| author | Stephen Paul Weber
<singpolyma@singpolyma.net> 2025-04-16 02:51:24 UTC |
| committer | Stephen Paul Weber
<singpolyma@singpolyma.net> 2025-04-16 03:03:50 UTC |
| .gitignore | +3 | -0 |
| .gitmodules | +15 | -0 |
| COPYING | +204 | -0 |
| Package.swift | +201 | -0 |
| README.md | +9 | -0 |
| Sources/Snikket/Snikket.swift | +2072 | -0 |
| Sources/c_snikket/iinclude/Array.h | +1186 | -0 |
| Sources/c_snikket/iinclude/Date.h | +95 | -0 |
| Sources/c_snikket/iinclude/Dynamic.h | +477 | -0 |
| Sources/c_snikket/iinclude/EReg.h | +69 | -0 |
| Sources/c_snikket/iinclude/Enum.h | +158 | -0 |
| Sources/c_snikket/iinclude/HaxeCBridge.h | +44 | -0 |
| Sources/c_snikket/iinclude/Lambda.h | +76 | -0 |
| Sources/c_snikket/iinclude/Reflect.h | +91 | -0 |
| Sources/c_snikket/iinclude/Std.h | +83 | -0 |
| Sources/c_snikket/iinclude/StringBuf.h | +78 | -0 |
| Sources/c_snikket/iinclude/StringTools.h | +88 | -0 |
| Sources/c_snikket/iinclude/Sys.h | +67 | -0 |
| Sources/c_snikket/iinclude/Type.h | +71 | -0 |
| Sources/c_snikket/iinclude/ValueType.h | +47 | -0 |
| Sources/c_snikket/iinclude/Xml.h | +114 | -0 |
| Sources/c_snikket/iinclude/_HaxeCBridge/Int64Map_Impl_.h | +62 | -0 |
| Sources/c_snikket/iinclude/_HaxeCBridge/Internal.h | +68 | -0 |
| Sources/c_snikket/iinclude/_UnicodeString/UnicodeString_Impl_.h | +66 | -0 |
| Sources/c_snikket/iinclude/_Xml/XmlType_Impl_.h | +60 | -0 |
| Sources/c_snikket/iinclude/cpp/CppInt32__.h | +92 | -0 |
| Sources/c_snikket/iinclude/cpp/FastIterator.h | +108 | -0 |
| Sources/c_snikket/iinclude/cpp/Int64.h | +148 | -0 |
| Sources/c_snikket/iinclude/cpp/Lib.h | +56 | -0 |
| Sources/c_snikket/iinclude/cpp/Pointer.h | +558 | -0 |
| Sources/c_snikket/iinclude/cpp/Variant.h | +674 | -0 |
| Sources/c_snikket/iinclude/cpp/VirtualArray.h | +724 | -0 |
| Sources/c_snikket/iinclude/datetime/_DateTime/DateTime_Impl_.h | +68 | -0 |
| Sources/c_snikket/iinclude/datetime/_DateTimeInterval/DateTimeInterval_Impl_.h | +63 | -0 |
| Sources/c_snikket/iinclude/datetime/cores/DateTimeIntervalCore.h | +92 | -0 |
| Sources/c_snikket/iinclude/datetime/utils/DateTimeIntervalUtils.h | +63 | -0 |
| Sources/c_snikket/iinclude/datetime/utils/DateTimeMonthUtils.h | +71 | -0 |
| Sources/c_snikket/iinclude/datetime/utils/DateTimeUtils.h | +71 | -0 |
| Sources/c_snikket/iinclude/haxe/EntryPoint.h | +60 | -0 |
| Sources/c_snikket/iinclude/haxe/Exception.h | +65 | -0 |
| Sources/c_snikket/iinclude/haxe/IMap.h | +31 | -0 |
| Sources/c_snikket/iinclude/haxe/Log.h | +62 | -0 |
| Sources/c_snikket/iinclude/haxe/MainEvent.h | +57 | -0 |
| Sources/c_snikket/iinclude/haxe/MainLoop.h | +69 | -0 |
| Sources/c_snikket/iinclude/haxe/NativeStackTrace.h | +66 | -0 |
| Sources/c_snikket/iinclude/haxe/StackItem.h | +41 | -0 |
| Sources/c_snikket/iinclude/haxe/Timer.h | +65 | -0 |
| Sources/c_snikket/iinclude/haxe/ValueException.h | +55 | -0 |
| Sources/c_snikket/iinclude/haxe/crypto/Base64.h | +78 | -0 |
| Sources/c_snikket/iinclude/haxe/crypto/BaseCode.h | +65 | -0 |
| Sources/c_snikket/iinclude/haxe/crypto/Sha1.h | +81 | -0 |
| Sources/c_snikket/iinclude/haxe/crypto/Sha256.h | +75 | -0 |
| Sources/c_snikket/iinclude/haxe/ds/BalancedTree.h | +83 | -0 |
| Sources/c_snikket/iinclude/haxe/ds/Either.h | +37 | -0 |
| Sources/c_snikket/iinclude/haxe/ds/EnumValueMap.h | +65 | -0 |
| Sources/c_snikket/iinclude/haxe/ds/IntMap.h | +102 | -0 |
| Sources/c_snikket/iinclude/haxe/ds/List.h | +62 | -0 |
| Sources/c_snikket/iinclude/haxe/ds/ObjectMap.h | +96 | -0 |
| Sources/c_snikket/iinclude/haxe/ds/Option.h | +37 | -0 |
| Sources/c_snikket/iinclude/haxe/ds/StringMap.h | +111 | -0 |
| Sources/c_snikket/iinclude/haxe/ds/TreeNode.h | +119 | -0 |
| Sources/c_snikket/iinclude/haxe/ds/_List/ListNode.h | +74 | -0 |
| Sources/c_snikket/iinclude/haxe/exceptions/NotImplementedException.h | +71 | -0 |
| Sources/c_snikket/iinclude/haxe/exceptions/PosException.h | +82 | -0 |
| Sources/c_snikket/iinclude/haxe/format/JsonParser.h | +69 | -0 |
| Sources/c_snikket/iinclude/haxe/format/JsonPrinter.h | +75 | -0 |
| Sources/c_snikket/iinclude/haxe/http/HttpBase.h | +90 | -0 |
| Sources/c_snikket/iinclude/haxe/io/Bytes.h | +86 | -0 |
| Sources/c_snikket/iinclude/haxe/io/BytesBuffer.h | +57 | -0 |
| Sources/c_snikket/iinclude/haxe/io/BytesInput.h | +65 | -0 |
| Sources/c_snikket/iinclude/haxe/io/BytesOutput.h | +66 | -0 |
| Sources/c_snikket/iinclude/haxe/io/Encoding.h | +37 | -0 |
| Sources/c_snikket/iinclude/haxe/io/Eof.h | +67 | -0 |
| Sources/c_snikket/iinclude/haxe/io/Error.h | +41 | -0 |
| Sources/c_snikket/iinclude/haxe/io/Input.h | +81 | -0 |
| Sources/c_snikket/iinclude/haxe/io/Output.h | +82 | -0 |
| Sources/c_snikket/iinclude/haxe/io/Path.h | +78 | -0 |
| Sources/c_snikket/iinclude/haxe/iterators/ArrayIterator.h | +78 | -0 |
| Sources/c_snikket/iinclude/haxe/iterators/MapKeyValueIterator.h | +61 | -0 |
| Sources/c_snikket/iinclude/haxe/xml/Parser.h | +71 | -0 |
| Sources/c_snikket/iinclude/haxe/xml/Printer.h | +66 | -0 |
| Sources/c_snikket/iinclude/haxe/xml/XmlParserException.h | +60 | -0 |
| Sources/c_snikket/iinclude/hsluv/Hsluv.h | +138 | -0 |
| Sources/c_snikket/iinclude/htmlparser/HtmlAttribute.h | +72 | -0 |
| Sources/c_snikket/iinclude/htmlparser/HtmlNode.h | +63 | -0 |
| Sources/c_snikket/iinclude/htmlparser/HtmlNodeElement.h | +62 | -0 |
| Sources/c_snikket/iinclude/htmlparser/HtmlNodeText.h | +58 | -0 |
| Sources/c_snikket/iinclude/htmlparser/HtmlParser.h | +98 | -0 |
| Sources/c_snikket/iinclude/htmlparser/HtmlParserException.h | +77 | -0 |
| Sources/c_snikket/iinclude/htmlparser/HtmlTools.h | +67 | -0 |
| Sources/c_snikket/iinclude/httpstatus/_HttpStatusMessage/HttpStatusMessage_Impl_.h | +62 | -0 |
| Sources/c_snikket/iinclude/hx/Anon.h | +752 | -0 |
| Sources/c_snikket/iinclude/hx/Boot.h | +15 | -0 |
| Sources/c_snikket/iinclude/hx/CFFI.h | +469 | -0 |
| Sources/c_snikket/iinclude/hx/CFFIAPI.h | +189 | -0 |
| Sources/c_snikket/iinclude/hx/CFFIJsPrime.h | +202 | -0 |
| Sources/c_snikket/iinclude/hx/CFFILoader.h | +330 | -0 |
| Sources/c_snikket/iinclude/hx/CFFINekoLoader.h | +723 | -0 |
| Sources/c_snikket/iinclude/hx/CFFIPrime.h | +1101 | -0 |
| Sources/c_snikket/iinclude/hx/Class.h | +294 | -0 |
| Sources/c_snikket/iinclude/hx/Debug.h | +376 | -0 |
| Sources/c_snikket/iinclude/hx/DynamicImpl.h | +1060 | -0 |
| Sources/c_snikket/iinclude/hx/DynamicImpl.tpl | +210 | -0 |
| Sources/c_snikket/iinclude/hx/ErrorCodes.h | +27 | -0 |
| Sources/c_snikket/iinclude/hx/FieldRef.h | +302 | -0 |
| Sources/c_snikket/iinclude/hx/Functions.h | +28 | -0 |
| Sources/c_snikket/iinclude/hx/GC.h | +594 | -0 |
| Sources/c_snikket/iinclude/hx/GcTypeInference.h | +161 | -0 |
| Sources/c_snikket/iinclude/hx/GenMacro.hx | +135 | -0 |
| Sources/c_snikket/iinclude/hx/HeaderVersion.h | +3 | -0 |
| Sources/c_snikket/iinclude/hx/HxcppMain.h | +114 | -0 |
| Sources/c_snikket/iinclude/hx/IndexRef.h | +9 | -0 |
| Sources/c_snikket/iinclude/hx/Interface.h | +31 | -0 |
| Sources/c_snikket/iinclude/hx/LessThanEq.h | +473 | -0 |
| Sources/c_snikket/iinclude/hx/Macros.h | +1099 | -0 |
| Sources/c_snikket/iinclude/hx/Macros.tpl | +191 | -0 |
| Sources/c_snikket/iinclude/hx/MacrosFixed.h | +320 | -0 |
| Sources/c_snikket/iinclude/hx/MacrosJumbo.h | +402 | -0 |
| Sources/c_snikket/iinclude/hx/MacrosJumbo.tpl | +25 | -0 |
| Sources/c_snikket/iinclude/hx/Memory.h | +32 | -0 |
| Sources/c_snikket/iinclude/hx/Native.h | +183 | -0 |
| Sources/c_snikket/iinclude/hx/NekoFunc.h | +118 | -0 |
| Sources/c_snikket/iinclude/hx/OS.h | +96 | -0 |
| Sources/c_snikket/iinclude/hx/ObjcHelpers.h | +222 | -0 |
| Sources/c_snikket/iinclude/hx/Object.h | +407 | -0 |
| Sources/c_snikket/iinclude/hx/Operators.h | +439 | -0 |
| Sources/c_snikket/iinclude/hx/QuickVec.h | +204 | -0 |
| Sources/c_snikket/iinclude/hx/Scriptable.h | +275 | -0 |
| Sources/c_snikket/iinclude/hx/StackContext.h | +746 | -0 |
| Sources/c_snikket/iinclude/hx/StdLibs.h | +925 | -0 |
| Sources/c_snikket/iinclude/hx/StdString.h | +30 | -0 |
| Sources/c_snikket/iinclude/hx/StringAlloc.h | +53 | -0 |
| Sources/c_snikket/iinclude/hx/Telemetry.h | +35 | -0 |
| Sources/c_snikket/iinclude/hx/TelemetryTracy.h | +44 | -0 |
| Sources/c_snikket/iinclude/hx/Thread.h | +345 | -0 |
| Sources/c_snikket/iinclude/hx/Tls.h | +165 | -0 |
| Sources/c_snikket/iinclude/hx/Undefine.h | +28 | -0 |
| Sources/c_snikket/iinclude/hx/Unordered.h | +38 | -0 |
| Sources/c_snikket/iinclude/hx/strings/RandomStrings.h | +74 | -0 |
| Sources/c_snikket/iinclude/hx/strings/StringBuilder.h | +70 | -0 |
| Sources/c_snikket/iinclude/hx/strings/Strings.h | +62 | -0 |
| Sources/c_snikket/iinclude/hx/strings/internal/_Either2/_Either2.h | +41 | -0 |
| Sources/c_snikket/iinclude/hxMath.h | +84 | -0 |
| Sources/c_snikket/iinclude/hxString.h | +404 | -0 |
| Sources/c_snikket/iinclude/hxcpp.h | +362 | -0 |
| Sources/c_snikket/iinclude/include/Date.h | +95 | -0 |
| Sources/c_snikket/iinclude/include/EReg.h | +69 | -0 |
| Sources/c_snikket/iinclude/include/HaxeCBridge.h | +44 | -0 |
| Sources/c_snikket/iinclude/include/Lambda.h | +76 | -0 |
| Sources/c_snikket/iinclude/include/Reflect.h | +91 | -0 |
| Sources/c_snikket/iinclude/include/Std.h | +83 | -0 |
| Sources/c_snikket/iinclude/include/StringBuf.h | +78 | -0 |
| Sources/c_snikket/iinclude/include/StringTools.h | +88 | -0 |
| Sources/c_snikket/iinclude/include/Sys.h | +67 | -0 |
| Sources/c_snikket/iinclude/include/Type.h | +71 | -0 |
| Sources/c_snikket/iinclude/include/ValueType.h | +47 | -0 |
| Sources/c_snikket/iinclude/include/Xml.h | +114 | -0 |
| Sources/c_snikket/iinclude/include/_HaxeCBridge/Int64Map_Impl_.h | +62 | -0 |
| Sources/c_snikket/iinclude/include/_HaxeCBridge/Internal.h | +68 | -0 |
| Sources/c_snikket/iinclude/include/_UnicodeString/UnicodeString_Impl_.h | +66 | -0 |
| Sources/c_snikket/iinclude/include/_Xml/XmlType_Impl_.h | +60 | -0 |
| Sources/c_snikket/iinclude/include/cpp/Lib.h | +56 | -0 |
| Sources/c_snikket/iinclude/include/datetime/_DateTime/DateTime_Impl_.h | +68 | -0 |
| Sources/c_snikket/iinclude/include/datetime/_DateTimeInterval/DateTimeInterval_Impl_.h | +63 | -0 |
| Sources/c_snikket/iinclude/include/datetime/cores/DateTimeIntervalCore.h | +92 | -0 |
| Sources/c_snikket/iinclude/include/datetime/utils/DateTimeIntervalUtils.h | +63 | -0 |
| Sources/c_snikket/iinclude/include/datetime/utils/DateTimeMonthUtils.h | +71 | -0 |
| Sources/c_snikket/iinclude/include/datetime/utils/DateTimeUtils.h | +71 | -0 |
| Sources/c_snikket/iinclude/include/haxe/EntryPoint.h | +60 | -0 |
| Sources/c_snikket/iinclude/include/haxe/Exception.h | +65 | -0 |
| Sources/c_snikket/iinclude/include/haxe/IMap.h | +31 | -0 |
| Sources/c_snikket/iinclude/include/haxe/Log.h | +62 | -0 |
| Sources/c_snikket/iinclude/include/haxe/MainEvent.h | +57 | -0 |
| Sources/c_snikket/iinclude/include/haxe/MainLoop.h | +69 | -0 |
| Sources/c_snikket/iinclude/include/haxe/NativeStackTrace.h | +66 | -0 |
| Sources/c_snikket/iinclude/include/haxe/StackItem.h | +41 | -0 |
| Sources/c_snikket/iinclude/include/haxe/Timer.h | +65 | -0 |
| Sources/c_snikket/iinclude/include/haxe/ValueException.h | +55 | -0 |
| Sources/c_snikket/iinclude/include/haxe/crypto/Base64.h | +78 | -0 |
| Sources/c_snikket/iinclude/include/haxe/crypto/BaseCode.h | +65 | -0 |
| Sources/c_snikket/iinclude/include/haxe/crypto/Sha1.h | +81 | -0 |
| Sources/c_snikket/iinclude/include/haxe/crypto/Sha256.h | +75 | -0 |
| Sources/c_snikket/iinclude/include/haxe/ds/BalancedTree.h | +83 | -0 |
| Sources/c_snikket/iinclude/include/haxe/ds/Either.h | +37 | -0 |
| Sources/c_snikket/iinclude/include/haxe/ds/EnumValueMap.h | +65 | -0 |
| Sources/c_snikket/iinclude/include/haxe/ds/IntMap.h | +102 | -0 |
| Sources/c_snikket/iinclude/include/haxe/ds/List.h | +62 | -0 |
| Sources/c_snikket/iinclude/include/haxe/ds/ObjectMap.h | +96 | -0 |
| Sources/c_snikket/iinclude/include/haxe/ds/Option.h | +37 | -0 |
| Sources/c_snikket/iinclude/include/haxe/ds/StringMap.h | +111 | -0 |
| Sources/c_snikket/iinclude/include/haxe/ds/TreeNode.h | +119 | -0 |
| Sources/c_snikket/iinclude/include/haxe/ds/_List/ListNode.h | +74 | -0 |
| Sources/c_snikket/iinclude/include/haxe/exceptions/NotImplementedException.h | +71 | -0 |
| Sources/c_snikket/iinclude/include/haxe/exceptions/PosException.h | +82 | -0 |
| Sources/c_snikket/iinclude/include/haxe/format/JsonParser.h | +69 | -0 |
| Sources/c_snikket/iinclude/include/haxe/format/JsonPrinter.h | +75 | -0 |
| Sources/c_snikket/iinclude/include/haxe/http/HttpBase.h | +90 | -0 |
| Sources/c_snikket/iinclude/include/haxe/io/Bytes.h | +86 | -0 |
| Sources/c_snikket/iinclude/include/haxe/io/BytesBuffer.h | +57 | -0 |
| Sources/c_snikket/iinclude/include/haxe/io/BytesInput.h | +65 | -0 |
| Sources/c_snikket/iinclude/include/haxe/io/BytesOutput.h | +66 | -0 |
| Sources/c_snikket/iinclude/include/haxe/io/Encoding.h | +37 | -0 |
| Sources/c_snikket/iinclude/include/haxe/io/Eof.h | +67 | -0 |
| Sources/c_snikket/iinclude/include/haxe/io/Error.h | +41 | -0 |
| Sources/c_snikket/iinclude/include/haxe/io/Input.h | +81 | -0 |
| Sources/c_snikket/iinclude/include/haxe/io/Output.h | +82 | -0 |
| Sources/c_snikket/iinclude/include/haxe/io/Path.h | +78 | -0 |
| Sources/c_snikket/iinclude/include/haxe/iterators/ArrayIterator.h | +78 | -0 |
| Sources/c_snikket/iinclude/include/haxe/iterators/MapKeyValueIterator.h | +61 | -0 |
| Sources/c_snikket/iinclude/include/haxe/xml/Parser.h | +71 | -0 |
| Sources/c_snikket/iinclude/include/haxe/xml/Printer.h | +66 | -0 |
| Sources/c_snikket/iinclude/include/haxe/xml/XmlParserException.h | +60 | -0 |
| Sources/c_snikket/iinclude/include/hsluv/Hsluv.h | +138 | -0 |
| Sources/c_snikket/iinclude/include/htmlparser/HtmlAttribute.h | +72 | -0 |
| Sources/c_snikket/iinclude/include/htmlparser/HtmlNode.h | +63 | -0 |
| Sources/c_snikket/iinclude/include/htmlparser/HtmlNodeElement.h | +62 | -0 |
| Sources/c_snikket/iinclude/include/htmlparser/HtmlNodeText.h | +58 | -0 |
| Sources/c_snikket/iinclude/include/htmlparser/HtmlParser.h | +98 | -0 |
| Sources/c_snikket/iinclude/include/htmlparser/HtmlParserException.h | +77 | -0 |
| Sources/c_snikket/iinclude/include/htmlparser/HtmlTools.h | +67 | -0 |
| Sources/c_snikket/iinclude/include/httpstatus/_HttpStatusMessage/HttpStatusMessage_Impl_.h | +62 | -0 |
| Sources/c_snikket/iinclude/include/hx/strings/RandomStrings.h | +74 | -0 |
| Sources/c_snikket/iinclude/include/hx/strings/StringBuilder.h | +70 | -0 |
| Sources/c_snikket/iinclude/include/hx/strings/Strings.h | +62 | -0 |
| Sources/c_snikket/iinclude/include/hx/strings/internal/_Either2/_Either2.h | +41 | -0 |
| Sources/c_snikket/iinclude/include/sha/Hash.h | +60 | -0 |
| Sources/c_snikket/iinclude/include/sha/SHA256.h | +86 | -0 |
| Sources/c_snikket/iinclude/include/sha/_SHA256/SHA256_Fields_.h | +62 | -0 |
| Sources/c_snikket/iinclude/include/snikket/AttachmentSource.h | +72 | -0 |
| Sources/c_snikket/iinclude/include/snikket/Autolink.h | +90 | -0 |
| Sources/c_snikket/iinclude/include/snikket/AvailableChat.h | +69 | -0 |
| Sources/c_snikket/iinclude/include/snikket/Builder.h | +62 | -0 |
| Sources/c_snikket/iinclude/include/snikket/Caps.h | +83 | -0 |
| Sources/c_snikket/iinclude/include/snikket/Channel.h | +144 | -0 |
| Sources/c_snikket/iinclude/include/snikket/Chat.h | +295 | -0 |
| Sources/c_snikket/iinclude/include/snikket/ChatAttachment.h | +75 | -0 |
| Sources/c_snikket/iinclude/include/snikket/ChatMessage.h | +172 | -0 |
| Sources/c_snikket/iinclude/include/snikket/ChatMessageBuilder.h | +189 | -0 |
| Sources/c_snikket/iinclude/include/snikket/Client.h | +279 | -0 |
| Sources/c_snikket/iinclude/include/snikket/Color.h | +63 | -0 |
| Sources/c_snikket/iinclude/include/snikket/Config.h | +60 | -0 |
| Sources/c_snikket/iinclude/include/snikket/CustomEmojiReaction.h | +62 | -0 |
| Sources/c_snikket/iinclude/include/snikket/Date.h | +61 | -0 |
| Sources/c_snikket/iinclude/include/snikket/DirectChat.h | +96 | -0 |
| Sources/c_snikket/iinclude/include/snikket/Emoji.h | +69 | -0 |
| Sources/c_snikket/iinclude/include/snikket/EmojiUtil.h | +95 | -0 |
| Sources/c_snikket/iinclude/include/snikket/EventEmitter.h | +64 | -0 |
| Sources/c_snikket/iinclude/include/snikket/EventHandler.h | +64 | -0 |
| Sources/c_snikket/iinclude/include/snikket/EventResult.h | +39 | -0 |
| Sources/c_snikket/iinclude/include/snikket/GenericStream.h | +72 | -0 |
| Sources/c_snikket/iinclude/include/snikket/Hash.h | +89 | -0 |
| Sources/c_snikket/iinclude/include/snikket/ID.h | +69 | -0 |
| Sources/c_snikket/iinclude/include/snikket/Identicon.h | +60 | -0 |
| Sources/c_snikket/iinclude/include/snikket/Identity.h | +61 | -0 |
| Sources/c_snikket/iinclude/include/snikket/IqRequestType.h | +35 | -0 |
| Sources/c_snikket/iinclude/include/snikket/IqResult.h | +39 | -0 |
| Sources/c_snikket/iinclude/include/snikket/JID.h | +78 | -0 |
| Sources/c_snikket/iinclude/include/snikket/Message.h | +63 | -0 |
| Sources/c_snikket/iinclude/include/snikket/MessageStanza.h | +46 | -0 |
| Sources/c_snikket/iinclude/include/snikket/MessageSync.h | +91 | -0 |
| Sources/c_snikket/iinclude/include/snikket/ModerationAction.h | +76 | -0 |
| Sources/c_snikket/iinclude/include/snikket/Node.h | +38 | -0 |
| Sources/c_snikket/iinclude/include/snikket/Notification.h | +98 | -0 |
| Sources/c_snikket/iinclude/include/snikket/Other.h | +69 | -0 |
| Sources/c_snikket/iinclude/include/snikket/Participant.h | +88 | -0 |
| Sources/c_snikket/iinclude/include/snikket/Persistence.h | +129 | -0 |
| Sources/c_snikket/iinclude/include/snikket/Presence.h | +55 | -0 |
| Sources/c_snikket/iinclude/include/snikket/PubsubEvent.h | +69 | -0 |
| Sources/c_snikket/iinclude/include/snikket/Reaction.h | +75 | -0 |
| Sources/c_snikket/iinclude/include/snikket/ReactionUpdate.h | +72 | -0 |
| Sources/c_snikket/iinclude/include/snikket/SerializedChat.h | +76 | -0 |
| Sources/c_snikket/iinclude/include/snikket/Stanza.h | +149 | -0 |
| Sources/c_snikket/iinclude/include/snikket/StanzaError.h | +72 | -0 |
| Sources/c_snikket/iinclude/include/snikket/StringUtil.h | +63 | -0 |
| Sources/c_snikket/iinclude/include/snikket/Symbol.h | +49 | -0 |
| Sources/c_snikket/iinclude/include/snikket/TextNode.h | +67 | -0 |
| Sources/c_snikket/iinclude/include/snikket/UnicodeBlocks.h | +59 | -0 |
| Sources/c_snikket/iinclude/include/snikket/UnicodeList.h | +59 | -0 |
| Sources/c_snikket/iinclude/include/snikket/UnicodeRange.h | +58 | -0 |
| Sources/c_snikket/iinclude/include/snikket/UnicodeSet.h | +27 | -0 |
| Sources/c_snikket/iinclude/include/snikket/XEP0393.h | +84 | -0 |
| Sources/c_snikket/iinclude/include/snikket/_Push/Push_Fields_.h | +64 | -0 |
| Sources/c_snikket/iinclude/include/snikket/_Stanza/NodeInterface.h | +34 | -0 |
| Sources/c_snikket/iinclude/include/snikket/_Util/Util_Fields_.h | +68 | -0 |
| Sources/c_snikket/iinclude/include/snikket/jingle/Attribute.h | +79 | -0 |
| Sources/c_snikket/iinclude/include/snikket/jingle/AudioFormat.h | +84 | -0 |
| Sources/c_snikket/iinclude/include/snikket/jingle/DTMFSender.h | +69 | -0 |
| Sources/c_snikket/iinclude/include/snikket/jingle/Group.h | +69 | -0 |
| Sources/c_snikket/iinclude/include/snikket/jingle/IceCandidate.h | +84 | -0 |
| Sources/c_snikket/iinclude/include/snikket/jingle/IncomingProposedSession.h | +114 | -0 |
| Sources/c_snikket/iinclude/include/snikket/jingle/InitiatedSession.h | +160 | -0 |
| Sources/c_snikket/iinclude/include/snikket/jingle/Media.h | +82 | -0 |
| Sources/c_snikket/iinclude/include/snikket/jingle/MediaStream.h | +68 | -0 |
| Sources/c_snikket/iinclude/include/snikket/jingle/MediaStreamTrack.h | +159 | -0 |
| Sources/c_snikket/iinclude/include/snikket/jingle/OutgoingProposedSession.h | +117 | -0 |
| Sources/c_snikket/iinclude/include/snikket/jingle/OutgoingSession.h | +63 | -0 |
| Sources/c_snikket/iinclude/include/snikket/jingle/PeerConnection.h | +119 | -0 |
| Sources/c_snikket/iinclude/include/snikket/jingle/Session.h | +84 | -0 |
| Sources/c_snikket/iinclude/include/snikket/jingle/SessionDescription.h | +86 | -0 |
| Sources/c_snikket/iinclude/include/snikket/jingle/TransportInfo.h | +60 | -0 |
| Sources/c_snikket/iinclude/include/snikket/jingle/_Session/Session_Fields_.h | +68 | -0 |
| Sources/c_snikket/iinclude/include/snikket/persistence/Dummy.h | +138 | -0 |
| Sources/c_snikket/iinclude/include/snikket/persistence/KeyValueStore.h | +33 | -0 |
| Sources/c_snikket/iinclude/include/snikket/persistence/MediaStore.h | +42 | -0 |
| Sources/c_snikket/iinclude/include/snikket/persistence/MediaStoreFS.h | +86 | -0 |
| Sources/c_snikket/iinclude/include/snikket/persistence/Sqlite.h | +180 | -0 |
| Sources/c_snikket/iinclude/include/snikket/persistence/SqliteDriver.h | +61 | -0 |
| Sources/c_snikket/iinclude/include/snikket/queries/BlocklistGet.h | +67 | -0 |
| Sources/c_snikket/iinclude/include/snikket/queries/BoB.h | +72 | -0 |
| Sources/c_snikket/iinclude/include/snikket/queries/DiscoInfoGet.h | +68 | -0 |
| Sources/c_snikket/iinclude/include/snikket/queries/DiscoItemsGet.h | +67 | -0 |
| Sources/c_snikket/iinclude/include/snikket/queries/ExtDiscoGet.h | +67 | -0 |
| Sources/c_snikket/iinclude/include/snikket/queries/GenericQuery.h | +65 | -0 |
| Sources/c_snikket/iinclude/include/snikket/queries/HttpUploadSlot.h | +68 | -0 |
| Sources/c_snikket/iinclude/include/snikket/queries/JabberIqGatewayGet.h | +68 | -0 |
| Sources/c_snikket/iinclude/include/snikket/queries/MAMQuery.h | +73 | -0 |
| Sources/c_snikket/iinclude/include/snikket/queries/PubsubGet.h | +68 | -0 |
| Sources/c_snikket/iinclude/include/snikket/queries/Push2Disable.h | +63 | -0 |
| Sources/c_snikket/iinclude/include/snikket/queries/RosterGet.h | +68 | -0 |
| Sources/c_snikket/iinclude/include/snikket/queries/VcardTempGet.h | +68 | -0 |
| Sources/c_snikket/iinclude/include/snikket/streams/XmppStropheStream.h | +103 | -0 |
| Sources/c_snikket/iinclude/include/sys/FileSystem.h | +75 | -0 |
| Sources/c_snikket/iinclude/include/sys/Http.h | +88 | -0 |
| Sources/c_snikket/iinclude/include/sys/db/Connection.h | +34 | -0 |
| Sources/c_snikket/iinclude/include/sys/db/ResultSet.h | +33 | -0 |
| Sources/c_snikket/iinclude/include/sys/db/Sqlite.h | +63 | -0 |
| Sources/c_snikket/iinclude/include/sys/db/_Sqlite/SqliteConnection.h | +67 | -0 |
| Sources/c_snikket/iinclude/include/sys/db/_Sqlite/SqliteResultSet.h | +68 | -0 |
| Sources/c_snikket/iinclude/include/sys/io/File.h | +73 | -0 |
| Sources/c_snikket/iinclude/include/sys/io/FileInput.h | +64 | -0 |
| Sources/c_snikket/iinclude/include/sys/io/FileOutput.h | +64 | -0 |
| Sources/c_snikket/iinclude/include/sys/io/Process.h | +61 | -0 |
| Sources/c_snikket/iinclude/include/sys/io/_Process/Stdin.h | +67 | -0 |
| Sources/c_snikket/iinclude/include/sys/io/_Process/Stdout.h | +66 | -0 |
| Sources/c_snikket/iinclude/include/sys/net/Host.h | +94 | -0 |
| Sources/c_snikket/iinclude/include/sys/net/Socket.h | +82 | -0 |
| Sources/c_snikket/iinclude/include/sys/net/_Socket/SocketInput.h | +66 | -0 |
| Sources/c_snikket/iinclude/include/sys/net/_Socket/SocketOutput.h | +66 | -0 |
| Sources/c_snikket/iinclude/include/sys/ssl/Certificate.h | +85 | -0 |
| Sources/c_snikket/iinclude/include/sys/ssl/Key.h | +73 | -0 |
| Sources/c_snikket/iinclude/include/sys/ssl/Socket.h | +88 | -0 |
| Sources/c_snikket/iinclude/include/sys/ssl/_Socket/SocketInput.h | +68 | -0 |
| Sources/c_snikket/iinclude/include/sys/ssl/_Socket/SocketOutput.h | +68 | -0 |
| Sources/c_snikket/iinclude/include/sys/thread/EventLoop.h | +80 | -0 |
| Sources/c_snikket/iinclude/include/sys/thread/Lock.h | +76 | -0 |
| Sources/c_snikket/iinclude/include/sys/thread/Mutex.h | +76 | -0 |
| Sources/c_snikket/iinclude/include/sys/thread/NoEventLoopException.h | +70 | -0 |
| Sources/c_snikket/iinclude/include/sys/thread/_EventLoop/RegularEvent.h | +81 | -0 |
| Sources/c_snikket/iinclude/include/sys/thread/_Thread/HaxeThread.h | +76 | -0 |
| Sources/c_snikket/iinclude/include/sys/thread/_Thread/Thread_Impl_.h | +69 | -0 |
| Sources/c_snikket/iinclude/include/thenshim/PromiseFactory.h | +36 | -0 |
| Sources/c_snikket/iinclude/include/thenshim/PromiseTools.h | +64 | -0 |
| Sources/c_snikket/iinclude/include/thenshim/Thenable.h | +27 | -0 |
| Sources/c_snikket/iinclude/include/thenshim/_Promise/Promise_Impl_.h | +75 | -0 |
| Sources/c_snikket/iinclude/include/thenshim/fallback/FallbackPromise.h | +77 | -0 |
| Sources/c_snikket/iinclude/include/thenshim/fallback/FallbackPromiseFactory.h | +75 | -0 |
| Sources/c_snikket/iinclude/include/thenshim/fallback/HandlerSession.h | +84 | -0 |
| Sources/c_snikket/iinclude/include/thenshim/fallback/PromiseState.h | +39 | -0 |
| Sources/c_snikket/iinclude/include/thenshim/fallback/TaskScheduler.h | +72 | -0 |
| Sources/c_snikket/iinclude/include/tink/_Chunk/Chunk_Impl_.h | +68 | -0 |
| Sources/c_snikket/iinclude/include/tink/_Chunk/EmptyChunk.h | +77 | -0 |
| Sources/c_snikket/iinclude/include/tink/_Url/Url_Impl_.h | +80 | -0 |
| Sources/c_snikket/iinclude/include/tink/chunk/ByteChunk.h | +90 | -0 |
| Sources/c_snikket/iinclude/include/tink/chunk/ChunkBase.h | +73 | -0 |
| Sources/c_snikket/iinclude/include/tink/chunk/ChunkCursor.h | +91 | -0 |
| Sources/c_snikket/iinclude/include/tink/chunk/ChunkObject.h | +57 | -0 |
| Sources/c_snikket/iinclude/include/tink/chunk/CompoundChunk.h | +97 | -0 |
| Sources/c_snikket/iinclude/include/tink/core/CallbackLinkRef.h | +61 | -0 |
| Sources/c_snikket/iinclude/include/tink/core/CallbackList.h | +81 | -0 |
| Sources/c_snikket/iinclude/include/tink/core/Disposable.h | +25 | -0 |
| Sources/c_snikket/iinclude/include/tink/core/FutureStatus.h | +45 | -0 |
| Sources/c_snikket/iinclude/include/tink/core/LinkObject.h | +29 | -0 |
| Sources/c_snikket/iinclude/include/tink/core/MPair.h | +72 | -0 |
| Sources/c_snikket/iinclude/include/tink/core/NamedWith.h | +72 | -0 |
| Sources/c_snikket/iinclude/include/tink/core/Outcome.h | +37 | -0 |
| Sources/c_snikket/iinclude/include/tink/core/OwnedDisposable.h | +29 | -0 |
| Sources/c_snikket/iinclude/include/tink/core/SimpleDisposable.h | +68 | -0 |
| Sources/c_snikket/iinclude/include/tink/core/TypedError.h | +72 | -0 |
| Sources/c_snikket/iinclude/include/tink/core/_Callback/Callback_Impl_.h | +69 | -0 |
| Sources/c_snikket/iinclude/include/tink/core/_Callback/LinkPair.h | +65 | -0 |
| Sources/c_snikket/iinclude/include/tink/core/_Callback/ListCell.h | +69 | -0 |
| Sources/c_snikket/iinclude/include/tink/core/_Future/FutureObject.h | +61 | -0 |
| Sources/c_snikket/iinclude/include/tink/core/_Future/Future_Impl_.h | +79 | -0 |
| Sources/c_snikket/iinclude/include/tink/core/_Future/SuspendableFuture.h | +81 | -0 |
| Sources/c_snikket/iinclude/include/tink/core/_Future/SyncFuture.h | +69 | -0 |
| Sources/c_snikket/iinclude/include/tink/core/_Lazy/Computable.h | +39 | -0 |
| Sources/c_snikket/iinclude/include/tink/core/_Lazy/LazyConst.h | +73 | -0 |
| Sources/c_snikket/iinclude/include/tink/core/_Lazy/LazyFunc.h | +76 | -0 |
| Sources/c_snikket/iinclude/include/tink/core/_Lazy/LazyObject.h | +47 | -0 |
| Sources/c_snikket/iinclude/include/tink/core/_Lazy/Lazy_Impl_.h | +66 | -0 |
| Sources/c_snikket/iinclude/include/tink/core/_Promise/Promise_Impl_.h | +65 | -0 |
| Sources/c_snikket/iinclude/include/tink/http/BodyPart.h | +37 | -0 |
| Sources/c_snikket/iinclude/include/tink/http/ClientObject.h | +32 | -0 |
| Sources/c_snikket/iinclude/include/tink/http/ClientType.h | +46 | -0 |
| Sources/c_snikket/iinclude/include/tink/http/Container.h | +25 | -0 |
| Sources/c_snikket/iinclude/include/tink/http/Fetch.h | +74 | -0 |
| Sources/c_snikket/iinclude/include/tink/http/HandlerObject.h | +32 | -0 |
| Sources/c_snikket/iinclude/include/tink/http/Header.h | +68 | -0 |
| Sources/c_snikket/iinclude/include/tink/http/HeaderField.h | +76 | -0 |
| Sources/c_snikket/iinclude/include/tink/http/HeaderParser.h | +73 | -0 |
| Sources/c_snikket/iinclude/include/tink/http/IncomingRequest.h | +61 | -0 |
| Sources/c_snikket/iinclude/include/tink/http/IncomingRequestBody.h | +39 | -0 |
| Sources/c_snikket/iinclude/include/tink/http/IncomingRequestHeader.h | +54 | -0 |
| Sources/c_snikket/iinclude/include/tink/http/IncomingResponse.h | +54 | -0 |
| Sources/c_snikket/iinclude/include/tink/http/Message.h | +72 | -0 |
| Sources/c_snikket/iinclude/include/tink/http/OutgoingRequest.h | +55 | -0 |
| Sources/c_snikket/iinclude/include/tink/http/OutgoingRequestHeader.h | +63 | -0 |
| Sources/c_snikket/iinclude/include/tink/http/RequestHeader.h | +63 | -0 |
| Sources/c_snikket/iinclude/include/tink/http/ResponseHeaderBase.h | +68 | -0 |
| Sources/c_snikket/iinclude/include/tink/http/_Client/CustomClient.h | +79 | -0 |
| Sources/c_snikket/iinclude/include/tink/http/_Fetch/FetchResponse_Impl_.h | +65 | -0 |
| Sources/c_snikket/iinclude/include/tink/http/_Header/HeaderValue_Impl_.h | +67 | -0 |
| Sources/c_snikket/iinclude/include/tink/http/_Response/OutgoingResponseData.h | +56 | -0 |
| Sources/c_snikket/iinclude/include/tink/http/clients/CurlClient.h | +69 | -0 |
| Sources/c_snikket/iinclude/include/tink/http/clients/Helpers.h | +65 | -0 |
| Sources/c_snikket/iinclude/include/tink/http/clients/LocalContainerClient.h | +68 | -0 |
| Sources/c_snikket/iinclude/include/tink/http/clients/SocketClient.h | +67 | -0 |
| Sources/c_snikket/iinclude/include/tink/http/clients/StdClient.h | +67 | -0 |
| Sources/c_snikket/iinclude/include/tink/http/containers/LocalContainer.h | +68 | -0 |
| Sources/c_snikket/iinclude/include/tink/io/BytewiseParser.h | +76 | -0 |
| Sources/c_snikket/iinclude/include/tink/io/IdealSourceTools.h | +64 | -0 |
| Sources/c_snikket/iinclude/include/tink/io/ParseResult.h | +41 | -0 |
| Sources/c_snikket/iinclude/include/tink/io/ParseStep.h | +40 | -0 |
| Sources/c_snikket/iinclude/include/tink/io/PipeResult.h | +43 | -0 |
| Sources/c_snikket/iinclude/include/tink/io/PipeResultTools.h | +65 | -0 |
| Sources/c_snikket/iinclude/include/tink/io/RealSourceTools.h | +72 | -0 |
| Sources/c_snikket/iinclude/include/tink/io/SinkBase.h | +69 | -0 |
| Sources/c_snikket/iinclude/include/tink/io/SinkObject.h | +31 | -0 |
| Sources/c_snikket/iinclude/include/tink/io/StreamParserObject.h | +36 | -0 |
| Sources/c_snikket/iinclude/include/tink/io/WorkerObject.h | +32 | -0 |
| Sources/c_snikket/iinclude/include/tink/io/_Sink/SinkYielding_Impl_.h | +66 | -0 |
| Sources/c_snikket/iinclude/include/tink/io/_Source/Source_Impl_.h | +82 | -0 |
| Sources/c_snikket/iinclude/include/tink/io/_StreamParser/StreamParser_Impl_.h | +70 | -0 |
| Sources/c_snikket/iinclude/include/tink/io/_Worker/EagerWorker.h | +61 | -0 |
| Sources/c_snikket/iinclude/include/tink/io/_Worker/Worker_Impl_.h | +77 | -0 |
| Sources/c_snikket/iinclude/include/tink/io/std/InputSource.h | +58 | -0 |
| Sources/c_snikket/iinclude/include/tink/io/std/OutputSink.h | +68 | -0 |
| Sources/c_snikket/iinclude/include/tink/streams/Conclusion.h | +43 | -0 |
| Sources/c_snikket/iinclude/include/tink/streams/Empty.h | +65 | -0 |
| Sources/c_snikket/iinclude/include/tink/streams/FutureStream.h | +61 | -0 |
| Sources/c_snikket/iinclude/include/tink/streams/Generator.h | +61 | -0 |
| Sources/c_snikket/iinclude/include/tink/streams/Handled.h | +42 | -0 |
| Sources/c_snikket/iinclude/include/tink/streams/IdealStreamBase.h | +56 | -0 |
| Sources/c_snikket/iinclude/include/tink/streams/IdealizeStream.h | +67 | -0 |
| Sources/c_snikket/iinclude/include/tink/streams/Reduction.h | +41 | -0 |
| Sources/c_snikket/iinclude/include/tink/streams/ReductionStep.h | +38 | -0 |
| Sources/c_snikket/iinclude/include/tink/streams/RegroupResult.h | +44 | -0 |
| Sources/c_snikket/iinclude/include/tink/streams/RegroupStatus.h | +40 | -0 |
| Sources/c_snikket/iinclude/include/tink/streams/Single.h | +63 | -0 |
| Sources/c_snikket/iinclude/include/tink/streams/Step.h | +41 | -0 |
| Sources/c_snikket/iinclude/include/tink/streams/StreamBase.h | +77 | -0 |
| Sources/c_snikket/iinclude/include/tink/streams/StreamObject.h | +55 | -0 |
| Sources/c_snikket/iinclude/include/tink/streams/_Stream/CompoundStream.h | +75 | -0 |
| Sources/c_snikket/iinclude/include/tink/streams/_Stream/ErrorStream.h | +64 | -0 |
| Sources/c_snikket/iinclude/include/tink/streams/_Stream/Handler_Impl_.h | +69 | -0 |
| Sources/c_snikket/iinclude/include/tink/streams/_Stream/Reducer_Impl_.h | +66 | -0 |
| Sources/c_snikket/iinclude/include/tink/streams/_Stream/RegroupStream.h | +55 | -0 |
| Sources/c_snikket/iinclude/include/tink/streams/_Stream/Regrouper_Impl_.h | +65 | -0 |
| Sources/c_snikket/iinclude/include/tink/streams/_Stream/Stream_Impl_.h | +73 | -0 |
| Sources/c_snikket/iinclude/include/tink/url/_Host/Host_Impl_.h | +70 | -0 |
| Sources/c_snikket/iinclude/include/tink/url/_Path/Path_Impl_.h | +70 | -0 |
| Sources/c_snikket/iinclude/null.h | +236 | -0 |
| Sources/c_snikket/iinclude/sha/Hash.h | +60 | -0 |
| Sources/c_snikket/iinclude/sha/SHA256.h | +86 | -0 |
| Sources/c_snikket/iinclude/sha/_SHA256/SHA256_Fields_.h | +62 | -0 |
| Sources/c_snikket/iinclude/snikket/AttachmentSource.h | +72 | -0 |
| Sources/c_snikket/iinclude/snikket/Autolink.h | +90 | -0 |
| Sources/c_snikket/iinclude/snikket/AvailableChat.h | +69 | -0 |
| Sources/c_snikket/iinclude/snikket/Builder.h | +62 | -0 |
| Sources/c_snikket/iinclude/snikket/Caps.h | +83 | -0 |
| Sources/c_snikket/iinclude/snikket/Channel.h | +144 | -0 |
| Sources/c_snikket/iinclude/snikket/Chat.h | +295 | -0 |
| Sources/c_snikket/iinclude/snikket/ChatAttachment.h | +75 | -0 |
| Sources/c_snikket/iinclude/snikket/ChatMessage.h | +172 | -0 |
| Sources/c_snikket/iinclude/snikket/ChatMessageBuilder.h | +189 | -0 |
| Sources/c_snikket/iinclude/snikket/Client.h | +279 | -0 |
| Sources/c_snikket/iinclude/snikket/Color.h | +63 | -0 |
| Sources/c_snikket/iinclude/snikket/Config.h | +60 | -0 |
| Sources/c_snikket/iinclude/snikket/CustomEmojiReaction.h | +62 | -0 |
| Sources/c_snikket/iinclude/snikket/Date.h | +61 | -0 |
| Sources/c_snikket/iinclude/snikket/DirectChat.h | +96 | -0 |
| Sources/c_snikket/iinclude/snikket/Emoji.h | +69 | -0 |
| Sources/c_snikket/iinclude/snikket/EmojiUtil.h | +95 | -0 |
| Sources/c_snikket/iinclude/snikket/EventEmitter.h | +64 | -0 |
| Sources/c_snikket/iinclude/snikket/EventHandler.h | +64 | -0 |
| Sources/c_snikket/iinclude/snikket/EventResult.h | +39 | -0 |
| Sources/c_snikket/iinclude/snikket/GenericStream.h | +72 | -0 |
| Sources/c_snikket/iinclude/snikket/Hash.h | +89 | -0 |
| Sources/c_snikket/iinclude/snikket/ID.h | +69 | -0 |
| Sources/c_snikket/iinclude/snikket/Identicon.h | +60 | -0 |
| Sources/c_snikket/iinclude/snikket/Identity.h | +61 | -0 |
| Sources/c_snikket/iinclude/snikket/IqRequestType.h | +35 | -0 |
| Sources/c_snikket/iinclude/snikket/IqResult.h | +39 | -0 |
| Sources/c_snikket/iinclude/snikket/JID.h | +78 | -0 |
| Sources/c_snikket/iinclude/snikket/Message.h | +63 | -0 |
| Sources/c_snikket/iinclude/snikket/MessageStanza.h | +46 | -0 |
| Sources/c_snikket/iinclude/snikket/MessageSync.h | +91 | -0 |
| Sources/c_snikket/iinclude/snikket/ModerationAction.h | +76 | -0 |
| Sources/c_snikket/iinclude/snikket/Node.h | +38 | -0 |
| Sources/c_snikket/iinclude/snikket/Notification.h | +98 | -0 |
| Sources/c_snikket/iinclude/snikket/Other.h | +69 | -0 |
| Sources/c_snikket/iinclude/snikket/Participant.h | +88 | -0 |
| Sources/c_snikket/iinclude/snikket/Persistence.h | +129 | -0 |
| Sources/c_snikket/iinclude/snikket/Presence.h | +55 | -0 |
| Sources/c_snikket/iinclude/snikket/PubsubEvent.h | +69 | -0 |
| Sources/c_snikket/iinclude/snikket/Reaction.h | +75 | -0 |
| Sources/c_snikket/iinclude/snikket/ReactionUpdate.h | +72 | -0 |
| Sources/c_snikket/iinclude/snikket/SerializedChat.h | +76 | -0 |
| Sources/c_snikket/iinclude/snikket/Stanza.h | +149 | -0 |
| Sources/c_snikket/iinclude/snikket/StanzaError.h | +72 | -0 |
| Sources/c_snikket/iinclude/snikket/StringUtil.h | +63 | -0 |
| Sources/c_snikket/iinclude/snikket/Symbol.h | +49 | -0 |
| Sources/c_snikket/iinclude/snikket/TextNode.h | +67 | -0 |
| Sources/c_snikket/iinclude/snikket/UnicodeBlocks.h | +59 | -0 |
| Sources/c_snikket/iinclude/snikket/UnicodeList.h | +59 | -0 |
| Sources/c_snikket/iinclude/snikket/UnicodeRange.h | +58 | -0 |
| Sources/c_snikket/iinclude/snikket/UnicodeSet.h | +27 | -0 |
| Sources/c_snikket/iinclude/snikket/XEP0393.h | +84 | -0 |
| Sources/c_snikket/iinclude/snikket/_Push/Push_Fields_.h | +64 | -0 |
| Sources/c_snikket/iinclude/snikket/_Stanza/NodeInterface.h | +34 | -0 |
| Sources/c_snikket/iinclude/snikket/_Util/Util_Fields_.h | +68 | -0 |
| Sources/c_snikket/iinclude/snikket/jingle/Attribute.h | +79 | -0 |
| Sources/c_snikket/iinclude/snikket/jingle/AudioFormat.h | +84 | -0 |
| Sources/c_snikket/iinclude/snikket/jingle/DTMFSender.h | +69 | -0 |
| Sources/c_snikket/iinclude/snikket/jingle/Group.h | +69 | -0 |
| Sources/c_snikket/iinclude/snikket/jingle/IceCandidate.h | +84 | -0 |
| Sources/c_snikket/iinclude/snikket/jingle/IncomingProposedSession.h | +114 | -0 |
| Sources/c_snikket/iinclude/snikket/jingle/InitiatedSession.h | +160 | -0 |
| Sources/c_snikket/iinclude/snikket/jingle/Media.h | +82 | -0 |
| Sources/c_snikket/iinclude/snikket/jingle/MediaStream.h | +68 | -0 |
| Sources/c_snikket/iinclude/snikket/jingle/MediaStreamTrack.h | +159 | -0 |
| Sources/c_snikket/iinclude/snikket/jingle/OutgoingProposedSession.h | +117 | -0 |
| Sources/c_snikket/iinclude/snikket/jingle/OutgoingSession.h | +63 | -0 |
| Sources/c_snikket/iinclude/snikket/jingle/PeerConnection.h | +119 | -0 |
| Sources/c_snikket/iinclude/snikket/jingle/Session.h | +84 | -0 |
| Sources/c_snikket/iinclude/snikket/jingle/SessionDescription.h | +86 | -0 |
| Sources/c_snikket/iinclude/snikket/jingle/TransportInfo.h | +60 | -0 |
| Sources/c_snikket/iinclude/snikket/jingle/_Session/Session_Fields_.h | +68 | -0 |
| Sources/c_snikket/iinclude/snikket/persistence/Dummy.h | +138 | -0 |
| Sources/c_snikket/iinclude/snikket/persistence/KeyValueStore.h | +33 | -0 |
| Sources/c_snikket/iinclude/snikket/persistence/MediaStore.h | +42 | -0 |
| Sources/c_snikket/iinclude/snikket/persistence/MediaStoreFS.h | +86 | -0 |
| Sources/c_snikket/iinclude/snikket/persistence/Sqlite.h | +180 | -0 |
| Sources/c_snikket/iinclude/snikket/persistence/SqliteDriver.h | +61 | -0 |
| Sources/c_snikket/iinclude/snikket/queries/BlocklistGet.h | +67 | -0 |
| Sources/c_snikket/iinclude/snikket/queries/BoB.h | +72 | -0 |
| Sources/c_snikket/iinclude/snikket/queries/DiscoInfoGet.h | +68 | -0 |
| Sources/c_snikket/iinclude/snikket/queries/DiscoItemsGet.h | +67 | -0 |
| Sources/c_snikket/iinclude/snikket/queries/ExtDiscoGet.h | +67 | -0 |
| Sources/c_snikket/iinclude/snikket/queries/GenericQuery.h | +65 | -0 |
| Sources/c_snikket/iinclude/snikket/queries/HttpUploadSlot.h | +68 | -0 |
| Sources/c_snikket/iinclude/snikket/queries/JabberIqGatewayGet.h | +68 | -0 |
| Sources/c_snikket/iinclude/snikket/queries/MAMQuery.h | +73 | -0 |
| Sources/c_snikket/iinclude/snikket/queries/PubsubGet.h | +68 | -0 |
| Sources/c_snikket/iinclude/snikket/queries/Push2Disable.h | +63 | -0 |
| Sources/c_snikket/iinclude/snikket/queries/RosterGet.h | +68 | -0 |
| Sources/c_snikket/iinclude/snikket/queries/VcardTempGet.h | +68 | -0 |
| Sources/c_snikket/iinclude/snikket/streams/XmppStropheStream.h | +103 | -0 |
| Sources/c_snikket/iinclude/sys/FileSystem.h | +75 | -0 |
| Sources/c_snikket/iinclude/sys/Http.h | +88 | -0 |
| Sources/c_snikket/iinclude/sys/db/Connection.h | +34 | -0 |
| Sources/c_snikket/iinclude/sys/db/ResultSet.h | +33 | -0 |
| Sources/c_snikket/iinclude/sys/db/Sqlite.h | +63 | -0 |
| Sources/c_snikket/iinclude/sys/db/_Sqlite/SqliteConnection.h | +67 | -0 |
| Sources/c_snikket/iinclude/sys/db/_Sqlite/SqliteResultSet.h | +68 | -0 |
| Sources/c_snikket/iinclude/sys/io/File.h | +73 | -0 |
| Sources/c_snikket/iinclude/sys/io/FileInput.h | +64 | -0 |
| Sources/c_snikket/iinclude/sys/io/FileOutput.h | +64 | -0 |
| Sources/c_snikket/iinclude/sys/io/Process.h | +61 | -0 |
| Sources/c_snikket/iinclude/sys/io/_Process/Stdin.h | +67 | -0 |
| Sources/c_snikket/iinclude/sys/io/_Process/Stdout.h | +66 | -0 |
| Sources/c_snikket/iinclude/sys/net/Host.h | +94 | -0 |
| Sources/c_snikket/iinclude/sys/net/Socket.h | +82 | -0 |
| Sources/c_snikket/iinclude/sys/net/_Socket/SocketInput.h | +66 | -0 |
| Sources/c_snikket/iinclude/sys/net/_Socket/SocketOutput.h | +66 | -0 |
| Sources/c_snikket/iinclude/sys/ssl/Certificate.h | +85 | -0 |
| Sources/c_snikket/iinclude/sys/ssl/Key.h | +73 | -0 |
| Sources/c_snikket/iinclude/sys/ssl/Socket.h | +88 | -0 |
| Sources/c_snikket/iinclude/sys/ssl/_Socket/SocketInput.h | +68 | -0 |
| Sources/c_snikket/iinclude/sys/ssl/_Socket/SocketOutput.h | +68 | -0 |
| Sources/c_snikket/iinclude/sys/thread/EventLoop.h | +80 | -0 |
| Sources/c_snikket/iinclude/sys/thread/Lock.h | +76 | -0 |
| Sources/c_snikket/iinclude/sys/thread/Mutex.h | +76 | -0 |
| Sources/c_snikket/iinclude/sys/thread/NoEventLoopException.h | +70 | -0 |
| Sources/c_snikket/iinclude/sys/thread/_EventLoop/RegularEvent.h | +81 | -0 |
| Sources/c_snikket/iinclude/sys/thread/_Thread/HaxeThread.h | +76 | -0 |
| Sources/c_snikket/iinclude/sys/thread/_Thread/Thread_Impl_.h | +69 | -0 |
| Sources/c_snikket/iinclude/thenshim/PromiseFactory.h | +36 | -0 |
| Sources/c_snikket/iinclude/thenshim/PromiseTools.h | +64 | -0 |
| Sources/c_snikket/iinclude/thenshim/Thenable.h | +27 | -0 |
| Sources/c_snikket/iinclude/thenshim/_Promise/Promise_Impl_.h | +75 | -0 |
| Sources/c_snikket/iinclude/thenshim/fallback/FallbackPromise.h | +77 | -0 |
| Sources/c_snikket/iinclude/thenshim/fallback/FallbackPromiseFactory.h | +75 | -0 |
| Sources/c_snikket/iinclude/thenshim/fallback/HandlerSession.h | +84 | -0 |
| Sources/c_snikket/iinclude/thenshim/fallback/PromiseState.h | +39 | -0 |
| Sources/c_snikket/iinclude/thenshim/fallback/TaskScheduler.h | +72 | -0 |
| Sources/c_snikket/iinclude/tink/_Chunk/Chunk_Impl_.h | +68 | -0 |
| Sources/c_snikket/iinclude/tink/_Chunk/EmptyChunk.h | +77 | -0 |
| Sources/c_snikket/iinclude/tink/_Url/Url_Impl_.h | +80 | -0 |
| Sources/c_snikket/iinclude/tink/chunk/ByteChunk.h | +90 | -0 |
| Sources/c_snikket/iinclude/tink/chunk/ChunkBase.h | +73 | -0 |
| Sources/c_snikket/iinclude/tink/chunk/ChunkCursor.h | +91 | -0 |
| Sources/c_snikket/iinclude/tink/chunk/ChunkObject.h | +57 | -0 |
| Sources/c_snikket/iinclude/tink/chunk/CompoundChunk.h | +97 | -0 |
| Sources/c_snikket/iinclude/tink/core/CallbackLinkRef.h | +61 | -0 |
| Sources/c_snikket/iinclude/tink/core/CallbackList.h | +81 | -0 |
| Sources/c_snikket/iinclude/tink/core/Disposable.h | +25 | -0 |
| Sources/c_snikket/iinclude/tink/core/FutureStatus.h | +45 | -0 |
| Sources/c_snikket/iinclude/tink/core/LinkObject.h | +29 | -0 |
| Sources/c_snikket/iinclude/tink/core/MPair.h | +72 | -0 |
| Sources/c_snikket/iinclude/tink/core/NamedWith.h | +72 | -0 |
| Sources/c_snikket/iinclude/tink/core/Outcome.h | +37 | -0 |
| Sources/c_snikket/iinclude/tink/core/OwnedDisposable.h | +29 | -0 |
| Sources/c_snikket/iinclude/tink/core/SimpleDisposable.h | +68 | -0 |
| Sources/c_snikket/iinclude/tink/core/TypedError.h | +72 | -0 |
| Sources/c_snikket/iinclude/tink/core/_Callback/Callback_Impl_.h | +69 | -0 |
| Sources/c_snikket/iinclude/tink/core/_Callback/LinkPair.h | +65 | -0 |
| Sources/c_snikket/iinclude/tink/core/_Callback/ListCell.h | +69 | -0 |
| Sources/c_snikket/iinclude/tink/core/_Future/FutureObject.h | +61 | -0 |
| Sources/c_snikket/iinclude/tink/core/_Future/Future_Impl_.h | +79 | -0 |
| Sources/c_snikket/iinclude/tink/core/_Future/SuspendableFuture.h | +81 | -0 |
| Sources/c_snikket/iinclude/tink/core/_Future/SyncFuture.h | +69 | -0 |
| Sources/c_snikket/iinclude/tink/core/_Lazy/Computable.h | +39 | -0 |
| Sources/c_snikket/iinclude/tink/core/_Lazy/LazyConst.h | +73 | -0 |
| Sources/c_snikket/iinclude/tink/core/_Lazy/LazyFunc.h | +76 | -0 |
| Sources/c_snikket/iinclude/tink/core/_Lazy/LazyObject.h | +47 | -0 |
| Sources/c_snikket/iinclude/tink/core/_Lazy/Lazy_Impl_.h | +66 | -0 |
| Sources/c_snikket/iinclude/tink/core/_Promise/Promise_Impl_.h | +65 | -0 |
| Sources/c_snikket/iinclude/tink/http/BodyPart.h | +37 | -0 |
| Sources/c_snikket/iinclude/tink/http/ClientObject.h | +32 | -0 |
| Sources/c_snikket/iinclude/tink/http/ClientType.h | +46 | -0 |
| Sources/c_snikket/iinclude/tink/http/Container.h | +25 | -0 |
| Sources/c_snikket/iinclude/tink/http/Fetch.h | +74 | -0 |
| Sources/c_snikket/iinclude/tink/http/HandlerObject.h | +32 | -0 |
| Sources/c_snikket/iinclude/tink/http/Header.h | +68 | -0 |
| Sources/c_snikket/iinclude/tink/http/HeaderField.h | +76 | -0 |
| Sources/c_snikket/iinclude/tink/http/HeaderParser.h | +73 | -0 |
| Sources/c_snikket/iinclude/tink/http/IncomingRequest.h | +61 | -0 |
| Sources/c_snikket/iinclude/tink/http/IncomingRequestBody.h | +39 | -0 |
| Sources/c_snikket/iinclude/tink/http/IncomingRequestHeader.h | +54 | -0 |
| Sources/c_snikket/iinclude/tink/http/IncomingResponse.h | +54 | -0 |
| Sources/c_snikket/iinclude/tink/http/Message.h | +72 | -0 |
| Sources/c_snikket/iinclude/tink/http/OutgoingRequest.h | +55 | -0 |
| Sources/c_snikket/iinclude/tink/http/OutgoingRequestHeader.h | +63 | -0 |
| Sources/c_snikket/iinclude/tink/http/RequestHeader.h | +63 | -0 |
| Sources/c_snikket/iinclude/tink/http/ResponseHeaderBase.h | +68 | -0 |
| Sources/c_snikket/iinclude/tink/http/_Client/CustomClient.h | +79 | -0 |
| Sources/c_snikket/iinclude/tink/http/_Fetch/FetchResponse_Impl_.h | +65 | -0 |
| Sources/c_snikket/iinclude/tink/http/_Header/HeaderValue_Impl_.h | +67 | -0 |
| Sources/c_snikket/iinclude/tink/http/_Response/OutgoingResponseData.h | +56 | -0 |
| Sources/c_snikket/iinclude/tink/http/clients/CurlClient.h | +69 | -0 |
| Sources/c_snikket/iinclude/tink/http/clients/Helpers.h | +65 | -0 |
| Sources/c_snikket/iinclude/tink/http/clients/LocalContainerClient.h | +68 | -0 |
| Sources/c_snikket/iinclude/tink/http/clients/SocketClient.h | +67 | -0 |
| Sources/c_snikket/iinclude/tink/http/clients/StdClient.h | +67 | -0 |
| Sources/c_snikket/iinclude/tink/http/containers/LocalContainer.h | +68 | -0 |
| Sources/c_snikket/iinclude/tink/io/BytewiseParser.h | +76 | -0 |
| Sources/c_snikket/iinclude/tink/io/IdealSourceTools.h | +64 | -0 |
| Sources/c_snikket/iinclude/tink/io/ParseResult.h | +41 | -0 |
| Sources/c_snikket/iinclude/tink/io/ParseStep.h | +40 | -0 |
| Sources/c_snikket/iinclude/tink/io/PipeResult.h | +43 | -0 |
| Sources/c_snikket/iinclude/tink/io/PipeResultTools.h | +65 | -0 |
| Sources/c_snikket/iinclude/tink/io/RealSourceTools.h | +72 | -0 |
| Sources/c_snikket/iinclude/tink/io/SinkBase.h | +69 | -0 |
| Sources/c_snikket/iinclude/tink/io/SinkObject.h | +31 | -0 |
| Sources/c_snikket/iinclude/tink/io/StreamParserObject.h | +36 | -0 |
| Sources/c_snikket/iinclude/tink/io/WorkerObject.h | +32 | -0 |
| Sources/c_snikket/iinclude/tink/io/_Sink/SinkYielding_Impl_.h | +66 | -0 |
| Sources/c_snikket/iinclude/tink/io/_Source/Source_Impl_.h | +82 | -0 |
| Sources/c_snikket/iinclude/tink/io/_StreamParser/StreamParser_Impl_.h | +70 | -0 |
| Sources/c_snikket/iinclude/tink/io/_Worker/EagerWorker.h | +61 | -0 |
| Sources/c_snikket/iinclude/tink/io/_Worker/Worker_Impl_.h | +77 | -0 |
| Sources/c_snikket/iinclude/tink/io/std/InputSource.h | +58 | -0 |
| Sources/c_snikket/iinclude/tink/io/std/OutputSink.h | +68 | -0 |
| Sources/c_snikket/iinclude/tink/streams/Conclusion.h | +43 | -0 |
| Sources/c_snikket/iinclude/tink/streams/Empty.h | +65 | -0 |
| Sources/c_snikket/iinclude/tink/streams/FutureStream.h | +61 | -0 |
| Sources/c_snikket/iinclude/tink/streams/Generator.h | +61 | -0 |
| Sources/c_snikket/iinclude/tink/streams/Handled.h | +42 | -0 |
| Sources/c_snikket/iinclude/tink/streams/IdealStreamBase.h | +56 | -0 |
| Sources/c_snikket/iinclude/tink/streams/IdealizeStream.h | +67 | -0 |
| Sources/c_snikket/iinclude/tink/streams/Reduction.h | +41 | -0 |
| Sources/c_snikket/iinclude/tink/streams/ReductionStep.h | +38 | -0 |
| Sources/c_snikket/iinclude/tink/streams/RegroupResult.h | +44 | -0 |
| Sources/c_snikket/iinclude/tink/streams/RegroupStatus.h | +40 | -0 |
| Sources/c_snikket/iinclude/tink/streams/Single.h | +63 | -0 |
| Sources/c_snikket/iinclude/tink/streams/Step.h | +41 | -0 |
| Sources/c_snikket/iinclude/tink/streams/StreamBase.h | +77 | -0 |
| Sources/c_snikket/iinclude/tink/streams/StreamObject.h | +55 | -0 |
| Sources/c_snikket/iinclude/tink/streams/_Stream/CompoundStream.h | +75 | -0 |
| Sources/c_snikket/iinclude/tink/streams/_Stream/ErrorStream.h | +64 | -0 |
| Sources/c_snikket/iinclude/tink/streams/_Stream/Handler_Impl_.h | +69 | -0 |
| Sources/c_snikket/iinclude/tink/streams/_Stream/Reducer_Impl_.h | +66 | -0 |
| Sources/c_snikket/iinclude/tink/streams/_Stream/RegroupStream.h | +55 | -0 |
| Sources/c_snikket/iinclude/tink/streams/_Stream/Regrouper_Impl_.h | +65 | -0 |
| Sources/c_snikket/iinclude/tink/streams/_Stream/Stream_Impl_.h | +73 | -0 |
| Sources/c_snikket/iinclude/tink/url/_Host/Host_Impl_.h | +70 | -0 |
| Sources/c_snikket/iinclude/tink/url/_Path/Path_Impl_.h | +70 | -0 |
| Sources/c_snikket/include/snikket.h | +1002 | -0 |
| Sources/c_snikket/src/Array.cpp | +1169 | -0 |
| Sources/c_snikket/src/Date.cpp | +231 | -0 |
| Sources/c_snikket/src/Dynamic.cpp | +637 | -0 |
| Sources/c_snikket/src/EReg.cpp | +578 | -0 |
| Sources/c_snikket/src/Enum.cpp | +137 | -0 |
| Sources/c_snikket/src/HaxeCBridge.cpp | +337 | -0 |
| Sources/c_snikket/src/Lambda.cpp | +209 | -0 |
| Sources/c_snikket/src/Math.cpp | +194 | -0 |
| Sources/c_snikket/src/Reflect.cpp | +264 | -0 |
| Sources/c_snikket/src/Std.cpp | +201 | -0 |
| Sources/c_snikket/src/String.cpp | +2417 | -0 |
| Sources/c_snikket/src/StringBuf.cpp | +219 | -0 |
| Sources/c_snikket/src/StringTools.cpp | +494 | -0 |
| Sources/c_snikket/src/Sys.cpp | +124 | -0 |
| Sources/c_snikket/src/Type.cpp | +199 | -0 |
| Sources/c_snikket/src/ValueType.cpp | +138 | -0 |
| Sources/c_snikket/src/Xml.cpp | +660 | -0 |
| Sources/c_snikket/src/_HaxeCBridge/Int64Map_Impl_.cpp | +91 | -0 |
| Sources/c_snikket/src/_HaxeCBridge/Internal.cpp | +184 | -0 |
| Sources/c_snikket/src/_UnicodeString/UnicodeString_Impl_.cpp | +230 | -0 |
| Sources/c_snikket/src/_Xml/XmlType_Impl_.cpp | +115 | -0 |
| Sources/c_snikket/src/__HaxeCBridgeBindings__.cpp | +7043 | -0 |
| Sources/c_snikket/src/__boot__.cpp | +1355 | -0 |
| Sources/c_snikket/src/__files__.cpp | +644 | -0 |
| Sources/c_snikket/src/__lib__.cpp | +18 | -0 |
| Sources/c_snikket/src/__resources__.cpp | +11 | -0 |
| Sources/c_snikket/src/cpp/Lib.cpp | +62 | -0 |
| Sources/c_snikket/src/datetime/_DateTime/DateTime_Impl_.cpp | +155 | -0 |
| Sources/c_snikket/src/datetime/_DateTimeInterval/DateTimeInterval_Impl_.cpp | +108 | -0 |
| Sources/c_snikket/src/datetime/cores/DateTimeIntervalCore.cpp | +572 | -0 |
| Sources/c_snikket/src/datetime/utils/DateTimeIntervalUtils.cpp | +199 | -0 |
| Sources/c_snikket/src/datetime/utils/DateTimeMonthUtils.cpp | +532 | -0 |
| Sources/c_snikket/src/datetime/utils/DateTimeUtils.cpp | +245 | -0 |
| Sources/c_snikket/src/haxe/EntryPoint.cpp | +84 | -0 |
| Sources/c_snikket/src/haxe/Exception.cpp | +244 | -0 |
| Sources/c_snikket/src/haxe/IMap.cpp | +28 | -0 |
| Sources/c_snikket/src/haxe/Log.cpp | +145 | -0 |
| Sources/c_snikket/src/haxe/MainEvent.cpp | +179 | -0 |
| Sources/c_snikket/src/haxe/MainLoop.cpp | +287 | -0 |
| Sources/c_snikket/src/haxe/NativeStackTrace.cpp | +104 | -0 |
| Sources/c_snikket/src/haxe/StackItem.cpp | +116 | -0 |
| Sources/c_snikket/src/haxe/Timer.cpp | +225 | -0 |
| Sources/c_snikket/src/haxe/ValueException.cpp | +142 | -0 |
| Sources/c_snikket/src/haxe/crypto/Base64.cpp | +260 | -0 |
| Sources/c_snikket/src/haxe/crypto/BaseCode.cpp | +285 | -0 |
| Sources/c_snikket/src/haxe/crypto/Sha1.cpp | +334 | -0 |
| Sources/c_snikket/src/haxe/crypto/Sha256.cpp | +313 | -0 |
| Sources/c_snikket/src/haxe/ds/BalancedTree.cpp | +388 | -0 |
| Sources/c_snikket/src/haxe/ds/Either.cpp | +86 | -0 |
| Sources/c_snikket/src/haxe/ds/EnumValueMap.cpp | +218 | -0 |
| Sources/c_snikket/src/haxe/ds/IntMap.cpp | +199 | -0 |
| Sources/c_snikket/src/haxe/ds/List.cpp | +185 | -0 |
| Sources/c_snikket/src/haxe/ds/ObjectMap.cpp | +183 | -0 |
| Sources/c_snikket/src/haxe/ds/Option.cpp | +82 | -0 |
| Sources/c_snikket/src/haxe/ds/StringMap.cpp | +237 | -0 |
| Sources/c_snikket/src/haxe/ds/TreeNode.cpp | +196 | -0 |
| Sources/c_snikket/src/haxe/ds/_List/ListNode.cpp | +121 | -0 |
| Sources/c_snikket/src/haxe/exceptions/NotImplementedException.cpp | +84 | -0 |
| Sources/c_snikket/src/haxe/exceptions/PosException.cpp | +136 | -0 |
| Sources/c_snikket/src/haxe/format/JsonParser.cpp | +793 | -0 |
| Sources/c_snikket/src/haxe/format/JsonPrinter.cpp | +822 | -0 |
| Sources/c_snikket/src/haxe/http/HttpBase.cpp | +371 | -0 |
| Sources/c_snikket/src/haxe/io/Bytes.cpp | +441 | -0 |
| Sources/c_snikket/src/haxe/io/BytesBuffer.cpp | +142 | -0 |
| Sources/c_snikket/src/haxe/io/BytesInput.cpp | +266 | -0 |
| Sources/c_snikket/src/haxe/io/BytesOutput.cpp | +206 | -0 |
| Sources/c_snikket/src/haxe/io/Encoding.cpp | +78 | -0 |
| Sources/c_snikket/src/haxe/io/Eof.cpp | +89 | -0 |
| Sources/c_snikket/src/haxe/io/Error.cpp | +98 | -0 |
| Sources/c_snikket/src/haxe/io/Input.cpp | +309 | -0 |
| Sources/c_snikket/src/haxe/io/Output.cpp | +216 | -0 |
| Sources/c_snikket/src/haxe/io/Path.cpp | +587 | -0 |
| Sources/c_snikket/src/haxe/iterators/ArrayIterator.cpp | +147 | -0 |
| Sources/c_snikket/src/haxe/iterators/MapKeyValueIterator.cpp | +166 | -0 |
| Sources/c_snikket/src/haxe/xml/Parser.cpp | +1062 | -0 |
| Sources/c_snikket/src/haxe/xml/Printer.cpp | +782 | -0 |
| Sources/c_snikket/src/haxe/xml/XmlParserException.cpp | +205 | -0 |
| Sources/c_snikket/src/hsluv/Hsluv.cpp | +841 | -0 |
| Sources/c_snikket/src/htmlparser/HtmlAttribute.cpp | +129 | -0 |
| Sources/c_snikket/src/htmlparser/HtmlNode.cpp | +108 | -0 |
| Sources/c_snikket/src/htmlparser/HtmlNodeElement.cpp | +214 | -0 |
| Sources/c_snikket/src/htmlparser/HtmlNodeText.cpp | +147 | -0 |
| Sources/c_snikket/src/htmlparser/HtmlParser.cpp | +1128 | -0 |
| Sources/c_snikket/src/htmlparser/HtmlParserException.cpp | +154 | -0 |
| Sources/c_snikket/src/htmlparser/HtmlTools.cpp | +288 | -0 |
| Sources/c_snikket/src/httpstatus/_HttpStatusMessage/HttpStatusMessage_Impl_.cpp | +336 | -0 |
| Sources/c_snikket/src/hx/Anon.cpp | +449 | -0 |
| Sources/c_snikket/src/hx/Boot.cpp | +35 | -0 |
| Sources/c_snikket/src/hx/CFFI.cpp | +1013 | -0 |
| Sources/c_snikket/src/hx/Class.cpp | +373 | -0 |
| Sources/c_snikket/src/hx/Date.cpp | +428 | -0 |
| Sources/c_snikket/src/hx/Debug.cpp | +573 | -0 |
| Sources/c_snikket/src/hx/Hash.cpp | +1242 | -0 |
| Sources/c_snikket/src/hx/Hash.h | +827 | -0 |
| Sources/c_snikket/src/hx/Lib.cpp | +807 | -0 |
| Sources/c_snikket/src/hx/Object.cpp | +205 | -0 |
| Sources/c_snikket/src/hx/StdLibs.cpp | +833 | -0 |
| Sources/c_snikket/src/hx/Thread.cpp | +950 | -0 |
| Sources/c_snikket/src/hx/Unicase.h | +125 | -0 |
| Sources/c_snikket/src/hx/gc/GcCommon.cpp | +182 | -0 |
| Sources/c_snikket/src/hx/gc/GcRegCapture.cpp | +159 | -0 |
| Sources/c_snikket/src/hx/gc/GcRegCapture.h | +140 | -0 |
| Sources/c_snikket/src/hx/gc/Immix.cpp | +7139 | -0 |
| Sources/c_snikket/src/hx/libs/regexp/Build.xml | +45 | -0 |
| Sources/c_snikket/src/hx/libs/regexp/RegExp.cpp | +292 | -0 |
| Sources/c_snikket/src/hx/libs/regexp/pcre2_sources.xml | +35 | -0 |
| Sources/c_snikket/src/hx/libs/sqlite/Build.xml | +25 | -0 |
| Sources/c_snikket/src/hx/libs/sqlite/Sqlite.cpp | +404 | -0 |
| Sources/c_snikket/src/hx/libs/ssl/SSL.cpp | +898 | -0 |
| Sources/c_snikket/src/hx/libs/std/Build.xml | +26 | -0 |
| Sources/c_snikket/src/hx/libs/std/File.cpp | +425 | -0 |
| Sources/c_snikket/src/hx/libs/std/Process.cpp | +603 | -0 |
| Sources/c_snikket/src/hx/libs/std/Random.cpp | +178 | -0 |
| Sources/c_snikket/src/hx/libs/std/Socket.cpp | +1392 | -0 |
| Sources/c_snikket/src/hx/libs/std/Sys.cpp | +908 | -0 |
| Sources/c_snikket/src/hx/strings/RandomStrings.cpp | +312 | -0 |
| Sources/c_snikket/src/hx/strings/StringBuilder.cpp | +298 | -0 |
| Sources/c_snikket/src/hx/strings/Strings.cpp | +110 | -0 |
| Sources/c_snikket/src/hx/strings/internal/_Either2/_Either2.cpp | +90 | -0 |
| Sources/c_snikket/src/sha/Hash.cpp | +223 | -0 |
| Sources/c_snikket/src/sha/SHA256.cpp | +406 | -0 |
| Sources/c_snikket/src/sha/_SHA256/SHA256_Fields_.cpp | +119 | -0 |
| Sources/c_snikket/src/snikket/AttachmentSource.cpp | +275 | -0 |
| Sources/c_snikket/src/snikket/Autolink.cpp | +573 | -0 |
| Sources/c_snikket/src/snikket/AvailableChat.cpp | +223 | -0 |
| Sources/c_snikket/src/snikket/Builder.cpp | +338 | -0 |
| Sources/c_snikket/src/snikket/Caps.cpp | +446 | -0 |
| Sources/c_snikket/src/snikket/Channel.cpp | +1750 | -0 |
| Sources/c_snikket/src/snikket/Chat.cpp | +2205 | -0 |
| Sources/c_snikket/src/snikket/ChatAttachment.cpp | +359 | -0 |
| Sources/c_snikket/src/snikket/ChatMessage.cpp | +1780 | -0 |
| Sources/c_snikket/src/snikket/ChatMessageBuilder.cpp | +1328 | -0 |
| Sources/c_snikket/src/snikket/Client.cpp | +5072 | -0 |
| Sources/c_snikket/src/snikket/Color.cpp | +135 | -0 |
| Sources/c_snikket/src/snikket/Config.cpp | +114 | -0 |
| Sources/c_snikket/src/snikket/CustomEmojiReaction.cpp | +189 | -0 |
| Sources/c_snikket/src/snikket/Date.cpp | +102 | -0 |
| Sources/c_snikket/src/snikket/DirectChat.cpp | +889 | -0 |
| Sources/c_snikket/src/snikket/Emoji.cpp | +93 | -0 |
| Sources/c_snikket/src/snikket/EmojiUtil.cpp | +578 | -0 |
| Sources/c_snikket/src/snikket/EventEmitter.cpp | +230 | -0 |
| Sources/c_snikket/src/snikket/EventHandler.cpp | +186 | -0 |
| Sources/c_snikket/src/snikket/EventResult.cpp | +96 | -0 |
| Sources/c_snikket/src/snikket/GenericStream.cpp | +237 | -0 |
| Sources/c_snikket/src/snikket/Hash.cpp | +385 | -0 |
| Sources/c_snikket/src/snikket/ID.cpp | +128 | -0 |
| Sources/c_snikket/src/snikket/Identicon.cpp | +233 | -0 |
| Sources/c_snikket/src/snikket/Identity.cpp | +177 | -0 |
| Sources/c_snikket/src/snikket/IqRequestType.cpp | +76 | -0 |
| Sources/c_snikket/src/snikket/IqResult.cpp | +94 | -0 |
| Sources/c_snikket/src/snikket/JID.cpp | +328 | -0 |
| Sources/c_snikket/src/snikket/Message.cpp | +1139 | -0 |
| Sources/c_snikket/src/snikket/MessageStanza.cpp | +135 | -0 |
| Sources/c_snikket/src/snikket/MessageSync.cpp | +514 | -0 |
| Sources/c_snikket/src/snikket/ModerationAction.cpp | +153 | -0 |
| Sources/c_snikket/src/snikket/Node.cpp | +93 | -0 |
| Sources/c_snikket/src/snikket/Notification.cpp | +288 | -0 |
| Sources/c_snikket/src/snikket/Other.cpp | +93 | -0 |
| Sources/c_snikket/src/snikket/Participant.cpp | +215 | -0 |
| Sources/c_snikket/src/snikket/Persistence.cpp | +80 | -0 |
| Sources/c_snikket/src/snikket/Presence.cpp | +143 | -0 |
| Sources/c_snikket/src/snikket/PubsubEvent.cpp | +234 | -0 |
| Sources/c_snikket/src/snikket/Reaction.cpp | +277 | -0 |
| Sources/c_snikket/src/snikket/ReactionUpdate.cpp | +413 | -0 |
| Sources/c_snikket/src/snikket/SerializedChat.cpp | +424 | -0 |
| Sources/c_snikket/src/snikket/Stanza.cpp | +1055 | -0 |
| Sources/c_snikket/src/snikket/StanzaError.cpp | +129 | -0 |
| Sources/c_snikket/src/snikket/StringUtil.cpp | +146 | -0 |
| Sources/c_snikket/src/snikket/Symbol.cpp | +133 | -0 |
| Sources/c_snikket/src/snikket/TextNode.cpp | +190 | -0 |
| Sources/c_snikket/src/snikket/UnicodeBlocks.cpp | +164 | -0 |
| Sources/c_snikket/src/snikket/UnicodeList.cpp | +153 | -0 |
| Sources/c_snikket/src/snikket/UnicodeRange.cpp | +153 | -0 |
| Sources/c_snikket/src/snikket/UnicodeSet.cpp | +27 | -0 |
| Sources/c_snikket/src/snikket/XEP0393.cpp | +774 | -0 |
| Sources/c_snikket/src/snikket/_Push/Push_Fields_.cpp | +145 | -0 |
| Sources/c_snikket/src/snikket/_Stanza/NodeInterface.cpp | +33 | -0 |
| Sources/c_snikket/src/snikket/_Util/Util_Fields_.cpp | +118 | -0 |
| Sources/c_snikket/src/snikket/jingle/Attribute.cpp | +179 | -0 |
| Sources/c_snikket/src/snikket/jingle/AudioFormat.cpp | +187 | -0 |
| Sources/c_snikket/src/snikket/jingle/DTMFSender.cpp | +365 | -0 |
| Sources/c_snikket/src/snikket/jingle/Group.cpp | +239 | -0 |
| Sources/c_snikket/src/snikket/jingle/IceCandidate.cpp | +479 | -0 |
| Sources/c_snikket/src/snikket/jingle/IncomingProposedSession.cpp | +519 | -0 |
| Sources/c_snikket/src/snikket/jingle/InitiatedSession.cpp | +1563 | -0 |
| Sources/c_snikket/src/snikket/jingle/Media.cpp | +1179 | -0 |
| Sources/c_snikket/src/snikket/jingle/MediaStream.cpp | +266 | -0 |
| Sources/c_snikket/src/snikket/jingle/MediaStreamTrack.cpp | +1115 | -0 |
| Sources/c_snikket/src/snikket/jingle/OutgoingProposedSession.cpp | +563 | -0 |
| Sources/c_snikket/src/snikket/jingle/OutgoingSession.cpp | +164 | -0 |
| Sources/c_snikket/src/snikket/jingle/PeerConnection.cpp | +767 | -0 |
| Sources/c_snikket/src/snikket/jingle/Session.cpp | +63 | -0 |
| Sources/c_snikket/src/snikket/jingle/SessionDescription.cpp | +727 | -0 |
| Sources/c_snikket/src/snikket/jingle/TransportInfo.cpp | +170 | -0 |
| Sources/c_snikket/src/snikket/jingle/_Session/Session_Fields_.cpp | +132 | -0 |
| Sources/c_snikket/src/snikket/persistence/Dummy.cpp | +512 | -0 |
| Sources/c_snikket/src/snikket/persistence/KeyValueStore.cpp | +30 | -0 |
| Sources/c_snikket/src/snikket/persistence/MediaStore.cpp | +35 | -0 |
| Sources/c_snikket/src/snikket/persistence/MediaStoreFS.cpp | +429 | -0 |
| Sources/c_snikket/src/snikket/persistence/Sqlite.cpp | +3231 | -0 |
| Sources/c_snikket/src/snikket/persistence/SqliteDriver.cpp | +284 | -0 |
| Sources/c_snikket/src/snikket/queries/BlocklistGet.cpp | +232 | -0 |
| Sources/c_snikket/src/snikket/queries/BoB.cpp | +297 | -0 |
| Sources/c_snikket/src/snikket/queries/DiscoInfoGet.cpp | +262 | -0 |
| Sources/c_snikket/src/snikket/queries/DiscoItemsGet.cpp | +244 | -0 |
| Sources/c_snikket/src/snikket/queries/ExtDiscoGet.cpp | +216 | -0 |
| Sources/c_snikket/src/snikket/queries/GenericQuery.cpp | +174 | -0 |
| Sources/c_snikket/src/snikket/queries/HttpUploadSlot.cpp | +277 | -0 |
| Sources/c_snikket/src/snikket/queries/JabberIqGatewayGet.cpp | +253 | -0 |
| Sources/c_snikket/src/snikket/queries/MAMQuery.cpp | +343 | -0 |
| Sources/c_snikket/src/snikket/queries/PubsubGet.cpp | +252 | -0 |
| Sources/c_snikket/src/snikket/queries/Push2Disable.cpp | +183 | -0 |
| Sources/c_snikket/src/snikket/queries/RosterGet.cpp | +254 | -0 |
| Sources/c_snikket/src/snikket/queries/VcardTempGet.cpp | +250 | -0 |
| Sources/c_snikket/src/snikket/streams/XmppStropheStream.cpp | +591 | -0 |
| Sources/c_snikket/src/sqlite3.c | +261454 | -0 |
| Sources/c_snikket/src/sys/FileSystem.cpp | +239 | -0 |
| Sources/c_snikket/src/sys/Http.cpp | +1426 | -0 |
| Sources/c_snikket/src/sys/db/Connection.cpp | +33 | -0 |
| Sources/c_snikket/src/sys/db/ResultSet.cpp | +30 | -0 |
| Sources/c_snikket/src/sys/db/Sqlite.cpp | +93 | -0 |
| Sources/c_snikket/src/sys/db/_Sqlite/SqliteConnection.cpp | +230 | -0 |
| Sources/c_snikket/src/sys/db/_Sqlite/SqliteResultSet.cpp | +196 | -0 |
| Sources/c_snikket/src/sys/io/File.cpp | +146 | -0 |
| Sources/c_snikket/src/sys/io/FileInput.cpp | +218 | -0 |
| Sources/c_snikket/src/sys/io/FileOutput.cpp | +204 | -0 |
| Sources/c_snikket/src/sys/io/Process.cpp | +202 | -0 |
| Sources/c_snikket/src/sys/io/_Process/Stdin.cpp | +202 | -0 |
| Sources/c_snikket/src/sys/io/_Process/Stdout.cpp | +212 | -0 |
| Sources/c_snikket/src/sys/net/Host.cpp | +175 | -0 |
| Sources/c_snikket/src/sys/net/Socket.cpp | +373 | -0 |
| Sources/c_snikket/src/sys/net/_Socket/SocketInput.cpp | +234 | -0 |
| Sources/c_snikket/src/sys/net/_Socket/SocketOutput.cpp | +229 | -0 |
| Sources/c_snikket/src/sys/ssl/Certificate.cpp | +228 | -0 |
| Sources/c_snikket/src/sys/ssl/Key.cpp | +122 | -0 |
| Sources/c_snikket/src/sys/ssl/Socket.cpp | +585 | -0 |
| Sources/c_snikket/src/sys/ssl/_Socket/SocketInput.cpp | +242 | -0 |
| Sources/c_snikket/src/sys/ssl/_Socket/SocketOutput.cpp | +229 | -0 |
| Sources/c_snikket/src/sys/thread/EventLoop.cpp | +499 | -0 |
| Sources/c_snikket/src/sys/thread/Lock.cpp | +139 | -0 |
| Sources/c_snikket/src/sys/thread/Mutex.cpp | +135 | -0 |
| Sources/c_snikket/src/sys/thread/NoEventLoopException.cpp | +77 | -0 |
| Sources/c_snikket/src/sys/thread/_EventLoop/RegularEvent.cpp | +166 | -0 |
| Sources/c_snikket/src/sys/thread/_Thread/HaxeThread.cpp | +358 | -0 |
| Sources/c_snikket/src/sys/thread/_Thread/Thread_Impl_.cpp | +117 | -0 |
| Sources/c_snikket/src/thenshim/PromiseFactory.cpp | +32 | -0 |
| Sources/c_snikket/src/thenshim/PromiseTools.cpp | +161 | -0 |
| Sources/c_snikket/src/thenshim/Thenable.cpp | +27 | -0 |
| Sources/c_snikket/src/thenshim/_Promise/Promise_Impl_.cpp | +163 | -0 |
| Sources/c_snikket/src/thenshim/fallback/FallbackPromise.cpp | +302 | -0 |
| Sources/c_snikket/src/thenshim/fallback/FallbackPromiseFactory.cpp | +300 | -0 |
| Sources/c_snikket/src/thenshim/fallback/HandlerSession.cpp | +508 | -0 |
| Sources/c_snikket/src/thenshim/fallback/PromiseState.cpp | +86 | -0 |
| Sources/c_snikket/src/thenshim/fallback/TaskScheduler.cpp | +117 | -0 |
| Sources/c_snikket/src/tink/_Chunk/Chunk_Impl_.cpp | +172 | -0 |
| Sources/c_snikket/src/tink/_Chunk/EmptyChunk.cpp | +235 | -0 |
| Sources/c_snikket/src/tink/_Url/Url_Impl_.cpp | +396 | -0 |
| Sources/c_snikket/src/tink/chunk/ByteChunk.cpp | +345 | -0 |
| Sources/c_snikket/src/tink/chunk/ChunkBase.cpp | +142 | -0 |
| Sources/c_snikket/src/tink/chunk/ChunkCursor.cpp | +433 | -0 |
| Sources/c_snikket/src/tink/chunk/ChunkObject.cpp | +47 | -0 |
| Sources/c_snikket/src/tink/chunk/CompoundChunk.cpp | +444 | -0 |
| Sources/c_snikket/src/tink/core/CallbackLinkRef.cpp | +157 | -0 |
| Sources/c_snikket/src/tink/core/CallbackList.cpp | +472 | -0 |
| Sources/c_snikket/src/tink/core/Disposable.cpp | +25 | -0 |
| Sources/c_snikket/src/tink/core/FutureStatus.cpp | +112 | -0 |
| Sources/c_snikket/src/tink/core/LinkObject.cpp | +29 | -0 |
| Sources/c_snikket/src/tink/core/MPair.cpp | +119 | -0 |
| Sources/c_snikket/src/tink/core/NamedWith.cpp | +123 | -0 |
| Sources/c_snikket/src/tink/core/Outcome.cpp | +86 | -0 |
| Sources/c_snikket/src/tink/core/OwnedDisposable.cpp | +28 | -0 |
| Sources/c_snikket/src/tink/core/SimpleDisposable.cpp | +211 | -0 |
| Sources/c_snikket/src/tink/core/TypedError.cpp | +250 | -0 |
| Sources/c_snikket/src/tink/core/_Callback/Callback_Impl_.cpp | +149 | -0 |
| Sources/c_snikket/src/tink/core/_Callback/LinkPair.cpp | +193 | -0 |
| Sources/c_snikket/src/tink/core/_Callback/ListCell.cpp | +192 | -0 |
| Sources/c_snikket/src/tink/core/_Future/FutureObject.cpp | +135 | -0 |
| Sources/c_snikket/src/tink/core/_Future/Future_Impl_.cpp | +319 | -0 |
| Sources/c_snikket/src/tink/core/_Future/SuspendableFuture.cpp | +347 | -0 |
| Sources/c_snikket/src/tink/core/_Future/SyncFuture.cpp | +186 | -0 |
| Sources/c_snikket/src/tink/core/_Lazy/Computable.cpp | +33 | -0 |
| Sources/c_snikket/src/tink/core/_Lazy/LazyConst.cpp | +206 | -0 |
| Sources/c_snikket/src/tink/core/_Lazy/LazyFunc.cpp | +270 | -0 |
| Sources/c_snikket/src/tink/core/_Lazy/LazyObject.cpp | +34 | -0 |
| Sources/c_snikket/src/tink/core/_Lazy/Lazy_Impl_.cpp | +96 | -0 |
| Sources/c_snikket/src/tink/core/_Promise/Promise_Impl_.cpp | +132 | -0 |
| Sources/c_snikket/src/tink/http/BodyPart.cpp | +86 | -0 |
| Sources/c_snikket/src/tink/http/ClientObject.cpp | +38 | -0 |
| Sources/c_snikket/src/tink/http/ClientType.cpp | +119 | -0 |
| Sources/c_snikket/src/tink/http/Container.cpp | +25 | -0 |
| Sources/c_snikket/src/tink/http/Fetch.cpp | +421 | -0 |
| Sources/c_snikket/src/tink/http/HandlerObject.cpp | +38 | -0 |
| Sources/c_snikket/src/tink/http/Header.cpp | +254 | -0 |
| Sources/c_snikket/src/tink/http/HeaderField.cpp | +138 | -0 |
| Sources/c_snikket/src/tink/http/HeaderParser.cpp | +410 | -0 |
| Sources/c_snikket/src/tink/http/IncomingRequest.cpp | +146 | -0 |
| Sources/c_snikket/src/tink/http/IncomingRequestBody.cpp | +92 | -0 |
| Sources/c_snikket/src/tink/http/IncomingRequestHeader.cpp | +103 | -0 |
| Sources/c_snikket/src/tink/http/IncomingResponse.cpp | +97 | -0 |
| Sources/c_snikket/src/tink/http/Message.cpp | +123 | -0 |
| Sources/c_snikket/src/tink/http/OutgoingRequest.cpp | +100 | -0 |
| Sources/c_snikket/src/tink/http/OutgoingRequestHeader.cpp | +210 | -0 |
| Sources/c_snikket/src/tink/http/RequestHeader.cpp | +198 | -0 |
| Sources/c_snikket/src/tink/http/ResponseHeaderBase.cpp | +248 | -0 |
| Sources/c_snikket/src/tink/http/_Client/CustomClient.cpp | +345 | -0 |
| Sources/c_snikket/src/tink/http/_Fetch/FetchResponse_Impl_.cpp | +159 | -0 |
| Sources/c_snikket/src/tink/http/_Header/HeaderValue_Impl_.cpp | +114 | -0 |
| Sources/c_snikket/src/tink/http/_Response/OutgoingResponseData.cpp | +99 | -0 |
| Sources/c_snikket/src/tink/http/clients/CurlClient.cpp | +364 | -0 |
| Sources/c_snikket/src/tink/http/clients/Helpers.cpp | +110 | -0 |
| Sources/c_snikket/src/tink/http/clients/LocalContainerClient.cpp | +262 | -0 |
| Sources/c_snikket/src/tink/http/clients/SocketClient.cpp | +543 | -0 |
| Sources/c_snikket/src/tink/http/clients/StdClient.cpp | +416 | -0 |
| Sources/c_snikket/src/tink/http/containers/LocalContainer.cpp | +211 | -0 |
| Sources/c_snikket/src/tink/io/BytewiseParser.cpp | +181 | -0 |
| Sources/c_snikket/src/tink/io/IdealSourceTools.cpp | +113 | -0 |
| Sources/c_snikket/src/tink/io/ParseResult.cpp | +104 | -0 |
| Sources/c_snikket/src/tink/io/ParseStep.cpp | +97 | -0 |
| Sources/c_snikket/src/tink/io/PipeResult.cpp | +112 | -0 |
| Sources/c_snikket/src/tink/io/PipeResultTools.cpp | +155 | -0 |
| Sources/c_snikket/src/tink/io/RealSourceTools.cpp | +194 | -0 |
| Sources/c_snikket/src/tink/io/SinkBase.cpp | +111 | -0 |
| Sources/c_snikket/src/tink/io/SinkObject.cpp | +35 | -0 |
| Sources/c_snikket/src/tink/io/StreamParserObject.cpp | +39 | -0 |
| Sources/c_snikket/src/tink/io/WorkerObject.cpp | +38 | -0 |
| Sources/c_snikket/src/tink/io/_Sink/SinkYielding_Impl_.cpp | +121 | -0 |
| Sources/c_snikket/src/tink/io/_Source/Source_Impl_.cpp | +253 | -0 |
| Sources/c_snikket/src/tink/io/_StreamParser/StreamParser_Impl_.cpp | +379 | -0 |
| Sources/c_snikket/src/tink/io/_Worker/EagerWorker.cpp | +140 | -0 |
| Sources/c_snikket/src/tink/io/_Worker/Worker_Impl_.cpp | +180 | -0 |
| Sources/c_snikket/src/tink/io/std/InputSource.cpp | +341 | -0 |
| Sources/c_snikket/src/tink/io/std/OutputSink.cpp | +444 | -0 |
| Sources/c_snikket/src/tink/streams/Conclusion.cpp | +112 | -0 |
| Sources/c_snikket/src/tink/streams/Empty.cpp | +203 | -0 |
| Sources/c_snikket/src/tink/streams/FutureStream.cpp | +175 | -0 |
| Sources/c_snikket/src/tink/streams/Generator.cpp | +226 | -0 |
| Sources/c_snikket/src/tink/streams/Handled.cpp | +101 | -0 |
| Sources/c_snikket/src/tink/streams/IdealStreamBase.cpp | +115 | -0 |
| Sources/c_snikket/src/tink/streams/IdealizeStream.cpp | +228 | -0 |
| Sources/c_snikket/src/tink/streams/Reduction.cpp | +104 | -0 |
| Sources/c_snikket/src/tink/streams/ReductionStep.cpp | +89 | -0 |
| Sources/c_snikket/src/tink/streams/RegroupResult.cpp | +115 | -0 |
| Sources/c_snikket/src/tink/streams/RegroupStatus.cpp | +93 | -0 |
| Sources/c_snikket/src/tink/streams/Single.cpp | +200 | -0 |
| Sources/c_snikket/src/tink/streams/Step.cpp | +100 | -0 |
| Sources/c_snikket/src/tink/streams/StreamBase.cpp | +333 | -0 |
| Sources/c_snikket/src/tink/streams/StreamObject.cpp | +41 | -0 |
| Sources/c_snikket/src/tink/streams/_Stream/CompoundStream.cpp | +318 | -0 |
| Sources/c_snikket/src/tink/streams/_Stream/ErrorStream.cpp | +169 | -0 |
| Sources/c_snikket/src/tink/streams/_Stream/Handler_Impl_.cpp | +127 | -0 |
| Sources/c_snikket/src/tink/streams/_Stream/Reducer_Impl_.cpp | +114 | -0 |
| Sources/c_snikket/src/tink/streams/_Stream/RegroupStream.cpp | +291 | -0 |
| Sources/c_snikket/src/tink/streams/_Stream/Regrouper_Impl_.cpp | +118 | -0 |
| Sources/c_snikket/src/tink/streams/_Stream/Stream_Impl_.cpp | +143 | -0 |
| Sources/c_snikket/src/tink/url/_Host/Host_Impl_.cpp | +193 | -0 |
| Sources/c_snikket/src/tink/url/_Path/Path_Impl_.cpp | +214 | -0 |
| Sources/libdatachannel/include/config.h | +0 | -0 |
| Sources/libdatachannel/include/rtc | +1 | -0 |
| Sources/libdatachannel/libdatachannel | +1 | -0 |
| Sources/libpcre2-16/include/config.h | +1 | -0 |
| Sources/libpcre2-16/include/pcre2.h | +1 | -0 |
| Sources/libpcre2-16/pcre2 | +1 | -0 |
| Sources/libpcre2-16/pcre2_chartables.c | +1 | -0 |
| Sources/libpcre2-8/include/config.h | +1 | -0 |
| Sources/libpcre2-8/include/pcre2.h | +1 | -0 |
| Sources/libpcre2-8/pcre2 | +1 | -0 |
| Sources/libpcre2-8/pcre2_chartables.c | +1 | -0 |
| Sources/mbedtls/include/.gitignore | +4 | -0 |
| Sources/mbedtls/include/mbedtls/aes.h | +689 | -0 |
| Sources/mbedtls/include/mbedtls/aesni.h | +136 | -0 |
| Sources/mbedtls/include/mbedtls/arc4.h | +145 | -0 |
| Sources/mbedtls/include/mbedtls/aria.h | +373 | -0 |
| Sources/mbedtls/include/mbedtls/asn1.h | +616 | -0 |
| Sources/mbedtls/include/mbedtls/asn1write.h | +370 | -0 |
| Sources/mbedtls/include/mbedtls/base64.h | +98 | -0 |
| Sources/mbedtls/include/mbedtls/bignum.h | +1104 | -0 |
| Sources/mbedtls/include/mbedtls/blowfish.h | +288 | -0 |
| Sources/mbedtls/include/mbedtls/bn_mul.h | +1004 | -0 |
| Sources/mbedtls/include/mbedtls/camellia.h | +327 | -0 |
| Sources/mbedtls/include/mbedtls/ccm.h | +311 | -0 |
| Sources/mbedtls/include/mbedtls/certs.h | +250 | -0 |
| Sources/mbedtls/include/mbedtls/chacha20.h | +228 | -0 |
| Sources/mbedtls/include/mbedtls/chachapoly.h | +359 | -0 |
| Sources/mbedtls/include/mbedtls/check_config.h | +958 | -0 |
| Sources/mbedtls/include/mbedtls/cipher.h | +1102 | -0 |
| Sources/mbedtls/include/mbedtls/cipher_internal.h | +150 | -0 |
| Sources/mbedtls/include/mbedtls/cmac.h | +247 | -0 |
| Sources/mbedtls/include/mbedtls/compat-1.3.h | +2529 | -0 |
| Sources/mbedtls/include/mbedtls/config.h | +4130 | -0 |
| Sources/mbedtls/include/mbedtls/config_psa.h | +833 | -0 |
| Sources/mbedtls/include/mbedtls/constant_time.h | +45 | -0 |
| Sources/mbedtls/include/mbedtls/ctr_drbg.h | +611 | -0 |
| Sources/mbedtls/include/mbedtls/debug.h | +311 | -0 |
| Sources/mbedtls/include/mbedtls/des.h | +370 | -0 |
| Sources/mbedtls/include/mbedtls/dhm.h | +1103 | -0 |
| Sources/mbedtls/include/mbedtls/ecdh.h | +446 | -0 |
| Sources/mbedtls/include/mbedtls/ecdsa.h | +624 | -0 |
| Sources/mbedtls/include/mbedtls/ecjpake.h | +275 | -0 |
| Sources/mbedtls/include/mbedtls/ecp.h | +1311 | -0 |
| Sources/mbedtls/include/mbedtls/ecp_internal.h | +297 | -0 |
| Sources/mbedtls/include/mbedtls/entropy.h | +294 | -0 |
| Sources/mbedtls/include/mbedtls/entropy_poll.h | +108 | -0 |
| Sources/mbedtls/include/mbedtls/error.h | +217 | -0 |
| Sources/mbedtls/include/mbedtls/gcm.h | +327 | -0 |
| Sources/mbedtls/include/mbedtls/havege.h | +80 | -0 |
| Sources/mbedtls/include/mbedtls/hkdf.h | +140 | -0 |
| Sources/mbedtls/include/mbedtls/hmac_drbg.h | +474 | -0 |
| Sources/mbedtls/include/mbedtls/md.h | +493 | -0 |
| Sources/mbedtls/include/mbedtls/md2.h | +305 | -0 |
| Sources/mbedtls/include/mbedtls/md4.h | +310 | -0 |
| Sources/mbedtls/include/mbedtls/md5.h | +310 | -0 |
| Sources/mbedtls/include/mbedtls/md_internal.h | +90 | -0 |
| Sources/mbedtls/include/mbedtls/memory_buffer_alloc.h | +149 | -0 |
| Sources/mbedtls/include/mbedtls/net.h | +35 | -0 |
| Sources/mbedtls/include/mbedtls/net_sockets.h | +301 | -0 |
| Sources/mbedtls/include/mbedtls/nist_kw.h | +182 | -0 |
| Sources/mbedtls/include/mbedtls/oid.h | +649 | -0 |
| Sources/mbedtls/include/mbedtls/padlock.h | +125 | -0 |
| Sources/mbedtls/include/mbedtls/pem.h | +153 | -0 |
| Sources/mbedtls/include/mbedtls/pk.h | +918 | -0 |
| Sources/mbedtls/include/mbedtls/pk_internal.h | +140 | -0 |
| Sources/mbedtls/include/mbedtls/pkcs11.h | +246 | -0 |
| Sources/mbedtls/include/mbedtls/pkcs12.h | +140 | -0 |
| Sources/mbedtls/include/mbedtls/pkcs5.h | +111 | -0 |
| Sources/mbedtls/include/mbedtls/platform.h | +428 | -0 |
| Sources/mbedtls/include/mbedtls/platform_time.h | +72 | -0 |
| Sources/mbedtls/include/mbedtls/platform_util.h | +283 | -0 |
| Sources/mbedtls/include/mbedtls/poly1305.h | +194 | -0 |
| Sources/mbedtls/include/mbedtls/psa_util.h | +512 | -0 |
| Sources/mbedtls/include/mbedtls/ripemd160.h | +236 | -0 |
| Sources/mbedtls/include/mbedtls/rsa.h | +1351 | -0 |
| Sources/mbedtls/include/mbedtls/rsa_internal.h | +224 | -0 |
| Sources/mbedtls/include/mbedtls/sha1.h | +352 | -0 |
| Sources/mbedtls/include/mbedtls/sha256.h | +300 | -0 |
| Sources/mbedtls/include/mbedtls/sha512.h | +316 | -0 |
| Sources/mbedtls/include/mbedtls/ssl.h | +4427 | -0 |
| Sources/mbedtls/include/mbedtls/ssl_cache.h | +149 | -0 |
| Sources/mbedtls/include/mbedtls/ssl_ciphersuites.h | +556 | -0 |
| Sources/mbedtls/include/mbedtls/ssl_cookie.h | +113 | -0 |
| Sources/mbedtls/include/mbedtls/ssl_internal.h | +1352 | -0 |
| Sources/mbedtls/include/mbedtls/ssl_ticket.h | +140 | -0 |
| Sources/mbedtls/include/mbedtls/threading.h | +126 | -0 |
| Sources/mbedtls/include/mbedtls/timing.h | +151 | -0 |
| Sources/mbedtls/include/mbedtls/version.h | +110 | -0 |
| Sources/mbedtls/include/mbedtls/x509.h | +380 | -0 |
| Sources/mbedtls/include/mbedtls/x509_crl.h | +172 | -0 |
| Sources/mbedtls/include/mbedtls/x509_crt.h | +1097 | -0 |
| Sources/mbedtls/include/mbedtls/x509_csr.h | +306 | -0 |
| Sources/mbedtls/include/mbedtls/xtea.h | +139 | -0 |
| Sources/mbedtls/include/psa/crypto.h | +3910 | -0 |
| Sources/mbedtls/include/psa/crypto_builtin_composites.h | +85 | -0 |
| Sources/mbedtls/include/psa/crypto_builtin_primitives.h | +125 | -0 |
| Sources/mbedtls/include/psa/crypto_compat.h | +528 | -0 |
| Sources/mbedtls/include/psa/crypto_config.h | +130 | -0 |
| Sources/mbedtls/include/psa/crypto_driver_common.h | +56 | -0 |
| Sources/mbedtls/include/psa/crypto_driver_contexts_composites.h | +93 | -0 |
| Sources/mbedtls/include/psa/crypto_driver_contexts_primitives.h | +117 | -0 |
| Sources/mbedtls/include/psa/crypto_extra.h | +816 | -0 |
| Sources/mbedtls/include/psa/crypto_platform.h | +111 | -0 |
| Sources/mbedtls/include/psa/crypto_se_driver.h | +1395 | -0 |
| Sources/mbedtls/include/psa/crypto_sizes.h | +1171 | -0 |
| Sources/mbedtls/include/psa/crypto_struct.h | +478 | -0 |
| Sources/mbedtls/include/psa/crypto_types.h | +464 | -0 |
| Sources/mbedtls/include/psa/crypto_values.h | +2373 | -0 |
| Sources/mbedtls/library/.gitignore | +4 | -0 |
| Sources/mbedtls/library/CMakeLists.txt | +242 | -0 |
| Sources/mbedtls/library/Makefile | +295 | -0 |
| Sources/mbedtls/library/aes.c | +2183 | -0 |
| Sources/mbedtls/library/aesni.c | +464 | -0 |
| Sources/mbedtls/library/arc4.c | +188 | -0 |
| Sources/mbedtls/library/aria.c | +1045 | -0 |
| Sources/mbedtls/library/asn1parse.c | +475 | -0 |
| Sources/mbedtls/library/asn1write.c | +479 | -0 |
| Sources/mbedtls/library/base64.c | +272 | -0 |
| Sources/mbedtls/library/bignum.c | +3155 | -0 |
| Sources/mbedtls/library/blowfish.c | +667 | -0 |
| Sources/mbedtls/library/camellia.c | +1080 | -0 |
| Sources/mbedtls/library/ccm.c | +539 | -0 |
| Sources/mbedtls/library/certs.c | +1746 | -0 |
| Sources/mbedtls/library/chacha20.c | +546 | -0 |
| Sources/mbedtls/library/chachapoly.c | +517 | -0 |
| Sources/mbedtls/library/check_crypto_config.h | +91 | -0 |
| Sources/mbedtls/library/cipher.c | +1632 | -0 |
| Sources/mbedtls/library/cipher_wrap.c | +2400 | -0 |
| Sources/mbedtls/library/cmac.c | +1087 | -0 |
| Sources/mbedtls/library/common.h | +350 | -0 |
| Sources/mbedtls/library/constant_time.c | +831 | -0 |
| Sources/mbedtls/library/constant_time_internal.h | +335 | -0 |
| Sources/mbedtls/library/constant_time_invasive.h | +51 | -0 |
| Sources/mbedtls/library/ctr_drbg.c | +891 | -0 |
| Sources/mbedtls/library/debug.c | +408 | -0 |
| Sources/mbedtls/library/des.c | +1055 | -0 |
| Sources/mbedtls/library/dhm.c | +711 | -0 |
| Sources/mbedtls/library/ecdh.c | +731 | -0 |
| Sources/mbedtls/library/ecdsa.c | +1006 | -0 |
| Sources/mbedtls/library/ecjpake.c | +1136 | -0 |
| Sources/mbedtls/library/ecp.c | +3611 | -0 |
| Sources/mbedtls/library/ecp_curves.c | +1475 | -0 |
| Sources/mbedtls/library/ecp_invasive.h | +81 | -0 |
| Sources/mbedtls/library/entropy.c | +728 | -0 |
| Sources/mbedtls/library/entropy_poll.c | +289 | -0 |
| Sources/mbedtls/library/error.c | +976 | -0 |
| Sources/mbedtls/library/gcm.c | +995 | -0 |
| Sources/mbedtls/library/havege.c | +237 | -0 |
| Sources/mbedtls/library/hkdf.c | +189 | -0 |
| Sources/mbedtls/library/hmac_drbg.c | +622 | -0 |
| Sources/mbedtls/library/md.c | +884 | -0 |
| Sources/mbedtls/library/md2.c | +353 | -0 |
| Sources/mbedtls/library/md4.c | +454 | -0 |
| Sources/mbedtls/library/md5.c | +468 | -0 |
| Sources/mbedtls/library/memory_buffer_alloc.c | +744 | -0 |
| Sources/mbedtls/library/mps_common.h | +195 | -0 |
| Sources/mbedtls/library/mps_error.h | +103 | -0 |
| Sources/mbedtls/library/mps_reader.c | +559 | -0 |
| Sources/mbedtls/library/mps_reader.h | +382 | -0 |
| Sources/mbedtls/library/mps_trace.c | +127 | -0 |
| Sources/mbedtls/library/mps_trace.h | +169 | -0 |
| Sources/mbedtls/library/net_sockets.c | +711 | -0 |
| Sources/mbedtls/library/nist_kw.c | +706 | -0 |
| Sources/mbedtls/library/oid.c | +763 | -0 |
| Sources/mbedtls/library/padlock.c | +164 | -0 |
| Sources/mbedtls/library/pem.c | +483 | -0 |
| Sources/mbedtls/library/pk.c | +642 | -0 |
| Sources/mbedtls/library/pk_wrap.c | +1063 | -0 |
| Sources/mbedtls/library/pkcs11.c | +232 | -0 |
| Sources/mbedtls/library/pkcs12.c | +404 | -0 |
| Sources/mbedtls/library/pkcs5.c | +415 | -0 |
| Sources/mbedtls/library/pkparse.c | +1539 | -0 |
| Sources/mbedtls/library/pkwrite.c | +617 | -0 |
| Sources/mbedtls/library/platform.c | +386 | -0 |
| Sources/mbedtls/library/platform_util.c | +133 | -0 |
| Sources/mbedtls/library/poly1305.c | +526 | -0 |
| Sources/mbedtls/library/psa_crypto.c | +5498 | -0 |
| Sources/mbedtls/library/psa_crypto_aead.c | +398 | -0 |
| Sources/mbedtls/library/psa_crypto_aead.h | +151 | -0 |
| Sources/mbedtls/library/psa_crypto_cipher.c | +593 | -0 |
| Sources/mbedtls/library/psa_crypto_cipher.h | +305 | -0 |
| Sources/mbedtls/library/psa_crypto_client.c | +78 | -0 |
| Sources/mbedtls/library/psa_crypto_core.h | +519 | -0 |
| Sources/mbedtls/library/psa_crypto_driver_wrappers.c | +1865 | -0 |
| Sources/mbedtls/library/psa_crypto_driver_wrappers.h | +268 | -0 |
| Sources/mbedtls/library/psa_crypto_ecp.c | +468 | -0 |
| Sources/mbedtls/library/psa_crypto_ecp.h | +222 | -0 |
| Sources/mbedtls/library/psa_crypto_hash.c | +489 | -0 |
| Sources/mbedtls/library/psa_crypto_hash.h | +234 | -0 |
| Sources/mbedtls/library/psa_crypto_invasive.h | +86 | -0 |
| Sources/mbedtls/library/psa_crypto_its.h | +149 | -0 |
| Sources/mbedtls/library/psa_crypto_mac.c | +500 | -0 |
| Sources/mbedtls/library/psa_crypto_mac.h | +276 | -0 |
| Sources/mbedtls/library/psa_crypto_random_impl.h | +205 | -0 |
| Sources/mbedtls/library/psa_crypto_rsa.c | +526 | -0 |
| Sources/mbedtls/library/psa_crypto_rsa.h | +215 | -0 |
| Sources/mbedtls/library/psa_crypto_se.c | +379 | -0 |
| Sources/mbedtls/library/psa_crypto_se.h | +202 | -0 |
| Sources/mbedtls/library/psa_crypto_slot_management.c | +581 | -0 |
| Sources/mbedtls/library/psa_crypto_slot_management.h | +224 | -0 |
| Sources/mbedtls/library/psa_crypto_storage.c | +484 | -0 |
| Sources/mbedtls/library/psa_crypto_storage.h | +399 | -0 |
| Sources/mbedtls/library/psa_its_file.c | +250 | -0 |
| Sources/mbedtls/library/ripemd160.c | +529 | -0 |
| Sources/mbedtls/library/rsa.c | +2582 | -0 |
| Sources/mbedtls/library/rsa_internal.c | +486 | -0 |
| Sources/mbedtls/library/sha1.c | +546 | -0 |
| Sources/mbedtls/library/sha256.c | +575 | -0 |
| Sources/mbedtls/library/sha512.c | +652 | -0 |
| Sources/mbedtls/library/ssl_cache.c | +339 | -0 |
| Sources/mbedtls/library/ssl_ciphersuites.c | +2369 | -0 |
| Sources/mbedtls/library/ssl_cli.c | +4611 | -0 |
| Sources/mbedtls/library/ssl_cookie.c | +253 | -0 |
| Sources/mbedtls/library/ssl_msg.c | +5986 | -0 |
| Sources/mbedtls/library/ssl_srv.c | +4861 | -0 |
| Sources/mbedtls/library/ssl_ticket.c | +418 | -0 |
| Sources/mbedtls/library/ssl_tls.c | +7773 | -0 |
| Sources/mbedtls/library/ssl_tls13_keys.c | +353 | -0 |
| Sources/mbedtls/library/ssl_tls13_keys.h | +274 | -0 |
| Sources/mbedtls/library/threading.c | +187 | -0 |
| Sources/mbedtls/library/timing.c | +524 | -0 |
| Sources/mbedtls/library/version.c | +44 | -0 |
| Sources/mbedtls/library/version_features.c | +872 | -0 |
| Sources/mbedtls/library/x509.c | +1098 | -0 |
| Sources/mbedtls/library/x509_create.c | +374 | -0 |
| Sources/mbedtls/library/x509_crl.c | +762 | -0 |
| Sources/mbedtls/library/x509_crt.c | +3403 | -0 |
| Sources/mbedtls/library/x509_csr.c | +406 | -0 |
| Sources/mbedtls/library/x509write_crt.c | +543 | -0 |
| Sources/mbedtls/library/x509write_csr.c | +335 | -0 |
| Sources/mbedtls/library/xtea.c | +241 | -0 |
| Sources/strophe/include/strophe.h | +1 | -0 |
| Sources/strophe/libstrophe | +1 | -0 |
| Sources/usrsctp/include/usrsctp.h | +1 | -0 |
| Sources/usrsctp/usrsctp | +1 | -0 |
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..06b9948
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+.build
+.swiftpm
+Package.resolved
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..7264edd
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,15 @@
+[submodule "Sources/strophe/libstrophe"]
+ path = Sources/strophe/libstrophe
+ url = https://github.com/strophe/libstrophe
+[submodule "Sources/libpcre2-8/pcre2"]
+ path = Sources/libpcre2-8/pcre2
+ url = https://github.com/PCRE2Project/pcre2
+[submodule "Sources/libpcre2-16/pcre2"]
+ path = Sources/libpcre2-16/pcre2
+ url = https://github.com/PCRE2Project/pcre2
+[submodule "Sources/usrsctp/usrsctp"]
+ path = Sources/usrsctp/usrsctp
+ url = https://github.com/singpolyma/usrsctp
+[submodule "Sources/libdatachannel/libdatachannel"]
+ path = Sources/libdatachannel/libdatachannel
+ url = https://github.com/paullouisageneau/libdatachannel
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..64128e7
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,204 @@
+Please check submodules and vendored dependencies for their respective licenses.
+Everything not otherwise marked is:
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
diff --git a/Package.swift b/Package.swift
new file mode 100644
index 0000000..c05ec94
--- /dev/null
+++ b/Package.swift
@@ -0,0 +1,201 @@
+// swift-tools-version: 5.8
+// The swift-tools-version declares the minimum version of Swift required to build this package.
+
+import PackageDescription
+
+let package = Package(
+ name: "Snikket",
+ platforms: [
+ .iOS(.v12),
+ .macOS(.v10_15),
+ .tvOS(.v12),
+ ],
+ products: [
+ .library(
+ name: "Snikket",
+ targets: ["Snikket"]),
+ ],
+ dependencies: [
+ .package(url: "https://github.com/apple/swift-docc-plugin", branch: "main"),
+ .package(url: "https://github.com/krzyzanowskim/OpenSSL-Package", from: "3.3.3000"),
+ .package(url: "https://github.com/alta/swift-opus", branch: "main"),
+ ],
+ targets: [
+ // Targets are the basic building blocks of a package, defining a module or a test suite.
+ // Targets can depend on other targets in this package and products from dependencies.
+ .target(
+ name: "strophe",
+ dependencies: [.product(name: "OpenSSL", package: "OpenSSL-Package")],
+ exclude: [
+ "libstrophe/src/compression_dummy.c",
+ "libstrophe/src/parser_expat.c",
+ "libstrophe/src/tls_gnutls.c",
+ "libstrophe/src/tls_schannel.c",
+ "libstrophe/src/tls_dummy.c"
+ ],
+ sources: ["libstrophe/src"],
+ linkerSettings: [
+ .linkedLibrary("resolv")
+ ]
+ ),
+ .target(
+ name: "usrsctp",
+ dependencies: [],
+ exclude: [
+ "usrsctp/.github",
+ "usrsctp/programs",
+ "usrsctp/fuzzer",
+ "usrsctp/cmake",
+ "usrsctp/usrsctplib/netinet6/meson.build"
+ ],
+ cxxSettings: [
+ CXXSetting.headerSearchPath("usrsctp/usrsctplib"),
+ CXXSetting.define("HAVE_NETINET_IP_ICMP_H"),
+ CXXSetting.define("HAVE_SA_LEN"),
+ CXXSetting.define("HAVE_SCONN_LEN"),
+ CXXSetting.define("HAVE_SIN6_LEN"),
+ CXXSetting.define("HAVE_SIN_LEN"),
+ CXXSetting.define("HAVE_STDATOMIC_H"),
+ CXXSetting.define("HAVE_SYS_QUEUE_H"),
+ CXXSetting.define("INET"),
+ CXXSetting.define("INET6"),
+ CXXSetting.define("SCTP_DEBUG"),
+ CXXSetting.define("SCTP_PROCESS_LEVEL_LOCKS"),
+ CXXSetting.define("SCTP_SIMPLE_ALLOCATOR"),
+ CXXSetting.define("__APPLE_USE_RFC_2292", .when(platforms: [.iOS, .macOS, .tvOS, .watchOS])),
+ CXXSetting.define("__Userspace__"),
+ ]
+ ),
+ .target(
+ name: "libdatachannel",
+ dependencies: [.product(name: "OpenSSL", package: "OpenSSL-Package"), "usrsctp"],
+ exclude: [
+ "libdatachannel/test",
+ "libdatachannel/src/websocketserver.cpp",
+ "libdatachannel/src/impl/websocketserver.cpp",
+ "libdatachannel/deps/libsrtp/crypto/test",
+ "libdatachannel/deps/libsrtp/crypto/Makefile.in",
+ "libdatachannel/deps/libsrtp/crypto/hash/hmac.c",
+ "libdatachannel/deps/libsrtp/crypto/hash/hmac_mbedtls.c",
+ "libdatachannel/deps/libsrtp/crypto/hash/hmac_nss.c",
+ "libdatachannel/deps/libsrtp/crypto/cipher/aes.c",
+ "libdatachannel/deps/libsrtp/crypto/cipher/aes_icm.c",
+ "libdatachannel/deps/libsrtp/crypto/cipher/aes_icm_nss.c",
+ "libdatachannel/deps/libsrtp/crypto/cipher/aes_gcm_nss.c",
+ "libdatachannel/deps/libsrtp/crypto/cipher/aes_icm_mbedtls.c",
+ "libdatachannel/deps/libsrtp/crypto/cipher/aes_gcm_mbedtls.c",
+ ],
+ sources: ["libdatachannel/src", "libdatachannel/deps/libsrtp/crypto", "libdatachannel/deps/libsrtp/srtp", "libdatachannel/deps/libjuice/src"],
+ cxxSettings: [
+ CXXSetting.headerSearchPath("include/rtc"),
+ CXXSetting.headerSearchPath("libdatachannel/src"),
+ CXXSetting.headerSearchPath("libdatachannel/deps/plog/include"),
+ CXXSetting.headerSearchPath("libdatachannel/deps/libsrtp/include"),
+ CXXSetting.headerSearchPath("libdatachannel/deps/libsrtp"),
+ CXXSetting.headerSearchPath("libdatachannel/deps/libsrtp/crypto/include"),
+ CXXSetting.headerSearchPath("libdatachannel/deps/libjuice/include"),
+ CXXSetting.headerSearchPath("libdatachannel/deps/libjuice/include/juice"),
+ CXXSetting.define("OPENSSL"),
+ CXXSetting.define("GCM"),
+ CXXSetting.define("RTC_ENABLE_MEDIA=1"),
+ CXXSetting.define("RTC_ENABLE_WEBSOCKET=0"),
+ CXXSetting.define("RTC_EXPORTS"),
+ CXXSetting.define("HAVE_CONFIG_H"),
+ CXXSetting.define("HAVE_ARPA_INET_H"),
+ CXXSetting.define("HAVE_INTTYPES_H"),
+ CXXSetting.define("HAVE_MACHINE_TYPES_H"),
+ CXXSetting.define("HAVE_NETINET_IN_H"),
+ CXXSetting.define("HAVE_STDINT_H"),
+ CXXSetting.define("HAVE_STDLIB_H"),
+ CXXSetting.define("HAVE_SYS_SOCKET_H"),
+ CXXSetting.define("HAVE_SYS_TYPES_H"),
+ CXXSetting.define("HAVE_UNISTD_H"),
+ CXXSetting.define("HAVE_INET_ATON"),
+ CXXSetting.define("HAVE_INET_PTON"),
+ CXXSetting.define("HAVE_SIGACTION"),
+ CXXSetting.define("HAVE_USLEEP"),
+ CXXSetting.define("HAVE_UINT8_T"),
+ CXXSetting.define("HAVE_UINT16_T"),
+ CXXSetting.define("HAVE_UINT32_T"),
+ CXXSetting.define("HAVE_UINT64_T"),
+ CXXSetting.define("HAVE_INT32_T"),
+ CXXSetting.define("SIZEOF_UNSIGNED_LONG=8"),
+ CXXSetting.define("SIZEOF_UNSIGNED_LONG_LONG=8"),
+ CXXSetting.define("HAVE_INLINE"),
+ CXXSetting.define("PACKAGE_VERSION=\"2.5.0\""),
+ CXXSetting.define("PACKAGE_STRING=\"libsrtp2 2.5.0\""),
+ ]
+ ),
+ .target(
+ name: "libpcre2-8",
+ exclude: [
+ "pcre2/deps",
+ "pcre2/maint",
+ "pcre2/src/pcre2demo.c",
+ "pcre2/src/pcre2test.c",
+ "pcre2/src/pcre2grep.c",
+ "pcre2/src/pcre2posix.c",
+ "pcre2/src/pcre2_jit_compile.c",
+ "pcre2/src/pcre2_jit_test.c",
+ "pcre2/src/pcre2_dftables.c",
+ "pcre2/src/pcre2test.c",
+ "pcre2/src/pcre2posix_test.c",
+ "pcre2/src/pcre2_jit_test.c",
+ "pcre2/src/pcre2_fuzzsupport.c",
+ ],
+ cSettings: [
+ CSetting.headerSearchPath("pcre2/src"),
+ CSetting.define("PCRE2_CODE_UNIT_WIDTH=8"),
+ CSetting.define("SUPPORT_PCRE2_8"),
+ CSetting.define("HAVE_CONFIG_H"),
+ CSetting.define("SUPPORT_UNICODE"),
+ ]
+ ),
+ .target(
+ name: "libpcre2-16",
+ exclude: [
+ "pcre2/deps",
+ "pcre2/maint",
+ "pcre2/src/pcre2demo.c",
+ "pcre2/src/pcre2test.c",
+ "pcre2/src/pcre2grep.c",
+ "pcre2/src/pcre2posix.c",
+ "pcre2/src/pcre2_dftables.c",
+ "pcre2/src/pcre2test.c",
+ "pcre2/src/pcre2posix_test.c",
+ "pcre2/src/pcre2_jit_test.c",
+ "pcre2/src/pcre2_fuzzsupport.c",
+ ],
+ cSettings: [
+ CSetting.headerSearchPath("pcre2/src"),
+ CSetting.define("PCRE2_CODE_UNIT_WIDTH=16"),
+ CSetting.define("SUPPORT_PCRE2_16"),
+ CSetting.define("HAVE_CONFIG_H"),
+ CSetting.define("SUPPORT_UNICODE"),
+ ]
+ ),
+ .target(
+ name: "mbedtls"
+ ),
+ .target(
+ name: "c_snikket",
+ dependencies: ["strophe", "libdatachannel", "libpcre2-8", "libpcre2-16", .product(name: "Copus", package: "swift-opus"), "mbedtls"],
+ cSettings: [
+ CSetting.headerSearchPath("iinclude"),
+ CSetting.define("HX_SMART_STRINGS=1"),
+ CSetting.define("HXCPP_M64"),
+ CSetting.define("HXCPP_VISIT_ALLOCS"),
+ CSetting.define("HXCPP_API_LEVEL=430"),
+ CSetting.define("HXCPP_ALIGN_ALLOC=1"),
+ CSetting.define("SQLITE_NOHAVE_SYSTEM", .when(platforms: [.iOS, .tvOS, .watchOS])),
+ CSetting.define("IPHONE", .when(platforms: [.iOS])),
+ CSetting.define("APPLETV", .when(platforms: [.tvOS])),
+ CSetting.define("HX_APPLEWATCH", .when(platforms: [.watchOS])),
+ CSetting.define("HX_MACOS", .when(platforms: [.macOS])),
+ ]
+ ),
+ .target(name: "Snikket", dependencies: ["c_snikket"]),
+ ],
+ cLanguageStandard: CLanguageStandard.c17,
+ cxxLanguageStandard: CXXLanguageStandard.cxx17
+)
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..d09ea8e
--- /dev/null
+++ b/README.md
@@ -0,0 +1,9 @@
+https://borogove.dev
+
+This repository exists to make adding the Borogove SDK to XCode projects (via "Add Package Dependencies") or SwiftPM easier.
+
+# Installation
+
+[Swift Package Manager](https://swift.org/package-manager/)
+
+ dependencies: [.package(url: "https://borogove.dev/src/r/swiftpm")]
diff --git a/Sources/Snikket/Snikket.swift b/Sources/Snikket/Snikket.swift
new file mode 100644
index 0000000..b6d5076
--- /dev/null
+++ b/Sources/Snikket/Snikket.swift
@@ -0,0 +1,2072 @@
+import c_snikket
+
+public func setup(_ handler: @convention(c) @escaping (UnsafePointer<CChar>?)->Void) {
+ c_snikket.snikket_setup(handler)
+}
+
+public func stop(_ wait: Bool) {
+ c_snikket.snikket_stop(wait)
+}
+
+public protocol SDKObject {
+ var o: UnsafeMutableRawPointer {get}
+}
+
+internal func useString(_ mptr: UnsafePointer<CChar>?) -> String? {
+ if let ptr = mptr {
+ let r = String(cString: ptr)
+ c_snikket.snikket_release(ptr)
+ return r
+ } else {
+ return nil
+ }
+}
+
+internal func useString(_ mptr: UnsafeMutableRawPointer?) -> String? {
+ return useString(UnsafePointer(mptr?.assumingMemoryBound(to: CChar.self)))
+}
+
+public protocol MediaStore: SDKObject {
+}
+
+public class AnyMediaStore: MediaStore {
+ public let o: UnsafeMutableRawPointer
+
+ internal init(_ ptr: UnsafeMutableRawPointer) {
+ o = ptr
+ }
+
+ deinit {
+ c_snikket.snikket_release(o)
+ }
+
+}
+
+public class MediaStoreFS: SDKObject, MediaStore {
+ public let o: UnsafeMutableRawPointer
+
+ internal init(_ ptr: UnsafeMutableRawPointer) {
+ o = ptr
+ }
+
+ public init(path: String) {
+ o = c_snikket.snikket_persistence_media_store_f_s_new(path)
+ }
+
+ public func getMediaPath(uri: String, callback: @escaping (String?)->Void) -> Void {
+ let __callback_ptr = UnsafeMutableRawPointer(Unmanaged.passRetained(callback as AnyObject).toOpaque())
+ c_snikket.snikket_persistence_media_store_f_s_get_media_path(
+ self.o,
+ uri,
+ { (a0, ctx) in
+ let callback = Unmanaged<AnyObject>.fromOpaque(ctx!).takeUnretainedValue() as! (String?)->Void
+ callback(useString(a0))
+ },
+ __callback_ptr
+ )
+ }
+
+ deinit {
+ c_snikket.snikket_release(o)
+ }
+}
+
+public protocol KeyValueStore: SDKObject {
+}
+
+public class AnyKeyValueStore: KeyValueStore {
+ public let o: UnsafeMutableRawPointer
+
+ internal init(_ ptr: UnsafeMutableRawPointer) {
+ o = ptr
+ }
+
+ deinit {
+ c_snikket.snikket_release(o)
+ }
+
+}
+
+public protocol Persistence: SDKObject {
+}
+
+public class AnyPersistence: Persistence {
+ public let o: UnsafeMutableRawPointer
+
+ internal init(_ ptr: UnsafeMutableRawPointer) {
+ o = ptr
+ }
+
+ deinit {
+ c_snikket.snikket_release(o)
+ }
+
+}
+
+public class Hash: SDKObject {
+ public let o: UnsafeMutableRawPointer
+
+ internal init(_ ptr: UnsafeMutableRawPointer) {
+ o = ptr
+ }
+
+ public static func fromHex(algorithm: String, hash: String) -> Hash? {
+ (c_snikket.snikket_hash_from_hex(
+ algorithm,
+ hash
+ )).map({ Hash($0) })
+ }
+
+ public static func fromUri(uri: String) -> Hash? {
+ (c_snikket.snikket_hash_from_uri(
+ uri
+ )).map({ Hash($0) })
+ }
+
+ public var algorithm: String {
+ get {
+ useString(c_snikket.snikket_hash_algorithm(o))!
+ }
+ }
+
+ public func toUri() -> String {
+ useString(c_snikket.snikket_hash_to_uri(
+ self.o
+ ))!
+ }
+
+ public func toHex() -> String {
+ useString(c_snikket.snikket_hash_to_hex(
+ self.o
+ ))!
+ }
+
+ public func toBase64() -> String {
+ useString(c_snikket.snikket_hash_to_base_64(
+ self.o
+ ))!
+ }
+
+ public func toBase64Url() -> String {
+ useString(c_snikket.snikket_hash_to_base_64_url(
+ self.o
+ ))!
+ }
+
+ deinit {
+ c_snikket.snikket_release(o)
+ }
+}
+
+public class ChatAttachment: SDKObject {
+ public let o: UnsafeMutableRawPointer
+
+ internal init(_ ptr: UnsafeMutableRawPointer) {
+ o = ptr
+ }
+
+ public static func create(name: String?, mime: String, size: Int32, uri: String) -> ChatAttachment {
+ ChatAttachment(c_snikket.snikket_chat_attachment_create(
+ name,
+ mime,
+ size,
+ uri
+ )!)
+ }
+
+ public var name: String? {
+ get {
+ useString(c_snikket.snikket_chat_attachment_name(o))
+ }
+ }
+
+ public var mime: String {
+ get {
+ useString(c_snikket.snikket_chat_attachment_mime(o))!
+ }
+ }
+
+ public var size: Int32? {
+ get {
+ c_snikket.snikket_chat_attachment_size(o)
+ }
+ }
+
+ public var uris: Array<String> {
+ get {
+ {var __ret: UnsafeMutablePointer<UnsafePointer<CChar>?>? = nil;let __ret_length = c_snikket.snikket_chat_attachment_uris(o, &__ret);return {let __r = UnsafeMutableBufferPointer<UnsafePointer<CChar>?>(start: __ret, count: __ret_length).map({useString($0)!});c_snikket.snikket_release(__ret);return __r;}();}()
+ }
+ }
+
+ public var hashes: Array<Hash> {
+ get {
+ {var __ret: UnsafeMutablePointer<UnsafeMutableRawPointer?>? = nil;let __ret_length = c_snikket.snikket_chat_attachment_hashes(o, &__ret);return {let __r = UnsafeMutableBufferPointer<UnsafeMutableRawPointer?>(start: __ret, count: __ret_length).map({Hash($0!)});c_snikket.snikket_release(__ret);return __r;}();}()
+ }
+ }
+
+ deinit {
+ c_snikket.snikket_release(o)
+ }
+}
+
+public class ChatMessage: SDKObject {
+ public let o: UnsafeMutableRawPointer
+
+ internal init(_ ptr: UnsafeMutableRawPointer) {
+ o = ptr
+ }
+
+ /**
+ The ID as set by the creator of this message
+ */
+ public var localId: String? {
+ get {
+ useString(c_snikket.snikket_chat_message_local_id(o))
+ }
+ }
+
+ /**
+ The ID as set by the authoritative server
+ */
+ public var serverId: String? {
+ get {
+ useString(c_snikket.snikket_chat_message_server_id(o))
+ }
+ }
+
+ /**
+ The ID of the server which set the serverId
+ */
+ public var serverIdBy: String? {
+ get {
+ useString(c_snikket.snikket_chat_message_server_id_by(o))
+ }
+ }
+
+ /**
+ The type of this message (Chat, Call, etc)
+ */
+ public var type: MessageType {
+ get {
+ c_snikket.snikket_chat_message_type(o)
+ }
+ }
+
+ /**
+ The timestamp of this message, in format YYYY-MM-DDThh:mm:ss[.sss]Z
+ */
+ public var timestamp: String {
+ get {
+ useString(c_snikket.snikket_chat_message_timestamp(o))!
+ }
+ }
+
+ /**
+ The ID of the sender of this message
+ */
+ public var senderId: String {
+ get {
+ useString(c_snikket.snikket_chat_message_sender_id(o))!
+ }
+ }
+
+ /**
+ Message this one is in reply to, or NULL
+ */
+ public var replyToMessage: ChatMessage? {
+ get {
+ (c_snikket.snikket_chat_message_reply_to_message(o)).map({ ChatMessage($0) })
+ }
+ }
+
+ /**
+ ID of the thread this message is in, or NULL
+ */
+ public var threadId: String? {
+ get {
+ useString(c_snikket.snikket_chat_message_thread_id(o))
+ }
+ }
+
+ /**
+ Array of attachments to this message
+ */
+ public var attachments: Array<ChatAttachment> {
+ get {
+ {var __ret: UnsafeMutablePointer<UnsafeMutableRawPointer?>? = nil;let __ret_length = c_snikket.snikket_chat_message_attachments(o, &__ret);return {let __r = UnsafeMutableBufferPointer<UnsafeMutableRawPointer?>(start: __ret, count: __ret_length).map({ChatAttachment($0!)});c_snikket.snikket_release(__ret);return __r;}();}()
+ }
+ }
+
+ /**
+ Body text of this message or NULL
+ */
+ public var text: String? {
+ get {
+ useString(c_snikket.snikket_chat_message_text(o))
+ }
+ }
+
+ /**
+ Language code for the body text
+ */
+ public var lang: String? {
+ get {
+ useString(c_snikket.snikket_chat_message_lang(o))
+ }
+ }
+
+ /**
+ Direction of this message
+ */
+ public var direction: MessageDirection {
+ get {
+ c_snikket.snikket_chat_message_direction(o)
+ }
+ }
+
+ /**
+ Status of this message
+ */
+ public var status: MessageStatus {
+ get {
+ c_snikket.snikket_chat_message_status(o)
+ }
+ set {
+ c_snikket.snikket_chat_message_set_status(o, newValue)
+ }
+ }
+
+ /**
+ Array of past versions of this message, if it has been edited
+ */
+ public var versions: Array<ChatMessage> {
+ get {
+ {var __ret: UnsafeMutablePointer<UnsafeMutableRawPointer?>? = nil;let __ret_length = c_snikket.snikket_chat_message_versions(o, &__ret);return {let __r = UnsafeMutableBufferPointer<UnsafeMutableRawPointer?>(start: __ret, count: __ret_length).map({ChatMessage($0!)});c_snikket.snikket_release(__ret);return __r;}();}()
+ }
+ }
+
+ /**
+ Create a new ChatMessage in reply to this one
+ */
+ public func reply() -> ChatMessageBuilder {
+ ChatMessageBuilder(c_snikket.snikket_chat_message_reply(
+ self.o
+ )!)
+ }
+
+ public func getReplyId() -> String? {
+ useString(c_snikket.snikket_chat_message_get_reply_id(
+ self.o
+ ))
+ }
+
+ /**
+ Get HTML version of the message body
+
+ WARNING: this is possibly untrusted HTML. You must parse or sanitize appropriately!
+ */
+ public func html() -> String {
+ useString(c_snikket.snikket_chat_message_html(
+ self.o
+ ))!
+ }
+
+ /**
+ The ID of the Chat this message is associated with
+ */
+ public func chatId() -> String {
+ useString(c_snikket.snikket_chat_message_chat_id(
+ self.o
+ ))!
+ }
+
+ /**
+ The ID of the account associated with this message
+ */
+ public func account() -> String {
+ useString(c_snikket.snikket_chat_message_account(
+ self.o
+ ))!
+ }
+
+ /**
+ Is this an incoming message?
+ */
+ public func isIncoming() -> Bool {
+ c_snikket.snikket_chat_message_is_incoming(
+ self.o
+ )
+ }
+
+ /**
+ The URI of an icon for the thread associated with this message, or NULL
+ */
+ public func threadIcon() -> String?? {
+ useString(c_snikket.snikket_chat_message_thread_icon(
+ self.o
+ ))
+ }
+
+ /**
+ The last status of the call if this message is related to a call
+ */
+ public func callStatus() -> String? {
+ useString(c_snikket.snikket_chat_message_call_status(
+ self.o
+ ))
+ }
+
+ /**
+ The session id of the call if this message is related to a call
+ */
+ public func callSid() -> String? {
+ useString(c_snikket.snikket_chat_message_call_sid(
+ self.o
+ ))
+ }
+
+ /**
+ The duration of the call if this message is related to a call
+ */
+ public func callDuration() -> String? {
+ useString(c_snikket.snikket_chat_message_call_duration(
+ self.o
+ ))
+ }
+
+ deinit {
+ c_snikket.snikket_release(o)
+ }
+}
+
+public class Sqlite: SDKObject, KeyValueStore, Persistence {
+ public let o: UnsafeMutableRawPointer
+
+ internal init(_ ptr: UnsafeMutableRawPointer) {
+ o = ptr
+ }
+
+ /**
+ Create a basic persistence layer based on sqlite
+
+ @param dbfile path to sqlite database
+ @params media a MediaStore to use for media
+ @returns new persistence layer
+ */
+ public init(dbfile: String, media: MediaStore) {
+ o = c_snikket.snikket_persistence_sqlite_new(dbfile, media.o)
+ }
+
+ public func getMessage(accountId: String, chatId: String, serverId: String?, localId: String?, callback: @escaping (ChatMessage?)->Void) -> Void {
+ let __callback_ptr = UnsafeMutableRawPointer(Unmanaged.passRetained(callback as AnyObject).toOpaque())
+ c_snikket.snikket_persistence_sqlite_get_message(
+ self.o,
+ accountId,
+ chatId,
+ serverId,
+ localId,
+ { (a0, ctx) in
+ let callback = Unmanaged<AnyObject>.fromOpaque(ctx!).takeUnretainedValue() as! (ChatMessage?)->Void
+ callback((a0).map({ ChatMessage($0) }))
+ },
+ __callback_ptr
+ )
+ }
+
+ public func removeAccount(accountId: String, completely: Bool) -> Void {
+ c_snikket.snikket_persistence_sqlite_remove_account(
+ self.o,
+ accountId,
+ completely
+ )
+ }
+
+ public func listAccounts(callback: @escaping (Array<String>)->Void) -> Void {
+ let __callback_ptr = UnsafeMutableRawPointer(Unmanaged.passRetained(callback as AnyObject).toOpaque())
+ c_snikket.snikket_persistence_sqlite_list_accounts(
+ self.o,
+ { (a0, a0_length, ctx) in
+ let callback = Unmanaged<AnyObject>.fromOpaque(ctx!).takeUnretainedValue() as! (Array<String>)->Void
+ callback({let __r = UnsafeMutableBufferPointer<UnsafePointer<CChar>?>(start: a0, count: a0_length).map({useString($0)!});c_snikket.snikket_release(a0);return __r;}())
+ },
+ __callback_ptr
+ )
+ }
+
+ deinit {
+ c_snikket.snikket_release(o)
+ }
+}
+
+public class ChatMessageBuilder: SDKObject {
+ public let o: UnsafeMutableRawPointer
+
+ internal init(_ ptr: UnsafeMutableRawPointer) {
+ o = ptr
+ }
+
+ /**
+ @returns a new blank ChatMessageBuilder
+ */
+ public init() {
+ o = c_snikket.snikket_chat_message_builder_new()
+ }
+
+ /**
+ The ID as set by the creator of this message
+ */
+ public var localId: String? {
+ get {
+ useString(c_snikket.snikket_chat_message_builder_local_id(o))
+ }
+ set {
+ c_snikket.snikket_chat_message_builder_set_local_id(o, newValue)
+ }
+ }
+
+ /**
+ The ID as set by the authoritative server
+ */
+ public var serverId: String? {
+ get {
+ useString(c_snikket.snikket_chat_message_builder_server_id(o))
+ }
+ set {
+ c_snikket.snikket_chat_message_builder_set_server_id(o, newValue)
+ }
+ }
+
+ /**
+ The ID of the server which set the serverId
+ */
+ public var serverIdBy: String? {
+ get {
+ useString(c_snikket.snikket_chat_message_builder_server_id_by(o))
+ }
+ set {
+ c_snikket.snikket_chat_message_builder_set_server_id_by(o, newValue)
+ }
+ }
+
+ /**
+ The type of this message (Chat, Call, etc)
+ */
+ public var type: MessageType {
+ get {
+ c_snikket.snikket_chat_message_builder_type(o)
+ }
+ set {
+ c_snikket.snikket_chat_message_builder_set_type(o, newValue)
+ }
+ }
+
+ /**
+ The timestamp of this message, in format YYYY-MM-DDThh:mm:ss[.sss]+00:00
+ */
+ public var timestamp: String? {
+ get {
+ useString(c_snikket.snikket_chat_message_builder_timestamp(o))
+ }
+ set {
+ c_snikket.snikket_chat_message_builder_set_timestamp(o, newValue)
+ }
+ }
+
+ public var senderId: String? {
+ get {
+ useString(c_snikket.snikket_chat_message_builder_sender_id(o))
+ }
+ set {
+ c_snikket.snikket_chat_message_builder_set_sender_id(o, newValue)
+ }
+ }
+
+ /**
+ Message this one is in reply to, or NULL
+ */
+ public var replyToMessage: ChatMessage? {
+ get {
+ (c_snikket.snikket_chat_message_builder_reply_to_message(o)).map({ ChatMessage($0) })
+ }
+ set {
+ c_snikket.snikket_chat_message_builder_set_reply_to_message(o, newValue?.o)
+ }
+ }
+
+ /**
+ ID of the thread this message is in, or NULL
+ */
+ public var threadId: String? {
+ get {
+ useString(c_snikket.snikket_chat_message_builder_thread_id(o))
+ }
+ set {
+ c_snikket.snikket_chat_message_builder_set_thread_id(o, newValue)
+ }
+ }
+
+ /**
+ Array of attachments to this message
+ */
+ public var attachments: Array<ChatAttachment> {
+ get {
+ {var __ret: UnsafeMutablePointer<UnsafeMutableRawPointer?>? = nil;let __ret_length = c_snikket.snikket_chat_message_builder_attachments(o, &__ret);return {let __r = UnsafeMutableBufferPointer<UnsafeMutableRawPointer?>(start: __ret, count: __ret_length).map({ChatAttachment($0!)});c_snikket.snikket_release(__ret);return __r;}();}()
+ }
+ }
+
+ /**
+ Body text of this message or NULL
+ */
+ public var text: String? {
+ get {
+ useString(c_snikket.snikket_chat_message_builder_text(o))
+ }
+ set {
+ c_snikket.snikket_chat_message_builder_set_text(o, newValue)
+ }
+ }
+
+ /**
+ Language code for the body text
+ */
+ public var lang: String? {
+ get {
+ useString(c_snikket.snikket_chat_message_builder_lang(o))
+ }
+ set {
+ c_snikket.snikket_chat_message_builder_set_lang(o, newValue)
+ }
+ }
+
+ /**
+ Direction of this message
+ */
+ public var direction: MessageDirection {
+ get {
+ c_snikket.snikket_chat_message_builder_direction(o)
+ }
+ set {
+ c_snikket.snikket_chat_message_builder_set_direction(o, newValue)
+ }
+ }
+
+ /**
+ Status of this message
+ */
+ public var status: MessageStatus {
+ get {
+ c_snikket.snikket_chat_message_builder_status(o)
+ }
+ set {
+ c_snikket.snikket_chat_message_builder_set_status(o, newValue)
+ }
+ }
+
+ /**
+ Array of past versions of this message, if it has been edited
+ */
+ public var versions: Array<ChatMessage> {
+ get {
+ {var __ret: UnsafeMutablePointer<UnsafeMutableRawPointer?>? = nil;let __ret_length = c_snikket.snikket_chat_message_builder_versions(o, &__ret);return {let __r = UnsafeMutableBufferPointer<UnsafeMutableRawPointer?>(start: __ret, count: __ret_length).map({ChatMessage($0!)});c_snikket.snikket_release(__ret);return __r;}();}()
+ }
+ }
+
+ public func addAttachment(attachment: ChatAttachment) -> Void {
+ c_snikket.snikket_chat_message_builder_add_attachment(
+ self.o,
+ attachment.o
+ )
+ }
+
+ /**
+ Set rich text using an HTML string
+ Also sets the plain text body appropriately
+ */
+ public func setHtml(html: String) -> Void {
+ c_snikket.snikket_chat_message_builder_set_html(
+ self.o,
+ html
+ )
+ }
+
+ /**
+ The ID of the Chat this message is associated with
+ */
+ public func chatId() -> String {
+ useString(c_snikket.snikket_chat_message_builder_chat_id(
+ self.o
+ ))!
+ }
+
+ /**
+ The ID of the sender of this message
+ */
+ public func get_senderId() -> String {
+ useString(c_snikket.snikket_chat_message_builder_get_sender_id(
+ self.o
+ ))!
+ }
+
+ public func isIncoming() -> Bool {
+ c_snikket.snikket_chat_message_builder_is_incoming(
+ self.o
+ )
+ }
+
+ public func build() -> ChatMessage {
+ ChatMessage(c_snikket.snikket_chat_message_builder_build(
+ self.o
+ )!)
+ }
+
+ deinit {
+ c_snikket.snikket_release(o)
+ }
+}
+
+public class Dummy: SDKObject, Persistence {
+ public let o: UnsafeMutableRawPointer
+
+ internal init(_ ptr: UnsafeMutableRawPointer) {
+ o = ptr
+ }
+
+ /**
+ Create a basic persistence layer that persists nothing
+
+ @returns new persistence layer
+ */
+ public init() {
+ o = c_snikket.snikket_persistence_dummy_new()
+ }
+
+ deinit {
+ c_snikket.snikket_release(o)
+ }
+}
+
+public class AudioFormat: SDKObject {
+ public let o: UnsafeMutableRawPointer
+
+ internal init(_ ptr: UnsafeMutableRawPointer) {
+ o = ptr
+ }
+
+ public init(format: String, payloadType: UInt8, clockRate: Int32, channels: Int32) {
+ o = c_snikket.snikket_jingle_audio_format_new(format, payloadType, clockRate, channels)
+ }
+
+ public var clockRate: Int32 {
+ get {
+ c_snikket.snikket_jingle_audio_format_clock_rate(o)
+ }
+ }
+
+ public var channels: Int32 {
+ get {
+ c_snikket.snikket_jingle_audio_format_channels(o)
+ }
+ }
+
+ deinit {
+ c_snikket.snikket_release(o)
+ }
+}
+
+public class MediaStreamTrack: SDKObject {
+ public let o: UnsafeMutableRawPointer
+
+ internal init(_ ptr: UnsafeMutableRawPointer) {
+ o = ptr
+ }
+
+ public var id: String {
+ get {
+ useString(c_snikket.snikket_jingle_media_stream_track_id(o))!
+ }
+ }
+
+ public var muted: Bool {
+ get {
+ c_snikket.snikket_jingle_media_stream_track_muted(o)
+ }
+ }
+
+ public var kind: String {
+ get {
+ useString(c_snikket.snikket_jingle_media_stream_track_kind(o))!
+ }
+ }
+
+ public var supportedAudioFormats: Array<AudioFormat> {
+ get {
+ {var __ret: UnsafeMutablePointer<UnsafeMutableRawPointer?>? = nil;let __ret_length = c_snikket.snikket_jingle_media_stream_track_supported_audio_formats(o, &__ret);return {let __r = UnsafeMutableBufferPointer<UnsafeMutableRawPointer?>(start: __ret, count: __ret_length).map({AudioFormat($0!)});c_snikket.snikket_release(__ret);return __r;}();}()
+ }
+ }
+
+ /**
+ Event fired for new inbound audio frame
+
+ @param callback takes three arguments, the Signed 16-bit PCM data, the clock rate, and the number of channels
+ */
+ public func addPCMListener(callback: @escaping (Array<Int16>, Int32, Int32)->Void) -> Void {
+ let __callback_ptr = UnsafeMutableRawPointer(Unmanaged.passRetained(callback as AnyObject).toOpaque())
+ c_snikket.snikket_jingle_media_stream_track_add_pcm_listener(
+ self.o,
+ { (a0, a0_length, a1, a2, ctx) in
+ let callback = Unmanaged<AnyObject>.fromOpaque(ctx!).takeUnretainedValue() as! (Array<Int16>, Int32, Int32)->Void
+ callback({let __r = UnsafeMutableBufferPointer<Int16>(start: a0, count: a0_length).map({$0});c_snikket.snikket_release(a0);return __r;}(), a1, a2)
+ },
+ __callback_ptr
+ )
+ }
+
+ /**
+ Event fired when ready for next outbound audio frame
+
+ @param callback
+ */
+ public func addReadyForPCMListener(callback: @escaping ()->Void) -> Void {
+ let __callback_ptr = UnsafeMutableRawPointer(Unmanaged.passRetained(callback as AnyObject).toOpaque())
+ c_snikket.snikket_jingle_media_stream_track_add_ready_for_pcm_listener(
+ self.o,
+ { (ctx) in
+ let callback = Unmanaged<AnyObject>.fromOpaque(ctx!).takeUnretainedValue() as! ()->Void
+ callback()
+ },
+ __callback_ptr
+ )
+ }
+
+ /**
+ Send new audio to this track
+
+ @param pcm 16-bit signed linear PCM data (interleaved)
+ @param clockRate the sampling rate of the data
+ @param channels the number of audio channels
+ */
+ public func writePCM(pcm: Array<Int16>, clockRate: Int32, channels: Int32) -> Void {
+ c_snikket.snikket_jingle_media_stream_track_write_pcm(
+ self.o,
+ pcm, pcm.count,
+ clockRate,
+ channels
+ )
+ }
+
+ public func stop() -> Void {
+ c_snikket.snikket_jingle_media_stream_track_stop(
+ self.o
+ )
+ }
+
+ deinit {
+ c_snikket.snikket_release(o)
+ }
+}
+
+public class Chat: SDKObject {
+ public let o: UnsafeMutableRawPointer
+
+ internal init(_ ptr: UnsafeMutableRawPointer) {
+ o = ptr
+ }
+
+ /**
+ ID of this Chat
+ */
+ public var chatId: String {
+ get {
+ useString(c_snikket.snikket_chat_chat_id(o))!
+ }
+ }
+
+ /**
+ Current state of this chat
+ */
+ public var uiState: UiState {
+ get {
+ c_snikket.snikket_chat_ui_state(o)
+ }
+ }
+
+ public var isBlocked: Bool {
+ get {
+ c_snikket.snikket_chat_is_blocked(o)
+ }
+ }
+
+ /**
+ Fetch a page of messages before some point
+
+ @param beforeId id of the message to look before
+ @param beforeTime timestamp of the message to look before,
+ String in format YYYY-MM-DDThh:mm:ss[.sss]+00:00
+ @param handler takes one argument, an array of ChatMessage that are found
+ */
+ public func getMessagesBefore(beforeId: String?, beforeTime: String?, handler: @escaping (Array<ChatMessage>)->Void) -> Void {
+ let __handler_ptr = UnsafeMutableRawPointer(Unmanaged.passRetained(handler as AnyObject).toOpaque())
+ c_snikket.snikket_chat_get_messages_before(
+ self.o,
+ beforeId,
+ beforeTime,
+ { (a0, a0_length, ctx) in
+ let handler = Unmanaged<AnyObject>.fromOpaque(ctx!).takeUnretainedValue() as! (Array<ChatMessage>)->Void
+ handler({let __r = UnsafeMutableBufferPointer<UnsafeMutableRawPointer?>(start: a0, count: a0_length).map({ChatMessage($0!)});c_snikket.snikket_release(a0);return __r;}())
+ },
+ __handler_ptr
+ )
+ }
+
+ /**
+ Fetch a page of messages after some point
+
+ @param afterId id of the message to look after
+ @param afterTime timestamp of the message to look after,
+ String in format YYYY-MM-DDThh:mm:ss[.sss]+00:00
+ @param handler takes one argument, an array of ChatMessage that are found
+ */
+ public func getMessagesAfter(afterId: String?, afterTime: String?, handler: @escaping (Array<ChatMessage>)->Void) -> Void {
+ let __handler_ptr = UnsafeMutableRawPointer(Unmanaged.passRetained(handler as AnyObject).toOpaque())
+ c_snikket.snikket_chat_get_messages_after(
+ self.o,
+ afterId,
+ afterTime,
+ { (a0, a0_length, ctx) in
+ let handler = Unmanaged<AnyObject>.fromOpaque(ctx!).takeUnretainedValue() as! (Array<ChatMessage>)->Void
+ handler({let __r = UnsafeMutableBufferPointer<UnsafeMutableRawPointer?>(start: a0, count: a0_length).map({ChatMessage($0!)});c_snikket.snikket_release(a0);return __r;}())
+ },
+ __handler_ptr
+ )
+ }
+
+ /**
+ Fetch a page of messages around (before, including, and after) some point
+
+ @param aroundId id of the message to look around
+ @param aroundTime timestamp of the message to look around,
+ String in format YYYY-MM-DDThh:mm:ss[.sss]+00:00
+ @param handler takes one argument, an array of ChatMessage that are found
+ */
+ public func getMessagesAround(aroundId: String?, aroundTime: String?, handler: @escaping (Array<ChatMessage>)->Void) -> Void {
+ let __handler_ptr = UnsafeMutableRawPointer(Unmanaged.passRetained(handler as AnyObject).toOpaque())
+ c_snikket.snikket_chat_get_messages_around(
+ self.o,
+ aroundId,
+ aroundTime,
+ { (a0, a0_length, ctx) in
+ let handler = Unmanaged<AnyObject>.fromOpaque(ctx!).takeUnretainedValue() as! (Array<ChatMessage>)->Void
+ handler({let __r = UnsafeMutableBufferPointer<UnsafeMutableRawPointer?>(start: a0, count: a0_length).map({ChatMessage($0!)});c_snikket.snikket_release(a0);return __r;}())
+ },
+ __handler_ptr
+ )
+ }
+
+ /**
+ Send a ChatMessage to this Chat
+
+ @param message the ChatMessage to send
+ */
+ public func sendMessage(message: ChatMessageBuilder) -> Void {
+ c_snikket.snikket_chat_send_message(
+ self.o,
+ message.o
+ )
+ }
+
+ /**
+ Signals that all messages up to and including this one have probably
+ been displayed to the user
+
+ @param message the ChatMessage most recently displayed
+ */
+ public func markReadUpTo(message: ChatMessage) -> Void {
+ c_snikket.snikket_chat_mark_read_up_to(
+ self.o,
+ message.o
+ )
+ }
+
+ /**
+ Save this Chat on the server
+ */
+ public func bookmark() -> Void {
+ c_snikket.snikket_chat_bookmark(
+ self.o
+ )
+ }
+
+ /**
+ Get the list of IDs of participants in this Chat
+
+ @returns array of IDs
+ */
+ public func getParticipants() -> Array<String> {
+ {var __ret: UnsafeMutablePointer<UnsafePointer<CChar>?>? = nil;let __ret_length = c_snikket.snikket_chat_get_participants(
+ self.o
+ , &__ret);return {let __r = UnsafeMutableBufferPointer<UnsafePointer<CChar>?>(start: __ret, count: __ret_length).map({useString($0)!});c_snikket.snikket_release(__ret);return __r;}();}()
+ }
+
+ /**
+ Get the details for one participant in this Chat
+
+ @param participantId the ID of the participant to look up
+ */
+ public func getParticipantDetails(participantId: String) -> Participant {
+ Participant(c_snikket.snikket_chat_get_participant_details(
+ self.o,
+ participantId
+ )!)
+ }
+
+ /**
+ Correct an already-send message by replacing it with a new one
+
+ @param localId the localId of the message to correct
+ must be the localId of the first version ever sent, not a subsequent correction
+ @param message the new ChatMessage to replace it with
+ */
+ public func correctMessage(localId: String, message: ChatMessageBuilder) -> Void {
+ c_snikket.snikket_chat_correct_message(
+ self.o,
+ localId,
+ message.o
+ )
+ }
+
+ /**
+ Add new reaction to a message in this Chat
+
+ @param m ChatMessage to react to
+ @param reaction emoji of the reaction
+ */
+ public func addReaction(m: ChatMessage, reaction: Reaction) -> Void {
+ c_snikket.snikket_chat_add_reaction(
+ self.o,
+ m.o,
+ reaction.o
+ )
+ }
+
+ /**
+ Remove an already-sent reaction from a message
+
+ @param m ChatMessage to remove the reaction from
+ @param reaction the emoji to remove
+ */
+ public func removeReaction(m: ChatMessage, reaction: Reaction) -> Void {
+ c_snikket.snikket_chat_remove_reaction(
+ self.o,
+ m.o,
+ reaction.o
+ )
+ }
+
+ /**
+ Call this whenever the user is typing, can call on every keystroke
+
+ @param threadId optional, what thread the user has selected if any
+ @param content optional, what the user has typed so far
+ */
+ public func typing(threadId: String?, content: String?) -> Void {
+ c_snikket.snikket_chat_typing(
+ self.o,
+ threadId,
+ content
+ )
+ }
+
+ /**
+ Call this whenever the user makes a chat or thread "active" in your UX
+ If you call this with true you MUST later call it will false
+
+ @param active true if the chat is "active", false otherwise
+ @param threadId optional, what thread the user has selected if any
+ */
+ public func setActive(active: Bool, threadId: String?) -> Void {
+ c_snikket.snikket_chat_set_active(
+ self.o,
+ active,
+ threadId
+ )
+ }
+
+ /**
+ Archive this chat
+ */
+ public func close() -> Void {
+ c_snikket.snikket_chat_close(
+ self.o
+ )
+ }
+
+ /**
+ Pin or unpin this chat
+ */
+ public func togglePinned() -> Void {
+ c_snikket.snikket_chat_toggle_pinned(
+ self.o
+ )
+ }
+
+ /**
+ Block this chat so it will not re-open
+ */
+ public func block(reportSpam: ChatMessage?, onServer: Bool) -> Void {
+ c_snikket.snikket_chat_block(
+ self.o,
+ reportSpam?.o,
+ onServer
+ )
+ }
+
+ /**
+ Unblock this chat so it will open again
+ */
+ public func unblock(onServer: Bool) -> Void {
+ c_snikket.snikket_chat_unblock(
+ self.o,
+ onServer
+ )
+ }
+
+ /**
+ Update notification preferences
+ */
+ public func setNotifications(filtered: Bool, mention: Bool, reply: Bool) -> Void {
+ c_snikket.snikket_chat_set_notifications(
+ self.o,
+ filtered,
+ mention,
+ reply
+ )
+ }
+
+ /**
+ Should notifications be filtered?
+ */
+ public func notificationsFiltered() -> Bool {
+ c_snikket.snikket_chat_notifications_filtered(
+ self.o
+ )
+ }
+
+ /**
+ Should a mention produce a notification?
+ */
+ public func notifyMention() -> Bool {
+ c_snikket.snikket_chat_notify_mention(
+ self.o
+ )
+ }
+
+ /**
+ Should a reply produce a notification?
+ */
+ public func notifyReply() -> Bool {
+ c_snikket.snikket_chat_notify_reply(
+ self.o
+ )
+ }
+
+ /**
+ An ID of the most recent message in this chat
+ */
+ public func lastMessageId() -> String? {
+ useString(c_snikket.snikket_chat_last_message_id(
+ self.o
+ ))
+ }
+
+ /**
+ The timestamp of the most recent message in this chat
+ */
+ public func lastMessageTimestamp() -> String? {
+ useString(c_snikket.snikket_chat_last_message_timestamp(
+ self.o
+ ))
+ }
+
+ /**
+ Get the URI image to represent this Chat, or null
+ */
+ public func getPhoto() -> String? {
+ useString(c_snikket.snikket_chat_get_photo(
+ self.o
+ ))
+ }
+
+ /**
+ Get the URI to a placeholder image to represent this Chat
+ */
+ public func getPlaceholder() -> String {
+ useString(c_snikket.snikket_chat_get_placeholder(
+ self.o
+ ))!
+ }
+
+ /**
+ An ID of the last message displayed to the user
+ */
+ public func readUpTo() -> String? {
+ useString(c_snikket.snikket_chat_read_up_to(
+ self.o
+ ))
+ }
+
+ /**
+ The number of message that have not yet been displayed to the user
+ */
+ public func unreadCount() -> Int32 {
+ c_snikket.snikket_chat_unread_count(
+ self.o
+ )
+ }
+
+ /**
+ A preview of the chat, such as the most recent message body
+ */
+ public func preview() -> String {
+ useString(c_snikket.snikket_chat_preview(
+ self.o
+ ))!
+ }
+
+ public func setDisplayName(fn: String) -> Void {
+ c_snikket.snikket_chat_set_display_name(
+ self.o,
+ fn
+ )
+ }
+
+ /**
+ The display name of this Chat
+ */
+ public func getDisplayName() -> String {
+ useString(c_snikket.snikket_chat_get_display_name(
+ self.o
+ ))!
+ }
+
+ public func setTrusted(trusted: Bool) -> Void {
+ c_snikket.snikket_chat_set_trusted(
+ self.o,
+ trusted
+ )
+ }
+
+ /**
+ Is this a chat with an entity we trust to see our online status?
+ */
+ public func isTrusted() -> Bool {
+ c_snikket.snikket_chat_is_trusted(
+ self.o
+ )
+ }
+
+ public func syncing() -> Bool {
+ c_snikket.snikket_chat_syncing(
+ self.o
+ )
+ }
+
+ /**
+ Can audio calls be started in this Chat?
+ */
+ public func canAudioCall() -> Bool {
+ c_snikket.snikket_chat_can_audio_call(
+ self.o
+ )
+ }
+
+ /**
+ Can video calls be started in this Chat?
+ */
+ public func canVideoCall() -> Bool {
+ c_snikket.snikket_chat_can_video_call(
+ self.o
+ )
+ }
+
+ /**
+ Start a new call in this Chat
+
+ @param audio do we want audio in this call
+ @param video do we want video in this call
+ */
+ public func startCall(audio: Bool, video: Bool) -> Void {
+ c_snikket.snikket_chat_start_call(
+ self.o,
+ audio,
+ video
+ )
+ }
+
+ /**
+ Accept any incoming calls in this Chat
+ */
+ public func acceptCall() -> Void {
+ c_snikket.snikket_chat_accept_call(
+ self.o
+ )
+ }
+
+ /**
+ Hangup or reject any calls in this chat
+ */
+ public func hangup() -> Void {
+ c_snikket.snikket_chat_hangup(
+ self.o
+ )
+ }
+
+ /**
+ The current status of a call in this chat
+ */
+ public func callStatus() -> String {
+ useString(c_snikket.snikket_chat_call_status(
+ self.o
+ ))!
+ }
+
+ /**
+ A DTMFSender for a call in this chat, or NULL
+ */
+ public func dtmf() -> DTMFSender? {
+ (c_snikket.snikket_chat_dtmf(
+ self.o
+ )).map({ DTMFSender($0) })
+ }
+
+ /**
+ All video tracks in all active calls in this chat
+ */
+ public func videoTracks() -> Array<MediaStreamTrack> {
+ {var __ret: UnsafeMutablePointer<UnsafeMutableRawPointer?>? = nil;let __ret_length = c_snikket.snikket_chat_video_tracks(
+ self.o
+ , &__ret);return {let __r = UnsafeMutableBufferPointer<UnsafeMutableRawPointer?>(start: __ret, count: __ret_length).map({MediaStreamTrack($0!)});c_snikket.snikket_release(__ret);return __r;}();}()
+ }
+
+ deinit {
+ c_snikket.snikket_release(o)
+ }
+}
+
+public class AvailableChat: SDKObject {
+ public let o: UnsafeMutableRawPointer
+
+ internal init(_ ptr: UnsafeMutableRawPointer) {
+ o = ptr
+ }
+
+ /**
+ The ID of the Chat this search result represents
+ */
+ public var chatId: String {
+ get {
+ useString(c_snikket.snikket_available_chat_chat_id(o))!
+ }
+ }
+
+ /**
+ The display name of this search result
+ */
+ public var displayName: String? {
+ get {
+ useString(c_snikket.snikket_available_chat_display_name(o))
+ }
+ }
+
+ /**
+ A human-readable note associated with this search result
+ */
+ public var note: String {
+ get {
+ useString(c_snikket.snikket_available_chat_note(o))!
+ }
+ }
+
+ /**
+ Is this search result a channel?
+ */
+ public func isChannel() -> Bool {
+ c_snikket.snikket_available_chat_is_channel(
+ self.o
+ )
+ }
+
+ deinit {
+ c_snikket.snikket_release(o)
+ }
+}
+
+public protocol Session: SDKObject {
+}
+
+public class AnySession: Session {
+ public let o: UnsafeMutableRawPointer
+
+ internal init(_ ptr: UnsafeMutableRawPointer) {
+ o = ptr
+ }
+
+ deinit {
+ c_snikket.snikket_release(o)
+ }
+
+}
+
+public class MediaStream: SDKObject {
+ public let o: UnsafeMutableRawPointer
+
+ internal init(_ ptr: UnsafeMutableRawPointer) {
+ o = ptr
+ }
+
+ public init() {
+ o = c_snikket.snikket_jingle_media_stream_new()
+ }
+
+ /**
+ Create default bidirectional audio track
+ */
+ public static func makeAudio() -> MediaStream {
+ MediaStream(c_snikket.snikket_jingle_media_stream_make_audio(
+ )!)
+ }
+
+ public func addTrack(track: MediaStreamTrack) -> Void {
+ c_snikket.snikket_jingle_media_stream_add_track(
+ self.o,
+ track.o
+ )
+ }
+
+ public func getTracks() -> Array<MediaStreamTrack> {
+ {var __ret: UnsafeMutablePointer<UnsafeMutableRawPointer?>? = nil;let __ret_length = c_snikket.snikket_jingle_media_stream_get_tracks(
+ self.o
+ , &__ret);return {let __r = UnsafeMutableBufferPointer<UnsafeMutableRawPointer?>(start: __ret, count: __ret_length).map({MediaStreamTrack($0!)});c_snikket.snikket_release(__ret);return __r;}();}()
+ }
+
+ deinit {
+ c_snikket.snikket_release(o)
+ }
+}
+
+public class InitiatedSession: SDKObject, Session {
+ public let o: UnsafeMutableRawPointer
+
+ internal init(_ ptr: UnsafeMutableRawPointer) {
+ o = ptr
+ }
+
+ public var sid: String {
+ get {
+ useString(c_snikket.snikket_jingle_initiated_session_sid(o))!
+ }
+ }
+
+ public func accept() -> Void {
+ c_snikket.snikket_jingle_initiated_session_accept(
+ self.o
+ )
+ }
+
+ public func hangup() -> Void {
+ c_snikket.snikket_jingle_initiated_session_hangup(
+ self.o
+ )
+ }
+
+ public func addMedia(streams: Array<MediaStream>) -> Void {
+ c_snikket.snikket_jingle_initiated_session_add_media(
+ self.o,
+ streams.map { $0.o }, streams.count
+ )
+ }
+
+ public func callStatus() -> String {
+ useString(c_snikket.snikket_jingle_initiated_session_call_status(
+ self.o
+ ))!
+ }
+
+ public func videoTracks() -> Array<MediaStreamTrack> {
+ {var __ret: UnsafeMutablePointer<UnsafeMutableRawPointer?>? = nil;let __ret_length = c_snikket.snikket_jingle_initiated_session_video_tracks(
+ self.o
+ , &__ret);return {let __r = UnsafeMutableBufferPointer<UnsafeMutableRawPointer?>(start: __ret, count: __ret_length).map({MediaStreamTrack($0!)});c_snikket.snikket_release(__ret);return __r;}();}()
+ }
+
+ public func dtmf() -> DTMFSender? {
+ (c_snikket.snikket_jingle_initiated_session_dtmf(
+ self.o
+ )).map({ DTMFSender($0) })
+ }
+
+ public func supplyMedia(streams: Array<MediaStream>) -> Void {
+ c_snikket.snikket_jingle_initiated_session_supply_media(
+ self.o,
+ streams.map { $0.o }, streams.count
+ )
+ }
+
+ deinit {
+ c_snikket.snikket_release(o)
+ }
+}
+
+public class Client: SDKObject {
+ public let o: UnsafeMutableRawPointer
+
+ internal init(_ ptr: UnsafeMutableRawPointer) {
+ o = ptr
+ }
+
+ /**
+ Create a new Client to connect to a particular account
+
+ @param address the account to connect to
+ @param persistence the persistence layer to use for storage
+ */
+ public init(address: String, persistence: Persistence) {
+ o = c_snikket.snikket_client_new(address, persistence.o)
+ }
+
+ /**
+ Start this client running and trying to connect to the server
+ */
+ public func start() -> Void {
+ c_snikket.snikket_client_start(
+ self.o
+ )
+ }
+
+ /**
+ Destroy local data for this account
+
+ @param completely if true chats, messages, etc will be deleted as well
+ */
+ public func logout(completely: Bool) -> Void {
+ c_snikket.snikket_client_logout(
+ self.o,
+ completely
+ )
+ }
+
+ /**
+ Sets the password to be used in response to the password needed event
+
+ @param password
+ */
+ public func usePassword(password: String) -> Void {
+ c_snikket.snikket_client_use_password(
+ self.o,
+ password
+ )
+ }
+
+ /**
+ Get the account ID for this Client
+
+ @returns account id
+ */
+ public func accountId() -> String {
+ useString(c_snikket.snikket_client_account_id(
+ self.o
+ ))!
+ }
+
+ /**
+ Get the current display name for this account
+
+ @returns display name
+ */
+ public func displayName() -> String {
+ useString(c_snikket.snikket_client_display_name(
+ self.o
+ ))!
+ }
+
+ /**
+ Set the current display name for this account on the server
+
+ @param display name to set (ignored if empty or NULL)
+ */
+ public func setDisplayName(displayName: String) -> Void {
+ c_snikket.snikket_client_set_display_name(
+ self.o,
+ displayName
+ )
+ }
+
+ /**
+ Turn a file into a ChatAttachment for attaching to a ChatMessage
+ */
+ public func prepareAttachment(source: AttachmentSource, callback: @escaping (ChatAttachment?)->Void) -> Void {
+ let __callback_ptr = UnsafeMutableRawPointer(Unmanaged.passRetained(callback as AnyObject).toOpaque())
+ c_snikket.snikket_client_prepare_attachment(
+ self.o,
+ source.o,
+ { (a0, ctx) in
+ let callback = Unmanaged<AnyObject>.fromOpaque(ctx!).takeUnretainedValue() as! (ChatAttachment?)->Void
+ callback((a0).map({ ChatAttachment($0) }))
+ },
+ __callback_ptr
+ )
+ }
+
+ /**
+ @returns array of open chats, sorted by last activity
+ */
+ public func getChats() -> Array<Chat> {
+ {var __ret: UnsafeMutablePointer<UnsafeMutableRawPointer?>? = nil;let __ret_length = c_snikket.snikket_client_get_chats(
+ self.o
+ , &__ret);return {let __r = UnsafeMutableBufferPointer<UnsafeMutableRawPointer?>(start: __ret, count: __ret_length).map({Chat($0!)});c_snikket.snikket_release(__ret);return __r;}();}()
+ }
+
+ /**
+ Search for chats the user can start or join
+
+ @param q the search query to use
+ @param callback takes two arguments, the query that was used and the array of results
+ */
+ public func findAvailableChats(q: String, callback: @escaping (String, Array<AvailableChat>)->Void) -> Void {
+ let __callback_ptr = UnsafeMutableRawPointer(Unmanaged.passRetained(callback as AnyObject).toOpaque())
+ c_snikket.snikket_client_find_available_chats(
+ self.o,
+ q,
+ { (a0, a1, a1_length, ctx) in
+ let callback = Unmanaged<AnyObject>.fromOpaque(ctx!).takeUnretainedValue() as! (String, Array<AvailableChat>)->Void
+ callback(useString(a0)!, {let __r = UnsafeMutableBufferPointer<UnsafeMutableRawPointer?>(start: a1, count: a1_length).map({AvailableChat($0!)});c_snikket.snikket_release(a1);return __r;}())
+ },
+ __callback_ptr
+ )
+ }
+
+ /**
+ Start or join a chat from the search results
+
+ @returns the chat that was started
+ */
+ public func startChat(availableChat: AvailableChat) -> Chat {
+ Chat(c_snikket.snikket_client_start_chat(
+ self.o,
+ availableChat.o
+ )!)
+ }
+
+ /**
+ Find a chat by id
+
+ @returns the chat if known, or NULL
+ */
+ public func getChat(chatId: String) -> Chat? {
+ (c_snikket.snikket_client_get_chat(
+ self.o,
+ chatId
+ )).map({ Chat($0) })
+ }
+
+ /**
+ Event fired when client needs a password for authentication
+
+ @param handler takes one argument, the Client that needs a password
+ */
+ public func addPasswordNeededListener(handler: @escaping (Client)->Void) -> Void {
+ let __handler_ptr = UnsafeMutableRawPointer(Unmanaged.passRetained(handler as AnyObject).toOpaque())
+ c_snikket.snikket_client_add_password_needed_listener(
+ self.o,
+ { (a0, ctx) in
+ let handler = Unmanaged<AnyObject>.fromOpaque(ctx!).takeUnretainedValue() as! (Client)->Void
+ handler(Client(a0!))
+ },
+ __handler_ptr
+ )
+ }
+
+ /**
+ Event fired when client is connected and fully synchronized
+
+ @param handler takes no arguments
+ */
+ public func addStatusOnlineListener(handler: @escaping ()->Void) -> Void {
+ let __handler_ptr = UnsafeMutableRawPointer(Unmanaged.passRetained(handler as AnyObject).toOpaque())
+ c_snikket.snikket_client_add_status_online_listener(
+ self.o,
+ { (ctx) in
+ let handler = Unmanaged<AnyObject>.fromOpaque(ctx!).takeUnretainedValue() as! ()->Void
+ handler()
+ },
+ __handler_ptr
+ )
+ }
+
+ /**
+ Event fired when client is disconnected
+
+ @param handler takes no arguments
+ */
+ public func addStatusOfflineListener(handler: @escaping ()->Void) -> Void {
+ let __handler_ptr = UnsafeMutableRawPointer(Unmanaged.passRetained(handler as AnyObject).toOpaque())
+ c_snikket.snikket_client_add_status_offline_listener(
+ self.o,
+ { (ctx) in
+ let handler = Unmanaged<AnyObject>.fromOpaque(ctx!).takeUnretainedValue() as! ()->Void
+ handler()
+ },
+ __handler_ptr
+ )
+ }
+
+ /**
+ Event fired when connection fails with a fatal error and will not be retried
+
+ @param handler takes no arguments
+ */
+ public func addConnectionFailedListener(handler: @escaping ()->Void) -> Void {
+ let __handler_ptr = UnsafeMutableRawPointer(Unmanaged.passRetained(handler as AnyObject).toOpaque())
+ c_snikket.snikket_client_add_connection_failed_listener(
+ self.o,
+ { (ctx) in
+ let handler = Unmanaged<AnyObject>.fromOpaque(ctx!).takeUnretainedValue() as! ()->Void
+ handler()
+ },
+ __handler_ptr
+ )
+ }
+
+ /**
+ Event fired when a new ChatMessage comes in on any Chat
+ Also fires when status of a ChatMessage changes,
+ when a ChatMessage is edited, or when a reaction is added
+
+ @param handler takes two arguments, the ChatMessage and ChatMessageEvent enum describing what happened
+ */
+ public func addChatMessageListener(handler: @escaping (ChatMessage, Int32)->Void) -> Void {
+ let __handler_ptr = UnsafeMutableRawPointer(Unmanaged.passRetained(handler as AnyObject).toOpaque())
+ c_snikket.snikket_client_add_chat_message_listener(
+ self.o,
+ { (a0, a1, ctx) in
+ let handler = Unmanaged<AnyObject>.fromOpaque(ctx!).takeUnretainedValue() as! (ChatMessage, Int32)->Void
+ handler(ChatMessage(a0!), a1)
+ },
+ __handler_ptr
+ )
+ }
+
+ /**
+ Event fired when syncing a new ChatMessage that was send when offline.
+ Normally you don't want this, but it may be useful if you want to notify on app start.
+
+ @param handler takes one argument, the ChatMessage
+ */
+ public func addSyncMessageListener(handler: @escaping (ChatMessage)->Void) -> Void {
+ let __handler_ptr = UnsafeMutableRawPointer(Unmanaged.passRetained(handler as AnyObject).toOpaque())
+ c_snikket.snikket_client_add_sync_message_listener(
+ self.o,
+ { (a0, ctx) in
+ let handler = Unmanaged<AnyObject>.fromOpaque(ctx!).takeUnretainedValue() as! (ChatMessage)->Void
+ handler(ChatMessage(a0!))
+ },
+ __handler_ptr
+ )
+ }
+
+ /**
+ Event fired when a Chat's metadata is updated, or when a new Chat is added
+
+ @param handler takes one argument, an array of Chats that were updated
+ */
+ public func addChatsUpdatedListener(handler: @escaping (Array<Chat>)->Void) -> Void {
+ let __handler_ptr = UnsafeMutableRawPointer(Unmanaged.passRetained(handler as AnyObject).toOpaque())
+ c_snikket.snikket_client_add_chats_updated_listener(
+ self.o,
+ { (a0, a0_length, ctx) in
+ let handler = Unmanaged<AnyObject>.fromOpaque(ctx!).takeUnretainedValue() as! (Array<Chat>)->Void
+ handler({let __r = UnsafeMutableBufferPointer<UnsafeMutableRawPointer?>(start: a0, count: a0_length).map({Chat($0!)});c_snikket.snikket_release(a0);return __r;}())
+ },
+ __handler_ptr
+ )
+ }
+
+ /**
+ Event fired when a new call comes in
+
+ @param handler takes two arguments, the call Session and the associated Chat ID
+ */
+ public func addCallRingListener(handler: @escaping (Session, String)->Void) -> Void {
+ let __handler_ptr = UnsafeMutableRawPointer(Unmanaged.passRetained(handler as AnyObject).toOpaque())
+ c_snikket.snikket_client_add_call_ring_listener(
+ self.o,
+ { (a0, a1, ctx) in
+ let handler = Unmanaged<AnyObject>.fromOpaque(ctx!).takeUnretainedValue() as! (Session, String)->Void
+ handler(AnySession(a0!), useString(a1)!)
+ },
+ __handler_ptr
+ )
+ }
+
+ /**
+ Event fired when a call is retracted or hung up
+
+ @param handler takes one argument, the associated Chat ID
+ */
+ public func addCallRetractListener(handler: @escaping (String)->Void) -> Void {
+ let __handler_ptr = UnsafeMutableRawPointer(Unmanaged.passRetained(handler as AnyObject).toOpaque())
+ c_snikket.snikket_client_add_call_retract_listener(
+ self.o,
+ { (a0, ctx) in
+ let handler = Unmanaged<AnyObject>.fromOpaque(ctx!).takeUnretainedValue() as! (String)->Void
+ handler(useString(a0)!)
+ },
+ __handler_ptr
+ )
+ }
+
+ /**
+ Event fired when an outgoing call starts ringing
+
+ @param handler takes one argument, the associated Chat ID
+ */
+ public func addCallRingingListener(handler: @escaping (String)->Void) -> Void {
+ let __handler_ptr = UnsafeMutableRawPointer(Unmanaged.passRetained(handler as AnyObject).toOpaque())
+ c_snikket.snikket_client_add_call_ringing_listener(
+ self.o,
+ { (a0, ctx) in
+ let handler = Unmanaged<AnyObject>.fromOpaque(ctx!).takeUnretainedValue() as! (String)->Void
+ handler(useString(a0)!)
+ },
+ __handler_ptr
+ )
+ }
+
+ /**
+ Event fired when a call is asking for media to send
+
+ @param handler takes three arguments, the call Session,
+ a boolean indicating if audio is desired,
+ and a boolean indicating if video is desired
+ */
+ public func addCallMediaListener(handler: @escaping (InitiatedSession, Bool, Bool)->Void) -> Void {
+ let __handler_ptr = UnsafeMutableRawPointer(Unmanaged.passRetained(handler as AnyObject).toOpaque())
+ c_snikket.snikket_client_add_call_media_listener(
+ self.o,
+ { (a0, a1, a2, ctx) in
+ let handler = Unmanaged<AnyObject>.fromOpaque(ctx!).takeUnretainedValue() as! (InitiatedSession, Bool, Bool)->Void
+ handler(InitiatedSession(a0!), a1, a2)
+ },
+ __handler_ptr
+ )
+ }
+
+ /**
+ Event fired when call has a new MediaStreamTrack to play
+
+ @param handler takes three arguments, the associated Chat ID,
+ the new MediaStreamTrack, and an array of any associated MediaStreams
+ */
+ public func addCallTrackListener(handler: @escaping (String, MediaStreamTrack, Array<MediaStream>)->Void) -> Void {
+ let __handler_ptr = UnsafeMutableRawPointer(Unmanaged.passRetained(handler as AnyObject).toOpaque())
+ c_snikket.snikket_client_add_call_track_listener(
+ self.o,
+ { (a0, a1, a2, a2_length, ctx) in
+ let handler = Unmanaged<AnyObject>.fromOpaque(ctx!).takeUnretainedValue() as! (String, MediaStreamTrack, Array<MediaStream>)->Void
+ handler(useString(a0)!, MediaStreamTrack(a1!), {let __r = UnsafeMutableBufferPointer<UnsafeMutableRawPointer?>(start: a2, count: a2_length).map({MediaStream($0!)});c_snikket.snikket_release(a2);return __r;}())
+ },
+ __handler_ptr
+ )
+ }
+
+ /**
+ Let the SDK know the UI is in the foreground
+ */
+ public func setInForeground() -> Void {
+ c_snikket.snikket_client_set_in_foreground(
+ self.o
+ )
+ }
+
+ /**
+ Let the SDK know the UI is in the foreground
+ */
+ public func setNotInForeground() -> Void {
+ c_snikket.snikket_client_set_not_in_foreground(
+ self.o
+ )
+ }
+
+ deinit {
+ c_snikket.snikket_release(o)
+ }
+}
+
+public class AttachmentSource: SDKObject {
+ public let o: UnsafeMutableRawPointer
+
+ internal init(_ ptr: UnsafeMutableRawPointer) {
+ o = ptr
+ }
+
+ public init(path: String, mime: String) {
+ o = c_snikket.snikket_attachment_source_new(path, mime)
+ }
+
+ public var path: String {
+ get {
+ useString(c_snikket.snikket_attachment_source_path(o))!
+ }
+ }
+
+ public var type: String {
+ get {
+ useString(c_snikket.snikket_attachment_source_type(o))!
+ }
+ }
+
+ public var name: String {
+ get {
+ useString(c_snikket.snikket_attachment_source_name(o))!
+ }
+ }
+
+ public var size: Int32 {
+ get {
+ c_snikket.snikket_attachment_source_size(o)
+ }
+ }
+
+ deinit {
+ c_snikket.snikket_release(o)
+ }
+}
+
+public class Participant: SDKObject {
+ public let o: UnsafeMutableRawPointer
+
+ internal init(_ ptr: UnsafeMutableRawPointer) {
+ o = ptr
+ }
+
+ public var displayName: String {
+ get {
+ useString(c_snikket.snikket_participant_display_name(o))!
+ }
+ }
+
+ public var photoUri: String? {
+ get {
+ useString(c_snikket.snikket_participant_photo_uri(o))
+ }
+ }
+
+ public var placeholderUri: String {
+ get {
+ useString(c_snikket.snikket_participant_placeholder_uri(o))!
+ }
+ }
+
+ public var isSelf: Bool {
+ get {
+ c_snikket.snikket_participant_is_self(o)
+ }
+ }
+
+ deinit {
+ c_snikket.snikket_release(o)
+ }
+}
+
+public class Channel: Chat {
+ public func isPrivate() -> Bool {
+ c_snikket.snikket_channel_is_private(
+ self.o
+ )
+ }
+
+}
+
+public class DirectChat: Chat {
+}
+
+public class Reaction: SDKObject {
+ public let o: UnsafeMutableRawPointer
+
+ internal init(_ ptr: UnsafeMutableRawPointer) {
+ o = ptr
+ }
+
+ public var senderId: String {
+ get {
+ useString(c_snikket.snikket_reaction_sender_id(o))!
+ }
+ }
+
+ public var timestamp: String {
+ get {
+ useString(c_snikket.snikket_reaction_timestamp(o))!
+ }
+ }
+
+ public var text: String {
+ get {
+ useString(c_snikket.snikket_reaction_text(o))!
+ }
+ }
+
+ public var key: String {
+ get {
+ useString(c_snikket.snikket_reaction_key(o))!
+ }
+ }
+
+ public var envelopeId: String? {
+ get {
+ useString(c_snikket.snikket_reaction_envelope_id(o))
+ }
+ }
+
+ deinit {
+ c_snikket.snikket_release(o)
+ }
+}
+
+public class CustomEmojiReaction: Reaction {
+ public var uri: String {
+ get {
+ useString(c_snikket.snikket_custom_emoji_reaction_uri(o))!
+ }
+ }
+
+}
+
+public class DTMFSender: SDKObject {
+ public let o: UnsafeMutableRawPointer
+
+ internal init(_ ptr: UnsafeMutableRawPointer) {
+ o = ptr
+ }
+
+ /**
+ Schedule DTMF events to be sent
+
+ @param tones can be any number of 0123456789#*ABCD,
+ */
+ public func insertDTMF(tones: String) -> Void {
+ c_snikket.snikket_jingle_dtmf_sender_insert_dtmf(
+ self.o,
+ tones
+ )
+ }
+
+ deinit {
+ c_snikket.snikket_release(o)
+ }
+}
+
+public typealias UiState = snikket_ui_state
+
+public typealias MessageType = snikket_message_type
+
+public typealias MessageStatus = snikket_message_status
+
+public typealias MessageDirection = snikket_message_direction
diff --git a/Sources/c_snikket/iinclude/Array.h b/Sources/c_snikket/iinclude/Array.h
new file mode 100644
index 0000000..ed6f738
--- /dev/null
+++ b/Sources/c_snikket/iinclude/Array.h
@@ -0,0 +1,1186 @@
+#ifndef HX_ARRAY_H
+#define HX_ARRAY_H
+#include <cpp/FastIterator.h>
+
+// --- hx::ReturnNull ------------------------------------------------------
+//
+// Provides an "Null<Object>" of given type. For types that can't actually be null, Dynamic is used.
+
+namespace hx
+{
+
+enum ArrayStore
+{
+ arrayNull = 0,
+ arrayEmpty,
+ arrayFixed,
+ arrayBool,
+ arrayInt,
+ arrayFloat,
+ arrayString,
+ arrayObject,
+ arrayInt64
+};
+
+enum ArrayConvertId
+{
+ aciAlwaysConvert = -4,
+ aciVirtualArray = -3,
+ aciStringArray = -2,
+ aciObjectArray = -1,
+ aciNotArray = 0,
+ aciPodBase = 1,
+};
+
+template<typename T>
+struct ReturnNull { typedef T type; };
+template<> struct ReturnNull<int> { typedef Dynamic type; };
+template<> struct ReturnNull<double> { typedef Dynamic type; };
+template<> struct ReturnNull<float> { typedef Dynamic type; };
+template<> struct ReturnNull<bool> { typedef Dynamic type; };
+template<> struct ReturnNull<char> { typedef Dynamic type; };
+template<> struct ReturnNull<signed char> { typedef Dynamic type; };
+template<> struct ReturnNull<unsigned char> { typedef Dynamic type; };
+template<> struct ReturnNull<short> { typedef Dynamic type; };
+template<> struct ReturnNull<unsigned short> { typedef Dynamic type; };
+template<> struct ReturnNull<unsigned int> { typedef Dynamic type; };
+template<> struct ReturnNull< ::cpp::Int64> { typedef Dynamic type; };
+
+template<typename T>
+struct ArrayTraits { enum { StoreType = arrayObject }; };
+template<> struct ArrayTraits<int> { enum { StoreType = arrayInt }; };
+template<> struct ArrayTraits<float> { enum { StoreType = arrayFloat}; };
+template<> struct ArrayTraits<double> { enum { StoreType = arrayFloat}; };
+template<> struct ArrayTraits<Dynamic> { enum { StoreType = arrayObject }; };
+template<> struct ArrayTraits<String> { enum { StoreType = arrayString }; };
+template<> struct ArrayTraits< ::cpp::Int64> { enum { StoreType = arrayInt64 }; };
+
+}
+
+
+
+namespace hx
+{
+
+
+
+// --- ArrayIterator -------------------------------------------
+//
+// An object that conforms to the standard iterator interface for arrays
+template<typename FROM,typename TO>
+class ArrayIterator : public cpp::FastIterator_obj<TO>
+{
+public:
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdArrayIterator };
+
+ ArrayIterator(Array<FROM> inArray) : mArray(inArray), mIdx(0) { }
+
+ // Fast versions ...
+ bool hasNext() { return mIdx < mArray->length; }
+
+ inline TO toTo(const Dynamic &inD) { return inD.StaticCast<TO>(); }
+
+ template<typename T>
+ inline TO toTo(T inT) { return inT; }
+
+ TO next() { return toTo(mArray->__get(mIdx++)); }
+
+ void __Mark(hx::MarkContext *__inCtx) { HX_MARK_MEMBER_NAME(mArray,"mArray"); }
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx) { HX_VISIT_MEMBER_NAME(mArray,"mArray"); }
+ #endif
+
+ int mIdx;
+ Array<FROM> mArray;
+};
+
+// --- ArrayKeyValueIterator -------------------------------------------
+template<typename FROM,typename TO>
+class ArrayKeyValueIterator : public cpp::FastIterator_obj<Dynamic>
+{
+public:
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdArrayIterator };
+
+ ArrayKeyValueIterator(Array<FROM> inArray) : mArray(inArray), mIdx(0) { }
+
+ bool hasNext() { return mIdx < mArray->length; }
+
+ inline TO toTo(const Dynamic &inD) { return inD.StaticCast<TO>(); }
+
+ template<typename T>
+ inline TO toTo(T inT) { return inT; }
+
+
+ Dynamic next();
+
+ void __Mark(hx::MarkContext *__inCtx) { HX_MARK_MEMBER_NAME(mArray,"mArray"); }
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx) { HX_VISIT_MEMBER_NAME(mArray,"mArray"); }
+ #endif
+
+ int mIdx;
+ Array<FROM> mArray;
+};
+
+}
+
+namespace hx
+{
+
+// Also used by cpp::VirtualArray
+class HXCPP_EXTERN_CLASS_ATTRIBUTES ArrayCommon : public hx::Object
+{
+ protected:
+ int mArrayConvertId;
+ public:
+ // Plain old data element size - or 0 if not plain-old-data
+ int getArrayConvertId() const { return mArrayConvertId; }
+
+ virtual hx::Object *__GetRealObject() { return this; }
+};
+
+// --- hx::ArrayBase ----------------------------------------------------
+//
+// Base class that treats array contents as a slab of bytes.
+// The derived "Array_obj" adds strong typing to the "[]" operator
+
+class HXCPP_EXTERN_CLASS_ATTRIBUTES ArrayBase : public ArrayCommon
+{
+public:
+ ArrayBase(int inSize,int inReserve,int inElementSize,bool inAtomic);
+
+ // Defined later so we can use "Array"
+ static Array<Dynamic> __new(int inSize=0,int inReserve=0);
+
+
+ static void __boot();
+
+ typedef hx::Object super;
+
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdArrayBase };
+
+ // Used by cpp.ArrayBase
+ inline int getElementSize() const { return GetElementSize(); }
+ inline int getByteCount() const { return GetElementSize()*length; }
+ inline char * getBase() const { return mBase; }
+
+
+ hx::Val __SetField(const String &inString,const hx::Val &inValue ,hx::PropertyAccess inCallProp) { return null(); }
+
+ static hx::Class __mClass;
+ static hx::Class &__SGetClass() { return __mClass; }
+ hx::Class __GetClass() const { return __mClass; }
+ String toString();
+ String __ToString() const;
+ int __Compare(const hx::Object *inRHS) const;
+
+
+ void setData(void *inData, int inElements)
+ {
+ mBase = (char *)inData;
+ length = inElements;
+ mAlloc = inElements;
+ HX_OBJ_WB_PESSIMISTIC_GET(this);
+ }
+
+ void setUnmanagedData(void *inData, int inElements)
+ {
+ mBase = (char *)inData;
+ length = inElements;
+ mAlloc = -1;
+ }
+
+
+ int __GetType() const { return vtArray; }
+
+ inline size_t size() const { return length; }
+ inline int __length() const { return (int)length; }
+
+ virtual String ItemString(int inI) = 0;
+
+ const char * __CStr() const { return mBase; }
+ inline const char *GetBase() const { return mBase; }
+ inline char *GetBase() { return mBase; }
+
+ virtual int GetElementSize() const = 0;
+
+ inline void resize(int inSize)
+ {
+ if (inSize<length)
+ {
+ int s = GetElementSize();
+ memset(mBase + inSize*s, 0, (length-inSize)*s);
+ length = inSize;
+ }
+ else if (inSize>length)
+ {
+ EnsureSize(inSize);
+ length = inSize;
+ }
+ }
+ inline void __SetSize(int inLen) { resize(inLen); }
+
+ void __SetSizeExact(int inLen=0);
+
+ Dynamic __unsafe_get(const Dynamic &i);
+ Dynamic __unsafe_set(const Dynamic &i, const Dynamic &val);
+
+ void safeSort(Dynamic sorter, bool isString);
+
+ inline void __unsafeStringReference(String inString)
+ {
+ mBase = (char *)inString.raw_ptr();
+ length = inString.length / GetElementSize();
+ mAlloc = length;
+ HX_OBJ_WB_PESSIMISTIC_GET(this);
+ }
+
+
+ virtual hx::ArrayStore getStoreType() const = 0;
+
+
+ // Dynamic interface
+ hx::Val __Field(const String &inString ,hx::PropertyAccess inCallProp);
+
+ inline void ____SetSize(int len) { resize(len); }
+ inline void ____SetSizeExact(int len) { __SetSizeExact(len); }
+ inline Dynamic ____unsafe_set(const Dynamic &i, const Dynamic &val) { return __SetItem(i,val); }
+ inline Dynamic ____unsafe_get(const Dynamic &i) { return __GetItem(i); }
+
+ virtual hx::ArrayBase *__concat(const cpp::VirtualArray &a0) = 0;
+ virtual hx::ArrayBase *__copy() = 0;
+ virtual void __insert(int inIndex,const Dynamic &a1) = 0;
+ virtual Dynamic __iterator() = 0;
+ virtual Dynamic __keyValueIterator() = 0;
+ virtual ::String __join(::String a0) = 0;
+ virtual Dynamic __pop() = 0;
+ virtual int __push(const Dynamic &a0) = 0;
+ virtual bool __contains(const Dynamic &a0) = 0;
+ virtual bool __remove(const Dynamic &a0) = 0;
+ virtual bool __removeAt(int inIndex) = 0;
+ virtual int __indexOf(const Dynamic &a0,const Dynamic &a1) = 0;
+ virtual int __lastIndexOf(const Dynamic &a0,const Dynamic &a1) = 0;
+ virtual void __reverse() = 0;
+ virtual Dynamic __shift() = 0;
+ virtual hx::ArrayBase *__slice(const Dynamic &a0,const Dynamic &a1) = 0;
+ virtual hx::ArrayBase *__splice(const Dynamic &a0,const Dynamic &a1) = 0;
+ virtual void __sort(const Dynamic &a0) = 0;
+ virtual ::String __toString() = 0;
+ virtual void __unshift(const Dynamic &a0) = 0;
+ virtual cpp::VirtualArray_obj *__map(const Dynamic &func) = 0;
+ virtual hx::ArrayBase *__filter(const Dynamic &func) = 0;
+ virtual void __blit(int inDestElement,const cpp::VirtualArray &inSourceArray,int inSourceElement,int inElementCount) = 0;
+ virtual int __memcmp(const cpp::VirtualArray &a0) = 0;
+ inline void __zero(const Dynamic &a0,const Dynamic &a1) { zero(a0,a1); }
+ virtual void __qsort(Dynamic inCompare) = 0;
+ virtual void __resize(int inLen) = 0;
+
+ virtual void set(int inIdx, const cpp::Variant &inValue) = 0;
+ virtual void setUnsafe(int inIdx, const cpp::Variant &inValue) = 0;
+
+ Dynamic concat_dyn();
+ Dynamic copy_dyn();
+ Dynamic insert_dyn();
+ Dynamic iterator_dyn();
+ Dynamic keyValueIterator_dyn();
+ Dynamic join_dyn();
+ Dynamic pop_dyn();
+ Dynamic push_dyn();
+ Dynamic contains_dyn();
+ Dynamic remove_dyn();
+ Dynamic removeAt_dyn();
+ Dynamic indexOf_dyn();
+ Dynamic lastIndexOf_dyn();
+ Dynamic reverse_dyn();
+ Dynamic shift_dyn();
+ Dynamic slice_dyn();
+ Dynamic splice_dyn();
+ Dynamic sort_dyn();
+ Dynamic toString_dyn();
+ Dynamic unshift_dyn();
+ Dynamic map_dyn();
+ Dynamic filter_dyn();
+ Dynamic __SetSize_dyn();
+ Dynamic __SetSizeExact_dyn();
+ Dynamic __unsafe_get_dyn();
+ Dynamic __unsafe_set_dyn();
+ Dynamic blit_dyn();
+ Dynamic zero_dyn();
+ Dynamic memcmp_dyn();
+ Dynamic resize_dyn();
+
+ void Realloc(int inLen) const;
+
+ inline void EnsureSize(int inLen) const
+ {
+ if (inLen>length)
+ {
+ if (inLen>mAlloc)
+ Realloc(inLen);
+ length = inLen;
+ }
+ }
+
+ void RemoveElement(int inIndex);
+
+
+ void Insert(int inPos);
+
+ void Splice(hx::ArrayBase *outResult,int inPos,int inLen);
+
+ void Slice(hx::ArrayBase *outResult,int inPos,int inEnd);
+
+ void Concat(hx::ArrayBase *outResult,const char *inEnd, int inLen);
+
+
+ void reserve(int inN) const;
+
+ inline int capacity() const { return mAlloc; }
+
+ // Set numeric values to 0, pointers to null, bools to false
+ void zero(Dynamic inFirst, Dynamic inCount);
+
+ int Memcmp(ArrayBase *inArray);
+
+ // Copy section of other array.
+ void Blit(int inDestElement, ArrayBase *inSourceArray, int inSourceElement, int inElementCount);
+
+ static String joinArray(hx::ArrayBase *inBase, String inSeparator);
+ static String joinArray(Array_obj<String> *inArray, String inSeparator);
+
+ virtual bool AllocAtomic() const { return false; }
+
+ inline bool IsByteArray() const { return getStoreType()==arrayBool; }
+
+
+ inline Dynamic __get(int inIndex) const { return __GetItem(inIndex); }
+
+ // Plain old data element size - or 0 if not plain-old-data
+ int getArrayConvertId() const { return mArrayConvertId; }
+
+ mutable int length;
+
+ static inline int baseOffset() { return (int)offsetof(ArrayBase,mBase); }
+ static inline int allocOffset() { return (int)offsetof(ArrayBase,mAlloc); }
+ static inline int lengthOffset() { return (int)offsetof(ArrayBase,length); }
+
+protected:
+ mutable int mAlloc;
+ mutable char *mBase;
+};
+
+} // end namespace hx for ArrayBase
+
+namespace cpp
+{
+ typedef hx::ArrayBase ArrayBase_obj;
+
+ // Use by cpp.ArrayBase extern
+ typedef hx::ObjectPtr<ArrayBase_obj> ArrayBase;
+}
+
+
+#include "cpp/VirtualArray.h"
+
+
+
+
+// --- Array_obj ------------------------------------------------------------------
+//
+// The Array_obj specialises the ArrayBase, adding typing where required
+
+
+namespace hx
+{
+// This is to determine is we need to include our slab of bytes in garbage collection
+template<typename T>
+inline bool TypeContainsPointers(T *) { return true; }
+template<> inline bool TypeContainsPointers(bool *) { return false; }
+template<> inline bool TypeContainsPointers(int *) { return false; }
+template<> inline bool TypeContainsPointers(double *) { return false; }
+template<> inline bool TypeContainsPointers(float *) { return false; }
+template<> inline bool TypeContainsPointers(short *) { return false; }
+template<> inline bool TypeContainsPointers(unsigned char *) { return false; }
+template<> inline bool TypeContainsPointers(::cpp::Int64 *) { return false; }
+
+template<typename TYPE> inline bool ContainsPointers()
+{
+ return TypeContainsPointers( (TYPE *)0 );
+}
+
+
+
+// For returning "null" when out of bounds ...
+template<typename TYPE>
+inline TYPE *NewNull() { Dynamic d; return (TYPE *)hx::NewGCBytes(&d,sizeof(d)); }
+
+template<> inline int *NewNull<int>() { int i=0; return (int *)hx::NewGCPrivate(&i,sizeof(i)); }
+template<> inline bool *NewNull<bool>() { bool b=0; return (bool *)hx::NewGCPrivate(&b,sizeof(b)); }
+template<> inline double *NewNull<double>() { double d=0.0; return (double *)hx::NewGCPrivate(&d,sizeof(d)); }
+template<> inline float *NewNull<float>() { float d=0.0f; return (float *)hx::NewGCPrivate(&d,sizeof(d)); }
+template<> inline unsigned char *NewNull<unsigned char>() { unsigned char u=0; return (unsigned char *)hx::NewGCPrivate(&u,sizeof(u)); }
+template<> inline ::cpp::Int64 *NewNull< ::cpp::Int64>() { ::cpp::Int64 i=0; return (::cpp::Int64 *)hx::NewGCPrivate(&i,sizeof(i)); }
+
+
+bool DynamicEq(const Dynamic &a, const Dynamic &b);
+
+}
+
+template<typename T> struct ArrayClassId { enum { id=hx::clsIdArrayObject }; };
+template<> struct ArrayClassId<unsigned char> { enum { id=hx::clsIdArrayByte }; };
+template<> struct ArrayClassId<signed char> { enum { id=hx::clsIdArrayByte }; };
+template<> struct ArrayClassId<unsigned short> { enum { id=hx::clsIdArrayShort }; };
+template<> struct ArrayClassId<signed short> { enum { id=hx::clsIdArrayShort }; };
+template<> struct ArrayClassId<unsigned int> { enum { id=hx::clsIdArrayInt }; };
+template<> struct ArrayClassId<signed int> { enum { id=hx::clsIdArrayInt }; };
+template<> struct ArrayClassId<float> { enum { id=hx::clsIdArrayFloat32 }; };
+template<> struct ArrayClassId<double> { enum { id=hx::clsIdArrayFloat64 }; };
+template<> struct ArrayClassId<String> { enum { id=hx::clsIdArrayString }; };
+template<> struct ArrayClassId< ::cpp::Int64> { enum { id=hx::clsIdArrayInt64 }; };
+
+// sort...
+#include <algorithm>
+
+namespace hx
+{
+template<typename T>
+inline bool arrayElemEq(const T &a, const T &b) { return a==b; }
+
+template<>
+inline bool arrayElemEq<Dynamic>(const Dynamic &a, const Dynamic &b) {
+ return hx::DynamicEq(a,b);
+}
+}
+
+
+template<typename ELEM_>
+class Array_obj : public hx::ArrayBase
+{
+ typedef ELEM_ Elem;
+ typedef hx::ObjectPtr< Array_obj<ELEM_> > ObjPtr;
+ typedef typename hx::ReturnNull<ELEM_>::type NullType;
+
+public:
+ enum { _hx_ClassId = ArrayClassId<ELEM_>::id };
+
+
+ Array_obj(int inSize,int inReserve) :
+ hx::ArrayBase(inSize,inReserve,sizeof(ELEM_),!hx::ContainsPointers<ELEM_>()) { }
+
+
+ // Defined later so we can use "Array"
+ static Array<ELEM_> __new(int inSize=0,int inReserve=0);
+ static Array<ELEM_> __newConstWrapper(ELEM_ *inData,int inSize);
+ static Array<ELEM_> fromData(const ELEM_ *inData,int inCount);
+
+ bool _hx_isInstanceOf(int inClassId)
+ {
+ return inClassId==1 || inClassId==(int)hx::clsIdArrayBase || inClassId==(int)_hx_ClassId;
+ }
+
+ virtual bool AllocAtomic() const { return !hx::ContainsPointers<ELEM_>(); }
+
+ virtual Dynamic __GetItem(int inIndex) const { return __get(inIndex); }
+ virtual Dynamic __SetItem(int inIndex,Dynamic inValue)
+ {
+ ELEM_ &elem = Item(inIndex);
+ elem = inValue;
+ if (hx::ContainsPointers<ELEM_>()) { HX_OBJ_WB_GET(this,hx::PointerOf(elem)); }
+ return inValue;
+ }
+
+ inline ELEM_ *Pointer() { return (ELEM_ *)mBase; }
+
+ inline ELEM_ &Item(int inIndex)
+ {
+ if (inIndex>=(int)length) EnsureSize(inIndex+1);
+ else if (inIndex<0) { return * hx::NewNull<ELEM_>(); }
+ return * (ELEM_ *)(mBase + inIndex*sizeof(ELEM_));
+ }
+ inline ELEM_ __get(int inIndex) const
+ {
+ if ((unsigned int)inIndex>=(unsigned int)length ) return null();
+ return * (ELEM_ *)(mBase + inIndex*sizeof(ELEM_));
+ }
+
+ // Does not check for size valid - use with care
+ inline ELEM_ &__unsafe_get(int inIndex) { return * (ELEM_ *)(mBase + inIndex*sizeof(ELEM_)); }
+
+
+ inline ELEM_ & __unsafe_set(int inIndex, ELEM_ inValue)
+ {
+ ELEM_ &elem = *(ELEM_*)(mBase + inIndex*sizeof(ELEM_));
+ elem = inValue;
+ if (hx::ContainsPointers<ELEM_>()) { HX_OBJ_WB_GET(this, hx::PointerOf(elem)); }
+ return elem;
+ }
+
+
+ inline int memcmp(Array<ELEM_> inOther)
+ {
+ return ArrayBase::Memcmp(inOther.GetPtr());
+ }
+
+
+ inline void memcpy(int inStart, const ELEM_ *inData, int inElements)
+ {
+ EnsureSize(inStart+inElements);
+ int s = GetElementSize();
+ ::memcpy(mBase + s*inStart, inData, s*inElements);
+ if (hx::ContainsPointers<ELEM_>())
+ {
+ HX_OBJ_WB_PESSIMISTIC_GET(this);
+ }
+ }
+
+
+ inline void blit(int inDestElement, Array<ELEM_> inSourceArray,
+ int inSourceElement, int inElementCount)
+ {
+ ArrayBase::Blit(inDestElement, inSourceArray.GetPtr(), inSourceElement, inElementCount);
+ }
+
+
+ void __Mark(hx::MarkContext *__inCtx)
+ {
+ if (mAlloc>0) hx::MarkAlloc((void *)mBase, __inCtx );
+ if (length && hx::ContainsPointers<ELEM_>())
+ {
+ ELEM_ *ptr = (ELEM_ *)mBase;
+ HX_MARK_MEMBER_ARRAY(ptr,length);
+ }
+ }
+
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx)
+ {
+ if (mAlloc>0) __inCtx->visitAlloc((void **)&mBase);
+ if (hx::ContainsPointers<ELEM_>())
+ {
+ ELEM_ *ptr = (ELEM_ *)mBase;
+ for(int i=0;i<length;i++)
+ {
+ HX_VISIT_MEMBER(ptr[i]);
+ }
+ }
+ }
+ #endif
+
+ inline Array<ELEM_> __SetSizeExact(int inLen);
+
+ int GetElementSize() const { return sizeof(ELEM_); }
+
+ String ItemString(int inI)
+ {
+ String result(__get(inI));
+ if (result==null()) return HX_CSTRING("null");
+ return result;
+ }
+
+ Array_obj<ELEM_> *Add(const ELEM_ &inItem) { push(inItem); return this; }
+
+ Array<ELEM_> init(int inIndex, ELEM_ inValue)
+ {
+ * (ELEM_ *)(mBase + inIndex*sizeof(ELEM_)) = inValue;
+ #ifdef HXCPP_GC_GENERATIONAL
+ if (hx::ContainsPointers<ELEM_>())
+ { HX_OBJ_WB_GET(this, hx::PointerOf(inValue)); }
+ #endif
+ return this;
+ }
+
+
+ #ifdef HXCPP_GC_GENERATIONAL
+ inline int pushCtx(hx::StackContext *_hx_ctx, ELEM_ inVal )
+ {
+ int l = length;
+ EnsureSize((int)l+1);
+ * (ELEM_ *)(mBase + l*sizeof(ELEM_)) = inVal;
+ if (hx::ContainsPointers<ELEM_>()) { HX_ARRAY_WB(this,inIdx, hx::PointerOf(inVal) ); }
+ return length;
+ }
+ #endif
+
+
+ // Haxe API
+ inline int push( ELEM_ inVal )
+ {
+ #ifdef HXCPP_GC_GENERATIONAL
+ if (hx::ContainsPointers<ELEM_>())
+ return pushCtx(HX_CTX_GET,inVal);
+ #endif
+ int l = length;
+ EnsureSize((int)l+1);
+ * (ELEM_ *)(mBase + l*sizeof(ELEM_)) = inVal;
+ return length;
+ }
+ inline NullType pop( )
+ {
+ if (!length) return null();
+ ELEM_ result = __get((int)length-1);
+ resize((int)length-1);
+ return result;
+ }
+
+
+
+ int Find(ELEM_ inValue)
+ {
+ ELEM_ *e = (ELEM_ *)mBase;
+ for(int i=0;i<length;i++)
+ if (hx::arrayElemEq(e[i],inValue))
+ return i;
+ return -1;
+ }
+
+ bool contains(ELEM_ inValue)
+ {
+ ELEM_ *e = (ELEM_ *)mBase;
+ for(int i=0;i<length;i++)
+ {
+ if (hx::arrayElemEq(e[i],inValue))
+ return true;
+ }
+ return false;
+ }
+
+ bool remove(ELEM_ inValue)
+ {
+ ELEM_ *e = (ELEM_ *)mBase;
+ for(int i=0;i<length;i++)
+ {
+ if (hx::arrayElemEq(e[i],inValue))
+ {
+ RemoveElement((int)i);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ bool removeAt( int idx )
+ {
+ if( idx < 0 ) idx += length;
+ if (idx>=length || idx<0) return false;
+ RemoveElement(idx);
+ return true;
+ }
+
+
+ int indexOf(ELEM_ inValue, Dynamic fromIndex = null())
+ {
+ int len = length;
+ int i = fromIndex==null() ? 0 : fromIndex->__ToInt();
+ ELEM_ *e = (ELEM_ *)mBase;
+ if (i < 0)
+ {
+ i += len;
+ if (i < 0) i = 0;
+ }
+ while(i<len)
+ {
+ if (hx::arrayElemEq(e[i],inValue))
+ return i;
+ i++;
+ }
+ return -1;
+ }
+
+ int lastIndexOf(ELEM_ inValue, Dynamic fromIndex = null())
+ {
+ int len = length;
+ int i = fromIndex==null() ? len-1 : fromIndex->__ToInt();
+ ELEM_ *e = (ELEM_ *)mBase;
+ if (i >= len)
+ i = len - 1;
+ else if (i < 0)
+ i += len;
+ while(i>=0)
+ {
+ if (hx::arrayElemEq(e[i],inValue))
+ return i;
+ i--;
+ }
+ return -1;
+ }
+
+ NullType shift()
+ {
+ if (length==0) return null();
+ ELEM_ result = __get(0);
+ RemoveElement(0);
+ return result;
+ }
+
+ String join(String inSeparator) { return ArrayBase::joinArray(this, inSeparator); }
+
+ Array<ELEM_> concat( Array<ELEM_> inTail );
+ Array<ELEM_> copy( );
+ Array<ELEM_> slice(int inPos, Dynamic end = null());
+ Array<ELEM_> splice(int inPos, int len);
+ inline void removeRange(int inPos, int len)
+ {
+ hx::ArrayBase::Splice(0,inPos,len);
+ }
+
+ cpp::VirtualArray map(Dynamic inFunc);
+ Array<ELEM_> filter(Dynamic inFunc);
+
+ void insert(int inPos, ELEM_ inValue)
+ {
+ if (inPos<0)
+ {
+ inPos+=length;
+ if (inPos<0) inPos = 0;
+ }
+ else if (inPos>length)
+ inPos = length;
+ hx::ArrayBase::Insert(inPos);
+ Item(inPos) = inValue;
+ #ifdef HXCPP_GC_GENERATIONAL
+ if (hx::ContainsPointers<ELEM_>())
+ { HX_OBJ_WB_GET(this,hx::PointerOf(inValue)); }
+ #endif
+ }
+
+ void unshift(ELEM_ inValue)
+ {
+ insert(0,inValue);
+ }
+
+ void reverse()
+ {
+ int half = length/2;
+ ELEM_ *e = (ELEM_ *)mBase;
+ for(int i=0;i<half;i++)
+ {
+ ELEM_ tmp = e[length-i-1];
+ e[length-i-1] = e[i];
+ e[i] = tmp;
+ }
+ }
+
+ // Will do random pointer sorting for object pointers
+ inline void sortAscending()
+ {
+ ELEM_ *e = (ELEM_ *)mBase;
+ std::sort(e, e+length);
+ }
+ static inline bool greaterThan(const ELEM_ &inA, const ELEM_ &inB) { return inB < inA; }
+ inline void sortDescending()
+ {
+ ELEM_ *e = (ELEM_ *)mBase;
+ std::sort(e, e+length, greaterThan);
+ }
+
+
+ struct Sorter
+ {
+ Sorter(Dynamic inFunc) : mFunc(inFunc) { }
+
+ bool operator()(const ELEM_ &inA, const ELEM_ &inB)
+ {
+ return mFunc( Dynamic(inA), Dynamic(inB))->__ToInt() < 0;
+ }
+
+ Dynamic mFunc;
+ };
+
+ inline void qsort(Dynamic inSorter)
+ {
+ ELEM_ *e = (ELEM_ *)mBase;
+ std::sort(e, e+length, Sorter(inSorter) );
+ }
+
+ void sort(Dynamic inSorter)
+ {
+ if ( (int)hx::ArrayTraits<ELEM_>::StoreType==(int)hx::arrayObject ||
+ (int)hx::ArrayTraits<ELEM_>::StoreType==(int)hx::arrayString)
+ {
+ // Keep references from being hidden inside sorters buffers
+ safeSort(inSorter, (int)hx::ArrayTraits<ELEM_>::StoreType==(int)hx::arrayString);
+ }
+ else
+ {
+ ELEM_ *e = (ELEM_ *)mBase;
+ std::stable_sort(e, e+length, Sorter(inSorter) );
+ }
+ }
+
+ Dynamic iterator() { return new hx::ArrayIterator<ELEM_,ELEM_>(this); }
+ Dynamic keyValueIterator() { return new hx::ArrayKeyValueIterator<ELEM_,ELEM_>(this); }
+
+ template<typename TO>
+ Dynamic iteratorFast() { return new hx::ArrayIterator<ELEM_,TO>(this); }
+
+ template<typename TO>
+ Dynamic keyValueIteratorFast() { return new hx::ArrayKeyValueIterator<ELEM_,TO>(this); }
+
+ virtual hx::ArrayStore getStoreType() const
+ {
+ return (hx::ArrayStore) hx::ArrayTraits<ELEM_>::StoreType;
+ }
+
+ inline ELEM_ &setCtx(hx::StackContext *_hx_ctx, int inIdx, ELEM_ inValue)
+ {
+ ELEM_ &elem = Item(inIdx);
+ HX_ARRAY_WB(this,inIdx, hx::PointerOf(inValue) );
+ return elem = inValue;
+ }
+
+
+ // Dynamic interface
+ virtual hx::ArrayBase *__concat(const cpp::VirtualArray &a0) { return concat(a0).mPtr; }
+ virtual hx::ArrayBase *__copy() { return copy().mPtr; }
+ virtual void __insert(int inIndex,const Dynamic &a1) { insert(inIndex,a1);}
+ virtual Dynamic __iterator() { return iterator(); }
+ virtual Dynamic __keyValueIterator() { return keyValueIterator(); }
+ virtual ::String __join(::String a0) { return join(a0); }
+ virtual Dynamic __pop() { return pop(); }
+ virtual int __push(const Dynamic &a0) { return push(a0);}
+ virtual bool __contains(const Dynamic &a0) { return contains(a0); }
+ virtual bool __remove(const Dynamic &a0) { return remove(a0); }
+ virtual bool __removeAt(int inIndex) { return removeAt(inIndex); }
+ virtual int __indexOf(const Dynamic &a0,const Dynamic &a1) { return indexOf(a0, a1); }
+ virtual int __lastIndexOf(const Dynamic &a0,const Dynamic &a1) { return lastIndexOf(a0, a1); }
+ virtual void __reverse() { reverse(); }
+ virtual Dynamic __shift() { return shift(); }
+ virtual hx::ArrayBase *__slice(const Dynamic &a0,const Dynamic &a1) { return slice(a0,a1).mPtr; }
+ virtual hx::ArrayBase *__splice(const Dynamic &a0,const Dynamic &a1) { return splice(a0,a1).mPtr; }
+ virtual void __sort(const Dynamic &a0) { sort(a0); }
+ virtual ::String __toString() { return toString(); }
+ virtual void __unshift(const Dynamic &a0) { unshift(a0); }
+ virtual cpp::VirtualArray_obj *__map(const Dynamic &func) { return map(func).mPtr; }
+ virtual void __resize(int inLen) { resize(inLen); }
+
+ virtual hx::ArrayBase *__filter(const Dynamic &func) { return filter(func).mPtr; }
+ virtual void __blit(int inDestElement,const cpp::VirtualArray &inSourceArray,int inSourceElement,int inElementCount)
+ {
+ blit(inDestElement,inSourceArray,inSourceElement,inElementCount);
+ }
+ virtual int __memcmp(const cpp::VirtualArray &a0) { return memcmp(a0); }
+ virtual void __qsort(Dynamic inCompare) { this->qsort(inCompare); };
+
+ virtual void set(int inIndex, const cpp::Variant &inValue) {
+ ELEM_ &elem = Item(inIndex);
+ elem = ELEM_(inValue);
+ if (hx::ContainsPointers<ELEM_>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(elem));
+ }
+ }
+ virtual void setUnsafe(int inIndex, const cpp::Variant &inValue) {
+ ELEM_ &elem = *(ELEM_ *)(mBase + inIndex*sizeof(ELEM_));
+ elem = ELEM_(inValue);
+ if (hx::ContainsPointers<ELEM_>()) { HX_OBJ_WB_GET(this,hx::PointerOf(elem)); }
+ }
+};
+
+
+// --- Array ---------------------------------------------------------------
+//
+// The array class adds object syntax to the Array_obj pointer
+
+template<typename ELEM_>
+class Array : public hx::ObjectPtr< Array_obj<ELEM_> >
+{
+ typedef hx::ObjectPtr< Array_obj<ELEM_> > super;
+ typedef Array_obj<ELEM_> OBJ_;
+
+public:
+ typedef ELEM_ Elem;
+ typedef Array_obj<ELEM_> *Ptr;
+ using super::mPtr;
+ using super::GetPtr;
+
+ Array() { }
+ Array(int inSize,int inReserve) : super( OBJ_::__new(inSize,inReserve) ) { }
+ Array(const null &inNull) : super(0) { }
+ Array(Ptr inPtr) : super(inPtr) { }
+
+ #ifdef HXCPP_CHECK_POINTER
+ inline OBJ_ *CheckGetPtr() const
+ {
+ if (!mPtr) hx::NullReference("Array", true);
+ // The handler might have fixed up the null value
+ if (!mPtr) hx::NullReference("Array", false);
+ return mPtr;
+ }
+ #else
+ inline OBJ_ *CheckGetPtr() const { return mPtr; }
+ #endif
+
+ // Construct from our type ...
+ Array ( const hx::ObjectPtr< OBJ_ > &inArray )
+ : hx::ObjectPtr< OBJ_ >(inArray) { }
+
+ Array(const Array<ELEM_> &inArray) : super(inArray.GetPtr()) { }
+
+ // Build dynamic array from foreign array
+ template<typename SOURCE_>
+ Array( const Array<SOURCE_> &inRHS ) : super(0)
+ {
+ Array_obj<SOURCE_> *ptr = inRHS.GetPtr();
+ if (ptr)
+ {
+ OBJ_ *arr = dynamic_cast<OBJ_ *>(ptr);
+ if (!arr)
+ {
+ // Non-identical type (syntactically, should be creating from Array<Dynamic>)
+ // Copy elements one-by-one
+ // Not quite right, but is the best we can do...
+ int n = ptr->__length();
+ *this = Array_obj<ELEM_>::__new(n);
+ for(int i=0;i<n;i++)
+ mPtr->__unsafe_set(i,ptr->__GetItem(i));
+ }
+ else
+ mPtr = arr;
+ }
+ }
+
+ #ifdef HX_VARRAY_DEFINED
+ // From VirtualArray
+ Array( const cpp::VirtualArray &inVArray) { fromVArray(inVArray.mPtr); }
+
+ void fromVArray(cpp::VirtualArray_obj *inVArray)
+ {
+ if (!inVArray || inVArray->store==hx::arrayNull)
+ {
+ mPtr = 0;
+ return;
+ }
+ inVArray->fixType<ELEM_>();
+ // Switch on type?
+ setDynamic(inVArray->base,true);
+ }
+
+ Array &operator=( const cpp::VirtualArray &inRHS )
+ {
+ fromVArray(inRHS.mPtr);
+ return *this;
+ }
+
+ #endif
+
+ inline void setDynamic( const Dynamic &inRHS, bool inIgnoreVirtualArray=false )
+ {
+ hx::Object *ptr = inRHS.GetPtr();
+ if (ptr)
+ {
+ OBJ_ *arr = dynamic_cast<OBJ_ *>(ptr);
+ if (!arr && ptr->__GetClass().mPtr == super::__SGetClass().mPtr )
+ {
+ #ifdef HX_VARRAY_DEFINED
+ cpp::VirtualArray_obj *varray = inIgnoreVirtualArray ? 0 :
+ dynamic_cast<cpp::VirtualArray_obj *>(ptr);
+ if (varray)
+ fromVArray(varray);
+ else
+ #endif
+ {
+ // Non-identical type.
+ // Copy elements one-by-one
+ // Not quite right, but is the best we can do...
+ int n = ptr->__length();
+ *this = Array_obj<ELEM_>::__new(n);
+ for(int i=0;i<n;i++)
+ mPtr->__unsafe_set(i,ptr->__GetItem(i));
+ }
+ }
+ else
+ mPtr = arr;
+ }
+ }
+
+ Array( const Dynamic &inRHS ) : super(0) { setDynamic(inRHS); }
+ Array( const cpp::ArrayBase &inRHS ) : super(0) { setDynamic(inRHS); }
+ inline Array(const ::cpp::Variant &inVariant) : super(0)
+ {
+ setDynamic(inVariant.asObject());
+ }
+
+ // operator= exact match...
+ Array &operator=( Array<ELEM_> inRHS )
+ {
+ mPtr = inRHS.GetPtr();
+ return *this;
+ }
+
+ // Foreign array
+ template<typename OTHER>
+ Array &operator=( const Array<OTHER> &inRHS )
+ {
+ *this = Array(inRHS);
+ return *this;
+ }
+
+ Array &operator=( const Dynamic &inRHS )
+ {
+ setDynamic(inRHS);
+ return *this;
+ }
+
+ Array &operator=( const cpp::ArrayBase &inRHS )
+ {
+ setDynamic(inRHS);
+ return *this;
+ }
+
+
+ Array &operator=( const cpp::Variant &inRHS )
+ {
+ if (inRHS.type!=cpp::Variant::typeObject)
+ setDynamic( null() );
+ else
+ setDynamic(inRHS.valObject);
+ return *this;
+ }
+
+
+ Array &operator=( const null &inNull )
+ {
+ mPtr = 0;
+ return *this;
+ }
+
+ inline bool operator==(const cpp::VirtualArray &varray) const { return varray==*this; }
+ inline bool operator!=(const cpp::VirtualArray &varray) const { return varray!=*this; }
+
+ inline ELEM_ &operator[](int inIdx) { return CheckGetPtr()->Item(inIdx); }
+ inline ELEM_ operator[](int inIdx) const { return CheckGetPtr()->__get(inIdx); }
+ //inline ELEM_ __get(int inIdx) const { return CheckGetPtr()->__get(inIdx); }
+ inline int __length() const { return CheckGetPtr()->__length(); }
+ inline Array<ELEM_> &Add(const ELEM_ &inElem) { CheckGetPtr()->Add(inElem); return *this; }
+ inline Array<ELEM_> & operator<<(const ELEM_ &inElem) { CheckGetPtr()->Add(inElem); return *this; }
+};
+
+
+// Now that the "Array" object is defined, we can implement this function ....
+
+template<typename ELEM_>
+Array<ELEM_> Array_obj<ELEM_>::__new(int inSize,int inReserve)
+ { return Array<ELEM_>(new Array_obj(inSize,inReserve)); }
+
+
+template<typename ELEM_>
+Array<ELEM_> Array_obj<ELEM_>::__newConstWrapper(ELEM_ *inData,int inSize)
+{
+ Array_obj<ELEM_> temp(0,0);
+ Array_obj<ELEM_> *result = (Array_obj<ELEM_> *)hx::InternalCreateConstBuffer(&temp,sizeof(temp));
+ result->setUnmanagedData(inData, inSize);
+ return result;
+}
+
+
+template<typename ELEM_>
+Array<ELEM_> Array_obj<ELEM_>::fromData(const ELEM_ *inData,int inCount)
+{
+ Array<ELEM_> result = new Array_obj(inCount,inCount);
+ if (inCount)
+ result->memcpy(0, inData, inCount);
+ return result;
+}
+
+
+
+template<>
+inline bool Dynamic::IsClass<Array<Dynamic> >()
+ { return mPtr && mPtr->__GetClass()== hx::ArrayBase::__mClass; }
+
+
+template<typename ELEM_>
+Array<ELEM_> Array_obj<ELEM_>::concat( Array<ELEM_> inTail )
+{
+ Array_obj *result = new Array_obj(inTail->__length()+(int)length,0);
+ hx::ArrayBase::Concat(result,inTail->GetBase(),inTail->__length());
+ return result;
+}
+
+template<typename ELEM_>
+Array<ELEM_> Array_obj<ELEM_>::copy( )
+{
+ Array_obj *result = new Array_obj((int)length,0);
+ ::memcpy(result->GetBase(),GetBase(),length*sizeof(ELEM_));
+ return result;
+}
+
+// Copies the range of the array starting at pos up to, but not including, end.
+// Both pos and end can be negative to count from the end: -1 is the last item in the array.
+template<typename ELEM_>
+Array<ELEM_> Array_obj<ELEM_>::slice(int inPos, Dynamic end)
+{
+ int e = end==null() ? length : end->__ToInt();
+ Array_obj *result = new Array_obj(0,0);
+ hx::ArrayBase::Slice(result,inPos,(int)e);
+ return result;
+}
+
+template<typename ELEM_>
+Array<ELEM_> Array_obj<ELEM_>::splice(int inPos, int len)
+{
+ Array_obj * result = new Array_obj(0,0);
+ hx::ArrayBase::Splice(result,inPos,len);
+ return result;
+}
+
+
+template<typename ELEM_>
+Array<ELEM_> Array_obj<ELEM_>::filter(Dynamic inFunc)
+{
+ Array_obj *result = new Array_obj(0,0);
+ for(int i=0;i<length;i++)
+ if (inFunc(__unsafe_get(i)))
+ result->push(__unsafe_get(i));
+ return result;
+}
+
+template<typename ELEM_>
+Array<ELEM_> Array_obj<ELEM_>::__SetSizeExact(int inLen)
+{
+ ArrayBase::__SetSizeExact(inLen);
+ return this;
+}
+
+// Static externs
+template<typename ARRAY>
+inline ARRAY _hx_array_set_size_exact(ARRAY inArray, int inLen)
+{
+ return inArray->__SetSizeExact(inLen);
+}
+
+template<typename ARRAY1,typename ARRAY2>
+inline int _hx_array_memcmp(ARRAY1 inArray1, ARRAY2 inArray2)
+{
+ return inArray1->memcmp(inArray2);
+}
+
+template<typename ARRAY,typename VALUE>
+inline typename ARRAY::Elem _hx_array_unsafe_set(ARRAY inArray, int inIndex, VALUE inValue)
+{
+ return inArray->__unsafe_set(inIndex, inValue);
+}
+
+
+template<typename ARRAY>
+inline typename ARRAY::Elem _hx_array_unsafe_get(ARRAY inArray, int inIndex)
+{
+ return inArray->__unsafe_get(inIndex);
+}
+
+
+
+// Include again, for functions that required Array definition
+#ifdef HX_VARRAY_DEFINED
+#include "cpp/VirtualArray.h"
+#endif
+
+template<typename ELEM_>
+cpp::VirtualArray Array_obj<ELEM_>::map(Dynamic inFunc)
+{
+ cpp::VirtualArray result = cpp::VirtualArray_obj::__new(length,0);
+ for(int i=0;i<length;i++)
+ result->__unsafe_set(i,inFunc(__unsafe_get(i)));
+ return result;
+}
+
+#endif
\ No newline at end of file
diff --git a/Sources/c_snikket/iinclude/Date.h b/Sources/c_snikket/iinclude/Date.h
new file mode 100644
index 0000000..370b920
--- /dev/null
+++ b/Sources/c_snikket/iinclude/Date.h
@@ -0,0 +1,95 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_Date
+#define INCLUDED_Date
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_8e4589df03e4f3cc_26_new)
+HX_DECLARE_CLASS0(Date)
+
+
+
+class HXCPP_CLASS_ATTRIBUTES Date_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Date_obj OBJ_;
+ Date_obj();
+
+ public:
+ enum { _hx_ClassId = 0x018f7872 };
+
+ void __construct(int year,int month,int day,int hour,int min,int sec);
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="Date")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"Date"); }
+
+ inline static ::hx::ObjectPtr< Date_obj > __new(int year,int month,int day,int hour,int min,int sec) {
+ ::hx::ObjectPtr< Date_obj > __this = new Date_obj();
+ __this->__construct(year,month,day,hour,min,sec);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Date_obj > __alloc(::hx::Ctx *_hx_ctx,int year,int month,int day,int hour,int min,int sec) {
+ Date_obj *__this = (Date_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Date_obj), false, "Date"));
+ *(void **)__this = Date_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_8e4589df03e4f3cc_26_new)
+HXDLIN( 26) ( ( ::Date)(__this) )->mSeconds = ::__hxcpp_new_date(year,month,day,hour,min,sec);
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Date_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Date",4e,82,3c,2d); }
+
+ static ::Date now();
+ static ::Dynamic now_dyn();
+
+ static ::Date fromTime(Float t);
+ static ::Dynamic fromTime_dyn();
+
+ Float mSeconds;
+ Float getTime();
+ ::Dynamic getTime_dyn();
+
+ int getUTCHours();
+ ::Dynamic getUTCHours_dyn();
+
+ int getUTCMinutes();
+ ::Dynamic getUTCMinutes_dyn();
+
+ int getUTCSeconds();
+ ::Dynamic getUTCSeconds_dyn();
+
+ int getUTCFullYear();
+ ::Dynamic getUTCFullYear_dyn();
+
+ int getUTCMonth();
+ ::Dynamic getUTCMonth_dyn();
+
+ int getUTCDate();
+ ::Dynamic getUTCDate_dyn();
+
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+};
+
+
+#endif /* INCLUDED_Date */
diff --git a/Sources/c_snikket/iinclude/Dynamic.h b/Sources/c_snikket/iinclude/Dynamic.h
new file mode 100644
index 0000000..391b949
--- /dev/null
+++ b/Sources/c_snikket/iinclude/Dynamic.h
@@ -0,0 +1,477 @@
+#ifndef HX_DYNAMIC_H
+#define HX_DYNAMIC_H
+
+// --- Dynamic ---------------------------------------------------------------
+//
+// The Dynamic class views all classes through the hx::Object interface, and
+// provides generic access to its pointer.
+// It uses dynamic_cast to provide strongly-typed access to the real class.
+
+namespace hx { class Interface; }
+
+
+
+class HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic : public hx::ObjectPtr<hx::Object>
+{
+ typedef hx::ObjectPtr<hx::Object> super;
+
+public:
+
+ Dynamic() {};
+ Dynamic(int inVal);
+ Dynamic(short inVal);
+ Dynamic(unsigned int inVal);
+ Dynamic(unsigned short inVal);
+ Dynamic(unsigned char inVal);
+ Dynamic(signed char inVal);
+ Dynamic(const cpp::CppInt32__ &inVal);
+ Dynamic(bool inVal);
+ Dynamic(double inVal);
+ Dynamic(float inVal);
+ Dynamic(cpp::Int64 inVal);
+ Dynamic(cpp::UInt64 inVal);
+ Dynamic(unsigned long inVal);
+ Dynamic(hx::Object *inObj) : super(inObj) { }
+ Dynamic(const String &inString);
+ Dynamic(const null &inNull) : super(0) { }
+ Dynamic(const Dynamic &inRHS) : super(inRHS.mPtr) { }
+ explicit Dynamic(const HX_CHAR *inStr);
+ Dynamic(const cpp::Variant &inRHS) : super(inRHS.asDynamic()) { }
+ template<typename T>
+ Dynamic(const hx::Native<T *> &inInterface):super(inInterface.ptr ? inInterface->__GetRealObject() : (hx::Object *)0 ) { }
+ #if !defined(__GNUC__) || defined(__MINGW32__) || (defined(__WORDSIZE) && (__WORDSIZE != 64))
+ Dynamic(long inVal);
+ Dynamic(unsigned long inVal);
+ #endif
+#ifdef __OBJC__
+#ifdef HXCPP_OBJC
+ Dynamic(const id inObjc);
+#endif
+#endif
+
+ template<typename T,typename S>
+ explicit Dynamic(const cpp::Struct<T,S> &inRHS) { *this = inRHS; }
+ template<typename T>
+ explicit Dynamic(const cpp::Pointer<T> &inRHS) { *this = inRHS; }
+
+
+ void Set(bool inVal);
+ void Set(int inVal);
+ void Set(double inVal);
+ void Set(float inVal);
+
+
+ template<typename RESULT> RESULT StaticCast() const;
+
+ inline operator double () const { return mPtr ? mPtr->__ToDouble() : 0.0; }
+ inline operator float () const { return mPtr ? (float)mPtr->__ToDouble() : 0.0f; }
+ inline operator int () const { return mPtr ? mPtr->__ToInt() : 0; }
+ inline operator unsigned int () const { return mPtr ? mPtr->__ToInt() : 0; }
+ inline operator short () const { return mPtr ? mPtr->__ToInt() : 0; }
+ inline operator unsigned short () const { return mPtr ? mPtr->__ToInt() : 0; }
+ inline operator unsigned char () const { return mPtr ? mPtr->__ToInt() : 0; }
+ inline operator char () const { return mPtr ? mPtr->__ToInt() : 0; }
+ inline operator signed char () const { return mPtr ? mPtr->__ToInt() : 0; }
+ inline operator bool() const { return mPtr && mPtr->__ToInt(); }
+ inline operator cpp::Int64() const { return mPtr ? mPtr->__ToInt64() : 0; }
+ inline operator cpp::UInt64() const { return mPtr ? mPtr->__ToInt64() : 0; }
+ inline operator unsigned long() const { return mPtr ? mPtr->__ToInt64() : 0; }
+
+ // Conversion to generic pointer requires you to tag the class with a typedef
+ template<typename T>
+ inline operator typename hx::Native<T *> () const {
+ return hx::Native<T *>(dynamic_cast<T *>(mPtr));
+ }
+
+
+ //inline operator cpp::Variant() const { return cpp::Variant(mPtr); }
+#ifdef __OBJC__
+#ifdef HXCPP_OBJC
+ #ifdef OBJC_ARC
+ inline operator id() const { return mPtr ? (__bridge id)mPtr->__GetHandle() : 0; }
+ #else
+ inline operator id() const { return mPtr ? (id)mPtr->__GetHandle() : 0; }
+ #endif
+#endif
+#endif
+ inline bool operator !() const { return !mPtr || !mPtr->__ToInt(); }
+
+ hx::IndexRef operator[](int inIndex);
+ inline Dynamic __get(int inIndex) const { return mPtr->__GetItem(inIndex); }
+
+ template<typename SOURCE_>
+ Dynamic(const hx::ObjectPtr<SOURCE_> &inObjectPtr) :
+ hx::ObjectPtr<hx::Object>(inObjectPtr.mPtr) { }
+
+ Dynamic Default(const Dynamic &inDef) { return mPtr ? *this : inDef; }
+
+ template<typename RETURN_>
+ RETURN_ Cast() const { return RETURN_(*this); }
+
+ template<typename CLASS_>
+ bool IsClass() { return CLASS_(mPtr,false).mPtr; }
+
+ static void __boot();
+
+ inline bool IsNumeric() const
+ {
+ if (!mPtr) return false;
+ int t = mPtr->__GetType();
+ return t==vtInt || t==vtFloat;
+ }
+
+ inline bool IsBool() const
+ {
+ if (!mPtr) return false;
+ int t = mPtr->__GetType();
+ return t==vtBool;
+ }
+
+
+ int Compare(const Dynamic &inRHS) const
+ {
+ if (mPtr==0) return inRHS.mPtr==0 ? 0 : -1;
+ if (inRHS.mPtr==0) return -1;
+ return mPtr->__Compare(inRHS.mPtr);
+ }
+
+ bool operator==(const null &inRHS) const { return mPtr==0; }
+ bool operator!=(const null &inRHS) const { return mPtr!=0; }
+
+ bool operator == (const Dynamic &inRHS) const
+ {
+ // Comparing pointers fails in the case on Nan==Nan
+ //if (mPtr==inRHS.mPtr) return true;
+ if (!mPtr && !inRHS.mPtr) return true;
+ if (!mPtr || !inRHS.mPtr) return false;
+ return mPtr->__Compare(inRHS.mPtr)==0;
+ }
+
+ bool operator != (const Dynamic &inRHS) const
+ {
+ // Comparing pointers fails in the case on Nan==Nan
+ //if (mPtr==inRHS.mPtr) return true;
+ if (!mPtr && !inRHS.mPtr) return false;
+ if (!mPtr || !inRHS.mPtr) return true;
+ return mPtr->__Compare(inRHS.mPtr)!=0;
+ }
+
+
+ bool operator == (const cpp::Variant &inRHS) const { return (*this) == Dynamic(inRHS); }
+ bool operator != (const cpp::Variant &inRHS) const { return (*this) != Dynamic(inRHS); }
+
+
+ #define DYNAMIC_COMPARE_OP( op ) \
+ bool operator op (const String &inRHS) const { return mPtr && ((String)(*this) op inRHS); } \
+ bool operator op (double inRHS) const { return IsNumeric() && ((double)(*this) op inRHS); } \
+ bool operator op (cpp::Int64 inRHS) const { return IsNumeric() && ((cpp::Int64)(*this) op inRHS); } \
+ bool operator op (cpp::UInt64 inRHS) const { return IsNumeric() && ((cpp::Int64)(*this) op inRHS); } \
+ bool operator op (float inRHS) const { return IsNumeric() && ((double)(*this) op inRHS); } \
+ bool operator op (int inRHS) const { return IsNumeric() && ((double)(*this) op (double)inRHS); } \
+ bool operator op (unsigned int inRHS) const { return IsNumeric() && ((double)(*this) op (double)inRHS); } \
+ bool operator op (short inRHS) const { return IsNumeric() && ((double)(*this) op (double)inRHS); } \
+ bool operator op (unsigned short inRHS) const { return IsNumeric() && ((double)(*this) op (double)inRHS); } \
+ bool operator op (signed char inRHS) const { return IsNumeric() && ((double)(*this) op (double)inRHS); } \
+ bool operator op (unsigned char inRHS) const { return IsNumeric() && ((double)(*this) op (double)inRHS); } \
+ bool operator op (bool inRHS) const { return IsBool() && ((double)(*this) op (double)inRHS); } \
+
+ bool operator != (const String &inRHS) const { return !mPtr || ((String)(*this) != inRHS); }
+ bool operator != (double inRHS) const { return !IsNumeric() || ((double)(*this) != inRHS); }
+ bool operator != (cpp::Int64 inRHS) const { return !IsNumeric() || ((cpp::Int64)(*this) != inRHS); }
+ bool operator != (cpp::UInt64 inRHS) const { return !IsNumeric() || ((cpp::Int64)(*this) != inRHS); }
+ bool operator != (float inRHS) const { return !IsNumeric() || ((double)(*this) != inRHS); }
+ bool operator != (int inRHS) const { return !IsNumeric() || ((double)(*this) != (double)inRHS); }
+ bool operator != (unsigned int inRHS) const { return !IsNumeric() || ((double)(*this) != (double)inRHS); }
+ bool operator != (short inRHS) const { return !IsNumeric() || ((double)(*this) != (double)inRHS); }
+ bool operator != (unsigned short inRHS) const { return !IsNumeric() || ((double)(*this) != (double)inRHS); }
+ bool operator != (signed char inRHS) const { return !IsNumeric() || ((double)(*this) != (double)inRHS); }
+ bool operator != (unsigned char inRHS) const { return !IsNumeric() || ((double)(*this) != (double)inRHS); }
+ bool operator != (bool inRHS) const { return !IsBool() || ((double)(*this) != (double)inRHS); }
+
+
+
+ #define DYNAMIC_COMPARE_OP_ALL( op ) \
+ bool operator op (const Dynamic &inRHS) const { return mPtr && (Compare(inRHS) op 0); } \
+ bool operator op (const cpp::Variant &inRHS) const { return *this op Dynamic(inRHS); } \
+ DYNAMIC_COMPARE_OP(op)
+
+
+ DYNAMIC_COMPARE_OP( == )
+ DYNAMIC_COMPARE_OP_ALL( < )
+ DYNAMIC_COMPARE_OP_ALL( <= )
+ DYNAMIC_COMPARE_OP_ALL( >= )
+ DYNAMIC_COMPARE_OP_ALL( > )
+
+ template<typename T_>
+ bool operator==(const hx::ObjectPtr<T_> &inRHS) const
+ {
+ if (mPtr==inRHS.mPtr) return true;
+ if (!mPtr || !inRHS.mPtr) return false;
+ return mPtr == inRHS.mPtr;
+ }
+
+ template<typename T_>
+ bool operator!=(const hx::ObjectPtr<T_> &inRHS) const
+ {
+ if (mPtr==inRHS.mPtr) return false;
+ if (!mPtr || !inRHS.mPtr) return true;
+ return mPtr != inRHS.mPtr;
+ }
+
+
+ // Operator + is different, since it must consider strings too...
+ Dynamic operator+(const Dynamic &inRHS) const;
+ inline String operator+(const String &s) const;
+
+ Dynamic operator+(const cpp::UInt64 &i) const;
+ Dynamic operator+(const cpp::Int64 &i) const;
+ Dynamic operator+(const int &i) const;
+ Dynamic operator+(const unsigned int &i) const;
+ Dynamic operator+(const short &i) const;
+ Dynamic operator+(const unsigned short &i) const;
+ Dynamic operator+(const signed char &i) const;
+ Dynamic operator+(const unsigned char &i) const;
+ Dynamic operator+(const double &d) const;
+ Dynamic operator+(const float &d) const;
+ Dynamic operator+(const cpp::Variant &d) const;
+
+ double operator%(const Dynamic &inRHS) const;
+ double operator-() const { return mPtr ? - mPtr->__ToDouble() : 0.0; }
+ double operator++() { double val = mPtr->__ToDouble() + 1; *this = val; return val; }
+ double operator++(int) {double val = mPtr->__ToDouble(); *this = val+1; return val; }
+ double operator--() { double val = mPtr->__ToDouble() - 1; *this = val; return val; }
+ double operator--(int) {double val = mPtr->__ToDouble(); *this = val-1; return val; }
+
+
+ double operator / (const cpp::Variant &inRHS) const { return (double)(*this) / (double)inRHS; } \
+ double operator / (const Dynamic &inRHS) const { return (double)(*this) / (double)inRHS; } \
+ double operator / (const double &inRHS) const { return (double)(*this) / (double)inRHS; } \
+ double operator / (const float &inRHS) const { return (double)(*this) / (double)inRHS; } \
+ double operator / (const int &inRHS) const { return (double)(*this) / (double)inRHS; }
+
+ #define DYNAMIC_ARITH( op ) \
+ Dynamic operator op (const cpp::Variant &inRHS) const \
+ { return mPtr->__GetType()==vtInt && inRHS.isInt() ? \
+ Dynamic((int)(*this) op (int)inRHS) : \
+ Dynamic( (double)(*this) op (double)inRHS); } \
+ Dynamic operator op (const Dynamic &inRHS) const \
+ { return mPtr->__GetType()==vtInt && inRHS.mPtr->__GetType()==vtInt ? \
+ Dynamic((int)(*this) op (int)inRHS) : \
+ Dynamic( (double)(*this) op (double)inRHS); } \
+ double operator op (const double &inRHS) const { return (double)(*this) op (double)inRHS; } \
+ double operator op (const float &inRHS) const { return (double)(*this) op (double)inRHS; } \
+ Dynamic operator op (const int &inRHS) const \
+ { return mPtr->__GetType()==vtInt ? Dynamic((int)(*this) op inRHS) : Dynamic((double)(*this) op inRHS); } \
+ Dynamic operator op (const unsigned int &inRHS) const \
+ { return mPtr->__GetType()==vtInt ? Dynamic((int)(*this) op inRHS) : Dynamic((double)(*this) op inRHS); } \
+ Dynamic operator op (const short &inRHS) const \
+ { return mPtr->__GetType()==vtInt ? Dynamic((int)(*this) op inRHS) : Dynamic((double)(*this) op inRHS); } \
+ Dynamic operator op (const unsigned short &inRHS) const \
+ { return mPtr->__GetType()==vtInt ? Dynamic((int)(*this) op inRHS) : Dynamic((double)(*this) op inRHS); } \
+ Dynamic operator op (const signed char &inRHS) const \
+ { return mPtr->__GetType()==vtInt ? Dynamic((int)(*this) op inRHS) : Dynamic((double)(*this) op inRHS); } \
+ Dynamic operator op (const unsigned char &inRHS) const \
+ { return mPtr->__GetType()==vtInt ? Dynamic((int)(*this) op inRHS) : Dynamic((double)(*this) op inRHS); } \
+ Dynamic operator op (const cpp::Int64 &inRHS) const \
+ { return Dynamic((double)(*this) op inRHS); } \
+ Dynamic operator op (const cpp::UInt64 &inRHS) const \
+ { return Dynamic((double)(*this) op inRHS); } \
+
+ DYNAMIC_ARITH( - )
+ DYNAMIC_ARITH( * )
+
+ static void ThrowBadFunctionError();
+ inline void CheckFPtr() { if (!mPtr) ThrowBadFunctionError(); }
+
+ inline ::Dynamic operator()() { CheckFPtr(); return mPtr->__run(); }
+ inline ::Dynamic operator()(const Dynamic &inArg0) { CheckFPtr(); return mPtr->__run(inArg0); }
+ inline ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1) { CheckFPtr(); return mPtr->__run(inArg0,inArg1); }
+ inline ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2) { CheckFPtr(); return mPtr->__run(inArg0,inArg1,inArg2); }
+ inline ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3) { CheckFPtr(); return mPtr->__run(inArg0,inArg1,inArg2,inArg3); }
+ inline ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4) { CheckFPtr(); return mPtr->__run(inArg0,inArg1,inArg2,inArg3,inArg4); }
+
+ HX_DECLARE_DYNAMIC_FUNCTIONS;
+
+
+ typedef const Dynamic &D;
+};
+
+
+
+namespace hx
+{
+
+inline hx::Object *DynamicPtr(Dynamic inVal) { return inVal.mPtr; }
+
+typedef Dynamic (*MemberFunction0)(hx::Object *inObj);
+typedef Dynamic (*MemberFunction1)(hx::Object *inObj,const Dynamic &inArg0);
+typedef Dynamic (*MemberFunction2)(hx::Object *inObj,const Dynamic &inArg0,const Dynamic &inArg1);
+typedef Dynamic (*MemberFunction3)(hx::Object *inObj,const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2);
+typedef Dynamic (*MemberFunction4)(hx::Object *inObj,const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3);
+typedef Dynamic (*MemberFunction5)(hx::Object *inObj,const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4);
+typedef Dynamic (*MemberFunctionVar)(hx::Object *inObj,const Array<Dynamic> &inArgs);
+
+typedef Dynamic (*StaticFunction0)();
+typedef Dynamic (*StaticFunction1)(const Dynamic &inArg0);
+typedef Dynamic (*StaticFunction2)(const Dynamic &inArg0,const Dynamic &inArg1);
+typedef Dynamic (*StaticFunction3)(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2);
+typedef Dynamic (*StaticFunction4)(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3);
+typedef Dynamic (*StaticFunction5)(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4);
+typedef Dynamic (*StaticFunctionVar)(const Array<Dynamic> &inArgs);
+
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic CreateMemberFunction0(const char *,hx::Object *, MemberFunction0);
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic CreateMemberFunction1(const char *,hx::Object *, MemberFunction1);
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic CreateMemberFunction2(const char *,hx::Object *, MemberFunction2);
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic CreateMemberFunction3(const char *,hx::Object *, MemberFunction3);
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic CreateMemberFunction4(const char *,hx::Object *, MemberFunction4);
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic CreateMemberFunction5(const char *,hx::Object *, MemberFunction5);
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic CreateMemberFunctionVar(const char *,hx::Object *, MemberFunctionVar,int inN);
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic CreateStaticFunction0(const char *,StaticFunction0);
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic CreateStaticFunction1(const char *,StaticFunction1);
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic CreateStaticFunction2(const char *,StaticFunction2);
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic CreateStaticFunction3(const char *,StaticFunction3);
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic CreateStaticFunction4(const char *,StaticFunction4);
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic CreateStaticFunction5(const char *,StaticFunction5);
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic CreateStaticFunctionVar(const char *,StaticFunctionVar,int inN);
+
+
+}
+
+
+
+
+
+
+
+template<>
+inline int Dynamic::Cast<int>() const { return mPtr ? mPtr->__ToInt() : 0; }
+template<>
+inline bool Dynamic::Cast<bool>() const { return mPtr ? mPtr->__ToInt() : 0; }
+template<>
+inline double Dynamic::Cast<double>() const { return mPtr ? mPtr->__ToDouble() : 0; }
+template<>
+inline float Dynamic::Cast<float>() const { return mPtr ? mPtr->__ToDouble() : 0; }
+template<>
+inline String Dynamic::Cast<String>() const { return mPtr ? mPtr->toString() : String(null()); }
+
+
+
+//
+// Gets the class definition that relates to a specific type.
+// Most classes have their own class data, by the standard types (non-classes)
+// use the template traits to get the class
+
+namespace hx
+{
+HXCPP_EXTERN_CLASS_ATTRIBUTES hx::Class &GetIntClass();
+HXCPP_EXTERN_CLASS_ATTRIBUTES hx::Class &GetFloatClass();
+HXCPP_EXTERN_CLASS_ATTRIBUTES hx::Class &GetBoolClass();
+HXCPP_EXTERN_CLASS_ATTRIBUTES hx::Class &GetVoidClass();
+HXCPP_EXTERN_CLASS_ATTRIBUTES hx::Class &GetStringClass();
+HXCPP_EXTERN_CLASS_ATTRIBUTES hx::Class &GetInt64Class();
+}
+
+template<>
+inline bool Dynamic::IsClass<int>() { return mPtr && mPtr->__GetClass()==hx::GetIntClass(); }
+template<>
+inline bool Dynamic::IsClass<double>() { return mPtr &&
+ ( mPtr->__GetClass()==hx::GetIntClass() || mPtr->__GetClass()==hx::GetFloatClass()) ; }
+template<>
+inline bool Dynamic::IsClass<float>() { return mPtr && mPtr->__GetClass()==hx::GetFloatClass(); }
+template<>
+inline bool Dynamic::IsClass<bool>() { return mPtr && mPtr->__GetClass()==hx::GetBoolClass(); }
+template<>
+inline bool Dynamic::IsClass<null>() { return !mPtr; }
+template<>
+inline bool Dynamic::IsClass<String>() { return mPtr && mPtr->__GetClass()==hx::GetStringClass(); }
+template<>
+inline bool Dynamic::IsClass<Dynamic>() { return true; }
+template<>
+inline bool Dynamic::IsClass< ::cpp::Int64>() { return mPtr && mPtr->__GetClass()==hx::GetInt64Class(); }
+
+inline String Dynamic::operator+(const String &s) const { return Cast<String>() + s; }
+
+#define HX_DYNAMIC_OP_ISEQ(T) \
+inline bool operator == (const T &inLHS,const Dynamic &inRHS) { return inRHS==inLHS; } \
+inline bool operator != (const T &inLHS,const Dynamic &inRHS) { return inRHS!=inLHS; }
+
+HX_DYNAMIC_OP_ISEQ(String)
+HX_DYNAMIC_OP_ISEQ(double)
+HX_DYNAMIC_OP_ISEQ(float)
+HX_DYNAMIC_OP_ISEQ(int)
+HX_DYNAMIC_OP_ISEQ(bool)
+
+inline bool operator < (bool inLHS,const Dynamic &inRHS) { return false; }
+inline bool operator <= (bool inLHS,const Dynamic &inRHS) { return false; }
+inline bool operator >= (bool inLHS,const Dynamic &inRHS) { return false; }
+inline bool operator > (bool inLHS,const Dynamic &inRHS) { return false; }
+
+#if defined(HX_WINRT) && defined(__cplusplus_winrt)
+// Try to avoid the compiler using injected Box::operator int and Dynamic(null) when doing ==
+template<typename T>
+bool operator==(Platform::Box<T> ^inPtr, nullptr_t)
+{
+ void* ptr = (void*) reinterpret_cast<void*>(inPtr);
+ return ptr==nullptr;
+}
+#endif
+
+
+
+#define COMPARE_DYNAMIC_OP( op ) \
+ inline bool operator op (double inLHS,const ::Dynamic &inRHS) \
+ { return inRHS.IsNumeric() && (inLHS op (double)inRHS); } \
+ inline bool operator op (float inLHS,const ::Dynamic &inRHS) \
+ { return inRHS.IsNumeric() && ((double)inLHS op (double)inRHS); } \
+ inline bool operator op (int inLHS,const ::Dynamic &inRHS) \
+ { return inRHS.IsNumeric() && (inLHS op (double)inRHS); }
+
+COMPARE_DYNAMIC_OP( < )
+COMPARE_DYNAMIC_OP( <= )
+COMPARE_DYNAMIC_OP( >= )
+COMPARE_DYNAMIC_OP( > )
+
+
+#define ARITH_DYNAMIC( op ) \
+ inline double operator op (const cpp::Int64 &inLHS,const Dynamic &inRHS) { return inLHS op (cpp::Int64)inRHS;} \
+ inline double operator op (const cpp::UInt64 &inLHS,const Dynamic &inRHS) { return inLHS op (cpp::UInt64)inRHS;} \
+ inline double operator op (const double &inLHS,const Dynamic &inRHS) { return inLHS op (double)inRHS;} \
+ inline double operator op (const float &inLHS,const Dynamic &inRHS) { return inLHS op (double)inRHS;} \
+ inline double operator op (const int &inLHS,const Dynamic &inRHS) { return inLHS op (double)inRHS; } \
+ inline double operator op (const unsigned int &inLHS,const Dynamic &inRHS) { return inLHS op (double)inRHS; } \
+ inline double operator op (const short &inLHS,const Dynamic &inRHS) { return inLHS op (double)inRHS; } \
+ inline double operator op (const unsigned short &inLHS,const Dynamic &inRHS) { return inLHS op (double)inRHS; } \
+ inline double operator op (const signed char &inLHS,const Dynamic &inRHS) { return inLHS op (double)inRHS; } \
+ inline double operator op (const unsigned char &inLHS,const Dynamic &inRHS) { return inLHS op (double)inRHS; } \
+
+ARITH_DYNAMIC( - )
+ARITH_DYNAMIC( + )
+ARITH_DYNAMIC( / )
+ARITH_DYNAMIC( * )
+
+double operator%(const int &inLHS,const Dynamic &inRHS);
+double operator%(const double &inLHS,const Dynamic &inRHS);
+double operator%(const float &inLHS,const Dynamic &inRHS);
+
+template<typename T,typename H> String::String(const cpp::Struct<T,H> &inRHS) { *this = (String)inRHS; }
+template<typename OBJ> String::String(const hx::ObjectPtr<OBJ> &inRHS) { *this = Dynamic(inRHS); }
+
+
+
+#endif
diff --git a/Sources/c_snikket/iinclude/EReg.h b/Sources/c_snikket/iinclude/EReg.h
new file mode 100644
index 0000000..9cf6865
--- /dev/null
+++ b/Sources/c_snikket/iinclude/EReg.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_EReg
+#define INCLUDED_EReg
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(EReg)
+
+
+
+class HXCPP_CLASS_ATTRIBUTES EReg_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef EReg_obj OBJ_;
+ EReg_obj();
+
+ public:
+ enum { _hx_ClassId = 0x022d4033 };
+
+ void __construct(::String r,::String opt);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="EReg")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"EReg"); }
+ static ::hx::ObjectPtr< EReg_obj > __new(::String r,::String opt);
+ static ::hx::ObjectPtr< EReg_obj > __alloc(::hx::Ctx *_hx_ctx,::String r,::String opt);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~EReg_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("EReg",0f,4a,da,2d); }
+
+ ::Dynamic r;
+ ::String last;
+ bool global;
+ bool match(::String s);
+ ::Dynamic match_dyn();
+
+ ::String matched(int n);
+ ::Dynamic matched_dyn();
+
+ ::Dynamic matchedPos();
+ ::Dynamic matchedPos_dyn();
+
+ bool matchSub(::String s,int pos,::hx::Null< int > len);
+ ::Dynamic matchSub_dyn();
+
+ ::String replace(::String s,::String by);
+ ::Dynamic replace_dyn();
+
+ ::String map(::String s, ::Dynamic f);
+ ::Dynamic map_dyn();
+
+};
+
+
+#endif /* INCLUDED_EReg */
diff --git a/Sources/c_snikket/iinclude/Enum.h b/Sources/c_snikket/iinclude/Enum.h
new file mode 100644
index 0000000..fed5b22
--- /dev/null
+++ b/Sources/c_snikket/iinclude/Enum.h
@@ -0,0 +1,158 @@
+#ifndef HX_ENUM_H
+#define HX_ENUM_H
+
+
+
+// Enum (ie enum object class def) is the same as Class.
+typedef hx::Class Enum;
+
+
+namespace hx
+{
+
+// --- hx::EnumBase_obj ----------------------------------------------------------
+//
+// Base class for Enums.
+// Specializations of this class don't actually add more data, just extra constructors
+// and type information.
+
+class HXCPP_EXTERN_CLASS_ATTRIBUTES EnumBase_obj : public hx::Object
+{
+ typedef hx::Object super;
+ typedef EnumBase_obj OBJ_;
+
+
+ protected:
+ String _hx_tag;
+ int mFixedFields;
+ #ifdef HXCPP_SCRIPTABLE
+ struct CppiaClassInfo *classInfo;
+ #endif
+ public:
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdEnum };
+
+ int index;
+
+ public:
+ inline void *operator new( size_t inSize, int inExtra=0)
+ {
+ return hx::Object::operator new(inSize+inExtra, true, 0);
+ }
+ inline void operator delete(void *, int inExtra ) { }
+ inline void operator delete(void *, size_t inSize ) { }
+ inline void operator delete(void *, size_t inSize, int inExtra ) { }
+
+
+ HX_DO_ENUM_RTTI_INTERNAL;
+ static hx::ObjectPtr<hx::Class_obj> &__SGetClass();
+
+
+ String toString();
+
+ EnumBase_obj() : index(-1) { }
+ EnumBase_obj(const null &inNull) : index(-1) { }
+ int __GetType() const { return vtEnum; }
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(DynamicArray inArgs);
+ static void __boot();
+
+ void __Mark(hx::MarkContext *__inCtx);
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx);
+ #endif
+
+ static hx::ObjectPtr<EnumBase_obj> Resolve(String inName);
+ inline static bool __GetStatic(const ::String &inName, Dynamic &outValue, hx::PropertyAccess inCallProp) { return false; }
+
+ inline cpp::Variant *_hx_getFixed() { return (cpp::Variant *)(this + 1); }
+ inline const cpp::Variant *_hx_getFixed() const { return (cpp::Variant *)(this + 1); }
+ inline ::Dynamic __Param(int inID) { return _hx_getFixed()[inID]; }
+ template<typename T>
+ inline EnumBase_obj *_hx_init(int inIndex,const T &inValue)
+ {
+ #ifdef HXCPP_GC_GENERATIONAL
+ cpp::Variant &v = _hx_getFixed()[inIndex];
+ v = inValue;
+ if (v.type<=cpp::Variant::typeString)
+ HX_OBJ_WB_GET(this, v.valObject);
+ #else
+ _hx_getFixed()[inIndex] = inValue;
+ #endif
+ return this;
+ }
+ inline void _hx_setIdentity(const String &inTag, int inIndex,int inFixedFields)
+ {
+ _hx_tag = inTag;
+ HX_OBJ_WB_GET(this, _hx_tag.__s);
+ index = inIndex;
+ mFixedFields = inFixedFields;
+ }
+ DynamicArray _hx_getParameters();
+
+ inline ::Dynamic _hx_getObject(int inId) { return _hx_getFixed()[inId].asDynamic(); }
+ inline int _hx_getInt(int inId) { return _hx_getFixed()[inId]; }
+ inline ::cpp::Int64 _hx_getInt64(int inId) { return _hx_getFixed()[inId].asInt64(); }
+ inline Float _hx_getFloat(int inId) { return _hx_getFixed()[inId]; }
+ inline bool _hx_getBool(int inId) { return _hx_getFixed()[inId]; }
+ inline ::String _hx_getString(int inId) { return _hx_getFixed()[inId].asString(); }
+ inline ::Dynamic _hx_getParamI(int inId) { return _hx_getFixed()[inId]; }
+ inline int _hx_getParamCount() { return mFixedFields; }
+ // Alias for _hx_getParamI
+ Dynamic __GetItem(int inIndex) const;
+
+ // For legacy
+ inline String __Tag() const { return _hx_tag; }
+
+
+ String _hx_getTag() const { return _hx_tag; }
+ int _hx_getIndex() const { return index; }
+
+
+ int __Compare(const hx::Object *inRHS) const;
+
+ virtual String GetEnumName( ) const { return HX_CSTRING("Enum"); }
+};
+
+
+typedef hx::ObjectPtr<EnumBase_obj> EnumBase;
+
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES bool __hxcpp_enum_eq( ::hx::EnumBase a, ::hx::EnumBase b);
+
+// --- CreateEnum -------------------------------------------------------------
+//
+// Template function to return a strongly-typed version fo the Enum.
+// Most of the common stuff is in "Set".
+
+template<typename ENUM>
+ENUM *CreateEnum(const String &inName,int inIndex, int inFields)
+{
+ ENUM *result = new (inFields*sizeof(cpp::Variant)) ENUM;
+ result->_hx_setIdentity(inName,inIndex,inFields);
+ return result;
+}
+
+template<typename ENUM>
+ENUM *CreateConstEnum(const String &inName,int inIndex)
+{
+ ENUM vtable;
+ ENUM *result = (ENUM *)hx::InternalCreateConstBuffer(&vtable,sizeof(ENUM));
+ result->_hx_setIdentity(inName,inIndex,0);
+ return result;
+}
+
+} // end namespace hx
+
+inline int _hx_getEnumValueIndex(hx::EnumBase inEnum)
+{
+ return inEnum->_hx_getIndex();
+}
+
+inline void __hxcpp_enum_force(hx::EnumBase inEnum,String inForceName, int inIndex)
+{
+ inEnum->_hx_setIdentity(inForceName, inIndex,0);
+}
+
+
+
+#endif
diff --git a/Sources/c_snikket/iinclude/HaxeCBridge.h b/Sources/c_snikket/iinclude/HaxeCBridge.h
new file mode 100644
index 0000000..6c32ea0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/HaxeCBridge.h
@@ -0,0 +1,44 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_HaxeCBridge
+#define INCLUDED_HaxeCBridge
+
+#ifndef HXCPP_H
+#ifdef HXCPP_API_LEVEL
+#include <hxcpp.h>
+#else
+#include <hx/Native.h>
+#endif
+#endif
+
+#ifndef INCLUDED_cbce7ceea2d0df24
+#define INCLUDED_cbce7ceea2d0df24
+#include "HaxeCBridge.h"
+#endif
+
+
+
+class HXCPP_CLASS_ATTRIBUTES HaxeCBridge
+{
+ public:
+ static void mainThreadInit(::cpp::Function< bool () > isMainThreadCb);
+
+ static void mainThreadRun(::cpp::Function< void () > processNativeCalls,::cpp::Function< void (const char*) > onUnhandledException);
+
+ static void** retainHaxeArray(::cpp::VirtualArray haxeArray);
+
+ static void* retainHaxeObject( ::Dynamic haxeObject);
+
+ static const char* retainHaxeString(::String haxeString);
+
+ static void releaseHaxePtr(void * haxePtr);
+
+ static bool isMainThread();
+
+ static void endMainThread(bool waitOnScheduledEvents);
+
+ static void wakeMainThread();
+
+};
+
+
+#endif /* INCLUDED_HaxeCBridge */
diff --git a/Sources/c_snikket/iinclude/Lambda.h b/Sources/c_snikket/iinclude/Lambda.h
new file mode 100644
index 0000000..43b4ef0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/Lambda.h
@@ -0,0 +1,76 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_Lambda
+#define INCLUDED_Lambda
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(Lambda)
+
+
+
+class HXCPP_CLASS_ATTRIBUTES Lambda_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Lambda_obj OBJ_;
+ Lambda_obj();
+
+ public:
+ enum { _hx_ClassId = 0x4cec6e4b };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="Lambda")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"Lambda"); }
+
+ inline static ::hx::ObjectPtr< Lambda_obj > __new() {
+ ::hx::ObjectPtr< Lambda_obj > __this = new Lambda_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Lambda_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Lambda_obj *__this = (Lambda_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Lambda_obj), false, "Lambda"));
+ *(void **)__this = Lambda_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Lambda_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Lambda",27,a7,54,85); }
+
+ static ::cpp::VirtualArray array( ::Dynamic it);
+ static ::Dynamic array_dyn();
+
+ static bool exists( ::Dynamic it, ::Dynamic f);
+ static ::Dynamic exists_dyn();
+
+ static ::cpp::VirtualArray filter( ::Dynamic it, ::Dynamic f);
+ static ::Dynamic filter_dyn();
+
+ static ::Dynamic fold( ::Dynamic it, ::Dynamic f, ::Dynamic first);
+ static ::Dynamic fold_dyn();
+
+ static bool empty( ::Dynamic it);
+ static ::Dynamic empty_dyn();
+
+ static ::Dynamic find( ::Dynamic it, ::Dynamic f);
+ static ::Dynamic find_dyn();
+
+ static int findIndex( ::Dynamic it, ::Dynamic f);
+ static ::Dynamic findIndex_dyn();
+
+};
+
+
+#endif /* INCLUDED_Lambda */
diff --git a/Sources/c_snikket/iinclude/Reflect.h b/Sources/c_snikket/iinclude/Reflect.h
new file mode 100644
index 0000000..87d8d52
--- /dev/null
+++ b/Sources/c_snikket/iinclude/Reflect.h
@@ -0,0 +1,91 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_Reflect
+#define INCLUDED_Reflect
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(Reflect)
+
+
+
+class HXCPP_CLASS_ATTRIBUTES Reflect_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Reflect_obj OBJ_;
+ Reflect_obj();
+
+ public:
+ enum { _hx_ClassId = 0x769a515d };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="Reflect")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"Reflect"); }
+
+ inline static ::hx::ObjectPtr< Reflect_obj > __new() {
+ ::hx::ObjectPtr< Reflect_obj > __this = new Reflect_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Reflect_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Reflect_obj *__this = (Reflect_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Reflect_obj), false, "Reflect"));
+ *(void **)__this = Reflect_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Reflect_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Reflect",1d,ac,7a,b6); }
+
+ static bool hasField( ::Dynamic o,::String field);
+ static ::Dynamic hasField_dyn();
+
+ static ::Dynamic field( ::Dynamic o,::String field);
+ static ::Dynamic field_dyn();
+
+ static void setField( ::Dynamic o,::String field, ::Dynamic value);
+ static ::Dynamic setField_dyn();
+
+ static ::Dynamic getProperty( ::Dynamic o,::String field);
+ static ::Dynamic getProperty_dyn();
+
+ static ::Dynamic callMethod( ::Dynamic o, ::Dynamic func,::cpp::VirtualArray args);
+ static ::Dynamic callMethod_dyn();
+
+ static ::Array< ::String > fields( ::Dynamic o);
+ static ::Dynamic fields_dyn();
+
+ static bool isFunction( ::Dynamic f);
+ static ::Dynamic isFunction_dyn();
+
+ static int compare( ::Dynamic a, ::Dynamic b);
+ static ::Dynamic compare_dyn();
+
+ static bool compareMethods( ::Dynamic f1, ::Dynamic f2);
+ static ::Dynamic compareMethods_dyn();
+
+ static bool isObject( ::Dynamic v);
+ static ::Dynamic isObject_dyn();
+
+ static bool isEnumValue( ::Dynamic v);
+ static ::Dynamic isEnumValue_dyn();
+
+ static ::Dynamic copy( ::Dynamic o);
+ static ::Dynamic copy_dyn();
+
+};
+
+
+#endif /* INCLUDED_Reflect */
diff --git a/Sources/c_snikket/iinclude/Std.h b/Sources/c_snikket/iinclude/Std.h
new file mode 100644
index 0000000..c837022
--- /dev/null
+++ b/Sources/c_snikket/iinclude/Std.h
@@ -0,0 +1,83 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_Std
+#define INCLUDED_Std
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(Std)
+
+
+
+class HXCPP_CLASS_ATTRIBUTES Std_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Std_obj OBJ_;
+ Std_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7ee3a517 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="Std")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"Std"); }
+
+ inline static ::hx::ObjectPtr< Std_obj > __new() {
+ ::hx::ObjectPtr< Std_obj > __this = new Std_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Std_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Std_obj *__this = (Std_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Std_obj), false, "Std"));
+ *(void **)__this = Std_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Std_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Std",83,60,3f,00); }
+
+ static bool is( ::Dynamic v, ::Dynamic t);
+ static ::Dynamic is_dyn();
+
+ static bool isOfType( ::Dynamic v, ::Dynamic t);
+ static ::Dynamic isOfType_dyn();
+
+ static ::Dynamic downcast( ::Dynamic value,::hx::Class c);
+ static ::Dynamic downcast_dyn();
+
+ static ::Dynamic instance( ::Dynamic value,::hx::Class c);
+ static ::Dynamic instance_dyn();
+
+ static ::String string( ::Dynamic s);
+ static ::Dynamic string_dyn();
+
+ static int _hx_int(Float x);
+ static ::Dynamic _hx_int_dyn();
+
+ static ::Dynamic parseInt(::String x);
+ static ::Dynamic parseInt_dyn();
+
+ static Float parseFloat(::String x);
+ static ::Dynamic parseFloat_dyn();
+
+ static int random(int x);
+ static ::Dynamic random_dyn();
+
+ static inline String string(String &s) { return s; }
+};
+
+
+#endif /* INCLUDED_Std */
diff --git a/Sources/c_snikket/iinclude/StringBuf.h b/Sources/c_snikket/iinclude/StringBuf.h
new file mode 100644
index 0000000..575e391
--- /dev/null
+++ b/Sources/c_snikket/iinclude/StringBuf.h
@@ -0,0 +1,78 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_StringBuf
+#define INCLUDED_StringBuf
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_8b63e6eaf513c097_35_new)
+HX_DECLARE_CLASS0(StringBuf)
+
+
+
+class HXCPP_CLASS_ATTRIBUTES StringBuf_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef StringBuf_obj OBJ_;
+ StringBuf_obj();
+
+ public:
+ enum { _hx_ClassId = 0x2cc74002 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="StringBuf")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"StringBuf"); }
+
+ inline static ::hx::ObjectPtr< StringBuf_obj > __new() {
+ ::hx::ObjectPtr< StringBuf_obj > __this = new StringBuf_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< StringBuf_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ StringBuf_obj *__this = (StringBuf_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(StringBuf_obj), true, "StringBuf"));
+ *(void **)__this = StringBuf_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_8b63e6eaf513c097_35_new)
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~StringBuf_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("StringBuf",c2,ca,83,69); }
+
+ ::Array< ::String > b;
+ ::Array< char > charBuf;
+ ::String charBufAsString();
+ ::Dynamic charBufAsString_dyn();
+
+ void flush();
+ ::Dynamic flush_dyn();
+
+ int get_length();
+ ::Dynamic get_length_dyn();
+
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+};
+
+
+#endif /* INCLUDED_StringBuf */
diff --git a/Sources/c_snikket/iinclude/StringTools.h b/Sources/c_snikket/iinclude/StringTools.h
new file mode 100644
index 0000000..039cb8b
--- /dev/null
+++ b/Sources/c_snikket/iinclude/StringTools.h
@@ -0,0 +1,88 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_StringTools
+#define INCLUDED_StringTools
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(StringTools)
+
+
+
+class HXCPP_CLASS_ATTRIBUTES StringTools_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef StringTools_obj OBJ_;
+ StringTools_obj();
+
+ public:
+ enum { _hx_ClassId = 0x084f186e };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="StringTools")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"StringTools"); }
+
+ inline static ::hx::ObjectPtr< StringTools_obj > __new() {
+ ::hx::ObjectPtr< StringTools_obj > __this = new StringTools_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< StringTools_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ StringTools_obj *__this = (StringTools_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(StringTools_obj), false, "StringTools"));
+ *(void **)__this = StringTools_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~StringTools_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("StringTools",6a,db,63,03); }
+
+ static ::String urlEncode(::String s);
+ static ::Dynamic urlEncode_dyn();
+
+ static ::String htmlEscape(::String s, ::Dynamic quotes);
+ static ::Dynamic htmlEscape_dyn();
+
+ static bool startsWith(::String s,::String start);
+ static ::Dynamic startsWith_dyn();
+
+ static bool endsWith(::String s,::String end);
+ static ::Dynamic endsWith_dyn();
+
+ static bool isSpace(::String s,int pos);
+ static ::Dynamic isSpace_dyn();
+
+ static ::String ltrim(::String s);
+ static ::Dynamic ltrim_dyn();
+
+ static ::String rtrim(::String s);
+ static ::Dynamic rtrim_dyn();
+
+ static ::String trim(::String s);
+ static ::Dynamic trim_dyn();
+
+ static ::String lpad(::String s,::String c,int l);
+ static ::Dynamic lpad_dyn();
+
+ static ::String replace(::String s,::String sub,::String by);
+ static ::Dynamic replace_dyn();
+
+ static ::String hex(int n, ::Dynamic digits);
+ static ::Dynamic hex_dyn();
+
+};
+
+
+#endif /* INCLUDED_StringTools */
diff --git a/Sources/c_snikket/iinclude/Sys.h b/Sources/c_snikket/iinclude/Sys.h
new file mode 100644
index 0000000..4834a8a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/Sys.h
@@ -0,0 +1,67 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_Sys
+#define INCLUDED_Sys
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(Sys)
+
+
+
+class HXCPP_CLASS_ATTRIBUTES Sys_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Sys_obj OBJ_;
+ Sys_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7ee3a981 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="Sys")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"Sys"); }
+
+ inline static ::hx::ObjectPtr< Sys_obj > __new() {
+ ::hx::ObjectPtr< Sys_obj > __this = new Sys_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Sys_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Sys_obj *__this = (Sys_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Sys_obj), false, "Sys"));
+ *(void **)__this = Sys_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Sys_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Sys",ed,64,3f,00); }
+
+ static ::String getEnv(::String s);
+ static ::Dynamic getEnv_dyn();
+
+ static ::String getCwd();
+ static ::Dynamic getCwd_dyn();
+
+ static ::String systemName();
+ static ::Dynamic systemName_dyn();
+
+ static Float time();
+ static ::Dynamic time_dyn();
+
+};
+
+
+#endif /* INCLUDED_Sys */
diff --git a/Sources/c_snikket/iinclude/Type.h b/Sources/c_snikket/iinclude/Type.h
new file mode 100644
index 0000000..4c1fe40
--- /dev/null
+++ b/Sources/c_snikket/iinclude/Type.h
@@ -0,0 +1,71 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_Type
+#define INCLUDED_Type
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(Type)
+HX_DECLARE_CLASS0(ValueType)
+
+
+
+class HXCPP_CLASS_ATTRIBUTES Type_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Type_obj OBJ_;
+ Type_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0c3514fe };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="Type")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"Type"); }
+
+ inline static ::hx::ObjectPtr< Type_obj > __new() {
+ ::hx::ObjectPtr< Type_obj > __this = new Type_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Type_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Type_obj *__this = (Type_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Type_obj), false, "Type"));
+ *(void **)__this = Type_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Type_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Type",da,1e,e2,37); }
+
+ static ::hx::Class getClass( ::Dynamic o);
+ static ::Dynamic getClass_dyn();
+
+ static ::String getClassName(::hx::Class c);
+ static ::Dynamic getClassName_dyn();
+
+ static ::Array< ::String > getInstanceFields(::hx::Class c);
+ static ::Dynamic getInstanceFields_dyn();
+
+ static ::ValueType _hx_typeof( ::Dynamic v);
+ static ::Dynamic _hx_typeof_dyn();
+
+ static ::cpp::VirtualArray enumParameters( ::Dynamic e);
+ static ::Dynamic enumParameters_dyn();
+
+};
+
+
+#endif /* INCLUDED_Type */
diff --git a/Sources/c_snikket/iinclude/ValueType.h b/Sources/c_snikket/iinclude/ValueType.h
new file mode 100644
index 0000000..ce988c6
--- /dev/null
+++ b/Sources/c_snikket/iinclude/ValueType.h
@@ -0,0 +1,47 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_ValueType
+#define INCLUDED_ValueType
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(ValueType)
+
+
+class ValueType_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef ValueType_obj OBJ_;
+
+ public:
+ ValueType_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("ValueType",ab,8a,60,3b); }
+ ::String __ToString() const { return HX_("ValueType.",23,cb,18,b9) + _hx_tag; }
+
+ static ::ValueType TBool;
+ static inline ::ValueType TBool_dyn() { return TBool; }
+ static ::ValueType TClass(::hx::Class c);
+ static ::Dynamic TClass_dyn();
+ static ::ValueType TEnum(::hx::Class e);
+ static ::Dynamic TEnum_dyn();
+ static ::ValueType TFloat;
+ static inline ::ValueType TFloat_dyn() { return TFloat; }
+ static ::ValueType TFunction;
+ static inline ::ValueType TFunction_dyn() { return TFunction; }
+ static ::ValueType TInt;
+ static inline ::ValueType TInt_dyn() { return TInt; }
+ static ::ValueType TNull;
+ static inline ::ValueType TNull_dyn() { return TNull; }
+ static ::ValueType TObject;
+ static inline ::ValueType TObject_dyn() { return TObject; }
+ static ::ValueType TUnknown;
+ static inline ::ValueType TUnknown_dyn() { return TUnknown; }
+};
+
+
+#endif /* INCLUDED_ValueType */
diff --git a/Sources/c_snikket/iinclude/Xml.h b/Sources/c_snikket/iinclude/Xml.h
new file mode 100644
index 0000000..2b2f152
--- /dev/null
+++ b/Sources/c_snikket/iinclude/Xml.h
@@ -0,0 +1,114 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_Xml
+#define INCLUDED_Xml
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(Xml)
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+
+
+
+class HXCPP_CLASS_ATTRIBUTES Xml_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Xml_obj OBJ_;
+ Xml_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7ee76a4b };
+
+ void __construct(int nodeType);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="Xml")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"Xml"); }
+ static ::hx::ObjectPtr< Xml_obj > __new(int nodeType);
+ static ::hx::ObjectPtr< Xml_obj > __alloc(::hx::Ctx *_hx_ctx,int nodeType);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Xml_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Xml",b7,25,43,00); }
+
+ static void __boot();
+ static int Element;
+ static int PCData;
+ static int CData;
+ static int Comment;
+ static int DocType;
+ static int ProcessingInstruction;
+ static int Document;
+ static ::Xml parse(::String str);
+ static ::Dynamic parse_dyn();
+
+ static ::Xml createElement(::String name);
+ static ::Dynamic createElement_dyn();
+
+ static ::Xml createPCData(::String data);
+ static ::Dynamic createPCData_dyn();
+
+ static ::Xml createCData(::String data);
+ static ::Dynamic createCData_dyn();
+
+ static ::Xml createComment(::String data);
+ static ::Dynamic createComment_dyn();
+
+ static ::Xml createDocType(::String data);
+ static ::Dynamic createDocType_dyn();
+
+ static ::Xml createProcessingInstruction(::String data);
+ static ::Dynamic createProcessingInstruction_dyn();
+
+ static ::Xml createDocument();
+ static ::Dynamic createDocument_dyn();
+
+ int nodeType;
+ ::String nodeName;
+ ::String nodeValue;
+ ::Xml parent;
+ ::Array< ::Dynamic> children;
+ ::haxe::ds::StringMap attributeMap;
+ ::String get(::String att);
+ ::Dynamic get_dyn();
+
+ void set(::String att,::String value);
+ ::Dynamic set_dyn();
+
+ bool exists(::String att);
+ ::Dynamic exists_dyn();
+
+ ::Dynamic attributes();
+ ::Dynamic attributes_dyn();
+
+ ::Xml firstElement();
+ ::Dynamic firstElement_dyn();
+
+ void addChild( ::Xml x);
+ ::Dynamic addChild_dyn();
+
+ bool removeChild( ::Xml x);
+ ::Dynamic removeChild_dyn();
+
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+};
+
+
+#endif /* INCLUDED_Xml */
diff --git a/Sources/c_snikket/iinclude/_HaxeCBridge/Int64Map_Impl_.h b/Sources/c_snikket/iinclude/_HaxeCBridge/Int64Map_Impl_.h
new file mode 100644
index 0000000..cf001a9
--- /dev/null
+++ b/Sources/c_snikket/iinclude/_HaxeCBridge/Int64Map_Impl_.h
@@ -0,0 +1,62 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED__HaxeCBridge_Int64Map_Impl_
+#define INCLUDED__HaxeCBridge_Int64Map_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(_HaxeCBridge,Int64Map_Impl_)
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,IntMap)
+
+namespace _HaxeCBridge{
+
+
+class HXCPP_CLASS_ATTRIBUTES Int64Map_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Int64Map_Impl__obj OBJ_;
+ Int64Map_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x09ceba9e };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="_HaxeCBridge.Int64Map_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"_HaxeCBridge.Int64Map_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Int64Map_Impl__obj > __new() {
+ ::hx::ObjectPtr< Int64Map_Impl__obj > __this = new Int64Map_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Int64Map_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Int64Map_Impl__obj *__this = (Int64Map_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Int64Map_Impl__obj), false, "_HaxeCBridge.Int64Map_Impl_"));
+ *(void **)__this = Int64Map_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Int64Map_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Int64Map_Impl_",af,5c,92,21); }
+
+ static ::haxe::ds::IntMap _new();
+ static ::Dynamic _new_dyn();
+
+};
+
+} // end namespace _HaxeCBridge
+
+#endif /* INCLUDED__HaxeCBridge_Int64Map_Impl_ */
diff --git a/Sources/c_snikket/iinclude/_HaxeCBridge/Internal.h b/Sources/c_snikket/iinclude/_HaxeCBridge/Internal.h
new file mode 100644
index 0000000..a2a1fae
--- /dev/null
+++ b/Sources/c_snikket/iinclude/_HaxeCBridge/Internal.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED__HaxeCBridge_Internal
+#define INCLUDED__HaxeCBridge_Internal
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(_HaxeCBridge,Internal)
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,IntMap)
+HX_DECLARE_CLASS2(sys,thread,Lock)
+
+namespace _HaxeCBridge{
+
+
+class HXCPP_CLASS_ATTRIBUTES Internal_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Internal_obj OBJ_;
+ Internal_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0f2147a8 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="_HaxeCBridge.Internal")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"_HaxeCBridge.Internal"); }
+
+ inline static ::hx::ObjectPtr< Internal_obj > __new() {
+ ::hx::ObjectPtr< Internal_obj > __this = new Internal_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Internal_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Internal_obj *__this = (Internal_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Internal_obj), false, "_HaxeCBridge.Internal"));
+ *(void **)__this = Internal_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Internal_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Internal",5d,23,28,02); }
+
+ static void __boot();
+ static ::cpp::Function< bool () > isMainThreadCb;
+ static Dynamic isMainThreadCb_dyn() { return isMainThreadCb;}
+ static ::sys::thread::Lock mainThreadWaitLock;
+ static bool mainThreadLoopActive;
+ static bool mainThreadEndIfNoPending;
+ static ::haxe::ds::IntMap gcRetainMap;
+};
+
+} // end namespace _HaxeCBridge
+
+#endif /* INCLUDED__HaxeCBridge_Internal */
diff --git a/Sources/c_snikket/iinclude/_UnicodeString/UnicodeString_Impl_.h b/Sources/c_snikket/iinclude/_UnicodeString/UnicodeString_Impl_.h
new file mode 100644
index 0000000..eb2190b
--- /dev/null
+++ b/Sources/c_snikket/iinclude/_UnicodeString/UnicodeString_Impl_.h
@@ -0,0 +1,66 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED__UnicodeString_UnicodeString_Impl_
+#define INCLUDED__UnicodeString_UnicodeString_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(_UnicodeString,UnicodeString_Impl_)
+
+namespace _UnicodeString{
+
+
+class HXCPP_CLASS_ATTRIBUTES UnicodeString_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef UnicodeString_Impl__obj OBJ_;
+ UnicodeString_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x699a1cff };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="_UnicodeString.UnicodeString_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"_UnicodeString.UnicodeString_Impl_"); }
+
+ inline static ::hx::ObjectPtr< UnicodeString_Impl__obj > __new() {
+ ::hx::ObjectPtr< UnicodeString_Impl__obj > __this = new UnicodeString_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< UnicodeString_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ UnicodeString_Impl__obj *__this = (UnicodeString_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(UnicodeString_Impl__obj), false, "_UnicodeString.UnicodeString_Impl_"));
+ *(void **)__this = UnicodeString_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~UnicodeString_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("UnicodeString_Impl_",ce,64,09,f3); }
+
+ static ::String charAt(::String this1,int index);
+ static ::Dynamic charAt_dyn();
+
+ static ::String substr(::String this1,int pos, ::Dynamic len);
+ static ::Dynamic substr_dyn();
+
+ static int get_length(::String this1);
+ static ::Dynamic get_length_dyn();
+
+};
+
+} // end namespace _UnicodeString
+
+#endif /* INCLUDED__UnicodeString_UnicodeString_Impl_ */
diff --git a/Sources/c_snikket/iinclude/_Xml/XmlType_Impl_.h b/Sources/c_snikket/iinclude/_Xml/XmlType_Impl_.h
new file mode 100644
index 0000000..43c8ecc
--- /dev/null
+++ b/Sources/c_snikket/iinclude/_Xml/XmlType_Impl_.h
@@ -0,0 +1,60 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED__Xml_XmlType_Impl_
+#define INCLUDED__Xml_XmlType_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(_Xml,XmlType_Impl_)
+
+namespace _Xml{
+
+
+class HXCPP_CLASS_ATTRIBUTES XmlType_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef XmlType_Impl__obj OBJ_;
+ XmlType_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x29df0a39 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="_Xml.XmlType_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"_Xml.XmlType_Impl_"); }
+
+ inline static ::hx::ObjectPtr< XmlType_Impl__obj > __new() {
+ ::hx::ObjectPtr< XmlType_Impl__obj > __this = new XmlType_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< XmlType_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ XmlType_Impl__obj *__this = (XmlType_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(XmlType_Impl__obj), false, "_Xml.XmlType_Impl_"));
+ *(void **)__this = XmlType_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~XmlType_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("XmlType_Impl_",71,0b,9f,dd); }
+
+ static ::String toString(int this1);
+ static ::Dynamic toString_dyn();
+
+};
+
+} // end namespace _Xml
+
+#endif /* INCLUDED__Xml_XmlType_Impl_ */
diff --git a/Sources/c_snikket/iinclude/cpp/CppInt32__.h b/Sources/c_snikket/iinclude/cpp/CppInt32__.h
new file mode 100644
index 0000000..bd856c0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/cpp/CppInt32__.h
@@ -0,0 +1,92 @@
+#ifndef INCLUDED_haxe_CppInt32__
+#define INCLUDED_haxe_CppInt32__
+
+#include <hxcpp.h>
+
+namespace cpp
+{
+
+#define HX_I32_DEF_FUNC1(Name) \
+ static inline Dynamic __##Name(const Dynamic &a) { return Name(a); } \
+ static inline Dynamic Name##_dyn() { return hx::CreateStaticFunction1(#Name,&CppInt32__::__##Name); }
+
+#define HX_I32_DEF_FUNC2(Name) \
+ static inline Dynamic __##Name(const Dynamic &a, const Dynamic &b) { return Name(a,b); } \
+ static inline Dynamic Name##_dyn() { return hx::CreateStaticFunction2(#Name,&CppInt32__::__##Name); }
+
+class CppInt32__
+{
+public:
+ CppInt32__(int inX=0) : mValue(inX) { }
+ CppInt32__(const null &inNull) : mValue(0) { }
+ CppInt32__(const Dynamic &inD);
+ operator int() const { return mValue; }
+ template<typename T>
+ inline CppInt32__ &operator=(T inValue) { mValue = inValue; return *this; }
+
+ static inline CppInt32__ make(int a,int b) { return CppInt32__( (a<<16) | b ); }
+ static inline CppInt32__ ofInt(int a) { return CppInt32__( a ); }
+ static inline int toInt(CppInt32__ a) { __hxcpp_check_overflow(a); return a.mValue; }
+ static inline int toNativeInt(CppInt32__ a) { return a.mValue; }
+ static inline CppInt32__ add(CppInt32__ a,CppInt32__ b) { return CppInt32__( a.mValue + b.mValue ); }
+ static inline CppInt32__ sub(CppInt32__ a,CppInt32__ b) { return CppInt32__( a.mValue - b.mValue ); }
+ static inline CppInt32__ mul(CppInt32__ a,CppInt32__ b) { return CppInt32__( a.mValue * b.mValue ); }
+ static inline CppInt32__ div(CppInt32__ a,CppInt32__ b) { return CppInt32__( a.mValue / b.mValue ); }
+ static inline CppInt32__ mod(CppInt32__ a,CppInt32__ b) { return CppInt32__( a.mValue % b.mValue ); }
+ static inline CppInt32__ shl(CppInt32__ a,int b) { return CppInt32__( a.mValue << (b&31) ); }
+ static inline CppInt32__ shr(CppInt32__ a,int b) { return CppInt32__( a.mValue >> (b&31) ); }
+ static inline CppInt32__ ushr(CppInt32__ a,int b) { return CppInt32__( ((unsigned int)a.mValue) >> (b&31) ); }
+ static inline CppInt32__ _and(CppInt32__ a,CppInt32__ b) { return CppInt32__( a.mValue & b.mValue ); }
+ static inline CppInt32__ _or(CppInt32__ a,CppInt32__ b) { return CppInt32__( a.mValue | b.mValue ); }
+ static inline CppInt32__ _xor(CppInt32__ a,CppInt32__ b) { return CppInt32__( a.mValue ^ b.mValue ); }
+ static inline CppInt32__ neg(CppInt32__ a) { return CppInt32__( -a.mValue ); }
+ static inline CppInt32__ complement(CppInt32__ a) { return CppInt32__( ~a.mValue ); }
+ static inline int compare(CppInt32__ a,CppInt32__ b) { return ( a.mValue - b.mValue ); }
+ static inline bool isNeg(CppInt32__ a) { return a.mValue < 0; }
+ static inline bool isZero(CppInt32__ a) { return a.mValue == 0; }
+ static inline int ucompare(CppInt32__ a,CppInt32__ b) { unsigned int am = a.mValue, bm = b.mValue; return (am == bm) ? 0 : ((am > bm) ? 1 : -1); }
+
+
+ inline bool operator==(const CppInt32__ &inRHS) const { return mValue == inRHS.mValue; }
+
+ inline int operator-(CppInt32__ b) { return mValue - b.mValue; }
+ inline int operator+(CppInt32__ b) { return mValue + b.mValue; }
+ inline int operator*(CppInt32__ b) { return mValue * b.mValue; }
+ inline int operator/(CppInt32__ b) { return mValue / b.mValue; }
+ inline int operator%(CppInt32__ b) { return mValue % b.mValue; }
+
+ HX_I32_DEF_FUNC2(make)
+ HX_I32_DEF_FUNC1(ofInt)
+ HX_I32_DEF_FUNC1(toInt)
+ HX_I32_DEF_FUNC1(toNativeInt)
+ HX_I32_DEF_FUNC2(add)
+ HX_I32_DEF_FUNC2(sub)
+ HX_I32_DEF_FUNC2(mul)
+ HX_I32_DEF_FUNC2(div)
+ HX_I32_DEF_FUNC2(mod)
+ HX_I32_DEF_FUNC2(shl)
+ HX_I32_DEF_FUNC2(shr)
+ HX_I32_DEF_FUNC2(ushr)
+ HX_I32_DEF_FUNC2(_and)
+ HX_I32_DEF_FUNC2(_or)
+ HX_I32_DEF_FUNC2(_xor)
+ HX_I32_DEF_FUNC1(neg)
+ HX_I32_DEF_FUNC1(complement)
+ HX_I32_DEF_FUNC2(compare)
+ HX_I32_DEF_FUNC2(ucompare)
+ HX_I32_DEF_FUNC1(isNeg)
+ HX_I32_DEF_FUNC1(isZero)
+
+ int mValue;
+};
+
+typedef CppInt32__ CppInt32___obj;
+}
+
+
+
+
+
+#endif
+
+
diff --git a/Sources/c_snikket/iinclude/cpp/FastIterator.h b/Sources/c_snikket/iinclude/cpp/FastIterator.h
new file mode 100644
index 0000000..37bcf66
--- /dev/null
+++ b/Sources/c_snikket/iinclude/cpp/FastIterator.h
@@ -0,0 +1,108 @@
+#ifndef INCLUDED_cpp_FastIterator
+#define INCLUDED_cpp_FastIterator
+
+namespace cpp
+{
+
+class HXCPP_EXTERN_CLASS_ATTRIBUTES IteratorBase : public hx::Object
+{
+public:
+ hx::Val __Field(const String &inString ,hx::PropertyAccess inCallProp);
+ virtual bool hasNext() = 0;
+ virtual Dynamic _dynamicNext() = 0;
+
+ Dynamic hasNext_dyn( );
+ Dynamic next_dyn( );
+ Dynamic _dynamicNext_dyn( );
+};
+
+
+template<typename T>
+class HXCPP_EXTERN_CLASS_ATTRIBUTES FastIterator_obj : public IteratorBase
+{
+public:
+ virtual bool hasNext() = 0;
+ virtual T next() = 0;
+
+ virtual Dynamic _dynamicNext() { return next(); }
+};
+
+
+
+template<typename T>
+class HXCPP_EXTERN_CLASS_ATTRIBUTES DynamicIterator : public FastIterator_obj<T>
+{
+public:
+ Dynamic mNext;
+ Dynamic mHasNext;
+
+ DynamicIterator(Dynamic inValue)
+ {
+ mNext = inValue->__Field(HX_CSTRING("next"), HX_PROP_ALWAYS);
+ mHasNext = inValue->__Field(HX_CSTRING("hasNext"), HX_PROP_ALWAYS);
+ }
+
+ bool hasNext() { return mHasNext(); }
+ T next() { return mNext(); }
+
+ void __Mark(hx::MarkContext *__inCtx)
+ {
+ HX_MARK_MEMBER_NAME(mNext,"mNext");
+ HX_MARK_MEMBER_NAME(mHasNext,"mHasNext");
+ }
+
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx)
+ {
+ HX_VISIT_MEMBER_NAME(mNext,"mNext");
+ HX_VISIT_MEMBER_NAME(mHasNext,"mHasNext");
+ }
+ #endif
+
+};
+
+
+template<typename T>
+FastIterator_obj<T> *CreateFastIterator(Dynamic inValue)
+{
+ FastIterator_obj<T> *result = dynamic_cast< FastIterator_obj<T> *>(inValue.GetPtr());
+ if (result) return result;
+ return new DynamicIterator<T>(inValue);
+}
+
+template<typename T>
+class HXCPP_EXTERN_CLASS_ATTRIBUTES StringIterator : public cpp::FastIterator_obj<T>
+{
+public:
+ String value;
+ int pos;
+
+ StringIterator(const String &inValue) : value(inValue), pos(0) { }
+
+ bool hasNext() { return pos<value.length; }
+ void __Mark(hx::MarkContext *__inCtx)
+ {
+ cpp::FastIterator_obj<T>::__Mark(__inCtx);
+ HX_MARK_MEMBER_NAME(value,"value");
+ }
+
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx)
+ {
+ cpp::FastIterator_obj<T>::__Visit(__inCtx);
+ HX_VISIT_MEMBER_NAME(value,"value");
+ }
+ #endif
+};
+
+}
+
+
+
+
+
+
+
+
+
+#endif
diff --git a/Sources/c_snikket/iinclude/cpp/Int64.h b/Sources/c_snikket/iinclude/cpp/Int64.h
new file mode 100644
index 0000000..e8b60db
--- /dev/null
+++ b/Sources/c_snikket/iinclude/cpp/Int64.h
@@ -0,0 +1,148 @@
+#ifndef CPP_INT64_INCLUDED
+#define CPP_INT64_INCLUDED
+
+namespace cpp
+{
+
+class Int64Handler
+{
+ public:
+ static inline const char *getName() { return "cpp.Int64"; }
+ static inline String toString( const void *inValue ) { return String( *(Int64 *)inValue ); }
+ static inline void handler(DynamicHandlerOp op, void *ioValue,int inSize, void *outResult)
+ {
+ if (op==dhoToString)
+ *(String *)outResult = toString(ioValue);
+ else if (op==dhoGetClassName)
+ *(const char **)outResult = getName();
+ else if (op==dhoFromDynamic)
+ {
+ StructHandlerDynamicParams *params = (StructHandlerDynamicParams *)outResult;
+ cpp::Int64 &value = *(cpp::Int64 *)ioValue;
+ params->outProcessed = true;
+ if (!params->inData)
+ value = 0;
+ else
+ value = params->inData->__ToInt64();
+ }
+ else if (op==dhoToDynamic)
+ {
+ Dynamic value = *(cpp::Int64 *)ioValue;
+ *(hx::Object **)outResult = value.mPtr;
+ }
+ else if (op==dhoIs)
+ {
+ StructHandlerDynamicParams *params = (StructHandlerDynamicParams *)outResult;
+ hx::Object *obj = params->inData;
+ int type = obj->__GetType();
+ params->outProcessed = type==vtInt || type==vtInt64;
+ }
+ else
+ return DefaultStructHandler::handler(op,ioValue,inSize, outResult);
+ }
+};
+
+typedef Struct<Int64,Int64Handler> Int64Struct;
+
+
+}
+
+#if (HXCPP_API_LEVEL >= 420)
+
+inline cpp::Int64 _hx_int64_make(int a, int b) { return (((cpp::Int64)(unsigned int)a)<<32) | (unsigned int)b; }
+inline bool _hx_int64_is_neg(cpp::Int64 a) { return a<0; }
+inline bool _hx_int64_is_zero(cpp::Int64 a) { return a==0; }
+inline bool _hx_int64_eq(cpp::Int64 a, cpp::Int64 b) { return a==b; }
+inline bool _hx_int64_neq(cpp::Int64 a, cpp::Int64 b) { return a!=b; }
+inline int _hx_int64_compare(cpp::Int64 a, cpp::Int64 b)
+{
+ return a==b ? 0 : a<b ? -1 : 1;
+}
+inline int _hx_int64_ucompare(cpp::Int64 a, cpp::Int64 b)
+{
+ return a==b ? 0 : ( ::cpp::UInt64)a<( ::cpp::UInt64)b ? -1 : 1;
+}
+inline String _hx_int64_to_string(cpp::Int64 a) { return a; }
+
+inline cpp::Int64 _hx_int64_neg(cpp::Int64 a) { return -a; }
+inline cpp::Int64 _hx_int64_complement(cpp::Int64 a) { return ~a; }
+
+inline cpp::Int64 _hx_int64_pre_increment(cpp::Int64 &ioVal) {
+ return ++ioVal;
+}
+inline cpp::Int64 _hx_int64_post_increment(cpp::Int64 &ioVal) {
+ return ioVal++;
+}
+inline cpp::Int64 _hx_int64_pre_decrement(cpp::Int64 &ioVal) {
+ return --ioVal;
+}
+inline cpp::Int64 _hx_int64_post_decrement(cpp::Int64 &ioVal) {
+ return ioVal--;
+}
+
+inline cpp::Int64 _hx_int64_sub(cpp::Int64 a, cpp::Int64 b) { return a-b; }
+inline cpp::Int64 _hx_int64_add(cpp::Int64 a, cpp::Int64 b) { return a+b; }
+inline cpp::Int64 _hx_int64_mul(cpp::Int64 a, cpp::Int64 b) { return a*b; }
+inline cpp::Int64 _hx_int64_div(cpp::Int64 a, cpp::Int64 b) { return a/b; }
+inline cpp::Int64 _hx_int64_mod(cpp::Int64 a, cpp::Int64 b) { return a%b; }
+inline cpp::Int64 _hx_int64_and(cpp::Int64 a, cpp::Int64 b) { return a&b; }
+inline cpp::Int64 _hx_int64_or(cpp::Int64 a, cpp::Int64 b) { return a|b; }
+inline cpp::Int64 _hx_int64_xor(cpp::Int64 a, cpp::Int64 b) { return a^b; }
+inline cpp::Int64 _hx_int64_shl(cpp::Int64 a, int b) { return a<<(b&63); }
+inline cpp::Int64 _hx_int64_shr(cpp::Int64 a, int b) { return a>>(b&63); }
+inline cpp::Int64 _hx_int64_ushr(cpp::Int64 a, int b) { return ((cpp::UInt64)a)>>(b&63); }
+inline int _hx_int64_high(cpp::Int64 a) { return (int)( a >> 32 ); }
+inline int _hx_int64_low(cpp::Int64 a) { return (int)( a & 0xffffffff ); }
+
+#else
+
+inline cpp::Int64Struct _hx_int64_make(int a, int b) { return (((cpp::Int64)(unsigned int)a)<<32) | (unsigned int)b; }
+inline bool _hx_int64_is_neg(cpp::Int64 a) { return a<0; }
+inline bool _hx_int64_is_zero(cpp::Int64 a) { return a==0; }
+inline bool _hx_int64_eq(cpp::Int64 a, cpp::Int64 b) { return a==b; }
+inline bool _hx_int64_neq(cpp::Int64 a, cpp::Int64 b) { return a!=b; }
+inline int _hx_int64_compare(cpp::Int64 a, cpp::Int64 b)
+{
+ return a==b ? 0 : a<b ? -1 : 1;
+}
+inline int _hx_int64_ucompare(cpp::Int64 a, cpp::Int64 b)
+{
+ return a==b ? 0 : ( ::cpp::UInt64)a<( ::cpp::UInt64)b ? -1 : 1;
+}
+inline String _hx_int64_to_string(cpp::Int64Struct a) { return a; }
+
+inline cpp::Int64Struct _hx_int64_neg(cpp::Int64 a) { return -a; }
+inline cpp::Int64Struct _hx_int64_complement(cpp::Int64 a) { return ~a; }
+
+inline cpp::Int64Struct _hx_int64_pre_increment(cpp::Int64Struct &ioVal) {
+ return ++ioVal.get();
+}
+inline cpp::Int64Struct _hx_int64_post_increment(cpp::Int64Struct &ioVal) {
+ return ioVal.get()++;
+}
+inline cpp::Int64Struct _hx_int64_pre_decrement(cpp::Int64Struct &ioVal) {
+ return --ioVal.get();
+}
+inline cpp::Int64Struct _hx_int64_post_decrement(cpp::Int64Struct &ioVal) {
+ return ioVal.get()--;
+}
+
+inline cpp::Int64Struct _hx_int64_sub(cpp::Int64 a, cpp::Int64 b) { return a-b; }
+inline cpp::Int64Struct _hx_int64_add(cpp::Int64 a, cpp::Int64 b) { return a+b; }
+inline cpp::Int64Struct _hx_int64_mul(cpp::Int64 a, cpp::Int64 b) { return a*b; }
+inline cpp::Int64Struct _hx_int64_div(cpp::Int64 a, cpp::Int64 b) { return a/b; }
+inline cpp::Int64Struct _hx_int64_mod(cpp::Int64 a, cpp::Int64 b) { return a%b; }
+inline cpp::Int64Struct _hx_int64_and(cpp::Int64 a, cpp::Int64 b) { return a&b; }
+inline cpp::Int64Struct _hx_int64_or(cpp::Int64 a, cpp::Int64 b) { return a|b; }
+inline cpp::Int64Struct _hx_int64_xor(cpp::Int64 a, cpp::Int64 b) { return a^b; }
+inline cpp::Int64Struct _hx_int64_shl(cpp::Int64 a, int b) { return a<<(b&63); }
+inline cpp::Int64Struct _hx_int64_shr(cpp::Int64 a, int b) { return a>>(b&63); }
+inline cpp::Int64Struct _hx_int64_ushr(cpp::Int64 a, int b) { return ((cpp::UInt64)a)>>(b&63); }
+inline int _hx_int64_high(cpp::Int64Struct a) { return (int)( a.get() >>32 ); }
+inline int _hx_int64_low(cpp::Int64Struct a) { return (int)( a.get() & 0xffffffff ); }
+
+#endif
+
+
+
+#endif
diff --git a/Sources/c_snikket/iinclude/cpp/Lib.h b/Sources/c_snikket/iinclude/cpp/Lib.h
new file mode 100644
index 0000000..38d98b7
--- /dev/null
+++ b/Sources/c_snikket/iinclude/cpp/Lib.h
@@ -0,0 +1,56 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_cpp_Lib
+#define INCLUDED_cpp_Lib
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(cpp,Lib)
+
+namespace cpp{
+
+
+class HXCPP_CLASS_ATTRIBUTES Lib_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Lib_obj OBJ_;
+ Lib_obj();
+
+ public:
+ enum { _hx_ClassId = 0x561f6486 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="cpp.Lib")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"cpp.Lib"); }
+
+ inline static ::hx::ObjectPtr< Lib_obj > __new() {
+ ::hx::ObjectPtr< Lib_obj > __this = new Lib_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Lib_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Lib_obj *__this = (Lib_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Lib_obj), false, "cpp.Lib"));
+ *(void **)__this = Lib_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Lib_obj();
+
+ HX_DO_RTTI_ALL;
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Lib",25,07,3a,00); }
+
+};
+
+} // end namespace cpp
+
+#endif /* INCLUDED_cpp_Lib */
diff --git a/Sources/c_snikket/iinclude/cpp/Pointer.h b/Sources/c_snikket/iinclude/cpp/Pointer.h
new file mode 100644
index 0000000..25c28b4
--- /dev/null
+++ b/Sources/c_snikket/iinclude/cpp/Pointer.h
@@ -0,0 +1,558 @@
+#ifndef CPP_POINTER_H
+#define CPP_POINTER_H
+
+namespace cpp
+{
+
+struct AutoCast
+{
+ void *value;
+
+ explicit inline AutoCast(void *inValue) : value(inValue) { }
+};
+
+
+struct RawAutoCast
+{
+ void *value;
+
+ explicit inline RawAutoCast(void *inValue) : value(inValue) { }
+
+ template<typename T>
+ operator T*() const { return (T*)value; }
+};
+
+
+Dynamic CreateDynamicPointer(void *inValue);
+
+enum DynamicHandlerOp
+{
+ dhoGetClassName,
+ dhoToString,
+ dhoFromDynamic,
+ dhoToDynamic,
+ dhoIs,
+};
+typedef void (*DynamicHandlerFunc)(DynamicHandlerOp op, void *ioValue, int inSize, void *outResult);
+Dynamic CreateDynamicStruct(const void *inValue, int inSize, DynamicHandlerFunc inFunc);
+
+template<typename T> class Reference;
+
+
+
+struct StructHandlerDynamicParams
+{
+ StructHandlerDynamicParams(hx::Object *data,const char *inName) :
+ outProcessed(false), inName(inName), inData(data) { }
+ bool outProcessed;
+ hx::Object *inData;
+ const char *inName;
+};
+
+
+class DefaultStructHandler
+{
+ public:
+ static inline const char *getName() { return "unknown"; }
+ static inline String toString( const void *inValue ) { return HX_CSTRING("Struct"); }
+ static inline void handler(DynamicHandlerOp op, void *ioValue, int inSize, void *outResult)
+ {
+ if (op==dhoToString)
+ *(String *)outResult = toString(ioValue);
+ else if (op==dhoGetClassName)
+ *(const char **)outResult = getName();
+ else if (op==dhoToDynamic)
+ {
+ // Handle outsize..
+ *(hx::Object **)outResult = 0;
+ }
+ else if (op==dhoFromDynamic)
+ {
+ StructHandlerDynamicParams *params = (StructHandlerDynamicParams *)outResult;
+ hx::Object *ptr= params->inData;
+ void *data = (void *)ptr->__GetHandle();
+ int len = ptr->__length();
+ if (data && len>=inSize && ptr->__CStr()==params->inName)
+ {
+ memcpy(ioValue,data,inSize);
+ params->outProcessed = true;
+ }
+ }
+ else if (op==dhoIs)
+ {
+ StructHandlerDynamicParams *params = (StructHandlerDynamicParams *)outResult;
+ hx::Object *ptr= params->inData;
+ void *data = (void *)ptr->__GetHandle();
+ int len = ptr->__length();
+ params->outProcessed = data && len>=inSize && ptr->__CStr()==params->inName;
+ }
+ }
+};
+
+
+class EnumHandler
+{
+ public:
+ static inline const char *getName() { return "enum"; }
+ static inline String toString( const void *inValue ) {
+ int val = inValue ? *(int *)inValue : 0;
+ return HX_CSTRING("enum(") + String(val) + HX_CSTRING(")");
+ }
+
+ static inline void handler(DynamicHandlerOp op, void *ioValue, int inSize, void *outResult)
+ {
+ if (op==dhoToString)
+ *(String *)outResult = toString(ioValue);
+ else if (op==dhoGetClassName)
+ *(const char **)outResult = getName();
+ else if (op==dhoFromDynamic)
+ {
+ StructHandlerDynamicParams *params = (StructHandlerDynamicParams *)outResult;
+ if (params->inData->__GetType()==vtInt)
+ {
+ *(int *)ioValue = params->inData->__ToInt();
+ params->outProcessed = true;
+ }
+ else
+ DefaultStructHandler::handler(op,ioValue, inSize, outResult);
+ }
+ else
+ DefaultStructHandler::handler(op,ioValue, inSize, outResult);
+ }
+};
+
+
+
+template<typename T, typename HANDLER = DefaultStructHandler >
+class Struct
+{
+public:
+ T value;
+ // This allows 'StaticCast' to be used from arrays
+ typedef Dynamic Ptr;
+
+ inline Struct( ) { }
+ inline Struct( const T &inRHS ) : value(inRHS) { }
+ inline Struct( const null &) { value = T(); }
+ inline Struct( const Reference<T> &);
+ inline Struct( const Dynamic &inRHS) { fromDynamic(inRHS.mPtr); }
+
+ inline Struct<T,HANDLER> &operator=( const T &inRHS ) { value = inRHS; return *this; }
+ inline Struct<T,HANDLER> &operator=( const null & ) { value = T(); return *this; }
+ inline Struct<T,HANDLER> &operator=( const Dynamic &inRHS ) { return *this = Struct<T,HANDLER>(inRHS); }
+
+ operator Dynamic() const
+ {
+ hx::Object *result = 0;
+ HANDLER::handler(dhoToDynamic, (void *)&value, sizeof(T), &result );
+ if (result)
+ return result;
+ return CreateDynamicStruct( &value, sizeof(T), HANDLER::handler);
+ }
+ operator String() const { return HANDLER::toString(&value); }
+
+ inline Struct( const hx::Val &inRHS) { fromDynamic(inRHS.asObject()); }
+ operator hx::Val() const { return operator Dynamic(); }
+
+ bool operator==(const Struct<T,HANDLER> &inRHS) const { return value==inRHS.value; }
+ bool operator==(const null &inRHS) const { return false; }
+ bool operator!=(const null &inRHS) const { return true; }
+
+ // Haxe uses -> notation
+ inline T *operator->() { return &value; }
+
+ T &get() { return value; }
+
+ static inline bool is( const Dynamic &inRHS)
+ {
+ hx::Object *ptr = inRHS.mPtr;
+ if (!ptr)
+ return false;
+ StructHandlerDynamicParams convert(ptr, ptr->__CStr());
+ HANDLER::handler(dhoIs, 0, sizeof(T), &convert );
+ return convert.outProcessed;
+ }
+
+
+ inline void fromDynamic( hx::Object *ptr)
+ {
+ if (!ptr)
+ {
+ value = T();
+ return;
+ }
+ StructHandlerDynamicParams convert(ptr, ptr->__CStr());
+ HANDLER::handler(dhoFromDynamic, &value, sizeof(T), &convert );
+ if (!convert.outProcessed)
+ {
+ hx::NullReference("DynamicData", true);
+ return;
+ }
+ }
+
+ inline operator T& () { return value; }
+};
+
+
+
+
+template<typename T>
+class Pointer
+{
+public:
+ typedef T elementType;
+
+ T *ptr;
+
+ inline Pointer( ) : ptr(0) { }
+ inline Pointer( const Pointer &inRHS ) : ptr(inRHS.ptr) { }
+ inline Pointer( const Dynamic &inRHS) { ptr = inRHS==null()?0: (T*)inRHS->__GetHandle(); }
+ inline Pointer( const null &inRHS ) : ptr(0) { }
+ inline Pointer( const cpp::Variant &inVariant ) {
+ hx::Object *obj = inVariant.asObject();
+ ptr = obj ? (T*)inVariant.valObject->__GetHandle() : 0;
+ }
+
+ template<typename O>
+ inline Pointer( const O *inValue ) : ptr( (T*) inValue) { }
+ //inline Pointer( T *inValue ) : ptr(inValue) { }
+ inline Pointer( AutoCast inValue ) : ptr( (T*)inValue.value) { }
+
+ template<typename H>
+ inline Pointer( const Struct<T,H> &structVal ) : ptr( &structVal.value ) { }
+
+ template<typename O>
+ inline void setRaw(const O *inValue ) { ptr = (T*) inValue; }
+
+
+ inline Pointer operator=( const Pointer &inRHS ) { return ptr = inRHS.ptr; }
+ inline Dynamic operator=( Dynamic &inValue )
+ {
+ ptr = inValue==null() ? 0 : (T*) inValue->__GetHandle();
+ return inValue;
+ }
+ inline Dynamic operator=( null &inValue ) { ptr=0; return inValue; }
+
+ template<typename O>
+ inline Pointer operator=( const Pointer<O> &inValue ) { ptr = (T*) inValue.ptr; return *this; }
+
+ template<typename O>
+ inline Pointer operator=( const O *inValue ) { ptr = (T*) inValue; return *this; }
+
+ template<typename H>
+ inline Pointer operator=( const Struct<T,H> &structVal ) { ptr = &structVal.value; return *this; }
+
+
+
+ inline AutoCast reinterpret() { return AutoCast(ptr); }
+ inline RawAutoCast rawCast() { return RawAutoCast(ptr); }
+
+ inline bool operator==( const null &inValue ) const { return ptr==0; }
+ inline bool operator!=( const null &inValue ) const { return ptr!=0; }
+
+ // Allow '->' syntax
+ inline Pointer *operator->() { return this; }
+ inline Pointer inc() { return ++ptr; }
+ inline Pointer dec() { return --ptr; }
+ inline Pointer add(int inInt) { return ptr+inInt; }
+ inline Pointer sub(int inInt) { return ptr-inInt; }
+ inline Pointer incBy(int inDiff) { ptr+=inDiff; return ptr; }
+ inline Pointer decBy(int inDiff) { ptr-=inDiff; return ptr; }
+ inline T &postIncRef() { return *ptr++; }
+ inline T &postIncVal() { return *ptr++; }
+
+ inline T &at(int inIndex) { return ptr[inIndex]; }
+ inline void setAt(int inIndex, const T &test) { ptr[inIndex] = test; }
+
+ inline T &__get(int inIndex) { return ptr[inIndex]; }
+ inline T &__set(int inIndex, const T &inValue) { T *p = ptr+inIndex; *p = inValue; return *p; }
+
+ inline T &get_value() { return *ptr; }
+ inline T &get_ref() { return *ptr; }
+ inline T &set_ref(const T &inValue) { return *ptr = inValue; }
+
+ operator Dynamic () const { return CreateDynamicPointer((void *)ptr); }
+ operator cpp::Variant () const { return CreateDynamicPointer((void *)ptr); }
+
+ operator T * () { return ptr; }
+ T * get_raw() { return ptr; }
+ const T * get_constRaw() { return ptr; }
+
+ inline void destroy() { delete ptr; }
+ inline void destroyArray() { delete [] ptr; }
+
+ inline bool lt(Pointer inOther) { return ptr < inOther.ptr; }
+ inline bool gt(Pointer inOther) { return ptr > inOther.ptr; }
+ inline bool leq(Pointer inOther) { return ptr <= inOther.ptr; }
+ inline bool geq(Pointer inOther) { return ptr >= inOther.ptr; }
+
+};
+
+
+
+
+
+template<>
+class Pointer<void>
+{
+public:
+ enum { elementSize = 0 };
+
+ void *ptr;
+
+ inline Pointer( ) : ptr(0) { }
+ inline Pointer( const Pointer &inRHS ) : ptr(inRHS.ptr) { }
+ inline Pointer( const Dynamic &inRHS) { ptr = inRHS==null()?0: (void*)inRHS->__GetHandle(); }
+ inline Pointer( const null &inRHS ) : ptr(0) { }
+
+ template<typename O>
+ inline Pointer( const O *inValue ) : ptr( (void*) inValue) { }
+ //inline Pointer( T *inValue ) : ptr(inValue) { }
+ inline Pointer( AutoCast inValue ) : ptr( (void*)inValue.value) { }
+
+ inline Pointer operator=( const Pointer &inRHS ) { return ptr = inRHS.ptr; }
+ inline Dynamic operator=( Dynamic &inValue )
+ {
+ ptr = inValue==null() ? 0 : (void*) inValue->__GetHandle();
+ return inValue;
+ }
+ inline Dynamic operator=( null &inValue ) { ptr=0; return inValue; }
+ inline AutoCast reinterpret() { return AutoCast(ptr); }
+ inline RawAutoCast rawCast() { return RawAutoCast(ptr); }
+
+ inline bool operator==( const null &inValue ) const { return ptr==0; }
+ inline bool operator!=( const null &inValue ) const { return ptr!=0; }
+
+ // Allow '->' syntax
+ inline Pointer *operator->() { return this; }
+ inline Pointer inc() { return ptr; }
+ inline Pointer dec() { return ptr; }
+ inline Pointer add(int inInt) { return ptr; }
+ inline Pointer sub(int inInt) { return ptr; }
+ inline Pointer incBy(int inDiff) { return ptr; }
+ inline Pointer decBy(int inDiff) { return ptr; }
+ inline void postIncRef() { }
+ inline void postIncVal() { }
+
+ inline void at(int inIndex) { }
+
+ inline void __get(int inIndex) { }
+
+ template<typename O>
+ inline void __set(int inIndex, O inValue) { }
+
+ inline void get_value() { }
+ inline void get_ref() { }
+ template<typename O> inline void set_ref(O val) { }
+
+ operator Dynamic () const { return CreateDynamicPointer(ptr); }
+ //operator hx::Val () const { return CreateDynamicPointer((void *)ptr); }
+ operator void * () { return ptr; }
+ void * get_raw() { return ptr; }
+ const void * get_constRaw() { return ptr; }
+
+ inline void destroy() { }
+ inline void destroyArray() { }
+
+ inline bool lt(Pointer inOther) { return ptr < inOther.ptr; }
+ inline bool gt(Pointer inOther) { return ptr > inOther.ptr; }
+ inline bool leq(Pointer inOther) { return ptr <= inOther.ptr; }
+ inline bool geq(Pointer inOther) { return ptr >= inOther.ptr; }
+
+};
+
+
+
+
+template<typename T>
+inline bool operator == (const null &, Pointer<T> inPtr) { return inPtr.ptr==0; }
+template<typename T>
+inline bool operator != (const null &, Pointer<T> inPtr) { return inPtr.ptr!=0; }
+
+
+
+template<typename T>
+class Reference : public Pointer<T>
+{
+public:
+ using Pointer<T>::ptr;
+
+
+ inline Reference( const T &inRHS ) : Pointer<T>(&inRHS) { }
+ inline Reference( T &inRHS ) : Pointer<T>(&inRHS) { }
+
+ inline Reference( ) : Pointer<T>((T*)0) { }
+ inline Reference( const Reference &inRHS ) : Pointer<T>(inRHS.ptr) { }
+ inline Reference( const Dynamic &inRHS) { ptr = inRHS==null()?0: (T*)inRHS->__GetHandle(); }
+ inline Reference( const null &inRHS ) : Pointer<T>((T*)0) { }
+ inline Reference( const T *inValue ) : Pointer<T>( (T*) inValue) { }
+ //inline Reference( T *inValue ) : Pointer(inValue) { }
+ inline Reference( AutoCast inValue ) : Pointer<T>( (T*)inValue.value) { }
+
+ template<typename OTHER>
+ inline Reference( const Reference<OTHER> &inOther )
+ {
+ // Allow reinterpret or not?
+ ptr = (T*)inOther.ptr;
+ }
+
+ template<typename H>
+ inline Reference( const Struct<T,H> &structVal ) : Pointer<T>( &structVal.value ) { }
+
+ inline Reference operator=( const Reference &inRHS ) { return ptr = inRHS.ptr; }
+
+
+ inline T *operator->() const { return ptr; }
+
+ inline operator T &() { return *ptr; }
+
+};
+
+template<typename T,typename H>
+Struct<T,H>::Struct( const Reference<T> &ref ) : value(*ref.ptr) { };
+
+
+
+template<typename T>
+class Function
+{
+public:
+ T *call;
+
+ inline Function( ) { }
+ inline Function( const Function &inRHS ) : call(inRHS.call) { }
+ inline Function( const Dynamic &inRHS) { call = inRHS==null()?0: (T*)inRHS->__GetHandle(); }
+ inline Function( const null &inRHS ) { call = 0; }
+ inline Function( T *inValue ) : call((T*)(inValue)) { }
+ //inline Function( T *inValue ) : call(inValue) { }
+ inline Function( AutoCast inValue ) : call( (T*)inValue.value) { }
+ inline Function( const hx::AnyCast &inValue ) : call( (T*)inValue.mPtr) { }
+
+ template<typename FROM>
+ inline static Function __new(FROM from)
+ {
+ return Function(from);
+ }
+
+ inline Function operator=( const Function &inRHS ) { return call = inRHS.call; }
+ inline Dynamic operator=( Dynamic &inValue )
+ {
+ call = inValue==null() ? 0 : (T*) inValue->__GetHandle();
+ return inValue;
+ }
+ inline Dynamic operator=( null &inValue ) { call=0; return inValue; }
+ inline bool operator==( const null &inValue ) const { return call==0; }
+ inline bool operator!=( const null &inValue ) const { return call!=0; }
+
+
+ operator Dynamic () const { return CreateDynamicPointer((void *)call); }
+ //operator hx::Val () const { return CreateDynamicPointer((void *)call); }
+ operator T * () { return call; }
+ operator void * () { return (void *)call; }
+
+ inline T &get_call() { return *call; }
+
+ inline bool lt(Function inOther) { return call < inOther.call; }
+ inline bool gt(Function inOther) { return call > inOther.call; }
+ inline bool leq(Function inOther) { return call <= inOther.call; }
+ inline bool geq(Function inOther) { return call >= inOther.call; }
+
+};
+
+
+template<typename T>
+inline bool operator == (const null &, Function<T> inPtr) { return inPtr.call==0; }
+template<typename T>
+inline bool operator != (const null &, Function<T> inPtr) { return inPtr.call!=0; }
+
+
+
+class Function_obj
+{
+public:
+
+ inline static AutoCast getProcAddress(String inLib, String inPrim)
+ {
+ return AutoCast(__hxcpp_get_proc_address(inLib, inPrim,false));
+ }
+
+
+ template<typename T>
+ inline static AutoCast fromStaticFunction(T *inFunction)
+ {
+ return AutoCast(inFunction);
+ }
+};
+
+
+class Pointer_obj
+{
+public:
+ template<typename T>
+ inline static AutoCast arrayElem(::Array<T> array, int inIndex) { return AutoCast(&array[inIndex]); }
+ inline static AutoCast arrayElem(Dynamic inVal, int inIndex)
+ {
+ if (inVal==null() || !inVal->__IsArray())
+ return AutoCast(0);
+ hx::ArrayBase *base = (hx::ArrayBase *)inVal.GetPtr();
+ return AutoCast(base->GetBase() + inIndex*base->GetElementSize());
+ }
+
+ template<typename T>
+ inline static AutoCast ofArray(::Array<T> array) { return AutoCast(&array[0]); }
+ inline static AutoCast ofArray(Dynamic inVal)
+ {
+ if (inVal==null() || !inVal->__IsArray())
+ return AutoCast(0);
+ hx::ArrayBase *base = (hx::ArrayBase *)inVal.GetPtr();
+ return AutoCast(base->GetBase());
+ }
+
+
+
+ template<typename T>
+ inline static Pointer<T> addressOf(T &value) { return Pointer<T>(&value); }
+
+ template<typename T>
+ inline static Pointer<void> endOf(hx::ObjectPtr<T> value) { return (void *)(value.mPtr+1); }
+
+ template<typename T>
+ inline static Pointer<T> fromPointer(T *value) { return Pointer<T>(value); }
+ template<typename T>
+ inline static Pointer<T> fromPointer(const T *value) { return Pointer<T>(value); }
+
+ template<typename T>
+ inline static Pointer<T> fromRaw(T *value) { return Pointer<T>(value); }
+ template<typename T>
+ inline static Pointer<T> fromRaw(const T *value) { return Pointer<T>(value); }
+ inline static Pointer<void> fromRaw(const AutoCast &inAutoCast) { return Pointer<void>(inAutoCast.value); }
+ inline static Pointer<void> fromRaw(const RawAutoCast &inAutoCast) { return Pointer<void>(inAutoCast.value); }
+
+
+ inline static AutoCast fromHandle(Dynamic inValue, String inKind)
+ {
+ if (inValue==null() || (inKind!=null() && inKind!=__hxcpp_get_kind(inValue)))
+ return AutoCast(0);
+ return AutoCast(inValue->__GetHandle());
+ }
+};
+
+
+class Reference_obj
+{
+public:
+
+};
+
+
+
+} // end namespace cpp
+
+namespace hx
+{
+template <typename T>
+T *StarOf(T &x) { return &x; }
+}
+
+
+#endif
diff --git a/Sources/c_snikket/iinclude/cpp/Variant.h b/Sources/c_snikket/iinclude/cpp/Variant.h
new file mode 100644
index 0000000..cf2352f
--- /dev/null
+++ b/Sources/c_snikket/iinclude/cpp/Variant.h
@@ -0,0 +1,674 @@
+#ifndef CPP_VARIANT_TWICE_H
+
+
+namespace cpp
+{
+#ifndef CPP_VARIANT_ONCE_H
+#define CPP_VARIANT_ONCE_H
+
+ template<typename T>
+ inline bool isIntType(const T &inRHS) { return false; }
+ template<> inline bool isIntType(const int &inRHS) { return true; }
+ template<> inline bool isIntType(const Dynamic &inRHS);
+ template<> inline bool isIntType(const cpp::Variant &inRHS);
+
+ template<typename T>
+ inline bool isStringType(const T &inRHS) { return false; }
+ template<> inline bool isStringType(const String &inRHS) { return true; }
+ template<> inline bool isStringType(const Dynamic &inRHS);
+ template<> inline bool isStringType(const cpp::Variant &inRHS);
+
+ struct Variant
+ {
+ enum Type
+ {
+ typeObject = 0,
+ typeString,
+ typeDouble,
+ typeInt,
+ typeInt64,
+ typeBool,
+ };
+
+ union
+ {
+ // Although this is typed as 'char', it might be char16_t in the case of smart strings
+ const char *valStringPtr;
+ hx::Object *valObject;
+ double valDouble;
+ cpp::Int64 valInt64;
+ int valInt;
+ bool valBool;
+ };
+ Type type;
+ unsigned int valStringLen;
+
+
+
+ inline bool isNull() const {
+ return (type==typeObject && !valObject) || (type==typeString && !valStringPtr); }
+ inline bool isNumeric() const;
+ inline bool isBool() const;
+ inline int asInt() const;
+ inline bool isInt() const;
+ inline cpp::Int64 asInt64() const;
+ inline bool isInt64() const;
+ inline bool isString() const;
+ inline double asDouble() const;
+ inline hx::Object *asObject() const { return type==typeObject ? valObject : 0; }
+ inline hx::Object *asDynamic() const{ return type==typeObject ? valObject : toDynamic(); }
+ inline hx::Object *toDynamic() const; // later
+ inline String asString() const;
+ inline String getString() const;
+
+ inline Variant() : valInt64(0), type(typeObject) { }
+ //inline Variant() { copyBuf.b[0] = copyBuf.b[1] = 0; }
+ inline Variant(const null &) : type(typeObject), valObject(0) { }
+ inline Variant(bool inValue) : type(typeBool), valBool(inValue) { }
+ inline Variant(double inValue) : type(typeDouble), valDouble(inValue) { }
+ inline Variant(const ::String &inValue); // later
+
+ inline Variant(cpp::Int64 inValue) : type(typeInt64), valInt64(inValue) { }
+ inline Variant(cpp::UInt64 inValue) : type(typeInt64), valInt64(inValue) { }
+ inline Variant(unsigned long inValue) : type(typeInt64), valInt64(inValue) { }
+ inline Variant(int inValue) : type(typeInt), valInt(inValue) { }
+ inline Variant(cpp::UInt32 inValue) : type(typeInt), valInt(inValue) { }
+ inline Variant(cpp::Int16 inValue) : type(typeInt), valInt(inValue) { }
+ inline Variant(cpp::UInt16 inValue) : type(typeInt), valInt(inValue) { }
+ inline Variant(cpp::Int8 inValue) : type(typeInt), valInt(inValue) { }
+ inline Variant(cpp::UInt8 inValue) : type(typeInt), valInt(inValue) { }
+ #if defined(__OBJC__) && defined(HXCPP_OBJC)
+ inline Variant(const id inObjc);
+ inline operator id() const;
+ #endif
+
+
+ template<typename SOURCE_>
+ Variant(const hx::ObjectPtr<SOURCE_> &inObjectPtr);
+
+ inline Variant(const Dynamic &inRHS); // later
+ inline Variant(hx::Object *inValue) : type(typeObject), valObject(inValue) { }
+
+ template<typename T,typename H>
+ explicit inline Variant(const cpp::Struct<T,H> &inVal);
+ template<typename T>
+ explicit inline Variant(const cpp::Pointer<T> &inRHS) ;
+ template<typename T>
+ explicit inline Variant(const cpp::Function<T> &inRHS) ;
+ template<typename T>
+ explicit inline Variant(const hx::Native<T> &inRHS) ;
+
+ //inline operator Dynamic() const; // later
+ //inline operator String() const;
+ inline operator double() const { return asDouble(); }
+ inline operator int() const { return asInt(); }
+ inline operator bool() const { return asInt(); }
+ inline operator float () const { return asDouble(); }
+ inline operator unsigned int () const { return asInt(); }
+ inline operator short () const { return asInt(); }
+ inline operator unsigned short () const { return asInt(); }
+ inline operator unsigned char () const { return asInt(); }
+ inline operator char () const { return asInt(); }
+ inline operator signed char () const { return asInt(); }
+ inline operator cpp::Int64 () const { return asInt64(); }
+ inline operator cpp::UInt64 () const { return asInt64(); }
+ inline operator unsigned long () const { return asInt64(); }
+ inline bool operator !() const { return !asInt(); }
+
+ inline int Compare(hx::Object *inRHS) const;
+ inline int Compare(const Dynamic &inRHS) const;
+ inline int Compare(const cpp::Variant &inRHS) const;
+
+ inline double set(const double &inValue) { type=typeDouble; return valDouble=inValue; }
+ inline double set(const float &inValue) { type=typeDouble; return valDouble=inValue; }
+
+ inline void mark(hx::MarkContext *__inCtx); // later
+ #ifdef HXCPP_VISIT_ALLOCS
+ inline void visit(hx::VisitContext *__inCtx); // later
+ #endif
+
+
+ //inline Variant &operator=(const Variant &inRhs) { copyBuf = inRhs.copyBuf; return *this; }
+
+ template<typename T>
+ bool operator==(const T &inRHS) const;
+
+ template<typename T>
+ bool operator==(const hx::ObjectPtr<T> &inRHS) const
+ { return Compare(inRHS.mPtr)==0; }
+
+
+ template<typename T>
+ bool operator!=(const hx::ObjectPtr<T> &inRHS) const
+ { return Compare(inRHS.mPtr)!=0; }
+
+
+
+ inline bool operator==(const null &inRHS) const { return isNull(); }
+ inline bool operator==(const String &inRHS) const;
+
+ inline bool operator!=(const null &inRHS) const { return !isNull(); }
+ inline bool operator!=(const Variant &inRHS) const { return !operator==(inRHS); }
+ inline bool operator!=(const String &inRHS) const;
+
+
+ template<typename RETURN_>
+ RETURN_ Cast() const { return RETURN_(*this); }
+
+ void CheckFPtr();
+ HX_DECLARE_VARIANT_FUNCTIONS
+
+
+ // Operator + is different, since it must consider strings too...
+ inline String operator+(const String &s) const;
+ template<typename T>
+ inline cpp::Variant operator + (const T &inRHS) const;
+
+ inline double operator%(const Dynamic &inRHS) const;
+ inline double operator-() const { return -asDouble(); }
+ inline double operator++() { return set(asDouble()+1); }
+ inline double operator++(int) {double val = asDouble(); set(val+1); return val; }
+ inline double operator--() { return set(asDouble()-1); }
+ inline double operator--(int) {double val = asDouble(); set(val-1); return val; }
+
+ template<typename T>
+ inline double operator / (const T &inRHS) const { return asDouble() / (double)inRHS; } \
+
+ template<typename T>
+ inline cpp::Variant operator - (const T &inRHS) const
+ {
+ if (::cpp::isIntType(inRHS) && isInt() )
+ return asInt() - (int)inRHS;
+ return asDouble() - (double)inRHS;
+ }
+
+ template<typename T>
+ inline cpp::Variant operator * (const T &inRHS) const
+ {
+ if (::cpp::isIntType(inRHS) && isInt())
+ return asInt() * (int)inRHS;
+ return asDouble() * (double)inRHS;
+ }
+
+ inline bool operator < (const String &inRHS) const;
+ inline bool operator <= (const String &inRHS) const;
+ inline bool operator > (const String &inRHS) const;
+ inline bool operator >= (const String &inRHS) const;
+
+
+
+ #define HX_VARIANT_COMPARE_OP( op ) \
+ inline bool operator op (double inRHS) const { return isNumeric() && (asDouble() op inRHS); } \
+ inline bool operator op (cpp::Int64 inRHS) const { return isNumeric() && (asInt64() op inRHS); } \
+ inline bool operator op (cpp::UInt64 inRHS) const { return isNumeric() && ((cpp::UInt64)(asInt64()) op inRHS); } \
+ inline bool operator op (float inRHS) const { return isNumeric() && (asDouble() op inRHS); } \
+ inline bool operator op (int inRHS) const { return isNumeric() && (asDouble() op (double)inRHS); } \
+ inline bool operator op (unsigned int inRHS) const { return isNumeric() && (asDouble() op (double)inRHS); } \
+ inline bool operator op (short inRHS) const { return isNumeric() && (asDouble() op (double)inRHS); } \
+ inline bool operator op (unsigned short inRHS) const { return isNumeric() && (asDouble() op (double)inRHS); } \
+ inline bool operator op (signed char inRHS) const { return isNumeric() && (asDouble() op (double)inRHS); } \
+ inline bool operator op (unsigned char inRHS) const { return isNumeric() && (asDouble() op (double)inRHS); } \
+ inline bool operator op (bool inRHS) const { return isBool() && (asDouble() op (double)inRHS); } \
+ inline bool operator op (const Dynamic &inRHS) const { return Compare(inRHS) op 0; } \
+
+ #define HX_VARIANT_COMPARE_OP_ALL( op ) \
+ inline bool operator op (const null &inRHS) const { return false; } \
+ inline bool operator op (const cpp::Variant &inRHS) const { return Compare(inRHS) op 0; } \
+ HX_VARIANT_COMPARE_OP(op)
+
+ HX_VARIANT_COMPARE_OP( == )
+ HX_VARIANT_COMPARE_OP( != )
+ HX_VARIANT_COMPARE_OP_ALL( < )
+ HX_VARIANT_COMPARE_OP_ALL( <= )
+ HX_VARIANT_COMPARE_OP_ALL( >= )
+ HX_VARIANT_COMPARE_OP_ALL( > )
+
+
+ };
+
+#else // Second time ...
+ #define CPP_VARIANT_TWICE_H
+
+ bool Variant::isInt() const
+ {
+ return type==typeInt || (type==typeObject && valObject && valObject->__GetType()==vtInt);
+ }
+ bool Variant::isInt64() const
+ {
+ return type==typeInt64 || (type==typeObject && valObject && valObject->__GetType()==vtInt64);
+ }
+ bool Variant::isString() const
+ {
+ return type==typeString || (type==typeObject && valObject && valObject->__GetType()==vtString);
+ }
+
+
+ #if defined(__OBJC__) && defined(HXCPP_OBJC)
+ // Variant type neither adds nor releases references counts while holding the value as an id on the stack
+ // The Dynamic created here owns the id, and we refer to the Dynamic and use his reference count to keep the id alive
+ inline Variant::Variant(const id inObjc) { type=typeObject; valObject = Dynamic(inObjc).mPtr; }
+ #ifdef OBJC_ARC
+ inline Variant::operator id () const { return type==typeObject && valObject ? (__bridge id)valObject->__GetHandle() : 0; }
+ #else
+ inline Variant::operator id () const { return type==typeObject && valObject ? (id)valObject->__GetHandle() : 0; }
+ #endif
+ #endif
+
+
+
+ template<> inline bool isIntType(const Dynamic &inRHS) { return inRHS->__GetType()==vtInt; }
+ template<> inline bool isIntType(const cpp::Variant &inRHS) { return inRHS.isInt(); }
+ template<> inline bool isStringType(const Dynamic &inRHS) { return inRHS.mPtr && inRHS->__GetType()==vtString; }
+ template<> inline bool isStringType(const cpp::Variant &inRHS) { return inRHS.isString(); }
+
+ template<typename T,typename H>
+ Variant::Variant(const cpp::Struct<T,H> &inVal) :
+ type(typeObject), valObject(Dynamic(inVal).mPtr) { }
+
+ template<typename T>
+ Variant::Variant(const cpp::Pointer<T> &inRHS) : type(typeObject), valObject( Dynamic(inRHS).mPtr ) { }
+ template<typename T>
+ Variant::Variant(const cpp::Function<T> &inRHS) : type(typeObject), valObject( Dynamic(inRHS).mPtr ) { }
+ template<typename T>
+ Variant::Variant(const hx::Native<T> &inRHS) : type(typeObject), valObject( CreateDynamicPointer(inRHS.ptr).mPtr ) { }
+
+
+#define HX_ARITH_VARIANT( op ) \
+ inline double operator op (const double &inLHS,const cpp::Variant &inRHS) { return inLHS op (double)inRHS;} \
+ inline double operator op (const float &inLHS,const cpp::Variant &inRHS) { return inLHS op (double)inRHS;} \
+ inline double operator op (const int &inLHS,const cpp::Variant &inRHS) { return inLHS op (double)inRHS; } \
+ inline double operator op (const unsigned int &inLHS,const cpp::Variant &inRHS) { return inLHS op (double)inRHS; } \
+ inline double operator op (const signed char &inLHS,const cpp::Variant &inRHS) { return inLHS op (double)inRHS; } \
+ inline double operator op (const unsigned char &inLHS,const cpp::Variant &inRHS) { return inLHS op (double)inRHS; } \
+ inline double operator op (const signed short &inLHS,const cpp::Variant &inRHS) { return inLHS op (double)inRHS; } \
+ inline double operator op (const unsigned short &inLHS,const cpp::Variant &inRHS) { return inLHS op (double)inRHS; } \
+ inline double operator op (const cpp::Int64 &inLHS,const cpp::Variant &inRHS) { return inLHS op (double)inRHS; } \
+ inline double operator op (const cpp::UInt64 &inLHS,const cpp::Variant &inRHS) { return inLHS op (double)inRHS; } \
+
+ HX_ARITH_VARIANT( - )
+ HX_ARITH_VARIANT( + )
+ HX_ARITH_VARIANT( / )
+ HX_ARITH_VARIANT( * )
+
+ inline bool Variant::operator==(const String &inString) const
+ {
+ if (isNull()) return inString==null();
+ return type==typeString && asString()==inString;
+ }
+ inline bool Variant::operator!=(const String &inString) const
+ {
+ if (isNull()) return inString!=null();
+ return type!=typeString || asString()!=inString;
+ }
+ inline bool Variant::operator < (const String &inRHS) const { return asString() < inRHS; }
+ inline bool Variant::operator <= (const String &inRHS) const { return asString() < inRHS; }
+ inline bool Variant::operator > (const String &inRHS) const { return asString() > inRHS; }
+ inline bool Variant::operator >= (const String &inRHS) const { return asString() >= inRHS; }
+
+
+
+
+
+ Variant::Variant(const ::String &inValue) :
+ type(typeString), valStringPtr(inValue.raw_ptr()), valStringLen(inValue.length) { }
+
+ Variant::Variant(const Dynamic &inRHS) : type(typeObject), valObject(inRHS.mPtr) { }
+
+ template<typename SOURCE_>
+ Variant::Variant(const hx::ObjectPtr<SOURCE_> &inObjectPtr) :
+ type(typeObject), valObject(inObjectPtr.mPtr) { }
+
+ inline void Variant::CheckFPtr()
+ {
+ if (isNull()) Dynamic::ThrowBadFunctionError();
+ }
+
+ HX_IMPLEMENT_INLINE_VARIANT_FUNCTIONS
+
+
+ int Variant::asInt() const
+ {
+ if (type==typeInt)
+ return valInt;
+
+ switch(type)
+ {
+ case typeDouble: return valDouble;
+ case typeInt64: return (int)valInt64;
+ case typeBool: return valBool;
+ case typeObject: return valObject ? valObject->__ToInt() : 0;
+ default: ;
+ }
+ return 0;
+ }
+
+
+
+ cpp::Int64 Variant::asInt64() const
+ {
+ if (type==typeInt64)
+ return valInt64;
+
+ switch(type)
+ {
+ case typeDouble: return valDouble;
+ case typeInt: return valInt;
+ case typeBool: return valBool;
+ case typeObject: return valObject ? valObject->__ToInt64() : 0;
+ default: ;
+ }
+ return 0;
+ }
+
+ double Variant::asDouble() const
+ {
+ if (type==typeDouble)
+ return valDouble;
+ else if (type==typeInt)
+ return valInt;
+ else if (type==typeBool)
+ return valBool ? 1.0 : 0.0;
+ else if (type==typeInt64)
+ return valInt64;
+ else if (type==typeObject)
+ return valObject ? valObject->__ToDouble() : 0.0;
+ return 0.0;
+ }
+
+
+ inline hx::Object *Variant::toDynamic() const
+ {
+ switch(type)
+ {
+ case typeInt: return Dynamic(valInt).mPtr;
+ case typeDouble: return Dynamic(valDouble).mPtr;
+ case typeBool: return Dynamic(valBool).mPtr;
+ case typeString: return Dynamic(String(valStringPtr, valStringLen)).mPtr;
+ case typeInt64: return Dynamic(valInt64).mPtr;
+ case typeObject: return valObject;
+ default: ;
+ }
+ return 0;
+ }
+
+
+ /*
+ Variant::operator Dynamic() const
+ {
+ switch(type)
+ {
+ case typeInt: return valInt;
+ case typeDouble: return valDouble;
+ case typeBool: return valBool;
+ case typeString: return String(valStringPtr, valStringLen);
+ case typeObject: return valObject;
+ default: ;
+ }
+ return null();
+ }
+ */
+
+
+ bool Variant::isNumeric() const
+ {
+ if (type==typeInt || type==typeDouble || type==typeInt64)
+ return true;
+ if (type!=typeObject || valObject==0)
+ return false;
+
+ int t = valObject->__GetType();
+ return t==vtInt || t==vtFloat;
+ }
+
+ bool Variant::isBool() const
+ {
+ if (type==typeBool)
+ return true;
+ if (type!=typeObject || valObject==0)
+ return false;
+
+ return valObject->__GetType() == vtBool;
+ }
+
+
+ String Variant::getString() const { return String(valStringPtr, valStringLen); }
+ String Variant::asString() const
+ {
+ switch(type)
+ {
+ case typeInt: return String(valInt);
+ case typeDouble: return String(valDouble);
+ case typeBool: return String(valBool);
+ case typeString: return String(valStringPtr, valStringLen);
+ case typeInt64: return String(valInt64);
+ case typeObject: return valObject ? valObject->toString() : String();
+ default: ;
+ }
+ return String();
+ }
+ //Variant::operator String() const { return asString(); }
+
+
+ void Variant::mark(hx::MarkContext *__inCtx)
+ {
+ if (type==typeString)
+ {
+ HX_MARK_STRING(valStringPtr);
+ }
+ else if (type==typeObject)
+ {
+ HX_MARK_OBJECT(valObject);
+ }
+ }
+
+ template<typename T>
+ bool Variant::operator==(const T &inRHS) const
+ {
+ switch(type)
+ {
+ case typeInt: return valInt==(double)inRHS;
+ case typeDouble:return valDouble==(double)inRHS;
+ case typeBool: return valBool==(bool)inRHS;
+ case typeInt64: return valInt64==(cpp::Int64)inRHS;
+ case typeString: return getString()==String(inRHS);
+ case typeObject:
+ if (!valObject)
+ return inRHS == null();
+ return valObject->__Compare( Dynamic(inRHS).mPtr )==0;
+ }
+ return false;
+ }
+
+
+ int Variant::Compare(hx::Object *inPtr) const
+ {
+ if (!inPtr)
+ return isNull() ? 0 : 1;
+
+ switch(type)
+ {
+ case typeInt:
+ {
+ double diff = valInt - inPtr->__ToDouble();
+ return diff<0 ? -1 : diff==0 ? 0 : 1;
+ }
+ case typeDouble:
+ {
+ double diff = valDouble - inPtr->__ToDouble();
+ return diff<0 ? -1 : diff==0 ? 0 : 1;
+ }
+ case typeInt64:
+ {
+ cpp::Int64 diff = valInt64 - inPtr->__ToInt64();
+ return diff<0 ? -1 : diff==0 ? 0 : 1;
+ }
+ case typeBool:
+ if (!inPtr) return 1;
+ return valBool==(bool)(inPtr->__ToInt()) ? 1 : 0;
+ case typeString:
+ if (!inPtr) return valStringPtr ? 1 : 0;
+ if (inPtr->__GetType()!=vtString)
+ return 1;
+ return String(valStringPtr, valStringLen)==inPtr->toString() ? 1 : 0;
+ case typeObject:
+ return valObject->__Compare( inPtr );
+ default: ;
+
+ }
+ return 0;
+ }
+ int Variant::Compare(const Dynamic &inD) const { return Compare(inD.mPtr); }
+ int Variant::Compare(const cpp::Variant &inVar) const
+ {
+ if (inVar.type==typeObject)
+ return Compare(inVar.valObject);
+
+ switch(type)
+ {
+ case typeInt:
+ {
+ double diff = valInt - inVar.asDouble();
+ return diff<0 ? -1 : diff==0 ? 0 : 1;
+ }
+ case typeDouble:
+ {
+ double diff = valDouble - inVar.asDouble();
+ return diff<0 ? -1 : diff==0 ? 0 : 1;
+ }
+ case typeInt64:
+ {
+ cpp::Int64 diff = valInt64 - inVar.asInt64();
+ return diff<0 ? -1 : diff==0 ? 0 : 1;
+ }
+ case typeBool:
+ return valBool==(bool)(inVar.asInt()) ? 1 : 0;
+ case typeString:
+ if (inVar.type!=typeString)
+ return 1;
+ return String(valStringPtr, valStringLen)==inVar.asString();
+ case typeObject:
+ if (!valObject)
+ return 1;
+ return - inVar.Compare(*this);
+ }
+
+ return 0;
+ }
+
+ String cpp::Variant::operator+(const String &s) const
+ {
+ return asString() + s;
+ }
+ template<typename T>
+ cpp::Variant Variant::operator + (const T &inRHS) const
+ {
+ if (isString() || ::cpp::isStringType(inRHS))
+ return asString() + String(inRHS);
+ return asDouble() + (double)inRHS;
+ }
+
+
+ #ifdef HXCPP_VISIT_ALLOCS
+ void Variant::visit(hx::VisitContext *__inCtx)
+ {
+ if (type==typeString)
+ {
+ HX_VISIT_STRING(valStringPtr);
+ }
+ else if (type==typeObject)
+ {
+ HX_VISIT_OBJECT(valObject);
+ }
+ }
+ #endif // HXCPP_VISIT_ALLOCS
+
+
+
+
+
+#define HX_VARIANT_OP_ISEQ(T) \
+inline bool operator == (const T &inLHS,const cpp::Variant &inRHS) { return inRHS==inLHS; } \
+inline bool operator != (const T &inLHS,const cpp::Variant &inRHS) { return inRHS!=inLHS; }
+
+
+#define HX_VARIANT_OP_ISEQ(T) \
+inline bool operator == (const T &inLHS,const cpp::Variant &inRHS) { return inRHS==inLHS; } \
+inline bool operator != (const T &inLHS,const cpp::Variant &inRHS) { return inRHS!=inLHS; }
+
+HX_VARIANT_OP_ISEQ(String)
+HX_VARIANT_OP_ISEQ(double)
+HX_VARIANT_OP_ISEQ(float)
+HX_VARIANT_OP_ISEQ(cpp::Int64)
+HX_VARIANT_OP_ISEQ(cpp::UInt64)
+HX_VARIANT_OP_ISEQ(int)
+HX_VARIANT_OP_ISEQ(unsigned int)
+HX_VARIANT_OP_ISEQ(short)
+HX_VARIANT_OP_ISEQ(unsigned short)
+HX_VARIANT_OP_ISEQ(signed char)
+HX_VARIANT_OP_ISEQ(unsigned char)
+HX_VARIANT_OP_ISEQ(bool)
+
+inline bool operator < (bool inLHS,const cpp::Variant &inRHS) { return false; }
+inline bool operator <= (bool inLHS,const cpp::Variant &inRHS) { return false; }
+inline bool operator >= (bool inLHS,const cpp::Variant &inRHS) { return false; }
+inline bool operator > (bool inLHS,const cpp::Variant &inRHS) { return false; }
+
+
+#define HX_COMPARE_VARIANT_OP( op ) \
+ inline bool operator op (double inLHS,const ::cpp::Variant &inRHS) \
+ { return inRHS.isNumeric() && (inLHS op (double)inRHS); } \
+ inline bool operator op (float inLHS,const ::cpp::Variant &inRHS) \
+ { return inRHS.isNumeric() && ((double)inLHS op (double)inRHS); } \
+ inline bool operator op (cpp::Int64 inLHS,const ::cpp::Variant &inRHS) \
+ { return inRHS.isNumeric() && (inLHS op (double)inRHS); } \
+ inline bool operator op (cpp::UInt64 inLHS,const ::cpp::Variant &inRHS) \
+ { return inRHS.isNumeric() && (inLHS op (double)inRHS); } \
+ inline bool operator op (int inLHS,const ::cpp::Variant &inRHS) \
+ { return inRHS.isNumeric() && (inLHS op (double)inRHS); } \
+ inline bool operator op (unsigned int inLHS,const ::cpp::Variant &inRHS) \
+ { return inRHS.isNumeric() && (inLHS op (double)inRHS); } \
+ inline bool operator op (short inLHS,const ::cpp::Variant &inRHS) \
+ { return inRHS.isNumeric() && (inLHS op (double)inRHS); } \
+ inline bool operator op (unsigned short inLHS,const ::cpp::Variant &inRHS) \
+ { return inRHS.isNumeric() && (inLHS op (double)inRHS); } \
+ inline bool operator op (signed char inLHS,const ::cpp::Variant &inRHS) \
+ { return inRHS.isNumeric() && (inLHS op (double)inRHS); } \
+ inline bool operator op (unsigned char inLHS,const ::cpp::Variant &inRHS) \
+ { return inRHS.isNumeric() && (inLHS op (double)inRHS); } \
+ inline bool operator op (const null &,const ::cpp::Variant &inRHS) \
+ { return false; } \
+
+HX_COMPARE_VARIANT_OP( < )
+HX_COMPARE_VARIANT_OP( <= )
+HX_COMPARE_VARIANT_OP( >= )
+HX_COMPARE_VARIANT_OP( > )
+
+
+
+
+
+
+} // close cpp
+namespace hx {
+ template<typename T>
+ bool ObjectPtr<T>::operator==(const cpp::Variant &inRHS) const {
+ return inRHS.Compare(mPtr)==0;
+ }
+ template<typename T>
+ bool ObjectPtr<T>::operator!=(const cpp::Variant &inRHS) const {
+ return inRHS.Compare(mPtr)!=0;
+ }
+
+} // close hx
+namespace cpp {
+
+#endif // not twice
+
+
+
+} // end namespace cpp
+
+
+
+
+#endif // CPP_VARIANT_TWICE_H
diff --git a/Sources/c_snikket/iinclude/cpp/VirtualArray.h b/Sources/c_snikket/iinclude/cpp/VirtualArray.h
new file mode 100644
index 0000000..a95f65f
--- /dev/null
+++ b/Sources/c_snikket/iinclude/cpp/VirtualArray.h
@@ -0,0 +1,724 @@
+namespace cpp
+{
+
+// This file is included twice - either side of the Array definition
+#ifndef HX_VARRAY_DEFINED
+#define HX_VARRAY_DEFINED
+
+
+class VirtualArray : public hx::ObjectPtr<VirtualArray_obj>
+{
+ typedef hx::ObjectPtr<VirtualArray_obj> super;
+public:
+ typedef Dynamic Elem;
+
+ inline VirtualArray() : super(0) { }
+ inline VirtualArray(VirtualArray_obj *inObj) : super(inObj) { }
+ inline VirtualArray(const null &inNull) : super(0) { }
+ inline VirtualArray(const VirtualArray &inOther) : super( inOther.mPtr ) { }
+
+ // Build from foreign array
+ template<typename SOURCE_> inline VirtualArray( const Array<SOURCE_> &inRHS );
+
+
+ inline VirtualArray( const Dynamic &inRHS ) : super(0) { setDynamic(inRHS); }
+ inline VirtualArray( const cpp::ArrayBase &inRHS ) : super(0) { setDynamic(inRHS); }
+ inline VirtualArray(const ::cpp::Variant &inVariant) { setDynamic(inVariant.asObject()); }
+
+
+
+
+ inline VirtualArray &operator=(const null &inNull) { mPtr = 0; return *this; }
+ inline VirtualArray &operator=(Ptr inRHS) { mPtr = inRHS; return *this; }
+ inline VirtualArray &operator=(const VirtualArray &inRHS) { mPtr = inRHS.mPtr; return *this; }
+
+ inline void setDynamic( const Dynamic &inRHS );
+
+ template<typename T>
+ inline VirtualArray Add(const T &inVal);
+
+
+ inline bool operator==(const Dynamic &value) const { return value==*this; }
+ template<typename SOURCE_> inline bool operator==( const Array<SOURCE_> &inRHS );
+
+ inline bool operator!=(Dynamic value) const { return value!=*this; }
+ template<typename SOURCE_> inline bool operator!=( const Array<SOURCE_> &inRHS ) { return inRHS!=*this; }
+
+};
+
+
+
+
+
+
+class HXCPP_EXTERN_CLASS_ATTRIBUTES VirtualArray_obj : public hx::ArrayCommon
+{
+ typedef hx::ArrayStore ArrayStore;
+ typedef hx::ArrayBase ArrayBase;
+
+public:
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdVirtualArray };
+
+ typedef hx::Object super;
+ ArrayStore store;
+ ArrayBase *base;
+
+ VirtualArray_obj(ArrayBase *inBase=0, bool inFixed=false) : base(inBase)
+ {
+ mArrayConvertId = hx::aciVirtualArray;
+ store = inFixed && inBase ? hx::arrayFixed : base ? base->getStoreType() : hx::arrayEmpty;
+ #ifdef HXCPP_GC_GENERATIONAL
+ if (base)
+ HX_OBJ_WB_GET(this,base);
+ #endif
+ }
+
+ VirtualArray_obj(ArrayStore inStore)
+ {
+ mArrayConvertId = hx::aciVirtualArray;
+ store = inStore;
+ }
+
+ hx::Object *__GetRealObject() { return base?(hx::Object *)base:(hx::Object *)this; }
+
+ inline static VirtualArray __new(int inSize=0,int inReserve=0)
+ {
+ VirtualArray result = new VirtualArray_obj(hx::arrayEmpty);
+ if (inSize>0)
+ result->__SetSizeExact(inSize);
+ if (inReserve>0)
+ result->reserve(inReserve);
+ return result;
+ }
+
+ int __Compare(const hx::Object *inRHS) const;
+
+ inline int get_length() const
+ {
+ return base ? base->length : 0;
+ }
+
+ inline void checkBase() const
+ {
+ #ifdef HXCPP_CHECK_POINTER
+ if (store==hx::arrayNull)
+ {
+ hx::NullReference("Array", true);
+ // The handler might have fixed up the null value
+ if (store==hx::arrayNull) hx::NullReference("Array", false);
+ }
+ #endif
+ }
+
+ void EnsureStorage(const Dynamic &inValue)
+ {
+ if (!inValue.mPtr)
+ {
+ EnsureNullStorage();
+ }
+ else switch(inValue->__GetType())
+ {
+ case vtBool: EnsureBoolStorage(); break;
+ case vtInt: EnsureIntStorage(); break;
+ case vtFloat: EnsureFloatStorage(); break;
+ case vtString: EnsureStringStorage(); break;
+ case vtInt64: EnsureInt64Storage(); break;
+ default: EnsureObjectStorage();
+ }
+ }
+
+
+ void EnsureStorage(const cpp::Variant &inValue)
+ {
+ switch(inValue.type)
+ {
+ case Variant::typeObject:
+ if (!inValue.valObject)
+ EnsureNullStorage();
+ else
+ EnsureObjectStorage();
+ break;
+ case Variant::typeString: EnsureStringStorage(); break;
+ case Variant::typeDouble: EnsureFloatStorage(); break;
+ case Variant::typeInt: EnsureIntStorage(); break;
+ case Variant::typeBool: EnsureBoolStorage(); break;
+ case Variant::typeInt64: EnsureInt64Storage(); break;
+ }
+ }
+
+
+ void MakeIntArray();
+ void MakeInt64Array();
+ void MakeObjectArray();
+ void MakeFloatArray();
+ void MakeBoolArray();
+ void MakeStringArray();
+
+ void EnsureStorage(const VirtualArray &inValue) { EnsureObjectStorage(); }
+ void EnsureStorage(const unsigned char &inValue) { EnsureIntStorage(); }
+ void EnsureStorage(const bool &inValue) { EnsureBoolStorage(); }
+ void EnsureStorage(const String &inValue) { EnsureStringStorage(); }
+ void EnsureStorage(const double &inValue) { EnsureFloatStorage(); }
+ void EnsureStorage(const float &inValue) { EnsureFloatStorage(); }
+ void EnsureStorage(const int &inValue) { EnsureIntStorage(); }
+ void EnsureStorage(const cpp::Int64 &inValue) { EnsureInt64Storage(); }
+ void EnsureStorage(const cpp::UInt64 &inValue) { EnsureInt64Storage(); }
+ void EnsureStorage(const null &inValue) { EnsureNullStorage(); }
+ template<typename T>
+ void EnsureStorage(const T &inValue) { EnsureObjectStorage(); }
+
+ inline void EnsureBoolStorage()
+ {
+ switch(store)
+ {
+ case hx::arrayNull:
+ case hx::arrayObject:
+ case hx::arrayFixed:
+ case hx::arrayBool:
+ return;
+ case hx::arrayEmpty:
+ MakeBoolArray();
+ break;
+ case hx::arrayInt:
+ case hx::arrayInt64:
+ case hx::arrayFloat:
+ case hx::arrayString:
+ MakeObjectArray();
+ break;
+ }
+ }
+ inline void EnsureStringStorage()
+ {
+ switch(store)
+ {
+ case hx::arrayNull:
+ case hx::arrayObject:
+ case hx::arrayFixed:
+ case hx::arrayString:
+ return;
+ case hx::arrayEmpty:
+ MakeStringArray();
+ break;
+ case hx::arrayInt:
+ case hx::arrayInt64:
+ case hx::arrayFloat:
+ case hx::arrayBool:
+ MakeObjectArray();
+ break;
+ }
+ }
+ inline void EnsureFloatStorage()
+ {
+ switch(store)
+ {
+ case hx::arrayNull:
+ case hx::arrayFloat:
+ case hx::arrayObject:
+ case hx::arrayFixed:
+ return;
+ case hx::arrayInt:
+ case hx::arrayInt64:
+ case hx::arrayEmpty:
+ MakeFloatArray();
+ break;
+ case hx::arrayBool:
+ case hx::arrayString:
+ MakeObjectArray();
+ break;
+ }
+ }
+
+ inline void EnsureIntStorage()
+ {
+ switch(store)
+ {
+ case hx::arrayNull:
+ case hx::arrayInt:
+ case hx::arrayInt64:
+ case hx::arrayFloat:
+ case hx::arrayObject:
+ case hx::arrayFixed:
+ return;
+ case hx::arrayEmpty:
+ MakeIntArray();
+ break;
+ case hx::arrayBool:
+ case hx::arrayString:
+ MakeObjectArray();
+ break;
+ }
+ }
+
+ inline void EnsureInt64Storage()
+ {
+ switch(store)
+ {
+ case hx::arrayNull:
+ case hx::arrayInt64:
+ case hx::arrayFloat:
+ case hx::arrayObject:
+ case hx::arrayFixed:
+ return;
+ case hx::arrayInt:
+ case hx::arrayEmpty:
+ MakeInt64Array();
+ break;
+ case hx::arrayBool:
+ case hx::arrayString:
+ MakeObjectArray();
+ break;
+ }
+ }
+
+ inline void EnsureObjectStorage()
+ {
+ switch(store)
+ {
+ case hx::arrayNull:
+ case hx::arrayObject:
+ case hx::arrayFixed:
+ return;
+ case hx::arrayEmpty:
+ case hx::arrayInt:
+ case hx::arrayInt64:
+ case hx::arrayFloat:
+ case hx::arrayBool:
+ case hx::arrayString:
+ MakeObjectArray();
+ break;
+ }
+ }
+ inline void EnsureNullStorage()
+ {
+ switch(store)
+ {
+ case hx::arrayNull:
+ case hx::arrayObject:
+ case hx::arrayFixed:
+ case hx::arrayString:
+ return;
+ case hx::arrayEmpty:
+ case hx::arrayInt:
+ case hx::arrayInt64:
+ case hx::arrayFloat:
+ case hx::arrayBool:
+ MakeObjectArray();
+ break;
+ }
+ }
+
+ template<typename F> void fixType();
+ template<typename F> F castArray();
+
+ void EnsureBase();
+ void CreateEmptyArray(int inLen);
+
+ void EnsureArrayStorage(ArrayStore inValue);
+ void EnsureArrayStorage(VirtualArray inValue);
+
+ void __Mark(hx::MarkContext *__inCtx)
+ {
+ HX_MARK_OBJECT(base);
+ }
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx)
+ {
+ if (base)
+ __inCtx->visitObject( (hx::Object **)&base);
+ }
+ #endif
+
+
+ // Used by cpp.ArrayBase
+ inline int getElementSize() const { return base ? base->GetElementSize() : 0; }
+ inline int getByteCount() const { return base ? base->getByteCount() : 0; }
+ inline char * getBase() const { return base ? base->GetBase() : 0; }
+ hx::Val __SetField(const String &inString,const hx::Val &inValue ,hx::PropertyAccess inCallProp) { return null(); }
+
+ static hx::Class &__SGetClass() { return hx::ArrayBase::__mClass; }
+ hx::Class __GetClass() const;
+ String toString();
+ String __ToString() const { return const_cast<VirtualArray_obj *>(this)->toString(); }
+
+ void setData(void *inData, int inElements) { EnsureBase(); base->setData(inData, inElements); }
+ void setUnmanagedData(void *inData, int inElements) { EnsureBase(); base->setUnmanagedData(inData, inElements); }
+
+ int __GetType() const { return vtArray; }
+
+ inline size_t size() const { checkBase(); return store==hx::arrayEmpty ? 0 : base->length; }
+ inline int __length() const { checkBase(); return store==hx::arrayEmpty ? 0 : (int)base->length; }
+
+ String ItemString(int inI) { checkBase(); return store==hx::arrayEmpty ? null() : base->ItemString(inI); }
+
+ const char * __CStr() const { return store==hx::arrayEmpty ? "[]" : store==hx::arrayNull ? "null" : base->__CStr(); }
+ inline const char *GetBase() const { return base ? base->GetBase() : 0; }
+ inline char *GetBase() { return base ? base->GetBase() : 0; }
+
+ int GetElementSize() const { checkBase(); return store==hx::arrayEmpty ? 0 : base->GetElementSize(); }
+
+ inline void reserve(int inSize) const
+ {
+ if (base)
+ base->reserve(inSize);
+ }
+
+ inline int capacity()
+ {
+ if (base)
+ return base->capacity();
+ return 0;
+ }
+
+ void resize(int inLen)
+ {
+ if (!base)
+ CreateEmptyArray(inLen);
+ else
+ base->resize(inLen);
+ }
+ void __SetSize(int inLen) { resize(inLen); }
+
+ VirtualArray __SetSizeExact(int inLen=0)
+ {
+ if (!base && inLen)
+ CreateEmptyArray(inLen);
+ else if (base)
+ base->__SetSizeExact(inLen);
+ return this;
+ }
+
+ void safeSort(Dynamic sorter, bool isString) { checkBase(); if (store!=hx::arrayEmpty) base->safeSort(sorter,isString); }
+
+ inline void __unsafeStringReference(String inString) { if (base) base->__unsafeStringReference(inString); }
+
+
+ Dynamic __GetItem(int inIndex) const;
+ Dynamic __SetItem(int inIndex,Dynamic inValue);
+ hx::Val __Field(const String &inString, hx::PropertyAccess inCallProp);
+
+ template<typename T>
+ inline const T &set(int inIdx, const T &inVal)
+ {
+ if (store!=hx::arrayFixed)
+ {
+ if (inIdx>(store==hx::arrayEmpty ? 0 : (int)base->length) )
+ EnsureObjectStorage();
+ else
+ EnsureStorage(inVal);
+ }
+ base->set(inIdx, inVal);
+ return inVal;
+ }
+
+
+ template<typename T>
+ inline int push(const T &inVal)
+ {
+ if (store!=hx::arrayFixed) EnsureStorage(inVal);
+ return base->__push(Dynamic(inVal));
+ }
+
+
+ template<typename T>
+ inline VirtualArray_obj *Add(const T &inVal)
+ {
+ if (store!=hx::arrayFixed) EnsureStorage(inVal);
+ base->__push(Dynamic(inVal));
+ return this;
+ }
+
+ inline Dynamic pop() { checkBase(); return store==hx::arrayEmpty ? null() : base->__pop(); }
+
+ inline bool contains(Dynamic inValue)
+ {
+ checkBase();
+ if (store==hx::arrayEmpty)
+ return false;
+ EnsureStorage(inValue);
+ return base->__contains(inValue);
+ }
+
+ inline bool remove(Dynamic inValue)
+ {
+ checkBase();
+ if (store==hx::arrayEmpty)
+ return false;
+ EnsureStorage(inValue);
+ return base->__remove(inValue);
+ }
+
+ inline bool removeAt(int inIndex) { checkBase(); return (store!=hx::arrayEmpty) && base->__removeAt(inIndex); }
+
+ int indexOf(Dynamic inValue, Dynamic fromIndex = null())
+ {
+ checkBase();
+ if (store==hx::arrayEmpty)
+ return -1;
+ EnsureStorage(inValue);
+ return (int)base->__indexOf(inValue,fromIndex);
+ }
+ int lastIndexOf(Dynamic inValue, Dynamic fromIndex = null())
+ {
+ checkBase();
+ if (store==hx::arrayEmpty)
+ return -1;
+ EnsureStorage(inValue);
+ return (int)base->__lastIndexOf(inValue,fromIndex);
+ }
+
+ Dynamic shift() { checkBase(); return store==hx::arrayEmpty ? null() : base->__shift(); }
+
+ VirtualArray concat( VirtualArray inTail )
+ {
+ inTail->checkBase();
+ EnsureArrayStorage(inTail);
+ if (inTail->__length()<1)
+ return copy();
+ return new VirtualArray_obj( base->__concat(inTail), store==hx::arrayFixed );
+ }
+ VirtualArray copy( )
+ {
+ checkBase();
+ if (store==hx::arrayEmpty)
+ return new VirtualArray_obj(hx::arrayEmpty);
+
+ return new VirtualArray_obj(base->__copy(), store==hx::arrayFixed);
+ }
+ VirtualArray slice(int inPos, Dynamic end = null())
+ {
+ checkBase();
+ if (store==hx::arrayEmpty)
+ return new VirtualArray_obj(hx::arrayEmpty);
+ return new VirtualArray_obj(base->__slice(inPos,end), store==hx::arrayFixed);
+ }
+ VirtualArray splice(int inPos, int len);
+ VirtualArray map(Dynamic inFunc);
+ VirtualArray filter(Dynamic inFunc);
+
+ template<typename T>
+ inline VirtualArray init(int inIndex, const T &inVal)
+ {
+ if (store!=hx::arrayFixed) EnsureStorage(inVal);
+ __SetItem(inIndex,inVal);
+ return this;
+ }
+
+ inline Dynamic __unsafe_set(int inIndex, const Dynamic &val) { return __SetItem(inIndex,val); }
+ inline Dynamic __unsafe_get(int inIndex) { return __GetItem(inIndex); }
+
+
+ template<typename T>
+ inline void insert(int inPos, const T &inValue)
+ {
+ if (store!=hx::arrayFixed)
+ {
+ if (inPos>(store==hx::arrayEmpty ? 0 : (int)base->length) )
+ EnsureObjectStorage();
+ else
+ EnsureStorage(inValue);
+ }
+
+ base->__insert(inPos,inValue);
+ }
+
+ template<typename T>
+ inline void unshift(const T& inValue)
+ {
+ if (store!=hx::arrayFixed) EnsureStorage(inValue);
+ base->__unshift(inValue);
+ }
+
+ inline void reverse() { checkBase(); if (store!=hx::arrayEmpty) base->__reverse(); }
+
+ inline void qsort(Dynamic inSorter) { checkBase(); if (base) base->__qsort(inSorter); }
+
+ inline void sort(Dynamic inSorter) { checkBase(); if (base) base->__sort(inSorter); }
+
+ Dynamic iterator() { checkBase(); return !base ? getEmptyIterator() : base->__iterator(); }
+ static Dynamic getEmptyIterator();
+
+ Dynamic keyValueIterator() { checkBase(); return !base ? getEmptyIterator() : base->__keyValueIterator(); }
+
+ bool IsByteArray() const { checkBase(); return store!=hx::arrayEmpty && base->IsByteArray(); }
+
+ void zero(Dynamic inFirst, Dynamic inCount) { checkBase(); if (store!=hx::arrayEmpty) base->zero(inFirst,inCount); }
+
+ inline int memcmp(VirtualArray inOther)
+ {
+ checkBase();
+ if (store==hx::arrayEmpty)
+ return inOther->__length() == 0;
+ return base->__memcmp(inOther);
+ }
+ inline void blit(int inDestElement, cpp::VirtualArray inSourceArray, int inSourceElement, int inElementCount)
+ {
+ inSourceArray->checkBase();
+ EnsureArrayStorage(inSourceArray);
+ if (base)
+ base->__blit(inDestElement, inSourceArray, inSourceElement, inElementCount);
+ }
+
+ String join(String inSeparator) { checkBase(); if (!base) return HX_CSTRING(""); return base->__join(inSeparator); }
+
+
+ Dynamic __get(int inIndex) const { checkBase(); if (store==hx::arrayEmpty) return null(); return base->__GetItem(inIndex); }
+
+ Dynamic concat_dyn();
+ Dynamic copy_dyn();
+ Dynamic insert_dyn();
+ Dynamic iterator_dyn();
+ Dynamic keyValueIterator_dyn();
+ Dynamic join_dyn();
+ Dynamic pop_dyn();
+ Dynamic push_dyn();
+ Dynamic contains_dyn();
+ Dynamic remove_dyn();
+ Dynamic removeAt_dyn();
+ Dynamic indexOf_dyn();
+ Dynamic lastIndexOf_dyn();
+ Dynamic reverse_dyn();
+ Dynamic shift_dyn();
+ Dynamic slice_dyn();
+ Dynamic splice_dyn();
+ Dynamic sort_dyn();
+ Dynamic toString_dyn();
+ Dynamic unshift_dyn();
+ Dynamic map_dyn();
+ Dynamic filter_dyn();
+ Dynamic __SetSize_dyn();
+ Dynamic __SetSizeExact_dyn();
+ Dynamic __unsafe_get_dyn();
+ Dynamic __unsafe_set_dyn();
+ Dynamic blit_dyn();
+ Dynamic zero_dyn();
+ Dynamic memcmp_dyn();
+ Dynamic resize_dyn();
+};
+
+
+//typedef hx::ObjectPtr< VirtualArray_obj > VirtualArray;
+
+
+
+#else // !HX_VARRAY_DEFINED
+
+
+// Build dynamic array from foreign array
+template<typename SOURCE_>
+VirtualArray::VirtualArray( const Array<SOURCE_> &inRHS )
+ : super( !inRHS.mPtr ? 0 : new VirtualArray_obj( inRHS.mPtr, true) )
+{
+}
+
+
+template<typename T>
+inline VirtualArray VirtualArray::Add(const T &inVal)
+{
+ mPtr->push(inVal);
+ return *this;
+}
+
+
+inline void VirtualArray::setDynamic( const Dynamic &inRHS )
+{
+ hx::Object *ptr = inRHS.GetPtr();
+ if (ptr)
+ {
+ if (ptr->__GetClass().mPtr == super::__SGetClass().mPtr )
+ {
+ cpp::VirtualArray_obj *varray = dynamic_cast<cpp::VirtualArray_obj *>(ptr);
+ if (varray)
+ mPtr = varray;
+ else
+ mPtr = new VirtualArray_obj(dynamic_cast<cpp::ArrayBase_obj *>(ptr), true);
+ }
+ }
+}
+
+
+
+template<typename F>
+void VirtualArray_obj::fixType()
+{
+ if (store==hx::arrayFixed)
+ return;
+
+ store = hx::arrayFixed;
+ if (base && base->length>0)
+ {
+ Array<F> fixedArray = Dynamic(base);
+ base = fixedArray.mPtr;
+ }
+ else
+ {
+ base = new Array_obj<F>(0,0);
+ }
+ #ifdef HXCPP_GC_GENERATIONAL
+ if (base)
+ HX_OBJ_WB_GET(this,base);
+ #endif
+}
+
+template<typename ARRAY >
+ARRAY VirtualArray_obj::castArray()
+{
+ if (store==hx::arrayFixed)
+ return Dynamic(base);
+
+ store = hx::arrayFixed;
+ if (base && base->length>0)
+ {
+ ARRAY fixedArray = Dynamic(base);
+ base = fixedArray.mPtr;
+ #ifdef HXCPP_GC_GENERATIONAL
+ if (base)
+ HX_OBJ_WB_GET(this,base);
+ #endif
+ return fixedArray;
+ }
+ else
+ {
+ ARRAY fixedArray(0,0);
+ base = fixedArray.mPtr;
+ #ifdef HXCPP_GC_GENERATIONAL
+ if (base)
+ HX_OBJ_WB_GET(this,base);
+ #endif
+ return fixedArray;
+ }
+}
+
+template<typename SOURCE_>
+inline bool VirtualArray::operator==( const Array<SOURCE_> &inRHS )
+{
+ if (!mPtr)
+ return inRHS.mPtr;
+ return mPtr->castArray< Array<SOURCE_> >() == inRHS;
+}
+
+} // end namespace cpp
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic _hx_reslove_virtual_array(cpp::VirtualArray inArray);
+
+
+
+namespace hx
+{
+// For type inference when marking
+template<> inline void MarkMember(cpp::VirtualArray &outT,hx::MarkContext *__inCtx)
+ { HX_MARK_OBJECT(outT.mPtr); }
+
+#ifdef HXCPP_VISIT_ALLOCS
+template<> inline void VisitMember(cpp::VirtualArray &outT,hx::VisitContext *__inCtx)
+{
+ HX_VISIT_OBJECT(outT.mPtr);
+}
+#endif
+
+} // end namespace hx
+
+namespace cpp
+{
+#endif // HX_VARRAY_DEFINED
+}
+
diff --git a/Sources/c_snikket/iinclude/datetime/_DateTime/DateTime_Impl_.h b/Sources/c_snikket/iinclude/datetime/_DateTime/DateTime_Impl_.h
new file mode 100644
index 0000000..94bc87f
--- /dev/null
+++ b/Sources/c_snikket/iinclude/datetime/_DateTime/DateTime_Impl_.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_datetime__DateTime_DateTime_Impl_
+#define INCLUDED_datetime__DateTime_DateTime_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(datetime,_DateTime,DateTime_Impl_)
+
+namespace datetime{
+namespace _DateTime{
+
+
+class HXCPP_CLASS_ATTRIBUTES DateTime_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef DateTime_Impl__obj OBJ_;
+ DateTime_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x3ae93836 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="datetime._DateTime.DateTime_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"datetime._DateTime.DateTime_Impl_"); }
+
+ inline static ::hx::ObjectPtr< DateTime_Impl__obj > __new() {
+ ::hx::ObjectPtr< DateTime_Impl__obj > __this = new DateTime_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< DateTime_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ DateTime_Impl__obj *__this = (DateTime_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(DateTime_Impl__obj), false, "datetime._DateTime.DateTime_Impl_"));
+ *(void **)__this = DateTime_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~DateTime_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("DateTime_Impl_",5b,c4,e6,72); }
+
+ static int getYear(Float this1);
+ static ::Dynamic getYear_dyn();
+
+ static Float yearStart(Float this1);
+ static ::Dynamic yearStart_dyn();
+
+ static bool isLeapYear(Float this1);
+ static ::Dynamic isLeapYear_dyn();
+
+};
+
+} // end namespace datetime
+} // end namespace _DateTime
+
+#endif /* INCLUDED_datetime__DateTime_DateTime_Impl_ */
diff --git a/Sources/c_snikket/iinclude/datetime/_DateTimeInterval/DateTimeInterval_Impl_.h b/Sources/c_snikket/iinclude/datetime/_DateTimeInterval/DateTimeInterval_Impl_.h
new file mode 100644
index 0000000..2d7ed1a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/datetime/_DateTimeInterval/DateTimeInterval_Impl_.h
@@ -0,0 +1,63 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_datetime__DateTimeInterval_DateTimeInterval_Impl_
+#define INCLUDED_datetime__DateTimeInterval_DateTimeInterval_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(datetime,_DateTimeInterval,DateTimeInterval_Impl_)
+HX_DECLARE_CLASS2(datetime,cores,DateTimeIntervalCore)
+
+namespace datetime{
+namespace _DateTimeInterval{
+
+
+class HXCPP_CLASS_ATTRIBUTES DateTimeInterval_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef DateTimeInterval_Impl__obj OBJ_;
+ DateTimeInterval_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x35e51cc0 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="datetime._DateTimeInterval.DateTimeInterval_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"datetime._DateTimeInterval.DateTimeInterval_Impl_"); }
+
+ inline static ::hx::ObjectPtr< DateTimeInterval_Impl__obj > __new() {
+ ::hx::ObjectPtr< DateTimeInterval_Impl__obj > __this = new DateTimeInterval_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< DateTimeInterval_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ DateTimeInterval_Impl__obj *__this = (DateTimeInterval_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(DateTimeInterval_Impl__obj), false, "datetime._DateTimeInterval.DateTimeInterval_Impl_"));
+ *(void **)__this = DateTimeInterval_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~DateTimeInterval_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("DateTimeInterval_Impl_",80,46,d9,2e); }
+
+ static ::datetime::cores::DateTimeIntervalCore create(Float begin,Float end);
+ static ::Dynamic create_dyn();
+
+};
+
+} // end namespace datetime
+} // end namespace _DateTimeInterval
+
+#endif /* INCLUDED_datetime__DateTimeInterval_DateTimeInterval_Impl_ */
diff --git a/Sources/c_snikket/iinclude/datetime/cores/DateTimeIntervalCore.h b/Sources/c_snikket/iinclude/datetime/cores/DateTimeIntervalCore.h
new file mode 100644
index 0000000..8cfdba1
--- /dev/null
+++ b/Sources/c_snikket/iinclude/datetime/cores/DateTimeIntervalCore.h
@@ -0,0 +1,92 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_datetime_cores_DateTimeIntervalCore
+#define INCLUDED_datetime_cores_DateTimeIntervalCore
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(datetime,cores,DateTimeIntervalCore)
+
+namespace datetime{
+namespace cores{
+
+
+class HXCPP_CLASS_ATTRIBUTES DateTimeIntervalCore_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef DateTimeIntervalCore_obj OBJ_;
+ DateTimeIntervalCore_obj();
+
+ public:
+ enum { _hx_ClassId = 0x2dc1c9d4 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="datetime.cores.DateTimeIntervalCore")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"datetime.cores.DateTimeIntervalCore"); }
+ static ::hx::ObjectPtr< DateTimeIntervalCore_obj > __new();
+ static ::hx::ObjectPtr< DateTimeIntervalCore_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~DateTimeIntervalCore_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("DateTimeIntervalCore",5f,bb,ed,3d); }
+
+ bool negative;
+ Float begin;
+ Float end;
+ int years;
+ int months;
+ int days;
+ int hours;
+ int minutes;
+ int seconds;
+ int getYears();
+ ::Dynamic getYears_dyn();
+
+ int getMonths();
+ ::Dynamic getMonths_dyn();
+
+ int getTotalMonths();
+ ::Dynamic getTotalMonths_dyn();
+
+ int getDays();
+ ::Dynamic getDays_dyn();
+
+ int getTotalDays();
+ ::Dynamic getTotalDays_dyn();
+
+ int getHours();
+ ::Dynamic getHours_dyn();
+
+ int getTotalHours();
+ ::Dynamic getTotalHours_dyn();
+
+ int getMinutes();
+ ::Dynamic getMinutes_dyn();
+
+ int getTotalMinutes();
+ ::Dynamic getTotalMinutes_dyn();
+
+ int getSeconds();
+ ::Dynamic getSeconds_dyn();
+
+ Float getTotalSeconds();
+ ::Dynamic getTotalSeconds_dyn();
+
+};
+
+} // end namespace datetime
+} // end namespace cores
+
+#endif /* INCLUDED_datetime_cores_DateTimeIntervalCore */
diff --git a/Sources/c_snikket/iinclude/datetime/utils/DateTimeIntervalUtils.h b/Sources/c_snikket/iinclude/datetime/utils/DateTimeIntervalUtils.h
new file mode 100644
index 0000000..f6bc00b
--- /dev/null
+++ b/Sources/c_snikket/iinclude/datetime/utils/DateTimeIntervalUtils.h
@@ -0,0 +1,63 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_datetime_utils_DateTimeIntervalUtils
+#define INCLUDED_datetime_utils_DateTimeIntervalUtils
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(datetime,cores,DateTimeIntervalCore)
+HX_DECLARE_CLASS2(datetime,utils,DateTimeIntervalUtils)
+
+namespace datetime{
+namespace utils{
+
+
+class HXCPP_CLASS_ATTRIBUTES DateTimeIntervalUtils_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef DateTimeIntervalUtils_obj OBJ_;
+ DateTimeIntervalUtils_obj();
+
+ public:
+ enum { _hx_ClassId = 0x144eafbf };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="datetime.utils.DateTimeIntervalUtils")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"datetime.utils.DateTimeIntervalUtils"); }
+
+ inline static ::hx::ObjectPtr< DateTimeIntervalUtils_obj > __new() {
+ ::hx::ObjectPtr< DateTimeIntervalUtils_obj > __this = new DateTimeIntervalUtils_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< DateTimeIntervalUtils_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ DateTimeIntervalUtils_obj *__this = (DateTimeIntervalUtils_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(DateTimeIntervalUtils_obj), false, "datetime.utils.DateTimeIntervalUtils"));
+ *(void **)__this = DateTimeIntervalUtils_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~DateTimeIntervalUtils_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("DateTimeIntervalUtils",31,ec,93,52); }
+
+ static ::String strftime( ::datetime::cores::DateTimeIntervalCore dti,::String format);
+ static ::Dynamic strftime_dyn();
+
+};
+
+} // end namespace datetime
+} // end namespace utils
+
+#endif /* INCLUDED_datetime_utils_DateTimeIntervalUtils */
diff --git a/Sources/c_snikket/iinclude/datetime/utils/DateTimeMonthUtils.h b/Sources/c_snikket/iinclude/datetime/utils/DateTimeMonthUtils.h
new file mode 100644
index 0000000..ab9584a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/datetime/utils/DateTimeMonthUtils.h
@@ -0,0 +1,71 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_datetime_utils_DateTimeMonthUtils
+#define INCLUDED_datetime_utils_DateTimeMonthUtils
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(datetime,utils,DateTimeMonthUtils)
+
+namespace datetime{
+namespace utils{
+
+
+class HXCPP_CLASS_ATTRIBUTES DateTimeMonthUtils_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef DateTimeMonthUtils_obj OBJ_;
+ DateTimeMonthUtils_obj();
+
+ public:
+ enum { _hx_ClassId = 0x250427de };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="datetime.utils.DateTimeMonthUtils")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"datetime.utils.DateTimeMonthUtils"); }
+
+ inline static ::hx::ObjectPtr< DateTimeMonthUtils_obj > __new() {
+ ::hx::ObjectPtr< DateTimeMonthUtils_obj > __this = new DateTimeMonthUtils_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< DateTimeMonthUtils_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ DateTimeMonthUtils_obj *__this = (DateTimeMonthUtils_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(DateTimeMonthUtils_obj), false, "datetime.utils.DateTimeMonthUtils"));
+ *(void **)__this = DateTimeMonthUtils_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~DateTimeMonthUtils_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("DateTimeMonthUtils",2c,90,be,68); }
+
+ static int days(int month,::hx::Null< bool > isLeapYear);
+ static ::Dynamic days_dyn();
+
+ static int getMonth(int days,::hx::Null< bool > isLeapYear);
+ static ::Dynamic getMonth_dyn();
+
+ static int getMonthDay(int days,::hx::Null< bool > isLeapYear);
+ static ::Dynamic getMonthDay_dyn();
+
+ static int toSeconds(int month,::hx::Null< bool > isLeapYear);
+ static ::Dynamic toSeconds_dyn();
+
+};
+
+} // end namespace datetime
+} // end namespace utils
+
+#endif /* INCLUDED_datetime_utils_DateTimeMonthUtils */
diff --git a/Sources/c_snikket/iinclude/datetime/utils/DateTimeUtils.h b/Sources/c_snikket/iinclude/datetime/utils/DateTimeUtils.h
new file mode 100644
index 0000000..b774eb8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/datetime/utils/DateTimeUtils.h
@@ -0,0 +1,71 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_datetime_utils_DateTimeUtils
+#define INCLUDED_datetime_utils_DateTimeUtils
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(datetime,utils,DateTimeUtils)
+
+namespace datetime{
+namespace utils{
+
+
+class HXCPP_CLASS_ATTRIBUTES DateTimeUtils_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef DateTimeUtils_obj OBJ_;
+ DateTimeUtils_obj();
+
+ public:
+ enum { _hx_ClassId = 0x4dd3c90c };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="datetime.utils.DateTimeUtils")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"datetime.utils.DateTimeUtils"); }
+
+ inline static ::hx::ObjectPtr< DateTimeUtils_obj > __new() {
+ ::hx::ObjectPtr< DateTimeUtils_obj > __this = new DateTimeUtils_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< DateTimeUtils_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ DateTimeUtils_obj *__this = (DateTimeUtils_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(DateTimeUtils_obj), false, "datetime.utils.DateTimeUtils"));
+ *(void **)__this = DateTimeUtils_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~DateTimeUtils_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("DateTimeUtils",b6,22,76,b4); }
+
+ static Float fromString(::String str);
+ static ::Dynamic fromString_dyn();
+
+ static Float parse(::String str);
+ static ::Dynamic parse_dyn();
+
+ static Float fromIsoString(::String str);
+ static ::Dynamic fromIsoString_dyn();
+
+ static Float yearToStamp(int year);
+ static ::Dynamic yearToStamp_dyn();
+
+};
+
+} // end namespace datetime
+} // end namespace utils
+
+#endif /* INCLUDED_datetime_utils_DateTimeUtils */
diff --git a/Sources/c_snikket/iinclude/haxe/EntryPoint.h b/Sources/c_snikket/iinclude/haxe/EntryPoint.h
new file mode 100644
index 0000000..170f0e7
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/EntryPoint.h
@@ -0,0 +1,60 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_EntryPoint
+#define INCLUDED_haxe_EntryPoint
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,EntryPoint)
+
+namespace haxe{
+
+
+class HXCPP_CLASS_ATTRIBUTES EntryPoint_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef EntryPoint_obj OBJ_;
+ EntryPoint_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7dc0c864 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="haxe.EntryPoint")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"haxe.EntryPoint"); }
+
+ inline static ::hx::ObjectPtr< EntryPoint_obj > __new() {
+ ::hx::ObjectPtr< EntryPoint_obj > __this = new EntryPoint_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< EntryPoint_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ EntryPoint_obj *__this = (EntryPoint_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(EntryPoint_obj), false, "haxe.EntryPoint"));
+ *(void **)__this = EntryPoint_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~EntryPoint_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("EntryPoint",9e,d2,23,a2); }
+
+ static void run();
+ static ::Dynamic run_dyn();
+
+};
+
+} // end namespace haxe
+
+#endif /* INCLUDED_haxe_EntryPoint */
diff --git a/Sources/c_snikket/iinclude/haxe/Exception.h b/Sources/c_snikket/iinclude/haxe/Exception.h
new file mode 100644
index 0000000..5e7cabd
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/Exception.h
@@ -0,0 +1,65 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_Exception
+#define INCLUDED_haxe_Exception
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,Exception)
+
+namespace haxe{
+
+
+class HXCPP_CLASS_ATTRIBUTES Exception_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Exception_obj OBJ_;
+ Exception_obj();
+
+ public:
+ enum { _hx_ClassId = 0x677ddc49 };
+
+ void __construct(::String message, ::haxe::Exception previous, ::Dynamic native);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.Exception")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.Exception"); }
+ static ::hx::ObjectPtr< Exception_obj > __new(::String message, ::haxe::Exception previous, ::Dynamic native);
+ static ::hx::ObjectPtr< Exception_obj > __alloc(::hx::Ctx *_hx_ctx,::String message, ::haxe::Exception previous, ::Dynamic native);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Exception_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Exception",2f,f0,6c,eb); }
+
+ static ::haxe::Exception caught( ::Dynamic value);
+ static ::Dynamic caught_dyn();
+
+ ::String _hx___exceptionMessage;
+ ::Array< ::String > _hx___nativeStack;
+ int _hx___skipStack;
+ ::Dynamic _hx___nativeException;
+ ::haxe::Exception _hx___previousException;
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+ ::String get_message();
+ ::Dynamic get_message_dyn();
+
+};
+
+} // end namespace haxe
+
+#endif /* INCLUDED_haxe_Exception */
diff --git a/Sources/c_snikket/iinclude/haxe/IMap.h b/Sources/c_snikket/iinclude/haxe/IMap.h
new file mode 100644
index 0000000..b3e5b1a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/IMap.h
@@ -0,0 +1,31 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_IMap
+#define INCLUDED_haxe_IMap
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,IMap)
+
+namespace haxe{
+
+
+class HXCPP_CLASS_ATTRIBUTES IMap_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ ::Dynamic (::hx::Object :: *_hx_get)( ::Dynamic k);
+ static inline ::Dynamic get( ::Dynamic _hx_, ::Dynamic k) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::haxe::IMap_obj *>(_hx_.mPtr->_hx_getInterface(0x09c2bd39)))->_hx_get)(k);
+ }
+ ::Dynamic (::hx::Object :: *_hx_keys)();
+ static inline ::Dynamic keys( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::haxe::IMap_obj *>(_hx_.mPtr->_hx_getInterface(0x09c2bd39)))->_hx_keys)();
+ }
+};
+
+} // end namespace haxe
+
+#endif /* INCLUDED_haxe_IMap */
diff --git a/Sources/c_snikket/iinclude/haxe/Log.h b/Sources/c_snikket/iinclude/haxe/Log.h
new file mode 100644
index 0000000..86c3163
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/Log.h
@@ -0,0 +1,62 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_Log
+#define INCLUDED_haxe_Log
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,Log)
+
+namespace haxe{
+
+
+class HXCPP_CLASS_ATTRIBUTES Log_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Log_obj OBJ_;
+ Log_obj();
+
+ public:
+ enum { _hx_ClassId = 0x3c235b1a };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="haxe.Log")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"haxe.Log"); }
+
+ inline static ::hx::ObjectPtr< Log_obj > __new() {
+ ::hx::ObjectPtr< Log_obj > __this = new Log_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Log_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Log_obj *__this = (Log_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Log_obj), false, "haxe.Log"));
+ *(void **)__this = Log_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Log_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Log",64,0c,3a,00); }
+
+ static void __boot();
+ static ::Dynamic trace;
+ static inline ::Dynamic &trace_dyn() {return trace; }
+
+};
+
+} // end namespace haxe
+
+#endif /* INCLUDED_haxe_Log */
diff --git a/Sources/c_snikket/iinclude/haxe/MainEvent.h b/Sources/c_snikket/iinclude/haxe/MainEvent.h
new file mode 100644
index 0000000..472de6e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/MainEvent.h
@@ -0,0 +1,57 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_MainEvent
+#define INCLUDED_haxe_MainEvent
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,MainEvent)
+
+namespace haxe{
+
+
+class HXCPP_CLASS_ATTRIBUTES MainEvent_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef MainEvent_obj OBJ_;
+ MainEvent_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0b5efb53 };
+
+ void __construct( ::Dynamic f,int p);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.MainEvent")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.MainEvent"); }
+ static ::hx::ObjectPtr< MainEvent_obj > __new( ::Dynamic f,int p);
+ static ::hx::ObjectPtr< MainEvent_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic f,int p);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~MainEvent_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("MainEvent",01,71,3b,31); }
+
+ ::Dynamic f;
+ Dynamic f_dyn() { return f;}
+ ::haxe::MainEvent prev;
+ ::haxe::MainEvent next;
+ bool isBlocking;
+ Float nextRun;
+ int priority;
+};
+
+} // end namespace haxe
+
+#endif /* INCLUDED_haxe_MainEvent */
diff --git a/Sources/c_snikket/iinclude/haxe/MainLoop.h b/Sources/c_snikket/iinclude/haxe/MainLoop.h
new file mode 100644
index 0000000..d8ad31a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/MainLoop.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_MainLoop
+#define INCLUDED_haxe_MainLoop
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,MainEvent)
+HX_DECLARE_CLASS1(haxe,MainLoop)
+
+namespace haxe{
+
+
+class HXCPP_CLASS_ATTRIBUTES MainLoop_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef MainLoop_obj OBJ_;
+ MainLoop_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0c7b74e7 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="haxe.MainLoop")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"haxe.MainLoop"); }
+
+ inline static ::hx::ObjectPtr< MainLoop_obj > __new() {
+ ::hx::ObjectPtr< MainLoop_obj > __this = new MainLoop_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< MainLoop_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ MainLoop_obj *__this = (MainLoop_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(MainLoop_obj), false, "haxe.MainLoop"));
+ *(void **)__this = MainLoop_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~MainLoop_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("MainLoop",5d,d7,eb,79); }
+
+ static ::haxe::MainEvent pending;
+ static bool hasEvents();
+ static ::Dynamic hasEvents_dyn();
+
+ static void sortEvents();
+ static ::Dynamic sortEvents_dyn();
+
+ static Float tick();
+ static ::Dynamic tick_dyn();
+
+};
+
+} // end namespace haxe
+
+#endif /* INCLUDED_haxe_MainLoop */
diff --git a/Sources/c_snikket/iinclude/haxe/NativeStackTrace.h b/Sources/c_snikket/iinclude/haxe/NativeStackTrace.h
new file mode 100644
index 0000000..dc1054c
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/NativeStackTrace.h
@@ -0,0 +1,66 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_NativeStackTrace
+#define INCLUDED_haxe_NativeStackTrace
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,NativeStackTrace)
+
+namespace haxe{
+
+
+class HXCPP_CLASS_ATTRIBUTES NativeStackTrace_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef NativeStackTrace_obj OBJ_;
+ NativeStackTrace_obj();
+
+ public:
+ enum { _hx_ClassId = 0x3984963e };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="haxe.NativeStackTrace")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"haxe.NativeStackTrace"); }
+
+ inline static ::hx::ObjectPtr< NativeStackTrace_obj > __new() {
+ ::hx::ObjectPtr< NativeStackTrace_obj > __this = new NativeStackTrace_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< NativeStackTrace_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ NativeStackTrace_obj *__this = (NativeStackTrace_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(NativeStackTrace_obj), false, "haxe.NativeStackTrace"));
+ *(void **)__this = NativeStackTrace_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~NativeStackTrace_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("NativeStackTrace",b4,5e,6d,3c); }
+
+ static void saveStack( ::Dynamic exception);
+ static ::Dynamic saveStack_dyn();
+
+ static ::Array< ::String > callStack();
+ static ::Dynamic callStack_dyn();
+
+ static ::Array< ::String > exceptionStack();
+ static ::Dynamic exceptionStack_dyn();
+
+};
+
+} // end namespace haxe
+
+#endif /* INCLUDED_haxe_NativeStackTrace */
diff --git a/Sources/c_snikket/iinclude/haxe/StackItem.h b/Sources/c_snikket/iinclude/haxe/StackItem.h
new file mode 100644
index 0000000..bf28552
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/StackItem.h
@@ -0,0 +1,41 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_StackItem
+#define INCLUDED_haxe_StackItem
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,StackItem)
+namespace haxe{
+
+
+class StackItem_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef StackItem_obj OBJ_;
+
+ public:
+ StackItem_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("haxe.StackItem",13,26,c7,2d); }
+ ::String __ToString() const { return HX_("StackItem.",73,53,dc,cb) + _hx_tag; }
+
+ static ::haxe::StackItem CFunction;
+ static inline ::haxe::StackItem CFunction_dyn() { return CFunction; }
+ static ::haxe::StackItem FilePos( ::haxe::StackItem s,::String file,int line, ::Dynamic column);
+ static ::Dynamic FilePos_dyn();
+ static ::haxe::StackItem LocalFunction( ::Dynamic v);
+ static ::Dynamic LocalFunction_dyn();
+ static ::haxe::StackItem Method(::String classname,::String method);
+ static ::Dynamic Method_dyn();
+ static ::haxe::StackItem Module(::String m);
+ static ::Dynamic Module_dyn();
+};
+
+} // end namespace haxe
+
+#endif /* INCLUDED_haxe_StackItem */
diff --git a/Sources/c_snikket/iinclude/haxe/Timer.h b/Sources/c_snikket/iinclude/haxe/Timer.h
new file mode 100644
index 0000000..27ba251
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/Timer.h
@@ -0,0 +1,65 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_Timer
+#define INCLUDED_haxe_Timer
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,Timer)
+HX_DECLARE_CLASS3(sys,thread,_EventLoop,RegularEvent)
+HX_DECLARE_CLASS3(sys,thread,_Thread,HaxeThread)
+
+namespace haxe{
+
+
+class HXCPP_CLASS_ATTRIBUTES Timer_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Timer_obj OBJ_;
+ Timer_obj();
+
+ public:
+ enum { _hx_ClassId = 0x04eaa0bb };
+
+ void __construct(int time_ms);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.Timer")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.Timer"); }
+ static ::hx::ObjectPtr< Timer_obj > __new(int time_ms);
+ static ::hx::ObjectPtr< Timer_obj > __alloc(::hx::Ctx *_hx_ctx,int time_ms);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ static void __alloc_dynamic_functions(::hx::Ctx *_hx_alloc,Timer_obj *_hx_obj);
+ //~Timer_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Timer",a5,2f,63,a3); }
+
+ static ::haxe::Timer delay( ::Dynamic f,int time_ms);
+ static ::Dynamic delay_dyn();
+
+ ::sys::thread::_Thread::HaxeThread thread;
+ ::sys::thread::_EventLoop::RegularEvent eventHandler;
+ void stop();
+ ::Dynamic stop_dyn();
+
+ ::Dynamic run;
+ inline ::Dynamic &run_dyn() {return run; }
+
+};
+
+} // end namespace haxe
+
+#endif /* INCLUDED_haxe_Timer */
diff --git a/Sources/c_snikket/iinclude/haxe/ValueException.h b/Sources/c_snikket/iinclude/haxe/ValueException.h
new file mode 100644
index 0000000..b515757
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/ValueException.h
@@ -0,0 +1,55 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_ValueException
+#define INCLUDED_haxe_ValueException
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_Exception
+#include <haxe/Exception.h>
+#endif
+HX_DECLARE_CLASS1(haxe,Exception)
+HX_DECLARE_CLASS1(haxe,ValueException)
+
+namespace haxe{
+
+
+class HXCPP_CLASS_ATTRIBUTES ValueException_obj : public ::haxe::Exception_obj
+{
+ public:
+ typedef ::haxe::Exception_obj super;
+ typedef ValueException_obj OBJ_;
+ ValueException_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0af01d58 };
+
+ void __construct( ::Dynamic value, ::haxe::Exception previous, ::Dynamic native);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.ValueException")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.ValueException"); }
+ static ::hx::ObjectPtr< ValueException_obj > __new( ::Dynamic value, ::haxe::Exception previous, ::Dynamic native);
+ static ::hx::ObjectPtr< ValueException_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic value, ::haxe::Exception previous, ::Dynamic native);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ValueException_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("ValueException",be,0e,61,3f); }
+
+ ::Dynamic value;
+};
+
+} // end namespace haxe
+
+#endif /* INCLUDED_haxe_ValueException */
diff --git a/Sources/c_snikket/iinclude/haxe/crypto/Base64.h b/Sources/c_snikket/iinclude/haxe/crypto/Base64.h
new file mode 100644
index 0000000..0f00eaf
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/crypto/Base64.h
@@ -0,0 +1,78 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_crypto_Base64
+#define INCLUDED_haxe_crypto_Base64
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,crypto,Base64)
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+
+namespace haxe{
+namespace crypto{
+
+
+class HXCPP_CLASS_ATTRIBUTES Base64_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Base64_obj OBJ_;
+ Base64_obj();
+
+ public:
+ enum { _hx_ClassId = 0x08b38de6 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="haxe.crypto.Base64")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"haxe.crypto.Base64"); }
+
+ inline static ::hx::ObjectPtr< Base64_obj > __new() {
+ ::hx::ObjectPtr< Base64_obj > __this = new Base64_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Base64_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Base64_obj *__this = (Base64_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Base64_obj), false, "haxe.crypto.Base64"));
+ *(void **)__this = Base64_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Base64_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Base64",af,71,bc,89); }
+
+ static void __boot();
+ static ::String CHARS;
+ static ::haxe::io::Bytes BYTES;
+ static ::String URL_CHARS;
+ static ::haxe::io::Bytes URL_BYTES;
+ static ::String encode( ::haxe::io::Bytes bytes,::hx::Null< bool > complement);
+ static ::Dynamic encode_dyn();
+
+ static ::haxe::io::Bytes decode(::String str,::hx::Null< bool > complement);
+ static ::Dynamic decode_dyn();
+
+ static ::String urlEncode( ::haxe::io::Bytes bytes,::hx::Null< bool > complement);
+ static ::Dynamic urlEncode_dyn();
+
+ static ::haxe::io::Bytes urlDecode(::String str,::hx::Null< bool > complement);
+ static ::Dynamic urlDecode_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace crypto
+
+#endif /* INCLUDED_haxe_crypto_Base64 */
diff --git a/Sources/c_snikket/iinclude/haxe/crypto/BaseCode.h b/Sources/c_snikket/iinclude/haxe/crypto/BaseCode.h
new file mode 100644
index 0000000..bd80353
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/crypto/BaseCode.h
@@ -0,0 +1,65 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_crypto_BaseCode
+#define INCLUDED_haxe_crypto_BaseCode
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,crypto,BaseCode)
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+
+namespace haxe{
+namespace crypto{
+
+
+class HXCPP_CLASS_ATTRIBUTES BaseCode_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef BaseCode_obj OBJ_;
+ BaseCode_obj();
+
+ public:
+ enum { _hx_ClassId = 0x34980465 };
+
+ void __construct( ::haxe::io::Bytes base);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.crypto.BaseCode")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.crypto.BaseCode"); }
+ static ::hx::ObjectPtr< BaseCode_obj > __new( ::haxe::io::Bytes base);
+ static ::hx::ObjectPtr< BaseCode_obj > __alloc(::hx::Ctx *_hx_ctx, ::haxe::io::Bytes base);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~BaseCode_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("BaseCode",fe,5d,c4,cf); }
+
+ ::haxe::io::Bytes base;
+ int nbits;
+ ::Array< int > tbl;
+ ::haxe::io::Bytes encodeBytes( ::haxe::io::Bytes b);
+ ::Dynamic encodeBytes_dyn();
+
+ void initTable();
+ ::Dynamic initTable_dyn();
+
+ ::haxe::io::Bytes decodeBytes( ::haxe::io::Bytes b);
+ ::Dynamic decodeBytes_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace crypto
+
+#endif /* INCLUDED_haxe_crypto_BaseCode */
diff --git a/Sources/c_snikket/iinclude/haxe/crypto/Sha1.h b/Sources/c_snikket/iinclude/haxe/crypto/Sha1.h
new file mode 100644
index 0000000..e2986e1
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/crypto/Sha1.h
@@ -0,0 +1,81 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_crypto_Sha1
+#define INCLUDED_haxe_crypto_Sha1
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_b388adc1457cbfc2_48_new)
+HX_DECLARE_CLASS2(haxe,crypto,Sha1)
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+
+namespace haxe{
+namespace crypto{
+
+
+class HXCPP_CLASS_ATTRIBUTES Sha1_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Sha1_obj OBJ_;
+ Sha1_obj();
+
+ public:
+ enum { _hx_ClassId = 0x3a249b8c };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="haxe.crypto.Sha1")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"haxe.crypto.Sha1"); }
+
+ inline static ::hx::ObjectPtr< Sha1_obj > __new() {
+ ::hx::ObjectPtr< Sha1_obj > __this = new Sha1_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Sha1_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Sha1_obj *__this = (Sha1_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Sha1_obj), false, "haxe.crypto.Sha1"));
+ *(void **)__this = Sha1_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_b388adc1457cbfc2_48_new)
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Sha1_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Sha1",a5,f4,2b,37); }
+
+ static ::haxe::io::Bytes make( ::haxe::io::Bytes b);
+ static ::Dynamic make_dyn();
+
+ static ::Array< int > bytes2blks( ::haxe::io::Bytes b);
+ static ::Dynamic bytes2blks_dyn();
+
+ ::Array< int > doEncode(::Array< int > x);
+ ::Dynamic doEncode_dyn();
+
+ int ft(int t,int b,int c,int d);
+ ::Dynamic ft_dyn();
+
+ int kt(int t);
+ ::Dynamic kt_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace crypto
+
+#endif /* INCLUDED_haxe_crypto_Sha1 */
diff --git a/Sources/c_snikket/iinclude/haxe/crypto/Sha256.h b/Sources/c_snikket/iinclude/haxe/crypto/Sha256.h
new file mode 100644
index 0000000..6851954
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/crypto/Sha256.h
@@ -0,0 +1,75 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_crypto_Sha256
+#define INCLUDED_haxe_crypto_Sha256
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_0a4e95b4276e5057_48_new)
+HX_DECLARE_CLASS2(haxe,crypto,Sha256)
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+
+namespace haxe{
+namespace crypto{
+
+
+class HXCPP_CLASS_ATTRIBUTES Sha256_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Sha256_obj OBJ_;
+ Sha256_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0c0976ea };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="haxe.crypto.Sha256")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"haxe.crypto.Sha256"); }
+
+ inline static ::hx::ObjectPtr< Sha256_obj > __new() {
+ ::hx::ObjectPtr< Sha256_obj > __this = new Sha256_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Sha256_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Sha256_obj *__this = (Sha256_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Sha256_obj), false, "haxe.crypto.Sha256"));
+ *(void **)__this = Sha256_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_0a4e95b4276e5057_48_new)
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Sha256_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Sha256",87,18,8f,51); }
+
+ static ::haxe::io::Bytes make( ::haxe::io::Bytes b);
+ static ::Dynamic make_dyn();
+
+ static ::Array< int > bytes2blks( ::haxe::io::Bytes b);
+ static ::Dynamic bytes2blks_dyn();
+
+ ::Array< int > doEncode(::Array< int > m,int l);
+ ::Dynamic doEncode_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace crypto
+
+#endif /* INCLUDED_haxe_crypto_Sha256 */
diff --git a/Sources/c_snikket/iinclude/haxe/ds/BalancedTree.h b/Sources/c_snikket/iinclude/haxe/ds/BalancedTree.h
new file mode 100644
index 0000000..4f5b9e6
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/ds/BalancedTree.h
@@ -0,0 +1,83 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_ds_BalancedTree
+#define INCLUDED_haxe_ds_BalancedTree
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,BalancedTree)
+HX_DECLARE_CLASS2(haxe,ds,TreeNode)
+
+namespace haxe{
+namespace ds{
+
+
+class HXCPP_CLASS_ATTRIBUTES BalancedTree_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef BalancedTree_obj OBJ_;
+ BalancedTree_obj();
+
+ public:
+ enum { _hx_ClassId = 0x4cc9cf7f };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.ds.BalancedTree")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.ds.BalancedTree"); }
+ static ::hx::ObjectPtr< BalancedTree_obj > __new();
+ static ::hx::ObjectPtr< BalancedTree_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~BalancedTree_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("BalancedTree",66,71,f8,aa); }
+
+ ::haxe::ds::TreeNode root;
+ void set( ::Dynamic key, ::Dynamic value);
+ ::Dynamic set_dyn();
+
+ ::Dynamic get( ::Dynamic key);
+ ::Dynamic get_dyn();
+
+ bool exists( ::Dynamic key);
+ ::Dynamic exists_dyn();
+
+ ::Dynamic keys();
+ ::Dynamic keys_dyn();
+
+ ::haxe::ds::TreeNode setLoop( ::Dynamic k, ::Dynamic v, ::haxe::ds::TreeNode node);
+ ::Dynamic setLoop_dyn();
+
+ void keysLoop( ::haxe::ds::TreeNode node,::cpp::VirtualArray acc);
+ ::Dynamic keysLoop_dyn();
+
+ ::haxe::ds::TreeNode balance( ::haxe::ds::TreeNode l, ::Dynamic k, ::Dynamic v, ::haxe::ds::TreeNode r);
+ ::Dynamic balance_dyn();
+
+ virtual int compare( ::Dynamic k1, ::Dynamic k2);
+ ::Dynamic compare_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace ds
+
+#endif /* INCLUDED_haxe_ds_BalancedTree */
diff --git a/Sources/c_snikket/iinclude/haxe/ds/Either.h b/Sources/c_snikket/iinclude/haxe/ds/Either.h
new file mode 100644
index 0000000..64e3fd7
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/ds/Either.h
@@ -0,0 +1,37 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_ds_Either
+#define INCLUDED_haxe_ds_Either
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,ds,Either)
+namespace haxe{
+namespace ds{
+
+
+class Either_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef Either_obj OBJ_;
+
+ public:
+ Either_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("haxe.ds.Either",1c,1a,b7,a4); }
+ ::String __ToString() const { return HX_("Either.",29,67,48,40) + _hx_tag; }
+
+ static ::haxe::ds::Either Left( ::Dynamic v);
+ static ::Dynamic Left_dyn();
+ static ::haxe::ds::Either Right( ::Dynamic v);
+ static ::Dynamic Right_dyn();
+};
+
+} // end namespace haxe
+} // end namespace ds
+
+#endif /* INCLUDED_haxe_ds_Either */
diff --git a/Sources/c_snikket/iinclude/haxe/ds/EnumValueMap.h b/Sources/c_snikket/iinclude/haxe/ds/EnumValueMap.h
new file mode 100644
index 0000000..48f7525
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/ds/EnumValueMap.h
@@ -0,0 +1,65 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_ds_EnumValueMap
+#define INCLUDED_haxe_ds_EnumValueMap
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_ds_BalancedTree
+#include <haxe/ds/BalancedTree.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,BalancedTree)
+HX_DECLARE_CLASS2(haxe,ds,EnumValueMap)
+
+namespace haxe{
+namespace ds{
+
+
+class HXCPP_CLASS_ATTRIBUTES EnumValueMap_obj : public ::haxe::ds::BalancedTree_obj
+{
+ public:
+ typedef ::haxe::ds::BalancedTree_obj super;
+ typedef EnumValueMap_obj OBJ_;
+ EnumValueMap_obj();
+
+ public:
+ enum { _hx_ClassId = 0x34ccfa05 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.ds.EnumValueMap")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.ds.EnumValueMap"); }
+ static ::hx::ObjectPtr< EnumValueMap_obj > __new();
+ static ::hx::ObjectPtr< EnumValueMap_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~EnumValueMap_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("EnumValueMap",ec,9b,fb,92); }
+
+ int compare( ::Dynamic _tmp_k1, ::Dynamic _tmp_k2);
+
+ int compareArgs(::cpp::VirtualArray a1,::cpp::VirtualArray a2);
+ ::Dynamic compareArgs_dyn();
+
+ int compareArg( ::Dynamic v1, ::Dynamic v2);
+ ::Dynamic compareArg_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace ds
+
+#endif /* INCLUDED_haxe_ds_EnumValueMap */
diff --git a/Sources/c_snikket/iinclude/haxe/ds/IntMap.h b/Sources/c_snikket/iinclude/haxe/ds/IntMap.h
new file mode 100644
index 0000000..c5e3745
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/ds/IntMap.h
@@ -0,0 +1,102 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_ds_IntMap
+#define INCLUDED_haxe_ds_IntMap
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,IntMap)
+
+namespace haxe{
+namespace ds{
+
+
+class HXCPP_CLASS_ATTRIBUTES IntMap_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef IntMap_obj OBJ_;
+ IntMap_obj();
+
+ public:
+ enum { _hx_ClassId = 0x269a1502 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.ds.IntMap")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.ds.IntMap"); }
+ static ::hx::ObjectPtr< IntMap_obj > __new();
+ static ::hx::ObjectPtr< IntMap_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~IntMap_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::Dynamic get_a7a2487a( ::Dynamic k);
+ ::String __ToString() const { return HX_("IntMap",0d,a9,08,d3); }
+
+ ::Dynamic h;
+ void set(int key, ::Dynamic value);
+ ::Dynamic set_dyn();
+
+ ::Dynamic get(int key);
+ ::Dynamic get_dyn();
+
+ bool remove(int key);
+ ::Dynamic remove_dyn();
+
+ ::Dynamic keys();
+ ::Dynamic keys_dyn();
+
+
+ inline void set(int key, ::null value) { __int_hash_set(HX_MAP_THIS,key,value); }
+ inline void set(int key, bool value) { __int_hash_set(HX_MAP_THIS,key,value); }
+ inline void set(int key, char value) { __int_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(int key, unsigned char value) { __int_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(int key, signed char value) { __int_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(int key, short value) { __int_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(int key, unsigned short value) { __int_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(int key, int value) { __int_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(int key, unsigned int value) { __int_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(int key, float value) { __int_hash_set_float(HX_MAP_THIS,key,value); }
+ inline void set(int key, double value) { __int_hash_set_float(HX_MAP_THIS,key,value); }
+ inline void set(int key, ::String value) { __int_hash_set_string(HX_MAP_THIS,key,value); }
+ inline void set(int key, cpp::Int64 value) { __int_hash_set_int64(HX_MAP_THIS,key,value); }
+
+ template<typename V, typename H>
+ inline void set(int key, const ::cpp::Struct<V,H> &value) {__int_hash_set(HX_MAP_THIS,key,value); }
+ template<typename F>
+ inline void set(int key, const ::cpp::Function<F> &value) {__int_hash_set(HX_MAP_THIS,key,value); }
+ template<typename V>
+ inline void set(int key, const ::cpp::Pointer<V> &value) {__int_hash_set(HX_MAP_THIS,key,(Dynamic)value ); }
+
+ template<typename VALUE>
+ inline void set(Dynamic &key, const VALUE &value) { set( (int)key, value ); }
+
+ inline bool get_bool(int key) { return __int_hash_get_bool(h,key); }
+ inline int get_int(int key) { return __int_hash_get_int(h,key); }
+ inline Float get_float(int key) { return __int_hash_get_float(h,key); }
+ inline String get_string(int key) { return __int_hash_get_string(h,key); }
+ inline cpp::Int64 get_int64(int key) { return __int_hash_get_int64(h,key); }
+
+};
+
+} // end namespace haxe
+} // end namespace ds
+
+#endif /* INCLUDED_haxe_ds_IntMap */
diff --git a/Sources/c_snikket/iinclude/haxe/ds/List.h b/Sources/c_snikket/iinclude/haxe/ds/List.h
new file mode 100644
index 0000000..f0559ec
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/ds/List.h
@@ -0,0 +1,62 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_ds_List
+#define INCLUDED_haxe_ds_List
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,ds,List)
+HX_DECLARE_CLASS3(haxe,ds,_List,ListNode)
+
+namespace haxe{
+namespace ds{
+
+
+class HXCPP_CLASS_ATTRIBUTES List_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef List_obj OBJ_;
+ List_obj();
+
+ public:
+ enum { _hx_ClassId = 0x39a75d33 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.ds.List")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.ds.List"); }
+ static ::hx::ObjectPtr< List_obj > __new();
+ static ::hx::ObjectPtr< List_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~List_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("List",7e,48,8c,32); }
+
+ ::haxe::ds::_List::ListNode h;
+ ::haxe::ds::_List::ListNode q;
+ int length;
+ void push( ::Dynamic item);
+ ::Dynamic push_dyn();
+
+ ::Dynamic pop();
+ ::Dynamic pop_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace ds
+
+#endif /* INCLUDED_haxe_ds_List */
diff --git a/Sources/c_snikket/iinclude/haxe/ds/ObjectMap.h b/Sources/c_snikket/iinclude/haxe/ds/ObjectMap.h
new file mode 100644
index 0000000..02cde81
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/ds/ObjectMap.h
@@ -0,0 +1,96 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_ds_ObjectMap
+#define INCLUDED_haxe_ds_ObjectMap
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,ObjectMap)
+
+namespace haxe{
+namespace ds{
+
+
+class HXCPP_CLASS_ATTRIBUTES ObjectMap_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef ObjectMap_obj OBJ_;
+ ObjectMap_obj();
+
+ public:
+ enum { _hx_ClassId = 0x6cba6d44 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.ds.ObjectMap")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.ds.ObjectMap"); }
+ static ::hx::ObjectPtr< ObjectMap_obj > __new();
+ static ::hx::ObjectPtr< ObjectMap_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ObjectMap_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("ObjectMap",fd,a4,50,e5); }
+
+ ::Dynamic h;
+ void set( ::Dynamic key, ::Dynamic value);
+ ::Dynamic set_dyn();
+
+ ::Dynamic get( ::Dynamic key);
+ ::Dynamic get_dyn();
+
+ ::Dynamic keys();
+ ::Dynamic keys_dyn();
+
+
+ inline void set(Dynamic key, ::null value) { __object_hash_set(HX_MAP_THIS,key,value); }
+ inline void set(Dynamic key, bool value) { __object_hash_set(HX_MAP_THIS,key,value); }
+ inline void set(Dynamic key, char value) { __object_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(Dynamic key, unsigned char value) { __object_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(Dynamic key, signed char value) { __object_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(Dynamic key, short value) { __object_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(Dynamic key, unsigned short value) { __object_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(Dynamic key, int value) { __object_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(Dynamic key, unsigned int value) { __object_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(Dynamic key, float value) { __object_hash_set_float(HX_MAP_THIS,key,value); }
+ inline void set(Dynamic key, double value) { __object_hash_set_float(HX_MAP_THIS,key,value); }
+ inline void set(Dynamic key, ::String value) { __object_hash_set_string(HX_MAP_THIS,key,value); }
+ inline void set(Dynamic key, cpp::Int64 value) { __object_hash_set_int64(HX_MAP_THIS,key,value); }
+
+
+ template<typename V, typename H>
+ inline void set(Dynamic key, const ::cpp::Struct<V,H> &value) {__object_hash_set(HX_MAP_THIS,key,value); }
+ template<typename V>
+ inline void set(Dynamic key, const ::cpp::Function<V> &value) {__object_hash_set(HX_MAP_THIS,key,(Dynamic)value ); }
+ template<typename V>
+ inline void set(Dynamic key, const ::cpp::Pointer<V> &value) {__object_hash_set(HX_MAP_THIS,key,(Dynamic)value ); }
+
+ inline bool get_bool(Dynamic key) { return __object_hash_get_bool(h,key); }
+ inline int get_int(Dynamic key) { return __object_hash_get_int(h,key); }
+ inline Float get_float(Dynamic key) { return __object_hash_get_float(h,key); }
+ inline String get_string(Dynamic key) { return __object_hash_get_string(h,key); }
+ inline cpp::Int64 get_int64(Dynamic key) { return __object_hash_get_int64(h,key); }
+
+};
+
+} // end namespace haxe
+} // end namespace ds
+
+#endif /* INCLUDED_haxe_ds_ObjectMap */
diff --git a/Sources/c_snikket/iinclude/haxe/ds/Option.h b/Sources/c_snikket/iinclude/haxe/ds/Option.h
new file mode 100644
index 0000000..f2703eb
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/ds/Option.h
@@ -0,0 +1,37 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_ds_Option
+#define INCLUDED_haxe_ds_Option
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,ds,Option)
+namespace haxe{
+namespace ds{
+
+
+class Option_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef Option_obj OBJ_;
+
+ public:
+ Option_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("haxe.ds.Option",4c,90,17,ac); }
+ ::String __ToString() const { return HX_("Option.",f9,5a,4f,ad) + _hx_tag; }
+
+ static ::haxe::ds::Option None;
+ static inline ::haxe::ds::Option None_dyn() { return None; }
+ static ::haxe::ds::Option Some( ::Dynamic v);
+ static ::Dynamic Some_dyn();
+};
+
+} // end namespace haxe
+} // end namespace ds
+
+#endif /* INCLUDED_haxe_ds_Option */
diff --git a/Sources/c_snikket/iinclude/haxe/ds/StringMap.h b/Sources/c_snikket/iinclude/haxe/ds/StringMap.h
new file mode 100644
index 0000000..527e7db
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/ds/StringMap.h
@@ -0,0 +1,111 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_ds_StringMap
+#define INCLUDED_haxe_ds_StringMap
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+
+namespace haxe{
+namespace ds{
+
+
+class HXCPP_CLASS_ATTRIBUTES StringMap_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef StringMap_obj OBJ_;
+ StringMap_obj();
+
+ public:
+ enum { _hx_ClassId = 0x4260cd56 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.ds.StringMap")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.ds.StringMap"); }
+ static ::hx::ObjectPtr< StringMap_obj > __new();
+ static ::hx::ObjectPtr< StringMap_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~StringMap_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::Dynamic get_a7a2487a( ::Dynamic k);
+ ::String __ToString() const { return HX_("StringMap",2b,12,8c,69); }
+
+ ::Dynamic h;
+ void set(::String key, ::Dynamic value);
+ ::Dynamic set_dyn();
+
+ ::Dynamic get(::String key);
+ ::Dynamic get_dyn();
+
+ bool exists(::String key);
+ ::Dynamic exists_dyn();
+
+ bool remove(::String key);
+ ::Dynamic remove_dyn();
+
+ ::Dynamic keys();
+ ::Dynamic keys_dyn();
+
+ ::Dynamic iterator();
+ ::Dynamic iterator_dyn();
+
+ void clear();
+ ::Dynamic clear_dyn();
+
+
+ inline void set(String key, ::null value) { __string_hash_set(HX_MAP_THIS,key,value); }
+ inline void set(String key, bool value) { __string_hash_set(HX_MAP_THIS,key,value); }
+ inline void set(String key, char value) { __string_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(String key, unsigned char value) { __string_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(String key, signed char value) { __string_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(String key, short value) { __string_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(String key, unsigned short value) { __string_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(String key, int value) { __string_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(String key, unsigned int value) { __string_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(String key, float value) { __string_hash_set_float(HX_MAP_THIS,key,value); }
+ inline void set(String key, double value) { __string_hash_set_float(HX_MAP_THIS,key,value); }
+ inline void set(String key, ::String value) { __string_hash_set_string(HX_MAP_THIS,key,value); }
+ inline void set(String key, cpp::Int64 value) { __string_hash_set_int64(HX_MAP_THIS,key,value); }
+
+ template<typename V, typename H>
+ inline void set(String key, const ::cpp::Struct<V,H> &value) {__string_hash_set(HX_MAP_THIS,key,value); }
+ template<typename V>
+ inline void set(String key, const ::cpp::Function<V> &value) {__string_hash_set(HX_MAP_THIS,key,(Dynamic)value ); }
+ template<typename V>
+ inline void set(String key, const ::cpp::Pointer<V> &value) {__string_hash_set(HX_MAP_THIS,key,(Dynamic)value ); }
+
+ template<typename VALUE>
+ inline void set(Dynamic &key, const VALUE &value) { set( (String)key, value ); }
+
+ inline bool get_bool(String key) { return __string_hash_get_bool(h,key); }
+ inline int get_int(String key) { return __string_hash_get_int(h,key); }
+ inline Float get_float(String key) { return __string_hash_get_float(h,key); }
+ inline String get_string(String key) { return __string_hash_get_string(h,key); }
+ inline cpp::Int64 get_int64(String key) { return __string_hash_get_int64(h,key); }
+
+};
+
+} // end namespace haxe
+} // end namespace ds
+
+#endif /* INCLUDED_haxe_ds_StringMap */
diff --git a/Sources/c_snikket/iinclude/haxe/ds/TreeNode.h b/Sources/c_snikket/iinclude/haxe/ds/TreeNode.h
new file mode 100644
index 0000000..9eb45af
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/ds/TreeNode.h
@@ -0,0 +1,119 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_ds_TreeNode
+#define INCLUDED_haxe_ds_TreeNode
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_bd32df1abf02b23a_252_new)
+HX_DECLARE_CLASS2(haxe,ds,TreeNode)
+
+namespace haxe{
+namespace ds{
+
+
+class HXCPP_CLASS_ATTRIBUTES TreeNode_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef TreeNode_obj OBJ_;
+ TreeNode_obj();
+
+ public:
+ enum { _hx_ClassId = 0x723fa5d5 };
+
+ void __construct( ::haxe::ds::TreeNode l, ::Dynamic k, ::Dynamic v, ::haxe::ds::TreeNode r,::hx::Null< int > __o_h);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.ds.TreeNode")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.ds.TreeNode"); }
+
+ inline static ::hx::ObjectPtr< TreeNode_obj > __new( ::haxe::ds::TreeNode l, ::Dynamic k, ::Dynamic v, ::haxe::ds::TreeNode r,::hx::Null< int > __o_h) {
+ ::hx::ObjectPtr< TreeNode_obj > __this = new TreeNode_obj();
+ __this->__construct(l,k,v,r,__o_h);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< TreeNode_obj > __alloc(::hx::Ctx *_hx_ctx, ::haxe::ds::TreeNode l, ::Dynamic k, ::Dynamic v, ::haxe::ds::TreeNode r,::hx::Null< int > __o_h) {
+ TreeNode_obj *__this = (TreeNode_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(TreeNode_obj), true, "haxe.ds.TreeNode"));
+ *(void **)__this = TreeNode_obj::_hx_vtable;
+{
+ int h = __o_h.Default(-1);
+ HX_STACKFRAME(&_hx_pos_bd32df1abf02b23a_252_new)
+HXLINE( 253) ( ( ::haxe::ds::TreeNode)(__this) )->left = l;
+HXLINE( 254) ( ( ::haxe::ds::TreeNode)(__this) )->key = k;
+HXLINE( 255) ( ( ::haxe::ds::TreeNode)(__this) )->value = v;
+HXLINE( 256) ( ( ::haxe::ds::TreeNode)(__this) )->right = r;
+HXLINE( 257) if ((h == -1)) {
+HXLINE( 258) int _hx_tmp;
+HXDLIN( 258) ::haxe::ds::TreeNode _this = ( ( ::haxe::ds::TreeNode)(__this) )->left;
+HXDLIN( 258) int _hx_tmp1;
+HXDLIN( 258) if (::hx::IsNull( _this )) {
+HXLINE( 258) _hx_tmp1 = 0;
+ }
+ else {
+HXLINE( 258) _hx_tmp1 = _this->_height;
+ }
+HXDLIN( 258) ::haxe::ds::TreeNode _this1 = ( ( ::haxe::ds::TreeNode)(__this) )->right;
+HXDLIN( 258) int _hx_tmp2;
+HXDLIN( 258) if (::hx::IsNull( _this1 )) {
+HXLINE( 258) _hx_tmp2 = 0;
+ }
+ else {
+HXLINE( 258) _hx_tmp2 = _this1->_height;
+ }
+HXDLIN( 258) if ((_hx_tmp1 > _hx_tmp2)) {
+HXLINE( 258) ::haxe::ds::TreeNode _this2 = ( ( ::haxe::ds::TreeNode)(__this) )->left;
+HXDLIN( 258) if (::hx::IsNull( _this2 )) {
+HXLINE( 258) _hx_tmp = 0;
+ }
+ else {
+HXLINE( 258) _hx_tmp = _this2->_height;
+ }
+ }
+ else {
+HXLINE( 258) ::haxe::ds::TreeNode _this3 = ( ( ::haxe::ds::TreeNode)(__this) )->right;
+HXDLIN( 258) if (::hx::IsNull( _this3 )) {
+HXLINE( 258) _hx_tmp = 0;
+ }
+ else {
+HXLINE( 258) _hx_tmp = _this3->_height;
+ }
+ }
+HXDLIN( 258) ( ( ::haxe::ds::TreeNode)(__this) )->_height = (_hx_tmp + 1);
+ }
+ else {
+HXLINE( 260) ( ( ::haxe::ds::TreeNode)(__this) )->_height = h;
+ }
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~TreeNode_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("TreeNode",a0,92,83,06); }
+
+ ::haxe::ds::TreeNode left;
+ ::haxe::ds::TreeNode right;
+ ::Dynamic key;
+ ::Dynamic value;
+ int _height;
+};
+
+} // end namespace haxe
+} // end namespace ds
+
+#endif /* INCLUDED_haxe_ds_TreeNode */
diff --git a/Sources/c_snikket/iinclude/haxe/ds/_List/ListNode.h b/Sources/c_snikket/iinclude/haxe/ds/_List/ListNode.h
new file mode 100644
index 0000000..c8b20b9
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/ds/_List/ListNode.h
@@ -0,0 +1,74 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_ds__List_ListNode
+#define INCLUDED_haxe_ds__List_ListNode
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_d7fe8fcac3c6136e_266_new)
+HX_DECLARE_CLASS3(haxe,ds,_List,ListNode)
+
+namespace haxe{
+namespace ds{
+namespace _List{
+
+
+class HXCPP_CLASS_ATTRIBUTES ListNode_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef ListNode_obj OBJ_;
+ ListNode_obj();
+
+ public:
+ enum { _hx_ClassId = 0x567ed068 };
+
+ void __construct( ::Dynamic item, ::haxe::ds::_List::ListNode next);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.ds._List.ListNode")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.ds._List.ListNode"); }
+
+ inline static ::hx::ObjectPtr< ListNode_obj > __new( ::Dynamic item, ::haxe::ds::_List::ListNode next) {
+ ::hx::ObjectPtr< ListNode_obj > __this = new ListNode_obj();
+ __this->__construct(item,next);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< ListNode_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic item, ::haxe::ds::_List::ListNode next) {
+ ListNode_obj *__this = (ListNode_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(ListNode_obj), true, "haxe.ds._List.ListNode"));
+ *(void **)__this = ListNode_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_d7fe8fcac3c6136e_266_new)
+HXLINE( 267) ( ( ::haxe::ds::_List::ListNode)(__this) )->item = item;
+HXLINE( 268) ( ( ::haxe::ds::_List::ListNode)(__this) )->next = next;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ListNode_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("ListNode",a0,95,b0,02); }
+
+ ::Dynamic item;
+ ::haxe::ds::_List::ListNode next;
+};
+
+} // end namespace haxe
+} // end namespace ds
+} // end namespace _List
+
+#endif /* INCLUDED_haxe_ds__List_ListNode */
diff --git a/Sources/c_snikket/iinclude/haxe/exceptions/NotImplementedException.h b/Sources/c_snikket/iinclude/haxe/exceptions/NotImplementedException.h
new file mode 100644
index 0000000..8af474a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/exceptions/NotImplementedException.h
@@ -0,0 +1,71 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_exceptions_NotImplementedException
+#define INCLUDED_haxe_exceptions_NotImplementedException
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_exceptions_PosException
+#include <haxe/exceptions/PosException.h>
+#endif
+HX_DECLARE_STACK_FRAME(_hx_pos_6becf3ac06fb2a12_8_new)
+HX_DECLARE_CLASS1(haxe,Exception)
+HX_DECLARE_CLASS2(haxe,exceptions,NotImplementedException)
+HX_DECLARE_CLASS2(haxe,exceptions,PosException)
+
+namespace haxe{
+namespace exceptions{
+
+
+class HXCPP_CLASS_ATTRIBUTES NotImplementedException_obj : public ::haxe::exceptions::PosException_obj
+{
+ public:
+ typedef ::haxe::exceptions::PosException_obj super;
+ typedef NotImplementedException_obj OBJ_;
+ NotImplementedException_obj();
+
+ public:
+ enum { _hx_ClassId = 0x081bdbd6 };
+
+ void __construct(::String __o_message, ::haxe::Exception previous, ::Dynamic pos);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.exceptions.NotImplementedException")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.exceptions.NotImplementedException"); }
+
+ inline static ::hx::ObjectPtr< NotImplementedException_obj > __new(::String __o_message, ::haxe::Exception previous, ::Dynamic pos) {
+ ::hx::ObjectPtr< NotImplementedException_obj > __this = new NotImplementedException_obj();
+ __this->__construct(__o_message,previous,pos);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< NotImplementedException_obj > __alloc(::hx::Ctx *_hx_ctx,::String __o_message, ::haxe::Exception previous, ::Dynamic pos) {
+ NotImplementedException_obj *__this = (NotImplementedException_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(NotImplementedException_obj), true, "haxe.exceptions.NotImplementedException"));
+ *(void **)__this = NotImplementedException_obj::_hx_vtable;
+{
+ ::String message = __o_message;
+ if (::hx::IsNull(__o_message)) message = HX_("Not implemented",15,1e,32,34);
+ HX_STACKFRAME(&_hx_pos_6becf3ac06fb2a12_8_new)
+HXDLIN( 8) __this->super::__construct(message,previous,pos);
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~NotImplementedException_obj();
+
+ HX_DO_RTTI_ALL;
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("NotImplementedException",c0,57,2c,4a); }
+
+};
+
+} // end namespace haxe
+} // end namespace exceptions
+
+#endif /* INCLUDED_haxe_exceptions_NotImplementedException */
diff --git a/Sources/c_snikket/iinclude/haxe/exceptions/PosException.h b/Sources/c_snikket/iinclude/haxe/exceptions/PosException.h
new file mode 100644
index 0000000..df1f2b8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/exceptions/PosException.h
@@ -0,0 +1,82 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_exceptions_PosException
+#define INCLUDED_haxe_exceptions_PosException
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_Exception
+#include <haxe/Exception.h>
+#endif
+HX_DECLARE_STACK_FRAME(_hx_pos_9487fa79a58895e3_12_new)
+HX_DECLARE_CLASS1(haxe,Exception)
+HX_DECLARE_CLASS2(haxe,exceptions,PosException)
+
+namespace haxe{
+namespace exceptions{
+
+
+class HXCPP_CLASS_ATTRIBUTES PosException_obj : public ::haxe::Exception_obj
+{
+ public:
+ typedef ::haxe::Exception_obj super;
+ typedef PosException_obj OBJ_;
+ PosException_obj();
+
+ public:
+ enum { _hx_ClassId = 0x65f7252d };
+
+ void __construct(::String message, ::haxe::Exception previous, ::Dynamic pos);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.exceptions.PosException")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.exceptions.PosException"); }
+
+ inline static ::hx::ObjectPtr< PosException_obj > __new(::String message, ::haxe::Exception previous, ::Dynamic pos) {
+ ::hx::ObjectPtr< PosException_obj > __this = new PosException_obj();
+ __this->__construct(message,previous,pos);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< PosException_obj > __alloc(::hx::Ctx *_hx_ctx,::String message, ::haxe::Exception previous, ::Dynamic pos) {
+ PosException_obj *__this = (PosException_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(PosException_obj), true, "haxe.exceptions.PosException"));
+ *(void **)__this = PosException_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_9487fa79a58895e3_12_new)
+HXLINE( 13) __this->super::__construct(message,previous,null());
+HXLINE( 14) if (::hx::IsNull( pos )) {
+HXLINE( 15) ( ( ::haxe::exceptions::PosException)(__this) )->posInfos = ::hx::SourceInfo(HX_("(unknown)",87,5d,fc,5f),0,HX_("(unknown)",87,5d,fc,5f),HX_("(unknown)",87,5d,fc,5f));
+ }
+ else {
+HXLINE( 17) ( ( ::haxe::exceptions::PosException)(__this) )->posInfos = pos;
+ }
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~PosException_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("PosException",3b,8c,23,b9); }
+
+ ::Dynamic posInfos;
+ virtual ::String toString();
+
+};
+
+} // end namespace haxe
+} // end namespace exceptions
+
+#endif /* INCLUDED_haxe_exceptions_PosException */
diff --git a/Sources/c_snikket/iinclude/haxe/format/JsonParser.h b/Sources/c_snikket/iinclude/haxe/format/JsonParser.h
new file mode 100644
index 0000000..be8707a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/format/JsonParser.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_format_JsonParser
+#define INCLUDED_haxe_format_JsonParser
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,format,JsonParser)
+
+namespace haxe{
+namespace format{
+
+
+class HXCPP_CLASS_ATTRIBUTES JsonParser_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef JsonParser_obj OBJ_;
+ JsonParser_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0ae51690 };
+
+ void __construct(::String str);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.format.JsonParser")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.format.JsonParser"); }
+ static ::hx::ObjectPtr< JsonParser_obj > __new(::String str);
+ static ::hx::ObjectPtr< JsonParser_obj > __alloc(::hx::Ctx *_hx_ctx,::String str);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~JsonParser_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("JsonParser",47,65,2e,25); }
+
+ ::String str;
+ int pos;
+ ::Dynamic doParse();
+ ::Dynamic doParse_dyn();
+
+ ::Dynamic parseRec();
+ ::Dynamic parseRec_dyn();
+
+ ::String parseString();
+ ::Dynamic parseString_dyn();
+
+ void invalidChar();
+ ::Dynamic invalidChar_dyn();
+
+ void invalidNumber(int start);
+ ::Dynamic invalidNumber_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace format
+
+#endif /* INCLUDED_haxe_format_JsonParser */
diff --git a/Sources/c_snikket/iinclude/haxe/format/JsonPrinter.h b/Sources/c_snikket/iinclude/haxe/format/JsonPrinter.h
new file mode 100644
index 0000000..4ac12b9
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/format/JsonPrinter.h
@@ -0,0 +1,75 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_format_JsonPrinter
+#define INCLUDED_haxe_format_JsonPrinter
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(StringBuf)
+HX_DECLARE_CLASS2(haxe,format,JsonPrinter)
+
+namespace haxe{
+namespace format{
+
+
+class HXCPP_CLASS_ATTRIBUTES JsonPrinter_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef JsonPrinter_obj OBJ_;
+ JsonPrinter_obj();
+
+ public:
+ enum { _hx_ClassId = 0x385642d1 };
+
+ void __construct( ::Dynamic replacer,::String space);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.format.JsonPrinter")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.format.JsonPrinter"); }
+ static ::hx::ObjectPtr< JsonPrinter_obj > __new( ::Dynamic replacer,::String space);
+ static ::hx::ObjectPtr< JsonPrinter_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic replacer,::String space);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~JsonPrinter_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("JsonPrinter",72,68,9d,fd); }
+
+ static ::String print( ::Dynamic o, ::Dynamic replacer,::String space);
+ static ::Dynamic print_dyn();
+
+ ::StringBuf buf;
+ ::Dynamic replacer;
+ Dynamic replacer_dyn() { return replacer;}
+ ::String indent;
+ bool pretty;
+ int nind;
+ void write( ::Dynamic k, ::Dynamic v);
+ ::Dynamic write_dyn();
+
+ void classString( ::Dynamic v);
+ ::Dynamic classString_dyn();
+
+ void fieldsString( ::Dynamic v,::Array< ::String > fields);
+ ::Dynamic fieldsString_dyn();
+
+ void quote(::String s);
+ ::Dynamic quote_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace format
+
+#endif /* INCLUDED_haxe_format_JsonPrinter */
diff --git a/Sources/c_snikket/iinclude/haxe/http/HttpBase.h b/Sources/c_snikket/iinclude/haxe/http/HttpBase.h
new file mode 100644
index 0000000..fb9bfeb
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/http/HttpBase.h
@@ -0,0 +1,90 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_http_HttpBase
+#define INCLUDED_haxe_http_HttpBase
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,http,HttpBase)
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+
+namespace haxe{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES HttpBase_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef HttpBase_obj OBJ_;
+ HttpBase_obj();
+
+ public:
+ enum { _hx_ClassId = 0x10c0921f };
+
+ void __construct(::String url);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.http.HttpBase")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.http.HttpBase"); }
+ static ::hx::ObjectPtr< HttpBase_obj > __new(::String url);
+ static ::hx::ObjectPtr< HttpBase_obj > __alloc(::hx::Ctx *_hx_ctx,::String url);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ static void __alloc_dynamic_functions(::hx::Ctx *_hx_alloc,HttpBase_obj *_hx_obj);
+ //~HttpBase_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("HttpBase",d9,cf,1a,f8); }
+
+ ::String url;
+ ::haxe::io::Bytes responseBytes;
+ ::String responseAsString;
+ ::String postData;
+ ::haxe::io::Bytes postBytes;
+ ::Array< ::Dynamic> headers;
+ ::Array< ::Dynamic> params;
+ ::Dynamic emptyOnData;
+ Dynamic emptyOnData_dyn() { return emptyOnData;}
+ void setHeader(::String name,::String value);
+ ::Dynamic setHeader_dyn();
+
+ void setPostData(::String data);
+ ::Dynamic setPostData_dyn();
+
+ ::Dynamic onData;
+ inline ::Dynamic &onData_dyn() {return onData; }
+
+ ::Dynamic onBytes;
+ inline ::Dynamic &onBytes_dyn() {return onBytes; }
+
+ ::Dynamic onError;
+ inline ::Dynamic &onError_dyn() {return onError; }
+
+ ::Dynamic onStatus;
+ inline ::Dynamic &onStatus_dyn() {return onStatus; }
+
+ bool hasOnData();
+ ::Dynamic hasOnData_dyn();
+
+ void success( ::haxe::io::Bytes data);
+ ::Dynamic success_dyn();
+
+ ::String get_responseData();
+ ::Dynamic get_responseData_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace http
+
+#endif /* INCLUDED_haxe_http_HttpBase */
diff --git a/Sources/c_snikket/iinclude/haxe/io/Bytes.h b/Sources/c_snikket/iinclude/haxe/io/Bytes.h
new file mode 100644
index 0000000..49850b2
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/io/Bytes.h
@@ -0,0 +1,86 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_io_Bytes
+#define INCLUDED_haxe_io_Bytes
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,Encoding)
+
+namespace haxe{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES Bytes_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Bytes_obj OBJ_;
+ Bytes_obj();
+
+ public:
+ enum { _hx_ClassId = 0x195c64b7 };
+
+ void __construct(int length,::Array< unsigned char > b);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.io.Bytes")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.io.Bytes"); }
+ static ::hx::ObjectPtr< Bytes_obj > __new(int length,::Array< unsigned char > b);
+ static ::hx::ObjectPtr< Bytes_obj > __alloc(::hx::Ctx *_hx_ctx,int length,::Array< unsigned char > b);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Bytes_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Bytes",4b,78,c5,50); }
+
+ static ::haxe::io::Bytes alloc(int length);
+ static ::Dynamic alloc_dyn();
+
+ static ::haxe::io::Bytes ofString(::String s, ::haxe::io::Encoding encoding);
+ static ::Dynamic ofString_dyn();
+
+ static ::haxe::io::Bytes ofData(::Array< unsigned char > b);
+ static ::Dynamic ofData_dyn();
+
+ static ::haxe::io::Bytes ofHex(::String s);
+ static ::Dynamic ofHex_dyn();
+
+ int length;
+ ::Array< unsigned char > b;
+ void blit(int pos, ::haxe::io::Bytes src,int srcpos,int len);
+ ::Dynamic blit_dyn();
+
+ void fill(int pos,int len,int value);
+ ::Dynamic fill_dyn();
+
+ ::haxe::io::Bytes sub(int pos,int len);
+ ::Dynamic sub_dyn();
+
+ ::String getString(int pos,int len, ::haxe::io::Encoding encoding);
+ ::Dynamic getString_dyn();
+
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+ ::String toHex();
+ ::Dynamic toHex_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace io
+
+#endif /* INCLUDED_haxe_io_Bytes */
diff --git a/Sources/c_snikket/iinclude/haxe/io/BytesBuffer.h b/Sources/c_snikket/iinclude/haxe/io/BytesBuffer.h
new file mode 100644
index 0000000..531cf7a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/io/BytesBuffer.h
@@ -0,0 +1,57 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_io_BytesBuffer
+#define INCLUDED_haxe_io_BytesBuffer
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,BytesBuffer)
+
+namespace haxe{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES BytesBuffer_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef BytesBuffer_obj OBJ_;
+ BytesBuffer_obj();
+
+ public:
+ enum { _hx_ClassId = 0x183160df };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.io.BytesBuffer")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.io.BytesBuffer"); }
+ static ::hx::ObjectPtr< BytesBuffer_obj > __new();
+ static ::hx::ObjectPtr< BytesBuffer_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~BytesBuffer_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("BytesBuffer",ab,73,22,f6); }
+
+ ::Array< unsigned char > b;
+ ::haxe::io::Bytes getBytes();
+ ::Dynamic getBytes_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace io
+
+#endif /* INCLUDED_haxe_io_BytesBuffer */
diff --git a/Sources/c_snikket/iinclude/haxe/io/BytesInput.h b/Sources/c_snikket/iinclude/haxe/io/BytesInput.h
new file mode 100644
index 0000000..4385c8d
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/io/BytesInput.h
@@ -0,0 +1,65 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_io_BytesInput
+#define INCLUDED_haxe_io_BytesInput
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_io_Input
+#include <haxe/io/Input.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,BytesInput)
+HX_DECLARE_CLASS2(haxe,io,Input)
+
+namespace haxe{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES BytesInput_obj : public ::haxe::io::Input_obj
+{
+ public:
+ typedef ::haxe::io::Input_obj super;
+ typedef BytesInput_obj OBJ_;
+ BytesInput_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7e26810b };
+
+ void __construct( ::haxe::io::Bytes b, ::Dynamic pos, ::Dynamic len);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.io.BytesInput")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.io.BytesInput"); }
+ static ::hx::ObjectPtr< BytesInput_obj > __new( ::haxe::io::Bytes b, ::Dynamic pos, ::Dynamic len);
+ static ::hx::ObjectPtr< BytesInput_obj > __alloc(::hx::Ctx *_hx_ctx, ::haxe::io::Bytes b, ::Dynamic pos, ::Dynamic len);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~BytesInput_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("BytesInput",bf,cb,76,e6); }
+
+ ::Array< unsigned char > b;
+ int pos;
+ int len;
+ int totlen;
+ int readByte();
+
+ int readBytes( ::haxe::io::Bytes buf,int pos,int len);
+
+};
+
+} // end namespace haxe
+} // end namespace io
+
+#endif /* INCLUDED_haxe_io_BytesInput */
diff --git a/Sources/c_snikket/iinclude/haxe/io/BytesOutput.h b/Sources/c_snikket/iinclude/haxe/io/BytesOutput.h
new file mode 100644
index 0000000..15fc989
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/io/BytesOutput.h
@@ -0,0 +1,66 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_io_BytesOutput
+#define INCLUDED_haxe_io_BytesOutput
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_io_Output
+#include <haxe/io/Output.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,BytesBuffer)
+HX_DECLARE_CLASS2(haxe,io,BytesOutput)
+HX_DECLARE_CLASS2(haxe,io,Output)
+
+namespace haxe{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES BytesOutput_obj : public ::haxe::io::Output_obj
+{
+ public:
+ typedef ::haxe::io::Output_obj super;
+ typedef BytesOutput_obj OBJ_;
+ BytesOutput_obj();
+
+ public:
+ enum { _hx_ClassId = 0x541db2e0 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.io.BytesOutput")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.io.BytesOutput"); }
+ static ::hx::ObjectPtr< BytesOutput_obj > __new();
+ static ::hx::ObjectPtr< BytesOutput_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~BytesOutput_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("BytesOutput",ac,c5,0e,32); }
+
+ ::haxe::io::BytesBuffer b;
+ void writeByte(int c);
+
+ int writeBytes( ::haxe::io::Bytes buf,int pos,int len);
+
+ ::haxe::io::Bytes getBytes();
+ ::Dynamic getBytes_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace io
+
+#endif /* INCLUDED_haxe_io_BytesOutput */
diff --git a/Sources/c_snikket/iinclude/haxe/io/Encoding.h b/Sources/c_snikket/iinclude/haxe/io/Encoding.h
new file mode 100644
index 0000000..2103145
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/io/Encoding.h
@@ -0,0 +1,37 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_io_Encoding
+#define INCLUDED_haxe_io_Encoding
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,io,Encoding)
+namespace haxe{
+namespace io{
+
+
+class Encoding_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef Encoding_obj OBJ_;
+
+ public:
+ Encoding_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("haxe.io.Encoding",33,a6,6d,22); }
+ ::String __ToString() const { return HX_("Encoding.",db,8b,f5,be) + _hx_tag; }
+
+ static ::haxe::io::Encoding RawNative;
+ static inline ::haxe::io::Encoding RawNative_dyn() { return RawNative; }
+ static ::haxe::io::Encoding UTF8;
+ static inline ::haxe::io::Encoding UTF8_dyn() { return UTF8; }
+};
+
+} // end namespace haxe
+} // end namespace io
+
+#endif /* INCLUDED_haxe_io_Encoding */
diff --git a/Sources/c_snikket/iinclude/haxe/io/Eof.h b/Sources/c_snikket/iinclude/haxe/io/Eof.h
new file mode 100644
index 0000000..4daee4e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/io/Eof.h
@@ -0,0 +1,67 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_io_Eof
+#define INCLUDED_haxe_io_Eof
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_c4f7e3feda612c90_29_new)
+HX_DECLARE_CLASS2(haxe,io,Eof)
+
+namespace haxe{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES Eof_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Eof_obj OBJ_;
+ Eof_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1d7955d0 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="haxe.io.Eof")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"haxe.io.Eof"); }
+
+ inline static ::hx::ObjectPtr< Eof_obj > __new() {
+ ::hx::ObjectPtr< Eof_obj > __this = new Eof_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Eof_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Eof_obj *__this = (Eof_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Eof_obj), false, "haxe.io.Eof"));
+ *(void **)__this = Eof_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_c4f7e3feda612c90_29_new)
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Eof_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Eof",9c,bc,34,00); }
+
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace io
+
+#endif /* INCLUDED_haxe_io_Eof */
diff --git a/Sources/c_snikket/iinclude/haxe/io/Error.h b/Sources/c_snikket/iinclude/haxe/io/Error.h
new file mode 100644
index 0000000..83aadc4
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/io/Error.h
@@ -0,0 +1,41 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_io_Error
+#define INCLUDED_haxe_io_Error
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,io,Error)
+namespace haxe{
+namespace io{
+
+
+class Error_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef Error_obj OBJ_;
+
+ public:
+ Error_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("haxe.io.Error",68,16,01,55); }
+ ::String __ToString() const { return HX_("Error.",86,f7,fc,85) + _hx_tag; }
+
+ static ::haxe::io::Error Blocked;
+ static inline ::haxe::io::Error Blocked_dyn() { return Blocked; }
+ static ::haxe::io::Error Custom( ::Dynamic e);
+ static ::Dynamic Custom_dyn();
+ static ::haxe::io::Error OutsideBounds;
+ static inline ::haxe::io::Error OutsideBounds_dyn() { return OutsideBounds; }
+ static ::haxe::io::Error Overflow;
+ static inline ::haxe::io::Error Overflow_dyn() { return Overflow; }
+};
+
+} // end namespace haxe
+} // end namespace io
+
+#endif /* INCLUDED_haxe_io_Error */
diff --git a/Sources/c_snikket/iinclude/haxe/io/Input.h b/Sources/c_snikket/iinclude/haxe/io/Input.h
new file mode 100644
index 0000000..8e88cce
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/io/Input.h
@@ -0,0 +1,81 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_io_Input
+#define INCLUDED_haxe_io_Input
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,Input)
+
+namespace haxe{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES Input_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Input_obj OBJ_;
+ Input_obj();
+
+ public:
+ enum { _hx_ClassId = 0x19e22056 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="haxe.io.Input")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"haxe.io.Input"); }
+
+ inline static ::hx::ObjectPtr< Input_obj > __new() {
+ ::hx::ObjectPtr< Input_obj > __this = new Input_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Input_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Input_obj *__this = (Input_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Input_obj), false, "haxe.io.Input"));
+ *(void **)__this = Input_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Input_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Input",ea,33,4b,51); }
+
+ bool bigEndian;
+ virtual int readByte();
+ ::Dynamic readByte_dyn();
+
+ virtual int readBytes( ::haxe::io::Bytes s,int pos,int len);
+ ::Dynamic readBytes_dyn();
+
+ virtual void close();
+ ::Dynamic close_dyn();
+
+ bool set_bigEndian(bool b);
+ ::Dynamic set_bigEndian_dyn();
+
+ ::haxe::io::Bytes readAll( ::Dynamic bufsize);
+ ::Dynamic readAll_dyn();
+
+ int readInt32();
+ ::Dynamic readInt32_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace io
+
+#endif /* INCLUDED_haxe_io_Input */
diff --git a/Sources/c_snikket/iinclude/haxe/io/Output.h b/Sources/c_snikket/iinclude/haxe/io/Output.h
new file mode 100644
index 0000000..7fc6dc3
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/io/Output.h
@@ -0,0 +1,82 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_io_Output
+#define INCLUDED_haxe_io_Output
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,Encoding)
+HX_DECLARE_CLASS2(haxe,io,Output)
+
+namespace haxe{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES Output_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Output_obj OBJ_;
+ Output_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0a55a26d };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="haxe.io.Output")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"haxe.io.Output"); }
+
+ inline static ::hx::ObjectPtr< Output_obj > __new() {
+ ::hx::ObjectPtr< Output_obj > __this = new Output_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Output_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Output_obj *__this = (Output_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Output_obj), false, "haxe.io.Output"));
+ *(void **)__this = Output_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Output_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Output",21,83,15,41); }
+
+ virtual void writeByte(int c);
+ ::Dynamic writeByte_dyn();
+
+ virtual int writeBytes( ::haxe::io::Bytes s,int pos,int len);
+ ::Dynamic writeBytes_dyn();
+
+ virtual void close();
+ ::Dynamic close_dyn();
+
+ void write( ::haxe::io::Bytes s);
+ ::Dynamic write_dyn();
+
+ void writeFullBytes( ::haxe::io::Bytes s,int pos,int len);
+ ::Dynamic writeFullBytes_dyn();
+
+ void prepare(int nbytes);
+ ::Dynamic prepare_dyn();
+
+ void writeString(::String s, ::haxe::io::Encoding encoding);
+ ::Dynamic writeString_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace io
+
+#endif /* INCLUDED_haxe_io_Output */
diff --git a/Sources/c_snikket/iinclude/haxe/io/Path.h b/Sources/c_snikket/iinclude/haxe/io/Path.h
new file mode 100644
index 0000000..c3b75d8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/io/Path.h
@@ -0,0 +1,78 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_io_Path
+#define INCLUDED_haxe_io_Path
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,io,Path)
+
+namespace haxe{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES Path_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Path_obj OBJ_;
+ Path_obj();
+
+ public:
+ enum { _hx_ClassId = 0x026896d9 };
+
+ void __construct(::String path);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.io.Path")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.io.Path"); }
+ static ::hx::ObjectPtr< Path_obj > __new(::String path);
+ static ::hx::ObjectPtr< Path_obj > __alloc(::hx::Ctx *_hx_ctx,::String path);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Path_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Path",c5,11,2b,35); }
+
+ static ::String withoutDirectory(::String path);
+ static ::Dynamic withoutDirectory_dyn();
+
+ static ::String join(::Array< ::String > paths);
+ static ::Dynamic join_dyn();
+
+ static ::String normalize(::String path);
+ static ::Dynamic normalize_dyn();
+
+ static ::String addTrailingSlash(::String path);
+ static ::Dynamic addTrailingSlash_dyn();
+
+ static ::String removeTrailingSlashes(::String path);
+ static ::Dynamic removeTrailingSlashes_dyn();
+
+ static bool isAbsolute(::String path);
+ static ::Dynamic isAbsolute_dyn();
+
+ ::String dir;
+ ::String file;
+ ::String ext;
+ bool backslash;
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace io
+
+#endif /* INCLUDED_haxe_io_Path */
diff --git a/Sources/c_snikket/iinclude/haxe/iterators/ArrayIterator.h b/Sources/c_snikket/iinclude/haxe/iterators/ArrayIterator.h
new file mode 100644
index 0000000..15325b9
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/iterators/ArrayIterator.h
@@ -0,0 +1,78 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_iterators_ArrayIterator
+#define INCLUDED_haxe_iterators_ArrayIterator
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_44ded26575b0f4de_28_new)
+HX_DECLARE_CLASS2(haxe,iterators,ArrayIterator)
+
+namespace haxe{
+namespace iterators{
+
+
+class HXCPP_CLASS_ATTRIBUTES ArrayIterator_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef ArrayIterator_obj OBJ_;
+ ArrayIterator_obj();
+
+ public:
+ enum { _hx_ClassId = 0x189859c8 };
+
+ void __construct(::cpp::VirtualArray array);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.iterators.ArrayIterator")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.iterators.ArrayIterator"); }
+
+ inline static ::hx::ObjectPtr< ArrayIterator_obj > __new(::cpp::VirtualArray array) {
+ ::hx::ObjectPtr< ArrayIterator_obj > __this = new ArrayIterator_obj();
+ __this->__construct(array);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< ArrayIterator_obj > __alloc(::hx::Ctx *_hx_ctx,::cpp::VirtualArray array) {
+ ArrayIterator_obj *__this = (ArrayIterator_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(ArrayIterator_obj), true, "haxe.iterators.ArrayIterator"));
+ *(void **)__this = ArrayIterator_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_44ded26575b0f4de_28_new)
+HXLINE( 30) ( ( ::haxe::iterators::ArrayIterator)(__this) )->current = 0;
+HXLINE( 37) ( ( ::haxe::iterators::ArrayIterator)(__this) )->array = array;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ArrayIterator_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("ArrayIterator",87,84,c8,5d); }
+
+ ::cpp::VirtualArray array;
+ int current;
+ bool hasNext();
+ ::Dynamic hasNext_dyn();
+
+ ::Dynamic next();
+ ::Dynamic next_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace iterators
+
+#endif /* INCLUDED_haxe_iterators_ArrayIterator */
diff --git a/Sources/c_snikket/iinclude/haxe/iterators/MapKeyValueIterator.h b/Sources/c_snikket/iinclude/haxe/iterators/MapKeyValueIterator.h
new file mode 100644
index 0000000..22cf306
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/iterators/MapKeyValueIterator.h
@@ -0,0 +1,61 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_iterators_MapKeyValueIterator
+#define INCLUDED_haxe_iterators_MapKeyValueIterator
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,iterators,MapKeyValueIterator)
+
+namespace haxe{
+namespace iterators{
+
+
+class HXCPP_CLASS_ATTRIBUTES MapKeyValueIterator_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef MapKeyValueIterator_obj OBJ_;
+ MapKeyValueIterator_obj();
+
+ public:
+ enum { _hx_ClassId = 0x5732dffd };
+
+ void __construct(::Dynamic map);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.iterators.MapKeyValueIterator")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.iterators.MapKeyValueIterator"); }
+ static ::hx::ObjectPtr< MapKeyValueIterator_obj > __new(::Dynamic map);
+ static ::hx::ObjectPtr< MapKeyValueIterator_obj > __alloc(::hx::Ctx *_hx_ctx,::Dynamic map);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~MapKeyValueIterator_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("MapKeyValueIterator",fc,23,62,2c); }
+
+ ::Dynamic map;
+ ::Dynamic keys;
+ bool hasNext();
+ ::Dynamic hasNext_dyn();
+
+ ::Dynamic next();
+ ::Dynamic next_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace iterators
+
+#endif /* INCLUDED_haxe_iterators_MapKeyValueIterator */
diff --git a/Sources/c_snikket/iinclude/haxe/xml/Parser.h b/Sources/c_snikket/iinclude/haxe/xml/Parser.h
new file mode 100644
index 0000000..b6ef3d6
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/xml/Parser.h
@@ -0,0 +1,71 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_xml_Parser
+#define INCLUDED_haxe_xml_Parser
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(Xml)
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+HX_DECLARE_CLASS2(haxe,xml,Parser)
+
+namespace haxe{
+namespace xml{
+
+
+class HXCPP_CLASS_ATTRIBUTES Parser_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Parser_obj OBJ_;
+ Parser_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1c6f1730 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="haxe.xml.Parser")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"haxe.xml.Parser"); }
+
+ inline static ::hx::ObjectPtr< Parser_obj > __new() {
+ ::hx::ObjectPtr< Parser_obj > __this = new Parser_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Parser_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Parser_obj *__this = (Parser_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Parser_obj), false, "haxe.xml.Parser"));
+ *(void **)__this = Parser_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Parser_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Parser",ff,10,1d,22); }
+
+ static void __boot();
+ static ::haxe::ds::StringMap escapes;
+ static ::Xml parse(::String str,::hx::Null< bool > strict);
+ static ::Dynamic parse_dyn();
+
+ static int doParse(::String str,bool strict,::hx::Null< int > p, ::Xml parent);
+ static ::Dynamic doParse_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace xml
+
+#endif /* INCLUDED_haxe_xml_Parser */
diff --git a/Sources/c_snikket/iinclude/haxe/xml/Printer.h b/Sources/c_snikket/iinclude/haxe/xml/Printer.h
new file mode 100644
index 0000000..5b159a1
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/xml/Printer.h
@@ -0,0 +1,66 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_xml_Printer
+#define INCLUDED_haxe_xml_Printer
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(StringBuf)
+HX_DECLARE_CLASS0(Xml)
+HX_DECLARE_CLASS2(haxe,xml,Printer)
+
+namespace haxe{
+namespace xml{
+
+
+class HXCPP_CLASS_ATTRIBUTES Printer_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Printer_obj OBJ_;
+ Printer_obj();
+
+ public:
+ enum { _hx_ClassId = 0x5ef86269 };
+
+ void __construct(bool pretty);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.xml.Printer")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.xml.Printer"); }
+ static ::hx::ObjectPtr< Printer_obj > __new(bool pretty);
+ static ::hx::ObjectPtr< Printer_obj > __alloc(::hx::Ctx *_hx_ctx,bool pretty);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Printer_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Printer",ba,fd,84,51); }
+
+ static ::String print( ::Xml xml, ::Dynamic pretty);
+ static ::Dynamic print_dyn();
+
+ ::StringBuf output;
+ bool pretty;
+ void writeNode( ::Xml value,::String tabs);
+ ::Dynamic writeNode_dyn();
+
+ bool hasChildren( ::Xml value);
+ ::Dynamic hasChildren_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace xml
+
+#endif /* INCLUDED_haxe_xml_Printer */
diff --git a/Sources/c_snikket/iinclude/haxe/xml/XmlParserException.h b/Sources/c_snikket/iinclude/haxe/xml/XmlParserException.h
new file mode 100644
index 0000000..a842951
--- /dev/null
+++ b/Sources/c_snikket/iinclude/haxe/xml/XmlParserException.h
@@ -0,0 +1,60 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_xml_XmlParserException
+#define INCLUDED_haxe_xml_XmlParserException
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,xml,XmlParserException)
+
+namespace haxe{
+namespace xml{
+
+
+class HXCPP_CLASS_ATTRIBUTES XmlParserException_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef XmlParserException_obj OBJ_;
+ XmlParserException_obj();
+
+ public:
+ enum { _hx_ClassId = 0x75f2332a };
+
+ void __construct(::String message,::String xml,int position);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.xml.XmlParserException")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.xml.XmlParserException"); }
+ static ::hx::ObjectPtr< XmlParserException_obj > __new(::String message,::String xml,int position);
+ static ::hx::ObjectPtr< XmlParserException_obj > __alloc(::hx::Ctx *_hx_ctx,::String message,::String xml,int position);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~XmlParserException_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("XmlParserException",79,27,d7,6b); }
+
+ ::String message;
+ int lineNumber;
+ int positionAtLine;
+ int position;
+ ::String xml;
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace xml
+
+#endif /* INCLUDED_haxe_xml_XmlParserException */
diff --git a/Sources/c_snikket/iinclude/hsluv/Hsluv.h b/Sources/c_snikket/iinclude/hsluv/Hsluv.h
new file mode 100644
index 0000000..f90390a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hsluv/Hsluv.h
@@ -0,0 +1,138 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_hsluv_Hsluv
+#define INCLUDED_hsluv_Hsluv
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(hsluv,Hsluv)
+
+namespace hsluv{
+
+
+class HXCPP_CLASS_ATTRIBUTES Hsluv_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Hsluv_obj OBJ_;
+ Hsluv_obj();
+
+ public:
+ enum { _hx_ClassId = 0x29e47ee8 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="hsluv.Hsluv")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"hsluv.Hsluv"); }
+ static ::hx::ObjectPtr< Hsluv_obj > __new();
+ static ::hx::ObjectPtr< Hsluv_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Hsluv_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Hsluv",82,a7,2f,c1); }
+
+ static void __boot();
+ static ::String hexChars;
+ static Float refY;
+ static Float refU;
+ static Float refV;
+ static Float kappa;
+ static Float epsilon;
+ static Float m_r0;
+ static Float m_r1;
+ static Float m_r2;
+ static Float m_g0;
+ static Float m_g1;
+ static Float m_g2;
+ static Float m_b0;
+ static Float m_b1;
+ static Float m_b2;
+ static Float fromLinear(Float c);
+ static ::Dynamic fromLinear_dyn();
+
+ static Float lToY(Float L);
+ static ::Dynamic lToY_dyn();
+
+ static ::String rgbChannelToHex(Float chan);
+ static ::Dynamic rgbChannelToHex_dyn();
+
+ static Float distanceFromOriginAngle(Float slope,Float intercept,Float angle);
+ static ::Dynamic distanceFromOriginAngle_dyn();
+
+ static Float min6(Float f1,Float f2,Float f3,Float f4,Float f5,Float f6);
+ static ::Dynamic min6_dyn();
+
+ ::String hex;
+ Float rgb_r;
+ Float rgb_g;
+ Float rgb_b;
+ Float xyz_x;
+ Float xyz_y;
+ Float xyz_z;
+ Float luv_l;
+ Float luv_u;
+ Float luv_v;
+ Float lch_l;
+ Float lch_c;
+ Float lch_h;
+ Float hsluv_h;
+ Float hsluv_s;
+ Float hsluv_l;
+ Float r0s;
+ Float r0i;
+ Float r1s;
+ Float r1i;
+ Float g0s;
+ Float g0i;
+ Float g1s;
+ Float g1i;
+ Float b0s;
+ Float b0i;
+ Float b1s;
+ Float b1i;
+ void rgbToHex();
+ ::Dynamic rgbToHex_dyn();
+
+ void xyzToRgb();
+ ::Dynamic xyzToRgb_dyn();
+
+ void luvToXyz();
+ ::Dynamic luvToXyz_dyn();
+
+ void lchToLuv();
+ ::Dynamic lchToLuv_dyn();
+
+ void calculateBoundingLines(Float l);
+ ::Dynamic calculateBoundingLines_dyn();
+
+ Float calcMaxChromaHsluv(Float h);
+ ::Dynamic calcMaxChromaHsluv_dyn();
+
+ void hsluvToLch();
+ ::Dynamic hsluvToLch_dyn();
+
+ void hsluvToRgb();
+ ::Dynamic hsluvToRgb_dyn();
+
+ void hsluvToHex();
+ ::Dynamic hsluvToHex_dyn();
+
+};
+
+} // end namespace hsluv
+
+#endif /* INCLUDED_hsluv_Hsluv */
diff --git a/Sources/c_snikket/iinclude/htmlparser/HtmlAttribute.h b/Sources/c_snikket/iinclude/htmlparser/HtmlAttribute.h
new file mode 100644
index 0000000..f473c92
--- /dev/null
+++ b/Sources/c_snikket/iinclude/htmlparser/HtmlAttribute.h
@@ -0,0 +1,72 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_htmlparser_HtmlAttribute
+#define INCLUDED_htmlparser_HtmlAttribute
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_630f17b70ccedfe6_10_new)
+HX_DECLARE_CLASS1(htmlparser,HtmlAttribute)
+
+namespace htmlparser{
+
+
+class HXCPP_CLASS_ATTRIBUTES HtmlAttribute_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef HtmlAttribute_obj OBJ_;
+ HtmlAttribute_obj();
+
+ public:
+ enum { _hx_ClassId = 0x49e2a647 };
+
+ void __construct(::String name,::String value,::String quote);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="htmlparser.HtmlAttribute")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"htmlparser.HtmlAttribute"); }
+
+ inline static ::hx::ObjectPtr< HtmlAttribute_obj > __new(::String name,::String value,::String quote) {
+ ::hx::ObjectPtr< HtmlAttribute_obj > __this = new HtmlAttribute_obj();
+ __this->__construct(name,value,quote);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< HtmlAttribute_obj > __alloc(::hx::Ctx *_hx_ctx,::String name,::String value,::String quote) {
+ HtmlAttribute_obj *__this = (HtmlAttribute_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(HtmlAttribute_obj), true, "htmlparser.HtmlAttribute"));
+ *(void **)__this = HtmlAttribute_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_630f17b70ccedfe6_10_new)
+HXLINE( 11) ( ( ::htmlparser::HtmlAttribute)(__this) )->name = name;
+HXLINE( 12) ( ( ::htmlparser::HtmlAttribute)(__this) )->value = value;
+HXLINE( 13) ( ( ::htmlparser::HtmlAttribute)(__this) )->quote = quote;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~HtmlAttribute_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("HtmlAttribute",11,85,c2,03); }
+
+ ::String name;
+ ::String value;
+ ::String quote;
+};
+
+} // end namespace htmlparser
+
+#endif /* INCLUDED_htmlparser_HtmlAttribute */
diff --git a/Sources/c_snikket/iinclude/htmlparser/HtmlNode.h b/Sources/c_snikket/iinclude/htmlparser/HtmlNode.h
new file mode 100644
index 0000000..2b2ab6c
--- /dev/null
+++ b/Sources/c_snikket/iinclude/htmlparser/HtmlNode.h
@@ -0,0 +1,63 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_htmlparser_HtmlNode
+#define INCLUDED_htmlparser_HtmlNode
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(htmlparser,HtmlNode)
+HX_DECLARE_CLASS1(htmlparser,HtmlNodeElement)
+
+namespace htmlparser{
+
+
+class HXCPP_CLASS_ATTRIBUTES HtmlNode_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef HtmlNode_obj OBJ_;
+ HtmlNode_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0ca65a7f };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="htmlparser.HtmlNode")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"htmlparser.HtmlNode"); }
+
+ inline static ::hx::ObjectPtr< HtmlNode_obj > __new() {
+ ::hx::ObjectPtr< HtmlNode_obj > __this = new HtmlNode_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< HtmlNode_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ HtmlNode_obj *__this = (HtmlNode_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(HtmlNode_obj), true, "htmlparser.HtmlNode"));
+ *(void **)__this = HtmlNode_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~HtmlNode_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("HtmlNode",2d,19,fa,e5); }
+
+ ::htmlparser::HtmlNodeElement parent;
+};
+
+} // end namespace htmlparser
+
+#endif /* INCLUDED_htmlparser_HtmlNode */
diff --git a/Sources/c_snikket/iinclude/htmlparser/HtmlNodeElement.h b/Sources/c_snikket/iinclude/htmlparser/HtmlNodeElement.h
new file mode 100644
index 0000000..6960292
--- /dev/null
+++ b/Sources/c_snikket/iinclude/htmlparser/HtmlNodeElement.h
@@ -0,0 +1,62 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_htmlparser_HtmlNodeElement
+#define INCLUDED_htmlparser_HtmlNodeElement
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_htmlparser_HtmlNode
+#include <htmlparser/HtmlNode.h>
+#endif
+HX_DECLARE_CLASS1(htmlparser,HtmlAttribute)
+HX_DECLARE_CLASS1(htmlparser,HtmlNode)
+HX_DECLARE_CLASS1(htmlparser,HtmlNodeElement)
+
+namespace htmlparser{
+
+
+class HXCPP_CLASS_ATTRIBUTES HtmlNodeElement_obj : public ::htmlparser::HtmlNode_obj
+{
+ public:
+ typedef ::htmlparser::HtmlNode_obj super;
+ typedef HtmlNodeElement_obj OBJ_;
+ HtmlNodeElement_obj();
+
+ public:
+ enum { _hx_ClassId = 0x234247c5 };
+
+ void __construct(::String name,::Array< ::Dynamic> attributes);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="htmlparser.HtmlNodeElement")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"htmlparser.HtmlNodeElement"); }
+ static ::hx::ObjectPtr< HtmlNodeElement_obj > __new(::String name,::Array< ::Dynamic> attributes);
+ static ::hx::ObjectPtr< HtmlNodeElement_obj > __alloc(::hx::Ctx *_hx_ctx,::String name,::Array< ::Dynamic> attributes);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~HtmlNodeElement_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("HtmlNodeElement",0f,ed,ee,fb); }
+
+ ::String name;
+ ::Array< ::Dynamic> attributes;
+ ::Array< ::Dynamic> nodes;
+ ::Array< ::Dynamic> children;
+ void addChild( ::htmlparser::HtmlNode node, ::htmlparser::HtmlNode beforeNode);
+ ::Dynamic addChild_dyn();
+
+};
+
+} // end namespace htmlparser
+
+#endif /* INCLUDED_htmlparser_HtmlNodeElement */
diff --git a/Sources/c_snikket/iinclude/htmlparser/HtmlNodeText.h b/Sources/c_snikket/iinclude/htmlparser/HtmlNodeText.h
new file mode 100644
index 0000000..82be3b5
--- /dev/null
+++ b/Sources/c_snikket/iinclude/htmlparser/HtmlNodeText.h
@@ -0,0 +1,58 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_htmlparser_HtmlNodeText
+#define INCLUDED_htmlparser_HtmlNodeText
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_htmlparser_HtmlNode
+#include <htmlparser/HtmlNode.h>
+#endif
+HX_DECLARE_CLASS1(htmlparser,HtmlNode)
+HX_DECLARE_CLASS1(htmlparser,HtmlNodeText)
+
+namespace htmlparser{
+
+
+class HXCPP_CLASS_ATTRIBUTES HtmlNodeText_obj : public ::htmlparser::HtmlNode_obj
+{
+ public:
+ typedef ::htmlparser::HtmlNode_obj super;
+ typedef HtmlNodeText_obj OBJ_;
+ HtmlNodeText_obj();
+
+ public:
+ enum { _hx_ClassId = 0x699e2404 };
+
+ void __construct(::String text);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="htmlparser.HtmlNodeText")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"htmlparser.HtmlNodeText"); }
+ static ::hx::ObjectPtr< HtmlNodeText_obj > __new(::String text);
+ static ::hx::ObjectPtr< HtmlNodeText_obj > __alloc(::hx::Ctx *_hx_ctx,::String text);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~HtmlNodeText_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("HtmlNodeText",7a,ac,55,90); }
+
+ ::String text;
+ ::String toText();
+ ::Dynamic toText_dyn();
+
+};
+
+} // end namespace htmlparser
+
+#endif /* INCLUDED_htmlparser_HtmlNodeText */
diff --git a/Sources/c_snikket/iinclude/htmlparser/HtmlParser.h b/Sources/c_snikket/iinclude/htmlparser/HtmlParser.h
new file mode 100644
index 0000000..88c417e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/htmlparser/HtmlParser.h
@@ -0,0 +1,98 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_htmlparser_HtmlParser
+#define INCLUDED_htmlparser_HtmlParser
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(EReg)
+HX_DECLARE_CLASS1(htmlparser,HtmlAttribute)
+HX_DECLARE_CLASS1(htmlparser,HtmlNode)
+HX_DECLARE_CLASS1(htmlparser,HtmlNodeElement)
+HX_DECLARE_CLASS1(htmlparser,HtmlParser)
+
+namespace htmlparser{
+
+
+class HXCPP_CLASS_ATTRIBUTES HtmlParser_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef HtmlParser_obj OBJ_;
+ HtmlParser_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0d37c69c };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="htmlparser.HtmlParser")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"htmlparser.HtmlParser"); }
+ static ::hx::ObjectPtr< HtmlParser_obj > __new();
+ static ::hx::ObjectPtr< HtmlParser_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~HtmlParser_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("HtmlParser",ca,0c,fb,b1); }
+
+ static void __boot();
+ static ::Dynamic SELF_CLOSING_TAGS_HTML;
+ static ::String reID;
+ static ::String reNamespacedID;
+ static ::String reCDATA;
+ static ::String reScript;
+ static ::String reStyle;
+ static ::String reElementOpen;
+ static ::String reAttr;
+ static ::String reElementEnd;
+ static ::String reElementClose;
+ static ::String reComment;
+ static ::EReg reMain;
+ static ::EReg reParseAttrs;
+ static ::Array< ::Dynamic> run(::String str,::hx::Null< bool > tolerant);
+ static ::Dynamic run_dyn();
+
+ static ::Array< ::Dynamic> parseAttrs(::String str);
+ static ::Dynamic parseAttrs_dyn();
+
+ bool tolerant;
+ ::Array< ::Dynamic> matches;
+ ::String str;
+ int i;
+ ::Array< ::Dynamic> parse(::String str,::hx::Null< bool > tolerant);
+ ::Dynamic parse_dyn();
+
+ ::Dynamic processMatches(::Array< ::String > openedTagsLC);
+ ::Dynamic processMatches_dyn();
+
+ ::Dynamic parseElement(::Array< ::String > openedTagsLC);
+ ::Dynamic parseElement_dyn();
+
+ bool isSelfClosingTag(::String tag);
+ ::Dynamic isSelfClosingTag_dyn();
+
+ ::htmlparser::HtmlNodeElement newElement(::String name,::Array< ::Dynamic> attributes);
+ ::Dynamic newElement_dyn();
+
+ ::Dynamic getPosition(int matchIndex);
+ ::Dynamic getPosition_dyn();
+
+};
+
+} // end namespace htmlparser
+
+#endif /* INCLUDED_htmlparser_HtmlParser */
diff --git a/Sources/c_snikket/iinclude/htmlparser/HtmlParserException.h b/Sources/c_snikket/iinclude/htmlparser/HtmlParserException.h
new file mode 100644
index 0000000..e32202a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/htmlparser/HtmlParserException.h
@@ -0,0 +1,77 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_htmlparser_HtmlParserException
+#define INCLUDED_htmlparser_HtmlParserException
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_8ec4e8a8c4e51446_12_new)
+HX_DECLARE_CLASS1(htmlparser,HtmlParserException)
+
+namespace htmlparser{
+
+
+class HXCPP_CLASS_ATTRIBUTES HtmlParserException_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef HtmlParserException_obj OBJ_;
+ HtmlParserException_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0872044b };
+
+ void __construct(::String message, ::Dynamic pos);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="htmlparser.HtmlParserException")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"htmlparser.HtmlParserException"); }
+
+ inline static ::hx::ObjectPtr< HtmlParserException_obj > __new(::String message, ::Dynamic pos) {
+ ::hx::ObjectPtr< HtmlParserException_obj > __this = new HtmlParserException_obj();
+ __this->__construct(message,pos);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< HtmlParserException_obj > __alloc(::hx::Ctx *_hx_ctx,::String message, ::Dynamic pos) {
+ HtmlParserException_obj *__this = (HtmlParserException_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(HtmlParserException_obj), true, "htmlparser.HtmlParserException"));
+ *(void **)__this = HtmlParserException_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_8ec4e8a8c4e51446_12_new)
+HXLINE( 13) ( ( ::htmlparser::HtmlParserException)(__this) )->message = message;
+HXLINE( 15) ( ( ::htmlparser::HtmlParserException)(__this) )->line = ( (int)(pos->__Field(HX_("line",f4,17,b3,47),::hx::paccDynamic)) );
+HXLINE( 16) ( ( ::htmlparser::HtmlParserException)(__this) )->column = ( (int)(pos->__Field(HX_("column",d6,4e,8b,c6),::hx::paccDynamic)) );
+HXLINE( 17) ( ( ::htmlparser::HtmlParserException)(__this) )->length = ( (int)(pos->__Field(HX_("length",e6,94,07,9f),::hx::paccDynamic)) );
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~HtmlParserException_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("HtmlParserException",25,fa,72,da); }
+
+ ::String message;
+ int line;
+ int column;
+ int length;
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+};
+
+} // end namespace htmlparser
+
+#endif /* INCLUDED_htmlparser_HtmlParserException */
diff --git a/Sources/c_snikket/iinclude/htmlparser/HtmlTools.h b/Sources/c_snikket/iinclude/htmlparser/HtmlTools.h
new file mode 100644
index 0000000..a082fb8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/htmlparser/HtmlTools.h
@@ -0,0 +1,67 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_htmlparser_HtmlTools
+#define INCLUDED_htmlparser_HtmlTools
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+HX_DECLARE_CLASS1(htmlparser,HtmlTools)
+
+namespace htmlparser{
+
+
+class HXCPP_CLASS_ATTRIBUTES HtmlTools_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef HtmlTools_obj OBJ_;
+ HtmlTools_obj();
+
+ public:
+ enum { _hx_ClassId = 0x319122e2 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="htmlparser.HtmlTools")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"htmlparser.HtmlTools"); }
+
+ inline static ::hx::ObjectPtr< HtmlTools_obj > __new() {
+ ::hx::ObjectPtr< HtmlTools_obj > __this = new HtmlTools_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< HtmlTools_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ HtmlTools_obj *__this = (HtmlTools_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(HtmlTools_obj), false, "htmlparser.HtmlTools"));
+ *(void **)__this = HtmlTools_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~HtmlTools_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("HtmlTools",90,c8,4b,c9); }
+
+ static ::haxe::ds::StringMap htmlUnescapeMap;
+ static ::haxe::ds::StringMap get_htmlUnescapeMap();
+ static ::Dynamic get_htmlUnescapeMap_dyn();
+
+ static ::String unescape(::String text);
+ static ::Dynamic unescape_dyn();
+
+};
+
+} // end namespace htmlparser
+
+#endif /* INCLUDED_htmlparser_HtmlTools */
diff --git a/Sources/c_snikket/iinclude/httpstatus/_HttpStatusMessage/HttpStatusMessage_Impl_.h b/Sources/c_snikket/iinclude/httpstatus/_HttpStatusMessage/HttpStatusMessage_Impl_.h
new file mode 100644
index 0000000..dfe9b21
--- /dev/null
+++ b/Sources/c_snikket/iinclude/httpstatus/_HttpStatusMessage/HttpStatusMessage_Impl_.h
@@ -0,0 +1,62 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_httpstatus__HttpStatusMessage_HttpStatusMessage_Impl_
+#define INCLUDED_httpstatus__HttpStatusMessage_HttpStatusMessage_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(httpstatus,_HttpStatusMessage,HttpStatusMessage_Impl_)
+
+namespace httpstatus{
+namespace _HttpStatusMessage{
+
+
+class HXCPP_CLASS_ATTRIBUTES HttpStatusMessage_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef HttpStatusMessage_Impl__obj OBJ_;
+ HttpStatusMessage_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x0de4d9f9 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="httpstatus._HttpStatusMessage.HttpStatusMessage_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"httpstatus._HttpStatusMessage.HttpStatusMessage_Impl_"); }
+
+ inline static ::hx::ObjectPtr< HttpStatusMessage_Impl__obj > __new() {
+ ::hx::ObjectPtr< HttpStatusMessage_Impl__obj > __this = new HttpStatusMessage_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< HttpStatusMessage_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ HttpStatusMessage_Impl__obj *__this = (HttpStatusMessage_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(HttpStatusMessage_Impl__obj), false, "httpstatus._HttpStatusMessage.HttpStatusMessage_Impl_"));
+ *(void **)__this = HttpStatusMessage_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~HttpStatusMessage_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("HttpStatusMessage_Impl_",4d,ec,1b,89); }
+
+ static ::String fromCode(int statusCode);
+ static ::Dynamic fromCode_dyn();
+
+};
+
+} // end namespace httpstatus
+} // end namespace _HttpStatusMessage
+
+#endif /* INCLUDED_httpstatus__HttpStatusMessage_HttpStatusMessage_Impl_ */
diff --git a/Sources/c_snikket/iinclude/hx/Anon.h b/Sources/c_snikket/iinclude/hx/Anon.h
new file mode 100644
index 0000000..f41e2ee
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/Anon.h
@@ -0,0 +1,752 @@
+#ifndef HX_ANON_H
+#define HX_ANON_H
+
+
+namespace hx
+{
+
+typedef Dynamic FieldMap;
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic FieldMapCreate();
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+bool FieldMapGet(Dynamic *inMap, const ::String &inName, ::Dynamic &outValue);
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+bool FieldMapHas(Dynamic *inMap, const ::String &inName);
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+bool FieldMapGet(Dynamic *inMap, int inID, ::Dynamic &outValue);
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+#ifdef HXCPP_GC_GENERATIONAL
+void FieldMapSet(hx::Object *inThis,Dynamic *inMap, const ::String &inName, const ::Dynamic &inValue);
+#else
+void FieldMapSet(Dynamic *inMap, const ::String &inName, const ::Dynamic &inValue);
+#endif
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+void FieldMapAppendFields(Dynamic *inMap,::Array< ::String> &outFields);
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+void FieldMapMark(Dynamic *inMap,hx::MarkContext *__inCtx);
+#ifdef HXCPP_VISIT_ALLOCS
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+void FieldMapVisit(Dynamic **inMap,hx::VisitContext *__inCtx);
+#endif
+
+} // end namespace hx
+
+
+
+
+namespace hx
+{
+
+// --- hx::Anon_obj ----------------------------------------------
+//
+// The hx::Anon_obj contains an arbitrary string map of fields.
+
+class HXCPP_EXTERN_CLASS_ATTRIBUTES Anon_obj : public hx::Object
+{
+ typedef hx::Anon_obj OBJ_;
+ typedef hx::ObjectPtr<hx::Anon_obj> Anon;
+ typedef hx::Object super;
+
+ inline void *operator new( size_t inSize, int inExtra )
+ {
+ return hx::Object::operator new(inSize+inExtra, true, 0);
+ }
+
+ struct VariantKey
+ {
+ int hash;
+ String key;
+ cpp::Variant value;
+ };
+
+ Dynamic mFields;
+ int mFixedFields;
+
+public:
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdDynamic };
+
+ inline void *operator new( size_t inSize )
+ {
+ return hx::Object::operator new(inSize, true, 0);
+ }
+ inline void operator delete(void *, size_t inSize ) { }
+ inline void operator delete(void *, size_t inSize, int inExtra ) { }
+
+ inline Anon_obj *setFixed(int index, const String &inName, const ::cpp::Variant &inValue)
+ {
+ VariantKey *fixed = getFixed() + index;
+ fixed->hash = inName.hash();
+ fixed->key = inName;
+ fixed->value = inValue;
+ if (inValue.type == ::cpp::Variant::typeObject) {
+ HX_OBJ_WB_GET(this, inValue.valObject);
+ }
+ else if (inValue.type == ::cpp::Variant::typeString) {
+ HX_OBJ_WB_GET(this, inValue.valStringPtr);
+ }
+ return this;
+ }
+ inline VariantKey *getFixed()
+ {
+ return (VariantKey *)(this + 1);
+ }
+ inline int findFixed(const ::String &inKey,bool inSkip5 = false);
+
+
+
+
+ Anon_obj(int inFixedFields = 0);
+
+ static Anon Create(int inElements)
+ {
+ return Anon(new (inElements*sizeof(VariantKey) ) hx::Anon_obj(inElements) );
+ }
+
+ static Anon Create() { return Anon(new (0) hx::Anon_obj); }
+ static Anon Create(const Dynamic &inSrc) { return Anon(new (0) hx::Anon_obj); }
+
+ static Dynamic __CreateEmpty() { return Anon(new (0) hx::Anon_obj); }
+ static Dynamic __Create(DynamicArray inArgs);
+ static void __boot();
+
+ void operator delete( void *, int) { }
+
+
+ hx::Val __Field(const String &inString ,hx::PropertyAccess inCallProp);
+ bool __HasField(const String &inString);
+ hx::Val __SetField(const String &inString,const hx::Val &inValue ,hx::PropertyAccess inCallProp);
+ virtual void __GetFields(Array<String> &outFields);
+ Dynamic *__GetFieldMap() { return &mFields; }
+
+ virtual int __GetType() const { return vtObject; }
+
+ hx::Anon_obj *Add(const String &inName,const Dynamic &inValue,bool inSetThisPointer=true);
+ void __Mark(hx::MarkContext *__inCtx);
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx);
+ #endif
+
+ String __ToString() const;
+ String toString();
+
+ static hx::ObjectPtr<hx::Class_obj> __mClass; \
+ static hx::ObjectPtr<hx::Class_obj> &__SGetClass() { return __mClass; }
+ hx::ObjectPtr<hx::Class_obj > __GetClass() const { return __mClass; }
+
+ bool __Remove(String inKey);
+};
+
+
+typedef hx::ObjectPtr<hx::Anon_obj> Anon;
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Anon SourceInfo(String inFile, int inLine, String inClass, String inMethod);
+
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES String StringFromAnonFields(hx::Object *inPtr);
+
+
+template<typename _hx_T0>
+class AnonStruct1_obj : public hx::Object
+{
+public:
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdDynamic };
+
+ String name0; _hx_T0 t0;
+
+ inline static hx::Object *Create(const String &inName0, _hx_T0 inT0)
+ {
+ AnonStruct1_obj *result = new AnonStruct1_obj;
+ result->name0 = inName0; result->t0 = inT0;
+ if (hx::ContainsPointers<_hx_T0>()) {
+ HX_OBJ_WB_GET(result, hx::PointerOf(inT0));
+ }
+ return result;
+ }
+ hx::Val __Field(const String &inField, hx::PropertyAccess)
+ {
+ if (HX_QSTR_EQ(inField,name0)) return t0;
+ return null();
+ }
+ hx::Val __SetField(const String &inField,const hx::Val &inValue, hx::PropertyAccess inCallProp)
+ {
+ if (inField.__s==name0.__s || HX_QSTR_EQ(inField,name0)) {
+ t0 = inValue.Cast< _hx_T0 >();
+ if (hx::ContainsPointers<_hx_T0>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t0));
+ }
+ return inValue;
+ }
+ hx::Throw(HX_CSTRING("Missing field ") + inField);
+ return inValue;
+ }
+
+ void __Mark(hx::MarkContext *__inCtx)
+ {
+ HX_MARK_MEMBER(t0);
+ }
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx)
+ {
+ HX_VISIT_MEMBER(t0);
+ }
+ #endif
+
+ void __GetFields(Array<String> &outFields)
+ {
+ outFields->push(name0);
+ }
+
+ String toString() { return StringFromAnonFields(this); }
+};
+
+
+
+template<typename _hx_T0, typename _hx_T1>
+class AnonStruct2_obj : public hx::Object
+{
+public:
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdDynamic };
+
+ String name0; _hx_T0 t0;
+ String name1; _hx_T1 t1;
+
+ inline static hx::Object *Create(const String &inName0, _hx_T0 inT0,
+ const String &inName1, _hx_T1 inT1)
+ {
+ AnonStruct2_obj *result = new AnonStruct2_obj;
+ result->name0 = inName0; result->t0 = inT0;
+ if (hx::ContainsPointers<_hx_T0>()) {
+ HX_OBJ_WB_GET(result, hx::PointerOf(inT0));
+ }
+ result->name1 = inName1; result->t1 = inT1;
+ if (hx::ContainsPointers<_hx_T1>()) {
+ HX_OBJ_WB_GET(result, hx::PointerOf(inT1));
+ }
+ return result;
+ }
+ hx::Val __Field(const String &inField, hx::PropertyAccess)
+ {
+ if (inField.__s==name0.__s) return t0;
+ if (inField.__s==name1.__s) return t1;
+
+ #ifdef HX_SMART_STRINGS
+ if (!inField.isAsciiEncodedQ())
+ return null();
+ #endif
+
+ if (HX_QSTR_EQ_AE(inField,name0)) return t0;
+ if (HX_QSTR_EQ_AE(inField,name1)) return t1;
+ return null();
+ }
+ hx::Val __SetField(const String &inField,const hx::Val &inValue, hx::PropertyAccess inCallProp)
+ {
+ if (inField.__s==name0.__s) {
+ t0 = inValue.Cast< _hx_T0 >();
+ if (hx::ContainsPointers<_hx_T0>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t0));
+ }
+ return inValue;
+ }
+ if (inField.__s==name1.__s) {
+ t1 = inValue.Cast< _hx_T1 >();
+ if (hx::ContainsPointers<_hx_T1>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t1));
+ }
+ return inValue;
+ }
+
+ if (HX_QSTR_EQ(inField,name0)) {
+ t0 = inValue.Cast< _hx_T0 >();
+ if (hx::ContainsPointers<_hx_T0>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t0));
+ }
+ return inValue;
+ }
+ if (HX_QSTR_EQ(inField,name1)) {
+ t1 = inValue.Cast< _hx_T1 >();
+ if (hx::ContainsPointers<_hx_T1>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t1));
+ }
+ return inValue;
+ }
+ hx::Throw(HX_CSTRING("Missing field ") + inField);
+ return inValue;
+ }
+
+ void __Mark(hx::MarkContext *__inCtx)
+ {
+ HX_MARK_MEMBER(t0);
+ HX_MARK_MEMBER(t1);
+ }
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx)
+ {
+ HX_VISIT_MEMBER(t0);
+ HX_VISIT_MEMBER(t1);
+ }
+ #endif
+
+ void __GetFields(Array<String> &outFields)
+ {
+ outFields->push(name0);
+ outFields->push(name1);
+ }
+
+ String toString() { return StringFromAnonFields(this); }
+
+};
+
+
+
+template<typename _hx_T0, typename _hx_T1, typename _hx_T2>
+class AnonStruct3_obj : public hx::Object
+{
+public:
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdDynamic };
+
+ String name0; _hx_T0 t0;
+ String name1; _hx_T1 t1;
+ String name2; _hx_T2 t2;
+
+ inline static hx::Object *Create(const String &inName0, _hx_T0 inT0,
+ const String &inName1, _hx_T1 inT1,
+ const String &inName2, _hx_T2 inT2)
+ {
+ AnonStruct3_obj *result = new AnonStruct3_obj;
+ result->name0 = inName0; result->t0 = inT0;
+ if (hx::ContainsPointers<_hx_T0>()) {
+ HX_OBJ_WB_GET(result, hx::PointerOf(inT0));
+ }
+ result->name1 = inName1; result->t1 = inT1;
+ if (hx::ContainsPointers<_hx_T1>()) {
+ HX_OBJ_WB_GET(result, hx::PointerOf(inT1));
+ }
+ result->name2 = inName2; result->t2 = inT2;
+ if (hx::ContainsPointers<_hx_T2>()) {
+ HX_OBJ_WB_GET(result, hx::PointerOf(inT2));
+ }
+ return result;
+ }
+ hx::Val __Field(const String &inField, hx::PropertyAccess)
+ {
+ if (inField.__s==name0.__s) return t0;
+ if (inField.__s==name1.__s) return t1;
+ if (inField.__s==name2.__s) return t2;
+ #ifdef HX_SMART_STRINGS
+ if (!inField.isAsciiEncodedQ())
+ return null();
+ #endif
+ if (HX_QSTR_EQ_AE(inField,name0)) return t0;
+ if (HX_QSTR_EQ_AE(inField,name1)) return t1;
+ if (HX_QSTR_EQ_AE(inField,name2)) return t2;
+ return null();
+ }
+ hx::Val __SetField(const String &inField,const hx::Val &inValue, hx::PropertyAccess inCallProp)
+ {
+ if (inField.__s==name0.__s) {
+ t0 = inValue.Cast< _hx_T0 >();
+ if (hx::ContainsPointers<_hx_T0>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t0));
+ }
+ return inValue;
+ }
+ if (inField.__s==name1.__s) {
+ t1 = inValue.Cast< _hx_T1 >();
+ if (hx::ContainsPointers<_hx_T1>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t1));
+ }
+ return inValue;
+ }
+ if (inField.__s==name2.__s) {
+ t2 = inValue.Cast< _hx_T2 >();
+ if (hx::ContainsPointers<_hx_T2>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t2));
+ }
+ return inValue;
+ }
+
+
+ if (HX_QSTR_EQ(inField,name0)) {
+ t0 = inValue.Cast< _hx_T0 >();
+ if (hx::ContainsPointers<_hx_T0>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t0));
+ }
+ return inValue;
+ }
+ if (HX_QSTR_EQ(inField,name1)) {
+ t1 = inValue.Cast< _hx_T1 >();
+ if (hx::ContainsPointers<_hx_T1>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t1));
+ }
+ return inValue;
+ }
+ if (HX_QSTR_EQ(inField,name2)) {
+ t2 = inValue.Cast< _hx_T2 >();
+ if (hx::ContainsPointers<_hx_T2>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t2));
+ }
+ return inValue;
+ }
+ hx::Throw(HX_CSTRING("Missing field ") + inField);
+ return inValue;
+ }
+
+ void __Mark(hx::MarkContext *__inCtx)
+ {
+ HX_MARK_MEMBER(t0);
+ HX_MARK_MEMBER(t1);
+ HX_MARK_MEMBER(t2);
+ }
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx)
+ {
+ HX_VISIT_MEMBER(t0);
+ HX_VISIT_MEMBER(t1);
+ HX_VISIT_MEMBER(t2);
+ }
+ #endif
+
+ void __GetFields(Array<String> &outFields)
+ {
+ outFields->push(name0);
+ outFields->push(name1);
+ outFields->push(name2);
+ }
+
+ String toString() { return StringFromAnonFields(this); }
+};
+
+
+template<typename _hx_T0, typename _hx_T1, typename _hx_T2, typename _hx_T3>
+class AnonStruct4_obj : public hx::Object
+{
+public:
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdDynamic };
+
+ String name0; _hx_T0 t0;
+ String name1; _hx_T1 t1;
+ String name2; _hx_T2 t2;
+ String name3; _hx_T3 t3;
+
+ inline static hx::Object *Create(const String &inName0, _hx_T0 inT0,
+ const String &inName1, _hx_T1 inT1,
+ const String &inName2, _hx_T2 inT2,
+ const String &inName3, _hx_T3 inT3
+ )
+ {
+ AnonStruct4_obj *result = new AnonStruct4_obj;
+ result->name0 = inName0; result->t0 = inT0;
+ if (hx::ContainsPointers<_hx_T0>()) {
+ HX_OBJ_WB_GET(result, hx::PointerOf(inT0));
+ }
+ result->name1 = inName1; result->t1 = inT1;
+ if (hx::ContainsPointers<_hx_T1>()) {
+ HX_OBJ_WB_GET(result, hx::PointerOf(inT1));
+ }
+ result->name2 = inName2; result->t2 = inT2;
+ if (hx::ContainsPointers<_hx_T2>()) {
+ HX_OBJ_WB_GET(result, hx::PointerOf(inT2));
+ }
+ result->name3 = inName3; result->t3 = inT3;
+ if (hx::ContainsPointers<_hx_T3>()) {
+ HX_OBJ_WB_GET(result, hx::PointerOf(inT3));
+ }
+ return result;
+ }
+ hx::Val __Field(const String &inField, hx::PropertyAccess)
+ {
+ if (inField.__s==name0.__s) return t0;
+ if (inField.__s==name1.__s) return t1;
+ if (inField.__s==name2.__s) return t2;
+ if (inField.__s==name3.__s) return t3;
+ #ifdef HX_SMART_STRINGS
+ if (!inField.isAsciiEncodedQ())
+ return null();
+ #endif
+ if (HX_QSTR_EQ_AE(inField,name0)) return t0;
+ if (HX_QSTR_EQ_AE(inField,name1)) return t1;
+ if (HX_QSTR_EQ_AE(inField,name2)) return t2;
+ if (HX_QSTR_EQ_AE(inField,name3)) return t3;
+ return null();
+ }
+ hx::Val __SetField(const String &inField,const hx::Val &inValue, hx::PropertyAccess inCallProp)
+ {
+ if (inField.__s==name0.__s) {
+ t0 = inValue.Cast< _hx_T0 >();
+ if (hx::ContainsPointers<_hx_T0>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t0));
+ }
+ return inValue;
+ }
+ if (inField.__s==name1.__s) {
+ t1 = inValue.Cast< _hx_T1 >();
+ if (hx::ContainsPointers<_hx_T1>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t1));
+ }
+ return inValue;
+ }
+ if (inField.__s==name2.__s) {
+ t2 = inValue.Cast< _hx_T2 >();
+ if (hx::ContainsPointers<_hx_T2>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t2));
+ }
+ return inValue;
+ }
+ if (inField.__s==name3.__s) {
+ t3 = inValue.Cast< _hx_T3 >();
+ if (hx::ContainsPointers<_hx_T3>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t3));
+ }
+ return inValue;
+ }
+
+
+
+ if (HX_QSTR_EQ(inField,name0)) {
+ t0 = inValue.Cast< _hx_T0 >();
+ if (hx::ContainsPointers<_hx_T0>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t0));
+ }
+ return inValue;
+ }
+ if (HX_QSTR_EQ(inField,name1)) {
+ t1 = inValue.Cast< _hx_T1 >();
+ if (hx::ContainsPointers<_hx_T1>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t1));
+ }
+ return inValue;
+ }
+ if (HX_QSTR_EQ(inField,name2)) {
+ t2 = inValue.Cast< _hx_T2 >();
+ if (hx::ContainsPointers<_hx_T2>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t2));
+ }
+ return inValue;
+ }
+ if (HX_QSTR_EQ(inField,name3)) {
+ t3 = inValue.Cast< _hx_T3 >();
+ if (hx::ContainsPointers<_hx_T3>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t3));
+ }
+ return inValue;
+ }
+ hx::Throw(HX_CSTRING("Missing field ") + inField);
+ return inValue;
+ }
+
+ void __Mark(hx::MarkContext *__inCtx)
+ {
+ HX_MARK_MEMBER(t0);
+ HX_MARK_MEMBER(t1);
+ HX_MARK_MEMBER(t2);
+ HX_MARK_MEMBER(t3);
+ }
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx)
+ {
+ HX_VISIT_MEMBER(t0);
+ HX_VISIT_MEMBER(t1);
+ HX_VISIT_MEMBER(t2);
+ HX_VISIT_MEMBER(t3);
+ }
+ #endif
+
+ void __GetFields(Array<String> &outFields)
+ {
+ outFields->push(name0);
+ outFields->push(name1);
+ outFields->push(name2);
+ outFields->push(name3);
+ }
+
+ String toString() { return StringFromAnonFields(this); }
+};
+
+
+
+
+template<typename _hx_T0, typename _hx_T1, typename _hx_T2, typename _hx_T3, typename _hx_T4>
+class AnonStruct5_obj : public hx::Object
+{
+public:
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdDynamic };
+
+ String name0; _hx_T0 t0;
+ String name1; _hx_T1 t1;
+ String name2; _hx_T2 t2;
+ String name3; _hx_T3 t3;
+ String name4; _hx_T4 t4;
+
+ inline static hx::Object *Create(const String &inName0, _hx_T0 inT0,
+ const String &inName1, _hx_T1 inT1,
+ const String &inName2, _hx_T2 inT2,
+ const String &inName3, _hx_T3 inT3,
+ const String &inName4, _hx_T4 inT4
+ )
+ {
+ AnonStruct5_obj *result = new AnonStruct5_obj;
+ result->name0 = inName0; result->t0 = inT0;
+ if (hx::ContainsPointers<_hx_T0>()) {
+ HX_OBJ_WB_GET(result, hx::PointerOf(inT0));
+ }
+ result->name1 = inName1; result->t1 = inT1;
+ if (hx::ContainsPointers<_hx_T1>()) {
+ HX_OBJ_WB_GET(result, hx::PointerOf(inT1));
+ }
+ result->name2 = inName2; result->t2 = inT2;
+ if (hx::ContainsPointers<_hx_T2>()) {
+ HX_OBJ_WB_GET(result, hx::PointerOf(inT2));
+ }
+ result->name3 = inName3; result->t3 = inT3;
+ if (hx::ContainsPointers<_hx_T3>()) {
+ HX_OBJ_WB_GET(result, hx::PointerOf(inT3));
+ }
+ result->name4 = inName4; result->t4 = inT4;
+ if (hx::ContainsPointers<_hx_T4>()) {
+ HX_OBJ_WB_GET(result, hx::PointerOf(inT4));
+ }
+ return result;
+ }
+ hx::Val __Field(const String &inField, hx::PropertyAccess)
+ {
+ if (inField.__s==name0.__s) return t0;
+ if (inField.__s==name1.__s) return t1;
+ if (inField.__s==name2.__s) return t2;
+ if (inField.__s==name3.__s) return t3;
+ if (inField.__s==name4.__s) return t4;
+ #ifdef HX_SMART_STRINGS
+ if (!inField.isAsciiEncodedQ())
+ return null();
+ #endif
+ if (HX_QSTR_EQ_AE(inField,name0)) return t0;
+ if (HX_QSTR_EQ_AE(inField,name1)) return t1;
+ if (HX_QSTR_EQ_AE(inField,name2)) return t2;
+ if (HX_QSTR_EQ_AE(inField,name3)) return t3;
+ if (HX_QSTR_EQ_AE(inField,name4)) return t4;
+ return null();
+ }
+ hx::Val __SetField(const String &inField,const hx::Val &inValue, hx::PropertyAccess inCallProp)
+ {
+ if (inField.__s==name0.__s) {
+ t0 = inValue.Cast< _hx_T0 >();
+ if (hx::ContainsPointers<_hx_T0>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t0));
+ }
+ return inValue;
+ }
+ if (inField.__s==name1.__s) {
+ t1 = inValue.Cast< _hx_T1 >();
+ if (hx::ContainsPointers<_hx_T1>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t1));
+ }
+ return inValue;
+ }
+ if (inField.__s==name2.__s) {
+ t2 = inValue.Cast< _hx_T2 >();
+ if (hx::ContainsPointers<_hx_T2>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t2));
+ }
+ return inValue;
+ }
+ if (inField.__s==name3.__s) {
+ t3 = inValue.Cast< _hx_T3 >();
+ if (hx::ContainsPointers<_hx_T3>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t3));
+ }
+ return inValue;
+ }
+ if (inField.__s==name4.__s) {
+ t4 = inValue.Cast< _hx_T4 >();
+ if (hx::ContainsPointers<_hx_T4>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t4));
+ }
+ return inValue;
+ }
+
+
+
+
+ if (HX_QSTR_EQ(inField,name0)) {
+ t0 = inValue.Cast< _hx_T0 >();
+ if (hx::ContainsPointers<_hx_T0>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t0));
+ }
+ return inValue;
+ }
+ if (HX_QSTR_EQ(inField,name1)) {
+ t1 = inValue.Cast< _hx_T1 >();
+ if (hx::ContainsPointers<_hx_T1>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t1));
+ }
+ return inValue;
+ }
+ if (HX_QSTR_EQ(inField,name2)) {
+ t2 = inValue.Cast< _hx_T2 >();
+ if (hx::ContainsPointers<_hx_T2>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t2));
+ }
+ return inValue;
+ }
+ if (HX_QSTR_EQ(inField,name3)) {
+ t3 = inValue.Cast< _hx_T3 >();
+ if (hx::ContainsPointers<_hx_T3>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t3));
+ }
+ return inValue;
+ }
+ if (HX_QSTR_EQ(inField,name4)) {
+ t4 = inValue.Cast< _hx_T4 >();
+ if (hx::ContainsPointers<_hx_T4>()) {
+ HX_OBJ_WB_GET(this, hx::PointerOf(t4));
+ }
+ return inValue;
+ }
+ hx::Throw(HX_CSTRING("Missing field ") + inField);
+ return inValue;
+ }
+
+ void __Mark(hx::MarkContext *__inCtx)
+ {
+ HX_MARK_MEMBER(t0);
+ HX_MARK_MEMBER(t1);
+ HX_MARK_MEMBER(t2);
+ HX_MARK_MEMBER(t3);
+ HX_MARK_MEMBER(t4);
+ }
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx)
+ {
+ HX_VISIT_MEMBER(t0);
+ HX_VISIT_MEMBER(t1);
+ HX_VISIT_MEMBER(t2);
+ HX_VISIT_MEMBER(t3);
+ HX_VISIT_MEMBER(t4);
+ }
+ #endif
+
+ void __GetFields(Array<String> &outFields)
+ {
+ outFields->push(name0);
+ outFields->push(name1);
+ outFields->push(name2);
+ outFields->push(name3);
+ outFields->push(name4);
+ }
+
+ String toString() { return StringFromAnonFields(this); }
+};
+
+
+
+
+
+
+} // end namespace hx
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+bool __hxcpp_anon_remove(Dynamic inObj,::String inKey);
+
+#endif
diff --git a/Sources/c_snikket/iinclude/hx/Boot.h b/Sources/c_snikket/iinclude/hx/Boot.h
new file mode 100644
index 0000000..22cafde
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/Boot.h
@@ -0,0 +1,15 @@
+#ifndef HX_BOOT_H
+#define HX_BOOT_H
+
+// Properly construct all the classes defined in the haxe code
+void __boot_all();
+
+namespace hx
+{
+
+// Initializer the hxcpp runtime system
+HXCPP_EXTERN_CLASS_ATTRIBUTES void Boot();
+
+}
+
+#endif
diff --git a/Sources/c_snikket/iinclude/hx/CFFI.h b/Sources/c_snikket/iinclude/hx/CFFI.h
new file mode 100644
index 0000000..872e197
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/CFFI.h
@@ -0,0 +1,469 @@
+#ifndef HX_CFFI_H
+#define HX_CFFI_H
+
+// 410 - adds gc_try_unblocking
+#define HX_CFFI_API_VERSION 410
+
+#ifdef HXCPP_JS_PRIME
+#include <emscripten/bind.h>
+using namespace emscripten;
+
+typedef struct emscripten::val value;
+typedef struct _vkind *vkind;
+typedef struct _buffer *buffer;
+#define HAVE_NEKO_TYPES 1
+#endif
+
+#include "OS.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#if defined(BLACKBERRY)
+using namespace std;
+#endif
+// --- Register functions (primitives) ----
+
+#ifdef STATIC_LINK
+
+#define DEFINE_PRIM_MULT(func) \
+int __reg_##func = hx_register_prim(#func "__MULT",(void *)(&func)); \
+
+#define DEFINE_PRIM(func,nargs) \
+int __reg_##func = hx_register_prim(#func "__" #nargs,(void *)(&func)); \
+
+
+#define DEFINE_PRIM_MULT_NATIVE(func,ext) \
+int __reg_##func = hx_register_prim(#func "__MULT",(void *)(&func)) + \
+ hx_register_prim(#func "__" #ext,(void *)(&func##_##ext)) ;
+
+#define DEFINE_PRIM_NATIVE(func,nargs,ext) \
+int __reg_##func = hx_register_prim(#func "__" #nargs,(void *)(&func)) + \
+ hx_register_prim(#func "__" #ext,(void *)(&func##_##ext)) ;
+
+
+#define DEFINE_LIB_PRIM_MULT(lib,func) \
+int __reg_##func = hx_register_prim(lib "_" #func "__MULT",(void *)(&func)); \
+
+#define DEFINE_LIB_PRIM(lib,func,nargs) \
+int __reg_##func = hx_register_prim(lib "_" #func "__" #nargs,(void *)(&func)); \
+
+
+#elif defined(HXCPP_JS_PRIME)
+
+//#define DEFINE_PRIM_MULT(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+//TODO
+#define DEFINE_PRIM_MULT(func)
+
+#define DEFINE_PRIM(func,nargs) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+
+
+#else
+
+
+#define DEFINE_PRIM_MULT(func) extern "C" { \
+ EXPORT void *func##__MULT() { return (void*)(&func); } \
+}
+
+
+#define DEFINE_PRIM(func,nargs) extern "C" { \
+ EXPORT void *func##__##nargs() { return (void*)(&func); } \
+}
+
+
+#define DEFINE_PRIM_MULT_NATIVE(func,ext) extern "C" { \
+ EXPORT void *func##__MULT() { return (void*)(&func); } \
+ EXPORT void *func##__##ext() { return (void*)(&func##_##ext); } \
+}
+
+
+#define DEFINE_PRIM_NATIVE(func,nargs,ext) extern "C" { \
+ EXPORT void *func##__##nargs() { return (void*)(&func); } \
+ EXPORT void *func##__##ext() { return (void*)(&func##_##ext); } \
+}
+
+
+#define DEFINE_LIB_PRIM_MULT(lib,func) extern "C" { \
+ EXPORT void *func##__MULT() { return (void*)(&func); } \
+}
+
+
+#define DEFINE_LIB_PRIM(lib,func,nargs) extern "C" { \
+ EXPORT void *func##__##nargs() { return (void*)(&func); } \
+}
+
+
+
+#endif // !STATIC_LINK
+
+
+
+
+
+#define DEFFUNC_0(ret,name) DEFFUNC(name,ret, (), ())
+#define DEFFUNC_1(ret,name,t1) DEFFUNC(name,ret, (t1 a1), (a1))
+#define DEFFUNC_2(ret,name,t1,t2) DEFFUNC(name,ret, (t1 a1, t2 a2), (a1,a2))
+#define DEFFUNC_3(ret,name,t1,t2,t3) DEFFUNC(name,ret, (t1 a1, t2 a2, t3 a3), (a1,a2,a3))
+#define DEFFUNC_4(ret,name,t1,t2,t3,t4) DEFFUNC(name,ret, (t1 a1, t2 a2, t3 a3, t4 a4), (a1,a2,a3,a4))
+#define DEFFUNC_5(ret,name,t1,t2,t3,t4,t5) DEFFUNC(name,ret, (t1 a1, t2 a2, t3 a3, t4 a4,t5 a5), (a1,a2,a3,a4,a5))
+
+
+enum hxValueType
+{
+ valtUnknown = -1,
+ valtInt = 0xff,
+ valtNull = 0,
+ valtFloat = 1,
+ valtBool = 2,
+ valtString = 3,
+ valtObject = 4,
+ valtArray = 5,
+ valtFunction = 6,
+ valtEnum,
+ valtClass,
+ valtRoot = 0xff,
+ valtAbstractBase = 0x100,
+};
+
+namespace hx
+{
+enum StringEncoding
+{
+ StringAscii,
+ StringUtf8,
+ StringUtf16
+};
+}
+
+// val_fun_nargs may return a special value
+enum { faNotFunction = -2, faVarArgs=-1, faArgs0=0 /* ... */ };
+
+typedef int field;
+
+
+
+#ifdef IMPLEMENT_API
+#include "CFFILoader.h"
+#endif
+
+
+#if !defined(HAVE_NEKO_TYPES)
+#ifdef HXCPP_NATIVE_CFFI_VALUE
+namespace hx { class Object; }
+typedef hx::Object _value;
+#else
+struct _value;
+#endif
+typedef _value *value;
+typedef struct _vkind *vkind;
+typedef struct _buffer *buffer;
+#endif
+
+typedef buffer cffiByteBuffer;
+
+typedef struct _gcroot *gcroot;
+
+typedef void (*hxFinalizer)(value v);
+typedef void (*hxPtrFinalizer)(void *v);
+
+typedef void (__hx_field_iter)(value v,field f,void *);
+
+#define hx_failure(msg) hx_fail(msg,__FILE__,__LINE__)
+
+#ifndef IGNORE_CFFI_API_H
+
+
+#ifndef IMPLEMENT_API
+
+#if defined(STATIC_LINK) || defined(HXCPP_JS_PRIME)
+
+#define DEFFUNC(name,ret,def_args,call_args) \
+extern "C" ret name def_args;
+
+
+#else
+
+#define DEFFUNC(name,ret,def_args,call_args) \
+typedef ret (*FUNC_##name) def_args; \
+extern FUNC_##name name;
+
+#endif
+
+#endif
+
+
+#include "CFFIAPI.h"
+
+
+#ifdef WANT_DYNALLOC_ALLOC_BYTES
+void *DynAlloc::allocBytes(size_t n)
+{
+ return hx_alloc((int)n);
+}
+#endif
+
+
+
+#define DEFINE_KIND(name) extern "C" { vkind name = 0; }
+
+#ifdef STATIC_LINK
+# define DEFINE_ENTRY_POINT(name)
+#else
+# define DEFINE_ENTRY_POINT(name) extern "C" { void name(); EXPORT void *__neko_entry_point() { return (void *)&name; } }
+#endif
+
+#ifdef HEADER_IMPORTS
+# define H_EXTERN IMPORT
+#else
+# define H_EXTERN EXPORT
+#endif
+
+#define DECLARE_PRIM(func,nargs) extern "C" { H_EXTERN void *func##__##nargs(); }
+#define DECLARE_KIND(name) extern "C" { H_EXTERN extern vkind name; }
+
+
+
+// --- Helpers ----------------------------------------------------------------
+
+// Check type...
+inline bool val_is_null(value inVal) { return val_type(inVal)==valtNull; }
+inline bool val_is_int(value inVal) { return val_type(inVal)==valtInt; }
+inline bool val_is_bool(value inVal) { return val_type(inVal)==valtBool; }
+inline bool val_is_float(value inVal) { return val_type(inVal)==valtFloat; }
+inline bool val_is_string(value inVal) { return val_type(inVal)==valtString; }
+inline bool val_is_function(value inVal) { return val_type(inVal)==valtFunction; }
+inline bool val_is_array(value inVal) { return val_type(inVal)==valtArray; }
+inline bool val_is_abstract(value inVal) { return val_type(inVal)>=valtAbstractBase; }
+inline bool val_is_kind(value inVal,vkind inKind) { return val_to_kind(inVal,inKind)!=0; }
+
+inline bool val_is_number(value inVal)
+{
+ int t = val_type(inVal);
+ return t==valtInt || t==valtFloat;
+}
+inline bool val_is_object(value inVal)
+{
+ int t = val_type(inVal);
+ return t==valtObject || t==valtEnum ||t==valtClass;
+}
+
+class AutoGCBlocking
+{
+public:
+ inline AutoGCBlocking(bool inSoftUnlock=false) :
+ mSoftUnlock(inSoftUnlock), mLocked( gc_try_blocking() ) { }
+ inline ~AutoGCBlocking() { Close(); }
+ inline void Close()
+ {
+ if (mLocked)
+ {
+ if (mSoftUnlock)
+ gc_try_unblocking();
+ else
+ gc_exit_blocking();
+ }
+ mLocked = false;
+ }
+
+ bool mLocked;
+ bool mSoftUnlock;
+};
+
+class AutoGCUnblocking
+{
+public:
+ AutoGCUnblocking() : mUnlocked( gc_try_unblocking() ) { }
+ ~AutoGCUnblocking() { Close(); }
+ void Close() { if (mUnlocked) gc_enter_blocking(); mUnlocked = false; }
+
+ bool mUnlocked;
+};
+
+
+class AutoGCRoot
+{
+public:
+ AutoGCRoot(value inValue)
+ {
+ mRoot = 0;
+ mPtr = alloc_root();
+ if (mPtr)
+ *mPtr = inValue;
+ else
+ mRoot = create_root(inValue);
+ }
+
+ ~AutoGCRoot()
+ {
+ if (mPtr)
+ free_root(mPtr);
+ else if (mRoot)
+ destroy_root(mRoot);
+ }
+ value get()const { return mPtr ? *mPtr : query_root(mRoot); }
+ void set(value inValue)
+ {
+ if (mPtr)
+ *mPtr = inValue;
+ else
+ {
+ if (mRoot) destroy_root(mRoot);
+ mRoot = create_root(inValue);
+ }
+ }
+
+private:
+ value *mPtr;
+ gcroot mRoot;
+ AutoGCRoot(const AutoGCRoot &);
+ void operator=(const AutoGCRoot &);
+};
+
+struct CffiBytes
+{
+ CffiBytes( unsigned char *inData=0, int inLength=0) : data(inData), length(inLength) {}
+
+ unsigned char *data;
+ int length;
+};
+
+inline CffiBytes getByteData(value inValue)
+{
+ static field bField = 0;
+ static field lengthField = 0;
+ if (bField==0)
+ {
+ bField = val_id("b");
+ lengthField = val_id("length");
+ }
+
+ if (val_is_object(inValue))
+ {
+ value b = val_field(inValue, bField);
+ value len = val_field(inValue, lengthField);
+ if (val_is_string(b) && val_is_int(len))
+ return CffiBytes( (unsigned char *)val_string(b), val_int(len) );
+ if (val_is_buffer(b) && val_is_int(len))
+ return CffiBytes( (unsigned char *)buffer_data(val_to_buffer(b)), val_int(len) );
+ }
+ else if (val_is_buffer(inValue))
+ {
+ value len = val_field(inValue, lengthField);
+ if (val_is_int(len))
+ {
+ buffer b = val_to_buffer(inValue);
+ return CffiBytes( (unsigned char *)buffer_data(b), val_int(len) );
+ }
+ }
+ return CffiBytes();
+}
+
+inline bool resizeByteData(value inValue, int inNewLen)
+{
+ if (!val_is_object(inValue))
+ return false;
+
+ static field bField = 0;
+ static field lengthField = 0;
+ if (bField==0)
+ {
+ bField = val_id("b");
+ lengthField = val_id("length");
+ }
+ value len = val_field(inValue, lengthField);
+ if (!val_is_int(len))
+ return false;
+ int oldLen = val_int(len);
+ value b = val_field(inValue, bField);
+ if (val_is_string(b))
+ {
+ if (inNewLen>oldLen)
+ {
+ value newString = alloc_raw_string(inNewLen);
+ memcpy( (char *)val_string(newString), val_string(b), inNewLen);
+ alloc_field(inValue, bField, newString );
+ }
+ alloc_field(inValue, lengthField, alloc_int(inNewLen) );
+ }
+ else if (val_is_buffer(b))
+ {
+ cffiByteBuffer buf = val_to_buffer(b);
+ buffer_set_size(buf,inNewLen);
+ alloc_field(inValue, lengthField, alloc_int(inNewLen) );
+ }
+ else
+ return false;
+
+ return true;
+}
+
+
+#define val_null alloc_null()
+
+#define bfailure(x) val_throw(buffer_to_string(x))
+
+#define copy_string(str,len) alloc_string_len(str,len)
+
+
+// The "Check" macros throw an error if assumtion is false
+#define val_check_kind(v,t) if( !val_is_kind(v,t) ) hx_failure("invalid kind");
+#define val_check_function(f,n) if( !val_is_function(f) || (val_fun_nargs(f) != (n) && val_fun_nargs(f) != faVarArgs) ) hx_failure("Bad function");
+#define val_check(v,t) if( !val_is_##t(v) ) hx_failure("type not " #t);
+
+// The "Get" function will return or force an error
+inline bool val_get_bool(value inVal) { val_check(inVal,bool); return val_bool(inVal); }
+inline int val_get_int(value inVal) { val_check(inVal,int); return val_int(inVal); }
+inline double val_get_double(value inVal) { val_check(inVal,number); return val_number(inVal); }
+inline const char *val_get_string(value inVal) { val_check(inVal,string); return val_string(inVal); }
+inline void *val_get_handle(value inVal,vkind inKind)
+ { val_check_kind(inVal,inKind); return val_to_kind(inVal,inKind); }
+
+
+inline value alloc_string(const char *inStr)
+{
+ const char *end = inStr;
+ while(*end) end++;
+ return alloc_string_len(inStr,(int)(end-inStr));
+}
+
+inline value alloc_wstring(const wchar_t *inStr)
+{
+ const wchar_t *end = inStr;
+ while(*end) end++;
+ return alloc_wstring_len(inStr,(int)(end-inStr));
+}
+
+inline void hxcpp_unscramble(const unsigned char *bytes, int len, const char *key, unsigned char *dest)
+{
+ int keyLen = 0;
+ while(key[keyLen])
+ keyLen++;
+ int state = 0;
+ //state = ((state + key[i]) ^ ch) & 0xff);
+ for(int i=0;i<len;i++)
+ {
+ dest[i] = ( (state + key[i%keyLen]) ^ bytes[i] ) & 0xff;
+ state = bytes[i];
+ }
+}
+
+
+//additional glue for easier neko modules compilation
+#define val_true alloc_bool(true)
+#define val_false alloc_bool(false)
+inline void neko_error() { hx_error(); }
+
+
+// Conservative marking within a buffer is not yet supported.
+//inline void * alloc(int i) { return hx_alloc(i); }
+
+// The bytes themselves will be GC'd, but not the pointers contained within.
+inline void * alloc_private(int i) { return hx_alloc(i); }
+
+// You should use alloc_buffer_len/buffer_data instead
+//value alloc_empty_string(int len) { }
+
+
+#endif
+
+
+#endif
diff --git a/Sources/c_snikket/iinclude/hx/CFFIAPI.h b/Sources/c_snikket/iinclude/hx/CFFIAPI.h
new file mode 100644
index 0000000..6a05ada
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/CFFIAPI.h
@@ -0,0 +1,189 @@
+/*
+ This bit of Macro magic is used to define extern function pointers
+ in ndlls, define stub implementations that link back to the hxcpp dll
+ and glue up the implementation in the hxcpp runtime.
+*/
+
+DEFFUNC_1(void,val_throw,value)
+DEFFUNC_0(void,hx_error)
+DEFFUNC_3(void,hx_fail,const char *,const char *,int)
+
+// Determine value type
+DEFFUNC_1(int,val_type,value)
+DEFFUNC_1(vkind,val_kind,value)
+DEFFUNC_2(void *,val_to_kind,value,vkind)
+// don't check the 'kind' ...
+DEFFUNC_1(void *,val_data,value)
+DEFFUNC_1(int,val_fun_nargs,value)
+
+
+// Extract value type
+DEFFUNC_1(bool,val_bool,value)
+DEFFUNC_1(int,val_int,value)
+DEFFUNC_1(double,val_float,value)
+DEFFUNC_1(double,val_number,value)
+
+// Create value type
+
+DEFFUNC_0(value,alloc_null)
+DEFFUNC_1(value,alloc_bool,bool)
+DEFFUNC_1(value,alloc_int,int)
+DEFFUNC_1(value,alloc_float,double)
+DEFFUNC_0(value,alloc_empty_object)
+DEFFUNC_2(value,alloc_abstract,vkind,void *)
+// Allocates conservative-collected memory
+DEFFUNC_3(value,create_abstract,vkind,int,hxFinalizer)
+DEFFUNC_1(void,free_abstract,value)
+DEFFUNC_1(value,alloc_best_int,int)
+DEFFUNC_1(value,alloc_int32,int)
+
+// String access
+DEFFUNC_1(int,val_strlen,value)
+DEFFUNC_2(value,alloc_string_len,const char *,int)
+DEFFUNC_2(value,alloc_wstring_len,const wchar_t *,int)
+
+DEFFUNC_1(const wchar_t *,val_wstring,value)
+DEFFUNC_1(const char *,val_string,value)
+DEFFUNC_1(wchar_t *,val_dup_wstring,value)
+DEFFUNC_1(char *,val_dup_string,value)
+DEFFUNC_2(char *,alloc_string_data,const char *,int)
+
+#ifdef HXCPP_PRIME
+DEFFUNC_2(HxString,alloc_hxs_wchar,const wchar_t *,int)
+DEFFUNC_2(HxString,alloc_hxs_utf16,const char16_t *,int)
+DEFFUNC_2(HxString,alloc_hxs_utf8,const char *,int)
+
+DEFFUNC_2(const char *,hxs_utf8,const HxString &,hx::IStringAlloc *)
+DEFFUNC_2(const wchar_t *,hxs_wchar,const HxString &,hx::IStringAlloc *)
+DEFFUNC_2(const char16_t *,hxs_utf16,const HxString &,hx::IStringAlloc *)
+
+DEFFUNC_1(hx::StringEncoding,hxs_encoding,const HxString &)
+#endif
+
+
+// Array access - generic
+DEFFUNC_1(value,alloc_array,int)
+DEFFUNC_1(int,val_array_size,value)
+DEFFUNC_2(void,val_array_set_size,value,int)
+DEFFUNC_2(value,val_array_i,value,int)
+DEFFUNC_3(void,val_array_set_i,value,int,value)
+DEFFUNC_2(void,val_array_push,value,value)
+
+
+// Array access - fast if possible - may return null
+// Resizing the array may invalidate the pointer
+DEFFUNC_1(bool *,val_array_bool,value)
+DEFFUNC_1(int *,val_array_int,value)
+DEFFUNC_1(double *,val_array_double,value)
+DEFFUNC_1(float *,val_array_float,value)
+DEFFUNC_1(value *,val_array_value,value)
+
+// String Buffer
+// A 'buffer' is a tool for joining strings together.
+// The C++ implementation is haxe.io.BytesData
+// The neko implementation is something else again, and can't be passes as a value, only copied to a string
+
+// Create a buffer from string of an empty buffer of a given length
+DEFFUNC_1(buffer,alloc_buffer,const char *)
+DEFFUNC_1(buffer,alloc_buffer_len,int)
+
+// Append a string representation of a value to the buffer
+DEFFUNC_2(void,val_buffer,buffer,value)
+
+// Append a c-string to a buffer
+DEFFUNC_2(void,buffer_append,buffer,const char *)
+
+// Append given number of bytes of a c-string to the buffer
+DEFFUNC_3(void,buffer_append_sub,buffer,const char *,int)
+
+// Append given character to string
+DEFFUNC_2(void,buffer_append_char,buffer,int)
+
+// Convert buffer back into string value
+DEFFUNC_1(value,buffer_to_string,buffer)
+
+
+
+// These routines are for direct access to the c++ BytesData structure
+// Use getByteData and resizeByteData for more generic access to haxe.io.Bytes
+
+// This will never return true on a neko host.
+DEFFUNC_1(bool,val_is_buffer,value)
+
+// These functions are only valid if val_is_buffer returns true
+// Currently, cffiByteBuffer is the same struct as buffer, but the usage is quite different
+DEFFUNC_1(cffiByteBuffer,val_to_buffer,value)
+
+// Number of byes in the array
+DEFFUNC_1(int,buffer_size,cffiByteBuffer)
+
+// Pointer to the byte data - will become invalid if the array is resized
+DEFFUNC_1(char *,buffer_data,cffiByteBuffer)
+
+// Convert c++ ByteBuffer back to 'value' - no copy involved
+DEFFUNC_1(value,buffer_val,cffiByteBuffer)
+
+// Resize the array - will invalidate the data
+DEFFUNC_2(void,buffer_set_size,cffiByteBuffer,int)
+
+// This is used by resizeByteData for manipulating bytes directly on neko
+DEFFUNC_1(value,alloc_raw_string,int)
+
+// Call Function
+DEFFUNC_1(value,val_call0,value)
+DEFFUNC_2(value,val_call1,value,value)
+DEFFUNC_3(value,val_call2,value,value,value)
+DEFFUNC_4(value,val_call3,value,value,value,value)
+DEFFUNC_3(value,val_callN,value,value *,int)
+
+// Call the function - catch and print any exceptions
+DEFFUNC_1(value,val_call0_traceexcept,value)
+
+// Call object field
+DEFFUNC_2(value,val_ocall0,value,int)
+DEFFUNC_3(value,val_ocall1,value,int,value)
+DEFFUNC_4(value,val_ocall2,value,int,value,value)
+DEFFUNC_4(value,val_ocallN,value,int,value *,int)
+
+// Objects access
+DEFFUNC_1(int,val_id,const char *)
+DEFFUNC_3(void,alloc_field,value,int,value)
+DEFFUNC_3(void,alloc_field_numeric,value,int,double)
+DEFFUNC_2(value,val_field,value,int)
+DEFFUNC_2(double,val_field_numeric,value,int)
+
+DEFFUNC_1(value,val_field_name,field)
+DEFFUNC_3(void,val_iter_fields,value,__hx_field_iter,void *)
+DEFFUNC_3(void,val_iter_field_vals,value,__hx_field_iter,void *)
+
+// Abstract types
+DEFFUNC_0(vkind,alloc_kind)
+DEFFUNC_2(void,kind_share,vkind *,const char *)
+
+// Garbage Collection
+DEFFUNC_1(void *,hx_alloc,int)
+DEFFUNC_2(void, val_gc,value,hxFinalizer)
+DEFFUNC_2(void, val_gc_ptr,void *,hxPtrFinalizer)
+DEFFUNC_0(value *, alloc_root)
+DEFFUNC_1(void, free_root,value *)
+DEFFUNC_2(void, gc_change_managed_memory,int,const char *)
+
+// Only available on cpp target...
+DEFFUNC_1(void, val_gc_add_root,value *)
+DEFFUNC_1(void, val_gc_remove_root,value *)
+// Only available on js target - use AutoGCRoot to assist
+DEFFUNC_1(gcroot, create_root,value)
+DEFFUNC_1(value, query_root,gcroot)
+DEFFUNC_1(void, destroy_root,gcroot)
+
+DEFFUNC_0(void, gc_enter_blocking)
+DEFFUNC_0(void, gc_exit_blocking)
+DEFFUNC_0(bool, gc_try_blocking)
+DEFFUNC_0(void, gc_safe_point)
+DEFFUNC_2(void, gc_set_top_of_stack,int *,bool)
+DEFFUNC_0(bool, gc_try_unblocking)
+
+// Used for finding functions in static libraries
+DEFFUNC_2(int, hx_register_prim, const char *, void*)
+
+
diff --git a/Sources/c_snikket/iinclude/hx/CFFIJsPrime.h b/Sources/c_snikket/iinclude/hx/CFFIJsPrime.h
new file mode 100644
index 0000000..cc72082
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/CFFIJsPrime.h
@@ -0,0 +1,202 @@
+
+extern "C"
+{
+
+typedef std::map<std::string,int> IdMap;
+static IdMap sIdMap;
+static std::vector<val> sIdKeys;
+
+int val_id(const char *inName)
+{
+ IdMap::iterator id = sIdMap.find(inName);
+ if (id==sIdMap.end())
+ {
+ int result = sIdMap.size();
+ sIdMap[inName] = result;
+ sIdKeys.push_back(value(inName));
+ return result;
+ }
+ return id->second;
+}
+
+
+double val_field_numeric(value inObject, int inFieldId)
+{
+ return inObject[sIdKeys[inFieldId]].as<double>();
+}
+
+int val_int(value inValue) { return inValue.as<int>(); }
+bool val_bool(value inValue) { return inValue.as<bool>(); }
+double val_number(value inValue) { return inValue.as<double>(); }
+double val_float(value inValue) { return inValue.as<double>(); }
+
+value alloc_null() { return emscripten::val::null(); }
+value alloc_int(int inValue) { return value(inValue); }
+value alloc_best_int(int inValue) { return value(inValue); }
+value alloc_int32(int inValue) { return value(inValue); }
+value alloc_bool(bool inValue) { return value(inValue); }
+value alloc_float(double inValue) { return value(inValue); }
+
+value val_field(value inObject, int inIndex) { return inObject[sIdKeys[inIndex]]; }
+void alloc_field(value inObject, int inIndex, value inValue) { inObject.set(sIdKeys[inIndex],inValue); }
+
+
+
+/*
+DEFFUNC_1(void,val_throw,value)
+DEFFUNC_0(void,hx_error)
+DEFFUNC_3(void,hx_fail,const char *,const char *,int)
+
+// Determine value type
+DEFFUNC_1(int,val_type,value)
+DEFFUNC_1(vkind,val_kind,value)
+DEFFUNC_2(void *,val_to_kind,value,vkind)
+// don't check the 'kind' ...
+DEFFUNC_1(void *,val_data,value)
+DEFFUNC_1(int,val_fun_nargs,value)
+
+
+
+// Create value type
+
+DEFFUNC_0(value,alloc_empty_object)
+DEFFUNC_2(value,alloc_abstract,vkind,void *)
+// Allocates conservative-collected memory
+DEFFUNC_3(value,create_abstract,vkind,int,hxFinalizer)
+DEFFUNC_1(void,free_abstract,value)
+
+// String access
+DEFFUNC_1(int,val_strlen,value)
+DEFFUNC_1(const wchar_t *,val_wstring,value)
+DEFFUNC_1(const char *,val_string,value)
+DEFFUNC_1(wchar_t *,val_dup_wstring,value)
+DEFFUNC_1(char *,val_dup_string,value)
+DEFFUNC_2(char *,alloc_string_data,const char *,int)
+DEFFUNC_2(value,alloc_string_len,const char *,int)
+DEFFUNC_2(value,alloc_wstring_len,const wchar_t *,int)
+
+// Array access - generic
+DEFFUNC_1(value,alloc_array,int)
+DEFFUNC_1(int,val_array_size,value)
+DEFFUNC_2(void,val_array_set_size,value,int)
+DEFFUNC_2(value,val_array_i,value,int)
+DEFFUNC_3(void,val_array_set_i,value,int,value)
+DEFFUNC_2(void,val_array_push,value,value)
+
+
+// Array access - fast if possible - may return null
+// Resizing the array may invalidate the pointer
+DEFFUNC_1(bool *,val_array_bool,value)
+DEFFUNC_1(int *,val_array_int,value)
+DEFFUNC_1(double *,val_array_double,value)
+DEFFUNC_1(float *,val_array_float,value)
+DEFFUNC_1(value *,val_array_value,value)
+
+// String Buffer
+// A 'buffer' is a tool for joining strings together.
+// The C++ implementation is haxe.io.BytesData
+// The neko implementation is something else again, and can't be passes as a value, only copied to a string
+
+// Create a buffer from string of an empty buffer of a given length
+DEFFUNC_1(buffer,alloc_buffer,const char *)
+DEFFUNC_1(buffer,alloc_buffer_len,int)
+
+// Append a string representation of a value to the buffer
+DEFFUNC_2(void,val_buffer,buffer,value)
+
+// Append a c-string to a buffer
+DEFFUNC_2(void,buffer_append,buffer,const char *)
+
+// Append given number of bytes of a c-string to the buffer
+DEFFUNC_3(void,buffer_append_sub,buffer,const char *,int)
+
+// Append given character to string
+DEFFUNC_2(void,buffer_append_char,buffer,int)
+
+// Convert buffer back into string value
+DEFFUNC_1(value,buffer_to_string,buffer)
+
+
+
+// These routines are for direct access to the c++ BytesData structure
+// Use getByteData and resizeByteData for more generic access to haxe.io.Bytes
+
+// This will never return true on a neko host.
+DEFFUNC_1(bool,val_is_buffer,value)
+
+// These functions are only valid if val_is_buffer returns true
+// Currently, cffiByteBuffer is the same struct as buffer, but the usage is quite different
+DEFFUNC_1(cffiByteBuffer,val_to_buffer,value)
+
+// Number of byes in the array
+DEFFUNC_1(int,buffer_size,cffiByteBuffer)
+
+// Pointer to the byte data - will become invalid if the array is resized
+DEFFUNC_1(char *,buffer_data,cffiByteBuffer)
+
+// Convert c++ ByteBuffer back to 'value' - no copy involved
+DEFFUNC_1(value,buffer_val,cffiByteBuffer)
+
+// Resize the array - will invalidate the data
+DEFFUNC_2(void,buffer_set_size,cffiByteBuffer,int)
+
+// This is used by resizeByteData for manipulating bytes directly on neko
+DEFFUNC_1(value,alloc_raw_string,int)
+
+// Call Function
+DEFFUNC_1(value,val_call0,value)
+DEFFUNC_2(value,val_call1,value,value)
+DEFFUNC_3(value,val_call2,value,value,value)
+DEFFUNC_4(value,val_call3,value,value,value,value)
+DEFFUNC_3(value,val_callN,value,value *,int)
+
+// Call the function - catch and print any exceptions
+DEFFUNC_1(value,val_call0_traceexcept,value)
+
+// Call object field
+DEFFUNC_2(value,val_ocall0,value,int)
+DEFFUNC_3(value,val_ocall1,value,int,value)
+DEFFUNC_4(value,val_ocall2,value,int,value,value)
+DEFFUNC_4(value,val_ocallN,value,int,value *,int)
+
+// Objects access
+DEFFUNC_1(int,val_id,const char *)
+DEFFUNC_3(void,alloc_field,value,int,value)
+DEFFUNC_2(value,val_field,value,int)
+DEFFUNC_2(double,val_field_numeric,value,int)
+
+DEFFUNC_1(value,val_field_name,field)
+DEFFUNC_3(void,val_iter_fields,value,__hx_field_iter,void *)
+DEFFUNC_3(void,val_iter_field_vals,value,__hx_field_iter,void *)
+
+// Abstract types
+DEFFUNC_0(vkind,alloc_kind)
+DEFFUNC_2(void,kind_share,vkind *,const char *)
+
+// Garbage Collection
+DEFFUNC_1(void *,hx_alloc,int)
+DEFFUNC_2(void, val_gc,value,hxFinalizer)
+DEFFUNC_2(void, val_gc_ptr,void *,hxPtrFinalizer)
+DEFFUNC_0(value *, alloc_root)
+DEFFUNC_1(void, free_root,value *)
+DEFFUNC_2(void, gc_change_managed_memory,int,const char *)
+
+// Only available on cpp target...
+DEFFUNC_1(void, val_gc_add_root,value *)
+DEFFUNC_1(void, val_gc_remove_root,value *)
+// Only available on js target - use AutoGCRoot to assist
+DEFFUNC_1(gcroot, create_root,value)
+DEFFUNC_1(value, query_root,gcroot)
+DEFFUNC_1(void, destroy_root,gcroot)
+
+DEFFUNC_0(void, gc_enter_blocking)
+DEFFUNC_0(void, gc_exit_blocking)
+DEFFUNC_0(void, gc_safe_point)
+DEFFUNC_2(void, gc_set_top_of_stack,int *,bool)
+
+// Used for finding functions in static libraries
+DEFFUNC_2(int, hx_register_prim, const char *, void*)
+*/
+
+
+}
diff --git a/Sources/c_snikket/iinclude/hx/CFFILoader.h b/Sources/c_snikket/iinclude/hx/CFFILoader.h
new file mode 100644
index 0000000..ed95f1f
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/CFFILoader.h
@@ -0,0 +1,330 @@
+#ifndef HX_CFFI_LOADER_H
+#define HX_CFFI_LOADER_H
+
+/*
+ This file will only be incuded in one cpp file in the ndll library -
+ the one with IMPLEMENT_API #defined.
+
+ The other files will refer to the val_ functions via the "extern" in CFFI.h
+
+ For dynamic linking, a macro (DEFFUNC) implements the "val_..." functions as function pointers,
+ and the cpp code calls these function pointers directly.
+ The pointers starts off as function pointers to bootstrap code, so when they are first called
+ the bootstrap uses the "ResolveProc" to find the correct version of the function for the particular
+ platform, and replaces the function pointer with this value. Subsequent calls then go directly
+ to the correct fucntion.
+
+ The ResolveProc can come from:
+ Explicitly setting - the proc is set when a dll is loaded into the hxcpp exe
+ Via 'GetProcAddress' on the exe - if symbols are needed and the proc has not been set
+ Internal implementation (CFFINekoLoader) - when linking agaist a neko process.
+ - Old code used to find this in NekoApi.dll, but the glue code is now built into each ndll directly.
+
+ For static linking, the functions are resolved at link time.
+
+ For HXCPP_JS_PRIME, these functions are implemented in CFFIJsPrime
+*/
+
+#ifdef ANDROID
+#include <android/log.h>
+#endif
+
+#ifdef NEKO_WINDOWS
+#include <windows.h>
+#include <stdio.h>
+// Stoopid windows ...
+#ifdef RegisterClass
+#undef RegisterClass
+#endif
+#ifdef abs
+#undef abs
+#endif
+
+#else // NOT NEKO_WINDOWS
+
+#ifdef NEKO_LINUX
+#define EXT "dso"
+#define NEKO_EXT "so"
+//#define __USE_GNU 1
+
+#elif defined(HX_MACOS)
+#include <mach-o/dyld.h>
+#define EXT "dylib"
+#define NEKO_EXT "dylib"
+
+#else
+#if defined(EMSCRIPTEN)
+#define EXT "ll"
+#else
+#define EXT "so"
+#endif
+
+#endif
+
+#include <dlfcn.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <memory.h>
+
+
+#endif
+#if defined(BLACKBERRY)
+using namespace std;
+#endif
+typedef void *(*ResolveProc)(const char *inName);
+static ResolveProc sResolveProc = 0;
+
+extern "C" {
+EXPORT void hx_set_loader(ResolveProc inProc)
+{
+ #ifdef ANDROID
+ __android_log_print(ANDROID_LOG_INFO, "haxe plugin", "Got Load Proc %p", inProc );
+ #endif
+ sResolveProc = inProc;
+}
+}
+
+
+
+#ifdef HXCPP_JS_PRIME // { js prime
+
+#define DEFFUNC(name,ret,def_args,call_args) \
+extern "C" ret name def_args;
+
+#include "CFFIJsPrime.h"
+
+#elif defined(STATIC_LINK) // js prime } { not js prime, static link
+
+#define DEFFUNC(name,ret,def_args,call_args) \
+extern "C" ret name def_args;
+
+#else // static link } { Dynamic link
+
+ #ifdef NEKO_COMPATIBLE
+
+ #include "CFFINekoLoader.h"
+
+ #endif // NEKO_COMPATIBLE
+
+
+ // This code will get run when the library is compiled against a newer version of hxcpp,
+ // and the application code uses an older version.
+ bool default_val_is_buffer(void *inBuffer)
+ {
+ typedef void *(ValToBufferFunc)(void *);
+ static ValToBufferFunc *valToBuffer = 0;
+ if (!valToBuffer)
+ valToBuffer = (ValToBufferFunc *)sResolveProc("val_to_buffer");
+
+ if (valToBuffer)
+ return valToBuffer(inBuffer)!=0;
+
+ return false;
+ }
+
+ // Neko, old cpp and js_prime are all utf8 based - and go through here
+ #ifdef HXCPP_PRIME
+ struct DynAlloc : public hx::IStringAlloc
+ {
+ #define WANT_DYNALLOC_ALLOC_BYTES
+ void *allocBytes(size_t n);
+ };
+
+
+ HxString default_string_wchar(const wchar_t *src,int len)
+ {
+ hx::strbuf buf;
+ const char *str = cffi::to_utf8(src,len,&buf);
+ return HxString(str,len);
+ }
+ HxString default_string_utf8(const char *str,int len)
+ {
+ return HxString(str,len);
+ }
+ HxString default_string_utf16(const char16_t *src,int len)
+ {
+ hx::strbuf buf;
+ const char *str = cffi::to_utf8(src,len,&buf);
+ return HxString(str,len);
+ }
+
+ const char *default_to_utf8(const HxString &str,hx::IStringAlloc *alloc)
+ {
+ return str.c_str();
+ }
+ const wchar_t *default_to_wchar(const HxString &str,hx::IStringAlloc *alloc)
+ {
+ DynAlloc d;
+ if (!alloc)
+ alloc = &d;
+ return cffi::from_utf8<wchar_t>(str.c_str(),str.size(),alloc);
+ }
+ const char16_t *default_to_utf16(const HxString &str,hx::IStringAlloc *alloc)
+ {
+ DynAlloc d;
+ if (!alloc)
+ alloc = &d;
+ return cffi::from_utf8<char16_t>(str.c_str(),str.size(),alloc);
+ }
+ #endif
+
+
+ hx::StringEncoding default_get_encoding(void *inPtr) { return hx::StringUtf8; }
+
+ void * default_alloc_empty_string(int) { return 0; }
+
+ // Do nothing on earlier versions of hxcpp that do not know what to do
+ void default_gc_change_managed_memory(int,const char *) { }
+
+ void *ResolveDefault(const char *inName)
+ {
+ void *result = sResolveProc(inName);
+ if (result)
+ return result;
+ if (!strcmp(inName,"val_is_buffer"))
+ return (void *)default_val_is_buffer;
+ if (!strcmp(inName,"alloc_empty_string"))
+ return (void *)default_alloc_empty_string;
+ if (!strcmp(inName,"gc_change_managed_memory"))
+ return (void *)default_gc_change_managed_memory;
+ if (!strcmp(inName,"hxs_encoding"))
+ return (void *)default_get_encoding;
+ #ifdef HXCPP_PRIME
+ if (!strcmp(inName,"alloc_hxs_wchar"))
+ return (void *)default_string_wchar;
+ if (!strcmp(inName,"alloc_hxs_utf16"))
+ return (void *)default_string_utf16;
+ if (!strcmp(inName,"alloc_hxs_utf8"))
+ return (void *)default_string_utf8;
+ if (!strcmp(inName,"hxs_utf8"))
+ return (void *)default_to_utf8;
+ if (!strcmp(inName,"hxs_utf16"))
+ return (void *)default_to_utf16;
+ if (!strcmp(inName,"hxs_wchar"))
+ return (void *)default_to_wchar;
+ #endif
+
+ return 0;
+ }
+
+ #ifdef NEKO_WINDOWS // {
+
+ void *LoadFunc(const char *inName)
+ {
+ #ifndef HX_WINRT
+ static const char *modules[] = { 0, "hxcpp", "hxcpp-debug" };
+ for(int i=0; i<3 && sResolveProc==0; i++)
+ {
+ HMODULE handle = GetModuleHandleA(modules[i]);
+ if (handle)
+ {
+ sResolveProc = (ResolveProc)GetProcAddress(handle,"hx_cffi");
+ if (sResolveProc==0)
+ FreeLibrary(handle);
+ }
+ }
+ #endif
+
+ #ifdef NEKO_COMPATIBLE
+ if (sResolveProc==0)
+ {
+ sResolveProc = InitDynamicNekoLoader();
+ }
+ #endif
+
+ if (sResolveProc==0)
+ {
+ fprintf(stderr,"Could not link plugin to process (hxCFFILoader.h %d)\n",__LINE__);
+ exit(1);
+ }
+ return ResolveDefault(inName);
+ }
+
+ #else // windows } { not windows
+
+
+ void *LoadFunc(const char *inName)
+ {
+ #ifndef ANDROID // {
+ if (sResolveProc==0)
+ {
+ sResolveProc = (ResolveProc)dlsym(RTLD_DEFAULT,"hx_cffi");
+ }
+
+ #ifdef NEKO_COMPATIBLE
+ if (sResolveProc==0)
+ {
+ sResolveProc = InitDynamicNekoLoader();
+ }
+ #endif
+ #endif // !Android }
+
+ if (sResolveProc==0)
+ {
+ #ifdef ANDROID
+ __android_log_print(ANDROID_LOG_ERROR, "CFFILoader.h", "Could not API %s", inName);
+ return 0;
+ #else
+ #ifdef NEKO_COMPATIBLE
+ fprintf(stderr,"Could not link plugin to process (CFFILoader.h %d) - with neko\n",__LINE__);
+ #else
+ fprintf(stderr,"Could not link plugin to process (CFFILoader.h %d)\n",__LINE__);
+ #endif
+ exit(1);
+ #endif
+ }
+ return ResolveDefault(inName);
+ }
+
+ #undef EXT
+
+ #endif // not windows }
+
+
+
+ #ifndef ANDROID // not android {
+
+ #define DEFFUNC(name,ret,def_args,call_args) \
+ typedef ret (*FUNC_##name)def_args; \
+ extern FUNC_##name name; \
+ ret IMPL_##name def_args \
+ { \
+ name = (FUNC_##name)LoadFunc(#name); \
+ if (!name) \
+ { \
+ fprintf(stderr,"Could not find function:" #name " \n"); \
+ exit(1); \
+ } \
+ return name call_args; \
+ }\
+ FUNC_##name name = IMPL_##name;
+
+ #ifdef NEKO_COMPATIBLE
+ DEFINE_PRIM(neko_init,5)
+ #endif
+
+ #else // not android } { android
+
+
+ #define DEFFUNC(name,ret,def_args,call_args) \
+ typedef ret (*FUNC_##name)def_args; \
+ extern FUNC_##name name; \
+ ret IMPL_##name def_args \
+ { \
+ name = (FUNC_##name)LoadFunc(#name); \
+ if (!name) \
+ { \
+ __android_log_print(ANDROID_LOG_ERROR,"CFFILoader", "Could not find function:" #name "\n"); \
+ } \
+ return name call_args; \
+ }\
+ FUNC_##name name = IMPL_##name;
+
+
+ #endif // android }
+
+#endif // dynamic link }
+
+#endif
+
+
diff --git a/Sources/c_snikket/iinclude/hx/CFFINekoLoader.h b/Sources/c_snikket/iinclude/hx/CFFINekoLoader.h
new file mode 100644
index 0000000..9fbb3b7
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/CFFINekoLoader.h
@@ -0,0 +1,723 @@
+#ifndef HX_CFFI_NEKO_LOADER_H
+#define HX_CFFI_NEKO_LOADER_H
+
+//-------- NEKO Interface -----------------------------------------------------
+namespace
+{
+
+#include <hx/NekoFunc.h>
+
+
+void *sNekoDllHandle = 0;
+
+void *LoadNekoFunc(const char *inName)
+{
+ #ifdef HX_WINRT
+ return 0;
+ #else
+ static bool tried = false;
+ if (tried && !sNekoDllHandle)
+ return 0;
+ tried = true;
+
+ if (!sNekoDllHandle)
+ {
+ #ifdef HX_WINDOWS
+ sNekoDllHandle = GetModuleHandleA("neko.dll");
+ #else
+ sNekoDllHandle = dlopen("libneko." NEKO_EXT, RTLD_NOW);
+ // The debian package creates libneko.so.0 without libneko.so...
+ // The fedora/openSUSE rpm packages create libneko.so.1...
+ if (!sNekoDllHandle)
+ sNekoDllHandle = dlopen("libneko." NEKO_EXT ".0", RTLD_NOW);
+ if (!sNekoDllHandle)
+ sNekoDllHandle = dlopen("libneko." NEKO_EXT ".1", RTLD_NOW);
+ if (!sNekoDllHandle)
+ sNekoDllHandle = dlopen("libneko." NEKO_EXT ".2", RTLD_NOW);
+ #endif
+
+ if (!sNekoDllHandle)
+ {
+ fprintf(stderr,"Could not link to neko.\n");
+ return 0;
+ }
+ }
+
+
+ #ifdef HX_WINDOWS
+ void *result = (void *)GetProcAddress((HMODULE)sNekoDllHandle,inName);
+ #else
+ void *result = dlsym(sNekoDllHandle,inName);
+ #endif
+
+ //printf(" %s = %p\n", inName, result );
+ return result;
+ #endif // !HX_WINRT
+}
+
+
+static int __a_id = 0;
+static int __s_id = 0;
+static int b_id = 0;
+static int length_id = 0;
+static int push_id = 0;
+
+neko_value *gNeko2HaxeString = 0;
+neko_value *gNekoNewArray = 0;
+neko_value gNekoNull = 0;
+neko_value gNekoTrue = 0;
+neko_value gNekoFalse = 0;
+
+
+namespace
+{
+void CheckInitDynamicNekoLoader()
+{
+ if (!gNekoNull)
+ {
+ printf("Haxe code is missing a call to cpp.Prime.nekoInit().\n");
+ }
+}
+}
+
+
+/*
+
+
+*/
+
+void *DynamicNekoLoader(const char *inName);
+
+typedef neko_value (*alloc_object_func)(neko_value);
+typedef neko_value (*alloc_string_func)(const char *);
+typedef neko_value (*alloc_abstract_func)(neko_vkind,void *);
+typedef neko_value (*val_call1_func)(neko_value,neko_value);
+typedef neko_value (*val_field_func)(neko_value,int);
+typedef neko_value (*alloc_float_func)(double);
+typedef void (*alloc_field_func)(neko_value,int,neko_value);
+typedef neko_value *(*alloc_root_func)(int);
+typedef char *(*alloc_private_func)(int);
+typedef neko_value (*copy_string_func)(const char *,int);
+typedef int (*val_id_func)(const char *);
+typedef neko_buffer (*alloc_buffer_func)(const char *);
+typedef neko_value (*val_buffer_func)(neko_buffer);
+typedef void (*buffer_append_sub_func)(neko_buffer,const char *,int);
+typedef void (*fail_func)(neko_value,const char *,int);
+typedef neko_value (*alloc_array_func)(unsigned int);
+typedef void (*val_gc_func)(neko_value,void *);
+typedef void (*val_ocall1_func)(neko_value,int,neko_value);
+typedef neko_value (*alloc_empty_string_func)(int);
+
+static alloc_object_func dyn_alloc_object = 0;
+static alloc_string_func dyn_alloc_string = 0;
+static alloc_abstract_func dyn_alloc_abstract = 0;
+static val_call1_func dyn_val_call1 = 0;
+static val_field_func dyn_val_field = 0;
+static alloc_field_func dyn_alloc_field = 0;
+static alloc_float_func dyn_alloc_float = 0;
+static alloc_root_func dyn_alloc_root = 0;
+static alloc_private_func dyn_alloc_private = 0;
+static alloc_private_func dyn_alloc = 0;
+static copy_string_func dyn_copy_string = 0;
+static val_id_func dyn_val_id = 0;
+static alloc_buffer_func dyn_alloc_buffer = 0;
+static val_buffer_func dyn_val_buffer = 0;
+static fail_func dyn_fail = 0;
+static buffer_append_sub_func dyn_buffer_append_sub = 0;
+static alloc_array_func dyn_alloc_array = 0;
+static val_gc_func dyn_val_gc = 0;
+static val_ocall1_func dyn_val_ocall1 = 0;
+static alloc_empty_string_func dyn_alloc_empty_string = 0;
+
+
+neko_value api_alloc_string(const char *inString)
+{
+ CheckInitDynamicNekoLoader();
+ neko_value neko_string = dyn_alloc_string(inString);
+ if (gNeko2HaxeString)
+ return dyn_val_call1(*gNeko2HaxeString,neko_string);
+ return neko_string;
+}
+
+
+char *api_alloc_string_data(const char *inString,int inLength)
+{
+ CheckInitDynamicNekoLoader();
+ char *result = (char *)dyn_alloc_private(inLength+1);
+ memcpy(result,inString,inLength);
+ result[inLength]='\0';
+ return result;
+}
+
+
+neko_value api_alloc_raw_string(int inLength)
+{
+ CheckInitDynamicNekoLoader();
+ return dyn_alloc_empty_string(inLength);
+}
+
+
+#define NEKO_NOT_IMPLEMENTED(func) dyn_fail(api_alloc_string("NOT Implemented:" func),__FILE__,__LINE__)
+
+void * api_empty() { return 0; }
+
+bool api_val_bool(neko_value arg1) { return arg1==gNekoTrue; }
+int api_val_int(neko_value arg1) { return neko_val_int(arg1); }
+double api_val_float(neko_value arg1) { return *(double *)( ((char *)arg1) + 4 ); }
+double api_val_number(neko_value arg1) { return neko_val_is_int(arg1) ? neko_val_int(arg1) : api_val_float(arg1); }
+
+
+neko_value api_alloc_bool(bool arg1) { CheckInitDynamicNekoLoader(); return arg1 ? gNekoTrue : gNekoFalse; }
+neko_value api_alloc_int(int arg1) { return neko_alloc_int(arg1); }
+neko_value api_alloc_empty_object()
+{
+ return dyn_alloc_object(gNekoNull);
+}
+
+neko_value api_buffer_to_string(neko_buffer arg1)
+{
+ neko_value neko_string = dyn_val_buffer(arg1);
+ if (gNeko2HaxeString)
+ return dyn_val_call1(*gNeko2HaxeString,neko_string);
+ return neko_string;
+}
+
+
+const char * api_val_string(neko_value arg1)
+{
+ if (neko_val_is_string(arg1))
+ return neko_val_string(arg1);
+
+ if (neko_val_is_object(arg1))
+ {
+ neko_value s = dyn_val_field(arg1,__s_id);
+ if (neko_val_is_string(s))
+ return neko_val_string(s);
+ }
+
+ return 0;
+}
+
+void api_alloc_field_numeric(neko_value arg1,int arg2, double arg3)
+{
+ dyn_alloc_field(arg1, arg2, dyn_alloc_float(arg3) );
+}
+
+double api_val_field_numeric(neko_value arg1,int arg2)
+{
+ neko_value field = dyn_val_field(arg1, arg2);
+ if (neko_val_is_number(field))
+ return api_val_number(field);
+ if (field==gNekoTrue)
+ return 1;
+ return 0;
+}
+
+
+
+
+int api_val_strlen(neko_value arg1)
+{
+ if (neko_val_is_string(arg1))
+ return neko_val_strlen(arg1);
+
+ if (neko_val_is_object(arg1))
+ {
+ neko_value l = dyn_val_field(arg1,length_id);
+ if (neko_val_is_int(l))
+ return api_val_int(l);
+ }
+ return 0;
+}
+void api_buffer_set_size(neko_buffer inBuffer,int inLen) {
+ NEKO_NOT_IMPLEMENTED("api_buffer_set_size");
+}
+
+
+void api_buffer_append_char(neko_buffer inBuffer,int inChar)
+{
+ NEKO_NOT_IMPLEMENTED("api_buffer_append_char");
+}
+
+
+
+// Byte arrays - use strings
+neko_buffer api_val_to_buffer(neko_value arg1)
+{
+ return (neko_buffer)api_val_string(arg1);
+}
+bool api_val_is_buffer(neko_value arg1) { return neko_val_is_string(arg1); }
+int api_buffer_size(neko_buffer inBuffer) { return neko_val_strlen((neko_value)inBuffer); }
+char * api_buffer_data(neko_buffer inBuffer) { return (char *)api_val_string((neko_value)inBuffer); }
+
+char * api_val_dup_string(neko_value inVal)
+{
+ int len = api_val_strlen(inVal);
+ const char *ptr = api_val_string(inVal);
+ char *result = dyn_alloc_private(len+1);
+ memcpy(result,ptr,len);
+ result[len] = '\0';
+ return result;
+}
+
+neko_value api_alloc_string_len(const char *inStr,int inLen)
+{
+ if (gNeko2HaxeString)
+ {
+ if (!inStr)
+ return dyn_val_call1(*gNeko2HaxeString,api_alloc_raw_string(inLen));
+ return dyn_val_call1(*gNeko2HaxeString,dyn_copy_string(inStr,inLen));
+ }
+ if (!inStr)
+ inStr = dyn_alloc_private(inLen);
+ return dyn_copy_string(inStr,inLen);
+}
+
+neko_buffer api_alloc_buffer_len(int inLen)
+{
+ neko_value str=api_alloc_string_len(0,inLen+1);
+ char *s=(char *)api_val_string(str);
+ memset(s,0,inLen+1);
+ return (neko_buffer)str;
+}
+
+
+
+neko_value api_alloc_wstring_len(const wchar_t *inStr,int inLen)
+{
+ int len = 0;
+ const wchar_t *chars = inStr;
+ for(int i=0;i<inLen;i++)
+ {
+ int c = chars[i];
+ if( c <= 0x7F ) len++;
+ else if( c <= 0x7FF ) len+=2;
+ else if( c <= 0xFFFF ) len+=3;
+ else len+= 4;
+ }
+
+ char *result = dyn_alloc_private(len);//+1?
+ unsigned char *data = (unsigned char *) &result[0];
+ for(int i=0;i<inLen;i++)
+ {
+ int c = chars[i];
+ if( c <= 0x7F )
+ *data++ = c;
+ else if( c <= 0x7FF )
+ {
+ *data++ = 0xC0 | (c >> 6);
+ *data++ = 0x80 | (c & 63);
+ }
+ else if( c <= 0xFFFF )
+ {
+ *data++ = 0xE0 | (c >> 12);
+ *data++ = 0x80 | ((c >> 6) & 63);
+ *data++ = 0x80 | (c & 63);
+ }
+ else
+ {
+ *data++ = 0xF0 | (c >> 18);
+ *data++ = 0x80 | ((c >> 12) & 63);
+ *data++ = 0x80 | ((c >> 6) & 63);
+ *data++ = 0x80 | (c & 63);
+ }
+ }
+ //result[len] = 0;
+
+ return api_alloc_string_len(result,len);
+}
+
+
+
+const wchar_t *api_val_wstring(neko_value arg1)
+{
+ int len = api_val_strlen(arg1);
+
+ unsigned char *b = (unsigned char *)api_val_string(arg1);
+ wchar_t *result = (wchar_t *)dyn_alloc_private((len+1)*sizeof(wchar_t));
+ int l = 0;
+
+ for(int i=0;i<len;)
+ {
+ int c = b[i++];
+ if (c==0) break;
+ else if( c < 0x80 )
+ {
+ result[l++] = c;
+ }
+ else if( c < 0xE0 )
+ result[l++] = ( ((c & 0x3F) << 6) | (b[i++] & 0x7F) );
+ else if( c < 0xF0 )
+ {
+ int c2 = b[i++];
+ result[l++] = ( ((c & 0x1F) << 12) | ((c2 & 0x7F) << 6) | ( b[i++] & 0x7F) );
+ }
+ else
+ {
+ int c2 = b[i++];
+ int c3 = b[i++];
+ result[l++] = ( ((c & 0x0F) << 18) | ((c2 & 0x7F) << 12) | ((c3 << 6) & 0x7F) | (b[i++] & 0x7F) );
+ }
+ }
+ result[l] = '\0';
+
+ return result;
+}
+
+
+wchar_t * api_val_dup_wstring(neko_value inVal)
+{
+ return (wchar_t *)api_val_wstring(inVal);
+}
+
+
+
+int api_val_type(neko_value arg1)
+{
+ int t=neko_val_type(arg1);
+
+ if (t==VAL_OBJECT)
+ {
+ neko_value __a = dyn_val_field(arg1,__a_id);
+ if (neko_val_is_array(__a))
+ return valtArray;
+ neko_value __s = dyn_val_field(arg1,__s_id);
+ if (neko_val_is_string(__s))
+ return valtString;
+ }
+ if (t<7)
+ return (hxValueType)t;
+ if (t==VAL_ABSTRACT)
+ return valtAbstractBase;
+
+ if (t==VAL_PRIMITIVE || t==VAL_JITFUN)
+ return valtFunction;
+ if (t==VAL_32_BITS || t==VAL_INT)
+ return valtInt;
+ return valtNull;
+}
+
+neko_value *api_alloc_root()
+{
+ return dyn_alloc_root(1);
+}
+
+
+void * api_val_to_kind(neko_value arg1,neko_vkind arg2)
+{
+ neko_vkind k = (neko_vkind)neko_val_kind(arg1);
+ if (k!=arg2)
+ return 0;
+ return neko_val_data(arg1);
+}
+
+
+int api_alloc_kind()
+{
+ static int id = 1;
+ int result = id;
+ id += 4;
+ return result;
+}
+neko_value api_alloc_null()
+{
+ CheckInitDynamicNekoLoader();
+ return gNekoNull;
+}
+
+neko_value api_create_abstract(neko_vkind inKind,int inSize,void *inFinalizer)
+{
+ void *data = dyn_alloc(inSize);
+ neko_value val = dyn_alloc_abstract(inKind, data);
+ dyn_val_gc(val, inFinalizer);
+ return val;
+}
+
+void api_free_abstract(neko_value inAbstract)
+{
+ if (neko_val_is_abstract(inAbstract))
+ {
+ dyn_val_gc(inAbstract,0);
+ neko_val_kind(inAbstract) = 0;
+ }
+}
+
+
+neko_value api_buffer_val(neko_buffer arg1)
+{
+ if (neko_val_is_string(arg1))
+ return (neko_value)arg1;
+
+ if (neko_val_is_object(arg1))
+ {
+ neko_value s = dyn_val_field((neko_value)arg1,__s_id);
+ if (neko_val_is_string(s))
+ return (neko_value)(s);
+ }
+
+
+ return api_alloc_null();
+}
+
+
+void api_hx_error()
+{
+ dyn_fail(dyn_alloc_string("An unknown error has occurred."),"",1);
+}
+
+void * api_val_data(neko_value arg1) { return neko_val_data(arg1); }
+
+// Array access - generic
+int api_val_array_size(neko_value arg1)
+{
+ if (neko_val_is_array(arg1))
+ return neko_val_array_size(arg1);
+ neko_value l = dyn_val_field(arg1,length_id);
+ return neko_val_int(l);
+}
+
+
+neko_value api_val_array_i(neko_value arg1,int arg2)
+{
+ if (neko_val_is_array(arg1))
+ return neko_val_array_ptr(arg1)[arg2];
+ return neko_val_array_ptr(dyn_val_field(arg1,__a_id))[arg2];
+}
+
+void api_val_array_set_i(neko_value arg1,int arg2,neko_value inVal)
+{
+ if (!neko_val_is_array(arg1))
+ arg1 = dyn_val_field(arg1,__a_id);
+ neko_val_array_ptr(arg1)[arg2] = inVal;
+}
+
+void api_val_array_set_size(neko_value arg1,int inLen)
+{
+ NEKO_NOT_IMPLEMENTED("api_val_array_set_size");
+}
+
+void api_val_array_push(neko_value inArray,neko_value inValue)
+{
+ dyn_val_ocall1(inArray,push_id,inValue);
+}
+
+
+neko_value api_alloc_array(int arg1)
+{
+ if (!gNekoNewArray)
+ return dyn_alloc_array(arg1);
+ return dyn_val_call1(*gNekoNewArray,neko_alloc_int(arg1));
+}
+
+
+neko_value * api_val_array_value(neko_value arg1)
+{
+ if (neko_val_is_array(arg1))
+ return neko_val_array_ptr(arg1);
+ return neko_val_array_ptr(dyn_val_field(arg1,__a_id));
+}
+
+neko_value api_val_call0_traceexcept(neko_value arg1)
+{
+ NEKO_NOT_IMPLEMENTED("api_val_call0_traceexcept");
+ return gNekoNull;
+}
+
+
+int api_val_fun_nargs(neko_value arg1)
+{
+ if (!arg1 || !neko_val_is_function(arg1) )
+ return faNotFunction;
+ return neko_val_fun_nargs(arg1);
+}
+
+
+
+void api_val_gc(neko_value obj, void *finalizer)
+{
+ // Let neko deal with ints or abstracts ...
+ if (neko_val_is_int(obj) || neko_val_is_abstract(obj))
+ {
+ dyn_val_gc(obj,finalizer);
+ }
+ else
+ {
+ // Hack type to abstract for the duration
+ neko_val_type old_tag = neko_val_tag(obj);
+ neko_val_tag(obj) = VAL_ABSTRACT;
+ dyn_val_gc(obj,finalizer);
+ neko_val_tag(obj) = old_tag;
+ }
+}
+
+void api_gc_change_managed_memory(int,const char *)
+{
+ // Nothing to do here
+}
+
+bool api_gc_try_blocking() { return false; }
+bool api_gc_try_unblocking() { return false; }
+
+#define IMPLEMENT_HERE(x) if (!strcmp(inName,#x)) return (void *)api_##x;
+#define IGNORE_API(x) if (!strcmp(inName,#x)) return (void *)api_empty;
+
+
+void *DynamicNekoLoader(const char *inName)
+{
+ IMPLEMENT_HERE(alloc_kind)
+ IMPLEMENT_HERE(alloc_null)
+ IMPLEMENT_HERE(val_to_kind)
+ if (!strcmp(inName,"hx_fail"))
+ return LoadNekoFunc("_neko_failure");
+ IMPLEMENT_HERE(val_type)
+ IMPLEMENT_HERE(val_bool)
+ IMPLEMENT_HERE(val_int)
+ IMPLEMENT_HERE(val_float)
+ IMPLEMENT_HERE(val_number)
+ IMPLEMENT_HERE(val_field_numeric)
+ IMPLEMENT_HERE(alloc_bool)
+ IMPLEMENT_HERE(alloc_int)
+ IMPLEMENT_HERE(alloc_empty_object)
+ IMPLEMENT_HERE(alloc_root)
+ IMPLEMENT_HERE(val_gc)
+ IMPLEMENT_HERE(gc_try_blocking)
+ IMPLEMENT_HERE(gc_try_unblocking)
+
+ IMPLEMENT_HERE(create_abstract)
+ IMPLEMENT_HERE(free_abstract)
+
+ IGNORE_API(gc_enter_blocking)
+ IGNORE_API(gc_exit_blocking)
+ IGNORE_API(gc_safe_point)
+ IGNORE_API(gc_add_root)
+ IGNORE_API(gc_remove_root)
+ IGNORE_API(gc_set_top_of_stack)
+ IGNORE_API(gc_change_managed_memory)
+ IGNORE_API(create_root)
+ IGNORE_API(query_root)
+ IGNORE_API(destroy_root)
+ IGNORE_API(hx_register_prim)
+ IGNORE_API(val_array_int)
+ IGNORE_API(val_array_double)
+ IGNORE_API(val_array_float)
+ IGNORE_API(val_array_bool)
+
+ if (!strcmp(inName,"hx_alloc"))
+ return LoadNekoFunc("neko_alloc");
+
+ IMPLEMENT_HERE(buffer_to_string)
+ IMPLEMENT_HERE(buffer_val)
+
+ if (!strcmp(inName,"val_iter_field_vals"))
+ return LoadNekoFunc("neko_val_iter_fields");
+
+ IMPLEMENT_HERE(val_strlen)
+ IMPLEMENT_HERE(val_wstring)
+ IMPLEMENT_HERE(val_string)
+ IMPLEMENT_HERE(alloc_string)
+ IMPLEMENT_HERE(alloc_raw_string)
+ IMPLEMENT_HERE(alloc_string_data)
+ IMPLEMENT_HERE(val_dup_wstring)
+ IMPLEMENT_HERE(val_dup_string)
+ IMPLEMENT_HERE(alloc_string_len)
+ IMPLEMENT_HERE(alloc_wstring_len)
+
+ IMPLEMENT_HERE(val_is_buffer)
+ IMPLEMENT_HERE(val_to_buffer)
+ IMPLEMENT_HERE(alloc_buffer_len)
+ IMPLEMENT_HERE(buffer_size)
+ IMPLEMENT_HERE(buffer_set_size)
+ IMPLEMENT_HERE(buffer_append_char)
+ IMPLEMENT_HERE(buffer_data)
+
+ IMPLEMENT_HERE(hx_error)
+ IMPLEMENT_HERE(val_array_i)
+ IMPLEMENT_HERE(val_array_size)
+ IMPLEMENT_HERE(val_data)
+ IMPLEMENT_HERE(val_array_set_i)
+ IMPLEMENT_HERE(val_array_set_size)
+ IMPLEMENT_HERE(val_array_push)
+ IMPLEMENT_HERE(alloc_array)
+ IMPLEMENT_HERE(alloc_field_numeric)
+ IMPLEMENT_HERE(val_array_value)
+
+ IMPLEMENT_HERE(val_fun_nargs)
+
+ IMPLEMENT_HERE(val_call0_traceexcept)
+
+
+ char buffer[100];
+ strcpy(buffer,"neko_");
+ strcat(buffer,inName);
+ void *result = LoadNekoFunc(buffer);
+ if (result)
+ return result;
+
+ return 0;
+}
+
+
+ResolveProc InitDynamicNekoLoader()
+{
+ static bool init = false;
+ if (!init)
+ {
+ dyn_alloc_private = (alloc_private_func)LoadNekoFunc("neko_alloc_private");
+ dyn_alloc = (alloc_private_func)LoadNekoFunc("neko_alloc");
+ dyn_alloc_object = (alloc_object_func)LoadNekoFunc("neko_alloc_object");
+ dyn_alloc_string = (alloc_string_func)LoadNekoFunc("neko_alloc_string");
+ dyn_alloc_abstract = (alloc_abstract_func)LoadNekoFunc("neko_alloc_abstract");
+ dyn_val_call1 = (val_call1_func)LoadNekoFunc("neko_val_call1");
+ dyn_val_field = (val_field_func)LoadNekoFunc("neko_val_field");
+ dyn_alloc_field = (alloc_field_func)LoadNekoFunc("neko_alloc_field");
+ dyn_alloc_float = (alloc_float_func)LoadNekoFunc("neko_alloc_float");
+ dyn_alloc_root = (alloc_root_func)LoadNekoFunc("neko_alloc_root");
+ dyn_copy_string = (copy_string_func)LoadNekoFunc("neko_copy_string");
+ dyn_val_id = (val_id_func)LoadNekoFunc("neko_val_id");
+ dyn_alloc_buffer = (alloc_buffer_func)LoadNekoFunc("neko_alloc_buffer");
+ dyn_val_buffer = (val_buffer_func)LoadNekoFunc("neko_buffer_to_string");
+ dyn_fail = (fail_func)LoadNekoFunc("_neko_failure");
+ dyn_buffer_append_sub = (buffer_append_sub_func)LoadNekoFunc("neko_buffer_append_sub");
+ dyn_alloc_array = (alloc_array_func)LoadNekoFunc("neko_alloc_array");
+ dyn_val_gc = (val_gc_func)LoadNekoFunc("neko_val_gc");
+ dyn_val_ocall1 = (val_ocall1_func)LoadNekoFunc("neko_val_ocall1");
+ dyn_alloc_empty_string = (alloc_empty_string_func)LoadNekoFunc("neko_alloc_empty_string");
+ init = true;
+ }
+
+ if (!dyn_val_id)
+ return 0;
+
+
+ __a_id = dyn_val_id("__a");
+ __s_id = dyn_val_id("__s");
+ b_id = dyn_val_id("b");
+ length_id = dyn_val_id("length");
+ push_id = dyn_val_id("push");
+
+ return DynamicNekoLoader;
+}
+
+
+neko_value neko_init(neko_value inNewString,neko_value inNewArray,neko_value inNull, neko_value inTrue, neko_value inFalse)
+{
+ InitDynamicNekoLoader();
+
+ gNekoNull = inNull;
+ gNekoTrue = inTrue;
+ gNekoFalse = inFalse;
+
+ gNeko2HaxeString = dyn_alloc_root(1);
+ *gNeko2HaxeString = inNewString;
+ gNekoNewArray = dyn_alloc_root(1);
+ *gNekoNewArray = inNewArray;
+
+ return gNekoNull;
+}
+
+
+
+} // end anon namespace
+
+#endif
+
diff --git a/Sources/c_snikket/iinclude/hx/CFFIPrime.h b/Sources/c_snikket/iinclude/hx/CFFIPrime.h
new file mode 100644
index 0000000..88481f8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/CFFIPrime.h
@@ -0,0 +1,1101 @@
+#ifndef HX_CFFIPRIME_INCLUDED
+#define HX_CFFIPRIME_INCLUDED
+
+#include <hx/StringAlloc.h>
+
+
+#define HXCPP_PRIME
+
+
+namespace cffi
+{
+template<typename T>
+inline const char *to_utf8(const T *inStr,int &ioLen,hx::IStringAlloc *inAlloc)
+{
+ int len = 0;
+ int n = ioLen;
+ if (n==0)
+ while(inStr[n])
+ n++;
+ for(int i=0;i<n;i++)
+ {
+ int c = inStr[i];
+ if ( sizeof(T)==2 && c>=0xd800)
+ {
+ i++;
+ int peek = i<n ? inStr[i] : 0xdc00;
+ if (peek<0xdc00)
+ peek = 0xdc00;
+ c = 0x10000 | ((c-0xd800) << 10) | (peek-0xdc00);
+ }
+
+ if( c <= 0x7F ) len++;
+ else if( c <= 0x7FF ) len+=2;
+ else if( c <= 0xFFFF ) len+=3;
+ else len+= 4;
+ }
+
+ char *result = (char *)inAlloc->allocBytes(len+1);
+ unsigned char *data = (unsigned char *)result;
+ for(int i=0;i<n;i++)
+ {
+ int c = inStr[i];
+ if ( sizeof(T)==2 && c>=0xd800)
+ {
+ int peek = i+1<n ? 0xdc00 : inStr[i+1];
+ if (peek<0xdc00)
+ peek = 0xdc00;
+ c = 0x10000 | ((c-0xd800) << 10) | (peek-0xdc00);
+ i++;
+ }
+
+ if( c <= 0x7F )
+ *data++ = c;
+ else if( c <= 0x7FF )
+ {
+ *data++ = 0xC0 | (c >> 6);
+ *data++ = 0x80 | (c & 63);
+ }
+ else if( c <= 0xFFFF )
+ {
+ *data++ = 0xE0 | (c >> 12);
+ *data++ = 0x80 | ((c >> 6) & 63);
+ *data++ = 0x80 | (c & 63);
+ }
+ else
+ {
+ *data++ = 0xF0 | (c >> 18);
+ *data++ = 0x80 | ((c >> 12) & 63);
+ *data++ = 0x80 | ((c >> 6) & 63);
+ *data++ = 0x80 | (c & 63);
+ }
+ }
+ result[len] = 0;
+ ioLen = len;
+ return result;
+}
+
+static inline int decode_advance_utf8(const unsigned char * &ioPtr,const unsigned char *end)
+{
+ int c = *ioPtr++;
+ if( c < 0x80 )
+ {
+ return c;
+ }
+ else if( c < 0xE0 )
+ {
+ return ((c & 0x3F) << 6) | (ioPtr < end ? (*ioPtr++) & 0x7F : 0);
+ }
+ else if( c < 0xF0 )
+ {
+ int c2 = ioPtr<end ? *ioPtr++ : 0;
+ return ((c & 0x1F) << 12) | ((c2 & 0x7F) << 6) | ( ioPtr<end ? (*ioPtr++) & 0x7F : 0 );
+ }
+
+ int c2 = ioPtr<end ? *ioPtr++ : 0;
+ int c3 = ioPtr<end ? *ioPtr++ : 0;
+ return ((c & 0x0F) << 18) | ((c2 & 0x7F) << 12) | ((c3 & 0x7F) << 6) | ( ioPtr<end ? (*ioPtr++) & 0x7F : 0);
+}
+
+template<typename T>
+inline const T *from_utf8(const char *inStr,int len,hx::IStringAlloc *inAlloc)
+{
+ int n = len;
+ if (n<0)
+ while(inStr[n])
+ n++;
+
+ const unsigned char *str = (const unsigned char *)inStr;
+ const unsigned char *end = str + n;
+ int count = 0;
+ while(str<end)
+ {
+ int ch = decode_advance_utf8(str,end);
+ count++;
+ if (sizeof(T)==2 && ch>=0x10000)
+ count++;
+ }
+ T *result = (T*)inAlloc->allocBytes( sizeof(T)*(count+1) );
+ T *dest = result;
+ str = (const unsigned char *)inStr;
+ while(str<end)
+ {
+ int ch = decode_advance_utf8(str,end);
+ if (sizeof(T)==2 && ch>=0x10000)
+ {
+ int over = (ch-0x10000);
+ *dest++ = (over>>10) + 0xd800;
+ *dest++ = (over&0x3ff) + 0xdc00;
+ }
+ else
+ *dest++ = ch;
+ }
+ *dest++ = 0;
+
+ return result;
+}
+
+}
+
+#ifdef HXCPP_JS_PRIME
+#include <string>
+typedef std::string HxString;
+
+#else
+
+#ifdef _MSC_VER
+#pragma warning( disable : 4190 )
+#endif
+
+struct HxString
+{
+ inline HxString(const HxString &inRHS)
+ {
+ length = inRHS.length;
+ __s = inRHS.__s;
+ }
+ inline HxString() : length(0), __s(0) { }
+ inline HxString(const char *inS,int inLen=-1, bool inAllocGcString=true);
+ inline int size() const { return length; }
+ inline const char *c_str() const { return __s; }
+
+
+ int length;
+ const char *__s;
+};
+
+#include "CFFI.h"
+#endif
+
+#ifndef HXCPP_JS_PRIME
+HxString::HxString(const char *inS,int inLen, bool inAllocGcString) : length(inLen), __s(inS)
+{
+ if (!inS)
+ length = 0;
+ else
+ {
+ if (length<0)
+ for(length=0; __s[length]; length++)
+ {
+ }
+ if (inAllocGcString)
+ __s = alloc_string_data(__s, length);
+ }
+}
+#endif
+
+
+
+namespace cffi
+{
+
+inline value alloc_pointer(void *inPtr) { return alloc_abstract((vkind)(0x100 + 2),inPtr); }
+
+
+template<typename T> struct SigType { enum { Char='?' }; };
+template<> struct SigType<bool> { enum { Char='b' }; };
+template<> struct SigType<int> { enum { Char='i' }; };
+template<> struct SigType<float> { enum { Char='f' }; };
+template<> struct SigType<double> { enum { Char='d' }; };
+template<> struct SigType<value> { enum { Char='o' }; };
+template<> struct SigType<void> { enum { Char='v' }; };
+template<> struct SigType<const char *> { enum { Char='c' }; };
+template<> struct SigType<HxString> { enum { Char='s' }; };
+
+template<typename RET>
+bool CheckSig0( RET (func)(), const char *inSig)
+{
+ return SigType<RET>::Char==inSig[0] &&
+ 0 == inSig[1];
+}
+
+
+template<typename RET, typename A0>
+bool CheckSig1( RET (func)(A0), const char *inSig)
+{
+ return SigType<A0>::Char==inSig[0] &&
+ SigType<RET>::Char==inSig[1] &&
+ 0 == inSig[2];
+}
+
+
+template<typename RET, typename A0, typename A1>
+bool CheckSig2( RET (func)(A0,A1), const char *inSig)
+{
+ return SigType<A0>::Char==inSig[0] &&
+ SigType<A1>::Char==inSig[1] &&
+ SigType<RET>::Char==inSig[2] &&
+ 0 == inSig[3];
+}
+
+
+template<typename RET, typename A0, typename A1, typename A2>
+bool CheckSig3( RET (func)(A0,A1,A2), const char *inSig)
+{
+ return SigType<A0>::Char==inSig[0] &&
+ SigType<A1>::Char==inSig[1] &&
+ SigType<A2>::Char==inSig[2] &&
+ SigType<RET>::Char==inSig[3] &&
+ 0 == inSig[4];
+}
+
+
+template<typename RET, typename A0, typename A1, typename A2, typename A3>
+bool CheckSig4( RET (func)(A0,A1,A2,A3), const char *inSig)
+{
+ return SigType<A0>::Char==inSig[0] &&
+ SigType<A1>::Char==inSig[1] &&
+ SigType<A2>::Char==inSig[2] &&
+ SigType<A3>::Char==inSig[3] &&
+ SigType<RET>::Char==inSig[4] &&
+ 0 == inSig[5];
+}
+
+
+template<typename RET, typename A0, typename A1, typename A2, typename A3, typename A4>
+bool CheckSig5( RET (func)(A0,A1,A2,A3,A4), const char *inSig)
+{
+ return SigType<A0>::Char==inSig[0] &&
+ SigType<A1>::Char==inSig[1] &&
+ SigType<A2>::Char==inSig[2] &&
+ SigType<A3>::Char==inSig[3] &&
+ SigType<A4>::Char==inSig[4] &&
+ SigType<RET>::Char==inSig[5] &&
+ 0 == inSig[6];
+}
+
+template<typename RET, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5>
+bool CheckSig6( RET (func)(A0,A1,A2,A3,A4,A5), const char *inSig)
+{
+ return SigType<A0>::Char==inSig[0] &&
+ SigType<A1>::Char==inSig[1] &&
+ SigType<A2>::Char==inSig[2] &&
+ SigType<A3>::Char==inSig[3] &&
+ SigType<A4>::Char==inSig[4] &&
+ SigType<A5>::Char==inSig[5] &&
+ SigType<RET>::Char==inSig[6] &&
+ 0 == inSig[7];
+}
+
+
+template<typename RET, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
+bool CheckSig7( RET (func)(A0,A1,A2,A3,A4,A5,A6), const char *inSig)
+{
+ return SigType<A0>::Char==inSig[0] &&
+ SigType<A1>::Char==inSig[1] &&
+ SigType<A2>::Char==inSig[2] &&
+ SigType<A3>::Char==inSig[3] &&
+ SigType<A4>::Char==inSig[4] &&
+ SigType<A5>::Char==inSig[5] &&
+ SigType<A6>::Char==inSig[6] &&
+ SigType<RET>::Char==inSig[7] &&
+ 0 == inSig[8];
+}
+
+template<typename RET, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7>
+bool CheckSig8( RET (func)(A0,A1,A2,A3,A4,A5,A6,A7), const char *inSig)
+{
+ return SigType<A0>::Char==inSig[0] &&
+ SigType<A1>::Char==inSig[1] &&
+ SigType<A2>::Char==inSig[2] &&
+ SigType<A3>::Char==inSig[3] &&
+ SigType<A4>::Char==inSig[4] &&
+ SigType<A5>::Char==inSig[5] &&
+ SigType<A6>::Char==inSig[6] &&
+ SigType<A7>::Char==inSig[7] &&
+ SigType<RET>::Char==inSig[8] &&
+ 0 == inSig[9];
+}
+
+
+template<typename RET, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8>
+bool CheckSig9( RET (func)(A0,A1,A2,A3,A4,A5,A6,A7,A8), const char *inSig)
+{
+ return SigType<A0>::Char==inSig[0] &&
+ SigType<A1>::Char==inSig[1] &&
+ SigType<A2>::Char==inSig[2] &&
+ SigType<A3>::Char==inSig[3] &&
+ SigType<A4>::Char==inSig[4] &&
+ SigType<A5>::Char==inSig[5] &&
+ SigType<A6>::Char==inSig[6] &&
+ SigType<A7>::Char==inSig[7] &&
+ SigType<A8>::Char==inSig[8] &&
+ SigType<RET>::Char==inSig[9] &&
+ 0 == inSig[10];
+}
+
+template<typename RET, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9>
+bool CheckSig10( RET (func)(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9), const char *inSig)
+{
+ return SigType<A0>::Char==inSig[0] &&
+ SigType<A1>::Char==inSig[1] &&
+ SigType<A2>::Char==inSig[2] &&
+ SigType<A3>::Char==inSig[3] &&
+ SigType<A4>::Char==inSig[4] &&
+ SigType<A5>::Char==inSig[5] &&
+ SigType<A6>::Char==inSig[6] &&
+ SigType<A7>::Char==inSig[7] &&
+ SigType<A8>::Char==inSig[8] &&
+ SigType<A9>::Char==inSig[9] &&
+ SigType<RET>::Char==inSig[10] &&
+ 0 == inSig[11];
+}
+
+template<typename RET, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10>
+bool CheckSig11( RET (func)(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9, A10), const char *inSig)
+{
+ return SigType<A0>::Char==inSig[0] &&
+ SigType<A1>::Char==inSig[1] &&
+ SigType<A2>::Char==inSig[2] &&
+ SigType<A3>::Char==inSig[3] &&
+ SigType<A4>::Char==inSig[4] &&
+ SigType<A5>::Char==inSig[5] &&
+ SigType<A6>::Char==inSig[6] &&
+ SigType<A7>::Char==inSig[7] &&
+ SigType<A8>::Char==inSig[8] &&
+ SigType<A9>::Char==inSig[9] &&
+ SigType<A10>::Char==inSig[10] &&
+ SigType<RET>::Char==inSig[11] &&
+ 0 == inSig[12];
+}
+
+
+template<typename RET, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11>
+bool CheckSig12( RET (func)(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9, A10, A11), const char *inSig)
+{
+ return SigType<A0>::Char==inSig[0] &&
+ SigType<A1>::Char==inSig[1] &&
+ SigType<A2>::Char==inSig[2] &&
+ SigType<A3>::Char==inSig[3] &&
+ SigType<A4>::Char==inSig[4] &&
+ SigType<A5>::Char==inSig[5] &&
+ SigType<A6>::Char==inSig[6] &&
+ SigType<A7>::Char==inSig[7] &&
+ SigType<A8>::Char==inSig[8] &&
+ SigType<A9>::Char==inSig[9] &&
+ SigType<A10>::Char==inSig[10] &&
+ SigType<A11>::Char==inSig[11] &&
+ SigType<RET>::Char==inSig[12] &&
+ 0 == inSig[13];
+}
+
+template<typename RET, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11, typename A12>
+bool CheckSig13( RET (func)(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12), const char *inSig)
+{
+ return SigType<A0>::Char==inSig[0] &&
+ SigType<A1>::Char==inSig[1] &&
+ SigType<A2>::Char==inSig[2] &&
+ SigType<A3>::Char==inSig[3] &&
+ SigType<A4>::Char==inSig[4] &&
+ SigType<A5>::Char==inSig[5] &&
+ SigType<A6>::Char==inSig[6] &&
+ SigType<A7>::Char==inSig[7] &&
+ SigType<A8>::Char==inSig[8] &&
+ SigType<A9>::Char==inSig[9] &&
+ SigType<A10>::Char==inSig[10] &&
+ SigType<A11>::Char==inSig[11] &&
+ SigType<A12>::Char==inSig[12] &&
+ SigType<RET>::Char==inSig[13] &&
+ 0 == inSig[14];
+}
+
+template<typename RET, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11, typename A12, typename A13>
+bool CheckSig14( RET (func)(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13), const char *inSig)
+{
+ return SigType<A0>::Char==inSig[0] &&
+ SigType<A1>::Char==inSig[1] &&
+ SigType<A2>::Char==inSig[2] &&
+ SigType<A3>::Char==inSig[3] &&
+ SigType<A4>::Char==inSig[4] &&
+ SigType<A5>::Char==inSig[5] &&
+ SigType<A6>::Char==inSig[6] &&
+ SigType<A7>::Char==inSig[7] &&
+ SigType<A8>::Char==inSig[8] &&
+ SigType<A9>::Char==inSig[9] &&
+ SigType<A10>::Char==inSig[10] &&
+ SigType<A11>::Char==inSig[11] &&
+ SigType<A12>::Char==inSig[12] &&
+ SigType<A13>::Char==inSig[13] &&
+ SigType<RET>::Char==inSig[14] &&
+ 0 == inSig[15];
+}
+
+
+template<typename RET, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11, typename A12, typename A13, typename A14>
+bool CheckSig15( RET (func)(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14), const char *inSig)
+{
+ return SigType<A0>::Char==inSig[0] &&
+ SigType<A1>::Char==inSig[1] &&
+ SigType<A2>::Char==inSig[2] &&
+ SigType<A3>::Char==inSig[3] &&
+ SigType<A4>::Char==inSig[4] &&
+ SigType<A5>::Char==inSig[5] &&
+ SigType<A6>::Char==inSig[6] &&
+ SigType<A7>::Char==inSig[7] &&
+ SigType<A8>::Char==inSig[8] &&
+ SigType<A9>::Char==inSig[9] &&
+ SigType<A10>::Char==inSig[10] &&
+ SigType<A11>::Char==inSig[11] &&
+ SigType<A12>::Char==inSig[12] &&
+ SigType<A13>::Char==inSig[13] &&
+ SigType<A14>::Char==inSig[14] &&
+ SigType<RET>::Char==inSig[15] &&
+ 0 == inSig[16];
+}
+
+
+inline value ToValue(int inVal) { return alloc_int(inVal); }
+inline value ToValue(long inVal) { return alloc_int32(inVal); }
+inline value ToValue(float inVal) { return alloc_float(inVal); }
+inline value ToValue(double inVal) { return alloc_float(inVal); }
+inline value ToValue(value inVal) { return inVal; }
+inline value ToValue(bool inVal) { return alloc_bool(inVal); }
+#ifdef HXCPP_JS_PRIME
+inline value ToValue(HxString inVal) { return inVal.c_str() ? alloc_string_len(inVal.c_str(),inVal.size()) : alloc_null() ; }
+#else
+inline value ToValue(HxString inVal) { return inVal.__s ? alloc_string_len(inVal.c_str(),inVal.size()) : alloc_null() ; }
+#endif
+
+struct AutoValue
+{
+ value mValue;
+
+ inline operator int() { return val_int(mValue); }
+ inline operator long() { return (long)val_number(mValue); }
+ inline operator value() { return mValue; }
+ inline operator double() { return val_number(mValue); }
+ inline operator float() { return val_number(mValue); }
+ inline operator bool() { return val_bool(mValue); }
+ inline operator const char *() { return val_string(mValue); }
+ inline operator HxString() { return val_is_null(mValue) ? HxString(0,0) : HxString(val_string(mValue), val_strlen(mValue), false); }
+};
+
+
+
+} // end namespace cffi
+
+
+#define PRIME_ARG_DECL0
+#define PRIME_ARG_DECL1 cffi::AutoValue a0
+#define PRIME_ARG_DECL2 PRIME_ARG_DECL1, cffi::AutoValue a1
+#define PRIME_ARG_DECL3 PRIME_ARG_DECL2, cffi::AutoValue a2
+#define PRIME_ARG_DECL4 PRIME_ARG_DECL3, cffi::AutoValue a3
+#define PRIME_ARG_DECL5 PRIME_ARG_DECL4, cffi::AutoValue a4
+
+#define PRIME_ARG_LIST0
+#define PRIME_ARG_LIST1 a0
+#define PRIME_ARG_LIST2 PRIME_ARG_LIST1, a1
+#define PRIME_ARG_LIST3 PRIME_ARG_LIST2, a2
+#define PRIME_ARG_LIST4 PRIME_ARG_LIST3, a3
+#define PRIME_ARG_LIST5 PRIME_ARG_LIST4, a4
+#define PRIME_ARG_LIST6 arg[0],arg[1],arg[2],arg[3],arg[4],arg[5]
+#define PRIME_ARG_LIST7 PRIME_ARG_LIST6 ,arg[6]
+#define PRIME_ARG_LIST8 PRIME_ARG_LIST7 ,arg[7]
+#define PRIME_ARG_LIST9 PRIME_ARG_LIST8 ,arg[8]
+#define PRIME_ARG_LIST10 PRIME_ARG_LIST9 ,arg[9]
+#define PRIME_ARG_LIST11 PRIME_ARG_LIST10 ,arg[10]
+#define PRIME_ARG_LIST12 PRIME_ARG_LIST11 ,arg[11]
+#define PRIME_ARG_LIST13 PRIME_ARG_LIST12 ,arg[12]
+#define PRIME_ARG_LIST14 PRIME_ARG_LIST13 ,arg[13]
+#define PRIME_ARG_LIST15 PRIME_ARG_LIST14 ,arg[14]
+
+
+
+#ifdef HXCPP_JS_PRIME
+
+
+#define DEFINE_PRIME0(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME1(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME2(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME3(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME4(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME5(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME6(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME7(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME8(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME9(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME10(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME11(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME12(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME13(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME14(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME15(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+
+
+#define DEFINE_PRIME0v(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME1v(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME2v(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME3v(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME4v(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME5v(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME6v(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME7v(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME8v(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME9v(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME10v(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME11v(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME12v(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME13v(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME14v(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+#define DEFINE_PRIME15v(func) EMSCRIPTEN_BINDINGS(func) { function(#func, &func); }
+
+
+#elif defined(STATIC_LINK)
+
+#if defined(HXCPP_STATIC_CFFI) || defined(HXCPP_NO_PRIME_EXPORT)
+#define PRIME_EXPORT
+#else
+#define PRIME_EXPORT EXPORT
+#endif
+
+#define DEFINE_PRIME0(func) extern "C" { \
+ PRIME_EXPORT value func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig0(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap() { return cffi::ToValue( func() ); } \
+ PRIME_EXPORT void *func##__0() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__0",(void *)(&func##__wrap)); \
+}
+
+#define DEFINE_PRIME0v(func) extern "C" { \
+ PRIME_EXPORT value func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig0(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap() { func(); return alloc_null(); } \
+ PRIME_EXPORT void *func##__0() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__0",(void *)(&func##__wrap)); \
+}
+
+
+#define DEFINE_PRIME1(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig1(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(PRIME_ARG_DECL1) { return cffi::ToValue( func(PRIME_ARG_LIST1) ); } \
+ PRIME_EXPORT void *func##__1() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__1",(void *)(&func##__wrap)); \
+}
+
+#define DEFINE_PRIME1v(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig1(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(PRIME_ARG_DECL1) { func(PRIME_ARG_LIST1); return alloc_null(); } \
+ PRIME_EXPORT void *func##__1() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__1",(void *)(&func##__wrap)); \
+}
+
+
+#define DEFINE_PRIME2(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig2(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(PRIME_ARG_DECL2) { return cffi::ToValue( func(PRIME_ARG_LIST2) ); } \
+ PRIME_EXPORT void *func##__2() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__2",(void *)(&func##__wrap)); \
+}
+
+#define DEFINE_PRIME2v(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig2(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(PRIME_ARG_DECL2) { func(PRIME_ARG_LIST2); return alloc_null(); } \
+ PRIME_EXPORT void *func##__2() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__2",(void *)(&func##__wrap)); \
+}
+
+
+#define DEFINE_PRIME3(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig3(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(PRIME_ARG_DECL3) { return cffi::ToValue( func(PRIME_ARG_LIST3) ); } \
+ PRIME_EXPORT void *func##__3() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__3",(void *)(&func##__wrap)); \
+}
+
+#define DEFINE_PRIME3v(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig3(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(PRIME_ARG_DECL3) { func(PRIME_ARG_LIST3); return alloc_null(); } \
+ PRIME_EXPORT void *func##__3() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__3",(void *)(&func##__wrap)); \
+}
+
+
+#define DEFINE_PRIME4(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig4(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(PRIME_ARG_DECL4) { return cffi::ToValue( func(PRIME_ARG_LIST4) ); } \
+ PRIME_EXPORT void *func##__4() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__4",(void *)(&func##__wrap)); \
+}
+
+#define DEFINE_PRIME4v(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig4(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(PRIME_ARG_DECL4) { func(PRIME_ARG_LIST4); return alloc_null(); } \
+ PRIME_EXPORT void *func##__4() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__4",(void *)(&func##__wrap)); \
+}
+
+
+#define DEFINE_PRIME5(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig5(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(PRIME_ARG_DECL5) { return cffi::ToValue( func(PRIME_ARG_LIST5) ); } \
+ PRIME_EXPORT void *func##__5() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__5",(void *)(&func##__wrap)); \
+}
+
+#define DEFINE_PRIME5v(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig5(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(PRIME_ARG_DECL5) { func(PRIME_ARG_LIST5); return alloc_null(); } \
+ PRIME_EXPORT void *func##__5() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__5",(void *)(&func##__wrap)); \
+}
+
+
+#define DEFINE_PRIME6(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig6(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg,int) { return cffi::ToValue( func(PRIME_ARG_LIST6) ); } \
+ PRIME_EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__MULT",(void *)(&func##__wrap)); \
+}
+
+#define DEFINE_PRIME6v(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig6(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg, int) { func(PRIME_ARG_LIST6); return alloc_null(); } \
+ PRIME_EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__MULT",(void *)(&func##__wrap)); \
+}
+
+
+#define DEFINE_PRIME7(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig7(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg,int) { return cffi::ToValue( func(PRIME_ARG_LIST7) ); } \
+ PRIME_EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__MULT",(void *)(&func##__wrap)); \
+}
+
+#define DEFINE_PRIME7v(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig7(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg, int) { func(PRIME_ARG_LIST7); return alloc_null(); } \
+ PRIME_EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__MULT",(void *)(&func##__wrap)); \
+}
+
+#define DEFINE_PRIME8(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig8(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg,int) { return cffi::ToValue( func(PRIME_ARG_LIST8) ); } \
+ PRIME_EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__MULT",(void *)(&func##__wrap)); \
+}
+
+#define DEFINE_PRIME8v(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig8(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg, int) { func(PRIME_ARG_LIST8); return alloc_null(); } \
+ PRIME_EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__MULT",(void *)(&func##__wrap)); \
+}
+
+
+#define DEFINE_PRIME9(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig9(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg,int) { return cffi::ToValue( func(PRIME_ARG_LIST9) ); } \
+ PRIME_EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__MULT",(void *)(&func##__wrap)); \
+}
+
+#define DEFINE_PRIME9v(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig9(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg, int) { func(PRIME_ARG_LIST9); return alloc_null(); } \
+ PRIME_EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__MULT",(void *)(&func##__wrap)); \
+}
+
+#define DEFINE_PRIME10(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig10(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg,int) { return cffi::ToValue( func(PRIME_ARG_LIST10) ); } \
+ PRIME_EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__MULT",(void *)(&func##__wrap)); \
+}
+
+#define DEFINE_PRIME10v(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig10(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg, int) { func(PRIME_ARG_LIST10); return alloc_null(); } \
+ PRIME_EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__MULT",(void *)(&func##__wrap)); \
+}
+
+
+#define DEFINE_PRIME11(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig11(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg,int) { return cffi::ToValue( func(PRIME_ARG_LIST11) ); } \
+ PRIME_EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__MULT",(void *)(&func##__wrap)); \
+}
+
+#define DEFINE_PRIME11v(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig11(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg, int) { func(PRIME_ARG_LIST11); return alloc_null(); } \
+ PRIME_EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__MULT",(void *)(&func##__wrap)); \
+}
+
+
+#define DEFINE_PRIME12(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig12(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg,int) { return cffi::ToValue( func(PRIME_ARG_LIST12) ); } \
+ PRIME_EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__MULT",(void *)(&func##__wrap)); \
+}
+
+#define DEFINE_PRIME12v(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig12(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg, int) { func(PRIME_ARG_LIST12); return alloc_null(); } \
+ PRIME_EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__MULT",(void *)(&func##__wrap)); \
+}
+
+
+
+#define DEFINE_PRIME13(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig13(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg,int) { return cffi::ToValue( func(PRIME_ARG_LIST13) ); } \
+ PRIME_EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__MULT",(void *)(&func##__wrap)); \
+}
+
+#define DEFINE_PRIME13v(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig13(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg, int) { func(PRIME_ARG_LIST13); return alloc_null(); } \
+ PRIME_EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__MULT",(void *)(&func##__wrap)); \
+}
+
+
+#define DEFINE_PRIME14(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig14(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg,int) { return cffi::ToValue( func(PRIME_ARG_LIST14) ); } \
+ PRIME_EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__MULT",(void *)(&func##__wrap)); \
+}
+
+#define DEFINE_PRIME14v(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig14(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg, int) { func(PRIME_ARG_LIST14); return alloc_null(); } \
+ PRIME_EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__MULT",(void *)(&func##__wrap)); \
+}
+
+
+
+#define DEFINE_PRIME15(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig15(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg,int) { return cffi::ToValue( func(PRIME_ARG_LIST15) ); } \
+ PRIME_EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__MULT",(void *)(&func##__wrap)); \
+}
+
+#define DEFINE_PRIME15v(func) extern "C" { \
+ PRIME_EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig15(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg, int) { func(PRIME_ARG_LIST15); return alloc_null(); } \
+ PRIME_EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+ int __reg_##func##__prime = hx_register_prim(#func "__prime",(void *)(&func##__prime)); \
+ int __reg_##func = hx_register_prim(#func "__MULT",(void *)(&func##__wrap)); \
+}
+
+
+#else
+
+
+#define DEFINE_PRIME0(func) extern "C" { \
+ EXPORT value func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig0(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap() { return cffi::ToValue( func() ); } \
+ EXPORT void *func##__0() { return (void*)(&func##__wrap); } \
+}
+
+#define DEFINE_PRIME0v(func) extern "C" { \
+ EXPORT value func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig0(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap() { func(); return alloc_null(); } \
+ EXPORT void *func##__0() { return (void*)(&func##__wrap); } \
+}
+
+
+#define DEFINE_PRIME1(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig1(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(PRIME_ARG_DECL1) { return cffi::ToValue( func(PRIME_ARG_LIST1) ); } \
+ EXPORT void *func##__1() { return (void*)(&func##__wrap); } \
+}
+
+#define DEFINE_PRIME1v(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig1(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(PRIME_ARG_DECL1) { func(PRIME_ARG_LIST1); return alloc_null(); } \
+ EXPORT void *func##__1() { return (void*)(&func##__wrap); } \
+}
+
+
+#define DEFINE_PRIME2(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig2(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(PRIME_ARG_DECL2) { return cffi::ToValue( func(PRIME_ARG_LIST2) ); } \
+ EXPORT void *func##__2() { return (void*)(&func##__wrap); } \
+}
+
+#define DEFINE_PRIME2v(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig2(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(PRIME_ARG_DECL2) { func(PRIME_ARG_LIST2); return alloc_null(); } \
+ EXPORT void *func##__2() { return (void*)(&func##__wrap); } \
+}
+
+
+#define DEFINE_PRIME3(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig3(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(PRIME_ARG_DECL3) { return cffi::ToValue( func(PRIME_ARG_LIST3) ); } \
+ EXPORT void *func##__3() { return (void*)(&func##__wrap); } \
+}
+
+#define DEFINE_PRIME3v(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig3(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(PRIME_ARG_DECL3) { func(PRIME_ARG_LIST3); return alloc_null(); } \
+ EXPORT void *func##__3() { return (void*)(&func##__wrap); } \
+}
+
+
+#define DEFINE_PRIME4(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig4(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(PRIME_ARG_DECL4) { return cffi::ToValue( func(PRIME_ARG_LIST4) ); } \
+ EXPORT void *func##__4() { return (void*)(&func##__wrap); } \
+}
+
+#define DEFINE_PRIME4v(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig4(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(PRIME_ARG_DECL4) { func(PRIME_ARG_LIST4); return alloc_null(); } \
+ EXPORT void *func##__4() { return (void*)(&func##__wrap); } \
+}
+
+
+#define DEFINE_PRIME5(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig5(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(PRIME_ARG_DECL5) { return cffi::ToValue( func(PRIME_ARG_LIST5) ); } \
+ EXPORT void *func##__5() { return (void*)(&func##__wrap); } \
+}
+
+#define DEFINE_PRIME5v(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig5(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(PRIME_ARG_DECL5) { func(PRIME_ARG_LIST5); return alloc_null(); } \
+ EXPORT void *func##__5() { return (void*)(&func##__wrap); } \
+}
+
+
+#define DEFINE_PRIME6(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig6(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg,int) { return cffi::ToValue( func(PRIME_ARG_LIST6) ); } \
+ EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+}
+
+#define DEFINE_PRIME6v(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig6(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg, int) { func(PRIME_ARG_LIST6); return alloc_null(); } \
+ EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+}
+
+
+#define DEFINE_PRIME7(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig7(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg,int) { return cffi::ToValue( func(PRIME_ARG_LIST7) ); } \
+ EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+}
+
+#define DEFINE_PRIME7v(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig7(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg, int) { func(PRIME_ARG_LIST7); return alloc_null(); } \
+ EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+}
+
+#define DEFINE_PRIME8(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig8(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg,int) { return cffi::ToValue( func(PRIME_ARG_LIST8) ); } \
+ EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+}
+
+#define DEFINE_PRIME8v(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig8(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg, int) { func(PRIME_ARG_LIST8); return alloc_null(); } \
+ EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+}
+
+
+#define DEFINE_PRIME9(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig9(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg,int) { return cffi::ToValue( func(PRIME_ARG_LIST9) ); } \
+ EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+}
+
+#define DEFINE_PRIME9v(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig9(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg, int) { func(PRIME_ARG_LIST9); return alloc_null(); } \
+ EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+}
+
+#define DEFINE_PRIME10(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig10(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg,int) { return cffi::ToValue( func(PRIME_ARG_LIST10) ); } \
+ EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+}
+
+#define DEFINE_PRIME10v(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig10(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg, int) { func(PRIME_ARG_LIST10); return alloc_null(); } \
+ EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+}
+
+
+#define DEFINE_PRIME11(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig11(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg,int) { return cffi::ToValue( func(PRIME_ARG_LIST11) ); } \
+ EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+}
+
+#define DEFINE_PRIME11v(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig11(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg, int) { func(PRIME_ARG_LIST11); return alloc_null(); } \
+ EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+}
+
+
+#define DEFINE_PRIME12(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig12(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg,int) { return cffi::ToValue( func(PRIME_ARG_LIST12) ); } \
+ EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+}
+
+#define DEFINE_PRIME12v(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig12(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg, int) { func(PRIME_ARG_LIST12); return alloc_null(); } \
+ EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+}
+
+
+
+#define DEFINE_PRIME13(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig13(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg,int) { return cffi::ToValue( func(PRIME_ARG_LIST13) ); } \
+ EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+}
+
+#define DEFINE_PRIME13v(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig13(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg, int) { func(PRIME_ARG_LIST13); return alloc_null(); } \
+ EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+}
+
+
+#define DEFINE_PRIME14(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig14(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg,int) { return cffi::ToValue( func(PRIME_ARG_LIST14) ); } \
+ EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+}
+
+#define DEFINE_PRIME14v(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig14(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg, int) { func(PRIME_ARG_LIST14); return alloc_null(); } \
+ EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+}
+
+#define DEFINE_PRIME15(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig15(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg,int) { return cffi::ToValue( func(PRIME_ARG_LIST15) ); } \
+ EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+}
+
+#define DEFINE_PRIME15v(func) extern "C" { \
+ EXPORT void *func##__prime(const char *inSig) { \
+ if (!cffi::CheckSig15(func,inSig)) return 0; return cffi::alloc_pointer((void*)&func); } \
+ value func##__wrap(cffi::AutoValue *arg, int) { func(PRIME_ARG_LIST15); return alloc_null(); } \
+ EXPORT void *func##__MULT() { return (void*)(&func##__wrap); } \
+}
+
+
+
+#endif
+
+#endif
+
+
diff --git a/Sources/c_snikket/iinclude/hx/Class.h b/Sources/c_snikket/iinclude/hx/Class.h
new file mode 100644
index 0000000..adaed2e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/Class.h
@@ -0,0 +1,294 @@
+ #ifndef HX_CLASS_H
+#define HX_CLASS_H
+
+
+namespace hx
+{
+// --- hxClassOf --------------------------------------------------------------
+//
+// Gets the class definition that relates to a specific type.
+// Most classes have their own class data, but the standard types (non-classes)
+// use the template traits to get the class
+
+
+template<typename T>
+inline hx::Class &ClassOf() { typedef typename T::Obj Obj; return Obj::__SGetClass(); }
+
+template<>
+inline hx::Class &ClassOf<int>() { return GetIntClass(); }
+
+template<>
+inline hx::Class &ClassOf<double>() { return GetFloatClass(); }
+
+template<>
+inline hx::Class &ClassOf<float>() { return GetFloatClass(); }
+
+template<>
+inline hx::Class &ClassOf<bool>() { return GetBoolClass(); }
+
+template<>
+inline hx::Class &ClassOf<null>() { return GetVoidClass(); }
+
+template<>
+inline hx::Class &ClassOf<String>() { return GetStringClass(); }
+
+template<>
+inline hx::Class &ClassOf< ::cpp::Int64>() { return GetInt64Class(); }
+
+
+template<typename T>
+struct hxBaseType { typedef T type; };
+template<typename T>
+struct hxBaseType< hx::ObjectPtr<T> > { typedef T type; };
+
+template<typename T> inline int ClassSizeOf() { return sizeof( typename hx::hxBaseType<T>::type ); }
+
+} // end namespace hx
+
+
+// --- Class_obj --------------------------------------------------------------------
+//
+// The Class_obj provides the type information required by the Reflect and type APIs.
+
+namespace hx
+{
+typedef Dynamic (*ConstructEmptyFunc)();
+typedef Dynamic (*ConstructArgsFunc)(DynamicArray inArgs);
+typedef Dynamic (*ConstructEnumFunc)(String inName,DynamicArray inArgs);
+typedef void (*MarkFunc)(hx::MarkContext *__inCtx);
+typedef bool (*CanCastFunc)(hx::Object *inPtr);
+#ifdef HXCPP_VISIT_ALLOCS
+typedef void (*VisitFunc)(hx::VisitContext *__inCtx);
+#endif
+typedef bool (*GetStaticFieldFunc)(const String &inString, Dynamic &outValue, hx::PropertyAccess inCallProp);
+typedef bool (*SetStaticFieldFunc)(const String &inString, Dynamic &ioValue, hx::PropertyAccess inCallProp);
+}
+
+inline bool operator!=(hx::ConstructEnumFunc inFunc,const null &inNull) { return inFunc!=0; }
+
+#ifdef HXCPP_SCRIPTABLE
+namespace hx
+{
+enum FieldStorage
+{
+ fsUnknown = 0,
+ fsBool,
+ fsInt,
+ fsFloat,
+ fsString,
+ fsByte,
+ fsObject,
+};
+struct StorageInfo
+{
+ FieldStorage type;
+ int offset;
+ String name;
+};
+struct StaticInfo
+{
+ FieldStorage type;
+ void *address;
+ String name;
+};
+
+}
+#endif
+
+namespace hx
+{
+
+class HXCPP_EXTERN_CLASS_ATTRIBUTES Class_obj : public hx::Object
+{
+public:
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdClass };
+
+
+ inline void *operator new( size_t inSize )
+ {
+ return hx::InternalCreateConstBuffer(0,(int)inSize);
+ }
+ void operator delete( void *) { }
+
+
+ Class_obj() : mSuper(0) { };
+ Class_obj(const String &inClassName, String inStatics[], String inMembers[],
+ hx::ConstructEmptyFunc inConstructEmpty, hx::ConstructArgsFunc inConstructArgs,
+ hx::Class *inSuperClass, hx::ConstructEnumFunc inConstructEnum,
+ hx::CanCastFunc inCanCast, hx::MarkFunc inMarkFunc
+ #ifdef HXCPP_VISIT_ALLOCS
+ , hx::VisitFunc inVisitFunc
+ #endif
+ #ifdef HXCPP_SCRIPTABLE
+ ,const hx::StorageInfo *inStorageInfo
+ ,const hx::StaticInfo *inStaticInfo
+ #endif
+ );
+
+ String __ToString() const;
+
+ void MarkStatics(hx::MarkContext *__inCtx);
+
+ #ifdef HXCPP_VISIT_ALLOCS
+ void VisitStatics(hx::VisitContext *__inCtx);
+ #endif
+
+ static ::Array< ::String > dupFunctions(String inStatics[]);
+
+ // the "Class class"
+ hx::Class __GetClass() const;
+ static hx::Class & __SGetClass();
+ static void __boot();
+
+ hx::Val __Field(const String &inString ,hx::PropertyAccess inCallProp);
+
+ hx::Val __SetField(const String &inString,const hx::Val &inValue ,hx::PropertyAccess inCallProp);
+
+ bool __HasField(const String &inString);
+
+ virtual Dynamic ConstructEmpty();
+ virtual Dynamic ConstructArgs(hx::DynamicArray inArgs);
+ virtual Dynamic ConstructEnum(String inName,hx::DynamicArray inArgs);
+ virtual bool VCanCast(hx::Object *inPtr) { return false; }
+
+ int __GetType() const { return vtObject; }
+
+ virtual bool __IsEnum();
+
+ inline bool CanCast(hx::Object *inPtr) { return mCanCast ? mCanCast(inPtr) : VCanCast(inPtr); }
+ static bool GetNoStaticField(const String &inString, Dynamic &outValue, hx::PropertyAccess inCallProp);
+ static bool SetNoStaticField(const String &inString, Dynamic &ioValue, hx::PropertyAccess inCallProp);
+
+ void registerScriptable(bool inOverwrite);
+
+ hx::CanCastFunc mCanCast;
+
+
+
+ virtual Array<String> GetInstanceFields();
+ virtual Array<String> GetClassFields();
+ hx::Class GetSuper();
+ #ifdef HXCPP_SCRIPTABLE
+ const hx::StorageInfo* GetMemberStorage(String inName);
+ const hx::StaticInfo* GetStaticStorage(String inName);
+ #endif
+
+ static hx::Class Resolve(String inName);
+
+
+ hx::Class *mSuper;
+ String mName;
+ Dynamic __meta__;
+ String __rtti__;
+
+ hx::ConstructArgsFunc mConstructArgs;
+ hx::ConstructEmptyFunc mConstructEmpty;
+ hx::ConstructEnumFunc mConstructEnum;
+ hx::GetStaticFieldFunc mGetStaticField;
+ hx::SetStaticFieldFunc mSetStaticField;
+
+ hx::MarkFunc mMarkFunc;
+ #ifdef HXCPP_VISIT_ALLOCS
+ hx::VisitFunc mVisitFunc;
+ #endif
+ Array<String> mStatics;
+ Array<String> mMembers;
+
+ #ifdef HXCPP_SCRIPTABLE
+ const hx::StorageInfo* mMemberStorageInfo;
+ const hx::StaticInfo* mStaticStorageInfo;
+ #endif
+};
+
+} // end namespace hx
+
+void __hxcpp_boot_std_classes();
+
+
+// --- All classes should be registered with this function via the "__boot" method
+#ifdef RegisterClass
+#undef RegisterClass
+#endif
+
+namespace hx
+{
+
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+hx::Class _hx_RegisterClass(const String &inClassName, CanCastFunc inCanCast,
+ String inStatics[], String inMembers[],
+ ConstructEmptyFunc inConstructEmpty, ConstructArgsFunc inConstructArgs,
+ hx::Class *inSuperClass, ConstructEnumFunc inConst=0, MarkFunc inMarkFunc=0
+ #ifdef HXCPP_VISIT_ALLOCS
+ , VisitFunc inVisitFunc=0
+ #endif
+ #ifdef HXCPP_SCRIPTABLE
+ ,const hx::StorageInfo *inStorageInfo=0
+ ,const hx::StaticInfo *inStaticInfo=0
+ #endif
+ );
+
+// For older versions
+inline hx::Class RegisterClass(
+ const String &inClassName, CanCastFunc inCanCast,
+ String inStatics[], String inMembers[],
+ ConstructEmptyFunc inConstructEmpty, ConstructArgsFunc inConstructArgs,
+ hx::Class *inSuperClass, ConstructEnumFunc inConst=0, MarkFunc inMarkFunc=0
+ #ifdef HXCPP_VISIT_ALLOCS
+ , VisitFunc inVisitFunc=0
+ #endif
+ #ifdef HXCPP_SCRIPTABLE
+ ,const hx::StorageInfo *inStorageInfo=0
+ ,const hx::StaticInfo *inStaticInfo=0
+ #endif
+ )
+{
+ return _hx_RegisterClass(inClassName, inCanCast, inStatics, inMembers,
+ inConstructEmpty, inConstructArgs, inSuperClass, inConst, inMarkFunc
+ #ifdef HXCPP_VISIT_ALLOCS
+ , inVisitFunc
+ #endif
+ #ifdef HXCPP_SCRIPTABLE
+ ,inStorageInfo ,inStaticInfo
+ #endif
+ );
+}
+
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+void _hx_RegisterClass(const String &inClassName, hx::Class inClass);
+
+inline void RegisterClass(const String &inClassName, hx::Class inClass)
+{
+ _hx_RegisterClass(inClassName, inClass);
+}
+
+template<typename T>
+inline bool TCanCast(hx::Object *inPtr)
+{
+ return inPtr && inPtr->_hx_isInstanceOf(T::_hx_ClassId);
+}
+
+
+template<int HASH>
+inline bool TIsInterface(hx::Object *inPtr)
+{
+ return inPtr && inPtr->_hx_getInterface(HASH);
+}
+
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES void RegisterVTableOffset(int inOffset);
+
+#define HX_REGISTER_VTABLE_OFFSET( CLASS, INTERFACE ) \
+{ \
+ CLASS *dummy = (CLASS *)0; \
+ INTERFACE *intf = dummy; \
+ hx::RegisterVTableOffset( (int)( (size_t)((char *)intf - (char *)dummy)) ); \
+}
+
+
+
+}
+
+
+#endif
diff --git a/Sources/c_snikket/iinclude/hx/Debug.h b/Sources/c_snikket/iinclude/hx/Debug.h
new file mode 100644
index 0000000..903468f
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/Debug.h
@@ -0,0 +1,376 @@
+#ifndef HX_DEBUG_H
+#define HX_DEBUG_H
+
+#include <hxcpp.h>
+
+// Some functions used by AdvancedDebug.cpp
+// Returns the thread number of the calling thread
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+int __hxcpp_GetCurrentThreadNumber();
+
+namespace hx
+{
+
+#ifdef HXCPP_DEBUGGER
+
+template<typename T> struct StackVariableWrapper
+{
+ typedef T wrapper;
+};
+template<> struct StackVariableWrapper<size_t>
+{
+ #ifdef HXCPP_M64
+ typedef cpp::Int64 wrapper;
+ #else
+ typedef int wrapper;
+ #endif
+};
+
+
+template<typename T> struct StackVariableWrapper<T *>
+{
+ typedef cpp::Pointer<T> wrapper;
+};
+
+
+
+
+class StackVariable
+{
+public:
+
+ const char *mHaxeName;
+ bool mIsArg;
+ StackVariable *mNext;
+
+ template<typename T>
+ StackVariable(StackVariable *&inHead, bool inIsArg,
+ const char *inHaxeName, T *inCppVar)
+ : mHaxeName(inHaxeName), mIsArg(inIsArg), mHead(inHead),
+ mCppVar((void *) inCppVar)
+ {
+ mGetOrSetFunction = GetOrSetFunction<T>;
+ mNext = mHead;
+ mHead = this;
+ }
+
+ StackVariable(StackVariable *&inHead, bool inIsArg,
+ const char *inHaxeName, hx::Object **inCppVar)
+ : mHaxeName(inHaxeName), mIsArg(inIsArg), mHead(inHead),
+ mCppVar((void *) inCppVar)
+ {
+ mGetOrSetFunction = GetOrSetFunctionHxObject;
+ mNext = mHead;
+ mHead = this;
+ }
+
+
+ // For StackThis
+ template<typename T>
+ StackVariable(StackVariable *&inHead, T *inCppVar)
+ : mHaxeName("this"), mIsArg(true), mHead(inHead),
+ mCppVar((void *) inCppVar)
+ {
+ mNext = mHead;
+ mHead = this;
+ }
+
+ ~StackVariable()
+ {
+ // Stack variables are always deleted in the reverse order that they
+ // are created, so a simple pop_front is sufficient; no need to hunt
+ // for and remove the variable, it's always in the front ...
+ mHead = mNext;
+ }
+
+ operator Dynamic()
+ {
+ return mGetOrSetFunction(true, mCppVar, 0);
+ }
+
+ StackVariable &operator =(Dynamic &other)
+ {
+ (void) mGetOrSetFunction(false, mCppVar, &other);
+
+ return *this;
+ }
+
+protected:
+
+ typedef Dynamic (*GetOrSetFunctionType)(bool, void *, Dynamic *);
+
+ GetOrSetFunctionType mGetOrSetFunction;
+
+private:
+
+ template<typename T>
+ static Dynamic GetOrSetFunction(bool get, void *ptr, Dynamic *dynamic)
+ {
+ typedef typename StackVariableWrapper<T>::wrapper Wrap;
+
+ if (get) {
+ return Wrap(* (T *) ptr);
+ }
+ else {
+ * (T *) ptr = Wrap(*dynamic);
+ return null();
+ }
+ }
+
+ static Dynamic GetOrSetFunctionHxObject(bool get, void *ptr, Dynamic *dynamic)
+ {
+ if (get) {
+ return * (hx::Object **) ptr;
+ }
+ else {
+ * (hx::Object **)ptr = dynamic->mPtr;
+ return null();
+ }
+ }
+
+
+ StackVariable *&mHead;
+
+ void *mCppVar;
+
+};
+
+
+class StackThis : public StackVariable
+{
+public:
+
+ template<typename T>
+ StackThis(StackVariable *&inHead, T *inThis)
+ : StackVariable(inHead, inThis)
+ {
+ mGetOrSetFunction = GetFunction<T>;
+ }
+
+ template<typename T>
+ StackThis(StackVariable *&inHead, hx::ObjectPtr<T> &inThis)
+ : StackVariable(inHead, &inThis.mPtr)
+ {
+ mGetOrSetFunction = GetObjectPtr<T>;
+ }
+
+ template<typename T>
+ static Dynamic GetObjectPtr(bool get, void *ptr, Dynamic *val)
+ {
+ if (get) {
+ return *(hx::Object **) ptr;
+ }
+ else {
+ return null();
+ }
+ }
+
+
+ template<typename T>
+ static Dynamic GetFunction(bool get, void *ptr, Dynamic *val)
+ {
+ if (get) {
+ return (T *) ptr;
+ }
+ else {
+ return null();
+ }
+ }
+};
+
+
+class StackCatchable
+{
+public:
+
+ StackCatchable *mNext;
+
+ template<typename T>
+ StackCatchable(StackFrame &frame, T * /* dummy required by template*/)
+ : mFrame(frame)
+{
+ mNext = frame.catchables;
+ frame.catchables = this;
+ mTestFunction = TestFunction<T>;
+ }
+
+ ~StackCatchable()
+{
+ mFrame.catchables = mNext;
+ }
+
+ bool Catches(Dynamic e) const
+ {
+ return mTestFunction(e);
+ }
+
+private:
+
+ template<typename T>
+ static bool TestFunction(Dynamic e)
+ {
+ return e.IsClass<T>();
+ }
+
+ StackFrame &mFrame;
+ bool (*mTestFunction)(Dynamic e);
+};
+
+#if defined(HXCPP_SCRIPTABLE) && (HXCPP_API_LEVEL >= 500)
+// This is the function to call when a new script has been loaded.
+// Signature: Void -> Void
+extern Dynamic g_onScriptLoadedFunction;
+#endif
+
+
+#endif // HXCPP_DEBUGGER
+
+} // end namespace hx
+
+
+
+void __hxcpp_dbg_getScriptableFiles( Array< ::String> ioPaths );
+void __hxcpp_dbg_getScriptableFilesFullPath( Array< ::String> ioPaths );
+void __hxcpp_dbg_getScriptableClasses( Array< ::String> ioClasses );
+
+
+
+#ifdef HXCPP_DEBUGGER
+
+
+namespace hx
+{
+
+// These must match the values present in cpp.vm.Debugger
+
+enum ThreadEvent
+{
+ THREAD_CREATED = 1,
+ THREAD_TERMINATED = 2,
+ THREAD_STARTED = 3,
+ THREAD_STOPPED = 4
+};
+
+enum StepType
+{
+ STEP_NONE = 0, // Not present or needed in cpp.vm.Debugger
+ STEP_INTO = 1,
+ STEP_OVER = 2,
+ STEP_OUT = 3
+};
+
+
+} // end namespace hx
+
+
+// The following functions are called directly, and only, by the haxe standard
+// library's cpp.vm.Debugger.hx class
+void __hxcpp_dbg_setEventNotificationHandler(Dynamic handler);
+void __hxcpp_dbg_enableCurrentThreadDebugging(bool enable);
+int __hxcpp_dbg_getCurrentThreadNumber();
+Array< ::String> __hxcpp_dbg_getFiles();
+Array< ::String> __hxcpp_dbg_getFilesFullPath();
+Array< ::String> __hxcpp_dbg_getClasses();
+Array<Dynamic> __hxcpp_dbg_getThreadInfos();
+Dynamic __hxcpp_dbg_getThreadInfo(int threadNumber, bool unsafe);
+int __hxcpp_dbg_addFileLineBreakpoint(String fileName, int lineNumber);
+int __hxcpp_dbg_addClassFunctionBreakpoint(String className,
+ String functionName);
+void __hxcpp_dbg_deleteAllBreakpoints();
+void __hxcpp_dbg_deleteBreakpoint(int number);
+void __hxcpp_dbg_breakNow(bool wait);
+void __hxcpp_dbg_continueThreads(int threadNumber, int count);
+void __hxcpp_dbg_stepThread(int threadNumber, int stepType, int stepCount);
+Array<Dynamic> __hxcpp_dbg_getStackVariables(int threadNumber,
+ int stackFrameNumber,
+ bool unsafe,
+ Dynamic markThreadNotStopped);
+Dynamic __hxcpp_dbg_getStackVariableValue(int threadNumber,
+ int stackFrameNumber,
+ String name,
+ bool unsafe,
+ Dynamic markNonexistent,
+ Dynamic markThreadNotStopped);
+
+Dynamic __hxcpp_dbg_setStackVariableValue(int threadNumber,
+ int stackFrameNumber,
+ String name, Dynamic value,
+ bool unsafe,
+ Dynamic markNonexistent,
+ Dynamic markThreadNotStopped);
+void __hxcpp_dbg_setNewParameterFunction(Dynamic function);
+void __hxcpp_dbg_setNewStackFrameFunction(Dynamic function);
+void __hxcpp_dbg_setNewThreadInfoFunction(Dynamic function);
+void __hxcpp_dbg_setAddParameterToStackFrameFunction(Dynamic function);
+void __hxcpp_dbg_setAddStackFrameToThreadInfoFunction(Dynamic function);
+#if defined(HXCPP_SCRIPTABLE) && (HXCPP_API_LEVEL >= 500)
+void __hxcpp_dbg_setOnScriptLoadedFunction(Dynamic function);
+#endif
+
+bool __hxcpp_dbg_fix_critical_error(String inErr);
+
+// The following functions are called by Thread.cpp to notify of thread
+// created and terminated
+void __hxcpp_dbg_threadCreatedOrTerminated(int threadNumber, bool created);
+
+// The following is called by the stack macros, but only if
+// HXCPP_DEBUGGER is set
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic __hxcpp_dbg_checkedThrow(Dynamic toThrow);
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic __hxcpp_dbg_checkedRethrow(Dynamic toThrow);
+
+#else // !HXCPP_DEBUGGER
+
+// If no debugger, provide empty implementations of the debugging functions
+
+inline void __hxcpp_dbg_setEventNotificationHandler(Dynamic)
+ { hx::Throw("Debugging is not enabled for this program; try\n"
+ "rebuilding it with the -D HXCPP_DEBUGGER option"); }
+inline void __hxcpp_dbg_enableCurrentThreadDebugging(bool) { }
+inline int __hxcpp_dbg_getCurrentThreadNumber() { return -1; }
+inline Array< ::String> __hxcpp_dbg_getFiles()
+ { return Array_obj< String>::__new(); }
+inline Array< ::String> __hxcpp_dbg_getFilesFullPath()
+ { return Array_obj< String>::__new(); }
+inline Array< ::String> __hxcpp_dbg_getClasses()
+ { return Array_obj< String>::__new(); }
+inline Array<Dynamic> __hxcpp_dbg_getThreadInfos()
+ { return Array_obj< ::Dynamic>::__new(); }
+inline Dynamic __hxcpp_dbg_getThreadInfo(int, bool) { return null(); }
+inline int __hxcpp_dbg_addFileLineBreakpoint(String, int) { return -1; }
+inline int __hxcpp_dbg_addClassFunctionBreakpoint(String, String)
+ { return -1; }
+inline void __hxcpp_dbg_deleteAllBreakpoints() { }
+inline void __hxcpp_dbg_deleteBreakpoint(int) { }
+inline void __hxcpp_dbg_breakNow(bool) { }
+inline void __hxcpp_dbg_continueThreads(int, int) { }
+inline void __hxcpp_dbg_stepThread(int, int, int) { }
+inline Array<Dynamic> __hxcpp_dbg_getStackVariables(int, int, bool, Dynamic)
+ { return Array_obj< String>::__new(); }
+inline Dynamic __hxcpp_dbg_getStackVariableValue(int, int, String, bool,
+ Dynamic, Dynamic)
+ { return null(); }
+inline Dynamic __hxcpp_dbg_setStackVariableValue(int, int, String, Dynamic,
+ bool, Dynamic, Dynamic)
+ { return null(); }
+inline void __hxcpp_dbg_setNewParameterFunction(Dynamic) { }
+inline void __hxcpp_dbg_setNewStackFrameFunction(Dynamic) { }
+inline void __hxcpp_dbg_setNewThreadInfoFunction(Dynamic) { }
+inline void __hxcpp_dbg_setAddParameterToStackFrameFunction(Dynamic) { }
+inline void __hxcpp_dbg_setAddStackFrameToThreadInfoFunction(Dynamic) { }
+#if defined(HXCPP_SCRIPTABLE) && (HXCPP_API_LEVEL >= 500)
+inline void __hxcpp_dbg_setOnScriptLoadedFunction(Dynamic) { }
+#endif
+
+// The following functions are called by Thread.cpp to notify of thread
+// created and terminated
+inline void __hxcpp_dbg_threadCreatedOrTerminated(int, bool) { }
+
+inline Dynamic __hxcpp_dbg_checkedThrow(Dynamic toThrow) { return hx::Throw(toThrow); }
+inline Dynamic __hxcpp_dbg_checkedRethrow(Dynamic toThrow) { return hx::Rethrow(toThrow); }
+
+#endif // HXCPP_DEBUGGER
+
+
+#endif // HX_DEBUG_H
diff --git a/Sources/c_snikket/iinclude/hx/DynamicImpl.h b/Sources/c_snikket/iinclude/hx/DynamicImpl.h
new file mode 100644
index 0000000..7661253
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/DynamicImpl.h
@@ -0,0 +1,1060 @@
+// ## ## ## ## #### ## ## ## ## ## #### ##
+// ## ## ## ## ## ## ## ### ## ## ### ## ## ##
+// ## ## ## ###### ###### ###### ## ###### ## ### ##
+// ## ## ## ## ## ## ## ## ### ## ## ### ## ##
+// ## ## ## ## ## ## ## ## ## ## ## #### ##
+
+// DO NOT EDIT
+// This file is generated from the .tpl file
+
+
+
+namespace hx {
+
+struct CMemberFunction0 : public hx::Object
+{
+ hx::ObjectPtr<Object> mThis;
+ MemberFunction0 mFunction;
+ const char *mName;
+
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdCMember0 };
+
+
+ CMemberFunction0(const char *inName, hx::Object *inObj, MemberFunction0 inFunction)
+ {
+ mName = inName;
+ mThis = inObj;
+ mFunction = inFunction;
+ }
+ int __Compare(const hx::Object *inRHS) const
+ {
+ const CMemberFunction0 *other = dynamic_cast<const CMemberFunction0 *>(inRHS);
+ if (!other)
+ return -1;
+ return (mName==other->mName && mFunction==other->mFunction && mThis.GetPtr()==other->mThis.GetPtr())? 0 : -1;
+ }
+
+ int __GetType() const { return vtFunction; }
+ int __ArgCount() const { return 0; }
+ ::String __ToString() const{ return String(mName); }
+ void __Mark(hx::MarkContext *__inCtx) { HX_MARK_MEMBER_NAME(mThis,"CMemberFunction0.this"); }
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx) { HX_VISIT_MEMBER(mThis); }
+ #endif
+ void *__GetHandle() const { return mThis.GetPtr(); }
+ Dynamic __Run(const Array<Dynamic> &inArgs)
+ {
+
+ return mFunction(mThis.GetPtr());
+
+ }
+ Dynamic __run()
+ {
+
+ return mFunction(mThis.GetPtr());
+
+ }
+};
+
+
+
+struct CStaticFunction0 : public hx::Object
+{
+ StaticFunction0 mFunction;
+ const char *mName;
+
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdCStatic0 };
+
+
+ CStaticFunction0(const char *inName,StaticFunction0 inFunction)
+ {
+ mName = inName;
+ mFunction = inFunction;
+ }
+ int __Compare(const hx::Object *inRHS) const
+ {
+ const CStaticFunction0 *other = dynamic_cast<const CStaticFunction0 *>(inRHS);
+ if (!other)
+ return -1;
+ return mName==other->mName && mFunction==other->mFunction && mName==other->mName ? 0 : -1;
+ }
+
+ int __GetType() const { return vtFunction; }
+ int __ArgCount() const { return 0; }
+ ::String __ToString() const{ return String(mName); }
+ Dynamic __Run(const Array<Dynamic> &inArgs)
+ {
+ return mFunction();
+ }
+ Dynamic __run()
+ {
+ return mFunction();
+ }
+};
+
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic CreateMemberFunction0(const char *inName,hx::Object *inObj, MemberFunction0 inFunc)
+ { return new CMemberFunction0(inName,inObj,inFunc); }
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic CreateStaticFunction0(const char *inName,StaticFunction0 inFunc)
+ { return new CStaticFunction0(inName,inFunc); }
+
+}
+
+
+
+
+namespace hx {
+
+struct CMemberFunction1 : public hx::Object
+{
+ hx::ObjectPtr<Object> mThis;
+ MemberFunction1 mFunction;
+ const char *mName;
+
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdCMember1 };
+
+
+ CMemberFunction1(const char *inName, hx::Object *inObj, MemberFunction1 inFunction)
+ {
+ mName = inName;
+ mThis = inObj;
+ mFunction = inFunction;
+ }
+ int __Compare(const hx::Object *inRHS) const
+ {
+ const CMemberFunction1 *other = dynamic_cast<const CMemberFunction1 *>(inRHS);
+ if (!other)
+ return -1;
+ return (mName==other->mName && mFunction==other->mFunction && mThis.GetPtr()==other->mThis.GetPtr())? 0 : -1;
+ }
+
+ int __GetType() const { return vtFunction; }
+ int __ArgCount() const { return 1; }
+ ::String __ToString() const{ return String(mName); }
+ void __Mark(hx::MarkContext *__inCtx) { HX_MARK_MEMBER_NAME(mThis,"CMemberFunction1.this"); }
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx) { HX_VISIT_MEMBER(mThis); }
+ #endif
+ void *__GetHandle() const { return mThis.GetPtr(); }
+ Dynamic __Run(const Array<Dynamic> &inArgs)
+ {
+
+ return mFunction(mThis.GetPtr(), inArgs[0]);
+
+ }
+ Dynamic __run(const Dynamic &inArg0)
+ {
+
+ return mFunction(mThis.GetPtr(), inArg0);
+
+ }
+};
+
+
+
+struct CStaticFunction1 : public hx::Object
+{
+ StaticFunction1 mFunction;
+ const char *mName;
+
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdCStatic1 };
+
+
+ CStaticFunction1(const char *inName,StaticFunction1 inFunction)
+ {
+ mName = inName;
+ mFunction = inFunction;
+ }
+ int __Compare(const hx::Object *inRHS) const
+ {
+ const CStaticFunction1 *other = dynamic_cast<const CStaticFunction1 *>(inRHS);
+ if (!other)
+ return -1;
+ return mName==other->mName && mFunction==other->mFunction && mName==other->mName ? 0 : -1;
+ }
+
+ int __GetType() const { return vtFunction; }
+ int __ArgCount() const { return 1; }
+ ::String __ToString() const{ return String(mName); }
+ Dynamic __Run(const Array<Dynamic> &inArgs)
+ {
+ return mFunction(inArgs[0]);
+ }
+ Dynamic __run(const Dynamic &inArg0)
+ {
+ return mFunction(inArg0);
+ }
+};
+
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic CreateMemberFunction1(const char *inName,hx::Object *inObj, MemberFunction1 inFunc)
+ { return new CMemberFunction1(inName,inObj,inFunc); }
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic CreateStaticFunction1(const char *inName,StaticFunction1 inFunc)
+ { return new CStaticFunction1(inName,inFunc); }
+
+}
+
+
+
+
+namespace hx {
+
+struct CMemberFunction2 : public hx::Object
+{
+ hx::ObjectPtr<Object> mThis;
+ MemberFunction2 mFunction;
+ const char *mName;
+
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdCMember2 };
+
+
+ CMemberFunction2(const char *inName, hx::Object *inObj, MemberFunction2 inFunction)
+ {
+ mName = inName;
+ mThis = inObj;
+ mFunction = inFunction;
+ }
+ int __Compare(const hx::Object *inRHS) const
+ {
+ const CMemberFunction2 *other = dynamic_cast<const CMemberFunction2 *>(inRHS);
+ if (!other)
+ return -1;
+ return (mName==other->mName && mFunction==other->mFunction && mThis.GetPtr()==other->mThis.GetPtr())? 0 : -1;
+ }
+
+ int __GetType() const { return vtFunction; }
+ int __ArgCount() const { return 2; }
+ ::String __ToString() const{ return String(mName); }
+ void __Mark(hx::MarkContext *__inCtx) { HX_MARK_MEMBER_NAME(mThis,"CMemberFunction2.this"); }
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx) { HX_VISIT_MEMBER(mThis); }
+ #endif
+ void *__GetHandle() const { return mThis.GetPtr(); }
+ Dynamic __Run(const Array<Dynamic> &inArgs)
+ {
+
+ return mFunction(mThis.GetPtr(), inArgs[0],inArgs[1]);
+
+ }
+ Dynamic __run(const Dynamic &inArg0,const Dynamic &inArg1)
+ {
+
+ return mFunction(mThis.GetPtr(), inArg0,inArg1);
+
+ }
+};
+
+
+
+struct CStaticFunction2 : public hx::Object
+{
+ StaticFunction2 mFunction;
+ const char *mName;
+
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdCStatic2 };
+
+
+ CStaticFunction2(const char *inName,StaticFunction2 inFunction)
+ {
+ mName = inName;
+ mFunction = inFunction;
+ }
+ int __Compare(const hx::Object *inRHS) const
+ {
+ const CStaticFunction2 *other = dynamic_cast<const CStaticFunction2 *>(inRHS);
+ if (!other)
+ return -1;
+ return mName==other->mName && mFunction==other->mFunction && mName==other->mName ? 0 : -1;
+ }
+
+ int __GetType() const { return vtFunction; }
+ int __ArgCount() const { return 2; }
+ ::String __ToString() const{ return String(mName); }
+ Dynamic __Run(const Array<Dynamic> &inArgs)
+ {
+ return mFunction(inArgs[0],inArgs[1]);
+ }
+ Dynamic __run(const Dynamic &inArg0,const Dynamic &inArg1)
+ {
+ return mFunction(inArg0,inArg1);
+ }
+};
+
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic CreateMemberFunction2(const char *inName,hx::Object *inObj, MemberFunction2 inFunc)
+ { return new CMemberFunction2(inName,inObj,inFunc); }
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic CreateStaticFunction2(const char *inName,StaticFunction2 inFunc)
+ { return new CStaticFunction2(inName,inFunc); }
+
+}
+
+
+
+
+namespace hx {
+
+struct CMemberFunction3 : public hx::Object
+{
+ hx::ObjectPtr<Object> mThis;
+ MemberFunction3 mFunction;
+ const char *mName;
+
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdCMember3 };
+
+
+ CMemberFunction3(const char *inName, hx::Object *inObj, MemberFunction3 inFunction)
+ {
+ mName = inName;
+ mThis = inObj;
+ mFunction = inFunction;
+ }
+ int __Compare(const hx::Object *inRHS) const
+ {
+ const CMemberFunction3 *other = dynamic_cast<const CMemberFunction3 *>(inRHS);
+ if (!other)
+ return -1;
+ return (mName==other->mName && mFunction==other->mFunction && mThis.GetPtr()==other->mThis.GetPtr())? 0 : -1;
+ }
+
+ int __GetType() const { return vtFunction; }
+ int __ArgCount() const { return 3; }
+ ::String __ToString() const{ return String(mName); }
+ void __Mark(hx::MarkContext *__inCtx) { HX_MARK_MEMBER_NAME(mThis,"CMemberFunction3.this"); }
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx) { HX_VISIT_MEMBER(mThis); }
+ #endif
+ void *__GetHandle() const { return mThis.GetPtr(); }
+ Dynamic __Run(const Array<Dynamic> &inArgs)
+ {
+
+ return mFunction(mThis.GetPtr(), inArgs[0],inArgs[1],inArgs[2]);
+
+ }
+ Dynamic __run(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2)
+ {
+
+ return mFunction(mThis.GetPtr(), inArg0,inArg1,inArg2);
+
+ }
+};
+
+
+
+struct CStaticFunction3 : public hx::Object
+{
+ StaticFunction3 mFunction;
+ const char *mName;
+
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdCStatic3 };
+
+
+ CStaticFunction3(const char *inName,StaticFunction3 inFunction)
+ {
+ mName = inName;
+ mFunction = inFunction;
+ }
+ int __Compare(const hx::Object *inRHS) const
+ {
+ const CStaticFunction3 *other = dynamic_cast<const CStaticFunction3 *>(inRHS);
+ if (!other)
+ return -1;
+ return mName==other->mName && mFunction==other->mFunction && mName==other->mName ? 0 : -1;
+ }
+
+ int __GetType() const { return vtFunction; }
+ int __ArgCount() const { return 3; }
+ ::String __ToString() const{ return String(mName); }
+ Dynamic __Run(const Array<Dynamic> &inArgs)
+ {
+ return mFunction(inArgs[0],inArgs[1],inArgs[2]);
+ }
+ Dynamic __run(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2)
+ {
+ return mFunction(inArg0,inArg1,inArg2);
+ }
+};
+
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic CreateMemberFunction3(const char *inName,hx::Object *inObj, MemberFunction3 inFunc)
+ { return new CMemberFunction3(inName,inObj,inFunc); }
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic CreateStaticFunction3(const char *inName,StaticFunction3 inFunc)
+ { return new CStaticFunction3(inName,inFunc); }
+
+}
+
+
+
+
+namespace hx {
+
+struct CMemberFunction4 : public hx::Object
+{
+ hx::ObjectPtr<Object> mThis;
+ MemberFunction4 mFunction;
+ const char *mName;
+
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdCMember4 };
+
+
+ CMemberFunction4(const char *inName, hx::Object *inObj, MemberFunction4 inFunction)
+ {
+ mName = inName;
+ mThis = inObj;
+ mFunction = inFunction;
+ }
+ int __Compare(const hx::Object *inRHS) const
+ {
+ const CMemberFunction4 *other = dynamic_cast<const CMemberFunction4 *>(inRHS);
+ if (!other)
+ return -1;
+ return (mName==other->mName && mFunction==other->mFunction && mThis.GetPtr()==other->mThis.GetPtr())? 0 : -1;
+ }
+
+ int __GetType() const { return vtFunction; }
+ int __ArgCount() const { return 4; }
+ ::String __ToString() const{ return String(mName); }
+ void __Mark(hx::MarkContext *__inCtx) { HX_MARK_MEMBER_NAME(mThis,"CMemberFunction4.this"); }
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx) { HX_VISIT_MEMBER(mThis); }
+ #endif
+ void *__GetHandle() const { return mThis.GetPtr(); }
+ Dynamic __Run(const Array<Dynamic> &inArgs)
+ {
+
+ return mFunction(mThis.GetPtr(), inArgs[0],inArgs[1],inArgs[2],inArgs[3]);
+
+ }
+ Dynamic __run(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3)
+ {
+
+ return mFunction(mThis.GetPtr(), inArg0,inArg1,inArg2,inArg3);
+
+ }
+};
+
+
+
+struct CStaticFunction4 : public hx::Object
+{
+ StaticFunction4 mFunction;
+ const char *mName;
+
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdCStatic4 };
+
+
+ CStaticFunction4(const char *inName,StaticFunction4 inFunction)
+ {
+ mName = inName;
+ mFunction = inFunction;
+ }
+ int __Compare(const hx::Object *inRHS) const
+ {
+ const CStaticFunction4 *other = dynamic_cast<const CStaticFunction4 *>(inRHS);
+ if (!other)
+ return -1;
+ return mName==other->mName && mFunction==other->mFunction && mName==other->mName ? 0 : -1;
+ }
+
+ int __GetType() const { return vtFunction; }
+ int __ArgCount() const { return 4; }
+ ::String __ToString() const{ return String(mName); }
+ Dynamic __Run(const Array<Dynamic> &inArgs)
+ {
+ return mFunction(inArgs[0],inArgs[1],inArgs[2],inArgs[3]);
+ }
+ Dynamic __run(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3)
+ {
+ return mFunction(inArg0,inArg1,inArg2,inArg3);
+ }
+};
+
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic CreateMemberFunction4(const char *inName,hx::Object *inObj, MemberFunction4 inFunc)
+ { return new CMemberFunction4(inName,inObj,inFunc); }
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic CreateStaticFunction4(const char *inName,StaticFunction4 inFunc)
+ { return new CStaticFunction4(inName,inFunc); }
+
+}
+
+
+
+
+namespace hx {
+
+struct CMemberFunction5 : public hx::Object
+{
+ hx::ObjectPtr<Object> mThis;
+ MemberFunction5 mFunction;
+ const char *mName;
+
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdCMember5 };
+
+
+ CMemberFunction5(const char *inName, hx::Object *inObj, MemberFunction5 inFunction)
+ {
+ mName = inName;
+ mThis = inObj;
+ mFunction = inFunction;
+ }
+ int __Compare(const hx::Object *inRHS) const
+ {
+ const CMemberFunction5 *other = dynamic_cast<const CMemberFunction5 *>(inRHS);
+ if (!other)
+ return -1;
+ return (mName==other->mName && mFunction==other->mFunction && mThis.GetPtr()==other->mThis.GetPtr())? 0 : -1;
+ }
+
+ int __GetType() const { return vtFunction; }
+ int __ArgCount() const { return 5; }
+ ::String __ToString() const{ return String(mName); }
+ void __Mark(hx::MarkContext *__inCtx) { HX_MARK_MEMBER_NAME(mThis,"CMemberFunction5.this"); }
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx) { HX_VISIT_MEMBER(mThis); }
+ #endif
+ void *__GetHandle() const { return mThis.GetPtr(); }
+ Dynamic __Run(const Array<Dynamic> &inArgs)
+ {
+
+ return mFunction(mThis.GetPtr(), inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4]);
+
+ }
+ Dynamic __run(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4)
+ {
+
+ return mFunction(mThis.GetPtr(), inArg0,inArg1,inArg2,inArg3,inArg4);
+
+ }
+};
+
+
+
+struct CStaticFunction5 : public hx::Object
+{
+ StaticFunction5 mFunction;
+ const char *mName;
+
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdCStatic5 };
+
+
+ CStaticFunction5(const char *inName,StaticFunction5 inFunction)
+ {
+ mName = inName;
+ mFunction = inFunction;
+ }
+ int __Compare(const hx::Object *inRHS) const
+ {
+ const CStaticFunction5 *other = dynamic_cast<const CStaticFunction5 *>(inRHS);
+ if (!other)
+ return -1;
+ return mName==other->mName && mFunction==other->mFunction && mName==other->mName ? 0 : -1;
+ }
+
+ int __GetType() const { return vtFunction; }
+ int __ArgCount() const { return 5; }
+ ::String __ToString() const{ return String(mName); }
+ Dynamic __Run(const Array<Dynamic> &inArgs)
+ {
+ return mFunction(inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4]);
+ }
+ Dynamic __run(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4)
+ {
+ return mFunction(inArg0,inArg1,inArg2,inArg3,inArg4);
+ }
+};
+
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic CreateMemberFunction5(const char *inName,hx::Object *inObj, MemberFunction5 inFunc)
+ { return new CMemberFunction5(inName,inObj,inFunc); }
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic CreateStaticFunction5(const char *inName,StaticFunction5 inFunc)
+ { return new CStaticFunction5(inName,inFunc); }
+
+}
+
+
+
+Dynamic Dynamic::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5)
+{
+ CheckFPtr();
+ return mPtr->__Run(Array_obj<Dynamic>::__new(6)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5));
+}
+
+namespace cpp
+{
+::Dynamic Variant::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5)
+{
+ if (isNull()) Dynamic::ThrowBadFunctionError();
+ return valObject->__Run(Array_obj<Dynamic>::__new(6)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5));
+}
+}
+
+
+
+
+Dynamic Dynamic::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6)
+{
+ CheckFPtr();
+ return mPtr->__Run(Array_obj<Dynamic>::__new(7)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6));
+}
+
+namespace cpp
+{
+::Dynamic Variant::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6)
+{
+ if (isNull()) Dynamic::ThrowBadFunctionError();
+ return valObject->__Run(Array_obj<Dynamic>::__new(7)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6));
+}
+}
+
+
+
+
+Dynamic Dynamic::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7)
+{
+ CheckFPtr();
+ return mPtr->__Run(Array_obj<Dynamic>::__new(8)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7));
+}
+
+namespace cpp
+{
+::Dynamic Variant::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7)
+{
+ if (isNull()) Dynamic::ThrowBadFunctionError();
+ return valObject->__Run(Array_obj<Dynamic>::__new(8)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7));
+}
+}
+
+
+
+
+Dynamic Dynamic::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8)
+{
+ CheckFPtr();
+ return mPtr->__Run(Array_obj<Dynamic>::__new(9)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8));
+}
+
+namespace cpp
+{
+::Dynamic Variant::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8)
+{
+ if (isNull()) Dynamic::ThrowBadFunctionError();
+ return valObject->__Run(Array_obj<Dynamic>::__new(9)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8));
+}
+}
+
+
+
+
+Dynamic Dynamic::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9)
+{
+ CheckFPtr();
+ return mPtr->__Run(Array_obj<Dynamic>::__new(10)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9));
+}
+
+namespace cpp
+{
+::Dynamic Variant::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9)
+{
+ if (isNull()) Dynamic::ThrowBadFunctionError();
+ return valObject->__Run(Array_obj<Dynamic>::__new(10)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9));
+}
+}
+
+
+
+
+Dynamic Dynamic::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10)
+{
+ CheckFPtr();
+ return mPtr->__Run(Array_obj<Dynamic>::__new(11)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10));
+}
+
+namespace cpp
+{
+::Dynamic Variant::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10)
+{
+ if (isNull()) Dynamic::ThrowBadFunctionError();
+ return valObject->__Run(Array_obj<Dynamic>::__new(11)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10));
+}
+}
+
+
+
+
+Dynamic Dynamic::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11)
+{
+ CheckFPtr();
+ return mPtr->__Run(Array_obj<Dynamic>::__new(12)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11));
+}
+
+namespace cpp
+{
+::Dynamic Variant::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11)
+{
+ if (isNull()) Dynamic::ThrowBadFunctionError();
+ return valObject->__Run(Array_obj<Dynamic>::__new(12)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11));
+}
+}
+
+
+
+
+Dynamic Dynamic::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12)
+{
+ CheckFPtr();
+ return mPtr->__Run(Array_obj<Dynamic>::__new(13)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11)->init(12,inArg12));
+}
+
+namespace cpp
+{
+::Dynamic Variant::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12)
+{
+ if (isNull()) Dynamic::ThrowBadFunctionError();
+ return valObject->__Run(Array_obj<Dynamic>::__new(13)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11)->init(12,inArg12));
+}
+}
+
+
+
+
+Dynamic Dynamic::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13)
+{
+ CheckFPtr();
+ return mPtr->__Run(Array_obj<Dynamic>::__new(14)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11)->init(12,inArg12)->init(13,inArg13));
+}
+
+namespace cpp
+{
+::Dynamic Variant::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13)
+{
+ if (isNull()) Dynamic::ThrowBadFunctionError();
+ return valObject->__Run(Array_obj<Dynamic>::__new(14)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11)->init(12,inArg12)->init(13,inArg13));
+}
+}
+
+
+
+
+Dynamic Dynamic::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14)
+{
+ CheckFPtr();
+ return mPtr->__Run(Array_obj<Dynamic>::__new(15)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11)->init(12,inArg12)->init(13,inArg13)->init(14,inArg14));
+}
+
+namespace cpp
+{
+::Dynamic Variant::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14)
+{
+ if (isNull()) Dynamic::ThrowBadFunctionError();
+ return valObject->__Run(Array_obj<Dynamic>::__new(15)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11)->init(12,inArg12)->init(13,inArg13)->init(14,inArg14));
+}
+}
+
+
+
+
+Dynamic Dynamic::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15)
+{
+ CheckFPtr();
+ return mPtr->__Run(Array_obj<Dynamic>::__new(16)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11)->init(12,inArg12)->init(13,inArg13)->init(14,inArg14)->init(15,inArg15));
+}
+
+namespace cpp
+{
+::Dynamic Variant::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15)
+{
+ if (isNull()) Dynamic::ThrowBadFunctionError();
+ return valObject->__Run(Array_obj<Dynamic>::__new(16)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11)->init(12,inArg12)->init(13,inArg13)->init(14,inArg14)->init(15,inArg15));
+}
+}
+
+
+
+
+Dynamic Dynamic::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16)
+{
+ CheckFPtr();
+ return mPtr->__Run(Array_obj<Dynamic>::__new(17)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11)->init(12,inArg12)->init(13,inArg13)->init(14,inArg14)->init(15,inArg15)->init(16,inArg16));
+}
+
+namespace cpp
+{
+::Dynamic Variant::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16)
+{
+ if (isNull()) Dynamic::ThrowBadFunctionError();
+ return valObject->__Run(Array_obj<Dynamic>::__new(17)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11)->init(12,inArg12)->init(13,inArg13)->init(14,inArg14)->init(15,inArg15)->init(16,inArg16));
+}
+}
+
+
+
+
+Dynamic Dynamic::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17)
+{
+ CheckFPtr();
+ return mPtr->__Run(Array_obj<Dynamic>::__new(18)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11)->init(12,inArg12)->init(13,inArg13)->init(14,inArg14)->init(15,inArg15)->init(16,inArg16)->init(17,inArg17));
+}
+
+namespace cpp
+{
+::Dynamic Variant::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17)
+{
+ if (isNull()) Dynamic::ThrowBadFunctionError();
+ return valObject->__Run(Array_obj<Dynamic>::__new(18)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11)->init(12,inArg12)->init(13,inArg13)->init(14,inArg14)->init(15,inArg15)->init(16,inArg16)->init(17,inArg17));
+}
+}
+
+
+
+
+Dynamic Dynamic::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18)
+{
+ CheckFPtr();
+ return mPtr->__Run(Array_obj<Dynamic>::__new(19)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11)->init(12,inArg12)->init(13,inArg13)->init(14,inArg14)->init(15,inArg15)->init(16,inArg16)->init(17,inArg17)->init(18,inArg18));
+}
+
+namespace cpp
+{
+::Dynamic Variant::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18)
+{
+ if (isNull()) Dynamic::ThrowBadFunctionError();
+ return valObject->__Run(Array_obj<Dynamic>::__new(19)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11)->init(12,inArg12)->init(13,inArg13)->init(14,inArg14)->init(15,inArg15)->init(16,inArg16)->init(17,inArg17)->init(18,inArg18));
+}
+}
+
+
+
+
+Dynamic Dynamic::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19)
+{
+ CheckFPtr();
+ return mPtr->__Run(Array_obj<Dynamic>::__new(20)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11)->init(12,inArg12)->init(13,inArg13)->init(14,inArg14)->init(15,inArg15)->init(16,inArg16)->init(17,inArg17)->init(18,inArg18)->init(19,inArg19));
+}
+
+namespace cpp
+{
+::Dynamic Variant::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19)
+{
+ if (isNull()) Dynamic::ThrowBadFunctionError();
+ return valObject->__Run(Array_obj<Dynamic>::__new(20)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11)->init(12,inArg12)->init(13,inArg13)->init(14,inArg14)->init(15,inArg15)->init(16,inArg16)->init(17,inArg17)->init(18,inArg18)->init(19,inArg19));
+}
+}
+
+
+
+
+Dynamic Dynamic::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20)
+{
+ CheckFPtr();
+ return mPtr->__Run(Array_obj<Dynamic>::__new(21)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11)->init(12,inArg12)->init(13,inArg13)->init(14,inArg14)->init(15,inArg15)->init(16,inArg16)->init(17,inArg17)->init(18,inArg18)->init(19,inArg19)->init(20,inArg20));
+}
+
+namespace cpp
+{
+::Dynamic Variant::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20)
+{
+ if (isNull()) Dynamic::ThrowBadFunctionError();
+ return valObject->__Run(Array_obj<Dynamic>::__new(21)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11)->init(12,inArg12)->init(13,inArg13)->init(14,inArg14)->init(15,inArg15)->init(16,inArg16)->init(17,inArg17)->init(18,inArg18)->init(19,inArg19)->init(20,inArg20));
+}
+}
+
+
+
+
+Dynamic Dynamic::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20,const Dynamic &inArg21)
+{
+ CheckFPtr();
+ return mPtr->__Run(Array_obj<Dynamic>::__new(22)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11)->init(12,inArg12)->init(13,inArg13)->init(14,inArg14)->init(15,inArg15)->init(16,inArg16)->init(17,inArg17)->init(18,inArg18)->init(19,inArg19)->init(20,inArg20)->init(21,inArg21));
+}
+
+namespace cpp
+{
+::Dynamic Variant::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20,const Dynamic &inArg21)
+{
+ if (isNull()) Dynamic::ThrowBadFunctionError();
+ return valObject->__Run(Array_obj<Dynamic>::__new(22)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11)->init(12,inArg12)->init(13,inArg13)->init(14,inArg14)->init(15,inArg15)->init(16,inArg16)->init(17,inArg17)->init(18,inArg18)->init(19,inArg19)->init(20,inArg20)->init(21,inArg21));
+}
+}
+
+
+
+
+Dynamic Dynamic::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20,const Dynamic &inArg21,const Dynamic &inArg22)
+{
+ CheckFPtr();
+ return mPtr->__Run(Array_obj<Dynamic>::__new(23)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11)->init(12,inArg12)->init(13,inArg13)->init(14,inArg14)->init(15,inArg15)->init(16,inArg16)->init(17,inArg17)->init(18,inArg18)->init(19,inArg19)->init(20,inArg20)->init(21,inArg21)->init(22,inArg22));
+}
+
+namespace cpp
+{
+::Dynamic Variant::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20,const Dynamic &inArg21,const Dynamic &inArg22)
+{
+ if (isNull()) Dynamic::ThrowBadFunctionError();
+ return valObject->__Run(Array_obj<Dynamic>::__new(23)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11)->init(12,inArg12)->init(13,inArg13)->init(14,inArg14)->init(15,inArg15)->init(16,inArg16)->init(17,inArg17)->init(18,inArg18)->init(19,inArg19)->init(20,inArg20)->init(21,inArg21)->init(22,inArg22));
+}
+}
+
+
+
+
+Dynamic Dynamic::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20,const Dynamic &inArg21,const Dynamic &inArg22,const Dynamic &inArg23)
+{
+ CheckFPtr();
+ return mPtr->__Run(Array_obj<Dynamic>::__new(24)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11)->init(12,inArg12)->init(13,inArg13)->init(14,inArg14)->init(15,inArg15)->init(16,inArg16)->init(17,inArg17)->init(18,inArg18)->init(19,inArg19)->init(20,inArg20)->init(21,inArg21)->init(22,inArg22)->init(23,inArg23));
+}
+
+namespace cpp
+{
+::Dynamic Variant::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20,const Dynamic &inArg21,const Dynamic &inArg22,const Dynamic &inArg23)
+{
+ if (isNull()) Dynamic::ThrowBadFunctionError();
+ return valObject->__Run(Array_obj<Dynamic>::__new(24)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11)->init(12,inArg12)->init(13,inArg13)->init(14,inArg14)->init(15,inArg15)->init(16,inArg16)->init(17,inArg17)->init(18,inArg18)->init(19,inArg19)->init(20,inArg20)->init(21,inArg21)->init(22,inArg22)->init(23,inArg23));
+}
+}
+
+
+
+
+Dynamic Dynamic::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20,const Dynamic &inArg21,const Dynamic &inArg22,const Dynamic &inArg23,const Dynamic &inArg24)
+{
+ CheckFPtr();
+ return mPtr->__Run(Array_obj<Dynamic>::__new(25)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11)->init(12,inArg12)->init(13,inArg13)->init(14,inArg14)->init(15,inArg15)->init(16,inArg16)->init(17,inArg17)->init(18,inArg18)->init(19,inArg19)->init(20,inArg20)->init(21,inArg21)->init(22,inArg22)->init(23,inArg23)->init(24,inArg24));
+}
+
+namespace cpp
+{
+::Dynamic Variant::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20,const Dynamic &inArg21,const Dynamic &inArg22,const Dynamic &inArg23,const Dynamic &inArg24)
+{
+ if (isNull()) Dynamic::ThrowBadFunctionError();
+ return valObject->__Run(Array_obj<Dynamic>::__new(25)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11)->init(12,inArg12)->init(13,inArg13)->init(14,inArg14)->init(15,inArg15)->init(16,inArg16)->init(17,inArg17)->init(18,inArg18)->init(19,inArg19)->init(20,inArg20)->init(21,inArg21)->init(22,inArg22)->init(23,inArg23)->init(24,inArg24));
+}
+}
+
+
+
+
+Dynamic Dynamic::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20,const Dynamic &inArg21,const Dynamic &inArg22,const Dynamic &inArg23,const Dynamic &inArg24,const Dynamic &inArg25)
+{
+ CheckFPtr();
+ return mPtr->__Run(Array_obj<Dynamic>::__new(26)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11)->init(12,inArg12)->init(13,inArg13)->init(14,inArg14)->init(15,inArg15)->init(16,inArg16)->init(17,inArg17)->init(18,inArg18)->init(19,inArg19)->init(20,inArg20)->init(21,inArg21)->init(22,inArg22)->init(23,inArg23)->init(24,inArg24)->init(25,inArg25));
+}
+
+namespace cpp
+{
+::Dynamic Variant::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20,const Dynamic &inArg21,const Dynamic &inArg22,const Dynamic &inArg23,const Dynamic &inArg24,const Dynamic &inArg25)
+{
+ if (isNull()) Dynamic::ThrowBadFunctionError();
+ return valObject->__Run(Array_obj<Dynamic>::__new(26)->init(0,inArg0)->init(1,inArg1)->init(2,inArg2)->init(3,inArg3)->init(4,inArg4)->init(5,inArg5)->init(6,inArg6)->init(7,inArg7)->init(8,inArg8)->init(9,inArg9)->init(10,inArg10)->init(11,inArg11)->init(12,inArg12)->init(13,inArg13)->init(14,inArg14)->init(15,inArg15)->init(16,inArg16)->init(17,inArg17)->init(18,inArg18)->init(19,inArg19)->init(20,inArg20)->init(21,inArg21)->init(22,inArg22)->init(23,inArg23)->init(24,inArg24)->init(25,inArg25));
+}
+}
+
+
+
+
+
+namespace hx
+{
+
+
+struct CMemberFunctionVar : public hx::Object
+{
+ hx::ObjectPtr<Object> mThis;
+ MemberFunctionVar mFunction;
+ const char *mName;
+ int N;
+
+
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdCMemberVar };
+
+
+ CMemberFunctionVar(const char *inName,hx::Object *inObj, MemberFunctionVar inFunction,int inN)
+ {
+ mThis = inObj;
+ mFunction = inFunction;
+ mName = inName;
+ N = inN;
+ }
+ int __Compare(const hx::Object *inRHS) const
+ {
+ const CMemberFunctionVar *other = dynamic_cast<const CMemberFunctionVar *>(inRHS);
+ if (!other)
+ return -1;
+ return (mFunction==other->mFunction && mName==other->mName && mThis.GetPtr()==other->mThis.GetPtr())? 0 : -1;
+ }
+
+
+ int __GetType() const { return vtFunction; }
+ int __ArgCount() const { return N; }
+ ::String __ToString() const{ return String(mName); }
+ void __Mark(hx::MarkContext *__inCtx) { HX_MARK_MEMBER_NAME(mThis,"CMemberFunctionVar.this"); }
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx) { HX_VISIT_MEMBER(mThis); }
+ #endif
+ void *__GetHandle() const { return mThis.GetPtr(); }
+ Dynamic __Run(const Array<Dynamic> &inArgs)
+ {
+ return mFunction(mThis.GetPtr(), inArgs);
+ }
+};
+
+
+
+struct CStaticFunctionVar : public hx::Object
+{
+ StaticFunctionVar mFunction;
+ const char *mName;
+ int N;
+
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdCStaticVar };
+
+ CStaticFunctionVar(const char *inName,StaticFunctionVar inFunction,int inN)
+ {
+ mFunction = inFunction;
+ mName = inName;
+ N = inN;
+ }
+ int __Compare(const hx::Object *inRHS) const
+ {
+ const CStaticFunctionVar *other = dynamic_cast<const CStaticFunctionVar *>(inRHS);
+ if (!other)
+ return -1;
+ return mName==other->mName && mFunction==other->mFunction ? 0 : -1;
+ }
+
+
+ int __GetType() const { return vtFunction; }
+ int __ArgCount() const { return N; }
+ ::String __ToString() const { return String(mName); }
+ Dynamic __Run(const Array<Dynamic> &inArgs)
+ {
+ return mFunction(inArgs);
+ }
+};
+
+
+Dynamic CreateMemberFunctionVar(const char *inName, hx::Object *inObj, MemberFunctionVar inFunc,int inN)
+ { return new CMemberFunctionVar(inName, inObj,inFunc,inN); }
+
+Dynamic CreateStaticFunctionVar(const char *inName,StaticFunctionVar inFunc,int inN)
+ { return new CStaticFunctionVar(inName, inFunc,inN); }
+
+}
+
+
diff --git a/Sources/c_snikket/iinclude/hx/DynamicImpl.tpl b/Sources/c_snikket/iinclude/hx/DynamicImpl.tpl
new file mode 100644
index 0000000..ae0e380
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/DynamicImpl.tpl
@@ -0,0 +1,210 @@
+
+::foreach PARAMS:: ::if (ARG>=6)::
+Dynamic Dynamic::NS::operator()(::DYNAMIC_ARG_LIST::)
+{
+ CheckFPtr();
+ return mPtr->__Run(Array_obj<Dynamic>::NS::__new(::ARG::)::DYNAMIC_ADDS::);
+}
+
+namespace cpp
+{
+::NS::Dynamic Variant::NS::operator()(::DYNAMIC_ARG_LIST::)
+{
+ if (isNull()) Dynamic::ThrowBadFunctionError();
+ return valObject->__Run(Array_obj<Dynamic>::NS::__new(::ARG::)::DYNAMIC_ADDS::);
+}
+}
+
+
+::else::
+
+namespace hx {
+
+struct CMemberFunction::ARG:: : public hx::Object
+{
+ hx::ObjectPtr<Object> mThis;
+ MemberFunction::ARG:: mFunction;
+ const char *mName;
+
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::NS::clsIdCMember::ARG:: };
+
+
+ CMemberFunction::ARG::(const char *inName, hx::Object *inObj, MemberFunction::ARG:: inFunction)
+ {
+ mName = inName;
+ mThis = inObj;
+ mFunction = inFunction;
+ }
+ int __Compare(const hx::Object *inRHS) const
+ {
+ const CMemberFunction::ARG:: *other = dynamic_cast<const CMemberFunction::ARG:: *>(inRHS);
+ if (!other)
+ return -1;
+ return (mName==other->mName && mFunction==other->mFunction && mThis.GetPtr()==other->mThis.GetPtr())? 0 : -1;
+ }
+
+ int __GetType() const { return vtFunction; }
+ int __ArgCount() const { return ::ARG::; }
+ ::String __ToString() const{ return String(mName); }
+ void __Mark(hx::MarkContext *__inCtx) { HX_MARK_MEMBER_NAME(mThis,"CMemberFunction::ARG::.this"); }
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx) { HX_VISIT_MEMBER(mThis); }
+ #endif
+ void *__GetHandle() const { return mThis.GetPtr(); }
+ Dynamic __Run(const Array<Dynamic> &inArgs)
+ {
+ ::if (ARG>0)::
+ return mFunction(mThis.GetPtr(), ::ARR_LIST::);
+ ::else::
+ return mFunction(mThis.GetPtr());
+ ::end::
+ }
+ Dynamic __run(::DYNAMIC_ARG_LIST::)
+ {
+ ::if (ARG>0)::
+ return mFunction(mThis.GetPtr(), ::ARG_LIST::);
+ ::else::
+ return mFunction(mThis.GetPtr());
+ ::end::
+ }
+};
+
+
+
+struct CStaticFunction::ARG:: : public hx::Object
+{
+ StaticFunction::ARG:: mFunction;
+ const char *mName;
+
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::NS::clsIdCStatic::ARG:: };
+
+
+ CStaticFunction::ARG::(const char *inName,StaticFunction::ARG:: inFunction)
+ {
+ mName = inName;
+ mFunction = inFunction;
+ }
+ int __Compare(const hx::Object *inRHS) const
+ {
+ const CStaticFunction::ARG:: *other = dynamic_cast<const CStaticFunction::ARG:: *>(inRHS);
+ if (!other)
+ return -1;
+ return mName==other->mName && mFunction==other->mFunction && mName==other->mName ? 0 : -1;
+ }
+
+ int __GetType() const { return vtFunction; }
+ int __ArgCount() const { return ::ARG::; }
+ ::String __ToString() const{ return String(mName); }
+ Dynamic __Run(const Array<Dynamic> &inArgs)
+ {
+ return mFunction(::ARR_LIST::);
+ }
+ Dynamic __run(::DYNAMIC_ARG_LIST::)
+ {
+ return mFunction(::ARG_LIST::);
+ }
+};
+
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic CreateMemberFunction::ARG::(const char *inName,hx::Object *inObj, MemberFunction::ARG:: inFunc)
+ { return new CMemberFunction::ARG::(inName,inObj,inFunc); }
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+Dynamic CreateStaticFunction::ARG::(const char *inName,StaticFunction::ARG:: inFunc)
+ { return new CStaticFunction::ARG::(inName,inFunc); }
+
+}
+
+::end::
+::end::
+
+namespace hx
+{
+
+
+struct CMemberFunctionVar : public hx::Object
+{
+ hx::ObjectPtr<Object> mThis;
+ MemberFunctionVar mFunction;
+ const char *mName;
+ int N;
+
+
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdCMemberVar };
+
+
+ CMemberFunctionVar(const char *inName,hx::Object *inObj, MemberFunctionVar inFunction,int inN)
+ {
+ mThis = inObj;
+ mFunction = inFunction;
+ mName = inName;
+ N = inN;
+ }
+ int __Compare(const hx::Object *inRHS) const
+ {
+ const CMemberFunctionVar *other = dynamic_cast<const CMemberFunctionVar *>(inRHS);
+ if (!other)
+ return -1;
+ return (mFunction==other->mFunction && mName==other->mName && mThis.GetPtr()==other->mThis.GetPtr())? 0 : -1;
+ }
+
+
+ int __GetType() const { return vtFunction; }
+ int __ArgCount() const { return N; }
+ ::String __ToString() const{ return String(mName); }
+ void __Mark(hx::MarkContext *__inCtx) { HX_MARK_MEMBER_NAME(mThis,"CMemberFunctionVar.this"); }
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx) { HX_VISIT_MEMBER(mThis); }
+ #endif
+ void *__GetHandle() const { return mThis.GetPtr(); }
+ Dynamic __Run(const Array<Dynamic> &inArgs)
+ {
+ return mFunction(mThis.GetPtr(), inArgs);
+ }
+};
+
+
+
+struct CStaticFunctionVar : public hx::Object
+{
+ StaticFunctionVar mFunction;
+ const char *mName;
+ int N;
+
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdCStaticVar };
+
+ CStaticFunctionVar(const char *inName,StaticFunctionVar inFunction,int inN)
+ {
+ mFunction = inFunction;
+ mName = inName;
+ N = inN;
+ }
+ int __Compare(const hx::Object *inRHS) const
+ {
+ const CStaticFunctionVar *other = dynamic_cast<const CStaticFunctionVar *>(inRHS);
+ if (!other)
+ return -1;
+ return mName==other->mName && mFunction==other->mFunction ? 0 : -1;
+ }
+
+
+ int __GetType() const { return vtFunction; }
+ int __ArgCount() const { return N; }
+ ::String __ToString() const { return String(mName); }
+ Dynamic __Run(const Array<Dynamic> &inArgs)
+ {
+ return mFunction(inArgs);
+ }
+};
+
+
+Dynamic CreateMemberFunctionVar(const char *inName, hx::Object *inObj, MemberFunctionVar inFunc,int inN)
+ { return new CMemberFunctionVar(inName, inObj,inFunc,inN); }
+
+Dynamic CreateStaticFunctionVar(const char *inName,StaticFunctionVar inFunc,int inN)
+ { return new CStaticFunctionVar(inName, inFunc,inN); }
+
+}
+
+
diff --git a/Sources/c_snikket/iinclude/hx/ErrorCodes.h b/Sources/c_snikket/iinclude/hx/ErrorCodes.h
new file mode 100644
index 0000000..fd7ca45
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/ErrorCodes.h
@@ -0,0 +1,27 @@
+#ifndef HX_ERROR_CODES
+#define HX_ERROR_CODES
+
+// --- Exteral constants, used inline
+#define HX_INVALID_CAST Dynamic(HX_CSTRING("Invalid Cast"))
+#define HX_INVALID_INTERFACE Dynamic(HX_CSTRING("Object does not implement interface"))
+#define HX_INDEX_OUT_OF_BOUNDS Dynamic(HX_CSTRING("Index Out of Bounds"))
+#define HX_INVALID_CONSTRUCTOR Dynamic(HX_CSTRING("Invalid constructor"))
+#define HX_INVALID_ENUM_CONSTRUCTOR(_enum_name, _constructor_name) \
+ Dynamic(HX_CSTRING("Invalid enum constructor for ") + \
+ HX_CSTRING(_enum_name) + \
+ HX_CSTRING(": ") + \
+ _constructor_name)
+#define HX_INVALID_OBJECT Dynamic(HX_CSTRING("Invalid object"))
+#define HX_INVALID_ARG_COUNT Dynamic(HX_CSTRING("Invalid Arg Count"))
+#define HX_NULL_FUNCTION_POINTER Dynamic(HX_CSTRING("Null Function Pointer"))
+#define HX_INVALID_ENUM_ARG_COUNT(_enum_name, _constructor_name, _count, _expected) \
+ Dynamic(HX_CSTRING("Invalid enum arg count for ") + \
+ HX_CSTRING(_enum_name) + \
+ HX_CSTRING(".") + \
+ _constructor_name + \
+ HX_CSTRING(": expected ") + \
+ ::String(_expected) + \
+ HX_CSTRING(", got ") + \
+ ::String(_count))
+
+#endif
diff --git a/Sources/c_snikket/iinclude/hx/FieldRef.h b/Sources/c_snikket/iinclude/hx/FieldRef.h
new file mode 100644
index 0000000..3ba1fdc
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/FieldRef.h
@@ -0,0 +1,302 @@
+#ifndef HX_FIELD_REF_H
+#define HX_FIELD_REF_H
+
+namespace hx
+{
+
+// --- FieldRef ----------------------------------------------------------
+//
+// This is used to provide syntaxe for setting fields by name. This is because
+// the field can't be returned by reference, because it may not exist as a dynamic.
+//
+// eg, consider class 'A' with variable 'x':
+// class A { int x; }
+//
+// And you have a Dynamic pointing to it:
+// Dynamic d = new A; Then you access x by name:
+// d->__Field("x") = 1;
+//
+// __Field can't return a Dynamic & because x is a int, not Dynamic. So I use this class.
+// Note that this may change if I fix the generator to create __SetField("x",1) directly.
+
+
+#define HX_FIELD_REF_MEM_OP(op,ret) \
+inline ret operator op (const FieldRef &inA) \
+ { return this->operator Dynamic() op inA.operator Dynamic(); } \
+inline ret operator op (const IndexRef &inA); \
+template<typename T> inline ret operator op (const T& inA) \
+ { return this->operator Dynamic() op inA; }
+
+#define HX_FIELD_REF_IMPL_MEM_OP(op,ret) \
+inline ret hx::FieldRef::operator op (const IndexRef &inA) \
+ { return this->operator Dynamic() op inA.operator Dynamic(); } \
+
+class FieldRef
+{
+public:
+ explicit FieldRef(hx::Object *inObj,const String &inName) : mObject(inObj), mName(inName)
+ {
+ }
+
+ hx::Val operator=(const hx::Val &inRHS)
+ {
+ return mObject->__SetField(mName,inRHS, HX_PROP_DYNAMIC );
+ }
+ inline operator hx::Val() const { return mObject ? mObject->__Field(mName, HX_PROP_DYNAMIC) : null(); }
+ inline operator Dynamic() const { return mObject ? Dynamic(mObject->__Field(mName, HX_PROP_DYNAMIC)) : null(); }
+ inline operator double() const { return mObject->__Field(mName, HX_PROP_DYNAMIC); }
+ inline operator float() const { return mObject->__Field(mName, HX_PROP_DYNAMIC); }
+ inline operator int() const { return mObject->__Field(mName, HX_PROP_DYNAMIC); }
+ inline operator cpp::UInt64() const { return mObject->__Field(mName, HX_PROP_DYNAMIC); }
+ inline operator cpp::Int64() const { return mObject->__Field(mName, HX_PROP_DYNAMIC); }
+
+
+ // post-increment
+ inline double operator++(int)
+ {
+ double d = mObject->__Field(mName, HX_PROP_DYNAMIC);
+ mObject->__SetField(mName,d+1, HX_PROP_DYNAMIC);
+ return d;
+ }
+ // pre-increment
+ inline double operator++()
+ {
+ double d = ((double)mObject->__Field(mName, HX_PROP_DYNAMIC)) + 1;
+ mObject->__SetField(mName,d, HX_PROP_DYNAMIC);
+ return d;
+ }
+ // post-decrement
+ inline double operator--(int)
+ {
+ double d = mObject->__Field(mName, HX_PROP_DYNAMIC);
+ mObject->__SetField(mName,d-1, HX_PROP_DYNAMIC);
+ return d;
+ }
+ // pre-decrement
+ inline double operator--()
+ {
+ double d = (double)(mObject->__Field(mName, HX_PROP_DYNAMIC)) - 1;
+ mObject->__SetField(mName,d, HX_PROP_DYNAMIC);
+ return d;
+ }
+ bool operator !() { return ! ((int)(mObject->__Field(mName, HX_PROP_DYNAMIC))); }
+ int operator ~() { return ~ ((int)mObject->__Field(mName, HX_PROP_DYNAMIC)); }
+
+ inline bool operator==(const null &) const { return !mObject; }
+ inline bool operator!=(const null &) const { return mObject; }
+
+ double operator -() { return - (double)(mObject->__Field(mName, HX_PROP_DYNAMIC)); }
+
+ bool HasPointer() const { return mObject; }
+
+
+ HX_FIELD_REF_MEM_OP(==,bool)
+ HX_FIELD_REF_MEM_OP(!=,bool)
+ HX_FIELD_REF_MEM_OP(<,bool)
+ HX_FIELD_REF_MEM_OP(<=,bool)
+ HX_FIELD_REF_MEM_OP(>,bool)
+ HX_FIELD_REF_MEM_OP(>=,bool)
+
+ HX_FIELD_REF_MEM_OP(+,Dynamic)
+ HX_FIELD_REF_MEM_OP(*,double)
+ HX_FIELD_REF_MEM_OP(/,double)
+ HX_FIELD_REF_MEM_OP(-,double)
+ HX_FIELD_REF_MEM_OP(%,double)
+
+
+
+ String mName;
+ hx::Object *mObject;
+};
+
+// We can define this one now...
+template<typename T>
+inline FieldRef ObjectPtr<T>::FieldRef(const String &inString)
+{
+ return hx::FieldRef(mPtr,inString);
+}
+
+#define HX_FIELD_REF_OP(op,ret) \
+template<typename T> inline ret operator op (T &inT, const FieldRef &inA) \
+ { return inT op ( inA.operator Dynamic()); }
+
+HX_FIELD_REF_OP(==,bool)
+HX_FIELD_REF_OP(!=,bool)
+HX_FIELD_REF_OP(<,bool)
+HX_FIELD_REF_OP(<=,bool)
+HX_FIELD_REF_OP(>,bool)
+HX_FIELD_REF_OP(>=,bool)
+
+HX_FIELD_REF_OP(+,Dynamic)
+HX_FIELD_REF_OP(*,double)
+HX_FIELD_REF_OP(/,double)
+HX_FIELD_REF_OP(-,double)
+HX_FIELD_REF_OP(%,double)
+
+
+
+// --- IndexRef --------------------------------------------------------------
+//
+// Like FieldRef, but for integer array access
+//
+
+#define HX_INDEX_REF_MEM_OP(op,ret) \
+inline ret operator op (const IndexRef &inA) \
+ { return this->operator Dynamic() op inA.operator Dynamic(); } \
+inline ret operator op (const FieldRef &inA) \
+ { return this->operator Dynamic() op inA.operator Dynamic(); } \
+template<typename T> inline ret operator op (const T& inA) \
+ { return this->operator Dynamic() op inA; }
+
+
+class IndexRef
+{
+public:
+ explicit IndexRef(hx::Object *inObj,int inIndex) : mObject(inObj), mIndex(inIndex)
+ {
+ }
+
+ Dynamic operator=(const Dynamic &inRHS)
+ {
+ return mObject->__SetItem(mIndex,inRHS);
+ }
+ inline operator Dynamic() const { return mObject->__GetItem(mIndex); }
+ inline operator double() const { return mObject->__GetItem(mIndex); }
+ inline operator int() const { return mObject->__GetItem(mIndex); }
+
+ // post-increment
+ inline double operator++(int)
+ {
+ double d = mObject->__GetItem(mIndex)->__ToDouble();
+ mObject->__SetItem(mIndex,d+1);
+ return d;
+ }
+ // pre-increment
+ inline double operator++()
+ {
+ double d = mObject->__GetItem(mIndex)->__ToDouble() + 1;
+ mObject->__SetItem(mIndex,d);
+ return d;
+ }
+ // post-decrement
+ inline double operator--(int)
+ {
+ double d = mObject->__GetItem(mIndex)->__ToDouble();
+ mObject->__SetItem(mIndex,d-1);
+ return d;
+ }
+ // pre-decrement
+ inline double operator--()
+ {
+ double d = mObject->__GetItem(mIndex)->__ToDouble() - 1;
+ mObject->__SetItem(mIndex,d);
+ return d;
+ }
+ bool operator !() { return ! mObject->__GetItem(mIndex)->__ToInt(); }
+ int operator ~() { return ~ mObject->__GetItem(mIndex)->__ToInt(); }
+ double operator -() { return - mObject->__GetItem(mIndex)->__ToDouble(); }
+
+ inline bool operator==(const null &) const { return !mObject; }
+ inline bool operator!=(const null &) const { return mObject; }
+
+ HX_INDEX_REF_MEM_OP(==,bool)
+ HX_INDEX_REF_MEM_OP(!=,bool)
+ HX_INDEX_REF_MEM_OP(<,bool)
+ HX_INDEX_REF_MEM_OP(<=,bool)
+ HX_INDEX_REF_MEM_OP(>,bool)
+ HX_INDEX_REF_MEM_OP(>=,bool)
+
+ HX_INDEX_REF_MEM_OP(+,Dynamic)
+ HX_INDEX_REF_MEM_OP(*,double)
+ HX_INDEX_REF_MEM_OP(/,double)
+ HX_INDEX_REF_MEM_OP(-,double)
+ HX_INDEX_REF_MEM_OP(%,double)
+
+ bool HasPointer() const { return mObject; }
+
+ int mIndex;
+ hx::Object *mObject;
+};
+
+// We can define this one now...
+template<typename T>
+inline IndexRef ObjectPtr<T>::IndexRef(int inIndex)
+{
+ return hx::IndexRef(mPtr,inIndex);
+}
+
+#define HX_INDEX_REF_OP(op,ret) \
+template<typename T> inline ret operator op (T &inT, const IndexRef &inA) \
+ { return inT op ( inA. operator Dynamic()); }
+
+HX_INDEX_REF_OP(==,bool)
+HX_INDEX_REF_OP(!=,bool)
+HX_INDEX_REF_OP(<,bool)
+HX_INDEX_REF_OP(<=,bool)
+HX_INDEX_REF_OP(>,bool)
+HX_INDEX_REF_OP(>=,bool)
+
+HX_INDEX_REF_OP(+,Dynamic)
+HX_INDEX_REF_OP(*,double)
+HX_INDEX_REF_OP(/,double)
+HX_INDEX_REF_OP(-,double)
+HX_INDEX_REF_OP(%,double)
+
+
+// Implement once IndexRef has been defined.
+HX_FIELD_REF_IMPL_MEM_OP(==,bool)
+HX_FIELD_REF_IMPL_MEM_OP(!=,bool)
+HX_FIELD_REF_IMPL_MEM_OP(<,bool)
+HX_FIELD_REF_IMPL_MEM_OP(<=,bool)
+HX_FIELD_REF_IMPL_MEM_OP(>,bool)
+HX_FIELD_REF_IMPL_MEM_OP(>=,bool)
+
+HX_FIELD_REF_IMPL_MEM_OP(+,Dynamic)
+HX_FIELD_REF_IMPL_MEM_OP(*,double)
+HX_FIELD_REF_IMPL_MEM_OP(/,double)
+HX_FIELD_REF_IMPL_MEM_OP(-,double)
+HX_FIELD_REF_IMPL_MEM_OP(%,double)
+
+// Disambiguate Dynamic operators...
+
+#define HX_INDEX_REF_OP_DYNAMIC(op,ret) \
+inline ret operator op (const Dynamic &inT, const IndexRef &inA) \
+ { return inT op ( inA.operator Dynamic()); }
+
+HX_INDEX_REF_OP_DYNAMIC(==,bool)
+HX_INDEX_REF_OP_DYNAMIC(!=,bool)
+HX_INDEX_REF_OP_DYNAMIC(+,Dynamic)
+HX_INDEX_REF_OP_DYNAMIC(*,double)
+
+
+
+template<typename _OBJ>
+class __TArrayImplRef
+{
+public:
+ _OBJ mObject;
+ int mIndex;
+
+ explicit __TArrayImplRef(_OBJ inObj,int inIndex) : mObject(inObj), mIndex(inIndex) { }
+
+ template<typename _DATA>
+ inline operator _DATA() { return mObject->__get(mIndex); }
+ template<typename _DATA>
+ inline void operator=(_DATA inRHS)
+ {
+ mObject->__set(mIndex,inRHS);
+ }
+};
+
+template<typename _OBJ>
+__TArrayImplRef<_OBJ> __ArrayImplRef(_OBJ inObj, int inIndex)
+{
+ return __TArrayImplRef<_OBJ>(inObj,inIndex);
+}
+
+
+
+} // end namespace hx
+
+
+#endif
diff --git a/Sources/c_snikket/iinclude/hx/Functions.h b/Sources/c_snikket/iinclude/hx/Functions.h
new file mode 100644
index 0000000..a27180e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/Functions.h
@@ -0,0 +1,28 @@
+#ifndef HX_FUNCTIONS_H
+#define HX_FUNCTIONS_H
+#include <hxcpp.h>
+
+namespace hx
+{
+ struct HXCPP_EXTERN_CLASS_ATTRIBUTES LocalFunc : public hx::Object
+ {
+ int __GetType() const { return vtFunction; }
+ inline void DoMarkThis(hx::MarkContext *__inCtx) { }
+#ifdef HXCPP_VISIT_ALLOCS
+ inline void DoVisitThis(hx::VisitContext *__inCtx) { }
+#endif
+ };
+
+ struct HXCPP_EXTERN_CLASS_ATTRIBUTES LocalThisFunc : public LocalFunc
+ {
+ Dynamic __this;
+ void __SetThis(Dynamic inThis) { __this = inThis; }
+ inline void DoMarkThis(hx::MarkContext *__inCtx) { HX_MARK_MEMBER(__this); }
+#ifdef HXCPP_VISIT_ALLOCS
+ inline void DoVisitThis(hx::VisitContext *__inCtx) { HX_VISIT_MEMBER(__this); }
+#endif
+ };
+
+}
+
+#endif
diff --git a/Sources/c_snikket/iinclude/hx/GC.h b/Sources/c_snikket/iinclude/hx/GC.h
new file mode 100644
index 0000000..95b65c2
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/GC.h
@@ -0,0 +1,594 @@
+#ifndef HX_GC_H
+#define HX_GC_H
+
+#include <hx/Tls.h>
+#include <stdio.h>
+
+// Under the current scheme (as defined by HX_HCSTRING/HX_CSTRING in hxcpp.h)
+// each constant string data is prepended with a 4-byte header that says the string
+// is constant (ie, not part of GC) and whether there is(not) a pre-computed hash at
+// the end of the data.
+// When HX_SMART_STRINGS is active, a bit says whether it is char16_t encoded.
+
+#define HX_GC_CONST_ALLOC_BIT 0x80000000
+#define HX_GC_CONST_ALLOC_MARK_BIT 0x80
+
+
+
+
+// Tell compiler the extra functions are supported
+#define HXCPP_GC_FUNCTIONS_1
+
+// Function called by the haxe code...
+
+#ifdef HXCPP_TELEMETRY
+extern void __hxt_gc_new(hx::StackContext *inStack, void* obj, int inSize, const char *inName);
+extern void __hxt_gc_alloc(void* obj, int inSize);
+extern void __hxt_gc_free_large(void* obj);
+#endif
+
+
+// Helpers for debugging code
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __hxcpp_reachable(hx::Object *inKeep);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __hxcpp_enable(bool inEnable);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __hxcpp_collect(bool inMajor=true);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __hxcpp_gc_compact();
+HXCPP_EXTERN_CLASS_ATTRIBUTES int __hxcpp_gc_trace(hx::Class inClass, bool inPrint);
+HXCPP_EXTERN_CLASS_ATTRIBUTES int __hxcpp_gc_used_bytes();
+HXCPP_EXTERN_CLASS_ATTRIBUTES double __hxcpp_gc_mem_info(int inWhat);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __hxcpp_enter_gc_free_zone();
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __hxcpp_exit_gc_free_zone();
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __hxcpp_gc_safe_point();
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __hxcpp_spam_collects(int inEveryNCalls);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __hxcpp_set_minimum_working_memory(int inBytes);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __hxcpp_set_minimum_free_space(int inBytes);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __hxcpp_set_target_free_space_percentage(int inPercentage);
+HXCPP_EXTERN_CLASS_ATTRIBUTES bool __hxcpp_is_const_string(const ::String &inString);
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic _hx_gc_freeze(Dynamic inObject);
+
+typedef void (hx::Object::*_hx_member_finalizer)(void);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __hxcpp_add_member_finalizer(hx::Object *inObject, _hx_member_finalizer, bool inPin);
+
+typedef void (*_hx_alloc_finalizer)(void *inPtr);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __hxcpp_add_alloc_finalizer(void *inAlloc, _hx_alloc_finalizer, bool inPin);
+
+template<typename T>
+inline void _hx_add_finalizable( hx::ObjectPtr<T> inObj, bool inPin)
+{
+ _hx_member_finalizer finalizer = (_hx_member_finalizer)&T::finalize;
+ __hxcpp_add_member_finalizer(inObj.mPtr, finalizer, inPin);
+}
+template<typename T>
+inline void _hx_add_finalizable( T *inObj, bool inPin)
+{
+ _hx_member_finalizer finalizer = (_hx_member_finalizer)&T::finalize;
+ __hxcpp_add_member_finalizer(inObj, finalizer, inPin);
+}
+
+
+
+template<typename T>
+T _hx_allocate_extended(int inExtra)
+{
+ typedef typename T::Obj Obj;
+ Obj *obj = new (inExtra) Obj();
+ return obj;
+}
+
+/*
+template<typename T>
+inline void _hx_allocate_extended( hx::ObjectPtr<T> inObj, bool inPin)
+*/
+
+
+// Finalizers from haxe code...
+void __hxcpp_gc_do_not_kill(Dynamic inObj);
+
+// This is the correctly typed version - no change of getting function proto wrong
+void _hx_set_finalizer(Dynamic inObj, void (*inFunc)(Dynamic) );
+
+void __hxcpp_set_finalizer(Dynamic inObj, void *inFunction);
+hx::Object *__hxcpp_get_next_zombie();
+
+#ifdef HXCPP_TELEMETRY
+void __hxcpp_set_hxt_finalizer(void* inObj, void *inFunc);
+#endif
+
+hx::Object *__hxcpp_weak_ref_create(Dynamic inObject);
+hx::Object *__hxcpp_weak_ref_get(Dynamic inRef);
+
+
+unsigned int __hxcpp_obj_hash(Dynamic inObj);
+int __hxcpp_obj_id(Dynamic inObj);
+hx::Object *__hxcpp_id_obj(int);
+
+
+
+
+
+
+namespace hx
+{
+// Generic allocation routine.
+// If inSize is small (<4k) it will be allocated from the immix pool.
+// Larger, and it will be allocated from a separate memory pool
+// inIsObject specifies whether "__Mark" should be called on the resulting object
+void *InternalNew(int inSize,bool inIsObject);
+
+// Used internall - realloc array data
+void *InternalRealloc(int inFromSize, void *inData,int inSize,bool inAllowExpansion=false);
+
+void InternalReleaseMem(void *inMem);
+
+unsigned int ObjectSizeSafe(void *inData);
+
+// Const buffers are allocated outside the GC system, and do not require marking
+// String buffers can optionally have a pre-computed hash appended with this method
+void *InternalCreateConstBuffer(const void *inData,int inSize,bool inAddStringHash=false);
+
+// Called after collection by an unspecified thread
+typedef void (*finalizer)(hx::Object *v);
+
+// Used internally by the runtime.
+// The constructor will add this object to the internal list of finalizers.
+// If the parent object is not marked by the end of the collect, the finalizer will trigger.
+struct InternalFinalizer
+{
+ InternalFinalizer(hx::Object *inObj, finalizer inFinalizer=0);
+
+ #ifdef HXCPP_VISIT_ALLOCS
+ void Visit(VisitContext *__inCtx);
+ #endif
+ void Detach();
+
+ bool mValid;
+ finalizer mFinalizer;
+ hx::Object *mObject;
+};
+
+// Attach a finalizer to any object allocation. This can be called from haxe code, but be aware that
+// you can't make any GC calls from the finalizer.
+void GCSetFinalizer( hx::Object *, hx::finalizer f );
+
+// If another thread wants to do a collect, it will signal this variable.
+// This automatically gets checked when you call "new", but if you are in long-running
+// loop with no new call, you might starve another thread if you to not check this.
+// 0xffffffff = pause requested
+extern int gPauseForCollect;
+
+
+// Minimum total memory - used + buffer for new objects
+extern int sgMinimumWorkingMemory;
+
+// Minimum free memory - not counting used memory
+extern int sgMinimumFreeSpace;
+
+// Also ensure that the free memory is larger than this amount of used memory
+extern int sgTargetFreeSpacePercentage;
+
+
+extern HXCPP_EXTERN_CLASS_ATTRIBUTES int gByteMarkID;
+
+// Call in response to a gPauseForCollect. Normally, this is done for you in "new"
+void PauseForCollect();
+
+
+// Used by WeakHash to work out if it needs to dispose its keys
+bool IsWeakRefValid(hx::Object *inPtr);
+bool IsWeakRefValid(const HX_CHAR *inPtr);
+
+// Used by CFFI to scan a block of memory for GC Pointers. May picks up random crap
+// that points to real, active objects.
+void MarkConservative(int *inBottom, int *inTop,hx::MarkContext *__inCtx);
+
+
+// Create/Remove a root.
+// All statics are explicitly registered - this saves adding the whole data segment
+// to the collection list.
+// It takes a pointer-pointer so it can move the contents, and the caller can change the contents
+void GCAddRoot(hx::Object **inRoot);
+void GCRemoveRoot(hx::Object **inRoot);
+
+
+// This is used internally in hxcpp
+// It calls InternalNew, and takes care of null-terminating the result
+char *NewString(int inLen);
+
+// The concept of 'private' is from the old conservative Gc method.
+// Now with explicit marking, these functions do the same thing, which is
+// to allocate some GC memory and optionally copy the 'inData' into those bytes
+HXCPP_EXTERN_CLASS_ATTRIBUTES void *NewGCBytes(void *inData,int inSize);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void *NewGCPrivate(void *inData,int inSize);
+
+// Force a collect from the calling thread
+// Only one thread should call this at a time
+int InternalCollect(bool inMajor,bool inCompact);
+
+
+// Disable the garbage collector. It will try to increase its internal buffers to honour extra requests.
+// If it runs out of memory, it will actually try to do a collect.
+void InternalEnableGC(bool inEnable);
+
+// Record that fact that external memory has been allocated and associated with a haxe object
+// eg. BitmapData. This will help the collector know when to collect
+void GCChangeManagedMemory(int inDelta, const char *inWhy=0);
+
+// Haxe threads can center GC free zones, where they can't make GC allocation calls, and should not mess with GC memory.
+// This means that they do not need to pause while the GC collections happen, and other threads will not
+// wait for them to "check in" before collecting. The standard runtime makes these calls around OS calls, such as "Sleep"
+void EnterGCFreeZone();
+void ExitGCFreeZone();
+// retuns true if ExitGCFreeZone should be called
+bool TryGCFreeZone();
+// retuns true if ExitGCFreeZone was called
+bool TryExitGCFreeZone();
+
+class HXCPP_EXTERN_CLASS_ATTRIBUTES AutoGCFreeZone
+{
+public:
+ AutoGCFreeZone() : locked(true) { EnterGCFreeZone(); }
+ ~AutoGCFreeZone() { if (locked) ExitGCFreeZone(); }
+
+ void close() { if (locked) ExitGCFreeZone(); locked = false; }
+
+ bool locked;
+};
+
+
+// Defined in Class.cpp, these function is called from the Gc to start the marking/visiting
+void MarkClassStatics(hx::MarkContext *__inCtx);
+#ifdef HXCPP_VISIT_ALLOCS
+void VisitClassStatics(hx::VisitContext *__inCtx);
+#endif
+
+
+// Called by haxe/application code to mark allocations.
+// "Object" allocs will recursively call __Mark
+inline void MarkAlloc(void *inPtr ,hx::MarkContext *__inCtx);
+inline void MarkObjectAlloc(hx::Object *inPtr ,hx::MarkContext *__inCtx);
+
+// Implemented differently for efficiency
+void MarkObjectArray(hx::Object **inPtr, int inLength, hx::MarkContext *__inCtx);
+void MarkStringArray(String *inPtr, int inLength, hx::MarkContext *__inCtx);
+
+// Provide extra debug info to the marking routines
+#ifdef HXCPP_DEBUG
+HXCPP_EXTERN_CLASS_ATTRIBUTES void MarkSetMember(const char *inName ,hx::MarkContext *__inCtx);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void MarkPushClass(const char *inName ,hx::MarkContext *__inCtx);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void MarkPopClass(hx::MarkContext *__inCtx);
+#endif
+
+
+// Used by runtime if it is being paranoid about pointers. It checks that the pointer is real and alive at last collect.
+void GCCheckPointer(void *);
+void GCOnNewPointer(void *);
+
+
+// Called internally before and GC operations
+void CommonInitAlloc();
+
+
+// Threading ...
+void RegisterNewThread(void *inTopOfStack);
+void RegisterCurrentThread(void *inTopOfStack);
+void UnregisterCurrentThread();
+void GCPrepareMultiThreaded();
+
+
+
+
+} // end namespace hx
+
+
+// Inline code tied to the immix implementation
+
+namespace hx
+{
+
+#define HX_USE_INLINE_IMMIX_OPERATOR_NEW
+
+//#define HX_STACK_CTX ::hx::ImmixAllocator *_hx_stack_ctx = hx::gMultiThreadMode ? hx::tlsImmixAllocator : hx::gMainThreadAlloc;
+
+
+// Each line ast 128 bytes (2^7)
+#define IMMIX_LINE_BITS 7
+#define IMMIX_LINE_LEN (1<<IMMIX_LINE_BITS)
+
+#define HX_GC_REMEMBERED 0x40
+
+// The size info is stored in the header 8 bits to the right
+#define IMMIX_ALLOC_SIZE_SHIFT 6
+
+// Indicates that __Mark must be called recursively
+#define IMMIX_ALLOC_IS_CONTAINER 0x00800000
+// String is char16_t type
+#define HX_GC_STRING_CHAR16_T 0x00200000
+// String has hash data at end
+#define HX_GC_STRING_HASH 0x00100000
+
+#define HX_GC_STRING_HASH_BIT 0x10
+
+#ifdef HXCPP_BIG_ENDIAN
+ #define HX_GC_STRING_HASH_OFFSET -3
+ #define HX_GC_CONST_ALLOC_MARK_OFFSET -4
+ #define HX_ENDIAN_MARK_ID_BYTE -4
+#else
+ #define HX_GC_STRING_HASH_OFFSET -2
+ #define HX_GC_CONST_ALLOC_MARK_OFFSET -1
+ #define HX_ENDIAN_MARK_ID_BYTE -1
+#endif
+
+
+
+// The gPauseForCollect bits will turn spaceEnd negative, and so force the slow path
+#ifndef HXCPP_SINGLE_THREADED_APP
+ #define WITH_PAUSE_FOR_COLLECT_FLAG | hx::gPauseForCollect
+#else
+ #define WITH_PAUSE_FOR_COLLECT_FLAG
+#endif
+
+
+
+class StackContext;
+
+EXTERN_FAST_TLS_DATA(StackContext, tlsStackContext);
+
+extern StackContext *gMainThreadContext;
+
+extern unsigned int gImmixStartFlag[128];
+extern int gMarkID;
+extern int gMarkIDWithContainer;
+extern void BadImmixAlloc();
+
+
+class ImmixAllocator
+{
+public:
+ virtual ~ImmixAllocator() {}
+ virtual void *CallAlloc(int inSize,unsigned int inObjectFlags) = 0;
+ virtual void SetupStackAndCollect(bool inMajor, bool inForceCompact, bool inLocked=false,bool inFreeIsFragged=false) = 0;
+
+ #ifdef HXCPP_GC_NURSERY
+ unsigned char *spaceFirst;
+ unsigned char *spaceOversize;
+ #else
+ int spaceStart;
+ int spaceEnd;
+ #endif
+ unsigned int *allocStartFlags;
+ unsigned char *allocBase;
+
+
+
+ // These allocate the function using the garbage-colleced malloc
+ inline static void *alloc(ImmixAllocator *alloc, size_t inSize, bool inContainer, const char *inName )
+ {
+ #ifdef HXCPP_GC_NURSERY
+
+ #ifdef HXCPP_ALIGN_ALLOC
+ // make sure buffer is 8-byte aligned
+ unsigned char *buffer = alloc->spaceFirst + ( (size_t)alloc->spaceFirst & 4 );
+ #else
+ unsigned char *buffer = alloc->spaceFirst;
+ #endif
+ unsigned char *end = buffer + (inSize + 4);
+
+ if ( end > alloc->spaceOversize )
+ {
+ // Fall back to external method
+ buffer = (unsigned char *)alloc->CallAlloc(inSize, inContainer ? IMMIX_ALLOC_IS_CONTAINER : 0);
+ }
+ else
+ {
+ alloc->spaceFirst = end;
+
+ if (inContainer)
+ ((unsigned int *)buffer)[-1] = inSize | IMMIX_ALLOC_IS_CONTAINER;
+ else
+ ((unsigned int *)buffer)[-1] = inSize;
+ }
+
+ #if defined(HXCPP_GC_CHECK_POINTER) && defined(HXCPP_GC_DEBUG_ALWAYS_MOVE)
+ hx::GCOnNewPointer(buffer);
+ #endif
+
+ #ifdef HXCPP_TELEMETRY
+ __hxt_gc_new((hx::StackContext *)alloc,buffer, inSize, inName);
+ #endif
+
+ return buffer;
+
+ #else
+ // Inline the fast-path if we can
+ // We know the object can hold a pointer (vtable) and that the size is int-aligned
+ int start = alloc->spaceStart;
+ #ifdef HXCPP_ALIGN_ALLOC
+ // Ensure odd alignment in 8 bytes
+ start += 4 - (start & 4);
+ #endif
+ int end = start + sizeof(int) + inSize;
+
+ if ( end <= alloc->spaceEnd )
+ {
+ alloc->spaceStart = end;
+
+ unsigned int *buffer = (unsigned int *)(alloc->allocBase + start);
+
+ int startRow = start>>IMMIX_LINE_BITS;
+
+ alloc->allocStartFlags[ startRow ] |= gImmixStartFlag[start&127];
+
+ if (inContainer)
+ *buffer++ = (( (end+(IMMIX_LINE_LEN-1))>>IMMIX_LINE_BITS) -startRow) |
+ (inSize<<IMMIX_ALLOC_SIZE_SHIFT) |
+ hx::gMarkIDWithContainer;
+ else
+ *buffer++ = (( (end+(IMMIX_LINE_LEN-1))>>IMMIX_LINE_BITS) -startRow) |
+ (inSize<<IMMIX_ALLOC_SIZE_SHIFT) |
+ hx::gMarkID;
+
+ #if defined(HXCPP_GC_CHECK_POINTER) && defined(HXCPP_GC_DEBUG_ALWAYS_MOVE)
+ hx::GCOnNewPointer(buffer);
+ #endif
+
+ #ifdef HXCPP_TELEMETRY
+ __hxt_gc_alloc(buffer, inSize);
+ __hxt_gc_new((hx::StackContext *)alloc,buffer, inSize, inName);
+ #endif
+ return buffer;
+ }
+
+ // Fall back to external method
+ void *result = alloc->CallAlloc(inSize, inContainer ? IMMIX_ALLOC_IS_CONTAINER : 0);
+
+ #ifdef HXCPP_TELEMETRY
+ __hxt_gc_new((hx::StackContext *)alloc,result, inSize, inName);
+ #endif
+
+ return result;
+ #endif // HXCPP_GC_NURSERY
+ }
+};
+
+typedef ImmixAllocator GcAllocator;
+typedef ImmixAllocator Ctx;
+
+
+#ifdef HXCPP_GC_GENERATIONAL
+ #define HX_OBJ_WB_CTX(obj,value,ctx) { \
+ unsigned char &mark = ((unsigned char *)(obj))[ HX_ENDIAN_MARK_ID_BYTE]; \
+ if (mark == hx::gByteMarkID && value && !((unsigned char *)(value))[ HX_ENDIAN_MARK_ID_BYTE ] ) { \
+ mark|=HX_GC_REMEMBERED; \
+ ctx->pushReferrer(obj); \
+ } }
+ #define HX_OBJ_WB_PESSIMISTIC_CTX(obj,ctx) { \
+ unsigned char &mark = ((unsigned char *)(obj))[ HX_ENDIAN_MARK_ID_BYTE]; \
+ if (mark == hx::gByteMarkID) { \
+ mark|=HX_GC_REMEMBERED; \
+ ctx->pushReferrer(obj); \
+ } }
+ // I'm not sure if this will ever trigger...
+ #define HX_OBJ_WB_NEW_MARKED_OBJECT(obj) { \
+ if (((unsigned char *)(obj))[ HX_ENDIAN_MARK_ID_BYTE]==hx::gByteMarkID) hx::NewMarkedObject(obj); \
+ }
+#else
+ #define HX_OBJ_WB_CTX(obj,value,ctx)
+ #define HX_OBJ_WB_PESSIMISTIC_CTX(obj,ctx)
+ #define HX_OBJ_WB_NEW_MARKED_OBJECT(obj)
+#endif
+
+#define HX_OBJ_WB(obj,value) HX_OBJ_WB_CTX(obj,value,_hx_ctx)
+#define HX_ARRAY_WB(array,index,value) HX_OBJ_WB(array,value)
+#define HX_OBJ_WB_PESSIMISTIC(obj) HX_OBJ_WB_PESSIMISTIC_CTX(obj,_hx_ctx)
+#define HX_OBJ_WB_GET(obj,value) HX_OBJ_WB_CTX(obj,value,HX_CTX_GET)
+#define HX_OBJ_WB_PESSIMISTIC_GET(obj) HX_OBJ_WB_PESSIMISTIC_CTX(obj,HX_CTX_GET)
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES extern unsigned int gPrevMarkIdMask;
+
+// Called only once it is determined that a new mark is required
+HXCPP_EXTERN_CLASS_ATTRIBUTES void MarkAllocUnchecked(void *inPtr ,hx::MarkContext *__inCtx);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void MarkObjectAllocUnchecked(hx::Object *inPtr ,hx::MarkContext *__inCtx);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void NewMarkedObject(hx::Object *inPtr);
+
+inline void MarkAlloc(void *inPtr ,hx::MarkContext *__inCtx)
+{
+ #ifdef EMSCRIPTEN
+ // Unaligned must be constants...
+ if ( !( ((size_t)inPtr) & 3) )
+ #endif
+ // This will also skip const regions
+ if ( !(((unsigned int *)inPtr)[-1] & gPrevMarkIdMask) )
+ MarkAllocUnchecked(inPtr,__inCtx);
+}
+inline void MarkObjectAlloc(hx::Object *inPtr ,hx::MarkContext *__inCtx)
+{
+ #ifdef EMSCRIPTEN
+ // Unaligned must be constants...
+ if ( !( ((size_t)inPtr) & 3) )
+ #endif
+ // This will also skip const regions
+ if ( !(((unsigned int *)inPtr)[-1] & gPrevMarkIdMask) )
+ MarkObjectAllocUnchecked(inPtr,__inCtx);
+}
+
+
+} // end namespace hx
+
+
+
+
+// It was theoretically possible to redefine the MarkContext arg type (or skip it)
+// incase the particular GC scheme did not need it. This may take a bit of extra
+// work to get going again
+
+#define HX_MARK_ARG __inCtx
+//#define HX_MARK_ADD_ARG ,__inCtx
+#define HX_MARK_PARAMS hx::MarkContext *__inCtx
+//#define HX_MARK_ADD_PARAMS ,hx::MarkContext *__inCtx
+
+#ifdef HXCPP_VISIT_ALLOCS
+#define HX_VISIT_ARG __inCtx
+#define HX_VISIT_PARAMS hx::VisitContext *__inCtx
+#else
+#define HX_VISIT_ARG
+#define HX_VISIT_PARAMS
+#endif
+
+
+
+
+
+// These macros add debug to the mark/visit calls if required
+// They also perform some inline checking to avoid function calls if possible
+
+
+#ifdef HXCPP_DEBUG
+
+#define HX_MARK_MEMBER_NAME(x,name) { hx::MarkSetMember(name, __inCtx); hx::MarkMember(x, __inCtx ); }
+#define HX_MARK_BEGIN_CLASS(x) hx::MarkPushClass(#x, __inCtx );
+#define HX_MARK_END_CLASS() hx::MarkPopClass(__inCtx );
+#define HX_MARK_MEMBER(x) { hx::MarkSetMember(0, __inCtx); hx::MarkMember(x, __inCtx ); }
+#define HX_MARK_MEMBER_ARRAY(x,len) { hx::MarkSetMember(0, __inCtx); hx::MarkMemberArray(x, len, __inCtx ); }
+
+#else
+
+#define HX_MARK_MEMBER_NAME(x,name) hx::MarkMember(x, __inCtx )
+#define HX_MARK_BEGIN_CLASS(x)
+#define HX_MARK_END_CLASS()
+#define HX_MARK_MEMBER(x) hx::MarkMember(x, __inCtx )
+#define HX_MARK_MEMBER_ARRAY(x,len) hx::MarkMemberArray(x, len, __inCtx )
+
+#endif
+
+#define HX_MARK_OBJECT(ioPtr) if (ioPtr) hx::MarkObjectAlloc(ioPtr, __inCtx );
+
+
+
+
+#define HX_MARK_STRING(ioPtr) \
+ if (ioPtr) hx::MarkAlloc((void *)ioPtr, __inCtx );
+
+#define HX_MARK_ARRAY(ioPtr) { if (ioPtr) hx::MarkAlloc((void *)ioPtr, __inCtx ); }
+
+
+
+
+#define HX_VISIT_MEMBER_NAME(x,name) hx::VisitMember(x, __inCtx )
+#define HX_VISIT_MEMBER(x) hx::VisitMember(x, __inCtx )
+
+#define HX_VISIT_OBJECT(ioPtr) \
+ { if (ioPtr && !(((unsigned char *)ioPtr)[HX_GC_CONST_ALLOC_MARK_OFFSET] & HX_GC_CONST_ALLOC_MARK_BIT) ) __inCtx->visitObject( (hx::Object **)&ioPtr); }
+
+#define HX_VISIT_STRING(ioPtr) \
+ if (ioPtr && !(((unsigned char *)ioPtr)[HX_GC_CONST_ALLOC_MARK_OFFSET] & HX_GC_CONST_ALLOC_MARK_BIT) ) __inCtx->visitAlloc((void **)&ioPtr);
+
+#define HX_VISIT_ARRAY(ioPtr) { if (ioPtr) __inCtx->visitAlloc((void **)&ioPtr); }
+
+
+
+
+
+
+
+#endif
+
diff --git a/Sources/c_snikket/iinclude/hx/GcTypeInference.h b/Sources/c_snikket/iinclude/hx/GcTypeInference.h
new file mode 100644
index 0000000..b1f186e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/GcTypeInference.h
@@ -0,0 +1,161 @@
+#ifndef HX_GC_TYPE_INFERENCE_H
+#define HX_GC_TYPE_INFERENCE_H
+
+
+// These templates allow you to call MarkMember(x) or VisitMember(x) and the
+// compiler will direct the call to the correct function
+
+namespace hx
+{
+
+
+template<typename T> inline void MarkMember(T &outT,hx::MarkContext *__inCtx) { }
+
+template<typename T> inline void MarkMember(hx::ObjectPtr<T> &outT,hx::MarkContext *__inCtx)
+{
+ HX_MARK_OBJECT(outT.mPtr);
+}
+template<> inline void MarkMember(Dynamic &outT,hx::MarkContext *__inCtx)
+{
+ HX_MARK_OBJECT(outT.mPtr);
+}
+template<typename T> inline void MarkMember(Array<T> &outT,hx::MarkContext *__inCtx)
+{
+ HX_MARK_OBJECT(outT.mPtr);
+}
+template<> inline void MarkMember<hx::Object *>(hx::Object *&outT,hx::MarkContext *__inCtx)
+{
+ HX_MARK_OBJECT(outT);
+}
+template<> inline void MarkMember<cpp::Variant>(cpp::Variant &outT,hx::MarkContext *__inCtx)
+{
+ outT.mark(__inCtx);
+}
+template<typename T> inline void MarkMember(hx::Native<T> &outT,hx::MarkContext *__inCtx)
+{
+ if (outT.ptr)
+ {
+ hx::Object *ptr = outT.ptr->__GetRealObject();
+ HX_MARK_OBJECT(ptr);
+ }
+}
+
+template<> inline void MarkMember<int>(int &outT,hx::MarkContext *__inCtx) { }
+template<> inline void MarkMember<bool>(bool &outT,hx::MarkContext *__inCtx) { }
+template<> inline void MarkMember<double>(double &outT,hx::MarkContext *__inCtx) { }
+template<> inline void MarkMember<float>(float &outT,hx::MarkContext *__inCtx) { }
+template<> inline void MarkMember<String>(String &outT,hx::MarkContext *__inCtx)
+{
+ HX_MARK_STRING(outT.raw_ptr());
+}
+template<> inline void MarkMember<null>(null &outT,hx::MarkContext *__inCtx) { }
+
+
+
+
+template<typename T> inline void MarkMemberArray(T *,int, hx::MarkContext *__inCtx)
+{
+ //*(int *)0=0;
+}
+template<> inline void MarkMemberArray<String>(String *ioStrings,int inLen,hx::MarkContext *__inCtx)
+{
+ hx::MarkStringArray(ioStrings,inLen,__inCtx);
+}
+template<typename T> inline void MarkMemberArray(hx::ObjectPtr<T> *inObjects, int inLen, hx::MarkContext *__inCtx)
+{
+ hx::MarkObjectArray( (hx::Object **)inObjects ,inLen,__inCtx);
+}
+template<> inline void MarkMemberArray(Dynamic *outT,int inLen, hx::MarkContext *__inCtx)
+{
+ hx::MarkObjectArray( (hx::Object **)outT ,inLen,__inCtx);
+}
+template<> inline void MarkMemberArray(hx::Object **outT,int inLen, hx::MarkContext *__inCtx)
+{
+ hx::MarkObjectArray( outT ,inLen,__inCtx);
+}
+template<typename T> inline void MarkMemberArray(Array<T> *outT,int inLen,hx::MarkContext *__inCtx)
+{
+ hx::MarkObjectArray( (hx::Object **)outT ,inLen,__inCtx);
+}
+
+
+
+// Locate potential GC pointer inside member
+inline const void *PointerOf( ::Dynamic &d) { return d.mPtr; }
+inline const void *PointerOf( ::String &s) { return s.raw_ptr(); }
+template<typename T> inline const void *PointerOf( ::Array<T> &a) { return a.mPtr; }
+template<typename T> inline const void *PointerOf( ::hx::ObjectPtr<T> &o) { return o.mPtr; }
+template<typename T> inline const void *PointerOf( ::hx::Native<T> &o)
+{
+ if (o.ptr)
+ return o.ptr->__GetRealObject();
+ return 0;
+}
+
+inline const void *PointerOf(...) { return 0; }
+
+
+#ifdef HXCPP_VISIT_ALLOCS
+template<typename T> inline void VisitMember(T &outT,hx::VisitContext *__inCtx) { }
+
+template<typename T> inline void VisitMember(hx::ObjectPtr<T> &outT,hx::VisitContext *__inCtx)
+{
+ HX_VISIT_OBJECT(outT.mPtr);
+}
+template<> inline void VisitMember(Dynamic &outT,hx::VisitContext *__inCtx)
+{
+ HX_VISIT_OBJECT(outT.mPtr);
+}
+template<> inline void VisitMember<hx::Object *>(hx::Object *&outT,hx::VisitContext *__inCtx)
+{
+ HX_VISIT_OBJECT(outT);
+}
+template<typename T> inline void VisitMember(Array<T> &outT,hx::VisitContext *__inCtx)
+{
+ HX_VISIT_OBJECT(outT.mPtr);
+}
+template<> inline void VisitMember(cpp::Variant &outT,hx::VisitContext *__inCtx)
+{
+ outT.visit(__inCtx);
+}
+template<typename T> inline void VisitMember(hx::Native<T> &outT,hx::VisitContext *__inCtx)
+{
+ if (outT.ptr)
+ {
+ hx::Object *ptr0 = outT.ptr->__GetRealObject();
+ if (ptr0)
+ {
+ hx::Object *ptr1 = ptr0;
+ HX_VISIT_OBJECT(ptr1);
+ size_t delta = ( (char *)ptr1 - (char *)ptr0 );
+ if (delta)
+ outT.ptr = (T)( (char *)outT.ptr + delta );
+ }
+ }
+}
+
+
+template<> inline void VisitMember<int>(int &outT,hx::VisitContext *__inCtx) { }
+template<> inline void VisitMember<bool>(bool &outT,hx::VisitContext *__inCtx) { }
+template<> inline void VisitMember<double>(double &outT,hx::VisitContext *__inCtx) { }
+template<> inline void VisitMember<float>(float &outT,hx::VisitContext *__inCtx) { }
+template<> inline void VisitMember<String>(String &outT,hx::VisitContext *__inCtx)
+{
+ HX_VISIT_STRING(outT.raw_ref());
+}
+template<> inline void VisitMember<null>(null &outT,hx::VisitContext *__inCtx) { }
+#endif
+
+
+
+// Template used to register and initialise the statics in the one call.
+// Do nothing...
+template<typename T> inline T &Static(T &t) { return t; }
+
+
+} // end namespace hx
+
+
+
+
+#endif
diff --git a/Sources/c_snikket/iinclude/hx/GenMacro.hx b/Sources/c_snikket/iinclude/hx/GenMacro.hx
new file mode 100644
index 0000000..17e21f0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/GenMacro.hx
@@ -0,0 +1,135 @@
+/*
+ This file is used to generate Macros.h and DynamicImpl.h.
+ To change the number of "fast" args, you will also need to change numbers in the tpl files.
+ Usage: haxe -x GenMacro.hx
+*/
+
+import haxe.Template;
+#if haxe3
+import sys.io.File;
+import sys.io.FileOutput;
+#else
+import neko.io.File;
+import neko.io.FileOutput;
+#end
+
+class GenMacro
+{
+ static var warning =
+ "// ## ## ## ## #### ## ## ## ## ## #### ##\n" +
+ "// ## ## ## ## ## ## ## ### ## ## ### ## ## ##\n" +
+ "// ## ## ## ###### ###### ###### ## ###### ## ### ##\n" +
+ "// ## ## ## ## ## ## ## ## ### ## ## ### ## ## \n" +
+ "// ## ## ## ## ## ## ## ## ## ## ## #### ##\n\n" +
+ "// DO NOT EDIT\n// This file is generated from the .tpl file\n";
+
+ public function new()
+ {
+ var context = { };
+ var params = new Array<Dynamic>();
+ var arr_list = new Array<String>();
+ var arg_list = new Array<String>();
+ var dynamic_arg_list = new Array<String>();
+ var dynamic_in_args = new Array<String>();
+ var dynamic_var_args = new Array<String>();
+ var dynamic_adds = new Array<String>();
+
+ for(arg in 0...27)
+ {
+ if (arg>0)
+ {
+ arr_list.push( "inArgs[" + (arg-1) + "]");
+ arg_list.push( "inArg" + (arg-1));
+ dynamic_arg_list.push("const Dynamic &inArg" + (arg-1) );
+ dynamic_adds.push( "->init(" + (arg-1) + ",inArg" + (arg-1) + ")" );
+ }
+
+ params.push( {
+ ARG : arg,
+ ARR_LIST : arr_list.join(","),
+ DYNAMIC_ARG_LIST : dynamic_arg_list.join(","),
+ ARG_LIST : arg_list.join(","),
+ DYNAMIC_ADDS : dynamic_adds.join("")
+ } );
+ }
+
+ var locals = new Array<Dynamic>();
+ var jumboLocals = new Array<Dynamic>();
+ var marks = new Array<String>();
+ var visits = new Array<String>();
+ var type_vars = new Array<String>();
+ var type_args = new Array<String>();
+ var construct_args = new Array<String>();
+ var construct_vars = new Array<String>();
+ for(arg in 1...62)
+ {
+ var vid = arg-1;
+ if (vid>=0)
+ {
+ marks.push( "HX_MARK_MEMBER(v" + vid +");" );
+ visits.push( "HX_VISIT_MEMBER(v" + vid +");" );
+ type_args.push( "t" + vid +",v" + vid );
+ type_vars.push( "t" + vid +" v" + vid );
+ construct_args.push( "t" + vid +" __" + vid );
+ construct_vars.push( "v" + vid +"(__" + vid + ")" );
+ }
+
+ var local = {
+ ARG : arg,
+ MARKS : marks.join(" "),
+ VISITS : visits.join(" "),
+ TYPE_VARS : type_vars.join(","),
+ TYPE_ARGS : type_args.join(","),
+ TYPE_DECL : type_vars.join(";"),
+ CONSTRUCT_VARS : construct_vars.join(","),
+ CONSTRUCT_ARGS : construct_args.join(",")
+ };
+ if (arg<20)
+ locals.push(local);
+ else
+ jumboLocals.push(local);
+ }
+
+ Reflect.setField(context, "PARAMS", params);
+ Reflect.setField(context, "LOCALS", locals);
+ Reflect.setField(context, "NS", "::");
+ Reflect.setField(context, "hxNS", " ::hx::");
+
+ var fixed = File.getContent("MacrosFixed.h");
+ fixed = fixed.split("
").join("");
+ var fileContents:String = File.getContent("Macros.tpl");
+ fileContents = fileContents.split("
").join("");
+
+ var template:Template = new Template(fileContents);
+ var result:String = template.execute(context);
+ var fileOutput:FileOutput = File.write("Macros.h", true);
+ fileOutput.writeString(warning);
+ fileOutput.writeString(fixed);
+ fileOutput.writeString(result);
+ fileOutput.close();
+
+ var fileContents:String = File.getContent("MacrosJumbo.tpl");
+ fileContents = fileContents.split("
").join("");
+ var template:Template = new Template(fileContents);
+ Reflect.setField(context, "LOCALS", jumboLocals);
+ var result:String = template.execute(context);
+ var fileOutput:FileOutput = File.write("MacrosJumbo.h", true);
+ fileOutput.writeString(warning);
+ fileOutput.writeString(result);
+ fileOutput.close();
+
+
+
+ var fileContents:String = File.getContent("DynamicImpl.tpl");
+ fileContents = fileContents.split("
").join("");
+ var template:Template = new Template(fileContents);
+ var result:String = template.execute(context);
+ var fileOutput:FileOutput = File.write("DynamicImpl.h", true);
+ fileOutput.writeString(warning);
+ fileOutput.writeString(result);
+ fileOutput.close();
+
+ }
+
+ public static function main() { new GenMacro(); }
+}
diff --git a/Sources/c_snikket/iinclude/hx/HeaderVersion.h b/Sources/c_snikket/iinclude/hx/HeaderVersion.h
new file mode 100644
index 0000000..81a2469
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/HeaderVersion.h
@@ -0,0 +1,3 @@
+#ifndef HXCPP_HEADER_VERSION
+#define HXCPP_HEADER_VERSION 330
+#endif
diff --git a/Sources/c_snikket/iinclude/hx/HxcppMain.h b/Sources/c_snikket/iinclude/hx/HxcppMain.h
new file mode 100644
index 0000000..ad09f30
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/HxcppMain.h
@@ -0,0 +1,114 @@
+#ifdef HXCPP_DLL_IMPORT
+
+ extern "C" EXPORT_EXTRA void __main__()
+ {
+ __boot_all();
+ __hxcpp_main();
+ }
+
+#elif defined(HX_ANDROID) && !defined(HXCPP_EXE_LINK)
+
+ // Java Main....
+ #include <jni.h>
+ #include <hx/Thread.h>
+ #include <android/log.h>
+
+ extern "C" EXPORT_EXTRA void hxcpp_main()
+ {
+ HX_TOP_OF_STACK
+ try
+ {
+ hx::Boot();
+ __boot_all();
+ __hxcpp_main();
+ }
+ catch (Dynamic e)
+ {
+ __hx_dump_stack();
+ __android_log_print(ANDROID_LOG_ERROR, "Exception", "%s", e==null() ? "null" : e->toString().__CStr());
+ }
+ hx::SetTopOfStack((int *)0,true);
+ }
+
+ extern "C" EXPORT_EXTRA JNIEXPORT void JNICALL Java_org_haxe_HXCPP_main(JNIEnv * env)
+ {
+ hxcpp_main();
+ }
+
+#elif defined(HX_WINRT) && defined(__cplusplus_winrt)
+
+ #include <Roapi.h>
+ [ Platform::MTAThread ]
+ int main(Platform::Array<Platform::String^>^)
+ {
+ HX_TOP_OF_STACK
+ RoInitialize(RO_INIT_MULTITHREADED);
+ hx::Boot();
+ try
+ {
+ __boot_all();
+ __hxcpp_main();
+ }
+ catch (Dynamic e)
+ {
+ __hx_dump_stack();
+ return -1;
+ }
+ return 0;
+ }
+
+#else
+
+ #if defined(HX_WIN_MAIN) && !defined(_WINDOWS_)
+ #ifndef HINSTANCE
+ #define HINSTANCE void*
+ #endif
+ #ifndef LPSTR
+ #define LPSTR char*
+ #endif
+ extern "C" int __stdcall MessageBoxA(void *,const char *,const char *,int);
+ #endif
+
+
+ #if defined(TIZEN)
+ extern "C" EXPORT_EXTRA int OspMain (int argc, char* pArgv[])
+ {
+ #elif defined(HX_WIN_MAIN)
+ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
+ {
+ #else
+
+ extern int _hxcpp_argc;
+ extern char **_hxcpp_argv;
+ int main(int argc,char **argv)
+ {
+ _hxcpp_argc = argc;
+ _hxcpp_argv = argv;
+ #endif
+ HX_TOP_OF_STACK
+ hx::Boot();
+ try
+ {
+ __boot_all();
+ __hxcpp_main();
+ }
+ catch (Dynamic e)
+ {
+ __hx_dump_stack();
+ #ifdef HX_WIN_MAIN
+ MessageBoxA(0, e==null() ? "null" : e->toString().__CStr(), "Error", 0);
+ #else
+ printf("Error : %s\n",e==null() ? "null" : e->toString().__CStr());
+ #endif
+ return -1;
+ }
+ return 0;
+ }
+ #if 0
+ }
+ }
+ #endif
+
+#endif
+
+
diff --git a/Sources/c_snikket/iinclude/hx/IndexRef.h b/Sources/c_snikket/iinclude/hx/IndexRef.h
new file mode 100644
index 0000000..9e9a183
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/IndexRef.h
@@ -0,0 +1,9 @@
+#ifndef HX_INDEX_REF_H
+#define HX_INDEX_REF_H
+
+namespace hx
+{
+
+}
+
+#endif
diff --git a/Sources/c_snikket/iinclude/hx/Interface.h b/Sources/c_snikket/iinclude/hx/Interface.h
new file mode 100644
index 0000000..e7438fe
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/Interface.h
@@ -0,0 +1,31 @@
+#ifndef HX_INTERFACE_H
+#define HX_INTERFACE_H
+
+namespace hx
+{
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES void InvalidInterface();
+
+template<typename T>
+inline T interface_cast(void *ptr)
+{
+ #if defined(HXCPP_GC_CHECK_POINTER) || defined(HXCPP_DEBUG)
+ if (!ptr) hx::InvalidInterface();
+ #endif
+ return static_cast<T>(ptr);
+}
+
+template<typename T>
+inline T interface_check(T inObj,int interfaceId)
+{
+ Dynamic d(inObj);
+ if ( !d.mPtr || !d->_hx_getInterface(interfaceId))
+ hx::BadCast();
+ return inObj;
+}
+
+}
+
+
+#endif
+
diff --git a/Sources/c_snikket/iinclude/hx/LessThanEq.h b/Sources/c_snikket/iinclude/hx/LessThanEq.h
new file mode 100644
index 0000000..e87ebb0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/LessThanEq.h
@@ -0,0 +1,473 @@
+#ifndef HX_LESS_THAN_EQ_INCLUDED
+#define HX_LESS_THAN_EQ_INCLUDED
+
+namespace hx
+{
+
+enum {
+ CompareAsInt,
+ CompareAsInt64,
+ CompareAsDouble,
+ CompareAsString,
+ CompareAsDynamic,
+};
+
+
+template <typename T>
+struct CompareTraits
+{
+ enum { type = (int)CompareAsDynamic };
+
+ inline static int toInt(Dynamic inValue) { return inValue; }
+ inline static double toDouble(Dynamic inValue) { return inValue; }
+ inline static cpp::Int64 toInt64(Dynamic inValue) { return inValue; }
+ inline static String toString(Dynamic inValue) { return inValue; }
+ inline static hx::Object *toObject(Dynamic inValue) { return inValue.mPtr; }
+ inline static int getDynamicCompareType(const Dynamic &inValue)
+ {
+ if (!inValue.mPtr)
+ return CompareAsDynamic;
+ switch(inValue->__GetType())
+ {
+ case vtInt: case vtBool: return CompareAsInt;
+ case vtInt64: return CompareAsInt64;
+ case vtFloat: return CompareAsDouble;
+ case vtString: return CompareAsString;
+ default: return CompareAsDynamic;
+ }
+ }
+ inline static bool isNull(const Dynamic &inValue) { return !inValue.mPtr; }
+};
+
+
+
+template <>
+struct CompareTraits<null>
+{
+ enum { type = (int)CompareAsDynamic };
+
+ inline static int toInt(const null &inValue) { return 0; }
+ inline static double toDouble(const null & inValue) { return 0; }
+ inline static cpp::Int64 toInt64(const null & inValue) { return 0; }
+ inline static String toString(const null & inValue) { return String(); }
+ inline static hx::Object *toObject(const null & inValue) { return 0; }
+
+ inline static int getDynamicCompareType(const null &) { return type; }
+ inline static bool isNull(const null &) { return true; }
+};
+
+
+
+template <>
+struct CompareTraits<signed int>
+{
+ enum { type = (int)CompareAsInt };
+
+ inline static int toInt(int inValue) { return inValue; }
+ inline static double toDouble(int inValue) { return inValue; }
+ inline static cpp::Int64 toInt64(int inValue) { return inValue; }
+ inline static String toString(int inValue) { return String(); }
+ inline static hx::Object *toObject(int inValue) { return 0; }
+
+ inline static int getDynamicCompareType(int) { return type; }
+ inline static bool isNull(int) { return false; }
+};
+
+template <>
+struct CompareTraits<unsigned int>
+{
+ enum { type = (int)CompareAsInt };
+
+ // Return value is unsigned ...
+ inline static unsigned int toInt(unsigned int inValue) { return inValue; }
+ inline static double toDouble(unsigned int inValue) { return inValue; }
+ inline static cpp::Int64 toInt64(unsigned int inValue) { return inValue; }
+ inline static String toString(unsigned int inValue) { return String(); }
+ inline static hx::Object *toObject(unsigned int inValue) { return 0; }
+
+ inline static int getDynamicCompareType(int) { return type; }
+ inline static bool isNull(int) { return false; }
+};
+
+template <> struct CompareTraits<signed short> : public CompareTraits<int> { };
+template <> struct CompareTraits<unsigned short> : public CompareTraits<int> { };
+template <> struct CompareTraits<signed char> : public CompareTraits<int> { };
+template <> struct CompareTraits<unsigned char> : public CompareTraits<int> { };
+template <> struct CompareTraits<char> : public CompareTraits<int> { };
+template <> struct CompareTraits<wchar_t> : public CompareTraits<int> { };
+template <> struct CompareTraits<char16_t> : public CompareTraits<int> { };
+
+
+template <>
+struct CompareTraits<double>
+{
+ enum { type = (int)CompareAsDouble };
+
+ inline static int toInt(double inValue) { return inValue; }
+ inline static double toDouble(double inValue) { return inValue; }
+ inline static cpp::Int64 toInt64(double inValue) { return inValue; }
+ inline static String toString(double inValue) { return String(); }
+ inline static hx::Object *toObject(double inValue) { return 0; }
+
+ inline static int getDynamicCompareType(const double &) { return type; }
+ inline static bool isNull(const double &) { return false; }
+};
+template <> struct CompareTraits<float> : public CompareTraits<double> { };
+
+
+
+template <>
+struct CompareTraits<cpp::Int64>
+{
+ enum { type = (int)CompareAsInt64 };
+
+ inline static int toInt(cpp::Int64 inValue) { return (int)inValue; }
+ inline static double toDouble(cpp::Int64 inValue) { return inValue; }
+ inline static cpp::Int64 toInt64(cpp::Int64 inValue) { return inValue; }
+ inline static String toString(cpp::Int64 inValue) { return String(); }
+ inline static hx::Object *toObject(cpp::Int64 inValue) { return 0; }
+
+ inline static int getDynamicCompareType(cpp::Int64) { return type; }
+ inline static bool isNull(cpp::Int64) { return false; }
+};
+
+template <>
+struct CompareTraits<cpp::UInt64>
+{
+ enum { type = (int)CompareAsInt64 };
+
+ inline static int toInt(cpp::UInt64 inValue) { return (int)inValue; }
+ inline static double toDouble(cpp::UInt64 inValue) { return inValue; }
+ // Return value is unsigned ...
+ inline static cpp::UInt64 toInt64(cpp::UInt64 inValue) { return inValue; }
+ inline static String toString(cpp::UInt64 inValue) { return String(); }
+ inline static hx::Object *toObject(cpp::UInt64 inValue) { return 0; }
+
+ inline static int getDynamicCompareType(cpp::UInt64) { return type; }
+ inline static bool isNull(cpp::UInt64) { return false; }
+};
+
+
+template <>
+struct CompareTraits< String >
+{
+ enum { type = (int)CompareAsString };
+
+ inline static int toInt(const String &) { return 0; }
+ inline static double toDouble(const String &) { return 0; }
+ inline static cpp::Int64 toInt64(const String &) { return 0; }
+ inline static String toString(const String &inValue ) { return inValue; }
+ inline static hx::Object *toObject(const String &inValue) { return Dynamic(inValue).mPtr; }
+
+ inline static int getDynamicCompareType(const String &) { return type; }
+ inline static bool isNull(const String &inValue) { return !inValue.raw_ptr(); }
+};
+
+
+template <>
+struct CompareTraits< cpp::Variant >
+{
+ enum { type = (int)CompareAsDynamic };
+
+ // Might ne a
+ inline static int toInt(const cpp::Variant &inValue) { return inValue; }
+ inline static double toDouble(const cpp::Variant &inValue) { return inValue; }
+ inline static cpp::Int64 toInt64(const cpp::Variant &inValue) { return inValue; }
+ inline static String toString(const cpp::Variant &inValue ) { return inValue; }
+ inline static hx::Object *toObject(const cpp::Variant &inValue) {
+ if (inValue.type==cpp::Variant::typeObject)
+ return inValue.valObject;
+ return 0;
+ }
+
+ inline static int getDynamicCompareType(const cpp::Variant &inValue)
+ {
+ switch(inValue.type)
+ {
+ case cpp::Variant::typeInt: case cpp::Variant::typeBool: return CompareAsInt;
+ case cpp::Variant::typeInt64: return CompareAsInt64;
+ case cpp::Variant::typeDouble: return CompareAsDouble;
+ case cpp::Variant::typeString: return CompareAsString;
+
+ case cpp::Variant::typeObject:
+ {
+ if (!inValue.valObject)
+ return CompareAsDynamic;
+ switch(inValue.valObject->__GetType())
+ {
+ case vtInt: case vtBool: return CompareAsInt;
+ case vtInt64: return CompareAsInt64;
+ case vtFloat: return CompareAsDouble;
+ case vtString: return CompareAsString;
+ default: return CompareAsDynamic;
+ }
+ }
+ default:
+ return CompareAsDynamic;
+ }
+ }
+ inline static bool isNull(const cpp::Variant &inValue) { return inValue.isNull(); }
+};
+
+
+
+template <typename T>
+struct CompareTraits< cpp::Pointer<T> >
+{
+ enum { type = (int)CompareAsDynamic };
+
+ inline static int toInt(Dynamic inValue) { return inValue; }
+ inline static double toDouble(Dynamic inValue) { return inValue; }
+ inline static cpp::Int64 toInt64(Dynamic inValue) { return inValue; }
+ inline static String toString(Dynamic inValue) { return inValue; }
+ inline static hx::Object *toObject(Dynamic inValue) { return inValue.mPtr; }
+ inline static int getDynamicCompareType(const Dynamic &inValue)
+ {
+ return CompareAsDynamic;
+ }
+ inline static bool isNull(const cpp::Pointer<T> &inValue) { return !inValue.ptr; }
+};
+
+
+template <typename T>
+struct CompareTraits< T * >
+{
+ enum { type = (int)CompareAsInt64 };
+
+ inline static int toInt(T * inValue) { return 0; }
+ inline static double toDouble(T * inValue) { return 0; }
+ inline static cpp::Int64 toInt64(T * inValue) { return (cpp::Int64)inValue; }
+ inline static String toString(T * inValue) { return String(); }
+ inline static hx::Object *toObject(T * inValue) { return 0; }
+ inline static int getDynamicCompareType(T * inValue)
+ {
+ return CompareAsInt64;
+ }
+ inline static bool isNull(T *inValue) { return !inValue; }
+};
+
+
+template<typename T1>
+hx::Object *GetExistingObject(const T1 &v1)
+{
+ typedef CompareTraits<T1> traits1;
+ return traits1::toObject(v1);
+}
+
+
+template<typename T1>
+bool IsNull(const T1 &v1)
+{
+ typedef CompareTraits<T1> traits1;
+ return traits1::isNull(v1);
+}
+
+template<typename T1>
+bool IsNotNull(const T1 &v1)
+{
+ typedef CompareTraits<T1> traits1;
+ return !traits1::isNull(v1);
+}
+
+template<bool LESS, bool EQ, typename T1, typename T2>
+inline bool TestLessEq(const T1 &v1, const T2 &v2)
+{
+ typedef CompareTraits<T1> traits1;
+ typedef CompareTraits<T2> traits2;
+
+ if (traits1::type==(int)CompareAsInt && traits2::type==(int)CompareAsInt)
+ {
+ return LESS ? ( EQ ? traits1::toInt(v1) <= traits2::toInt(v2) :
+ traits1::toInt(v1) < traits2::toInt(v2) ) :
+ ( EQ ? traits1::toInt(v1) == traits2::toInt(v2) :
+ traits1::toInt(v1) != traits2::toInt(v2) );
+ }
+ else if (traits1::type<=(int)CompareAsInt64 && traits2::type<=(int)CompareAsInt64)
+ {
+ return LESS ? ( EQ ? traits1::toInt64(v1) <= traits2::toInt64(v2) :
+ traits1::toInt64(v1) < traits2::toInt64(v2) ) :
+ ( EQ ? traits1::toInt64(v1) == traits2::toInt64(v2) :
+ traits1::toInt64(v1) != traits2::toInt64(v2) );
+ }
+ else if (traits1::type<=(int)CompareAsDouble && traits2::type<=(int)CompareAsDouble)
+ {
+ return LESS ? ( EQ ? traits1::toDouble(v1) <= traits2::toDouble(v2) :
+ traits1::toDouble(v1) < traits2::toDouble(v2) ) :
+ ( EQ ? traits1::toDouble(v1) == traits2::toDouble(v2) :
+ traits1::toDouble(v1) != traits2::toDouble(v2) );
+ }
+ else if (traits1::type==(int)CompareAsString && traits2::type==(int)CompareAsString)
+ {
+ return LESS ? ( EQ ? traits1::toString(v1) <= traits2::toString(v2) :
+ traits1::toString(v1) < traits2::toString(v2) ) :
+ ( EQ ? traits1::toString(v1) == traits2::toString(v2) :
+ traits1::toString(v1) != traits2::toString(v2) );
+ }
+ else if (traits1::type<=(int)CompareAsString && traits2::type<=(int)CompareAsString)
+ {
+ // String with a number...
+ return false;
+ }
+ else if (traits1::type==(int)CompareAsString || traits2::type==(int)CompareAsString)
+ {
+ // String with a object...
+ return LESS ? ( EQ ? traits1::toString(v1) <= traits2::toString(v2) :
+ traits1::toString(v1) < traits2::toString(v2) ) :
+ ( EQ ? traits1::toString(v1) == traits2::toString(v2) :
+ traits1::toString(v1) != traits2::toString(v2) );
+ }
+ else if (traits1::type<=(int)CompareAsDouble || traits2::type<=(int)CompareAsDouble)
+ {
+ // numeric with a object...
+
+ // null can only be equal to null...
+ bool n1 = traits1::isNull(v1);
+ bool n2 = traits2::isNull(v2);
+ if (n1 || n2)
+ return EQ ? n1==n2 : !LESS && n1!=n2/* false,false = not equal*/;
+
+ return LESS ? ( EQ ? traits1::toDouble(v1) <= traits2::toDouble(v2) :
+ traits1::toDouble(v1) < traits2::toDouble(v2) ) :
+ ( EQ ? traits1::toDouble(v1) == traits2::toDouble(v2) :
+ traits1::toDouble(v1) != traits2::toDouble(v2) );
+ }
+ else
+ {
+ // Dynamic compare.
+ // This time, one or both types are calculated at run time
+
+ // Check null/not null compare
+ bool n1 = traits1::isNull(v1);
+ bool n2 = traits2::isNull(v2);
+ if (n1 || n2)
+ return EQ ? n1==n2 : !LESS && n1!=n2 /* false,false = not equal*/;
+
+ int t1 = traits1::getDynamicCompareType(v1);
+ int t2 = traits2::getDynamicCompareType(v2);
+
+ if (t1==(int)CompareAsInt && t2==(int)CompareAsInt)
+ {
+ return LESS ? ( EQ ? traits1::toInt(v1) <= traits2::toInt(v2) :
+ traits1::toInt(v1) < traits2::toInt(v2) ) :
+ ( EQ ? traits1::toInt(v1) == traits2::toInt(v2) :
+ traits1::toInt(v1) != traits2::toInt(v2) );
+ }
+ else if (t1<=(int)CompareAsInt64 && t2<=(int)CompareAsInt64)
+ {
+ return LESS ? ( EQ ? traits1::toInt64(v1) <= traits2::toInt64(v2) :
+ traits1::toInt64(v1) < traits2::toInt64(v2) ) :
+ ( EQ ? traits1::toInt64(v1) == traits2::toInt64(v2) :
+ traits1::toInt64(v1) != traits2::toInt64(v2) );
+ }
+ else if (t1<=(int)CompareAsDouble && t2<=(int)CompareAsDouble)
+ {
+ return LESS ? ( EQ ? traits1::toDouble(v1) <= traits2::toDouble(v2) :
+ traits1::toDouble(v1) < traits2::toDouble(v2) ) :
+ ( EQ ? traits1::toDouble(v1) == traits2::toDouble(v2) :
+ traits1::toDouble(v1) != traits2::toDouble(v2) );
+ }
+ else if (t1==(int)CompareAsString && t2==(int)CompareAsString)
+ {
+ return LESS ? ( EQ ? traits1::toString(v1) <= traits2::toString(v2) :
+ traits1::toString(v1) < traits2::toString(v2) ) :
+ ( EQ ? traits1::toString(v1) == traits2::toString(v2) :
+ traits1::toString(v1) != traits2::toString(v2) );
+ }
+ else if (t1<=(int)CompareAsString && t2<=(int)CompareAsString)
+ {
+ // String with a number...
+ return false;
+ }
+ else if (t1==(int)CompareAsString || t2==(int)CompareAsString)
+ {
+ // String with a object...
+ return LESS ? ( EQ ? traits1::toString(v1) <= traits2::toString(v2) :
+ traits1::toString(v1) < traits2::toString(v2) ) :
+ ( EQ ? traits1::toString(v1) == traits2::toString(v2) :
+ traits1::toString(v1) != traits2::toString(v2) );
+ }
+ else if (t1<=(int)CompareAsDouble || t2<=(int)CompareAsDouble)
+ {
+ // numeric with a object only works for not-equal
+ return !LESS && !EQ;
+ }
+ else
+ {
+ // Object with Object
+ hx::Object *o1 = traits1::toObject(v1);
+ hx::Object *o2 = traits2::toObject(v2);
+
+ int diff = o1->__Compare(o2);
+ return LESS ? ( EQ ? diff <= 0 :
+ diff < 0 ) :
+ ( EQ ? diff == 0 :
+ diff != 0 );
+ }
+ }
+}
+
+
+template<typename T1, typename T2>
+bool IsEq(const T1 &v1, const T2 &v2) { return TestLessEq<false,true,T1,T2>(v1,v2); }
+
+template<typename T1, typename T2>
+bool IsNotEq(const T1 &v1, const T2 &v2) { return TestLessEq<false,false,T1,T2>(v1,v2); }
+
+template<typename T1, typename T2>
+bool IsLess(const T1 &v1, const T2 &v2) { return TestLessEq<true,false,T1,T2>(v1,v2); }
+
+template<typename T1, typename T2>
+bool IsLessEq(const T1 &v1, const T2 &v2) { return TestLessEq<true,true,T1,T2>(v1,v2); }
+
+
+template<typename T1, typename T2>
+bool IsGreater(const T1 &v1, const T2 &v2) { return TestLessEq<true,false,T2,T1>(v2,v1); }
+
+template<typename T1, typename T2>
+bool IsGreaterEq(const T1 &v1, const T2 &v2) { return TestLessEq<true,true,T2,T1>(v2,v1); }
+
+
+
+template<typename T1, typename T2>
+bool IsPointerEq(const T1 &v1, const T2 &v2)
+{
+ return GetExistingObject(v1) == GetExistingObject(v2);
+}
+
+template<typename T1, typename T2>
+bool IsPointerNotEq(const T1 &v1, const T2 &v2)
+{
+ return GetExistingObject(v1) != GetExistingObject(v2);
+}
+
+
+template<typename T1, typename T2>
+bool IsInstanceEq(const T1 &v1, const T2 &v2)
+{
+ hx::Object *p1 = GetExistingObject(v1);
+ hx::Object *p2 = GetExistingObject(v2);
+ if (p1==p2)
+ return true;
+ if (!p1 || !p2)
+ return false;
+ return !p1->__Compare(p2);
+}
+
+template<typename T1, typename T2>
+bool IsInstanceNotEq(const T1 &v1, const T2 &v2)
+{
+ hx::Object *p1 = GetExistingObject(v1);
+ hx::Object *p2 = GetExistingObject(v2);
+ if (p1==p2)
+ return false;
+ if (!p1 || !p2)
+ return true;
+ return p1->__Compare(p2);
+}
+
+
+
+}
+
+
+#endif
diff --git a/Sources/c_snikket/iinclude/hx/Macros.h b/Sources/c_snikket/iinclude/hx/Macros.h
new file mode 100644
index 0000000..ac4e050
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/Macros.h
@@ -0,0 +1,1099 @@
+// ## ## ## ## #### ## ## ## ## ## #### ##
+// ## ## ## ## ## ## ## ### ## ## ### ## ## ##
+// ## ## ## ###### ###### ###### ## ###### ## ### ##
+// ## ## ## ## ## ## ## ## ### ## ## ### ## ##
+// ## ## ## ## ## ## ## ## ## ## ## #### ##
+
+// DO NOT EDIT
+// This file is generated from the .tpl file
+#ifndef MACROS_FIXED_H
+#define MACROS_FIXED_H
+
+// ---- Forward Declare ---------------
+
+
+#define HX_DECLARE_CLASS0(klass) \
+ class klass##_obj; \
+ typedef ::hx::ObjectPtr<klass##_obj> klass;
+#define HX_DECLARE_CLASS1(ns1,klass) namespace ns1 { HX_DECLARE_CLASS0(klass) }
+#define HX_DECLARE_CLASS2(ns2,ns1,klass) namespace ns2 { HX_DECLARE_CLASS1(ns1,klass) }
+#define HX_DECLARE_CLASS3(ns3,ns2,ns1,klass) namespace ns3 { HX_DECLARE_CLASS2(ns2,ns1,klass) }
+#define HX_DECLARE_CLASS4(ns4,ns3,ns2,ns1,klass) namespace ns4 { HX_DECLARE_CLASS3(ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS5(ns5,ns4,ns3,ns2,ns1,klass) namespace ns5 { HX_DECLARE_CLASS4(ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS6(ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns6 { HX_DECLARE_CLASS5(ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS7(ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns7 { HX_DECLARE_CLASS6(ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS8(ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns8 { HX_DECLARE_CLASS7(ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS9(ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns9 { HX_DECLARE_CLASS8(ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS10(ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns10 { HX_DECLARE_CLASS9(ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS11(ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns11 { HX_DECLARE_CLASS10(ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS12(ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns12 { HX_DECLARE_CLASS11(ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS13(ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns13 { HX_DECLARE_CLASS12(ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS14(ns14,ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns14 { HX_DECLARE_CLASS13(ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS15(ns15,ns14,ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns15 { HX_DECLARE_CLASS14(ns14,ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS16(ns16,ns15,ns14,ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns16 { HX_DECLARE_CLASS15(ns15,ns14,ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS17(ns17,ns16,ns15,ns14,ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns17 { HX_DECLARE_CLASS16(ns16,ns15,ns14,ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS18(ns18,ns17,ns16,ns15,ns14,ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns18 { HX_DECLARE_CLASS17(ns17,ns16,ns15,ns14,ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS19(ns19,ns18,ns17,ns16,ns15,ns14,ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns19 { HX_DECLARE_CLASS18(ns18,ns17,ns16,ns15,ns14,ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS20(ns20,ns19,ns18,ns17,ns16,ns15,ns14,ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns20 { HX_DECLARE_CLASS19(ns19,ns18,ns17,ns16,ns15,ns14,ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+
+// ---- Enum ----------------------
+
+#define HX_DEFINE_CREATE_ENUM(enum_obj) \
+static ::Dynamic Create##enum_obj(::String inName,::hx::DynamicArray inArgs) \
+{ \
+ int count = enum_obj::__FindArgCount(inName); \
+ int args = inArgs.GetPtr() ? inArgs.__length() : 0; \
+ if (args!=count) __hxcpp_dbg_checkedThrow(HX_INVALID_ENUM_ARG_COUNT(#enum_obj, inName, count, args)); \
+ ::Dynamic result; \
+ if (!enum_obj::__GetStatic(inName,result,::hx::paccDynamic)) __hxcpp_dbg_checkedThrow(HX_INVALID_ENUM_CONSTRUCTOR(#enum_obj, inName)); \
+ if (args==0) return result; \
+ return result->__Run(inArgs); \
+}
+
+// ---- Fields ----------------------
+
+#define HX_IS_INSTANCE_OF bool _hx_isInstanceOf(int inClassId) { return inClassId==1 || inClassId==(int)_hx_ClassId; }
+
+#define HX_DO_RTTI_ALL \
+ static ::hx::ObjectPtr< ::hx::Class_obj> __mClass; \
+ ::hx::ObjectPtr< ::hx::Class_obj > __GetClass() const { return __mClass; } \
+ inline static ::hx::ObjectPtr< ::hx::Class_obj> &__SGetClass() { return __mClass; } \
+ inline operator super *() { return this; }
+
+#define HX_DO_RTTI \
+ HX_DO_RTTI_ALL \
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp); \
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp); \
+ void __GetFields(Array< ::String> &outFields);
+
+#define HX_DO_INTERFACE_RTTI \
+ static ::hx::ObjectPtr< ::hx::Class_obj> __mClass; \
+ static ::hx::ObjectPtr< ::hx::Class_obj> &__SGetClass() { return __mClass; } \
+ static void __register();
+
+#define HX_DO_ENUM_RTTI_INTERNAL \
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp); \
+ static int __FindIndex(::String inName); \
+ static int __FindArgCount(::String inName);
+
+#define HX_DO_ENUM_RTTI \
+ HX_DO_ENUM_RTTI_INTERNAL \
+ static ::hx::ObjectPtr< ::hx::Class_obj> __mClass; \
+ ::hx::ObjectPtr< ::hx::Class_obj > __GetClass() const { return __mClass; } \
+ static ::hx::ObjectPtr< ::hx::Class_obj> &__SGetClass() { return __mClass; }
+
+
+#define HX_DECLARE_IMPLEMENT_DYNAMIC ::Dynamic __mDynamicFields; \
+ ::Dynamic *__GetFieldMap() { return &__mDynamicFields; } \
+ bool __HasField(const String &inString) \
+ { return ::hx::FieldMapHas(&__mDynamicFields,inString) || super::__HasField(inString); }
+
+
+#define HX_INIT_IMPLEMENT_DYNAMIC
+
+#define HX_MARK_DYNAMIC HX_MARK_MEMBER(__mDynamicFields)
+
+
+#ifdef HX_VISIT_ALLOCS
+
+#define HX_VISIT_DYNAMIC HX_VISIT_MEMBER(__mDynamicFields);
+
+#else
+
+#define HX_VISIT_DYNAMIC do { } while (0);
+
+#endif
+
+#define HX_CHECK_DYNAMIC_GET_FIELD(inName) \
+ { ::Dynamic d; if (::hx::FieldMapGet(&__mDynamicFields,inName,d)) return d; }
+
+#define HX_CHECK_DYNAMIC_GET_INT_FIELD(inID) \
+ { ::Dynamic d; if (::hx::FieldMapGet(&__mDynamicFields,inID,d)) return d; }
+
+#ifdef HXCPP_GC_GENERATIONAL
+#define HX_DYNAMIC_SET_FIELD(inName,inValue) ::hx::FieldMapSet(this,&__mDynamicFields,inName,inValue)
+#else
+#define HX_DYNAMIC_SET_FIELD(inName,inValue) ::hx::FieldMapSet(&__mDynamicFields,inName,inValue)
+#endif
+
+#define HX_APPEND_DYNAMIC_FIELDS(outFields) ::hx::FieldMapAppendFields(&__mDynamicFields,outFields)
+
+
+
+
+
+
+// ---- Main ---------------
+
+
+namespace hx {
+HXCPP_EXTERN_CLASS_ATTRIBUTES void SetTopOfStack(int *inTopOfStack,bool);
+}
+#define HX_TOP_OF_STACK \
+ int t0 = 99; \
+ ::hx::SetTopOfStack(&t0,false);
+
+
+#ifdef __GNUC__
+ #define EXPORT_EXTRA __attribute__ ((visibility("default")))
+#else
+ #define EXPORT_EXTRA __declspec(dllexport)
+#endif
+
+#ifdef HX_DECLARE_MAIN
+
+#ifdef HXCPP_DLL_IMPORT
+
+#define HX_BEGIN_MAIN \
+ extern "C" { \
+ EXPORT_EXTRA void __main__() { \
+ __boot_all();
+
+#define HX_END_MAIN \
+} \
+}
+
+
+#elif defined(HX_ANDROID)
+ #ifdef HXCPP_EXE_LINK
+ #define HX_BEGIN_MAIN \
+ \
+ int main(int argc,char **argv){ \
+ HX_TOP_OF_STACK \
+ ::hx::Boot(); \
+ try{ \
+ __boot_all();
+
+ #define HX_END_MAIN \
+ } \
+ catch ( ::Dynamic e){ \
+ __hx_dump_stack(); \
+ printf("Error : %s\n",e->toString().__CStr()); \
+ return -1; \
+ } \
+ return 0; \
+ }
+
+ #else
+ // Java Main....
+ #include <jni.h>
+ #include <hx/Thread.h>
+ #include <android/log.h>
+
+ #define HX_BEGIN_MAIN \
+ extern "C" EXPORT_EXTRA void hxcpp_main() { \
+ HX_TOP_OF_STACK \
+ try { \
+ ::hx::Boot(); \
+ __boot_all();
+
+
+ #define HX_END_MAIN \
+ } catch ( ::Dynamic e) { \
+ __hx_dump_stack(); \
+ __android_log_print(ANDROID_LOG_ERROR, "Exception", "%s", e->toString().__CStr()); \
+ }\
+ ::hx::SetTopOfStack((int *)0,true); \
+ } \
+ \
+ extern "C" EXPORT_EXTRA JNIEXPORT void JNICALL Java_org_haxe_HXCPP_main(JNIEnv * env) \
+ { hxcpp_main(); }
+ #endif
+
+#elif defined(HX_WINRT)
+
+#include <Roapi.h>
+
+#define HX_BEGIN_MAIN \
+[ Platform::MTAThread ] \
+int main(Platform::Array<Platform::String^>^) \
+{ \
+ HX_TOP_OF_STACK \
+ RoInitialize(RO_INIT_MULTITHREADED); \
+ ::hx::Boot(); \
+ try{ \
+ __boot_all();
+
+#define HX_END_MAIN \
+ } \
+ catch ( ::Dynamic e){ \
+ __hx_dump_stack(); \
+ return -1; \
+ } \
+ return 0; \
+}
+
+#elif defined(HX_WIN_MAIN)
+
+
+#ifdef HAVE_WINDOWS_H
+
+#define HX_BEGIN_MAIN \
+int __stdcall WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) \
+{ \
+ HX_TOP_OF_STACK \
+ ::hx::Boot(); \
+ try{ \
+ __boot_all();
+
+#else
+
+#define HX_BEGIN_MAIN \
+extern "C" int __stdcall MessageBoxA(void *,const char *,const char *,int); \
+\
+int __stdcall WinMain( void * hInstance, void * hPrevInstance, const char *lpCmdLine, int nCmdShow) \
+{ \
+ HX_TOP_OF_STACK \
+ ::hx::Boot(); \
+ try{ \
+ __boot_all();
+
+#endif
+
+#define HX_END_MAIN \
+ } \
+ catch ( ::Dynamic e){ \
+ __hx_dump_stack(); \
+ MessageBoxA(0, e->toString().__CStr(), "Error", 0); \
+ return -1; \
+ } \
+ return 0; \
+}
+
+
+#elif defined(TIZEN)
+
+
+#define HX_BEGIN_MAIN \
+\
+extern "C" EXPORT_EXTRA int OspMain (int argc, char* pArgv[]){ \
+ HX_TOP_OF_STACK \
+ ::hx::Boot(); \
+ try{ \
+ __boot_all();
+
+#define HX_END_MAIN \
+ } \
+ catch ( ::Dynamic e){ \
+ __hx_dump_stack(); \
+ printf("Error : %s\n",e->toString().__CStr()); \
+ return -1; \
+ } \
+ return 0; \
+}
+
+
+#else
+// Console Main ...
+
+#define HX_BEGIN_MAIN \
+\
+int main(int argc,char **argv){ \
+ HX_TOP_OF_STACK \
+ ::hx::Boot(); \
+ try{ \
+ __boot_all();
+
+#define HX_END_MAIN \
+ } \
+ catch ( ::Dynamic e){ \
+ __hx_dump_stack(); \
+ printf("Error : %s\n",e->toString().__CStr()); \
+ return -1; \
+ } \
+ return 0; \
+}
+
+#endif
+
+#endif // HX_DECLARE_MAIN
+
+// Run as library
+#define HX_BEGIN_LIB_MAIN \
+extern "C" {\
+\
+void __hxcpp_lib_main() \
+{ \
+ HX_TOP_OF_STACK \
+ ::hx::Boot(); \
+ __boot_all();
+
+#define HX_END_LIB_MAIN \
+} }
+
+
+
+#endif
+
+
+#ifndef HX_MACROS_H
+#define HX_MACROS_H
+
+// --- Functions and their parameters ----
+
+
+#define HX_ARR_LIST0
+#define HX_ARR_LIST1 inArgs[0]
+#define HX_ARR_LIST2 inArgs[0],inArgs[1]
+#define HX_ARR_LIST3 inArgs[0],inArgs[1],inArgs[2]
+#define HX_ARR_LIST4 inArgs[0],inArgs[1],inArgs[2],inArgs[3]
+#define HX_ARR_LIST5 inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4]
+#define HX_ARR_LIST6 inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5]
+#define HX_ARR_LIST7 inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6]
+#define HX_ARR_LIST8 inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6],inArgs[7]
+#define HX_ARR_LIST9 inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6],inArgs[7],inArgs[8]
+#define HX_ARR_LIST10 inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6],inArgs[7],inArgs[8],inArgs[9]
+#define HX_ARR_LIST11 inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6],inArgs[7],inArgs[8],inArgs[9],inArgs[10]
+#define HX_ARR_LIST12 inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6],inArgs[7],inArgs[8],inArgs[9],inArgs[10],inArgs[11]
+#define HX_ARR_LIST13 inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6],inArgs[7],inArgs[8],inArgs[9],inArgs[10],inArgs[11],inArgs[12]
+#define HX_ARR_LIST14 inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6],inArgs[7],inArgs[8],inArgs[9],inArgs[10],inArgs[11],inArgs[12],inArgs[13]
+#define HX_ARR_LIST15 inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6],inArgs[7],inArgs[8],inArgs[9],inArgs[10],inArgs[11],inArgs[12],inArgs[13],inArgs[14]
+#define HX_ARR_LIST16 inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6],inArgs[7],inArgs[8],inArgs[9],inArgs[10],inArgs[11],inArgs[12],inArgs[13],inArgs[14],inArgs[15]
+#define HX_ARR_LIST17 inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6],inArgs[7],inArgs[8],inArgs[9],inArgs[10],inArgs[11],inArgs[12],inArgs[13],inArgs[14],inArgs[15],inArgs[16]
+#define HX_ARR_LIST18 inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6],inArgs[7],inArgs[8],inArgs[9],inArgs[10],inArgs[11],inArgs[12],inArgs[13],inArgs[14],inArgs[15],inArgs[16],inArgs[17]
+#define HX_ARR_LIST19 inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6],inArgs[7],inArgs[8],inArgs[9],inArgs[10],inArgs[11],inArgs[12],inArgs[13],inArgs[14],inArgs[15],inArgs[16],inArgs[17],inArgs[18]
+#define HX_ARR_LIST20 inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6],inArgs[7],inArgs[8],inArgs[9],inArgs[10],inArgs[11],inArgs[12],inArgs[13],inArgs[14],inArgs[15],inArgs[16],inArgs[17],inArgs[18],inArgs[19]
+#define HX_ARR_LIST21 inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6],inArgs[7],inArgs[8],inArgs[9],inArgs[10],inArgs[11],inArgs[12],inArgs[13],inArgs[14],inArgs[15],inArgs[16],inArgs[17],inArgs[18],inArgs[19],inArgs[20]
+#define HX_ARR_LIST22 inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6],inArgs[7],inArgs[8],inArgs[9],inArgs[10],inArgs[11],inArgs[12],inArgs[13],inArgs[14],inArgs[15],inArgs[16],inArgs[17],inArgs[18],inArgs[19],inArgs[20],inArgs[21]
+#define HX_ARR_LIST23 inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6],inArgs[7],inArgs[8],inArgs[9],inArgs[10],inArgs[11],inArgs[12],inArgs[13],inArgs[14],inArgs[15],inArgs[16],inArgs[17],inArgs[18],inArgs[19],inArgs[20],inArgs[21],inArgs[22]
+#define HX_ARR_LIST24 inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6],inArgs[7],inArgs[8],inArgs[9],inArgs[10],inArgs[11],inArgs[12],inArgs[13],inArgs[14],inArgs[15],inArgs[16],inArgs[17],inArgs[18],inArgs[19],inArgs[20],inArgs[21],inArgs[22],inArgs[23]
+#define HX_ARR_LIST25 inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6],inArgs[7],inArgs[8],inArgs[9],inArgs[10],inArgs[11],inArgs[12],inArgs[13],inArgs[14],inArgs[15],inArgs[16],inArgs[17],inArgs[18],inArgs[19],inArgs[20],inArgs[21],inArgs[22],inArgs[23],inArgs[24]
+#define HX_ARR_LIST26 inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6],inArgs[7],inArgs[8],inArgs[9],inArgs[10],inArgs[11],inArgs[12],inArgs[13],inArgs[14],inArgs[15],inArgs[16],inArgs[17],inArgs[18],inArgs[19],inArgs[20],inArgs[21],inArgs[22],inArgs[23],inArgs[24],inArgs[25]
+
+
+#define HX_DYNAMIC_ARG_LIST0
+#define HX_DYNAMIC_ARG_LIST1 const Dynamic &inArg0
+#define HX_DYNAMIC_ARG_LIST2 const Dynamic &inArg0,const Dynamic &inArg1
+#define HX_DYNAMIC_ARG_LIST3 const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2
+#define HX_DYNAMIC_ARG_LIST4 const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3
+#define HX_DYNAMIC_ARG_LIST5 const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4
+#define HX_DYNAMIC_ARG_LIST6 const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5
+#define HX_DYNAMIC_ARG_LIST7 const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6
+#define HX_DYNAMIC_ARG_LIST8 const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7
+#define HX_DYNAMIC_ARG_LIST9 const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8
+#define HX_DYNAMIC_ARG_LIST10 const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9
+#define HX_DYNAMIC_ARG_LIST11 const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10
+#define HX_DYNAMIC_ARG_LIST12 const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11
+#define HX_DYNAMIC_ARG_LIST13 const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12
+#define HX_DYNAMIC_ARG_LIST14 const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13
+#define HX_DYNAMIC_ARG_LIST15 const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14
+#define HX_DYNAMIC_ARG_LIST16 const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15
+#define HX_DYNAMIC_ARG_LIST17 const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16
+#define HX_DYNAMIC_ARG_LIST18 const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17
+#define HX_DYNAMIC_ARG_LIST19 const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18
+#define HX_DYNAMIC_ARG_LIST20 const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19
+#define HX_DYNAMIC_ARG_LIST21 const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20
+#define HX_DYNAMIC_ARG_LIST22 const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20,const Dynamic &inArg21
+#define HX_DYNAMIC_ARG_LIST23 const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20,const Dynamic &inArg21,const Dynamic &inArg22
+#define HX_DYNAMIC_ARG_LIST24 const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20,const Dynamic &inArg21,const Dynamic &inArg22,const Dynamic &inArg23
+#define HX_DYNAMIC_ARG_LIST25 const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20,const Dynamic &inArg21,const Dynamic &inArg22,const Dynamic &inArg23,const Dynamic &inArg24
+#define HX_DYNAMIC_ARG_LIST26 const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20,const Dynamic &inArg21,const Dynamic &inArg22,const Dynamic &inArg23,const Dynamic &inArg24,const Dynamic &inArg25
+
+
+#define HX_ARG_LIST0
+#define HX_ARG_LIST1 inArg0
+#define HX_ARG_LIST2 inArg0,inArg1
+#define HX_ARG_LIST3 inArg0,inArg1,inArg2
+#define HX_ARG_LIST4 inArg0,inArg1,inArg2,inArg3
+#define HX_ARG_LIST5 inArg0,inArg1,inArg2,inArg3,inArg4
+#define HX_ARG_LIST6 inArg0,inArg1,inArg2,inArg3,inArg4,inArg5
+#define HX_ARG_LIST7 inArg0,inArg1,inArg2,inArg3,inArg4,inArg5,inArg6
+#define HX_ARG_LIST8 inArg0,inArg1,inArg2,inArg3,inArg4,inArg5,inArg6,inArg7
+#define HX_ARG_LIST9 inArg0,inArg1,inArg2,inArg3,inArg4,inArg5,inArg6,inArg7,inArg8
+#define HX_ARG_LIST10 inArg0,inArg1,inArg2,inArg3,inArg4,inArg5,inArg6,inArg7,inArg8,inArg9
+#define HX_ARG_LIST11 inArg0,inArg1,inArg2,inArg3,inArg4,inArg5,inArg6,inArg7,inArg8,inArg9,inArg10
+#define HX_ARG_LIST12 inArg0,inArg1,inArg2,inArg3,inArg4,inArg5,inArg6,inArg7,inArg8,inArg9,inArg10,inArg11
+#define HX_ARG_LIST13 inArg0,inArg1,inArg2,inArg3,inArg4,inArg5,inArg6,inArg7,inArg8,inArg9,inArg10,inArg11,inArg12
+#define HX_ARG_LIST14 inArg0,inArg1,inArg2,inArg3,inArg4,inArg5,inArg6,inArg7,inArg8,inArg9,inArg10,inArg11,inArg12,inArg13
+#define HX_ARG_LIST15 inArg0,inArg1,inArg2,inArg3,inArg4,inArg5,inArg6,inArg7,inArg8,inArg9,inArg10,inArg11,inArg12,inArg13,inArg14
+#define HX_ARG_LIST16 inArg0,inArg1,inArg2,inArg3,inArg4,inArg5,inArg6,inArg7,inArg8,inArg9,inArg10,inArg11,inArg12,inArg13,inArg14,inArg15
+#define HX_ARG_LIST17 inArg0,inArg1,inArg2,inArg3,inArg4,inArg5,inArg6,inArg7,inArg8,inArg9,inArg10,inArg11,inArg12,inArg13,inArg14,inArg15,inArg16
+#define HX_ARG_LIST18 inArg0,inArg1,inArg2,inArg3,inArg4,inArg5,inArg6,inArg7,inArg8,inArg9,inArg10,inArg11,inArg12,inArg13,inArg14,inArg15,inArg16,inArg17
+#define HX_ARG_LIST19 inArg0,inArg1,inArg2,inArg3,inArg4,inArg5,inArg6,inArg7,inArg8,inArg9,inArg10,inArg11,inArg12,inArg13,inArg14,inArg15,inArg16,inArg17,inArg18
+#define HX_ARG_LIST20 inArg0,inArg1,inArg2,inArg3,inArg4,inArg5,inArg6,inArg7,inArg8,inArg9,inArg10,inArg11,inArg12,inArg13,inArg14,inArg15,inArg16,inArg17,inArg18,inArg19
+#define HX_ARG_LIST21 inArg0,inArg1,inArg2,inArg3,inArg4,inArg5,inArg6,inArg7,inArg8,inArg9,inArg10,inArg11,inArg12,inArg13,inArg14,inArg15,inArg16,inArg17,inArg18,inArg19,inArg20
+#define HX_ARG_LIST22 inArg0,inArg1,inArg2,inArg3,inArg4,inArg5,inArg6,inArg7,inArg8,inArg9,inArg10,inArg11,inArg12,inArg13,inArg14,inArg15,inArg16,inArg17,inArg18,inArg19,inArg20,inArg21
+#define HX_ARG_LIST23 inArg0,inArg1,inArg2,inArg3,inArg4,inArg5,inArg6,inArg7,inArg8,inArg9,inArg10,inArg11,inArg12,inArg13,inArg14,inArg15,inArg16,inArg17,inArg18,inArg19,inArg20,inArg21,inArg22
+#define HX_ARG_LIST24 inArg0,inArg1,inArg2,inArg3,inArg4,inArg5,inArg6,inArg7,inArg8,inArg9,inArg10,inArg11,inArg12,inArg13,inArg14,inArg15,inArg16,inArg17,inArg18,inArg19,inArg20,inArg21,inArg22,inArg23
+#define HX_ARG_LIST25 inArg0,inArg1,inArg2,inArg3,inArg4,inArg5,inArg6,inArg7,inArg8,inArg9,inArg10,inArg11,inArg12,inArg13,inArg14,inArg15,inArg16,inArg17,inArg18,inArg19,inArg20,inArg21,inArg22,inArg23,inArg24
+#define HX_ARG_LIST26 inArg0,inArg1,inArg2,inArg3,inArg4,inArg5,inArg6,inArg7,inArg8,inArg9,inArg10,inArg11,inArg12,inArg13,inArg14,inArg15,inArg16,inArg17,inArg18,inArg19,inArg20,inArg21,inArg22,inArg23,inArg24,inArg25
+
+#define HX_DEFINE_DYNAMIC_FUNC0(class,func,ret) \
+static ::Dynamic __##class##func( ::hx::Object *inObj) \
+{ \
+ ret reinterpret_cast<class *>(inObj)->func(); return ::Dynamic(); \
+}; \
+ ::Dynamic class::func##_dyn() \
+{\
+ return ::hx::CreateMemberFunction0(#func,this,__##class##func); \
+}
+
+
+#define HX_DEFINE_DYNAMIC_FUNC(class,N,func,ret,array_list,dynamic_arg_list,arg_list) \
+static ::Dynamic __##class##func( ::hx::Object *inObj, dynamic_arg_list) \
+{ \
+ ret reinterpret_cast<class *>(inObj)->func(arg_list); return ::Dynamic(); \
+}; \
+ ::Dynamic class::func##_dyn() \
+{\
+ return ::hx::CreateMemberFunction##N(#func,this,__##class##func); \
+}
+
+
+#define HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,N,func,ret,array_list,dynamic_arg_list,arg_list) \
+static ::Dynamic __##class##func( ::hx::Object *inObj, const Array< ::Dynamic> &inArgs) \
+{ \
+ ret reinterpret_cast<class *>(inObj)->func(array_list); return ::Dynamic(); \
+}; \
+ ::Dynamic class::func##_dyn() \
+{\
+ return ::hx::CreateMemberFunctionVar(#func,this,__##class##func,N); \
+}
+
+
+#define DELEGATE_0(ret,func) ret func() { return mDelegate->func(); }
+#define CDELEGATE_0(ret,func) ret func() const { return mDelegate->func(); }
+#define DELEGATE_1(ret,func,arg1) ret func(arg1 _a1) { return mDelegate->func(_a1); }
+#define CDELEGATE_1(ret,func,arg1) ret func(arg1 _a1) const { return mDelegate->func(_a1); }
+#define DELEGATE_2(ret,func,arg1,arg2) ret func(arg1 _a1,arg2 _a2) { return mDelegate->func(_a1,_a2); }
+
+
+
+
+
+#define HX_DECLARE_DYNAMIC_FUNC(func,dynamic_arg_list) \
+ ::Dynamic func##_dyn(dynamic_arg_list);
+
+#define STATIC_HX_DECLARE_DYNAMIC_FUNC(func,dynamic_arg_list) \
+ static ::Dynamic func##_dyn(dynamic_arg_list);
+
+
+
+
+
+#define HX_DEFINE_DYNAMIC_FUNC1(class,func,ret) \
+ HX_DEFINE_DYNAMIC_FUNC(class,1,func,ret,HX_ARR_LIST1,HX_DYNAMIC_ARG_LIST1,HX_ARG_LIST1)
+
+
+
+#define HX_DEFINE_DYNAMIC_FUNC2(class,func,ret) \
+ HX_DEFINE_DYNAMIC_FUNC(class,2,func,ret,HX_ARR_LIST2,HX_DYNAMIC_ARG_LIST2,HX_ARG_LIST2)
+
+
+
+#define HX_DEFINE_DYNAMIC_FUNC3(class,func,ret) \
+ HX_DEFINE_DYNAMIC_FUNC(class,3,func,ret,HX_ARR_LIST3,HX_DYNAMIC_ARG_LIST3,HX_ARG_LIST3)
+
+
+
+#define HX_DEFINE_DYNAMIC_FUNC4(class,func,ret) \
+ HX_DEFINE_DYNAMIC_FUNC(class,4,func,ret,HX_ARR_LIST4,HX_DYNAMIC_ARG_LIST4,HX_ARG_LIST4)
+
+
+
+#define HX_DEFINE_DYNAMIC_FUNC5(class,func,ret) \
+ HX_DEFINE_DYNAMIC_FUNC(class,5,func,ret,HX_ARR_LIST5,HX_DYNAMIC_ARG_LIST5,HX_ARG_LIST5)
+
+
+
+#define HX_DEFINE_DYNAMIC_FUNC6(class,func,ret) \
+ HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,6,func,ret,HX_ARR_LIST6,HX_DYNAMIC_ARG_LIST6,HX_ARG_LIST6)
+
+
+
+#define HX_DEFINE_DYNAMIC_FUNC7(class,func,ret) \
+ HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,7,func,ret,HX_ARR_LIST7,HX_DYNAMIC_ARG_LIST7,HX_ARG_LIST7)
+
+
+
+#define HX_DEFINE_DYNAMIC_FUNC8(class,func,ret) \
+ HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,8,func,ret,HX_ARR_LIST8,HX_DYNAMIC_ARG_LIST8,HX_ARG_LIST8)
+
+
+
+#define HX_DEFINE_DYNAMIC_FUNC9(class,func,ret) \
+ HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,9,func,ret,HX_ARR_LIST9,HX_DYNAMIC_ARG_LIST9,HX_ARG_LIST9)
+
+
+
+#define HX_DEFINE_DYNAMIC_FUNC10(class,func,ret) \
+ HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,10,func,ret,HX_ARR_LIST10,HX_DYNAMIC_ARG_LIST10,HX_ARG_LIST10)
+
+
+
+#define HX_DEFINE_DYNAMIC_FUNC11(class,func,ret) \
+ HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,11,func,ret,HX_ARR_LIST11,HX_DYNAMIC_ARG_LIST11,HX_ARG_LIST11)
+
+
+
+#define HX_DEFINE_DYNAMIC_FUNC12(class,func,ret) \
+ HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,12,func,ret,HX_ARR_LIST12,HX_DYNAMIC_ARG_LIST12,HX_ARG_LIST12)
+
+
+
+#define HX_DEFINE_DYNAMIC_FUNC13(class,func,ret) \
+ HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,13,func,ret,HX_ARR_LIST13,HX_DYNAMIC_ARG_LIST13,HX_ARG_LIST13)
+
+
+
+#define HX_DEFINE_DYNAMIC_FUNC14(class,func,ret) \
+ HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,14,func,ret,HX_ARR_LIST14,HX_DYNAMIC_ARG_LIST14,HX_ARG_LIST14)
+
+
+
+#define HX_DEFINE_DYNAMIC_FUNC15(class,func,ret) \
+ HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,15,func,ret,HX_ARR_LIST15,HX_DYNAMIC_ARG_LIST15,HX_ARG_LIST15)
+
+
+
+#define HX_DEFINE_DYNAMIC_FUNC16(class,func,ret) \
+ HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,16,func,ret,HX_ARR_LIST16,HX_DYNAMIC_ARG_LIST16,HX_ARG_LIST16)
+
+
+
+#define HX_DEFINE_DYNAMIC_FUNC17(class,func,ret) \
+ HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,17,func,ret,HX_ARR_LIST17,HX_DYNAMIC_ARG_LIST17,HX_ARG_LIST17)
+
+
+
+#define HX_DEFINE_DYNAMIC_FUNC18(class,func,ret) \
+ HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,18,func,ret,HX_ARR_LIST18,HX_DYNAMIC_ARG_LIST18,HX_ARG_LIST18)
+
+
+
+#define HX_DEFINE_DYNAMIC_FUNC19(class,func,ret) \
+ HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,19,func,ret,HX_ARR_LIST19,HX_DYNAMIC_ARG_LIST19,HX_ARG_LIST19)
+
+
+
+#define HX_DEFINE_DYNAMIC_FUNC20(class,func,ret) \
+ HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,20,func,ret,HX_ARR_LIST20,HX_DYNAMIC_ARG_LIST20,HX_ARG_LIST20)
+
+
+
+#define HX_DEFINE_DYNAMIC_FUNC21(class,func,ret) \
+ HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,21,func,ret,HX_ARR_LIST21,HX_DYNAMIC_ARG_LIST21,HX_ARG_LIST21)
+
+
+
+#define HX_DEFINE_DYNAMIC_FUNC22(class,func,ret) \
+ HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,22,func,ret,HX_ARR_LIST22,HX_DYNAMIC_ARG_LIST22,HX_ARG_LIST22)
+
+
+
+#define HX_DEFINE_DYNAMIC_FUNC23(class,func,ret) \
+ HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,23,func,ret,HX_ARR_LIST23,HX_DYNAMIC_ARG_LIST23,HX_ARG_LIST23)
+
+
+
+#define HX_DEFINE_DYNAMIC_FUNC24(class,func,ret) \
+ HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,24,func,ret,HX_ARR_LIST24,HX_DYNAMIC_ARG_LIST24,HX_ARG_LIST24)
+
+
+
+#define HX_DEFINE_DYNAMIC_FUNC25(class,func,ret) \
+ HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,25,func,ret,HX_ARR_LIST25,HX_DYNAMIC_ARG_LIST25,HX_ARG_LIST25)
+
+
+
+#define HX_DEFINE_DYNAMIC_FUNC26(class,func,ret) \
+ HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,26,func,ret,HX_ARR_LIST26,HX_DYNAMIC_ARG_LIST26,HX_ARG_LIST26)
+
+
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC0(class,func,ret) \
+static ::Dynamic __##class##func() \
+{ \
+ ret class::func(); return ::Dynamic(); \
+}; \
+ ::Dynamic class::func##_dyn() \
+{\
+ return ::hx::CreateStaticFunction0(#func,__##class##func); \
+}
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC(class,N,func,ret,array_list,dynamic_arg_list,arg_list) \
+static ::Dynamic __##class##func(dynamic_arg_list) \
+{ \
+ ret class::func(arg_list); return ::Dynamic(); \
+}; \
+ ::Dynamic class::func##_dyn() \
+{\
+ return ::hx::CreateStaticFunction##N(#func,__##class##func); \
+}
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,N,func,ret,array_list,dynamic_arg_list,arg_list) \
+static ::Dynamic __##class##func(const Array< ::Dynamic> &inArgs) \
+{ \
+ ret class::func(array_list); return ::Dynamic(); \
+}; \
+ ::Dynamic class::func##_dyn() \
+{\
+ return ::hx::CreateStaticFunctionVar(#func,__##class##func,N); \
+}
+
+
+
+
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC1(class,func,ret) \
+ STATIC_HX_DEFINE_DYNAMIC_FUNC(class,1,func,ret,HX_ARR_LIST1,HX_DYNAMIC_ARG_LIST1,HX_ARG_LIST1)
+
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC2(class,func,ret) \
+ STATIC_HX_DEFINE_DYNAMIC_FUNC(class,2,func,ret,HX_ARR_LIST2,HX_DYNAMIC_ARG_LIST2,HX_ARG_LIST2)
+
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC3(class,func,ret) \
+ STATIC_HX_DEFINE_DYNAMIC_FUNC(class,3,func,ret,HX_ARR_LIST3,HX_DYNAMIC_ARG_LIST3,HX_ARG_LIST3)
+
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC4(class,func,ret) \
+ STATIC_HX_DEFINE_DYNAMIC_FUNC(class,4,func,ret,HX_ARR_LIST4,HX_DYNAMIC_ARG_LIST4,HX_ARG_LIST4)
+
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC5(class,func,ret) \
+ STATIC_HX_DEFINE_DYNAMIC_FUNC(class,5,func,ret,HX_ARR_LIST5,HX_DYNAMIC_ARG_LIST5,HX_ARG_LIST5)
+
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC6(class,func,ret) \
+ STATIC_HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,6,func,ret,HX_ARR_LIST6,HX_DYNAMIC_ARG_LIST6,HX_ARG_LIST6)
+
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC7(class,func,ret) \
+ STATIC_HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,7,func,ret,HX_ARR_LIST7,HX_DYNAMIC_ARG_LIST7,HX_ARG_LIST7)
+
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC8(class,func,ret) \
+ STATIC_HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,8,func,ret,HX_ARR_LIST8,HX_DYNAMIC_ARG_LIST8,HX_ARG_LIST8)
+
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC9(class,func,ret) \
+ STATIC_HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,9,func,ret,HX_ARR_LIST9,HX_DYNAMIC_ARG_LIST9,HX_ARG_LIST9)
+
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC10(class,func,ret) \
+ STATIC_HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,10,func,ret,HX_ARR_LIST10,HX_DYNAMIC_ARG_LIST10,HX_ARG_LIST10)
+
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC11(class,func,ret) \
+ STATIC_HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,11,func,ret,HX_ARR_LIST11,HX_DYNAMIC_ARG_LIST11,HX_ARG_LIST11)
+
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC12(class,func,ret) \
+ STATIC_HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,12,func,ret,HX_ARR_LIST12,HX_DYNAMIC_ARG_LIST12,HX_ARG_LIST12)
+
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC13(class,func,ret) \
+ STATIC_HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,13,func,ret,HX_ARR_LIST13,HX_DYNAMIC_ARG_LIST13,HX_ARG_LIST13)
+
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC14(class,func,ret) \
+ STATIC_HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,14,func,ret,HX_ARR_LIST14,HX_DYNAMIC_ARG_LIST14,HX_ARG_LIST14)
+
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC15(class,func,ret) \
+ STATIC_HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,15,func,ret,HX_ARR_LIST15,HX_DYNAMIC_ARG_LIST15,HX_ARG_LIST15)
+
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC16(class,func,ret) \
+ STATIC_HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,16,func,ret,HX_ARR_LIST16,HX_DYNAMIC_ARG_LIST16,HX_ARG_LIST16)
+
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC17(class,func,ret) \
+ STATIC_HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,17,func,ret,HX_ARR_LIST17,HX_DYNAMIC_ARG_LIST17,HX_ARG_LIST17)
+
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC18(class,func,ret) \
+ STATIC_HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,18,func,ret,HX_ARR_LIST18,HX_DYNAMIC_ARG_LIST18,HX_ARG_LIST18)
+
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC19(class,func,ret) \
+ STATIC_HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,19,func,ret,HX_ARR_LIST19,HX_DYNAMIC_ARG_LIST19,HX_ARG_LIST19)
+
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC20(class,func,ret) \
+ STATIC_HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,20,func,ret,HX_ARR_LIST20,HX_DYNAMIC_ARG_LIST20,HX_ARG_LIST20)
+
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC21(class,func,ret) \
+ STATIC_HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,21,func,ret,HX_ARR_LIST21,HX_DYNAMIC_ARG_LIST21,HX_ARG_LIST21)
+
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC22(class,func,ret) \
+ STATIC_HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,22,func,ret,HX_ARR_LIST22,HX_DYNAMIC_ARG_LIST22,HX_ARG_LIST22)
+
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC23(class,func,ret) \
+ STATIC_HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,23,func,ret,HX_ARR_LIST23,HX_DYNAMIC_ARG_LIST23,HX_ARG_LIST23)
+
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC24(class,func,ret) \
+ STATIC_HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,24,func,ret,HX_ARR_LIST24,HX_DYNAMIC_ARG_LIST24,HX_ARG_LIST24)
+
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC25(class,func,ret) \
+ STATIC_HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,25,func,ret,HX_ARR_LIST25,HX_DYNAMIC_ARG_LIST25,HX_ARG_LIST25)
+
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC26(class,func,ret) \
+ STATIC_HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,26,func,ret,HX_ARR_LIST26,HX_DYNAMIC_ARG_LIST26,HX_ARG_LIST26)
+
+
+
+
+#define HX_DYNAMIC_CALL(ret,func,array_args,dyn_arg_list,arg_list) \
+ ::Dynamic __Run(const Array< ::Dynamic> &inArgs) { ret func( array_args ); return null();} \
+ ::Dynamic __run(dyn_arg_list) { ret func( arg_list ); return null();}
+
+
+#define HX_DYNAMIC_CALL0(ret,func) HX_DYNAMIC_CALL(ret,func,HX_ARR_LIST0,HX_DYNAMIC_ARG_LIST0,HX_ARG_LIST0)
+#define HX_DYNAMIC_CALL1(ret,func) HX_DYNAMIC_CALL(ret,func,HX_ARR_LIST1,HX_DYNAMIC_ARG_LIST1,HX_ARG_LIST1)
+#define HX_DYNAMIC_CALL2(ret,func) HX_DYNAMIC_CALL(ret,func,HX_ARR_LIST2,HX_DYNAMIC_ARG_LIST2,HX_ARG_LIST2)
+#define HX_DYNAMIC_CALL3(ret,func) HX_DYNAMIC_CALL(ret,func,HX_ARR_LIST3,HX_DYNAMIC_ARG_LIST3,HX_ARG_LIST3)
+#define HX_DYNAMIC_CALL4(ret,func) HX_DYNAMIC_CALL(ret,func,HX_ARR_LIST4,HX_DYNAMIC_ARG_LIST4,HX_ARG_LIST4)
+#define HX_DYNAMIC_CALL5(ret,func) HX_DYNAMIC_CALL(ret,func,HX_ARR_LIST5,HX_DYNAMIC_ARG_LIST5,HX_ARG_LIST5)
+#define HX_DYNAMIC_CALL6(ret,func) HX_DYNAMIC_CALL(ret,func,HX_ARR_LIST6,HX_DYNAMIC_ARG_LIST6,HX_ARG_LIST6)
+#define HX_DYNAMIC_CALL7(ret,func) HX_DYNAMIC_CALL(ret,func,HX_ARR_LIST7,HX_DYNAMIC_ARG_LIST7,HX_ARG_LIST7)
+#define HX_DYNAMIC_CALL8(ret,func) HX_DYNAMIC_CALL(ret,func,HX_ARR_LIST8,HX_DYNAMIC_ARG_LIST8,HX_ARG_LIST8)
+#define HX_DYNAMIC_CALL9(ret,func) HX_DYNAMIC_CALL(ret,func,HX_ARR_LIST9,HX_DYNAMIC_ARG_LIST9,HX_ARG_LIST9)
+#define HX_DYNAMIC_CALL10(ret,func) HX_DYNAMIC_CALL(ret,func,HX_ARR_LIST10,HX_DYNAMIC_ARG_LIST10,HX_ARG_LIST10)
+#define HX_DYNAMIC_CALL11(ret,func) HX_DYNAMIC_CALL(ret,func,HX_ARR_LIST11,HX_DYNAMIC_ARG_LIST11,HX_ARG_LIST11)
+#define HX_DYNAMIC_CALL12(ret,func) HX_DYNAMIC_CALL(ret,func,HX_ARR_LIST12,HX_DYNAMIC_ARG_LIST12,HX_ARG_LIST12)
+#define HX_DYNAMIC_CALL13(ret,func) HX_DYNAMIC_CALL(ret,func,HX_ARR_LIST13,HX_DYNAMIC_ARG_LIST13,HX_ARG_LIST13)
+#define HX_DYNAMIC_CALL14(ret,func) HX_DYNAMIC_CALL(ret,func,HX_ARR_LIST14,HX_DYNAMIC_ARG_LIST14,HX_ARG_LIST14)
+#define HX_DYNAMIC_CALL15(ret,func) HX_DYNAMIC_CALL(ret,func,HX_ARR_LIST15,HX_DYNAMIC_ARG_LIST15,HX_ARG_LIST15)
+#define HX_DYNAMIC_CALL16(ret,func) HX_DYNAMIC_CALL(ret,func,HX_ARR_LIST16,HX_DYNAMIC_ARG_LIST16,HX_ARG_LIST16)
+#define HX_DYNAMIC_CALL17(ret,func) HX_DYNAMIC_CALL(ret,func,HX_ARR_LIST17,HX_DYNAMIC_ARG_LIST17,HX_ARG_LIST17)
+#define HX_DYNAMIC_CALL18(ret,func) HX_DYNAMIC_CALL(ret,func,HX_ARR_LIST18,HX_DYNAMIC_ARG_LIST18,HX_ARG_LIST18)
+#define HX_DYNAMIC_CALL19(ret,func) HX_DYNAMIC_CALL(ret,func,HX_ARR_LIST19,HX_DYNAMIC_ARG_LIST19,HX_ARG_LIST19)
+#define HX_DYNAMIC_CALL20(ret,func) HX_DYNAMIC_CALL(ret,func,HX_ARR_LIST20,HX_DYNAMIC_ARG_LIST20,HX_ARG_LIST20)
+#define HX_DYNAMIC_CALL21(ret,func) HX_DYNAMIC_CALL(ret,func,HX_ARR_LIST21,HX_DYNAMIC_ARG_LIST21,HX_ARG_LIST21)
+#define HX_DYNAMIC_CALL22(ret,func) HX_DYNAMIC_CALL(ret,func,HX_ARR_LIST22,HX_DYNAMIC_ARG_LIST22,HX_ARG_LIST22)
+#define HX_DYNAMIC_CALL23(ret,func) HX_DYNAMIC_CALL(ret,func,HX_ARR_LIST23,HX_DYNAMIC_ARG_LIST23,HX_ARG_LIST23)
+#define HX_DYNAMIC_CALL24(ret,func) HX_DYNAMIC_CALL(ret,func,HX_ARR_LIST24,HX_DYNAMIC_ARG_LIST24,HX_ARG_LIST24)
+#define HX_DYNAMIC_CALL25(ret,func) HX_DYNAMIC_CALL(ret,func,HX_ARR_LIST25,HX_DYNAMIC_ARG_LIST25,HX_ARG_LIST25)
+#define HX_DYNAMIC_CALL26(ret,func) HX_DYNAMIC_CALL(ret,func,HX_ARR_LIST26,HX_DYNAMIC_ARG_LIST26,HX_ARG_LIST26)
+
+#define HX_BEGIN_DEFAULT_FUNC(name,t0) \
+ namespace { \
+ struct name : public ::hx::Object { int __GetType() const { return vtFunction; } \
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = ::hx::clsIdClosure }; \
+ ::hx::ObjectPtr<t0> __this; \
+ name( ::hx::ObjectPtr<t0> __0 = null()) : __this(__0) {} \
+ void __Mark( ::hx::MarkContext *__inCtx) { HX_MARK_MEMBER(__this); } \
+ void __Visit( ::hx::VisitContext *__inCtx) { HX_VISIT_MEMBER(__this); }
+
+
+#define HX_END_DEFAULT_FUNC \
+}
+
+#define HXARGC(x) int __ArgCount() const { return x; }
+
+#define HX_BEGIN_LOCAL_FUNC_S0(SUPER,name) \
+ struct name : public SUPER { \
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = ::hx::clsIdClosure }; \
+ void __Mark( ::hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); } \
+ void __Visit( ::hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); } \
+ name() {}
+
+
+#define HX_BEGIN_LOCAL_FUNC_S1(SUPER,name,t0,v0) \
+ struct name : public SUPER { \
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = ::hx::clsIdClosure }; \
+ t0 v0; \
+ void __Mark( ::hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); } \
+ void __Visit( ::hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); } \
+ name(t0 __0) : v0(__0) {}
+#define HX_BEGIN_LOCAL_FUNC_S2(SUPER,name,t0,v0,t1,v1) \
+ struct name : public SUPER { \
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = ::hx::clsIdClosure }; \
+ t0 v0;t1 v1; \
+ void __Mark( ::hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); } \
+ void __Visit( ::hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); } \
+ name(t0 __0,t1 __1) : v0(__0),v1(__1) {}
+#define HX_BEGIN_LOCAL_FUNC_S3(SUPER,name,t0,v0,t1,v1,t2,v2) \
+ struct name : public SUPER { \
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = ::hx::clsIdClosure }; \
+ t0 v0;t1 v1;t2 v2; \
+ void __Mark( ::hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); } \
+ void __Visit( ::hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); } \
+ name(t0 __0,t1 __1,t2 __2) : v0(__0),v1(__1),v2(__2) {}
+#define HX_BEGIN_LOCAL_FUNC_S4(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3) \
+ struct name : public SUPER { \
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = ::hx::clsIdClosure }; \
+ t0 v0;t1 v1;t2 v2;t3 v3; \
+ void __Mark( ::hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); } \
+ void __Visit( ::hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3) : v0(__0),v1(__1),v2(__2),v3(__3) {}
+#define HX_BEGIN_LOCAL_FUNC_S5(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4) \
+ struct name : public SUPER { \
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = ::hx::clsIdClosure }; \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4; \
+ void __Mark( ::hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); } \
+ void __Visit( ::hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4) {}
+#define HX_BEGIN_LOCAL_FUNC_S6(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \
+ struct name : public SUPER { \
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = ::hx::clsIdClosure }; \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5; \
+ void __Mark( ::hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); } \
+ void __Visit( ::hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5) {}
+#define HX_BEGIN_LOCAL_FUNC_S7(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6) \
+ struct name : public SUPER { \
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = ::hx::clsIdClosure }; \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6; \
+ void __Mark( ::hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); } \
+ void __Visit( ::hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6) {}
+#define HX_BEGIN_LOCAL_FUNC_S8(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7) \
+ struct name : public SUPER { \
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = ::hx::clsIdClosure }; \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7; \
+ void __Mark( ::hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); } \
+ void __Visit( ::hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7) {}
+#define HX_BEGIN_LOCAL_FUNC_S9(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8) \
+ struct name : public SUPER { \
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = ::hx::clsIdClosure }; \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8; \
+ void __Mark( ::hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); } \
+ void __Visit( ::hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8) {}
+#define HX_BEGIN_LOCAL_FUNC_S10(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9) \
+ struct name : public SUPER { \
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = ::hx::clsIdClosure }; \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9; \
+ void __Mark( ::hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); } \
+ void __Visit( ::hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9) {}
+#define HX_BEGIN_LOCAL_FUNC_S11(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10) \
+ struct name : public SUPER { \
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = ::hx::clsIdClosure }; \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10; \
+ void __Mark( ::hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); } \
+ void __Visit( ::hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10) {}
+#define HX_BEGIN_LOCAL_FUNC_S12(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11) \
+ struct name : public SUPER { \
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = ::hx::clsIdClosure }; \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11; \
+ void __Mark( ::hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); } \
+ void __Visit( ::hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11) {}
+#define HX_BEGIN_LOCAL_FUNC_S13(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12) \
+ struct name : public SUPER { \
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = ::hx::clsIdClosure }; \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12; \
+ void __Mark( ::hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); } \
+ void __Visit( ::hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12) {}
+#define HX_BEGIN_LOCAL_FUNC_S14(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13) \
+ struct name : public SUPER { \
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = ::hx::clsIdClosure }; \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13; \
+ void __Mark( ::hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); } \
+ void __Visit( ::hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13) {}
+#define HX_BEGIN_LOCAL_FUNC_S15(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14) \
+ struct name : public SUPER { \
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = ::hx::clsIdClosure }; \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14; \
+ void __Mark( ::hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); } \
+ void __Visit( ::hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14) {}
+#define HX_BEGIN_LOCAL_FUNC_S16(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15) \
+ struct name : public SUPER { \
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = ::hx::clsIdClosure }; \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15; \
+ void __Mark( ::hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); } \
+ void __Visit( ::hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15) {}
+#define HX_BEGIN_LOCAL_FUNC_S17(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16) \
+ struct name : public SUPER { \
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = ::hx::clsIdClosure }; \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16; \
+ void __Mark( ::hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); } \
+ void __Visit( ::hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16) {}
+#define HX_BEGIN_LOCAL_FUNC_S18(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17) \
+ struct name : public SUPER { \
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = ::hx::clsIdClosure }; \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17; \
+ void __Mark( ::hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); } \
+ void __Visit( ::hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17) {}
+#define HX_BEGIN_LOCAL_FUNC_S19(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18) \
+ struct name : public SUPER { \
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = ::hx::clsIdClosure }; \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18; \
+ void __Mark( ::hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); } \
+ void __Visit( ::hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18) {}
+
+#define HX_LOCAL_RUN _hx_run
+
+#define HX_END_LOCAL_FUNC0(ret) HX_DYNAMIC_CALL0(ret, HX_LOCAL_RUN ) };
+
+#define HX_END_LOCAL_FUNC1(ret) HX_DYNAMIC_CALL1(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC2(ret) HX_DYNAMIC_CALL2(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC3(ret) HX_DYNAMIC_CALL3(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC4(ret) HX_DYNAMIC_CALL4(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC5(ret) HX_DYNAMIC_CALL5(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC6(ret) HX_DYNAMIC_CALL6(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC7(ret) HX_DYNAMIC_CALL7(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC8(ret) HX_DYNAMIC_CALL8(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC9(ret) HX_DYNAMIC_CALL9(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC10(ret) HX_DYNAMIC_CALL10(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC11(ret) HX_DYNAMIC_CALL11(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC12(ret) HX_DYNAMIC_CALL12(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC13(ret) HX_DYNAMIC_CALL13(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC14(ret) HX_DYNAMIC_CALL14(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC15(ret) HX_DYNAMIC_CALL15(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC16(ret) HX_DYNAMIC_CALL16(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC17(ret) HX_DYNAMIC_CALL17(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC18(ret) HX_DYNAMIC_CALL18(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC19(ret) HX_DYNAMIC_CALL19(ret, HX_LOCAL_RUN ) };
+
+// For compatibility until next version of haxe is released
+#define HX_BEGIN_LOCAL_FUNC0(name) \
+ HX_BEGIN_LOCAL_FUNC_S0( ::hx::LocalFunc,name)
+
+#define HX_BEGIN_LOCAL_FUNC1(name,t0,v0) \
+ HX_BEGIN_LOCAL_FUNC_S1( ::hx::LocalFunc,name,t0,v0)
+#define HX_BEGIN_LOCAL_FUNC2(name,t0,v0,t1,v1) \
+ HX_BEGIN_LOCAL_FUNC_S2( ::hx::LocalFunc,name,t0,v0,t1,v1)
+#define HX_BEGIN_LOCAL_FUNC3(name,t0,v0,t1,v1,t2,v2) \
+ HX_BEGIN_LOCAL_FUNC_S3( ::hx::LocalFunc,name,t0,v0,t1,v1,t2,v2)
+#define HX_BEGIN_LOCAL_FUNC4(name,t0,v0,t1,v1,t2,v2,t3,v3) \
+ HX_BEGIN_LOCAL_FUNC_S4( ::hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3)
+#define HX_BEGIN_LOCAL_FUNC5(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4) \
+ HX_BEGIN_LOCAL_FUNC_S5( ::hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4)
+#define HX_BEGIN_LOCAL_FUNC6(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \
+ HX_BEGIN_LOCAL_FUNC_S6( ::hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5)
+#define HX_BEGIN_LOCAL_FUNC7(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6) \
+ HX_BEGIN_LOCAL_FUNC_S7( ::hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6)
+#define HX_BEGIN_LOCAL_FUNC8(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7) \
+ HX_BEGIN_LOCAL_FUNC_S8( ::hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7)
+#define HX_BEGIN_LOCAL_FUNC9(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8) \
+ HX_BEGIN_LOCAL_FUNC_S9( ::hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8)
+#define HX_BEGIN_LOCAL_FUNC10(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9) \
+ HX_BEGIN_LOCAL_FUNC_S10( ::hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9)
+#define HX_BEGIN_LOCAL_FUNC11(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10) \
+ HX_BEGIN_LOCAL_FUNC_S11( ::hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10)
+#define HX_BEGIN_LOCAL_FUNC12(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11) \
+ HX_BEGIN_LOCAL_FUNC_S12( ::hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11)
+#define HX_BEGIN_LOCAL_FUNC13(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12) \
+ HX_BEGIN_LOCAL_FUNC_S13( ::hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12)
+#define HX_BEGIN_LOCAL_FUNC14(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13) \
+ HX_BEGIN_LOCAL_FUNC_S14( ::hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13)
+#define HX_BEGIN_LOCAL_FUNC15(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14) \
+ HX_BEGIN_LOCAL_FUNC_S15( ::hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14)
+#define HX_BEGIN_LOCAL_FUNC16(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15) \
+ HX_BEGIN_LOCAL_FUNC_S16( ::hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15)
+#define HX_BEGIN_LOCAL_FUNC17(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16) \
+ HX_BEGIN_LOCAL_FUNC_S17( ::hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16)
+#define HX_BEGIN_LOCAL_FUNC18(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17) \
+ HX_BEGIN_LOCAL_FUNC_S18( ::hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17)
+#define HX_BEGIN_LOCAL_FUNC19(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18) \
+ HX_BEGIN_LOCAL_FUNC_S19( ::hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18)
+
+
+#define HX_DECLARE_DYNAMIC_FUNCTIONS \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20,const Dynamic &inArg21); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20,const Dynamic &inArg21,const Dynamic &inArg22); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20,const Dynamic &inArg21,const Dynamic &inArg22,const Dynamic &inArg23); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20,const Dynamic &inArg21,const Dynamic &inArg22,const Dynamic &inArg23,const Dynamic &inArg24); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20,const Dynamic &inArg21,const Dynamic &inArg22,const Dynamic &inArg23,const Dynamic &inArg24,const Dynamic &inArg25); \
+
+
+
+#define HX_DECLARE_VARIANT_FUNCTIONS \
+ inline ::Dynamic operator()(); \
+ inline ::Dynamic operator()(const Dynamic &inArg0); \
+ inline ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1); \
+ inline ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2); \
+ inline ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3); \
+ inline ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20,const Dynamic &inArg21); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20,const Dynamic &inArg21,const Dynamic &inArg22); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20,const Dynamic &inArg21,const Dynamic &inArg22,const Dynamic &inArg23); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20,const Dynamic &inArg21,const Dynamic &inArg22,const Dynamic &inArg23,const Dynamic &inArg24); \
+ ::Dynamic operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4,const Dynamic &inArg5,const Dynamic &inArg6,const Dynamic &inArg7,const Dynamic &inArg8,const Dynamic &inArg9,const Dynamic &inArg10,const Dynamic &inArg11,const Dynamic &inArg12,const Dynamic &inArg13,const Dynamic &inArg14,const Dynamic &inArg15,const Dynamic &inArg16,const Dynamic &inArg17,const Dynamic &inArg18,const Dynamic &inArg19,const Dynamic &inArg20,const Dynamic &inArg21,const Dynamic &inArg22,const Dynamic &inArg23,const Dynamic &inArg24,const Dynamic &inArg25); \
+
+
+
+#define HX_IMPLEMENT_INLINE_VARIANT_FUNCTIONS \
+ ::Dynamic Variant::operator()() { CheckFPtr(); return valObject->__run(); } \
+ ::Dynamic Variant::operator()(const Dynamic &inArg0) { CheckFPtr(); return valObject->__run(inArg0); } \
+ ::Dynamic Variant::operator()(const Dynamic &inArg0,const Dynamic &inArg1) { CheckFPtr(); return valObject->__run(inArg0,inArg1); } \
+ ::Dynamic Variant::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2) { CheckFPtr(); return valObject->__run(inArg0,inArg1,inArg2); } \
+ ::Dynamic Variant::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3) { CheckFPtr(); return valObject->__run(inArg0,inArg1,inArg2,inArg3); } \
+ ::Dynamic Variant::operator()(const Dynamic &inArg0,const Dynamic &inArg1,const Dynamic &inArg2,const Dynamic &inArg3,const Dynamic &inArg4) { CheckFPtr(); return valObject->__run(inArg0,inArg1,inArg2,inArg3,inArg4); } \
+
+
+
+#endif
+
+
diff --git a/Sources/c_snikket/iinclude/hx/Macros.tpl b/Sources/c_snikket/iinclude/hx/Macros.tpl
new file mode 100644
index 0000000..bae9abf
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/Macros.tpl
@@ -0,0 +1,191 @@
+#ifndef HX_MACROS_H
+#define HX_MACROS_H
+
+// --- Functions and their parameters ----
+
+::foreach PARAMS::
+#define HX_ARR_LIST::ARG:: ::ARR_LIST::::end::
+
+::foreach PARAMS::
+#define HX_DYNAMIC_ARG_LIST::ARG:: ::DYNAMIC_ARG_LIST::::end::
+
+::foreach PARAMS::
+#define HX_ARG_LIST::ARG:: ::ARG_LIST::::end::
+
+#define HX_DEFINE_DYNAMIC_FUNC0(class,func,ret) \
+static ::NS::Dynamic __##class##func(::hxNS::Object *inObj) \
+{ \
+ ret reinterpret_cast<class *>(inObj)->func(); return ::NS::Dynamic(); \
+}; \
+ ::NS::Dynamic class::func##_dyn() \
+{\
+ return ::hxNS::CreateMemberFunction0(#func,this,__##class##func); \
+}
+
+
+#define HX_DEFINE_DYNAMIC_FUNC(class,N,func,ret,array_list,dynamic_arg_list,arg_list) \
+static ::NS::Dynamic __##class##func(::hxNS::Object *inObj, dynamic_arg_list) \
+{ \
+ ret reinterpret_cast<class *>(inObj)->func(arg_list); return ::NS::Dynamic(); \
+}; \
+ ::NS::Dynamic class::func##_dyn() \
+{\
+ return ::hxNS::CreateMemberFunction##N(#func,this,__##class##func); \
+}
+
+
+#define HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,N,func,ret,array_list,dynamic_arg_list,arg_list) \
+static ::NS::Dynamic __##class##func(::hxNS::Object *inObj, const Array< ::NS::Dynamic> &inArgs) \
+{ \
+ ret reinterpret_cast<class *>(inObj)->func(array_list); return ::NS::Dynamic(); \
+}; \
+ ::NS::Dynamic class::func##_dyn() \
+{\
+ return ::hxNS::CreateMemberFunctionVar(#func,this,__##class##func,N); \
+}
+
+
+#define DELEGATE_0(ret,func) ret func() { return mDelegate->func(); }
+#define CDELEGATE_0(ret,func) ret func() const { return mDelegate->func(); }
+#define DELEGATE_1(ret,func,arg1) ret func(arg1 _a1) { return mDelegate->func(_a1); }
+#define CDELEGATE_1(ret,func,arg1) ret func(arg1 _a1) const { return mDelegate->func(_a1); }
+#define DELEGATE_2(ret,func,arg1,arg2) ret func(arg1 _a1,arg2 _a2) { return mDelegate->func(_a1,_a2); }
+
+
+
+
+
+#define HX_DECLARE_DYNAMIC_FUNC(func,dynamic_arg_list) \
+ ::NS::Dynamic func##_dyn(dynamic_arg_list);
+
+#define STATIC_HX_DECLARE_DYNAMIC_FUNC(func,dynamic_arg_list) \
+ static ::NS::Dynamic func##_dyn(dynamic_arg_list);
+
+
+::foreach PARAMS::
+::if (ARG>0)::::if (ARG<6)::
+#define HX_DEFINE_DYNAMIC_FUNC::ARG::(class,func,ret) \
+ HX_DEFINE_DYNAMIC_FUNC(class,::ARG::,func,ret,HX_ARR_LIST::ARG::,HX_DYNAMIC_ARG_LIST::ARG::,HX_ARG_LIST::ARG::)
+::else::
+#define HX_DEFINE_DYNAMIC_FUNC::ARG::(class,func,ret) \
+ HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,::ARG::,func,ret,HX_ARR_LIST::ARG::,HX_DYNAMIC_ARG_LIST::ARG::,HX_ARG_LIST::ARG::)
+::end::
+::end::::end::
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC0(class,func,ret) \
+static ::NS::Dynamic __##class##func() \
+{ \
+ ret class::func(); return ::NS::Dynamic(); \
+}; \
+ ::NS::Dynamic class::func##_dyn() \
+{\
+ return ::hxNS::CreateStaticFunction0(#func,__##class##func); \
+}
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC(class,N,func,ret,array_list,dynamic_arg_list,arg_list) \
+static ::NS::Dynamic __##class##func(dynamic_arg_list) \
+{ \
+ ret class::func(arg_list); return ::NS::Dynamic(); \
+}; \
+ ::NS::Dynamic class::func##_dyn() \
+{\
+ return ::hxNS::CreateStaticFunction##N(#func,__##class##func); \
+}
+
+
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,N,func,ret,array_list,dynamic_arg_list,arg_list) \
+static ::NS::Dynamic __##class##func(const Array< ::NS::Dynamic> &inArgs) \
+{ \
+ ret class::func(array_list); return ::NS::Dynamic(); \
+}; \
+ ::NS::Dynamic class::func##_dyn() \
+{\
+ return ::hxNS::CreateStaticFunctionVar(#func,__##class##func,N); \
+}
+
+
+
+::foreach PARAMS::
+::if (ARG>0)::::if (ARG<6)::
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC::ARG::(class,func,ret) \
+ STATIC_HX_DEFINE_DYNAMIC_FUNC(class,::ARG::,func,ret,HX_ARR_LIST::ARG::,HX_DYNAMIC_ARG_LIST::ARG::,HX_ARG_LIST::ARG::)
+::else::
+#define STATIC_HX_DEFINE_DYNAMIC_FUNC::ARG::(class,func,ret) \
+ STATIC_HX_DEFINE_DYNAMIC_FUNC_EXTRA(class,::ARG::,func,ret,HX_ARR_LIST::ARG::,HX_DYNAMIC_ARG_LIST::ARG::,HX_ARG_LIST::ARG::)
+::end::
+::end::::end::
+
+
+#define HX_DYNAMIC_CALL(ret,func,array_args,dyn_arg_list,arg_list) \
+ ::NS::Dynamic __Run(const Array< ::NS::Dynamic> &inArgs) { ret func( array_args ); return null();} \
+ ::NS::Dynamic __run(dyn_arg_list) { ret func( arg_list ); return null();}
+
+::foreach PARAMS::
+#define HX_DYNAMIC_CALL::ARG::(ret,func) HX_DYNAMIC_CALL(ret,func,HX_ARR_LIST::ARG::,HX_DYNAMIC_ARG_LIST::ARG::,HX_ARG_LIST::ARG::)::end::
+
+#define HX_BEGIN_DEFAULT_FUNC(name,t0) \
+ namespace { \
+ struct name : public ::hxNS::Object { int __GetType() const { return vtFunction; } \
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = ::hxNS::clsIdClosure }; \
+ ::hxNS::ObjectPtr<t0> __this; \
+ name(::hxNS::ObjectPtr<t0> __0 = null()) : __this(__0) {} \
+ void __Mark(::hxNS::MarkContext *__inCtx) { HX_MARK_MEMBER(__this); } \
+ void __Visit(::hxNS::VisitContext *__inCtx) { HX_VISIT_MEMBER(__this); }
+
+
+#define HX_END_DEFAULT_FUNC \
+}
+
+#define HXARGC(x) int __ArgCount() const { return x; }
+
+#define HX_BEGIN_LOCAL_FUNC_S0(SUPER,name) \
+ struct name : public SUPER { \
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = ::hxNS::clsIdClosure }; \
+ void __Mark(::hxNS::MarkContext *__inCtx) { DoMarkThis(__inCtx); } \
+ void __Visit(::hxNS::VisitContext *__inCtx) { DoVisitThis(__inCtx); } \
+ name() {}
+
+::foreach LOCALS::
+#define HX_BEGIN_LOCAL_FUNC_S::ARG::(SUPER,name,::TYPE_ARGS::) \
+ struct name : public SUPER { \
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = ::hxNS::clsIdClosure }; \
+ ::TYPE_DECL::; \
+ void __Mark(::hxNS::MarkContext *__inCtx) { DoMarkThis(__inCtx); ::MARKS:: } \
+ void __Visit(::hxNS::VisitContext *__inCtx) { DoVisitThis(__inCtx); ::VISITS:: } \
+ name(::CONSTRUCT_ARGS::) : ::CONSTRUCT_VARS:: {}::end::
+
+#define HX_LOCAL_RUN _hx_run
+
+#define HX_END_LOCAL_FUNC0(ret) HX_DYNAMIC_CALL0(ret, HX_LOCAL_RUN ) };
+::foreach LOCALS::
+#define HX_END_LOCAL_FUNC::ARG::(ret) HX_DYNAMIC_CALL::ARG::(ret, HX_LOCAL_RUN ) };::end::
+
+// For compatibility until next version of haxe is released
+#define HX_BEGIN_LOCAL_FUNC0(name) \
+ HX_BEGIN_LOCAL_FUNC_S0(::hxNS::LocalFunc,name)
+::foreach LOCALS::
+#define HX_BEGIN_LOCAL_FUNC::ARG::(name,::TYPE_ARGS::) \
+ HX_BEGIN_LOCAL_FUNC_S::ARG::(::hxNS::LocalFunc,name,::TYPE_ARGS::)::end::
+
+
+#define HX_DECLARE_DYNAMIC_FUNCTIONS \
+::foreach PARAMS:: ::if (ARG<6)::::else:: ::NS::Dynamic operator()(::DYNAMIC_ARG_LIST::); \
+::end:: ::end::
+
+
+#define HX_DECLARE_VARIANT_FUNCTIONS \
+::foreach PARAMS:: ::if (ARG<6):: inline ::NS::Dynamic operator()(::DYNAMIC_ARG_LIST::); \
+::else:: ::NS::Dynamic operator()(::DYNAMIC_ARG_LIST::); \
+::end:: ::end::
+
+
+#define HX_IMPLEMENT_INLINE_VARIANT_FUNCTIONS \
+::foreach PARAMS:: ::if (ARG<6):: ::NS::Dynamic Variant::NS::operator()(::DYNAMIC_ARG_LIST::) { CheckFPtr(); return valObject->__run(::ARG_LIST::); } \
+::end:: ::end::
+
+
+#endif
+
+
diff --git a/Sources/c_snikket/iinclude/hx/MacrosFixed.h b/Sources/c_snikket/iinclude/hx/MacrosFixed.h
new file mode 100644
index 0000000..d3c194a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/MacrosFixed.h
@@ -0,0 +1,320 @@
+#ifndef MACROS_FIXED_H
+#define MACROS_FIXED_H
+
+// ---- Forward Declare ---------------
+
+
+#define HX_DECLARE_CLASS0(klass) \
+ class klass##_obj; \
+ typedef ::hx::ObjectPtr<klass##_obj> klass;
+#define HX_DECLARE_CLASS1(ns1,klass) namespace ns1 { HX_DECLARE_CLASS0(klass) }
+#define HX_DECLARE_CLASS2(ns2,ns1,klass) namespace ns2 { HX_DECLARE_CLASS1(ns1,klass) }
+#define HX_DECLARE_CLASS3(ns3,ns2,ns1,klass) namespace ns3 { HX_DECLARE_CLASS2(ns2,ns1,klass) }
+#define HX_DECLARE_CLASS4(ns4,ns3,ns2,ns1,klass) namespace ns4 { HX_DECLARE_CLASS3(ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS5(ns5,ns4,ns3,ns2,ns1,klass) namespace ns5 { HX_DECLARE_CLASS4(ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS6(ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns6 { HX_DECLARE_CLASS5(ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS7(ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns7 { HX_DECLARE_CLASS6(ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS8(ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns8 { HX_DECLARE_CLASS7(ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS9(ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns9 { HX_DECLARE_CLASS8(ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS10(ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns10 { HX_DECLARE_CLASS9(ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS11(ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns11 { HX_DECLARE_CLASS10(ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS12(ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns12 { HX_DECLARE_CLASS11(ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS13(ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns13 { HX_DECLARE_CLASS12(ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS14(ns14,ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns14 { HX_DECLARE_CLASS13(ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS15(ns15,ns14,ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns15 { HX_DECLARE_CLASS14(ns14,ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS16(ns16,ns15,ns14,ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns16 { HX_DECLARE_CLASS15(ns15,ns14,ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS17(ns17,ns16,ns15,ns14,ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns17 { HX_DECLARE_CLASS16(ns16,ns15,ns14,ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS18(ns18,ns17,ns16,ns15,ns14,ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns18 { HX_DECLARE_CLASS17(ns17,ns16,ns15,ns14,ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS19(ns19,ns18,ns17,ns16,ns15,ns14,ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns19 { HX_DECLARE_CLASS18(ns18,ns17,ns16,ns15,ns14,ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_CLASS20(ns20,ns19,ns18,ns17,ns16,ns15,ns14,ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns20 { HX_DECLARE_CLASS19(ns19,ns18,ns17,ns16,ns15,ns14,ns13,ns12,ns11,ns10,ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+
+// ---- Enum ----------------------
+
+#define HX_DEFINE_CREATE_ENUM(enum_obj) \
+static ::Dynamic Create##enum_obj(::String inName,::hx::DynamicArray inArgs) \
+{ \
+ int count = enum_obj::__FindArgCount(inName); \
+ int args = inArgs.GetPtr() ? inArgs.__length() : 0; \
+ if (args!=count) __hxcpp_dbg_checkedThrow(HX_INVALID_ENUM_ARG_COUNT(#enum_obj, inName, count, args)); \
+ ::Dynamic result; \
+ if (!enum_obj::__GetStatic(inName,result,::hx::paccDynamic)) __hxcpp_dbg_checkedThrow(HX_INVALID_ENUM_CONSTRUCTOR(#enum_obj, inName)); \
+ if (args==0) return result; \
+ return result->__Run(inArgs); \
+}
+
+// ---- Fields ----------------------
+
+#define HX_IS_INSTANCE_OF bool _hx_isInstanceOf(int inClassId) { return inClassId==1 || inClassId==(int)_hx_ClassId; }
+
+#define HX_DO_RTTI_ALL \
+ static ::hx::ObjectPtr< ::hx::Class_obj> __mClass; \
+ ::hx::ObjectPtr< ::hx::Class_obj > __GetClass() const { return __mClass; } \
+ inline static ::hx::ObjectPtr< ::hx::Class_obj> &__SGetClass() { return __mClass; } \
+ inline operator super *() { return this; }
+
+#define HX_DO_RTTI \
+ HX_DO_RTTI_ALL \
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp); \
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp); \
+ void __GetFields(Array< ::String> &outFields);
+
+#define HX_DO_INTERFACE_RTTI \
+ static ::hx::ObjectPtr< ::hx::Class_obj> __mClass; \
+ static ::hx::ObjectPtr< ::hx::Class_obj> &__SGetClass() { return __mClass; } \
+ static void __register();
+
+#define HX_DO_ENUM_RTTI_INTERNAL \
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp); \
+ static int __FindIndex(::String inName); \
+ static int __FindArgCount(::String inName);
+
+#define HX_DO_ENUM_RTTI \
+ HX_DO_ENUM_RTTI_INTERNAL \
+ static ::hx::ObjectPtr< ::hx::Class_obj> __mClass; \
+ ::hx::ObjectPtr< ::hx::Class_obj > __GetClass() const { return __mClass; } \
+ static ::hx::ObjectPtr< ::hx::Class_obj> &__SGetClass() { return __mClass; }
+
+
+#define HX_DECLARE_IMPLEMENT_DYNAMIC ::Dynamic __mDynamicFields; \
+ ::Dynamic *__GetFieldMap() { return &__mDynamicFields; } \
+ bool __HasField(const String &inString) \
+ { return ::hx::FieldMapHas(&__mDynamicFields,inString) || super::__HasField(inString); }
+
+
+#define HX_INIT_IMPLEMENT_DYNAMIC
+
+#define HX_MARK_DYNAMIC HX_MARK_MEMBER(__mDynamicFields)
+
+
+#ifdef HX_VISIT_ALLOCS
+
+#define HX_VISIT_DYNAMIC HX_VISIT_MEMBER(__mDynamicFields);
+
+#else
+
+#define HX_VISIT_DYNAMIC do { } while (0);
+
+#endif
+
+#define HX_CHECK_DYNAMIC_GET_FIELD(inName) \
+ { ::Dynamic d; if (::hx::FieldMapGet(&__mDynamicFields,inName,d)) return d; }
+
+#define HX_CHECK_DYNAMIC_GET_INT_FIELD(inID) \
+ { ::Dynamic d; if (::hx::FieldMapGet(&__mDynamicFields,inID,d)) return d; }
+
+#ifdef HXCPP_GC_GENERATIONAL
+#define HX_DYNAMIC_SET_FIELD(inName,inValue) ::hx::FieldMapSet(this,&__mDynamicFields,inName,inValue)
+#else
+#define HX_DYNAMIC_SET_FIELD(inName,inValue) ::hx::FieldMapSet(&__mDynamicFields,inName,inValue)
+#endif
+
+#define HX_APPEND_DYNAMIC_FIELDS(outFields) ::hx::FieldMapAppendFields(&__mDynamicFields,outFields)
+
+
+
+
+
+
+// ---- Main ---------------
+
+
+namespace hx {
+HXCPP_EXTERN_CLASS_ATTRIBUTES void SetTopOfStack(int *inTopOfStack,bool);
+}
+#define HX_TOP_OF_STACK \
+ int t0 = 99; \
+ ::hx::SetTopOfStack(&t0,false);
+
+
+#ifdef __GNUC__
+ #define EXPORT_EXTRA __attribute__ ((visibility("default")))
+#else
+ #define EXPORT_EXTRA __declspec(dllexport)
+#endif
+
+#ifdef HX_DECLARE_MAIN
+
+#ifdef HXCPP_DLL_IMPORT
+
+#define HX_BEGIN_MAIN \
+ extern "C" { \
+ EXPORT_EXTRA void __main__() { \
+ __boot_all();
+
+#define HX_END_MAIN \
+} \
+}
+
+
+#elif defined(HX_ANDROID)
+ #ifdef HXCPP_EXE_LINK
+ #define HX_BEGIN_MAIN \
+ \
+ int main(int argc,char **argv){ \
+ HX_TOP_OF_STACK \
+ ::hx::Boot(); \
+ try{ \
+ __boot_all();
+
+ #define HX_END_MAIN \
+ } \
+ catch ( ::Dynamic e){ \
+ __hx_dump_stack(); \
+ printf("Error : %s\n",e->toString().__CStr()); \
+ return -1; \
+ } \
+ return 0; \
+ }
+
+ #else
+ // Java Main....
+ #include <jni.h>
+ #include <hx/Thread.h>
+ #include <android/log.h>
+
+ #define HX_BEGIN_MAIN \
+ extern "C" EXPORT_EXTRA void hxcpp_main() { \
+ HX_TOP_OF_STACK \
+ try { \
+ ::hx::Boot(); \
+ __boot_all();
+
+
+ #define HX_END_MAIN \
+ } catch ( ::Dynamic e) { \
+ __hx_dump_stack(); \
+ __android_log_print(ANDROID_LOG_ERROR, "Exception", "%s", e->toString().__CStr()); \
+ }\
+ ::hx::SetTopOfStack((int *)0,true); \
+ } \
+ \
+ extern "C" EXPORT_EXTRA JNIEXPORT void JNICALL Java_org_haxe_HXCPP_main(JNIEnv * env) \
+ { hxcpp_main(); }
+ #endif
+
+#elif defined(HX_WINRT)
+
+#include <Roapi.h>
+
+#define HX_BEGIN_MAIN \
+[ Platform::MTAThread ] \
+int main(Platform::Array<Platform::String^>^) \
+{ \
+ HX_TOP_OF_STACK \
+ RoInitialize(RO_INIT_MULTITHREADED); \
+ ::hx::Boot(); \
+ try{ \
+ __boot_all();
+
+#define HX_END_MAIN \
+ } \
+ catch ( ::Dynamic e){ \
+ __hx_dump_stack(); \
+ return -1; \
+ } \
+ return 0; \
+}
+
+#elif defined(HX_WIN_MAIN)
+
+
+#ifdef HAVE_WINDOWS_H
+
+#define HX_BEGIN_MAIN \
+int __stdcall WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) \
+{ \
+ HX_TOP_OF_STACK \
+ ::hx::Boot(); \
+ try{ \
+ __boot_all();
+
+#else
+
+#define HX_BEGIN_MAIN \
+extern "C" int __stdcall MessageBoxA(void *,const char *,const char *,int); \
+\
+int __stdcall WinMain( void * hInstance, void * hPrevInstance, const char *lpCmdLine, int nCmdShow) \
+{ \
+ HX_TOP_OF_STACK \
+ ::hx::Boot(); \
+ try{ \
+ __boot_all();
+
+#endif
+
+#define HX_END_MAIN \
+ } \
+ catch ( ::Dynamic e){ \
+ __hx_dump_stack(); \
+ MessageBoxA(0, e->toString().__CStr(), "Error", 0); \
+ return -1; \
+ } \
+ return 0; \
+}
+
+
+#elif defined(TIZEN)
+
+
+#define HX_BEGIN_MAIN \
+\
+extern "C" EXPORT_EXTRA int OspMain (int argc, char* pArgv[]){ \
+ HX_TOP_OF_STACK \
+ ::hx::Boot(); \
+ try{ \
+ __boot_all();
+
+#define HX_END_MAIN \
+ } \
+ catch ( ::Dynamic e){ \
+ __hx_dump_stack(); \
+ printf("Error : %s\n",e->toString().__CStr()); \
+ return -1; \
+ } \
+ return 0; \
+}
+
+
+#else
+// Console Main ...
+
+#define HX_BEGIN_MAIN \
+\
+int main(int argc,char **argv){ \
+ HX_TOP_OF_STACK \
+ ::hx::Boot(); \
+ try{ \
+ __boot_all();
+
+#define HX_END_MAIN \
+ } \
+ catch ( ::Dynamic e){ \
+ __hx_dump_stack(); \
+ printf("Error : %s\n",e->toString().__CStr()); \
+ return -1; \
+ } \
+ return 0; \
+}
+
+#endif
+
+#endif // HX_DECLARE_MAIN
+
+// Run as library
+#define HX_BEGIN_LIB_MAIN \
+extern "C" {\
+\
+void __hxcpp_lib_main() \
+{ \
+ HX_TOP_OF_STACK \
+ ::hx::Boot(); \
+ __boot_all();
+
+#define HX_END_LIB_MAIN \
+} }
+
+
+
+#endif
+
+
diff --git a/Sources/c_snikket/iinclude/hx/MacrosJumbo.h b/Sources/c_snikket/iinclude/hx/MacrosJumbo.h
new file mode 100644
index 0000000..52b6d93
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/MacrosJumbo.h
@@ -0,0 +1,402 @@
+// ## ## ## ## #### ## ## ## ## ## #### ##
+// ## ## ## ## ## ## ## ### ## ## ### ## ## ##
+// ## ## ## ###### ###### ###### ## ###### ## ### ##
+// ## ## ## ## ## ## ## ## ### ## ## ### ## ##
+// ## ## ## ## ## ## ## ## ## ## ## #### ##
+
+// DO NOT EDIT
+// This file is generated from the .tpl file
+#ifndef HX_MACROS_JUMBO_H
+#define HX_MACROS_JUMBO_H
+
+
+#define HX_BEGIN_LOCAL_FUNC_S20(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19) {}
+#define HX_BEGIN_LOCAL_FUNC_S21(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20) {}
+#define HX_BEGIN_LOCAL_FUNC_S22(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21) {}
+#define HX_BEGIN_LOCAL_FUNC_S23(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22) {}
+#define HX_BEGIN_LOCAL_FUNC_S24(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23) {}
+#define HX_BEGIN_LOCAL_FUNC_S25(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24) {}
+#define HX_BEGIN_LOCAL_FUNC_S26(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25) {}
+#define HX_BEGIN_LOCAL_FUNC_S27(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26) {}
+#define HX_BEGIN_LOCAL_FUNC_S28(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27) {}
+#define HX_BEGIN_LOCAL_FUNC_S29(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28) {}
+#define HX_BEGIN_LOCAL_FUNC_S30(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29) {}
+#define HX_BEGIN_LOCAL_FUNC_S31(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30) {}
+#define HX_BEGIN_LOCAL_FUNC_S32(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31) {}
+#define HX_BEGIN_LOCAL_FUNC_S33(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32) {}
+#define HX_BEGIN_LOCAL_FUNC_S34(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32;t33 v33; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); HX_MARK_MEMBER(v33); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); HX_VISIT_MEMBER(v33); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32,t33 __33) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32),v33(__33) {}
+#define HX_BEGIN_LOCAL_FUNC_S35(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32;t33 v33;t34 v34; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); HX_MARK_MEMBER(v33); HX_MARK_MEMBER(v34); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); HX_VISIT_MEMBER(v33); HX_VISIT_MEMBER(v34); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32,t33 __33,t34 __34) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32),v33(__33),v34(__34) {}
+#define HX_BEGIN_LOCAL_FUNC_S36(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32;t33 v33;t34 v34;t35 v35; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); HX_MARK_MEMBER(v33); HX_MARK_MEMBER(v34); HX_MARK_MEMBER(v35); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); HX_VISIT_MEMBER(v33); HX_VISIT_MEMBER(v34); HX_VISIT_MEMBER(v35); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32,t33 __33,t34 __34,t35 __35) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32),v33(__33),v34(__34),v35(__35) {}
+#define HX_BEGIN_LOCAL_FUNC_S37(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32;t33 v33;t34 v34;t35 v35;t36 v36; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); HX_MARK_MEMBER(v33); HX_MARK_MEMBER(v34); HX_MARK_MEMBER(v35); HX_MARK_MEMBER(v36); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); HX_VISIT_MEMBER(v33); HX_VISIT_MEMBER(v34); HX_VISIT_MEMBER(v35); HX_VISIT_MEMBER(v36); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32,t33 __33,t34 __34,t35 __35,t36 __36) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32),v33(__33),v34(__34),v35(__35),v36(__36) {}
+#define HX_BEGIN_LOCAL_FUNC_S38(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32;t33 v33;t34 v34;t35 v35;t36 v36;t37 v37; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); HX_MARK_MEMBER(v33); HX_MARK_MEMBER(v34); HX_MARK_MEMBER(v35); HX_MARK_MEMBER(v36); HX_MARK_MEMBER(v37); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); HX_VISIT_MEMBER(v33); HX_VISIT_MEMBER(v34); HX_VISIT_MEMBER(v35); HX_VISIT_MEMBER(v36); HX_VISIT_MEMBER(v37); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32,t33 __33,t34 __34,t35 __35,t36 __36,t37 __37) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32),v33(__33),v34(__34),v35(__35),v36(__36),v37(__37) {}
+#define HX_BEGIN_LOCAL_FUNC_S39(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32;t33 v33;t34 v34;t35 v35;t36 v36;t37 v37;t38 v38; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); HX_MARK_MEMBER(v33); HX_MARK_MEMBER(v34); HX_MARK_MEMBER(v35); HX_MARK_MEMBER(v36); HX_MARK_MEMBER(v37); HX_MARK_MEMBER(v38); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); HX_VISIT_MEMBER(v33); HX_VISIT_MEMBER(v34); HX_VISIT_MEMBER(v35); HX_VISIT_MEMBER(v36); HX_VISIT_MEMBER(v37); HX_VISIT_MEMBER(v38); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32,t33 __33,t34 __34,t35 __35,t36 __36,t37 __37,t38 __38) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32),v33(__33),v34(__34),v35(__35),v36(__36),v37(__37),v38(__38) {}
+#define HX_BEGIN_LOCAL_FUNC_S40(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32;t33 v33;t34 v34;t35 v35;t36 v36;t37 v37;t38 v38;t39 v39; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); HX_MARK_MEMBER(v33); HX_MARK_MEMBER(v34); HX_MARK_MEMBER(v35); HX_MARK_MEMBER(v36); HX_MARK_MEMBER(v37); HX_MARK_MEMBER(v38); HX_MARK_MEMBER(v39); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); HX_VISIT_MEMBER(v33); HX_VISIT_MEMBER(v34); HX_VISIT_MEMBER(v35); HX_VISIT_MEMBER(v36); HX_VISIT_MEMBER(v37); HX_VISIT_MEMBER(v38); HX_VISIT_MEMBER(v39); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32,t33 __33,t34 __34,t35 __35,t36 __36,t37 __37,t38 __38,t39 __39) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32),v33(__33),v34(__34),v35(__35),v36(__36),v37(__37),v38(__38),v39(__39) {}
+#define HX_BEGIN_LOCAL_FUNC_S41(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32;t33 v33;t34 v34;t35 v35;t36 v36;t37 v37;t38 v38;t39 v39;t40 v40; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); HX_MARK_MEMBER(v33); HX_MARK_MEMBER(v34); HX_MARK_MEMBER(v35); HX_MARK_MEMBER(v36); HX_MARK_MEMBER(v37); HX_MARK_MEMBER(v38); HX_MARK_MEMBER(v39); HX_MARK_MEMBER(v40); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); HX_VISIT_MEMBER(v33); HX_VISIT_MEMBER(v34); HX_VISIT_MEMBER(v35); HX_VISIT_MEMBER(v36); HX_VISIT_MEMBER(v37); HX_VISIT_MEMBER(v38); HX_VISIT_MEMBER(v39); HX_VISIT_MEMBER(v40); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32,t33 __33,t34 __34,t35 __35,t36 __36,t37 __37,t38 __38,t39 __39,t40 __40) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32),v33(__33),v34(__34),v35(__35),v36(__36),v37(__37),v38(__38),v39(__39),v40(__40) {}
+#define HX_BEGIN_LOCAL_FUNC_S42(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32;t33 v33;t34 v34;t35 v35;t36 v36;t37 v37;t38 v38;t39 v39;t40 v40;t41 v41; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); HX_MARK_MEMBER(v33); HX_MARK_MEMBER(v34); HX_MARK_MEMBER(v35); HX_MARK_MEMBER(v36); HX_MARK_MEMBER(v37); HX_MARK_MEMBER(v38); HX_MARK_MEMBER(v39); HX_MARK_MEMBER(v40); HX_MARK_MEMBER(v41); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); HX_VISIT_MEMBER(v33); HX_VISIT_MEMBER(v34); HX_VISIT_MEMBER(v35); HX_VISIT_MEMBER(v36); HX_VISIT_MEMBER(v37); HX_VISIT_MEMBER(v38); HX_VISIT_MEMBER(v39); HX_VISIT_MEMBER(v40); HX_VISIT_MEMBER(v41); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32,t33 __33,t34 __34,t35 __35,t36 __36,t37 __37,t38 __38,t39 __39,t40 __40,t41 __41) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32),v33(__33),v34(__34),v35(__35),v36(__36),v37(__37),v38(__38),v39(__39),v40(__40),v41(__41) {}
+#define HX_BEGIN_LOCAL_FUNC_S43(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32;t33 v33;t34 v34;t35 v35;t36 v36;t37 v37;t38 v38;t39 v39;t40 v40;t41 v41;t42 v42; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); HX_MARK_MEMBER(v33); HX_MARK_MEMBER(v34); HX_MARK_MEMBER(v35); HX_MARK_MEMBER(v36); HX_MARK_MEMBER(v37); HX_MARK_MEMBER(v38); HX_MARK_MEMBER(v39); HX_MARK_MEMBER(v40); HX_MARK_MEMBER(v41); HX_MARK_MEMBER(v42); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); HX_VISIT_MEMBER(v33); HX_VISIT_MEMBER(v34); HX_VISIT_MEMBER(v35); HX_VISIT_MEMBER(v36); HX_VISIT_MEMBER(v37); HX_VISIT_MEMBER(v38); HX_VISIT_MEMBER(v39); HX_VISIT_MEMBER(v40); HX_VISIT_MEMBER(v41); HX_VISIT_MEMBER(v42); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32,t33 __33,t34 __34,t35 __35,t36 __36,t37 __37,t38 __38,t39 __39,t40 __40,t41 __41,t42 __42) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32),v33(__33),v34(__34),v35(__35),v36(__36),v37(__37),v38(__38),v39(__39),v40(__40),v41(__41),v42(__42) {}
+#define HX_BEGIN_LOCAL_FUNC_S44(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32;t33 v33;t34 v34;t35 v35;t36 v36;t37 v37;t38 v38;t39 v39;t40 v40;t41 v41;t42 v42;t43 v43; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); HX_MARK_MEMBER(v33); HX_MARK_MEMBER(v34); HX_MARK_MEMBER(v35); HX_MARK_MEMBER(v36); HX_MARK_MEMBER(v37); HX_MARK_MEMBER(v38); HX_MARK_MEMBER(v39); HX_MARK_MEMBER(v40); HX_MARK_MEMBER(v41); HX_MARK_MEMBER(v42); HX_MARK_MEMBER(v43); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); HX_VISIT_MEMBER(v33); HX_VISIT_MEMBER(v34); HX_VISIT_MEMBER(v35); HX_VISIT_MEMBER(v36); HX_VISIT_MEMBER(v37); HX_VISIT_MEMBER(v38); HX_VISIT_MEMBER(v39); HX_VISIT_MEMBER(v40); HX_VISIT_MEMBER(v41); HX_VISIT_MEMBER(v42); HX_VISIT_MEMBER(v43); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32,t33 __33,t34 __34,t35 __35,t36 __36,t37 __37,t38 __38,t39 __39,t40 __40,t41 __41,t42 __42,t43 __43) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32),v33(__33),v34(__34),v35(__35),v36(__36),v37(__37),v38(__38),v39(__39),v40(__40),v41(__41),v42(__42),v43(__43) {}
+#define HX_BEGIN_LOCAL_FUNC_S45(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32;t33 v33;t34 v34;t35 v35;t36 v36;t37 v37;t38 v38;t39 v39;t40 v40;t41 v41;t42 v42;t43 v43;t44 v44; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); HX_MARK_MEMBER(v33); HX_MARK_MEMBER(v34); HX_MARK_MEMBER(v35); HX_MARK_MEMBER(v36); HX_MARK_MEMBER(v37); HX_MARK_MEMBER(v38); HX_MARK_MEMBER(v39); HX_MARK_MEMBER(v40); HX_MARK_MEMBER(v41); HX_MARK_MEMBER(v42); HX_MARK_MEMBER(v43); HX_MARK_MEMBER(v44); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); HX_VISIT_MEMBER(v33); HX_VISIT_MEMBER(v34); HX_VISIT_MEMBER(v35); HX_VISIT_MEMBER(v36); HX_VISIT_MEMBER(v37); HX_VISIT_MEMBER(v38); HX_VISIT_MEMBER(v39); HX_VISIT_MEMBER(v40); HX_VISIT_MEMBER(v41); HX_VISIT_MEMBER(v42); HX_VISIT_MEMBER(v43); HX_VISIT_MEMBER(v44); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32,t33 __33,t34 __34,t35 __35,t36 __36,t37 __37,t38 __38,t39 __39,t40 __40,t41 __41,t42 __42,t43 __43,t44 __44) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32),v33(__33),v34(__34),v35(__35),v36(__36),v37(__37),v38(__38),v39(__39),v40(__40),v41(__41),v42(__42),v43(__43),v44(__44) {}
+#define HX_BEGIN_LOCAL_FUNC_S46(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32;t33 v33;t34 v34;t35 v35;t36 v36;t37 v37;t38 v38;t39 v39;t40 v40;t41 v41;t42 v42;t43 v43;t44 v44;t45 v45; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); HX_MARK_MEMBER(v33); HX_MARK_MEMBER(v34); HX_MARK_MEMBER(v35); HX_MARK_MEMBER(v36); HX_MARK_MEMBER(v37); HX_MARK_MEMBER(v38); HX_MARK_MEMBER(v39); HX_MARK_MEMBER(v40); HX_MARK_MEMBER(v41); HX_MARK_MEMBER(v42); HX_MARK_MEMBER(v43); HX_MARK_MEMBER(v44); HX_MARK_MEMBER(v45); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); HX_VISIT_MEMBER(v33); HX_VISIT_MEMBER(v34); HX_VISIT_MEMBER(v35); HX_VISIT_MEMBER(v36); HX_VISIT_MEMBER(v37); HX_VISIT_MEMBER(v38); HX_VISIT_MEMBER(v39); HX_VISIT_MEMBER(v40); HX_VISIT_MEMBER(v41); HX_VISIT_MEMBER(v42); HX_VISIT_MEMBER(v43); HX_VISIT_MEMBER(v44); HX_VISIT_MEMBER(v45); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32,t33 __33,t34 __34,t35 __35,t36 __36,t37 __37,t38 __38,t39 __39,t40 __40,t41 __41,t42 __42,t43 __43,t44 __44,t45 __45) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32),v33(__33),v34(__34),v35(__35),v36(__36),v37(__37),v38(__38),v39(__39),v40(__40),v41(__41),v42(__42),v43(__43),v44(__44),v45(__45) {}
+#define HX_BEGIN_LOCAL_FUNC_S47(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32;t33 v33;t34 v34;t35 v35;t36 v36;t37 v37;t38 v38;t39 v39;t40 v40;t41 v41;t42 v42;t43 v43;t44 v44;t45 v45;t46 v46; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); HX_MARK_MEMBER(v33); HX_MARK_MEMBER(v34); HX_MARK_MEMBER(v35); HX_MARK_MEMBER(v36); HX_MARK_MEMBER(v37); HX_MARK_MEMBER(v38); HX_MARK_MEMBER(v39); HX_MARK_MEMBER(v40); HX_MARK_MEMBER(v41); HX_MARK_MEMBER(v42); HX_MARK_MEMBER(v43); HX_MARK_MEMBER(v44); HX_MARK_MEMBER(v45); HX_MARK_MEMBER(v46); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); HX_VISIT_MEMBER(v33); HX_VISIT_MEMBER(v34); HX_VISIT_MEMBER(v35); HX_VISIT_MEMBER(v36); HX_VISIT_MEMBER(v37); HX_VISIT_MEMBER(v38); HX_VISIT_MEMBER(v39); HX_VISIT_MEMBER(v40); HX_VISIT_MEMBER(v41); HX_VISIT_MEMBER(v42); HX_VISIT_MEMBER(v43); HX_VISIT_MEMBER(v44); HX_VISIT_MEMBER(v45); HX_VISIT_MEMBER(v46); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32,t33 __33,t34 __34,t35 __35,t36 __36,t37 __37,t38 __38,t39 __39,t40 __40,t41 __41,t42 __42,t43 __43,t44 __44,t45 __45,t46 __46) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32),v33(__33),v34(__34),v35(__35),v36(__36),v37(__37),v38(__38),v39(__39),v40(__40),v41(__41),v42(__42),v43(__43),v44(__44),v45(__45),v46(__46) {}
+#define HX_BEGIN_LOCAL_FUNC_S48(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32;t33 v33;t34 v34;t35 v35;t36 v36;t37 v37;t38 v38;t39 v39;t40 v40;t41 v41;t42 v42;t43 v43;t44 v44;t45 v45;t46 v46;t47 v47; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); HX_MARK_MEMBER(v33); HX_MARK_MEMBER(v34); HX_MARK_MEMBER(v35); HX_MARK_MEMBER(v36); HX_MARK_MEMBER(v37); HX_MARK_MEMBER(v38); HX_MARK_MEMBER(v39); HX_MARK_MEMBER(v40); HX_MARK_MEMBER(v41); HX_MARK_MEMBER(v42); HX_MARK_MEMBER(v43); HX_MARK_MEMBER(v44); HX_MARK_MEMBER(v45); HX_MARK_MEMBER(v46); HX_MARK_MEMBER(v47); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); HX_VISIT_MEMBER(v33); HX_VISIT_MEMBER(v34); HX_VISIT_MEMBER(v35); HX_VISIT_MEMBER(v36); HX_VISIT_MEMBER(v37); HX_VISIT_MEMBER(v38); HX_VISIT_MEMBER(v39); HX_VISIT_MEMBER(v40); HX_VISIT_MEMBER(v41); HX_VISIT_MEMBER(v42); HX_VISIT_MEMBER(v43); HX_VISIT_MEMBER(v44); HX_VISIT_MEMBER(v45); HX_VISIT_MEMBER(v46); HX_VISIT_MEMBER(v47); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32,t33 __33,t34 __34,t35 __35,t36 __36,t37 __37,t38 __38,t39 __39,t40 __40,t41 __41,t42 __42,t43 __43,t44 __44,t45 __45,t46 __46,t47 __47) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32),v33(__33),v34(__34),v35(__35),v36(__36),v37(__37),v38(__38),v39(__39),v40(__40),v41(__41),v42(__42),v43(__43),v44(__44),v45(__45),v46(__46),v47(__47) {}
+#define HX_BEGIN_LOCAL_FUNC_S49(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32;t33 v33;t34 v34;t35 v35;t36 v36;t37 v37;t38 v38;t39 v39;t40 v40;t41 v41;t42 v42;t43 v43;t44 v44;t45 v45;t46 v46;t47 v47;t48 v48; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); HX_MARK_MEMBER(v33); HX_MARK_MEMBER(v34); HX_MARK_MEMBER(v35); HX_MARK_MEMBER(v36); HX_MARK_MEMBER(v37); HX_MARK_MEMBER(v38); HX_MARK_MEMBER(v39); HX_MARK_MEMBER(v40); HX_MARK_MEMBER(v41); HX_MARK_MEMBER(v42); HX_MARK_MEMBER(v43); HX_MARK_MEMBER(v44); HX_MARK_MEMBER(v45); HX_MARK_MEMBER(v46); HX_MARK_MEMBER(v47); HX_MARK_MEMBER(v48); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); HX_VISIT_MEMBER(v33); HX_VISIT_MEMBER(v34); HX_VISIT_MEMBER(v35); HX_VISIT_MEMBER(v36); HX_VISIT_MEMBER(v37); HX_VISIT_MEMBER(v38); HX_VISIT_MEMBER(v39); HX_VISIT_MEMBER(v40); HX_VISIT_MEMBER(v41); HX_VISIT_MEMBER(v42); HX_VISIT_MEMBER(v43); HX_VISIT_MEMBER(v44); HX_VISIT_MEMBER(v45); HX_VISIT_MEMBER(v46); HX_VISIT_MEMBER(v47); HX_VISIT_MEMBER(v48); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32,t33 __33,t34 __34,t35 __35,t36 __36,t37 __37,t38 __38,t39 __39,t40 __40,t41 __41,t42 __42,t43 __43,t44 __44,t45 __45,t46 __46,t47 __47,t48 __48) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32),v33(__33),v34(__34),v35(__35),v36(__36),v37(__37),v38(__38),v39(__39),v40(__40),v41(__41),v42(__42),v43(__43),v44(__44),v45(__45),v46(__46),v47(__47),v48(__48) {}
+#define HX_BEGIN_LOCAL_FUNC_S50(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32;t33 v33;t34 v34;t35 v35;t36 v36;t37 v37;t38 v38;t39 v39;t40 v40;t41 v41;t42 v42;t43 v43;t44 v44;t45 v45;t46 v46;t47 v47;t48 v48;t49 v49; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); HX_MARK_MEMBER(v33); HX_MARK_MEMBER(v34); HX_MARK_MEMBER(v35); HX_MARK_MEMBER(v36); HX_MARK_MEMBER(v37); HX_MARK_MEMBER(v38); HX_MARK_MEMBER(v39); HX_MARK_MEMBER(v40); HX_MARK_MEMBER(v41); HX_MARK_MEMBER(v42); HX_MARK_MEMBER(v43); HX_MARK_MEMBER(v44); HX_MARK_MEMBER(v45); HX_MARK_MEMBER(v46); HX_MARK_MEMBER(v47); HX_MARK_MEMBER(v48); HX_MARK_MEMBER(v49); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); HX_VISIT_MEMBER(v33); HX_VISIT_MEMBER(v34); HX_VISIT_MEMBER(v35); HX_VISIT_MEMBER(v36); HX_VISIT_MEMBER(v37); HX_VISIT_MEMBER(v38); HX_VISIT_MEMBER(v39); HX_VISIT_MEMBER(v40); HX_VISIT_MEMBER(v41); HX_VISIT_MEMBER(v42); HX_VISIT_MEMBER(v43); HX_VISIT_MEMBER(v44); HX_VISIT_MEMBER(v45); HX_VISIT_MEMBER(v46); HX_VISIT_MEMBER(v47); HX_VISIT_MEMBER(v48); HX_VISIT_MEMBER(v49); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32,t33 __33,t34 __34,t35 __35,t36 __36,t37 __37,t38 __38,t39 __39,t40 __40,t41 __41,t42 __42,t43 __43,t44 __44,t45 __45,t46 __46,t47 __47,t48 __48,t49 __49) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32),v33(__33),v34(__34),v35(__35),v36(__36),v37(__37),v38(__38),v39(__39),v40(__40),v41(__41),v42(__42),v43(__43),v44(__44),v45(__45),v46(__46),v47(__47),v48(__48),v49(__49) {}
+#define HX_BEGIN_LOCAL_FUNC_S51(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32;t33 v33;t34 v34;t35 v35;t36 v36;t37 v37;t38 v38;t39 v39;t40 v40;t41 v41;t42 v42;t43 v43;t44 v44;t45 v45;t46 v46;t47 v47;t48 v48;t49 v49;t50 v50; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); HX_MARK_MEMBER(v33); HX_MARK_MEMBER(v34); HX_MARK_MEMBER(v35); HX_MARK_MEMBER(v36); HX_MARK_MEMBER(v37); HX_MARK_MEMBER(v38); HX_MARK_MEMBER(v39); HX_MARK_MEMBER(v40); HX_MARK_MEMBER(v41); HX_MARK_MEMBER(v42); HX_MARK_MEMBER(v43); HX_MARK_MEMBER(v44); HX_MARK_MEMBER(v45); HX_MARK_MEMBER(v46); HX_MARK_MEMBER(v47); HX_MARK_MEMBER(v48); HX_MARK_MEMBER(v49); HX_MARK_MEMBER(v50); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); HX_VISIT_MEMBER(v33); HX_VISIT_MEMBER(v34); HX_VISIT_MEMBER(v35); HX_VISIT_MEMBER(v36); HX_VISIT_MEMBER(v37); HX_VISIT_MEMBER(v38); HX_VISIT_MEMBER(v39); HX_VISIT_MEMBER(v40); HX_VISIT_MEMBER(v41); HX_VISIT_MEMBER(v42); HX_VISIT_MEMBER(v43); HX_VISIT_MEMBER(v44); HX_VISIT_MEMBER(v45); HX_VISIT_MEMBER(v46); HX_VISIT_MEMBER(v47); HX_VISIT_MEMBER(v48); HX_VISIT_MEMBER(v49); HX_VISIT_MEMBER(v50); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32,t33 __33,t34 __34,t35 __35,t36 __36,t37 __37,t38 __38,t39 __39,t40 __40,t41 __41,t42 __42,t43 __43,t44 __44,t45 __45,t46 __46,t47 __47,t48 __48,t49 __49,t50 __50) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32),v33(__33),v34(__34),v35(__35),v36(__36),v37(__37),v38(__38),v39(__39),v40(__40),v41(__41),v42(__42),v43(__43),v44(__44),v45(__45),v46(__46),v47(__47),v48(__48),v49(__49),v50(__50) {}
+#define HX_BEGIN_LOCAL_FUNC_S52(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32;t33 v33;t34 v34;t35 v35;t36 v36;t37 v37;t38 v38;t39 v39;t40 v40;t41 v41;t42 v42;t43 v43;t44 v44;t45 v45;t46 v46;t47 v47;t48 v48;t49 v49;t50 v50;t51 v51; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); HX_MARK_MEMBER(v33); HX_MARK_MEMBER(v34); HX_MARK_MEMBER(v35); HX_MARK_MEMBER(v36); HX_MARK_MEMBER(v37); HX_MARK_MEMBER(v38); HX_MARK_MEMBER(v39); HX_MARK_MEMBER(v40); HX_MARK_MEMBER(v41); HX_MARK_MEMBER(v42); HX_MARK_MEMBER(v43); HX_MARK_MEMBER(v44); HX_MARK_MEMBER(v45); HX_MARK_MEMBER(v46); HX_MARK_MEMBER(v47); HX_MARK_MEMBER(v48); HX_MARK_MEMBER(v49); HX_MARK_MEMBER(v50); HX_MARK_MEMBER(v51); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); HX_VISIT_MEMBER(v33); HX_VISIT_MEMBER(v34); HX_VISIT_MEMBER(v35); HX_VISIT_MEMBER(v36); HX_VISIT_MEMBER(v37); HX_VISIT_MEMBER(v38); HX_VISIT_MEMBER(v39); HX_VISIT_MEMBER(v40); HX_VISIT_MEMBER(v41); HX_VISIT_MEMBER(v42); HX_VISIT_MEMBER(v43); HX_VISIT_MEMBER(v44); HX_VISIT_MEMBER(v45); HX_VISIT_MEMBER(v46); HX_VISIT_MEMBER(v47); HX_VISIT_MEMBER(v48); HX_VISIT_MEMBER(v49); HX_VISIT_MEMBER(v50); HX_VISIT_MEMBER(v51); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32,t33 __33,t34 __34,t35 __35,t36 __36,t37 __37,t38 __38,t39 __39,t40 __40,t41 __41,t42 __42,t43 __43,t44 __44,t45 __45,t46 __46,t47 __47,t48 __48,t49 __49,t50 __50,t51 __51) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32),v33(__33),v34(__34),v35(__35),v36(__36),v37(__37),v38(__38),v39(__39),v40(__40),v41(__41),v42(__42),v43(__43),v44(__44),v45(__45),v46(__46),v47(__47),v48(__48),v49(__49),v50(__50),v51(__51) {}
+#define HX_BEGIN_LOCAL_FUNC_S53(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51,t52,v52) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32;t33 v33;t34 v34;t35 v35;t36 v36;t37 v37;t38 v38;t39 v39;t40 v40;t41 v41;t42 v42;t43 v43;t44 v44;t45 v45;t46 v46;t47 v47;t48 v48;t49 v49;t50 v50;t51 v51;t52 v52; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); HX_MARK_MEMBER(v33); HX_MARK_MEMBER(v34); HX_MARK_MEMBER(v35); HX_MARK_MEMBER(v36); HX_MARK_MEMBER(v37); HX_MARK_MEMBER(v38); HX_MARK_MEMBER(v39); HX_MARK_MEMBER(v40); HX_MARK_MEMBER(v41); HX_MARK_MEMBER(v42); HX_MARK_MEMBER(v43); HX_MARK_MEMBER(v44); HX_MARK_MEMBER(v45); HX_MARK_MEMBER(v46); HX_MARK_MEMBER(v47); HX_MARK_MEMBER(v48); HX_MARK_MEMBER(v49); HX_MARK_MEMBER(v50); HX_MARK_MEMBER(v51); HX_MARK_MEMBER(v52); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); HX_VISIT_MEMBER(v33); HX_VISIT_MEMBER(v34); HX_VISIT_MEMBER(v35); HX_VISIT_MEMBER(v36); HX_VISIT_MEMBER(v37); HX_VISIT_MEMBER(v38); HX_VISIT_MEMBER(v39); HX_VISIT_MEMBER(v40); HX_VISIT_MEMBER(v41); HX_VISIT_MEMBER(v42); HX_VISIT_MEMBER(v43); HX_VISIT_MEMBER(v44); HX_VISIT_MEMBER(v45); HX_VISIT_MEMBER(v46); HX_VISIT_MEMBER(v47); HX_VISIT_MEMBER(v48); HX_VISIT_MEMBER(v49); HX_VISIT_MEMBER(v50); HX_VISIT_MEMBER(v51); HX_VISIT_MEMBER(v52); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32,t33 __33,t34 __34,t35 __35,t36 __36,t37 __37,t38 __38,t39 __39,t40 __40,t41 __41,t42 __42,t43 __43,t44 __44,t45 __45,t46 __46,t47 __47,t48 __48,t49 __49,t50 __50,t51 __51,t52 __52) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32),v33(__33),v34(__34),v35(__35),v36(__36),v37(__37),v38(__38),v39(__39),v40(__40),v41(__41),v42(__42),v43(__43),v44(__44),v45(__45),v46(__46),v47(__47),v48(__48),v49(__49),v50(__50),v51(__51),v52(__52) {}
+#define HX_BEGIN_LOCAL_FUNC_S54(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51,t52,v52,t53,v53) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32;t33 v33;t34 v34;t35 v35;t36 v36;t37 v37;t38 v38;t39 v39;t40 v40;t41 v41;t42 v42;t43 v43;t44 v44;t45 v45;t46 v46;t47 v47;t48 v48;t49 v49;t50 v50;t51 v51;t52 v52;t53 v53; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); HX_MARK_MEMBER(v33); HX_MARK_MEMBER(v34); HX_MARK_MEMBER(v35); HX_MARK_MEMBER(v36); HX_MARK_MEMBER(v37); HX_MARK_MEMBER(v38); HX_MARK_MEMBER(v39); HX_MARK_MEMBER(v40); HX_MARK_MEMBER(v41); HX_MARK_MEMBER(v42); HX_MARK_MEMBER(v43); HX_MARK_MEMBER(v44); HX_MARK_MEMBER(v45); HX_MARK_MEMBER(v46); HX_MARK_MEMBER(v47); HX_MARK_MEMBER(v48); HX_MARK_MEMBER(v49); HX_MARK_MEMBER(v50); HX_MARK_MEMBER(v51); HX_MARK_MEMBER(v52); HX_MARK_MEMBER(v53); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); HX_VISIT_MEMBER(v33); HX_VISIT_MEMBER(v34); HX_VISIT_MEMBER(v35); HX_VISIT_MEMBER(v36); HX_VISIT_MEMBER(v37); HX_VISIT_MEMBER(v38); HX_VISIT_MEMBER(v39); HX_VISIT_MEMBER(v40); HX_VISIT_MEMBER(v41); HX_VISIT_MEMBER(v42); HX_VISIT_MEMBER(v43); HX_VISIT_MEMBER(v44); HX_VISIT_MEMBER(v45); HX_VISIT_MEMBER(v46); HX_VISIT_MEMBER(v47); HX_VISIT_MEMBER(v48); HX_VISIT_MEMBER(v49); HX_VISIT_MEMBER(v50); HX_VISIT_MEMBER(v51); HX_VISIT_MEMBER(v52); HX_VISIT_MEMBER(v53); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32,t33 __33,t34 __34,t35 __35,t36 __36,t37 __37,t38 __38,t39 __39,t40 __40,t41 __41,t42 __42,t43 __43,t44 __44,t45 __45,t46 __46,t47 __47,t48 __48,t49 __49,t50 __50,t51 __51,t52 __52,t53 __53) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32),v33(__33),v34(__34),v35(__35),v36(__36),v37(__37),v38(__38),v39(__39),v40(__40),v41(__41),v42(__42),v43(__43),v44(__44),v45(__45),v46(__46),v47(__47),v48(__48),v49(__49),v50(__50),v51(__51),v52(__52),v53(__53) {}
+#define HX_BEGIN_LOCAL_FUNC_S55(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51,t52,v52,t53,v53,t54,v54) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32;t33 v33;t34 v34;t35 v35;t36 v36;t37 v37;t38 v38;t39 v39;t40 v40;t41 v41;t42 v42;t43 v43;t44 v44;t45 v45;t46 v46;t47 v47;t48 v48;t49 v49;t50 v50;t51 v51;t52 v52;t53 v53;t54 v54; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); HX_MARK_MEMBER(v33); HX_MARK_MEMBER(v34); HX_MARK_MEMBER(v35); HX_MARK_MEMBER(v36); HX_MARK_MEMBER(v37); HX_MARK_MEMBER(v38); HX_MARK_MEMBER(v39); HX_MARK_MEMBER(v40); HX_MARK_MEMBER(v41); HX_MARK_MEMBER(v42); HX_MARK_MEMBER(v43); HX_MARK_MEMBER(v44); HX_MARK_MEMBER(v45); HX_MARK_MEMBER(v46); HX_MARK_MEMBER(v47); HX_MARK_MEMBER(v48); HX_MARK_MEMBER(v49); HX_MARK_MEMBER(v50); HX_MARK_MEMBER(v51); HX_MARK_MEMBER(v52); HX_MARK_MEMBER(v53); HX_MARK_MEMBER(v54); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); HX_VISIT_MEMBER(v33); HX_VISIT_MEMBER(v34); HX_VISIT_MEMBER(v35); HX_VISIT_MEMBER(v36); HX_VISIT_MEMBER(v37); HX_VISIT_MEMBER(v38); HX_VISIT_MEMBER(v39); HX_VISIT_MEMBER(v40); HX_VISIT_MEMBER(v41); HX_VISIT_MEMBER(v42); HX_VISIT_MEMBER(v43); HX_VISIT_MEMBER(v44); HX_VISIT_MEMBER(v45); HX_VISIT_MEMBER(v46); HX_VISIT_MEMBER(v47); HX_VISIT_MEMBER(v48); HX_VISIT_MEMBER(v49); HX_VISIT_MEMBER(v50); HX_VISIT_MEMBER(v51); HX_VISIT_MEMBER(v52); HX_VISIT_MEMBER(v53); HX_VISIT_MEMBER(v54); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32,t33 __33,t34 __34,t35 __35,t36 __36,t37 __37,t38 __38,t39 __39,t40 __40,t41 __41,t42 __42,t43 __43,t44 __44,t45 __45,t46 __46,t47 __47,t48 __48,t49 __49,t50 __50,t51 __51,t52 __52,t53 __53,t54 __54) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32),v33(__33),v34(__34),v35(__35),v36(__36),v37(__37),v38(__38),v39(__39),v40(__40),v41(__41),v42(__42),v43(__43),v44(__44),v45(__45),v46(__46),v47(__47),v48(__48),v49(__49),v50(__50),v51(__51),v52(__52),v53(__53),v54(__54) {}
+#define HX_BEGIN_LOCAL_FUNC_S56(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51,t52,v52,t53,v53,t54,v54,t55,v55) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32;t33 v33;t34 v34;t35 v35;t36 v36;t37 v37;t38 v38;t39 v39;t40 v40;t41 v41;t42 v42;t43 v43;t44 v44;t45 v45;t46 v46;t47 v47;t48 v48;t49 v49;t50 v50;t51 v51;t52 v52;t53 v53;t54 v54;t55 v55; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); HX_MARK_MEMBER(v33); HX_MARK_MEMBER(v34); HX_MARK_MEMBER(v35); HX_MARK_MEMBER(v36); HX_MARK_MEMBER(v37); HX_MARK_MEMBER(v38); HX_MARK_MEMBER(v39); HX_MARK_MEMBER(v40); HX_MARK_MEMBER(v41); HX_MARK_MEMBER(v42); HX_MARK_MEMBER(v43); HX_MARK_MEMBER(v44); HX_MARK_MEMBER(v45); HX_MARK_MEMBER(v46); HX_MARK_MEMBER(v47); HX_MARK_MEMBER(v48); HX_MARK_MEMBER(v49); HX_MARK_MEMBER(v50); HX_MARK_MEMBER(v51); HX_MARK_MEMBER(v52); HX_MARK_MEMBER(v53); HX_MARK_MEMBER(v54); HX_MARK_MEMBER(v55); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); HX_VISIT_MEMBER(v33); HX_VISIT_MEMBER(v34); HX_VISIT_MEMBER(v35); HX_VISIT_MEMBER(v36); HX_VISIT_MEMBER(v37); HX_VISIT_MEMBER(v38); HX_VISIT_MEMBER(v39); HX_VISIT_MEMBER(v40); HX_VISIT_MEMBER(v41); HX_VISIT_MEMBER(v42); HX_VISIT_MEMBER(v43); HX_VISIT_MEMBER(v44); HX_VISIT_MEMBER(v45); HX_VISIT_MEMBER(v46); HX_VISIT_MEMBER(v47); HX_VISIT_MEMBER(v48); HX_VISIT_MEMBER(v49); HX_VISIT_MEMBER(v50); HX_VISIT_MEMBER(v51); HX_VISIT_MEMBER(v52); HX_VISIT_MEMBER(v53); HX_VISIT_MEMBER(v54); HX_VISIT_MEMBER(v55); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32,t33 __33,t34 __34,t35 __35,t36 __36,t37 __37,t38 __38,t39 __39,t40 __40,t41 __41,t42 __42,t43 __43,t44 __44,t45 __45,t46 __46,t47 __47,t48 __48,t49 __49,t50 __50,t51 __51,t52 __52,t53 __53,t54 __54,t55 __55) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32),v33(__33),v34(__34),v35(__35),v36(__36),v37(__37),v38(__38),v39(__39),v40(__40),v41(__41),v42(__42),v43(__43),v44(__44),v45(__45),v46(__46),v47(__47),v48(__48),v49(__49),v50(__50),v51(__51),v52(__52),v53(__53),v54(__54),v55(__55) {}
+#define HX_BEGIN_LOCAL_FUNC_S57(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51,t52,v52,t53,v53,t54,v54,t55,v55,t56,v56) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32;t33 v33;t34 v34;t35 v35;t36 v36;t37 v37;t38 v38;t39 v39;t40 v40;t41 v41;t42 v42;t43 v43;t44 v44;t45 v45;t46 v46;t47 v47;t48 v48;t49 v49;t50 v50;t51 v51;t52 v52;t53 v53;t54 v54;t55 v55;t56 v56; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); HX_MARK_MEMBER(v33); HX_MARK_MEMBER(v34); HX_MARK_MEMBER(v35); HX_MARK_MEMBER(v36); HX_MARK_MEMBER(v37); HX_MARK_MEMBER(v38); HX_MARK_MEMBER(v39); HX_MARK_MEMBER(v40); HX_MARK_MEMBER(v41); HX_MARK_MEMBER(v42); HX_MARK_MEMBER(v43); HX_MARK_MEMBER(v44); HX_MARK_MEMBER(v45); HX_MARK_MEMBER(v46); HX_MARK_MEMBER(v47); HX_MARK_MEMBER(v48); HX_MARK_MEMBER(v49); HX_MARK_MEMBER(v50); HX_MARK_MEMBER(v51); HX_MARK_MEMBER(v52); HX_MARK_MEMBER(v53); HX_MARK_MEMBER(v54); HX_MARK_MEMBER(v55); HX_MARK_MEMBER(v56); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); HX_VISIT_MEMBER(v33); HX_VISIT_MEMBER(v34); HX_VISIT_MEMBER(v35); HX_VISIT_MEMBER(v36); HX_VISIT_MEMBER(v37); HX_VISIT_MEMBER(v38); HX_VISIT_MEMBER(v39); HX_VISIT_MEMBER(v40); HX_VISIT_MEMBER(v41); HX_VISIT_MEMBER(v42); HX_VISIT_MEMBER(v43); HX_VISIT_MEMBER(v44); HX_VISIT_MEMBER(v45); HX_VISIT_MEMBER(v46); HX_VISIT_MEMBER(v47); HX_VISIT_MEMBER(v48); HX_VISIT_MEMBER(v49); HX_VISIT_MEMBER(v50); HX_VISIT_MEMBER(v51); HX_VISIT_MEMBER(v52); HX_VISIT_MEMBER(v53); HX_VISIT_MEMBER(v54); HX_VISIT_MEMBER(v55); HX_VISIT_MEMBER(v56); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32,t33 __33,t34 __34,t35 __35,t36 __36,t37 __37,t38 __38,t39 __39,t40 __40,t41 __41,t42 __42,t43 __43,t44 __44,t45 __45,t46 __46,t47 __47,t48 __48,t49 __49,t50 __50,t51 __51,t52 __52,t53 __53,t54 __54,t55 __55,t56 __56) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32),v33(__33),v34(__34),v35(__35),v36(__36),v37(__37),v38(__38),v39(__39),v40(__40),v41(__41),v42(__42),v43(__43),v44(__44),v45(__45),v46(__46),v47(__47),v48(__48),v49(__49),v50(__50),v51(__51),v52(__52),v53(__53),v54(__54),v55(__55),v56(__56) {}
+#define HX_BEGIN_LOCAL_FUNC_S58(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51,t52,v52,t53,v53,t54,v54,t55,v55,t56,v56,t57,v57) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32;t33 v33;t34 v34;t35 v35;t36 v36;t37 v37;t38 v38;t39 v39;t40 v40;t41 v41;t42 v42;t43 v43;t44 v44;t45 v45;t46 v46;t47 v47;t48 v48;t49 v49;t50 v50;t51 v51;t52 v52;t53 v53;t54 v54;t55 v55;t56 v56;t57 v57; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); HX_MARK_MEMBER(v33); HX_MARK_MEMBER(v34); HX_MARK_MEMBER(v35); HX_MARK_MEMBER(v36); HX_MARK_MEMBER(v37); HX_MARK_MEMBER(v38); HX_MARK_MEMBER(v39); HX_MARK_MEMBER(v40); HX_MARK_MEMBER(v41); HX_MARK_MEMBER(v42); HX_MARK_MEMBER(v43); HX_MARK_MEMBER(v44); HX_MARK_MEMBER(v45); HX_MARK_MEMBER(v46); HX_MARK_MEMBER(v47); HX_MARK_MEMBER(v48); HX_MARK_MEMBER(v49); HX_MARK_MEMBER(v50); HX_MARK_MEMBER(v51); HX_MARK_MEMBER(v52); HX_MARK_MEMBER(v53); HX_MARK_MEMBER(v54); HX_MARK_MEMBER(v55); HX_MARK_MEMBER(v56); HX_MARK_MEMBER(v57); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); HX_VISIT_MEMBER(v33); HX_VISIT_MEMBER(v34); HX_VISIT_MEMBER(v35); HX_VISIT_MEMBER(v36); HX_VISIT_MEMBER(v37); HX_VISIT_MEMBER(v38); HX_VISIT_MEMBER(v39); HX_VISIT_MEMBER(v40); HX_VISIT_MEMBER(v41); HX_VISIT_MEMBER(v42); HX_VISIT_MEMBER(v43); HX_VISIT_MEMBER(v44); HX_VISIT_MEMBER(v45); HX_VISIT_MEMBER(v46); HX_VISIT_MEMBER(v47); HX_VISIT_MEMBER(v48); HX_VISIT_MEMBER(v49); HX_VISIT_MEMBER(v50); HX_VISIT_MEMBER(v51); HX_VISIT_MEMBER(v52); HX_VISIT_MEMBER(v53); HX_VISIT_MEMBER(v54); HX_VISIT_MEMBER(v55); HX_VISIT_MEMBER(v56); HX_VISIT_MEMBER(v57); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32,t33 __33,t34 __34,t35 __35,t36 __36,t37 __37,t38 __38,t39 __39,t40 __40,t41 __41,t42 __42,t43 __43,t44 __44,t45 __45,t46 __46,t47 __47,t48 __48,t49 __49,t50 __50,t51 __51,t52 __52,t53 __53,t54 __54,t55 __55,t56 __56,t57 __57) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32),v33(__33),v34(__34),v35(__35),v36(__36),v37(__37),v38(__38),v39(__39),v40(__40),v41(__41),v42(__42),v43(__43),v44(__44),v45(__45),v46(__46),v47(__47),v48(__48),v49(__49),v50(__50),v51(__51),v52(__52),v53(__53),v54(__54),v55(__55),v56(__56),v57(__57) {}
+#define HX_BEGIN_LOCAL_FUNC_S59(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51,t52,v52,t53,v53,t54,v54,t55,v55,t56,v56,t57,v57,t58,v58) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32;t33 v33;t34 v34;t35 v35;t36 v36;t37 v37;t38 v38;t39 v39;t40 v40;t41 v41;t42 v42;t43 v43;t44 v44;t45 v45;t46 v46;t47 v47;t48 v48;t49 v49;t50 v50;t51 v51;t52 v52;t53 v53;t54 v54;t55 v55;t56 v56;t57 v57;t58 v58; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); HX_MARK_MEMBER(v33); HX_MARK_MEMBER(v34); HX_MARK_MEMBER(v35); HX_MARK_MEMBER(v36); HX_MARK_MEMBER(v37); HX_MARK_MEMBER(v38); HX_MARK_MEMBER(v39); HX_MARK_MEMBER(v40); HX_MARK_MEMBER(v41); HX_MARK_MEMBER(v42); HX_MARK_MEMBER(v43); HX_MARK_MEMBER(v44); HX_MARK_MEMBER(v45); HX_MARK_MEMBER(v46); HX_MARK_MEMBER(v47); HX_MARK_MEMBER(v48); HX_MARK_MEMBER(v49); HX_MARK_MEMBER(v50); HX_MARK_MEMBER(v51); HX_MARK_MEMBER(v52); HX_MARK_MEMBER(v53); HX_MARK_MEMBER(v54); HX_MARK_MEMBER(v55); HX_MARK_MEMBER(v56); HX_MARK_MEMBER(v57); HX_MARK_MEMBER(v58); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); HX_VISIT_MEMBER(v33); HX_VISIT_MEMBER(v34); HX_VISIT_MEMBER(v35); HX_VISIT_MEMBER(v36); HX_VISIT_MEMBER(v37); HX_VISIT_MEMBER(v38); HX_VISIT_MEMBER(v39); HX_VISIT_MEMBER(v40); HX_VISIT_MEMBER(v41); HX_VISIT_MEMBER(v42); HX_VISIT_MEMBER(v43); HX_VISIT_MEMBER(v44); HX_VISIT_MEMBER(v45); HX_VISIT_MEMBER(v46); HX_VISIT_MEMBER(v47); HX_VISIT_MEMBER(v48); HX_VISIT_MEMBER(v49); HX_VISIT_MEMBER(v50); HX_VISIT_MEMBER(v51); HX_VISIT_MEMBER(v52); HX_VISIT_MEMBER(v53); HX_VISIT_MEMBER(v54); HX_VISIT_MEMBER(v55); HX_VISIT_MEMBER(v56); HX_VISIT_MEMBER(v57); HX_VISIT_MEMBER(v58); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32,t33 __33,t34 __34,t35 __35,t36 __36,t37 __37,t38 __38,t39 __39,t40 __40,t41 __41,t42 __42,t43 __43,t44 __44,t45 __45,t46 __46,t47 __47,t48 __48,t49 __49,t50 __50,t51 __51,t52 __52,t53 __53,t54 __54,t55 __55,t56 __56,t57 __57,t58 __58) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32),v33(__33),v34(__34),v35(__35),v36(__36),v37(__37),v38(__38),v39(__39),v40(__40),v41(__41),v42(__42),v43(__43),v44(__44),v45(__45),v46(__46),v47(__47),v48(__48),v49(__49),v50(__50),v51(__51),v52(__52),v53(__53),v54(__54),v55(__55),v56(__56),v57(__57),v58(__58) {}
+#define HX_BEGIN_LOCAL_FUNC_S60(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51,t52,v52,t53,v53,t54,v54,t55,v55,t56,v56,t57,v57,t58,v58,t59,v59) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32;t33 v33;t34 v34;t35 v35;t36 v36;t37 v37;t38 v38;t39 v39;t40 v40;t41 v41;t42 v42;t43 v43;t44 v44;t45 v45;t46 v46;t47 v47;t48 v48;t49 v49;t50 v50;t51 v51;t52 v52;t53 v53;t54 v54;t55 v55;t56 v56;t57 v57;t58 v58;t59 v59; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); HX_MARK_MEMBER(v33); HX_MARK_MEMBER(v34); HX_MARK_MEMBER(v35); HX_MARK_MEMBER(v36); HX_MARK_MEMBER(v37); HX_MARK_MEMBER(v38); HX_MARK_MEMBER(v39); HX_MARK_MEMBER(v40); HX_MARK_MEMBER(v41); HX_MARK_MEMBER(v42); HX_MARK_MEMBER(v43); HX_MARK_MEMBER(v44); HX_MARK_MEMBER(v45); HX_MARK_MEMBER(v46); HX_MARK_MEMBER(v47); HX_MARK_MEMBER(v48); HX_MARK_MEMBER(v49); HX_MARK_MEMBER(v50); HX_MARK_MEMBER(v51); HX_MARK_MEMBER(v52); HX_MARK_MEMBER(v53); HX_MARK_MEMBER(v54); HX_MARK_MEMBER(v55); HX_MARK_MEMBER(v56); HX_MARK_MEMBER(v57); HX_MARK_MEMBER(v58); HX_MARK_MEMBER(v59); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); HX_VISIT_MEMBER(v33); HX_VISIT_MEMBER(v34); HX_VISIT_MEMBER(v35); HX_VISIT_MEMBER(v36); HX_VISIT_MEMBER(v37); HX_VISIT_MEMBER(v38); HX_VISIT_MEMBER(v39); HX_VISIT_MEMBER(v40); HX_VISIT_MEMBER(v41); HX_VISIT_MEMBER(v42); HX_VISIT_MEMBER(v43); HX_VISIT_MEMBER(v44); HX_VISIT_MEMBER(v45); HX_VISIT_MEMBER(v46); HX_VISIT_MEMBER(v47); HX_VISIT_MEMBER(v48); HX_VISIT_MEMBER(v49); HX_VISIT_MEMBER(v50); HX_VISIT_MEMBER(v51); HX_VISIT_MEMBER(v52); HX_VISIT_MEMBER(v53); HX_VISIT_MEMBER(v54); HX_VISIT_MEMBER(v55); HX_VISIT_MEMBER(v56); HX_VISIT_MEMBER(v57); HX_VISIT_MEMBER(v58); HX_VISIT_MEMBER(v59); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32,t33 __33,t34 __34,t35 __35,t36 __36,t37 __37,t38 __38,t39 __39,t40 __40,t41 __41,t42 __42,t43 __43,t44 __44,t45 __45,t46 __46,t47 __47,t48 __48,t49 __49,t50 __50,t51 __51,t52 __52,t53 __53,t54 __54,t55 __55,t56 __56,t57 __57,t58 __58,t59 __59) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32),v33(__33),v34(__34),v35(__35),v36(__36),v37(__37),v38(__38),v39(__39),v40(__40),v41(__41),v42(__42),v43(__43),v44(__44),v45(__45),v46(__46),v47(__47),v48(__48),v49(__49),v50(__50),v51(__51),v52(__52),v53(__53),v54(__54),v55(__55),v56(__56),v57(__57),v58(__58),v59(__59) {}
+#define HX_BEGIN_LOCAL_FUNC_S61(SUPER,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51,t52,v52,t53,v53,t54,v54,t55,v55,t56,v56,t57,v57,t58,v58,t59,v59,t60,v60) \
+ struct name : public SUPER { \
+ t0 v0;t1 v1;t2 v2;t3 v3;t4 v4;t5 v5;t6 v6;t7 v7;t8 v8;t9 v9;t10 v10;t11 v11;t12 v12;t13 v13;t14 v14;t15 v15;t16 v16;t17 v17;t18 v18;t19 v19;t20 v20;t21 v21;t22 v22;t23 v23;t24 v24;t25 v25;t26 v26;t27 v27;t28 v28;t29 v29;t30 v30;t31 v31;t32 v32;t33 v33;t34 v34;t35 v35;t36 v36;t37 v37;t38 v38;t39 v39;t40 v40;t41 v41;t42 v42;t43 v43;t44 v44;t45 v45;t46 v46;t47 v47;t48 v48;t49 v49;t50 v50;t51 v51;t52 v52;t53 v53;t54 v54;t55 v55;t56 v56;t57 v57;t58 v58;t59 v59;t60 v60; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); HX_MARK_MEMBER(v0); HX_MARK_MEMBER(v1); HX_MARK_MEMBER(v2); HX_MARK_MEMBER(v3); HX_MARK_MEMBER(v4); HX_MARK_MEMBER(v5); HX_MARK_MEMBER(v6); HX_MARK_MEMBER(v7); HX_MARK_MEMBER(v8); HX_MARK_MEMBER(v9); HX_MARK_MEMBER(v10); HX_MARK_MEMBER(v11); HX_MARK_MEMBER(v12); HX_MARK_MEMBER(v13); HX_MARK_MEMBER(v14); HX_MARK_MEMBER(v15); HX_MARK_MEMBER(v16); HX_MARK_MEMBER(v17); HX_MARK_MEMBER(v18); HX_MARK_MEMBER(v19); HX_MARK_MEMBER(v20); HX_MARK_MEMBER(v21); HX_MARK_MEMBER(v22); HX_MARK_MEMBER(v23); HX_MARK_MEMBER(v24); HX_MARK_MEMBER(v25); HX_MARK_MEMBER(v26); HX_MARK_MEMBER(v27); HX_MARK_MEMBER(v28); HX_MARK_MEMBER(v29); HX_MARK_MEMBER(v30); HX_MARK_MEMBER(v31); HX_MARK_MEMBER(v32); HX_MARK_MEMBER(v33); HX_MARK_MEMBER(v34); HX_MARK_MEMBER(v35); HX_MARK_MEMBER(v36); HX_MARK_MEMBER(v37); HX_MARK_MEMBER(v38); HX_MARK_MEMBER(v39); HX_MARK_MEMBER(v40); HX_MARK_MEMBER(v41); HX_MARK_MEMBER(v42); HX_MARK_MEMBER(v43); HX_MARK_MEMBER(v44); HX_MARK_MEMBER(v45); HX_MARK_MEMBER(v46); HX_MARK_MEMBER(v47); HX_MARK_MEMBER(v48); HX_MARK_MEMBER(v49); HX_MARK_MEMBER(v50); HX_MARK_MEMBER(v51); HX_MARK_MEMBER(v52); HX_MARK_MEMBER(v53); HX_MARK_MEMBER(v54); HX_MARK_MEMBER(v55); HX_MARK_MEMBER(v56); HX_MARK_MEMBER(v57); HX_MARK_MEMBER(v58); HX_MARK_MEMBER(v59); HX_MARK_MEMBER(v60); } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); HX_VISIT_MEMBER(v0); HX_VISIT_MEMBER(v1); HX_VISIT_MEMBER(v2); HX_VISIT_MEMBER(v3); HX_VISIT_MEMBER(v4); HX_VISIT_MEMBER(v5); HX_VISIT_MEMBER(v6); HX_VISIT_MEMBER(v7); HX_VISIT_MEMBER(v8); HX_VISIT_MEMBER(v9); HX_VISIT_MEMBER(v10); HX_VISIT_MEMBER(v11); HX_VISIT_MEMBER(v12); HX_VISIT_MEMBER(v13); HX_VISIT_MEMBER(v14); HX_VISIT_MEMBER(v15); HX_VISIT_MEMBER(v16); HX_VISIT_MEMBER(v17); HX_VISIT_MEMBER(v18); HX_VISIT_MEMBER(v19); HX_VISIT_MEMBER(v20); HX_VISIT_MEMBER(v21); HX_VISIT_MEMBER(v22); HX_VISIT_MEMBER(v23); HX_VISIT_MEMBER(v24); HX_VISIT_MEMBER(v25); HX_VISIT_MEMBER(v26); HX_VISIT_MEMBER(v27); HX_VISIT_MEMBER(v28); HX_VISIT_MEMBER(v29); HX_VISIT_MEMBER(v30); HX_VISIT_MEMBER(v31); HX_VISIT_MEMBER(v32); HX_VISIT_MEMBER(v33); HX_VISIT_MEMBER(v34); HX_VISIT_MEMBER(v35); HX_VISIT_MEMBER(v36); HX_VISIT_MEMBER(v37); HX_VISIT_MEMBER(v38); HX_VISIT_MEMBER(v39); HX_VISIT_MEMBER(v40); HX_VISIT_MEMBER(v41); HX_VISIT_MEMBER(v42); HX_VISIT_MEMBER(v43); HX_VISIT_MEMBER(v44); HX_VISIT_MEMBER(v45); HX_VISIT_MEMBER(v46); HX_VISIT_MEMBER(v47); HX_VISIT_MEMBER(v48); HX_VISIT_MEMBER(v49); HX_VISIT_MEMBER(v50); HX_VISIT_MEMBER(v51); HX_VISIT_MEMBER(v52); HX_VISIT_MEMBER(v53); HX_VISIT_MEMBER(v54); HX_VISIT_MEMBER(v55); HX_VISIT_MEMBER(v56); HX_VISIT_MEMBER(v57); HX_VISIT_MEMBER(v58); HX_VISIT_MEMBER(v59); HX_VISIT_MEMBER(v60); } \
+ name(t0 __0,t1 __1,t2 __2,t3 __3,t4 __4,t5 __5,t6 __6,t7 __7,t8 __8,t9 __9,t10 __10,t11 __11,t12 __12,t13 __13,t14 __14,t15 __15,t16 __16,t17 __17,t18 __18,t19 __19,t20 __20,t21 __21,t22 __22,t23 __23,t24 __24,t25 __25,t26 __26,t27 __27,t28 __28,t29 __29,t30 __30,t31 __31,t32 __32,t33 __33,t34 __34,t35 __35,t36 __36,t37 __37,t38 __38,t39 __39,t40 __40,t41 __41,t42 __42,t43 __43,t44 __44,t45 __45,t46 __46,t47 __47,t48 __48,t49 __49,t50 __50,t51 __51,t52 __52,t53 __53,t54 __54,t55 __55,t56 __56,t57 __57,t58 __58,t59 __59,t60 __60) : v0(__0),v1(__1),v2(__2),v3(__3),v4(__4),v5(__5),v6(__6),v7(__7),v8(__8),v9(__9),v10(__10),v11(__11),v12(__12),v13(__13),v14(__14),v15(__15),v16(__16),v17(__17),v18(__18),v19(__19),v20(__20),v21(__21),v22(__22),v23(__23),v24(__24),v25(__25),v26(__26),v27(__27),v28(__28),v29(__29),v30(__30),v31(__31),v32(__32),v33(__33),v34(__34),v35(__35),v36(__36),v37(__37),v38(__38),v39(__39),v40(__40),v41(__41),v42(__42),v43(__43),v44(__44),v45(__45),v46(__46),v47(__47),v48(__48),v49(__49),v50(__50),v51(__51),v52(__52),v53(__53),v54(__54),v55(__55),v56(__56),v57(__57),v58(__58),v59(__59),v60(__60) {}
+
+#define HX_LOCAL_RUN _hx_run
+
+
+#define HX_END_LOCAL_FUNC20(ret) HX_DYNAMIC_CALL20(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC21(ret) HX_DYNAMIC_CALL21(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC22(ret) HX_DYNAMIC_CALL22(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC23(ret) HX_DYNAMIC_CALL23(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC24(ret) HX_DYNAMIC_CALL24(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC25(ret) HX_DYNAMIC_CALL25(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC26(ret) HX_DYNAMIC_CALL26(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC27(ret) HX_DYNAMIC_CALL27(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC28(ret) HX_DYNAMIC_CALL28(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC29(ret) HX_DYNAMIC_CALL29(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC30(ret) HX_DYNAMIC_CALL30(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC31(ret) HX_DYNAMIC_CALL31(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC32(ret) HX_DYNAMIC_CALL32(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC33(ret) HX_DYNAMIC_CALL33(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC34(ret) HX_DYNAMIC_CALL34(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC35(ret) HX_DYNAMIC_CALL35(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC36(ret) HX_DYNAMIC_CALL36(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC37(ret) HX_DYNAMIC_CALL37(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC38(ret) HX_DYNAMIC_CALL38(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC39(ret) HX_DYNAMIC_CALL39(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC40(ret) HX_DYNAMIC_CALL40(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC41(ret) HX_DYNAMIC_CALL41(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC42(ret) HX_DYNAMIC_CALL42(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC43(ret) HX_DYNAMIC_CALL43(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC44(ret) HX_DYNAMIC_CALL44(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC45(ret) HX_DYNAMIC_CALL45(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC46(ret) HX_DYNAMIC_CALL46(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC47(ret) HX_DYNAMIC_CALL47(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC48(ret) HX_DYNAMIC_CALL48(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC49(ret) HX_DYNAMIC_CALL49(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC50(ret) HX_DYNAMIC_CALL50(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC51(ret) HX_DYNAMIC_CALL51(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC52(ret) HX_DYNAMIC_CALL52(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC53(ret) HX_DYNAMIC_CALL53(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC54(ret) HX_DYNAMIC_CALL54(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC55(ret) HX_DYNAMIC_CALL55(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC56(ret) HX_DYNAMIC_CALL56(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC57(ret) HX_DYNAMIC_CALL57(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC58(ret) HX_DYNAMIC_CALL58(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC59(ret) HX_DYNAMIC_CALL59(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC60(ret) HX_DYNAMIC_CALL60(ret, HX_LOCAL_RUN ) };
+#define HX_END_LOCAL_FUNC61(ret) HX_DYNAMIC_CALL61(ret, HX_LOCAL_RUN ) };
+
+// For compatibility until next version of haxe is released
+
+#define HX_BEGIN_LOCAL_FUNC20(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19) \
+ HX_BEGIN_LOCAL_FUNC_S20(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19)
+#define HX_BEGIN_LOCAL_FUNC21(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20) \
+ HX_BEGIN_LOCAL_FUNC_S21(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20)
+#define HX_BEGIN_LOCAL_FUNC22(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21) \
+ HX_BEGIN_LOCAL_FUNC_S22(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21)
+#define HX_BEGIN_LOCAL_FUNC23(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22) \
+ HX_BEGIN_LOCAL_FUNC_S23(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22)
+#define HX_BEGIN_LOCAL_FUNC24(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23) \
+ HX_BEGIN_LOCAL_FUNC_S24(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23)
+#define HX_BEGIN_LOCAL_FUNC25(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24) \
+ HX_BEGIN_LOCAL_FUNC_S25(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24)
+#define HX_BEGIN_LOCAL_FUNC26(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25) \
+ HX_BEGIN_LOCAL_FUNC_S26(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25)
+#define HX_BEGIN_LOCAL_FUNC27(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26) \
+ HX_BEGIN_LOCAL_FUNC_S27(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26)
+#define HX_BEGIN_LOCAL_FUNC28(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27) \
+ HX_BEGIN_LOCAL_FUNC_S28(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27)
+#define HX_BEGIN_LOCAL_FUNC29(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28) \
+ HX_BEGIN_LOCAL_FUNC_S29(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28)
+#define HX_BEGIN_LOCAL_FUNC30(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29) \
+ HX_BEGIN_LOCAL_FUNC_S30(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29)
+#define HX_BEGIN_LOCAL_FUNC31(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30) \
+ HX_BEGIN_LOCAL_FUNC_S31(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30)
+#define HX_BEGIN_LOCAL_FUNC32(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31) \
+ HX_BEGIN_LOCAL_FUNC_S32(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31)
+#define HX_BEGIN_LOCAL_FUNC33(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32) \
+ HX_BEGIN_LOCAL_FUNC_S33(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32)
+#define HX_BEGIN_LOCAL_FUNC34(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33) \
+ HX_BEGIN_LOCAL_FUNC_S34(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33)
+#define HX_BEGIN_LOCAL_FUNC35(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34) \
+ HX_BEGIN_LOCAL_FUNC_S35(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34)
+#define HX_BEGIN_LOCAL_FUNC36(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35) \
+ HX_BEGIN_LOCAL_FUNC_S36(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35)
+#define HX_BEGIN_LOCAL_FUNC37(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36) \
+ HX_BEGIN_LOCAL_FUNC_S37(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36)
+#define HX_BEGIN_LOCAL_FUNC38(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37) \
+ HX_BEGIN_LOCAL_FUNC_S38(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37)
+#define HX_BEGIN_LOCAL_FUNC39(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38) \
+ HX_BEGIN_LOCAL_FUNC_S39(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38)
+#define HX_BEGIN_LOCAL_FUNC40(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39) \
+ HX_BEGIN_LOCAL_FUNC_S40(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39)
+#define HX_BEGIN_LOCAL_FUNC41(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40) \
+ HX_BEGIN_LOCAL_FUNC_S41(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40)
+#define HX_BEGIN_LOCAL_FUNC42(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41) \
+ HX_BEGIN_LOCAL_FUNC_S42(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41)
+#define HX_BEGIN_LOCAL_FUNC43(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42) \
+ HX_BEGIN_LOCAL_FUNC_S43(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42)
+#define HX_BEGIN_LOCAL_FUNC44(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43) \
+ HX_BEGIN_LOCAL_FUNC_S44(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43)
+#define HX_BEGIN_LOCAL_FUNC45(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44) \
+ HX_BEGIN_LOCAL_FUNC_S45(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44)
+#define HX_BEGIN_LOCAL_FUNC46(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45) \
+ HX_BEGIN_LOCAL_FUNC_S46(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45)
+#define HX_BEGIN_LOCAL_FUNC47(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46) \
+ HX_BEGIN_LOCAL_FUNC_S47(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46)
+#define HX_BEGIN_LOCAL_FUNC48(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47) \
+ HX_BEGIN_LOCAL_FUNC_S48(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47)
+#define HX_BEGIN_LOCAL_FUNC49(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48) \
+ HX_BEGIN_LOCAL_FUNC_S49(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48)
+#define HX_BEGIN_LOCAL_FUNC50(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49) \
+ HX_BEGIN_LOCAL_FUNC_S50(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49)
+#define HX_BEGIN_LOCAL_FUNC51(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50) \
+ HX_BEGIN_LOCAL_FUNC_S51(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50)
+#define HX_BEGIN_LOCAL_FUNC52(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51) \
+ HX_BEGIN_LOCAL_FUNC_S52(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51)
+#define HX_BEGIN_LOCAL_FUNC53(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51,t52,v52) \
+ HX_BEGIN_LOCAL_FUNC_S53(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51,t52,v52)
+#define HX_BEGIN_LOCAL_FUNC54(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51,t52,v52,t53,v53) \
+ HX_BEGIN_LOCAL_FUNC_S54(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51,t52,v52,t53,v53)
+#define HX_BEGIN_LOCAL_FUNC55(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51,t52,v52,t53,v53,t54,v54) \
+ HX_BEGIN_LOCAL_FUNC_S55(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51,t52,v52,t53,v53,t54,v54)
+#define HX_BEGIN_LOCAL_FUNC56(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51,t52,v52,t53,v53,t54,v54,t55,v55) \
+ HX_BEGIN_LOCAL_FUNC_S56(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51,t52,v52,t53,v53,t54,v54,t55,v55)
+#define HX_BEGIN_LOCAL_FUNC57(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51,t52,v52,t53,v53,t54,v54,t55,v55,t56,v56) \
+ HX_BEGIN_LOCAL_FUNC_S57(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51,t52,v52,t53,v53,t54,v54,t55,v55,t56,v56)
+#define HX_BEGIN_LOCAL_FUNC58(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51,t52,v52,t53,v53,t54,v54,t55,v55,t56,v56,t57,v57) \
+ HX_BEGIN_LOCAL_FUNC_S58(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51,t52,v52,t53,v53,t54,v54,t55,v55,t56,v56,t57,v57)
+#define HX_BEGIN_LOCAL_FUNC59(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51,t52,v52,t53,v53,t54,v54,t55,v55,t56,v56,t57,v57,t58,v58) \
+ HX_BEGIN_LOCAL_FUNC_S59(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51,t52,v52,t53,v53,t54,v54,t55,v55,t56,v56,t57,v57,t58,v58)
+#define HX_BEGIN_LOCAL_FUNC60(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51,t52,v52,t53,v53,t54,v54,t55,v55,t56,v56,t57,v57,t58,v58,t59,v59) \
+ HX_BEGIN_LOCAL_FUNC_S60(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51,t52,v52,t53,v53,t54,v54,t55,v55,t56,v56,t57,v57,t58,v58,t59,v59)
+#define HX_BEGIN_LOCAL_FUNC61(name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51,t52,v52,t53,v53,t54,v54,t55,v55,t56,v56,t57,v57,t58,v58,t59,v59,t60,v60) \
+ HX_BEGIN_LOCAL_FUNC_S61(hx::LocalFunc,name,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10,t11,v11,t12,v12,t13,v13,t14,v14,t15,v15,t16,v16,t17,v17,t18,v18,t19,v19,t20,v20,t21,v21,t22,v22,t23,v23,t24,v24,t25,v25,t26,v26,t27,v27,t28,v28,t29,v29,t30,v30,t31,v31,t32,v32,t33,v33,t34,v34,t35,v35,t36,v36,t37,v37,t38,v38,t39,v39,t40,v40,t41,v41,t42,v42,t43,v43,t44,v44,t45,v45,t46,v46,t47,v47,t48,v48,t49,v49,t50,v50,t51,v51,t52,v52,t53,v53,t54,v54,t55,v55,t56,v56,t57,v57,t58,v58,t59,v59,t60,v60)
+
+
+#endif
+
+
diff --git a/Sources/c_snikket/iinclude/hx/MacrosJumbo.tpl b/Sources/c_snikket/iinclude/hx/MacrosJumbo.tpl
new file mode 100644
index 0000000..213b272
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/MacrosJumbo.tpl
@@ -0,0 +1,25 @@
+#ifndef HX_MACROS_JUMBO_H
+#define HX_MACROS_JUMBO_H
+
+::foreach LOCALS::
+#define HX_BEGIN_LOCAL_FUNC_S::ARG::(SUPER,name,::TYPE_ARGS::) \
+ struct name : public SUPER { \
+ ::TYPE_DECL::; \
+ void __Mark(hx::MarkContext *__inCtx) { DoMarkThis(__inCtx); ::MARKS:: } \
+ void __Visit(hx::VisitContext *__inCtx) { DoVisitThis(__inCtx); ::VISITS:: } \
+ name(::CONSTRUCT_ARGS::) : ::CONSTRUCT_VARS:: {}::end::
+
+#define HX_LOCAL_RUN _hx_run
+
+::foreach LOCALS::
+#define HX_END_LOCAL_FUNC::ARG::(ret) HX_DYNAMIC_CALL::ARG::(ret, HX_LOCAL_RUN ) };::end::
+
+// For compatibility until next version of haxe is released
+::foreach LOCALS::
+#define HX_BEGIN_LOCAL_FUNC::ARG::(name,::TYPE_ARGS::) \
+ HX_BEGIN_LOCAL_FUNC_S::ARG::(hx::LocalFunc,name,::TYPE_ARGS::)::end::
+
+
+#endif
+
+
diff --git a/Sources/c_snikket/iinclude/hx/Memory.h b/Sources/c_snikket/iinclude/hx/Memory.h
new file mode 100644
index 0000000..dbb5d3d
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/Memory.h
@@ -0,0 +1,32 @@
+#ifdef HX_MEMORY_H_OVERRIDE
+// Users can define their own header to use here, but there is no API
+// compatibility gaurantee for future changes.
+#include HX_MEMORY_H_OVERRIDE
+
+// Todo - special version?
+inline void HxFreeGCBlock(void *p) {
+ HxFree(p);
+}
+
+#else
+
+#ifndef HX_MEMORY_H
+#define HX_MEMORY_H
+
+#include <stdlib.h>
+
+inline void *HxAlloc(size_t size) {
+ return malloc(size);
+}
+
+inline void HxFree(void *p) {
+ free(p);
+}
+
+void *HxAllocGCBlock(size_t size);
+void HxFreeGCBlock(void *p);
+
+
+#endif
+
+#endif
diff --git a/Sources/c_snikket/iinclude/hx/Native.h b/Sources/c_snikket/iinclude/hx/Native.h
new file mode 100644
index 0000000..4b68982
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/Native.h
@@ -0,0 +1,183 @@
+#ifndef HX_NATIVE_INCLUDED_H
+#define HX_NATIVE_INCLUDED_H
+/*
+ *
+ This file is in the public domain, and can be freely distributed.
+
+*/
+
+#include <stdio.h>
+
+#ifndef HXCPP_H
+#define HXCPP_H
+typedef double Float;
+typedef void Void;
+
+//typedef int Int;
+//typedef bool Bool;
+
+#ifndef HXCPP_CLASS_ATTRIBUTES
+#define HXCPP_CLASS_ATTRIBUTES
+#endif
+
+#endif
+
+
+
+#define HX_DECLARE_NATIVE0(klass) \
+ class klass;
+#define HX_DECLARE_NATIVE1(ns1,klass) namespace ns1 { HX_DECLARE_NATIVE0(klass) }
+#define HX_DECLARE_NATIVE2(ns2,ns1,klass) namespace ns2 { HX_DECLARE_NATIVE1(ns1,klass) }
+#define HX_DECLARE_NATIVE3(ns3,ns2,ns1,klass) namespace ns3 { HX_DECLARE_NATIVE2(ns2,ns1,klass) }
+#define HX_DECLARE_NATIVE4(ns4,ns3,ns2,ns1,klass) namespace ns4 { HX_DECLARE_NATIVE3(ns3,ns2,ns1,klass) }
+#define HX_DECLARE_NATIVE5(ns5,ns4,ns3,ns2,ns1,klass) namespace ns5 { HX_DECLARE_NATIVE4(ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_NATIVE6(ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns6 { HX_DECLARE_NATIVE5(ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_NATIVE7(ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns7 { HX_DECLARE_NATIVE6(ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_NATIVE8(ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns8 { HX_DECLARE_NATIVE7(ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+#define HX_DECLARE_NATIVE9(ns9,ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) namespace ns9 { HX_DECLARE_NATIVE8(ns8,ns7,ns6,ns5,ns4,ns3,ns2,ns1,klass) }
+
+
+
+
+
+namespace hx
+{
+ class Object;
+
+ class HXCPP_CLASS_ATTRIBUTES NativeInterface
+ {
+ public:
+ virtual hx::Object *__GetRealObject() = 0;
+ void _hx_addRef();
+ void _hx_decRef();
+ };
+
+ template<typename T>
+ class Native
+ {
+ public:
+ T ptr;
+
+ Native () : ptr(0) { }
+ Native (T inPtr) : ptr(inPtr) { }
+ Native (const Native<T> &inNative) : ptr(inNative.ptr) { }
+ #ifdef CPP_VARIANT_ONCE_H
+ Native (const cpp::Variant &inVariant) {
+ hx::Object *obj = inVariant.asObject();
+ ptr = obj ? (T)inVariant.valObject->__GetHandle() : 0;
+ }
+ #endif
+
+ inline Native &operator=(T inPtr) { ptr=inPtr; return *this; }
+ inline Native &operator=(const Native<T> &inNative) { ptr=inNative.ptr; return *this; }
+ #ifdef HX_NULL_H
+ inline Native &operator=(const ::null &) { ptr=0; return *this; }
+ #endif
+ inline T operator->() const { return ptr; }
+
+ inline operator T() const { return ptr; }
+
+ template<typename O>
+ inline bool operator==(const Native<O> &inOther) const
+ { return ptr == inOther.ptr; }
+ template<typename O>
+ inline bool operator!=(const Native<O> &inOther) const
+ { return ptr != inOther.ptr; }
+
+ };
+
+ HXCPP_CLASS_ATTRIBUTES const char *Init(bool stayAttached=true);
+ HXCPP_CLASS_ATTRIBUTES void PushTopOfStack(void *);
+ HXCPP_CLASS_ATTRIBUTES void PopTopOfStack();
+ HXCPP_CLASS_ATTRIBUTES void GcAddOffsetRoot(void *inRoot, int inOffset);
+ HXCPP_CLASS_ATTRIBUTES void GcSetOffsetRoot(void *inRoot, int inOffset);
+ HXCPP_CLASS_ATTRIBUTES void GcRemoveOffsetRoot(void *inRoot);
+ HXCPP_CLASS_ATTRIBUTES int GcGetThreadAttachedCount();
+
+ class HXCPP_CLASS_ATTRIBUTES NativeAttach
+ {
+ bool isAttached;
+ public:
+ NativeAttach(bool inAttach=true)
+ {
+ isAttached = false;
+ if (inAttach)
+ attach();
+ }
+ ~NativeAttach()
+ {
+ detach();
+ }
+ void attach()
+ {
+ if (!isAttached)
+ {
+ isAttached = true;
+ hx::PushTopOfStack(this);
+ }
+ }
+ void detach()
+ {
+ if (isAttached)
+ {
+ isAttached = false;
+ hx::PopTopOfStack();
+ }
+ }
+ };
+
+ template<typename T>
+ class Ref
+ {
+ public:
+ T ptr;
+
+ Ref() : ptr(0) { }
+ Ref(const T &inT) : ptr(0) { setPtr(inT); }
+ template<typename O>
+ inline Ref(const Native<O> &inNative) : ptr(0) { setPtr(inNative.ptr); }
+ template<typename O>
+ inline Ref(const Ref<O> &inRef) : ptr(0) { setPtr(inRef.ptr); }
+
+ ~Ref() { setPtr(0); }
+ void setPtr(T inPtr)
+ {
+ hx::Object *old = ptr ? ptr->__GetRealObject() : 0;
+ int oldOffset = old ? (int)(size_t)((char *)inPtr - (char *)old) : 0;
+ hx::Object *next = inPtr ? inPtr->__GetRealObject() : 0;
+ int nextOffset = next ? (int)(size_t)((char *)inPtr - (char *)next) : 0;
+
+ ptr = inPtr;
+ if (next)
+ {
+ if (!old)
+ GcAddOffsetRoot(&ptr, nextOffset);
+ else if (oldOffset!=nextOffset)
+ GcSetOffsetRoot(&ptr, nextOffset);
+ }
+ else if (old)
+ GcRemoveOffsetRoot(&ptr);
+ }
+
+ inline Ref &operator=(const T &inPtr) { setPtr(inPtr); return *this; }
+ template<typename O>
+ inline Ref &operator=(const Native<O> &inNative) { setPtr(inNative.ptr); return *this; }
+ template<typename O>
+ inline Ref &operator=(const Ref<O> &inRef) { setPtr(inRef.ptr); return *this; }
+
+ template<typename O>
+ inline bool operator==(const Ref<O> &inOther) const
+ { return ptr == inOther.ptr; }
+ template<typename O>
+ inline bool operator!=(const Ref<O> &inOther) const
+ { return ptr != inOther.ptr; }
+
+ T operator->() { return ptr; }
+ };
+
+ #define HX_NATIVE_IMPLEMENTATION hx::Object *__GetRealObject() { return this; }
+ #define HX_EXTERN_NATIVE_IMPLEMENTATION hx::Object *__GetRealObject() { return 0; }
+}
+
+#endif
+
diff --git a/Sources/c_snikket/iinclude/hx/NekoFunc.h b/Sources/c_snikket/iinclude/hx/NekoFunc.h
new file mode 100644
index 0000000..382a589
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/NekoFunc.h
@@ -0,0 +1,118 @@
+#ifndef HX_NEKO_FUNC_H
+#define HX_NEKO_FUNC_H
+
+#define NEKO_VERSION 180
+
+typedef intptr_t int_val;
+
+typedef enum {
+ VAL_INT = 0xFF,
+ VAL_NULL = 0,
+ VAL_FLOAT = 1,
+ VAL_BOOL = 2,
+ VAL_STRING = 3,
+ VAL_OBJECT = 4,
+ VAL_ARRAY = 5,
+ VAL_FUNCTION = 6,
+ VAL_ABSTRACT = 7,
+ VAL_PRIMITIVE = 6 | 8,
+ VAL_JITFUN = 6 | 16,
+ VAL_32_BITS = 0xFFFFFFFF
+} neko_val_type;
+
+struct _neko_value {
+ neko_val_type t;
+};
+
+struct _neko_objtable;
+struct _neko_buffer;
+
+#ifndef HAVE_NEKO_TYPES
+typedef struct _neko_vkind *neko_vkind;
+typedef struct _neko_value *neko_value;
+typedef struct _neko_buffer *neko_buffer;
+#endif
+
+typedef struct _neko_objtable* neko_objtable;
+typedef double tfloat;
+
+typedef void (*finalizer)(neko_value v);
+
+#pragma pack(4)
+typedef struct {
+ neko_val_type t;
+ tfloat f;
+} vfloat;
+#pragma pack()
+
+typedef struct _vobject {
+ neko_val_type t;
+ neko_objtable table;
+ struct _vobject *proto;
+} vobject;
+
+typedef struct {
+ neko_val_type t;
+ int nargs;
+ void *addr;
+ neko_value env;
+ void *module;
+} vfunction;
+
+typedef struct {
+ neko_val_type t;
+ char c;
+} vstring;
+
+typedef struct {
+ neko_val_type t;
+ neko_value ptr;
+} varray;
+
+typedef struct {
+ neko_val_type t;
+ neko_vkind kind;
+ void *data;
+} vabstract;
+
+
+
+#define neko_val_tag(v) (*(neko_val_type*)(v))
+#define neko_val_is_null(v) ((v) == val_null)
+#define neko_val_is_int(v) ((((int)(int_val)(v)) & 1) != 0)
+#define neko_val_is_number(v) (neko_val_is_int(v) || neko_val_tag(v) == VAL_FLOAT)
+#define neko_val_is_float(v) (!neko_val_is_int(v) && neko_val_tag(v) == VAL_FLOAT)
+#define neko_val_is_string(v) (!neko_val_is_int(v) && (neko_val_tag(v)&7) == VAL_STRING)
+#define neko_val_is_function(v) (!neko_val_is_int(v) && (neko_val_tag(v)&7) == VAL_FUNCTION)
+#define neko_val_is_object(v) (!neko_val_is_int(v) && neko_val_tag(v) == VAL_OBJECT)
+#define neko_val_is_array(v) (!neko_val_is_int(v) && (neko_val_tag(v)&7) == VAL_ARRAY)
+#define neko_val_is_abstract(v) (!neko_val_is_int(v) && neko_val_tag(v) == VAL_ABSTRACT)
+#define neko_val_is_kind(v,t) (neko_val_is_abstract(v) && neko_val_kind(v) == (t))
+#define neko_val_check_kind(v,t) if( !neko_val_is_kind(v,t) ) neko_error();
+#define neko_val_check_function(f,n) if( !neko_val_is_function(f) || (neko_val_fun_nargs(f) != (n) && neko_val_fun_nargs(f) != VAR_ARGS) ) neko_error();
+#define neko_val_check(v,t) if( !neko_val_is_##t(v) ) neko_error();
+#define neko_val_data(v) ((vabstract*)(v))->data
+#define neko_val_kind(v) ((vabstract*)(v))->kind
+
+#define neko_val_type(v) (neko_val_is_int(v) ? VAL_INT : (neko_val_tag(v)&7))
+#define neko_val_int(v) (((int)(int_val)(v)) >> 1)
+#define neko_val_float(v) (CONV_FLOAT ((vfloat*)(v))->f)
+#define neko_val_bool(v) ((v) == neko_val_true)
+#define neko_val_number(v) (neko_val_is_int(v)?neko_val_int(v):neko_val_float(v))
+#define neko_val_hdata(v) ((vhash*)neko_val_data(v))
+#define neko_val_string(v) (&((vstring*)(v))->c)
+#define neko_val_strlen(v) (neko_val_tag(v) >> 3)
+#define neko_val_set_length(v,l) neko_val_tag(v) = (neko_val_tag(v)&7) | ((l) << 3)
+#define neko_val_set_size neko_val_set_length
+
+#define neko_val_array_size(v) (neko_val_tag(v) >> 3)
+#define neko_val_array_ptr(v) (&((varray*)(v))->ptr)
+#define neko_val_fun_nargs(v) ((vfunction*)(v))->nargs
+#define neko_alloc_int(v) ((neko_value)(int_val)((((int)(v)) << 1) | 1))
+#define neko_alloc_bool(b) ((b)?neko_val_true:neko_val_false)
+
+#define neko_max_array_size ((1 << 29) - 1)
+#define neko_max_string_size ((1 << 29) - 1)
+#define neko_invalid_comparison 0xFE
+
+#endif // HX_NEKO_FUNC_H
diff --git a/Sources/c_snikket/iinclude/hx/OS.h b/Sources/c_snikket/iinclude/hx/OS.h
new file mode 100644
index 0000000..cb28c20
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/OS.h
@@ -0,0 +1,96 @@
+#ifndef HX_OS_H
+#define HX_OS_H
+
+// OS FLAGS
+#if defined(_WIN32)
+# define NEKO_WINDOWS
+#endif
+
+#if defined(__APPLE__) || defined(__MACH__) || defined(macintosh)
+# define NEKO_MAC
+#endif
+
+#if defined(linux) || defined(__linux__)
+# define NEKO_LINUX
+#endif
+
+#if defined(__FreeBSD_kernel__)
+# define NEKO_GNUKBSD
+#endif
+
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+# define NEKO_BSD
+#endif
+
+// COMPILER/PROCESSOR FLAGS
+#if defined(__GNUC__)
+# define NEKO_GCC
+#endif
+
+#if defined(_MSC_VER)
+# define NEKO_VCC
+#endif
+
+#if defined(__MINGW32__)
+# define NEKO_MINGW
+#endif
+
+#if defined(__i386__) || defined(_WIN32)
+# define NEKO_X86
+#endif
+
+#if defined(__ppc__)
+# define NEKO_PPC
+#endif
+
+#if defined(_64BITS)
+# define NEKO_64BITS
+#endif
+
+#if defined(NEKO_LINUX) || defined(NEKO_MAC) || defined(NEKO_BSD) || defined(NEKO_GNUKBSD)
+# define NEKO_POSIX
+#endif
+
+#if defined(NEKO_GCC)
+# define NEKO_THREADED
+# define NEKO_DIRECT_THREADED
+#endif
+
+#include <stddef.h>
+#ifndef NEKO_VCC
+# include <stdint.h>
+#endif
+
+
+
+
+
+#undef EXPORT
+#undef IMPORT
+#if defined(NEKO_VCC) || defined(NEKO_MINGW)
+# define INLINE __inline
+# define EXPORT __declspec( dllexport )
+# define IMPORT __declspec( dllimport )
+#elif defined (HX_LINUX)
+# define INLINE inline
+# define EXPORT __attribute__ ((visibility("default")))
+# define IMPORT
+#else
+# define INLINE inline
+# define EXPORT __attribute__ ((visibility("default")))
+# define IMPORT
+#endif
+
+#ifdef NEKO_POSIX
+# include <errno.h>
+# define POSIX_LABEL(name) name:
+# define HANDLE_EINTR(label) if( errno == EINTR ) goto label
+# define HANDLE_FINTR(f,label) if( ferror(f) && errno == EINTR ) goto label
+#else
+# define POSIX_LABEL(name)
+# define HANDLE_EINTR(label)
+# define HANDLE_FINTR(f,label)
+#endif
+
+
+#endif
diff --git a/Sources/c_snikket/iinclude/hx/ObjcHelpers.h b/Sources/c_snikket/iinclude/hx/ObjcHelpers.h
new file mode 100644
index 0000000..90ef857
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/ObjcHelpers.h
@@ -0,0 +1,222 @@
+#ifndef HX_OBJC_HELPERS_INCLUDED
+#define HX_OBJC_HELPERS_INCLUDED
+
+
+
+@interface NSHaxeWrapperClass : NSObject {
+ @public hx::Object *haxeObject;
+}
+- (id)init:(hx::Object *) inHaxe;
+- (void)dealloc;
+@end
+
+
+NSDictionary<NSString *, id> *_hx_obj_to_nsdictionary(Dynamic d);
+
+id _hx_value_to_objc(Dynamic d);
+
+
+Dynamic _hx_nsdictionary_to_obj(NSDictionary<NSString *, id> *inDictionary);
+
+Dynamic _hx_objc_to_dynamic(id inValue);
+
+Array<unsigned char> _hx_objc_to_bytes(id value);
+
+
+namespace hx
+{
+
+
+// 0 args
+struct TObjcBlockVoidVoid
+{
+ typedef void (^t)();
+
+ static t create(Dynamic func)
+ {
+ NSHaxeWrapperClass *wrapper = [[NSHaxeWrapperClass alloc] init:func.mPtr];
+ t wrap = ^ {
+ wrapper->haxeObject->__run();
+ };
+ return wrap;
+ }
+};
+
+
+template<typename Ret>
+struct TObjcBlockRetVoid
+{
+ typedef Ret (^t)();
+
+ static t create(Dynamic func)
+ {
+ NSHaxeWrapperClass *wrapper = [[NSHaxeWrapperClass alloc] init:func.mPtr];
+ t wrap = ^() {
+ return (Ret) wrapper->haxeObject->__run();
+ };
+ return wrap;
+ }
+};
+
+
+// 1 arg
+template<typename Arg0>
+struct TObjcBlockVoidArgs1
+{
+ typedef void (^t)(Arg0 a);
+
+ static t create(Dynamic func)
+ {
+ NSHaxeWrapperClass *wrapper = [[NSHaxeWrapperClass alloc] init:func.mPtr];
+ t wrap = ^(Arg0 a0) {
+ wrapper->haxeObject->__run(a0);
+ };
+ return wrap;
+ }
+};
+
+template<typename Ret, typename Arg0>
+struct TObjcBlockRetArgs1
+{
+ typedef Ret (^t)(Arg0 a);
+ inline static t create(Dynamic func)
+ {
+ NSHaxeWrapperClass *wrapper = [[NSHaxeWrapperClass alloc] init:func.mPtr];
+ t wrap = ^(Arg0 a0) {
+ return (Ret) wrapper->haxeObject->__run(a0);
+ } ;
+ }
+};
+
+
+
+// 2 arg
+template<typename Arg0, typename Arg1>
+struct TObjcBlockVoidArgs2
+{
+ typedef void (^t)(Arg0 a0, Arg1 a1);
+
+ static t create(Dynamic func)
+ {
+ NSHaxeWrapperClass *wrapper = [[NSHaxeWrapperClass alloc] init:func.mPtr];
+ t wrap = ^(Arg0 a0, Arg1 a1) {
+ wrapper->haxeObject->__run(a0,a1);
+ };
+ return wrap;
+ }
+};
+
+template<typename Ret, typename Arg0, typename Arg1>
+struct TObjcBlockRetArgs2
+{
+ typedef Ret (^t)(Arg0 a0, Arg1 a1);
+ inline static t create(Dynamic func)
+ {
+ NSHaxeWrapperClass *wrapper = [[NSHaxeWrapperClass alloc] init:func.mPtr];
+ t wrap = ^(Arg0 a0, Arg1 a1) {
+ return (Ret) wrapper->haxeObject->__run(a0,a1);
+ } ;
+ }
+};
+
+
+// 3 arg
+template<typename Arg0, typename Arg1, typename Arg2>
+struct TObjcBlockVoidArgs3
+{
+ typedef void (^t)(Arg0 a0, Arg1 a1, Arg2 a2);
+
+ static t create(Dynamic func)
+ {
+ NSHaxeWrapperClass *wrapper = [[NSHaxeWrapperClass alloc] init:func.mPtr];
+ t wrap = ^(Arg0 a0, Arg1 a1, Arg2 a2) {
+ wrapper->haxeObject->__run(a0,a1,a2);
+ };
+ return wrap;
+ }
+};
+
+template<typename Ret, typename Arg0, typename Arg1, typename Arg2>
+struct TObjcBlockRetArgs3
+{
+ typedef Ret (^t)(Arg0 a0, Arg1 a1, Arg2 a2);
+ inline static t create(Dynamic func)
+ {
+ NSHaxeWrapperClass *wrapper = [[NSHaxeWrapperClass alloc] init:func.mPtr];
+ t wrap = ^(Arg0 a0, Arg1 a1, Arg2 a2) {
+ return (Ret) wrapper->haxeObject->__run(a0,a1,a2);
+ } ;
+ }
+};
+
+
+// 4 arg
+template<typename Arg0, typename Arg1, typename Arg2, typename Arg3>
+struct TObjcBlockVoidArgs4
+{
+ typedef void (^t)(Arg0 a0, Arg1 a1, Arg2 a2, Arg3 a3);
+
+ static t create(Dynamic func)
+ {
+ NSHaxeWrapperClass *wrapper = [[NSHaxeWrapperClass alloc] init:func.mPtr];
+ t wrap = ^(Arg0 a0, Arg1 a1, Arg2 a2, Arg3 a3) {
+ wrapper->haxeObject->__run(a0,a1,a2,a3);
+ };
+ return wrap;
+ }
+};
+
+template<typename Ret, typename Arg0, typename Arg1, typename Arg2, typename Arg3>
+struct TObjcBlockRetArgs4
+{
+ typedef Ret (^t)(Arg0 a0, Arg1 a1, Arg2 a2, Arg3 a3);
+ inline static t create(Dynamic func)
+ {
+ NSHaxeWrapperClass *wrapper = [[NSHaxeWrapperClass alloc] init:func.mPtr];
+ t wrap = ^(Arg0 a0, Arg1 a1, Arg2 a2, Arg3 a3) {
+ return (Ret) wrapper->haxeObject->__run(a0,a1,a2,a3);
+ } ;
+ }
+};
+
+
+// 5 arg
+template<typename Arg0, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
+struct TObjcBlockVoidArgs5
+{
+ typedef void (^t)(Arg0 a0, Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4);
+
+ static t create(Dynamic func)
+ {
+ NSHaxeWrapperClass *wrapper = [[NSHaxeWrapperClass alloc] init:func.mPtr];
+ t wrap = ^(Arg0 a0, Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4) {
+ wrapper->haxeObject->__run(a0,a1,a2,a3,a4);
+ };
+ return wrap;
+ }
+};
+
+template<typename Ret, typename Arg0, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
+struct TObjcBlockRetArgs5
+{
+ typedef Ret (^t)(Arg0 a0, Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4);
+ inline static t create(Dynamic func)
+ {
+ NSHaxeWrapperClass *wrapper = [[NSHaxeWrapperClass alloc] init:func.mPtr];
+ t wrap = ^(Arg0 a0, Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4) {
+ return (Ret) wrapper->haxeObject->__run(a0,a1,a2,a3,a4);
+ } ;
+ }
+};
+
+
+
+
+
+
+
+
+}
+
+#endif
+
diff --git a/Sources/c_snikket/iinclude/hx/Object.h b/Sources/c_snikket/iinclude/hx/Object.h
new file mode 100644
index 0000000..8cf2fa8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/Object.h
@@ -0,0 +1,407 @@
+#ifndef HX_OBJECT_H
+#define HX_OBJECT_H
+
+#ifndef HXCPP_H
+#error "Please include hxcpp.h, not hx/Object.h"
+#endif
+
+
+
+// --- Constants -------------------------------------------------------
+
+// These values are returned from the "__GetType" function
+enum hxObjectType
+{
+ vtUnknown = -1,
+ vtInt = 0xff,
+ vtNull = 0,
+ vtFloat = 1,
+ vtBool = 2,
+ vtString = 3,
+ vtObject = 4,
+ vtArray = 5,
+ vtFunction = 6,
+ vtEnum,
+ vtClass,
+ vtInt64,
+ vtAbstractBase = 0x100,
+};
+
+
+namespace hx
+{
+
+
+
+class FieldRef;
+class IndexRef;
+typedef Array<Dynamic> DynamicArray;
+HXCPP_EXTERN_CLASS_ATTRIBUTES null BadCast();
+
+#ifdef HXCPP_SCRIPTABLE
+
+// CPPIA_CALL = fastcall on x86(32), nothing otherwise
+#if (defined(_WIN32) && !defined(_M_X64) && !defined(__x86_64__) && !defined(_ARM_) ) || \
+ defined(HXCPP_X86) || defined(__i386__) || defined(__i386) || \
+ (!defined(_WIN32) && !defined(_ARM_) && !defined(__arm__) && !defined(__x86_64__) )
+
+ #if defined(__GNUC__) && !defined(__APPLE__) && !defined(EMSCRIPTEN)
+ #define CPPIA_CALL __attribute__ ((fastcall))
+ #elif defined(_MSC_VER)
+ #define CPPIA_CALL __fastcall
+ #endif
+#endif
+
+#ifndef CPPIA_CALL
+ #define CPPIA_CALL
+#endif
+
+
+typedef void (CPPIA_CALL *StackExecute)(struct StackContext *ctx);
+struct ScriptFunction
+{
+ ScriptFunction(StackExecute inExe=0,const char *inSig=0)
+ : execute(inExe), signature(inSig) { }
+ StackExecute execute;
+ const char *signature;
+};
+struct ScriptCallable;
+
+#endif
+
+enum NewObjectType
+{
+ NewObjAlloc,
+ NewObjContainer,
+ NewObjConst,
+};
+
+enum
+{
+ clsIdDynamic = 1,
+ clsIdClass,
+ clsIdInt,
+ clsIdInt64,
+ clsIdFloat,
+ clsIdBool,
+ clsIdString,
+ clsIdMath,
+ clsIdEnum,
+ clsIdClosure,
+ clsIdVirtualArray,
+ clsIdArrayIterator,
+ clsIdArrayBase,
+ clsIdArrayByte,
+ clsIdArrayShort,
+ clsIdArrayInt,
+ clsIdArrayBool,
+ clsIdArrayFloat32,
+ clsIdArrayFloat64,
+ clsIdArrayString,
+ clsIdArrayInt64,
+ clsIdArrayObject,
+ clsIdAbstract,
+ clsIdHash,
+ clsIdWeakRef,
+ clsIdExternalPrimitive,
+ clsIdPointer,
+ clsIdStruct,
+ clsIdCMember0,
+ clsIdCMember1,
+ clsIdCMember2,
+ clsIdCMember3,
+ clsIdCMember4,
+ clsIdCMember5,
+ clsIdCMemberVar,
+ clsIdCStatic0,
+ clsIdCStatic1,
+ clsIdCStatic2,
+ clsIdCStatic3,
+ clsIdCStatic4,
+ clsIdCStatic5,
+ clsIdCStaticVar,
+ clsIdMutex,
+ clsIdSemaphore,
+ clsIdCondition,
+ clsIdLock,
+ clsIdDeque,
+ clsIdThreadInfo,
+ clsIdPcreData,
+ clsIdFio,
+ clsIdProcess,
+ clsIdSocket,
+ clsIdRandom,
+ clsIdPollData,
+ clsIdSqlite,
+ clsIdMysql,
+ clsIdMysqlResult,
+ clsIdSsl,
+ clsIdSslCert,
+ clsIdSslConf,
+ clsIdSslKey,
+ clsIdZLib,
+
+};
+
+
+// --- hx::Object ------------------------------------------------------------
+//
+// Base for all hxcpp objects.
+// This contains the virtual functions required by the core to provide
+// a generic interface to the specific classes.
+//
+// Hxcpp classes inherit from this.
+//
+class HXCPP_EXTERN_CLASS_ATTRIBUTES Object
+{
+public:
+ enum { _hx_ClassId = hx::clsIdDynamic };
+
+
+ inline void *operator new( size_t inSize, bool inContainer=true, const char *inName=0 )
+ {
+ #ifdef HX_USE_INLINE_IMMIX_OPERATOR_NEW
+ ImmixAllocator *alloc = HX_CTX_GET;
+
+ #ifdef HXCPP_DEBUG
+ if (!alloc)
+ BadImmixAlloc();
+ #endif
+
+ return ImmixAllocator::alloc(alloc, inSize, inContainer, inName);
+
+ #else // Not HX_USE_INLINE_IMMIX_OPERATOR_NEW ...
+
+ void *result = hx::InternalNew(inSize,inContainer);
+
+ #ifdef HXCPP_TELEMETRY
+ __hxt_gc_new(result, inSize, inName);
+ #endif
+ return result;
+ #endif
+ }
+
+ inline void *operator new( size_t inSize, hx::NewObjectType inType, const char *inName=0 )
+ {
+ if (inType==NewObjConst)
+ return InternalCreateConstBuffer(0,(int)inSize);
+ return operator new(inSize, inType==NewObjContainer, inName);
+ }
+
+ void operator delete( void *, bool) { }
+ void operator delete( void *, bool, const char * ) { }
+ void operator delete( void *, int ) { }
+ void operator delete( void *, hx::NewObjectType) { }
+ void operator delete( void *, hx::NewObjectType, const char * ) { }
+
+ virtual bool _hx_isInstanceOf(int inClassId);
+
+ //virtual void *__root();
+ virtual void __Mark(hx::MarkContext *__inCtx) { }
+ #ifdef HXCPP_VISIT_ALLOCS
+ virtual void __Visit(hx::VisitContext *__inCtx) { }
+ #endif
+
+ // helpers...
+ inline bool __IsArray() const { return __GetType()==vtArray; }
+
+ virtual int __GetType() const { return vtClass; }
+ virtual void *__GetHandle() const { return 0; }
+
+
+ virtual hx::FieldRef __FieldRef(const String &inString);
+
+ virtual String __ToString() const;
+
+ virtual int __ToInt() const { return 0; }
+ virtual double __ToDouble() const { return __ToInt(); }
+ virtual cpp::Int64 __ToInt64() const { return (cpp::Int64)(__ToDouble()); }
+ virtual const char * __CStr() const;
+ virtual String toString();
+ virtual bool __HasField(const String &inString);
+ virtual hx::Val __Field(const String &inString, hx::PropertyAccess inCallProp);
+
+ // Non-virtual
+ Dynamic __IField(int inFieldID);
+ double __INumField(int inFieldID);
+ virtual void *_hx_getInterface(int inId);
+
+ virtual hx::Val __SetField(const String &inField,const hx::Val &inValue, hx::PropertyAccess inCallProp);
+
+ virtual void __SetThis(Dynamic inThis);
+ virtual Dynamic __Run(const Array<Dynamic> &inArgs);
+ virtual Dynamic *__GetFieldMap();
+ virtual void __GetFields(Array<String> &outFields);
+ virtual hx::Class __GetClass() const;
+
+ virtual int __Compare(const hx::Object *inRHS) const;
+
+ virtual int __length() const { return 0; }
+ virtual Dynamic __GetItem(int inIndex) const;
+ virtual Dynamic __SetItem(int inIndex,Dynamic inValue);
+
+
+ typedef const Dynamic &D;
+ virtual Dynamic __run();
+ virtual Dynamic __run(D a);
+ virtual Dynamic __run(D a,D b);
+ virtual Dynamic __run(D a,D b,D c);
+ virtual Dynamic __run(D a,D b,D c,D d);
+ virtual Dynamic __run(D a,D b,D c,D d,D e);
+
+ virtual int __ArgCount() const { return -1; }
+
+ #ifdef HXCPP_SCRIPTABLE
+ virtual void **__GetScriptVTable() { return 0; }
+ virtual hx::ScriptCallable *__GetScriptCallable() { return 0; }
+ static hx::ScriptFunction __script_construct;
+ #endif
+
+ inline bool __compare( hx::Object *inRHS ) { return this!=inRHS; }
+
+ static hx::Class &__SGetClass();
+ static void __boot();
+};
+
+// --- hx::ObjectPtr ---------------------------------------------------------------
+//
+// This class simply provides syntax so that pointers can be written as objects,
+// and overloaded operators can be used
+
+template<typename OBJ_>
+class ObjectPtr
+{
+protected:
+ inline bool SetPtr(OBJ_ *inPtr)
+ {
+ mPtr = inPtr;
+ return true;
+ }
+ inline bool SetPtr(...) { return false; }
+
+ inline void CastPtr(hx::Object *inPtr,bool inThrowOnInvalid)
+ {
+ if (inPtr)
+ {
+ mPtr = inPtr->_hx_isInstanceOf(OBJ_::_hx_ClassId) ? reinterpret_cast<OBJ_*>(inPtr) : 0;
+
+ if (inThrowOnInvalid && !mPtr)
+ ::hx::BadCast();
+ }
+ else
+ mPtr = 0;
+ }
+
+public:
+ typedef OBJ_ Obj;
+ typedef OBJ_ *Ptr;
+
+ inline ObjectPtr() : mPtr(0) { }
+ inline ObjectPtr(OBJ_ *inObj) : mPtr(inObj) { }
+ inline ObjectPtr(const null &inNull) : mPtr(0) { }
+ inline ObjectPtr(const ObjectPtr<OBJ_> &inOther) : mPtr( inOther.mPtr ) { }
+ template<typename T>
+ inline ObjectPtr(const hx::Native<T> &inNative) : mPtr( dynamic_cast<T>(inNative.ptr) ) { }
+
+ template<typename SOURCE_>
+ inline ObjectPtr(const ObjectPtr<SOURCE_> &inObjectPtr)
+ {
+ if (!SetPtr(inObjectPtr.mPtr))
+ CastPtr(inObjectPtr.mPtr,false);
+ }
+
+
+ inline ObjectPtr(const ::cpp::Variant &inVariant)
+ {
+ hx::Object *object = inVariant.asObject();
+ if (!SetPtr(object))
+ CastPtr(object,false);
+ }
+
+ template<typename SOURCE_>
+ inline ObjectPtr(const SOURCE_ *inPtr,bool inCheckCast=true)
+ {
+ if (!SetPtr(const_cast<SOURCE_ *>(inPtr)))
+ CastPtr(const_cast<SOURCE_ *>(inPtr),inCheckCast);
+ }
+
+ inline ObjectPtr &operator=(const null &inNull) { mPtr = 0; return *this; }
+ inline ObjectPtr &operator=(Ptr inRHS) { mPtr = inRHS; return *this; }
+ inline ObjectPtr &operator=(const ObjectPtr &inRHS) { mPtr = inRHS.mPtr; return *this; }
+ template<typename InterfaceImpl>
+ inline ObjectPtr &operator=(InterfaceImpl *inRHS)
+ {
+ mPtr = inRHS->operator Ptr();
+ return *this;
+ }
+
+ inline OBJ_ *GetPtr() const { return mPtr; }
+ inline OBJ_ *operator->()
+ {
+ #ifdef HXCPP_CHECK_POINTER
+ if (!mPtr) NullReference("Object", true);
+ // The handler might have fixed up the null value
+ if (!mPtr) NullReference("Object", false);
+ #ifdef HXCPP_GC_CHECK_POINTER
+ GCCheckPointer(mPtr);
+ #endif
+ #endif
+ return mPtr;
+ }
+ inline const OBJ_ *operator->() const
+ {
+ #ifdef HXCPP_CHECK_POINTER
+ if (!mPtr) NullReference("Object", true);
+ // The handler might have fixed up the null value
+ if (!mPtr) NullReference("Object", false);
+ #ifdef HXCPP_GC_CHECK_POINTER
+ GCCheckPointer(mPtr);
+ #endif
+ #endif
+ return mPtr;
+ }
+
+ template<typename T>
+ inline bool operator==(const T &inTRHS) const
+ {
+ ObjectPtr inRHS(inTRHS.mPtr,false);
+ if (mPtr==inRHS.mPtr) return true;
+ if (!mPtr || !inRHS.mPtr) return false;
+ return !mPtr->__compare(inRHS.mPtr);
+ }
+ inline bool operator==(const cpp::Variant &inRHS) const;
+ inline bool operator!=(const cpp::Variant &inRHS) const;
+
+ template<typename T>
+ inline bool operator!=(const T &inTRHS) const
+ {
+ ObjectPtr inRHS(inTRHS.mPtr,false);
+ if (mPtr==inRHS.mPtr) return false;
+ if (!mPtr || !inRHS.mPtr) return true;
+ return mPtr->__compare(inRHS.mPtr);
+ }
+
+ template<typename T>
+ operator hx::Native<T> () { return hx::Native<T>( mPtr ); }
+
+ inline bool operator==(const null &inRHS) const { return mPtr==0; }
+ inline bool operator!=(const null &inRHS) const { return mPtr!=0; }
+
+ //inline bool operator==(const Dynamic &inRHS) const { return inRHS==*this; }
+ //inline bool operator!=(const Dynamic &inRHS) const { return inRHS!=*this; }
+
+
+ // This is defined in the "FieldRef" class...
+ inline class hx::FieldRef FieldRef(const String &inString);
+ inline class hx::IndexRef IndexRef(int inString);
+ inline static hx::Class &__SGetClass() { return OBJ_::__SGetClass(); }
+
+ OBJ_ *mPtr;
+};
+
+
+} // end namespace hx
+
+
+
+#endif
diff --git a/Sources/c_snikket/iinclude/hx/Operators.h b/Sources/c_snikket/iinclude/hx/Operators.h
new file mode 100644
index 0000000..862a5da
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/Operators.h
@@ -0,0 +1,439 @@
+#ifndef HX_OPERATORS_H
+#define HX_OPERATORS_H
+
+
+
+template<typename T> bool null::operator == (const hx::ObjectPtr<T> &O) const { return !O.mPtr; }
+template<typename T> inline bool null::operator != (const hx::ObjectPtr<T> &O) const { return O.mPtr; }
+
+template<typename T> inline bool null::operator == (const Array<T> &O) const { return !O.mPtr; }
+template<typename T> inline bool null::operator != (const Array<T> &O) const { return O.mPtr; }
+inline bool null::operator == (const hx::FieldRef &O) const { return !O.HasPointer(); }
+inline bool null::operator != (const hx::FieldRef &O) const { return O.HasPointer(); }
+inline bool null::operator == (const hx::IndexRef &O) const { return !O.HasPointer(); }
+inline bool null::operator != (const hx::IndexRef &O) const { return O.HasPointer(); }
+
+inline bool null::operator == (const Dynamic &O) const { return !O.mPtr; }
+inline bool null::operator != (const Dynamic &O) const { return O.mPtr; }
+
+inline bool null::operator == (const String &O) const { return !O.raw_ptr(); }
+inline bool null::operator != (const String &O) const { return O.raw_ptr(); }
+
+namespace hx {
+template<typename T> Null<T>::operator Dynamic() { if (isNull) return Dynamic(); return value; }
+}
+
+HX_COMPARE_NULL_MOST_OPS(String)
+HX_COMPARE_NULL_MOST_OPS(Dynamic)
+HX_COMPARE_NULL_MOST_OPS(hx::FieldRef)
+HX_COMPARE_NULL_MOST_OPS(hx::IndexRef)
+
+//HX_NULL_DEFINE_COMPARE_MOST_OPS(String)
+//HX_NULL_DEFINE_COMPARE_MOST_OPS(Dynamic)
+//HX_NULL_DEFINE_COMPARE_MOST_OPS(hx::FieldRef)
+//HX_NULL_DEFINE_COMPARE_MOST_OPS(hx::IndexRef)
+
+
+// Operators for mixing various types ....
+
+
+inline String operator+(const cpp::UInt64 &i,const String &s) { return String(i) + s; }
+inline String operator+(const cpp::Int64 &i,const String &s) { return String(i) + s; }
+inline String operator+(const int &i,const String &s) { return String(i) + s; }
+inline String operator+(const unsigned int &i,const String &s) { return String(i) + s; }
+inline String operator+(const double &d,const String &s) { return String(d) + s; }
+inline String operator+(const float &d,const String &s) { return String(d) + s; }
+inline String operator+(const bool &b,const String &s) { return String(b) + s; }
+inline String operator+(const unsigned char c,const String &s) { return String(c) + s; }
+inline String operator+(const signed char c,const String &s) { return String(c) + s; }
+inline String operator+(const unsigned short c,const String &s) { return String(c) + s; }
+inline String operator+(const signed short c,const String &s) { return String(c) + s; }
+inline String operator+(const null &n,const String &s) { return String(n) + s; }
+inline String operator+(const cpp::CppInt32__ &i,const String &s) { return String(i) + s; }
+
+template<typename T_>
+ inline String operator+(const hx::ObjectPtr<T_> &inLHS,const String &s)
+ { return (inLHS.mPtr ? const_cast<hx::ObjectPtr<T_> & >(inLHS)->toString() : HX_CSTRING("null") ) + s; }
+
+/*
+template<typename LHS_>
+ inline Dynamic operator+(LHS_ inLHS, const hx::FieldRef &inField)
+ { return inLHS + inField.operator Dynamic(); }
+
+template<typename LHS_>
+ inline Dynamic operator+(LHS_ inLHS,const hx::IndexRef &inIndexRef)
+ { return inLHS + inIndexRef.operator Dynamic(); }
+*/
+
+// += -= *= /= %= &= |= ^= <<= >>= >>>=
+
+namespace hx
+{
+
+template<typename T> inline double ToDouble(T inT) { return 0; }
+template<typename T> inline double ToDouble(hx::ObjectPtr<T> inObj)
+{
+ return inObj.mPtr ? inObj.mPtr->__ToDouble() : 0.0;
+}
+template<> inline double ToDouble(String inValue) { return __hxcpp_parse_float(inValue); }
+template<> inline double ToDouble(double inValue) { return inValue; }
+template<> inline double ToDouble(int inValue) { return inValue; }
+template<> inline double ToDouble(bool inValue) { return inValue; }
+template<> inline double ToDouble(float inValue) { return inValue; }
+template<> inline double ToDouble(cpp::UInt64 inValue) { return inValue; }
+template<> inline double ToDouble(cpp::Int64 inValue) { return inValue; }
+template<> inline double ToDouble(null inValue) { return 0; }
+
+
+
+inline int UShr(int inData,int inShift)
+{
+ return ((unsigned int)inData) >> inShift;
+}
+
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES double DoubleMod(double inLHS,double inRHS);
+
+template<typename TL,typename TR>
+double Mod(TL inLHS,TR inRHS) { return hx::DoubleMod(inLHS,inRHS); }
+
+double DivByZero(double d);
+
+#if !defined(_MSC_VER) || _MSC_VER > 1399
+inline int Mod(int inLHS,int inRHS)
+{
+ if (!inRHS)
+ hx::Throw(HX_CSTRING("Mod by 0 Error."));
+ return inLHS % inRHS;
+}
+#endif
+
+
+template<typename L, typename R>
+inline L& AddEq(L &inLHS, R inRHS) { inLHS = inLHS + inRHS; return inLHS; }
+template<typename L, typename R>
+inline L& MultEq(L &inLHS, R inRHS) { inLHS = inLHS * inRHS; return inLHS; }
+template<typename L, typename R>
+inline L& DivEq(L &inLHS, R inRHS) { inLHS = (double)inLHS / (double)inRHS; return inLHS; }
+template<typename L, typename R>
+inline L& SubEq(L &inLHS, R inRHS) { inLHS = inLHS - inRHS; return inLHS; }
+template<typename L, typename R>
+inline L& AndEq(L &inLHS, R inRHS) { inLHS = (int)inLHS & (int)inRHS; return inLHS; }
+template<typename L, typename R>
+inline L& OrEq(L &inLHS, R inRHS) { inLHS = (int)inLHS | (int)inRHS; return inLHS; }
+template<typename L, typename R>
+inline L& XorEq(L &inLHS, R inRHS) { inLHS = (int)inLHS ^ (int)inRHS; return inLHS; }
+template<typename L, typename R>
+inline L& ShlEq(L &inLHS, R inRHS) { inLHS = (int)inLHS << (int)inRHS; return inLHS; }
+template<typename L, typename R>
+inline L& ShrEq(L &inLHS, R inRHS) { inLHS = (int)inLHS >> (int)inRHS; return inLHS; }
+template<typename L, typename R>
+inline L& UShrEq(L &inLHS, R inRHS) { inLHS = hx::UShr(inLHS,inRHS); return inLHS; }
+template<typename L, typename R>
+inline L& ModEq(L &inLHS, R inRHS) { inLHS = DoubleMod(inLHS,inRHS); return inLHS; }
+
+#if defined(__GNUC__) || defined(__SNC__)
+template<typename R>
+inline hx::FieldRef AddEq(hx::FieldRef inLHS, R inRHS) { inLHS = inLHS + inRHS; return inLHS; }
+template<typename R>
+inline hx::FieldRef MultEq(hx::FieldRef inLHS, R inRHS) { inLHS = inLHS * inRHS; return inLHS; }
+template<typename R>
+inline hx::FieldRef DivEq(hx::FieldRef inLHS, R inRHS) { inLHS = (double)inLHS / (double)inRHS; return inLHS; }
+template<typename R>
+inline hx::FieldRef SubEq(hx::FieldRef inLHS, R inRHS) { inLHS = inLHS - inRHS; return inLHS; }
+template<typename R>
+inline hx::FieldRef AndEq(hx::FieldRef inLHS, R inRHS) { inLHS = (int)inLHS & (int)inRHS; return inLHS; }
+template<typename R>
+inline hx::FieldRef OrEq(hx::FieldRef inLHS, R inRHS) { inLHS = (int)inLHS | (int)inRHS; return inLHS; }
+template<typename R>
+inline hx::FieldRef XorEq(hx::FieldRef inLHS, R inRHS) { inLHS = (int)inLHS ^ (int)inRHS; return inLHS; }
+template<typename R>
+inline hx::FieldRef ShlEq(hx::FieldRef inLHS, R inRHS) { inLHS = (int)inLHS << (int)inRHS; return inLHS; }
+template<typename R>
+inline hx::FieldRef ShrEq(hx::FieldRef inLHS, R inRHS) { inLHS = (int)inLHS >> (int)inRHS; return inLHS; }
+template<typename R>
+inline hx::FieldRef UShrEq(hx::FieldRef inLHS, R inRHS) { inLHS = hx::UShr(inLHS,inRHS); return inLHS; }
+template<typename R>
+inline hx::FieldRef ModEq(hx::FieldRef inLHS, R inRHS) { inLHS = DoubleMod(inLHS,inRHS); return inLHS; }
+
+
+template<typename R>
+inline hx::IndexRef AddEq(hx::IndexRef inLHS, R inRHS) { inLHS = inLHS + inRHS; return inLHS; }
+template<typename R>
+inline hx::IndexRef MultEq(hx::IndexRef inLHS, R inRHS) { inLHS = (double)inLHS * (double)inRHS; return inLHS; }
+template<typename R>
+inline hx::IndexRef DivEq(hx::IndexRef inLHS, R inRHS) { inLHS = (double)inLHS / (double)inRHS; return inLHS; }
+template<typename R>
+inline hx::IndexRef SubEq(hx::IndexRef inLHS, R inRHS) { inLHS = (double)inLHS - (double)inRHS; return inLHS; }
+template<typename R>
+inline hx::IndexRef AndEq(hx::IndexRef inLHS, R inRHS) { inLHS = (int)inLHS & (int)inRHS; return inLHS; }
+template<typename R>
+inline hx::IndexRef OrEq(hx::IndexRef inLHS, R inRHS) { inLHS = (int)inLHS | (int)inRHS; return inLHS; }
+template<typename R>
+inline hx::IndexRef XorEq(hx::IndexRef inLHS, R inRHS) { inLHS = (int)inLHS ^ (int)inRHS; return inLHS; }
+template<typename R>
+inline hx::IndexRef ShlEq(hx::IndexRef inLHS, R inRHS) { inLHS = (int)inLHS << (int)inRHS; return inLHS; }
+template<typename R>
+inline hx::IndexRef ShrEq(hx::IndexRef inLHS, R inRHS) { inLHS = (int)inLHS >> (int)inRHS; return inLHS; }
+template<typename R>
+inline hx::IndexRef UShrEq(hx::IndexRef inLHS, R inRHS) { inLHS = hx::UShr(inLHS,inRHS); return inLHS; }
+template<typename R>
+inline hx::IndexRef ModEq(hx::IndexRef inLHS, R inRHS) { inLHS = DoubleMod(inLHS,inRHS); return inLHS; }
+
+
+
+#endif // __GNUC__ || __SNC__
+
+template<typename R,typename T>
+inline hx::__TArrayImplRef<T> AddEq(hx::__TArrayImplRef<T> ref, R inRHS)
+ { ref.mObject->__set(ref.mIndex, ref.mObject->__get(ref.mIndex) + inRHS); return ref;}
+
+template<typename R,typename T>
+inline hx::__TArrayImplRef<T> MultEq(hx::__TArrayImplRef<T> ref, R inRHS)
+ { ref.mObject->__set(ref.mIndex, ref.mObject->__get(ref.mIndex) * inRHS); return ref;}
+
+template<typename R,typename T>
+inline hx::__TArrayImplRef<T> DivEq(hx::__TArrayImplRef<T> ref, R inRHS)
+ { ref.mObject->__set(ref.mIndex, ref.mObject->__get(ref.mIndex) / inRHS); return ref;}
+
+template<typename R,typename T>
+inline hx::__TArrayImplRef<T> SubEq(hx::__TArrayImplRef<T> ref, R inRHS)
+ { ref.mObject->__set(ref.mIndex, ref.mObject->__get(ref.mIndex) - inRHS); return ref;}
+
+template<typename T>
+inline hx::__TArrayImplRef<T> AndEq(hx::__TArrayImplRef<T> ref, int inRHS)
+ { ref.mObject->__set(ref.mIndex, (int)ref.mObject->__get(ref.mIndex) & inRHS); return ref;}
+
+template<typename T>
+inline hx::__TArrayImplRef<T> OrEq(hx::__TArrayImplRef<T> ref, int inRHS)
+ { ref.mObject->__set(ref.mIndex, (int)ref.mObject->__get(ref.mIndex) | inRHS); return ref;}
+
+template<typename T>
+inline hx::__TArrayImplRef<T> XorEq(hx::__TArrayImplRef<T> ref, int inRHS)
+ { ref.mObject->__set(ref.mIndex, (int)ref.mObject->__get(ref.mIndex) ^ inRHS); return ref;}
+
+template<typename T>
+inline hx::__TArrayImplRef<T> ShlEq(hx::__TArrayImplRef<T> ref, int inRHS)
+ { ref.mObject->__set(ref.mIndex, (int)ref.mObject->__get(ref.mIndex) << inRHS); return ref;}
+
+template<typename T>
+inline hx::__TArrayImplRef<T> ShrEq(hx::__TArrayImplRef<T> ref, int inRHS)
+ { ref.mObject->__set(ref.mIndex, (int)ref.mObject->__get(ref.mIndex) >> inRHS); return ref;}
+
+template<typename T>
+inline hx::__TArrayImplRef<T> UShrEq(hx::__TArrayImplRef<T> ref, int inRHS)
+ { ref.mObject->__set(ref.mIndex, hx::UShr(ref.mObject->__get(ref.mIndex),inRHS)); return ref;}
+
+template<typename T>
+inline hx::__TArrayImplRef<T> UShrEq(hx::__TArrayImplRef<T> ref, double inRHS)
+ { ref.mObject->__set(ref.mIndex, DoubleMod(ref.mObject->__get(ref.mIndex),inRHS)); return ref;}
+
+
+
+
+
+
+
+template<typename T> inline T TCastObject(hx::Object *inObj) { return hx::BadCast(); }
+template<> inline bool TCastObject<bool>(hx::Object *inObj)
+{
+ if (!inObj) return false;
+ if (inObj->__GetType()!=::vtBool) return hx::BadCast();
+ return inObj?inObj->__ToInt():0;
+}
+template<> inline int TCastObject<int>(hx::Object *inObj)
+{
+ if (!inObj) return 0;
+ if (!(inObj->__GetType()==::vtInt ||
+ ((inObj->__GetType()==::vtFloat || inObj->__GetType()==::vtInt64) && inObj->__ToDouble()==inObj->__ToInt()) ) ) return hx::BadCast();
+ return inObj->__ToInt();
+}
+template<> inline double TCastObject<double>(hx::Object *inObj)
+{
+ if (!inObj) return 0.0;
+ if ((inObj->__GetType()!=::vtFloat && inObj->__GetType()!=::vtInt64 && inObj->__GetType()!=::vtInt))
+ return hx::BadCast();
+ return inObj->__ToDouble();
+}
+template<> inline float TCastObject<float>(hx::Object *inObj)
+{
+ if (!inObj || (inObj->__GetType()!=::vtFloat && inObj->__GetType()!=::vtInt64 && inObj->__GetType()!=::vtInt))
+ return hx::BadCast();
+ return inObj->__ToDouble();
+}
+
+template<> inline String TCastObject<String>(hx::Object *inObj)
+{
+ if (!inObj) return String();
+ if (inObj->__GetType()!=::vtString)
+ return hx::BadCast();
+ return inObj->__ToString();
+}
+
+template<> inline null TCastObject<null>(hx::Object *inObj) { return null(); }
+
+// Cast to scalar
+template<typename T> struct TCast
+{
+ template<typename VAL> static inline T cast(VAL inVal ) {
+ T result = TCastObject<T>(Dynamic(inVal).GetPtr());
+ //null string from null is ok...
+ //if (result==null()) hx::BadCast();
+ return result;
+ }
+
+ template<typename INOBJ>
+ static inline T cast(ObjectPtr<INOBJ> inObj )
+ {
+ T result = TCastObject<T>(inObj.GetPtr());
+ if (result==null()) hx::BadCast();
+ return result;
+ }
+
+ template<typename INOBJ>
+ static inline T cast(Array<INOBJ> inObj ) { return hx::BadCast(); }
+
+};
+
+// Cast to object
+template<typename T> struct TCast< ObjectPtr<T> >
+{
+ template<typename VAL> static inline ObjectPtr<T> cast(VAL inVal ) {
+ ObjectPtr<T> result = Dynamic(inVal);
+ if (result==null() && inVal!=null()) BadCast();
+ return result;
+ }
+
+ template<typename INOBJ>
+ static inline ObjectPtr<T> cast(ObjectPtr<INOBJ> inObj )
+ {
+ ObjectPtr<T> result = ObjectPtr<T>(inObj);
+ if (result==null() && inObj!=null()) hx::BadCast();
+ return result;
+ }
+};
+
+template< > struct TCast< cpp::VirtualArray >
+{
+ template<typename VAL> static inline cpp::VirtualArray cast(VAL inVal ) {
+ return cpp::VirtualArray(inVal);
+ }
+};
+
+// Cast to struct
+template<typename T,typename H> struct TCast< cpp::Struct<T,H> >
+{
+ static inline cpp::Struct<T,H> cast( const cpp::Struct<T,H> &inObj ) { return inObj; }
+};
+
+
+inline Array<Dynamic> TCastToArray(Dynamic inVal)
+{
+ Dynamic result = inVal;
+ if (result==null() && inVal!=null()) hx::BadCast();
+ return inVal;
+}
+
+template<typename PTRTYPE> struct DynamicConvertType { enum { Convert = aciNotArray }; };
+
+// Always convert ...
+template<> struct DynamicConvertType< hx::Interface * > { enum { Convert = aciAlwaysConvert }; };
+template<> struct DynamicConvertType< Array_obj<Dynamic> * > { enum { Convert = aciObjectArray }; };
+template<> struct DynamicConvertType< Array_obj< ::String> * > { enum { Convert = aciStringArray }; };
+template<typename T> struct DynamicConvertType< Array_obj<T> * > { enum { Convert = sizeof(T) }; };
+template<> struct DynamicConvertType< cpp::VirtualArray_obj * > { enum { Convert = aciVirtualArray }; };
+
+}
+
+
+
+template<typename RESULT>
+inline RESULT Dynamic::StaticCast() const
+{
+ typedef typename RESULT::Ptr type;
+
+ const int convertId = (int)hx::DynamicConvertType<type>::Convert;
+ if (convertId!=hx::aciNotArray && mPtr && convertId!=((hx::ArrayCommon *)mPtr)->getArrayConvertId())
+ {
+ // Constructing the result from the Dynamic value will check for a conversion
+ // using something like dynamic_cast
+ return *this;
+ }
+ else
+ {
+ // Simple reinterpret_cast
+ return (typename RESULT::Ptr)mPtr;
+ }
+}
+
+namespace hx
+{
+inline bool IsInterfacePtr(...) { return false; }
+inline bool IsInterfacePtr(const hx::Interface *) { return true; }
+}
+
+template<typename VALUE>
+inline void __hxcpp_unsafe_set(hx::ObjectPtr<VALUE> &outForced, const Dynamic &inD)
+{
+ if (hx::IsInterfacePtr(outForced.mPtr))
+ {
+ hx::Throw(HX_CSTRING("unsafe set of interfaces not supported yet."));
+ outForced.mPtr = (VALUE *)(inD.mPtr);
+ }
+ else
+ {
+ outForced.mPtr = (VALUE *)(inD.mPtr);
+ }
+}
+
+namespace hx
+{
+class HXCPP_EXTERN_CLASS_ATTRIBUTES StringValueIterator : public cpp::StringIterator<int>
+{
+public:
+ StringValueIterator(const String &inValue) : StringIterator(inValue) { }
+
+ int next() { return value.cca(pos++); }
+};
+
+class HXCPP_EXTERN_CLASS_ATTRIBUTES StringKeyValueIterator : public cpp::StringIterator<Dynamic>
+{
+public:
+ StringKeyValueIterator(const String &inValue) : StringIterator(inValue) { }
+
+ Dynamic next() {
+ int p = pos;
+ return
+ hx::AnonStruct2_obj< int,int >::Create(HX_("key",9f,89,51,00),p,
+ HX_("value",71,7f,b8,31), value.cca(pos++) );
+ }
+};
+}
+
+
+Dynamic String::iterator()
+{
+ return new hx::StringValueIterator(*this);
+}
+
+
+Dynamic String::keyValueIterator()
+{
+ return new hx::StringKeyValueIterator(*this);
+}
+
+namespace hx
+{
+template<typename FROM, typename TO> Dynamic hx::ArrayKeyValueIterator<FROM, TO>::next()
+{
+ int p = mIdx++;
+ return
+ hx::AnonStruct2_obj< int,TO >::Create(HX_("key",9f,89,51,00),p,
+ HX_("value",71,7f,b8,31), toTo(mArray->__get(p)) );
+}
+}
+
+
+
+
+#endif
diff --git a/Sources/c_snikket/iinclude/hx/QuickVec.h b/Sources/c_snikket/iinclude/hx/QuickVec.h
new file mode 100644
index 0000000..2427904
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/QuickVec.h
@@ -0,0 +1,204 @@
+#ifndef HX_QUICKVEC_INCLUDED
+#define HX_QUICKVEC_INCLUDED
+
+#include <stdlib.h>
+#include <algorithm>
+
+namespace hx
+{
+
+template<typename T>
+struct QuickVec
+{
+ int mAlloc;
+ int mSize;
+ T *mPtr;
+
+ QuickVec() : mPtr(0), mAlloc(0), mSize(0) { }
+ ~QuickVec()
+ {
+ if (mPtr)
+ free(mPtr);
+ }
+
+ inline void push(const T &inT)
+ {
+ if (mSize+1>mAlloc)
+ {
+ mAlloc = 10 + (mSize*3/2);
+ mPtr = (T *)realloc(mPtr,sizeof(T)*mAlloc);
+ }
+ mPtr[mSize]=inT;
+ mSize++;
+ }
+ void swap(QuickVec<T> &inOther)
+ {
+ std::swap(mAlloc, inOther.mAlloc);
+ std::swap(mSize, inOther.mSize);
+ std::swap(mPtr, inOther.mPtr);
+ }
+ T *setSize(int inSize)
+ {
+ if (inSize>mAlloc)
+ {
+ mAlloc = inSize;
+ mPtr = (T *)realloc(mPtr,sizeof(T)*mAlloc);
+ }
+ mSize = inSize;
+ return mPtr;
+ }
+ // Can push this many without realloc
+ bool hasExtraCapacity(int inN)
+ {
+ return mSize+inN<=mAlloc;
+ }
+
+ bool safeReserveExtra(int inN)
+ {
+ int want = mSize + inN;
+ if (want>mAlloc)
+ {
+ int wantAlloc = 10 + (mSize*3/2);
+ if (wantAlloc<want)
+ wantAlloc = want;
+ T *newBuffer = (T *)malloc( sizeof(T)*wantAlloc );
+ if (!newBuffer)
+ return false;
+ mAlloc = wantAlloc;
+ if (mPtr)
+ {
+ memcpy(newBuffer, mPtr, mSize*sizeof(T));
+ free(mPtr);
+ }
+ mPtr = newBuffer;
+ }
+ return true;
+ }
+ inline void pop_back() { --mSize; }
+ inline T &back() { return mPtr[mSize-1]; }
+ inline T pop()
+ {
+ return mPtr[--mSize];
+ }
+ inline void qerase(int inPos)
+ {
+ --mSize;
+ mPtr[inPos] = mPtr[mSize];
+ }
+ inline void erase(int inPos)
+ {
+ --mSize;
+ if (mSize>inPos)
+ memmove(mPtr+inPos, mPtr+inPos+1, (mSize-inPos)*sizeof(T));
+ }
+ void zero() { memset(mPtr,0,mSize*sizeof(T) ); }
+
+ inline bool qerase_val(T inVal)
+ {
+ for(int i=0;i<mSize;i++)
+ if (mPtr[i]==inVal)
+ {
+ --mSize;
+ mPtr[i] = mPtr[mSize];
+ return true;
+ }
+ return false;
+ }
+
+ inline bool some_left() { return mSize; }
+ inline bool empty() const { return !mSize; }
+ inline void clear() { mSize = 0; }
+ inline int next()
+ {
+ if (mSize+1>=mAlloc)
+ {
+ mAlloc = 10 + (mSize*3/2);
+ mPtr = (T *)realloc(mPtr,sizeof(T)*mAlloc);
+ }
+ return mSize++;
+ }
+ inline int size() const { return mSize; }
+ inline T &operator[](int inIndex) { return mPtr[inIndex]; }
+ inline const T &operator[](int inIndex) const { return mPtr[inIndex]; }
+
+private:
+ QuickVec(const QuickVec<T> &);
+ void operator =(const QuickVec<T> &);
+};
+
+
+template<typename T>
+class QuickDeque
+{
+ struct Slab
+ {
+ T mElems[1024];
+ };
+
+ QuickVec<Slab *> mSpare;
+ QuickVec<Slab *> mActive;
+
+ int mHeadPos;
+ int mTailPos;
+ Slab *mHead;
+ Slab *mTail;
+
+public:
+
+ QuickDeque()
+ {
+ mHead = mTail = 0;
+ mHeadPos = 1024;
+ mTailPos = 1024;
+ }
+ ~QuickDeque()
+ {
+ for(int i=0;i<mSpare.size();i++)
+ delete mSpare[i];
+ for(int i=0;i<mActive.size();i++)
+ delete mActive[i];
+ delete mHead;
+ if (mTail!=mHead)
+ delete mTail;
+ }
+ inline void push(T inObj)
+ {
+ if (mHeadPos<1024)
+ {
+ mHead->mElems[mHeadPos++] = inObj;
+ return;
+ }
+ if (mHead != mTail)
+ mActive.push(mHead);
+ mHead = mSpare.empty() ? new Slab : mSpare.pop();
+ mHead->mElems[0] = inObj;
+ mHeadPos = 1;
+ }
+ inline bool some_left() { return mHead!=mTail || mHeadPos!=mTailPos; }
+ inline T pop()
+ {
+ if (mTailPos<1024)
+ return mTail->mElems[mTailPos++];
+ if (mTail)
+ mSpare.push(mTail);
+ if (mActive.empty())
+ {
+ mTail = mHead;
+ }
+ else
+ {
+ mTail = mActive[0];
+ mActive.erase(0);
+ }
+ mTailPos = 1;
+ return mTail->mElems[0];
+ }
+
+private:
+ QuickDeque(const QuickDeque<T> &);
+ void operator=(const QuickDeque<T> &);
+};
+
+} // end namespace hx
+
+#endif
diff --git a/Sources/c_snikket/iinclude/hx/Scriptable.h b/Sources/c_snikket/iinclude/hx/Scriptable.h
new file mode 100644
index 0000000..db66f25
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/Scriptable.h
@@ -0,0 +1,275 @@
+#ifndef INCLUDED_HX_SCRIPTABLE
+#define INCLUDED_HX_SCRIPTABLE
+
+#include <typeinfo>
+#ifdef __clang__
+#pragma clang diagnostic ignored "-Winvalid-offsetof"
+#endif
+
+
+namespace hx
+{
+
+extern bool gEnableJit;
+inline void EnableJit(bool inEnable) { gEnableJit = inEnable; }
+
+#define HXCPP_CPPIA_SUPER_ARG(x) , (x)
+
+struct ScriptNamedFunction : public ScriptFunction
+{
+ ScriptNamedFunction(const ScriptFunction &s) : ScriptFunction(s), name(0), isStatic(false), superExecute(0) { }
+
+ ScriptNamedFunction(const char *inName=0,StackExecute inExe=0,const char *inSig=0, bool inIsStatic=false, StackExecute superExecute=0)
+ : ScriptFunction(inExe, inSig), name(inName), isStatic(inIsStatic), superExecute(superExecute) { }
+
+ const char *name;
+ bool isStatic;
+ StackExecute superExecute;
+};
+
+
+inline void SetFloatAligned(void *inPtr, const Float &inValue)
+{
+ #ifdef HXCPP_ALIGN_FLOAT
+ int *dest = (int *)inPtr;
+ const int *src = (const int *)&inValue;
+ dest[1] = src[1];
+ #else
+ *(Float *)inPtr = inValue;
+ #endif
+}
+
+
+inline Float GetFloatAligned(const void *inPtr)
+{
+ #ifdef HXCPP_ALIGN_FLOAT
+ Float result;
+ int *dest = (int *)&result;
+ const int *src = (const int *)inPtr;
+ dest[0] = src[0];
+ dest[1] = src[1];
+ return result;
+ #else
+ return *(Float *)inPtr;
+ #endif
+}
+
+
+inline void StackContext::pushFloat(Float f)
+{
+ SetFloatAligned(pointer, f);
+ pointer += sizeof(Float);
+}
+inline void StackContext::pushString(const String &s)
+{
+ *(String *)pointer = s;
+ pointer += sizeof(String);
+}
+
+inline void StackContext::pushObject(Dynamic d)
+{
+ *(hx::Object **)pointer = d.mPtr;
+ pointer += sizeof(hx::Object *);
+}
+
+inline void StackContext::returnFloat(Float f)
+{
+ SetFloatAligned(frame, f);
+}
+inline void StackContext::returnString(const String &s)
+{
+ *(String *)frame = s;
+}
+inline void StackContext::returnObject(Dynamic d)
+{
+ *(hx::Object **)frame = d.mPtr;
+}
+
+inline hx::Object *StackContext::getThis(bool inCheckPtr)
+{
+ #ifdef HXCPP_CHECK_POINTER
+ if (inCheckPtr)
+ {
+ if (!*(hx::Object **)frame) NullReference("This", false);
+ #ifdef HXCPP_GC_CHECK_POINTER
+ GCCheckPointer(*(hx::Object **)frame);
+ #endif
+ }
+ #endif
+ return *(hx::Object **)frame;
+}
+
+
+inline Float StackContext::getFloat(int inPos)
+{
+ return GetFloatAligned(frame+inPos);
+}
+inline String StackContext::getString(int inPos)
+{
+ return *(String *)(frame+inPos);
+}
+inline Dynamic StackContext::getObject(int inPos)
+{
+ return *(hx::Object **)(frame+inPos);
+}
+
+
+enum SignatureChar
+{
+ sigVoid = 'v',
+ sigBool = 'b',
+ sigInt = 'i',
+ sigFloat = 'f',
+ sigString = 's',
+ sigObject = 'o',
+};
+
+
+
+struct AutoStack
+{
+ CppiaCtx *ctx;
+ unsigned char *pointer;
+ unsigned char *frame;
+
+ AutoStack(CppiaCtx *inCtx) : ctx(inCtx)
+ {
+ frame = ctx->frame;
+ pointer = ctx->pointer;
+ ctx->frame = pointer;
+ }
+ AutoStack(CppiaCtx *inCtx,unsigned char *inPointer) : ctx(inCtx)
+ {
+ frame = ctx->frame;
+ pointer = inPointer;
+ ctx->frame = pointer;
+ }
+
+ ~AutoStack()
+ {
+ ctx->pointer = pointer;
+ ctx->frame = frame;
+ }
+};
+
+
+
+
+
+typedef hx::Object * (*ScriptableClassFactory)(void **inVTable,int inDataSize);
+typedef hx::Object * (*ScriptableInterfaceFactory)(void **inVTable,::hx::Object *);
+
+void ScriptableRegisterClass( String inName, int inBaseSize, ScriptNamedFunction *inFunctions, ScriptableClassFactory inFactory, ScriptFunction inConstruct);
+
+
+void ScriptableRegisterInterface( String inName, ScriptNamedFunction *inFunctions, void *inInterfacePointers);
+void ScriptableRegisterNameSlots(const char *inNames[], int inLength);
+
+::String ScriptableToString(void *);
+hx::Class ScriptableGetClass(void *);
+int ScriptableGetType(void *);
+void ScriptableMark(void *, hx::Object *, HX_MARK_PARAMS);
+void ScriptableVisit(void *, hx::Object *, HX_VISIT_PARAMS);
+bool ScriptableField(hx::Object *, const ::String &,hx::PropertyAccess inCallProp,Dynamic &outResult);
+bool ScriptableField(hx::Object *, int inName,hx::PropertyAccess inCallProp,Float &outResult);
+bool ScriptableField(hx::Object *, int inName,hx::PropertyAccess inCallProp,Dynamic &outResult);
+void ScriptableGetFields(hx::Object *inObject, Array< ::String> &outFields);
+bool ScriptableSetField(hx::Object *, const ::String &, Dynamic inValue,hx::PropertyAccess inCallProp, Dynamic &outValue);
+
+
+class CppiaLoadedModule_obj : public ::hx::Object
+{
+public:
+ virtual void run() = 0;
+ virtual void boot() = 0;
+ virtual ::hx::Class resolveClass( ::String inName) = 0;
+};
+typedef ::hx::ObjectPtr<CppiaLoadedModule_obj> CppiaLoadedModule;
+
+
+
+} // End namespace hx
+
+void __scriptable_load_neko(String inName);
+void __scriptable_load_cppia(String inCode);
+::hx::CppiaLoadedModule __scriptable_cppia_from_string(String inCode);
+::hx::CppiaLoadedModule __scriptable_cppia_from_data(Array<unsigned char> inBytes);
+void __scriptable_load_neko_bytes(Array<unsigned char> inBytes);
+void __scriptable_load_abc(Array<unsigned char> inBytes);
+
+#define HX_SCRIPTABLE_REGISTER_INTERFACE(name,class) \
+ hx::ScriptableRegisterInterface( HX_CSTRING(name), __scriptableFunctions, & class##_scriptable )
+
+#define HX_SCRIPTABLE_REGISTER_CLASS(name,class) \
+ hx::ScriptableRegisterClass( HX_CSTRING(name), (int)offsetof(class##__scriptable,__scriptVTable) + sizeof(void *), __scriptableFunctions, class##__scriptable::__script_create, class##__scriptable::__script_construct )
+
+
+#ifdef HXCPP_VISIT_ALLOCS
+#define SCRIPTABLE_VISIT_FUNCTION \
+void __Visit(HX_VISIT_PARAMS) { super::__Visit(HX_VISIT_ARG); hx::ScriptableVisit(__scriptVTable[-1],this,HX_VISIT_ARG); }
+#else
+#define SCRIPTABLE_VISIT_FUNCTION
+#endif
+
+
+#define HX_DEFINE_SCRIPTABLE(ARG_LIST) \
+ inline void *operator new( size_t inSize, int inExtraDataSize ) \
+ { \
+ return hx::InternalNew(inSize + inExtraDataSize,true); \
+ } \
+ inline void operator delete(void *,int) {} \
+ public: \
+ void **__scriptVTable; \
+ static hx::Object *__script_create(void **inVTable, int inExtra) { \
+ __ME *result = new (inExtra) __ME(); \
+ result->__scriptVTable = inVTable; \
+ return result; } \
+ void ** __GetScriptVTable() { return __scriptVTable; } \
+ ::String toString() { if (__scriptVTable[0] ) \
+ { hx::CppiaCtx *ctx = hx::CppiaCtx::getCurrent(); hx::AutoStack a(ctx); ctx->pushObject(this); return ctx->runString(__scriptVTable[0]); } \
+ else return __superString::toString(); } \
+ ::String __ToString() const { return hx::ScriptableToString(__scriptVTable[-1]); } \
+ hx::Class __GetClass() const { return hx::ScriptableGetClass(__scriptVTable[-1]); } \
+ int __GetType() const { return hx::ScriptableGetType(__scriptVTable[-1]); } \
+ void __Mark(HX_MARK_PARAMS) { super::__Mark(HX_MARK_ARG); hx::ScriptableMark(__scriptVTable[-1],this,HX_MARK_ARG); } \
+ SCRIPTABLE_VISIT_FUNCTION
+
+
+
+#define HX_DEFINE_SCRIPTABLE_INTERFACE \
+ void **__scriptVTable; \
+ Dynamic mDelegate; \
+ hx::Object *__GetRealObject() { return mDelegate.mPtr; } \
+ SCRIPTABLE_VISIT_FUNCTION \
+ void ** __GetScriptVTable() { return __scriptVTable; } \
+ public: \
+ static hx::Object *__script_create(void **inVTable,hx::Object *inDelegate) { \
+ __ME *result = new __ME(); \
+ result->__scriptVTable = inVTable; \
+ result->mDelegate = inDelegate; \
+ return result; }
+
+
+
+#define HX_DEFINE_SCRIPTABLE_DYNAMIC \
+ \
+ hx::Val __Field(const ::String &inName,hx::PropertyAccess inCallProp) \
+ { Dynamic result; if (hx::ScriptableField(this,inName,inCallProp,result)) return result; return super::__Field(inName,inCallProp); } \
+ Float __INumField(int inFieldID) \
+ { Float result; if (hx::ScriptableField(this,inFieldID,hx::paccAlways,result)) return result; return super::__INumField(inFieldID); } \
+ Dynamic __IField(int inFieldID) \
+ { Dynamic result; if (hx::ScriptableField(this,inFieldID,hx::paccAlways,result)) return result; return super::__IField(inFieldID); } \
+ hx::Val __SetField(const ::String &inName,const hx::Val &inValue,hx::PropertyAccess inCallProp) \
+ { \
+ Dynamic value; \
+ if (hx::ScriptableSetField(this, inName, inValue,inCallProp,value)) \
+ return value; \
+ return super::__SetField(inName,inValue,inCallProp); \
+ } \
+ void __GetFields(Array< ::String> &outFields) \
+ { super::__GetFields(outFields); hx::ScriptableGetFields(this,outFields); }
+
+
+
+
+#endif
diff --git a/Sources/c_snikket/iinclude/hx/StackContext.h b/Sources/c_snikket/iinclude/hx/StackContext.h
new file mode 100644
index 0000000..67dc563
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/StackContext.h
@@ -0,0 +1,746 @@
+#ifndef HX_STACK_CONTEXT_H
+#define HX_STACK_CONTEXT_H
+
+#include "QuickVec.h"
+
+#ifdef HXCPP_SINGLE_THREADED_APP
+ #define HX_CTX_GET ::hx::gMainThreadContext
+#else
+ #define HX_CTX_GET ((::hx::StackContext *)::hx::tlsStackContext)
+#endif
+
+// Set:
+// HXCPP_STACK_LINE if stack line numbers need to be tracked
+// HXCPP_STACK_TRACE if stack frames need to be tracked
+
+// Keep track of lines - more accurate stack traces for exceptions, also
+// needed for the debugger
+#if (defined(HXCPP_DEBUG) || defined(HXCPP_DEBUGGER)) && !defined(HXCPP_STACK_LINE)
+#define HXCPP_STACK_LINE
+#endif
+
+// Do we need to keep a stack trace - for basic exception handelling, also needed for the debugger
+// At a minimum, you can track the functions calls and nothing else
+#if (defined(HXCPP_STACK_LINE) || defined(HXCPP_TELEMETRY) || defined(HXCPP_PROFILER) || defined(HXCPP_DEBUG)) && !defined(HXCPP_STACK_TRACE)
+ #define HXCPP_STACK_TRACE
+#endif
+
+#if defined(HXCPP_STACK_TRACE) && defined(HXCPP_SCRIPTABLE)
+#define HXCPP_STACK_SCRIPTABLE
+#endif
+// HXCPP_DEBUG_HASH == HXCPP_DEBUGGER
+// HXCPP_STACK_VARS == HXCPP_DEBUGGER
+
+
+// HX_STACKFRAME(pos) - tracks position according to define. May be optimized away.
+// HX_GC_STACKFRAME(pos) - tracks position according to define, but is never optimized away
+// HX_JUST_GC_STACKFRAME - never tracks position, never optimized away
+
+// Setup the _hx_stackframe variable
+#ifdef HXCPP_STACK_TRACE
+ // Setup the 'HX_DEFINE_STACK_FRAME' 'HX_LOCAL_STACK_FRAME' macro.
+ // This will be empty, just track functions(release), track functions and lines(debug) or track everything (debugger)
+ #define HX_DECLARE_STACK_FRAME(name) extern ::hx::StackPosition name;
+
+ #ifdef HXCPP_STACK_LINE
+
+ #ifdef HXCPP_DEBUGGER
+ #define HX_DEFINE_STACK_FRAME(varName, className, functionName, classFunctionHash, fullName,fileName, \
+ lineNumber, fileHash ) \
+ ::hx::StackPosition varName(className, functionName, fullName, fileName, lineNumber, \
+ classFunctionHash, fileHash);
+ #else
+ #define HX_DEFINE_STACK_FRAME(varName, className, functionName, classFunctionHash, fullName,fileName, \
+ lineNumber, fileHash ) \
+ ::hx::StackPosition varName(className, functionName, fullName, fileName, lineNumber);
+ #endif
+ #else
+
+ #define HX_DEFINE_STACK_FRAME(varName, className, functionName, classFunctionHash, fullName,fileName, \
+ lineNumber, fileHash ) \
+ ::hx::StackPosition varName(className, functionName, fullName, fileName);
+
+ #endif
+
+ #define HX_LOCAL_STACK_FRAME(a,b,c,d,e,f,g,h) static HX_DEFINE_STACK_FRAME(a,b,c,d,e,f,g,h)
+
+ // Haxe < 330 does not create position pointers, and we must use a local one.
+ // This code will hst the 'HX_STACK_FRAME' macro
+ #define HX_STACK_FRAME(className, functionName, classFunctionHash, fullName,fileName, lineNumber, fileHash ) \
+ HX_DEFINE_STACK_FRAME(__stackPosition, className, functionName, classFunctionHash, fullName,fileName, lineNumber, fileHash ) \
+ ::hx::StackFrame _hx_stackframe(&__stackPosition);
+
+ // Newer code will use the HX_STACKFRAME macro
+ #define HX_STACKFRAME(pos) ::hx::StackFrame _hx_stackframe(pos);
+ #define HX_GC_STACKFRAME(pos) ::hx::StackFrame _hx_stackframe(pos);
+
+ // Must record the stack state at the catch
+ #define HX_STACK_BEGIN_CATCH __hxcpp_stack_begin_catch();
+ #define HX_JUST_GC_STACKFRAME ::hx::JustGcStackFrame _hx_stackframe;
+ #define HX_CTX _hx_stackframe.ctx
+#else
+ // No need to track frame
+ #define HX_DECLARE_STACK_FRAME(name)
+ #define HX_STACK_BEGIN_CATCH
+ #define HX_DEFINE_STACK_FRAME(__stackPosition, className, functionName, classFunctionHash, fullName,fileName, lineNumber, fileHash )
+ #define HX_LOCAL_STACK_FRAME(a,b,c,d,e,f,g,h)
+ #define HX_STACK_FRAME(className, functionName, classFunctionHash, fullName,fileName, lineNumber, fileHash )
+ #define HX_STACKFRAME(pos)
+ #define HX_JUST_GC_STACKFRAME ::hx::StackContext *_hx_ctx = HX_CTX_GET;
+ #define HX_GC_STACKFRAME(pos) HX_JUST_GC_STACKFRAME
+ #define HX_CTX _hx_ctx
+#endif
+
+#define HX_GC_CTX HX_CTX
+
+
+// Setup debugger catchable and variable macros...
+#ifdef HXCPP_DEBUGGER
+
+ // Emitted at the beginning of every instance fuction. ptr is "this".
+ // Only if stack variables are to be tracked
+ #define HX_STACK_THIS(ptr) ::hx::StackThis __stackthis(_hx_stackframe.variables, ptr);
+
+ // Emitted at the beginning of every function that takes arguments.
+ // name is the name of the argument.
+ // For the lifetime of this object, the argument will be in the [arguments]
+ // list of the stack frame in which the arg was declared
+ // Only if stack variables are to be tracked
+ #define HX_STACK_ARG(cpp_var, haxe_name) \
+ ::hx::StackVariable __stackargument_##cpp_var(_hx_stackframe.variables, true, haxe_name, &cpp_var);
+
+ // Emitted whenever a Haxe value is pushed on the stack. cpp_var is the local
+ // cpp variable, haxe_name is the name that was used in haxe for it
+ // Only if stack variables are to be tracked
+ #define HX_STACK_VAR(cpp_var, haxe_name) \
+ ::hx::StackVariable __stackvariable_##cpp_var(_hx_stackframe.variables, false, haxe_name, &cpp_var);
+
+ #define HX_STACK_CATCHABLE(T, n) \
+ hx::StackCatchable __stackcatchable_##n \
+ (_hx_stackframe, reinterpret_cast<T *>(&_hx_stackframe));
+
+ // If HXCPP_DEBUGGER is enabled, then a throw is checked to see if it
+ // can be caught and if not, the debugger is entered. Otherwise, the
+ // throw proceeds as normal.
+ #define HX_STACK_DO_THROW(e) __hxcpp_dbg_checkedThrow(e)
+ #define HX_STACK_DO_RETHROW(e) __hxcpp_dbg_checkedRethrow(e)
+
+
+ #define HX_VAR(type,name) type name; HX_STACK_VAR(name, #name)
+ #define HX_VARI(type,name) type name; HX_STACK_VAR(name, #name) name
+ #define HX_VAR_NAME(type,name,dbgName) type name; HX_STACK_VAR(name, dbgName)
+ #define HX_VARI_NAME(type,name,dbgName) type name; HX_STACK_VAR(name, dbgName) name
+
+#else // Non-debugger versions. Just stub-out.
+
+ #define HX_STACK_THIS(ptr)
+ #define HX_STACK_ARG(cpp_var, haxe_name)
+ #define HX_STACK_VAR(cpp_var, haxe_name)
+ #define HX_STACK_CATCHABLE(T, n)
+
+ #define HX_VAR(type,name) type name
+ #define HX_VARI(type,name) type name
+ #define HX_VAR_NAME(type,name,dbgName) type name
+ #define HX_VARI_NAME(type,name,dbgName) type name
+
+ // Just throw - move to hx::Throw function?
+ #define HX_STACK_DO_THROW(e) ::hx::Throw(e)
+ #define HX_STACK_DO_RETHROW(e) ::hx::Rethrow(e)
+#endif // HXCPP_STACK_VARS
+
+
+
+
+// Emitted after every Haxe line. number is the original Haxe line number.
+// Only if stack lines are to be tracked
+#ifdef HXCPP_STACK_LINE
+ // If the debugger is enabled, must check for a breakpoint at every line.
+ #ifdef HXCPP_DEBUGGER
+ #define HX_STACK_LINE(number) \
+ _hx_stackframe.lineNumber = number; \
+ /* This is incorrect - a read memory barrier is needed here. */ \
+ /* For now, just live with the exceedingly rare cases where */ \
+ /* breakpoints are missed */ \
+ if (::hx::gShouldCallHandleBreakpoints) { \
+ __hxcpp_on_line_changed(_hx_stackframe.ctx); \
+ }
+ #define HX_STACK_LINE_QUICK(number) _hx_stackframe.lineNumber = number;
+ #else
+ // Just set it
+ #define HX_STACK_LINE(number) _hx_stackframe.lineNumber = number;
+ #define HX_STACK_LINE_QUICK(number) _hx_stackframe.lineNumber = number;
+ #endif
+#else
+ #define HX_STACK_LINE(number)
+ #define HX_STACK_LINE_QUICK(number)
+#endif
+
+
+// For tidier generated code
+#define HXLINE(number) HX_STACK_LINE(number)
+#define HXDLIN(number)
+
+
+// To support older versions of the haxe compiler that emit HX_STACK_PUSH
+// instead of HX_STACK_FRAME. If the old haxe compiler is used with this
+// new debugger implementation, className.functionName breakpoints will
+// not work, and stack reporting will be a little weird. If you want to
+// use debugging, you really should upgrade to a newer haxe compiler.
+
+#undef HX_STACK_PUSH
+#define HX_STACK_PUSH(fullName, fileName, lineNumber) \
+ HX_STACK_FRAME("", fullName, 0, fullName, fileName, lineNumber, 0)
+
+#if defined(HXCPP_STACK_TRACE) || defined(HXCPP_TELEMETRY)
+ #define HXCPP_STACK_IDS
+#endif
+
+
+namespace hx
+{
+
+
+class StackFrame;
+struct StackContext;
+
+class Profiler;
+void profDestroy(Profiler *);
+void profAttach(Profiler *, StackContext *);
+void profDetach(Profiler *, StackContext *);
+void profSample(Profiler *, StackContext *inContext);
+
+
+class Telemetry;
+Telemetry *tlmCreate(StackContext *);
+void tlmDestroy(Telemetry *);
+void tlmAttach(Telemetry *, StackContext *);
+void tlmDetach(Telemetry *);
+void tlmSampleEnter(Telemetry *, StackFrame *inFrame);
+void tlmSampleExit(Telemetry *);
+
+
+class DebuggerContext;
+DebuggerContext *dbgCtxCreate(StackContext *);
+void dbgCtxDestroy(DebuggerContext *);
+void dbgCtxAttach(DebuggerContext *, StackContext *);
+void dbgCtxDetach(DebuggerContext *);
+void dbgCtxEnable(DebuggerContext *, bool inEnable);
+
+
+struct scriptCallable;
+class StackVariable;
+class StackCatchable;
+
+template<typename T> struct Hash;
+struct TWeakStringSet;
+typedef Hash<TWeakStringSet> WeakStringSet;
+
+extern const char* EXTERN_CLASS_NAME;
+
+
+#ifdef HXCPP_DEBUGGER
+extern volatile bool gShouldCallHandleBreakpoints;
+
+
+// These must match the values present in cpp.vm.Debugger
+enum DebugStatus
+{
+ DBG_STATUS_INVALID = 0, // Not present or needed in cpp.vm.Debugger
+ DBG_STATUS_RUNNING = 1,
+ DBG_STATUS_STOPPED_BREAK_IMMEDIATE = 2,
+ DBG_STATUS_STOPPED_BREAKPOINT = 3,
+ DBG_STATUS_STOPPED_UNCAUGHT_EXCEPTION = 4,
+ DBG_STATUS_STOPPED_CRITICAL_ERROR = 5
+};
+
+enum ExecutionTrace
+{
+ exeTraceOff = 0,
+ exeTraceFuncs = 1,
+ exeTraceLines = 2,
+};
+
+extern ExecutionTrace sExecutionTrace;
+
+#endif
+
+
+
+
+
+class StackPosition
+{
+public:
+ // These are constant during the lifetime of the stack frame
+ const char *className;
+ const char *functionName;
+ const char *fullName; // this is className.functionName - used for profiler
+ const char *fileName;
+ int firstLineNumber;
+
+ #if defined(HXCPP_STACK_SCRIPTABLE)
+ // Information about the current cppia function
+ struct ScriptCallable *scriptCallable;
+ #endif
+
+ // These are only used if HXCPP_DEBUGGER is defined
+ #ifdef HXCPP_DEBUGGER
+ int fileHash;
+ int classFuncHash;
+ #else
+ enum { fileHash = 0, classFuncHash=0 };
+ #endif
+
+ inline StackPosition() { }
+
+ // The constructor automatically adds the StackFrame to the list of
+ // stack frames for the current thread
+ inline StackPosition(const char *inClassName, const char *inFunctionName,
+ const char *inFullName, const char *inFileName
+ #ifdef HXCPP_STACK_LINE
+ , int inLineNumber
+ #endif
+ #ifdef HXCPP_DEBUGGER
+ ,int inClassFunctionHash, int inFileHash
+ #endif
+ )
+
+ : className(inClassName), functionName(inFunctionName)
+ ,fullName(inFullName), fileName(inFileName)
+ #ifdef HXCPP_DEBUGGER
+ ,classFuncHash(inClassFunctionHash)
+ ,fileHash(inFileHash)
+ #endif
+ #ifdef HXCPP_STACK_LINE
+ ,firstLineNumber(inLineNumber)
+ #endif
+ {
+ #if defined(HXCPP_STACK_SCRIPTABLE)
+ // Information about the current cppia function
+ scriptCallable = 0;
+ #endif
+ }
+
+};
+
+
+
+
+
+
+#ifdef HXCPP_STACK_TRACE
+struct ExceptionStackFrame
+{
+ #ifdef HXCPP_STACK_LINE
+ int line;
+ #endif
+
+ const hx::StackPosition *position;
+
+ ExceptionStackFrame(const StackFrame &inFrame);
+ ::String format(bool inForDisplay);
+ ::String toDisplay();
+ ::String toString();
+};
+#endif
+
+
+#ifdef HXCPP_SCRIPTABLE
+enum
+{
+ bcrBreak = 0x01,
+ bcrContinue = 0x02,
+ bcrReturn = 0x04,
+
+ bcrLoop = (bcrBreak | bcrContinue),
+};
+
+
+
+#endif
+
+
+struct MarkChunk
+{
+ enum { SIZE = 62 };
+ enum { OBJ_ARRAY_JOB = -1 };
+
+ inline MarkChunk() : count(0), next(0) { }
+
+ int count;
+
+ union
+ {
+ hx::Object *stack[SIZE];
+ struct
+ {
+ hx::Object **arrayBase;
+ int arrayElements;
+ };
+ };
+ MarkChunk *next;
+
+ inline void push(Object *inObj)
+ {
+ stack[count++] = inObj;
+ }
+ inline hx::Object *pop()
+ {
+ if (count)
+ return stack[--count];
+ return 0;
+ }
+ MarkChunk *swapForNew();
+};
+
+
+
+struct StackContext : public hx::ImmixAllocator
+{
+ #ifdef HXCPP_STACK_IDS
+ int mThreadId;
+ #endif
+
+ #ifdef HXCPP_STACK_TRACE
+ hx::QuickVec<StackFrame *> mStackFrames;
+ hx::QuickVec<hx::ExceptionStackFrame> mExceptionStack;
+ // Updated only when a thrown exception unwinds the stack
+ bool mIsUnwindingException;
+
+ #ifdef HXCPP_STACK_SCRIPTABLE
+ // TODO - combine CppaCtx and StackContext
+ #endif
+
+ #ifdef HXCPP_DEBUGGER
+ DebuggerContext *mDebugger;
+ #endif
+
+ #ifdef HXCPP_PROFILER
+ // Profiling support
+ Profiler *mProfiler;
+ #endif
+
+ #endif
+
+ #ifdef HXCPP_TELEMETRY
+ // Telemetry support
+ Telemetry *mTelemetry;
+ #endif
+
+ #ifdef HXCPP_COMBINE_STRINGS
+ WeakStringSet *stringSet;
+ #endif
+
+ #ifdef HXCPP_GC_GENERATIONAL
+ MarkChunk *mOldReferrers;
+ inline void pushReferrer(hx::Object *inObj)
+ {
+ // If collector is running on non-generational mode, mOldReferrers will be null
+ if (mOldReferrers)
+ {
+ mOldReferrers->push(inObj);
+ if (mOldReferrers->count==MarkChunk::SIZE)
+ mOldReferrers = mOldReferrers->swapForNew();
+ }
+ }
+ #endif
+
+ #ifdef HXCPP_CATCH_SEGV
+ #ifdef _MSC_VER
+ _se_translator_function mOldSignalFunc;
+ #else
+ void (*mOldSignalFunc)(int);
+ #endif
+ #endif
+
+ StackContext();
+ ~StackContext();
+ void onThreadAttach();
+ void onThreadDetach();
+
+
+ #ifdef HXCPP_STACK_TRACE // {
+ void tracePosition();
+
+ // Note that the stack frames are manipulated without holding any locks.
+ // This is because the manipulation of stack frames can only be done by
+ // the thread that "owns" that stack frame. The only other contention on
+ // the call stack is from calls to GetThreadInfo() and GetThreadInfos(),
+ // and these should only be called when the thread for which the call
+ // stack is being acquired is stopped in a breakpoint anyway, thus there
+ // can be no contention on the contents of the CallStack in that case
+ // either.
+
+ inline void pushFrame(StackFrame *inFrame)
+ {
+ #ifdef HXCPP_PROFILER
+ if (mProfiler)
+ profSample(mProfiler,this);
+ #endif
+
+ #ifdef HXCPP_TELEMETRY
+ if (mTelemetry)
+ tlmSampleEnter(mTelemetry,inFrame);
+ #endif
+
+ mIsUnwindingException = false;
+ mStackFrames.push(inFrame);
+
+ #ifdef HXCPP_DEBUGGER
+ if (sExecutionTrace!=exeTraceOff)
+ tracePosition();
+ #endif
+ }
+
+ inline void popFrame(StackFrame *inFrame)
+ {
+ #ifdef HXCPP_TELEMETRY
+ if (mTelemetry)
+ tlmSampleExit(mTelemetry);
+ #endif
+
+ if (mIsUnwindingException)
+ {
+ // Use default operator=
+ mExceptionStack.push( *inFrame );
+ }
+
+ mStackFrames.pop_back();
+ }
+
+ void getCurrentCallStackAsStrings(Array<String> result, bool skipLast);
+ void getCurrentExceptionStackAsStrings(Array<String> result);
+ StackFrame *getCurrentStackFrame() { return mStackFrames.back(); }
+ StackFrame *getStackFrame(int inIndex) { return mStackFrames[inIndex]; }
+ int getDepth() const { return mStackFrames.size(); }
+ inline const char *getFullNameAtDepth(int depth) const;
+ void dumpExceptionStack();
+
+ // Called when a throw occurs
+ void setLastException();
+ void pushLastException();
+ // Called when a catch block begins to be executed. hxcpp wants to track
+ // the stack back through the catches so that it can be dumped if
+ // uncaught. If inAll is true, the entire stack is captured immediately.
+ // If inAll is false, only the last stack frame is captured.
+ void beginCatch(bool inAll);
+
+ #endif // } HXCPP_STACK_TRACE
+
+ #ifdef HXCPP_DEBUGGER
+ void enableCurrentThreadDebugging(bool inEnable)
+ {
+ dbgCtxEnable(mDebugger,inEnable);
+ }
+ #endif
+
+ static inline StackContext *getCurrent()
+ {
+ return HX_CTX_GET;
+ }
+
+ #ifdef HXCPP_STACK_IDS
+ static void getAllStackIds( QuickVec<int> &outIds );
+ static StackContext *getStackForId(int id);
+ #endif
+
+
+ #ifdef HXCPP_SCRIPTABLE
+ unsigned char *stack;
+ unsigned char *pointer;
+ unsigned char *frame;
+ class Object *exception;
+
+ unsigned int breakContReturn;
+ int byteMarkId;
+
+ template<typename T>
+ void push(T inValue)
+ {
+ *(T *)pointer = inValue;
+ pointer += sizeof(T);
+ }
+ unsigned char *stackAlloc(int inSize)
+ {
+ unsigned char *p = pointer;
+ pointer += inSize;
+ return p;
+ }
+ void stackFree(int inSize)
+ {
+ pointer -= inSize;
+ }
+
+ int getFrameSize() const { return pointer-frame; }
+
+ int runInt(void *vtable);
+ Float runFloat(void *vtable);
+ String runString(void *vtable);
+ void runVoid(void *vtable);
+ Dynamic runObject(void *vtable);
+ hx::Object *runObjectPtr(void *vtable);
+
+ void push(bool &inValue) { *(int *)pointer = inValue; pointer += sizeof(int); }
+ inline void pushBool(bool b) { *(int *)pointer = b; pointer += sizeof(int); }
+ inline void pushInt(int i) { *(int *)pointer = i; pointer += sizeof(int); }
+
+ inline void pushFloat(Float f);
+ inline void pushString(const String &s);
+ inline void pushObject(Dynamic d);
+ inline void returnFloat(Float f);
+ inline void returnString(const String &s);
+ inline void returnObject(Dynamic d);
+ inline hx::Object *getThis(bool inCheckPtr=true);
+
+ inline void returnBool(bool b) { *(int *)frame = b; }
+ inline void returnInt(int i) { *(int *)frame = i; }
+ inline bool getBool(int inPos=0) { return *(bool *)(frame+inPos); }
+ inline int getInt(int inPos=0) { return *(int *)(frame+inPos); }
+
+ inline Float getFloat(int inPos=0);
+ inline String getString(int inPos=0);
+ inline Dynamic getObject(int inPos=0);
+ inline hx::Object *getObjectPtr(int inPos=0) { return *(hx::Object **)(frame+inPos); }
+
+
+ void breakFlag() { breakContReturn |= bcrBreak; }
+ void continueFlag() { breakContReturn |= bcrContinue; }
+ void returnFlag() { breakContReturn |= bcrReturn; }
+
+ #endif
+
+};
+
+
+typedef StackContext CppiaCtx;
+
+
+
+class StackFrame
+{
+public:
+ StackContext *ctx;
+
+ #ifdef HXCPP_STACK_TRACE // {
+ const StackPosition *position;
+
+ #ifdef HXCPP_STACK_LINE
+ // Current line number, changes during the lifetime of the stack frame.
+ // Only updated if HXCPP_STACK_LINE is defined.
+ int lineNumber;
+
+ #ifdef HXCPP_DEBUGGER
+ // Function arguments and local variables in reverse order of their
+ // declaration. If a variable name is in here twice, the first version is
+ // the most recently scoped one and should be used. Only updated if
+ // HXCPP_DEBUGGER is defined.
+ StackVariable *variables;
+
+ // The list of types that can be currently caught in the stack frame.
+ StackCatchable *catchables;
+ #endif
+ #endif
+
+ // The constructor automatically adds the StackFrame to the list of
+ // stack frames for the current thread
+ inline StackFrame(const StackPosition *inPosition
+ ) : position(inPosition)
+ {
+ #ifdef HXCPP_STACK_LINE
+ lineNumber = inPosition->firstLineNumber;
+ #ifdef HXCPP_DEBUGGER
+ variables = 0;
+ catchables = 0;
+ #endif
+ #endif
+
+
+ ctx = HX_CTX_GET;
+ ctx->pushFrame(this);
+ }
+
+
+ // The destructor automatically removes the StackFrame from the list of
+ // stack frames for the current thread
+ ~StackFrame()
+ {
+ ctx->popFrame(this);
+ }
+
+ ::String toString();
+ ::String toDisplay();
+ #else // } !HXCPP_STACK_TRACE {
+
+ // Release version only has ctx
+ inline StackFrame()
+ {
+ ctx = HX_CTX_GET;
+ }
+
+ #endif // }
+
+};
+
+#ifdef HXCPP_STACK_TRACE
+const char *StackContext::getFullNameAtDepth(int depth) const
+{
+ return mStackFrames[depth]->position->fullName;
+}
+#endif
+
+class JustGcStackFrame
+{
+public:
+ StackContext *ctx;
+ inline JustGcStackFrame() : ctx(HX_CTX_GET) { }
+};
+
+
+
+
+} // end namespace hx
+
+
+
+// Some functions used by AdvancedDebug.cpp
+// Returns the thread number of the calling thread
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+int __hxcpp_GetCurrentThreadNumber();
+
+// Called by the main function when an uncaught exception occurs to dump
+// the stack leading to the exception
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+void __hx_dump_stack();
+
+// The macro HX_STACK_BEGIN_CATCH, which is emitted at the beginning of every
+// catch block, calls this in debug mode to let the debugging system know that
+// a catch block has been entered
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+void __hxcpp_stack_begin_catch();
+
+// Last chance to throw an exception for null-pointer access
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+void __hxcpp_set_critical_error_handler(Dynamic inHandler);
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+void __hxcpp_execution_trace(int inLevel);
+
+// Used by debug breakpoints and execution trace
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+void __hxcpp_set_stack_frame_line(int);
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+void __hxcpp_on_line_changed(hx::StackContext *);
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+void __hxcpp_set_debugger_info(const char **inAllClasses, const char **inFullPaths);
+
+
+void __hxcpp_dbg_getScriptableVariables(hx::StackFrame *stackFrame, ::Array< ::Dynamic> outNames);
+bool __hxcpp_dbg_getScriptableValue(hx::StackFrame *stackFrame, String inName, ::Dynamic &outValue);
+bool __hxcpp_dbg_setScriptableValue(hx::StackFrame *StackFrame, String inName, ::Dynamic inValue);
+
+
+
+
+#endif // HX_STACK_CTX_H
diff --git a/Sources/c_snikket/iinclude/hx/StdLibs.h b/Sources/c_snikket/iinclude/hx/StdLibs.h
new file mode 100644
index 0000000..8bb7190
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/StdLibs.h
@@ -0,0 +1,925 @@
+#ifndef HX_STDLIBS_H
+#define HX_STDLIBS_H
+
+// --- Resource -------------------------------------------------------------
+
+namespace hx
+{
+struct Resource
+{
+ String mName;
+ int mDataLength;
+ unsigned char *mData;
+
+ bool operator<(const Resource &inRHS) const { return mName < inRHS.mName; }
+};
+
+Resource *GetResources();
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES
+void RegisterResources(hx::Resource *inResources);
+
+
+struct AnyCast
+{
+ template<typename T>
+ explicit AnyCast(T* inPtr) : mPtr((void *)inPtr) { }
+
+ template<typename T>
+ operator T*() const { return (T*)mPtr; }
+
+ void *mPtr;
+};
+
+} // end namespace hx
+
+Array<String> __hxcpp_resource_names();
+String __hxcpp_resource_string(String inName);
+Array<unsigned char> __hxcpp_resource_bytes(String inName);
+
+
+
+
+// System access
+Array<String> __get_args();
+double __time_stamp();
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __hxcpp_print_string(const String &inV);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __hxcpp_println_string(const String &inV);
+
+template<typename T> inline void __hxcpp_println(T inV)
+{
+ Dynamic d(inV);
+ __hxcpp_println_string(d);
+}
+// Specialization that does not need dynamic boxing
+template<> inline void __hxcpp_println(String inV)
+{
+ __hxcpp_println_string(inV);
+}
+
+template<typename T> inline void __hxcpp_print(T inV)
+{
+ Dynamic d(inV);
+ __hxcpp_print_string(d);
+}
+// Specialization that does not need dynamic boxing
+template<> inline void __hxcpp_print(String inV)
+{
+ __hxcpp_print_string(inV);
+}
+
+
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __trace(Dynamic inPtr, Dynamic inData);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __hxcpp_exit(int inExitCode);
+void __hxcpp_stdlibs_boot();
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES int hxcpp_alloc_kind();
+
+// --- Maths ---------------------------------------------------------
+double __hxcpp_drand();
+HXCPP_EXTERN_CLASS_ATTRIBUTES int __hxcpp_irand(int inMax);
+
+// --- Casting/Converting ---------------------------------------------------------
+HXCPP_EXTERN_CLASS_ATTRIBUTES bool __instanceof(const Dynamic &inValue, const Dynamic &inType);
+HXCPP_EXTERN_CLASS_ATTRIBUTES int __int__(double x);
+HXCPP_EXTERN_CLASS_ATTRIBUTES bool __hxcpp_same_closure(Dynamic &inF1,Dynamic &inF2);
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic __hxcpp_parse_int(const String &inString);
+HXCPP_EXTERN_CLASS_ATTRIBUTES double __hxcpp_parse_float(const String &inString);
+HXCPP_EXTERN_CLASS_ATTRIBUTES double __hxcpp_parse_substr_float(const String &inString, int start, int len);
+HXCPP_EXTERN_CLASS_ATTRIBUTES int __hxcpp_parse_substr_int(const String &inString, int start=0, int len=-1);
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic __hxcpp_create_var_args(Dynamic &inArrayFunc);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __hxcpp_set_float_format(String inFormat);
+
+inline int _hx_idiv(int inNum,int inDenom) { return inNum/inDenom; }
+inline int _hx_imod(int inNum,int inDenom) { return inNum%inDenom; }
+inline int _hx_cast_int(int inX) { return inX; }
+inline int _hx_fast_floor(double inX) {
+ union Cast
+ {
+ double d;
+ long l;
+ };
+ Cast c;
+ c.d = (inX-0.5) + 6755399441055744.0;
+ return c.l;
+}
+
+
+
+// --- CFFI helpers ------------------------------------------------------------------
+
+// Used for accessing object fields by integer ID, rather than string ID.
+// Used mainly for neko ndll interaction.
+HXCPP_EXTERN_CLASS_ATTRIBUTES int __hxcpp_field_to_id( const char *inField );
+HXCPP_EXTERN_CLASS_ATTRIBUTES const String &__hxcpp_field_from_id( int f );
+HXCPP_EXTERN_CLASS_ATTRIBUTES int __hxcpp_register_prim(const HX_CHAR *inName,void *inFunc);
+
+// Get function pointer from dll file
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic __loadprim(String inLib, String inPrim,int inArgCount);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void *__hxcpp_get_proc_address(String inLib, String inPrim,bool inNdll, bool inQuietFail=false);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __hxcpp_run_dll(String inLib, String inPrim);
+// Can assign to function pointer without error
+inline hx::AnyCast __hxcpp_cast_get_proc_address(String inLib, String inPrim,bool inQuietFail=false)
+{
+ return hx::AnyCast(__hxcpp_get_proc_address(inLib,inPrim,false,inQuietFail));
+}
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES int __hxcpp_unload_all_libraries();
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __hxcpp_push_dll_path(String inPath);
+HXCPP_EXTERN_CLASS_ATTRIBUTES String __hxcpp_get_dll_extension();
+HXCPP_EXTERN_CLASS_ATTRIBUTES String __hxcpp_get_bin_dir();
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES String __hxcpp_get_kind(Dynamic inObject);
+
+
+// Loading functions via name (dummy return value)
+
+
+
+// --- haxe.io.BytesData ----------------------------------------------------------------
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __hxcpp_bytes_of_string(Array<unsigned char> &outBytes,const String &inString);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __hxcpp_string_of_bytes(Array<unsigned char> &inBytes,String &outString,int pos,int len,bool inCopyPointer=false);
+// UTF8 processing
+HXCPP_EXTERN_CLASS_ATTRIBUTES String __hxcpp_char_array_to_utf8_string(Array<int> &inChars,int inFirst=0, int inLen=-1);
+HXCPP_EXTERN_CLASS_ATTRIBUTES Array<int> __hxcpp_utf8_string_to_char_array(String &inString);
+HXCPP_EXTERN_CLASS_ATTRIBUTES String __hxcpp_char_bytes_to_utf8_string(String &inBytes);
+HXCPP_EXTERN_CLASS_ATTRIBUTES String __hxcpp_utf8_string_to_char_bytes(String &inUTF8);
+
+
+#ifdef HXCPP_GC_GENERATIONAL
+ #define HX_MAP_THIS this, h
+ #define HX_MAP_THIS_ this,
+ #define HX_MAP_THIS_ARG hx::Object *owner, Dynamic &ioHash
+#else
+ #define HX_MAP_THIS h
+ #define HX_MAP_THIS_
+ #define HX_MAP_THIS_ARG Dynamic &ioHash
+#endif
+
+// --- HashRoot ---------------------------------------------------------------------
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES int __root_hash_size(Dynamic *rtHash);
+
+// --- IntHash ----------------------------------------------------------------------
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES inline hx::Object *__int_hash_create() { return 0; }
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __int_hash_set(HX_MAP_THIS_ARG,int inKey,const Dynamic &value);
+HXCPP_EXTERN_CLASS_ATTRIBUTES bool __int_hash_exists(Dynamic &hash,int inKey);
+HXCPP_EXTERN_CLASS_ATTRIBUTES bool __int_hash_remove(Dynamic &hash,int inKey);
+HXCPP_EXTERN_CLASS_ATTRIBUTES Array<int> __int_hash_keys(Dynamic &hash);
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic __int_hash_values(Dynamic &hash);
+// Typed IntHash access...
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __int_hash_set_int(HX_MAP_THIS_ARG,int inKey,int inValue);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __int_hash_set_string(HX_MAP_THIS_ARG,int inKey,::String inValue);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __int_hash_set_float(HX_MAP_THIS_ARG,int inKey,Float inValue);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __int_hash_set_int64(HX_MAP_THIS_ARG,int inKey,cpp::Int64 inValue);
+HXCPP_EXTERN_CLASS_ATTRIBUTES ::String __int_hash_to_string(Dynamic &hash);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __int_hash_clear(Dynamic &hash);
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic __int_hash_get(Dynamic inHash,int inKey);
+HXCPP_EXTERN_CLASS_ATTRIBUTES int __int_hash_get_int(Dynamic inHash,int inKey);
+HXCPP_EXTERN_CLASS_ATTRIBUTES ::String __int_hash_get_string(Dynamic inHash,int inKey);
+HXCPP_EXTERN_CLASS_ATTRIBUTES Float __int_hash_get_float(Dynamic inHash,int inKey);
+HXCPP_EXTERN_CLASS_ATTRIBUTES cpp::Int64 __int_hash_get_int64(Dynamic inHash,int inKey);
+inline bool __int_hash_get_bool(Dynamic inHash,int inKey) { return __int_hash_get_int(inHash,inKey); }
+
+// --- Int64Hash -----------------------------------------------------------------------
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES inline hx::Object *__int64_hash_create() { return 0; }
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __int64_hash_set(HX_MAP_THIS_ARG,cpp::Int64 inKey,const Dynamic &value);
+HXCPP_EXTERN_CLASS_ATTRIBUTES bool __int64_hash_exists(Dynamic &hash,cpp::Int64 inKey);
+HXCPP_EXTERN_CLASS_ATTRIBUTES bool __int64_hash_remove(Dynamic &hash,cpp::Int64 inKey);
+HXCPP_EXTERN_CLASS_ATTRIBUTES Array<cpp::Int64> __int64_hash_keys(Dynamic &hash);
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic __int64_hash_values(Dynamic &hash);
+// Typed IntHash access...
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __int64_hash_set_int(HX_MAP_THIS_ARG,cpp::Int64 inKey,int inValue);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __int64_hash_set_string(HX_MAP_THIS_ARG,cpp::Int64 inKey,::String inValue);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __int64_hash_set_float(HX_MAP_THIS_ARG,cpp::Int64 inKey,Float inValue);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __int64_hash_set_int64(HX_MAP_THIS_ARG,cpp::Int64 inKey,cpp::Int64 inValue);
+HXCPP_EXTERN_CLASS_ATTRIBUTES ::String __int64_hash_to_string(Dynamic &hash);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __int64_hash_clear(Dynamic &hash);
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic __int64_hash_get(Dynamic inHash,cpp::Int64 inKey);
+HXCPP_EXTERN_CLASS_ATTRIBUTES int __int64_hash_get_int(Dynamic inHash,cpp::Int64 inKey);
+HXCPP_EXTERN_CLASS_ATTRIBUTES ::String __int64_hash_get_string(Dynamic inHash,cpp::Int64 inKey);
+HXCPP_EXTERN_CLASS_ATTRIBUTES Float __int64_hash_get_float(Dynamic inHash,cpp::Int64 inKey);
+HXCPP_EXTERN_CLASS_ATTRIBUTES cpp::Int64 __int64_hash_get_int64(Dynamic inHash,cpp::Int64 inKey);
+inline bool __int64_hash_get_bool(Dynamic inHash,cpp::Int64 inKey) { return __int64_hash_get_int(inHash,inKey); }
+
+// --- StringHash ----------------------------------------------------------------------
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __string_hash_set(HX_MAP_THIS_ARG,String inKey,const Dynamic &value,bool inForceDynamic=false);
+HXCPP_EXTERN_CLASS_ATTRIBUTES bool __string_hash_exists(Dynamic &hash,String inKey);
+HXCPP_EXTERN_CLASS_ATTRIBUTES bool __string_hash_remove(Dynamic &hash,String inKey);
+HXCPP_EXTERN_CLASS_ATTRIBUTES Array< ::String> __string_hash_keys(Dynamic &hash);
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic __string_hash_values(Dynamic &hash);
+// Typed StringHash access...
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __string_hash_set_int(HX_MAP_THIS_ARG,String inKey,int inValue);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __string_hash_set_string(HX_MAP_THIS_ARG,String inKey,::String inValue);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __string_hash_set_float(HX_MAP_THIS_ARG,String inKey,Float inValue);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __string_hash_set_int64(HX_MAP_THIS_ARG,String inKey,cpp::Int64 inValue);
+HXCPP_EXTERN_CLASS_ATTRIBUTES ::String __string_hash_map_substr(HX_MAP_THIS_ARG,String inKey,int inStart, int inLength);
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES ::String __string_hash_to_string(Dynamic &hash);
+HXCPP_EXTERN_CLASS_ATTRIBUTES ::String __string_hash_to_string_raw(Dynamic &hash);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __string_hash_clear(Dynamic &hash);
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic __string_hash_get(Dynamic inHash,String inKey);
+HXCPP_EXTERN_CLASS_ATTRIBUTES int __string_hash_get_int(Dynamic inHash,String inKey);
+HXCPP_EXTERN_CLASS_ATTRIBUTES ::String __string_hash_get_string(Dynamic inHash,String inKey);
+HXCPP_EXTERN_CLASS_ATTRIBUTES Float __string_hash_get_float(Dynamic inHash,String inKey);
+HXCPP_EXTERN_CLASS_ATTRIBUTES cpp::Int64 __string_hash_get_int64(Dynamic inHash,String inKey);
+inline bool __string_hash_get_bool(Dynamic inHash,String inKey) { return __string_hash_get_int(inHash,inKey); }
+
+// --- ObjectHash ----------------------------------------------------------------------
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __object_hash_set(HX_MAP_THIS_ARG,Dynamic inKey,const Dynamic &value,bool inWeakKey=false);
+HXCPP_EXTERN_CLASS_ATTRIBUTES bool __object_hash_exists(Dynamic &hash,Dynamic inKey);
+HXCPP_EXTERN_CLASS_ATTRIBUTES bool __object_hash_remove(Dynamic &hash,Dynamic inKey);
+HXCPP_EXTERN_CLASS_ATTRIBUTES Array< ::Dynamic> __object_hash_keys(Dynamic &hash);
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic __object_hash_values(Dynamic &hash);
+// Typed ObjectHash access...
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __object_hash_set_int(HX_MAP_THIS_ARG,Dynamic inKey,int inValue,bool inWeakKey=false);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __object_hash_set_string(HX_MAP_THIS_ARG,Dynamic inKey,::String inValue,bool inWeakKey=false);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __object_hash_set_float(HX_MAP_THIS_ARG,Dynamic inKey,Float inValue,bool inWeakKey=false);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __object_hash_set_int64(HX_MAP_THIS_ARG,Dynamic inKey,cpp::Int64 inValue,bool inWeakKey=false);
+HXCPP_EXTERN_CLASS_ATTRIBUTES ::String __object_hash_to_string(Dynamic &hash);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __object_hash_clear(Dynamic &hash);
+
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic __object_hash_get(Dynamic inHash,Dynamic inKey);
+HXCPP_EXTERN_CLASS_ATTRIBUTES int __object_hash_get_int(Dynamic inHash,Dynamic inKey);
+HXCPP_EXTERN_CLASS_ATTRIBUTES ::String __object_hash_get_string(Dynamic inHash,Dynamic inKey);
+HXCPP_EXTERN_CLASS_ATTRIBUTES Float __object_hash_get_float(Dynamic inHash,Dynamic inKey);
+HXCPP_EXTERN_CLASS_ATTRIBUTES cpp::Int64 __object_hash_get_int64(Dynamic inHash,Dynamic inKey);
+inline bool __object_hash_get_bool(Dynamic inHash,Dynamic inKey) { return __object_hash_get_int(inHash,inKey); }
+
+// --- Date --------------------------------------------------------------------------
+
+// returns Epoch UTC timestamp (in seconds); assumes that input date parts are considered to be in local timezone date/time representation
+double __hxcpp_new_date(int inYear,int inMonth,int inDay,int inHour, int inMin, int inSeconds,int inMilliseconds = 0);
+
+double __hxcpp_utc_date(int inYear,int inMonth,int inDay,int inHour, int inMin, int inSeconds);
+int __hxcpp_get_hours(double inSeconds);
+int __hxcpp_get_minutes(double inSeconds);
+int __hxcpp_get_seconds(double inSeconds);
+int __hxcpp_get_year(double inSeconds);
+int __hxcpp_get_month(double inSeconds);
+int __hxcpp_get_date(double inSeconds);
+int __hxcpp_get_day(double inSeconds);
+String __hxcpp_to_string(double inSeconds);
+double __hxcpp_date_now();
+
+
+int __hxcpp_get_utc_hours(double inSeconds); /* returns hour part of UTC date/time representation of input time (Epoch, in seconds), 0-23 */
+int __hxcpp_get_utc_minutes(double inSeconds); /* returns minutes part of UTC date/time representation of input time (Epoch, in seconds), 0-59 */
+int __hxcpp_get_utc_seconds(double inSeconds); /* returns seconds part of UTC date/time representation of input time (Epoch, in seconds), 0-59 */
+int __hxcpp_get_utc_year(double inSeconds); /* returns year part of UTC date/time representation of input time (Epoch, in seconds) */
+int __hxcpp_get_utc_month(double inSeconds); /* returns month part of UTC date/time representation of input time (Epoch, in seconds), 0-January...11-December */
+int __hxcpp_get_utc_date(double inSeconds); /* returns day of the month part of UTC date/time representation of input time (Epoch, in seconds), 1-31 */
+int __hxcpp_get_utc_day(double inSeconds); /* returns day of the week part of UTC date/time representation of input time (Epoch, in seconds), 0-Sunday...6-Saturday */
+String __hxcpp_to_utc_string(double inSeconds); /* same as __hxcpp_to_string but in corresponding UTC format */
+
+int __hxcpp_is_dst(double inSeconds); /* is input time (Epoch UTC timestamp, in seconds)'s local time in DST ? 1 for true, 0 for false */
+double __hxcpp_timezone_offset(double inSeconds); /* input time (Epoch UTC timestamp, in seconds)'s local time zone offset from UTC, in seconds */
+double __hxcpp_from_utc(int inYear,int inMonth,int inDay,int inHour, int inMin, int inSeconds, int inMilliSeconds); /* returns Epoch timestamp (in seconds); assumes that input date parts are considered to be in UTC date/time representation */
+
+
+
+double __hxcpp_time_stamp();
+
+// --- vm/threading --------------------------------------------------------------------
+
+Dynamic __hxcpp_thread_create(Dynamic inFunc);
+Dynamic __hxcpp_thread_current();
+void __hxcpp_thread_send(Dynamic inThread, Dynamic inMessage);
+Dynamic __hxcpp_thread_read_message(bool inBlocked);
+bool __hxcpp_is_current_thread(hx::Object *inThread);
+
+Dynamic __hxcpp_mutex_create();
+void __hxcpp_mutex_acquire(Dynamic);
+bool __hxcpp_mutex_try(Dynamic);
+void __hxcpp_mutex_release(Dynamic);
+
+Dynamic __hxcpp_semaphore_create(int);
+void __hxcpp_semaphore_acquire(Dynamic);
+bool __hxcpp_semaphore_try_acquire(Dynamic, double timeout);
+void __hxcpp_semaphore_release(Dynamic);
+
+Dynamic __hxcpp_condition_create(void);
+void __hxcpp_condition_acquire(Dynamic);
+bool __hxcpp_condition_try_acquire(Dynamic);
+void __hxcpp_condition_release(Dynamic);
+void __hxcpp_condition_wait(Dynamic);
+bool __hxcpp_condition_timed_wait(Dynamic,double);
+void __hxcpp_condition_signal(Dynamic);
+void __hxcpp_condition_broadcast(Dynamic);
+
+Dynamic __hxcpp_lock_create();
+bool __hxcpp_lock_wait(Dynamic inlock,double inTime);
+void __hxcpp_lock_release(Dynamic inlock);
+
+Dynamic __hxcpp_deque_create();
+void __hxcpp_deque_add(Dynamic q,Dynamic inVal);
+void __hxcpp_deque_push(Dynamic q,Dynamic inVal);
+Dynamic __hxcpp_deque_pop(Dynamic q,bool block);
+
+Dynamic __hxcpp_tls_get(int inID);
+void __hxcpp_tls_set(int inID,Dynamic inVal);
+
+bool _hx_atomic_exchange_if(::cpp::Pointer<cpp::AtomicInt> inPtr, int test, int newVal );
+int _hx_atomic_inc(::cpp::Pointer<cpp::AtomicInt> inPtr );
+int _hx_atomic_dec(::cpp::Pointer<cpp::AtomicInt> inPtr );
+
+// Assumptions made:
+// People are not using 8 year old versions of GCC.
+
+#if defined(__GNUC__) || defined(__clang__)
+#define HX_GCC_ATOMICS
+#define HX_HAS_ATOMIC 1
+#elif defined(_MSC_VER)
+#define HX_MSVC_ATOMICS
+#define HX_HAS_ATOMIC 1
+#include <intrin.h>
+#else
+#define HX_HAS_ATOMIC 0
+#endif
+
+inline int _hx_atomic_add(volatile int *a, int b) {
+#if defined(HX_GCC_ATOMICS)
+ return __atomic_fetch_add(a, b, __ATOMIC_SEQ_CST);
+#elif defined(HX_MSVC_ATOMICS)
+ return _InterlockedExchangeAdd((long volatile *)a, b);
+#else
+ int old = *a;
+ *a += b;
+ return old;
+#endif
+}
+
+inline int _hx_atomic_sub(volatile int *a, int b) {
+#if defined(HX_GCC_ATOMICS)
+ return __atomic_fetch_sub(a, b, __ATOMIC_SEQ_CST);
+#elif defined(HX_MSVC_ATOMICS)
+ return _InterlockedExchangeAdd((long volatile *)a, -b);
+#else
+ int old = *a;
+ *a -= b;
+ return old;
+#endif
+}
+
+inline int _hx_atomic_and(volatile int *a, int b) {
+#if defined(HX_GCC_ATOMICS)
+ return __atomic_fetch_and(a, b, __ATOMIC_SEQ_CST);
+#elif defined(HX_MSVC_ATOMICS)
+ return _InterlockedAnd((long volatile *)a, b);
+#else
+ int old = *a;
+ *a &= b;
+ return old;
+#endif
+}
+
+inline int _hx_atomic_or(volatile int *a, int b) {
+#if defined(HX_GCC_ATOMICS)
+ return __atomic_fetch_or(a, b, __ATOMIC_SEQ_CST);
+#elif defined(HX_MSVC_ATOMICS)
+ return _InterlockedOr((long volatile *)a, b);
+#else
+ int old = *a;
+ *a |= b;
+ return old;
+#endif
+}
+
+inline int _hx_atomic_xor(int *a, int b) {
+#if defined(HX_GCC_ATOMICS)
+ return __atomic_fetch_xor(a, b, __ATOMIC_SEQ_CST);
+#elif defined(HX_MSVC_ATOMICS)
+ return _InterlockedXor((long volatile *)a, b);
+#else
+ int old = *a;
+ *a ^= b;
+ return old;
+#endif
+}
+
+inline int _hx_atomic_compare_exchange(volatile int *a, int expected,
+ int replacement) {
+#if defined(HX_GCC_ATOMICS)
+ int _expected = expected;
+ __atomic_compare_exchange(a, &_expected, &replacement, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
+ return _expected;
+#elif defined(HX_MSVC_ATOMICS)
+ return _InterlockedCompareExchange((long volatile *)a, replacement, expected);
+#else
+ int old = *a;
+ if(old == expected) {
+ *a = replacement;
+ }
+ return old;
+#endif
+}
+
+inline int _hx_atomic_exchange(volatile int *a, int replacement) {
+#if defined(HX_GCC_ATOMICS)
+ int ret = 0;
+ __atomic_exchange(a, &replacement, &ret, __ATOMIC_SEQ_CST);
+ return ret;
+#elif defined(HX_MSVC_ATOMICS)
+ return _InterlockedExchange((long volatile *)a, replacement);
+#else
+ int old = *a;
+ *a = replacement;
+ return old;
+#endif
+}
+
+inline int _hx_atomic_load(volatile int *a) {
+#if defined(HX_GCC_ATOMICS)
+ int ret = 0;
+ __atomic_load(a, &ret, __ATOMIC_SEQ_CST);
+ return ret;
+#elif defined(HX_MSVC_ATOMICS)
+ return _InterlockedXor((long volatile *)a, 0);
+#else
+ return *a;
+#endif
+}
+
+inline int _hx_atomic_store(volatile int *a, int value) {
+#if defined(HX_GCC_ATOMICS)
+ __atomic_store(a, &value, __ATOMIC_SEQ_CST);
+ return value;
+#elif defined(HX_MSVC_ATOMICS)
+ _InterlockedExchange((long volatile *)a, value);
+ return value;
+#else
+ *a = value;
+ return value;
+#endif
+}
+
+inline void* _hx_atomic_compare_exchange_ptr(volatile void **a, void *expected, void* replacement) {
+#if defined(HX_GCC_ATOMICS)
+ void* _expected = expected;
+ __atomic_compare_exchange(a, (volatile void **)&_expected, (volatile void**)&replacement, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
+ return _expected;
+#elif defined(HX_MSVC_ATOMICS)
+ return _InterlockedCompareExchangePointer((void *volatile *)a, replacement, expected);
+#else
+ void *old = *a;
+ *a = replacement;
+ return old;
+#endif
+}
+
+inline void* _hx_atomic_compare_exchange_cast_ptr(void *a, void *expected, void *replacement) {
+ return _hx_atomic_compare_exchange_ptr((volatile void **)a, expected, replacement);
+}
+
+Array<String> __hxcpp_get_call_stack(bool inSkipLast);
+Array<String> __hxcpp_get_exception_stack();
+#define HXCPP_HAS_CLASSLIST
+Array<String> __hxcpp_get_class_list();
+
+// --- Profile -------------------------------------------------------------------
+
+void __hxcpp_start_profiler(::String inDumpFile);
+void __hxcpp_stop_profiler();
+
+
+// --- Memory --------------------------------------------------------------------------
+
+inline void __hxcpp_align_set_float32( unsigned char *base, int addr, float v)
+{
+ #ifdef HXCPP_ALIGN_FLOAT
+ if (addr & 3)
+ {
+ const unsigned char *src = (const unsigned char *)&v;
+ unsigned char *dest = base + addr;
+ dest[0] = src[0];
+ dest[1] = src[1];
+ dest[2] = src[2];
+ dest[3] = src[3];
+ }
+ else
+ #endif
+ *(float *)(base+addr) = v;
+}
+
+
+inline float __hxcpp_align_get_float32( unsigned char *base, int addr)
+{
+ #ifdef HXCPP_ALIGN_FLOAT
+ if (addr & 3)
+ {
+ float buf;
+ unsigned char *dest = (unsigned char *)&buf;
+ const unsigned char *src = base + addr;
+ dest[0] = src[0];
+ dest[1] = src[1];
+ dest[2] = src[2];
+ dest[3] = src[3];
+ return buf;
+ }
+ #endif
+ return *(float *)(base+addr);
+}
+
+
+inline void __hxcpp_align_set_float64( unsigned char *base, int addr, double v)
+{
+ #ifdef HXCPP_ALIGN_FLOAT
+ if (addr & 3)
+ {
+ unsigned char *dest = base + addr;
+ const unsigned char *src = (const unsigned char *)&v;
+ dest[0] = src[0];
+ dest[1] = src[1];
+ dest[2] = src[2];
+ dest[3] = src[3];
+ dest[4] = src[4];
+ dest[5] = src[5];
+ dest[6] = src[6];
+ dest[7] = src[7];
+ }
+ else
+ #endif
+ *(double *)(base + addr) = v;
+}
+
+
+inline double __hxcpp_align_get_float64( unsigned char *base, int addr)
+{
+ #ifdef HXCPP_ALIGN_FLOAT
+ if (addr & 3)
+ {
+ double buf;
+ unsigned char *dest = (unsigned char *)&buf;
+ const unsigned char *src = base + addr;
+ dest[0] = src[0];
+ dest[1] = src[1];
+ dest[2] = src[2];
+ dest[3] = src[3];
+ dest[4] = src[4];
+ dest[5] = src[5];
+ dest[6] = src[6];
+ dest[7] = src[7];
+ return buf;
+ }
+ #endif
+ return *(double *)(base+addr);
+}
+
+
+
+
+// Threadsafe methods - takes buffer
+HXCPP_EXTERN_CLASS_ATTRIBUTES void __hxcpp_memory_memset(Array<unsigned char> &inBuffer ,int pos, int len, int value);
+
+inline int __hxcpp_memory_get_byte(Array<unsigned char> inBuffer ,int addr) { return inBuffer->GetBase()[addr]; }
+inline double __hxcpp_memory_get_double(Array<unsigned char> inBuffer ,int addr) {
+ return __hxcpp_align_get_float64((unsigned char *)inBuffer->GetBase(), addr);
+}
+inline float __hxcpp_memory_get_float(Array<unsigned char> inBuffer ,int addr) {
+ return __hxcpp_align_get_float32((unsigned char *)inBuffer->GetBase(), addr);
+}
+inline int __hxcpp_memory_get_i16(Array<unsigned char> inBuffer ,int addr) { return *(short *)(inBuffer->GetBase()+addr); }
+inline int __hxcpp_memory_get_i32(Array<unsigned char> inBuffer ,int addr) { return *(int *)(inBuffer->GetBase()+addr); }
+inline int __hxcpp_memory_get_ui16(Array<unsigned char> inBuffer ,int addr) { return *(unsigned short *)(inBuffer->GetBase()+addr); }
+inline int __hxcpp_memory_get_ui32(Array<unsigned char> inBuffer ,int addr) { return *(unsigned int *)(inBuffer->GetBase()+addr); }
+inline float __hxcpp_memory_get_f32(Array<unsigned char> inBuffer ,int addr) {
+ return __hxcpp_align_get_float32((unsigned char *)inBuffer->GetBase(), addr);
+}
+
+inline void __hxcpp_memory_set_byte(Array<unsigned char> inBuffer ,int addr,int v) { inBuffer->GetBase()[addr] = v; }
+inline void __hxcpp_memory_set_double(Array<unsigned char> inBuffer ,int addr,double v) {
+ return __hxcpp_align_set_float64((unsigned char *)inBuffer->GetBase(), addr,v);
+}
+inline void __hxcpp_memory_set_float(Array<unsigned char> inBuffer ,int addr,float v) {
+ return __hxcpp_align_set_float32((unsigned char *)inBuffer->GetBase(), addr,v);
+}
+inline void __hxcpp_memory_set_i16(Array<unsigned char> inBuffer ,int addr,int v) { *(short *)(inBuffer->GetBase()+addr) = v; }
+inline void __hxcpp_memory_set_i32(Array<unsigned char> inBuffer ,int addr,int v) { *(int *)(inBuffer->GetBase()+addr) = v; }
+inline void __hxcpp_memory_set_ui16(Array<unsigned char> inBuffer ,int addr,int v) { *(unsigned short *)(inBuffer->GetBase()+addr) = v; }
+inline void __hxcpp_memory_set_ui32(Array<unsigned char> inBuffer ,int addr,int v) { *(unsigned int *)(inBuffer->GetBase()+addr) = v; }
+inline void __hxcpp_memory_set_f32(Array<unsigned char> inBuffer ,int addr,float v) {
+ return __hxcpp_align_set_float32((unsigned char *)inBuffer->GetBase(), addr, v);
+}
+
+
+// Uses global pointer...
+extern unsigned char *__hxcpp_memory;
+
+inline void __hxcpp_memory_clear( ) { __hxcpp_memory = 0; }
+inline void __hxcpp_memory_select( Array<unsigned char> inBuffer )
+ { __hxcpp_memory= (unsigned char *)inBuffer->GetBase(); }
+
+inline int __hxcpp_memory_get_byte(int addr) { return __hxcpp_memory[addr]; }
+inline double __hxcpp_memory_get_double(int addr) { return __hxcpp_align_get_float64(__hxcpp_memory,addr); }
+inline float __hxcpp_memory_get_float(int addr) { return __hxcpp_align_get_float32(__hxcpp_memory,addr); }
+inline int __hxcpp_memory_get_i16(int addr) { return *(short *)(__hxcpp_memory+addr); }
+inline int __hxcpp_memory_get_i32(int addr) { return *(int *)(__hxcpp_memory+addr); }
+inline int __hxcpp_memory_get_ui16(int addr) { return *(unsigned short *)(__hxcpp_memory+addr); }
+inline int __hxcpp_memory_get_ui32(int addr) { return *(unsigned int *)(__hxcpp_memory+addr); }
+inline float __hxcpp_memory_get_f32(int addr) { return __hxcpp_align_get_float32(__hxcpp_memory,addr); }
+
+inline void __hxcpp_memory_set_byte(int addr,int v) { __hxcpp_memory[addr] = v; }
+inline void __hxcpp_memory_set_double(int addr,double v) { __hxcpp_align_set_float64(__hxcpp_memory,addr,v); }
+inline void __hxcpp_memory_set_float(int addr,float v) { __hxcpp_align_set_float32(__hxcpp_memory,addr,v); }
+inline void __hxcpp_memory_set_i16(int addr,int v) { *(short *)(__hxcpp_memory+addr) = v; }
+inline void __hxcpp_memory_set_i32(int addr,int v) { *(int *)(__hxcpp_memory+addr) = v; }
+inline void __hxcpp_memory_set_ui16(int addr,int v) { *(unsigned short *)(__hxcpp_memory+addr) = v; }
+inline void __hxcpp_memory_set_ui32(int addr,int v) { *(unsigned int *)(__hxcpp_memory+addr) = v; }
+inline void __hxcpp_memory_set_f32(int addr,float v) { __hxcpp_align_set_float32(__hxcpp_memory,addr,v); }
+
+// FPHelper conversion
+
+inline void __hxcpp_reverse_endian(int &ioData)
+{
+ ioData = (((ioData>>24) & 0xff ) )|
+ (((ioData>>16) & 0xff )<<8 )|
+ (((ioData>>8 ) & 0xff )<<16 )|
+ (((ioData ) & 0xff )<<24 );
+}
+
+
+inline float __hxcpp_reinterpret_le_int32_as_float32(int inInt)
+{
+ #ifdef HXCPP_BIG_ENDIAN
+ __hxcpp_reverse_endian(inInt);
+ #endif
+ return *(float*)(&inInt);
+}
+
+
+inline int __hxcpp_reinterpret_float32_as_le_int32(float inFloat)
+{
+ #ifdef HXCPP_BIG_ENDIAN
+ __hxcpp_reverse_endian(*(int *)&inFloat);
+ #endif
+ return *(int*)(&inFloat);
+}
+
+
+inline double __hxcpp_reinterpret_le_int32s_as_float64(int inLow, int inHigh)
+{
+ int vals[2] = {inLow, inHigh};
+ #ifdef HXCPP_BIG_ENDIAN
+ __hxcpp_reverse_endian(vals[0]);
+ __hxcpp_reverse_endian(vals[1]);
+ #endif
+ return *(double*)(vals);
+}
+
+
+inline int __hxcpp_reinterpret_float64_as_le_int32_low(double inValue)
+{
+ int *asInts = (int *)&inValue;
+ #ifdef HXCPP_BIG_ENDIAN
+ __hxcpp_reverse_endian(asInts[0]);
+ #endif
+ return asInts[0];
+}
+
+
+inline int __hxcpp_reinterpret_float64_as_le_int32_high(double inValue)
+{
+ int *asInts = (int *)&inValue;
+ #ifdef HXCPP_BIG_ENDIAN
+ __hxcpp_reverse_endian(asInts[1]);
+ #endif
+ return asInts[1];
+}
+
+#ifdef __OBJC__
+#ifdef HXCPP_OBJC
+
+inline NSData *_hx_bytes_to_nsdata( ::Array<unsigned char> inBytes)
+{
+ if (!inBytes.mPtr)
+ return nil;
+
+ return [NSData dataWithBytes: inBytes->getBase() length:inBytes->length ];
+
+}
+
+inline ::Array<unsigned char> _hx_nsdata_to_bytes(NSData *inData)
+{
+ if (inData==nil)
+ return null();
+
+ return ::Array_obj<unsigned char>::fromData( (const unsigned char *)inData.bytes, inData.length );
+}
+
+#endif
+#endif
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic _hx_regexp_new_options(String s, String options);
+
+// EReg.hx -> src/hx/libs/regexp/RegExp.cpp
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic _hx_regexp_new_options(String s, String options);
+HXCPP_EXTERN_CLASS_ATTRIBUTES bool _hx_regexp_match(Dynamic handle, String string, int pos, int len);
+HXCPP_EXTERN_CLASS_ATTRIBUTES String _hx_regexp_matched(Dynamic handle, int pos);
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic _hx_regexp_matched_pos(Dynamic handle, int match);
+HXCPP_EXTERN_CLASS_ATTRIBUTES int _hx_regexp_matched_num(Dynamic handle);
+
+
+// haxe.zip.(Un)Compress.hx -> src/hx/libs/zlib/ZLib.cpp
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic _hx_deflate_init(int level);
+HXCPP_EXTERN_CLASS_ATTRIBUTES int _hx_deflate_bound(Dynamic handle,int length);
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic _hx_deflate_buffer(Dynamic handle, Array<unsigned char> src, int srcPos, Array<unsigned char> dest, int destPos);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_deflate_end(Dynamic handle);
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic _hx_inflate_init(Dynamic windowBits);
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic _hx_inflate_buffer(Dynamic handle, Array<unsigned char> src, int srcPos, Array<unsigned char> dest, int destPos);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_inflate_end(Dynamic handle);
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_zip_set_flush_mode(Dynamic handle, String flushMode);
+
+// sys.db.Mysql.hx -> src/hx/libs/regexp/RegExp.cpp
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic _hx_mysql_connect(Dynamic params);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_mysql_select_db(Dynamic handle,String db);
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic _hx_mysql_request(Dynamic handle,String req);
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic _hx_mysql_close(Dynamic handle);
+HXCPP_EXTERN_CLASS_ATTRIBUTES String _hx_mysql_escape(Dynamic handle,String str);
+HXCPP_EXTERN_CLASS_ATTRIBUTES int _hx_mysql_result_get_length(Dynamic handle);
+HXCPP_EXTERN_CLASS_ATTRIBUTES int _hx_mysql_result_get_nfields(Dynamic handle);
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic _hx_mysql_result_next(Dynamic handle);
+HXCPP_EXTERN_CLASS_ATTRIBUTES String _hx_mysql_result_get(Dynamic handle,int i);
+HXCPP_EXTERN_CLASS_ATTRIBUTES int _hx_mysql_result_get_int(Dynamic handle,int i);
+HXCPP_EXTERN_CLASS_ATTRIBUTES Float _hx_mysql_result_get_float(Dynamic handle,int i);
+HXCPP_EXTERN_CLASS_ATTRIBUTES Array<String> _hx_mysql_result_get_fields_names(Dynamic handle);
+
+namespace cpp { template<typename T> class Function; }
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_mysql_set_conversion(
+ cpp::Function< Dynamic(Dynamic) > inCharsToBytes,
+ cpp::Function< Dynamic(Float) > inTimeToDate );
+
+// sys.db.Sqlite.hx -> src/hx/libs/sqlite/RegExp.cpp
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic _hx_sqlite_connect(String filename);
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic _hx_sqlite_request(Dynamic handle,String req);
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_sqlite_close(Dynamic handle);
+HXCPP_EXTERN_CLASS_ATTRIBUTES int _hx_sqlite_last_insert_id(Dynamic handle);
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES int _hx_sqlite_result_get_length(Dynamic handle);
+HXCPP_EXTERN_CLASS_ATTRIBUTES int _hx_sqlite_result_get_nfields(Dynamic handle);
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic _hx_sqlite_result_next(Dynamic handle);
+HXCPP_EXTERN_CLASS_ATTRIBUTES String _hx_sqlite_result_get(Dynamic handle,int i);
+HXCPP_EXTERN_CLASS_ATTRIBUTES int _hx_sqlite_result_get_int(Dynamic handle,int i);
+HXCPP_EXTERN_CLASS_ATTRIBUTES Float _hx_sqlite_result_get_float(Dynamic handle,int i);
+
+// src/hx/libs/std ..
+// File
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic _hx_std_file_open( String fname, String r );
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_file_close( Dynamic handle );
+HXCPP_EXTERN_CLASS_ATTRIBUTES int _hx_std_file_write( Dynamic handle, Array<unsigned char> s, int p, int n );
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_file_write_char( Dynamic handle, int c );
+HXCPP_EXTERN_CLASS_ATTRIBUTES int _hx_std_file_read( Dynamic handle, Array<unsigned char> buf, int p, int n );
+HXCPP_EXTERN_CLASS_ATTRIBUTES int _hx_std_file_read_char( Dynamic handle );
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_file_seek( Dynamic handle, int pos, int kind );
+HXCPP_EXTERN_CLASS_ATTRIBUTES int _hx_std_file_tell( Dynamic handle );
+HXCPP_EXTERN_CLASS_ATTRIBUTES bool _hx_std_file_eof( Dynamic handle );
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_file_flush( Dynamic handle );
+HXCPP_EXTERN_CLASS_ATTRIBUTES String _hx_std_file_contents_string( String name );
+HXCPP_EXTERN_CLASS_ATTRIBUTES Array<unsigned char> _hx_std_file_contents_bytes( String name );
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic _hx_std_file_stdin();
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic _hx_std_file_stdout();
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic _hx_std_file_stderr();
+
+// Process
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic _hx_std_process_run( String cmd, Array<String> vargs, int inShow= 1 /* SHOW_NORMAL */ );
+HXCPP_EXTERN_CLASS_ATTRIBUTES int _hx_std_process_stdout_read( Dynamic handle, Array<unsigned char> buf, int pos, int len );
+HXCPP_EXTERN_CLASS_ATTRIBUTES int _hx_std_process_stderr_read( Dynamic handle, Array<unsigned char> buf, int pos, int len );
+HXCPP_EXTERN_CLASS_ATTRIBUTES int _hx_std_process_stdin_write( Dynamic handle, Array<unsigned char> buf, int pos, int len );
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_process_stdin_close( Dynamic handle );
+#if (HXCPP_API_LEVEL > 420)
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic _hx_std_process_exit( Dynamic handle, bool block );
+#else
+HXCPP_EXTERN_CLASS_ATTRIBUTES int _hx_std_process_exit( Dynamic handle );
+#endif
+HXCPP_EXTERN_CLASS_ATTRIBUTES int _hx_std_process_pid( Dynamic handle );
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_process_kill( Dynamic handle );
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_process_close( Dynamic handle );
+
+// Random
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic _hx_std_random_new();
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_random_set_seed( Dynamic handle, int v );
+HXCPP_EXTERN_CLASS_ATTRIBUTES int _hx_std_random_int( Dynamic handle, int max );
+HXCPP_EXTERN_CLASS_ATTRIBUTES double _hx_std_random_float( Dynamic handle );
+
+// Socket
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_socket_init();
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic _hx_std_socket_new( bool udp, bool ipv6 = false );
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_socket_bind( Dynamic o, int host, int port );
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_socket_bind_ipv6( Dynamic o, Array<unsigned char> host, int port );
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_socket_close( Dynamic handle );
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_socket_send_char( Dynamic o, int c );
+HXCPP_EXTERN_CLASS_ATTRIBUTES int _hx_std_socket_send( Dynamic o, Array<unsigned char> buf, int p, int l );
+HXCPP_EXTERN_CLASS_ATTRIBUTES int _hx_std_socket_recv( Dynamic o, Array<unsigned char> buf, int p, int l );
+HXCPP_EXTERN_CLASS_ATTRIBUTES int _hx_std_socket_recv_char( Dynamic o );
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_socket_write( Dynamic o, Array<unsigned char> buf );
+HXCPP_EXTERN_CLASS_ATTRIBUTES Array<unsigned char> _hx_std_socket_read( Dynamic o );
+HXCPP_EXTERN_CLASS_ATTRIBUTES int _hx_std_host_resolve( String host );
+HXCPP_EXTERN_CLASS_ATTRIBUTES Array<unsigned char> _hx_std_host_resolve_ipv6( String host, bool dummy=true );
+HXCPP_EXTERN_CLASS_ATTRIBUTES String _hx_std_host_to_string( int ip );
+HXCPP_EXTERN_CLASS_ATTRIBUTES String _hx_std_host_to_string_ipv6( Array<unsigned char> ip );
+HXCPP_EXTERN_CLASS_ATTRIBUTES String _hx_std_host_reverse( int host );
+HXCPP_EXTERN_CLASS_ATTRIBUTES String _hx_std_host_reverse_ipv6( Array<unsigned char> host );
+HXCPP_EXTERN_CLASS_ATTRIBUTES String _hx_std_host_local();
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_socket_connect( Dynamic o, int host, int port );
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_socket_connect_ipv6( Dynamic o, Array<unsigned char> host, int port );
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_socket_listen( Dynamic o, int n );
+HXCPP_EXTERN_CLASS_ATTRIBUTES Array<Dynamic> _hx_std_socket_select( Array<Dynamic> rs, Array<Dynamic> ws, Array<Dynamic> es, Dynamic timeout );
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_socket_fast_select( Array<Dynamic> rs, Array<Dynamic> ws, Array<Dynamic> es, Dynamic timeout );
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic _hx_std_socket_accept( Dynamic o );
+HXCPP_EXTERN_CLASS_ATTRIBUTES Array<int> _hx_std_socket_peer( Dynamic o );
+HXCPP_EXTERN_CLASS_ATTRIBUTES Array<int> _hx_std_socket_host( Dynamic o );
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_socket_set_timeout( Dynamic o, Dynamic t );
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_socket_shutdown( Dynamic o, bool r, bool w );
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_socket_set_blocking( Dynamic o, bool b );
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_socket_set_fast_send( Dynamic o, bool b );
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_socket_set_broadcast( Dynamic o, bool b );
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic _hx_std_socket_poll_alloc( int nsocks );
+HXCPP_EXTERN_CLASS_ATTRIBUTES Array<Dynamic> _hx_std_socket_poll_prepare( Dynamic pdata, Array<Dynamic> rsocks, Array<Dynamic> wsocks );
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_socket_poll_events( Dynamic pdata, double timeout );
+HXCPP_EXTERN_CLASS_ATTRIBUTES Array<Dynamic> _hx_std_socket_poll( Array<Dynamic> socks, Dynamic pdata, double timeout );
+HXCPP_EXTERN_CLASS_ATTRIBUTES int _hx_std_socket_send_to( Dynamic o, Array<unsigned char> buf, int p, int l, Dynamic inAddr );
+HXCPP_EXTERN_CLASS_ATTRIBUTES int _hx_std_socket_recv_from( Dynamic o, Array<unsigned char> buf, int p, int l, Dynamic outAddr);
+
+// Sys
+HXCPP_EXTERN_CLASS_ATTRIBUTES String _hx_std_get_env( String v );
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_put_env( String e, String v );
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_sys_sleep( double f );
+HXCPP_EXTERN_CLASS_ATTRIBUTES bool _hx_std_set_time_locale( String l );
+HXCPP_EXTERN_CLASS_ATTRIBUTES String _hx_std_get_cwd();
+HXCPP_EXTERN_CLASS_ATTRIBUTES bool _hx_std_set_cwd( String d );
+HXCPP_EXTERN_CLASS_ATTRIBUTES String _hx_std_sys_string();
+HXCPP_EXTERN_CLASS_ATTRIBUTES bool _hx_std_sys_is64();
+HXCPP_EXTERN_CLASS_ATTRIBUTES int _hx_std_sys_command( String cmd );
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_sys_exit( int code );
+HXCPP_EXTERN_CLASS_ATTRIBUTES bool _hx_std_sys_exists( String path );
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_file_delete( String path );
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_sys_rename( String path, String newname );
+HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic _hx_std_sys_stat( String path );
+HXCPP_EXTERN_CLASS_ATTRIBUTES String _hx_std_sys_file_type( String path );
+HXCPP_EXTERN_CLASS_ATTRIBUTES bool _hx_std_sys_create_dir( String path, int mode );
+HXCPP_EXTERN_CLASS_ATTRIBUTES void _hx_std_sys_remove_dir( String path );
+HXCPP_EXTERN_CLASS_ATTRIBUTES double _hx_std_sys_time();
+HXCPP_EXTERN_CLASS_ATTRIBUTES double _hx_std_sys_cpu_time();
+HXCPP_EXTERN_CLASS_ATTRIBUTES Array<String> _hx_std_sys_read_dir( String p);
+HXCPP_EXTERN_CLASS_ATTRIBUTES String _hx_std_file_full_path( String path );
+HXCPP_EXTERN_CLASS_ATTRIBUTES String _hx_std_sys_exe_path();
+HXCPP_EXTERN_CLASS_ATTRIBUTES Array<String> _hx_std_sys_env();
+HXCPP_EXTERN_CLASS_ATTRIBUTES int _hx_std_sys_getch( bool b );
+HXCPP_EXTERN_CLASS_ATTRIBUTES int _hx_std_sys_get_pid();
+
+
+// SSL
+void _hx_ssl_init();
+Dynamic _hx_ssl_new( Dynamic hconf );
+void _hx_ssl_close( Dynamic hssl );
+void _hx_ssl_debug_set (int i);
+void _hx_ssl_handshake( Dynamic handle );
+void _hx_ssl_set_socket( Dynamic hssl, Dynamic hsocket );
+void _hx_ssl_set_hostname( Dynamic hssl, String hostname );
+Dynamic _hx_ssl_get_peer_certificate( Dynamic hssl );
+bool _hx_ssl_get_verify_result( Dynamic hssl );
+void _hx_ssl_send_char( Dynamic hssl, int v );
+int _hx_ssl_send( Dynamic hssl, Array<unsigned char> buf, int p, int l );
+void _hx_ssl_write( Dynamic hssl, Array<unsigned char> buf );
+int _hx_ssl_recv_char( Dynamic hssl );
+int _hx_ssl_recv( Dynamic hssl, Array<unsigned char> buf, int p, int l );
+Array<unsigned char> _hx_ssl_read( Dynamic hssl );
+Dynamic _hx_ssl_conf_new( bool server );
+void _hx_ssl_conf_close( Dynamic hconf );
+void _hx_ssl_conf_set_ca( Dynamic hconf, Dynamic hcert );
+void _hx_ssl_conf_set_verify( Dynamic hconf, int mode );
+void _hx_ssl_conf_set_cert( Dynamic hconf, Dynamic hcert, Dynamic hpkey );
+void _hx_ssl_conf_set_servername_callback( Dynamic hconf, Dynamic obj );
+Dynamic _hx_ssl_cert_load_defaults();
+Dynamic _hx_ssl_cert_load_file( String file );
+Dynamic _hx_ssl_cert_load_path( String path );
+String _hx_ssl_cert_get_subject( Dynamic hcert, String objname );
+String _hx_ssl_cert_get_issuer( Dynamic hcert, String objname );
+Array<String> _hx_ssl_cert_get_altnames( Dynamic hcert );
+Array<int> _hx_ssl_cert_get_notbefore( Dynamic hcert );
+Array<int> _hx_ssl_cert_get_notafter( Dynamic hcert );
+Dynamic _hx_ssl_cert_get_next( Dynamic hcert );
+Dynamic _hx_ssl_cert_add_pem( Dynamic hcert, String data );
+Dynamic _hx_ssl_cert_add_der( Dynamic hcert, Array<unsigned char> buf );
+Dynamic _hx_ssl_key_from_der( Array<unsigned char> buf, bool pub );
+Dynamic _hx_ssl_key_from_pem( String data, bool pub, String pass );
+Array<unsigned char> _hx_ssl_dgst_make( Array<unsigned char> buf, String alg );
+Array<unsigned char> _hx_ssl_dgst_sign( Array<unsigned char> buf, Dynamic hpkey, String alg );
+bool _hx_ssl_dgst_verify( Array<unsigned char> buf, Array<unsigned char> sign, Dynamic hpkey, String alg );
+
+
+#endif
diff --git a/Sources/c_snikket/iinclude/hx/StdString.h b/Sources/c_snikket/iinclude/hx/StdString.h
new file mode 100644
index 0000000..82c9adc
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/StdString.h
@@ -0,0 +1,30 @@
+#ifndef HX_STD_STRING_INCLUDEDED
+#define HX_STD_STRING_INCLUDEDED
+
+#include <string>
+
+namespace hx
+{
+ class StdString : public std::string
+ {
+ public:
+ StdString() : std::string() { }
+ StdString(const char *inPtr) : std::string(inPtr) { }
+ StdString(const char *inPtr, int inLen) : std::string(inPtr, inLen) { }
+ StdString(const std::string &inS) : std::string(inS) { }
+ StdString(const StdString &inS) : std::string(inS) { }
+
+ #if (HXCPP_API_LEVEL>1)
+ StdString(const Dynamic &inS) : std::string(inS.mPtr ? inS.mPtr->toString().utf8_str() : "null") { }
+ StdString(const String &inS) : std::string(inS.utf8_str()) { }
+ String toString() const { return String(c_str(),size()).dup(); }
+ String toString() { return String(c_str(),size()).dup(); }
+ operator Dynamic() const { return const_cast<StdString*>(this)->toString(); }
+ #endif
+
+ inline const StdString &toStdString() const { return *this; }
+
+ };
+}
+
+#endif
diff --git a/Sources/c_snikket/iinclude/hx/StringAlloc.h b/Sources/c_snikket/iinclude/hx/StringAlloc.h
new file mode 100755
index 0000000..29fb7f7
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/StringAlloc.h
@@ -0,0 +1,53 @@
+#ifndef HX_STRING_ALLOC
+#define HX_STRING_ALLOC
+
+#include <stdlib.h>
+#include <stdint.h>
+
+namespace hx
+{
+
+class IStringAlloc
+{
+ public:
+ virtual void *allocBytes(size_t inBytes) = 0;
+
+ protected:
+ ~IStringAlloc(){};
+};
+
+template<int STACK>
+class StringAlloc : public IStringAlloc
+{
+ char buffer[STACK];
+ size_t alloced;
+ char *heap;
+
+ public:
+ inline StringAlloc() : alloced(0), heap(0) { }
+ ~StringAlloc()
+ {
+ if (heap)
+ free(heap);
+ }
+ void *allocBytes(size_t inBytes)
+ {
+ if (inBytes<=STACK)
+ return buffer;
+ if (inBytes>alloced)
+ {
+ alloced = inBytes;
+ heap = (char *)realloc(heap, alloced);
+ }
+ return heap;
+ }
+ private:
+ StringAlloc(const StringAlloc &);
+ void operator=(const StringAlloc &);
+};
+
+typedef StringAlloc<100> strbuf;
+
+} // end namespace hx
+
+#endif
diff --git a/Sources/c_snikket/iinclude/hx/Telemetry.h b/Sources/c_snikket/iinclude/hx/Telemetry.h
new file mode 100644
index 0000000..cf86577
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/Telemetry.h
@@ -0,0 +1,35 @@
+#ifndef HX_TELEMETRY_H
+#define HX_TELEMETRY_H
+
+#define HX_TELEMETRY_VERSION 1
+
+#include <hxcpp.h>
+#include <vector>
+
+struct TelemetryFrame
+{
+ // microseconds, always valid
+ int gctime;
+ int gcoverhead;
+
+ // Valid only if profiler is enabled
+ std::vector<int> *samples;
+ std::vector<const char*> *names;
+
+ // Valid only if allocations (and profiler) are enabled
+ std::vector<int> *allocation_data;
+ std::vector<int> *stacks;
+};
+
+// --- Telemetry -----------------------------------------------------------------
+
+int __hxcpp_hxt_start_telemetry(bool profiler, bool allocations);
+void __hxcpp_hxt_stash_telemetry();
+TelemetryFrame* __hxcpp_hxt_dump_telemetry(int thread_num);
+void __hxcpp_hxt_ignore_allocs(int delta);
+
+// expose these from GCInternal
+int __hxcpp_gc_reserved_bytes();
+int __hxcpp_gc_used_bytes();
+
+#endif
diff --git a/Sources/c_snikket/iinclude/hx/TelemetryTracy.h b/Sources/c_snikket/iinclude/hx/TelemetryTracy.h
new file mode 100644
index 0000000..178932a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/TelemetryTracy.h
@@ -0,0 +1,44 @@
+#ifndef HX_TELEMETRY_TRACY_H
+#define HX_TELEMETRY_TRACY_H
+
+#ifndef HXCPP_TRACY
+ #error "Error: HXCPP_TRACY must be defined."
+#endif
+
+#define TRACY_ENABLE
+#include <hxcpp.h>
+#include "../../project/thirdparty/tracy-0.11.1/tracy/TracyC.h"
+#include "../../project/thirdparty/tracy-0.11.1/tracy/Tracy.hpp"
+
+#ifdef HXCPP_TRACY_MEMORY
+ #ifdef HXCPP_GC_MOVING
+ #error "Error: HXCPP_TRACY_MEMORY is not supported when HXCPP_GC_MOVING is active."
+ #endif
+ #ifdef HXCPP_GC_GENERATIONAL
+ #error "Error: HXCPP_TRACY_MEMORY is not supported when HXCPP_GC_GENERATIONAL is active."
+ #endif
+#endif
+
+#ifdef HXCPP_TRACY_INCLUDE_CALLSTACKS
+#define HXCPP_TRACY_ZONE(name) \
+ ::hx::strbuf TracyConcat(_hx_tracy_str_buffer, TracyLine); \
+ int TracyConcat(_hx_tracy_str_length, TracyLine); \
+ const char *TracyConcat(_hx_tracy_str_buffer_ptr, TracyLine) = name.utf8_str(&TracyConcat(_hx_tracy_str_buffer, TracyLine), false, &TracyConcat(_hx_tracy_str_length, TracyLine)); \
+ ::tracy::ScopedZone TracyConcat(_hx_tracy_scoped_zone,TracyLine)(_hx_stackframe.lineNumber, _hx_stackframe.position->fileName, strlen(_hx_stackframe.position->fileName), _hx_stackframe.position->fullName, strlen(_hx_stackframe.position->fullName), TracyConcat(_hx_tracy_str_buffer_ptr, TracyLine), TracyConcat(_hx_tracy_str_length, TracyLine), __hxcpp_tracy_get_zone_count());
+#else
+#define HXCPP_TRACY_ZONE(name) \
+ ::hx::strbuf TracyConcat(_hx_tracy_str_buffer, TracyLine); \
+ int TracyConcat(_hx_tracy_str_length, TracyLine); \
+ const char *TracyConcat(_hx_tracy_str_buffer_ptr, TracyLine) = name.utf8_str(&TracyConcat(_hx_tracy_str_buffer, TracyLine), false, &TracyConcat(_hx_tracy_str_length, TracyLine)); \
+ ::tracy::ScopedZone TracyConcat(_hx_tracy_scoped_zone,TracyLine)(_hx_stackframe.lineNumber, _hx_stackframe.position->fileName, strlen(_hx_stackframe.position->fileName), _hx_stackframe.position->fullName, strlen(_hx_stackframe.position->fullName), TracyConcat(_hx_tracy_str_buffer_ptr, TracyLine), TracyConcat(_hx_tracy_str_length, TracyLine));
+#endif
+
+void __hxcpp_tracy_framemark();
+void __hxcpp_tracy_plot(::String name, ::Float val);
+void __hxcpp_tracy_plot_config(::String name, uint8_t format, bool step, bool fill, int color);
+void __hxcpp_tracy_message(::String msg, int color);
+void __hxcpp_tracy_message_app_info(::String info);
+void __hxcpp_tracy_set_thread_name_and_group(String name, int groupHint);
+int __hxcpp_tracy_get_zone_count();
+
+#endif
diff --git a/Sources/c_snikket/iinclude/hx/Thread.h b/Sources/c_snikket/iinclude/hx/Thread.h
new file mode 100644
index 0000000..069d51e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/Thread.h
@@ -0,0 +1,345 @@
+#ifdef HX_THREAD_H_OVERRIDE
+// Users can define their own header to use here, but there is no API
+// compatibility gaurantee for future changes.
+#include HX_THREAD_H_OVERRIDE
+#else
+
+#ifndef HX_THREAD_H
+#define HX_THREAD_H
+
+#ifndef HXCPP_HEADER_VERSION
+#include "hx/HeaderVersion.h"
+#endif
+
+#ifdef HX_WINRT
+
+#include <windows.h>
+#include <process.h>
+#include <mutex>
+
+#elif defined(_WIN32)
+
+#ifdef HXCPP_WINXP_COMPAT
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0400
+#else
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0600
+#endif
+
+#include <windows.h>
+#include <process.h>
+#else
+#include <errno.h>
+#include <pthread.h>
+#include <sys/time.h>
+#include <stdio.h>
+#define HXCPP_PTHREADS
+#endif
+
+#ifdef RegisterClass
+#undef RegisterClass
+#endif
+
+#if defined(HX_WINDOWS)
+
+
+struct HxMutex
+{
+ HxMutex()
+ {
+ mValid = true;
+ #ifdef HX_WINRT
+ InitializeCriticalSectionEx(&mCritSec,4000,0);
+ #else
+ InitializeCriticalSection(&mCritSec);
+ #endif
+ }
+ ~HxMutex() { if (mValid) DeleteCriticalSection(&mCritSec); }
+ void Lock() { EnterCriticalSection(&mCritSec); }
+ void Unlock() { LeaveCriticalSection(&mCritSec); }
+ bool TryLock() { return TryEnterCriticalSection(&mCritSec); }
+ bool IsValid() { return mValid; }
+ void Clean()
+ {
+ if (mValid)
+ {
+ DeleteCriticalSection(&mCritSec);
+ mValid = false;
+ }
+ }
+
+ bool mValid;
+ CRITICAL_SECTION mCritSec;
+};
+
+
+#define THREAD_FUNC_TYPE DWORD WINAPI
+#define THREAD_FUNC_RET return 0;
+
+inline bool HxCreateDetachedThread(DWORD (WINAPI *func)(void *), void *param)
+{
+ return (CreateThread(NULL, 0, func, param, 0, 0) != 0);
+}
+
+#else
+
+struct HxMutex
+{
+ HxMutex()
+ {
+ pthread_mutexattr_t mta;
+ pthread_mutexattr_init(&mta);
+ pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_RECURSIVE);
+ mMutex = new pthread_mutex_t();
+ mValid = pthread_mutex_init(mMutex,&mta) ==0;
+ }
+ ~HxMutex()
+ {
+ if (mValid)
+ pthread_mutex_destroy(mMutex);
+ delete mMutex;
+ }
+ void Lock() { pthread_mutex_lock(mMutex); }
+ void Unlock() { pthread_mutex_unlock(mMutex); }
+ bool TryLock() { return !pthread_mutex_trylock(mMutex); }
+ bool IsValid() { return mValid; }
+ void Clean()
+ {
+ if (mValid)
+ pthread_mutex_destroy(mMutex);
+ mValid = 0;
+ }
+
+ bool mValid;
+ pthread_mutex_t *mMutex;
+};
+
+#define THREAD_FUNC_TYPE void *
+#define THREAD_FUNC_RET return 0;
+
+inline bool HxCreateDetachedThread(void *(*func)(void *), void *param)
+{
+ pthread_t t;
+ pthread_attr_t attr;
+ if (pthread_attr_init(&attr) != 0)
+ return false;
+#ifdef PTHREAD_CREATE_DETACHED
+ if (pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) != 0)
+ return false;
+#endif
+ if (pthread_create(&t, &attr, func, param) != 0 )
+ return false;
+ if (pthread_attr_destroy(&attr) != 0)
+ return false;
+ return true;
+}
+
+#endif
+
+
+
+
+template<typename LOCKABLE>
+struct TAutoLock
+{
+ TAutoLock(LOCKABLE &inMutex) : mMutex(inMutex) { mMutex.Lock(); }
+ ~TAutoLock() { mMutex.Unlock(); }
+ void Lock() { mMutex.Lock(); }
+ void Unlock() { mMutex.Unlock(); }
+
+ LOCKABLE &mMutex;
+};
+
+typedef TAutoLock<HxMutex> AutoLock;
+
+
+#if defined(HX_WINDOWS)
+
+struct HxSemaphore
+{
+ HxSemaphore()
+ {
+ #ifdef HX_WINRT
+ mSemaphore = CreateEventEx(nullptr,nullptr,0,EVENT_ALL_ACCESS);
+ #else
+ mSemaphore = CreateEvent(0,0,0,0);
+ #endif
+ }
+ ~HxSemaphore() { if (mSemaphore) CloseHandle(mSemaphore); }
+ void Set() { SetEvent(mSemaphore); }
+ void Wait()
+ {
+ #ifdef HX_WINRT
+ WaitForSingleObjectEx(mSemaphore,INFINITE,false);
+ #else
+ WaitForSingleObject(mSemaphore,INFINITE);
+ #endif
+ }
+ // Returns true on success, false on timeout
+ bool WaitSeconds(double inSeconds)
+ {
+ #ifdef HX_WINRT
+ return WaitForSingleObjectEx(mSemaphore,inSeconds*1000.0,false) != WAIT_TIMEOUT;
+ #else
+ return WaitForSingleObject(mSemaphore,inSeconds*1000.0) != WAIT_TIMEOUT;
+ #endif
+ }
+ void Reset() { ResetEvent(mSemaphore); }
+ void Clean() { if (mSemaphore) CloseHandle(mSemaphore); mSemaphore = 0; }
+
+ HANDLE mSemaphore;
+};
+
+#else
+
+
+#define HX_THREAD_SEMAPHORE_LOCKABLE
+
+struct HxSemaphore
+{
+ HxSemaphore()
+ {
+ mSet = false;
+ mValid = true;
+ mCondition = new pthread_cond_t();
+ pthread_cond_init(mCondition,0);
+ }
+ ~HxSemaphore()
+ {
+ if (mValid)
+ {
+ pthread_cond_destroy(mCondition);
+ }
+ }
+ // For autolock
+ inline operator HxMutex &() { return mMutex; }
+ void Set()
+ {
+ AutoLock lock(mMutex);
+ if (!mSet)
+ {
+ mSet = true;
+ pthread_cond_signal( mCondition );
+ }
+ }
+ void QSet()
+ {
+ mSet = true;
+ pthread_cond_signal( mCondition );
+ }
+ void Reset()
+ {
+ AutoLock lock(mMutex);
+ mSet = false;
+ }
+ void QReset() { mSet = false; }
+ void Wait()
+ {
+ AutoLock lock(mMutex);
+ while( !mSet )
+ pthread_cond_wait( mCondition, mMutex.mMutex );
+ mSet = false;
+ }
+ // when we already hold the mMutex lock ...
+ void QWait()
+ {
+ while( !mSet )
+ pthread_cond_wait( mCondition, mMutex.mMutex );
+ mSet = false;
+ }
+ // Returns true if the wait was success, false on timeout.
+ bool WaitSeconds(double inSeconds)
+ {
+ struct timeval tv;
+ gettimeofday(&tv, 0);
+
+ int isec = (int)inSeconds;
+ int usec = (int)((inSeconds-isec)*1000000.0);
+ timespec spec;
+ spec.tv_nsec = (tv.tv_usec + usec) * 1000;
+ if (spec.tv_nsec>1000000000)
+ {
+ spec.tv_nsec-=1000000000;
+ isec++;
+ }
+ spec.tv_sec = tv.tv_sec + isec;
+
+ AutoLock lock(mMutex);
+
+ int result = 0;
+ // Wait for set to be true...
+ while( !mSet && (result=pthread_cond_timedwait( mCondition, mMutex.mMutex, &spec )) != ETIMEDOUT)
+ {
+ if (result!=0)
+ {
+ // Error - something's gone wrong...
+ /*
+ if (result==EINVAL)
+ printf("ERROR: Condition EINVAL\n");
+ else if (result==EPERM)
+ printf("ERROR: Condition EPERM\n");
+ else
+ printf("ERROR: Condition unknown error\n");
+ */
+ break;
+ }
+ // Condition signalled - but try mSet again ...
+ }
+
+ bool wasSet = mSet;
+ mSet = false;
+ return wasSet;
+ }
+ void Clean()
+ {
+ mMutex.Clean();
+ if (mValid)
+ {
+ mValid = false;
+ pthread_cond_destroy(mCondition);
+ }
+ delete mCondition;
+ }
+
+
+ HxMutex mMutex;
+ pthread_cond_t *mCondition;
+ bool mSet;
+ bool mValid;
+};
+
+
+#endif
+
+
+#if defined HX_WINRT
+
+inline void HxSleep(unsigned int ms)
+{
+ ::Sleep(ms);
+}
+
+#elif defined HX_WINDOWS
+
+inline void HxSleep(unsigned int ms)
+{
+ ::Sleep(ms);
+}
+
+#else
+
+inline void HxSleep(unsigned int ms)
+{
+ struct timespec t;
+ struct timespec tmp;
+ t.tv_sec = 0;
+ t.tv_nsec = ms * 1000000;
+ nanosleep(&t, &tmp);
+}
+
+#endif
+
+
+#endif
+#endif
diff --git a/Sources/c_snikket/iinclude/hx/Tls.h b/Sources/c_snikket/iinclude/hx/Tls.h
new file mode 100755
index 0000000..689d4bb
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/Tls.h
@@ -0,0 +1,165 @@
+#ifdef HX_TLS_H_OVERRIDE
+// Users can define their own header to use here, but there is no API
+// compatibility gaurantee for future changes.
+#include HX_TLS_H_OVERRIDE
+#else
+
+#ifndef HX_TLS_INCLUDED
+#define HX_TLS_INCLUDED
+
+#ifdef HX_WINDOWS
+
+ #ifdef HX_WINRT
+ // Nothing
+ #else
+
+ #if ! defined(__GNUC__) && !defined(__BORLANDC__)
+ #include <intrin.h>
+ #endif
+
+ extern "C"
+ {
+ __declspec(dllimport)
+ int __stdcall TlsSetValue(unsigned long dwTlsIndex, void *lpTlsValue);
+
+ __declspec(dllimport)
+ void * __stdcall TlsGetValue(unsigned long dwTlsIndex);
+
+ __declspec(dllimport)
+ unsigned long __stdcall TlsAlloc(void);
+ }
+
+
+ namespace hx {
+
+ template<typename DATA,bool FAST=false>
+ struct TLSData
+ {
+ static const size_t kMaxInlineSlots = 64;
+
+ TLSData()
+ {
+ mSlot = TlsAlloc();
+ TlsSetValue(mSlot,0);
+ #ifdef HXCPP_M64
+ mFastOffset = mSlot*sizeof(void *) + 0x1480;
+ #else
+ if (FAST || mSlot < kMaxInlineSlots)
+ mFastOffset = mSlot*sizeof(void *) + 0xE10;
+ else
+ mFastOffset = mSlot - kMaxInlineSlots;
+ #endif
+ }
+ inline DATA *operator=(DATA *inData)
+ {
+ TlsSetValue(mSlot,inData);
+ return inData;
+ }
+
+ inline operator DATA *()
+ {
+ #if !defined(HXCPP_M64) && (_MSC_VER >= 1400)
+ const size_t kTibExtraTlsOffset = 0xF94;
+
+ if (FAST || mSlot < kMaxInlineSlots)
+ return (DATA *)__readfsdword(mFastOffset);
+
+ DATA **extra = (DATA **)(__readfsdword(kTibExtraTlsOffset));
+ return extra[mFastOffset];
+ #elif (_MSC_VER >= 1400) & !defined(HXCPP_DEBUG) && !defined(HXCPP_ARM64)// 64 bit version...
+ if (mSlot < 64)
+ return (DATA *)__readgsqword(mFastOffset);
+ else
+ return (DATA *)TlsGetValue(mSlot);
+ #else
+ return (DATA *)TlsGetValue(mSlot);
+ #endif
+ }
+
+ int mSlot;
+ int mFastOffset;
+ };
+
+ } // end namespace hx
+
+
+ #define DECLARE_TLS_DATA(TYPE,NAME) \
+ hx::TLSData<TYPE> NAME;
+ #define DECLARE_FAST_TLS_DATA(TYPE,NAME) \
+ hx::TLSData<TYPE,true> NAME;
+ #define EXTERN_TLS_DATA(TYPE,NAME) \
+ extern hx::TLSData<TYPE> NAME;
+ #define EXTERN_FAST_TLS_DATA(TYPE,NAME) \
+ extern hx::TLSData<TYPE,true> NAME;
+
+
+ #endif
+#else // not HX_WINDOWS
+
+#include <pthread.h>
+
+namespace hx
+{
+
+template<typename DATA,bool FAST=false>
+struct TLSData
+{
+ TLSData()
+ {
+ pthread_key_create(&mSlot, 0);
+ }
+ DATA *Get()
+ {
+ return (DATA *)pthread_getspecific(mSlot);
+ }
+ void Set(DATA *inData)
+ {
+ pthread_setspecific(mSlot,inData);
+ }
+ inline DATA *operator=(DATA *inData)
+ {
+ pthread_setspecific(mSlot,inData);
+ return inData;
+ }
+ inline operator DATA *() { return (DATA *)pthread_getspecific(mSlot); }
+
+ pthread_key_t mSlot;
+};
+
+} // end namespace hx
+
+
+#endif
+
+
+
+#ifdef HX_WINRT
+
+#define DECLARE_TLS_DATA(TYPE,NAME) \
+ __declspec(thread) TYPE * NAME = nullptr;
+#define DECLARE_FAST_TLS_DATA(TYPE,NAME) \
+ __declspec(thread) TYPE * NAME = nullptr;
+#define EXTERN_TLS_DATA(TYPE,NAME) \
+ __declspec(thread) extern TYPE * NAME;
+#define EXTERN_FAST_TLS_DATA(TYPE,NAME) \
+ __declspec(thread) extern TYPE * NAME;
+
+#else
+
+#define DECLARE_TLS_DATA(TYPE,NAME) \
+ hx::TLSData<TYPE> NAME;
+#define DECLARE_FAST_TLS_DATA(TYPE,NAME) \
+ hx::TLSData<TYPE,true> NAME;
+#define EXTERN_TLS_DATA(TYPE,NAME) \
+ extern hx::TLSData<TYPE> NAME;
+#define EXTERN_FAST_TLS_DATA(TYPE,NAME) \
+ extern hx::TLSData<TYPE,true> NAME;
+
+#endif
+
+
+
+
+#endif
+
+#endif
diff --git a/Sources/c_snikket/iinclude/hx/Undefine.h b/Sources/c_snikket/iinclude/hx/Undefine.h
new file mode 100644
index 0000000..9400821
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/Undefine.h
@@ -0,0 +1,28 @@
+#ifndef HX_UNDEFINE_H
+#define HX_UNDEFINE_H
+
+#undef TRUE
+#undef FALSE
+#undef BOOLEAN
+#undef ERROR
+#undef NO_ERROR
+#undef DELETE
+#undef OPTIONS
+#undef IN
+#undef OUT
+#undef ALTERNATE
+#undef OPTIONAL
+#undef DOUBLE_CLICK
+#undef DIFFERENCE
+#undef POINT
+#undef RECT
+#undef OVERFLOW
+#undef UNDERFLOW
+#undef DOMAIN
+#undef TRANSPARENT
+#undef CONST
+#undef CopyFile
+#undef COLOR_HIGHLIGHT
+#undef __valid
+
+#endif
diff --git a/Sources/c_snikket/iinclude/hx/Unordered.h b/Sources/c_snikket/iinclude/hx/Unordered.h
new file mode 100644
index 0000000..ca5d69c
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/Unordered.h
@@ -0,0 +1,38 @@
+#ifndef HX_UNORDERED_INCLUDED
+#define HX_UNORDERED_INCLUDED
+
+#if (defined(_MSC_VER) && (_MSC_VER >= 1800)) || ( defined(__GNUC__) && defined(HXCPP_CPP11) )
+#include <unordered_set>
+#include <unordered_map>
+
+namespace hx
+{
+
+template<typename T>
+struct UnorderedSet : public std::unordered_set<T> { };
+
+template<typename KEY, typename VALUE>
+struct UnorderedMap : public std::unordered_map<KEY,VALUE> { };
+
+}
+
+
+#else
+
+#include <set>
+#include <map>
+
+namespace hx
+{
+
+template<typename T>
+struct UnorderedSet : public std::set<T> { };
+
+template<typename KEY, typename VALUE>
+struct UnorderedMap : public std::map<KEY,VALUE> { };
+
+}
+
+#endif
+
+#endif
diff --git a/Sources/c_snikket/iinclude/hx/strings/RandomStrings.h b/Sources/c_snikket/iinclude/hx/strings/RandomStrings.h
new file mode 100644
index 0000000..ff1c160
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/strings/RandomStrings.h
@@ -0,0 +1,74 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_hx_strings_RandomStrings
+#define INCLUDED_hx_strings_RandomStrings
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(hx,strings,RandomStrings)
+HX_DECLARE_CLASS4(hx,strings,internal,_Either2,_Either2)
+
+namespace hx{
+namespace strings{
+
+
+class HXCPP_CLASS_ATTRIBUTES RandomStrings_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef RandomStrings_obj OBJ_;
+ RandomStrings_obj();
+
+ public:
+ enum { _hx_ClassId = 0x48d6a291 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="hx.strings.RandomStrings")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"hx.strings.RandomStrings"); }
+
+ inline static ::hx::ObjectPtr< RandomStrings_obj > __new() {
+ ::hx::ObjectPtr< RandomStrings_obj > __this = new RandomStrings_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< RandomStrings_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ RandomStrings_obj *__this = (RandomStrings_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(RandomStrings_obj), false, "hx.strings.RandomStrings"));
+ *(void **)__this = RandomStrings_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~RandomStrings_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("RandomStrings",9f,7a,45,55); }
+
+ static void __boot();
+ static ::Array< int > DIGITS;
+ static ::Array< int > _genAsciiAlpha();
+ static ::Dynamic _genAsciiAlpha_dyn();
+
+ static ::Array< int > ASCII_ALPHA;
+ static ::Array< int > ASCII_ALPHA_NUMERIC;
+ static ::String random(int length, ::hx::strings::internal::_Either2::_Either2 chars);
+ static ::Dynamic random_dyn();
+
+ static ::String randomUUIDv4(::String separator);
+ static ::Dynamic randomUUIDv4_dyn();
+
+};
+
+} // end namespace hx
+} // end namespace strings
+
+#endif /* INCLUDED_hx_strings_RandomStrings */
diff --git a/Sources/c_snikket/iinclude/hx/strings/StringBuilder.h b/Sources/c_snikket/iinclude/hx/strings/StringBuilder.h
new file mode 100644
index 0000000..8115925
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/strings/StringBuilder.h
@@ -0,0 +1,70 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_hx_strings_StringBuilder
+#define INCLUDED_hx_strings_StringBuilder
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(StringBuf)
+HX_DECLARE_CLASS2(hx,strings,StringBuilder)
+
+namespace hx{
+namespace strings{
+
+
+class HXCPP_CLASS_ATTRIBUTES StringBuilder_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef StringBuilder_obj OBJ_;
+ StringBuilder_obj();
+
+ public:
+ enum { _hx_ClassId = 0x32066fb8 };
+
+ void __construct(::String initialContent);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="hx.strings.StringBuilder")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"hx.strings.StringBuilder"); }
+ static ::hx::ObjectPtr< StringBuilder_obj > __new(::String initialContent);
+ static ::hx::ObjectPtr< StringBuilder_obj > __alloc(::hx::Ctx *_hx_ctx,::String initialContent);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~StringBuilder_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("StringBuilder",2a,56,d0,8d); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ ::StringBuf sb;
+ ::Array< ::String > pre;
+ int len;
+ ::hx::strings::StringBuilder add(::String item);
+ ::Dynamic add_dyn();
+
+ ::hx::strings::StringBuilder addChar(int ch);
+ ::Dynamic addChar_dyn();
+
+ ::hx::strings::StringBuilder clear();
+ ::Dynamic clear_dyn();
+
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+};
+
+} // end namespace hx
+} // end namespace strings
+
+#endif /* INCLUDED_hx_strings_StringBuilder */
diff --git a/Sources/c_snikket/iinclude/hx/strings/Strings.h b/Sources/c_snikket/iinclude/hx/strings/Strings.h
new file mode 100644
index 0000000..6629ee7
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/strings/Strings.h
@@ -0,0 +1,62 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_hx_strings_Strings
+#define INCLUDED_hx_strings_Strings
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(hx,strings,Strings)
+
+namespace hx{
+namespace strings{
+
+
+class HXCPP_CLASS_ATTRIBUTES Strings_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Strings_obj OBJ_;
+ Strings_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0e5b539c };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="hx.strings.Strings")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"hx.strings.Strings"); }
+
+ inline static ::hx::ObjectPtr< Strings_obj > __new() {
+ ::hx::ObjectPtr< Strings_obj > __this = new Strings_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Strings_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Strings_obj *__this = (Strings_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Strings_obj), false, "hx.strings.Strings"));
+ *(void **)__this = Strings_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Strings_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Strings",62,b6,44,c6); }
+
+ static ::Array< int > toChars(::String str);
+ static ::Dynamic toChars_dyn();
+
+};
+
+} // end namespace hx
+} // end namespace strings
+
+#endif /* INCLUDED_hx_strings_Strings */
diff --git a/Sources/c_snikket/iinclude/hx/strings/internal/_Either2/_Either2.h b/Sources/c_snikket/iinclude/hx/strings/internal/_Either2/_Either2.h
new file mode 100644
index 0000000..189b578
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hx/strings/internal/_Either2/_Either2.h
@@ -0,0 +1,41 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_hx_strings_internal__Either2__Either2
+#define INCLUDED_hx_strings_internal__Either2__Either2
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS4(hx,strings,internal,_Either2,_Either2)
+namespace hx{
+namespace strings{
+namespace internal{
+namespace _Either2{
+
+
+class _Either2_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef _Either2_obj OBJ_;
+
+ public:
+ _Either2_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("hx.strings.internal._Either2._Either2",07,08,e6,82); }
+ ::String __ToString() const { return HX_("_Either2.",c0,d7,a7,46) + _hx_tag; }
+
+ static ::hx::strings::internal::_Either2::_Either2 a( ::Dynamic v);
+ static ::Dynamic a_dyn();
+ static ::hx::strings::internal::_Either2::_Either2 b( ::Dynamic v);
+ static ::Dynamic b_dyn();
+};
+
+} // end namespace hx
+} // end namespace strings
+} // end namespace internal
+} // end namespace _Either2
+
+#endif /* INCLUDED_hx_strings_internal__Either2__Either2 */
diff --git a/Sources/c_snikket/iinclude/hxMath.h b/Sources/c_snikket/iinclude/hxMath.h
new file mode 100644
index 0000000..1e4b1b6
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hxMath.h
@@ -0,0 +1,84 @@
+#ifndef HX_MATH
+#define HX_MATH
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#include <cmath>
+#include <stdlib.h>
+
+class HXCPP_EXTERN_CLASS_ATTRIBUTES Math_obj : public hx::Object
+{
+public:
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdMath };
+
+ typedef hx::Object super;
+ typedef Math_obj OBJ_;
+ HX_DO_RTTI;
+ void __construct();
+ static Dynamic __CreateEmpty();
+ static void __boot();
+
+ inline static int floor(double inX) { return __int__(::std::floor(inX)); }
+ inline static int ceil(double inX) { return __int__(::std::ceil(inX)); }
+ inline static int round(double inX) { return floor(inX+0.5); }
+ inline static double ffloor(double inX) { return ::std::floor(inX); }
+ inline static double fceil(double inX) { return ::std::ceil(inX); }
+ inline static double fround(double inX) { return ::std::floor(inX+0.5); }
+ inline static double random() { return __hxcpp_drand(); }
+ inline static double sqrt(double inX) { return ::std::sqrt(inX); }
+ inline static double cos(double inX) { return ::std::cos(inX); }
+ inline static double sin(double inX) { return ::std::sin(inX); }
+ inline static double tan(double inX) { return ::std::tan(inX); }
+ inline static double atan2(double inY,double inX) { return ::std::atan2(inY,inX); }
+ inline static double abs(double inX) { return ::std::fabs(inX); }
+ inline static double pow(double inA,double inB) { return ::std::pow(inA,inB); }
+ inline static double log(double inA) { return ::std::log(inA); }
+ inline static double max(double inA,double inB) { return inA>inB ? inA:inA==inA?inB:inA; }
+ inline static double min(double inA,double inB) { return inA<inB ? inA:inA==inA?inB:inA; }
+
+ inline static double atan(double inA) { return ::std::atan(inA); }
+ inline static double asin(double inA) { return ::std::asin(inA); }
+ inline static double acos(double inA) { return ::std::acos(inA); }
+ inline static double exp(double inA) { return ::std::exp(inA); }
+
+
+ static bool isNaN(double inX);
+ static bool isFinite(double inX);
+
+
+ static Dynamic floor_dyn();
+ static Dynamic ceil_dyn();
+ static Dynamic round_dyn();
+ static Dynamic ffloor_dyn();
+ static Dynamic fceil_dyn();
+ static Dynamic fround_dyn();
+ static Dynamic random_dyn();
+ static Dynamic sqrt_dyn();
+ static Dynamic cos_dyn();
+ static Dynamic sin_dyn();
+ static Dynamic tan_dyn();
+ static Dynamic atan2_dyn();
+ static Dynamic abs_dyn();
+ static Dynamic pow_dyn();
+ static Dynamic log_dyn();
+ static Dynamic min_dyn();
+ static Dynamic max_dyn();
+ static Dynamic atan_dyn();
+ static Dynamic asin_dyn();
+ static Dynamic acos_dyn();
+ static Dynamic exp_dyn();
+ static Dynamic isNaN_dyn();
+ static Dynamic isFinite_dyn();
+
+ static double NaN;
+ static double PI;
+ static double NEGATIVE_INFINITY;
+ static double POSITIVE_INFINITY;
+};
+
+typedef hx::ObjectPtr<Math_obj> Math;
+
+
+#endif
diff --git a/Sources/c_snikket/iinclude/hxString.h b/Sources/c_snikket/iinclude/hxString.h
new file mode 100644
index 0000000..e390ac3
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hxString.h
@@ -0,0 +1,404 @@
+#ifndef HX_STRING_H
+#define HX_STRING_H
+
+#ifndef HXCPP_H
+#error "Please include hxcpp.h, not hx/Object.h"
+#endif
+
+#include <hx/StringAlloc.h>
+
+#ifdef __OBJC__
+#import <Foundation/Foundation.h>
+#endif
+
+
+// --- String --------------------------------------------------------
+//
+// Basic String type for hxcpp.
+// It's based on garbage collection of the wchar_t (or char ) *ptr.
+// Note: this does not inherit from "hx::Object", so in some ways it acts more
+// like a standard "int" type than a mode generic class.
+
+class HXCPP_EXTERN_CLASS_ATTRIBUTES String
+{
+ friend class StringOffset;
+
+public:
+ // These allocate the function using the garbage-colleced malloc
+ void *operator new( size_t inSize );
+ inline void* operator new( size_t, void* ptr ) { return ptr; }
+ void operator delete( void * ) { }
+
+ inline String() : length(0), __s(0) { }
+
+ // Uses pointer
+ inline String(const char *inPtr,int inLen) : __s(inPtr), length(inLen) { }
+ #ifdef HX_SMART_STRINGS
+ inline String(const char16_t *inPtr,int inLen) : __w(inPtr), length(inLen) { }
+ #endif
+
+ // Makes copy
+ inline String(const wchar_t *inPtr) { *this = create(inPtr); }
+ inline String(const char16_t *inPtr) { *this = create(inPtr); }
+ inline String(const char *inPtr) { *this = create(inPtr); }
+
+ static String create(const wchar_t *inPtr,int inLen=-1);
+ static String create(const char16_t *inPtr,int inLen=-1);
+ static String create(const char *inPtr,int inLen=-1);
+
+ // Uses non-gc memory and wont ever be collected
+ static ::String createPermanent(const char *inUtf8, int inLen);
+ const ::String &makePermanent() const;
+ hx::Object *makePermanentObject() const;
+
+ // Legacy
+ ::String &dup();
+
+
+ #ifdef __OBJC__
+ inline String(NSString *inString)
+ {
+ if (inString)
+ *this = String([inString UTF8String]);
+ else
+ {
+ length = 0;
+ __s = 0;
+ }
+ }
+ inline operator NSString * () const
+ {
+ hx::strbuf buf;
+ return [[NSString alloc] initWithUTF8String:utf8_str(&buf) ];
+ }
+ #endif
+ #if defined(HX_WINRT) && defined(__cplusplus_winrt)
+ inline String(Platform::String^ inString)
+ {
+ *this = String(inString->Data());
+ }
+ inline String(Platform::StringReference inString)
+ {
+ *this = String(inString.Data());
+ }
+ #endif
+
+ inline String(const ::String &inRHS) : __s(inRHS.__s), length(inRHS.length) { }
+ String(const int &inRHS);
+ String(const unsigned int &inRHS);
+ String(const short &inRHS) { fromInt(inRHS); }
+ String(const unsigned short &inRHS) { fromInt(inRHS); }
+ String(const signed char &inRHS) { fromInt(inRHS); }
+ String(const unsigned char &inRHS) { fromInt(inRHS); }
+ String(const cpp::CppInt32__ &inRHS);
+ String(const double &inRHS);
+ String(const float &inRHS);
+ String(const cpp::Int64 &inRHS);
+ String(const cpp::UInt64 &inRHS);
+ String(const unsigned long &inRHS);
+ explicit String(const bool &inRHS);
+ inline String(const null &inRHS) : __s(0), length(0) { }
+ String(hx::Null< ::String > inRHS) : __s(inRHS.value.__s), length(inRHS.value.length) { }
+ inline String(const ::cpp::Variant &inRHS) { *this = inRHS.asString(); }
+ template<typename T>
+ inline String( const ::cpp::Pointer<T> &inRHS) { fromPointer(inRHS.ptr); }
+ template<typename T>
+ inline String( const hx::Native<T> &n ) { fromPointer(n.ptr); }
+
+ static String emptyString;
+ static void __boot();
+
+ hx::Object *__ToObject() const;
+
+ template<typename T,typename S>
+ explicit inline String(const cpp::Struct<T,S> &inRHS);
+ template<typename OBJ>
+ explicit inline String(const hx::ObjectPtr<OBJ> &inRHS);
+ void fromInt(int inI);
+ void fromPointer(const void *p);
+
+
+
+ /*
+ This causes ambiguous problem with Object==Dynamic (String==Dynamic vs Object==Object)
+ and syntactically, String(Dynamic) should be enough I think.
+ Could perhaps make it explicit
+
+ template<typename T>
+ inline String(const hx::ObjectPtr<T> &inRHS)
+ {
+ if (inRHS.mPtr)
+ {
+ ::String s = static_cast<hx::Object *>(inRHS.mPtr)->toString();
+ __s = s.__s;
+ length = s.length;
+ }
+ else { __s = 0; length = 0; }
+ }
+ */
+ String(const Dynamic &inRHS);
+
+ inline ::String &operator=(const ::String &inRHS)
+ { length = inRHS.length; __s = inRHS.__s; return *this; }
+
+ ::String Default(const ::String &inDef) { return __s ? *this : inDef; }
+
+
+ ::String toString() { return *this; }
+
+ ::String __URLEncode() const;
+ ::String __URLDecode() const;
+
+
+ ::String toUpperCase() const;
+ ::String toLowerCase() const;
+ ::String charAt(int inPos) const;
+ Dynamic charCodeAt(int inPos) const;
+ int indexOf(const ::String &inValue, Dynamic inStart) const;
+ int lastIndexOf(const ::String &inValue, Dynamic inStart) const;
+ Array<String> split(const ::String &inDelimiter) const;
+ ::String substr(int inPos,Dynamic inLen) const;
+ ::String substring(int inStartIndex, Dynamic inEndIndex) const;
+
+ inline const char *&raw_ref() { return __s; }
+ inline const char *raw_ptr() const { return __s; }
+ const char *utf8_str(hx::IStringAlloc *inBuffer = 0,bool throwInvalid=true, int *byteLength = 0) const;
+ const char *ascii_substr(hx::IStringAlloc *inBuffer,int start, int length) const;
+ inline const char *c_str() const { return utf8_str(); }
+ inline const char *out_str(hx::IStringAlloc *inBuffer = 0) const { return utf8_str(inBuffer,false); }
+ const wchar_t *wchar_str(hx::IStringAlloc *inBuffer = 0) const;
+ const char16_t *wc_str(hx::IStringAlloc *inBuffer = 0, int *outCharLength = 0) const;
+
+ const char *__CStr() const { return utf8_str(); };
+ const wchar_t *__WCStr() const { return wchar_str(0); }
+ inline operator const char *() { return utf8_str(); }
+
+ #ifdef HX_SMART_STRINGS
+ inline const char16_t *raw_wptr() const { return __w; }
+ #endif
+ inline bool isUTF16Encoded() const {
+ #ifdef HX_SMART_STRINGS
+ return __w && ((unsigned int *)__w)[-1] & HX_GC_STRING_CHAR16_T;
+ #else
+ return false;
+ #endif
+ }
+
+ inline bool isAsciiEncoded() const {
+ #ifdef HX_SMART_STRINGS
+ return !__w || !(((unsigned int *)__w)[-1] & HX_GC_STRING_CHAR16_T);
+ #else
+ return true;
+ #endif
+ }
+
+ inline bool isAsciiEncodedQ() const {
+ #ifdef HX_SMART_STRINGS
+ return !(((unsigned int *)__w)[-1] & HX_GC_STRING_CHAR16_T);
+ #else
+ return true;
+ #endif
+ }
+
+
+
+ static ::String fromCharCode(int inCode);
+
+ inline bool operator==(const null &inRHS) const { return __s==0; }
+ inline bool operator!=(const null &inRHS) const { return __s!=0; }
+
+ inline int getChar( int index ) {
+ if (isUTF16Encoded())
+ return __w[index];
+ return __s[index];
+ }
+ inline unsigned int hash( ) const
+ {
+ if (!__s) return 0;
+ if ( __s[HX_GC_STRING_HASH_OFFSET] & HX_GC_STRING_HASH_BIT)
+ {
+ #ifdef HXCPP_PARANOID
+ unsigned int result = calcHash();
+
+ unsigned int have = (((unsigned int *)__s)[-1] & HX_GC_CONST_ALLOC_BIT) ?
+ ((unsigned int *)__s)[-2] : *((unsigned int *)(__s+length+1) );
+
+ if ( have != result )
+ {
+ printf("Bad string hash for %s\n", __s );
+ printf(" Is %08x\n", result );
+ printf(" Baked %08x\n", have );
+ printf(" Mark %08x\n", ((unsigned int *)__s)[-1] );
+ }
+ #endif
+ if (__s[HX_GC_CONST_ALLOC_MARK_OFFSET] & HX_GC_CONST_ALLOC_MARK_BIT)
+ {
+ #ifdef EMSCRIPTEN
+ return ((emscripten_align1_int*)__s)[-2];
+ #else
+ return ((unsigned int *)__s)[-2];
+ #endif
+ }
+ #ifdef EMSCRIPTEN
+ return *((emscripten_align1_int *)(__s+length+1) );
+ #else
+ return *((unsigned int *)(__s+length+1) );
+ #endif
+ }
+
+ // Slow path..
+ return calcHash();
+ }
+
+ unsigned int calcHash() const;
+ unsigned int calcSubHash(int start, int length) const;
+
+ #ifdef HX_SMART_STRINGS
+ int compare(const ::String &inRHS) const;
+ #else
+ inline int compare(const ::String &inRHS) const
+ {
+ const char *r = inRHS.__s;
+ if (__s == r) return inRHS.length-length;
+ if (__s==0) return -1;
+ if (r==0) return 1;
+
+ return strcmp(__s,r);
+ //return memcmp(__s,r,length);
+ }
+ #endif
+
+
+ ::String &operator+=(const ::String &inRHS);
+ ::String operator+(const ::String &inRHS) const;
+ ::String operator+(const int &inRHS) const { return *this + ::String(inRHS); }
+ ::String operator+(const bool &inRHS) const { return *this + ::String(inRHS); }
+ ::String operator+(const double &inRHS) const { return *this + ::String(inRHS); }
+ ::String operator+(const float &inRHS) const { return *this + ::String(inRHS); }
+ ::String operator+(const null &inRHS) const{ return *this + HX_CSTRING("null"); }
+ //::String operator+(const char *inRHS) const{ return *this + ::String(inRHS); }
+ ::String operator+(const cpp::CppInt32__ &inRHS) const{ return *this + ::String(inRHS); }
+ template<typename T>
+ inline ::String operator+(const hx::ObjectPtr<T> &inRHS) const
+ { return *this + (inRHS.mPtr ? const_cast<hx::ObjectPtr<T>&>(inRHS)->toString() : HX_CSTRING("null") ); }
+ ::String operator+(const cpp::Variant &inRHS) const{ return *this + inRHS.asString(); }
+
+
+
+ #ifdef HX_SMART_STRINGS
+ bool eq(const ::String &inRHS) const;
+ #else
+ inline bool eq(const ::String &inRHS) const
+ {
+ // Strings are known not to be null...
+ return length==inRHS.length && !memcmp(__s,inRHS.__s,length);
+ }
+ #endif
+
+ inline bool operator==(const ::String &inRHS) const
+ {
+ if (!inRHS.__s)
+ return !__s;
+ if (!__s)
+ return false;
+ return eq(inRHS);
+ }
+ inline bool operator!=(const ::String &inRHS) const
+ {
+ if (!inRHS.__s)
+ return __s;
+ if (!__s)
+ return true;
+ return !eq(inRHS);
+ }
+
+ inline bool operator<(const ::String &inRHS) const { return compare(inRHS)<0; }
+ inline bool operator<=(const ::String &inRHS) const { return compare(inRHS)<=0; }
+ inline bool operator>(const ::String &inRHS) const { return compare(inRHS)>0; }
+ inline bool operator>=(const ::String &inRHS) const { return compare(inRHS)>=0; }
+
+ inline bool operator<(const Dynamic &inRHS) const { return compare(inRHS)<0; }
+ inline bool operator<=(const Dynamic &inRHS) const { return compare(inRHS)<=0; }
+ inline bool operator>(const Dynamic &inRHS) const { return compare(inRHS)>0; }
+ inline bool operator>=(const Dynamic &inRHS) const { return compare(inRHS)>=0; }
+
+ inline int cca(int inPos) const
+ {
+ if ((unsigned)inPos>=length) return 0;
+ #ifdef HX_SMART_STRINGS
+ if (isUTF16Encoded())
+ return __w[inPos];
+ #endif
+ return ((unsigned char *)__s)[inPos];
+ }
+
+ inline Dynamic iterator();
+ inline Dynamic keyValueIterator();
+
+ static char16_t *allocChar16Ptr(int len);
+
+
+ static Dynamic fromCharCode_dyn();
+
+
+ Dynamic charAt_dyn();
+ Dynamic charCodeAt_dyn();
+ Dynamic indexOf_dyn();
+ Dynamic lastIndexOf_dyn();
+ Dynamic split_dyn();
+ Dynamic substr_dyn();
+ Dynamic substring_dyn();
+ Dynamic toLowerCase_dyn();
+ Dynamic toString_dyn();
+ Dynamic toUpperCase_dyn();
+
+ // This is used by the string-wrapped-as-dynamic class
+ hx::Val __Field(const ::String &inString, hx::PropertyAccess inCallProp);
+
+ // The actual implementation.
+ // Note that "__s" is const - if you want to change it, you should create a new string.
+ // this allows for multiple strings to point to the same data.
+ int length;
+
+ #ifdef HX_SMART_STRINGS
+ // TODO private:
+ // Use c_str, wc_str, raw_str instead
+ #endif
+
+ union {
+ const char *__s;
+ const char16_t *__w;
+ };
+
+};
+
+class StringOffset
+{
+ public:
+ enum { Ptr = offsetof(String,__s) };
+};
+
+
+
+
+
+inline HXCPP_EXTERN_CLASS_ATTRIBUTES String _hx_string_create(const char *str, int len)
+{
+ return String::create(str,len);
+}
+
+inline int HXCPP_EXTERN_CLASS_ATTRIBUTES _hx_string_compare(String inString0, String inString1)
+{
+ return inString0.compare(inString1);
+}
+
+String HXCPP_EXTERN_CLASS_ATTRIBUTES _hx_utf8_to_utf16(const unsigned char *ptr, int inUtf8Len, bool addHash);
+
+int HXCPP_EXTERN_CLASS_ATTRIBUTES _hx_utf8_char_code_at(String inString, int inIndex);
+int HXCPP_EXTERN_CLASS_ATTRIBUTES _hx_utf8_length(String inString);
+bool HXCPP_EXTERN_CLASS_ATTRIBUTES _hx_utf8_is_valid(String inString);
+String HXCPP_EXTERN_CLASS_ATTRIBUTES _hx_utf8_sub(String inString0, int inStart, int inLen);
+int HXCPP_EXTERN_CLASS_ATTRIBUTES _hx_utf8_decode_advance(char *&ioPtr);
+
+
+#endif
diff --git a/Sources/c_snikket/iinclude/hxcpp.h b/Sources/c_snikket/iinclude/hxcpp.h
new file mode 100755
index 0000000..008f135
--- /dev/null
+++ b/Sources/c_snikket/iinclude/hxcpp.h
@@ -0,0 +1,362 @@
+#ifndef HXCPP_H
+#define HXCPP_H
+
+// Standard headers ....
+
+// Windows hack
+#define NOMINMAX
+
+#ifndef HXCPP_API_LEVEL
+ #define HXCPP_API_LEVEL 0
+#endif
+
+#include "hx/HeaderVersion.h"
+
+#if defined(_MSC_VER) || defined(__BORLANDC__)
+ #if _MSC_VER >= 1423
+ #include <typeinfo>
+ #else
+ #include <typeinfo.h>
+ #endif
+ #if defined(__BORLANDC__)
+ namespace hx { typedef std::type_info type_info; }
+ #else
+ namespace hx { typedef ::type_info type_info; }
+ #endif
+#else
+ #include <typeinfo>
+ #include <stdint.h>
+ #include <cstddef>
+ namespace hx { typedef std::type_info type_info; }
+ #ifndef EMSCRIPTEN
+ using hx::type_info;
+ #ifdef __MINGW32__
+ #include <stdint.h>
+ #else
+ typedef int64_t __int64;
+ #endif
+ #endif
+#endif
+
+#if defined(EMSCRIPTEN) || defined(IPHONE) || defined(APPLETV)
+ #include <unistd.h>
+ #include <cstdlib>
+#endif
+
+#if defined(EMSCRIPTEN)
+ #include <emscripten.h>
+#endif
+
+#ifdef __OBJC__
+#ifdef HXCPP_OBJC
+ #import <Foundation/Foundation.h>
+#endif
+#endif
+
+
+#include <string.h>
+
+#include <wchar.h>
+
+#ifdef HX_LINUX
+ #include <unistd.h>
+ #include <cstdio>
+ #include <stddef.h>
+#endif
+
+#if defined(EMSCRIPTEN) || defined(_ARM_) || defined(__arm__) || defined(GCW0)
+ #define HXCPP_ALIGN_FLOAT
+#endif
+
+// Must allign allocs to 8 bytes to match floating point requirement?
+// Ints must br read on 4-byte boundary
+#if (!defined(HXCPP_ALIGN_FLOAT) && (defined(EMSCRIPTEN) || defined(GCW0)) )
+ #define HXCPP_ALIGN_ALLOC
+#endif
+
+
+// Some compilers are over-enthusiastic about what they #define ...
+//#ifdef NULL
+//#undef NULL
+//#endif
+
+#ifdef assert
+#undef assert
+#endif
+
+#define HXCPP_CLASS_ATTRIBUTES
+
+#ifdef _MSC_VER
+ #if defined(HXCPP_DLL_IMPORT)
+ #define HXCPP_EXTERN_CLASS_ATTRIBUTES __declspec(dllimport)
+ #elif defined (HXCPP_DLL_EXPORT)
+ #define HXCPP_EXTERN_CLASS_ATTRIBUTES __declspec(dllexport)
+ #else
+ #define HXCPP_EXTERN_CLASS_ATTRIBUTES
+ #endif
+#else
+ #if defined(HXCPP_DLL_EXPORT)
+ #define HXCPP_EXTERN_CLASS_ATTRIBUTES __attribute__((visibility("default")))
+ #else
+ #define HXCPP_EXTERN_CLASS_ATTRIBUTES
+ #endif
+#endif
+
+typedef char HX_CHAR;
+
+
+
+#if (defined(HXCPP_DEBUG) || defined(HXCPP_DEBUGGER)) && !defined HXCPP_CHECK_POINTER
+#define HXCPP_CHECK_POINTER
+#endif
+
+#ifdef HX_WINRT
+
+#define WINRT_LOG(fmt, ...) {char buf[1024];sprintf_s(buf,1024,"****LOG: %s(%d): %s \n [" fmt "]\n",__FILE__,__LINE__,__FUNCTION__, __VA_ARGS__);OutputDebugString(buf);}
+#define WINRT_PRINTF(fmt, ...) {char buf[2048];sprintf_s(buf,2048,fmt,__VA_ARGS__);OutputDebugString(buf);}
+
+#endif
+
+
+#ifdef BIG_ENDIAN
+#undef BIG_ENDIAN
+
+ #ifndef HXCPP_BIG_ENDIAN
+ #define HXCPP_BIG_ENDIAN
+ #endif
+#endif
+
+#ifdef __BIG_ENDIAN__
+ #ifndef HXCPP_BIG_ENDIAN
+ #define HXCPP_BIG_ENDIAN
+ #endif
+#endif
+
+#ifdef LITTLE_ENDIAN
+#undef LITTLE_ENDIAN
+
+ #ifdef HXCPP_BIG_ENDIAN
+ #undef HXCPP_BIG_ENDIAN
+ #endif
+#endif
+
+#ifdef __LITTLE_ENDIAN__
+ #ifdef HXCPP_BIG_ENDIAN
+ #undef HXCPP_BIG_ENDIAN
+ #endif
+#endif
+
+
+// HX_HCSTRING is for constant strings with built-in hashes
+// HX_GC_CONST_ALLOC_BIT | HX_GC_STRING_HASH
+// HX_CSTRING is for constant strings without built-in hashes
+// HX_GC_CONST_ALLOC_BIT
+// HX_GC_CONST_ALLOC_BIT = 0x80000000
+// HX_GC_STRING_HASH = 0x00100000
+// HX_GC_STRING_CHAR16_T = 0x00200000
+
+// For making generated code easier to read
+#define HX_HASH_JOIN(A, B) A##B
+#define HX_JOIN_PARTS(A, B) HX_HASH_JOIN(A, B)
+#define HX_HASH_OF(A) #A
+#define HX_HASH_OF_W(A) HX_HASH_JOIN(u,#A)
+#define HX_STR_QUOTE(A) HX_HASH_OF(A)
+#define HX_STR_QUOTE_W(A) HX_HASH_OF_W(A)
+#define HX_HEX_QUOTE(hex) HX_STR_QUOTE(HX_JOIN_PARTS(\x,hex))
+#define HX_HEX_QUOTE_W(hex) HX_STR_QUOTE_W(HX_JOIN_PARTS(\x,hex))
+
+#ifdef HXCPP_BIG_ENDIAN
+
+#define HX_HCSTRING(s,h0,h1,h2,h3) ::String( const_cast<char *>((h3 h2 h1 h0 "\x80\x10\x00\x00" s)) + 8 , sizeof(s)/sizeof(char)-1)
+#define HX_(s,h0,h1,h2,h3) ::String( const_cast<char *>(( HX_HEX_QUOTE(h3) HX_HEX_QUOTE(h2) HX_HEX_QUOTE(h1) HX_HEX_QUOTE(h0) "\x80\x10\x00\x00" s )) + 8 , sizeof(s)/sizeof(char)-1)
+#define HX_STRINGI(s,len) ::String( const_cast<char *>(("\x80\x00\x00\x00" s)) + 4 ,len)
+#define HX_W(s,h0,h1) ::String( const_cast<char16_t *>(( HX_HEX_QUOTE_W(h1) HX_HEX_QUOTE_W(h0) u"\x8030\x0000" s )) + 4, sizeof(s)/2-1)
+
+#else
+
+#define HX_HCSTRING(s,h0,h1,h2,h3) ::String( const_cast<char *>((h0 h1 h2 h3 "\x00\x00\x10\x80" s )) + 8 , sizeof(s)/sizeof(char)-1)
+#define HX_(s,h0,h1,h2,h3) ::String( const_cast<char *>(( HX_HEX_QUOTE(h0) HX_HEX_QUOTE(h1) HX_HEX_QUOTE(h2) HX_HEX_QUOTE(h3) "\x00\x00\x10\x80" s )) + 8 , sizeof(s)/sizeof(char)-1)
+#define HX_STRINGI(s,len) ::String( const_cast<char *>(("\x00\x00\x0\x80" s)) + 4 ,len)
+
+#define HX_W(s,h0,h1) ::String( const_cast<char16_t *>(( HX_HEX_QUOTE_W(h0) HX_HEX_QUOTE_W(h1) u"\x0000\x8030" s )) + 4, sizeof(s)/2-1)
+
+#endif
+
+
+#define HX_STRI(s) HX_STRINGI(s,sizeof(s)/sizeof(char)-1)
+#define HX_CSTRING(x) HX_STRI(x)
+#define HX_CSTRING2(wide,len,utf8) HX_STRI(utf8)
+
+#ifdef HX_SMART_STRINGS
+ #define HX_FIELD_EQ(name,field) (name.isAsciiEncoded() && !::memcmp(name.raw_ptr(), field, sizeof(field)/sizeof(char)))
+ // No null check is performedd...
+ #define HX_QSTR_EQ(name,field) (name.length==field.length && field.isAsciiEncodedQ() && !::memcmp(name.raw_ptr(), field.raw_ptr() , field.length) )
+ // field is known to be isAsciiEncodedQ
+ #define HX_QSTR_EQ_AE(name,field) (name.length==field.length && !::memcmp(name.raw_ptr(), field.raw_ptr() , field.length) )
+#else
+ #define HX_FIELD_EQ(name,field) !::memcmp(name.__s, field, sizeof(field)/sizeof(char))
+ // No null check is performed....
+ #define HX_QSTR_EQ(name,field) (name.length==field.length && !::memcmp(name.__s, field.__s, field.length))
+ #define HX_QSTR_EQ_AE(name,field) (name.length==field.length && !::memcmp(name.__s, field.__s, field.length))
+#endif
+
+
+
+#pragma warning(disable:4251)
+#pragma warning(disable:4800)
+
+#if defined(_MSC_VER) && _MSC_VER < 1201
+#error MSVC 7.1 does not support template specialization and is not supported by HXCPP
+#endif
+
+
+// HXCPP includes...
+
+// Basic mapping from haxe -> c++
+
+#ifdef HXCPP_FLOAT32
+typedef float Float;
+#else
+typedef double Float;
+#endif
+
+
+// Extended mapping - cpp namespace
+namespace cpp
+{
+ typedef signed char Int8;
+ typedef unsigned char UInt8;
+ typedef char Char;
+ typedef signed short Int16;
+ typedef unsigned short UInt16;
+ typedef signed int Int32;
+ typedef unsigned int UInt32;
+ #ifdef _WIN32
+ typedef __int64 Int64;
+ typedef unsigned __int64 UInt64;
+ // TODO - EMSCRIPTEN?
+ #else
+ typedef int64_t Int64;
+ typedef uint64_t UInt64;
+ #endif
+ typedef float Float32;
+ typedef double Float64;
+ typedef volatile int AtomicInt;
+};
+// Extended mapping - old way
+namespace haxe { namespace io { typedef unsigned char Unsigned_char__; } }
+
+// --- Forward decalarations --------------------------------------------
+
+class null;
+namespace hx { class Object; }
+namespace hx { class FieldRef; }
+namespace hx { class IndexRef; }
+namespace hx { class NativeInterface; }
+namespace hx { class StackContext; }
+namespace hx { template<typename T> class Native; }
+namespace hx { template<typename O> class ObjectPtr; }
+namespace cpp { template<typename S,typename H> class Struct; }
+namespace cpp { template<typename T> class Pointer; }
+namespace cpp { template<typename T> class Function; }
+template<typename ELEM_> class Array_obj;
+template<typename ELEM_> class Array;
+namespace hx {
+ class Class_obj;
+ typedef hx::ObjectPtr<hx::Class_obj> Class;
+}
+namespace cpp {
+ struct Variant;
+ class VirtualArray_obj;
+ class VirtualArray;
+ class CppInt32__;
+}
+
+class Dynamic;
+class String;
+
+// Use an external routine to throw to avoid sjlj overhead on iphone.
+namespace hx { HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic Throw(Dynamic inDynamic); }
+namespace hx { HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic Rethrow(Dynamic inDynamic); }
+namespace hx { HXCPP_EXTERN_CLASS_ATTRIBUTES void CriticalError(const String &inError, bool inAllowFixup=false); }
+namespace hx { HXCPP_EXTERN_CLASS_ATTRIBUTES void NullReference(const char *type, bool allowFixup); }
+namespace hx { extern String sNone[]; }
+void __hxcpp_check_overflow(int inVal);
+
+namespace hx
+{
+class MarkContext;
+
+
+class VisitContext
+{
+public:
+ virtual void visitObject(hx::Object **ioPtr)=0;
+ virtual void visitAlloc(void **ioPtr)=0;
+};
+
+typedef ::cpp::Variant Val;
+
+#ifdef HXCPP_GC_GENERATIONAL
+ #define HXCPP_GC_NURSERY
+#endif
+
+
+//#define HXCPP_COMBINE_STRINGS
+
+enum PropertyAccessMode
+{
+ paccNever = 0,
+ paccDynamic = 1,
+ paccAlways = 2,
+};
+typedef PropertyAccessMode PropertyAccess;
+#define HX_PROP_NEVER hx::paccNever
+#define HX_PROP_DYNAMIC hx::paccDynamic
+#define HX_PROP_ALWAYS hx::paccAlways
+
+} // end namespace hx
+
+#define HX_COMMA ,
+
+
+// The order of these includes has been chosen to minimize forward declarations.
+// You should not include the individual files, just this one.
+
+// First time ...
+#include <hx/Macros.h>
+#include <cpp/Variant.h>
+#include <hx/ErrorCodes.h>
+#include <hx/GC.h>
+#include <hx/StackContext.h>
+#include "null.h"
+#include <hx/Object.h>
+#include "hxString.h"
+#include "Dynamic.h"
+#include <cpp/CppInt32__.h>
+// This needs to "see" other declarations ...
+#include <hx/GcTypeInference.h>
+#include <hx/FieldRef.h>
+#include "Array.h"
+#include <hx/Anon.h>
+#include <hx/Class.h>
+#include "Enum.h"
+#include <hx/Interface.h>
+#include <hx/Telemetry.h>
+#if defined(__OBJC__) && defined(HXCPP_OBJC)
+ #include <hx/ObjcHelpers.h>
+#endif
+#include <hx/StdLibs.h>
+#include <cpp/Pointer.h>
+#include <hx/Native.h>
+#include <hx/Operators.h>
+#include <hx/Functions.h>
+// second time ...
+#include <cpp/Variant.h>
+#include <hx/Debug.h>
+#include <hx/Boot.h>
+#include <hx/Undefine.h>
+#include <hx/LessThanEq.h>
+
+#endif
+
diff --git a/Sources/c_snikket/iinclude/include/Date.h b/Sources/c_snikket/iinclude/include/Date.h
new file mode 100644
index 0000000..370b920
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/Date.h
@@ -0,0 +1,95 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_Date
+#define INCLUDED_Date
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_8e4589df03e4f3cc_26_new)
+HX_DECLARE_CLASS0(Date)
+
+
+
+class HXCPP_CLASS_ATTRIBUTES Date_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Date_obj OBJ_;
+ Date_obj();
+
+ public:
+ enum { _hx_ClassId = 0x018f7872 };
+
+ void __construct(int year,int month,int day,int hour,int min,int sec);
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="Date")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"Date"); }
+
+ inline static ::hx::ObjectPtr< Date_obj > __new(int year,int month,int day,int hour,int min,int sec) {
+ ::hx::ObjectPtr< Date_obj > __this = new Date_obj();
+ __this->__construct(year,month,day,hour,min,sec);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Date_obj > __alloc(::hx::Ctx *_hx_ctx,int year,int month,int day,int hour,int min,int sec) {
+ Date_obj *__this = (Date_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Date_obj), false, "Date"));
+ *(void **)__this = Date_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_8e4589df03e4f3cc_26_new)
+HXDLIN( 26) ( ( ::Date)(__this) )->mSeconds = ::__hxcpp_new_date(year,month,day,hour,min,sec);
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Date_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Date",4e,82,3c,2d); }
+
+ static ::Date now();
+ static ::Dynamic now_dyn();
+
+ static ::Date fromTime(Float t);
+ static ::Dynamic fromTime_dyn();
+
+ Float mSeconds;
+ Float getTime();
+ ::Dynamic getTime_dyn();
+
+ int getUTCHours();
+ ::Dynamic getUTCHours_dyn();
+
+ int getUTCMinutes();
+ ::Dynamic getUTCMinutes_dyn();
+
+ int getUTCSeconds();
+ ::Dynamic getUTCSeconds_dyn();
+
+ int getUTCFullYear();
+ ::Dynamic getUTCFullYear_dyn();
+
+ int getUTCMonth();
+ ::Dynamic getUTCMonth_dyn();
+
+ int getUTCDate();
+ ::Dynamic getUTCDate_dyn();
+
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+};
+
+
+#endif /* INCLUDED_Date */
diff --git a/Sources/c_snikket/iinclude/include/EReg.h b/Sources/c_snikket/iinclude/include/EReg.h
new file mode 100644
index 0000000..9cf6865
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/EReg.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_EReg
+#define INCLUDED_EReg
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(EReg)
+
+
+
+class HXCPP_CLASS_ATTRIBUTES EReg_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef EReg_obj OBJ_;
+ EReg_obj();
+
+ public:
+ enum { _hx_ClassId = 0x022d4033 };
+
+ void __construct(::String r,::String opt);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="EReg")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"EReg"); }
+ static ::hx::ObjectPtr< EReg_obj > __new(::String r,::String opt);
+ static ::hx::ObjectPtr< EReg_obj > __alloc(::hx::Ctx *_hx_ctx,::String r,::String opt);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~EReg_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("EReg",0f,4a,da,2d); }
+
+ ::Dynamic r;
+ ::String last;
+ bool global;
+ bool match(::String s);
+ ::Dynamic match_dyn();
+
+ ::String matched(int n);
+ ::Dynamic matched_dyn();
+
+ ::Dynamic matchedPos();
+ ::Dynamic matchedPos_dyn();
+
+ bool matchSub(::String s,int pos,::hx::Null< int > len);
+ ::Dynamic matchSub_dyn();
+
+ ::String replace(::String s,::String by);
+ ::Dynamic replace_dyn();
+
+ ::String map(::String s, ::Dynamic f);
+ ::Dynamic map_dyn();
+
+};
+
+
+#endif /* INCLUDED_EReg */
diff --git a/Sources/c_snikket/iinclude/include/HaxeCBridge.h b/Sources/c_snikket/iinclude/include/HaxeCBridge.h
new file mode 100644
index 0000000..6c32ea0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/HaxeCBridge.h
@@ -0,0 +1,44 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_HaxeCBridge
+#define INCLUDED_HaxeCBridge
+
+#ifndef HXCPP_H
+#ifdef HXCPP_API_LEVEL
+#include <hxcpp.h>
+#else
+#include <hx/Native.h>
+#endif
+#endif
+
+#ifndef INCLUDED_cbce7ceea2d0df24
+#define INCLUDED_cbce7ceea2d0df24
+#include "HaxeCBridge.h"
+#endif
+
+
+
+class HXCPP_CLASS_ATTRIBUTES HaxeCBridge
+{
+ public:
+ static void mainThreadInit(::cpp::Function< bool () > isMainThreadCb);
+
+ static void mainThreadRun(::cpp::Function< void () > processNativeCalls,::cpp::Function< void (const char*) > onUnhandledException);
+
+ static void** retainHaxeArray(::cpp::VirtualArray haxeArray);
+
+ static void* retainHaxeObject( ::Dynamic haxeObject);
+
+ static const char* retainHaxeString(::String haxeString);
+
+ static void releaseHaxePtr(void * haxePtr);
+
+ static bool isMainThread();
+
+ static void endMainThread(bool waitOnScheduledEvents);
+
+ static void wakeMainThread();
+
+};
+
+
+#endif /* INCLUDED_HaxeCBridge */
diff --git a/Sources/c_snikket/iinclude/include/Lambda.h b/Sources/c_snikket/iinclude/include/Lambda.h
new file mode 100644
index 0000000..43b4ef0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/Lambda.h
@@ -0,0 +1,76 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_Lambda
+#define INCLUDED_Lambda
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(Lambda)
+
+
+
+class HXCPP_CLASS_ATTRIBUTES Lambda_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Lambda_obj OBJ_;
+ Lambda_obj();
+
+ public:
+ enum { _hx_ClassId = 0x4cec6e4b };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="Lambda")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"Lambda"); }
+
+ inline static ::hx::ObjectPtr< Lambda_obj > __new() {
+ ::hx::ObjectPtr< Lambda_obj > __this = new Lambda_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Lambda_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Lambda_obj *__this = (Lambda_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Lambda_obj), false, "Lambda"));
+ *(void **)__this = Lambda_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Lambda_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Lambda",27,a7,54,85); }
+
+ static ::cpp::VirtualArray array( ::Dynamic it);
+ static ::Dynamic array_dyn();
+
+ static bool exists( ::Dynamic it, ::Dynamic f);
+ static ::Dynamic exists_dyn();
+
+ static ::cpp::VirtualArray filter( ::Dynamic it, ::Dynamic f);
+ static ::Dynamic filter_dyn();
+
+ static ::Dynamic fold( ::Dynamic it, ::Dynamic f, ::Dynamic first);
+ static ::Dynamic fold_dyn();
+
+ static bool empty( ::Dynamic it);
+ static ::Dynamic empty_dyn();
+
+ static ::Dynamic find( ::Dynamic it, ::Dynamic f);
+ static ::Dynamic find_dyn();
+
+ static int findIndex( ::Dynamic it, ::Dynamic f);
+ static ::Dynamic findIndex_dyn();
+
+};
+
+
+#endif /* INCLUDED_Lambda */
diff --git a/Sources/c_snikket/iinclude/include/Reflect.h b/Sources/c_snikket/iinclude/include/Reflect.h
new file mode 100644
index 0000000..87d8d52
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/Reflect.h
@@ -0,0 +1,91 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_Reflect
+#define INCLUDED_Reflect
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(Reflect)
+
+
+
+class HXCPP_CLASS_ATTRIBUTES Reflect_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Reflect_obj OBJ_;
+ Reflect_obj();
+
+ public:
+ enum { _hx_ClassId = 0x769a515d };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="Reflect")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"Reflect"); }
+
+ inline static ::hx::ObjectPtr< Reflect_obj > __new() {
+ ::hx::ObjectPtr< Reflect_obj > __this = new Reflect_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Reflect_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Reflect_obj *__this = (Reflect_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Reflect_obj), false, "Reflect"));
+ *(void **)__this = Reflect_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Reflect_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Reflect",1d,ac,7a,b6); }
+
+ static bool hasField( ::Dynamic o,::String field);
+ static ::Dynamic hasField_dyn();
+
+ static ::Dynamic field( ::Dynamic o,::String field);
+ static ::Dynamic field_dyn();
+
+ static void setField( ::Dynamic o,::String field, ::Dynamic value);
+ static ::Dynamic setField_dyn();
+
+ static ::Dynamic getProperty( ::Dynamic o,::String field);
+ static ::Dynamic getProperty_dyn();
+
+ static ::Dynamic callMethod( ::Dynamic o, ::Dynamic func,::cpp::VirtualArray args);
+ static ::Dynamic callMethod_dyn();
+
+ static ::Array< ::String > fields( ::Dynamic o);
+ static ::Dynamic fields_dyn();
+
+ static bool isFunction( ::Dynamic f);
+ static ::Dynamic isFunction_dyn();
+
+ static int compare( ::Dynamic a, ::Dynamic b);
+ static ::Dynamic compare_dyn();
+
+ static bool compareMethods( ::Dynamic f1, ::Dynamic f2);
+ static ::Dynamic compareMethods_dyn();
+
+ static bool isObject( ::Dynamic v);
+ static ::Dynamic isObject_dyn();
+
+ static bool isEnumValue( ::Dynamic v);
+ static ::Dynamic isEnumValue_dyn();
+
+ static ::Dynamic copy( ::Dynamic o);
+ static ::Dynamic copy_dyn();
+
+};
+
+
+#endif /* INCLUDED_Reflect */
diff --git a/Sources/c_snikket/iinclude/include/Std.h b/Sources/c_snikket/iinclude/include/Std.h
new file mode 100644
index 0000000..c837022
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/Std.h
@@ -0,0 +1,83 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_Std
+#define INCLUDED_Std
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(Std)
+
+
+
+class HXCPP_CLASS_ATTRIBUTES Std_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Std_obj OBJ_;
+ Std_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7ee3a517 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="Std")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"Std"); }
+
+ inline static ::hx::ObjectPtr< Std_obj > __new() {
+ ::hx::ObjectPtr< Std_obj > __this = new Std_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Std_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Std_obj *__this = (Std_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Std_obj), false, "Std"));
+ *(void **)__this = Std_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Std_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Std",83,60,3f,00); }
+
+ static bool is( ::Dynamic v, ::Dynamic t);
+ static ::Dynamic is_dyn();
+
+ static bool isOfType( ::Dynamic v, ::Dynamic t);
+ static ::Dynamic isOfType_dyn();
+
+ static ::Dynamic downcast( ::Dynamic value,::hx::Class c);
+ static ::Dynamic downcast_dyn();
+
+ static ::Dynamic instance( ::Dynamic value,::hx::Class c);
+ static ::Dynamic instance_dyn();
+
+ static ::String string( ::Dynamic s);
+ static ::Dynamic string_dyn();
+
+ static int _hx_int(Float x);
+ static ::Dynamic _hx_int_dyn();
+
+ static ::Dynamic parseInt(::String x);
+ static ::Dynamic parseInt_dyn();
+
+ static Float parseFloat(::String x);
+ static ::Dynamic parseFloat_dyn();
+
+ static int random(int x);
+ static ::Dynamic random_dyn();
+
+ static inline String string(String &s) { return s; }
+};
+
+
+#endif /* INCLUDED_Std */
diff --git a/Sources/c_snikket/iinclude/include/StringBuf.h b/Sources/c_snikket/iinclude/include/StringBuf.h
new file mode 100644
index 0000000..575e391
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/StringBuf.h
@@ -0,0 +1,78 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_StringBuf
+#define INCLUDED_StringBuf
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_8b63e6eaf513c097_35_new)
+HX_DECLARE_CLASS0(StringBuf)
+
+
+
+class HXCPP_CLASS_ATTRIBUTES StringBuf_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef StringBuf_obj OBJ_;
+ StringBuf_obj();
+
+ public:
+ enum { _hx_ClassId = 0x2cc74002 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="StringBuf")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"StringBuf"); }
+
+ inline static ::hx::ObjectPtr< StringBuf_obj > __new() {
+ ::hx::ObjectPtr< StringBuf_obj > __this = new StringBuf_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< StringBuf_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ StringBuf_obj *__this = (StringBuf_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(StringBuf_obj), true, "StringBuf"));
+ *(void **)__this = StringBuf_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_8b63e6eaf513c097_35_new)
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~StringBuf_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("StringBuf",c2,ca,83,69); }
+
+ ::Array< ::String > b;
+ ::Array< char > charBuf;
+ ::String charBufAsString();
+ ::Dynamic charBufAsString_dyn();
+
+ void flush();
+ ::Dynamic flush_dyn();
+
+ int get_length();
+ ::Dynamic get_length_dyn();
+
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+};
+
+
+#endif /* INCLUDED_StringBuf */
diff --git a/Sources/c_snikket/iinclude/include/StringTools.h b/Sources/c_snikket/iinclude/include/StringTools.h
new file mode 100644
index 0000000..039cb8b
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/StringTools.h
@@ -0,0 +1,88 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_StringTools
+#define INCLUDED_StringTools
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(StringTools)
+
+
+
+class HXCPP_CLASS_ATTRIBUTES StringTools_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef StringTools_obj OBJ_;
+ StringTools_obj();
+
+ public:
+ enum { _hx_ClassId = 0x084f186e };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="StringTools")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"StringTools"); }
+
+ inline static ::hx::ObjectPtr< StringTools_obj > __new() {
+ ::hx::ObjectPtr< StringTools_obj > __this = new StringTools_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< StringTools_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ StringTools_obj *__this = (StringTools_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(StringTools_obj), false, "StringTools"));
+ *(void **)__this = StringTools_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~StringTools_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("StringTools",6a,db,63,03); }
+
+ static ::String urlEncode(::String s);
+ static ::Dynamic urlEncode_dyn();
+
+ static ::String htmlEscape(::String s, ::Dynamic quotes);
+ static ::Dynamic htmlEscape_dyn();
+
+ static bool startsWith(::String s,::String start);
+ static ::Dynamic startsWith_dyn();
+
+ static bool endsWith(::String s,::String end);
+ static ::Dynamic endsWith_dyn();
+
+ static bool isSpace(::String s,int pos);
+ static ::Dynamic isSpace_dyn();
+
+ static ::String ltrim(::String s);
+ static ::Dynamic ltrim_dyn();
+
+ static ::String rtrim(::String s);
+ static ::Dynamic rtrim_dyn();
+
+ static ::String trim(::String s);
+ static ::Dynamic trim_dyn();
+
+ static ::String lpad(::String s,::String c,int l);
+ static ::Dynamic lpad_dyn();
+
+ static ::String replace(::String s,::String sub,::String by);
+ static ::Dynamic replace_dyn();
+
+ static ::String hex(int n, ::Dynamic digits);
+ static ::Dynamic hex_dyn();
+
+};
+
+
+#endif /* INCLUDED_StringTools */
diff --git a/Sources/c_snikket/iinclude/include/Sys.h b/Sources/c_snikket/iinclude/include/Sys.h
new file mode 100644
index 0000000..4834a8a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/Sys.h
@@ -0,0 +1,67 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_Sys
+#define INCLUDED_Sys
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(Sys)
+
+
+
+class HXCPP_CLASS_ATTRIBUTES Sys_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Sys_obj OBJ_;
+ Sys_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7ee3a981 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="Sys")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"Sys"); }
+
+ inline static ::hx::ObjectPtr< Sys_obj > __new() {
+ ::hx::ObjectPtr< Sys_obj > __this = new Sys_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Sys_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Sys_obj *__this = (Sys_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Sys_obj), false, "Sys"));
+ *(void **)__this = Sys_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Sys_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Sys",ed,64,3f,00); }
+
+ static ::String getEnv(::String s);
+ static ::Dynamic getEnv_dyn();
+
+ static ::String getCwd();
+ static ::Dynamic getCwd_dyn();
+
+ static ::String systemName();
+ static ::Dynamic systemName_dyn();
+
+ static Float time();
+ static ::Dynamic time_dyn();
+
+};
+
+
+#endif /* INCLUDED_Sys */
diff --git a/Sources/c_snikket/iinclude/include/Type.h b/Sources/c_snikket/iinclude/include/Type.h
new file mode 100644
index 0000000..4c1fe40
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/Type.h
@@ -0,0 +1,71 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_Type
+#define INCLUDED_Type
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(Type)
+HX_DECLARE_CLASS0(ValueType)
+
+
+
+class HXCPP_CLASS_ATTRIBUTES Type_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Type_obj OBJ_;
+ Type_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0c3514fe };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="Type")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"Type"); }
+
+ inline static ::hx::ObjectPtr< Type_obj > __new() {
+ ::hx::ObjectPtr< Type_obj > __this = new Type_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Type_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Type_obj *__this = (Type_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Type_obj), false, "Type"));
+ *(void **)__this = Type_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Type_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Type",da,1e,e2,37); }
+
+ static ::hx::Class getClass( ::Dynamic o);
+ static ::Dynamic getClass_dyn();
+
+ static ::String getClassName(::hx::Class c);
+ static ::Dynamic getClassName_dyn();
+
+ static ::Array< ::String > getInstanceFields(::hx::Class c);
+ static ::Dynamic getInstanceFields_dyn();
+
+ static ::ValueType _hx_typeof( ::Dynamic v);
+ static ::Dynamic _hx_typeof_dyn();
+
+ static ::cpp::VirtualArray enumParameters( ::Dynamic e);
+ static ::Dynamic enumParameters_dyn();
+
+};
+
+
+#endif /* INCLUDED_Type */
diff --git a/Sources/c_snikket/iinclude/include/ValueType.h b/Sources/c_snikket/iinclude/include/ValueType.h
new file mode 100644
index 0000000..ce988c6
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/ValueType.h
@@ -0,0 +1,47 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_ValueType
+#define INCLUDED_ValueType
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(ValueType)
+
+
+class ValueType_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef ValueType_obj OBJ_;
+
+ public:
+ ValueType_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("ValueType",ab,8a,60,3b); }
+ ::String __ToString() const { return HX_("ValueType.",23,cb,18,b9) + _hx_tag; }
+
+ static ::ValueType TBool;
+ static inline ::ValueType TBool_dyn() { return TBool; }
+ static ::ValueType TClass(::hx::Class c);
+ static ::Dynamic TClass_dyn();
+ static ::ValueType TEnum(::hx::Class e);
+ static ::Dynamic TEnum_dyn();
+ static ::ValueType TFloat;
+ static inline ::ValueType TFloat_dyn() { return TFloat; }
+ static ::ValueType TFunction;
+ static inline ::ValueType TFunction_dyn() { return TFunction; }
+ static ::ValueType TInt;
+ static inline ::ValueType TInt_dyn() { return TInt; }
+ static ::ValueType TNull;
+ static inline ::ValueType TNull_dyn() { return TNull; }
+ static ::ValueType TObject;
+ static inline ::ValueType TObject_dyn() { return TObject; }
+ static ::ValueType TUnknown;
+ static inline ::ValueType TUnknown_dyn() { return TUnknown; }
+};
+
+
+#endif /* INCLUDED_ValueType */
diff --git a/Sources/c_snikket/iinclude/include/Xml.h b/Sources/c_snikket/iinclude/include/Xml.h
new file mode 100644
index 0000000..2b2f152
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/Xml.h
@@ -0,0 +1,114 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_Xml
+#define INCLUDED_Xml
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(Xml)
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+
+
+
+class HXCPP_CLASS_ATTRIBUTES Xml_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Xml_obj OBJ_;
+ Xml_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7ee76a4b };
+
+ void __construct(int nodeType);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="Xml")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"Xml"); }
+ static ::hx::ObjectPtr< Xml_obj > __new(int nodeType);
+ static ::hx::ObjectPtr< Xml_obj > __alloc(::hx::Ctx *_hx_ctx,int nodeType);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Xml_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Xml",b7,25,43,00); }
+
+ static void __boot();
+ static int Element;
+ static int PCData;
+ static int CData;
+ static int Comment;
+ static int DocType;
+ static int ProcessingInstruction;
+ static int Document;
+ static ::Xml parse(::String str);
+ static ::Dynamic parse_dyn();
+
+ static ::Xml createElement(::String name);
+ static ::Dynamic createElement_dyn();
+
+ static ::Xml createPCData(::String data);
+ static ::Dynamic createPCData_dyn();
+
+ static ::Xml createCData(::String data);
+ static ::Dynamic createCData_dyn();
+
+ static ::Xml createComment(::String data);
+ static ::Dynamic createComment_dyn();
+
+ static ::Xml createDocType(::String data);
+ static ::Dynamic createDocType_dyn();
+
+ static ::Xml createProcessingInstruction(::String data);
+ static ::Dynamic createProcessingInstruction_dyn();
+
+ static ::Xml createDocument();
+ static ::Dynamic createDocument_dyn();
+
+ int nodeType;
+ ::String nodeName;
+ ::String nodeValue;
+ ::Xml parent;
+ ::Array< ::Dynamic> children;
+ ::haxe::ds::StringMap attributeMap;
+ ::String get(::String att);
+ ::Dynamic get_dyn();
+
+ void set(::String att,::String value);
+ ::Dynamic set_dyn();
+
+ bool exists(::String att);
+ ::Dynamic exists_dyn();
+
+ ::Dynamic attributes();
+ ::Dynamic attributes_dyn();
+
+ ::Xml firstElement();
+ ::Dynamic firstElement_dyn();
+
+ void addChild( ::Xml x);
+ ::Dynamic addChild_dyn();
+
+ bool removeChild( ::Xml x);
+ ::Dynamic removeChild_dyn();
+
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+};
+
+
+#endif /* INCLUDED_Xml */
diff --git a/Sources/c_snikket/iinclude/include/_HaxeCBridge/Int64Map_Impl_.h b/Sources/c_snikket/iinclude/include/_HaxeCBridge/Int64Map_Impl_.h
new file mode 100644
index 0000000..cf001a9
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/_HaxeCBridge/Int64Map_Impl_.h
@@ -0,0 +1,62 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED__HaxeCBridge_Int64Map_Impl_
+#define INCLUDED__HaxeCBridge_Int64Map_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(_HaxeCBridge,Int64Map_Impl_)
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,IntMap)
+
+namespace _HaxeCBridge{
+
+
+class HXCPP_CLASS_ATTRIBUTES Int64Map_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Int64Map_Impl__obj OBJ_;
+ Int64Map_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x09ceba9e };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="_HaxeCBridge.Int64Map_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"_HaxeCBridge.Int64Map_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Int64Map_Impl__obj > __new() {
+ ::hx::ObjectPtr< Int64Map_Impl__obj > __this = new Int64Map_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Int64Map_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Int64Map_Impl__obj *__this = (Int64Map_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Int64Map_Impl__obj), false, "_HaxeCBridge.Int64Map_Impl_"));
+ *(void **)__this = Int64Map_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Int64Map_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Int64Map_Impl_",af,5c,92,21); }
+
+ static ::haxe::ds::IntMap _new();
+ static ::Dynamic _new_dyn();
+
+};
+
+} // end namespace _HaxeCBridge
+
+#endif /* INCLUDED__HaxeCBridge_Int64Map_Impl_ */
diff --git a/Sources/c_snikket/iinclude/include/_HaxeCBridge/Internal.h b/Sources/c_snikket/iinclude/include/_HaxeCBridge/Internal.h
new file mode 100644
index 0000000..a2a1fae
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/_HaxeCBridge/Internal.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED__HaxeCBridge_Internal
+#define INCLUDED__HaxeCBridge_Internal
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(_HaxeCBridge,Internal)
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,IntMap)
+HX_DECLARE_CLASS2(sys,thread,Lock)
+
+namespace _HaxeCBridge{
+
+
+class HXCPP_CLASS_ATTRIBUTES Internal_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Internal_obj OBJ_;
+ Internal_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0f2147a8 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="_HaxeCBridge.Internal")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"_HaxeCBridge.Internal"); }
+
+ inline static ::hx::ObjectPtr< Internal_obj > __new() {
+ ::hx::ObjectPtr< Internal_obj > __this = new Internal_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Internal_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Internal_obj *__this = (Internal_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Internal_obj), false, "_HaxeCBridge.Internal"));
+ *(void **)__this = Internal_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Internal_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Internal",5d,23,28,02); }
+
+ static void __boot();
+ static ::cpp::Function< bool () > isMainThreadCb;
+ static Dynamic isMainThreadCb_dyn() { return isMainThreadCb;}
+ static ::sys::thread::Lock mainThreadWaitLock;
+ static bool mainThreadLoopActive;
+ static bool mainThreadEndIfNoPending;
+ static ::haxe::ds::IntMap gcRetainMap;
+};
+
+} // end namespace _HaxeCBridge
+
+#endif /* INCLUDED__HaxeCBridge_Internal */
diff --git a/Sources/c_snikket/iinclude/include/_UnicodeString/UnicodeString_Impl_.h b/Sources/c_snikket/iinclude/include/_UnicodeString/UnicodeString_Impl_.h
new file mode 100644
index 0000000..eb2190b
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/_UnicodeString/UnicodeString_Impl_.h
@@ -0,0 +1,66 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED__UnicodeString_UnicodeString_Impl_
+#define INCLUDED__UnicodeString_UnicodeString_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(_UnicodeString,UnicodeString_Impl_)
+
+namespace _UnicodeString{
+
+
+class HXCPP_CLASS_ATTRIBUTES UnicodeString_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef UnicodeString_Impl__obj OBJ_;
+ UnicodeString_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x699a1cff };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="_UnicodeString.UnicodeString_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"_UnicodeString.UnicodeString_Impl_"); }
+
+ inline static ::hx::ObjectPtr< UnicodeString_Impl__obj > __new() {
+ ::hx::ObjectPtr< UnicodeString_Impl__obj > __this = new UnicodeString_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< UnicodeString_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ UnicodeString_Impl__obj *__this = (UnicodeString_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(UnicodeString_Impl__obj), false, "_UnicodeString.UnicodeString_Impl_"));
+ *(void **)__this = UnicodeString_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~UnicodeString_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("UnicodeString_Impl_",ce,64,09,f3); }
+
+ static ::String charAt(::String this1,int index);
+ static ::Dynamic charAt_dyn();
+
+ static ::String substr(::String this1,int pos, ::Dynamic len);
+ static ::Dynamic substr_dyn();
+
+ static int get_length(::String this1);
+ static ::Dynamic get_length_dyn();
+
+};
+
+} // end namespace _UnicodeString
+
+#endif /* INCLUDED__UnicodeString_UnicodeString_Impl_ */
diff --git a/Sources/c_snikket/iinclude/include/_Xml/XmlType_Impl_.h b/Sources/c_snikket/iinclude/include/_Xml/XmlType_Impl_.h
new file mode 100644
index 0000000..43c8ecc
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/_Xml/XmlType_Impl_.h
@@ -0,0 +1,60 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED__Xml_XmlType_Impl_
+#define INCLUDED__Xml_XmlType_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(_Xml,XmlType_Impl_)
+
+namespace _Xml{
+
+
+class HXCPP_CLASS_ATTRIBUTES XmlType_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef XmlType_Impl__obj OBJ_;
+ XmlType_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x29df0a39 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="_Xml.XmlType_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"_Xml.XmlType_Impl_"); }
+
+ inline static ::hx::ObjectPtr< XmlType_Impl__obj > __new() {
+ ::hx::ObjectPtr< XmlType_Impl__obj > __this = new XmlType_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< XmlType_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ XmlType_Impl__obj *__this = (XmlType_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(XmlType_Impl__obj), false, "_Xml.XmlType_Impl_"));
+ *(void **)__this = XmlType_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~XmlType_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("XmlType_Impl_",71,0b,9f,dd); }
+
+ static ::String toString(int this1);
+ static ::Dynamic toString_dyn();
+
+};
+
+} // end namespace _Xml
+
+#endif /* INCLUDED__Xml_XmlType_Impl_ */
diff --git a/Sources/c_snikket/iinclude/include/cpp/Lib.h b/Sources/c_snikket/iinclude/include/cpp/Lib.h
new file mode 100644
index 0000000..38d98b7
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/cpp/Lib.h
@@ -0,0 +1,56 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_cpp_Lib
+#define INCLUDED_cpp_Lib
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(cpp,Lib)
+
+namespace cpp{
+
+
+class HXCPP_CLASS_ATTRIBUTES Lib_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Lib_obj OBJ_;
+ Lib_obj();
+
+ public:
+ enum { _hx_ClassId = 0x561f6486 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="cpp.Lib")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"cpp.Lib"); }
+
+ inline static ::hx::ObjectPtr< Lib_obj > __new() {
+ ::hx::ObjectPtr< Lib_obj > __this = new Lib_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Lib_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Lib_obj *__this = (Lib_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Lib_obj), false, "cpp.Lib"));
+ *(void **)__this = Lib_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Lib_obj();
+
+ HX_DO_RTTI_ALL;
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Lib",25,07,3a,00); }
+
+};
+
+} // end namespace cpp
+
+#endif /* INCLUDED_cpp_Lib */
diff --git a/Sources/c_snikket/iinclude/include/datetime/_DateTime/DateTime_Impl_.h b/Sources/c_snikket/iinclude/include/datetime/_DateTime/DateTime_Impl_.h
new file mode 100644
index 0000000..94bc87f
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/datetime/_DateTime/DateTime_Impl_.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_datetime__DateTime_DateTime_Impl_
+#define INCLUDED_datetime__DateTime_DateTime_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(datetime,_DateTime,DateTime_Impl_)
+
+namespace datetime{
+namespace _DateTime{
+
+
+class HXCPP_CLASS_ATTRIBUTES DateTime_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef DateTime_Impl__obj OBJ_;
+ DateTime_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x3ae93836 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="datetime._DateTime.DateTime_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"datetime._DateTime.DateTime_Impl_"); }
+
+ inline static ::hx::ObjectPtr< DateTime_Impl__obj > __new() {
+ ::hx::ObjectPtr< DateTime_Impl__obj > __this = new DateTime_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< DateTime_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ DateTime_Impl__obj *__this = (DateTime_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(DateTime_Impl__obj), false, "datetime._DateTime.DateTime_Impl_"));
+ *(void **)__this = DateTime_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~DateTime_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("DateTime_Impl_",5b,c4,e6,72); }
+
+ static int getYear(Float this1);
+ static ::Dynamic getYear_dyn();
+
+ static Float yearStart(Float this1);
+ static ::Dynamic yearStart_dyn();
+
+ static bool isLeapYear(Float this1);
+ static ::Dynamic isLeapYear_dyn();
+
+};
+
+} // end namespace datetime
+} // end namespace _DateTime
+
+#endif /* INCLUDED_datetime__DateTime_DateTime_Impl_ */
diff --git a/Sources/c_snikket/iinclude/include/datetime/_DateTimeInterval/DateTimeInterval_Impl_.h b/Sources/c_snikket/iinclude/include/datetime/_DateTimeInterval/DateTimeInterval_Impl_.h
new file mode 100644
index 0000000..2d7ed1a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/datetime/_DateTimeInterval/DateTimeInterval_Impl_.h
@@ -0,0 +1,63 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_datetime__DateTimeInterval_DateTimeInterval_Impl_
+#define INCLUDED_datetime__DateTimeInterval_DateTimeInterval_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(datetime,_DateTimeInterval,DateTimeInterval_Impl_)
+HX_DECLARE_CLASS2(datetime,cores,DateTimeIntervalCore)
+
+namespace datetime{
+namespace _DateTimeInterval{
+
+
+class HXCPP_CLASS_ATTRIBUTES DateTimeInterval_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef DateTimeInterval_Impl__obj OBJ_;
+ DateTimeInterval_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x35e51cc0 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="datetime._DateTimeInterval.DateTimeInterval_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"datetime._DateTimeInterval.DateTimeInterval_Impl_"); }
+
+ inline static ::hx::ObjectPtr< DateTimeInterval_Impl__obj > __new() {
+ ::hx::ObjectPtr< DateTimeInterval_Impl__obj > __this = new DateTimeInterval_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< DateTimeInterval_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ DateTimeInterval_Impl__obj *__this = (DateTimeInterval_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(DateTimeInterval_Impl__obj), false, "datetime._DateTimeInterval.DateTimeInterval_Impl_"));
+ *(void **)__this = DateTimeInterval_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~DateTimeInterval_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("DateTimeInterval_Impl_",80,46,d9,2e); }
+
+ static ::datetime::cores::DateTimeIntervalCore create(Float begin,Float end);
+ static ::Dynamic create_dyn();
+
+};
+
+} // end namespace datetime
+} // end namespace _DateTimeInterval
+
+#endif /* INCLUDED_datetime__DateTimeInterval_DateTimeInterval_Impl_ */
diff --git a/Sources/c_snikket/iinclude/include/datetime/cores/DateTimeIntervalCore.h b/Sources/c_snikket/iinclude/include/datetime/cores/DateTimeIntervalCore.h
new file mode 100644
index 0000000..8cfdba1
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/datetime/cores/DateTimeIntervalCore.h
@@ -0,0 +1,92 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_datetime_cores_DateTimeIntervalCore
+#define INCLUDED_datetime_cores_DateTimeIntervalCore
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(datetime,cores,DateTimeIntervalCore)
+
+namespace datetime{
+namespace cores{
+
+
+class HXCPP_CLASS_ATTRIBUTES DateTimeIntervalCore_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef DateTimeIntervalCore_obj OBJ_;
+ DateTimeIntervalCore_obj();
+
+ public:
+ enum { _hx_ClassId = 0x2dc1c9d4 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="datetime.cores.DateTimeIntervalCore")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"datetime.cores.DateTimeIntervalCore"); }
+ static ::hx::ObjectPtr< DateTimeIntervalCore_obj > __new();
+ static ::hx::ObjectPtr< DateTimeIntervalCore_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~DateTimeIntervalCore_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("DateTimeIntervalCore",5f,bb,ed,3d); }
+
+ bool negative;
+ Float begin;
+ Float end;
+ int years;
+ int months;
+ int days;
+ int hours;
+ int minutes;
+ int seconds;
+ int getYears();
+ ::Dynamic getYears_dyn();
+
+ int getMonths();
+ ::Dynamic getMonths_dyn();
+
+ int getTotalMonths();
+ ::Dynamic getTotalMonths_dyn();
+
+ int getDays();
+ ::Dynamic getDays_dyn();
+
+ int getTotalDays();
+ ::Dynamic getTotalDays_dyn();
+
+ int getHours();
+ ::Dynamic getHours_dyn();
+
+ int getTotalHours();
+ ::Dynamic getTotalHours_dyn();
+
+ int getMinutes();
+ ::Dynamic getMinutes_dyn();
+
+ int getTotalMinutes();
+ ::Dynamic getTotalMinutes_dyn();
+
+ int getSeconds();
+ ::Dynamic getSeconds_dyn();
+
+ Float getTotalSeconds();
+ ::Dynamic getTotalSeconds_dyn();
+
+};
+
+} // end namespace datetime
+} // end namespace cores
+
+#endif /* INCLUDED_datetime_cores_DateTimeIntervalCore */
diff --git a/Sources/c_snikket/iinclude/include/datetime/utils/DateTimeIntervalUtils.h b/Sources/c_snikket/iinclude/include/datetime/utils/DateTimeIntervalUtils.h
new file mode 100644
index 0000000..f6bc00b
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/datetime/utils/DateTimeIntervalUtils.h
@@ -0,0 +1,63 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_datetime_utils_DateTimeIntervalUtils
+#define INCLUDED_datetime_utils_DateTimeIntervalUtils
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(datetime,cores,DateTimeIntervalCore)
+HX_DECLARE_CLASS2(datetime,utils,DateTimeIntervalUtils)
+
+namespace datetime{
+namespace utils{
+
+
+class HXCPP_CLASS_ATTRIBUTES DateTimeIntervalUtils_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef DateTimeIntervalUtils_obj OBJ_;
+ DateTimeIntervalUtils_obj();
+
+ public:
+ enum { _hx_ClassId = 0x144eafbf };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="datetime.utils.DateTimeIntervalUtils")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"datetime.utils.DateTimeIntervalUtils"); }
+
+ inline static ::hx::ObjectPtr< DateTimeIntervalUtils_obj > __new() {
+ ::hx::ObjectPtr< DateTimeIntervalUtils_obj > __this = new DateTimeIntervalUtils_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< DateTimeIntervalUtils_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ DateTimeIntervalUtils_obj *__this = (DateTimeIntervalUtils_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(DateTimeIntervalUtils_obj), false, "datetime.utils.DateTimeIntervalUtils"));
+ *(void **)__this = DateTimeIntervalUtils_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~DateTimeIntervalUtils_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("DateTimeIntervalUtils",31,ec,93,52); }
+
+ static ::String strftime( ::datetime::cores::DateTimeIntervalCore dti,::String format);
+ static ::Dynamic strftime_dyn();
+
+};
+
+} // end namespace datetime
+} // end namespace utils
+
+#endif /* INCLUDED_datetime_utils_DateTimeIntervalUtils */
diff --git a/Sources/c_snikket/iinclude/include/datetime/utils/DateTimeMonthUtils.h b/Sources/c_snikket/iinclude/include/datetime/utils/DateTimeMonthUtils.h
new file mode 100644
index 0000000..ab9584a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/datetime/utils/DateTimeMonthUtils.h
@@ -0,0 +1,71 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_datetime_utils_DateTimeMonthUtils
+#define INCLUDED_datetime_utils_DateTimeMonthUtils
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(datetime,utils,DateTimeMonthUtils)
+
+namespace datetime{
+namespace utils{
+
+
+class HXCPP_CLASS_ATTRIBUTES DateTimeMonthUtils_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef DateTimeMonthUtils_obj OBJ_;
+ DateTimeMonthUtils_obj();
+
+ public:
+ enum { _hx_ClassId = 0x250427de };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="datetime.utils.DateTimeMonthUtils")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"datetime.utils.DateTimeMonthUtils"); }
+
+ inline static ::hx::ObjectPtr< DateTimeMonthUtils_obj > __new() {
+ ::hx::ObjectPtr< DateTimeMonthUtils_obj > __this = new DateTimeMonthUtils_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< DateTimeMonthUtils_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ DateTimeMonthUtils_obj *__this = (DateTimeMonthUtils_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(DateTimeMonthUtils_obj), false, "datetime.utils.DateTimeMonthUtils"));
+ *(void **)__this = DateTimeMonthUtils_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~DateTimeMonthUtils_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("DateTimeMonthUtils",2c,90,be,68); }
+
+ static int days(int month,::hx::Null< bool > isLeapYear);
+ static ::Dynamic days_dyn();
+
+ static int getMonth(int days,::hx::Null< bool > isLeapYear);
+ static ::Dynamic getMonth_dyn();
+
+ static int getMonthDay(int days,::hx::Null< bool > isLeapYear);
+ static ::Dynamic getMonthDay_dyn();
+
+ static int toSeconds(int month,::hx::Null< bool > isLeapYear);
+ static ::Dynamic toSeconds_dyn();
+
+};
+
+} // end namespace datetime
+} // end namespace utils
+
+#endif /* INCLUDED_datetime_utils_DateTimeMonthUtils */
diff --git a/Sources/c_snikket/iinclude/include/datetime/utils/DateTimeUtils.h b/Sources/c_snikket/iinclude/include/datetime/utils/DateTimeUtils.h
new file mode 100644
index 0000000..b774eb8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/datetime/utils/DateTimeUtils.h
@@ -0,0 +1,71 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_datetime_utils_DateTimeUtils
+#define INCLUDED_datetime_utils_DateTimeUtils
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(datetime,utils,DateTimeUtils)
+
+namespace datetime{
+namespace utils{
+
+
+class HXCPP_CLASS_ATTRIBUTES DateTimeUtils_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef DateTimeUtils_obj OBJ_;
+ DateTimeUtils_obj();
+
+ public:
+ enum { _hx_ClassId = 0x4dd3c90c };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="datetime.utils.DateTimeUtils")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"datetime.utils.DateTimeUtils"); }
+
+ inline static ::hx::ObjectPtr< DateTimeUtils_obj > __new() {
+ ::hx::ObjectPtr< DateTimeUtils_obj > __this = new DateTimeUtils_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< DateTimeUtils_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ DateTimeUtils_obj *__this = (DateTimeUtils_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(DateTimeUtils_obj), false, "datetime.utils.DateTimeUtils"));
+ *(void **)__this = DateTimeUtils_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~DateTimeUtils_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("DateTimeUtils",b6,22,76,b4); }
+
+ static Float fromString(::String str);
+ static ::Dynamic fromString_dyn();
+
+ static Float parse(::String str);
+ static ::Dynamic parse_dyn();
+
+ static Float fromIsoString(::String str);
+ static ::Dynamic fromIsoString_dyn();
+
+ static Float yearToStamp(int year);
+ static ::Dynamic yearToStamp_dyn();
+
+};
+
+} // end namespace datetime
+} // end namespace utils
+
+#endif /* INCLUDED_datetime_utils_DateTimeUtils */
diff --git a/Sources/c_snikket/iinclude/include/haxe/EntryPoint.h b/Sources/c_snikket/iinclude/include/haxe/EntryPoint.h
new file mode 100644
index 0000000..170f0e7
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/EntryPoint.h
@@ -0,0 +1,60 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_EntryPoint
+#define INCLUDED_haxe_EntryPoint
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,EntryPoint)
+
+namespace haxe{
+
+
+class HXCPP_CLASS_ATTRIBUTES EntryPoint_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef EntryPoint_obj OBJ_;
+ EntryPoint_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7dc0c864 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="haxe.EntryPoint")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"haxe.EntryPoint"); }
+
+ inline static ::hx::ObjectPtr< EntryPoint_obj > __new() {
+ ::hx::ObjectPtr< EntryPoint_obj > __this = new EntryPoint_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< EntryPoint_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ EntryPoint_obj *__this = (EntryPoint_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(EntryPoint_obj), false, "haxe.EntryPoint"));
+ *(void **)__this = EntryPoint_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~EntryPoint_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("EntryPoint",9e,d2,23,a2); }
+
+ static void run();
+ static ::Dynamic run_dyn();
+
+};
+
+} // end namespace haxe
+
+#endif /* INCLUDED_haxe_EntryPoint */
diff --git a/Sources/c_snikket/iinclude/include/haxe/Exception.h b/Sources/c_snikket/iinclude/include/haxe/Exception.h
new file mode 100644
index 0000000..5e7cabd
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/Exception.h
@@ -0,0 +1,65 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_Exception
+#define INCLUDED_haxe_Exception
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,Exception)
+
+namespace haxe{
+
+
+class HXCPP_CLASS_ATTRIBUTES Exception_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Exception_obj OBJ_;
+ Exception_obj();
+
+ public:
+ enum { _hx_ClassId = 0x677ddc49 };
+
+ void __construct(::String message, ::haxe::Exception previous, ::Dynamic native);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.Exception")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.Exception"); }
+ static ::hx::ObjectPtr< Exception_obj > __new(::String message, ::haxe::Exception previous, ::Dynamic native);
+ static ::hx::ObjectPtr< Exception_obj > __alloc(::hx::Ctx *_hx_ctx,::String message, ::haxe::Exception previous, ::Dynamic native);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Exception_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Exception",2f,f0,6c,eb); }
+
+ static ::haxe::Exception caught( ::Dynamic value);
+ static ::Dynamic caught_dyn();
+
+ ::String _hx___exceptionMessage;
+ ::Array< ::String > _hx___nativeStack;
+ int _hx___skipStack;
+ ::Dynamic _hx___nativeException;
+ ::haxe::Exception _hx___previousException;
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+ ::String get_message();
+ ::Dynamic get_message_dyn();
+
+};
+
+} // end namespace haxe
+
+#endif /* INCLUDED_haxe_Exception */
diff --git a/Sources/c_snikket/iinclude/include/haxe/IMap.h b/Sources/c_snikket/iinclude/include/haxe/IMap.h
new file mode 100644
index 0000000..b3e5b1a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/IMap.h
@@ -0,0 +1,31 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_IMap
+#define INCLUDED_haxe_IMap
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,IMap)
+
+namespace haxe{
+
+
+class HXCPP_CLASS_ATTRIBUTES IMap_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ ::Dynamic (::hx::Object :: *_hx_get)( ::Dynamic k);
+ static inline ::Dynamic get( ::Dynamic _hx_, ::Dynamic k) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::haxe::IMap_obj *>(_hx_.mPtr->_hx_getInterface(0x09c2bd39)))->_hx_get)(k);
+ }
+ ::Dynamic (::hx::Object :: *_hx_keys)();
+ static inline ::Dynamic keys( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::haxe::IMap_obj *>(_hx_.mPtr->_hx_getInterface(0x09c2bd39)))->_hx_keys)();
+ }
+};
+
+} // end namespace haxe
+
+#endif /* INCLUDED_haxe_IMap */
diff --git a/Sources/c_snikket/iinclude/include/haxe/Log.h b/Sources/c_snikket/iinclude/include/haxe/Log.h
new file mode 100644
index 0000000..86c3163
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/Log.h
@@ -0,0 +1,62 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_Log
+#define INCLUDED_haxe_Log
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,Log)
+
+namespace haxe{
+
+
+class HXCPP_CLASS_ATTRIBUTES Log_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Log_obj OBJ_;
+ Log_obj();
+
+ public:
+ enum { _hx_ClassId = 0x3c235b1a };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="haxe.Log")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"haxe.Log"); }
+
+ inline static ::hx::ObjectPtr< Log_obj > __new() {
+ ::hx::ObjectPtr< Log_obj > __this = new Log_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Log_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Log_obj *__this = (Log_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Log_obj), false, "haxe.Log"));
+ *(void **)__this = Log_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Log_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Log",64,0c,3a,00); }
+
+ static void __boot();
+ static ::Dynamic trace;
+ static inline ::Dynamic &trace_dyn() {return trace; }
+
+};
+
+} // end namespace haxe
+
+#endif /* INCLUDED_haxe_Log */
diff --git a/Sources/c_snikket/iinclude/include/haxe/MainEvent.h b/Sources/c_snikket/iinclude/include/haxe/MainEvent.h
new file mode 100644
index 0000000..472de6e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/MainEvent.h
@@ -0,0 +1,57 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_MainEvent
+#define INCLUDED_haxe_MainEvent
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,MainEvent)
+
+namespace haxe{
+
+
+class HXCPP_CLASS_ATTRIBUTES MainEvent_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef MainEvent_obj OBJ_;
+ MainEvent_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0b5efb53 };
+
+ void __construct( ::Dynamic f,int p);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.MainEvent")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.MainEvent"); }
+ static ::hx::ObjectPtr< MainEvent_obj > __new( ::Dynamic f,int p);
+ static ::hx::ObjectPtr< MainEvent_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic f,int p);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~MainEvent_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("MainEvent",01,71,3b,31); }
+
+ ::Dynamic f;
+ Dynamic f_dyn() { return f;}
+ ::haxe::MainEvent prev;
+ ::haxe::MainEvent next;
+ bool isBlocking;
+ Float nextRun;
+ int priority;
+};
+
+} // end namespace haxe
+
+#endif /* INCLUDED_haxe_MainEvent */
diff --git a/Sources/c_snikket/iinclude/include/haxe/MainLoop.h b/Sources/c_snikket/iinclude/include/haxe/MainLoop.h
new file mode 100644
index 0000000..d8ad31a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/MainLoop.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_MainLoop
+#define INCLUDED_haxe_MainLoop
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,MainEvent)
+HX_DECLARE_CLASS1(haxe,MainLoop)
+
+namespace haxe{
+
+
+class HXCPP_CLASS_ATTRIBUTES MainLoop_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef MainLoop_obj OBJ_;
+ MainLoop_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0c7b74e7 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="haxe.MainLoop")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"haxe.MainLoop"); }
+
+ inline static ::hx::ObjectPtr< MainLoop_obj > __new() {
+ ::hx::ObjectPtr< MainLoop_obj > __this = new MainLoop_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< MainLoop_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ MainLoop_obj *__this = (MainLoop_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(MainLoop_obj), false, "haxe.MainLoop"));
+ *(void **)__this = MainLoop_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~MainLoop_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("MainLoop",5d,d7,eb,79); }
+
+ static ::haxe::MainEvent pending;
+ static bool hasEvents();
+ static ::Dynamic hasEvents_dyn();
+
+ static void sortEvents();
+ static ::Dynamic sortEvents_dyn();
+
+ static Float tick();
+ static ::Dynamic tick_dyn();
+
+};
+
+} // end namespace haxe
+
+#endif /* INCLUDED_haxe_MainLoop */
diff --git a/Sources/c_snikket/iinclude/include/haxe/NativeStackTrace.h b/Sources/c_snikket/iinclude/include/haxe/NativeStackTrace.h
new file mode 100644
index 0000000..dc1054c
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/NativeStackTrace.h
@@ -0,0 +1,66 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_NativeStackTrace
+#define INCLUDED_haxe_NativeStackTrace
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,NativeStackTrace)
+
+namespace haxe{
+
+
+class HXCPP_CLASS_ATTRIBUTES NativeStackTrace_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef NativeStackTrace_obj OBJ_;
+ NativeStackTrace_obj();
+
+ public:
+ enum { _hx_ClassId = 0x3984963e };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="haxe.NativeStackTrace")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"haxe.NativeStackTrace"); }
+
+ inline static ::hx::ObjectPtr< NativeStackTrace_obj > __new() {
+ ::hx::ObjectPtr< NativeStackTrace_obj > __this = new NativeStackTrace_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< NativeStackTrace_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ NativeStackTrace_obj *__this = (NativeStackTrace_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(NativeStackTrace_obj), false, "haxe.NativeStackTrace"));
+ *(void **)__this = NativeStackTrace_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~NativeStackTrace_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("NativeStackTrace",b4,5e,6d,3c); }
+
+ static void saveStack( ::Dynamic exception);
+ static ::Dynamic saveStack_dyn();
+
+ static ::Array< ::String > callStack();
+ static ::Dynamic callStack_dyn();
+
+ static ::Array< ::String > exceptionStack();
+ static ::Dynamic exceptionStack_dyn();
+
+};
+
+} // end namespace haxe
+
+#endif /* INCLUDED_haxe_NativeStackTrace */
diff --git a/Sources/c_snikket/iinclude/include/haxe/StackItem.h b/Sources/c_snikket/iinclude/include/haxe/StackItem.h
new file mode 100644
index 0000000..bf28552
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/StackItem.h
@@ -0,0 +1,41 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_StackItem
+#define INCLUDED_haxe_StackItem
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,StackItem)
+namespace haxe{
+
+
+class StackItem_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef StackItem_obj OBJ_;
+
+ public:
+ StackItem_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("haxe.StackItem",13,26,c7,2d); }
+ ::String __ToString() const { return HX_("StackItem.",73,53,dc,cb) + _hx_tag; }
+
+ static ::haxe::StackItem CFunction;
+ static inline ::haxe::StackItem CFunction_dyn() { return CFunction; }
+ static ::haxe::StackItem FilePos( ::haxe::StackItem s,::String file,int line, ::Dynamic column);
+ static ::Dynamic FilePos_dyn();
+ static ::haxe::StackItem LocalFunction( ::Dynamic v);
+ static ::Dynamic LocalFunction_dyn();
+ static ::haxe::StackItem Method(::String classname,::String method);
+ static ::Dynamic Method_dyn();
+ static ::haxe::StackItem Module(::String m);
+ static ::Dynamic Module_dyn();
+};
+
+} // end namespace haxe
+
+#endif /* INCLUDED_haxe_StackItem */
diff --git a/Sources/c_snikket/iinclude/include/haxe/Timer.h b/Sources/c_snikket/iinclude/include/haxe/Timer.h
new file mode 100644
index 0000000..27ba251
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/Timer.h
@@ -0,0 +1,65 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_Timer
+#define INCLUDED_haxe_Timer
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,Timer)
+HX_DECLARE_CLASS3(sys,thread,_EventLoop,RegularEvent)
+HX_DECLARE_CLASS3(sys,thread,_Thread,HaxeThread)
+
+namespace haxe{
+
+
+class HXCPP_CLASS_ATTRIBUTES Timer_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Timer_obj OBJ_;
+ Timer_obj();
+
+ public:
+ enum { _hx_ClassId = 0x04eaa0bb };
+
+ void __construct(int time_ms);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.Timer")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.Timer"); }
+ static ::hx::ObjectPtr< Timer_obj > __new(int time_ms);
+ static ::hx::ObjectPtr< Timer_obj > __alloc(::hx::Ctx *_hx_ctx,int time_ms);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ static void __alloc_dynamic_functions(::hx::Ctx *_hx_alloc,Timer_obj *_hx_obj);
+ //~Timer_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Timer",a5,2f,63,a3); }
+
+ static ::haxe::Timer delay( ::Dynamic f,int time_ms);
+ static ::Dynamic delay_dyn();
+
+ ::sys::thread::_Thread::HaxeThread thread;
+ ::sys::thread::_EventLoop::RegularEvent eventHandler;
+ void stop();
+ ::Dynamic stop_dyn();
+
+ ::Dynamic run;
+ inline ::Dynamic &run_dyn() {return run; }
+
+};
+
+} // end namespace haxe
+
+#endif /* INCLUDED_haxe_Timer */
diff --git a/Sources/c_snikket/iinclude/include/haxe/ValueException.h b/Sources/c_snikket/iinclude/include/haxe/ValueException.h
new file mode 100644
index 0000000..b515757
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/ValueException.h
@@ -0,0 +1,55 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_ValueException
+#define INCLUDED_haxe_ValueException
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_Exception
+#include <haxe/Exception.h>
+#endif
+HX_DECLARE_CLASS1(haxe,Exception)
+HX_DECLARE_CLASS1(haxe,ValueException)
+
+namespace haxe{
+
+
+class HXCPP_CLASS_ATTRIBUTES ValueException_obj : public ::haxe::Exception_obj
+{
+ public:
+ typedef ::haxe::Exception_obj super;
+ typedef ValueException_obj OBJ_;
+ ValueException_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0af01d58 };
+
+ void __construct( ::Dynamic value, ::haxe::Exception previous, ::Dynamic native);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.ValueException")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.ValueException"); }
+ static ::hx::ObjectPtr< ValueException_obj > __new( ::Dynamic value, ::haxe::Exception previous, ::Dynamic native);
+ static ::hx::ObjectPtr< ValueException_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic value, ::haxe::Exception previous, ::Dynamic native);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ValueException_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("ValueException",be,0e,61,3f); }
+
+ ::Dynamic value;
+};
+
+} // end namespace haxe
+
+#endif /* INCLUDED_haxe_ValueException */
diff --git a/Sources/c_snikket/iinclude/include/haxe/crypto/Base64.h b/Sources/c_snikket/iinclude/include/haxe/crypto/Base64.h
new file mode 100644
index 0000000..0f00eaf
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/crypto/Base64.h
@@ -0,0 +1,78 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_crypto_Base64
+#define INCLUDED_haxe_crypto_Base64
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,crypto,Base64)
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+
+namespace haxe{
+namespace crypto{
+
+
+class HXCPP_CLASS_ATTRIBUTES Base64_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Base64_obj OBJ_;
+ Base64_obj();
+
+ public:
+ enum { _hx_ClassId = 0x08b38de6 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="haxe.crypto.Base64")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"haxe.crypto.Base64"); }
+
+ inline static ::hx::ObjectPtr< Base64_obj > __new() {
+ ::hx::ObjectPtr< Base64_obj > __this = new Base64_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Base64_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Base64_obj *__this = (Base64_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Base64_obj), false, "haxe.crypto.Base64"));
+ *(void **)__this = Base64_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Base64_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Base64",af,71,bc,89); }
+
+ static void __boot();
+ static ::String CHARS;
+ static ::haxe::io::Bytes BYTES;
+ static ::String URL_CHARS;
+ static ::haxe::io::Bytes URL_BYTES;
+ static ::String encode( ::haxe::io::Bytes bytes,::hx::Null< bool > complement);
+ static ::Dynamic encode_dyn();
+
+ static ::haxe::io::Bytes decode(::String str,::hx::Null< bool > complement);
+ static ::Dynamic decode_dyn();
+
+ static ::String urlEncode( ::haxe::io::Bytes bytes,::hx::Null< bool > complement);
+ static ::Dynamic urlEncode_dyn();
+
+ static ::haxe::io::Bytes urlDecode(::String str,::hx::Null< bool > complement);
+ static ::Dynamic urlDecode_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace crypto
+
+#endif /* INCLUDED_haxe_crypto_Base64 */
diff --git a/Sources/c_snikket/iinclude/include/haxe/crypto/BaseCode.h b/Sources/c_snikket/iinclude/include/haxe/crypto/BaseCode.h
new file mode 100644
index 0000000..bd80353
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/crypto/BaseCode.h
@@ -0,0 +1,65 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_crypto_BaseCode
+#define INCLUDED_haxe_crypto_BaseCode
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,crypto,BaseCode)
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+
+namespace haxe{
+namespace crypto{
+
+
+class HXCPP_CLASS_ATTRIBUTES BaseCode_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef BaseCode_obj OBJ_;
+ BaseCode_obj();
+
+ public:
+ enum { _hx_ClassId = 0x34980465 };
+
+ void __construct( ::haxe::io::Bytes base);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.crypto.BaseCode")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.crypto.BaseCode"); }
+ static ::hx::ObjectPtr< BaseCode_obj > __new( ::haxe::io::Bytes base);
+ static ::hx::ObjectPtr< BaseCode_obj > __alloc(::hx::Ctx *_hx_ctx, ::haxe::io::Bytes base);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~BaseCode_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("BaseCode",fe,5d,c4,cf); }
+
+ ::haxe::io::Bytes base;
+ int nbits;
+ ::Array< int > tbl;
+ ::haxe::io::Bytes encodeBytes( ::haxe::io::Bytes b);
+ ::Dynamic encodeBytes_dyn();
+
+ void initTable();
+ ::Dynamic initTable_dyn();
+
+ ::haxe::io::Bytes decodeBytes( ::haxe::io::Bytes b);
+ ::Dynamic decodeBytes_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace crypto
+
+#endif /* INCLUDED_haxe_crypto_BaseCode */
diff --git a/Sources/c_snikket/iinclude/include/haxe/crypto/Sha1.h b/Sources/c_snikket/iinclude/include/haxe/crypto/Sha1.h
new file mode 100644
index 0000000..e2986e1
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/crypto/Sha1.h
@@ -0,0 +1,81 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_crypto_Sha1
+#define INCLUDED_haxe_crypto_Sha1
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_b388adc1457cbfc2_48_new)
+HX_DECLARE_CLASS2(haxe,crypto,Sha1)
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+
+namespace haxe{
+namespace crypto{
+
+
+class HXCPP_CLASS_ATTRIBUTES Sha1_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Sha1_obj OBJ_;
+ Sha1_obj();
+
+ public:
+ enum { _hx_ClassId = 0x3a249b8c };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="haxe.crypto.Sha1")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"haxe.crypto.Sha1"); }
+
+ inline static ::hx::ObjectPtr< Sha1_obj > __new() {
+ ::hx::ObjectPtr< Sha1_obj > __this = new Sha1_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Sha1_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Sha1_obj *__this = (Sha1_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Sha1_obj), false, "haxe.crypto.Sha1"));
+ *(void **)__this = Sha1_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_b388adc1457cbfc2_48_new)
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Sha1_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Sha1",a5,f4,2b,37); }
+
+ static ::haxe::io::Bytes make( ::haxe::io::Bytes b);
+ static ::Dynamic make_dyn();
+
+ static ::Array< int > bytes2blks( ::haxe::io::Bytes b);
+ static ::Dynamic bytes2blks_dyn();
+
+ ::Array< int > doEncode(::Array< int > x);
+ ::Dynamic doEncode_dyn();
+
+ int ft(int t,int b,int c,int d);
+ ::Dynamic ft_dyn();
+
+ int kt(int t);
+ ::Dynamic kt_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace crypto
+
+#endif /* INCLUDED_haxe_crypto_Sha1 */
diff --git a/Sources/c_snikket/iinclude/include/haxe/crypto/Sha256.h b/Sources/c_snikket/iinclude/include/haxe/crypto/Sha256.h
new file mode 100644
index 0000000..6851954
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/crypto/Sha256.h
@@ -0,0 +1,75 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_crypto_Sha256
+#define INCLUDED_haxe_crypto_Sha256
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_0a4e95b4276e5057_48_new)
+HX_DECLARE_CLASS2(haxe,crypto,Sha256)
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+
+namespace haxe{
+namespace crypto{
+
+
+class HXCPP_CLASS_ATTRIBUTES Sha256_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Sha256_obj OBJ_;
+ Sha256_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0c0976ea };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="haxe.crypto.Sha256")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"haxe.crypto.Sha256"); }
+
+ inline static ::hx::ObjectPtr< Sha256_obj > __new() {
+ ::hx::ObjectPtr< Sha256_obj > __this = new Sha256_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Sha256_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Sha256_obj *__this = (Sha256_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Sha256_obj), false, "haxe.crypto.Sha256"));
+ *(void **)__this = Sha256_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_0a4e95b4276e5057_48_new)
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Sha256_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Sha256",87,18,8f,51); }
+
+ static ::haxe::io::Bytes make( ::haxe::io::Bytes b);
+ static ::Dynamic make_dyn();
+
+ static ::Array< int > bytes2blks( ::haxe::io::Bytes b);
+ static ::Dynamic bytes2blks_dyn();
+
+ ::Array< int > doEncode(::Array< int > m,int l);
+ ::Dynamic doEncode_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace crypto
+
+#endif /* INCLUDED_haxe_crypto_Sha256 */
diff --git a/Sources/c_snikket/iinclude/include/haxe/ds/BalancedTree.h b/Sources/c_snikket/iinclude/include/haxe/ds/BalancedTree.h
new file mode 100644
index 0000000..4f5b9e6
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/ds/BalancedTree.h
@@ -0,0 +1,83 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_ds_BalancedTree
+#define INCLUDED_haxe_ds_BalancedTree
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,BalancedTree)
+HX_DECLARE_CLASS2(haxe,ds,TreeNode)
+
+namespace haxe{
+namespace ds{
+
+
+class HXCPP_CLASS_ATTRIBUTES BalancedTree_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef BalancedTree_obj OBJ_;
+ BalancedTree_obj();
+
+ public:
+ enum { _hx_ClassId = 0x4cc9cf7f };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.ds.BalancedTree")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.ds.BalancedTree"); }
+ static ::hx::ObjectPtr< BalancedTree_obj > __new();
+ static ::hx::ObjectPtr< BalancedTree_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~BalancedTree_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("BalancedTree",66,71,f8,aa); }
+
+ ::haxe::ds::TreeNode root;
+ void set( ::Dynamic key, ::Dynamic value);
+ ::Dynamic set_dyn();
+
+ ::Dynamic get( ::Dynamic key);
+ ::Dynamic get_dyn();
+
+ bool exists( ::Dynamic key);
+ ::Dynamic exists_dyn();
+
+ ::Dynamic keys();
+ ::Dynamic keys_dyn();
+
+ ::haxe::ds::TreeNode setLoop( ::Dynamic k, ::Dynamic v, ::haxe::ds::TreeNode node);
+ ::Dynamic setLoop_dyn();
+
+ void keysLoop( ::haxe::ds::TreeNode node,::cpp::VirtualArray acc);
+ ::Dynamic keysLoop_dyn();
+
+ ::haxe::ds::TreeNode balance( ::haxe::ds::TreeNode l, ::Dynamic k, ::Dynamic v, ::haxe::ds::TreeNode r);
+ ::Dynamic balance_dyn();
+
+ virtual int compare( ::Dynamic k1, ::Dynamic k2);
+ ::Dynamic compare_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace ds
+
+#endif /* INCLUDED_haxe_ds_BalancedTree */
diff --git a/Sources/c_snikket/iinclude/include/haxe/ds/Either.h b/Sources/c_snikket/iinclude/include/haxe/ds/Either.h
new file mode 100644
index 0000000..64e3fd7
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/ds/Either.h
@@ -0,0 +1,37 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_ds_Either
+#define INCLUDED_haxe_ds_Either
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,ds,Either)
+namespace haxe{
+namespace ds{
+
+
+class Either_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef Either_obj OBJ_;
+
+ public:
+ Either_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("haxe.ds.Either",1c,1a,b7,a4); }
+ ::String __ToString() const { return HX_("Either.",29,67,48,40) + _hx_tag; }
+
+ static ::haxe::ds::Either Left( ::Dynamic v);
+ static ::Dynamic Left_dyn();
+ static ::haxe::ds::Either Right( ::Dynamic v);
+ static ::Dynamic Right_dyn();
+};
+
+} // end namespace haxe
+} // end namespace ds
+
+#endif /* INCLUDED_haxe_ds_Either */
diff --git a/Sources/c_snikket/iinclude/include/haxe/ds/EnumValueMap.h b/Sources/c_snikket/iinclude/include/haxe/ds/EnumValueMap.h
new file mode 100644
index 0000000..48f7525
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/ds/EnumValueMap.h
@@ -0,0 +1,65 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_ds_EnumValueMap
+#define INCLUDED_haxe_ds_EnumValueMap
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_ds_BalancedTree
+#include <haxe/ds/BalancedTree.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,BalancedTree)
+HX_DECLARE_CLASS2(haxe,ds,EnumValueMap)
+
+namespace haxe{
+namespace ds{
+
+
+class HXCPP_CLASS_ATTRIBUTES EnumValueMap_obj : public ::haxe::ds::BalancedTree_obj
+{
+ public:
+ typedef ::haxe::ds::BalancedTree_obj super;
+ typedef EnumValueMap_obj OBJ_;
+ EnumValueMap_obj();
+
+ public:
+ enum { _hx_ClassId = 0x34ccfa05 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.ds.EnumValueMap")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.ds.EnumValueMap"); }
+ static ::hx::ObjectPtr< EnumValueMap_obj > __new();
+ static ::hx::ObjectPtr< EnumValueMap_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~EnumValueMap_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("EnumValueMap",ec,9b,fb,92); }
+
+ int compare( ::Dynamic _tmp_k1, ::Dynamic _tmp_k2);
+
+ int compareArgs(::cpp::VirtualArray a1,::cpp::VirtualArray a2);
+ ::Dynamic compareArgs_dyn();
+
+ int compareArg( ::Dynamic v1, ::Dynamic v2);
+ ::Dynamic compareArg_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace ds
+
+#endif /* INCLUDED_haxe_ds_EnumValueMap */
diff --git a/Sources/c_snikket/iinclude/include/haxe/ds/IntMap.h b/Sources/c_snikket/iinclude/include/haxe/ds/IntMap.h
new file mode 100644
index 0000000..c5e3745
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/ds/IntMap.h
@@ -0,0 +1,102 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_ds_IntMap
+#define INCLUDED_haxe_ds_IntMap
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,IntMap)
+
+namespace haxe{
+namespace ds{
+
+
+class HXCPP_CLASS_ATTRIBUTES IntMap_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef IntMap_obj OBJ_;
+ IntMap_obj();
+
+ public:
+ enum { _hx_ClassId = 0x269a1502 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.ds.IntMap")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.ds.IntMap"); }
+ static ::hx::ObjectPtr< IntMap_obj > __new();
+ static ::hx::ObjectPtr< IntMap_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~IntMap_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::Dynamic get_a7a2487a( ::Dynamic k);
+ ::String __ToString() const { return HX_("IntMap",0d,a9,08,d3); }
+
+ ::Dynamic h;
+ void set(int key, ::Dynamic value);
+ ::Dynamic set_dyn();
+
+ ::Dynamic get(int key);
+ ::Dynamic get_dyn();
+
+ bool remove(int key);
+ ::Dynamic remove_dyn();
+
+ ::Dynamic keys();
+ ::Dynamic keys_dyn();
+
+
+ inline void set(int key, ::null value) { __int_hash_set(HX_MAP_THIS,key,value); }
+ inline void set(int key, bool value) { __int_hash_set(HX_MAP_THIS,key,value); }
+ inline void set(int key, char value) { __int_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(int key, unsigned char value) { __int_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(int key, signed char value) { __int_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(int key, short value) { __int_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(int key, unsigned short value) { __int_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(int key, int value) { __int_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(int key, unsigned int value) { __int_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(int key, float value) { __int_hash_set_float(HX_MAP_THIS,key,value); }
+ inline void set(int key, double value) { __int_hash_set_float(HX_MAP_THIS,key,value); }
+ inline void set(int key, ::String value) { __int_hash_set_string(HX_MAP_THIS,key,value); }
+ inline void set(int key, cpp::Int64 value) { __int_hash_set_int64(HX_MAP_THIS,key,value); }
+
+ template<typename V, typename H>
+ inline void set(int key, const ::cpp::Struct<V,H> &value) {__int_hash_set(HX_MAP_THIS,key,value); }
+ template<typename F>
+ inline void set(int key, const ::cpp::Function<F> &value) {__int_hash_set(HX_MAP_THIS,key,value); }
+ template<typename V>
+ inline void set(int key, const ::cpp::Pointer<V> &value) {__int_hash_set(HX_MAP_THIS,key,(Dynamic)value ); }
+
+ template<typename VALUE>
+ inline void set(Dynamic &key, const VALUE &value) { set( (int)key, value ); }
+
+ inline bool get_bool(int key) { return __int_hash_get_bool(h,key); }
+ inline int get_int(int key) { return __int_hash_get_int(h,key); }
+ inline Float get_float(int key) { return __int_hash_get_float(h,key); }
+ inline String get_string(int key) { return __int_hash_get_string(h,key); }
+ inline cpp::Int64 get_int64(int key) { return __int_hash_get_int64(h,key); }
+
+};
+
+} // end namespace haxe
+} // end namespace ds
+
+#endif /* INCLUDED_haxe_ds_IntMap */
diff --git a/Sources/c_snikket/iinclude/include/haxe/ds/List.h b/Sources/c_snikket/iinclude/include/haxe/ds/List.h
new file mode 100644
index 0000000..f0559ec
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/ds/List.h
@@ -0,0 +1,62 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_ds_List
+#define INCLUDED_haxe_ds_List
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,ds,List)
+HX_DECLARE_CLASS3(haxe,ds,_List,ListNode)
+
+namespace haxe{
+namespace ds{
+
+
+class HXCPP_CLASS_ATTRIBUTES List_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef List_obj OBJ_;
+ List_obj();
+
+ public:
+ enum { _hx_ClassId = 0x39a75d33 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.ds.List")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.ds.List"); }
+ static ::hx::ObjectPtr< List_obj > __new();
+ static ::hx::ObjectPtr< List_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~List_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("List",7e,48,8c,32); }
+
+ ::haxe::ds::_List::ListNode h;
+ ::haxe::ds::_List::ListNode q;
+ int length;
+ void push( ::Dynamic item);
+ ::Dynamic push_dyn();
+
+ ::Dynamic pop();
+ ::Dynamic pop_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace ds
+
+#endif /* INCLUDED_haxe_ds_List */
diff --git a/Sources/c_snikket/iinclude/include/haxe/ds/ObjectMap.h b/Sources/c_snikket/iinclude/include/haxe/ds/ObjectMap.h
new file mode 100644
index 0000000..02cde81
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/ds/ObjectMap.h
@@ -0,0 +1,96 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_ds_ObjectMap
+#define INCLUDED_haxe_ds_ObjectMap
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,ObjectMap)
+
+namespace haxe{
+namespace ds{
+
+
+class HXCPP_CLASS_ATTRIBUTES ObjectMap_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef ObjectMap_obj OBJ_;
+ ObjectMap_obj();
+
+ public:
+ enum { _hx_ClassId = 0x6cba6d44 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.ds.ObjectMap")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.ds.ObjectMap"); }
+ static ::hx::ObjectPtr< ObjectMap_obj > __new();
+ static ::hx::ObjectPtr< ObjectMap_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ObjectMap_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("ObjectMap",fd,a4,50,e5); }
+
+ ::Dynamic h;
+ void set( ::Dynamic key, ::Dynamic value);
+ ::Dynamic set_dyn();
+
+ ::Dynamic get( ::Dynamic key);
+ ::Dynamic get_dyn();
+
+ ::Dynamic keys();
+ ::Dynamic keys_dyn();
+
+
+ inline void set(Dynamic key, ::null value) { __object_hash_set(HX_MAP_THIS,key,value); }
+ inline void set(Dynamic key, bool value) { __object_hash_set(HX_MAP_THIS,key,value); }
+ inline void set(Dynamic key, char value) { __object_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(Dynamic key, unsigned char value) { __object_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(Dynamic key, signed char value) { __object_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(Dynamic key, short value) { __object_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(Dynamic key, unsigned short value) { __object_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(Dynamic key, int value) { __object_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(Dynamic key, unsigned int value) { __object_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(Dynamic key, float value) { __object_hash_set_float(HX_MAP_THIS,key,value); }
+ inline void set(Dynamic key, double value) { __object_hash_set_float(HX_MAP_THIS,key,value); }
+ inline void set(Dynamic key, ::String value) { __object_hash_set_string(HX_MAP_THIS,key,value); }
+ inline void set(Dynamic key, cpp::Int64 value) { __object_hash_set_int64(HX_MAP_THIS,key,value); }
+
+
+ template<typename V, typename H>
+ inline void set(Dynamic key, const ::cpp::Struct<V,H> &value) {__object_hash_set(HX_MAP_THIS,key,value); }
+ template<typename V>
+ inline void set(Dynamic key, const ::cpp::Function<V> &value) {__object_hash_set(HX_MAP_THIS,key,(Dynamic)value ); }
+ template<typename V>
+ inline void set(Dynamic key, const ::cpp::Pointer<V> &value) {__object_hash_set(HX_MAP_THIS,key,(Dynamic)value ); }
+
+ inline bool get_bool(Dynamic key) { return __object_hash_get_bool(h,key); }
+ inline int get_int(Dynamic key) { return __object_hash_get_int(h,key); }
+ inline Float get_float(Dynamic key) { return __object_hash_get_float(h,key); }
+ inline String get_string(Dynamic key) { return __object_hash_get_string(h,key); }
+ inline cpp::Int64 get_int64(Dynamic key) { return __object_hash_get_int64(h,key); }
+
+};
+
+} // end namespace haxe
+} // end namespace ds
+
+#endif /* INCLUDED_haxe_ds_ObjectMap */
diff --git a/Sources/c_snikket/iinclude/include/haxe/ds/Option.h b/Sources/c_snikket/iinclude/include/haxe/ds/Option.h
new file mode 100644
index 0000000..f2703eb
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/ds/Option.h
@@ -0,0 +1,37 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_ds_Option
+#define INCLUDED_haxe_ds_Option
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,ds,Option)
+namespace haxe{
+namespace ds{
+
+
+class Option_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef Option_obj OBJ_;
+
+ public:
+ Option_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("haxe.ds.Option",4c,90,17,ac); }
+ ::String __ToString() const { return HX_("Option.",f9,5a,4f,ad) + _hx_tag; }
+
+ static ::haxe::ds::Option None;
+ static inline ::haxe::ds::Option None_dyn() { return None; }
+ static ::haxe::ds::Option Some( ::Dynamic v);
+ static ::Dynamic Some_dyn();
+};
+
+} // end namespace haxe
+} // end namespace ds
+
+#endif /* INCLUDED_haxe_ds_Option */
diff --git a/Sources/c_snikket/iinclude/include/haxe/ds/StringMap.h b/Sources/c_snikket/iinclude/include/haxe/ds/StringMap.h
new file mode 100644
index 0000000..527e7db
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/ds/StringMap.h
@@ -0,0 +1,111 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_ds_StringMap
+#define INCLUDED_haxe_ds_StringMap
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+
+namespace haxe{
+namespace ds{
+
+
+class HXCPP_CLASS_ATTRIBUTES StringMap_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef StringMap_obj OBJ_;
+ StringMap_obj();
+
+ public:
+ enum { _hx_ClassId = 0x4260cd56 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.ds.StringMap")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.ds.StringMap"); }
+ static ::hx::ObjectPtr< StringMap_obj > __new();
+ static ::hx::ObjectPtr< StringMap_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~StringMap_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::Dynamic get_a7a2487a( ::Dynamic k);
+ ::String __ToString() const { return HX_("StringMap",2b,12,8c,69); }
+
+ ::Dynamic h;
+ void set(::String key, ::Dynamic value);
+ ::Dynamic set_dyn();
+
+ ::Dynamic get(::String key);
+ ::Dynamic get_dyn();
+
+ bool exists(::String key);
+ ::Dynamic exists_dyn();
+
+ bool remove(::String key);
+ ::Dynamic remove_dyn();
+
+ ::Dynamic keys();
+ ::Dynamic keys_dyn();
+
+ ::Dynamic iterator();
+ ::Dynamic iterator_dyn();
+
+ void clear();
+ ::Dynamic clear_dyn();
+
+
+ inline void set(String key, ::null value) { __string_hash_set(HX_MAP_THIS,key,value); }
+ inline void set(String key, bool value) { __string_hash_set(HX_MAP_THIS,key,value); }
+ inline void set(String key, char value) { __string_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(String key, unsigned char value) { __string_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(String key, signed char value) { __string_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(String key, short value) { __string_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(String key, unsigned short value) { __string_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(String key, int value) { __string_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(String key, unsigned int value) { __string_hash_set_int(HX_MAP_THIS,key,value); }
+ inline void set(String key, float value) { __string_hash_set_float(HX_MAP_THIS,key,value); }
+ inline void set(String key, double value) { __string_hash_set_float(HX_MAP_THIS,key,value); }
+ inline void set(String key, ::String value) { __string_hash_set_string(HX_MAP_THIS,key,value); }
+ inline void set(String key, cpp::Int64 value) { __string_hash_set_int64(HX_MAP_THIS,key,value); }
+
+ template<typename V, typename H>
+ inline void set(String key, const ::cpp::Struct<V,H> &value) {__string_hash_set(HX_MAP_THIS,key,value); }
+ template<typename V>
+ inline void set(String key, const ::cpp::Function<V> &value) {__string_hash_set(HX_MAP_THIS,key,(Dynamic)value ); }
+ template<typename V>
+ inline void set(String key, const ::cpp::Pointer<V> &value) {__string_hash_set(HX_MAP_THIS,key,(Dynamic)value ); }
+
+ template<typename VALUE>
+ inline void set(Dynamic &key, const VALUE &value) { set( (String)key, value ); }
+
+ inline bool get_bool(String key) { return __string_hash_get_bool(h,key); }
+ inline int get_int(String key) { return __string_hash_get_int(h,key); }
+ inline Float get_float(String key) { return __string_hash_get_float(h,key); }
+ inline String get_string(String key) { return __string_hash_get_string(h,key); }
+ inline cpp::Int64 get_int64(String key) { return __string_hash_get_int64(h,key); }
+
+};
+
+} // end namespace haxe
+} // end namespace ds
+
+#endif /* INCLUDED_haxe_ds_StringMap */
diff --git a/Sources/c_snikket/iinclude/include/haxe/ds/TreeNode.h b/Sources/c_snikket/iinclude/include/haxe/ds/TreeNode.h
new file mode 100644
index 0000000..9eb45af
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/ds/TreeNode.h
@@ -0,0 +1,119 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_ds_TreeNode
+#define INCLUDED_haxe_ds_TreeNode
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_bd32df1abf02b23a_252_new)
+HX_DECLARE_CLASS2(haxe,ds,TreeNode)
+
+namespace haxe{
+namespace ds{
+
+
+class HXCPP_CLASS_ATTRIBUTES TreeNode_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef TreeNode_obj OBJ_;
+ TreeNode_obj();
+
+ public:
+ enum { _hx_ClassId = 0x723fa5d5 };
+
+ void __construct( ::haxe::ds::TreeNode l, ::Dynamic k, ::Dynamic v, ::haxe::ds::TreeNode r,::hx::Null< int > __o_h);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.ds.TreeNode")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.ds.TreeNode"); }
+
+ inline static ::hx::ObjectPtr< TreeNode_obj > __new( ::haxe::ds::TreeNode l, ::Dynamic k, ::Dynamic v, ::haxe::ds::TreeNode r,::hx::Null< int > __o_h) {
+ ::hx::ObjectPtr< TreeNode_obj > __this = new TreeNode_obj();
+ __this->__construct(l,k,v,r,__o_h);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< TreeNode_obj > __alloc(::hx::Ctx *_hx_ctx, ::haxe::ds::TreeNode l, ::Dynamic k, ::Dynamic v, ::haxe::ds::TreeNode r,::hx::Null< int > __o_h) {
+ TreeNode_obj *__this = (TreeNode_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(TreeNode_obj), true, "haxe.ds.TreeNode"));
+ *(void **)__this = TreeNode_obj::_hx_vtable;
+{
+ int h = __o_h.Default(-1);
+ HX_STACKFRAME(&_hx_pos_bd32df1abf02b23a_252_new)
+HXLINE( 253) ( ( ::haxe::ds::TreeNode)(__this) )->left = l;
+HXLINE( 254) ( ( ::haxe::ds::TreeNode)(__this) )->key = k;
+HXLINE( 255) ( ( ::haxe::ds::TreeNode)(__this) )->value = v;
+HXLINE( 256) ( ( ::haxe::ds::TreeNode)(__this) )->right = r;
+HXLINE( 257) if ((h == -1)) {
+HXLINE( 258) int _hx_tmp;
+HXDLIN( 258) ::haxe::ds::TreeNode _this = ( ( ::haxe::ds::TreeNode)(__this) )->left;
+HXDLIN( 258) int _hx_tmp1;
+HXDLIN( 258) if (::hx::IsNull( _this )) {
+HXLINE( 258) _hx_tmp1 = 0;
+ }
+ else {
+HXLINE( 258) _hx_tmp1 = _this->_height;
+ }
+HXDLIN( 258) ::haxe::ds::TreeNode _this1 = ( ( ::haxe::ds::TreeNode)(__this) )->right;
+HXDLIN( 258) int _hx_tmp2;
+HXDLIN( 258) if (::hx::IsNull( _this1 )) {
+HXLINE( 258) _hx_tmp2 = 0;
+ }
+ else {
+HXLINE( 258) _hx_tmp2 = _this1->_height;
+ }
+HXDLIN( 258) if ((_hx_tmp1 > _hx_tmp2)) {
+HXLINE( 258) ::haxe::ds::TreeNode _this2 = ( ( ::haxe::ds::TreeNode)(__this) )->left;
+HXDLIN( 258) if (::hx::IsNull( _this2 )) {
+HXLINE( 258) _hx_tmp = 0;
+ }
+ else {
+HXLINE( 258) _hx_tmp = _this2->_height;
+ }
+ }
+ else {
+HXLINE( 258) ::haxe::ds::TreeNode _this3 = ( ( ::haxe::ds::TreeNode)(__this) )->right;
+HXDLIN( 258) if (::hx::IsNull( _this3 )) {
+HXLINE( 258) _hx_tmp = 0;
+ }
+ else {
+HXLINE( 258) _hx_tmp = _this3->_height;
+ }
+ }
+HXDLIN( 258) ( ( ::haxe::ds::TreeNode)(__this) )->_height = (_hx_tmp + 1);
+ }
+ else {
+HXLINE( 260) ( ( ::haxe::ds::TreeNode)(__this) )->_height = h;
+ }
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~TreeNode_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("TreeNode",a0,92,83,06); }
+
+ ::haxe::ds::TreeNode left;
+ ::haxe::ds::TreeNode right;
+ ::Dynamic key;
+ ::Dynamic value;
+ int _height;
+};
+
+} // end namespace haxe
+} // end namespace ds
+
+#endif /* INCLUDED_haxe_ds_TreeNode */
diff --git a/Sources/c_snikket/iinclude/include/haxe/ds/_List/ListNode.h b/Sources/c_snikket/iinclude/include/haxe/ds/_List/ListNode.h
new file mode 100644
index 0000000..c8b20b9
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/ds/_List/ListNode.h
@@ -0,0 +1,74 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_ds__List_ListNode
+#define INCLUDED_haxe_ds__List_ListNode
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_d7fe8fcac3c6136e_266_new)
+HX_DECLARE_CLASS3(haxe,ds,_List,ListNode)
+
+namespace haxe{
+namespace ds{
+namespace _List{
+
+
+class HXCPP_CLASS_ATTRIBUTES ListNode_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef ListNode_obj OBJ_;
+ ListNode_obj();
+
+ public:
+ enum { _hx_ClassId = 0x567ed068 };
+
+ void __construct( ::Dynamic item, ::haxe::ds::_List::ListNode next);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.ds._List.ListNode")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.ds._List.ListNode"); }
+
+ inline static ::hx::ObjectPtr< ListNode_obj > __new( ::Dynamic item, ::haxe::ds::_List::ListNode next) {
+ ::hx::ObjectPtr< ListNode_obj > __this = new ListNode_obj();
+ __this->__construct(item,next);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< ListNode_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic item, ::haxe::ds::_List::ListNode next) {
+ ListNode_obj *__this = (ListNode_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(ListNode_obj), true, "haxe.ds._List.ListNode"));
+ *(void **)__this = ListNode_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_d7fe8fcac3c6136e_266_new)
+HXLINE( 267) ( ( ::haxe::ds::_List::ListNode)(__this) )->item = item;
+HXLINE( 268) ( ( ::haxe::ds::_List::ListNode)(__this) )->next = next;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ListNode_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("ListNode",a0,95,b0,02); }
+
+ ::Dynamic item;
+ ::haxe::ds::_List::ListNode next;
+};
+
+} // end namespace haxe
+} // end namespace ds
+} // end namespace _List
+
+#endif /* INCLUDED_haxe_ds__List_ListNode */
diff --git a/Sources/c_snikket/iinclude/include/haxe/exceptions/NotImplementedException.h b/Sources/c_snikket/iinclude/include/haxe/exceptions/NotImplementedException.h
new file mode 100644
index 0000000..8af474a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/exceptions/NotImplementedException.h
@@ -0,0 +1,71 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_exceptions_NotImplementedException
+#define INCLUDED_haxe_exceptions_NotImplementedException
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_exceptions_PosException
+#include <haxe/exceptions/PosException.h>
+#endif
+HX_DECLARE_STACK_FRAME(_hx_pos_6becf3ac06fb2a12_8_new)
+HX_DECLARE_CLASS1(haxe,Exception)
+HX_DECLARE_CLASS2(haxe,exceptions,NotImplementedException)
+HX_DECLARE_CLASS2(haxe,exceptions,PosException)
+
+namespace haxe{
+namespace exceptions{
+
+
+class HXCPP_CLASS_ATTRIBUTES NotImplementedException_obj : public ::haxe::exceptions::PosException_obj
+{
+ public:
+ typedef ::haxe::exceptions::PosException_obj super;
+ typedef NotImplementedException_obj OBJ_;
+ NotImplementedException_obj();
+
+ public:
+ enum { _hx_ClassId = 0x081bdbd6 };
+
+ void __construct(::String __o_message, ::haxe::Exception previous, ::Dynamic pos);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.exceptions.NotImplementedException")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.exceptions.NotImplementedException"); }
+
+ inline static ::hx::ObjectPtr< NotImplementedException_obj > __new(::String __o_message, ::haxe::Exception previous, ::Dynamic pos) {
+ ::hx::ObjectPtr< NotImplementedException_obj > __this = new NotImplementedException_obj();
+ __this->__construct(__o_message,previous,pos);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< NotImplementedException_obj > __alloc(::hx::Ctx *_hx_ctx,::String __o_message, ::haxe::Exception previous, ::Dynamic pos) {
+ NotImplementedException_obj *__this = (NotImplementedException_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(NotImplementedException_obj), true, "haxe.exceptions.NotImplementedException"));
+ *(void **)__this = NotImplementedException_obj::_hx_vtable;
+{
+ ::String message = __o_message;
+ if (::hx::IsNull(__o_message)) message = HX_("Not implemented",15,1e,32,34);
+ HX_STACKFRAME(&_hx_pos_6becf3ac06fb2a12_8_new)
+HXDLIN( 8) __this->super::__construct(message,previous,pos);
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~NotImplementedException_obj();
+
+ HX_DO_RTTI_ALL;
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("NotImplementedException",c0,57,2c,4a); }
+
+};
+
+} // end namespace haxe
+} // end namespace exceptions
+
+#endif /* INCLUDED_haxe_exceptions_NotImplementedException */
diff --git a/Sources/c_snikket/iinclude/include/haxe/exceptions/PosException.h b/Sources/c_snikket/iinclude/include/haxe/exceptions/PosException.h
new file mode 100644
index 0000000..df1f2b8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/exceptions/PosException.h
@@ -0,0 +1,82 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_exceptions_PosException
+#define INCLUDED_haxe_exceptions_PosException
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_Exception
+#include <haxe/Exception.h>
+#endif
+HX_DECLARE_STACK_FRAME(_hx_pos_9487fa79a58895e3_12_new)
+HX_DECLARE_CLASS1(haxe,Exception)
+HX_DECLARE_CLASS2(haxe,exceptions,PosException)
+
+namespace haxe{
+namespace exceptions{
+
+
+class HXCPP_CLASS_ATTRIBUTES PosException_obj : public ::haxe::Exception_obj
+{
+ public:
+ typedef ::haxe::Exception_obj super;
+ typedef PosException_obj OBJ_;
+ PosException_obj();
+
+ public:
+ enum { _hx_ClassId = 0x65f7252d };
+
+ void __construct(::String message, ::haxe::Exception previous, ::Dynamic pos);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.exceptions.PosException")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.exceptions.PosException"); }
+
+ inline static ::hx::ObjectPtr< PosException_obj > __new(::String message, ::haxe::Exception previous, ::Dynamic pos) {
+ ::hx::ObjectPtr< PosException_obj > __this = new PosException_obj();
+ __this->__construct(message,previous,pos);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< PosException_obj > __alloc(::hx::Ctx *_hx_ctx,::String message, ::haxe::Exception previous, ::Dynamic pos) {
+ PosException_obj *__this = (PosException_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(PosException_obj), true, "haxe.exceptions.PosException"));
+ *(void **)__this = PosException_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_9487fa79a58895e3_12_new)
+HXLINE( 13) __this->super::__construct(message,previous,null());
+HXLINE( 14) if (::hx::IsNull( pos )) {
+HXLINE( 15) ( ( ::haxe::exceptions::PosException)(__this) )->posInfos = ::hx::SourceInfo(HX_("(unknown)",87,5d,fc,5f),0,HX_("(unknown)",87,5d,fc,5f),HX_("(unknown)",87,5d,fc,5f));
+ }
+ else {
+HXLINE( 17) ( ( ::haxe::exceptions::PosException)(__this) )->posInfos = pos;
+ }
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~PosException_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("PosException",3b,8c,23,b9); }
+
+ ::Dynamic posInfos;
+ virtual ::String toString();
+
+};
+
+} // end namespace haxe
+} // end namespace exceptions
+
+#endif /* INCLUDED_haxe_exceptions_PosException */
diff --git a/Sources/c_snikket/iinclude/include/haxe/format/JsonParser.h b/Sources/c_snikket/iinclude/include/haxe/format/JsonParser.h
new file mode 100644
index 0000000..be8707a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/format/JsonParser.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_format_JsonParser
+#define INCLUDED_haxe_format_JsonParser
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,format,JsonParser)
+
+namespace haxe{
+namespace format{
+
+
+class HXCPP_CLASS_ATTRIBUTES JsonParser_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef JsonParser_obj OBJ_;
+ JsonParser_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0ae51690 };
+
+ void __construct(::String str);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.format.JsonParser")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.format.JsonParser"); }
+ static ::hx::ObjectPtr< JsonParser_obj > __new(::String str);
+ static ::hx::ObjectPtr< JsonParser_obj > __alloc(::hx::Ctx *_hx_ctx,::String str);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~JsonParser_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("JsonParser",47,65,2e,25); }
+
+ ::String str;
+ int pos;
+ ::Dynamic doParse();
+ ::Dynamic doParse_dyn();
+
+ ::Dynamic parseRec();
+ ::Dynamic parseRec_dyn();
+
+ ::String parseString();
+ ::Dynamic parseString_dyn();
+
+ void invalidChar();
+ ::Dynamic invalidChar_dyn();
+
+ void invalidNumber(int start);
+ ::Dynamic invalidNumber_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace format
+
+#endif /* INCLUDED_haxe_format_JsonParser */
diff --git a/Sources/c_snikket/iinclude/include/haxe/format/JsonPrinter.h b/Sources/c_snikket/iinclude/include/haxe/format/JsonPrinter.h
new file mode 100644
index 0000000..4ac12b9
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/format/JsonPrinter.h
@@ -0,0 +1,75 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_format_JsonPrinter
+#define INCLUDED_haxe_format_JsonPrinter
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(StringBuf)
+HX_DECLARE_CLASS2(haxe,format,JsonPrinter)
+
+namespace haxe{
+namespace format{
+
+
+class HXCPP_CLASS_ATTRIBUTES JsonPrinter_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef JsonPrinter_obj OBJ_;
+ JsonPrinter_obj();
+
+ public:
+ enum { _hx_ClassId = 0x385642d1 };
+
+ void __construct( ::Dynamic replacer,::String space);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.format.JsonPrinter")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.format.JsonPrinter"); }
+ static ::hx::ObjectPtr< JsonPrinter_obj > __new( ::Dynamic replacer,::String space);
+ static ::hx::ObjectPtr< JsonPrinter_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic replacer,::String space);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~JsonPrinter_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("JsonPrinter",72,68,9d,fd); }
+
+ static ::String print( ::Dynamic o, ::Dynamic replacer,::String space);
+ static ::Dynamic print_dyn();
+
+ ::StringBuf buf;
+ ::Dynamic replacer;
+ Dynamic replacer_dyn() { return replacer;}
+ ::String indent;
+ bool pretty;
+ int nind;
+ void write( ::Dynamic k, ::Dynamic v);
+ ::Dynamic write_dyn();
+
+ void classString( ::Dynamic v);
+ ::Dynamic classString_dyn();
+
+ void fieldsString( ::Dynamic v,::Array< ::String > fields);
+ ::Dynamic fieldsString_dyn();
+
+ void quote(::String s);
+ ::Dynamic quote_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace format
+
+#endif /* INCLUDED_haxe_format_JsonPrinter */
diff --git a/Sources/c_snikket/iinclude/include/haxe/http/HttpBase.h b/Sources/c_snikket/iinclude/include/haxe/http/HttpBase.h
new file mode 100644
index 0000000..fb9bfeb
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/http/HttpBase.h
@@ -0,0 +1,90 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_http_HttpBase
+#define INCLUDED_haxe_http_HttpBase
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,http,HttpBase)
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+
+namespace haxe{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES HttpBase_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef HttpBase_obj OBJ_;
+ HttpBase_obj();
+
+ public:
+ enum { _hx_ClassId = 0x10c0921f };
+
+ void __construct(::String url);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.http.HttpBase")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.http.HttpBase"); }
+ static ::hx::ObjectPtr< HttpBase_obj > __new(::String url);
+ static ::hx::ObjectPtr< HttpBase_obj > __alloc(::hx::Ctx *_hx_ctx,::String url);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ static void __alloc_dynamic_functions(::hx::Ctx *_hx_alloc,HttpBase_obj *_hx_obj);
+ //~HttpBase_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("HttpBase",d9,cf,1a,f8); }
+
+ ::String url;
+ ::haxe::io::Bytes responseBytes;
+ ::String responseAsString;
+ ::String postData;
+ ::haxe::io::Bytes postBytes;
+ ::Array< ::Dynamic> headers;
+ ::Array< ::Dynamic> params;
+ ::Dynamic emptyOnData;
+ Dynamic emptyOnData_dyn() { return emptyOnData;}
+ void setHeader(::String name,::String value);
+ ::Dynamic setHeader_dyn();
+
+ void setPostData(::String data);
+ ::Dynamic setPostData_dyn();
+
+ ::Dynamic onData;
+ inline ::Dynamic &onData_dyn() {return onData; }
+
+ ::Dynamic onBytes;
+ inline ::Dynamic &onBytes_dyn() {return onBytes; }
+
+ ::Dynamic onError;
+ inline ::Dynamic &onError_dyn() {return onError; }
+
+ ::Dynamic onStatus;
+ inline ::Dynamic &onStatus_dyn() {return onStatus; }
+
+ bool hasOnData();
+ ::Dynamic hasOnData_dyn();
+
+ void success( ::haxe::io::Bytes data);
+ ::Dynamic success_dyn();
+
+ ::String get_responseData();
+ ::Dynamic get_responseData_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace http
+
+#endif /* INCLUDED_haxe_http_HttpBase */
diff --git a/Sources/c_snikket/iinclude/include/haxe/io/Bytes.h b/Sources/c_snikket/iinclude/include/haxe/io/Bytes.h
new file mode 100644
index 0000000..49850b2
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/io/Bytes.h
@@ -0,0 +1,86 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_io_Bytes
+#define INCLUDED_haxe_io_Bytes
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,Encoding)
+
+namespace haxe{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES Bytes_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Bytes_obj OBJ_;
+ Bytes_obj();
+
+ public:
+ enum { _hx_ClassId = 0x195c64b7 };
+
+ void __construct(int length,::Array< unsigned char > b);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.io.Bytes")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.io.Bytes"); }
+ static ::hx::ObjectPtr< Bytes_obj > __new(int length,::Array< unsigned char > b);
+ static ::hx::ObjectPtr< Bytes_obj > __alloc(::hx::Ctx *_hx_ctx,int length,::Array< unsigned char > b);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Bytes_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Bytes",4b,78,c5,50); }
+
+ static ::haxe::io::Bytes alloc(int length);
+ static ::Dynamic alloc_dyn();
+
+ static ::haxe::io::Bytes ofString(::String s, ::haxe::io::Encoding encoding);
+ static ::Dynamic ofString_dyn();
+
+ static ::haxe::io::Bytes ofData(::Array< unsigned char > b);
+ static ::Dynamic ofData_dyn();
+
+ static ::haxe::io::Bytes ofHex(::String s);
+ static ::Dynamic ofHex_dyn();
+
+ int length;
+ ::Array< unsigned char > b;
+ void blit(int pos, ::haxe::io::Bytes src,int srcpos,int len);
+ ::Dynamic blit_dyn();
+
+ void fill(int pos,int len,int value);
+ ::Dynamic fill_dyn();
+
+ ::haxe::io::Bytes sub(int pos,int len);
+ ::Dynamic sub_dyn();
+
+ ::String getString(int pos,int len, ::haxe::io::Encoding encoding);
+ ::Dynamic getString_dyn();
+
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+ ::String toHex();
+ ::Dynamic toHex_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace io
+
+#endif /* INCLUDED_haxe_io_Bytes */
diff --git a/Sources/c_snikket/iinclude/include/haxe/io/BytesBuffer.h b/Sources/c_snikket/iinclude/include/haxe/io/BytesBuffer.h
new file mode 100644
index 0000000..531cf7a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/io/BytesBuffer.h
@@ -0,0 +1,57 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_io_BytesBuffer
+#define INCLUDED_haxe_io_BytesBuffer
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,BytesBuffer)
+
+namespace haxe{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES BytesBuffer_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef BytesBuffer_obj OBJ_;
+ BytesBuffer_obj();
+
+ public:
+ enum { _hx_ClassId = 0x183160df };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.io.BytesBuffer")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.io.BytesBuffer"); }
+ static ::hx::ObjectPtr< BytesBuffer_obj > __new();
+ static ::hx::ObjectPtr< BytesBuffer_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~BytesBuffer_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("BytesBuffer",ab,73,22,f6); }
+
+ ::Array< unsigned char > b;
+ ::haxe::io::Bytes getBytes();
+ ::Dynamic getBytes_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace io
+
+#endif /* INCLUDED_haxe_io_BytesBuffer */
diff --git a/Sources/c_snikket/iinclude/include/haxe/io/BytesInput.h b/Sources/c_snikket/iinclude/include/haxe/io/BytesInput.h
new file mode 100644
index 0000000..4385c8d
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/io/BytesInput.h
@@ -0,0 +1,65 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_io_BytesInput
+#define INCLUDED_haxe_io_BytesInput
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_io_Input
+#include <haxe/io/Input.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,BytesInput)
+HX_DECLARE_CLASS2(haxe,io,Input)
+
+namespace haxe{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES BytesInput_obj : public ::haxe::io::Input_obj
+{
+ public:
+ typedef ::haxe::io::Input_obj super;
+ typedef BytesInput_obj OBJ_;
+ BytesInput_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7e26810b };
+
+ void __construct( ::haxe::io::Bytes b, ::Dynamic pos, ::Dynamic len);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.io.BytesInput")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.io.BytesInput"); }
+ static ::hx::ObjectPtr< BytesInput_obj > __new( ::haxe::io::Bytes b, ::Dynamic pos, ::Dynamic len);
+ static ::hx::ObjectPtr< BytesInput_obj > __alloc(::hx::Ctx *_hx_ctx, ::haxe::io::Bytes b, ::Dynamic pos, ::Dynamic len);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~BytesInput_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("BytesInput",bf,cb,76,e6); }
+
+ ::Array< unsigned char > b;
+ int pos;
+ int len;
+ int totlen;
+ int readByte();
+
+ int readBytes( ::haxe::io::Bytes buf,int pos,int len);
+
+};
+
+} // end namespace haxe
+} // end namespace io
+
+#endif /* INCLUDED_haxe_io_BytesInput */
diff --git a/Sources/c_snikket/iinclude/include/haxe/io/BytesOutput.h b/Sources/c_snikket/iinclude/include/haxe/io/BytesOutput.h
new file mode 100644
index 0000000..15fc989
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/io/BytesOutput.h
@@ -0,0 +1,66 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_io_BytesOutput
+#define INCLUDED_haxe_io_BytesOutput
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_io_Output
+#include <haxe/io/Output.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,BytesBuffer)
+HX_DECLARE_CLASS2(haxe,io,BytesOutput)
+HX_DECLARE_CLASS2(haxe,io,Output)
+
+namespace haxe{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES BytesOutput_obj : public ::haxe::io::Output_obj
+{
+ public:
+ typedef ::haxe::io::Output_obj super;
+ typedef BytesOutput_obj OBJ_;
+ BytesOutput_obj();
+
+ public:
+ enum { _hx_ClassId = 0x541db2e0 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.io.BytesOutput")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.io.BytesOutput"); }
+ static ::hx::ObjectPtr< BytesOutput_obj > __new();
+ static ::hx::ObjectPtr< BytesOutput_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~BytesOutput_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("BytesOutput",ac,c5,0e,32); }
+
+ ::haxe::io::BytesBuffer b;
+ void writeByte(int c);
+
+ int writeBytes( ::haxe::io::Bytes buf,int pos,int len);
+
+ ::haxe::io::Bytes getBytes();
+ ::Dynamic getBytes_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace io
+
+#endif /* INCLUDED_haxe_io_BytesOutput */
diff --git a/Sources/c_snikket/iinclude/include/haxe/io/Encoding.h b/Sources/c_snikket/iinclude/include/haxe/io/Encoding.h
new file mode 100644
index 0000000..2103145
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/io/Encoding.h
@@ -0,0 +1,37 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_io_Encoding
+#define INCLUDED_haxe_io_Encoding
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,io,Encoding)
+namespace haxe{
+namespace io{
+
+
+class Encoding_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef Encoding_obj OBJ_;
+
+ public:
+ Encoding_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("haxe.io.Encoding",33,a6,6d,22); }
+ ::String __ToString() const { return HX_("Encoding.",db,8b,f5,be) + _hx_tag; }
+
+ static ::haxe::io::Encoding RawNative;
+ static inline ::haxe::io::Encoding RawNative_dyn() { return RawNative; }
+ static ::haxe::io::Encoding UTF8;
+ static inline ::haxe::io::Encoding UTF8_dyn() { return UTF8; }
+};
+
+} // end namespace haxe
+} // end namespace io
+
+#endif /* INCLUDED_haxe_io_Encoding */
diff --git a/Sources/c_snikket/iinclude/include/haxe/io/Eof.h b/Sources/c_snikket/iinclude/include/haxe/io/Eof.h
new file mode 100644
index 0000000..4daee4e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/io/Eof.h
@@ -0,0 +1,67 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_io_Eof
+#define INCLUDED_haxe_io_Eof
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_c4f7e3feda612c90_29_new)
+HX_DECLARE_CLASS2(haxe,io,Eof)
+
+namespace haxe{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES Eof_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Eof_obj OBJ_;
+ Eof_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1d7955d0 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="haxe.io.Eof")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"haxe.io.Eof"); }
+
+ inline static ::hx::ObjectPtr< Eof_obj > __new() {
+ ::hx::ObjectPtr< Eof_obj > __this = new Eof_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Eof_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Eof_obj *__this = (Eof_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Eof_obj), false, "haxe.io.Eof"));
+ *(void **)__this = Eof_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_c4f7e3feda612c90_29_new)
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Eof_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Eof",9c,bc,34,00); }
+
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace io
+
+#endif /* INCLUDED_haxe_io_Eof */
diff --git a/Sources/c_snikket/iinclude/include/haxe/io/Error.h b/Sources/c_snikket/iinclude/include/haxe/io/Error.h
new file mode 100644
index 0000000..83aadc4
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/io/Error.h
@@ -0,0 +1,41 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_io_Error
+#define INCLUDED_haxe_io_Error
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,io,Error)
+namespace haxe{
+namespace io{
+
+
+class Error_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef Error_obj OBJ_;
+
+ public:
+ Error_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("haxe.io.Error",68,16,01,55); }
+ ::String __ToString() const { return HX_("Error.",86,f7,fc,85) + _hx_tag; }
+
+ static ::haxe::io::Error Blocked;
+ static inline ::haxe::io::Error Blocked_dyn() { return Blocked; }
+ static ::haxe::io::Error Custom( ::Dynamic e);
+ static ::Dynamic Custom_dyn();
+ static ::haxe::io::Error OutsideBounds;
+ static inline ::haxe::io::Error OutsideBounds_dyn() { return OutsideBounds; }
+ static ::haxe::io::Error Overflow;
+ static inline ::haxe::io::Error Overflow_dyn() { return Overflow; }
+};
+
+} // end namespace haxe
+} // end namespace io
+
+#endif /* INCLUDED_haxe_io_Error */
diff --git a/Sources/c_snikket/iinclude/include/haxe/io/Input.h b/Sources/c_snikket/iinclude/include/haxe/io/Input.h
new file mode 100644
index 0000000..8e88cce
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/io/Input.h
@@ -0,0 +1,81 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_io_Input
+#define INCLUDED_haxe_io_Input
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,Input)
+
+namespace haxe{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES Input_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Input_obj OBJ_;
+ Input_obj();
+
+ public:
+ enum { _hx_ClassId = 0x19e22056 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="haxe.io.Input")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"haxe.io.Input"); }
+
+ inline static ::hx::ObjectPtr< Input_obj > __new() {
+ ::hx::ObjectPtr< Input_obj > __this = new Input_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Input_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Input_obj *__this = (Input_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Input_obj), false, "haxe.io.Input"));
+ *(void **)__this = Input_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Input_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Input",ea,33,4b,51); }
+
+ bool bigEndian;
+ virtual int readByte();
+ ::Dynamic readByte_dyn();
+
+ virtual int readBytes( ::haxe::io::Bytes s,int pos,int len);
+ ::Dynamic readBytes_dyn();
+
+ virtual void close();
+ ::Dynamic close_dyn();
+
+ bool set_bigEndian(bool b);
+ ::Dynamic set_bigEndian_dyn();
+
+ ::haxe::io::Bytes readAll( ::Dynamic bufsize);
+ ::Dynamic readAll_dyn();
+
+ int readInt32();
+ ::Dynamic readInt32_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace io
+
+#endif /* INCLUDED_haxe_io_Input */
diff --git a/Sources/c_snikket/iinclude/include/haxe/io/Output.h b/Sources/c_snikket/iinclude/include/haxe/io/Output.h
new file mode 100644
index 0000000..7fc6dc3
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/io/Output.h
@@ -0,0 +1,82 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_io_Output
+#define INCLUDED_haxe_io_Output
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,Encoding)
+HX_DECLARE_CLASS2(haxe,io,Output)
+
+namespace haxe{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES Output_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Output_obj OBJ_;
+ Output_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0a55a26d };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="haxe.io.Output")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"haxe.io.Output"); }
+
+ inline static ::hx::ObjectPtr< Output_obj > __new() {
+ ::hx::ObjectPtr< Output_obj > __this = new Output_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Output_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Output_obj *__this = (Output_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Output_obj), false, "haxe.io.Output"));
+ *(void **)__this = Output_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Output_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Output",21,83,15,41); }
+
+ virtual void writeByte(int c);
+ ::Dynamic writeByte_dyn();
+
+ virtual int writeBytes( ::haxe::io::Bytes s,int pos,int len);
+ ::Dynamic writeBytes_dyn();
+
+ virtual void close();
+ ::Dynamic close_dyn();
+
+ void write( ::haxe::io::Bytes s);
+ ::Dynamic write_dyn();
+
+ void writeFullBytes( ::haxe::io::Bytes s,int pos,int len);
+ ::Dynamic writeFullBytes_dyn();
+
+ void prepare(int nbytes);
+ ::Dynamic prepare_dyn();
+
+ void writeString(::String s, ::haxe::io::Encoding encoding);
+ ::Dynamic writeString_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace io
+
+#endif /* INCLUDED_haxe_io_Output */
diff --git a/Sources/c_snikket/iinclude/include/haxe/io/Path.h b/Sources/c_snikket/iinclude/include/haxe/io/Path.h
new file mode 100644
index 0000000..c3b75d8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/io/Path.h
@@ -0,0 +1,78 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_io_Path
+#define INCLUDED_haxe_io_Path
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,io,Path)
+
+namespace haxe{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES Path_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Path_obj OBJ_;
+ Path_obj();
+
+ public:
+ enum { _hx_ClassId = 0x026896d9 };
+
+ void __construct(::String path);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.io.Path")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.io.Path"); }
+ static ::hx::ObjectPtr< Path_obj > __new(::String path);
+ static ::hx::ObjectPtr< Path_obj > __alloc(::hx::Ctx *_hx_ctx,::String path);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Path_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Path",c5,11,2b,35); }
+
+ static ::String withoutDirectory(::String path);
+ static ::Dynamic withoutDirectory_dyn();
+
+ static ::String join(::Array< ::String > paths);
+ static ::Dynamic join_dyn();
+
+ static ::String normalize(::String path);
+ static ::Dynamic normalize_dyn();
+
+ static ::String addTrailingSlash(::String path);
+ static ::Dynamic addTrailingSlash_dyn();
+
+ static ::String removeTrailingSlashes(::String path);
+ static ::Dynamic removeTrailingSlashes_dyn();
+
+ static bool isAbsolute(::String path);
+ static ::Dynamic isAbsolute_dyn();
+
+ ::String dir;
+ ::String file;
+ ::String ext;
+ bool backslash;
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace io
+
+#endif /* INCLUDED_haxe_io_Path */
diff --git a/Sources/c_snikket/iinclude/include/haxe/iterators/ArrayIterator.h b/Sources/c_snikket/iinclude/include/haxe/iterators/ArrayIterator.h
new file mode 100644
index 0000000..15325b9
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/iterators/ArrayIterator.h
@@ -0,0 +1,78 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_iterators_ArrayIterator
+#define INCLUDED_haxe_iterators_ArrayIterator
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_44ded26575b0f4de_28_new)
+HX_DECLARE_CLASS2(haxe,iterators,ArrayIterator)
+
+namespace haxe{
+namespace iterators{
+
+
+class HXCPP_CLASS_ATTRIBUTES ArrayIterator_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef ArrayIterator_obj OBJ_;
+ ArrayIterator_obj();
+
+ public:
+ enum { _hx_ClassId = 0x189859c8 };
+
+ void __construct(::cpp::VirtualArray array);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.iterators.ArrayIterator")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.iterators.ArrayIterator"); }
+
+ inline static ::hx::ObjectPtr< ArrayIterator_obj > __new(::cpp::VirtualArray array) {
+ ::hx::ObjectPtr< ArrayIterator_obj > __this = new ArrayIterator_obj();
+ __this->__construct(array);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< ArrayIterator_obj > __alloc(::hx::Ctx *_hx_ctx,::cpp::VirtualArray array) {
+ ArrayIterator_obj *__this = (ArrayIterator_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(ArrayIterator_obj), true, "haxe.iterators.ArrayIterator"));
+ *(void **)__this = ArrayIterator_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_44ded26575b0f4de_28_new)
+HXLINE( 30) ( ( ::haxe::iterators::ArrayIterator)(__this) )->current = 0;
+HXLINE( 37) ( ( ::haxe::iterators::ArrayIterator)(__this) )->array = array;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ArrayIterator_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("ArrayIterator",87,84,c8,5d); }
+
+ ::cpp::VirtualArray array;
+ int current;
+ bool hasNext();
+ ::Dynamic hasNext_dyn();
+
+ ::Dynamic next();
+ ::Dynamic next_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace iterators
+
+#endif /* INCLUDED_haxe_iterators_ArrayIterator */
diff --git a/Sources/c_snikket/iinclude/include/haxe/iterators/MapKeyValueIterator.h b/Sources/c_snikket/iinclude/include/haxe/iterators/MapKeyValueIterator.h
new file mode 100644
index 0000000..22cf306
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/iterators/MapKeyValueIterator.h
@@ -0,0 +1,61 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_iterators_MapKeyValueIterator
+#define INCLUDED_haxe_iterators_MapKeyValueIterator
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,iterators,MapKeyValueIterator)
+
+namespace haxe{
+namespace iterators{
+
+
+class HXCPP_CLASS_ATTRIBUTES MapKeyValueIterator_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef MapKeyValueIterator_obj OBJ_;
+ MapKeyValueIterator_obj();
+
+ public:
+ enum { _hx_ClassId = 0x5732dffd };
+
+ void __construct(::Dynamic map);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.iterators.MapKeyValueIterator")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.iterators.MapKeyValueIterator"); }
+ static ::hx::ObjectPtr< MapKeyValueIterator_obj > __new(::Dynamic map);
+ static ::hx::ObjectPtr< MapKeyValueIterator_obj > __alloc(::hx::Ctx *_hx_ctx,::Dynamic map);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~MapKeyValueIterator_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("MapKeyValueIterator",fc,23,62,2c); }
+
+ ::Dynamic map;
+ ::Dynamic keys;
+ bool hasNext();
+ ::Dynamic hasNext_dyn();
+
+ ::Dynamic next();
+ ::Dynamic next_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace iterators
+
+#endif /* INCLUDED_haxe_iterators_MapKeyValueIterator */
diff --git a/Sources/c_snikket/iinclude/include/haxe/xml/Parser.h b/Sources/c_snikket/iinclude/include/haxe/xml/Parser.h
new file mode 100644
index 0000000..b6ef3d6
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/xml/Parser.h
@@ -0,0 +1,71 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_xml_Parser
+#define INCLUDED_haxe_xml_Parser
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(Xml)
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+HX_DECLARE_CLASS2(haxe,xml,Parser)
+
+namespace haxe{
+namespace xml{
+
+
+class HXCPP_CLASS_ATTRIBUTES Parser_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Parser_obj OBJ_;
+ Parser_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1c6f1730 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="haxe.xml.Parser")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"haxe.xml.Parser"); }
+
+ inline static ::hx::ObjectPtr< Parser_obj > __new() {
+ ::hx::ObjectPtr< Parser_obj > __this = new Parser_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Parser_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Parser_obj *__this = (Parser_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Parser_obj), false, "haxe.xml.Parser"));
+ *(void **)__this = Parser_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Parser_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Parser",ff,10,1d,22); }
+
+ static void __boot();
+ static ::haxe::ds::StringMap escapes;
+ static ::Xml parse(::String str,::hx::Null< bool > strict);
+ static ::Dynamic parse_dyn();
+
+ static int doParse(::String str,bool strict,::hx::Null< int > p, ::Xml parent);
+ static ::Dynamic doParse_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace xml
+
+#endif /* INCLUDED_haxe_xml_Parser */
diff --git a/Sources/c_snikket/iinclude/include/haxe/xml/Printer.h b/Sources/c_snikket/iinclude/include/haxe/xml/Printer.h
new file mode 100644
index 0000000..5b159a1
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/xml/Printer.h
@@ -0,0 +1,66 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_xml_Printer
+#define INCLUDED_haxe_xml_Printer
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(StringBuf)
+HX_DECLARE_CLASS0(Xml)
+HX_DECLARE_CLASS2(haxe,xml,Printer)
+
+namespace haxe{
+namespace xml{
+
+
+class HXCPP_CLASS_ATTRIBUTES Printer_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Printer_obj OBJ_;
+ Printer_obj();
+
+ public:
+ enum { _hx_ClassId = 0x5ef86269 };
+
+ void __construct(bool pretty);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.xml.Printer")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.xml.Printer"); }
+ static ::hx::ObjectPtr< Printer_obj > __new(bool pretty);
+ static ::hx::ObjectPtr< Printer_obj > __alloc(::hx::Ctx *_hx_ctx,bool pretty);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Printer_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Printer",ba,fd,84,51); }
+
+ static ::String print( ::Xml xml, ::Dynamic pretty);
+ static ::Dynamic print_dyn();
+
+ ::StringBuf output;
+ bool pretty;
+ void writeNode( ::Xml value,::String tabs);
+ ::Dynamic writeNode_dyn();
+
+ bool hasChildren( ::Xml value);
+ ::Dynamic hasChildren_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace xml
+
+#endif /* INCLUDED_haxe_xml_Printer */
diff --git a/Sources/c_snikket/iinclude/include/haxe/xml/XmlParserException.h b/Sources/c_snikket/iinclude/include/haxe/xml/XmlParserException.h
new file mode 100644
index 0000000..a842951
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/haxe/xml/XmlParserException.h
@@ -0,0 +1,60 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_haxe_xml_XmlParserException
+#define INCLUDED_haxe_xml_XmlParserException
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,xml,XmlParserException)
+
+namespace haxe{
+namespace xml{
+
+
+class HXCPP_CLASS_ATTRIBUTES XmlParserException_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef XmlParserException_obj OBJ_;
+ XmlParserException_obj();
+
+ public:
+ enum { _hx_ClassId = 0x75f2332a };
+
+ void __construct(::String message,::String xml,int position);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="haxe.xml.XmlParserException")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"haxe.xml.XmlParserException"); }
+ static ::hx::ObjectPtr< XmlParserException_obj > __new(::String message,::String xml,int position);
+ static ::hx::ObjectPtr< XmlParserException_obj > __alloc(::hx::Ctx *_hx_ctx,::String message,::String xml,int position);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~XmlParserException_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("XmlParserException",79,27,d7,6b); }
+
+ ::String message;
+ int lineNumber;
+ int positionAtLine;
+ int position;
+ ::String xml;
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+};
+
+} // end namespace haxe
+} // end namespace xml
+
+#endif /* INCLUDED_haxe_xml_XmlParserException */
diff --git a/Sources/c_snikket/iinclude/include/hsluv/Hsluv.h b/Sources/c_snikket/iinclude/include/hsluv/Hsluv.h
new file mode 100644
index 0000000..f90390a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/hsluv/Hsluv.h
@@ -0,0 +1,138 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_hsluv_Hsluv
+#define INCLUDED_hsluv_Hsluv
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(hsluv,Hsluv)
+
+namespace hsluv{
+
+
+class HXCPP_CLASS_ATTRIBUTES Hsluv_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Hsluv_obj OBJ_;
+ Hsluv_obj();
+
+ public:
+ enum { _hx_ClassId = 0x29e47ee8 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="hsluv.Hsluv")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"hsluv.Hsluv"); }
+ static ::hx::ObjectPtr< Hsluv_obj > __new();
+ static ::hx::ObjectPtr< Hsluv_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Hsluv_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Hsluv",82,a7,2f,c1); }
+
+ static void __boot();
+ static ::String hexChars;
+ static Float refY;
+ static Float refU;
+ static Float refV;
+ static Float kappa;
+ static Float epsilon;
+ static Float m_r0;
+ static Float m_r1;
+ static Float m_r2;
+ static Float m_g0;
+ static Float m_g1;
+ static Float m_g2;
+ static Float m_b0;
+ static Float m_b1;
+ static Float m_b2;
+ static Float fromLinear(Float c);
+ static ::Dynamic fromLinear_dyn();
+
+ static Float lToY(Float L);
+ static ::Dynamic lToY_dyn();
+
+ static ::String rgbChannelToHex(Float chan);
+ static ::Dynamic rgbChannelToHex_dyn();
+
+ static Float distanceFromOriginAngle(Float slope,Float intercept,Float angle);
+ static ::Dynamic distanceFromOriginAngle_dyn();
+
+ static Float min6(Float f1,Float f2,Float f3,Float f4,Float f5,Float f6);
+ static ::Dynamic min6_dyn();
+
+ ::String hex;
+ Float rgb_r;
+ Float rgb_g;
+ Float rgb_b;
+ Float xyz_x;
+ Float xyz_y;
+ Float xyz_z;
+ Float luv_l;
+ Float luv_u;
+ Float luv_v;
+ Float lch_l;
+ Float lch_c;
+ Float lch_h;
+ Float hsluv_h;
+ Float hsluv_s;
+ Float hsluv_l;
+ Float r0s;
+ Float r0i;
+ Float r1s;
+ Float r1i;
+ Float g0s;
+ Float g0i;
+ Float g1s;
+ Float g1i;
+ Float b0s;
+ Float b0i;
+ Float b1s;
+ Float b1i;
+ void rgbToHex();
+ ::Dynamic rgbToHex_dyn();
+
+ void xyzToRgb();
+ ::Dynamic xyzToRgb_dyn();
+
+ void luvToXyz();
+ ::Dynamic luvToXyz_dyn();
+
+ void lchToLuv();
+ ::Dynamic lchToLuv_dyn();
+
+ void calculateBoundingLines(Float l);
+ ::Dynamic calculateBoundingLines_dyn();
+
+ Float calcMaxChromaHsluv(Float h);
+ ::Dynamic calcMaxChromaHsluv_dyn();
+
+ void hsluvToLch();
+ ::Dynamic hsluvToLch_dyn();
+
+ void hsluvToRgb();
+ ::Dynamic hsluvToRgb_dyn();
+
+ void hsluvToHex();
+ ::Dynamic hsluvToHex_dyn();
+
+};
+
+} // end namespace hsluv
+
+#endif /* INCLUDED_hsluv_Hsluv */
diff --git a/Sources/c_snikket/iinclude/include/htmlparser/HtmlAttribute.h b/Sources/c_snikket/iinclude/include/htmlparser/HtmlAttribute.h
new file mode 100644
index 0000000..f473c92
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/htmlparser/HtmlAttribute.h
@@ -0,0 +1,72 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_htmlparser_HtmlAttribute
+#define INCLUDED_htmlparser_HtmlAttribute
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_630f17b70ccedfe6_10_new)
+HX_DECLARE_CLASS1(htmlparser,HtmlAttribute)
+
+namespace htmlparser{
+
+
+class HXCPP_CLASS_ATTRIBUTES HtmlAttribute_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef HtmlAttribute_obj OBJ_;
+ HtmlAttribute_obj();
+
+ public:
+ enum { _hx_ClassId = 0x49e2a647 };
+
+ void __construct(::String name,::String value,::String quote);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="htmlparser.HtmlAttribute")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"htmlparser.HtmlAttribute"); }
+
+ inline static ::hx::ObjectPtr< HtmlAttribute_obj > __new(::String name,::String value,::String quote) {
+ ::hx::ObjectPtr< HtmlAttribute_obj > __this = new HtmlAttribute_obj();
+ __this->__construct(name,value,quote);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< HtmlAttribute_obj > __alloc(::hx::Ctx *_hx_ctx,::String name,::String value,::String quote) {
+ HtmlAttribute_obj *__this = (HtmlAttribute_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(HtmlAttribute_obj), true, "htmlparser.HtmlAttribute"));
+ *(void **)__this = HtmlAttribute_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_630f17b70ccedfe6_10_new)
+HXLINE( 11) ( ( ::htmlparser::HtmlAttribute)(__this) )->name = name;
+HXLINE( 12) ( ( ::htmlparser::HtmlAttribute)(__this) )->value = value;
+HXLINE( 13) ( ( ::htmlparser::HtmlAttribute)(__this) )->quote = quote;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~HtmlAttribute_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("HtmlAttribute",11,85,c2,03); }
+
+ ::String name;
+ ::String value;
+ ::String quote;
+};
+
+} // end namespace htmlparser
+
+#endif /* INCLUDED_htmlparser_HtmlAttribute */
diff --git a/Sources/c_snikket/iinclude/include/htmlparser/HtmlNode.h b/Sources/c_snikket/iinclude/include/htmlparser/HtmlNode.h
new file mode 100644
index 0000000..2b2ab6c
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/htmlparser/HtmlNode.h
@@ -0,0 +1,63 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_htmlparser_HtmlNode
+#define INCLUDED_htmlparser_HtmlNode
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(htmlparser,HtmlNode)
+HX_DECLARE_CLASS1(htmlparser,HtmlNodeElement)
+
+namespace htmlparser{
+
+
+class HXCPP_CLASS_ATTRIBUTES HtmlNode_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef HtmlNode_obj OBJ_;
+ HtmlNode_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0ca65a7f };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="htmlparser.HtmlNode")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"htmlparser.HtmlNode"); }
+
+ inline static ::hx::ObjectPtr< HtmlNode_obj > __new() {
+ ::hx::ObjectPtr< HtmlNode_obj > __this = new HtmlNode_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< HtmlNode_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ HtmlNode_obj *__this = (HtmlNode_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(HtmlNode_obj), true, "htmlparser.HtmlNode"));
+ *(void **)__this = HtmlNode_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~HtmlNode_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("HtmlNode",2d,19,fa,e5); }
+
+ ::htmlparser::HtmlNodeElement parent;
+};
+
+} // end namespace htmlparser
+
+#endif /* INCLUDED_htmlparser_HtmlNode */
diff --git a/Sources/c_snikket/iinclude/include/htmlparser/HtmlNodeElement.h b/Sources/c_snikket/iinclude/include/htmlparser/HtmlNodeElement.h
new file mode 100644
index 0000000..6960292
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/htmlparser/HtmlNodeElement.h
@@ -0,0 +1,62 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_htmlparser_HtmlNodeElement
+#define INCLUDED_htmlparser_HtmlNodeElement
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_htmlparser_HtmlNode
+#include <htmlparser/HtmlNode.h>
+#endif
+HX_DECLARE_CLASS1(htmlparser,HtmlAttribute)
+HX_DECLARE_CLASS1(htmlparser,HtmlNode)
+HX_DECLARE_CLASS1(htmlparser,HtmlNodeElement)
+
+namespace htmlparser{
+
+
+class HXCPP_CLASS_ATTRIBUTES HtmlNodeElement_obj : public ::htmlparser::HtmlNode_obj
+{
+ public:
+ typedef ::htmlparser::HtmlNode_obj super;
+ typedef HtmlNodeElement_obj OBJ_;
+ HtmlNodeElement_obj();
+
+ public:
+ enum { _hx_ClassId = 0x234247c5 };
+
+ void __construct(::String name,::Array< ::Dynamic> attributes);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="htmlparser.HtmlNodeElement")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"htmlparser.HtmlNodeElement"); }
+ static ::hx::ObjectPtr< HtmlNodeElement_obj > __new(::String name,::Array< ::Dynamic> attributes);
+ static ::hx::ObjectPtr< HtmlNodeElement_obj > __alloc(::hx::Ctx *_hx_ctx,::String name,::Array< ::Dynamic> attributes);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~HtmlNodeElement_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("HtmlNodeElement",0f,ed,ee,fb); }
+
+ ::String name;
+ ::Array< ::Dynamic> attributes;
+ ::Array< ::Dynamic> nodes;
+ ::Array< ::Dynamic> children;
+ void addChild( ::htmlparser::HtmlNode node, ::htmlparser::HtmlNode beforeNode);
+ ::Dynamic addChild_dyn();
+
+};
+
+} // end namespace htmlparser
+
+#endif /* INCLUDED_htmlparser_HtmlNodeElement */
diff --git a/Sources/c_snikket/iinclude/include/htmlparser/HtmlNodeText.h b/Sources/c_snikket/iinclude/include/htmlparser/HtmlNodeText.h
new file mode 100644
index 0000000..82be3b5
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/htmlparser/HtmlNodeText.h
@@ -0,0 +1,58 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_htmlparser_HtmlNodeText
+#define INCLUDED_htmlparser_HtmlNodeText
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_htmlparser_HtmlNode
+#include <htmlparser/HtmlNode.h>
+#endif
+HX_DECLARE_CLASS1(htmlparser,HtmlNode)
+HX_DECLARE_CLASS1(htmlparser,HtmlNodeText)
+
+namespace htmlparser{
+
+
+class HXCPP_CLASS_ATTRIBUTES HtmlNodeText_obj : public ::htmlparser::HtmlNode_obj
+{
+ public:
+ typedef ::htmlparser::HtmlNode_obj super;
+ typedef HtmlNodeText_obj OBJ_;
+ HtmlNodeText_obj();
+
+ public:
+ enum { _hx_ClassId = 0x699e2404 };
+
+ void __construct(::String text);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="htmlparser.HtmlNodeText")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"htmlparser.HtmlNodeText"); }
+ static ::hx::ObjectPtr< HtmlNodeText_obj > __new(::String text);
+ static ::hx::ObjectPtr< HtmlNodeText_obj > __alloc(::hx::Ctx *_hx_ctx,::String text);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~HtmlNodeText_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("HtmlNodeText",7a,ac,55,90); }
+
+ ::String text;
+ ::String toText();
+ ::Dynamic toText_dyn();
+
+};
+
+} // end namespace htmlparser
+
+#endif /* INCLUDED_htmlparser_HtmlNodeText */
diff --git a/Sources/c_snikket/iinclude/include/htmlparser/HtmlParser.h b/Sources/c_snikket/iinclude/include/htmlparser/HtmlParser.h
new file mode 100644
index 0000000..88c417e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/htmlparser/HtmlParser.h
@@ -0,0 +1,98 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_htmlparser_HtmlParser
+#define INCLUDED_htmlparser_HtmlParser
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(EReg)
+HX_DECLARE_CLASS1(htmlparser,HtmlAttribute)
+HX_DECLARE_CLASS1(htmlparser,HtmlNode)
+HX_DECLARE_CLASS1(htmlparser,HtmlNodeElement)
+HX_DECLARE_CLASS1(htmlparser,HtmlParser)
+
+namespace htmlparser{
+
+
+class HXCPP_CLASS_ATTRIBUTES HtmlParser_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef HtmlParser_obj OBJ_;
+ HtmlParser_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0d37c69c };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="htmlparser.HtmlParser")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"htmlparser.HtmlParser"); }
+ static ::hx::ObjectPtr< HtmlParser_obj > __new();
+ static ::hx::ObjectPtr< HtmlParser_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~HtmlParser_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("HtmlParser",ca,0c,fb,b1); }
+
+ static void __boot();
+ static ::Dynamic SELF_CLOSING_TAGS_HTML;
+ static ::String reID;
+ static ::String reNamespacedID;
+ static ::String reCDATA;
+ static ::String reScript;
+ static ::String reStyle;
+ static ::String reElementOpen;
+ static ::String reAttr;
+ static ::String reElementEnd;
+ static ::String reElementClose;
+ static ::String reComment;
+ static ::EReg reMain;
+ static ::EReg reParseAttrs;
+ static ::Array< ::Dynamic> run(::String str,::hx::Null< bool > tolerant);
+ static ::Dynamic run_dyn();
+
+ static ::Array< ::Dynamic> parseAttrs(::String str);
+ static ::Dynamic parseAttrs_dyn();
+
+ bool tolerant;
+ ::Array< ::Dynamic> matches;
+ ::String str;
+ int i;
+ ::Array< ::Dynamic> parse(::String str,::hx::Null< bool > tolerant);
+ ::Dynamic parse_dyn();
+
+ ::Dynamic processMatches(::Array< ::String > openedTagsLC);
+ ::Dynamic processMatches_dyn();
+
+ ::Dynamic parseElement(::Array< ::String > openedTagsLC);
+ ::Dynamic parseElement_dyn();
+
+ bool isSelfClosingTag(::String tag);
+ ::Dynamic isSelfClosingTag_dyn();
+
+ ::htmlparser::HtmlNodeElement newElement(::String name,::Array< ::Dynamic> attributes);
+ ::Dynamic newElement_dyn();
+
+ ::Dynamic getPosition(int matchIndex);
+ ::Dynamic getPosition_dyn();
+
+};
+
+} // end namespace htmlparser
+
+#endif /* INCLUDED_htmlparser_HtmlParser */
diff --git a/Sources/c_snikket/iinclude/include/htmlparser/HtmlParserException.h b/Sources/c_snikket/iinclude/include/htmlparser/HtmlParserException.h
new file mode 100644
index 0000000..e32202a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/htmlparser/HtmlParserException.h
@@ -0,0 +1,77 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_htmlparser_HtmlParserException
+#define INCLUDED_htmlparser_HtmlParserException
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_8ec4e8a8c4e51446_12_new)
+HX_DECLARE_CLASS1(htmlparser,HtmlParserException)
+
+namespace htmlparser{
+
+
+class HXCPP_CLASS_ATTRIBUTES HtmlParserException_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef HtmlParserException_obj OBJ_;
+ HtmlParserException_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0872044b };
+
+ void __construct(::String message, ::Dynamic pos);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="htmlparser.HtmlParserException")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"htmlparser.HtmlParserException"); }
+
+ inline static ::hx::ObjectPtr< HtmlParserException_obj > __new(::String message, ::Dynamic pos) {
+ ::hx::ObjectPtr< HtmlParserException_obj > __this = new HtmlParserException_obj();
+ __this->__construct(message,pos);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< HtmlParserException_obj > __alloc(::hx::Ctx *_hx_ctx,::String message, ::Dynamic pos) {
+ HtmlParserException_obj *__this = (HtmlParserException_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(HtmlParserException_obj), true, "htmlparser.HtmlParserException"));
+ *(void **)__this = HtmlParserException_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_8ec4e8a8c4e51446_12_new)
+HXLINE( 13) ( ( ::htmlparser::HtmlParserException)(__this) )->message = message;
+HXLINE( 15) ( ( ::htmlparser::HtmlParserException)(__this) )->line = ( (int)(pos->__Field(HX_("line",f4,17,b3,47),::hx::paccDynamic)) );
+HXLINE( 16) ( ( ::htmlparser::HtmlParserException)(__this) )->column = ( (int)(pos->__Field(HX_("column",d6,4e,8b,c6),::hx::paccDynamic)) );
+HXLINE( 17) ( ( ::htmlparser::HtmlParserException)(__this) )->length = ( (int)(pos->__Field(HX_("length",e6,94,07,9f),::hx::paccDynamic)) );
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~HtmlParserException_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("HtmlParserException",25,fa,72,da); }
+
+ ::String message;
+ int line;
+ int column;
+ int length;
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+};
+
+} // end namespace htmlparser
+
+#endif /* INCLUDED_htmlparser_HtmlParserException */
diff --git a/Sources/c_snikket/iinclude/include/htmlparser/HtmlTools.h b/Sources/c_snikket/iinclude/include/htmlparser/HtmlTools.h
new file mode 100644
index 0000000..a082fb8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/htmlparser/HtmlTools.h
@@ -0,0 +1,67 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_htmlparser_HtmlTools
+#define INCLUDED_htmlparser_HtmlTools
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+HX_DECLARE_CLASS1(htmlparser,HtmlTools)
+
+namespace htmlparser{
+
+
+class HXCPP_CLASS_ATTRIBUTES HtmlTools_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef HtmlTools_obj OBJ_;
+ HtmlTools_obj();
+
+ public:
+ enum { _hx_ClassId = 0x319122e2 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="htmlparser.HtmlTools")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"htmlparser.HtmlTools"); }
+
+ inline static ::hx::ObjectPtr< HtmlTools_obj > __new() {
+ ::hx::ObjectPtr< HtmlTools_obj > __this = new HtmlTools_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< HtmlTools_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ HtmlTools_obj *__this = (HtmlTools_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(HtmlTools_obj), false, "htmlparser.HtmlTools"));
+ *(void **)__this = HtmlTools_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~HtmlTools_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("HtmlTools",90,c8,4b,c9); }
+
+ static ::haxe::ds::StringMap htmlUnescapeMap;
+ static ::haxe::ds::StringMap get_htmlUnescapeMap();
+ static ::Dynamic get_htmlUnescapeMap_dyn();
+
+ static ::String unescape(::String text);
+ static ::Dynamic unescape_dyn();
+
+};
+
+} // end namespace htmlparser
+
+#endif /* INCLUDED_htmlparser_HtmlTools */
diff --git a/Sources/c_snikket/iinclude/include/httpstatus/_HttpStatusMessage/HttpStatusMessage_Impl_.h b/Sources/c_snikket/iinclude/include/httpstatus/_HttpStatusMessage/HttpStatusMessage_Impl_.h
new file mode 100644
index 0000000..dfe9b21
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/httpstatus/_HttpStatusMessage/HttpStatusMessage_Impl_.h
@@ -0,0 +1,62 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_httpstatus__HttpStatusMessage_HttpStatusMessage_Impl_
+#define INCLUDED_httpstatus__HttpStatusMessage_HttpStatusMessage_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(httpstatus,_HttpStatusMessage,HttpStatusMessage_Impl_)
+
+namespace httpstatus{
+namespace _HttpStatusMessage{
+
+
+class HXCPP_CLASS_ATTRIBUTES HttpStatusMessage_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef HttpStatusMessage_Impl__obj OBJ_;
+ HttpStatusMessage_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x0de4d9f9 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="httpstatus._HttpStatusMessage.HttpStatusMessage_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"httpstatus._HttpStatusMessage.HttpStatusMessage_Impl_"); }
+
+ inline static ::hx::ObjectPtr< HttpStatusMessage_Impl__obj > __new() {
+ ::hx::ObjectPtr< HttpStatusMessage_Impl__obj > __this = new HttpStatusMessage_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< HttpStatusMessage_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ HttpStatusMessage_Impl__obj *__this = (HttpStatusMessage_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(HttpStatusMessage_Impl__obj), false, "httpstatus._HttpStatusMessage.HttpStatusMessage_Impl_"));
+ *(void **)__this = HttpStatusMessage_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~HttpStatusMessage_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("HttpStatusMessage_Impl_",4d,ec,1b,89); }
+
+ static ::String fromCode(int statusCode);
+ static ::Dynamic fromCode_dyn();
+
+};
+
+} // end namespace httpstatus
+} // end namespace _HttpStatusMessage
+
+#endif /* INCLUDED_httpstatus__HttpStatusMessage_HttpStatusMessage_Impl_ */
diff --git a/Sources/c_snikket/iinclude/include/hx/strings/RandomStrings.h b/Sources/c_snikket/iinclude/include/hx/strings/RandomStrings.h
new file mode 100644
index 0000000..ff1c160
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/hx/strings/RandomStrings.h
@@ -0,0 +1,74 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_hx_strings_RandomStrings
+#define INCLUDED_hx_strings_RandomStrings
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(hx,strings,RandomStrings)
+HX_DECLARE_CLASS4(hx,strings,internal,_Either2,_Either2)
+
+namespace hx{
+namespace strings{
+
+
+class HXCPP_CLASS_ATTRIBUTES RandomStrings_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef RandomStrings_obj OBJ_;
+ RandomStrings_obj();
+
+ public:
+ enum { _hx_ClassId = 0x48d6a291 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="hx.strings.RandomStrings")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"hx.strings.RandomStrings"); }
+
+ inline static ::hx::ObjectPtr< RandomStrings_obj > __new() {
+ ::hx::ObjectPtr< RandomStrings_obj > __this = new RandomStrings_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< RandomStrings_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ RandomStrings_obj *__this = (RandomStrings_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(RandomStrings_obj), false, "hx.strings.RandomStrings"));
+ *(void **)__this = RandomStrings_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~RandomStrings_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("RandomStrings",9f,7a,45,55); }
+
+ static void __boot();
+ static ::Array< int > DIGITS;
+ static ::Array< int > _genAsciiAlpha();
+ static ::Dynamic _genAsciiAlpha_dyn();
+
+ static ::Array< int > ASCII_ALPHA;
+ static ::Array< int > ASCII_ALPHA_NUMERIC;
+ static ::String random(int length, ::hx::strings::internal::_Either2::_Either2 chars);
+ static ::Dynamic random_dyn();
+
+ static ::String randomUUIDv4(::String separator);
+ static ::Dynamic randomUUIDv4_dyn();
+
+};
+
+} // end namespace hx
+} // end namespace strings
+
+#endif /* INCLUDED_hx_strings_RandomStrings */
diff --git a/Sources/c_snikket/iinclude/include/hx/strings/StringBuilder.h b/Sources/c_snikket/iinclude/include/hx/strings/StringBuilder.h
new file mode 100644
index 0000000..8115925
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/hx/strings/StringBuilder.h
@@ -0,0 +1,70 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_hx_strings_StringBuilder
+#define INCLUDED_hx_strings_StringBuilder
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(StringBuf)
+HX_DECLARE_CLASS2(hx,strings,StringBuilder)
+
+namespace hx{
+namespace strings{
+
+
+class HXCPP_CLASS_ATTRIBUTES StringBuilder_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef StringBuilder_obj OBJ_;
+ StringBuilder_obj();
+
+ public:
+ enum { _hx_ClassId = 0x32066fb8 };
+
+ void __construct(::String initialContent);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="hx.strings.StringBuilder")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"hx.strings.StringBuilder"); }
+ static ::hx::ObjectPtr< StringBuilder_obj > __new(::String initialContent);
+ static ::hx::ObjectPtr< StringBuilder_obj > __alloc(::hx::Ctx *_hx_ctx,::String initialContent);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~StringBuilder_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("StringBuilder",2a,56,d0,8d); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ ::StringBuf sb;
+ ::Array< ::String > pre;
+ int len;
+ ::hx::strings::StringBuilder add(::String item);
+ ::Dynamic add_dyn();
+
+ ::hx::strings::StringBuilder addChar(int ch);
+ ::Dynamic addChar_dyn();
+
+ ::hx::strings::StringBuilder clear();
+ ::Dynamic clear_dyn();
+
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+};
+
+} // end namespace hx
+} // end namespace strings
+
+#endif /* INCLUDED_hx_strings_StringBuilder */
diff --git a/Sources/c_snikket/iinclude/include/hx/strings/Strings.h b/Sources/c_snikket/iinclude/include/hx/strings/Strings.h
new file mode 100644
index 0000000..6629ee7
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/hx/strings/Strings.h
@@ -0,0 +1,62 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_hx_strings_Strings
+#define INCLUDED_hx_strings_Strings
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(hx,strings,Strings)
+
+namespace hx{
+namespace strings{
+
+
+class HXCPP_CLASS_ATTRIBUTES Strings_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Strings_obj OBJ_;
+ Strings_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0e5b539c };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="hx.strings.Strings")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"hx.strings.Strings"); }
+
+ inline static ::hx::ObjectPtr< Strings_obj > __new() {
+ ::hx::ObjectPtr< Strings_obj > __this = new Strings_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Strings_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Strings_obj *__this = (Strings_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Strings_obj), false, "hx.strings.Strings"));
+ *(void **)__this = Strings_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Strings_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Strings",62,b6,44,c6); }
+
+ static ::Array< int > toChars(::String str);
+ static ::Dynamic toChars_dyn();
+
+};
+
+} // end namespace hx
+} // end namespace strings
+
+#endif /* INCLUDED_hx_strings_Strings */
diff --git a/Sources/c_snikket/iinclude/include/hx/strings/internal/_Either2/_Either2.h b/Sources/c_snikket/iinclude/include/hx/strings/internal/_Either2/_Either2.h
new file mode 100644
index 0000000..189b578
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/hx/strings/internal/_Either2/_Either2.h
@@ -0,0 +1,41 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_hx_strings_internal__Either2__Either2
+#define INCLUDED_hx_strings_internal__Either2__Either2
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS4(hx,strings,internal,_Either2,_Either2)
+namespace hx{
+namespace strings{
+namespace internal{
+namespace _Either2{
+
+
+class _Either2_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef _Either2_obj OBJ_;
+
+ public:
+ _Either2_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("hx.strings.internal._Either2._Either2",07,08,e6,82); }
+ ::String __ToString() const { return HX_("_Either2.",c0,d7,a7,46) + _hx_tag; }
+
+ static ::hx::strings::internal::_Either2::_Either2 a( ::Dynamic v);
+ static ::Dynamic a_dyn();
+ static ::hx::strings::internal::_Either2::_Either2 b( ::Dynamic v);
+ static ::Dynamic b_dyn();
+};
+
+} // end namespace hx
+} // end namespace strings
+} // end namespace internal
+} // end namespace _Either2
+
+#endif /* INCLUDED_hx_strings_internal__Either2__Either2 */
diff --git a/Sources/c_snikket/iinclude/include/sha/Hash.h b/Sources/c_snikket/iinclude/include/sha/Hash.h
new file mode 100644
index 0000000..105a34b
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sha/Hash.h
@@ -0,0 +1,60 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sha_Hash
+#define INCLUDED_sha_Hash
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS1(sha,Hash)
+
+namespace sha{
+
+
+class HXCPP_CLASS_ATTRIBUTES Hash_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Hash_obj OBJ_;
+ Hash_obj();
+
+ public:
+ enum { _hx_ClassId = 0x49a7eb1a };
+
+ void __construct(int blockSize,int finalSize);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sha.Hash")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sha.Hash"); }
+
+ //~Hash_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Hash",ee,5b,e1,2f); }
+
+ int finalSize;
+ int length;
+ ::haxe::io::Bytes block;
+ ::sha::Hash update( ::haxe::io::Bytes data);
+ ::Dynamic update_dyn();
+
+ ::haxe::io::Bytes digest();
+ ::Dynamic digest_dyn();
+
+ virtual void _update( ::haxe::io::Bytes data) {}
+ ::Dynamic _update_dyn();
+ virtual ::haxe::io::Bytes _hash() { return 0; }
+ ::Dynamic _hash_dyn();
+};
+
+} // end namespace sha
+
+#endif /* INCLUDED_sha_Hash */
diff --git a/Sources/c_snikket/iinclude/include/sha/SHA256.h b/Sources/c_snikket/iinclude/include/sha/SHA256.h
new file mode 100644
index 0000000..28722a8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sha/SHA256.h
@@ -0,0 +1,86 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sha_SHA256
+#define INCLUDED_sha_SHA256
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_sha_Hash
+#include <sha/Hash.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS1(sha,Hash)
+HX_DECLARE_CLASS1(sha,SHA256)
+
+namespace sha{
+
+
+class HXCPP_CLASS_ATTRIBUTES SHA256_obj : public ::sha::Hash_obj
+{
+ public:
+ typedef ::sha::Hash_obj super;
+ typedef SHA256_obj OBJ_;
+ SHA256_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0251ab23 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sha.SHA256")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sha.SHA256"); }
+ static ::hx::ObjectPtr< SHA256_obj > __new();
+ static ::hx::ObjectPtr< SHA256_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SHA256_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("SHA256",87,b4,95,cf); }
+
+ int _a;
+ int _b;
+ int _c;
+ int _d;
+ int _e;
+ int _f;
+ int _g;
+ int _h;
+ ::Array< int > _w;
+ int sigma0(int x);
+ ::Dynamic sigma0_dyn();
+
+ int sigma1(int x);
+ ::Dynamic sigma1_dyn();
+
+ int gamma0(int x);
+ ::Dynamic gamma0_dyn();
+
+ int gamma1(int x);
+ ::Dynamic gamma1_dyn();
+
+ int ch(int x,int y,int z);
+ ::Dynamic ch_dyn();
+
+ int maj(int x,int y,int z);
+ ::Dynamic maj_dyn();
+
+ void _update( ::haxe::io::Bytes data);
+
+ ::haxe::io::Bytes _hash();
+
+};
+
+} // end namespace sha
+
+#endif /* INCLUDED_sha_SHA256 */
diff --git a/Sources/c_snikket/iinclude/include/sha/_SHA256/SHA256_Fields_.h b/Sources/c_snikket/iinclude/include/sha/_SHA256/SHA256_Fields_.h
new file mode 100644
index 0000000..3d1d69a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sha/_SHA256/SHA256_Fields_.h
@@ -0,0 +1,62 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sha__SHA256_SHA256_Fields_
+#define INCLUDED_sha__SHA256_SHA256_Fields_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(sha,_SHA256,SHA256_Fields_)
+
+namespace sha{
+namespace _SHA256{
+
+
+class HXCPP_CLASS_ATTRIBUTES SHA256_Fields__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef SHA256_Fields__obj OBJ_;
+ SHA256_Fields__obj();
+
+ public:
+ enum { _hx_ClassId = 0x07d39014 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="sha._SHA256.SHA256_Fields_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"sha._SHA256.SHA256_Fields_"); }
+
+ inline static ::hx::ObjectPtr< SHA256_Fields__obj > __new() {
+ ::hx::ObjectPtr< SHA256_Fields__obj > __this = new SHA256_Fields__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< SHA256_Fields__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ SHA256_Fields__obj *__this = (SHA256_Fields__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(SHA256_Fields__obj), false, "sha._SHA256.SHA256_Fields_"));
+ *(void **)__this = SHA256_Fields__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SHA256_Fields__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("SHA256_Fields_",ae,b0,ef,ea); }
+
+ static void __boot();
+ static ::Array< int > K;
+};
+
+} // end namespace sha
+} // end namespace _SHA256
+
+#endif /* INCLUDED_sha__SHA256_SHA256_Fields_ */
diff --git a/Sources/c_snikket/iinclude/include/snikket/AttachmentSource.h b/Sources/c_snikket/iinclude/include/snikket/AttachmentSource.h
new file mode 100644
index 0000000..35e0bb9
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/AttachmentSource.h
@@ -0,0 +1,72 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_AttachmentSource
+#define INCLUDED_snikket_AttachmentSource
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,AttachmentSource)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES AttachmentSource_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef AttachmentSource_obj OBJ_;
+ AttachmentSource_obj();
+
+ public:
+ enum { _hx_ClassId = 0x3b403b17 };
+
+ void __construct(::String path,::String mime);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.AttachmentSource")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.AttachmentSource"); }
+ static ::hx::ObjectPtr< AttachmentSource_obj > __new(::String path,::String mime);
+ static ::hx::ObjectPtr< AttachmentSource_obj > __alloc(::hx::Ctx *_hx_ctx,::String path,::String mime);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~AttachmentSource_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("AttachmentSource",3e,95,3b,6c); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ ::String path;
+ ::String path__fromC();
+ ::Dynamic path__fromC_dyn();
+
+ ::String type;
+ ::String type__fromC();
+ ::Dynamic type__fromC_dyn();
+
+ ::String name;
+ ::String name__fromC();
+ ::Dynamic name__fromC_dyn();
+
+ int size;
+ int size__fromC();
+ ::Dynamic size__fromC_dyn();
+
+ ::Dynamic tinkSource();
+ ::Dynamic tinkSource_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_AttachmentSource */
diff --git a/Sources/c_snikket/iinclude/include/snikket/Autolink.h b/Sources/c_snikket/iinclude/include/snikket/Autolink.h
new file mode 100644
index 0000000..f244927
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/Autolink.h
@@ -0,0 +1,90 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Autolink
+#define INCLUDED_snikket_Autolink
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Autolink)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Autolink_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Autolink_obj OBJ_;
+ Autolink_obj();
+
+ public:
+ enum { _hx_ClassId = 0x257fedc6 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="snikket.Autolink")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"snikket.Autolink"); }
+
+ inline static ::hx::ObjectPtr< Autolink_obj > __new() {
+ ::hx::ObjectPtr< Autolink_obj > __this = new Autolink_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Autolink_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Autolink_obj *__this = (Autolink_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Autolink_obj), false, "snikket.Autolink"));
+ *(void **)__this = Autolink_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Autolink_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Autolink",09,97,b1,19); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ static ::String IANA_TOP_LEVEL_DOMAINS;
+ static ::String GOOD_IRI_CHAR;
+ static ::String IP_ADDRESS;
+ static ::String IP6_ADDRESS;
+ static ::String UCS_CHAR;
+ static ::String LABEL_CHAR;
+ static ::String IRI_LABEL;
+ static ::String PUNYCODE_TLD;
+ static ::String PROTOCOL;
+ static ::String WORD_BOUNDARY;
+ static ::String USER_INFO;
+ static ::String PORT_NUMBER;
+ static ::String PATH_CHAR;
+ static ::String PATH_AND_QUERY;
+ static ::String STRICT_TLD;
+ static ::String STRICT_HOST_NAME;
+ static ::String STRICT_DOMAIN_NAME;
+ static ::String RELAXED_DOMAIN_NAME;
+ static ::String WEB_URL_WITHOUT_PROTOCOL;
+ static ::String WEB_URL_WITH_PROTOCOL;
+ static ::String AUTOLINK_WEB_URL;
+ static ::String TEL_URI;
+ static ::String SMS_URI;
+ static ::String XMPP_URI;
+ static ::Dynamic one(::String s,int start);
+ static ::Dynamic one_dyn();
+
+ static ::Dynamic match(::String s,int start,::String pattern,bool addHttps);
+ static ::Dynamic match_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Autolink */
diff --git a/Sources/c_snikket/iinclude/include/snikket/AvailableChat.h b/Sources/c_snikket/iinclude/include/snikket/AvailableChat.h
new file mode 100644
index 0000000..80ae01e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/AvailableChat.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_AvailableChat
+#define INCLUDED_snikket_AvailableChat
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,AvailableChat)
+HX_DECLARE_CLASS1(snikket,Caps)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES AvailableChat_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef AvailableChat_obj OBJ_;
+ AvailableChat_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7aa46944 };
+
+ void __construct(::String chatId,::String displayName,::String note, ::snikket::Caps caps);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.AvailableChat")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.AvailableChat"); }
+ static ::hx::ObjectPtr< AvailableChat_obj > __new(::String chatId,::String displayName,::String note, ::snikket::Caps caps);
+ static ::hx::ObjectPtr< AvailableChat_obj > __alloc(::hx::Ctx *_hx_ctx,::String chatId,::String displayName,::String note, ::snikket::Caps caps);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~AvailableChat_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("AvailableChat",21,4d,b7,ce); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ ::String chatId;
+ ::String chatId__fromC();
+ ::Dynamic chatId__fromC_dyn();
+
+ ::String displayName;
+ ::String displayName__fromC();
+ ::Dynamic displayName__fromC_dyn();
+
+ ::String note;
+ ::String note__fromC();
+ ::Dynamic note__fromC_dyn();
+
+ ::snikket::Caps caps;
+ bool isChannel();
+ ::Dynamic isChannel_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_AvailableChat */
diff --git a/Sources/c_snikket/iinclude/include/snikket/Builder.h b/Sources/c_snikket/iinclude/include/snikket/Builder.h
new file mode 100644
index 0000000..2b371f1
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/Builder.h
@@ -0,0 +1,62 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Builder
+#define INCLUDED_snikket_Builder
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Builder)
+HX_DECLARE_CLASS1(snikket,Symbol)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Builder_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Builder_obj OBJ_;
+ Builder_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7b0e9a2a };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Builder")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Builder"); }
+ static ::hx::ObjectPtr< Builder_obj > __new();
+ static ::hx::ObjectPtr< Builder_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Builder_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Builder",fb,02,0c,3d); }
+
+ static bool isMerger(int codepoint);
+ static ::Dynamic isMerger_dyn();
+
+ ::Array< int > codepoints;
+ bool offer(int codepoint);
+ ::Dynamic offer_dyn();
+
+ ::snikket::Symbol build();
+ ::Dynamic build_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Builder */
diff --git a/Sources/c_snikket/iinclude/include/snikket/Caps.h b/Sources/c_snikket/iinclude/include/snikket/Caps.h
new file mode 100644
index 0000000..908402f
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/Caps.h
@@ -0,0 +1,83 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Caps
+#define INCLUDED_snikket_Caps
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Caps)
+HX_DECLARE_CLASS1(snikket,Hash)
+HX_DECLARE_CLASS1(snikket,Identity)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Caps_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Caps_obj OBJ_;
+ Caps_obj();
+
+ public:
+ enum { _hx_ClassId = 0x02663c7e };
+
+ void __construct(::String node,::Array< ::Dynamic> identities,::Array< ::String > features);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Caps")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Caps"); }
+ static ::hx::ObjectPtr< Caps_obj > __new(::String node,::Array< ::Dynamic> identities,::Array< ::String > features);
+ static ::hx::ObjectPtr< Caps_obj > __alloc(::hx::Ctx *_hx_ctx,::String node,::Array< ::Dynamic> identities,::Array< ::String > features);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Caps_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Caps",41,48,93,2c); }
+
+ static ::Array< ::String > withIdentity( ::Dynamic caps,::String category,::String type);
+ static ::Dynamic withIdentity_dyn();
+
+ static ::Array< ::String > withFeature( ::Dynamic caps,::String feature);
+ static ::Dynamic withFeature_dyn();
+
+ ::String node;
+ ::Array< ::Dynamic> identities;
+ ::Array< ::String > features;
+ ::snikket::Hash _ver;
+ bool isChannel(::String chatId);
+ ::Dynamic isChannel_dyn();
+
+ ::snikket::Stanza discoReply();
+ ::Dynamic discoReply_dyn();
+
+ ::snikket::Stanza addC( ::snikket::Stanza stanza);
+ ::Dynamic addC_dyn();
+
+ ::snikket::Hash computeVer();
+ ::Dynamic computeVer_dyn();
+
+ ::snikket::Hash verRaw();
+ ::Dynamic verRaw_dyn();
+
+ ::String ver();
+ ::Dynamic ver_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Caps */
diff --git a/Sources/c_snikket/iinclude/include/snikket/Channel.h b/Sources/c_snikket/iinclude/include/snikket/Channel.h
new file mode 100644
index 0000000..74066bc
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/Channel.h
@@ -0,0 +1,144 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Channel
+#define INCLUDED_snikket_Channel
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_Chat
+#include <snikket/Chat.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Caps)
+HX_DECLARE_CLASS1(snikket,Channel)
+HX_DECLARE_CLASS1(snikket,Chat)
+HX_DECLARE_CLASS1(snikket,ChatMessage)
+HX_DECLARE_CLASS1(snikket,ChatMessageBuilder)
+HX_DECLARE_CLASS1(snikket,Client)
+HX_DECLARE_CLASS1(snikket,EventEmitter)
+HX_DECLARE_CLASS1(snikket,GenericStream)
+HX_DECLARE_CLASS1(snikket,JID)
+HX_DECLARE_CLASS1(snikket,MessageSync)
+HX_DECLARE_CLASS1(snikket,Participant)
+HX_DECLARE_CLASS1(snikket,Persistence)
+HX_DECLARE_CLASS1(snikket,Presence)
+HX_DECLARE_CLASS1(snikket,Reaction)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Channel_obj : public ::snikket::Chat_obj
+{
+ public:
+ typedef ::snikket::Chat_obj super;
+ typedef Channel_obj OBJ_;
+ Channel_obj();
+
+ public:
+ enum { _hx_ClassId = 0x23f2b886 };
+
+ void __construct( ::snikket::Client client, ::snikket::GenericStream stream,::Dynamic persistence,::String chatId,::hx::Null< int > __o_uiState,::hx::Null< bool > __o_isBlocked, ::snikket::Stanza extensions,::String readUpToId,::String readUpToBy, ::snikket::Caps disco);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Channel")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Channel"); }
+ static ::hx::ObjectPtr< Channel_obj > __new( ::snikket::Client client, ::snikket::GenericStream stream,::Dynamic persistence,::String chatId,::hx::Null< int > __o_uiState,::hx::Null< bool > __o_isBlocked, ::snikket::Stanza extensions,::String readUpToId,::String readUpToBy, ::snikket::Caps disco);
+ static ::hx::ObjectPtr< Channel_obj > __alloc(::hx::Ctx *_hx_ctx, ::snikket::Client client, ::snikket::GenericStream stream,::Dynamic persistence,::String chatId,::hx::Null< int > __o_uiState,::hx::Null< bool > __o_isBlocked, ::snikket::Stanza extensions,::String readUpToId,::String readUpToBy, ::snikket::Caps disco);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Channel_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Channel",a3,28,23,9a); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ ::snikket::Caps disco;
+ bool inSync;
+ ::snikket::MessageSync sync;
+ bool forceLive;
+ ::String _nickInUse;
+ void selfPing(bool refresh);
+ ::Dynamic selfPing_dyn();
+
+ void join();
+ ::Dynamic join_dyn();
+
+ void selfPingSuccess();
+ ::Dynamic selfPingSuccess_dyn();
+
+ void setPresence(::String resource, ::snikket::Presence presence);
+
+ void doSync(::String lastId);
+ ::Dynamic doSync_dyn();
+
+ bool isTrusted();
+
+ bool isPrivate();
+ ::Dynamic isPrivate_dyn();
+
+ void refreshDisco( ::Dynamic callback);
+ ::Dynamic refreshDisco_dyn();
+
+ ::String preview();
+
+ bool livePresence();
+
+ bool syncing();
+
+ bool canAudioCall();
+
+ bool canVideoCall();
+
+ ::String nickInUse();
+ ::Dynamic nickInUse_dyn();
+
+ ::snikket::JID getFullJid();
+ ::Dynamic getFullJid_dyn();
+
+ ::Array< ::String > getParticipants();
+
+ ::snikket::Participant getParticipantDetails(::String participantId);
+
+ void getMessagesBefore(::String beforeId,::String beforeTime, ::Dynamic handler);
+
+ void getMessagesAfter(::String afterId,::String afterTime, ::Dynamic handler);
+
+ void getMessagesAround(::String aroundId,::String aroundTime, ::Dynamic handler);
+
+ ::snikket::ChatMessageBuilder prepareIncomingMessage( ::snikket::ChatMessageBuilder message, ::snikket::Stanza stanza);
+
+ ::snikket::ChatMessageBuilder prepareOutgoingMessage( ::snikket::ChatMessageBuilder message);
+ ::Dynamic prepareOutgoingMessage_dyn();
+
+ void correctMessage(::String localId, ::snikket::ChatMessageBuilder message);
+
+ void sendMessage( ::snikket::ChatMessageBuilder message);
+
+ void removeReaction( ::snikket::ChatMessage m, ::snikket::Reaction reaction);
+
+ ::String lastMessageId();
+
+ void markReadUpTo( ::snikket::ChatMessage message);
+
+ void bookmark();
+
+ void sendChatState(::String state,::String threadId);
+
+ void close();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Channel */
diff --git a/Sources/c_snikket/iinclude/include/snikket/Chat.h b/Sources/c_snikket/iinclude/include/snikket/Chat.h
new file mode 100644
index 0000000..244dff4
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/Chat.h
@@ -0,0 +1,295 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Chat
+#define INCLUDED_snikket_Chat
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS1(haxe,Timer)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+HX_DECLARE_CLASS1(snikket,Caps)
+HX_DECLARE_CLASS1(snikket,Chat)
+HX_DECLARE_CLASS1(snikket,ChatMessage)
+HX_DECLARE_CLASS1(snikket,ChatMessageBuilder)
+HX_DECLARE_CLASS1(snikket,Client)
+HX_DECLARE_CLASS1(snikket,EventEmitter)
+HX_DECLARE_CLASS1(snikket,GenericStream)
+HX_DECLARE_CLASS1(snikket,MessageSync)
+HX_DECLARE_CLASS1(snikket,Participant)
+HX_DECLARE_CLASS1(snikket,Persistence)
+HX_DECLARE_CLASS1(snikket,Presence)
+HX_DECLARE_CLASS1(snikket,Reaction)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,jingle,DTMFSender)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStream)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStreamTrack)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Chat_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Chat_obj OBJ_;
+ Chat_obj();
+
+ public:
+ enum { _hx_ClassId = 0x026b7f35 };
+
+ void __construct( ::snikket::Client client, ::snikket::GenericStream stream,::Dynamic persistence,::String chatId,::hx::Null< int > __o_uiState,::hx::Null< bool > __o_isBlocked, ::snikket::Stanza extensions,::String readUpToId,::String readUpToBy);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Chat")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Chat"); }
+
+ //~Chat_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Chat",f8,8a,98,2c); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ ::snikket::Client client;
+ ::snikket::GenericStream stream;
+ ::Dynamic persistence;
+ ::Array< unsigned char > avatarSha1;
+ ::haxe::ds::StringMap presence;
+ bool trusted;
+ ::String chatId;
+ ::String chatId__fromC();
+ ::Dynamic chatId__fromC_dyn();
+
+ ::haxe::ds::StringMap jingleSessions;
+ ::String displayName;
+ int uiState;
+ int uiState__fromC();
+ ::Dynamic uiState__fromC_dyn();
+
+ bool isBlocked;
+ bool isBlocked__fromC();
+ ::Dynamic isBlocked__fromC_dyn();
+
+ ::snikket::Stanza extensions;
+ int _unreadCount;
+ ::snikket::ChatMessage lastMessage;
+ ::String readUpToId;
+ ::String readUpToBy;
+ bool isTyping;
+ ::String typingThread;
+ ::haxe::Timer typingTimer;
+ ::Dynamic isActive;
+ ::String activeThread;
+ ::Dynamic notificationSettings;
+ virtual ::snikket::ChatMessageBuilder prepareIncomingMessage( ::snikket::ChatMessageBuilder message, ::snikket::Stanza stanza) { return 0; }
+ ::Dynamic prepareIncomingMessage_dyn();
+ virtual void getMessagesBefore(::String beforeId,::String beforeTime, ::Dynamic handler) {}
+ ::Dynamic getMessagesBefore_dyn();
+ void getMessagesBefore__fromC(::String beforeId,::String beforeTime,::cpp::Function< void (void**,size_t,void*) > handler,void* handler__context);
+
+ virtual void getMessagesAfter(::String afterId,::String afterTime, ::Dynamic handler) {}
+ ::Dynamic getMessagesAfter_dyn();
+ void getMessagesAfter__fromC(::String afterId,::String afterTime,::cpp::Function< void (void**,size_t,void*) > handler,void* handler__context);
+
+ virtual void getMessagesAround(::String aroundId,::String aroundTime, ::Dynamic handler) {}
+ ::Dynamic getMessagesAround_dyn();
+ void getMessagesAround__fromC(::String aroundId,::String aroundTime,::cpp::Function< void (void**,size_t,void*) > handler,void* handler__context);
+
+ void fetchFromSync( ::snikket::MessageSync sync, ::Dynamic callback);
+ ::Dynamic fetchFromSync_dyn();
+
+ virtual void sendMessage( ::snikket::ChatMessageBuilder message) {}
+ ::Dynamic sendMessage_dyn();
+ void sendMessage__fromC( ::snikket::ChatMessageBuilder message);
+ ::Dynamic sendMessage__fromC_dyn();
+
+ virtual void markReadUpTo( ::snikket::ChatMessage message) {}
+ ::Dynamic markReadUpTo_dyn();
+ void markReadUpTo__fromC( ::snikket::ChatMessage message);
+ ::Dynamic markReadUpTo__fromC_dyn();
+
+ virtual void bookmark() {}
+ ::Dynamic bookmark_dyn();
+ void bookmark__fromC();
+ ::Dynamic bookmark__fromC_dyn();
+
+ virtual ::Array< ::String > getParticipants() { return 0; }
+ ::Dynamic getParticipants_dyn();
+ size_t getParticipants__fromC(const char*** outPtr);
+
+ virtual ::snikket::Participant getParticipantDetails(::String participantId) { return 0; }
+ ::Dynamic getParticipantDetails_dyn();
+ ::snikket::Participant getParticipantDetails__fromC(::String participantId);
+ ::Dynamic getParticipantDetails__fromC_dyn();
+
+ virtual void correctMessage(::String localId, ::snikket::ChatMessageBuilder message) {}
+ ::Dynamic correctMessage_dyn();
+ void correctMessage__fromC(::String localId, ::snikket::ChatMessageBuilder message);
+ ::Dynamic correctMessage__fromC_dyn();
+
+ void addReaction( ::snikket::ChatMessage m, ::snikket::Reaction reaction);
+ ::Dynamic addReaction_dyn();
+
+ virtual void removeReaction( ::snikket::ChatMessage m, ::snikket::Reaction reaction) {}
+ ::Dynamic removeReaction_dyn();
+ void removeReaction__fromC( ::snikket::ChatMessage m, ::snikket::Reaction reaction);
+ ::Dynamic removeReaction__fromC_dyn();
+
+ virtual void sendChatState(::String state,::String threadId) {}
+ ::Dynamic sendChatState_dyn();
+ void typing(::String threadId,::String content);
+ ::Dynamic typing_dyn();
+
+ void setActive(bool active,::String threadId);
+ ::Dynamic setActive_dyn();
+
+ virtual void close() {}
+ ::Dynamic close_dyn();
+ void close__fromC();
+ ::Dynamic close__fromC_dyn();
+
+ void togglePinned();
+ ::Dynamic togglePinned_dyn();
+
+ void block( ::snikket::ChatMessage reportSpam,bool onServer);
+ ::Dynamic block_dyn();
+
+ void unblock(bool onServer);
+ ::Dynamic unblock_dyn();
+
+ void setNotifications(bool filtered,bool mention,bool reply);
+ ::Dynamic setNotifications_dyn();
+
+ bool notificationsFiltered();
+ ::Dynamic notificationsFiltered_dyn();
+
+ bool notifyMention();
+ ::Dynamic notifyMention_dyn();
+
+ bool notifyReply();
+ ::Dynamic notifyReply_dyn();
+
+ virtual ::String lastMessageId() { return 0; }
+ ::Dynamic lastMessageId_dyn();
+ ::String lastMessageId__fromC();
+ ::Dynamic lastMessageId__fromC_dyn();
+
+ ::String lastMessageTimestamp();
+ ::Dynamic lastMessageTimestamp_dyn();
+
+ void updateFromBookmark( ::snikket::Stanza item);
+ ::Dynamic updateFromBookmark_dyn();
+
+ void updateFromRoster( ::Dynamic item);
+ ::Dynamic updateFromRoster_dyn();
+
+ ::String getPhoto();
+ ::Dynamic getPhoto_dyn();
+
+ ::String getPlaceholder();
+ ::Dynamic getPlaceholder_dyn();
+
+ ::String readUpTo();
+ ::Dynamic readUpTo_dyn();
+
+ int unreadCount();
+ ::Dynamic unreadCount_dyn();
+
+ void setUnreadCount(int count);
+ ::Dynamic setUnreadCount_dyn();
+
+ virtual ::String preview();
+ ::Dynamic preview_dyn();
+
+ void setLastMessage( ::snikket::ChatMessage message);
+ ::Dynamic setLastMessage_dyn();
+
+ void setDisplayName(::String fn);
+ ::Dynamic setDisplayName_dyn();
+
+ ::String getDisplayName();
+ ::Dynamic getDisplayName_dyn();
+
+ virtual void setPresence(::String resource, ::snikket::Presence presence);
+ ::Dynamic setPresence_dyn();
+
+ void setCaps(::String resource, ::snikket::Caps caps);
+ ::Dynamic setCaps_dyn();
+
+ void removePresence(::String resource);
+ ::Dynamic removePresence_dyn();
+
+ ::Dynamic getCaps();
+ ::Dynamic getCaps_dyn();
+
+ ::snikket::Caps getResourceCaps(::String resource);
+ ::Dynamic getResourceCaps_dyn();
+
+ void setAvatarSha1(::Array< unsigned char > sha1);
+ ::Dynamic setAvatarSha1_dyn();
+
+ void setTrusted(bool trusted);
+ ::Dynamic setTrusted_dyn();
+
+ virtual bool isTrusted();
+ ::Dynamic isTrusted_dyn();
+
+ virtual bool livePresence();
+ ::Dynamic livePresence_dyn();
+
+ virtual bool syncing();
+ ::Dynamic syncing_dyn();
+
+ virtual bool canAudioCall();
+ ::Dynamic canAudioCall_dyn();
+
+ virtual bool canVideoCall();
+ ::Dynamic canVideoCall_dyn();
+
+ void startCall(bool audio,bool video);
+ ::Dynamic startCall_dyn();
+
+ void addMedia(::Array< ::Dynamic> streams);
+ ::Dynamic addMedia_dyn();
+
+ void acceptCall();
+ ::Dynamic acceptCall_dyn();
+
+ void hangup();
+ ::Dynamic hangup_dyn();
+
+ ::String callStatus();
+ ::Dynamic callStatus_dyn();
+
+ ::snikket::jingle::DTMFSender dtmf();
+ ::Dynamic dtmf_dyn();
+
+ ::Array< ::Dynamic> videoTracks();
+ ::Dynamic videoTracks_dyn();
+
+ size_t videoTracks__fromC(void*** outPtr);
+
+ void markReadUpToId(::String upTo,::String upToBy, ::Dynamic callback);
+ ::Dynamic markReadUpToId_dyn();
+
+ void markReadUpToMessage( ::snikket::ChatMessage message, ::Dynamic callback);
+ ::Dynamic markReadUpToMessage_dyn();
+
+ void publishMds();
+ ::Dynamic publishMds_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Chat */
diff --git a/Sources/c_snikket/iinclude/include/snikket/ChatAttachment.h b/Sources/c_snikket/iinclude/include/snikket/ChatAttachment.h
new file mode 100644
index 0000000..a22273b
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/ChatAttachment.h
@@ -0,0 +1,75 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_ChatAttachment
+#define INCLUDED_snikket_ChatAttachment
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,ChatAttachment)
+HX_DECLARE_CLASS1(snikket,Hash)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES ChatAttachment_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef ChatAttachment_obj OBJ_;
+ ChatAttachment_obj();
+
+ public:
+ enum { _hx_ClassId = 0x2f907f78 };
+
+ void __construct(::String name,::String mime, ::Dynamic size,::Array< ::String > uris,::Array< ::Dynamic> hashes);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.ChatAttachment")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.ChatAttachment"); }
+ static ::hx::ObjectPtr< ChatAttachment_obj > __new(::String name,::String mime, ::Dynamic size,::Array< ::String > uris,::Array< ::Dynamic> hashes);
+ static ::hx::ObjectPtr< ChatAttachment_obj > __alloc(::hx::Ctx *_hx_ctx,::String name,::String mime, ::Dynamic size,::Array< ::String > uris,::Array< ::Dynamic> hashes);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ChatAttachment_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("ChatAttachment",fb,fc,04,6c); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ static ::snikket::ChatAttachment create(::String name,::String mime,int size,::String uri);
+ static ::Dynamic create_dyn();
+
+ ::String name;
+ ::String name__fromC();
+ ::Dynamic name__fromC_dyn();
+
+ ::String mime;
+ ::String mime__fromC();
+ ::Dynamic mime__fromC_dyn();
+
+ ::Dynamic size;
+ ::Dynamic size__fromC();
+ ::Dynamic size__fromC_dyn();
+
+ ::Array< ::String > uris;
+ size_t uris__fromC(const char*** outPtr);
+
+ ::Array< ::Dynamic> hashes;
+ size_t hashes__fromC(void*** outPtr);
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_ChatAttachment */
diff --git a/Sources/c_snikket/iinclude/include/snikket/ChatMessage.h b/Sources/c_snikket/iinclude/include/snikket/ChatMessage.h
new file mode 100644
index 0000000..c2531ac
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/ChatMessage.h
@@ -0,0 +1,172 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_ChatMessage
+#define INCLUDED_snikket_ChatMessage
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+HX_DECLARE_CLASS1(snikket,ChatAttachment)
+HX_DECLARE_CLASS1(snikket,ChatMessage)
+HX_DECLARE_CLASS1(snikket,ChatMessageBuilder)
+HX_DECLARE_CLASS1(snikket,Hash)
+HX_DECLARE_CLASS1(snikket,JID)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES ChatMessage_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef ChatMessage_obj OBJ_;
+ ChatMessage_obj();
+
+ public:
+ enum { _hx_ClassId = 0x36665f12 };
+
+ void __construct( ::Dynamic params);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.ChatMessage")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.ChatMessage"); }
+ static ::hx::ObjectPtr< ChatMessage_obj > __new( ::Dynamic params);
+ static ::hx::ObjectPtr< ChatMessage_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic params);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ChatMessage_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("ChatMessage",af,a1,2d,18); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ static ::snikket::ChatMessage fromStanza( ::snikket::Stanza stanza, ::snikket::JID localJid, ::Dynamic addContext);
+ static ::Dynamic fromStanza_dyn();
+
+ ::String localId;
+ ::String localId__fromC();
+ ::Dynamic localId__fromC_dyn();
+
+ ::String serverId;
+ ::String serverId__fromC();
+ ::Dynamic serverId__fromC_dyn();
+
+ ::String serverIdBy;
+ ::String serverIdBy__fromC();
+ ::Dynamic serverIdBy__fromC_dyn();
+
+ int type;
+ int type__fromC();
+ ::Dynamic type__fromC_dyn();
+
+ bool syncPoint;
+ ::String replyId;
+ ::String timestamp;
+ ::String timestamp__fromC();
+ ::Dynamic timestamp__fromC_dyn();
+
+ ::snikket::JID to;
+ ::snikket::JID from;
+ ::Array< ::Dynamic> recipients;
+ ::Array< ::Dynamic> replyTo;
+ ::String senderId;
+ ::String senderId__fromC();
+ ::Dynamic senderId__fromC_dyn();
+
+ ::snikket::ChatMessage replyToMessage;
+ ::snikket::ChatMessage replyToMessage__fromC();
+ ::Dynamic replyToMessage__fromC_dyn();
+
+ ::String threadId;
+ ::String threadId__fromC();
+ ::Dynamic threadId__fromC_dyn();
+
+ ::Array< ::Dynamic> attachments;
+ size_t attachments__fromC(void*** outPtr);
+
+ ::haxe::ds::StringMap reactions;
+ ::String text;
+ ::String text__fromC();
+ ::Dynamic text__fromC_dyn();
+
+ ::String lang;
+ ::String lang__fromC();
+ ::Dynamic lang__fromC_dyn();
+
+ int direction;
+ int direction__fromC();
+ ::Dynamic direction__fromC_dyn();
+
+ int status;
+ int status__fromC();
+ ::Dynamic status__fromC_dyn();
+
+ void set_status__fromC(int value);
+ ::Dynamic set_status__fromC_dyn();
+
+ ::Array< ::Dynamic> versions;
+ size_t versions__fromC(void*** outPtr);
+
+ ::Array< ::Dynamic> payloads;
+ ::snikket::Stanza stanza;
+ ::snikket::ChatMessageBuilder reply();
+ ::Dynamic reply_dyn();
+
+ ::String getReplyId();
+ ::Dynamic getReplyId_dyn();
+
+ ::snikket::ChatMessage set_replyToMessage( ::snikket::ChatMessage m);
+ ::Dynamic set_replyToMessage_dyn();
+
+ ::haxe::ds::StringMap set_reactions( ::haxe::ds::StringMap r);
+ ::Dynamic set_reactions_dyn();
+
+ ::Array< ::Dynamic> inlineHashReferences();
+ ::Dynamic inlineHashReferences_dyn();
+
+ ::String html();
+ ::Dynamic html_dyn();
+
+ ::String chatId();
+ ::Dynamic chatId_dyn();
+
+ ::String account();
+ ::Dynamic account_dyn();
+
+ bool isIncoming();
+ ::Dynamic isIncoming_dyn();
+
+ ::String threadIcon();
+ ::Dynamic threadIcon_dyn();
+
+ ::String callStatus();
+ ::Dynamic callStatus_dyn();
+
+ ::String callSid();
+ ::Dynamic callSid_dyn();
+
+ ::String callDuration();
+ ::Dynamic callDuration_dyn();
+
+ ::snikket::Stanza asStanza();
+ ::Dynamic asStanza_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_ChatMessage */
diff --git a/Sources/c_snikket/iinclude/include/snikket/ChatMessageBuilder.h b/Sources/c_snikket/iinclude/include/snikket/ChatMessageBuilder.h
new file mode 100644
index 0000000..041e48a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/ChatMessageBuilder.h
@@ -0,0 +1,189 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_ChatMessageBuilder
+#define INCLUDED_snikket_ChatMessageBuilder
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+HX_DECLARE_CLASS1(htmlparser,HtmlNode)
+HX_DECLARE_CLASS1(snikket,ChatAttachment)
+HX_DECLARE_CLASS1(snikket,ChatMessage)
+HX_DECLARE_CLASS1(snikket,ChatMessageBuilder)
+HX_DECLARE_CLASS1(snikket,JID)
+HX_DECLARE_CLASS1(snikket,Node)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES ChatMessageBuilder_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef ChatMessageBuilder_obj OBJ_;
+ ChatMessageBuilder_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1d9d1345 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.ChatMessageBuilder")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.ChatMessageBuilder"); }
+ static ::hx::ObjectPtr< ChatMessageBuilder_obj > __new();
+ static ::hx::ObjectPtr< ChatMessageBuilder_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ChatMessageBuilder_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("ChatMessageBuilder",2c,85,c0,07); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ static ::snikket::ChatMessage makeModerated( ::snikket::ChatMessage m,::String timestamp,::String moderatorId,::String reason);
+ static ::Dynamic makeModerated_dyn();
+
+ ::String localId;
+ ::String localId__fromC();
+ ::Dynamic localId__fromC_dyn();
+
+ void set_localId__fromC(::String value);
+ ::Dynamic set_localId__fromC_dyn();
+
+ ::String serverId;
+ ::String serverId__fromC();
+ ::Dynamic serverId__fromC_dyn();
+
+ void set_serverId__fromC(::String value);
+ ::Dynamic set_serverId__fromC_dyn();
+
+ ::String serverIdBy;
+ ::String serverIdBy__fromC();
+ ::Dynamic serverIdBy__fromC_dyn();
+
+ void set_serverIdBy__fromC(::String value);
+ ::Dynamic set_serverIdBy__fromC_dyn();
+
+ int type;
+ int type__fromC();
+ ::Dynamic type__fromC_dyn();
+
+ void set_type__fromC(int value);
+ ::Dynamic set_type__fromC_dyn();
+
+ bool syncPoint;
+ ::String replyId;
+ ::String timestamp;
+ ::String timestamp__fromC();
+ ::Dynamic timestamp__fromC_dyn();
+
+ void set_timestamp__fromC(::String value);
+ ::Dynamic set_timestamp__fromC_dyn();
+
+ ::snikket::JID to;
+ ::snikket::JID from;
+ ::snikket::JID sender;
+ ::Array< ::Dynamic> recipients;
+ ::Array< ::Dynamic> replyTo;
+ ::String senderId;
+ ::String senderId__fromC();
+ ::Dynamic senderId__fromC_dyn();
+
+ void set_senderId__fromC(::String value);
+ ::Dynamic set_senderId__fromC_dyn();
+
+ ::snikket::ChatMessage replyToMessage;
+ ::snikket::ChatMessage replyToMessage__fromC();
+ ::Dynamic replyToMessage__fromC_dyn();
+
+ void set_replyToMessage__fromC( ::snikket::ChatMessage value);
+ ::Dynamic set_replyToMessage__fromC_dyn();
+
+ ::String threadId;
+ ::String threadId__fromC();
+ ::Dynamic threadId__fromC_dyn();
+
+ void set_threadId__fromC(::String value);
+ ::Dynamic set_threadId__fromC_dyn();
+
+ ::Array< ::Dynamic> attachments;
+ size_t attachments__fromC(void*** outPtr);
+
+ ::haxe::ds::StringMap reactions;
+ ::String text;
+ ::String text__fromC();
+ ::Dynamic text__fromC_dyn();
+
+ void set_text__fromC(::String value);
+ ::Dynamic set_text__fromC_dyn();
+
+ ::String lang;
+ ::String lang__fromC();
+ ::Dynamic lang__fromC_dyn();
+
+ void set_lang__fromC(::String value);
+ ::Dynamic set_lang__fromC_dyn();
+
+ int direction;
+ int direction__fromC();
+ ::Dynamic direction__fromC_dyn();
+
+ void set_direction__fromC(int value);
+ ::Dynamic set_direction__fromC_dyn();
+
+ int status;
+ int status__fromC();
+ ::Dynamic status__fromC_dyn();
+
+ void set_status__fromC(int value);
+ ::Dynamic set_status__fromC_dyn();
+
+ ::Array< ::Dynamic> versions;
+ size_t versions__fromC(void*** outPtr);
+
+ ::Array< ::Dynamic> payloads;
+ ::snikket::Stanza stanza;
+ void attachSims( ::snikket::Stanza sims);
+ ::Dynamic attachSims_dyn();
+
+ void addAttachment( ::snikket::ChatAttachment attachment);
+ ::Dynamic addAttachment_dyn();
+
+ void setHtml(::String html);
+ ::Dynamic setHtml_dyn();
+
+ ::snikket::Node htmlToNode( ::htmlparser::HtmlNode node);
+ ::Dynamic htmlToNode_dyn();
+
+ ::String chatId();
+ ::Dynamic chatId_dyn();
+
+ ::String get_senderId();
+ ::Dynamic get_senderId_dyn();
+
+ bool isIncoming();
+ ::Dynamic isIncoming_dyn();
+
+ ::snikket::ChatMessage build();
+ ::Dynamic build_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_ChatMessageBuilder */
diff --git a/Sources/c_snikket/iinclude/include/snikket/Client.h b/Sources/c_snikket/iinclude/include/snikket/Client.h
new file mode 100644
index 0000000..8908f68
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/Client.h
@@ -0,0 +1,279 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Client
+#define INCLUDED_snikket_Client
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_EventEmitter
+#include <snikket/EventEmitter.h>
+#endif
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+HX_DECLARE_CLASS1(snikket,AttachmentSource)
+HX_DECLARE_CLASS1(snikket,AvailableChat)
+HX_DECLARE_CLASS1(snikket,Caps)
+HX_DECLARE_CLASS1(snikket,Chat)
+HX_DECLARE_CLASS1(snikket,ChatAttachment)
+HX_DECLARE_CLASS1(snikket,ChatMessage)
+HX_DECLARE_CLASS1(snikket,Client)
+HX_DECLARE_CLASS1(snikket,DirectChat)
+HX_DECLARE_CLASS1(snikket,EventEmitter)
+HX_DECLARE_CLASS1(snikket,EventResult)
+HX_DECLARE_CLASS1(snikket,GenericStream)
+HX_DECLARE_CLASS1(snikket,Hash)
+HX_DECLARE_CLASS1(snikket,JID)
+HX_DECLARE_CLASS1(snikket,ModerationAction)
+HX_DECLARE_CLASS1(snikket,Persistence)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,jingle,InitiatedSession)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStream)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStreamTrack)
+HX_DECLARE_CLASS2(snikket,jingle,Session)
+HX_DECLARE_CLASS2(snikket,queries,GenericQuery)
+HX_DECLARE_CLASS1(thenshim,Thenable)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Client_obj : public ::snikket::EventEmitter_obj
+{
+ public:
+ typedef ::snikket::EventEmitter_obj super;
+ typedef Client_obj OBJ_;
+ Client_obj();
+
+ public:
+ enum { _hx_ClassId = 0x668a7be8 };
+
+ void __construct(::String address,::Dynamic persistence);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Client")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Client"); }
+ static ::hx::ObjectPtr< Client_obj > __new(::String address,::Dynamic persistence);
+ static ::hx::ObjectPtr< Client_obj > __alloc(::hx::Ctx *_hx_ctx,::String address,::Dynamic persistence);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Client_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Client",6b,3e,e4,3e); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ bool sendAvailable;
+ void set_sendAvailable__fromC(bool value);
+ ::Dynamic set_sendAvailable__fromC_dyn();
+
+ ::snikket::GenericStream stream;
+ ::Array< ::Dynamic> chatMessageHandlers;
+ ::Array< ::Dynamic> syncMessageHandlers;
+ ::Array< ::Dynamic> chatStateHandlers;
+ ::snikket::JID jid;
+ ::Array< ::Dynamic> chats;
+ ::Dynamic persistence;
+ ::snikket::Caps caps;
+ ::String _displayName;
+ ::String fastMechanism;
+ ::String token;
+ ::haxe::ds::StringMap pendingCaps;
+ bool inSync;
+ void start();
+ ::Dynamic start_dyn();
+
+ void logout(bool completely);
+ ::Dynamic logout_dyn();
+
+ void usePassword(::String password);
+ ::Dynamic usePassword_dyn();
+
+ ::String accountId();
+ ::Dynamic accountId_dyn();
+
+ ::String displayName();
+ ::Dynamic displayName_dyn();
+
+ void setDisplayName(::String displayName);
+ ::Dynamic setDisplayName_dyn();
+
+ bool updateDisplayName(::String fn);
+ ::Dynamic updateDisplayName_dyn();
+
+ ::snikket::EventResult onConnected( ::Dynamic data);
+ ::Dynamic onConnected_dyn();
+
+ void prepareAttachment( ::snikket::AttachmentSource source, ::Dynamic callback);
+ ::Dynamic prepareAttachment_dyn();
+
+ void prepareAttachment__fromC( ::snikket::AttachmentSource source,::cpp::Function< void (void*,void*) > callback,void* callback__context);
+
+ void prepareAttachmentFor( ::snikket::AttachmentSource source,::Array< ::Dynamic> services,::Array< ::Dynamic> hashes, ::Dynamic callback);
+ ::Dynamic prepareAttachmentFor_dyn();
+
+ ::Array< ::Dynamic> getChats();
+ ::Dynamic getChats_dyn();
+
+ size_t getChats__fromC(void*** outPtr);
+
+ void findAvailableChats(::String q, ::Dynamic callback);
+ ::Dynamic findAvailableChats_dyn();
+
+ void findAvailableChats__fromC(::String q,::cpp::Function< void (const char*,void**,size_t,void*) > callback,void* callback__context);
+
+ ::snikket::Chat startChat( ::snikket::AvailableChat availableChat);
+ ::Dynamic startChat_dyn();
+
+ ::snikket::Chat getChat(::String chatId);
+ ::Dynamic getChat_dyn();
+
+ ::Dynamic moderateMessage( ::snikket::ModerationAction action);
+ ::Dynamic moderateMessage_dyn();
+
+ ::snikket::DirectChat getDirectChat(::String chatId,::hx::Null< bool > triggerIfNew);
+ ::Dynamic getDirectChat_dyn();
+
+ void addPasswordNeededListener( ::Dynamic handler);
+ ::Dynamic addPasswordNeededListener_dyn();
+
+ void addPasswordNeededListener__fromC(::cpp::Function< void (void*,void*) > handler,void* handler__context);
+
+ void addStatusOnlineListener( ::Dynamic handler);
+ ::Dynamic addStatusOnlineListener_dyn();
+
+ void addStatusOnlineListener__fromC(::cpp::Function< void (void*) > handler,void* handler__context);
+
+ void addStatusOfflineListener( ::Dynamic handler);
+ ::Dynamic addStatusOfflineListener_dyn();
+
+ void addStatusOfflineListener__fromC(::cpp::Function< void (void*) > handler,void* handler__context);
+
+ void addConnectionFailedListener( ::Dynamic handler);
+ ::Dynamic addConnectionFailedListener_dyn();
+
+ void addConnectionFailedListener__fromC(::cpp::Function< void (void*) > handler,void* handler__context);
+
+ void addChatMessageListener( ::Dynamic handler);
+ ::Dynamic addChatMessageListener_dyn();
+
+ void addChatMessageListener__fromC(::cpp::Function< void (void*,int,void*) > handler,void* handler__context);
+
+ void addSyncMessageListener( ::Dynamic handler);
+ ::Dynamic addSyncMessageListener_dyn();
+
+ void addSyncMessageListener__fromC(::cpp::Function< void (void*,void*) > handler,void* handler__context);
+
+ void addChatsUpdatedListener( ::Dynamic handler);
+ ::Dynamic addChatsUpdatedListener_dyn();
+
+ void addChatsUpdatedListener__fromC(::cpp::Function< void (void**,size_t,void*) > handler,void* handler__context);
+
+ void addCallRingListener( ::Dynamic handler);
+ ::Dynamic addCallRingListener_dyn();
+
+ void addCallRingListener__fromC(::cpp::Function< void (void*,const char*,void*) > handler,void* handler__context);
+
+ void addCallRetractListener( ::Dynamic handler);
+ ::Dynamic addCallRetractListener_dyn();
+
+ void addCallRetractListener__fromC(::cpp::Function< void (const char*,void*) > handler,void* handler__context);
+
+ void addCallRingingListener( ::Dynamic handler);
+ ::Dynamic addCallRingingListener_dyn();
+
+ void addCallRingingListener__fromC(::cpp::Function< void (const char*,void*) > handler,void* handler__context);
+
+ void addCallMediaListener( ::Dynamic handler);
+ ::Dynamic addCallMediaListener_dyn();
+
+ void addCallMediaListener__fromC(::cpp::Function< void (void*,bool,bool,void*) > handler,void* handler__context);
+
+ void addCallTrackListener( ::Dynamic handler);
+ ::Dynamic addCallTrackListener_dyn();
+
+ void addCallTrackListener__fromC(::cpp::Function< void (const char*,void*,void**,size_t,void*) > handler,void* handler__context);
+
+ void setInForeground();
+ ::Dynamic setInForeground_dyn();
+
+ void setNotInForeground();
+ ::Dynamic setNotInForeground_dyn();
+
+ ::Dynamic fetchMediaByHash(::Array< ::Dynamic> hashes,::Array< ::Dynamic> counterparts);
+ ::Dynamic fetchMediaByHash_dyn();
+
+ ::Dynamic fetchMediaByHashOneCounterpart(::Array< ::Dynamic> hashes, ::snikket::JID counterpart);
+ ::Dynamic fetchMediaByHashOneCounterpart_dyn();
+
+ void chatActivity( ::snikket::Chat chat,::hx::Null< bool > trigger);
+ ::Dynamic chatActivity_dyn();
+
+ void sortChats();
+ ::Dynamic sortChats_dyn();
+
+ void storeMessages(::Array< ::Dynamic> messages, ::Dynamic callback);
+ ::Dynamic storeMessages_dyn();
+
+ void sendQuery( ::snikket::queries::GenericQuery query);
+ ::Dynamic sendQuery_dyn();
+
+ void sendStanza( ::snikket::Stanza stanza);
+ ::Dynamic sendStanza_dyn();
+
+ void sendPresence(::String to, ::Dynamic augment);
+ ::Dynamic sendPresence_dyn();
+
+ void getIceServers( ::Dynamic callback);
+ ::Dynamic getIceServers_dyn();
+
+ void discoverServices( ::snikket::JID target,::String node, ::Dynamic callback);
+ ::Dynamic discoverServices_dyn();
+
+ void notifyMessageHandlers( ::snikket::ChatMessage message,int event);
+ ::Dynamic notifyMessageHandlers_dyn();
+
+ void notifySyncMessageHandlers( ::snikket::ChatMessage message);
+ ::Dynamic notifySyncMessageHandlers_dyn();
+
+ void rosterGet();
+ ::Dynamic rosterGet_dyn();
+
+ void startChatWith(::String jid, ::Dynamic handleCaps, ::Dynamic handleChat);
+ ::Dynamic startChatWith_dyn();
+
+ void serverBlocked(::String blocked);
+ ::Dynamic serverBlocked_dyn();
+
+ void bookmarksGet( ::Dynamic callback);
+ ::Dynamic bookmarksGet_dyn();
+
+ void sync( ::Dynamic callback);
+ ::Dynamic sync_dyn();
+
+ void onMAMJMI(::String sid, ::snikket::Stanza stanza);
+ ::Dynamic onMAMJMI_dyn();
+
+ void doSync( ::Dynamic callback,::String lastId);
+ ::Dynamic doSync_dyn();
+
+ void pingAllChannels(bool refresh);
+ ::Dynamic pingAllChannels_dyn();
+
+ void joinAllChannels();
+ ::Dynamic joinAllChannels_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Client */
diff --git a/Sources/c_snikket/iinclude/include/snikket/Color.h b/Sources/c_snikket/iinclude/include/snikket/Color.h
new file mode 100644
index 0000000..074383f
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/Color.h
@@ -0,0 +1,63 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Color
+#define INCLUDED_snikket_Color
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Color)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Color_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Color_obj OBJ_;
+ Color_obj();
+
+ public:
+ enum { _hx_ClassId = 0x204ca266 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="snikket.Color")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"snikket.Color"); }
+
+ inline static ::hx::ObjectPtr< Color_obj > __new() {
+ ::hx::ObjectPtr< Color_obj > __this = new Color_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Color_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Color_obj *__this = (Color_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Color_obj), false, "snikket.Color"));
+ *(void **)__this = Color_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Color_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Color",43,e1,89,dd); }
+
+ static ::String forString(::String s);
+ static ::Dynamic forString_dyn();
+
+ static ::String defaultPhoto(::String input,::String letter);
+ static ::Dynamic defaultPhoto_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Color */
diff --git a/Sources/c_snikket/iinclude/include/snikket/Config.h b/Sources/c_snikket/iinclude/include/snikket/Config.h
new file mode 100644
index 0000000..a987dd2
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/Config.h
@@ -0,0 +1,60 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Config
+#define INCLUDED_snikket_Config
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Config)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Config_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Config_obj OBJ_;
+ Config_obj();
+
+ public:
+ enum { _hx_ClassId = 0x240d085f };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="snikket.Config")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"snikket.Config"); }
+
+ inline static ::hx::ObjectPtr< Config_obj > __new() {
+ ::hx::ObjectPtr< Config_obj > __this = new Config_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Config_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Config_obj *__this = (Config_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Config_obj), false, "snikket.Config"));
+ *(void **)__this = Config_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Config_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Config",e2,ca,66,fc); }
+
+ static void __boot();
+ static bool relativeHashUri;
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Config */
diff --git a/Sources/c_snikket/iinclude/include/snikket/CustomEmojiReaction.h b/Sources/c_snikket/iinclude/include/snikket/CustomEmojiReaction.h
new file mode 100644
index 0000000..304c858
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/CustomEmojiReaction.h
@@ -0,0 +1,62 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_CustomEmojiReaction
+#define INCLUDED_snikket_CustomEmojiReaction
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_Reaction
+#include <snikket/Reaction.h>
+#endif
+HX_DECLARE_CLASS1(snikket,CustomEmojiReaction)
+HX_DECLARE_CLASS1(snikket,Reaction)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES CustomEmojiReaction_obj : public ::snikket::Reaction_obj
+{
+ public:
+ typedef ::snikket::Reaction_obj super;
+ typedef CustomEmojiReaction_obj OBJ_;
+ CustomEmojiReaction_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1e93c5e9 };
+
+ void __construct(::String senderId,::String timestamp,::String text,::String uri,::String envelopeId);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.CustomEmojiReaction")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.CustomEmojiReaction"); }
+ static ::hx::ObjectPtr< CustomEmojiReaction_obj > __new(::String senderId,::String timestamp,::String text,::String uri,::String envelopeId);
+ static ::hx::ObjectPtr< CustomEmojiReaction_obj > __alloc(::hx::Ctx *_hx_ctx,::String senderId,::String timestamp,::String text,::String uri,::String envelopeId);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~CustomEmojiReaction_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("CustomEmojiReaction",be,8e,6d,ec); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ ::String uri;
+ ::String uri__fromC();
+ ::Dynamic uri__fromC_dyn();
+
+ ::Dynamic render( ::Dynamic forText, ::Dynamic forImage);
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_CustomEmojiReaction */
diff --git a/Sources/c_snikket/iinclude/include/snikket/Date.h b/Sources/c_snikket/iinclude/include/snikket/Date.h
new file mode 100644
index 0000000..19af500
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/Date.h
@@ -0,0 +1,61 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Date
+#define INCLUDED_snikket_Date
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(Date)
+HX_DECLARE_CLASS1(snikket,Date)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Date_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Date_obj OBJ_;
+ Date_obj();
+
+ public:
+ enum { _hx_ClassId = 0x030f768b };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="snikket.Date")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"snikket.Date"); }
+
+ inline static ::hx::ObjectPtr< Date_obj > __new() {
+ ::hx::ObjectPtr< Date_obj > __this = new Date_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Date_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Date_obj *__this = (Date_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Date_obj), false, "snikket.Date"));
+ *(void **)__this = Date_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Date_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Date",4e,82,3c,2d); }
+
+ static ::String format( ::Date d);
+ static ::Dynamic format_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Date */
diff --git a/Sources/c_snikket/iinclude/include/snikket/DirectChat.h b/Sources/c_snikket/iinclude/include/snikket/DirectChat.h
new file mode 100644
index 0000000..e8a37c4
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/DirectChat.h
@@ -0,0 +1,96 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_DirectChat
+#define INCLUDED_snikket_DirectChat
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_Chat
+#include <snikket/Chat.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Chat)
+HX_DECLARE_CLASS1(snikket,ChatMessage)
+HX_DECLARE_CLASS1(snikket,ChatMessageBuilder)
+HX_DECLARE_CLASS1(snikket,Client)
+HX_DECLARE_CLASS1(snikket,DirectChat)
+HX_DECLARE_CLASS1(snikket,EventEmitter)
+HX_DECLARE_CLASS1(snikket,GenericStream)
+HX_DECLARE_CLASS1(snikket,Participant)
+HX_DECLARE_CLASS1(snikket,Persistence)
+HX_DECLARE_CLASS1(snikket,Reaction)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES DirectChat_obj : public ::snikket::Chat_obj
+{
+ public:
+ typedef ::snikket::Chat_obj super;
+ typedef DirectChat_obj OBJ_;
+ DirectChat_obj();
+
+ public:
+ enum { _hx_ClassId = 0x62c262be };
+
+ void __construct( ::snikket::Client client, ::snikket::GenericStream stream,::Dynamic persistence,::String chatId,::hx::Null< int > __o_uiState,::hx::Null< bool > __o_isBlocked, ::snikket::Stanza extensions,::String readUpToId,::String readUpToBy);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.DirectChat")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.DirectChat"); }
+ static ::hx::ObjectPtr< DirectChat_obj > __new( ::snikket::Client client, ::snikket::GenericStream stream,::Dynamic persistence,::String chatId,::hx::Null< int > __o_uiState,::hx::Null< bool > __o_isBlocked, ::snikket::Stanza extensions,::String readUpToId,::String readUpToBy);
+ static ::hx::ObjectPtr< DirectChat_obj > __alloc(::hx::Ctx *_hx_ctx, ::snikket::Client client, ::snikket::GenericStream stream,::Dynamic persistence,::String chatId,::hx::Null< int > __o_uiState,::hx::Null< bool > __o_isBlocked, ::snikket::Stanza extensions,::String readUpToId,::String readUpToBy);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~DirectChat_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("DirectChat",c1,22,a3,05); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ ::Array< ::String > getParticipants();
+
+ ::Array< ::String > counterparts();
+ ::Dynamic counterparts_dyn();
+
+ ::snikket::Participant getParticipantDetails(::String participantId);
+
+ void getMessagesBefore(::String beforeId,::String beforeTime, ::Dynamic handler);
+
+ void getMessagesAfter(::String afterId,::String afterTime, ::Dynamic handler);
+
+ void getMessagesAround(::String aroundId,::String aroundTime, ::Dynamic handler);
+
+ ::snikket::ChatMessageBuilder prepareIncomingMessage( ::snikket::ChatMessageBuilder message, ::snikket::Stanza stanza);
+
+ ::snikket::ChatMessageBuilder prepareOutgoingMessage( ::snikket::ChatMessageBuilder message);
+ ::Dynamic prepareOutgoingMessage_dyn();
+
+ void correctMessage(::String localId, ::snikket::ChatMessageBuilder message);
+
+ void sendMessage( ::snikket::ChatMessageBuilder message);
+
+ void removeReaction( ::snikket::ChatMessage m, ::snikket::Reaction reaction);
+
+ ::String lastMessageId();
+
+ void markReadUpTo( ::snikket::ChatMessage message);
+
+ void bookmark();
+
+ void sendChatState(::String state,::String threadId);
+
+ void close();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_DirectChat */
diff --git a/Sources/c_snikket/iinclude/include/snikket/Emoji.h b/Sources/c_snikket/iinclude/include/snikket/Emoji.h
new file mode 100644
index 0000000..685d92e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/Emoji.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Emoji
+#define INCLUDED_snikket_Emoji
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_Symbol
+#include <snikket/Symbol.h>
+#endif
+HX_DECLARE_STACK_FRAME(_hx_pos_dd1b4f8973e1f9df_136_new)
+HX_DECLARE_CLASS1(snikket,Emoji)
+HX_DECLARE_CLASS1(snikket,Symbol)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Emoji_obj : public ::snikket::Symbol_obj
+{
+ public:
+ typedef ::snikket::Symbol_obj super;
+ typedef Emoji_obj OBJ_;
+ Emoji_obj();
+
+ public:
+ enum { _hx_ClassId = 0x45c9a089 };
+
+ void __construct(::Array< int > codepoints);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Emoji")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Emoji"); }
+
+ inline static ::hx::ObjectPtr< Emoji_obj > __new(::Array< int > codepoints) {
+ ::hx::ObjectPtr< Emoji_obj > __this = new Emoji_obj();
+ __this->__construct(codepoints);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Emoji_obj > __alloc(::hx::Ctx *_hx_ctx,::Array< int > codepoints) {
+ Emoji_obj *__this = (Emoji_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Emoji_obj), true, "snikket.Emoji"));
+ *(void **)__this = Emoji_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_dd1b4f8973e1f9df_136_new)
+HXDLIN( 136) __this->super::__construct(codepoints);
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Emoji_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Emoji",66,df,06,03); }
+
+ bool isEmoji();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Emoji */
diff --git a/Sources/c_snikket/iinclude/include/snikket/EmojiUtil.h b/Sources/c_snikket/iinclude/include/snikket/EmojiUtil.h
new file mode 100644
index 0000000..f45f679
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/EmojiUtil.h
@@ -0,0 +1,95 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_EmojiUtil
+#define INCLUDED_snikket_EmojiUtil
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,EmojiUtil)
+HX_DECLARE_CLASS1(snikket,Symbol)
+HX_DECLARE_CLASS1(snikket,UnicodeBlocks)
+HX_DECLARE_CLASS1(snikket,UnicodeList)
+HX_DECLARE_CLASS1(snikket,UnicodeRange)
+HX_DECLARE_CLASS1(snikket,UnicodeSet)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES EmojiUtil_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef EmojiUtil_obj OBJ_;
+ EmojiUtil_obj();
+
+ public:
+ enum { _hx_ClassId = 0x636eb1f3 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="snikket.EmojiUtil")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"snikket.EmojiUtil"); }
+
+ inline static ::hx::ObjectPtr< EmojiUtil_obj > __new() {
+ ::hx::ObjectPtr< EmojiUtil_obj > __this = new EmojiUtil_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< EmojiUtil_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ EmojiUtil_obj *__this = (EmojiUtil_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(EmojiUtil_obj), false, "snikket.EmojiUtil"));
+ *(void **)__this = EmojiUtil_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~EmojiUtil_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("EmojiUtil",88,0e,c9,4c); }
+
+ static void __boot();
+ static ::snikket::UnicodeRange MISC_SYMBOLS_AND_PICTOGRAPHS;
+ static ::snikket::UnicodeRange SUPPLEMENTAL_SYMBOLS;
+ static ::snikket::UnicodeRange EMOTICONS;
+ static ::snikket::UnicodeRange MISC_SYMBOLS;
+ static ::snikket::UnicodeRange DINGBATS;
+ static ::snikket::UnicodeRange ENCLOSED_ALPHANUMERIC_SUPPLEMENT;
+ static ::snikket::UnicodeRange ENCLOSED_IDEOGRAPHIC_SUPPLEMENT;
+ static ::snikket::UnicodeRange REGIONAL_INDICATORS;
+ static ::snikket::UnicodeRange GEOMETRIC_SHAPES;
+ static ::snikket::UnicodeRange LATIN_SUPPLEMENT;
+ static ::snikket::UnicodeRange MISC_TECHNICAL;
+ static ::snikket::UnicodeRange TAGS;
+ static ::snikket::UnicodeList CYK_SYMBOLS_AND_PUNCTUATION;
+ static ::snikket::UnicodeList LETTERLIKE_SYMBOLS;
+ static ::snikket::UnicodeBlocks KEYCAP_COMBINEABLE;
+ static ::snikket::UnicodeBlocks SYMBOLIZE;
+ static ::snikket::UnicodeBlocks EMOJIS;
+ static int ZWJ;
+ static int VARIATION_16;
+ static int COMBINING_ENCLOSING_KEYCAP;
+ static int BLACK_FLAG;
+ static ::snikket::UnicodeRange FITZPATRICK;
+ static ::Array< ::Dynamic> parse(::String str);
+ static ::Dynamic parse_dyn();
+
+ static bool isEmoji(::String input);
+ static ::Dynamic isEmoji_dyn();
+
+ static bool isOnlyEmoji(::String input);
+ static ::Dynamic isOnlyEmoji_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_EmojiUtil */
diff --git a/Sources/c_snikket/iinclude/include/snikket/EventEmitter.h b/Sources/c_snikket/iinclude/include/snikket/EventEmitter.h
new file mode 100644
index 0000000..7b9ee4d
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/EventEmitter.h
@@ -0,0 +1,64 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_EventEmitter
+#define INCLUDED_snikket_EventEmitter
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+HX_DECLARE_CLASS1(snikket,EventEmitter)
+HX_DECLARE_CLASS1(snikket,EventHandler)
+HX_DECLARE_CLASS1(snikket,EventResult)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES EventEmitter_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef EventEmitter_obj OBJ_;
+ EventEmitter_obj();
+
+ public:
+ enum { _hx_ClassId = 0x6aca71d1 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.EventEmitter")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.EventEmitter"); }
+ static ::hx::ObjectPtr< EventEmitter_obj > __new();
+ static ::hx::ObjectPtr< EventEmitter_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~EventEmitter_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("EventEmitter",94,78,5d,17); }
+
+ ::haxe::ds::StringMap eventHandlers;
+ ::snikket::EventHandler on(::String eventName, ::Dynamic callback);
+ ::Dynamic on_dyn();
+
+ ::snikket::EventHandler once(::String eventName, ::Dynamic callback);
+ ::Dynamic once_dyn();
+
+ ::snikket::EventResult trigger(::String eventName, ::Dynamic eventData);
+ ::Dynamic trigger_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_EventEmitter */
diff --git a/Sources/c_snikket/iinclude/include/snikket/EventHandler.h b/Sources/c_snikket/iinclude/include/snikket/EventHandler.h
new file mode 100644
index 0000000..c25353d
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/EventHandler.h
@@ -0,0 +1,64 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_EventHandler
+#define INCLUDED_snikket_EventHandler
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,EventHandler)
+HX_DECLARE_CLASS1(snikket,EventResult)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES EventHandler_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef EventHandler_obj OBJ_;
+ EventHandler_obj();
+
+ public:
+ enum { _hx_ClassId = 0x39717849 };
+
+ void __construct(::Array< ::Dynamic> handlers, ::Dynamic callback, ::Dynamic onlyOnce);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.EventHandler")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.EventHandler"); }
+ static ::hx::ObjectPtr< EventHandler_obj > __new(::Array< ::Dynamic> handlers, ::Dynamic callback, ::Dynamic onlyOnce);
+ static ::hx::ObjectPtr< EventHandler_obj > __alloc(::hx::Ctx *_hx_ctx,::Array< ::Dynamic> handlers, ::Dynamic callback, ::Dynamic onlyOnce);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~EventHandler_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("EventHandler",f0,f2,3c,9e); }
+
+ ::Array< ::Dynamic> handlers;
+ ::Dynamic callback;
+ Dynamic callback_dyn() { return callback;}
+ bool onlyOnce;
+ ::snikket::EventResult call( ::Dynamic data);
+ ::Dynamic call_dyn();
+
+ ::snikket::EventHandler once();
+ ::Dynamic once_dyn();
+
+ void unsubscribe();
+ ::Dynamic unsubscribe_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_EventHandler */
diff --git a/Sources/c_snikket/iinclude/include/snikket/EventResult.h b/Sources/c_snikket/iinclude/include/snikket/EventResult.h
new file mode 100644
index 0000000..b3b5504
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/EventResult.h
@@ -0,0 +1,39 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_EventResult
+#define INCLUDED_snikket_EventResult
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,EventResult)
+namespace snikket{
+
+
+class EventResult_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef EventResult_obj OBJ_;
+
+ public:
+ EventResult_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("snikket.EventResult",06,97,23,e2); }
+ ::String __ToString() const { return HX_("EventResult.",d7,9b,be,c3) + _hx_tag; }
+
+ static ::snikket::EventResult EventHandled;
+ static inline ::snikket::EventResult EventHandled_dyn() { return EventHandled; }
+ static ::snikket::EventResult EventStop;
+ static inline ::snikket::EventResult EventStop_dyn() { return EventStop; }
+ static ::snikket::EventResult EventUnhandled;
+ static inline ::snikket::EventResult EventUnhandled_dyn() { return EventUnhandled; }
+ static ::snikket::EventResult EventValue( ::Dynamic result);
+ static ::Dynamic EventValue_dyn();
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_EventResult */
diff --git a/Sources/c_snikket/iinclude/include/snikket/GenericStream.h b/Sources/c_snikket/iinclude/include/snikket/GenericStream.h
new file mode 100644
index 0000000..50fc0bd
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/GenericStream.h
@@ -0,0 +1,72 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_GenericStream
+#define INCLUDED_snikket_GenericStream
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_EventEmitter
+#include <snikket/EventEmitter.h>
+#endif
+HX_DECLARE_CLASS1(snikket,EventEmitter)
+HX_DECLARE_CLASS1(snikket,GenericStream)
+HX_DECLARE_CLASS1(snikket,IqRequestType)
+HX_DECLARE_CLASS1(snikket,IqResult)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES GenericStream_obj : public ::snikket::EventEmitter_obj
+{
+ public:
+ typedef ::snikket::EventEmitter_obj super;
+ typedef GenericStream_obj OBJ_;
+ GenericStream_obj();
+
+ public:
+ enum { _hx_ClassId = 0x785c9e5e };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.GenericStream")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.GenericStream"); }
+
+ //~GenericStream_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("GenericStream",d7,75,9c,45); }
+
+ ::String clientId;
+ bool csi;
+ virtual void connect(::String jid,::Array< unsigned char > sm) {}
+ ::Dynamic connect_dyn();
+ virtual void disconnect() {}
+ ::Dynamic disconnect_dyn();
+ virtual void sendStanza( ::snikket::Stanza stanza) {}
+ ::Dynamic sendStanza_dyn();
+ virtual ::String newId() { return 0; }
+ ::Dynamic newId_dyn();
+ virtual void onIq( ::snikket::IqRequestType type,::String tag,::String xmlns, ::Dynamic handler) {}
+ ::Dynamic onIq_dyn();
+ void sendIq( ::snikket::Stanza stanza, ::Dynamic callback);
+ ::Dynamic sendIq_dyn();
+
+ void onStanza( ::snikket::Stanza stanza);
+ ::Dynamic onStanza_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_GenericStream */
diff --git a/Sources/c_snikket/iinclude/include/snikket/Hash.h b/Sources/c_snikket/iinclude/include/snikket/Hash.h
new file mode 100644
index 0000000..8be664d
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/Hash.h
@@ -0,0 +1,89 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Hash
+#define INCLUDED_snikket_Hash
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS1(snikket,Hash)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Hash_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Hash_obj OBJ_;
+ Hash_obj();
+
+ public:
+ enum { _hx_ClassId = 0x05b4502b };
+
+ void __construct(::String algorithm,::Array< unsigned char > hash);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Hash")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Hash"); }
+ static ::hx::ObjectPtr< Hash_obj > __new(::String algorithm,::Array< unsigned char > hash);
+ static ::hx::ObjectPtr< Hash_obj > __alloc(::hx::Ctx *_hx_ctx,::String algorithm,::Array< unsigned char > hash);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Hash_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Hash",ee,5b,e1,2f); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ static ::snikket::Hash fromHex(::String algorithm,::String hash);
+ static ::Dynamic fromHex_dyn();
+
+ static ::snikket::Hash fromUri(::String uri);
+ static ::Dynamic fromUri_dyn();
+
+ static ::snikket::Hash sha1( ::haxe::io::Bytes bytes);
+ static ::Dynamic sha1_dyn();
+
+ static ::snikket::Hash sha256( ::haxe::io::Bytes bytes);
+ static ::Dynamic sha256_dyn();
+
+ ::String algorithm;
+ ::String algorithm__fromC();
+ ::Dynamic algorithm__fromC_dyn();
+
+ ::Array< unsigned char > hash;
+ ::String toUri();
+ ::Dynamic toUri_dyn();
+
+ ::String bobUri();
+ ::Dynamic bobUri_dyn();
+
+ ::String serializeUri();
+ ::Dynamic serializeUri_dyn();
+
+ ::String toHex();
+ ::Dynamic toHex_dyn();
+
+ ::String toBase64();
+ ::Dynamic toBase64_dyn();
+
+ ::String toBase64Url();
+ ::Dynamic toBase64Url_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Hash */
diff --git a/Sources/c_snikket/iinclude/include/snikket/ID.h b/Sources/c_snikket/iinclude/include/snikket/ID.h
new file mode 100644
index 0000000..6d5d8c6
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/ID.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_ID
+#define INCLUDED_snikket_ID
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,ID)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES ID_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef ID_obj OBJ_;
+ ID_obj();
+
+ public:
+ enum { _hx_ClassId = 0x5880bad8 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="snikket.ID")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"snikket.ID"); }
+
+ inline static ::hx::ObjectPtr< ID_obj > __new() {
+ ::hx::ObjectPtr< ID_obj > __this = new ID_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< ID_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ ID_obj *__this = (ID_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(ID_obj), false, "snikket.ID"));
+ *(void **)__this = ID_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ID_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("ID",db,3f,00,00); }
+
+ static ::String tiny();
+ static ::Dynamic tiny_dyn();
+
+ static ::String _hx_short();
+ static ::Dynamic _hx_short_dyn();
+
+ static ::String medium();
+ static ::Dynamic medium_dyn();
+
+ static ::String _hx_long();
+ static ::Dynamic _hx_long_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_ID */
diff --git a/Sources/c_snikket/iinclude/include/snikket/Identicon.h b/Sources/c_snikket/iinclude/include/snikket/Identicon.h
new file mode 100644
index 0000000..f440dab
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/Identicon.h
@@ -0,0 +1,60 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Identicon
+#define INCLUDED_snikket_Identicon
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Identicon)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Identicon_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Identicon_obj OBJ_;
+ Identicon_obj();
+
+ public:
+ enum { _hx_ClassId = 0x3ab0d0ec };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="snikket.Identicon")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"snikket.Identicon"); }
+
+ inline static ::hx::ObjectPtr< Identicon_obj > __new() {
+ ::hx::ObjectPtr< Identicon_obj > __this = new Identicon_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Identicon_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Identicon_obj *__this = (Identicon_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Identicon_obj), false, "snikket.Identicon"));
+ *(void **)__this = Identicon_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Identicon_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Identicon",49,42,f3,f1); }
+
+ static ::String svg(::String source);
+ static ::Dynamic svg_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Identicon */
diff --git a/Sources/c_snikket/iinclude/include/snikket/Identity.h b/Sources/c_snikket/iinclude/include/snikket/Identity.h
new file mode 100644
index 0000000..28c9c85
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/Identity.h
@@ -0,0 +1,61 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Identity
+#define INCLUDED_snikket_Identity
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Identity)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Identity_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Identity_obj OBJ_;
+ Identity_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7fcd1307 };
+
+ void __construct(::String category,::String type,::String name);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Identity")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Identity"); }
+ static ::hx::ObjectPtr< Identity_obj > __new(::String category,::String type,::String name);
+ static ::hx::ObjectPtr< Identity_obj > __alloc(::hx::Ctx *_hx_ctx,::String category,::String type,::String name);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Identity_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Identity",5e,01,e1,92); }
+
+ ::String category;
+ ::String type;
+ ::String name;
+ void addToDisco( ::snikket::Stanza stanza);
+ ::Dynamic addToDisco_dyn();
+
+ ::String ver();
+ ::Dynamic ver_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Identity */
diff --git a/Sources/c_snikket/iinclude/include/snikket/IqRequestType.h b/Sources/c_snikket/iinclude/include/snikket/IqRequestType.h
new file mode 100644
index 0000000..b4f759d
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/IqRequestType.h
@@ -0,0 +1,35 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_IqRequestType
+#define INCLUDED_snikket_IqRequestType
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,IqRequestType)
+namespace snikket{
+
+
+class IqRequestType_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef IqRequestType_obj OBJ_;
+
+ public:
+ IqRequestType_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("snikket.IqRequestType",d0,62,72,94); }
+ ::String __ToString() const { return HX_("IqRequestType.",8d,9a,13,cc) + _hx_tag; }
+
+ static ::snikket::IqRequestType Get;
+ static inline ::snikket::IqRequestType Get_dyn() { return Get; }
+ static ::snikket::IqRequestType Set;
+ static inline ::snikket::IqRequestType Set_dyn() { return Set; }
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_IqRequestType */
diff --git a/Sources/c_snikket/iinclude/include/snikket/IqResult.h b/Sources/c_snikket/iinclude/include/snikket/IqResult.h
new file mode 100644
index 0000000..81b0271
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/IqResult.h
@@ -0,0 +1,39 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_IqResult
+#define INCLUDED_snikket_IqResult
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,IqResult)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+namespace snikket{
+
+
+class IqResult_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef IqResult_obj OBJ_;
+
+ public:
+ IqResult_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("snikket.IqResult",16,e9,a3,c2); }
+ ::String __ToString() const { return HX_("IqResult.",89,d1,c3,9e) + _hx_tag; }
+
+ static ::snikket::IqResult IqNoResult;
+ static inline ::snikket::IqResult IqNoResult_dyn() { return IqNoResult; }
+ static ::snikket::IqResult IqResult;
+ static inline ::snikket::IqResult IqResult_dyn() { return IqResult; }
+ static ::snikket::IqResult IqResultElement( ::snikket::Stanza element);
+ static ::Dynamic IqResultElement_dyn();
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_IqResult */
diff --git a/Sources/c_snikket/iinclude/include/snikket/JID.h b/Sources/c_snikket/iinclude/include/snikket/JID.h
new file mode 100644
index 0000000..c64d0d0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/JID.h
@@ -0,0 +1,78 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_JID
+#define INCLUDED_snikket_JID
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,JID)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES JID_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef JID_obj OBJ_;
+ JID_obj();
+
+ public:
+ enum { _hx_ClassId = 0x18238908 };
+
+ void __construct(::String node,::String domain,::String resource);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.JID")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.JID"); }
+ static ::hx::ObjectPtr< JID_obj > __new(::String node,::String domain,::String resource);
+ static ::hx::ObjectPtr< JID_obj > __alloc(::hx::Ctx *_hx_ctx,::String node,::String domain,::String resource);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~JID_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("JID",a5,66,38,00); }
+
+ static ::snikket::JID parse(::String jid);
+ static ::Dynamic parse_dyn();
+
+ ::String node;
+ ::String domain;
+ ::String resource;
+ ::snikket::JID asBare();
+ ::Dynamic asBare_dyn();
+
+ ::snikket::JID withResource(::String resource);
+ ::Dynamic withResource_dyn();
+
+ bool isValid();
+ ::Dynamic isValid_dyn();
+
+ bool isDomain();
+ ::Dynamic isDomain_dyn();
+
+ bool isBare();
+ ::Dynamic isBare_dyn();
+
+ bool equals( ::snikket::JID rhs);
+ ::Dynamic equals_dyn();
+
+ ::String asString();
+ ::Dynamic asString_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_JID */
diff --git a/Sources/c_snikket/iinclude/include/snikket/Message.h b/Sources/c_snikket/iinclude/include/snikket/Message.h
new file mode 100644
index 0000000..931dcc6
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/Message.h
@@ -0,0 +1,63 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Message
+#define INCLUDED_snikket_Message
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,ChatMessageBuilder)
+HX_DECLARE_CLASS1(snikket,JID)
+HX_DECLARE_CLASS1(snikket,Message)
+HX_DECLARE_CLASS1(snikket,MessageStanza)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Message_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Message_obj OBJ_;
+ Message_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7c0c6d2e };
+
+ void __construct(::String chatId,::String senderId,::String threadId, ::snikket::MessageStanza parsed);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Message")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Message"); }
+ static ::hx::ObjectPtr< Message_obj > __new(::String chatId,::String senderId,::String threadId, ::snikket::MessageStanza parsed);
+ static ::hx::ObjectPtr< Message_obj > __alloc(::hx::Ctx *_hx_ctx,::String chatId,::String senderId,::String threadId, ::snikket::MessageStanza parsed);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Message_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Message",a7,5d,62,67); }
+
+ static ::snikket::Message fromStanza( ::snikket::Stanza stanza, ::snikket::JID localJid, ::Dynamic addContext);
+ static ::Dynamic fromStanza_dyn();
+
+ ::String chatId;
+ ::String senderId;
+ ::String threadId;
+ ::snikket::MessageStanza parsed;
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Message */
diff --git a/Sources/c_snikket/iinclude/include/snikket/MessageStanza.h b/Sources/c_snikket/iinclude/include/snikket/MessageStanza.h
new file mode 100644
index 0000000..486e5a6
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/MessageStanza.h
@@ -0,0 +1,46 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_MessageStanza
+#define INCLUDED_snikket_MessageStanza
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,ChatMessage)
+HX_DECLARE_CLASS1(snikket,MessageStanza)
+HX_DECLARE_CLASS1(snikket,ModerationAction)
+HX_DECLARE_CLASS1(snikket,ReactionUpdate)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+namespace snikket{
+
+
+class MessageStanza_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef MessageStanza_obj OBJ_;
+
+ public:
+ MessageStanza_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("snikket.MessageStanza",4b,b3,84,a4); }
+ ::String __ToString() const { return HX_("MessageStanza.",b2,b5,07,cc) + _hx_tag; }
+
+ static ::snikket::MessageStanza ChatMessageStanza( ::snikket::ChatMessage message);
+ static ::Dynamic ChatMessageStanza_dyn();
+ static ::snikket::MessageStanza ErrorMessageStanza( ::snikket::Stanza stanza);
+ static ::Dynamic ErrorMessageStanza_dyn();
+ static ::snikket::MessageStanza ModerateMessageStanza( ::snikket::ModerationAction action);
+ static ::Dynamic ModerateMessageStanza_dyn();
+ static ::snikket::MessageStanza ReactionUpdateStanza( ::snikket::ReactionUpdate update);
+ static ::Dynamic ReactionUpdateStanza_dyn();
+ static ::snikket::MessageStanza UnknownMessageStanza( ::snikket::Stanza stanza);
+ static ::Dynamic UnknownMessageStanza_dyn();
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_MessageStanza */
diff --git a/Sources/c_snikket/iinclude/include/snikket/MessageSync.h b/Sources/c_snikket/iinclude/include/snikket/MessageSync.h
new file mode 100644
index 0000000..7469276
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/MessageSync.h
@@ -0,0 +1,91 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_MessageSync
+#define INCLUDED_snikket_MessageSync
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+HX_DECLARE_CLASS1(snikket,ChatMessageBuilder)
+HX_DECLARE_CLASS1(snikket,Client)
+HX_DECLARE_CLASS1(snikket,EventEmitter)
+HX_DECLARE_CLASS1(snikket,GenericStream)
+HX_DECLARE_CLASS1(snikket,MessageSync)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES MessageSync_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef MessageSync_obj OBJ_;
+ MessageSync_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0c8e50c1 };
+
+ void __construct( ::snikket::Client client, ::snikket::GenericStream stream, ::Dynamic filter,::String serviceJID);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.MessageSync")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.MessageSync"); }
+ static ::hx::ObjectPtr< MessageSync_obj > __new( ::snikket::Client client, ::snikket::GenericStream stream, ::Dynamic filter,::String serviceJID);
+ static ::hx::ObjectPtr< MessageSync_obj > __alloc(::hx::Ctx *_hx_ctx, ::snikket::Client client, ::snikket::GenericStream stream, ::Dynamic filter,::String serviceJID);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~MessageSync_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("MessageSync",a2,a3,78,63); }
+
+ ::snikket::Client client;
+ ::snikket::GenericStream stream;
+ ::Dynamic filter;
+ ::String serviceJID;
+ ::Dynamic handler;
+ Dynamic handler_dyn() { return handler;}
+ ::Dynamic contextHandler;
+ Dynamic contextHandler_dyn() { return contextHandler;}
+ ::Dynamic errorHandler;
+ Dynamic errorHandler_dyn() { return errorHandler;}
+ ::Dynamic lastPage;
+ int progress;
+ bool complete;
+ bool newestPageFirst;
+ ::haxe::ds::StringMap jmi;
+ void fetchNext();
+ ::Dynamic fetchNext_dyn();
+
+ bool hasMore();
+ ::Dynamic hasMore_dyn();
+
+ void addContext( ::Dynamic handler);
+ ::Dynamic addContext_dyn();
+
+ void onMessages( ::Dynamic handler);
+ ::Dynamic onMessages_dyn();
+
+ void onError( ::Dynamic handler);
+ ::Dynamic onError_dyn();
+
+ void setNewestPageFirst(bool newestPageFirst);
+ ::Dynamic setNewestPageFirst_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_MessageSync */
diff --git a/Sources/c_snikket/iinclude/include/snikket/ModerationAction.h b/Sources/c_snikket/iinclude/include/snikket/ModerationAction.h
new file mode 100644
index 0000000..16f7e22
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/ModerationAction.h
@@ -0,0 +1,76 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_ModerationAction
+#define INCLUDED_snikket_ModerationAction
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_cab007b58fe42bf8_10_new)
+HX_DECLARE_CLASS1(snikket,ModerationAction)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES ModerationAction_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef ModerationAction_obj OBJ_;
+ ModerationAction_obj();
+
+ public:
+ enum { _hx_ClassId = 0x2ac69cd9 };
+
+ void __construct(::String chatId,::String moderateServerId,::String timestamp,::String moderatorId,::String reason);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.ModerationAction")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.ModerationAction"); }
+
+ inline static ::hx::ObjectPtr< ModerationAction_obj > __new(::String chatId,::String moderateServerId,::String timestamp,::String moderatorId,::String reason) {
+ ::hx::ObjectPtr< ModerationAction_obj > __this = new ModerationAction_obj();
+ __this->__construct(chatId,moderateServerId,timestamp,moderatorId,reason);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< ModerationAction_obj > __alloc(::hx::Ctx *_hx_ctx,::String chatId,::String moderateServerId,::String timestamp,::String moderatorId,::String reason) {
+ ModerationAction_obj *__this = (ModerationAction_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(ModerationAction_obj), true, "snikket.ModerationAction"));
+ *(void **)__this = ModerationAction_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_cab007b58fe42bf8_10_new)
+HXLINE( 11) ( ( ::snikket::ModerationAction)(__this) )->chatId = chatId;
+HXLINE( 12) ( ( ::snikket::ModerationAction)(__this) )->moderateServerId = moderateServerId;
+HXLINE( 13) ( ( ::snikket::ModerationAction)(__this) )->timestamp = timestamp;
+HXLINE( 14) ( ( ::snikket::ModerationAction)(__this) )->moderatorId = moderatorId;
+HXLINE( 15) ( ( ::snikket::ModerationAction)(__this) )->reason = reason;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ModerationAction_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("ModerationAction",1c,c1,77,cb); }
+
+ ::String chatId;
+ ::String moderateServerId;
+ ::String timestamp;
+ ::String moderatorId;
+ ::String reason;
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_ModerationAction */
diff --git a/Sources/c_snikket/iinclude/include/snikket/Node.h b/Sources/c_snikket/iinclude/include/snikket/Node.h
new file mode 100644
index 0000000..31bf990
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/Node.h
@@ -0,0 +1,38 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Node
+#define INCLUDED_snikket_Node
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Node)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS1(snikket,TextNode)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+namespace snikket{
+
+
+class Node_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef Node_obj OBJ_;
+
+ public:
+ Node_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("snikket.Node",b3,af,c7,53); }
+ ::String __ToString() const { return HX_("Node.",cc,27,ec,32) + _hx_tag; }
+
+ static ::snikket::Node CData( ::snikket::TextNode textNode);
+ static ::Dynamic CData_dyn();
+ static ::snikket::Node Element( ::snikket::Stanza stanza);
+ static ::Dynamic Element_dyn();
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Node */
diff --git a/Sources/c_snikket/iinclude/include/snikket/Notification.h b/Sources/c_snikket/iinclude/include/snikket/Notification.h
new file mode 100644
index 0000000..d41f56b
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/Notification.h
@@ -0,0 +1,98 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Notification
+#define INCLUDED_snikket_Notification
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_b0a79cae3ba17812_21_new)
+HX_DECLARE_CLASS1(snikket,ChatMessage)
+HX_DECLARE_CLASS1(snikket,Notification)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Notification_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Notification_obj OBJ_;
+ Notification_obj();
+
+ public:
+ enum { _hx_ClassId = 0x778a3c48 };
+
+ void __construct(::String title,::String body,::String accountId,::String chatId,::String messageId,int type,::String callStatus,::String callSid,::String imageUri,::String lang,::String timestamp);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Notification")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Notification"); }
+
+ inline static ::hx::ObjectPtr< Notification_obj > __new(::String title,::String body,::String accountId,::String chatId,::String messageId,int type,::String callStatus,::String callSid,::String imageUri,::String lang,::String timestamp) {
+ ::hx::ObjectPtr< Notification_obj > __this = new Notification_obj();
+ __this->__construct(title,body,accountId,chatId,messageId,type,callStatus,callSid,imageUri,lang,timestamp);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Notification_obj > __alloc(::hx::Ctx *_hx_ctx,::String title,::String body,::String accountId,::String chatId,::String messageId,int type,::String callStatus,::String callSid,::String imageUri,::String lang,::String timestamp) {
+ Notification_obj *__this = (Notification_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Notification_obj), true, "snikket.Notification"));
+ *(void **)__this = Notification_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_b0a79cae3ba17812_21_new)
+HXLINE( 22) ( ( ::snikket::Notification)(__this) )->title = title;
+HXLINE( 23) ( ( ::snikket::Notification)(__this) )->body = body;
+HXLINE( 24) ( ( ::snikket::Notification)(__this) )->accountId = accountId;
+HXLINE( 25) ( ( ::snikket::Notification)(__this) )->chatId = chatId;
+HXLINE( 26) ( ( ::snikket::Notification)(__this) )->messageId = messageId;
+HXLINE( 27) ( ( ::snikket::Notification)(__this) )->type = type;
+HXLINE( 28) ( ( ::snikket::Notification)(__this) )->callStatus = callStatus;
+HXLINE( 29) ( ( ::snikket::Notification)(__this) )->callSid = callSid;
+HXLINE( 30) ( ( ::snikket::Notification)(__this) )->imageUri = imageUri;
+HXLINE( 31) ( ( ::snikket::Notification)(__this) )->lang = lang;
+HXLINE( 32) ( ( ::snikket::Notification)(__this) )->timestamp = timestamp;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Notification_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Notification",0b,43,1d,24); }
+
+ static ::snikket::Notification fromChatMessage( ::snikket::ChatMessage m);
+ static ::Dynamic fromChatMessage_dyn();
+
+ static ::snikket::Notification fromThinStanza( ::snikket::Stanza stanza);
+ static ::Dynamic fromThinStanza_dyn();
+
+ ::String title;
+ ::String body;
+ ::String accountId;
+ ::String chatId;
+ ::String messageId;
+ int type;
+ ::String callStatus;
+ ::String callSid;
+ ::String imageUri;
+ ::String lang;
+ ::String timestamp;
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Notification */
diff --git a/Sources/c_snikket/iinclude/include/snikket/Other.h b/Sources/c_snikket/iinclude/include/snikket/Other.h
new file mode 100644
index 0000000..500f13e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/Other.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Other
+#define INCLUDED_snikket_Other
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_Symbol
+#include <snikket/Symbol.h>
+#endif
+HX_DECLARE_STACK_FRAME(_hx_pos_aac171f877c525f9_146_new)
+HX_DECLARE_CLASS1(snikket,Other)
+HX_DECLARE_CLASS1(snikket,Symbol)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Other_obj : public ::snikket::Symbol_obj
+{
+ public:
+ typedef ::snikket::Symbol_obj super;
+ typedef Other_obj OBJ_;
+ Other_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0c6697d3 };
+
+ void __construct(::Array< int > codepoints);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Other")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Other"); }
+
+ inline static ::hx::ObjectPtr< Other_obj > __new(::Array< int > codepoints) {
+ ::hx::ObjectPtr< Other_obj > __this = new Other_obj();
+ __this->__construct(codepoints);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Other_obj > __alloc(::hx::Ctx *_hx_ctx,::Array< int > codepoints) {
+ Other_obj *__this = (Other_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Other_obj), true, "snikket.Other"));
+ *(void **)__this = Other_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_aac171f877c525f9_146_new)
+HXDLIN( 146) __this->super::__construct(codepoints);
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Other_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Other",b0,d6,a3,c9); }
+
+ bool isEmoji();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Other */
diff --git a/Sources/c_snikket/iinclude/include/snikket/Participant.h b/Sources/c_snikket/iinclude/include/snikket/Participant.h
new file mode 100644
index 0000000..5317907
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/Participant.h
@@ -0,0 +1,88 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Participant
+#define INCLUDED_snikket_Participant
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_33195ab9b813f4c6_20_new)
+HX_DECLARE_CLASS1(snikket,Participant)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Participant_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Participant_obj OBJ_;
+ Participant_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7d555cf6 };
+
+ void __construct(::String displayName,::String photoUri,::String placeholderUri,bool isSelf);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Participant")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Participant"); }
+
+ inline static ::hx::ObjectPtr< Participant_obj > __new(::String displayName,::String photoUri,::String placeholderUri,bool isSelf) {
+ ::hx::ObjectPtr< Participant_obj > __this = new Participant_obj();
+ __this->__construct(displayName,photoUri,placeholderUri,isSelf);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Participant_obj > __alloc(::hx::Ctx *_hx_ctx,::String displayName,::String photoUri,::String placeholderUri,bool isSelf) {
+ Participant_obj *__this = (Participant_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Participant_obj), true, "snikket.Participant"));
+ *(void **)__this = Participant_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_33195ab9b813f4c6_20_new)
+HXLINE( 21) ( ( ::snikket::Participant)(__this) )->displayName = displayName;
+HXLINE( 22) ( ( ::snikket::Participant)(__this) )->photoUri = photoUri;
+HXLINE( 23) ( ( ::snikket::Participant)(__this) )->placeholderUri = placeholderUri;
+HXLINE( 24) ( ( ::snikket::Participant)(__this) )->isSelf = isSelf;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Participant_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Participant",93,9f,1c,5f); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ ::String displayName;
+ ::String displayName__fromC();
+ ::Dynamic displayName__fromC_dyn();
+
+ ::String photoUri;
+ ::String photoUri__fromC();
+ ::Dynamic photoUri__fromC_dyn();
+
+ ::String placeholderUri;
+ ::String placeholderUri__fromC();
+ ::Dynamic placeholderUri__fromC_dyn();
+
+ bool isSelf;
+ bool isSelf__fromC();
+ ::Dynamic isSelf__fromC_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Participant */
diff --git a/Sources/c_snikket/iinclude/include/snikket/Persistence.h b/Sources/c_snikket/iinclude/include/snikket/Persistence.h
new file mode 100644
index 0000000..b3621d1
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/Persistence.h
@@ -0,0 +1,129 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Persistence
+#define INCLUDED_snikket_Persistence
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Caps)
+HX_DECLARE_CLASS1(snikket,Chat)
+HX_DECLARE_CLASS1(snikket,ChatMessage)
+HX_DECLARE_CLASS1(snikket,Persistence)
+HX_DECLARE_CLASS1(snikket,ReactionUpdate)
+HX_DECLARE_CLASS1(snikket,SerializedChat)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Persistence_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ static void __boot();
+ void (::hx::Object :: *_hx_lastId)(::String accountId,::String chatId, ::Dynamic callback);
+ static inline void lastId( ::Dynamic _hx_,::String accountId,::String chatId, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_lastId)(accountId,chatId,callback);
+ }
+ void (::hx::Object :: *_hx_storeChats)(::String accountId,::Array< ::Dynamic> chats);
+ static inline void storeChats( ::Dynamic _hx_,::String accountId,::Array< ::Dynamic> chats) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_storeChats)(accountId,chats);
+ }
+ void (::hx::Object :: *_hx_getChats)(::String accountId, ::Dynamic callback);
+ static inline void getChats( ::Dynamic _hx_,::String accountId, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_getChats)(accountId,callback);
+ }
+ void (::hx::Object :: *_hx_getChatsUnreadDetails)(::String accountId,::Array< ::Dynamic> chats, ::Dynamic callback);
+ static inline void getChatsUnreadDetails( ::Dynamic _hx_,::String accountId,::Array< ::Dynamic> chats, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_getChatsUnreadDetails)(accountId,chats,callback);
+ }
+ void (::hx::Object :: *_hx_storeReaction)(::String accountId, ::snikket::ReactionUpdate update, ::Dynamic callback);
+ static inline void storeReaction( ::Dynamic _hx_,::String accountId, ::snikket::ReactionUpdate update, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_storeReaction)(accountId,update,callback);
+ }
+ void (::hx::Object :: *_hx_storeMessages)(::String accountId,::Array< ::Dynamic> message, ::Dynamic callback);
+ static inline void storeMessages( ::Dynamic _hx_,::String accountId,::Array< ::Dynamic> message, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_storeMessages)(accountId,message,callback);
+ }
+ void (::hx::Object :: *_hx_updateMessage)(::String accountId, ::snikket::ChatMessage message);
+ static inline void updateMessage( ::Dynamic _hx_,::String accountId, ::snikket::ChatMessage message) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_updateMessage)(accountId,message);
+ }
+ void (::hx::Object :: *_hx_updateMessageStatus)(::String accountId,::String localId,int status, ::Dynamic callback);
+ static inline void updateMessageStatus( ::Dynamic _hx_,::String accountId,::String localId,int status, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_updateMessageStatus)(accountId,localId,status,callback);
+ }
+ void (::hx::Object :: *_hx_getMessage)(::String accountId,::String chatId,::String serverId,::String localId, ::Dynamic callback);
+ static inline void getMessage( ::Dynamic _hx_,::String accountId,::String chatId,::String serverId,::String localId, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_getMessage)(accountId,chatId,serverId,localId,callback);
+ }
+ void (::hx::Object :: *_hx_getMessagesBefore)(::String accountId,::String chatId,::String beforeId,::String beforeTime, ::Dynamic callback);
+ static inline void getMessagesBefore( ::Dynamic _hx_,::String accountId,::String chatId,::String beforeId,::String beforeTime, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_getMessagesBefore)(accountId,chatId,beforeId,beforeTime,callback);
+ }
+ void (::hx::Object :: *_hx_getMessagesAfter)(::String accountId,::String chatId,::String afterId,::String afterTime, ::Dynamic callback);
+ static inline void getMessagesAfter( ::Dynamic _hx_,::String accountId,::String chatId,::String afterId,::String afterTime, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_getMessagesAfter)(accountId,chatId,afterId,afterTime,callback);
+ }
+ void (::hx::Object :: *_hx_getMessagesAround)(::String accountId,::String chatId,::String aroundId,::String aroundTime, ::Dynamic callback);
+ static inline void getMessagesAround( ::Dynamic _hx_,::String accountId,::String chatId,::String aroundId,::String aroundTime, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_getMessagesAround)(accountId,chatId,aroundId,aroundTime,callback);
+ }
+ void (::hx::Object :: *_hx_hasMedia)(::String hashAlgorithm,::Array< unsigned char > hash, ::Dynamic callback);
+ static inline void hasMedia( ::Dynamic _hx_,::String hashAlgorithm,::Array< unsigned char > hash, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_hasMedia)(hashAlgorithm,hash,callback);
+ }
+ void (::hx::Object :: *_hx_storeMedia)(::String mime,::Array< unsigned char > bytes, ::Dynamic callback);
+ static inline void storeMedia( ::Dynamic _hx_,::String mime,::Array< unsigned char > bytes, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_storeMedia)(mime,bytes,callback);
+ }
+ void (::hx::Object :: *_hx_removeMedia)(::String hashAlgorithm,::Array< unsigned char > hash);
+ static inline void removeMedia( ::Dynamic _hx_,::String hashAlgorithm,::Array< unsigned char > hash) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_removeMedia)(hashAlgorithm,hash);
+ }
+ void (::hx::Object :: *_hx_storeCaps)( ::snikket::Caps caps);
+ static inline void storeCaps( ::Dynamic _hx_, ::snikket::Caps caps) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_storeCaps)(caps);
+ }
+ void (::hx::Object :: *_hx_getCaps)(::String ver, ::Dynamic callback);
+ static inline void getCaps( ::Dynamic _hx_,::String ver, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_getCaps)(ver,callback);
+ }
+ void (::hx::Object :: *_hx_storeLogin)(::String login,::String clientId,::String displayName,::String token);
+ static inline void storeLogin( ::Dynamic _hx_,::String login,::String clientId,::String displayName,::String token) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_storeLogin)(login,clientId,displayName,token);
+ }
+ void (::hx::Object :: *_hx_getLogin)(::String login, ::Dynamic callback);
+ static inline void getLogin( ::Dynamic _hx_,::String login, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_getLogin)(login,callback);
+ }
+ void (::hx::Object :: *_hx_removeAccount)(::String accountId,bool completely);
+ static inline void removeAccount( ::Dynamic _hx_,::String accountId,bool completely) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_removeAccount)(accountId,completely);
+ }
+ void (::hx::Object :: *_hx_listAccounts)( ::Dynamic callback);
+ static inline void listAccounts( ::Dynamic _hx_, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_listAccounts)(callback);
+ }
+ void (::hx::Object :: *_hx_storeStreamManagement)(::String accountId,::Array< unsigned char > data);
+ static inline void storeStreamManagement( ::Dynamic _hx_,::String accountId,::Array< unsigned char > data) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_storeStreamManagement)(accountId,data);
+ }
+ void (::hx::Object :: *_hx_getStreamManagement)(::String accountId, ::Dynamic callback);
+ static inline void getStreamManagement( ::Dynamic _hx_,::String accountId, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_getStreamManagement)(accountId,callback);
+ }
+ void (::hx::Object :: *_hx_storeService)(::String accountId,::String serviceId,::String name,::String node, ::snikket::Caps caps);
+ static inline void storeService( ::Dynamic _hx_,::String accountId,::String serviceId,::String name,::String node, ::snikket::Caps caps) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_storeService)(accountId,serviceId,name,node,caps);
+ }
+ void (::hx::Object :: *_hx_findServicesWithFeature)(::String accountId,::String feature, ::Dynamic callback);
+ static inline void findServicesWithFeature( ::Dynamic _hx_,::String accountId,::String feature, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_findServicesWithFeature)(accountId,feature,callback);
+ }
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Persistence */
diff --git a/Sources/c_snikket/iinclude/include/snikket/Presence.h b/Sources/c_snikket/iinclude/include/snikket/Presence.h
new file mode 100644
index 0000000..ac48ae8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/Presence.h
@@ -0,0 +1,55 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Presence
+#define INCLUDED_snikket_Presence
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Caps)
+HX_DECLARE_CLASS1(snikket,Presence)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Presence_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Presence_obj OBJ_;
+ Presence_obj();
+
+ public:
+ enum { _hx_ClassId = 0x4c576518 };
+
+ void __construct( ::snikket::Caps caps, ::snikket::Stanza mucUser);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Presence")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Presence"); }
+ static ::hx::ObjectPtr< Presence_obj > __new( ::snikket::Caps caps, ::snikket::Stanza mucUser);
+ static ::hx::ObjectPtr< Presence_obj > __alloc(::hx::Ctx *_hx_ctx, ::snikket::Caps caps, ::snikket::Stanza mucUser);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Presence_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Presence",5b,0e,89,40); }
+
+ ::snikket::Caps caps;
+ ::snikket::Stanza mucUser;
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Presence */
diff --git a/Sources/c_snikket/iinclude/include/snikket/PubsubEvent.h b/Sources/c_snikket/iinclude/include/snikket/PubsubEvent.h
new file mode 100644
index 0000000..555e1cd
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/PubsubEvent.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_PubsubEvent
+#define INCLUDED_snikket_PubsubEvent
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,PubsubEvent)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES PubsubEvent_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef PubsubEvent_obj OBJ_;
+ PubsubEvent_obj();
+
+ public:
+ enum { _hx_ClassId = 0x04e7c6de };
+
+ void __construct(::String from,::String to,::String node,::Array< ::Dynamic> items);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.PubsubEvent")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.PubsubEvent"); }
+ static ::hx::ObjectPtr< PubsubEvent_obj > __new(::String from,::String to,::String node,::Array< ::Dynamic> items);
+ static ::hx::ObjectPtr< PubsubEvent_obj > __alloc(::hx::Ctx *_hx_ctx,::String from,::String to,::String node,::Array< ::Dynamic> items);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~PubsubEvent_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("PubsubEvent",17,9e,d8,d2); }
+
+ static ::snikket::PubsubEvent fromStanza( ::snikket::Stanza stanza);
+ static ::Dynamic fromStanza_dyn();
+
+ ::String from;
+ ::String to;
+ ::String node;
+ ::Array< ::Dynamic> items;
+ ::String getFrom();
+ ::Dynamic getFrom_dyn();
+
+ ::String getNode();
+ ::Dynamic getNode_dyn();
+
+ ::Array< ::Dynamic> getItems();
+ ::Dynamic getItems_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_PubsubEvent */
diff --git a/Sources/c_snikket/iinclude/include/snikket/Reaction.h b/Sources/c_snikket/iinclude/include/snikket/Reaction.h
new file mode 100644
index 0000000..5c77199
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/Reaction.h
@@ -0,0 +1,75 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Reaction
+#define INCLUDED_snikket_Reaction
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Reaction)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Reaction_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Reaction_obj OBJ_;
+ Reaction_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7f8e2b4a };
+
+ void __construct(::String senderId,::String timestamp,::String text,::String envelopeId,::String key);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Reaction")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Reaction"); }
+ static ::hx::ObjectPtr< Reaction_obj > __new(::String senderId,::String timestamp,::String text,::String envelopeId,::String key);
+ static ::hx::ObjectPtr< Reaction_obj > __alloc(::hx::Ctx *_hx_ctx,::String senderId,::String timestamp,::String text,::String envelopeId,::String key);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Reaction_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Reaction",c9,a3,66,d0); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ ::String senderId;
+ ::String senderId__fromC();
+ ::Dynamic senderId__fromC_dyn();
+
+ ::String timestamp;
+ ::String timestamp__fromC();
+ ::Dynamic timestamp__fromC_dyn();
+
+ ::String text;
+ ::String text__fromC();
+ ::Dynamic text__fromC_dyn();
+
+ ::String key;
+ ::String key__fromC();
+ ::Dynamic key__fromC_dyn();
+
+ ::String envelopeId;
+ ::String envelopeId__fromC();
+ ::Dynamic envelopeId__fromC_dyn();
+
+ virtual ::Dynamic render( ::Dynamic forText, ::Dynamic forImage);
+ ::Dynamic render_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Reaction */
diff --git a/Sources/c_snikket/iinclude/include/snikket/ReactionUpdate.h b/Sources/c_snikket/iinclude/include/snikket/ReactionUpdate.h
new file mode 100644
index 0000000..79c5a2a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/ReactionUpdate.h
@@ -0,0 +1,72 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_ReactionUpdate
+#define INCLUDED_snikket_ReactionUpdate
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Hash)
+HX_DECLARE_CLASS1(snikket,Reaction)
+HX_DECLARE_CLASS1(snikket,ReactionUpdate)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES ReactionUpdate_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef ReactionUpdate_obj OBJ_;
+ ReactionUpdate_obj();
+
+ public:
+ enum { _hx_ClassId = 0x71029d2f };
+
+ void __construct(::String updateId,::String serverId,::String serverIdBy,::String localId,::String chatId,::String senderId,::String timestamp,::Array< ::Dynamic> reactions,int kind);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.ReactionUpdate")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.ReactionUpdate"); }
+ static ::hx::ObjectPtr< ReactionUpdate_obj > __new(::String updateId,::String serverId,::String serverIdBy,::String localId,::String chatId,::String senderId,::String timestamp,::Array< ::Dynamic> reactions,int kind);
+ static ::hx::ObjectPtr< ReactionUpdate_obj > __alloc(::hx::Ctx *_hx_ctx,::String updateId,::String serverId,::String serverIdBy,::String localId,::String chatId,::String senderId,::String timestamp,::Array< ::Dynamic> reactions,int kind);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ReactionUpdate_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("ReactionUpdate",b2,1a,77,ad); }
+
+ ::String updateId;
+ ::String serverId;
+ ::String serverIdBy;
+ ::String localId;
+ ::String chatId;
+ ::String senderId;
+ ::String timestamp;
+ ::Array< ::Dynamic> reactions;
+ int kind;
+ ::Array< ::Dynamic> getReactions(::Array< ::Dynamic> existingReactions);
+ ::Dynamic getReactions_dyn();
+
+ ::Array< ::Dynamic> inlineHashReferences();
+ ::Dynamic inlineHashReferences_dyn();
+
+ ::snikket::Stanza asStanza();
+ ::Dynamic asStanza_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_ReactionUpdate */
diff --git a/Sources/c_snikket/iinclude/include/snikket/SerializedChat.h b/Sources/c_snikket/iinclude/include/snikket/SerializedChat.h
new file mode 100644
index 0000000..80ed386
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/SerializedChat.h
@@ -0,0 +1,76 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_SerializedChat
+#define INCLUDED_snikket_SerializedChat
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+HX_DECLARE_CLASS1(snikket,Caps)
+HX_DECLARE_CLASS1(snikket,Chat)
+HX_DECLARE_CLASS1(snikket,Client)
+HX_DECLARE_CLASS1(snikket,EventEmitter)
+HX_DECLARE_CLASS1(snikket,GenericStream)
+HX_DECLARE_CLASS1(snikket,Persistence)
+HX_DECLARE_CLASS1(snikket,SerializedChat)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES SerializedChat_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef SerializedChat_obj OBJ_;
+ SerializedChat_obj();
+
+ public:
+ enum { _hx_ClassId = 0x3eb0c535 };
+
+ void __construct(::String chatId,bool trusted,::Array< unsigned char > avatarSha1, ::haxe::ds::StringMap presence,::String displayName, ::Dynamic uiState, ::Dynamic isBlocked,::String extensions,::String readUpToId,::String readUpToBy, ::Dynamic notificationsFiltered,bool notifyMention,bool notifyReply, ::snikket::Caps disco,::String klass);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.SerializedChat")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.SerializedChat"); }
+ static ::hx::ObjectPtr< SerializedChat_obj > __new(::String chatId,bool trusted,::Array< unsigned char > avatarSha1, ::haxe::ds::StringMap presence,::String displayName, ::Dynamic uiState, ::Dynamic isBlocked,::String extensions,::String readUpToId,::String readUpToBy, ::Dynamic notificationsFiltered,bool notifyMention,bool notifyReply, ::snikket::Caps disco,::String klass);
+ static ::hx::ObjectPtr< SerializedChat_obj > __alloc(::hx::Ctx *_hx_ctx,::String chatId,bool trusted,::Array< unsigned char > avatarSha1, ::haxe::ds::StringMap presence,::String displayName, ::Dynamic uiState, ::Dynamic isBlocked,::String extensions,::String readUpToId,::String readUpToBy, ::Dynamic notificationsFiltered,bool notifyMention,bool notifyReply, ::snikket::Caps disco,::String klass);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SerializedChat_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("SerializedChat",9c,77,4d,09); }
+
+ ::String chatId;
+ bool trusted;
+ ::Array< unsigned char > avatarSha1;
+ ::haxe::ds::StringMap presence;
+ ::String displayName;
+ int uiState;
+ bool isBlocked;
+ ::String extensions;
+ ::String readUpToId;
+ ::String readUpToBy;
+ ::snikket::Caps disco;
+ ::String klass;
+ ::Dynamic notificationsFiltered;
+ bool notifyMention;
+ bool notifyReply;
+ ::snikket::Chat toChat( ::snikket::Client client, ::snikket::GenericStream stream,::Dynamic persistence);
+ ::Dynamic toChat_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_SerializedChat */
diff --git a/Sources/c_snikket/iinclude/include/snikket/Stanza.h b/Sources/c_snikket/iinclude/include/snikket/Stanza.h
new file mode 100644
index 0000000..7c79f8c
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/Stanza.h
@@ -0,0 +1,149 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Stanza
+#define INCLUDED_snikket_Stanza
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+HX_DECLARE_CLASS0(Xml)
+HX_DECLARE_CLASS1(snikket,Node)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS1(snikket,StanzaError)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Stanza_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Stanza_obj OBJ_;
+ Stanza_obj();
+
+ public:
+ enum { _hx_ClassId = 0x62320f92 };
+
+ void __construct(::String name, ::Dynamic attr);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Stanza")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Stanza"); }
+ static ::hx::ObjectPtr< Stanza_obj > __new(::String name, ::Dynamic attr);
+ static ::hx::ObjectPtr< Stanza_obj > __alloc(::hx::Ctx *_hx_ctx,::String name, ::Dynamic attr);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Stanza_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::Dynamic traverse_881a854a( ::Dynamic f);
+ ::String __ToString() const { return HX_("Stanza",15,d2,8b,3a); }
+
+ static ::snikket::Stanza parse(::String s);
+ static ::Dynamic parse_dyn();
+
+ static ::snikket::Stanza fromXml( ::Xml el);
+ static ::Dynamic fromXml_dyn();
+
+ static bool parseXmlBool(::String x);
+ static ::Dynamic parseXmlBool_dyn();
+
+ ::String name;
+ ::Dynamic attr;
+ ::Array< ::Dynamic> children;
+ ::snikket::Stanza last_added;
+ ::Array< ::Dynamic> last_added_stack;
+ ::String serialize();
+ ::Dynamic serialize_dyn();
+
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+ ::snikket::Stanza tag(::String name, ::Dynamic attr);
+ ::Dynamic tag_dyn();
+
+ ::snikket::Stanza text(::String content);
+ ::Dynamic text_dyn();
+
+ ::snikket::Stanza textTag(::String tagName,::String textContent, ::Dynamic attr);
+ ::Dynamic textTag_dyn();
+
+ ::snikket::Stanza up();
+ ::Dynamic up_dyn();
+
+ ::snikket::Stanza reset();
+ ::Dynamic reset_dyn();
+
+ ::snikket::Stanza addChildren( ::Dynamic children);
+ ::Dynamic addChildren_dyn();
+
+ ::snikket::Stanza addChildNodes( ::Dynamic children);
+ ::Dynamic addChildNodes_dyn();
+
+ ::snikket::Stanza addChild( ::snikket::Stanza stanza);
+ ::Dynamic addChild_dyn();
+
+ ::snikket::Stanza addDirectChild( ::snikket::Node child);
+ ::Dynamic addDirectChild_dyn();
+
+ ::snikket::Stanza clone();
+ ::Dynamic clone_dyn();
+
+ ::Array< ::Dynamic> allTags(::String name,::String xmlns);
+ ::Dynamic allTags_dyn();
+
+ ::Array< ::String > allText();
+ ::Dynamic allText_dyn();
+
+ ::snikket::Stanza getFirstChild();
+ ::Dynamic getFirstChild_dyn();
+
+ ::Array< ::Dynamic> getChildren();
+ ::Dynamic getChildren_dyn();
+
+ ::snikket::Stanza getChild(::String name,::String xmlns);
+ ::Dynamic getChild_dyn();
+
+ ::String getChildText(::String name,::String xmlns);
+ ::Dynamic getChildText_dyn();
+
+ ::String getText();
+ ::Dynamic getText_dyn();
+
+ ::snikket::Node find(::String path);
+ ::Dynamic find_dyn();
+
+ ::snikket::Stanza findChild(::String path);
+ ::Dynamic findChild_dyn();
+
+ ::String findText(::String path);
+ ::Dynamic findText_dyn();
+
+ ::snikket::Stanza traverse( ::Dynamic f);
+ ::Dynamic traverse_dyn();
+
+ ::snikket::StanzaError getError();
+ ::Dynamic getError_dyn();
+
+ void removeChildren(::String name,::String xmlns_);
+ ::Dynamic removeChildren_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Stanza */
diff --git a/Sources/c_snikket/iinclude/include/snikket/StanzaError.h b/Sources/c_snikket/iinclude/include/snikket/StanzaError.h
new file mode 100644
index 0000000..a16d52c
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/StanzaError.h
@@ -0,0 +1,72 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_StanzaError
+#define INCLUDED_snikket_StanzaError
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_ba7467be1e1fd22b_46_new)
+HX_DECLARE_CLASS1(snikket,StanzaError)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES StanzaError_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef StanzaError_obj OBJ_;
+ StanzaError_obj();
+
+ public:
+ enum { _hx_ClassId = 0x29697ad6 };
+
+ void __construct(::String type_,::String condition_,::String text_);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.StanzaError")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.StanzaError"); }
+
+ inline static ::hx::ObjectPtr< StanzaError_obj > __new(::String type_,::String condition_,::String text_) {
+ ::hx::ObjectPtr< StanzaError_obj > __this = new StanzaError_obj();
+ __this->__construct(type_,condition_,text_);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< StanzaError_obj > __alloc(::hx::Ctx *_hx_ctx,::String type_,::String condition_,::String text_) {
+ StanzaError_obj *__this = (StanzaError_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(StanzaError_obj), true, "snikket.StanzaError"));
+ *(void **)__this = StanzaError_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_ba7467be1e1fd22b_46_new)
+HXLINE( 47) ( ( ::snikket::StanzaError)(__this) )->type = type_;
+HXLINE( 48) ( ( ::snikket::StanzaError)(__this) )->condition = condition_;
+HXLINE( 49) ( ( ::snikket::StanzaError)(__this) )->text = text_;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~StanzaError_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("StanzaError",73,bd,30,0b); }
+
+ ::String type;
+ ::String condition;
+ ::String text;
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_StanzaError */
diff --git a/Sources/c_snikket/iinclude/include/snikket/StringUtil.h b/Sources/c_snikket/iinclude/include/snikket/StringUtil.h
new file mode 100644
index 0000000..2aba5bb
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/StringUtil.h
@@ -0,0 +1,63 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_StringUtil
+#define INCLUDED_snikket_StringUtil
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,StringUtil)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES StringUtil_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef StringUtil_obj OBJ_;
+ StringUtil_obj();
+
+ public:
+ enum { _hx_ClassId = 0x537b2d90 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="snikket.StringUtil")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"snikket.StringUtil"); }
+
+ inline static ::hx::ObjectPtr< StringUtil_obj > __new() {
+ ::hx::ObjectPtr< StringUtil_obj > __this = new StringUtil_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< StringUtil_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ StringUtil_obj *__this = (StringUtil_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(StringUtil_obj), false, "snikket.StringUtil"));
+ *(void **)__this = StringUtil_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~StringUtil_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("StringUtil",93,ed,5b,f6); }
+
+ static ::Array< ::String > codepointArray(::String s);
+ static ::Dynamic codepointArray_dyn();
+
+ static ::Array< int > rawCodepointArray(::String s);
+ static ::Dynamic rawCodepointArray_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_StringUtil */
diff --git a/Sources/c_snikket/iinclude/include/snikket/Symbol.h b/Sources/c_snikket/iinclude/include/snikket/Symbol.h
new file mode 100644
index 0000000..a0c352f
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/Symbol.h
@@ -0,0 +1,49 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Symbol
+#define INCLUDED_snikket_Symbol
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Symbol)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Symbol_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Symbol_obj OBJ_;
+ Symbol_obj();
+
+ public:
+ enum { _hx_ClassId = 0x4b1860f5 };
+
+ void __construct(::Array< int > codepoints);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Symbol")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Symbol"); }
+
+ //~Symbol_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Symbol",78,23,72,23); }
+
+ ::String value;
+ virtual bool isEmoji() { return 0; }
+ ::Dynamic isEmoji_dyn();
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Symbol */
diff --git a/Sources/c_snikket/iinclude/include/snikket/TextNode.h b/Sources/c_snikket/iinclude/include/snikket/TextNode.h
new file mode 100644
index 0000000..f290844
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/TextNode.h
@@ -0,0 +1,67 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_TextNode
+#define INCLUDED_snikket_TextNode
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS1(snikket,TextNode)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES TextNode_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef TextNode_obj OBJ_;
+ TextNode_obj();
+
+ public:
+ enum { _hx_ClassId = 0x3185702c };
+
+ void __construct(::String content);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.TextNode")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.TextNode"); }
+ static ::hx::ObjectPtr< TextNode_obj > __new(::String content);
+ static ::hx::ObjectPtr< TextNode_obj > __alloc(::hx::Ctx *_hx_ctx,::String content);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~TextNode_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::Dynamic traverse_881a854a( ::Dynamic f);
+ ::String __ToString() const { return HX_("TextNode",6f,19,b7,25); }
+
+ ::String content;
+ ::String serialize();
+ ::Dynamic serialize_dyn();
+
+ ::snikket::TextNode clone();
+ ::Dynamic clone_dyn();
+
+ ::snikket::TextNode traverse( ::Dynamic f);
+ ::Dynamic traverse_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_TextNode */
diff --git a/Sources/c_snikket/iinclude/include/snikket/UnicodeBlocks.h b/Sources/c_snikket/iinclude/include/snikket/UnicodeBlocks.h
new file mode 100644
index 0000000..0038254
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/UnicodeBlocks.h
@@ -0,0 +1,59 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_UnicodeBlocks
+#define INCLUDED_snikket_UnicodeBlocks
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_UnicodeSet
+#include <snikket/UnicodeSet.h>
+#endif
+HX_DECLARE_CLASS1(snikket,UnicodeBlocks)
+HX_DECLARE_CLASS1(snikket,UnicodeSet)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES UnicodeBlocks_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef UnicodeBlocks_obj OBJ_;
+ UnicodeBlocks_obj();
+
+ public:
+ enum { _hx_ClassId = 0x5ff5d386 };
+
+ void __construct(::Array< ::Dynamic> sets);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.UnicodeBlocks")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.UnicodeBlocks"); }
+ static ::hx::ObjectPtr< UnicodeBlocks_obj > __new(::Array< ::Dynamic> sets);
+ static ::hx::ObjectPtr< UnicodeBlocks_obj > __alloc(::hx::Ctx *_hx_ctx,::Array< ::Dynamic> sets);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~UnicodeBlocks_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("UnicodeBlocks",63,b7,08,b4); }
+
+ ::Array< ::Dynamic> unicodeSets;
+ bool contains(int codepoint);
+ ::Dynamic contains_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_UnicodeBlocks */
diff --git a/Sources/c_snikket/iinclude/include/snikket/UnicodeList.h b/Sources/c_snikket/iinclude/include/snikket/UnicodeList.h
new file mode 100644
index 0000000..4ae5d96
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/UnicodeList.h
@@ -0,0 +1,59 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_UnicodeList
+#define INCLUDED_snikket_UnicodeList
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_UnicodeSet
+#include <snikket/UnicodeSet.h>
+#endif
+HX_DECLARE_CLASS1(snikket,UnicodeList)
+HX_DECLARE_CLASS1(snikket,UnicodeSet)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES UnicodeList_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef UnicodeList_obj OBJ_;
+ UnicodeList_obj();
+
+ public:
+ enum { _hx_ClassId = 0x002205b6 };
+
+ void __construct(::Array< int > codes);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.UnicodeList")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.UnicodeList"); }
+ static ::hx::ObjectPtr< UnicodeList_obj > __new(::Array< int > codes);
+ static ::hx::ObjectPtr< UnicodeList_obj > __alloc(::hx::Ctx *_hx_ctx,::Array< int > codes);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~UnicodeList_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("UnicodeList",fb,c3,e2,6a); }
+
+ ::Array< int > list;
+ bool contains(int codepoint);
+ ::Dynamic contains_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_UnicodeList */
diff --git a/Sources/c_snikket/iinclude/include/snikket/UnicodeRange.h b/Sources/c_snikket/iinclude/include/snikket/UnicodeRange.h
new file mode 100644
index 0000000..538a195
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/UnicodeRange.h
@@ -0,0 +1,58 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_UnicodeRange
+#define INCLUDED_snikket_UnicodeRange
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_UnicodeSet
+#include <snikket/UnicodeSet.h>
+#endif
+HX_DECLARE_CLASS1(snikket,UnicodeRange)
+HX_DECLARE_CLASS1(snikket,UnicodeSet)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES UnicodeRange_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef UnicodeRange_obj OBJ_;
+ UnicodeRange_obj();
+
+ public:
+ enum { _hx_ClassId = 0x25d72cd9 };
+
+ void __construct(int lower,int upper);
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="snikket.UnicodeRange")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"snikket.UnicodeRange"); }
+ static ::hx::ObjectPtr< UnicodeRange_obj > __new(int lower,int upper);
+ static ::hx::ObjectPtr< UnicodeRange_obj > __alloc(::hx::Ctx *_hx_ctx,int lower,int upper);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~UnicodeRange_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("UnicodeRange",80,a7,a2,8a); }
+
+ int lower;
+ int upper;
+ bool contains(int codePoint);
+ ::Dynamic contains_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_UnicodeRange */
diff --git a/Sources/c_snikket/iinclude/include/snikket/UnicodeSet.h b/Sources/c_snikket/iinclude/include/snikket/UnicodeSet.h
new file mode 100644
index 0000000..1f6c00a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/UnicodeSet.h
@@ -0,0 +1,27 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_UnicodeSet
+#define INCLUDED_snikket_UnicodeSet
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,UnicodeSet)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES UnicodeSet_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ bool (::hx::Object :: *_hx_contains)(int codepoint);
+ static inline bool contains( ::Dynamic _hx_,int codepoint) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::UnicodeSet_obj *>(_hx_.mPtr->_hx_getInterface(0x29205162)))->_hx_contains)(codepoint);
+ }
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_UnicodeSet */
diff --git a/Sources/c_snikket/iinclude/include/snikket/XEP0393.h b/Sources/c_snikket/iinclude/include/snikket/XEP0393.h
new file mode 100644
index 0000000..3af9b96
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/XEP0393.h
@@ -0,0 +1,84 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_XEP0393
+#define INCLUDED_snikket_XEP0393
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Node)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS1(snikket,XEP0393)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES XEP0393_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef XEP0393_obj OBJ_;
+ XEP0393_obj();
+
+ public:
+ enum { _hx_ClassId = 0x794b61b7 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="snikket.XEP0393")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"snikket.XEP0393"); }
+
+ inline static ::hx::ObjectPtr< XEP0393_obj > __new() {
+ ::hx::ObjectPtr< XEP0393_obj > __this = new XEP0393_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< XEP0393_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ XEP0393_obj *__this = (XEP0393_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(XEP0393_obj), false, "snikket.XEP0393"));
+ *(void **)__this = XEP0393_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~XEP0393_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("XEP0393",e0,42,f0,11); }
+
+ static ::Dynamic parse(::String styled);
+ static ::Dynamic parse_dyn();
+
+ static ::String render( ::snikket::Stanza xhtml);
+ static ::Dynamic render_dyn();
+
+ static ::String renderNode( ::snikket::Node xhtml);
+ static ::Dynamic renderNode_dyn();
+
+ static ::Dynamic parseSpans(::String styled);
+ static ::Dynamic parseSpans_dyn();
+
+ static ::Dynamic parseSpan(::String tagName,::String marker,::String styled,int start);
+ static ::Dynamic parseSpan_dyn();
+
+ static ::Dynamic parseBlock(::String styled);
+ static ::Dynamic parseBlock_dyn();
+
+ static ::Dynamic parseQuote(::String styled);
+ static ::Dynamic parseQuote_dyn();
+
+ static ::Dynamic parsePreformatted(::String styled);
+ static ::Dynamic parsePreformatted_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_XEP0393 */
diff --git a/Sources/c_snikket/iinclude/include/snikket/_Push/Push_Fields_.h b/Sources/c_snikket/iinclude/include/snikket/_Push/Push_Fields_.h
new file mode 100644
index 0000000..27e14f5
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/_Push/Push_Fields_.h
@@ -0,0 +1,64 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket__Push_Push_Fields_
+#define INCLUDED_snikket__Push_Push_Fields_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Notification)
+HX_DECLARE_CLASS1(snikket,Persistence)
+HX_DECLARE_CLASS2(snikket,_Push,Push_Fields_)
+
+namespace snikket{
+namespace _Push{
+
+
+class HXCPP_CLASS_ATTRIBUTES Push_Fields__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Push_Fields__obj OBJ_;
+ Push_Fields__obj();
+
+ public:
+ enum { _hx_ClassId = 0x1c9e72a5 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="snikket._Push.Push_Fields_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"snikket._Push.Push_Fields_"); }
+
+ inline static ::hx::ObjectPtr< Push_Fields__obj > __new() {
+ ::hx::ObjectPtr< Push_Fields__obj > __this = new Push_Fields__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Push_Fields__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Push_Fields__obj *__this = (Push_Fields__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Push_Fields__obj), false, "snikket._Push.Push_Fields_"));
+ *(void **)__this = Push_Fields__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Push_Fields__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Push_Fields_",21,65,37,88); }
+
+ static ::snikket::Notification receive(::String data,::Dynamic persistence);
+ static ::Dynamic receive_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace _Push
+
+#endif /* INCLUDED_snikket__Push_Push_Fields_ */
diff --git a/Sources/c_snikket/iinclude/include/snikket/_Stanza/NodeInterface.h b/Sources/c_snikket/iinclude/include/snikket/_Stanza/NodeInterface.h
new file mode 100644
index 0000000..8a96ae8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/_Stanza/NodeInterface.h
@@ -0,0 +1,34 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#define INCLUDED_snikket__Stanza_NodeInterface
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+namespace _Stanza{
+
+
+class HXCPP_CLASS_ATTRIBUTES NodeInterface_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ ::String (::hx::Object :: *_hx_serialize)();
+ static inline ::String serialize( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::_Stanza::NodeInterface_obj *>(_hx_.mPtr->_hx_getInterface(0xc837e580)))->_hx_serialize)();
+ }
+ ::Dynamic (::hx::Object :: *_hx_traverse)( ::Dynamic f);
+ static inline ::Dynamic traverse( ::Dynamic _hx_, ::Dynamic f) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::_Stanza::NodeInterface_obj *>(_hx_.mPtr->_hx_getInterface(0xc837e580)))->_hx_traverse)(f);
+ }
+};
+
+} // end namespace snikket
+} // end namespace _Stanza
+
+#endif /* INCLUDED_snikket__Stanza_NodeInterface */
diff --git a/Sources/c_snikket/iinclude/include/snikket/_Util/Util_Fields_.h b/Sources/c_snikket/iinclude/include/snikket/_Util/Util_Fields_.h
new file mode 100644
index 0000000..a5a7fd3
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/_Util/Util_Fields_.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket__Util_Util_Fields_
+#define INCLUDED_snikket__Util_Util_Fields_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(snikket,_Util,Util_Fields_)
+
+namespace snikket{
+namespace _Util{
+
+
+class HXCPP_CLASS_ATTRIBUTES Util_Fields__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Util_Fields__obj OBJ_;
+ Util_Fields__obj();
+
+ public:
+ enum { _hx_ClassId = 0x1266dcf5 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="snikket._Util.Util_Fields_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"snikket._Util.Util_Fields_"); }
+
+ inline static ::hx::ObjectPtr< Util_Fields__obj > __new() {
+ ::hx::ObjectPtr< Util_Fields__obj > __this = new Util_Fields__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Util_Fields__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Util_Fields__obj *__this = (Util_Fields__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Util_Fields__obj), false, "snikket._Util.Util_Fields_"));
+ *(void **)__this = Util_Fields__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Util_Fields__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Util_Fields_",49,13,f3,18); }
+
+ static void setupTrace();
+ static ::Dynamic setupTrace_dyn();
+
+ static ::Dynamic downcast( ::Dynamic value,::hx::Class c);
+ static ::Dynamic downcast_dyn();
+
+ static ::String xmlEscape(::String s);
+ static ::Dynamic xmlEscape_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace _Util
+
+#endif /* INCLUDED_snikket__Util_Util_Fields_ */
diff --git a/Sources/c_snikket/iinclude/include/snikket/jingle/Attribute.h b/Sources/c_snikket/iinclude/include/snikket/jingle/Attribute.h
new file mode 100644
index 0000000..ab36337
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/jingle/Attribute.h
@@ -0,0 +1,79 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_Attribute
+#define INCLUDED_snikket_jingle_Attribute
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_3dd2db7f2124ae96_624_new)
+HX_DECLARE_CLASS2(snikket,jingle,Attribute)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES Attribute_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Attribute_obj OBJ_;
+ Attribute_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0704634e };
+
+ void __construct(::String key,::String value);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.Attribute")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.Attribute"); }
+
+ inline static ::hx::ObjectPtr< Attribute_obj > __new(::String key,::String value) {
+ ::hx::ObjectPtr< Attribute_obj > __this = new Attribute_obj();
+ __this->__construct(key,value);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Attribute_obj > __alloc(::hx::Ctx *_hx_ctx,::String key,::String value) {
+ Attribute_obj *__this = (Attribute_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Attribute_obj), true, "snikket.jingle.Attribute"));
+ *(void **)__this = Attribute_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_3dd2db7f2124ae96_624_new)
+HXLINE( 625) ( ( ::snikket::jingle::Attribute)(__this) )->key = key;
+HXLINE( 626) ( ( ::snikket::jingle::Attribute)(__this) )->value = value;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Attribute_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Attribute",fc,4f,c3,9c); }
+
+ static ::snikket::jingle::Attribute parse(::String input);
+ static ::Dynamic parse_dyn();
+
+ ::String key;
+ ::String value;
+ ::String toSdp();
+ ::Dynamic toSdp_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_Attribute */
diff --git a/Sources/c_snikket/iinclude/include/snikket/jingle/AudioFormat.h b/Sources/c_snikket/iinclude/include/snikket/jingle/AudioFormat.h
new file mode 100644
index 0000000..5a01544
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/jingle/AudioFormat.h
@@ -0,0 +1,84 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_AudioFormat
+#define INCLUDED_snikket_jingle_AudioFormat
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_1f09f7dcf750977c_327_new)
+HX_DECLARE_CLASS2(snikket,jingle,AudioFormat)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES AudioFormat_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef AudioFormat_obj OBJ_;
+ AudioFormat_obj();
+
+ public:
+ enum { _hx_ClassId = 0x22a1d3c3 };
+
+ void __construct(::String format,unsigned char payloadType,int clockRate,int channels);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.AudioFormat")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.AudioFormat"); }
+
+ inline static ::hx::ObjectPtr< AudioFormat_obj > __new(::String format,unsigned char payloadType,int clockRate,int channels) {
+ ::hx::ObjectPtr< AudioFormat_obj > __this = new AudioFormat_obj();
+ __this->__construct(format,payloadType,clockRate,channels);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< AudioFormat_obj > __alloc(::hx::Ctx *_hx_ctx,::String format,unsigned char payloadType,int clockRate,int channels) {
+ AudioFormat_obj *__this = (AudioFormat_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(AudioFormat_obj), true, "snikket.jingle.AudioFormat"));
+ *(void **)__this = AudioFormat_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_1f09f7dcf750977c_327_new)
+HXLINE( 328) ( ( ::snikket::jingle::AudioFormat)(__this) )->format = format;
+HXLINE( 329) ( ( ::snikket::jingle::AudioFormat)(__this) )->payloadType = payloadType;
+HXLINE( 330) ( ( ::snikket::jingle::AudioFormat)(__this) )->clockRate = clockRate;
+HXLINE( 331) ( ( ::snikket::jingle::AudioFormat)(__this) )->channels = channels;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~AudioFormat_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("AudioFormat",8d,58,71,b0); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ ::String format;
+ unsigned char payloadType;
+ int clockRate;
+ int clockRate__fromC();
+ ::Dynamic clockRate__fromC_dyn();
+
+ int channels;
+ int channels__fromC();
+ ::Dynamic channels__fromC_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_AudioFormat */
diff --git a/Sources/c_snikket/iinclude/include/snikket/jingle/DTMFSender.h b/Sources/c_snikket/iinclude/include/snikket/jingle/DTMFSender.h
new file mode 100644
index 0000000..ac11f9b
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/jingle/DTMFSender.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_DTMFSender
+#define INCLUDED_snikket_jingle_DTMFSender
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS1(haxe,Timer)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+HX_DECLARE_CLASS2(snikket,jingle,DTMFSender)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStreamTrack)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES DTMFSender_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef DTMFSender_obj OBJ_;
+ DTMFSender_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0cd227ec };
+
+ void __construct( ::snikket::jingle::MediaStreamTrack track);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.DTMFSender")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.DTMFSender"); }
+ static ::hx::ObjectPtr< DTMFSender_obj > __new( ::snikket::jingle::MediaStreamTrack track);
+ static ::hx::ObjectPtr< DTMFSender_obj > __alloc(::hx::Ctx *_hx_ctx, ::snikket::jingle::MediaStreamTrack track);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~DTMFSender_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("DTMFSender",7e,53,22,7e); }
+
+ static void __boot();
+ static ::haxe::ds::StringMap TONES;
+ ::snikket::jingle::MediaStreamTrack track;
+ ::haxe::Timer timer;
+ ::Array< unsigned char > tones;
+ void insertDTMF(::String tones);
+ ::Dynamic insertDTMF_dyn();
+
+ void insertOneTone(unsigned char tone);
+ ::Dynamic insertOneTone_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_DTMFSender */
diff --git a/Sources/c_snikket/iinclude/include/snikket/jingle/Group.h b/Sources/c_snikket/iinclude/include/snikket/jingle/Group.h
new file mode 100644
index 0000000..e94b018
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/jingle/Group.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_Group
+#define INCLUDED_snikket_jingle_Group
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,jingle,Group)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES Group_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Group_obj OBJ_;
+ Group_obj();
+
+ public:
+ enum { _hx_ClassId = 0x21f1b1d5 };
+
+ void __construct(::String semantics,::Array< ::String > identificationTags);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.Group")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.Group"); }
+ static ::hx::ObjectPtr< Group_obj > __new(::String semantics,::Array< ::String > identificationTags);
+ static ::hx::ObjectPtr< Group_obj > __alloc(::hx::Ctx *_hx_ctx,::String semantics,::Array< ::String > identificationTags);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Group_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Group",1f,23,22,2d); }
+
+ static ::snikket::jingle::Group parse(::String input);
+ static ::Dynamic parse_dyn();
+
+ static ::snikket::jingle::Group fromElement( ::snikket::Stanza el);
+ static ::Dynamic fromElement_dyn();
+
+ ::String semantics;
+ ::Array< ::String > identificationTags;
+ ::String toSdp();
+ ::Dynamic toSdp_dyn();
+
+ ::snikket::Stanza toElement();
+ ::Dynamic toElement_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_Group */
diff --git a/Sources/c_snikket/iinclude/include/snikket/jingle/IceCandidate.h b/Sources/c_snikket/iinclude/include/snikket/jingle/IceCandidate.h
new file mode 100644
index 0000000..3f6d0f8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/jingle/IceCandidate.h
@@ -0,0 +1,84 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_IceCandidate
+#define INCLUDED_snikket_jingle_IceCandidate
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,jingle,IceCandidate)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES IceCandidate_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef IceCandidate_obj OBJ_;
+ IceCandidate_obj();
+
+ public:
+ enum { _hx_ClassId = 0x5f466786 };
+
+ void __construct(::String sdpMid,::String ufrag,::String foundation,::String component,::String transport,::String priority,::String connectionAddress,::String port, ::haxe::ds::StringMap parameters);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.IceCandidate")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.IceCandidate"); }
+ static ::hx::ObjectPtr< IceCandidate_obj > __new(::String sdpMid,::String ufrag,::String foundation,::String component,::String transport,::String priority,::String connectionAddress,::String port, ::haxe::ds::StringMap parameters);
+ static ::hx::ObjectPtr< IceCandidate_obj > __alloc(::hx::Ctx *_hx_ctx,::String sdpMid,::String ufrag,::String foundation,::String component,::String transport,::String priority,::String connectionAddress,::String port, ::haxe::ds::StringMap parameters);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~IceCandidate_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("IceCandidate",98,1b,a6,e5); }
+
+ static ::snikket::jingle::IceCandidate fromElement( ::snikket::Stanza candidate,::String sdpMid,::String ufrag);
+ static ::Dynamic fromElement_dyn();
+
+ static ::Array< ::Dynamic> fromTransport( ::snikket::Stanza transport,::String sdpMid);
+ static ::Dynamic fromTransport_dyn();
+
+ static ::Array< ::Dynamic> fromStanza( ::snikket::Stanza iq);
+ static ::Dynamic fromStanza_dyn();
+
+ static ::snikket::jingle::IceCandidate parse(::String input,::String sdpMid,::String ufrag);
+ static ::Dynamic parse_dyn();
+
+ ::String sdpMid;
+ ::String ufrag;
+ ::String foundation;
+ ::String component;
+ ::String transport;
+ ::String priority;
+ ::String connectionAddress;
+ ::String port;
+ ::haxe::ds::StringMap parameters;
+ ::snikket::Stanza toElement();
+ ::Dynamic toElement_dyn();
+
+ ::String toSdp();
+ ::Dynamic toSdp_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_IceCandidate */
diff --git a/Sources/c_snikket/iinclude/include/snikket/jingle/IncomingProposedSession.h b/Sources/c_snikket/iinclude/include/snikket/jingle/IncomingProposedSession.h
new file mode 100644
index 0000000..ba3b24a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/jingle/IncomingProposedSession.h
@@ -0,0 +1,114 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_IncomingProposedSession
+#define INCLUDED_snikket_jingle_IncomingProposedSession
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_jingle_Session
+#include <snikket/jingle/Session.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Client)
+HX_DECLARE_CLASS1(snikket,EventEmitter)
+HX_DECLARE_CLASS1(snikket,JID)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,jingle,DTMFSender)
+HX_DECLARE_CLASS2(snikket,jingle,IncomingProposedSession)
+HX_DECLARE_CLASS2(snikket,jingle,InitiatedSession)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStream)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStreamTrack)
+HX_DECLARE_CLASS2(snikket,jingle,Session)
+HX_DECLARE_CLASS1(thenshim,Thenable)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES IncomingProposedSession_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef IncomingProposedSession_obj OBJ_;
+ IncomingProposedSession_obj();
+
+ public:
+ enum { _hx_ClassId = 0x409e1620 };
+
+ void __construct( ::snikket::Client client, ::snikket::JID from,::String sid);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.IncomingProposedSession")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.IncomingProposedSession"); }
+ static ::hx::ObjectPtr< IncomingProposedSession_obj > __new( ::snikket::Client client, ::snikket::JID from,::String sid);
+ static ::hx::ObjectPtr< IncomingProposedSession_obj > __alloc(::hx::Ctx *_hx_ctx, ::snikket::Client client, ::snikket::JID from,::String sid);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~IncomingProposedSession_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("IncomingProposedSession",ea,a1,86,13); }
+
+ ::String sid;
+ ::snikket::Client client;
+ ::snikket::JID from;
+ ::String _sid;
+ bool accepted;
+ void ring();
+ ::Dynamic ring_dyn();
+
+ void hangup();
+ ::Dynamic hangup_dyn();
+
+ void retract();
+ ::Dynamic retract_dyn();
+
+ void terminate();
+ ::Dynamic terminate_dyn();
+
+ void contentAdd( ::snikket::Stanza _);
+ ::Dynamic contentAdd_dyn();
+
+ void contentAccept( ::snikket::Stanza _);
+ ::Dynamic contentAccept_dyn();
+
+ ::Dynamic transportInfo( ::snikket::Stanza _);
+ ::Dynamic transportInfo_dyn();
+
+ void accept();
+ ::Dynamic accept_dyn();
+
+ ::snikket::jingle::InitiatedSession initiate( ::snikket::Stanza stanza);
+ ::Dynamic initiate_dyn();
+
+ void addMedia(::Array< ::Dynamic> _);
+ ::Dynamic addMedia_dyn();
+
+ ::String callStatus();
+ ::Dynamic callStatus_dyn();
+
+ ::Array< ::Dynamic> videoTracks();
+ ::Dynamic videoTracks_dyn();
+
+ ::snikket::jingle::DTMFSender dtmf();
+ ::Dynamic dtmf_dyn();
+
+ ::String get_sid();
+ ::Dynamic get_sid_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_IncomingProposedSession */
diff --git a/Sources/c_snikket/iinclude/include/snikket/jingle/InitiatedSession.h b/Sources/c_snikket/iinclude/include/snikket/jingle/InitiatedSession.h
new file mode 100644
index 0000000..569256c
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/jingle/InitiatedSession.h
@@ -0,0 +1,160 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_InitiatedSession
+#define INCLUDED_snikket_jingle_InitiatedSession
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_jingle_Session
+#include <snikket/jingle/Session.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Client)
+HX_DECLARE_CLASS1(snikket,EventEmitter)
+HX_DECLARE_CLASS1(snikket,JID)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,jingle,DTMFSender)
+HX_DECLARE_CLASS2(snikket,jingle,InitiatedSession)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStream)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStreamTrack)
+HX_DECLARE_CLASS2(snikket,jingle,OutgoingSession)
+HX_DECLARE_CLASS2(snikket,jingle,PeerConnection)
+HX_DECLARE_CLASS2(snikket,jingle,Session)
+HX_DECLARE_CLASS2(snikket,jingle,SessionDescription)
+HX_DECLARE_CLASS1(thenshim,Thenable)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES InitiatedSession_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef InitiatedSession_obj OBJ_;
+ InitiatedSession_obj();
+
+ public:
+ enum { _hx_ClassId = 0x050f75b9 };
+
+ void __construct( ::snikket::Client client, ::snikket::JID counterpart,::String sid, ::snikket::jingle::SessionDescription remoteDescription);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.InitiatedSession")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.InitiatedSession"); }
+ static ::hx::ObjectPtr< InitiatedSession_obj > __new( ::snikket::Client client, ::snikket::JID counterpart,::String sid, ::snikket::jingle::SessionDescription remoteDescription);
+ static ::hx::ObjectPtr< InitiatedSession_obj > __alloc(::hx::Ctx *_hx_ctx, ::snikket::Client client, ::snikket::JID counterpart,::String sid, ::snikket::jingle::SessionDescription remoteDescription);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~InitiatedSession_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::snikket::jingle::InitiatedSession initiate_ef691953( ::snikket::Stanza stanza);
+ ::String __ToString() const { return HX_("InitiatedSession",cb,9a,8f,24); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ static ::snikket::jingle::InitiatedSession fromSessionInitiate( ::snikket::Client client, ::snikket::Stanza stanza);
+ static ::Dynamic fromSessionInitiate_dyn();
+
+ ::String sid;
+ ::String sid__fromC();
+ ::Dynamic sid__fromC_dyn();
+
+ ::snikket::Client client;
+ ::snikket::JID counterpart;
+ ::String _sid;
+ ::snikket::jingle::SessionDescription remoteDescription;
+ ::snikket::jingle::SessionDescription localDescription;
+ ::snikket::jingle::PeerConnection pc;
+ ::String peerDtlsSetup;
+ ::Array< ::Dynamic> queuedInboundTransportInfo;
+ ::Array< ::Dynamic> queuedOutboundCandidate;
+ bool accepted;
+ ::Dynamic afterMedia;
+ Dynamic afterMedia_dyn() { return afterMedia;}
+ bool initiator;
+ ::Dynamic candidatesDone;
+ Dynamic candidatesDone_dyn() { return candidatesDone;}
+ ::String get_sid();
+ ::Dynamic get_sid_dyn();
+
+ void ring();
+ ::Dynamic ring_dyn();
+
+ void retract();
+ ::Dynamic retract_dyn();
+
+ void accept();
+ ::Dynamic accept_dyn();
+
+ void hangup();
+ ::Dynamic hangup_dyn();
+
+ virtual ::snikket::jingle::OutgoingSession initiate( ::snikket::Stanza stanza);
+ ::Dynamic initiate_dyn();
+
+ void terminate();
+ ::Dynamic terminate_dyn();
+
+ void contentAdd( ::snikket::Stanza stanza);
+ ::Dynamic contentAdd_dyn();
+
+ void contentAccept( ::snikket::Stanza stanza);
+ ::Dynamic contentAccept_dyn();
+
+ ::Dynamic transportInfo( ::snikket::Stanza stanza);
+ ::Dynamic transportInfo_dyn();
+
+ void addMedia(::Array< ::Dynamic> streams);
+ ::Dynamic addMedia_dyn();
+
+ void addMedia__fromC(::cpp::Pointer< void* > streams,size_t streams__len);
+ ::Dynamic addMedia__fromC_dyn();
+
+ ::String callStatus();
+ ::Dynamic callStatus_dyn();
+
+ ::Array< ::Dynamic> videoTracks();
+ ::Dynamic videoTracks_dyn();
+
+ size_t videoTracks__fromC(void*** outPtr);
+
+ ::snikket::jingle::DTMFSender dtmf();
+ ::Dynamic dtmf_dyn();
+
+ void sendIceCandidate( ::Dynamic candidate);
+ ::Dynamic sendIceCandidate_dyn();
+
+ void supplyMedia(::Array< ::Dynamic> streams);
+ ::Dynamic supplyMedia_dyn();
+
+ void supplyMedia__fromC(::cpp::Pointer< void* > streams,size_t streams__len);
+ ::Dynamic supplyMedia__fromC_dyn();
+
+ void setupPeerConnection( ::Dynamic callback);
+ ::Dynamic setupPeerConnection_dyn();
+
+ ::Dynamic setupLocalDescription(::String type,::Array< ::String > filterMedia, ::Dynamic filterOut, ::Dynamic beforeSend);
+ ::Dynamic setupLocalDescription_dyn();
+
+ virtual ::Dynamic onPeerConnection();
+ ::Dynamic onPeerConnection_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_InitiatedSession */
diff --git a/Sources/c_snikket/iinclude/include/snikket/jingle/Media.h b/Sources/c_snikket/iinclude/include/snikket/jingle/Media.h
new file mode 100644
index 0000000..139653a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/jingle/Media.h
@@ -0,0 +1,82 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_Media
+#define INCLUDED_snikket_jingle_Media
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,jingle,Attribute)
+HX_DECLARE_CLASS2(snikket,jingle,Media)
+HX_DECLARE_CLASS2(snikket,jingle,SessionDescription)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES Media_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Media_obj OBJ_;
+ Media_obj();
+
+ public:
+ enum { _hx_ClassId = 0x06e5f716 };
+
+ void __construct(::String mid,::String media,::String connectionData,::String port,::String protocol,::Array< ::Dynamic> attributes,::Array< int > formats);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.Media")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.Media"); }
+ static ::hx::ObjectPtr< Media_obj > __new(::String mid,::String media,::String connectionData,::String port,::String protocol,::Array< ::Dynamic> attributes,::Array< int > formats);
+ static ::hx::ObjectPtr< Media_obj > __alloc(::hx::Ctx *_hx_ctx,::String mid,::String media,::String connectionData,::String port,::String protocol,::Array< ::Dynamic> attributes,::Array< int > formats);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Media_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Media",c4,74,e9,98); }
+
+ static ::snikket::jingle::Media fromElement( ::snikket::Stanza content,bool initiator,bool hasGroup, ::snikket::jingle::SessionDescription existingDescription);
+ static ::Dynamic fromElement_dyn();
+
+ ::String mid;
+ ::String media;
+ ::String connectionData;
+ ::String port;
+ ::String protocol;
+ ::Array< ::Dynamic> attributes;
+ ::Array< int > formats;
+ ::String toSdp();
+ ::Dynamic toSdp_dyn();
+
+ ::snikket::Stanza contentElement(bool initiator);
+ ::Dynamic contentElement_dyn();
+
+ ::snikket::Stanza toElement(::Array< ::Dynamic> sessionAttributes,bool initiator);
+ ::Dynamic toElement_dyn();
+
+ ::Dynamic getUfragPwd(::Array< ::Dynamic> sessionAttributes);
+ ::Dynamic getUfragPwd_dyn();
+
+ ::snikket::Stanza toTransportElement(::Array< ::Dynamic> sessionAttributes);
+ ::Dynamic toTransportElement_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_Media */
diff --git a/Sources/c_snikket/iinclude/include/snikket/jingle/MediaStream.h b/Sources/c_snikket/iinclude/include/snikket/jingle/MediaStream.h
new file mode 100644
index 0000000..1e4bb42
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/jingle/MediaStream.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_MediaStream
+#define INCLUDED_snikket_jingle_MediaStream
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(snikket,jingle,MediaStream)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStreamTrack)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES MediaStream_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef MediaStream_obj OBJ_;
+ MediaStream_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1cdfd2fe };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.MediaStream")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.MediaStream"); }
+ static ::hx::ObjectPtr< MediaStream_obj > __new();
+ static ::hx::ObjectPtr< MediaStream_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~MediaStream_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("MediaStream",64,e8,a8,83); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ static ::snikket::jingle::MediaStream makeAudio();
+ static ::Dynamic makeAudio_dyn();
+
+ ::Array< ::Dynamic> tracks;
+ void addTrack( ::snikket::jingle::MediaStreamTrack track);
+ ::Dynamic addTrack_dyn();
+
+ ::Array< ::Dynamic> getTracks();
+ ::Dynamic getTracks_dyn();
+
+ size_t getTracks__fromC(void*** outPtr);
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_MediaStream */
diff --git a/Sources/c_snikket/iinclude/include/snikket/jingle/MediaStreamTrack.h b/Sources/c_snikket/iinclude/include/snikket/jingle/MediaStreamTrack.h
new file mode 100644
index 0000000..368efe0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/jingle/MediaStreamTrack.h
@@ -0,0 +1,159 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_MediaStreamTrack
+#define INCLUDED_snikket_jingle_MediaStreamTrack
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_f561c66e4c8ac38c
+#define INCLUDED_f561c66e4c8ac38c
+#include "fstream"
+#endif
+#ifndef INCLUDED_c2bfbc5a172f2993
+#define INCLUDED_c2bfbc5a172f2993
+#include "opus.h"
+#endif
+#ifndef INCLUDED_639eed8ef5b51d52
+#define INCLUDED_639eed8ef5b51d52
+#include "rtc/frameinfo.hpp"
+#endif
+#ifndef INCLUDED_0e487a29b6aa8a9b
+#define INCLUDED_0e487a29b6aa8a9b
+#include "rtc/rtc.hpp"
+#endif
+HX_DECLARE_CLASS1(haxe,Timer)
+HX_DECLARE_CLASS2(snikket,jingle,AudioFormat)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStreamTrack)
+HX_DECLARE_CLASS2(sys,thread,EventLoop)
+HX_DECLARE_CLASS2(sys,thread,Mutex)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES MediaStreamTrack_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef MediaStreamTrack_obj OBJ_;
+ MediaStreamTrack_obj();
+
+ public:
+ enum { _hx_ClassId = 0x047992ad };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.MediaStreamTrack")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.MediaStreamTrack"); }
+ static ::hx::ObjectPtr< MediaStreamTrack_obj > __new();
+ static ::hx::ObjectPtr< MediaStreamTrack_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~MediaStreamTrack_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("MediaStreamTrack",87,2b,0b,ac); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ static ::snikket::jingle::MediaStreamTrack fromTrack( std::shared_ptr< rtc::Track > t);
+
+ static ::Array< short > ULAW_DECODE;
+ static ::Array< unsigned char > ULAW_EXP;
+ static unsigned char pcmToUlaw(short sample);
+ static ::Dynamic pcmToUlaw_dyn();
+
+ ::String id__fromC();
+ ::Dynamic id__fromC_dyn();
+
+ bool muted__fromC();
+ ::Dynamic muted__fromC_dyn();
+
+ ::String kind__fromC();
+ ::Dynamic kind__fromC_dyn();
+
+ size_t supportedAudioFormats__fromC(void*** outPtr);
+
+ ::Dynamic pcmCallback;
+ Dynamic pcmCallback_dyn() { return pcmCallback;}
+ ::Dynamic readyForPCMCallback;
+ Dynamic readyForPCMCallback_dyn() { return readyForPCMCallback;}
+ cpp::Struct< OpusDecoder* > opus;
+ cpp::Struct< OpusEncoder* > opusEncoder;
+ std::shared_ptr< rtc::RtpPacketizationConfig > rtpPacketizationConfig;
+ ::sys::thread::EventLoop eventLoop;
+ ::haxe::Timer timer;
+ ::Array< ::Dynamic> audioQ;
+ bool alive;
+ bool waitForQ;
+ Float bufferSizeInSeconds;
+ ::sys::thread::Mutex mutex;
+ std::optional< rtc::Description::Media > media;
+ std::shared_ptr< rtc::Track > track;
+ std::optional< rtc::Description::Media > get_media();
+
+ ::String get_id();
+ ::Dynamic get_id_dyn();
+
+ ::String get_kind();
+ ::Dynamic get_kind_dyn();
+
+ bool get_muted();
+ ::Dynamic get_muted_dyn();
+
+ ::Array< ::Dynamic> get_supportedAudioFormats();
+ ::Dynamic get_supportedAudioFormats_dyn();
+
+ std::shared_ptr< rtc::Track > set_track( std::shared_ptr< rtc::Track > newTrack);
+
+ void addPCMListener( ::Dynamic callback);
+ ::Dynamic addPCMListener_dyn();
+
+ void addPCMListener__fromC(::cpp::Function< void (short*,size_t,int,int,void*) > callback,void* callback__context);
+
+ void onFrame( std::vector< std::byte > msg, rtc::FrameInfo frameInfo);
+
+ void addReadyForPCMListener( ::Dynamic callback);
+ ::Dynamic addReadyForPCMListener_dyn();
+
+ void addReadyForPCMListener__fromC(::cpp::Function< void (void*) > callback,void* callback__context);
+
+ void notifyReadyForData(bool fromCPP);
+ ::Dynamic notifyReadyForData_dyn();
+
+ void writePCM(::Array< short > pcm,int clockRate,int channels);
+ ::Dynamic writePCM_dyn();
+
+ void writePCM__fromC(::cpp::Pointer< short > pcm,size_t pcm__len,int clockRate,int channels);
+ ::Dynamic writePCM__fromC_dyn();
+
+ void onAudioLoop( ::Dynamic callback);
+ ::Dynamic onAudioLoop_dyn();
+
+ void write(::Array< unsigned char > payload,unsigned char payloadType,int clockRate);
+ ::Dynamic write_dyn();
+
+ void advanceTimestamp(int samples);
+ ::Dynamic advanceTimestamp_dyn();
+
+ void stop();
+ ::Dynamic stop_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_MediaStreamTrack */
diff --git a/Sources/c_snikket/iinclude/include/snikket/jingle/OutgoingProposedSession.h b/Sources/c_snikket/iinclude/include/snikket/jingle/OutgoingProposedSession.h
new file mode 100644
index 0000000..04be360
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/jingle/OutgoingProposedSession.h
@@ -0,0 +1,117 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_OutgoingProposedSession
+#define INCLUDED_snikket_jingle_OutgoingProposedSession
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_jingle_Session
+#include <snikket/jingle/Session.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Client)
+HX_DECLARE_CLASS1(snikket,EventEmitter)
+HX_DECLARE_CLASS1(snikket,JID)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,jingle,DTMFSender)
+HX_DECLARE_CLASS2(snikket,jingle,InitiatedSession)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStream)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStreamTrack)
+HX_DECLARE_CLASS2(snikket,jingle,OutgoingProposedSession)
+HX_DECLARE_CLASS2(snikket,jingle,OutgoingSession)
+HX_DECLARE_CLASS2(snikket,jingle,Session)
+HX_DECLARE_CLASS1(thenshim,Thenable)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES OutgoingProposedSession_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef OutgoingProposedSession_obj OBJ_;
+ OutgoingProposedSession_obj();
+
+ public:
+ enum { _hx_ClassId = 0x4349a55a };
+
+ void __construct( ::snikket::Client client, ::snikket::JID to);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.OutgoingProposedSession")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.OutgoingProposedSession"); }
+ static ::hx::ObjectPtr< OutgoingProposedSession_obj > __new( ::snikket::Client client, ::snikket::JID to);
+ static ::hx::ObjectPtr< OutgoingProposedSession_obj > __alloc(::hx::Ctx *_hx_ctx, ::snikket::Client client, ::snikket::JID to);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~OutgoingProposedSession_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::snikket::jingle::InitiatedSession initiate_ef691953( ::snikket::Stanza stanza);
+ ::String __ToString() const { return HX_("OutgoingProposedSession",24,31,32,16); }
+
+ ::String sid;
+ ::snikket::Client client;
+ ::snikket::JID to;
+ ::String _sid;
+ bool audio;
+ bool video;
+ void propose(bool audio,bool video);
+ ::Dynamic propose_dyn();
+
+ void hangup();
+ ::Dynamic hangup_dyn();
+
+ void retract();
+ ::Dynamic retract_dyn();
+
+ void terminate();
+ ::Dynamic terminate_dyn();
+
+ void contentAdd( ::snikket::Stanza _);
+ ::Dynamic contentAdd_dyn();
+
+ void contentAccept( ::snikket::Stanza _);
+ ::Dynamic contentAccept_dyn();
+
+ ::Dynamic transportInfo( ::snikket::Stanza _);
+ ::Dynamic transportInfo_dyn();
+
+ void accept();
+ ::Dynamic accept_dyn();
+
+ ::snikket::jingle::OutgoingSession initiate( ::snikket::Stanza stanza);
+ ::Dynamic initiate_dyn();
+
+ void addMedia(::Array< ::Dynamic> _);
+ ::Dynamic addMedia_dyn();
+
+ ::String callStatus();
+ ::Dynamic callStatus_dyn();
+
+ ::Array< ::Dynamic> videoTracks();
+ ::Dynamic videoTracks_dyn();
+
+ ::snikket::jingle::DTMFSender dtmf();
+ ::Dynamic dtmf_dyn();
+
+ ::String get_sid();
+ ::Dynamic get_sid_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_OutgoingProposedSession */
diff --git a/Sources/c_snikket/iinclude/include/snikket/jingle/OutgoingSession.h b/Sources/c_snikket/iinclude/include/snikket/jingle/OutgoingSession.h
new file mode 100644
index 0000000..80cffde
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/jingle/OutgoingSession.h
@@ -0,0 +1,63 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_OutgoingSession
+#define INCLUDED_snikket_jingle_OutgoingSession
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_jingle_InitiatedSession
+#include <snikket/jingle/InitiatedSession.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Client)
+HX_DECLARE_CLASS1(snikket,EventEmitter)
+HX_DECLARE_CLASS1(snikket,JID)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,jingle,InitiatedSession)
+HX_DECLARE_CLASS2(snikket,jingle,OutgoingSession)
+HX_DECLARE_CLASS2(snikket,jingle,Session)
+HX_DECLARE_CLASS1(thenshim,Thenable)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES OutgoingSession_obj : public ::snikket::jingle::InitiatedSession_obj
+{
+ public:
+ typedef ::snikket::jingle::InitiatedSession_obj super;
+ typedef OutgoingSession_obj OBJ_;
+ OutgoingSession_obj();
+
+ public:
+ enum { _hx_ClassId = 0x43b8b0fc };
+
+ void __construct( ::snikket::Client client, ::snikket::JID counterpart,::String sid);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.OutgoingSession")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.OutgoingSession"); }
+ static ::hx::ObjectPtr< OutgoingSession_obj > __new( ::snikket::Client client, ::snikket::JID counterpart,::String sid);
+ static ::hx::ObjectPtr< OutgoingSession_obj > __alloc(::hx::Ctx *_hx_ctx, ::snikket::Client client, ::snikket::JID counterpart,::String sid);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~OutgoingSession_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("OutgoingSession",2a,54,07,c9); }
+
+ ::Dynamic onPeerConnection();
+
+ ::snikket::jingle::OutgoingSession initiate( ::snikket::Stanza stanza);
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_OutgoingSession */
diff --git a/Sources/c_snikket/iinclude/include/snikket/jingle/PeerConnection.h b/Sources/c_snikket/iinclude/include/snikket/jingle/PeerConnection.h
new file mode 100644
index 0000000..44a1ee9
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/jingle/PeerConnection.h
@@ -0,0 +1,119 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_PeerConnection
+#define INCLUDED_snikket_jingle_PeerConnection
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_0e487a29b6aa8a9b
+#define INCLUDED_0e487a29b6aa8a9b
+#include "rtc/rtc.hpp"
+#endif
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStream)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStreamTrack)
+HX_DECLARE_CLASS2(snikket,jingle,PeerConnection)
+HX_DECLARE_CLASS2(sys,thread,EventLoop)
+HX_DECLARE_CLASS1(thenshim,Thenable)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES PeerConnection_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef PeerConnection_obj OBJ_;
+ PeerConnection_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1731230a };
+
+ void __construct( ::Dynamic configuration, ::Dynamic constraints);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.PeerConnection")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.PeerConnection"); }
+ static ::hx::ObjectPtr< PeerConnection_obj > __new( ::Dynamic configuration, ::Dynamic constraints);
+ static ::hx::ObjectPtr< PeerConnection_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic configuration, ::Dynamic constraints);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~PeerConnection_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("PeerConnection",80,38,71,9a); }
+
+ ::Dynamic localDescription;
+ ::String connectionState;
+ std::shared_ptr< rtc::PeerConnection > _pc;
+ ::cpp::Pointer< rtc::PeerConnection > pc;
+ ::Dynamic waitingOnLocal;
+ Dynamic waitingOnLocal_dyn() { return waitingOnLocal;}
+ ::haxe::ds::StringMap tracks;
+ ::Array< ::Dynamic> trackListeners;
+ ::Array< ::Dynamic> localCandidateListeners;
+ ::Array< ::Dynamic> stateChangeListeners;
+ ::sys::thread::EventLoop mainLoop;
+ bool hasLocal;
+ bool hasRemote;
+ ::Array< ::Dynamic> pendingTracks;
+ void onLocalDescription();
+ ::Dynamic onLocalDescription_dyn();
+
+ void onLocalCandidate( rtc::Candidate candidate);
+
+ void onStateChange(cpp::Struct< rtc::PeerConnection::State > state);
+ ::Dynamic onStateChange_dyn();
+
+ void onGatheringStateChange(cpp::Struct< rtc::PeerConnection::GatheringState > state);
+ ::Dynamic onGatheringStateChange_dyn();
+
+ void onTrack( std::shared_ptr< rtc::Track > track);
+
+ ::String get_connectionState();
+ ::Dynamic get_connectionState_dyn();
+
+ ::Dynamic get_localDescription();
+ ::Dynamic get_localDescription_dyn();
+
+ ::Dynamic setLocalDescription(cpp::Struct< rtc::Description::Type > sdpType);
+ ::Dynamic setLocalDescription_dyn();
+
+ ::Dynamic setRemoteDescription( ::Dynamic description);
+ ::Dynamic setRemoteDescription_dyn();
+
+ ::Dynamic addIceCandidate( ::Dynamic candidate);
+ ::Dynamic addIceCandidate_dyn();
+
+ void addPendingTracks();
+ ::Dynamic addPendingTracks_dyn();
+
+ void addTrack( ::snikket::jingle::MediaStreamTrack track, ::snikket::jingle::MediaStream stream);
+ ::Dynamic addTrack_dyn();
+
+ ::Array< ::Dynamic> getTransceivers();
+ ::Dynamic getTransceivers_dyn();
+
+ void close();
+ ::Dynamic close_dyn();
+
+ void addEventListener(::String event, ::Dynamic callback);
+ ::Dynamic addEventListener_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_PeerConnection */
diff --git a/Sources/c_snikket/iinclude/include/snikket/jingle/Session.h b/Sources/c_snikket/iinclude/include/snikket/jingle/Session.h
new file mode 100644
index 0000000..306298c
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/jingle/Session.h
@@ -0,0 +1,84 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_Session
+#define INCLUDED_snikket_jingle_Session
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,jingle,DTMFSender)
+HX_DECLARE_CLASS2(snikket,jingle,InitiatedSession)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStream)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStreamTrack)
+HX_DECLARE_CLASS2(snikket,jingle,Session)
+HX_DECLARE_CLASS1(thenshim,Thenable)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES Session_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ ::String (::hx::Object :: *_hx_get_sid)();
+ static inline ::String get_sid( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::jingle::Session_obj *>(_hx_.mPtr->_hx_getInterface(0x79d60748)))->_hx_get_sid)();
+ }
+ ::snikket::jingle::InitiatedSession (::hx::Object :: *_hx_initiate)( ::snikket::Stanza stanza);
+ static inline ::snikket::jingle::InitiatedSession initiate( ::Dynamic _hx_, ::snikket::Stanza stanza) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::jingle::Session_obj *>(_hx_.mPtr->_hx_getInterface(0x79d60748)))->_hx_initiate)(stanza);
+ }
+ void (::hx::Object :: *_hx_accept)();
+ static inline void accept( ::Dynamic _hx_) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::jingle::Session_obj *>(_hx_.mPtr->_hx_getInterface(0x79d60748)))->_hx_accept)();
+ }
+ void (::hx::Object :: *_hx_hangup)();
+ static inline void hangup( ::Dynamic _hx_) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::jingle::Session_obj *>(_hx_.mPtr->_hx_getInterface(0x79d60748)))->_hx_hangup)();
+ }
+ void (::hx::Object :: *_hx_retract)();
+ static inline void retract( ::Dynamic _hx_) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::jingle::Session_obj *>(_hx_.mPtr->_hx_getInterface(0x79d60748)))->_hx_retract)();
+ }
+ void (::hx::Object :: *_hx_terminate)();
+ static inline void terminate( ::Dynamic _hx_) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::jingle::Session_obj *>(_hx_.mPtr->_hx_getInterface(0x79d60748)))->_hx_terminate)();
+ }
+ void (::hx::Object :: *_hx_contentAdd)( ::snikket::Stanza stanza);
+ static inline void contentAdd( ::Dynamic _hx_, ::snikket::Stanza stanza) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::jingle::Session_obj *>(_hx_.mPtr->_hx_getInterface(0x79d60748)))->_hx_contentAdd)(stanza);
+ }
+ void (::hx::Object :: *_hx_contentAccept)( ::snikket::Stanza stanza);
+ static inline void contentAccept( ::Dynamic _hx_, ::snikket::Stanza stanza) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::jingle::Session_obj *>(_hx_.mPtr->_hx_getInterface(0x79d60748)))->_hx_contentAccept)(stanza);
+ }
+ ::Dynamic (::hx::Object :: *_hx_transportInfo)( ::snikket::Stanza stanza);
+ static inline ::Dynamic transportInfo( ::Dynamic _hx_, ::snikket::Stanza stanza) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::jingle::Session_obj *>(_hx_.mPtr->_hx_getInterface(0x79d60748)))->_hx_transportInfo)(stanza);
+ }
+ void (::hx::Object :: *_hx_addMedia)(::Array< ::Dynamic> streams);
+ static inline void addMedia( ::Dynamic _hx_,::Array< ::Dynamic> streams) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::jingle::Session_obj *>(_hx_.mPtr->_hx_getInterface(0x79d60748)))->_hx_addMedia)(streams);
+ }
+ ::String (::hx::Object :: *_hx_callStatus)();
+ static inline ::String callStatus( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::jingle::Session_obj *>(_hx_.mPtr->_hx_getInterface(0x79d60748)))->_hx_callStatus)();
+ }
+ ::Array< ::Dynamic> (::hx::Object :: *_hx_videoTracks)();
+ static inline ::Array< ::Dynamic> videoTracks( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::jingle::Session_obj *>(_hx_.mPtr->_hx_getInterface(0x79d60748)))->_hx_videoTracks)();
+ }
+ ::snikket::jingle::DTMFSender (::hx::Object :: *_hx_dtmf)();
+ static inline ::snikket::jingle::DTMFSender dtmf( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::jingle::Session_obj *>(_hx_.mPtr->_hx_getInterface(0x79d60748)))->_hx_dtmf)();
+ }
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_Session */
diff --git a/Sources/c_snikket/iinclude/include/snikket/jingle/SessionDescription.h b/Sources/c_snikket/iinclude/include/snikket/jingle/SessionDescription.h
new file mode 100644
index 0000000..4529362
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/jingle/SessionDescription.h
@@ -0,0 +1,86 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_SessionDescription
+#define INCLUDED_snikket_jingle_SessionDescription
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,jingle,Attribute)
+HX_DECLARE_CLASS2(snikket,jingle,Media)
+HX_DECLARE_CLASS2(snikket,jingle,SessionDescription)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES SessionDescription_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef SessionDescription_obj OBJ_;
+ SessionDescription_obj();
+
+ public:
+ enum { _hx_ClassId = 0x24aad8f0 };
+
+ void __construct(int version,::String name,::Array< ::Dynamic> media,::Array< ::Dynamic> attributes,::Array< ::String > identificationTags);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.SessionDescription")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.SessionDescription"); }
+ static ::hx::ObjectPtr< SessionDescription_obj > __new(int version,::String name,::Array< ::Dynamic> media,::Array< ::Dynamic> attributes,::Array< ::String > identificationTags);
+ static ::hx::ObjectPtr< SessionDescription_obj > __alloc(::hx::Ctx *_hx_ctx,int version,::String name,::Array< ::Dynamic> media,::Array< ::Dynamic> attributes,::Array< ::String > identificationTags);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SessionDescription_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("SessionDescription",66,e1,61,a3); }
+
+ static ::snikket::jingle::SessionDescription parse(::String input);
+ static ::Dynamic parse_dyn();
+
+ static ::snikket::jingle::SessionDescription fromStanza( ::snikket::Stanza iq,bool initiator, ::snikket::jingle::SessionDescription existingDescription);
+ static ::Dynamic fromStanza_dyn();
+
+ int version;
+ ::String name;
+ ::Array< ::Dynamic> media;
+ ::Array< ::Dynamic> attributes;
+ ::Array< ::String > identificationTags;
+ ::Dynamic getUfragPwd();
+ ::Dynamic getUfragPwd_dyn();
+
+ ::snikket::jingle::Attribute getFingerprint();
+ ::Dynamic getFingerprint_dyn();
+
+ ::String getDtlsSetup();
+ ::Dynamic getDtlsSetup_dyn();
+
+ ::snikket::jingle::SessionDescription addContent( ::snikket::jingle::SessionDescription newDescription);
+ ::Dynamic addContent_dyn();
+
+ ::String toSdp();
+ ::Dynamic toSdp_dyn();
+
+ ::snikket::Stanza toStanza(::String action,::String sid,bool initiator);
+ ::Dynamic toStanza_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_SessionDescription */
diff --git a/Sources/c_snikket/iinclude/include/snikket/jingle/TransportInfo.h b/Sources/c_snikket/iinclude/include/snikket/jingle/TransportInfo.h
new file mode 100644
index 0000000..1af9d00
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/jingle/TransportInfo.h
@@ -0,0 +1,60 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_TransportInfo
+#define INCLUDED_snikket_jingle_TransportInfo
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,jingle,Media)
+HX_DECLARE_CLASS2(snikket,jingle,TransportInfo)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES TransportInfo_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef TransportInfo_obj OBJ_;
+ TransportInfo_obj();
+
+ public:
+ enum { _hx_ClassId = 0x4c85e215 };
+
+ void __construct( ::snikket::jingle::Media media,::String sid);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.TransportInfo")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.TransportInfo"); }
+ static ::hx::ObjectPtr< TransportInfo_obj > __new( ::snikket::jingle::Media media,::String sid);
+ static ::hx::ObjectPtr< TransportInfo_obj > __alloc(::hx::Ctx *_hx_ctx, ::snikket::jingle::Media media,::String sid);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~TransportInfo_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("TransportInfo",97,8c,bf,fe); }
+
+ ::snikket::jingle::Media media;
+ ::String sid;
+ ::snikket::Stanza toStanza(bool initiator);
+ ::Dynamic toStanza_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_TransportInfo */
diff --git a/Sources/c_snikket/iinclude/include/snikket/jingle/_Session/Session_Fields_.h b/Sources/c_snikket/iinclude/include/snikket/jingle/_Session/Session_Fields_.h
new file mode 100644
index 0000000..5690ec1
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/jingle/_Session/Session_Fields_.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle__Session_Session_Fields_
+#define INCLUDED_snikket_jingle__Session_Session_Fields_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,ChatMessage)
+HX_DECLARE_CLASS1(snikket,JID)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS3(snikket,jingle,_Session,Session_Fields_)
+
+namespace snikket{
+namespace jingle{
+namespace _Session{
+
+
+class HXCPP_CLASS_ATTRIBUTES Session_Fields__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Session_Fields__obj OBJ_;
+ Session_Fields__obj();
+
+ public:
+ enum { _hx_ClassId = 0x4b7e6858 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="snikket.jingle._Session.Session_Fields_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"snikket.jingle._Session.Session_Fields_"); }
+
+ inline static ::hx::ObjectPtr< Session_Fields__obj > __new() {
+ ::hx::ObjectPtr< Session_Fields__obj > __this = new Session_Fields__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Session_Fields__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Session_Fields__obj *__this = (Session_Fields__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Session_Fields__obj), false, "snikket.jingle._Session.Session_Fields_"));
+ *(void **)__this = Session_Fields__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Session_Fields__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Session_Fields_",5d,02,e4,dc); }
+
+ static ::snikket::ChatMessage mkCallMessage( ::snikket::JID to, ::snikket::JID from, ::snikket::Stanza event);
+ static ::Dynamic mkCallMessage_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+} // end namespace _Session
+
+#endif /* INCLUDED_snikket_jingle__Session_Session_Fields_ */
diff --git a/Sources/c_snikket/iinclude/include/snikket/persistence/Dummy.h b/Sources/c_snikket/iinclude/include/snikket/persistence/Dummy.h
new file mode 100644
index 0000000..6b7e275
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/persistence/Dummy.h
@@ -0,0 +1,138 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_persistence_Dummy
+#define INCLUDED_snikket_persistence_Dummy
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_Persistence
+#include <snikket/Persistence.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Caps)
+HX_DECLARE_CLASS1(snikket,Chat)
+HX_DECLARE_CLASS1(snikket,ChatMessage)
+HX_DECLARE_CLASS1(snikket,Persistence)
+HX_DECLARE_CLASS1(snikket,ReactionUpdate)
+HX_DECLARE_CLASS1(snikket,SerializedChat)
+HX_DECLARE_CLASS2(snikket,persistence,Dummy)
+
+namespace snikket{
+namespace persistence{
+
+
+class HXCPP_CLASS_ATTRIBUTES Dummy_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Dummy_obj OBJ_;
+ Dummy_obj();
+
+ public:
+ enum { _hx_ClassId = 0x130a03e2 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="snikket.persistence.Dummy")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"snikket.persistence.Dummy"); }
+ static ::hx::ObjectPtr< Dummy_obj > __new();
+ static ::hx::ObjectPtr< Dummy_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Dummy_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("Dummy",08,7e,e8,74); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ void lastId(::String accountId,::String chatId, ::Dynamic callback);
+ ::Dynamic lastId_dyn();
+
+ void storeChats(::String accountId,::Array< ::Dynamic> chat);
+ ::Dynamic storeChats_dyn();
+
+ void getChats(::String accountId, ::Dynamic callback);
+ ::Dynamic getChats_dyn();
+
+ void storeMessages(::String accountId,::Array< ::Dynamic> messages, ::Dynamic callback);
+ ::Dynamic storeMessages_dyn();
+
+ void updateMessage(::String accountId, ::snikket::ChatMessage message);
+ ::Dynamic updateMessage_dyn();
+
+ void getMessage(::String accountId,::String chatId,::String serverId,::String localId, ::Dynamic callback);
+ ::Dynamic getMessage_dyn();
+
+ void getMessagesBefore(::String accountId,::String chatId,::String beforeId,::String beforeTime, ::Dynamic callback);
+ ::Dynamic getMessagesBefore_dyn();
+
+ void getMessagesAfter(::String accountId,::String chatId,::String afterId,::String afterTime, ::Dynamic callback);
+ ::Dynamic getMessagesAfter_dyn();
+
+ void getMessagesAround(::String accountId,::String chatId,::String aroundId,::String aroundTime, ::Dynamic callback);
+ ::Dynamic getMessagesAround_dyn();
+
+ void getChatsUnreadDetails(::String accountId,::Array< ::Dynamic> chats, ::Dynamic callback);
+ ::Dynamic getChatsUnreadDetails_dyn();
+
+ void storeReaction(::String accountId, ::snikket::ReactionUpdate update, ::Dynamic callback);
+ ::Dynamic storeReaction_dyn();
+
+ void updateMessageStatus(::String accountId,::String localId,int status, ::Dynamic callback);
+ ::Dynamic updateMessageStatus_dyn();
+
+ void getMediaUri(::String hashAlgorithm,::Array< unsigned char > hash, ::Dynamic callback);
+ ::Dynamic getMediaUri_dyn();
+
+ void hasMedia(::String hashAlgorithm,::Array< unsigned char > hash, ::Dynamic callback);
+ ::Dynamic hasMedia_dyn();
+
+ void storeMedia(::String mime,::Array< unsigned char > bd, ::Dynamic callback);
+ ::Dynamic storeMedia_dyn();
+
+ void removeMedia(::String hashAlgorithm,::Array< unsigned char > hash);
+ ::Dynamic removeMedia_dyn();
+
+ void storeCaps( ::snikket::Caps caps);
+ ::Dynamic storeCaps_dyn();
+
+ void getCaps(::String ver, ::Dynamic callback);
+ ::Dynamic getCaps_dyn();
+
+ void storeLogin(::String login,::String clientId,::String displayName,::String token);
+ ::Dynamic storeLogin_dyn();
+
+ void getLogin(::String login, ::Dynamic callback);
+ ::Dynamic getLogin_dyn();
+
+ void removeAccount(::String accountId,bool completely);
+ ::Dynamic removeAccount_dyn();
+
+ void listAccounts( ::Dynamic callback);
+ ::Dynamic listAccounts_dyn();
+
+ void storeStreamManagement(::String accountId,::Array< unsigned char > sm);
+ ::Dynamic storeStreamManagement_dyn();
+
+ void getStreamManagement(::String accountId, ::Dynamic callback);
+ ::Dynamic getStreamManagement_dyn();
+
+ void storeService(::String accountId,::String serviceId,::String name,::String node, ::snikket::Caps caps);
+ ::Dynamic storeService_dyn();
+
+ void findServicesWithFeature(::String accountId,::String feature, ::Dynamic callback);
+ ::Dynamic findServicesWithFeature_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace persistence
+
+#endif /* INCLUDED_snikket_persistence_Dummy */
diff --git a/Sources/c_snikket/iinclude/include/snikket/persistence/KeyValueStore.h b/Sources/c_snikket/iinclude/include/snikket/persistence/KeyValueStore.h
new file mode 100644
index 0000000..33fa468
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/persistence/KeyValueStore.h
@@ -0,0 +1,33 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_persistence_KeyValueStore
+#define INCLUDED_snikket_persistence_KeyValueStore
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(snikket,persistence,KeyValueStore)
+
+namespace snikket{
+namespace persistence{
+
+
+class HXCPP_CLASS_ATTRIBUTES KeyValueStore_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ void (::hx::Object :: *_hx_get)(::String k, ::Dynamic callback);
+ static inline void get( ::Dynamic _hx_,::String k, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::persistence::KeyValueStore_obj *>(_hx_.mPtr->_hx_getInterface(0x42160a8d)))->_hx_get)(k,callback);
+ }
+ void (::hx::Object :: *_hx_set)(::String k,::String v, ::Dynamic callback);
+ static inline void set( ::Dynamic _hx_,::String k,::String v, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::persistence::KeyValueStore_obj *>(_hx_.mPtr->_hx_getInterface(0x42160a8d)))->_hx_set)(k,v,callback);
+ }
+};
+
+} // end namespace snikket
+} // end namespace persistence
+
+#endif /* INCLUDED_snikket_persistence_KeyValueStore */
diff --git a/Sources/c_snikket/iinclude/include/snikket/persistence/MediaStore.h b/Sources/c_snikket/iinclude/include/snikket/persistence/MediaStore.h
new file mode 100644
index 0000000..911ceff
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/persistence/MediaStore.h
@@ -0,0 +1,42 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_persistence_MediaStore
+#define INCLUDED_snikket_persistence_MediaStore
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(snikket,persistence,KeyValueStore)
+HX_DECLARE_CLASS2(snikket,persistence,MediaStore)
+
+namespace snikket{
+namespace persistence{
+
+
+class HXCPP_CLASS_ATTRIBUTES MediaStore_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ void (::hx::Object :: *_hx_hasMedia)(::String hashAlgorithm,::Array< unsigned char > hash, ::Dynamic callback);
+ static inline void hasMedia( ::Dynamic _hx_,::String hashAlgorithm,::Array< unsigned char > hash, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::persistence::MediaStore_obj *>(_hx_.mPtr->_hx_getInterface(0x2952283f)))->_hx_hasMedia)(hashAlgorithm,hash,callback);
+ }
+ void (::hx::Object :: *_hx_removeMedia)(::String hashAlgorithm,::Array< unsigned char > hash);
+ static inline void removeMedia( ::Dynamic _hx_,::String hashAlgorithm,::Array< unsigned char > hash) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::persistence::MediaStore_obj *>(_hx_.mPtr->_hx_getInterface(0x2952283f)))->_hx_removeMedia)(hashAlgorithm,hash);
+ }
+ void (::hx::Object :: *_hx_storeMedia)(::String mime,::Array< unsigned char > bytes, ::Dynamic callback);
+ static inline void storeMedia( ::Dynamic _hx_,::String mime,::Array< unsigned char > bytes, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::persistence::MediaStore_obj *>(_hx_.mPtr->_hx_getInterface(0x2952283f)))->_hx_storeMedia)(mime,bytes,callback);
+ }
+ void (::hx::Object :: *_hx_setKV)(::Dynamic kv);
+ static inline void setKV( ::Dynamic _hx_,::Dynamic kv) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::persistence::MediaStore_obj *>(_hx_.mPtr->_hx_getInterface(0x2952283f)))->_hx_setKV)(kv);
+ }
+};
+
+} // end namespace snikket
+} // end namespace persistence
+
+#endif /* INCLUDED_snikket_persistence_MediaStore */
diff --git a/Sources/c_snikket/iinclude/include/snikket/persistence/MediaStoreFS.h b/Sources/c_snikket/iinclude/include/snikket/persistence/MediaStoreFS.h
new file mode 100644
index 0000000..7ceaaa8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/persistence/MediaStoreFS.h
@@ -0,0 +1,86 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_persistence_MediaStoreFS
+#define INCLUDED_snikket_persistence_MediaStoreFS
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_persistence_MediaStore
+#include <snikket/persistence/MediaStore.h>
+#endif
+HX_DECLARE_CLASS2(snikket,persistence,KeyValueStore)
+HX_DECLARE_CLASS2(snikket,persistence,MediaStore)
+HX_DECLARE_CLASS2(snikket,persistence,MediaStoreFS)
+HX_DECLARE_CLASS1(thenshim,Thenable)
+
+namespace snikket{
+namespace persistence{
+
+
+class HXCPP_CLASS_ATTRIBUTES MediaStoreFS_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef MediaStoreFS_obj OBJ_;
+ MediaStoreFS_obj();
+
+ public:
+ enum { _hx_ClassId = 0x3993cd38 };
+
+ void __construct(::String path);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.persistence.MediaStoreFS")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.persistence.MediaStoreFS"); }
+ static ::hx::ObjectPtr< MediaStoreFS_obj > __new(::String path);
+ static ::hx::ObjectPtr< MediaStoreFS_obj > __alloc(::hx::Ctx *_hx_ctx,::String path);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~MediaStoreFS_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("MediaStoreFS",0a,5f,89,fe); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ ::String blobpath;
+ ::Dynamic kv;
+ void setKV(::Dynamic kv);
+ ::Dynamic setKV_dyn();
+
+ void getMediaPath(::String uri, ::Dynamic callback);
+ ::Dynamic getMediaPath_dyn();
+
+ void getMediaPath__fromC(::String uri,::cpp::Function< void (const char*,void*) > callback,void* callback__context);
+
+ void hasMedia(::String hashAlgorithm,::Array< unsigned char > hash, ::Dynamic callback);
+ ::Dynamic hasMedia_dyn();
+
+ void removeMedia(::String hashAlgorithm,::Array< unsigned char > hash);
+ ::Dynamic removeMedia_dyn();
+
+ void storeMedia(::String mime,::Array< unsigned char > bd, ::Dynamic callback);
+ ::Dynamic storeMedia_dyn();
+
+ ::Dynamic set(::String k,::String v);
+ ::Dynamic set_dyn();
+
+ ::Dynamic get(::String k);
+ ::Dynamic get_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace persistence
+
+#endif /* INCLUDED_snikket_persistence_MediaStoreFS */
diff --git a/Sources/c_snikket/iinclude/include/snikket/persistence/Sqlite.h b/Sources/c_snikket/iinclude/include/snikket/persistence/Sqlite.h
new file mode 100644
index 0000000..8418150
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/persistence/Sqlite.h
@@ -0,0 +1,180 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_persistence_Sqlite
+#define INCLUDED_snikket_persistence_Sqlite
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_persistence_KeyValueStore
+#include <snikket/persistence/KeyValueStore.h>
+#endif
+#ifndef INCLUDED_snikket_Persistence
+#include <snikket/Persistence.h>
+#endif
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS1(haxe,Timer)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+HX_DECLARE_CLASS1(snikket,Caps)
+HX_DECLARE_CLASS1(snikket,Chat)
+HX_DECLARE_CLASS1(snikket,ChatMessage)
+HX_DECLARE_CLASS1(snikket,Persistence)
+HX_DECLARE_CLASS1(snikket,ReactionUpdate)
+HX_DECLARE_CLASS1(snikket,SerializedChat)
+HX_DECLARE_CLASS2(snikket,persistence,KeyValueStore)
+HX_DECLARE_CLASS2(snikket,persistence,MediaStore)
+HX_DECLARE_CLASS2(snikket,persistence,Sqlite)
+HX_DECLARE_CLASS2(snikket,persistence,SqliteDriver)
+HX_DECLARE_CLASS1(thenshim,Thenable)
+
+namespace snikket{
+namespace persistence{
+
+
+class HXCPP_CLASS_ATTRIBUTES Sqlite_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Sqlite_obj OBJ_;
+ Sqlite_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1fc6c66e };
+
+ void __construct(::String dbfile,::Dynamic media);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.persistence.Sqlite")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.persistence.Sqlite"); }
+ static ::hx::ObjectPtr< Sqlite_obj > __new(::String dbfile,::Dynamic media);
+ static ::hx::ObjectPtr< Sqlite_obj > __alloc(::hx::Ctx *_hx_ctx,::String dbfile,::Dynamic media);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Sqlite_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("Sqlite",ec,9c,99,87); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ ::snikket::persistence::SqliteDriver db;
+ ::Dynamic media;
+ void get(::String k, ::Dynamic callback);
+ ::Dynamic get_dyn();
+
+ void set(::String k,::String v, ::Dynamic callback);
+ ::Dynamic set_dyn();
+
+ void lastId(::String accountId,::String chatId, ::Dynamic callback);
+ ::Dynamic lastId_dyn();
+
+ ::haxe::ds::StringMap storeChatBuffer;
+ ::haxe::Timer storeChatTimer;
+ void storeChats(::String accountId,::Array< ::Dynamic> chats);
+ ::Dynamic storeChats_dyn();
+
+ void getChats(::String accountId, ::Dynamic callback);
+ ::Dynamic getChats_dyn();
+
+ void storeMessages(::String accountId,::Array< ::Dynamic> messages, ::Dynamic callback);
+ ::Dynamic storeMessages_dyn();
+
+ void updateMessage(::String accountId, ::snikket::ChatMessage message);
+ ::Dynamic updateMessage_dyn();
+
+ void getMessage(::String accountId,::String chatId,::String serverId,::String localId, ::Dynamic callback);
+ ::Dynamic getMessage_dyn();
+
+ void getMessage__fromC(::String accountId,::String chatId,::String serverId,::String localId,::cpp::Function< void (void*,void*) > callback,void* callback__context);
+
+ ::Dynamic getMessages(::String accountId,::String chatId,::String time,::String op);
+ ::Dynamic getMessages_dyn();
+
+ void getMessagesBefore(::String accountId,::String chatId,::String beforeId,::String beforeTime, ::Dynamic callback);
+ ::Dynamic getMessagesBefore_dyn();
+
+ void getMessagesAfter(::String accountId,::String chatId,::String afterId,::String afterTime, ::Dynamic callback);
+ ::Dynamic getMessagesAfter_dyn();
+
+ void getMessagesAround(::String accountId,::String chatId,::String aroundId,::String aroundTime, ::Dynamic callback);
+ ::Dynamic getMessagesAround_dyn();
+
+ void getChatsUnreadDetails(::String accountId,::Array< ::Dynamic> chats, ::Dynamic callback);
+ ::Dynamic getChatsUnreadDetails_dyn();
+
+ void storeReaction(::String accountId, ::snikket::ReactionUpdate update, ::Dynamic callback);
+ ::Dynamic storeReaction_dyn();
+
+ void updateMessageStatus(::String accountId,::String localId,int status, ::Dynamic callback);
+ ::Dynamic updateMessageStatus_dyn();
+
+ void hasMedia(::String hashAlgorithm,::Array< unsigned char > hash, ::Dynamic callback);
+ ::Dynamic hasMedia_dyn();
+
+ void removeMedia(::String hashAlgorithm,::Array< unsigned char > hash);
+ ::Dynamic removeMedia_dyn();
+
+ void storeMedia(::String mime,::Array< unsigned char > bd, ::Dynamic callback);
+ ::Dynamic storeMedia_dyn();
+
+ void storeCaps( ::snikket::Caps caps);
+ ::Dynamic storeCaps_dyn();
+
+ void getCaps(::String ver, ::Dynamic callback);
+ ::Dynamic getCaps_dyn();
+
+ void storeLogin(::String accountId,::String clientId,::String displayName,::String token);
+ ::Dynamic storeLogin_dyn();
+
+ void getLogin(::String accountId, ::Dynamic callback);
+ ::Dynamic getLogin_dyn();
+
+ void removeAccount(::String accountId,bool completely);
+ ::Dynamic removeAccount_dyn();
+
+ void listAccounts( ::Dynamic callback);
+ ::Dynamic listAccounts_dyn();
+
+ void listAccounts__fromC(::cpp::Function< void (const char**,size_t,void*) > callback,void* callback__context);
+
+ bool smStoreInProgress;
+ ::Array< unsigned char > smStoreNext;
+ void storeStreamManagement(::String accountId,::Array< unsigned char > sm);
+ ::Dynamic storeStreamManagement_dyn();
+
+ void getStreamManagement(::String accountId, ::Dynamic callback);
+ ::Dynamic getStreamManagement_dyn();
+
+ void storeService(::String accountId,::String serviceId,::String name,::String node, ::snikket::Caps caps);
+ ::Dynamic storeService_dyn();
+
+ void findServicesWithFeature(::String accountId,::String feature, ::Dynamic callback);
+ ::Dynamic findServicesWithFeature_dyn();
+
+ ::Dynamic hydrateReactions(::String accountId,::Array< ::Dynamic> messages);
+ ::Dynamic hydrateReactions_dyn();
+
+ ::Dynamic fetchReactions(::String accountId,::Array< ::Dynamic> ids);
+ ::Dynamic fetchReactions_dyn();
+
+ ::Dynamic hydrateReplyTo(::String accountId,::Array< ::Dynamic> messages,::Array< ::Dynamic> replyTos);
+ ::Dynamic hydrateReplyTo_dyn();
+
+ ::Array< ::Dynamic> hydrateMessages(::String accountId, ::Dynamic rows);
+ ::Dynamic hydrateMessages_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace persistence
+
+#endif /* INCLUDED_snikket_persistence_Sqlite */
diff --git a/Sources/c_snikket/iinclude/include/snikket/persistence/SqliteDriver.h b/Sources/c_snikket/iinclude/include/snikket/persistence/SqliteDriver.h
new file mode 100644
index 0000000..d13d4d8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/persistence/SqliteDriver.h
@@ -0,0 +1,61 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_persistence_SqliteDriver
+#define INCLUDED_snikket_persistence_SqliteDriver
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(snikket,persistence,SqliteDriver)
+HX_DECLARE_CLASS2(sys,db,Connection)
+HX_DECLARE_CLASS1(thenshim,Thenable)
+
+namespace snikket{
+namespace persistence{
+
+
+class HXCPP_CLASS_ATTRIBUTES SqliteDriver_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef SqliteDriver_obj OBJ_;
+ SqliteDriver_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0672539a };
+
+ void __construct(::String dbfile);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.persistence.SqliteDriver")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.persistence.SqliteDriver"); }
+ static ::hx::ObjectPtr< SqliteDriver_obj > __new(::String dbfile);
+ static ::hx::ObjectPtr< SqliteDriver_obj > __alloc(::hx::Ctx *_hx_ctx,::String dbfile);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SqliteDriver_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("SqliteDriver",34,0a,34,44); }
+
+ ::Dynamic db;
+ ::Dynamic exec( ::Dynamic sql,::cpp::VirtualArray params);
+ ::Dynamic exec_dyn();
+
+ ::String prepare(::String sql,::cpp::VirtualArray params);
+ ::Dynamic prepare_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace persistence
+
+#endif /* INCLUDED_snikket_persistence_SqliteDriver */
diff --git a/Sources/c_snikket/iinclude/include/snikket/queries/BlocklistGet.h b/Sources/c_snikket/iinclude/include/snikket/queries/BlocklistGet.h
new file mode 100644
index 0000000..ab498fe
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/queries/BlocklistGet.h
@@ -0,0 +1,67 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_queries_BlocklistGet
+#define INCLUDED_snikket_queries_BlocklistGet
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,queries,BlocklistGet)
+HX_DECLARE_CLASS2(snikket,queries,GenericQuery)
+
+namespace snikket{
+namespace queries{
+
+
+class HXCPP_CLASS_ATTRIBUTES BlocklistGet_obj : public ::snikket::queries::GenericQuery_obj
+{
+ public:
+ typedef ::snikket::queries::GenericQuery_obj super;
+ typedef BlocklistGet_obj OBJ_;
+ BlocklistGet_obj();
+
+ public:
+ enum { _hx_ClassId = 0x60103714 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.queries.BlocklistGet")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.queries.BlocklistGet"); }
+ static ::hx::ObjectPtr< BlocklistGet_obj > __new();
+ static ::hx::ObjectPtr< BlocklistGet_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~BlocklistGet_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("BlocklistGet",4b,75,69,37); }
+
+ ::String xmlns;
+ ::String queryId;
+ ::snikket::Stanza responseStanza;
+ ::Array< ::String > result;
+ void handleResponse( ::snikket::Stanza stanza);
+
+ ::Array< ::String > getResult();
+ ::Dynamic getResult_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace queries
+
+#endif /* INCLUDED_snikket_queries_BlocklistGet */
diff --git a/Sources/c_snikket/iinclude/include/snikket/queries/BoB.h b/Sources/c_snikket/iinclude/include/snikket/queries/BoB.h
new file mode 100644
index 0000000..a2bd8ec
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/queries/BoB.h
@@ -0,0 +1,72 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_queries_BoB
+#define INCLUDED_snikket_queries_BoB
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Hash)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,queries,BoB)
+HX_DECLARE_CLASS2(snikket,queries,GenericQuery)
+
+namespace snikket{
+namespace queries{
+
+
+class HXCPP_CLASS_ATTRIBUTES BoB_obj : public ::snikket::queries::GenericQuery_obj
+{
+ public:
+ typedef ::snikket::queries::GenericQuery_obj super;
+ typedef BoB_obj OBJ_;
+ BoB_obj();
+
+ public:
+ enum { _hx_ClassId = 0x6fef110c };
+
+ void __construct(::String to,::String uri);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.queries.BoB")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.queries.BoB"); }
+ static ::hx::ObjectPtr< BoB_obj > __new(::String to,::String uri);
+ static ::hx::ObjectPtr< BoB_obj > __alloc(::hx::Ctx *_hx_ctx,::String to,::String uri);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~BoB_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("BoB",b5,75,32,00); }
+
+ static ::snikket::queries::BoB forHash(::String to, ::snikket::Hash hash);
+ static ::Dynamic forHash_dyn();
+
+ ::String xmlns;
+ ::String queryId;
+ ::snikket::Stanza responseStanza;
+ ::Dynamic result;
+ void handleResponse( ::snikket::Stanza stanza);
+
+ ::Dynamic getResult();
+ ::Dynamic getResult_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace queries
+
+#endif /* INCLUDED_snikket_queries_BoB */
diff --git a/Sources/c_snikket/iinclude/include/snikket/queries/DiscoInfoGet.h b/Sources/c_snikket/iinclude/include/snikket/queries/DiscoInfoGet.h
new file mode 100644
index 0000000..cb69a82
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/queries/DiscoInfoGet.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_queries_DiscoInfoGet
+#define INCLUDED_snikket_queries_DiscoInfoGet
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Caps)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,queries,DiscoInfoGet)
+HX_DECLARE_CLASS2(snikket,queries,GenericQuery)
+
+namespace snikket{
+namespace queries{
+
+
+class HXCPP_CLASS_ATTRIBUTES DiscoInfoGet_obj : public ::snikket::queries::GenericQuery_obj
+{
+ public:
+ typedef ::snikket::queries::GenericQuery_obj super;
+ typedef DiscoInfoGet_obj OBJ_;
+ DiscoInfoGet_obj();
+
+ public:
+ enum { _hx_ClassId = 0x17bd6e57 };
+
+ void __construct(::String to,::String node);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.queries.DiscoInfoGet")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.queries.DiscoInfoGet"); }
+ static ::hx::ObjectPtr< DiscoInfoGet_obj > __new(::String to,::String node);
+ static ::hx::ObjectPtr< DiscoInfoGet_obj > __alloc(::hx::Ctx *_hx_ctx,::String to,::String node);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~DiscoInfoGet_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("DiscoInfoGet",8e,ac,16,ef); }
+
+ ::String xmlns;
+ ::String queryId;
+ ::snikket::Stanza responseStanza;
+ ::snikket::Caps result;
+ void handleResponse( ::snikket::Stanza stanza);
+
+ ::snikket::Caps getResult();
+ ::Dynamic getResult_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace queries
+
+#endif /* INCLUDED_snikket_queries_DiscoInfoGet */
diff --git a/Sources/c_snikket/iinclude/include/snikket/queries/DiscoItemsGet.h b/Sources/c_snikket/iinclude/include/snikket/queries/DiscoItemsGet.h
new file mode 100644
index 0000000..8096b9e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/queries/DiscoItemsGet.h
@@ -0,0 +1,67 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_queries_DiscoItemsGet
+#define INCLUDED_snikket_queries_DiscoItemsGet
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,queries,DiscoItemsGet)
+HX_DECLARE_CLASS2(snikket,queries,GenericQuery)
+
+namespace snikket{
+namespace queries{
+
+
+class HXCPP_CLASS_ATTRIBUTES DiscoItemsGet_obj : public ::snikket::queries::GenericQuery_obj
+{
+ public:
+ typedef ::snikket::queries::GenericQuery_obj super;
+ typedef DiscoItemsGet_obj OBJ_;
+ DiscoItemsGet_obj();
+
+ public:
+ enum { _hx_ClassId = 0x3759f407 };
+
+ void __construct(::String to,::String node);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.queries.DiscoItemsGet")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.queries.DiscoItemsGet"); }
+ static ::hx::ObjectPtr< DiscoItemsGet_obj > __new(::String to,::String node);
+ static ::hx::ObjectPtr< DiscoItemsGet_obj > __alloc(::hx::Ctx *_hx_ctx,::String to,::String node);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~DiscoItemsGet_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("DiscoItemsGet",f0,25,17,ce); }
+
+ ::String xmlns;
+ ::String queryId;
+ ::snikket::Stanza responseStanza;
+ ::Array< ::Dynamic> result;
+ void handleResponse( ::snikket::Stanza stanza);
+
+ ::Array< ::Dynamic> getResult();
+ ::Dynamic getResult_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace queries
+
+#endif /* INCLUDED_snikket_queries_DiscoItemsGet */
diff --git a/Sources/c_snikket/iinclude/include/snikket/queries/ExtDiscoGet.h b/Sources/c_snikket/iinclude/include/snikket/queries/ExtDiscoGet.h
new file mode 100644
index 0000000..7f2afdc
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/queries/ExtDiscoGet.h
@@ -0,0 +1,67 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_queries_ExtDiscoGet
+#define INCLUDED_snikket_queries_ExtDiscoGet
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,queries,ExtDiscoGet)
+HX_DECLARE_CLASS2(snikket,queries,GenericQuery)
+
+namespace snikket{
+namespace queries{
+
+
+class HXCPP_CLASS_ATTRIBUTES ExtDiscoGet_obj : public ::snikket::queries::GenericQuery_obj
+{
+ public:
+ typedef ::snikket::queries::GenericQuery_obj super;
+ typedef ExtDiscoGet_obj OBJ_;
+ ExtDiscoGet_obj();
+
+ public:
+ enum { _hx_ClassId = 0x5f97d134 };
+
+ void __construct(::String to);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.queries.ExtDiscoGet")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.queries.ExtDiscoGet"); }
+ static ::hx::ObjectPtr< ExtDiscoGet_obj > __new(::String to);
+ static ::hx::ObjectPtr< ExtDiscoGet_obj > __alloc(::hx::Ctx *_hx_ctx,::String to);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ExtDiscoGet_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("ExtDiscoGet",dd,86,3d,f9); }
+
+ ::String xmlns;
+ ::String queryId;
+ ::snikket::Stanza responseStanza;
+ ::Array< ::Dynamic> result;
+ void handleResponse( ::snikket::Stanza stanza);
+
+ ::Array< ::Dynamic> getResult();
+ ::Dynamic getResult_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace queries
+
+#endif /* INCLUDED_snikket_queries_ExtDiscoGet */
diff --git a/Sources/c_snikket/iinclude/include/snikket/queries/GenericQuery.h b/Sources/c_snikket/iinclude/include/snikket/queries/GenericQuery.h
new file mode 100644
index 0000000..b2b72e1
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/queries/GenericQuery.h
@@ -0,0 +1,65 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#define INCLUDED_snikket_queries_GenericQuery
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,queries,GenericQuery)
+
+namespace snikket{
+namespace queries{
+
+
+class HXCPP_CLASS_ATTRIBUTES GenericQuery_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef GenericQuery_obj OBJ_;
+ GenericQuery_obj();
+
+ public:
+ enum { _hx_ClassId = 0x22eda35a };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.queries.GenericQuery")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.queries.GenericQuery"); }
+
+ //~GenericQuery_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("GenericQuery",91,e1,46,fa); }
+
+ ::snikket::Stanza queryStanza;
+ ::Dynamic handleFinished;
+ Dynamic handleFinished_dyn() { return handleFinished;}
+ bool isFinished;
+ ::snikket::Stanza getQueryStanza();
+ ::Dynamic getQueryStanza_dyn();
+
+ void finish();
+ ::Dynamic finish_dyn();
+
+ virtual void handleResponse( ::snikket::Stanza response) {}
+ ::Dynamic handleResponse_dyn();
+ void onFinished( ::Dynamic handler);
+ ::Dynamic onFinished_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace queries
+
+#endif /* INCLUDED_snikket_queries_GenericQuery */
diff --git a/Sources/c_snikket/iinclude/include/snikket/queries/HttpUploadSlot.h b/Sources/c_snikket/iinclude/include/snikket/queries/HttpUploadSlot.h
new file mode 100644
index 0000000..883512b
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/queries/HttpUploadSlot.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_queries_HttpUploadSlot
+#define INCLUDED_snikket_queries_HttpUploadSlot
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Hash)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,queries,GenericQuery)
+HX_DECLARE_CLASS2(snikket,queries,HttpUploadSlot)
+
+namespace snikket{
+namespace queries{
+
+
+class HXCPP_CLASS_ATTRIBUTES HttpUploadSlot_obj : public ::snikket::queries::GenericQuery_obj
+{
+ public:
+ typedef ::snikket::queries::GenericQuery_obj super;
+ typedef HttpUploadSlot_obj OBJ_;
+ HttpUploadSlot_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1883dc70 };
+
+ void __construct(::String to,::String filename,int size,::String mime,::Array< ::Dynamic> hashes);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.queries.HttpUploadSlot")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.queries.HttpUploadSlot"); }
+ static ::hx::ObjectPtr< HttpUploadSlot_obj > __new(::String to,::String filename,int size,::String mime,::Array< ::Dynamic> hashes);
+ static ::hx::ObjectPtr< HttpUploadSlot_obj > __alloc(::hx::Ctx *_hx_ctx,::String to,::String filename,int size,::String mime,::Array< ::Dynamic> hashes);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~HttpUploadSlot_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("HttpUploadSlot",67,56,52,67); }
+
+ ::String xmlns;
+ ::String queryId;
+ ::snikket::Stanza responseStanza;
+ ::Dynamic result;
+ void handleResponse( ::snikket::Stanza stanza);
+
+ ::Dynamic getResult();
+ ::Dynamic getResult_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace queries
+
+#endif /* INCLUDED_snikket_queries_HttpUploadSlot */
diff --git a/Sources/c_snikket/iinclude/include/snikket/queries/JabberIqGatewayGet.h b/Sources/c_snikket/iinclude/include/snikket/queries/JabberIqGatewayGet.h
new file mode 100644
index 0000000..9c76c99
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/queries/JabberIqGatewayGet.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_queries_JabberIqGatewayGet
+#define INCLUDED_snikket_queries_JabberIqGatewayGet
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+HX_DECLARE_CLASS2(haxe,ds,Either)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,queries,GenericQuery)
+HX_DECLARE_CLASS2(snikket,queries,JabberIqGatewayGet)
+
+namespace snikket{
+namespace queries{
+
+
+class HXCPP_CLASS_ATTRIBUTES JabberIqGatewayGet_obj : public ::snikket::queries::GenericQuery_obj
+{
+ public:
+ typedef ::snikket::queries::GenericQuery_obj super;
+ typedef JabberIqGatewayGet_obj OBJ_;
+ JabberIqGatewayGet_obj();
+
+ public:
+ enum { _hx_ClassId = 0x3942ef8b };
+
+ void __construct(::String to,::String prompt);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.queries.JabberIqGatewayGet")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.queries.JabberIqGatewayGet"); }
+ static ::hx::ObjectPtr< JabberIqGatewayGet_obj > __new(::String to,::String prompt);
+ static ::hx::ObjectPtr< JabberIqGatewayGet_obj > __alloc(::hx::Ctx *_hx_ctx,::String to,::String prompt);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~JabberIqGatewayGet_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("JabberIqGatewayGet",9e,bd,60,0b); }
+
+ ::String xmlns;
+ ::String queryId;
+ ::snikket::Stanza responseStanza;
+ ::haxe::ds::Either result;
+ void handleResponse( ::snikket::Stanza stanza);
+
+ ::haxe::ds::Either getResult();
+ ::Dynamic getResult_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace queries
+
+#endif /* INCLUDED_snikket_queries_JabberIqGatewayGet */
diff --git a/Sources/c_snikket/iinclude/include/snikket/queries/MAMQuery.h b/Sources/c_snikket/iinclude/include/snikket/queries/MAMQuery.h
new file mode 100644
index 0000000..c3abe95
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/queries/MAMQuery.h
@@ -0,0 +1,73 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_queries_MAMQuery
+#define INCLUDED_snikket_queries_MAMQuery
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,queries,GenericQuery)
+HX_DECLARE_CLASS2(snikket,queries,MAMQuery)
+
+namespace snikket{
+namespace queries{
+
+
+class HXCPP_CLASS_ATTRIBUTES MAMQuery_obj : public ::snikket::queries::GenericQuery_obj
+{
+ public:
+ typedef ::snikket::queries::GenericQuery_obj super;
+ typedef MAMQuery_obj OBJ_;
+ MAMQuery_obj();
+
+ public:
+ enum { _hx_ClassId = 0x3d2643e0 };
+
+ void __construct( ::Dynamic params,::String jid);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.queries.MAMQuery")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.queries.MAMQuery"); }
+ static ::hx::ObjectPtr< MAMQuery_obj > __new( ::Dynamic params,::String jid);
+ static ::hx::ObjectPtr< MAMQuery_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic params,::String jid);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~MAMQuery_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("MAMQuery",cf,3d,b2,7d); }
+
+ ::String xmlns;
+ ::String queryId;
+ ::snikket::Stanza responseStanza;
+ ::Dynamic result;
+ void addStringField(::String name,::String value);
+ ::Dynamic addStringField_dyn();
+
+ void addArrayField(::String name,::Array< ::String > values);
+ ::Dynamic addArrayField_dyn();
+
+ void handleResponse( ::snikket::Stanza stanza);
+
+ ::Dynamic getResult();
+ ::Dynamic getResult_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace queries
+
+#endif /* INCLUDED_snikket_queries_MAMQuery */
diff --git a/Sources/c_snikket/iinclude/include/snikket/queries/PubsubGet.h b/Sources/c_snikket/iinclude/include/snikket/queries/PubsubGet.h
new file mode 100644
index 0000000..0765cc8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/queries/PubsubGet.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_queries_PubsubGet
+#define INCLUDED_snikket_queries_PubsubGet
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,queries,GenericQuery)
+HX_DECLARE_CLASS2(snikket,queries,PubsubGet)
+
+namespace snikket{
+namespace queries{
+
+
+class HXCPP_CLASS_ATTRIBUTES PubsubGet_obj : public ::snikket::queries::GenericQuery_obj
+{
+ public:
+ typedef ::snikket::queries::GenericQuery_obj super;
+ typedef PubsubGet_obj OBJ_;
+ PubsubGet_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1a0e23ea };
+
+ void __construct(::String to,::String node,::String itemId);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.queries.PubsubGet")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.queries.PubsubGet"); }
+ static ::hx::ObjectPtr< PubsubGet_obj > __new(::String to,::String node,::String itemId);
+ static ::hx::ObjectPtr< PubsubGet_obj > __alloc(::hx::Ctx *_hx_ctx,::String to,::String node,::String itemId);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~PubsubGet_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("PubsubGet",53,ed,9f,94); }
+
+ ::String xmlns;
+ ::String queryId;
+ ::String ver;
+ ::snikket::Stanza responseStanza;
+ ::Array< ::Dynamic> result;
+ void handleResponse( ::snikket::Stanza stanza);
+
+ ::Array< ::Dynamic> getResult();
+ ::Dynamic getResult_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace queries
+
+#endif /* INCLUDED_snikket_queries_PubsubGet */
diff --git a/Sources/c_snikket/iinclude/include/snikket/queries/Push2Disable.h b/Sources/c_snikket/iinclude/include/snikket/queries/Push2Disable.h
new file mode 100644
index 0000000..19efee6
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/queries/Push2Disable.h
@@ -0,0 +1,63 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_queries_Push2Disable
+#define INCLUDED_snikket_queries_Push2Disable
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,queries,GenericQuery)
+HX_DECLARE_CLASS2(snikket,queries,Push2Disable)
+
+namespace snikket{
+namespace queries{
+
+
+class HXCPP_CLASS_ATTRIBUTES Push2Disable_obj : public ::snikket::queries::GenericQuery_obj
+{
+ public:
+ typedef ::snikket::queries::GenericQuery_obj super;
+ typedef Push2Disable_obj OBJ_;
+ Push2Disable_obj();
+
+ public:
+ enum { _hx_ClassId = 0x582a6599 };
+
+ void __construct(::String to);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.queries.Push2Disable")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.queries.Push2Disable"); }
+ static ::hx::ObjectPtr< Push2Disable_obj > __new(::String to);
+ static ::hx::ObjectPtr< Push2Disable_obj > __alloc(::hx::Ctx *_hx_ctx,::String to);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Push2Disable_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Push2Disable",d0,a3,83,2f); }
+
+ ::String xmlns;
+ ::String queryId;
+ ::snikket::Stanza responseStanza;
+ void handleResponse( ::snikket::Stanza stanza);
+
+};
+
+} // end namespace snikket
+} // end namespace queries
+
+#endif /* INCLUDED_snikket_queries_Push2Disable */
diff --git a/Sources/c_snikket/iinclude/include/snikket/queries/RosterGet.h b/Sources/c_snikket/iinclude/include/snikket/queries/RosterGet.h
new file mode 100644
index 0000000..befa38a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/queries/RosterGet.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_queries_RosterGet
+#define INCLUDED_snikket_queries_RosterGet
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,queries,GenericQuery)
+HX_DECLARE_CLASS2(snikket,queries,RosterGet)
+
+namespace snikket{
+namespace queries{
+
+
+class HXCPP_CLASS_ATTRIBUTES RosterGet_obj : public ::snikket::queries::GenericQuery_obj
+{
+ public:
+ typedef ::snikket::queries::GenericQuery_obj super;
+ typedef RosterGet_obj OBJ_;
+ RosterGet_obj();
+
+ public:
+ enum { _hx_ClassId = 0x6634aa42 };
+
+ void __construct(::String ver);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.queries.RosterGet")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.queries.RosterGet"); }
+ static ::hx::ObjectPtr< RosterGet_obj > __new(::String ver);
+ static ::hx::ObjectPtr< RosterGet_obj > __alloc(::hx::Ctx *_hx_ctx,::String ver);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~RosterGet_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("RosterGet",ab,73,c6,e0); }
+
+ ::String xmlns;
+ ::String queryId;
+ ::String ver;
+ ::snikket::Stanza responseStanza;
+ ::Array< ::Dynamic> result;
+ void handleResponse( ::snikket::Stanza stanza);
+
+ ::Array< ::Dynamic> getResult();
+ ::Dynamic getResult_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace queries
+
+#endif /* INCLUDED_snikket_queries_RosterGet */
diff --git a/Sources/c_snikket/iinclude/include/snikket/queries/VcardTempGet.h b/Sources/c_snikket/iinclude/include/snikket/queries/VcardTempGet.h
new file mode 100644
index 0000000..fea8f62
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/queries/VcardTempGet.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_queries_VcardTempGet
+#define INCLUDED_snikket_queries_VcardTempGet
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+HX_DECLARE_CLASS1(snikket,JID)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,queries,GenericQuery)
+HX_DECLARE_CLASS2(snikket,queries,VcardTempGet)
+
+namespace snikket{
+namespace queries{
+
+
+class HXCPP_CLASS_ATTRIBUTES VcardTempGet_obj : public ::snikket::queries::GenericQuery_obj
+{
+ public:
+ typedef ::snikket::queries::GenericQuery_obj super;
+ typedef VcardTempGet_obj OBJ_;
+ VcardTempGet_obj();
+
+ public:
+ enum { _hx_ClassId = 0x4c679325 };
+
+ void __construct( ::snikket::JID to);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.queries.VcardTempGet")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.queries.VcardTempGet"); }
+ static ::hx::ObjectPtr< VcardTempGet_obj > __new( ::snikket::JID to);
+ static ::hx::ObjectPtr< VcardTempGet_obj > __alloc(::hx::Ctx *_hx_ctx, ::snikket::JID to);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~VcardTempGet_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("VcardTempGet",5c,d1,c0,23); }
+
+ ::String xmlns;
+ ::String queryId;
+ ::snikket::Stanza responseStanza;
+ ::Dynamic result;
+ void handleResponse( ::snikket::Stanza stanza);
+
+ ::Dynamic getResult();
+ ::Dynamic getResult_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace queries
+
+#endif /* INCLUDED_snikket_queries_VcardTempGet */
diff --git a/Sources/c_snikket/iinclude/include/snikket/streams/XmppStropheStream.h b/Sources/c_snikket/iinclude/include/snikket/streams/XmppStropheStream.h
new file mode 100644
index 0000000..59b34d0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/snikket/streams/XmppStropheStream.h
@@ -0,0 +1,103 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_streams_XmppStropheStream
+#define INCLUDED_snikket_streams_XmppStropheStream
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_GenericStream
+#include <snikket/GenericStream.h>
+#endif
+#ifndef INCLUDED_18a1146676e1af0b
+#define INCLUDED_18a1146676e1af0b
+#include "strophe.h"
+#endif
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,BalancedTree)
+HX_DECLARE_CLASS2(haxe,ds,EnumValueMap)
+HX_DECLARE_CLASS1(snikket,EventEmitter)
+HX_DECLARE_CLASS1(snikket,GenericStream)
+HX_DECLARE_CLASS1(snikket,IqRequestType)
+HX_DECLARE_CLASS1(snikket,IqResult)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,streams,XmppStropheStream)
+
+#include "strophe.h"
+namespace snikket{
+namespace streams{
+
+
+class HXCPP_CLASS_ATTRIBUTES XmppStropheStream_obj : public ::snikket::GenericStream_obj
+{
+ public:
+ typedef ::snikket::GenericStream_obj super;
+ typedef XmppStropheStream_obj OBJ_;
+ XmppStropheStream_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7e6ea620 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.streams.XmppStropheStream")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.streams.XmppStropheStream"); }
+ static ::hx::ObjectPtr< XmppStropheStream_obj > __new();
+ static ::hx::ObjectPtr< XmppStropheStream_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~XmppStropheStream_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("XmppStropheStream",da,d9,8d,8c); }
+
+ static int strophe_certfail_handler( const xmpp_tlscert_t* cert,const char* err);
+
+ static int strophe_stanza( xmpp_conn_t* conn, xmpp_stanza_t* sstanza,void* userdata);
+
+ static void strophe_connect( xmpp_conn_t* conn, xmpp_conn_event_t event,int error, xmpp_stream_error_t* stream_error,void* userdata);
+
+ static ::snikket::Stanza convertToStanza( xmpp_stanza_t* el,void* dummy);
+
+ ::haxe::ds::EnumValueMap iqHandlers;
+ ::Array< ::Dynamic> pending;
+ bool ready;
+ ::String newId();
+
+ void onIq( ::snikket::IqRequestType type,::String tag,::String xmlns, ::Dynamic handler);
+
+ void connect(::String jid,::Array< unsigned char > sm);
+
+ void disconnect();
+
+ void poll();
+ ::Dynamic poll_dyn();
+
+ xmpp_stanza_t* convertFromStanza( ::snikket::Stanza el);
+ ::Dynamic convertFromStanza_dyn();
+
+ void sendStanza( ::snikket::Stanza stanza);
+
+ void finalize();
+ ::Dynamic finalize_dyn();
+
+
+ private: xmpp_ctx_t *ctx;
+ private: xmpp_conn_t *conn;
+
+};
+
+} // end namespace snikket
+} // end namespace streams
+
+#endif /* INCLUDED_snikket_streams_XmppStropheStream */
diff --git a/Sources/c_snikket/iinclude/include/sys/FileSystem.h b/Sources/c_snikket/iinclude/include/sys/FileSystem.h
new file mode 100644
index 0000000..882325d
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/FileSystem.h
@@ -0,0 +1,75 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_FileSystem
+#define INCLUDED_sys_FileSystem
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(sys,FileSystem)
+
+namespace sys{
+
+
+class HXCPP_CLASS_ATTRIBUTES FileSystem_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef FileSystem_obj OBJ_;
+ FileSystem_obj();
+
+ public:
+ enum { _hx_ClassId = 0x2378c654 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="sys.FileSystem")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"sys.FileSystem"); }
+
+ inline static ::hx::ObjectPtr< FileSystem_obj > __new() {
+ ::hx::ObjectPtr< FileSystem_obj > __this = new FileSystem_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< FileSystem_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ FileSystem_obj *__this = (FileSystem_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(FileSystem_obj), false, "sys.FileSystem"));
+ *(void **)__this = FileSystem_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~FileSystem_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("FileSystem",ab,e2,17,ca); }
+
+ static bool exists(::String path);
+ static ::Dynamic exists_dyn();
+
+ static ::Dynamic stat(::String path);
+ static ::Dynamic stat_dyn();
+
+ static ::String fullPath(::String relPath);
+ static ::Dynamic fullPath_dyn();
+
+ static ::String absolutePath(::String relPath);
+ static ::Dynamic absolutePath_dyn();
+
+ static bool isDirectory(::String path);
+ static ::Dynamic isDirectory_dyn();
+
+ static void deleteFile(::String path);
+ static ::Dynamic deleteFile_dyn();
+
+};
+
+} // end namespace sys
+
+#endif /* INCLUDED_sys_FileSystem */
diff --git a/Sources/c_snikket/iinclude/include/sys/Http.h b/Sources/c_snikket/iinclude/include/sys/Http.h
new file mode 100644
index 0000000..42e3202
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/Http.h
@@ -0,0 +1,88 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_Http
+#define INCLUDED_sys_Http
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_http_HttpBase
+#include <haxe/http/HttpBase.h>
+#endif
+HX_DECLARE_CLASS0(EReg)
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+HX_DECLARE_CLASS2(haxe,http,HttpBase)
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,BytesOutput)
+HX_DECLARE_CLASS2(haxe,io,Input)
+HX_DECLARE_CLASS2(haxe,io,Output)
+HX_DECLARE_CLASS1(sys,Http)
+HX_DECLARE_CLASS2(sys,net,Socket)
+
+namespace sys{
+
+
+class HXCPP_CLASS_ATTRIBUTES Http_obj : public ::haxe::http::HttpBase_obj
+{
+ public:
+ typedef ::haxe::http::HttpBase_obj super;
+ typedef Http_obj OBJ_;
+ Http_obj();
+
+ public:
+ enum { _hx_ClassId = 0x02924475 };
+
+ void __construct(::String url);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.Http")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.Http"); }
+ static ::hx::ObjectPtr< Http_obj > __new(::String url);
+ static ::hx::ObjectPtr< Http_obj > __alloc(::hx::Ctx *_hx_ctx,::String url);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Http_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Http",a8,c7,ef,2f); }
+
+ static void __boot();
+ static ::Dynamic PROXY;
+ bool noShutdown;
+ Float cnxTimeout;
+ ::haxe::ds::StringMap responseHeaders;
+ ::haxe::ds::StringMap responseHeadersSameKey;
+ ::Dynamic chunk_size;
+ ::haxe::io::Bytes chunk_buf;
+ ::Dynamic file;
+ void request( ::Dynamic post);
+ ::Dynamic request_dyn();
+
+ void customRequest(bool post, ::haxe::io::Output api, ::sys::net::Socket sock,::String method);
+ ::Dynamic customRequest_dyn();
+
+ void writeBody( ::haxe::io::BytesOutput body, ::haxe::io::Input fileInput,int fileSize,::String boundary, ::sys::net::Socket sock);
+ ::Dynamic writeBody_dyn();
+
+ void readHttpResponse( ::haxe::io::Output api, ::sys::net::Socket sock);
+ ::Dynamic readHttpResponse_dyn();
+
+ bool readChunk( ::EReg chunk_re, ::haxe::io::Output api, ::haxe::io::Bytes buf,int len);
+ ::Dynamic readChunk_dyn();
+
+};
+
+} // end namespace sys
+
+#endif /* INCLUDED_sys_Http */
diff --git a/Sources/c_snikket/iinclude/include/sys/db/Connection.h b/Sources/c_snikket/iinclude/include/sys/db/Connection.h
new file mode 100644
index 0000000..cf46b5f
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/db/Connection.h
@@ -0,0 +1,34 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_db_Connection
+#define INCLUDED_sys_db_Connection
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(sys,db,Connection)
+HX_DECLARE_CLASS2(sys,db,ResultSet)
+
+namespace sys{
+namespace db{
+
+
+class HXCPP_CLASS_ATTRIBUTES Connection_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ ::Dynamic (::hx::Object :: *_hx_request)(::String s);
+ static inline ::Dynamic request( ::Dynamic _hx_,::String s) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::sys::db::Connection_obj *>(_hx_.mPtr->_hx_getInterface(0x6e7a3d49)))->_hx_request)(s);
+ }
+ ::String (::hx::Object :: *_hx_quote)(::String s);
+ static inline ::String quote( ::Dynamic _hx_,::String s) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::sys::db::Connection_obj *>(_hx_.mPtr->_hx_getInterface(0x6e7a3d49)))->_hx_quote)(s);
+ }
+};
+
+} // end namespace sys
+} // end namespace db
+
+#endif /* INCLUDED_sys_db_Connection */
diff --git a/Sources/c_snikket/iinclude/include/sys/db/ResultSet.h b/Sources/c_snikket/iinclude/include/sys/db/ResultSet.h
new file mode 100644
index 0000000..6a8d3ca
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/db/ResultSet.h
@@ -0,0 +1,33 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_db_ResultSet
+#define INCLUDED_sys_db_ResultSet
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(sys,db,ResultSet)
+
+namespace sys{
+namespace db{
+
+
+class HXCPP_CLASS_ATTRIBUTES ResultSet_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ bool (::hx::Object :: *_hx_hasNext)();
+ static inline bool hasNext( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::sys::db::ResultSet_obj *>(_hx_.mPtr->_hx_getInterface(0xc11b83fa)))->_hx_hasNext)();
+ }
+ ::Dynamic (::hx::Object :: *_hx_next)();
+ static inline ::Dynamic next( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::sys::db::ResultSet_obj *>(_hx_.mPtr->_hx_getInterface(0xc11b83fa)))->_hx_next)();
+ }
+};
+
+} // end namespace sys
+} // end namespace db
+
+#endif /* INCLUDED_sys_db_ResultSet */
diff --git a/Sources/c_snikket/iinclude/include/sys/db/Sqlite.h b/Sources/c_snikket/iinclude/include/sys/db/Sqlite.h
new file mode 100644
index 0000000..ae8bcba
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/db/Sqlite.h
@@ -0,0 +1,63 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_db_Sqlite
+#define INCLUDED_sys_db_Sqlite
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(sys,db,Connection)
+HX_DECLARE_CLASS2(sys,db,Sqlite)
+
+namespace sys{
+namespace db{
+
+
+class HXCPP_CLASS_ATTRIBUTES Sqlite_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Sqlite_obj OBJ_;
+ Sqlite_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1fc648d3 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="sys.db.Sqlite")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"sys.db.Sqlite"); }
+
+ inline static ::hx::ObjectPtr< Sqlite_obj > __new() {
+ ::hx::ObjectPtr< Sqlite_obj > __this = new Sqlite_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Sqlite_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Sqlite_obj *__this = (Sqlite_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Sqlite_obj), false, "sys.db.Sqlite"));
+ *(void **)__this = Sqlite_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Sqlite_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Sqlite",ec,9c,99,87); }
+
+ static ::Dynamic open(::String file);
+ static ::Dynamic open_dyn();
+
+};
+
+} // end namespace sys
+} // end namespace db
+
+#endif /* INCLUDED_sys_db_Sqlite */
diff --git a/Sources/c_snikket/iinclude/include/sys/db/_Sqlite/SqliteConnection.h b/Sources/c_snikket/iinclude/include/sys/db/_Sqlite/SqliteConnection.h
new file mode 100644
index 0000000..7c154f8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/db/_Sqlite/SqliteConnection.h
@@ -0,0 +1,67 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_db__Sqlite_SqliteConnection
+#define INCLUDED_sys_db__Sqlite_SqliteConnection
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_sys_db_Connection
+#include <sys/db/Connection.h>
+#endif
+HX_DECLARE_CLASS2(sys,db,Connection)
+HX_DECLARE_CLASS2(sys,db,ResultSet)
+HX_DECLARE_CLASS3(sys,db,_Sqlite,SqliteConnection)
+
+namespace sys{
+namespace db{
+namespace _Sqlite{
+
+
+class HXCPP_CLASS_ATTRIBUTES SqliteConnection_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef SqliteConnection_obj OBJ_;
+ SqliteConnection_obj();
+
+ public:
+ enum { _hx_ClassId = 0x26edc0ae };
+
+ void __construct(::String file);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.db._Sqlite.SqliteConnection")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.db._Sqlite.SqliteConnection"); }
+ static ::hx::ObjectPtr< SqliteConnection_obj > __new(::String file);
+ static ::hx::ObjectPtr< SqliteConnection_obj > __alloc(::hx::Ctx *_hx_ctx,::String file);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SqliteConnection_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("SqliteConnection",2a,20,03,a3); }
+
+ ::Dynamic c;
+ ::Dynamic request(::String s);
+ ::Dynamic request_dyn();
+
+ ::String quote(::String s);
+ ::Dynamic quote_dyn();
+
+};
+
+} // end namespace sys
+} // end namespace db
+} // end namespace _Sqlite
+
+#endif /* INCLUDED_sys_db__Sqlite_SqliteConnection */
diff --git a/Sources/c_snikket/iinclude/include/sys/db/_Sqlite/SqliteResultSet.h b/Sources/c_snikket/iinclude/include/sys/db/_Sqlite/SqliteResultSet.h
new file mode 100644
index 0000000..3437f67
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/db/_Sqlite/SqliteResultSet.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_db__Sqlite_SqliteResultSet
+#define INCLUDED_sys_db__Sqlite_SqliteResultSet
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_sys_db_ResultSet
+#include <sys/db/ResultSet.h>
+#endif
+HX_DECLARE_CLASS2(haxe,ds,List)
+HX_DECLARE_CLASS2(sys,db,ResultSet)
+HX_DECLARE_CLASS3(sys,db,_Sqlite,SqliteResultSet)
+
+namespace sys{
+namespace db{
+namespace _Sqlite{
+
+
+class HXCPP_CLASS_ATTRIBUTES SqliteResultSet_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef SqliteResultSet_obj OBJ_;
+ SqliteResultSet_obj();
+
+ public:
+ enum { _hx_ClassId = 0x068aee19 };
+
+ void __construct( ::Dynamic r);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.db._Sqlite.SqliteResultSet")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.db._Sqlite.SqliteResultSet"); }
+ static ::hx::ObjectPtr< SqliteResultSet_obj > __new( ::Dynamic r);
+ static ::hx::ObjectPtr< SqliteResultSet_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic r);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SqliteResultSet_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("SqliteResultSet",39,58,4c,f7); }
+
+ ::Dynamic r;
+ ::haxe::ds::List cache;
+ bool hasNext();
+ ::Dynamic hasNext_dyn();
+
+ ::Dynamic next();
+ ::Dynamic next_dyn();
+
+};
+
+} // end namespace sys
+} // end namespace db
+} // end namespace _Sqlite
+
+#endif /* INCLUDED_sys_db__Sqlite_SqliteResultSet */
diff --git a/Sources/c_snikket/iinclude/include/sys/io/File.h b/Sources/c_snikket/iinclude/include/sys/io/File.h
new file mode 100644
index 0000000..11172d1
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/io/File.h
@@ -0,0 +1,73 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_io_File
+#define INCLUDED_sys_io_File
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,Input)
+HX_DECLARE_CLASS2(haxe,io,Output)
+HX_DECLARE_CLASS2(sys,io,File)
+HX_DECLARE_CLASS2(sys,io,FileInput)
+HX_DECLARE_CLASS2(sys,io,FileOutput)
+
+namespace sys{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES File_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef File_obj OBJ_;
+ File_obj();
+
+ public:
+ enum { _hx_ClassId = 0x645a6147 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="sys.io.File")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"sys.io.File"); }
+
+ inline static ::hx::ObjectPtr< File_obj > __new() {
+ ::hx::ObjectPtr< File_obj > __this = new File_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< File_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ File_obj *__this = (File_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(File_obj), false, "sys.io.File"));
+ *(void **)__this = File_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~File_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("File",9c,fa,94,2e); }
+
+ static void saveBytes(::String path, ::haxe::io::Bytes bytes);
+ static ::Dynamic saveBytes_dyn();
+
+ static ::sys::io::FileInput read(::String path,::hx::Null< bool > binary);
+ static ::Dynamic read_dyn();
+
+ static ::sys::io::FileOutput write(::String path,::hx::Null< bool > binary);
+ static ::Dynamic write_dyn();
+
+};
+
+} // end namespace sys
+} // end namespace io
+
+#endif /* INCLUDED_sys_io_File */
diff --git a/Sources/c_snikket/iinclude/include/sys/io/FileInput.h b/Sources/c_snikket/iinclude/include/sys/io/FileInput.h
new file mode 100644
index 0000000..8cd622d
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/io/FileInput.h
@@ -0,0 +1,64 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_io_FileInput
+#define INCLUDED_sys_io_FileInput
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_io_Input
+#include <haxe/io/Input.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,Input)
+HX_DECLARE_CLASS2(sys,io,FileInput)
+
+namespace sys{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES FileInput_obj : public ::haxe::io::Input_obj
+{
+ public:
+ typedef ::haxe::io::Input_obj super;
+ typedef FileInput_obj OBJ_;
+ FileInput_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1a1fbc7b };
+
+ void __construct( ::Dynamic f);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.io.FileInput")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.io.FileInput"); }
+ static ::hx::ObjectPtr< FileInput_obj > __new( ::Dynamic f);
+ static ::hx::ObjectPtr< FileInput_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic f);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~FileInput_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("FileInput",ce,43,18,62); }
+
+ ::Dynamic _hx___f;
+ int readByte();
+
+ int readBytes( ::haxe::io::Bytes s,int p,int l);
+
+ void close();
+
+};
+
+} // end namespace sys
+} // end namespace io
+
+#endif /* INCLUDED_sys_io_FileInput */
diff --git a/Sources/c_snikket/iinclude/include/sys/io/FileOutput.h b/Sources/c_snikket/iinclude/include/sys/io/FileOutput.h
new file mode 100644
index 0000000..9bcf940
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/io/FileOutput.h
@@ -0,0 +1,64 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_io_FileOutput
+#define INCLUDED_sys_io_FileOutput
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_io_Output
+#include <haxe/io/Output.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,Output)
+HX_DECLARE_CLASS2(sys,io,FileOutput)
+
+namespace sys{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES FileOutput_obj : public ::haxe::io::Output_obj
+{
+ public:
+ typedef ::haxe::io::Output_obj super;
+ typedef FileOutput_obj OBJ_;
+ FileOutput_obj();
+
+ public:
+ enum { _hx_ClassId = 0x32387970 };
+
+ void __construct( ::Dynamic f);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.io.FileOutput")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.io.FileOutput"); }
+ static ::hx::ObjectPtr< FileOutput_obj > __new( ::Dynamic f);
+ static ::hx::ObjectPtr< FileOutput_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic f);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~FileOutput_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("FileOutput",bd,5a,b6,e3); }
+
+ ::Dynamic _hx___f;
+ void writeByte(int c);
+
+ int writeBytes( ::haxe::io::Bytes s,int p,int l);
+
+ void close();
+
+};
+
+} // end namespace sys
+} // end namespace io
+
+#endif /* INCLUDED_sys_io_FileOutput */
diff --git a/Sources/c_snikket/iinclude/include/sys/io/Process.h b/Sources/c_snikket/iinclude/include/sys/io/Process.h
new file mode 100644
index 0000000..d4386c5
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/io/Process.h
@@ -0,0 +1,61 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_io_Process
+#define INCLUDED_sys_io_Process
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,io,Input)
+HX_DECLARE_CLASS2(haxe,io,Output)
+HX_DECLARE_CLASS2(sys,io,Process)
+
+namespace sys{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES Process_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Process_obj OBJ_;
+ Process_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7a155cb0 };
+
+ void __construct(::String cmd,::Array< ::String > args, ::Dynamic detached);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.io.Process")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.io.Process"); }
+ static ::hx::ObjectPtr< Process_obj > __new(::String cmd,::Array< ::String > args, ::Dynamic detached);
+ static ::hx::ObjectPtr< Process_obj > __alloc(::hx::Ctx *_hx_ctx,::String cmd,::Array< ::String > args, ::Dynamic detached);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Process_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Process",4f,ca,9b,be); }
+
+ ::Dynamic p;
+ ::haxe::io::Input _hx_stdout;
+ ::haxe::io::Input _hx_stderr;
+ ::haxe::io::Output _hx_stdin;
+ ::Dynamic exitCode(::hx::Null< bool > block);
+ ::Dynamic exitCode_dyn();
+
+};
+
+} // end namespace sys
+} // end namespace io
+
+#endif /* INCLUDED_sys_io_Process */
diff --git a/Sources/c_snikket/iinclude/include/sys/io/_Process/Stdin.h b/Sources/c_snikket/iinclude/include/sys/io/_Process/Stdin.h
new file mode 100644
index 0000000..473d06a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/io/_Process/Stdin.h
@@ -0,0 +1,67 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_io__Process_Stdin
+#define INCLUDED_sys_io__Process_Stdin
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_io_Output
+#include <haxe/io/Output.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,Output)
+HX_DECLARE_CLASS3(sys,io,_Process,Stdin)
+
+namespace sys{
+namespace io{
+namespace _Process{
+
+
+class HXCPP_CLASS_ATTRIBUTES Stdin_obj : public ::haxe::io::Output_obj
+{
+ public:
+ typedef ::haxe::io::Output_obj super;
+ typedef Stdin_obj OBJ_;
+ Stdin_obj();
+
+ public:
+ enum { _hx_ClassId = 0x037481cd };
+
+ void __construct( ::Dynamic p);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.io._Process.Stdin")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.io._Process.Stdin"); }
+ static ::hx::ObjectPtr< Stdin_obj > __new( ::Dynamic p);
+ static ::hx::ObjectPtr< Stdin_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic p);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Stdin_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Stdin",28,23,3b,17); }
+
+ ::Dynamic p;
+ ::haxe::io::Bytes buf;
+ void close();
+
+ void writeByte(int c);
+
+ int writeBytes( ::haxe::io::Bytes buf,int pos,int len);
+
+};
+
+} // end namespace sys
+} // end namespace io
+} // end namespace _Process
+
+#endif /* INCLUDED_sys_io__Process_Stdin */
diff --git a/Sources/c_snikket/iinclude/include/sys/io/_Process/Stdout.h b/Sources/c_snikket/iinclude/include/sys/io/_Process/Stdout.h
new file mode 100644
index 0000000..0533216
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/io/_Process/Stdout.h
@@ -0,0 +1,66 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_io__Process_Stdout
+#define INCLUDED_sys_io__Process_Stdout
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_io_Input
+#include <haxe/io/Input.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,Input)
+HX_DECLARE_CLASS3(sys,io,_Process,Stdout)
+
+namespace sys{
+namespace io{
+namespace _Process{
+
+
+class HXCPP_CLASS_ATTRIBUTES Stdout_obj : public ::haxe::io::Input_obj
+{
+ public:
+ typedef ::haxe::io::Input_obj super;
+ typedef Stdout_obj OBJ_;
+ Stdout_obj();
+
+ public:
+ enum { _hx_ClassId = 0x2316116e };
+
+ void __construct( ::Dynamic p,bool out);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.io._Process.Stdout")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.io._Process.Stdout"); }
+ static ::hx::ObjectPtr< Stdout_obj > __new( ::Dynamic p,bool out);
+ static ::hx::ObjectPtr< Stdout_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic p,bool out);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Stdout_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Stdout",eb,33,88,3c); }
+
+ ::Dynamic p;
+ bool out;
+ ::haxe::io::Bytes buf;
+ int readByte();
+
+ int readBytes( ::haxe::io::Bytes str,int pos,int len);
+
+};
+
+} // end namespace sys
+} // end namespace io
+} // end namespace _Process
+
+#endif /* INCLUDED_sys_io__Process_Stdout */
diff --git a/Sources/c_snikket/iinclude/include/sys/net/Host.h b/Sources/c_snikket/iinclude/include/sys/net/Host.h
new file mode 100644
index 0000000..0fe42fa
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/net/Host.h
@@ -0,0 +1,94 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_net_Host
+#define INCLUDED_sys_net_Host
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_87d3457c074e81a3_35_new)
+HX_DECLARE_CLASS2(sys,net,Host)
+
+namespace sys{
+namespace net{
+
+
+class HXCPP_CLASS_ATTRIBUTES Host_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Host_obj OBJ_;
+ Host_obj();
+
+ public:
+ enum { _hx_ClassId = 0x6c3d7e78 };
+
+ void __construct(::String name);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.net.Host")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.net.Host"); }
+
+ inline static ::hx::ObjectPtr< Host_obj > __new(::String name) {
+ ::hx::ObjectPtr< Host_obj > __this = new Host_obj();
+ __this->__construct(name);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Host_obj > __alloc(::hx::Ctx *_hx_ctx,::String name) {
+ Host_obj *__this = (Host_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Host_obj), true, "sys.net.Host"));
+ *(void **)__this = Host_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_87d3457c074e81a3_35_new)
+HXLINE( 36) ( ( ::sys::net::Host)(__this) )->host = name;
+HXLINE( 37) try {
+ HX_STACK_CATCHABLE( ::Dynamic, 0);
+HXLINE( 38) ( ( ::sys::net::Host)(__this) )->ip = _hx_std_host_resolve(name);
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::Dynamic >() ){
+ HX_STACK_BEGIN_CATCH
+ ::Dynamic _g = _hx_e;
+HXLINE( 39) {
+HXLINE( 39) null();
+ }
+HXLINE( 40) ( ( ::sys::net::Host)(__this) )->ipv6 = _hx_std_host_resolve_ipv6(name);
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Host_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ static void __init__();
+
+ ::String __ToString() const { return HX_("Host",88,fb,eb,2f); }
+
+ static void __boot();
+ ::String host;
+ int ip;
+ ::Array< unsigned char > ipv6;
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+};
+
+} // end namespace sys
+} // end namespace net
+
+#endif /* INCLUDED_sys_net_Host */
diff --git a/Sources/c_snikket/iinclude/include/sys/net/Socket.h b/Sources/c_snikket/iinclude/include/sys/net/Socket.h
new file mode 100644
index 0000000..c1426ac
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/net/Socket.h
@@ -0,0 +1,82 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_net_Socket
+#define INCLUDED_sys_net_Socket
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,io,Input)
+HX_DECLARE_CLASS2(haxe,io,Output)
+HX_DECLARE_CLASS2(sys,net,Host)
+HX_DECLARE_CLASS2(sys,net,Socket)
+
+namespace sys{
+namespace net{
+
+
+class HXCPP_CLASS_ATTRIBUTES Socket_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Socket_obj OBJ_;
+ Socket_obj();
+
+ public:
+ enum { _hx_ClassId = 0x70c71ec3 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.net.Socket")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.net.Socket"); }
+ static ::hx::ObjectPtr< Socket_obj > __new();
+ static ::hx::ObjectPtr< Socket_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Socket_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Socket",d3,ff,da,5a); }
+
+ ::Dynamic __s;
+ Float _hx___timeout;
+ bool _hx___blocking;
+ bool _hx___fastSend;
+ ::haxe::io::Input input;
+ ::haxe::io::Output output;
+ virtual void init();
+ ::Dynamic init_dyn();
+
+ virtual void close();
+ ::Dynamic close_dyn();
+
+ virtual void connect( ::sys::net::Host host,int port);
+ ::Dynamic connect_dyn();
+
+ void shutdown(bool read,bool write);
+ ::Dynamic shutdown_dyn();
+
+ void setTimeout(Float timeout);
+ ::Dynamic setTimeout_dyn();
+
+ void setBlocking(bool b);
+ ::Dynamic setBlocking_dyn();
+
+ void setFastSend(bool b);
+ ::Dynamic setFastSend_dyn();
+
+};
+
+} // end namespace sys
+} // end namespace net
+
+#endif /* INCLUDED_sys_net_Socket */
diff --git a/Sources/c_snikket/iinclude/include/sys/net/_Socket/SocketInput.h b/Sources/c_snikket/iinclude/include/sys/net/_Socket/SocketInput.h
new file mode 100644
index 0000000..7c6907c
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/net/_Socket/SocketInput.h
@@ -0,0 +1,66 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_net__Socket_SocketInput
+#define INCLUDED_sys_net__Socket_SocketInput
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_io_Input
+#include <haxe/io/Input.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,Input)
+HX_DECLARE_CLASS3(sys,net,_Socket,SocketInput)
+
+namespace sys{
+namespace net{
+namespace _Socket{
+
+
+class HXCPP_CLASS_ATTRIBUTES SocketInput_obj : public ::haxe::io::Input_obj
+{
+ public:
+ typedef ::haxe::io::Input_obj super;
+ typedef SocketInput_obj OBJ_;
+ SocketInput_obj();
+
+ public:
+ enum { _hx_ClassId = 0x342d0eb5 };
+
+ void __construct( ::Dynamic s);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.net._Socket.SocketInput")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.net._Socket.SocketInput"); }
+ static ::hx::ObjectPtr< SocketInput_obj > __new( ::Dynamic s);
+ static ::hx::ObjectPtr< SocketInput_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic s);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SocketInput_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("SocketInput",37,f7,80,be); }
+
+ ::Dynamic __s;
+ int readByte();
+
+ int readBytes( ::haxe::io::Bytes buf,int pos,int len);
+
+ void close();
+
+};
+
+} // end namespace sys
+} // end namespace net
+} // end namespace _Socket
+
+#endif /* INCLUDED_sys_net__Socket_SocketInput */
diff --git a/Sources/c_snikket/iinclude/include/sys/net/_Socket/SocketOutput.h b/Sources/c_snikket/iinclude/include/sys/net/_Socket/SocketOutput.h
new file mode 100644
index 0000000..2c685e5
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/net/_Socket/SocketOutput.h
@@ -0,0 +1,66 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_net__Socket_SocketOutput
+#define INCLUDED_sys_net__Socket_SocketOutput
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_io_Output
+#include <haxe/io/Output.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,Output)
+HX_DECLARE_CLASS3(sys,net,_Socket,SocketOutput)
+
+namespace sys{
+namespace net{
+namespace _Socket{
+
+
+class HXCPP_CLASS_ATTRIBUTES SocketOutput_obj : public ::haxe::io::Output_obj
+{
+ public:
+ typedef ::haxe::io::Output_obj super;
+ typedef SocketOutput_obj OBJ_;
+ SocketOutput_obj();
+
+ public:
+ enum { _hx_ClassId = 0x05556112 };
+
+ void __construct( ::Dynamic s);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.net._Socket.SocketOutput")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.net._Socket.SocketOutput"); }
+ static ::hx::ObjectPtr< SocketOutput_obj > __new( ::Dynamic s);
+ static ::hx::ObjectPtr< SocketOutput_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic s);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SocketOutput_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("SocketOutput",34,a3,ea,62); }
+
+ ::Dynamic __s;
+ void writeByte(int c);
+
+ int writeBytes( ::haxe::io::Bytes buf,int pos,int len);
+
+ void close();
+
+};
+
+} // end namespace sys
+} // end namespace net
+} // end namespace _Socket
+
+#endif /* INCLUDED_sys_net__Socket_SocketOutput */
diff --git a/Sources/c_snikket/iinclude/include/sys/ssl/Certificate.h b/Sources/c_snikket/iinclude/include/sys/ssl/Certificate.h
new file mode 100644
index 0000000..c0b6746
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/ssl/Certificate.h
@@ -0,0 +1,85 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_ssl_Certificate
+#define INCLUDED_sys_ssl_Certificate
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_15e02723fb84005c_33_new)
+HX_DECLARE_CLASS2(sys,ssl,Certificate)
+
+namespace sys{
+namespace ssl{
+
+
+class HXCPP_CLASS_ATTRIBUTES Certificate_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Certificate_obj OBJ_;
+ Certificate_obj();
+
+ public:
+ enum { _hx_ClassId = 0x205b2370 };
+
+ void __construct( ::Dynamic x, ::sys::ssl::Certificate h);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.ssl.Certificate")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.ssl.Certificate"); }
+
+ inline static ::hx::ObjectPtr< Certificate_obj > __new( ::Dynamic x, ::sys::ssl::Certificate h) {
+ ::hx::ObjectPtr< Certificate_obj > __this = new Certificate_obj();
+ __this->__construct(x,h);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Certificate_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic x, ::sys::ssl::Certificate h) {
+ Certificate_obj *__this = (Certificate_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Certificate_obj), true, "sys.ssl.Certificate"));
+ *(void **)__this = Certificate_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_15e02723fb84005c_33_new)
+HXLINE( 34) ( ( ::sys::ssl::Certificate)(__this) )->_hx___x = x;
+HXLINE( 35) ( ( ::sys::ssl::Certificate)(__this) )->_hx___h = h;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Certificate_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ static void __init__();
+
+ ::String __ToString() const { return HX_("Certificate",f7,60,75,ff); }
+
+ static void __boot();
+ static ::sys::ssl::Certificate loadFile(::String file);
+ static ::Dynamic loadFile_dyn();
+
+ static ::sys::ssl::Certificate loadPath(::String path);
+ static ::Dynamic loadPath_dyn();
+
+ static ::sys::ssl::Certificate loadDefaults();
+ static ::Dynamic loadDefaults_dyn();
+
+ ::sys::ssl::Certificate _hx___h;
+ ::Dynamic _hx___x;
+};
+
+} // end namespace sys
+} // end namespace ssl
+
+#endif /* INCLUDED_sys_ssl_Certificate */
diff --git a/Sources/c_snikket/iinclude/include/sys/ssl/Key.h b/Sources/c_snikket/iinclude/include/sys/ssl/Key.h
new file mode 100644
index 0000000..68e01fd
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/ssl/Key.h
@@ -0,0 +1,73 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_ssl_Key
+#define INCLUDED_sys_ssl_Key
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_360df8ce648879c1_34_new)
+HX_DECLARE_CLASS2(sys,ssl,Key)
+
+namespace sys{
+namespace ssl{
+
+
+class HXCPP_CLASS_ATTRIBUTES Key_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Key_obj OBJ_;
+ Key_obj();
+
+ public:
+ enum { _hx_ClassId = 0x6dab52dc };
+
+ void __construct( ::Dynamic k);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.ssl.Key")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.ssl.Key"); }
+
+ inline static ::hx::ObjectPtr< Key_obj > __new( ::Dynamic k) {
+ ::hx::ObjectPtr< Key_obj > __this = new Key_obj();
+ __this->__construct(k);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Key_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic k) {
+ Key_obj *__this = (Key_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Key_obj), true, "sys.ssl.Key"));
+ *(void **)__this = Key_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_360df8ce648879c1_34_new)
+HXDLIN( 34) ( ( ::sys::ssl::Key)(__this) )->_hx___k = k;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Key_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ static void __init__();
+
+ ::String __ToString() const { return HX_("Key",7f,41,39,00); }
+
+ static void __boot();
+ ::Dynamic _hx___k;
+};
+
+} // end namespace sys
+} // end namespace ssl
+
+#endif /* INCLUDED_sys_ssl_Key */
diff --git a/Sources/c_snikket/iinclude/include/sys/ssl/Socket.h b/Sources/c_snikket/iinclude/include/sys/ssl/Socket.h
new file mode 100644
index 0000000..97bacfe
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/ssl/Socket.h
@@ -0,0 +1,88 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_ssl_Socket
+#define INCLUDED_sys_ssl_Socket
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_sys_net_Socket
+#include <sys/net/Socket.h>
+#endif
+HX_DECLARE_CLASS2(sys,net,Host)
+HX_DECLARE_CLASS2(sys,net,Socket)
+HX_DECLARE_CLASS2(sys,ssl,Certificate)
+HX_DECLARE_CLASS2(sys,ssl,Key)
+HX_DECLARE_CLASS2(sys,ssl,Socket)
+
+namespace sys{
+namespace ssl{
+
+
+class HXCPP_CLASS_ATTRIBUTES Socket_obj : public ::sys::net::Socket_obj
+{
+ public:
+ typedef ::sys::net::Socket_obj super;
+ typedef Socket_obj OBJ_;
+ Socket_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7a492a0e };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.ssl.Socket")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.ssl.Socket"); }
+ static ::hx::ObjectPtr< Socket_obj > __new();
+ static ::hx::ObjectPtr< Socket_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Socket_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ static void __init__();
+
+ ::String __ToString() const { return HX_("Socket",d3,ff,da,5a); }
+
+ static void __boot();
+ static ::Dynamic DEFAULT_VERIFY_CERT;
+ static ::sys::ssl::Certificate DEFAULT_CA;
+ ::Dynamic conf;
+ ::Dynamic ssl;
+ ::Dynamic verifyCert;
+ ::sys::ssl::Certificate caCert;
+ ::String hostname;
+ ::sys::ssl::Certificate ownCert;
+ ::sys::ssl::Key ownKey;
+ ::Array< ::Dynamic> altSNIContexts;
+ ::Dynamic sniCallback;
+ bool handshakeDone;
+ void init();
+
+ void connect( ::sys::net::Host host,int port);
+
+ void handshake();
+ ::Dynamic handshake_dyn();
+
+ void close();
+
+ ::Dynamic buildSSLConfig(bool server);
+ ::Dynamic buildSSLConfig_dyn();
+
+};
+
+} // end namespace sys
+} // end namespace ssl
+
+#endif /* INCLUDED_sys_ssl_Socket */
diff --git a/Sources/c_snikket/iinclude/include/sys/ssl/_Socket/SocketInput.h b/Sources/c_snikket/iinclude/include/sys/ssl/_Socket/SocketInput.h
new file mode 100644
index 0000000..7fa83ba
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/ssl/_Socket/SocketInput.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_ssl__Socket_SocketInput
+#define INCLUDED_sys_ssl__Socket_SocketInput
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_io_Input
+#include <haxe/io/Input.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,Input)
+HX_DECLARE_CLASS2(sys,net,Socket)
+HX_DECLARE_CLASS2(sys,ssl,Socket)
+HX_DECLARE_CLASS3(sys,ssl,_Socket,SocketInput)
+
+namespace sys{
+namespace ssl{
+namespace _Socket{
+
+
+class HXCPP_CLASS_ATTRIBUTES SocketInput_obj : public ::haxe::io::Input_obj
+{
+ public:
+ typedef ::haxe::io::Input_obj super;
+ typedef SocketInput_obj OBJ_;
+ SocketInput_obj();
+
+ public:
+ enum { _hx_ClassId = 0x5d27522c };
+
+ void __construct( ::sys::ssl::Socket s);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.ssl._Socket.SocketInput")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.ssl._Socket.SocketInput"); }
+ static ::hx::ObjectPtr< SocketInput_obj > __new( ::sys::ssl::Socket s);
+ static ::hx::ObjectPtr< SocketInput_obj > __alloc(::hx::Ctx *_hx_ctx, ::sys::ssl::Socket s);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SocketInput_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("SocketInput",37,f7,80,be); }
+
+ ::sys::ssl::Socket __s;
+ int readByte();
+
+ int readBytes( ::haxe::io::Bytes buf,int pos,int len);
+
+ void close();
+
+};
+
+} // end namespace sys
+} // end namespace ssl
+} // end namespace _Socket
+
+#endif /* INCLUDED_sys_ssl__Socket_SocketInput */
diff --git a/Sources/c_snikket/iinclude/include/sys/ssl/_Socket/SocketOutput.h b/Sources/c_snikket/iinclude/include/sys/ssl/_Socket/SocketOutput.h
new file mode 100644
index 0000000..6282196
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/ssl/_Socket/SocketOutput.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_ssl__Socket_SocketOutput
+#define INCLUDED_sys_ssl__Socket_SocketOutput
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_io_Output
+#include <haxe/io/Output.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,Output)
+HX_DECLARE_CLASS2(sys,net,Socket)
+HX_DECLARE_CLASS2(sys,ssl,Socket)
+HX_DECLARE_CLASS3(sys,ssl,_Socket,SocketOutput)
+
+namespace sys{
+namespace ssl{
+namespace _Socket{
+
+
+class HXCPP_CLASS_ATTRIBUTES SocketOutput_obj : public ::haxe::io::Output_obj
+{
+ public:
+ typedef ::haxe::io::Output_obj super;
+ typedef SocketOutput_obj OBJ_;
+ SocketOutput_obj();
+
+ public:
+ enum { _hx_ClassId = 0x52cf5067 };
+
+ void __construct( ::sys::ssl::Socket s);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.ssl._Socket.SocketOutput")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.ssl._Socket.SocketOutput"); }
+ static ::hx::ObjectPtr< SocketOutput_obj > __new( ::sys::ssl::Socket s);
+ static ::hx::ObjectPtr< SocketOutput_obj > __alloc(::hx::Ctx *_hx_ctx, ::sys::ssl::Socket s);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SocketOutput_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("SocketOutput",34,a3,ea,62); }
+
+ ::sys::ssl::Socket __s;
+ void writeByte(int c);
+
+ int writeBytes( ::haxe::io::Bytes buf,int pos,int len);
+
+ void close();
+
+};
+
+} // end namespace sys
+} // end namespace ssl
+} // end namespace _Socket
+
+#endif /* INCLUDED_sys_ssl__Socket_SocketOutput */
diff --git a/Sources/c_snikket/iinclude/include/sys/thread/EventLoop.h b/Sources/c_snikket/iinclude/include/sys/thread/EventLoop.h
new file mode 100644
index 0000000..e5d0fee
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/thread/EventLoop.h
@@ -0,0 +1,80 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_thread_EventLoop
+#define INCLUDED_sys_thread_EventLoop
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(sys,thread,EventLoop)
+HX_DECLARE_CLASS2(sys,thread,Lock)
+HX_DECLARE_CLASS2(sys,thread,Mutex)
+HX_DECLARE_CLASS3(sys,thread,_EventLoop,RegularEvent)
+
+namespace sys{
+namespace thread{
+
+
+class HXCPP_CLASS_ATTRIBUTES EventLoop_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef EventLoop_obj OBJ_;
+ EventLoop_obj();
+
+ public:
+ enum { _hx_ClassId = 0x6a581147 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.thread.EventLoop")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.thread.EventLoop"); }
+ static ::hx::ObjectPtr< EventLoop_obj > __new();
+ static ::hx::ObjectPtr< EventLoop_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~EventLoop_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("EventLoop",7e,8f,97,98); }
+
+ static bool CREATED;
+ ::sys::thread::Mutex mutex;
+ ::Array< ::Dynamic> oneTimeEvents;
+ int oneTimeEventsIdx;
+ ::sys::thread::Lock waitLock;
+ int promisedEventsCount;
+ ::sys::thread::_EventLoop::RegularEvent regularEvents;
+ bool isMainThread;
+ ::sys::thread::_EventLoop::RegularEvent repeat( ::Dynamic event,int intervalMs);
+ ::Dynamic repeat_dyn();
+
+ void cancel( ::sys::thread::_EventLoop::RegularEvent eventHandler);
+ ::Dynamic cancel_dyn();
+
+ void run( ::Dynamic event);
+ ::Dynamic run_dyn();
+
+ bool wait( ::Dynamic timeout);
+ ::Dynamic wait_dyn();
+
+ void loop();
+ ::Dynamic loop_dyn();
+
+};
+
+} // end namespace sys
+} // end namespace thread
+
+#endif /* INCLUDED_sys_thread_EventLoop */
diff --git a/Sources/c_snikket/iinclude/include/sys/thread/Lock.h b/Sources/c_snikket/iinclude/include/sys/thread/Lock.h
new file mode 100644
index 0000000..b08cb6e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/thread/Lock.h
@@ -0,0 +1,76 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_thread_Lock
+#define INCLUDED_sys_thread_Lock
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_c256ff93ff467723_30_new)
+HX_DECLARE_CLASS2(sys,thread,Lock)
+
+namespace sys{
+namespace thread{
+
+
+class HXCPP_CLASS_ATTRIBUTES Lock_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Lock_obj OBJ_;
+ Lock_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7fa5e9e6 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.thread.Lock")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.thread.Lock"); }
+
+ inline static ::hx::ObjectPtr< Lock_obj > __new() {
+ ::hx::ObjectPtr< Lock_obj > __this = new Lock_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Lock_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Lock_obj *__this = (Lock_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Lock_obj), true, "sys.thread.Lock"));
+ *(void **)__this = Lock_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_c256ff93ff467723_30_new)
+HXDLIN( 30) ( ( ::sys::thread::Lock)(__this) )->l = ::__hxcpp_lock_create();
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Lock_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Lock",0b,c8,90,32); }
+
+ ::Dynamic l;
+ bool wait( ::Dynamic timeout);
+ ::Dynamic wait_dyn();
+
+ void release();
+ ::Dynamic release_dyn();
+
+};
+
+} // end namespace sys
+} // end namespace thread
+
+#endif /* INCLUDED_sys_thread_Lock */
diff --git a/Sources/c_snikket/iinclude/include/sys/thread/Mutex.h b/Sources/c_snikket/iinclude/include/sys/thread/Mutex.h
new file mode 100644
index 0000000..7dcf304
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/thread/Mutex.h
@@ -0,0 +1,76 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_thread_Mutex
+#define INCLUDED_sys_thread_Mutex
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_2ef35e640612cac3_30_new)
+HX_DECLARE_CLASS2(sys,thread,Mutex)
+
+namespace sys{
+namespace thread{
+
+
+class HXCPP_CLASS_ATTRIBUTES Mutex_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Mutex_obj OBJ_;
+ Mutex_obj();
+
+ public:
+ enum { _hx_ClassId = 0x5474b30c };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.thread.Mutex")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.thread.Mutex"); }
+
+ inline static ::hx::ObjectPtr< Mutex_obj > __new() {
+ ::hx::ObjectPtr< Mutex_obj > __this = new Mutex_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Mutex_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Mutex_obj *__this = (Mutex_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Mutex_obj), true, "sys.thread.Mutex"));
+ *(void **)__this = Mutex_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_2ef35e640612cac3_30_new)
+HXDLIN( 30) ( ( ::sys::thread::Mutex)(__this) )->m = ::__hxcpp_mutex_create();
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Mutex_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Mutex",5f,ff,88,a3); }
+
+ ::Dynamic m;
+ void acquire();
+ ::Dynamic acquire_dyn();
+
+ void release();
+ ::Dynamic release_dyn();
+
+};
+
+} // end namespace sys
+} // end namespace thread
+
+#endif /* INCLUDED_sys_thread_Mutex */
diff --git a/Sources/c_snikket/iinclude/include/sys/thread/NoEventLoopException.h b/Sources/c_snikket/iinclude/include/sys/thread/NoEventLoopException.h
new file mode 100644
index 0000000..836f0ff
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/thread/NoEventLoopException.h
@@ -0,0 +1,70 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_thread_NoEventLoopException
+#define INCLUDED_sys_thread_NoEventLoopException
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_Exception
+#include <haxe/Exception.h>
+#endif
+HX_DECLARE_STACK_FRAME(_hx_pos_c0f6a7d563b0a42e_7_new)
+HX_DECLARE_CLASS1(haxe,Exception)
+HX_DECLARE_CLASS2(sys,thread,NoEventLoopException)
+
+namespace sys{
+namespace thread{
+
+
+class HXCPP_CLASS_ATTRIBUTES NoEventLoopException_obj : public ::haxe::Exception_obj
+{
+ public:
+ typedef ::haxe::Exception_obj super;
+ typedef NoEventLoopException_obj OBJ_;
+ NoEventLoopException_obj();
+
+ public:
+ enum { _hx_ClassId = 0x00a9e885 };
+
+ void __construct(::String __o_msg, ::haxe::Exception previous);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.thread.NoEventLoopException")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.thread.NoEventLoopException"); }
+
+ inline static ::hx::ObjectPtr< NoEventLoopException_obj > __new(::String __o_msg, ::haxe::Exception previous) {
+ ::hx::ObjectPtr< NoEventLoopException_obj > __this = new NoEventLoopException_obj();
+ __this->__construct(__o_msg,previous);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< NoEventLoopException_obj > __alloc(::hx::Ctx *_hx_ctx,::String __o_msg, ::haxe::Exception previous) {
+ NoEventLoopException_obj *__this = (NoEventLoopException_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(NoEventLoopException_obj), true, "sys.thread.NoEventLoopException"));
+ *(void **)__this = NoEventLoopException_obj::_hx_vtable;
+{
+ ::String msg = __o_msg;
+ if (::hx::IsNull(__o_msg)) msg = HX_("Event loop is not available. Refer to sys.thread.Thread.runWithEventLoop.",89,e6,4c,1c);
+ HX_STACKFRAME(&_hx_pos_c0f6a7d563b0a42e_7_new)
+HXDLIN( 7) __this->super::__construct(msg,previous,null());
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~NoEventLoopException_obj();
+
+ HX_DO_RTTI_ALL;
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("NoEventLoopException",92,71,e8,a8); }
+
+};
+
+} // end namespace sys
+} // end namespace thread
+
+#endif /* INCLUDED_sys_thread_NoEventLoopException */
diff --git a/Sources/c_snikket/iinclude/include/sys/thread/_EventLoop/RegularEvent.h b/Sources/c_snikket/iinclude/include/sys/thread/_EventLoop/RegularEvent.h
new file mode 100644
index 0000000..e91ddab
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/thread/_EventLoop/RegularEvent.h
@@ -0,0 +1,81 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_thread__EventLoop_RegularEvent
+#define INCLUDED_sys_thread__EventLoop_RegularEvent
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_692c76051dac6459_278_new)
+HX_DECLARE_CLASS3(sys,thread,_EventLoop,RegularEvent)
+
+namespace sys{
+namespace thread{
+namespace _EventLoop{
+
+
+class HXCPP_CLASS_ATTRIBUTES RegularEvent_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef RegularEvent_obj OBJ_;
+ RegularEvent_obj();
+
+ public:
+ enum { _hx_ClassId = 0x13f58728 };
+
+ void __construct( ::Dynamic run,Float nextRunTime,Float interval);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.thread._EventLoop.RegularEvent")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.thread._EventLoop.RegularEvent"); }
+
+ inline static ::hx::ObjectPtr< RegularEvent_obj > __new( ::Dynamic run,Float nextRunTime,Float interval) {
+ ::hx::ObjectPtr< RegularEvent_obj > __this = new RegularEvent_obj();
+ __this->__construct(run,nextRunTime,interval);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< RegularEvent_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic run,Float nextRunTime,Float interval) {
+ RegularEvent_obj *__this = (RegularEvent_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(RegularEvent_obj), true, "sys.thread._EventLoop.RegularEvent"));
+ *(void **)__this = RegularEvent_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_692c76051dac6459_278_new)
+HXLINE( 284) ( ( ::sys::thread::_EventLoop::RegularEvent)(__this) )->cancelled = false;
+HXLINE( 287) ( ( ::sys::thread::_EventLoop::RegularEvent)(__this) )->run = run;
+HXLINE( 288) ( ( ::sys::thread::_EventLoop::RegularEvent)(__this) )->nextRunTime = nextRunTime;
+HXLINE( 289) ( ( ::sys::thread::_EventLoop::RegularEvent)(__this) )->interval = interval;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~RegularEvent_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("RegularEvent",3e,24,e8,2d); }
+
+ Float nextRunTime;
+ Float interval;
+ ::Dynamic run;
+ Dynamic run_dyn() { return run;}
+ ::sys::thread::_EventLoop::RegularEvent next;
+ ::sys::thread::_EventLoop::RegularEvent previous;
+ bool cancelled;
+};
+
+} // end namespace sys
+} // end namespace thread
+} // end namespace _EventLoop
+
+#endif /* INCLUDED_sys_thread__EventLoop_RegularEvent */
diff --git a/Sources/c_snikket/iinclude/include/sys/thread/_Thread/HaxeThread.h b/Sources/c_snikket/iinclude/include/sys/thread/_Thread/HaxeThread.h
new file mode 100644
index 0000000..80f44f1
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/thread/_Thread/HaxeThread.h
@@ -0,0 +1,76 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_thread__Thread_HaxeThread
+#define INCLUDED_sys_thread__Thread_HaxeThread
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(sys,thread,EventLoop)
+HX_DECLARE_CLASS2(sys,thread,Mutex)
+HX_DECLARE_CLASS3(sys,thread,_Thread,HaxeThread)
+
+namespace sys{
+namespace thread{
+namespace _Thread{
+
+
+class HXCPP_CLASS_ATTRIBUTES HaxeThread_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef HaxeThread_obj OBJ_;
+ HaxeThread_obj();
+
+ public:
+ enum { _hx_ClassId = 0x72cf0b82 };
+
+ void __construct( ::Dynamic h);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.thread._Thread.HaxeThread")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.thread._Thread.HaxeThread"); }
+ static ::hx::ObjectPtr< HaxeThread_obj > __new( ::Dynamic h);
+ static ::hx::ObjectPtr< HaxeThread_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic h);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~HaxeThread_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ static void __init__();
+
+ ::String __ToString() const { return HX_("HaxeThread",b0,c7,55,fd); }
+
+ static void __boot();
+ static ::Array< ::Dynamic> threads;
+ static ::sys::thread::Mutex threadsMutex;
+ static ::Dynamic mainThreadHandle;
+ static ::sys::thread::_Thread::HaxeThread mainThread;
+ static ::sys::thread::_Thread::HaxeThread current();
+ static ::Dynamic current_dyn();
+
+ static ::sys::thread::_Thread::HaxeThread create( ::Dynamic job,bool withEventLoop);
+ static ::Dynamic create_dyn();
+
+ static void dropThread( ::Dynamic item,int probableIndex);
+ static ::Dynamic dropThread_dyn();
+
+ ::sys::thread::EventLoop events;
+ ::Dynamic handle;
+};
+
+} // end namespace sys
+} // end namespace thread
+} // end namespace _Thread
+
+#endif /* INCLUDED_sys_thread__Thread_HaxeThread */
diff --git a/Sources/c_snikket/iinclude/include/sys/thread/_Thread/Thread_Impl_.h b/Sources/c_snikket/iinclude/include/sys/thread/_Thread/Thread_Impl_.h
new file mode 100644
index 0000000..1d125c1
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/sys/thread/_Thread/Thread_Impl_.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_thread__Thread_Thread_Impl_
+#define INCLUDED_sys_thread__Thread_Thread_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(sys,thread,EventLoop)
+HX_DECLARE_CLASS3(sys,thread,_Thread,HaxeThread)
+HX_DECLARE_CLASS3(sys,thread,_Thread,Thread_Impl_)
+
+namespace sys{
+namespace thread{
+namespace _Thread{
+
+
+class HXCPP_CLASS_ATTRIBUTES Thread_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Thread_Impl__obj OBJ_;
+ Thread_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x3097b824 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="sys.thread._Thread.Thread_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"sys.thread._Thread.Thread_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Thread_Impl__obj > __new() {
+ ::hx::ObjectPtr< Thread_Impl__obj > __this = new Thread_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Thread_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Thread_Impl__obj *__this = (Thread_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Thread_Impl__obj), false, "sys.thread._Thread.Thread_Impl_"));
+ *(void **)__this = Thread_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Thread_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Thread_Impl_",0a,37,9c,fe); }
+
+ static ::sys::thread::EventLoop get_events( ::sys::thread::_Thread::HaxeThread this1);
+ static ::Dynamic get_events_dyn();
+
+ static void processEvents();
+ static ::Dynamic processEvents_dyn();
+
+};
+
+} // end namespace sys
+} // end namespace thread
+} // end namespace _Thread
+
+#endif /* INCLUDED_sys_thread__Thread_Thread_Impl_ */
diff --git a/Sources/c_snikket/iinclude/include/thenshim/PromiseFactory.h b/Sources/c_snikket/iinclude/include/thenshim/PromiseFactory.h
new file mode 100644
index 0000000..1fd53c5
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/thenshim/PromiseFactory.h
@@ -0,0 +1,36 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_thenshim_PromiseFactory
+#define INCLUDED_thenshim_PromiseFactory
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(thenshim,PromiseFactory)
+HX_DECLARE_CLASS1(thenshim,Thenable)
+
+namespace thenshim{
+
+
+class HXCPP_CLASS_ATTRIBUTES PromiseFactory_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ ::Dynamic (::hx::Object :: *_hx_make)( ::Dynamic executor);
+ static inline ::Dynamic make( ::Dynamic _hx_, ::Dynamic executor) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::thenshim::PromiseFactory_obj *>(_hx_.mPtr->_hx_getInterface(0x93a35865)))->_hx_make)(executor);
+ }
+ ::Dynamic (::hx::Object :: *_hx_asResolved)( ::Dynamic object);
+ static inline ::Dynamic asResolved( ::Dynamic _hx_, ::Dynamic object) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::thenshim::PromiseFactory_obj *>(_hx_.mPtr->_hx_getInterface(0x93a35865)))->_hx_asResolved)(object);
+ }
+ ::Dynamic (::hx::Object :: *_hx_asRejected)( ::Dynamic reason);
+ static inline ::Dynamic asRejected( ::Dynamic _hx_, ::Dynamic reason) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::thenshim::PromiseFactory_obj *>(_hx_.mPtr->_hx_getInterface(0x93a35865)))->_hx_asRejected)(reason);
+ }
+};
+
+} // end namespace thenshim
+
+#endif /* INCLUDED_thenshim_PromiseFactory */
diff --git a/Sources/c_snikket/iinclude/include/thenshim/PromiseTools.h b/Sources/c_snikket/iinclude/include/thenshim/PromiseTools.h
new file mode 100644
index 0000000..f854535
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/thenshim/PromiseTools.h
@@ -0,0 +1,64 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_thenshim_PromiseTools
+#define INCLUDED_thenshim_PromiseTools
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(thenshim,PromiseTools)
+HX_DECLARE_CLASS1(thenshim,Thenable)
+
+namespace thenshim{
+
+
+class HXCPP_CLASS_ATTRIBUTES PromiseTools_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef PromiseTools_obj OBJ_;
+ PromiseTools_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1873701a };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="thenshim.PromiseTools")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"thenshim.PromiseTools"); }
+
+ inline static ::hx::ObjectPtr< PromiseTools_obj > __new() {
+ ::hx::ObjectPtr< PromiseTools_obj > __this = new PromiseTools_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< PromiseTools_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ PromiseTools_obj *__this = (PromiseTools_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(PromiseTools_obj), false, "thenshim.PromiseTools"));
+ *(void **)__this = PromiseTools_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~PromiseTools_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("PromiseTools",a0,4e,2e,4d); }
+
+ static ::Dynamic all( ::Dynamic promises);
+ static ::Dynamic all_dyn();
+
+ static ::Dynamic catch_(::Dynamic promise, ::Dynamic onRejected);
+ static ::Dynamic catch__dyn();
+
+};
+
+} // end namespace thenshim
+
+#endif /* INCLUDED_thenshim_PromiseTools */
diff --git a/Sources/c_snikket/iinclude/include/thenshim/Thenable.h b/Sources/c_snikket/iinclude/include/thenshim/Thenable.h
new file mode 100644
index 0000000..66c521e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/thenshim/Thenable.h
@@ -0,0 +1,27 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_thenshim_Thenable
+#define INCLUDED_thenshim_Thenable
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(thenshim,Thenable)
+
+namespace thenshim{
+
+
+class HXCPP_CLASS_ATTRIBUTES Thenable_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ ::Dynamic (::hx::Object :: *_hx_then)( ::Dynamic onFulfilled, ::Dynamic onRejected);
+ static inline ::Dynamic then( ::Dynamic _hx_, ::Dynamic onFulfilled, ::Dynamic onRejected) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::thenshim::Thenable_obj *>(_hx_.mPtr->_hx_getInterface(0xc019ce6d)))->_hx_then)(onFulfilled,onRejected);
+ }
+};
+
+} // end namespace thenshim
+
+#endif /* INCLUDED_thenshim_Thenable */
diff --git a/Sources/c_snikket/iinclude/include/thenshim/_Promise/Promise_Impl_.h b/Sources/c_snikket/iinclude/include/thenshim/_Promise/Promise_Impl_.h
new file mode 100644
index 0000000..266087a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/thenshim/_Promise/Promise_Impl_.h
@@ -0,0 +1,75 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_thenshim__Promise_Promise_Impl_
+#define INCLUDED_thenshim__Promise_Promise_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(thenshim,PromiseFactory)
+HX_DECLARE_CLASS1(thenshim,Thenable)
+HX_DECLARE_CLASS2(thenshim,_Promise,Promise_Impl_)
+
+namespace thenshim{
+namespace _Promise{
+
+
+class HXCPP_CLASS_ATTRIBUTES Promise_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Promise_Impl__obj OBJ_;
+ Promise_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x048c0501 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="thenshim._Promise.Promise_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"thenshim._Promise.Promise_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Promise_Impl__obj > __new() {
+ ::hx::ObjectPtr< Promise_Impl__obj > __this = new Promise_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Promise_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Promise_Impl__obj *__this = (Promise_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Promise_Impl__obj), false, "thenshim._Promise.Promise_Impl_"));
+ *(void **)__this = Promise_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Promise_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Promise_Impl_",5b,00,ba,be); }
+
+ static void __boot();
+ static ::Dynamic factory;
+ static ::Dynamic _new( ::Dynamic executor);
+ static ::Dynamic _new_dyn();
+
+ static ::Dynamic resolve( ::Dynamic object);
+ static ::Dynamic resolve_dyn();
+
+ static ::Dynamic reject( ::Dynamic reason);
+ static ::Dynamic reject_dyn();
+
+ static ::Dynamic then(::Dynamic this1, ::Dynamic onFulfilled, ::Dynamic onRejected);
+ static ::Dynamic then_dyn();
+
+};
+
+} // end namespace thenshim
+} // end namespace _Promise
+
+#endif /* INCLUDED_thenshim__Promise_Promise_Impl_ */
diff --git a/Sources/c_snikket/iinclude/include/thenshim/fallback/FallbackPromise.h b/Sources/c_snikket/iinclude/include/thenshim/fallback/FallbackPromise.h
new file mode 100644
index 0000000..21e2936
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/thenshim/fallback/FallbackPromise.h
@@ -0,0 +1,77 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_thenshim_fallback_FallbackPromise
+#define INCLUDED_thenshim_fallback_FallbackPromise
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_thenshim_Thenable
+#include <thenshim/Thenable.h>
+#endif
+HX_DECLARE_CLASS1(thenshim,Thenable)
+HX_DECLARE_CLASS2(thenshim,fallback,FallbackPromise)
+HX_DECLARE_CLASS2(thenshim,fallback,HandlerSession)
+HX_DECLARE_CLASS2(thenshim,fallback,PromiseState)
+HX_DECLARE_CLASS2(thenshim,fallback,TaskScheduler)
+
+namespace thenshim{
+namespace fallback{
+
+
+class HXCPP_CLASS_ATTRIBUTES FallbackPromise_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef FallbackPromise_obj OBJ_;
+ FallbackPromise_obj();
+
+ public:
+ enum { _hx_ClassId = 0x6da4d981 };
+
+ void __construct( ::thenshim::fallback::TaskScheduler scheduler);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="thenshim.fallback.FallbackPromise")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"thenshim.fallback.FallbackPromise"); }
+ static ::hx::ObjectPtr< FallbackPromise_obj > __new( ::thenshim::fallback::TaskScheduler scheduler);
+ static ::hx::ObjectPtr< FallbackPromise_obj > __alloc(::hx::Ctx *_hx_ctx, ::thenshim::fallback::TaskScheduler scheduler);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~FallbackPromise_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("FallbackPromise",79,35,7a,1c); }
+
+ ::thenshim::fallback::TaskScheduler scheduler;
+ ::thenshim::fallback::PromiseState state;
+ ::Dynamic value;
+ ::Dynamic reason;
+ ::Array< ::Dynamic> sessions;
+ ::Dynamic then( ::Dynamic onFulfilled, ::Dynamic onRejected);
+ ::Dynamic then_dyn();
+
+ ::thenshim::fallback::FallbackPromise thenImpl( ::Dynamic onFulfilled, ::Dynamic onRejected);
+ ::Dynamic thenImpl_dyn();
+
+ void resolve( ::Dynamic value);
+ ::Dynamic resolve_dyn();
+
+ void reject( ::Dynamic reason);
+ ::Dynamic reject_dyn();
+
+};
+
+} // end namespace thenshim
+} // end namespace fallback
+
+#endif /* INCLUDED_thenshim_fallback_FallbackPromise */
diff --git a/Sources/c_snikket/iinclude/include/thenshim/fallback/FallbackPromiseFactory.h b/Sources/c_snikket/iinclude/include/thenshim/fallback/FallbackPromiseFactory.h
new file mode 100644
index 0000000..ecfa490
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/thenshim/fallback/FallbackPromiseFactory.h
@@ -0,0 +1,75 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_thenshim_fallback_FallbackPromiseFactory
+#define INCLUDED_thenshim_fallback_FallbackPromiseFactory
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_thenshim_PromiseFactory
+#include <thenshim/PromiseFactory.h>
+#endif
+HX_DECLARE_CLASS1(thenshim,PromiseFactory)
+HX_DECLARE_CLASS1(thenshim,Thenable)
+HX_DECLARE_CLASS2(thenshim,fallback,FallbackPromiseFactory)
+HX_DECLARE_CLASS2(thenshim,fallback,TaskScheduler)
+
+namespace thenshim{
+namespace fallback{
+
+
+class HXCPP_CLASS_ATTRIBUTES FallbackPromiseFactory_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef FallbackPromiseFactory_obj OBJ_;
+ FallbackPromiseFactory_obj();
+
+ public:
+ enum { _hx_ClassId = 0x592d0d49 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="thenshim.fallback.FallbackPromiseFactory")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"thenshim.fallback.FallbackPromiseFactory"); }
+ static ::hx::ObjectPtr< FallbackPromiseFactory_obj > __new();
+ static ::hx::ObjectPtr< FallbackPromiseFactory_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~FallbackPromiseFactory_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("FallbackPromiseFactory",51,a0,67,b6); }
+
+ ::thenshim::fallback::TaskScheduler scheduler;
+ ::Dynamic make( ::Dynamic executor);
+ ::Dynamic make_dyn();
+
+ ::Dynamic asResolved( ::Dynamic object);
+ ::Dynamic asResolved_dyn();
+
+ ::Dynamic asResolvedThenable(::Dynamic thenable);
+ ::Dynamic asResolvedThenable_dyn();
+
+ ::Dynamic asResolvedThenProperty( ::Dynamic object);
+ ::Dynamic asResolvedThenProperty_dyn();
+
+ ::Dynamic asRejected( ::Dynamic reason);
+ ::Dynamic asRejected_dyn();
+
+};
+
+} // end namespace thenshim
+} // end namespace fallback
+
+#endif /* INCLUDED_thenshim_fallback_FallbackPromiseFactory */
diff --git a/Sources/c_snikket/iinclude/include/thenshim/fallback/HandlerSession.h b/Sources/c_snikket/iinclude/include/thenshim/fallback/HandlerSession.h
new file mode 100644
index 0000000..c9dc287
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/thenshim/fallback/HandlerSession.h
@@ -0,0 +1,84 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_thenshim_fallback_HandlerSession
+#define INCLUDED_thenshim_fallback_HandlerSession
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(thenshim,Thenable)
+HX_DECLARE_CLASS2(thenshim,fallback,FallbackPromise)
+HX_DECLARE_CLASS2(thenshim,fallback,HandlerSession)
+HX_DECLARE_CLASS2(thenshim,fallback,TaskScheduler)
+
+namespace thenshim{
+namespace fallback{
+
+
+class HXCPP_CLASS_ATTRIBUTES HandlerSession_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef HandlerSession_obj OBJ_;
+ HandlerSession_obj();
+
+ public:
+ enum { _hx_ClassId = 0x30baea8c };
+
+ void __construct( ::thenshim::fallback::TaskScheduler scheduler, ::Dynamic fulfilledCallback, ::Dynamic rejectedCallback);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="thenshim.fallback.HandlerSession")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"thenshim.fallback.HandlerSession"); }
+ static ::hx::ObjectPtr< HandlerSession_obj > __new( ::thenshim::fallback::TaskScheduler scheduler, ::Dynamic fulfilledCallback, ::Dynamic rejectedCallback);
+ static ::hx::ObjectPtr< HandlerSession_obj > __alloc(::hx::Ctx *_hx_ctx, ::thenshim::fallback::TaskScheduler scheduler, ::Dynamic fulfilledCallback, ::Dynamic rejectedCallback);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~HandlerSession_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("HandlerSession",cc,10,db,f7); }
+
+ static void resolvePromise( ::thenshim::fallback::FallbackPromise promise, ::Dynamic value);
+ static ::Dynamic resolvePromise_dyn();
+
+ static bool rejectIfSame( ::thenshim::fallback::FallbackPromise promise, ::Dynamic value);
+ static ::Dynamic rejectIfSame_dyn();
+
+ static void resolvePromiseThenable( ::thenshim::fallback::FallbackPromise promise,::Dynamic thenable);
+ static ::Dynamic resolvePromiseThenable_dyn();
+
+ static void resolvePromiseObject( ::thenshim::fallback::FallbackPromise promise, ::Dynamic object);
+ static ::Dynamic resolvePromiseObject_dyn();
+
+ ::thenshim::fallback::FallbackPromise promise;
+ ::thenshim::fallback::TaskScheduler scheduler;
+ ::Dynamic fulfilledCallback;
+ ::Dynamic rejectedCallback;
+ void resolve( ::Dynamic value);
+ ::Dynamic resolve_dyn();
+
+ void resolveImpl( ::Dynamic value);
+ ::Dynamic resolveImpl_dyn();
+
+ void reject( ::Dynamic reason);
+ ::Dynamic reject_dyn();
+
+ void rejectImpl( ::Dynamic reason);
+ ::Dynamic rejectImpl_dyn();
+
+};
+
+} // end namespace thenshim
+} // end namespace fallback
+
+#endif /* INCLUDED_thenshim_fallback_HandlerSession */
diff --git a/Sources/c_snikket/iinclude/include/thenshim/fallback/PromiseState.h b/Sources/c_snikket/iinclude/include/thenshim/fallback/PromiseState.h
new file mode 100644
index 0000000..7e84191
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/thenshim/fallback/PromiseState.h
@@ -0,0 +1,39 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_thenshim_fallback_PromiseState
+#define INCLUDED_thenshim_fallback_PromiseState
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(thenshim,fallback,PromiseState)
+namespace thenshim{
+namespace fallback{
+
+
+class PromiseState_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef PromiseState_obj OBJ_;
+
+ public:
+ PromiseState_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("thenshim.fallback.PromiseState",0a,45,f3,26); }
+ ::String __ToString() const { return HX_("PromiseState.",d8,10,c1,ac) + _hx_tag; }
+
+ static ::thenshim::fallback::PromiseState Fulfilled;
+ static inline ::thenshim::fallback::PromiseState Fulfilled_dyn() { return Fulfilled; }
+ static ::thenshim::fallback::PromiseState Pending;
+ static inline ::thenshim::fallback::PromiseState Pending_dyn() { return Pending; }
+ static ::thenshim::fallback::PromiseState Rejected;
+ static inline ::thenshim::fallback::PromiseState Rejected_dyn() { return Rejected; }
+};
+
+} // end namespace thenshim
+} // end namespace fallback
+
+#endif /* INCLUDED_thenshim_fallback_PromiseState */
diff --git a/Sources/c_snikket/iinclude/include/thenshim/fallback/TaskScheduler.h b/Sources/c_snikket/iinclude/include/thenshim/fallback/TaskScheduler.h
new file mode 100644
index 0000000..ba47ed8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/thenshim/fallback/TaskScheduler.h
@@ -0,0 +1,72 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_thenshim_fallback_TaskScheduler
+#define INCLUDED_thenshim_fallback_TaskScheduler
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_8fc69505e32be3f2_11_new)
+HX_DECLARE_CLASS2(thenshim,fallback,TaskScheduler)
+
+namespace thenshim{
+namespace fallback{
+
+
+class HXCPP_CLASS_ATTRIBUTES TaskScheduler_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef TaskScheduler_obj OBJ_;
+ TaskScheduler_obj();
+
+ public:
+ enum { _hx_ClassId = 0x23747a3a };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="thenshim.fallback.TaskScheduler")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"thenshim.fallback.TaskScheduler"); }
+
+ inline static ::hx::ObjectPtr< TaskScheduler_obj > __new() {
+ ::hx::ObjectPtr< TaskScheduler_obj > __this = new TaskScheduler_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< TaskScheduler_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ TaskScheduler_obj *__this = (TaskScheduler_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(TaskScheduler_obj), true, "thenshim.fallback.TaskScheduler"));
+ *(void **)__this = TaskScheduler_obj::_hx_vtable;
+ thenshim::fallback::TaskScheduler_obj::__alloc_dynamic_functions(_hx_ctx,__this);
+{
+ HX_STACKFRAME(&_hx_pos_8fc69505e32be3f2_11_new)
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ static void __alloc_dynamic_functions(::hx::Ctx *_hx_alloc,TaskScheduler_obj *_hx_obj);
+ //~TaskScheduler_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("TaskScheduler",16,22,01,bb); }
+
+ ::Dynamic addNext;
+ inline ::Dynamic &addNext_dyn() {return addNext; }
+
+};
+
+} // end namespace thenshim
+} // end namespace fallback
+
+#endif /* INCLUDED_thenshim_fallback_TaskScheduler */
diff --git a/Sources/c_snikket/iinclude/include/tink/_Chunk/Chunk_Impl_.h b/Sources/c_snikket/iinclude/include/tink/_Chunk/Chunk_Impl_.h
new file mode 100644
index 0000000..567282c
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/_Chunk/Chunk_Impl_.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink__Chunk_Chunk_Impl_
+#define INCLUDED_tink__Chunk_Chunk_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,_Chunk,Chunk_Impl_)
+HX_DECLARE_CLASS2(tink,chunk,ChunkObject)
+
+namespace tink{
+namespace _Chunk{
+
+
+class HXCPP_CLASS_ATTRIBUTES Chunk_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Chunk_Impl__obj OBJ_;
+ Chunk_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x3bb70ded };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink._Chunk.Chunk_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink._Chunk.Chunk_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Chunk_Impl__obj > __new() {
+ ::hx::ObjectPtr< Chunk_Impl__obj > __this = new Chunk_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Chunk_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Chunk_Impl__obj *__this = (Chunk_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Chunk_Impl__obj), false, "tink._Chunk.Chunk_Impl_"));
+ *(void **)__this = Chunk_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Chunk_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Chunk_Impl_",ad,aa,7a,82); }
+
+ static void __boot();
+ static ::Dynamic concat(::Dynamic this1,::Dynamic that);
+ static ::Dynamic concat_dyn();
+
+ static ::Dynamic join(::Array< ::Dynamic> chunks);
+ static ::Dynamic join_dyn();
+
+ static ::Dynamic EMPTY;
+};
+
+} // end namespace tink
+} // end namespace _Chunk
+
+#endif /* INCLUDED_tink__Chunk_Chunk_Impl_ */
diff --git a/Sources/c_snikket/iinclude/include/tink/_Chunk/EmptyChunk.h b/Sources/c_snikket/iinclude/include/tink/_Chunk/EmptyChunk.h
new file mode 100644
index 0000000..b66b362
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/_Chunk/EmptyChunk.h
@@ -0,0 +1,77 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink__Chunk_EmptyChunk
+#define INCLUDED_tink__Chunk_EmptyChunk
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_chunk_ChunkBase
+#include <tink/chunk/ChunkBase.h>
+#endif
+#ifndef INCLUDED_tink_chunk_ChunkObject
+#include <tink/chunk/ChunkObject.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(tink,_Chunk,EmptyChunk)
+HX_DECLARE_CLASS2(tink,chunk,ChunkBase)
+HX_DECLARE_CLASS2(tink,chunk,ChunkObject)
+
+namespace tink{
+namespace _Chunk{
+
+
+class HXCPP_CLASS_ATTRIBUTES EmptyChunk_obj : public ::tink::chunk::ChunkBase_obj
+{
+ public:
+ typedef ::tink::chunk::ChunkBase_obj super;
+ typedef EmptyChunk_obj OBJ_;
+ EmptyChunk_obj();
+
+ public:
+ enum { _hx_ClassId = 0x01566580 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink._Chunk.EmptyChunk")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink._Chunk.EmptyChunk"); }
+ static ::hx::ObjectPtr< EmptyChunk_obj > __new();
+ static ::hx::ObjectPtr< EmptyChunk_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~EmptyChunk_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("EmptyChunk",c0,a0,c6,bc); }
+
+ static void __boot();
+ static ::haxe::io::Bytes EMPTY;
+ int getLength();
+ ::Dynamic getLength_dyn();
+
+ ::Dynamic slice(int from,int to);
+ ::Dynamic slice_dyn();
+
+ void blitTo( ::haxe::io::Bytes target,int offset);
+ ::Dynamic blitTo_dyn();
+
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+ ::haxe::io::Bytes toBytes();
+ ::Dynamic toBytes_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace _Chunk
+
+#endif /* INCLUDED_tink__Chunk_EmptyChunk */
diff --git a/Sources/c_snikket/iinclude/include/tink/_Url/Url_Impl_.h b/Sources/c_snikket/iinclude/include/tink/_Url/Url_Impl_.h
new file mode 100644
index 0000000..954edfb
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/_Url/Url_Impl_.h
@@ -0,0 +1,80 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink__Url_Url_Impl_
+#define INCLUDED_tink__Url_Url_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,_Url,Url_Impl_)
+
+namespace tink{
+namespace _Url{
+
+
+class HXCPP_CLASS_ATTRIBUTES Url_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Url_Impl__obj OBJ_;
+ Url_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x142a69a5 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink._Url.Url_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink._Url.Url_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Url_Impl__obj > __new() {
+ ::hx::ObjectPtr< Url_Impl__obj > __this = new Url_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Url_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Url_Impl__obj *__this = (Url_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Url_Impl__obj), false, "tink._Url.Url_Impl_"));
+ *(void **)__this = Url_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Url_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Url_Impl_",2f,05,36,5a); }
+
+ static ::Dynamic resolve( ::Dynamic this1, ::Dynamic that);
+ static ::Dynamic resolve_dyn();
+
+ static void makePayload( ::Dynamic parts);
+ static ::Dynamic makePayload_dyn();
+
+ static ::String toString( ::Dynamic this1);
+ static ::Dynamic toString_dyn();
+
+ static ::Dynamic fromString(::String s);
+ static ::Dynamic fromString_dyn();
+
+ static void noop(::String _);
+ static ::Dynamic noop_dyn();
+
+ static ::Dynamic parse(::String s, ::Dynamic onError);
+ static ::Dynamic parse_dyn();
+
+ static ::Dynamic make( ::Dynamic parts);
+ static ::Dynamic make_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace _Url
+
+#endif /* INCLUDED_tink__Url_Url_Impl_ */
diff --git a/Sources/c_snikket/iinclude/include/tink/chunk/ByteChunk.h b/Sources/c_snikket/iinclude/include/tink/chunk/ByteChunk.h
new file mode 100644
index 0000000..6fa0b79
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/chunk/ByteChunk.h
@@ -0,0 +1,90 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_chunk_ByteChunk
+#define INCLUDED_tink_chunk_ByteChunk
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_chunk_ChunkBase
+#include <tink/chunk/ChunkBase.h>
+#endif
+#ifndef INCLUDED_tink_chunk_ChunkObject
+#include <tink/chunk/ChunkObject.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(tink,chunk,ByteChunk)
+HX_DECLARE_CLASS2(tink,chunk,ChunkBase)
+HX_DECLARE_CLASS2(tink,chunk,ChunkObject)
+
+namespace tink{
+namespace chunk{
+
+
+class HXCPP_CLASS_ATTRIBUTES ByteChunk_obj : public ::tink::chunk::ChunkBase_obj
+{
+ public:
+ typedef ::tink::chunk::ChunkBase_obj super;
+ typedef ByteChunk_obj OBJ_;
+ ByteChunk_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1854896e };
+
+ void __construct(::Array< unsigned char > data,int from,int to);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.chunk.ByteChunk")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.chunk.ByteChunk"); }
+ static ::hx::ObjectPtr< ByteChunk_obj > __new(::Array< unsigned char > data,int from,int to);
+ static ::hx::ObjectPtr< ByteChunk_obj > __alloc(::hx::Ctx *_hx_ctx,::Array< unsigned char > data,int from,int to);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ByteChunk_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("ByteChunk",25,7a,ca,7d); }
+
+ static ::Dynamic of( ::haxe::io::Bytes b);
+ static ::Dynamic of_dyn();
+
+ ::Array< unsigned char > data;
+ int from;
+ int to;
+ ::haxe::io::Bytes wrapped;
+ void flatten(::Array< ::Dynamic> into);
+
+ int getLength();
+ ::Dynamic getLength_dyn();
+
+ ::tink::chunk::ByteChunk getSlice(int from,int to);
+ ::Dynamic getSlice_dyn();
+
+ ::Dynamic slice(int from,int to);
+ ::Dynamic slice_dyn();
+
+ void blitTo( ::haxe::io::Bytes target,int offset);
+ ::Dynamic blitTo_dyn();
+
+ ::haxe::io::Bytes toBytes();
+ ::Dynamic toBytes_dyn();
+
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace chunk
+
+#endif /* INCLUDED_tink_chunk_ByteChunk */
diff --git a/Sources/c_snikket/iinclude/include/tink/chunk/ChunkBase.h b/Sources/c_snikket/iinclude/include/tink/chunk/ChunkBase.h
new file mode 100644
index 0000000..f4af2f3
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/chunk/ChunkBase.h
@@ -0,0 +1,73 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_chunk_ChunkBase
+#define INCLUDED_tink_chunk_ChunkBase
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,chunk,ByteChunk)
+HX_DECLARE_CLASS2(tink,chunk,ChunkBase)
+HX_DECLARE_CLASS2(tink,chunk,ChunkCursor)
+HX_DECLARE_CLASS2(tink,chunk,ChunkObject)
+
+namespace tink{
+namespace chunk{
+
+
+class HXCPP_CLASS_ATTRIBUTES ChunkBase_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef ChunkBase_obj OBJ_;
+ ChunkBase_obj();
+
+ public:
+ enum { _hx_ClassId = 0x49bef7e3 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.chunk.ChunkBase")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.chunk.ChunkBase"); }
+
+ inline static ::hx::ObjectPtr< ChunkBase_obj > __new() {
+ ::hx::ObjectPtr< ChunkBase_obj > __this = new ChunkBase_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< ChunkBase_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ ChunkBase_obj *__this = (ChunkBase_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(ChunkBase_obj), true, "tink.chunk.ChunkBase"));
+ *(void **)__this = ChunkBase_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ChunkBase_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("ChunkBase",fe,f4,07,36); }
+
+ ::Array< ::Dynamic> flattened;
+ ::tink::chunk::ChunkCursor getCursor();
+ ::Dynamic getCursor_dyn();
+
+ virtual void flatten(::Array< ::Dynamic> into);
+ ::Dynamic flatten_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace chunk
+
+#endif /* INCLUDED_tink_chunk_ChunkBase */
diff --git a/Sources/c_snikket/iinclude/include/tink/chunk/ChunkCursor.h b/Sources/c_snikket/iinclude/include/tink/chunk/ChunkCursor.h
new file mode 100644
index 0000000..338a1b0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/chunk/ChunkCursor.h
@@ -0,0 +1,91 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_chunk_ChunkCursor
+#define INCLUDED_tink_chunk_ChunkCursor
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,chunk,ByteChunk)
+HX_DECLARE_CLASS2(tink,chunk,ChunkBase)
+HX_DECLARE_CLASS2(tink,chunk,ChunkCursor)
+HX_DECLARE_CLASS2(tink,chunk,ChunkObject)
+
+namespace tink{
+namespace chunk{
+
+
+class HXCPP_CLASS_ATTRIBUTES ChunkCursor_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef ChunkCursor_obj OBJ_;
+ ChunkCursor_obj();
+
+ public:
+ enum { _hx_ClassId = 0x5b17b728 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.chunk.ChunkCursor")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.chunk.ChunkCursor"); }
+ static ::hx::ObjectPtr< ChunkCursor_obj > __new();
+ static ::hx::ObjectPtr< ChunkCursor_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ChunkCursor_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("ChunkCursor",03,71,6e,a9); }
+
+ static ::tink::chunk::ChunkCursor create(::Array< ::Dynamic> parts);
+ static ::Dynamic create_dyn();
+
+ ::Array< ::Dynamic> parts;
+ ::tink::chunk::ByteChunk curPart;
+ int curPartIndex;
+ int curOffset;
+ int curLength;
+ int length;
+ int currentPos;
+ int currentByte;
+ void reset();
+ ::Dynamic reset_dyn();
+
+ ::Dynamic flush();
+ ::Dynamic flush_dyn();
+
+ void add(::Dynamic chunk);
+ ::Dynamic add_dyn();
+
+ void shift(::Dynamic chunk);
+ ::Dynamic shift_dyn();
+
+ ::Dynamic left();
+ ::Dynamic left_dyn();
+
+ ::Dynamic right();
+ ::Dynamic right_dyn();
+
+ void ffwd();
+ ::Dynamic ffwd_dyn();
+
+ bool next();
+ ::Dynamic next_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace chunk
+
+#endif /* INCLUDED_tink_chunk_ChunkCursor */
diff --git a/Sources/c_snikket/iinclude/include/tink/chunk/ChunkObject.h b/Sources/c_snikket/iinclude/include/tink/chunk/ChunkObject.h
new file mode 100644
index 0000000..7a4d920
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/chunk/ChunkObject.h
@@ -0,0 +1,57 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_chunk_ChunkObject
+#define INCLUDED_tink_chunk_ChunkObject
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(tink,chunk,ByteChunk)
+HX_DECLARE_CLASS2(tink,chunk,ChunkBase)
+HX_DECLARE_CLASS2(tink,chunk,ChunkCursor)
+HX_DECLARE_CLASS2(tink,chunk,ChunkObject)
+
+namespace tink{
+namespace chunk{
+
+
+class HXCPP_CLASS_ATTRIBUTES ChunkObject_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ ::tink::chunk::ChunkCursor (::hx::Object :: *_hx_getCursor)();
+ static inline ::tink::chunk::ChunkCursor getCursor( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::chunk::ChunkObject_obj *>(_hx_.mPtr->_hx_getInterface(0x027c3451)))->_hx_getCursor)();
+ }
+ void (::hx::Object :: *_hx_flatten)(::Array< ::Dynamic> into);
+ static inline void flatten( ::Dynamic _hx_,::Array< ::Dynamic> into) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::tink::chunk::ChunkObject_obj *>(_hx_.mPtr->_hx_getInterface(0x027c3451)))->_hx_flatten)(into);
+ }
+ int (::hx::Object :: *_hx_getLength)();
+ static inline int getLength( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::chunk::ChunkObject_obj *>(_hx_.mPtr->_hx_getInterface(0x027c3451)))->_hx_getLength)();
+ }
+ ::Dynamic (::hx::Object :: *_hx_slice)(int from,int to);
+ static inline ::Dynamic slice( ::Dynamic _hx_,int from,int to) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::chunk::ChunkObject_obj *>(_hx_.mPtr->_hx_getInterface(0x027c3451)))->_hx_slice)(from,to);
+ }
+ ::String (::hx::Object :: *_hx_toString)();
+ static inline ::String toString( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::chunk::ChunkObject_obj *>(_hx_.mPtr->_hx_getInterface(0x027c3451)))->_hx_toString)();
+ }
+ ::haxe::io::Bytes (::hx::Object :: *_hx_toBytes)();
+ static inline ::haxe::io::Bytes toBytes( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::chunk::ChunkObject_obj *>(_hx_.mPtr->_hx_getInterface(0x027c3451)))->_hx_toBytes)();
+ }
+ void (::hx::Object :: *_hx_blitTo)( ::haxe::io::Bytes target,int offset);
+ static inline void blitTo( ::Dynamic _hx_, ::haxe::io::Bytes target,int offset) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::tink::chunk::ChunkObject_obj *>(_hx_.mPtr->_hx_getInterface(0x027c3451)))->_hx_blitTo)(target,offset);
+ }
+};
+
+} // end namespace tink
+} // end namespace chunk
+
+#endif /* INCLUDED_tink_chunk_ChunkObject */
diff --git a/Sources/c_snikket/iinclude/include/tink/chunk/CompoundChunk.h b/Sources/c_snikket/iinclude/include/tink/chunk/CompoundChunk.h
new file mode 100644
index 0000000..661f924
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/chunk/CompoundChunk.h
@@ -0,0 +1,97 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_chunk_CompoundChunk
+#define INCLUDED_tink_chunk_CompoundChunk
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_chunk_ChunkBase
+#include <tink/chunk/ChunkBase.h>
+#endif
+#ifndef INCLUDED_tink_chunk_ChunkObject
+#include <tink/chunk/ChunkObject.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(tink,chunk,ByteChunk)
+HX_DECLARE_CLASS2(tink,chunk,ChunkBase)
+HX_DECLARE_CLASS2(tink,chunk,ChunkObject)
+HX_DECLARE_CLASS2(tink,chunk,CompoundChunk)
+
+namespace tink{
+namespace chunk{
+
+
+class HXCPP_CLASS_ATTRIBUTES CompoundChunk_obj : public ::tink::chunk::ChunkBase_obj
+{
+ public:
+ typedef ::tink::chunk::ChunkBase_obj super;
+ typedef CompoundChunk_obj OBJ_;
+ CompoundChunk_obj();
+
+ public:
+ enum { _hx_ClassId = 0x73605847 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.chunk.CompoundChunk")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.chunk.CompoundChunk"); }
+ static ::hx::ObjectPtr< CompoundChunk_obj > __new();
+ static ::hx::ObjectPtr< CompoundChunk_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~CompoundChunk_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("CompoundChunk",e2,7e,3d,10); }
+
+ static ::tink::chunk::CompoundChunk asCompound(::Dynamic c);
+ static ::Dynamic asCompound_dyn();
+
+ static ::Dynamic cons(::Dynamic a,::Dynamic b);
+ static ::Dynamic cons_dyn();
+
+ static ::tink::chunk::CompoundChunk create(::Array< ::Dynamic> chunks,int depth);
+ static ::Dynamic create_dyn();
+
+ ::Array< ::Dynamic> chunks;
+ ::Array< int > offsets;
+ int length;
+ int depth;
+ int getLength();
+ ::Dynamic getLength_dyn();
+
+ int findChunk(int target);
+ ::Dynamic findChunk_dyn();
+
+ void flatten(::Array< ::Dynamic> into);
+
+ ::Dynamic slice(int from,int to);
+ ::Dynamic slice_dyn();
+
+ void blitTo( ::haxe::io::Bytes target,int offset);
+ ::Dynamic blitTo_dyn();
+
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+ ::haxe::io::Bytes toBytes();
+ ::Dynamic toBytes_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace chunk
+
+#endif /* INCLUDED_tink_chunk_CompoundChunk */
diff --git a/Sources/c_snikket/iinclude/include/tink/core/CallbackLinkRef.h b/Sources/c_snikket/iinclude/include/tink/core/CallbackLinkRef.h
new file mode 100644
index 0000000..fb645e0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/core/CallbackLinkRef.h
@@ -0,0 +1,61 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core_CallbackLinkRef
+#define INCLUDED_tink_core_CallbackLinkRef
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_core_LinkObject
+#include <tink/core/LinkObject.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,CallbackLinkRef)
+HX_DECLARE_CLASS2(tink,core,LinkObject)
+
+namespace tink{
+namespace core{
+
+
+class HXCPP_CLASS_ATTRIBUTES CallbackLinkRef_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef CallbackLinkRef_obj OBJ_;
+ CallbackLinkRef_obj();
+
+ public:
+ enum { _hx_ClassId = 0x2af492e3 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.core.CallbackLinkRef")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.core.CallbackLinkRef"); }
+ static ::hx::ObjectPtr< CallbackLinkRef_obj > __new();
+ static ::hx::ObjectPtr< CallbackLinkRef_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~CallbackLinkRef_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("CallbackLinkRef",14,ba,30,89); }
+
+ ::Dynamic link;
+ void cancel();
+ ::Dynamic cancel_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace core
+
+#endif /* INCLUDED_tink_core_CallbackLinkRef */
diff --git a/Sources/c_snikket/iinclude/include/tink/core/CallbackList.h b/Sources/c_snikket/iinclude/include/tink/core/CallbackList.h
new file mode 100644
index 0000000..903c88f
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/core/CallbackList.h
@@ -0,0 +1,81 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core_CallbackList
+#define INCLUDED_tink_core_CallbackList
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_core_SimpleDisposable
+#include <tink/core/SimpleDisposable.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,CallbackList)
+HX_DECLARE_CLASS2(tink,core,Disposable)
+HX_DECLARE_CLASS2(tink,core,LinkObject)
+HX_DECLARE_CLASS2(tink,core,OwnedDisposable)
+HX_DECLARE_CLASS2(tink,core,SimpleDisposable)
+HX_DECLARE_CLASS3(tink,core,_Callback,ListCell)
+
+namespace tink{
+namespace core{
+
+
+class HXCPP_CLASS_ATTRIBUTES CallbackList_obj : public ::tink::core::SimpleDisposable_obj
+{
+ public:
+ typedef ::tink::core::SimpleDisposable_obj super;
+ typedef CallbackList_obj OBJ_;
+ CallbackList_obj();
+
+ public:
+ enum { _hx_ClassId = 0x12a8ef7c };
+
+ void __construct(::hx::Null< bool > __o_destructive);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.core.CallbackList")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.core.CallbackList"); }
+ static ::hx::ObjectPtr< CallbackList_obj > __new(::hx::Null< bool > __o_destructive);
+ static ::hx::ObjectPtr< CallbackList_obj > __alloc(::hx::Ctx *_hx_ctx,::hx::Null< bool > __o_destructive);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~CallbackList_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("CallbackList",e3,f4,55,31); }
+
+ bool destructive;
+ ::Array< ::Dynamic> cells;
+ int used;
+ ::Array< ::Dynamic> queue;
+ bool busy;
+ ::Dynamic ondrain;
+ Dynamic ondrain_dyn() { return ondrain;}
+ ::Dynamic onfill;
+ Dynamic onfill_dyn() { return onfill;}
+ void destroy();
+ ::Dynamic destroy_dyn();
+
+ void invoke( ::Dynamic data);
+ ::Dynamic invoke_dyn();
+
+ void compact();
+ ::Dynamic compact_dyn();
+
+ void resize(int length);
+ ::Dynamic resize_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace core
+
+#endif /* INCLUDED_tink_core_CallbackList */
diff --git a/Sources/c_snikket/iinclude/include/tink/core/Disposable.h b/Sources/c_snikket/iinclude/include/tink/core/Disposable.h
new file mode 100644
index 0000000..bd2c459
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/core/Disposable.h
@@ -0,0 +1,25 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core_Disposable
+#define INCLUDED_tink_core_Disposable
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,Disposable)
+
+namespace tink{
+namespace core{
+
+
+class HXCPP_CLASS_ATTRIBUTES Disposable_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+};
+
+} // end namespace tink
+} // end namespace core
+
+#endif /* INCLUDED_tink_core_Disposable */
diff --git a/Sources/c_snikket/iinclude/include/tink/core/FutureStatus.h b/Sources/c_snikket/iinclude/include/tink/core/FutureStatus.h
new file mode 100644
index 0000000..f046dc9
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/core/FutureStatus.h
@@ -0,0 +1,45 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core_FutureStatus
+#define INCLUDED_tink_core_FutureStatus
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,FutureStatus)
+HX_DECLARE_CLASS3(tink,core,_Lazy,Computable)
+HX_DECLARE_CLASS3(tink,core,_Lazy,LazyObject)
+namespace tink{
+namespace core{
+
+
+class FutureStatus_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef FutureStatus_obj OBJ_;
+
+ public:
+ FutureStatus_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.core.FutureStatus",e8,d1,b4,f2); }
+ ::String __ToString() const { return HX_("FutureStatus.",99,22,18,ea) + _hx_tag; }
+
+ static ::tink::core::FutureStatus Awaited;
+ static inline ::tink::core::FutureStatus Awaited_dyn() { return Awaited; }
+ static ::tink::core::FutureStatus EagerlyAwaited;
+ static inline ::tink::core::FutureStatus EagerlyAwaited_dyn() { return EagerlyAwaited; }
+ static ::tink::core::FutureStatus NeverEver;
+ static inline ::tink::core::FutureStatus NeverEver_dyn() { return NeverEver; }
+ static ::tink::core::FutureStatus Ready(::Dynamic result);
+ static ::Dynamic Ready_dyn();
+ static ::tink::core::FutureStatus Suspended;
+ static inline ::tink::core::FutureStatus Suspended_dyn() { return Suspended; }
+};
+
+} // end namespace tink
+} // end namespace core
+
+#endif /* INCLUDED_tink_core_FutureStatus */
diff --git a/Sources/c_snikket/iinclude/include/tink/core/LinkObject.h b/Sources/c_snikket/iinclude/include/tink/core/LinkObject.h
new file mode 100644
index 0000000..8ad85f0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/core/LinkObject.h
@@ -0,0 +1,29 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core_LinkObject
+#define INCLUDED_tink_core_LinkObject
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,LinkObject)
+
+namespace tink{
+namespace core{
+
+
+class HXCPP_CLASS_ATTRIBUTES LinkObject_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ void (::hx::Object :: *_hx_cancel)();
+ static inline void cancel( ::Dynamic _hx_) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::tink::core::LinkObject_obj *>(_hx_.mPtr->_hx_getInterface(0x0d15dd4a)))->_hx_cancel)();
+ }
+};
+
+} // end namespace tink
+} // end namespace core
+
+#endif /* INCLUDED_tink_core_LinkObject */
diff --git a/Sources/c_snikket/iinclude/include/tink/core/MPair.h b/Sources/c_snikket/iinclude/include/tink/core/MPair.h
new file mode 100644
index 0000000..5d16a2e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/core/MPair.h
@@ -0,0 +1,72 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core_MPair
+#define INCLUDED_tink_core_MPair
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_7fda083185addcb6_27_new)
+HX_DECLARE_CLASS2(tink,core,MPair)
+
+namespace tink{
+namespace core{
+
+
+class HXCPP_CLASS_ATTRIBUTES MPair_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef MPair_obj OBJ_;
+ MPair_obj();
+
+ public:
+ enum { _hx_ClassId = 0x4cad4316 };
+
+ void __construct( ::Dynamic a, ::Dynamic b);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.core.MPair")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.core.MPair"); }
+
+ inline static ::hx::ObjectPtr< MPair_obj > __new( ::Dynamic a, ::Dynamic b) {
+ ::hx::ObjectPtr< MPair_obj > __this = new MPair_obj();
+ __this->__construct(a,b);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< MPair_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic a, ::Dynamic b) {
+ MPair_obj *__this = (MPair_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(MPair_obj), true, "tink.core.MPair"));
+ *(void **)__this = MPair_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_7fda083185addcb6_27_new)
+HXLINE( 28) ( ( ::tink::core::MPair)(__this) )->a = a;
+HXLINE( 29) ( ( ::tink::core::MPair)(__this) )->b = b;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~MPair_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("MPair",07,b3,05,8b); }
+
+ ::Dynamic a;
+ ::Dynamic b;
+};
+
+} // end namespace tink
+} // end namespace core
+
+#endif /* INCLUDED_tink_core_MPair */
diff --git a/Sources/c_snikket/iinclude/include/tink/core/NamedWith.h b/Sources/c_snikket/iinclude/include/tink/core/NamedWith.h
new file mode 100644
index 0000000..125a8dd
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/core/NamedWith.h
@@ -0,0 +1,72 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core_NamedWith
+#define INCLUDED_tink_core_NamedWith
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_fe49a69a0def38bb_11_new)
+HX_DECLARE_CLASS2(tink,core,NamedWith)
+
+namespace tink{
+namespace core{
+
+
+class HXCPP_CLASS_ATTRIBUTES NamedWith_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef NamedWith_obj OBJ_;
+ NamedWith_obj();
+
+ public:
+ enum { _hx_ClassId = 0x4df025ce };
+
+ void __construct( ::Dynamic name, ::Dynamic value);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.core.NamedWith")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.core.NamedWith"); }
+
+ inline static ::hx::ObjectPtr< NamedWith_obj > __new( ::Dynamic name, ::Dynamic value) {
+ ::hx::ObjectPtr< NamedWith_obj > __this = new NamedWith_obj();
+ __this->__construct(name,value);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< NamedWith_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic name, ::Dynamic value) {
+ NamedWith_obj *__this = (NamedWith_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(NamedWith_obj), true, "tink.core.NamedWith"));
+ *(void **)__this = NamedWith_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_fe49a69a0def38bb_11_new)
+HXLINE( 12) ( ( ::tink::core::NamedWith)(__this) )->name = name;
+HXLINE( 13) ( ( ::tink::core::NamedWith)(__this) )->value = value;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~NamedWith_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("NamedWith",3f,e2,3d,d6); }
+
+ ::Dynamic name;
+ ::Dynamic value;
+};
+
+} // end namespace tink
+} // end namespace core
+
+#endif /* INCLUDED_tink_core_NamedWith */
diff --git a/Sources/c_snikket/iinclude/include/tink/core/Outcome.h b/Sources/c_snikket/iinclude/include/tink/core/Outcome.h
new file mode 100644
index 0000000..8434633
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/core/Outcome.h
@@ -0,0 +1,37 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core_Outcome
+#define INCLUDED_tink_core_Outcome
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,Outcome)
+namespace tink{
+namespace core{
+
+
+class Outcome_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef Outcome_obj OBJ_;
+
+ public:
+ Outcome_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.core.Outcome",5f,27,74,0c); }
+ ::String __ToString() const { return HX_("Outcome.",7c,83,a3,53) + _hx_tag; }
+
+ static ::tink::core::Outcome Failure( ::Dynamic failure);
+ static ::Dynamic Failure_dyn();
+ static ::tink::core::Outcome Success( ::Dynamic data);
+ static ::Dynamic Success_dyn();
+};
+
+} // end namespace tink
+} // end namespace core
+
+#endif /* INCLUDED_tink_core_Outcome */
diff --git a/Sources/c_snikket/iinclude/include/tink/core/OwnedDisposable.h b/Sources/c_snikket/iinclude/include/tink/core/OwnedDisposable.h
new file mode 100644
index 0000000..fe901cf
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/core/OwnedDisposable.h
@@ -0,0 +1,29 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core_OwnedDisposable
+#define INCLUDED_tink_core_OwnedDisposable
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_core_Disposable
+#include <tink/core/Disposable.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,Disposable)
+HX_DECLARE_CLASS2(tink,core,OwnedDisposable)
+
+namespace tink{
+namespace core{
+
+
+class HXCPP_CLASS_ATTRIBUTES OwnedDisposable_obj {
+ public:
+ typedef ::tink::core::Disposable_obj super;
+ HX_DO_INTERFACE_RTTI;
+
+};
+
+} // end namespace tink
+} // end namespace core
+
+#endif /* INCLUDED_tink_core_OwnedDisposable */
diff --git a/Sources/c_snikket/iinclude/include/tink/core/SimpleDisposable.h b/Sources/c_snikket/iinclude/include/tink/core/SimpleDisposable.h
new file mode 100644
index 0000000..0af4801
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/core/SimpleDisposable.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core_SimpleDisposable
+#define INCLUDED_tink_core_SimpleDisposable
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_core_OwnedDisposable
+#include <tink/core/OwnedDisposable.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,Disposable)
+HX_DECLARE_CLASS2(tink,core,OwnedDisposable)
+HX_DECLARE_CLASS2(tink,core,SimpleDisposable)
+
+namespace tink{
+namespace core{
+
+
+class HXCPP_CLASS_ATTRIBUTES SimpleDisposable_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef SimpleDisposable_obj OBJ_;
+ SimpleDisposable_obj();
+
+ public:
+ enum { _hx_ClassId = 0x11eb7047 };
+
+ void __construct( ::Dynamic dispose);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.core.SimpleDisposable")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.core.SimpleDisposable"); }
+ static ::hx::ObjectPtr< SimpleDisposable_obj > __new( ::Dynamic dispose);
+ static ::hx::ObjectPtr< SimpleDisposable_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic dispose);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SimpleDisposable_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("SimpleDisposable",92,24,4b,01); }
+
+ static void noop();
+ static ::Dynamic noop_dyn();
+
+ ::Dynamic f;
+ Dynamic f_dyn() { return f;}
+ ::Array< ::Dynamic> disposeHandlers;
+ void dispose();
+ ::Dynamic dispose_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace core
+
+#endif /* INCLUDED_tink_core_SimpleDisposable */
diff --git a/Sources/c_snikket/iinclude/include/tink/core/TypedError.h b/Sources/c_snikket/iinclude/include/tink/core/TypedError.h
new file mode 100644
index 0000000..b359208
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/core/TypedError.h
@@ -0,0 +1,72 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core_TypedError
+#define INCLUDED_tink_core_TypedError
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,StackItem)
+HX_DECLARE_CLASS2(tink,core,TypedError)
+
+namespace tink{
+namespace core{
+
+
+class HXCPP_CLASS_ATTRIBUTES TypedError_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef TypedError_obj OBJ_;
+ TypedError_obj();
+
+ public:
+ enum { _hx_ClassId = 0x07b6f513 };
+
+ void __construct( ::Dynamic __o_code,::String message, ::Dynamic pos);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.core.TypedError")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.core.TypedError"); }
+ static ::hx::ObjectPtr< TypedError_obj > __new( ::Dynamic __o_code,::String message, ::Dynamic pos);
+ static ::hx::ObjectPtr< TypedError_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic __o_code,::String message, ::Dynamic pos);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~TypedError_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("TypedError",1e,0f,9b,3c); }
+
+ static ::tink::core::TypedError withData( ::Dynamic code,::String message, ::Dynamic data, ::Dynamic pos);
+ static ::Dynamic withData_dyn();
+
+ static ::tink::core::TypedError typed( ::Dynamic code,::String message, ::Dynamic data, ::Dynamic pos);
+ static ::Dynamic typed_dyn();
+
+ ::String message;
+ int code;
+ ::Dynamic data;
+ ::Dynamic pos;
+ ::Array< ::Dynamic> callStack;
+ ::Array< ::Dynamic> exceptionStack;
+ ::String printPos();
+ ::Dynamic printPos_dyn();
+
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace core
+
+#endif /* INCLUDED_tink_core_TypedError */
diff --git a/Sources/c_snikket/iinclude/include/tink/core/_Callback/Callback_Impl_.h b/Sources/c_snikket/iinclude/include/tink/core/_Callback/Callback_Impl_.h
new file mode 100644
index 0000000..a7f2a09
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/core/_Callback/Callback_Impl_.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core__Callback_Callback_Impl_
+#define INCLUDED_tink_core__Callback_Callback_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Callback,Callback_Impl_)
+
+namespace tink{
+namespace core{
+namespace _Callback{
+
+
+class HXCPP_CLASS_ATTRIBUTES Callback_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Callback_Impl__obj OBJ_;
+ Callback_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x10af39f4 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.core._Callback.Callback_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.core._Callback.Callback_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Callback_Impl__obj > __new() {
+ ::hx::ObjectPtr< Callback_Impl__obj > __this = new Callback_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Callback_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Callback_Impl__obj *__this = (Callback_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Callback_Impl__obj), false, "tink.core._Callback.Callback_Impl_"));
+ *(void **)__this = Callback_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Callback_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Callback_Impl_",45,8c,62,d2); }
+
+ static void __boot();
+ static int depth;
+ static void invoke( ::Dynamic this1, ::Dynamic data);
+ static ::Dynamic invoke_dyn();
+
+ static void defer( ::Dynamic f);
+ static ::Dynamic defer_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace core
+} // end namespace _Callback
+
+#endif /* INCLUDED_tink_core__Callback_Callback_Impl_ */
diff --git a/Sources/c_snikket/iinclude/include/tink/core/_Callback/LinkPair.h b/Sources/c_snikket/iinclude/include/tink/core/_Callback/LinkPair.h
new file mode 100644
index 0000000..b86caa5
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/core/_Callback/LinkPair.h
@@ -0,0 +1,65 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core__Callback_LinkPair
+#define INCLUDED_tink_core__Callback_LinkPair
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_core_LinkObject
+#include <tink/core/LinkObject.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,LinkObject)
+HX_DECLARE_CLASS3(tink,core,_Callback,LinkPair)
+
+namespace tink{
+namespace core{
+namespace _Callback{
+
+
+class HXCPP_CLASS_ATTRIBUTES LinkPair_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef LinkPair_obj OBJ_;
+ LinkPair_obj();
+
+ public:
+ enum { _hx_ClassId = 0x01531ffb };
+
+ void __construct(::Dynamic a,::Dynamic b);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.core._Callback.LinkPair")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.core._Callback.LinkPair"); }
+ static ::hx::ObjectPtr< LinkPair_obj > __new(::Dynamic a,::Dynamic b);
+ static ::hx::ObjectPtr< LinkPair_obj > __alloc(::hx::Ctx *_hx_ctx,::Dynamic a,::Dynamic b);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~LinkPair_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("LinkPair",54,61,94,d5); }
+
+ ::Dynamic a;
+ ::Dynamic b;
+ bool dissolved;
+ void cancel();
+ ::Dynamic cancel_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace core
+} // end namespace _Callback
+
+#endif /* INCLUDED_tink_core__Callback_LinkPair */
diff --git a/Sources/c_snikket/iinclude/include/tink/core/_Callback/ListCell.h b/Sources/c_snikket/iinclude/include/tink/core/_Callback/ListCell.h
new file mode 100644
index 0000000..1e66518
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/core/_Callback/ListCell.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core__Callback_ListCell
+#define INCLUDED_tink_core__Callback_ListCell
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_core_LinkObject
+#include <tink/core/LinkObject.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,CallbackList)
+HX_DECLARE_CLASS2(tink,core,Disposable)
+HX_DECLARE_CLASS2(tink,core,LinkObject)
+HX_DECLARE_CLASS2(tink,core,OwnedDisposable)
+HX_DECLARE_CLASS2(tink,core,SimpleDisposable)
+HX_DECLARE_CLASS3(tink,core,_Callback,ListCell)
+
+namespace tink{
+namespace core{
+namespace _Callback{
+
+
+class HXCPP_CLASS_ATTRIBUTES ListCell_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef ListCell_obj OBJ_;
+ ListCell_obj();
+
+ public:
+ enum { _hx_ClassId = 0x05a024cb };
+
+ void __construct( ::Dynamic cb, ::tink::core::CallbackList list);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.core._Callback.ListCell")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.core._Callback.ListCell"); }
+ static ::hx::ObjectPtr< ListCell_obj > __new( ::Dynamic cb, ::tink::core::CallbackList list);
+ static ::hx::ObjectPtr< ListCell_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic cb, ::tink::core::CallbackList list);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ListCell_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("ListCell",40,ad,63,fb); }
+
+ ::Dynamic cb;
+ Dynamic cb_dyn() { return cb;}
+ ::tink::core::CallbackList list;
+ void cancel();
+ ::Dynamic cancel_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace core
+} // end namespace _Callback
+
+#endif /* INCLUDED_tink_core__Callback_ListCell */
diff --git a/Sources/c_snikket/iinclude/include/tink/core/_Future/FutureObject.h b/Sources/c_snikket/iinclude/include/tink/core/_Future/FutureObject.h
new file mode 100644
index 0000000..7e4ed1a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/core/_Future/FutureObject.h
@@ -0,0 +1,61 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core__Future_FutureObject
+#define INCLUDED_tink_core__Future_FutureObject
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,FutureStatus)
+HX_DECLARE_CLASS2(tink,core,LinkObject)
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+
+namespace tink{
+namespace core{
+namespace _Future{
+
+
+class HXCPP_CLASS_ATTRIBUTES FutureObject_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef FutureObject_obj OBJ_;
+ FutureObject_obj();
+
+ public:
+ enum { _hx_ClassId = 0x75d0f9d3 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.core._Future.FutureObject")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.core._Future.FutureObject"); }
+ static ::hx::ObjectPtr< FutureObject_obj > __new();
+ static ::hx::ObjectPtr< FutureObject_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~FutureObject_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("FutureObject",82,eb,54,94); }
+
+ virtual ::tink::core::FutureStatus getStatus();
+ ::Dynamic getStatus_dyn();
+
+ virtual ::Dynamic handle( ::Dynamic callback);
+ ::Dynamic handle_dyn();
+
+ virtual void eager();
+ ::Dynamic eager_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace core
+} // end namespace _Future
+
+#endif /* INCLUDED_tink_core__Future_FutureObject */
diff --git a/Sources/c_snikket/iinclude/include/tink/core/_Future/Future_Impl_.h b/Sources/c_snikket/iinclude/include/tink/core/_Future/Future_Impl_.h
new file mode 100644
index 0000000..94ba4b7
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/core/_Future/Future_Impl_.h
@@ -0,0 +1,79 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core__Future_Future_Impl_
+#define INCLUDED_tink_core__Future_Future_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS3(tink,core,_Future,Future_Impl_)
+
+namespace tink{
+namespace core{
+namespace _Future{
+
+
+class HXCPP_CLASS_ATTRIBUTES Future_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Future_Impl__obj OBJ_;
+ Future_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x78864394 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.core._Future.Future_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.core._Future.Future_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Future_Impl__obj > __new() {
+ ::hx::ObjectPtr< Future_Impl__obj > __this = new Future_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Future_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Future_Impl__obj *__this = (Future_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Future_Impl__obj), false, "tink.core._Future.Future_Impl_"));
+ *(void **)__this = Future_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Future_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Future_Impl_",43,35,0a,97); }
+
+ static void __boot();
+ static ::tink::core::_Future::FutureObject NEVER_INST;
+ static ::tink::core::_Future::FutureObject never();
+ static ::Dynamic never_dyn();
+
+ static ::tink::core::_Future::FutureObject map( ::tink::core::_Future::FutureObject this1, ::Dynamic f, ::Dynamic gather);
+ static ::Dynamic map_dyn();
+
+ static ::tink::core::_Future::FutureObject flatMap( ::tink::core::_Future::FutureObject this1, ::Dynamic next, ::Dynamic gather);
+ static ::Dynamic flatMap_dyn();
+
+ static ::tink::core::_Future::FutureObject async( ::Dynamic init, ::Dynamic lazy);
+ static ::Dynamic async_dyn();
+
+ static ::tink::core::_Future::FutureObject irreversible( ::Dynamic init);
+ static ::Dynamic irreversible_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace core
+} // end namespace _Future
+
+#endif /* INCLUDED_tink_core__Future_Future_Impl_ */
diff --git a/Sources/c_snikket/iinclude/include/tink/core/_Future/SuspendableFuture.h b/Sources/c_snikket/iinclude/include/tink/core/_Future/SuspendableFuture.h
new file mode 100644
index 0000000..358a37e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/core/_Future/SuspendableFuture.h
@@ -0,0 +1,81 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core__Future_SuspendableFuture
+#define INCLUDED_tink_core__Future_SuspendableFuture
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_core__Future_FutureObject
+#include <tink/core/_Future/FutureObject.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,CallbackList)
+HX_DECLARE_CLASS2(tink,core,Disposable)
+HX_DECLARE_CLASS2(tink,core,FutureStatus)
+HX_DECLARE_CLASS2(tink,core,LinkObject)
+HX_DECLARE_CLASS2(tink,core,OwnedDisposable)
+HX_DECLARE_CLASS2(tink,core,SimpleDisposable)
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS3(tink,core,_Future,SuspendableFuture)
+
+namespace tink{
+namespace core{
+namespace _Future{
+
+
+class HXCPP_CLASS_ATTRIBUTES SuspendableFuture_obj : public ::tink::core::_Future::FutureObject_obj
+{
+ public:
+ typedef ::tink::core::_Future::FutureObject_obj super;
+ typedef SuspendableFuture_obj OBJ_;
+ SuspendableFuture_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1fbfb7e8 };
+
+ void __construct( ::Dynamic wakeup);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.core._Future.SuspendableFuture")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.core._Future.SuspendableFuture"); }
+ static ::hx::ObjectPtr< SuspendableFuture_obj > __new( ::Dynamic wakeup);
+ static ::hx::ObjectPtr< SuspendableFuture_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic wakeup);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SuspendableFuture_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("SuspendableFuture",d9,4b,c6,80); }
+
+ ::tink::core::CallbackList callbacks;
+ ::tink::core::FutureStatus status;
+ ::Dynamic link;
+ ::Dynamic wakeup;
+ Dynamic wakeup_dyn() { return wakeup;}
+ ::tink::core::FutureStatus getStatus();
+
+ void trigger( ::Dynamic value);
+ ::Dynamic trigger_dyn();
+
+ ::Dynamic handle( ::Dynamic callback);
+
+ void arm();
+ ::Dynamic arm_dyn();
+
+ void eager();
+
+};
+
+} // end namespace tink
+} // end namespace core
+} // end namespace _Future
+
+#endif /* INCLUDED_tink_core__Future_SuspendableFuture */
diff --git a/Sources/c_snikket/iinclude/include/tink/core/_Future/SyncFuture.h b/Sources/c_snikket/iinclude/include/tink/core/_Future/SyncFuture.h
new file mode 100644
index 0000000..7c3b0d3
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/core/_Future/SyncFuture.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core__Future_SyncFuture
+#define INCLUDED_tink_core__Future_SyncFuture
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_core__Future_FutureObject
+#include <tink/core/_Future/FutureObject.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,FutureStatus)
+HX_DECLARE_CLASS2(tink,core,LinkObject)
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS3(tink,core,_Future,SyncFuture)
+HX_DECLARE_CLASS3(tink,core,_Lazy,Computable)
+HX_DECLARE_CLASS3(tink,core,_Lazy,LazyObject)
+
+namespace tink{
+namespace core{
+namespace _Future{
+
+
+class HXCPP_CLASS_ATTRIBUTES SyncFuture_obj : public ::tink::core::_Future::FutureObject_obj
+{
+ public:
+ typedef ::tink::core::_Future::FutureObject_obj super;
+ typedef SyncFuture_obj OBJ_;
+ SyncFuture_obj();
+
+ public:
+ enum { _hx_ClassId = 0x03763767 };
+
+ void __construct(::Dynamic value);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.core._Future.SyncFuture")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.core._Future.SyncFuture"); }
+ static ::hx::ObjectPtr< SyncFuture_obj > __new(::Dynamic value);
+ static ::hx::ObjectPtr< SyncFuture_obj > __alloc(::hx::Ctx *_hx_ctx,::Dynamic value);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SyncFuture_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("SyncFuture",1e,81,9c,5c); }
+
+ ::Dynamic value;
+ ::tink::core::FutureStatus getStatus();
+
+ ::Dynamic handle( ::Dynamic cb);
+
+ void eager();
+
+};
+
+} // end namespace tink
+} // end namespace core
+} // end namespace _Future
+
+#endif /* INCLUDED_tink_core__Future_SyncFuture */
diff --git a/Sources/c_snikket/iinclude/include/tink/core/_Lazy/Computable.h b/Sources/c_snikket/iinclude/include/tink/core/_Lazy/Computable.h
new file mode 100644
index 0000000..7d87bba
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/core/_Lazy/Computable.h
@@ -0,0 +1,39 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core__Lazy_Computable
+#define INCLUDED_tink_core__Lazy_Computable
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Lazy,Computable)
+
+namespace tink{
+namespace core{
+namespace _Lazy{
+
+
+class HXCPP_CLASS_ATTRIBUTES Computable_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ bool (::hx::Object :: *_hx_isComputed)();
+ static inline bool isComputed( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::core::_Lazy::Computable_obj *>(_hx_.mPtr->_hx_getInterface(0xd2b592ea)))->_hx_isComputed)();
+ }
+ void (::hx::Object :: *_hx_compute)();
+ static inline void compute( ::Dynamic _hx_) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::tink::core::_Lazy::Computable_obj *>(_hx_.mPtr->_hx_getInterface(0xd2b592ea)))->_hx_compute)();
+ }
+ ::Dynamic (::hx::Object :: *_hx_underlying)();
+ static inline ::Dynamic underlying( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::core::_Lazy::Computable_obj *>(_hx_.mPtr->_hx_getInterface(0xd2b592ea)))->_hx_underlying)();
+ }
+};
+
+} // end namespace tink
+} // end namespace core
+} // end namespace _Lazy
+
+#endif /* INCLUDED_tink_core__Lazy_Computable */
diff --git a/Sources/c_snikket/iinclude/include/tink/core/_Lazy/LazyConst.h b/Sources/c_snikket/iinclude/include/tink/core/_Lazy/LazyConst.h
new file mode 100644
index 0000000..8313c7c
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/core/_Lazy/LazyConst.h
@@ -0,0 +1,73 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core__Lazy_LazyConst
+#define INCLUDED_tink_core__Lazy_LazyConst
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_core__Lazy_LazyObject
+#include <tink/core/_Lazy/LazyObject.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Lazy,Computable)
+HX_DECLARE_CLASS3(tink,core,_Lazy,LazyConst)
+HX_DECLARE_CLASS3(tink,core,_Lazy,LazyObject)
+
+namespace tink{
+namespace core{
+namespace _Lazy{
+
+
+class HXCPP_CLASS_ATTRIBUTES LazyConst_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef LazyConst_obj OBJ_;
+ LazyConst_obj();
+
+ public:
+ enum { _hx_ClassId = 0x43104c2d };
+
+ void __construct( ::Dynamic value);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.core._Lazy.LazyConst")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.core._Lazy.LazyConst"); }
+ static ::hx::ObjectPtr< LazyConst_obj > __new( ::Dynamic value);
+ static ::hx::ObjectPtr< LazyConst_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic value);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~LazyConst_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("LazyConst",2f,14,bd,5b); }
+
+ ::Dynamic value;
+ bool isComputed();
+ ::Dynamic isComputed_dyn();
+
+ ::Dynamic get();
+ ::Dynamic get_dyn();
+
+ void compute();
+ ::Dynamic compute_dyn();
+
+ ::Dynamic underlying();
+ ::Dynamic underlying_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace core
+} // end namespace _Lazy
+
+#endif /* INCLUDED_tink_core__Lazy_LazyConst */
diff --git a/Sources/c_snikket/iinclude/include/tink/core/_Lazy/LazyFunc.h b/Sources/c_snikket/iinclude/include/tink/core/_Lazy/LazyFunc.h
new file mode 100644
index 0000000..d20b1d8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/core/_Lazy/LazyFunc.h
@@ -0,0 +1,76 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core__Lazy_LazyFunc
+#define INCLUDED_tink_core__Lazy_LazyFunc
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_core__Lazy_LazyObject
+#include <tink/core/_Lazy/LazyObject.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Lazy,Computable)
+HX_DECLARE_CLASS3(tink,core,_Lazy,LazyFunc)
+HX_DECLARE_CLASS3(tink,core,_Lazy,LazyObject)
+
+namespace tink{
+namespace core{
+namespace _Lazy{
+
+
+class HXCPP_CLASS_ATTRIBUTES LazyFunc_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef LazyFunc_obj OBJ_;
+ LazyFunc_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1cb47fba };
+
+ void __construct( ::Dynamic f,::Dynamic from);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.core._Lazy.LazyFunc")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.core._Lazy.LazyFunc"); }
+ static ::hx::ObjectPtr< LazyFunc_obj > __new( ::Dynamic f,::Dynamic from);
+ static ::hx::ObjectPtr< LazyFunc_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic f,::Dynamic from);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~LazyFunc_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("LazyFunc",f8,2d,40,5e); }
+
+ ::Dynamic f;
+ Dynamic f_dyn() { return f;}
+ ::Dynamic from;
+ ::Dynamic result;
+ ::Dynamic underlying();
+ ::Dynamic underlying_dyn();
+
+ bool isComputed();
+ ::Dynamic isComputed_dyn();
+
+ ::Dynamic get();
+ ::Dynamic get_dyn();
+
+ void compute();
+ ::Dynamic compute_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace core
+} // end namespace _Lazy
+
+#endif /* INCLUDED_tink_core__Lazy_LazyFunc */
diff --git a/Sources/c_snikket/iinclude/include/tink/core/_Lazy/LazyObject.h b/Sources/c_snikket/iinclude/include/tink/core/_Lazy/LazyObject.h
new file mode 100644
index 0000000..b6ab109
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/core/_Lazy/LazyObject.h
@@ -0,0 +1,47 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core__Lazy_LazyObject
+#define INCLUDED_tink_core__Lazy_LazyObject
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_core__Lazy_Computable
+#include <tink/core/_Lazy/Computable.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Lazy,Computable)
+HX_DECLARE_CLASS3(tink,core,_Lazy,LazyObject)
+
+namespace tink{
+namespace core{
+namespace _Lazy{
+
+
+class HXCPP_CLASS_ATTRIBUTES LazyObject_obj {
+ public:
+ typedef ::tink::core::_Lazy::Computable_obj super;
+ HX_DO_INTERFACE_RTTI;
+
+ bool (::hx::Object :: *_hx_isComputed)();
+ static inline bool isComputed( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::core::_Lazy::LazyObject_obj *>(_hx_.mPtr->_hx_getInterface(0xe1200775)))->_hx_isComputed)();
+ }
+ void (::hx::Object :: *_hx_compute)();
+ static inline void compute( ::Dynamic _hx_) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::tink::core::_Lazy::LazyObject_obj *>(_hx_.mPtr->_hx_getInterface(0xe1200775)))->_hx_compute)();
+ }
+ ::Dynamic (::hx::Object :: *_hx_underlying)();
+ static inline ::Dynamic underlying( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::core::_Lazy::LazyObject_obj *>(_hx_.mPtr->_hx_getInterface(0xe1200775)))->_hx_underlying)();
+ }
+ ::Dynamic (::hx::Object :: *_hx_get)();
+ static inline ::Dynamic get( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::core::_Lazy::LazyObject_obj *>(_hx_.mPtr->_hx_getInterface(0xe1200775)))->_hx_get)();
+ }
+};
+
+} // end namespace tink
+} // end namespace core
+} // end namespace _Lazy
+
+#endif /* INCLUDED_tink_core__Lazy_LazyObject */
diff --git a/Sources/c_snikket/iinclude/include/tink/core/_Lazy/Lazy_Impl_.h b/Sources/c_snikket/iinclude/include/tink/core/_Lazy/Lazy_Impl_.h
new file mode 100644
index 0000000..46a8e46
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/core/_Lazy/Lazy_Impl_.h
@@ -0,0 +1,66 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core__Lazy_Lazy_Impl_
+#define INCLUDED_tink_core__Lazy_Lazy_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Lazy,Computable)
+HX_DECLARE_CLASS3(tink,core,_Lazy,LazyObject)
+HX_DECLARE_CLASS3(tink,core,_Lazy,Lazy_Impl_)
+
+namespace tink{
+namespace core{
+namespace _Lazy{
+
+
+class HXCPP_CLASS_ATTRIBUTES Lazy_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Lazy_Impl__obj OBJ_;
+ Lazy_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x7f55432a };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.core._Lazy.Lazy_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.core._Lazy.Lazy_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Lazy_Impl__obj > __new() {
+ ::hx::ObjectPtr< Lazy_Impl__obj > __this = new Lazy_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Lazy_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Lazy_Impl__obj *__this = (Lazy_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Lazy_Impl__obj), false, "tink.core._Lazy.Lazy_Impl_"));
+ *(void **)__this = Lazy_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Lazy_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Lazy_Impl_",34,20,cd,39); }
+
+ static ::Dynamic get(::Dynamic this1);
+ static ::Dynamic get_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace core
+} // end namespace _Lazy
+
+#endif /* INCLUDED_tink_core__Lazy_Lazy_Impl_ */
diff --git a/Sources/c_snikket/iinclude/include/tink/core/_Promise/Promise_Impl_.h b/Sources/c_snikket/iinclude/include/tink/core/_Promise/Promise_Impl_.h
new file mode 100644
index 0000000..74f71a0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/core/_Promise/Promise_Impl_.h
@@ -0,0 +1,65 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core__Promise_Promise_Impl_
+#define INCLUDED_tink_core__Promise_Promise_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS3(tink,core,_Promise,Promise_Impl_)
+
+namespace tink{
+namespace core{
+namespace _Promise{
+
+
+class HXCPP_CLASS_ATTRIBUTES Promise_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Promise_Impl__obj OBJ_;
+ Promise_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x03edc1ee };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.core._Promise.Promise_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.core._Promise.Promise_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Promise_Impl__obj > __new() {
+ ::hx::ObjectPtr< Promise_Impl__obj > __this = new Promise_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Promise_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Promise_Impl__obj *__this = (Promise_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Promise_Impl__obj), false, "tink.core._Promise.Promise_Impl_"));
+ *(void **)__this = Promise_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Promise_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Promise_Impl_",5b,00,ba,be); }
+
+ static ::tink::core::_Future::FutureObject next( ::tink::core::_Future::FutureObject this1, ::Dynamic f, ::Dynamic gather);
+ static ::Dynamic next_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace core
+} // end namespace _Promise
+
+#endif /* INCLUDED_tink_core__Promise_Promise_Impl_ */
diff --git a/Sources/c_snikket/iinclude/include/tink/http/BodyPart.h b/Sources/c_snikket/iinclude/include/tink/http/BodyPart.h
new file mode 100644
index 0000000..29267c0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/http/BodyPart.h
@@ -0,0 +1,37 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_BodyPart
+#define INCLUDED_tink_http_BodyPart
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,http,BodyPart)
+namespace tink{
+namespace http{
+
+
+class BodyPart_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef BodyPart_obj OBJ_;
+
+ public:
+ BodyPart_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.http.BodyPart",ff,9c,21,13); }
+ ::String __ToString() const { return HX_("BodyPart.",b9,9a,30,1f) + _hx_tag; }
+
+ static ::tink::http::BodyPart File( ::Dynamic handle);
+ static ::Dynamic File_dyn();
+ static ::tink::http::BodyPart Value(::String v);
+ static ::Dynamic Value_dyn();
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_BodyPart */
diff --git a/Sources/c_snikket/iinclude/include/tink/http/ClientObject.h b/Sources/c_snikket/iinclude/include/tink/http/ClientObject.h
new file mode 100644
index 0000000..cfa81e2
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/http/ClientObject.h
@@ -0,0 +1,32 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_ClientObject
+#define INCLUDED_tink_http_ClientObject
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,http,ClientObject)
+HX_DECLARE_CLASS2(tink,http,Message)
+HX_DECLARE_CLASS2(tink,http,OutgoingRequest)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES ClientObject_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ ::tink::core::_Future::FutureObject (::hx::Object :: *_hx_request)( ::tink::http::OutgoingRequest req);
+ static inline ::tink::core::_Future::FutureObject request( ::Dynamic _hx_, ::tink::http::OutgoingRequest req) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::http::ClientObject_obj *>(_hx_.mPtr->_hx_getInterface(0x9c46f484)))->_hx_request)(req);
+ }
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_ClientObject */
diff --git a/Sources/c_snikket/iinclude/include/tink/http/ClientType.h b/Sources/c_snikket/iinclude/include/tink/http/ClientType.h
new file mode 100644
index 0000000..372ee0e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/http/ClientType.h
@@ -0,0 +1,46 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_ClientType
+#define INCLUDED_tink_http_ClientType
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,http,ClientObject)
+HX_DECLARE_CLASS2(tink,http,ClientType)
+HX_DECLARE_CLASS2(tink,http,Container)
+HX_DECLARE_CLASS3(tink,http,containers,LocalContainer)
+namespace tink{
+namespace http{
+
+
+class ClientType_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef ClientType_obj OBJ_;
+
+ public:
+ ClientType_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.http.ClientType",6f,ea,c8,55); }
+ ::String __ToString() const { return HX_("ClientType.",c9,7d,23,dd) + _hx_tag; }
+
+ static ::tink::http::ClientType Curl;
+ static inline ::tink::http::ClientType Curl_dyn() { return Curl; }
+ static ::tink::http::ClientType Custom(::Dynamic v);
+ static ::Dynamic Custom_dyn();
+ static ::tink::http::ClientType Default;
+ static inline ::tink::http::ClientType Default_dyn() { return Default; }
+ static ::tink::http::ClientType Local( ::tink::http::containers::LocalContainer container);
+ static ::Dynamic Local_dyn();
+ static ::tink::http::ClientType StdLib;
+ static inline ::tink::http::ClientType StdLib_dyn() { return StdLib; }
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_ClientType */
diff --git a/Sources/c_snikket/iinclude/include/tink/http/Container.h b/Sources/c_snikket/iinclude/include/tink/http/Container.h
new file mode 100644
index 0000000..e6373c2
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/http/Container.h
@@ -0,0 +1,25 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_Container
+#define INCLUDED_tink_http_Container
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,http,Container)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES Container_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_Container */
diff --git a/Sources/c_snikket/iinclude/include/tink/http/Fetch.h b/Sources/c_snikket/iinclude/include/tink/http/Fetch.h
new file mode 100644
index 0000000..b965ff4
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/http/Fetch.h
@@ -0,0 +1,74 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_Fetch
+#define INCLUDED_tink_http_Fetch
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,BalancedTree)
+HX_DECLARE_CLASS2(haxe,ds,EnumValueMap)
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,http,ClientObject)
+HX_DECLARE_CLASS2(tink,http,ClientType)
+HX_DECLARE_CLASS2(tink,http,Fetch)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES Fetch_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Fetch_obj OBJ_;
+ Fetch_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7f806d70 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.http.Fetch")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.http.Fetch"); }
+
+ inline static ::hx::ObjectPtr< Fetch_obj > __new() {
+ ::hx::ObjectPtr< Fetch_obj > __this = new Fetch_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Fetch_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Fetch_obj *__this = (Fetch_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Fetch_obj), false, "tink.http.Fetch"));
+ *(void **)__this = Fetch_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Fetch_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Fetch",1a,84,27,91); }
+
+ static void __boot();
+ static ::haxe::ds::EnumValueMap cache;
+ static ::tink::core::_Future::FutureObject fetch( ::Dynamic url, ::Dynamic options);
+ static ::Dynamic fetch_dyn();
+
+ static ::Dynamic getClient( ::tink::http::ClientType type);
+ static ::Dynamic getClient_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_Fetch */
diff --git a/Sources/c_snikket/iinclude/include/tink/http/HandlerObject.h b/Sources/c_snikket/iinclude/include/tink/http/HandlerObject.h
new file mode 100644
index 0000000..37c2119
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/http/HandlerObject.h
@@ -0,0 +1,32 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_HandlerObject
+#define INCLUDED_tink_http_HandlerObject
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,http,HandlerObject)
+HX_DECLARE_CLASS2(tink,http,IncomingRequest)
+HX_DECLARE_CLASS2(tink,http,Message)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES HandlerObject_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ ::tink::core::_Future::FutureObject (::hx::Object :: *_hx_process)( ::tink::http::IncomingRequest req);
+ static inline ::tink::core::_Future::FutureObject process( ::Dynamic _hx_, ::tink::http::IncomingRequest req) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::http::HandlerObject_obj *>(_hx_.mPtr->_hx_getInterface(0xee501fcf)))->_hx_process)(req);
+ }
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_HandlerObject */
diff --git a/Sources/c_snikket/iinclude/include/tink/http/Header.h b/Sources/c_snikket/iinclude/include/tink/http/Header.h
new file mode 100644
index 0000000..8567553
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/http/Header.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_Header
+#define INCLUDED_tink_http_Header
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,NamedWith)
+HX_DECLARE_CLASS2(tink,core,Outcome)
+HX_DECLARE_CLASS2(tink,http,Header)
+HX_DECLARE_CLASS2(tink,http,HeaderField)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES Header_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Header_obj OBJ_;
+ Header_obj();
+
+ public:
+ enum { _hx_ClassId = 0x4094a9e7 };
+
+ void __construct(::Array< ::Dynamic> fields);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.Header")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.Header"); }
+ static ::hx::ObjectPtr< Header_obj > __new(::Array< ::Dynamic> fields);
+ static ::hx::ObjectPtr< Header_obj > __alloc(::hx::Ctx *_hx_ctx,::Array< ::Dynamic> fields);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Header_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Header",ad,7d,94,31); }
+
+ ::Array< ::Dynamic> fields;
+ ::Array< ::String > get(::String name);
+ ::Dynamic get_dyn();
+
+ ::tink::core::Outcome byName(::String name);
+ ::Dynamic byName_dyn();
+
+ ::tink::core::Outcome getContentLength();
+ ::Dynamic getContentLength_dyn();
+
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_Header */
diff --git a/Sources/c_snikket/iinclude/include/tink/http/HeaderField.h b/Sources/c_snikket/iinclude/include/tink/http/HeaderField.h
new file mode 100644
index 0000000..c12456f
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/http/HeaderField.h
@@ -0,0 +1,76 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_HeaderField
+#define INCLUDED_tink_http_HeaderField
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_core_NamedWith
+#include <tink/core/NamedWith.h>
+#endif
+HX_DECLARE_STACK_FRAME(_hx_pos_80f54cb31df217e8_249_new)
+HX_DECLARE_CLASS2(tink,core,NamedWith)
+HX_DECLARE_CLASS2(tink,http,HeaderField)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES HeaderField_obj : public ::tink::core::NamedWith_obj
+{
+ public:
+ typedef ::tink::core::NamedWith_obj super;
+ typedef HeaderField_obj OBJ_;
+ HeaderField_obj();
+
+ public:
+ enum { _hx_ClassId = 0x67181553 };
+
+ void __construct(::String name,::String value);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.HeaderField")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.HeaderField"); }
+
+ inline static ::hx::ObjectPtr< HeaderField_obj > __new(::String name,::String value) {
+ ::hx::ObjectPtr< HeaderField_obj > __this = new HeaderField_obj();
+ __this->__construct(name,value);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< HeaderField_obj > __alloc(::hx::Ctx *_hx_ctx,::String name,::String value) {
+ HeaderField_obj *__this = (HeaderField_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(HeaderField_obj), true, "tink.http.HeaderField"));
+ *(void **)__this = HeaderField_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_80f54cb31df217e8_249_new)
+HXDLIN( 249) __this->super::__construct(name,value);
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~HeaderField_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("HeaderField",cd,d3,84,f1); }
+
+ static ::tink::http::HeaderField ofString(::String s);
+ static ::Dynamic ofString_dyn();
+
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_HeaderField */
diff --git a/Sources/c_snikket/iinclude/include/tink/http/HeaderParser.h b/Sources/c_snikket/iinclude/include/tink/http/HeaderParser.h
new file mode 100644
index 0000000..a493cba
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/http/HeaderParser.h
@@ -0,0 +1,73 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_HeaderParser
+#define INCLUDED_tink_http_HeaderParser
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_io_BytewiseParser
+#include <tink/io/BytewiseParser.h>
+#endif
+HX_DECLARE_CLASS0(StringBuf)
+HX_DECLARE_CLASS2(tink,core,NamedWith)
+HX_DECLARE_CLASS2(tink,core,Outcome)
+HX_DECLARE_CLASS2(tink,http,HeaderField)
+HX_DECLARE_CLASS2(tink,http,HeaderParser)
+HX_DECLARE_CLASS2(tink,io,BytewiseParser)
+HX_DECLARE_CLASS2(tink,io,ParseStep)
+HX_DECLARE_CLASS2(tink,io,StreamParserObject)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES HeaderParser_obj : public ::tink::io::BytewiseParser_obj
+{
+ public:
+ typedef ::tink::io::BytewiseParser_obj super;
+ typedef HeaderParser_obj OBJ_;
+ HeaderParser_obj();
+
+ public:
+ enum { _hx_ClassId = 0x3af4a226 };
+
+ void __construct( ::Dynamic makeHeader);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.HeaderParser")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.HeaderParser"); }
+ static ::hx::ObjectPtr< HeaderParser_obj > __new( ::Dynamic makeHeader);
+ static ::hx::ObjectPtr< HeaderParser_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic makeHeader);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~HeaderParser_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("HeaderParser",6c,8e,ae,cf); }
+
+ ::Dynamic header;
+ ::Array< ::Dynamic> fields;
+ ::StringBuf buf;
+ int last;
+ ::Dynamic makeHeader;
+ Dynamic makeHeader_dyn() { return makeHeader;}
+ ::tink::io::ParseStep read(int c);
+
+ ::tink::io::ParseStep nextLine();
+ ::Dynamic nextLine_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_HeaderParser */
diff --git a/Sources/c_snikket/iinclude/include/tink/http/IncomingRequest.h b/Sources/c_snikket/iinclude/include/tink/http/IncomingRequest.h
new file mode 100644
index 0000000..3bdc78d
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/http/IncomingRequest.h
@@ -0,0 +1,61 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_IncomingRequest
+#define INCLUDED_tink_http_IncomingRequest
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_http_Message
+#include <tink/http/Message.h>
+#endif
+HX_DECLARE_CLASS2(tink,http,Header)
+HX_DECLARE_CLASS2(tink,http,IncomingRequest)
+HX_DECLARE_CLASS2(tink,http,IncomingRequestBody)
+HX_DECLARE_CLASS2(tink,http,IncomingRequestHeader)
+HX_DECLARE_CLASS2(tink,http,Message)
+HX_DECLARE_CLASS2(tink,http,RequestHeader)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES IncomingRequest_obj : public ::tink::http::Message_obj
+{
+ public:
+ typedef ::tink::http::Message_obj super;
+ typedef IncomingRequest_obj OBJ_;
+ IncomingRequest_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0386f7df };
+
+ void __construct(::String clientIp, ::tink::http::IncomingRequestHeader header, ::tink::http::IncomingRequestBody body);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.IncomingRequest")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.IncomingRequest"); }
+ static ::hx::ObjectPtr< IncomingRequest_obj > __new(::String clientIp, ::tink::http::IncomingRequestHeader header, ::tink::http::IncomingRequestBody body);
+ static ::hx::ObjectPtr< IncomingRequest_obj > __alloc(::hx::Ctx *_hx_ctx,::String clientIp, ::tink::http::IncomingRequestHeader header, ::tink::http::IncomingRequestBody body);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~IncomingRequest_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("IncomingRequest",e9,56,c7,13); }
+
+ ::String clientIp;
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_IncomingRequest */
diff --git a/Sources/c_snikket/iinclude/include/tink/http/IncomingRequestBody.h b/Sources/c_snikket/iinclude/include/tink/http/IncomingRequestBody.h
new file mode 100644
index 0000000..80b9e97
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/http/IncomingRequestBody.h
@@ -0,0 +1,39 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_IncomingRequestBody
+#define INCLUDED_tink_http_IncomingRequestBody
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,NamedWith)
+HX_DECLARE_CLASS2(tink,http,IncomingRequestBody)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+namespace tink{
+namespace http{
+
+
+class IncomingRequestBody_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef IncomingRequestBody_obj OBJ_;
+
+ public:
+ IncomingRequestBody_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.http.IncomingRequestBody",41,e5,fc,1f); }
+ ::String __ToString() const { return HX_("IncomingRequestBody.",a3,3f,25,ff) + _hx_tag; }
+
+ static ::tink::http::IncomingRequestBody Parsed(::Array< ::Dynamic> parts);
+ static ::Dynamic Parsed_dyn();
+ static ::tink::http::IncomingRequestBody Plain(::Dynamic source);
+ static ::Dynamic Plain_dyn();
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_IncomingRequestBody */
diff --git a/Sources/c_snikket/iinclude/include/tink/http/IncomingRequestHeader.h b/Sources/c_snikket/iinclude/include/tink/http/IncomingRequestHeader.h
new file mode 100644
index 0000000..8f6a9c0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/http/IncomingRequestHeader.h
@@ -0,0 +1,54 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_IncomingRequestHeader
+#define INCLUDED_tink_http_IncomingRequestHeader
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_http_RequestHeader
+#include <tink/http/RequestHeader.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,NamedWith)
+HX_DECLARE_CLASS2(tink,http,Header)
+HX_DECLARE_CLASS2(tink,http,HeaderField)
+HX_DECLARE_CLASS2(tink,http,IncomingRequestHeader)
+HX_DECLARE_CLASS2(tink,http,RequestHeader)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES IncomingRequestHeader_obj : public ::tink::http::RequestHeader_obj
+{
+ public:
+ typedef ::tink::http::RequestHeader_obj super;
+ typedef IncomingRequestHeader_obj OBJ_;
+ IncomingRequestHeader_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1c840e5c };
+
+ void __construct(::String method, ::Dynamic url,::String __o_protocol,::Array< ::Dynamic> fields);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.IncomingRequestHeader")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.IncomingRequestHeader"); }
+ static ::hx::ObjectPtr< IncomingRequestHeader_obj > __new(::String method, ::Dynamic url,::String __o_protocol,::Array< ::Dynamic> fields);
+ static ::hx::ObjectPtr< IncomingRequestHeader_obj > __alloc(::hx::Ctx *_hx_ctx,::String method, ::Dynamic url,::String __o_protocol,::Array< ::Dynamic> fields);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~IncomingRequestHeader_obj();
+
+ HX_DO_RTTI_ALL;
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("IncomingRequestHeader",56,69,89,e3); }
+
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_IncomingRequestHeader */
diff --git a/Sources/c_snikket/iinclude/include/tink/http/IncomingResponse.h b/Sources/c_snikket/iinclude/include/tink/http/IncomingResponse.h
new file mode 100644
index 0000000..bf1e612
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/http/IncomingResponse.h
@@ -0,0 +1,54 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_IncomingResponse
+#define INCLUDED_tink_http_IncomingResponse
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_http_Message
+#include <tink/http/Message.h>
+#endif
+HX_DECLARE_CLASS2(tink,http,Header)
+HX_DECLARE_CLASS2(tink,http,IncomingResponse)
+HX_DECLARE_CLASS2(tink,http,Message)
+HX_DECLARE_CLASS2(tink,http,ResponseHeaderBase)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES IncomingResponse_obj : public ::tink::http::Message_obj
+{
+ public:
+ typedef ::tink::http::Message_obj super;
+ typedef IncomingResponse_obj OBJ_;
+ IncomingResponse_obj();
+
+ public:
+ enum { _hx_ClassId = 0x68c65661 };
+
+ void __construct( ::tink::http::ResponseHeaderBase header,::Dynamic body);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.IncomingResponse")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.IncomingResponse"); }
+ static ::hx::ObjectPtr< IncomingResponse_obj > __new( ::tink::http::ResponseHeaderBase header,::Dynamic body);
+ static ::hx::ObjectPtr< IncomingResponse_obj > __alloc(::hx::Ctx *_hx_ctx, ::tink::http::ResponseHeaderBase header,::Dynamic body);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~IncomingResponse_obj();
+
+ HX_DO_RTTI_ALL;
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("IncomingResponse",a7,dd,f2,2c); }
+
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_IncomingResponse */
diff --git a/Sources/c_snikket/iinclude/include/tink/http/Message.h b/Sources/c_snikket/iinclude/include/tink/http/Message.h
new file mode 100644
index 0000000..df01137
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/http/Message.h
@@ -0,0 +1,72 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_Message
+#define INCLUDED_tink_http_Message
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_bcbf082f6c47a594_8_new)
+HX_DECLARE_CLASS2(tink,http,Message)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES Message_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Message_obj OBJ_;
+ Message_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7888e42d };
+
+ void __construct( ::Dynamic header, ::Dynamic body);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.Message")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.Message"); }
+
+ inline static ::hx::ObjectPtr< Message_obj > __new( ::Dynamic header, ::Dynamic body) {
+ ::hx::ObjectPtr< Message_obj > __this = new Message_obj();
+ __this->__construct(header,body);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Message_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic header, ::Dynamic body) {
+ Message_obj *__this = (Message_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Message_obj), true, "tink.http.Message"));
+ *(void **)__this = Message_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_bcbf082f6c47a594_8_new)
+HXLINE( 9) ( ( ::tink::http::Message)(__this) )->header = header;
+HXLINE( 10) ( ( ::tink::http::Message)(__this) )->body = body;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Message_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Message",a7,5d,62,67); }
+
+ ::Dynamic header;
+ ::Dynamic body;
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_Message */
diff --git a/Sources/c_snikket/iinclude/include/tink/http/OutgoingRequest.h b/Sources/c_snikket/iinclude/include/tink/http/OutgoingRequest.h
new file mode 100644
index 0000000..cbe4430
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/http/OutgoingRequest.h
@@ -0,0 +1,55 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_OutgoingRequest
+#define INCLUDED_tink_http_OutgoingRequest
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_http_Message
+#include <tink/http/Message.h>
+#endif
+HX_DECLARE_CLASS2(tink,http,Header)
+HX_DECLARE_CLASS2(tink,http,Message)
+HX_DECLARE_CLASS2(tink,http,OutgoingRequest)
+HX_DECLARE_CLASS2(tink,http,OutgoingRequestHeader)
+HX_DECLARE_CLASS2(tink,http,RequestHeader)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES OutgoingRequest_obj : public ::tink::http::Message_obj
+{
+ public:
+ typedef ::tink::http::Message_obj super;
+ typedef OutgoingRequest_obj OBJ_;
+ OutgoingRequest_obj();
+
+ public:
+ enum { _hx_ClassId = 0x08bf21c5 };
+
+ void __construct( ::tink::http::OutgoingRequestHeader header,::Dynamic body);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.OutgoingRequest")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.OutgoingRequest"); }
+ static ::hx::ObjectPtr< OutgoingRequest_obj > __new( ::tink::http::OutgoingRequestHeader header,::Dynamic body);
+ static ::hx::ObjectPtr< OutgoingRequest_obj > __alloc(::hx::Ctx *_hx_ctx, ::tink::http::OutgoingRequestHeader header,::Dynamic body);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~OutgoingRequest_obj();
+
+ HX_DO_RTTI_ALL;
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("OutgoingRequest",23,1c,f4,79); }
+
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_OutgoingRequest */
diff --git a/Sources/c_snikket/iinclude/include/tink/http/OutgoingRequestHeader.h b/Sources/c_snikket/iinclude/include/tink/http/OutgoingRequestHeader.h
new file mode 100644
index 0000000..89bb40c
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/http/OutgoingRequestHeader.h
@@ -0,0 +1,63 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_OutgoingRequestHeader
+#define INCLUDED_tink_http_OutgoingRequestHeader
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_http_RequestHeader
+#include <tink/http/RequestHeader.h>
+#endif
+HX_DECLARE_CLASS2(haxe,ds,Option)
+HX_DECLARE_CLASS2(tink,core,NamedWith)
+HX_DECLARE_CLASS2(tink,http,Header)
+HX_DECLARE_CLASS2(tink,http,HeaderField)
+HX_DECLARE_CLASS2(tink,http,OutgoingRequestHeader)
+HX_DECLARE_CLASS2(tink,http,RequestHeader)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES OutgoingRequestHeader_obj : public ::tink::http::RequestHeader_obj
+{
+ public:
+ typedef ::tink::http::RequestHeader_obj super;
+ typedef OutgoingRequestHeader_obj OBJ_;
+ OutgoingRequestHeader_obj();
+
+ public:
+ enum { _hx_ClassId = 0x17e6c132 };
+
+ void __construct(::String method, ::Dynamic url,::String __o_protocol,::Array< ::Dynamic> fields);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.OutgoingRequestHeader")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.OutgoingRequestHeader"); }
+ static ::hx::ObjectPtr< OutgoingRequestHeader_obj > __new(::String method, ::Dynamic url,::String __o_protocol,::Array< ::Dynamic> fields);
+ static ::hx::ObjectPtr< OutgoingRequestHeader_obj > __alloc(::hx::Ctx *_hx_ctx,::String method, ::Dynamic url,::String __o_protocol,::Array< ::Dynamic> fields);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~OutgoingRequestHeader_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("OutgoingRequestHeader",10,d6,f4,a2); }
+
+ static ::haxe::ds::Option extractAuth( ::Dynamic url);
+ static ::Dynamic extractAuth_dyn();
+
+ ::tink::http::OutgoingRequestHeader concat(::Array< ::Dynamic> fields);
+ ::Dynamic concat_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_OutgoingRequestHeader */
diff --git a/Sources/c_snikket/iinclude/include/tink/http/RequestHeader.h b/Sources/c_snikket/iinclude/include/tink/http/RequestHeader.h
new file mode 100644
index 0000000..465e640
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/http/RequestHeader.h
@@ -0,0 +1,63 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_RequestHeader
+#define INCLUDED_tink_http_RequestHeader
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_http_Header
+#include <tink/http/Header.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,NamedWith)
+HX_DECLARE_CLASS2(tink,http,Header)
+HX_DECLARE_CLASS2(tink,http,HeaderField)
+HX_DECLARE_CLASS2(tink,http,RequestHeader)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES RequestHeader_obj : public ::tink::http::Header_obj
+{
+ public:
+ typedef ::tink::http::Header_obj super;
+ typedef RequestHeader_obj OBJ_;
+ RequestHeader_obj();
+
+ public:
+ enum { _hx_ClassId = 0x72a5c122 };
+
+ void __construct(::String method, ::Dynamic url,::String __o_protocol,::Array< ::Dynamic> fields);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.RequestHeader")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.RequestHeader"); }
+ static ::hx::ObjectPtr< RequestHeader_obj > __new(::String method, ::Dynamic url,::String __o_protocol,::Array< ::Dynamic> fields);
+ static ::hx::ObjectPtr< RequestHeader_obj > __alloc(::hx::Ctx *_hx_ctx,::String method, ::Dynamic url,::String __o_protocol,::Array< ::Dynamic> fields);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~RequestHeader_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("RequestHeader",1c,92,9a,00); }
+
+ ::String method;
+ ::Dynamic url;
+ ::String protocol;
+ virtual ::String toString();
+
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_RequestHeader */
diff --git a/Sources/c_snikket/iinclude/include/tink/http/ResponseHeaderBase.h b/Sources/c_snikket/iinclude/include/tink/http/ResponseHeaderBase.h
new file mode 100644
index 0000000..e02ec11
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/http/ResponseHeaderBase.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_ResponseHeaderBase
+#define INCLUDED_tink_http_ResponseHeaderBase
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_http_Header
+#include <tink/http/Header.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,NamedWith)
+HX_DECLARE_CLASS2(tink,http,Header)
+HX_DECLARE_CLASS2(tink,http,HeaderField)
+HX_DECLARE_CLASS2(tink,http,ResponseHeaderBase)
+HX_DECLARE_CLASS2(tink,io,StreamParserObject)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES ResponseHeaderBase_obj : public ::tink::http::Header_obj
+{
+ public:
+ typedef ::tink::http::Header_obj super;
+ typedef ResponseHeaderBase_obj OBJ_;
+ ResponseHeaderBase_obj();
+
+ public:
+ enum { _hx_ClassId = 0x68228641 };
+
+ void __construct(int statusCode,::String reason,::Array< ::Dynamic> fields,::String __o_protocol);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.ResponseHeaderBase")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.ResponseHeaderBase"); }
+ static ::hx::ObjectPtr< ResponseHeaderBase_obj > __new(int statusCode,::String reason,::Array< ::Dynamic> fields,::String __o_protocol);
+ static ::hx::ObjectPtr< ResponseHeaderBase_obj > __alloc(::hx::Ctx *_hx_ctx,int statusCode,::String reason,::Array< ::Dynamic> fields,::String __o_protocol);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ResponseHeaderBase_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("ResponseHeaderBase",3f,ca,db,63); }
+
+ static ::Dynamic parser();
+ static ::Dynamic parser_dyn();
+
+ int statusCode;
+ ::String reason;
+ ::String protocol;
+ virtual ::String toString();
+
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_ResponseHeaderBase */
diff --git a/Sources/c_snikket/iinclude/include/tink/http/_Client/CustomClient.h b/Sources/c_snikket/iinclude/include/tink/http/_Client/CustomClient.h
new file mode 100644
index 0000000..75eff5b
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/http/_Client/CustomClient.h
@@ -0,0 +1,79 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http__Client_CustomClient
+#define INCLUDED_tink_http__Client_CustomClient
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_http_ClientObject
+#include <tink/http/ClientObject.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,http,ClientObject)
+HX_DECLARE_CLASS2(tink,http,IncomingResponse)
+HX_DECLARE_CLASS2(tink,http,Message)
+HX_DECLARE_CLASS2(tink,http,OutgoingRequest)
+HX_DECLARE_CLASS3(tink,http,_Client,CustomClient)
+
+namespace tink{
+namespace http{
+namespace _Client{
+
+
+class HXCPP_CLASS_ATTRIBUTES CustomClient_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef CustomClient_obj OBJ_;
+ CustomClient_obj();
+
+ public:
+ enum { _hx_ClassId = 0x16257e84 };
+
+ void __construct(::Array< ::Dynamic> preprocessors,::Array< ::Dynamic> postprocessors,::Dynamic real);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http._Client.CustomClient")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http._Client.CustomClient"); }
+ static ::hx::ObjectPtr< CustomClient_obj > __new(::Array< ::Dynamic> preprocessors,::Array< ::Dynamic> postprocessors,::Dynamic real);
+ static ::hx::ObjectPtr< CustomClient_obj > __alloc(::hx::Ctx *_hx_ctx,::Array< ::Dynamic> preprocessors,::Array< ::Dynamic> postprocessors,::Dynamic real);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~CustomClient_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("CustomClient",fc,6c,ff,d1); }
+
+ static ::cpp::VirtualArray concat(::cpp::VirtualArray a,::cpp::VirtualArray b);
+ static ::Dynamic concat_dyn();
+
+ static ::tink::http::_Client::CustomClient create(::Dynamic c,::Array< ::Dynamic> preprocessors,::Array< ::Dynamic> postprocessors);
+ static ::Dynamic create_dyn();
+
+ ::Array< ::Dynamic> preprocessors;
+ ::Array< ::Dynamic> postprocessors;
+ ::Dynamic real;
+ ::tink::core::_Future::FutureObject pipe( ::Dynamic value,::Array< ::Dynamic> transforms, ::Dynamic index);
+ ::Dynamic pipe_dyn();
+
+ ::tink::core::_Future::FutureObject request( ::tink::http::OutgoingRequest req);
+ ::Dynamic request_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace http
+} // end namespace _Client
+
+#endif /* INCLUDED_tink_http__Client_CustomClient */
diff --git a/Sources/c_snikket/iinclude/include/tink/http/_Fetch/FetchResponse_Impl_.h b/Sources/c_snikket/iinclude/include/tink/http/_Fetch/FetchResponse_Impl_.h
new file mode 100644
index 0000000..0227082
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/http/_Fetch/FetchResponse_Impl_.h
@@ -0,0 +1,65 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http__Fetch_FetchResponse_Impl_
+#define INCLUDED_tink_http__Fetch_FetchResponse_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS3(tink,http,_Fetch,FetchResponse_Impl_)
+
+namespace tink{
+namespace http{
+namespace _Fetch{
+
+
+class HXCPP_CLASS_ATTRIBUTES FetchResponse_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef FetchResponse_Impl__obj OBJ_;
+ FetchResponse_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x706f0b26 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.http._Fetch.FetchResponse_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.http._Fetch.FetchResponse_Impl_"); }
+
+ inline static ::hx::ObjectPtr< FetchResponse_Impl__obj > __new() {
+ ::hx::ObjectPtr< FetchResponse_Impl__obj > __this = new FetchResponse_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< FetchResponse_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ FetchResponse_Impl__obj *__this = (FetchResponse_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(FetchResponse_Impl__obj), false, "tink.http._Fetch.FetchResponse_Impl_"));
+ *(void **)__this = FetchResponse_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~FetchResponse_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("FetchResponse_Impl_",9b,93,47,bc); }
+
+ static ::tink::core::_Future::FutureObject all( ::tink::core::_Future::FutureObject this1);
+ static ::Dynamic all_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace http
+} // end namespace _Fetch
+
+#endif /* INCLUDED_tink_http__Fetch_FetchResponse_Impl_ */
diff --git a/Sources/c_snikket/iinclude/include/tink/http/_Header/HeaderValue_Impl_.h b/Sources/c_snikket/iinclude/include/tink/http/_Header/HeaderValue_Impl_.h
new file mode 100644
index 0000000..a0fbe32
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/http/_Header/HeaderValue_Impl_.h
@@ -0,0 +1,67 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http__Header_HeaderValue_Impl_
+#define INCLUDED_tink_http__Header_HeaderValue_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,http,_Header,HeaderValue_Impl_)
+
+namespace tink{
+namespace http{
+namespace _Header{
+
+
+class HXCPP_CLASS_ATTRIBUTES HeaderValue_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef HeaderValue_Impl__obj OBJ_;
+ HeaderValue_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x58df80d2 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.http._Header.HeaderValue_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.http._Header.HeaderValue_Impl_"); }
+
+ inline static ::hx::ObjectPtr< HeaderValue_Impl__obj > __new() {
+ ::hx::ObjectPtr< HeaderValue_Impl__obj > __this = new HeaderValue_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< HeaderValue_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ HeaderValue_Impl__obj *__this = (HeaderValue_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(HeaderValue_Impl__obj), false, "tink.http._Header.HeaderValue_Impl_"));
+ *(void **)__this = HeaderValue_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~HeaderValue_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("HeaderValue_Impl_",24,b6,26,b3); }
+
+ static ::String basicAuth(::String username,::String password);
+ static ::Dynamic basicAuth_dyn();
+
+ static ::String ofInt(int i);
+ static ::Dynamic ofInt_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace http
+} // end namespace _Header
+
+#endif /* INCLUDED_tink_http__Header_HeaderValue_Impl_ */
diff --git a/Sources/c_snikket/iinclude/include/tink/http/_Response/OutgoingResponseData.h b/Sources/c_snikket/iinclude/include/tink/http/_Response/OutgoingResponseData.h
new file mode 100644
index 0000000..7279c3c
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/http/_Response/OutgoingResponseData.h
@@ -0,0 +1,56 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http__Response_OutgoingResponseData
+#define INCLUDED_tink_http__Response_OutgoingResponseData
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_http_Message
+#include <tink/http/Message.h>
+#endif
+HX_DECLARE_CLASS2(tink,http,Header)
+HX_DECLARE_CLASS2(tink,http,Message)
+HX_DECLARE_CLASS2(tink,http,ResponseHeaderBase)
+HX_DECLARE_CLASS3(tink,http,_Response,OutgoingResponseData)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace http{
+namespace _Response{
+
+
+class HXCPP_CLASS_ATTRIBUTES OutgoingResponseData_obj : public ::tink::http::Message_obj
+{
+ public:
+ typedef ::tink::http::Message_obj super;
+ typedef OutgoingResponseData_obj OBJ_;
+ OutgoingResponseData_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0dfa253d };
+
+ void __construct( ::tink::http::ResponseHeaderBase header,::Dynamic body);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http._Response.OutgoingResponseData")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http._Response.OutgoingResponseData"); }
+ static ::hx::ObjectPtr< OutgoingResponseData_obj > __new( ::tink::http::ResponseHeaderBase header,::Dynamic body);
+ static ::hx::ObjectPtr< OutgoingResponseData_obj > __alloc(::hx::Ctx *_hx_ctx, ::tink::http::ResponseHeaderBase header,::Dynamic body);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~OutgoingResponseData_obj();
+
+ HX_DO_RTTI_ALL;
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("OutgoingResponseData",f7,c7,68,aa); }
+
+};
+
+} // end namespace tink
+} // end namespace http
+} // end namespace _Response
+
+#endif /* INCLUDED_tink_http__Response_OutgoingResponseData */
diff --git a/Sources/c_snikket/iinclude/include/tink/http/clients/CurlClient.h b/Sources/c_snikket/iinclude/include/tink/http/clients/CurlClient.h
new file mode 100644
index 0000000..f926bf5
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/http/clients/CurlClient.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_clients_CurlClient
+#define INCLUDED_tink_http_clients_CurlClient
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_http_ClientObject
+#include <tink/http/ClientObject.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,http,ClientObject)
+HX_DECLARE_CLASS2(tink,http,Message)
+HX_DECLARE_CLASS2(tink,http,OutgoingRequest)
+HX_DECLARE_CLASS3(tink,http,clients,CurlClient)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace http{
+namespace clients{
+
+
+class HXCPP_CLASS_ATTRIBUTES CurlClient_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef CurlClient_obj OBJ_;
+ CurlClient_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1ef1a485 };
+
+ void __construct( ::Dynamic curl);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.clients.CurlClient")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.clients.CurlClient"); }
+ static ::hx::ObjectPtr< CurlClient_obj > __new( ::Dynamic curl);
+ static ::hx::ObjectPtr< CurlClient_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic curl);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ static void __alloc_dynamic_functions(::hx::Ctx *_hx_alloc,CurlClient_obj *_hx_obj);
+ //~CurlClient_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("CurlClient",77,86,3b,fe); }
+
+ ::tink::core::_Future::FutureObject request( ::tink::http::OutgoingRequest req);
+ ::Dynamic request_dyn();
+
+ ::Dynamic curl;
+ inline ::Dynamic &curl_dyn() {return curl; }
+
+};
+
+} // end namespace tink
+} // end namespace http
+} // end namespace clients
+
+#endif /* INCLUDED_tink_http_clients_CurlClient */
diff --git a/Sources/c_snikket/iinclude/include/tink/http/clients/Helpers.h b/Sources/c_snikket/iinclude/include/tink/http/clients/Helpers.h
new file mode 100644
index 0000000..ce58cd0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/http/clients/Helpers.h
@@ -0,0 +1,65 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_clients_Helpers
+#define INCLUDED_tink_http_clients_Helpers
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,ds,Option)
+HX_DECLARE_CLASS3(tink,http,clients,Helpers)
+
+namespace tink{
+namespace http{
+namespace clients{
+
+
+class HXCPP_CLASS_ATTRIBUTES Helpers_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Helpers_obj OBJ_;
+ Helpers_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1dfdf71f };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.http.clients.Helpers")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.http.clients.Helpers"); }
+
+ inline static ::hx::ObjectPtr< Helpers_obj > __new() {
+ ::hx::ObjectPtr< Helpers_obj > __this = new Helpers_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Helpers_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Helpers_obj *__this = (Helpers_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Helpers_obj), false, "tink.http.clients.Helpers"));
+ *(void **)__this = Helpers_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Helpers_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Helpers",25,6b,b0,8d); }
+
+ static ::haxe::ds::Option checkScheme(::String s);
+ static ::Dynamic checkScheme_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace http
+} // end namespace clients
+
+#endif /* INCLUDED_tink_http_clients_Helpers */
diff --git a/Sources/c_snikket/iinclude/include/tink/http/clients/LocalContainerClient.h b/Sources/c_snikket/iinclude/include/tink/http/clients/LocalContainerClient.h
new file mode 100644
index 0000000..6e1785e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/http/clients/LocalContainerClient.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_clients_LocalContainerClient
+#define INCLUDED_tink_http_clients_LocalContainerClient
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_http_ClientObject
+#include <tink/http/ClientObject.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,http,ClientObject)
+HX_DECLARE_CLASS2(tink,http,Container)
+HX_DECLARE_CLASS2(tink,http,Message)
+HX_DECLARE_CLASS2(tink,http,OutgoingRequest)
+HX_DECLARE_CLASS3(tink,http,clients,LocalContainerClient)
+HX_DECLARE_CLASS3(tink,http,containers,LocalContainer)
+
+namespace tink{
+namespace http{
+namespace clients{
+
+
+class HXCPP_CLASS_ATTRIBUTES LocalContainerClient_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef LocalContainerClient_obj OBJ_;
+ LocalContainerClient_obj();
+
+ public:
+ enum { _hx_ClassId = 0x4c48d30b };
+
+ void __construct( ::tink::http::containers::LocalContainer container);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.clients.LocalContainerClient")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.clients.LocalContainerClient"); }
+ static ::hx::ObjectPtr< LocalContainerClient_obj > __new( ::tink::http::containers::LocalContainer container);
+ static ::hx::ObjectPtr< LocalContainerClient_obj > __alloc(::hx::Ctx *_hx_ctx, ::tink::http::containers::LocalContainer container);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~LocalContainerClient_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("LocalContainerClient",61,95,42,2f); }
+
+ ::tink::http::containers::LocalContainer container;
+ ::tink::core::_Future::FutureObject request( ::tink::http::OutgoingRequest req);
+ ::Dynamic request_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace http
+} // end namespace clients
+
+#endif /* INCLUDED_tink_http_clients_LocalContainerClient */
diff --git a/Sources/c_snikket/iinclude/include/tink/http/clients/SocketClient.h b/Sources/c_snikket/iinclude/include/tink/http/clients/SocketClient.h
new file mode 100644
index 0000000..71e2c7f
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/http/clients/SocketClient.h
@@ -0,0 +1,67 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_clients_SocketClient
+#define INCLUDED_tink_http_clients_SocketClient
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_http_ClientObject
+#include <tink/http/ClientObject.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,http,ClientObject)
+HX_DECLARE_CLASS2(tink,http,Message)
+HX_DECLARE_CLASS2(tink,http,OutgoingRequest)
+HX_DECLARE_CLASS3(tink,http,clients,SocketClient)
+HX_DECLARE_CLASS2(tink,io,WorkerObject)
+
+namespace tink{
+namespace http{
+namespace clients{
+
+
+class HXCPP_CLASS_ATTRIBUTES SocketClient_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef SocketClient_obj OBJ_;
+ SocketClient_obj();
+
+ public:
+ enum { _hx_ClassId = 0x29ac2844 };
+
+ void __construct(::Dynamic worker);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.clients.SocketClient")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.clients.SocketClient"); }
+ static ::hx::ObjectPtr< SocketClient_obj > __new(::Dynamic worker);
+ static ::hx::ObjectPtr< SocketClient_obj > __alloc(::hx::Ctx *_hx_ctx,::Dynamic worker);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SocketClient_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("SocketClient",7e,5e,b9,60); }
+
+ ::Dynamic worker;
+ ::tink::core::_Future::FutureObject request( ::tink::http::OutgoingRequest req);
+ ::Dynamic request_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace http
+} // end namespace clients
+
+#endif /* INCLUDED_tink_http_clients_SocketClient */
diff --git a/Sources/c_snikket/iinclude/include/tink/http/clients/StdClient.h b/Sources/c_snikket/iinclude/include/tink/http/clients/StdClient.h
new file mode 100644
index 0000000..bc59cd0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/http/clients/StdClient.h
@@ -0,0 +1,67 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_clients_StdClient
+#define INCLUDED_tink_http_clients_StdClient
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_http_ClientObject
+#include <tink/http/ClientObject.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,http,ClientObject)
+HX_DECLARE_CLASS2(tink,http,Message)
+HX_DECLARE_CLASS2(tink,http,OutgoingRequest)
+HX_DECLARE_CLASS3(tink,http,clients,StdClient)
+HX_DECLARE_CLASS2(tink,io,WorkerObject)
+
+namespace tink{
+namespace http{
+namespace clients{
+
+
+class HXCPP_CLASS_ATTRIBUTES StdClient_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef StdClient_obj OBJ_;
+ StdClient_obj();
+
+ public:
+ enum { _hx_ClassId = 0x6b1f5144 };
+
+ void __construct(::Dynamic worker);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.clients.StdClient")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.clients.StdClient"); }
+ static ::hx::ObjectPtr< StdClient_obj > __new(::Dynamic worker);
+ static ::hx::ObjectPtr< StdClient_obj > __alloc(::hx::Ctx *_hx_ctx,::Dynamic worker);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~StdClient_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("StdClient",2e,63,67,cc); }
+
+ ::Dynamic worker;
+ ::tink::core::_Future::FutureObject request( ::tink::http::OutgoingRequest req);
+ ::Dynamic request_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace http
+} // end namespace clients
+
+#endif /* INCLUDED_tink_http_clients_StdClient */
diff --git a/Sources/c_snikket/iinclude/include/tink/http/containers/LocalContainer.h b/Sources/c_snikket/iinclude/include/tink/http/containers/LocalContainer.h
new file mode 100644
index 0000000..09cbd34
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/http/containers/LocalContainer.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_containers_LocalContainer
+#define INCLUDED_tink_http_containers_LocalContainer
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_http_Container
+#include <tink/http/Container.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,http,Container)
+HX_DECLARE_CLASS2(tink,http,HandlerObject)
+HX_DECLARE_CLASS2(tink,http,IncomingRequest)
+HX_DECLARE_CLASS2(tink,http,Message)
+HX_DECLARE_CLASS3(tink,http,containers,LocalContainer)
+
+namespace tink{
+namespace http{
+namespace containers{
+
+
+class HXCPP_CLASS_ATTRIBUTES LocalContainer_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef LocalContainer_obj OBJ_;
+ LocalContainer_obj();
+
+ public:
+ enum { _hx_ClassId = 0x315b134a };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.containers.LocalContainer")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.containers.LocalContainer"); }
+ static ::hx::ObjectPtr< LocalContainer_obj > __new();
+ static ::hx::ObjectPtr< LocalContainer_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~LocalContainer_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("LocalContainer",76,1a,ea,cb); }
+
+ ::Dynamic handler;
+ bool running;
+ ::tink::core::_Future::FutureObject serve( ::tink::http::IncomingRequest req);
+ ::Dynamic serve_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace http
+} // end namespace containers
+
+#endif /* INCLUDED_tink_http_containers_LocalContainer */
diff --git a/Sources/c_snikket/iinclude/include/tink/io/BytewiseParser.h b/Sources/c_snikket/iinclude/include/tink/io/BytewiseParser.h
new file mode 100644
index 0000000..487c7a1
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/io/BytewiseParser.h
@@ -0,0 +1,76 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io_BytewiseParser
+#define INCLUDED_tink_io_BytewiseParser
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_io_StreamParserObject
+#include <tink/io/StreamParserObject.h>
+#endif
+HX_DECLARE_CLASS2(tink,chunk,ChunkCursor)
+HX_DECLARE_CLASS2(tink,core,Outcome)
+HX_DECLARE_CLASS2(tink,io,BytewiseParser)
+HX_DECLARE_CLASS2(tink,io,ParseStep)
+HX_DECLARE_CLASS2(tink,io,StreamParserObject)
+
+namespace tink{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES BytewiseParser_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef BytewiseParser_obj OBJ_;
+ BytewiseParser_obj();
+
+ public:
+ enum { _hx_ClassId = 0x66915863 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.io.BytewiseParser")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.io.BytewiseParser"); }
+
+ inline static ::hx::ObjectPtr< BytewiseParser_obj > __new() {
+ ::hx::ObjectPtr< BytewiseParser_obj > __this = new BytewiseParser_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< BytewiseParser_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ BytewiseParser_obj *__this = (BytewiseParser_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(BytewiseParser_obj), false, "tink.io.BytewiseParser"));
+ *(void **)__this = BytewiseParser_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~BytewiseParser_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("BytewiseParser",4b,c6,88,ee); }
+
+ virtual ::tink::io::ParseStep read(int _hx_char);
+ ::Dynamic read_dyn();
+
+ ::tink::io::ParseStep progress( ::tink::chunk::ChunkCursor cursor);
+ ::Dynamic progress_dyn();
+
+ ::tink::core::Outcome eof( ::tink::chunk::ChunkCursor rest);
+ ::Dynamic eof_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace io
+
+#endif /* INCLUDED_tink_io_BytewiseParser */
diff --git a/Sources/c_snikket/iinclude/include/tink/io/IdealSourceTools.h b/Sources/c_snikket/iinclude/include/tink/io/IdealSourceTools.h
new file mode 100644
index 0000000..c7d617b
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/io/IdealSourceTools.h
@@ -0,0 +1,64 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io_IdealSourceTools
+#define INCLUDED_tink_io_IdealSourceTools
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,io,IdealSourceTools)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES IdealSourceTools_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef IdealSourceTools_obj OBJ_;
+ IdealSourceTools_obj();
+
+ public:
+ enum { _hx_ClassId = 0x186409e3 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.io.IdealSourceTools")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.io.IdealSourceTools"); }
+
+ inline static ::hx::ObjectPtr< IdealSourceTools_obj > __new() {
+ ::hx::ObjectPtr< IdealSourceTools_obj > __this = new IdealSourceTools_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< IdealSourceTools_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ IdealSourceTools_obj *__this = (IdealSourceTools_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(IdealSourceTools_obj), false, "tink.io.IdealSourceTools"));
+ *(void **)__this = IdealSourceTools_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~IdealSourceTools_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("IdealSourceTools",cb,c1,80,1f); }
+
+ static ::tink::core::_Future::FutureObject all(::Dynamic s);
+ static ::Dynamic all_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace io
+
+#endif /* INCLUDED_tink_io_IdealSourceTools */
diff --git a/Sources/c_snikket/iinclude/include/tink/io/ParseResult.h b/Sources/c_snikket/iinclude/include/tink/io/ParseResult.h
new file mode 100644
index 0000000..49ac084
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/io/ParseResult.h
@@ -0,0 +1,41 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io_ParseResult
+#define INCLUDED_tink_io_ParseResult
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS2(tink,io,ParseResult)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+namespace tink{
+namespace io{
+
+
+class ParseResult_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef ParseResult_obj OBJ_;
+
+ public:
+ ParseResult_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.io.ParseResult",c4,44,ed,6f); }
+ ::String __ToString() const { return HX_("ParseResult.",de,f8,43,8d) + _hx_tag; }
+
+ static ::tink::io::ParseResult Broke( ::tink::core::TypedError e);
+ static ::Dynamic Broke_dyn();
+ static ::tink::io::ParseResult Invalid( ::tink::core::TypedError e,::Dynamic rest);
+ static ::Dynamic Invalid_dyn();
+ static ::tink::io::ParseResult Parsed( ::Dynamic data,::Dynamic rest);
+ static ::Dynamic Parsed_dyn();
+};
+
+} // end namespace tink
+} // end namespace io
+
+#endif /* INCLUDED_tink_io_ParseResult */
diff --git a/Sources/c_snikket/iinclude/include/tink/io/ParseStep.h b/Sources/c_snikket/iinclude/include/tink/io/ParseStep.h
new file mode 100644
index 0000000..05a3784
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/io/ParseStep.h
@@ -0,0 +1,40 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io_ParseStep
+#define INCLUDED_tink_io_ParseStep
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS2(tink,io,ParseStep)
+namespace tink{
+namespace io{
+
+
+class ParseStep_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef ParseStep_obj OBJ_;
+
+ public:
+ ParseStep_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.io.ParseStep",73,2b,8e,cf); }
+ ::String __ToString() const { return HX_("ParseStep.",4f,c6,a0,a4) + _hx_tag; }
+
+ static ::tink::io::ParseStep Done( ::Dynamic r);
+ static ::Dynamic Done_dyn();
+ static ::tink::io::ParseStep Failed( ::tink::core::TypedError e);
+ static ::Dynamic Failed_dyn();
+ static ::tink::io::ParseStep Progressed;
+ static inline ::tink::io::ParseStep Progressed_dyn() { return Progressed; }
+};
+
+} // end namespace tink
+} // end namespace io
+
+#endif /* INCLUDED_tink_io_ParseStep */
diff --git a/Sources/c_snikket/iinclude/include/tink/io/PipeResult.h b/Sources/c_snikket/iinclude/include/tink/io/PipeResult.h
new file mode 100644
index 0000000..167b3e7
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/io/PipeResult.h
@@ -0,0 +1,43 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io_PipeResult
+#define INCLUDED_tink_io_PipeResult
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS2(tink,io,PipeResult)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+namespace tink{
+namespace io{
+
+
+class PipeResult_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef PipeResult_obj OBJ_;
+
+ public:
+ PipeResult_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.io.PipeResult",d7,3e,a3,6f); }
+ ::String __ToString() const { return HX_("PipeResult.",03,26,3a,37) + _hx_tag; }
+
+ static ::tink::io::PipeResult AllWritten;
+ static inline ::tink::io::PipeResult AllWritten_dyn() { return AllWritten; }
+ static ::tink::io::PipeResult SinkEnded( ::Dynamic result,::Dynamic rest);
+ static ::Dynamic SinkEnded_dyn();
+ static ::tink::io::PipeResult SinkFailed( ::tink::core::TypedError e,::Dynamic rest);
+ static ::Dynamic SinkFailed_dyn();
+ static ::tink::io::PipeResult SourceFailed( ::tink::core::TypedError e);
+ static ::Dynamic SourceFailed_dyn();
+};
+
+} // end namespace tink
+} // end namespace io
+
+#endif /* INCLUDED_tink_io_PipeResult */
diff --git a/Sources/c_snikket/iinclude/include/tink/io/PipeResultTools.h b/Sources/c_snikket/iinclude/include/tink/io/PipeResultTools.h
new file mode 100644
index 0000000..de6e225
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/io/PipeResultTools.h
@@ -0,0 +1,65 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io_PipeResultTools
+#define INCLUDED_tink_io_PipeResultTools
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,chunk,ChunkObject)
+HX_DECLARE_CLASS2(tink,io,PipeResult)
+HX_DECLARE_CLASS2(tink,io,PipeResultTools)
+HX_DECLARE_CLASS2(tink,streams,Conclusion)
+
+namespace tink{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES PipeResultTools_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef PipeResultTools_obj OBJ_;
+ PipeResultTools_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0add7938 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.io.PipeResultTools")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.io.PipeResultTools"); }
+
+ inline static ::hx::ObjectPtr< PipeResultTools_obj > __new() {
+ ::hx::ObjectPtr< PipeResultTools_obj > __this = new PipeResultTools_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< PipeResultTools_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ PipeResultTools_obj *__this = (PipeResultTools_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(PipeResultTools_obj), false, "tink.io.PipeResultTools"));
+ *(void **)__this = PipeResultTools_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~PipeResultTools_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("PipeResultTools",50,36,66,7b); }
+
+ static ::tink::io::PipeResult toResult( ::tink::streams::Conclusion c, ::Dynamic result,::Dynamic buffered);
+ static ::Dynamic toResult_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace io
+
+#endif /* INCLUDED_tink_io_PipeResultTools */
diff --git a/Sources/c_snikket/iinclude/include/tink/io/RealSourceTools.h b/Sources/c_snikket/iinclude/include/tink/io/RealSourceTools.h
new file mode 100644
index 0000000..40852fc
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/io/RealSourceTools.h
@@ -0,0 +1,72 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io_RealSourceTools
+#define INCLUDED_tink_io_RealSourceTools
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,io,RealSourceTools)
+HX_DECLARE_CLASS2(tink,io,StreamParserObject)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES RealSourceTools_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef RealSourceTools_obj OBJ_;
+ RealSourceTools_obj();
+
+ public:
+ enum { _hx_ClassId = 0x688b0f4a };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.io.RealSourceTools")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.io.RealSourceTools"); }
+
+ inline static ::hx::ObjectPtr< RealSourceTools_obj > __new() {
+ ::hx::ObjectPtr< RealSourceTools_obj > __this = new RealSourceTools_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< RealSourceTools_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ RealSourceTools_obj *__this = (RealSourceTools_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(RealSourceTools_obj), false, "tink.io.RealSourceTools"));
+ *(void **)__this = RealSourceTools_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~RealSourceTools_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("RealSourceTools",62,cc,13,d9); }
+
+ static ::tink::core::_Future::FutureObject all(::Dynamic s);
+ static ::Dynamic all_dyn();
+
+ static ::tink::core::_Future::FutureObject parse(::Dynamic s,::Dynamic p);
+ static ::Dynamic parse_dyn();
+
+ static ::Dynamic idealize(::Dynamic s, ::Dynamic rescue);
+ static ::Dynamic idealize_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace io
+
+#endif /* INCLUDED_tink_io_RealSourceTools */
diff --git a/Sources/c_snikket/iinclude/include/tink/io/SinkBase.h b/Sources/c_snikket/iinclude/include/tink/io/SinkBase.h
new file mode 100644
index 0000000..30475bb
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/io/SinkBase.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io_SinkBase
+#define INCLUDED_tink_io_SinkBase
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_io_SinkObject
+#include <tink/io/SinkObject.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,io,SinkBase)
+HX_DECLARE_CLASS2(tink,io,SinkObject)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES SinkBase_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef SinkBase_obj OBJ_;
+ SinkBase_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1efa06a0 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.io.SinkBase")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.io.SinkBase"); }
+
+ inline static ::hx::ObjectPtr< SinkBase_obj > __new() {
+ ::hx::ObjectPtr< SinkBase_obj > __this = new SinkBase_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< SinkBase_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ SinkBase_obj *__this = (SinkBase_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(SinkBase_obj), false, "tink.io.SinkBase"));
+ *(void **)__this = SinkBase_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SinkBase_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("SinkBase",24,8c,b4,5c); }
+
+ virtual ::tink::core::_Future::FutureObject consume(::Dynamic source, ::Dynamic options);
+ ::Dynamic consume_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace io
+
+#endif /* INCLUDED_tink_io_SinkBase */
diff --git a/Sources/c_snikket/iinclude/include/tink/io/SinkObject.h b/Sources/c_snikket/iinclude/include/tink/io/SinkObject.h
new file mode 100644
index 0000000..bf9b6e3
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/io/SinkObject.h
@@ -0,0 +1,31 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io_SinkObject
+#define INCLUDED_tink_io_SinkObject
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,io,SinkObject)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES SinkObject_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ ::tink::core::_Future::FutureObject (::hx::Object :: *_hx_consume)(::Dynamic source, ::Dynamic options);
+ static inline ::tink::core::_Future::FutureObject consume( ::Dynamic _hx_,::Dynamic source, ::Dynamic options) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::io::SinkObject_obj *>(_hx_.mPtr->_hx_getInterface(0x483020ea)))->_hx_consume)(source,options);
+ }
+};
+
+} // end namespace tink
+} // end namespace io
+
+#endif /* INCLUDED_tink_io_SinkObject */
diff --git a/Sources/c_snikket/iinclude/include/tink/io/StreamParserObject.h b/Sources/c_snikket/iinclude/include/tink/io/StreamParserObject.h
new file mode 100644
index 0000000..290d16b
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/io/StreamParserObject.h
@@ -0,0 +1,36 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io_StreamParserObject
+#define INCLUDED_tink_io_StreamParserObject
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,chunk,ChunkCursor)
+HX_DECLARE_CLASS2(tink,core,Outcome)
+HX_DECLARE_CLASS2(tink,io,ParseStep)
+HX_DECLARE_CLASS2(tink,io,StreamParserObject)
+
+namespace tink{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES StreamParserObject_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ ::tink::io::ParseStep (::hx::Object :: *_hx_progress)( ::tink::chunk::ChunkCursor cursor);
+ static inline ::tink::io::ParseStep progress( ::Dynamic _hx_, ::tink::chunk::ChunkCursor cursor) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::io::StreamParserObject_obj *>(_hx_.mPtr->_hx_getInterface(0x048ef116)))->_hx_progress)(cursor);
+ }
+ ::tink::core::Outcome (::hx::Object :: *_hx_eof)( ::tink::chunk::ChunkCursor rest);
+ static inline ::tink::core::Outcome eof( ::Dynamic _hx_, ::tink::chunk::ChunkCursor rest) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::io::StreamParserObject_obj *>(_hx_.mPtr->_hx_getInterface(0x048ef116)))->_hx_eof)(rest);
+ }
+};
+
+} // end namespace tink
+} // end namespace io
+
+#endif /* INCLUDED_tink_io_StreamParserObject */
diff --git a/Sources/c_snikket/iinclude/include/tink/io/WorkerObject.h b/Sources/c_snikket/iinclude/include/tink/io/WorkerObject.h
new file mode 100644
index 0000000..152ff58
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/io/WorkerObject.h
@@ -0,0 +1,32 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io_WorkerObject
+#define INCLUDED_tink_io_WorkerObject
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS3(tink,core,_Lazy,Computable)
+HX_DECLARE_CLASS3(tink,core,_Lazy,LazyObject)
+HX_DECLARE_CLASS2(tink,io,WorkerObject)
+
+namespace tink{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES WorkerObject_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ ::tink::core::_Future::FutureObject (::hx::Object :: *_hx_work)(::Dynamic task);
+ static inline ::tink::core::_Future::FutureObject work( ::Dynamic _hx_,::Dynamic task) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::io::WorkerObject_obj *>(_hx_.mPtr->_hx_getInterface(0xdcf3fb55)))->_hx_work)(task);
+ }
+};
+
+} // end namespace tink
+} // end namespace io
+
+#endif /* INCLUDED_tink_io_WorkerObject */
diff --git a/Sources/c_snikket/iinclude/include/tink/io/_Sink/SinkYielding_Impl_.h b/Sources/c_snikket/iinclude/include/tink/io/_Sink/SinkYielding_Impl_.h
new file mode 100644
index 0000000..2e51a31
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/io/_Sink/SinkYielding_Impl_.h
@@ -0,0 +1,66 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io__Sink_SinkYielding_Impl_
+#define INCLUDED_tink_io__Sink_SinkYielding_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,io,Output)
+HX_DECLARE_CLASS2(tink,io,SinkObject)
+HX_DECLARE_CLASS3(tink,io,_Sink,SinkYielding_Impl_)
+
+namespace tink{
+namespace io{
+namespace _Sink{
+
+
+class HXCPP_CLASS_ATTRIBUTES SinkYielding_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef SinkYielding_Impl__obj OBJ_;
+ SinkYielding_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x1dd8821a };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.io._Sink.SinkYielding_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.io._Sink.SinkYielding_Impl_"); }
+
+ inline static ::hx::ObjectPtr< SinkYielding_Impl__obj > __new() {
+ ::hx::ObjectPtr< SinkYielding_Impl__obj > __this = new SinkYielding_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< SinkYielding_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ SinkYielding_Impl__obj *__this = (SinkYielding_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(SinkYielding_Impl__obj), false, "tink.io._Sink.SinkYielding_Impl_"));
+ *(void **)__this = SinkYielding_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SinkYielding_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("SinkYielding_Impl_",e8,ec,49,5e); }
+
+ static ::Dynamic ofOutput(::String name, ::haxe::io::Output target, ::Dynamic options);
+ static ::Dynamic ofOutput_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace io
+} // end namespace _Sink
+
+#endif /* INCLUDED_tink_io__Sink_SinkYielding_Impl_ */
diff --git a/Sources/c_snikket/iinclude/include/tink/io/_Source/Source_Impl_.h b/Sources/c_snikket/iinclude/include/tink/io/_Source/Source_Impl_.h
new file mode 100644
index 0000000..d119491
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/io/_Source/Source_Impl_.h
@@ -0,0 +1,82 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io__Source_Source_Impl_
+#define INCLUDED_tink_io__Source_Source_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,io,SinkObject)
+HX_DECLARE_CLASS3(tink,io,_Source,Source_Impl_)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace io{
+namespace _Source{
+
+
+class HXCPP_CLASS_ATTRIBUTES Source_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Source_Impl__obj OBJ_;
+ Source_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x52c5539d };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.io._Source.Source_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.io._Source.Source_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Source_Impl__obj > __new() {
+ ::hx::ObjectPtr< Source_Impl__obj > __this = new Source_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Source_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Source_Impl__obj *__this = (Source_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Source_Impl__obj), false, "tink.io._Source.Source_Impl_"));
+ *(void **)__this = Source_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Source_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Source_Impl_",db,cf,0d,d6); }
+
+ static void __boot();
+ static ::Dynamic EMPTY;
+ static ::Dynamic chunked(::Dynamic this1);
+ static ::Dynamic chunked_dyn();
+
+ static ::tink::core::_Future::FutureObject concatAll(::Dynamic s);
+ static ::Dynamic concatAll_dyn();
+
+ static ::tink::core::_Future::FutureObject pipeTo(::Dynamic this1,::Dynamic target, ::Dynamic options);
+ static ::Dynamic pipeTo_dyn();
+
+ static ::Dynamic limit(::Dynamic this1,int len);
+ static ::Dynamic limit_dyn();
+
+ static ::Dynamic ofError( ::tink::core::TypedError e);
+ static ::Dynamic ofError_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace io
+} // end namespace _Source
+
+#endif /* INCLUDED_tink_io__Source_Source_Impl_ */
diff --git a/Sources/c_snikket/iinclude/include/tink/io/_StreamParser/StreamParser_Impl_.h b/Sources/c_snikket/iinclude/include/tink/io/_StreamParser/StreamParser_Impl_.h
new file mode 100644
index 0000000..357b028
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/io/_StreamParser/StreamParser_Impl_.h
@@ -0,0 +1,70 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io__StreamParser_StreamParser_Impl_
+#define INCLUDED_tink_io__StreamParser_StreamParser_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,io,StreamParserObject)
+HX_DECLARE_CLASS3(tink,io,_StreamParser,StreamParser_Impl_)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace io{
+namespace _StreamParser{
+
+
+class HXCPP_CLASS_ATTRIBUTES StreamParser_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef StreamParser_Impl__obj OBJ_;
+ StreamParser_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x18cfe7c1 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.io._StreamParser.StreamParser_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.io._StreamParser.StreamParser_Impl_"); }
+
+ inline static ::hx::ObjectPtr< StreamParser_Impl__obj > __new() {
+ ::hx::ObjectPtr< StreamParser_Impl__obj > __this = new StreamParser_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< StreamParser_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ StreamParser_Impl__obj *__this = (StreamParser_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(StreamParser_Impl__obj), false, "tink.io._StreamParser.StreamParser_Impl_"));
+ *(void **)__this = StreamParser_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~StreamParser_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("StreamParser_Impl_",7f,8f,ef,63); }
+
+ static ::tink::core::_Future::FutureObject doParse(::Dynamic source,::Dynamic p, ::Dynamic consume, ::Dynamic finish);
+ static ::Dynamic doParse_dyn();
+
+ static ::tink::core::_Future::FutureObject parse(::Dynamic s,::Dynamic p);
+ static ::Dynamic parse_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace io
+} // end namespace _StreamParser
+
+#endif /* INCLUDED_tink_io__StreamParser_StreamParser_Impl_ */
diff --git a/Sources/c_snikket/iinclude/include/tink/io/_Worker/EagerWorker.h b/Sources/c_snikket/iinclude/include/tink/io/_Worker/EagerWorker.h
new file mode 100644
index 0000000..0529ae7
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/io/_Worker/EagerWorker.h
@@ -0,0 +1,61 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io__Worker_EagerWorker
+#define INCLUDED_tink_io__Worker_EagerWorker
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_io_WorkerObject
+#include <tink/io/WorkerObject.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS3(tink,core,_Lazy,Computable)
+HX_DECLARE_CLASS3(tink,core,_Lazy,LazyObject)
+HX_DECLARE_CLASS2(tink,io,WorkerObject)
+HX_DECLARE_CLASS3(tink,io,_Worker,EagerWorker)
+
+namespace tink{
+namespace io{
+namespace _Worker{
+
+
+class HXCPP_CLASS_ATTRIBUTES EagerWorker_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef EagerWorker_obj OBJ_;
+ EagerWorker_obj();
+
+ public:
+ enum { _hx_ClassId = 0x49fe0131 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.io._Worker.EagerWorker")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.io._Worker.EagerWorker"); }
+ static ::hx::ObjectPtr< EagerWorker_obj > __new();
+ static ::hx::ObjectPtr< EagerWorker_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~EagerWorker_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("EagerWorker",36,20,f4,8a); }
+
+ ::tink::core::_Future::FutureObject work(::Dynamic task);
+ ::Dynamic work_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace io
+} // end namespace _Worker
+
+#endif /* INCLUDED_tink_io__Worker_EagerWorker */
diff --git a/Sources/c_snikket/iinclude/include/tink/io/_Worker/Worker_Impl_.h b/Sources/c_snikket/iinclude/include/tink/io/_Worker/Worker_Impl_.h
new file mode 100644
index 0000000..76182c0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/io/_Worker/Worker_Impl_.h
@@ -0,0 +1,77 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io__Worker_Worker_Impl_
+#define INCLUDED_tink_io__Worker_Worker_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS3(tink,core,_Lazy,Computable)
+HX_DECLARE_CLASS3(tink,core,_Lazy,LazyObject)
+HX_DECLARE_CLASS2(tink,io,WorkerObject)
+HX_DECLARE_CLASS3(tink,io,_Worker,Worker_Impl_)
+
+namespace tink{
+namespace io{
+namespace _Worker{
+
+
+class HXCPP_CLASS_ATTRIBUTES Worker_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Worker_Impl__obj OBJ_;
+ Worker_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x132db49b };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.io._Worker.Worker_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.io._Worker.Worker_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Worker_Impl__obj > __new() {
+ ::hx::ObjectPtr< Worker_Impl__obj > __this = new Worker_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Worker_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Worker_Impl__obj *__this = (Worker_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Worker_Impl__obj), false, "tink.io._Worker.Worker_Impl_"));
+ *(void **)__this = Worker_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Worker_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Worker_Impl_",be,2b,8e,66); }
+
+ static void __boot();
+ static ::Dynamic EAGER;
+ static ::Array< ::Dynamic> pool;
+ static ::Dynamic ensure(::Dynamic this1);
+ static ::Dynamic ensure_dyn();
+
+ static ::Dynamic get();
+ static ::Dynamic get_dyn();
+
+ static ::tink::core::_Future::FutureObject work(::Dynamic this1,::Dynamic task);
+ static ::Dynamic work_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace io
+} // end namespace _Worker
+
+#endif /* INCLUDED_tink_io__Worker_Worker_Impl_ */
diff --git a/Sources/c_snikket/iinclude/include/tink/io/std/InputSource.h b/Sources/c_snikket/iinclude/include/tink/io/std/InputSource.h
new file mode 100644
index 0000000..0a66a9d
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/io/std/InputSource.h
@@ -0,0 +1,58 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io_std_InputSource
+#define INCLUDED_tink_io_std_InputSource
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_streams_Generator
+#include <tink/streams/Generator.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,Input)
+HX_DECLARE_CLASS2(tink,io,WorkerObject)
+HX_DECLARE_CLASS3(tink,io,std,InputSource)
+HX_DECLARE_CLASS2(tink,streams,Generator)
+HX_DECLARE_CLASS2(tink,streams,StreamBase)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace io{
+namespace std{
+
+
+class HXCPP_CLASS_ATTRIBUTES InputSource_obj : public ::tink::streams::Generator_obj
+{
+ public:
+ typedef ::tink::streams::Generator_obj super;
+ typedef InputSource_obj OBJ_;
+ InputSource_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0f2d2d9e };
+
+ void __construct(::String name, ::haxe::io::Input target,::Dynamic worker, ::haxe::io::Bytes buf,int offset);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.io.std.InputSource")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.io.std.InputSource"); }
+ static ::hx::ObjectPtr< InputSource_obj > __new(::String name, ::haxe::io::Input target,::Dynamic worker, ::haxe::io::Bytes buf,int offset);
+ static ::hx::ObjectPtr< InputSource_obj > __alloc(::hx::Ctx *_hx_ctx,::String name, ::haxe::io::Input target,::Dynamic worker, ::haxe::io::Bytes buf,int offset);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~InputSource_obj();
+
+ HX_DO_RTTI_ALL;
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("InputSource",65,24,98,0b); }
+
+};
+
+} // end namespace tink
+} // end namespace io
+} // end namespace std
+
+#endif /* INCLUDED_tink_io_std_InputSource */
diff --git a/Sources/c_snikket/iinclude/include/tink/io/std/OutputSink.h b/Sources/c_snikket/iinclude/include/tink/io/std/OutputSink.h
new file mode 100644
index 0000000..56470b3
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/io/std/OutputSink.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io_std_OutputSink
+#define INCLUDED_tink_io_std_OutputSink
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_io_SinkBase
+#include <tink/io/SinkBase.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Output)
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,io,SinkBase)
+HX_DECLARE_CLASS2(tink,io,SinkObject)
+HX_DECLARE_CLASS2(tink,io,WorkerObject)
+HX_DECLARE_CLASS3(tink,io,std,OutputSink)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace io{
+namespace std{
+
+
+class HXCPP_CLASS_ATTRIBUTES OutputSink_obj : public ::tink::io::SinkBase_obj
+{
+ public:
+ typedef ::tink::io::SinkBase_obj super;
+ typedef OutputSink_obj OBJ_;
+ OutputSink_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1eacaafb };
+
+ void __construct(::String name, ::haxe::io::Output target,::Dynamic worker);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.io.std.OutputSink")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.io.std.OutputSink"); }
+ static ::hx::ObjectPtr< OutputSink_obj > __new(::String name, ::haxe::io::Output target,::Dynamic worker);
+ static ::hx::ObjectPtr< OutputSink_obj > __alloc(::hx::Ctx *_hx_ctx,::String name, ::haxe::io::Output target,::Dynamic worker);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~OutputSink_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("OutputSink",14,ea,f8,a4); }
+
+ ::String name;
+ ::haxe::io::Output target;
+ ::Dynamic worker;
+ ::tink::core::_Future::FutureObject consume(::Dynamic source, ::Dynamic options);
+
+};
+
+} // end namespace tink
+} // end namespace io
+} // end namespace std
+
+#endif /* INCLUDED_tink_io_std_OutputSink */
diff --git a/Sources/c_snikket/iinclude/include/tink/streams/Conclusion.h b/Sources/c_snikket/iinclude/include/tink/streams/Conclusion.h
new file mode 100644
index 0000000..94b9893
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/streams/Conclusion.h
@@ -0,0 +1,43 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_Conclusion
+#define INCLUDED_tink_streams_Conclusion
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS2(tink,streams,Conclusion)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+namespace tink{
+namespace streams{
+
+
+class Conclusion_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef Conclusion_obj OBJ_;
+
+ public:
+ Conclusion_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.streams.Conclusion",96,99,43,ae); }
+ ::String __ToString() const { return HX_("Conclusion.",4f,54,5d,ac) + _hx_tag; }
+
+ static ::tink::streams::Conclusion Clogged( ::tink::core::TypedError error,::Dynamic at);
+ static ::Dynamic Clogged_dyn();
+ static ::tink::streams::Conclusion Depleted;
+ static inline ::tink::streams::Conclusion Depleted_dyn() { return Depleted; }
+ static ::tink::streams::Conclusion Failed( ::tink::core::TypedError error);
+ static ::Dynamic Failed_dyn();
+ static ::tink::streams::Conclusion Halted(::Dynamic rest);
+ static ::Dynamic Halted_dyn();
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_Conclusion */
diff --git a/Sources/c_snikket/iinclude/include/tink/streams/Empty.h b/Sources/c_snikket/iinclude/include/tink/streams/Empty.h
new file mode 100644
index 0000000..c56d215
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/streams/Empty.h
@@ -0,0 +1,65 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_Empty
+#define INCLUDED_tink_streams_Empty
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_streams_StreamBase
+#include <tink/streams/StreamBase.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,streams,Empty)
+HX_DECLARE_CLASS2(tink,streams,StreamBase)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace streams{
+
+
+class HXCPP_CLASS_ATTRIBUTES Empty_obj : public ::tink::streams::StreamBase_obj
+{
+ public:
+ typedef ::tink::streams::StreamBase_obj super;
+ typedef Empty_obj OBJ_;
+ Empty_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0b521554 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.streams.Empty")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.streams.Empty"); }
+ static ::hx::ObjectPtr< Empty_obj > __new();
+ static ::hx::ObjectPtr< Empty_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Empty_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Empty",6d,aa,07,03); }
+
+ static void __boot();
+ static ::tink::streams::Empty inst;
+ static ::Dynamic make();
+ static ::Dynamic make_dyn();
+
+ bool get_depleted();
+
+ ::tink::core::_Future::FutureObject forEach( ::Dynamic handler);
+
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_Empty */
diff --git a/Sources/c_snikket/iinclude/include/tink/streams/FutureStream.h b/Sources/c_snikket/iinclude/include/tink/streams/FutureStream.h
new file mode 100644
index 0000000..6e2ba9d
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/streams/FutureStream.h
@@ -0,0 +1,61 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_FutureStream
+#define INCLUDED_tink_streams_FutureStream
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_streams_StreamBase
+#include <tink/streams/StreamBase.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,streams,FutureStream)
+HX_DECLARE_CLASS2(tink,streams,StreamBase)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace streams{
+
+
+class HXCPP_CLASS_ATTRIBUTES FutureStream_obj : public ::tink::streams::StreamBase_obj
+{
+ public:
+ typedef ::tink::streams::StreamBase_obj super;
+ typedef FutureStream_obj OBJ_;
+ FutureStream_obj();
+
+ public:
+ enum { _hx_ClassId = 0x04fe513c };
+
+ void __construct( ::tink::core::_Future::FutureObject f);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.streams.FutureStream")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.streams.FutureStream"); }
+ static ::hx::ObjectPtr< FutureStream_obj > __new( ::tink::core::_Future::FutureObject f);
+ static ::hx::ObjectPtr< FutureStream_obj > __alloc(::hx::Ctx *_hx_ctx, ::tink::core::_Future::FutureObject f);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~FutureStream_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("FutureStream",43,81,42,90); }
+
+ ::tink::core::_Future::FutureObject f;
+ ::tink::core::_Future::FutureObject forEach( ::Dynamic handler);
+
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_FutureStream */
diff --git a/Sources/c_snikket/iinclude/include/tink/streams/Generator.h b/Sources/c_snikket/iinclude/include/tink/streams/Generator.h
new file mode 100644
index 0000000..62a0082
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/streams/Generator.h
@@ -0,0 +1,61 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_Generator
+#define INCLUDED_tink_streams_Generator
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_streams_StreamBase
+#include <tink/streams/StreamBase.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,streams,Generator)
+HX_DECLARE_CLASS2(tink,streams,StreamBase)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace streams{
+
+
+class HXCPP_CLASS_ATTRIBUTES Generator_obj : public ::tink::streams::StreamBase_obj
+{
+ public:
+ typedef ::tink::streams::StreamBase_obj super;
+ typedef Generator_obj OBJ_;
+ Generator_obj();
+
+ public:
+ enum { _hx_ClassId = 0x50a767d2 };
+
+ void __construct( ::tink::core::_Future::FutureObject upcoming);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.streams.Generator")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.streams.Generator"); }
+ static ::hx::ObjectPtr< Generator_obj > __new( ::tink::core::_Future::FutureObject upcoming);
+ static ::hx::ObjectPtr< Generator_obj > __alloc(::hx::Ctx *_hx_ctx, ::tink::core::_Future::FutureObject upcoming);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Generator_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Generator",33,d8,43,36); }
+
+ ::tink::core::_Future::FutureObject upcoming;
+ ::tink::core::_Future::FutureObject forEach( ::Dynamic handler);
+
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_Generator */
diff --git a/Sources/c_snikket/iinclude/include/tink/streams/Handled.h b/Sources/c_snikket/iinclude/include/tink/streams/Handled.h
new file mode 100644
index 0000000..f35f350
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/streams/Handled.h
@@ -0,0 +1,42 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_Handled
+#define INCLUDED_tink_streams_Handled
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS2(tink,streams,Handled)
+namespace tink{
+namespace streams{
+
+
+class Handled_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef Handled_obj OBJ_;
+
+ public:
+ Handled_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.streams.Handled",a5,94,ee,d9); }
+ ::String __ToString() const { return HX_("Handled.",12,d1,d5,ae) + _hx_tag; }
+
+ static ::tink::streams::Handled BackOff;
+ static inline ::tink::streams::Handled BackOff_dyn() { return BackOff; }
+ static ::tink::streams::Handled Clog( ::tink::core::TypedError e);
+ static ::Dynamic Clog_dyn();
+ static ::tink::streams::Handled Finish;
+ static inline ::tink::streams::Handled Finish_dyn() { return Finish; }
+ static ::tink::streams::Handled Resume;
+ static inline ::tink::streams::Handled Resume_dyn() { return Resume; }
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_Handled */
diff --git a/Sources/c_snikket/iinclude/include/tink/streams/IdealStreamBase.h b/Sources/c_snikket/iinclude/include/tink/streams/IdealStreamBase.h
new file mode 100644
index 0000000..6d2b2da
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/streams/IdealStreamBase.h
@@ -0,0 +1,56 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_IdealStreamBase
+#define INCLUDED_tink_streams_IdealStreamBase
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_streams_StreamBase
+#include <tink/streams/StreamBase.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS2(tink,streams,IdealStreamBase)
+HX_DECLARE_CLASS2(tink,streams,StreamBase)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace streams{
+
+
+class HXCPP_CLASS_ATTRIBUTES IdealStreamBase_obj : public ::tink::streams::StreamBase_obj
+{
+ public:
+ typedef ::tink::streams::StreamBase_obj super;
+ typedef IdealStreamBase_obj OBJ_;
+ IdealStreamBase_obj();
+
+ public:
+ enum { _hx_ClassId = 0x79ca79c9 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.streams.IdealStreamBase")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.streams.IdealStreamBase"); }
+ static ::hx::ObjectPtr< IdealStreamBase_obj > __new();
+ static ::hx::ObjectPtr< IdealStreamBase_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~IdealStreamBase_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("IdealStreamBase",86,d8,f0,d8); }
+
+ ::Dynamic idealize( ::Dynamic _tmp_rescue);
+
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_IdealStreamBase */
diff --git a/Sources/c_snikket/iinclude/include/tink/streams/IdealizeStream.h b/Sources/c_snikket/iinclude/include/tink/streams/IdealizeStream.h
new file mode 100644
index 0000000..ef12b38
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/streams/IdealizeStream.h
@@ -0,0 +1,67 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_IdealizeStream
+#define INCLUDED_tink_streams_IdealizeStream
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_streams_IdealStreamBase
+#include <tink/streams/IdealStreamBase.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,streams,IdealStreamBase)
+HX_DECLARE_CLASS2(tink,streams,IdealizeStream)
+HX_DECLARE_CLASS2(tink,streams,StreamBase)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace streams{
+
+
+class HXCPP_CLASS_ATTRIBUTES IdealizeStream_obj : public ::tink::streams::IdealStreamBase_obj
+{
+ public:
+ typedef ::tink::streams::IdealStreamBase_obj super;
+ typedef IdealizeStream_obj OBJ_;
+ IdealizeStream_obj();
+
+ public:
+ enum { _hx_ClassId = 0x15b188e0 };
+
+ void __construct(::Dynamic target, ::Dynamic rescue);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.streams.IdealizeStream")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.streams.IdealizeStream"); }
+ static ::hx::ObjectPtr< IdealizeStream_obj > __new(::Dynamic target, ::Dynamic rescue);
+ static ::hx::ObjectPtr< IdealizeStream_obj > __alloc(::hx::Ctx *_hx_ctx,::Dynamic target, ::Dynamic rescue);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~IdealizeStream_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("IdealizeStream",df,18,9d,1b); }
+
+ ::Dynamic target;
+ ::Dynamic rescue;
+ Dynamic rescue_dyn() { return rescue;}
+ bool get_depleted();
+
+ ::tink::core::_Future::FutureObject forEach( ::Dynamic handler);
+
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_IdealizeStream */
diff --git a/Sources/c_snikket/iinclude/include/tink/streams/Reduction.h b/Sources/c_snikket/iinclude/include/tink/streams/Reduction.h
new file mode 100644
index 0000000..5d8fe33
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/streams/Reduction.h
@@ -0,0 +1,41 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_Reduction
+#define INCLUDED_tink_streams_Reduction
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS2(tink,streams,Reduction)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+namespace tink{
+namespace streams{
+
+
+class Reduction_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef Reduction_obj OBJ_;
+
+ public:
+ Reduction_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.streams.Reduction",5c,50,fe,4b); }
+ ::String __ToString() const { return HX_("Reduction.",bb,b1,a8,cf) + _hx_tag; }
+
+ static ::tink::streams::Reduction Crashed( ::tink::core::TypedError error,::Dynamic at);
+ static ::Dynamic Crashed_dyn();
+ static ::tink::streams::Reduction Failed( ::tink::core::TypedError error);
+ static ::Dynamic Failed_dyn();
+ static ::tink::streams::Reduction Reduced( ::Dynamic result);
+ static ::Dynamic Reduced_dyn();
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_Reduction */
diff --git a/Sources/c_snikket/iinclude/include/tink/streams/ReductionStep.h b/Sources/c_snikket/iinclude/include/tink/streams/ReductionStep.h
new file mode 100644
index 0000000..a20fdfd
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/streams/ReductionStep.h
@@ -0,0 +1,38 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_ReductionStep
+#define INCLUDED_tink_streams_ReductionStep
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS2(tink,streams,ReductionStep)
+namespace tink{
+namespace streams{
+
+
+class ReductionStep_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef ReductionStep_obj OBJ_;
+
+ public:
+ ReductionStep_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.streams.ReductionStep",c8,c1,78,61); }
+ ::String __ToString() const { return HX_("ReductionStep.",4f,e7,10,f7) + _hx_tag; }
+
+ static ::tink::streams::ReductionStep Crash( ::tink::core::TypedError e);
+ static ::Dynamic Crash_dyn();
+ static ::tink::streams::ReductionStep Progress( ::Dynamic result);
+ static ::Dynamic Progress_dyn();
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_ReductionStep */
diff --git a/Sources/c_snikket/iinclude/include/tink/streams/RegroupResult.h b/Sources/c_snikket/iinclude/include/tink/streams/RegroupResult.h
new file mode 100644
index 0000000..d8b27a2
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/streams/RegroupResult.h
@@ -0,0 +1,44 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_RegroupResult
+#define INCLUDED_tink_streams_RegroupResult
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,ds,Option)
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS2(tink,streams,RegroupResult)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+namespace tink{
+namespace streams{
+
+
+class RegroupResult_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef RegroupResult_obj OBJ_;
+
+ public:
+ RegroupResult_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.streams.RegroupResult",52,26,01,31); }
+ ::String __ToString() const { return HX_("RegroupResult.",85,7b,e0,be) + _hx_tag; }
+
+ static ::tink::streams::RegroupResult Converted(::Dynamic data,::cpp::VirtualArray untouched);
+ static ::Dynamic Converted_dyn();
+ static ::tink::streams::RegroupResult Errored( ::tink::core::TypedError e);
+ static ::Dynamic Errored_dyn();
+ static ::tink::streams::RegroupResult Terminated( ::haxe::ds::Option data);
+ static ::Dynamic Terminated_dyn();
+ static ::tink::streams::RegroupResult Untouched;
+ static inline ::tink::streams::RegroupResult Untouched_dyn() { return Untouched; }
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_RegroupResult */
diff --git a/Sources/c_snikket/iinclude/include/tink/streams/RegroupStatus.h b/Sources/c_snikket/iinclude/include/tink/streams/RegroupStatus.h
new file mode 100644
index 0000000..7177b22
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/streams/RegroupStatus.h
@@ -0,0 +1,40 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_RegroupStatus
+#define INCLUDED_tink_streams_RegroupStatus
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS2(tink,streams,RegroupStatus)
+namespace tink{
+namespace streams{
+
+
+class RegroupStatus_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef RegroupStatus_obj OBJ_;
+
+ public:
+ RegroupStatus_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.streams.RegroupStatus",a7,a4,78,2e); }
+ ::String __ToString() const { return HX_("RegroupStatus.",90,87,f7,89) + _hx_tag; }
+
+ static ::tink::streams::RegroupStatus Ended;
+ static inline ::tink::streams::RegroupStatus Ended_dyn() { return Ended; }
+ static ::tink::streams::RegroupStatus Errored( ::tink::core::TypedError e);
+ static ::Dynamic Errored_dyn();
+ static ::tink::streams::RegroupStatus Flowing;
+ static inline ::tink::streams::RegroupStatus Flowing_dyn() { return Flowing; }
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_RegroupStatus */
diff --git a/Sources/c_snikket/iinclude/include/tink/streams/Single.h b/Sources/c_snikket/iinclude/include/tink/streams/Single.h
new file mode 100644
index 0000000..fc74928
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/streams/Single.h
@@ -0,0 +1,63 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_Single
+#define INCLUDED_tink_streams_Single
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_streams_StreamBase
+#include <tink/streams/StreamBase.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS3(tink,core,_Lazy,Computable)
+HX_DECLARE_CLASS3(tink,core,_Lazy,LazyObject)
+HX_DECLARE_CLASS2(tink,streams,Single)
+HX_DECLARE_CLASS2(tink,streams,StreamBase)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace streams{
+
+
+class HXCPP_CLASS_ATTRIBUTES Single_obj : public ::tink::streams::StreamBase_obj
+{
+ public:
+ typedef ::tink::streams::StreamBase_obj super;
+ typedef Single_obj OBJ_;
+ Single_obj();
+
+ public:
+ enum { _hx_ClassId = 0x2688f9e1 };
+
+ void __construct(::Dynamic value);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.streams.Single")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.streams.Single"); }
+ static ::hx::ObjectPtr< Single_obj > __new(::Dynamic value);
+ static ::hx::ObjectPtr< Single_obj > __alloc(::hx::Ctx *_hx_ctx,::Dynamic value);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Single_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Single",a8,da,b5,ed); }
+
+ ::Dynamic value;
+ ::tink::core::_Future::FutureObject forEach( ::Dynamic handle);
+
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_Single */
diff --git a/Sources/c_snikket/iinclude/include/tink/streams/Step.h b/Sources/c_snikket/iinclude/include/tink/streams/Step.h
new file mode 100644
index 0000000..e200806
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/streams/Step.h
@@ -0,0 +1,41 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_Step
+#define INCLUDED_tink_streams_Step
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS2(tink,streams,Step)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+namespace tink{
+namespace streams{
+
+
+class Step_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef Step_obj OBJ_;
+
+ public:
+ Step_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.streams.Step",c3,c6,00,cc); }
+ ::String __ToString() const { return HX_("Step.",42,eb,3b,17) + _hx_tag; }
+
+ static ::tink::streams::Step End;
+ static inline ::tink::streams::Step End_dyn() { return End; }
+ static ::tink::streams::Step Fail( ::tink::core::TypedError e);
+ static ::Dynamic Fail_dyn();
+ static ::tink::streams::Step Link( ::Dynamic value,::Dynamic next);
+ static ::Dynamic Link_dyn();
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_Step */
diff --git a/Sources/c_snikket/iinclude/include/tink/streams/StreamBase.h b/Sources/c_snikket/iinclude/include/tink/streams/StreamBase.h
new file mode 100644
index 0000000..92259cf
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/streams/StreamBase.h
@@ -0,0 +1,77 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_StreamBase
+#define INCLUDED_tink_streams_StreamBase
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_streams_StreamObject
+#include <tink/streams/StreamObject.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,streams,StreamBase)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace streams{
+
+
+class HXCPP_CLASS_ATTRIBUTES StreamBase_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef StreamBase_obj OBJ_;
+ StreamBase_obj();
+
+ public:
+ enum { _hx_ClassId = 0x61521c8a };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.streams.StreamBase")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.streams.StreamBase"); }
+ static ::hx::ObjectPtr< StreamBase_obj > __new();
+ static ::hx::ObjectPtr< StreamBase_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~StreamBase_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("StreamBase",d1,6c,2c,85); }
+
+ virtual bool get_depleted();
+ ::Dynamic get_depleted_dyn();
+
+ ::Dynamic regroup( ::Dynamic f);
+ ::Dynamic regroup_dyn();
+
+ ::Dynamic prepend(::Dynamic other);
+ ::Dynamic prepend_dyn();
+
+ virtual void decompose(::Array< ::Dynamic> into);
+ ::Dynamic decompose_dyn();
+
+ virtual ::Dynamic idealize( ::Dynamic rescue);
+ ::Dynamic idealize_dyn();
+
+ ::tink::core::_Future::FutureObject reduce( ::Dynamic initial, ::Dynamic reducer);
+ ::Dynamic reduce_dyn();
+
+ virtual ::tink::core::_Future::FutureObject forEach( ::Dynamic handler);
+ ::Dynamic forEach_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_StreamBase */
diff --git a/Sources/c_snikket/iinclude/include/tink/streams/StreamObject.h b/Sources/c_snikket/iinclude/include/tink/streams/StreamObject.h
new file mode 100644
index 0000000..5a2bbc9
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/streams/StreamObject.h
@@ -0,0 +1,55 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_StreamObject
+#define INCLUDED_tink_streams_StreamObject
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace streams{
+
+
+class HXCPP_CLASS_ATTRIBUTES StreamObject_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ bool (::hx::Object :: *_hx_get_depleted)();
+ static inline bool get_depleted( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::streams::StreamObject_obj *>(_hx_.mPtr->_hx_getInterface(0x6164ac00)))->_hx_get_depleted)();
+ }
+ ::Dynamic (::hx::Object :: *_hx_regroup)( ::Dynamic f);
+ static inline ::Dynamic regroup( ::Dynamic _hx_, ::Dynamic f) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::streams::StreamObject_obj *>(_hx_.mPtr->_hx_getInterface(0x6164ac00)))->_hx_regroup)(f);
+ }
+ ::Dynamic (::hx::Object :: *_hx_idealize)( ::Dynamic rescue);
+ static inline ::Dynamic idealize( ::Dynamic _hx_, ::Dynamic rescue) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::streams::StreamObject_obj *>(_hx_.mPtr->_hx_getInterface(0x6164ac00)))->_hx_idealize)(rescue);
+ }
+ ::Dynamic (::hx::Object :: *_hx_prepend)(::Dynamic other);
+ static inline ::Dynamic prepend( ::Dynamic _hx_,::Dynamic other) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::streams::StreamObject_obj *>(_hx_.mPtr->_hx_getInterface(0x6164ac00)))->_hx_prepend)(other);
+ }
+ void (::hx::Object :: *_hx_decompose)(::Array< ::Dynamic> into);
+ static inline void decompose( ::Dynamic _hx_,::Array< ::Dynamic> into) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::tink::streams::StreamObject_obj *>(_hx_.mPtr->_hx_getInterface(0x6164ac00)))->_hx_decompose)(into);
+ }
+ ::tink::core::_Future::FutureObject (::hx::Object :: *_hx_forEach)( ::Dynamic handle);
+ static inline ::tink::core::_Future::FutureObject forEach( ::Dynamic _hx_, ::Dynamic handle) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::streams::StreamObject_obj *>(_hx_.mPtr->_hx_getInterface(0x6164ac00)))->_hx_forEach)(handle);
+ }
+ ::tink::core::_Future::FutureObject (::hx::Object :: *_hx_reduce)( ::Dynamic initial, ::Dynamic reducer);
+ static inline ::tink::core::_Future::FutureObject reduce( ::Dynamic _hx_, ::Dynamic initial, ::Dynamic reducer) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::streams::StreamObject_obj *>(_hx_.mPtr->_hx_getInterface(0x6164ac00)))->_hx_reduce)(initial,reducer);
+ }
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_StreamObject */
diff --git a/Sources/c_snikket/iinclude/include/tink/streams/_Stream/CompoundStream.h b/Sources/c_snikket/iinclude/include/tink/streams/_Stream/CompoundStream.h
new file mode 100644
index 0000000..529a9c5
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/streams/_Stream/CompoundStream.h
@@ -0,0 +1,75 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams__Stream_CompoundStream
+#define INCLUDED_tink_streams__Stream_CompoundStream
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_streams_StreamBase
+#include <tink/streams/StreamBase.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,streams,Conclusion)
+HX_DECLARE_CLASS2(tink,streams,StreamBase)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+HX_DECLARE_CLASS3(tink,streams,_Stream,CompoundStream)
+
+namespace tink{
+namespace streams{
+namespace _Stream{
+
+
+class HXCPP_CLASS_ATTRIBUTES CompoundStream_obj : public ::tink::streams::StreamBase_obj
+{
+ public:
+ typedef ::tink::streams::StreamBase_obj super;
+ typedef CompoundStream_obj OBJ_;
+ CompoundStream_obj();
+
+ public:
+ enum { _hx_ClassId = 0x56b49549 };
+
+ void __construct(::Array< ::Dynamic> parts);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.streams._Stream.CompoundStream")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.streams._Stream.CompoundStream"); }
+ static ::hx::ObjectPtr< CompoundStream_obj > __new(::Array< ::Dynamic> parts);
+ static ::hx::ObjectPtr< CompoundStream_obj > __alloc(::hx::Ctx *_hx_ctx,::Array< ::Dynamic> parts);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~CompoundStream_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("CompoundStream",6b,c2,13,72); }
+
+ static void consumeParts(::Array< ::Dynamic> parts, ::Dynamic handler, ::Dynamic cb);
+ static ::Dynamic consumeParts_dyn();
+
+ static ::Dynamic of(::Array< ::Dynamic> streams);
+ static ::Dynamic of_dyn();
+
+ ::Array< ::Dynamic> parts;
+ bool get_depleted();
+
+ void decompose(::Array< ::Dynamic> into);
+
+ ::tink::core::_Future::FutureObject forEach( ::Dynamic handler);
+
+};
+
+} // end namespace tink
+} // end namespace streams
+} // end namespace _Stream
+
+#endif /* INCLUDED_tink_streams__Stream_CompoundStream */
diff --git a/Sources/c_snikket/iinclude/include/tink/streams/_Stream/ErrorStream.h b/Sources/c_snikket/iinclude/include/tink/streams/_Stream/ErrorStream.h
new file mode 100644
index 0000000..609ab95
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/streams/_Stream/ErrorStream.h
@@ -0,0 +1,64 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams__Stream_ErrorStream
+#define INCLUDED_tink_streams__Stream_ErrorStream
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_streams_StreamBase
+#include <tink/streams/StreamBase.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,streams,StreamBase)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+HX_DECLARE_CLASS3(tink,streams,_Stream,ErrorStream)
+
+namespace tink{
+namespace streams{
+namespace _Stream{
+
+
+class HXCPP_CLASS_ATTRIBUTES ErrorStream_obj : public ::tink::streams::StreamBase_obj
+{
+ public:
+ typedef ::tink::streams::StreamBase_obj super;
+ typedef ErrorStream_obj OBJ_;
+ ErrorStream_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1afcc8aa };
+
+ void __construct( ::tink::core::TypedError error);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.streams._Stream.ErrorStream")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.streams._Stream.ErrorStream"); }
+ static ::hx::ObjectPtr< ErrorStream_obj > __new( ::tink::core::TypedError error);
+ static ::hx::ObjectPtr< ErrorStream_obj > __alloc(::hx::Ctx *_hx_ctx, ::tink::core::TypedError error);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ErrorStream_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("ErrorStream",48,f2,cc,e3); }
+
+ ::tink::core::TypedError error;
+ ::tink::core::_Future::FutureObject forEach( ::Dynamic handler);
+
+};
+
+} // end namespace tink
+} // end namespace streams
+} // end namespace _Stream
+
+#endif /* INCLUDED_tink_streams__Stream_ErrorStream */
diff --git a/Sources/c_snikket/iinclude/include/tink/streams/_Stream/Handler_Impl_.h b/Sources/c_snikket/iinclude/include/tink/streams/_Stream/Handler_Impl_.h
new file mode 100644
index 0000000..2e0cf9a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/streams/_Stream/Handler_Impl_.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams__Stream_Handler_Impl_
+#define INCLUDED_tink_streams__Stream_Handler_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,streams,Handled)
+HX_DECLARE_CLASS3(tink,streams,_Stream,Handler_Impl_)
+
+namespace tink{
+namespace streams{
+namespace _Stream{
+
+
+class HXCPP_CLASS_ATTRIBUTES Handler_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Handler_Impl__obj OBJ_;
+ Handler_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x065ceae4 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.streams._Stream.Handler_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.streams._Stream.Handler_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Handler_Impl__obj > __new() {
+ ::hx::ObjectPtr< Handler_Impl__obj > __this = new Handler_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Handler_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Handler_Impl__obj *__this = (Handler_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Handler_Impl__obj), false, "tink.streams._Stream.Handler_Impl_"));
+ *(void **)__this = Handler_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Handler_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Handler_Impl_",ca,2f,2c,64); }
+
+ static ::Dynamic ofSafeSync( ::Dynamic f);
+ static ::Dynamic ofSafeSync_dyn();
+
+ static ::Dynamic ofUnknown( ::Dynamic f);
+ static ::Dynamic ofUnknown_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace streams
+} // end namespace _Stream
+
+#endif /* INCLUDED_tink_streams__Stream_Handler_Impl_ */
diff --git a/Sources/c_snikket/iinclude/include/tink/streams/_Stream/Reducer_Impl_.h b/Sources/c_snikket/iinclude/include/tink/streams/_Stream/Reducer_Impl_.h
new file mode 100644
index 0000000..3308ef5
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/streams/_Stream/Reducer_Impl_.h
@@ -0,0 +1,66 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams__Stream_Reducer_Impl_
+#define INCLUDED_tink_streams__Stream_Reducer_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,streams,ReductionStep)
+HX_DECLARE_CLASS3(tink,streams,_Stream,Reducer_Impl_)
+
+namespace tink{
+namespace streams{
+namespace _Stream{
+
+
+class HXCPP_CLASS_ATTRIBUTES Reducer_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Reducer_Impl__obj OBJ_;
+ Reducer_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x18a49ca6 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.streams._Stream.Reducer_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.streams._Stream.Reducer_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Reducer_Impl__obj > __new() {
+ ::hx::ObjectPtr< Reducer_Impl__obj > __this = new Reducer_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Reducer_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Reducer_Impl__obj *__this = (Reducer_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Reducer_Impl__obj), false, "tink.streams._Stream.Reducer_Impl_"));
+ *(void **)__this = Reducer_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Reducer_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Reducer_Impl_",8c,e1,73,76); }
+
+ static ::Dynamic ofSafeSync( ::Dynamic f);
+ static ::Dynamic ofSafeSync_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace streams
+} // end namespace _Stream
+
+#endif /* INCLUDED_tink_streams__Stream_Reducer_Impl_ */
diff --git a/Sources/c_snikket/iinclude/include/tink/streams/_Stream/RegroupStream.h b/Sources/c_snikket/iinclude/include/tink/streams/_Stream/RegroupStream.h
new file mode 100644
index 0000000..b268759
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/streams/_Stream/RegroupStream.h
@@ -0,0 +1,55 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams__Stream_RegroupStream
+#define INCLUDED_tink_streams__Stream_RegroupStream
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_streams__Stream_CompoundStream
+#include <tink/streams/_Stream/CompoundStream.h>
+#endif
+HX_DECLARE_CLASS2(tink,streams,StreamBase)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+HX_DECLARE_CLASS3(tink,streams,_Stream,CompoundStream)
+HX_DECLARE_CLASS3(tink,streams,_Stream,RegroupStream)
+
+namespace tink{
+namespace streams{
+namespace _Stream{
+
+
+class HXCPP_CLASS_ATTRIBUTES RegroupStream_obj : public ::tink::streams::_Stream::CompoundStream_obj
+{
+ public:
+ typedef ::tink::streams::_Stream::CompoundStream_obj super;
+ typedef RegroupStream_obj OBJ_;
+ RegroupStream_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1850db0e };
+
+ void __construct(::Dynamic source, ::Dynamic f,::Dynamic prev,::cpp::VirtualArray buf);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.streams._Stream.RegroupStream")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.streams._Stream.RegroupStream"); }
+ static ::hx::ObjectPtr< RegroupStream_obj > __new(::Dynamic source, ::Dynamic f,::Dynamic prev,::cpp::VirtualArray buf);
+ static ::hx::ObjectPtr< RegroupStream_obj > __alloc(::hx::Ctx *_hx_ctx,::Dynamic source, ::Dynamic f,::Dynamic prev,::cpp::VirtualArray buf);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~RegroupStream_obj();
+
+ HX_DO_RTTI_ALL;
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("RegroupStream",2c,28,b5,d4); }
+
+};
+
+} // end namespace tink
+} // end namespace streams
+} // end namespace _Stream
+
+#endif /* INCLUDED_tink_streams__Stream_RegroupStream */
diff --git a/Sources/c_snikket/iinclude/include/tink/streams/_Stream/Regrouper_Impl_.h b/Sources/c_snikket/iinclude/include/tink/streams/_Stream/Regrouper_Impl_.h
new file mode 100644
index 0000000..72afba4
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/streams/_Stream/Regrouper_Impl_.h
@@ -0,0 +1,65 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams__Stream_Regrouper_Impl_
+#define INCLUDED_tink_streams__Stream_Regrouper_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,streams,RegroupResult)
+HX_DECLARE_CLASS3(tink,streams,_Stream,Regrouper_Impl_)
+
+namespace tink{
+namespace streams{
+namespace _Stream{
+
+
+class HXCPP_CLASS_ATTRIBUTES Regrouper_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Regrouper_Impl__obj OBJ_;
+ Regrouper_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x74da6ebb };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.streams._Stream.Regrouper_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.streams._Stream.Regrouper_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Regrouper_Impl__obj > __new() {
+ ::hx::ObjectPtr< Regrouper_Impl__obj > __this = new Regrouper_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Regrouper_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Regrouper_Impl__obj *__this = (Regrouper_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Regrouper_Impl__obj), false, "tink.streams._Stream.Regrouper_Impl_"));
+ *(void **)__this = Regrouper_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Regrouper_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Regrouper_Impl_",59,bf,c2,4c); }
+
+ static ::Dynamic ofIgnoranceSync( ::Dynamic f);
+ static ::Dynamic ofIgnoranceSync_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace streams
+} // end namespace _Stream
+
+#endif /* INCLUDED_tink_streams__Stream_Regrouper_Impl_ */
diff --git a/Sources/c_snikket/iinclude/include/tink/streams/_Stream/Stream_Impl_.h b/Sources/c_snikket/iinclude/include/tink/streams/_Stream/Stream_Impl_.h
new file mode 100644
index 0000000..776c5cc
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/streams/_Stream/Stream_Impl_.h
@@ -0,0 +1,73 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams__Stream_Stream_Impl_
+#define INCLUDED_tink_streams__Stream_Stream_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+HX_DECLARE_CLASS3(tink,streams,_Stream,Stream_Impl_)
+
+namespace tink{
+namespace streams{
+namespace _Stream{
+
+
+class HXCPP_CLASS_ATTRIBUTES Stream_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Stream_Impl__obj OBJ_;
+ Stream_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x5036bc9e };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.streams._Stream.Stream_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.streams._Stream.Stream_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Stream_Impl__obj > __new() {
+ ::hx::ObjectPtr< Stream_Impl__obj > __this = new Stream_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Stream_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Stream_Impl__obj *__this = (Stream_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Stream_Impl__obj), false, "tink.streams._Stream.Stream_Impl_"));
+ *(void **)__this = Stream_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Stream_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Stream_Impl_",40,fd,8a,3d); }
+
+ static ::Dynamic single( ::Dynamic i);
+ static ::Dynamic single_dyn();
+
+ static ::Dynamic future( ::tink::core::_Future::FutureObject f);
+ static ::Dynamic future_dyn();
+
+ static ::Dynamic ofError( ::tink::core::TypedError e);
+ static ::Dynamic ofError_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace streams
+} // end namespace _Stream
+
+#endif /* INCLUDED_tink_streams__Stream_Stream_Impl_ */
diff --git a/Sources/c_snikket/iinclude/include/tink/url/_Host/Host_Impl_.h b/Sources/c_snikket/iinclude/include/tink/url/_Host/Host_Impl_.h
new file mode 100644
index 0000000..3db7153
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/url/_Host/Host_Impl_.h
@@ -0,0 +1,70 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_url__Host_Host_Impl_
+#define INCLUDED_tink_url__Host_Host_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,url,_Host,Host_Impl_)
+
+namespace tink{
+namespace url{
+namespace _Host{
+
+
+class HXCPP_CLASS_ATTRIBUTES Host_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Host_Impl__obj OBJ_;
+ Host_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x20d53a72 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.url._Host.Host_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.url._Host.Host_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Host_Impl__obj > __new() {
+ ::hx::ObjectPtr< Host_Impl__obj > __this = new Host_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Host_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Host_Impl__obj *__this = (Host_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Host_Impl__obj), false, "tink.url._Host.Host_Impl_"));
+ *(void **)__this = Host_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Host_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Host_Impl_",28,8e,8a,61); }
+
+ static ::String _new(::String name, ::Dynamic port);
+ static ::Dynamic _new_dyn();
+
+ static ::String get_name(::String this1);
+ static ::Dynamic get_name_dyn();
+
+ static ::Dynamic get_port(::String this1);
+ static ::Dynamic get_port_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace url
+} // end namespace _Host
+
+#endif /* INCLUDED_tink_url__Host_Host_Impl_ */
diff --git a/Sources/c_snikket/iinclude/include/tink/url/_Path/Path_Impl_.h b/Sources/c_snikket/iinclude/include/tink/url/_Path/Path_Impl_.h
new file mode 100644
index 0000000..25b6b43
--- /dev/null
+++ b/Sources/c_snikket/iinclude/include/tink/url/_Path/Path_Impl_.h
@@ -0,0 +1,70 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_url__Path_Path_Impl_
+#define INCLUDED_tink_url__Path_Path_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,url,_Path,Path_Impl_)
+
+namespace tink{
+namespace url{
+namespace _Path{
+
+
+class HXCPP_CLASS_ATTRIBUTES Path_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Path_Impl__obj OBJ_;
+ Path_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x718c1a2c };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.url._Path.Path_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.url._Path.Path_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Path_Impl__obj > __new() {
+ ::hx::ObjectPtr< Path_Impl__obj > __this = new Path_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Path_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Path_Impl__obj *__this = (Path_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Path_Impl__obj), false, "tink.url._Path.Path_Impl_"));
+ *(void **)__this = Path_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Path_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Path_Impl_",25,70,db,20); }
+
+ static ::String join(::String this1,::String that);
+ static ::Dynamic join_dyn();
+
+ static ::String ofString(::String s);
+ static ::Dynamic ofString_dyn();
+
+ static ::String normalize(::String s);
+ static ::Dynamic normalize_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace url
+} // end namespace _Path
+
+#endif /* INCLUDED_tink_url__Path_Path_Impl_ */
diff --git a/Sources/c_snikket/iinclude/null.h b/Sources/c_snikket/iinclude/null.h
new file mode 100644
index 0000000..396dc74
--- /dev/null
+++ b/Sources/c_snikket/iinclude/null.h
@@ -0,0 +1,236 @@
+#ifndef HX_NULL_H
+#define HX_NULL_H
+
+
+
+// --- null value ---------------------------------------------------------
+//
+// This is used by external operatator and return statments - Most will
+// use operator overloading to convert to the null pointer
+
+
+// Forward declare ...
+class String;
+class null;
+namespace hx { template<typename O> class ObjectPtr; }
+
+namespace hx { null NullArithmetic(const char *inText); }
+
+#define HX_NULL_COMPARE_OP(op,type,value) \
+ bool operator op (const type &inRHS) const { return value; }
+
+#define HX_NULL_COMPARE_OPS(type) \
+ HX_NULL_COMPARE_OP(<,type,false) \
+ HX_NULL_COMPARE_OP(<=,type,false) \
+ HX_NULL_COMPARE_OP(>,type,false) \
+ HX_NULL_COMPARE_OP(>=,type,false) \
+ HX_NULL_COMPARE_OP(==,type,false) \
+ HX_NULL_COMPARE_OP(!=,type,true)
+
+#define HX_NULL_COMPARE_MOST_OPS(type) \
+ HX_NULL_COMPARE_OP(<,type,false) \
+ HX_NULL_COMPARE_OP(<=,type,false) \
+ HX_NULL_COMPARE_OP(>,type,false) \
+ HX_NULL_COMPARE_OP(>=,type,false)
+
+#define HX_COMPARE_NULL_OP(op,type,value) \
+ inline bool operator op (type inLHS, const null &) { return value; }
+
+#define HX_COMPARE_NULL_OPS(type) \
+ HX_COMPARE_NULL_OP(<,type,false) \
+ HX_COMPARE_NULL_OP(<=,type,false) \
+ HX_COMPARE_NULL_OP(>,type,false) \
+ HX_COMPARE_NULL_OP(>=,type,false) \
+ HX_COMPARE_NULL_OP(==,type,false) \
+ HX_COMPARE_NULL_OP(!=,type,true)
+
+#define HX_COMPARE_NULL_MOST_OPS(type) \
+ HX_COMPARE_NULL_OP(<,type,false) \
+ HX_COMPARE_NULL_OP(<=,type,false) \
+ HX_COMPARE_NULL_OP(>,type,false) \
+ HX_COMPARE_NULL_OP(>=,type,false)
+
+
+#define HX_NULL_ARITHMETIC_OP(op) \
+template<typename T> inline null operator op (T t) const \
+ { return hx::NullArithmetic(#op); } \
+inline null operator op (const null &) const \
+ { return hx::NullArithmetic(#op); }
+
+#define HX_ARITHMETIC_NULL_OP(op) \
+template<typename T> inline null operator op (const T &, const null &) \
+ { return hx::NullArithmetic(#op); }
+
+
+class null
+{
+ struct AnyArg
+ {
+ template<typename T>
+ inline AnyArg(const T&) { }
+ };
+ public:
+ inline null(){ }
+
+ template<typename T> explicit inline null(const hx::ObjectPtr<T> &){ }
+ template<typename T> explicit inline null(const String &){ }
+ explicit inline null(double){ }
+ explicit inline null(float){ }
+ explicit inline null(int){ }
+ explicit inline null(bool){ }
+
+ template<typename T>
+ T StaticCast() { return null(); }
+
+ operator bool () { return false; }
+ operator int () { return 0; }
+ operator unsigned int () { return 0; }
+ operator double () { return 0; }
+ operator float () { return 0; }
+ operator char () { return 0; }
+ operator unsigned char () { return 0; }
+ operator signed char () { return 0; }
+ operator short () { return 0; }
+ operator unsigned short () { return 0; }
+ operator unsigned long () { return 0; }
+ operator cpp::UInt64 () { return 0; }
+ operator cpp::Int64 () { return 0; }
+ template<typename T>
+ inline operator typename hx::Native<T *> () const { return 0; }
+
+
+ // Any pointer!
+ //operator char * () { return 0; }
+ //operator wchar_t * () { return 0; }
+ template<typename T> operator T *() { return 0; }
+
+ bool operator == (null inRHS) const { return true; }
+ bool operator != (null inRHS) const { return false; }
+ bool operator == (null inRHS) { return true; }
+ bool operator != (null inRHS) { return false; }
+
+ template<typename T> inline bool operator == (const hx::ObjectPtr<T> &) const;
+ template<typename T> inline bool operator != (const hx::ObjectPtr<T> &) const;
+ template<typename T> inline bool operator == (const Array<T> &) const;
+ template<typename T> inline bool operator != (const Array<T> &) const;
+ inline bool operator == (const hx::FieldRef &) const;
+ inline bool operator != (const hx::FieldRef &) const;
+ inline bool operator == (const hx::IndexRef &) const;
+ inline bool operator != (const hx::IndexRef &) const;
+ inline bool operator == (const Dynamic &) const;
+ inline bool operator != (const Dynamic &) const;
+ inline bool operator == (const String &) const;
+ inline bool operator != (const String &) const;
+ inline bool operator == (const cpp::Variant &v) const { return v.isNull(); }
+ inline bool operator != (const cpp::Variant &v) const{ return !v.isNull(); }
+
+ inline null operator - () const { return hx::NullArithmetic("-"); }
+ inline null operator ! () const { return hx::NullArithmetic("!"); }
+
+ template<class T> T operator()(const AnyArg &a0=0, const AnyArg &a1=0, const AnyArg &a2=0,
+ const AnyArg &a4=0, const AnyArg &a5=0, const AnyArg &a6=0,
+ const AnyArg &a7=0, const AnyArg &a8=0, const AnyArg &a9=0 )
+ {
+ hx::NullReference("Function Call", false);
+ T nullDynamic;
+ return nullDynamic;
+ }
+
+ HX_NULL_COMPARE_OPS(bool)
+ HX_NULL_COMPARE_OPS(double)
+ HX_NULL_COMPARE_OPS(float)
+ HX_NULL_COMPARE_OPS(int)
+ HX_NULL_COMPARE_OPS(unsigned int)
+ HX_NULL_COMPARE_OPS(short)
+ HX_NULL_COMPARE_OPS(unsigned short)
+ HX_NULL_COMPARE_OPS(signed char)
+ HX_NULL_COMPARE_OPS(unsigned char)
+ HX_NULL_COMPARE_OPS(cpp::Int64)
+ HX_NULL_COMPARE_OPS(cpp::UInt64)
+ HX_NULL_COMPARE_MOST_OPS(String)
+ HX_NULL_COMPARE_MOST_OPS(Dynamic)
+ HX_NULL_COMPARE_MOST_OPS(hx::FieldRef)
+ HX_NULL_COMPARE_MOST_OPS(hx::IndexRef)
+
+ HX_NULL_COMPARE_OP(<,null,false)
+ HX_NULL_COMPARE_OP(<=,null,true)
+ HX_NULL_COMPARE_OP(>,null,false)
+ HX_NULL_COMPARE_OP(>=,null,true)
+
+
+ HX_NULL_ARITHMETIC_OP(+);
+ HX_NULL_ARITHMETIC_OP(*);
+ HX_NULL_ARITHMETIC_OP(-);
+ HX_NULL_ARITHMETIC_OP(/);
+ HX_NULL_ARITHMETIC_OP(%);
+ HX_NULL_ARITHMETIC_OP(&);
+ HX_NULL_ARITHMETIC_OP(|);
+ HX_NULL_ARITHMETIC_OP(^);
+ HX_NULL_ARITHMETIC_OP(>>);
+ HX_NULL_ARITHMETIC_OP(<<);
+};
+
+namespace hx
+{
+
+template<typename T>
+struct Null
+{
+ inline Null() : isNull(true) { }
+ inline Null(const Null<T> &inOther) : isNull(inOther.isNull), value(inOther.value) { }
+ inline Null(const T& inVal) : isNull(false), value(inVal) { }
+ inline Null(const null &) : isNull(true) { }
+ inline Null(const Dynamic &inVal)
+ {
+ isNull = null() == inVal;
+ if (!isNull)
+ value = inVal;
+ }
+ inline Null(const cpp::Variant &inVal)
+ {
+ isNull = inVal.isNull();
+ if (!isNull)
+ value = inVal;
+ }
+
+ inline operator Dynamic();
+ inline T Default(T inDefault) { return isNull ? inDefault : value; }
+
+ bool isNull;
+ T value;
+};
+
+} // end namesapce hx
+
+typedef null Void;
+
+HX_COMPARE_NULL_OPS(bool)
+HX_COMPARE_NULL_OPS(double)
+HX_COMPARE_NULL_OPS(float)
+HX_COMPARE_NULL_OPS(int)
+HX_COMPARE_NULL_OPS(unsigned int)
+HX_COMPARE_NULL_OPS(short)
+HX_COMPARE_NULL_OPS(unsigned short)
+HX_COMPARE_NULL_OPS(signed char)
+HX_COMPARE_NULL_OPS(unsigned char)
+HX_COMPARE_NULL_OPS(cpp::UInt64)
+HX_COMPARE_NULL_OPS(cpp::Int64)
+
+HX_ARITHMETIC_NULL_OP(+)
+HX_ARITHMETIC_NULL_OP(*)
+HX_ARITHMETIC_NULL_OP(-)
+HX_ARITHMETIC_NULL_OP(/)
+HX_ARITHMETIC_NULL_OP(%)
+HX_ARITHMETIC_NULL_OP(&)
+HX_ARITHMETIC_NULL_OP(|)
+HX_ARITHMETIC_NULL_OP(^)
+HX_ARITHMETIC_NULL_OP(>>)
+HX_ARITHMETIC_NULL_OP(<<)
+
+// Other ops in Operator.h
+
+inline void *_hx_nullptr() { return 0; }
+
+
+#endif
+
diff --git a/Sources/c_snikket/iinclude/sha/Hash.h b/Sources/c_snikket/iinclude/sha/Hash.h
new file mode 100644
index 0000000..105a34b
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sha/Hash.h
@@ -0,0 +1,60 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sha_Hash
+#define INCLUDED_sha_Hash
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS1(sha,Hash)
+
+namespace sha{
+
+
+class HXCPP_CLASS_ATTRIBUTES Hash_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Hash_obj OBJ_;
+ Hash_obj();
+
+ public:
+ enum { _hx_ClassId = 0x49a7eb1a };
+
+ void __construct(int blockSize,int finalSize);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sha.Hash")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sha.Hash"); }
+
+ //~Hash_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Hash",ee,5b,e1,2f); }
+
+ int finalSize;
+ int length;
+ ::haxe::io::Bytes block;
+ ::sha::Hash update( ::haxe::io::Bytes data);
+ ::Dynamic update_dyn();
+
+ ::haxe::io::Bytes digest();
+ ::Dynamic digest_dyn();
+
+ virtual void _update( ::haxe::io::Bytes data) {}
+ ::Dynamic _update_dyn();
+ virtual ::haxe::io::Bytes _hash() { return 0; }
+ ::Dynamic _hash_dyn();
+};
+
+} // end namespace sha
+
+#endif /* INCLUDED_sha_Hash */
diff --git a/Sources/c_snikket/iinclude/sha/SHA256.h b/Sources/c_snikket/iinclude/sha/SHA256.h
new file mode 100644
index 0000000..28722a8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sha/SHA256.h
@@ -0,0 +1,86 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sha_SHA256
+#define INCLUDED_sha_SHA256
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_sha_Hash
+#include <sha/Hash.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS1(sha,Hash)
+HX_DECLARE_CLASS1(sha,SHA256)
+
+namespace sha{
+
+
+class HXCPP_CLASS_ATTRIBUTES SHA256_obj : public ::sha::Hash_obj
+{
+ public:
+ typedef ::sha::Hash_obj super;
+ typedef SHA256_obj OBJ_;
+ SHA256_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0251ab23 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sha.SHA256")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sha.SHA256"); }
+ static ::hx::ObjectPtr< SHA256_obj > __new();
+ static ::hx::ObjectPtr< SHA256_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SHA256_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("SHA256",87,b4,95,cf); }
+
+ int _a;
+ int _b;
+ int _c;
+ int _d;
+ int _e;
+ int _f;
+ int _g;
+ int _h;
+ ::Array< int > _w;
+ int sigma0(int x);
+ ::Dynamic sigma0_dyn();
+
+ int sigma1(int x);
+ ::Dynamic sigma1_dyn();
+
+ int gamma0(int x);
+ ::Dynamic gamma0_dyn();
+
+ int gamma1(int x);
+ ::Dynamic gamma1_dyn();
+
+ int ch(int x,int y,int z);
+ ::Dynamic ch_dyn();
+
+ int maj(int x,int y,int z);
+ ::Dynamic maj_dyn();
+
+ void _update( ::haxe::io::Bytes data);
+
+ ::haxe::io::Bytes _hash();
+
+};
+
+} // end namespace sha
+
+#endif /* INCLUDED_sha_SHA256 */
diff --git a/Sources/c_snikket/iinclude/sha/_SHA256/SHA256_Fields_.h b/Sources/c_snikket/iinclude/sha/_SHA256/SHA256_Fields_.h
new file mode 100644
index 0000000..3d1d69a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sha/_SHA256/SHA256_Fields_.h
@@ -0,0 +1,62 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sha__SHA256_SHA256_Fields_
+#define INCLUDED_sha__SHA256_SHA256_Fields_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(sha,_SHA256,SHA256_Fields_)
+
+namespace sha{
+namespace _SHA256{
+
+
+class HXCPP_CLASS_ATTRIBUTES SHA256_Fields__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef SHA256_Fields__obj OBJ_;
+ SHA256_Fields__obj();
+
+ public:
+ enum { _hx_ClassId = 0x07d39014 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="sha._SHA256.SHA256_Fields_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"sha._SHA256.SHA256_Fields_"); }
+
+ inline static ::hx::ObjectPtr< SHA256_Fields__obj > __new() {
+ ::hx::ObjectPtr< SHA256_Fields__obj > __this = new SHA256_Fields__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< SHA256_Fields__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ SHA256_Fields__obj *__this = (SHA256_Fields__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(SHA256_Fields__obj), false, "sha._SHA256.SHA256_Fields_"));
+ *(void **)__this = SHA256_Fields__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SHA256_Fields__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("SHA256_Fields_",ae,b0,ef,ea); }
+
+ static void __boot();
+ static ::Array< int > K;
+};
+
+} // end namespace sha
+} // end namespace _SHA256
+
+#endif /* INCLUDED_sha__SHA256_SHA256_Fields_ */
diff --git a/Sources/c_snikket/iinclude/snikket/AttachmentSource.h b/Sources/c_snikket/iinclude/snikket/AttachmentSource.h
new file mode 100644
index 0000000..35e0bb9
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/AttachmentSource.h
@@ -0,0 +1,72 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_AttachmentSource
+#define INCLUDED_snikket_AttachmentSource
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,AttachmentSource)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES AttachmentSource_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef AttachmentSource_obj OBJ_;
+ AttachmentSource_obj();
+
+ public:
+ enum { _hx_ClassId = 0x3b403b17 };
+
+ void __construct(::String path,::String mime);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.AttachmentSource")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.AttachmentSource"); }
+ static ::hx::ObjectPtr< AttachmentSource_obj > __new(::String path,::String mime);
+ static ::hx::ObjectPtr< AttachmentSource_obj > __alloc(::hx::Ctx *_hx_ctx,::String path,::String mime);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~AttachmentSource_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("AttachmentSource",3e,95,3b,6c); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ ::String path;
+ ::String path__fromC();
+ ::Dynamic path__fromC_dyn();
+
+ ::String type;
+ ::String type__fromC();
+ ::Dynamic type__fromC_dyn();
+
+ ::String name;
+ ::String name__fromC();
+ ::Dynamic name__fromC_dyn();
+
+ int size;
+ int size__fromC();
+ ::Dynamic size__fromC_dyn();
+
+ ::Dynamic tinkSource();
+ ::Dynamic tinkSource_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_AttachmentSource */
diff --git a/Sources/c_snikket/iinclude/snikket/Autolink.h b/Sources/c_snikket/iinclude/snikket/Autolink.h
new file mode 100644
index 0000000..f244927
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/Autolink.h
@@ -0,0 +1,90 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Autolink
+#define INCLUDED_snikket_Autolink
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Autolink)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Autolink_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Autolink_obj OBJ_;
+ Autolink_obj();
+
+ public:
+ enum { _hx_ClassId = 0x257fedc6 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="snikket.Autolink")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"snikket.Autolink"); }
+
+ inline static ::hx::ObjectPtr< Autolink_obj > __new() {
+ ::hx::ObjectPtr< Autolink_obj > __this = new Autolink_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Autolink_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Autolink_obj *__this = (Autolink_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Autolink_obj), false, "snikket.Autolink"));
+ *(void **)__this = Autolink_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Autolink_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Autolink",09,97,b1,19); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ static ::String IANA_TOP_LEVEL_DOMAINS;
+ static ::String GOOD_IRI_CHAR;
+ static ::String IP_ADDRESS;
+ static ::String IP6_ADDRESS;
+ static ::String UCS_CHAR;
+ static ::String LABEL_CHAR;
+ static ::String IRI_LABEL;
+ static ::String PUNYCODE_TLD;
+ static ::String PROTOCOL;
+ static ::String WORD_BOUNDARY;
+ static ::String USER_INFO;
+ static ::String PORT_NUMBER;
+ static ::String PATH_CHAR;
+ static ::String PATH_AND_QUERY;
+ static ::String STRICT_TLD;
+ static ::String STRICT_HOST_NAME;
+ static ::String STRICT_DOMAIN_NAME;
+ static ::String RELAXED_DOMAIN_NAME;
+ static ::String WEB_URL_WITHOUT_PROTOCOL;
+ static ::String WEB_URL_WITH_PROTOCOL;
+ static ::String AUTOLINK_WEB_URL;
+ static ::String TEL_URI;
+ static ::String SMS_URI;
+ static ::String XMPP_URI;
+ static ::Dynamic one(::String s,int start);
+ static ::Dynamic one_dyn();
+
+ static ::Dynamic match(::String s,int start,::String pattern,bool addHttps);
+ static ::Dynamic match_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Autolink */
diff --git a/Sources/c_snikket/iinclude/snikket/AvailableChat.h b/Sources/c_snikket/iinclude/snikket/AvailableChat.h
new file mode 100644
index 0000000..80ae01e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/AvailableChat.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_AvailableChat
+#define INCLUDED_snikket_AvailableChat
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,AvailableChat)
+HX_DECLARE_CLASS1(snikket,Caps)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES AvailableChat_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef AvailableChat_obj OBJ_;
+ AvailableChat_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7aa46944 };
+
+ void __construct(::String chatId,::String displayName,::String note, ::snikket::Caps caps);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.AvailableChat")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.AvailableChat"); }
+ static ::hx::ObjectPtr< AvailableChat_obj > __new(::String chatId,::String displayName,::String note, ::snikket::Caps caps);
+ static ::hx::ObjectPtr< AvailableChat_obj > __alloc(::hx::Ctx *_hx_ctx,::String chatId,::String displayName,::String note, ::snikket::Caps caps);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~AvailableChat_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("AvailableChat",21,4d,b7,ce); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ ::String chatId;
+ ::String chatId__fromC();
+ ::Dynamic chatId__fromC_dyn();
+
+ ::String displayName;
+ ::String displayName__fromC();
+ ::Dynamic displayName__fromC_dyn();
+
+ ::String note;
+ ::String note__fromC();
+ ::Dynamic note__fromC_dyn();
+
+ ::snikket::Caps caps;
+ bool isChannel();
+ ::Dynamic isChannel_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_AvailableChat */
diff --git a/Sources/c_snikket/iinclude/snikket/Builder.h b/Sources/c_snikket/iinclude/snikket/Builder.h
new file mode 100644
index 0000000..2b371f1
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/Builder.h
@@ -0,0 +1,62 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Builder
+#define INCLUDED_snikket_Builder
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Builder)
+HX_DECLARE_CLASS1(snikket,Symbol)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Builder_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Builder_obj OBJ_;
+ Builder_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7b0e9a2a };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Builder")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Builder"); }
+ static ::hx::ObjectPtr< Builder_obj > __new();
+ static ::hx::ObjectPtr< Builder_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Builder_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Builder",fb,02,0c,3d); }
+
+ static bool isMerger(int codepoint);
+ static ::Dynamic isMerger_dyn();
+
+ ::Array< int > codepoints;
+ bool offer(int codepoint);
+ ::Dynamic offer_dyn();
+
+ ::snikket::Symbol build();
+ ::Dynamic build_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Builder */
diff --git a/Sources/c_snikket/iinclude/snikket/Caps.h b/Sources/c_snikket/iinclude/snikket/Caps.h
new file mode 100644
index 0000000..908402f
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/Caps.h
@@ -0,0 +1,83 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Caps
+#define INCLUDED_snikket_Caps
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Caps)
+HX_DECLARE_CLASS1(snikket,Hash)
+HX_DECLARE_CLASS1(snikket,Identity)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Caps_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Caps_obj OBJ_;
+ Caps_obj();
+
+ public:
+ enum { _hx_ClassId = 0x02663c7e };
+
+ void __construct(::String node,::Array< ::Dynamic> identities,::Array< ::String > features);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Caps")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Caps"); }
+ static ::hx::ObjectPtr< Caps_obj > __new(::String node,::Array< ::Dynamic> identities,::Array< ::String > features);
+ static ::hx::ObjectPtr< Caps_obj > __alloc(::hx::Ctx *_hx_ctx,::String node,::Array< ::Dynamic> identities,::Array< ::String > features);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Caps_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Caps",41,48,93,2c); }
+
+ static ::Array< ::String > withIdentity( ::Dynamic caps,::String category,::String type);
+ static ::Dynamic withIdentity_dyn();
+
+ static ::Array< ::String > withFeature( ::Dynamic caps,::String feature);
+ static ::Dynamic withFeature_dyn();
+
+ ::String node;
+ ::Array< ::Dynamic> identities;
+ ::Array< ::String > features;
+ ::snikket::Hash _ver;
+ bool isChannel(::String chatId);
+ ::Dynamic isChannel_dyn();
+
+ ::snikket::Stanza discoReply();
+ ::Dynamic discoReply_dyn();
+
+ ::snikket::Stanza addC( ::snikket::Stanza stanza);
+ ::Dynamic addC_dyn();
+
+ ::snikket::Hash computeVer();
+ ::Dynamic computeVer_dyn();
+
+ ::snikket::Hash verRaw();
+ ::Dynamic verRaw_dyn();
+
+ ::String ver();
+ ::Dynamic ver_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Caps */
diff --git a/Sources/c_snikket/iinclude/snikket/Channel.h b/Sources/c_snikket/iinclude/snikket/Channel.h
new file mode 100644
index 0000000..74066bc
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/Channel.h
@@ -0,0 +1,144 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Channel
+#define INCLUDED_snikket_Channel
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_Chat
+#include <snikket/Chat.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Caps)
+HX_DECLARE_CLASS1(snikket,Channel)
+HX_DECLARE_CLASS1(snikket,Chat)
+HX_DECLARE_CLASS1(snikket,ChatMessage)
+HX_DECLARE_CLASS1(snikket,ChatMessageBuilder)
+HX_DECLARE_CLASS1(snikket,Client)
+HX_DECLARE_CLASS1(snikket,EventEmitter)
+HX_DECLARE_CLASS1(snikket,GenericStream)
+HX_DECLARE_CLASS1(snikket,JID)
+HX_DECLARE_CLASS1(snikket,MessageSync)
+HX_DECLARE_CLASS1(snikket,Participant)
+HX_DECLARE_CLASS1(snikket,Persistence)
+HX_DECLARE_CLASS1(snikket,Presence)
+HX_DECLARE_CLASS1(snikket,Reaction)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Channel_obj : public ::snikket::Chat_obj
+{
+ public:
+ typedef ::snikket::Chat_obj super;
+ typedef Channel_obj OBJ_;
+ Channel_obj();
+
+ public:
+ enum { _hx_ClassId = 0x23f2b886 };
+
+ void __construct( ::snikket::Client client, ::snikket::GenericStream stream,::Dynamic persistence,::String chatId,::hx::Null< int > __o_uiState,::hx::Null< bool > __o_isBlocked, ::snikket::Stanza extensions,::String readUpToId,::String readUpToBy, ::snikket::Caps disco);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Channel")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Channel"); }
+ static ::hx::ObjectPtr< Channel_obj > __new( ::snikket::Client client, ::snikket::GenericStream stream,::Dynamic persistence,::String chatId,::hx::Null< int > __o_uiState,::hx::Null< bool > __o_isBlocked, ::snikket::Stanza extensions,::String readUpToId,::String readUpToBy, ::snikket::Caps disco);
+ static ::hx::ObjectPtr< Channel_obj > __alloc(::hx::Ctx *_hx_ctx, ::snikket::Client client, ::snikket::GenericStream stream,::Dynamic persistence,::String chatId,::hx::Null< int > __o_uiState,::hx::Null< bool > __o_isBlocked, ::snikket::Stanza extensions,::String readUpToId,::String readUpToBy, ::snikket::Caps disco);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Channel_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Channel",a3,28,23,9a); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ ::snikket::Caps disco;
+ bool inSync;
+ ::snikket::MessageSync sync;
+ bool forceLive;
+ ::String _nickInUse;
+ void selfPing(bool refresh);
+ ::Dynamic selfPing_dyn();
+
+ void join();
+ ::Dynamic join_dyn();
+
+ void selfPingSuccess();
+ ::Dynamic selfPingSuccess_dyn();
+
+ void setPresence(::String resource, ::snikket::Presence presence);
+
+ void doSync(::String lastId);
+ ::Dynamic doSync_dyn();
+
+ bool isTrusted();
+
+ bool isPrivate();
+ ::Dynamic isPrivate_dyn();
+
+ void refreshDisco( ::Dynamic callback);
+ ::Dynamic refreshDisco_dyn();
+
+ ::String preview();
+
+ bool livePresence();
+
+ bool syncing();
+
+ bool canAudioCall();
+
+ bool canVideoCall();
+
+ ::String nickInUse();
+ ::Dynamic nickInUse_dyn();
+
+ ::snikket::JID getFullJid();
+ ::Dynamic getFullJid_dyn();
+
+ ::Array< ::String > getParticipants();
+
+ ::snikket::Participant getParticipantDetails(::String participantId);
+
+ void getMessagesBefore(::String beforeId,::String beforeTime, ::Dynamic handler);
+
+ void getMessagesAfter(::String afterId,::String afterTime, ::Dynamic handler);
+
+ void getMessagesAround(::String aroundId,::String aroundTime, ::Dynamic handler);
+
+ ::snikket::ChatMessageBuilder prepareIncomingMessage( ::snikket::ChatMessageBuilder message, ::snikket::Stanza stanza);
+
+ ::snikket::ChatMessageBuilder prepareOutgoingMessage( ::snikket::ChatMessageBuilder message);
+ ::Dynamic prepareOutgoingMessage_dyn();
+
+ void correctMessage(::String localId, ::snikket::ChatMessageBuilder message);
+
+ void sendMessage( ::snikket::ChatMessageBuilder message);
+
+ void removeReaction( ::snikket::ChatMessage m, ::snikket::Reaction reaction);
+
+ ::String lastMessageId();
+
+ void markReadUpTo( ::snikket::ChatMessage message);
+
+ void bookmark();
+
+ void sendChatState(::String state,::String threadId);
+
+ void close();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Channel */
diff --git a/Sources/c_snikket/iinclude/snikket/Chat.h b/Sources/c_snikket/iinclude/snikket/Chat.h
new file mode 100644
index 0000000..244dff4
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/Chat.h
@@ -0,0 +1,295 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Chat
+#define INCLUDED_snikket_Chat
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS1(haxe,Timer)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+HX_DECLARE_CLASS1(snikket,Caps)
+HX_DECLARE_CLASS1(snikket,Chat)
+HX_DECLARE_CLASS1(snikket,ChatMessage)
+HX_DECLARE_CLASS1(snikket,ChatMessageBuilder)
+HX_DECLARE_CLASS1(snikket,Client)
+HX_DECLARE_CLASS1(snikket,EventEmitter)
+HX_DECLARE_CLASS1(snikket,GenericStream)
+HX_DECLARE_CLASS1(snikket,MessageSync)
+HX_DECLARE_CLASS1(snikket,Participant)
+HX_DECLARE_CLASS1(snikket,Persistence)
+HX_DECLARE_CLASS1(snikket,Presence)
+HX_DECLARE_CLASS1(snikket,Reaction)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,jingle,DTMFSender)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStream)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStreamTrack)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Chat_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Chat_obj OBJ_;
+ Chat_obj();
+
+ public:
+ enum { _hx_ClassId = 0x026b7f35 };
+
+ void __construct( ::snikket::Client client, ::snikket::GenericStream stream,::Dynamic persistence,::String chatId,::hx::Null< int > __o_uiState,::hx::Null< bool > __o_isBlocked, ::snikket::Stanza extensions,::String readUpToId,::String readUpToBy);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Chat")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Chat"); }
+
+ //~Chat_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Chat",f8,8a,98,2c); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ ::snikket::Client client;
+ ::snikket::GenericStream stream;
+ ::Dynamic persistence;
+ ::Array< unsigned char > avatarSha1;
+ ::haxe::ds::StringMap presence;
+ bool trusted;
+ ::String chatId;
+ ::String chatId__fromC();
+ ::Dynamic chatId__fromC_dyn();
+
+ ::haxe::ds::StringMap jingleSessions;
+ ::String displayName;
+ int uiState;
+ int uiState__fromC();
+ ::Dynamic uiState__fromC_dyn();
+
+ bool isBlocked;
+ bool isBlocked__fromC();
+ ::Dynamic isBlocked__fromC_dyn();
+
+ ::snikket::Stanza extensions;
+ int _unreadCount;
+ ::snikket::ChatMessage lastMessage;
+ ::String readUpToId;
+ ::String readUpToBy;
+ bool isTyping;
+ ::String typingThread;
+ ::haxe::Timer typingTimer;
+ ::Dynamic isActive;
+ ::String activeThread;
+ ::Dynamic notificationSettings;
+ virtual ::snikket::ChatMessageBuilder prepareIncomingMessage( ::snikket::ChatMessageBuilder message, ::snikket::Stanza stanza) { return 0; }
+ ::Dynamic prepareIncomingMessage_dyn();
+ virtual void getMessagesBefore(::String beforeId,::String beforeTime, ::Dynamic handler) {}
+ ::Dynamic getMessagesBefore_dyn();
+ void getMessagesBefore__fromC(::String beforeId,::String beforeTime,::cpp::Function< void (void**,size_t,void*) > handler,void* handler__context);
+
+ virtual void getMessagesAfter(::String afterId,::String afterTime, ::Dynamic handler) {}
+ ::Dynamic getMessagesAfter_dyn();
+ void getMessagesAfter__fromC(::String afterId,::String afterTime,::cpp::Function< void (void**,size_t,void*) > handler,void* handler__context);
+
+ virtual void getMessagesAround(::String aroundId,::String aroundTime, ::Dynamic handler) {}
+ ::Dynamic getMessagesAround_dyn();
+ void getMessagesAround__fromC(::String aroundId,::String aroundTime,::cpp::Function< void (void**,size_t,void*) > handler,void* handler__context);
+
+ void fetchFromSync( ::snikket::MessageSync sync, ::Dynamic callback);
+ ::Dynamic fetchFromSync_dyn();
+
+ virtual void sendMessage( ::snikket::ChatMessageBuilder message) {}
+ ::Dynamic sendMessage_dyn();
+ void sendMessage__fromC( ::snikket::ChatMessageBuilder message);
+ ::Dynamic sendMessage__fromC_dyn();
+
+ virtual void markReadUpTo( ::snikket::ChatMessage message) {}
+ ::Dynamic markReadUpTo_dyn();
+ void markReadUpTo__fromC( ::snikket::ChatMessage message);
+ ::Dynamic markReadUpTo__fromC_dyn();
+
+ virtual void bookmark() {}
+ ::Dynamic bookmark_dyn();
+ void bookmark__fromC();
+ ::Dynamic bookmark__fromC_dyn();
+
+ virtual ::Array< ::String > getParticipants() { return 0; }
+ ::Dynamic getParticipants_dyn();
+ size_t getParticipants__fromC(const char*** outPtr);
+
+ virtual ::snikket::Participant getParticipantDetails(::String participantId) { return 0; }
+ ::Dynamic getParticipantDetails_dyn();
+ ::snikket::Participant getParticipantDetails__fromC(::String participantId);
+ ::Dynamic getParticipantDetails__fromC_dyn();
+
+ virtual void correctMessage(::String localId, ::snikket::ChatMessageBuilder message) {}
+ ::Dynamic correctMessage_dyn();
+ void correctMessage__fromC(::String localId, ::snikket::ChatMessageBuilder message);
+ ::Dynamic correctMessage__fromC_dyn();
+
+ void addReaction( ::snikket::ChatMessage m, ::snikket::Reaction reaction);
+ ::Dynamic addReaction_dyn();
+
+ virtual void removeReaction( ::snikket::ChatMessage m, ::snikket::Reaction reaction) {}
+ ::Dynamic removeReaction_dyn();
+ void removeReaction__fromC( ::snikket::ChatMessage m, ::snikket::Reaction reaction);
+ ::Dynamic removeReaction__fromC_dyn();
+
+ virtual void sendChatState(::String state,::String threadId) {}
+ ::Dynamic sendChatState_dyn();
+ void typing(::String threadId,::String content);
+ ::Dynamic typing_dyn();
+
+ void setActive(bool active,::String threadId);
+ ::Dynamic setActive_dyn();
+
+ virtual void close() {}
+ ::Dynamic close_dyn();
+ void close__fromC();
+ ::Dynamic close__fromC_dyn();
+
+ void togglePinned();
+ ::Dynamic togglePinned_dyn();
+
+ void block( ::snikket::ChatMessage reportSpam,bool onServer);
+ ::Dynamic block_dyn();
+
+ void unblock(bool onServer);
+ ::Dynamic unblock_dyn();
+
+ void setNotifications(bool filtered,bool mention,bool reply);
+ ::Dynamic setNotifications_dyn();
+
+ bool notificationsFiltered();
+ ::Dynamic notificationsFiltered_dyn();
+
+ bool notifyMention();
+ ::Dynamic notifyMention_dyn();
+
+ bool notifyReply();
+ ::Dynamic notifyReply_dyn();
+
+ virtual ::String lastMessageId() { return 0; }
+ ::Dynamic lastMessageId_dyn();
+ ::String lastMessageId__fromC();
+ ::Dynamic lastMessageId__fromC_dyn();
+
+ ::String lastMessageTimestamp();
+ ::Dynamic lastMessageTimestamp_dyn();
+
+ void updateFromBookmark( ::snikket::Stanza item);
+ ::Dynamic updateFromBookmark_dyn();
+
+ void updateFromRoster( ::Dynamic item);
+ ::Dynamic updateFromRoster_dyn();
+
+ ::String getPhoto();
+ ::Dynamic getPhoto_dyn();
+
+ ::String getPlaceholder();
+ ::Dynamic getPlaceholder_dyn();
+
+ ::String readUpTo();
+ ::Dynamic readUpTo_dyn();
+
+ int unreadCount();
+ ::Dynamic unreadCount_dyn();
+
+ void setUnreadCount(int count);
+ ::Dynamic setUnreadCount_dyn();
+
+ virtual ::String preview();
+ ::Dynamic preview_dyn();
+
+ void setLastMessage( ::snikket::ChatMessage message);
+ ::Dynamic setLastMessage_dyn();
+
+ void setDisplayName(::String fn);
+ ::Dynamic setDisplayName_dyn();
+
+ ::String getDisplayName();
+ ::Dynamic getDisplayName_dyn();
+
+ virtual void setPresence(::String resource, ::snikket::Presence presence);
+ ::Dynamic setPresence_dyn();
+
+ void setCaps(::String resource, ::snikket::Caps caps);
+ ::Dynamic setCaps_dyn();
+
+ void removePresence(::String resource);
+ ::Dynamic removePresence_dyn();
+
+ ::Dynamic getCaps();
+ ::Dynamic getCaps_dyn();
+
+ ::snikket::Caps getResourceCaps(::String resource);
+ ::Dynamic getResourceCaps_dyn();
+
+ void setAvatarSha1(::Array< unsigned char > sha1);
+ ::Dynamic setAvatarSha1_dyn();
+
+ void setTrusted(bool trusted);
+ ::Dynamic setTrusted_dyn();
+
+ virtual bool isTrusted();
+ ::Dynamic isTrusted_dyn();
+
+ virtual bool livePresence();
+ ::Dynamic livePresence_dyn();
+
+ virtual bool syncing();
+ ::Dynamic syncing_dyn();
+
+ virtual bool canAudioCall();
+ ::Dynamic canAudioCall_dyn();
+
+ virtual bool canVideoCall();
+ ::Dynamic canVideoCall_dyn();
+
+ void startCall(bool audio,bool video);
+ ::Dynamic startCall_dyn();
+
+ void addMedia(::Array< ::Dynamic> streams);
+ ::Dynamic addMedia_dyn();
+
+ void acceptCall();
+ ::Dynamic acceptCall_dyn();
+
+ void hangup();
+ ::Dynamic hangup_dyn();
+
+ ::String callStatus();
+ ::Dynamic callStatus_dyn();
+
+ ::snikket::jingle::DTMFSender dtmf();
+ ::Dynamic dtmf_dyn();
+
+ ::Array< ::Dynamic> videoTracks();
+ ::Dynamic videoTracks_dyn();
+
+ size_t videoTracks__fromC(void*** outPtr);
+
+ void markReadUpToId(::String upTo,::String upToBy, ::Dynamic callback);
+ ::Dynamic markReadUpToId_dyn();
+
+ void markReadUpToMessage( ::snikket::ChatMessage message, ::Dynamic callback);
+ ::Dynamic markReadUpToMessage_dyn();
+
+ void publishMds();
+ ::Dynamic publishMds_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Chat */
diff --git a/Sources/c_snikket/iinclude/snikket/ChatAttachment.h b/Sources/c_snikket/iinclude/snikket/ChatAttachment.h
new file mode 100644
index 0000000..a22273b
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/ChatAttachment.h
@@ -0,0 +1,75 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_ChatAttachment
+#define INCLUDED_snikket_ChatAttachment
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,ChatAttachment)
+HX_DECLARE_CLASS1(snikket,Hash)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES ChatAttachment_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef ChatAttachment_obj OBJ_;
+ ChatAttachment_obj();
+
+ public:
+ enum { _hx_ClassId = 0x2f907f78 };
+
+ void __construct(::String name,::String mime, ::Dynamic size,::Array< ::String > uris,::Array< ::Dynamic> hashes);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.ChatAttachment")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.ChatAttachment"); }
+ static ::hx::ObjectPtr< ChatAttachment_obj > __new(::String name,::String mime, ::Dynamic size,::Array< ::String > uris,::Array< ::Dynamic> hashes);
+ static ::hx::ObjectPtr< ChatAttachment_obj > __alloc(::hx::Ctx *_hx_ctx,::String name,::String mime, ::Dynamic size,::Array< ::String > uris,::Array< ::Dynamic> hashes);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ChatAttachment_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("ChatAttachment",fb,fc,04,6c); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ static ::snikket::ChatAttachment create(::String name,::String mime,int size,::String uri);
+ static ::Dynamic create_dyn();
+
+ ::String name;
+ ::String name__fromC();
+ ::Dynamic name__fromC_dyn();
+
+ ::String mime;
+ ::String mime__fromC();
+ ::Dynamic mime__fromC_dyn();
+
+ ::Dynamic size;
+ ::Dynamic size__fromC();
+ ::Dynamic size__fromC_dyn();
+
+ ::Array< ::String > uris;
+ size_t uris__fromC(const char*** outPtr);
+
+ ::Array< ::Dynamic> hashes;
+ size_t hashes__fromC(void*** outPtr);
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_ChatAttachment */
diff --git a/Sources/c_snikket/iinclude/snikket/ChatMessage.h b/Sources/c_snikket/iinclude/snikket/ChatMessage.h
new file mode 100644
index 0000000..c2531ac
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/ChatMessage.h
@@ -0,0 +1,172 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_ChatMessage
+#define INCLUDED_snikket_ChatMessage
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+HX_DECLARE_CLASS1(snikket,ChatAttachment)
+HX_DECLARE_CLASS1(snikket,ChatMessage)
+HX_DECLARE_CLASS1(snikket,ChatMessageBuilder)
+HX_DECLARE_CLASS1(snikket,Hash)
+HX_DECLARE_CLASS1(snikket,JID)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES ChatMessage_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef ChatMessage_obj OBJ_;
+ ChatMessage_obj();
+
+ public:
+ enum { _hx_ClassId = 0x36665f12 };
+
+ void __construct( ::Dynamic params);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.ChatMessage")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.ChatMessage"); }
+ static ::hx::ObjectPtr< ChatMessage_obj > __new( ::Dynamic params);
+ static ::hx::ObjectPtr< ChatMessage_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic params);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ChatMessage_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("ChatMessage",af,a1,2d,18); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ static ::snikket::ChatMessage fromStanza( ::snikket::Stanza stanza, ::snikket::JID localJid, ::Dynamic addContext);
+ static ::Dynamic fromStanza_dyn();
+
+ ::String localId;
+ ::String localId__fromC();
+ ::Dynamic localId__fromC_dyn();
+
+ ::String serverId;
+ ::String serverId__fromC();
+ ::Dynamic serverId__fromC_dyn();
+
+ ::String serverIdBy;
+ ::String serverIdBy__fromC();
+ ::Dynamic serverIdBy__fromC_dyn();
+
+ int type;
+ int type__fromC();
+ ::Dynamic type__fromC_dyn();
+
+ bool syncPoint;
+ ::String replyId;
+ ::String timestamp;
+ ::String timestamp__fromC();
+ ::Dynamic timestamp__fromC_dyn();
+
+ ::snikket::JID to;
+ ::snikket::JID from;
+ ::Array< ::Dynamic> recipients;
+ ::Array< ::Dynamic> replyTo;
+ ::String senderId;
+ ::String senderId__fromC();
+ ::Dynamic senderId__fromC_dyn();
+
+ ::snikket::ChatMessage replyToMessage;
+ ::snikket::ChatMessage replyToMessage__fromC();
+ ::Dynamic replyToMessage__fromC_dyn();
+
+ ::String threadId;
+ ::String threadId__fromC();
+ ::Dynamic threadId__fromC_dyn();
+
+ ::Array< ::Dynamic> attachments;
+ size_t attachments__fromC(void*** outPtr);
+
+ ::haxe::ds::StringMap reactions;
+ ::String text;
+ ::String text__fromC();
+ ::Dynamic text__fromC_dyn();
+
+ ::String lang;
+ ::String lang__fromC();
+ ::Dynamic lang__fromC_dyn();
+
+ int direction;
+ int direction__fromC();
+ ::Dynamic direction__fromC_dyn();
+
+ int status;
+ int status__fromC();
+ ::Dynamic status__fromC_dyn();
+
+ void set_status__fromC(int value);
+ ::Dynamic set_status__fromC_dyn();
+
+ ::Array< ::Dynamic> versions;
+ size_t versions__fromC(void*** outPtr);
+
+ ::Array< ::Dynamic> payloads;
+ ::snikket::Stanza stanza;
+ ::snikket::ChatMessageBuilder reply();
+ ::Dynamic reply_dyn();
+
+ ::String getReplyId();
+ ::Dynamic getReplyId_dyn();
+
+ ::snikket::ChatMessage set_replyToMessage( ::snikket::ChatMessage m);
+ ::Dynamic set_replyToMessage_dyn();
+
+ ::haxe::ds::StringMap set_reactions( ::haxe::ds::StringMap r);
+ ::Dynamic set_reactions_dyn();
+
+ ::Array< ::Dynamic> inlineHashReferences();
+ ::Dynamic inlineHashReferences_dyn();
+
+ ::String html();
+ ::Dynamic html_dyn();
+
+ ::String chatId();
+ ::Dynamic chatId_dyn();
+
+ ::String account();
+ ::Dynamic account_dyn();
+
+ bool isIncoming();
+ ::Dynamic isIncoming_dyn();
+
+ ::String threadIcon();
+ ::Dynamic threadIcon_dyn();
+
+ ::String callStatus();
+ ::Dynamic callStatus_dyn();
+
+ ::String callSid();
+ ::Dynamic callSid_dyn();
+
+ ::String callDuration();
+ ::Dynamic callDuration_dyn();
+
+ ::snikket::Stanza asStanza();
+ ::Dynamic asStanza_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_ChatMessage */
diff --git a/Sources/c_snikket/iinclude/snikket/ChatMessageBuilder.h b/Sources/c_snikket/iinclude/snikket/ChatMessageBuilder.h
new file mode 100644
index 0000000..041e48a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/ChatMessageBuilder.h
@@ -0,0 +1,189 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_ChatMessageBuilder
+#define INCLUDED_snikket_ChatMessageBuilder
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+HX_DECLARE_CLASS1(htmlparser,HtmlNode)
+HX_DECLARE_CLASS1(snikket,ChatAttachment)
+HX_DECLARE_CLASS1(snikket,ChatMessage)
+HX_DECLARE_CLASS1(snikket,ChatMessageBuilder)
+HX_DECLARE_CLASS1(snikket,JID)
+HX_DECLARE_CLASS1(snikket,Node)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES ChatMessageBuilder_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef ChatMessageBuilder_obj OBJ_;
+ ChatMessageBuilder_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1d9d1345 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.ChatMessageBuilder")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.ChatMessageBuilder"); }
+ static ::hx::ObjectPtr< ChatMessageBuilder_obj > __new();
+ static ::hx::ObjectPtr< ChatMessageBuilder_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ChatMessageBuilder_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("ChatMessageBuilder",2c,85,c0,07); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ static ::snikket::ChatMessage makeModerated( ::snikket::ChatMessage m,::String timestamp,::String moderatorId,::String reason);
+ static ::Dynamic makeModerated_dyn();
+
+ ::String localId;
+ ::String localId__fromC();
+ ::Dynamic localId__fromC_dyn();
+
+ void set_localId__fromC(::String value);
+ ::Dynamic set_localId__fromC_dyn();
+
+ ::String serverId;
+ ::String serverId__fromC();
+ ::Dynamic serverId__fromC_dyn();
+
+ void set_serverId__fromC(::String value);
+ ::Dynamic set_serverId__fromC_dyn();
+
+ ::String serverIdBy;
+ ::String serverIdBy__fromC();
+ ::Dynamic serverIdBy__fromC_dyn();
+
+ void set_serverIdBy__fromC(::String value);
+ ::Dynamic set_serverIdBy__fromC_dyn();
+
+ int type;
+ int type__fromC();
+ ::Dynamic type__fromC_dyn();
+
+ void set_type__fromC(int value);
+ ::Dynamic set_type__fromC_dyn();
+
+ bool syncPoint;
+ ::String replyId;
+ ::String timestamp;
+ ::String timestamp__fromC();
+ ::Dynamic timestamp__fromC_dyn();
+
+ void set_timestamp__fromC(::String value);
+ ::Dynamic set_timestamp__fromC_dyn();
+
+ ::snikket::JID to;
+ ::snikket::JID from;
+ ::snikket::JID sender;
+ ::Array< ::Dynamic> recipients;
+ ::Array< ::Dynamic> replyTo;
+ ::String senderId;
+ ::String senderId__fromC();
+ ::Dynamic senderId__fromC_dyn();
+
+ void set_senderId__fromC(::String value);
+ ::Dynamic set_senderId__fromC_dyn();
+
+ ::snikket::ChatMessage replyToMessage;
+ ::snikket::ChatMessage replyToMessage__fromC();
+ ::Dynamic replyToMessage__fromC_dyn();
+
+ void set_replyToMessage__fromC( ::snikket::ChatMessage value);
+ ::Dynamic set_replyToMessage__fromC_dyn();
+
+ ::String threadId;
+ ::String threadId__fromC();
+ ::Dynamic threadId__fromC_dyn();
+
+ void set_threadId__fromC(::String value);
+ ::Dynamic set_threadId__fromC_dyn();
+
+ ::Array< ::Dynamic> attachments;
+ size_t attachments__fromC(void*** outPtr);
+
+ ::haxe::ds::StringMap reactions;
+ ::String text;
+ ::String text__fromC();
+ ::Dynamic text__fromC_dyn();
+
+ void set_text__fromC(::String value);
+ ::Dynamic set_text__fromC_dyn();
+
+ ::String lang;
+ ::String lang__fromC();
+ ::Dynamic lang__fromC_dyn();
+
+ void set_lang__fromC(::String value);
+ ::Dynamic set_lang__fromC_dyn();
+
+ int direction;
+ int direction__fromC();
+ ::Dynamic direction__fromC_dyn();
+
+ void set_direction__fromC(int value);
+ ::Dynamic set_direction__fromC_dyn();
+
+ int status;
+ int status__fromC();
+ ::Dynamic status__fromC_dyn();
+
+ void set_status__fromC(int value);
+ ::Dynamic set_status__fromC_dyn();
+
+ ::Array< ::Dynamic> versions;
+ size_t versions__fromC(void*** outPtr);
+
+ ::Array< ::Dynamic> payloads;
+ ::snikket::Stanza stanza;
+ void attachSims( ::snikket::Stanza sims);
+ ::Dynamic attachSims_dyn();
+
+ void addAttachment( ::snikket::ChatAttachment attachment);
+ ::Dynamic addAttachment_dyn();
+
+ void setHtml(::String html);
+ ::Dynamic setHtml_dyn();
+
+ ::snikket::Node htmlToNode( ::htmlparser::HtmlNode node);
+ ::Dynamic htmlToNode_dyn();
+
+ ::String chatId();
+ ::Dynamic chatId_dyn();
+
+ ::String get_senderId();
+ ::Dynamic get_senderId_dyn();
+
+ bool isIncoming();
+ ::Dynamic isIncoming_dyn();
+
+ ::snikket::ChatMessage build();
+ ::Dynamic build_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_ChatMessageBuilder */
diff --git a/Sources/c_snikket/iinclude/snikket/Client.h b/Sources/c_snikket/iinclude/snikket/Client.h
new file mode 100644
index 0000000..8908f68
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/Client.h
@@ -0,0 +1,279 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Client
+#define INCLUDED_snikket_Client
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_EventEmitter
+#include <snikket/EventEmitter.h>
+#endif
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+HX_DECLARE_CLASS1(snikket,AttachmentSource)
+HX_DECLARE_CLASS1(snikket,AvailableChat)
+HX_DECLARE_CLASS1(snikket,Caps)
+HX_DECLARE_CLASS1(snikket,Chat)
+HX_DECLARE_CLASS1(snikket,ChatAttachment)
+HX_DECLARE_CLASS1(snikket,ChatMessage)
+HX_DECLARE_CLASS1(snikket,Client)
+HX_DECLARE_CLASS1(snikket,DirectChat)
+HX_DECLARE_CLASS1(snikket,EventEmitter)
+HX_DECLARE_CLASS1(snikket,EventResult)
+HX_DECLARE_CLASS1(snikket,GenericStream)
+HX_DECLARE_CLASS1(snikket,Hash)
+HX_DECLARE_CLASS1(snikket,JID)
+HX_DECLARE_CLASS1(snikket,ModerationAction)
+HX_DECLARE_CLASS1(snikket,Persistence)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,jingle,InitiatedSession)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStream)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStreamTrack)
+HX_DECLARE_CLASS2(snikket,jingle,Session)
+HX_DECLARE_CLASS2(snikket,queries,GenericQuery)
+HX_DECLARE_CLASS1(thenshim,Thenable)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Client_obj : public ::snikket::EventEmitter_obj
+{
+ public:
+ typedef ::snikket::EventEmitter_obj super;
+ typedef Client_obj OBJ_;
+ Client_obj();
+
+ public:
+ enum { _hx_ClassId = 0x668a7be8 };
+
+ void __construct(::String address,::Dynamic persistence);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Client")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Client"); }
+ static ::hx::ObjectPtr< Client_obj > __new(::String address,::Dynamic persistence);
+ static ::hx::ObjectPtr< Client_obj > __alloc(::hx::Ctx *_hx_ctx,::String address,::Dynamic persistence);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Client_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Client",6b,3e,e4,3e); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ bool sendAvailable;
+ void set_sendAvailable__fromC(bool value);
+ ::Dynamic set_sendAvailable__fromC_dyn();
+
+ ::snikket::GenericStream stream;
+ ::Array< ::Dynamic> chatMessageHandlers;
+ ::Array< ::Dynamic> syncMessageHandlers;
+ ::Array< ::Dynamic> chatStateHandlers;
+ ::snikket::JID jid;
+ ::Array< ::Dynamic> chats;
+ ::Dynamic persistence;
+ ::snikket::Caps caps;
+ ::String _displayName;
+ ::String fastMechanism;
+ ::String token;
+ ::haxe::ds::StringMap pendingCaps;
+ bool inSync;
+ void start();
+ ::Dynamic start_dyn();
+
+ void logout(bool completely);
+ ::Dynamic logout_dyn();
+
+ void usePassword(::String password);
+ ::Dynamic usePassword_dyn();
+
+ ::String accountId();
+ ::Dynamic accountId_dyn();
+
+ ::String displayName();
+ ::Dynamic displayName_dyn();
+
+ void setDisplayName(::String displayName);
+ ::Dynamic setDisplayName_dyn();
+
+ bool updateDisplayName(::String fn);
+ ::Dynamic updateDisplayName_dyn();
+
+ ::snikket::EventResult onConnected( ::Dynamic data);
+ ::Dynamic onConnected_dyn();
+
+ void prepareAttachment( ::snikket::AttachmentSource source, ::Dynamic callback);
+ ::Dynamic prepareAttachment_dyn();
+
+ void prepareAttachment__fromC( ::snikket::AttachmentSource source,::cpp::Function< void (void*,void*) > callback,void* callback__context);
+
+ void prepareAttachmentFor( ::snikket::AttachmentSource source,::Array< ::Dynamic> services,::Array< ::Dynamic> hashes, ::Dynamic callback);
+ ::Dynamic prepareAttachmentFor_dyn();
+
+ ::Array< ::Dynamic> getChats();
+ ::Dynamic getChats_dyn();
+
+ size_t getChats__fromC(void*** outPtr);
+
+ void findAvailableChats(::String q, ::Dynamic callback);
+ ::Dynamic findAvailableChats_dyn();
+
+ void findAvailableChats__fromC(::String q,::cpp::Function< void (const char*,void**,size_t,void*) > callback,void* callback__context);
+
+ ::snikket::Chat startChat( ::snikket::AvailableChat availableChat);
+ ::Dynamic startChat_dyn();
+
+ ::snikket::Chat getChat(::String chatId);
+ ::Dynamic getChat_dyn();
+
+ ::Dynamic moderateMessage( ::snikket::ModerationAction action);
+ ::Dynamic moderateMessage_dyn();
+
+ ::snikket::DirectChat getDirectChat(::String chatId,::hx::Null< bool > triggerIfNew);
+ ::Dynamic getDirectChat_dyn();
+
+ void addPasswordNeededListener( ::Dynamic handler);
+ ::Dynamic addPasswordNeededListener_dyn();
+
+ void addPasswordNeededListener__fromC(::cpp::Function< void (void*,void*) > handler,void* handler__context);
+
+ void addStatusOnlineListener( ::Dynamic handler);
+ ::Dynamic addStatusOnlineListener_dyn();
+
+ void addStatusOnlineListener__fromC(::cpp::Function< void (void*) > handler,void* handler__context);
+
+ void addStatusOfflineListener( ::Dynamic handler);
+ ::Dynamic addStatusOfflineListener_dyn();
+
+ void addStatusOfflineListener__fromC(::cpp::Function< void (void*) > handler,void* handler__context);
+
+ void addConnectionFailedListener( ::Dynamic handler);
+ ::Dynamic addConnectionFailedListener_dyn();
+
+ void addConnectionFailedListener__fromC(::cpp::Function< void (void*) > handler,void* handler__context);
+
+ void addChatMessageListener( ::Dynamic handler);
+ ::Dynamic addChatMessageListener_dyn();
+
+ void addChatMessageListener__fromC(::cpp::Function< void (void*,int,void*) > handler,void* handler__context);
+
+ void addSyncMessageListener( ::Dynamic handler);
+ ::Dynamic addSyncMessageListener_dyn();
+
+ void addSyncMessageListener__fromC(::cpp::Function< void (void*,void*) > handler,void* handler__context);
+
+ void addChatsUpdatedListener( ::Dynamic handler);
+ ::Dynamic addChatsUpdatedListener_dyn();
+
+ void addChatsUpdatedListener__fromC(::cpp::Function< void (void**,size_t,void*) > handler,void* handler__context);
+
+ void addCallRingListener( ::Dynamic handler);
+ ::Dynamic addCallRingListener_dyn();
+
+ void addCallRingListener__fromC(::cpp::Function< void (void*,const char*,void*) > handler,void* handler__context);
+
+ void addCallRetractListener( ::Dynamic handler);
+ ::Dynamic addCallRetractListener_dyn();
+
+ void addCallRetractListener__fromC(::cpp::Function< void (const char*,void*) > handler,void* handler__context);
+
+ void addCallRingingListener( ::Dynamic handler);
+ ::Dynamic addCallRingingListener_dyn();
+
+ void addCallRingingListener__fromC(::cpp::Function< void (const char*,void*) > handler,void* handler__context);
+
+ void addCallMediaListener( ::Dynamic handler);
+ ::Dynamic addCallMediaListener_dyn();
+
+ void addCallMediaListener__fromC(::cpp::Function< void (void*,bool,bool,void*) > handler,void* handler__context);
+
+ void addCallTrackListener( ::Dynamic handler);
+ ::Dynamic addCallTrackListener_dyn();
+
+ void addCallTrackListener__fromC(::cpp::Function< void (const char*,void*,void**,size_t,void*) > handler,void* handler__context);
+
+ void setInForeground();
+ ::Dynamic setInForeground_dyn();
+
+ void setNotInForeground();
+ ::Dynamic setNotInForeground_dyn();
+
+ ::Dynamic fetchMediaByHash(::Array< ::Dynamic> hashes,::Array< ::Dynamic> counterparts);
+ ::Dynamic fetchMediaByHash_dyn();
+
+ ::Dynamic fetchMediaByHashOneCounterpart(::Array< ::Dynamic> hashes, ::snikket::JID counterpart);
+ ::Dynamic fetchMediaByHashOneCounterpart_dyn();
+
+ void chatActivity( ::snikket::Chat chat,::hx::Null< bool > trigger);
+ ::Dynamic chatActivity_dyn();
+
+ void sortChats();
+ ::Dynamic sortChats_dyn();
+
+ void storeMessages(::Array< ::Dynamic> messages, ::Dynamic callback);
+ ::Dynamic storeMessages_dyn();
+
+ void sendQuery( ::snikket::queries::GenericQuery query);
+ ::Dynamic sendQuery_dyn();
+
+ void sendStanza( ::snikket::Stanza stanza);
+ ::Dynamic sendStanza_dyn();
+
+ void sendPresence(::String to, ::Dynamic augment);
+ ::Dynamic sendPresence_dyn();
+
+ void getIceServers( ::Dynamic callback);
+ ::Dynamic getIceServers_dyn();
+
+ void discoverServices( ::snikket::JID target,::String node, ::Dynamic callback);
+ ::Dynamic discoverServices_dyn();
+
+ void notifyMessageHandlers( ::snikket::ChatMessage message,int event);
+ ::Dynamic notifyMessageHandlers_dyn();
+
+ void notifySyncMessageHandlers( ::snikket::ChatMessage message);
+ ::Dynamic notifySyncMessageHandlers_dyn();
+
+ void rosterGet();
+ ::Dynamic rosterGet_dyn();
+
+ void startChatWith(::String jid, ::Dynamic handleCaps, ::Dynamic handleChat);
+ ::Dynamic startChatWith_dyn();
+
+ void serverBlocked(::String blocked);
+ ::Dynamic serverBlocked_dyn();
+
+ void bookmarksGet( ::Dynamic callback);
+ ::Dynamic bookmarksGet_dyn();
+
+ void sync( ::Dynamic callback);
+ ::Dynamic sync_dyn();
+
+ void onMAMJMI(::String sid, ::snikket::Stanza stanza);
+ ::Dynamic onMAMJMI_dyn();
+
+ void doSync( ::Dynamic callback,::String lastId);
+ ::Dynamic doSync_dyn();
+
+ void pingAllChannels(bool refresh);
+ ::Dynamic pingAllChannels_dyn();
+
+ void joinAllChannels();
+ ::Dynamic joinAllChannels_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Client */
diff --git a/Sources/c_snikket/iinclude/snikket/Color.h b/Sources/c_snikket/iinclude/snikket/Color.h
new file mode 100644
index 0000000..074383f
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/Color.h
@@ -0,0 +1,63 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Color
+#define INCLUDED_snikket_Color
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Color)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Color_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Color_obj OBJ_;
+ Color_obj();
+
+ public:
+ enum { _hx_ClassId = 0x204ca266 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="snikket.Color")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"snikket.Color"); }
+
+ inline static ::hx::ObjectPtr< Color_obj > __new() {
+ ::hx::ObjectPtr< Color_obj > __this = new Color_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Color_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Color_obj *__this = (Color_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Color_obj), false, "snikket.Color"));
+ *(void **)__this = Color_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Color_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Color",43,e1,89,dd); }
+
+ static ::String forString(::String s);
+ static ::Dynamic forString_dyn();
+
+ static ::String defaultPhoto(::String input,::String letter);
+ static ::Dynamic defaultPhoto_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Color */
diff --git a/Sources/c_snikket/iinclude/snikket/Config.h b/Sources/c_snikket/iinclude/snikket/Config.h
new file mode 100644
index 0000000..a987dd2
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/Config.h
@@ -0,0 +1,60 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Config
+#define INCLUDED_snikket_Config
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Config)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Config_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Config_obj OBJ_;
+ Config_obj();
+
+ public:
+ enum { _hx_ClassId = 0x240d085f };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="snikket.Config")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"snikket.Config"); }
+
+ inline static ::hx::ObjectPtr< Config_obj > __new() {
+ ::hx::ObjectPtr< Config_obj > __this = new Config_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Config_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Config_obj *__this = (Config_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Config_obj), false, "snikket.Config"));
+ *(void **)__this = Config_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Config_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Config",e2,ca,66,fc); }
+
+ static void __boot();
+ static bool relativeHashUri;
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Config */
diff --git a/Sources/c_snikket/iinclude/snikket/CustomEmojiReaction.h b/Sources/c_snikket/iinclude/snikket/CustomEmojiReaction.h
new file mode 100644
index 0000000..304c858
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/CustomEmojiReaction.h
@@ -0,0 +1,62 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_CustomEmojiReaction
+#define INCLUDED_snikket_CustomEmojiReaction
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_Reaction
+#include <snikket/Reaction.h>
+#endif
+HX_DECLARE_CLASS1(snikket,CustomEmojiReaction)
+HX_DECLARE_CLASS1(snikket,Reaction)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES CustomEmojiReaction_obj : public ::snikket::Reaction_obj
+{
+ public:
+ typedef ::snikket::Reaction_obj super;
+ typedef CustomEmojiReaction_obj OBJ_;
+ CustomEmojiReaction_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1e93c5e9 };
+
+ void __construct(::String senderId,::String timestamp,::String text,::String uri,::String envelopeId);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.CustomEmojiReaction")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.CustomEmojiReaction"); }
+ static ::hx::ObjectPtr< CustomEmojiReaction_obj > __new(::String senderId,::String timestamp,::String text,::String uri,::String envelopeId);
+ static ::hx::ObjectPtr< CustomEmojiReaction_obj > __alloc(::hx::Ctx *_hx_ctx,::String senderId,::String timestamp,::String text,::String uri,::String envelopeId);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~CustomEmojiReaction_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("CustomEmojiReaction",be,8e,6d,ec); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ ::String uri;
+ ::String uri__fromC();
+ ::Dynamic uri__fromC_dyn();
+
+ ::Dynamic render( ::Dynamic forText, ::Dynamic forImage);
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_CustomEmojiReaction */
diff --git a/Sources/c_snikket/iinclude/snikket/Date.h b/Sources/c_snikket/iinclude/snikket/Date.h
new file mode 100644
index 0000000..19af500
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/Date.h
@@ -0,0 +1,61 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Date
+#define INCLUDED_snikket_Date
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS0(Date)
+HX_DECLARE_CLASS1(snikket,Date)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Date_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Date_obj OBJ_;
+ Date_obj();
+
+ public:
+ enum { _hx_ClassId = 0x030f768b };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="snikket.Date")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"snikket.Date"); }
+
+ inline static ::hx::ObjectPtr< Date_obj > __new() {
+ ::hx::ObjectPtr< Date_obj > __this = new Date_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Date_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Date_obj *__this = (Date_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Date_obj), false, "snikket.Date"));
+ *(void **)__this = Date_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Date_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Date",4e,82,3c,2d); }
+
+ static ::String format( ::Date d);
+ static ::Dynamic format_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Date */
diff --git a/Sources/c_snikket/iinclude/snikket/DirectChat.h b/Sources/c_snikket/iinclude/snikket/DirectChat.h
new file mode 100644
index 0000000..e8a37c4
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/DirectChat.h
@@ -0,0 +1,96 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_DirectChat
+#define INCLUDED_snikket_DirectChat
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_Chat
+#include <snikket/Chat.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Chat)
+HX_DECLARE_CLASS1(snikket,ChatMessage)
+HX_DECLARE_CLASS1(snikket,ChatMessageBuilder)
+HX_DECLARE_CLASS1(snikket,Client)
+HX_DECLARE_CLASS1(snikket,DirectChat)
+HX_DECLARE_CLASS1(snikket,EventEmitter)
+HX_DECLARE_CLASS1(snikket,GenericStream)
+HX_DECLARE_CLASS1(snikket,Participant)
+HX_DECLARE_CLASS1(snikket,Persistence)
+HX_DECLARE_CLASS1(snikket,Reaction)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES DirectChat_obj : public ::snikket::Chat_obj
+{
+ public:
+ typedef ::snikket::Chat_obj super;
+ typedef DirectChat_obj OBJ_;
+ DirectChat_obj();
+
+ public:
+ enum { _hx_ClassId = 0x62c262be };
+
+ void __construct( ::snikket::Client client, ::snikket::GenericStream stream,::Dynamic persistence,::String chatId,::hx::Null< int > __o_uiState,::hx::Null< bool > __o_isBlocked, ::snikket::Stanza extensions,::String readUpToId,::String readUpToBy);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.DirectChat")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.DirectChat"); }
+ static ::hx::ObjectPtr< DirectChat_obj > __new( ::snikket::Client client, ::snikket::GenericStream stream,::Dynamic persistence,::String chatId,::hx::Null< int > __o_uiState,::hx::Null< bool > __o_isBlocked, ::snikket::Stanza extensions,::String readUpToId,::String readUpToBy);
+ static ::hx::ObjectPtr< DirectChat_obj > __alloc(::hx::Ctx *_hx_ctx, ::snikket::Client client, ::snikket::GenericStream stream,::Dynamic persistence,::String chatId,::hx::Null< int > __o_uiState,::hx::Null< bool > __o_isBlocked, ::snikket::Stanza extensions,::String readUpToId,::String readUpToBy);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~DirectChat_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("DirectChat",c1,22,a3,05); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ ::Array< ::String > getParticipants();
+
+ ::Array< ::String > counterparts();
+ ::Dynamic counterparts_dyn();
+
+ ::snikket::Participant getParticipantDetails(::String participantId);
+
+ void getMessagesBefore(::String beforeId,::String beforeTime, ::Dynamic handler);
+
+ void getMessagesAfter(::String afterId,::String afterTime, ::Dynamic handler);
+
+ void getMessagesAround(::String aroundId,::String aroundTime, ::Dynamic handler);
+
+ ::snikket::ChatMessageBuilder prepareIncomingMessage( ::snikket::ChatMessageBuilder message, ::snikket::Stanza stanza);
+
+ ::snikket::ChatMessageBuilder prepareOutgoingMessage( ::snikket::ChatMessageBuilder message);
+ ::Dynamic prepareOutgoingMessage_dyn();
+
+ void correctMessage(::String localId, ::snikket::ChatMessageBuilder message);
+
+ void sendMessage( ::snikket::ChatMessageBuilder message);
+
+ void removeReaction( ::snikket::ChatMessage m, ::snikket::Reaction reaction);
+
+ ::String lastMessageId();
+
+ void markReadUpTo( ::snikket::ChatMessage message);
+
+ void bookmark();
+
+ void sendChatState(::String state,::String threadId);
+
+ void close();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_DirectChat */
diff --git a/Sources/c_snikket/iinclude/snikket/Emoji.h b/Sources/c_snikket/iinclude/snikket/Emoji.h
new file mode 100644
index 0000000..685d92e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/Emoji.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Emoji
+#define INCLUDED_snikket_Emoji
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_Symbol
+#include <snikket/Symbol.h>
+#endif
+HX_DECLARE_STACK_FRAME(_hx_pos_dd1b4f8973e1f9df_136_new)
+HX_DECLARE_CLASS1(snikket,Emoji)
+HX_DECLARE_CLASS1(snikket,Symbol)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Emoji_obj : public ::snikket::Symbol_obj
+{
+ public:
+ typedef ::snikket::Symbol_obj super;
+ typedef Emoji_obj OBJ_;
+ Emoji_obj();
+
+ public:
+ enum { _hx_ClassId = 0x45c9a089 };
+
+ void __construct(::Array< int > codepoints);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Emoji")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Emoji"); }
+
+ inline static ::hx::ObjectPtr< Emoji_obj > __new(::Array< int > codepoints) {
+ ::hx::ObjectPtr< Emoji_obj > __this = new Emoji_obj();
+ __this->__construct(codepoints);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Emoji_obj > __alloc(::hx::Ctx *_hx_ctx,::Array< int > codepoints) {
+ Emoji_obj *__this = (Emoji_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Emoji_obj), true, "snikket.Emoji"));
+ *(void **)__this = Emoji_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_dd1b4f8973e1f9df_136_new)
+HXDLIN( 136) __this->super::__construct(codepoints);
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Emoji_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Emoji",66,df,06,03); }
+
+ bool isEmoji();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Emoji */
diff --git a/Sources/c_snikket/iinclude/snikket/EmojiUtil.h b/Sources/c_snikket/iinclude/snikket/EmojiUtil.h
new file mode 100644
index 0000000..f45f679
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/EmojiUtil.h
@@ -0,0 +1,95 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_EmojiUtil
+#define INCLUDED_snikket_EmojiUtil
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,EmojiUtil)
+HX_DECLARE_CLASS1(snikket,Symbol)
+HX_DECLARE_CLASS1(snikket,UnicodeBlocks)
+HX_DECLARE_CLASS1(snikket,UnicodeList)
+HX_DECLARE_CLASS1(snikket,UnicodeRange)
+HX_DECLARE_CLASS1(snikket,UnicodeSet)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES EmojiUtil_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef EmojiUtil_obj OBJ_;
+ EmojiUtil_obj();
+
+ public:
+ enum { _hx_ClassId = 0x636eb1f3 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="snikket.EmojiUtil")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"snikket.EmojiUtil"); }
+
+ inline static ::hx::ObjectPtr< EmojiUtil_obj > __new() {
+ ::hx::ObjectPtr< EmojiUtil_obj > __this = new EmojiUtil_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< EmojiUtil_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ EmojiUtil_obj *__this = (EmojiUtil_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(EmojiUtil_obj), false, "snikket.EmojiUtil"));
+ *(void **)__this = EmojiUtil_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~EmojiUtil_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("EmojiUtil",88,0e,c9,4c); }
+
+ static void __boot();
+ static ::snikket::UnicodeRange MISC_SYMBOLS_AND_PICTOGRAPHS;
+ static ::snikket::UnicodeRange SUPPLEMENTAL_SYMBOLS;
+ static ::snikket::UnicodeRange EMOTICONS;
+ static ::snikket::UnicodeRange MISC_SYMBOLS;
+ static ::snikket::UnicodeRange DINGBATS;
+ static ::snikket::UnicodeRange ENCLOSED_ALPHANUMERIC_SUPPLEMENT;
+ static ::snikket::UnicodeRange ENCLOSED_IDEOGRAPHIC_SUPPLEMENT;
+ static ::snikket::UnicodeRange REGIONAL_INDICATORS;
+ static ::snikket::UnicodeRange GEOMETRIC_SHAPES;
+ static ::snikket::UnicodeRange LATIN_SUPPLEMENT;
+ static ::snikket::UnicodeRange MISC_TECHNICAL;
+ static ::snikket::UnicodeRange TAGS;
+ static ::snikket::UnicodeList CYK_SYMBOLS_AND_PUNCTUATION;
+ static ::snikket::UnicodeList LETTERLIKE_SYMBOLS;
+ static ::snikket::UnicodeBlocks KEYCAP_COMBINEABLE;
+ static ::snikket::UnicodeBlocks SYMBOLIZE;
+ static ::snikket::UnicodeBlocks EMOJIS;
+ static int ZWJ;
+ static int VARIATION_16;
+ static int COMBINING_ENCLOSING_KEYCAP;
+ static int BLACK_FLAG;
+ static ::snikket::UnicodeRange FITZPATRICK;
+ static ::Array< ::Dynamic> parse(::String str);
+ static ::Dynamic parse_dyn();
+
+ static bool isEmoji(::String input);
+ static ::Dynamic isEmoji_dyn();
+
+ static bool isOnlyEmoji(::String input);
+ static ::Dynamic isOnlyEmoji_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_EmojiUtil */
diff --git a/Sources/c_snikket/iinclude/snikket/EventEmitter.h b/Sources/c_snikket/iinclude/snikket/EventEmitter.h
new file mode 100644
index 0000000..7b9ee4d
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/EventEmitter.h
@@ -0,0 +1,64 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_EventEmitter
+#define INCLUDED_snikket_EventEmitter
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+HX_DECLARE_CLASS1(snikket,EventEmitter)
+HX_DECLARE_CLASS1(snikket,EventHandler)
+HX_DECLARE_CLASS1(snikket,EventResult)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES EventEmitter_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef EventEmitter_obj OBJ_;
+ EventEmitter_obj();
+
+ public:
+ enum { _hx_ClassId = 0x6aca71d1 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.EventEmitter")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.EventEmitter"); }
+ static ::hx::ObjectPtr< EventEmitter_obj > __new();
+ static ::hx::ObjectPtr< EventEmitter_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~EventEmitter_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("EventEmitter",94,78,5d,17); }
+
+ ::haxe::ds::StringMap eventHandlers;
+ ::snikket::EventHandler on(::String eventName, ::Dynamic callback);
+ ::Dynamic on_dyn();
+
+ ::snikket::EventHandler once(::String eventName, ::Dynamic callback);
+ ::Dynamic once_dyn();
+
+ ::snikket::EventResult trigger(::String eventName, ::Dynamic eventData);
+ ::Dynamic trigger_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_EventEmitter */
diff --git a/Sources/c_snikket/iinclude/snikket/EventHandler.h b/Sources/c_snikket/iinclude/snikket/EventHandler.h
new file mode 100644
index 0000000..c25353d
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/EventHandler.h
@@ -0,0 +1,64 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_EventHandler
+#define INCLUDED_snikket_EventHandler
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,EventHandler)
+HX_DECLARE_CLASS1(snikket,EventResult)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES EventHandler_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef EventHandler_obj OBJ_;
+ EventHandler_obj();
+
+ public:
+ enum { _hx_ClassId = 0x39717849 };
+
+ void __construct(::Array< ::Dynamic> handlers, ::Dynamic callback, ::Dynamic onlyOnce);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.EventHandler")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.EventHandler"); }
+ static ::hx::ObjectPtr< EventHandler_obj > __new(::Array< ::Dynamic> handlers, ::Dynamic callback, ::Dynamic onlyOnce);
+ static ::hx::ObjectPtr< EventHandler_obj > __alloc(::hx::Ctx *_hx_ctx,::Array< ::Dynamic> handlers, ::Dynamic callback, ::Dynamic onlyOnce);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~EventHandler_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("EventHandler",f0,f2,3c,9e); }
+
+ ::Array< ::Dynamic> handlers;
+ ::Dynamic callback;
+ Dynamic callback_dyn() { return callback;}
+ bool onlyOnce;
+ ::snikket::EventResult call( ::Dynamic data);
+ ::Dynamic call_dyn();
+
+ ::snikket::EventHandler once();
+ ::Dynamic once_dyn();
+
+ void unsubscribe();
+ ::Dynamic unsubscribe_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_EventHandler */
diff --git a/Sources/c_snikket/iinclude/snikket/EventResult.h b/Sources/c_snikket/iinclude/snikket/EventResult.h
new file mode 100644
index 0000000..b3b5504
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/EventResult.h
@@ -0,0 +1,39 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_EventResult
+#define INCLUDED_snikket_EventResult
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,EventResult)
+namespace snikket{
+
+
+class EventResult_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef EventResult_obj OBJ_;
+
+ public:
+ EventResult_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("snikket.EventResult",06,97,23,e2); }
+ ::String __ToString() const { return HX_("EventResult.",d7,9b,be,c3) + _hx_tag; }
+
+ static ::snikket::EventResult EventHandled;
+ static inline ::snikket::EventResult EventHandled_dyn() { return EventHandled; }
+ static ::snikket::EventResult EventStop;
+ static inline ::snikket::EventResult EventStop_dyn() { return EventStop; }
+ static ::snikket::EventResult EventUnhandled;
+ static inline ::snikket::EventResult EventUnhandled_dyn() { return EventUnhandled; }
+ static ::snikket::EventResult EventValue( ::Dynamic result);
+ static ::Dynamic EventValue_dyn();
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_EventResult */
diff --git a/Sources/c_snikket/iinclude/snikket/GenericStream.h b/Sources/c_snikket/iinclude/snikket/GenericStream.h
new file mode 100644
index 0000000..50fc0bd
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/GenericStream.h
@@ -0,0 +1,72 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_GenericStream
+#define INCLUDED_snikket_GenericStream
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_EventEmitter
+#include <snikket/EventEmitter.h>
+#endif
+HX_DECLARE_CLASS1(snikket,EventEmitter)
+HX_DECLARE_CLASS1(snikket,GenericStream)
+HX_DECLARE_CLASS1(snikket,IqRequestType)
+HX_DECLARE_CLASS1(snikket,IqResult)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES GenericStream_obj : public ::snikket::EventEmitter_obj
+{
+ public:
+ typedef ::snikket::EventEmitter_obj super;
+ typedef GenericStream_obj OBJ_;
+ GenericStream_obj();
+
+ public:
+ enum { _hx_ClassId = 0x785c9e5e };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.GenericStream")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.GenericStream"); }
+
+ //~GenericStream_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("GenericStream",d7,75,9c,45); }
+
+ ::String clientId;
+ bool csi;
+ virtual void connect(::String jid,::Array< unsigned char > sm) {}
+ ::Dynamic connect_dyn();
+ virtual void disconnect() {}
+ ::Dynamic disconnect_dyn();
+ virtual void sendStanza( ::snikket::Stanza stanza) {}
+ ::Dynamic sendStanza_dyn();
+ virtual ::String newId() { return 0; }
+ ::Dynamic newId_dyn();
+ virtual void onIq( ::snikket::IqRequestType type,::String tag,::String xmlns, ::Dynamic handler) {}
+ ::Dynamic onIq_dyn();
+ void sendIq( ::snikket::Stanza stanza, ::Dynamic callback);
+ ::Dynamic sendIq_dyn();
+
+ void onStanza( ::snikket::Stanza stanza);
+ ::Dynamic onStanza_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_GenericStream */
diff --git a/Sources/c_snikket/iinclude/snikket/Hash.h b/Sources/c_snikket/iinclude/snikket/Hash.h
new file mode 100644
index 0000000..8be664d
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/Hash.h
@@ -0,0 +1,89 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Hash
+#define INCLUDED_snikket_Hash
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS1(snikket,Hash)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Hash_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Hash_obj OBJ_;
+ Hash_obj();
+
+ public:
+ enum { _hx_ClassId = 0x05b4502b };
+
+ void __construct(::String algorithm,::Array< unsigned char > hash);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Hash")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Hash"); }
+ static ::hx::ObjectPtr< Hash_obj > __new(::String algorithm,::Array< unsigned char > hash);
+ static ::hx::ObjectPtr< Hash_obj > __alloc(::hx::Ctx *_hx_ctx,::String algorithm,::Array< unsigned char > hash);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Hash_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Hash",ee,5b,e1,2f); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ static ::snikket::Hash fromHex(::String algorithm,::String hash);
+ static ::Dynamic fromHex_dyn();
+
+ static ::snikket::Hash fromUri(::String uri);
+ static ::Dynamic fromUri_dyn();
+
+ static ::snikket::Hash sha1( ::haxe::io::Bytes bytes);
+ static ::Dynamic sha1_dyn();
+
+ static ::snikket::Hash sha256( ::haxe::io::Bytes bytes);
+ static ::Dynamic sha256_dyn();
+
+ ::String algorithm;
+ ::String algorithm__fromC();
+ ::Dynamic algorithm__fromC_dyn();
+
+ ::Array< unsigned char > hash;
+ ::String toUri();
+ ::Dynamic toUri_dyn();
+
+ ::String bobUri();
+ ::Dynamic bobUri_dyn();
+
+ ::String serializeUri();
+ ::Dynamic serializeUri_dyn();
+
+ ::String toHex();
+ ::Dynamic toHex_dyn();
+
+ ::String toBase64();
+ ::Dynamic toBase64_dyn();
+
+ ::String toBase64Url();
+ ::Dynamic toBase64Url_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Hash */
diff --git a/Sources/c_snikket/iinclude/snikket/ID.h b/Sources/c_snikket/iinclude/snikket/ID.h
new file mode 100644
index 0000000..6d5d8c6
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/ID.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_ID
+#define INCLUDED_snikket_ID
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,ID)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES ID_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef ID_obj OBJ_;
+ ID_obj();
+
+ public:
+ enum { _hx_ClassId = 0x5880bad8 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="snikket.ID")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"snikket.ID"); }
+
+ inline static ::hx::ObjectPtr< ID_obj > __new() {
+ ::hx::ObjectPtr< ID_obj > __this = new ID_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< ID_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ ID_obj *__this = (ID_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(ID_obj), false, "snikket.ID"));
+ *(void **)__this = ID_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ID_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("ID",db,3f,00,00); }
+
+ static ::String tiny();
+ static ::Dynamic tiny_dyn();
+
+ static ::String _hx_short();
+ static ::Dynamic _hx_short_dyn();
+
+ static ::String medium();
+ static ::Dynamic medium_dyn();
+
+ static ::String _hx_long();
+ static ::Dynamic _hx_long_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_ID */
diff --git a/Sources/c_snikket/iinclude/snikket/Identicon.h b/Sources/c_snikket/iinclude/snikket/Identicon.h
new file mode 100644
index 0000000..f440dab
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/Identicon.h
@@ -0,0 +1,60 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Identicon
+#define INCLUDED_snikket_Identicon
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Identicon)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Identicon_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Identicon_obj OBJ_;
+ Identicon_obj();
+
+ public:
+ enum { _hx_ClassId = 0x3ab0d0ec };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="snikket.Identicon")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"snikket.Identicon"); }
+
+ inline static ::hx::ObjectPtr< Identicon_obj > __new() {
+ ::hx::ObjectPtr< Identicon_obj > __this = new Identicon_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Identicon_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Identicon_obj *__this = (Identicon_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Identicon_obj), false, "snikket.Identicon"));
+ *(void **)__this = Identicon_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Identicon_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Identicon",49,42,f3,f1); }
+
+ static ::String svg(::String source);
+ static ::Dynamic svg_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Identicon */
diff --git a/Sources/c_snikket/iinclude/snikket/Identity.h b/Sources/c_snikket/iinclude/snikket/Identity.h
new file mode 100644
index 0000000..28c9c85
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/Identity.h
@@ -0,0 +1,61 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Identity
+#define INCLUDED_snikket_Identity
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Identity)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Identity_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Identity_obj OBJ_;
+ Identity_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7fcd1307 };
+
+ void __construct(::String category,::String type,::String name);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Identity")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Identity"); }
+ static ::hx::ObjectPtr< Identity_obj > __new(::String category,::String type,::String name);
+ static ::hx::ObjectPtr< Identity_obj > __alloc(::hx::Ctx *_hx_ctx,::String category,::String type,::String name);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Identity_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Identity",5e,01,e1,92); }
+
+ ::String category;
+ ::String type;
+ ::String name;
+ void addToDisco( ::snikket::Stanza stanza);
+ ::Dynamic addToDisco_dyn();
+
+ ::String ver();
+ ::Dynamic ver_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Identity */
diff --git a/Sources/c_snikket/iinclude/snikket/IqRequestType.h b/Sources/c_snikket/iinclude/snikket/IqRequestType.h
new file mode 100644
index 0000000..b4f759d
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/IqRequestType.h
@@ -0,0 +1,35 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_IqRequestType
+#define INCLUDED_snikket_IqRequestType
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,IqRequestType)
+namespace snikket{
+
+
+class IqRequestType_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef IqRequestType_obj OBJ_;
+
+ public:
+ IqRequestType_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("snikket.IqRequestType",d0,62,72,94); }
+ ::String __ToString() const { return HX_("IqRequestType.",8d,9a,13,cc) + _hx_tag; }
+
+ static ::snikket::IqRequestType Get;
+ static inline ::snikket::IqRequestType Get_dyn() { return Get; }
+ static ::snikket::IqRequestType Set;
+ static inline ::snikket::IqRequestType Set_dyn() { return Set; }
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_IqRequestType */
diff --git a/Sources/c_snikket/iinclude/snikket/IqResult.h b/Sources/c_snikket/iinclude/snikket/IqResult.h
new file mode 100644
index 0000000..81b0271
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/IqResult.h
@@ -0,0 +1,39 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_IqResult
+#define INCLUDED_snikket_IqResult
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,IqResult)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+namespace snikket{
+
+
+class IqResult_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef IqResult_obj OBJ_;
+
+ public:
+ IqResult_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("snikket.IqResult",16,e9,a3,c2); }
+ ::String __ToString() const { return HX_("IqResult.",89,d1,c3,9e) + _hx_tag; }
+
+ static ::snikket::IqResult IqNoResult;
+ static inline ::snikket::IqResult IqNoResult_dyn() { return IqNoResult; }
+ static ::snikket::IqResult IqResult;
+ static inline ::snikket::IqResult IqResult_dyn() { return IqResult; }
+ static ::snikket::IqResult IqResultElement( ::snikket::Stanza element);
+ static ::Dynamic IqResultElement_dyn();
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_IqResult */
diff --git a/Sources/c_snikket/iinclude/snikket/JID.h b/Sources/c_snikket/iinclude/snikket/JID.h
new file mode 100644
index 0000000..c64d0d0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/JID.h
@@ -0,0 +1,78 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_JID
+#define INCLUDED_snikket_JID
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,JID)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES JID_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef JID_obj OBJ_;
+ JID_obj();
+
+ public:
+ enum { _hx_ClassId = 0x18238908 };
+
+ void __construct(::String node,::String domain,::String resource);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.JID")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.JID"); }
+ static ::hx::ObjectPtr< JID_obj > __new(::String node,::String domain,::String resource);
+ static ::hx::ObjectPtr< JID_obj > __alloc(::hx::Ctx *_hx_ctx,::String node,::String domain,::String resource);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~JID_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("JID",a5,66,38,00); }
+
+ static ::snikket::JID parse(::String jid);
+ static ::Dynamic parse_dyn();
+
+ ::String node;
+ ::String domain;
+ ::String resource;
+ ::snikket::JID asBare();
+ ::Dynamic asBare_dyn();
+
+ ::snikket::JID withResource(::String resource);
+ ::Dynamic withResource_dyn();
+
+ bool isValid();
+ ::Dynamic isValid_dyn();
+
+ bool isDomain();
+ ::Dynamic isDomain_dyn();
+
+ bool isBare();
+ ::Dynamic isBare_dyn();
+
+ bool equals( ::snikket::JID rhs);
+ ::Dynamic equals_dyn();
+
+ ::String asString();
+ ::Dynamic asString_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_JID */
diff --git a/Sources/c_snikket/iinclude/snikket/Message.h b/Sources/c_snikket/iinclude/snikket/Message.h
new file mode 100644
index 0000000..931dcc6
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/Message.h
@@ -0,0 +1,63 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Message
+#define INCLUDED_snikket_Message
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,ChatMessageBuilder)
+HX_DECLARE_CLASS1(snikket,JID)
+HX_DECLARE_CLASS1(snikket,Message)
+HX_DECLARE_CLASS1(snikket,MessageStanza)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Message_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Message_obj OBJ_;
+ Message_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7c0c6d2e };
+
+ void __construct(::String chatId,::String senderId,::String threadId, ::snikket::MessageStanza parsed);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Message")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Message"); }
+ static ::hx::ObjectPtr< Message_obj > __new(::String chatId,::String senderId,::String threadId, ::snikket::MessageStanza parsed);
+ static ::hx::ObjectPtr< Message_obj > __alloc(::hx::Ctx *_hx_ctx,::String chatId,::String senderId,::String threadId, ::snikket::MessageStanza parsed);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Message_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Message",a7,5d,62,67); }
+
+ static ::snikket::Message fromStanza( ::snikket::Stanza stanza, ::snikket::JID localJid, ::Dynamic addContext);
+ static ::Dynamic fromStanza_dyn();
+
+ ::String chatId;
+ ::String senderId;
+ ::String threadId;
+ ::snikket::MessageStanza parsed;
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Message */
diff --git a/Sources/c_snikket/iinclude/snikket/MessageStanza.h b/Sources/c_snikket/iinclude/snikket/MessageStanza.h
new file mode 100644
index 0000000..486e5a6
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/MessageStanza.h
@@ -0,0 +1,46 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_MessageStanza
+#define INCLUDED_snikket_MessageStanza
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,ChatMessage)
+HX_DECLARE_CLASS1(snikket,MessageStanza)
+HX_DECLARE_CLASS1(snikket,ModerationAction)
+HX_DECLARE_CLASS1(snikket,ReactionUpdate)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+namespace snikket{
+
+
+class MessageStanza_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef MessageStanza_obj OBJ_;
+
+ public:
+ MessageStanza_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("snikket.MessageStanza",4b,b3,84,a4); }
+ ::String __ToString() const { return HX_("MessageStanza.",b2,b5,07,cc) + _hx_tag; }
+
+ static ::snikket::MessageStanza ChatMessageStanza( ::snikket::ChatMessage message);
+ static ::Dynamic ChatMessageStanza_dyn();
+ static ::snikket::MessageStanza ErrorMessageStanza( ::snikket::Stanza stanza);
+ static ::Dynamic ErrorMessageStanza_dyn();
+ static ::snikket::MessageStanza ModerateMessageStanza( ::snikket::ModerationAction action);
+ static ::Dynamic ModerateMessageStanza_dyn();
+ static ::snikket::MessageStanza ReactionUpdateStanza( ::snikket::ReactionUpdate update);
+ static ::Dynamic ReactionUpdateStanza_dyn();
+ static ::snikket::MessageStanza UnknownMessageStanza( ::snikket::Stanza stanza);
+ static ::Dynamic UnknownMessageStanza_dyn();
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_MessageStanza */
diff --git a/Sources/c_snikket/iinclude/snikket/MessageSync.h b/Sources/c_snikket/iinclude/snikket/MessageSync.h
new file mode 100644
index 0000000..7469276
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/MessageSync.h
@@ -0,0 +1,91 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_MessageSync
+#define INCLUDED_snikket_MessageSync
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+HX_DECLARE_CLASS1(snikket,ChatMessageBuilder)
+HX_DECLARE_CLASS1(snikket,Client)
+HX_DECLARE_CLASS1(snikket,EventEmitter)
+HX_DECLARE_CLASS1(snikket,GenericStream)
+HX_DECLARE_CLASS1(snikket,MessageSync)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES MessageSync_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef MessageSync_obj OBJ_;
+ MessageSync_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0c8e50c1 };
+
+ void __construct( ::snikket::Client client, ::snikket::GenericStream stream, ::Dynamic filter,::String serviceJID);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.MessageSync")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.MessageSync"); }
+ static ::hx::ObjectPtr< MessageSync_obj > __new( ::snikket::Client client, ::snikket::GenericStream stream, ::Dynamic filter,::String serviceJID);
+ static ::hx::ObjectPtr< MessageSync_obj > __alloc(::hx::Ctx *_hx_ctx, ::snikket::Client client, ::snikket::GenericStream stream, ::Dynamic filter,::String serviceJID);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~MessageSync_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("MessageSync",a2,a3,78,63); }
+
+ ::snikket::Client client;
+ ::snikket::GenericStream stream;
+ ::Dynamic filter;
+ ::String serviceJID;
+ ::Dynamic handler;
+ Dynamic handler_dyn() { return handler;}
+ ::Dynamic contextHandler;
+ Dynamic contextHandler_dyn() { return contextHandler;}
+ ::Dynamic errorHandler;
+ Dynamic errorHandler_dyn() { return errorHandler;}
+ ::Dynamic lastPage;
+ int progress;
+ bool complete;
+ bool newestPageFirst;
+ ::haxe::ds::StringMap jmi;
+ void fetchNext();
+ ::Dynamic fetchNext_dyn();
+
+ bool hasMore();
+ ::Dynamic hasMore_dyn();
+
+ void addContext( ::Dynamic handler);
+ ::Dynamic addContext_dyn();
+
+ void onMessages( ::Dynamic handler);
+ ::Dynamic onMessages_dyn();
+
+ void onError( ::Dynamic handler);
+ ::Dynamic onError_dyn();
+
+ void setNewestPageFirst(bool newestPageFirst);
+ ::Dynamic setNewestPageFirst_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_MessageSync */
diff --git a/Sources/c_snikket/iinclude/snikket/ModerationAction.h b/Sources/c_snikket/iinclude/snikket/ModerationAction.h
new file mode 100644
index 0000000..16f7e22
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/ModerationAction.h
@@ -0,0 +1,76 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_ModerationAction
+#define INCLUDED_snikket_ModerationAction
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_cab007b58fe42bf8_10_new)
+HX_DECLARE_CLASS1(snikket,ModerationAction)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES ModerationAction_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef ModerationAction_obj OBJ_;
+ ModerationAction_obj();
+
+ public:
+ enum { _hx_ClassId = 0x2ac69cd9 };
+
+ void __construct(::String chatId,::String moderateServerId,::String timestamp,::String moderatorId,::String reason);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.ModerationAction")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.ModerationAction"); }
+
+ inline static ::hx::ObjectPtr< ModerationAction_obj > __new(::String chatId,::String moderateServerId,::String timestamp,::String moderatorId,::String reason) {
+ ::hx::ObjectPtr< ModerationAction_obj > __this = new ModerationAction_obj();
+ __this->__construct(chatId,moderateServerId,timestamp,moderatorId,reason);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< ModerationAction_obj > __alloc(::hx::Ctx *_hx_ctx,::String chatId,::String moderateServerId,::String timestamp,::String moderatorId,::String reason) {
+ ModerationAction_obj *__this = (ModerationAction_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(ModerationAction_obj), true, "snikket.ModerationAction"));
+ *(void **)__this = ModerationAction_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_cab007b58fe42bf8_10_new)
+HXLINE( 11) ( ( ::snikket::ModerationAction)(__this) )->chatId = chatId;
+HXLINE( 12) ( ( ::snikket::ModerationAction)(__this) )->moderateServerId = moderateServerId;
+HXLINE( 13) ( ( ::snikket::ModerationAction)(__this) )->timestamp = timestamp;
+HXLINE( 14) ( ( ::snikket::ModerationAction)(__this) )->moderatorId = moderatorId;
+HXLINE( 15) ( ( ::snikket::ModerationAction)(__this) )->reason = reason;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ModerationAction_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("ModerationAction",1c,c1,77,cb); }
+
+ ::String chatId;
+ ::String moderateServerId;
+ ::String timestamp;
+ ::String moderatorId;
+ ::String reason;
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_ModerationAction */
diff --git a/Sources/c_snikket/iinclude/snikket/Node.h b/Sources/c_snikket/iinclude/snikket/Node.h
new file mode 100644
index 0000000..31bf990
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/Node.h
@@ -0,0 +1,38 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Node
+#define INCLUDED_snikket_Node
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Node)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS1(snikket,TextNode)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+namespace snikket{
+
+
+class Node_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef Node_obj OBJ_;
+
+ public:
+ Node_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("snikket.Node",b3,af,c7,53); }
+ ::String __ToString() const { return HX_("Node.",cc,27,ec,32) + _hx_tag; }
+
+ static ::snikket::Node CData( ::snikket::TextNode textNode);
+ static ::Dynamic CData_dyn();
+ static ::snikket::Node Element( ::snikket::Stanza stanza);
+ static ::Dynamic Element_dyn();
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Node */
diff --git a/Sources/c_snikket/iinclude/snikket/Notification.h b/Sources/c_snikket/iinclude/snikket/Notification.h
new file mode 100644
index 0000000..d41f56b
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/Notification.h
@@ -0,0 +1,98 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Notification
+#define INCLUDED_snikket_Notification
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_b0a79cae3ba17812_21_new)
+HX_DECLARE_CLASS1(snikket,ChatMessage)
+HX_DECLARE_CLASS1(snikket,Notification)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Notification_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Notification_obj OBJ_;
+ Notification_obj();
+
+ public:
+ enum { _hx_ClassId = 0x778a3c48 };
+
+ void __construct(::String title,::String body,::String accountId,::String chatId,::String messageId,int type,::String callStatus,::String callSid,::String imageUri,::String lang,::String timestamp);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Notification")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Notification"); }
+
+ inline static ::hx::ObjectPtr< Notification_obj > __new(::String title,::String body,::String accountId,::String chatId,::String messageId,int type,::String callStatus,::String callSid,::String imageUri,::String lang,::String timestamp) {
+ ::hx::ObjectPtr< Notification_obj > __this = new Notification_obj();
+ __this->__construct(title,body,accountId,chatId,messageId,type,callStatus,callSid,imageUri,lang,timestamp);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Notification_obj > __alloc(::hx::Ctx *_hx_ctx,::String title,::String body,::String accountId,::String chatId,::String messageId,int type,::String callStatus,::String callSid,::String imageUri,::String lang,::String timestamp) {
+ Notification_obj *__this = (Notification_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Notification_obj), true, "snikket.Notification"));
+ *(void **)__this = Notification_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_b0a79cae3ba17812_21_new)
+HXLINE( 22) ( ( ::snikket::Notification)(__this) )->title = title;
+HXLINE( 23) ( ( ::snikket::Notification)(__this) )->body = body;
+HXLINE( 24) ( ( ::snikket::Notification)(__this) )->accountId = accountId;
+HXLINE( 25) ( ( ::snikket::Notification)(__this) )->chatId = chatId;
+HXLINE( 26) ( ( ::snikket::Notification)(__this) )->messageId = messageId;
+HXLINE( 27) ( ( ::snikket::Notification)(__this) )->type = type;
+HXLINE( 28) ( ( ::snikket::Notification)(__this) )->callStatus = callStatus;
+HXLINE( 29) ( ( ::snikket::Notification)(__this) )->callSid = callSid;
+HXLINE( 30) ( ( ::snikket::Notification)(__this) )->imageUri = imageUri;
+HXLINE( 31) ( ( ::snikket::Notification)(__this) )->lang = lang;
+HXLINE( 32) ( ( ::snikket::Notification)(__this) )->timestamp = timestamp;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Notification_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Notification",0b,43,1d,24); }
+
+ static ::snikket::Notification fromChatMessage( ::snikket::ChatMessage m);
+ static ::Dynamic fromChatMessage_dyn();
+
+ static ::snikket::Notification fromThinStanza( ::snikket::Stanza stanza);
+ static ::Dynamic fromThinStanza_dyn();
+
+ ::String title;
+ ::String body;
+ ::String accountId;
+ ::String chatId;
+ ::String messageId;
+ int type;
+ ::String callStatus;
+ ::String callSid;
+ ::String imageUri;
+ ::String lang;
+ ::String timestamp;
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Notification */
diff --git a/Sources/c_snikket/iinclude/snikket/Other.h b/Sources/c_snikket/iinclude/snikket/Other.h
new file mode 100644
index 0000000..500f13e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/Other.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Other
+#define INCLUDED_snikket_Other
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_Symbol
+#include <snikket/Symbol.h>
+#endif
+HX_DECLARE_STACK_FRAME(_hx_pos_aac171f877c525f9_146_new)
+HX_DECLARE_CLASS1(snikket,Other)
+HX_DECLARE_CLASS1(snikket,Symbol)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Other_obj : public ::snikket::Symbol_obj
+{
+ public:
+ typedef ::snikket::Symbol_obj super;
+ typedef Other_obj OBJ_;
+ Other_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0c6697d3 };
+
+ void __construct(::Array< int > codepoints);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Other")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Other"); }
+
+ inline static ::hx::ObjectPtr< Other_obj > __new(::Array< int > codepoints) {
+ ::hx::ObjectPtr< Other_obj > __this = new Other_obj();
+ __this->__construct(codepoints);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Other_obj > __alloc(::hx::Ctx *_hx_ctx,::Array< int > codepoints) {
+ Other_obj *__this = (Other_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Other_obj), true, "snikket.Other"));
+ *(void **)__this = Other_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_aac171f877c525f9_146_new)
+HXDLIN( 146) __this->super::__construct(codepoints);
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Other_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Other",b0,d6,a3,c9); }
+
+ bool isEmoji();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Other */
diff --git a/Sources/c_snikket/iinclude/snikket/Participant.h b/Sources/c_snikket/iinclude/snikket/Participant.h
new file mode 100644
index 0000000..5317907
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/Participant.h
@@ -0,0 +1,88 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Participant
+#define INCLUDED_snikket_Participant
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_33195ab9b813f4c6_20_new)
+HX_DECLARE_CLASS1(snikket,Participant)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Participant_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Participant_obj OBJ_;
+ Participant_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7d555cf6 };
+
+ void __construct(::String displayName,::String photoUri,::String placeholderUri,bool isSelf);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Participant")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Participant"); }
+
+ inline static ::hx::ObjectPtr< Participant_obj > __new(::String displayName,::String photoUri,::String placeholderUri,bool isSelf) {
+ ::hx::ObjectPtr< Participant_obj > __this = new Participant_obj();
+ __this->__construct(displayName,photoUri,placeholderUri,isSelf);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Participant_obj > __alloc(::hx::Ctx *_hx_ctx,::String displayName,::String photoUri,::String placeholderUri,bool isSelf) {
+ Participant_obj *__this = (Participant_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Participant_obj), true, "snikket.Participant"));
+ *(void **)__this = Participant_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_33195ab9b813f4c6_20_new)
+HXLINE( 21) ( ( ::snikket::Participant)(__this) )->displayName = displayName;
+HXLINE( 22) ( ( ::snikket::Participant)(__this) )->photoUri = photoUri;
+HXLINE( 23) ( ( ::snikket::Participant)(__this) )->placeholderUri = placeholderUri;
+HXLINE( 24) ( ( ::snikket::Participant)(__this) )->isSelf = isSelf;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Participant_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Participant",93,9f,1c,5f); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ ::String displayName;
+ ::String displayName__fromC();
+ ::Dynamic displayName__fromC_dyn();
+
+ ::String photoUri;
+ ::String photoUri__fromC();
+ ::Dynamic photoUri__fromC_dyn();
+
+ ::String placeholderUri;
+ ::String placeholderUri__fromC();
+ ::Dynamic placeholderUri__fromC_dyn();
+
+ bool isSelf;
+ bool isSelf__fromC();
+ ::Dynamic isSelf__fromC_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Participant */
diff --git a/Sources/c_snikket/iinclude/snikket/Persistence.h b/Sources/c_snikket/iinclude/snikket/Persistence.h
new file mode 100644
index 0000000..b3621d1
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/Persistence.h
@@ -0,0 +1,129 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Persistence
+#define INCLUDED_snikket_Persistence
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Caps)
+HX_DECLARE_CLASS1(snikket,Chat)
+HX_DECLARE_CLASS1(snikket,ChatMessage)
+HX_DECLARE_CLASS1(snikket,Persistence)
+HX_DECLARE_CLASS1(snikket,ReactionUpdate)
+HX_DECLARE_CLASS1(snikket,SerializedChat)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Persistence_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ static void __boot();
+ void (::hx::Object :: *_hx_lastId)(::String accountId,::String chatId, ::Dynamic callback);
+ static inline void lastId( ::Dynamic _hx_,::String accountId,::String chatId, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_lastId)(accountId,chatId,callback);
+ }
+ void (::hx::Object :: *_hx_storeChats)(::String accountId,::Array< ::Dynamic> chats);
+ static inline void storeChats( ::Dynamic _hx_,::String accountId,::Array< ::Dynamic> chats) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_storeChats)(accountId,chats);
+ }
+ void (::hx::Object :: *_hx_getChats)(::String accountId, ::Dynamic callback);
+ static inline void getChats( ::Dynamic _hx_,::String accountId, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_getChats)(accountId,callback);
+ }
+ void (::hx::Object :: *_hx_getChatsUnreadDetails)(::String accountId,::Array< ::Dynamic> chats, ::Dynamic callback);
+ static inline void getChatsUnreadDetails( ::Dynamic _hx_,::String accountId,::Array< ::Dynamic> chats, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_getChatsUnreadDetails)(accountId,chats,callback);
+ }
+ void (::hx::Object :: *_hx_storeReaction)(::String accountId, ::snikket::ReactionUpdate update, ::Dynamic callback);
+ static inline void storeReaction( ::Dynamic _hx_,::String accountId, ::snikket::ReactionUpdate update, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_storeReaction)(accountId,update,callback);
+ }
+ void (::hx::Object :: *_hx_storeMessages)(::String accountId,::Array< ::Dynamic> message, ::Dynamic callback);
+ static inline void storeMessages( ::Dynamic _hx_,::String accountId,::Array< ::Dynamic> message, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_storeMessages)(accountId,message,callback);
+ }
+ void (::hx::Object :: *_hx_updateMessage)(::String accountId, ::snikket::ChatMessage message);
+ static inline void updateMessage( ::Dynamic _hx_,::String accountId, ::snikket::ChatMessage message) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_updateMessage)(accountId,message);
+ }
+ void (::hx::Object :: *_hx_updateMessageStatus)(::String accountId,::String localId,int status, ::Dynamic callback);
+ static inline void updateMessageStatus( ::Dynamic _hx_,::String accountId,::String localId,int status, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_updateMessageStatus)(accountId,localId,status,callback);
+ }
+ void (::hx::Object :: *_hx_getMessage)(::String accountId,::String chatId,::String serverId,::String localId, ::Dynamic callback);
+ static inline void getMessage( ::Dynamic _hx_,::String accountId,::String chatId,::String serverId,::String localId, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_getMessage)(accountId,chatId,serverId,localId,callback);
+ }
+ void (::hx::Object :: *_hx_getMessagesBefore)(::String accountId,::String chatId,::String beforeId,::String beforeTime, ::Dynamic callback);
+ static inline void getMessagesBefore( ::Dynamic _hx_,::String accountId,::String chatId,::String beforeId,::String beforeTime, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_getMessagesBefore)(accountId,chatId,beforeId,beforeTime,callback);
+ }
+ void (::hx::Object :: *_hx_getMessagesAfter)(::String accountId,::String chatId,::String afterId,::String afterTime, ::Dynamic callback);
+ static inline void getMessagesAfter( ::Dynamic _hx_,::String accountId,::String chatId,::String afterId,::String afterTime, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_getMessagesAfter)(accountId,chatId,afterId,afterTime,callback);
+ }
+ void (::hx::Object :: *_hx_getMessagesAround)(::String accountId,::String chatId,::String aroundId,::String aroundTime, ::Dynamic callback);
+ static inline void getMessagesAround( ::Dynamic _hx_,::String accountId,::String chatId,::String aroundId,::String aroundTime, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_getMessagesAround)(accountId,chatId,aroundId,aroundTime,callback);
+ }
+ void (::hx::Object :: *_hx_hasMedia)(::String hashAlgorithm,::Array< unsigned char > hash, ::Dynamic callback);
+ static inline void hasMedia( ::Dynamic _hx_,::String hashAlgorithm,::Array< unsigned char > hash, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_hasMedia)(hashAlgorithm,hash,callback);
+ }
+ void (::hx::Object :: *_hx_storeMedia)(::String mime,::Array< unsigned char > bytes, ::Dynamic callback);
+ static inline void storeMedia( ::Dynamic _hx_,::String mime,::Array< unsigned char > bytes, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_storeMedia)(mime,bytes,callback);
+ }
+ void (::hx::Object :: *_hx_removeMedia)(::String hashAlgorithm,::Array< unsigned char > hash);
+ static inline void removeMedia( ::Dynamic _hx_,::String hashAlgorithm,::Array< unsigned char > hash) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_removeMedia)(hashAlgorithm,hash);
+ }
+ void (::hx::Object :: *_hx_storeCaps)( ::snikket::Caps caps);
+ static inline void storeCaps( ::Dynamic _hx_, ::snikket::Caps caps) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_storeCaps)(caps);
+ }
+ void (::hx::Object :: *_hx_getCaps)(::String ver, ::Dynamic callback);
+ static inline void getCaps( ::Dynamic _hx_,::String ver, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_getCaps)(ver,callback);
+ }
+ void (::hx::Object :: *_hx_storeLogin)(::String login,::String clientId,::String displayName,::String token);
+ static inline void storeLogin( ::Dynamic _hx_,::String login,::String clientId,::String displayName,::String token) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_storeLogin)(login,clientId,displayName,token);
+ }
+ void (::hx::Object :: *_hx_getLogin)(::String login, ::Dynamic callback);
+ static inline void getLogin( ::Dynamic _hx_,::String login, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_getLogin)(login,callback);
+ }
+ void (::hx::Object :: *_hx_removeAccount)(::String accountId,bool completely);
+ static inline void removeAccount( ::Dynamic _hx_,::String accountId,bool completely) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_removeAccount)(accountId,completely);
+ }
+ void (::hx::Object :: *_hx_listAccounts)( ::Dynamic callback);
+ static inline void listAccounts( ::Dynamic _hx_, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_listAccounts)(callback);
+ }
+ void (::hx::Object :: *_hx_storeStreamManagement)(::String accountId,::Array< unsigned char > data);
+ static inline void storeStreamManagement( ::Dynamic _hx_,::String accountId,::Array< unsigned char > data) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_storeStreamManagement)(accountId,data);
+ }
+ void (::hx::Object :: *_hx_getStreamManagement)(::String accountId, ::Dynamic callback);
+ static inline void getStreamManagement( ::Dynamic _hx_,::String accountId, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_getStreamManagement)(accountId,callback);
+ }
+ void (::hx::Object :: *_hx_storeService)(::String accountId,::String serviceId,::String name,::String node, ::snikket::Caps caps);
+ static inline void storeService( ::Dynamic _hx_,::String accountId,::String serviceId,::String name,::String node, ::snikket::Caps caps) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_storeService)(accountId,serviceId,name,node,caps);
+ }
+ void (::hx::Object :: *_hx_findServicesWithFeature)(::String accountId,::String feature, ::Dynamic callback);
+ static inline void findServicesWithFeature( ::Dynamic _hx_,::String accountId,::String feature, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::Persistence_obj *>(_hx_.mPtr->_hx_getInterface(0x3e9d59e2)))->_hx_findServicesWithFeature)(accountId,feature,callback);
+ }
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Persistence */
diff --git a/Sources/c_snikket/iinclude/snikket/Presence.h b/Sources/c_snikket/iinclude/snikket/Presence.h
new file mode 100644
index 0000000..ac48ae8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/Presence.h
@@ -0,0 +1,55 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Presence
+#define INCLUDED_snikket_Presence
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Caps)
+HX_DECLARE_CLASS1(snikket,Presence)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Presence_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Presence_obj OBJ_;
+ Presence_obj();
+
+ public:
+ enum { _hx_ClassId = 0x4c576518 };
+
+ void __construct( ::snikket::Caps caps, ::snikket::Stanza mucUser);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Presence")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Presence"); }
+ static ::hx::ObjectPtr< Presence_obj > __new( ::snikket::Caps caps, ::snikket::Stanza mucUser);
+ static ::hx::ObjectPtr< Presence_obj > __alloc(::hx::Ctx *_hx_ctx, ::snikket::Caps caps, ::snikket::Stanza mucUser);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Presence_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Presence",5b,0e,89,40); }
+
+ ::snikket::Caps caps;
+ ::snikket::Stanza mucUser;
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Presence */
diff --git a/Sources/c_snikket/iinclude/snikket/PubsubEvent.h b/Sources/c_snikket/iinclude/snikket/PubsubEvent.h
new file mode 100644
index 0000000..555e1cd
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/PubsubEvent.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_PubsubEvent
+#define INCLUDED_snikket_PubsubEvent
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,PubsubEvent)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES PubsubEvent_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef PubsubEvent_obj OBJ_;
+ PubsubEvent_obj();
+
+ public:
+ enum { _hx_ClassId = 0x04e7c6de };
+
+ void __construct(::String from,::String to,::String node,::Array< ::Dynamic> items);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.PubsubEvent")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.PubsubEvent"); }
+ static ::hx::ObjectPtr< PubsubEvent_obj > __new(::String from,::String to,::String node,::Array< ::Dynamic> items);
+ static ::hx::ObjectPtr< PubsubEvent_obj > __alloc(::hx::Ctx *_hx_ctx,::String from,::String to,::String node,::Array< ::Dynamic> items);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~PubsubEvent_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("PubsubEvent",17,9e,d8,d2); }
+
+ static ::snikket::PubsubEvent fromStanza( ::snikket::Stanza stanza);
+ static ::Dynamic fromStanza_dyn();
+
+ ::String from;
+ ::String to;
+ ::String node;
+ ::Array< ::Dynamic> items;
+ ::String getFrom();
+ ::Dynamic getFrom_dyn();
+
+ ::String getNode();
+ ::Dynamic getNode_dyn();
+
+ ::Array< ::Dynamic> getItems();
+ ::Dynamic getItems_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_PubsubEvent */
diff --git a/Sources/c_snikket/iinclude/snikket/Reaction.h b/Sources/c_snikket/iinclude/snikket/Reaction.h
new file mode 100644
index 0000000..5c77199
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/Reaction.h
@@ -0,0 +1,75 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Reaction
+#define INCLUDED_snikket_Reaction
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Reaction)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Reaction_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Reaction_obj OBJ_;
+ Reaction_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7f8e2b4a };
+
+ void __construct(::String senderId,::String timestamp,::String text,::String envelopeId,::String key);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Reaction")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Reaction"); }
+ static ::hx::ObjectPtr< Reaction_obj > __new(::String senderId,::String timestamp,::String text,::String envelopeId,::String key);
+ static ::hx::ObjectPtr< Reaction_obj > __alloc(::hx::Ctx *_hx_ctx,::String senderId,::String timestamp,::String text,::String envelopeId,::String key);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Reaction_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Reaction",c9,a3,66,d0); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ ::String senderId;
+ ::String senderId__fromC();
+ ::Dynamic senderId__fromC_dyn();
+
+ ::String timestamp;
+ ::String timestamp__fromC();
+ ::Dynamic timestamp__fromC_dyn();
+
+ ::String text;
+ ::String text__fromC();
+ ::Dynamic text__fromC_dyn();
+
+ ::String key;
+ ::String key__fromC();
+ ::Dynamic key__fromC_dyn();
+
+ ::String envelopeId;
+ ::String envelopeId__fromC();
+ ::Dynamic envelopeId__fromC_dyn();
+
+ virtual ::Dynamic render( ::Dynamic forText, ::Dynamic forImage);
+ ::Dynamic render_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Reaction */
diff --git a/Sources/c_snikket/iinclude/snikket/ReactionUpdate.h b/Sources/c_snikket/iinclude/snikket/ReactionUpdate.h
new file mode 100644
index 0000000..79c5a2a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/ReactionUpdate.h
@@ -0,0 +1,72 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_ReactionUpdate
+#define INCLUDED_snikket_ReactionUpdate
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Hash)
+HX_DECLARE_CLASS1(snikket,Reaction)
+HX_DECLARE_CLASS1(snikket,ReactionUpdate)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES ReactionUpdate_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef ReactionUpdate_obj OBJ_;
+ ReactionUpdate_obj();
+
+ public:
+ enum { _hx_ClassId = 0x71029d2f };
+
+ void __construct(::String updateId,::String serverId,::String serverIdBy,::String localId,::String chatId,::String senderId,::String timestamp,::Array< ::Dynamic> reactions,int kind);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.ReactionUpdate")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.ReactionUpdate"); }
+ static ::hx::ObjectPtr< ReactionUpdate_obj > __new(::String updateId,::String serverId,::String serverIdBy,::String localId,::String chatId,::String senderId,::String timestamp,::Array< ::Dynamic> reactions,int kind);
+ static ::hx::ObjectPtr< ReactionUpdate_obj > __alloc(::hx::Ctx *_hx_ctx,::String updateId,::String serverId,::String serverIdBy,::String localId,::String chatId,::String senderId,::String timestamp,::Array< ::Dynamic> reactions,int kind);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ReactionUpdate_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("ReactionUpdate",b2,1a,77,ad); }
+
+ ::String updateId;
+ ::String serverId;
+ ::String serverIdBy;
+ ::String localId;
+ ::String chatId;
+ ::String senderId;
+ ::String timestamp;
+ ::Array< ::Dynamic> reactions;
+ int kind;
+ ::Array< ::Dynamic> getReactions(::Array< ::Dynamic> existingReactions);
+ ::Dynamic getReactions_dyn();
+
+ ::Array< ::Dynamic> inlineHashReferences();
+ ::Dynamic inlineHashReferences_dyn();
+
+ ::snikket::Stanza asStanza();
+ ::Dynamic asStanza_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_ReactionUpdate */
diff --git a/Sources/c_snikket/iinclude/snikket/SerializedChat.h b/Sources/c_snikket/iinclude/snikket/SerializedChat.h
new file mode 100644
index 0000000..80ed386
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/SerializedChat.h
@@ -0,0 +1,76 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_SerializedChat
+#define INCLUDED_snikket_SerializedChat
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+HX_DECLARE_CLASS1(snikket,Caps)
+HX_DECLARE_CLASS1(snikket,Chat)
+HX_DECLARE_CLASS1(snikket,Client)
+HX_DECLARE_CLASS1(snikket,EventEmitter)
+HX_DECLARE_CLASS1(snikket,GenericStream)
+HX_DECLARE_CLASS1(snikket,Persistence)
+HX_DECLARE_CLASS1(snikket,SerializedChat)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES SerializedChat_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef SerializedChat_obj OBJ_;
+ SerializedChat_obj();
+
+ public:
+ enum { _hx_ClassId = 0x3eb0c535 };
+
+ void __construct(::String chatId,bool trusted,::Array< unsigned char > avatarSha1, ::haxe::ds::StringMap presence,::String displayName, ::Dynamic uiState, ::Dynamic isBlocked,::String extensions,::String readUpToId,::String readUpToBy, ::Dynamic notificationsFiltered,bool notifyMention,bool notifyReply, ::snikket::Caps disco,::String klass);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.SerializedChat")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.SerializedChat"); }
+ static ::hx::ObjectPtr< SerializedChat_obj > __new(::String chatId,bool trusted,::Array< unsigned char > avatarSha1, ::haxe::ds::StringMap presence,::String displayName, ::Dynamic uiState, ::Dynamic isBlocked,::String extensions,::String readUpToId,::String readUpToBy, ::Dynamic notificationsFiltered,bool notifyMention,bool notifyReply, ::snikket::Caps disco,::String klass);
+ static ::hx::ObjectPtr< SerializedChat_obj > __alloc(::hx::Ctx *_hx_ctx,::String chatId,bool trusted,::Array< unsigned char > avatarSha1, ::haxe::ds::StringMap presence,::String displayName, ::Dynamic uiState, ::Dynamic isBlocked,::String extensions,::String readUpToId,::String readUpToBy, ::Dynamic notificationsFiltered,bool notifyMention,bool notifyReply, ::snikket::Caps disco,::String klass);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SerializedChat_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("SerializedChat",9c,77,4d,09); }
+
+ ::String chatId;
+ bool trusted;
+ ::Array< unsigned char > avatarSha1;
+ ::haxe::ds::StringMap presence;
+ ::String displayName;
+ int uiState;
+ bool isBlocked;
+ ::String extensions;
+ ::String readUpToId;
+ ::String readUpToBy;
+ ::snikket::Caps disco;
+ ::String klass;
+ ::Dynamic notificationsFiltered;
+ bool notifyMention;
+ bool notifyReply;
+ ::snikket::Chat toChat( ::snikket::Client client, ::snikket::GenericStream stream,::Dynamic persistence);
+ ::Dynamic toChat_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_SerializedChat */
diff --git a/Sources/c_snikket/iinclude/snikket/Stanza.h b/Sources/c_snikket/iinclude/snikket/Stanza.h
new file mode 100644
index 0000000..7c79f8c
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/Stanza.h
@@ -0,0 +1,149 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Stanza
+#define INCLUDED_snikket_Stanza
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+HX_DECLARE_CLASS0(Xml)
+HX_DECLARE_CLASS1(snikket,Node)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS1(snikket,StanzaError)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Stanza_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Stanza_obj OBJ_;
+ Stanza_obj();
+
+ public:
+ enum { _hx_ClassId = 0x62320f92 };
+
+ void __construct(::String name, ::Dynamic attr);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Stanza")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Stanza"); }
+ static ::hx::ObjectPtr< Stanza_obj > __new(::String name, ::Dynamic attr);
+ static ::hx::ObjectPtr< Stanza_obj > __alloc(::hx::Ctx *_hx_ctx,::String name, ::Dynamic attr);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Stanza_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::Dynamic traverse_881a854a( ::Dynamic f);
+ ::String __ToString() const { return HX_("Stanza",15,d2,8b,3a); }
+
+ static ::snikket::Stanza parse(::String s);
+ static ::Dynamic parse_dyn();
+
+ static ::snikket::Stanza fromXml( ::Xml el);
+ static ::Dynamic fromXml_dyn();
+
+ static bool parseXmlBool(::String x);
+ static ::Dynamic parseXmlBool_dyn();
+
+ ::String name;
+ ::Dynamic attr;
+ ::Array< ::Dynamic> children;
+ ::snikket::Stanza last_added;
+ ::Array< ::Dynamic> last_added_stack;
+ ::String serialize();
+ ::Dynamic serialize_dyn();
+
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+ ::snikket::Stanza tag(::String name, ::Dynamic attr);
+ ::Dynamic tag_dyn();
+
+ ::snikket::Stanza text(::String content);
+ ::Dynamic text_dyn();
+
+ ::snikket::Stanza textTag(::String tagName,::String textContent, ::Dynamic attr);
+ ::Dynamic textTag_dyn();
+
+ ::snikket::Stanza up();
+ ::Dynamic up_dyn();
+
+ ::snikket::Stanza reset();
+ ::Dynamic reset_dyn();
+
+ ::snikket::Stanza addChildren( ::Dynamic children);
+ ::Dynamic addChildren_dyn();
+
+ ::snikket::Stanza addChildNodes( ::Dynamic children);
+ ::Dynamic addChildNodes_dyn();
+
+ ::snikket::Stanza addChild( ::snikket::Stanza stanza);
+ ::Dynamic addChild_dyn();
+
+ ::snikket::Stanza addDirectChild( ::snikket::Node child);
+ ::Dynamic addDirectChild_dyn();
+
+ ::snikket::Stanza clone();
+ ::Dynamic clone_dyn();
+
+ ::Array< ::Dynamic> allTags(::String name,::String xmlns);
+ ::Dynamic allTags_dyn();
+
+ ::Array< ::String > allText();
+ ::Dynamic allText_dyn();
+
+ ::snikket::Stanza getFirstChild();
+ ::Dynamic getFirstChild_dyn();
+
+ ::Array< ::Dynamic> getChildren();
+ ::Dynamic getChildren_dyn();
+
+ ::snikket::Stanza getChild(::String name,::String xmlns);
+ ::Dynamic getChild_dyn();
+
+ ::String getChildText(::String name,::String xmlns);
+ ::Dynamic getChildText_dyn();
+
+ ::String getText();
+ ::Dynamic getText_dyn();
+
+ ::snikket::Node find(::String path);
+ ::Dynamic find_dyn();
+
+ ::snikket::Stanza findChild(::String path);
+ ::Dynamic findChild_dyn();
+
+ ::String findText(::String path);
+ ::Dynamic findText_dyn();
+
+ ::snikket::Stanza traverse( ::Dynamic f);
+ ::Dynamic traverse_dyn();
+
+ ::snikket::StanzaError getError();
+ ::Dynamic getError_dyn();
+
+ void removeChildren(::String name,::String xmlns_);
+ ::Dynamic removeChildren_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Stanza */
diff --git a/Sources/c_snikket/iinclude/snikket/StanzaError.h b/Sources/c_snikket/iinclude/snikket/StanzaError.h
new file mode 100644
index 0000000..a16d52c
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/StanzaError.h
@@ -0,0 +1,72 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_StanzaError
+#define INCLUDED_snikket_StanzaError
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_ba7467be1e1fd22b_46_new)
+HX_DECLARE_CLASS1(snikket,StanzaError)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES StanzaError_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef StanzaError_obj OBJ_;
+ StanzaError_obj();
+
+ public:
+ enum { _hx_ClassId = 0x29697ad6 };
+
+ void __construct(::String type_,::String condition_,::String text_);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.StanzaError")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.StanzaError"); }
+
+ inline static ::hx::ObjectPtr< StanzaError_obj > __new(::String type_,::String condition_,::String text_) {
+ ::hx::ObjectPtr< StanzaError_obj > __this = new StanzaError_obj();
+ __this->__construct(type_,condition_,text_);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< StanzaError_obj > __alloc(::hx::Ctx *_hx_ctx,::String type_,::String condition_,::String text_) {
+ StanzaError_obj *__this = (StanzaError_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(StanzaError_obj), true, "snikket.StanzaError"));
+ *(void **)__this = StanzaError_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_ba7467be1e1fd22b_46_new)
+HXLINE( 47) ( ( ::snikket::StanzaError)(__this) )->type = type_;
+HXLINE( 48) ( ( ::snikket::StanzaError)(__this) )->condition = condition_;
+HXLINE( 49) ( ( ::snikket::StanzaError)(__this) )->text = text_;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~StanzaError_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("StanzaError",73,bd,30,0b); }
+
+ ::String type;
+ ::String condition;
+ ::String text;
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_StanzaError */
diff --git a/Sources/c_snikket/iinclude/snikket/StringUtil.h b/Sources/c_snikket/iinclude/snikket/StringUtil.h
new file mode 100644
index 0000000..2aba5bb
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/StringUtil.h
@@ -0,0 +1,63 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_StringUtil
+#define INCLUDED_snikket_StringUtil
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,StringUtil)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES StringUtil_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef StringUtil_obj OBJ_;
+ StringUtil_obj();
+
+ public:
+ enum { _hx_ClassId = 0x537b2d90 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="snikket.StringUtil")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"snikket.StringUtil"); }
+
+ inline static ::hx::ObjectPtr< StringUtil_obj > __new() {
+ ::hx::ObjectPtr< StringUtil_obj > __this = new StringUtil_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< StringUtil_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ StringUtil_obj *__this = (StringUtil_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(StringUtil_obj), false, "snikket.StringUtil"));
+ *(void **)__this = StringUtil_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~StringUtil_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("StringUtil",93,ed,5b,f6); }
+
+ static ::Array< ::String > codepointArray(::String s);
+ static ::Dynamic codepointArray_dyn();
+
+ static ::Array< int > rawCodepointArray(::String s);
+ static ::Dynamic rawCodepointArray_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_StringUtil */
diff --git a/Sources/c_snikket/iinclude/snikket/Symbol.h b/Sources/c_snikket/iinclude/snikket/Symbol.h
new file mode 100644
index 0000000..a0c352f
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/Symbol.h
@@ -0,0 +1,49 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_Symbol
+#define INCLUDED_snikket_Symbol
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Symbol)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES Symbol_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Symbol_obj OBJ_;
+ Symbol_obj();
+
+ public:
+ enum { _hx_ClassId = 0x4b1860f5 };
+
+ void __construct(::Array< int > codepoints);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.Symbol")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.Symbol"); }
+
+ //~Symbol_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Symbol",78,23,72,23); }
+
+ ::String value;
+ virtual bool isEmoji() { return 0; }
+ ::Dynamic isEmoji_dyn();
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_Symbol */
diff --git a/Sources/c_snikket/iinclude/snikket/TextNode.h b/Sources/c_snikket/iinclude/snikket/TextNode.h
new file mode 100644
index 0000000..f290844
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/TextNode.h
@@ -0,0 +1,67 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_TextNode
+#define INCLUDED_snikket_TextNode
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS1(snikket,TextNode)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES TextNode_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef TextNode_obj OBJ_;
+ TextNode_obj();
+
+ public:
+ enum { _hx_ClassId = 0x3185702c };
+
+ void __construct(::String content);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.TextNode")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.TextNode"); }
+ static ::hx::ObjectPtr< TextNode_obj > __new(::String content);
+ static ::hx::ObjectPtr< TextNode_obj > __alloc(::hx::Ctx *_hx_ctx,::String content);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~TextNode_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::Dynamic traverse_881a854a( ::Dynamic f);
+ ::String __ToString() const { return HX_("TextNode",6f,19,b7,25); }
+
+ ::String content;
+ ::String serialize();
+ ::Dynamic serialize_dyn();
+
+ ::snikket::TextNode clone();
+ ::Dynamic clone_dyn();
+
+ ::snikket::TextNode traverse( ::Dynamic f);
+ ::Dynamic traverse_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_TextNode */
diff --git a/Sources/c_snikket/iinclude/snikket/UnicodeBlocks.h b/Sources/c_snikket/iinclude/snikket/UnicodeBlocks.h
new file mode 100644
index 0000000..0038254
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/UnicodeBlocks.h
@@ -0,0 +1,59 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_UnicodeBlocks
+#define INCLUDED_snikket_UnicodeBlocks
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_UnicodeSet
+#include <snikket/UnicodeSet.h>
+#endif
+HX_DECLARE_CLASS1(snikket,UnicodeBlocks)
+HX_DECLARE_CLASS1(snikket,UnicodeSet)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES UnicodeBlocks_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef UnicodeBlocks_obj OBJ_;
+ UnicodeBlocks_obj();
+
+ public:
+ enum { _hx_ClassId = 0x5ff5d386 };
+
+ void __construct(::Array< ::Dynamic> sets);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.UnicodeBlocks")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.UnicodeBlocks"); }
+ static ::hx::ObjectPtr< UnicodeBlocks_obj > __new(::Array< ::Dynamic> sets);
+ static ::hx::ObjectPtr< UnicodeBlocks_obj > __alloc(::hx::Ctx *_hx_ctx,::Array< ::Dynamic> sets);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~UnicodeBlocks_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("UnicodeBlocks",63,b7,08,b4); }
+
+ ::Array< ::Dynamic> unicodeSets;
+ bool contains(int codepoint);
+ ::Dynamic contains_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_UnicodeBlocks */
diff --git a/Sources/c_snikket/iinclude/snikket/UnicodeList.h b/Sources/c_snikket/iinclude/snikket/UnicodeList.h
new file mode 100644
index 0000000..4ae5d96
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/UnicodeList.h
@@ -0,0 +1,59 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_UnicodeList
+#define INCLUDED_snikket_UnicodeList
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_UnicodeSet
+#include <snikket/UnicodeSet.h>
+#endif
+HX_DECLARE_CLASS1(snikket,UnicodeList)
+HX_DECLARE_CLASS1(snikket,UnicodeSet)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES UnicodeList_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef UnicodeList_obj OBJ_;
+ UnicodeList_obj();
+
+ public:
+ enum { _hx_ClassId = 0x002205b6 };
+
+ void __construct(::Array< int > codes);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.UnicodeList")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.UnicodeList"); }
+ static ::hx::ObjectPtr< UnicodeList_obj > __new(::Array< int > codes);
+ static ::hx::ObjectPtr< UnicodeList_obj > __alloc(::hx::Ctx *_hx_ctx,::Array< int > codes);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~UnicodeList_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("UnicodeList",fb,c3,e2,6a); }
+
+ ::Array< int > list;
+ bool contains(int codepoint);
+ ::Dynamic contains_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_UnicodeList */
diff --git a/Sources/c_snikket/iinclude/snikket/UnicodeRange.h b/Sources/c_snikket/iinclude/snikket/UnicodeRange.h
new file mode 100644
index 0000000..538a195
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/UnicodeRange.h
@@ -0,0 +1,58 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_UnicodeRange
+#define INCLUDED_snikket_UnicodeRange
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_UnicodeSet
+#include <snikket/UnicodeSet.h>
+#endif
+HX_DECLARE_CLASS1(snikket,UnicodeRange)
+HX_DECLARE_CLASS1(snikket,UnicodeSet)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES UnicodeRange_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef UnicodeRange_obj OBJ_;
+ UnicodeRange_obj();
+
+ public:
+ enum { _hx_ClassId = 0x25d72cd9 };
+
+ void __construct(int lower,int upper);
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="snikket.UnicodeRange")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"snikket.UnicodeRange"); }
+ static ::hx::ObjectPtr< UnicodeRange_obj > __new(int lower,int upper);
+ static ::hx::ObjectPtr< UnicodeRange_obj > __alloc(::hx::Ctx *_hx_ctx,int lower,int upper);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~UnicodeRange_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("UnicodeRange",80,a7,a2,8a); }
+
+ int lower;
+ int upper;
+ bool contains(int codePoint);
+ ::Dynamic contains_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_UnicodeRange */
diff --git a/Sources/c_snikket/iinclude/snikket/UnicodeSet.h b/Sources/c_snikket/iinclude/snikket/UnicodeSet.h
new file mode 100644
index 0000000..1f6c00a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/UnicodeSet.h
@@ -0,0 +1,27 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_UnicodeSet
+#define INCLUDED_snikket_UnicodeSet
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,UnicodeSet)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES UnicodeSet_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ bool (::hx::Object :: *_hx_contains)(int codepoint);
+ static inline bool contains( ::Dynamic _hx_,int codepoint) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::UnicodeSet_obj *>(_hx_.mPtr->_hx_getInterface(0x29205162)))->_hx_contains)(codepoint);
+ }
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_UnicodeSet */
diff --git a/Sources/c_snikket/iinclude/snikket/XEP0393.h b/Sources/c_snikket/iinclude/snikket/XEP0393.h
new file mode 100644
index 0000000..3af9b96
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/XEP0393.h
@@ -0,0 +1,84 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_XEP0393
+#define INCLUDED_snikket_XEP0393
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Node)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS1(snikket,XEP0393)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+
+
+class HXCPP_CLASS_ATTRIBUTES XEP0393_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef XEP0393_obj OBJ_;
+ XEP0393_obj();
+
+ public:
+ enum { _hx_ClassId = 0x794b61b7 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="snikket.XEP0393")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"snikket.XEP0393"); }
+
+ inline static ::hx::ObjectPtr< XEP0393_obj > __new() {
+ ::hx::ObjectPtr< XEP0393_obj > __this = new XEP0393_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< XEP0393_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ XEP0393_obj *__this = (XEP0393_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(XEP0393_obj), false, "snikket.XEP0393"));
+ *(void **)__this = XEP0393_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~XEP0393_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("XEP0393",e0,42,f0,11); }
+
+ static ::Dynamic parse(::String styled);
+ static ::Dynamic parse_dyn();
+
+ static ::String render( ::snikket::Stanza xhtml);
+ static ::Dynamic render_dyn();
+
+ static ::String renderNode( ::snikket::Node xhtml);
+ static ::Dynamic renderNode_dyn();
+
+ static ::Dynamic parseSpans(::String styled);
+ static ::Dynamic parseSpans_dyn();
+
+ static ::Dynamic parseSpan(::String tagName,::String marker,::String styled,int start);
+ static ::Dynamic parseSpan_dyn();
+
+ static ::Dynamic parseBlock(::String styled);
+ static ::Dynamic parseBlock_dyn();
+
+ static ::Dynamic parseQuote(::String styled);
+ static ::Dynamic parseQuote_dyn();
+
+ static ::Dynamic parsePreformatted(::String styled);
+ static ::Dynamic parsePreformatted_dyn();
+
+};
+
+} // end namespace snikket
+
+#endif /* INCLUDED_snikket_XEP0393 */
diff --git a/Sources/c_snikket/iinclude/snikket/_Push/Push_Fields_.h b/Sources/c_snikket/iinclude/snikket/_Push/Push_Fields_.h
new file mode 100644
index 0000000..27e14f5
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/_Push/Push_Fields_.h
@@ -0,0 +1,64 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket__Push_Push_Fields_
+#define INCLUDED_snikket__Push_Push_Fields_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Notification)
+HX_DECLARE_CLASS1(snikket,Persistence)
+HX_DECLARE_CLASS2(snikket,_Push,Push_Fields_)
+
+namespace snikket{
+namespace _Push{
+
+
+class HXCPP_CLASS_ATTRIBUTES Push_Fields__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Push_Fields__obj OBJ_;
+ Push_Fields__obj();
+
+ public:
+ enum { _hx_ClassId = 0x1c9e72a5 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="snikket._Push.Push_Fields_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"snikket._Push.Push_Fields_"); }
+
+ inline static ::hx::ObjectPtr< Push_Fields__obj > __new() {
+ ::hx::ObjectPtr< Push_Fields__obj > __this = new Push_Fields__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Push_Fields__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Push_Fields__obj *__this = (Push_Fields__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Push_Fields__obj), false, "snikket._Push.Push_Fields_"));
+ *(void **)__this = Push_Fields__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Push_Fields__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Push_Fields_",21,65,37,88); }
+
+ static ::snikket::Notification receive(::String data,::Dynamic persistence);
+ static ::Dynamic receive_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace _Push
+
+#endif /* INCLUDED_snikket__Push_Push_Fields_ */
diff --git a/Sources/c_snikket/iinclude/snikket/_Stanza/NodeInterface.h b/Sources/c_snikket/iinclude/snikket/_Stanza/NodeInterface.h
new file mode 100644
index 0000000..8a96ae8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/_Stanza/NodeInterface.h
@@ -0,0 +1,34 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#define INCLUDED_snikket__Stanza_NodeInterface
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+
+namespace snikket{
+namespace _Stanza{
+
+
+class HXCPP_CLASS_ATTRIBUTES NodeInterface_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ ::String (::hx::Object :: *_hx_serialize)();
+ static inline ::String serialize( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::_Stanza::NodeInterface_obj *>(_hx_.mPtr->_hx_getInterface(0xc837e580)))->_hx_serialize)();
+ }
+ ::Dynamic (::hx::Object :: *_hx_traverse)( ::Dynamic f);
+ static inline ::Dynamic traverse( ::Dynamic _hx_, ::Dynamic f) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::_Stanza::NodeInterface_obj *>(_hx_.mPtr->_hx_getInterface(0xc837e580)))->_hx_traverse)(f);
+ }
+};
+
+} // end namespace snikket
+} // end namespace _Stanza
+
+#endif /* INCLUDED_snikket__Stanza_NodeInterface */
diff --git a/Sources/c_snikket/iinclude/snikket/_Util/Util_Fields_.h b/Sources/c_snikket/iinclude/snikket/_Util/Util_Fields_.h
new file mode 100644
index 0000000..a5a7fd3
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/_Util/Util_Fields_.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket__Util_Util_Fields_
+#define INCLUDED_snikket__Util_Util_Fields_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(snikket,_Util,Util_Fields_)
+
+namespace snikket{
+namespace _Util{
+
+
+class HXCPP_CLASS_ATTRIBUTES Util_Fields__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Util_Fields__obj OBJ_;
+ Util_Fields__obj();
+
+ public:
+ enum { _hx_ClassId = 0x1266dcf5 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="snikket._Util.Util_Fields_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"snikket._Util.Util_Fields_"); }
+
+ inline static ::hx::ObjectPtr< Util_Fields__obj > __new() {
+ ::hx::ObjectPtr< Util_Fields__obj > __this = new Util_Fields__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Util_Fields__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Util_Fields__obj *__this = (Util_Fields__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Util_Fields__obj), false, "snikket._Util.Util_Fields_"));
+ *(void **)__this = Util_Fields__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Util_Fields__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Util_Fields_",49,13,f3,18); }
+
+ static void setupTrace();
+ static ::Dynamic setupTrace_dyn();
+
+ static ::Dynamic downcast( ::Dynamic value,::hx::Class c);
+ static ::Dynamic downcast_dyn();
+
+ static ::String xmlEscape(::String s);
+ static ::Dynamic xmlEscape_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace _Util
+
+#endif /* INCLUDED_snikket__Util_Util_Fields_ */
diff --git a/Sources/c_snikket/iinclude/snikket/jingle/Attribute.h b/Sources/c_snikket/iinclude/snikket/jingle/Attribute.h
new file mode 100644
index 0000000..ab36337
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/jingle/Attribute.h
@@ -0,0 +1,79 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_Attribute
+#define INCLUDED_snikket_jingle_Attribute
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_3dd2db7f2124ae96_624_new)
+HX_DECLARE_CLASS2(snikket,jingle,Attribute)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES Attribute_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Attribute_obj OBJ_;
+ Attribute_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0704634e };
+
+ void __construct(::String key,::String value);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.Attribute")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.Attribute"); }
+
+ inline static ::hx::ObjectPtr< Attribute_obj > __new(::String key,::String value) {
+ ::hx::ObjectPtr< Attribute_obj > __this = new Attribute_obj();
+ __this->__construct(key,value);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Attribute_obj > __alloc(::hx::Ctx *_hx_ctx,::String key,::String value) {
+ Attribute_obj *__this = (Attribute_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Attribute_obj), true, "snikket.jingle.Attribute"));
+ *(void **)__this = Attribute_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_3dd2db7f2124ae96_624_new)
+HXLINE( 625) ( ( ::snikket::jingle::Attribute)(__this) )->key = key;
+HXLINE( 626) ( ( ::snikket::jingle::Attribute)(__this) )->value = value;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Attribute_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Attribute",fc,4f,c3,9c); }
+
+ static ::snikket::jingle::Attribute parse(::String input);
+ static ::Dynamic parse_dyn();
+
+ ::String key;
+ ::String value;
+ ::String toSdp();
+ ::Dynamic toSdp_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_Attribute */
diff --git a/Sources/c_snikket/iinclude/snikket/jingle/AudioFormat.h b/Sources/c_snikket/iinclude/snikket/jingle/AudioFormat.h
new file mode 100644
index 0000000..5a01544
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/jingle/AudioFormat.h
@@ -0,0 +1,84 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_AudioFormat
+#define INCLUDED_snikket_jingle_AudioFormat
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_1f09f7dcf750977c_327_new)
+HX_DECLARE_CLASS2(snikket,jingle,AudioFormat)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES AudioFormat_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef AudioFormat_obj OBJ_;
+ AudioFormat_obj();
+
+ public:
+ enum { _hx_ClassId = 0x22a1d3c3 };
+
+ void __construct(::String format,unsigned char payloadType,int clockRate,int channels);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.AudioFormat")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.AudioFormat"); }
+
+ inline static ::hx::ObjectPtr< AudioFormat_obj > __new(::String format,unsigned char payloadType,int clockRate,int channels) {
+ ::hx::ObjectPtr< AudioFormat_obj > __this = new AudioFormat_obj();
+ __this->__construct(format,payloadType,clockRate,channels);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< AudioFormat_obj > __alloc(::hx::Ctx *_hx_ctx,::String format,unsigned char payloadType,int clockRate,int channels) {
+ AudioFormat_obj *__this = (AudioFormat_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(AudioFormat_obj), true, "snikket.jingle.AudioFormat"));
+ *(void **)__this = AudioFormat_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_1f09f7dcf750977c_327_new)
+HXLINE( 328) ( ( ::snikket::jingle::AudioFormat)(__this) )->format = format;
+HXLINE( 329) ( ( ::snikket::jingle::AudioFormat)(__this) )->payloadType = payloadType;
+HXLINE( 330) ( ( ::snikket::jingle::AudioFormat)(__this) )->clockRate = clockRate;
+HXLINE( 331) ( ( ::snikket::jingle::AudioFormat)(__this) )->channels = channels;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~AudioFormat_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("AudioFormat",8d,58,71,b0); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ ::String format;
+ unsigned char payloadType;
+ int clockRate;
+ int clockRate__fromC();
+ ::Dynamic clockRate__fromC_dyn();
+
+ int channels;
+ int channels__fromC();
+ ::Dynamic channels__fromC_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_AudioFormat */
diff --git a/Sources/c_snikket/iinclude/snikket/jingle/DTMFSender.h b/Sources/c_snikket/iinclude/snikket/jingle/DTMFSender.h
new file mode 100644
index 0000000..ac11f9b
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/jingle/DTMFSender.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_DTMFSender
+#define INCLUDED_snikket_jingle_DTMFSender
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS1(haxe,Timer)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+HX_DECLARE_CLASS2(snikket,jingle,DTMFSender)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStreamTrack)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES DTMFSender_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef DTMFSender_obj OBJ_;
+ DTMFSender_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0cd227ec };
+
+ void __construct( ::snikket::jingle::MediaStreamTrack track);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.DTMFSender")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.DTMFSender"); }
+ static ::hx::ObjectPtr< DTMFSender_obj > __new( ::snikket::jingle::MediaStreamTrack track);
+ static ::hx::ObjectPtr< DTMFSender_obj > __alloc(::hx::Ctx *_hx_ctx, ::snikket::jingle::MediaStreamTrack track);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~DTMFSender_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("DTMFSender",7e,53,22,7e); }
+
+ static void __boot();
+ static ::haxe::ds::StringMap TONES;
+ ::snikket::jingle::MediaStreamTrack track;
+ ::haxe::Timer timer;
+ ::Array< unsigned char > tones;
+ void insertDTMF(::String tones);
+ ::Dynamic insertDTMF_dyn();
+
+ void insertOneTone(unsigned char tone);
+ ::Dynamic insertOneTone_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_DTMFSender */
diff --git a/Sources/c_snikket/iinclude/snikket/jingle/Group.h b/Sources/c_snikket/iinclude/snikket/jingle/Group.h
new file mode 100644
index 0000000..e94b018
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/jingle/Group.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_Group
+#define INCLUDED_snikket_jingle_Group
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,jingle,Group)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES Group_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Group_obj OBJ_;
+ Group_obj();
+
+ public:
+ enum { _hx_ClassId = 0x21f1b1d5 };
+
+ void __construct(::String semantics,::Array< ::String > identificationTags);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.Group")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.Group"); }
+ static ::hx::ObjectPtr< Group_obj > __new(::String semantics,::Array< ::String > identificationTags);
+ static ::hx::ObjectPtr< Group_obj > __alloc(::hx::Ctx *_hx_ctx,::String semantics,::Array< ::String > identificationTags);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Group_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Group",1f,23,22,2d); }
+
+ static ::snikket::jingle::Group parse(::String input);
+ static ::Dynamic parse_dyn();
+
+ static ::snikket::jingle::Group fromElement( ::snikket::Stanza el);
+ static ::Dynamic fromElement_dyn();
+
+ ::String semantics;
+ ::Array< ::String > identificationTags;
+ ::String toSdp();
+ ::Dynamic toSdp_dyn();
+
+ ::snikket::Stanza toElement();
+ ::Dynamic toElement_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_Group */
diff --git a/Sources/c_snikket/iinclude/snikket/jingle/IceCandidate.h b/Sources/c_snikket/iinclude/snikket/jingle/IceCandidate.h
new file mode 100644
index 0000000..3f6d0f8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/jingle/IceCandidate.h
@@ -0,0 +1,84 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_IceCandidate
+#define INCLUDED_snikket_jingle_IceCandidate
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,jingle,IceCandidate)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES IceCandidate_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef IceCandidate_obj OBJ_;
+ IceCandidate_obj();
+
+ public:
+ enum { _hx_ClassId = 0x5f466786 };
+
+ void __construct(::String sdpMid,::String ufrag,::String foundation,::String component,::String transport,::String priority,::String connectionAddress,::String port, ::haxe::ds::StringMap parameters);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.IceCandidate")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.IceCandidate"); }
+ static ::hx::ObjectPtr< IceCandidate_obj > __new(::String sdpMid,::String ufrag,::String foundation,::String component,::String transport,::String priority,::String connectionAddress,::String port, ::haxe::ds::StringMap parameters);
+ static ::hx::ObjectPtr< IceCandidate_obj > __alloc(::hx::Ctx *_hx_ctx,::String sdpMid,::String ufrag,::String foundation,::String component,::String transport,::String priority,::String connectionAddress,::String port, ::haxe::ds::StringMap parameters);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~IceCandidate_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("IceCandidate",98,1b,a6,e5); }
+
+ static ::snikket::jingle::IceCandidate fromElement( ::snikket::Stanza candidate,::String sdpMid,::String ufrag);
+ static ::Dynamic fromElement_dyn();
+
+ static ::Array< ::Dynamic> fromTransport( ::snikket::Stanza transport,::String sdpMid);
+ static ::Dynamic fromTransport_dyn();
+
+ static ::Array< ::Dynamic> fromStanza( ::snikket::Stanza iq);
+ static ::Dynamic fromStanza_dyn();
+
+ static ::snikket::jingle::IceCandidate parse(::String input,::String sdpMid,::String ufrag);
+ static ::Dynamic parse_dyn();
+
+ ::String sdpMid;
+ ::String ufrag;
+ ::String foundation;
+ ::String component;
+ ::String transport;
+ ::String priority;
+ ::String connectionAddress;
+ ::String port;
+ ::haxe::ds::StringMap parameters;
+ ::snikket::Stanza toElement();
+ ::Dynamic toElement_dyn();
+
+ ::String toSdp();
+ ::Dynamic toSdp_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_IceCandidate */
diff --git a/Sources/c_snikket/iinclude/snikket/jingle/IncomingProposedSession.h b/Sources/c_snikket/iinclude/snikket/jingle/IncomingProposedSession.h
new file mode 100644
index 0000000..ba3b24a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/jingle/IncomingProposedSession.h
@@ -0,0 +1,114 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_IncomingProposedSession
+#define INCLUDED_snikket_jingle_IncomingProposedSession
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_jingle_Session
+#include <snikket/jingle/Session.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Client)
+HX_DECLARE_CLASS1(snikket,EventEmitter)
+HX_DECLARE_CLASS1(snikket,JID)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,jingle,DTMFSender)
+HX_DECLARE_CLASS2(snikket,jingle,IncomingProposedSession)
+HX_DECLARE_CLASS2(snikket,jingle,InitiatedSession)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStream)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStreamTrack)
+HX_DECLARE_CLASS2(snikket,jingle,Session)
+HX_DECLARE_CLASS1(thenshim,Thenable)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES IncomingProposedSession_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef IncomingProposedSession_obj OBJ_;
+ IncomingProposedSession_obj();
+
+ public:
+ enum { _hx_ClassId = 0x409e1620 };
+
+ void __construct( ::snikket::Client client, ::snikket::JID from,::String sid);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.IncomingProposedSession")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.IncomingProposedSession"); }
+ static ::hx::ObjectPtr< IncomingProposedSession_obj > __new( ::snikket::Client client, ::snikket::JID from,::String sid);
+ static ::hx::ObjectPtr< IncomingProposedSession_obj > __alloc(::hx::Ctx *_hx_ctx, ::snikket::Client client, ::snikket::JID from,::String sid);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~IncomingProposedSession_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("IncomingProposedSession",ea,a1,86,13); }
+
+ ::String sid;
+ ::snikket::Client client;
+ ::snikket::JID from;
+ ::String _sid;
+ bool accepted;
+ void ring();
+ ::Dynamic ring_dyn();
+
+ void hangup();
+ ::Dynamic hangup_dyn();
+
+ void retract();
+ ::Dynamic retract_dyn();
+
+ void terminate();
+ ::Dynamic terminate_dyn();
+
+ void contentAdd( ::snikket::Stanza _);
+ ::Dynamic contentAdd_dyn();
+
+ void contentAccept( ::snikket::Stanza _);
+ ::Dynamic contentAccept_dyn();
+
+ ::Dynamic transportInfo( ::snikket::Stanza _);
+ ::Dynamic transportInfo_dyn();
+
+ void accept();
+ ::Dynamic accept_dyn();
+
+ ::snikket::jingle::InitiatedSession initiate( ::snikket::Stanza stanza);
+ ::Dynamic initiate_dyn();
+
+ void addMedia(::Array< ::Dynamic> _);
+ ::Dynamic addMedia_dyn();
+
+ ::String callStatus();
+ ::Dynamic callStatus_dyn();
+
+ ::Array< ::Dynamic> videoTracks();
+ ::Dynamic videoTracks_dyn();
+
+ ::snikket::jingle::DTMFSender dtmf();
+ ::Dynamic dtmf_dyn();
+
+ ::String get_sid();
+ ::Dynamic get_sid_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_IncomingProposedSession */
diff --git a/Sources/c_snikket/iinclude/snikket/jingle/InitiatedSession.h b/Sources/c_snikket/iinclude/snikket/jingle/InitiatedSession.h
new file mode 100644
index 0000000..569256c
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/jingle/InitiatedSession.h
@@ -0,0 +1,160 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_InitiatedSession
+#define INCLUDED_snikket_jingle_InitiatedSession
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_jingle_Session
+#include <snikket/jingle/Session.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Client)
+HX_DECLARE_CLASS1(snikket,EventEmitter)
+HX_DECLARE_CLASS1(snikket,JID)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,jingle,DTMFSender)
+HX_DECLARE_CLASS2(snikket,jingle,InitiatedSession)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStream)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStreamTrack)
+HX_DECLARE_CLASS2(snikket,jingle,OutgoingSession)
+HX_DECLARE_CLASS2(snikket,jingle,PeerConnection)
+HX_DECLARE_CLASS2(snikket,jingle,Session)
+HX_DECLARE_CLASS2(snikket,jingle,SessionDescription)
+HX_DECLARE_CLASS1(thenshim,Thenable)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES InitiatedSession_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef InitiatedSession_obj OBJ_;
+ InitiatedSession_obj();
+
+ public:
+ enum { _hx_ClassId = 0x050f75b9 };
+
+ void __construct( ::snikket::Client client, ::snikket::JID counterpart,::String sid, ::snikket::jingle::SessionDescription remoteDescription);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.InitiatedSession")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.InitiatedSession"); }
+ static ::hx::ObjectPtr< InitiatedSession_obj > __new( ::snikket::Client client, ::snikket::JID counterpart,::String sid, ::snikket::jingle::SessionDescription remoteDescription);
+ static ::hx::ObjectPtr< InitiatedSession_obj > __alloc(::hx::Ctx *_hx_ctx, ::snikket::Client client, ::snikket::JID counterpart,::String sid, ::snikket::jingle::SessionDescription remoteDescription);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~InitiatedSession_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::snikket::jingle::InitiatedSession initiate_ef691953( ::snikket::Stanza stanza);
+ ::String __ToString() const { return HX_("InitiatedSession",cb,9a,8f,24); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ static ::snikket::jingle::InitiatedSession fromSessionInitiate( ::snikket::Client client, ::snikket::Stanza stanza);
+ static ::Dynamic fromSessionInitiate_dyn();
+
+ ::String sid;
+ ::String sid__fromC();
+ ::Dynamic sid__fromC_dyn();
+
+ ::snikket::Client client;
+ ::snikket::JID counterpart;
+ ::String _sid;
+ ::snikket::jingle::SessionDescription remoteDescription;
+ ::snikket::jingle::SessionDescription localDescription;
+ ::snikket::jingle::PeerConnection pc;
+ ::String peerDtlsSetup;
+ ::Array< ::Dynamic> queuedInboundTransportInfo;
+ ::Array< ::Dynamic> queuedOutboundCandidate;
+ bool accepted;
+ ::Dynamic afterMedia;
+ Dynamic afterMedia_dyn() { return afterMedia;}
+ bool initiator;
+ ::Dynamic candidatesDone;
+ Dynamic candidatesDone_dyn() { return candidatesDone;}
+ ::String get_sid();
+ ::Dynamic get_sid_dyn();
+
+ void ring();
+ ::Dynamic ring_dyn();
+
+ void retract();
+ ::Dynamic retract_dyn();
+
+ void accept();
+ ::Dynamic accept_dyn();
+
+ void hangup();
+ ::Dynamic hangup_dyn();
+
+ virtual ::snikket::jingle::OutgoingSession initiate( ::snikket::Stanza stanza);
+ ::Dynamic initiate_dyn();
+
+ void terminate();
+ ::Dynamic terminate_dyn();
+
+ void contentAdd( ::snikket::Stanza stanza);
+ ::Dynamic contentAdd_dyn();
+
+ void contentAccept( ::snikket::Stanza stanza);
+ ::Dynamic contentAccept_dyn();
+
+ ::Dynamic transportInfo( ::snikket::Stanza stanza);
+ ::Dynamic transportInfo_dyn();
+
+ void addMedia(::Array< ::Dynamic> streams);
+ ::Dynamic addMedia_dyn();
+
+ void addMedia__fromC(::cpp::Pointer< void* > streams,size_t streams__len);
+ ::Dynamic addMedia__fromC_dyn();
+
+ ::String callStatus();
+ ::Dynamic callStatus_dyn();
+
+ ::Array< ::Dynamic> videoTracks();
+ ::Dynamic videoTracks_dyn();
+
+ size_t videoTracks__fromC(void*** outPtr);
+
+ ::snikket::jingle::DTMFSender dtmf();
+ ::Dynamic dtmf_dyn();
+
+ void sendIceCandidate( ::Dynamic candidate);
+ ::Dynamic sendIceCandidate_dyn();
+
+ void supplyMedia(::Array< ::Dynamic> streams);
+ ::Dynamic supplyMedia_dyn();
+
+ void supplyMedia__fromC(::cpp::Pointer< void* > streams,size_t streams__len);
+ ::Dynamic supplyMedia__fromC_dyn();
+
+ void setupPeerConnection( ::Dynamic callback);
+ ::Dynamic setupPeerConnection_dyn();
+
+ ::Dynamic setupLocalDescription(::String type,::Array< ::String > filterMedia, ::Dynamic filterOut, ::Dynamic beforeSend);
+ ::Dynamic setupLocalDescription_dyn();
+
+ virtual ::Dynamic onPeerConnection();
+ ::Dynamic onPeerConnection_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_InitiatedSession */
diff --git a/Sources/c_snikket/iinclude/snikket/jingle/Media.h b/Sources/c_snikket/iinclude/snikket/jingle/Media.h
new file mode 100644
index 0000000..139653a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/jingle/Media.h
@@ -0,0 +1,82 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_Media
+#define INCLUDED_snikket_jingle_Media
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,jingle,Attribute)
+HX_DECLARE_CLASS2(snikket,jingle,Media)
+HX_DECLARE_CLASS2(snikket,jingle,SessionDescription)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES Media_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Media_obj OBJ_;
+ Media_obj();
+
+ public:
+ enum { _hx_ClassId = 0x06e5f716 };
+
+ void __construct(::String mid,::String media,::String connectionData,::String port,::String protocol,::Array< ::Dynamic> attributes,::Array< int > formats);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.Media")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.Media"); }
+ static ::hx::ObjectPtr< Media_obj > __new(::String mid,::String media,::String connectionData,::String port,::String protocol,::Array< ::Dynamic> attributes,::Array< int > formats);
+ static ::hx::ObjectPtr< Media_obj > __alloc(::hx::Ctx *_hx_ctx,::String mid,::String media,::String connectionData,::String port,::String protocol,::Array< ::Dynamic> attributes,::Array< int > formats);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Media_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Media",c4,74,e9,98); }
+
+ static ::snikket::jingle::Media fromElement( ::snikket::Stanza content,bool initiator,bool hasGroup, ::snikket::jingle::SessionDescription existingDescription);
+ static ::Dynamic fromElement_dyn();
+
+ ::String mid;
+ ::String media;
+ ::String connectionData;
+ ::String port;
+ ::String protocol;
+ ::Array< ::Dynamic> attributes;
+ ::Array< int > formats;
+ ::String toSdp();
+ ::Dynamic toSdp_dyn();
+
+ ::snikket::Stanza contentElement(bool initiator);
+ ::Dynamic contentElement_dyn();
+
+ ::snikket::Stanza toElement(::Array< ::Dynamic> sessionAttributes,bool initiator);
+ ::Dynamic toElement_dyn();
+
+ ::Dynamic getUfragPwd(::Array< ::Dynamic> sessionAttributes);
+ ::Dynamic getUfragPwd_dyn();
+
+ ::snikket::Stanza toTransportElement(::Array< ::Dynamic> sessionAttributes);
+ ::Dynamic toTransportElement_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_Media */
diff --git a/Sources/c_snikket/iinclude/snikket/jingle/MediaStream.h b/Sources/c_snikket/iinclude/snikket/jingle/MediaStream.h
new file mode 100644
index 0000000..1e4bb42
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/jingle/MediaStream.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_MediaStream
+#define INCLUDED_snikket_jingle_MediaStream
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(snikket,jingle,MediaStream)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStreamTrack)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES MediaStream_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef MediaStream_obj OBJ_;
+ MediaStream_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1cdfd2fe };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.MediaStream")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.MediaStream"); }
+ static ::hx::ObjectPtr< MediaStream_obj > __new();
+ static ::hx::ObjectPtr< MediaStream_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~MediaStream_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("MediaStream",64,e8,a8,83); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ static ::snikket::jingle::MediaStream makeAudio();
+ static ::Dynamic makeAudio_dyn();
+
+ ::Array< ::Dynamic> tracks;
+ void addTrack( ::snikket::jingle::MediaStreamTrack track);
+ ::Dynamic addTrack_dyn();
+
+ ::Array< ::Dynamic> getTracks();
+ ::Dynamic getTracks_dyn();
+
+ size_t getTracks__fromC(void*** outPtr);
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_MediaStream */
diff --git a/Sources/c_snikket/iinclude/snikket/jingle/MediaStreamTrack.h b/Sources/c_snikket/iinclude/snikket/jingle/MediaStreamTrack.h
new file mode 100644
index 0000000..368efe0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/jingle/MediaStreamTrack.h
@@ -0,0 +1,159 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_MediaStreamTrack
+#define INCLUDED_snikket_jingle_MediaStreamTrack
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_f561c66e4c8ac38c
+#define INCLUDED_f561c66e4c8ac38c
+#include "fstream"
+#endif
+#ifndef INCLUDED_c2bfbc5a172f2993
+#define INCLUDED_c2bfbc5a172f2993
+#include "opus.h"
+#endif
+#ifndef INCLUDED_639eed8ef5b51d52
+#define INCLUDED_639eed8ef5b51d52
+#include "rtc/frameinfo.hpp"
+#endif
+#ifndef INCLUDED_0e487a29b6aa8a9b
+#define INCLUDED_0e487a29b6aa8a9b
+#include "rtc/rtc.hpp"
+#endif
+HX_DECLARE_CLASS1(haxe,Timer)
+HX_DECLARE_CLASS2(snikket,jingle,AudioFormat)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStreamTrack)
+HX_DECLARE_CLASS2(sys,thread,EventLoop)
+HX_DECLARE_CLASS2(sys,thread,Mutex)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES MediaStreamTrack_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef MediaStreamTrack_obj OBJ_;
+ MediaStreamTrack_obj();
+
+ public:
+ enum { _hx_ClassId = 0x047992ad };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.MediaStreamTrack")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.MediaStreamTrack"); }
+ static ::hx::ObjectPtr< MediaStreamTrack_obj > __new();
+ static ::hx::ObjectPtr< MediaStreamTrack_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~MediaStreamTrack_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("MediaStreamTrack",87,2b,0b,ac); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ static ::snikket::jingle::MediaStreamTrack fromTrack( std::shared_ptr< rtc::Track > t);
+
+ static ::Array< short > ULAW_DECODE;
+ static ::Array< unsigned char > ULAW_EXP;
+ static unsigned char pcmToUlaw(short sample);
+ static ::Dynamic pcmToUlaw_dyn();
+
+ ::String id__fromC();
+ ::Dynamic id__fromC_dyn();
+
+ bool muted__fromC();
+ ::Dynamic muted__fromC_dyn();
+
+ ::String kind__fromC();
+ ::Dynamic kind__fromC_dyn();
+
+ size_t supportedAudioFormats__fromC(void*** outPtr);
+
+ ::Dynamic pcmCallback;
+ Dynamic pcmCallback_dyn() { return pcmCallback;}
+ ::Dynamic readyForPCMCallback;
+ Dynamic readyForPCMCallback_dyn() { return readyForPCMCallback;}
+ cpp::Struct< OpusDecoder* > opus;
+ cpp::Struct< OpusEncoder* > opusEncoder;
+ std::shared_ptr< rtc::RtpPacketizationConfig > rtpPacketizationConfig;
+ ::sys::thread::EventLoop eventLoop;
+ ::haxe::Timer timer;
+ ::Array< ::Dynamic> audioQ;
+ bool alive;
+ bool waitForQ;
+ Float bufferSizeInSeconds;
+ ::sys::thread::Mutex mutex;
+ std::optional< rtc::Description::Media > media;
+ std::shared_ptr< rtc::Track > track;
+ std::optional< rtc::Description::Media > get_media();
+
+ ::String get_id();
+ ::Dynamic get_id_dyn();
+
+ ::String get_kind();
+ ::Dynamic get_kind_dyn();
+
+ bool get_muted();
+ ::Dynamic get_muted_dyn();
+
+ ::Array< ::Dynamic> get_supportedAudioFormats();
+ ::Dynamic get_supportedAudioFormats_dyn();
+
+ std::shared_ptr< rtc::Track > set_track( std::shared_ptr< rtc::Track > newTrack);
+
+ void addPCMListener( ::Dynamic callback);
+ ::Dynamic addPCMListener_dyn();
+
+ void addPCMListener__fromC(::cpp::Function< void (short*,size_t,int,int,void*) > callback,void* callback__context);
+
+ void onFrame( std::vector< std::byte > msg, rtc::FrameInfo frameInfo);
+
+ void addReadyForPCMListener( ::Dynamic callback);
+ ::Dynamic addReadyForPCMListener_dyn();
+
+ void addReadyForPCMListener__fromC(::cpp::Function< void (void*) > callback,void* callback__context);
+
+ void notifyReadyForData(bool fromCPP);
+ ::Dynamic notifyReadyForData_dyn();
+
+ void writePCM(::Array< short > pcm,int clockRate,int channels);
+ ::Dynamic writePCM_dyn();
+
+ void writePCM__fromC(::cpp::Pointer< short > pcm,size_t pcm__len,int clockRate,int channels);
+ ::Dynamic writePCM__fromC_dyn();
+
+ void onAudioLoop( ::Dynamic callback);
+ ::Dynamic onAudioLoop_dyn();
+
+ void write(::Array< unsigned char > payload,unsigned char payloadType,int clockRate);
+ ::Dynamic write_dyn();
+
+ void advanceTimestamp(int samples);
+ ::Dynamic advanceTimestamp_dyn();
+
+ void stop();
+ ::Dynamic stop_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_MediaStreamTrack */
diff --git a/Sources/c_snikket/iinclude/snikket/jingle/OutgoingProposedSession.h b/Sources/c_snikket/iinclude/snikket/jingle/OutgoingProposedSession.h
new file mode 100644
index 0000000..04be360
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/jingle/OutgoingProposedSession.h
@@ -0,0 +1,117 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_OutgoingProposedSession
+#define INCLUDED_snikket_jingle_OutgoingProposedSession
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_jingle_Session
+#include <snikket/jingle/Session.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Client)
+HX_DECLARE_CLASS1(snikket,EventEmitter)
+HX_DECLARE_CLASS1(snikket,JID)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,jingle,DTMFSender)
+HX_DECLARE_CLASS2(snikket,jingle,InitiatedSession)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStream)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStreamTrack)
+HX_DECLARE_CLASS2(snikket,jingle,OutgoingProposedSession)
+HX_DECLARE_CLASS2(snikket,jingle,OutgoingSession)
+HX_DECLARE_CLASS2(snikket,jingle,Session)
+HX_DECLARE_CLASS1(thenshim,Thenable)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES OutgoingProposedSession_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef OutgoingProposedSession_obj OBJ_;
+ OutgoingProposedSession_obj();
+
+ public:
+ enum { _hx_ClassId = 0x4349a55a };
+
+ void __construct( ::snikket::Client client, ::snikket::JID to);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.OutgoingProposedSession")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.OutgoingProposedSession"); }
+ static ::hx::ObjectPtr< OutgoingProposedSession_obj > __new( ::snikket::Client client, ::snikket::JID to);
+ static ::hx::ObjectPtr< OutgoingProposedSession_obj > __alloc(::hx::Ctx *_hx_ctx, ::snikket::Client client, ::snikket::JID to);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~OutgoingProposedSession_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::snikket::jingle::InitiatedSession initiate_ef691953( ::snikket::Stanza stanza);
+ ::String __ToString() const { return HX_("OutgoingProposedSession",24,31,32,16); }
+
+ ::String sid;
+ ::snikket::Client client;
+ ::snikket::JID to;
+ ::String _sid;
+ bool audio;
+ bool video;
+ void propose(bool audio,bool video);
+ ::Dynamic propose_dyn();
+
+ void hangup();
+ ::Dynamic hangup_dyn();
+
+ void retract();
+ ::Dynamic retract_dyn();
+
+ void terminate();
+ ::Dynamic terminate_dyn();
+
+ void contentAdd( ::snikket::Stanza _);
+ ::Dynamic contentAdd_dyn();
+
+ void contentAccept( ::snikket::Stanza _);
+ ::Dynamic contentAccept_dyn();
+
+ ::Dynamic transportInfo( ::snikket::Stanza _);
+ ::Dynamic transportInfo_dyn();
+
+ void accept();
+ ::Dynamic accept_dyn();
+
+ ::snikket::jingle::OutgoingSession initiate( ::snikket::Stanza stanza);
+ ::Dynamic initiate_dyn();
+
+ void addMedia(::Array< ::Dynamic> _);
+ ::Dynamic addMedia_dyn();
+
+ ::String callStatus();
+ ::Dynamic callStatus_dyn();
+
+ ::Array< ::Dynamic> videoTracks();
+ ::Dynamic videoTracks_dyn();
+
+ ::snikket::jingle::DTMFSender dtmf();
+ ::Dynamic dtmf_dyn();
+
+ ::String get_sid();
+ ::Dynamic get_sid_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_OutgoingProposedSession */
diff --git a/Sources/c_snikket/iinclude/snikket/jingle/OutgoingSession.h b/Sources/c_snikket/iinclude/snikket/jingle/OutgoingSession.h
new file mode 100644
index 0000000..80cffde
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/jingle/OutgoingSession.h
@@ -0,0 +1,63 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_OutgoingSession
+#define INCLUDED_snikket_jingle_OutgoingSession
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_jingle_InitiatedSession
+#include <snikket/jingle/InitiatedSession.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Client)
+HX_DECLARE_CLASS1(snikket,EventEmitter)
+HX_DECLARE_CLASS1(snikket,JID)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,jingle,InitiatedSession)
+HX_DECLARE_CLASS2(snikket,jingle,OutgoingSession)
+HX_DECLARE_CLASS2(snikket,jingle,Session)
+HX_DECLARE_CLASS1(thenshim,Thenable)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES OutgoingSession_obj : public ::snikket::jingle::InitiatedSession_obj
+{
+ public:
+ typedef ::snikket::jingle::InitiatedSession_obj super;
+ typedef OutgoingSession_obj OBJ_;
+ OutgoingSession_obj();
+
+ public:
+ enum { _hx_ClassId = 0x43b8b0fc };
+
+ void __construct( ::snikket::Client client, ::snikket::JID counterpart,::String sid);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.OutgoingSession")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.OutgoingSession"); }
+ static ::hx::ObjectPtr< OutgoingSession_obj > __new( ::snikket::Client client, ::snikket::JID counterpart,::String sid);
+ static ::hx::ObjectPtr< OutgoingSession_obj > __alloc(::hx::Ctx *_hx_ctx, ::snikket::Client client, ::snikket::JID counterpart,::String sid);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~OutgoingSession_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("OutgoingSession",2a,54,07,c9); }
+
+ ::Dynamic onPeerConnection();
+
+ ::snikket::jingle::OutgoingSession initiate( ::snikket::Stanza stanza);
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_OutgoingSession */
diff --git a/Sources/c_snikket/iinclude/snikket/jingle/PeerConnection.h b/Sources/c_snikket/iinclude/snikket/jingle/PeerConnection.h
new file mode 100644
index 0000000..44a1ee9
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/jingle/PeerConnection.h
@@ -0,0 +1,119 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_PeerConnection
+#define INCLUDED_snikket_jingle_PeerConnection
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_0e487a29b6aa8a9b
+#define INCLUDED_0e487a29b6aa8a9b
+#include "rtc/rtc.hpp"
+#endif
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStream)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStreamTrack)
+HX_DECLARE_CLASS2(snikket,jingle,PeerConnection)
+HX_DECLARE_CLASS2(sys,thread,EventLoop)
+HX_DECLARE_CLASS1(thenshim,Thenable)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES PeerConnection_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef PeerConnection_obj OBJ_;
+ PeerConnection_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1731230a };
+
+ void __construct( ::Dynamic configuration, ::Dynamic constraints);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.PeerConnection")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.PeerConnection"); }
+ static ::hx::ObjectPtr< PeerConnection_obj > __new( ::Dynamic configuration, ::Dynamic constraints);
+ static ::hx::ObjectPtr< PeerConnection_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic configuration, ::Dynamic constraints);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~PeerConnection_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("PeerConnection",80,38,71,9a); }
+
+ ::Dynamic localDescription;
+ ::String connectionState;
+ std::shared_ptr< rtc::PeerConnection > _pc;
+ ::cpp::Pointer< rtc::PeerConnection > pc;
+ ::Dynamic waitingOnLocal;
+ Dynamic waitingOnLocal_dyn() { return waitingOnLocal;}
+ ::haxe::ds::StringMap tracks;
+ ::Array< ::Dynamic> trackListeners;
+ ::Array< ::Dynamic> localCandidateListeners;
+ ::Array< ::Dynamic> stateChangeListeners;
+ ::sys::thread::EventLoop mainLoop;
+ bool hasLocal;
+ bool hasRemote;
+ ::Array< ::Dynamic> pendingTracks;
+ void onLocalDescription();
+ ::Dynamic onLocalDescription_dyn();
+
+ void onLocalCandidate( rtc::Candidate candidate);
+
+ void onStateChange(cpp::Struct< rtc::PeerConnection::State > state);
+ ::Dynamic onStateChange_dyn();
+
+ void onGatheringStateChange(cpp::Struct< rtc::PeerConnection::GatheringState > state);
+ ::Dynamic onGatheringStateChange_dyn();
+
+ void onTrack( std::shared_ptr< rtc::Track > track);
+
+ ::String get_connectionState();
+ ::Dynamic get_connectionState_dyn();
+
+ ::Dynamic get_localDescription();
+ ::Dynamic get_localDescription_dyn();
+
+ ::Dynamic setLocalDescription(cpp::Struct< rtc::Description::Type > sdpType);
+ ::Dynamic setLocalDescription_dyn();
+
+ ::Dynamic setRemoteDescription( ::Dynamic description);
+ ::Dynamic setRemoteDescription_dyn();
+
+ ::Dynamic addIceCandidate( ::Dynamic candidate);
+ ::Dynamic addIceCandidate_dyn();
+
+ void addPendingTracks();
+ ::Dynamic addPendingTracks_dyn();
+
+ void addTrack( ::snikket::jingle::MediaStreamTrack track, ::snikket::jingle::MediaStream stream);
+ ::Dynamic addTrack_dyn();
+
+ ::Array< ::Dynamic> getTransceivers();
+ ::Dynamic getTransceivers_dyn();
+
+ void close();
+ ::Dynamic close_dyn();
+
+ void addEventListener(::String event, ::Dynamic callback);
+ ::Dynamic addEventListener_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_PeerConnection */
diff --git a/Sources/c_snikket/iinclude/snikket/jingle/Session.h b/Sources/c_snikket/iinclude/snikket/jingle/Session.h
new file mode 100644
index 0000000..306298c
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/jingle/Session.h
@@ -0,0 +1,84 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_Session
+#define INCLUDED_snikket_jingle_Session
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,jingle,DTMFSender)
+HX_DECLARE_CLASS2(snikket,jingle,InitiatedSession)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStream)
+HX_DECLARE_CLASS2(snikket,jingle,MediaStreamTrack)
+HX_DECLARE_CLASS2(snikket,jingle,Session)
+HX_DECLARE_CLASS1(thenshim,Thenable)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES Session_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ ::String (::hx::Object :: *_hx_get_sid)();
+ static inline ::String get_sid( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::jingle::Session_obj *>(_hx_.mPtr->_hx_getInterface(0x79d60748)))->_hx_get_sid)();
+ }
+ ::snikket::jingle::InitiatedSession (::hx::Object :: *_hx_initiate)( ::snikket::Stanza stanza);
+ static inline ::snikket::jingle::InitiatedSession initiate( ::Dynamic _hx_, ::snikket::Stanza stanza) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::jingle::Session_obj *>(_hx_.mPtr->_hx_getInterface(0x79d60748)))->_hx_initiate)(stanza);
+ }
+ void (::hx::Object :: *_hx_accept)();
+ static inline void accept( ::Dynamic _hx_) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::jingle::Session_obj *>(_hx_.mPtr->_hx_getInterface(0x79d60748)))->_hx_accept)();
+ }
+ void (::hx::Object :: *_hx_hangup)();
+ static inline void hangup( ::Dynamic _hx_) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::jingle::Session_obj *>(_hx_.mPtr->_hx_getInterface(0x79d60748)))->_hx_hangup)();
+ }
+ void (::hx::Object :: *_hx_retract)();
+ static inline void retract( ::Dynamic _hx_) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::jingle::Session_obj *>(_hx_.mPtr->_hx_getInterface(0x79d60748)))->_hx_retract)();
+ }
+ void (::hx::Object :: *_hx_terminate)();
+ static inline void terminate( ::Dynamic _hx_) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::jingle::Session_obj *>(_hx_.mPtr->_hx_getInterface(0x79d60748)))->_hx_terminate)();
+ }
+ void (::hx::Object :: *_hx_contentAdd)( ::snikket::Stanza stanza);
+ static inline void contentAdd( ::Dynamic _hx_, ::snikket::Stanza stanza) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::jingle::Session_obj *>(_hx_.mPtr->_hx_getInterface(0x79d60748)))->_hx_contentAdd)(stanza);
+ }
+ void (::hx::Object :: *_hx_contentAccept)( ::snikket::Stanza stanza);
+ static inline void contentAccept( ::Dynamic _hx_, ::snikket::Stanza stanza) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::jingle::Session_obj *>(_hx_.mPtr->_hx_getInterface(0x79d60748)))->_hx_contentAccept)(stanza);
+ }
+ ::Dynamic (::hx::Object :: *_hx_transportInfo)( ::snikket::Stanza stanza);
+ static inline ::Dynamic transportInfo( ::Dynamic _hx_, ::snikket::Stanza stanza) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::jingle::Session_obj *>(_hx_.mPtr->_hx_getInterface(0x79d60748)))->_hx_transportInfo)(stanza);
+ }
+ void (::hx::Object :: *_hx_addMedia)(::Array< ::Dynamic> streams);
+ static inline void addMedia( ::Dynamic _hx_,::Array< ::Dynamic> streams) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::jingle::Session_obj *>(_hx_.mPtr->_hx_getInterface(0x79d60748)))->_hx_addMedia)(streams);
+ }
+ ::String (::hx::Object :: *_hx_callStatus)();
+ static inline ::String callStatus( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::jingle::Session_obj *>(_hx_.mPtr->_hx_getInterface(0x79d60748)))->_hx_callStatus)();
+ }
+ ::Array< ::Dynamic> (::hx::Object :: *_hx_videoTracks)();
+ static inline ::Array< ::Dynamic> videoTracks( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::jingle::Session_obj *>(_hx_.mPtr->_hx_getInterface(0x79d60748)))->_hx_videoTracks)();
+ }
+ ::snikket::jingle::DTMFSender (::hx::Object :: *_hx_dtmf)();
+ static inline ::snikket::jingle::DTMFSender dtmf( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::jingle::Session_obj *>(_hx_.mPtr->_hx_getInterface(0x79d60748)))->_hx_dtmf)();
+ }
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_Session */
diff --git a/Sources/c_snikket/iinclude/snikket/jingle/SessionDescription.h b/Sources/c_snikket/iinclude/snikket/jingle/SessionDescription.h
new file mode 100644
index 0000000..4529362
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/jingle/SessionDescription.h
@@ -0,0 +1,86 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_SessionDescription
+#define INCLUDED_snikket_jingle_SessionDescription
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,jingle,Attribute)
+HX_DECLARE_CLASS2(snikket,jingle,Media)
+HX_DECLARE_CLASS2(snikket,jingle,SessionDescription)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES SessionDescription_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef SessionDescription_obj OBJ_;
+ SessionDescription_obj();
+
+ public:
+ enum { _hx_ClassId = 0x24aad8f0 };
+
+ void __construct(int version,::String name,::Array< ::Dynamic> media,::Array< ::Dynamic> attributes,::Array< ::String > identificationTags);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.SessionDescription")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.SessionDescription"); }
+ static ::hx::ObjectPtr< SessionDescription_obj > __new(int version,::String name,::Array< ::Dynamic> media,::Array< ::Dynamic> attributes,::Array< ::String > identificationTags);
+ static ::hx::ObjectPtr< SessionDescription_obj > __alloc(::hx::Ctx *_hx_ctx,int version,::String name,::Array< ::Dynamic> media,::Array< ::Dynamic> attributes,::Array< ::String > identificationTags);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SessionDescription_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("SessionDescription",66,e1,61,a3); }
+
+ static ::snikket::jingle::SessionDescription parse(::String input);
+ static ::Dynamic parse_dyn();
+
+ static ::snikket::jingle::SessionDescription fromStanza( ::snikket::Stanza iq,bool initiator, ::snikket::jingle::SessionDescription existingDescription);
+ static ::Dynamic fromStanza_dyn();
+
+ int version;
+ ::String name;
+ ::Array< ::Dynamic> media;
+ ::Array< ::Dynamic> attributes;
+ ::Array< ::String > identificationTags;
+ ::Dynamic getUfragPwd();
+ ::Dynamic getUfragPwd_dyn();
+
+ ::snikket::jingle::Attribute getFingerprint();
+ ::Dynamic getFingerprint_dyn();
+
+ ::String getDtlsSetup();
+ ::Dynamic getDtlsSetup_dyn();
+
+ ::snikket::jingle::SessionDescription addContent( ::snikket::jingle::SessionDescription newDescription);
+ ::Dynamic addContent_dyn();
+
+ ::String toSdp();
+ ::Dynamic toSdp_dyn();
+
+ ::snikket::Stanza toStanza(::String action,::String sid,bool initiator);
+ ::Dynamic toStanza_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_SessionDescription */
diff --git a/Sources/c_snikket/iinclude/snikket/jingle/TransportInfo.h b/Sources/c_snikket/iinclude/snikket/jingle/TransportInfo.h
new file mode 100644
index 0000000..1af9d00
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/jingle/TransportInfo.h
@@ -0,0 +1,60 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle_TransportInfo
+#define INCLUDED_snikket_jingle_TransportInfo
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,jingle,Media)
+HX_DECLARE_CLASS2(snikket,jingle,TransportInfo)
+
+namespace snikket{
+namespace jingle{
+
+
+class HXCPP_CLASS_ATTRIBUTES TransportInfo_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef TransportInfo_obj OBJ_;
+ TransportInfo_obj();
+
+ public:
+ enum { _hx_ClassId = 0x4c85e215 };
+
+ void __construct( ::snikket::jingle::Media media,::String sid);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.jingle.TransportInfo")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.jingle.TransportInfo"); }
+ static ::hx::ObjectPtr< TransportInfo_obj > __new( ::snikket::jingle::Media media,::String sid);
+ static ::hx::ObjectPtr< TransportInfo_obj > __alloc(::hx::Ctx *_hx_ctx, ::snikket::jingle::Media media,::String sid);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~TransportInfo_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("TransportInfo",97,8c,bf,fe); }
+
+ ::snikket::jingle::Media media;
+ ::String sid;
+ ::snikket::Stanza toStanza(bool initiator);
+ ::Dynamic toStanza_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+
+#endif /* INCLUDED_snikket_jingle_TransportInfo */
diff --git a/Sources/c_snikket/iinclude/snikket/jingle/_Session/Session_Fields_.h b/Sources/c_snikket/iinclude/snikket/jingle/_Session/Session_Fields_.h
new file mode 100644
index 0000000..5690ec1
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/jingle/_Session/Session_Fields_.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_jingle__Session_Session_Fields_
+#define INCLUDED_snikket_jingle__Session_Session_Fields_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,ChatMessage)
+HX_DECLARE_CLASS1(snikket,JID)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS3(snikket,jingle,_Session,Session_Fields_)
+
+namespace snikket{
+namespace jingle{
+namespace _Session{
+
+
+class HXCPP_CLASS_ATTRIBUTES Session_Fields__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Session_Fields__obj OBJ_;
+ Session_Fields__obj();
+
+ public:
+ enum { _hx_ClassId = 0x4b7e6858 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="snikket.jingle._Session.Session_Fields_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"snikket.jingle._Session.Session_Fields_"); }
+
+ inline static ::hx::ObjectPtr< Session_Fields__obj > __new() {
+ ::hx::ObjectPtr< Session_Fields__obj > __this = new Session_Fields__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Session_Fields__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Session_Fields__obj *__this = (Session_Fields__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Session_Fields__obj), false, "snikket.jingle._Session.Session_Fields_"));
+ *(void **)__this = Session_Fields__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Session_Fields__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Session_Fields_",5d,02,e4,dc); }
+
+ static ::snikket::ChatMessage mkCallMessage( ::snikket::JID to, ::snikket::JID from, ::snikket::Stanza event);
+ static ::Dynamic mkCallMessage_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace jingle
+} // end namespace _Session
+
+#endif /* INCLUDED_snikket_jingle__Session_Session_Fields_ */
diff --git a/Sources/c_snikket/iinclude/snikket/persistence/Dummy.h b/Sources/c_snikket/iinclude/snikket/persistence/Dummy.h
new file mode 100644
index 0000000..6b7e275
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/persistence/Dummy.h
@@ -0,0 +1,138 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_persistence_Dummy
+#define INCLUDED_snikket_persistence_Dummy
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_Persistence
+#include <snikket/Persistence.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Caps)
+HX_DECLARE_CLASS1(snikket,Chat)
+HX_DECLARE_CLASS1(snikket,ChatMessage)
+HX_DECLARE_CLASS1(snikket,Persistence)
+HX_DECLARE_CLASS1(snikket,ReactionUpdate)
+HX_DECLARE_CLASS1(snikket,SerializedChat)
+HX_DECLARE_CLASS2(snikket,persistence,Dummy)
+
+namespace snikket{
+namespace persistence{
+
+
+class HXCPP_CLASS_ATTRIBUTES Dummy_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Dummy_obj OBJ_;
+ Dummy_obj();
+
+ public:
+ enum { _hx_ClassId = 0x130a03e2 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="snikket.persistence.Dummy")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"snikket.persistence.Dummy"); }
+ static ::hx::ObjectPtr< Dummy_obj > __new();
+ static ::hx::ObjectPtr< Dummy_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Dummy_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("Dummy",08,7e,e8,74); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ void lastId(::String accountId,::String chatId, ::Dynamic callback);
+ ::Dynamic lastId_dyn();
+
+ void storeChats(::String accountId,::Array< ::Dynamic> chat);
+ ::Dynamic storeChats_dyn();
+
+ void getChats(::String accountId, ::Dynamic callback);
+ ::Dynamic getChats_dyn();
+
+ void storeMessages(::String accountId,::Array< ::Dynamic> messages, ::Dynamic callback);
+ ::Dynamic storeMessages_dyn();
+
+ void updateMessage(::String accountId, ::snikket::ChatMessage message);
+ ::Dynamic updateMessage_dyn();
+
+ void getMessage(::String accountId,::String chatId,::String serverId,::String localId, ::Dynamic callback);
+ ::Dynamic getMessage_dyn();
+
+ void getMessagesBefore(::String accountId,::String chatId,::String beforeId,::String beforeTime, ::Dynamic callback);
+ ::Dynamic getMessagesBefore_dyn();
+
+ void getMessagesAfter(::String accountId,::String chatId,::String afterId,::String afterTime, ::Dynamic callback);
+ ::Dynamic getMessagesAfter_dyn();
+
+ void getMessagesAround(::String accountId,::String chatId,::String aroundId,::String aroundTime, ::Dynamic callback);
+ ::Dynamic getMessagesAround_dyn();
+
+ void getChatsUnreadDetails(::String accountId,::Array< ::Dynamic> chats, ::Dynamic callback);
+ ::Dynamic getChatsUnreadDetails_dyn();
+
+ void storeReaction(::String accountId, ::snikket::ReactionUpdate update, ::Dynamic callback);
+ ::Dynamic storeReaction_dyn();
+
+ void updateMessageStatus(::String accountId,::String localId,int status, ::Dynamic callback);
+ ::Dynamic updateMessageStatus_dyn();
+
+ void getMediaUri(::String hashAlgorithm,::Array< unsigned char > hash, ::Dynamic callback);
+ ::Dynamic getMediaUri_dyn();
+
+ void hasMedia(::String hashAlgorithm,::Array< unsigned char > hash, ::Dynamic callback);
+ ::Dynamic hasMedia_dyn();
+
+ void storeMedia(::String mime,::Array< unsigned char > bd, ::Dynamic callback);
+ ::Dynamic storeMedia_dyn();
+
+ void removeMedia(::String hashAlgorithm,::Array< unsigned char > hash);
+ ::Dynamic removeMedia_dyn();
+
+ void storeCaps( ::snikket::Caps caps);
+ ::Dynamic storeCaps_dyn();
+
+ void getCaps(::String ver, ::Dynamic callback);
+ ::Dynamic getCaps_dyn();
+
+ void storeLogin(::String login,::String clientId,::String displayName,::String token);
+ ::Dynamic storeLogin_dyn();
+
+ void getLogin(::String login, ::Dynamic callback);
+ ::Dynamic getLogin_dyn();
+
+ void removeAccount(::String accountId,bool completely);
+ ::Dynamic removeAccount_dyn();
+
+ void listAccounts( ::Dynamic callback);
+ ::Dynamic listAccounts_dyn();
+
+ void storeStreamManagement(::String accountId,::Array< unsigned char > sm);
+ ::Dynamic storeStreamManagement_dyn();
+
+ void getStreamManagement(::String accountId, ::Dynamic callback);
+ ::Dynamic getStreamManagement_dyn();
+
+ void storeService(::String accountId,::String serviceId,::String name,::String node, ::snikket::Caps caps);
+ ::Dynamic storeService_dyn();
+
+ void findServicesWithFeature(::String accountId,::String feature, ::Dynamic callback);
+ ::Dynamic findServicesWithFeature_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace persistence
+
+#endif /* INCLUDED_snikket_persistence_Dummy */
diff --git a/Sources/c_snikket/iinclude/snikket/persistence/KeyValueStore.h b/Sources/c_snikket/iinclude/snikket/persistence/KeyValueStore.h
new file mode 100644
index 0000000..33fa468
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/persistence/KeyValueStore.h
@@ -0,0 +1,33 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_persistence_KeyValueStore
+#define INCLUDED_snikket_persistence_KeyValueStore
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(snikket,persistence,KeyValueStore)
+
+namespace snikket{
+namespace persistence{
+
+
+class HXCPP_CLASS_ATTRIBUTES KeyValueStore_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ void (::hx::Object :: *_hx_get)(::String k, ::Dynamic callback);
+ static inline void get( ::Dynamic _hx_,::String k, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::persistence::KeyValueStore_obj *>(_hx_.mPtr->_hx_getInterface(0x42160a8d)))->_hx_get)(k,callback);
+ }
+ void (::hx::Object :: *_hx_set)(::String k,::String v, ::Dynamic callback);
+ static inline void set( ::Dynamic _hx_,::String k,::String v, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::persistence::KeyValueStore_obj *>(_hx_.mPtr->_hx_getInterface(0x42160a8d)))->_hx_set)(k,v,callback);
+ }
+};
+
+} // end namespace snikket
+} // end namespace persistence
+
+#endif /* INCLUDED_snikket_persistence_KeyValueStore */
diff --git a/Sources/c_snikket/iinclude/snikket/persistence/MediaStore.h b/Sources/c_snikket/iinclude/snikket/persistence/MediaStore.h
new file mode 100644
index 0000000..911ceff
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/persistence/MediaStore.h
@@ -0,0 +1,42 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_persistence_MediaStore
+#define INCLUDED_snikket_persistence_MediaStore
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(snikket,persistence,KeyValueStore)
+HX_DECLARE_CLASS2(snikket,persistence,MediaStore)
+
+namespace snikket{
+namespace persistence{
+
+
+class HXCPP_CLASS_ATTRIBUTES MediaStore_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ void (::hx::Object :: *_hx_hasMedia)(::String hashAlgorithm,::Array< unsigned char > hash, ::Dynamic callback);
+ static inline void hasMedia( ::Dynamic _hx_,::String hashAlgorithm,::Array< unsigned char > hash, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::persistence::MediaStore_obj *>(_hx_.mPtr->_hx_getInterface(0x2952283f)))->_hx_hasMedia)(hashAlgorithm,hash,callback);
+ }
+ void (::hx::Object :: *_hx_removeMedia)(::String hashAlgorithm,::Array< unsigned char > hash);
+ static inline void removeMedia( ::Dynamic _hx_,::String hashAlgorithm,::Array< unsigned char > hash) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::persistence::MediaStore_obj *>(_hx_.mPtr->_hx_getInterface(0x2952283f)))->_hx_removeMedia)(hashAlgorithm,hash);
+ }
+ void (::hx::Object :: *_hx_storeMedia)(::String mime,::Array< unsigned char > bytes, ::Dynamic callback);
+ static inline void storeMedia( ::Dynamic _hx_,::String mime,::Array< unsigned char > bytes, ::Dynamic callback) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::persistence::MediaStore_obj *>(_hx_.mPtr->_hx_getInterface(0x2952283f)))->_hx_storeMedia)(mime,bytes,callback);
+ }
+ void (::hx::Object :: *_hx_setKV)(::Dynamic kv);
+ static inline void setKV( ::Dynamic _hx_,::Dynamic kv) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::snikket::persistence::MediaStore_obj *>(_hx_.mPtr->_hx_getInterface(0x2952283f)))->_hx_setKV)(kv);
+ }
+};
+
+} // end namespace snikket
+} // end namespace persistence
+
+#endif /* INCLUDED_snikket_persistence_MediaStore */
diff --git a/Sources/c_snikket/iinclude/snikket/persistence/MediaStoreFS.h b/Sources/c_snikket/iinclude/snikket/persistence/MediaStoreFS.h
new file mode 100644
index 0000000..7ceaaa8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/persistence/MediaStoreFS.h
@@ -0,0 +1,86 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_persistence_MediaStoreFS
+#define INCLUDED_snikket_persistence_MediaStoreFS
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_persistence_MediaStore
+#include <snikket/persistence/MediaStore.h>
+#endif
+HX_DECLARE_CLASS2(snikket,persistence,KeyValueStore)
+HX_DECLARE_CLASS2(snikket,persistence,MediaStore)
+HX_DECLARE_CLASS2(snikket,persistence,MediaStoreFS)
+HX_DECLARE_CLASS1(thenshim,Thenable)
+
+namespace snikket{
+namespace persistence{
+
+
+class HXCPP_CLASS_ATTRIBUTES MediaStoreFS_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef MediaStoreFS_obj OBJ_;
+ MediaStoreFS_obj();
+
+ public:
+ enum { _hx_ClassId = 0x3993cd38 };
+
+ void __construct(::String path);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.persistence.MediaStoreFS")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.persistence.MediaStoreFS"); }
+ static ::hx::ObjectPtr< MediaStoreFS_obj > __new(::String path);
+ static ::hx::ObjectPtr< MediaStoreFS_obj > __alloc(::hx::Ctx *_hx_ctx,::String path);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~MediaStoreFS_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("MediaStoreFS",0a,5f,89,fe); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ ::String blobpath;
+ ::Dynamic kv;
+ void setKV(::Dynamic kv);
+ ::Dynamic setKV_dyn();
+
+ void getMediaPath(::String uri, ::Dynamic callback);
+ ::Dynamic getMediaPath_dyn();
+
+ void getMediaPath__fromC(::String uri,::cpp::Function< void (const char*,void*) > callback,void* callback__context);
+
+ void hasMedia(::String hashAlgorithm,::Array< unsigned char > hash, ::Dynamic callback);
+ ::Dynamic hasMedia_dyn();
+
+ void removeMedia(::String hashAlgorithm,::Array< unsigned char > hash);
+ ::Dynamic removeMedia_dyn();
+
+ void storeMedia(::String mime,::Array< unsigned char > bd, ::Dynamic callback);
+ ::Dynamic storeMedia_dyn();
+
+ ::Dynamic set(::String k,::String v);
+ ::Dynamic set_dyn();
+
+ ::Dynamic get(::String k);
+ ::Dynamic get_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace persistence
+
+#endif /* INCLUDED_snikket_persistence_MediaStoreFS */
diff --git a/Sources/c_snikket/iinclude/snikket/persistence/Sqlite.h b/Sources/c_snikket/iinclude/snikket/persistence/Sqlite.h
new file mode 100644
index 0000000..8418150
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/persistence/Sqlite.h
@@ -0,0 +1,180 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_persistence_Sqlite
+#define INCLUDED_snikket_persistence_Sqlite
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_persistence_KeyValueStore
+#include <snikket/persistence/KeyValueStore.h>
+#endif
+#ifndef INCLUDED_snikket_Persistence
+#include <snikket/Persistence.h>
+#endif
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS1(haxe,Timer)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+HX_DECLARE_CLASS1(snikket,Caps)
+HX_DECLARE_CLASS1(snikket,Chat)
+HX_DECLARE_CLASS1(snikket,ChatMessage)
+HX_DECLARE_CLASS1(snikket,Persistence)
+HX_DECLARE_CLASS1(snikket,ReactionUpdate)
+HX_DECLARE_CLASS1(snikket,SerializedChat)
+HX_DECLARE_CLASS2(snikket,persistence,KeyValueStore)
+HX_DECLARE_CLASS2(snikket,persistence,MediaStore)
+HX_DECLARE_CLASS2(snikket,persistence,Sqlite)
+HX_DECLARE_CLASS2(snikket,persistence,SqliteDriver)
+HX_DECLARE_CLASS1(thenshim,Thenable)
+
+namespace snikket{
+namespace persistence{
+
+
+class HXCPP_CLASS_ATTRIBUTES Sqlite_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Sqlite_obj OBJ_;
+ Sqlite_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1fc6c66e };
+
+ void __construct(::String dbfile,::Dynamic media);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.persistence.Sqlite")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.persistence.Sqlite"); }
+ static ::hx::ObjectPtr< Sqlite_obj > __new(::String dbfile,::Dynamic media);
+ static ::hx::ObjectPtr< Sqlite_obj > __alloc(::hx::Ctx *_hx_ctx,::String dbfile,::Dynamic media);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Sqlite_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("Sqlite",ec,9c,99,87); }
+
+ static void __boot();
+ static ::Dynamic __meta__;
+ ::snikket::persistence::SqliteDriver db;
+ ::Dynamic media;
+ void get(::String k, ::Dynamic callback);
+ ::Dynamic get_dyn();
+
+ void set(::String k,::String v, ::Dynamic callback);
+ ::Dynamic set_dyn();
+
+ void lastId(::String accountId,::String chatId, ::Dynamic callback);
+ ::Dynamic lastId_dyn();
+
+ ::haxe::ds::StringMap storeChatBuffer;
+ ::haxe::Timer storeChatTimer;
+ void storeChats(::String accountId,::Array< ::Dynamic> chats);
+ ::Dynamic storeChats_dyn();
+
+ void getChats(::String accountId, ::Dynamic callback);
+ ::Dynamic getChats_dyn();
+
+ void storeMessages(::String accountId,::Array< ::Dynamic> messages, ::Dynamic callback);
+ ::Dynamic storeMessages_dyn();
+
+ void updateMessage(::String accountId, ::snikket::ChatMessage message);
+ ::Dynamic updateMessage_dyn();
+
+ void getMessage(::String accountId,::String chatId,::String serverId,::String localId, ::Dynamic callback);
+ ::Dynamic getMessage_dyn();
+
+ void getMessage__fromC(::String accountId,::String chatId,::String serverId,::String localId,::cpp::Function< void (void*,void*) > callback,void* callback__context);
+
+ ::Dynamic getMessages(::String accountId,::String chatId,::String time,::String op);
+ ::Dynamic getMessages_dyn();
+
+ void getMessagesBefore(::String accountId,::String chatId,::String beforeId,::String beforeTime, ::Dynamic callback);
+ ::Dynamic getMessagesBefore_dyn();
+
+ void getMessagesAfter(::String accountId,::String chatId,::String afterId,::String afterTime, ::Dynamic callback);
+ ::Dynamic getMessagesAfter_dyn();
+
+ void getMessagesAround(::String accountId,::String chatId,::String aroundId,::String aroundTime, ::Dynamic callback);
+ ::Dynamic getMessagesAround_dyn();
+
+ void getChatsUnreadDetails(::String accountId,::Array< ::Dynamic> chats, ::Dynamic callback);
+ ::Dynamic getChatsUnreadDetails_dyn();
+
+ void storeReaction(::String accountId, ::snikket::ReactionUpdate update, ::Dynamic callback);
+ ::Dynamic storeReaction_dyn();
+
+ void updateMessageStatus(::String accountId,::String localId,int status, ::Dynamic callback);
+ ::Dynamic updateMessageStatus_dyn();
+
+ void hasMedia(::String hashAlgorithm,::Array< unsigned char > hash, ::Dynamic callback);
+ ::Dynamic hasMedia_dyn();
+
+ void removeMedia(::String hashAlgorithm,::Array< unsigned char > hash);
+ ::Dynamic removeMedia_dyn();
+
+ void storeMedia(::String mime,::Array< unsigned char > bd, ::Dynamic callback);
+ ::Dynamic storeMedia_dyn();
+
+ void storeCaps( ::snikket::Caps caps);
+ ::Dynamic storeCaps_dyn();
+
+ void getCaps(::String ver, ::Dynamic callback);
+ ::Dynamic getCaps_dyn();
+
+ void storeLogin(::String accountId,::String clientId,::String displayName,::String token);
+ ::Dynamic storeLogin_dyn();
+
+ void getLogin(::String accountId, ::Dynamic callback);
+ ::Dynamic getLogin_dyn();
+
+ void removeAccount(::String accountId,bool completely);
+ ::Dynamic removeAccount_dyn();
+
+ void listAccounts( ::Dynamic callback);
+ ::Dynamic listAccounts_dyn();
+
+ void listAccounts__fromC(::cpp::Function< void (const char**,size_t,void*) > callback,void* callback__context);
+
+ bool smStoreInProgress;
+ ::Array< unsigned char > smStoreNext;
+ void storeStreamManagement(::String accountId,::Array< unsigned char > sm);
+ ::Dynamic storeStreamManagement_dyn();
+
+ void getStreamManagement(::String accountId, ::Dynamic callback);
+ ::Dynamic getStreamManagement_dyn();
+
+ void storeService(::String accountId,::String serviceId,::String name,::String node, ::snikket::Caps caps);
+ ::Dynamic storeService_dyn();
+
+ void findServicesWithFeature(::String accountId,::String feature, ::Dynamic callback);
+ ::Dynamic findServicesWithFeature_dyn();
+
+ ::Dynamic hydrateReactions(::String accountId,::Array< ::Dynamic> messages);
+ ::Dynamic hydrateReactions_dyn();
+
+ ::Dynamic fetchReactions(::String accountId,::Array< ::Dynamic> ids);
+ ::Dynamic fetchReactions_dyn();
+
+ ::Dynamic hydrateReplyTo(::String accountId,::Array< ::Dynamic> messages,::Array< ::Dynamic> replyTos);
+ ::Dynamic hydrateReplyTo_dyn();
+
+ ::Array< ::Dynamic> hydrateMessages(::String accountId, ::Dynamic rows);
+ ::Dynamic hydrateMessages_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace persistence
+
+#endif /* INCLUDED_snikket_persistence_Sqlite */
diff --git a/Sources/c_snikket/iinclude/snikket/persistence/SqliteDriver.h b/Sources/c_snikket/iinclude/snikket/persistence/SqliteDriver.h
new file mode 100644
index 0000000..d13d4d8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/persistence/SqliteDriver.h
@@ -0,0 +1,61 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_persistence_SqliteDriver
+#define INCLUDED_snikket_persistence_SqliteDriver
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(snikket,persistence,SqliteDriver)
+HX_DECLARE_CLASS2(sys,db,Connection)
+HX_DECLARE_CLASS1(thenshim,Thenable)
+
+namespace snikket{
+namespace persistence{
+
+
+class HXCPP_CLASS_ATTRIBUTES SqliteDriver_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef SqliteDriver_obj OBJ_;
+ SqliteDriver_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0672539a };
+
+ void __construct(::String dbfile);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.persistence.SqliteDriver")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.persistence.SqliteDriver"); }
+ static ::hx::ObjectPtr< SqliteDriver_obj > __new(::String dbfile);
+ static ::hx::ObjectPtr< SqliteDriver_obj > __alloc(::hx::Ctx *_hx_ctx,::String dbfile);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SqliteDriver_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("SqliteDriver",34,0a,34,44); }
+
+ ::Dynamic db;
+ ::Dynamic exec( ::Dynamic sql,::cpp::VirtualArray params);
+ ::Dynamic exec_dyn();
+
+ ::String prepare(::String sql,::cpp::VirtualArray params);
+ ::Dynamic prepare_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace persistence
+
+#endif /* INCLUDED_snikket_persistence_SqliteDriver */
diff --git a/Sources/c_snikket/iinclude/snikket/queries/BlocklistGet.h b/Sources/c_snikket/iinclude/snikket/queries/BlocklistGet.h
new file mode 100644
index 0000000..ab498fe
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/queries/BlocklistGet.h
@@ -0,0 +1,67 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_queries_BlocklistGet
+#define INCLUDED_snikket_queries_BlocklistGet
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,queries,BlocklistGet)
+HX_DECLARE_CLASS2(snikket,queries,GenericQuery)
+
+namespace snikket{
+namespace queries{
+
+
+class HXCPP_CLASS_ATTRIBUTES BlocklistGet_obj : public ::snikket::queries::GenericQuery_obj
+{
+ public:
+ typedef ::snikket::queries::GenericQuery_obj super;
+ typedef BlocklistGet_obj OBJ_;
+ BlocklistGet_obj();
+
+ public:
+ enum { _hx_ClassId = 0x60103714 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.queries.BlocklistGet")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.queries.BlocklistGet"); }
+ static ::hx::ObjectPtr< BlocklistGet_obj > __new();
+ static ::hx::ObjectPtr< BlocklistGet_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~BlocklistGet_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("BlocklistGet",4b,75,69,37); }
+
+ ::String xmlns;
+ ::String queryId;
+ ::snikket::Stanza responseStanza;
+ ::Array< ::String > result;
+ void handleResponse( ::snikket::Stanza stanza);
+
+ ::Array< ::String > getResult();
+ ::Dynamic getResult_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace queries
+
+#endif /* INCLUDED_snikket_queries_BlocklistGet */
diff --git a/Sources/c_snikket/iinclude/snikket/queries/BoB.h b/Sources/c_snikket/iinclude/snikket/queries/BoB.h
new file mode 100644
index 0000000..a2bd8ec
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/queries/BoB.h
@@ -0,0 +1,72 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_queries_BoB
+#define INCLUDED_snikket_queries_BoB
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Hash)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,queries,BoB)
+HX_DECLARE_CLASS2(snikket,queries,GenericQuery)
+
+namespace snikket{
+namespace queries{
+
+
+class HXCPP_CLASS_ATTRIBUTES BoB_obj : public ::snikket::queries::GenericQuery_obj
+{
+ public:
+ typedef ::snikket::queries::GenericQuery_obj super;
+ typedef BoB_obj OBJ_;
+ BoB_obj();
+
+ public:
+ enum { _hx_ClassId = 0x6fef110c };
+
+ void __construct(::String to,::String uri);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.queries.BoB")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.queries.BoB"); }
+ static ::hx::ObjectPtr< BoB_obj > __new(::String to,::String uri);
+ static ::hx::ObjectPtr< BoB_obj > __alloc(::hx::Ctx *_hx_ctx,::String to,::String uri);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~BoB_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("BoB",b5,75,32,00); }
+
+ static ::snikket::queries::BoB forHash(::String to, ::snikket::Hash hash);
+ static ::Dynamic forHash_dyn();
+
+ ::String xmlns;
+ ::String queryId;
+ ::snikket::Stanza responseStanza;
+ ::Dynamic result;
+ void handleResponse( ::snikket::Stanza stanza);
+
+ ::Dynamic getResult();
+ ::Dynamic getResult_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace queries
+
+#endif /* INCLUDED_snikket_queries_BoB */
diff --git a/Sources/c_snikket/iinclude/snikket/queries/DiscoInfoGet.h b/Sources/c_snikket/iinclude/snikket/queries/DiscoInfoGet.h
new file mode 100644
index 0000000..cb69a82
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/queries/DiscoInfoGet.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_queries_DiscoInfoGet
+#define INCLUDED_snikket_queries_DiscoInfoGet
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Caps)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,queries,DiscoInfoGet)
+HX_DECLARE_CLASS2(snikket,queries,GenericQuery)
+
+namespace snikket{
+namespace queries{
+
+
+class HXCPP_CLASS_ATTRIBUTES DiscoInfoGet_obj : public ::snikket::queries::GenericQuery_obj
+{
+ public:
+ typedef ::snikket::queries::GenericQuery_obj super;
+ typedef DiscoInfoGet_obj OBJ_;
+ DiscoInfoGet_obj();
+
+ public:
+ enum { _hx_ClassId = 0x17bd6e57 };
+
+ void __construct(::String to,::String node);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.queries.DiscoInfoGet")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.queries.DiscoInfoGet"); }
+ static ::hx::ObjectPtr< DiscoInfoGet_obj > __new(::String to,::String node);
+ static ::hx::ObjectPtr< DiscoInfoGet_obj > __alloc(::hx::Ctx *_hx_ctx,::String to,::String node);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~DiscoInfoGet_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("DiscoInfoGet",8e,ac,16,ef); }
+
+ ::String xmlns;
+ ::String queryId;
+ ::snikket::Stanza responseStanza;
+ ::snikket::Caps result;
+ void handleResponse( ::snikket::Stanza stanza);
+
+ ::snikket::Caps getResult();
+ ::Dynamic getResult_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace queries
+
+#endif /* INCLUDED_snikket_queries_DiscoInfoGet */
diff --git a/Sources/c_snikket/iinclude/snikket/queries/DiscoItemsGet.h b/Sources/c_snikket/iinclude/snikket/queries/DiscoItemsGet.h
new file mode 100644
index 0000000..8096b9e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/queries/DiscoItemsGet.h
@@ -0,0 +1,67 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_queries_DiscoItemsGet
+#define INCLUDED_snikket_queries_DiscoItemsGet
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,queries,DiscoItemsGet)
+HX_DECLARE_CLASS2(snikket,queries,GenericQuery)
+
+namespace snikket{
+namespace queries{
+
+
+class HXCPP_CLASS_ATTRIBUTES DiscoItemsGet_obj : public ::snikket::queries::GenericQuery_obj
+{
+ public:
+ typedef ::snikket::queries::GenericQuery_obj super;
+ typedef DiscoItemsGet_obj OBJ_;
+ DiscoItemsGet_obj();
+
+ public:
+ enum { _hx_ClassId = 0x3759f407 };
+
+ void __construct(::String to,::String node);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.queries.DiscoItemsGet")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.queries.DiscoItemsGet"); }
+ static ::hx::ObjectPtr< DiscoItemsGet_obj > __new(::String to,::String node);
+ static ::hx::ObjectPtr< DiscoItemsGet_obj > __alloc(::hx::Ctx *_hx_ctx,::String to,::String node);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~DiscoItemsGet_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("DiscoItemsGet",f0,25,17,ce); }
+
+ ::String xmlns;
+ ::String queryId;
+ ::snikket::Stanza responseStanza;
+ ::Array< ::Dynamic> result;
+ void handleResponse( ::snikket::Stanza stanza);
+
+ ::Array< ::Dynamic> getResult();
+ ::Dynamic getResult_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace queries
+
+#endif /* INCLUDED_snikket_queries_DiscoItemsGet */
diff --git a/Sources/c_snikket/iinclude/snikket/queries/ExtDiscoGet.h b/Sources/c_snikket/iinclude/snikket/queries/ExtDiscoGet.h
new file mode 100644
index 0000000..7f2afdc
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/queries/ExtDiscoGet.h
@@ -0,0 +1,67 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_queries_ExtDiscoGet
+#define INCLUDED_snikket_queries_ExtDiscoGet
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,queries,ExtDiscoGet)
+HX_DECLARE_CLASS2(snikket,queries,GenericQuery)
+
+namespace snikket{
+namespace queries{
+
+
+class HXCPP_CLASS_ATTRIBUTES ExtDiscoGet_obj : public ::snikket::queries::GenericQuery_obj
+{
+ public:
+ typedef ::snikket::queries::GenericQuery_obj super;
+ typedef ExtDiscoGet_obj OBJ_;
+ ExtDiscoGet_obj();
+
+ public:
+ enum { _hx_ClassId = 0x5f97d134 };
+
+ void __construct(::String to);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.queries.ExtDiscoGet")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.queries.ExtDiscoGet"); }
+ static ::hx::ObjectPtr< ExtDiscoGet_obj > __new(::String to);
+ static ::hx::ObjectPtr< ExtDiscoGet_obj > __alloc(::hx::Ctx *_hx_ctx,::String to);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ExtDiscoGet_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("ExtDiscoGet",dd,86,3d,f9); }
+
+ ::String xmlns;
+ ::String queryId;
+ ::snikket::Stanza responseStanza;
+ ::Array< ::Dynamic> result;
+ void handleResponse( ::snikket::Stanza stanza);
+
+ ::Array< ::Dynamic> getResult();
+ ::Dynamic getResult_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace queries
+
+#endif /* INCLUDED_snikket_queries_ExtDiscoGet */
diff --git a/Sources/c_snikket/iinclude/snikket/queries/GenericQuery.h b/Sources/c_snikket/iinclude/snikket/queries/GenericQuery.h
new file mode 100644
index 0000000..b2b72e1
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/queries/GenericQuery.h
@@ -0,0 +1,65 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#define INCLUDED_snikket_queries_GenericQuery
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,queries,GenericQuery)
+
+namespace snikket{
+namespace queries{
+
+
+class HXCPP_CLASS_ATTRIBUTES GenericQuery_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef GenericQuery_obj OBJ_;
+ GenericQuery_obj();
+
+ public:
+ enum { _hx_ClassId = 0x22eda35a };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.queries.GenericQuery")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.queries.GenericQuery"); }
+
+ //~GenericQuery_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("GenericQuery",91,e1,46,fa); }
+
+ ::snikket::Stanza queryStanza;
+ ::Dynamic handleFinished;
+ Dynamic handleFinished_dyn() { return handleFinished;}
+ bool isFinished;
+ ::snikket::Stanza getQueryStanza();
+ ::Dynamic getQueryStanza_dyn();
+
+ void finish();
+ ::Dynamic finish_dyn();
+
+ virtual void handleResponse( ::snikket::Stanza response) {}
+ ::Dynamic handleResponse_dyn();
+ void onFinished( ::Dynamic handler);
+ ::Dynamic onFinished_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace queries
+
+#endif /* INCLUDED_snikket_queries_GenericQuery */
diff --git a/Sources/c_snikket/iinclude/snikket/queries/HttpUploadSlot.h b/Sources/c_snikket/iinclude/snikket/queries/HttpUploadSlot.h
new file mode 100644
index 0000000..883512b
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/queries/HttpUploadSlot.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_queries_HttpUploadSlot
+#define INCLUDED_snikket_queries_HttpUploadSlot
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Hash)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,queries,GenericQuery)
+HX_DECLARE_CLASS2(snikket,queries,HttpUploadSlot)
+
+namespace snikket{
+namespace queries{
+
+
+class HXCPP_CLASS_ATTRIBUTES HttpUploadSlot_obj : public ::snikket::queries::GenericQuery_obj
+{
+ public:
+ typedef ::snikket::queries::GenericQuery_obj super;
+ typedef HttpUploadSlot_obj OBJ_;
+ HttpUploadSlot_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1883dc70 };
+
+ void __construct(::String to,::String filename,int size,::String mime,::Array< ::Dynamic> hashes);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.queries.HttpUploadSlot")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.queries.HttpUploadSlot"); }
+ static ::hx::ObjectPtr< HttpUploadSlot_obj > __new(::String to,::String filename,int size,::String mime,::Array< ::Dynamic> hashes);
+ static ::hx::ObjectPtr< HttpUploadSlot_obj > __alloc(::hx::Ctx *_hx_ctx,::String to,::String filename,int size,::String mime,::Array< ::Dynamic> hashes);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~HttpUploadSlot_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("HttpUploadSlot",67,56,52,67); }
+
+ ::String xmlns;
+ ::String queryId;
+ ::snikket::Stanza responseStanza;
+ ::Dynamic result;
+ void handleResponse( ::snikket::Stanza stanza);
+
+ ::Dynamic getResult();
+ ::Dynamic getResult_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace queries
+
+#endif /* INCLUDED_snikket_queries_HttpUploadSlot */
diff --git a/Sources/c_snikket/iinclude/snikket/queries/JabberIqGatewayGet.h b/Sources/c_snikket/iinclude/snikket/queries/JabberIqGatewayGet.h
new file mode 100644
index 0000000..9c76c99
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/queries/JabberIqGatewayGet.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_queries_JabberIqGatewayGet
+#define INCLUDED_snikket_queries_JabberIqGatewayGet
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+HX_DECLARE_CLASS2(haxe,ds,Either)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,queries,GenericQuery)
+HX_DECLARE_CLASS2(snikket,queries,JabberIqGatewayGet)
+
+namespace snikket{
+namespace queries{
+
+
+class HXCPP_CLASS_ATTRIBUTES JabberIqGatewayGet_obj : public ::snikket::queries::GenericQuery_obj
+{
+ public:
+ typedef ::snikket::queries::GenericQuery_obj super;
+ typedef JabberIqGatewayGet_obj OBJ_;
+ JabberIqGatewayGet_obj();
+
+ public:
+ enum { _hx_ClassId = 0x3942ef8b };
+
+ void __construct(::String to,::String prompt);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.queries.JabberIqGatewayGet")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.queries.JabberIqGatewayGet"); }
+ static ::hx::ObjectPtr< JabberIqGatewayGet_obj > __new(::String to,::String prompt);
+ static ::hx::ObjectPtr< JabberIqGatewayGet_obj > __alloc(::hx::Ctx *_hx_ctx,::String to,::String prompt);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~JabberIqGatewayGet_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("JabberIqGatewayGet",9e,bd,60,0b); }
+
+ ::String xmlns;
+ ::String queryId;
+ ::snikket::Stanza responseStanza;
+ ::haxe::ds::Either result;
+ void handleResponse( ::snikket::Stanza stanza);
+
+ ::haxe::ds::Either getResult();
+ ::Dynamic getResult_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace queries
+
+#endif /* INCLUDED_snikket_queries_JabberIqGatewayGet */
diff --git a/Sources/c_snikket/iinclude/snikket/queries/MAMQuery.h b/Sources/c_snikket/iinclude/snikket/queries/MAMQuery.h
new file mode 100644
index 0000000..c3abe95
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/queries/MAMQuery.h
@@ -0,0 +1,73 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_queries_MAMQuery
+#define INCLUDED_snikket_queries_MAMQuery
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,queries,GenericQuery)
+HX_DECLARE_CLASS2(snikket,queries,MAMQuery)
+
+namespace snikket{
+namespace queries{
+
+
+class HXCPP_CLASS_ATTRIBUTES MAMQuery_obj : public ::snikket::queries::GenericQuery_obj
+{
+ public:
+ typedef ::snikket::queries::GenericQuery_obj super;
+ typedef MAMQuery_obj OBJ_;
+ MAMQuery_obj();
+
+ public:
+ enum { _hx_ClassId = 0x3d2643e0 };
+
+ void __construct( ::Dynamic params,::String jid);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.queries.MAMQuery")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.queries.MAMQuery"); }
+ static ::hx::ObjectPtr< MAMQuery_obj > __new( ::Dynamic params,::String jid);
+ static ::hx::ObjectPtr< MAMQuery_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic params,::String jid);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~MAMQuery_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("MAMQuery",cf,3d,b2,7d); }
+
+ ::String xmlns;
+ ::String queryId;
+ ::snikket::Stanza responseStanza;
+ ::Dynamic result;
+ void addStringField(::String name,::String value);
+ ::Dynamic addStringField_dyn();
+
+ void addArrayField(::String name,::Array< ::String > values);
+ ::Dynamic addArrayField_dyn();
+
+ void handleResponse( ::snikket::Stanza stanza);
+
+ ::Dynamic getResult();
+ ::Dynamic getResult_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace queries
+
+#endif /* INCLUDED_snikket_queries_MAMQuery */
diff --git a/Sources/c_snikket/iinclude/snikket/queries/PubsubGet.h b/Sources/c_snikket/iinclude/snikket/queries/PubsubGet.h
new file mode 100644
index 0000000..0765cc8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/queries/PubsubGet.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_queries_PubsubGet
+#define INCLUDED_snikket_queries_PubsubGet
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,queries,GenericQuery)
+HX_DECLARE_CLASS2(snikket,queries,PubsubGet)
+
+namespace snikket{
+namespace queries{
+
+
+class HXCPP_CLASS_ATTRIBUTES PubsubGet_obj : public ::snikket::queries::GenericQuery_obj
+{
+ public:
+ typedef ::snikket::queries::GenericQuery_obj super;
+ typedef PubsubGet_obj OBJ_;
+ PubsubGet_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1a0e23ea };
+
+ void __construct(::String to,::String node,::String itemId);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.queries.PubsubGet")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.queries.PubsubGet"); }
+ static ::hx::ObjectPtr< PubsubGet_obj > __new(::String to,::String node,::String itemId);
+ static ::hx::ObjectPtr< PubsubGet_obj > __alloc(::hx::Ctx *_hx_ctx,::String to,::String node,::String itemId);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~PubsubGet_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("PubsubGet",53,ed,9f,94); }
+
+ ::String xmlns;
+ ::String queryId;
+ ::String ver;
+ ::snikket::Stanza responseStanza;
+ ::Array< ::Dynamic> result;
+ void handleResponse( ::snikket::Stanza stanza);
+
+ ::Array< ::Dynamic> getResult();
+ ::Dynamic getResult_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace queries
+
+#endif /* INCLUDED_snikket_queries_PubsubGet */
diff --git a/Sources/c_snikket/iinclude/snikket/queries/Push2Disable.h b/Sources/c_snikket/iinclude/snikket/queries/Push2Disable.h
new file mode 100644
index 0000000..19efee6
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/queries/Push2Disable.h
@@ -0,0 +1,63 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_queries_Push2Disable
+#define INCLUDED_snikket_queries_Push2Disable
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,queries,GenericQuery)
+HX_DECLARE_CLASS2(snikket,queries,Push2Disable)
+
+namespace snikket{
+namespace queries{
+
+
+class HXCPP_CLASS_ATTRIBUTES Push2Disable_obj : public ::snikket::queries::GenericQuery_obj
+{
+ public:
+ typedef ::snikket::queries::GenericQuery_obj super;
+ typedef Push2Disable_obj OBJ_;
+ Push2Disable_obj();
+
+ public:
+ enum { _hx_ClassId = 0x582a6599 };
+
+ void __construct(::String to);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.queries.Push2Disable")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.queries.Push2Disable"); }
+ static ::hx::ObjectPtr< Push2Disable_obj > __new(::String to);
+ static ::hx::ObjectPtr< Push2Disable_obj > __alloc(::hx::Ctx *_hx_ctx,::String to);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Push2Disable_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Push2Disable",d0,a3,83,2f); }
+
+ ::String xmlns;
+ ::String queryId;
+ ::snikket::Stanza responseStanza;
+ void handleResponse( ::snikket::Stanza stanza);
+
+};
+
+} // end namespace snikket
+} // end namespace queries
+
+#endif /* INCLUDED_snikket_queries_Push2Disable */
diff --git a/Sources/c_snikket/iinclude/snikket/queries/RosterGet.h b/Sources/c_snikket/iinclude/snikket/queries/RosterGet.h
new file mode 100644
index 0000000..befa38a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/queries/RosterGet.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_queries_RosterGet
+#define INCLUDED_snikket_queries_RosterGet
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,queries,GenericQuery)
+HX_DECLARE_CLASS2(snikket,queries,RosterGet)
+
+namespace snikket{
+namespace queries{
+
+
+class HXCPP_CLASS_ATTRIBUTES RosterGet_obj : public ::snikket::queries::GenericQuery_obj
+{
+ public:
+ typedef ::snikket::queries::GenericQuery_obj super;
+ typedef RosterGet_obj OBJ_;
+ RosterGet_obj();
+
+ public:
+ enum { _hx_ClassId = 0x6634aa42 };
+
+ void __construct(::String ver);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.queries.RosterGet")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.queries.RosterGet"); }
+ static ::hx::ObjectPtr< RosterGet_obj > __new(::String ver);
+ static ::hx::ObjectPtr< RosterGet_obj > __alloc(::hx::Ctx *_hx_ctx,::String ver);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~RosterGet_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("RosterGet",ab,73,c6,e0); }
+
+ ::String xmlns;
+ ::String queryId;
+ ::String ver;
+ ::snikket::Stanza responseStanza;
+ ::Array< ::Dynamic> result;
+ void handleResponse( ::snikket::Stanza stanza);
+
+ ::Array< ::Dynamic> getResult();
+ ::Dynamic getResult_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace queries
+
+#endif /* INCLUDED_snikket_queries_RosterGet */
diff --git a/Sources/c_snikket/iinclude/snikket/queries/VcardTempGet.h b/Sources/c_snikket/iinclude/snikket/queries/VcardTempGet.h
new file mode 100644
index 0000000..fea8f62
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/queries/VcardTempGet.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_queries_VcardTempGet
+#define INCLUDED_snikket_queries_VcardTempGet
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+HX_DECLARE_CLASS1(snikket,JID)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,queries,GenericQuery)
+HX_DECLARE_CLASS2(snikket,queries,VcardTempGet)
+
+namespace snikket{
+namespace queries{
+
+
+class HXCPP_CLASS_ATTRIBUTES VcardTempGet_obj : public ::snikket::queries::GenericQuery_obj
+{
+ public:
+ typedef ::snikket::queries::GenericQuery_obj super;
+ typedef VcardTempGet_obj OBJ_;
+ VcardTempGet_obj();
+
+ public:
+ enum { _hx_ClassId = 0x4c679325 };
+
+ void __construct( ::snikket::JID to);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.queries.VcardTempGet")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.queries.VcardTempGet"); }
+ static ::hx::ObjectPtr< VcardTempGet_obj > __new( ::snikket::JID to);
+ static ::hx::ObjectPtr< VcardTempGet_obj > __alloc(::hx::Ctx *_hx_ctx, ::snikket::JID to);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~VcardTempGet_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("VcardTempGet",5c,d1,c0,23); }
+
+ ::String xmlns;
+ ::String queryId;
+ ::snikket::Stanza responseStanza;
+ ::Dynamic result;
+ void handleResponse( ::snikket::Stanza stanza);
+
+ ::Dynamic getResult();
+ ::Dynamic getResult_dyn();
+
+};
+
+} // end namespace snikket
+} // end namespace queries
+
+#endif /* INCLUDED_snikket_queries_VcardTempGet */
diff --git a/Sources/c_snikket/iinclude/snikket/streams/XmppStropheStream.h b/Sources/c_snikket/iinclude/snikket/streams/XmppStropheStream.h
new file mode 100644
index 0000000..59b34d0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/snikket/streams/XmppStropheStream.h
@@ -0,0 +1,103 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_snikket_streams_XmppStropheStream
+#define INCLUDED_snikket_streams_XmppStropheStream
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_snikket_GenericStream
+#include <snikket/GenericStream.h>
+#endif
+#ifndef INCLUDED_18a1146676e1af0b
+#define INCLUDED_18a1146676e1af0b
+#include "strophe.h"
+#endif
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,BalancedTree)
+HX_DECLARE_CLASS2(haxe,ds,EnumValueMap)
+HX_DECLARE_CLASS1(snikket,EventEmitter)
+HX_DECLARE_CLASS1(snikket,GenericStream)
+HX_DECLARE_CLASS1(snikket,IqRequestType)
+HX_DECLARE_CLASS1(snikket,IqResult)
+HX_DECLARE_CLASS1(snikket,Stanza)
+HX_DECLARE_CLASS2(snikket,_Stanza,NodeInterface)
+HX_DECLARE_CLASS2(snikket,streams,XmppStropheStream)
+
+#include "strophe.h"
+namespace snikket{
+namespace streams{
+
+
+class HXCPP_CLASS_ATTRIBUTES XmppStropheStream_obj : public ::snikket::GenericStream_obj
+{
+ public:
+ typedef ::snikket::GenericStream_obj super;
+ typedef XmppStropheStream_obj OBJ_;
+ XmppStropheStream_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7e6ea620 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="snikket.streams.XmppStropheStream")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"snikket.streams.XmppStropheStream"); }
+ static ::hx::ObjectPtr< XmppStropheStream_obj > __new();
+ static ::hx::ObjectPtr< XmppStropheStream_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~XmppStropheStream_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("XmppStropheStream",da,d9,8d,8c); }
+
+ static int strophe_certfail_handler( const xmpp_tlscert_t* cert,const char* err);
+
+ static int strophe_stanza( xmpp_conn_t* conn, xmpp_stanza_t* sstanza,void* userdata);
+
+ static void strophe_connect( xmpp_conn_t* conn, xmpp_conn_event_t event,int error, xmpp_stream_error_t* stream_error,void* userdata);
+
+ static ::snikket::Stanza convertToStanza( xmpp_stanza_t* el,void* dummy);
+
+ ::haxe::ds::EnumValueMap iqHandlers;
+ ::Array< ::Dynamic> pending;
+ bool ready;
+ ::String newId();
+
+ void onIq( ::snikket::IqRequestType type,::String tag,::String xmlns, ::Dynamic handler);
+
+ void connect(::String jid,::Array< unsigned char > sm);
+
+ void disconnect();
+
+ void poll();
+ ::Dynamic poll_dyn();
+
+ xmpp_stanza_t* convertFromStanza( ::snikket::Stanza el);
+ ::Dynamic convertFromStanza_dyn();
+
+ void sendStanza( ::snikket::Stanza stanza);
+
+ void finalize();
+ ::Dynamic finalize_dyn();
+
+
+ private: xmpp_ctx_t *ctx;
+ private: xmpp_conn_t *conn;
+
+};
+
+} // end namespace snikket
+} // end namespace streams
+
+#endif /* INCLUDED_snikket_streams_XmppStropheStream */
diff --git a/Sources/c_snikket/iinclude/sys/FileSystem.h b/Sources/c_snikket/iinclude/sys/FileSystem.h
new file mode 100644
index 0000000..882325d
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/FileSystem.h
@@ -0,0 +1,75 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_FileSystem
+#define INCLUDED_sys_FileSystem
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(sys,FileSystem)
+
+namespace sys{
+
+
+class HXCPP_CLASS_ATTRIBUTES FileSystem_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef FileSystem_obj OBJ_;
+ FileSystem_obj();
+
+ public:
+ enum { _hx_ClassId = 0x2378c654 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="sys.FileSystem")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"sys.FileSystem"); }
+
+ inline static ::hx::ObjectPtr< FileSystem_obj > __new() {
+ ::hx::ObjectPtr< FileSystem_obj > __this = new FileSystem_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< FileSystem_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ FileSystem_obj *__this = (FileSystem_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(FileSystem_obj), false, "sys.FileSystem"));
+ *(void **)__this = FileSystem_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~FileSystem_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("FileSystem",ab,e2,17,ca); }
+
+ static bool exists(::String path);
+ static ::Dynamic exists_dyn();
+
+ static ::Dynamic stat(::String path);
+ static ::Dynamic stat_dyn();
+
+ static ::String fullPath(::String relPath);
+ static ::Dynamic fullPath_dyn();
+
+ static ::String absolutePath(::String relPath);
+ static ::Dynamic absolutePath_dyn();
+
+ static bool isDirectory(::String path);
+ static ::Dynamic isDirectory_dyn();
+
+ static void deleteFile(::String path);
+ static ::Dynamic deleteFile_dyn();
+
+};
+
+} // end namespace sys
+
+#endif /* INCLUDED_sys_FileSystem */
diff --git a/Sources/c_snikket/iinclude/sys/Http.h b/Sources/c_snikket/iinclude/sys/Http.h
new file mode 100644
index 0000000..42e3202
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/Http.h
@@ -0,0 +1,88 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_Http
+#define INCLUDED_sys_Http
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_http_HttpBase
+#include <haxe/http/HttpBase.h>
+#endif
+HX_DECLARE_CLASS0(EReg)
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,StringMap)
+HX_DECLARE_CLASS2(haxe,http,HttpBase)
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,BytesOutput)
+HX_DECLARE_CLASS2(haxe,io,Input)
+HX_DECLARE_CLASS2(haxe,io,Output)
+HX_DECLARE_CLASS1(sys,Http)
+HX_DECLARE_CLASS2(sys,net,Socket)
+
+namespace sys{
+
+
+class HXCPP_CLASS_ATTRIBUTES Http_obj : public ::haxe::http::HttpBase_obj
+{
+ public:
+ typedef ::haxe::http::HttpBase_obj super;
+ typedef Http_obj OBJ_;
+ Http_obj();
+
+ public:
+ enum { _hx_ClassId = 0x02924475 };
+
+ void __construct(::String url);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.Http")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.Http"); }
+ static ::hx::ObjectPtr< Http_obj > __new(::String url);
+ static ::hx::ObjectPtr< Http_obj > __alloc(::hx::Ctx *_hx_ctx,::String url);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Http_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Http",a8,c7,ef,2f); }
+
+ static void __boot();
+ static ::Dynamic PROXY;
+ bool noShutdown;
+ Float cnxTimeout;
+ ::haxe::ds::StringMap responseHeaders;
+ ::haxe::ds::StringMap responseHeadersSameKey;
+ ::Dynamic chunk_size;
+ ::haxe::io::Bytes chunk_buf;
+ ::Dynamic file;
+ void request( ::Dynamic post);
+ ::Dynamic request_dyn();
+
+ void customRequest(bool post, ::haxe::io::Output api, ::sys::net::Socket sock,::String method);
+ ::Dynamic customRequest_dyn();
+
+ void writeBody( ::haxe::io::BytesOutput body, ::haxe::io::Input fileInput,int fileSize,::String boundary, ::sys::net::Socket sock);
+ ::Dynamic writeBody_dyn();
+
+ void readHttpResponse( ::haxe::io::Output api, ::sys::net::Socket sock);
+ ::Dynamic readHttpResponse_dyn();
+
+ bool readChunk( ::EReg chunk_re, ::haxe::io::Output api, ::haxe::io::Bytes buf,int len);
+ ::Dynamic readChunk_dyn();
+
+};
+
+} // end namespace sys
+
+#endif /* INCLUDED_sys_Http */
diff --git a/Sources/c_snikket/iinclude/sys/db/Connection.h b/Sources/c_snikket/iinclude/sys/db/Connection.h
new file mode 100644
index 0000000..cf46b5f
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/db/Connection.h
@@ -0,0 +1,34 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_db_Connection
+#define INCLUDED_sys_db_Connection
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(sys,db,Connection)
+HX_DECLARE_CLASS2(sys,db,ResultSet)
+
+namespace sys{
+namespace db{
+
+
+class HXCPP_CLASS_ATTRIBUTES Connection_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ ::Dynamic (::hx::Object :: *_hx_request)(::String s);
+ static inline ::Dynamic request( ::Dynamic _hx_,::String s) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::sys::db::Connection_obj *>(_hx_.mPtr->_hx_getInterface(0x6e7a3d49)))->_hx_request)(s);
+ }
+ ::String (::hx::Object :: *_hx_quote)(::String s);
+ static inline ::String quote( ::Dynamic _hx_,::String s) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::sys::db::Connection_obj *>(_hx_.mPtr->_hx_getInterface(0x6e7a3d49)))->_hx_quote)(s);
+ }
+};
+
+} // end namespace sys
+} // end namespace db
+
+#endif /* INCLUDED_sys_db_Connection */
diff --git a/Sources/c_snikket/iinclude/sys/db/ResultSet.h b/Sources/c_snikket/iinclude/sys/db/ResultSet.h
new file mode 100644
index 0000000..6a8d3ca
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/db/ResultSet.h
@@ -0,0 +1,33 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_db_ResultSet
+#define INCLUDED_sys_db_ResultSet
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(sys,db,ResultSet)
+
+namespace sys{
+namespace db{
+
+
+class HXCPP_CLASS_ATTRIBUTES ResultSet_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ bool (::hx::Object :: *_hx_hasNext)();
+ static inline bool hasNext( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::sys::db::ResultSet_obj *>(_hx_.mPtr->_hx_getInterface(0xc11b83fa)))->_hx_hasNext)();
+ }
+ ::Dynamic (::hx::Object :: *_hx_next)();
+ static inline ::Dynamic next( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::sys::db::ResultSet_obj *>(_hx_.mPtr->_hx_getInterface(0xc11b83fa)))->_hx_next)();
+ }
+};
+
+} // end namespace sys
+} // end namespace db
+
+#endif /* INCLUDED_sys_db_ResultSet */
diff --git a/Sources/c_snikket/iinclude/sys/db/Sqlite.h b/Sources/c_snikket/iinclude/sys/db/Sqlite.h
new file mode 100644
index 0000000..ae8bcba
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/db/Sqlite.h
@@ -0,0 +1,63 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_db_Sqlite
+#define INCLUDED_sys_db_Sqlite
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(sys,db,Connection)
+HX_DECLARE_CLASS2(sys,db,Sqlite)
+
+namespace sys{
+namespace db{
+
+
+class HXCPP_CLASS_ATTRIBUTES Sqlite_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Sqlite_obj OBJ_;
+ Sqlite_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1fc648d3 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="sys.db.Sqlite")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"sys.db.Sqlite"); }
+
+ inline static ::hx::ObjectPtr< Sqlite_obj > __new() {
+ ::hx::ObjectPtr< Sqlite_obj > __this = new Sqlite_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Sqlite_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Sqlite_obj *__this = (Sqlite_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Sqlite_obj), false, "sys.db.Sqlite"));
+ *(void **)__this = Sqlite_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Sqlite_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Sqlite",ec,9c,99,87); }
+
+ static ::Dynamic open(::String file);
+ static ::Dynamic open_dyn();
+
+};
+
+} // end namespace sys
+} // end namespace db
+
+#endif /* INCLUDED_sys_db_Sqlite */
diff --git a/Sources/c_snikket/iinclude/sys/db/_Sqlite/SqliteConnection.h b/Sources/c_snikket/iinclude/sys/db/_Sqlite/SqliteConnection.h
new file mode 100644
index 0000000..7c154f8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/db/_Sqlite/SqliteConnection.h
@@ -0,0 +1,67 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_db__Sqlite_SqliteConnection
+#define INCLUDED_sys_db__Sqlite_SqliteConnection
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_sys_db_Connection
+#include <sys/db/Connection.h>
+#endif
+HX_DECLARE_CLASS2(sys,db,Connection)
+HX_DECLARE_CLASS2(sys,db,ResultSet)
+HX_DECLARE_CLASS3(sys,db,_Sqlite,SqliteConnection)
+
+namespace sys{
+namespace db{
+namespace _Sqlite{
+
+
+class HXCPP_CLASS_ATTRIBUTES SqliteConnection_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef SqliteConnection_obj OBJ_;
+ SqliteConnection_obj();
+
+ public:
+ enum { _hx_ClassId = 0x26edc0ae };
+
+ void __construct(::String file);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.db._Sqlite.SqliteConnection")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.db._Sqlite.SqliteConnection"); }
+ static ::hx::ObjectPtr< SqliteConnection_obj > __new(::String file);
+ static ::hx::ObjectPtr< SqliteConnection_obj > __alloc(::hx::Ctx *_hx_ctx,::String file);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SqliteConnection_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("SqliteConnection",2a,20,03,a3); }
+
+ ::Dynamic c;
+ ::Dynamic request(::String s);
+ ::Dynamic request_dyn();
+
+ ::String quote(::String s);
+ ::Dynamic quote_dyn();
+
+};
+
+} // end namespace sys
+} // end namespace db
+} // end namespace _Sqlite
+
+#endif /* INCLUDED_sys_db__Sqlite_SqliteConnection */
diff --git a/Sources/c_snikket/iinclude/sys/db/_Sqlite/SqliteResultSet.h b/Sources/c_snikket/iinclude/sys/db/_Sqlite/SqliteResultSet.h
new file mode 100644
index 0000000..3437f67
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/db/_Sqlite/SqliteResultSet.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_db__Sqlite_SqliteResultSet
+#define INCLUDED_sys_db__Sqlite_SqliteResultSet
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_sys_db_ResultSet
+#include <sys/db/ResultSet.h>
+#endif
+HX_DECLARE_CLASS2(haxe,ds,List)
+HX_DECLARE_CLASS2(sys,db,ResultSet)
+HX_DECLARE_CLASS3(sys,db,_Sqlite,SqliteResultSet)
+
+namespace sys{
+namespace db{
+namespace _Sqlite{
+
+
+class HXCPP_CLASS_ATTRIBUTES SqliteResultSet_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef SqliteResultSet_obj OBJ_;
+ SqliteResultSet_obj();
+
+ public:
+ enum { _hx_ClassId = 0x068aee19 };
+
+ void __construct( ::Dynamic r);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.db._Sqlite.SqliteResultSet")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.db._Sqlite.SqliteResultSet"); }
+ static ::hx::ObjectPtr< SqliteResultSet_obj > __new( ::Dynamic r);
+ static ::hx::ObjectPtr< SqliteResultSet_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic r);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SqliteResultSet_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("SqliteResultSet",39,58,4c,f7); }
+
+ ::Dynamic r;
+ ::haxe::ds::List cache;
+ bool hasNext();
+ ::Dynamic hasNext_dyn();
+
+ ::Dynamic next();
+ ::Dynamic next_dyn();
+
+};
+
+} // end namespace sys
+} // end namespace db
+} // end namespace _Sqlite
+
+#endif /* INCLUDED_sys_db__Sqlite_SqliteResultSet */
diff --git a/Sources/c_snikket/iinclude/sys/io/File.h b/Sources/c_snikket/iinclude/sys/io/File.h
new file mode 100644
index 0000000..11172d1
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/io/File.h
@@ -0,0 +1,73 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_io_File
+#define INCLUDED_sys_io_File
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,Input)
+HX_DECLARE_CLASS2(haxe,io,Output)
+HX_DECLARE_CLASS2(sys,io,File)
+HX_DECLARE_CLASS2(sys,io,FileInput)
+HX_DECLARE_CLASS2(sys,io,FileOutput)
+
+namespace sys{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES File_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef File_obj OBJ_;
+ File_obj();
+
+ public:
+ enum { _hx_ClassId = 0x645a6147 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="sys.io.File")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"sys.io.File"); }
+
+ inline static ::hx::ObjectPtr< File_obj > __new() {
+ ::hx::ObjectPtr< File_obj > __this = new File_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< File_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ File_obj *__this = (File_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(File_obj), false, "sys.io.File"));
+ *(void **)__this = File_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~File_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("File",9c,fa,94,2e); }
+
+ static void saveBytes(::String path, ::haxe::io::Bytes bytes);
+ static ::Dynamic saveBytes_dyn();
+
+ static ::sys::io::FileInput read(::String path,::hx::Null< bool > binary);
+ static ::Dynamic read_dyn();
+
+ static ::sys::io::FileOutput write(::String path,::hx::Null< bool > binary);
+ static ::Dynamic write_dyn();
+
+};
+
+} // end namespace sys
+} // end namespace io
+
+#endif /* INCLUDED_sys_io_File */
diff --git a/Sources/c_snikket/iinclude/sys/io/FileInput.h b/Sources/c_snikket/iinclude/sys/io/FileInput.h
new file mode 100644
index 0000000..8cd622d
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/io/FileInput.h
@@ -0,0 +1,64 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_io_FileInput
+#define INCLUDED_sys_io_FileInput
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_io_Input
+#include <haxe/io/Input.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,Input)
+HX_DECLARE_CLASS2(sys,io,FileInput)
+
+namespace sys{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES FileInput_obj : public ::haxe::io::Input_obj
+{
+ public:
+ typedef ::haxe::io::Input_obj super;
+ typedef FileInput_obj OBJ_;
+ FileInput_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1a1fbc7b };
+
+ void __construct( ::Dynamic f);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.io.FileInput")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.io.FileInput"); }
+ static ::hx::ObjectPtr< FileInput_obj > __new( ::Dynamic f);
+ static ::hx::ObjectPtr< FileInput_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic f);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~FileInput_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("FileInput",ce,43,18,62); }
+
+ ::Dynamic _hx___f;
+ int readByte();
+
+ int readBytes( ::haxe::io::Bytes s,int p,int l);
+
+ void close();
+
+};
+
+} // end namespace sys
+} // end namespace io
+
+#endif /* INCLUDED_sys_io_FileInput */
diff --git a/Sources/c_snikket/iinclude/sys/io/FileOutput.h b/Sources/c_snikket/iinclude/sys/io/FileOutput.h
new file mode 100644
index 0000000..9bcf940
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/io/FileOutput.h
@@ -0,0 +1,64 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_io_FileOutput
+#define INCLUDED_sys_io_FileOutput
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_io_Output
+#include <haxe/io/Output.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,Output)
+HX_DECLARE_CLASS2(sys,io,FileOutput)
+
+namespace sys{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES FileOutput_obj : public ::haxe::io::Output_obj
+{
+ public:
+ typedef ::haxe::io::Output_obj super;
+ typedef FileOutput_obj OBJ_;
+ FileOutput_obj();
+
+ public:
+ enum { _hx_ClassId = 0x32387970 };
+
+ void __construct( ::Dynamic f);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.io.FileOutput")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.io.FileOutput"); }
+ static ::hx::ObjectPtr< FileOutput_obj > __new( ::Dynamic f);
+ static ::hx::ObjectPtr< FileOutput_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic f);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~FileOutput_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("FileOutput",bd,5a,b6,e3); }
+
+ ::Dynamic _hx___f;
+ void writeByte(int c);
+
+ int writeBytes( ::haxe::io::Bytes s,int p,int l);
+
+ void close();
+
+};
+
+} // end namespace sys
+} // end namespace io
+
+#endif /* INCLUDED_sys_io_FileOutput */
diff --git a/Sources/c_snikket/iinclude/sys/io/Process.h b/Sources/c_snikket/iinclude/sys/io/Process.h
new file mode 100644
index 0000000..d4386c5
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/io/Process.h
@@ -0,0 +1,61 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_io_Process
+#define INCLUDED_sys_io_Process
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,io,Input)
+HX_DECLARE_CLASS2(haxe,io,Output)
+HX_DECLARE_CLASS2(sys,io,Process)
+
+namespace sys{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES Process_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Process_obj OBJ_;
+ Process_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7a155cb0 };
+
+ void __construct(::String cmd,::Array< ::String > args, ::Dynamic detached);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.io.Process")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.io.Process"); }
+ static ::hx::ObjectPtr< Process_obj > __new(::String cmd,::Array< ::String > args, ::Dynamic detached);
+ static ::hx::ObjectPtr< Process_obj > __alloc(::hx::Ctx *_hx_ctx,::String cmd,::Array< ::String > args, ::Dynamic detached);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Process_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Process",4f,ca,9b,be); }
+
+ ::Dynamic p;
+ ::haxe::io::Input _hx_stdout;
+ ::haxe::io::Input _hx_stderr;
+ ::haxe::io::Output _hx_stdin;
+ ::Dynamic exitCode(::hx::Null< bool > block);
+ ::Dynamic exitCode_dyn();
+
+};
+
+} // end namespace sys
+} // end namespace io
+
+#endif /* INCLUDED_sys_io_Process */
diff --git a/Sources/c_snikket/iinclude/sys/io/_Process/Stdin.h b/Sources/c_snikket/iinclude/sys/io/_Process/Stdin.h
new file mode 100644
index 0000000..473d06a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/io/_Process/Stdin.h
@@ -0,0 +1,67 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_io__Process_Stdin
+#define INCLUDED_sys_io__Process_Stdin
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_io_Output
+#include <haxe/io/Output.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,Output)
+HX_DECLARE_CLASS3(sys,io,_Process,Stdin)
+
+namespace sys{
+namespace io{
+namespace _Process{
+
+
+class HXCPP_CLASS_ATTRIBUTES Stdin_obj : public ::haxe::io::Output_obj
+{
+ public:
+ typedef ::haxe::io::Output_obj super;
+ typedef Stdin_obj OBJ_;
+ Stdin_obj();
+
+ public:
+ enum { _hx_ClassId = 0x037481cd };
+
+ void __construct( ::Dynamic p);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.io._Process.Stdin")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.io._Process.Stdin"); }
+ static ::hx::ObjectPtr< Stdin_obj > __new( ::Dynamic p);
+ static ::hx::ObjectPtr< Stdin_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic p);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Stdin_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Stdin",28,23,3b,17); }
+
+ ::Dynamic p;
+ ::haxe::io::Bytes buf;
+ void close();
+
+ void writeByte(int c);
+
+ int writeBytes( ::haxe::io::Bytes buf,int pos,int len);
+
+};
+
+} // end namespace sys
+} // end namespace io
+} // end namespace _Process
+
+#endif /* INCLUDED_sys_io__Process_Stdin */
diff --git a/Sources/c_snikket/iinclude/sys/io/_Process/Stdout.h b/Sources/c_snikket/iinclude/sys/io/_Process/Stdout.h
new file mode 100644
index 0000000..0533216
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/io/_Process/Stdout.h
@@ -0,0 +1,66 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_io__Process_Stdout
+#define INCLUDED_sys_io__Process_Stdout
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_io_Input
+#include <haxe/io/Input.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,Input)
+HX_DECLARE_CLASS3(sys,io,_Process,Stdout)
+
+namespace sys{
+namespace io{
+namespace _Process{
+
+
+class HXCPP_CLASS_ATTRIBUTES Stdout_obj : public ::haxe::io::Input_obj
+{
+ public:
+ typedef ::haxe::io::Input_obj super;
+ typedef Stdout_obj OBJ_;
+ Stdout_obj();
+
+ public:
+ enum { _hx_ClassId = 0x2316116e };
+
+ void __construct( ::Dynamic p,bool out);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.io._Process.Stdout")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.io._Process.Stdout"); }
+ static ::hx::ObjectPtr< Stdout_obj > __new( ::Dynamic p,bool out);
+ static ::hx::ObjectPtr< Stdout_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic p,bool out);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Stdout_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Stdout",eb,33,88,3c); }
+
+ ::Dynamic p;
+ bool out;
+ ::haxe::io::Bytes buf;
+ int readByte();
+
+ int readBytes( ::haxe::io::Bytes str,int pos,int len);
+
+};
+
+} // end namespace sys
+} // end namespace io
+} // end namespace _Process
+
+#endif /* INCLUDED_sys_io__Process_Stdout */
diff --git a/Sources/c_snikket/iinclude/sys/net/Host.h b/Sources/c_snikket/iinclude/sys/net/Host.h
new file mode 100644
index 0000000..0fe42fa
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/net/Host.h
@@ -0,0 +1,94 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_net_Host
+#define INCLUDED_sys_net_Host
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_87d3457c074e81a3_35_new)
+HX_DECLARE_CLASS2(sys,net,Host)
+
+namespace sys{
+namespace net{
+
+
+class HXCPP_CLASS_ATTRIBUTES Host_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Host_obj OBJ_;
+ Host_obj();
+
+ public:
+ enum { _hx_ClassId = 0x6c3d7e78 };
+
+ void __construct(::String name);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.net.Host")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.net.Host"); }
+
+ inline static ::hx::ObjectPtr< Host_obj > __new(::String name) {
+ ::hx::ObjectPtr< Host_obj > __this = new Host_obj();
+ __this->__construct(name);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Host_obj > __alloc(::hx::Ctx *_hx_ctx,::String name) {
+ Host_obj *__this = (Host_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Host_obj), true, "sys.net.Host"));
+ *(void **)__this = Host_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_87d3457c074e81a3_35_new)
+HXLINE( 36) ( ( ::sys::net::Host)(__this) )->host = name;
+HXLINE( 37) try {
+ HX_STACK_CATCHABLE( ::Dynamic, 0);
+HXLINE( 38) ( ( ::sys::net::Host)(__this) )->ip = _hx_std_host_resolve(name);
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::Dynamic >() ){
+ HX_STACK_BEGIN_CATCH
+ ::Dynamic _g = _hx_e;
+HXLINE( 39) {
+HXLINE( 39) null();
+ }
+HXLINE( 40) ( ( ::sys::net::Host)(__this) )->ipv6 = _hx_std_host_resolve_ipv6(name);
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Host_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ static void __init__();
+
+ ::String __ToString() const { return HX_("Host",88,fb,eb,2f); }
+
+ static void __boot();
+ ::String host;
+ int ip;
+ ::Array< unsigned char > ipv6;
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+};
+
+} // end namespace sys
+} // end namespace net
+
+#endif /* INCLUDED_sys_net_Host */
diff --git a/Sources/c_snikket/iinclude/sys/net/Socket.h b/Sources/c_snikket/iinclude/sys/net/Socket.h
new file mode 100644
index 0000000..c1426ac
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/net/Socket.h
@@ -0,0 +1,82 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_net_Socket
+#define INCLUDED_sys_net_Socket
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,io,Input)
+HX_DECLARE_CLASS2(haxe,io,Output)
+HX_DECLARE_CLASS2(sys,net,Host)
+HX_DECLARE_CLASS2(sys,net,Socket)
+
+namespace sys{
+namespace net{
+
+
+class HXCPP_CLASS_ATTRIBUTES Socket_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Socket_obj OBJ_;
+ Socket_obj();
+
+ public:
+ enum { _hx_ClassId = 0x70c71ec3 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.net.Socket")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.net.Socket"); }
+ static ::hx::ObjectPtr< Socket_obj > __new();
+ static ::hx::ObjectPtr< Socket_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Socket_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Socket",d3,ff,da,5a); }
+
+ ::Dynamic __s;
+ Float _hx___timeout;
+ bool _hx___blocking;
+ bool _hx___fastSend;
+ ::haxe::io::Input input;
+ ::haxe::io::Output output;
+ virtual void init();
+ ::Dynamic init_dyn();
+
+ virtual void close();
+ ::Dynamic close_dyn();
+
+ virtual void connect( ::sys::net::Host host,int port);
+ ::Dynamic connect_dyn();
+
+ void shutdown(bool read,bool write);
+ ::Dynamic shutdown_dyn();
+
+ void setTimeout(Float timeout);
+ ::Dynamic setTimeout_dyn();
+
+ void setBlocking(bool b);
+ ::Dynamic setBlocking_dyn();
+
+ void setFastSend(bool b);
+ ::Dynamic setFastSend_dyn();
+
+};
+
+} // end namespace sys
+} // end namespace net
+
+#endif /* INCLUDED_sys_net_Socket */
diff --git a/Sources/c_snikket/iinclude/sys/net/_Socket/SocketInput.h b/Sources/c_snikket/iinclude/sys/net/_Socket/SocketInput.h
new file mode 100644
index 0000000..7c6907c
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/net/_Socket/SocketInput.h
@@ -0,0 +1,66 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_net__Socket_SocketInput
+#define INCLUDED_sys_net__Socket_SocketInput
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_io_Input
+#include <haxe/io/Input.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,Input)
+HX_DECLARE_CLASS3(sys,net,_Socket,SocketInput)
+
+namespace sys{
+namespace net{
+namespace _Socket{
+
+
+class HXCPP_CLASS_ATTRIBUTES SocketInput_obj : public ::haxe::io::Input_obj
+{
+ public:
+ typedef ::haxe::io::Input_obj super;
+ typedef SocketInput_obj OBJ_;
+ SocketInput_obj();
+
+ public:
+ enum { _hx_ClassId = 0x342d0eb5 };
+
+ void __construct( ::Dynamic s);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.net._Socket.SocketInput")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.net._Socket.SocketInput"); }
+ static ::hx::ObjectPtr< SocketInput_obj > __new( ::Dynamic s);
+ static ::hx::ObjectPtr< SocketInput_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic s);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SocketInput_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("SocketInput",37,f7,80,be); }
+
+ ::Dynamic __s;
+ int readByte();
+
+ int readBytes( ::haxe::io::Bytes buf,int pos,int len);
+
+ void close();
+
+};
+
+} // end namespace sys
+} // end namespace net
+} // end namespace _Socket
+
+#endif /* INCLUDED_sys_net__Socket_SocketInput */
diff --git a/Sources/c_snikket/iinclude/sys/net/_Socket/SocketOutput.h b/Sources/c_snikket/iinclude/sys/net/_Socket/SocketOutput.h
new file mode 100644
index 0000000..2c685e5
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/net/_Socket/SocketOutput.h
@@ -0,0 +1,66 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_net__Socket_SocketOutput
+#define INCLUDED_sys_net__Socket_SocketOutput
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_io_Output
+#include <haxe/io/Output.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,Output)
+HX_DECLARE_CLASS3(sys,net,_Socket,SocketOutput)
+
+namespace sys{
+namespace net{
+namespace _Socket{
+
+
+class HXCPP_CLASS_ATTRIBUTES SocketOutput_obj : public ::haxe::io::Output_obj
+{
+ public:
+ typedef ::haxe::io::Output_obj super;
+ typedef SocketOutput_obj OBJ_;
+ SocketOutput_obj();
+
+ public:
+ enum { _hx_ClassId = 0x05556112 };
+
+ void __construct( ::Dynamic s);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.net._Socket.SocketOutput")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.net._Socket.SocketOutput"); }
+ static ::hx::ObjectPtr< SocketOutput_obj > __new( ::Dynamic s);
+ static ::hx::ObjectPtr< SocketOutput_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic s);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SocketOutput_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("SocketOutput",34,a3,ea,62); }
+
+ ::Dynamic __s;
+ void writeByte(int c);
+
+ int writeBytes( ::haxe::io::Bytes buf,int pos,int len);
+
+ void close();
+
+};
+
+} // end namespace sys
+} // end namespace net
+} // end namespace _Socket
+
+#endif /* INCLUDED_sys_net__Socket_SocketOutput */
diff --git a/Sources/c_snikket/iinclude/sys/ssl/Certificate.h b/Sources/c_snikket/iinclude/sys/ssl/Certificate.h
new file mode 100644
index 0000000..c0b6746
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/ssl/Certificate.h
@@ -0,0 +1,85 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_ssl_Certificate
+#define INCLUDED_sys_ssl_Certificate
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_15e02723fb84005c_33_new)
+HX_DECLARE_CLASS2(sys,ssl,Certificate)
+
+namespace sys{
+namespace ssl{
+
+
+class HXCPP_CLASS_ATTRIBUTES Certificate_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Certificate_obj OBJ_;
+ Certificate_obj();
+
+ public:
+ enum { _hx_ClassId = 0x205b2370 };
+
+ void __construct( ::Dynamic x, ::sys::ssl::Certificate h);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.ssl.Certificate")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.ssl.Certificate"); }
+
+ inline static ::hx::ObjectPtr< Certificate_obj > __new( ::Dynamic x, ::sys::ssl::Certificate h) {
+ ::hx::ObjectPtr< Certificate_obj > __this = new Certificate_obj();
+ __this->__construct(x,h);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Certificate_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic x, ::sys::ssl::Certificate h) {
+ Certificate_obj *__this = (Certificate_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Certificate_obj), true, "sys.ssl.Certificate"));
+ *(void **)__this = Certificate_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_15e02723fb84005c_33_new)
+HXLINE( 34) ( ( ::sys::ssl::Certificate)(__this) )->_hx___x = x;
+HXLINE( 35) ( ( ::sys::ssl::Certificate)(__this) )->_hx___h = h;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Certificate_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ static void __init__();
+
+ ::String __ToString() const { return HX_("Certificate",f7,60,75,ff); }
+
+ static void __boot();
+ static ::sys::ssl::Certificate loadFile(::String file);
+ static ::Dynamic loadFile_dyn();
+
+ static ::sys::ssl::Certificate loadPath(::String path);
+ static ::Dynamic loadPath_dyn();
+
+ static ::sys::ssl::Certificate loadDefaults();
+ static ::Dynamic loadDefaults_dyn();
+
+ ::sys::ssl::Certificate _hx___h;
+ ::Dynamic _hx___x;
+};
+
+} // end namespace sys
+} // end namespace ssl
+
+#endif /* INCLUDED_sys_ssl_Certificate */
diff --git a/Sources/c_snikket/iinclude/sys/ssl/Key.h b/Sources/c_snikket/iinclude/sys/ssl/Key.h
new file mode 100644
index 0000000..68e01fd
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/ssl/Key.h
@@ -0,0 +1,73 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_ssl_Key
+#define INCLUDED_sys_ssl_Key
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_360df8ce648879c1_34_new)
+HX_DECLARE_CLASS2(sys,ssl,Key)
+
+namespace sys{
+namespace ssl{
+
+
+class HXCPP_CLASS_ATTRIBUTES Key_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Key_obj OBJ_;
+ Key_obj();
+
+ public:
+ enum { _hx_ClassId = 0x6dab52dc };
+
+ void __construct( ::Dynamic k);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.ssl.Key")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.ssl.Key"); }
+
+ inline static ::hx::ObjectPtr< Key_obj > __new( ::Dynamic k) {
+ ::hx::ObjectPtr< Key_obj > __this = new Key_obj();
+ __this->__construct(k);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Key_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic k) {
+ Key_obj *__this = (Key_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Key_obj), true, "sys.ssl.Key"));
+ *(void **)__this = Key_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_360df8ce648879c1_34_new)
+HXDLIN( 34) ( ( ::sys::ssl::Key)(__this) )->_hx___k = k;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Key_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ static void __init__();
+
+ ::String __ToString() const { return HX_("Key",7f,41,39,00); }
+
+ static void __boot();
+ ::Dynamic _hx___k;
+};
+
+} // end namespace sys
+} // end namespace ssl
+
+#endif /* INCLUDED_sys_ssl_Key */
diff --git a/Sources/c_snikket/iinclude/sys/ssl/Socket.h b/Sources/c_snikket/iinclude/sys/ssl/Socket.h
new file mode 100644
index 0000000..97bacfe
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/ssl/Socket.h
@@ -0,0 +1,88 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_ssl_Socket
+#define INCLUDED_sys_ssl_Socket
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_sys_net_Socket
+#include <sys/net/Socket.h>
+#endif
+HX_DECLARE_CLASS2(sys,net,Host)
+HX_DECLARE_CLASS2(sys,net,Socket)
+HX_DECLARE_CLASS2(sys,ssl,Certificate)
+HX_DECLARE_CLASS2(sys,ssl,Key)
+HX_DECLARE_CLASS2(sys,ssl,Socket)
+
+namespace sys{
+namespace ssl{
+
+
+class HXCPP_CLASS_ATTRIBUTES Socket_obj : public ::sys::net::Socket_obj
+{
+ public:
+ typedef ::sys::net::Socket_obj super;
+ typedef Socket_obj OBJ_;
+ Socket_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7a492a0e };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.ssl.Socket")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.ssl.Socket"); }
+ static ::hx::ObjectPtr< Socket_obj > __new();
+ static ::hx::ObjectPtr< Socket_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Socket_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ static void __init__();
+
+ ::String __ToString() const { return HX_("Socket",d3,ff,da,5a); }
+
+ static void __boot();
+ static ::Dynamic DEFAULT_VERIFY_CERT;
+ static ::sys::ssl::Certificate DEFAULT_CA;
+ ::Dynamic conf;
+ ::Dynamic ssl;
+ ::Dynamic verifyCert;
+ ::sys::ssl::Certificate caCert;
+ ::String hostname;
+ ::sys::ssl::Certificate ownCert;
+ ::sys::ssl::Key ownKey;
+ ::Array< ::Dynamic> altSNIContexts;
+ ::Dynamic sniCallback;
+ bool handshakeDone;
+ void init();
+
+ void connect( ::sys::net::Host host,int port);
+
+ void handshake();
+ ::Dynamic handshake_dyn();
+
+ void close();
+
+ ::Dynamic buildSSLConfig(bool server);
+ ::Dynamic buildSSLConfig_dyn();
+
+};
+
+} // end namespace sys
+} // end namespace ssl
+
+#endif /* INCLUDED_sys_ssl_Socket */
diff --git a/Sources/c_snikket/iinclude/sys/ssl/_Socket/SocketInput.h b/Sources/c_snikket/iinclude/sys/ssl/_Socket/SocketInput.h
new file mode 100644
index 0000000..7fa83ba
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/ssl/_Socket/SocketInput.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_ssl__Socket_SocketInput
+#define INCLUDED_sys_ssl__Socket_SocketInput
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_io_Input
+#include <haxe/io/Input.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,Input)
+HX_DECLARE_CLASS2(sys,net,Socket)
+HX_DECLARE_CLASS2(sys,ssl,Socket)
+HX_DECLARE_CLASS3(sys,ssl,_Socket,SocketInput)
+
+namespace sys{
+namespace ssl{
+namespace _Socket{
+
+
+class HXCPP_CLASS_ATTRIBUTES SocketInput_obj : public ::haxe::io::Input_obj
+{
+ public:
+ typedef ::haxe::io::Input_obj super;
+ typedef SocketInput_obj OBJ_;
+ SocketInput_obj();
+
+ public:
+ enum { _hx_ClassId = 0x5d27522c };
+
+ void __construct( ::sys::ssl::Socket s);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.ssl._Socket.SocketInput")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.ssl._Socket.SocketInput"); }
+ static ::hx::ObjectPtr< SocketInput_obj > __new( ::sys::ssl::Socket s);
+ static ::hx::ObjectPtr< SocketInput_obj > __alloc(::hx::Ctx *_hx_ctx, ::sys::ssl::Socket s);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SocketInput_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("SocketInput",37,f7,80,be); }
+
+ ::sys::ssl::Socket __s;
+ int readByte();
+
+ int readBytes( ::haxe::io::Bytes buf,int pos,int len);
+
+ void close();
+
+};
+
+} // end namespace sys
+} // end namespace ssl
+} // end namespace _Socket
+
+#endif /* INCLUDED_sys_ssl__Socket_SocketInput */
diff --git a/Sources/c_snikket/iinclude/sys/ssl/_Socket/SocketOutput.h b/Sources/c_snikket/iinclude/sys/ssl/_Socket/SocketOutput.h
new file mode 100644
index 0000000..6282196
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/ssl/_Socket/SocketOutput.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_ssl__Socket_SocketOutput
+#define INCLUDED_sys_ssl__Socket_SocketOutput
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_io_Output
+#include <haxe/io/Output.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,Output)
+HX_DECLARE_CLASS2(sys,net,Socket)
+HX_DECLARE_CLASS2(sys,ssl,Socket)
+HX_DECLARE_CLASS3(sys,ssl,_Socket,SocketOutput)
+
+namespace sys{
+namespace ssl{
+namespace _Socket{
+
+
+class HXCPP_CLASS_ATTRIBUTES SocketOutput_obj : public ::haxe::io::Output_obj
+{
+ public:
+ typedef ::haxe::io::Output_obj super;
+ typedef SocketOutput_obj OBJ_;
+ SocketOutput_obj();
+
+ public:
+ enum { _hx_ClassId = 0x52cf5067 };
+
+ void __construct( ::sys::ssl::Socket s);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.ssl._Socket.SocketOutput")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.ssl._Socket.SocketOutput"); }
+ static ::hx::ObjectPtr< SocketOutput_obj > __new( ::sys::ssl::Socket s);
+ static ::hx::ObjectPtr< SocketOutput_obj > __alloc(::hx::Ctx *_hx_ctx, ::sys::ssl::Socket s);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SocketOutput_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("SocketOutput",34,a3,ea,62); }
+
+ ::sys::ssl::Socket __s;
+ void writeByte(int c);
+
+ int writeBytes( ::haxe::io::Bytes buf,int pos,int len);
+
+ void close();
+
+};
+
+} // end namespace sys
+} // end namespace ssl
+} // end namespace _Socket
+
+#endif /* INCLUDED_sys_ssl__Socket_SocketOutput */
diff --git a/Sources/c_snikket/iinclude/sys/thread/EventLoop.h b/Sources/c_snikket/iinclude/sys/thread/EventLoop.h
new file mode 100644
index 0000000..e5d0fee
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/thread/EventLoop.h
@@ -0,0 +1,80 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_thread_EventLoop
+#define INCLUDED_sys_thread_EventLoop
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(sys,thread,EventLoop)
+HX_DECLARE_CLASS2(sys,thread,Lock)
+HX_DECLARE_CLASS2(sys,thread,Mutex)
+HX_DECLARE_CLASS3(sys,thread,_EventLoop,RegularEvent)
+
+namespace sys{
+namespace thread{
+
+
+class HXCPP_CLASS_ATTRIBUTES EventLoop_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef EventLoop_obj OBJ_;
+ EventLoop_obj();
+
+ public:
+ enum { _hx_ClassId = 0x6a581147 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.thread.EventLoop")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.thread.EventLoop"); }
+ static ::hx::ObjectPtr< EventLoop_obj > __new();
+ static ::hx::ObjectPtr< EventLoop_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~EventLoop_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("EventLoop",7e,8f,97,98); }
+
+ static bool CREATED;
+ ::sys::thread::Mutex mutex;
+ ::Array< ::Dynamic> oneTimeEvents;
+ int oneTimeEventsIdx;
+ ::sys::thread::Lock waitLock;
+ int promisedEventsCount;
+ ::sys::thread::_EventLoop::RegularEvent regularEvents;
+ bool isMainThread;
+ ::sys::thread::_EventLoop::RegularEvent repeat( ::Dynamic event,int intervalMs);
+ ::Dynamic repeat_dyn();
+
+ void cancel( ::sys::thread::_EventLoop::RegularEvent eventHandler);
+ ::Dynamic cancel_dyn();
+
+ void run( ::Dynamic event);
+ ::Dynamic run_dyn();
+
+ bool wait( ::Dynamic timeout);
+ ::Dynamic wait_dyn();
+
+ void loop();
+ ::Dynamic loop_dyn();
+
+};
+
+} // end namespace sys
+} // end namespace thread
+
+#endif /* INCLUDED_sys_thread_EventLoop */
diff --git a/Sources/c_snikket/iinclude/sys/thread/Lock.h b/Sources/c_snikket/iinclude/sys/thread/Lock.h
new file mode 100644
index 0000000..b08cb6e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/thread/Lock.h
@@ -0,0 +1,76 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_thread_Lock
+#define INCLUDED_sys_thread_Lock
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_c256ff93ff467723_30_new)
+HX_DECLARE_CLASS2(sys,thread,Lock)
+
+namespace sys{
+namespace thread{
+
+
+class HXCPP_CLASS_ATTRIBUTES Lock_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Lock_obj OBJ_;
+ Lock_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7fa5e9e6 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.thread.Lock")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.thread.Lock"); }
+
+ inline static ::hx::ObjectPtr< Lock_obj > __new() {
+ ::hx::ObjectPtr< Lock_obj > __this = new Lock_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Lock_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Lock_obj *__this = (Lock_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Lock_obj), true, "sys.thread.Lock"));
+ *(void **)__this = Lock_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_c256ff93ff467723_30_new)
+HXDLIN( 30) ( ( ::sys::thread::Lock)(__this) )->l = ::__hxcpp_lock_create();
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Lock_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Lock",0b,c8,90,32); }
+
+ ::Dynamic l;
+ bool wait( ::Dynamic timeout);
+ ::Dynamic wait_dyn();
+
+ void release();
+ ::Dynamic release_dyn();
+
+};
+
+} // end namespace sys
+} // end namespace thread
+
+#endif /* INCLUDED_sys_thread_Lock */
diff --git a/Sources/c_snikket/iinclude/sys/thread/Mutex.h b/Sources/c_snikket/iinclude/sys/thread/Mutex.h
new file mode 100644
index 0000000..7dcf304
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/thread/Mutex.h
@@ -0,0 +1,76 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_thread_Mutex
+#define INCLUDED_sys_thread_Mutex
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_2ef35e640612cac3_30_new)
+HX_DECLARE_CLASS2(sys,thread,Mutex)
+
+namespace sys{
+namespace thread{
+
+
+class HXCPP_CLASS_ATTRIBUTES Mutex_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Mutex_obj OBJ_;
+ Mutex_obj();
+
+ public:
+ enum { _hx_ClassId = 0x5474b30c };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.thread.Mutex")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.thread.Mutex"); }
+
+ inline static ::hx::ObjectPtr< Mutex_obj > __new() {
+ ::hx::ObjectPtr< Mutex_obj > __this = new Mutex_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Mutex_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Mutex_obj *__this = (Mutex_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Mutex_obj), true, "sys.thread.Mutex"));
+ *(void **)__this = Mutex_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_2ef35e640612cac3_30_new)
+HXDLIN( 30) ( ( ::sys::thread::Mutex)(__this) )->m = ::__hxcpp_mutex_create();
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Mutex_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Mutex",5f,ff,88,a3); }
+
+ ::Dynamic m;
+ void acquire();
+ ::Dynamic acquire_dyn();
+
+ void release();
+ ::Dynamic release_dyn();
+
+};
+
+} // end namespace sys
+} // end namespace thread
+
+#endif /* INCLUDED_sys_thread_Mutex */
diff --git a/Sources/c_snikket/iinclude/sys/thread/NoEventLoopException.h b/Sources/c_snikket/iinclude/sys/thread/NoEventLoopException.h
new file mode 100644
index 0000000..836f0ff
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/thread/NoEventLoopException.h
@@ -0,0 +1,70 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_thread_NoEventLoopException
+#define INCLUDED_sys_thread_NoEventLoopException
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_haxe_Exception
+#include <haxe/Exception.h>
+#endif
+HX_DECLARE_STACK_FRAME(_hx_pos_c0f6a7d563b0a42e_7_new)
+HX_DECLARE_CLASS1(haxe,Exception)
+HX_DECLARE_CLASS2(sys,thread,NoEventLoopException)
+
+namespace sys{
+namespace thread{
+
+
+class HXCPP_CLASS_ATTRIBUTES NoEventLoopException_obj : public ::haxe::Exception_obj
+{
+ public:
+ typedef ::haxe::Exception_obj super;
+ typedef NoEventLoopException_obj OBJ_;
+ NoEventLoopException_obj();
+
+ public:
+ enum { _hx_ClassId = 0x00a9e885 };
+
+ void __construct(::String __o_msg, ::haxe::Exception previous);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.thread.NoEventLoopException")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.thread.NoEventLoopException"); }
+
+ inline static ::hx::ObjectPtr< NoEventLoopException_obj > __new(::String __o_msg, ::haxe::Exception previous) {
+ ::hx::ObjectPtr< NoEventLoopException_obj > __this = new NoEventLoopException_obj();
+ __this->__construct(__o_msg,previous);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< NoEventLoopException_obj > __alloc(::hx::Ctx *_hx_ctx,::String __o_msg, ::haxe::Exception previous) {
+ NoEventLoopException_obj *__this = (NoEventLoopException_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(NoEventLoopException_obj), true, "sys.thread.NoEventLoopException"));
+ *(void **)__this = NoEventLoopException_obj::_hx_vtable;
+{
+ ::String msg = __o_msg;
+ if (::hx::IsNull(__o_msg)) msg = HX_("Event loop is not available. Refer to sys.thread.Thread.runWithEventLoop.",89,e6,4c,1c);
+ HX_STACKFRAME(&_hx_pos_c0f6a7d563b0a42e_7_new)
+HXDLIN( 7) __this->super::__construct(msg,previous,null());
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~NoEventLoopException_obj();
+
+ HX_DO_RTTI_ALL;
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("NoEventLoopException",92,71,e8,a8); }
+
+};
+
+} // end namespace sys
+} // end namespace thread
+
+#endif /* INCLUDED_sys_thread_NoEventLoopException */
diff --git a/Sources/c_snikket/iinclude/sys/thread/_EventLoop/RegularEvent.h b/Sources/c_snikket/iinclude/sys/thread/_EventLoop/RegularEvent.h
new file mode 100644
index 0000000..e91ddab
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/thread/_EventLoop/RegularEvent.h
@@ -0,0 +1,81 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_thread__EventLoop_RegularEvent
+#define INCLUDED_sys_thread__EventLoop_RegularEvent
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_692c76051dac6459_278_new)
+HX_DECLARE_CLASS3(sys,thread,_EventLoop,RegularEvent)
+
+namespace sys{
+namespace thread{
+namespace _EventLoop{
+
+
+class HXCPP_CLASS_ATTRIBUTES RegularEvent_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef RegularEvent_obj OBJ_;
+ RegularEvent_obj();
+
+ public:
+ enum { _hx_ClassId = 0x13f58728 };
+
+ void __construct( ::Dynamic run,Float nextRunTime,Float interval);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.thread._EventLoop.RegularEvent")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.thread._EventLoop.RegularEvent"); }
+
+ inline static ::hx::ObjectPtr< RegularEvent_obj > __new( ::Dynamic run,Float nextRunTime,Float interval) {
+ ::hx::ObjectPtr< RegularEvent_obj > __this = new RegularEvent_obj();
+ __this->__construct(run,nextRunTime,interval);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< RegularEvent_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic run,Float nextRunTime,Float interval) {
+ RegularEvent_obj *__this = (RegularEvent_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(RegularEvent_obj), true, "sys.thread._EventLoop.RegularEvent"));
+ *(void **)__this = RegularEvent_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_692c76051dac6459_278_new)
+HXLINE( 284) ( ( ::sys::thread::_EventLoop::RegularEvent)(__this) )->cancelled = false;
+HXLINE( 287) ( ( ::sys::thread::_EventLoop::RegularEvent)(__this) )->run = run;
+HXLINE( 288) ( ( ::sys::thread::_EventLoop::RegularEvent)(__this) )->nextRunTime = nextRunTime;
+HXLINE( 289) ( ( ::sys::thread::_EventLoop::RegularEvent)(__this) )->interval = interval;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~RegularEvent_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("RegularEvent",3e,24,e8,2d); }
+
+ Float nextRunTime;
+ Float interval;
+ ::Dynamic run;
+ Dynamic run_dyn() { return run;}
+ ::sys::thread::_EventLoop::RegularEvent next;
+ ::sys::thread::_EventLoop::RegularEvent previous;
+ bool cancelled;
+};
+
+} // end namespace sys
+} // end namespace thread
+} // end namespace _EventLoop
+
+#endif /* INCLUDED_sys_thread__EventLoop_RegularEvent */
diff --git a/Sources/c_snikket/iinclude/sys/thread/_Thread/HaxeThread.h b/Sources/c_snikket/iinclude/sys/thread/_Thread/HaxeThread.h
new file mode 100644
index 0000000..80f44f1
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/thread/_Thread/HaxeThread.h
@@ -0,0 +1,76 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_thread__Thread_HaxeThread
+#define INCLUDED_sys_thread__Thread_HaxeThread
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(sys,thread,EventLoop)
+HX_DECLARE_CLASS2(sys,thread,Mutex)
+HX_DECLARE_CLASS3(sys,thread,_Thread,HaxeThread)
+
+namespace sys{
+namespace thread{
+namespace _Thread{
+
+
+class HXCPP_CLASS_ATTRIBUTES HaxeThread_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef HaxeThread_obj OBJ_;
+ HaxeThread_obj();
+
+ public:
+ enum { _hx_ClassId = 0x72cf0b82 };
+
+ void __construct( ::Dynamic h);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="sys.thread._Thread.HaxeThread")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"sys.thread._Thread.HaxeThread"); }
+ static ::hx::ObjectPtr< HaxeThread_obj > __new( ::Dynamic h);
+ static ::hx::ObjectPtr< HaxeThread_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic h);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~HaxeThread_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ static void __init__();
+
+ ::String __ToString() const { return HX_("HaxeThread",b0,c7,55,fd); }
+
+ static void __boot();
+ static ::Array< ::Dynamic> threads;
+ static ::sys::thread::Mutex threadsMutex;
+ static ::Dynamic mainThreadHandle;
+ static ::sys::thread::_Thread::HaxeThread mainThread;
+ static ::sys::thread::_Thread::HaxeThread current();
+ static ::Dynamic current_dyn();
+
+ static ::sys::thread::_Thread::HaxeThread create( ::Dynamic job,bool withEventLoop);
+ static ::Dynamic create_dyn();
+
+ static void dropThread( ::Dynamic item,int probableIndex);
+ static ::Dynamic dropThread_dyn();
+
+ ::sys::thread::EventLoop events;
+ ::Dynamic handle;
+};
+
+} // end namespace sys
+} // end namespace thread
+} // end namespace _Thread
+
+#endif /* INCLUDED_sys_thread__Thread_HaxeThread */
diff --git a/Sources/c_snikket/iinclude/sys/thread/_Thread/Thread_Impl_.h b/Sources/c_snikket/iinclude/sys/thread/_Thread/Thread_Impl_.h
new file mode 100644
index 0000000..1d125c1
--- /dev/null
+++ b/Sources/c_snikket/iinclude/sys/thread/_Thread/Thread_Impl_.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_sys_thread__Thread_Thread_Impl_
+#define INCLUDED_sys_thread__Thread_Thread_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(sys,thread,EventLoop)
+HX_DECLARE_CLASS3(sys,thread,_Thread,HaxeThread)
+HX_DECLARE_CLASS3(sys,thread,_Thread,Thread_Impl_)
+
+namespace sys{
+namespace thread{
+namespace _Thread{
+
+
+class HXCPP_CLASS_ATTRIBUTES Thread_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Thread_Impl__obj OBJ_;
+ Thread_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x3097b824 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="sys.thread._Thread.Thread_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"sys.thread._Thread.Thread_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Thread_Impl__obj > __new() {
+ ::hx::ObjectPtr< Thread_Impl__obj > __this = new Thread_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Thread_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Thread_Impl__obj *__this = (Thread_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Thread_Impl__obj), false, "sys.thread._Thread.Thread_Impl_"));
+ *(void **)__this = Thread_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Thread_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Thread_Impl_",0a,37,9c,fe); }
+
+ static ::sys::thread::EventLoop get_events( ::sys::thread::_Thread::HaxeThread this1);
+ static ::Dynamic get_events_dyn();
+
+ static void processEvents();
+ static ::Dynamic processEvents_dyn();
+
+};
+
+} // end namespace sys
+} // end namespace thread
+} // end namespace _Thread
+
+#endif /* INCLUDED_sys_thread__Thread_Thread_Impl_ */
diff --git a/Sources/c_snikket/iinclude/thenshim/PromiseFactory.h b/Sources/c_snikket/iinclude/thenshim/PromiseFactory.h
new file mode 100644
index 0000000..1fd53c5
--- /dev/null
+++ b/Sources/c_snikket/iinclude/thenshim/PromiseFactory.h
@@ -0,0 +1,36 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_thenshim_PromiseFactory
+#define INCLUDED_thenshim_PromiseFactory
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(thenshim,PromiseFactory)
+HX_DECLARE_CLASS1(thenshim,Thenable)
+
+namespace thenshim{
+
+
+class HXCPP_CLASS_ATTRIBUTES PromiseFactory_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ ::Dynamic (::hx::Object :: *_hx_make)( ::Dynamic executor);
+ static inline ::Dynamic make( ::Dynamic _hx_, ::Dynamic executor) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::thenshim::PromiseFactory_obj *>(_hx_.mPtr->_hx_getInterface(0x93a35865)))->_hx_make)(executor);
+ }
+ ::Dynamic (::hx::Object :: *_hx_asResolved)( ::Dynamic object);
+ static inline ::Dynamic asResolved( ::Dynamic _hx_, ::Dynamic object) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::thenshim::PromiseFactory_obj *>(_hx_.mPtr->_hx_getInterface(0x93a35865)))->_hx_asResolved)(object);
+ }
+ ::Dynamic (::hx::Object :: *_hx_asRejected)( ::Dynamic reason);
+ static inline ::Dynamic asRejected( ::Dynamic _hx_, ::Dynamic reason) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::thenshim::PromiseFactory_obj *>(_hx_.mPtr->_hx_getInterface(0x93a35865)))->_hx_asRejected)(reason);
+ }
+};
+
+} // end namespace thenshim
+
+#endif /* INCLUDED_thenshim_PromiseFactory */
diff --git a/Sources/c_snikket/iinclude/thenshim/PromiseTools.h b/Sources/c_snikket/iinclude/thenshim/PromiseTools.h
new file mode 100644
index 0000000..f854535
--- /dev/null
+++ b/Sources/c_snikket/iinclude/thenshim/PromiseTools.h
@@ -0,0 +1,64 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_thenshim_PromiseTools
+#define INCLUDED_thenshim_PromiseTools
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(thenshim,PromiseTools)
+HX_DECLARE_CLASS1(thenshim,Thenable)
+
+namespace thenshim{
+
+
+class HXCPP_CLASS_ATTRIBUTES PromiseTools_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef PromiseTools_obj OBJ_;
+ PromiseTools_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1873701a };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="thenshim.PromiseTools")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"thenshim.PromiseTools"); }
+
+ inline static ::hx::ObjectPtr< PromiseTools_obj > __new() {
+ ::hx::ObjectPtr< PromiseTools_obj > __this = new PromiseTools_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< PromiseTools_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ PromiseTools_obj *__this = (PromiseTools_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(PromiseTools_obj), false, "thenshim.PromiseTools"));
+ *(void **)__this = PromiseTools_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~PromiseTools_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("PromiseTools",a0,4e,2e,4d); }
+
+ static ::Dynamic all( ::Dynamic promises);
+ static ::Dynamic all_dyn();
+
+ static ::Dynamic catch_(::Dynamic promise, ::Dynamic onRejected);
+ static ::Dynamic catch__dyn();
+
+};
+
+} // end namespace thenshim
+
+#endif /* INCLUDED_thenshim_PromiseTools */
diff --git a/Sources/c_snikket/iinclude/thenshim/Thenable.h b/Sources/c_snikket/iinclude/thenshim/Thenable.h
new file mode 100644
index 0000000..66c521e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/thenshim/Thenable.h
@@ -0,0 +1,27 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_thenshim_Thenable
+#define INCLUDED_thenshim_Thenable
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(thenshim,Thenable)
+
+namespace thenshim{
+
+
+class HXCPP_CLASS_ATTRIBUTES Thenable_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ ::Dynamic (::hx::Object :: *_hx_then)( ::Dynamic onFulfilled, ::Dynamic onRejected);
+ static inline ::Dynamic then( ::Dynamic _hx_, ::Dynamic onFulfilled, ::Dynamic onRejected) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::thenshim::Thenable_obj *>(_hx_.mPtr->_hx_getInterface(0xc019ce6d)))->_hx_then)(onFulfilled,onRejected);
+ }
+};
+
+} // end namespace thenshim
+
+#endif /* INCLUDED_thenshim_Thenable */
diff --git a/Sources/c_snikket/iinclude/thenshim/_Promise/Promise_Impl_.h b/Sources/c_snikket/iinclude/thenshim/_Promise/Promise_Impl_.h
new file mode 100644
index 0000000..266087a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/thenshim/_Promise/Promise_Impl_.h
@@ -0,0 +1,75 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_thenshim__Promise_Promise_Impl_
+#define INCLUDED_thenshim__Promise_Promise_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(thenshim,PromiseFactory)
+HX_DECLARE_CLASS1(thenshim,Thenable)
+HX_DECLARE_CLASS2(thenshim,_Promise,Promise_Impl_)
+
+namespace thenshim{
+namespace _Promise{
+
+
+class HXCPP_CLASS_ATTRIBUTES Promise_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Promise_Impl__obj OBJ_;
+ Promise_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x048c0501 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="thenshim._Promise.Promise_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"thenshim._Promise.Promise_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Promise_Impl__obj > __new() {
+ ::hx::ObjectPtr< Promise_Impl__obj > __this = new Promise_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Promise_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Promise_Impl__obj *__this = (Promise_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Promise_Impl__obj), false, "thenshim._Promise.Promise_Impl_"));
+ *(void **)__this = Promise_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Promise_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Promise_Impl_",5b,00,ba,be); }
+
+ static void __boot();
+ static ::Dynamic factory;
+ static ::Dynamic _new( ::Dynamic executor);
+ static ::Dynamic _new_dyn();
+
+ static ::Dynamic resolve( ::Dynamic object);
+ static ::Dynamic resolve_dyn();
+
+ static ::Dynamic reject( ::Dynamic reason);
+ static ::Dynamic reject_dyn();
+
+ static ::Dynamic then(::Dynamic this1, ::Dynamic onFulfilled, ::Dynamic onRejected);
+ static ::Dynamic then_dyn();
+
+};
+
+} // end namespace thenshim
+} // end namespace _Promise
+
+#endif /* INCLUDED_thenshim__Promise_Promise_Impl_ */
diff --git a/Sources/c_snikket/iinclude/thenshim/fallback/FallbackPromise.h b/Sources/c_snikket/iinclude/thenshim/fallback/FallbackPromise.h
new file mode 100644
index 0000000..21e2936
--- /dev/null
+++ b/Sources/c_snikket/iinclude/thenshim/fallback/FallbackPromise.h
@@ -0,0 +1,77 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_thenshim_fallback_FallbackPromise
+#define INCLUDED_thenshim_fallback_FallbackPromise
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_thenshim_Thenable
+#include <thenshim/Thenable.h>
+#endif
+HX_DECLARE_CLASS1(thenshim,Thenable)
+HX_DECLARE_CLASS2(thenshim,fallback,FallbackPromise)
+HX_DECLARE_CLASS2(thenshim,fallback,HandlerSession)
+HX_DECLARE_CLASS2(thenshim,fallback,PromiseState)
+HX_DECLARE_CLASS2(thenshim,fallback,TaskScheduler)
+
+namespace thenshim{
+namespace fallback{
+
+
+class HXCPP_CLASS_ATTRIBUTES FallbackPromise_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef FallbackPromise_obj OBJ_;
+ FallbackPromise_obj();
+
+ public:
+ enum { _hx_ClassId = 0x6da4d981 };
+
+ void __construct( ::thenshim::fallback::TaskScheduler scheduler);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="thenshim.fallback.FallbackPromise")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"thenshim.fallback.FallbackPromise"); }
+ static ::hx::ObjectPtr< FallbackPromise_obj > __new( ::thenshim::fallback::TaskScheduler scheduler);
+ static ::hx::ObjectPtr< FallbackPromise_obj > __alloc(::hx::Ctx *_hx_ctx, ::thenshim::fallback::TaskScheduler scheduler);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~FallbackPromise_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("FallbackPromise",79,35,7a,1c); }
+
+ ::thenshim::fallback::TaskScheduler scheduler;
+ ::thenshim::fallback::PromiseState state;
+ ::Dynamic value;
+ ::Dynamic reason;
+ ::Array< ::Dynamic> sessions;
+ ::Dynamic then( ::Dynamic onFulfilled, ::Dynamic onRejected);
+ ::Dynamic then_dyn();
+
+ ::thenshim::fallback::FallbackPromise thenImpl( ::Dynamic onFulfilled, ::Dynamic onRejected);
+ ::Dynamic thenImpl_dyn();
+
+ void resolve( ::Dynamic value);
+ ::Dynamic resolve_dyn();
+
+ void reject( ::Dynamic reason);
+ ::Dynamic reject_dyn();
+
+};
+
+} // end namespace thenshim
+} // end namespace fallback
+
+#endif /* INCLUDED_thenshim_fallback_FallbackPromise */
diff --git a/Sources/c_snikket/iinclude/thenshim/fallback/FallbackPromiseFactory.h b/Sources/c_snikket/iinclude/thenshim/fallback/FallbackPromiseFactory.h
new file mode 100644
index 0000000..ecfa490
--- /dev/null
+++ b/Sources/c_snikket/iinclude/thenshim/fallback/FallbackPromiseFactory.h
@@ -0,0 +1,75 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_thenshim_fallback_FallbackPromiseFactory
+#define INCLUDED_thenshim_fallback_FallbackPromiseFactory
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_thenshim_PromiseFactory
+#include <thenshim/PromiseFactory.h>
+#endif
+HX_DECLARE_CLASS1(thenshim,PromiseFactory)
+HX_DECLARE_CLASS1(thenshim,Thenable)
+HX_DECLARE_CLASS2(thenshim,fallback,FallbackPromiseFactory)
+HX_DECLARE_CLASS2(thenshim,fallback,TaskScheduler)
+
+namespace thenshim{
+namespace fallback{
+
+
+class HXCPP_CLASS_ATTRIBUTES FallbackPromiseFactory_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef FallbackPromiseFactory_obj OBJ_;
+ FallbackPromiseFactory_obj();
+
+ public:
+ enum { _hx_ClassId = 0x592d0d49 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="thenshim.fallback.FallbackPromiseFactory")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"thenshim.fallback.FallbackPromiseFactory"); }
+ static ::hx::ObjectPtr< FallbackPromiseFactory_obj > __new();
+ static ::hx::ObjectPtr< FallbackPromiseFactory_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~FallbackPromiseFactory_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("FallbackPromiseFactory",51,a0,67,b6); }
+
+ ::thenshim::fallback::TaskScheduler scheduler;
+ ::Dynamic make( ::Dynamic executor);
+ ::Dynamic make_dyn();
+
+ ::Dynamic asResolved( ::Dynamic object);
+ ::Dynamic asResolved_dyn();
+
+ ::Dynamic asResolvedThenable(::Dynamic thenable);
+ ::Dynamic asResolvedThenable_dyn();
+
+ ::Dynamic asResolvedThenProperty( ::Dynamic object);
+ ::Dynamic asResolvedThenProperty_dyn();
+
+ ::Dynamic asRejected( ::Dynamic reason);
+ ::Dynamic asRejected_dyn();
+
+};
+
+} // end namespace thenshim
+} // end namespace fallback
+
+#endif /* INCLUDED_thenshim_fallback_FallbackPromiseFactory */
diff --git a/Sources/c_snikket/iinclude/thenshim/fallback/HandlerSession.h b/Sources/c_snikket/iinclude/thenshim/fallback/HandlerSession.h
new file mode 100644
index 0000000..c9dc287
--- /dev/null
+++ b/Sources/c_snikket/iinclude/thenshim/fallback/HandlerSession.h
@@ -0,0 +1,84 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_thenshim_fallback_HandlerSession
+#define INCLUDED_thenshim_fallback_HandlerSession
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(thenshim,Thenable)
+HX_DECLARE_CLASS2(thenshim,fallback,FallbackPromise)
+HX_DECLARE_CLASS2(thenshim,fallback,HandlerSession)
+HX_DECLARE_CLASS2(thenshim,fallback,TaskScheduler)
+
+namespace thenshim{
+namespace fallback{
+
+
+class HXCPP_CLASS_ATTRIBUTES HandlerSession_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef HandlerSession_obj OBJ_;
+ HandlerSession_obj();
+
+ public:
+ enum { _hx_ClassId = 0x30baea8c };
+
+ void __construct( ::thenshim::fallback::TaskScheduler scheduler, ::Dynamic fulfilledCallback, ::Dynamic rejectedCallback);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="thenshim.fallback.HandlerSession")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"thenshim.fallback.HandlerSession"); }
+ static ::hx::ObjectPtr< HandlerSession_obj > __new( ::thenshim::fallback::TaskScheduler scheduler, ::Dynamic fulfilledCallback, ::Dynamic rejectedCallback);
+ static ::hx::ObjectPtr< HandlerSession_obj > __alloc(::hx::Ctx *_hx_ctx, ::thenshim::fallback::TaskScheduler scheduler, ::Dynamic fulfilledCallback, ::Dynamic rejectedCallback);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~HandlerSession_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("HandlerSession",cc,10,db,f7); }
+
+ static void resolvePromise( ::thenshim::fallback::FallbackPromise promise, ::Dynamic value);
+ static ::Dynamic resolvePromise_dyn();
+
+ static bool rejectIfSame( ::thenshim::fallback::FallbackPromise promise, ::Dynamic value);
+ static ::Dynamic rejectIfSame_dyn();
+
+ static void resolvePromiseThenable( ::thenshim::fallback::FallbackPromise promise,::Dynamic thenable);
+ static ::Dynamic resolvePromiseThenable_dyn();
+
+ static void resolvePromiseObject( ::thenshim::fallback::FallbackPromise promise, ::Dynamic object);
+ static ::Dynamic resolvePromiseObject_dyn();
+
+ ::thenshim::fallback::FallbackPromise promise;
+ ::thenshim::fallback::TaskScheduler scheduler;
+ ::Dynamic fulfilledCallback;
+ ::Dynamic rejectedCallback;
+ void resolve( ::Dynamic value);
+ ::Dynamic resolve_dyn();
+
+ void resolveImpl( ::Dynamic value);
+ ::Dynamic resolveImpl_dyn();
+
+ void reject( ::Dynamic reason);
+ ::Dynamic reject_dyn();
+
+ void rejectImpl( ::Dynamic reason);
+ ::Dynamic rejectImpl_dyn();
+
+};
+
+} // end namespace thenshim
+} // end namespace fallback
+
+#endif /* INCLUDED_thenshim_fallback_HandlerSession */
diff --git a/Sources/c_snikket/iinclude/thenshim/fallback/PromiseState.h b/Sources/c_snikket/iinclude/thenshim/fallback/PromiseState.h
new file mode 100644
index 0000000..7e84191
--- /dev/null
+++ b/Sources/c_snikket/iinclude/thenshim/fallback/PromiseState.h
@@ -0,0 +1,39 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_thenshim_fallback_PromiseState
+#define INCLUDED_thenshim_fallback_PromiseState
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(thenshim,fallback,PromiseState)
+namespace thenshim{
+namespace fallback{
+
+
+class PromiseState_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef PromiseState_obj OBJ_;
+
+ public:
+ PromiseState_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("thenshim.fallback.PromiseState",0a,45,f3,26); }
+ ::String __ToString() const { return HX_("PromiseState.",d8,10,c1,ac) + _hx_tag; }
+
+ static ::thenshim::fallback::PromiseState Fulfilled;
+ static inline ::thenshim::fallback::PromiseState Fulfilled_dyn() { return Fulfilled; }
+ static ::thenshim::fallback::PromiseState Pending;
+ static inline ::thenshim::fallback::PromiseState Pending_dyn() { return Pending; }
+ static ::thenshim::fallback::PromiseState Rejected;
+ static inline ::thenshim::fallback::PromiseState Rejected_dyn() { return Rejected; }
+};
+
+} // end namespace thenshim
+} // end namespace fallback
+
+#endif /* INCLUDED_thenshim_fallback_PromiseState */
diff --git a/Sources/c_snikket/iinclude/thenshim/fallback/TaskScheduler.h b/Sources/c_snikket/iinclude/thenshim/fallback/TaskScheduler.h
new file mode 100644
index 0000000..ba47ed8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/thenshim/fallback/TaskScheduler.h
@@ -0,0 +1,72 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_thenshim_fallback_TaskScheduler
+#define INCLUDED_thenshim_fallback_TaskScheduler
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_8fc69505e32be3f2_11_new)
+HX_DECLARE_CLASS2(thenshim,fallback,TaskScheduler)
+
+namespace thenshim{
+namespace fallback{
+
+
+class HXCPP_CLASS_ATTRIBUTES TaskScheduler_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef TaskScheduler_obj OBJ_;
+ TaskScheduler_obj();
+
+ public:
+ enum { _hx_ClassId = 0x23747a3a };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="thenshim.fallback.TaskScheduler")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"thenshim.fallback.TaskScheduler"); }
+
+ inline static ::hx::ObjectPtr< TaskScheduler_obj > __new() {
+ ::hx::ObjectPtr< TaskScheduler_obj > __this = new TaskScheduler_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< TaskScheduler_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ TaskScheduler_obj *__this = (TaskScheduler_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(TaskScheduler_obj), true, "thenshim.fallback.TaskScheduler"));
+ *(void **)__this = TaskScheduler_obj::_hx_vtable;
+ thenshim::fallback::TaskScheduler_obj::__alloc_dynamic_functions(_hx_ctx,__this);
+{
+ HX_STACKFRAME(&_hx_pos_8fc69505e32be3f2_11_new)
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ static void __alloc_dynamic_functions(::hx::Ctx *_hx_alloc,TaskScheduler_obj *_hx_obj);
+ //~TaskScheduler_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("TaskScheduler",16,22,01,bb); }
+
+ ::Dynamic addNext;
+ inline ::Dynamic &addNext_dyn() {return addNext; }
+
+};
+
+} // end namespace thenshim
+} // end namespace fallback
+
+#endif /* INCLUDED_thenshim_fallback_TaskScheduler */
diff --git a/Sources/c_snikket/iinclude/tink/_Chunk/Chunk_Impl_.h b/Sources/c_snikket/iinclude/tink/_Chunk/Chunk_Impl_.h
new file mode 100644
index 0000000..567282c
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/_Chunk/Chunk_Impl_.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink__Chunk_Chunk_Impl_
+#define INCLUDED_tink__Chunk_Chunk_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,_Chunk,Chunk_Impl_)
+HX_DECLARE_CLASS2(tink,chunk,ChunkObject)
+
+namespace tink{
+namespace _Chunk{
+
+
+class HXCPP_CLASS_ATTRIBUTES Chunk_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Chunk_Impl__obj OBJ_;
+ Chunk_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x3bb70ded };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink._Chunk.Chunk_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink._Chunk.Chunk_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Chunk_Impl__obj > __new() {
+ ::hx::ObjectPtr< Chunk_Impl__obj > __this = new Chunk_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Chunk_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Chunk_Impl__obj *__this = (Chunk_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Chunk_Impl__obj), false, "tink._Chunk.Chunk_Impl_"));
+ *(void **)__this = Chunk_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Chunk_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Chunk_Impl_",ad,aa,7a,82); }
+
+ static void __boot();
+ static ::Dynamic concat(::Dynamic this1,::Dynamic that);
+ static ::Dynamic concat_dyn();
+
+ static ::Dynamic join(::Array< ::Dynamic> chunks);
+ static ::Dynamic join_dyn();
+
+ static ::Dynamic EMPTY;
+};
+
+} // end namespace tink
+} // end namespace _Chunk
+
+#endif /* INCLUDED_tink__Chunk_Chunk_Impl_ */
diff --git a/Sources/c_snikket/iinclude/tink/_Chunk/EmptyChunk.h b/Sources/c_snikket/iinclude/tink/_Chunk/EmptyChunk.h
new file mode 100644
index 0000000..b66b362
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/_Chunk/EmptyChunk.h
@@ -0,0 +1,77 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink__Chunk_EmptyChunk
+#define INCLUDED_tink__Chunk_EmptyChunk
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_chunk_ChunkBase
+#include <tink/chunk/ChunkBase.h>
+#endif
+#ifndef INCLUDED_tink_chunk_ChunkObject
+#include <tink/chunk/ChunkObject.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(tink,_Chunk,EmptyChunk)
+HX_DECLARE_CLASS2(tink,chunk,ChunkBase)
+HX_DECLARE_CLASS2(tink,chunk,ChunkObject)
+
+namespace tink{
+namespace _Chunk{
+
+
+class HXCPP_CLASS_ATTRIBUTES EmptyChunk_obj : public ::tink::chunk::ChunkBase_obj
+{
+ public:
+ typedef ::tink::chunk::ChunkBase_obj super;
+ typedef EmptyChunk_obj OBJ_;
+ EmptyChunk_obj();
+
+ public:
+ enum { _hx_ClassId = 0x01566580 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink._Chunk.EmptyChunk")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink._Chunk.EmptyChunk"); }
+ static ::hx::ObjectPtr< EmptyChunk_obj > __new();
+ static ::hx::ObjectPtr< EmptyChunk_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~EmptyChunk_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("EmptyChunk",c0,a0,c6,bc); }
+
+ static void __boot();
+ static ::haxe::io::Bytes EMPTY;
+ int getLength();
+ ::Dynamic getLength_dyn();
+
+ ::Dynamic slice(int from,int to);
+ ::Dynamic slice_dyn();
+
+ void blitTo( ::haxe::io::Bytes target,int offset);
+ ::Dynamic blitTo_dyn();
+
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+ ::haxe::io::Bytes toBytes();
+ ::Dynamic toBytes_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace _Chunk
+
+#endif /* INCLUDED_tink__Chunk_EmptyChunk */
diff --git a/Sources/c_snikket/iinclude/tink/_Url/Url_Impl_.h b/Sources/c_snikket/iinclude/tink/_Url/Url_Impl_.h
new file mode 100644
index 0000000..954edfb
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/_Url/Url_Impl_.h
@@ -0,0 +1,80 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink__Url_Url_Impl_
+#define INCLUDED_tink__Url_Url_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,_Url,Url_Impl_)
+
+namespace tink{
+namespace _Url{
+
+
+class HXCPP_CLASS_ATTRIBUTES Url_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Url_Impl__obj OBJ_;
+ Url_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x142a69a5 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink._Url.Url_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink._Url.Url_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Url_Impl__obj > __new() {
+ ::hx::ObjectPtr< Url_Impl__obj > __this = new Url_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Url_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Url_Impl__obj *__this = (Url_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Url_Impl__obj), false, "tink._Url.Url_Impl_"));
+ *(void **)__this = Url_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Url_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Url_Impl_",2f,05,36,5a); }
+
+ static ::Dynamic resolve( ::Dynamic this1, ::Dynamic that);
+ static ::Dynamic resolve_dyn();
+
+ static void makePayload( ::Dynamic parts);
+ static ::Dynamic makePayload_dyn();
+
+ static ::String toString( ::Dynamic this1);
+ static ::Dynamic toString_dyn();
+
+ static ::Dynamic fromString(::String s);
+ static ::Dynamic fromString_dyn();
+
+ static void noop(::String _);
+ static ::Dynamic noop_dyn();
+
+ static ::Dynamic parse(::String s, ::Dynamic onError);
+ static ::Dynamic parse_dyn();
+
+ static ::Dynamic make( ::Dynamic parts);
+ static ::Dynamic make_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace _Url
+
+#endif /* INCLUDED_tink__Url_Url_Impl_ */
diff --git a/Sources/c_snikket/iinclude/tink/chunk/ByteChunk.h b/Sources/c_snikket/iinclude/tink/chunk/ByteChunk.h
new file mode 100644
index 0000000..6fa0b79
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/chunk/ByteChunk.h
@@ -0,0 +1,90 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_chunk_ByteChunk
+#define INCLUDED_tink_chunk_ByteChunk
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_chunk_ChunkBase
+#include <tink/chunk/ChunkBase.h>
+#endif
+#ifndef INCLUDED_tink_chunk_ChunkObject
+#include <tink/chunk/ChunkObject.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(tink,chunk,ByteChunk)
+HX_DECLARE_CLASS2(tink,chunk,ChunkBase)
+HX_DECLARE_CLASS2(tink,chunk,ChunkObject)
+
+namespace tink{
+namespace chunk{
+
+
+class HXCPP_CLASS_ATTRIBUTES ByteChunk_obj : public ::tink::chunk::ChunkBase_obj
+{
+ public:
+ typedef ::tink::chunk::ChunkBase_obj super;
+ typedef ByteChunk_obj OBJ_;
+ ByteChunk_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1854896e };
+
+ void __construct(::Array< unsigned char > data,int from,int to);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.chunk.ByteChunk")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.chunk.ByteChunk"); }
+ static ::hx::ObjectPtr< ByteChunk_obj > __new(::Array< unsigned char > data,int from,int to);
+ static ::hx::ObjectPtr< ByteChunk_obj > __alloc(::hx::Ctx *_hx_ctx,::Array< unsigned char > data,int from,int to);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ByteChunk_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("ByteChunk",25,7a,ca,7d); }
+
+ static ::Dynamic of( ::haxe::io::Bytes b);
+ static ::Dynamic of_dyn();
+
+ ::Array< unsigned char > data;
+ int from;
+ int to;
+ ::haxe::io::Bytes wrapped;
+ void flatten(::Array< ::Dynamic> into);
+
+ int getLength();
+ ::Dynamic getLength_dyn();
+
+ ::tink::chunk::ByteChunk getSlice(int from,int to);
+ ::Dynamic getSlice_dyn();
+
+ ::Dynamic slice(int from,int to);
+ ::Dynamic slice_dyn();
+
+ void blitTo( ::haxe::io::Bytes target,int offset);
+ ::Dynamic blitTo_dyn();
+
+ ::haxe::io::Bytes toBytes();
+ ::Dynamic toBytes_dyn();
+
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace chunk
+
+#endif /* INCLUDED_tink_chunk_ByteChunk */
diff --git a/Sources/c_snikket/iinclude/tink/chunk/ChunkBase.h b/Sources/c_snikket/iinclude/tink/chunk/ChunkBase.h
new file mode 100644
index 0000000..f4af2f3
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/chunk/ChunkBase.h
@@ -0,0 +1,73 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_chunk_ChunkBase
+#define INCLUDED_tink_chunk_ChunkBase
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,chunk,ByteChunk)
+HX_DECLARE_CLASS2(tink,chunk,ChunkBase)
+HX_DECLARE_CLASS2(tink,chunk,ChunkCursor)
+HX_DECLARE_CLASS2(tink,chunk,ChunkObject)
+
+namespace tink{
+namespace chunk{
+
+
+class HXCPP_CLASS_ATTRIBUTES ChunkBase_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef ChunkBase_obj OBJ_;
+ ChunkBase_obj();
+
+ public:
+ enum { _hx_ClassId = 0x49bef7e3 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.chunk.ChunkBase")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.chunk.ChunkBase"); }
+
+ inline static ::hx::ObjectPtr< ChunkBase_obj > __new() {
+ ::hx::ObjectPtr< ChunkBase_obj > __this = new ChunkBase_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< ChunkBase_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ ChunkBase_obj *__this = (ChunkBase_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(ChunkBase_obj), true, "tink.chunk.ChunkBase"));
+ *(void **)__this = ChunkBase_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ChunkBase_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("ChunkBase",fe,f4,07,36); }
+
+ ::Array< ::Dynamic> flattened;
+ ::tink::chunk::ChunkCursor getCursor();
+ ::Dynamic getCursor_dyn();
+
+ virtual void flatten(::Array< ::Dynamic> into);
+ ::Dynamic flatten_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace chunk
+
+#endif /* INCLUDED_tink_chunk_ChunkBase */
diff --git a/Sources/c_snikket/iinclude/tink/chunk/ChunkCursor.h b/Sources/c_snikket/iinclude/tink/chunk/ChunkCursor.h
new file mode 100644
index 0000000..338a1b0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/chunk/ChunkCursor.h
@@ -0,0 +1,91 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_chunk_ChunkCursor
+#define INCLUDED_tink_chunk_ChunkCursor
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,chunk,ByteChunk)
+HX_DECLARE_CLASS2(tink,chunk,ChunkBase)
+HX_DECLARE_CLASS2(tink,chunk,ChunkCursor)
+HX_DECLARE_CLASS2(tink,chunk,ChunkObject)
+
+namespace tink{
+namespace chunk{
+
+
+class HXCPP_CLASS_ATTRIBUTES ChunkCursor_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef ChunkCursor_obj OBJ_;
+ ChunkCursor_obj();
+
+ public:
+ enum { _hx_ClassId = 0x5b17b728 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.chunk.ChunkCursor")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.chunk.ChunkCursor"); }
+ static ::hx::ObjectPtr< ChunkCursor_obj > __new();
+ static ::hx::ObjectPtr< ChunkCursor_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ChunkCursor_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("ChunkCursor",03,71,6e,a9); }
+
+ static ::tink::chunk::ChunkCursor create(::Array< ::Dynamic> parts);
+ static ::Dynamic create_dyn();
+
+ ::Array< ::Dynamic> parts;
+ ::tink::chunk::ByteChunk curPart;
+ int curPartIndex;
+ int curOffset;
+ int curLength;
+ int length;
+ int currentPos;
+ int currentByte;
+ void reset();
+ ::Dynamic reset_dyn();
+
+ ::Dynamic flush();
+ ::Dynamic flush_dyn();
+
+ void add(::Dynamic chunk);
+ ::Dynamic add_dyn();
+
+ void shift(::Dynamic chunk);
+ ::Dynamic shift_dyn();
+
+ ::Dynamic left();
+ ::Dynamic left_dyn();
+
+ ::Dynamic right();
+ ::Dynamic right_dyn();
+
+ void ffwd();
+ ::Dynamic ffwd_dyn();
+
+ bool next();
+ ::Dynamic next_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace chunk
+
+#endif /* INCLUDED_tink_chunk_ChunkCursor */
diff --git a/Sources/c_snikket/iinclude/tink/chunk/ChunkObject.h b/Sources/c_snikket/iinclude/tink/chunk/ChunkObject.h
new file mode 100644
index 0000000..7a4d920
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/chunk/ChunkObject.h
@@ -0,0 +1,57 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_chunk_ChunkObject
+#define INCLUDED_tink_chunk_ChunkObject
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(tink,chunk,ByteChunk)
+HX_DECLARE_CLASS2(tink,chunk,ChunkBase)
+HX_DECLARE_CLASS2(tink,chunk,ChunkCursor)
+HX_DECLARE_CLASS2(tink,chunk,ChunkObject)
+
+namespace tink{
+namespace chunk{
+
+
+class HXCPP_CLASS_ATTRIBUTES ChunkObject_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ ::tink::chunk::ChunkCursor (::hx::Object :: *_hx_getCursor)();
+ static inline ::tink::chunk::ChunkCursor getCursor( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::chunk::ChunkObject_obj *>(_hx_.mPtr->_hx_getInterface(0x027c3451)))->_hx_getCursor)();
+ }
+ void (::hx::Object :: *_hx_flatten)(::Array< ::Dynamic> into);
+ static inline void flatten( ::Dynamic _hx_,::Array< ::Dynamic> into) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::tink::chunk::ChunkObject_obj *>(_hx_.mPtr->_hx_getInterface(0x027c3451)))->_hx_flatten)(into);
+ }
+ int (::hx::Object :: *_hx_getLength)();
+ static inline int getLength( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::chunk::ChunkObject_obj *>(_hx_.mPtr->_hx_getInterface(0x027c3451)))->_hx_getLength)();
+ }
+ ::Dynamic (::hx::Object :: *_hx_slice)(int from,int to);
+ static inline ::Dynamic slice( ::Dynamic _hx_,int from,int to) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::chunk::ChunkObject_obj *>(_hx_.mPtr->_hx_getInterface(0x027c3451)))->_hx_slice)(from,to);
+ }
+ ::String (::hx::Object :: *_hx_toString)();
+ static inline ::String toString( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::chunk::ChunkObject_obj *>(_hx_.mPtr->_hx_getInterface(0x027c3451)))->_hx_toString)();
+ }
+ ::haxe::io::Bytes (::hx::Object :: *_hx_toBytes)();
+ static inline ::haxe::io::Bytes toBytes( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::chunk::ChunkObject_obj *>(_hx_.mPtr->_hx_getInterface(0x027c3451)))->_hx_toBytes)();
+ }
+ void (::hx::Object :: *_hx_blitTo)( ::haxe::io::Bytes target,int offset);
+ static inline void blitTo( ::Dynamic _hx_, ::haxe::io::Bytes target,int offset) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::tink::chunk::ChunkObject_obj *>(_hx_.mPtr->_hx_getInterface(0x027c3451)))->_hx_blitTo)(target,offset);
+ }
+};
+
+} // end namespace tink
+} // end namespace chunk
+
+#endif /* INCLUDED_tink_chunk_ChunkObject */
diff --git a/Sources/c_snikket/iinclude/tink/chunk/CompoundChunk.h b/Sources/c_snikket/iinclude/tink/chunk/CompoundChunk.h
new file mode 100644
index 0000000..661f924
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/chunk/CompoundChunk.h
@@ -0,0 +1,97 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_chunk_CompoundChunk
+#define INCLUDED_tink_chunk_CompoundChunk
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_chunk_ChunkBase
+#include <tink/chunk/ChunkBase.h>
+#endif
+#ifndef INCLUDED_tink_chunk_ChunkObject
+#include <tink/chunk/ChunkObject.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(tink,chunk,ByteChunk)
+HX_DECLARE_CLASS2(tink,chunk,ChunkBase)
+HX_DECLARE_CLASS2(tink,chunk,ChunkObject)
+HX_DECLARE_CLASS2(tink,chunk,CompoundChunk)
+
+namespace tink{
+namespace chunk{
+
+
+class HXCPP_CLASS_ATTRIBUTES CompoundChunk_obj : public ::tink::chunk::ChunkBase_obj
+{
+ public:
+ typedef ::tink::chunk::ChunkBase_obj super;
+ typedef CompoundChunk_obj OBJ_;
+ CompoundChunk_obj();
+
+ public:
+ enum { _hx_ClassId = 0x73605847 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.chunk.CompoundChunk")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.chunk.CompoundChunk"); }
+ static ::hx::ObjectPtr< CompoundChunk_obj > __new();
+ static ::hx::ObjectPtr< CompoundChunk_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~CompoundChunk_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("CompoundChunk",e2,7e,3d,10); }
+
+ static ::tink::chunk::CompoundChunk asCompound(::Dynamic c);
+ static ::Dynamic asCompound_dyn();
+
+ static ::Dynamic cons(::Dynamic a,::Dynamic b);
+ static ::Dynamic cons_dyn();
+
+ static ::tink::chunk::CompoundChunk create(::Array< ::Dynamic> chunks,int depth);
+ static ::Dynamic create_dyn();
+
+ ::Array< ::Dynamic> chunks;
+ ::Array< int > offsets;
+ int length;
+ int depth;
+ int getLength();
+ ::Dynamic getLength_dyn();
+
+ int findChunk(int target);
+ ::Dynamic findChunk_dyn();
+
+ void flatten(::Array< ::Dynamic> into);
+
+ ::Dynamic slice(int from,int to);
+ ::Dynamic slice_dyn();
+
+ void blitTo( ::haxe::io::Bytes target,int offset);
+ ::Dynamic blitTo_dyn();
+
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+ ::haxe::io::Bytes toBytes();
+ ::Dynamic toBytes_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace chunk
+
+#endif /* INCLUDED_tink_chunk_CompoundChunk */
diff --git a/Sources/c_snikket/iinclude/tink/core/CallbackLinkRef.h b/Sources/c_snikket/iinclude/tink/core/CallbackLinkRef.h
new file mode 100644
index 0000000..fb645e0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/core/CallbackLinkRef.h
@@ -0,0 +1,61 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core_CallbackLinkRef
+#define INCLUDED_tink_core_CallbackLinkRef
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_core_LinkObject
+#include <tink/core/LinkObject.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,CallbackLinkRef)
+HX_DECLARE_CLASS2(tink,core,LinkObject)
+
+namespace tink{
+namespace core{
+
+
+class HXCPP_CLASS_ATTRIBUTES CallbackLinkRef_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef CallbackLinkRef_obj OBJ_;
+ CallbackLinkRef_obj();
+
+ public:
+ enum { _hx_ClassId = 0x2af492e3 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.core.CallbackLinkRef")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.core.CallbackLinkRef"); }
+ static ::hx::ObjectPtr< CallbackLinkRef_obj > __new();
+ static ::hx::ObjectPtr< CallbackLinkRef_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~CallbackLinkRef_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("CallbackLinkRef",14,ba,30,89); }
+
+ ::Dynamic link;
+ void cancel();
+ ::Dynamic cancel_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace core
+
+#endif /* INCLUDED_tink_core_CallbackLinkRef */
diff --git a/Sources/c_snikket/iinclude/tink/core/CallbackList.h b/Sources/c_snikket/iinclude/tink/core/CallbackList.h
new file mode 100644
index 0000000..903c88f
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/core/CallbackList.h
@@ -0,0 +1,81 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core_CallbackList
+#define INCLUDED_tink_core_CallbackList
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_core_SimpleDisposable
+#include <tink/core/SimpleDisposable.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,CallbackList)
+HX_DECLARE_CLASS2(tink,core,Disposable)
+HX_DECLARE_CLASS2(tink,core,LinkObject)
+HX_DECLARE_CLASS2(tink,core,OwnedDisposable)
+HX_DECLARE_CLASS2(tink,core,SimpleDisposable)
+HX_DECLARE_CLASS3(tink,core,_Callback,ListCell)
+
+namespace tink{
+namespace core{
+
+
+class HXCPP_CLASS_ATTRIBUTES CallbackList_obj : public ::tink::core::SimpleDisposable_obj
+{
+ public:
+ typedef ::tink::core::SimpleDisposable_obj super;
+ typedef CallbackList_obj OBJ_;
+ CallbackList_obj();
+
+ public:
+ enum { _hx_ClassId = 0x12a8ef7c };
+
+ void __construct(::hx::Null< bool > __o_destructive);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.core.CallbackList")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.core.CallbackList"); }
+ static ::hx::ObjectPtr< CallbackList_obj > __new(::hx::Null< bool > __o_destructive);
+ static ::hx::ObjectPtr< CallbackList_obj > __alloc(::hx::Ctx *_hx_ctx,::hx::Null< bool > __o_destructive);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~CallbackList_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("CallbackList",e3,f4,55,31); }
+
+ bool destructive;
+ ::Array< ::Dynamic> cells;
+ int used;
+ ::Array< ::Dynamic> queue;
+ bool busy;
+ ::Dynamic ondrain;
+ Dynamic ondrain_dyn() { return ondrain;}
+ ::Dynamic onfill;
+ Dynamic onfill_dyn() { return onfill;}
+ void destroy();
+ ::Dynamic destroy_dyn();
+
+ void invoke( ::Dynamic data);
+ ::Dynamic invoke_dyn();
+
+ void compact();
+ ::Dynamic compact_dyn();
+
+ void resize(int length);
+ ::Dynamic resize_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace core
+
+#endif /* INCLUDED_tink_core_CallbackList */
diff --git a/Sources/c_snikket/iinclude/tink/core/Disposable.h b/Sources/c_snikket/iinclude/tink/core/Disposable.h
new file mode 100644
index 0000000..bd2c459
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/core/Disposable.h
@@ -0,0 +1,25 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core_Disposable
+#define INCLUDED_tink_core_Disposable
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,Disposable)
+
+namespace tink{
+namespace core{
+
+
+class HXCPP_CLASS_ATTRIBUTES Disposable_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+};
+
+} // end namespace tink
+} // end namespace core
+
+#endif /* INCLUDED_tink_core_Disposable */
diff --git a/Sources/c_snikket/iinclude/tink/core/FutureStatus.h b/Sources/c_snikket/iinclude/tink/core/FutureStatus.h
new file mode 100644
index 0000000..f046dc9
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/core/FutureStatus.h
@@ -0,0 +1,45 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core_FutureStatus
+#define INCLUDED_tink_core_FutureStatus
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,FutureStatus)
+HX_DECLARE_CLASS3(tink,core,_Lazy,Computable)
+HX_DECLARE_CLASS3(tink,core,_Lazy,LazyObject)
+namespace tink{
+namespace core{
+
+
+class FutureStatus_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef FutureStatus_obj OBJ_;
+
+ public:
+ FutureStatus_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.core.FutureStatus",e8,d1,b4,f2); }
+ ::String __ToString() const { return HX_("FutureStatus.",99,22,18,ea) + _hx_tag; }
+
+ static ::tink::core::FutureStatus Awaited;
+ static inline ::tink::core::FutureStatus Awaited_dyn() { return Awaited; }
+ static ::tink::core::FutureStatus EagerlyAwaited;
+ static inline ::tink::core::FutureStatus EagerlyAwaited_dyn() { return EagerlyAwaited; }
+ static ::tink::core::FutureStatus NeverEver;
+ static inline ::tink::core::FutureStatus NeverEver_dyn() { return NeverEver; }
+ static ::tink::core::FutureStatus Ready(::Dynamic result);
+ static ::Dynamic Ready_dyn();
+ static ::tink::core::FutureStatus Suspended;
+ static inline ::tink::core::FutureStatus Suspended_dyn() { return Suspended; }
+};
+
+} // end namespace tink
+} // end namespace core
+
+#endif /* INCLUDED_tink_core_FutureStatus */
diff --git a/Sources/c_snikket/iinclude/tink/core/LinkObject.h b/Sources/c_snikket/iinclude/tink/core/LinkObject.h
new file mode 100644
index 0000000..8ad85f0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/core/LinkObject.h
@@ -0,0 +1,29 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core_LinkObject
+#define INCLUDED_tink_core_LinkObject
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,LinkObject)
+
+namespace tink{
+namespace core{
+
+
+class HXCPP_CLASS_ATTRIBUTES LinkObject_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ void (::hx::Object :: *_hx_cancel)();
+ static inline void cancel( ::Dynamic _hx_) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::tink::core::LinkObject_obj *>(_hx_.mPtr->_hx_getInterface(0x0d15dd4a)))->_hx_cancel)();
+ }
+};
+
+} // end namespace tink
+} // end namespace core
+
+#endif /* INCLUDED_tink_core_LinkObject */
diff --git a/Sources/c_snikket/iinclude/tink/core/MPair.h b/Sources/c_snikket/iinclude/tink/core/MPair.h
new file mode 100644
index 0000000..5d16a2e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/core/MPair.h
@@ -0,0 +1,72 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core_MPair
+#define INCLUDED_tink_core_MPair
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_7fda083185addcb6_27_new)
+HX_DECLARE_CLASS2(tink,core,MPair)
+
+namespace tink{
+namespace core{
+
+
+class HXCPP_CLASS_ATTRIBUTES MPair_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef MPair_obj OBJ_;
+ MPair_obj();
+
+ public:
+ enum { _hx_ClassId = 0x4cad4316 };
+
+ void __construct( ::Dynamic a, ::Dynamic b);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.core.MPair")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.core.MPair"); }
+
+ inline static ::hx::ObjectPtr< MPair_obj > __new( ::Dynamic a, ::Dynamic b) {
+ ::hx::ObjectPtr< MPair_obj > __this = new MPair_obj();
+ __this->__construct(a,b);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< MPair_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic a, ::Dynamic b) {
+ MPair_obj *__this = (MPair_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(MPair_obj), true, "tink.core.MPair"));
+ *(void **)__this = MPair_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_7fda083185addcb6_27_new)
+HXLINE( 28) ( ( ::tink::core::MPair)(__this) )->a = a;
+HXLINE( 29) ( ( ::tink::core::MPair)(__this) )->b = b;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~MPair_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("MPair",07,b3,05,8b); }
+
+ ::Dynamic a;
+ ::Dynamic b;
+};
+
+} // end namespace tink
+} // end namespace core
+
+#endif /* INCLUDED_tink_core_MPair */
diff --git a/Sources/c_snikket/iinclude/tink/core/NamedWith.h b/Sources/c_snikket/iinclude/tink/core/NamedWith.h
new file mode 100644
index 0000000..125a8dd
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/core/NamedWith.h
@@ -0,0 +1,72 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core_NamedWith
+#define INCLUDED_tink_core_NamedWith
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_fe49a69a0def38bb_11_new)
+HX_DECLARE_CLASS2(tink,core,NamedWith)
+
+namespace tink{
+namespace core{
+
+
+class HXCPP_CLASS_ATTRIBUTES NamedWith_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef NamedWith_obj OBJ_;
+ NamedWith_obj();
+
+ public:
+ enum { _hx_ClassId = 0x4df025ce };
+
+ void __construct( ::Dynamic name, ::Dynamic value);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.core.NamedWith")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.core.NamedWith"); }
+
+ inline static ::hx::ObjectPtr< NamedWith_obj > __new( ::Dynamic name, ::Dynamic value) {
+ ::hx::ObjectPtr< NamedWith_obj > __this = new NamedWith_obj();
+ __this->__construct(name,value);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< NamedWith_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic name, ::Dynamic value) {
+ NamedWith_obj *__this = (NamedWith_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(NamedWith_obj), true, "tink.core.NamedWith"));
+ *(void **)__this = NamedWith_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_fe49a69a0def38bb_11_new)
+HXLINE( 12) ( ( ::tink::core::NamedWith)(__this) )->name = name;
+HXLINE( 13) ( ( ::tink::core::NamedWith)(__this) )->value = value;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~NamedWith_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("NamedWith",3f,e2,3d,d6); }
+
+ ::Dynamic name;
+ ::Dynamic value;
+};
+
+} // end namespace tink
+} // end namespace core
+
+#endif /* INCLUDED_tink_core_NamedWith */
diff --git a/Sources/c_snikket/iinclude/tink/core/Outcome.h b/Sources/c_snikket/iinclude/tink/core/Outcome.h
new file mode 100644
index 0000000..8434633
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/core/Outcome.h
@@ -0,0 +1,37 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core_Outcome
+#define INCLUDED_tink_core_Outcome
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,Outcome)
+namespace tink{
+namespace core{
+
+
+class Outcome_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef Outcome_obj OBJ_;
+
+ public:
+ Outcome_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.core.Outcome",5f,27,74,0c); }
+ ::String __ToString() const { return HX_("Outcome.",7c,83,a3,53) + _hx_tag; }
+
+ static ::tink::core::Outcome Failure( ::Dynamic failure);
+ static ::Dynamic Failure_dyn();
+ static ::tink::core::Outcome Success( ::Dynamic data);
+ static ::Dynamic Success_dyn();
+};
+
+} // end namespace tink
+} // end namespace core
+
+#endif /* INCLUDED_tink_core_Outcome */
diff --git a/Sources/c_snikket/iinclude/tink/core/OwnedDisposable.h b/Sources/c_snikket/iinclude/tink/core/OwnedDisposable.h
new file mode 100644
index 0000000..fe901cf
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/core/OwnedDisposable.h
@@ -0,0 +1,29 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core_OwnedDisposable
+#define INCLUDED_tink_core_OwnedDisposable
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_core_Disposable
+#include <tink/core/Disposable.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,Disposable)
+HX_DECLARE_CLASS2(tink,core,OwnedDisposable)
+
+namespace tink{
+namespace core{
+
+
+class HXCPP_CLASS_ATTRIBUTES OwnedDisposable_obj {
+ public:
+ typedef ::tink::core::Disposable_obj super;
+ HX_DO_INTERFACE_RTTI;
+
+};
+
+} // end namespace tink
+} // end namespace core
+
+#endif /* INCLUDED_tink_core_OwnedDisposable */
diff --git a/Sources/c_snikket/iinclude/tink/core/SimpleDisposable.h b/Sources/c_snikket/iinclude/tink/core/SimpleDisposable.h
new file mode 100644
index 0000000..0af4801
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/core/SimpleDisposable.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core_SimpleDisposable
+#define INCLUDED_tink_core_SimpleDisposable
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_core_OwnedDisposable
+#include <tink/core/OwnedDisposable.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,Disposable)
+HX_DECLARE_CLASS2(tink,core,OwnedDisposable)
+HX_DECLARE_CLASS2(tink,core,SimpleDisposable)
+
+namespace tink{
+namespace core{
+
+
+class HXCPP_CLASS_ATTRIBUTES SimpleDisposable_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef SimpleDisposable_obj OBJ_;
+ SimpleDisposable_obj();
+
+ public:
+ enum { _hx_ClassId = 0x11eb7047 };
+
+ void __construct( ::Dynamic dispose);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.core.SimpleDisposable")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.core.SimpleDisposable"); }
+ static ::hx::ObjectPtr< SimpleDisposable_obj > __new( ::Dynamic dispose);
+ static ::hx::ObjectPtr< SimpleDisposable_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic dispose);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SimpleDisposable_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("SimpleDisposable",92,24,4b,01); }
+
+ static void noop();
+ static ::Dynamic noop_dyn();
+
+ ::Dynamic f;
+ Dynamic f_dyn() { return f;}
+ ::Array< ::Dynamic> disposeHandlers;
+ void dispose();
+ ::Dynamic dispose_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace core
+
+#endif /* INCLUDED_tink_core_SimpleDisposable */
diff --git a/Sources/c_snikket/iinclude/tink/core/TypedError.h b/Sources/c_snikket/iinclude/tink/core/TypedError.h
new file mode 100644
index 0000000..b359208
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/core/TypedError.h
@@ -0,0 +1,72 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core_TypedError
+#define INCLUDED_tink_core_TypedError
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,StackItem)
+HX_DECLARE_CLASS2(tink,core,TypedError)
+
+namespace tink{
+namespace core{
+
+
+class HXCPP_CLASS_ATTRIBUTES TypedError_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef TypedError_obj OBJ_;
+ TypedError_obj();
+
+ public:
+ enum { _hx_ClassId = 0x07b6f513 };
+
+ void __construct( ::Dynamic __o_code,::String message, ::Dynamic pos);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.core.TypedError")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.core.TypedError"); }
+ static ::hx::ObjectPtr< TypedError_obj > __new( ::Dynamic __o_code,::String message, ::Dynamic pos);
+ static ::hx::ObjectPtr< TypedError_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic __o_code,::String message, ::Dynamic pos);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~TypedError_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("TypedError",1e,0f,9b,3c); }
+
+ static ::tink::core::TypedError withData( ::Dynamic code,::String message, ::Dynamic data, ::Dynamic pos);
+ static ::Dynamic withData_dyn();
+
+ static ::tink::core::TypedError typed( ::Dynamic code,::String message, ::Dynamic data, ::Dynamic pos);
+ static ::Dynamic typed_dyn();
+
+ ::String message;
+ int code;
+ ::Dynamic data;
+ ::Dynamic pos;
+ ::Array< ::Dynamic> callStack;
+ ::Array< ::Dynamic> exceptionStack;
+ ::String printPos();
+ ::Dynamic printPos_dyn();
+
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace core
+
+#endif /* INCLUDED_tink_core_TypedError */
diff --git a/Sources/c_snikket/iinclude/tink/core/_Callback/Callback_Impl_.h b/Sources/c_snikket/iinclude/tink/core/_Callback/Callback_Impl_.h
new file mode 100644
index 0000000..a7f2a09
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/core/_Callback/Callback_Impl_.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core__Callback_Callback_Impl_
+#define INCLUDED_tink_core__Callback_Callback_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Callback,Callback_Impl_)
+
+namespace tink{
+namespace core{
+namespace _Callback{
+
+
+class HXCPP_CLASS_ATTRIBUTES Callback_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Callback_Impl__obj OBJ_;
+ Callback_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x10af39f4 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.core._Callback.Callback_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.core._Callback.Callback_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Callback_Impl__obj > __new() {
+ ::hx::ObjectPtr< Callback_Impl__obj > __this = new Callback_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Callback_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Callback_Impl__obj *__this = (Callback_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Callback_Impl__obj), false, "tink.core._Callback.Callback_Impl_"));
+ *(void **)__this = Callback_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Callback_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Callback_Impl_",45,8c,62,d2); }
+
+ static void __boot();
+ static int depth;
+ static void invoke( ::Dynamic this1, ::Dynamic data);
+ static ::Dynamic invoke_dyn();
+
+ static void defer( ::Dynamic f);
+ static ::Dynamic defer_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace core
+} // end namespace _Callback
+
+#endif /* INCLUDED_tink_core__Callback_Callback_Impl_ */
diff --git a/Sources/c_snikket/iinclude/tink/core/_Callback/LinkPair.h b/Sources/c_snikket/iinclude/tink/core/_Callback/LinkPair.h
new file mode 100644
index 0000000..b86caa5
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/core/_Callback/LinkPair.h
@@ -0,0 +1,65 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core__Callback_LinkPair
+#define INCLUDED_tink_core__Callback_LinkPair
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_core_LinkObject
+#include <tink/core/LinkObject.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,LinkObject)
+HX_DECLARE_CLASS3(tink,core,_Callback,LinkPair)
+
+namespace tink{
+namespace core{
+namespace _Callback{
+
+
+class HXCPP_CLASS_ATTRIBUTES LinkPair_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef LinkPair_obj OBJ_;
+ LinkPair_obj();
+
+ public:
+ enum { _hx_ClassId = 0x01531ffb };
+
+ void __construct(::Dynamic a,::Dynamic b);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.core._Callback.LinkPair")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.core._Callback.LinkPair"); }
+ static ::hx::ObjectPtr< LinkPair_obj > __new(::Dynamic a,::Dynamic b);
+ static ::hx::ObjectPtr< LinkPair_obj > __alloc(::hx::Ctx *_hx_ctx,::Dynamic a,::Dynamic b);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~LinkPair_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("LinkPair",54,61,94,d5); }
+
+ ::Dynamic a;
+ ::Dynamic b;
+ bool dissolved;
+ void cancel();
+ ::Dynamic cancel_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace core
+} // end namespace _Callback
+
+#endif /* INCLUDED_tink_core__Callback_LinkPair */
diff --git a/Sources/c_snikket/iinclude/tink/core/_Callback/ListCell.h b/Sources/c_snikket/iinclude/tink/core/_Callback/ListCell.h
new file mode 100644
index 0000000..1e66518
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/core/_Callback/ListCell.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core__Callback_ListCell
+#define INCLUDED_tink_core__Callback_ListCell
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_core_LinkObject
+#include <tink/core/LinkObject.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,CallbackList)
+HX_DECLARE_CLASS2(tink,core,Disposable)
+HX_DECLARE_CLASS2(tink,core,LinkObject)
+HX_DECLARE_CLASS2(tink,core,OwnedDisposable)
+HX_DECLARE_CLASS2(tink,core,SimpleDisposable)
+HX_DECLARE_CLASS3(tink,core,_Callback,ListCell)
+
+namespace tink{
+namespace core{
+namespace _Callback{
+
+
+class HXCPP_CLASS_ATTRIBUTES ListCell_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef ListCell_obj OBJ_;
+ ListCell_obj();
+
+ public:
+ enum { _hx_ClassId = 0x05a024cb };
+
+ void __construct( ::Dynamic cb, ::tink::core::CallbackList list);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.core._Callback.ListCell")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.core._Callback.ListCell"); }
+ static ::hx::ObjectPtr< ListCell_obj > __new( ::Dynamic cb, ::tink::core::CallbackList list);
+ static ::hx::ObjectPtr< ListCell_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic cb, ::tink::core::CallbackList list);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ListCell_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("ListCell",40,ad,63,fb); }
+
+ ::Dynamic cb;
+ Dynamic cb_dyn() { return cb;}
+ ::tink::core::CallbackList list;
+ void cancel();
+ ::Dynamic cancel_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace core
+} // end namespace _Callback
+
+#endif /* INCLUDED_tink_core__Callback_ListCell */
diff --git a/Sources/c_snikket/iinclude/tink/core/_Future/FutureObject.h b/Sources/c_snikket/iinclude/tink/core/_Future/FutureObject.h
new file mode 100644
index 0000000..7e4ed1a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/core/_Future/FutureObject.h
@@ -0,0 +1,61 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core__Future_FutureObject
+#define INCLUDED_tink_core__Future_FutureObject
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,FutureStatus)
+HX_DECLARE_CLASS2(tink,core,LinkObject)
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+
+namespace tink{
+namespace core{
+namespace _Future{
+
+
+class HXCPP_CLASS_ATTRIBUTES FutureObject_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef FutureObject_obj OBJ_;
+ FutureObject_obj();
+
+ public:
+ enum { _hx_ClassId = 0x75d0f9d3 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.core._Future.FutureObject")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.core._Future.FutureObject"); }
+ static ::hx::ObjectPtr< FutureObject_obj > __new();
+ static ::hx::ObjectPtr< FutureObject_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~FutureObject_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("FutureObject",82,eb,54,94); }
+
+ virtual ::tink::core::FutureStatus getStatus();
+ ::Dynamic getStatus_dyn();
+
+ virtual ::Dynamic handle( ::Dynamic callback);
+ ::Dynamic handle_dyn();
+
+ virtual void eager();
+ ::Dynamic eager_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace core
+} // end namespace _Future
+
+#endif /* INCLUDED_tink_core__Future_FutureObject */
diff --git a/Sources/c_snikket/iinclude/tink/core/_Future/Future_Impl_.h b/Sources/c_snikket/iinclude/tink/core/_Future/Future_Impl_.h
new file mode 100644
index 0000000..94ba4b7
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/core/_Future/Future_Impl_.h
@@ -0,0 +1,79 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core__Future_Future_Impl_
+#define INCLUDED_tink_core__Future_Future_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS3(tink,core,_Future,Future_Impl_)
+
+namespace tink{
+namespace core{
+namespace _Future{
+
+
+class HXCPP_CLASS_ATTRIBUTES Future_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Future_Impl__obj OBJ_;
+ Future_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x78864394 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.core._Future.Future_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.core._Future.Future_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Future_Impl__obj > __new() {
+ ::hx::ObjectPtr< Future_Impl__obj > __this = new Future_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Future_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Future_Impl__obj *__this = (Future_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Future_Impl__obj), false, "tink.core._Future.Future_Impl_"));
+ *(void **)__this = Future_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Future_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Future_Impl_",43,35,0a,97); }
+
+ static void __boot();
+ static ::tink::core::_Future::FutureObject NEVER_INST;
+ static ::tink::core::_Future::FutureObject never();
+ static ::Dynamic never_dyn();
+
+ static ::tink::core::_Future::FutureObject map( ::tink::core::_Future::FutureObject this1, ::Dynamic f, ::Dynamic gather);
+ static ::Dynamic map_dyn();
+
+ static ::tink::core::_Future::FutureObject flatMap( ::tink::core::_Future::FutureObject this1, ::Dynamic next, ::Dynamic gather);
+ static ::Dynamic flatMap_dyn();
+
+ static ::tink::core::_Future::FutureObject async( ::Dynamic init, ::Dynamic lazy);
+ static ::Dynamic async_dyn();
+
+ static ::tink::core::_Future::FutureObject irreversible( ::Dynamic init);
+ static ::Dynamic irreversible_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace core
+} // end namespace _Future
+
+#endif /* INCLUDED_tink_core__Future_Future_Impl_ */
diff --git a/Sources/c_snikket/iinclude/tink/core/_Future/SuspendableFuture.h b/Sources/c_snikket/iinclude/tink/core/_Future/SuspendableFuture.h
new file mode 100644
index 0000000..358a37e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/core/_Future/SuspendableFuture.h
@@ -0,0 +1,81 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core__Future_SuspendableFuture
+#define INCLUDED_tink_core__Future_SuspendableFuture
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_core__Future_FutureObject
+#include <tink/core/_Future/FutureObject.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,CallbackList)
+HX_DECLARE_CLASS2(tink,core,Disposable)
+HX_DECLARE_CLASS2(tink,core,FutureStatus)
+HX_DECLARE_CLASS2(tink,core,LinkObject)
+HX_DECLARE_CLASS2(tink,core,OwnedDisposable)
+HX_DECLARE_CLASS2(tink,core,SimpleDisposable)
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS3(tink,core,_Future,SuspendableFuture)
+
+namespace tink{
+namespace core{
+namespace _Future{
+
+
+class HXCPP_CLASS_ATTRIBUTES SuspendableFuture_obj : public ::tink::core::_Future::FutureObject_obj
+{
+ public:
+ typedef ::tink::core::_Future::FutureObject_obj super;
+ typedef SuspendableFuture_obj OBJ_;
+ SuspendableFuture_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1fbfb7e8 };
+
+ void __construct( ::Dynamic wakeup);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.core._Future.SuspendableFuture")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.core._Future.SuspendableFuture"); }
+ static ::hx::ObjectPtr< SuspendableFuture_obj > __new( ::Dynamic wakeup);
+ static ::hx::ObjectPtr< SuspendableFuture_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic wakeup);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SuspendableFuture_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("SuspendableFuture",d9,4b,c6,80); }
+
+ ::tink::core::CallbackList callbacks;
+ ::tink::core::FutureStatus status;
+ ::Dynamic link;
+ ::Dynamic wakeup;
+ Dynamic wakeup_dyn() { return wakeup;}
+ ::tink::core::FutureStatus getStatus();
+
+ void trigger( ::Dynamic value);
+ ::Dynamic trigger_dyn();
+
+ ::Dynamic handle( ::Dynamic callback);
+
+ void arm();
+ ::Dynamic arm_dyn();
+
+ void eager();
+
+};
+
+} // end namespace tink
+} // end namespace core
+} // end namespace _Future
+
+#endif /* INCLUDED_tink_core__Future_SuspendableFuture */
diff --git a/Sources/c_snikket/iinclude/tink/core/_Future/SyncFuture.h b/Sources/c_snikket/iinclude/tink/core/_Future/SyncFuture.h
new file mode 100644
index 0000000..7c3b0d3
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/core/_Future/SyncFuture.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core__Future_SyncFuture
+#define INCLUDED_tink_core__Future_SyncFuture
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_core__Future_FutureObject
+#include <tink/core/_Future/FutureObject.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,FutureStatus)
+HX_DECLARE_CLASS2(tink,core,LinkObject)
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS3(tink,core,_Future,SyncFuture)
+HX_DECLARE_CLASS3(tink,core,_Lazy,Computable)
+HX_DECLARE_CLASS3(tink,core,_Lazy,LazyObject)
+
+namespace tink{
+namespace core{
+namespace _Future{
+
+
+class HXCPP_CLASS_ATTRIBUTES SyncFuture_obj : public ::tink::core::_Future::FutureObject_obj
+{
+ public:
+ typedef ::tink::core::_Future::FutureObject_obj super;
+ typedef SyncFuture_obj OBJ_;
+ SyncFuture_obj();
+
+ public:
+ enum { _hx_ClassId = 0x03763767 };
+
+ void __construct(::Dynamic value);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.core._Future.SyncFuture")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.core._Future.SyncFuture"); }
+ static ::hx::ObjectPtr< SyncFuture_obj > __new(::Dynamic value);
+ static ::hx::ObjectPtr< SyncFuture_obj > __alloc(::hx::Ctx *_hx_ctx,::Dynamic value);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SyncFuture_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("SyncFuture",1e,81,9c,5c); }
+
+ ::Dynamic value;
+ ::tink::core::FutureStatus getStatus();
+
+ ::Dynamic handle( ::Dynamic cb);
+
+ void eager();
+
+};
+
+} // end namespace tink
+} // end namespace core
+} // end namespace _Future
+
+#endif /* INCLUDED_tink_core__Future_SyncFuture */
diff --git a/Sources/c_snikket/iinclude/tink/core/_Lazy/Computable.h b/Sources/c_snikket/iinclude/tink/core/_Lazy/Computable.h
new file mode 100644
index 0000000..7d87bba
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/core/_Lazy/Computable.h
@@ -0,0 +1,39 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core__Lazy_Computable
+#define INCLUDED_tink_core__Lazy_Computable
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Lazy,Computable)
+
+namespace tink{
+namespace core{
+namespace _Lazy{
+
+
+class HXCPP_CLASS_ATTRIBUTES Computable_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ bool (::hx::Object :: *_hx_isComputed)();
+ static inline bool isComputed( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::core::_Lazy::Computable_obj *>(_hx_.mPtr->_hx_getInterface(0xd2b592ea)))->_hx_isComputed)();
+ }
+ void (::hx::Object :: *_hx_compute)();
+ static inline void compute( ::Dynamic _hx_) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::tink::core::_Lazy::Computable_obj *>(_hx_.mPtr->_hx_getInterface(0xd2b592ea)))->_hx_compute)();
+ }
+ ::Dynamic (::hx::Object :: *_hx_underlying)();
+ static inline ::Dynamic underlying( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::core::_Lazy::Computable_obj *>(_hx_.mPtr->_hx_getInterface(0xd2b592ea)))->_hx_underlying)();
+ }
+};
+
+} // end namespace tink
+} // end namespace core
+} // end namespace _Lazy
+
+#endif /* INCLUDED_tink_core__Lazy_Computable */
diff --git a/Sources/c_snikket/iinclude/tink/core/_Lazy/LazyConst.h b/Sources/c_snikket/iinclude/tink/core/_Lazy/LazyConst.h
new file mode 100644
index 0000000..8313c7c
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/core/_Lazy/LazyConst.h
@@ -0,0 +1,73 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core__Lazy_LazyConst
+#define INCLUDED_tink_core__Lazy_LazyConst
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_core__Lazy_LazyObject
+#include <tink/core/_Lazy/LazyObject.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Lazy,Computable)
+HX_DECLARE_CLASS3(tink,core,_Lazy,LazyConst)
+HX_DECLARE_CLASS3(tink,core,_Lazy,LazyObject)
+
+namespace tink{
+namespace core{
+namespace _Lazy{
+
+
+class HXCPP_CLASS_ATTRIBUTES LazyConst_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef LazyConst_obj OBJ_;
+ LazyConst_obj();
+
+ public:
+ enum { _hx_ClassId = 0x43104c2d };
+
+ void __construct( ::Dynamic value);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.core._Lazy.LazyConst")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.core._Lazy.LazyConst"); }
+ static ::hx::ObjectPtr< LazyConst_obj > __new( ::Dynamic value);
+ static ::hx::ObjectPtr< LazyConst_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic value);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~LazyConst_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("LazyConst",2f,14,bd,5b); }
+
+ ::Dynamic value;
+ bool isComputed();
+ ::Dynamic isComputed_dyn();
+
+ ::Dynamic get();
+ ::Dynamic get_dyn();
+
+ void compute();
+ ::Dynamic compute_dyn();
+
+ ::Dynamic underlying();
+ ::Dynamic underlying_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace core
+} // end namespace _Lazy
+
+#endif /* INCLUDED_tink_core__Lazy_LazyConst */
diff --git a/Sources/c_snikket/iinclude/tink/core/_Lazy/LazyFunc.h b/Sources/c_snikket/iinclude/tink/core/_Lazy/LazyFunc.h
new file mode 100644
index 0000000..d20b1d8
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/core/_Lazy/LazyFunc.h
@@ -0,0 +1,76 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core__Lazy_LazyFunc
+#define INCLUDED_tink_core__Lazy_LazyFunc
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_core__Lazy_LazyObject
+#include <tink/core/_Lazy/LazyObject.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Lazy,Computable)
+HX_DECLARE_CLASS3(tink,core,_Lazy,LazyFunc)
+HX_DECLARE_CLASS3(tink,core,_Lazy,LazyObject)
+
+namespace tink{
+namespace core{
+namespace _Lazy{
+
+
+class HXCPP_CLASS_ATTRIBUTES LazyFunc_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef LazyFunc_obj OBJ_;
+ LazyFunc_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1cb47fba };
+
+ void __construct( ::Dynamic f,::Dynamic from);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.core._Lazy.LazyFunc")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.core._Lazy.LazyFunc"); }
+ static ::hx::ObjectPtr< LazyFunc_obj > __new( ::Dynamic f,::Dynamic from);
+ static ::hx::ObjectPtr< LazyFunc_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic f,::Dynamic from);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~LazyFunc_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("LazyFunc",f8,2d,40,5e); }
+
+ ::Dynamic f;
+ Dynamic f_dyn() { return f;}
+ ::Dynamic from;
+ ::Dynamic result;
+ ::Dynamic underlying();
+ ::Dynamic underlying_dyn();
+
+ bool isComputed();
+ ::Dynamic isComputed_dyn();
+
+ ::Dynamic get();
+ ::Dynamic get_dyn();
+
+ void compute();
+ ::Dynamic compute_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace core
+} // end namespace _Lazy
+
+#endif /* INCLUDED_tink_core__Lazy_LazyFunc */
diff --git a/Sources/c_snikket/iinclude/tink/core/_Lazy/LazyObject.h b/Sources/c_snikket/iinclude/tink/core/_Lazy/LazyObject.h
new file mode 100644
index 0000000..b6ab109
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/core/_Lazy/LazyObject.h
@@ -0,0 +1,47 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core__Lazy_LazyObject
+#define INCLUDED_tink_core__Lazy_LazyObject
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_core__Lazy_Computable
+#include <tink/core/_Lazy/Computable.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Lazy,Computable)
+HX_DECLARE_CLASS3(tink,core,_Lazy,LazyObject)
+
+namespace tink{
+namespace core{
+namespace _Lazy{
+
+
+class HXCPP_CLASS_ATTRIBUTES LazyObject_obj {
+ public:
+ typedef ::tink::core::_Lazy::Computable_obj super;
+ HX_DO_INTERFACE_RTTI;
+
+ bool (::hx::Object :: *_hx_isComputed)();
+ static inline bool isComputed( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::core::_Lazy::LazyObject_obj *>(_hx_.mPtr->_hx_getInterface(0xe1200775)))->_hx_isComputed)();
+ }
+ void (::hx::Object :: *_hx_compute)();
+ static inline void compute( ::Dynamic _hx_) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::tink::core::_Lazy::LazyObject_obj *>(_hx_.mPtr->_hx_getInterface(0xe1200775)))->_hx_compute)();
+ }
+ ::Dynamic (::hx::Object :: *_hx_underlying)();
+ static inline ::Dynamic underlying( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::core::_Lazy::LazyObject_obj *>(_hx_.mPtr->_hx_getInterface(0xe1200775)))->_hx_underlying)();
+ }
+ ::Dynamic (::hx::Object :: *_hx_get)();
+ static inline ::Dynamic get( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::core::_Lazy::LazyObject_obj *>(_hx_.mPtr->_hx_getInterface(0xe1200775)))->_hx_get)();
+ }
+};
+
+} // end namespace tink
+} // end namespace core
+} // end namespace _Lazy
+
+#endif /* INCLUDED_tink_core__Lazy_LazyObject */
diff --git a/Sources/c_snikket/iinclude/tink/core/_Lazy/Lazy_Impl_.h b/Sources/c_snikket/iinclude/tink/core/_Lazy/Lazy_Impl_.h
new file mode 100644
index 0000000..46a8e46
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/core/_Lazy/Lazy_Impl_.h
@@ -0,0 +1,66 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core__Lazy_Lazy_Impl_
+#define INCLUDED_tink_core__Lazy_Lazy_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Lazy,Computable)
+HX_DECLARE_CLASS3(tink,core,_Lazy,LazyObject)
+HX_DECLARE_CLASS3(tink,core,_Lazy,Lazy_Impl_)
+
+namespace tink{
+namespace core{
+namespace _Lazy{
+
+
+class HXCPP_CLASS_ATTRIBUTES Lazy_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Lazy_Impl__obj OBJ_;
+ Lazy_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x7f55432a };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.core._Lazy.Lazy_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.core._Lazy.Lazy_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Lazy_Impl__obj > __new() {
+ ::hx::ObjectPtr< Lazy_Impl__obj > __this = new Lazy_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Lazy_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Lazy_Impl__obj *__this = (Lazy_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Lazy_Impl__obj), false, "tink.core._Lazy.Lazy_Impl_"));
+ *(void **)__this = Lazy_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Lazy_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Lazy_Impl_",34,20,cd,39); }
+
+ static ::Dynamic get(::Dynamic this1);
+ static ::Dynamic get_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace core
+} // end namespace _Lazy
+
+#endif /* INCLUDED_tink_core__Lazy_Lazy_Impl_ */
diff --git a/Sources/c_snikket/iinclude/tink/core/_Promise/Promise_Impl_.h b/Sources/c_snikket/iinclude/tink/core/_Promise/Promise_Impl_.h
new file mode 100644
index 0000000..74f71a0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/core/_Promise/Promise_Impl_.h
@@ -0,0 +1,65 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_core__Promise_Promise_Impl_
+#define INCLUDED_tink_core__Promise_Promise_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS3(tink,core,_Promise,Promise_Impl_)
+
+namespace tink{
+namespace core{
+namespace _Promise{
+
+
+class HXCPP_CLASS_ATTRIBUTES Promise_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Promise_Impl__obj OBJ_;
+ Promise_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x03edc1ee };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.core._Promise.Promise_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.core._Promise.Promise_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Promise_Impl__obj > __new() {
+ ::hx::ObjectPtr< Promise_Impl__obj > __this = new Promise_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Promise_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Promise_Impl__obj *__this = (Promise_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Promise_Impl__obj), false, "tink.core._Promise.Promise_Impl_"));
+ *(void **)__this = Promise_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Promise_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Promise_Impl_",5b,00,ba,be); }
+
+ static ::tink::core::_Future::FutureObject next( ::tink::core::_Future::FutureObject this1, ::Dynamic f, ::Dynamic gather);
+ static ::Dynamic next_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace core
+} // end namespace _Promise
+
+#endif /* INCLUDED_tink_core__Promise_Promise_Impl_ */
diff --git a/Sources/c_snikket/iinclude/tink/http/BodyPart.h b/Sources/c_snikket/iinclude/tink/http/BodyPart.h
new file mode 100644
index 0000000..29267c0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/http/BodyPart.h
@@ -0,0 +1,37 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_BodyPart
+#define INCLUDED_tink_http_BodyPart
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,http,BodyPart)
+namespace tink{
+namespace http{
+
+
+class BodyPart_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef BodyPart_obj OBJ_;
+
+ public:
+ BodyPart_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.http.BodyPart",ff,9c,21,13); }
+ ::String __ToString() const { return HX_("BodyPart.",b9,9a,30,1f) + _hx_tag; }
+
+ static ::tink::http::BodyPart File( ::Dynamic handle);
+ static ::Dynamic File_dyn();
+ static ::tink::http::BodyPart Value(::String v);
+ static ::Dynamic Value_dyn();
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_BodyPart */
diff --git a/Sources/c_snikket/iinclude/tink/http/ClientObject.h b/Sources/c_snikket/iinclude/tink/http/ClientObject.h
new file mode 100644
index 0000000..cfa81e2
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/http/ClientObject.h
@@ -0,0 +1,32 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_ClientObject
+#define INCLUDED_tink_http_ClientObject
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,http,ClientObject)
+HX_DECLARE_CLASS2(tink,http,Message)
+HX_DECLARE_CLASS2(tink,http,OutgoingRequest)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES ClientObject_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ ::tink::core::_Future::FutureObject (::hx::Object :: *_hx_request)( ::tink::http::OutgoingRequest req);
+ static inline ::tink::core::_Future::FutureObject request( ::Dynamic _hx_, ::tink::http::OutgoingRequest req) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::http::ClientObject_obj *>(_hx_.mPtr->_hx_getInterface(0x9c46f484)))->_hx_request)(req);
+ }
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_ClientObject */
diff --git a/Sources/c_snikket/iinclude/tink/http/ClientType.h b/Sources/c_snikket/iinclude/tink/http/ClientType.h
new file mode 100644
index 0000000..372ee0e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/http/ClientType.h
@@ -0,0 +1,46 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_ClientType
+#define INCLUDED_tink_http_ClientType
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,http,ClientObject)
+HX_DECLARE_CLASS2(tink,http,ClientType)
+HX_DECLARE_CLASS2(tink,http,Container)
+HX_DECLARE_CLASS3(tink,http,containers,LocalContainer)
+namespace tink{
+namespace http{
+
+
+class ClientType_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef ClientType_obj OBJ_;
+
+ public:
+ ClientType_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.http.ClientType",6f,ea,c8,55); }
+ ::String __ToString() const { return HX_("ClientType.",c9,7d,23,dd) + _hx_tag; }
+
+ static ::tink::http::ClientType Curl;
+ static inline ::tink::http::ClientType Curl_dyn() { return Curl; }
+ static ::tink::http::ClientType Custom(::Dynamic v);
+ static ::Dynamic Custom_dyn();
+ static ::tink::http::ClientType Default;
+ static inline ::tink::http::ClientType Default_dyn() { return Default; }
+ static ::tink::http::ClientType Local( ::tink::http::containers::LocalContainer container);
+ static ::Dynamic Local_dyn();
+ static ::tink::http::ClientType StdLib;
+ static inline ::tink::http::ClientType StdLib_dyn() { return StdLib; }
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_ClientType */
diff --git a/Sources/c_snikket/iinclude/tink/http/Container.h b/Sources/c_snikket/iinclude/tink/http/Container.h
new file mode 100644
index 0000000..e6373c2
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/http/Container.h
@@ -0,0 +1,25 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_Container
+#define INCLUDED_tink_http_Container
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,http,Container)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES Container_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_Container */
diff --git a/Sources/c_snikket/iinclude/tink/http/Fetch.h b/Sources/c_snikket/iinclude/tink/http/Fetch.h
new file mode 100644
index 0000000..b965ff4
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/http/Fetch.h
@@ -0,0 +1,74 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_Fetch
+#define INCLUDED_tink_http_Fetch
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS1(haxe,IMap)
+HX_DECLARE_CLASS2(haxe,ds,BalancedTree)
+HX_DECLARE_CLASS2(haxe,ds,EnumValueMap)
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,http,ClientObject)
+HX_DECLARE_CLASS2(tink,http,ClientType)
+HX_DECLARE_CLASS2(tink,http,Fetch)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES Fetch_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Fetch_obj OBJ_;
+ Fetch_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7f806d70 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.http.Fetch")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.http.Fetch"); }
+
+ inline static ::hx::ObjectPtr< Fetch_obj > __new() {
+ ::hx::ObjectPtr< Fetch_obj > __this = new Fetch_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Fetch_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Fetch_obj *__this = (Fetch_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Fetch_obj), false, "tink.http.Fetch"));
+ *(void **)__this = Fetch_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Fetch_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Fetch",1a,84,27,91); }
+
+ static void __boot();
+ static ::haxe::ds::EnumValueMap cache;
+ static ::tink::core::_Future::FutureObject fetch( ::Dynamic url, ::Dynamic options);
+ static ::Dynamic fetch_dyn();
+
+ static ::Dynamic getClient( ::tink::http::ClientType type);
+ static ::Dynamic getClient_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_Fetch */
diff --git a/Sources/c_snikket/iinclude/tink/http/HandlerObject.h b/Sources/c_snikket/iinclude/tink/http/HandlerObject.h
new file mode 100644
index 0000000..37c2119
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/http/HandlerObject.h
@@ -0,0 +1,32 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_HandlerObject
+#define INCLUDED_tink_http_HandlerObject
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,http,HandlerObject)
+HX_DECLARE_CLASS2(tink,http,IncomingRequest)
+HX_DECLARE_CLASS2(tink,http,Message)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES HandlerObject_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ ::tink::core::_Future::FutureObject (::hx::Object :: *_hx_process)( ::tink::http::IncomingRequest req);
+ static inline ::tink::core::_Future::FutureObject process( ::Dynamic _hx_, ::tink::http::IncomingRequest req) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::http::HandlerObject_obj *>(_hx_.mPtr->_hx_getInterface(0xee501fcf)))->_hx_process)(req);
+ }
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_HandlerObject */
diff --git a/Sources/c_snikket/iinclude/tink/http/Header.h b/Sources/c_snikket/iinclude/tink/http/Header.h
new file mode 100644
index 0000000..8567553
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/http/Header.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_Header
+#define INCLUDED_tink_http_Header
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,NamedWith)
+HX_DECLARE_CLASS2(tink,core,Outcome)
+HX_DECLARE_CLASS2(tink,http,Header)
+HX_DECLARE_CLASS2(tink,http,HeaderField)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES Header_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Header_obj OBJ_;
+ Header_obj();
+
+ public:
+ enum { _hx_ClassId = 0x4094a9e7 };
+
+ void __construct(::Array< ::Dynamic> fields);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.Header")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.Header"); }
+ static ::hx::ObjectPtr< Header_obj > __new(::Array< ::Dynamic> fields);
+ static ::hx::ObjectPtr< Header_obj > __alloc(::hx::Ctx *_hx_ctx,::Array< ::Dynamic> fields);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Header_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Header",ad,7d,94,31); }
+
+ ::Array< ::Dynamic> fields;
+ ::Array< ::String > get(::String name);
+ ::Dynamic get_dyn();
+
+ ::tink::core::Outcome byName(::String name);
+ ::Dynamic byName_dyn();
+
+ ::tink::core::Outcome getContentLength();
+ ::Dynamic getContentLength_dyn();
+
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_Header */
diff --git a/Sources/c_snikket/iinclude/tink/http/HeaderField.h b/Sources/c_snikket/iinclude/tink/http/HeaderField.h
new file mode 100644
index 0000000..c12456f
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/http/HeaderField.h
@@ -0,0 +1,76 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_HeaderField
+#define INCLUDED_tink_http_HeaderField
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_core_NamedWith
+#include <tink/core/NamedWith.h>
+#endif
+HX_DECLARE_STACK_FRAME(_hx_pos_80f54cb31df217e8_249_new)
+HX_DECLARE_CLASS2(tink,core,NamedWith)
+HX_DECLARE_CLASS2(tink,http,HeaderField)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES HeaderField_obj : public ::tink::core::NamedWith_obj
+{
+ public:
+ typedef ::tink::core::NamedWith_obj super;
+ typedef HeaderField_obj OBJ_;
+ HeaderField_obj();
+
+ public:
+ enum { _hx_ClassId = 0x67181553 };
+
+ void __construct(::String name,::String value);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.HeaderField")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.HeaderField"); }
+
+ inline static ::hx::ObjectPtr< HeaderField_obj > __new(::String name,::String value) {
+ ::hx::ObjectPtr< HeaderField_obj > __this = new HeaderField_obj();
+ __this->__construct(name,value);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< HeaderField_obj > __alloc(::hx::Ctx *_hx_ctx,::String name,::String value) {
+ HeaderField_obj *__this = (HeaderField_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(HeaderField_obj), true, "tink.http.HeaderField"));
+ *(void **)__this = HeaderField_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_80f54cb31df217e8_249_new)
+HXDLIN( 249) __this->super::__construct(name,value);
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~HeaderField_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("HeaderField",cd,d3,84,f1); }
+
+ static ::tink::http::HeaderField ofString(::String s);
+ static ::Dynamic ofString_dyn();
+
+ virtual ::String toString();
+ ::Dynamic toString_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_HeaderField */
diff --git a/Sources/c_snikket/iinclude/tink/http/HeaderParser.h b/Sources/c_snikket/iinclude/tink/http/HeaderParser.h
new file mode 100644
index 0000000..a493cba
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/http/HeaderParser.h
@@ -0,0 +1,73 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_HeaderParser
+#define INCLUDED_tink_http_HeaderParser
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_io_BytewiseParser
+#include <tink/io/BytewiseParser.h>
+#endif
+HX_DECLARE_CLASS0(StringBuf)
+HX_DECLARE_CLASS2(tink,core,NamedWith)
+HX_DECLARE_CLASS2(tink,core,Outcome)
+HX_DECLARE_CLASS2(tink,http,HeaderField)
+HX_DECLARE_CLASS2(tink,http,HeaderParser)
+HX_DECLARE_CLASS2(tink,io,BytewiseParser)
+HX_DECLARE_CLASS2(tink,io,ParseStep)
+HX_DECLARE_CLASS2(tink,io,StreamParserObject)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES HeaderParser_obj : public ::tink::io::BytewiseParser_obj
+{
+ public:
+ typedef ::tink::io::BytewiseParser_obj super;
+ typedef HeaderParser_obj OBJ_;
+ HeaderParser_obj();
+
+ public:
+ enum { _hx_ClassId = 0x3af4a226 };
+
+ void __construct( ::Dynamic makeHeader);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.HeaderParser")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.HeaderParser"); }
+ static ::hx::ObjectPtr< HeaderParser_obj > __new( ::Dynamic makeHeader);
+ static ::hx::ObjectPtr< HeaderParser_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic makeHeader);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~HeaderParser_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("HeaderParser",6c,8e,ae,cf); }
+
+ ::Dynamic header;
+ ::Array< ::Dynamic> fields;
+ ::StringBuf buf;
+ int last;
+ ::Dynamic makeHeader;
+ Dynamic makeHeader_dyn() { return makeHeader;}
+ ::tink::io::ParseStep read(int c);
+
+ ::tink::io::ParseStep nextLine();
+ ::Dynamic nextLine_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_HeaderParser */
diff --git a/Sources/c_snikket/iinclude/tink/http/IncomingRequest.h b/Sources/c_snikket/iinclude/tink/http/IncomingRequest.h
new file mode 100644
index 0000000..3bdc78d
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/http/IncomingRequest.h
@@ -0,0 +1,61 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_IncomingRequest
+#define INCLUDED_tink_http_IncomingRequest
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_http_Message
+#include <tink/http/Message.h>
+#endif
+HX_DECLARE_CLASS2(tink,http,Header)
+HX_DECLARE_CLASS2(tink,http,IncomingRequest)
+HX_DECLARE_CLASS2(tink,http,IncomingRequestBody)
+HX_DECLARE_CLASS2(tink,http,IncomingRequestHeader)
+HX_DECLARE_CLASS2(tink,http,Message)
+HX_DECLARE_CLASS2(tink,http,RequestHeader)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES IncomingRequest_obj : public ::tink::http::Message_obj
+{
+ public:
+ typedef ::tink::http::Message_obj super;
+ typedef IncomingRequest_obj OBJ_;
+ IncomingRequest_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0386f7df };
+
+ void __construct(::String clientIp, ::tink::http::IncomingRequestHeader header, ::tink::http::IncomingRequestBody body);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.IncomingRequest")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.IncomingRequest"); }
+ static ::hx::ObjectPtr< IncomingRequest_obj > __new(::String clientIp, ::tink::http::IncomingRequestHeader header, ::tink::http::IncomingRequestBody body);
+ static ::hx::ObjectPtr< IncomingRequest_obj > __alloc(::hx::Ctx *_hx_ctx,::String clientIp, ::tink::http::IncomingRequestHeader header, ::tink::http::IncomingRequestBody body);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~IncomingRequest_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("IncomingRequest",e9,56,c7,13); }
+
+ ::String clientIp;
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_IncomingRequest */
diff --git a/Sources/c_snikket/iinclude/tink/http/IncomingRequestBody.h b/Sources/c_snikket/iinclude/tink/http/IncomingRequestBody.h
new file mode 100644
index 0000000..80b9e97
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/http/IncomingRequestBody.h
@@ -0,0 +1,39 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_IncomingRequestBody
+#define INCLUDED_tink_http_IncomingRequestBody
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,NamedWith)
+HX_DECLARE_CLASS2(tink,http,IncomingRequestBody)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+namespace tink{
+namespace http{
+
+
+class IncomingRequestBody_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef IncomingRequestBody_obj OBJ_;
+
+ public:
+ IncomingRequestBody_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.http.IncomingRequestBody",41,e5,fc,1f); }
+ ::String __ToString() const { return HX_("IncomingRequestBody.",a3,3f,25,ff) + _hx_tag; }
+
+ static ::tink::http::IncomingRequestBody Parsed(::Array< ::Dynamic> parts);
+ static ::Dynamic Parsed_dyn();
+ static ::tink::http::IncomingRequestBody Plain(::Dynamic source);
+ static ::Dynamic Plain_dyn();
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_IncomingRequestBody */
diff --git a/Sources/c_snikket/iinclude/tink/http/IncomingRequestHeader.h b/Sources/c_snikket/iinclude/tink/http/IncomingRequestHeader.h
new file mode 100644
index 0000000..8f6a9c0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/http/IncomingRequestHeader.h
@@ -0,0 +1,54 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_IncomingRequestHeader
+#define INCLUDED_tink_http_IncomingRequestHeader
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_http_RequestHeader
+#include <tink/http/RequestHeader.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,NamedWith)
+HX_DECLARE_CLASS2(tink,http,Header)
+HX_DECLARE_CLASS2(tink,http,HeaderField)
+HX_DECLARE_CLASS2(tink,http,IncomingRequestHeader)
+HX_DECLARE_CLASS2(tink,http,RequestHeader)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES IncomingRequestHeader_obj : public ::tink::http::RequestHeader_obj
+{
+ public:
+ typedef ::tink::http::RequestHeader_obj super;
+ typedef IncomingRequestHeader_obj OBJ_;
+ IncomingRequestHeader_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1c840e5c };
+
+ void __construct(::String method, ::Dynamic url,::String __o_protocol,::Array< ::Dynamic> fields);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.IncomingRequestHeader")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.IncomingRequestHeader"); }
+ static ::hx::ObjectPtr< IncomingRequestHeader_obj > __new(::String method, ::Dynamic url,::String __o_protocol,::Array< ::Dynamic> fields);
+ static ::hx::ObjectPtr< IncomingRequestHeader_obj > __alloc(::hx::Ctx *_hx_ctx,::String method, ::Dynamic url,::String __o_protocol,::Array< ::Dynamic> fields);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~IncomingRequestHeader_obj();
+
+ HX_DO_RTTI_ALL;
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("IncomingRequestHeader",56,69,89,e3); }
+
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_IncomingRequestHeader */
diff --git a/Sources/c_snikket/iinclude/tink/http/IncomingResponse.h b/Sources/c_snikket/iinclude/tink/http/IncomingResponse.h
new file mode 100644
index 0000000..bf1e612
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/http/IncomingResponse.h
@@ -0,0 +1,54 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_IncomingResponse
+#define INCLUDED_tink_http_IncomingResponse
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_http_Message
+#include <tink/http/Message.h>
+#endif
+HX_DECLARE_CLASS2(tink,http,Header)
+HX_DECLARE_CLASS2(tink,http,IncomingResponse)
+HX_DECLARE_CLASS2(tink,http,Message)
+HX_DECLARE_CLASS2(tink,http,ResponseHeaderBase)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES IncomingResponse_obj : public ::tink::http::Message_obj
+{
+ public:
+ typedef ::tink::http::Message_obj super;
+ typedef IncomingResponse_obj OBJ_;
+ IncomingResponse_obj();
+
+ public:
+ enum { _hx_ClassId = 0x68c65661 };
+
+ void __construct( ::tink::http::ResponseHeaderBase header,::Dynamic body);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.IncomingResponse")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.IncomingResponse"); }
+ static ::hx::ObjectPtr< IncomingResponse_obj > __new( ::tink::http::ResponseHeaderBase header,::Dynamic body);
+ static ::hx::ObjectPtr< IncomingResponse_obj > __alloc(::hx::Ctx *_hx_ctx, ::tink::http::ResponseHeaderBase header,::Dynamic body);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~IncomingResponse_obj();
+
+ HX_DO_RTTI_ALL;
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("IncomingResponse",a7,dd,f2,2c); }
+
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_IncomingResponse */
diff --git a/Sources/c_snikket/iinclude/tink/http/Message.h b/Sources/c_snikket/iinclude/tink/http/Message.h
new file mode 100644
index 0000000..df01137
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/http/Message.h
@@ -0,0 +1,72 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_Message
+#define INCLUDED_tink_http_Message
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_STACK_FRAME(_hx_pos_bcbf082f6c47a594_8_new)
+HX_DECLARE_CLASS2(tink,http,Message)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES Message_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Message_obj OBJ_;
+ Message_obj();
+
+ public:
+ enum { _hx_ClassId = 0x7888e42d };
+
+ void __construct( ::Dynamic header, ::Dynamic body);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.Message")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.Message"); }
+
+ inline static ::hx::ObjectPtr< Message_obj > __new( ::Dynamic header, ::Dynamic body) {
+ ::hx::ObjectPtr< Message_obj > __this = new Message_obj();
+ __this->__construct(header,body);
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Message_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic header, ::Dynamic body) {
+ Message_obj *__this = (Message_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Message_obj), true, "tink.http.Message"));
+ *(void **)__this = Message_obj::_hx_vtable;
+{
+ HX_STACKFRAME(&_hx_pos_bcbf082f6c47a594_8_new)
+HXLINE( 9) ( ( ::tink::http::Message)(__this) )->header = header;
+HXLINE( 10) ( ( ::tink::http::Message)(__this) )->body = body;
+ }
+
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Message_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Message",a7,5d,62,67); }
+
+ ::Dynamic header;
+ ::Dynamic body;
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_Message */
diff --git a/Sources/c_snikket/iinclude/tink/http/OutgoingRequest.h b/Sources/c_snikket/iinclude/tink/http/OutgoingRequest.h
new file mode 100644
index 0000000..cbe4430
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/http/OutgoingRequest.h
@@ -0,0 +1,55 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_OutgoingRequest
+#define INCLUDED_tink_http_OutgoingRequest
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_http_Message
+#include <tink/http/Message.h>
+#endif
+HX_DECLARE_CLASS2(tink,http,Header)
+HX_DECLARE_CLASS2(tink,http,Message)
+HX_DECLARE_CLASS2(tink,http,OutgoingRequest)
+HX_DECLARE_CLASS2(tink,http,OutgoingRequestHeader)
+HX_DECLARE_CLASS2(tink,http,RequestHeader)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES OutgoingRequest_obj : public ::tink::http::Message_obj
+{
+ public:
+ typedef ::tink::http::Message_obj super;
+ typedef OutgoingRequest_obj OBJ_;
+ OutgoingRequest_obj();
+
+ public:
+ enum { _hx_ClassId = 0x08bf21c5 };
+
+ void __construct( ::tink::http::OutgoingRequestHeader header,::Dynamic body);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.OutgoingRequest")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.OutgoingRequest"); }
+ static ::hx::ObjectPtr< OutgoingRequest_obj > __new( ::tink::http::OutgoingRequestHeader header,::Dynamic body);
+ static ::hx::ObjectPtr< OutgoingRequest_obj > __alloc(::hx::Ctx *_hx_ctx, ::tink::http::OutgoingRequestHeader header,::Dynamic body);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~OutgoingRequest_obj();
+
+ HX_DO_RTTI_ALL;
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("OutgoingRequest",23,1c,f4,79); }
+
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_OutgoingRequest */
diff --git a/Sources/c_snikket/iinclude/tink/http/OutgoingRequestHeader.h b/Sources/c_snikket/iinclude/tink/http/OutgoingRequestHeader.h
new file mode 100644
index 0000000..89bb40c
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/http/OutgoingRequestHeader.h
@@ -0,0 +1,63 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_OutgoingRequestHeader
+#define INCLUDED_tink_http_OutgoingRequestHeader
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_http_RequestHeader
+#include <tink/http/RequestHeader.h>
+#endif
+HX_DECLARE_CLASS2(haxe,ds,Option)
+HX_DECLARE_CLASS2(tink,core,NamedWith)
+HX_DECLARE_CLASS2(tink,http,Header)
+HX_DECLARE_CLASS2(tink,http,HeaderField)
+HX_DECLARE_CLASS2(tink,http,OutgoingRequestHeader)
+HX_DECLARE_CLASS2(tink,http,RequestHeader)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES OutgoingRequestHeader_obj : public ::tink::http::RequestHeader_obj
+{
+ public:
+ typedef ::tink::http::RequestHeader_obj super;
+ typedef OutgoingRequestHeader_obj OBJ_;
+ OutgoingRequestHeader_obj();
+
+ public:
+ enum { _hx_ClassId = 0x17e6c132 };
+
+ void __construct(::String method, ::Dynamic url,::String __o_protocol,::Array< ::Dynamic> fields);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.OutgoingRequestHeader")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.OutgoingRequestHeader"); }
+ static ::hx::ObjectPtr< OutgoingRequestHeader_obj > __new(::String method, ::Dynamic url,::String __o_protocol,::Array< ::Dynamic> fields);
+ static ::hx::ObjectPtr< OutgoingRequestHeader_obj > __alloc(::hx::Ctx *_hx_ctx,::String method, ::Dynamic url,::String __o_protocol,::Array< ::Dynamic> fields);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~OutgoingRequestHeader_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("OutgoingRequestHeader",10,d6,f4,a2); }
+
+ static ::haxe::ds::Option extractAuth( ::Dynamic url);
+ static ::Dynamic extractAuth_dyn();
+
+ ::tink::http::OutgoingRequestHeader concat(::Array< ::Dynamic> fields);
+ ::Dynamic concat_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_OutgoingRequestHeader */
diff --git a/Sources/c_snikket/iinclude/tink/http/RequestHeader.h b/Sources/c_snikket/iinclude/tink/http/RequestHeader.h
new file mode 100644
index 0000000..465e640
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/http/RequestHeader.h
@@ -0,0 +1,63 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_RequestHeader
+#define INCLUDED_tink_http_RequestHeader
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_http_Header
+#include <tink/http/Header.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,NamedWith)
+HX_DECLARE_CLASS2(tink,http,Header)
+HX_DECLARE_CLASS2(tink,http,HeaderField)
+HX_DECLARE_CLASS2(tink,http,RequestHeader)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES RequestHeader_obj : public ::tink::http::Header_obj
+{
+ public:
+ typedef ::tink::http::Header_obj super;
+ typedef RequestHeader_obj OBJ_;
+ RequestHeader_obj();
+
+ public:
+ enum { _hx_ClassId = 0x72a5c122 };
+
+ void __construct(::String method, ::Dynamic url,::String __o_protocol,::Array< ::Dynamic> fields);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.RequestHeader")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.RequestHeader"); }
+ static ::hx::ObjectPtr< RequestHeader_obj > __new(::String method, ::Dynamic url,::String __o_protocol,::Array< ::Dynamic> fields);
+ static ::hx::ObjectPtr< RequestHeader_obj > __alloc(::hx::Ctx *_hx_ctx,::String method, ::Dynamic url,::String __o_protocol,::Array< ::Dynamic> fields);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~RequestHeader_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("RequestHeader",1c,92,9a,00); }
+
+ ::String method;
+ ::Dynamic url;
+ ::String protocol;
+ virtual ::String toString();
+
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_RequestHeader */
diff --git a/Sources/c_snikket/iinclude/tink/http/ResponseHeaderBase.h b/Sources/c_snikket/iinclude/tink/http/ResponseHeaderBase.h
new file mode 100644
index 0000000..e02ec11
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/http/ResponseHeaderBase.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_ResponseHeaderBase
+#define INCLUDED_tink_http_ResponseHeaderBase
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_http_Header
+#include <tink/http/Header.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,NamedWith)
+HX_DECLARE_CLASS2(tink,http,Header)
+HX_DECLARE_CLASS2(tink,http,HeaderField)
+HX_DECLARE_CLASS2(tink,http,ResponseHeaderBase)
+HX_DECLARE_CLASS2(tink,io,StreamParserObject)
+
+namespace tink{
+namespace http{
+
+
+class HXCPP_CLASS_ATTRIBUTES ResponseHeaderBase_obj : public ::tink::http::Header_obj
+{
+ public:
+ typedef ::tink::http::Header_obj super;
+ typedef ResponseHeaderBase_obj OBJ_;
+ ResponseHeaderBase_obj();
+
+ public:
+ enum { _hx_ClassId = 0x68228641 };
+
+ void __construct(int statusCode,::String reason,::Array< ::Dynamic> fields,::String __o_protocol);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.ResponseHeaderBase")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.ResponseHeaderBase"); }
+ static ::hx::ObjectPtr< ResponseHeaderBase_obj > __new(int statusCode,::String reason,::Array< ::Dynamic> fields,::String __o_protocol);
+ static ::hx::ObjectPtr< ResponseHeaderBase_obj > __alloc(::hx::Ctx *_hx_ctx,int statusCode,::String reason,::Array< ::Dynamic> fields,::String __o_protocol);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ResponseHeaderBase_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("ResponseHeaderBase",3f,ca,db,63); }
+
+ static ::Dynamic parser();
+ static ::Dynamic parser_dyn();
+
+ int statusCode;
+ ::String reason;
+ ::String protocol;
+ virtual ::String toString();
+
+};
+
+} // end namespace tink
+} // end namespace http
+
+#endif /* INCLUDED_tink_http_ResponseHeaderBase */
diff --git a/Sources/c_snikket/iinclude/tink/http/_Client/CustomClient.h b/Sources/c_snikket/iinclude/tink/http/_Client/CustomClient.h
new file mode 100644
index 0000000..75eff5b
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/http/_Client/CustomClient.h
@@ -0,0 +1,79 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http__Client_CustomClient
+#define INCLUDED_tink_http__Client_CustomClient
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_http_ClientObject
+#include <tink/http/ClientObject.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,http,ClientObject)
+HX_DECLARE_CLASS2(tink,http,IncomingResponse)
+HX_DECLARE_CLASS2(tink,http,Message)
+HX_DECLARE_CLASS2(tink,http,OutgoingRequest)
+HX_DECLARE_CLASS3(tink,http,_Client,CustomClient)
+
+namespace tink{
+namespace http{
+namespace _Client{
+
+
+class HXCPP_CLASS_ATTRIBUTES CustomClient_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef CustomClient_obj OBJ_;
+ CustomClient_obj();
+
+ public:
+ enum { _hx_ClassId = 0x16257e84 };
+
+ void __construct(::Array< ::Dynamic> preprocessors,::Array< ::Dynamic> postprocessors,::Dynamic real);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http._Client.CustomClient")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http._Client.CustomClient"); }
+ static ::hx::ObjectPtr< CustomClient_obj > __new(::Array< ::Dynamic> preprocessors,::Array< ::Dynamic> postprocessors,::Dynamic real);
+ static ::hx::ObjectPtr< CustomClient_obj > __alloc(::hx::Ctx *_hx_ctx,::Array< ::Dynamic> preprocessors,::Array< ::Dynamic> postprocessors,::Dynamic real);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~CustomClient_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("CustomClient",fc,6c,ff,d1); }
+
+ static ::cpp::VirtualArray concat(::cpp::VirtualArray a,::cpp::VirtualArray b);
+ static ::Dynamic concat_dyn();
+
+ static ::tink::http::_Client::CustomClient create(::Dynamic c,::Array< ::Dynamic> preprocessors,::Array< ::Dynamic> postprocessors);
+ static ::Dynamic create_dyn();
+
+ ::Array< ::Dynamic> preprocessors;
+ ::Array< ::Dynamic> postprocessors;
+ ::Dynamic real;
+ ::tink::core::_Future::FutureObject pipe( ::Dynamic value,::Array< ::Dynamic> transforms, ::Dynamic index);
+ ::Dynamic pipe_dyn();
+
+ ::tink::core::_Future::FutureObject request( ::tink::http::OutgoingRequest req);
+ ::Dynamic request_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace http
+} // end namespace _Client
+
+#endif /* INCLUDED_tink_http__Client_CustomClient */
diff --git a/Sources/c_snikket/iinclude/tink/http/_Fetch/FetchResponse_Impl_.h b/Sources/c_snikket/iinclude/tink/http/_Fetch/FetchResponse_Impl_.h
new file mode 100644
index 0000000..0227082
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/http/_Fetch/FetchResponse_Impl_.h
@@ -0,0 +1,65 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http__Fetch_FetchResponse_Impl_
+#define INCLUDED_tink_http__Fetch_FetchResponse_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS3(tink,http,_Fetch,FetchResponse_Impl_)
+
+namespace tink{
+namespace http{
+namespace _Fetch{
+
+
+class HXCPP_CLASS_ATTRIBUTES FetchResponse_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef FetchResponse_Impl__obj OBJ_;
+ FetchResponse_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x706f0b26 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.http._Fetch.FetchResponse_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.http._Fetch.FetchResponse_Impl_"); }
+
+ inline static ::hx::ObjectPtr< FetchResponse_Impl__obj > __new() {
+ ::hx::ObjectPtr< FetchResponse_Impl__obj > __this = new FetchResponse_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< FetchResponse_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ FetchResponse_Impl__obj *__this = (FetchResponse_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(FetchResponse_Impl__obj), false, "tink.http._Fetch.FetchResponse_Impl_"));
+ *(void **)__this = FetchResponse_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~FetchResponse_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("FetchResponse_Impl_",9b,93,47,bc); }
+
+ static ::tink::core::_Future::FutureObject all( ::tink::core::_Future::FutureObject this1);
+ static ::Dynamic all_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace http
+} // end namespace _Fetch
+
+#endif /* INCLUDED_tink_http__Fetch_FetchResponse_Impl_ */
diff --git a/Sources/c_snikket/iinclude/tink/http/_Header/HeaderValue_Impl_.h b/Sources/c_snikket/iinclude/tink/http/_Header/HeaderValue_Impl_.h
new file mode 100644
index 0000000..a0fbe32
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/http/_Header/HeaderValue_Impl_.h
@@ -0,0 +1,67 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http__Header_HeaderValue_Impl_
+#define INCLUDED_tink_http__Header_HeaderValue_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,http,_Header,HeaderValue_Impl_)
+
+namespace tink{
+namespace http{
+namespace _Header{
+
+
+class HXCPP_CLASS_ATTRIBUTES HeaderValue_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef HeaderValue_Impl__obj OBJ_;
+ HeaderValue_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x58df80d2 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.http._Header.HeaderValue_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.http._Header.HeaderValue_Impl_"); }
+
+ inline static ::hx::ObjectPtr< HeaderValue_Impl__obj > __new() {
+ ::hx::ObjectPtr< HeaderValue_Impl__obj > __this = new HeaderValue_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< HeaderValue_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ HeaderValue_Impl__obj *__this = (HeaderValue_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(HeaderValue_Impl__obj), false, "tink.http._Header.HeaderValue_Impl_"));
+ *(void **)__this = HeaderValue_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~HeaderValue_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("HeaderValue_Impl_",24,b6,26,b3); }
+
+ static ::String basicAuth(::String username,::String password);
+ static ::Dynamic basicAuth_dyn();
+
+ static ::String ofInt(int i);
+ static ::Dynamic ofInt_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace http
+} // end namespace _Header
+
+#endif /* INCLUDED_tink_http__Header_HeaderValue_Impl_ */
diff --git a/Sources/c_snikket/iinclude/tink/http/_Response/OutgoingResponseData.h b/Sources/c_snikket/iinclude/tink/http/_Response/OutgoingResponseData.h
new file mode 100644
index 0000000..7279c3c
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/http/_Response/OutgoingResponseData.h
@@ -0,0 +1,56 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http__Response_OutgoingResponseData
+#define INCLUDED_tink_http__Response_OutgoingResponseData
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_http_Message
+#include <tink/http/Message.h>
+#endif
+HX_DECLARE_CLASS2(tink,http,Header)
+HX_DECLARE_CLASS2(tink,http,Message)
+HX_DECLARE_CLASS2(tink,http,ResponseHeaderBase)
+HX_DECLARE_CLASS3(tink,http,_Response,OutgoingResponseData)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace http{
+namespace _Response{
+
+
+class HXCPP_CLASS_ATTRIBUTES OutgoingResponseData_obj : public ::tink::http::Message_obj
+{
+ public:
+ typedef ::tink::http::Message_obj super;
+ typedef OutgoingResponseData_obj OBJ_;
+ OutgoingResponseData_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0dfa253d };
+
+ void __construct( ::tink::http::ResponseHeaderBase header,::Dynamic body);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http._Response.OutgoingResponseData")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http._Response.OutgoingResponseData"); }
+ static ::hx::ObjectPtr< OutgoingResponseData_obj > __new( ::tink::http::ResponseHeaderBase header,::Dynamic body);
+ static ::hx::ObjectPtr< OutgoingResponseData_obj > __alloc(::hx::Ctx *_hx_ctx, ::tink::http::ResponseHeaderBase header,::Dynamic body);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~OutgoingResponseData_obj();
+
+ HX_DO_RTTI_ALL;
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("OutgoingResponseData",f7,c7,68,aa); }
+
+};
+
+} // end namespace tink
+} // end namespace http
+} // end namespace _Response
+
+#endif /* INCLUDED_tink_http__Response_OutgoingResponseData */
diff --git a/Sources/c_snikket/iinclude/tink/http/clients/CurlClient.h b/Sources/c_snikket/iinclude/tink/http/clients/CurlClient.h
new file mode 100644
index 0000000..f926bf5
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/http/clients/CurlClient.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_clients_CurlClient
+#define INCLUDED_tink_http_clients_CurlClient
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_http_ClientObject
+#include <tink/http/ClientObject.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,http,ClientObject)
+HX_DECLARE_CLASS2(tink,http,Message)
+HX_DECLARE_CLASS2(tink,http,OutgoingRequest)
+HX_DECLARE_CLASS3(tink,http,clients,CurlClient)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace http{
+namespace clients{
+
+
+class HXCPP_CLASS_ATTRIBUTES CurlClient_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef CurlClient_obj OBJ_;
+ CurlClient_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1ef1a485 };
+
+ void __construct( ::Dynamic curl);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.clients.CurlClient")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.clients.CurlClient"); }
+ static ::hx::ObjectPtr< CurlClient_obj > __new( ::Dynamic curl);
+ static ::hx::ObjectPtr< CurlClient_obj > __alloc(::hx::Ctx *_hx_ctx, ::Dynamic curl);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ static void __alloc_dynamic_functions(::hx::Ctx *_hx_alloc,CurlClient_obj *_hx_obj);
+ //~CurlClient_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("CurlClient",77,86,3b,fe); }
+
+ ::tink::core::_Future::FutureObject request( ::tink::http::OutgoingRequest req);
+ ::Dynamic request_dyn();
+
+ ::Dynamic curl;
+ inline ::Dynamic &curl_dyn() {return curl; }
+
+};
+
+} // end namespace tink
+} // end namespace http
+} // end namespace clients
+
+#endif /* INCLUDED_tink_http_clients_CurlClient */
diff --git a/Sources/c_snikket/iinclude/tink/http/clients/Helpers.h b/Sources/c_snikket/iinclude/tink/http/clients/Helpers.h
new file mode 100644
index 0000000..ce58cd0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/http/clients/Helpers.h
@@ -0,0 +1,65 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_clients_Helpers
+#define INCLUDED_tink_http_clients_Helpers
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,ds,Option)
+HX_DECLARE_CLASS3(tink,http,clients,Helpers)
+
+namespace tink{
+namespace http{
+namespace clients{
+
+
+class HXCPP_CLASS_ATTRIBUTES Helpers_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Helpers_obj OBJ_;
+ Helpers_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1dfdf71f };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.http.clients.Helpers")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.http.clients.Helpers"); }
+
+ inline static ::hx::ObjectPtr< Helpers_obj > __new() {
+ ::hx::ObjectPtr< Helpers_obj > __this = new Helpers_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Helpers_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Helpers_obj *__this = (Helpers_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Helpers_obj), false, "tink.http.clients.Helpers"));
+ *(void **)__this = Helpers_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Helpers_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Helpers",25,6b,b0,8d); }
+
+ static ::haxe::ds::Option checkScheme(::String s);
+ static ::Dynamic checkScheme_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace http
+} // end namespace clients
+
+#endif /* INCLUDED_tink_http_clients_Helpers */
diff --git a/Sources/c_snikket/iinclude/tink/http/clients/LocalContainerClient.h b/Sources/c_snikket/iinclude/tink/http/clients/LocalContainerClient.h
new file mode 100644
index 0000000..6e1785e
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/http/clients/LocalContainerClient.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_clients_LocalContainerClient
+#define INCLUDED_tink_http_clients_LocalContainerClient
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_http_ClientObject
+#include <tink/http/ClientObject.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,http,ClientObject)
+HX_DECLARE_CLASS2(tink,http,Container)
+HX_DECLARE_CLASS2(tink,http,Message)
+HX_DECLARE_CLASS2(tink,http,OutgoingRequest)
+HX_DECLARE_CLASS3(tink,http,clients,LocalContainerClient)
+HX_DECLARE_CLASS3(tink,http,containers,LocalContainer)
+
+namespace tink{
+namespace http{
+namespace clients{
+
+
+class HXCPP_CLASS_ATTRIBUTES LocalContainerClient_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef LocalContainerClient_obj OBJ_;
+ LocalContainerClient_obj();
+
+ public:
+ enum { _hx_ClassId = 0x4c48d30b };
+
+ void __construct( ::tink::http::containers::LocalContainer container);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.clients.LocalContainerClient")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.clients.LocalContainerClient"); }
+ static ::hx::ObjectPtr< LocalContainerClient_obj > __new( ::tink::http::containers::LocalContainer container);
+ static ::hx::ObjectPtr< LocalContainerClient_obj > __alloc(::hx::Ctx *_hx_ctx, ::tink::http::containers::LocalContainer container);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~LocalContainerClient_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("LocalContainerClient",61,95,42,2f); }
+
+ ::tink::http::containers::LocalContainer container;
+ ::tink::core::_Future::FutureObject request( ::tink::http::OutgoingRequest req);
+ ::Dynamic request_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace http
+} // end namespace clients
+
+#endif /* INCLUDED_tink_http_clients_LocalContainerClient */
diff --git a/Sources/c_snikket/iinclude/tink/http/clients/SocketClient.h b/Sources/c_snikket/iinclude/tink/http/clients/SocketClient.h
new file mode 100644
index 0000000..71e2c7f
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/http/clients/SocketClient.h
@@ -0,0 +1,67 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_clients_SocketClient
+#define INCLUDED_tink_http_clients_SocketClient
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_http_ClientObject
+#include <tink/http/ClientObject.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,http,ClientObject)
+HX_DECLARE_CLASS2(tink,http,Message)
+HX_DECLARE_CLASS2(tink,http,OutgoingRequest)
+HX_DECLARE_CLASS3(tink,http,clients,SocketClient)
+HX_DECLARE_CLASS2(tink,io,WorkerObject)
+
+namespace tink{
+namespace http{
+namespace clients{
+
+
+class HXCPP_CLASS_ATTRIBUTES SocketClient_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef SocketClient_obj OBJ_;
+ SocketClient_obj();
+
+ public:
+ enum { _hx_ClassId = 0x29ac2844 };
+
+ void __construct(::Dynamic worker);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.clients.SocketClient")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.clients.SocketClient"); }
+ static ::hx::ObjectPtr< SocketClient_obj > __new(::Dynamic worker);
+ static ::hx::ObjectPtr< SocketClient_obj > __alloc(::hx::Ctx *_hx_ctx,::Dynamic worker);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SocketClient_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("SocketClient",7e,5e,b9,60); }
+
+ ::Dynamic worker;
+ ::tink::core::_Future::FutureObject request( ::tink::http::OutgoingRequest req);
+ ::Dynamic request_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace http
+} // end namespace clients
+
+#endif /* INCLUDED_tink_http_clients_SocketClient */
diff --git a/Sources/c_snikket/iinclude/tink/http/clients/StdClient.h b/Sources/c_snikket/iinclude/tink/http/clients/StdClient.h
new file mode 100644
index 0000000..bc59cd0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/http/clients/StdClient.h
@@ -0,0 +1,67 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_clients_StdClient
+#define INCLUDED_tink_http_clients_StdClient
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_http_ClientObject
+#include <tink/http/ClientObject.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,http,ClientObject)
+HX_DECLARE_CLASS2(tink,http,Message)
+HX_DECLARE_CLASS2(tink,http,OutgoingRequest)
+HX_DECLARE_CLASS3(tink,http,clients,StdClient)
+HX_DECLARE_CLASS2(tink,io,WorkerObject)
+
+namespace tink{
+namespace http{
+namespace clients{
+
+
+class HXCPP_CLASS_ATTRIBUTES StdClient_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef StdClient_obj OBJ_;
+ StdClient_obj();
+
+ public:
+ enum { _hx_ClassId = 0x6b1f5144 };
+
+ void __construct(::Dynamic worker);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.clients.StdClient")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.clients.StdClient"); }
+ static ::hx::ObjectPtr< StdClient_obj > __new(::Dynamic worker);
+ static ::hx::ObjectPtr< StdClient_obj > __alloc(::hx::Ctx *_hx_ctx,::Dynamic worker);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~StdClient_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("StdClient",2e,63,67,cc); }
+
+ ::Dynamic worker;
+ ::tink::core::_Future::FutureObject request( ::tink::http::OutgoingRequest req);
+ ::Dynamic request_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace http
+} // end namespace clients
+
+#endif /* INCLUDED_tink_http_clients_StdClient */
diff --git a/Sources/c_snikket/iinclude/tink/http/containers/LocalContainer.h b/Sources/c_snikket/iinclude/tink/http/containers/LocalContainer.h
new file mode 100644
index 0000000..09cbd34
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/http/containers/LocalContainer.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_http_containers_LocalContainer
+#define INCLUDED_tink_http_containers_LocalContainer
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_http_Container
+#include <tink/http/Container.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,http,Container)
+HX_DECLARE_CLASS2(tink,http,HandlerObject)
+HX_DECLARE_CLASS2(tink,http,IncomingRequest)
+HX_DECLARE_CLASS2(tink,http,Message)
+HX_DECLARE_CLASS3(tink,http,containers,LocalContainer)
+
+namespace tink{
+namespace http{
+namespace containers{
+
+
+class HXCPP_CLASS_ATTRIBUTES LocalContainer_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef LocalContainer_obj OBJ_;
+ LocalContainer_obj();
+
+ public:
+ enum { _hx_ClassId = 0x315b134a };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.http.containers.LocalContainer")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.http.containers.LocalContainer"); }
+ static ::hx::ObjectPtr< LocalContainer_obj > __new();
+ static ::hx::ObjectPtr< LocalContainer_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~LocalContainer_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("LocalContainer",76,1a,ea,cb); }
+
+ ::Dynamic handler;
+ bool running;
+ ::tink::core::_Future::FutureObject serve( ::tink::http::IncomingRequest req);
+ ::Dynamic serve_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace http
+} // end namespace containers
+
+#endif /* INCLUDED_tink_http_containers_LocalContainer */
diff --git a/Sources/c_snikket/iinclude/tink/io/BytewiseParser.h b/Sources/c_snikket/iinclude/tink/io/BytewiseParser.h
new file mode 100644
index 0000000..487c7a1
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/io/BytewiseParser.h
@@ -0,0 +1,76 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io_BytewiseParser
+#define INCLUDED_tink_io_BytewiseParser
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_io_StreamParserObject
+#include <tink/io/StreamParserObject.h>
+#endif
+HX_DECLARE_CLASS2(tink,chunk,ChunkCursor)
+HX_DECLARE_CLASS2(tink,core,Outcome)
+HX_DECLARE_CLASS2(tink,io,BytewiseParser)
+HX_DECLARE_CLASS2(tink,io,ParseStep)
+HX_DECLARE_CLASS2(tink,io,StreamParserObject)
+
+namespace tink{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES BytewiseParser_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef BytewiseParser_obj OBJ_;
+ BytewiseParser_obj();
+
+ public:
+ enum { _hx_ClassId = 0x66915863 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.io.BytewiseParser")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.io.BytewiseParser"); }
+
+ inline static ::hx::ObjectPtr< BytewiseParser_obj > __new() {
+ ::hx::ObjectPtr< BytewiseParser_obj > __this = new BytewiseParser_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< BytewiseParser_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ BytewiseParser_obj *__this = (BytewiseParser_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(BytewiseParser_obj), false, "tink.io.BytewiseParser"));
+ *(void **)__this = BytewiseParser_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~BytewiseParser_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("BytewiseParser",4b,c6,88,ee); }
+
+ virtual ::tink::io::ParseStep read(int _hx_char);
+ ::Dynamic read_dyn();
+
+ ::tink::io::ParseStep progress( ::tink::chunk::ChunkCursor cursor);
+ ::Dynamic progress_dyn();
+
+ ::tink::core::Outcome eof( ::tink::chunk::ChunkCursor rest);
+ ::Dynamic eof_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace io
+
+#endif /* INCLUDED_tink_io_BytewiseParser */
diff --git a/Sources/c_snikket/iinclude/tink/io/IdealSourceTools.h b/Sources/c_snikket/iinclude/tink/io/IdealSourceTools.h
new file mode 100644
index 0000000..c7d617b
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/io/IdealSourceTools.h
@@ -0,0 +1,64 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io_IdealSourceTools
+#define INCLUDED_tink_io_IdealSourceTools
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,io,IdealSourceTools)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES IdealSourceTools_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef IdealSourceTools_obj OBJ_;
+ IdealSourceTools_obj();
+
+ public:
+ enum { _hx_ClassId = 0x186409e3 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.io.IdealSourceTools")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.io.IdealSourceTools"); }
+
+ inline static ::hx::ObjectPtr< IdealSourceTools_obj > __new() {
+ ::hx::ObjectPtr< IdealSourceTools_obj > __this = new IdealSourceTools_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< IdealSourceTools_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ IdealSourceTools_obj *__this = (IdealSourceTools_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(IdealSourceTools_obj), false, "tink.io.IdealSourceTools"));
+ *(void **)__this = IdealSourceTools_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~IdealSourceTools_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("IdealSourceTools",cb,c1,80,1f); }
+
+ static ::tink::core::_Future::FutureObject all(::Dynamic s);
+ static ::Dynamic all_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace io
+
+#endif /* INCLUDED_tink_io_IdealSourceTools */
diff --git a/Sources/c_snikket/iinclude/tink/io/ParseResult.h b/Sources/c_snikket/iinclude/tink/io/ParseResult.h
new file mode 100644
index 0000000..49ac084
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/io/ParseResult.h
@@ -0,0 +1,41 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io_ParseResult
+#define INCLUDED_tink_io_ParseResult
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS2(tink,io,ParseResult)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+namespace tink{
+namespace io{
+
+
+class ParseResult_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef ParseResult_obj OBJ_;
+
+ public:
+ ParseResult_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.io.ParseResult",c4,44,ed,6f); }
+ ::String __ToString() const { return HX_("ParseResult.",de,f8,43,8d) + _hx_tag; }
+
+ static ::tink::io::ParseResult Broke( ::tink::core::TypedError e);
+ static ::Dynamic Broke_dyn();
+ static ::tink::io::ParseResult Invalid( ::tink::core::TypedError e,::Dynamic rest);
+ static ::Dynamic Invalid_dyn();
+ static ::tink::io::ParseResult Parsed( ::Dynamic data,::Dynamic rest);
+ static ::Dynamic Parsed_dyn();
+};
+
+} // end namespace tink
+} // end namespace io
+
+#endif /* INCLUDED_tink_io_ParseResult */
diff --git a/Sources/c_snikket/iinclude/tink/io/ParseStep.h b/Sources/c_snikket/iinclude/tink/io/ParseStep.h
new file mode 100644
index 0000000..05a3784
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/io/ParseStep.h
@@ -0,0 +1,40 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io_ParseStep
+#define INCLUDED_tink_io_ParseStep
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS2(tink,io,ParseStep)
+namespace tink{
+namespace io{
+
+
+class ParseStep_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef ParseStep_obj OBJ_;
+
+ public:
+ ParseStep_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.io.ParseStep",73,2b,8e,cf); }
+ ::String __ToString() const { return HX_("ParseStep.",4f,c6,a0,a4) + _hx_tag; }
+
+ static ::tink::io::ParseStep Done( ::Dynamic r);
+ static ::Dynamic Done_dyn();
+ static ::tink::io::ParseStep Failed( ::tink::core::TypedError e);
+ static ::Dynamic Failed_dyn();
+ static ::tink::io::ParseStep Progressed;
+ static inline ::tink::io::ParseStep Progressed_dyn() { return Progressed; }
+};
+
+} // end namespace tink
+} // end namespace io
+
+#endif /* INCLUDED_tink_io_ParseStep */
diff --git a/Sources/c_snikket/iinclude/tink/io/PipeResult.h b/Sources/c_snikket/iinclude/tink/io/PipeResult.h
new file mode 100644
index 0000000..167b3e7
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/io/PipeResult.h
@@ -0,0 +1,43 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io_PipeResult
+#define INCLUDED_tink_io_PipeResult
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS2(tink,io,PipeResult)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+namespace tink{
+namespace io{
+
+
+class PipeResult_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef PipeResult_obj OBJ_;
+
+ public:
+ PipeResult_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.io.PipeResult",d7,3e,a3,6f); }
+ ::String __ToString() const { return HX_("PipeResult.",03,26,3a,37) + _hx_tag; }
+
+ static ::tink::io::PipeResult AllWritten;
+ static inline ::tink::io::PipeResult AllWritten_dyn() { return AllWritten; }
+ static ::tink::io::PipeResult SinkEnded( ::Dynamic result,::Dynamic rest);
+ static ::Dynamic SinkEnded_dyn();
+ static ::tink::io::PipeResult SinkFailed( ::tink::core::TypedError e,::Dynamic rest);
+ static ::Dynamic SinkFailed_dyn();
+ static ::tink::io::PipeResult SourceFailed( ::tink::core::TypedError e);
+ static ::Dynamic SourceFailed_dyn();
+};
+
+} // end namespace tink
+} // end namespace io
+
+#endif /* INCLUDED_tink_io_PipeResult */
diff --git a/Sources/c_snikket/iinclude/tink/io/PipeResultTools.h b/Sources/c_snikket/iinclude/tink/io/PipeResultTools.h
new file mode 100644
index 0000000..de6e225
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/io/PipeResultTools.h
@@ -0,0 +1,65 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io_PipeResultTools
+#define INCLUDED_tink_io_PipeResultTools
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,chunk,ChunkObject)
+HX_DECLARE_CLASS2(tink,io,PipeResult)
+HX_DECLARE_CLASS2(tink,io,PipeResultTools)
+HX_DECLARE_CLASS2(tink,streams,Conclusion)
+
+namespace tink{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES PipeResultTools_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef PipeResultTools_obj OBJ_;
+ PipeResultTools_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0add7938 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.io.PipeResultTools")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.io.PipeResultTools"); }
+
+ inline static ::hx::ObjectPtr< PipeResultTools_obj > __new() {
+ ::hx::ObjectPtr< PipeResultTools_obj > __this = new PipeResultTools_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< PipeResultTools_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ PipeResultTools_obj *__this = (PipeResultTools_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(PipeResultTools_obj), false, "tink.io.PipeResultTools"));
+ *(void **)__this = PipeResultTools_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~PipeResultTools_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("PipeResultTools",50,36,66,7b); }
+
+ static ::tink::io::PipeResult toResult( ::tink::streams::Conclusion c, ::Dynamic result,::Dynamic buffered);
+ static ::Dynamic toResult_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace io
+
+#endif /* INCLUDED_tink_io_PipeResultTools */
diff --git a/Sources/c_snikket/iinclude/tink/io/RealSourceTools.h b/Sources/c_snikket/iinclude/tink/io/RealSourceTools.h
new file mode 100644
index 0000000..40852fc
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/io/RealSourceTools.h
@@ -0,0 +1,72 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io_RealSourceTools
+#define INCLUDED_tink_io_RealSourceTools
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,io,RealSourceTools)
+HX_DECLARE_CLASS2(tink,io,StreamParserObject)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES RealSourceTools_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef RealSourceTools_obj OBJ_;
+ RealSourceTools_obj();
+
+ public:
+ enum { _hx_ClassId = 0x688b0f4a };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.io.RealSourceTools")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.io.RealSourceTools"); }
+
+ inline static ::hx::ObjectPtr< RealSourceTools_obj > __new() {
+ ::hx::ObjectPtr< RealSourceTools_obj > __this = new RealSourceTools_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< RealSourceTools_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ RealSourceTools_obj *__this = (RealSourceTools_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(RealSourceTools_obj), false, "tink.io.RealSourceTools"));
+ *(void **)__this = RealSourceTools_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~RealSourceTools_obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("RealSourceTools",62,cc,13,d9); }
+
+ static ::tink::core::_Future::FutureObject all(::Dynamic s);
+ static ::Dynamic all_dyn();
+
+ static ::tink::core::_Future::FutureObject parse(::Dynamic s,::Dynamic p);
+ static ::Dynamic parse_dyn();
+
+ static ::Dynamic idealize(::Dynamic s, ::Dynamic rescue);
+ static ::Dynamic idealize_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace io
+
+#endif /* INCLUDED_tink_io_RealSourceTools */
diff --git a/Sources/c_snikket/iinclude/tink/io/SinkBase.h b/Sources/c_snikket/iinclude/tink/io/SinkBase.h
new file mode 100644
index 0000000..30475bb
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/io/SinkBase.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io_SinkBase
+#define INCLUDED_tink_io_SinkBase
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_io_SinkObject
+#include <tink/io/SinkObject.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,io,SinkBase)
+HX_DECLARE_CLASS2(tink,io,SinkObject)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES SinkBase_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef SinkBase_obj OBJ_;
+ SinkBase_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1efa06a0 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.io.SinkBase")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.io.SinkBase"); }
+
+ inline static ::hx::ObjectPtr< SinkBase_obj > __new() {
+ ::hx::ObjectPtr< SinkBase_obj > __this = new SinkBase_obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< SinkBase_obj > __alloc(::hx::Ctx *_hx_ctx) {
+ SinkBase_obj *__this = (SinkBase_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(SinkBase_obj), false, "tink.io.SinkBase"));
+ *(void **)__this = SinkBase_obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SinkBase_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("SinkBase",24,8c,b4,5c); }
+
+ virtual ::tink::core::_Future::FutureObject consume(::Dynamic source, ::Dynamic options);
+ ::Dynamic consume_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace io
+
+#endif /* INCLUDED_tink_io_SinkBase */
diff --git a/Sources/c_snikket/iinclude/tink/io/SinkObject.h b/Sources/c_snikket/iinclude/tink/io/SinkObject.h
new file mode 100644
index 0000000..bf9b6e3
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/io/SinkObject.h
@@ -0,0 +1,31 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io_SinkObject
+#define INCLUDED_tink_io_SinkObject
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,io,SinkObject)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES SinkObject_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ ::tink::core::_Future::FutureObject (::hx::Object :: *_hx_consume)(::Dynamic source, ::Dynamic options);
+ static inline ::tink::core::_Future::FutureObject consume( ::Dynamic _hx_,::Dynamic source, ::Dynamic options) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::io::SinkObject_obj *>(_hx_.mPtr->_hx_getInterface(0x483020ea)))->_hx_consume)(source,options);
+ }
+};
+
+} // end namespace tink
+} // end namespace io
+
+#endif /* INCLUDED_tink_io_SinkObject */
diff --git a/Sources/c_snikket/iinclude/tink/io/StreamParserObject.h b/Sources/c_snikket/iinclude/tink/io/StreamParserObject.h
new file mode 100644
index 0000000..290d16b
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/io/StreamParserObject.h
@@ -0,0 +1,36 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io_StreamParserObject
+#define INCLUDED_tink_io_StreamParserObject
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,chunk,ChunkCursor)
+HX_DECLARE_CLASS2(tink,core,Outcome)
+HX_DECLARE_CLASS2(tink,io,ParseStep)
+HX_DECLARE_CLASS2(tink,io,StreamParserObject)
+
+namespace tink{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES StreamParserObject_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ ::tink::io::ParseStep (::hx::Object :: *_hx_progress)( ::tink::chunk::ChunkCursor cursor);
+ static inline ::tink::io::ParseStep progress( ::Dynamic _hx_, ::tink::chunk::ChunkCursor cursor) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::io::StreamParserObject_obj *>(_hx_.mPtr->_hx_getInterface(0x048ef116)))->_hx_progress)(cursor);
+ }
+ ::tink::core::Outcome (::hx::Object :: *_hx_eof)( ::tink::chunk::ChunkCursor rest);
+ static inline ::tink::core::Outcome eof( ::Dynamic _hx_, ::tink::chunk::ChunkCursor rest) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::io::StreamParserObject_obj *>(_hx_.mPtr->_hx_getInterface(0x048ef116)))->_hx_eof)(rest);
+ }
+};
+
+} // end namespace tink
+} // end namespace io
+
+#endif /* INCLUDED_tink_io_StreamParserObject */
diff --git a/Sources/c_snikket/iinclude/tink/io/WorkerObject.h b/Sources/c_snikket/iinclude/tink/io/WorkerObject.h
new file mode 100644
index 0000000..152ff58
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/io/WorkerObject.h
@@ -0,0 +1,32 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io_WorkerObject
+#define INCLUDED_tink_io_WorkerObject
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS3(tink,core,_Lazy,Computable)
+HX_DECLARE_CLASS3(tink,core,_Lazy,LazyObject)
+HX_DECLARE_CLASS2(tink,io,WorkerObject)
+
+namespace tink{
+namespace io{
+
+
+class HXCPP_CLASS_ATTRIBUTES WorkerObject_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ ::tink::core::_Future::FutureObject (::hx::Object :: *_hx_work)(::Dynamic task);
+ static inline ::tink::core::_Future::FutureObject work( ::Dynamic _hx_,::Dynamic task) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::io::WorkerObject_obj *>(_hx_.mPtr->_hx_getInterface(0xdcf3fb55)))->_hx_work)(task);
+ }
+};
+
+} // end namespace tink
+} // end namespace io
+
+#endif /* INCLUDED_tink_io_WorkerObject */
diff --git a/Sources/c_snikket/iinclude/tink/io/_Sink/SinkYielding_Impl_.h b/Sources/c_snikket/iinclude/tink/io/_Sink/SinkYielding_Impl_.h
new file mode 100644
index 0000000..2e51a31
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/io/_Sink/SinkYielding_Impl_.h
@@ -0,0 +1,66 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io__Sink_SinkYielding_Impl_
+#define INCLUDED_tink_io__Sink_SinkYielding_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,io,Output)
+HX_DECLARE_CLASS2(tink,io,SinkObject)
+HX_DECLARE_CLASS3(tink,io,_Sink,SinkYielding_Impl_)
+
+namespace tink{
+namespace io{
+namespace _Sink{
+
+
+class HXCPP_CLASS_ATTRIBUTES SinkYielding_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef SinkYielding_Impl__obj OBJ_;
+ SinkYielding_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x1dd8821a };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.io._Sink.SinkYielding_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.io._Sink.SinkYielding_Impl_"); }
+
+ inline static ::hx::ObjectPtr< SinkYielding_Impl__obj > __new() {
+ ::hx::ObjectPtr< SinkYielding_Impl__obj > __this = new SinkYielding_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< SinkYielding_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ SinkYielding_Impl__obj *__this = (SinkYielding_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(SinkYielding_Impl__obj), false, "tink.io._Sink.SinkYielding_Impl_"));
+ *(void **)__this = SinkYielding_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~SinkYielding_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("SinkYielding_Impl_",e8,ec,49,5e); }
+
+ static ::Dynamic ofOutput(::String name, ::haxe::io::Output target, ::Dynamic options);
+ static ::Dynamic ofOutput_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace io
+} // end namespace _Sink
+
+#endif /* INCLUDED_tink_io__Sink_SinkYielding_Impl_ */
diff --git a/Sources/c_snikket/iinclude/tink/io/_Source/Source_Impl_.h b/Sources/c_snikket/iinclude/tink/io/_Source/Source_Impl_.h
new file mode 100644
index 0000000..d119491
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/io/_Source/Source_Impl_.h
@@ -0,0 +1,82 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io__Source_Source_Impl_
+#define INCLUDED_tink_io__Source_Source_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,io,SinkObject)
+HX_DECLARE_CLASS3(tink,io,_Source,Source_Impl_)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace io{
+namespace _Source{
+
+
+class HXCPP_CLASS_ATTRIBUTES Source_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Source_Impl__obj OBJ_;
+ Source_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x52c5539d };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.io._Source.Source_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.io._Source.Source_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Source_Impl__obj > __new() {
+ ::hx::ObjectPtr< Source_Impl__obj > __this = new Source_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Source_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Source_Impl__obj *__this = (Source_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Source_Impl__obj), false, "tink.io._Source.Source_Impl_"));
+ *(void **)__this = Source_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Source_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Source_Impl_",db,cf,0d,d6); }
+
+ static void __boot();
+ static ::Dynamic EMPTY;
+ static ::Dynamic chunked(::Dynamic this1);
+ static ::Dynamic chunked_dyn();
+
+ static ::tink::core::_Future::FutureObject concatAll(::Dynamic s);
+ static ::Dynamic concatAll_dyn();
+
+ static ::tink::core::_Future::FutureObject pipeTo(::Dynamic this1,::Dynamic target, ::Dynamic options);
+ static ::Dynamic pipeTo_dyn();
+
+ static ::Dynamic limit(::Dynamic this1,int len);
+ static ::Dynamic limit_dyn();
+
+ static ::Dynamic ofError( ::tink::core::TypedError e);
+ static ::Dynamic ofError_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace io
+} // end namespace _Source
+
+#endif /* INCLUDED_tink_io__Source_Source_Impl_ */
diff --git a/Sources/c_snikket/iinclude/tink/io/_StreamParser/StreamParser_Impl_.h b/Sources/c_snikket/iinclude/tink/io/_StreamParser/StreamParser_Impl_.h
new file mode 100644
index 0000000..357b028
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/io/_StreamParser/StreamParser_Impl_.h
@@ -0,0 +1,70 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io__StreamParser_StreamParser_Impl_
+#define INCLUDED_tink_io__StreamParser_StreamParser_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,io,StreamParserObject)
+HX_DECLARE_CLASS3(tink,io,_StreamParser,StreamParser_Impl_)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace io{
+namespace _StreamParser{
+
+
+class HXCPP_CLASS_ATTRIBUTES StreamParser_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef StreamParser_Impl__obj OBJ_;
+ StreamParser_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x18cfe7c1 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.io._StreamParser.StreamParser_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.io._StreamParser.StreamParser_Impl_"); }
+
+ inline static ::hx::ObjectPtr< StreamParser_Impl__obj > __new() {
+ ::hx::ObjectPtr< StreamParser_Impl__obj > __this = new StreamParser_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< StreamParser_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ StreamParser_Impl__obj *__this = (StreamParser_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(StreamParser_Impl__obj), false, "tink.io._StreamParser.StreamParser_Impl_"));
+ *(void **)__this = StreamParser_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~StreamParser_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("StreamParser_Impl_",7f,8f,ef,63); }
+
+ static ::tink::core::_Future::FutureObject doParse(::Dynamic source,::Dynamic p, ::Dynamic consume, ::Dynamic finish);
+ static ::Dynamic doParse_dyn();
+
+ static ::tink::core::_Future::FutureObject parse(::Dynamic s,::Dynamic p);
+ static ::Dynamic parse_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace io
+} // end namespace _StreamParser
+
+#endif /* INCLUDED_tink_io__StreamParser_StreamParser_Impl_ */
diff --git a/Sources/c_snikket/iinclude/tink/io/_Worker/EagerWorker.h b/Sources/c_snikket/iinclude/tink/io/_Worker/EagerWorker.h
new file mode 100644
index 0000000..0529ae7
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/io/_Worker/EagerWorker.h
@@ -0,0 +1,61 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io__Worker_EagerWorker
+#define INCLUDED_tink_io__Worker_EagerWorker
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_io_WorkerObject
+#include <tink/io/WorkerObject.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS3(tink,core,_Lazy,Computable)
+HX_DECLARE_CLASS3(tink,core,_Lazy,LazyObject)
+HX_DECLARE_CLASS2(tink,io,WorkerObject)
+HX_DECLARE_CLASS3(tink,io,_Worker,EagerWorker)
+
+namespace tink{
+namespace io{
+namespace _Worker{
+
+
+class HXCPP_CLASS_ATTRIBUTES EagerWorker_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef EagerWorker_obj OBJ_;
+ EagerWorker_obj();
+
+ public:
+ enum { _hx_ClassId = 0x49fe0131 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.io._Worker.EagerWorker")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.io._Worker.EagerWorker"); }
+ static ::hx::ObjectPtr< EagerWorker_obj > __new();
+ static ::hx::ObjectPtr< EagerWorker_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~EagerWorker_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("EagerWorker",36,20,f4,8a); }
+
+ ::tink::core::_Future::FutureObject work(::Dynamic task);
+ ::Dynamic work_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace io
+} // end namespace _Worker
+
+#endif /* INCLUDED_tink_io__Worker_EagerWorker */
diff --git a/Sources/c_snikket/iinclude/tink/io/_Worker/Worker_Impl_.h b/Sources/c_snikket/iinclude/tink/io/_Worker/Worker_Impl_.h
new file mode 100644
index 0000000..76182c0
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/io/_Worker/Worker_Impl_.h
@@ -0,0 +1,77 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io__Worker_Worker_Impl_
+#define INCLUDED_tink_io__Worker_Worker_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS3(tink,core,_Lazy,Computable)
+HX_DECLARE_CLASS3(tink,core,_Lazy,LazyObject)
+HX_DECLARE_CLASS2(tink,io,WorkerObject)
+HX_DECLARE_CLASS3(tink,io,_Worker,Worker_Impl_)
+
+namespace tink{
+namespace io{
+namespace _Worker{
+
+
+class HXCPP_CLASS_ATTRIBUTES Worker_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Worker_Impl__obj OBJ_;
+ Worker_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x132db49b };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.io._Worker.Worker_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.io._Worker.Worker_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Worker_Impl__obj > __new() {
+ ::hx::ObjectPtr< Worker_Impl__obj > __this = new Worker_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Worker_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Worker_Impl__obj *__this = (Worker_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Worker_Impl__obj), false, "tink.io._Worker.Worker_Impl_"));
+ *(void **)__this = Worker_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Worker_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Worker_Impl_",be,2b,8e,66); }
+
+ static void __boot();
+ static ::Dynamic EAGER;
+ static ::Array< ::Dynamic> pool;
+ static ::Dynamic ensure(::Dynamic this1);
+ static ::Dynamic ensure_dyn();
+
+ static ::Dynamic get();
+ static ::Dynamic get_dyn();
+
+ static ::tink::core::_Future::FutureObject work(::Dynamic this1,::Dynamic task);
+ static ::Dynamic work_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace io
+} // end namespace _Worker
+
+#endif /* INCLUDED_tink_io__Worker_Worker_Impl_ */
diff --git a/Sources/c_snikket/iinclude/tink/io/std/InputSource.h b/Sources/c_snikket/iinclude/tink/io/std/InputSource.h
new file mode 100644
index 0000000..0a66a9d
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/io/std/InputSource.h
@@ -0,0 +1,58 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io_std_InputSource
+#define INCLUDED_tink_io_std_InputSource
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_streams_Generator
+#include <tink/streams/Generator.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Bytes)
+HX_DECLARE_CLASS2(haxe,io,Input)
+HX_DECLARE_CLASS2(tink,io,WorkerObject)
+HX_DECLARE_CLASS3(tink,io,std,InputSource)
+HX_DECLARE_CLASS2(tink,streams,Generator)
+HX_DECLARE_CLASS2(tink,streams,StreamBase)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace io{
+namespace std{
+
+
+class HXCPP_CLASS_ATTRIBUTES InputSource_obj : public ::tink::streams::Generator_obj
+{
+ public:
+ typedef ::tink::streams::Generator_obj super;
+ typedef InputSource_obj OBJ_;
+ InputSource_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0f2d2d9e };
+
+ void __construct(::String name, ::haxe::io::Input target,::Dynamic worker, ::haxe::io::Bytes buf,int offset);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.io.std.InputSource")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.io.std.InputSource"); }
+ static ::hx::ObjectPtr< InputSource_obj > __new(::String name, ::haxe::io::Input target,::Dynamic worker, ::haxe::io::Bytes buf,int offset);
+ static ::hx::ObjectPtr< InputSource_obj > __alloc(::hx::Ctx *_hx_ctx,::String name, ::haxe::io::Input target,::Dynamic worker, ::haxe::io::Bytes buf,int offset);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~InputSource_obj();
+
+ HX_DO_RTTI_ALL;
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("InputSource",65,24,98,0b); }
+
+};
+
+} // end namespace tink
+} // end namespace io
+} // end namespace std
+
+#endif /* INCLUDED_tink_io_std_InputSource */
diff --git a/Sources/c_snikket/iinclude/tink/io/std/OutputSink.h b/Sources/c_snikket/iinclude/tink/io/std/OutputSink.h
new file mode 100644
index 0000000..56470b3
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/io/std/OutputSink.h
@@ -0,0 +1,68 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_io_std_OutputSink
+#define INCLUDED_tink_io_std_OutputSink
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_io_SinkBase
+#include <tink/io/SinkBase.h>
+#endif
+HX_DECLARE_CLASS2(haxe,io,Output)
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,io,SinkBase)
+HX_DECLARE_CLASS2(tink,io,SinkObject)
+HX_DECLARE_CLASS2(tink,io,WorkerObject)
+HX_DECLARE_CLASS3(tink,io,std,OutputSink)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace io{
+namespace std{
+
+
+class HXCPP_CLASS_ATTRIBUTES OutputSink_obj : public ::tink::io::SinkBase_obj
+{
+ public:
+ typedef ::tink::io::SinkBase_obj super;
+ typedef OutputSink_obj OBJ_;
+ OutputSink_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1eacaafb };
+
+ void __construct(::String name, ::haxe::io::Output target,::Dynamic worker);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.io.std.OutputSink")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.io.std.OutputSink"); }
+ static ::hx::ObjectPtr< OutputSink_obj > __new(::String name, ::haxe::io::Output target,::Dynamic worker);
+ static ::hx::ObjectPtr< OutputSink_obj > __alloc(::hx::Ctx *_hx_ctx,::String name, ::haxe::io::Output target,::Dynamic worker);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~OutputSink_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("OutputSink",14,ea,f8,a4); }
+
+ ::String name;
+ ::haxe::io::Output target;
+ ::Dynamic worker;
+ ::tink::core::_Future::FutureObject consume(::Dynamic source, ::Dynamic options);
+
+};
+
+} // end namespace tink
+} // end namespace io
+} // end namespace std
+
+#endif /* INCLUDED_tink_io_std_OutputSink */
diff --git a/Sources/c_snikket/iinclude/tink/streams/Conclusion.h b/Sources/c_snikket/iinclude/tink/streams/Conclusion.h
new file mode 100644
index 0000000..94b9893
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/streams/Conclusion.h
@@ -0,0 +1,43 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_Conclusion
+#define INCLUDED_tink_streams_Conclusion
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS2(tink,streams,Conclusion)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+namespace tink{
+namespace streams{
+
+
+class Conclusion_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef Conclusion_obj OBJ_;
+
+ public:
+ Conclusion_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.streams.Conclusion",96,99,43,ae); }
+ ::String __ToString() const { return HX_("Conclusion.",4f,54,5d,ac) + _hx_tag; }
+
+ static ::tink::streams::Conclusion Clogged( ::tink::core::TypedError error,::Dynamic at);
+ static ::Dynamic Clogged_dyn();
+ static ::tink::streams::Conclusion Depleted;
+ static inline ::tink::streams::Conclusion Depleted_dyn() { return Depleted; }
+ static ::tink::streams::Conclusion Failed( ::tink::core::TypedError error);
+ static ::Dynamic Failed_dyn();
+ static ::tink::streams::Conclusion Halted(::Dynamic rest);
+ static ::Dynamic Halted_dyn();
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_Conclusion */
diff --git a/Sources/c_snikket/iinclude/tink/streams/Empty.h b/Sources/c_snikket/iinclude/tink/streams/Empty.h
new file mode 100644
index 0000000..c56d215
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/streams/Empty.h
@@ -0,0 +1,65 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_Empty
+#define INCLUDED_tink_streams_Empty
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_streams_StreamBase
+#include <tink/streams/StreamBase.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,streams,Empty)
+HX_DECLARE_CLASS2(tink,streams,StreamBase)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace streams{
+
+
+class HXCPP_CLASS_ATTRIBUTES Empty_obj : public ::tink::streams::StreamBase_obj
+{
+ public:
+ typedef ::tink::streams::StreamBase_obj super;
+ typedef Empty_obj OBJ_;
+ Empty_obj();
+
+ public:
+ enum { _hx_ClassId = 0x0b521554 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.streams.Empty")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.streams.Empty"); }
+ static ::hx::ObjectPtr< Empty_obj > __new();
+ static ::hx::ObjectPtr< Empty_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Empty_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static bool __SetStatic(const ::String &inString, Dynamic &ioValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Empty",6d,aa,07,03); }
+
+ static void __boot();
+ static ::tink::streams::Empty inst;
+ static ::Dynamic make();
+ static ::Dynamic make_dyn();
+
+ bool get_depleted();
+
+ ::tink::core::_Future::FutureObject forEach( ::Dynamic handler);
+
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_Empty */
diff --git a/Sources/c_snikket/iinclude/tink/streams/FutureStream.h b/Sources/c_snikket/iinclude/tink/streams/FutureStream.h
new file mode 100644
index 0000000..6e2ba9d
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/streams/FutureStream.h
@@ -0,0 +1,61 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_FutureStream
+#define INCLUDED_tink_streams_FutureStream
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_streams_StreamBase
+#include <tink/streams/StreamBase.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,streams,FutureStream)
+HX_DECLARE_CLASS2(tink,streams,StreamBase)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace streams{
+
+
+class HXCPP_CLASS_ATTRIBUTES FutureStream_obj : public ::tink::streams::StreamBase_obj
+{
+ public:
+ typedef ::tink::streams::StreamBase_obj super;
+ typedef FutureStream_obj OBJ_;
+ FutureStream_obj();
+
+ public:
+ enum { _hx_ClassId = 0x04fe513c };
+
+ void __construct( ::tink::core::_Future::FutureObject f);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.streams.FutureStream")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.streams.FutureStream"); }
+ static ::hx::ObjectPtr< FutureStream_obj > __new( ::tink::core::_Future::FutureObject f);
+ static ::hx::ObjectPtr< FutureStream_obj > __alloc(::hx::Ctx *_hx_ctx, ::tink::core::_Future::FutureObject f);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~FutureStream_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("FutureStream",43,81,42,90); }
+
+ ::tink::core::_Future::FutureObject f;
+ ::tink::core::_Future::FutureObject forEach( ::Dynamic handler);
+
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_FutureStream */
diff --git a/Sources/c_snikket/iinclude/tink/streams/Generator.h b/Sources/c_snikket/iinclude/tink/streams/Generator.h
new file mode 100644
index 0000000..62a0082
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/streams/Generator.h
@@ -0,0 +1,61 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_Generator
+#define INCLUDED_tink_streams_Generator
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_streams_StreamBase
+#include <tink/streams/StreamBase.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,streams,Generator)
+HX_DECLARE_CLASS2(tink,streams,StreamBase)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace streams{
+
+
+class HXCPP_CLASS_ATTRIBUTES Generator_obj : public ::tink::streams::StreamBase_obj
+{
+ public:
+ typedef ::tink::streams::StreamBase_obj super;
+ typedef Generator_obj OBJ_;
+ Generator_obj();
+
+ public:
+ enum { _hx_ClassId = 0x50a767d2 };
+
+ void __construct( ::tink::core::_Future::FutureObject upcoming);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.streams.Generator")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.streams.Generator"); }
+ static ::hx::ObjectPtr< Generator_obj > __new( ::tink::core::_Future::FutureObject upcoming);
+ static ::hx::ObjectPtr< Generator_obj > __alloc(::hx::Ctx *_hx_ctx, ::tink::core::_Future::FutureObject upcoming);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Generator_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Generator",33,d8,43,36); }
+
+ ::tink::core::_Future::FutureObject upcoming;
+ ::tink::core::_Future::FutureObject forEach( ::Dynamic handler);
+
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_Generator */
diff --git a/Sources/c_snikket/iinclude/tink/streams/Handled.h b/Sources/c_snikket/iinclude/tink/streams/Handled.h
new file mode 100644
index 0000000..f35f350
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/streams/Handled.h
@@ -0,0 +1,42 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_Handled
+#define INCLUDED_tink_streams_Handled
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS2(tink,streams,Handled)
+namespace tink{
+namespace streams{
+
+
+class Handled_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef Handled_obj OBJ_;
+
+ public:
+ Handled_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.streams.Handled",a5,94,ee,d9); }
+ ::String __ToString() const { return HX_("Handled.",12,d1,d5,ae) + _hx_tag; }
+
+ static ::tink::streams::Handled BackOff;
+ static inline ::tink::streams::Handled BackOff_dyn() { return BackOff; }
+ static ::tink::streams::Handled Clog( ::tink::core::TypedError e);
+ static ::Dynamic Clog_dyn();
+ static ::tink::streams::Handled Finish;
+ static inline ::tink::streams::Handled Finish_dyn() { return Finish; }
+ static ::tink::streams::Handled Resume;
+ static inline ::tink::streams::Handled Resume_dyn() { return Resume; }
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_Handled */
diff --git a/Sources/c_snikket/iinclude/tink/streams/IdealStreamBase.h b/Sources/c_snikket/iinclude/tink/streams/IdealStreamBase.h
new file mode 100644
index 0000000..6d2b2da
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/streams/IdealStreamBase.h
@@ -0,0 +1,56 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_IdealStreamBase
+#define INCLUDED_tink_streams_IdealStreamBase
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_streams_StreamBase
+#include <tink/streams/StreamBase.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS2(tink,streams,IdealStreamBase)
+HX_DECLARE_CLASS2(tink,streams,StreamBase)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace streams{
+
+
+class HXCPP_CLASS_ATTRIBUTES IdealStreamBase_obj : public ::tink::streams::StreamBase_obj
+{
+ public:
+ typedef ::tink::streams::StreamBase_obj super;
+ typedef IdealStreamBase_obj OBJ_;
+ IdealStreamBase_obj();
+
+ public:
+ enum { _hx_ClassId = 0x79ca79c9 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.streams.IdealStreamBase")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.streams.IdealStreamBase"); }
+ static ::hx::ObjectPtr< IdealStreamBase_obj > __new();
+ static ::hx::ObjectPtr< IdealStreamBase_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~IdealStreamBase_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("IdealStreamBase",86,d8,f0,d8); }
+
+ ::Dynamic idealize( ::Dynamic _tmp_rescue);
+
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_IdealStreamBase */
diff --git a/Sources/c_snikket/iinclude/tink/streams/IdealizeStream.h b/Sources/c_snikket/iinclude/tink/streams/IdealizeStream.h
new file mode 100644
index 0000000..ef12b38
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/streams/IdealizeStream.h
@@ -0,0 +1,67 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_IdealizeStream
+#define INCLUDED_tink_streams_IdealizeStream
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_streams_IdealStreamBase
+#include <tink/streams/IdealStreamBase.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,streams,IdealStreamBase)
+HX_DECLARE_CLASS2(tink,streams,IdealizeStream)
+HX_DECLARE_CLASS2(tink,streams,StreamBase)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace streams{
+
+
+class HXCPP_CLASS_ATTRIBUTES IdealizeStream_obj : public ::tink::streams::IdealStreamBase_obj
+{
+ public:
+ typedef ::tink::streams::IdealStreamBase_obj super;
+ typedef IdealizeStream_obj OBJ_;
+ IdealizeStream_obj();
+
+ public:
+ enum { _hx_ClassId = 0x15b188e0 };
+
+ void __construct(::Dynamic target, ::Dynamic rescue);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.streams.IdealizeStream")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.streams.IdealizeStream"); }
+ static ::hx::ObjectPtr< IdealizeStream_obj > __new(::Dynamic target, ::Dynamic rescue);
+ static ::hx::ObjectPtr< IdealizeStream_obj > __alloc(::hx::Ctx *_hx_ctx,::Dynamic target, ::Dynamic rescue);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~IdealizeStream_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("IdealizeStream",df,18,9d,1b); }
+
+ ::Dynamic target;
+ ::Dynamic rescue;
+ Dynamic rescue_dyn() { return rescue;}
+ bool get_depleted();
+
+ ::tink::core::_Future::FutureObject forEach( ::Dynamic handler);
+
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_IdealizeStream */
diff --git a/Sources/c_snikket/iinclude/tink/streams/Reduction.h b/Sources/c_snikket/iinclude/tink/streams/Reduction.h
new file mode 100644
index 0000000..5d8fe33
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/streams/Reduction.h
@@ -0,0 +1,41 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_Reduction
+#define INCLUDED_tink_streams_Reduction
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS2(tink,streams,Reduction)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+namespace tink{
+namespace streams{
+
+
+class Reduction_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef Reduction_obj OBJ_;
+
+ public:
+ Reduction_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.streams.Reduction",5c,50,fe,4b); }
+ ::String __ToString() const { return HX_("Reduction.",bb,b1,a8,cf) + _hx_tag; }
+
+ static ::tink::streams::Reduction Crashed( ::tink::core::TypedError error,::Dynamic at);
+ static ::Dynamic Crashed_dyn();
+ static ::tink::streams::Reduction Failed( ::tink::core::TypedError error);
+ static ::Dynamic Failed_dyn();
+ static ::tink::streams::Reduction Reduced( ::Dynamic result);
+ static ::Dynamic Reduced_dyn();
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_Reduction */
diff --git a/Sources/c_snikket/iinclude/tink/streams/ReductionStep.h b/Sources/c_snikket/iinclude/tink/streams/ReductionStep.h
new file mode 100644
index 0000000..a20fdfd
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/streams/ReductionStep.h
@@ -0,0 +1,38 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_ReductionStep
+#define INCLUDED_tink_streams_ReductionStep
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS2(tink,streams,ReductionStep)
+namespace tink{
+namespace streams{
+
+
+class ReductionStep_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef ReductionStep_obj OBJ_;
+
+ public:
+ ReductionStep_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.streams.ReductionStep",c8,c1,78,61); }
+ ::String __ToString() const { return HX_("ReductionStep.",4f,e7,10,f7) + _hx_tag; }
+
+ static ::tink::streams::ReductionStep Crash( ::tink::core::TypedError e);
+ static ::Dynamic Crash_dyn();
+ static ::tink::streams::ReductionStep Progress( ::Dynamic result);
+ static ::Dynamic Progress_dyn();
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_ReductionStep */
diff --git a/Sources/c_snikket/iinclude/tink/streams/RegroupResult.h b/Sources/c_snikket/iinclude/tink/streams/RegroupResult.h
new file mode 100644
index 0000000..d8b27a2
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/streams/RegroupResult.h
@@ -0,0 +1,44 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_RegroupResult
+#define INCLUDED_tink_streams_RegroupResult
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(haxe,ds,Option)
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS2(tink,streams,RegroupResult)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+namespace tink{
+namespace streams{
+
+
+class RegroupResult_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef RegroupResult_obj OBJ_;
+
+ public:
+ RegroupResult_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.streams.RegroupResult",52,26,01,31); }
+ ::String __ToString() const { return HX_("RegroupResult.",85,7b,e0,be) + _hx_tag; }
+
+ static ::tink::streams::RegroupResult Converted(::Dynamic data,::cpp::VirtualArray untouched);
+ static ::Dynamic Converted_dyn();
+ static ::tink::streams::RegroupResult Errored( ::tink::core::TypedError e);
+ static ::Dynamic Errored_dyn();
+ static ::tink::streams::RegroupResult Terminated( ::haxe::ds::Option data);
+ static ::Dynamic Terminated_dyn();
+ static ::tink::streams::RegroupResult Untouched;
+ static inline ::tink::streams::RegroupResult Untouched_dyn() { return Untouched; }
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_RegroupResult */
diff --git a/Sources/c_snikket/iinclude/tink/streams/RegroupStatus.h b/Sources/c_snikket/iinclude/tink/streams/RegroupStatus.h
new file mode 100644
index 0000000..7177b22
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/streams/RegroupStatus.h
@@ -0,0 +1,40 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_RegroupStatus
+#define INCLUDED_tink_streams_RegroupStatus
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS2(tink,streams,RegroupStatus)
+namespace tink{
+namespace streams{
+
+
+class RegroupStatus_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef RegroupStatus_obj OBJ_;
+
+ public:
+ RegroupStatus_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.streams.RegroupStatus",a7,a4,78,2e); }
+ ::String __ToString() const { return HX_("RegroupStatus.",90,87,f7,89) + _hx_tag; }
+
+ static ::tink::streams::RegroupStatus Ended;
+ static inline ::tink::streams::RegroupStatus Ended_dyn() { return Ended; }
+ static ::tink::streams::RegroupStatus Errored( ::tink::core::TypedError e);
+ static ::Dynamic Errored_dyn();
+ static ::tink::streams::RegroupStatus Flowing;
+ static inline ::tink::streams::RegroupStatus Flowing_dyn() { return Flowing; }
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_RegroupStatus */
diff --git a/Sources/c_snikket/iinclude/tink/streams/Single.h b/Sources/c_snikket/iinclude/tink/streams/Single.h
new file mode 100644
index 0000000..fc74928
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/streams/Single.h
@@ -0,0 +1,63 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_Single
+#define INCLUDED_tink_streams_Single
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_streams_StreamBase
+#include <tink/streams/StreamBase.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS3(tink,core,_Lazy,Computable)
+HX_DECLARE_CLASS3(tink,core,_Lazy,LazyObject)
+HX_DECLARE_CLASS2(tink,streams,Single)
+HX_DECLARE_CLASS2(tink,streams,StreamBase)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace streams{
+
+
+class HXCPP_CLASS_ATTRIBUTES Single_obj : public ::tink::streams::StreamBase_obj
+{
+ public:
+ typedef ::tink::streams::StreamBase_obj super;
+ typedef Single_obj OBJ_;
+ Single_obj();
+
+ public:
+ enum { _hx_ClassId = 0x2688f9e1 };
+
+ void __construct(::Dynamic value);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.streams.Single")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.streams.Single"); }
+ static ::hx::ObjectPtr< Single_obj > __new(::Dynamic value);
+ static ::hx::ObjectPtr< Single_obj > __alloc(::hx::Ctx *_hx_ctx,::Dynamic value);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Single_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Single",a8,da,b5,ed); }
+
+ ::Dynamic value;
+ ::tink::core::_Future::FutureObject forEach( ::Dynamic handle);
+
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_Single */
diff --git a/Sources/c_snikket/iinclude/tink/streams/Step.h b/Sources/c_snikket/iinclude/tink/streams/Step.h
new file mode 100644
index 0000000..e200806
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/streams/Step.h
@@ -0,0 +1,41 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_Step
+#define INCLUDED_tink_streams_Step
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS2(tink,streams,Step)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+namespace tink{
+namespace streams{
+
+
+class Step_obj : public ::hx::EnumBase_obj
+{
+ typedef ::hx::EnumBase_obj super;
+ typedef Step_obj OBJ_;
+
+ public:
+ Step_obj() {};
+ HX_DO_ENUM_RTTI;
+ static void __boot();
+ static void __register();
+ static bool __GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::String GetEnumName( ) const { return HX_("tink.streams.Step",c3,c6,00,cc); }
+ ::String __ToString() const { return HX_("Step.",42,eb,3b,17) + _hx_tag; }
+
+ static ::tink::streams::Step End;
+ static inline ::tink::streams::Step End_dyn() { return End; }
+ static ::tink::streams::Step Fail( ::tink::core::TypedError e);
+ static ::Dynamic Fail_dyn();
+ static ::tink::streams::Step Link( ::Dynamic value,::Dynamic next);
+ static ::Dynamic Link_dyn();
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_Step */
diff --git a/Sources/c_snikket/iinclude/tink/streams/StreamBase.h b/Sources/c_snikket/iinclude/tink/streams/StreamBase.h
new file mode 100644
index 0000000..92259cf
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/streams/StreamBase.h
@@ -0,0 +1,77 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_StreamBase
+#define INCLUDED_tink_streams_StreamBase
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_streams_StreamObject
+#include <tink/streams/StreamObject.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,streams,StreamBase)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace streams{
+
+
+class HXCPP_CLASS_ATTRIBUTES StreamBase_obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef StreamBase_obj OBJ_;
+ StreamBase_obj();
+
+ public:
+ enum { _hx_ClassId = 0x61521c8a };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.streams.StreamBase")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.streams.StreamBase"); }
+ static ::hx::ObjectPtr< StreamBase_obj > __new();
+ static ::hx::ObjectPtr< StreamBase_obj > __alloc(::hx::Ctx *_hx_ctx);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~StreamBase_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ void *_hx_getInterface(int inHash);
+ ::String __ToString() const { return HX_("StreamBase",d1,6c,2c,85); }
+
+ virtual bool get_depleted();
+ ::Dynamic get_depleted_dyn();
+
+ ::Dynamic regroup( ::Dynamic f);
+ ::Dynamic regroup_dyn();
+
+ ::Dynamic prepend(::Dynamic other);
+ ::Dynamic prepend_dyn();
+
+ virtual void decompose(::Array< ::Dynamic> into);
+ ::Dynamic decompose_dyn();
+
+ virtual ::Dynamic idealize( ::Dynamic rescue);
+ ::Dynamic idealize_dyn();
+
+ ::tink::core::_Future::FutureObject reduce( ::Dynamic initial, ::Dynamic reducer);
+ ::Dynamic reduce_dyn();
+
+ virtual ::tink::core::_Future::FutureObject forEach( ::Dynamic handler);
+ ::Dynamic forEach_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_StreamBase */
diff --git a/Sources/c_snikket/iinclude/tink/streams/StreamObject.h b/Sources/c_snikket/iinclude/tink/streams/StreamObject.h
new file mode 100644
index 0000000..5a2bbc9
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/streams/StreamObject.h
@@ -0,0 +1,55 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams_StreamObject
+#define INCLUDED_tink_streams_StreamObject
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+
+namespace tink{
+namespace streams{
+
+
+class HXCPP_CLASS_ATTRIBUTES StreamObject_obj {
+ public:
+ typedef ::hx::Object super;
+ HX_DO_INTERFACE_RTTI;
+
+ bool (::hx::Object :: *_hx_get_depleted)();
+ static inline bool get_depleted( ::Dynamic _hx_) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::streams::StreamObject_obj *>(_hx_.mPtr->_hx_getInterface(0x6164ac00)))->_hx_get_depleted)();
+ }
+ ::Dynamic (::hx::Object :: *_hx_regroup)( ::Dynamic f);
+ static inline ::Dynamic regroup( ::Dynamic _hx_, ::Dynamic f) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::streams::StreamObject_obj *>(_hx_.mPtr->_hx_getInterface(0x6164ac00)))->_hx_regroup)(f);
+ }
+ ::Dynamic (::hx::Object :: *_hx_idealize)( ::Dynamic rescue);
+ static inline ::Dynamic idealize( ::Dynamic _hx_, ::Dynamic rescue) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::streams::StreamObject_obj *>(_hx_.mPtr->_hx_getInterface(0x6164ac00)))->_hx_idealize)(rescue);
+ }
+ ::Dynamic (::hx::Object :: *_hx_prepend)(::Dynamic other);
+ static inline ::Dynamic prepend( ::Dynamic _hx_,::Dynamic other) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::streams::StreamObject_obj *>(_hx_.mPtr->_hx_getInterface(0x6164ac00)))->_hx_prepend)(other);
+ }
+ void (::hx::Object :: *_hx_decompose)(::Array< ::Dynamic> into);
+ static inline void decompose( ::Dynamic _hx_,::Array< ::Dynamic> into) {
+ (_hx_.mPtr->*( ::hx::interface_cast< ::tink::streams::StreamObject_obj *>(_hx_.mPtr->_hx_getInterface(0x6164ac00)))->_hx_decompose)(into);
+ }
+ ::tink::core::_Future::FutureObject (::hx::Object :: *_hx_forEach)( ::Dynamic handle);
+ static inline ::tink::core::_Future::FutureObject forEach( ::Dynamic _hx_, ::Dynamic handle) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::streams::StreamObject_obj *>(_hx_.mPtr->_hx_getInterface(0x6164ac00)))->_hx_forEach)(handle);
+ }
+ ::tink::core::_Future::FutureObject (::hx::Object :: *_hx_reduce)( ::Dynamic initial, ::Dynamic reducer);
+ static inline ::tink::core::_Future::FutureObject reduce( ::Dynamic _hx_, ::Dynamic initial, ::Dynamic reducer) {
+ return (_hx_.mPtr->*( ::hx::interface_cast< ::tink::streams::StreamObject_obj *>(_hx_.mPtr->_hx_getInterface(0x6164ac00)))->_hx_reduce)(initial,reducer);
+ }
+};
+
+} // end namespace tink
+} // end namespace streams
+
+#endif /* INCLUDED_tink_streams_StreamObject */
diff --git a/Sources/c_snikket/iinclude/tink/streams/_Stream/CompoundStream.h b/Sources/c_snikket/iinclude/tink/streams/_Stream/CompoundStream.h
new file mode 100644
index 0000000..529a9c5
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/streams/_Stream/CompoundStream.h
@@ -0,0 +1,75 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams__Stream_CompoundStream
+#define INCLUDED_tink_streams__Stream_CompoundStream
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_streams_StreamBase
+#include <tink/streams/StreamBase.h>
+#endif
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,streams,Conclusion)
+HX_DECLARE_CLASS2(tink,streams,StreamBase)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+HX_DECLARE_CLASS3(tink,streams,_Stream,CompoundStream)
+
+namespace tink{
+namespace streams{
+namespace _Stream{
+
+
+class HXCPP_CLASS_ATTRIBUTES CompoundStream_obj : public ::tink::streams::StreamBase_obj
+{
+ public:
+ typedef ::tink::streams::StreamBase_obj super;
+ typedef CompoundStream_obj OBJ_;
+ CompoundStream_obj();
+
+ public:
+ enum { _hx_ClassId = 0x56b49549 };
+
+ void __construct(::Array< ::Dynamic> parts);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.streams._Stream.CompoundStream")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.streams._Stream.CompoundStream"); }
+ static ::hx::ObjectPtr< CompoundStream_obj > __new(::Array< ::Dynamic> parts);
+ static ::hx::ObjectPtr< CompoundStream_obj > __alloc(::hx::Ctx *_hx_ctx,::Array< ::Dynamic> parts);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~CompoundStream_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("CompoundStream",6b,c2,13,72); }
+
+ static void consumeParts(::Array< ::Dynamic> parts, ::Dynamic handler, ::Dynamic cb);
+ static ::Dynamic consumeParts_dyn();
+
+ static ::Dynamic of(::Array< ::Dynamic> streams);
+ static ::Dynamic of_dyn();
+
+ ::Array< ::Dynamic> parts;
+ bool get_depleted();
+
+ void decompose(::Array< ::Dynamic> into);
+
+ ::tink::core::_Future::FutureObject forEach( ::Dynamic handler);
+
+};
+
+} // end namespace tink
+} // end namespace streams
+} // end namespace _Stream
+
+#endif /* INCLUDED_tink_streams__Stream_CompoundStream */
diff --git a/Sources/c_snikket/iinclude/tink/streams/_Stream/ErrorStream.h b/Sources/c_snikket/iinclude/tink/streams/_Stream/ErrorStream.h
new file mode 100644
index 0000000..609ab95
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/streams/_Stream/ErrorStream.h
@@ -0,0 +1,64 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams__Stream_ErrorStream
+#define INCLUDED_tink_streams__Stream_ErrorStream
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_streams_StreamBase
+#include <tink/streams/StreamBase.h>
+#endif
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,streams,StreamBase)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+HX_DECLARE_CLASS3(tink,streams,_Stream,ErrorStream)
+
+namespace tink{
+namespace streams{
+namespace _Stream{
+
+
+class HXCPP_CLASS_ATTRIBUTES ErrorStream_obj : public ::tink::streams::StreamBase_obj
+{
+ public:
+ typedef ::tink::streams::StreamBase_obj super;
+ typedef ErrorStream_obj OBJ_;
+ ErrorStream_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1afcc8aa };
+
+ void __construct( ::tink::core::TypedError error);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.streams._Stream.ErrorStream")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.streams._Stream.ErrorStream"); }
+ static ::hx::ObjectPtr< ErrorStream_obj > __new( ::tink::core::TypedError error);
+ static ::hx::ObjectPtr< ErrorStream_obj > __alloc(::hx::Ctx *_hx_ctx, ::tink::core::TypedError error);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~ErrorStream_obj();
+
+ HX_DO_RTTI_ALL;
+ ::hx::Val __Field(const ::String &inString, ::hx::PropertyAccess inCallProp);
+ ::hx::Val __SetField(const ::String &inString,const ::hx::Val &inValue, ::hx::PropertyAccess inCallProp);
+ void __GetFields(Array< ::String> &outFields);
+ static void __register();
+ void __Mark(HX_MARK_PARAMS);
+ void __Visit(HX_VISIT_PARAMS);
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("ErrorStream",48,f2,cc,e3); }
+
+ ::tink::core::TypedError error;
+ ::tink::core::_Future::FutureObject forEach( ::Dynamic handler);
+
+};
+
+} // end namespace tink
+} // end namespace streams
+} // end namespace _Stream
+
+#endif /* INCLUDED_tink_streams__Stream_ErrorStream */
diff --git a/Sources/c_snikket/iinclude/tink/streams/_Stream/Handler_Impl_.h b/Sources/c_snikket/iinclude/tink/streams/_Stream/Handler_Impl_.h
new file mode 100644
index 0000000..2e0cf9a
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/streams/_Stream/Handler_Impl_.h
@@ -0,0 +1,69 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams__Stream_Handler_Impl_
+#define INCLUDED_tink_streams__Stream_Handler_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,streams,Handled)
+HX_DECLARE_CLASS3(tink,streams,_Stream,Handler_Impl_)
+
+namespace tink{
+namespace streams{
+namespace _Stream{
+
+
+class HXCPP_CLASS_ATTRIBUTES Handler_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Handler_Impl__obj OBJ_;
+ Handler_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x065ceae4 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.streams._Stream.Handler_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.streams._Stream.Handler_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Handler_Impl__obj > __new() {
+ ::hx::ObjectPtr< Handler_Impl__obj > __this = new Handler_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Handler_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Handler_Impl__obj *__this = (Handler_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Handler_Impl__obj), false, "tink.streams._Stream.Handler_Impl_"));
+ *(void **)__this = Handler_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Handler_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Handler_Impl_",ca,2f,2c,64); }
+
+ static ::Dynamic ofSafeSync( ::Dynamic f);
+ static ::Dynamic ofSafeSync_dyn();
+
+ static ::Dynamic ofUnknown( ::Dynamic f);
+ static ::Dynamic ofUnknown_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace streams
+} // end namespace _Stream
+
+#endif /* INCLUDED_tink_streams__Stream_Handler_Impl_ */
diff --git a/Sources/c_snikket/iinclude/tink/streams/_Stream/Reducer_Impl_.h b/Sources/c_snikket/iinclude/tink/streams/_Stream/Reducer_Impl_.h
new file mode 100644
index 0000000..3308ef5
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/streams/_Stream/Reducer_Impl_.h
@@ -0,0 +1,66 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams__Stream_Reducer_Impl_
+#define INCLUDED_tink_streams__Stream_Reducer_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,streams,ReductionStep)
+HX_DECLARE_CLASS3(tink,streams,_Stream,Reducer_Impl_)
+
+namespace tink{
+namespace streams{
+namespace _Stream{
+
+
+class HXCPP_CLASS_ATTRIBUTES Reducer_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Reducer_Impl__obj OBJ_;
+ Reducer_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x18a49ca6 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.streams._Stream.Reducer_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.streams._Stream.Reducer_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Reducer_Impl__obj > __new() {
+ ::hx::ObjectPtr< Reducer_Impl__obj > __this = new Reducer_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Reducer_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Reducer_Impl__obj *__this = (Reducer_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Reducer_Impl__obj), false, "tink.streams._Stream.Reducer_Impl_"));
+ *(void **)__this = Reducer_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Reducer_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Reducer_Impl_",8c,e1,73,76); }
+
+ static ::Dynamic ofSafeSync( ::Dynamic f);
+ static ::Dynamic ofSafeSync_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace streams
+} // end namespace _Stream
+
+#endif /* INCLUDED_tink_streams__Stream_Reducer_Impl_ */
diff --git a/Sources/c_snikket/iinclude/tink/streams/_Stream/RegroupStream.h b/Sources/c_snikket/iinclude/tink/streams/_Stream/RegroupStream.h
new file mode 100644
index 0000000..b268759
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/streams/_Stream/RegroupStream.h
@@ -0,0 +1,55 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams__Stream_RegroupStream
+#define INCLUDED_tink_streams__Stream_RegroupStream
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+#ifndef INCLUDED_tink_streams__Stream_CompoundStream
+#include <tink/streams/_Stream/CompoundStream.h>
+#endif
+HX_DECLARE_CLASS2(tink,streams,StreamBase)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+HX_DECLARE_CLASS3(tink,streams,_Stream,CompoundStream)
+HX_DECLARE_CLASS3(tink,streams,_Stream,RegroupStream)
+
+namespace tink{
+namespace streams{
+namespace _Stream{
+
+
+class HXCPP_CLASS_ATTRIBUTES RegroupStream_obj : public ::tink::streams::_Stream::CompoundStream_obj
+{
+ public:
+ typedef ::tink::streams::_Stream::CompoundStream_obj super;
+ typedef RegroupStream_obj OBJ_;
+ RegroupStream_obj();
+
+ public:
+ enum { _hx_ClassId = 0x1850db0e };
+
+ void __construct(::Dynamic source, ::Dynamic f,::Dynamic prev,::cpp::VirtualArray buf);
+ inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="tink.streams._Stream.RegroupStream")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,true,"tink.streams._Stream.RegroupStream"); }
+ static ::hx::ObjectPtr< RegroupStream_obj > __new(::Dynamic source, ::Dynamic f,::Dynamic prev,::cpp::VirtualArray buf);
+ static ::hx::ObjectPtr< RegroupStream_obj > __alloc(::hx::Ctx *_hx_ctx,::Dynamic source, ::Dynamic f,::Dynamic prev,::cpp::VirtualArray buf);
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~RegroupStream_obj();
+
+ HX_DO_RTTI_ALL;
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("RegroupStream",2c,28,b5,d4); }
+
+};
+
+} // end namespace tink
+} // end namespace streams
+} // end namespace _Stream
+
+#endif /* INCLUDED_tink_streams__Stream_RegroupStream */
diff --git a/Sources/c_snikket/iinclude/tink/streams/_Stream/Regrouper_Impl_.h b/Sources/c_snikket/iinclude/tink/streams/_Stream/Regrouper_Impl_.h
new file mode 100644
index 0000000..72afba4
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/streams/_Stream/Regrouper_Impl_.h
@@ -0,0 +1,65 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams__Stream_Regrouper_Impl_
+#define INCLUDED_tink_streams__Stream_Regrouper_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,streams,RegroupResult)
+HX_DECLARE_CLASS3(tink,streams,_Stream,Regrouper_Impl_)
+
+namespace tink{
+namespace streams{
+namespace _Stream{
+
+
+class HXCPP_CLASS_ATTRIBUTES Regrouper_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Regrouper_Impl__obj OBJ_;
+ Regrouper_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x74da6ebb };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.streams._Stream.Regrouper_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.streams._Stream.Regrouper_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Regrouper_Impl__obj > __new() {
+ ::hx::ObjectPtr< Regrouper_Impl__obj > __this = new Regrouper_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Regrouper_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Regrouper_Impl__obj *__this = (Regrouper_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Regrouper_Impl__obj), false, "tink.streams._Stream.Regrouper_Impl_"));
+ *(void **)__this = Regrouper_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Regrouper_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Regrouper_Impl_",59,bf,c2,4c); }
+
+ static ::Dynamic ofIgnoranceSync( ::Dynamic f);
+ static ::Dynamic ofIgnoranceSync_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace streams
+} // end namespace _Stream
+
+#endif /* INCLUDED_tink_streams__Stream_Regrouper_Impl_ */
diff --git a/Sources/c_snikket/iinclude/tink/streams/_Stream/Stream_Impl_.h b/Sources/c_snikket/iinclude/tink/streams/_Stream/Stream_Impl_.h
new file mode 100644
index 0000000..776c5cc
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/streams/_Stream/Stream_Impl_.h
@@ -0,0 +1,73 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_streams__Stream_Stream_Impl_
+#define INCLUDED_tink_streams__Stream_Stream_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS2(tink,core,TypedError)
+HX_DECLARE_CLASS3(tink,core,_Future,FutureObject)
+HX_DECLARE_CLASS2(tink,streams,StreamObject)
+HX_DECLARE_CLASS3(tink,streams,_Stream,Stream_Impl_)
+
+namespace tink{
+namespace streams{
+namespace _Stream{
+
+
+class HXCPP_CLASS_ATTRIBUTES Stream_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Stream_Impl__obj OBJ_;
+ Stream_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x5036bc9e };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.streams._Stream.Stream_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.streams._Stream.Stream_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Stream_Impl__obj > __new() {
+ ::hx::ObjectPtr< Stream_Impl__obj > __this = new Stream_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Stream_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Stream_Impl__obj *__this = (Stream_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Stream_Impl__obj), false, "tink.streams._Stream.Stream_Impl_"));
+ *(void **)__this = Stream_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Stream_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Stream_Impl_",40,fd,8a,3d); }
+
+ static ::Dynamic single( ::Dynamic i);
+ static ::Dynamic single_dyn();
+
+ static ::Dynamic future( ::tink::core::_Future::FutureObject f);
+ static ::Dynamic future_dyn();
+
+ static ::Dynamic ofError( ::tink::core::TypedError e);
+ static ::Dynamic ofError_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace streams
+} // end namespace _Stream
+
+#endif /* INCLUDED_tink_streams__Stream_Stream_Impl_ */
diff --git a/Sources/c_snikket/iinclude/tink/url/_Host/Host_Impl_.h b/Sources/c_snikket/iinclude/tink/url/_Host/Host_Impl_.h
new file mode 100644
index 0000000..3db7153
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/url/_Host/Host_Impl_.h
@@ -0,0 +1,70 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_url__Host_Host_Impl_
+#define INCLUDED_tink_url__Host_Host_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,url,_Host,Host_Impl_)
+
+namespace tink{
+namespace url{
+namespace _Host{
+
+
+class HXCPP_CLASS_ATTRIBUTES Host_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Host_Impl__obj OBJ_;
+ Host_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x20d53a72 };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.url._Host.Host_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.url._Host.Host_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Host_Impl__obj > __new() {
+ ::hx::ObjectPtr< Host_Impl__obj > __this = new Host_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Host_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Host_Impl__obj *__this = (Host_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Host_Impl__obj), false, "tink.url._Host.Host_Impl_"));
+ *(void **)__this = Host_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Host_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Host_Impl_",28,8e,8a,61); }
+
+ static ::String _new(::String name, ::Dynamic port);
+ static ::Dynamic _new_dyn();
+
+ static ::String get_name(::String this1);
+ static ::Dynamic get_name_dyn();
+
+ static ::Dynamic get_port(::String this1);
+ static ::Dynamic get_port_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace url
+} // end namespace _Host
+
+#endif /* INCLUDED_tink_url__Host_Host_Impl_ */
diff --git a/Sources/c_snikket/iinclude/tink/url/_Path/Path_Impl_.h b/Sources/c_snikket/iinclude/tink/url/_Path/Path_Impl_.h
new file mode 100644
index 0000000..25b6b43
--- /dev/null
+++ b/Sources/c_snikket/iinclude/tink/url/_Path/Path_Impl_.h
@@ -0,0 +1,70 @@
+// Generated by Haxe 4.3.3
+#ifndef INCLUDED_tink_url__Path_Path_Impl_
+#define INCLUDED_tink_url__Path_Path_Impl_
+
+#ifndef HXCPP_H
+#include <hxcpp.h>
+#endif
+
+HX_DECLARE_CLASS3(tink,url,_Path,Path_Impl_)
+
+namespace tink{
+namespace url{
+namespace _Path{
+
+
+class HXCPP_CLASS_ATTRIBUTES Path_Impl__obj : public ::hx::Object
+{
+ public:
+ typedef ::hx::Object super;
+ typedef Path_Impl__obj OBJ_;
+ Path_Impl__obj();
+
+ public:
+ enum { _hx_ClassId = 0x718c1a2c };
+
+ void __construct();
+ inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="tink.url._Path.Path_Impl_")
+ { return ::hx::Object::operator new(inSize,inContainer,inName); }
+ inline void *operator new(size_t inSize, int extra)
+ { return ::hx::Object::operator new(inSize+extra,false,"tink.url._Path.Path_Impl_"); }
+
+ inline static ::hx::ObjectPtr< Path_Impl__obj > __new() {
+ ::hx::ObjectPtr< Path_Impl__obj > __this = new Path_Impl__obj();
+ __this->__construct();
+ return __this;
+ }
+
+ inline static ::hx::ObjectPtr< Path_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) {
+ Path_Impl__obj *__this = (Path_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Path_Impl__obj), false, "tink.url._Path.Path_Impl_"));
+ *(void **)__this = Path_Impl__obj::_hx_vtable;
+ return __this;
+ }
+
+ static void * _hx_vtable;
+ static Dynamic __CreateEmpty();
+ static Dynamic __Create(::hx::DynamicArray inArgs);
+ //~Path_Impl__obj();
+
+ HX_DO_RTTI_ALL;
+ static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp);
+ static void __register();
+ bool _hx_isInstanceOf(int inClassId);
+ ::String __ToString() const { return HX_("Path_Impl_",25,70,db,20); }
+
+ static ::String join(::String this1,::String that);
+ static ::Dynamic join_dyn();
+
+ static ::String ofString(::String s);
+ static ::Dynamic ofString_dyn();
+
+ static ::String normalize(::String s);
+ static ::Dynamic normalize_dyn();
+
+};
+
+} // end namespace tink
+} // end namespace url
+} // end namespace _Path
+
+#endif /* INCLUDED_tink_url__Path_Path_Impl_ */
diff --git a/Sources/c_snikket/include/snikket.h b/Sources/c_snikket/include/snikket.h
new file mode 100644
index 0000000..a294c1b
--- /dev/null
+++ b/Sources/c_snikket/include/snikket.h
@@ -0,0 +1,1002 @@
+/**
+ * \file snikket.h the Snikket SDK for C
+ *
+ * Everything returned from an SDK procedure or passed to a function
+ * pointer, both strings and opaque types, must be passed to
+ * snikket_release when you are done with it.
+ */
+
+#ifndef __SNIKKET_H
+#define __SNIKKET_H
+
+#ifndef MKDOCS
+#include <stdbool.h>
+#include <stddef.h>
+
+#ifndef API_PREFIX
+ #ifdef _WIN32
+ #define API_PREFIX __declspec(dllimport)
+ #else
+ #define API_PREFIX
+ #endif
+#endif
+
+#endif
+
+typedef void (*snikket_panic_callback) (const char *info);
+
+enum
+#ifdef __clang__
+__attribute__((enum_extensibility(closed)))
+#endif
+snikket_message_type {
+ MessageChat = 0,
+ MessageCall = 1,
+ MessageChannel = 2,
+ MessageChannelPrivate = 3
+};
+
+enum
+#ifdef __clang__
+__attribute__((enum_extensibility(closed)))
+#endif
+snikket_message_direction {
+ MessageReceived = 0,
+ MessageSent = 1
+};
+
+enum
+#ifdef __clang__
+__attribute__((enum_extensibility(closed)))
+#endif
+snikket_message_status {
+ MessagePending = 0,
+ MessageDeliveredToServer = 1,
+ MessageDeliveredToDevice = 2,
+ MessageFailedToSend = 3
+};
+
+enum
+#ifdef __clang__
+__attribute__((enum_extensibility(closed)))
+#endif
+snikket_ui_state {
+ Pinned = 0,
+ Open = 1,
+ Closed = 2
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Initializes the SDK
+ *
+ * This must be first before calling SDK functions (otherwise those calls will hang waiting for a response).
+ *
+ * @param panicCallback a callback to execute if the SDK panics. The SDK will continue processing events after a panic and you may want to stop it after receiving this callback. Use `NULL` for no callback
+ * @returns `NULL` if the thread initializes successfully or a null-terminated C string if an error occurs during initialization
+ */
+API_PREFIX const char *snikket_setup(snikket_panic_callback panic_callback);
+
+/**
+ * Stops the SDK, blocking until the main thread has completed. Once ended, it cannot be restarted (this is because static variable state will be retained from the last run).
+ *
+ * It can be safely called any number of times – if the SDK is not running this function will just return.
+ *
+ * After executing no more calls to SDK functions can be made (as these will hang waiting for a response).
+ *
+ * Thread-safety: Can be called safely called on any thread.
+ *
+ * @param wait If `true`, this function will wait for all events scheduled to execute in the future on the SDK thread to complete. If `false`, immediate pending events will be finished and the SDK stopped without executing events scheduled in the future
+ */
+API_PREFIX void snikket_stop(bool wait);
+
+/**
+ * Informs the garbage collector that object is no longer needed by the C code.
+ *
+ * If the object has no remaining reference the garbage collector can free the associated memory (which can happen at any time in the future). It does not free the memory immediately.
+ *
+ * Thread-safety: can be called on any thread.
+ *
+ * @param ptr a handle to an arbitrary SDK object returned from an SDK function
+ */
+API_PREFIX void snikket_release(const void *ptr);
+
+API_PREFIX void *snikket_persistence_media_store_f_s_new(const char *path);
+
+API_PREFIX void snikket_persistence_media_store_f_s_get_media_path(void *media_store_fs, const char *uri, void (*callback) (const char*, void*), void *callback__context);
+
+/**
+ * Create a basic persistence layer based on sqlite
+ *
+ * @param dbfile path to sqlite database
+ * @params media a MediaStore to use for media
+ * @returns new persistence layer
+ */
+API_PREFIX void *snikket_persistence_sqlite_new(const char *dbfile, void *media);
+
+API_PREFIX void snikket_persistence_sqlite_get_message(void *sqlite, const char *accountId, const char *chatId, const char *serverId, const char *localId, void (*callback) (void*, void*), void *callback__context);
+
+API_PREFIX void snikket_persistence_sqlite_remove_account(void *sqlite, const char *accountId, bool completely);
+
+API_PREFIX void snikket_persistence_sqlite_list_accounts(void *sqlite, void (*callback) (const char**, size_t, void*), void *callback__context);
+
+/**
+ * The ID as set by the creator of this message
+ */
+API_PREFIX const char *snikket_chat_message_local_id(void *chat_message);
+
+/**
+ * The ID as set by the authoritative server
+ */
+API_PREFIX const char *snikket_chat_message_server_id(void *chat_message);
+
+/**
+ * The ID of the server which set the serverId
+ */
+API_PREFIX const char *snikket_chat_message_server_id_by(void *chat_message);
+
+/**
+ * The type of this message (Chat, Call, etc)
+ */
+API_PREFIX enum snikket_message_type snikket_chat_message_type(void *chat_message);
+
+/**
+ * The timestamp of this message, in format YYYY-MM-DDThh:mm:ss[.sss]Z
+ */
+API_PREFIX const char *snikket_chat_message_timestamp(void *chat_message);
+
+/**
+ * The ID of the sender of this message
+ */
+API_PREFIX const char *snikket_chat_message_sender_id(void *chat_message);
+
+/**
+ * Message this one is in reply to, or NULL
+ */
+API_PREFIX void *snikket_chat_message_reply_to_message(void *chat_message);
+
+/**
+ * ID of the thread this message is in, or NULL
+ */
+API_PREFIX const char *snikket_chat_message_thread_id(void *chat_message);
+
+/**
+ * Array of attachments to this message
+ */
+API_PREFIX size_t snikket_chat_message_attachments(void *chat_message, void ***outPtr);
+
+/**
+ * Body text of this message or NULL
+ */
+API_PREFIX const char *snikket_chat_message_text(void *chat_message);
+
+/**
+ * Language code for the body text
+ */
+API_PREFIX const char *snikket_chat_message_lang(void *chat_message);
+
+/**
+ * Direction of this message
+ */
+API_PREFIX enum snikket_message_direction snikket_chat_message_direction(void *chat_message);
+
+/**
+ * Status of this message
+ */
+API_PREFIX enum snikket_message_status snikket_chat_message_status(void *chat_message);
+
+/**
+ * Status of this message
+ */
+API_PREFIX void snikket_chat_message_set_status(void *chat_message, enum snikket_message_status value);
+
+/**
+ * Array of past versions of this message, if it has been edited
+ */
+API_PREFIX size_t snikket_chat_message_versions(void *chat_message, void ***outPtr);
+
+/**
+ * Create a new ChatMessage in reply to this one
+ */
+API_PREFIX void *snikket_chat_message_reply(void *chat_message);
+
+API_PREFIX const char *snikket_chat_message_get_reply_id(void *chat_message);
+
+/**
+ * Get HTML version of the message body
+ *
+ * WARNING: this is possibly untrusted HTML. You must parse or sanitize appropriately!
+ */
+API_PREFIX const char *snikket_chat_message_html(void *chat_message);
+
+/**
+ * The ID of the Chat this message is associated with
+ */
+API_PREFIX const char *snikket_chat_message_chat_id(void *chat_message);
+
+/**
+ * The ID of the account associated with this message
+ */
+API_PREFIX const char *snikket_chat_message_account(void *chat_message);
+
+/**
+ * Is this an incoming message?
+ */
+API_PREFIX bool snikket_chat_message_is_incoming(void *chat_message);
+
+/**
+ * The URI of an icon for the thread associated with this message, or NULL
+ */
+API_PREFIX const char *snikket_chat_message_thread_icon(void *chat_message);
+
+/**
+ * The last status of the call if this message is related to a call
+ */
+API_PREFIX const char *snikket_chat_message_call_status(void *chat_message);
+
+/**
+ * The session id of the call if this message is related to a call
+ */
+API_PREFIX const char *snikket_chat_message_call_sid(void *chat_message);
+
+/**
+ * The duration of the call if this message is related to a call
+ */
+API_PREFIX const char *snikket_chat_message_call_duration(void *chat_message);
+
+API_PREFIX void *snikket_chat_attachment_create(const char *name, const char *mime, int size, const char *uri);
+
+API_PREFIX const char *snikket_chat_attachment_name(void *chat_attachment);
+
+API_PREFIX const char *snikket_chat_attachment_mime(void *chat_attachment);
+
+API_PREFIX int snikket_chat_attachment_size(void *chat_attachment);
+
+API_PREFIX size_t snikket_chat_attachment_uris(void *chat_attachment, const char ***outPtr);
+
+API_PREFIX size_t snikket_chat_attachment_hashes(void *chat_attachment, void ***outPtr);
+
+API_PREFIX void *snikket_hash_from_hex(const char *algorithm, const char *hash);
+
+API_PREFIX void *snikket_hash_from_uri(const char *uri);
+
+API_PREFIX const char *snikket_hash_algorithm(void *hash);
+
+API_PREFIX const char *snikket_hash_to_uri(void *hash);
+
+API_PREFIX const char *snikket_hash_to_hex(void *hash);
+
+API_PREFIX const char *snikket_hash_to_base_64(void *hash);
+
+API_PREFIX const char *snikket_hash_to_base_64_url(void *hash);
+
+/**
+ * @returns a new blank ChatMessageBuilder
+ */
+API_PREFIX void *snikket_chat_message_builder_new();
+
+/**
+ * The ID as set by the creator of this message
+ */
+API_PREFIX const char *snikket_chat_message_builder_local_id(void *chat_message_builder);
+
+/**
+ * The ID as set by the creator of this message
+ */
+API_PREFIX void snikket_chat_message_builder_set_local_id(void *chat_message_builder, const char *value);
+
+/**
+ * The ID as set by the authoritative server
+ */
+API_PREFIX const char *snikket_chat_message_builder_server_id(void *chat_message_builder);
+
+/**
+ * The ID as set by the authoritative server
+ */
+API_PREFIX void snikket_chat_message_builder_set_server_id(void *chat_message_builder, const char *value);
+
+/**
+ * The ID of the server which set the serverId
+ */
+API_PREFIX const char *snikket_chat_message_builder_server_id_by(void *chat_message_builder);
+
+/**
+ * The ID of the server which set the serverId
+ */
+API_PREFIX void snikket_chat_message_builder_set_server_id_by(void *chat_message_builder, const char *value);
+
+/**
+ * The type of this message (Chat, Call, etc)
+ */
+API_PREFIX enum snikket_message_type snikket_chat_message_builder_type(void *chat_message_builder);
+
+/**
+ * The type of this message (Chat, Call, etc)
+ */
+API_PREFIX void snikket_chat_message_builder_set_type(void *chat_message_builder, enum snikket_message_type value);
+
+/**
+ * The timestamp of this message, in format YYYY-MM-DDThh:mm:ss[.sss]+00:00
+ */
+API_PREFIX const char *snikket_chat_message_builder_timestamp(void *chat_message_builder);
+
+/**
+ * The timestamp of this message, in format YYYY-MM-DDThh:mm:ss[.sss]+00:00
+ */
+API_PREFIX void snikket_chat_message_builder_set_timestamp(void *chat_message_builder, const char *value);
+
+API_PREFIX const char *snikket_chat_message_builder_sender_id(void *chat_message_builder);
+
+API_PREFIX void snikket_chat_message_builder_set_sender_id(void *chat_message_builder, const char *value);
+
+/**
+ * Message this one is in reply to, or NULL
+ */
+API_PREFIX void *snikket_chat_message_builder_reply_to_message(void *chat_message_builder);
+
+/**
+ * Message this one is in reply to, or NULL
+ */
+API_PREFIX void snikket_chat_message_builder_set_reply_to_message(void *chat_message_builder, void *value);
+
+/**
+ * ID of the thread this message is in, or NULL
+ */
+API_PREFIX const char *snikket_chat_message_builder_thread_id(void *chat_message_builder);
+
+/**
+ * ID of the thread this message is in, or NULL
+ */
+API_PREFIX void snikket_chat_message_builder_set_thread_id(void *chat_message_builder, const char *value);
+
+/**
+ * Array of attachments to this message
+ */
+API_PREFIX size_t snikket_chat_message_builder_attachments(void *chat_message_builder, void ***outPtr);
+
+/**
+ * Body text of this message or NULL
+ */
+API_PREFIX const char *snikket_chat_message_builder_text(void *chat_message_builder);
+
+/**
+ * Body text of this message or NULL
+ */
+API_PREFIX void snikket_chat_message_builder_set_text(void *chat_message_builder, const char *value);
+
+/**
+ * Language code for the body text
+ */
+API_PREFIX const char *snikket_chat_message_builder_lang(void *chat_message_builder);
+
+/**
+ * Language code for the body text
+ */
+API_PREFIX void snikket_chat_message_builder_set_lang(void *chat_message_builder, const char *value);
+
+/**
+ * Direction of this message
+ */
+API_PREFIX enum snikket_message_direction snikket_chat_message_builder_direction(void *chat_message_builder);
+
+/**
+ * Direction of this message
+ */
+API_PREFIX void snikket_chat_message_builder_set_direction(void *chat_message_builder, enum snikket_message_direction value);
+
+/**
+ * Status of this message
+ */
+API_PREFIX enum snikket_message_status snikket_chat_message_builder_status(void *chat_message_builder);
+
+/**
+ * Status of this message
+ */
+API_PREFIX void snikket_chat_message_builder_set_status(void *chat_message_builder, enum snikket_message_status value);
+
+/**
+ * Array of past versions of this message, if it has been edited
+ */
+API_PREFIX size_t snikket_chat_message_builder_versions(void *chat_message_builder, void ***outPtr);
+
+API_PREFIX void snikket_chat_message_builder_add_attachment(void *chat_message_builder, void *attachment);
+
+/**
+ * Set rich text using an HTML string
+ * Also sets the plain text body appropriately
+ */
+API_PREFIX void snikket_chat_message_builder_set_html(void *chat_message_builder, const char *html);
+
+/**
+ * The ID of the Chat this message is associated with
+ */
+API_PREFIX const char *snikket_chat_message_builder_chat_id(void *chat_message_builder);
+
+/**
+ * The ID of the sender of this message
+ */
+API_PREFIX const char *snikket_chat_message_builder_get_sender_id(void *chat_message_builder);
+
+API_PREFIX bool snikket_chat_message_builder_is_incoming(void *chat_message_builder);
+
+API_PREFIX void *snikket_chat_message_builder_build(void *chat_message_builder);
+
+/**
+ * Create a basic persistence layer that persists nothing
+ *
+ * @returns new persistence layer
+ */
+API_PREFIX void *snikket_persistence_dummy_new();
+
+/**
+ * Create a new Client to connect to a particular account
+ *
+ * @param address the account to connect to
+ * @param persistence the persistence layer to use for storage
+ */
+API_PREFIX void *snikket_client_new(const char *address, void *persistence);
+
+/**
+ * Set to false to suppress sending available presence
+ */
+API_PREFIX void snikket_client_set_send_available(void *client, bool value);
+
+/**
+ * Start this client running and trying to connect to the server
+ */
+API_PREFIX void snikket_client_start(void *client);
+
+/**
+ * Destroy local data for this account
+ *
+ * @param completely if true chats, messages, etc will be deleted as well
+ */
+API_PREFIX void snikket_client_logout(void *client, bool completely);
+
+/**
+ * Sets the password to be used in response to the password needed event
+ *
+ * @param password
+ */
+API_PREFIX void snikket_client_use_password(void *client, const char *password);
+
+/**
+ * Get the account ID for this Client
+ *
+ * @returns account id
+ */
+API_PREFIX const char *snikket_client_account_id(void *client);
+
+/**
+ * Get the current display name for this account
+ *
+ * @returns display name
+ */
+API_PREFIX const char *snikket_client_display_name(void *client);
+
+/**
+ * Set the current display name for this account on the server
+ *
+ * @param display name to set (ignored if empty or NULL)
+ */
+API_PREFIX void snikket_client_set_display_name(void *client, const char *displayName);
+
+/**
+ * Turn a file into a ChatAttachment for attaching to a ChatMessage
+ */
+API_PREFIX void snikket_client_prepare_attachment(void *client, void *source, void (*callback) (void*, void*), void *callback__context);
+
+/**
+ * @returns array of open chats, sorted by last activity
+ */
+API_PREFIX size_t snikket_client_get_chats(void *client, void ***outPtr);
+
+/**
+ * Search for chats the user can start or join
+ *
+ * @param q the search query to use
+ * @param callback takes two arguments, the query that was used and the array of results
+ */
+API_PREFIX void snikket_client_find_available_chats(void *client, const char *q, void (*callback) (const char*, void**, size_t, void*), void *callback__context);
+
+/**
+ * Start or join a chat from the search results
+ *
+ * @returns the chat that was started
+ */
+API_PREFIX void *snikket_client_start_chat(void *client, void *availableChat);
+
+/**
+ * Find a chat by id
+ *
+ * @returns the chat if known, or NULL
+ */
+API_PREFIX void *snikket_client_get_chat(void *client, const char *chatId);
+
+/**
+ * Event fired when client needs a password for authentication
+ *
+ * @param handler takes one argument, the Client that needs a password
+ */
+API_PREFIX void snikket_client_add_password_needed_listener(void *client, void (*handler) (void*, void*), void *handler__context);
+
+/**
+ * Event fired when client is connected and fully synchronized
+ *
+ * @param handler takes no arguments
+ */
+API_PREFIX void snikket_client_add_status_online_listener(void *client, void (*handler) (void*), void *handler__context);
+
+/**
+ * Event fired when client is disconnected
+ *
+ * @param handler takes no arguments
+ */
+API_PREFIX void snikket_client_add_status_offline_listener(void *client, void (*handler) (void*), void *handler__context);
+
+/**
+ * Event fired when connection fails with a fatal error and will not be retried
+ *
+ * @param handler takes no arguments
+ */
+API_PREFIX void snikket_client_add_connection_failed_listener(void *client, void (*handler) (void*), void *handler__context);
+
+/**
+ * Event fired when a new ChatMessage comes in on any Chat
+ * Also fires when status of a ChatMessage changes,
+ * when a ChatMessage is edited, or when a reaction is added
+ *
+ * @param handler takes two arguments, the ChatMessage and ChatMessageEvent enum describing what happened
+ */
+API_PREFIX void snikket_client_add_chat_message_listener(void *client, void (*handler) (void*, int, void*), void *handler__context);
+
+/**
+ * Event fired when syncing a new ChatMessage that was send when offline.
+ * Normally you don't want this, but it may be useful if you want to notify on app start.
+ *
+ * @param handler takes one argument, the ChatMessage
+ */
+API_PREFIX void snikket_client_add_sync_message_listener(void *client, void (*handler) (void*, void*), void *handler__context);
+
+/**
+ * Event fired when a Chat's metadata is updated, or when a new Chat is added
+ *
+ * @param handler takes one argument, an array of Chats that were updated
+ */
+API_PREFIX void snikket_client_add_chats_updated_listener(void *client, void (*handler) (void**, size_t, void*), void *handler__context);
+
+/**
+ * Event fired when a new call comes in
+ *
+ * @param handler takes two arguments, the call Session and the associated Chat ID
+ */
+API_PREFIX void snikket_client_add_call_ring_listener(void *client, void (*handler) (void*, const char*, void*), void *handler__context);
+
+/**
+ * Event fired when a call is retracted or hung up
+ *
+ * @param handler takes one argument, the associated Chat ID
+ */
+API_PREFIX void snikket_client_add_call_retract_listener(void *client, void (*handler) (const char*, void*), void *handler__context);
+
+/**
+ * Event fired when an outgoing call starts ringing
+ *
+ * @param handler takes one argument, the associated Chat ID
+ */
+API_PREFIX void snikket_client_add_call_ringing_listener(void *client, void (*handler) (const char*, void*), void *handler__context);
+
+/**
+ * Event fired when a call is asking for media to send
+ *
+ * @param handler takes three arguments, the call Session,
+ * a boolean indicating if audio is desired,
+ * and a boolean indicating if video is desired
+ */
+API_PREFIX void snikket_client_add_call_media_listener(void *client, void (*handler) (void*, bool, bool, void*), void *handler__context);
+
+/**
+ * Event fired when call has a new MediaStreamTrack to play
+ *
+ * @param handler takes three arguments, the associated Chat ID,
+ * the new MediaStreamTrack, and an array of any associated MediaStreams
+ */
+API_PREFIX void snikket_client_add_call_track_listener(void *client, void (*handler) (const char*, void*, void**, size_t, void*), void *handler__context);
+
+/**
+ * Let the SDK know the UI is in the foreground
+ */
+API_PREFIX void snikket_client_set_in_foreground(void *client);
+
+/**
+ * Let the SDK know the UI is in the foreground
+ */
+API_PREFIX void snikket_client_set_not_in_foreground(void *client);
+
+/**
+ * ID of this Chat
+ */
+API_PREFIX const char *snikket_chat_chat_id(void *chat);
+
+/**
+ * Current state of this chat
+ */
+API_PREFIX enum snikket_ui_state snikket_chat_ui_state(void *chat);
+
+API_PREFIX bool snikket_chat_is_blocked(void *chat);
+
+/**
+ * Fetch a page of messages before some point
+ *
+ * @param beforeId id of the message to look before
+ * @param beforeTime timestamp of the message to look before,
+ * String in format YYYY-MM-DDThh:mm:ss[.sss]+00:00
+ * @param handler takes one argument, an array of ChatMessage that are found
+ */
+API_PREFIX void snikket_chat_get_messages_before(void *chat, const char *beforeId, const char *beforeTime, void (*handler) (void**, size_t, void*), void *handler__context);
+
+/**
+ * Fetch a page of messages after some point
+ *
+ * @param afterId id of the message to look after
+ * @param afterTime timestamp of the message to look after,
+ * String in format YYYY-MM-DDThh:mm:ss[.sss]+00:00
+ * @param handler takes one argument, an array of ChatMessage that are found
+ */
+API_PREFIX void snikket_chat_get_messages_after(void *chat, const char *afterId, const char *afterTime, void (*handler) (void**, size_t, void*), void *handler__context);
+
+/**
+ * Fetch a page of messages around (before, including, and after) some point
+ *
+ * @param aroundId id of the message to look around
+ * @param aroundTime timestamp of the message to look around,
+ * String in format YYYY-MM-DDThh:mm:ss[.sss]+00:00
+ * @param handler takes one argument, an array of ChatMessage that are found
+ */
+API_PREFIX void snikket_chat_get_messages_around(void *chat, const char *aroundId, const char *aroundTime, void (*handler) (void**, size_t, void*), void *handler__context);
+
+/**
+ * Send a ChatMessage to this Chat
+ *
+ * @param message the ChatMessage to send
+ */
+API_PREFIX void snikket_chat_send_message(void *chat, void *message);
+
+/**
+ * Signals that all messages up to and including this one have probably
+ * been displayed to the user
+ *
+ * @param message the ChatMessage most recently displayed
+ */
+API_PREFIX void snikket_chat_mark_read_up_to(void *chat, void *message);
+
+/**
+ * Save this Chat on the server
+ */
+API_PREFIX void snikket_chat_bookmark(void *chat);
+
+/**
+ * Get the list of IDs of participants in this Chat
+ *
+ * @returns array of IDs
+ */
+API_PREFIX size_t snikket_chat_get_participants(void *chat, const char ***outPtr);
+
+/**
+ * Get the details for one participant in this Chat
+ *
+ * @param participantId the ID of the participant to look up
+ */
+API_PREFIX void *snikket_chat_get_participant_details(void *chat, const char *participantId);
+
+/**
+ * Correct an already-send message by replacing it with a new one
+ *
+ * @param localId the localId of the message to correct
+ * must be the localId of the first version ever sent, not a subsequent correction
+ * @param message the new ChatMessage to replace it with
+ */
+API_PREFIX void snikket_chat_correct_message(void *chat, const char *localId, void *message);
+
+/**
+ * Add new reaction to a message in this Chat
+ *
+ * @param m ChatMessage to react to
+ * @param reaction emoji of the reaction
+ */
+API_PREFIX void snikket_chat_add_reaction(void *chat, void *m, void *reaction);
+
+/**
+ * Remove an already-sent reaction from a message
+ *
+ * @param m ChatMessage to remove the reaction from
+ * @param reaction the emoji to remove
+ */
+API_PREFIX void snikket_chat_remove_reaction(void *chat, void *m, void *reaction);
+
+/**
+ * Call this whenever the user is typing, can call on every keystroke
+ *
+ * @param threadId optional, what thread the user has selected if any
+ * @param content optional, what the user has typed so far
+ */
+API_PREFIX void snikket_chat_typing(void *chat, const char *threadId, const char *content);
+
+/**
+ * Call this whenever the user makes a chat or thread "active" in your UX
+ * If you call this with true you MUST later call it will false
+ *
+ * @param active true if the chat is "active", false otherwise
+ * @param threadId optional, what thread the user has selected if any
+ */
+API_PREFIX void snikket_chat_set_active(void *chat, bool active, const char *threadId);
+
+/**
+ * Archive this chat
+ */
+API_PREFIX void snikket_chat_close(void *chat);
+
+/**
+ * Pin or unpin this chat
+ */
+API_PREFIX void snikket_chat_toggle_pinned(void *chat);
+
+/**
+ * Block this chat so it will not re-open
+ */
+API_PREFIX void snikket_chat_block(void *chat, void *reportSpam, bool onServer);
+
+/**
+ * Unblock this chat so it will open again
+ */
+API_PREFIX void snikket_chat_unblock(void *chat, bool onServer);
+
+/**
+ * Update notification preferences
+ */
+API_PREFIX void snikket_chat_set_notifications(void *chat, bool filtered, bool mention, bool reply);
+
+/**
+ * Should notifications be filtered?
+ */
+API_PREFIX bool snikket_chat_notifications_filtered(void *chat);
+
+/**
+ * Should a mention produce a notification?
+ */
+API_PREFIX bool snikket_chat_notify_mention(void *chat);
+
+/**
+ * Should a reply produce a notification?
+ */
+API_PREFIX bool snikket_chat_notify_reply(void *chat);
+
+/**
+ * An ID of the most recent message in this chat
+ */
+API_PREFIX const char *snikket_chat_last_message_id(void *chat);
+
+/**
+ * The timestamp of the most recent message in this chat
+ */
+API_PREFIX const char *snikket_chat_last_message_timestamp(void *chat);
+
+/**
+ * Get the URI image to represent this Chat, or null
+ */
+API_PREFIX const char *snikket_chat_get_photo(void *chat);
+
+/**
+ * Get the URI to a placeholder image to represent this Chat
+ */
+API_PREFIX const char *snikket_chat_get_placeholder(void *chat);
+
+/**
+ * An ID of the last message displayed to the user
+ */
+API_PREFIX const char *snikket_chat_read_up_to(void *chat);
+
+/**
+ * The number of message that have not yet been displayed to the user
+ */
+API_PREFIX int snikket_chat_unread_count(void *chat);
+
+/**
+ * A preview of the chat, such as the most recent message body
+ */
+API_PREFIX const char *snikket_chat_preview(void *chat);
+
+API_PREFIX void snikket_chat_set_display_name(void *chat, const char *fn);
+
+/**
+ * The display name of this Chat
+ */
+API_PREFIX const char *snikket_chat_get_display_name(void *chat);
+
+API_PREFIX void snikket_chat_set_trusted(void *chat, bool trusted);
+
+/**
+ * Is this a chat with an entity we trust to see our online status?
+ */
+API_PREFIX bool snikket_chat_is_trusted(void *chat);
+
+API_PREFIX bool snikket_chat_syncing(void *chat);
+
+/**
+ * Can audio calls be started in this Chat?
+ */
+API_PREFIX bool snikket_chat_can_audio_call(void *chat);
+
+/**
+ * Can video calls be started in this Chat?
+ */
+API_PREFIX bool snikket_chat_can_video_call(void *chat);
+
+/**
+ * Start a new call in this Chat
+ *
+ * @param audio do we want audio in this call
+ * @param video do we want video in this call
+ */
+API_PREFIX void snikket_chat_start_call(void *chat, bool audio, bool video);
+
+/**
+ * Accept any incoming calls in this Chat
+ */
+API_PREFIX void snikket_chat_accept_call(void *chat);
+
+/**
+ * Hangup or reject any calls in this chat
+ */
+API_PREFIX void snikket_chat_hangup(void *chat);
+
+/**
+ * The current status of a call in this chat
+ */
+API_PREFIX const char *snikket_chat_call_status(void *chat);
+
+/**
+ * A DTMFSender for a call in this chat, or NULL
+ */
+API_PREFIX void *snikket_chat_dtmf(void *chat);
+
+/**
+ * All video tracks in all active calls in this chat
+ */
+API_PREFIX size_t snikket_chat_video_tracks(void *chat, void ***outPtr);
+
+API_PREFIX const char *snikket_jingle_media_stream_track_id(void *media_stream_track);
+
+API_PREFIX bool snikket_jingle_media_stream_track_muted(void *media_stream_track);
+
+API_PREFIX const char *snikket_jingle_media_stream_track_kind(void *media_stream_track);
+
+API_PREFIX size_t snikket_jingle_media_stream_track_supported_audio_formats(void *media_stream_track, void ***outPtr);
+
+/**
+ * Event fired for new inbound audio frame
+ *
+ * @param callback takes three arguments, the Signed 16-bit PCM data, the clock rate, and the number of channels
+ */
+API_PREFIX void snikket_jingle_media_stream_track_add_pcm_listener(void *media_stream_track, void (*callback) (short*, size_t, int, int, void*), void *callback__context);
+
+/**
+ * Event fired when ready for next outbound audio frame
+ *
+ * @param callback
+ */
+API_PREFIX void snikket_jingle_media_stream_track_add_ready_for_pcm_listener(void *media_stream_track, void (*callback) (void*), void *callback__context);
+
+/**
+ * Send new audio to this track
+ *
+ * @param pcm 16-bit signed linear PCM data (interleaved)
+ * @param clockRate the sampling rate of the data
+ * @param channels the number of audio channels
+ */
+API_PREFIX void snikket_jingle_media_stream_track_write_pcm(void *media_stream_track, const short *pcm, size_t pcm__len, int clockRate, int channels);
+
+API_PREFIX void snikket_jingle_media_stream_track_stop(void *media_stream_track);
+
+API_PREFIX void *snikket_jingle_audio_format_new(const char *format, unsigned char payloadType, int clockRate, int channels);
+
+API_PREFIX int snikket_jingle_audio_format_clock_rate(void *audio_format);
+
+API_PREFIX int snikket_jingle_audio_format_channels(void *audio_format);
+
+/**
+ * The ID of the Chat this search result represents
+ */
+API_PREFIX const char *snikket_available_chat_chat_id(void *available_chat);
+
+/**
+ * The display name of this search result
+ */
+API_PREFIX const char *snikket_available_chat_display_name(void *available_chat);
+
+/**
+ * A human-readable note associated with this search result
+ */
+API_PREFIX const char *snikket_available_chat_note(void *available_chat);
+
+/**
+ * Is this search result a channel?
+ */
+API_PREFIX bool snikket_available_chat_is_channel(void *available_chat);
+
+API_PREFIX const char *snikket_jingle_initiated_session_sid(void *initiated_session);
+
+API_PREFIX void snikket_jingle_initiated_session_accept(void *initiated_session);
+
+API_PREFIX void snikket_jingle_initiated_session_hangup(void *initiated_session);
+
+API_PREFIX void snikket_jingle_initiated_session_add_media(void *initiated_session, void *const *streams, size_t streams__len);
+
+API_PREFIX const char *snikket_jingle_initiated_session_call_status(void *initiated_session);
+
+API_PREFIX size_t snikket_jingle_initiated_session_video_tracks(void *initiated_session, void ***outPtr);
+
+API_PREFIX void *snikket_jingle_initiated_session_dtmf(void *initiated_session);
+
+API_PREFIX void snikket_jingle_initiated_session_supply_media(void *initiated_session, void *const *streams, size_t streams__len);
+
+API_PREFIX void *snikket_jingle_media_stream_new();
+
+/**
+ * Create default bidirectional audio track
+ */
+API_PREFIX void *snikket_jingle_media_stream_make_audio();
+
+API_PREFIX void snikket_jingle_media_stream_add_track(void *media_stream, void *track);
+
+API_PREFIX size_t snikket_jingle_media_stream_get_tracks(void *media_stream, void ***outPtr);
+
+API_PREFIX void *snikket_attachment_source_new(const char *path, const char *mime);
+
+API_PREFIX const char *snikket_attachment_source_path(void *attachment_source);
+
+API_PREFIX const char *snikket_attachment_source_type(void *attachment_source);
+
+API_PREFIX const char *snikket_attachment_source_name(void *attachment_source);
+
+API_PREFIX int snikket_attachment_source_size(void *attachment_source);
+
+API_PREFIX const char *snikket_participant_display_name(void *participant);
+
+API_PREFIX const char *snikket_participant_photo_uri(void *participant);
+
+API_PREFIX const char *snikket_participant_placeholder_uri(void *participant);
+
+API_PREFIX bool snikket_participant_is_self(void *participant);
+
+API_PREFIX bool snikket_channel_is_private(void *channel);
+
+API_PREFIX const char *snikket_reaction_sender_id(void *reaction);
+
+API_PREFIX const char *snikket_reaction_timestamp(void *reaction);
+
+API_PREFIX const char *snikket_reaction_text(void *reaction);
+
+API_PREFIX const char *snikket_reaction_key(void *reaction);
+
+API_PREFIX const char *snikket_reaction_envelope_id(void *reaction);
+
+API_PREFIX const char *snikket_custom_emoji_reaction_uri(void *custom_emoji_reaction);
+
+/**
+ * Schedule DTMF events to be sent
+ *
+ * @param tones can be any number of 0123456789#*ABCD,
+ */
+API_PREFIX void snikket_jingle_dtmf_sender_insert_dtmf(void *dtmf_sender, const char *tones);
+
+#ifdef __cplusplus
+}
+#endif
+
+#undef API_PREFIX
+
+#endif
diff --git a/Sources/c_snikket/src/Array.cpp b/Sources/c_snikket/src/Array.cpp
new file mode 100644
index 0000000..19366ea
--- /dev/null
+++ b/Sources/c_snikket/src/Array.cpp
@@ -0,0 +1,1169 @@
+#include <hxcpp.h>
+#include <vector>
+#include <cpp/Pointer.h>
+
+#ifdef HXCPP_TELEMETRY
+extern void __hxt_new_array(void* obj, int size);
+#endif
+
+using namespace hx;
+
+
+// -------- ArrayBase -------------------------------------
+
+namespace hx
+{
+
+Array<Dynamic> ArrayBase::__new(int inSize,int inReserve)
+ { return Array<Dynamic>(new Array_obj<Dynamic>(inSize,inReserve)); }
+
+ArrayBase::ArrayBase(int inSize,int inReserve,int inElementSize,bool inAtomic)
+{
+ length = inSize;
+ int alloc = inSize < inReserve ? inReserve : inSize;
+ if (alloc)
+ {
+ mBase = (char *)hx::InternalNew(alloc * inElementSize,false);
+ HX_OBJ_WB_GET(this,mBase);
+#ifdef HXCPP_TELEMETRY
+ __hxt_new_array(mBase, alloc * inElementSize);
+#endif
+ }
+ else
+ mBase = 0;
+ mAlloc = alloc;
+ mArrayConvertId = inAtomic ? inElementSize :
+ inElementSize==sizeof(String) ? aciStringArray : aciObjectArray;
+}
+
+
+
+void ArrayBase::reserve(int inSize) const
+{
+ if (mAlloc<inSize)
+ {
+ int elemSize = GetElementSize();
+ int bytes = inSize * elemSize;
+
+ if (mBase)
+ {
+ bool wasUnamanaged = mAlloc<0;
+ if (wasUnamanaged)
+ {
+ char *base=(char *)hx::InternalNew(bytes,false);
+ memcpy(base,mBase,length*elemSize);
+ mBase = base;
+ }
+ else
+ mBase = (char *)hx::InternalRealloc(length*elemSize,mBase, bytes );
+ }
+ else
+ {
+ mBase = (char *)hx::InternalNew(bytes,false);
+ #ifdef HXCPP_TELEMETRY
+ __hxt_new_array(mBase, bytes);
+ #endif
+ }
+
+ mAlloc = inSize;
+ HX_OBJ_WB_GET(const_cast<ArrayBase *>(this),mBase);
+ }
+}
+
+
+void ArrayBase::Realloc(int inSize) const
+{
+ // Try to detect "push" case vs resizing to big array size explicitly by looking at gap
+ bool pushCase = (inSize<=mAlloc + 16);
+ if (!pushCase)
+ {
+ reserve(inSize);
+ }
+ else if (pushCase)
+ {
+ int newAlloc = inSize;
+ unsigned int elemSize = GetElementSize();
+ unsigned int minBytes = inSize*elemSize + 8;
+ unsigned int roundup = 64;
+ while(roundup<minBytes)
+ roundup<<=1;
+
+ if (roundup>64)
+ {
+ int half = 3*(roundup>>2);
+ if (minBytes<half)
+ roundup = half;
+ }
+ unsigned int bytes = roundup-8;
+
+ if (mBase)
+ {
+ bool wasUnamanaged = mAlloc<0;
+ if (wasUnamanaged)
+ {
+ char *base=(char *)hx::InternalNew(bytes,false);
+ memcpy(base,mBase,length*elemSize);
+ mBase = base;
+ }
+ else
+ {
+ mBase = (char *)hx::InternalRealloc(length*elemSize,mBase, bytes, true);
+ int o = bytes;
+ bytes = hx::ObjectSizeSafe(mBase);
+ }
+ }
+ else
+ {
+ mBase = (char *)hx::InternalNew(bytes,false);
+ #ifdef HXCPP_TELEMETRY
+ __hxt_new_array(mBase, bytes);
+ #endif
+ }
+
+ mAlloc = bytes/elemSize;
+ HX_OBJ_WB_GET(const_cast<ArrayBase *>(this),mBase);
+ }
+}
+
+// Set numeric values to 0, pointers to null, bools to false
+void ArrayBase::zero(Dynamic inFirst, Dynamic inCount)
+{
+ int first = inFirst==null() ? 0 : inFirst->__ToInt();
+ if (first<0)
+ first+=length;
+ if (first<0 || first>=length)
+ return;
+
+ int count = length;
+ if (inCount!=null())
+ count = inCount->__ToInt();
+ if (count<0)
+ count += length;
+ if (count<0)
+ return;
+
+ if (first+count > length)
+ count = length - first;
+
+ int size = GetElementSize();
+ memset(mBase + first*size, 0, count*size);
+}
+
+int ArrayBase::Memcmp(ArrayBase *inOther)
+{
+ int bytesA = length * GetElementSize();
+ int bytesB = inOther->length * inOther->GetElementSize();
+ int common = bytesA<bytesB ? bytesA : bytesB;
+ int result = memcmp(mBase, inOther->mBase, common);
+ if (result)
+ return result;
+ return bytesA - bytesB;
+}
+
+void ArrayBase::Blit(int inDestElement, ArrayBase *inSourceArray, int inSourceElement, int inElementCount)
+{
+ int srcSize = inSourceArray->GetElementSize();
+ int srcElems = inSourceArray->length;
+ if (inDestElement<0 || inSourceElement<0 || inSourceElement+inElementCount>srcElems)
+ hx::Throw( HX_CSTRING("blit out of bounds") );
+ if (srcSize!=GetElementSize())
+ hx::Throw( HX_CSTRING("blit array mismatch") );
+
+ int newSize = inDestElement + inElementCount;
+ if (newSize>length)
+ resize(newSize);
+
+ const char *src = inSourceArray->mBase + inSourceElement*srcSize;
+ char *dest = mBase + inDestElement*srcSize;
+ int len = inElementCount*srcSize;
+ if (src+len < dest || dest+len<src)
+ memcpy(dest,src,len);
+ else
+ memmove(dest,src,len);
+
+ HX_OBJ_WB_PESSIMISTIC_GET(this);
+}
+
+int ArrayBase::__Compare(const hx::Object *inRHS) const
+{
+ if (inRHS==this)
+ return 0;
+ if (inRHS->__GetType()!=vtArray)
+ return -1;
+ ArrayCommon *common = (ArrayCommon *)inRHS;
+ hx::Object *implementation = common->__GetRealObject();
+ return implementation<this ? -1 : implementation!=this;
+}
+
+String ArrayBase::__ToString() const { return HX_CSTRING("Array"); }
+String ArrayBase::toString()
+{
+ // Byte-array (not bool!)
+ if (IsByteArray())
+ {
+ return String( (const char *) mBase, length);
+ }
+
+ return HX_CSTRING("[") + __join(HX_CSTRING(",")) + HX_CSTRING("]");
+}
+
+
+void ArrayBase::__SetSizeExact(int inSize)
+{
+ if (inSize==0)
+ {
+ InternalReleaseMem(mBase);
+ mBase = 0;
+ mAlloc = length = 0;
+ }
+ else if (inSize!=length || inSize!=mAlloc)
+ {
+ int elemSize = GetElementSize();
+ int bytes = inSize * elemSize;
+ if (mBase)
+ {
+ bool wasUnamanaged = mAlloc<0;
+
+ if (wasUnamanaged)
+ {
+ char *base=(char *)(AllocAtomic() ? hx::NewGCPrivate(0,bytes) : hx::NewGCBytes(0,bytes));
+ memcpy(base,mBase,std::min(length,inSize)*elemSize);
+ mBase = base;
+ }
+ else
+ mBase = (char *)hx::InternalRealloc(length*elemSize,mBase, bytes );
+ }
+ else if (AllocAtomic())
+ {
+ mBase = (char *)hx::NewGCPrivate(0,bytes);
+#ifdef HXCPP_TELEMETRY
+ __hxt_new_array(mBase, bytes);
+#endif
+ }
+ else
+ {
+ mBase = (char *)hx::NewGCBytes(0,bytes);
+#ifdef HXCPP_TELEMETRY
+ __hxt_new_array(mBase, bytes);
+#endif
+ }
+ mAlloc = length = inSize;
+ HX_OBJ_WB_GET(this,mBase);
+ }
+}
+
+
+Dynamic ArrayBase::__unsafe_get(const Dynamic &i)
+{
+ return __GetItem(i);
+}
+
+
+Dynamic ArrayBase::__unsafe_set(const Dynamic &i, const Dynamic &val)
+{
+ return __SetItem(i,val);
+}
+
+
+
+void ArrayBase::Insert(int inPos)
+{
+ if (inPos>=length)
+ resize(length+1);
+ else
+ {
+ resize(length+1);
+ int s = GetElementSize();
+ memmove(mBase + inPos*s + s, mBase+inPos*s, (length-inPos-1)*s );
+ }
+}
+
+void ArrayBase::Splice(ArrayBase *outResult,int inPos,int inLen)
+{
+ if (inPos>=length)
+ {
+ return;
+ }
+ else if (inPos<0)
+ {
+ inPos += length;
+ if (inPos<0)
+ inPos =0;
+ }
+ if (inLen<0)
+ return;
+ if (inPos+inLen>length)
+ inLen = length - inPos;
+
+ int s = GetElementSize();
+ if (outResult)
+ {
+ outResult->resize(inLen);
+ memcpy(outResult->mBase, mBase+inPos*s, s*inLen);
+ // todo - only needed if we have dirty pointer elements
+ HX_OBJ_WB_PESSIMISTIC_GET(outResult);
+ }
+ memmove(mBase+inPos*s, mBase + (inPos+inLen)*s, (length-(inPos+inLen))*s);
+ resize(length-inLen);
+}
+
+void ArrayBase::Slice(ArrayBase *outResult,int inPos,int inEnd)
+{
+ if (inPos<0)
+ {
+ inPos += length;
+ if (inPos<0)
+ inPos =0;
+ }
+ if (inEnd<0)
+ inEnd += length;
+ if (inEnd>length)
+ inEnd = length;
+ int n = inEnd - inPos;
+ if (n<=0)
+ outResult->resize(0);
+ else
+ {
+ outResult->resize(n);
+ int s = GetElementSize();
+ memcpy(outResult->mBase, mBase+inPos*s, n*s);
+ // todo - only needed if we have dirty pointer elements
+ HX_OBJ_WB_PESSIMISTIC_GET(outResult);
+ }
+}
+
+void ArrayBase::RemoveElement(int inPos)
+{
+ if (inPos<length)
+ {
+ int s = GetElementSize();
+ memmove(mBase + inPos*s, mBase+inPos*s + s, (length-inPos-1)*s );
+ resize(length-1);
+ }
+
+}
+
+void ArrayBase::Concat(ArrayBase *outResult,const char *inSecond,int inLen)
+{
+ char *ptr = outResult->GetBase();
+ int n = length * GetElementSize();
+ memcpy(ptr,mBase,n);
+ ptr += n;
+ memcpy(ptr,inSecond,inLen*GetElementSize());
+ HX_OBJ_WB_PESSIMISTIC_GET(this);
+}
+
+
+String ArrayBase::joinArray(Array_obj<String> *inArray, String inSeparator)
+{
+ int length = inArray->length;
+ if (length==0)
+ return HX_CSTRING("");
+
+ int len = 0;
+ bool isWChar = false;
+ for(int i=0;i<length;i++)
+ {
+ String strI = inArray->__unsafe_get(i);
+ if (strI.raw_ptr())
+ {
+ len += strI.length;
+ #ifdef HX_SMART_STRINGS
+ if (strI.isUTF16Encoded())
+ isWChar = true;
+ #endif
+ }
+ else
+ len += 4;
+ }
+
+ len += (length-1) * inSeparator.length;
+ #ifdef HX_SMART_STRINGS
+ bool sepIsWide = inSeparator.isUTF16Encoded();
+ if (isWChar || sepIsWide)
+ {
+ char16_t *buf = String::allocChar16Ptr(len);
+ int pos = 0;
+ bool separated = inSeparator.length>0;
+
+ for(int i=0;i<length;i++)
+ {
+ String strI = inArray->__unsafe_get(i);
+ if (!strI.raw_ptr())
+ {
+ memcpy(buf+pos,u"null",8);
+ pos+=4;
+ }
+ else if(strI.length==0)
+ {
+ // ignore
+ }
+ else if (strI.isUTF16Encoded())
+ {
+ memcpy(buf+pos,strI.raw_wptr(),strI.length*sizeof(char16_t));
+ pos += strI.length;
+ }
+ else
+ {
+ const char *ptr = strI.raw_ptr();
+ for(int c=0;c<strI.length;c++)
+ buf[pos++] = ptr[c];
+ }
+
+ if (separated && (i+1<length) )
+ {
+ if (sepIsWide)
+ {
+ memcpy(buf+pos,inSeparator.raw_ptr(),inSeparator.length*sizeof(char16_t));
+ pos += inSeparator.length;
+ }
+ else
+ {
+ const char *ptr = inSeparator.raw_ptr();
+ for(int c=0;c<inSeparator.length;c++)
+ buf[pos++] = ptr[c];
+ }
+ }
+ }
+ buf[len] = '\0';
+
+ String result(buf,len);
+ return result;
+ }
+ #endif
+ {
+ char *buf = hx::NewString(len);
+
+ int pos = 0;
+ bool separated = inSeparator.length>0;
+ for(int i=0;i<length;i++)
+ {
+ String strI = inArray->__unsafe_get(i);
+ if (!strI.raw_ptr())
+ {
+ memcpy(buf+pos,"null",4);
+ pos+=4;
+ }
+ else
+ {
+ memcpy(buf+pos,strI.raw_ptr(),strI.length*sizeof(char));
+ pos += strI.length;
+ }
+ if (separated && (i+1<length) )
+ {
+ memcpy(buf+pos,inSeparator.raw_ptr(),inSeparator.length*sizeof(char));
+ pos += inSeparator.length;
+ }
+ }
+ buf[len] = '\0';
+
+ return String(buf,len);
+ }
+}
+
+
+int _hx_toString_depth = 0;
+String ArrayBase::joinArray(ArrayBase *inBase, String inSeparator)
+{
+ if (_hx_toString_depth >= 5)
+ return HX_CSTRING("...");
+ int length = inBase->length;
+ if (length==0)
+ return HX_CSTRING("");
+
+ Array<String> stringArray = Array_obj<String>::__new(length, length);
+ _hx_toString_depth++;
+ try
+ {
+ for(int i=0;i<length;i++)
+ stringArray->__unsafe_set(i, inBase->ItemString(i));
+ _hx_toString_depth--;
+ }
+ catch (...)
+ {
+ _hx_toString_depth--;
+ throw;
+ }
+
+ return stringArray->join(inSeparator);
+}
+
+template<typename T>
+struct ArrayBaseSorter
+{
+ ArrayBaseSorter(T *inArray, Dynamic inFunc)
+ {
+ mFunc = inFunc;
+ mArray = inArray;
+ }
+
+ bool operator()(int inA, int inB)
+ { return mFunc(mArray[inA], mArray[inB])->__ToInt() < 0; }
+
+ Dynamic mFunc;
+ T* mArray;
+};
+
+template<typename T,typename STORE>
+void TArraySortLen(T *inArray, int inLength, Dynamic inSorter)
+{
+ std::vector<STORE> index(inLength);
+ for(int i=0;i<inLength;i++)
+ index[i] = (STORE)i;
+
+ std::stable_sort(index.begin(), index.end(), ArrayBaseSorter<T>(inArray,inSorter) );
+
+ // Put the results back ...
+ for(int i=0;i<inLength;i++)
+ {
+ int from = index[i];
+ while(from < i)
+ from = index[from];
+ if (from!=i)
+ {
+ std::swap(inArray[i],inArray[from]);
+ index[i] = from;
+ }
+ }
+}
+
+template<typename T>
+void TArraySort(T *inArray, int inLength, Dynamic inSorter)
+{
+ if (inLength<2)
+ return;
+ if (inLength<=256)
+ TArraySortLen<T,unsigned char >(inArray, inLength, inSorter);
+ else if (inLength<=65536)
+ TArraySortLen<T,unsigned short >(inArray, inLength, inSorter);
+ else
+ TArraySortLen<T,unsigned int >(inArray, inLength, inSorter);
+}
+
+void ArrayBase::safeSort(Dynamic inSorter, bool inIsString)
+{
+ if (inIsString)
+ TArraySort((String *)mBase, length,inSorter);
+ else
+ TArraySort((Dynamic *)mBase, length,inSorter);
+}
+
+
+
+#ifdef HXCPP_VISIT_ALLOCS
+#define ARRAY_VISIT_FUNC \
+ void __Visit(hx::VisitContext *__inCtx) { HX_VISIT_MEMBER(mThis); }
+#else
+#define ARRAY_VISIT_FUNC
+#endif
+
+#define DEFINE_ARRAY_FUNC(ret,func,array_list,dynamic_arg_list,arg_list,ARG_C) \
+struct ArrayBase_##func : public hx::Object \
+{ \
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdClosure }; \
+ bool __IsFunction() const { return true; } \
+ ArrayBase *mThis; \
+ ArrayBase_##func(ArrayBase *inThis) : mThis(inThis) { } \
+ String toString() const{ return HX_CSTRING(#func) ; } \
+ String __ToString() const{ return HX_CSTRING(#func) ; } \
+ int __GetType() const { return vtFunction; } \
+ void *__GetHandle() const { return mThis; } \
+ int __ArgCount() const { return ARG_C; } \
+ void __Mark(hx::MarkContext *__inCtx) { HX_MARK_MEMBER(mThis); } \
+ ARRAY_VISIT_FUNC \
+ Dynamic __Run(const Array<Dynamic> &inArgs) \
+ { \
+ ret mThis->__##func(array_list); return Dynamic(); \
+ } \
+ Dynamic __run(dynamic_arg_list) \
+ { \
+ ret mThis->__##func(arg_list); return Dynamic(); \
+ } \
+ int __Compare(const hx::Object *inRHS) const \
+ { \
+ if (!dynamic_cast<const ArrayBase_##func *>(inRHS)) return -1; \
+ return (mThis==inRHS->__GetHandle() ? 0 : -1); \
+ } \
+}; \
+Dynamic ArrayBase::func##_dyn() { return new ArrayBase_##func(this); }
+
+
+#define DEFINE_ARRAY_FUNC0(ret,func) DEFINE_ARRAY_FUNC(ret,func,HX_ARR_LIST0,HX_DYNAMIC_ARG_LIST0,HX_ARG_LIST0,0)
+#define DEFINE_ARRAY_FUNC1(ret,func) DEFINE_ARRAY_FUNC(ret,func,HX_ARR_LIST1,HX_DYNAMIC_ARG_LIST1,HX_ARG_LIST1,1)
+#define DEFINE_ARRAY_FUNC2(ret,func) DEFINE_ARRAY_FUNC(ret,func,HX_ARR_LIST2,HX_DYNAMIC_ARG_LIST2,HX_ARG_LIST2,2)
+#define DEFINE_ARRAY_FUNC3(ret,func) DEFINE_ARRAY_FUNC(ret,func,HX_ARR_LIST3,HX_DYNAMIC_ARG_LIST3,HX_ARG_LIST3,3)
+#define DEFINE_ARRAY_FUNC4(ret,func) DEFINE_ARRAY_FUNC(ret,func,HX_ARR_LIST4,HX_DYNAMIC_ARG_LIST4,HX_ARG_LIST4,4)
+
+
+DEFINE_ARRAY_FUNC1(,__SetSize);
+DEFINE_ARRAY_FUNC1(,__SetSizeExact);
+DEFINE_ARRAY_FUNC2(,insert);
+DEFINE_ARRAY_FUNC0(,reverse);
+DEFINE_ARRAY_FUNC1(,sort);
+DEFINE_ARRAY_FUNC1(,unshift);
+DEFINE_ARRAY_FUNC4(,blit);
+DEFINE_ARRAY_FUNC2(,zero);
+DEFINE_ARRAY_FUNC1(,resize);
+DEFINE_ARRAY_FUNC1(return,concat);
+DEFINE_ARRAY_FUNC0(return,iterator);
+DEFINE_ARRAY_FUNC0(return,keyValueIterator);
+DEFINE_ARRAY_FUNC1(return,join);
+DEFINE_ARRAY_FUNC0(return,pop);
+DEFINE_ARRAY_FUNC0(return,copy);
+DEFINE_ARRAY_FUNC1(return,push);
+DEFINE_ARRAY_FUNC1(return,contains);
+DEFINE_ARRAY_FUNC1(return,remove);
+DEFINE_ARRAY_FUNC1(return,removeAt);
+DEFINE_ARRAY_FUNC2(return,indexOf);
+DEFINE_ARRAY_FUNC2(return,lastIndexOf);
+DEFINE_ARRAY_FUNC0(return,shift);
+DEFINE_ARRAY_FUNC2(return,slice);
+DEFINE_ARRAY_FUNC2(return,splice);
+DEFINE_ARRAY_FUNC0(return,toString);
+DEFINE_ARRAY_FUNC1(return,map);
+DEFINE_ARRAY_FUNC1(return,filter);
+DEFINE_ARRAY_FUNC1(return,__unsafe_get);
+DEFINE_ARRAY_FUNC2(return,__unsafe_set);
+DEFINE_ARRAY_FUNC1(return,memcmp);
+
+
+
+
+hx::Val ArrayBase::__Field(const String &inString, hx::PropertyAccess inCallProp)
+{
+ if (inString==HX_CSTRING("length")) return (int)size();
+ if (inString==HX_CSTRING("concat")) return concat_dyn();
+ if (inString==HX_CSTRING("insert")) return insert_dyn();
+ if (inString==HX_CSTRING("copy")) return copy_dyn();
+ if (inString==HX_CSTRING("iterator")) return iterator_dyn();
+ if (inString==HX_CSTRING("keyValueIterator")) return keyValueIterator_dyn();
+ if (inString==HX_CSTRING("join")) return join_dyn();
+ if (inString==HX_CSTRING("pop")) return pop_dyn();
+ if (inString==HX_CSTRING("push")) return push_dyn();
+ if (inString==HX_CSTRING("contains")) return contains_dyn();
+ if (inString==HX_CSTRING("remove")) return remove_dyn();
+ if (inString==HX_CSTRING("removeAt")) return removeAt_dyn();
+ if (inString==HX_CSTRING("indexOf")) return indexOf_dyn();
+ if (inString==HX_CSTRING("lastIndexOf")) return lastIndexOf_dyn();
+ if (inString==HX_CSTRING("reverse")) return reverse_dyn();
+ if (inString==HX_CSTRING("shift")) return shift_dyn();
+ if (inString==HX_CSTRING("splice")) return splice_dyn();
+ if (inString==HX_CSTRING("slice")) return slice_dyn();
+ if (inString==HX_CSTRING("sort")) return sort_dyn();
+ if (inString==HX_CSTRING("toString")) return toString_dyn();
+ if (inString==HX_CSTRING("unshift")) return unshift_dyn();
+ if (inString==HX_CSTRING("filter")) return filter_dyn();
+ if (inString==HX_CSTRING("map")) return map_dyn();
+ if (inString==HX_CSTRING("__SetSize")) return __SetSize_dyn();
+ if (inString==HX_CSTRING("__SetSizeExact")) return __SetSizeExact_dyn();
+ if (inString==HX_CSTRING("__unsafe_get")) return __unsafe_get_dyn();
+ if (inString==HX_CSTRING("__unsafe_set")) return __unsafe_set_dyn();
+ if (inString==HX_CSTRING("blit")) return blit_dyn();
+ if (inString==HX_CSTRING("zero")) return zero_dyn();
+ if (inString==HX_CSTRING("memcmp")) return memcmp_dyn();
+ if (inString==HX_CSTRING("_hx_storeType")) return (int)getStoreType();
+ if (inString==HX_CSTRING("_hx_elementSize")) return (int)GetElementSize();
+ if (inString==HX_CSTRING("_hx_pointer")) return cpp::CreateDynamicPointer((void *)mBase);
+ if (inString==HX_CSTRING("resize")) return resize_dyn();
+ return null();
+}
+
+
+static String sArrayFields[] = {
+ HX_CSTRING("length"),
+ HX_CSTRING("concat"),
+ HX_CSTRING("insert"),
+ HX_CSTRING("iterator"),
+ HX_CSTRING("keyValueIterator"),
+ HX_CSTRING("join"),
+ HX_CSTRING("copy"),
+ HX_CSTRING("pop"),
+ HX_CSTRING("push"),
+ HX_CSTRING("contains"),
+ HX_CSTRING("remove"),
+ HX_CSTRING("removeAt"),
+ HX_CSTRING("indexOf"),
+ HX_CSTRING("lastIndexOf"),
+ HX_CSTRING("reverse"),
+ HX_CSTRING("shift"),
+ HX_CSTRING("slice"),
+ HX_CSTRING("splice"),
+ HX_CSTRING("sort"),
+ HX_CSTRING("toString"),
+ HX_CSTRING("unshift"),
+ HX_CSTRING("filter"),
+ HX_CSTRING("map"),
+ HX_CSTRING("resize"),
+ String(null())
+};
+
+
+
+// TODO;
+hx::Class ArrayBase::__mClass;
+
+Dynamic ArrayCreateEmpty() { return new Array<Dynamic>(0,0); }
+Dynamic ArrayCreateArgs(DynamicArray inArgs)
+{
+ return inArgs->__copy();
+}
+
+static bool ArrayCanCast(hx::Object *inInstance)
+{
+ return inInstance->__GetClass().mPtr == ArrayBase::__mClass.mPtr;
+}
+
+void ArrayBase::__boot()
+{
+ Static(__mClass) = hx::_hx_RegisterClass(HX_CSTRING("Array"),ArrayCanCast,sNone,sArrayFields,
+ ArrayCreateEmpty,ArrayCreateArgs,0,0);
+}
+
+
+
+bool DynamicEq(const Dynamic &a, const Dynamic &b)
+{
+ // ? return hx::IsInstanceEq(a,b);
+ return hx::IsEq(a,b);
+}
+
+
+
+// -------- ArrayIterator -------------------------------------
+
+} // End namespace hx
+
+
+namespace cpp
+{
+HX_DEFINE_DYNAMIC_FUNC0(IteratorBase,hasNext,return)
+HX_DEFINE_DYNAMIC_FUNC0(IteratorBase,_dynamicNext,return)
+
+Dynamic IteratorBase::next_dyn()
+{
+ return hx::CreateMemberFunction0("next",this,__IteratorBase_dynamicNext);
+}
+
+hx::Val IteratorBase::__Field(const String &inString, hx::PropertyAccess inCallProp)
+{
+ if (inString==HX_CSTRING("hasNext")) return hasNext_dyn();
+ if (inString==HX_CSTRING("next")) return _dynamicNext_dyn();
+ return null();
+}
+}
+
+
+#ifdef HX_VARRAY_DEFINED
+// -------- VirtualArray -------------------------------------
+
+namespace cpp
+{
+
+
+
+#define DEFINE_VARRAY_FUNC(ret, func,array_list,dynamic_arg_list,arg_list,ARG_C) \
+struct VirtualArray_##func : public hx::Object \
+{ \
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdClosure }; \
+ bool __IsFunction() const { return true; } \
+ VirtualArray mThis; \
+ VirtualArray_##func(VirtualArray inThis) : mThis(inThis) { \
+ HX_OBJ_WB_NEW_MARKED_OBJECT(this); \
+ } \
+ String toString() const{ return HX_CSTRING(#func) ; } \
+ String __ToString() const{ return HX_CSTRING(#func) ; } \
+ int __GetType() const { return vtFunction; } \
+ void *__GetHandle() const { return mThis.mPtr; } \
+ int __ArgCount() const { return ARG_C; } \
+ void __Mark(hx::MarkContext *__inCtx) { HX_MARK_MEMBER(mThis); } \
+ ARRAY_VISIT_FUNC \
+ Dynamic __Run(const Array<Dynamic> &inArgs) \
+ { \
+ ret mThis->func(array_list); return Dynamic(); \
+ } \
+ Dynamic __run(dynamic_arg_list) \
+ { \
+ ret mThis->func(arg_list); return Dynamic(); \
+ } \
+}; \
+Dynamic VirtualArray_obj::func##_dyn() { return new VirtualArray_##func(this); }
+
+
+#define DEFINE_VARRAY_FUNC0(ret,func) DEFINE_VARRAY_FUNC(ret,func,HX_ARR_LIST0,HX_DYNAMIC_ARG_LIST0,HX_ARG_LIST0,0)
+#define DEFINE_VARRAY_FUNC1(ret,func) DEFINE_VARRAY_FUNC(ret,func,HX_ARR_LIST1,HX_DYNAMIC_ARG_LIST1,HX_ARG_LIST1,1)
+#define DEFINE_VARRAY_FUNC2(ret,func) DEFINE_VARRAY_FUNC(ret,func,HX_ARR_LIST2,HX_DYNAMIC_ARG_LIST2,HX_ARG_LIST2,2)
+#define DEFINE_VARRAY_FUNC3(ret,func) DEFINE_VARRAY_FUNC(ret,func,HX_ARR_LIST3,HX_DYNAMIC_ARG_LIST3,HX_ARG_LIST3,3)
+#define DEFINE_VARRAY_FUNC4(ret,func) DEFINE_VARRAY_FUNC(ret,func,HX_ARR_LIST4,HX_DYNAMIC_ARG_LIST4,HX_ARG_LIST4,4)
+
+
+DEFINE_VARRAY_FUNC1(return,concat);
+DEFINE_VARRAY_FUNC2(,insert);
+DEFINE_VARRAY_FUNC0(return,iterator);
+DEFINE_VARRAY_FUNC0(return,keyValueIterator);
+DEFINE_VARRAY_FUNC1(return,join);
+DEFINE_VARRAY_FUNC0(return,pop);
+DEFINE_VARRAY_FUNC0(return,copy);
+DEFINE_VARRAY_FUNC1(return,push);
+DEFINE_VARRAY_FUNC1(return,contains);
+DEFINE_VARRAY_FUNC1(return,remove);
+DEFINE_VARRAY_FUNC1(return,removeAt);
+DEFINE_VARRAY_FUNC2(return,indexOf);
+DEFINE_VARRAY_FUNC2(return,lastIndexOf);
+DEFINE_VARRAY_FUNC0(,reverse);
+DEFINE_VARRAY_FUNC0(return,shift);
+DEFINE_VARRAY_FUNC2(return,slice);
+DEFINE_VARRAY_FUNC2(return,splice);
+DEFINE_VARRAY_FUNC1(,sort);
+DEFINE_VARRAY_FUNC0(return,toString);
+DEFINE_VARRAY_FUNC1(,unshift);
+DEFINE_VARRAY_FUNC1(return,map);
+DEFINE_VARRAY_FUNC1(return,filter);
+DEFINE_VARRAY_FUNC1(,__SetSize);
+DEFINE_VARRAY_FUNC1(,__SetSizeExact);
+DEFINE_VARRAY_FUNC2(,zero);
+DEFINE_VARRAY_FUNC1(,memcmp);
+DEFINE_VARRAY_FUNC1(return,__unsafe_get);
+DEFINE_VARRAY_FUNC2(return,__unsafe_set);
+DEFINE_VARRAY_FUNC4(,blit);
+DEFINE_VARRAY_FUNC1(,resize);
+
+
+
+
+int VirtualArray_obj::__Compare(const hx::Object *inRHS) const
+{
+ if (inRHS->__GetType()!=vtArray)
+ return -1;
+ ArrayCommon *common = (ArrayCommon *)inRHS;
+ hx::Object *a = const_cast<VirtualArray_obj *>(this)->__GetRealObject();
+ hx::Object *b = common->__GetRealObject();
+ return a<b ? -1 : a>b;
+}
+
+Dynamic VirtualArray_obj::__GetItem(int inIndex) const
+{
+ checkBase();
+ if (store==hx::arrayEmpty || inIndex<0 || inIndex>=get_length()) return
+ null();
+ return base->__GetItem(inIndex);
+}
+
+Dynamic VirtualArray_obj::__SetItem(int inIndex,Dynamic inValue)
+{
+ checkBase();
+
+ if (store!=hx::arrayFixed)
+ {
+ if (inIndex>(store==hx::arrayEmpty ? 0 : (int)base->length) )
+ EnsureObjectStorage();
+ else
+ EnsureStorage(inValue);
+ }
+
+ base->__SetItem(inIndex,inValue);
+ return inValue;
+}
+
+hx::Val VirtualArray_obj::__Field(const String &inString, hx::PropertyAccess inCallProp)
+{
+ if (inString==HX_CSTRING("length")) return (int)get_length();
+ if (inString==HX_CSTRING("concat")) return concat_dyn();
+ if (inString==HX_CSTRING("insert")) return insert_dyn();
+ if (inString==HX_CSTRING("copy")) return copy_dyn();
+ if (inString==HX_CSTRING("iterator")) return iterator_dyn();
+ if (inString==HX_CSTRING("keyValueIterator")) return keyValueIterator_dyn();
+ if (inString==HX_CSTRING("join")) return join_dyn();
+ if (inString==HX_CSTRING("pop")) return pop_dyn();
+ if (inString==HX_CSTRING("push")) return push_dyn();
+ if (inString==HX_CSTRING("contains")) return contains_dyn();
+ if (inString==HX_CSTRING("remove")) return remove_dyn();
+ if (inString==HX_CSTRING("removeAt")) return removeAt_dyn();
+ if (inString==HX_CSTRING("indexOf")) return indexOf_dyn();
+ if (inString==HX_CSTRING("lastIndexOf")) return lastIndexOf_dyn();
+ if (inString==HX_CSTRING("reverse")) return reverse_dyn();
+ if (inString==HX_CSTRING("shift")) return shift_dyn();
+ if (inString==HX_CSTRING("splice")) return splice_dyn();
+ if (inString==HX_CSTRING("slice")) return slice_dyn();
+ if (inString==HX_CSTRING("sort")) return sort_dyn();
+ if (inString==HX_CSTRING("toString")) return toString_dyn();
+ if (inString==HX_CSTRING("unshift")) return unshift_dyn();
+ if (inString==HX_CSTRING("filter")) return filter_dyn();
+ if (inString==HX_CSTRING("map")) return map_dyn();
+ if (inString==HX_CSTRING("__SetSize")) return __SetSize_dyn();
+ if (inString==HX_CSTRING("__SetSizeExact")) return __SetSizeExact_dyn();
+ if (inString==HX_CSTRING("__unsafe_get")) return __unsafe_get_dyn();
+ if (inString==HX_CSTRING("__unsafe_set")) return __unsafe_set_dyn();
+ if (inString==HX_CSTRING("blit")) return blit_dyn();
+ if (inString==HX_CSTRING("zero")) return zero_dyn();
+ if (inString==HX_CSTRING("memcmp")) return memcmp_dyn();
+ if (inString==HX_CSTRING("resize")) return resize_dyn();
+
+ if (inString==HX_CSTRING("_hx_storeType"))
+ {
+ if (!base)
+ return -1;
+ return (int)base->getStoreType();
+ }
+ if (inString==HX_CSTRING("_hx_elementSize"))
+ {
+ if (!base)
+ return 0;
+ return (int)base->GetElementSize();
+ }
+ if (inString==HX_CSTRING("_hx_pointer"))
+ {
+ if (!base)
+ return cpp::CreateDynamicPointer((void *)0);
+ else
+ return cpp::CreateDynamicPointer((void *)base->GetBase());
+ }
+
+
+ return null();
+
+}
+
+
+hx::Class VirtualArray_obj::__GetClass() const { return ArrayBase::__mClass; }
+String VirtualArray_obj::toString()
+{
+ if (!base)
+ {
+ if (store==arrayEmpty)
+ return HX_CSTRING("[]");
+ return HX_CSTRING("null");
+ }
+ return base->toString();
+
+}
+
+void VirtualArray_obj::EnsureArrayStorage(ArrayStore inStore)
+{
+ switch(inStore)
+ {
+ case arrayFixed:
+ case arrayNull:
+ // These should not happen
+ break;
+
+ case arrayEmpty:
+ EnsureBase();
+ break;
+
+ case arrayBool: EnsureBoolStorage(); break;
+ case arrayInt: EnsureIntStorage(); break;
+ case arrayFloat: EnsureFloatStorage(); break;
+ case arrayString: EnsureStringStorage(); break;
+ case arrayInt64: EnsureInt64Storage(); break;
+ case arrayObject: EnsureObjectStorage(); break;
+ }
+}
+
+void VirtualArray_obj::EnsureArrayStorage(VirtualArray inValue)
+{
+ if (store!=arrayFixed)
+ {
+ if (inValue->store==arrayFixed)
+ {
+ EnsureArrayStorage(inValue->base->getStoreType());
+ store = arrayFixed;
+ }
+ else
+ {
+ EnsureArrayStorage(inValue->store);
+ }
+ }
+}
+
+void VirtualArray_obj::MakeIntArray()
+{
+ if (store==arrayEmpty && base )
+ {
+ int len = base->length;
+ base = new Array_obj<int>(len,len);
+ }
+ else if (!base)
+ base = new Array_obj<int>(0,0);
+ else
+ {
+ Array<int> result = Dynamic(base);
+ base = result.mPtr;
+ }
+ store = arrayInt;
+ HX_OBJ_WB_GET(this,base);
+}
+
+void VirtualArray_obj::MakeInt64Array()
+{
+ if (store==arrayEmpty && base)
+ {
+ int len = base->length;
+ base = new Array_obj< ::cpp::Int64>(len, len);
+ }
+ else if (!base)
+ base = new Array_obj< ::cpp::Int64>(0, 0);
+ else
+ {
+ Array< ::cpp::Int64> result = Dynamic(base);
+ base = result.mPtr;
+ }
+ store = arrayInt64;
+ HX_OBJ_WB_GET(this, base);
+}
+
+void VirtualArray_obj::MakeObjectArray()
+{
+ if (store==arrayEmpty && base )
+ {
+ // Actually, ok already.
+ }
+ else if (!base)
+ {
+ base = new Array_obj<Dynamic>(0,0);
+ HX_OBJ_WB_GET(this,base);
+ }
+ else
+ {
+ Array<Dynamic> result = Dynamic(base);
+ base = result.mPtr;
+ HX_OBJ_WB_GET(this,base);
+ }
+ store = arrayObject;
+}
+
+
+void VirtualArray_obj::MakeStringArray()
+{
+ if (store==arrayEmpty && base )
+ {
+ int len = base->length;
+ base = new Array_obj<String>(len,len);
+ }
+ else if (!base)
+ base = new Array_obj<String>(0,0);
+ else
+ {
+ Array<String> result = Dynamic(base);
+ base = result.mPtr;
+ }
+ store = arrayString;
+ HX_OBJ_WB_GET(this,base);
+}
+
+
+void VirtualArray_obj::MakeBoolArray()
+{
+ if (store==arrayEmpty && base )
+ {
+ int len = base->length;
+ base = new Array_obj<bool>(len,len);
+ }
+ else if (!base)
+ base = new Array_obj<bool>(0,0);
+ else
+ {
+ Array<bool> result = Dynamic(base);
+ base = result.mPtr;
+ }
+ store = arrayBool;
+ HX_OBJ_WB_GET(this,base);
+}
+
+
+void VirtualArray_obj::MakeFloatArray()
+{
+ if (store==arrayEmpty && base )
+ {
+ int len = base->length;
+ base = new Array_obj<Float>(len,len);
+ }
+ else if (!base)
+ base = new Array_obj<Float>(0,0);
+ else
+ {
+ Array<Float> result = Dynamic(base);
+ base = result.mPtr;
+ }
+ store = arrayFloat;
+ HX_OBJ_WB_GET(this,base);
+}
+
+void VirtualArray_obj::CreateEmptyArray(int inLen)
+{
+ base = new Array_obj<Dynamic>(inLen,inLen);
+ HX_OBJ_WB_GET(this,base);
+}
+
+void VirtualArray_obj::EnsureBase()
+{
+ if (!base)
+ {
+ base = new Array_obj<unsigned char>(0,0);
+ store = arrayInt;
+ HX_OBJ_WB_GET(this,base);
+ }
+}
+
+VirtualArray VirtualArray_obj::splice(int inPos, int len)
+{
+ if ( !base )
+ return new VirtualArray_obj();
+
+ Dynamic cut = base->__splice(inPos, len);
+
+ VirtualArray result = new VirtualArray_obj( dynamic_cast<cpp::ArrayBase_obj *>(cut.mPtr), false);
+ result->store = store;
+ return result;
+}
+
+VirtualArray VirtualArray_obj::map(Dynamic inFunc)
+{
+ VirtualArray result = new VirtualArray_obj( );
+ int len = get_length();
+ for(int i=0;i<len;i++)
+ result->push( inFunc( base->__GetItem(i) ) );
+ return result;
+}
+
+VirtualArray VirtualArray_obj::filter(Dynamic inFunc)
+{
+ if ( !base )
+ return new VirtualArray_obj();
+
+ Dynamic filtered = base->__filter(inFunc);
+
+ VirtualArray result = new VirtualArray_obj( dynamic_cast<cpp::ArrayBase_obj *>(filtered.mPtr), false);
+ result->store = store;
+ return result;
+}
+
+class EmptyIterator : public IteratorBase
+{
+public:
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdArrayIterator }; \
+
+ bool hasNext() { return false; }
+ Dynamic _dynamicNext() { return null(); }
+};
+
+
+
+Dynamic VirtualArray_obj::getEmptyIterator()
+{
+ return new EmptyIterator();
+}
+
+
+
+} // End namespace cpp
+
+Dynamic _hx_reslove_virtual_array(cpp::VirtualArray inArray)
+{
+ if (!inArray.mPtr)
+ return Dynamic();
+ if (inArray->store==hx::arrayFixed || inArray->store==hx::arrayObject)
+ return inArray->__GetRealObject();
+ return inArray;
+}
+
+#endif
diff --git a/Sources/c_snikket/src/Date.cpp b/Sources/c_snikket/src/Date.cpp
new file mode 100644
index 0000000..83667f5
--- /dev/null
+++ b/Sources/c_snikket/src/Date.cpp
@@ -0,0 +1,231 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Date
+#include <Date.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_8e4589df03e4f3cc_26_new,"Date","new",0x9aa26240,"Date.new","/usr/local/lib/haxe/std/cpp/_std/Date.hx",26,0xd1a513ee)
+HX_LOCAL_STACK_FRAME(_hx_pos_8e4589df03e4f3cc_30_getTime,"Date","getTime",0x0cac7da3,"Date.getTime","/usr/local/lib/haxe/std/cpp/_std/Date.hx",30,0xd1a513ee)
+HX_LOCAL_STACK_FRAME(_hx_pos_8e4589df03e4f3cc_62_getUTCHours,"Date","getUTCHours",0x5f8b1fa1,"Date.getUTCHours","/usr/local/lib/haxe/std/cpp/_std/Date.hx",62,0xd1a513ee)
+HX_LOCAL_STACK_FRAME(_hx_pos_8e4589df03e4f3cc_66_getUTCMinutes,"Date","getUTCMinutes",0x1440e071,"Date.getUTCMinutes","/usr/local/lib/haxe/std/cpp/_std/Date.hx",66,0xd1a513ee)
+HX_LOCAL_STACK_FRAME(_hx_pos_8e4589df03e4f3cc_70_getUTCSeconds,"Date","getUTCSeconds",0x1aefffd1,"Date.getUTCSeconds","/usr/local/lib/haxe/std/cpp/_std/Date.hx",70,0xd1a513ee)
+HX_LOCAL_STACK_FRAME(_hx_pos_8e4589df03e4f3cc_74_getUTCFullYear,"Date","getUTCFullYear",0xf9f9315a,"Date.getUTCFullYear","/usr/local/lib/haxe/std/cpp/_std/Date.hx",74,0xd1a513ee)
+HX_LOCAL_STACK_FRAME(_hx_pos_8e4589df03e4f3cc_78_getUTCMonth,"Date","getUTCMonth",0x4086b812,"Date.getUTCMonth","/usr/local/lib/haxe/std/cpp/_std/Date.hx",78,0xd1a513ee)
+HX_LOCAL_STACK_FRAME(_hx_pos_8e4589df03e4f3cc_82_getUTCDate,"Date","getUTCDate",0xb1f9e59c,"Date.getUTCDate","/usr/local/lib/haxe/std/cpp/_std/Date.hx",82,0xd1a513ee)
+HX_LOCAL_STACK_FRAME(_hx_pos_8e4589df03e4f3cc_94_toString,"Date","toString",0xd2a372cc,"Date.toString","/usr/local/lib/haxe/std/cpp/_std/Date.hx",94,0xd1a513ee)
+HX_LOCAL_STACK_FRAME(_hx_pos_8e4589df03e4f3cc_98_now,"Date","now",0x9aa26af6,"Date.now","/usr/local/lib/haxe/std/cpp/_std/Date.hx",98,0xd1a513ee)
+HX_LOCAL_STACK_FRAME(_hx_pos_8e4589df03e4f3cc_105_fromTime,"Date","fromTime",0x44fd3cb7,"Date.fromTime","/usr/local/lib/haxe/std/cpp/_std/Date.hx",105,0xd1a513ee)
+
+void Date_obj::__construct(int year,int month,int day,int hour,int min,int sec){
+ HX_STACKFRAME(&_hx_pos_8e4589df03e4f3cc_26_new)
+HXDLIN( 26) this->mSeconds = ::__hxcpp_new_date(year,month,day,hour,min,sec);
+ }
+
+Dynamic Date_obj::__CreateEmpty() { return new Date_obj; }
+
+void *Date_obj::_hx_vtable = 0;
+
+Dynamic Date_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Date_obj > _hx_result = new Date_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5]);
+ return _hx_result;
+}
+
+bool Date_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x018f7872;
+}
+
+Float Date_obj::getTime(){
+ HX_STACKFRAME(&_hx_pos_8e4589df03e4f3cc_30_getTime)
+HXDLIN( 30) return (this->mSeconds * ((Float)1000.0));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Date_obj,getTime,return )
+
+int Date_obj::getUTCHours(){
+ HX_STACKFRAME(&_hx_pos_8e4589df03e4f3cc_62_getUTCHours)
+HXDLIN( 62) return ::__hxcpp_get_utc_hours(this->mSeconds);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Date_obj,getUTCHours,return )
+
+int Date_obj::getUTCMinutes(){
+ HX_STACKFRAME(&_hx_pos_8e4589df03e4f3cc_66_getUTCMinutes)
+HXDLIN( 66) return ::__hxcpp_get_utc_minutes(this->mSeconds);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Date_obj,getUTCMinutes,return )
+
+int Date_obj::getUTCSeconds(){
+ HX_STACKFRAME(&_hx_pos_8e4589df03e4f3cc_70_getUTCSeconds)
+HXDLIN( 70) return ::__hxcpp_get_utc_seconds(this->mSeconds);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Date_obj,getUTCSeconds,return )
+
+int Date_obj::getUTCFullYear(){
+ HX_STACKFRAME(&_hx_pos_8e4589df03e4f3cc_74_getUTCFullYear)
+HXDLIN( 74) return ::__hxcpp_get_utc_year(this->mSeconds);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Date_obj,getUTCFullYear,return )
+
+int Date_obj::getUTCMonth(){
+ HX_STACKFRAME(&_hx_pos_8e4589df03e4f3cc_78_getUTCMonth)
+HXDLIN( 78) return ::__hxcpp_get_utc_month(this->mSeconds);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Date_obj,getUTCMonth,return )
+
+int Date_obj::getUTCDate(){
+ HX_STACKFRAME(&_hx_pos_8e4589df03e4f3cc_82_getUTCDate)
+HXDLIN( 82) return ::__hxcpp_get_utc_date(this->mSeconds);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Date_obj,getUTCDate,return )
+
+::String Date_obj::toString(){
+ HX_STACKFRAME(&_hx_pos_8e4589df03e4f3cc_94_toString)
+HXDLIN( 94) return ::__hxcpp_to_string(this->mSeconds);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Date_obj,toString,return )
+
+ ::Date Date_obj::now(){
+ HX_STACKFRAME(&_hx_pos_8e4589df03e4f3cc_98_now)
+HXDLIN( 98) return ::Date_obj::fromTime((( (Float)( ::__hxcpp_date_now()) ) * ((Float)1000.0)));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC0(Date_obj,now,return )
+
+ ::Date Date_obj::fromTime(Float t){
+ HX_GC_STACKFRAME(&_hx_pos_8e4589df03e4f3cc_105_fromTime)
+HXLINE( 106) ::Date result = ::Date_obj::__alloc( HX_CTX ,0,0,0,0,0,0);
+HXLINE( 107) result->mSeconds = (t * ((Float)0.001));
+HXLINE( 108) return result;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Date_obj,fromTime,return )
+
+
+Date_obj::Date_obj()
+{
+}
+
+::hx::Val Date_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 7:
+ if (HX_FIELD_EQ(inName,"getTime") ) { return ::hx::Val( getTime_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"mSeconds") ) { return ::hx::Val( mSeconds ); }
+ if (HX_FIELD_EQ(inName,"toString") ) { return ::hx::Val( toString_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"getUTCDate") ) { return ::hx::Val( getUTCDate_dyn() ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"getUTCHours") ) { return ::hx::Val( getUTCHours_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getUTCMonth") ) { return ::hx::Val( getUTCMonth_dyn() ); }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"getUTCMinutes") ) { return ::hx::Val( getUTCMinutes_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getUTCSeconds") ) { return ::hx::Val( getUTCSeconds_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"getUTCFullYear") ) { return ::hx::Val( getUTCFullYear_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool Date_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"now") ) { outValue = now_dyn(); return true; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"fromTime") ) { outValue = fromTime_dyn(); return true; }
+ }
+ return false;
+}
+
+::hx::Val Date_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 8:
+ if (HX_FIELD_EQ(inName,"mSeconds") ) { mSeconds=inValue.Cast< Float >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void Date_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("mSeconds",92,75,59,82));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Date_obj_sMemberStorageInfo[] = {
+ {::hx::fsFloat,(int)offsetof(Date_obj,mSeconds),HX_("mSeconds",92,75,59,82)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *Date_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Date_obj_sMemberFields[] = {
+ HX_("mSeconds",92,75,59,82),
+ HX_("getTime",c3,7b,7f,1f),
+ HX_("getUTCHours",c1,ad,87,77),
+ HX_("getUTCMinutes",91,36,15,8f),
+ HX_("getUTCSeconds",f1,55,c4,95),
+ HX_("getUTCFullYear",3a,37,f0,f8),
+ HX_("getUTCMonth",32,46,83,58),
+ HX_("getUTCDate",7c,7b,c0,a7),
+ HX_("toString",ac,d0,6e,38),
+ ::String(null()) };
+
+::hx::Class Date_obj::__mClass;
+
+static ::String Date_obj_sStaticFields[] = {
+ HX_("now",16,d9,53,00),
+ HX_("fromTime",97,9a,c8,aa),
+ ::String(null())
+};
+
+void Date_obj::__register()
+{
+ Date_obj _hx_dummy;
+ Date_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("Date",4e,82,3c,2d);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Date_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Date_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Date_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Date_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Date_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Date_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
diff --git a/Sources/c_snikket/src/Dynamic.cpp b/Sources/c_snikket/src/Dynamic.cpp
new file mode 100644
index 0000000..9feaa5c
--- /dev/null
+++ b/Sources/c_snikket/src/Dynamic.cpp
@@ -0,0 +1,637 @@
+#include <hxcpp.h>
+#include <math.h>
+#include <hxMath.h>
+#include <stdio.h>
+
+using namespace hx;
+
+
+
+extern hx::Class __StringClass;
+namespace hx
+{
+
+extern hx::Class hxEnumBase_obj__mClass;
+extern hx::Class Object__mClass;
+
+
+hx::Class __BoolClass;
+hx::Class __IntClass;
+hx::Class __FloatClass;
+hx::Class __Int64Class;
+hx::Class __PointerClass;
+hx::Class __VoidClass;
+#ifdef HXCPP_OBJC
+hx::Class __ObjcClass;
+#endif
+
+
+hx::Class &GetBoolClass() { return __BoolClass; }
+hx::Class &GetIntClass() { return __IntClass; }
+hx::Class &GetFloatClass() { return __FloatClass; }
+hx::Class &GetInt64Class() { return __Int64Class; }
+hx::Class &GetPointerClass() { return __PointerClass; }
+hx::Class &GetVoidClass() { return __VoidClass; }
+
+
+
+// --- "Simple" Data Objects ---------------------------------------------------
+
+
+Dynamic DynTrue;
+Dynamic DynFalse;
+
+class IntData : public hx::Object
+{
+public:
+ enum { _hx_ClassId = hx::clsIdInt };
+
+ bool _hx_isInstanceOf(int inClassId)
+ {
+ return inClassId==1 || inClassId==(int)_hx_ClassId || inClassId==(int)hx::clsIdFloat;
+ }
+
+
+ inline void *operator new( size_t inSize, hx::NewObjectType inAlloc=NewObjAlloc, const char *inName="Int")
+ { return hx::Object::operator new(inSize,inAlloc,inName); }
+ IntData(int inValue=0) : mValue(inValue) {};
+
+ hx::Class __GetClass() const { return __IntClass; }
+
+ virtual int __GetType() const { return vtInt; }
+
+ String toString() { return String(mValue); }
+ String __ToString() const { return String(mValue); }
+ double __ToDouble() const { return mValue; }
+ int __ToInt() const { return mValue; }
+ cpp::Int64 __ToInt64() const { return mValue; }
+
+ int __Compare(const hx::Object *inRHS) const
+ {
+ double diff = mValue - inRHS->__ToDouble();
+ return diff < 0 ? -1 : diff==0 ? 0 : 1;
+ }
+
+
+ int mValue;
+};
+
+
+class BoolData : public hx::Object
+{
+public:
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = clsIdBool };
+
+ inline void *operator new( size_t inSize, hx::NewObjectType inAlloc=NewObjAlloc,const char *inName="Bool")
+ { return hx::Object::operator new(inSize,inAlloc,"Bool"); }
+ BoolData(bool inValue=false) : mValue(inValue) {};
+
+ hx::Class __GetClass() const { return __BoolClass; }
+
+ virtual int __GetType() const { return vtBool; }
+
+ String __ToString() const { return mValue ? HX_CSTRING("true") : HX_CSTRING("false"); }
+ String toString() { return mValue ? HX_CSTRING("true") : HX_CSTRING("false"); }
+ double __ToDouble() const { return mValue; }
+ int __ToInt() const { return mValue; }
+
+ int __Compare(const hx::Object *inRHS) const
+ {
+ double diff = (double)mValue - inRHS->__ToDouble();
+ return diff < 0 ? -1 : diff==0 ? 0 : 1;
+ }
+
+
+ bool mValue;
+};
+
+
+
+class DoubleData : public hx::Object
+{
+public:
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdFloat };
+
+ inline void *operator new( size_t inSize, hx::NewObjectType inAlloc=NewObjAlloc,const char *inName="Float")
+ { return hx::Object::operator new(inSize,inAlloc,inName); }
+ DoubleData(double inValue=0) : mValue(inValue) {};
+
+ hx::Class __GetClass() const { return __FloatClass; }
+
+ virtual int __GetType() const { return vtFloat; }
+ String toString() { return String(mValue); }
+ String __ToString() const { return String(mValue); }
+ double __ToDouble() const { return mValue; }
+ int __ToInt() const { return (int)mValue; }
+ cpp::Int64 __ToInt64() const { return mValue; }
+
+ int __Compare(const hx::Object *inRHS) const
+ {
+ double rval = inRHS->__ToDouble();
+ if (rval==mValue)
+ return 0;
+
+ return mValue < rval ? -1 : 1;
+ }
+
+
+ double mValue;
+};
+
+
+class Int64Data : public hx::Object
+{
+public:
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdInt64 };
+
+ inline void *operator new( size_t inSize, hx::NewObjectType inAlloc=NewObjAlloc,const char *inName="Int64")
+ { return hx::Object::operator new(inSize,inAlloc,inName); }
+ Int64Data(cpp::Int64 inValue=0) : mValue(inValue) {};
+
+ hx::Class __GetClass() const { return __Int64Class; }
+
+ virtual int __GetType() const { return vtInt64; }
+ String toString() { return String(mValue); }
+ String __ToString() const { return String(mValue); }
+ double __ToDouble() const { return mValue; }
+ int __ToInt() const { return (int)mValue; }
+ cpp::Int64 __ToInt64() const { return mValue; }
+ void __GetFields(Array<String> &outFields)
+ {
+ outFields->push( HX_HCSTRING("hi","\x01","\x5b","\x00","\x00") );
+ outFields->push( HX_HCSTRING("lo","\x83","\x5e","\x00","\x00") );
+ }
+ hx::Val __Field(const String &inName, hx::PropertyAccess inCallProp)
+ {
+ if (HX_FIELD_EQ(inName,"hi") ) { return hx::Val( (int)(mValue>>32)); }
+ if (HX_FIELD_EQ(inName,"lo") ) { return hx::Val( (int)(mValue&0xffffffff)); }
+ return hx::Object::__Field(inName,inCallProp);
+ }
+ hx::Val __SetField(const String &inName,const hx::Val &inValue, hx::PropertyAccess inCallProp)
+ {
+ if (HX_FIELD_EQ(inName,"hi") )
+ {
+ mValue = (int)(mValue & 0xffffffff) | (cpp::Int64(inValue.Cast< int >())<<32);
+ return inValue;
+ }
+ if (HX_FIELD_EQ(inName,"lo") )
+ {
+ mValue = (mValue & (cpp::Int64(0xffffffff)<<32) ) | cpp::Int64( (unsigned int)(inValue.Cast< int >()));
+ return inValue;
+ }
+ return hx::Object::__SetField(inName,inValue,inCallProp);
+ }
+
+ int __Compare(const hx::Object *inRHS) const
+ {
+ double rval = inRHS->__ToInt64();
+ if (rval==mValue)
+ return 0;
+
+ return mValue < rval ? -1 : 1;
+ }
+
+
+
+
+ cpp::Int64 mValue;
+};
+
+
+
+class PointerData : public hx::Object
+{
+public:
+ inline void *operator new( size_t inSize, hx::NewObjectType inAlloc=NewObjAlloc,const char *inName="cpp.Pointer")
+ { return hx::Object::operator new(inSize,inAlloc,inName); }
+
+ PointerData(void *inValue) : mValue(inValue) {};
+
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdPointer };
+
+ hx::Class __GetClass() const { return __PointerClass; }
+
+ // k_cpp_pointer
+ int __GetType() const { return vtAbstractBase + 2; }
+ void * __GetHandle() const { return mValue; }
+ String toString()
+ {
+ char buf[100];
+ snprintf(buf,sizeof(buf),"Pointer(%p)", mValue);
+ return String(buf);
+ }
+ String __ToString() const { return String(mValue); }
+
+ int __Compare(const hx::Object *inRHS) const
+ {
+ void *r = inRHS==0 ? 0 : inRHS->__GetHandle();
+ return mValue < r ? -1 : mValue==r ? 0 : 1;
+ }
+
+
+ void *mValue;
+};
+
+
+class StructData : public hx::Object
+{
+public:
+ inline void *operator new( size_t inSize, hx::NewObjectType inAlloc=NewObjContainer,const char *inName="cpp.Struct")
+ { return hx::Object::operator new(inSize,inAlloc,inName); }
+
+ StructData(const void *inValue,int inLength, cpp::DynamicHandlerFunc inHandler)
+ {
+ mLength= inLength;
+ mValue = InternalNew(inLength,false);
+ HX_OBJ_WB_GET(this, mValue);
+ memcpy(mValue, inValue, inLength);
+ mHandler = inHandler;
+ }
+
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdStruct };
+
+ hx::Class __GetClass() const { return __PointerClass; }
+
+ // k_cpp_struct
+ int __GetType() const { return vtAbstractBase + 3; }
+ void * __GetHandle() const { return mValue; }
+ String toString()
+ {
+ return __ToString();
+ }
+ String __ToString() const
+ {
+ String result;
+ mHandler(cpp::dhoToString, mValue, 0, &result );
+ return result;
+ }
+ const char *__CStr() const
+ {
+ const char *result = "unknown";
+ mHandler(cpp::dhoGetClassName, mValue, 0, &result );
+ return result;
+ }
+
+ int __Compare(const hx::Object *inRHS) const
+ {
+ if (!inRHS)
+ return 1;
+
+ int diff = __length() - inRHS->__length();
+ if (diff==0)
+ diff = __GetType() - inRHS->__GetType();
+ if (diff==0)
+ diff = memcmp( mValue, inRHS->__GetHandle(), mLength );
+
+ if (diff<0) return -1;
+ if (diff>0) return 1;
+ return 0;
+ }
+
+ int __length() const { return mLength; }
+
+ void __Mark(hx::MarkContext *__inCtx)
+ {
+ HX_MARK_ARRAY(mValue);
+ }
+
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx)
+ {
+ HX_VISIT_ARRAY(mValue);
+ }
+ #endif
+
+ int mLength;
+ void *mValue;
+ cpp::DynamicHandlerFunc mHandler;
+};
+
+
+
+
+
+}
+
+
+namespace cpp
+{
+// --- Pointer -------------------------------------------------
+
+Dynamic CreateDynamicPointer(void *inValue) {
+ if (!inValue)
+ return Dynamic();
+ return new hx::PointerData(inValue);
+}
+
+// --- Struct -------------------------------------------------
+
+Dynamic CreateDynamicStruct(const void *inValue, int inSize, DynamicHandlerFunc inFunc)
+
+{
+ return new hx::StructData(inValue,inSize,inFunc); }
+}
+
+
+
+// --- Dynamic -------------------------------------------------
+
+Dynamic sConstDynamicInts[256+1];
+
+static hx::Object *fromInt(int inVal)
+{
+ hx::Object *result = 0;
+ if (inVal>=-1 && inVal<256)
+ {
+ int idx = inVal+1;
+ result = sConstDynamicInts[idx].mPtr;
+ if (!result)
+ result = sConstDynamicInts[idx].mPtr = new (hx::NewObjConst)IntData(inVal);
+ }
+ else
+ result = (hx::Object *)new IntData(inVal);
+ return result;
+}
+
+Dynamic::Dynamic(bool inVal) : super( inVal ? hx::DynTrue.mPtr : hx::DynFalse.mPtr ) { }
+
+
+Dynamic::Dynamic(int inVal)
+{
+ mPtr = fromInt(inVal);
+}
+
+Dynamic::Dynamic(short inVal)
+{
+ mPtr = fromInt(inVal);
+}
+
+#if !defined(__GNUC__) || defined(__MINGW32__) || (defined(__WORDSIZE) && (__WORDSIZE != 64))
+Dynamic::Dynamic(unsigned long inVal)
+{
+ mPtr = fromInt(inVal);
+}
+Dynamic::Dynamic(long inVal)
+{
+ mPtr = fromInt(inVal);
+}
+#endif
+
+Dynamic::Dynamic(unsigned int inVal)
+{
+ mPtr = fromInt(inVal);
+}
+
+Dynamic::Dynamic(unsigned short inVal)
+{
+ mPtr = fromInt(inVal);
+}
+
+Dynamic::Dynamic(unsigned char inVal)
+{
+ mPtr = fromInt(inVal);
+}
+
+Dynamic::Dynamic(signed char inVal)
+{
+ mPtr = fromInt(inVal);
+}
+
+
+
+Dynamic::Dynamic(double inVal)
+{
+ if ( (int)inVal==inVal && inVal>=-1 && inVal<256 )
+ {
+ int idx = inVal+1;
+ mPtr = sConstDynamicInts[idx].mPtr;
+ if (!mPtr)
+ mPtr = sConstDynamicInts[idx].mPtr = new (hx::NewObjConst)IntData(inVal);
+ }
+ else
+ mPtr = (hx::Object *)new DoubleData(inVal);
+}
+
+
+Dynamic::Dynamic(cpp::Int64 inVal)
+{
+ if ( (int)inVal==inVal && inVal>=-1 && inVal<256 )
+ {
+ int idx = inVal+1;
+ mPtr = sConstDynamicInts[idx].mPtr;
+ if (!mPtr)
+ mPtr = sConstDynamicInts[idx].mPtr = new (hx::NewObjConst)IntData(inVal);
+ }
+ else
+ mPtr = (hx::Object *)new Int64Data(inVal);
+}
+
+
+Dynamic::Dynamic(cpp::UInt64 inVal)
+{
+ if ( (int)inVal==inVal && inVal<256 )
+ {
+ int idx = inVal+1;
+ mPtr = sConstDynamicInts[idx].mPtr;
+ if (!mPtr)
+ mPtr = sConstDynamicInts[idx].mPtr = new (hx::NewObjConst)IntData(inVal);
+ }
+ else
+ mPtr = (hx::Object *)new Int64Data(inVal);
+}
+
+Dynamic::Dynamic(unsigned long inVal)
+{
+ if ( (int)inVal==inVal && inVal<256 )
+ {
+ int idx = inVal+1;
+ mPtr = sConstDynamicInts[idx].mPtr;
+ if (!mPtr)
+ mPtr = sConstDynamicInts[idx].mPtr = new (hx::NewObjConst)IntData(inVal);
+ }
+ else
+ mPtr = (hx::Object *)new Int64Data(inVal);
+}
+
+
+
+
+
+Dynamic::Dynamic(float inVal)
+{
+ mPtr = Dynamic( (double) inVal ).mPtr;
+}
+
+Dynamic::Dynamic(const cpp::CppInt32__ &inVal) :
+ super( Dynamic(inVal.mValue).mPtr ) { }
+
+Dynamic::Dynamic(const String &inVal) :
+ super( inVal.raw_ptr() ? inVal.__ToObject() : 0 ) { }
+
+Dynamic::Dynamic(const HX_CHAR *inVal) :
+ super( inVal ? String(inVal).__ToObject() : 0 ) { }
+
+
+Dynamic Dynamic::operator+(const Dynamic &inRHS) const
+{
+ int t1 = mPtr ? mPtr->__GetType() : vtNull;
+ int t2 = inRHS.mPtr ? inRHS.mPtr->__GetType() : vtNull;
+
+ if ( (t1==vtInt || t1==vtFloat) && (t2==vtInt || t2==vtFloat) )
+ {
+ return mPtr->__ToDouble() + inRHS.mPtr->__ToDouble();
+ }
+ if (!mPtr)
+ return String() + inRHS;
+ if (!inRHS.mPtr)
+ return *this + String();
+
+ return const_cast<hx::Object*>(mPtr)->toString() + const_cast<Dynamic&>(inRHS)->toString();
+}
+
+#define DYN_OP_ADD(TYPE) \
+Dynamic Dynamic::operator+(const TYPE &i) const \
+{ \
+ int t = mPtr ? mPtr->__GetType() : vtNull; \
+ if (t==vtString) \
+ return Cast<String>() + String(i); \
+ return Cast<double>() + i; \
+}
+
+DYN_OP_ADD(double)
+DYN_OP_ADD(float)
+DYN_OP_ADD(int)
+DYN_OP_ADD(unsigned int)
+DYN_OP_ADD(short)
+DYN_OP_ADD(unsigned short)
+DYN_OP_ADD(signed char)
+DYN_OP_ADD(unsigned char)
+DYN_OP_ADD(cpp::Int64)
+DYN_OP_ADD(cpp::UInt64)
+
+Dynamic Dynamic::operator+(const cpp::Variant &v) const
+{
+ int t = mPtr ? mPtr->__GetType() : vtNull;
+ if (t==vtString || v.type == cpp::Variant::typeString)
+ return Cast<String>() + v.asString();
+ return Cast<double>() + v.asDouble();
+}
+
+
+
+double Dynamic::operator%(const Dynamic &inRHS) const
+{
+ if (mPtr->__GetType()==vtInt && inRHS.mPtr->__GetType()==vtInt)
+ return mPtr->__ToInt() % inRHS->__ToInt();
+ double lhs = mPtr->__ToDouble();
+ double rhs = inRHS->__ToDouble();
+ int even = (int)(lhs/rhs);
+ double remain = lhs - even * rhs;
+ if (remain<0) remain += fabs(rhs);
+ return remain;
+}
+
+hx::IndexRef Dynamic::operator[](int inIndex)
+{
+ return hx::IndexRef(mPtr,inIndex);
+}
+
+
+void Dynamic::ThrowBadFunctionError()
+{
+ #ifdef HXCPP_DEBUGGER
+ NullReference("Function", true);
+ #endif
+ hx::Throw( HX_NULL_FUNCTION_POINTER );
+}
+
+#include <hx/DynamicImpl.h>
+
+namespace cpp
+{
+CppInt32__::CppInt32__(const Dynamic &inD) : mValue(inD->__ToInt()) { }
+}
+
+namespace hx {
+null BadCast()
+{
+ hx::Throw(HX_INVALID_CAST);
+ return null();
+}
+
+void InvalidInterface()
+{
+ hx::Throw(HX_INVALID_INTERFACE);
+}
+
+
+}
+
+
+static bool NoCast(hx::Object *) { return false; }
+static bool IsFloat(hx::Object *inPtr)
+{
+ return inPtr && (TCanCast<IntData>(inPtr) || TCanCast<DoubleData>(inPtr) || TCanCast<Int64Data>(inPtr) );
+}
+static bool IsInt64(hx::Object *inPtr)
+{
+ return inPtr && (TCanCast<Int64Data>(inPtr) || TCanCast<IntData>(inPtr));
+}
+
+static bool IsPointer(hx::Object *inPtr)
+{
+ return inPtr && inPtr->__GetType() >= vtAbstractBase;
+}
+
+static bool IsInt(hx::Object *inPtr)
+{
+ if (!inPtr)
+ return false;
+ if (TCanCast<IntData>(inPtr))
+ return true;
+ DoubleData *d = dynamic_cast<DoubleData *>(inPtr);
+ if (!d)
+ {
+ Int64Data *i64 = dynamic_cast<Int64Data *>(inPtr);
+ if (i64)
+ {
+ int val = i64->mValue;
+ return val==i64->mValue;
+ }
+ return false;
+ }
+ double val = d->__ToDouble();
+ return ((int)val == val);
+}
+
+static Dynamic createEmptyInt64()
+{
+ return new Int64Data();
+}
+
+static Dynamic createInt64(hx::DynamicArray inArgs)
+{
+ return new Int64Data();
+}
+
+void Dynamic::__boot()
+{
+ Static(__VoidClass) = hx::_hx_RegisterClass(HX_CSTRING("Void"),NoCast,sNone,sNone,0,0,0, 0, 0
+ #ifdef HXCPP_VISIT_ALLOCS
+ ,0
+ #endif
+ );
+ Static(__BoolClass) = hx::_hx_RegisterClass(HX_CSTRING("Bool"),TCanCast<BoolData>,sNone,sNone, 0,0, 0);
+ Static(__IntClass) = hx::_hx_RegisterClass(HX_CSTRING("Int"),IsInt,sNone,sNone,0,0, 0 );
+ Static(__FloatClass) = hx::_hx_RegisterClass(HX_CSTRING("Float"),IsFloat,sNone,sNone, 0,0,&__IntClass );
+ Static(__Int64Class) = hx::_hx_RegisterClass(HX_CSTRING("cpp::Int64"),IsInt64,sNone,sNone, 0,0,&__IntClass );
+ __Int64Class->mConstructEmpty = &createEmptyInt64;
+ __Int64Class->mConstructArgs = &createInt64;
+
+ Static(__PointerClass) = hx::_hx_RegisterClass(HX_CSTRING("cpp::Pointer"),IsPointer,sNone,sNone, 0,0,&__PointerClass );
+ DynTrue = Dynamic( new (hx::NewObjConst) hx::BoolData(true) );
+ DynFalse = Dynamic( new (hx::NewObjConst) hx::BoolData(false) );
+#ifdef HXCPP_OBJC
+ Static(__ObjcClass) = hx::_hx_RegisterClass(HX_CSTRING("objc::BoxedType"),IsPointer,sNone,sNone, 0,0,&__ObjcClass );
+#endif
+}
diff --git a/Sources/c_snikket/src/EReg.cpp b/Sources/c_snikket/src/EReg.cpp
new file mode 100644
index 0000000..f12470b
--- /dev/null
+++ b/Sources/c_snikket/src/EReg.cpp
@@ -0,0 +1,578 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_EReg
+#include <EReg.h>
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_StringBuf
+#include <StringBuf.h>
+#endif
+#ifndef INCLUDED_haxe_Exception
+#include <haxe/Exception.h>
+#endif
+#ifndef INCLUDED_haxe_ValueException
+#include <haxe/ValueException.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_359fe5fd855fee60_28_new,"EReg","new",0x8b859e81,"EReg.new","/usr/local/lib/haxe/std/cpp/_std/EReg.hx",28,0x5a2fdacd)
+HX_LOCAL_STACK_FRAME(_hx_pos_359fe5fd855fee60_36_match,"EReg","match",0x18fda1a6,"EReg.match","/usr/local/lib/haxe/std/cpp/_std/EReg.hx",36,0x5a2fdacd)
+HX_LOCAL_STACK_FRAME(_hx_pos_359fe5fd855fee60_45_matched,"EReg","matched",0x8ce62f85,"EReg.matched","/usr/local/lib/haxe/std/cpp/_std/EReg.hx",45,0x5a2fdacd)
+HX_LOCAL_STACK_FRAME(_hx_pos_359fe5fd855fee60_62_matchedPos,"EReg","matchedPos",0x7007a70f,"EReg.matchedPos","/usr/local/lib/haxe/std/cpp/_std/EReg.hx",62,0x5a2fdacd)
+HX_LOCAL_STACK_FRAME(_hx_pos_359fe5fd855fee60_65_matchSub,"EReg","matchSub",0xbc75cb7a,"EReg.matchSub","/usr/local/lib/haxe/std/cpp/_std/EReg.hx",65,0x5a2fdacd)
+HX_LOCAL_STACK_FRAME(_hx_pos_359fe5fd855fee60_98_replace,"EReg","replace",0xae923ad5,"EReg.replace","/usr/local/lib/haxe/std/cpp/_std/EReg.hx",98,0x5a2fdacd)
+static const ::String _hx_array_data_2dda4a0f_8[] = {
+ HX_("$",24,00,00,00),
+};
+static const ::String _hx_array_data_2dda4a0f_9[] = {
+ HX_("$",24,00,00,00),
+};
+HX_LOCAL_STACK_FRAME(_hx_pos_359fe5fd855fee60_149_map,"EReg","map",0x8b84d8bd,"EReg.map","/usr/local/lib/haxe/std/cpp/_std/EReg.hx",149,0x5a2fdacd)
+
+void EReg_obj::__construct(::String r,::String opt){
+ HX_STACKFRAME(&_hx_pos_359fe5fd855fee60_28_new)
+HXLINE( 29) ::Array< ::String > a = opt.split(HX_("g",67,00,00,00));
+HXLINE( 30) this->global = (a->length > 1);
+HXLINE( 31) if (this->global) {
+HXLINE( 32) opt = a->join(HX_("",00,00,00,00));
+ }
+HXLINE( 33) this->r = _hx_regexp_new_options(r,opt);
+ }
+
+Dynamic EReg_obj::__CreateEmpty() { return new EReg_obj; }
+
+void *EReg_obj::_hx_vtable = 0;
+
+Dynamic EReg_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< EReg_obj > _hx_result = new EReg_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1]);
+ return _hx_result;
+}
+
+bool EReg_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x022d4033;
+}
+
+bool EReg_obj::match(::String s){
+ HX_STACKFRAME(&_hx_pos_359fe5fd855fee60_36_match)
+HXLINE( 37) bool p = _hx_regexp_match(this->r,s,0,s.length);
+HXLINE( 38) if (p) {
+HXLINE( 39) this->last = s;
+ }
+ else {
+HXLINE( 41) this->last = null();
+ }
+HXLINE( 42) return p;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(EReg_obj,match,return )
+
+::String EReg_obj::matched(int n){
+ HX_STACKFRAME(&_hx_pos_359fe5fd855fee60_45_matched)
+HXLINE( 46) ::String m = _hx_regexp_matched(this->r,n);
+HXLINE( 47) return m;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(EReg_obj,matched,return )
+
+ ::Dynamic EReg_obj::matchedPos(){
+ HX_STACKFRAME(&_hx_pos_359fe5fd855fee60_62_matchedPos)
+HXDLIN( 62) return _hx_regexp_matched_pos(this->r,0);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(EReg_obj,matchedPos,return )
+
+bool EReg_obj::matchSub(::String s,int pos,::hx::Null< int > __o_len){
+ int len = __o_len.Default(-1);
+ HX_STACKFRAME(&_hx_pos_359fe5fd855fee60_65_matchSub)
+HXLINE( 66) int p;
+HXDLIN( 66) if ((len < 0)) {
+HXLINE( 66) p = (s.length - pos);
+ }
+ else {
+HXLINE( 66) p = len;
+ }
+HXDLIN( 66) bool p1 = _hx_regexp_match(this->r,s,pos,p);
+HXLINE( 67) if (p1) {
+HXLINE( 68) this->last = s;
+ }
+ else {
+HXLINE( 70) this->last = null();
+ }
+HXLINE( 71) return p1;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(EReg_obj,matchSub,return )
+
+::String EReg_obj::replace(::String s,::String by){
+ HX_GC_STACKFRAME(&_hx_pos_359fe5fd855fee60_98_replace)
+HXLINE( 99) ::StringBuf b = ::StringBuf_obj::__alloc( HX_CTX );
+HXLINE( 100) int pos = 0;
+HXLINE( 101) int len = s.length;
+HXLINE( 102) ::Array< ::String > a = by.split(HX_("$",24,00,00,00));
+HXLINE( 103) bool first = true;
+HXLINE( 104) while(_hx_regexp_match(this->r,s,pos,len)){
+HXLINE( 107) ::Dynamic p = _hx_regexp_matched_pos(this->r,0);
+HXLINE( 108) bool _hx_tmp;
+HXDLIN( 108) if (::hx::IsEq( p->__Field(HX_("len",d5,4b,52,00),::hx::paccDynamic),0 )) {
+HXLINE( 108) _hx_tmp = !(first);
+ }
+ else {
+HXLINE( 108) _hx_tmp = false;
+ }
+HXDLIN( 108) if (_hx_tmp) {
+HXLINE( 109) if (::hx::IsEq( p->__Field(HX_("pos",94,5d,55,00),::hx::paccDynamic),s.length )) {
+HXLINE( 110) goto _hx_goto_5;
+ }
+HXLINE( 111) ::Dynamic p1 = p;
+HXDLIN( 111) p1->__SetField(HX_("pos",94,5d,55,00),(p1->__Field(HX_("pos",94,5d,55,00),::hx::paccDynamic) + 1),::hx::paccDynamic);
+ }
+HXLINE( 113) {
+HXLINE( 113) ::Dynamic len1 = (( (int)(p->__Field(HX_("pos",94,5d,55,00),::hx::paccDynamic)) ) - pos);
+HXDLIN( 113) if (::hx::IsNotNull( b->charBuf )) {
+HXLINE( 113) b->flush();
+ }
+HXDLIN( 113) if (::hx::IsNull( b->b )) {
+HXLINE( 113) b->b = ::Array_obj< ::String >::__new(1)->init(0,s.substr(pos,len1));
+ }
+ else {
+HXLINE( 113) ::Array< ::String > b1 = b->b;
+HXDLIN( 113) b1->push(s.substr(pos,len1));
+ }
+ }
+HXLINE( 114) if ((a->length > 0)) {
+HXLINE( 115) ::String x = a->__get(0);
+HXDLIN( 115) if (::hx::IsNotNull( b->charBuf )) {
+HXLINE( 115) b->flush();
+ }
+HXDLIN( 115) if (::hx::IsNull( b->b )) {
+HXLINE( 115) b->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x));
+ }
+ else {
+HXLINE( 115) ::Array< ::String > b2 = b->b;
+HXDLIN( 115) b2->push(::Std_obj::string(x));
+ }
+ }
+HXLINE( 116) int i = 1;
+HXLINE( 117) while((i < a->length)){
+HXLINE( 118) ::String k = a->__get(i);
+HXLINE( 119) ::Dynamic c = k.charCodeAt(0);
+HXLINE( 121) bool _hx_tmp1;
+HXDLIN( 121) if (::hx::IsGreaterEq( c,49 )) {
+HXLINE( 121) _hx_tmp1 = ::hx::IsLessEq( c,57 );
+ }
+ else {
+HXLINE( 121) _hx_tmp1 = false;
+ }
+HXDLIN( 121) if (_hx_tmp1) {
+HXLINE( 122) ::Dynamic p2;
+HXDLIN( 122) try {
+ HX_STACK_CATCHABLE(::String, 0);
+ HX_STACK_CATCHABLE( ::haxe::ValueException, 1);
+HXLINE( 122) ::Dynamic p3 = this->r;
+HXDLIN( 122) p2 = _hx_regexp_matched_pos(p3,(::Std_obj::_hx_int(( (Float)(c) )) - 48));
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::String >() && _hx_e->toString()!=null() ){
+ HX_STACK_BEGIN_CATCH
+ ::String e = _hx_e;
+HXLINE( 122) p2 = null();
+ }
+ else if (_hx_e.IsClass< ::haxe::ValueException >() ){
+ HX_STACK_BEGIN_CATCH
+ ::haxe::ValueException _g = _hx_e;
+HXLINE( 122) {
+HXLINE( 122) null();
+ }
+HXDLIN( 122) if (::Std_obj::isOfType(_g->value,::hx::ClassOf< ::String >())) {
+HXLINE( 122) p2 = null();
+ }
+ else {
+HXLINE( 122) HX_STACK_DO_THROW(_g);
+ }
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+HXLINE( 123) if (::hx::IsNull( p2 )) {
+HXLINE( 124) {
+HXLINE( 124) if (::hx::IsNotNull( b->charBuf )) {
+HXLINE( 124) b->flush();
+ }
+HXDLIN( 124) if (::hx::IsNull( b->b )) {
+HXLINE( 124) b->b = ::Array_obj< ::String >::fromData( _hx_array_data_2dda4a0f_8,1);
+ }
+ else {
+HXLINE( 124) b->b->push(HX_("$",24,00,00,00));
+ }
+ }
+HXLINE( 125) {
+HXLINE( 125) if (::hx::IsNotNull( b->charBuf )) {
+HXLINE( 125) b->flush();
+ }
+HXDLIN( 125) if (::hx::IsNull( b->b )) {
+HXLINE( 125) b->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(k));
+ }
+ else {
+HXLINE( 125) ::Array< ::String > b3 = b->b;
+HXDLIN( 125) b3->push(::Std_obj::string(k));
+ }
+ }
+ }
+ else {
+HXLINE( 127) {
+HXLINE( 127) int pos1 = ( (int)(p2->__Field(HX_("pos",94,5d,55,00),::hx::paccDynamic)) );
+HXDLIN( 127) ::Dynamic len2 = p2->__Field(HX_("len",d5,4b,52,00),::hx::paccDynamic);
+HXDLIN( 127) if (::hx::IsNotNull( b->charBuf )) {
+HXLINE( 127) b->flush();
+ }
+HXDLIN( 127) if (::hx::IsNull( b->b )) {
+HXLINE( 127) b->b = ::Array_obj< ::String >::__new(1)->init(0,s.substr(pos1,len2));
+ }
+ else {
+HXLINE( 127) ::Array< ::String > b4 = b->b;
+HXDLIN( 127) b4->push(s.substr(pos1,len2));
+ }
+ }
+HXLINE( 128) {
+HXLINE( 128) ::Dynamic len3 = (k.length - 1);
+HXDLIN( 128) if (::hx::IsNotNull( b->charBuf )) {
+HXLINE( 128) b->flush();
+ }
+HXDLIN( 128) if (::hx::IsNull( b->b )) {
+HXLINE( 128) b->b = ::Array_obj< ::String >::__new(1)->init(0,k.substr(1,len3));
+ }
+ else {
+HXLINE( 128) ::Array< ::String > b5 = b->b;
+HXDLIN( 128) b5->push(k.substr(1,len3));
+ }
+ }
+ }
+ }
+ else {
+HXLINE( 130) if (::hx::IsNull( c )) {
+HXLINE( 131) {
+HXLINE( 131) if (::hx::IsNotNull( b->charBuf )) {
+HXLINE( 131) b->flush();
+ }
+HXDLIN( 131) if (::hx::IsNull( b->b )) {
+HXLINE( 131) b->b = ::Array_obj< ::String >::fromData( _hx_array_data_2dda4a0f_9,1);
+ }
+ else {
+HXLINE( 131) b->b->push(HX_("$",24,00,00,00));
+ }
+ }
+HXLINE( 132) i = (i + 1);
+HXLINE( 133) ::String k2 = a->__get(i);
+HXLINE( 134) bool _hx_tmp2;
+HXDLIN( 134) if (::hx::IsNotNull( k2 )) {
+HXLINE( 134) _hx_tmp2 = (k2.length > 0);
+ }
+ else {
+HXLINE( 134) _hx_tmp2 = false;
+ }
+HXDLIN( 134) if (_hx_tmp2) {
+HXLINE( 135) if (::hx::IsNotNull( b->charBuf )) {
+HXLINE( 135) b->flush();
+ }
+HXDLIN( 135) if (::hx::IsNull( b->b )) {
+HXLINE( 135) b->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(k2));
+ }
+ else {
+HXLINE( 135) ::Array< ::String > b6 = b->b;
+HXDLIN( 135) b6->push(::Std_obj::string(k2));
+ }
+ }
+ }
+ else {
+HXLINE( 137) ::String x1 = (HX_("$",24,00,00,00) + k);
+HXDLIN( 137) if (::hx::IsNotNull( b->charBuf )) {
+HXLINE( 137) b->flush();
+ }
+HXDLIN( 137) if (::hx::IsNull( b->b )) {
+HXLINE( 137) b->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x1));
+ }
+ else {
+HXLINE( 137) ::Array< ::String > b7 = b->b;
+HXDLIN( 137) b7->push(::Std_obj::string(x1));
+ }
+ }
+ }
+HXLINE( 138) i = (i + 1);
+ }
+HXLINE( 140) int tot = (( (int)((p->__Field(HX_("pos",94,5d,55,00),::hx::paccDynamic) + p->__Field(HX_("len",d5,4b,52,00),::hx::paccDynamic))) ) - pos);
+HXLINE( 141) pos = (pos + tot);
+HXLINE( 142) len = (len - tot);
+HXLINE( 143) first = false;
+HXLINE( 104) if (!(this->global)) {
+HXLINE( 104) goto _hx_goto_5;
+ }
+ }
+ _hx_goto_5:;
+HXLINE( 145) {
+HXLINE( 145) if (::hx::IsNotNull( b->charBuf )) {
+HXLINE( 145) b->flush();
+ }
+HXDLIN( 145) if (::hx::IsNull( b->b )) {
+HXLINE( 145) b->b = ::Array_obj< ::String >::__new(1)->init(0,s.substr(pos,len));
+ }
+ else {
+HXLINE( 145) ::Array< ::String > b8 = b->b;
+HXDLIN( 145) b8->push(s.substr(pos,len));
+ }
+ }
+HXLINE( 146) return b->toString();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(EReg_obj,replace,return )
+
+::String EReg_obj::map(::String s, ::Dynamic f){
+ HX_GC_STACKFRAME(&_hx_pos_359fe5fd855fee60_149_map)
+HXLINE( 150) int offset = 0;
+HXLINE( 151) ::StringBuf buf = ::StringBuf_obj::__alloc( HX_CTX );
+HXLINE( 152) do {
+HXLINE( 153) if ((offset >= s.length)) {
+HXLINE( 154) goto _hx_goto_10;
+ }
+ else {
+HXLINE( 155) if (!(this->matchSub(s,offset,null()))) {
+HXLINE( 156) {
+HXLINE( 156) ::String x = s.substr(offset,null());
+HXDLIN( 156) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 156) buf->flush();
+ }
+HXDLIN( 156) if (::hx::IsNull( buf->b )) {
+HXLINE( 156) buf->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x));
+ }
+ else {
+HXLINE( 156) ::Array< ::String > buf1 = buf->b;
+HXDLIN( 156) buf1->push(::Std_obj::string(x));
+ }
+ }
+HXLINE( 157) goto _hx_goto_10;
+ }
+ }
+HXLINE( 159) ::Dynamic p = _hx_regexp_matched_pos(this->r,0);
+HXLINE( 160) {
+HXLINE( 160) ::String x1 = s.substr(offset,(( (int)(p->__Field(HX_("pos",94,5d,55,00),::hx::paccDynamic)) ) - offset));
+HXDLIN( 160) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 160) buf->flush();
+ }
+HXDLIN( 160) if (::hx::IsNull( buf->b )) {
+HXLINE( 160) buf->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x1));
+ }
+ else {
+HXLINE( 160) ::Array< ::String > buf2 = buf->b;
+HXDLIN( 160) buf2->push(::Std_obj::string(x1));
+ }
+ }
+HXLINE( 161) {
+HXLINE( 161) ::String x2 = ( (::String)(f(::hx::ObjectPtr<OBJ_>(this))) );
+HXDLIN( 161) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 161) buf->flush();
+ }
+HXDLIN( 161) if (::hx::IsNull( buf->b )) {
+HXLINE( 161) buf->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x2));
+ }
+ else {
+HXLINE( 161) ::Array< ::String > buf3 = buf->b;
+HXDLIN( 161) buf3->push(::Std_obj::string(x2));
+ }
+ }
+HXLINE( 162) if (::hx::IsEq( p->__Field(HX_("len",d5,4b,52,00),::hx::paccDynamic),0 )) {
+HXLINE( 163) {
+HXLINE( 163) ::String x3 = s.substr(( (int)(p->__Field(HX_("pos",94,5d,55,00),::hx::paccDynamic)) ),1);
+HXDLIN( 163) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 163) buf->flush();
+ }
+HXDLIN( 163) if (::hx::IsNull( buf->b )) {
+HXLINE( 163) buf->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x3));
+ }
+ else {
+HXLINE( 163) ::Array< ::String > buf4 = buf->b;
+HXDLIN( 163) buf4->push(::Std_obj::string(x3));
+ }
+ }
+HXLINE( 164) offset = ( (int)((p->__Field(HX_("pos",94,5d,55,00),::hx::paccDynamic) + 1)) );
+ }
+ else {
+HXLINE( 166) offset = ( (int)((p->__Field(HX_("pos",94,5d,55,00),::hx::paccDynamic) + p->__Field(HX_("len",d5,4b,52,00),::hx::paccDynamic))) );
+ }
+ } while(this->global);
+ _hx_goto_10:;
+HXLINE( 168) bool _hx_tmp;
+HXDLIN( 168) bool _hx_tmp1;
+HXDLIN( 168) if (!(this->global)) {
+HXLINE( 168) _hx_tmp1 = (offset > 0);
+ }
+ else {
+HXLINE( 168) _hx_tmp1 = false;
+ }
+HXDLIN( 168) if (_hx_tmp1) {
+HXLINE( 168) _hx_tmp = (offset < s.length);
+ }
+ else {
+HXLINE( 168) _hx_tmp = false;
+ }
+HXDLIN( 168) if (_hx_tmp) {
+HXLINE( 169) ::String x4 = s.substr(offset,null());
+HXDLIN( 169) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 169) buf->flush();
+ }
+HXDLIN( 169) if (::hx::IsNull( buf->b )) {
+HXLINE( 169) buf->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x4));
+ }
+ else {
+HXLINE( 169) ::Array< ::String > buf5 = buf->b;
+HXDLIN( 169) buf5->push(::Std_obj::string(x4));
+ }
+ }
+HXLINE( 170) return buf->toString();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(EReg_obj,map,return )
+
+
+::hx::ObjectPtr< EReg_obj > EReg_obj::__new(::String r,::String opt) {
+ ::hx::ObjectPtr< EReg_obj > __this = new EReg_obj();
+ __this->__construct(r,opt);
+ return __this;
+}
+
+::hx::ObjectPtr< EReg_obj > EReg_obj::__alloc(::hx::Ctx *_hx_ctx,::String r,::String opt) {
+ EReg_obj *__this = (EReg_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(EReg_obj), true, "EReg"));
+ *(void **)__this = EReg_obj::_hx_vtable;
+ __this->__construct(r,opt);
+ return __this;
+}
+
+EReg_obj::EReg_obj()
+{
+}
+
+void EReg_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(EReg);
+ HX_MARK_MEMBER_NAME(r,"r");
+ HX_MARK_MEMBER_NAME(last,"last");
+ HX_MARK_MEMBER_NAME(global,"global");
+ HX_MARK_END_CLASS();
+}
+
+void EReg_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(r,"r");
+ HX_VISIT_MEMBER_NAME(last,"last");
+ HX_VISIT_MEMBER_NAME(global,"global");
+}
+
+::hx::Val EReg_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 1:
+ if (HX_FIELD_EQ(inName,"r") ) { return ::hx::Val( r ); }
+ break;
+ case 3:
+ if (HX_FIELD_EQ(inName,"map") ) { return ::hx::Val( map_dyn() ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"last") ) { return ::hx::Val( last ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"match") ) { return ::hx::Val( match_dyn() ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"global") ) { return ::hx::Val( global ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"matched") ) { return ::hx::Val( matched_dyn() ); }
+ if (HX_FIELD_EQ(inName,"replace") ) { return ::hx::Val( replace_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"matchSub") ) { return ::hx::Val( matchSub_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"matchedPos") ) { return ::hx::Val( matchedPos_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val EReg_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 1:
+ if (HX_FIELD_EQ(inName,"r") ) { r=inValue.Cast< ::Dynamic >(); return inValue; }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"last") ) { last=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"global") ) { global=inValue.Cast< bool >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void EReg_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("r",72,00,00,00));
+ outFields->push(HX_("last",56,0a,ad,47));
+ outFields->push(HX_("global",63,31,b2,a7));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo EReg_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(EReg_obj,r),HX_("r",72,00,00,00)},
+ {::hx::fsString,(int)offsetof(EReg_obj,last),HX_("last",56,0a,ad,47)},
+ {::hx::fsBool,(int)offsetof(EReg_obj,global),HX_("global",63,31,b2,a7)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *EReg_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String EReg_obj_sMemberFields[] = {
+ HX_("r",72,00,00,00),
+ HX_("last",56,0a,ad,47),
+ HX_("global",63,31,b2,a7),
+ HX_("match",45,49,23,03),
+ HX_("matched",e4,3c,7c,89),
+ HX_("matchedPos",10,ff,c2,cb),
+ HX_("matchSub",3b,71,2b,c3),
+ HX_("replace",34,48,28,ab),
+ HX_("map",9c,0a,53,00),
+ ::String(null()) };
+
+::hx::Class EReg_obj::__mClass;
+
+void EReg_obj::__register()
+{
+ EReg_obj _hx_dummy;
+ EReg_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("EReg",0f,4a,da,2d);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(EReg_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< EReg_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = EReg_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = EReg_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
diff --git a/Sources/c_snikket/src/Enum.cpp b/Sources/c_snikket/src/Enum.cpp
new file mode 100644
index 0000000..e8fee46
--- /dev/null
+++ b/Sources/c_snikket/src/Enum.cpp
@@ -0,0 +1,137 @@
+#include <hxcpp.h>
+
+
+// -------- Enums ---------------------------------
+
+namespace hx
+{
+
+Dynamic EnumBase_obj::__Create(DynamicArray inArgs) { return new hx::EnumBase_obj; }
+Dynamic EnumBase_obj::__CreateEmpty() { return new hx::EnumBase_obj; }
+
+
+int EnumBase_obj::__FindIndex(String inName)
+{
+ if (inName==HX_CSTRING("__")) return 1;
+ return -1;
+}
+int EnumBase_obj::__FindArgCount(String inName)
+{
+ if (inName==HX_CSTRING("__")) return 0;
+ return -1;
+}
+hx::Val EnumBase_obj::__Field(const String &inName, hx::PropertyAccess inCallProp)
+{
+ if (HX_FIELD_EQ(inName,"tag") ) { return ::hx::Val( _hx_tag ); }
+ if (HX_FIELD_EQ(inName,"index") ) { return ::hx::Val( index ); }
+ return null();
+}
+
+hx::Class hxEnumBase_obj__mClass;
+hx::Class &EnumBase_obj::__SGetClass() { return hxEnumBase_obj__mClass; }
+
+//void hxEnumBase_obj::__GetFields(Array<String> &outFields) { }
+
+void EnumBase_obj::__boot()
+{
+ Static(hxEnumBase_obj__mClass) = hx::_hx_RegisterClass(HX_CSTRING("__EnumBase") ,TCanCast<EnumBase_obj>,
+ sNone,sNone,
+ &__CreateEmpty, &__Create, 0 );
+}
+
+DynamicArray EnumBase_obj::_hx_getParameters()
+{
+ Array<Dynamic> result = Array_obj<Dynamic>::__new(mFixedFields);
+ cpp::Variant *fixed = _hx_getFixed();
+ for(int i=0;i<mFixedFields;i++)
+ result[i] = fixed[i];
+ return result;
+}
+
+int EnumBase_obj::__Compare(const hx::Object *inRHS) const
+{
+ if (inRHS->__GetType()!=vtEnum) return -1;
+ const EnumBase_obj *rhs = static_cast<const EnumBase_obj *>(inRHS);
+
+ if (_hx_tag!=rhs->_hx_tag || GetEnumName()!=rhs->GetEnumName()) return -1;
+ if (mFixedFields!=rhs->mFixedFields) return -1;
+ if (!mFixedFields) return 0;
+
+ const cpp::Variant *f0 = _hx_getFixed();
+ const cpp::Variant *f1 = rhs->_hx_getFixed();
+ for(int i=0;i<mFixedFields;i++)
+ if ( f0[i] != f1[i])
+ return -1;
+
+ return 0;
+}
+
+bool __hxcpp_enum_eq( ::hx::EnumBase a, ::hx::EnumBase b)
+{
+ if (!a.mPtr || !b.mPtr)
+ return !a.mPtr && !b.mPtr;
+ // Known to be same type
+ if (a->index != b->index)
+ return 0;
+ int n = a->_hx_getParamCount();
+ if (n==0)
+ return true;
+ cpp::Variant *fa = a->_hx_getFixed();
+ cpp::Variant *fb = b->_hx_getFixed();
+ for(int i=0;i<n;i++)
+ if ( fa[i]!=fb[i] )
+ return false;
+ return true;
+}
+
+
+
+void EnumBase_obj::__Mark(hx::MarkContext *__inCtx)
+{
+ HX_MARK_MEMBER(_hx_tag);
+ if (mFixedFields>0)
+ {
+ cpp::Variant *v = _hx_getFixed();
+ for(int i=0;i<mFixedFields;i++)
+ HX_MARK_MEMBER(v[i]);
+ }
+}
+
+#ifdef HXCPP_VISIT_ALLOCS
+void EnumBase_obj::__Visit(hx::VisitContext *__inCtx)
+{
+
+ HX_VISIT_MEMBER(_hx_tag);
+ if (mFixedFields>0)
+ {
+ cpp::Variant *v = _hx_getFixed();
+ for(int i=0;i<mFixedFields;i++)
+ HX_VISIT_MEMBER(v[i]);
+ }
+}
+#endif
+
+
+Dynamic EnumBase_obj::__GetItem(int inIndex) const
+{
+ return ((EnumBase_obj *)this)->_hx_getParamI(inIndex);
+}
+
+
+
+String EnumBase_obj::toString() {
+ if (mFixedFields==0)
+ return _hx_tag;
+ if (mFixedFields==1)
+ return _hx_tag + HX_CSTRING("(") + _hx_getFixed()->asString() + HX_CSTRING(")");
+
+ Array<String> args = Array_obj<String>::__new(mFixedFields);
+ cpp::Variant *v = _hx_getFixed();
+ for(int i=0;i<mFixedFields;i++)
+ args[i] = v[i].asString();
+
+ return _hx_tag + HX_CSTRING("(") + args->join(HX_CSTRING(",")) + HX_CSTRING(")");
+}
+
+}
+
diff --git a/Sources/c_snikket/src/HaxeCBridge.cpp b/Sources/c_snikket/src/HaxeCBridge.cpp
new file mode 100644
index 0000000..94dcd30
--- /dev/null
+++ b/Sources/c_snikket/src/HaxeCBridge.cpp
@@ -0,0 +1,337 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_cbce7ceea2d0df24
+#define INCLUDED_cbce7ceea2d0df24
+#include "HaxeCBridge.h"
+#endif
+#ifndef INCLUDED_95f339a1d026d52c
+#define INCLUDED_95f339a1d026d52c
+#include "hxMath.h"
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_Sys
+#include <Sys.h>
+#endif
+#ifndef INCLUDED__HaxeCBridge_Internal
+#include <_HaxeCBridge/Internal.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_IntMap
+#include <haxe/ds/IntMap.h>
+#endif
+#ifndef INCLUDED_sys_thread_EventLoop
+#include <sys/thread/EventLoop.h>
+#endif
+#ifndef INCLUDED_sys_thread_Lock
+#include <sys/thread/Lock.h>
+#endif
+#ifndef INCLUDED_sys_thread_Mutex
+#include <sys/thread/Mutex.h>
+#endif
+#ifndef INCLUDED_sys_thread__EventLoop_RegularEvent
+#include <sys/thread/_EventLoop/RegularEvent.h>
+#endif
+#ifndef INCLUDED_sys_thread__Thread_HaxeThread
+#include <sys/thread/_Thread/HaxeThread.h>
+#endif
+#ifndef INCLUDED_sys_thread__Thread_Thread_Impl_
+#include <sys/thread/_Thread/Thread_Impl_.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_74d844958d4dcf5a_1907_mainThreadInit,"HaxeCBridge","mainThreadInit",0x6f09ae5b,"HaxeCBridge.mainThreadInit","HaxeCBridge.hx",1907,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_74d844958d4dcf5a_1922_mainThreadRun,"HaxeCBridge","mainThreadRun",0xa4afa660,"HaxeCBridge.mainThreadRun","HaxeCBridge.hx",1922,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_74d844958d4dcf5a_2001_retainHaxeArray,"HaxeCBridge","retainHaxeArray",0x7373bc46,"HaxeCBridge.retainHaxeArray","HaxeCBridge.hx",2001,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_74d844958d4dcf5a_2010_retainHaxeObject,"HaxeCBridge","retainHaxeObject",0xef200772,"HaxeCBridge.retainHaxeObject","HaxeCBridge.hx",2010,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_74d844958d4dcf5a_2020_retainHaxeString,"HaxeCBridge","retainHaxeString",0xeb10b184,"HaxeCBridge.retainHaxeString","HaxeCBridge.hx",2020,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_74d844958d4dcf5a_2027_releaseHaxePtr,"HaxeCBridge","releaseHaxePtr",0x5df2fc29,"HaxeCBridge.releaseHaxePtr","HaxeCBridge.hx",2027,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_74d844958d4dcf5a_2034_isMainThread,"HaxeCBridge","isMainThread",0x6f71c035,"HaxeCBridge.isMainThread","HaxeCBridge.hx",2034,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_74d844958d4dcf5a_2039_endMainThread,"HaxeCBridge","endMainThread",0x0d9deed6,"HaxeCBridge.endMainThread","HaxeCBridge.hx",2039,0xa18550d8)
+
+void HaxeCBridge::mainThreadInit(::cpp::Function< bool () > isMainThreadCb){
+ HX_STACKFRAME(&_hx_pos_74d844958d4dcf5a_1907_mainThreadInit)
+HXLINE(1913) ::_HaxeCBridge::Internal_obj::isMainThreadCb = isMainThreadCb;
+HXLINE(1914) ::_HaxeCBridge::Internal_obj::mainThreadWaitLock = ::sys::thread::_Thread::Thread_Impl__obj::get_events(::sys::thread::_Thread::HaxeThread_obj::current())->waitLock;
+ }
+
+
+void HaxeCBridge::mainThreadRun(::cpp::Function< void () > processNativeCalls,::cpp::Function< void (const char*) > onUnhandledException){
+ HX_STACKFRAME(&_hx_pos_74d844958d4dcf5a_1922_mainThreadRun)
+HXLINE(1923) try {
+ HX_STACK_CATCHABLE( ::Dynamic, 0);
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::Dynamic >() ){
+ HX_STACK_BEGIN_CATCH
+ ::Dynamic _g = _hx_e;
+HXLINE(1925) {
+HXLINE(1925) null();
+ }
+HXDLIN(1925) ::Dynamic e = _g;
+HXLINE(1926) {
+HXLINE(1926) ::String s;
+HXDLIN(1926) if (::hx::IsNull( e )) {
+HXLINE(1926) s = HX_("null",87,9e,0e,49);
+ }
+ else {
+HXLINE(1926) s = ::Std_obj::string(e);
+ }
+HXDLIN(1926) onUnhandledException(s.utf8_str());
+ }
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+HXLINE(1930) ::sys::thread::EventLoop eventLoop = ::sys::thread::_Thread::Thread_Impl__obj::get_events(::sys::thread::_Thread::HaxeThread_obj::current());
+HXLINE(1932) ::Array< ::Dynamic> events = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE(1933) while(::_HaxeCBridge::Internal_obj::mainThreadLoopActive){
+HXLINE(1934) try {
+ HX_STACK_CATCHABLE( ::Dynamic, 0);
+HXLINE(1936) processNativeCalls();
+HXLINE(1939) Float now = ::Sys_obj::time();
+HXDLIN(1939) ::Array< ::Dynamic> eventsToRun = events;
+HXDLIN(1939) int eventsToRunIdx = 0;
+HXDLIN(1939) Float nextEventAt = ( (Float)(-1) );
+HXDLIN(1939) eventLoop->mutex->acquire();
+HXDLIN(1939) ::sys::thread::_EventLoop::RegularEvent current = eventLoop->regularEvents;
+HXDLIN(1939) while(::hx::IsNotNull( current )){
+HXLINE(1939) if ((current->nextRunTime <= now)) {
+HXLINE(1939) eventsToRunIdx = (eventsToRunIdx + 1);
+HXDLIN(1939) eventsToRun[(eventsToRunIdx - 1)] = current->run;
+HXDLIN(1939) ::sys::thread::_EventLoop::RegularEvent current1 = current;
+HXDLIN(1939) current1->nextRunTime = (current1->nextRunTime + current->interval);
+HXLINE(2152) nextEventAt = ( (Float)(-2) );
+ }
+ else {
+HXLINE(1939) bool _hx_tmp;
+HXDLIN(1939) if ((nextEventAt != -1)) {
+HXLINE(1939) _hx_tmp = (current->nextRunTime < nextEventAt);
+ }
+ else {
+HXLINE(1939) _hx_tmp = true;
+ }
+HXDLIN(1939) if (_hx_tmp) {
+HXLINE(2154) nextEventAt = current->nextRunTime;
+ }
+ }
+HXLINE(2156) current = current->next;
+ }
+HXLINE(1939) eventLoop->mutex->release();
+HXDLIN(1939) int _g1 = 0;
+HXDLIN(1939) int _g2 = eventsToRunIdx;
+HXDLIN(1939) while((_g1 < _g2)){
+HXLINE(1939) _g1 = (_g1 + 1);
+HXDLIN(1939) int i = (_g1 - 1);
+HXDLIN(1939) eventsToRun->__get(i)();
+HXDLIN(1939) eventsToRun[i] = null();
+ }
+HXLINE(2165) eventsToRunIdx = 0;
+HXLINE(1939) eventLoop->mutex->acquire();
+HXDLIN(1939) int _g_current = 0;
+HXDLIN(1939) ::Array< ::Dynamic> _g_array = eventLoop->oneTimeEvents;
+HXDLIN(1939) while((_g_current < _g_array->length)){
+HXLINE(1939) ::Dynamic _g_value = _g_array->__get(_g_current);
+HXDLIN(1939) _g_current = (_g_current + 1);
+HXDLIN(1939) int _g_key = (_g_current - 1);
+HXDLIN(1939) int i1 = _g_key;
+HXDLIN(1939) ::Dynamic event = _g_value;
+HXDLIN(1939) if (::hx::IsNull( event )) {
+HXLINE(1939) goto _hx_goto_4;
+ }
+ else {
+HXLINE(1939) eventsToRunIdx = (eventsToRunIdx + 1);
+HXDLIN(1939) eventsToRun[(eventsToRunIdx - 1)] = event;
+HXDLIN(1939) eventLoop->oneTimeEvents[i1] = null();
+ }
+ }
+ _hx_goto_4:;
+HXDLIN(1939) eventLoop->oneTimeEventsIdx = 0;
+HXDLIN(1939) bool hasPromisedEvents = (eventLoop->promisedEventsCount > 0);
+HXDLIN(1939) eventLoop->mutex->release();
+HXDLIN(1939) int _g3 = 0;
+HXDLIN(1939) int _g4 = eventsToRunIdx;
+HXDLIN(1939) while((_g3 < _g4)){
+HXLINE(1939) _g3 = (_g3 + 1);
+HXDLIN(1939) int i2 = (_g3 - 1);
+HXDLIN(1939) eventsToRun->__get(i2)();
+HXDLIN(1939) eventsToRun[i2] = null();
+ }
+HXDLIN(1939) if ((eventsToRunIdx > 0)) {
+HXLINE(2190) nextEventAt = ( (Float)(-2) );
+ }
+HXLINE(1939) Float eventTickInfo_nextEventAt = nextEventAt;
+HXDLIN(1939) bool eventTickInfo_anyTime = hasPromisedEvents;
+HXLINE(1940) {
+HXLINE(1940) Float _g5 = eventTickInfo_nextEventAt;
+HXDLIN(1940) Float _hx_switch_0 = _g5;
+ if ( (_hx_switch_0==( (Float)(-2) )) ){
+HXLINE(1941) goto _hx_goto_6;
+ }
+ if ( (_hx_switch_0==( (Float)(-1) )) ){
+HXLINE(1943) bool _hx_tmp1;
+HXDLIN(1943) if (::_HaxeCBridge::Internal_obj::mainThreadEndIfNoPending) {
+HXLINE(1943) _hx_tmp1 = !(eventTickInfo_anyTime);
+ }
+ else {
+HXLINE(1943) _hx_tmp1 = false;
+ }
+HXDLIN(1943) if (_hx_tmp1) {
+HXLINE(1945) goto _hx_goto_1;
+ }
+HXLINE(1947) ::_HaxeCBridge::Internal_obj::mainThreadWaitLock->wait(null());
+HXLINE(1942) goto _hx_goto_6;
+ }
+ /* default */{
+HXLINE(1948) Float time = _g5;
+HXDLIN(1948) {
+HXLINE(1949) Float timeout = (time - ::Sys_obj::time());
+HXLINE(1950) ::_HaxeCBridge::Internal_obj::mainThreadWaitLock->wait(::Math_obj::max(( (Float)(0) ),timeout));
+ }
+ }
+ _hx_goto_6:;
+ }
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::Dynamic >() ){
+ HX_STACK_BEGIN_CATCH
+ ::Dynamic _g6 = _hx_e;
+HXLINE(1952) {
+HXLINE(1952) null();
+ }
+HXDLIN(1952) ::Dynamic e1 = _g6;
+HXLINE(1953) {
+HXLINE(1953) ::String s1;
+HXDLIN(1953) if (::hx::IsNull( e1 )) {
+HXLINE(1953) s1 = HX_("null",87,9e,0e,49);
+ }
+ else {
+HXLINE(1953) s1 = ::Std_obj::string(e1);
+ }
+HXDLIN(1953) onUnhandledException(s1.utf8_str());
+ }
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+ }
+ _hx_goto_1:;
+HXLINE(1958) __hxcpp_collect(true);
+ }
+
+
+void** HaxeCBridge::retainHaxeArray(::cpp::VirtualArray haxeArray){
+ HX_GC_STACKFRAME(&_hx_pos_74d844958d4dcf5a_2001_retainHaxeArray)
+HXLINE(2004) void** ptr = (void**)haxeArray->getBase();
+HXLINE(2005) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(ptr);
+HXLINE(2006) {
+HXLINE(2006) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN(2006) int low = ptrInt64 & 0xffffffff;
+HXDLIN(2006) int high = ptrInt64 >> 32;
+HXDLIN(2006) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN(2006) if (::hx::IsNull( highMap )) {
+HXLINE(2006) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN(2006) this1->set(low,highMap);
+ }
+HXDLIN(2006) highMap->set(high,haxeArray);
+ }
+HXLINE(2007) return ptr;
+ }
+
+
+void* HaxeCBridge::retainHaxeObject( ::Dynamic haxeObject){
+ HX_GC_STACKFRAME(&_hx_pos_74d844958d4dcf5a_2010_retainHaxeObject)
+HXLINE(2012) void* ptr = haxeObject.mPtr;
+HXLINE(2015) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(ptr);
+HXLINE(2016) {
+HXLINE(2016) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN(2016) int low = ptrInt64 & 0xffffffff;
+HXDLIN(2016) int high = ptrInt64 >> 32;
+HXDLIN(2016) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN(2016) if (::hx::IsNull( highMap )) {
+HXLINE(2016) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN(2016) this1->set(low,highMap);
+ }
+HXDLIN(2016) highMap->set(high,haxeObject);
+ }
+HXLINE(2017) return ptr;
+ }
+
+
+const char* HaxeCBridge::retainHaxeString(::String haxeString){
+ HX_GC_STACKFRAME(&_hx_pos_74d844958d4dcf5a_2020_retainHaxeString)
+HXLINE(2021) const char* cStrPtr = haxeString.utf8_str();
+HXLINE(2022) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(cStrPtr);
+HXLINE(2023) {
+HXLINE(2023) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN(2023) int low = ptrInt64 & 0xffffffff;
+HXDLIN(2023) int high = ptrInt64 >> 32;
+HXDLIN(2023) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN(2023) if (::hx::IsNull( highMap )) {
+HXLINE(2023) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN(2023) this1->set(low,highMap);
+ }
+HXDLIN(2023) highMap->set(high,haxeString);
+ }
+HXLINE(2024) return cStrPtr;
+ }
+
+
+void HaxeCBridge::releaseHaxePtr(void * haxePtr){
+ HX_STACKFRAME(&_hx_pos_74d844958d4dcf5a_2027_releaseHaxePtr)
+HXLINE(2028) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(haxePtr);
+HXLINE(2029) {
+HXLINE(2029) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN(2029) int low = ptrInt64 & 0xffffffff;
+HXDLIN(2029) int high = ptrInt64 >> 32;
+HXDLIN(2029) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN(2029) if (::hx::IsNotNull( highMap )) {
+HXLINE(2029) bool removed = highMap->remove(high);
+HXDLIN(2029) bool isHighMapEmpty = true;
+HXDLIN(2029) {
+HXLINE(2029) ::Dynamic k = highMap->keys();
+HXDLIN(2029) while(( (bool)(k->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE(2029) int k1 = ( (int)(k->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXDLIN(2029) isHighMapEmpty = false;
+HXDLIN(2029) goto _hx_goto_11;
+ }
+ _hx_goto_11:;
+ }
+HXDLIN(2029) if (isHighMapEmpty) {
+HXLINE(2029) this1->remove(low);
+ }
+ }
+ }
+ }
+
+
+bool HaxeCBridge::isMainThread(){
+ HX_STACKFRAME(&_hx_pos_74d844958d4dcf5a_2034_isMainThread)
+HXDLIN(2034) return ::_HaxeCBridge::Internal_obj::isMainThreadCb();
+ }
+
+
+void HaxeCBridge::endMainThread(bool waitOnScheduledEvents){
+ HX_STACKFRAME(&_hx_pos_74d844958d4dcf5a_2039_endMainThread)
+HXLINE(2040) ::_HaxeCBridge::Internal_obj::mainThreadEndIfNoPending = true;
+HXLINE(2041) bool _hx_tmp;
+HXDLIN(2041) if (::_HaxeCBridge::Internal_obj::mainThreadLoopActive) {
+HXLINE(2041) _hx_tmp = waitOnScheduledEvents;
+ }
+ else {
+HXLINE(2041) _hx_tmp = false;
+ }
+HXDLIN(2041) ::_HaxeCBridge::Internal_obj::mainThreadLoopActive = _hx_tmp;
+HXLINE(2042) ::__hxcpp_lock_release(::_HaxeCBridge::Internal_obj::mainThreadWaitLock->l);
+ }
+
+
+void HaxeCBridge::wakeMainThread(){
+ ::__hxcpp_lock_release(::_HaxeCBridge::Internal_obj::mainThreadWaitLock->l);
+}
+
+
+
diff --git a/Sources/c_snikket/src/Lambda.cpp b/Sources/c_snikket/src/Lambda.cpp
new file mode 100644
index 0000000..df36922
--- /dev/null
+++ b/Sources/c_snikket/src/Lambda.cpp
@@ -0,0 +1,209 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Lambda
+#include <Lambda.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_a2b9229e56451ffa_45_array,"Lambda","array",0x9c8b0512,"Lambda.array","/usr/local/lib/haxe/std/Lambda.hx",45,0xf61dfe9a)
+HX_LOCAL_STACK_FRAME(_hx_pos_a2b9229e56451ffa_125_exists,"Lambda","exists",0x65091043,"Lambda.exists","/usr/local/lib/haxe/std/Lambda.hx",125,0xf61dfe9a)
+HX_LOCAL_STACK_FRAME(_hx_pos_a2b9229e56451ffa_168_filter,"Lambda","filter",0x2a5e121f,"Lambda.filter","/usr/local/lib/haxe/std/Lambda.hx",168,0xf61dfe9a)
+HX_LOCAL_STACK_FRAME(_hx_pos_a2b9229e56451ffa_183_fold,"Lambda","fold",0x9b8816a8,"Lambda.fold","/usr/local/lib/haxe/std/Lambda.hx",183,0xf61dfe9a)
+HX_LOCAL_STACK_FRAME(_hx_pos_a2b9229e56451ffa_225_empty,"Lambda","empty",0xe6d5d206,"Lambda.empty","/usr/local/lib/haxe/std/Lambda.hx",225,0xf61dfe9a)
+HX_LOCAL_STACK_FRAME(_hx_pos_a2b9229e56451ffa_255_find,"Lambda","find",0x9b838ae0,"Lambda.find","/usr/local/lib/haxe/std/Lambda.hx",255,0xf61dfe9a)
+HX_LOCAL_STACK_FRAME(_hx_pos_a2b9229e56451ffa_273_findIndex,"Lambda","findIndex",0xea9b1412,"Lambda.findIndex","/usr/local/lib/haxe/std/Lambda.hx",273,0xf61dfe9a)
+
+void Lambda_obj::__construct() { }
+
+Dynamic Lambda_obj::__CreateEmpty() { return new Lambda_obj; }
+
+void *Lambda_obj::_hx_vtable = 0;
+
+Dynamic Lambda_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Lambda_obj > _hx_result = new Lambda_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool Lambda_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x4cec6e4b;
+}
+
+::cpp::VirtualArray Lambda_obj::array( ::Dynamic it){
+ HX_STACKFRAME(&_hx_pos_a2b9229e56451ffa_45_array)
+HXLINE( 46) ::cpp::VirtualArray a = ::cpp::VirtualArray_obj::__new();
+HXLINE( 47) {
+HXLINE( 47) ::Dynamic i = it->__Field(HX_("iterator",ee,49,9a,93),::hx::paccDynamic)();
+HXDLIN( 47) while(( (bool)(i->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 47) ::Dynamic i1 = i->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)();
+HXLINE( 48) a->push(i1);
+ }
+ }
+HXLINE( 49) return a;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Lambda_obj,array,return )
+
+bool Lambda_obj::exists( ::Dynamic it, ::Dynamic f){
+ HX_STACKFRAME(&_hx_pos_a2b9229e56451ffa_125_exists)
+HXLINE( 126) {
+HXLINE( 126) ::Dynamic x = it->__Field(HX_("iterator",ee,49,9a,93),::hx::paccDynamic)();
+HXDLIN( 126) while(( (bool)(x->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 126) ::Dynamic x1 = x->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)();
+HXLINE( 127) if (( (bool)(f(x1)) )) {
+HXLINE( 128) return true;
+ }
+ }
+ }
+HXLINE( 129) return false;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Lambda_obj,exists,return )
+
+::cpp::VirtualArray Lambda_obj::filter( ::Dynamic it, ::Dynamic f){
+ HX_STACKFRAME(&_hx_pos_a2b9229e56451ffa_168_filter)
+HXDLIN( 168) ::cpp::VirtualArray _g = ::cpp::VirtualArray_obj::__new(0);
+HXDLIN( 168) {
+HXDLIN( 168) ::Dynamic x = it->__Field(HX_("iterator",ee,49,9a,93),::hx::paccDynamic)();
+HXDLIN( 168) while(( (bool)(x->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXDLIN( 168) ::Dynamic x1 = x->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)();
+HXDLIN( 168) if (( (bool)(f(x1)) )) {
+HXDLIN( 168) _g->push(x1);
+ }
+ }
+ }
+HXDLIN( 168) return _g;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Lambda_obj,filter,return )
+
+ ::Dynamic Lambda_obj::fold( ::Dynamic it, ::Dynamic f, ::Dynamic first){
+ HX_STACKFRAME(&_hx_pos_a2b9229e56451ffa_183_fold)
+HXLINE( 184) {
+HXLINE( 184) ::Dynamic x = it->__Field(HX_("iterator",ee,49,9a,93),::hx::paccDynamic)();
+HXDLIN( 184) while(( (bool)(x->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 184) ::Dynamic x1 = x->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)();
+HXLINE( 185) first = f(x1,first);
+ }
+ }
+HXLINE( 186) return first;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC3(Lambda_obj,fold,return )
+
+bool Lambda_obj::empty( ::Dynamic it){
+ HX_STACKFRAME(&_hx_pos_a2b9229e56451ffa_225_empty)
+HXDLIN( 225) return !(( (bool)(it->__Field(HX_("iterator",ee,49,9a,93),::hx::paccDynamic)()->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) ));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Lambda_obj,empty,return )
+
+ ::Dynamic Lambda_obj::find( ::Dynamic it, ::Dynamic f){
+ HX_STACKFRAME(&_hx_pos_a2b9229e56451ffa_255_find)
+HXLINE( 256) {
+HXLINE( 256) ::Dynamic v = it->__Field(HX_("iterator",ee,49,9a,93),::hx::paccDynamic)();
+HXDLIN( 256) while(( (bool)(v->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 256) ::Dynamic v1 = v->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)();
+HXLINE( 257) if (( (bool)(f(v1)) )) {
+HXLINE( 258) return v1;
+ }
+ }
+ }
+HXLINE( 260) return null();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Lambda_obj,find,return )
+
+int Lambda_obj::findIndex( ::Dynamic it, ::Dynamic f){
+ HX_STACKFRAME(&_hx_pos_a2b9229e56451ffa_273_findIndex)
+HXLINE( 274) int i = 0;
+HXLINE( 275) {
+HXLINE( 275) ::Dynamic v = it->__Field(HX_("iterator",ee,49,9a,93),::hx::paccDynamic)();
+HXDLIN( 275) while(( (bool)(v->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 275) ::Dynamic v1 = v->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)();
+HXLINE( 276) if (( (bool)(f(v1)) )) {
+HXLINE( 277) return i;
+ }
+HXLINE( 278) i = (i + 1);
+ }
+ }
+HXLINE( 280) return -1;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Lambda_obj,findIndex,return )
+
+
+Lambda_obj::Lambda_obj()
+{
+}
+
+bool Lambda_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"fold") ) { outValue = fold_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"find") ) { outValue = find_dyn(); return true; }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"array") ) { outValue = array_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"empty") ) { outValue = empty_dyn(); return true; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"exists") ) { outValue = exists_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"filter") ) { outValue = filter_dyn(); return true; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"findIndex") ) { outValue = findIndex_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *Lambda_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *Lambda_obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class Lambda_obj::__mClass;
+
+static ::String Lambda_obj_sStaticFields[] = {
+ HX_("array",99,6d,8f,25),
+ HX_("exists",dc,1d,e0,bf),
+ HX_("filter",b8,1f,35,85),
+ HX_("fold",01,5c,c0,43),
+ HX_("empty",8d,3a,da,6f),
+ HX_("find",39,d0,bb,43),
+ HX_("findIndex",19,cc,0b,ad),
+ ::String(null())
+};
+
+void Lambda_obj::__register()
+{
+ Lambda_obj _hx_dummy;
+ Lambda_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("Lambda",27,a7,54,85);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Lambda_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Lambda_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< Lambda_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Lambda_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Lambda_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
diff --git a/Sources/c_snikket/src/Math.cpp b/Sources/c_snikket/src/Math.cpp
new file mode 100755
index 0000000..2b2b5fa
--- /dev/null
+++ b/Sources/c_snikket/src/Math.cpp
@@ -0,0 +1,194 @@
+#include <hxcpp.h>
+#include <limits>
+#include <hxMath.h>
+
+#include <stdlib.h>
+#include <time.h>
+#if defined(HX_WINRT) && !defined(__cplusplus_winrt)
+#include <windows.h>
+#elif defined(HX_WINDOWS)
+#include <process.h>
+#else
+#include <unistd.h>
+#include <sys/time.h>
+#endif
+
+// -------- Math ---------------------------------------
+
+using namespace hx;
+
+
+bool Math_obj::isNaN(double inX)
+ { return inX!=inX; }
+
+bool Math_obj::isFinite(double inX)
+ { return inX==inX && inX!=NEGATIVE_INFINITY && inX!=POSITIVE_INFINITY; }
+
+double Math_obj::NaN = std::numeric_limits<double>::quiet_NaN();
+double Math_obj::NEGATIVE_INFINITY = -std::numeric_limits<double>::infinity();
+double Math_obj::PI = 3.1415926535897932385;
+double Math_obj::POSITIVE_INFINITY = std::numeric_limits<double>::infinity();
+
+#ifdef min
+#undef min
+#endif
+
+#ifdef max
+#undef max
+#endif
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Math_obj,floor,return);
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Math_obj,ffloor,return);
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Math_obj,ceil,return);
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Math_obj,fceil,return);
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Math_obj,round,return);
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Math_obj,fround,return);
+STATIC_HX_DEFINE_DYNAMIC_FUNC0(Math_obj,random,return);
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Math_obj,sqrt,return);
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Math_obj,cos,return);
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Math_obj,sin,return);
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Math_obj,tan,return);
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Math_obj,atan2,return);
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Math_obj,abs,return);
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Math_obj,pow,return);
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Math_obj,log,return);
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Math_obj,min,return);
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Math_obj,max,return);
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Math_obj,atan,return);
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Math_obj,asin,return);
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Math_obj,acos,return);
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Math_obj,exp,return);
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Math_obj,isNaN,return);
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Math_obj,isFinite,return);
+
+hx::Val Math_obj::__Field(const String &inString, hx::PropertyAccess inCallProp)
+{
+ if (inString==HX_CSTRING("floor")) return floor_dyn();
+ if (inString==HX_CSTRING("ffloor")) return ffloor_dyn();
+ if (inString==HX_CSTRING("ceil")) return ceil_dyn();
+ if (inString==HX_CSTRING("fceil")) return fceil_dyn();
+ if (inString==HX_CSTRING("round")) return round_dyn();
+ if (inString==HX_CSTRING("fround")) return fround_dyn();
+ if (inString==HX_CSTRING("random")) return random_dyn();
+ if (inString==HX_CSTRING("sqrt")) return sqrt_dyn();
+ if (inString==HX_CSTRING("cos")) return cos_dyn();
+ if (inString==HX_CSTRING("sin")) return sin_dyn();
+ if (inString==HX_CSTRING("tan")) return tan_dyn();
+ if (inString==HX_CSTRING("atan2")) return atan2_dyn();
+ if (inString==HX_CSTRING("abs")) return abs_dyn();
+ if (inString==HX_CSTRING("pow")) return pow_dyn();
+ if (inString==HX_CSTRING("log")) return log_dyn();
+ if (inString==HX_CSTRING("min")) return min_dyn();
+ if (inString==HX_CSTRING("max")) return max_dyn();
+ if (inString==HX_CSTRING("atan")) return atan_dyn();
+ if (inString==HX_CSTRING("acos")) return acos_dyn();
+ if (inString==HX_CSTRING("asin")) return asin_dyn();
+ if (inString==HX_CSTRING("exp")) return exp_dyn();
+ if (inString==HX_CSTRING("isNaN")) return isNaN_dyn();
+ if (inString==HX_CSTRING("isFinite")) return isFinite_dyn();
+
+ if (inString==HX_CSTRING("NEGATIVE_INFINITY")) return NEGATIVE_INFINITY;
+ if (inString==HX_CSTRING("POSITIVE_INFINITY")) return POSITIVE_INFINITY;
+ if (inString==HX_CSTRING("PI")) return PI;
+ if (inString==HX_CSTRING("NaN")) return NaN;
+ return null();
+}
+
+void Math_obj::__GetFields(Array<String> &outFields) { }
+
+static String sMathFields[] = {
+ HX_CSTRING("floor"),
+ HX_CSTRING("ceil"),
+ HX_CSTRING("round"),
+ HX_CSTRING("random"),
+ HX_CSTRING("sqrt"),
+ HX_CSTRING("cos"),
+ HX_CSTRING("sin"),
+ HX_CSTRING("tan"),
+ HX_CSTRING("atan2"),
+ HX_CSTRING("abs"),
+ HX_CSTRING("pow"),
+ HX_CSTRING("atan"),
+ HX_CSTRING("acos"),
+ HX_CSTRING("asin"),
+ HX_CSTRING("exp"),
+ HX_CSTRING("isFinite"),
+ String(null()) };
+
+
+hx::Val Math_obj::__SetField(const String &inString,const hx::Val &inValue, hx::PropertyAccess inCallProp) { return null(); }
+
+Dynamic Math_obj::__CreateEmpty() { return new Math_obj; }
+
+hx::Class Math_obj::__mClass;
+
+/*
+Class &Math_obj::__SGetClass() { return __mClass; }
+Class Math_obj::__GetClass() const { return __mClass; }
+*/
+
+#if HXCPP_SCRIPTABLE
+static hx::StaticInfo Math_obj_sStaticStorageInfo[] = {
+ {hx::fsFloat,(void *) &Math_obj::PI,HX_HCSTRING("PI","\xf9","\x45","\x00","\x00")},
+ {hx::fsFloat,(void *) &Math_obj::NEGATIVE_INFINITY,HX_HCSTRING("NEGATIVE_INFINITY","\x32","\xf1","\x1e","\x93")},
+ {hx::fsFloat,(void *) &Math_obj::POSITIVE_INFINITY,HX_HCSTRING("POSITIVE_INFINITY","\x6e","\x48","\x1e","\x72")},
+ {hx::fsFloat,(void *) &Math_obj::NaN,HX_HCSTRING("NaN","\x9b","\x84","\x3b","\x00")},
+ { hx::fsUnknown, 0, null()}
+};
+#endif
+
+void Math_obj::__boot()
+{
+ Static(Math_obj::__mClass) = hx::_hx_RegisterClass(HX_CSTRING("Math"),TCanCast<Math_obj>,sMathFields,sNone, &__CreateEmpty,0 , 0 );
+
+#ifdef HXCPP_SCRIPTABLE
+ Math_obj::__mClass->mStaticStorageInfo = Math_obj_sStaticStorageInfo;
+#endif
+
+#if defined(HX_WINDOWS) || defined(__SNC__)
+ unsigned int t = clock();
+#else
+ struct timeval tv;
+ gettimeofday(&tv,0);
+ unsigned int t = tv.tv_sec * 1000000 + tv.tv_usec;
+#endif
+
+#if defined(HX_WINDOWS) && !defined(__BORLANDC__)
+ #if defined(HX_WINRT)
+ #if defined(__cplusplus_winrt)
+ int pid = Windows::Security::Cryptography::CryptographicBuffer::GenerateRandomNumber();
+ #else
+ int pid = GetCurrentProcessId();
+ #endif
+ #else
+ int pid = _getpid();
+ #endif
+#else
+ int pid = getpid();
+#endif
+
+ srand(t ^ (pid | (pid << 16)));
+ #ifdef HX_ANDROID
+ srand48(t ^ (pid | (pid << 16)));
+ #endif
+ rand();
+}
+
+namespace hx
+{
+
+double DoubleMod(double inLHS,double inRHS)
+{
+ return fmod(inLHS,inRHS);
+}
+
+double hxZero = 0.0;
+double DivByZero(double d)
+{
+ return d/hxZero;
+}
+
+
+}
+
+
diff --git a/Sources/c_snikket/src/Reflect.cpp b/Sources/c_snikket/src/Reflect.cpp
new file mode 100644
index 0000000..415f3f9
--- /dev/null
+++ b/Sources/c_snikket/src/Reflect.cpp
@@ -0,0 +1,264 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_7b3988d9963d5a21_30_hasField,"Reflect","hasField",0xef8c2571,"Reflect.hasField","/usr/local/lib/haxe/std/cpp/_std/Reflect.hx",30,0x1c2422c3)
+HX_LOCAL_STACK_FRAME(_hx_pos_7b3988d9963d5a21_35_field,"Reflect","field",0x54b04da9,"Reflect.field","/usr/local/lib/haxe/std/cpp/_std/Reflect.hx",35,0x1c2422c3)
+HX_LOCAL_STACK_FRAME(_hx_pos_7b3988d9963d5a21_40_setField,"Reflect","setField",0x71684429,"Reflect.setField","/usr/local/lib/haxe/std/cpp/_std/Reflect.hx",40,0x1c2422c3)
+HX_LOCAL_STACK_FRAME(_hx_pos_7b3988d9963d5a21_45_getProperty,"Reflect","getProperty",0x632ca13a,"Reflect.getProperty","/usr/local/lib/haxe/std/cpp/_std/Reflect.hx",45,0x1c2422c3)
+HX_LOCAL_STACK_FRAME(_hx_pos_7b3988d9963d5a21_54_callMethod,"Reflect","callMethod",0xb49e52d0,"Reflect.callMethod","/usr/local/lib/haxe/std/cpp/_std/Reflect.hx",54,0x1c2422c3)
+HX_LOCAL_STACK_FRAME(_hx_pos_7b3988d9963d5a21_67_fields,"Reflect","fields",0xc593a6aa,"Reflect.fields","/usr/local/lib/haxe/std/cpp/_std/Reflect.hx",67,0x1c2422c3)
+HX_LOCAL_STACK_FRAME(_hx_pos_7b3988d9963d5a21_77_isFunction,"Reflect","isFunction",0x0f1541d3,"Reflect.isFunction","/usr/local/lib/haxe/std/cpp/_std/Reflect.hx",77,0x1c2422c3)
+HX_LOCAL_STACK_FRAME(_hx_pos_7b3988d9963d5a21_81_compare,"Reflect","compare",0xa2d92b54,"Reflect.compare","/usr/local/lib/haxe/std/cpp/_std/Reflect.hx",81,0x1c2422c3)
+HX_LOCAL_STACK_FRAME(_hx_pos_7b3988d9963d5a21_84_compareMethods,"Reflect","compareMethods",0x8b8ddd7e,"Reflect.compareMethods","/usr/local/lib/haxe/std/cpp/_std/Reflect.hx",84,0x1c2422c3)
+HX_LOCAL_STACK_FRAME(_hx_pos_7b3988d9963d5a21_93_isObject,"Reflect","isObject",0xd04960ba,"Reflect.isObject","/usr/local/lib/haxe/std/cpp/_std/Reflect.hx",93,0x1c2422c3)
+HX_LOCAL_STACK_FRAME(_hx_pos_7b3988d9963d5a21_102_isEnumValue,"Reflect","isEnumValue",0x97884d95,"Reflect.isEnumValue","/usr/local/lib/haxe/std/cpp/_std/Reflect.hx",102,0x1c2422c3)
+HX_LOCAL_STACK_FRAME(_hx_pos_7b3988d9963d5a21_112_copy,"Reflect","copy",0x47e2b5a6,"Reflect.copy","/usr/local/lib/haxe/std/cpp/_std/Reflect.hx",112,0x1c2422c3)
+
+void Reflect_obj::__construct() { }
+
+Dynamic Reflect_obj::__CreateEmpty() { return new Reflect_obj; }
+
+void *Reflect_obj::_hx_vtable = 0;
+
+Dynamic Reflect_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Reflect_obj > _hx_result = new Reflect_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool Reflect_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x769a515d;
+}
+
+bool Reflect_obj::hasField( ::Dynamic o,::String field){
+ HX_STACKFRAME(&_hx_pos_7b3988d9963d5a21_30_hasField)
+HXDLIN( 30) return (::hx::IsNotNull( o ) && ( (bool)(o->__HasField(field)) ));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Reflect_obj,hasField,return )
+
+ ::Dynamic Reflect_obj::field( ::Dynamic o,::String field){
+ HX_STACKFRAME(&_hx_pos_7b3988d9963d5a21_35_field)
+HXDLIN( 35) return ::hx::IsNull( o ) ? null() : o->__Field(field,::hx::paccNever);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Reflect_obj,field,return )
+
+void Reflect_obj::setField( ::Dynamic o,::String field, ::Dynamic value){
+ HX_STACKFRAME(&_hx_pos_7b3988d9963d5a21_40_setField)
+HXDLIN( 40) if (::hx::IsNotNull( o )) {
+HXLINE( 41) o->__SetField(field,value,::hx::paccNever);
+ }
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC3(Reflect_obj,setField,(void))
+
+ ::Dynamic Reflect_obj::getProperty( ::Dynamic o,::String field){
+ HX_STACKFRAME(&_hx_pos_7b3988d9963d5a21_45_getProperty)
+HXDLIN( 45) return ::hx::IsNull( o ) ? null() : o->__Field(field,::hx::paccAlways);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Reflect_obj,getProperty,return )
+
+ ::Dynamic Reflect_obj::callMethod( ::Dynamic o, ::Dynamic func,::cpp::VirtualArray args){
+ HX_STACKFRAME(&_hx_pos_7b3988d9963d5a21_54_callMethod)
+HXLINE( 55) if ((::hx::IsNotNull( func ) && ::hx::IsEq( func->__GetType(),3 ))) {
+HXLINE( 56) if (::hx::IsNull( o )) {
+HXLINE( 57) HX_STACK_DO_THROW(HX_STACK_DO_THROW(HX_INVALID_OBJECT));
+ }
+HXLINE( 58) func = o->__Field(func,::hx::paccDynamic);
+ }
+HXLINE( 60) if (::hx::IsNull( func )) {
+HXLINE( 61) HX_STACK_DO_THROW(HX_STACK_DO_THROW(HX_NULL_FUNCTION_POINTER));
+ }
+HXLINE( 62) func->__SetThis(o);
+HXLINE( 63) return func->__Run(args);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC3(Reflect_obj,callMethod,return )
+
+::Array< ::String > Reflect_obj::fields( ::Dynamic o){
+ HX_STACKFRAME(&_hx_pos_7b3988d9963d5a21_67_fields)
+HXLINE( 68) if (::hx::IsNull( o )) {
+HXLINE( 69) return ::Array_obj< ::String >::__new();
+ }
+HXLINE( 70) ::Array< ::String > a = ::Array_obj< ::String >::__new(0);
+HXLINE( 71) o->__GetFields(a);
+HXLINE( 72) return a;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Reflect_obj,fields,return )
+
+bool Reflect_obj::isFunction( ::Dynamic f){
+ HX_STACKFRAME(&_hx_pos_7b3988d9963d5a21_77_isFunction)
+HXDLIN( 77) return (::hx::IsNotNull( f ) && ::hx::IsEq( f->__GetType(),6 ));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Reflect_obj,isFunction,return )
+
+int Reflect_obj::compare( ::Dynamic a, ::Dynamic b){
+ HX_STACKFRAME(&_hx_pos_7b3988d9963d5a21_81_compare)
+HXDLIN( 81) return ::hx::IsEq( a,b ) ? 0 : ::hx::IsGreater( a,b ) ? 1 : -1;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Reflect_obj,compare,return )
+
+bool Reflect_obj::compareMethods( ::Dynamic f1, ::Dynamic f2){
+ HX_STACKFRAME(&_hx_pos_7b3988d9963d5a21_84_compareMethods)
+HXLINE( 85) if (::hx::IsEq( f1,f2 )) {
+HXLINE( 86) return true;
+ }
+HXLINE( 87) if ((!(::Reflect_obj::isFunction(f1)) || !(::Reflect_obj::isFunction(f2)))) {
+HXLINE( 88) return false;
+ }
+HXLINE( 89) return ::__hxcpp_same_closure(f1,f2);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Reflect_obj,compareMethods,return )
+
+bool Reflect_obj::isObject( ::Dynamic v){
+ HX_STACKFRAME(&_hx_pos_7b3988d9963d5a21_93_isObject)
+HXLINE( 94) if (::hx::IsNull( v )) {
+HXLINE( 95) return false;
+ }
+HXLINE( 96) int t = ( (int)(v->__GetType()) );
+HXLINE( 97) return ((((t == 4) || (t == 8)) || (t == 3)) || (t == 5));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Reflect_obj,isObject,return )
+
+bool Reflect_obj::isEnumValue( ::Dynamic v){
+ HX_STACKFRAME(&_hx_pos_7b3988d9963d5a21_102_isEnumValue)
+HXDLIN( 102) return (::hx::IsNotNull( v ) && ::hx::IsEq( v->__GetType(),7 ));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Reflect_obj,isEnumValue,return )
+
+ ::Dynamic Reflect_obj::copy( ::Dynamic o){
+ HX_STACKFRAME(&_hx_pos_7b3988d9963d5a21_112_copy)
+HXLINE( 113) if (::hx::IsNull( o )) {
+HXLINE( 114) return null();
+ }
+HXLINE( 115) if (::hx::IsEq( o->__GetType(),3 )) {
+HXLINE( 116) return o;
+ }
+HXLINE( 117) if (::hx::IsEq( o->__GetType(),5 )) {
+HXLINE( 118) return o->__Field(HX_("copy",b5,bb,c4,41),::hx::paccDynamic)();
+ }
+HXLINE( 119) ::Dynamic o2 = ::Dynamic(::hx::Anon_obj::Create(0));
+HXLINE( 120) {
+HXLINE( 120) int _g = 0;
+HXDLIN( 120) ::Array< ::String > _g1 = ::Reflect_obj::fields(o);
+HXDLIN( 120) while((_g < _g1->length)){
+HXLINE( 120) ::String f = _g1->__get(_g);
+HXDLIN( 120) ++_g;
+HXLINE( 121) ::Reflect_obj::setField(o2,f,::Reflect_obj::field(o,f));
+ }
+ }
+HXLINE( 122) return o2;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Reflect_obj,copy,return )
+
+
+Reflect_obj::Reflect_obj()
+{
+}
+
+bool Reflect_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"copy") ) { outValue = copy_dyn(); return true; }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"field") ) { outValue = field_dyn(); return true; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"fields") ) { outValue = fields_dyn(); return true; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"compare") ) { outValue = compare_dyn(); return true; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"hasField") ) { outValue = hasField_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"setField") ) { outValue = setField_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"isObject") ) { outValue = isObject_dyn(); return true; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"callMethod") ) { outValue = callMethod_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"isFunction") ) { outValue = isFunction_dyn(); return true; }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"getProperty") ) { outValue = getProperty_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"isEnumValue") ) { outValue = isEnumValue_dyn(); return true; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"compareMethods") ) { outValue = compareMethods_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *Reflect_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *Reflect_obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class Reflect_obj::__mClass;
+
+static ::String Reflect_obj_sStaticFields[] = {
+ HX_("hasField",00,df,eb,8c),
+ HX_("field",ba,94,93,00),
+ HX_("setField",b8,fd,c7,0e),
+ HX_("getProperty",0b,0b,2c,d2),
+ HX_("callMethod",1f,ce,8a,34),
+ HX_("fields",79,8e,8e,80),
+ HX_("isFunction",22,bd,01,8f),
+ HX_("compare",a5,18,69,83),
+ HX_("compareMethods",4d,ac,7b,37),
+ HX_("isObject",49,1a,a9,6d),
+ HX_("isEnumValue",66,b7,87,06),
+ HX_("copy",b5,bb,c4,41),
+ ::String(null())
+};
+
+void Reflect_obj::__register()
+{
+ Reflect_obj _hx_dummy;
+ Reflect_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("Reflect",1d,ac,7a,b6);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Reflect_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Reflect_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< Reflect_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Reflect_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Reflect_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
diff --git a/Sources/c_snikket/src/Std.cpp b/Sources/c_snikket/src/Std.cpp
new file mode 100644
index 0000000..dc5c1ab
--- /dev/null
+++ b/Sources/c_snikket/src/Std.cpp
@@ -0,0 +1,201 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_e2e0452d28e59cd7_26_is,"Std","is",0x3c56d6f5,"Std.is","/usr/local/lib/haxe/std/cpp/_std/Std.hx",26,0xe751091d)
+HX_LOCAL_STACK_FRAME(_hx_pos_e2e0452d28e59cd7_30_isOfType,"Std","isOfType",0x6718c846,"Std.isOfType","/usr/local/lib/haxe/std/cpp/_std/Std.hx",30,0xe751091d)
+HX_LOCAL_STACK_FRAME(_hx_pos_e2e0452d28e59cd7_34_downcast,"Std","downcast",0x4619c56c,"Std.downcast","/usr/local/lib/haxe/std/cpp/_std/Std.hx",34,0xe751091d)
+HX_LOCAL_STACK_FRAME(_hx_pos_e2e0452d28e59cd7_39_instance,"Std","instance",0x1431f4e0,"Std.instance","/usr/local/lib/haxe/std/cpp/_std/Std.hx",39,0xe751091d)
+HX_LOCAL_STACK_FRAME(_hx_pos_e2e0452d28e59cd7_43_string,"Std","string",0xcf48855c,"Std.string","/usr/local/lib/haxe/std/cpp/_std/Std.hx",43,0xe751091d)
+HX_LOCAL_STACK_FRAME(_hx_pos_e2e0452d28e59cd7_47_int,"Std","int",0x8fa53b84,"Std.int","/usr/local/lib/haxe/std/cpp/_std/Std.hx",47,0xe751091d)
+HX_LOCAL_STACK_FRAME(_hx_pos_e2e0452d28e59cd7_51_parseInt,"Std","parseInt",0x90c2ebc7,"Std.parseInt","/usr/local/lib/haxe/std/cpp/_std/Std.hx",51,0xe751091d)
+HX_LOCAL_STACK_FRAME(_hx_pos_e2e0452d28e59cd7_55_parseFloat,"Std","parseFloat",0xbca10a74,"Std.parseFloat","/usr/local/lib/haxe/std/cpp/_std/Std.hx",55,0xe751091d)
+HX_LOCAL_STACK_FRAME(_hx_pos_e2e0452d28e59cd7_58_random,"Std","random",0x75a77e8e,"Std.random","/usr/local/lib/haxe/std/cpp/_std/Std.hx",58,0xe751091d)
+
+void Std_obj::__construct() { }
+
+Dynamic Std_obj::__CreateEmpty() { return new Std_obj; }
+
+void *Std_obj::_hx_vtable = 0;
+
+Dynamic Std_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Std_obj > _hx_result = new Std_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool Std_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x7ee3a517;
+}
+
+bool Std_obj::is( ::Dynamic v, ::Dynamic t){
+ HX_STACKFRAME(&_hx_pos_e2e0452d28e59cd7_26_is)
+HXDLIN( 26) return ::Std_obj::isOfType(v,t);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Std_obj,is,return )
+
+bool Std_obj::isOfType( ::Dynamic v, ::Dynamic t){
+ HX_STACKFRAME(&_hx_pos_e2e0452d28e59cd7_30_isOfType)
+HXDLIN( 30) return ::__instanceof(v,t);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Std_obj,isOfType,return )
+
+ ::Dynamic Std_obj::downcast( ::Dynamic value,::hx::Class c){
+ HX_STACKFRAME(&_hx_pos_e2e0452d28e59cd7_34_downcast)
+HXDLIN( 34) if (::Std_obj::isOfType(value,c)) {
+HXDLIN( 34) return value;
+ }
+ else {
+HXDLIN( 34) return null();
+ }
+HXDLIN( 34) return null();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Std_obj,downcast,return )
+
+ ::Dynamic Std_obj::instance( ::Dynamic value,::hx::Class c){
+ HX_STACKFRAME(&_hx_pos_e2e0452d28e59cd7_39_instance)
+HXDLIN( 39) ::Dynamic _hx_tmp;
+HXDLIN( 39) if (::Std_obj::isOfType(value,c)) {
+HXDLIN( 39) _hx_tmp = value;
+ }
+ else {
+HXDLIN( 39) _hx_tmp = null();
+ }
+HXDLIN( 39) return _hx_tmp;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Std_obj,instance,return )
+
+::String Std_obj::string( ::Dynamic s){
+ HX_STACKFRAME(&_hx_pos_e2e0452d28e59cd7_43_string)
+HXDLIN( 43) if (::hx::IsNull( s )) {
+HXDLIN( 43) return HX_("null",87,9e,0e,49);
+ }
+ else {
+HXDLIN( 43) return ( (::String)(s->toString()) );
+ }
+HXDLIN( 43) return null();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Std_obj,string,return )
+
+int Std_obj::_hx_int(Float x){
+ HX_STACKFRAME(&_hx_pos_e2e0452d28e59cd7_47_int)
+HXDLIN( 47) return ::__int__(x);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Std_obj,_hx_int,return )
+
+ ::Dynamic Std_obj::parseInt(::String x){
+ HX_STACKFRAME(&_hx_pos_e2e0452d28e59cd7_51_parseInt)
+HXDLIN( 51) return ::__hxcpp_parse_int(x);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Std_obj,parseInt,return )
+
+Float Std_obj::parseFloat(::String x){
+ HX_STACKFRAME(&_hx_pos_e2e0452d28e59cd7_55_parseFloat)
+HXDLIN( 55) return ::__hxcpp_parse_float(x);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Std_obj,parseFloat,return )
+
+int Std_obj::random(int x){
+ HX_STACKFRAME(&_hx_pos_e2e0452d28e59cd7_58_random)
+HXLINE( 59) if ((x <= 0)) {
+HXLINE( 60) return 0;
+ }
+HXLINE( 61) return ::__hxcpp_irand(x);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Std_obj,random,return )
+
+
+Std_obj::Std_obj()
+{
+}
+
+bool Std_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 2:
+ if (HX_FIELD_EQ(inName,"is") ) { outValue = is_dyn(); return true; }
+ break;
+ case 3:
+ if (HX_FIELD_EQ(inName,"int") ) { outValue = _hx_int_dyn(); return true; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"string") ) { outValue = string_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"random") ) { outValue = random_dyn(); return true; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"isOfType") ) { outValue = isOfType_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"downcast") ) { outValue = downcast_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"instance") ) { outValue = instance_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"parseInt") ) { outValue = parseInt_dyn(); return true; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"parseFloat") ) { outValue = parseFloat_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *Std_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *Std_obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class Std_obj::__mClass;
+
+static ::String Std_obj_sStaticFields[] = {
+ HX_("is",ea,5b,00,00),
+ HX_("isOfType",fb,f2,c7,ac),
+ HX_("downcast",21,f0,c8,8b),
+ HX_("instance",95,1f,e1,59),
+ HX_("string",d1,28,30,11),
+ HX_("int",ef,0c,50,00),
+ HX_("parseInt",7c,16,72,d6),
+ HX_("parseFloat",69,0c,78,2c),
+ HX_("random",03,22,8f,b7),
+ ::String(null())
+};
+
+void Std_obj::__register()
+{
+ Std_obj _hx_dummy;
+ Std_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("Std",83,60,3f,00);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Std_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Std_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< Std_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Std_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Std_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
diff --git a/Sources/c_snikket/src/String.cpp b/Sources/c_snikket/src/String.cpp
new file mode 100644
index 0000000..815d976
--- /dev/null
+++ b/Sources/c_snikket/src/String.cpp
@@ -0,0 +1,2417 @@
+#include <hxcpp.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <set>
+#include <string>
+#include <hx/Unordered.h>
+#include "hx/Hash.h"
+#include <hx/Thread.h>
+#include <locale>
+
+using namespace hx;
+
+#if defined(BLACKBERRY)
+using namespace std;
+#endif
+
+// -------- String ----------------------------------------
+
+
+#ifdef HX_WINDOWS
+
+#ifndef _MSC_VER
+#define _MSC_VER 1
+#endif
+
+// vc 7...
+#if _MSC_VER < 1400
+
+#define SPRINTF _snprintf
+
+#else // vc8+
+
+#define SPRINTF _snprintf_s
+
+#endif
+
+#else // not windows ..
+
+#define SPRINTF snprintf
+
+#endif
+
+#ifdef HX_SMART_STRINGS
+#include "hx/Unicase.h"
+#endif
+
+namespace hx
+{
+char HX_DOUBLE_PATTERN[20] = "%.15g";
+#define HX_INT_PATTERN "%d"
+#define HX_UINT_PATTERN "%ud"
+}
+
+void __hxcpp_set_float_format(String inFormat)
+{
+ int last = inFormat.length < 19 ? inFormat.length : 19;
+ memcpy(HX_DOUBLE_PATTERN, inFormat.utf8_str(), last*sizeof(char) );
+ HX_DOUBLE_PATTERN[last] = '\0';
+}
+
+// --- GC helper
+
+hx::Class __StringClass;
+
+String String::emptyString = HX_("",00,00,00,00);
+static Dynamic sConstEmptyString;
+static String sConstStrings[256];
+static Dynamic sConstDynamicStrings[256];
+static String *sCharToString[1088] = { 0 };
+
+
+typedef Hash<TNonGcStringSet> StringSet;
+static StringSet *sPermanentStringSet = 0;
+static volatile int sPermanentStringSetMutex = 0;
+
+#ifdef HXCPP_COMBINE_STRINGS
+static bool sIsIdent[256];
+static bool InitIdent()
+{
+ for(int i=0;i<256;i++)
+ sIsIdent[i]= (i>='a' && i<='z') || (i>='A' && i<='Z') || (i>='0' && i<='9') || (i=='_');
+ return true;
+}
+#endif
+
+inline static bool IsUtf16Surrogate(int ch)
+{
+ return ch>=0xd800 && ch<0xe000;
+}
+inline static bool IsUtf16LowSurrogate(int ch)
+{
+ return ch>=0xdc00 && ch<0xe000;
+}
+inline static bool IsUtf16HighSurrogate(int ch)
+{
+ return ch>=0xd800 && ch<0xdc00;
+}
+
+static int UTF8Bytes(int c)
+{
+ if( c <= 0x7F )
+ return 1;
+ else if( c <= 0x7FF )
+ return 2;
+ else if( c <= 0xFFFF )
+ return 3;
+ else
+ return 4;
+}
+
+inline static int UTF16BytesCheck(int ch)
+{
+ if (ch>=0x10000)
+ {
+ if (ch<0x110000)
+ return 2;
+ }
+ return 1;
+}
+
+static void UTF8EncodeAdvance(char * &ioPtr,int c)
+{
+ if( c <= 0x7F )
+ *ioPtr++ = (c);
+ else if( c <= 0x7FF )
+ {
+ *ioPtr++ = ( 0xC0 | (c >> 6) );
+ *ioPtr++ = ( 0x80 | (c & 63) );
+ }
+ else if( c <= 0xFFFF )
+ {
+ *ioPtr++ = ( 0xE0 | (c >> 12) );
+ *ioPtr++ = ( 0x80 | ((c >> 6) & 63) );
+ *ioPtr++ = ( 0x80 | (c & 63) );
+ }
+ else
+ {
+ *ioPtr++ = ( 0xF0 | (c >> 18) );
+ *ioPtr++ = ( 0x80 | ((c >> 12) & 63) );
+ *ioPtr++ = ( 0x80 | ((c >> 6) & 63) );
+ *ioPtr++ = ( 0x80 | (c & 63) );
+ }
+}
+
+static unsigned char *sUtf8LenArray = 0;
+
+static const unsigned char *getUtf8LenArray()
+{
+ if (!sUtf8LenArray)
+ {
+ sUtf8LenArray = (unsigned char *)malloc(256);
+ for(int i=0;i<256;i++)
+ sUtf8LenArray[i] = i< 0x80 ? 1 : i<0xe0 ? 2 : i<0xf0 ? 3 : 4;
+ }
+ return sUtf8LenArray;
+}
+
+static inline int DecodeAdvanceUTF8(const unsigned char * &ioPtr)
+{
+ int c = *ioPtr++;
+ if( c < 0x80 )
+ {
+ return c;
+ }
+ else if( c < 0xE0 )
+ {
+ return ((c & 0x3F) << 6) | ((*ioPtr++) & 0x7F);
+ }
+ else if( c < 0xF0 )
+ {
+ int c2 = *ioPtr++;
+ return ((c & 0x1F) << 12) | ((c2 & 0x7F) << 6) | ( (*ioPtr++) & 0x7F);
+ }
+
+ int c2 = *ioPtr++;
+ int c3 = *ioPtr++;
+ return ((c & 0x0F) << 18) | ((c2 & 0x7F) << 12) | ((c3 & 0x7F) << 6) | ((*ioPtr++) & 0x7F);
+}
+
+static inline int DecodeAdvanceUTF8(const unsigned char * &ioPtr,const unsigned char *end)
+{
+ int c = *ioPtr++;
+ if( c < 0x80 )
+ {
+ return c;
+ }
+ else if( c < 0xE0 )
+ {
+ return ((c & 0x3F) << 6) | (ioPtr < end ? (*ioPtr++) & 0x7F : 0);
+ }
+ else if( c < 0xF0 )
+ {
+ int c2 = ioPtr<end ? *ioPtr++ : 0;
+ return ((c & 0x1F) << 12) | ((c2 & 0x7F) << 6) | ( ioPtr<end ? (*ioPtr++) & 0x7F : 0 );
+ }
+
+ int c2 = ioPtr<end ? *ioPtr++ : 0;
+ int c3 = ioPtr<end ? *ioPtr++ : 0;
+ return ((c & 0x0F) << 18) | ((c2 & 0x7F) << 12) | ((c3 & 0x7F) << 6) | ( ioPtr<end ? (*ioPtr++) & 0x7F : 0);
+}
+
+
+int _hx_utf8_decode_advance(char *&ioPtr)
+{
+ return DecodeAdvanceUTF8( (const unsigned char * &) ioPtr );
+}
+
+
+inline int Char16Advance(const char16_t *&ioStr,bool throwOnErr=true)
+{
+ int ch = *ioStr++;
+ if (IsUtf16Surrogate(ch))
+ {
+ if (IsUtf16LowSurrogate(ch))
+ {
+ if (throwOnErr)
+ hx::Throw(HX_CSTRING("Invalid UTF16"));
+ return 0xFFFD;
+ }
+
+ int peek = *ioStr++;
+ if (IsUtf16HighSurrogate(peek))
+ {
+ if (throwOnErr)
+ hx::Throw(HX_CSTRING("Invalid UTF16"));
+ return 0xFFFD;
+ }
+
+ ch = 0x10000 + ((ch-0xd800) << 10) | (peek-0xdc00);
+ }
+ return ch;
+}
+
+
+void Char16AdvanceSet(char16_t *&ioStr,int inChar)
+{
+ if (inChar>=0x10000)
+ {
+ int over = (inChar-0x10000);
+ if (over>=0x100000)
+ {
+ *ioStr++ = 0xfffd;
+ }
+ else
+ {
+ *ioStr++ = (over>>10) + 0xd800;
+ *ioStr++ = (over&0x3ff) + 0xdc00;
+ }
+ }
+ else if (IsUtf16Surrogate(inChar))
+ {
+ *ioStr++ = 0xfffd;
+ }
+ else
+ *ioStr++ = inChar;
+}
+
+
+template<typename T>
+char *TConvertToUTF8(const T *inStr, int *ioLen, hx::IStringAlloc *inBuffer,bool)
+{
+ int len = 0;
+ int chars = 0;
+ if (ioLen==0 || *ioLen==0)
+ {
+ while(inStr[len])
+ chars += UTF8Bytes(inStr[len++]);
+ }
+ else
+ {
+ len = *ioLen;
+ for(int i=0;i<len;i++)
+ chars += UTF8Bytes(inStr[i]);
+ }
+
+ char *buf = inBuffer ? (char *)inBuffer->allocBytes(chars+1) :
+ (char *)NewGCPrivate(0,chars+1);
+ char *ptr = buf;
+ for(int i=0;i<len;i++)
+ UTF8EncodeAdvance(ptr,inStr[i]);
+ *ptr = 0;
+ if (ioLen)
+ *ioLen = chars;
+
+ return buf;
+}
+
+
+template<>
+char *TConvertToUTF8(const char16_t *inStr, int *ioLen, hx::IStringAlloc *inBuffer,bool throwInvalid)
+{
+ int len = 0;
+ if (ioLen==0 || *ioLen==0)
+ {
+ const char16_t *s = inStr;
+ while( Char16Advance(s,throwInvalid) ) { }
+ len = s - inStr - 1;
+ }
+ else
+ {
+ len = *ioLen;
+ }
+ const char16_t *s = inStr;
+ const char16_t *end = s + len;
+ int chars = 0;
+ while(s<end)
+ chars += UTF8Bytes( Char16Advance( s,throwInvalid ) );
+
+ char *buf = inBuffer ? (char *)inBuffer->allocBytes(chars+1) :
+ (char *)NewGCPrivate(0,chars+1);
+ char *ptr = buf;
+ s = inStr;
+ while(s<end)
+ UTF8EncodeAdvance(ptr,Char16Advance(s,throwInvalid));
+
+ *ptr = 0;
+ if (ioLen)
+ *ioLen = chars;
+
+ return buf;
+}
+
+char16_t *String::allocChar16Ptr(int len)
+{
+ char16_t *result = (char16_t *)hx::InternalNew( (len+1)*2, false );
+ ((unsigned int *)result)[-1] |= HX_GC_STRING_CHAR16_T;
+ result[len] = 0;
+ return result;
+}
+
+
+template<typename T>
+static const char *GCStringDup(const T *inStr,int inLen, int *outLen=0)
+{
+ if (inStr==0 && inLen<=0)
+ {
+ if (outLen)
+ outLen = 0;
+ return String::emptyString.raw_ptr();
+ }
+
+ int len = inLen;
+ bool allAscii = true;
+ if (len==-1)
+ {
+ len=0;
+ while(inStr[len])
+ {
+ if (sizeof(T)>1 && allAscii)
+ allAscii = inStr[len] <= 127;
+ len++;
+ }
+ }
+ else if (sizeof(T)>1)
+ {
+ for(int i=0;i<inLen;i++)
+ if (inStr[i]>127)
+ {
+ allAscii = false;
+ break;
+ }
+ }
+
+ if (outLen)
+ *outLen = len;
+
+ if (len==1)
+ return String::fromCharCode(inStr[0]).raw_ptr();
+
+ #ifdef HXCPP_COMBINE_STRINGS
+ bool ident = len<20 && sIsIdent[inStr[0]] && (inStr[0]<'0' || inStr[0]>'9');
+ if (ident && len>3)
+ for(int p=1; p<len;p++)
+ if (!sIsIdent[ inStr[p] ])
+ {
+ ident = false;
+ break;
+ }
+
+ if (ident)
+ {
+ hx::StackContext *ctx = hx::StackContext::getCurrent();
+ if (!ctx->stringSet)
+ ctx->stringSet = new WeakStringSet();
+
+ unsigned int hash = 0;
+ for(int i=0;i<len;i++)
+ hash = hash*223 + ((unsigned char *)inStr)[i];
+
+ struct Finder
+ {
+ int len;
+ const char *ptr;
+ Finder(int len, const char *inPtr) : len(len), ptr(inPtr) { }
+ bool operator==(const String &inStr) const
+ {
+ return len == inStr.length && !memcmp(ptr, inStr.__s, len*sizeof(char));
+ }
+ };
+ String found;
+ if (ctx->stringSet->findEquivalentKey(found, hash, Finder(len, inStr)))
+ return found.__s;
+
+ char *result = hx::NewString(len + 4);
+ memcpy(result,inStr,sizeof(char)*(len));
+ result[len] = '\0';
+ *((unsigned int *)(result + len + 1)) = hash;
+ ((unsigned int *)(result))[-1] |= HX_GC_STRING_HASH;
+
+ String asString(result, len);
+ ctx->stringSet->TSet( asString, true );
+
+ return result;
+ }
+ #endif
+
+ if (sizeof(T)==1 || allAscii)
+ {
+ char *result = hx::NewString( len );
+ if (sizeof(T)==1)
+ memcpy(result,inStr,sizeof(char)*(len));
+ else
+ for(int i=0;i<len;i++)
+ result[i] = inStr[i];
+ return result;
+ }
+
+
+ char16_t *result = String::allocChar16Ptr(len);
+ memcpy(result,inStr,2*len);
+ if (IsUtf16LowSurrogate(result[0]))
+ result[0] = 0xFFFD;
+ if (len>1 && IsUtf16HighSurrogate(result[len-1]))
+ result[len-1] = 0xFFFD;
+ return (const char *)result;
+}
+
+
+
+
+template<typename T>
+inline String TCopyString(const T *inString,int inLength)
+{
+ if (!inString)
+ return String();
+
+ #ifndef HX_SMART_STRINGS
+ if (inLength<0)
+ for(inLength=0; !inString[inLength]; inString++) { }
+
+ if (sizeof(T)==1)
+ {
+ int len = 0;
+ const char *res = GCStringDup((const char *)inString,inLength,&len);
+ return String(res,len);
+ }
+ else
+ {
+ int length = inLength;
+ const char *ptr = TConvertToUTF8(inString, &length, 0, true );
+ return String(ptr,length);
+ }
+ #else
+ int c16len=0;
+ bool hasWChar = false;
+ const T *end = inLength>=0 ? inString + inLength : 0;
+ if (end)
+ {
+ for(const T *s = inString; s<end; s++)
+ {
+ unsigned int c = *s;
+ if (c>127)
+ hasWChar = true;
+ c16len += UTF16BytesCheck(c);
+ }
+ }
+ else
+ for(const T *s = inString; *s; s++)
+ {
+ unsigned int c = *s;
+ if (c>127)
+ hasWChar = true;
+ c16len += UTF16BytesCheck(c);
+ }
+
+ if (hasWChar)
+ {
+ char16_t *result = String::allocChar16Ptr(c16len);
+ c16len = 0;
+ for(const T *s = inString; ; s++)
+ {
+ if (end)
+ {
+ if (s>=end) break;
+ }
+ else
+ {
+ if (!*s) break;
+ }
+ unsigned int c = *s;
+ if (c<0x10000)
+ result[c16len++] = c;
+ else
+ {
+ int over = (c-0x10000);
+ result[c16len++] = (over>>10) + 0xd800;
+ result[c16len++] = (over&0x3ff) + 0xdc00;
+ }
+ }
+ return String(result,c16len);
+ }
+ else
+ {
+ char *s = hx::NewString(c16len);
+ for(int i=0;i<c16len;i++)
+ s[i] = (char)inString[i];
+ return String(s,c16len);
+ }
+ #endif
+}
+
+
+String __hxcpp_char_array_to_utf8_string(Array<int> &inChars,int inFirst, int inLen)
+{
+ int len = inChars->length;
+ if (inFirst<0)
+ inFirst = 0;
+ if (inLen<0) inLen = len;
+ if (inFirst+inLen>len)
+ inLen = len-inFirst;
+ if (inLen<=0)
+ return String::emptyString;
+
+ int *base = &inChars[0];
+ #ifdef HX_SMART_STRINGS
+ bool hasBig = false;
+ for(int i=0;i<inLen;i++)
+ if (base[i+inFirst]>127)
+ {
+ hasBig = true;
+ break;
+ }
+
+ if (hasBig)
+ {
+ char16_t *ptr = String::allocChar16Ptr(inLen);
+ for(int i=0;i<inLen;i++)
+ ptr[i] = base[i+inFirst];
+ return String(ptr, inLen);
+ }
+ #endif
+ char *result = TConvertToUTF8(base+inFirst,&len,0,true);
+ return String(result,len);
+}
+
+Array<int> __hxcpp_utf8_string_to_char_array(String &inString)
+{
+ #ifdef HX_SMART_STRINGS
+ Array<int> result = Array_obj<int>::__new(inString.length);
+ if (inString.isUTF16Encoded())
+ {
+ const char16_t *ptr = inString.wc_str();
+ for(int i=0;i<inString.length;i++)
+ result[i] = ptr[i];
+ }
+ else
+ {
+ const char *ptr = inString.raw_ptr();
+ for(int i=0;i<inString.length;i++)
+ result[i] = ptr[i];
+ }
+ #else
+ Array<int> result = Array_obj<int>::__new(0,inString.length);
+
+ const unsigned char *src = (const unsigned char *)inString.__s;
+ const unsigned char *end = src + inString.length;
+ while(src<end)
+ result->push(DecodeAdvanceUTF8(src));
+
+ if (src!=end)
+ hx::Throw(HX_CSTRING("Invalid UTF8"));
+ #endif
+
+ return result;
+}
+
+
+String __hxcpp_char_bytes_to_utf8_string(String &inBytes)
+{
+ #ifdef HX_SMART_STRINGS
+ // This does not really make much sense
+ return inBytes;
+ #else
+ int len = inBytes.length;
+ char *result = TConvertToUTF8((unsigned char *)inBytes.__s,&len,0,true);
+ return String(result,len);
+ #endif
+}
+
+
+String __hxcpp_utf8_string_to_char_bytes(String &inUTF8)
+{
+ #ifdef HX_SMART_STRINGS
+ // This does not really make much sense
+ return inUTF8;
+ #else
+ const unsigned char *src = (unsigned char *)inUTF8.__s;
+ const unsigned char *end = src + inUTF8.length;
+ int char_count = 0;
+ while(src<end)
+ {
+ int c = DecodeAdvanceUTF8(src,end);
+ char_count++;
+ if( c == 8364 ) // euro symbol
+ c = 164;
+ else if ( c == 0xFEFF ) // BOM
+ {
+ char_count--;
+ }
+ else if( c > 255 )
+ hx::Throw(HX_CSTRING("Utf8::decode invalid character"));
+ }
+
+ if (src!=end)
+ hx::Throw(HX_CSTRING("Invalid UTF8"));
+
+ char *result = hx::NewString(char_count);
+
+ src = (unsigned char *)inUTF8.__s;
+ char_count = 0;
+ while(src<end)
+ {
+ int c = DecodeAdvanceUTF8(src);
+ if( c == 8364 ) // euro symbol
+ c = 164;
+ if ( c != 0xFEFF ) // BOM
+ result[char_count++] = c;
+ }
+
+ result[char_count] = '\0';
+ return String(result,char_count);
+ #endif
+}
+
+
+void _hx_utf8_iter(String inString, Dynamic inIter)
+{
+ #ifdef HX_SMART_STRINGS
+ if (inString.isUTF16Encoded())
+ for(int i=0;i<inString.length;i++)
+ inIter( (int)inString.raw_wptr()[i] );
+ else
+ for(int i=0;i<inString.length;i++)
+ inIter( (int)inString.raw_ptr()[i] );
+ #else
+ const unsigned char *src = (const unsigned char *)inString.__s;
+ const unsigned char *end = src + inString.length;
+
+ while(src<end)
+ inIter(DecodeAdvanceUTF8(src,end+1));
+
+ if (src>end)
+ hx::Throw(HX_CSTRING("Invalid UTF8"));
+ #endif
+}
+
+int _hx_utf8_char_code_at(String inString, int inIndex)
+{
+ #ifdef HX_SMART_STRINGS
+ if (!inString.raw_ptr() || inIndex>=inString.length)
+ return 0;
+ if (inString.isUTF16Encoded())
+ return inString.raw_wptr()[inIndex];
+ else
+ return inString.raw_ptr()[inIndex];
+ #else
+ const unsigned char *src = (const unsigned char *)inString.__s;
+ const unsigned char *end = src + inString.length;
+ const unsigned char *sLen = getUtf8LenArray();
+
+ for(int i=0;i<inIndex;i++)
+ {
+ src += sLen[*src];
+ if (src==end)
+ return 0;
+ if (src>end)
+ hx::Throw(HX_CSTRING("Invalid UTF8"));
+ }
+ return DecodeAdvanceUTF8(src,end);
+ #endif
+}
+
+int _hx_utf8_length(String inString)
+{
+ #ifdef HX_SMART_STRINGS
+ return inString.length;
+ #else
+
+ const unsigned char *src = (const unsigned char *)inString.__s;
+ const unsigned char *end = src + inString.length;
+
+ int len = 0;
+ const unsigned char *sLen = getUtf8LenArray();
+ while(src<end)
+ {
+ src += sLen[*src];
+ len++;
+ }
+ if (src>end)
+ hx::Throw(HX_CSTRING("Invalid UTF8"));
+ return len;
+ #endif
+}
+
+bool _hx_utf8_is_valid(String inString)
+{
+ #ifdef HX_SMART_STRINGS
+ return true;
+ #else
+ const unsigned char *src = (const unsigned char *)inString.__s;
+ const unsigned char *end = src + inString.length;
+ const unsigned char *sLen = getUtf8LenArray();
+ while(src<end)
+ src += sLen[*src];
+
+ return src==end;
+ #endif
+}
+
+String _hx_utf8_sub(String inString, int inStart, int inLen)
+{
+ #ifdef HX_SMART_STRINGS
+ return inString.substr(inStart,inLen);
+ #else
+ const unsigned char *src = (const unsigned char *)inString.__s;
+ const unsigned char *end = src + inString.length;
+
+ const unsigned char *sLen = getUtf8LenArray();
+ for(int i=0;i<inStart;i++)
+ {
+ src += sLen[*src];
+
+ if (src==end)
+ return String::emptyString;
+ if (src>end)
+ hx::Throw(HX_CSTRING("Invalid UTF8"));
+ }
+ const unsigned char *start = src;
+ for(int i=0;i<inLen;i++)
+ {
+ src += sLen[*src];
+ if (src==end)
+ break;
+ if (src>end)
+ hx::Throw(HX_CSTRING("Invalid UTF8"));
+ }
+ return String::create((const char *)start, src-start);
+ #endif
+}
+
+
+
+
+
+String String::create(const wchar_t *inString,int inLength) { return TCopyString(inString,inLength); }
+String String::create(const char16_t *inString,int inLength) { return TCopyString(inString,inLength); }
+String String::create(const char *inString,int inLength)
+{
+ if (!inString)
+ return String();
+
+ #ifdef HX_SMART_STRINGS
+ if (inLength<0)
+ for(inLength=0; inString[inLength]; inLength++) { }
+
+ const unsigned char *c = (const unsigned char *)inString;
+ for(int i=0;i<inLength;i++)
+ {
+ if (c[i]>127)
+ return _hx_utf8_to_utf16(c, inLength,false);
+ }
+
+ #endif
+
+ int len = 0;
+ const char *s = GCStringDup(inString,inLength,&len);
+ return String(s,len);
+}
+
+
+
+
+
+
+String::String(const Dynamic &inRHS)
+{
+ if (inRHS.GetPtr())
+ (*this)=const_cast<Dynamic &>(inRHS)->toString();
+ else
+ {
+ __s = 0;
+ length = 0;
+ }
+}
+
+void String::fromInt(int inIdx)
+{
+ char buf[100];
+ SPRINTF(buf,100,HX_INT_PATTERN,inIdx);
+ buf[99]='\0';
+ __s = GCStringDup(buf,-1,&length);
+}
+
+String::String(const int &inRHS)
+{
+ fromInt(inRHS);
+}
+
+
+String::String(const unsigned int &inRHS)
+{
+ char buf[100];
+ SPRINTF(buf,100,HX_UINT_PATTERN,inRHS);
+ buf[99]='\0';
+ __s = GCStringDup(buf,-1,&length);
+}
+
+
+String::String(const cpp::CppInt32__ &inRHS)
+{
+ char buf[100];
+ SPRINTF(buf,100,HX_INT_PATTERN,inRHS.mValue);
+ __s = GCStringDup(buf,-1,&length);
+}
+
+
+
+String::String(const double &inRHS)
+{
+ char buf[100];
+ SPRINTF(buf,100,HX_DOUBLE_PATTERN,inRHS);
+ buf[99]='\0';
+ __s = GCStringDup(buf,-1,&length);
+}
+
+
+String::String(const cpp::Int64 &inRHS)
+{
+ char buf[100];
+ SPRINTF(buf,100,"%lld", (long long int)inRHS);
+ buf[99]='\0';
+ __s = GCStringDup(buf,-1,&length);
+}
+
+
+String::String(const cpp::UInt64 &inRHS)
+{
+ char buf[100];
+ SPRINTF(buf,100,"%llu", (unsigned long long int)inRHS);
+ buf[99]='\0';
+ __s = GCStringDup(buf,-1,&length);
+}
+
+String::String(const unsigned long &inRHS)
+{
+ char buf[100];
+ SPRINTF(buf,100,"%llu", (unsigned long long int)inRHS);
+ buf[99]='\0';
+ __s = GCStringDup(buf,-1,&length);
+}
+
+String::String(const float &inRHS)
+{
+ char buf[100];
+ SPRINTF(buf,100,HX_DOUBLE_PATTERN,inRHS);
+ buf[99]='\0';
+ __s = GCStringDup(buf,-1,&length);
+}
+
+String::String(const bool &inRHS)
+{
+ if (inRHS)
+ {
+ *this = HX_CSTRING("true");
+ }
+ else
+ {
+ *this = HX_CSTRING("false");
+ }
+}
+
+void String::fromPointer(const void *p)
+{
+ char buf[128];
+ SPRINTF(buf,128,"Native(%p)",p);
+ __s = GCStringDup(buf,-1,&length);
+}
+
+#ifdef HX_SMART_STRINGS
+#define ADD_HASH(X) \
+ result = result*223 + (int)(X)
+#endif
+
+unsigned int String::calcSubHash(int start, int inLen) const
+{
+ unsigned int result = 0;
+ #ifdef HX_SMART_STRINGS
+ if (isUTF16Encoded())
+ {
+ const char16_t *w = __w + start;
+ for(int i=0;i<inLen;i++)
+ {
+ int c = w[i];
+ if( c <= 0x7F )
+ {
+ ADD_HASH(c);
+ }
+ else if( c <= 0x7FF )
+ {
+ ADD_HASH(0xC0 | (c >> 6));
+ ADD_HASH(0x80 | (c & 63));
+ }
+ else if( c <= 0xFFFF )
+ {
+ ADD_HASH(0xE0 | (c >> 12));
+ ADD_HASH(0x80 | ((c >> 6) & 63));
+ ADD_HASH(0x80 | (c & 63));
+ }
+ else
+ {
+ ADD_HASH(0xF0 | (c >> 18));
+ ADD_HASH(0x80 | ((c >> 12) & 63));
+ ADD_HASH(0x80 | ((c >> 6) & 63) );
+ ADD_HASH(0x80 | (c & 63) );
+ }
+ }
+ }
+ else
+ #endif
+ {
+ const unsigned char *s = (const unsigned char *)__s + start;
+ for(int i=0;i<inLen;i++)
+ result = result*223 + s[i];
+ }
+
+ return result;
+
+}
+
+unsigned int String::calcHash() const
+{
+ unsigned int result = 0;
+ #ifdef HX_SMART_STRINGS
+ if (isUTF16Encoded())
+ {
+ for(int i=0;i<length;i++)
+ {
+ int c = __w[i];
+ if( c <= 0x7F )
+ {
+ ADD_HASH(c);
+ }
+ else if( c <= 0x7FF )
+ {
+ ADD_HASH(0xC0 | (c >> 6));
+ ADD_HASH(0x80 | (c & 63));
+ }
+ else if( c <= 0xFFFF )
+ {
+ ADD_HASH(0xE0 | (c >> 12));
+ ADD_HASH(0x80 | ((c >> 6) & 63));
+ ADD_HASH(0x80 | (c & 63));
+ }
+ else
+ {
+ ADD_HASH(0xF0 | (c >> 18));
+ ADD_HASH(0x80 | ((c >> 12) & 63));
+ ADD_HASH(0x80 | ((c >> 6) & 63) );
+ ADD_HASH(0x80 | (c & 63) );
+ }
+ }
+ }
+ else
+ #endif
+ for(int i=0;i<length;i++)
+ result = result*223 + ((unsigned char *)__s)[i];
+
+ return result;
+}
+
+
+
+// InternalCreateConstBuffer is not uft16 aware whenit come to hashes
+static void fixHashPerm16(const String &str)
+{
+ unsigned int hash = str.calcHash();
+ ((unsigned int *)str.raw_ptr())[-2] = hash;
+}
+
+
+static unsigned char safeChars[256];
+
+String String::__URLEncode() const
+{
+ Array<unsigned char> bytes(0,length);
+ // utf8-encode
+ __hxcpp_bytes_of_string(bytes,*this);
+
+ int extra = 0;
+ int utf8_chars = bytes->__length();
+ for(int i=0;i<utf8_chars;i++)
+ if (!safeChars[bytes[i]])
+ extra++;
+ if (extra==0)
+ return *this;
+
+ int l = utf8_chars + extra*2;
+ char *result = hx::NewString(l);
+ char *ptr = result;
+
+ for(int i=0;i<utf8_chars;i++)
+ {
+ if (!safeChars[bytes[i]])
+ {
+ static char hex[] = "0123456789ABCDEF";
+ unsigned char b = bytes[i];
+ *ptr++ = '%';
+ *ptr++ = hex[ b>>4 ];
+ *ptr++ = hex[ b & 0x0f ];
+ }
+ else
+ *ptr++ = bytes[i];
+ }
+ return String(result,l);
+}
+
+String String::toUpperCase() const
+{
+ #ifdef HX_SMART_STRINGS
+ if (isUTF16Encoded())
+ {
+ char16_t *result = String::allocChar16Ptr(length);
+ for(int i=0;i<length;i++)
+ {
+ // Surrogates should already may to themselves - no need to check
+ result[i] = unicase_toupper( __w[i] );
+ }
+ return String(result,length);
+ }
+ #endif
+
+ char *result = hx::NewString(length);
+ for(int i=0;i<length;i++)
+ result[i] = toupper( __s[i] );
+ return String(result,length);
+}
+
+String String::toLowerCase() const
+{
+ #ifdef HX_SMART_STRINGS
+ if (isUTF16Encoded())
+ {
+ char16_t *result = String::allocChar16Ptr(length);
+ for(int i=0;i<length;i++)
+ {
+ result[i] = unicase_tolower( __w[i] );
+ }
+ return String(result,length);
+ }
+ #endif
+ char *result = hx::NewString(length);
+ for(int i=0;i<length;i++)
+ result[i] = tolower( __s[i] );
+ return String(result,length);
+}
+
+
+static int hex(int inChar)
+{
+ if (inChar>='0' && inChar<='9')
+ return inChar-'0';
+ if (inChar>='a' && inChar<='f')
+ return inChar-'a' + 10;
+ if (inChar>='A' && inChar<='F')
+ return inChar-'A' + 10;
+ return 0;
+}
+
+
+String String::__URLDecode() const
+{
+ // Create the decoded string; the decoded form might have fewer than
+ // [length] characters, but it won't have more. If it has fewer than
+ // [length], some memory will be wasted here, but on the assumption that
+ // most URLs have only a few '%NN' encodings in them, don't bother
+ // counting the number of characters in the resulting string first.
+ char *decoded = NewString(length), *d = decoded;
+
+ bool hasBig = false;
+
+ #ifdef HX_SMART_STRINGS
+ if (isUTF16Encoded())
+ {
+ for (int i = 0; i < length; i++)
+ {
+ int c = __w[i];
+ if (c > 127)
+ *d++ = '?';
+ else if (c == '+')
+ *d++ = ' ';
+ else if ((c == '%') && (i < (length - 2)))
+ {
+ int ch = ((hex(__w[i + 1]) << 4) | (hex(__w[i + 2])));
+ if (ch>127)
+ hasBig = true;
+ *d++ = ch;
+ i += 2;
+ }
+ else
+ *d++ = c;
+ }
+ }
+ else
+ #endif
+ {
+ for (int i = 0; i < length; i++)
+ {
+ int c = __s[i];
+ if (c > 127)
+ *d++ = '?';
+ else if (c == '+')
+ *d++ = ' ';
+ else if ((c == '%') && (i < (length - 2)))
+ {
+ int ch = ((hex(__s[i + 1]) << 4) | (hex(__s[i + 2])));
+ #ifdef HX_SMART_STRINGS
+ if (ch>127)
+ hasBig = true;
+ #endif
+ *d++ = ch;
+ i += 2;
+ }
+ else
+ *d++ = c;
+ }
+ }
+
+ #ifdef HX_SMART_STRINGS
+ if (hasBig)
+ return _hx_utf8_to_utf16((const unsigned char *)decoded, d-decoded,false);
+ #endif
+
+ return String( decoded, (d - decoded) );
+}
+
+::String &::String::dup()
+{
+ const char *s = __s;
+ __s = 0;
+ *this = create(s,length);
+ return *this;
+}
+
+const ::String &::String::makePermanent() const
+{
+ if (!__s || (__s[HX_GC_CONST_ALLOC_MARK_OFFSET] & HX_GC_CONST_ALLOC_MARK_BIT) )
+ {
+ // Already permanent
+ }
+ else if (!length)
+ {
+ const_cast<String *>(this)->__s = emptyString.__s;
+ }
+ else if (length==1)
+ {
+ const_cast<String *>(this)->__s = String::fromCharCode(cca(0)).__s;
+ }
+ else
+ {
+ unsigned int myHash = hash();
+ {
+ while(_hx_atomic_compare_exchange(&sPermanentStringSetMutex, 0, 1) != 0)
+ __hxcpp_gc_safe_point();
+ TNonGcStringSet *element = sPermanentStringSet->find(myHash , *this);
+ sPermanentStringSetMutex = 0;
+ if (element)
+ {
+ const_cast<String *>(this)->__s = element->key.__s;
+ return *this;
+ }
+ }
+
+ #ifdef HX_SMART_STRINGS
+ if (isUTF16Encoded())
+ {
+ char16_t *w = (char16_t *)InternalCreateConstBuffer(__s,(length+1)*2,true);
+ ((unsigned int *)w)[-1] |= HX_GC_STRING_CHAR16_T;
+ const_cast<String *>(this)->__w = w;
+ fixHashPerm16(*this);
+ }
+ else
+ #endif
+ {
+ char *s = (char *)InternalCreateConstBuffer(__s,length+1,true);
+ const_cast<String *>(this)->__s = s;
+ }
+
+ while(_hx_atomic_compare_exchange(&sPermanentStringSetMutex, 0, 1) != 0)
+ __hxcpp_gc_safe_point();
+ sPermanentStringSet->set(*this,null());
+ sPermanentStringSetMutex = 0;
+ }
+
+ return *this;
+}
+
+
+String String::createPermanent(const char *inUtf8, int length)
+{
+ if (!inUtf8)
+ return String();
+
+ if (length<0)
+ length = strlen(inUtf8);
+
+ if (!length)
+ {
+ return emptyString;
+ }
+ else if (length==1)
+ {
+ return String::fromCharCode( *(unsigned char *)inUtf8 );
+ }
+ else
+ {
+ String temp = create(inUtf8,length);
+ return temp.makePermanent();
+ }
+}
+
+
+
+
+template<typename T>
+static int TIndexOf(int s, const T *str, int strLen, const T *sought, int soughtLen)
+{
+ if (soughtLen==1)
+ {
+ T test = *sought;
+ while(s<strLen)
+ {
+ if (str[s]==test)
+ return s;
+ ++s;
+ }
+ }
+ else
+ {
+ while(s+soughtLen<=strLen)
+ {
+ if (!memcmp(str + s,sought,soughtLen*sizeof(T)))
+ return s;
+ s++;
+ }
+ }
+ return -1;
+}
+
+static bool StrMatch(const char16_t *src0, const char *src1, int len)
+{
+ for(int i=0;i<len;i++)
+ if (src0[i]!=src1[i])
+ return false;
+ return true;
+}
+
+
+int String::indexOf(const String &inValue, Dynamic inStart) const
+{
+ if (__s==0)
+ return -1;
+ int s = inStart==null() ? 0 : inStart->__ToInt();
+ int l = inValue.length;
+
+ if (l==0) {
+ return std::max(0, std::min(s, length));
+ }
+
+ #ifdef HX_SMART_STRINGS
+ bool s016 = isUTF16Encoded();
+ bool s116 = inValue.isUTF16Encoded();
+ if (s016 || s116)
+ {
+ if (s016 && s116)
+ return TIndexOf(s, __w, length, inValue.__w, inValue.length);
+
+ while(s+l<=length)
+ {
+ if (s016 ? StrMatch(__w+s, inValue.__s, l) : StrMatch(inValue.__w, __s+s, l) )
+ return s;
+ s++;
+ }
+ return -1;
+ }
+ #endif
+
+ return TIndexOf(s, __s, length, inValue.__s, inValue.length);
+}
+
+
+template<typename T>
+static int TLastIndexOf(int s, const T *str, int strLen, const T *sought, int soughtLen)
+{
+ if (soughtLen==1)
+ {
+ T test = *sought;
+ while(s>=0)
+ {
+ if (str[s]==test)
+ return s;
+ s--;
+ }
+ }
+ else
+ {
+ while(s>=0)
+ {
+ if (!memcmp(str + s,sought,soughtLen*sizeof(T)))
+ return s;
+ --s;
+ }
+ }
+ return -1;
+}
+
+
+
+int String::lastIndexOf(const String &inValue, Dynamic inStart) const
+{
+ if (__s==0)
+ return -1;
+ int l = inValue.length;
+ int s = inStart==null() ? length : inStart->__ToInt();
+ if (l==0) {
+ return std::max(0, std::min(s, length));
+ }
+ if (l>length) return -1;
+ if (s+l>length) s = length-l;
+
+ #ifdef HX_SMART_STRINGS
+ bool s016 = isUTF16Encoded();
+ bool s116 = inValue.isUTF16Encoded();
+ if (s016 || s116)
+ {
+ if (s016 && s116)
+ return TLastIndexOf(s, __w, length, inValue.__w, inValue.length);
+
+ while(s>=0)
+ {
+ if (s016 ? StrMatch(__w+s, inValue.__s, l) : StrMatch(inValue.__w, __s+s, l) )
+ return s;
+ s--;
+ }
+ return -1;
+ }
+ #endif
+ return TLastIndexOf(s, __s, length, inValue.__s, inValue.length);
+}
+
+
+
+
+
+Dynamic String::charCodeAt(int inPos) const
+{
+ if (inPos<0 || inPos>=length)
+ return null();
+
+ #ifdef HX_SMART_STRINGS
+ if (isUTF16Encoded())
+ {
+ return (int)__w[inPos];
+ }
+ #endif
+ return (int)(((unsigned char *)__s)[inPos]);
+}
+
+String String::fromCharCode( int c )
+{
+ if (c<=255)
+ {
+ return sConstStrings[c];
+ }
+ else
+ {
+ #ifdef HX_SMART_STRINGS
+ if (IsUtf16Surrogate(c)||c>=0x110000)
+ c = 0xFFFD;
+ #endif
+
+ int group = c>>10;
+ if (group>=1088)
+ hx::Throw(HX_CSTRING("Invalid char code"));
+ if (!sCharToString[group])
+ {
+ String *ptr = (String *)malloc( sizeof(String)*1024 );
+ memset(ptr, 0, sizeof(String)*1024 );
+ sCharToString[group] = ptr;
+ }
+ String *ptr = sCharToString[group];
+ int cid = c & ((1<<10)-1);
+ if (!ptr[cid].__s)
+ {
+ #ifdef HX_SMART_STRINGS
+ int l = UTF16BytesCheck(c);
+ char16_t *p = (char16_t *)InternalCreateConstBuffer(0,(l+1)*2,true);
+ ((unsigned int *)p)[-1] |= HX_GC_STRING_CHAR16_T;
+ if (c>=0x10000)
+ {
+ int over = (c-0x10000);
+ p[0] = (over>>10) + 0xd800;
+ p[1] = (over&0x3ff) + 0xdc00;
+ }
+ else
+ p[0] = c;
+
+ ptr[cid].length = l;
+ ptr[cid].__w = p;
+ fixHashPerm16(ptr[cid]);
+ #else
+ char buf[5];
+ int utf8Len = UTF8Bytes(c);
+ char *p = buf;
+ UTF8EncodeAdvance(p,c);
+ buf[utf8Len] = '\0';
+ const char *s = (char *)InternalCreateConstBuffer(buf,utf8Len+1,true);
+ ptr[cid].length = utf8Len;
+ ptr[cid].__s = s;
+ #endif
+ }
+ return ptr[cid];
+ }
+}
+
+String String::charAt( int at ) const
+{
+ if (at<0 || at>=length)
+ return emptyString;
+
+ #ifdef HX_SMART_STRINGS
+ if (isUTF16Encoded())
+ return fromCharCode(__w[at]);
+ #endif
+ return fromCharCode(__s[at]);
+}
+
+void __hxcpp_bytes_of_string(Array<unsigned char> &outBytes,const String &inString)
+{
+ if (!inString.length)
+ return;
+
+ #ifdef HX_SMART_STRINGS
+ if (inString.isUTF16Encoded())
+ {
+ const char16_t *src = inString.raw_wptr();
+ const char16_t *end = src + inString.length;
+ while(src<end)
+ {
+ int c = Char16Advance(src);
+
+ if( c <= 0x7F )
+ outBytes->push(c);
+ else if( c <= 0x7FF )
+ {
+ outBytes->push( 0xC0 | (c >> 6) );
+ outBytes->push( 0x80 | (c & 63) );
+ }
+ else if( c <= 0xFFFF )
+ {
+ outBytes->push( 0xE0 | (c >> 12) );
+ outBytes->push( 0x80 | ((c >> 6) & 63) );
+ outBytes->push( 0x80 | (c & 63) );
+ }
+ else
+ {
+ outBytes->push( 0xF0 | (c >> 18) );
+ outBytes->push( 0x80 | ((c >> 12) & 63) );
+ outBytes->push( 0x80 | ((c >> 6) & 63) );
+ outBytes->push( 0x80 | (c & 63) );
+ }
+ }
+ }
+ else
+ #endif
+ {
+ outBytes->__SetSize(inString.length);
+ memcpy(outBytes->GetBase(), inString.raw_ptr(),inString.length);
+ }
+}
+
+#ifdef HX_SMART_STRINGS
+String _hx_utf8_to_utf16(const unsigned char *ptr, int inUtf8Len, bool addHash)
+{
+ unsigned int hash = 0;
+ if (addHash)
+ for(int i=0;i<inUtf8Len;i++)
+ hash = hash*223 + ptr[i];
+
+ int char16Count = 0;
+ const unsigned char *u = ptr;
+ const unsigned char *end = ptr + inUtf8Len;
+ while(u<end)
+ {
+ int code = DecodeAdvanceUTF8(u,end);
+ char16Count += UTF16BytesCheck(code);
+ }
+
+ int allocSize = 2*(char16Count+1);
+ if (addHash)
+ allocSize += sizeof(int);
+ char16_t *str = (char16_t *)NewGCPrivate(0,allocSize);
+
+ u = ptr;
+ char16_t *o = str;
+ while(u<end)
+ {
+ int code = DecodeAdvanceUTF8(u,end);
+ Char16AdvanceSet(o,code);
+ }
+ if (addHash)
+ {
+ #ifdef EMSCRIPTEN
+ *((emscripten_align1_int *)(str+char16Count+1) ) = hash;
+ #else
+ *((unsigned int *)(str+char16Count+1) ) = hash;
+ #endif
+ ((unsigned int *)(str))[-1] |= HX_GC_STRING_HASH | HX_GC_STRING_CHAR16_T;
+ }
+ else
+ ((unsigned int *)(str))[-1] |= HX_GC_STRING_CHAR16_T;
+
+ return String(str, char16Count);
+}
+#endif
+
+
+void __hxcpp_string_of_bytes(Array<unsigned char> &inBytes,String &outString,int pos,int len,bool inCopyPointer)
+{
+ if (inCopyPointer)
+ outString = String( (const char *)inBytes->GetBase(), len);
+ else if (len==0)
+ outString = String::emptyString;
+ else
+ {
+ const unsigned char *p0 = (const unsigned char *)inBytes->GetBase();
+ #ifdef HX_SMART_STRINGS
+ bool hasWChar = false;
+ const unsigned char *p = p0 + pos;
+ for(int i=0;i<len;i++)
+ if (p[i]>127)
+ {
+ hasWChar = true;
+ break;
+ }
+ if (hasWChar)
+ {
+ outString = _hx_utf8_to_utf16(p0+pos,len,true);
+ }
+ else
+ #endif
+ outString = String( GCStringDup((const char *)p0+pos, len, 0), len);
+ }
+}
+
+
+
+const char * String::utf8_str(hx::IStringAlloc *inBuffer,bool throwInvalid, int *byteLength) const
+{
+ #ifdef HX_SMART_STRINGS
+ if (isUTF16Encoded())
+ return TConvertToUTF8(__w,byteLength,inBuffer,throwInvalid);
+ #endif
+ if (byteLength != 0)
+ {
+ *byteLength = length;
+ }
+ return __s;
+}
+
+const char *String::ascii_substr(hx::IStringAlloc *inBuffer,int start, int length) const
+{
+ #ifdef HX_SMART_STRINGS
+ if (isUTF16Encoded())
+ {
+ const char16_t *p0 = __w + start;
+ const char16_t *p = p0;
+ const char16_t *limit = p+length;
+ while(p<limit)
+ {
+ if (*p<=0 || *p>=127)
+ break;
+ p++;
+ }
+ int validLen = (int)(p-p0);
+ char *result = (char *)inBuffer->allocBytes(validLen+1);
+ for(int i=0;i<validLen;i++)
+ result[i] = p0[i];
+ result[validLen] = 0;
+ return result;
+ }
+ #endif
+ if (__s[start+length]=='\0')
+ return __s+start;
+ char *result = (char *)inBuffer->allocBytes(length+1);
+ memcpy(result,__s+start,length);
+ result[length] = '\0';
+
+ return result;
+}
+
+#ifdef HX_SMART_STRINGS
+
+bool String::eq(const ::String &inRHS) const
+{
+ if (length != inRHS.length)
+ return false;
+
+ bool s0IsWide = isUTF16Encoded();
+ if (s0IsWide != inRHS.isUTF16Encoded() )
+ return false;
+ return !memcmp(__s, inRHS.__s, s0IsWide ? 2 * length : length );
+}
+
+
+int String::compare(const ::String &inRHS) const
+{
+ if (!__s)
+ return inRHS.__s ? -1 : 0;
+ if (!inRHS.__s)
+ return 1;
+
+ int cmp = 0;
+ int minLen = length<inRHS.length ? length : inRHS.length;
+
+ if (minLen>0)
+ {
+ bool s0IsWide = isUTF16Encoded();
+ bool s1IsWide = inRHS.isUTF16Encoded();
+
+ if (s0IsWide==s1IsWide)
+ {
+ if (!s0IsWide)
+ {
+ cmp = memcmp(__s,inRHS.__s,minLen);
+ }
+ else
+ {
+ for(int i=0;i<minLen;i++)
+ {
+ if (__w[i]!=inRHS.__w[i])
+ {
+ cmp = __w[i] - inRHS.__w[i];
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ const unsigned char *s = (const unsigned char *)( s0IsWide ? inRHS.__s : __s );
+ const char16_t *w = s0IsWide ? __w : inRHS.__w;
+ for(int i=0;i<minLen;i++)
+ if (s[i]!=w[i])
+ {
+ cmp = s[i]<w[i] ? -1 : 1;
+ if (s0IsWide)
+ cmp = - cmp;
+ break;
+ }
+ }
+ }
+ return cmp ? cmp : length - inRHS.length;
+}
+#endif
+
+
+namespace hx
+{
+
+wchar_t *ConvertToWChar(const char *inStr, int *ioLen)
+{
+ int len = ioLen ? *ioLen : strlen(inStr);
+
+ wchar_t *result = (wchar_t *)NewGCPrivate(0,sizeof(wchar_t)*(len+1));
+ int l = 0;
+
+ unsigned char *b = (unsigned char *)inStr;
+ for(int i=0;i<len;)
+ {
+ int c = b[i++];
+ if (c==0) break;
+ else if( c < 0x80 )
+ {
+ result[l++] = c;
+ }
+ else if( c < 0xE0 )
+ result[l++] = ( ((c & 0x3F) << 6) | (b[i++] & 0x7F) );
+ else if( c < 0xF0 )
+ {
+ int c2 = b[i++];
+ result[l++] = ( ((c & 0x1F) << 12) | ((c2 & 0x7F) << 6) | ( b[i++] & 0x7F) );
+ }
+ else
+ {
+ int c2 = b[i++];
+ int c3 = b[i++];
+ result[l++] = ( ((c & 0x0F) << 18) | ((c2 & 0x7F) << 12) | ((c3 << 6) & 0x7F) | (b[i++] & 0x7F) );
+ }
+ }
+ result[l] = '\0';
+ if (ioLen)
+ *ioLen = l;
+ return result;
+}
+
+
+
+
+}
+
+
+
+const char16_t * String::wc_str(hx::IStringAlloc *inBuffer, int *outCharLength) const
+{
+ #ifdef HX_SMART_STRINGS
+ if (isUTF16Encoded()) {
+ if (outCharLength != 0) {
+ *outCharLength = length;
+ }
+ return __w;
+ }
+ #endif
+
+ int char16Count = 0;
+ const unsigned char *ptr = (const unsigned char *)__s;
+ const unsigned char *u = ptr;
+ const unsigned char *end = u + length;
+ while(u<end)
+ {
+ int code = DecodeAdvanceUTF8(u,end);
+ char16Count += UTF16BytesCheck(code);
+ }
+
+ char16_t *str = inBuffer ? (char16_t *)inBuffer->allocBytes(2*(char16Count+1)) :
+ (char16_t *)NewGCPrivate(0,2*(char16Count+1));
+
+ u = ptr;
+ char16_t *o = str;
+ while(u<end)
+ {
+ int code = DecodeAdvanceUTF8(u,end);
+ Char16AdvanceSet(o,code);
+ }
+ *o = 0;
+ if (outCharLength != 0) {
+ *outCharLength = char16Count;
+ }
+ return str;
+}
+
+
+const wchar_t * String::wchar_str(hx::IStringAlloc *inBuffer) const
+{
+ if (!__s)
+ return 0;
+ if (length==0)
+ return L"";
+
+ #ifdef HX_SMART_STRINGS
+ if (isUTF16Encoded())
+ {
+ if (sizeof(wchar_t)==sizeof(char16_t))
+ return (wchar_t *)__w;
+ }
+
+ wchar_t *result = 0;
+ if (inBuffer)
+ {
+ result = (wchar_t *)inBuffer->allocBytes(sizeof(wchar_t)*(length+1) );
+ }
+ else
+ {
+ result = (wchar_t *)NewGCPrivate(0,sizeof(wchar_t)*(length+1) );
+ }
+ if (isUTF16Encoded())
+ for(int i=0;i<length;i++)
+ result[i] = __w[i];
+ else
+ for(int i=0;i<length;i++)
+ result[i] = __s[i];
+ result[length] = 0;
+ return result;
+ #else
+
+ const unsigned char *ptr = (const unsigned char *)__s;
+ const unsigned char *end = ptr + length;
+ int idx = 0;
+ while(ptr<end)
+ {
+ DecodeAdvanceUTF8(ptr,end);
+ idx++;
+ }
+
+ wchar_t *result = 0;
+ if (inBuffer)
+ {
+ result = (wchar_t *)inBuffer->allocBytes(sizeof(wchar_t)*(idx+1) );
+ }
+ else
+ {
+ result = (wchar_t *)NewGCPrivate(0,sizeof(wchar_t)*(idx+1) );
+ }
+
+ ptr = (const unsigned char *)__s;
+ idx = 0;
+ while(ptr<end)
+ result[idx++] = DecodeAdvanceUTF8(ptr,end);
+ result[idx] = 0;
+ return result;
+ #endif
+}
+
+
+
+#ifdef ANDROID
+bool my_wstrneq(const wchar_t *s1, const wchar_t *s2, int len)
+{
+ for(int i=0;i<len;i++)
+ if (s1[i]!=s2[i])
+ return false;
+ return true;
+}
+#endif
+
+static bool isSame(const char16_t *a, const char *b, int count)
+{
+ for(int i=0;i<count;i++)
+ if (a[i]!=b[i])
+ return false;
+ return true;
+}
+
+Array<String> String::split(const String &inDelimiter) const
+{
+ int len = inDelimiter.length;
+ int pos = 0;
+ int last = 0;
+ if (len==0)
+ {
+ // Special case of splitting into characters - use efficient code...
+ int chars = length;
+ Array<String> result(0,chars);
+ int idx = 0;
+ #ifdef HX_SMART_STRINGS
+ if (isUTF16Encoded())
+ {
+ const char16_t *p = __w;
+ for(int i=0;i<length;i++)
+ result[i] = String::fromCharCode(p[i]);
+ /*
+ const char16_t *end = p + length;
+ while(p<end)
+ result[idx++] = String::fromCharCode(Char16Advance(p));
+ */
+ }
+ else
+ {
+ for(int i=0;i<chars;i++)
+ result[i] = String::fromCharCode( __s[i] );
+ }
+ #else
+ for(int i=0;i<chars; )
+ {
+ const unsigned char *start = (const unsigned char *)(__s + i);
+ const unsigned char *ptr = start;
+ DecodeAdvanceUTF8(ptr);
+ int len = ptr - start;
+ result[idx++] = String::create( __s+i, len );
+ i+=len;
+ }
+ #endif
+ return result;
+ }
+
+
+ Array<String> result(0,1);
+ #if HX_SMART_STRINGS
+ bool s0 = isUTF16Encoded();
+ bool s1 = inDelimiter.isUTF16Encoded();
+ if (s0 || s1)
+ {
+ if (s0 && s1)
+ {
+ while(pos+len <=length )
+ if (!memcmp(__w+pos,inDelimiter.__w,len*2))
+ {
+ result->push( substr(last,pos-last) );
+ pos += len;
+ last = pos;
+ }
+ else
+ pos++;
+ }
+ else if (s0)
+ while(pos+len <=length )
+ if (isSame(__w+pos,inDelimiter.__s,len))
+ {
+ result->push( substr(last,pos-last) );
+ pos += len;
+ last = pos;
+ }
+ else
+ pos++;
+ else
+ while(pos+len <=length )
+ if (isSame(inDelimiter.__w,__s+pos,len))
+ {
+ result->push( substr(last,pos-last) );
+ pos += len;
+ last = pos;
+ }
+ else
+ pos++;
+ }
+ else
+ #endif
+ {
+ while(pos+len <=length )
+ if (!strncmp(__s+pos,inDelimiter.__s,len))
+ {
+ result->push( substr(last,pos-last) );
+ pos += len;
+ last = pos;
+ }
+ else
+ pos++;
+ }
+
+ result->push( substr(last,null()) );
+
+
+ return result;
+}
+
+Dynamic CreateEmptyString() { return sConstEmptyString; }
+
+Dynamic CreateString(DynamicArray inArgs)
+{
+ if (inArgs->__length()>0)
+ return inArgs[0]->toString();
+ return String();
+}
+
+
+String String::substr(int inFirst, Dynamic inLen) const
+{
+ int len = inLen == null() ? length : inLen->__ToInt();
+ if (inFirst<0) inFirst += length;
+ if (inFirst<0) inFirst = 0;
+ if (len<0)
+ {
+ len += length;
+ // This logic matches flash ....
+ if (inFirst + len >=length)
+ len = 0;
+ }
+
+ if (len<=0 || inFirst>=length)
+ return String::emptyString;
+
+ if ((len+inFirst > length) ) len = length - inFirst;
+ if (len==0)
+ return String::emptyString;
+
+
+ #ifdef HX_SMART_STRINGS
+ if (isUTF16Encoded())
+ {
+ if (len==1)
+ return String::fromCharCode(__w[inFirst]);
+ return String( GCStringDup(__w+inFirst, len, 0), len );
+ }
+ #endif
+
+ if (len==1)
+ return String::fromCharCode(__s[inFirst]);
+
+ return String( GCStringDup(__s+inFirst, len, 0), len );
+}
+
+String String::substring(int startIndex, Dynamic inEndIndex) const
+{
+ int endIndex = inEndIndex == null() ? length : inEndIndex->__ToInt();
+ if ( endIndex < 0 ) {
+ endIndex = 0;
+ } else if ( endIndex > length ) {
+ endIndex = length;
+ }
+
+ if ( startIndex < 0 ) {
+ startIndex = 0;
+ } else if ( startIndex > length ) {
+ startIndex = length;
+ }
+
+ if ( startIndex > endIndex ) {
+ int tmp = startIndex;
+ startIndex = endIndex;
+ endIndex = tmp;
+ }
+
+ return substr( startIndex, endIndex - startIndex );
+}
+
+String String::operator+(const String &inRHS) const
+{
+ if (!__s) return HX_CSTRING("null") + inRHS;
+ if (!length)
+ {
+ if (!inRHS.__s)
+ return HX_CSTRING("null");
+ return inRHS;
+ }
+ if (!inRHS.__s) return *this + HX_CSTRING("null");
+ if (!inRHS.length) return *this;
+
+ int l = length + inRHS.length;
+
+ #ifdef HX_SMART_STRINGS
+ bool ws0 = isUTF16Encoded();
+ bool ws1 = inRHS.isUTF16Encoded();
+ if (ws0 || ws1)
+ {
+ char16_t *result = String::allocChar16Ptr(l);
+
+ if (ws0)
+ memcpy(result,__w,length*2);
+ else
+ for(int i=0;i<length;i++)
+ result[i] = __s[i];
+
+ char16_t *r2 = result + length;
+ if (ws1)
+ memcpy(r2, inRHS.__w, inRHS.length*2);
+ else
+ for(int i=0;i<inRHS.length;i++)
+ r2[i] = inRHS.__s[i];
+
+ return String(result,l);
+ }
+ #endif
+
+
+ char *result = hx::NewString(l);
+ memcpy(result,__s,length*sizeof(char));
+ memcpy(result+length,inRHS.__s,inRHS.length*sizeof(char));
+ result[l] = '\0';
+ return String(result,l);
+}
+
+
+String &String::operator+=(const String &inRHS)
+{
+ if (length==0)
+ {
+ *this = inRHS;
+ }
+ else if (inRHS.length>0)
+ {
+ int l = length + inRHS.length;
+ #ifdef HX_SMART_STRINGS
+ bool ws0 = isUTF16Encoded();
+ bool ws1 = inRHS.isUTF16Encoded();
+ if (ws0 || ws1)
+ {
+ char16_t *result = String::allocChar16Ptr(l);
+
+ if (ws0)
+ memcpy(result,__w,length*2);
+ else
+ for(int i=0;i<length;i++)
+ result[i] = __s[i];
+
+ char16_t *r2 = result + length;
+ if (ws1)
+ memcpy(r2, inRHS.__w, inRHS.length*2);
+ else
+ for(int i=0;i<inRHS.length;i++)
+ r2[i] = inRHS.__s[i];
+
+ __w = result;
+ }
+ else
+ #endif
+ {
+ char *s = hx::NewString(l);
+ memcpy(s,__s,length*sizeof(char));
+ memcpy(s+length,inRHS.__s,inRHS.length*sizeof(char));
+ __s = s;
+ }
+
+ length = l;
+ }
+ return *this;
+}
+
+#ifdef HXCPP_VISIT_ALLOCS
+#define STRING_VISIT_FUNC \
+ void __Visit(hx::VisitContext *__inCtx) { HX_VISIT_STRING(mThis.raw_ref()); }
+#else
+#define STRING_VISIT_FUNC
+#endif
+
+#define DEFINE_STRING_FUNC(func,array_list,dynamic_arg_list,arg_list,ARG_C) \
+struct __String_##func : public hx::Object \
+{ \
+ bool __IsFunction() const { return true; } \
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdClosure }; \
+ String mThis; \
+ __String_##func(const String &inThis) : mThis(inThis) { \
+ HX_OBJ_WB_NEW_MARKED_OBJECT(this); \
+ } \
+ String toString() const{ return HX_CSTRING(#func); } \
+ String __ToString() const{ return HX_CSTRING(#func); } \
+ int __GetType() const { return vtFunction; } \
+ void *__GetHandle() const { return const_cast<char *>(mThis.raw_ptr()); } \
+ int __ArgCount() const { return ARG_C; } \
+ Dynamic __Run(const Array<Dynamic> &inArgs) \
+ { \
+ return mThis.func(array_list); return Dynamic(); \
+ } \
+ Dynamic __run(dynamic_arg_list) \
+ { \
+ return mThis.func(arg_list); return Dynamic(); \
+ } \
+ void __Mark(hx::MarkContext *__inCtx) { HX_MARK_STRING(mThis.raw_ptr()); } \
+ STRING_VISIT_FUNC \
+ void __SetThis(Dynamic inThis) { mThis = inThis; } \
+}; \
+Dynamic String::func##_dyn() { return new __String_##func(*this); }
+
+
+#define DEFINE_STRING_FUNC0(func) DEFINE_STRING_FUNC(func,HX_ARR_LIST0,HX_DYNAMIC_ARG_LIST0,HX_ARG_LIST0,0)
+#define DEFINE_STRING_FUNC1(func) DEFINE_STRING_FUNC(func,HX_ARR_LIST1,HX_DYNAMIC_ARG_LIST1,HX_ARG_LIST1,1)
+#define DEFINE_STRING_FUNC2(func) DEFINE_STRING_FUNC(func,HX_ARR_LIST2,HX_DYNAMIC_ARG_LIST2,HX_ARG_LIST2,2)
+
+DEFINE_STRING_FUNC1(charAt);
+DEFINE_STRING_FUNC1(charCodeAt);
+DEFINE_STRING_FUNC2(indexOf);
+DEFINE_STRING_FUNC2(lastIndexOf);
+DEFINE_STRING_FUNC1(split);
+DEFINE_STRING_FUNC2(substr);
+DEFINE_STRING_FUNC2(substring);
+DEFINE_STRING_FUNC0(toLowerCase);
+DEFINE_STRING_FUNC0(toUpperCase);
+DEFINE_STRING_FUNC0(toString);
+
+hx::Val String::__Field(const String &inString, hx::PropertyAccess inCallProp)
+{
+ if (HX_FIELD_EQ(inString,"length")) return length;
+ if (HX_FIELD_EQ(inString,"charAt")) return charAt_dyn();
+ if (HX_FIELD_EQ(inString,"charCodeAt")) return charCodeAt_dyn();
+ if (HX_FIELD_EQ(inString,"indexOf")) return indexOf_dyn();
+ if (HX_FIELD_EQ(inString,"lastIndexOf")) return lastIndexOf_dyn();
+ if (HX_FIELD_EQ(inString,"split")) return split_dyn();
+ if (HX_FIELD_EQ(inString,"substr")) return substr_dyn();
+ if (HX_FIELD_EQ(inString,"substring")) return substring_dyn();
+ if (HX_FIELD_EQ(inString,"toLowerCase")) return toLowerCase_dyn();
+ if (HX_FIELD_EQ(inString,"toUpperCase")) return toUpperCase_dyn();
+ if (HX_FIELD_EQ(inString,"toString")) return toString_dyn();
+ return null();
+}
+
+
+static String sStringStatics[] = {
+ HX_CSTRING("fromCharCode"),
+ String(null())
+};
+static String sStringFields[] = {
+ HX_CSTRING("length"),
+ HX_CSTRING("charAt"),
+ HX_CSTRING("charCodeAt"),
+ HX_CSTRING("indexOf"),
+ HX_CSTRING("lastIndexOf"),
+ HX_CSTRING("split"),
+ HX_CSTRING("substr"),
+ HX_CSTRING("substring"),
+ HX_CSTRING("toLowerCase"),
+ HX_CSTRING("toUpperCase"),
+ HX_CSTRING("toString"),
+ String(null())
+};
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(String,fromCharCode,return )
+
+namespace hx
+{
+
+
+
+#ifndef HX_WINDOWS
+inline double _wtof(const wchar_t *inStr)
+{
+ #ifdef ANDROID
+ char buf[101];
+ int i;
+ for(i=0;i<100 && inStr[i];i++)
+ buf[i] = inStr[i];
+ buf[i] = '\0';
+ return strtod(buf, 0);
+ #else
+ return wcstod(inStr,0);
+ #endif
+}
+
+#ifdef HX_ANDROID
+int my_wtol(const wchar_t *inStr,wchar_t ** end, int inBase)
+{
+ char buf[101];
+ int i;
+ for(i=0;i<100 && inStr[i];i++)
+ buf[i] = inStr[i];
+ buf[i] = '\0';
+ char *cend = buf;
+ int result = strtol(buf,&cend,inBase);
+ *end = (wchar_t *)inStr + (cend-buf);
+ return result;
+}
+#define wcstol my_wtol
+#endif
+
+inline int _wtoi(const wchar_t *inStr)
+{
+ wchar_t *end = 0;
+ if (!inStr) return 0;
+ long result = 0;
+ if (inStr[0]=='0' && (inStr[1]=='x' || inStr[1]=='X'))
+ result = wcstol(inStr,&end,16);
+ else
+ result = wcstol(inStr,&end,10);
+ return result;
+}
+#endif
+
+
+
+class StringData : public hx::Object
+{
+public:
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdString };
+
+ inline void *operator new( size_t inSize, hx::NewObjectType inAlloc=hx::NewObjContainer)
+ { return hx::Object::operator new(inSize,inAlloc); }
+
+
+ StringData(String inValue) : mValue(inValue) {
+ HX_OBJ_WB_GET(this,mValue.raw_ref());
+ };
+
+ hx::Class __GetClass() const { return __StringClass; }
+ bool __Is(hx::Object *inClass) const { return dynamic_cast< StringData *>(inClass); }
+
+ virtual int __GetType() const { return vtString; }
+ String __ToString() const { return mValue; }
+ String toString() { return mValue; }
+ double __ToDouble() const
+ {
+ if (!mValue.raw_ptr()) return 0;
+
+ #ifdef HX_ANDROID
+ return strtod(mValue.utf8_str(),0);
+ #else
+ return atof(mValue.utf8_str());
+ #endif
+ }
+ int __length() const { return mValue.length; }
+
+ void __Mark(hx::MarkContext *__inCtx)
+ {
+ HX_MARK_MEMBER(mValue);
+ }
+
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx)
+ {
+ HX_VISIT_MEMBER(mValue);
+ }
+ #endif
+
+
+ int __ToInt() const
+ {
+ if (!mValue.raw_ptr()) return 0;
+ return atoi(mValue.utf8_str());
+ }
+
+ int __Compare(const hx::Object *inRHS) const
+ {
+ return mValue.compare( const_cast<hx::Object*>(inRHS)->toString() );
+ }
+
+ hx::Val __Field(const String &inString, hx::PropertyAccess inCallProp)
+ {
+ return mValue.__Field(inString, inCallProp);
+ }
+
+
+ String mValue;
+};
+
+
+
+
+hx::Class &GetStringClass() { return __StringClass; }
+
+} // end namespace hx
+
+hx::Object *String::__ToObject() const
+{
+ if (!__s)
+ return 0;
+
+ if (length==0)
+ {
+ return sConstEmptyString.mPtr;
+ }
+ else if (length==1)
+ {
+ #ifdef HX_SMART_STRINGS
+ int idx = isUTF16Encoded() ? __w[0] : ((unsigned char *)__s)[0];
+ #else
+ int idx = ((unsigned char *)__s)[0];
+ #endif
+
+ if (idx<=255)
+ {
+ if (sConstDynamicStrings[idx].mPtr)
+ return sConstDynamicStrings[idx].mPtr;
+
+ return sConstDynamicStrings[idx].mPtr = new (hx::NewObjConst)StringData(fromCharCode(idx));
+ }
+ }
+
+ bool isConst = __s[HX_GC_CONST_ALLOC_MARK_OFFSET] & HX_GC_CONST_ALLOC_MARK_BIT;
+ NewObjectType type = isConst ? NewObjAlloc : NewObjContainer;
+ return new (type) StringData(*this);
+}
+
+hx::Object * String::makePermanentObject() const
+{
+ return new (hx::NewObjConst)StringData(makePermanent());
+}
+
+
+
+void String::__boot()
+{
+ #ifdef HXCPP_COMBINE_STRINGS
+ InitIdent();
+ #endif
+
+ sPermanentStringSet = new StringSet();
+ GCAddRoot((hx::Object **)&sPermanentStringSet);
+
+ for(int i=0;i<256;i++)
+ safeChars[i] = i>32 && i<127;
+ unsigned char dodgy[] = { 36, 38, 43, 44, 47, 58, 59, 61, 63, 64,
+ 34, 60, 62, 35, 37, 123, 125, 124, 92, 94, 126, 91, 93, 96 };
+ for(int i=0;i<sizeof(dodgy);i++)
+ safeChars[ dodgy[i] ] = 0;
+
+ for(int c=0;c<256;c++)
+ {
+ #ifdef HX_SMART_STRINGS
+ if (c>127)
+ #endif
+ {
+ char16_t buf[20];
+ buf[0] = c;
+ buf[1] = '\0';
+ sConstStrings[c].length = 1;
+ char16_t *w = (char16_t *)InternalCreateConstBuffer(buf,2*2,true);
+ ((unsigned int *)w)[-1] |= HX_GC_STRING_CHAR16_T;
+ sConstStrings[c].__w = w;
+ fixHashPerm16(sConstStrings[c]);
+ }
+ #ifdef HX_SMART_STRINGS
+ else
+ {
+ char buf[20];
+ int utf8Len = UTF8Bytes(c);
+ char *p = buf;
+ UTF8EncodeAdvance(p,c);
+ buf[utf8Len] = '\0';
+ sConstStrings[c].__s = (char *)InternalCreateConstBuffer(buf,utf8Len+1,true);
+ sConstStrings[c].length = utf8Len;
+ }
+ #endif
+ }
+
+ sConstEmptyString.mPtr = new (hx::NewObjConst)StringData(emptyString);
+
+ Static(__StringClass) = hx::_hx_RegisterClass(HX_CSTRING("String"),TCanCast<StringData>,sStringStatics, sStringFields,
+ &CreateEmptyString, &CreateString, 0, 0, 0
+ );
+}
diff --git a/Sources/c_snikket/src/StringBuf.cpp b/Sources/c_snikket/src/StringBuf.cpp
new file mode 100644
index 0000000..de1eed6
--- /dev/null
+++ b/Sources/c_snikket/src/StringBuf.cpp
@@ -0,0 +1,219 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_StringBuf
+#include <StringBuf.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_8b63e6eaf513c097_35_new,"StringBuf","new",0xaaa8f4b4,"StringBuf.new","/usr/local/lib/haxe/std/cpp/_std/StringBuf.hx",35,0x6c227dbe)
+HX_LOCAL_STACK_FRAME(_hx_pos_8b63e6eaf513c097_37_charBufAsString,"StringBuf","charBufAsString",0x54d38cd4,"StringBuf.charBufAsString","/usr/local/lib/haxe/std/cpp/_std/StringBuf.hx",37,0x6c227dbe)
+HX_LOCAL_STACK_FRAME(_hx_pos_8b63e6eaf513c097_43_flush,"StringBuf","flush",0xc7c14418,"StringBuf.flush","/usr/local/lib/haxe/std/cpp/_std/StringBuf.hx",43,0x6c227dbe)
+HX_LOCAL_STACK_FRAME(_hx_pos_8b63e6eaf513c097_51_get_length,"StringBuf","get_length",0xe673d2db,"StringBuf.get_length","/usr/local/lib/haxe/std/cpp/_std/StringBuf.hx",51,0x6c227dbe)
+HX_LOCAL_STACK_FRAME(_hx_pos_8b63e6eaf513c097_92_toString,"StringBuf","toString",0x68f17bd8,"StringBuf.toString","/usr/local/lib/haxe/std/cpp/_std/StringBuf.hx",92,0x6c227dbe)
+
+void StringBuf_obj::__construct(){
+ HX_STACKFRAME(&_hx_pos_8b63e6eaf513c097_35_new)
+ }
+
+Dynamic StringBuf_obj::__CreateEmpty() { return new StringBuf_obj; }
+
+void *StringBuf_obj::_hx_vtable = 0;
+
+Dynamic StringBuf_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< StringBuf_obj > _hx_result = new StringBuf_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool StringBuf_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x2cc74002;
+}
+
+::String StringBuf_obj::charBufAsString(){
+ HX_STACKFRAME(&_hx_pos_8b63e6eaf513c097_37_charBufAsString)
+HXLINE( 38) int len = this->charBuf->length;
+HXLINE( 39) this->charBuf->push(0);
+HXLINE( 40) ::cpp::Pointer< char > inPtr = ( (::cpp::Pointer< char >)(::cpp::Pointer_obj::arrayElem(this->charBuf,0)) );
+HXDLIN( 40) return ::String(inPtr->ptr,len);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(StringBuf_obj,charBufAsString,return )
+
+void StringBuf_obj::flush(){
+ HX_STACKFRAME(&_hx_pos_8b63e6eaf513c097_43_flush)
+HXLINE( 44) if (::hx::IsNull( this->b )) {
+HXLINE( 45) this->b = ::Array_obj< ::String >::__new(1)->init(0,this->charBufAsString());
+ }
+ else {
+HXLINE( 47) ::Array< ::String > _hx_tmp = this->b;
+HXDLIN( 47) _hx_tmp->push(this->charBufAsString());
+ }
+HXLINE( 48) this->charBuf = null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(StringBuf_obj,flush,(void))
+
+int StringBuf_obj::get_length(){
+ HX_STACKFRAME(&_hx_pos_8b63e6eaf513c097_51_get_length)
+HXLINE( 52) int len = 0;
+HXLINE( 53) if (::hx::IsNotNull( this->charBuf )) {
+HXLINE( 54) len = this->charBuf->length;
+ }
+HXLINE( 55) if (::hx::IsNotNull( this->b )) {
+HXLINE( 56) int _g = 0;
+HXDLIN( 56) ::Array< ::String > _g1 = this->b;
+HXDLIN( 56) while((_g < _g1->length)){
+HXLINE( 56) ::String s = _g1->__get(_g);
+HXDLIN( 56) _g = (_g + 1);
+HXLINE( 57) int len1;
+HXDLIN( 57) if (::hx::IsNull( s )) {
+HXLINE( 57) len1 = 4;
+ }
+ else {
+HXLINE( 57) len1 = s.length;
+ }
+HXDLIN( 57) len = (len + len1);
+ }
+ }
+HXLINE( 58) return len;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(StringBuf_obj,get_length,return )
+
+::String StringBuf_obj::toString(){
+ HX_STACKFRAME(&_hx_pos_8b63e6eaf513c097_92_toString)
+HXLINE( 93) if (::hx::IsNotNull( this->charBuf )) {
+HXLINE( 94) this->flush();
+ }
+HXLINE( 95) bool _hx_tmp;
+HXDLIN( 95) if (::hx::IsNotNull( this->b )) {
+HXLINE( 95) _hx_tmp = (this->b->length == 0);
+ }
+ else {
+HXLINE( 95) _hx_tmp = true;
+ }
+HXDLIN( 95) if (_hx_tmp) {
+HXLINE( 96) return HX_("",00,00,00,00);
+ }
+HXLINE( 97) if ((this->b->length == 1)) {
+HXLINE( 98) return this->b->__get(0);
+ }
+HXLINE( 99) return this->b->join(HX_("",00,00,00,00));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(StringBuf_obj,toString,return )
+
+
+StringBuf_obj::StringBuf_obj()
+{
+}
+
+void StringBuf_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(StringBuf);
+ HX_MARK_MEMBER_NAME(b,"b");
+ HX_MARK_MEMBER_NAME(charBuf,"charBuf");
+ HX_MARK_END_CLASS();
+}
+
+void StringBuf_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(b,"b");
+ HX_VISIT_MEMBER_NAME(charBuf,"charBuf");
+}
+
+::hx::Val StringBuf_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 1:
+ if (HX_FIELD_EQ(inName,"b") ) { return ::hx::Val( b ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"flush") ) { return ::hx::Val( flush_dyn() ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"length") ) { if (inCallProp == ::hx::paccAlways) return ::hx::Val( get_length() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"charBuf") ) { return ::hx::Val( charBuf ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"toString") ) { return ::hx::Val( toString_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"get_length") ) { return ::hx::Val( get_length_dyn() ); }
+ break;
+ case 15:
+ if (HX_FIELD_EQ(inName,"charBufAsString") ) { return ::hx::Val( charBufAsString_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val StringBuf_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 1:
+ if (HX_FIELD_EQ(inName,"b") ) { b=inValue.Cast< ::Array< ::String > >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"charBuf") ) { charBuf=inValue.Cast< ::Array< char > >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void StringBuf_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("b",62,00,00,00));
+ outFields->push(HX_("length",e6,94,07,9f));
+ outFields->push(HX_("charBuf",fd,85,55,cf));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo StringBuf_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::Array< ::String > */ ,(int)offsetof(StringBuf_obj,b),HX_("b",62,00,00,00)},
+ {::hx::fsObject /* ::Array< char > */ ,(int)offsetof(StringBuf_obj,charBuf),HX_("charBuf",fd,85,55,cf)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *StringBuf_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String StringBuf_obj_sMemberFields[] = {
+ HX_("b",62,00,00,00),
+ HX_("charBuf",fd,85,55,cf),
+ HX_("charBufAsString",80,3a,2f,0a),
+ HX_("flush",c4,62,9b,02),
+ HX_("get_length",af,04,8f,8f),
+ HX_("toString",ac,d0,6e,38),
+ ::String(null()) };
+
+::hx::Class StringBuf_obj::__mClass;
+
+void StringBuf_obj::__register()
+{
+ StringBuf_obj _hx_dummy;
+ StringBuf_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("StringBuf",c2,ca,83,69);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(StringBuf_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< StringBuf_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = StringBuf_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = StringBuf_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
diff --git a/Sources/c_snikket/src/StringTools.cpp b/Sources/c_snikket/src/StringTools.cpp
new file mode 100644
index 0000000..6f05edb
--- /dev/null
+++ b/Sources/c_snikket/src/StringTools.cpp
@@ -0,0 +1,494 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_StringBuf
+#include <StringBuf.h>
+#endif
+#ifndef INCLUDED_StringTools
+#include <StringTools.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_0e615b5827179e15_50_urlEncode,"StringTools","urlEncode",0x06afdce1,"StringTools.urlEncode","/usr/local/lib/haxe/std/StringTools.hx",50,0x3f930611)
+HX_LOCAL_STACK_FRAME(_hx_pos_0e615b5827179e15_158_htmlEscape,"StringTools","htmlEscape",0x0e1a5dd0,"StringTools.htmlEscape","/usr/local/lib/haxe/std/StringTools.hx",158,0x3f930611)
+static const ::String _hx_array_data_0363db6a_3[] = {
+ HX_(""",2c,d9,81,8f),
+};
+static const ::String _hx_array_data_0363db6a_4[] = {
+ HX_("&",dd,d4,aa,21),
+};
+static const ::String _hx_array_data_0363db6a_5[] = {
+ HX_("'",62,26,77,78),
+};
+static const ::String _hx_array_data_0363db6a_6[] = {
+ HX_("<",4d,74,70,19),
+};
+static const ::String _hx_array_data_0363db6a_7[] = {
+ HX_(">",08,a9,6c,19),
+};
+HX_LOCAL_STACK_FRAME(_hx_pos_0e615b5827179e15_240_startsWith,"StringTools","startsWith",0x5f4e6efb,"StringTools.startsWith","/usr/local/lib/haxe/std/StringTools.hx",240,0x3f930611)
+HX_LOCAL_STACK_FRAME(_hx_pos_0e615b5827179e15_251_endsWith,"StringTools","endsWith",0x0eb5bfe2,"StringTools.endsWith","/usr/local/lib/haxe/std/StringTools.hx",251,0x3f930611)
+HX_LOCAL_STACK_FRAME(_hx_pos_0e615b5827179e15_282_isSpace,"StringTools","isSpace",0xe0290778,"StringTools.isSpace","/usr/local/lib/haxe/std/StringTools.hx",282,0x3f930611)
+HX_LOCAL_STACK_FRAME(_hx_pos_0e615b5827179e15_300_ltrim,"StringTools","ltrim",0x24d2234a,"StringTools.ltrim","/usr/local/lib/haxe/std/StringTools.hx",300,0x3f930611)
+HX_LOCAL_STACK_FRAME(_hx_pos_0e615b5827179e15_325_rtrim,"StringTools","rtrim",0x99399e50,"StringTools.rtrim","/usr/local/lib/haxe/std/StringTools.hx",325,0x3f930611)
+HX_LOCAL_STACK_FRAME(_hx_pos_0e615b5827179e15_353_trim,"StringTools","trim",0x2908d066,"StringTools.trim","/usr/local/lib/haxe/std/StringTools.hx",353,0x3f930611)
+HX_LOCAL_STACK_FRAME(_hx_pos_0e615b5827179e15_369_lpad,"StringTools","lpad",0x23bd8feb,"StringTools.lpad","/usr/local/lib/haxe/std/StringTools.hx",369,0x3f930611)
+HX_LOCAL_STACK_FRAME(_hx_pos_0e615b5827179e15_428_replace,"StringTools","replace",0x6d651f30,"StringTools.replace","/usr/local/lib/haxe/std/StringTools.hx",428,0x3f930611)
+HX_LOCAL_STACK_FRAME(_hx_pos_0e615b5827179e15_438_hex,"StringTools","hex",0xd91debd7,"StringTools.hex","/usr/local/lib/haxe/std/StringTools.hx",438,0x3f930611)
+
+void StringTools_obj::__construct() { }
+
+Dynamic StringTools_obj::__CreateEmpty() { return new StringTools_obj; }
+
+void *StringTools_obj::_hx_vtable = 0;
+
+Dynamic StringTools_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< StringTools_obj > _hx_result = new StringTools_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool StringTools_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x084f186e;
+}
+
+::String StringTools_obj::urlEncode(::String s){
+ HX_STACKFRAME(&_hx_pos_0e615b5827179e15_50_urlEncode)
+HXDLIN( 50) return ( (::String)(s.__URLEncode()) );
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(StringTools_obj,urlEncode,return )
+
+::String StringTools_obj::htmlEscape(::String s, ::Dynamic quotes){
+ HX_GC_STACKFRAME(&_hx_pos_0e615b5827179e15_158_htmlEscape)
+HXLINE( 159) ::StringBuf buf = ::StringBuf_obj::__alloc( HX_CTX );
+HXLINE( 160) {
+HXLINE( 160) int _g_offset = 0;
+HXDLIN( 160) ::String _g_s = s;
+HXDLIN( 160) while((_g_offset < _g_s.length)){
+HXLINE( 160) ::String s1 = _g_s;
+HXDLIN( 160) _g_offset = (_g_offset + 1);
+HXDLIN( 160) int index = (_g_offset - 1);
+HXDLIN( 160) int c = s1.cca(index);
+HXDLIN( 160) bool _hx_tmp;
+HXDLIN( 160) if ((c >= 55296)) {
+HXLINE( 160) _hx_tmp = (c <= 56319);
+ }
+ else {
+HXLINE( 160) _hx_tmp = false;
+ }
+HXDLIN( 160) if (_hx_tmp) {
+HXLINE( 639) c = (((c - 55232) << 10) | (s1.cca((index + 1)) & 1023));
+ }
+HXLINE( 160) int c1 = c;
+HXDLIN( 160) if ((c1 >= 65536)) {
+HXLINE( 160) _g_offset = (_g_offset + 1);
+ }
+HXDLIN( 160) int code = c1;
+HXLINE( 161) switch((int)(code)){
+ case (int)34: {
+HXLINE( 168) if (( (bool)(quotes) )) {
+HXLINE( 169) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 169) buf->flush();
+ }
+HXDLIN( 169) if (::hx::IsNull( buf->b )) {
+HXLINE( 169) buf->b = ::Array_obj< ::String >::fromData( _hx_array_data_0363db6a_3,1);
+ }
+ else {
+HXLINE( 169) buf->b->push(HX_(""",2c,d9,81,8f));
+ }
+ }
+ else {
+HXLINE( 173) if ((code >= 127)) {
+HXLINE( 173) ::String x = ::String::fromCharCode(code);
+HXDLIN( 173) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 173) buf->flush();
+ }
+HXDLIN( 173) if (::hx::IsNull( buf->b )) {
+HXLINE( 173) buf->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x));
+ }
+ else {
+HXLINE( 173) ::Array< ::String > buf1 = buf->b;
+HXDLIN( 173) buf1->push(::Std_obj::string(x));
+ }
+ }
+ else {
+HXLINE( 173) if (::hx::IsNull( buf->charBuf )) {
+HXLINE( 173) buf->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 173) buf->charBuf->push(code);
+ }
+ }
+ }
+ break;
+ case (int)38: {
+HXLINE( 163) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 163) buf->flush();
+ }
+HXDLIN( 163) if (::hx::IsNull( buf->b )) {
+HXLINE( 163) buf->b = ::Array_obj< ::String >::fromData( _hx_array_data_0363db6a_4,1);
+ }
+ else {
+HXLINE( 163) buf->b->push(HX_("&",dd,d4,aa,21));
+ }
+ }
+ break;
+ case (int)39: {
+HXLINE( 170) if (( (bool)(quotes) )) {
+HXLINE( 171) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 171) buf->flush();
+ }
+HXDLIN( 171) if (::hx::IsNull( buf->b )) {
+HXLINE( 171) buf->b = ::Array_obj< ::String >::fromData( _hx_array_data_0363db6a_5,1);
+ }
+ else {
+HXLINE( 171) buf->b->push(HX_("'",62,26,77,78));
+ }
+ }
+ else {
+HXLINE( 173) if ((code >= 127)) {
+HXLINE( 173) ::String x1 = ::String::fromCharCode(code);
+HXDLIN( 173) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 173) buf->flush();
+ }
+HXDLIN( 173) if (::hx::IsNull( buf->b )) {
+HXLINE( 173) buf->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x1));
+ }
+ else {
+HXLINE( 173) ::Array< ::String > buf2 = buf->b;
+HXDLIN( 173) buf2->push(::Std_obj::string(x1));
+ }
+ }
+ else {
+HXLINE( 173) if (::hx::IsNull( buf->charBuf )) {
+HXLINE( 173) buf->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 173) buf->charBuf->push(code);
+ }
+ }
+ }
+ break;
+ case (int)60: {
+HXLINE( 165) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 165) buf->flush();
+ }
+HXDLIN( 165) if (::hx::IsNull( buf->b )) {
+HXLINE( 165) buf->b = ::Array_obj< ::String >::fromData( _hx_array_data_0363db6a_6,1);
+ }
+ else {
+HXLINE( 165) buf->b->push(HX_("<",4d,74,70,19));
+ }
+ }
+ break;
+ case (int)62: {
+HXLINE( 167) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 167) buf->flush();
+ }
+HXDLIN( 167) if (::hx::IsNull( buf->b )) {
+HXLINE( 167) buf->b = ::Array_obj< ::String >::fromData( _hx_array_data_0363db6a_7,1);
+ }
+ else {
+HXLINE( 167) buf->b->push(HX_(">",08,a9,6c,19));
+ }
+ }
+ break;
+ default:{
+HXLINE( 173) if ((code >= 127)) {
+HXLINE( 173) ::String x2 = ::String::fromCharCode(code);
+HXDLIN( 173) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 173) buf->flush();
+ }
+HXDLIN( 173) if (::hx::IsNull( buf->b )) {
+HXLINE( 173) buf->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x2));
+ }
+ else {
+HXLINE( 173) ::Array< ::String > buf3 = buf->b;
+HXDLIN( 173) buf3->push(::Std_obj::string(x2));
+ }
+ }
+ else {
+HXLINE( 173) if (::hx::IsNull( buf->charBuf )) {
+HXLINE( 173) buf->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 173) buf->charBuf->push(code);
+ }
+ }
+ }
+ }
+ }
+HXLINE( 176) return buf->toString();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(StringTools_obj,htmlEscape,return )
+
+bool StringTools_obj::startsWith(::String s,::String start){
+ HX_STACKFRAME(&_hx_pos_0e615b5827179e15_240_startsWith)
+HXDLIN( 240) if ((s.length >= start.length)) {
+HXDLIN( 240) return (s.lastIndexOf(start,0) == 0);
+ }
+ else {
+HXDLIN( 240) return false;
+ }
+HXDLIN( 240) return false;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(StringTools_obj,startsWith,return )
+
+bool StringTools_obj::endsWith(::String s,::String end){
+ HX_STACKFRAME(&_hx_pos_0e615b5827179e15_251_endsWith)
+HXLINE( 267) int elen = end.length;
+HXLINE( 268) int slen = s.length;
+HXLINE( 269) if ((slen >= elen)) {
+HXLINE( 269) return (s.indexOf(end,(slen - elen)) == (slen - elen));
+ }
+ else {
+HXLINE( 269) return false;
+ }
+HXDLIN( 269) return false;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(StringTools_obj,endsWith,return )
+
+bool StringTools_obj::isSpace(::String s,int pos){
+ HX_STACKFRAME(&_hx_pos_0e615b5827179e15_282_isSpace)
+HXLINE( 287) ::Dynamic c = s.charCodeAt(pos);
+HXLINE( 288) bool _hx_tmp;
+HXDLIN( 288) if (::hx::IsGreater( c,8 )) {
+HXLINE( 288) _hx_tmp = ::hx::IsLess( c,14 );
+ }
+ else {
+HXLINE( 288) _hx_tmp = false;
+ }
+HXDLIN( 288) if (!(_hx_tmp)) {
+HXLINE( 288) return ::hx::IsEq( c,32 );
+ }
+ else {
+HXLINE( 288) return true;
+ }
+HXDLIN( 288) return false;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(StringTools_obj,isSpace,return )
+
+::String StringTools_obj::ltrim(::String s){
+ HX_STACKFRAME(&_hx_pos_0e615b5827179e15_300_ltrim)
+HXLINE( 304) int l = s.length;
+HXLINE( 305) int r = 0;
+HXLINE( 306) while(true){
+HXLINE( 306) bool _hx_tmp;
+HXDLIN( 306) if ((r < l)) {
+HXLINE( 306) _hx_tmp = ::StringTools_obj::isSpace(s,r);
+ }
+ else {
+HXLINE( 306) _hx_tmp = false;
+ }
+HXDLIN( 306) if (!(_hx_tmp)) {
+HXLINE( 306) goto _hx_goto_11;
+ }
+HXLINE( 307) r = (r + 1);
+ }
+ _hx_goto_11:;
+HXLINE( 309) if ((r > 0)) {
+HXLINE( 310) return s.substr(r,(l - r));
+ }
+ else {
+HXLINE( 312) return s;
+ }
+HXLINE( 309) return null();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(StringTools_obj,ltrim,return )
+
+::String StringTools_obj::rtrim(::String s){
+ HX_STACKFRAME(&_hx_pos_0e615b5827179e15_325_rtrim)
+HXLINE( 329) int l = s.length;
+HXLINE( 330) int r = 0;
+HXLINE( 331) while(true){
+HXLINE( 331) bool _hx_tmp;
+HXDLIN( 331) if ((r < l)) {
+HXLINE( 331) _hx_tmp = ::StringTools_obj::isSpace(s,((l - r) - 1));
+ }
+ else {
+HXLINE( 331) _hx_tmp = false;
+ }
+HXDLIN( 331) if (!(_hx_tmp)) {
+HXLINE( 331) goto _hx_goto_13;
+ }
+HXLINE( 332) r = (r + 1);
+ }
+ _hx_goto_13:;
+HXLINE( 334) if ((r > 0)) {
+HXLINE( 335) return s.substr(0,(l - r));
+ }
+ else {
+HXLINE( 337) return s;
+ }
+HXLINE( 334) return null();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(StringTools_obj,rtrim,return )
+
+::String StringTools_obj::trim(::String s){
+ HX_STACKFRAME(&_hx_pos_0e615b5827179e15_353_trim)
+HXDLIN( 353) return ::StringTools_obj::ltrim(::StringTools_obj::rtrim(s));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(StringTools_obj,trim,return )
+
+::String StringTools_obj::lpad(::String s,::String c,int l){
+ HX_GC_STACKFRAME(&_hx_pos_0e615b5827179e15_369_lpad)
+HXLINE( 370) if ((c.length <= 0)) {
+HXLINE( 371) return s;
+ }
+HXLINE( 373) ::StringBuf buf = ::StringBuf_obj::__alloc( HX_CTX );
+HXLINE( 374) l = (l - s.length);
+HXLINE( 375) while((buf->get_length() < l)){
+HXLINE( 376) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 376) buf->flush();
+ }
+HXDLIN( 376) if (::hx::IsNull( buf->b )) {
+HXLINE( 376) buf->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(c));
+ }
+ else {
+HXLINE( 376) ::Array< ::String > buf1 = buf->b;
+HXDLIN( 376) buf1->push(::Std_obj::string(c));
+ }
+ }
+HXLINE( 378) {
+HXLINE( 378) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 378) buf->flush();
+ }
+HXDLIN( 378) if (::hx::IsNull( buf->b )) {
+HXLINE( 378) buf->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(s));
+ }
+ else {
+HXLINE( 378) ::Array< ::String > buf2 = buf->b;
+HXDLIN( 378) buf2->push(::Std_obj::string(s));
+ }
+ }
+HXLINE( 379) return buf->toString();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC3(StringTools_obj,lpad,return )
+
+::String StringTools_obj::replace(::String s,::String sub,::String by){
+ HX_STACKFRAME(&_hx_pos_0e615b5827179e15_428_replace)
+HXDLIN( 428) return s.split(sub)->join(by);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC3(StringTools_obj,replace,return )
+
+::String StringTools_obj::hex(int n, ::Dynamic digits){
+ HX_STACKFRAME(&_hx_pos_0e615b5827179e15_438_hex)
+HXLINE( 444) ::String s = HX_("",00,00,00,00);
+HXLINE( 445) ::String hexChars = HX_("0123456789ABCDEF",68,2a,58,a2);
+HXLINE( 446) do {
+HXLINE( 447) s = (hexChars.charAt((n & 15)) + s);
+HXLINE( 448) n = ::hx::UShr(n,4);
+ } while((n > 0));
+;
+HXLINE( 459) if (::hx::IsNotNull( digits )) {
+HXLINE( 460) while(::hx::IsLess( s.length,digits )){
+HXLINE( 461) s = (HX_("0",30,00,00,00) + s);
+ }
+ }
+HXLINE( 463) return s;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(StringTools_obj,hex,return )
+
+
+StringTools_obj::StringTools_obj()
+{
+}
+
+bool StringTools_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"hex") ) { outValue = hex_dyn(); return true; }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"trim") ) { outValue = trim_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"lpad") ) { outValue = lpad_dyn(); return true; }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"ltrim") ) { outValue = ltrim_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"rtrim") ) { outValue = rtrim_dyn(); return true; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"isSpace") ) { outValue = isSpace_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"replace") ) { outValue = replace_dyn(); return true; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"endsWith") ) { outValue = endsWith_dyn(); return true; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"urlEncode") ) { outValue = urlEncode_dyn(); return true; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"htmlEscape") ) { outValue = htmlEscape_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"startsWith") ) { outValue = startsWith_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *StringTools_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *StringTools_obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class StringTools_obj::__mClass;
+
+static ::String StringTools_obj_sStaticFields[] = {
+ HX_("urlEncode",e5,4e,52,9a),
+ HX_("htmlEscape",4c,af,9b,a8),
+ HX_("startsWith",77,c0,cf,f9),
+ HX_("endsWith",5e,7a,b6,db),
+ HX_("isSpace",7c,30,ec,1d),
+ HX_("ltrim",4e,43,4a,7c),
+ HX_("rtrim",54,be,b1,f0),
+ HX_("trim",e2,9c,03,4d),
+ HX_("lpad",67,5c,b8,47),
+ HX_("replace",34,48,28,ab),
+ HX_("hex",db,42,4f,00),
+ ::String(null())
+};
+
+void StringTools_obj::__register()
+{
+ StringTools_obj _hx_dummy;
+ StringTools_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("StringTools",6a,db,63,03);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &StringTools_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(StringTools_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< StringTools_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = StringTools_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = StringTools_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
diff --git a/Sources/c_snikket/src/Sys.cpp b/Sources/c_snikket/src/Sys.cpp
new file mode 100644
index 0000000..39a5076
--- /dev/null
+++ b/Sources/c_snikket/src/Sys.cpp
@@ -0,0 +1,124 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Sys
+#include <Sys.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_39f5eab4124248fe_59_getEnv,"Sys","getEnv",0xd9e05658,"Sys.getEnv","/usr/local/lib/haxe/std/cpp/_std/Sys.hx",59,0xd23c22f3)
+HX_LOCAL_STACK_FRAME(_hx_pos_39f5eab4124248fe_79_getCwd,"Sys","getCwd",0xd9ded99b,"Sys.getCwd","/usr/local/lib/haxe/std/cpp/_std/Sys.hx",79,0xd23c22f3)
+HX_LOCAL_STACK_FRAME(_hx_pos_39f5eab4124248fe_87_systemName,"Sys","systemName",0xbea5b6bb,"Sys.systemName","/usr/local/lib/haxe/std/cpp/_std/Sys.hx",87,0xd23c22f3)
+HX_LOCAL_STACK_FRAME(_hx_pos_39f5eab4124248fe_113_time,"Sys","time",0xf7761b2e,"Sys.time","/usr/local/lib/haxe/std/cpp/_std/Sys.hx",113,0xd23c22f3)
+
+void Sys_obj::__construct() { }
+
+Dynamic Sys_obj::__CreateEmpty() { return new Sys_obj; }
+
+void *Sys_obj::_hx_vtable = 0;
+
+Dynamic Sys_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Sys_obj > _hx_result = new Sys_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool Sys_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x7ee3a981;
+}
+
+::String Sys_obj::getEnv(::String s){
+ HX_STACKFRAME(&_hx_pos_39f5eab4124248fe_59_getEnv)
+HXLINE( 60) ::String v = _hx_std_get_env(s);
+HXLINE( 61) if (::hx::IsNull( v )) {
+HXLINE( 62) return null();
+ }
+HXLINE( 63) return v;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Sys_obj,getEnv,return )
+
+::String Sys_obj::getCwd(){
+ HX_STACKFRAME(&_hx_pos_39f5eab4124248fe_79_getCwd)
+HXDLIN( 79) return _hx_std_get_cwd();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC0(Sys_obj,getCwd,return )
+
+::String Sys_obj::systemName(){
+ HX_STACKFRAME(&_hx_pos_39f5eab4124248fe_87_systemName)
+HXDLIN( 87) return _hx_std_sys_string();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC0(Sys_obj,systemName,return )
+
+Float Sys_obj::time(){
+ HX_STACKFRAME(&_hx_pos_39f5eab4124248fe_113_time)
+HXDLIN( 113) return _hx_std_sys_time();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC0(Sys_obj,time,return )
+
+
+Sys_obj::Sys_obj()
+{
+}
+
+bool Sys_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"time") ) { outValue = time_dyn(); return true; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"getEnv") ) { outValue = getEnv_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"getCwd") ) { outValue = getCwd_dyn(); return true; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"systemName") ) { outValue = systemName_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *Sys_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *Sys_obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class Sys_obj::__mClass;
+
+static ::String Sys_obj_sStaticFields[] = {
+ HX_("getEnv",f7,3c,1c,a3),
+ HX_("getCwd",3a,c0,1a,a3),
+ HX_("systemName",da,d8,82,f7),
+ HX_("time",0d,cc,fc,4c),
+ ::String(null())
+};
+
+void Sys_obj::__register()
+{
+ Sys_obj _hx_dummy;
+ Sys_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("Sys",ed,64,3f,00);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Sys_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Sys_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< Sys_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Sys_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Sys_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
diff --git a/Sources/c_snikket/src/Type.cpp b/Sources/c_snikket/src/Type.cpp
new file mode 100644
index 0000000..bc5cd54
--- /dev/null
+++ b/Sources/c_snikket/src/Type.cpp
@@ -0,0 +1,199 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_Type
+#include <Type.h>
+#endif
+#ifndef INCLUDED_ValueType
+#include <ValueType.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_6ebc4c1d0351a436_36_getClass,"Type","getClass",0xc4e49bd6,"Type.getClass","/usr/local/lib/haxe/std/cpp/_std/Type.hx",36,0xb5f2d6e2)
+HX_LOCAL_STACK_FRAME(_hx_pos_6ebc4c1d0351a436_61_getClassName,"Type","getClassName",0x8e66dd41,"Type.getClassName","/usr/local/lib/haxe/std/cpp/_std/Type.hx",61,0xb5f2d6e2)
+HX_LOCAL_STACK_FRAME(_hx_pos_6ebc4c1d0351a436_111_getInstanceFields,"Type","getInstanceFields",0xe970f890,"Type.getInstanceFields","/usr/local/lib/haxe/std/cpp/_std/Type.hx",111,0xb5f2d6e2)
+HX_LOCAL_STACK_FRAME(_hx_pos_6ebc4c1d0351a436_124_typeof,"Type","typeof",0xd6c51d65,"Type.typeof","/usr/local/lib/haxe/std/cpp/_std/Type.hx",124,0xb5f2d6e2)
+HX_LOCAL_STACK_FRAME(_hx_pos_6ebc4c1d0351a436_158_enumParameters,"Type","enumParameters",0xf9e1b41f,"Type.enumParameters","/usr/local/lib/haxe/std/cpp/_std/Type.hx",158,0xb5f2d6e2)
+
+void Type_obj::__construct() { }
+
+Dynamic Type_obj::__CreateEmpty() { return new Type_obj; }
+
+void *Type_obj::_hx_vtable = 0;
+
+Dynamic Type_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Type_obj > _hx_result = new Type_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool Type_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x0c3514fe;
+}
+
+::hx::Class Type_obj::getClass( ::Dynamic o){
+ HX_STACKFRAME(&_hx_pos_6ebc4c1d0351a436_36_getClass)
+HXLINE( 37) bool _hx_tmp;
+HXDLIN( 37) if (::hx::IsNotNull( o )) {
+HXLINE( 37) _hx_tmp = !(::Reflect_obj::isObject(o));
+ }
+ else {
+HXLINE( 37) _hx_tmp = true;
+ }
+HXDLIN( 37) if (_hx_tmp) {
+HXLINE( 38) return null();
+ }
+HXLINE( 39) ::Dynamic c = o->__GetClass();
+HXLINE( 40) ::String _hx_switch_0 = ( (::String)(c->toString()) );
+ if ( (_hx_switch_0==HX_("Class",18,e8,85,db)) ){
+HXLINE( 44) return null();
+HXDLIN( 44) goto _hx_goto_0;
+ }
+ if ( (_hx_switch_0==HX_("__Anon",8c,1a,43,da)) ){
+HXLINE( 42) return null();
+HXDLIN( 42) goto _hx_goto_0;
+ }
+ _hx_goto_0:;
+HXLINE( 46) return c;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Type_obj,getClass,return )
+
+::String Type_obj::getClassName(::hx::Class c){
+ HX_STACKFRAME(&_hx_pos_6ebc4c1d0351a436_61_getClassName)
+HXLINE( 62) if (::hx::IsNull( c )) {
+HXLINE( 63) return null();
+ }
+HXLINE( 64) return c->mName;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Type_obj,getClassName,return )
+
+::Array< ::String > Type_obj::getInstanceFields(::hx::Class c){
+ HX_STACKFRAME(&_hx_pos_6ebc4c1d0351a436_111_getInstanceFields)
+HXDLIN( 111) return ( (::Array< ::String >)(c->GetInstanceFields()) );
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Type_obj,getInstanceFields,return )
+
+ ::ValueType Type_obj::_hx_typeof( ::Dynamic v){
+ HX_STACKFRAME(&_hx_pos_6ebc4c1d0351a436_124_typeof)
+HXLINE( 125) if (::hx::IsNull( v )) {
+HXLINE( 126) return ::ValueType_obj::TNull_dyn();
+ }
+HXLINE( 127) int t = ( (int)(v->__GetType()) );
+HXLINE( 128) switch((int)(t)){
+ case (int)1: {
+HXLINE( 134) return ::ValueType_obj::TFloat_dyn();
+ }
+ break;
+ case (int)2: {
+HXLINE( 130) return ::ValueType_obj::TBool_dyn();
+ }
+ break;
+ case (int)4: {
+HXLINE( 138) return ::ValueType_obj::TObject_dyn();
+ }
+ break;
+ case (int)6: {
+HXLINE( 136) return ::ValueType_obj::TFunction_dyn();
+ }
+ break;
+ case (int)7: {
+HXLINE( 140) return ::ValueType_obj::TEnum(v->__GetClass());
+ }
+ break;
+ case (int)255: {
+HXLINE( 132) return ::ValueType_obj::TInt_dyn();
+ }
+ break;
+ default:{
+HXLINE( 142) return ::ValueType_obj::TClass(v->__GetClass());
+ }
+ }
+HXLINE( 128) return null();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Type_obj,_hx_typeof,return )
+
+::cpp::VirtualArray Type_obj::enumParameters( ::Dynamic e){
+ HX_STACKFRAME(&_hx_pos_6ebc4c1d0351a436_158_enumParameters)
+HXLINE( 159) hx::EnumBase value = ( ( hx::EnumBase)(e) );
+HXLINE( 160) return value->_hx_getParameters();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Type_obj,enumParameters,return )
+
+
+Type_obj::Type_obj()
+{
+}
+
+bool Type_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 6:
+ if (HX_FIELD_EQ(inName,"typeof") ) { outValue = _hx_typeof_dyn(); return true; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"getClass") ) { outValue = getClass_dyn(); return true; }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"getClassName") ) { outValue = getClassName_dyn(); return true; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"enumParameters") ) { outValue = enumParameters_dyn(); return true; }
+ break;
+ case 17:
+ if (HX_FIELD_EQ(inName,"getInstanceFields") ) { outValue = getInstanceFields_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *Type_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *Type_obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class Type_obj::__mClass;
+
+static ::String Type_obj_sStaticFields[] = {
+ HX_("getClass",c2,87,2f,a8),
+ HX_("getClassName",2d,2f,94,eb),
+ HX_("getInstanceFields",24,2f,97,ed),
+ HX_("typeof",51,f6,36,57),
+ HX_("enumParameters",0b,59,78,fa),
+ ::String(null())
+};
+
+void Type_obj::__register()
+{
+ Type_obj _hx_dummy;
+ Type_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("Type",da,1e,e2,37);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Type_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Type_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< Type_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Type_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Type_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
diff --git a/Sources/c_snikket/src/ValueType.cpp b/Sources/c_snikket/src/ValueType.cpp
new file mode 100644
index 0000000..f8f6801
--- /dev/null
+++ b/Sources/c_snikket/src/ValueType.cpp
@@ -0,0 +1,138 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_ValueType
+#include <ValueType.h>
+#endif
+
+::ValueType ValueType_obj::TBool;
+
+::ValueType ValueType_obj::TClass(::hx::Class c)
+{
+ return ::hx::CreateEnum< ValueType_obj >(HX_("TClass",44,37,80,71),6,1)->_hx_init(0,c);
+}
+
+::ValueType ValueType_obj::TEnum(::hx::Class e)
+{
+ return ::hx::CreateEnum< ValueType_obj >(HX_("TEnum",75,51,98,8b),7,1)->_hx_init(0,e);
+}
+
+::ValueType ValueType_obj::TFloat;
+
+::ValueType ValueType_obj::TFunction;
+
+::ValueType ValueType_obj::TInt;
+
+::ValueType ValueType_obj::TNull;
+
+::ValueType ValueType_obj::TObject;
+
+::ValueType ValueType_obj::TUnknown;
+
+bool ValueType_obj::__GetStatic(const ::String &inName, ::Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ if (inName==HX_("TBool",9e,6a,9d,89)) { outValue = ValueType_obj::TBool; return true; }
+ if (inName==HX_("TClass",44,37,80,71)) { outValue = ValueType_obj::TClass_dyn(); return true; }
+ if (inName==HX_("TEnum",75,51,98,8b)) { outValue = ValueType_obj::TEnum_dyn(); return true; }
+ if (inName==HX_("TFloat",a8,84,be,2b)) { outValue = ValueType_obj::TFloat; return true; }
+ if (inName==HX_("TFunction",8c,db,3a,25)) { outValue = ValueType_obj::TFunction; return true; }
+ if (inName==HX_("TInt",fb,b0,bd,37)) { outValue = ValueType_obj::TInt; return true; }
+ if (inName==HX_("TNull",fb,84,90,91)) { outValue = ValueType_obj::TNull; return true; }
+ if (inName==HX_("TObject",33,ea,de,ee)) { outValue = ValueType_obj::TObject; return true; }
+ if (inName==HX_("TUnknown",96,bd,59,73)) { outValue = ValueType_obj::TUnknown; return true; }
+ return super::__GetStatic(inName, outValue, inCallProp);
+}
+
+HX_DEFINE_CREATE_ENUM(ValueType_obj)
+
+int ValueType_obj::__FindIndex(::String inName)
+{
+ if (inName==HX_("TBool",9e,6a,9d,89)) return 3;
+ if (inName==HX_("TClass",44,37,80,71)) return 6;
+ if (inName==HX_("TEnum",75,51,98,8b)) return 7;
+ if (inName==HX_("TFloat",a8,84,be,2b)) return 2;
+ if (inName==HX_("TFunction",8c,db,3a,25)) return 5;
+ if (inName==HX_("TInt",fb,b0,bd,37)) return 1;
+ if (inName==HX_("TNull",fb,84,90,91)) return 0;
+ if (inName==HX_("TObject",33,ea,de,ee)) return 4;
+ if (inName==HX_("TUnknown",96,bd,59,73)) return 8;
+ return super::__FindIndex(inName);
+}
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(ValueType_obj,TClass,return)
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(ValueType_obj,TEnum,return)
+
+int ValueType_obj::__FindArgCount(::String inName)
+{
+ if (inName==HX_("TBool",9e,6a,9d,89)) return 0;
+ if (inName==HX_("TClass",44,37,80,71)) return 1;
+ if (inName==HX_("TEnum",75,51,98,8b)) return 1;
+ if (inName==HX_("TFloat",a8,84,be,2b)) return 0;
+ if (inName==HX_("TFunction",8c,db,3a,25)) return 0;
+ if (inName==HX_("TInt",fb,b0,bd,37)) return 0;
+ if (inName==HX_("TNull",fb,84,90,91)) return 0;
+ if (inName==HX_("TObject",33,ea,de,ee)) return 0;
+ if (inName==HX_("TUnknown",96,bd,59,73)) return 0;
+ return super::__FindArgCount(inName);
+}
+
+::hx::Val ValueType_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ if (inName==HX_("TBool",9e,6a,9d,89)) return TBool;
+ if (inName==HX_("TClass",44,37,80,71)) return TClass_dyn();
+ if (inName==HX_("TEnum",75,51,98,8b)) return TEnum_dyn();
+ if (inName==HX_("TFloat",a8,84,be,2b)) return TFloat;
+ if (inName==HX_("TFunction",8c,db,3a,25)) return TFunction;
+ if (inName==HX_("TInt",fb,b0,bd,37)) return TInt;
+ if (inName==HX_("TNull",fb,84,90,91)) return TNull;
+ if (inName==HX_("TObject",33,ea,de,ee)) return TObject;
+ if (inName==HX_("TUnknown",96,bd,59,73)) return TUnknown;
+ return super::__Field(inName,inCallProp);
+}
+
+static ::String ValueType_obj_sStaticFields[] = {
+ HX_("TNull",fb,84,90,91),
+ HX_("TInt",fb,b0,bd,37),
+ HX_("TFloat",a8,84,be,2b),
+ HX_("TBool",9e,6a,9d,89),
+ HX_("TObject",33,ea,de,ee),
+ HX_("TFunction",8c,db,3a,25),
+ HX_("TClass",44,37,80,71),
+ HX_("TEnum",75,51,98,8b),
+ HX_("TUnknown",96,bd,59,73),
+ ::String(null())
+};
+
+::hx::Class ValueType_obj::__mClass;
+
+Dynamic __Create_ValueType_obj() { return new ValueType_obj; }
+
+void ValueType_obj::__register()
+{
+
+::hx::Static(__mClass) = ::hx::_hx_RegisterClass(HX_("ValueType",ab,8a,60,3b), ::hx::TCanCast< ValueType_obj >,ValueType_obj_sStaticFields,0,
+ &__Create_ValueType_obj, &__Create,
+ &super::__SGetClass(), &CreateValueType_obj, 0
+#ifdef HXCPP_VISIT_ALLOCS
+ , 0
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ , 0
+#endif
+);
+ __mClass->mGetStaticField = &ValueType_obj::__GetStatic;
+}
+
+void ValueType_obj::__boot()
+{
+TBool = ::hx::CreateConstEnum< ValueType_obj >(HX_("TBool",9e,6a,9d,89),3);
+TFloat = ::hx::CreateConstEnum< ValueType_obj >(HX_("TFloat",a8,84,be,2b),2);
+TFunction = ::hx::CreateConstEnum< ValueType_obj >(HX_("TFunction",8c,db,3a,25),5);
+TInt = ::hx::CreateConstEnum< ValueType_obj >(HX_("TInt",fb,b0,bd,37),1);
+TNull = ::hx::CreateConstEnum< ValueType_obj >(HX_("TNull",fb,84,90,91),0);
+TObject = ::hx::CreateConstEnum< ValueType_obj >(HX_("TObject",33,ea,de,ee),4);
+TUnknown = ::hx::CreateConstEnum< ValueType_obj >(HX_("TUnknown",96,bd,59,73),8);
+}
+
+
diff --git a/Sources/c_snikket/src/Xml.cpp b/Sources/c_snikket/src/Xml.cpp
new file mode 100644
index 0000000..38309a3
--- /dev/null
+++ b/Sources/c_snikket/src/Xml.cpp
@@ -0,0 +1,660 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Xml
+#include <Xml.h>
+#endif
+#ifndef INCLUDED__Xml_XmlType_Impl_
+#include <_Xml/XmlType_Impl_.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_StringMap
+#include <haxe/ds/StringMap.h>
+#endif
+#ifndef INCLUDED_haxe_xml_Parser
+#include <haxe/xml/Parser.h>
+#endif
+#ifndef INCLUDED_haxe_xml_Printer
+#include <haxe/xml/Printer.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_7e4d842269e66db1_397_new,"Xml","new",0x2e496e29,"Xml.new","/usr/local/lib/haxe/std/Xml.hx",397,0x5c1024e4)
+HX_LOCAL_STACK_FRAME(_hx_pos_7e4d842269e66db1_244_get,"Xml","get",0x2e441e5f,"Xml.get","/usr/local/lib/haxe/std/Xml.hx",244,0x5c1024e4)
+HX_LOCAL_STACK_FRAME(_hx_pos_7e4d842269e66db1_255_set,"Xml","set",0x2e4d396b,"Xml.set","/usr/local/lib/haxe/std/Xml.hx",255,0x5c1024e4)
+HX_LOCAL_STACK_FRAME(_hx_pos_7e4d842269e66db1_277_exists,"Xml","exists",0x446683b3,"Xml.exists","/usr/local/lib/haxe/std/Xml.hx",277,0x5c1024e4)
+HX_LOCAL_STACK_FRAME(_hx_pos_7e4d842269e66db1_287_attributes,"Xml","attributes",0x1ab5462e,"Xml.attributes","/usr/local/lib/haxe/std/Xml.hx",287,0x5c1024e4)
+HX_LOCAL_STACK_FRAME(_hx_pos_7e4d842269e66db1_337_firstElement,"Xml","firstElement",0xc103a583,"Xml.firstElement","/usr/local/lib/haxe/std/Xml.hx",337,0x5c1024e4)
+HX_LOCAL_STACK_FRAME(_hx_pos_7e4d842269e66db1_353_addChild,"Xml","addChild",0x3e639952,"Xml.addChild","/usr/local/lib/haxe/std/Xml.hx",353,0x5c1024e4)
+HX_LOCAL_STACK_FRAME(_hx_pos_7e4d842269e66db1_366_removeChild,"Xml","removeChild",0x9bd39581,"Xml.removeChild","/usr/local/lib/haxe/std/Xml.hx",366,0x5c1024e4)
+HX_LOCAL_STACK_FRAME(_hx_pos_7e4d842269e66db1_394_toString,"Xml","toString",0xb7bb9a43,"Xml.toString","/usr/local/lib/haxe/std/Xml.hx",394,0x5c1024e4)
+HX_LOCAL_STACK_FRAME(_hx_pos_7e4d842269e66db1_122_parse,"Xml","parse",0x8a44f23c,"Xml.parse","/usr/local/lib/haxe/std/Xml.hx",122,0x5c1024e4)
+HX_LOCAL_STACK_FRAME(_hx_pos_7e4d842269e66db1_182_createElement,"Xml","createElement",0x97359a29,"Xml.createElement","/usr/local/lib/haxe/std/Xml.hx",182,0x5c1024e4)
+HX_LOCAL_STACK_FRAME(_hx_pos_7e4d842269e66db1_191_createPCData,"Xml","createPCData",0x3cc9ead0,"Xml.createPCData","/usr/local/lib/haxe/std/Xml.hx",191,0x5c1024e4)
+HX_LOCAL_STACK_FRAME(_hx_pos_7e4d842269e66db1_200_createCData,"Xml","createCData",0xaf49365a,"Xml.createCData","/usr/local/lib/haxe/std/Xml.hx",200,0x5c1024e4)
+HX_LOCAL_STACK_FRAME(_hx_pos_7e4d842269e66db1_209_createComment,"Xml","createComment",0x125165cc,"Xml.createComment","/usr/local/lib/haxe/std/Xml.hx",209,0x5c1024e4)
+HX_LOCAL_STACK_FRAME(_hx_pos_7e4d842269e66db1_218_createDocType,"Xml","createDocType",0x696de8bf,"Xml.createDocType","/usr/local/lib/haxe/std/Xml.hx",218,0x5c1024e4)
+HX_LOCAL_STACK_FRAME(_hx_pos_7e4d842269e66db1_227_createProcessingInstruction,"Xml","createProcessingInstruction",0x632a1f28,"Xml.createProcessingInstruction","/usr/local/lib/haxe/std/Xml.hx",227,0x5c1024e4)
+HX_LOCAL_STACK_FRAME(_hx_pos_7e4d842269e66db1_237_createDocument,"Xml","createDocument",0xcf00030e,"Xml.createDocument","/usr/local/lib/haxe/std/Xml.hx",237,0x5c1024e4)
+HX_LOCAL_STACK_FRAME(_hx_pos_7e4d842269e66db1_86_boot,"Xml","boot",0x4a0ff649,"Xml.boot","/usr/local/lib/haxe/std/Xml.hx",86,0x5c1024e4)
+HX_LOCAL_STACK_FRAME(_hx_pos_7e4d842269e66db1_91_boot,"Xml","boot",0x4a0ff649,"Xml.boot","/usr/local/lib/haxe/std/Xml.hx",91,0x5c1024e4)
+HX_LOCAL_STACK_FRAME(_hx_pos_7e4d842269e66db1_96_boot,"Xml","boot",0x4a0ff649,"Xml.boot","/usr/local/lib/haxe/std/Xml.hx",96,0x5c1024e4)
+HX_LOCAL_STACK_FRAME(_hx_pos_7e4d842269e66db1_101_boot,"Xml","boot",0x4a0ff649,"Xml.boot","/usr/local/lib/haxe/std/Xml.hx",101,0x5c1024e4)
+HX_LOCAL_STACK_FRAME(_hx_pos_7e4d842269e66db1_106_boot,"Xml","boot",0x4a0ff649,"Xml.boot","/usr/local/lib/haxe/std/Xml.hx",106,0x5c1024e4)
+HX_LOCAL_STACK_FRAME(_hx_pos_7e4d842269e66db1_111_boot,"Xml","boot",0x4a0ff649,"Xml.boot","/usr/local/lib/haxe/std/Xml.hx",111,0x5c1024e4)
+HX_LOCAL_STACK_FRAME(_hx_pos_7e4d842269e66db1_116_boot,"Xml","boot",0x4a0ff649,"Xml.boot","/usr/local/lib/haxe/std/Xml.hx",116,0x5c1024e4)
+
+void Xml_obj::__construct(int nodeType){
+ HX_GC_STACKFRAME(&_hx_pos_7e4d842269e66db1_397_new)
+HXLINE( 398) this->nodeType = nodeType;
+HXLINE( 399) this->children = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 400) this->attributeMap = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+ }
+
+Dynamic Xml_obj::__CreateEmpty() { return new Xml_obj; }
+
+void *Xml_obj::_hx_vtable = 0;
+
+Dynamic Xml_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Xml_obj > _hx_result = new Xml_obj();
+ _hx_result->__construct(inArgs[0]);
+ return _hx_result;
+}
+
+bool Xml_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x7ee76a4b;
+}
+
+::String Xml_obj::get(::String att){
+ HX_STACKFRAME(&_hx_pos_7e4d842269e66db1_244_get)
+HXLINE( 245) if ((this->nodeType != ::Xml_obj::Element)) {
+HXLINE( 246) HX_STACK_DO_THROW((HX_("Bad node type, expected Element but found ",d8,90,8b,bb) + ::_Xml::XmlType_Impl__obj::toString(this->nodeType)));
+ }
+HXLINE( 248) return this->attributeMap->get_string(att);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Xml_obj,get,return )
+
+void Xml_obj::set(::String att,::String value){
+ HX_STACKFRAME(&_hx_pos_7e4d842269e66db1_255_set)
+HXLINE( 256) if ((this->nodeType != ::Xml_obj::Element)) {
+HXLINE( 257) HX_STACK_DO_THROW((HX_("Bad node type, expected Element but found ",d8,90,8b,bb) + ::_Xml::XmlType_Impl__obj::toString(this->nodeType)));
+ }
+HXLINE( 259) this->attributeMap->set(att,value);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Xml_obj,set,(void))
+
+bool Xml_obj::exists(::String att){
+ HX_STACKFRAME(&_hx_pos_7e4d842269e66db1_277_exists)
+HXLINE( 278) if ((this->nodeType != ::Xml_obj::Element)) {
+HXLINE( 279) HX_STACK_DO_THROW((HX_("Bad node type, expected Element but found ",d8,90,8b,bb) + ::_Xml::XmlType_Impl__obj::toString(this->nodeType)));
+ }
+HXLINE( 281) return this->attributeMap->exists(att);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Xml_obj,exists,return )
+
+ ::Dynamic Xml_obj::attributes(){
+ HX_STACKFRAME(&_hx_pos_7e4d842269e66db1_287_attributes)
+HXLINE( 288) if ((this->nodeType != ::Xml_obj::Element)) {
+HXLINE( 289) HX_STACK_DO_THROW((HX_("Bad node type, expected Element but found ",d8,90,8b,bb) + ::_Xml::XmlType_Impl__obj::toString(this->nodeType)));
+ }
+HXLINE( 291) return this->attributeMap->keys();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Xml_obj,attributes,return )
+
+ ::Xml Xml_obj::firstElement(){
+ HX_STACKFRAME(&_hx_pos_7e4d842269e66db1_337_firstElement)
+HXLINE( 338) bool _hx_tmp;
+HXDLIN( 338) if ((this->nodeType != ::Xml_obj::Document)) {
+HXLINE( 338) _hx_tmp = (this->nodeType != ::Xml_obj::Element);
+ }
+ else {
+HXLINE( 338) _hx_tmp = false;
+ }
+HXDLIN( 338) if (_hx_tmp) {
+HXLINE( 338) HX_STACK_DO_THROW((HX_("Bad node type, expected Element or Document but found ",a0,d6,ba,79) + ::_Xml::XmlType_Impl__obj::toString(this->nodeType)));
+ }
+HXLINE( 339) {
+HXLINE( 339) int _g = 0;
+HXDLIN( 339) ::Array< ::Dynamic> _g1 = this->children;
+HXDLIN( 339) while((_g < _g1->length)){
+HXLINE( 339) ::Xml child = _g1->__get(_g).StaticCast< ::Xml >();
+HXDLIN( 339) _g = (_g + 1);
+HXLINE( 340) if ((child->nodeType == ::Xml_obj::Element)) {
+HXLINE( 341) return child;
+ }
+ }
+ }
+HXLINE( 344) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Xml_obj,firstElement,return )
+
+void Xml_obj::addChild( ::Xml x){
+ HX_STACKFRAME(&_hx_pos_7e4d842269e66db1_353_addChild)
+HXLINE( 354) bool _hx_tmp;
+HXDLIN( 354) if ((this->nodeType != ::Xml_obj::Document)) {
+HXLINE( 354) _hx_tmp = (this->nodeType != ::Xml_obj::Element);
+ }
+ else {
+HXLINE( 354) _hx_tmp = false;
+ }
+HXDLIN( 354) if (_hx_tmp) {
+HXLINE( 354) HX_STACK_DO_THROW((HX_("Bad node type, expected Element or Document but found ",a0,d6,ba,79) + ::_Xml::XmlType_Impl__obj::toString(this->nodeType)));
+ }
+HXLINE( 355) if (::hx::IsNotNull( x->parent )) {
+HXLINE( 356) x->parent->removeChild(x);
+ }
+HXLINE( 358) this->children->push(x);
+HXLINE( 359) x->parent = ::hx::ObjectPtr<OBJ_>(this);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Xml_obj,addChild,(void))
+
+bool Xml_obj::removeChild( ::Xml x){
+ HX_STACKFRAME(&_hx_pos_7e4d842269e66db1_366_removeChild)
+HXLINE( 367) bool _hx_tmp;
+HXDLIN( 367) if ((this->nodeType != ::Xml_obj::Document)) {
+HXLINE( 367) _hx_tmp = (this->nodeType != ::Xml_obj::Element);
+ }
+ else {
+HXLINE( 367) _hx_tmp = false;
+ }
+HXDLIN( 367) if (_hx_tmp) {
+HXLINE( 367) HX_STACK_DO_THROW((HX_("Bad node type, expected Element or Document but found ",a0,d6,ba,79) + ::_Xml::XmlType_Impl__obj::toString(this->nodeType)));
+ }
+HXLINE( 368) if (this->children->remove(x)) {
+HXLINE( 369) x->parent = null();
+HXLINE( 370) return true;
+ }
+HXLINE( 372) return false;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Xml_obj,removeChild,return )
+
+::String Xml_obj::toString(){
+ HX_STACKFRAME(&_hx_pos_7e4d842269e66db1_394_toString)
+HXDLIN( 394) return ::haxe::xml::Printer_obj::print(::hx::ObjectPtr<OBJ_>(this),null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Xml_obj,toString,return )
+
+int Xml_obj::Element;
+
+int Xml_obj::PCData;
+
+int Xml_obj::CData;
+
+int Xml_obj::Comment;
+
+int Xml_obj::DocType;
+
+int Xml_obj::ProcessingInstruction;
+
+int Xml_obj::Document;
+
+ ::Xml Xml_obj::parse(::String str){
+ HX_STACKFRAME(&_hx_pos_7e4d842269e66db1_122_parse)
+HXDLIN( 122) return ::haxe::xml::Parser_obj::parse(str,null());
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Xml_obj,parse,return )
+
+ ::Xml Xml_obj::createElement(::String name){
+ HX_GC_STACKFRAME(&_hx_pos_7e4d842269e66db1_182_createElement)
+HXLINE( 183) ::Xml xml = ::Xml_obj::__alloc( HX_CTX ,::Xml_obj::Element);
+HXLINE( 184) {
+HXLINE( 184) if ((xml->nodeType != ::Xml_obj::Element)) {
+HXLINE( 184) HX_STACK_DO_THROW((HX_("Bad node type, expected Element but found ",d8,90,8b,bb) + ::_Xml::XmlType_Impl__obj::toString(xml->nodeType)));
+ }
+HXDLIN( 184) xml->nodeName = name;
+ }
+HXLINE( 185) return xml;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Xml_obj,createElement,return )
+
+ ::Xml Xml_obj::createPCData(::String data){
+ HX_GC_STACKFRAME(&_hx_pos_7e4d842269e66db1_191_createPCData)
+HXLINE( 192) ::Xml xml = ::Xml_obj::__alloc( HX_CTX ,::Xml_obj::PCData);
+HXLINE( 193) {
+HXLINE( 193) bool _hx_tmp;
+HXDLIN( 193) if ((xml->nodeType != ::Xml_obj::Document)) {
+HXLINE( 193) _hx_tmp = (xml->nodeType == ::Xml_obj::Element);
+ }
+ else {
+HXLINE( 193) _hx_tmp = true;
+ }
+HXDLIN( 193) if (_hx_tmp) {
+HXLINE( 193) HX_STACK_DO_THROW((HX_("Bad node type, unexpected ",be,79,d5,11) + ::_Xml::XmlType_Impl__obj::toString(xml->nodeType)));
+ }
+HXDLIN( 193) xml->nodeValue = data;
+ }
+HXLINE( 194) return xml;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Xml_obj,createPCData,return )
+
+ ::Xml Xml_obj::createCData(::String data){
+ HX_GC_STACKFRAME(&_hx_pos_7e4d842269e66db1_200_createCData)
+HXLINE( 201) ::Xml xml = ::Xml_obj::__alloc( HX_CTX ,::Xml_obj::CData);
+HXLINE( 202) {
+HXLINE( 202) bool _hx_tmp;
+HXDLIN( 202) if ((xml->nodeType != ::Xml_obj::Document)) {
+HXLINE( 202) _hx_tmp = (xml->nodeType == ::Xml_obj::Element);
+ }
+ else {
+HXLINE( 202) _hx_tmp = true;
+ }
+HXDLIN( 202) if (_hx_tmp) {
+HXLINE( 202) HX_STACK_DO_THROW((HX_("Bad node type, unexpected ",be,79,d5,11) + ::_Xml::XmlType_Impl__obj::toString(xml->nodeType)));
+ }
+HXDLIN( 202) xml->nodeValue = data;
+ }
+HXLINE( 203) return xml;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Xml_obj,createCData,return )
+
+ ::Xml Xml_obj::createComment(::String data){
+ HX_GC_STACKFRAME(&_hx_pos_7e4d842269e66db1_209_createComment)
+HXLINE( 210) ::Xml xml = ::Xml_obj::__alloc( HX_CTX ,::Xml_obj::Comment);
+HXLINE( 211) {
+HXLINE( 211) bool _hx_tmp;
+HXDLIN( 211) if ((xml->nodeType != ::Xml_obj::Document)) {
+HXLINE( 211) _hx_tmp = (xml->nodeType == ::Xml_obj::Element);
+ }
+ else {
+HXLINE( 211) _hx_tmp = true;
+ }
+HXDLIN( 211) if (_hx_tmp) {
+HXLINE( 211) HX_STACK_DO_THROW((HX_("Bad node type, unexpected ",be,79,d5,11) + ::_Xml::XmlType_Impl__obj::toString(xml->nodeType)));
+ }
+HXDLIN( 211) xml->nodeValue = data;
+ }
+HXLINE( 212) return xml;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Xml_obj,createComment,return )
+
+ ::Xml Xml_obj::createDocType(::String data){
+ HX_GC_STACKFRAME(&_hx_pos_7e4d842269e66db1_218_createDocType)
+HXLINE( 219) ::Xml xml = ::Xml_obj::__alloc( HX_CTX ,::Xml_obj::DocType);
+HXLINE( 220) {
+HXLINE( 220) bool _hx_tmp;
+HXDLIN( 220) if ((xml->nodeType != ::Xml_obj::Document)) {
+HXLINE( 220) _hx_tmp = (xml->nodeType == ::Xml_obj::Element);
+ }
+ else {
+HXLINE( 220) _hx_tmp = true;
+ }
+HXDLIN( 220) if (_hx_tmp) {
+HXLINE( 220) HX_STACK_DO_THROW((HX_("Bad node type, unexpected ",be,79,d5,11) + ::_Xml::XmlType_Impl__obj::toString(xml->nodeType)));
+ }
+HXDLIN( 220) xml->nodeValue = data;
+ }
+HXLINE( 221) return xml;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Xml_obj,createDocType,return )
+
+ ::Xml Xml_obj::createProcessingInstruction(::String data){
+ HX_GC_STACKFRAME(&_hx_pos_7e4d842269e66db1_227_createProcessingInstruction)
+HXLINE( 228) ::Xml xml = ::Xml_obj::__alloc( HX_CTX ,::Xml_obj::ProcessingInstruction);
+HXLINE( 229) {
+HXLINE( 229) bool _hx_tmp;
+HXDLIN( 229) if ((xml->nodeType != ::Xml_obj::Document)) {
+HXLINE( 229) _hx_tmp = (xml->nodeType == ::Xml_obj::Element);
+ }
+ else {
+HXLINE( 229) _hx_tmp = true;
+ }
+HXDLIN( 229) if (_hx_tmp) {
+HXLINE( 229) HX_STACK_DO_THROW((HX_("Bad node type, unexpected ",be,79,d5,11) + ::_Xml::XmlType_Impl__obj::toString(xml->nodeType)));
+ }
+HXDLIN( 229) xml->nodeValue = data;
+ }
+HXLINE( 230) return xml;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Xml_obj,createProcessingInstruction,return )
+
+ ::Xml Xml_obj::createDocument(){
+ HX_GC_STACKFRAME(&_hx_pos_7e4d842269e66db1_237_createDocument)
+HXDLIN( 237) return ::Xml_obj::__alloc( HX_CTX ,::Xml_obj::Document);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC0(Xml_obj,createDocument,return )
+
+
+::hx::ObjectPtr< Xml_obj > Xml_obj::__new(int nodeType) {
+ ::hx::ObjectPtr< Xml_obj > __this = new Xml_obj();
+ __this->__construct(nodeType);
+ return __this;
+}
+
+::hx::ObjectPtr< Xml_obj > Xml_obj::__alloc(::hx::Ctx *_hx_ctx,int nodeType) {
+ Xml_obj *__this = (Xml_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Xml_obj), true, "Xml"));
+ *(void **)__this = Xml_obj::_hx_vtable;
+ __this->__construct(nodeType);
+ return __this;
+}
+
+Xml_obj::Xml_obj()
+{
+}
+
+void Xml_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(Xml);
+ HX_MARK_MEMBER_NAME(nodeType,"nodeType");
+ HX_MARK_MEMBER_NAME(nodeName,"nodeName");
+ HX_MARK_MEMBER_NAME(nodeValue,"nodeValue");
+ HX_MARK_MEMBER_NAME(parent,"parent");
+ HX_MARK_MEMBER_NAME(children,"children");
+ HX_MARK_MEMBER_NAME(attributeMap,"attributeMap");
+ HX_MARK_END_CLASS();
+}
+
+void Xml_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(nodeType,"nodeType");
+ HX_VISIT_MEMBER_NAME(nodeName,"nodeName");
+ HX_VISIT_MEMBER_NAME(nodeValue,"nodeValue");
+ HX_VISIT_MEMBER_NAME(parent,"parent");
+ HX_VISIT_MEMBER_NAME(children,"children");
+ HX_VISIT_MEMBER_NAME(attributeMap,"attributeMap");
+}
+
+::hx::Val Xml_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"get") ) { return ::hx::Val( get_dyn() ); }
+ if (HX_FIELD_EQ(inName,"set") ) { return ::hx::Val( set_dyn() ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"parent") ) { return ::hx::Val( parent ); }
+ if (HX_FIELD_EQ(inName,"exists") ) { return ::hx::Val( exists_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"nodeType") ) { return ::hx::Val( nodeType ); }
+ if (HX_FIELD_EQ(inName,"nodeName") ) { return ::hx::Val( nodeName ); }
+ if (HX_FIELD_EQ(inName,"children") ) { return ::hx::Val( children ); }
+ if (HX_FIELD_EQ(inName,"addChild") ) { return ::hx::Val( addChild_dyn() ); }
+ if (HX_FIELD_EQ(inName,"toString") ) { return ::hx::Val( toString_dyn() ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"nodeValue") ) { return ::hx::Val( nodeValue ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"attributes") ) { return ::hx::Val( attributes_dyn() ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"removeChild") ) { return ::hx::Val( removeChild_dyn() ); }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"attributeMap") ) { return ::hx::Val( attributeMap ); }
+ if (HX_FIELD_EQ(inName,"firstElement") ) { return ::hx::Val( firstElement_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool Xml_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"CData") ) { outValue = ( CData ); return true; }
+ if (HX_FIELD_EQ(inName,"parse") ) { outValue = parse_dyn(); return true; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"PCData") ) { outValue = ( PCData ); return true; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"Element") ) { outValue = ( Element ); return true; }
+ if (HX_FIELD_EQ(inName,"Comment") ) { outValue = ( Comment ); return true; }
+ if (HX_FIELD_EQ(inName,"DocType") ) { outValue = ( DocType ); return true; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"Document") ) { outValue = ( Document ); return true; }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"createCData") ) { outValue = createCData_dyn(); return true; }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"createPCData") ) { outValue = createPCData_dyn(); return true; }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"createElement") ) { outValue = createElement_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"createComment") ) { outValue = createComment_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"createDocType") ) { outValue = createDocType_dyn(); return true; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"createDocument") ) { outValue = createDocument_dyn(); return true; }
+ break;
+ case 21:
+ if (HX_FIELD_EQ(inName,"ProcessingInstruction") ) { outValue = ( ProcessingInstruction ); return true; }
+ break;
+ case 27:
+ if (HX_FIELD_EQ(inName,"createProcessingInstruction") ) { outValue = createProcessingInstruction_dyn(); return true; }
+ }
+ return false;
+}
+
+::hx::Val Xml_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 6:
+ if (HX_FIELD_EQ(inName,"parent") ) { parent=inValue.Cast< ::Xml >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"nodeType") ) { nodeType=inValue.Cast< int >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"nodeName") ) { nodeName=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"children") ) { children=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"nodeValue") ) { nodeValue=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"attributeMap") ) { attributeMap=inValue.Cast< ::haxe::ds::StringMap >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+bool Xml_obj::__SetStatic(const ::String &inName,Dynamic &ioValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"CData") ) { CData=ioValue.Cast< int >(); return true; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"PCData") ) { PCData=ioValue.Cast< int >(); return true; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"Element") ) { Element=ioValue.Cast< int >(); return true; }
+ if (HX_FIELD_EQ(inName,"Comment") ) { Comment=ioValue.Cast< int >(); return true; }
+ if (HX_FIELD_EQ(inName,"DocType") ) { DocType=ioValue.Cast< int >(); return true; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"Document") ) { Document=ioValue.Cast< int >(); return true; }
+ break;
+ case 21:
+ if (HX_FIELD_EQ(inName,"ProcessingInstruction") ) { ProcessingInstruction=ioValue.Cast< int >(); return true; }
+ }
+ return false;
+}
+
+void Xml_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("nodeType",dc,51,86,f6));
+ outFields->push(HX_("nodeName",6d,d1,7c,f2));
+ outFields->push(HX_("nodeValue",0f,5e,ee,d5));
+ outFields->push(HX_("parent",2a,05,7e,ed));
+ outFields->push(HX_("children",3f,19,6a,70));
+ outFields->push(HX_("attributeMap",e0,4b,b2,95));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Xml_obj_sMemberStorageInfo[] = {
+ {::hx::fsInt,(int)offsetof(Xml_obj,nodeType),HX_("nodeType",dc,51,86,f6)},
+ {::hx::fsString,(int)offsetof(Xml_obj,nodeName),HX_("nodeName",6d,d1,7c,f2)},
+ {::hx::fsString,(int)offsetof(Xml_obj,nodeValue),HX_("nodeValue",0f,5e,ee,d5)},
+ {::hx::fsObject /* ::Xml */ ,(int)offsetof(Xml_obj,parent),HX_("parent",2a,05,7e,ed)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(Xml_obj,children),HX_("children",3f,19,6a,70)},
+ {::hx::fsObject /* ::haxe::ds::StringMap */ ,(int)offsetof(Xml_obj,attributeMap),HX_("attributeMap",e0,4b,b2,95)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo Xml_obj_sStaticStorageInfo[] = {
+ {::hx::fsInt,(void *) &Xml_obj::Element,HX_("Element",9c,d6,a5,d3)},
+ {::hx::fsInt,(void *) &Xml_obj::PCData,HX_("PCData",bd,3d,a2,bd)},
+ {::hx::fsInt,(void *) &Xml_obj::CData,HX_("CData",0d,60,15,c1)},
+ {::hx::fsInt,(void *) &Xml_obj::Comment,HX_("Comment",3f,a2,c1,4e)},
+ {::hx::fsInt,(void *) &Xml_obj::DocType,HX_("DocType",32,25,de,a5)},
+ {::hx::fsInt,(void *) &Xml_obj::ProcessingInstruction,HX_("ProcessingInstruction",db,1e,14,6a)},
+ {::hx::fsInt,(void *) &Xml_obj::Document,HX_("Document",3b,ab,c4,74)},
+ { ::hx::fsUnknown, 0, null()}
+};
+#endif
+
+static ::String Xml_obj_sMemberFields[] = {
+ HX_("nodeType",dc,51,86,f6),
+ HX_("nodeName",6d,d1,7c,f2),
+ HX_("nodeValue",0f,5e,ee,d5),
+ HX_("parent",2a,05,7e,ed),
+ HX_("children",3f,19,6a,70),
+ HX_("attributeMap",e0,4b,b2,95),
+ HX_("get",96,80,4e,00),
+ HX_("set",a2,9b,57,00),
+ HX_("exists",dc,1d,e0,bf),
+ HX_("attributes",d7,a8,71,97),
+ HX_("firstElement",6c,c4,9c,2f),
+ HX_("addChild",bb,cf,16,bf),
+ HX_("removeChild",b8,86,ed,43),
+ HX_("toString",ac,d0,6e,38),
+ ::String(null()) };
+
+static void Xml_obj_sMarkStatics(HX_MARK_PARAMS) {
+ HX_MARK_MEMBER_NAME(Xml_obj::Element,"Element");
+ HX_MARK_MEMBER_NAME(Xml_obj::PCData,"PCData");
+ HX_MARK_MEMBER_NAME(Xml_obj::CData,"CData");
+ HX_MARK_MEMBER_NAME(Xml_obj::Comment,"Comment");
+ HX_MARK_MEMBER_NAME(Xml_obj::DocType,"DocType");
+ HX_MARK_MEMBER_NAME(Xml_obj::ProcessingInstruction,"ProcessingInstruction");
+ HX_MARK_MEMBER_NAME(Xml_obj::Document,"Document");
+};
+
+#ifdef HXCPP_VISIT_ALLOCS
+static void Xml_obj_sVisitStatics(HX_VISIT_PARAMS) {
+ HX_VISIT_MEMBER_NAME(Xml_obj::Element,"Element");
+ HX_VISIT_MEMBER_NAME(Xml_obj::PCData,"PCData");
+ HX_VISIT_MEMBER_NAME(Xml_obj::CData,"CData");
+ HX_VISIT_MEMBER_NAME(Xml_obj::Comment,"Comment");
+ HX_VISIT_MEMBER_NAME(Xml_obj::DocType,"DocType");
+ HX_VISIT_MEMBER_NAME(Xml_obj::ProcessingInstruction,"ProcessingInstruction");
+ HX_VISIT_MEMBER_NAME(Xml_obj::Document,"Document");
+};
+
+#endif
+
+::hx::Class Xml_obj::__mClass;
+
+static ::String Xml_obj_sStaticFields[] = {
+ HX_("Element",9c,d6,a5,d3),
+ HX_("PCData",bd,3d,a2,bd),
+ HX_("CData",0d,60,15,c1),
+ HX_("Comment",3f,a2,c1,4e),
+ HX_("DocType",32,25,de,a5),
+ HX_("ProcessingInstruction",db,1e,14,6a),
+ HX_("Document",3b,ab,c4,74),
+ HX_("parse",33,90,55,bd),
+ HX_("createElement",20,87,97,ee),
+ HX_("createPCData",b9,09,63,ab),
+ HX_("createCData",91,27,63,57),
+ HX_("createComment",c3,52,b3,69),
+ HX_("createDocType",b6,d5,cf,c0),
+ HX_("createProcessingInstruction",5f,2e,58,38),
+ HX_("createDocument",37,6e,4d,ed),
+ ::String(null())
+};
+
+void Xml_obj::__register()
+{
+ Xml_obj _hx_dummy;
+ Xml_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("Xml",b7,25,43,00);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Xml_obj::__GetStatic;
+ __mClass->mSetStaticField = &Xml_obj::__SetStatic;
+ __mClass->mMarkFunc = Xml_obj_sMarkStatics;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Xml_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Xml_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Xml_obj >;
+#ifdef HXCPP_VISIT_ALLOCS
+ __mClass->mVisitFunc = Xml_obj_sVisitStatics;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Xml_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Xml_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void Xml_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_7e4d842269e66db1_86_boot)
+HXDLIN( 86) Element = 0;
+ }
+{
+ HX_STACKFRAME(&_hx_pos_7e4d842269e66db1_91_boot)
+HXDLIN( 91) PCData = 1;
+ }
+{
+ HX_STACKFRAME(&_hx_pos_7e4d842269e66db1_96_boot)
+HXDLIN( 96) CData = 2;
+ }
+{
+ HX_STACKFRAME(&_hx_pos_7e4d842269e66db1_101_boot)
+HXDLIN( 101) Comment = 3;
+ }
+{
+ HX_STACKFRAME(&_hx_pos_7e4d842269e66db1_106_boot)
+HXDLIN( 106) DocType = 4;
+ }
+{
+ HX_STACKFRAME(&_hx_pos_7e4d842269e66db1_111_boot)
+HXDLIN( 111) ProcessingInstruction = 5;
+ }
+{
+ HX_STACKFRAME(&_hx_pos_7e4d842269e66db1_116_boot)
+HXDLIN( 116) Document = 6;
+ }
+}
+
diff --git a/Sources/c_snikket/src/_HaxeCBridge/Int64Map_Impl_.cpp b/Sources/c_snikket/src/_HaxeCBridge/Int64Map_Impl_.cpp
new file mode 100644
index 0000000..8ce460f
--- /dev/null
+++ b/Sources/c_snikket/src/_HaxeCBridge/Int64Map_Impl_.cpp
@@ -0,0 +1,91 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED__HaxeCBridge_Int64Map_Impl_
+#include <_HaxeCBridge/Int64Map_Impl_.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_IntMap
+#include <haxe/ds/IntMap.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_d939fa764c7c1922_2072__new,"_HaxeCBridge.Int64Map_Impl_","_new",0x93ec2b39,"_HaxeCBridge.Int64Map_Impl_._new","HaxeCBridge.hx",2072,0xa18550d8)
+namespace _HaxeCBridge{
+
+void Int64Map_Impl__obj::__construct() { }
+
+Dynamic Int64Map_Impl__obj::__CreateEmpty() { return new Int64Map_Impl__obj; }
+
+void *Int64Map_Impl__obj::_hx_vtable = 0;
+
+Dynamic Int64Map_Impl__obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Int64Map_Impl__obj > _hx_result = new Int64Map_Impl__obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool Int64Map_Impl__obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x09ceba9e;
+}
+
+ ::haxe::ds::IntMap Int64Map_Impl__obj::_new(){
+ HX_GC_STACKFRAME(&_hx_pos_d939fa764c7c1922_2072__new)
+HXDLIN(2072) return ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC0(Int64Map_Impl__obj,_new,return )
+
+
+Int64Map_Impl__obj::Int64Map_Impl__obj()
+{
+}
+
+bool Int64Map_Impl__obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"_new") ) { outValue = _new_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *Int64Map_Impl__obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *Int64Map_Impl__obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class Int64Map_Impl__obj::__mClass;
+
+static ::String Int64Map_Impl__obj_sStaticFields[] = {
+ HX_("_new",61,15,1f,3f),
+ ::String(null())
+};
+
+void Int64Map_Impl__obj::__register()
+{
+ Int64Map_Impl__obj _hx_dummy;
+ Int64Map_Impl__obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("_HaxeCBridge.Int64Map_Impl_",96,19,cf,fe);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Int64Map_Impl__obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Int64Map_Impl__obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< Int64Map_Impl__obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Int64Map_Impl__obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Int64Map_Impl__obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace _HaxeCBridge
diff --git a/Sources/c_snikket/src/_HaxeCBridge/Internal.cpp b/Sources/c_snikket/src/_HaxeCBridge/Internal.cpp
new file mode 100644
index 0000000..845cacc
--- /dev/null
+++ b/Sources/c_snikket/src/_HaxeCBridge/Internal.cpp
@@ -0,0 +1,184 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED__HaxeCBridge_Int64Map_Impl_
+#include <_HaxeCBridge/Int64Map_Impl_.h>
+#endif
+#ifndef INCLUDED__HaxeCBridge_Internal
+#include <_HaxeCBridge/Internal.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_IntMap
+#include <haxe/ds/IntMap.h>
+#endif
+#ifndef INCLUDED_sys_thread_Lock
+#include <sys/thread/Lock.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_afd834d22acce778_2060_boot,"_HaxeCBridge.Internal","boot",0xcd005bdc,"_HaxeCBridge.Internal.boot","HaxeCBridge.hx",2060,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_afd834d22acce778_2061_boot,"_HaxeCBridge.Internal","boot",0xcd005bdc,"_HaxeCBridge.Internal.boot","HaxeCBridge.hx",2061,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_afd834d22acce778_2062_boot,"_HaxeCBridge.Internal","boot",0xcd005bdc,"_HaxeCBridge.Internal.boot","HaxeCBridge.hx",2062,0xa18550d8)
+namespace _HaxeCBridge{
+
+void Internal_obj::__construct() { }
+
+Dynamic Internal_obj::__CreateEmpty() { return new Internal_obj; }
+
+void *Internal_obj::_hx_vtable = 0;
+
+Dynamic Internal_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Internal_obj > _hx_result = new Internal_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool Internal_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x0f2147a8;
+}
+
+::cpp::Function< bool () > Internal_obj::isMainThreadCb;
+
+ ::sys::thread::Lock Internal_obj::mainThreadWaitLock;
+
+bool Internal_obj::mainThreadLoopActive;
+
+bool Internal_obj::mainThreadEndIfNoPending;
+
+ ::haxe::ds::IntMap Internal_obj::gcRetainMap;
+
+
+Internal_obj::Internal_obj()
+{
+}
+
+bool Internal_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 11:
+ if (HX_FIELD_EQ(inName,"gcRetainMap") ) { outValue = ( gcRetainMap ); return true; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"isMainThreadCb") ) { outValue = ( isMainThreadCb ); return true; }
+ break;
+ case 18:
+ if (HX_FIELD_EQ(inName,"mainThreadWaitLock") ) { outValue = ( mainThreadWaitLock ); return true; }
+ break;
+ case 20:
+ if (HX_FIELD_EQ(inName,"mainThreadLoopActive") ) { outValue = ( mainThreadLoopActive ); return true; }
+ break;
+ case 24:
+ if (HX_FIELD_EQ(inName,"mainThreadEndIfNoPending") ) { outValue = ( mainThreadEndIfNoPending ); return true; }
+ }
+ return false;
+}
+
+bool Internal_obj::__SetStatic(const ::String &inName,Dynamic &ioValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 11:
+ if (HX_FIELD_EQ(inName,"gcRetainMap") ) { gcRetainMap=ioValue.Cast< ::haxe::ds::IntMap >(); return true; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"isMainThreadCb") ) { isMainThreadCb=ioValue.Cast< ::cpp::Function< bool () > >(); return true; }
+ break;
+ case 18:
+ if (HX_FIELD_EQ(inName,"mainThreadWaitLock") ) { mainThreadWaitLock=ioValue.Cast< ::sys::thread::Lock >(); return true; }
+ break;
+ case 20:
+ if (HX_FIELD_EQ(inName,"mainThreadLoopActive") ) { mainThreadLoopActive=ioValue.Cast< bool >(); return true; }
+ break;
+ case 24:
+ if (HX_FIELD_EQ(inName,"mainThreadEndIfNoPending") ) { mainThreadEndIfNoPending=ioValue.Cast< bool >(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *Internal_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo Internal_obj_sStaticStorageInfo[] = {
+ {::hx::fsObject /* ::cpp::Function< bool () > */ ,(void *) &Internal_obj::isMainThreadCb,HX_("isMainThreadCb",6c,b0,87,f1)},
+ {::hx::fsObject /* ::sys::thread::Lock */ ,(void *) &Internal_obj::mainThreadWaitLock,HX_("mainThreadWaitLock",03,70,b0,ec)},
+ {::hx::fsBool,(void *) &Internal_obj::mainThreadLoopActive,HX_("mainThreadLoopActive",0d,b5,07,81)},
+ {::hx::fsBool,(void *) &Internal_obj::mainThreadEndIfNoPending,HX_("mainThreadEndIfNoPending",a1,49,76,fa)},
+ {::hx::fsObject /* ::haxe::ds::IntMap */ ,(void *) &Internal_obj::gcRetainMap,HX_("gcRetainMap",1b,1e,df,b6)},
+ { ::hx::fsUnknown, 0, null()}
+};
+#endif
+
+static void Internal_obj_sMarkStatics(HX_MARK_PARAMS) {
+ HX_MARK_MEMBER_NAME(Internal_obj::isMainThreadCb,"isMainThreadCb");
+ HX_MARK_MEMBER_NAME(Internal_obj::mainThreadWaitLock,"mainThreadWaitLock");
+ HX_MARK_MEMBER_NAME(Internal_obj::mainThreadLoopActive,"mainThreadLoopActive");
+ HX_MARK_MEMBER_NAME(Internal_obj::mainThreadEndIfNoPending,"mainThreadEndIfNoPending");
+ HX_MARK_MEMBER_NAME(Internal_obj::gcRetainMap,"gcRetainMap");
+};
+
+#ifdef HXCPP_VISIT_ALLOCS
+static void Internal_obj_sVisitStatics(HX_VISIT_PARAMS) {
+ HX_VISIT_MEMBER_NAME(Internal_obj::isMainThreadCb,"isMainThreadCb");
+ HX_VISIT_MEMBER_NAME(Internal_obj::mainThreadWaitLock,"mainThreadWaitLock");
+ HX_VISIT_MEMBER_NAME(Internal_obj::mainThreadLoopActive,"mainThreadLoopActive");
+ HX_VISIT_MEMBER_NAME(Internal_obj::mainThreadEndIfNoPending,"mainThreadEndIfNoPending");
+ HX_VISIT_MEMBER_NAME(Internal_obj::gcRetainMap,"gcRetainMap");
+};
+
+#endif
+
+::hx::Class Internal_obj::__mClass;
+
+static ::String Internal_obj_sStaticFields[] = {
+ HX_("isMainThreadCb",6c,b0,87,f1),
+ HX_("mainThreadWaitLock",03,70,b0,ec),
+ HX_("mainThreadLoopActive",0d,b5,07,81),
+ HX_("mainThreadEndIfNoPending",a1,49,76,fa),
+ HX_("gcRetainMap",1b,1e,df,b6),
+ ::String(null())
+};
+
+void Internal_obj::__register()
+{
+ Internal_obj _hx_dummy;
+ Internal_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("_HaxeCBridge.Internal",04,a9,b2,94);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Internal_obj::__GetStatic;
+ __mClass->mSetStaticField = &Internal_obj::__SetStatic;
+ __mClass->mMarkFunc = Internal_obj_sMarkStatics;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Internal_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< Internal_obj >;
+#ifdef HXCPP_VISIT_ALLOCS
+ __mClass->mVisitFunc = Internal_obj_sVisitStatics;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Internal_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Internal_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void Internal_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_afd834d22acce778_2060_boot)
+HXDLIN(2060) mainThreadLoopActive = true;
+ }
+{
+ HX_STACKFRAME(&_hx_pos_afd834d22acce778_2061_boot)
+HXDLIN(2061) mainThreadEndIfNoPending = false;
+ }
+{
+ HX_STACKFRAME(&_hx_pos_afd834d22acce778_2062_boot)
+HXDLIN(2062) gcRetainMap = ::_HaxeCBridge::Int64Map_Impl__obj::_new();
+ }
+}
+
+} // end namespace _HaxeCBridge
diff --git a/Sources/c_snikket/src/_UnicodeString/UnicodeString_Impl_.cpp b/Sources/c_snikket/src/_UnicodeString/UnicodeString_Impl_.cpp
new file mode 100644
index 0000000..b6a1db1
--- /dev/null
+++ b/Sources/c_snikket/src/_UnicodeString/UnicodeString_Impl_.cpp
@@ -0,0 +1,230 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED__UnicodeString_UnicodeString_Impl_
+#include <_UnicodeString/UnicodeString_Impl_.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_916f2d3bacb9c7fb_149_charAt,"_UnicodeString.UnicodeString_Impl_","charAt",0xef11cb28,"_UnicodeString.UnicodeString_Impl_.charAt","/usr/local/lib/haxe/std/UnicodeString.hx",149,0x872b4b8d)
+HX_LOCAL_STACK_FRAME(_hx_pos_916f2d3bacb9c7fb_320_substr,"_UnicodeString.UnicodeString_Impl_","substr",0xd1a740f0,"_UnicodeString.UnicodeString_Impl_.substr","/usr/local/lib/haxe/std/UnicodeString.hx",320,0x872b4b8d)
+HX_LOCAL_STACK_FRAME(_hx_pos_916f2d3bacb9c7fb_420_get_length,"_UnicodeString.UnicodeString_Impl_","get_length",0x33b0a1ee,"_UnicodeString.UnicodeString_Impl_.get_length","/usr/local/lib/haxe/std/UnicodeString.hx",420,0x872b4b8d)
+namespace _UnicodeString{
+
+void UnicodeString_Impl__obj::__construct() { }
+
+Dynamic UnicodeString_Impl__obj::__CreateEmpty() { return new UnicodeString_Impl__obj; }
+
+void *UnicodeString_Impl__obj::_hx_vtable = 0;
+
+Dynamic UnicodeString_Impl__obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< UnicodeString_Impl__obj > _hx_result = new UnicodeString_Impl__obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool UnicodeString_Impl__obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x699a1cff;
+}
+
+::String UnicodeString_Impl__obj::charAt(::String this1,int index){
+ HX_STACKFRAME(&_hx_pos_916f2d3bacb9c7fb_149_charAt)
+HXLINE( 150) if ((index < 0)) {
+HXLINE( 151) return HX_("",00,00,00,00);
+ }
+HXLINE( 152) int unicodeOffset = 0;
+HXLINE( 153) int nativeOffset = 0;
+HXLINE( 154) while((nativeOffset < this1.length)){
+HXLINE( 155) nativeOffset = (nativeOffset + 1);
+HXDLIN( 155) int index1 = (nativeOffset - 1);
+HXDLIN( 155) int c = this1.cca(index1);
+HXDLIN( 155) bool _hx_tmp;
+HXDLIN( 155) if ((c >= 55296)) {
+HXLINE( 155) _hx_tmp = (c <= 56319);
+ }
+ else {
+HXLINE( 155) _hx_tmp = false;
+ }
+HXDLIN( 155) if (_hx_tmp) {
+HXLINE( 155) c = (((c - 55232) << 10) | (this1.cca((index1 + 1)) & 1023));
+ }
+HXDLIN( 155) int c1 = c;
+HXLINE( 156) if ((unicodeOffset == index)) {
+HXLINE( 157) return ::String::fromCharCode(c1);
+ }
+HXLINE( 159) if ((c1 >= 65536)) {
+HXLINE( 160) nativeOffset = (nativeOffset + 1);
+ }
+HXLINE( 162) unicodeOffset = (unicodeOffset + 1);
+ }
+HXLINE( 164) return HX_("",00,00,00,00);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(UnicodeString_Impl__obj,charAt,return )
+
+::String UnicodeString_Impl__obj::substr(::String this1,int pos, ::Dynamic len){
+ HX_STACKFRAME(&_hx_pos_916f2d3bacb9c7fb_320_substr)
+HXLINE( 321) if ((pos < 0)) {
+HXLINE( 322) pos = (::_UnicodeString::UnicodeString_Impl__obj::get_length(this1) + pos);
+HXLINE( 323) if ((pos < 0)) {
+HXLINE( 324) pos = 0;
+ }
+ }
+HXLINE( 327) if (::hx::IsNotNull( len )) {
+HXLINE( 328) if (::hx::IsLess( len,0 )) {
+HXLINE( 329) len = (::_UnicodeString::UnicodeString_Impl__obj::get_length(this1) + len);
+ }
+HXLINE( 331) if (::hx::IsLessEq( len,0 )) {
+HXLINE( 332) return HX_("",00,00,00,00);
+ }
+ }
+HXLINE( 335) int unicodeOffset = 0;
+HXLINE( 336) int nativeOffset = 0;
+HXLINE( 337) int fromOffset = -1;
+HXLINE( 338) int subLength = 0;
+HXLINE( 339) while((nativeOffset < this1.length)){
+HXLINE( 340) int c = this1.cca(nativeOffset);
+HXDLIN( 340) bool _hx_tmp;
+HXDLIN( 340) if ((c >= 55296)) {
+HXLINE( 340) _hx_tmp = (c <= 56319);
+ }
+ else {
+HXLINE( 340) _hx_tmp = false;
+ }
+HXDLIN( 340) if (_hx_tmp) {
+HXLINE( 340) c = (((c - 55232) << 10) | (this1.cca((nativeOffset + 1)) & 1023));
+ }
+HXDLIN( 340) int c1 = c;
+HXLINE( 342) if ((unicodeOffset >= pos)) {
+HXLINE( 343) if ((fromOffset < 0)) {
+HXLINE( 344) if (::hx::IsNull( len )) {
+HXLINE( 345) return this1.substr(nativeOffset,null());
+ }
+HXLINE( 347) fromOffset = nativeOffset;
+ }
+HXLINE( 349) subLength = (subLength + 1);
+HXLINE( 350) if (::hx::IsGreaterEq( subLength,len )) {
+HXLINE( 351) int lastOffset;
+HXDLIN( 351) if ((c1 < 65536)) {
+HXLINE( 351) lastOffset = nativeOffset;
+ }
+ else {
+HXLINE( 351) lastOffset = (nativeOffset + 1);
+ }
+HXLINE( 352) return this1.substr(fromOffset,((lastOffset - fromOffset) + 1));
+ }
+ }
+HXLINE( 356) int nativeOffset1;
+HXDLIN( 356) if ((c1 >= 65536)) {
+HXLINE( 356) nativeOffset1 = 2;
+ }
+ else {
+HXLINE( 356) nativeOffset1 = 1;
+ }
+HXDLIN( 356) nativeOffset = (nativeOffset + nativeOffset1);
+HXLINE( 357) unicodeOffset = (unicodeOffset + 1);
+ }
+HXLINE( 359) if ((fromOffset < 0)) {
+HXLINE( 359) return HX_("",00,00,00,00);
+ }
+ else {
+HXLINE( 359) return this1.substr(fromOffset,null());
+ }
+HXDLIN( 359) return null();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC3(UnicodeString_Impl__obj,substr,return )
+
+int UnicodeString_Impl__obj::get_length(::String this1){
+ HX_STACKFRAME(&_hx_pos_916f2d3bacb9c7fb_420_get_length)
+HXLINE( 421) int l = 0;
+HXLINE( 422) {
+HXLINE( 422) int _g_offset = 0;
+HXDLIN( 422) ::String _g_s = this1;
+HXDLIN( 422) while((_g_offset < _g_s.length)){
+HXLINE( 422) ::String s = _g_s;
+HXDLIN( 422) _g_offset = (_g_offset + 1);
+HXDLIN( 422) int index = (_g_offset - 1);
+HXDLIN( 422) int c = s.cca(index);
+HXDLIN( 422) bool _hx_tmp;
+HXDLIN( 422) if ((c >= 55296)) {
+HXLINE( 422) _hx_tmp = (c <= 56319);
+ }
+ else {
+HXLINE( 422) _hx_tmp = false;
+ }
+HXDLIN( 422) if (_hx_tmp) {
+HXLINE( 639) c = (((c - 55232) << 10) | (s.cca((index + 1)) & 1023));
+ }
+HXLINE( 422) int c1 = c;
+HXDLIN( 422) if ((c1 >= 65536)) {
+HXLINE( 422) _g_offset = (_g_offset + 1);
+ }
+HXDLIN( 422) int c2 = c1;
+HXLINE( 423) l = (l + 1);
+ }
+ }
+HXLINE( 425) return l;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(UnicodeString_Impl__obj,get_length,return )
+
+
+UnicodeString_Impl__obj::UnicodeString_Impl__obj()
+{
+}
+
+bool UnicodeString_Impl__obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 6:
+ if (HX_FIELD_EQ(inName,"charAt") ) { outValue = charAt_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"substr") ) { outValue = substr_dyn(); return true; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"get_length") ) { outValue = get_length_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *UnicodeString_Impl__obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *UnicodeString_Impl__obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class UnicodeString_Impl__obj::__mClass;
+
+static ::String UnicodeString_Impl__obj_sStaticFields[] = {
+ HX_("charAt",69,79,75,b7),
+ HX_("substr",31,ef,0a,9a),
+ HX_("get_length",af,04,8f,8f),
+ ::String(null())
+};
+
+void UnicodeString_Impl__obj::__register()
+{
+ UnicodeString_Impl__obj _hx_dummy;
+ UnicodeString_Impl__obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("_UnicodeString.UnicodeString_Impl_",cf,cc,3a,6f);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &UnicodeString_Impl__obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(UnicodeString_Impl__obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< UnicodeString_Impl__obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = UnicodeString_Impl__obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = UnicodeString_Impl__obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace _UnicodeString
diff --git a/Sources/c_snikket/src/_Xml/XmlType_Impl_.cpp b/Sources/c_snikket/src/_Xml/XmlType_Impl_.cpp
new file mode 100644
index 0000000..5e98c94
--- /dev/null
+++ b/Sources/c_snikket/src/_Xml/XmlType_Impl_.cpp
@@ -0,0 +1,115 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED__Xml_XmlType_Impl_
+#include <_Xml/XmlType_Impl_.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_ae9d30f993cc7475_65_toString,"_Xml.XmlType_Impl_","toString",0x16b62c3f,"_Xml.XmlType_Impl_.toString","/usr/local/lib/haxe/std/Xml.hx",65,0x5c1024e4)
+namespace _Xml{
+
+void XmlType_Impl__obj::__construct() { }
+
+Dynamic XmlType_Impl__obj::__CreateEmpty() { return new XmlType_Impl__obj; }
+
+void *XmlType_Impl__obj::_hx_vtable = 0;
+
+Dynamic XmlType_Impl__obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< XmlType_Impl__obj > _hx_result = new XmlType_Impl__obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool XmlType_Impl__obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x29df0a39;
+}
+
+::String XmlType_Impl__obj::toString(int this1){
+ HX_STACKFRAME(&_hx_pos_ae9d30f993cc7475_65_toString)
+HXDLIN( 65) switch((int)(this1)){
+ case (int)0: {
+HXLINE( 66) return HX_("Element",9c,d6,a5,d3);
+ }
+ break;
+ case (int)1: {
+HXLINE( 67) return HX_("PCData",bd,3d,a2,bd);
+ }
+ break;
+ case (int)2: {
+HXLINE( 68) return HX_("CData",0d,60,15,c1);
+ }
+ break;
+ case (int)3: {
+HXLINE( 69) return HX_("Comment",3f,a2,c1,4e);
+ }
+ break;
+ case (int)4: {
+HXLINE( 70) return HX_("DocType",32,25,de,a5);
+ }
+ break;
+ case (int)5: {
+HXLINE( 71) return HX_("ProcessingInstruction",db,1e,14,6a);
+ }
+ break;
+ case (int)6: {
+HXLINE( 72) return HX_("Document",3b,ab,c4,74);
+ }
+ break;
+ }
+HXLINE( 65) return null();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(XmlType_Impl__obj,toString,return )
+
+
+XmlType_Impl__obj::XmlType_Impl__obj()
+{
+}
+
+bool XmlType_Impl__obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 8:
+ if (HX_FIELD_EQ(inName,"toString") ) { outValue = toString_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *XmlType_Impl__obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *XmlType_Impl__obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class XmlType_Impl__obj::__mClass;
+
+static ::String XmlType_Impl__obj_sStaticFields[] = {
+ HX_("toString",ac,d0,6e,38),
+ ::String(null())
+};
+
+void XmlType_Impl__obj::__register()
+{
+ XmlType_Impl__obj _hx_dummy;
+ XmlType_Impl__obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("_Xml.XmlType_Impl_",3b,c3,52,59);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &XmlType_Impl__obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(XmlType_Impl__obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< XmlType_Impl__obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = XmlType_Impl__obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = XmlType_Impl__obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace _Xml
diff --git a/Sources/c_snikket/src/__HaxeCBridgeBindings__.cpp b/Sources/c_snikket/src/__HaxeCBridgeBindings__.cpp
new file mode 100644
index 0000000..5b6f6b2
--- /dev/null
+++ b/Sources/c_snikket/src/__HaxeCBridgeBindings__.cpp
@@ -0,0 +1,7043 @@
+/**
+ * HaxeCBridge Function Binding Implementation
+ * Automatically generated by HaxeCBridge
+ */
+#include <hxcpp.h>
+#include <hx/Native.h>
+#include <hx/Thread.h>
+#include <hx/StdLibs.h>
+#include <hx/GC.h>
+#include <HaxeCBridge.h>
+#include <assert.h>
+#include <queue>
+#include <utility>
+#include <atomic>
+
+// include generated bindings header
+// set prefix when exporting dll symbols on windows
+#ifdef _WIN32
+ #define API_PREFIX __declspec(dllexport)
+#endif
+#include "snikket.h"
+
+#define HAXE_C_BRIDGE_LINKAGE HXCPP_EXTERN_CLASS_ATTRIBUTES
+#include <snikket/persistence/MediaStoreFS.h>
+#include <snikket/persistence/Sqlite.h>
+#include <snikket/persistence/MediaStore.h>
+#include <snikket/ChatMessage.h>
+#include <snikket/ChatMessageBuilder.h>
+#include <snikket/ChatAttachment.h>
+#include <snikket/Hash.h>
+#include <snikket/persistence/Dummy.h>
+#include <snikket/Client.h>
+#include <snikket/Persistence.h>
+#include <snikket/AttachmentSource.h>
+#include <snikket/AvailableChat.h>
+#include <snikket/Chat.h>
+#include <snikket/Participant.h>
+#include <snikket/Reaction.h>
+#include <snikket/jingle/DTMFSender.h>
+#include <snikket/jingle/MediaStreamTrack.h>
+#include <snikket/jingle/AudioFormat.h>
+#include <snikket/jingle/InitiatedSession.h>
+#include <snikket/jingle/MediaStream.h>
+#include <snikket/Channel.h>
+#include <snikket/DirectChat.h>
+#include <snikket/CustomEmojiReaction.h>
+
+namespace HaxeCBridgeInternal {
+
+ // we cannot use hxcpps HxCreateDetachedThread() because we cannot wait on these threads to end on unix because they are detached threads
+ #if defined(HX_WINDOWS)
+ HANDLE haxeThreadNativeHandle = nullptr;
+ DWORD haxeThreadNativeId = 0; // 0 is not valid thread id
+ bool createHaxeThread(DWORD (WINAPI *func)(void *), void *param) {
+ haxeThreadNativeHandle = CreateThread(NULL, 0, func, param, 0, &haxeThreadNativeId);
+ return haxeThreadNativeHandle != 0;
+ }
+ bool waitForThreadExit(HANDLE handle) {
+ DWORD result = WaitForSingleObject(handle, INFINITE);
+ return result != WAIT_FAILED;
+ }
+ #else
+ pthread_t haxeThreadNativeHandle;
+ bool createHaxeThread(void *(*func)(void *), void *param) {
+ // same as HxCreateDetachedThread(func, param) but without detaching the thread
+
+ pthread_attr_t attr;
+ if (pthread_attr_init(&attr) != 0)
+ return false;
+ if (pthread_create(&haxeThreadNativeHandle, &attr, func, param) != 0 )
+ return false;
+ if (pthread_attr_destroy(&attr) != 0)
+ return false;
+ return true;
+ }
+ bool waitForThreadExit(pthread_t handle) {
+ int result = pthread_join(handle, NULL);
+ return result == 0;
+ }
+ #endif
+
+ std::atomic<bool> threadStarted = { false };
+ std::atomic<bool> threadRunning = { false };
+ // once haxe statics are initialized we cannot clear them for a clean restart
+ std::atomic<bool> staticsInitialized = { false };
+
+ struct HaxeThreadData {
+ snikket_panic_callback haxeExceptionCallback;
+ const char* initExceptionInfo;
+ };
+
+ HxSemaphore threadInitSemaphore;
+ HxMutex threadManageMutex;
+
+ void defaultExceptionHandler(const char* info) {
+ printf("Unhandled haxe exception: %s\n", info);
+ }
+
+ typedef void (* MainThreadCallback)(void* data);
+ HxMutex queueMutex;
+ std::queue<std::pair<MainThreadCallback, void*>> queue;
+
+ void runInMainThread(MainThreadCallback callback, void* data) {
+ queueMutex.Lock();
+ queue.push(std::make_pair(callback, data));
+ queueMutex.Unlock();
+ HaxeCBridge::wakeMainThread();
+ }
+
+ // called on the haxe main thread
+ void processNativeCalls() {
+ AutoLock lock(queueMutex);
+ while(!queue.empty()) {
+ std::pair<MainThreadCallback, void*> pair = queue.front();
+ queue.pop();
+ pair.first(pair.second);
+ }
+ }
+
+ #if defined(HX_WINDOWS)
+ bool isHaxeMainThread() {
+ return threadRunning &&
+ (GetCurrentThreadId() == haxeThreadNativeId) &&
+ (haxeThreadNativeId != 0);
+ }
+ #else
+ bool isHaxeMainThread() {
+ return threadRunning && pthread_equal(haxeThreadNativeHandle, pthread_self());
+ }
+ #endif
+}
+
+THREAD_FUNC_TYPE haxeMainThreadFunc(void *data) {
+ HX_TOP_OF_STACK
+ HaxeCBridgeInternal::HaxeThreadData* threadData = (HaxeCBridgeInternal::HaxeThreadData*) data;
+
+ HaxeCBridgeInternal::threadRunning = true;
+
+ threadData->initExceptionInfo = nullptr;
+
+ // copy out callback
+ snikket_panic_callback haxeExceptionCallback = threadData->haxeExceptionCallback;
+
+ bool firstRun = !HaxeCBridgeInternal::staticsInitialized;
+
+ // See hx::Init in StdLibs.cpp for reference
+ if (!HaxeCBridgeInternal::staticsInitialized) try {
+ ::hx::Boot();
+ __boot_all();
+ HaxeCBridgeInternal::staticsInitialized = true;
+ } catch(Dynamic initException) {
+ // hxcpp init failure or uncaught haxe runtime exception
+ threadData->initExceptionInfo = initException->toString().utf8_str();
+ }
+
+ if (HaxeCBridgeInternal::staticsInitialized) { // initialized without error
+ // blocks running the event loop
+ // keeps alive until manual stop is called
+ HaxeCBridge::mainThreadInit(HaxeCBridgeInternal::isHaxeMainThread);
+ HaxeCBridgeInternal::threadInitSemaphore.Set();
+ HaxeCBridge::mainThreadRun(HaxeCBridgeInternal::processNativeCalls, haxeExceptionCallback);
+ } else {
+ // failed to initialize statics; unlock init semaphore so _initializeHaxeThread can continue and report the exception
+ HaxeCBridgeInternal::threadInitSemaphore.Set();
+ }
+
+ HaxeCBridgeInternal::threadRunning = false;
+
+ THREAD_FUNC_RET
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char* snikket_setup(snikket_panic_callback unhandledExceptionCallback) {
+ HaxeCBridgeInternal::HaxeThreadData threadData;
+ threadData.haxeExceptionCallback = unhandledExceptionCallback == nullptr ? HaxeCBridgeInternal::defaultExceptionHandler : unhandledExceptionCallback;
+ threadData.initExceptionInfo = nullptr;
+
+ {
+ // mutex prevents two threads calling this function from being able to start two haxe threads
+ AutoLock lock(HaxeCBridgeInternal::threadManageMutex);
+ if (!HaxeCBridgeInternal::threadStarted) {
+ // startup the haxe main thread
+ HaxeCBridgeInternal::createHaxeThread(haxeMainThreadFunc, &threadData);
+
+ HaxeCBridgeInternal::threadStarted = true;
+
+ // wait until the thread is initialized and ready
+ HaxeCBridgeInternal::threadInitSemaphore.Wait();
+ } else {
+ threadData.initExceptionInfo = "haxe thread cannot be started twice";
+ }
+ }
+
+ if (threadData.initExceptionInfo != nullptr) {
+ snikket_stop(false);
+
+ const int returnInfoMax = 1024;
+ static char returnInfo[returnInfoMax] = ""; // statically allocated for return safety
+ strncpy(returnInfo, threadData.initExceptionInfo, returnInfoMax);
+ return returnInfo;
+ } else {
+ return nullptr;
+ }
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_stop(bool waitOnScheduledEvents) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ // it is possible for stopHaxeThread to be called from within the haxe thread, while another thread is waiting on for the thread to end
+ // so it is important the haxe thread does not wait on certain locks
+ HaxeCBridge::endMainThread(waitOnScheduledEvents);
+ } else {
+ AutoLock lock(HaxeCBridgeInternal::threadManageMutex);
+ if (HaxeCBridgeInternal::threadRunning) {
+ struct Callback {
+ static void run(void* data) {
+ bool* b = (bool*) data;
+ HaxeCBridge::endMainThread(*b);
+ }
+ };
+
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &waitOnScheduledEvents);
+
+ HaxeCBridgeInternal::waitForThreadExit(HaxeCBridgeInternal::haxeThreadNativeHandle);
+ }
+ }
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_release(const void* ptr) {
+ struct Callback {
+ static void run(void* data) {
+ HaxeCBridge::releaseHaxePtr(data);
+ }
+ };
+ HaxeCBridgeInternal::runInMainThread(Callback::run, (void*)ptr);
+}
+HAXE_C_BRIDGE_LINKAGE
+void *snikket_persistence_media_store_f_s_new(const char *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeObject(snikket::persistence::MediaStoreFS_obj::__new(a0));
+ }
+ struct Data {
+ struct {const char * a0;} args;
+ HxSemaphore lock;
+ void * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeObject(snikket::persistence::MediaStoreFS_obj::__new(data->args.a0));
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute new() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_persistence_media_store_f_s_get_media_path(void *a0, const char *a1, void (*a2) (const char*, void*), void *a3) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::persistence::MediaStoreFS((hx::Object *)a0, true))->getMediaPath__fromC(a1, cpp::Function<void(const char*, void*)>(a2), a3);
+ }
+ struct Data {
+ struct {void * a0; const char * a1; void (* a2) (const char*, void*); void* a3;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::persistence::MediaStoreFS((hx::Object *)data->args.a0, true))->getMediaPath__fromC(data->args.a1, cpp::Function<void(const char*, void*)>(data->args.a2), data->args.a3);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2, a3} };
+
+ // queue a callback to execute getMediaPath__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void *snikket_persistence_sqlite_new(const char *a0, void *a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeObject(snikket::persistence::Sqlite_obj::__new(a0, Dynamic((hx::Object *)a1)));
+ }
+ struct Data {
+ struct {const char * a0; void * a1;} args;
+ HxSemaphore lock;
+ void * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeObject(snikket::persistence::Sqlite_obj::__new(data->args.a0, Dynamic((hx::Object *)data->args.a1)));
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute new() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_persistence_sqlite_get_message(void *a0, const char *a1, const char *a2, const char *a3, const char *a4, void (*a5) (void*, void*), void *a6) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::persistence::Sqlite((hx::Object *)a0, true))->getMessage__fromC(a1, a2, a3, a4, cpp::Function<void(void*, void*)>(a5), a6);
+ }
+ struct Data {
+ struct {void * a0; const char * a1; const char * a2; const char * a3; const char * a4; void (* a5) (void*, void*); void* a6;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::persistence::Sqlite((hx::Object *)data->args.a0, true))->getMessage__fromC(data->args.a1, data->args.a2, data->args.a3, data->args.a4, cpp::Function<void(void*, void*)>(data->args.a5), data->args.a6);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2, a3, a4, a5, a6} };
+
+ // queue a callback to execute getMessage__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_persistence_sqlite_remove_account(void *a0, const char *a1, bool a2) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::persistence::Sqlite((hx::Object *)a0, true))->removeAccount(a1, a2);
+ }
+ struct Data {
+ struct {void * a0; const char * a1; bool a2;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::persistence::Sqlite((hx::Object *)data->args.a0, true))->removeAccount(data->args.a1, data->args.a2);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2} };
+
+ // queue a callback to execute removeAccount() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_persistence_sqlite_list_accounts(void *a0, void (*a1) (const char**, size_t, void*), void *a2) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::persistence::Sqlite((hx::Object *)a0, true))->listAccounts__fromC(cpp::Function<void(const char**, size_t, void*)>(a1), a2);
+ }
+ struct Data {
+ struct {void * a0; void (* a1) (const char**, size_t, void*); void* a2;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::persistence::Sqlite((hx::Object *)data->args.a0, true))->listAccounts__fromC(cpp::Function<void(const char**, size_t, void*)>(data->args.a1), data->args.a2);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2} };
+
+ // queue a callback to execute listAccounts__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_message_local_id(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)a0, true))->localId__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)data->args.a0, true))->localId__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute localId__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_message_server_id(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)a0, true))->serverId__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)data->args.a0, true))->serverId__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute serverId__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_message_server_id_by(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)a0, true))->serverIdBy__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)data->args.a0, true))->serverIdBy__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute serverIdBy__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+enum snikket_message_type snikket_chat_message_type(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return static_cast<enum snikket_message_type>((snikket::ChatMessage((hx::Object *)a0, true))->type__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ enum snikket_message_type ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = static_cast<enum snikket_message_type>((snikket::ChatMessage((hx::Object *)data->args.a0, true))->type__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute type__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_message_timestamp(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)a0, true))->timestamp__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)data->args.a0, true))->timestamp__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute timestamp__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_message_sender_id(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)a0, true))->senderId__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)data->args.a0, true))->senderId__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute senderId__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void *snikket_chat_message_reply_to_message(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeObject((snikket::ChatMessage((hx::Object *)a0, true))->replyToMessage__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ void * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeObject((snikket::ChatMessage((hx::Object *)data->args.a0, true))->replyToMessage__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute replyToMessage__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_message_thread_id(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)a0, true))->threadId__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)data->args.a0, true))->threadId__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute threadId__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+size_t snikket_chat_message_attachments(void *a0, void ***a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::ChatMessage((hx::Object *)a0, true))->attachments__fromC(a1);
+ }
+ struct Data {
+ struct {void * a0; void*** a1;} args;
+ HxSemaphore lock;
+ size_t ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::ChatMessage((hx::Object *)data->args.a0, true))->attachments__fromC(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute attachments__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_message_text(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)a0, true))->text__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)data->args.a0, true))->text__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute text__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_message_lang(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)a0, true))->lang__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)data->args.a0, true))->lang__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute lang__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+enum snikket_message_direction snikket_chat_message_direction(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return static_cast<enum snikket_message_direction>((snikket::ChatMessage((hx::Object *)a0, true))->direction__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ enum snikket_message_direction ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = static_cast<enum snikket_message_direction>((snikket::ChatMessage((hx::Object *)data->args.a0, true))->direction__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute direction__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+enum snikket_message_status snikket_chat_message_status(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return static_cast<enum snikket_message_status>((snikket::ChatMessage((hx::Object *)a0, true))->status__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ enum snikket_message_status ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = static_cast<enum snikket_message_status>((snikket::ChatMessage((hx::Object *)data->args.a0, true))->status__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute status__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_message_set_status(void *a0, enum snikket_message_status a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::ChatMessage((hx::Object *)a0, true))->set_status__fromC(a1);
+ }
+ struct Data {
+ struct {void * a0; enum snikket_message_status a1;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::ChatMessage((hx::Object *)data->args.a0, true))->set_status__fromC(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute set_status__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+size_t snikket_chat_message_versions(void *a0, void ***a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::ChatMessage((hx::Object *)a0, true))->versions__fromC(a1);
+ }
+ struct Data {
+ struct {void * a0; void*** a1;} args;
+ HxSemaphore lock;
+ size_t ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::ChatMessage((hx::Object *)data->args.a0, true))->versions__fromC(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute versions__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void *snikket_chat_message_reply(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeObject((snikket::ChatMessage((hx::Object *)a0, true))->reply());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ void * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeObject((snikket::ChatMessage((hx::Object *)data->args.a0, true))->reply());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute reply() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_message_get_reply_id(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)a0, true))->getReplyId());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)data->args.a0, true))->getReplyId());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute getReplyId() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_message_html(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)a0, true))->html());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)data->args.a0, true))->html());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute html() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_message_chat_id(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)a0, true))->chatId());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)data->args.a0, true))->chatId());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute chatId() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_message_account(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)a0, true))->account());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)data->args.a0, true))->account());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute account() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+bool snikket_chat_message_is_incoming(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::ChatMessage((hx::Object *)a0, true))->isIncoming();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ bool ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::ChatMessage((hx::Object *)data->args.a0, true))->isIncoming();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute isIncoming() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_message_thread_icon(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)a0, true))->threadIcon());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)data->args.a0, true))->threadIcon());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute threadIcon() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_message_call_status(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)a0, true))->callStatus());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)data->args.a0, true))->callStatus());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute callStatus() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_message_call_sid(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)a0, true))->callSid());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)data->args.a0, true))->callSid());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute callSid() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_message_call_duration(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)a0, true))->callDuration());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::ChatMessage((hx::Object *)data->args.a0, true))->callDuration());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute callDuration() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void *snikket_chat_attachment_create(const char *a0, const char *a1, int a2, const char *a3) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeObject(snikket::ChatAttachment_obj::create(a0, a1, a2, a3));
+ }
+ struct Data {
+ struct {const char * a0; const char * a1; int a2; const char * a3;} args;
+ HxSemaphore lock;
+ void * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeObject(snikket::ChatAttachment_obj::create(data->args.a0, data->args.a1, data->args.a2, data->args.a3));
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2, a3} };
+
+ // queue a callback to execute create() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_attachment_name(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::ChatAttachment((hx::Object *)a0, true))->name__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::ChatAttachment((hx::Object *)data->args.a0, true))->name__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute name__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_attachment_mime(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::ChatAttachment((hx::Object *)a0, true))->mime__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::ChatAttachment((hx::Object *)data->args.a0, true))->mime__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute mime__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+int snikket_chat_attachment_size(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::ChatAttachment((hx::Object *)a0, true))->size__fromC();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ int ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::ChatAttachment((hx::Object *)data->args.a0, true))->size__fromC();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute size__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+size_t snikket_chat_attachment_uris(void *a0, const char ***a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::ChatAttachment((hx::Object *)a0, true))->uris__fromC(a1);
+ }
+ struct Data {
+ struct {void * a0; const char*** a1;} args;
+ HxSemaphore lock;
+ size_t ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::ChatAttachment((hx::Object *)data->args.a0, true))->uris__fromC(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute uris__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+size_t snikket_chat_attachment_hashes(void *a0, void ***a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::ChatAttachment((hx::Object *)a0, true))->hashes__fromC(a1);
+ }
+ struct Data {
+ struct {void * a0; void*** a1;} args;
+ HxSemaphore lock;
+ size_t ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::ChatAttachment((hx::Object *)data->args.a0, true))->hashes__fromC(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute hashes__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void *snikket_hash_from_hex(const char *a0, const char *a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeObject(snikket::Hash_obj::fromHex(a0, a1));
+ }
+ struct Data {
+ struct {const char * a0; const char * a1;} args;
+ HxSemaphore lock;
+ void * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeObject(snikket::Hash_obj::fromHex(data->args.a0, data->args.a1));
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute fromHex() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void *snikket_hash_from_uri(const char *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeObject(snikket::Hash_obj::fromUri(a0));
+ }
+ struct Data {
+ struct {const char * a0;} args;
+ HxSemaphore lock;
+ void * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeObject(snikket::Hash_obj::fromUri(data->args.a0));
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute fromUri() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_hash_algorithm(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::Hash((hx::Object *)a0, true))->algorithm__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::Hash((hx::Object *)data->args.a0, true))->algorithm__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute algorithm__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_hash_to_uri(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::Hash((hx::Object *)a0, true))->toUri());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::Hash((hx::Object *)data->args.a0, true))->toUri());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute toUri() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_hash_to_hex(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::Hash((hx::Object *)a0, true))->toHex());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::Hash((hx::Object *)data->args.a0, true))->toHex());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute toHex() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_hash_to_base_64(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::Hash((hx::Object *)a0, true))->toBase64());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::Hash((hx::Object *)data->args.a0, true))->toBase64());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute toBase64() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_hash_to_base_64_url(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::Hash((hx::Object *)a0, true))->toBase64Url());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::Hash((hx::Object *)data->args.a0, true))->toBase64Url());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute toBase64Url() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void *snikket_chat_message_builder_new() {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeObject(snikket::ChatMessageBuilder_obj::__new());
+ }
+ struct Data {
+ struct {} args;
+ HxSemaphore lock;
+ void * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeObject(snikket::ChatMessageBuilder_obj::__new());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {} };
+
+ // queue a callback to execute new() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_message_builder_local_id(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::ChatMessageBuilder((hx::Object *)a0, true))->localId__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->localId__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute localId__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_message_builder_set_local_id(void *a0, const char *a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::ChatMessageBuilder((hx::Object *)a0, true))->set_localId__fromC(a1);
+ }
+ struct Data {
+ struct {void * a0; const char * a1;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->set_localId__fromC(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute set_localId__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_message_builder_server_id(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::ChatMessageBuilder((hx::Object *)a0, true))->serverId__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->serverId__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute serverId__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_message_builder_set_server_id(void *a0, const char *a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::ChatMessageBuilder((hx::Object *)a0, true))->set_serverId__fromC(a1);
+ }
+ struct Data {
+ struct {void * a0; const char * a1;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->set_serverId__fromC(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute set_serverId__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_message_builder_server_id_by(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::ChatMessageBuilder((hx::Object *)a0, true))->serverIdBy__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->serverIdBy__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute serverIdBy__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_message_builder_set_server_id_by(void *a0, const char *a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::ChatMessageBuilder((hx::Object *)a0, true))->set_serverIdBy__fromC(a1);
+ }
+ struct Data {
+ struct {void * a0; const char * a1;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->set_serverIdBy__fromC(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute set_serverIdBy__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+enum snikket_message_type snikket_chat_message_builder_type(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return static_cast<enum snikket_message_type>((snikket::ChatMessageBuilder((hx::Object *)a0, true))->type__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ enum snikket_message_type ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = static_cast<enum snikket_message_type>((snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->type__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute type__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_message_builder_set_type(void *a0, enum snikket_message_type a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::ChatMessageBuilder((hx::Object *)a0, true))->set_type__fromC(a1);
+ }
+ struct Data {
+ struct {void * a0; enum snikket_message_type a1;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->set_type__fromC(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute set_type__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_message_builder_timestamp(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::ChatMessageBuilder((hx::Object *)a0, true))->timestamp__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->timestamp__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute timestamp__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_message_builder_set_timestamp(void *a0, const char *a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::ChatMessageBuilder((hx::Object *)a0, true))->set_timestamp__fromC(a1);
+ }
+ struct Data {
+ struct {void * a0; const char * a1;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->set_timestamp__fromC(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute set_timestamp__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_message_builder_sender_id(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::ChatMessageBuilder((hx::Object *)a0, true))->senderId__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->senderId__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute senderId__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_message_builder_set_sender_id(void *a0, const char *a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::ChatMessageBuilder((hx::Object *)a0, true))->set_senderId__fromC(a1);
+ }
+ struct Data {
+ struct {void * a0; const char * a1;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->set_senderId__fromC(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute set_senderId__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void *snikket_chat_message_builder_reply_to_message(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeObject((snikket::ChatMessageBuilder((hx::Object *)a0, true))->replyToMessage__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ void * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeObject((snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->replyToMessage__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute replyToMessage__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_message_builder_set_reply_to_message(void *a0, void *a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::ChatMessageBuilder((hx::Object *)a0, true))->set_replyToMessage__fromC(Dynamic((hx::Object *)a1));
+ }
+ struct Data {
+ struct {void * a0; void * a1;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->set_replyToMessage__fromC(Dynamic((hx::Object *)data->args.a1));
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute set_replyToMessage__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_message_builder_thread_id(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::ChatMessageBuilder((hx::Object *)a0, true))->threadId__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->threadId__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute threadId__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_message_builder_set_thread_id(void *a0, const char *a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::ChatMessageBuilder((hx::Object *)a0, true))->set_threadId__fromC(a1);
+ }
+ struct Data {
+ struct {void * a0; const char * a1;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->set_threadId__fromC(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute set_threadId__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+size_t snikket_chat_message_builder_attachments(void *a0, void ***a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::ChatMessageBuilder((hx::Object *)a0, true))->attachments__fromC(a1);
+ }
+ struct Data {
+ struct {void * a0; void*** a1;} args;
+ HxSemaphore lock;
+ size_t ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->attachments__fromC(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute attachments__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_message_builder_text(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::ChatMessageBuilder((hx::Object *)a0, true))->text__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->text__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute text__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_message_builder_set_text(void *a0, const char *a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::ChatMessageBuilder((hx::Object *)a0, true))->set_text__fromC(a1);
+ }
+ struct Data {
+ struct {void * a0; const char * a1;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->set_text__fromC(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute set_text__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_message_builder_lang(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::ChatMessageBuilder((hx::Object *)a0, true))->lang__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->lang__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute lang__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_message_builder_set_lang(void *a0, const char *a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::ChatMessageBuilder((hx::Object *)a0, true))->set_lang__fromC(a1);
+ }
+ struct Data {
+ struct {void * a0; const char * a1;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->set_lang__fromC(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute set_lang__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+enum snikket_message_direction snikket_chat_message_builder_direction(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return static_cast<enum snikket_message_direction>((snikket::ChatMessageBuilder((hx::Object *)a0, true))->direction__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ enum snikket_message_direction ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = static_cast<enum snikket_message_direction>((snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->direction__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute direction__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_message_builder_set_direction(void *a0, enum snikket_message_direction a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::ChatMessageBuilder((hx::Object *)a0, true))->set_direction__fromC(a1);
+ }
+ struct Data {
+ struct {void * a0; enum snikket_message_direction a1;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->set_direction__fromC(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute set_direction__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+enum snikket_message_status snikket_chat_message_builder_status(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return static_cast<enum snikket_message_status>((snikket::ChatMessageBuilder((hx::Object *)a0, true))->status__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ enum snikket_message_status ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = static_cast<enum snikket_message_status>((snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->status__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute status__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_message_builder_set_status(void *a0, enum snikket_message_status a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::ChatMessageBuilder((hx::Object *)a0, true))->set_status__fromC(a1);
+ }
+ struct Data {
+ struct {void * a0; enum snikket_message_status a1;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->set_status__fromC(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute set_status__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+size_t snikket_chat_message_builder_versions(void *a0, void ***a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::ChatMessageBuilder((hx::Object *)a0, true))->versions__fromC(a1);
+ }
+ struct Data {
+ struct {void * a0; void*** a1;} args;
+ HxSemaphore lock;
+ size_t ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->versions__fromC(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute versions__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_message_builder_add_attachment(void *a0, void *a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::ChatMessageBuilder((hx::Object *)a0, true))->addAttachment(Dynamic((hx::Object *)a1));
+ }
+ struct Data {
+ struct {void * a0; void * a1;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->addAttachment(Dynamic((hx::Object *)data->args.a1));
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute addAttachment() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_message_builder_set_html(void *a0, const char *a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::ChatMessageBuilder((hx::Object *)a0, true))->setHtml(a1);
+ }
+ struct Data {
+ struct {void * a0; const char * a1;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->setHtml(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute setHtml() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_message_builder_chat_id(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::ChatMessageBuilder((hx::Object *)a0, true))->chatId());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->chatId());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute chatId() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_message_builder_get_sender_id(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::ChatMessageBuilder((hx::Object *)a0, true))->get_senderId());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->get_senderId());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute get_senderId() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+bool snikket_chat_message_builder_is_incoming(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::ChatMessageBuilder((hx::Object *)a0, true))->isIncoming();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ bool ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->isIncoming();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute isIncoming() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void *snikket_chat_message_builder_build(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeObject((snikket::ChatMessageBuilder((hx::Object *)a0, true))->build());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ void * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeObject((snikket::ChatMessageBuilder((hx::Object *)data->args.a0, true))->build());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute build() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void *snikket_persistence_dummy_new() {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeObject(snikket::persistence::Dummy_obj::__new());
+ }
+ struct Data {
+ struct {} args;
+ HxSemaphore lock;
+ void * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeObject(snikket::persistence::Dummy_obj::__new());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {} };
+
+ // queue a callback to execute new() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void *snikket_client_new(const char *a0, void *a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeObject(snikket::Client_obj::__new(a0, Dynamic((hx::Object *)a1)));
+ }
+ struct Data {
+ struct {const char * a0; void * a1;} args;
+ HxSemaphore lock;
+ void * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeObject(snikket::Client_obj::__new(data->args.a0, Dynamic((hx::Object *)data->args.a1)));
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute new() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_client_set_send_available(void *a0, bool a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Client((hx::Object *)a0, true))->set_sendAvailable__fromC(a1);
+ }
+ struct Data {
+ struct {void * a0; bool a1;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Client((hx::Object *)data->args.a0, true))->set_sendAvailable__fromC(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute set_sendAvailable__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_client_start(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Client((hx::Object *)a0, true))->start();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Client((hx::Object *)data->args.a0, true))->start();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute start() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_client_logout(void *a0, bool a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Client((hx::Object *)a0, true))->logout(a1);
+ }
+ struct Data {
+ struct {void * a0; bool a1;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Client((hx::Object *)data->args.a0, true))->logout(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute logout() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_client_use_password(void *a0, const char *a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Client((hx::Object *)a0, true))->usePassword(a1);
+ }
+ struct Data {
+ struct {void * a0; const char * a1;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Client((hx::Object *)data->args.a0, true))->usePassword(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute usePassword() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_client_account_id(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::Client((hx::Object *)a0, true))->accountId());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::Client((hx::Object *)data->args.a0, true))->accountId());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute accountId() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_client_display_name(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::Client((hx::Object *)a0, true))->displayName());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::Client((hx::Object *)data->args.a0, true))->displayName());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute displayName() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_client_set_display_name(void *a0, const char *a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Client((hx::Object *)a0, true))->setDisplayName(a1);
+ }
+ struct Data {
+ struct {void * a0; const char * a1;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Client((hx::Object *)data->args.a0, true))->setDisplayName(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute setDisplayName() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_client_prepare_attachment(void *a0, void *a1, void (*a2) (void*, void*), void *a3) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Client((hx::Object *)a0, true))->prepareAttachment__fromC(Dynamic((hx::Object *)a1), cpp::Function<void(void*, void*)>(a2), a3);
+ }
+ struct Data {
+ struct {void * a0; void * a1; void (* a2) (void*, void*); void* a3;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Client((hx::Object *)data->args.a0, true))->prepareAttachment__fromC(Dynamic((hx::Object *)data->args.a1), cpp::Function<void(void*, void*)>(data->args.a2), data->args.a3);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2, a3} };
+
+ // queue a callback to execute prepareAttachment__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+size_t snikket_client_get_chats(void *a0, void ***a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Client((hx::Object *)a0, true))->getChats__fromC(a1);
+ }
+ struct Data {
+ struct {void * a0; void*** a1;} args;
+ HxSemaphore lock;
+ size_t ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::Client((hx::Object *)data->args.a0, true))->getChats__fromC(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute getChats__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_client_find_available_chats(void *a0, const char *a1, void (*a2) (const char*, void**, size_t, void*), void *a3) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Client((hx::Object *)a0, true))->findAvailableChats__fromC(a1, cpp::Function<void(const char*, void**, size_t, void*)>(a2), a3);
+ }
+ struct Data {
+ struct {void * a0; const char * a1; void (* a2) (const char*, void**, size_t, void*); void* a3;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Client((hx::Object *)data->args.a0, true))->findAvailableChats__fromC(data->args.a1, cpp::Function<void(const char*, void**, size_t, void*)>(data->args.a2), data->args.a3);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2, a3} };
+
+ // queue a callback to execute findAvailableChats__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void *snikket_client_start_chat(void *a0, void *a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeObject((snikket::Client((hx::Object *)a0, true))->startChat(Dynamic((hx::Object *)a1)));
+ }
+ struct Data {
+ struct {void * a0; void * a1;} args;
+ HxSemaphore lock;
+ void * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeObject((snikket::Client((hx::Object *)data->args.a0, true))->startChat(Dynamic((hx::Object *)data->args.a1)));
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute startChat() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void *snikket_client_get_chat(void *a0, const char *a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeObject((snikket::Client((hx::Object *)a0, true))->getChat(a1));
+ }
+ struct Data {
+ struct {void * a0; const char * a1;} args;
+ HxSemaphore lock;
+ void * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeObject((snikket::Client((hx::Object *)data->args.a0, true))->getChat(data->args.a1));
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute getChat() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_client_add_password_needed_listener(void *a0, void (*a1) (void*, void*), void *a2) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Client((hx::Object *)a0, true))->addPasswordNeededListener__fromC(cpp::Function<void(void*, void*)>(a1), a2);
+ }
+ struct Data {
+ struct {void * a0; void (* a1) (void*, void*); void* a2;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Client((hx::Object *)data->args.a0, true))->addPasswordNeededListener__fromC(cpp::Function<void(void*, void*)>(data->args.a1), data->args.a2);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2} };
+
+ // queue a callback to execute addPasswordNeededListener__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_client_add_status_online_listener(void *a0, void (*a1) (void*), void *a2) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Client((hx::Object *)a0, true))->addStatusOnlineListener__fromC(cpp::Function<void(void*)>(a1), a2);
+ }
+ struct Data {
+ struct {void * a0; void (* a1) (void*); void* a2;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Client((hx::Object *)data->args.a0, true))->addStatusOnlineListener__fromC(cpp::Function<void(void*)>(data->args.a1), data->args.a2);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2} };
+
+ // queue a callback to execute addStatusOnlineListener__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_client_add_status_offline_listener(void *a0, void (*a1) (void*), void *a2) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Client((hx::Object *)a0, true))->addStatusOfflineListener__fromC(cpp::Function<void(void*)>(a1), a2);
+ }
+ struct Data {
+ struct {void * a0; void (* a1) (void*); void* a2;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Client((hx::Object *)data->args.a0, true))->addStatusOfflineListener__fromC(cpp::Function<void(void*)>(data->args.a1), data->args.a2);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2} };
+
+ // queue a callback to execute addStatusOfflineListener__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_client_add_connection_failed_listener(void *a0, void (*a1) (void*), void *a2) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Client((hx::Object *)a0, true))->addConnectionFailedListener__fromC(cpp::Function<void(void*)>(a1), a2);
+ }
+ struct Data {
+ struct {void * a0; void (* a1) (void*); void* a2;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Client((hx::Object *)data->args.a0, true))->addConnectionFailedListener__fromC(cpp::Function<void(void*)>(data->args.a1), data->args.a2);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2} };
+
+ // queue a callback to execute addConnectionFailedListener__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_client_add_chat_message_listener(void *a0, void (*a1) (void*, int, void*), void *a2) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Client((hx::Object *)a0, true))->addChatMessageListener__fromC(cpp::Function<void(void*, int, void*)>(a1), a2);
+ }
+ struct Data {
+ struct {void * a0; void (* a1) (void*, int, void*); void* a2;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Client((hx::Object *)data->args.a0, true))->addChatMessageListener__fromC(cpp::Function<void(void*, int, void*)>(data->args.a1), data->args.a2);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2} };
+
+ // queue a callback to execute addChatMessageListener__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_client_add_sync_message_listener(void *a0, void (*a1) (void*, void*), void *a2) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Client((hx::Object *)a0, true))->addSyncMessageListener__fromC(cpp::Function<void(void*, void*)>(a1), a2);
+ }
+ struct Data {
+ struct {void * a0; void (* a1) (void*, void*); void* a2;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Client((hx::Object *)data->args.a0, true))->addSyncMessageListener__fromC(cpp::Function<void(void*, void*)>(data->args.a1), data->args.a2);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2} };
+
+ // queue a callback to execute addSyncMessageListener__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_client_add_chats_updated_listener(void *a0, void (*a1) (void**, size_t, void*), void *a2) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Client((hx::Object *)a0, true))->addChatsUpdatedListener__fromC(cpp::Function<void(void**, size_t, void*)>(a1), a2);
+ }
+ struct Data {
+ struct {void * a0; void (* a1) (void**, size_t, void*); void* a2;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Client((hx::Object *)data->args.a0, true))->addChatsUpdatedListener__fromC(cpp::Function<void(void**, size_t, void*)>(data->args.a1), data->args.a2);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2} };
+
+ // queue a callback to execute addChatsUpdatedListener__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_client_add_call_ring_listener(void *a0, void (*a1) (void*, const char*, void*), void *a2) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Client((hx::Object *)a0, true))->addCallRingListener__fromC(cpp::Function<void(void*, const char*, void*)>(a1), a2);
+ }
+ struct Data {
+ struct {void * a0; void (* a1) (void*, const char*, void*); void* a2;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Client((hx::Object *)data->args.a0, true))->addCallRingListener__fromC(cpp::Function<void(void*, const char*, void*)>(data->args.a1), data->args.a2);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2} };
+
+ // queue a callback to execute addCallRingListener__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_client_add_call_retract_listener(void *a0, void (*a1) (const char*, void*), void *a2) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Client((hx::Object *)a0, true))->addCallRetractListener__fromC(cpp::Function<void(const char*, void*)>(a1), a2);
+ }
+ struct Data {
+ struct {void * a0; void (* a1) (const char*, void*); void* a2;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Client((hx::Object *)data->args.a0, true))->addCallRetractListener__fromC(cpp::Function<void(const char*, void*)>(data->args.a1), data->args.a2);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2} };
+
+ // queue a callback to execute addCallRetractListener__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_client_add_call_ringing_listener(void *a0, void (*a1) (const char*, void*), void *a2) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Client((hx::Object *)a0, true))->addCallRingingListener__fromC(cpp::Function<void(const char*, void*)>(a1), a2);
+ }
+ struct Data {
+ struct {void * a0; void (* a1) (const char*, void*); void* a2;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Client((hx::Object *)data->args.a0, true))->addCallRingingListener__fromC(cpp::Function<void(const char*, void*)>(data->args.a1), data->args.a2);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2} };
+
+ // queue a callback to execute addCallRingingListener__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_client_add_call_media_listener(void *a0, void (*a1) (void*, bool, bool, void*), void *a2) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Client((hx::Object *)a0, true))->addCallMediaListener__fromC(cpp::Function<void(void*, bool, bool, void*)>(a1), a2);
+ }
+ struct Data {
+ struct {void * a0; void (* a1) (void*, bool, bool, void*); void* a2;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Client((hx::Object *)data->args.a0, true))->addCallMediaListener__fromC(cpp::Function<void(void*, bool, bool, void*)>(data->args.a1), data->args.a2);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2} };
+
+ // queue a callback to execute addCallMediaListener__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_client_add_call_track_listener(void *a0, void (*a1) (const char*, void*, void**, size_t, void*), void *a2) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Client((hx::Object *)a0, true))->addCallTrackListener__fromC(cpp::Function<void(const char*, void*, void**, size_t, void*)>(a1), a2);
+ }
+ struct Data {
+ struct {void * a0; void (* a1) (const char*, void*, void**, size_t, void*); void* a2;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Client((hx::Object *)data->args.a0, true))->addCallTrackListener__fromC(cpp::Function<void(const char*, void*, void**, size_t, void*)>(data->args.a1), data->args.a2);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2} };
+
+ // queue a callback to execute addCallTrackListener__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_client_set_in_foreground(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Client((hx::Object *)a0, true))->setInForeground();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Client((hx::Object *)data->args.a0, true))->setInForeground();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute setInForeground() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_client_set_not_in_foreground(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Client((hx::Object *)a0, true))->setNotInForeground();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Client((hx::Object *)data->args.a0, true))->setNotInForeground();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute setNotInForeground() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_chat_id(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::Chat((hx::Object *)a0, true))->chatId__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::Chat((hx::Object *)data->args.a0, true))->chatId__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute chatId__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+enum snikket_ui_state snikket_chat_ui_state(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return static_cast<enum snikket_ui_state>((snikket::Chat((hx::Object *)a0, true))->uiState__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ enum snikket_ui_state ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = static_cast<enum snikket_ui_state>((snikket::Chat((hx::Object *)data->args.a0, true))->uiState__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute uiState__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+bool snikket_chat_is_blocked(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->isBlocked__fromC();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ bool ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::Chat((hx::Object *)data->args.a0, true))->isBlocked__fromC();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute isBlocked__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_get_messages_before(void *a0, const char *a1, const char *a2, void (*a3) (void**, size_t, void*), void *a4) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->getMessagesBefore__fromC(a1, a2, cpp::Function<void(void**, size_t, void*)>(a3), a4);
+ }
+ struct Data {
+ struct {void * a0; const char * a1; const char * a2; void (* a3) (void**, size_t, void*); void* a4;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Chat((hx::Object *)data->args.a0, true))->getMessagesBefore__fromC(data->args.a1, data->args.a2, cpp::Function<void(void**, size_t, void*)>(data->args.a3), data->args.a4);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2, a3, a4} };
+
+ // queue a callback to execute getMessagesBefore__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_get_messages_after(void *a0, const char *a1, const char *a2, void (*a3) (void**, size_t, void*), void *a4) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->getMessagesAfter__fromC(a1, a2, cpp::Function<void(void**, size_t, void*)>(a3), a4);
+ }
+ struct Data {
+ struct {void * a0; const char * a1; const char * a2; void (* a3) (void**, size_t, void*); void* a4;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Chat((hx::Object *)data->args.a0, true))->getMessagesAfter__fromC(data->args.a1, data->args.a2, cpp::Function<void(void**, size_t, void*)>(data->args.a3), data->args.a4);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2, a3, a4} };
+
+ // queue a callback to execute getMessagesAfter__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_get_messages_around(void *a0, const char *a1, const char *a2, void (*a3) (void**, size_t, void*), void *a4) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->getMessagesAround__fromC(a1, a2, cpp::Function<void(void**, size_t, void*)>(a3), a4);
+ }
+ struct Data {
+ struct {void * a0; const char * a1; const char * a2; void (* a3) (void**, size_t, void*); void* a4;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Chat((hx::Object *)data->args.a0, true))->getMessagesAround__fromC(data->args.a1, data->args.a2, cpp::Function<void(void**, size_t, void*)>(data->args.a3), data->args.a4);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2, a3, a4} };
+
+ // queue a callback to execute getMessagesAround__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_send_message(void *a0, void *a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->sendMessage__fromC(Dynamic((hx::Object *)a1));
+ }
+ struct Data {
+ struct {void * a0; void * a1;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Chat((hx::Object *)data->args.a0, true))->sendMessage__fromC(Dynamic((hx::Object *)data->args.a1));
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute sendMessage__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_mark_read_up_to(void *a0, void *a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->markReadUpTo__fromC(Dynamic((hx::Object *)a1));
+ }
+ struct Data {
+ struct {void * a0; void * a1;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Chat((hx::Object *)data->args.a0, true))->markReadUpTo__fromC(Dynamic((hx::Object *)data->args.a1));
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute markReadUpTo__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_bookmark(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->bookmark__fromC();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Chat((hx::Object *)data->args.a0, true))->bookmark__fromC();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute bookmark__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+size_t snikket_chat_get_participants(void *a0, const char ***a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->getParticipants__fromC(a1);
+ }
+ struct Data {
+ struct {void * a0; const char*** a1;} args;
+ HxSemaphore lock;
+ size_t ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::Chat((hx::Object *)data->args.a0, true))->getParticipants__fromC(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute getParticipants__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void *snikket_chat_get_participant_details(void *a0, const char *a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeObject((snikket::Chat((hx::Object *)a0, true))->getParticipantDetails__fromC(a1));
+ }
+ struct Data {
+ struct {void * a0; const char * a1;} args;
+ HxSemaphore lock;
+ void * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeObject((snikket::Chat((hx::Object *)data->args.a0, true))->getParticipantDetails__fromC(data->args.a1));
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute getParticipantDetails__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_correct_message(void *a0, const char *a1, void *a2) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->correctMessage__fromC(a1, Dynamic((hx::Object *)a2));
+ }
+ struct Data {
+ struct {void * a0; const char * a1; void * a2;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Chat((hx::Object *)data->args.a0, true))->correctMessage__fromC(data->args.a1, Dynamic((hx::Object *)data->args.a2));
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2} };
+
+ // queue a callback to execute correctMessage__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_add_reaction(void *a0, void *a1, void *a2) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->addReaction(Dynamic((hx::Object *)a1), Dynamic((hx::Object *)a2));
+ }
+ struct Data {
+ struct {void * a0; void * a1; void * a2;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Chat((hx::Object *)data->args.a0, true))->addReaction(Dynamic((hx::Object *)data->args.a1), Dynamic((hx::Object *)data->args.a2));
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2} };
+
+ // queue a callback to execute addReaction() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_remove_reaction(void *a0, void *a1, void *a2) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->removeReaction__fromC(Dynamic((hx::Object *)a1), Dynamic((hx::Object *)a2));
+ }
+ struct Data {
+ struct {void * a0; void * a1; void * a2;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Chat((hx::Object *)data->args.a0, true))->removeReaction__fromC(Dynamic((hx::Object *)data->args.a1), Dynamic((hx::Object *)data->args.a2));
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2} };
+
+ // queue a callback to execute removeReaction__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_typing(void *a0, const char *a1, const char *a2) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->typing(a1, a2);
+ }
+ struct Data {
+ struct {void * a0; const char * a1; const char * a2;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Chat((hx::Object *)data->args.a0, true))->typing(data->args.a1, data->args.a2);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2} };
+
+ // queue a callback to execute typing() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_set_active(void *a0, bool a1, const char *a2) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->setActive(a1, a2);
+ }
+ struct Data {
+ struct {void * a0; bool a1; const char * a2;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Chat((hx::Object *)data->args.a0, true))->setActive(data->args.a1, data->args.a2);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2} };
+
+ // queue a callback to execute setActive() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_close(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->close__fromC();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Chat((hx::Object *)data->args.a0, true))->close__fromC();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute close__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_toggle_pinned(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->togglePinned();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Chat((hx::Object *)data->args.a0, true))->togglePinned();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute togglePinned() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_block(void *a0, void *a1, bool a2) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->block(Dynamic((hx::Object *)a1), a2);
+ }
+ struct Data {
+ struct {void * a0; void * a1; bool a2;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Chat((hx::Object *)data->args.a0, true))->block(Dynamic((hx::Object *)data->args.a1), data->args.a2);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2} };
+
+ // queue a callback to execute block() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_unblock(void *a0, bool a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->unblock(a1);
+ }
+ struct Data {
+ struct {void * a0; bool a1;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Chat((hx::Object *)data->args.a0, true))->unblock(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute unblock() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_set_notifications(void *a0, bool a1, bool a2, bool a3) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->setNotifications(a1, a2, a3);
+ }
+ struct Data {
+ struct {void * a0; bool a1; bool a2; bool a3;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Chat((hx::Object *)data->args.a0, true))->setNotifications(data->args.a1, data->args.a2, data->args.a3);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2, a3} };
+
+ // queue a callback to execute setNotifications() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+bool snikket_chat_notifications_filtered(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->notificationsFiltered();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ bool ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::Chat((hx::Object *)data->args.a0, true))->notificationsFiltered();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute notificationsFiltered() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+bool snikket_chat_notify_mention(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->notifyMention();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ bool ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::Chat((hx::Object *)data->args.a0, true))->notifyMention();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute notifyMention() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+bool snikket_chat_notify_reply(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->notifyReply();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ bool ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::Chat((hx::Object *)data->args.a0, true))->notifyReply();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute notifyReply() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_last_message_id(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::Chat((hx::Object *)a0, true))->lastMessageId__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::Chat((hx::Object *)data->args.a0, true))->lastMessageId__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute lastMessageId__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_last_message_timestamp(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::Chat((hx::Object *)a0, true))->lastMessageTimestamp());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::Chat((hx::Object *)data->args.a0, true))->lastMessageTimestamp());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute lastMessageTimestamp() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_get_photo(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::Chat((hx::Object *)a0, true))->getPhoto());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::Chat((hx::Object *)data->args.a0, true))->getPhoto());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute getPhoto() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_get_placeholder(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::Chat((hx::Object *)a0, true))->getPlaceholder());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::Chat((hx::Object *)data->args.a0, true))->getPlaceholder());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute getPlaceholder() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_read_up_to(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::Chat((hx::Object *)a0, true))->readUpTo());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::Chat((hx::Object *)data->args.a0, true))->readUpTo());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute readUpTo() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+int snikket_chat_unread_count(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->unreadCount();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ int ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::Chat((hx::Object *)data->args.a0, true))->unreadCount();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute unreadCount() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_preview(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::Chat((hx::Object *)a0, true))->preview());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::Chat((hx::Object *)data->args.a0, true))->preview());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute preview() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_set_display_name(void *a0, const char *a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->setDisplayName(a1);
+ }
+ struct Data {
+ struct {void * a0; const char * a1;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Chat((hx::Object *)data->args.a0, true))->setDisplayName(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute setDisplayName() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_get_display_name(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::Chat((hx::Object *)a0, true))->getDisplayName());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::Chat((hx::Object *)data->args.a0, true))->getDisplayName());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute getDisplayName() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_set_trusted(void *a0, bool a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->setTrusted(a1);
+ }
+ struct Data {
+ struct {void * a0; bool a1;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Chat((hx::Object *)data->args.a0, true))->setTrusted(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute setTrusted() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+bool snikket_chat_is_trusted(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->isTrusted();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ bool ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::Chat((hx::Object *)data->args.a0, true))->isTrusted();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute isTrusted() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+bool snikket_chat_syncing(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->syncing();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ bool ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::Chat((hx::Object *)data->args.a0, true))->syncing();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute syncing() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+bool snikket_chat_can_audio_call(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->canAudioCall();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ bool ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::Chat((hx::Object *)data->args.a0, true))->canAudioCall();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute canAudioCall() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+bool snikket_chat_can_video_call(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->canVideoCall();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ bool ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::Chat((hx::Object *)data->args.a0, true))->canVideoCall();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute canVideoCall() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_start_call(void *a0, bool a1, bool a2) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->startCall(a1, a2);
+ }
+ struct Data {
+ struct {void * a0; bool a1; bool a2;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Chat((hx::Object *)data->args.a0, true))->startCall(data->args.a1, data->args.a2);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2} };
+
+ // queue a callback to execute startCall() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_accept_call(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->acceptCall();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Chat((hx::Object *)data->args.a0, true))->acceptCall();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute acceptCall() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_chat_hangup(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->hangup();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::Chat((hx::Object *)data->args.a0, true))->hangup();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute hangup() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_chat_call_status(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::Chat((hx::Object *)a0, true))->callStatus());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::Chat((hx::Object *)data->args.a0, true))->callStatus());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute callStatus() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void *snikket_chat_dtmf(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeObject((snikket::Chat((hx::Object *)a0, true))->dtmf());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ void * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeObject((snikket::Chat((hx::Object *)data->args.a0, true))->dtmf());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute dtmf() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+size_t snikket_chat_video_tracks(void *a0, void ***a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Chat((hx::Object *)a0, true))->videoTracks__fromC(a1);
+ }
+ struct Data {
+ struct {void * a0; void*** a1;} args;
+ HxSemaphore lock;
+ size_t ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::Chat((hx::Object *)data->args.a0, true))->videoTracks__fromC(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute videoTracks__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_jingle_media_stream_track_id(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::jingle::MediaStreamTrack((hx::Object *)a0, true))->id__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::jingle::MediaStreamTrack((hx::Object *)data->args.a0, true))->id__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute id__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+bool snikket_jingle_media_stream_track_muted(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::jingle::MediaStreamTrack((hx::Object *)a0, true))->muted__fromC();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ bool ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::jingle::MediaStreamTrack((hx::Object *)data->args.a0, true))->muted__fromC();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute muted__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_jingle_media_stream_track_kind(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::jingle::MediaStreamTrack((hx::Object *)a0, true))->kind__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::jingle::MediaStreamTrack((hx::Object *)data->args.a0, true))->kind__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute kind__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+size_t snikket_jingle_media_stream_track_supported_audio_formats(void *a0, void ***a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::jingle::MediaStreamTrack((hx::Object *)a0, true))->supportedAudioFormats__fromC(a1);
+ }
+ struct Data {
+ struct {void * a0; void*** a1;} args;
+ HxSemaphore lock;
+ size_t ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::jingle::MediaStreamTrack((hx::Object *)data->args.a0, true))->supportedAudioFormats__fromC(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute supportedAudioFormats__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_jingle_media_stream_track_add_pcm_listener(void *a0, void (*a1) (short*, size_t, int, int, void*), void *a2) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::jingle::MediaStreamTrack((hx::Object *)a0, true))->addPCMListener__fromC(cpp::Function<void(short*, size_t, int, int, void*)>(a1), a2);
+ }
+ struct Data {
+ struct {void * a0; void (* a1) (short*, size_t, int, int, void*); void* a2;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::jingle::MediaStreamTrack((hx::Object *)data->args.a0, true))->addPCMListener__fromC(cpp::Function<void(short*, size_t, int, int, void*)>(data->args.a1), data->args.a2);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2} };
+
+ // queue a callback to execute addPCMListener__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_jingle_media_stream_track_add_ready_for_pcm_listener(void *a0, void (*a1) (void*), void *a2) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::jingle::MediaStreamTrack((hx::Object *)a0, true))->addReadyForPCMListener__fromC(cpp::Function<void(void*)>(a1), a2);
+ }
+ struct Data {
+ struct {void * a0; void (* a1) (void*); void* a2;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::jingle::MediaStreamTrack((hx::Object *)data->args.a0, true))->addReadyForPCMListener__fromC(cpp::Function<void(void*)>(data->args.a1), data->args.a2);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2} };
+
+ // queue a callback to execute addReadyForPCMListener__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_jingle_media_stream_track_write_pcm(void *a0, const short *a1, size_t a2, int a3, int a4) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::jingle::MediaStreamTrack((hx::Object *)a0, true))->writePCM__fromC(a1, a2, a3, a4);
+ }
+ struct Data {
+ struct {void * a0; const short* a1; size_t a2; int a3; int a4;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::jingle::MediaStreamTrack((hx::Object *)data->args.a0, true))->writePCM__fromC(data->args.a1, data->args.a2, data->args.a3, data->args.a4);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2, a3, a4} };
+
+ // queue a callback to execute writePCM__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_jingle_media_stream_track_stop(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::jingle::MediaStreamTrack((hx::Object *)a0, true))->stop();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::jingle::MediaStreamTrack((hx::Object *)data->args.a0, true))->stop();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute stop() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void *snikket_jingle_audio_format_new(const char *a0, unsigned char a1, int a2, int a3) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeObject(snikket::jingle::AudioFormat_obj::__new(a0, a1, a2, a3));
+ }
+ struct Data {
+ struct {const char * a0; unsigned char a1; int a2; int a3;} args;
+ HxSemaphore lock;
+ void * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeObject(snikket::jingle::AudioFormat_obj::__new(data->args.a0, data->args.a1, data->args.a2, data->args.a3));
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2, a3} };
+
+ // queue a callback to execute new() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+int snikket_jingle_audio_format_clock_rate(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::jingle::AudioFormat((hx::Object *)a0, true))->clockRate__fromC();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ int ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::jingle::AudioFormat((hx::Object *)data->args.a0, true))->clockRate__fromC();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute clockRate__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+int snikket_jingle_audio_format_channels(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::jingle::AudioFormat((hx::Object *)a0, true))->channels__fromC();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ int ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::jingle::AudioFormat((hx::Object *)data->args.a0, true))->channels__fromC();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute channels__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_available_chat_chat_id(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::AvailableChat((hx::Object *)a0, true))->chatId__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::AvailableChat((hx::Object *)data->args.a0, true))->chatId__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute chatId__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_available_chat_display_name(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::AvailableChat((hx::Object *)a0, true))->displayName__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::AvailableChat((hx::Object *)data->args.a0, true))->displayName__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute displayName__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_available_chat_note(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::AvailableChat((hx::Object *)a0, true))->note__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::AvailableChat((hx::Object *)data->args.a0, true))->note__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute note__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+bool snikket_available_chat_is_channel(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::AvailableChat((hx::Object *)a0, true))->isChannel();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ bool ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::AvailableChat((hx::Object *)data->args.a0, true))->isChannel();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute isChannel() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_jingle_initiated_session_sid(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::jingle::InitiatedSession((hx::Object *)a0, true))->sid__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::jingle::InitiatedSession((hx::Object *)data->args.a0, true))->sid__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute sid__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_jingle_initiated_session_accept(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::jingle::InitiatedSession((hx::Object *)a0, true))->accept();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::jingle::InitiatedSession((hx::Object *)data->args.a0, true))->accept();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute accept() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_jingle_initiated_session_hangup(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::jingle::InitiatedSession((hx::Object *)a0, true))->hangup();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::jingle::InitiatedSession((hx::Object *)data->args.a0, true))->hangup();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute hangup() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_jingle_initiated_session_add_media(void *a0, void *const *a1, size_t a2) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::jingle::InitiatedSession((hx::Object *)a0, true))->addMedia__fromC(a1, a2);
+ }
+ struct Data {
+ struct {void * a0; void* const* a1; size_t a2;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::jingle::InitiatedSession((hx::Object *)data->args.a0, true))->addMedia__fromC(data->args.a1, data->args.a2);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2} };
+
+ // queue a callback to execute addMedia__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_jingle_initiated_session_call_status(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::jingle::InitiatedSession((hx::Object *)a0, true))->callStatus());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::jingle::InitiatedSession((hx::Object *)data->args.a0, true))->callStatus());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute callStatus() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+size_t snikket_jingle_initiated_session_video_tracks(void *a0, void ***a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::jingle::InitiatedSession((hx::Object *)a0, true))->videoTracks__fromC(a1);
+ }
+ struct Data {
+ struct {void * a0; void*** a1;} args;
+ HxSemaphore lock;
+ size_t ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::jingle::InitiatedSession((hx::Object *)data->args.a0, true))->videoTracks__fromC(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute videoTracks__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void *snikket_jingle_initiated_session_dtmf(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeObject((snikket::jingle::InitiatedSession((hx::Object *)a0, true))->dtmf());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ void * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeObject((snikket::jingle::InitiatedSession((hx::Object *)data->args.a0, true))->dtmf());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute dtmf() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_jingle_initiated_session_supply_media(void *a0, void *const *a1, size_t a2) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::jingle::InitiatedSession((hx::Object *)a0, true))->supplyMedia__fromC(a1, a2);
+ }
+ struct Data {
+ struct {void * a0; void* const* a1; size_t a2;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::jingle::InitiatedSession((hx::Object *)data->args.a0, true))->supplyMedia__fromC(data->args.a1, data->args.a2);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1, a2} };
+
+ // queue a callback to execute supplyMedia__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void *snikket_jingle_media_stream_new() {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeObject(snikket::jingle::MediaStream_obj::__new());
+ }
+ struct Data {
+ struct {} args;
+ HxSemaphore lock;
+ void * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeObject(snikket::jingle::MediaStream_obj::__new());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {} };
+
+ // queue a callback to execute new() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void *snikket_jingle_media_stream_make_audio() {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeObject(snikket::jingle::MediaStream_obj::makeAudio());
+ }
+ struct Data {
+ struct {} args;
+ HxSemaphore lock;
+ void * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeObject(snikket::jingle::MediaStream_obj::makeAudio());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {} };
+
+ // queue a callback to execute makeAudio() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_jingle_media_stream_add_track(void *a0, void *a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::jingle::MediaStream((hx::Object *)a0, true))->addTrack(Dynamic((hx::Object *)a1));
+ }
+ struct Data {
+ struct {void * a0; void * a1;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::jingle::MediaStream((hx::Object *)data->args.a0, true))->addTrack(Dynamic((hx::Object *)data->args.a1));
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute addTrack() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
+HAXE_C_BRIDGE_LINKAGE
+size_t snikket_jingle_media_stream_get_tracks(void *a0, void ***a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::jingle::MediaStream((hx::Object *)a0, true))->getTracks__fromC(a1);
+ }
+ struct Data {
+ struct {void * a0; void*** a1;} args;
+ HxSemaphore lock;
+ size_t ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::jingle::MediaStream((hx::Object *)data->args.a0, true))->getTracks__fromC(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute getTracks__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void *snikket_attachment_source_new(const char *a0, const char *a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeObject(snikket::AttachmentSource_obj::__new(a0, a1));
+ }
+ struct Data {
+ struct {const char * a0; const char * a1;} args;
+ HxSemaphore lock;
+ void * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeObject(snikket::AttachmentSource_obj::__new(data->args.a0, data->args.a1));
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute new() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_attachment_source_path(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::AttachmentSource((hx::Object *)a0, true))->path__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::AttachmentSource((hx::Object *)data->args.a0, true))->path__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute path__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_attachment_source_type(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::AttachmentSource((hx::Object *)a0, true))->type__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::AttachmentSource((hx::Object *)data->args.a0, true))->type__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute type__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_attachment_source_name(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::AttachmentSource((hx::Object *)a0, true))->name__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::AttachmentSource((hx::Object *)data->args.a0, true))->name__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute name__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+int snikket_attachment_source_size(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::AttachmentSource((hx::Object *)a0, true))->size__fromC();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ int ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::AttachmentSource((hx::Object *)data->args.a0, true))->size__fromC();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute size__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_participant_display_name(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::Participant((hx::Object *)a0, true))->displayName__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::Participant((hx::Object *)data->args.a0, true))->displayName__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute displayName__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_participant_photo_uri(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::Participant((hx::Object *)a0, true))->photoUri__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::Participant((hx::Object *)data->args.a0, true))->photoUri__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute photoUri__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_participant_placeholder_uri(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::Participant((hx::Object *)a0, true))->placeholderUri__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::Participant((hx::Object *)data->args.a0, true))->placeholderUri__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute placeholderUri__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+bool snikket_participant_is_self(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Participant((hx::Object *)a0, true))->isSelf__fromC();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ bool ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::Participant((hx::Object *)data->args.a0, true))->isSelf__fromC();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute isSelf__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+bool snikket_channel_is_private(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::Channel((hx::Object *)a0, true))->isPrivate();
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ bool ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = (snikket::Channel((hx::Object *)data->args.a0, true))->isPrivate();
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute isPrivate() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_reaction_sender_id(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::Reaction((hx::Object *)a0, true))->senderId__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::Reaction((hx::Object *)data->args.a0, true))->senderId__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute senderId__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_reaction_timestamp(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::Reaction((hx::Object *)a0, true))->timestamp__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::Reaction((hx::Object *)data->args.a0, true))->timestamp__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute timestamp__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_reaction_text(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::Reaction((hx::Object *)a0, true))->text__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::Reaction((hx::Object *)data->args.a0, true))->text__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute text__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_reaction_key(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::Reaction((hx::Object *)a0, true))->key__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::Reaction((hx::Object *)data->args.a0, true))->key__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute key__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_reaction_envelope_id(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::Reaction((hx::Object *)a0, true))->envelopeId__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::Reaction((hx::Object *)data->args.a0, true))->envelopeId__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute envelopeId__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+const char *snikket_custom_emoji_reaction_uri(void *a0) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return HaxeCBridge::retainHaxeString((snikket::CustomEmojiReaction((hx::Object *)a0, true))->uri__fromC());
+ }
+ struct Data {
+ struct {void * a0;} args;
+ HxSemaphore lock;
+ const char * ret;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ data->ret = HaxeCBridge::retainHaxeString((snikket::CustomEmojiReaction((hx::Object *)data->args.a0, true))->uri__fromC());
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0} };
+
+ // queue a callback to execute uri__fromC() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+ return data.ret;
+}
+
+HAXE_C_BRIDGE_LINKAGE
+void snikket_jingle_dtmf_sender_insert_dtmf(void *a0, const char *a1) {
+ if (HaxeCBridgeInternal::isHaxeMainThread()) {
+ return (snikket::jingle::DTMFSender((hx::Object *)a0, true))->insertDTMF(a1);
+ }
+ struct Data {
+ struct {void * a0; const char * a1;} args;
+ HxSemaphore lock;
+ };
+ struct Callback {
+ static void run(void* p) {
+ // executed within the haxe main thread
+ Data* data = (Data*) p;
+ try {
+ (snikket::jingle::DTMFSender((hx::Object *)data->args.a0, true))->insertDTMF(data->args.a1);
+ data->lock.Set();
+ } catch(Dynamic runtimeException) {
+ data->lock.Set();
+ throw runtimeException;
+ }
+ }
+ };
+
+ #ifdef HXCPP_DEBUG
+ assert(HaxeCBridgeInternal::threadRunning && "haxe thread not running, use snikket_initializeHaxeThread() to activate the haxe thread");
+ #endif
+
+ Data data = { {a0, a1} };
+
+ // queue a callback to execute insertDTMF() on the main thread and wait until execution completes
+ HaxeCBridgeInternal::runInMainThread(Callback::run, &data);
+ data.lock.Wait();
+}
+
diff --git a/Sources/c_snikket/src/__boot__.cpp b/Sources/c_snikket/src/__boot__.cpp
new file mode 100644
index 0000000..7ce0df6
--- /dev/null
+++ b/Sources/c_snikket/src/__boot__.cpp
@@ -0,0 +1,1355 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_tink_streams_Step
+#include <tink/streams/Step.h>
+#endif
+#ifndef INCLUDED_tink_streams_Reduction
+#include <tink/streams/Reduction.h>
+#endif
+#ifndef INCLUDED_tink_streams_ReductionStep
+#include <tink/streams/ReductionStep.h>
+#endif
+#ifndef INCLUDED_tink_streams_Conclusion
+#include <tink/streams/Conclusion.h>
+#endif
+#ifndef INCLUDED_tink_streams_Handled
+#include <tink/streams/Handled.h>
+#endif
+#ifndef INCLUDED_tink_streams_RegroupResult
+#include <tink/streams/RegroupResult.h>
+#endif
+#ifndef INCLUDED_tink_streams_RegroupStatus
+#include <tink/streams/RegroupStatus.h>
+#endif
+#ifndef INCLUDED_tink_io_ParseResult
+#include <tink/io/ParseResult.h>
+#endif
+#ifndef INCLUDED_tink_io_PipeResult
+#include <tink/io/PipeResult.h>
+#endif
+#ifndef INCLUDED_tink_http_BodyPart
+#include <tink/http/BodyPart.h>
+#endif
+#ifndef INCLUDED_tink_http_IncomingRequestBody
+#include <tink/http/IncomingRequestBody.h>
+#endif
+#ifndef INCLUDED_tink_io_ParseStep
+#include <tink/io/ParseStep.h>
+#endif
+#ifndef INCLUDED_tink_http_ClientType
+#include <tink/http/ClientType.h>
+#endif
+#ifndef INCLUDED_tink_core_Outcome
+#include <tink/core/Outcome.h>
+#endif
+#ifndef INCLUDED_tink_core_FutureStatus
+#include <tink/core/FutureStatus.h>
+#endif
+#ifndef INCLUDED_thenshim_fallback_PromiseState
+#include <thenshim/fallback/PromiseState.h>
+#endif
+#ifndef INCLUDED_snikket_IqRequestType
+#include <snikket/IqRequestType.h>
+#endif
+#ifndef INCLUDED_snikket_Node
+#include <snikket/Node.h>
+#endif
+#ifndef INCLUDED_snikket_MessageStanza
+#include <snikket/MessageStanza.h>
+#endif
+#ifndef INCLUDED_snikket_IqResult
+#include <snikket/IqResult.h>
+#endif
+#ifndef INCLUDED_snikket_EventResult
+#include <snikket/EventResult.h>
+#endif
+#ifndef INCLUDED_hx_strings_internal__Either2__Either2
+#include <hx/strings/internal/_Either2/_Either2.h>
+#endif
+#ifndef INCLUDED_haxe_io_Error
+#include <haxe/io/Error.h>
+#endif
+#ifndef INCLUDED_haxe_io_Encoding
+#include <haxe/io/Encoding.h>
+#endif
+#ifndef INCLUDED_haxe_ds_Option
+#include <haxe/ds/Option.h>
+#endif
+#ifndef INCLUDED_haxe_ds_Either
+#include <haxe/ds/Either.h>
+#endif
+#ifndef INCLUDED_haxe_StackItem
+#include <haxe/StackItem.h>
+#endif
+#ifndef INCLUDED_ValueType
+#include <ValueType.h>
+#endif
+#ifndef INCLUDED_tink_io__Worker_Worker_Impl_
+#include <tink/io/_Worker/Worker_Impl_.h>
+#endif
+#ifndef INCLUDED_tink_io__Source_Source_Impl_
+#include <tink/io/_Source/Source_Impl_.h>
+#endif
+#ifndef INCLUDED_tink_streams_Empty
+#include <tink/streams/Empty.h>
+#endif
+#ifndef INCLUDED_tink_http_Fetch
+#include <tink/http/Fetch.h>
+#endif
+#ifndef INCLUDED_tink_core__Future_Future_Impl_
+#include <tink/core/_Future/Future_Impl_.h>
+#endif
+#ifndef INCLUDED_tink_core__Callback_Callback_Impl_
+#include <tink/core/_Callback/Callback_Impl_.h>
+#endif
+#ifndef INCLUDED_tink__Chunk_Chunk_Impl_
+#include <tink/_Chunk/Chunk_Impl_.h>
+#endif
+#ifndef INCLUDED_tink__Chunk_EmptyChunk
+#include <tink/_Chunk/EmptyChunk.h>
+#endif
+#ifndef INCLUDED_thenshim__Promise_Promise_Impl_
+#include <thenshim/_Promise/Promise_Impl_.h>
+#endif
+#ifndef INCLUDED_sys_ssl_Socket
+#include <sys/ssl/Socket.h>
+#endif
+#ifndef INCLUDED_sys_ssl_Key
+#include <sys/ssl/Key.h>
+#endif
+#ifndef INCLUDED_sys_ssl_Certificate
+#include <sys/ssl/Certificate.h>
+#endif
+#ifndef INCLUDED_sys_net_Host
+#include <sys/net/Host.h>
+#endif
+#ifndef INCLUDED_sys_Http
+#include <sys/Http.h>
+#endif
+#ifndef INCLUDED_snikket_persistence_Sqlite
+#include <snikket/persistence/Sqlite.h>
+#endif
+#ifndef INCLUDED_snikket_persistence_MediaStoreFS
+#include <snikket/persistence/MediaStoreFS.h>
+#endif
+#ifndef INCLUDED_snikket_persistence_Dummy
+#include <snikket/persistence/Dummy.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_InitiatedSession
+#include <snikket/jingle/InitiatedSession.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_MediaStream
+#include <snikket/jingle/MediaStream.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_MediaStreamTrack
+#include <snikket/jingle/MediaStreamTrack.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_AudioFormat
+#include <snikket/jingle/AudioFormat.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_DTMFSender
+#include <snikket/jingle/DTMFSender.h>
+#endif
+#ifndef INCLUDED_snikket_CustomEmojiReaction
+#include <snikket/CustomEmojiReaction.h>
+#endif
+#ifndef INCLUDED_snikket_Reaction
+#include <snikket/Reaction.h>
+#endif
+#ifndef INCLUDED_snikket_Persistence
+#include <snikket/Persistence.h>
+#endif
+#ifndef INCLUDED_snikket_Participant
+#include <snikket/Participant.h>
+#endif
+#ifndef INCLUDED_snikket_Hash
+#include <snikket/Hash.h>
+#endif
+#ifndef INCLUDED_snikket_EmojiUtil
+#include <snikket/EmojiUtil.h>
+#endif
+#ifndef INCLUDED_snikket_Config
+#include <snikket/Config.h>
+#endif
+#ifndef INCLUDED_snikket_Client
+#include <snikket/Client.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessageBuilder
+#include <snikket/ChatMessageBuilder.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessage
+#include <snikket/ChatMessage.h>
+#endif
+#ifndef INCLUDED_snikket_ChatAttachment
+#include <snikket/ChatAttachment.h>
+#endif
+#ifndef INCLUDED_snikket_AvailableChat
+#include <snikket/AvailableChat.h>
+#endif
+#ifndef INCLUDED_snikket_Channel
+#include <snikket/Channel.h>
+#endif
+#ifndef INCLUDED_snikket_DirectChat
+#include <snikket/DirectChat.h>
+#endif
+#ifndef INCLUDED_snikket_Chat
+#include <snikket/Chat.h>
+#endif
+#ifndef INCLUDED_snikket_Autolink
+#include <snikket/Autolink.h>
+#endif
+#ifndef INCLUDED_snikket_AttachmentSource
+#include <snikket/AttachmentSource.h>
+#endif
+#ifndef INCLUDED_sha__SHA256_SHA256_Fields_
+#include <sha/_SHA256/SHA256_Fields_.h>
+#endif
+#ifndef INCLUDED_hx_strings_StringBuilder
+#include <hx/strings/StringBuilder.h>
+#endif
+#ifndef INCLUDED_hx_strings_RandomStrings
+#include <hx/strings/RandomStrings.h>
+#endif
+#ifndef INCLUDED_htmlparser_HtmlParser
+#include <htmlparser/HtmlParser.h>
+#endif
+#ifndef INCLUDED_hsluv_Hsluv
+#include <hsluv/Hsluv.h>
+#endif
+#ifndef INCLUDED_haxe_xml_Parser
+#include <haxe/xml/Parser.h>
+#endif
+#ifndef INCLUDED_haxe_crypto_Base64
+#include <haxe/crypto/Base64.h>
+#endif
+#ifndef INCLUDED_haxe_Log
+#include <haxe/Log.h>
+#endif
+#ifndef INCLUDED_sys_thread__Thread_HaxeThread
+#include <sys/thread/_Thread/HaxeThread.h>
+#endif
+#ifndef INCLUDED_Xml
+#include <Xml.h>
+#endif
+#ifndef INCLUDED__HaxeCBridge_Internal
+#include <_HaxeCBridge/Internal.h>
+#endif
+#ifndef INCLUDED_tink_url__Path_Path_Impl_
+#include <tink/url/_Path/Path_Impl_.h>
+#endif
+#ifndef INCLUDED_tink_url__Host_Host_Impl_
+#include <tink/url/_Host/Host_Impl_.h>
+#endif
+#ifndef INCLUDED_tink_streams_FutureStream
+#include <tink/streams/FutureStream.h>
+#endif
+#ifndef INCLUDED_tink_streams__Stream_Reducer_Impl_
+#include <tink/streams/_Stream/Reducer_Impl_.h>
+#endif
+#ifndef INCLUDED_tink_streams__Stream_Handler_Impl_
+#include <tink/streams/_Stream/Handler_Impl_.h>
+#endif
+#ifndef INCLUDED_tink_streams_Single
+#include <tink/streams/Single.h>
+#endif
+#ifndef INCLUDED_tink_streams_IdealizeStream
+#include <tink/streams/IdealizeStream.h>
+#endif
+#ifndef INCLUDED_tink_streams__Stream_ErrorStream
+#include <tink/streams/_Stream/ErrorStream.h>
+#endif
+#ifndef INCLUDED_tink_streams__Stream_RegroupStream
+#include <tink/streams/_Stream/RegroupStream.h>
+#endif
+#ifndef INCLUDED_tink_streams__Stream_CompoundStream
+#include <tink/streams/_Stream/CompoundStream.h>
+#endif
+#ifndef INCLUDED_tink_streams__Stream_Regrouper_Impl_
+#include <tink/streams/_Stream/Regrouper_Impl_.h>
+#endif
+#ifndef INCLUDED_tink_streams__Stream_Stream_Impl_
+#include <tink/streams/_Stream/Stream_Impl_.h>
+#endif
+#ifndef INCLUDED_tink_streams_IdealStreamBase
+#include <tink/streams/IdealStreamBase.h>
+#endif
+#ifndef INCLUDED_tink_io_std_OutputSink
+#include <tink/io/std/OutputSink.h>
+#endif
+#ifndef INCLUDED_tink_io_std_InputSource
+#include <tink/io/std/InputSource.h>
+#endif
+#ifndef INCLUDED_tink_streams_Generator
+#include <tink/streams/Generator.h>
+#endif
+#ifndef INCLUDED_tink_io__Worker_EagerWorker
+#include <tink/io/_Worker/EagerWorker.h>
+#endif
+#ifndef INCLUDED_tink_io_WorkerObject
+#include <tink/io/WorkerObject.h>
+#endif
+#ifndef INCLUDED_tink_io__StreamParser_StreamParser_Impl_
+#include <tink/io/_StreamParser/StreamParser_Impl_.h>
+#endif
+#ifndef INCLUDED_tink_io_IdealSourceTools
+#include <tink/io/IdealSourceTools.h>
+#endif
+#ifndef INCLUDED_tink_io_RealSourceTools
+#include <tink/io/RealSourceTools.h>
+#endif
+#ifndef INCLUDED_tink_streams_StreamBase
+#include <tink/streams/StreamBase.h>
+#endif
+#ifndef INCLUDED_tink_streams_StreamObject
+#include <tink/streams/StreamObject.h>
+#endif
+#ifndef INCLUDED_tink_io__Sink_SinkYielding_Impl_
+#include <tink/io/_Sink/SinkYielding_Impl_.h>
+#endif
+#ifndef INCLUDED_tink_io_SinkBase
+#include <tink/io/SinkBase.h>
+#endif
+#ifndef INCLUDED_tink_io_SinkObject
+#include <tink/io/SinkObject.h>
+#endif
+#ifndef INCLUDED_tink_io_PipeResultTools
+#include <tink/io/PipeResultTools.h>
+#endif
+#ifndef INCLUDED_tink_http_containers_LocalContainer
+#include <tink/http/containers/LocalContainer.h>
+#endif
+#ifndef INCLUDED_tink_http_clients_StdClient
+#include <tink/http/clients/StdClient.h>
+#endif
+#ifndef INCLUDED_tink_http_clients_SocketClient
+#include <tink/http/clients/SocketClient.h>
+#endif
+#ifndef INCLUDED_tink_http_clients_LocalContainerClient
+#include <tink/http/clients/LocalContainerClient.h>
+#endif
+#ifndef INCLUDED_tink_http_clients_Helpers
+#include <tink/http/clients/Helpers.h>
+#endif
+#ifndef INCLUDED_tink_http_clients_CurlClient
+#include <tink/http/clients/CurlClient.h>
+#endif
+#ifndef INCLUDED_tink_http_IncomingResponse
+#include <tink/http/IncomingResponse.h>
+#endif
+#ifndef INCLUDED_tink_http__Response_OutgoingResponseData
+#include <tink/http/_Response/OutgoingResponseData.h>
+#endif
+#ifndef INCLUDED_tink_http_ResponseHeaderBase
+#include <tink/http/ResponseHeaderBase.h>
+#endif
+#ifndef INCLUDED_tink_http_IncomingRequest
+#include <tink/http/IncomingRequest.h>
+#endif
+#ifndef INCLUDED_tink_http_OutgoingRequest
+#include <tink/http/OutgoingRequest.h>
+#endif
+#ifndef INCLUDED_tink_http_OutgoingRequestHeader
+#include <tink/http/OutgoingRequestHeader.h>
+#endif
+#ifndef INCLUDED_tink_http_IncomingRequestHeader
+#include <tink/http/IncomingRequestHeader.h>
+#endif
+#ifndef INCLUDED_tink_http_RequestHeader
+#include <tink/http/RequestHeader.h>
+#endif
+#ifndef INCLUDED_tink_http_Message
+#include <tink/http/Message.h>
+#endif
+#ifndef INCLUDED_tink_http_HeaderParser
+#include <tink/http/HeaderParser.h>
+#endif
+#ifndef INCLUDED_tink_io_BytewiseParser
+#include <tink/io/BytewiseParser.h>
+#endif
+#ifndef INCLUDED_tink_http_HeaderField
+#include <tink/http/HeaderField.h>
+#endif
+#ifndef INCLUDED_tink_http__Header_HeaderValue_Impl_
+#include <tink/http/_Header/HeaderValue_Impl_.h>
+#endif
+#ifndef INCLUDED_tink_http_Header
+#include <tink/http/Header.h>
+#endif
+#ifndef INCLUDED_tink_http_HandlerObject
+#include <tink/http/HandlerObject.h>
+#endif
+#ifndef INCLUDED_tink_http__Fetch_FetchResponse_Impl_
+#include <tink/http/_Fetch/FetchResponse_Impl_.h>
+#endif
+#ifndef INCLUDED_tink_http_Container
+#include <tink/http/Container.h>
+#endif
+#ifndef INCLUDED_tink_http__Client_CustomClient
+#include <tink/http/_Client/CustomClient.h>
+#endif
+#ifndef INCLUDED_tink_http_ClientObject
+#include <tink/http/ClientObject.h>
+#endif
+#ifndef INCLUDED_tink_io_StreamParserObject
+#include <tink/io/StreamParserObject.h>
+#endif
+#ifndef INCLUDED_tink_core__Promise_Promise_Impl_
+#include <tink/core/_Promise/Promise_Impl_.h>
+#endif
+#ifndef INCLUDED_tink_core_MPair
+#include <tink/core/MPair.h>
+#endif
+#ifndef INCLUDED_tink_core_NamedWith
+#include <tink/core/NamedWith.h>
+#endif
+#ifndef INCLUDED_tink_core__Lazy_LazyFunc
+#include <tink/core/_Lazy/LazyFunc.h>
+#endif
+#ifndef INCLUDED_tink_core__Lazy_Lazy_Impl_
+#include <tink/core/_Lazy/Lazy_Impl_.h>
+#endif
+#ifndef INCLUDED_tink_core__Future_SuspendableFuture
+#include <tink/core/_Future/SuspendableFuture.h>
+#endif
+#ifndef INCLUDED_tink_core__Future_SyncFuture
+#include <tink/core/_Future/SyncFuture.h>
+#endif
+#ifndef INCLUDED_tink_core__Lazy_LazyConst
+#include <tink/core/_Lazy/LazyConst.h>
+#endif
+#ifndef INCLUDED_tink_core__Lazy_LazyObject
+#include <tink/core/_Lazy/LazyObject.h>
+#endif
+#ifndef INCLUDED_tink_core__Lazy_Computable
+#include <tink/core/_Lazy/Computable.h>
+#endif
+#ifndef INCLUDED_tink_core__Future_FutureObject
+#include <tink/core/_Future/FutureObject.h>
+#endif
+#ifndef INCLUDED_tink_core_TypedError
+#include <tink/core/TypedError.h>
+#endif
+#ifndef INCLUDED_tink_core_CallbackList
+#include <tink/core/CallbackList.h>
+#endif
+#ifndef INCLUDED_tink_core_SimpleDisposable
+#include <tink/core/SimpleDisposable.h>
+#endif
+#ifndef INCLUDED_tink_core_OwnedDisposable
+#include <tink/core/OwnedDisposable.h>
+#endif
+#ifndef INCLUDED_tink_core_Disposable
+#include <tink/core/Disposable.h>
+#endif
+#ifndef INCLUDED_tink_core__Callback_ListCell
+#include <tink/core/_Callback/ListCell.h>
+#endif
+#ifndef INCLUDED_tink_core__Callback_LinkPair
+#include <tink/core/_Callback/LinkPair.h>
+#endif
+#ifndef INCLUDED_tink_core_CallbackLinkRef
+#include <tink/core/CallbackLinkRef.h>
+#endif
+#ifndef INCLUDED_tink_core_LinkObject
+#include <tink/core/LinkObject.h>
+#endif
+#ifndef INCLUDED_tink_chunk_CompoundChunk
+#include <tink/chunk/CompoundChunk.h>
+#endif
+#ifndef INCLUDED_tink_chunk_ChunkCursor
+#include <tink/chunk/ChunkCursor.h>
+#endif
+#ifndef INCLUDED_tink_chunk_ByteChunk
+#include <tink/chunk/ByteChunk.h>
+#endif
+#ifndef INCLUDED_tink__Url_Url_Impl_
+#include <tink/_Url/Url_Impl_.h>
+#endif
+#ifndef INCLUDED_tink_chunk_ChunkObject
+#include <tink/chunk/ChunkObject.h>
+#endif
+#ifndef INCLUDED_tink_chunk_ChunkBase
+#include <tink/chunk/ChunkBase.h>
+#endif
+#ifndef INCLUDED_thenshim_fallback_HandlerSession
+#include <thenshim/fallback/HandlerSession.h>
+#endif
+#ifndef INCLUDED_thenshim_fallback_FallbackPromise
+#include <thenshim/fallback/FallbackPromise.h>
+#endif
+#ifndef INCLUDED_thenshim_Thenable
+#include <thenshim/Thenable.h>
+#endif
+#ifndef INCLUDED_thenshim_PromiseTools
+#include <thenshim/PromiseTools.h>
+#endif
+#ifndef INCLUDED_thenshim_fallback_TaskScheduler
+#include <thenshim/fallback/TaskScheduler.h>
+#endif
+#ifndef INCLUDED_thenshim_fallback_FallbackPromiseFactory
+#include <thenshim/fallback/FallbackPromiseFactory.h>
+#endif
+#ifndef INCLUDED_thenshim_PromiseFactory
+#include <thenshim/PromiseFactory.h>
+#endif
+#ifndef INCLUDED_sys_thread__Thread_Thread_Impl_
+#include <sys/thread/_Thread/Thread_Impl_.h>
+#endif
+#ifndef INCLUDED_sys_thread_NoEventLoopException
+#include <sys/thread/NoEventLoopException.h>
+#endif
+#ifndef INCLUDED_sys_thread_Lock
+#include <sys/thread/Lock.h>
+#endif
+#ifndef INCLUDED_sys_thread__EventLoop_RegularEvent
+#include <sys/thread/_EventLoop/RegularEvent.h>
+#endif
+#ifndef INCLUDED_sys_ssl__Socket_SocketOutput
+#include <sys/ssl/_Socket/SocketOutput.h>
+#endif
+#ifndef INCLUDED_sys_ssl__Socket_SocketInput
+#include <sys/ssl/_Socket/SocketInput.h>
+#endif
+#ifndef INCLUDED_sys_net_Socket
+#include <sys/net/Socket.h>
+#endif
+#ifndef INCLUDED_sys_net__Socket_SocketOutput
+#include <sys/net/_Socket/SocketOutput.h>
+#endif
+#ifndef INCLUDED_sys_net__Socket_SocketInput
+#include <sys/net/_Socket/SocketInput.h>
+#endif
+#ifndef INCLUDED_sys_io_Process
+#include <sys/io/Process.h>
+#endif
+#ifndef INCLUDED_sys_io__Process_Stdout
+#include <sys/io/_Process/Stdout.h>
+#endif
+#ifndef INCLUDED_sys_io__Process_Stdin
+#include <sys/io/_Process/Stdin.h>
+#endif
+#ifndef INCLUDED_sys_io_FileOutput
+#include <sys/io/FileOutput.h>
+#endif
+#ifndef INCLUDED_sys_io_FileInput
+#include <sys/io/FileInput.h>
+#endif
+#ifndef INCLUDED_sys_io_File
+#include <sys/io/File.h>
+#endif
+#ifndef INCLUDED_sys_db_Sqlite
+#include <sys/db/Sqlite.h>
+#endif
+#ifndef INCLUDED_sys_db__Sqlite_SqliteResultSet
+#include <sys/db/_Sqlite/SqliteResultSet.h>
+#endif
+#ifndef INCLUDED_sys_db__Sqlite_SqliteConnection
+#include <sys/db/_Sqlite/SqliteConnection.h>
+#endif
+#ifndef INCLUDED_sys_db_ResultSet
+#include <sys/db/ResultSet.h>
+#endif
+#ifndef INCLUDED_sys_db_Connection
+#include <sys/db/Connection.h>
+#endif
+#ifndef INCLUDED_sys_FileSystem
+#include <sys/FileSystem.h>
+#endif
+#ifndef INCLUDED_snikket_streams_XmppStropheStream
+#include <snikket/streams/XmppStropheStream.h>
+#endif
+#ifndef INCLUDED_snikket_queries_VcardTempGet
+#include <snikket/queries/VcardTempGet.h>
+#endif
+#ifndef INCLUDED_snikket_queries_RosterGet
+#include <snikket/queries/RosterGet.h>
+#endif
+#ifndef INCLUDED_snikket_queries_Push2Disable
+#include <snikket/queries/Push2Disable.h>
+#endif
+#ifndef INCLUDED_snikket_queries_PubsubGet
+#include <snikket/queries/PubsubGet.h>
+#endif
+#ifndef INCLUDED_snikket_queries_MAMQuery
+#include <snikket/queries/MAMQuery.h>
+#endif
+#ifndef INCLUDED_snikket_queries_JabberIqGatewayGet
+#include <snikket/queries/JabberIqGatewayGet.h>
+#endif
+#ifndef INCLUDED_snikket_queries_HttpUploadSlot
+#include <snikket/queries/HttpUploadSlot.h>
+#endif
+#ifndef INCLUDED_snikket_queries_ExtDiscoGet
+#include <snikket/queries/ExtDiscoGet.h>
+#endif
+#ifndef INCLUDED_snikket_queries_DiscoItemsGet
+#include <snikket/queries/DiscoItemsGet.h>
+#endif
+#ifndef INCLUDED_snikket_queries_DiscoInfoGet
+#include <snikket/queries/DiscoInfoGet.h>
+#endif
+#ifndef INCLUDED_snikket_queries_BoB
+#include <snikket/queries/BoB.h>
+#endif
+#ifndef INCLUDED_snikket_queries_BlocklistGet
+#include <snikket/queries/BlocklistGet.h>
+#endif
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+#ifndef INCLUDED_snikket_persistence_SqliteDriver
+#include <snikket/persistence/SqliteDriver.h>
+#endif
+#ifndef INCLUDED_snikket_persistence_MediaStore
+#include <snikket/persistence/MediaStore.h>
+#endif
+#ifndef INCLUDED_snikket_persistence_KeyValueStore
+#include <snikket/persistence/KeyValueStore.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_Attribute
+#include <snikket/jingle/Attribute.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_IceCandidate
+#include <snikket/jingle/IceCandidate.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_Media
+#include <snikket/jingle/Media.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_TransportInfo
+#include <snikket/jingle/TransportInfo.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_SessionDescription
+#include <snikket/jingle/SessionDescription.h>
+#endif
+#ifndef INCLUDED_snikket_jingle__Session_Session_Fields_
+#include <snikket/jingle/_Session/Session_Fields_.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_OutgoingSession
+#include <snikket/jingle/OutgoingSession.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_OutgoingProposedSession
+#include <snikket/jingle/OutgoingProposedSession.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_IncomingProposedSession
+#include <snikket/jingle/IncomingProposedSession.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_Session
+#include <snikket/jingle/Session.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_PeerConnection
+#include <snikket/jingle/PeerConnection.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_Group
+#include <snikket/jingle/Group.h>
+#endif
+#ifndef INCLUDED_snikket_XEP0393
+#include <snikket/XEP0393.h>
+#endif
+#ifndef INCLUDED_snikket__Util_Util_Fields_
+#include <snikket/_Util/Util_Fields_.h>
+#endif
+#ifndef INCLUDED_snikket_StringUtil
+#include <snikket/StringUtil.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket_StanzaError
+#include <snikket/StanzaError.h>
+#endif
+#ifndef INCLUDED_snikket_TextNode
+#include <snikket/TextNode.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_ReactionUpdate
+#include <snikket/ReactionUpdate.h>
+#endif
+#ifndef INCLUDED_snikket__Push_Push_Fields_
+#include <snikket/_Push/Push_Fields_.h>
+#endif
+#ifndef INCLUDED_snikket_PubsubEvent
+#include <snikket/PubsubEvent.h>
+#endif
+#ifndef INCLUDED_snikket_Presence
+#include <snikket/Presence.h>
+#endif
+#ifndef INCLUDED_snikket_Notification
+#include <snikket/Notification.h>
+#endif
+#ifndef INCLUDED_snikket_ModerationAction
+#include <snikket/ModerationAction.h>
+#endif
+#ifndef INCLUDED_snikket_MessageSync
+#include <snikket/MessageSync.h>
+#endif
+#ifndef INCLUDED_snikket_Message
+#include <snikket/Message.h>
+#endif
+#ifndef INCLUDED_snikket_JID
+#include <snikket/JID.h>
+#endif
+#ifndef INCLUDED_snikket_Identicon
+#include <snikket/Identicon.h>
+#endif
+#ifndef INCLUDED_snikket_ID
+#include <snikket/ID.h>
+#endif
+#ifndef INCLUDED_snikket_GenericStream
+#include <snikket/GenericStream.h>
+#endif
+#ifndef INCLUDED_snikket_EventHandler
+#include <snikket/EventHandler.h>
+#endif
+#ifndef INCLUDED_snikket_Builder
+#include <snikket/Builder.h>
+#endif
+#ifndef INCLUDED_snikket_Other
+#include <snikket/Other.h>
+#endif
+#ifndef INCLUDED_snikket_Emoji
+#include <snikket/Emoji.h>
+#endif
+#ifndef INCLUDED_snikket_Symbol
+#include <snikket/Symbol.h>
+#endif
+#ifndef INCLUDED_snikket_UnicodeBlocks
+#include <snikket/UnicodeBlocks.h>
+#endif
+#ifndef INCLUDED_snikket_UnicodeRange
+#include <snikket/UnicodeRange.h>
+#endif
+#ifndef INCLUDED_snikket_UnicodeList
+#include <snikket/UnicodeList.h>
+#endif
+#ifndef INCLUDED_snikket_UnicodeSet
+#include <snikket/UnicodeSet.h>
+#endif
+#ifndef INCLUDED_snikket_Date
+#include <snikket/Date.h>
+#endif
+#ifndef INCLUDED_snikket_Color
+#include <snikket/Color.h>
+#endif
+#ifndef INCLUDED_snikket_EventEmitter
+#include <snikket/EventEmitter.h>
+#endif
+#ifndef INCLUDED_snikket_SerializedChat
+#include <snikket/SerializedChat.h>
+#endif
+#ifndef INCLUDED_snikket_Identity
+#include <snikket/Identity.h>
+#endif
+#ifndef INCLUDED_snikket_Caps
+#include <snikket/Caps.h>
+#endif
+#ifndef INCLUDED_sha_SHA256
+#include <sha/SHA256.h>
+#endif
+#ifndef INCLUDED_sha_Hash
+#include <sha/Hash.h>
+#endif
+#ifndef INCLUDED_hx_strings_Strings
+#include <hx/strings/Strings.h>
+#endif
+#ifndef INCLUDED_httpstatus__HttpStatusMessage_HttpStatusMessage_Impl_
+#include <httpstatus/_HttpStatusMessage/HttpStatusMessage_Impl_.h>
+#endif
+#ifndef INCLUDED_htmlparser_HtmlTools
+#include <htmlparser/HtmlTools.h>
+#endif
+#ifndef INCLUDED_htmlparser_HtmlParserException
+#include <htmlparser/HtmlParserException.h>
+#endif
+#ifndef INCLUDED_htmlparser_HtmlNodeText
+#include <htmlparser/HtmlNodeText.h>
+#endif
+#ifndef INCLUDED_htmlparser_HtmlNodeElement
+#include <htmlparser/HtmlNodeElement.h>
+#endif
+#ifndef INCLUDED_htmlparser_HtmlNode
+#include <htmlparser/HtmlNode.h>
+#endif
+#ifndef INCLUDED_htmlparser_HtmlAttribute
+#include <htmlparser/HtmlAttribute.h>
+#endif
+#ifndef INCLUDED_haxe_xml_Printer
+#include <haxe/xml/Printer.h>
+#endif
+#ifndef INCLUDED_haxe_xml_XmlParserException
+#include <haxe/xml/XmlParserException.h>
+#endif
+#ifndef INCLUDED_haxe_iterators_MapKeyValueIterator
+#include <haxe/iterators/MapKeyValueIterator.h>
+#endif
+#ifndef INCLUDED_haxe_iterators_ArrayIterator
+#include <haxe/iterators/ArrayIterator.h>
+#endif
+#ifndef INCLUDED_haxe_io_Path
+#include <haxe/io/Path.h>
+#endif
+#ifndef INCLUDED_haxe_io_Eof
+#include <haxe/io/Eof.h>
+#endif
+#ifndef INCLUDED_haxe_io_BytesOutput
+#include <haxe/io/BytesOutput.h>
+#endif
+#ifndef INCLUDED_haxe_io_Output
+#include <haxe/io/Output.h>
+#endif
+#ifndef INCLUDED_haxe_io_BytesInput
+#include <haxe/io/BytesInput.h>
+#endif
+#ifndef INCLUDED_haxe_io_Input
+#include <haxe/io/Input.h>
+#endif
+#ifndef INCLUDED_haxe_io_BytesBuffer
+#include <haxe/io/BytesBuffer.h>
+#endif
+#ifndef INCLUDED_haxe_http_HttpBase
+#include <haxe/http/HttpBase.h>
+#endif
+#ifndef INCLUDED_haxe_format_JsonPrinter
+#include <haxe/format/JsonPrinter.h>
+#endif
+#ifndef INCLUDED_haxe_format_JsonParser
+#include <haxe/format/JsonParser.h>
+#endif
+#ifndef INCLUDED_haxe_exceptions_NotImplementedException
+#include <haxe/exceptions/NotImplementedException.h>
+#endif
+#ifndef INCLUDED_haxe_exceptions_PosException
+#include <haxe/exceptions/PosException.h>
+#endif
+#ifndef INCLUDED_haxe_ds_StringMap
+#include <haxe/ds/StringMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_ObjectMap
+#include <haxe/ds/ObjectMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds__List_ListNode
+#include <haxe/ds/_List/ListNode.h>
+#endif
+#ifndef INCLUDED_haxe_ds_List
+#include <haxe/ds/List.h>
+#endif
+#ifndef INCLUDED_haxe_ds_IntMap
+#include <haxe/ds/IntMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_EnumValueMap
+#include <haxe/ds/EnumValueMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_TreeNode
+#include <haxe/ds/TreeNode.h>
+#endif
+#ifndef INCLUDED_haxe_ds_BalancedTree
+#include <haxe/ds/BalancedTree.h>
+#endif
+#ifndef INCLUDED_haxe_crypto_Sha256
+#include <haxe/crypto/Sha256.h>
+#endif
+#ifndef INCLUDED_haxe_crypto_Sha1
+#include <haxe/crypto/Sha1.h>
+#endif
+#ifndef INCLUDED_haxe_crypto_BaseCode
+#include <haxe/crypto/BaseCode.h>
+#endif
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+#ifndef INCLUDED_haxe_ValueException
+#include <haxe/ValueException.h>
+#endif
+#ifndef INCLUDED_haxe_Timer
+#include <haxe/Timer.h>
+#endif
+#ifndef INCLUDED_haxe_NativeStackTrace
+#include <haxe/NativeStackTrace.h>
+#endif
+#ifndef INCLUDED_haxe_MainLoop
+#include <haxe/MainLoop.h>
+#endif
+#ifndef INCLUDED_haxe_MainEvent
+#include <haxe/MainEvent.h>
+#endif
+#ifndef INCLUDED_haxe_Exception
+#include <haxe/Exception.h>
+#endif
+#ifndef INCLUDED_haxe_EntryPoint
+#include <haxe/EntryPoint.h>
+#endif
+#ifndef INCLUDED_sys_thread_EventLoop
+#include <sys/thread/EventLoop.h>
+#endif
+#ifndef INCLUDED_sys_thread_Mutex
+#include <sys/thread/Mutex.h>
+#endif
+#ifndef INCLUDED_datetime_utils_DateTimeUtils
+#include <datetime/utils/DateTimeUtils.h>
+#endif
+#ifndef INCLUDED_datetime_utils_DateTimeMonthUtils
+#include <datetime/utils/DateTimeMonthUtils.h>
+#endif
+#ifndef INCLUDED_datetime_utils_DateTimeIntervalUtils
+#include <datetime/utils/DateTimeIntervalUtils.h>
+#endif
+#ifndef INCLUDED_datetime_cores_DateTimeIntervalCore
+#include <datetime/cores/DateTimeIntervalCore.h>
+#endif
+#ifndef INCLUDED_datetime__DateTimeInterval_DateTimeInterval_Impl_
+#include <datetime/_DateTimeInterval/DateTimeInterval_Impl_.h>
+#endif
+#ifndef INCLUDED_datetime__DateTime_DateTime_Impl_
+#include <datetime/_DateTime/DateTime_Impl_.h>
+#endif
+#ifndef INCLUDED_cpp_Lib
+#include <cpp/Lib.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED__Xml_XmlType_Impl_
+#include <_Xml/XmlType_Impl_.h>
+#endif
+#ifndef INCLUDED__UnicodeString_UnicodeString_Impl_
+#include <_UnicodeString/UnicodeString_Impl_.h>
+#endif
+#ifndef INCLUDED_Type
+#include <Type.h>
+#endif
+#ifndef INCLUDED_Sys
+#include <Sys.h>
+#endif
+#ifndef INCLUDED_StringTools
+#include <StringTools.h>
+#endif
+#ifndef INCLUDED_StringBuf
+#include <StringBuf.h>
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_Lambda
+#include <Lambda.h>
+#endif
+#ifndef INCLUDED__HaxeCBridge_Int64Map_Impl_
+#include <_HaxeCBridge/Int64Map_Impl_.h>
+#endif
+#ifndef INCLUDED_EReg
+#include <EReg.h>
+#endif
+#ifndef INCLUDED_Date
+#include <Date.h>
+#endif
+
+void __files__boot();
+
+void __boot_all()
+{
+__files__boot();
+::hx::RegisterResources( ::hx::GetResources() );
+::tink::streams::Step_obj::__register();
+::tink::streams::Reduction_obj::__register();
+::tink::streams::ReductionStep_obj::__register();
+::tink::streams::Conclusion_obj::__register();
+::tink::streams::Handled_obj::__register();
+::tink::streams::RegroupResult_obj::__register();
+::tink::streams::RegroupStatus_obj::__register();
+::tink::io::ParseResult_obj::__register();
+::tink::io::PipeResult_obj::__register();
+::tink::http::BodyPart_obj::__register();
+::tink::http::IncomingRequestBody_obj::__register();
+::tink::io::ParseStep_obj::__register();
+::tink::http::ClientType_obj::__register();
+::tink::core::Outcome_obj::__register();
+::tink::core::FutureStatus_obj::__register();
+::thenshim::fallback::PromiseState_obj::__register();
+::snikket::IqRequestType_obj::__register();
+::snikket::Node_obj::__register();
+::snikket::MessageStanza_obj::__register();
+::snikket::IqResult_obj::__register();
+::snikket::EventResult_obj::__register();
+::hx::strings::internal::_Either2::_Either2_obj::__register();
+::haxe::io::Error_obj::__register();
+::haxe::io::Encoding_obj::__register();
+::haxe::ds::Option_obj::__register();
+::haxe::ds::Either_obj::__register();
+::haxe::StackItem_obj::__register();
+::ValueType_obj::__register();
+::tink::io::_Worker::Worker_Impl__obj::__register();
+::tink::io::_Source::Source_Impl__obj::__register();
+::tink::streams::Empty_obj::__register();
+::tink::http::Fetch_obj::__register();
+::tink::core::_Future::Future_Impl__obj::__register();
+::tink::core::_Callback::Callback_Impl__obj::__register();
+::tink::_Chunk::Chunk_Impl__obj::__register();
+::tink::_Chunk::EmptyChunk_obj::__register();
+::thenshim::_Promise::Promise_Impl__obj::__register();
+::sys::ssl::Socket_obj::__register();
+::sys::ssl::Key_obj::__register();
+::sys::ssl::Certificate_obj::__register();
+::sys::net::Host_obj::__register();
+::sys::Http_obj::__register();
+::snikket::persistence::Sqlite_obj::__register();
+::snikket::persistence::MediaStoreFS_obj::__register();
+::snikket::persistence::Dummy_obj::__register();
+::snikket::jingle::InitiatedSession_obj::__register();
+::snikket::jingle::MediaStream_obj::__register();
+::snikket::jingle::MediaStreamTrack_obj::__register();
+::snikket::jingle::AudioFormat_obj::__register();
+::snikket::jingle::DTMFSender_obj::__register();
+::snikket::CustomEmojiReaction_obj::__register();
+::snikket::Reaction_obj::__register();
+::snikket::Persistence_obj::__register();
+::snikket::Participant_obj::__register();
+::snikket::Hash_obj::__register();
+::snikket::EmojiUtil_obj::__register();
+::snikket::Config_obj::__register();
+::snikket::Client_obj::__register();
+::snikket::ChatMessageBuilder_obj::__register();
+::snikket::ChatMessage_obj::__register();
+::snikket::ChatAttachment_obj::__register();
+::snikket::AvailableChat_obj::__register();
+::snikket::Channel_obj::__register();
+::snikket::DirectChat_obj::__register();
+::snikket::Chat_obj::__register();
+::snikket::Autolink_obj::__register();
+::snikket::AttachmentSource_obj::__register();
+::sha::_SHA256::SHA256_Fields__obj::__register();
+::hx::strings::StringBuilder_obj::__register();
+::hx::strings::RandomStrings_obj::__register();
+::htmlparser::HtmlParser_obj::__register();
+::hsluv::Hsluv_obj::__register();
+::haxe::xml::Parser_obj::__register();
+::haxe::crypto::Base64_obj::__register();
+::haxe::Log_obj::__register();
+::sys::thread::_Thread::HaxeThread_obj::__register();
+::Xml_obj::__register();
+::_HaxeCBridge::Internal_obj::__register();
+::tink::url::_Path::Path_Impl__obj::__register();
+::tink::url::_Host::Host_Impl__obj::__register();
+::tink::streams::FutureStream_obj::__register();
+::tink::streams::_Stream::Reducer_Impl__obj::__register();
+::tink::streams::_Stream::Handler_Impl__obj::__register();
+::tink::streams::Single_obj::__register();
+::tink::streams::IdealizeStream_obj::__register();
+::tink::streams::_Stream::ErrorStream_obj::__register();
+::tink::streams::_Stream::RegroupStream_obj::__register();
+::tink::streams::_Stream::CompoundStream_obj::__register();
+::tink::streams::_Stream::Regrouper_Impl__obj::__register();
+::tink::streams::_Stream::Stream_Impl__obj::__register();
+::tink::streams::IdealStreamBase_obj::__register();
+::tink::io::std::OutputSink_obj::__register();
+::tink::io::std::InputSource_obj::__register();
+::tink::streams::Generator_obj::__register();
+::tink::io::_Worker::EagerWorker_obj::__register();
+::tink::io::WorkerObject_obj::__register();
+::tink::io::_StreamParser::StreamParser_Impl__obj::__register();
+::tink::io::IdealSourceTools_obj::__register();
+::tink::io::RealSourceTools_obj::__register();
+::tink::streams::StreamBase_obj::__register();
+::tink::streams::StreamObject_obj::__register();
+::tink::io::_Sink::SinkYielding_Impl__obj::__register();
+::tink::io::SinkBase_obj::__register();
+::tink::io::SinkObject_obj::__register();
+::tink::io::PipeResultTools_obj::__register();
+::tink::http::containers::LocalContainer_obj::__register();
+::tink::http::clients::StdClient_obj::__register();
+::tink::http::clients::SocketClient_obj::__register();
+::tink::http::clients::LocalContainerClient_obj::__register();
+::tink::http::clients::Helpers_obj::__register();
+::tink::http::clients::CurlClient_obj::__register();
+::tink::http::IncomingResponse_obj::__register();
+::tink::http::_Response::OutgoingResponseData_obj::__register();
+::tink::http::ResponseHeaderBase_obj::__register();
+::tink::http::IncomingRequest_obj::__register();
+::tink::http::OutgoingRequest_obj::__register();
+::tink::http::OutgoingRequestHeader_obj::__register();
+::tink::http::IncomingRequestHeader_obj::__register();
+::tink::http::RequestHeader_obj::__register();
+::tink::http::Message_obj::__register();
+::tink::http::HeaderParser_obj::__register();
+::tink::io::BytewiseParser_obj::__register();
+::tink::http::HeaderField_obj::__register();
+::tink::http::_Header::HeaderValue_Impl__obj::__register();
+::tink::http::Header_obj::__register();
+::tink::http::HandlerObject_obj::__register();
+::tink::http::_Fetch::FetchResponse_Impl__obj::__register();
+::tink::http::Container_obj::__register();
+::tink::http::_Client::CustomClient_obj::__register();
+::tink::http::ClientObject_obj::__register();
+::tink::io::StreamParserObject_obj::__register();
+::tink::core::_Promise::Promise_Impl__obj::__register();
+::tink::core::MPair_obj::__register();
+::tink::core::NamedWith_obj::__register();
+::tink::core::_Lazy::LazyFunc_obj::__register();
+::tink::core::_Lazy::Lazy_Impl__obj::__register();
+::tink::core::_Future::SuspendableFuture_obj::__register();
+::tink::core::_Future::SyncFuture_obj::__register();
+::tink::core::_Lazy::LazyConst_obj::__register();
+::tink::core::_Lazy::LazyObject_obj::__register();
+::tink::core::_Lazy::Computable_obj::__register();
+::tink::core::_Future::FutureObject_obj::__register();
+::tink::core::TypedError_obj::__register();
+::tink::core::CallbackList_obj::__register();
+::tink::core::SimpleDisposable_obj::__register();
+::tink::core::OwnedDisposable_obj::__register();
+::tink::core::Disposable_obj::__register();
+::tink::core::_Callback::ListCell_obj::__register();
+::tink::core::_Callback::LinkPair_obj::__register();
+::tink::core::CallbackLinkRef_obj::__register();
+::tink::core::LinkObject_obj::__register();
+::tink::chunk::CompoundChunk_obj::__register();
+::tink::chunk::ChunkCursor_obj::__register();
+::tink::chunk::ByteChunk_obj::__register();
+::tink::_Url::Url_Impl__obj::__register();
+::tink::chunk::ChunkObject_obj::__register();
+::tink::chunk::ChunkBase_obj::__register();
+::thenshim::fallback::HandlerSession_obj::__register();
+::thenshim::fallback::FallbackPromise_obj::__register();
+::thenshim::Thenable_obj::__register();
+::thenshim::PromiseTools_obj::__register();
+::thenshim::fallback::TaskScheduler_obj::__register();
+::thenshim::fallback::FallbackPromiseFactory_obj::__register();
+::thenshim::PromiseFactory_obj::__register();
+::sys::thread::_Thread::Thread_Impl__obj::__register();
+::sys::thread::NoEventLoopException_obj::__register();
+::sys::thread::Lock_obj::__register();
+::sys::thread::_EventLoop::RegularEvent_obj::__register();
+::sys::ssl::_Socket::SocketOutput_obj::__register();
+::sys::ssl::_Socket::SocketInput_obj::__register();
+::sys::net::Socket_obj::__register();
+::sys::net::_Socket::SocketOutput_obj::__register();
+::sys::net::_Socket::SocketInput_obj::__register();
+::sys::io::Process_obj::__register();
+::sys::io::_Process::Stdout_obj::__register();
+::sys::io::_Process::Stdin_obj::__register();
+::sys::io::FileOutput_obj::__register();
+::sys::io::FileInput_obj::__register();
+::sys::io::File_obj::__register();
+::sys::db::Sqlite_obj::__register();
+::sys::db::_Sqlite::SqliteResultSet_obj::__register();
+::sys::db::_Sqlite::SqliteConnection_obj::__register();
+::sys::db::ResultSet_obj::__register();
+::sys::db::Connection_obj::__register();
+::sys::FileSystem_obj::__register();
+::snikket::streams::XmppStropheStream_obj::__register();
+::snikket::queries::VcardTempGet_obj::__register();
+::snikket::queries::RosterGet_obj::__register();
+::snikket::queries::Push2Disable_obj::__register();
+::snikket::queries::PubsubGet_obj::__register();
+::snikket::queries::MAMQuery_obj::__register();
+::snikket::queries::JabberIqGatewayGet_obj::__register();
+::snikket::queries::HttpUploadSlot_obj::__register();
+::snikket::queries::ExtDiscoGet_obj::__register();
+::snikket::queries::DiscoItemsGet_obj::__register();
+::snikket::queries::DiscoInfoGet_obj::__register();
+::snikket::queries::BoB_obj::__register();
+::snikket::queries::BlocklistGet_obj::__register();
+::snikket::queries::GenericQuery_obj::__register();
+::snikket::persistence::SqliteDriver_obj::__register();
+::snikket::persistence::MediaStore_obj::__register();
+::snikket::persistence::KeyValueStore_obj::__register();
+::snikket::jingle::Attribute_obj::__register();
+::snikket::jingle::IceCandidate_obj::__register();
+::snikket::jingle::Media_obj::__register();
+::snikket::jingle::TransportInfo_obj::__register();
+::snikket::jingle::SessionDescription_obj::__register();
+::snikket::jingle::_Session::Session_Fields__obj::__register();
+::snikket::jingle::OutgoingSession_obj::__register();
+::snikket::jingle::OutgoingProposedSession_obj::__register();
+::snikket::jingle::IncomingProposedSession_obj::__register();
+::snikket::jingle::Session_obj::__register();
+::snikket::jingle::PeerConnection_obj::__register();
+::snikket::jingle::Group_obj::__register();
+::snikket::XEP0393_obj::__register();
+::snikket::_Util::Util_Fields__obj::__register();
+::snikket::StringUtil_obj::__register();
+::snikket::Stanza_obj::__register();
+::snikket::StanzaError_obj::__register();
+::snikket::TextNode_obj::__register();
+::snikket::_Stanza::NodeInterface_obj::__register();
+::snikket::ReactionUpdate_obj::__register();
+::snikket::_Push::Push_Fields__obj::__register();
+::snikket::PubsubEvent_obj::__register();
+::snikket::Presence_obj::__register();
+::snikket::Notification_obj::__register();
+::snikket::ModerationAction_obj::__register();
+::snikket::MessageSync_obj::__register();
+::snikket::Message_obj::__register();
+::snikket::JID_obj::__register();
+::snikket::Identicon_obj::__register();
+::snikket::ID_obj::__register();
+::snikket::GenericStream_obj::__register();
+::snikket::EventHandler_obj::__register();
+::snikket::Builder_obj::__register();
+::snikket::Other_obj::__register();
+::snikket::Emoji_obj::__register();
+::snikket::Symbol_obj::__register();
+::snikket::UnicodeBlocks_obj::__register();
+::snikket::UnicodeRange_obj::__register();
+::snikket::UnicodeList_obj::__register();
+::snikket::UnicodeSet_obj::__register();
+::snikket::Date_obj::__register();
+::snikket::Color_obj::__register();
+::snikket::EventEmitter_obj::__register();
+::snikket::SerializedChat_obj::__register();
+::snikket::Identity_obj::__register();
+::snikket::Caps_obj::__register();
+::sha::SHA256_obj::__register();
+::sha::Hash_obj::__register();
+::hx::strings::Strings_obj::__register();
+::httpstatus::_HttpStatusMessage::HttpStatusMessage_Impl__obj::__register();
+::htmlparser::HtmlTools_obj::__register();
+::htmlparser::HtmlParserException_obj::__register();
+::htmlparser::HtmlNodeText_obj::__register();
+::htmlparser::HtmlNodeElement_obj::__register();
+::htmlparser::HtmlNode_obj::__register();
+::htmlparser::HtmlAttribute_obj::__register();
+::haxe::xml::Printer_obj::__register();
+::haxe::xml::XmlParserException_obj::__register();
+::haxe::iterators::MapKeyValueIterator_obj::__register();
+::haxe::iterators::ArrayIterator_obj::__register();
+::haxe::io::Path_obj::__register();
+::haxe::io::Eof_obj::__register();
+::haxe::io::BytesOutput_obj::__register();
+::haxe::io::Output_obj::__register();
+::haxe::io::BytesInput_obj::__register();
+::haxe::io::Input_obj::__register();
+::haxe::io::BytesBuffer_obj::__register();
+::haxe::http::HttpBase_obj::__register();
+::haxe::format::JsonPrinter_obj::__register();
+::haxe::format::JsonParser_obj::__register();
+::haxe::exceptions::NotImplementedException_obj::__register();
+::haxe::exceptions::PosException_obj::__register();
+::haxe::ds::StringMap_obj::__register();
+::haxe::ds::ObjectMap_obj::__register();
+::haxe::ds::_List::ListNode_obj::__register();
+::haxe::ds::List_obj::__register();
+::haxe::ds::IntMap_obj::__register();
+::haxe::ds::EnumValueMap_obj::__register();
+::haxe::ds::TreeNode_obj::__register();
+::haxe::ds::BalancedTree_obj::__register();
+::haxe::crypto::Sha256_obj::__register();
+::haxe::crypto::Sha1_obj::__register();
+::haxe::crypto::BaseCode_obj::__register();
+::haxe::io::Bytes_obj::__register();
+::haxe::ValueException_obj::__register();
+::haxe::Timer_obj::__register();
+::haxe::NativeStackTrace_obj::__register();
+::haxe::MainLoop_obj::__register();
+::haxe::MainEvent_obj::__register();
+::haxe::Exception_obj::__register();
+::haxe::EntryPoint_obj::__register();
+::sys::thread::EventLoop_obj::__register();
+::sys::thread::Mutex_obj::__register();
+::datetime::utils::DateTimeUtils_obj::__register();
+::datetime::utils::DateTimeMonthUtils_obj::__register();
+::datetime::utils::DateTimeIntervalUtils_obj::__register();
+::datetime::cores::DateTimeIntervalCore_obj::__register();
+::datetime::_DateTimeInterval::DateTimeInterval_Impl__obj::__register();
+::datetime::_DateTime::DateTime_Impl__obj::__register();
+::cpp::Lib_obj::__register();
+::haxe::IMap_obj::__register();
+::_Xml::XmlType_Impl__obj::__register();
+::_UnicodeString::UnicodeString_Impl__obj::__register();
+::Type_obj::__register();
+::Sys_obj::__register();
+::StringTools_obj::__register();
+::StringBuf_obj::__register();
+::Std_obj::__register();
+::Reflect_obj::__register();
+::Lambda_obj::__register();
+::_HaxeCBridge::Int64Map_Impl__obj::__register();
+::EReg_obj::__register();
+::Date_obj::__register();
+::tink::streams::Step_obj::__boot();
+::tink::streams::Reduction_obj::__boot();
+::tink::streams::ReductionStep_obj::__boot();
+::tink::streams::Conclusion_obj::__boot();
+::tink::streams::Handled_obj::__boot();
+::tink::streams::RegroupResult_obj::__boot();
+::tink::streams::RegroupStatus_obj::__boot();
+::tink::io::ParseResult_obj::__boot();
+::tink::io::PipeResult_obj::__boot();
+::tink::http::BodyPart_obj::__boot();
+::tink::http::IncomingRequestBody_obj::__boot();
+::tink::io::ParseStep_obj::__boot();
+::tink::http::ClientType_obj::__boot();
+::tink::core::Outcome_obj::__boot();
+::tink::core::FutureStatus_obj::__boot();
+::thenshim::fallback::PromiseState_obj::__boot();
+::snikket::IqRequestType_obj::__boot();
+::snikket::Node_obj::__boot();
+::snikket::MessageStanza_obj::__boot();
+::snikket::IqResult_obj::__boot();
+::snikket::EventResult_obj::__boot();
+::hx::strings::internal::_Either2::_Either2_obj::__boot();
+::haxe::io::Error_obj::__boot();
+::haxe::io::Encoding_obj::__boot();
+::haxe::ds::Option_obj::__boot();
+::haxe::ds::Either_obj::__boot();
+::haxe::StackItem_obj::__boot();
+::ValueType_obj::__boot();
+::sys::thread::_Thread::HaxeThread_obj::__init__();
+::sys::net::Host_obj::__init__();
+::sys::ssl::Certificate_obj::__init__();
+::sys::ssl::Key_obj::__init__();
+::sys::ssl::Socket_obj::__init__();
+::haxe::Log_obj::__boot();
+::_HaxeCBridge::Internal_obj::__boot();
+::Xml_obj::__boot();
+::sys::thread::_Thread::HaxeThread_obj::__boot();
+::haxe::crypto::Base64_obj::__boot();
+::haxe::xml::Parser_obj::__boot();
+::hsluv::Hsluv_obj::__boot();
+::htmlparser::HtmlParser_obj::__boot();
+::hx::strings::RandomStrings_obj::__boot();
+::hx::strings::StringBuilder_obj::__boot();
+::sha::_SHA256::SHA256_Fields__obj::__boot();
+::snikket::AttachmentSource_obj::__boot();
+::snikket::Autolink_obj::__boot();
+::snikket::Chat_obj::__boot();
+::snikket::DirectChat_obj::__boot();
+::snikket::Channel_obj::__boot();
+::snikket::AvailableChat_obj::__boot();
+::snikket::ChatAttachment_obj::__boot();
+::snikket::ChatMessage_obj::__boot();
+::snikket::ChatMessageBuilder_obj::__boot();
+::snikket::Client_obj::__boot();
+::snikket::Config_obj::__boot();
+::snikket::EmojiUtil_obj::__boot();
+::snikket::Hash_obj::__boot();
+::snikket::Participant_obj::__boot();
+::snikket::Persistence_obj::__boot();
+::snikket::Reaction_obj::__boot();
+::snikket::CustomEmojiReaction_obj::__boot();
+::snikket::jingle::DTMFSender_obj::__boot();
+::snikket::jingle::AudioFormat_obj::__boot();
+::snikket::jingle::MediaStreamTrack_obj::__boot();
+::snikket::jingle::MediaStream_obj::__boot();
+::snikket::jingle::InitiatedSession_obj::__boot();
+::snikket::persistence::Dummy_obj::__boot();
+::snikket::persistence::MediaStoreFS_obj::__boot();
+::snikket::persistence::Sqlite_obj::__boot();
+::sys::Http_obj::__boot();
+::sys::net::Host_obj::__boot();
+::sys::ssl::Certificate_obj::__boot();
+::sys::ssl::Key_obj::__boot();
+::sys::ssl::Socket_obj::__boot();
+::thenshim::_Promise::Promise_Impl__obj::__boot();
+::tink::_Chunk::EmptyChunk_obj::__boot();
+::tink::_Chunk::Chunk_Impl__obj::__boot();
+::tink::core::_Callback::Callback_Impl__obj::__boot();
+::tink::core::_Future::Future_Impl__obj::__boot();
+::tink::http::Fetch_obj::__boot();
+::tink::streams::Empty_obj::__boot();
+::tink::io::_Source::Source_Impl__obj::__boot();
+::tink::io::_Worker::Worker_Impl__obj::__boot();
+}
+
diff --git a/Sources/c_snikket/src/__files__.cpp b/Sources/c_snikket/src/__files__.cpp
new file mode 100644
index 0000000..ee2081b
--- /dev/null
+++ b/Sources/c_snikket/src/__files__.cpp
@@ -0,0 +1,644 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+namespace hx {
+const char *__hxcpp_all_files[] = {
+#ifdef HXCPP_DEBUGGER
+"/usr/local/lib/haxe/std/Lambda.hx",
+"/usr/local/lib/haxe/std/StringTools.hx",
+"/usr/local/lib/haxe/std/UnicodeString.hx",
+"/usr/local/lib/haxe/std/Xml.hx",
+"/usr/local/lib/haxe/std/cpp/_std/Date.hx",
+"/usr/local/lib/haxe/std/cpp/_std/EReg.hx",
+"/usr/local/lib/haxe/std/cpp/_std/Reflect.hx",
+"/usr/local/lib/haxe/std/cpp/_std/Std.hx",
+"/usr/local/lib/haxe/std/cpp/_std/StringBuf.hx",
+"/usr/local/lib/haxe/std/cpp/_std/Sys.hx",
+"/usr/local/lib/haxe/std/cpp/_std/Type.hx",
+"/usr/local/lib/haxe/std/cpp/_std/haxe/Exception.hx",
+"/usr/local/lib/haxe/std/cpp/_std/haxe/Log.hx",
+"/usr/local/lib/haxe/std/cpp/_std/haxe/NativeStackTrace.hx",
+"/usr/local/lib/haxe/std/cpp/_std/haxe/ds/IntMap.hx",
+"/usr/local/lib/haxe/std/cpp/_std/haxe/ds/ObjectMap.hx",
+"/usr/local/lib/haxe/std/cpp/_std/haxe/ds/StringMap.hx",
+"/usr/local/lib/haxe/std/cpp/_std/sys/FileSystem.hx",
+"/usr/local/lib/haxe/std/cpp/_std/sys/db/Sqlite.hx",
+"/usr/local/lib/haxe/std/cpp/_std/sys/io/File.hx",
+"/usr/local/lib/haxe/std/cpp/_std/sys/io/FileInput.hx",
+"/usr/local/lib/haxe/std/cpp/_std/sys/io/FileOutput.hx",
+"/usr/local/lib/haxe/std/cpp/_std/sys/io/Process.hx",
+"/usr/local/lib/haxe/std/cpp/_std/sys/net/Host.hx",
+"/usr/local/lib/haxe/std/cpp/_std/sys/net/Socket.hx",
+"/usr/local/lib/haxe/std/cpp/_std/sys/ssl/Certificate.hx",
+"/usr/local/lib/haxe/std/cpp/_std/sys/ssl/Key.hx",
+"/usr/local/lib/haxe/std/cpp/_std/sys/ssl/Socket.hx",
+"/usr/local/lib/haxe/std/cpp/_std/sys/thread/Lock.hx",
+"/usr/local/lib/haxe/std/cpp/_std/sys/thread/Mutex.hx",
+"/usr/local/lib/haxe/std/cpp/_std/sys/thread/Thread.hx",
+"/usr/local/lib/haxe/std/haxe/EntryPoint.hx",
+"/usr/local/lib/haxe/std/haxe/MainLoop.hx",
+"/usr/local/lib/haxe/std/haxe/Timer.hx",
+"/usr/local/lib/haxe/std/haxe/ValueException.hx",
+"/usr/local/lib/haxe/std/haxe/crypto/Base64.hx",
+"/usr/local/lib/haxe/std/haxe/crypto/BaseCode.hx",
+"/usr/local/lib/haxe/std/haxe/crypto/Sha1.hx",
+"/usr/local/lib/haxe/std/haxe/crypto/Sha256.hx",
+"/usr/local/lib/haxe/std/haxe/ds/BalancedTree.hx",
+"/usr/local/lib/haxe/std/haxe/ds/EnumValueMap.hx",
+"/usr/local/lib/haxe/std/haxe/ds/List.hx",
+"/usr/local/lib/haxe/std/haxe/exceptions/NotImplementedException.hx",
+"/usr/local/lib/haxe/std/haxe/exceptions/PosException.hx",
+"/usr/local/lib/haxe/std/haxe/format/JsonParser.hx",
+"/usr/local/lib/haxe/std/haxe/format/JsonPrinter.hx",
+"/usr/local/lib/haxe/std/haxe/http/HttpBase.hx",
+"/usr/local/lib/haxe/std/haxe/io/Bytes.hx",
+"/usr/local/lib/haxe/std/haxe/io/BytesBuffer.hx",
+"/usr/local/lib/haxe/std/haxe/io/BytesInput.hx",
+"/usr/local/lib/haxe/std/haxe/io/BytesOutput.hx",
+"/usr/local/lib/haxe/std/haxe/io/Eof.hx",
+"/usr/local/lib/haxe/std/haxe/io/Input.hx",
+"/usr/local/lib/haxe/std/haxe/io/Output.hx",
+"/usr/local/lib/haxe/std/haxe/io/Path.hx",
+"/usr/local/lib/haxe/std/haxe/iterators/ArrayIterator.hx",
+"/usr/local/lib/haxe/std/haxe/iterators/MapKeyValueIterator.hx",
+"/usr/local/lib/haxe/std/haxe/xml/Parser.hx",
+"/usr/local/lib/haxe/std/haxe/xml/Printer.hx",
+"/usr/local/lib/haxe/std/sys/Http.hx",
+"/usr/local/lib/haxe/std/sys/thread/EventLoop.hx",
+"/usr/local/lib/haxe/std/sys/thread/NoEventLoopException.hx",
+"HaxeCBridge.hx",
+"datetime/DateTime.hx",
+"datetime/DateTimeInterval.hx",
+"datetime/cores/DateTimeIntervalCore.hx",
+"datetime/utils/DateTimeIntervalUtils.hx",
+"datetime/utils/DateTimeMonthUtils.hx",
+"datetime/utils/DateTimeUtils.hx",
+"hsluv/Hsluv.hx",
+"htmlparser/HtmlAttribute.hx",
+"htmlparser/HtmlNodeElement.hx",
+"htmlparser/HtmlNodeText.hx",
+"htmlparser/HtmlParser.hx",
+"htmlparser/HtmlParserException.hx",
+"htmlparser/HtmlTools.hx",
+"httpstatus/HttpStatusMessage.hx",
+"hx/strings/RandomStrings.hx",
+"hx/strings/StringBuilder.hx",
+"hx/strings/Strings.hx",
+"sha/Hash.hx",
+"sha/SHA256.hx",
+"snikket/AttachmentSource.cpp.hx",
+"snikket/Autolink.hx",
+"snikket/Caps.hx",
+"snikket/Chat.hx",
+"snikket/ChatMessage.hx",
+"snikket/ChatMessageBuilder.hx",
+"snikket/Client.hx",
+"snikket/Color.hx",
+"snikket/Config.hx",
+"snikket/Date.hx",
+"snikket/EmojiUtil.hx",
+"snikket/EventEmitter.hx",
+"snikket/EventHandler.hx",
+"snikket/GenericStream.hx",
+"snikket/Hash.hx",
+"snikket/ID.hx",
+"snikket/Identicon.hx",
+"snikket/JID.hx",
+"snikket/Message.hx",
+"snikket/MessageSync.hx",
+"snikket/ModerationAction.hx",
+"snikket/Notification.hx",
+"snikket/Participant.hx",
+"snikket/Persistence.hx",
+"snikket/Presence.hx",
+"snikket/PubsubEvent.hx",
+"snikket/Push.hx",
+"snikket/Reaction.hx",
+"snikket/ReactionUpdate.hx",
+"snikket/Stanza.hx",
+"snikket/StringUtil.hx",
+"snikket/Util.hx",
+"snikket/XEP0393.hx",
+"snikket/jingle/Group.hx",
+"snikket/jingle/PeerConnection.cpp.hx",
+"snikket/jingle/Session.hx",
+"snikket/jingle/SessionDescription.hx",
+"snikket/persistence/Dummy.hx",
+"snikket/persistence/MediaStoreFS.hx",
+"snikket/persistence/Sqlite.hx",
+"snikket/persistence/SqliteDriver.hx",
+"snikket/queries/BlocklistGet.hx",
+"snikket/queries/BoB.hx",
+"snikket/queries/DiscoInfoGet.hx",
+"snikket/queries/DiscoItemsGet.hx",
+"snikket/queries/ExtDiscoGet.hx",
+"snikket/queries/GenericQuery.hx",
+"snikket/queries/HttpUploadSlot.hx",
+"snikket/queries/JabberIqGatewayGet.hx",
+"snikket/queries/MAMQuery.hx",
+"snikket/queries/PubsubGet.hx",
+"snikket/queries/Push2Disable.hx",
+"snikket/queries/RosterGet.hx",
+"snikket/queries/VcardTempGet.hx",
+"snikket/streams/XmppStropheStream.hx",
+"thenshim/Promise.hx",
+"thenshim/PromiseTools.hx",
+"thenshim/fallback/FallbackPromise.hx",
+"thenshim/fallback/FallbackPromiseFactory.hx",
+"thenshim/fallback/HandlerSession.hx",
+"thenshim/fallback/TaskScheduler.hx",
+"tink/Chunk.hx",
+"tink/Url.hx",
+"tink/chunk/ByteChunk.hx",
+"tink/chunk/ChunkBase.hx",
+"tink/chunk/ChunkCursor.hx",
+"tink/chunk/CompoundChunk.hx",
+"tink/core/Callback.hx",
+"tink/core/Disposable.hx",
+"tink/core/Error.hx",
+"tink/core/Future.hx",
+"tink/core/Lazy.hx",
+"tink/core/Named.hx",
+"tink/core/Pair.hx",
+"tink/core/Promise.hx",
+"tink/http/Client.hx",
+"tink/http/Fetch.hx",
+"tink/http/Header.hx",
+"tink/http/Message.hx",
+"tink/http/Request.hx",
+"tink/http/Response.hx",
+"tink/http/clients/CurlClient.hx",
+"tink/http/clients/Helpers.hx",
+"tink/http/clients/LocalContainerClient.hx",
+"tink/http/clients/SocketClient.hx",
+"tink/http/clients/StdClient.hx",
+"tink/http/containers/LocalContainer.hx",
+"tink/io/PipeResult.hx",
+"tink/io/Sink.hx",
+"tink/io/Source.hx",
+"tink/io/StreamParser.hx",
+"tink/io/Worker.hx",
+"tink/io/std/InputSource.hx",
+"tink/io/std/OutputSink.hx",
+"tink/streams/IdealStream.hx",
+"tink/streams/Stream.hx",
+"tink/url/Host.hx",
+"tink/url/Path.hx",
+#endif
+ 0 };
+
+const char *__hxcpp_all_files_fullpath[] = {
+#ifdef HXCPP_DEBUGGER
+"/usr/local/lib/haxe/std/Lambda.hx",
+"/usr/local/lib/haxe/std/StringTools.hx",
+"/usr/local/lib/haxe/std/UnicodeString.hx",
+"/usr/local/lib/haxe/std/Xml.hx",
+"/usr/local/lib/haxe/std/cpp/_std/Date.hx",
+"/usr/local/lib/haxe/std/cpp/_std/EReg.hx",
+"/usr/local/lib/haxe/std/cpp/_std/Reflect.hx",
+"/usr/local/lib/haxe/std/cpp/_std/Std.hx",
+"/usr/local/lib/haxe/std/cpp/_std/StringBuf.hx",
+"/usr/local/lib/haxe/std/cpp/_std/Sys.hx",
+"/usr/local/lib/haxe/std/cpp/_std/Type.hx",
+"/usr/local/lib/haxe/std/cpp/_std/haxe/Exception.hx",
+"/usr/local/lib/haxe/std/cpp/_std/haxe/Log.hx",
+"/usr/local/lib/haxe/std/cpp/_std/haxe/NativeStackTrace.hx",
+"/usr/local/lib/haxe/std/cpp/_std/haxe/ds/IntMap.hx",
+"/usr/local/lib/haxe/std/cpp/_std/haxe/ds/ObjectMap.hx",
+"/usr/local/lib/haxe/std/cpp/_std/haxe/ds/StringMap.hx",
+"/usr/local/lib/haxe/std/cpp/_std/sys/FileSystem.hx",
+"/usr/local/lib/haxe/std/cpp/_std/sys/db/Sqlite.hx",
+"/usr/local/lib/haxe/std/cpp/_std/sys/io/File.hx",
+"/usr/local/lib/haxe/std/cpp/_std/sys/io/FileInput.hx",
+"/usr/local/lib/haxe/std/cpp/_std/sys/io/FileOutput.hx",
+"/usr/local/lib/haxe/std/cpp/_std/sys/io/Process.hx",
+"/usr/local/lib/haxe/std/cpp/_std/sys/net/Host.hx",
+"/usr/local/lib/haxe/std/cpp/_std/sys/net/Socket.hx",
+"/usr/local/lib/haxe/std/cpp/_std/sys/ssl/Certificate.hx",
+"/usr/local/lib/haxe/std/cpp/_std/sys/ssl/Key.hx",
+"/usr/local/lib/haxe/std/cpp/_std/sys/ssl/Socket.hx",
+"/usr/local/lib/haxe/std/cpp/_std/sys/thread/Lock.hx",
+"/usr/local/lib/haxe/std/cpp/_std/sys/thread/Mutex.hx",
+"/usr/local/lib/haxe/std/cpp/_std/sys/thread/Thread.hx",
+"/usr/local/lib/haxe/std/haxe/EntryPoint.hx",
+"/usr/local/lib/haxe/std/haxe/MainLoop.hx",
+"/usr/local/lib/haxe/std/haxe/Timer.hx",
+"/usr/local/lib/haxe/std/haxe/ValueException.hx",
+"/usr/local/lib/haxe/std/haxe/crypto/Base64.hx",
+"/usr/local/lib/haxe/std/haxe/crypto/BaseCode.hx",
+"/usr/local/lib/haxe/std/haxe/crypto/Sha1.hx",
+"/usr/local/lib/haxe/std/haxe/crypto/Sha256.hx",
+"/usr/local/lib/haxe/std/haxe/ds/BalancedTree.hx",
+"/usr/local/lib/haxe/std/haxe/ds/EnumValueMap.hx",
+"/usr/local/lib/haxe/std/haxe/ds/List.hx",
+"/usr/local/lib/haxe/std/haxe/exceptions/NotImplementedException.hx",
+"/usr/local/lib/haxe/std/haxe/exceptions/PosException.hx",
+"/usr/local/lib/haxe/std/haxe/format/JsonParser.hx",
+"/usr/local/lib/haxe/std/haxe/format/JsonPrinter.hx",
+"/usr/local/lib/haxe/std/haxe/http/HttpBase.hx",
+"/usr/local/lib/haxe/std/haxe/io/Bytes.hx",
+"/usr/local/lib/haxe/std/haxe/io/BytesBuffer.hx",
+"/usr/local/lib/haxe/std/haxe/io/BytesInput.hx",
+"/usr/local/lib/haxe/std/haxe/io/BytesOutput.hx",
+"/usr/local/lib/haxe/std/haxe/io/Eof.hx",
+"/usr/local/lib/haxe/std/haxe/io/Input.hx",
+"/usr/local/lib/haxe/std/haxe/io/Output.hx",
+"/usr/local/lib/haxe/std/haxe/io/Path.hx",
+"/usr/local/lib/haxe/std/haxe/iterators/ArrayIterator.hx",
+"/usr/local/lib/haxe/std/haxe/iterators/MapKeyValueIterator.hx",
+"/usr/local/lib/haxe/std/haxe/xml/Parser.hx",
+"/usr/local/lib/haxe/std/haxe/xml/Printer.hx",
+"/usr/local/lib/haxe/std/sys/Http.hx",
+"/usr/local/lib/haxe/std/sys/thread/EventLoop.hx",
+"/usr/local/lib/haxe/std/sys/thread/NoEventLoopException.hx",
+"/Users/singpolyma/src/snikket-sdk/HaxeCBridge.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/datetime/3,1,4/src/datetime/DateTime.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/datetime/3,1,4/src/datetime/DateTimeInterval.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/datetime/3,1,4/src/datetime/cores/DateTimeIntervalCore.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/datetime/3,1,4/src/datetime/utils/DateTimeIntervalUtils.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/datetime/3,1,4/src/datetime/utils/DateTimeMonthUtils.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/datetime/3,1,4/src/datetime/utils/DateTimeUtils.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/hsluv/0,1,1/src/hsluv/Hsluv.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/HtmlParser/3,4,0/htmlparser/HtmlAttribute.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/HtmlParser/3,4,0/htmlparser/HtmlNodeElement.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/HtmlParser/3,4,0/htmlparser/HtmlNodeText.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/HtmlParser/3,4,0/htmlparser/HtmlParser.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/HtmlParser/3,4,0/htmlparser/HtmlParserException.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/HtmlParser/3,4,0/htmlparser/HtmlTools.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/http-status/1,3,1/src/httpstatus/HttpStatusMessage.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/haxe-strings/7,0,5/src/hx/strings/RandomStrings.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/haxe-strings/7,0,5/src/hx/strings/StringBuilder.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/haxe-strings/7,0,5/src/hx/strings/Strings.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/sha/0,0,1/src/sha/Hash.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/sha/0,0,1/src/sha/SHA256.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/AttachmentSource.cpp.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/Autolink.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/Caps.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/Chat.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/ChatMessage.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/ChatMessageBuilder.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/Client.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/Color.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/Config.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/Date.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/EmojiUtil.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/EventEmitter.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/EventHandler.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/GenericStream.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/Hash.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/ID.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/Identicon.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/JID.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/Message.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/MessageSync.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/ModerationAction.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/Notification.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/Participant.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/Persistence.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/Presence.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/PubsubEvent.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/Push.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/Reaction.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/ReactionUpdate.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/Stanza.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/StringUtil.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/Util.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/XEP0393.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/jingle/Group.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/jingle/PeerConnection.cpp.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/jingle/Session.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/jingle/SessionDescription.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/persistence/Dummy.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/persistence/MediaStoreFS.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/persistence/Sqlite.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/persistence/SqliteDriver.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/queries/BlocklistGet.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/queries/BoB.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/queries/DiscoInfoGet.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/queries/DiscoItemsGet.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/queries/ExtDiscoGet.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/queries/GenericQuery.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/queries/HttpUploadSlot.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/queries/JabberIqGatewayGet.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/queries/MAMQuery.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/queries/PubsubGet.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/queries/Push2Disable.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/queries/RosterGet.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/queries/VcardTempGet.hx",
+"/Users/singpolyma/src/snikket-sdk/snikket/streams/XmppStropheStream.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/thenshim/1,1,2/src/thenshim/Promise.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/thenshim/1,1,2/src/thenshim/PromiseTools.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/thenshim/1,1,2/src/thenshim/fallback/FallbackPromise.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/thenshim/1,1,2/src/thenshim/fallback/FallbackPromiseFactory.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/thenshim/1,1,2/src/thenshim/fallback/HandlerSession.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/thenshim/1,1,2/src/thenshim/fallback/TaskScheduler.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_chunk/0,4,0/src/tink/Chunk.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_url/0,5,0/src/tink/Url.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_chunk/0,4,0/src/tink/chunk/ByteChunk.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_chunk/0,4,0/src/tink/chunk/ChunkBase.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_chunk/0,4,0/src/tink/chunk/ChunkCursor.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_chunk/0,4,0/src/tink/chunk/CompoundChunk.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_core/2,1,1/src/tink/core/Callback.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_core/2,1,1/src/tink/core/Disposable.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_core/2,1,1/src/tink/core/Error.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_core/2,1,1/src/tink/core/Future.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_core/2,1,1/src/tink/core/Lazy.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_core/2,1,1/src/tink/core/Named.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_core/2,1,1/src/tink/core/Pair.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_core/2,1,1/src/tink/core/Promise.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_http/0,10,0/src/tink/http/Client.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_http/0,10,0/src/tink/http/Fetch.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_http/0,10,0/src/tink/http/Header.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_http/0,10,0/src/tink/http/Message.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_http/0,10,0/src/tink/http/Request.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_http/0,10,0/src/tink/http/Response.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_http/0,10,0/src/tink/http/clients/CurlClient.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_http/0,10,0/src/tink/http/clients/Helpers.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_http/0,10,0/src/tink/http/clients/LocalContainerClient.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_http/0,10,0/src/tink/http/clients/SocketClient.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_http/0,10,0/src/tink/http/clients/StdClient.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_http/0,10,0/src/tink/http/containers/LocalContainer.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_io/0,9,0/src/tink/io/PipeResult.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_io/0,9,0/src/tink/io/Sink.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_io/0,9,0/src/tink/io/Source.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_io/0,9,0/src/tink/io/StreamParser.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_io/0,9,0/src/tink/io/Worker.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_io/0,9,0/src/tink/io/std/InputSource.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_io/0,9,0/src/tink/io/std/OutputSink.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_streams/0,4,0/src/tink/streams/IdealStream.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_streams/0,4,0/src/tink/streams/Stream.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_url/0,5,0/src/tink/url/Host.hx",
+"/Users/singpolyma/.local/lib/haxe/lib/tink_url/0,5,0/src/tink/url/Path.hx",
+#endif
+ 0 };
+
+const char *__hxcpp_all_classes[] = {
+#ifdef HXCPP_DEBUGGER
+"Date",
+"EReg",
+"HaxeCBridge",
+"_HaxeCBridge.Int64Map_Impl_",
+"_HaxeCBridge.Internal",
+"Lambda",
+"Reflect",
+"Std",
+"StringBuf",
+"StringTools",
+"Sys",
+"Type",
+"_UnicodeString.UnicodeString_Impl_",
+"_Xml.XmlType_Impl_",
+"Xml",
+"cpp.Lib",
+"datetime._DateTime.DateTime_Impl_",
+"datetime._DateTimeInterval.DateTimeInterval_Impl_",
+"datetime.cores.DateTimeIntervalCore",
+"datetime.utils.DateTimeIntervalUtils",
+"datetime.utils.DateTimeMonthUtils",
+"datetime.utils.DateTimeUtils",
+"sys.thread.Mutex",
+"sys.thread.EventLoop",
+"sys.thread._Thread.HaxeThread",
+"haxe.EntryPoint",
+"haxe.Exception",
+"haxe.Log",
+"haxe.MainEvent",
+"haxe.MainLoop",
+"haxe.NativeStackTrace",
+"haxe.Timer",
+"haxe.ValueException",
+"haxe.io.Bytes",
+"haxe.crypto.Base64",
+"haxe.crypto.BaseCode",
+"haxe.crypto.Sha1",
+"haxe.crypto.Sha256",
+"haxe.ds.BalancedTree",
+"haxe.ds.TreeNode",
+"haxe.ds.EnumValueMap",
+"haxe.ds.IntMap",
+"haxe.ds.List",
+"haxe.ds._List.ListNode",
+"haxe.ds.ObjectMap",
+"haxe.ds.StringMap",
+"haxe.exceptions.PosException",
+"haxe.exceptions.NotImplementedException",
+"haxe.format.JsonParser",
+"haxe.format.JsonPrinter",
+"haxe.http.HttpBase",
+"haxe.io.BytesBuffer",
+"haxe.io.Input",
+"haxe.io.BytesInput",
+"haxe.io.Output",
+"haxe.io.BytesOutput",
+"haxe.io.Eof",
+"haxe.io.Path",
+"haxe.iterators.ArrayIterator",
+"haxe.iterators.MapKeyValueIterator",
+"haxe.xml.XmlParserException",
+"haxe.xml.Parser",
+"haxe.xml.Printer",
+"hsluv.Hsluv",
+"htmlparser.HtmlAttribute",
+"htmlparser.HtmlNode",
+"htmlparser.HtmlNodeElement",
+"htmlparser.HtmlNodeText",
+"htmlparser.HtmlParser",
+"htmlparser.HtmlParserException",
+"htmlparser.HtmlTools",
+"httpstatus._HttpStatusMessage.HttpStatusMessage_Impl_",
+"hx.strings.Strings",
+"hx.strings.RandomStrings",
+"hx.strings.StringBuilder",
+"sha.Hash",
+"sha.SHA256",
+"sha._SHA256.SHA256_Fields_",
+"snikket.AttachmentSource",
+"snikket.Autolink",
+"snikket.Caps",
+"snikket.Identity",
+"snikket.Chat",
+"snikket.DirectChat",
+"snikket.Channel",
+"snikket.AvailableChat",
+"snikket.SerializedChat",
+"snikket.ChatAttachment",
+"snikket.ChatMessage",
+"snikket.ChatMessageBuilder",
+"snikket.EventEmitter",
+"snikket.Client",
+"snikket.Color",
+"snikket.Config",
+"snikket.Date",
+"snikket.UnicodeList",
+"snikket.UnicodeRange",
+"snikket.UnicodeBlocks",
+"snikket.EmojiUtil",
+"snikket.Symbol",
+"snikket.Emoji",
+"snikket.Other",
+"snikket.Builder",
+"snikket.EventHandler",
+"snikket.GenericStream",
+"snikket.Hash",
+"snikket.ID",
+"snikket.Identicon",
+"snikket.JID",
+"snikket.Message",
+"snikket.MessageSync",
+"snikket.ModerationAction",
+"snikket.Notification",
+"snikket.Participant",
+"snikket.Presence",
+"snikket.PubsubEvent",
+"snikket._Push.Push_Fields_",
+"snikket.Reaction",
+"snikket.CustomEmojiReaction",
+"snikket.ReactionUpdate",
+"snikket.TextNode",
+"snikket.StanzaError",
+"snikket.Stanza",
+"snikket.StringUtil",
+"snikket._Util.Util_Fields_",
+"snikket.XEP0393",
+"snikket.jingle.Group",
+"snikket.jingle.DTMFSender",
+"snikket.jingle.AudioFormat",
+"snikket.jingle.MediaStreamTrack",
+"snikket.jingle.MediaStream",
+"snikket.jingle.PeerConnection",
+"snikket.jingle.IncomingProposedSession",
+"snikket.jingle.OutgoingProposedSession",
+"snikket.jingle.InitiatedSession",
+"snikket.jingle.OutgoingSession",
+"snikket.jingle._Session.Session_Fields_",
+"snikket.jingle.SessionDescription",
+"snikket.jingle.TransportInfo",
+"snikket.jingle.Media",
+"snikket.jingle.IceCandidate",
+"snikket.jingle.Attribute",
+"snikket.persistence.Dummy",
+"snikket.persistence.MediaStoreFS",
+"snikket.persistence.Sqlite",
+"snikket.persistence.SqliteDriver",
+"snikket.queries.GenericQuery",
+"snikket.queries.BlocklistGet",
+"snikket.queries.BoB",
+"snikket.queries.DiscoInfoGet",
+"snikket.queries.DiscoItemsGet",
+"snikket.queries.ExtDiscoGet",
+"snikket.queries.HttpUploadSlot",
+"snikket.queries.JabberIqGatewayGet",
+"snikket.queries.MAMQuery",
+"snikket.queries.PubsubGet",
+"snikket.queries.Push2Disable",
+"snikket.queries.RosterGet",
+"snikket.queries.VcardTempGet",
+"snikket.streams.XmppStropheStream",
+"sys.FileSystem",
+"sys.Http",
+"sys.db._Sqlite.SqliteConnection",
+"sys.db._Sqlite.SqliteResultSet",
+"sys.db.Sqlite",
+"sys.io.File",
+"sys.io.FileInput",
+"sys.io.FileOutput",
+"sys.io._Process.Stdin",
+"sys.io._Process.Stdout",
+"sys.io.Process",
+"sys.net.Host",
+"sys.net._Socket.SocketInput",
+"sys.net._Socket.SocketOutput",
+"sys.net.Socket",
+"sys.ssl.Certificate",
+"sys.ssl.Key",
+"sys.ssl._Socket.SocketInput",
+"sys.ssl._Socket.SocketOutput",
+"sys.ssl.Socket",
+"sys.thread._EventLoop.RegularEvent",
+"sys.thread.Lock",
+"sys.thread.NoEventLoopException",
+"sys.thread._Thread.Thread_Impl_",
+"thenshim.fallback.FallbackPromiseFactory",
+"thenshim.fallback.TaskScheduler",
+"thenshim._Promise.Promise_Impl_",
+"thenshim.PromiseTools",
+"thenshim.fallback.FallbackPromise",
+"thenshim.fallback.HandlerSession",
+"tink.chunk.ChunkBase",
+"tink._Chunk.EmptyChunk",
+"tink._Chunk.Chunk_Impl_",
+"tink._Url.Url_Impl_",
+"tink.chunk.ByteChunk",
+"tink.chunk.ChunkCursor",
+"tink.chunk.CompoundChunk",
+"tink.core._Callback.Callback_Impl_",
+"tink.core.CallbackLinkRef",
+"tink.core._Callback.LinkPair",
+"tink.core._Callback.ListCell",
+"tink.core.SimpleDisposable",
+"tink.core.CallbackList",
+"tink.core.TypedError",
+"tink.core._Future.FutureObject",
+"tink.core._Lazy.LazyConst",
+"tink.core._Future.SyncFuture",
+"tink.core._Future.Future_Impl_",
+"tink.core._Future.SuspendableFuture",
+"tink.core._Lazy.Lazy_Impl_",
+"tink.core._Lazy.LazyFunc",
+"tink.core.NamedWith",
+"tink.core.MPair",
+"tink.core._Promise.Promise_Impl_",
+"tink.http._Client.CustomClient",
+"tink.http.Fetch",
+"tink.http._Fetch.FetchResponse_Impl_",
+"tink.http.Header",
+"tink.http._Header.HeaderValue_Impl_",
+"tink.http.HeaderField",
+"tink.io.BytewiseParser",
+"tink.http.HeaderParser",
+"tink.http.Message",
+"tink.http.RequestHeader",
+"tink.http.IncomingRequestHeader",
+"tink.http.OutgoingRequestHeader",
+"tink.http.OutgoingRequest",
+"tink.http.IncomingRequest",
+"tink.http.ResponseHeaderBase",
+"tink.http._Response.OutgoingResponseData",
+"tink.http.IncomingResponse",
+"tink.http.clients.CurlClient",
+"tink.http.clients.Helpers",
+"tink.http.clients.LocalContainerClient",
+"tink.http.clients.SocketClient",
+"tink.http.clients.StdClient",
+"tink.http.containers.LocalContainer",
+"tink.io.PipeResultTools",
+"tink.io.SinkBase",
+"tink.io._Sink.SinkYielding_Impl_",
+"tink.streams.StreamBase",
+"tink.streams.Empty",
+"tink.io._Source.Source_Impl_",
+"tink.io.RealSourceTools",
+"tink.io.IdealSourceTools",
+"tink.io._StreamParser.StreamParser_Impl_",
+"tink.io._Worker.EagerWorker",
+"tink.io._Worker.Worker_Impl_",
+"tink.streams.Generator",
+"tink.io.std.InputSource",
+"tink.io.std.OutputSink",
+"tink.streams.IdealStreamBase",
+"tink.streams._Stream.Stream_Impl_",
+"tink.streams._Stream.Regrouper_Impl_",
+"tink.streams._Stream.CompoundStream",
+"tink.streams._Stream.RegroupStream",
+"tink.streams._Stream.ErrorStream",
+"tink.streams.IdealizeStream",
+"tink.streams.Single",
+"tink.streams._Stream.Handler_Impl_",
+"tink.streams._Stream.Reducer_Impl_",
+"tink.streams.FutureStream",
+"tink.url._Host.Host_Impl_",
+"tink.url._Path.Path_Impl_",
+#endif
+ 0 };
+} // namespace hx
+void __files__boot() { __hxcpp_set_debugger_info(::hx::__hxcpp_all_classes, ::hx::__hxcpp_all_files_fullpath); }
diff --git a/Sources/c_snikket/src/__lib__.cpp b/Sources/c_snikket/src/__lib__.cpp
new file mode 100644
index 0000000..86255b2
--- /dev/null
+++ b/Sources/c_snikket/src/__lib__.cpp
@@ -0,0 +1,18 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#include <stdio.h>
+
+extern "C" void __hxcpp_main();
+
+extern "C" void __hxcpp_lib_main();
+
+void __hxcpp_main() {
+ }
+
+void __hxcpp_lib_main() {
+ HX_TOP_OF_STACK
+ ::hx::Boot();
+ __boot_all();
+ __hxcpp_main();
+ }
diff --git a/Sources/c_snikket/src/__resources__.cpp b/Sources/c_snikket/src/__resources__.cpp
new file mode 100644
index 0000000..da8d947
--- /dev/null
+++ b/Sources/c_snikket/src/__resources__.cpp
@@ -0,0 +1,11 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+namespace hx {
+}
+
+::hx::Resource __Resources[] = {
+ { ::String(null()),0,0 }
+};
+
+namespace hx { Resource *GetResources() { return __Resources; } }
diff --git a/Sources/c_snikket/src/cpp/Lib.cpp b/Sources/c_snikket/src/cpp/Lib.cpp
new file mode 100644
index 0000000..233e526
--- /dev/null
+++ b/Sources/c_snikket/src/cpp/Lib.cpp
@@ -0,0 +1,62 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_cpp_Lib
+#include <cpp/Lib.h>
+#endif
+
+namespace cpp{
+
+void Lib_obj::__construct() { }
+
+Dynamic Lib_obj::__CreateEmpty() { return new Lib_obj; }
+
+void *Lib_obj::_hx_vtable = 0;
+
+Dynamic Lib_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Lib_obj > _hx_result = new Lib_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool Lib_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x561f6486;
+}
+
+
+Lib_obj::Lib_obj()
+{
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *Lib_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *Lib_obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class Lib_obj::__mClass;
+
+void Lib_obj::__register()
+{
+ Lib_obj _hx_dummy;
+ Lib_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("cpp.Lib",5a,26,48,78);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< Lib_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Lib_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Lib_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace cpp
diff --git a/Sources/c_snikket/src/datetime/_DateTime/DateTime_Impl_.cpp b/Sources/c_snikket/src/datetime/_DateTime/DateTime_Impl_.cpp
new file mode 100644
index 0000000..b9712e3
--- /dev/null
+++ b/Sources/c_snikket/src/datetime/_DateTime/DateTime_Impl_.cpp
@@ -0,0 +1,155 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_datetime__DateTime_DateTime_Impl_
+#include <datetime/_DateTime/DateTime_Impl_.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_5a09d285486cbbfe_312_getYear,"datetime._DateTime.DateTime_Impl_","getYear",0x24acbe07,"datetime._DateTime.DateTime_Impl_.getYear","datetime/DateTime.hx",312,0xa456c60f)
+HX_LOCAL_STACK_FRAME(_hx_pos_5a09d285486cbbfe_333_yearStart,"datetime._DateTime.DateTime_Impl_","yearStart",0xa4f73ef9,"datetime._DateTime.DateTime_Impl_.yearStart","datetime/DateTime.hx",333,0xa456c60f)
+HX_LOCAL_STACK_FRAME(_hx_pos_5a09d285486cbbfe_376_isLeapYear,"datetime._DateTime.DateTime_Impl_","isLeapYear",0xb042cf7b,"datetime._DateTime.DateTime_Impl_.isLeapYear","datetime/DateTime.hx",376,0xa456c60f)
+namespace datetime{
+namespace _DateTime{
+
+void DateTime_Impl__obj::__construct() { }
+
+Dynamic DateTime_Impl__obj::__CreateEmpty() { return new DateTime_Impl__obj; }
+
+void *DateTime_Impl__obj::_hx_vtable = 0;
+
+Dynamic DateTime_Impl__obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< DateTime_Impl__obj > _hx_result = new DateTime_Impl__obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool DateTime_Impl__obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x3ae93836;
+}
+
+int DateTime_Impl__obj::getYear(Float this1){
+ HX_STACKFRAME(&_hx_pos_5a09d285486cbbfe_312_getYear)
+HXLINE( 313) Float cquads = (( (Float)(::Std_obj::_hx_int((this1 / ((Float)12622780800.0)))) ) * ((Float)12622780800.0));
+HXLINE( 314) Float centuries = (( (Float)(::Std_obj::_hx_int(((this1 - cquads) / ((Float)3155673600.0)))) ) * ((Float)3155673600.0));
+HXLINE( 315) if ((centuries > ((Float)9467020800.))) {
+HXLINE( 316) centuries = (centuries - ((Float)3155673600.0));
+ }
+HXLINE( 318) Float quads = (( (Float)(::Std_obj::_hx_int((((this1 - cquads) - centuries) / ((Float)126230400.0)))) ) * ((Float)126230400.0));
+HXLINE( 319) int years = ::Std_obj::_hx_int(((((this1 - cquads) - centuries) - quads) / ( (Float)(31536000) )));
+HXLINE( 322) int _hx_tmp = (::Std_obj::_hx_int((cquads / ((Float)12622780800.0))) * 400);
+HXDLIN( 322) int _hx_tmp1 = (_hx_tmp + (::Std_obj::_hx_int((centuries / ((Float)3155673600.0))) * 100));
+HXDLIN( 322) int _hx_tmp2 = (_hx_tmp1 + (::Std_obj::_hx_int((quads / ((Float)126230400.0))) * 4));
+HXLINE( 325) int _hx_tmp3;
+HXDLIN( 325) if ((years == 4)) {
+HXLINE( 325) _hx_tmp3 = years;
+ }
+ else {
+HXLINE( 325) _hx_tmp3 = (years + 1);
+ }
+HXLINE( 321) return (_hx_tmp2 + _hx_tmp3);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(DateTime_Impl__obj,getYear,return )
+
+Float DateTime_Impl__obj::yearStart(Float this1){
+ HX_STACKFRAME(&_hx_pos_5a09d285486cbbfe_333_yearStart)
+HXLINE( 334) Float cquads = (( (Float)(::Std_obj::_hx_int((this1 / ((Float)12622780800.0)))) ) * ((Float)12622780800.0));
+HXLINE( 335) Float centuries = (( (Float)(::Std_obj::_hx_int(((this1 - cquads) / ((Float)3155673600.0)))) ) * ((Float)3155673600.0));
+HXLINE( 336) if ((centuries > ((Float)9467020800.))) {
+HXLINE( 337) centuries = (centuries - ((Float)3155673600.0));
+ }
+HXLINE( 339) Float quads = (( (Float)(::Std_obj::_hx_int((((this1 - cquads) - centuries) / ((Float)126230400.0)))) ) * ((Float)126230400.0));
+HXLINE( 341) int years = ::Std_obj::_hx_int(((((this1 - cquads) - centuries) - quads) / ( (Float)(31536000) )));
+HXLINE( 342) if ((years == 4)) {
+HXLINE( 343) years = (years - 1);
+ }
+HXLINE( 346) return ((((cquads + centuries) + quads) + (years * 31536000)) - ((Float)62135596800.0));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(DateTime_Impl__obj,yearStart,return )
+
+bool DateTime_Impl__obj::isLeapYear(Float this1){
+ HX_STACKFRAME(&_hx_pos_5a09d285486cbbfe_376_isLeapYear)
+HXDLIN( 376) int year = ::datetime::_DateTime::DateTime_Impl__obj::getYear(this1);
+HXDLIN( 376) if ((::hx::Mod(year,4) == 0)) {
+HXDLIN( 376) if ((::hx::Mod(year,100) == 0)) {
+HXDLIN( 376) return (::hx::Mod(year,400) == 0);
+ }
+ else {
+HXDLIN( 376) return true;
+ }
+ }
+ else {
+HXDLIN( 376) return false;
+ }
+HXDLIN( 376) return false;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(DateTime_Impl__obj,isLeapYear,return )
+
+
+DateTime_Impl__obj::DateTime_Impl__obj()
+{
+}
+
+bool DateTime_Impl__obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 7:
+ if (HX_FIELD_EQ(inName,"getYear") ) { outValue = getYear_dyn(); return true; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"yearStart") ) { outValue = yearStart_dyn(); return true; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"isLeapYear") ) { outValue = isLeapYear_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *DateTime_Impl__obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *DateTime_Impl__obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class DateTime_Impl__obj::__mClass;
+
+static ::String DateTime_Impl__obj_sStaticFields[] = {
+ HX_("getYear",73,79,ca,22),
+ HX_("yearStart",65,ad,8b,b2),
+ HX_("isLeapYear",8f,ff,8e,84),
+ ::String(null())
+};
+
+void DateTime_Impl__obj::__register()
+{
+ DateTime_Impl__obj _hx_dummy;
+ DateTime_Impl__obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("datetime._DateTime.DateTime_Impl_",02,f1,15,34);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &DateTime_Impl__obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(DateTime_Impl__obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< DateTime_Impl__obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = DateTime_Impl__obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = DateTime_Impl__obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace datetime
+} // end namespace _DateTime
diff --git a/Sources/c_snikket/src/datetime/_DateTimeInterval/DateTimeInterval_Impl_.cpp b/Sources/c_snikket/src/datetime/_DateTimeInterval/DateTimeInterval_Impl_.cpp
new file mode 100644
index 0000000..26e96d6
--- /dev/null
+++ b/Sources/c_snikket/src/datetime/_DateTimeInterval/DateTimeInterval_Impl_.cpp
@@ -0,0 +1,108 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_datetime__DateTimeInterval_DateTimeInterval_Impl_
+#include <datetime/_DateTimeInterval/DateTimeInterval_Impl_.h>
+#endif
+#ifndef INCLUDED_datetime_cores_DateTimeIntervalCore
+#include <datetime/cores/DateTimeIntervalCore.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_685e120148cc45a9_22_create,"datetime._DateTimeInterval.DateTimeInterval_Impl_","create",0xb737c388,"datetime._DateTimeInterval.DateTimeInterval_Impl_.create","datetime/DateTimeInterval.hx",22,0x301776ca)
+namespace datetime{
+namespace _DateTimeInterval{
+
+void DateTimeInterval_Impl__obj::__construct() { }
+
+Dynamic DateTimeInterval_Impl__obj::__CreateEmpty() { return new DateTimeInterval_Impl__obj; }
+
+void *DateTimeInterval_Impl__obj::_hx_vtable = 0;
+
+Dynamic DateTimeInterval_Impl__obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< DateTimeInterval_Impl__obj > _hx_result = new DateTimeInterval_Impl__obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool DateTimeInterval_Impl__obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x35e51cc0;
+}
+
+ ::datetime::cores::DateTimeIntervalCore DateTimeInterval_Impl__obj::create(Float begin,Float end){
+ HX_GC_STACKFRAME(&_hx_pos_685e120148cc45a9_22_create)
+HXLINE( 23) ::datetime::cores::DateTimeIntervalCore dtic = ::datetime::cores::DateTimeIntervalCore_obj::__alloc( HX_CTX );
+HXLINE( 24) Float _hx_tmp;
+HXDLIN( 24) if (((end - ((Float)62135596800.0)) < (begin - ((Float)62135596800.0)))) {
+HXLINE( 24) _hx_tmp = end;
+ }
+ else {
+HXLINE( 24) _hx_tmp = begin;
+ }
+HXDLIN( 24) dtic->begin = _hx_tmp;
+HXLINE( 25) Float _hx_tmp1;
+HXDLIN( 25) if (((end - ((Float)62135596800.0)) < (begin - ((Float)62135596800.0)))) {
+HXLINE( 25) _hx_tmp1 = begin;
+ }
+ else {
+HXLINE( 25) _hx_tmp1 = end;
+ }
+HXDLIN( 25) dtic->end = _hx_tmp1;
+HXLINE( 26) dtic->negative = ((end - ((Float)62135596800.0)) < (begin - ((Float)62135596800.0)));
+HXLINE( 28) return dtic;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(DateTimeInterval_Impl__obj,create,return )
+
+
+DateTimeInterval_Impl__obj::DateTimeInterval_Impl__obj()
+{
+}
+
+bool DateTimeInterval_Impl__obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 6:
+ if (HX_FIELD_EQ(inName,"create") ) { outValue = create_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *DateTimeInterval_Impl__obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *DateTimeInterval_Impl__obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class DateTimeInterval_Impl__obj::__mClass;
+
+static ::String DateTimeInterval_Impl__obj_sStaticFields[] = {
+ HX_("create",fc,66,0f,7c),
+ ::String(null())
+};
+
+void DateTimeInterval_Impl__obj::__register()
+{
+ DateTimeInterval_Impl__obj _hx_dummy;
+ DateTimeInterval_Impl__obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("datetime._DateTimeInterval.DateTimeInterval_Impl_",62,ea,b3,6b);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &DateTimeInterval_Impl__obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(DateTimeInterval_Impl__obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< DateTimeInterval_Impl__obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = DateTimeInterval_Impl__obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = DateTimeInterval_Impl__obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace datetime
+} // end namespace _DateTimeInterval
diff --git a/Sources/c_snikket/src/datetime/cores/DateTimeIntervalCore.cpp b/Sources/c_snikket/src/datetime/cores/DateTimeIntervalCore.cpp
new file mode 100644
index 0000000..cff5650
--- /dev/null
+++ b/Sources/c_snikket/src/datetime/cores/DateTimeIntervalCore.cpp
@@ -0,0 +1,572 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_95f339a1d026d52c
+#define INCLUDED_95f339a1d026d52c
+#include "hxMath.h"
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_datetime__DateTime_DateTime_Impl_
+#include <datetime/_DateTime/DateTime_Impl_.h>
+#endif
+#ifndef INCLUDED_datetime_cores_DateTimeIntervalCore
+#include <datetime/cores/DateTimeIntervalCore.h>
+#endif
+#ifndef INCLUDED_datetime_utils_DateTimeMonthUtils
+#include <datetime/utils/DateTimeMonthUtils.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_83aeac1808ae1ded_17_new,"datetime.cores.DateTimeIntervalCore","new",0xdc5b211e,"datetime.cores.DateTimeIntervalCore.new","datetime/cores/DateTimeIntervalCore.hx",17,0xa7130d90)
+HX_LOCAL_STACK_FRAME(_hx_pos_83aeac1808ae1ded_54_getYears,"datetime.cores.DateTimeIntervalCore","getYears",0xfda50a22,"datetime.cores.DateTimeIntervalCore.getYears","datetime/cores/DateTimeIntervalCore.hx",54,0xa7130d90)
+HX_LOCAL_STACK_FRAME(_hx_pos_83aeac1808ae1ded_93_getMonths,"datetime.cores.DateTimeIntervalCore","getMonths",0xf1168da7,"datetime.cores.DateTimeIntervalCore.getMonths","datetime/cores/DateTimeIntervalCore.hx",93,0xa7130d90)
+HX_LOCAL_STACK_FRAME(_hx_pos_83aeac1808ae1ded_135_getTotalMonths,"datetime.cores.DateTimeIntervalCore","getTotalMonths",0x56f0e323,"datetime.cores.DateTimeIntervalCore.getTotalMonths","datetime/cores/DateTimeIntervalCore.hx",135,0xa7130d90)
+HX_LOCAL_STACK_FRAME(_hx_pos_83aeac1808ae1ded_143_getDays,"datetime.cores.DateTimeIntervalCore","getDays",0x74f7920b,"datetime.cores.DateTimeIntervalCore.getDays","datetime/cores/DateTimeIntervalCore.hx",143,0xa7130d90)
+HX_LOCAL_STACK_FRAME(_hx_pos_83aeac1808ae1ded_178_getTotalDays,"datetime.cores.DateTimeIntervalCore","getTotalDays",0x56485087,"datetime.cores.DateTimeIntervalCore.getTotalDays","datetime/cores/DateTimeIntervalCore.hx",178,0xa7130d90)
+HX_LOCAL_STACK_FRAME(_hx_pos_83aeac1808ae1ded_186_getHours,"datetime.cores.DateTimeIntervalCore","getHours",0x3a807cdb,"datetime.cores.DateTimeIntervalCore.getHours","datetime/cores/DateTimeIntervalCore.hx",186,0xa7130d90)
+HX_LOCAL_STACK_FRAME(_hx_pos_83aeac1808ae1ded_215_getTotalHours,"datetime.cores.DateTimeIntervalCore","getTotalHours",0x7fd66adf,"datetime.cores.DateTimeIntervalCore.getTotalHours","datetime/cores/DateTimeIntervalCore.hx",215,0xa7130d90)
+HX_LOCAL_STACK_FRAME(_hx_pos_83aeac1808ae1ded_223_getMinutes,"datetime.cores.DateTimeIntervalCore","getMinutes",0x9d33802b,"datetime.cores.DateTimeIntervalCore.getMinutes","datetime/cores/DateTimeIntervalCore.hx",223,0xa7130d90)
+HX_LOCAL_STACK_FRAME(_hx_pos_83aeac1808ae1ded_248_getTotalMinutes,"datetime.cores.DateTimeIntervalCore","getTotalMinutes",0x5663f72f,"datetime.cores.DateTimeIntervalCore.getTotalMinutes","datetime/cores/DateTimeIntervalCore.hx",248,0xa7130d90)
+HX_LOCAL_STACK_FRAME(_hx_pos_83aeac1808ae1ded_256_getSeconds,"datetime.cores.DateTimeIntervalCore","getSeconds",0xa3e29f8b,"datetime.cores.DateTimeIntervalCore.getSeconds","datetime/cores/DateTimeIntervalCore.hx",256,0xa7130d90)
+HX_LOCAL_STACK_FRAME(_hx_pos_83aeac1808ae1ded_277_getTotalSeconds,"datetime.cores.DateTimeIntervalCore","getTotalSeconds",0x5d13168f,"datetime.cores.DateTimeIntervalCore.getTotalSeconds","datetime/cores/DateTimeIntervalCore.hx",277,0xa7130d90)
+namespace datetime{
+namespace cores{
+
+void DateTimeIntervalCore_obj::__construct(){
+ HX_STACKFRAME(&_hx_pos_83aeac1808ae1ded_17_new)
+HXLINE( 37) this->seconds = -1;
+HXLINE( 35) this->minutes = -1;
+HXLINE( 33) this->hours = -1;
+HXLINE( 31) this->days = -1;
+HXLINE( 29) this->months = -1;
+HXLINE( 27) this->years = -1;
+HXLINE( 19) this->negative = false;
+ }
+
+Dynamic DateTimeIntervalCore_obj::__CreateEmpty() { return new DateTimeIntervalCore_obj; }
+
+void *DateTimeIntervalCore_obj::_hx_vtable = 0;
+
+Dynamic DateTimeIntervalCore_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< DateTimeIntervalCore_obj > _hx_result = new DateTimeIntervalCore_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool DateTimeIntervalCore_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x2dc1c9d4;
+}
+
+int DateTimeIntervalCore_obj::getYears(){
+ HX_STACKFRAME(&_hx_pos_83aeac1808ae1ded_54_getYears)
+HXLINE( 55) if ((this->years < 0)) {
+HXLINE( 56) int _hx_tmp = ::datetime::_DateTime::DateTime_Impl__obj::getYear(this->end);
+HXDLIN( 56) this->years = (_hx_tmp - ::datetime::_DateTime::DateTime_Impl__obj::getYear(this->begin));
+HXLINE( 58) Float this1 = this->begin;
+HXDLIN( 58) int days = (::Std_obj::_hx_int((((this1 - ((Float)62135596800.0)) - ::datetime::_DateTime::DateTime_Impl__obj::yearStart(this1)) / ( (Float)(86400) ))) + 1);
+HXDLIN( 58) int m1 = ::datetime::utils::DateTimeMonthUtils_obj::getMonth(days,::datetime::_DateTime::DateTime_Impl__obj::isLeapYear(this1));
+HXLINE( 59) Float this2 = this->end;
+HXDLIN( 59) int days1 = (::Std_obj::_hx_int((((this2 - ((Float)62135596800.0)) - ::datetime::_DateTime::DateTime_Impl__obj::yearStart(this2)) / ( (Float)(86400) ))) + 1);
+HXDLIN( 59) int m2 = ::datetime::utils::DateTimeMonthUtils_obj::getMonth(days1,::datetime::_DateTime::DateTime_Impl__obj::isLeapYear(this2));
+HXLINE( 60) if ((m2 < m1)) {
+HXLINE( 61) this->years--;
+ }
+ else {
+HXLINE( 62) if ((m1 == m2)) {
+HXLINE( 63) Float this3 = this->begin;
+HXDLIN( 63) int days2 = (::Std_obj::_hx_int((((this3 - ((Float)62135596800.0)) - ::datetime::_DateTime::DateTime_Impl__obj::yearStart(this3)) / ( (Float)(86400) ))) + 1);
+HXDLIN( 63) int d1 = ::datetime::utils::DateTimeMonthUtils_obj::getMonthDay(days2,::datetime::_DateTime::DateTime_Impl__obj::isLeapYear(this3));
+HXLINE( 64) Float this4 = this->end;
+HXDLIN( 64) int days3 = (::Std_obj::_hx_int((((this4 - ((Float)62135596800.0)) - ::datetime::_DateTime::DateTime_Impl__obj::yearStart(this4)) / ( (Float)(86400) ))) + 1);
+HXDLIN( 64) int d2 = ::datetime::utils::DateTimeMonthUtils_obj::getMonthDay(days3,::datetime::_DateTime::DateTime_Impl__obj::isLeapYear(this4));
+HXLINE( 65) if ((d2 < d1)) {
+HXLINE( 66) this->years--;
+ }
+ else {
+HXLINE( 67) if ((d1 == d2)) {
+HXLINE( 68) Float this5 = this->begin;
+HXDLIN( 68) int h1 = ::Std_obj::_hx_int(((this5 - (::Math_obj::ffloor((this5 / ( (Float)(86400) ))) * ( (Float)(86400) ))) / ( (Float)(3600) )));
+HXLINE( 69) Float this6 = this->end;
+HXDLIN( 69) int h2 = ::Std_obj::_hx_int(((this6 - (::Math_obj::ffloor((this6 / ( (Float)(86400) ))) * ( (Float)(86400) ))) / ( (Float)(3600) )));
+HXLINE( 70) if ((h2 < h1)) {
+HXLINE( 71) this->years--;
+ }
+ else {
+HXLINE( 72) if ((h2 == h1)) {
+HXLINE( 73) Float this7 = this->begin;
+HXDLIN( 73) int m11 = ::Std_obj::_hx_int(((this7 - (::Math_obj::ffloor((this7 / ( (Float)(3600) ))) * ( (Float)(3600) ))) / ( (Float)(60) )));
+HXLINE( 74) Float this8 = this->end;
+HXDLIN( 74) int m21 = ::Std_obj::_hx_int(((this8 - (::Math_obj::ffloor((this8 / ( (Float)(3600) ))) * ( (Float)(3600) ))) / ( (Float)(60) )));
+HXLINE( 75) if ((m21 < m11)) {
+HXLINE( 76) this->years--;
+ }
+ else {
+HXLINE( 77) bool _hx_tmp1;
+HXDLIN( 77) if ((m21 == m11)) {
+HXLINE( 77) Float this9 = this->end;
+HXDLIN( 77) int _hx_tmp2 = ::Std_obj::_hx_int((this9 - (::Math_obj::ffloor((this9 / ( (Float)(60) ))) * ( (Float)(60) ))));
+HXDLIN( 77) Float this10 = this->begin;
+HXDLIN( 77) _hx_tmp1 = (_hx_tmp2 < ::Std_obj::_hx_int((this10 - (::Math_obj::ffloor((this10 / ( (Float)(60) ))) * ( (Float)(60) )))));
+ }
+ else {
+HXLINE( 77) _hx_tmp1 = false;
+ }
+HXDLIN( 77) if (_hx_tmp1) {
+HXLINE( 78) this->years--;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+HXLINE( 85) return this->years;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(DateTimeIntervalCore_obj,getYears,return )
+
+int DateTimeIntervalCore_obj::getMonths(){
+ HX_STACKFRAME(&_hx_pos_83aeac1808ae1ded_93_getMonths)
+HXLINE( 94) if ((this->months < 0)) {
+HXLINE( 95) Float this1 = this->begin;
+HXDLIN( 95) int days = (::Std_obj::_hx_int((((this1 - ((Float)62135596800.0)) - ::datetime::_DateTime::DateTime_Impl__obj::yearStart(this1)) / ( (Float)(86400) ))) + 1);
+HXDLIN( 95) int monthBegin = ::datetime::utils::DateTimeMonthUtils_obj::getMonth(days,::datetime::_DateTime::DateTime_Impl__obj::isLeapYear(this1));
+HXLINE( 96) Float this2 = this->end;
+HXDLIN( 96) int days1 = (::Std_obj::_hx_int((((this2 - ((Float)62135596800.0)) - ::datetime::_DateTime::DateTime_Impl__obj::yearStart(this2)) / ( (Float)(86400) ))) + 1);
+HXDLIN( 96) int monthEnd = ::datetime::utils::DateTimeMonthUtils_obj::getMonth(days1,::datetime::_DateTime::DateTime_Impl__obj::isLeapYear(this2));
+HXLINE( 98) int _hx_tmp;
+HXDLIN( 98) if ((monthBegin <= monthEnd)) {
+HXLINE( 98) _hx_tmp = (monthEnd - monthBegin);
+ }
+ else {
+HXLINE( 98) _hx_tmp = ((12 - monthBegin) + monthEnd);
+ }
+HXDLIN( 98) this->months = _hx_tmp;
+HXLINE( 104) Float this3 = this->begin;
+HXDLIN( 104) int days2 = (::Std_obj::_hx_int((((this3 - ((Float)62135596800.0)) - ::datetime::_DateTime::DateTime_Impl__obj::yearStart(this3)) / ( (Float)(86400) ))) + 1);
+HXDLIN( 104) int d1 = ::datetime::utils::DateTimeMonthUtils_obj::getMonthDay(days2,::datetime::_DateTime::DateTime_Impl__obj::isLeapYear(this3));
+HXLINE( 105) Float this4 = this->end;
+HXDLIN( 105) int days3 = (::Std_obj::_hx_int((((this4 - ((Float)62135596800.0)) - ::datetime::_DateTime::DateTime_Impl__obj::yearStart(this4)) / ( (Float)(86400) ))) + 1);
+HXDLIN( 105) int d2 = ::datetime::utils::DateTimeMonthUtils_obj::getMonthDay(days3,::datetime::_DateTime::DateTime_Impl__obj::isLeapYear(this4));
+HXLINE( 106) if ((d2 < d1)) {
+HXLINE( 107) this->months--;
+ }
+ else {
+HXLINE( 108) if ((d1 == d2)) {
+HXLINE( 109) Float this5 = this->begin;
+HXDLIN( 109) int h1 = ::Std_obj::_hx_int(((this5 - (::Math_obj::ffloor((this5 / ( (Float)(86400) ))) * ( (Float)(86400) ))) / ( (Float)(3600) )));
+HXLINE( 110) Float this6 = this->end;
+HXDLIN( 110) int h2 = ::Std_obj::_hx_int(((this6 - (::Math_obj::ffloor((this6 / ( (Float)(86400) ))) * ( (Float)(86400) ))) / ( (Float)(3600) )));
+HXLINE( 111) if ((h2 < h1)) {
+HXLINE( 112) this->months--;
+ }
+ else {
+HXLINE( 113) if ((h2 == h1)) {
+HXLINE( 114) Float this7 = this->begin;
+HXDLIN( 114) int m1 = ::Std_obj::_hx_int(((this7 - (::Math_obj::ffloor((this7 / ( (Float)(3600) ))) * ( (Float)(3600) ))) / ( (Float)(60) )));
+HXLINE( 115) Float this8 = this->end;
+HXDLIN( 115) int m2 = ::Std_obj::_hx_int(((this8 - (::Math_obj::ffloor((this8 / ( (Float)(3600) ))) * ( (Float)(3600) ))) / ( (Float)(60) )));
+HXLINE( 116) if ((m2 < m1)) {
+HXLINE( 117) this->months--;
+ }
+ else {
+HXLINE( 118) bool _hx_tmp1;
+HXDLIN( 118) if ((m2 == m1)) {
+HXLINE( 118) Float this9 = this->end;
+HXDLIN( 118) int _hx_tmp2 = ::Std_obj::_hx_int((this9 - (::Math_obj::ffloor((this9 / ( (Float)(60) ))) * ( (Float)(60) ))));
+HXDLIN( 118) Float this10 = this->begin;
+HXDLIN( 118) _hx_tmp1 = (_hx_tmp2 < ::Std_obj::_hx_int((this10 - (::Math_obj::ffloor((this10 / ( (Float)(60) ))) * ( (Float)(60) )))));
+ }
+ else {
+HXLINE( 118) _hx_tmp1 = false;
+ }
+HXDLIN( 118) if (_hx_tmp1) {
+HXLINE( 119) this->months--;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+HXLINE( 125) return this->months;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(DateTimeIntervalCore_obj,getMonths,return )
+
+int DateTimeIntervalCore_obj::getTotalMonths(){
+ HX_STACKFRAME(&_hx_pos_83aeac1808ae1ded_135_getTotalMonths)
+HXDLIN( 135) int _hx_tmp = (this->getYears() * 12);
+HXDLIN( 135) return (_hx_tmp + this->getMonths());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(DateTimeIntervalCore_obj,getTotalMonths,return )
+
+int DateTimeIntervalCore_obj::getDays(){
+ HX_STACKFRAME(&_hx_pos_83aeac1808ae1ded_143_getDays)
+HXLINE( 144) if ((this->days < 0)) {
+HXLINE( 145) Float this1 = this->begin;
+HXDLIN( 145) int days = (::Std_obj::_hx_int((((this1 - ((Float)62135596800.0)) - ::datetime::_DateTime::DateTime_Impl__obj::yearStart(this1)) / ( (Float)(86400) ))) + 1);
+HXDLIN( 145) int dayBegin = ::datetime::utils::DateTimeMonthUtils_obj::getMonthDay(days,::datetime::_DateTime::DateTime_Impl__obj::isLeapYear(this1));
+HXLINE( 146) Float this2 = this->end;
+HXDLIN( 146) int days1 = (::Std_obj::_hx_int((((this2 - ((Float)62135596800.0)) - ::datetime::_DateTime::DateTime_Impl__obj::yearStart(this2)) / ( (Float)(86400) ))) + 1);
+HXDLIN( 146) int dayEnd = ::datetime::utils::DateTimeMonthUtils_obj::getMonthDay(days1,::datetime::_DateTime::DateTime_Impl__obj::isLeapYear(this2));
+HXLINE( 148) int _hx_tmp;
+HXDLIN( 148) if ((dayBegin <= dayEnd)) {
+HXLINE( 148) _hx_tmp = (dayEnd - dayBegin);
+ }
+ else {
+HXLINE( 151) Float this3 = this->begin;
+HXDLIN( 151) int days2 = (::Std_obj::_hx_int((((this3 - ((Float)62135596800.0)) - ::datetime::_DateTime::DateTime_Impl__obj::yearStart(this3)) / ( (Float)(86400) ))) + 1);
+HXDLIN( 151) int _hx_tmp1 = ::datetime::utils::DateTimeMonthUtils_obj::getMonth(days2,::datetime::_DateTime::DateTime_Impl__obj::isLeapYear(this3));
+HXLINE( 148) _hx_tmp = ((::datetime::utils::DateTimeMonthUtils_obj::days(_hx_tmp1,::datetime::_DateTime::DateTime_Impl__obj::isLeapYear(this->begin)) - dayBegin) + dayEnd);
+ }
+HXDLIN( 148) this->days = _hx_tmp;
+HXLINE( 154) Float this4 = this->begin;
+HXDLIN( 154) int h1 = ::Std_obj::_hx_int(((this4 - (::Math_obj::ffloor((this4 / ( (Float)(86400) ))) * ( (Float)(86400) ))) / ( (Float)(3600) )));
+HXLINE( 155) Float this5 = this->end;
+HXDLIN( 155) int h2 = ::Std_obj::_hx_int(((this5 - (::Math_obj::ffloor((this5 / ( (Float)(86400) ))) * ( (Float)(86400) ))) / ( (Float)(3600) )));
+HXLINE( 156) if ((h2 < h1)) {
+HXLINE( 157) this->days--;
+ }
+ else {
+HXLINE( 158) if ((h2 == h1)) {
+HXLINE( 159) Float this6 = this->begin;
+HXDLIN( 159) int m1 = ::Std_obj::_hx_int(((this6 - (::Math_obj::ffloor((this6 / ( (Float)(3600) ))) * ( (Float)(3600) ))) / ( (Float)(60) )));
+HXLINE( 160) Float this7 = this->end;
+HXDLIN( 160) int m2 = ::Std_obj::_hx_int(((this7 - (::Math_obj::ffloor((this7 / ( (Float)(3600) ))) * ( (Float)(3600) ))) / ( (Float)(60) )));
+HXLINE( 161) if ((m2 < m1)) {
+HXLINE( 162) this->days--;
+ }
+ else {
+HXLINE( 163) bool _hx_tmp2;
+HXDLIN( 163) if ((m2 == m1)) {
+HXLINE( 163) Float this8 = this->end;
+HXDLIN( 163) int _hx_tmp3 = ::Std_obj::_hx_int((this8 - (::Math_obj::ffloor((this8 / ( (Float)(60) ))) * ( (Float)(60) ))));
+HXDLIN( 163) Float this9 = this->begin;
+HXDLIN( 163) _hx_tmp2 = (_hx_tmp3 < ::Std_obj::_hx_int((this9 - (::Math_obj::ffloor((this9 / ( (Float)(60) ))) * ( (Float)(60) )))));
+ }
+ else {
+HXLINE( 163) _hx_tmp2 = false;
+ }
+HXDLIN( 163) if (_hx_tmp2) {
+HXLINE( 164) this->days--;
+ }
+ }
+ }
+ }
+ }
+HXLINE( 169) return this->days;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(DateTimeIntervalCore_obj,getDays,return )
+
+int DateTimeIntervalCore_obj::getTotalDays(){
+ HX_STACKFRAME(&_hx_pos_83aeac1808ae1ded_178_getTotalDays)
+HXDLIN( 178) return ::Std_obj::_hx_int((((this->end - ((Float)62135596800.0)) - (this->begin - ((Float)62135596800.0))) / ( (Float)(86400) )));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(DateTimeIntervalCore_obj,getTotalDays,return )
+
+int DateTimeIntervalCore_obj::getHours(){
+ HX_STACKFRAME(&_hx_pos_83aeac1808ae1ded_186_getHours)
+HXLINE( 187) if ((this->hours < 0)) {
+HXLINE( 188) Float this1 = this->begin;
+HXDLIN( 188) int hourBegin = ::Std_obj::_hx_int(((this1 - (::Math_obj::ffloor((this1 / ( (Float)(86400) ))) * ( (Float)(86400) ))) / ( (Float)(3600) )));
+HXLINE( 189) Float this2 = this->end;
+HXDLIN( 189) int hourEnd = ::Std_obj::_hx_int(((this2 - (::Math_obj::ffloor((this2 / ( (Float)(86400) ))) * ( (Float)(86400) ))) / ( (Float)(3600) )));
+HXLINE( 191) int _hx_tmp;
+HXDLIN( 191) if ((hourBegin <= hourEnd)) {
+HXLINE( 191) _hx_tmp = (hourEnd - hourBegin);
+ }
+ else {
+HXLINE( 191) _hx_tmp = ((24 - hourBegin) + hourEnd);
+ }
+HXDLIN( 191) this->hours = _hx_tmp;
+HXLINE( 197) Float this3 = this->begin;
+HXDLIN( 197) int m1 = ::Std_obj::_hx_int(((this3 - (::Math_obj::ffloor((this3 / ( (Float)(3600) ))) * ( (Float)(3600) ))) / ( (Float)(60) )));
+HXLINE( 198) Float this4 = this->end;
+HXDLIN( 198) int m2 = ::Std_obj::_hx_int(((this4 - (::Math_obj::ffloor((this4 / ( (Float)(3600) ))) * ( (Float)(3600) ))) / ( (Float)(60) )));
+HXLINE( 199) if ((m2 < m1)) {
+HXLINE( 200) this->hours--;
+ }
+ else {
+HXLINE( 201) bool _hx_tmp1;
+HXDLIN( 201) if ((m2 == m1)) {
+HXLINE( 201) Float this5 = this->end;
+HXDLIN( 201) int _hx_tmp2 = ::Std_obj::_hx_int((this5 - (::Math_obj::ffloor((this5 / ( (Float)(60) ))) * ( (Float)(60) ))));
+HXDLIN( 201) Float this6 = this->begin;
+HXDLIN( 201) _hx_tmp1 = (_hx_tmp2 < ::Std_obj::_hx_int((this6 - (::Math_obj::ffloor((this6 / ( (Float)(60) ))) * ( (Float)(60) )))));
+ }
+ else {
+HXLINE( 201) _hx_tmp1 = false;
+ }
+HXDLIN( 201) if (_hx_tmp1) {
+HXLINE( 202) this->hours--;
+ }
+ }
+ }
+HXLINE( 206) return this->hours;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(DateTimeIntervalCore_obj,getHours,return )
+
+int DateTimeIntervalCore_obj::getTotalHours(){
+ HX_STACKFRAME(&_hx_pos_83aeac1808ae1ded_215_getTotalHours)
+HXDLIN( 215) return ::Std_obj::_hx_int((((this->end - ((Float)62135596800.0)) - (this->begin - ((Float)62135596800.0))) / ( (Float)(3600) )));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(DateTimeIntervalCore_obj,getTotalHours,return )
+
+int DateTimeIntervalCore_obj::getMinutes(){
+ HX_STACKFRAME(&_hx_pos_83aeac1808ae1ded_223_getMinutes)
+HXLINE( 224) if ((this->minutes < 0)) {
+HXLINE( 225) Float this1 = this->begin;
+HXDLIN( 225) int minuteBegin = ::Std_obj::_hx_int(((this1 - (::Math_obj::ffloor((this1 / ( (Float)(3600) ))) * ( (Float)(3600) ))) / ( (Float)(60) )));
+HXLINE( 226) Float this2 = this->end;
+HXDLIN( 226) int minuteEnd = ::Std_obj::_hx_int(((this2 - (::Math_obj::ffloor((this2 / ( (Float)(3600) ))) * ( (Float)(3600) ))) / ( (Float)(60) )));
+HXLINE( 228) int _hx_tmp;
+HXDLIN( 228) if ((minuteBegin <= minuteEnd)) {
+HXLINE( 228) _hx_tmp = (minuteEnd - minuteBegin);
+ }
+ else {
+HXLINE( 228) _hx_tmp = ((60 - minuteBegin) + minuteEnd);
+ }
+HXDLIN( 228) this->minutes = _hx_tmp;
+HXLINE( 234) Float this3 = this->end;
+HXDLIN( 234) int _hx_tmp1 = ::Std_obj::_hx_int((this3 - (::Math_obj::ffloor((this3 / ( (Float)(60) ))) * ( (Float)(60) ))));
+HXDLIN( 234) Float this4 = this->begin;
+HXDLIN( 234) if ((_hx_tmp1 < ::Std_obj::_hx_int((this4 - (::Math_obj::ffloor((this4 / ( (Float)(60) ))) * ( (Float)(60) )))))) {
+HXLINE( 235) this->minutes--;
+ }
+ }
+HXLINE( 239) return this->minutes;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(DateTimeIntervalCore_obj,getMinutes,return )
+
+int DateTimeIntervalCore_obj::getTotalMinutes(){
+ HX_STACKFRAME(&_hx_pos_83aeac1808ae1ded_248_getTotalMinutes)
+HXDLIN( 248) return ::Std_obj::_hx_int((((this->end - ((Float)62135596800.0)) - (this->begin - ((Float)62135596800.0))) / ( (Float)(60) )));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(DateTimeIntervalCore_obj,getTotalMinutes,return )
+
+int DateTimeIntervalCore_obj::getSeconds(){
+ HX_STACKFRAME(&_hx_pos_83aeac1808ae1ded_256_getSeconds)
+HXLINE( 257) if ((this->seconds < 0)) {
+HXLINE( 258) Float this1 = this->begin;
+HXDLIN( 258) int secondBegin = ::Std_obj::_hx_int((this1 - (::Math_obj::ffloor((this1 / ( (Float)(60) ))) * ( (Float)(60) ))));
+HXLINE( 259) Float this2 = this->end;
+HXDLIN( 259) int secondEnd = ::Std_obj::_hx_int((this2 - (::Math_obj::ffloor((this2 / ( (Float)(60) ))) * ( (Float)(60) ))));
+HXLINE( 261) int _hx_tmp;
+HXDLIN( 261) if ((secondBegin <= secondEnd)) {
+HXLINE( 261) _hx_tmp = (secondEnd - secondBegin);
+ }
+ else {
+HXLINE( 261) _hx_tmp = ((60 - secondBegin) + secondEnd);
+ }
+HXDLIN( 261) this->seconds = _hx_tmp;
+ }
+HXLINE( 268) return this->seconds;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(DateTimeIntervalCore_obj,getSeconds,return )
+
+Float DateTimeIntervalCore_obj::getTotalSeconds(){
+ HX_STACKFRAME(&_hx_pos_83aeac1808ae1ded_277_getTotalSeconds)
+HXDLIN( 277) return ((this->end - ((Float)62135596800.0)) - (this->begin - ((Float)62135596800.0)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(DateTimeIntervalCore_obj,getTotalSeconds,return )
+
+
+::hx::ObjectPtr< DateTimeIntervalCore_obj > DateTimeIntervalCore_obj::__new() {
+ ::hx::ObjectPtr< DateTimeIntervalCore_obj > __this = new DateTimeIntervalCore_obj();
+ __this->__construct();
+ return __this;
+}
+
+::hx::ObjectPtr< DateTimeIntervalCore_obj > DateTimeIntervalCore_obj::__alloc(::hx::Ctx *_hx_ctx) {
+ DateTimeIntervalCore_obj *__this = (DateTimeIntervalCore_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(DateTimeIntervalCore_obj), false, "datetime.cores.DateTimeIntervalCore"));
+ *(void **)__this = DateTimeIntervalCore_obj::_hx_vtable;
+ __this->__construct();
+ return __this;
+}
+
+DateTimeIntervalCore_obj::DateTimeIntervalCore_obj()
+{
+}
+
+::hx::Val DateTimeIntervalCore_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"end") ) { return ::hx::Val( end ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"days") ) { return ::hx::Val( days ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"begin") ) { return ::hx::Val( begin ); }
+ if (HX_FIELD_EQ(inName,"years") ) { return ::hx::Val( years ); }
+ if (HX_FIELD_EQ(inName,"hours") ) { return ::hx::Val( hours ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"months") ) { return ::hx::Val( months ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"minutes") ) { return ::hx::Val( minutes ); }
+ if (HX_FIELD_EQ(inName,"seconds") ) { return ::hx::Val( seconds ); }
+ if (HX_FIELD_EQ(inName,"getDays") ) { return ::hx::Val( getDays_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"negative") ) { return ::hx::Val( negative ); }
+ if (HX_FIELD_EQ(inName,"getYears") ) { return ::hx::Val( getYears_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getHours") ) { return ::hx::Val( getHours_dyn() ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"getMonths") ) { return ::hx::Val( getMonths_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"getMinutes") ) { return ::hx::Val( getMinutes_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getSeconds") ) { return ::hx::Val( getSeconds_dyn() ); }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"getTotalDays") ) { return ::hx::Val( getTotalDays_dyn() ); }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"getTotalHours") ) { return ::hx::Val( getTotalHours_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"getTotalMonths") ) { return ::hx::Val( getTotalMonths_dyn() ); }
+ break;
+ case 15:
+ if (HX_FIELD_EQ(inName,"getTotalMinutes") ) { return ::hx::Val( getTotalMinutes_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getTotalSeconds") ) { return ::hx::Val( getTotalSeconds_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val DateTimeIntervalCore_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"end") ) { end=inValue.Cast< Float >(); return inValue; }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"days") ) { days=inValue.Cast< int >(); return inValue; }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"begin") ) { begin=inValue.Cast< Float >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"years") ) { years=inValue.Cast< int >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"hours") ) { hours=inValue.Cast< int >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"months") ) { months=inValue.Cast< int >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"minutes") ) { minutes=inValue.Cast< int >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"seconds") ) { seconds=inValue.Cast< int >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"negative") ) { negative=inValue.Cast< bool >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void DateTimeIntervalCore_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("negative",75,26,42,51));
+ outFields->push(HX_("begin",29,ea,55,b0));
+ outFields->push(HX_("end",db,03,4d,00));
+ outFields->push(HX_("years",16,bc,88,ee));
+ outFields->push(HX_("months",33,91,6e,c7));
+ outFields->push(HX_("days",97,5a,63,42));
+ outFields->push(HX_("hours",cf,2e,64,2b));
+ outFields->push(HX_("minutes",1f,97,de,53));
+ outFields->push(HX_("seconds",7f,b6,8d,5a));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo DateTimeIntervalCore_obj_sMemberStorageInfo[] = {
+ {::hx::fsBool,(int)offsetof(DateTimeIntervalCore_obj,negative),HX_("negative",75,26,42,51)},
+ {::hx::fsFloat,(int)offsetof(DateTimeIntervalCore_obj,begin),HX_("begin",29,ea,55,b0)},
+ {::hx::fsFloat,(int)offsetof(DateTimeIntervalCore_obj,end),HX_("end",db,03,4d,00)},
+ {::hx::fsInt,(int)offsetof(DateTimeIntervalCore_obj,years),HX_("years",16,bc,88,ee)},
+ {::hx::fsInt,(int)offsetof(DateTimeIntervalCore_obj,months),HX_("months",33,91,6e,c7)},
+ {::hx::fsInt,(int)offsetof(DateTimeIntervalCore_obj,days),HX_("days",97,5a,63,42)},
+ {::hx::fsInt,(int)offsetof(DateTimeIntervalCore_obj,hours),HX_("hours",cf,2e,64,2b)},
+ {::hx::fsInt,(int)offsetof(DateTimeIntervalCore_obj,minutes),HX_("minutes",1f,97,de,53)},
+ {::hx::fsInt,(int)offsetof(DateTimeIntervalCore_obj,seconds),HX_("seconds",7f,b6,8d,5a)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *DateTimeIntervalCore_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String DateTimeIntervalCore_obj_sMemberFields[] = {
+ HX_("negative",75,26,42,51),
+ HX_("begin",29,ea,55,b0),
+ HX_("end",db,03,4d,00),
+ HX_("years",16,bc,88,ee),
+ HX_("months",33,91,6e,c7),
+ HX_("days",97,5a,63,42),
+ HX_("hours",cf,2e,64,2b),
+ HX_("minutes",1f,97,de,53),
+ HX_("seconds",7f,b6,8d,5a),
+ HX_("getYears",a0,cb,5f,4e),
+ HX_("getMonths",69,1a,c5,43),
+ HX_("getTotalMonths",21,d7,42,15),
+ HX_("getDays",4d,0a,e6,14),
+ HX_("getTotalDays",05,a9,74,6e),
+ HX_("getHours",59,3e,3b,8b),
+ HX_("getTotalHours",a1,80,77,8e),
+ HX_("getMinutes",29,1d,40,a3),
+ HX_("getTotalMinutes",71,81,c7,1f),
+ HX_("getSeconds",89,3c,ef,a9),
+ HX_("getTotalSeconds",d1,a0,76,26),
+ ::String(null()) };
+
+::hx::Class DateTimeIntervalCore_obj::__mClass;
+
+void DateTimeIntervalCore_obj::__register()
+{
+ DateTimeIntervalCore_obj _hx_dummy;
+ DateTimeIntervalCore_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("datetime.cores.DateTimeIntervalCore",2c,fa,f8,5e);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(DateTimeIntervalCore_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< DateTimeIntervalCore_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = DateTimeIntervalCore_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = DateTimeIntervalCore_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace datetime
+} // end namespace cores
diff --git a/Sources/c_snikket/src/datetime/utils/DateTimeIntervalUtils.cpp b/Sources/c_snikket/src/datetime/utils/DateTimeIntervalUtils.cpp
new file mode 100644
index 0000000..15df9da
--- /dev/null
+++ b/Sources/c_snikket/src/datetime/utils/DateTimeIntervalUtils.cpp
@@ -0,0 +1,199 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_StringTools
+#include <StringTools.h>
+#endif
+#ifndef INCLUDED_datetime_cores_DateTimeIntervalCore
+#include <datetime/cores/DateTimeIntervalCore.h>
+#endif
+#ifndef INCLUDED_datetime_utils_DateTimeIntervalUtils
+#include <datetime/utils/DateTimeIntervalUtils.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_a0b77070014f1410_21_strftime,"datetime.utils.DateTimeIntervalUtils","strftime",0x585a38af,"datetime.utils.DateTimeIntervalUtils.strftime","datetime/utils/DateTimeIntervalUtils.hx",21,0x78b63b9f)
+namespace datetime{
+namespace utils{
+
+void DateTimeIntervalUtils_obj::__construct() { }
+
+Dynamic DateTimeIntervalUtils_obj::__CreateEmpty() { return new DateTimeIntervalUtils_obj; }
+
+void *DateTimeIntervalUtils_obj::_hx_vtable = 0;
+
+Dynamic DateTimeIntervalUtils_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< DateTimeIntervalUtils_obj > _hx_result = new DateTimeIntervalUtils_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool DateTimeIntervalUtils_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x144eafbf;
+}
+
+::String DateTimeIntervalUtils_obj::strftime( ::datetime::cores::DateTimeIntervalCore dti,::String format){
+ HX_STACKFRAME(&_hx_pos_a0b77070014f1410_21_strftime)
+HXLINE( 22) int prevPos = 0;
+HXLINE( 23) int pos = format.indexOf(HX_("%",25,00,00,00),null());
+HXLINE( 24) ::String str = HX_("",00,00,00,00);
+HXLINE( 26) while((pos >= 0)){
+HXLINE( 27) str = (str + format.substring(prevPos,pos));
+HXLINE( 28) pos = (pos + 1);
+HXLINE( 30) switch((int)(format.cca(pos))){
+ case (int)37: {
+HXLINE( 90) str = (str + HX_("%",25,00,00,00));
+ }
+ break;
+ case (int)68: {
+HXLINE( 48) str = (str + ::StringTools_obj::lpad((dti->getDays() + HX_("",00,00,00,00)),HX_("0",30,00,00,00),2));
+ }
+ break;
+ case (int)72: {
+HXLINE( 57) str = (str + ::StringTools_obj::lpad((dti->getHours() + HX_("",00,00,00,00)),HX_("0",30,00,00,00),2));
+ }
+ break;
+ case (int)73: {
+HXLINE( 66) str = (str + ::StringTools_obj::lpad((dti->getMinutes() + HX_("",00,00,00,00)),HX_("0",30,00,00,00),2));
+ }
+ break;
+ case (int)77: {
+HXLINE( 39) str = (str + ::StringTools_obj::lpad((dti->getMonths() + HX_("",00,00,00,00)),HX_("0",30,00,00,00),2));
+ }
+ break;
+ case (int)82: {
+HXLINE( 84) ::String str1;
+HXDLIN( 84) if (dti->negative) {
+HXLINE( 84) str1 = HX_("-",2d,00,00,00);
+ }
+ else {
+HXLINE( 84) str1 = HX_("+",2b,00,00,00);
+ }
+HXDLIN( 84) str = (str + str1);
+ }
+ break;
+ case (int)83: {
+HXLINE( 75) str = (str + ::StringTools_obj::lpad((dti->getSeconds() + HX_("",00,00,00,00)),HX_("0",30,00,00,00),2));
+ }
+ break;
+ case (int)89: {
+HXLINE( 33) str = (str + ::StringTools_obj::lpad((dti->getYears() + HX_("",00,00,00,00)),HX_("0",30,00,00,00),2));
+ }
+ break;
+ case (int)97: {
+HXLINE( 54) str = (str + (dti->getTotalDays() + HX_("",00,00,00,00)));
+ }
+ break;
+ case (int)98: {
+HXLINE( 45) str = (str + (dti->getTotalMonths() + HX_("",00,00,00,00)));
+ }
+ break;
+ case (int)99: {
+HXLINE( 63) str = (str + (dti->getTotalHours() + HX_("",00,00,00,00)));
+ }
+ break;
+ case (int)100: {
+HXLINE( 51) str = (str + (dti->getDays() + HX_("",00,00,00,00)));
+ }
+ break;
+ case (int)101: {
+HXLINE( 72) str = (str + (dti->getTotalMinutes() + HX_("",00,00,00,00)));
+ }
+ break;
+ case (int)102: {
+HXLINE( 81) str = (str + (dti->getTotalSeconds() + HX_("",00,00,00,00)));
+ }
+ break;
+ case (int)104: {
+HXLINE( 60) str = (str + (dti->getHours() + HX_("",00,00,00,00)));
+ }
+ break;
+ case (int)105: {
+HXLINE( 69) str = (str + (dti->getMinutes() + HX_("",00,00,00,00)));
+ }
+ break;
+ case (int)109: {
+HXLINE( 42) str = (str + (dti->getMonths() + HX_("",00,00,00,00)));
+ }
+ break;
+ case (int)114: {
+HXLINE( 87) ::String str2;
+HXDLIN( 87) if (dti->negative) {
+HXLINE( 87) str2 = HX_("-",2d,00,00,00);
+ }
+ else {
+HXLINE( 87) str2 = HX_("",00,00,00,00);
+ }
+HXDLIN( 87) str = (str + str2);
+ }
+ break;
+ case (int)115: {
+HXLINE( 78) str = (str + (dti->getSeconds() + HX_("",00,00,00,00)));
+ }
+ break;
+ case (int)121: {
+HXLINE( 36) str = (str + (dti->getYears() + HX_("",00,00,00,00)));
+ }
+ break;
+ }
+HXLINE( 93) prevPos = (pos + 1);
+HXLINE( 94) pos = format.indexOf(HX_("%",25,00,00,00),(pos + 1));
+ }
+HXLINE( 96) str = (str + format.substring(prevPos,null()));
+HXLINE( 98) return str;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(DateTimeIntervalUtils_obj,strftime,return )
+
+
+DateTimeIntervalUtils_obj::DateTimeIntervalUtils_obj()
+{
+}
+
+bool DateTimeIntervalUtils_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 8:
+ if (HX_FIELD_EQ(inName,"strftime") ) { outValue = strftime_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *DateTimeIntervalUtils_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *DateTimeIntervalUtils_obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class DateTimeIntervalUtils_obj::__mClass;
+
+static ::String DateTimeIntervalUtils_obj_sStaticFields[] = {
+ HX_("strftime",22,2d,ee,25),
+ ::String(null())
+};
+
+void DateTimeIntervalUtils_obj::__register()
+{
+ DateTimeIntervalUtils_obj _hx_dummy;
+ DateTimeIntervalUtils_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("datetime.utils.DateTimeIntervalUtils",81,fa,2b,b6);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &DateTimeIntervalUtils_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(DateTimeIntervalUtils_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< DateTimeIntervalUtils_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = DateTimeIntervalUtils_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = DateTimeIntervalUtils_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace datetime
+} // end namespace utils
diff --git a/Sources/c_snikket/src/datetime/utils/DateTimeMonthUtils.cpp b/Sources/c_snikket/src/datetime/utils/DateTimeMonthUtils.cpp
new file mode 100644
index 0000000..dbe2b90
--- /dev/null
+++ b/Sources/c_snikket/src/datetime/utils/DateTimeMonthUtils.cpp
@@ -0,0 +1,532 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_datetime_utils_DateTimeMonthUtils
+#include <datetime/utils/DateTimeMonthUtils.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_ab169acce21f9458_20_days,"datetime.utils.DateTimeMonthUtils","days",0x65719c69,"datetime.utils.DateTimeMonthUtils.days","datetime/utils/DateTimeMonthUtils.hx",20,0x2b734a60)
+HX_LOCAL_STACK_FRAME(_hx_pos_ab169acce21f9458_42_getMonth,"datetime.utils.DateTimeMonthUtils","getMonth",0x241f699c,"datetime.utils.DateTimeMonthUtils.getMonth","datetime/utils/DateTimeMonthUtils.hx",42,0x2b734a60)
+HX_LOCAL_STACK_FRAME(_hx_pos_ab169acce21f9458_76_getMonthDay,"datetime.utils.DateTimeMonthUtils","getMonthDay",0xc7f96e20,"datetime.utils.DateTimeMonthUtils.getMonthDay","datetime/utils/DateTimeMonthUtils.hx",76,0x2b734a60)
+HX_LOCAL_STACK_FRAME(_hx_pos_ab169acce21f9458_110_toSeconds,"datetime.utils.DateTimeMonthUtils","toSeconds",0xbdb9d332,"datetime.utils.DateTimeMonthUtils.toSeconds","datetime/utils/DateTimeMonthUtils.hx",110,0x2b734a60)
+namespace datetime{
+namespace utils{
+
+void DateTimeMonthUtils_obj::__construct() { }
+
+Dynamic DateTimeMonthUtils_obj::__CreateEmpty() { return new DateTimeMonthUtils_obj; }
+
+void *DateTimeMonthUtils_obj::_hx_vtable = 0;
+
+Dynamic DateTimeMonthUtils_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< DateTimeMonthUtils_obj > _hx_result = new DateTimeMonthUtils_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool DateTimeMonthUtils_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x250427de;
+}
+
+int DateTimeMonthUtils_obj::days(int month,::hx::Null< bool > __o_isLeapYear){
+ bool isLeapYear = __o_isLeapYear.Default(false);
+ HX_STACKFRAME(&_hx_pos_ab169acce21f9458_20_days)
+HXDLIN( 20) if ((month == 1)) {
+HXDLIN( 20) return 31;
+ }
+ else {
+HXLINE( 21) bool _hx_tmp;
+HXDLIN( 21) if ((month == 2)) {
+HXLINE( 21) _hx_tmp = isLeapYear;
+ }
+ else {
+HXLINE( 21) _hx_tmp = false;
+ }
+HXDLIN( 21) if (_hx_tmp) {
+HXLINE( 21) return 29;
+ }
+ else {
+HXLINE( 22) if ((month == 2)) {
+HXLINE( 22) return 28;
+ }
+ else {
+HXLINE( 23) if ((month == 3)) {
+HXLINE( 23) return 31;
+ }
+ else {
+HXLINE( 24) if ((month == 4)) {
+HXLINE( 24) return 30;
+ }
+ else {
+HXLINE( 25) if ((month == 5)) {
+HXLINE( 25) return 31;
+ }
+ else {
+HXLINE( 26) if ((month == 6)) {
+HXLINE( 26) return 30;
+ }
+ else {
+HXLINE( 27) if ((month == 7)) {
+HXLINE( 27) return 31;
+ }
+ else {
+HXLINE( 28) if ((month == 8)) {
+HXLINE( 28) return 31;
+ }
+ else {
+HXLINE( 29) if ((month == 9)) {
+HXLINE( 29) return 30;
+ }
+ else {
+HXLINE( 30) if ((month == 10)) {
+HXLINE( 30) return 31;
+ }
+ else {
+HXLINE( 31) if ((month == 11)) {
+HXLINE( 31) return 30;
+ }
+ else {
+HXLINE( 32) return 31;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+HXLINE( 20) return 0;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(DateTimeMonthUtils_obj,days,return )
+
+int DateTimeMonthUtils_obj::getMonth(int days,::hx::Null< bool > __o_isLeapYear){
+ bool isLeapYear = __o_isLeapYear.Default(false);
+ HX_STACKFRAME(&_hx_pos_ab169acce21f9458_42_getMonth)
+HXDLIN( 42) if ((days < 32)) {
+HXDLIN( 42) return 1;
+ }
+ else {
+HXLINE( 43) if (isLeapYear) {
+HXLINE( 44) if ((days < 61)) {
+HXLINE( 44) return 2;
+ }
+ else {
+HXLINE( 45) if ((days < 92)) {
+HXLINE( 45) return 3;
+ }
+ else {
+HXLINE( 46) if ((days < 122)) {
+HXLINE( 46) return 4;
+ }
+ else {
+HXLINE( 47) if ((days < 153)) {
+HXLINE( 47) return 5;
+ }
+ else {
+HXLINE( 48) if ((days < 183)) {
+HXLINE( 48) return 6;
+ }
+ else {
+HXLINE( 49) if ((days < 214)) {
+HXLINE( 49) return 7;
+ }
+ else {
+HXLINE( 50) if ((days < 245)) {
+HXLINE( 50) return 8;
+ }
+ else {
+HXLINE( 51) if ((days < 275)) {
+HXLINE( 51) return 9;
+ }
+ else {
+HXLINE( 52) if ((days < 306)) {
+HXLINE( 52) return 10;
+ }
+ else {
+HXLINE( 53) if ((days < 336)) {
+HXLINE( 53) return 11;
+ }
+ else {
+HXLINE( 54) return 12;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ else {
+HXLINE( 56) if ((days < 60)) {
+HXLINE( 56) return 2;
+ }
+ else {
+HXLINE( 57) if ((days < 91)) {
+HXLINE( 57) return 3;
+ }
+ else {
+HXLINE( 58) if ((days < 121)) {
+HXLINE( 58) return 4;
+ }
+ else {
+HXLINE( 59) if ((days < 152)) {
+HXLINE( 59) return 5;
+ }
+ else {
+HXLINE( 60) if ((days < 182)) {
+HXLINE( 60) return 6;
+ }
+ else {
+HXLINE( 61) if ((days < 213)) {
+HXLINE( 61) return 7;
+ }
+ else {
+HXLINE( 62) if ((days < 244)) {
+HXLINE( 62) return 8;
+ }
+ else {
+HXLINE( 63) if ((days < 274)) {
+HXLINE( 63) return 9;
+ }
+ else {
+HXLINE( 64) if ((days < 305)) {
+HXLINE( 64) return 10;
+ }
+ else {
+HXLINE( 65) if ((days < 335)) {
+HXLINE( 65) return 11;
+ }
+ else {
+HXLINE( 66) return 12;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+HXLINE( 42) return 0;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(DateTimeMonthUtils_obj,getMonth,return )
+
+int DateTimeMonthUtils_obj::getMonthDay(int days,::hx::Null< bool > __o_isLeapYear){
+ bool isLeapYear = __o_isLeapYear.Default(false);
+ HX_STACKFRAME(&_hx_pos_ab169acce21f9458_76_getMonthDay)
+HXDLIN( 76) if ((days < 32)) {
+HXDLIN( 76) return days;
+ }
+ else {
+HXLINE( 77) if (isLeapYear) {
+HXLINE( 78) if ((days < 61)) {
+HXLINE( 78) return (days - 31);
+ }
+ else {
+HXLINE( 79) if ((days < 92)) {
+HXLINE( 79) return (days - 60);
+ }
+ else {
+HXLINE( 80) if ((days < 122)) {
+HXLINE( 80) return (days - 91);
+ }
+ else {
+HXLINE( 81) if ((days < 153)) {
+HXLINE( 81) return (days - 121);
+ }
+ else {
+HXLINE( 82) if ((days < 183)) {
+HXLINE( 82) return (days - 152);
+ }
+ else {
+HXLINE( 83) if ((days < 214)) {
+HXLINE( 83) return (days - 182);
+ }
+ else {
+HXLINE( 84) if ((days < 245)) {
+HXLINE( 84) return (days - 213);
+ }
+ else {
+HXLINE( 85) if ((days < 275)) {
+HXLINE( 85) return (days - 244);
+ }
+ else {
+HXLINE( 86) if ((days < 306)) {
+HXLINE( 86) return (days - 274);
+ }
+ else {
+HXLINE( 87) if ((days < 336)) {
+HXLINE( 87) return (days - 305);
+ }
+ else {
+HXLINE( 88) return (days - 335);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ else {
+HXLINE( 90) if ((days < 60)) {
+HXLINE( 90) return (days - 31);
+ }
+ else {
+HXLINE( 91) if ((days < 91)) {
+HXLINE( 91) return (days - 59);
+ }
+ else {
+HXLINE( 92) if ((days < 121)) {
+HXLINE( 92) return (days - 90);
+ }
+ else {
+HXLINE( 93) if ((days < 152)) {
+HXLINE( 93) return (days - 120);
+ }
+ else {
+HXLINE( 94) if ((days < 182)) {
+HXLINE( 94) return (days - 151);
+ }
+ else {
+HXLINE( 95) if ((days < 213)) {
+HXLINE( 95) return (days - 181);
+ }
+ else {
+HXLINE( 96) if ((days < 244)) {
+HXLINE( 96) return (days - 212);
+ }
+ else {
+HXLINE( 97) if ((days < 274)) {
+HXLINE( 97) return (days - 243);
+ }
+ else {
+HXLINE( 98) if ((days < 305)) {
+HXLINE( 98) return (days - 273);
+ }
+ else {
+HXLINE( 99) if ((days < 335)) {
+HXLINE( 99) return (days - 304);
+ }
+ else {
+HXLINE( 100) return (days - 334);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+HXLINE( 76) return 0;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(DateTimeMonthUtils_obj,getMonthDay,return )
+
+int DateTimeMonthUtils_obj::toSeconds(int month,::hx::Null< bool > __o_isLeapYear){
+ bool isLeapYear = __o_isLeapYear.Default(false);
+ HX_STACKFRAME(&_hx_pos_ab169acce21f9458_110_toSeconds)
+HXDLIN( 110) int _hx_tmp;
+HXDLIN( 110) if ((month == 1)) {
+HXDLIN( 110) _hx_tmp = 0;
+ }
+ else {
+HXLINE( 111) if (isLeapYear) {
+HXLINE( 112) if ((month == 2)) {
+HXDLIN( 110) _hx_tmp = 31;
+ }
+ else {
+HXLINE( 113) if ((month == 3)) {
+HXDLIN( 110) _hx_tmp = 60;
+ }
+ else {
+HXLINE( 114) if ((month == 4)) {
+HXDLIN( 110) _hx_tmp = 91;
+ }
+ else {
+HXLINE( 115) if ((month == 5)) {
+HXDLIN( 110) _hx_tmp = 121;
+ }
+ else {
+HXLINE( 116) if ((month == 6)) {
+HXDLIN( 110) _hx_tmp = 152;
+ }
+ else {
+HXLINE( 117) if ((month == 7)) {
+HXDLIN( 110) _hx_tmp = 182;
+ }
+ else {
+HXLINE( 118) if ((month == 8)) {
+HXDLIN( 110) _hx_tmp = 213;
+ }
+ else {
+HXLINE( 119) if ((month == 9)) {
+HXDLIN( 110) _hx_tmp = 244;
+ }
+ else {
+HXLINE( 120) if ((month == 10)) {
+HXDLIN( 110) _hx_tmp = 274;
+ }
+ else {
+HXLINE( 121) if ((month == 11)) {
+HXDLIN( 110) _hx_tmp = 305;
+ }
+ else {
+HXDLIN( 110) _hx_tmp = 335;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ else {
+HXLINE( 124) if ((month == 2)) {
+HXDLIN( 110) _hx_tmp = 31;
+ }
+ else {
+HXLINE( 125) if ((month == 3)) {
+HXDLIN( 110) _hx_tmp = 59;
+ }
+ else {
+HXLINE( 126) if ((month == 4)) {
+HXDLIN( 110) _hx_tmp = 90;
+ }
+ else {
+HXLINE( 127) if ((month == 5)) {
+HXDLIN( 110) _hx_tmp = 120;
+ }
+ else {
+HXLINE( 128) if ((month == 6)) {
+HXDLIN( 110) _hx_tmp = 151;
+ }
+ else {
+HXLINE( 129) if ((month == 7)) {
+HXDLIN( 110) _hx_tmp = 181;
+ }
+ else {
+HXLINE( 130) if ((month == 8)) {
+HXDLIN( 110) _hx_tmp = 212;
+ }
+ else {
+HXLINE( 131) if ((month == 9)) {
+HXDLIN( 110) _hx_tmp = 243;
+ }
+ else {
+HXLINE( 132) if ((month == 10)) {
+HXDLIN( 110) _hx_tmp = 273;
+ }
+ else {
+HXLINE( 133) if ((month == 11)) {
+HXDLIN( 110) _hx_tmp = 304;
+ }
+ else {
+HXDLIN( 110) _hx_tmp = 334;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+HXDLIN( 110) return (86400 * _hx_tmp);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(DateTimeMonthUtils_obj,toSeconds,return )
+
+
+DateTimeMonthUtils_obj::DateTimeMonthUtils_obj()
+{
+}
+
+bool DateTimeMonthUtils_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"days") ) { outValue = days_dyn(); return true; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"getMonth") ) { outValue = getMonth_dyn(); return true; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"toSeconds") ) { outValue = toSeconds_dyn(); return true; }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"getMonthDay") ) { outValue = getMonthDay_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *DateTimeMonthUtils_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *DateTimeMonthUtils_obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class DateTimeMonthUtils_obj::__mClass;
+
+static ::String DateTimeMonthUtils_obj_sStaticFields[] = {
+ HX_("days",97,5a,63,42),
+ HX_("getMonth",ca,d6,36,6c),
+ HX_("getMonthDay",b2,f1,eb,92),
+ HX_("toSeconds",44,ee,21,8a),
+ ::String(null())
+};
+
+void DateTimeMonthUtils_obj::__register()
+{
+ DateTimeMonthUtils_obj _hx_dummy;
+ DateTimeMonthUtils_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("datetime.utils.DateTimeMonthUtils",dc,6f,51,c7);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &DateTimeMonthUtils_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(DateTimeMonthUtils_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< DateTimeMonthUtils_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = DateTimeMonthUtils_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = DateTimeMonthUtils_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace datetime
+} // end namespace utils
diff --git a/Sources/c_snikket/src/datetime/utils/DateTimeUtils.cpp b/Sources/c_snikket/src/datetime/utils/DateTimeUtils.cpp
new file mode 100644
index 0000000..27bf218
--- /dev/null
+++ b/Sources/c_snikket/src/datetime/utils/DateTimeUtils.cpp
@@ -0,0 +1,245 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_datetime_utils_DateTimeMonthUtils
+#include <datetime/utils/DateTimeMonthUtils.h>
+#endif
+#ifndef INCLUDED_datetime_utils_DateTimeUtils
+#include <datetime/utils/DateTimeUtils.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_3ecdb3441ed93307_24_fromString,"datetime.utils.DateTimeUtils","fromString",0x5ba24443,"datetime.utils.DateTimeUtils.fromString","datetime/utils/DateTimeUtils.hx",24,0xd824643a)
+HX_LOCAL_STACK_FRAME(_hx_pos_3ecdb3441ed93307_42_parse,"datetime.utils.DateTimeUtils","parse",0x5eaf12cb,"datetime.utils.DateTimeUtils.parse","datetime/utils/DateTimeUtils.hx",42,0xd824643a)
+HX_LOCAL_STACK_FRAME(_hx_pos_3ecdb3441ed93307_73_fromIsoString,"datetime.utils.DateTimeUtils","fromIsoString",0xf12b87c4,"datetime.utils.DateTimeUtils.fromIsoString","datetime/utils/DateTimeUtils.hx",73,0xd824643a)
+HX_LOCAL_STACK_FRAME(_hx_pos_3ecdb3441ed93307_107_yearToStamp,"datetime.utils.DateTimeUtils","yearToStamp",0x8b7800e3,"datetime.utils.DateTimeUtils.yearToStamp","datetime/utils/DateTimeUtils.hx",107,0xd824643a)
+namespace datetime{
+namespace utils{
+
+void DateTimeUtils_obj::__construct() { }
+
+Dynamic DateTimeUtils_obj::__CreateEmpty() { return new DateTimeUtils_obj; }
+
+void *DateTimeUtils_obj::_hx_vtable = 0;
+
+Dynamic DateTimeUtils_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< DateTimeUtils_obj > _hx_result = new DateTimeUtils_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool DateTimeUtils_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x4dd3c90c;
+}
+
+Float DateTimeUtils_obj::fromString(::String str){
+ HX_STACKFRAME(&_hx_pos_3ecdb3441ed93307_24_fromString)
+HXDLIN( 24) bool _hx_tmp;
+HXDLIN( 24) if ((str.length != 10)) {
+HXDLIN( 24) _hx_tmp = (str.cca(10) == 32);
+ }
+ else {
+HXDLIN( 24) _hx_tmp = true;
+ }
+HXDLIN( 24) if (_hx_tmp) {
+HXLINE( 25) return ::datetime::utils::DateTimeUtils_obj::parse(str);
+ }
+ else {
+HXLINE( 28) if ((str.cca(10) == 84)) {
+HXLINE( 29) return ::datetime::utils::DateTimeUtils_obj::fromIsoString(str);
+ }
+ else {
+HXLINE( 33) HX_STACK_DO_THROW(((HX_("`",60,00,00,00) + str) + HX_("` - incorrect date/time format. Should be either `YYYY-MM-DD hh:mm:ss` or `YYYY-MM-DD` or `YYYY-MM-DDThh:mm:ss[.SSS]Z`",8f,45,0a,94)));
+ }
+ }
+HXLINE( 24) return null();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(DateTimeUtils_obj,fromString,return )
+
+Float DateTimeUtils_obj::parse(::String str){
+ HX_STACKFRAME(&_hx_pos_3ecdb3441ed93307_42_parse)
+HXLINE( 43) int ylength = str.indexOf(HX_("-",2d,00,00,00),null());
+HXLINE( 45) bool _hx_tmp;
+HXDLIN( 45) if ((ylength >= 1)) {
+HXLINE( 45) if (((str.length - ylength) != 6)) {
+HXLINE( 45) _hx_tmp = ((str.length - ylength) != 15);
+ }
+ else {
+HXLINE( 45) _hx_tmp = false;
+ }
+ }
+ else {
+HXLINE( 45) _hx_tmp = true;
+ }
+HXDLIN( 45) if (_hx_tmp) {
+HXLINE( 46) HX_STACK_DO_THROW(((HX_("`",60,00,00,00) + str) + HX_("` - incorrect date/time format. Should be either `YYYY-MM-DD hh:mm:ss` or `YYYY-MM-DD`",db,89,d2,d6)));
+ }
+HXLINE( 49) if (((str.length - ylength) == 6)) {
+HXLINE( 50) str = (str + HX_(" 00:00:00",60,fa,7d,d7));
+ }
+HXLINE( 54) ::Dynamic year = ::Std_obj::parseInt(str.substr(0,ylength));
+HXLINE( 55) ::Dynamic month = ::Std_obj::parseInt(str.substr((ylength + 1),2));
+HXLINE( 56) ::Dynamic day = ::Std_obj::parseInt(str.substr((ylength + 4),2));
+HXLINE( 57) ::Dynamic hour = ::Std_obj::parseInt(str.substr((ylength + 7),2));
+HXLINE( 58) ::Dynamic minute = ::Std_obj::parseInt(str.substr((ylength + 10),2));
+HXLINE( 59) ::Dynamic second = ::Std_obj::parseInt(str.substr((ylength + 13),2));
+HXLINE( 61) bool _hx_tmp1;
+HXDLIN( 61) bool _hx_tmp2;
+HXDLIN( 61) bool _hx_tmp3;
+HXDLIN( 61) bool _hx_tmp4;
+HXDLIN( 61) bool _hx_tmp5;
+HXDLIN( 61) if (::hx::IsNotNull( year )) {
+HXLINE( 61) _hx_tmp5 = ::hx::IsNull( month );
+ }
+ else {
+HXLINE( 61) _hx_tmp5 = true;
+ }
+HXDLIN( 61) if (!(_hx_tmp5)) {
+HXLINE( 61) _hx_tmp4 = ::hx::IsNull( day );
+ }
+ else {
+HXLINE( 61) _hx_tmp4 = true;
+ }
+HXDLIN( 61) if (!(_hx_tmp4)) {
+HXLINE( 61) _hx_tmp3 = ::hx::IsNull( hour );
+ }
+ else {
+HXLINE( 61) _hx_tmp3 = true;
+ }
+HXDLIN( 61) if (!(_hx_tmp3)) {
+HXLINE( 61) _hx_tmp2 = ::hx::IsNull( minute );
+ }
+ else {
+HXLINE( 61) _hx_tmp2 = true;
+ }
+HXDLIN( 61) if (!(_hx_tmp2)) {
+HXLINE( 61) _hx_tmp1 = ::hx::IsNull( second );
+ }
+ else {
+HXLINE( 61) _hx_tmp1 = true;
+ }
+HXDLIN( 61) if (_hx_tmp1) {
+HXLINE( 62) HX_STACK_DO_THROW(((HX_("`",60,00,00,00) + str) + HX_("` - incorrect date/time format. Should be either `YYYY-MM-DD hh:mm:ss` or `YYYY-MM-DD`",db,89,d2,d6)));
+ }
+HXLINE( 65) int year1 = ( (int)(year) );
+HXDLIN( 65) Float time = ::datetime::utils::DateTimeUtils_obj::yearToStamp(year1);
+HXDLIN( 65) bool time1;
+HXDLIN( 65) if ((::hx::Mod(year1,4) == 0)) {
+HXLINE( 65) if ((::hx::Mod(year1,100) == 0)) {
+HXLINE( 65) time1 = (::hx::Mod(year1,400) == 0);
+ }
+ else {
+HXLINE( 65) time1 = true;
+ }
+ }
+ else {
+HXLINE( 65) time1 = false;
+ }
+HXDLIN( 65) return (((((((time + ::datetime::utils::DateTimeMonthUtils_obj::toSeconds(( (int)(month) ),time1)) + ((( (int)(day) ) - 1) * 86400)) + (( (int)(hour) ) * 3600)) + (( (int)(minute) ) * 60)) + ( (int)(second) )) - ((Float)62135596800.0)) + ((Float)62135596800.0));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(DateTimeUtils_obj,parse,return )
+
+Float DateTimeUtils_obj::fromIsoString(::String str){
+ HX_STACKFRAME(&_hx_pos_3ecdb3441ed93307_73_fromIsoString)
+HXLINE( 74) int dotPos = str.indexOf(HX_(".",2e,00,00,00),null());
+HXLINE( 75) int zPos = str.indexOf(HX_("Z",5a,00,00,00),null());
+HXLINE( 77) if ((str.cca((str.length - 1)) != 90)) {
+HXLINE( 78) HX_STACK_DO_THROW(((HX_("`",60,00,00,00) + str) + HX_("` - incorrect date/time format. Not an ISO 8601 UTC/Zulu string: Z not found.",de,76,4f,0c)));
+ }
+HXLINE( 81) if ((str.length > 20)) {
+HXLINE( 82) if ((str.cca(19) != 46)) {
+HXLINE( 83) HX_STACK_DO_THROW(((HX_("`",60,00,00,00) + str) + HX_("` - incorrect date/time format. Not an ISO 8601 string: Millisecond specification erroneous.",be,b1,fd,65)));
+ }
+HXLINE( 85) if ((str.cca(23) != 90)) {
+HXLINE( 86) HX_STACK_DO_THROW(((HX_("`",60,00,00,00) + str) + HX_("` - incorrect date/time format. Not an ISO 8601 string: Timezone specification erroneous.",06,eb,8a,5d)));
+ }
+ }
+HXLINE( 90) ::String _hx_tmp = (str.substr(0,10) + HX_(" ",20,00,00,00));
+HXDLIN( 90) return ::datetime::utils::DateTimeUtils_obj::parse((_hx_tmp + str.substr(11,8)));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(DateTimeUtils_obj,fromIsoString,return )
+
+Float DateTimeUtils_obj::yearToStamp(int year){
+ HX_STACKFRAME(&_hx_pos_3ecdb3441ed93307_107_yearToStamp)
+HXLINE( 108) year = (year - 1);
+HXLINE( 109) int cquads = ::Std_obj::_hx_int((( (Float)(year) ) / ( (Float)(400) )));
+HXLINE( 110) int quads = ::Std_obj::_hx_int((( (Float)((year - (cquads * 400))) ) / ( (Float)(4) )));
+HXLINE( 111) int excessDays = ::Std_obj::_hx_int((( (Float)(quads) ) / ( (Float)(25) )));
+HXLINE( 114) return ((((( (Float)(cquads) ) * ((Float)12622780800.0)) + (( (Float)(quads) ) * ((Float)126230400.0))) - ( (Float)((excessDays * 86400)) )) + (((year - (cquads * 400)) - (quads * 4)) * 31536000));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(DateTimeUtils_obj,yearToStamp,return )
+
+
+DateTimeUtils_obj::DateTimeUtils_obj()
+{
+}
+
+bool DateTimeUtils_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"parse") ) { outValue = parse_dyn(); return true; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"fromString") ) { outValue = fromString_dyn(); return true; }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"yearToStamp") ) { outValue = yearToStamp_dyn(); return true; }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"fromIsoString") ) { outValue = fromIsoString_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *DateTimeUtils_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *DateTimeUtils_obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class DateTimeUtils_obj::__mClass;
+
+static ::String DateTimeUtils_obj_sStaticFields[] = {
+ HX_("fromString",db,2d,74,54),
+ HX_("parse",33,90,55,bd),
+ HX_("fromIsoString",2c,ad,29,f8),
+ HX_("yearToStamp",4b,7c,52,4a),
+ ::String(null())
+};
+
+void DateTimeUtils_obj::__register()
+{
+ DateTimeUtils_obj _hx_dummy;
+ DateTimeUtils_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("datetime.utils.DateTimeUtils",06,61,2f,d4);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &DateTimeUtils_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(DateTimeUtils_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< DateTimeUtils_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = DateTimeUtils_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = DateTimeUtils_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace datetime
+} // end namespace utils
diff --git a/Sources/c_snikket/src/haxe/EntryPoint.cpp b/Sources/c_snikket/src/haxe/EntryPoint.cpp
new file mode 100644
index 0000000..e60e8b5
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/EntryPoint.cpp
@@ -0,0 +1,84 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_EntryPoint
+#include <haxe/EntryPoint.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_ca838965b09ef212_126_run,"haxe.EntryPoint","run",0xf0324cc3,"haxe.EntryPoint.run","/usr/local/lib/haxe/std/haxe/EntryPoint.hx",126,0x029442f4)
+namespace haxe{
+
+void EntryPoint_obj::__construct() { }
+
+Dynamic EntryPoint_obj::__CreateEmpty() { return new EntryPoint_obj; }
+
+void *EntryPoint_obj::_hx_vtable = 0;
+
+Dynamic EntryPoint_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< EntryPoint_obj > _hx_result = new EntryPoint_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool EntryPoint_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x7dc0c864;
+}
+
+void EntryPoint_obj::run(){
+ HX_STACKFRAME(&_hx_pos_ca838965b09ef212_126_run)
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC0(EntryPoint_obj,run,(void))
+
+
+EntryPoint_obj::EntryPoint_obj()
+{
+}
+
+bool EntryPoint_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"run") ) { outValue = run_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *EntryPoint_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *EntryPoint_obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class EntryPoint_obj::__mClass;
+
+static ::String EntryPoint_obj_sStaticFields[] = {
+ HX_("run",4b,e7,56,00),
+ ::String(null())
+};
+
+void EntryPoint_obj::__register()
+{
+ EntryPoint_obj _hx_dummy;
+ EntryPoint_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.EntryPoint",e6,a9,c1,b6);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &EntryPoint_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(EntryPoint_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< EntryPoint_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = EntryPoint_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = EntryPoint_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
diff --git a/Sources/c_snikket/src/haxe/Exception.cpp b/Sources/c_snikket/src/haxe/Exception.cpp
new file mode 100644
index 0000000..6925fe8
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/Exception.cpp
@@ -0,0 +1,244 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_haxe_Exception
+#include <haxe/Exception.h>
+#endif
+#ifndef INCLUDED_haxe_NativeStackTrace
+#include <haxe/NativeStackTrace.h>
+#endif
+#ifndef INCLUDED_haxe_ValueException
+#include <haxe/ValueException.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_7c0836163b1ec49e_5_new,"haxe.Exception","new",0xa32fba59,"haxe.Exception.new","/usr/local/lib/haxe/std/cpp/_std/haxe/Exception.hx",5,0x2b1198f6)
+HX_LOCAL_STACK_FRAME(_hx_pos_7c0836163b1ec49e_56_toString,"haxe.Exception","toString",0x11a32013,"haxe.Exception.toString","/usr/local/lib/haxe/std/cpp/_std/haxe/Exception.hx",56,0x2b1198f6)
+HX_LOCAL_STACK_FRAME(_hx_pos_7c0836163b1ec49e_76_get_message,"haxe.Exception","get_message",0x7b47a0d7,"haxe.Exception.get_message","/usr/local/lib/haxe/std/cpp/_std/haxe/Exception.hx",76,0x2b1198f6)
+HX_LOCAL_STACK_FRAME(_hx_pos_7c0836163b1ec49e_19_caught,"haxe.Exception","caught",0xbc294f23,"haxe.Exception.caught","/usr/local/lib/haxe/std/cpp/_std/haxe/Exception.hx",19,0x2b1198f6)
+namespace haxe{
+
+void Exception_obj::__construct(::String message, ::haxe::Exception previous, ::Dynamic native){
+ HX_STACKFRAME(&_hx_pos_7c0836163b1ec49e_5_new)
+HXLINE( 14) this->_hx___skipStack = 0;
+HXLINE( 40) this->_hx___exceptionMessage = message;
+HXLINE( 41) this->_hx___previousException = previous;
+HXLINE( 42) if (::hx::IsNotNull( native )) {
+HXLINE( 43) this->_hx___nativeStack = ::haxe::NativeStackTrace_obj::exceptionStack();
+HXLINE( 44) this->_hx___nativeException = native;
+ }
+ else {
+HXLINE( 46) this->_hx___nativeStack = ::haxe::NativeStackTrace_obj::callStack();
+HXLINE( 47) this->_hx___nativeException = ::hx::ObjectPtr<OBJ_>(this);
+ }
+ }
+
+Dynamic Exception_obj::__CreateEmpty() { return new Exception_obj; }
+
+void *Exception_obj::_hx_vtable = 0;
+
+Dynamic Exception_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Exception_obj > _hx_result = new Exception_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2]);
+ return _hx_result;
+}
+
+bool Exception_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x677ddc49;
+}
+
+::String Exception_obj::toString(){
+ HX_STACKFRAME(&_hx_pos_7c0836163b1ec49e_56_toString)
+HXDLIN( 56) return this->get_message();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Exception_obj,toString,return )
+
+::String Exception_obj::get_message(){
+ HX_STACKFRAME(&_hx_pos_7c0836163b1ec49e_76_get_message)
+HXDLIN( 76) return this->_hx___exceptionMessage;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Exception_obj,get_message,return )
+
+ ::haxe::Exception Exception_obj::caught( ::Dynamic value){
+ HX_GC_STACKFRAME(&_hx_pos_7c0836163b1ec49e_19_caught)
+HXDLIN( 19) if (::Std_obj::isOfType(value,::hx::ClassOf< ::haxe::Exception >())) {
+HXLINE( 20) return ( ( ::haxe::Exception)(value) );
+ }
+ else {
+HXLINE( 22) ::haxe::ValueException e = ::haxe::ValueException_obj::__alloc( HX_CTX ,value,null(),value);
+HXLINE( 24) e->_hx___skipStack--;
+HXLINE( 25) return e;
+ }
+HXLINE( 19) return null();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Exception_obj,caught,return )
+
+
+::hx::ObjectPtr< Exception_obj > Exception_obj::__new(::String message, ::haxe::Exception previous, ::Dynamic native) {
+ ::hx::ObjectPtr< Exception_obj > __this = new Exception_obj();
+ __this->__construct(message,previous,native);
+ return __this;
+}
+
+::hx::ObjectPtr< Exception_obj > Exception_obj::__alloc(::hx::Ctx *_hx_ctx,::String message, ::haxe::Exception previous, ::Dynamic native) {
+ Exception_obj *__this = (Exception_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Exception_obj), true, "haxe.Exception"));
+ *(void **)__this = Exception_obj::_hx_vtable;
+ __this->__construct(message,previous,native);
+ return __this;
+}
+
+Exception_obj::Exception_obj()
+{
+}
+
+void Exception_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(Exception);
+ HX_MARK_MEMBER_NAME(_hx___exceptionMessage,"__exceptionMessage");
+ HX_MARK_MEMBER_NAME(_hx___nativeStack,"__nativeStack");
+ HX_MARK_MEMBER_NAME(_hx___skipStack,"__skipStack");
+ HX_MARK_MEMBER_NAME(_hx___nativeException,"__nativeException");
+ HX_MARK_MEMBER_NAME(_hx___previousException,"__previousException");
+ HX_MARK_END_CLASS();
+}
+
+void Exception_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(_hx___exceptionMessage,"__exceptionMessage");
+ HX_VISIT_MEMBER_NAME(_hx___nativeStack,"__nativeStack");
+ HX_VISIT_MEMBER_NAME(_hx___skipStack,"__skipStack");
+ HX_VISIT_MEMBER_NAME(_hx___nativeException,"__nativeException");
+ HX_VISIT_MEMBER_NAME(_hx___previousException,"__previousException");
+}
+
+::hx::Val Exception_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 7:
+ if (HX_FIELD_EQ(inName,"message") ) { if (inCallProp == ::hx::paccAlways) return ::hx::Val( get_message() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"toString") ) { return ::hx::Val( toString_dyn() ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"__skipStack") ) { return ::hx::Val( _hx___skipStack ); }
+ if (HX_FIELD_EQ(inName,"get_message") ) { return ::hx::Val( get_message_dyn() ); }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"__nativeStack") ) { return ::hx::Val( _hx___nativeStack ); }
+ break;
+ case 17:
+ if (HX_FIELD_EQ(inName,"__nativeException") ) { return ::hx::Val( _hx___nativeException ); }
+ break;
+ case 18:
+ if (HX_FIELD_EQ(inName,"__exceptionMessage") ) { return ::hx::Val( _hx___exceptionMessage ); }
+ break;
+ case 19:
+ if (HX_FIELD_EQ(inName,"__previousException") ) { return ::hx::Val( _hx___previousException ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool Exception_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 6:
+ if (HX_FIELD_EQ(inName,"caught") ) { outValue = caught_dyn(); return true; }
+ }
+ return false;
+}
+
+::hx::Val Exception_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 11:
+ if (HX_FIELD_EQ(inName,"__skipStack") ) { _hx___skipStack=inValue.Cast< int >(); return inValue; }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"__nativeStack") ) { _hx___nativeStack=inValue.Cast< ::Array< ::String > >(); return inValue; }
+ break;
+ case 17:
+ if (HX_FIELD_EQ(inName,"__nativeException") ) { _hx___nativeException=inValue.Cast< ::Dynamic >(); return inValue; }
+ break;
+ case 18:
+ if (HX_FIELD_EQ(inName,"__exceptionMessage") ) { _hx___exceptionMessage=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 19:
+ if (HX_FIELD_EQ(inName,"__previousException") ) { _hx___previousException=inValue.Cast< ::haxe::Exception >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void Exception_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("message",c7,35,11,9a));
+ outFields->push(HX_("__exceptionMessage",58,18,4c,1e));
+ outFields->push(HX_("__nativeStack",11,2b,7f,33));
+ outFields->push(HX_("__skipStack",29,1d,33,c6));
+ outFields->push(HX_("__nativeException",98,ec,35,0d));
+ outFields->push(HX_("__previousException",f8,9d,b4,84));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Exception_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(Exception_obj,_hx___exceptionMessage),HX_("__exceptionMessage",58,18,4c,1e)},
+ {::hx::fsObject /* ::Array< ::String > */ ,(int)offsetof(Exception_obj,_hx___nativeStack),HX_("__nativeStack",11,2b,7f,33)},
+ {::hx::fsInt,(int)offsetof(Exception_obj,_hx___skipStack),HX_("__skipStack",29,1d,33,c6)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(Exception_obj,_hx___nativeException),HX_("__nativeException",98,ec,35,0d)},
+ {::hx::fsObject /* ::haxe::Exception */ ,(int)offsetof(Exception_obj,_hx___previousException),HX_("__previousException",f8,9d,b4,84)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *Exception_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Exception_obj_sMemberFields[] = {
+ HX_("__exceptionMessage",58,18,4c,1e),
+ HX_("__nativeStack",11,2b,7f,33),
+ HX_("__skipStack",29,1d,33,c6),
+ HX_("__nativeException",98,ec,35,0d),
+ HX_("__previousException",f8,9d,b4,84),
+ HX_("toString",ac,d0,6e,38),
+ HX_("get_message",de,95,0b,20),
+ ::String(null()) };
+
+::hx::Class Exception_obj::__mClass;
+
+static ::String Exception_obj_sStaticFields[] = {
+ HX_("caught",7c,77,d7,bc),
+ ::String(null())
+};
+
+void Exception_obj::__register()
+{
+ Exception_obj _hx_dummy;
+ Exception_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.Exception",e7,99,a3,a6);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Exception_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Exception_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Exception_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Exception_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Exception_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Exception_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
diff --git a/Sources/c_snikket/src/haxe/IMap.cpp b/Sources/c_snikket/src/haxe/IMap.cpp
new file mode 100644
index 0000000..ba12ab3
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/IMap.cpp
@@ -0,0 +1,28 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+
+namespace haxe{
+
+
+static ::String IMap_obj_sMemberFields[] = {
+ HX_("get",96,80,4e,00),
+ HX_("keys",f4,e1,06,47),
+ ::String(null()) };
+
+::hx::Class IMap_obj::__mClass;
+
+void IMap_obj::__register()
+{
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.IMap",1b,07,35,eb);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(IMap_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TIsInterface< (int)0x09c2bd39 >;
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
diff --git a/Sources/c_snikket/src/haxe/Log.cpp b/Sources/c_snikket/src/haxe/Log.cpp
new file mode 100644
index 0000000..97f3ef5
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/Log.cpp
@@ -0,0 +1,145 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_haxe_Log
+#include <haxe/Log.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_5d4e2478c442a18b_30___default_trace,"haxe.Log","__default_trace",0xe2f5e5d5,"haxe.Log.__default_trace","/usr/local/lib/haxe/std/cpp/_std/haxe/Log.hx",30,0x26c9bca1)
+namespace haxe{
+
+void Log_obj::__construct() { }
+
+Dynamic Log_obj::__CreateEmpty() { return new Log_obj; }
+
+void *Log_obj::_hx_vtable = 0;
+
+Dynamic Log_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Log_obj > _hx_result = new Log_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool Log_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x3c235b1a;
+}
+
+HX_BEGIN_DEFAULT_FUNC(__default_trace,Log_obj)
+void _hx_run( ::Dynamic v, ::Dynamic infos){
+ HX_STACKFRAME(&_hx_pos_5d4e2478c442a18b_30___default_trace)
+HXDLIN( 30) bool _hx_tmp;
+HXDLIN( 30) if (::hx::IsNotNull( infos )) {
+HXDLIN( 30) _hx_tmp = ::hx::IsNotNull( infos->__Field(HX_("customParams",d7,51,18,ed),::hx::paccDynamic) );
+ }
+ else {
+HXDLIN( 30) _hx_tmp = false;
+ }
+HXDLIN( 30) if (_hx_tmp) {
+HXLINE( 31) ::String extra = HX_("",00,00,00,00);
+HXLINE( 32) {
+HXLINE( 32) int _g = 0;
+HXDLIN( 32) ::cpp::VirtualArray _g1 = ( (::cpp::VirtualArray)(infos->__Field(HX_("customParams",d7,51,18,ed),::hx::paccDynamic)) );
+HXDLIN( 32) while((_g < _g1->get_length())){
+HXLINE( 32) ::Dynamic v1 = _g1->__get(_g);
+HXDLIN( 32) _g = (_g + 1);
+HXLINE( 33) extra = (extra + (HX_(",",2c,00,00,00) + ::Std_obj::string(v1)));
+ }
+ }
+HXLINE( 34) __trace((::Std_obj::string(v) + extra),infos);
+ }
+ else {
+HXLINE( 36) __trace(( (::String)(v) ),infos);
+ }
+ }
+HX_END_LOCAL_FUNC2((void))
+HX_END_DEFAULT_FUNC
+
+::Dynamic Log_obj::trace;
+
+
+Log_obj::Log_obj()
+{
+}
+
+bool Log_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"trace") ) { outValue = ( trace ); return true; }
+ }
+ return false;
+}
+
+bool Log_obj::__SetStatic(const ::String &inName,Dynamic &ioValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"trace") ) { trace=ioValue.Cast< ::Dynamic >(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *Log_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo Log_obj_sStaticStorageInfo[] = {
+ {::hx::fsObject /* ::Dynamic */ ,(void *) &Log_obj::trace,HX_("trace",85,8e,1f,16)},
+ { ::hx::fsUnknown, 0, null()}
+};
+#endif
+
+static void Log_obj_sMarkStatics(HX_MARK_PARAMS) {
+ HX_MARK_MEMBER_NAME(Log_obj::trace,"trace");
+};
+
+#ifdef HXCPP_VISIT_ALLOCS
+static void Log_obj_sVisitStatics(HX_VISIT_PARAMS) {
+ HX_VISIT_MEMBER_NAME(Log_obj::trace,"trace");
+};
+
+#endif
+
+::hx::Class Log_obj::__mClass;
+
+static ::String Log_obj_sStaticFields[] = {
+ HX_("trace",85,8e,1f,16),
+ ::String(null())
+};
+
+void Log_obj::__register()
+{
+ Log_obj _hx_dummy;
+ Log_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.Log",1c,1c,0e,3f);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Log_obj::__GetStatic;
+ __mClass->mSetStaticField = &Log_obj::__SetStatic;
+ __mClass->mMarkFunc = Log_obj_sMarkStatics;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Log_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< Log_obj >;
+#ifdef HXCPP_VISIT_ALLOCS
+ __mClass->mVisitFunc = Log_obj_sVisitStatics;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Log_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Log_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void Log_obj::__boot()
+{
+ trace = new __default_trace;
+
+}
+
+} // end namespace haxe
diff --git a/Sources/c_snikket/src/haxe/MainEvent.cpp b/Sources/c_snikket/src/haxe/MainEvent.cpp
new file mode 100644
index 0000000..28dfe72
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/MainEvent.cpp
@@ -0,0 +1,179 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_95f339a1d026d52c
+#define INCLUDED_95f339a1d026d52c
+#include "hxMath.h"
+#endif
+#ifndef INCLUDED_haxe_MainEvent
+#include <haxe/MainEvent.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_593a9917e735e8fd_9_new,"haxe.MainEvent","new",0x1c640c2b,"haxe.MainEvent.new","/usr/local/lib/haxe/std/haxe/MainLoop.hx",9,0x4a7d9295)
+namespace haxe{
+
+void MainEvent_obj::__construct( ::Dynamic f,int p){
+ HX_STACKFRAME(&_hx_pos_593a9917e735e8fd_9_new)
+HXLINE( 17) this->isBlocking = true;
+HXLINE( 23) this->f = f;
+HXLINE( 24) this->priority = p;
+HXLINE( 25) this->nextRun = ::Math_obj::NEGATIVE_INFINITY;
+ }
+
+Dynamic MainEvent_obj::__CreateEmpty() { return new MainEvent_obj; }
+
+void *MainEvent_obj::_hx_vtable = 0;
+
+Dynamic MainEvent_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< MainEvent_obj > _hx_result = new MainEvent_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1]);
+ return _hx_result;
+}
+
+bool MainEvent_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x0b5efb53;
+}
+
+
+::hx::ObjectPtr< MainEvent_obj > MainEvent_obj::__new( ::Dynamic f,int p) {
+ ::hx::ObjectPtr< MainEvent_obj > __this = new MainEvent_obj();
+ __this->__construct(f,p);
+ return __this;
+}
+
+::hx::ObjectPtr< MainEvent_obj > MainEvent_obj::__alloc(::hx::Ctx *_hx_ctx, ::Dynamic f,int p) {
+ MainEvent_obj *__this = (MainEvent_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(MainEvent_obj), true, "haxe.MainEvent"));
+ *(void **)__this = MainEvent_obj::_hx_vtable;
+ __this->__construct(f,p);
+ return __this;
+}
+
+MainEvent_obj::MainEvent_obj()
+{
+}
+
+void MainEvent_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(MainEvent);
+ HX_MARK_MEMBER_NAME(f,"f");
+ HX_MARK_MEMBER_NAME(prev,"prev");
+ HX_MARK_MEMBER_NAME(next,"next");
+ HX_MARK_MEMBER_NAME(isBlocking,"isBlocking");
+ HX_MARK_MEMBER_NAME(nextRun,"nextRun");
+ HX_MARK_MEMBER_NAME(priority,"priority");
+ HX_MARK_END_CLASS();
+}
+
+void MainEvent_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(f,"f");
+ HX_VISIT_MEMBER_NAME(prev,"prev");
+ HX_VISIT_MEMBER_NAME(next,"next");
+ HX_VISIT_MEMBER_NAME(isBlocking,"isBlocking");
+ HX_VISIT_MEMBER_NAME(nextRun,"nextRun");
+ HX_VISIT_MEMBER_NAME(priority,"priority");
+}
+
+::hx::Val MainEvent_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 1:
+ if (HX_FIELD_EQ(inName,"f") ) { return ::hx::Val( f ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"prev") ) { return ::hx::Val( prev ); }
+ if (HX_FIELD_EQ(inName,"next") ) { return ::hx::Val( next ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"nextRun") ) { return ::hx::Val( nextRun ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"priority") ) { return ::hx::Val( priority ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"isBlocking") ) { return ::hx::Val( isBlocking ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val MainEvent_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 1:
+ if (HX_FIELD_EQ(inName,"f") ) { f=inValue.Cast< ::Dynamic >(); return inValue; }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"prev") ) { prev=inValue.Cast< ::haxe::MainEvent >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"next") ) { next=inValue.Cast< ::haxe::MainEvent >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"nextRun") ) { nextRun=inValue.Cast< Float >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"priority") ) { priority=inValue.Cast< int >(); return inValue; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"isBlocking") ) { isBlocking=inValue.Cast< bool >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void MainEvent_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("prev",f3,be,5e,4a));
+ outFields->push(HX_("next",f3,84,02,49));
+ outFields->push(HX_("isBlocking",bf,37,5f,94));
+ outFields->push(HX_("nextRun",18,74,45,a5));
+ outFields->push(HX_("priority",64,7b,3e,bb));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo MainEvent_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(MainEvent_obj,f),HX_("f",66,00,00,00)},
+ {::hx::fsObject /* ::haxe::MainEvent */ ,(int)offsetof(MainEvent_obj,prev),HX_("prev",f3,be,5e,4a)},
+ {::hx::fsObject /* ::haxe::MainEvent */ ,(int)offsetof(MainEvent_obj,next),HX_("next",f3,84,02,49)},
+ {::hx::fsBool,(int)offsetof(MainEvent_obj,isBlocking),HX_("isBlocking",bf,37,5f,94)},
+ {::hx::fsFloat,(int)offsetof(MainEvent_obj,nextRun),HX_("nextRun",18,74,45,a5)},
+ {::hx::fsInt,(int)offsetof(MainEvent_obj,priority),HX_("priority",64,7b,3e,bb)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *MainEvent_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String MainEvent_obj_sMemberFields[] = {
+ HX_("f",66,00,00,00),
+ HX_("prev",f3,be,5e,4a),
+ HX_("next",f3,84,02,49),
+ HX_("isBlocking",bf,37,5f,94),
+ HX_("nextRun",18,74,45,a5),
+ HX_("priority",64,7b,3e,bb),
+ ::String(null()) };
+
+::hx::Class MainEvent_obj::__mClass;
+
+void MainEvent_obj::__register()
+{
+ MainEvent_obj _hx_dummy;
+ MainEvent_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.MainEvent",b9,1a,72,ec);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(MainEvent_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< MainEvent_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = MainEvent_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = MainEvent_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
diff --git a/Sources/c_snikket/src/haxe/MainLoop.cpp b/Sources/c_snikket/src/haxe/MainLoop.cpp
new file mode 100644
index 0000000..444ec9c
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/MainLoop.cpp
@@ -0,0 +1,287 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_MainEvent
+#include <haxe/MainEvent.h>
+#endif
+#ifndef INCLUDED_haxe_MainLoop
+#include <haxe/MainLoop.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_c09dd4c76a148f98_71_hasEvents,"haxe.MainLoop","hasEvents",0xbbf2790a,"haxe.MainLoop.hasEvents","/usr/local/lib/haxe/std/haxe/MainLoop.hx",71,0x4a7d9295)
+HX_LOCAL_STACK_FRAME(_hx_pos_c09dd4c76a148f98_104_sortEvents,"haxe.MainLoop","sortEvents",0x1a386640,"haxe.MainLoop.sortEvents","/usr/local/lib/haxe/std/haxe/MainLoop.hx",104,0x4a7d9295)
+HX_LOCAL_STACK_FRAME(_hx_pos_c09dd4c76a148f98_169_tick,"haxe.MainLoop","tick",0x9d5eafc6,"haxe.MainLoop.tick","/usr/local/lib/haxe/std/haxe/MainLoop.hx",169,0x4a7d9295)
+namespace haxe{
+
+void MainLoop_obj::__construct() { }
+
+Dynamic MainLoop_obj::__CreateEmpty() { return new MainLoop_obj; }
+
+void *MainLoop_obj::_hx_vtable = 0;
+
+Dynamic MainLoop_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< MainLoop_obj > _hx_result = new MainLoop_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool MainLoop_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x0c7b74e7;
+}
+
+ ::haxe::MainEvent MainLoop_obj::pending;
+
+bool MainLoop_obj::hasEvents(){
+ HX_STACKFRAME(&_hx_pos_c09dd4c76a148f98_71_hasEvents)
+HXLINE( 72) ::haxe::MainEvent p = ::haxe::MainLoop_obj::pending;
+HXLINE( 73) while(::hx::IsNotNull( p )){
+HXLINE( 74) if (p->isBlocking) {
+HXLINE( 75) return true;
+ }
+HXLINE( 76) p = p->next;
+ }
+HXLINE( 78) return false;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC0(MainLoop_obj,hasEvents,return )
+
+void MainLoop_obj::sortEvents(){
+ HX_STACKFRAME(&_hx_pos_c09dd4c76a148f98_104_sortEvents)
+HXLINE( 108) ::haxe::MainEvent list = ::haxe::MainLoop_obj::pending;
+HXLINE( 110) if (::hx::IsNull( list )) {
+HXLINE( 111) return;
+ }
+HXLINE( 113) int insize = 1;
+HXDLIN( 113) int nmerges;
+HXDLIN( 113) int psize = 0;
+HXDLIN( 113) int qsize = 0;
+HXLINE( 114) ::haxe::MainEvent p;
+HXDLIN( 114) ::haxe::MainEvent q;
+HXDLIN( 114) ::haxe::MainEvent e;
+HXDLIN( 114) ::haxe::MainEvent tail;
+HXLINE( 116) while(true){
+HXLINE( 117) p = list;
+HXLINE( 118) list = null();
+HXLINE( 119) tail = null();
+HXLINE( 120) nmerges = 0;
+HXLINE( 121) while(::hx::IsNotNull( p )){
+HXLINE( 122) nmerges = (nmerges + 1);
+HXLINE( 123) q = p;
+HXLINE( 124) psize = 0;
+HXLINE( 125) {
+HXLINE( 125) int _g = 0;
+HXDLIN( 125) int _g1 = insize;
+HXDLIN( 125) while((_g < _g1)){
+HXLINE( 125) _g = (_g + 1);
+HXDLIN( 125) int i = (_g - 1);
+HXLINE( 126) psize = (psize + 1);
+HXLINE( 127) q = q->next;
+HXLINE( 128) if (::hx::IsNull( q )) {
+HXLINE( 129) goto _hx_goto_4;
+ }
+ }
+ _hx_goto_4:;
+ }
+HXLINE( 131) qsize = insize;
+HXLINE( 132) while(true){
+HXLINE( 132) bool _hx_tmp;
+HXDLIN( 132) if ((psize <= 0)) {
+HXLINE( 132) if ((qsize > 0)) {
+HXLINE( 132) _hx_tmp = ::hx::IsNotNull( q );
+ }
+ else {
+HXLINE( 132) _hx_tmp = false;
+ }
+ }
+ else {
+HXLINE( 132) _hx_tmp = true;
+ }
+HXDLIN( 132) if (!(_hx_tmp)) {
+HXLINE( 132) goto _hx_goto_5;
+ }
+HXLINE( 133) if ((psize == 0)) {
+HXLINE( 134) e = q;
+HXLINE( 135) q = q->next;
+HXLINE( 136) qsize = (qsize - 1);
+ }
+ else {
+HXLINE( 137) bool _hx_tmp1;
+HXDLIN( 137) bool _hx_tmp2;
+HXDLIN( 137) if ((qsize != 0)) {
+HXLINE( 137) _hx_tmp2 = ::hx::IsNull( q );
+ }
+ else {
+HXLINE( 137) _hx_tmp2 = true;
+ }
+HXDLIN( 137) if (!(_hx_tmp2)) {
+HXLINE( 139) if ((p->priority <= q->priority)) {
+HXLINE( 139) if ((p->priority == q->priority)) {
+HXLINE( 137) _hx_tmp1 = (p->nextRun <= q->nextRun);
+ }
+ else {
+HXLINE( 137) _hx_tmp1 = false;
+ }
+ }
+ else {
+HXLINE( 137) _hx_tmp1 = true;
+ }
+ }
+ else {
+HXLINE( 137) _hx_tmp1 = true;
+ }
+HXDLIN( 137) if (_hx_tmp1) {
+HXLINE( 140) e = p;
+HXLINE( 141) p = p->next;
+HXLINE( 142) psize = (psize - 1);
+ }
+ else {
+HXLINE( 144) e = q;
+HXLINE( 145) q = q->next;
+HXLINE( 146) qsize = (qsize - 1);
+ }
+ }
+HXLINE( 148) if (::hx::IsNotNull( tail )) {
+HXLINE( 149) tail->next = e;
+ }
+ else {
+HXLINE( 151) list = e;
+ }
+HXLINE( 152) e->prev = tail;
+HXLINE( 153) tail = e;
+ }
+ _hx_goto_5:;
+HXLINE( 155) p = q;
+ }
+HXLINE( 157) tail->next = null();
+HXLINE( 158) if ((nmerges <= 1)) {
+HXLINE( 159) goto _hx_goto_2;
+ }
+HXLINE( 160) insize = (insize * 2);
+ }
+ _hx_goto_2:;
+HXLINE( 162) list->prev = null();
+HXLINE( 163) ::haxe::MainLoop_obj::pending = list;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC0(MainLoop_obj,sortEvents,(void))
+
+Float MainLoop_obj::tick(){
+ HX_STACKFRAME(&_hx_pos_c09dd4c76a148f98_169_tick)
+HXLINE( 170) ::haxe::MainLoop_obj::sortEvents();
+HXLINE( 171) ::haxe::MainEvent e = ::haxe::MainLoop_obj::pending;
+HXLINE( 172) Float now = ::__time_stamp();
+HXLINE( 173) Float wait = ((Float)1e9);
+HXLINE( 174) while(::hx::IsNotNull( e )){
+HXLINE( 175) ::haxe::MainEvent next = e->next;
+HXLINE( 176) Float wt = (e->nextRun - now);
+HXLINE( 177) if ((wt <= 0)) {
+HXLINE( 178) wait = ( (Float)(0) );
+HXLINE( 179) if (::hx::IsNotNull( e->f )) {
+HXLINE( 179) e->f();
+ }
+ }
+ else {
+HXLINE( 180) if ((wait > wt)) {
+HXLINE( 181) wait = wt;
+ }
+ }
+HXLINE( 182) e = next;
+ }
+HXLINE( 184) return wait;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC0(MainLoop_obj,tick,return )
+
+
+MainLoop_obj::MainLoop_obj()
+{
+}
+
+bool MainLoop_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"tick") ) { outValue = tick_dyn(); return true; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"pending") ) { outValue = ( pending ); return true; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"hasEvents") ) { outValue = hasEvents_dyn(); return true; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"sortEvents") ) { outValue = sortEvents_dyn(); return true; }
+ }
+ return false;
+}
+
+bool MainLoop_obj::__SetStatic(const ::String &inName,Dynamic &ioValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 7:
+ if (HX_FIELD_EQ(inName,"pending") ) { pending=ioValue.Cast< ::haxe::MainEvent >(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *MainLoop_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo MainLoop_obj_sStaticStorageInfo[] = {
+ {::hx::fsObject /* ::haxe::MainEvent */ ,(void *) &MainLoop_obj::pending,HX_("pending",57,98,ec,2b)},
+ { ::hx::fsUnknown, 0, null()}
+};
+#endif
+
+static void MainLoop_obj_sMarkStatics(HX_MARK_PARAMS) {
+ HX_MARK_MEMBER_NAME(MainLoop_obj::pending,"pending");
+};
+
+#ifdef HXCPP_VISIT_ALLOCS
+static void MainLoop_obj_sVisitStatics(HX_VISIT_PARAMS) {
+ HX_VISIT_MEMBER_NAME(MainLoop_obj::pending,"pending");
+};
+
+#endif
+
+::hx::Class MainLoop_obj::__mClass;
+
+static ::String MainLoop_obj_sStaticFields[] = {
+ HX_("pending",57,98,ec,2b),
+ HX_("hasEvents",13,02,53,d7),
+ HX_("sortEvents",17,c5,4f,f3),
+ HX_("tick",5d,c3,fc,4c),
+ ::String(null())
+};
+
+void MainLoop_obj::__register()
+{
+ MainLoop_obj _hx_dummy;
+ MainLoop_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.MainLoop",a5,cc,ab,e6);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &MainLoop_obj::__GetStatic;
+ __mClass->mSetStaticField = &MainLoop_obj::__SetStatic;
+ __mClass->mMarkFunc = MainLoop_obj_sMarkStatics;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(MainLoop_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< MainLoop_obj >;
+#ifdef HXCPP_VISIT_ALLOCS
+ __mClass->mVisitFunc = MainLoop_obj_sVisitStatics;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = MainLoop_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = MainLoop_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
diff --git a/Sources/c_snikket/src/haxe/NativeStackTrace.cpp b/Sources/c_snikket/src/haxe/NativeStackTrace.cpp
new file mode 100644
index 0000000..654bc33
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/NativeStackTrace.cpp
@@ -0,0 +1,104 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_NativeStackTrace
+#include <haxe/NativeStackTrace.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_0eaca57ef1f373a1_12_saveStack,"haxe.NativeStackTrace","saveStack",0x471b27d9,"haxe.NativeStackTrace.saveStack","/usr/local/lib/haxe/std/cpp/_std/haxe/NativeStackTrace.hx",12,0xab41cc63)
+namespace haxe{
+
+void NativeStackTrace_obj::__construct() { }
+
+Dynamic NativeStackTrace_obj::__CreateEmpty() { return new NativeStackTrace_obj; }
+
+void *NativeStackTrace_obj::_hx_vtable = 0;
+
+Dynamic NativeStackTrace_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< NativeStackTrace_obj > _hx_result = new NativeStackTrace_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool NativeStackTrace_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x3984963e;
+}
+
+void NativeStackTrace_obj::saveStack( ::Dynamic exception){
+ HX_STACKFRAME(&_hx_pos_0eaca57ef1f373a1_12_saveStack)
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(NativeStackTrace_obj,saveStack,(void))
+
+::Array< ::String > NativeStackTrace_obj::callStack(){
+ return ::__hxcpp_get_call_stack(true);
+}
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC0(NativeStackTrace_obj,callStack,return )
+
+::Array< ::String > NativeStackTrace_obj::exceptionStack(){
+ return ::__hxcpp_get_exception_stack();
+}
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC0(NativeStackTrace_obj,exceptionStack,return )
+
+
+NativeStackTrace_obj::NativeStackTrace_obj()
+{
+}
+
+bool NativeStackTrace_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 9:
+ if (HX_FIELD_EQ(inName,"saveStack") ) { outValue = saveStack_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"callStack") ) { outValue = callStack_dyn(); return true; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"exceptionStack") ) { outValue = exceptionStack_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *NativeStackTrace_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *NativeStackTrace_obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class NativeStackTrace_obj::__mClass;
+
+static ::String NativeStackTrace_obj_sStaticFields[] = {
+ HX_("saveStack",cb,6e,b8,12),
+ HX_("callStack",ca,c1,4a,10),
+ HX_("exceptionStack",79,48,56,0b),
+ ::String(null())
+};
+
+void NativeStackTrace_obj::__register()
+{
+ NativeStackTrace_obj _hx_dummy;
+ NativeStackTrace_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.NativeStackTrace",fc,db,8f,5d);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &NativeStackTrace_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(NativeStackTrace_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< NativeStackTrace_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = NativeStackTrace_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = NativeStackTrace_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
diff --git a/Sources/c_snikket/src/haxe/StackItem.cpp b/Sources/c_snikket/src/haxe/StackItem.cpp
new file mode 100644
index 0000000..dd84ddb
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/StackItem.cpp
@@ -0,0 +1,116 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_StackItem
+#include <haxe/StackItem.h>
+#endif
+namespace haxe{
+
+::haxe::StackItem StackItem_obj::CFunction;
+
+::haxe::StackItem StackItem_obj::FilePos( ::haxe::StackItem s,::String file,int line, ::Dynamic column)
+{
+ return ::hx::CreateEnum< StackItem_obj >(HX_("FilePos",58,a4,9d,cc),2,4)->_hx_init(0,s)->_hx_init(1,file)->_hx_init(2,line)->_hx_init(3,column);
+}
+
+::haxe::StackItem StackItem_obj::LocalFunction( ::Dynamic v)
+{
+ return ::hx::CreateEnum< StackItem_obj >(HX_("LocalFunction",83,63,3d,d5),4,1)->_hx_init(0,v);
+}
+
+::haxe::StackItem StackItem_obj::Method(::String classname,::String method)
+{
+ return ::hx::CreateEnum< StackItem_obj >(HX_("Method",01,6b,ef,3d),3,2)->_hx_init(0,classname)->_hx_init(1,method);
+}
+
+::haxe::StackItem StackItem_obj::Module(::String m)
+{
+ return ::hx::CreateEnum< StackItem_obj >(HX_("Module",cc,a8,67,f5),1,1)->_hx_init(0,m);
+}
+
+bool StackItem_obj::__GetStatic(const ::String &inName, ::Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ if (inName==HX_("CFunction",7b,e2,32,23)) { outValue = StackItem_obj::CFunction; return true; }
+ if (inName==HX_("FilePos",58,a4,9d,cc)) { outValue = StackItem_obj::FilePos_dyn(); return true; }
+ if (inName==HX_("LocalFunction",83,63,3d,d5)) { outValue = StackItem_obj::LocalFunction_dyn(); return true; }
+ if (inName==HX_("Method",01,6b,ef,3d)) { outValue = StackItem_obj::Method_dyn(); return true; }
+ if (inName==HX_("Module",cc,a8,67,f5)) { outValue = StackItem_obj::Module_dyn(); return true; }
+ return super::__GetStatic(inName, outValue, inCallProp);
+}
+
+HX_DEFINE_CREATE_ENUM(StackItem_obj)
+
+int StackItem_obj::__FindIndex(::String inName)
+{
+ if (inName==HX_("CFunction",7b,e2,32,23)) return 0;
+ if (inName==HX_("FilePos",58,a4,9d,cc)) return 2;
+ if (inName==HX_("LocalFunction",83,63,3d,d5)) return 4;
+ if (inName==HX_("Method",01,6b,ef,3d)) return 3;
+ if (inName==HX_("Module",cc,a8,67,f5)) return 1;
+ return super::__FindIndex(inName);
+}
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC4(StackItem_obj,FilePos,return)
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(StackItem_obj,LocalFunction,return)
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(StackItem_obj,Method,return)
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(StackItem_obj,Module,return)
+
+int StackItem_obj::__FindArgCount(::String inName)
+{
+ if (inName==HX_("CFunction",7b,e2,32,23)) return 0;
+ if (inName==HX_("FilePos",58,a4,9d,cc)) return 4;
+ if (inName==HX_("LocalFunction",83,63,3d,d5)) return 1;
+ if (inName==HX_("Method",01,6b,ef,3d)) return 2;
+ if (inName==HX_("Module",cc,a8,67,f5)) return 1;
+ return super::__FindArgCount(inName);
+}
+
+::hx::Val StackItem_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ if (inName==HX_("CFunction",7b,e2,32,23)) return CFunction;
+ if (inName==HX_("FilePos",58,a4,9d,cc)) return FilePos_dyn();
+ if (inName==HX_("LocalFunction",83,63,3d,d5)) return LocalFunction_dyn();
+ if (inName==HX_("Method",01,6b,ef,3d)) return Method_dyn();
+ if (inName==HX_("Module",cc,a8,67,f5)) return Module_dyn();
+ return super::__Field(inName,inCallProp);
+}
+
+static ::String StackItem_obj_sStaticFields[] = {
+ HX_("CFunction",7b,e2,32,23),
+ HX_("Module",cc,a8,67,f5),
+ HX_("FilePos",58,a4,9d,cc),
+ HX_("Method",01,6b,ef,3d),
+ HX_("LocalFunction",83,63,3d,d5),
+ ::String(null())
+};
+
+::hx::Class StackItem_obj::__mClass;
+
+Dynamic __Create_StackItem_obj() { return new StackItem_obj; }
+
+void StackItem_obj::__register()
+{
+
+::hx::Static(__mClass) = ::hx::_hx_RegisterClass(HX_("haxe.StackItem",13,26,c7,2d), ::hx::TCanCast< StackItem_obj >,StackItem_obj_sStaticFields,0,
+ &__Create_StackItem_obj, &__Create,
+ &super::__SGetClass(), &CreateStackItem_obj, 0
+#ifdef HXCPP_VISIT_ALLOCS
+ , 0
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ , 0
+#endif
+);
+ __mClass->mGetStaticField = &StackItem_obj::__GetStatic;
+}
+
+void StackItem_obj::__boot()
+{
+CFunction = ::hx::CreateConstEnum< StackItem_obj >(HX_("CFunction",7b,e2,32,23),0);
+}
+
+
+} // end namespace haxe
diff --git a/Sources/c_snikket/src/haxe/Timer.cpp b/Sources/c_snikket/src/haxe/Timer.cpp
new file mode 100644
index 0000000..af1c1f6
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/Timer.cpp
@@ -0,0 +1,225 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_Timer
+#include <haxe/Timer.h>
+#endif
+#ifndef INCLUDED_sys_thread_EventLoop
+#include <sys/thread/EventLoop.h>
+#endif
+#ifndef INCLUDED_sys_thread__EventLoop_RegularEvent
+#include <sys/thread/_EventLoop/RegularEvent.h>
+#endif
+#ifndef INCLUDED_sys_thread__Thread_HaxeThread
+#include <sys/thread/_Thread/HaxeThread.h>
+#endif
+#ifndef INCLUDED_sys_thread__Thread_Thread_Impl_
+#include <sys/thread/_Thread/Thread_Impl_.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_62462c654e989831_81_new,"haxe.Timer","new",0x4136b0cf,"haxe.Timer.new","/usr/local/lib/haxe/std/haxe/Timer.hx",81,0x03b744a5)
+HX_DEFINE_STACK_FRAME(_hx_pos_62462c654e989831_70_new,"haxe.Timer","new",0x4136b0cf,"haxe.Timer.new","/usr/local/lib/haxe/std/haxe/Timer.hx",70,0x03b744a5)
+HX_LOCAL_STACK_FRAME(_hx_pos_62462c654e989831_111_stop,"haxe.Timer","stop",0xd1fd70b3,"haxe.Timer.stop","/usr/local/lib/haxe/std/haxe/Timer.hx",111,0x03b744a5)
+HX_LOCAL_STACK_FRAME(_hx_pos_62462c654e989831_134___default_run,"haxe.Timer","__default_run",0xdc2b9b9c,"haxe.Timer.__default_run","/usr/local/lib/haxe/std/haxe/Timer.hx",134,0x03b744a5)
+HX_LOCAL_STACK_FRAME(_hx_pos_62462c654e989831_147_delay,"haxe.Timer","delay",0x3ed5f1b2,"haxe.Timer.delay","/usr/local/lib/haxe/std/haxe/Timer.hx",147,0x03b744a5)
+HX_LOCAL_STACK_FRAME(_hx_pos_62462c654e989831_145_delay,"haxe.Timer","delay",0x3ed5f1b2,"haxe.Timer.delay","/usr/local/lib/haxe/std/haxe/Timer.hx",145,0x03b744a5)
+namespace haxe{
+
+void Timer_obj::__construct(int time_ms){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::haxe::Timer,_gthis) HXARGC(0)
+ void _hx_run(){
+ HX_STACKFRAME(&_hx_pos_62462c654e989831_81_new)
+HXLINE( 81) _gthis->run();
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_STACKFRAME(&_hx_pos_62462c654e989831_70_new)
+HXDLIN( 70) ::haxe::Timer _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 80) this->thread = ::sys::thread::_Thread::HaxeThread_obj::current();
+HXLINE( 81) this->eventHandler = ::sys::thread::_Thread::Thread_Impl__obj::get_events(this->thread)->repeat( ::Dynamic(new _hx_Closure_0(_gthis)),time_ms);
+ }
+
+Dynamic Timer_obj::__CreateEmpty() { return new Timer_obj; }
+
+void *Timer_obj::_hx_vtable = 0;
+
+Dynamic Timer_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Timer_obj > _hx_result = new Timer_obj();
+ _hx_result->__construct(inArgs[0]);
+ return _hx_result;
+}
+
+bool Timer_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x04eaa0bb;
+}
+
+void Timer_obj::stop(){
+ HX_STACKFRAME(&_hx_pos_62462c654e989831_111_stop)
+HXDLIN( 111) ::sys::thread::_Thread::Thread_Impl__obj::get_events(this->thread)->cancel(this->eventHandler);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Timer_obj,stop,(void))
+
+HX_BEGIN_DEFAULT_FUNC(__default_run,Timer_obj)
+void _hx_run(){
+ HX_STACKFRAME(&_hx_pos_62462c654e989831_134___default_run)
+ }
+HX_END_LOCAL_FUNC0((void))
+HX_END_DEFAULT_FUNC
+
+ ::haxe::Timer Timer_obj::delay( ::Dynamic f,int time_ms){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0, ::Dynamic,f, ::haxe::Timer,t) HXARGC(0)
+ void _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_62462c654e989831_147_delay)
+HXLINE( 148) t->stop();
+HXLINE( 149) f();
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_62462c654e989831_145_delay)
+HXLINE( 146) ::haxe::Timer t = ::haxe::Timer_obj::__alloc( HX_CTX ,time_ms);
+HXLINE( 147) t->run = ::Dynamic(new _hx_Closure_0(f,t));
+HXLINE( 151) return t;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Timer_obj,delay,return )
+
+
+void Timer_obj::__alloc_dynamic_functions(::hx::Ctx *_hx_ctx,Timer_obj *_hx_obj) {
+ if (!_hx_obj->run.mPtr) _hx_obj->run = new __default_run(_hx_obj);
+}
+::hx::ObjectPtr< Timer_obj > Timer_obj::__new(int time_ms) {
+ ::hx::ObjectPtr< Timer_obj > __this = new Timer_obj();
+ __this->__construct(time_ms);
+ return __this;
+}
+
+::hx::ObjectPtr< Timer_obj > Timer_obj::__alloc(::hx::Ctx *_hx_ctx,int time_ms) {
+ Timer_obj *__this = (Timer_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Timer_obj), true, "haxe.Timer"));
+ *(void **)__this = Timer_obj::_hx_vtable;
+ haxe::Timer_obj::__alloc_dynamic_functions(_hx_ctx,__this);
+ __this->__construct(time_ms);
+ return __this;
+}
+
+Timer_obj::Timer_obj()
+{
+ run = new __default_run(this);
+}
+
+void Timer_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(Timer);
+ HX_MARK_MEMBER_NAME(thread,"thread");
+ HX_MARK_MEMBER_NAME(eventHandler,"eventHandler");
+ HX_MARK_MEMBER_NAME(run,"run");
+ HX_MARK_END_CLASS();
+}
+
+void Timer_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(thread,"thread");
+ HX_VISIT_MEMBER_NAME(eventHandler,"eventHandler");
+ HX_VISIT_MEMBER_NAME(run,"run");
+}
+
+::hx::Val Timer_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"run") ) { return ::hx::Val( run ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"stop") ) { return ::hx::Val( stop_dyn() ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"thread") ) { return ::hx::Val( thread ); }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"eventHandler") ) { return ::hx::Val( eventHandler ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool Timer_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"delay") ) { outValue = delay_dyn(); return true; }
+ }
+ return false;
+}
+
+::hx::Val Timer_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"run") ) { run=inValue.Cast< ::Dynamic >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"thread") ) { thread=inValue.Cast< ::sys::thread::_Thread::HaxeThread >(); return inValue; }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"eventHandler") ) { eventHandler=inValue.Cast< ::sys::thread::_EventLoop::RegularEvent >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void Timer_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("thread",ca,7a,b9,8e));
+ outFields->push(HX_("eventHandler",d0,a6,2a,d6));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Timer_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::sys::thread::_Thread::HaxeThread */ ,(int)offsetof(Timer_obj,thread),HX_("thread",ca,7a,b9,8e)},
+ {::hx::fsObject /* ::sys::thread::_EventLoop::RegularEvent */ ,(int)offsetof(Timer_obj,eventHandler),HX_("eventHandler",d0,a6,2a,d6)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(Timer_obj,run),HX_("run",4b,e7,56,00)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *Timer_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Timer_obj_sMemberFields[] = {
+ HX_("thread",ca,7a,b9,8e),
+ HX_("eventHandler",d0,a6,2a,d6),
+ HX_("stop",02,f0,5b,4c),
+ HX_("run",4b,e7,56,00),
+ ::String(null()) };
+
+::hx::Class Timer_obj::__mClass;
+
+static ::String Timer_obj_sStaticFields[] = {
+ HX_("delay",83,d7,26,d7),
+ ::String(null())
+};
+
+void Timer_obj::__register()
+{
+ Timer_obj _hx_dummy;
+ Timer_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.Timer",5d,9d,24,4b);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Timer_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Timer_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Timer_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Timer_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Timer_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Timer_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
diff --git a/Sources/c_snikket/src/haxe/ValueException.cpp b/Sources/c_snikket/src/haxe/ValueException.cpp
new file mode 100644
index 0000000..94292f4
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/ValueException.cpp
@@ -0,0 +1,142 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_haxe_Exception
+#include <haxe/Exception.h>
+#endif
+#ifndef INCLUDED_haxe_ValueException
+#include <haxe/ValueException.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_aef49c9161dcd373_23_new,"haxe.ValueException","new",0xb19045f8,"haxe.ValueException.new","/usr/local/lib/haxe/std/haxe/ValueException.hx",23,0x518cf4d4)
+namespace haxe{
+
+void ValueException_obj::__construct( ::Dynamic value, ::haxe::Exception previous, ::Dynamic native){
+ HX_STACKFRAME(&_hx_pos_aef49c9161dcd373_23_new)
+HXLINE( 24) ::String _hx_tmp;
+HXDLIN( 24) if (::hx::IsNull( value )) {
+HXLINE( 24) _hx_tmp = HX_("null",87,9e,0e,49);
+ }
+ else {
+HXLINE( 24) _hx_tmp = ::Std_obj::string(value);
+ }
+HXDLIN( 24) super::__construct(_hx_tmp,previous,native);
+HXLINE( 25) this->value = value;
+ }
+
+Dynamic ValueException_obj::__CreateEmpty() { return new ValueException_obj; }
+
+void *ValueException_obj::_hx_vtable = 0;
+
+Dynamic ValueException_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< ValueException_obj > _hx_result = new ValueException_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2]);
+ return _hx_result;
+}
+
+bool ValueException_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x0af01d58) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x0af01d58;
+ } else {
+ return inClassId==(int)0x677ddc49;
+ }
+}
+
+
+::hx::ObjectPtr< ValueException_obj > ValueException_obj::__new( ::Dynamic value, ::haxe::Exception previous, ::Dynamic native) {
+ ::hx::ObjectPtr< ValueException_obj > __this = new ValueException_obj();
+ __this->__construct(value,previous,native);
+ return __this;
+}
+
+::hx::ObjectPtr< ValueException_obj > ValueException_obj::__alloc(::hx::Ctx *_hx_ctx, ::Dynamic value, ::haxe::Exception previous, ::Dynamic native) {
+ ValueException_obj *__this = (ValueException_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(ValueException_obj), true, "haxe.ValueException"));
+ *(void **)__this = ValueException_obj::_hx_vtable;
+ __this->__construct(value,previous,native);
+ return __this;
+}
+
+ValueException_obj::ValueException_obj()
+{
+}
+
+void ValueException_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(ValueException);
+ HX_MARK_MEMBER_NAME(value,"value");
+ ::haxe::Exception_obj::__Mark(HX_MARK_ARG);
+ HX_MARK_END_CLASS();
+}
+
+void ValueException_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(value,"value");
+ ::haxe::Exception_obj::__Visit(HX_VISIT_ARG);
+}
+
+::hx::Val ValueException_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"value") ) { return ::hx::Val( value ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val ValueException_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"value") ) { value=inValue.Cast< ::Dynamic >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void ValueException_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("value",71,7f,b8,31));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo ValueException_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(ValueException_obj,value),HX_("value",71,7f,b8,31)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *ValueException_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String ValueException_obj_sMemberFields[] = {
+ HX_("value",71,7f,b8,31),
+ ::String(null()) };
+
+::hx::Class ValueException_obj::__mClass;
+
+void ValueException_obj::__register()
+{
+ ValueException_obj _hx_dummy;
+ ValueException_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.ValueException",06,2a,10,02);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(ValueException_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< ValueException_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = ValueException_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = ValueException_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
diff --git a/Sources/c_snikket/src/haxe/crypto/Base64.cpp b/Sources/c_snikket/src/haxe/crypto/Base64.cpp
new file mode 100644
index 0000000..2185a75
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/crypto/Base64.cpp
@@ -0,0 +1,260 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_crypto_Base64
+#include <haxe/crypto/Base64.h>
+#endif
+#ifndef INCLUDED_haxe_crypto_BaseCode
+#include <haxe/crypto/BaseCode.h>
+#endif
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+#ifndef INCLUDED_haxe_io_Encoding
+#include <haxe/io/Encoding.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_160cc64a37c5b236_35_encode,"haxe.crypto.Base64","encode",0xc6961450,"haxe.crypto.Base64.encode","/usr/local/lib/haxe/std/haxe/crypto/Base64.hx",35,0x132e3b4d)
+HX_LOCAL_STACK_FRAME(_hx_pos_160cc64a37c5b236_48_decode,"haxe.crypto.Base64","decode",0x319f7f68,"haxe.crypto.Base64.decode","/usr/local/lib/haxe/std/haxe/crypto/Base64.hx",48,0x132e3b4d)
+HX_LOCAL_STACK_FRAME(_hx_pos_160cc64a37c5b236_55_urlEncode,"haxe.crypto.Base64","urlEncode",0xe877cceb,"haxe.crypto.Base64.urlEncode","/usr/local/lib/haxe/std/haxe/crypto/Base64.hx",55,0x132e3b4d)
+HX_LOCAL_STACK_FRAME(_hx_pos_160cc64a37c5b236_68_urlDecode,"haxe.crypto.Base64","urlDecode",0x53813803,"haxe.crypto.Base64.urlDecode","/usr/local/lib/haxe/std/haxe/crypto/Base64.hx",68,0x132e3b4d)
+HX_LOCAL_STACK_FRAME(_hx_pos_160cc64a37c5b236_29_boot,"haxe.crypto.Base64","boot",0x49b2c3ec,"haxe.crypto.Base64.boot","/usr/local/lib/haxe/std/haxe/crypto/Base64.hx",29,0x132e3b4d)
+HX_LOCAL_STACK_FRAME(_hx_pos_160cc64a37c5b236_30_boot,"haxe.crypto.Base64","boot",0x49b2c3ec,"haxe.crypto.Base64.boot","/usr/local/lib/haxe/std/haxe/crypto/Base64.hx",30,0x132e3b4d)
+HX_LOCAL_STACK_FRAME(_hx_pos_160cc64a37c5b236_32_boot,"haxe.crypto.Base64","boot",0x49b2c3ec,"haxe.crypto.Base64.boot","/usr/local/lib/haxe/std/haxe/crypto/Base64.hx",32,0x132e3b4d)
+HX_LOCAL_STACK_FRAME(_hx_pos_160cc64a37c5b236_33_boot,"haxe.crypto.Base64","boot",0x49b2c3ec,"haxe.crypto.Base64.boot","/usr/local/lib/haxe/std/haxe/crypto/Base64.hx",33,0x132e3b4d)
+namespace haxe{
+namespace crypto{
+
+void Base64_obj::__construct() { }
+
+Dynamic Base64_obj::__CreateEmpty() { return new Base64_obj; }
+
+void *Base64_obj::_hx_vtable = 0;
+
+Dynamic Base64_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Base64_obj > _hx_result = new Base64_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool Base64_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x08b38de6;
+}
+
+::String Base64_obj::CHARS;
+
+ ::haxe::io::Bytes Base64_obj::BYTES;
+
+::String Base64_obj::URL_CHARS;
+
+ ::haxe::io::Bytes Base64_obj::URL_BYTES;
+
+::String Base64_obj::encode( ::haxe::io::Bytes bytes,::hx::Null< bool > __o_complement){
+ bool complement = __o_complement.Default(true);
+ HX_GC_STACKFRAME(&_hx_pos_160cc64a37c5b236_35_encode)
+HXLINE( 36) ::String str = ::haxe::crypto::BaseCode_obj::__alloc( HX_CTX ,::haxe::crypto::Base64_obj::BYTES)->encodeBytes(bytes)->toString();
+HXLINE( 37) if (complement) {
+HXLINE( 38) switch((int)(::hx::Mod(bytes->length,3))){
+ case (int)1: {
+HXLINE( 40) str = (str + HX_("==",60,35,00,00));
+ }
+ break;
+ case (int)2: {
+HXLINE( 42) str = (str + HX_("=",3d,00,00,00));
+ }
+ break;
+ default:{
+ }
+ }
+ }
+HXLINE( 45) return str;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Base64_obj,encode,return )
+
+ ::haxe::io::Bytes Base64_obj::decode(::String str,::hx::Null< bool > __o_complement){
+ bool complement = __o_complement.Default(true);
+ HX_GC_STACKFRAME(&_hx_pos_160cc64a37c5b236_48_decode)
+HXLINE( 49) if (complement) {
+HXLINE( 50) while(::hx::IsEq( str.charCodeAt((str.length - 1)),61 )){
+HXLINE( 51) str = str.substr(0,-1);
+ }
+ }
+HXLINE( 52) ::haxe::crypto::BaseCode _hx_tmp = ::haxe::crypto::BaseCode_obj::__alloc( HX_CTX ,::haxe::crypto::Base64_obj::BYTES);
+HXDLIN( 52) return _hx_tmp->decodeBytes(::haxe::io::Bytes_obj::ofString(str,null()));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Base64_obj,decode,return )
+
+::String Base64_obj::urlEncode( ::haxe::io::Bytes bytes,::hx::Null< bool > __o_complement){
+ bool complement = __o_complement.Default(false);
+ HX_GC_STACKFRAME(&_hx_pos_160cc64a37c5b236_55_urlEncode)
+HXLINE( 56) ::String str = ::haxe::crypto::BaseCode_obj::__alloc( HX_CTX ,::haxe::crypto::Base64_obj::URL_BYTES)->encodeBytes(bytes)->toString();
+HXLINE( 57) if (complement) {
+HXLINE( 58) switch((int)(::hx::Mod(bytes->length,3))){
+ case (int)1: {
+HXLINE( 60) str = (str + HX_("==",60,35,00,00));
+ }
+ break;
+ case (int)2: {
+HXLINE( 62) str = (str + HX_("=",3d,00,00,00));
+ }
+ break;
+ default:{
+ }
+ }
+ }
+HXLINE( 65) return str;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Base64_obj,urlEncode,return )
+
+ ::haxe::io::Bytes Base64_obj::urlDecode(::String str,::hx::Null< bool > __o_complement){
+ bool complement = __o_complement.Default(false);
+ HX_GC_STACKFRAME(&_hx_pos_160cc64a37c5b236_68_urlDecode)
+HXLINE( 69) if (complement) {
+HXLINE( 70) while(::hx::IsEq( str.charCodeAt((str.length - 1)),61 )){
+HXLINE( 71) str = str.substr(0,-1);
+ }
+ }
+HXLINE( 72) ::haxe::crypto::BaseCode _hx_tmp = ::haxe::crypto::BaseCode_obj::__alloc( HX_CTX ,::haxe::crypto::Base64_obj::URL_BYTES);
+HXDLIN( 72) return _hx_tmp->decodeBytes(::haxe::io::Bytes_obj::ofString(str,null()));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Base64_obj,urlDecode,return )
+
+
+Base64_obj::Base64_obj()
+{
+}
+
+bool Base64_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"CHARS") ) { outValue = ( CHARS ); return true; }
+ if (HX_FIELD_EQ(inName,"BYTES") ) { outValue = ( BYTES ); return true; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"encode") ) { outValue = encode_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"decode") ) { outValue = decode_dyn(); return true; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"URL_CHARS") ) { outValue = ( URL_CHARS ); return true; }
+ if (HX_FIELD_EQ(inName,"URL_BYTES") ) { outValue = ( URL_BYTES ); return true; }
+ if (HX_FIELD_EQ(inName,"urlEncode") ) { outValue = urlEncode_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"urlDecode") ) { outValue = urlDecode_dyn(); return true; }
+ }
+ return false;
+}
+
+bool Base64_obj::__SetStatic(const ::String &inName,Dynamic &ioValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"CHARS") ) { CHARS=ioValue.Cast< ::String >(); return true; }
+ if (HX_FIELD_EQ(inName,"BYTES") ) { BYTES=ioValue.Cast< ::haxe::io::Bytes >(); return true; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"URL_CHARS") ) { URL_CHARS=ioValue.Cast< ::String >(); return true; }
+ if (HX_FIELD_EQ(inName,"URL_BYTES") ) { URL_BYTES=ioValue.Cast< ::haxe::io::Bytes >(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *Base64_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo Base64_obj_sStaticStorageInfo[] = {
+ {::hx::fsString,(void *) &Base64_obj::CHARS,HX_("CHARS",bd,d4,a1,c3)},
+ {::hx::fsObject /* ::haxe::io::Bytes */ ,(void *) &Base64_obj::BYTES,HX_("BYTES",4b,40,86,3b)},
+ {::hx::fsString,(void *) &Base64_obj::URL_CHARS,HX_("URL_CHARS",8d,c8,38,74)},
+ {::hx::fsObject /* ::haxe::io::Bytes */ ,(void *) &Base64_obj::URL_BYTES,HX_("URL_BYTES",1b,34,1d,ec)},
+ { ::hx::fsUnknown, 0, null()}
+};
+#endif
+
+static void Base64_obj_sMarkStatics(HX_MARK_PARAMS) {
+ HX_MARK_MEMBER_NAME(Base64_obj::CHARS,"CHARS");
+ HX_MARK_MEMBER_NAME(Base64_obj::BYTES,"BYTES");
+ HX_MARK_MEMBER_NAME(Base64_obj::URL_CHARS,"URL_CHARS");
+ HX_MARK_MEMBER_NAME(Base64_obj::URL_BYTES,"URL_BYTES");
+};
+
+#ifdef HXCPP_VISIT_ALLOCS
+static void Base64_obj_sVisitStatics(HX_VISIT_PARAMS) {
+ HX_VISIT_MEMBER_NAME(Base64_obj::CHARS,"CHARS");
+ HX_VISIT_MEMBER_NAME(Base64_obj::BYTES,"BYTES");
+ HX_VISIT_MEMBER_NAME(Base64_obj::URL_CHARS,"URL_CHARS");
+ HX_VISIT_MEMBER_NAME(Base64_obj::URL_BYTES,"URL_BYTES");
+};
+
+#endif
+
+::hx::Class Base64_obj::__mClass;
+
+static ::String Base64_obj_sStaticFields[] = {
+ HX_("CHARS",bd,d4,a1,c3),
+ HX_("BYTES",4b,40,86,3b),
+ HX_("URL_CHARS",8d,c8,38,74),
+ HX_("URL_BYTES",1b,34,1d,ec),
+ HX_("encode",16,f2,e3,f9),
+ HX_("decode",2e,5d,ed,64),
+ HX_("urlEncode",e5,4e,52,9a),
+ HX_("urlDecode",fd,b9,5b,05),
+ ::String(null())
+};
+
+void Base64_obj::__register()
+{
+ Base64_obj _hx_dummy;
+ Base64_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.crypto.Base64",f4,3a,39,e7);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Base64_obj::__GetStatic;
+ __mClass->mSetStaticField = &Base64_obj::__SetStatic;
+ __mClass->mMarkFunc = Base64_obj_sMarkStatics;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Base64_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< Base64_obj >;
+#ifdef HXCPP_VISIT_ALLOCS
+ __mClass->mVisitFunc = Base64_obj_sVisitStatics;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Base64_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Base64_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void Base64_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_160cc64a37c5b236_29_boot)
+HXDLIN( 29) CHARS = HX_("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",03,41,03,7f);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_160cc64a37c5b236_30_boot)
+HXDLIN( 30) BYTES = ::haxe::io::Bytes_obj::ofString(::haxe::crypto::Base64_obj::CHARS,null());
+ }
+{
+ HX_STACKFRAME(&_hx_pos_160cc64a37c5b236_32_boot)
+HXDLIN( 32) URL_CHARS = HX_("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",f1,42,03,7f);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_160cc64a37c5b236_33_boot)
+HXDLIN( 33) URL_BYTES = ::haxe::io::Bytes_obj::ofString(::haxe::crypto::Base64_obj::URL_CHARS,null());
+ }
+}
+
+} // end namespace haxe
+} // end namespace crypto
diff --git a/Sources/c_snikket/src/haxe/crypto/BaseCode.cpp b/Sources/c_snikket/src/haxe/crypto/BaseCode.cpp
new file mode 100644
index 0000000..c17124b
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/crypto/BaseCode.cpp
@@ -0,0 +1,285 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_haxe_crypto_BaseCode
+#include <haxe/crypto/BaseCode.h>
+#endif
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_b23e417e2bb3f320_33_new,"haxe.crypto.BaseCode","new",0xd63c60f5,"haxe.crypto.BaseCode.new","/usr/local/lib/haxe/std/haxe/crypto/BaseCode.hx",33,0xb0c29dde)
+HX_LOCAL_STACK_FRAME(_hx_pos_b23e417e2bb3f320_44_encodeBytes,"haxe.crypto.BaseCode","encodeBytes",0x58a8e40a,"haxe.crypto.BaseCode.encodeBytes","/usr/local/lib/haxe/std/haxe/crypto/BaseCode.hx",44,0xb0c29dde)
+HX_LOCAL_STACK_FRAME(_hx_pos_b23e417e2bb3f320_72_initTable,"haxe.crypto.BaseCode","initTable",0xa1288133,"haxe.crypto.BaseCode.initTable","/usr/local/lib/haxe/std/haxe/crypto/BaseCode.hx",72,0xb0c29dde)
+HX_LOCAL_STACK_FRAME(_hx_pos_b23e417e2bb3f320_81_decodeBytes,"haxe.crypto.BaseCode","decodeBytes",0x152c41f2,"haxe.crypto.BaseCode.decodeBytes","/usr/local/lib/haxe/std/haxe/crypto/BaseCode.hx",81,0xb0c29dde)
+namespace haxe{
+namespace crypto{
+
+void BaseCode_obj::__construct( ::haxe::io::Bytes base){
+ HX_STACKFRAME(&_hx_pos_b23e417e2bb3f320_33_new)
+HXLINE( 34) int len = base->length;
+HXLINE( 35) int nbits = 1;
+HXLINE( 36) while((len > (1 << nbits))){
+HXLINE( 37) nbits = (nbits + 1);
+ }
+HXLINE( 38) bool _hx_tmp;
+HXDLIN( 38) if ((nbits <= 8)) {
+HXLINE( 38) _hx_tmp = (len != (1 << nbits));
+ }
+ else {
+HXLINE( 38) _hx_tmp = true;
+ }
+HXDLIN( 38) if (_hx_tmp) {
+HXLINE( 39) HX_STACK_DO_THROW(HX_("BaseCode : base length must be a power of two.",78,b6,c8,ca));
+ }
+HXLINE( 40) this->base = base;
+HXLINE( 41) this->nbits = nbits;
+ }
+
+Dynamic BaseCode_obj::__CreateEmpty() { return new BaseCode_obj; }
+
+void *BaseCode_obj::_hx_vtable = 0;
+
+Dynamic BaseCode_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< BaseCode_obj > _hx_result = new BaseCode_obj();
+ _hx_result->__construct(inArgs[0]);
+ return _hx_result;
+}
+
+bool BaseCode_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x34980465;
+}
+
+ ::haxe::io::Bytes BaseCode_obj::encodeBytes( ::haxe::io::Bytes b){
+ HX_STACKFRAME(&_hx_pos_b23e417e2bb3f320_44_encodeBytes)
+HXLINE( 48) int nbits = this->nbits;
+HXLINE( 49) ::haxe::io::Bytes base = this->base;
+HXLINE( 50) int size = ::Std_obj::_hx_int((( (Float)((b->length * 8)) ) / ( (Float)(nbits) )));
+HXLINE( 51) int out;
+HXDLIN( 51) if ((::hx::Mod((b->length * 8),nbits) == 0)) {
+HXLINE( 51) out = 0;
+ }
+ else {
+HXLINE( 51) out = 1;
+ }
+HXDLIN( 51) ::haxe::io::Bytes out1 = ::haxe::io::Bytes_obj::alloc((size + out));
+HXLINE( 52) int buf = 0;
+HXLINE( 53) int curbits = 0;
+HXLINE( 54) int mask = ((1 << nbits) - 1);
+HXLINE( 55) int pin = 0;
+HXLINE( 56) int pout = 0;
+HXLINE( 57) while((pout < size)){
+HXLINE( 58) while((curbits < nbits)){
+HXLINE( 59) curbits = (curbits + 8);
+HXLINE( 60) buf = (buf << 8);
+HXLINE( 61) pin = (pin + 1);
+HXDLIN( 61) buf = (buf | ( (int)(b->b->__get((pin - 1))) ));
+ }
+HXLINE( 63) curbits = (curbits - nbits);
+HXLINE( 64) {
+HXLINE( 64) pout = (pout + 1);
+HXDLIN( 64) out1->b[(pout - 1)] = base->b->__get(((buf >> curbits) & mask));
+ }
+ }
+HXLINE( 66) if ((curbits > 0)) {
+HXLINE( 67) pout = (pout + 1);
+HXDLIN( 67) out1->b[(pout - 1)] = base->b->__get(((buf << (nbits - curbits)) & mask));
+ }
+HXLINE( 68) return out1;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(BaseCode_obj,encodeBytes,return )
+
+void BaseCode_obj::initTable(){
+ HX_STACKFRAME(&_hx_pos_b23e417e2bb3f320_72_initTable)
+HXLINE( 73) ::Array< int > tbl = ::Array_obj< int >::__new();
+HXLINE( 74) {
+HXLINE( 74) int _g = 0;
+HXDLIN( 74) while((_g < 256)){
+HXLINE( 74) _g = (_g + 1);
+HXDLIN( 74) int i = (_g - 1);
+HXLINE( 75) tbl[i] = -1;
+ }
+ }
+HXLINE( 76) {
+HXLINE( 76) int _g1 = 0;
+HXDLIN( 76) int _g2 = this->base->length;
+HXDLIN( 76) while((_g1 < _g2)){
+HXLINE( 76) _g1 = (_g1 + 1);
+HXDLIN( 76) int i1 = (_g1 - 1);
+HXLINE( 77) tbl[( (int)(this->base->b->__get(i1)) )] = i1;
+ }
+ }
+HXLINE( 78) this->tbl = tbl;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(BaseCode_obj,initTable,(void))
+
+ ::haxe::io::Bytes BaseCode_obj::decodeBytes( ::haxe::io::Bytes b){
+ HX_STACKFRAME(&_hx_pos_b23e417e2bb3f320_81_decodeBytes)
+HXLINE( 85) int nbits = this->nbits;
+HXLINE( 86) ::haxe::io::Bytes base = this->base;
+HXLINE( 87) if (::hx::IsNull( this->tbl )) {
+HXLINE( 88) this->initTable();
+ }
+HXLINE( 89) ::Array< int > tbl = this->tbl;
+HXLINE( 90) int size = ((b->length * nbits) >> 3);
+HXLINE( 91) ::haxe::io::Bytes out = ::haxe::io::Bytes_obj::alloc(size);
+HXLINE( 92) int buf = 0;
+HXLINE( 93) int curbits = 0;
+HXLINE( 94) int pin = 0;
+HXLINE( 95) int pout = 0;
+HXLINE( 96) while((pout < size)){
+HXLINE( 97) while((curbits < 8)){
+HXLINE( 98) curbits = (curbits + nbits);
+HXLINE( 99) buf = (buf << nbits);
+HXLINE( 100) pin = (pin + 1);
+HXDLIN( 100) int i = tbl->__get(( (int)(b->b->__get((pin - 1))) ));
+HXLINE( 101) if ((i == -1)) {
+HXLINE( 102) HX_STACK_DO_THROW(HX_("BaseCode : invalid encoded char",f9,14,33,18));
+ }
+HXLINE( 103) buf = (buf | i);
+ }
+HXLINE( 105) curbits = (curbits - 8);
+HXLINE( 106) {
+HXLINE( 106) pout = (pout + 1);
+HXDLIN( 106) out->b[(pout - 1)] = ( (unsigned char)(((buf >> curbits) & 255)) );
+ }
+ }
+HXLINE( 108) return out;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(BaseCode_obj,decodeBytes,return )
+
+
+::hx::ObjectPtr< BaseCode_obj > BaseCode_obj::__new( ::haxe::io::Bytes base) {
+ ::hx::ObjectPtr< BaseCode_obj > __this = new BaseCode_obj();
+ __this->__construct(base);
+ return __this;
+}
+
+::hx::ObjectPtr< BaseCode_obj > BaseCode_obj::__alloc(::hx::Ctx *_hx_ctx, ::haxe::io::Bytes base) {
+ BaseCode_obj *__this = (BaseCode_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(BaseCode_obj), true, "haxe.crypto.BaseCode"));
+ *(void **)__this = BaseCode_obj::_hx_vtable;
+ __this->__construct(base);
+ return __this;
+}
+
+BaseCode_obj::BaseCode_obj()
+{
+}
+
+void BaseCode_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(BaseCode);
+ HX_MARK_MEMBER_NAME(base,"base");
+ HX_MARK_MEMBER_NAME(nbits,"nbits");
+ HX_MARK_MEMBER_NAME(tbl,"tbl");
+ HX_MARK_END_CLASS();
+}
+
+void BaseCode_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(base,"base");
+ HX_VISIT_MEMBER_NAME(nbits,"nbits");
+ HX_VISIT_MEMBER_NAME(tbl,"tbl");
+}
+
+::hx::Val BaseCode_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"tbl") ) { return ::hx::Val( tbl ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"base") ) { return ::hx::Val( base ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"nbits") ) { return ::hx::Val( nbits ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"initTable") ) { return ::hx::Val( initTable_dyn() ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"encodeBytes") ) { return ::hx::Val( encodeBytes_dyn() ); }
+ if (HX_FIELD_EQ(inName,"decodeBytes") ) { return ::hx::Val( decodeBytes_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val BaseCode_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"tbl") ) { tbl=inValue.Cast< ::Array< int > >(); return inValue; }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"base") ) { base=inValue.Cast< ::haxe::io::Bytes >(); return inValue; }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"nbits") ) { nbits=inValue.Cast< int >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void BaseCode_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("base",11,e8,10,41));
+ outFields->push(HX_("nbits",74,ca,2a,97));
+ outFields->push(HX_("tbl",3e,5b,58,00));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo BaseCode_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::haxe::io::Bytes */ ,(int)offsetof(BaseCode_obj,base),HX_("base",11,e8,10,41)},
+ {::hx::fsInt,(int)offsetof(BaseCode_obj,nbits),HX_("nbits",74,ca,2a,97)},
+ {::hx::fsObject /* ::Array< int > */ ,(int)offsetof(BaseCode_obj,tbl),HX_("tbl",3e,5b,58,00)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *BaseCode_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String BaseCode_obj_sMemberFields[] = {
+ HX_("base",11,e8,10,41),
+ HX_("nbits",74,ca,2a,97),
+ HX_("tbl",3e,5b,58,00),
+ HX_("encodeBytes",75,36,2e,c9),
+ HX_("initTable",de,d2,75,26),
+ HX_("decodeBytes",5d,94,b1,85),
+ ::String(null()) };
+
+::hx::Class BaseCode_obj::__mClass;
+
+void BaseCode_obj::__register()
+{
+ BaseCode_obj _hx_dummy;
+ BaseCode_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.crypto.BaseCode",83,c2,f9,1c);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(BaseCode_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< BaseCode_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = BaseCode_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = BaseCode_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
+} // end namespace crypto
diff --git a/Sources/c_snikket/src/haxe/crypto/Sha1.cpp b/Sources/c_snikket/src/haxe/crypto/Sha1.cpp
new file mode 100644
index 0000000..3ab767b
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/crypto/Sha1.cpp
@@ -0,0 +1,334 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_crypto_Sha1
+#include <haxe/crypto/Sha1.h>
+#endif
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_b388adc1457cbfc2_48_new,"haxe.crypto.Sha1","new",0xdb44b09c,"haxe.crypto.Sha1.new","/usr/local/lib/haxe/std/haxe/crypto/Sha1.hx",48,0x02d96297)
+HX_LOCAL_STACK_FRAME(_hx_pos_b388adc1457cbfc2_50_doEncode,"haxe.crypto.Sha1","doEncode",0xfb483e45,"haxe.crypto.Sha1.doEncode","/usr/local/lib/haxe/std/haxe/crypto/Sha1.hx",50,0x02d96297)
+HX_LOCAL_STACK_FRAME(_hx_pos_b388adc1457cbfc2_142_ft,"haxe.crypto.Sha1","ft",0x7aab5492,"haxe.crypto.Sha1.ft","/usr/local/lib/haxe/std/haxe/crypto/Sha1.hx",142,0x02d96297)
+HX_LOCAL_STACK_FRAME(_hx_pos_b388adc1457cbfc2_155_kt,"haxe.crypto.Sha1","kt",0x7aab58ed,"haxe.crypto.Sha1.kt","/usr/local/lib/haxe/std/haxe/crypto/Sha1.hx",155,0x02d96297)
+HX_LOCAL_STACK_FRAME(_hx_pos_b388adc1457cbfc2_35_make,"haxe.crypto.Sha1","make",0x00298e32,"haxe.crypto.Sha1.make","/usr/local/lib/haxe/std/haxe/crypto/Sha1.hx",35,0x02d96297)
+HX_LOCAL_STACK_FRAME(_hx_pos_b388adc1457cbfc2_115_bytes2blks,"haxe.crypto.Sha1","bytes2blks",0x985aae1d,"haxe.crypto.Sha1.bytes2blks","/usr/local/lib/haxe/std/haxe/crypto/Sha1.hx",115,0x02d96297)
+namespace haxe{
+namespace crypto{
+
+void Sha1_obj::__construct(){
+ HX_STACKFRAME(&_hx_pos_b388adc1457cbfc2_48_new)
+ }
+
+Dynamic Sha1_obj::__CreateEmpty() { return new Sha1_obj; }
+
+void *Sha1_obj::_hx_vtable = 0;
+
+Dynamic Sha1_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Sha1_obj > _hx_result = new Sha1_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool Sha1_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x3a249b8c;
+}
+
+::Array< int > Sha1_obj::doEncode(::Array< int > x){
+ HX_STACKFRAME(&_hx_pos_b388adc1457cbfc2_50_doEncode)
+HXLINE( 51) ::Array< int > w = ::Array_obj< int >::__new();
+HXLINE( 53) int a = (int)1732584193;
+HXLINE( 54) int b = -271733879;
+HXLINE( 55) int c = (int)-1732584194;
+HXLINE( 56) int d = 271733878;
+HXLINE( 57) int e = (int)-1009589776;
+HXLINE( 59) int i = 0;
+HXLINE( 60) while((i < x->length)){
+HXLINE( 61) int olda = a;
+HXLINE( 62) int oldb = b;
+HXLINE( 63) int oldc = c;
+HXLINE( 64) int oldd = d;
+HXLINE( 65) int olde = e;
+HXLINE( 67) int j = 0;
+HXLINE( 68) while((j < 80)){
+HXLINE( 69) if ((j < 16)) {
+HXLINE( 70) w[j] = x->__get((i + j));
+ }
+ else {
+HXLINE( 72) int num = (((w->__get((j - 3)) ^ w->__get((j - 8))) ^ w->__get((j - 14))) ^ w->__get((j - 16)));
+HXDLIN( 72) w[j] = ((num << 1) | ::hx::UShr(num,31));
+ }
+HXLINE( 73) int t = ((((a << 5) | ::hx::UShr(a,27)) + this->ft(j,b,c,d)) + e);
+HXDLIN( 73) int t1 = (t + w->__get(j));
+HXDLIN( 73) int t2 = (t1 + this->kt(j));
+HXLINE( 74) e = d;
+HXLINE( 75) d = c;
+HXLINE( 76) c = ((b << 30) | ::hx::UShr(b,2));
+HXLINE( 77) b = a;
+HXLINE( 78) a = t2;
+HXLINE( 79) j = (j + 1);
+ }
+HXLINE( 81) a = (a + olda);
+HXLINE( 82) b = (b + oldb);
+HXLINE( 83) c = (c + oldc);
+HXLINE( 84) d = (d + oldd);
+HXLINE( 85) e = (e + olde);
+HXLINE( 86) i = (i + 16);
+ }
+HXLINE( 88) return ::Array_obj< int >::__new(5)->init(0,a)->init(1,b)->init(2,c)->init(3,d)->init(4,e);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Sha1_obj,doEncode,return )
+
+int Sha1_obj::ft(int t,int b,int c,int d){
+ HX_STACKFRAME(&_hx_pos_b388adc1457cbfc2_142_ft)
+HXLINE( 143) if ((t < 20)) {
+HXLINE( 144) return ((b & c) | (~(b) & d));
+ }
+HXLINE( 145) if ((t < 40)) {
+HXLINE( 146) return ((b ^ c) ^ d);
+ }
+HXLINE( 147) if ((t < 60)) {
+HXLINE( 148) return (((b & c) | (b & d)) | (c & d));
+ }
+HXLINE( 149) return ((b ^ c) ^ d);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC4(Sha1_obj,ft,return )
+
+int Sha1_obj::kt(int t){
+ HX_STACKFRAME(&_hx_pos_b388adc1457cbfc2_155_kt)
+HXLINE( 156) if ((t < 20)) {
+HXLINE( 157) return (int)1518500249;
+ }
+HXLINE( 158) if ((t < 40)) {
+HXLINE( 159) return (int)1859775393;
+ }
+HXLINE( 160) if ((t < 60)) {
+HXLINE( 161) return (int)-1894007588;
+ }
+HXLINE( 162) return -899497514;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Sha1_obj,kt,return )
+
+ ::haxe::io::Bytes Sha1_obj::make( ::haxe::io::Bytes b){
+ HX_GC_STACKFRAME(&_hx_pos_b388adc1457cbfc2_35_make)
+HXLINE( 36) ::haxe::crypto::Sha1 h = ::haxe::crypto::Sha1_obj::__alloc( HX_CTX );
+HXDLIN( 36) ::Array< int > h1 = h->doEncode(::haxe::crypto::Sha1_obj::bytes2blks(b));
+HXLINE( 37) ::haxe::io::Bytes out = ::haxe::io::Bytes_obj::alloc(20);
+HXLINE( 38) int p = 0;
+HXLINE( 39) {
+HXLINE( 39) {
+HXLINE( 40) {
+HXLINE( 40) p = (p + 1);
+HXDLIN( 40) out->b[(p - 1)] = ( (unsigned char)(::hx::UShr(h1->__get(0),24)) );
+ }
+HXLINE( 41) {
+HXLINE( 41) p = (p + 1);
+HXDLIN( 41) out->b[(p - 1)] = ( (unsigned char)(((h1->__get(0) >> 16) & 255)) );
+ }
+HXLINE( 42) {
+HXLINE( 42) p = (p + 1);
+HXDLIN( 42) out->b[(p - 1)] = ( (unsigned char)(((h1->__get(0) >> 8) & 255)) );
+ }
+HXLINE( 43) {
+HXLINE( 43) p = (p + 1);
+HXDLIN( 43) out->b[(p - 1)] = ( (unsigned char)((h1->__get(0) & 255)) );
+ }
+ }
+HXLINE( 39) {
+HXLINE( 40) {
+HXLINE( 40) p = (p + 1);
+HXDLIN( 40) out->b[(p - 1)] = ( (unsigned char)(::hx::UShr(h1->__get(1),24)) );
+ }
+HXLINE( 41) {
+HXLINE( 41) p = (p + 1);
+HXDLIN( 41) out->b[(p - 1)] = ( (unsigned char)(((h1->__get(1) >> 16) & 255)) );
+ }
+HXLINE( 42) {
+HXLINE( 42) p = (p + 1);
+HXDLIN( 42) out->b[(p - 1)] = ( (unsigned char)(((h1->__get(1) >> 8) & 255)) );
+ }
+HXLINE( 43) {
+HXLINE( 43) p = (p + 1);
+HXDLIN( 43) out->b[(p - 1)] = ( (unsigned char)((h1->__get(1) & 255)) );
+ }
+ }
+HXLINE( 39) {
+HXLINE( 40) {
+HXLINE( 40) p = (p + 1);
+HXDLIN( 40) out->b[(p - 1)] = ( (unsigned char)(::hx::UShr(h1->__get(2),24)) );
+ }
+HXLINE( 41) {
+HXLINE( 41) p = (p + 1);
+HXDLIN( 41) out->b[(p - 1)] = ( (unsigned char)(((h1->__get(2) >> 16) & 255)) );
+ }
+HXLINE( 42) {
+HXLINE( 42) p = (p + 1);
+HXDLIN( 42) out->b[(p - 1)] = ( (unsigned char)(((h1->__get(2) >> 8) & 255)) );
+ }
+HXLINE( 43) {
+HXLINE( 43) p = (p + 1);
+HXDLIN( 43) out->b[(p - 1)] = ( (unsigned char)((h1->__get(2) & 255)) );
+ }
+ }
+HXLINE( 39) {
+HXLINE( 40) {
+HXLINE( 40) p = (p + 1);
+HXDLIN( 40) out->b[(p - 1)] = ( (unsigned char)(::hx::UShr(h1->__get(3),24)) );
+ }
+HXLINE( 41) {
+HXLINE( 41) p = (p + 1);
+HXDLIN( 41) out->b[(p - 1)] = ( (unsigned char)(((h1->__get(3) >> 16) & 255)) );
+ }
+HXLINE( 42) {
+HXLINE( 42) p = (p + 1);
+HXDLIN( 42) out->b[(p - 1)] = ( (unsigned char)(((h1->__get(3) >> 8) & 255)) );
+ }
+HXLINE( 43) {
+HXLINE( 43) p = (p + 1);
+HXDLIN( 43) out->b[(p - 1)] = ( (unsigned char)((h1->__get(3) & 255)) );
+ }
+ }
+HXLINE( 39) {
+HXLINE( 40) {
+HXLINE( 40) p = (p + 1);
+HXDLIN( 40) out->b[(p - 1)] = ( (unsigned char)(::hx::UShr(h1->__get(4),24)) );
+ }
+HXLINE( 41) {
+HXLINE( 41) p = (p + 1);
+HXDLIN( 41) out->b[(p - 1)] = ( (unsigned char)(((h1->__get(4) >> 16) & 255)) );
+ }
+HXLINE( 42) {
+HXLINE( 42) p = (p + 1);
+HXDLIN( 42) out->b[(p - 1)] = ( (unsigned char)(((h1->__get(4) >> 8) & 255)) );
+ }
+HXLINE( 43) {
+HXLINE( 43) p = (p + 1);
+HXDLIN( 43) out->b[(p - 1)] = ( (unsigned char)((h1->__get(4) & 255)) );
+ }
+ }
+ }
+HXLINE( 45) return out;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Sha1_obj,make,return )
+
+::Array< int > Sha1_obj::bytes2blks( ::haxe::io::Bytes b){
+ HX_STACKFRAME(&_hx_pos_b388adc1457cbfc2_115_bytes2blks)
+HXLINE( 116) int nblk = (((b->length + 8) >> 6) + 1);
+HXLINE( 117) ::Array< int > blks = ::Array_obj< int >::__new();
+HXLINE( 119) {
+HXLINE( 119) int _g = 0;
+HXDLIN( 119) int _g1 = (nblk * 16);
+HXDLIN( 119) while((_g < _g1)){
+HXLINE( 119) _g = (_g + 1);
+HXDLIN( 119) int i = (_g - 1);
+HXLINE( 120) blks[i] = 0;
+ }
+ }
+HXLINE( 121) {
+HXLINE( 121) int _g2 = 0;
+HXDLIN( 121) int _g3 = b->length;
+HXDLIN( 121) while((_g2 < _g3)){
+HXLINE( 121) _g2 = (_g2 + 1);
+HXDLIN( 121) int i1 = (_g2 - 1);
+HXLINE( 122) int p = (i1 >> 2);
+HXLINE( 123) ::Array< int > blks1 = blks;
+HXDLIN( 123) int p1 = p;
+HXDLIN( 123) blks1[p1] = (blks1->__get(p1) | (( (int)(b->b->__get(i1)) ) << (24 - ((i1 & 3) << 3))));
+ }
+ }
+HXLINE( 125) int i2 = b->length;
+HXLINE( 126) int p2 = (i2 >> 2);
+HXLINE( 127) ::Array< int > blks2 = blks;
+HXDLIN( 127) int p3 = p2;
+HXDLIN( 127) blks2[p3] = (blks2->__get(p3) | (128 << (24 - ((i2 & 3) << 3))));
+HXLINE( 128) blks[((nblk * 16) - 1)] = (b->length * 8);
+HXLINE( 129) return blks;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Sha1_obj,bytes2blks,return )
+
+
+Sha1_obj::Sha1_obj()
+{
+}
+
+::hx::Val Sha1_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 2:
+ if (HX_FIELD_EQ(inName,"ft") ) { return ::hx::Val( ft_dyn() ); }
+ if (HX_FIELD_EQ(inName,"kt") ) { return ::hx::Val( kt_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"doEncode") ) { return ::hx::Val( doEncode_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool Sha1_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"make") ) { outValue = make_dyn(); return true; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"bytes2blks") ) { outValue = bytes2blks_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *Sha1_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *Sha1_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Sha1_obj_sMemberFields[] = {
+ HX_("doEncode",01,78,fb,8d),
+ HX_("ft",4e,59,00,00),
+ HX_("kt",a9,5d,00,00),
+ ::String(null()) };
+
+::hx::Class Sha1_obj::__mClass;
+
+static ::String Sha1_obj_sStaticFields[] = {
+ HX_("make",ee,39,56,48),
+ HX_("bytes2blks",d9,ce,9c,a9),
+ ::String(null())
+};
+
+void Sha1_obj::__register()
+{
+ Sha1_obj _hx_dummy;
+ Sha1_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.crypto.Sha1",aa,72,c9,13);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Sha1_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Sha1_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Sha1_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Sha1_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Sha1_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Sha1_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
+} // end namespace crypto
diff --git a/Sources/c_snikket/src/haxe/crypto/Sha256.cpp b/Sources/c_snikket/src/haxe/crypto/Sha256.cpp
new file mode 100644
index 0000000..fc04c02
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/crypto/Sha256.cpp
@@ -0,0 +1,313 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_crypto_Sha256
+#include <haxe/crypto/Sha256.h>
+#endif
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_0a4e95b4276e5057_48_new,"haxe.crypto.Sha256","new",0x4d8a58be,"haxe.crypto.Sha256.new","/usr/local/lib/haxe/std/haxe/crypto/Sha256.hx",48,0xc2cd6b75)
+HX_LOCAL_STACK_FRAME(_hx_pos_0a4e95b4276e5057_50_doEncode,"haxe.crypto.Sha256","doEncode",0xbba3dae3,"haxe.crypto.Sha256.doEncode","/usr/local/lib/haxe/std/haxe/crypto/Sha256.hx",50,0xc2cd6b75)
+static const int _hx_array_data_af0be1cc_4[] = {
+ (int)1116352408,(int)1899447441,(int)-1245643825,(int)-373957723,(int)961987163,(int)1508970993,(int)-1841331548,(int)-1424204075,(int)-670586216,(int)310598401,(int)607225278,(int)1426881987,(int)1925078388,(int)-2132889090,(int)-1680079193,(int)-1046744716,(int)-459576895,(int)-272742522,(int)264347078,(int)604807628,(int)770255983,(int)1249150122,(int)1555081692,(int)1996064986,(int)-1740746414,(int)-1473132947,(int)-1341970488,(int)-1084653625,(int)-958395405,(int)-710438585,(int)113926993,(int)338241895,(int)666307205,(int)773529912,(int)1294757372,(int)1396182291,(int)1695183700,(int)1986661051,(int)-2117940946,(int)-1838011259,(int)-1564481375,(int)-1474664885,(int)-1035236496,(int)-949202525,(int)-778901479,(int)-694614492,(int)-200395387,(int)275423344,(int)430227734,(int)506948616,(int)659060556,(int)883997877,(int)958139571,(int)1322822218,(int)1537002063,(int)1747873779,(int)1955562222,(int)2024104815,(int)-2067236844,(int)-1933114872,(int)-1866530822,(int)-1538233109,(int)-1090935817,(int)-965641998,
+};
+static const int _hx_array_data_af0be1cc_5[] = {
+ (int)1779033703,(int)-1150833019,(int)1013904242,(int)-1521486534,(int)1359893119,(int)-1694144372,(int)528734635,(int)1541459225,
+};
+HX_LOCAL_STACK_FRAME(_hx_pos_0a4e95b4276e5057_35_make,"haxe.crypto.Sha256","make",0x8ad703d0,"haxe.crypto.Sha256.make","/usr/local/lib/haxe/std/haxe/crypto/Sha256.hx",35,0xc2cd6b75)
+HX_LOCAL_STACK_FRAME(_hx_pos_0a4e95b4276e5057_133_bytes2blks,"haxe.crypto.Sha256","bytes2blks",0xdc4d2e3b,"haxe.crypto.Sha256.bytes2blks","/usr/local/lib/haxe/std/haxe/crypto/Sha256.hx",133,0xc2cd6b75)
+namespace haxe{
+namespace crypto{
+
+void Sha256_obj::__construct(){
+ HX_STACKFRAME(&_hx_pos_0a4e95b4276e5057_48_new)
+ }
+
+Dynamic Sha256_obj::__CreateEmpty() { return new Sha256_obj; }
+
+void *Sha256_obj::_hx_vtable = 0;
+
+Dynamic Sha256_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Sha256_obj > _hx_result = new Sha256_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool Sha256_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x0c0976ea;
+}
+
+::Array< int > Sha256_obj::doEncode(::Array< int > m,int l){
+ HX_STACKFRAME(&_hx_pos_0a4e95b4276e5057_50_doEncode)
+HXLINE( 51) ::Array< int > K = ::Array_obj< int >::fromData( _hx_array_data_af0be1cc_4,64);
+HXLINE( 59) ::Array< int > HASH = ::Array_obj< int >::fromData( _hx_array_data_af0be1cc_5,8);
+HXLINE( 64) ::Array< int > W = ::Array_obj< int >::__new();
+HXLINE( 65) W[64] = 0;
+HXLINE( 66) int a;
+HXDLIN( 66) int b;
+HXDLIN( 66) int c;
+HXDLIN( 66) int d;
+HXDLIN( 66) int e;
+HXDLIN( 66) int f;
+HXDLIN( 66) int g;
+HXDLIN( 66) int h;
+HXLINE( 67) int T1;
+HXDLIN( 67) int T2;
+HXLINE( 68) ::Array< int > m1 = m;
+HXDLIN( 68) int index = (l >> 5);
+HXDLIN( 68) m1[index] = (m1->__get(index) | (128 << (24 - ::hx::Mod(l,32))));
+HXLINE( 69) m[((((l + 64) >> 9) << 4) + 15)] = l;
+HXLINE( 70) int i = 0;
+HXLINE( 71) while((i < m->length)){
+HXLINE( 72) a = HASH->__get(0);
+HXLINE( 73) b = HASH->__get(1);
+HXLINE( 74) c = HASH->__get(2);
+HXLINE( 75) d = HASH->__get(3);
+HXLINE( 76) e = HASH->__get(4);
+HXLINE( 77) f = HASH->__get(5);
+HXLINE( 78) g = HASH->__get(6);
+HXLINE( 79) h = HASH->__get(7);
+HXLINE( 80) {
+HXLINE( 80) int _g = 0;
+HXDLIN( 80) while((_g < 64)){
+HXLINE( 80) _g = (_g + 1);
+HXDLIN( 80) int j = (_g - 1);
+HXLINE( 81) if ((j < 16)) {
+HXLINE( 82) W[j] = m->__get((j + i));
+ }
+ else {
+HXLINE( 84) int x = W->__get((j - 2));
+HXDLIN( 84) int x1 = (((::hx::UShr(x,17) | (x << 15)) ^ (::hx::UShr(x,19) | (x << 13))) ^ ::hx::UShr(x,10));
+HXDLIN( 84) int y = W->__get((j - 7));
+HXDLIN( 84) int lsw = ((x1 & 65535) + (y & 65535));
+HXDLIN( 84) int msw = (((x1 >> 16) + (y >> 16)) + (lsw >> 16));
+HXDLIN( 84) int x2 = ((msw << 16) | (lsw & 65535));
+HXDLIN( 84) int x3 = W->__get((j - 15));
+HXDLIN( 84) int y1 = (((::hx::UShr(x3,7) | (x3 << 25)) ^ (::hx::UShr(x3,18) | (x3 << 14))) ^ ::hx::UShr(x3,3));
+HXDLIN( 84) int lsw1 = ((x2 & 65535) + (y1 & 65535));
+HXDLIN( 84) int msw1 = (((x2 >> 16) + (y1 >> 16)) + (lsw1 >> 16));
+HXDLIN( 84) int x4 = ((msw1 << 16) | (lsw1 & 65535));
+HXDLIN( 84) int y2 = W->__get((j - 16));
+HXDLIN( 84) int lsw2 = ((x4 & 65535) + (y2 & 65535));
+HXDLIN( 84) int msw2 = (((x4 >> 16) + (y2 >> 16)) + (lsw2 >> 16));
+HXDLIN( 84) W[j] = ((msw2 << 16) | (lsw2 & 65535));
+ }
+HXLINE( 85) int y3 = (((::hx::UShr(e,6) | (e << 26)) ^ (::hx::UShr(e,11) | (e << 21))) ^ (::hx::UShr(e,25) | (e << 7)));
+HXDLIN( 85) int lsw3 = ((h & 65535) + (y3 & 65535));
+HXDLIN( 85) int msw3 = (((h >> 16) + (y3 >> 16)) + (lsw3 >> 16));
+HXDLIN( 85) int x5 = ((msw3 << 16) | (lsw3 & 65535));
+HXDLIN( 85) int y4 = ((e & f) ^ (~(e) & g));
+HXDLIN( 85) int lsw4 = ((x5 & 65535) + (y4 & 65535));
+HXDLIN( 85) int msw4 = (((x5 >> 16) + (y4 >> 16)) + (lsw4 >> 16));
+HXDLIN( 85) int x6 = ((msw4 << 16) | (lsw4 & 65535));
+HXDLIN( 85) int y5 = K->__get(j);
+HXDLIN( 85) int lsw5 = ((x6 & 65535) + (y5 & 65535));
+HXDLIN( 85) int msw5 = (((x6 >> 16) + (y5 >> 16)) + (lsw5 >> 16));
+HXDLIN( 85) int x7 = ((msw5 << 16) | (lsw5 & 65535));
+HXDLIN( 85) int y6 = W->__get(j);
+HXDLIN( 85) int lsw6 = ((x7 & 65535) + (y6 & 65535));
+HXDLIN( 85) int msw6 = (((x7 >> 16) + (y6 >> 16)) + (lsw6 >> 16));
+HXDLIN( 85) T1 = ((msw6 << 16) | (lsw6 & 65535));
+HXLINE( 86) int x8 = (((::hx::UShr(a,2) | (a << 30)) ^ (::hx::UShr(a,13) | (a << 19))) ^ (::hx::UShr(a,22) | (a << 10)));
+HXDLIN( 86) int y7 = (((a & b) ^ (a & c)) ^ (b & c));
+HXDLIN( 86) int lsw7 = ((x8 & 65535) + (y7 & 65535));
+HXDLIN( 86) int msw7 = (((x8 >> 16) + (y7 >> 16)) + (lsw7 >> 16));
+HXDLIN( 86) T2 = ((msw7 << 16) | (lsw7 & 65535));
+HXLINE( 87) h = g;
+HXLINE( 88) g = f;
+HXLINE( 89) f = e;
+HXLINE( 90) int lsw8 = ((d & 65535) + (T1 & 65535));
+HXDLIN( 90) int msw8 = (((d >> 16) + (T1 >> 16)) + (lsw8 >> 16));
+HXDLIN( 90) e = ((msw8 << 16) | (lsw8 & 65535));
+HXLINE( 91) d = c;
+HXLINE( 92) c = b;
+HXLINE( 93) b = a;
+HXLINE( 94) int lsw9 = ((T1 & 65535) + (T2 & 65535));
+HXDLIN( 94) int msw9 = (((T1 >> 16) + (T2 >> 16)) + (lsw9 >> 16));
+HXDLIN( 94) a = ((msw9 << 16) | (lsw9 & 65535));
+ }
+ }
+HXLINE( 96) int y8 = HASH->__get(0);
+HXDLIN( 96) int lsw10 = ((a & 65535) + (y8 & 65535));
+HXDLIN( 96) int msw10 = (((a >> 16) + (y8 >> 16)) + (lsw10 >> 16));
+HXDLIN( 96) HASH[0] = ((msw10 << 16) | (lsw10 & 65535));
+HXLINE( 97) int y9 = HASH->__get(1);
+HXDLIN( 97) int lsw11 = ((b & 65535) + (y9 & 65535));
+HXDLIN( 97) int msw11 = (((b >> 16) + (y9 >> 16)) + (lsw11 >> 16));
+HXDLIN( 97) HASH[1] = ((msw11 << 16) | (lsw11 & 65535));
+HXLINE( 98) int y10 = HASH->__get(2);
+HXDLIN( 98) int lsw12 = ((c & 65535) + (y10 & 65535));
+HXDLIN( 98) int msw12 = (((c >> 16) + (y10 >> 16)) + (lsw12 >> 16));
+HXDLIN( 98) HASH[2] = ((msw12 << 16) | (lsw12 & 65535));
+HXLINE( 99) int y11 = HASH->__get(3);
+HXDLIN( 99) int lsw13 = ((d & 65535) + (y11 & 65535));
+HXDLIN( 99) int msw13 = (((d >> 16) + (y11 >> 16)) + (lsw13 >> 16));
+HXDLIN( 99) HASH[3] = ((msw13 << 16) | (lsw13 & 65535));
+HXLINE( 100) int y12 = HASH->__get(4);
+HXDLIN( 100) int lsw14 = ((e & 65535) + (y12 & 65535));
+HXDLIN( 100) int msw14 = (((e >> 16) + (y12 >> 16)) + (lsw14 >> 16));
+HXDLIN( 100) HASH[4] = ((msw14 << 16) | (lsw14 & 65535));
+HXLINE( 101) int y13 = HASH->__get(5);
+HXDLIN( 101) int lsw15 = ((f & 65535) + (y13 & 65535));
+HXDLIN( 101) int msw15 = (((f >> 16) + (y13 >> 16)) + (lsw15 >> 16));
+HXDLIN( 101) HASH[5] = ((msw15 << 16) | (lsw15 & 65535));
+HXLINE( 102) int y14 = HASH->__get(6);
+HXDLIN( 102) int lsw16 = ((g & 65535) + (y14 & 65535));
+HXDLIN( 102) int msw16 = (((g >> 16) + (y14 >> 16)) + (lsw16 >> 16));
+HXDLIN( 102) HASH[6] = ((msw16 << 16) | (lsw16 & 65535));
+HXLINE( 103) int y15 = HASH->__get(7);
+HXDLIN( 103) int lsw17 = ((h & 65535) + (y15 & 65535));
+HXDLIN( 103) int msw17 = (((h >> 16) + (y15 >> 16)) + (lsw17 >> 16));
+HXDLIN( 103) HASH[7] = ((msw17 << 16) | (lsw17 & 65535));
+HXLINE( 104) i = (i + 16);
+ }
+HXLINE( 106) return HASH;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Sha256_obj,doEncode,return )
+
+ ::haxe::io::Bytes Sha256_obj::make( ::haxe::io::Bytes b){
+ HX_GC_STACKFRAME(&_hx_pos_0a4e95b4276e5057_35_make)
+HXLINE( 36) ::haxe::crypto::Sha256 h = ::haxe::crypto::Sha256_obj::__alloc( HX_CTX );
+HXDLIN( 36) ::Array< int > h1 = ::haxe::crypto::Sha256_obj::bytes2blks(b);
+HXDLIN( 36) ::Array< int > h2 = h->doEncode(h1,(b->length * 8));
+HXLINE( 37) ::haxe::io::Bytes out = ::haxe::io::Bytes_obj::alloc(32);
+HXLINE( 38) int p = 0;
+HXLINE( 39) {
+HXLINE( 39) int _g = 0;
+HXDLIN( 39) while((_g < 8)){
+HXLINE( 39) _g = (_g + 1);
+HXDLIN( 39) int i = (_g - 1);
+HXLINE( 40) {
+HXLINE( 40) p = (p + 1);
+HXDLIN( 40) out->b[(p - 1)] = ( (unsigned char)(::hx::UShr(h2->__get(i),24)) );
+ }
+HXLINE( 41) {
+HXLINE( 41) p = (p + 1);
+HXDLIN( 41) out->b[(p - 1)] = ( (unsigned char)(((h2->__get(i) >> 16) & 255)) );
+ }
+HXLINE( 42) {
+HXLINE( 42) p = (p + 1);
+HXDLIN( 42) out->b[(p - 1)] = ( (unsigned char)(((h2->__get(i) >> 8) & 255)) );
+ }
+HXLINE( 43) {
+HXLINE( 43) p = (p + 1);
+HXDLIN( 43) out->b[(p - 1)] = ( (unsigned char)((h2->__get(i) & 255)) );
+ }
+ }
+ }
+HXLINE( 45) return out;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Sha256_obj,make,return )
+
+::Array< int > Sha256_obj::bytes2blks( ::haxe::io::Bytes b){
+ HX_STACKFRAME(&_hx_pos_0a4e95b4276e5057_133_bytes2blks)
+HXLINE( 134) int nblk = (((b->length + 8) >> 6) + 1);
+HXLINE( 135) ::Array< int > blks = ::Array_obj< int >::__new();
+HXLINE( 137) {
+HXLINE( 137) int _g = 0;
+HXDLIN( 137) int _g1 = (nblk * 16);
+HXDLIN( 137) while((_g < _g1)){
+HXLINE( 137) _g = (_g + 1);
+HXDLIN( 137) int i = (_g - 1);
+HXLINE( 138) blks[i] = 0;
+ }
+ }
+HXLINE( 139) {
+HXLINE( 139) int _g2 = 0;
+HXDLIN( 139) int _g3 = b->length;
+HXDLIN( 139) while((_g2 < _g3)){
+HXLINE( 139) _g2 = (_g2 + 1);
+HXDLIN( 139) int i1 = (_g2 - 1);
+HXLINE( 140) int p = (i1 >> 2);
+HXLINE( 141) ::Array< int > blks1 = blks;
+HXDLIN( 141) int p1 = p;
+HXDLIN( 141) blks1[p1] = (blks1->__get(p1) | (( (int)(b->b->__get(i1)) ) << (24 - ((i1 & 3) << 3))));
+ }
+ }
+HXLINE( 143) int i2 = b->length;
+HXLINE( 144) int p2 = (i2 >> 2);
+HXLINE( 145) ::Array< int > blks2 = blks;
+HXDLIN( 145) int p3 = p2;
+HXDLIN( 145) blks2[p3] = (blks2->__get(p3) | (128 << (24 - ((i2 & 3) << 3))));
+HXLINE( 146) blks[((nblk * 16) - 1)] = (b->length * 8);
+HXLINE( 147) return blks;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Sha256_obj,bytes2blks,return )
+
+
+Sha256_obj::Sha256_obj()
+{
+}
+
+::hx::Val Sha256_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 8:
+ if (HX_FIELD_EQ(inName,"doEncode") ) { return ::hx::Val( doEncode_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool Sha256_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"make") ) { outValue = make_dyn(); return true; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"bytes2blks") ) { outValue = bytes2blks_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *Sha256_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *Sha256_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Sha256_obj_sMemberFields[] = {
+ HX_("doEncode",01,78,fb,8d),
+ ::String(null()) };
+
+::hx::Class Sha256_obj::__mClass;
+
+static ::String Sha256_obj_sStaticFields[] = {
+ HX_("make",ee,39,56,48),
+ HX_("bytes2blks",d9,ce,9c,a9),
+ ::String(null())
+};
+
+void Sha256_obj::__register()
+{
+ Sha256_obj _hx_dummy;
+ Sha256_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.crypto.Sha256",cc,e1,0b,af);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Sha256_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Sha256_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Sha256_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Sha256_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Sha256_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Sha256_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
+} // end namespace crypto
diff --git a/Sources/c_snikket/src/haxe/ds/BalancedTree.cpp b/Sources/c_snikket/src/haxe/ds/BalancedTree.cpp
new file mode 100644
index 0000000..03e7628
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/ds/BalancedTree.cpp
@@ -0,0 +1,388 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_BalancedTree
+#include <haxe/ds/BalancedTree.h>
+#endif
+#ifndef INCLUDED_haxe_ds_TreeNode
+#include <haxe/ds/TreeNode.h>
+#endif
+#ifndef INCLUDED_haxe_iterators_ArrayIterator
+#include <haxe/iterators/ArrayIterator.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_84f0fad7b22fcaf3_41_new,"haxe.ds.BalancedTree","new",0xfb50b0cf,"haxe.ds.BalancedTree.new","/usr/local/lib/haxe/std/haxe/ds/BalancedTree.hx",41,0xee0b42c4)
+HX_LOCAL_STACK_FRAME(_hx_pos_84f0fad7b22fcaf3_51_set,"haxe.ds.BalancedTree","set",0xfb547c11,"haxe.ds.BalancedTree.set","/usr/local/lib/haxe/std/haxe/ds/BalancedTree.hx",51,0xee0b42c4)
+HX_LOCAL_STACK_FRAME(_hx_pos_84f0fad7b22fcaf3_61_get,"haxe.ds.BalancedTree","get",0xfb4b6105,"haxe.ds.BalancedTree.get","/usr/local/lib/haxe/std/haxe/ds/BalancedTree.hx",61,0xee0b42c4)
+HX_LOCAL_STACK_FRAME(_hx_pos_84f0fad7b22fcaf3_101_exists,"haxe.ds.BalancedTree","exists",0x238deccd,"haxe.ds.BalancedTree.exists","/usr/local/lib/haxe/std/haxe/ds/BalancedTree.hx",101,0xee0b42c4)
+HX_LOCAL_STACK_FRAME(_hx_pos_84f0fad7b22fcaf3_138_keys,"haxe.ds.BalancedTree","keys",0xe94e62a5,"haxe.ds.BalancedTree.keys","/usr/local/lib/haxe/std/haxe/ds/BalancedTree.hx",138,0xee0b42c4)
+HX_LOCAL_STACK_FRAME(_hx_pos_84f0fad7b22fcaf3_150_setLoop,"haxe.ds.BalancedTree","setLoop",0xe1a32b15,"haxe.ds.BalancedTree.setLoop","/usr/local/lib/haxe/std/haxe/ds/BalancedTree.hx",150,0xee0b42c4)
+HX_LOCAL_STACK_FRAME(_hx_pos_84f0fad7b22fcaf3_181_keysLoop,"haxe.ds.BalancedTree","keysLoop",0x20d5eba9,"haxe.ds.BalancedTree.keysLoop","/usr/local/lib/haxe/std/haxe/ds/BalancedTree.hx",181,0xee0b42c4)
+HX_LOCAL_STACK_FRAME(_hx_pos_84f0fad7b22fcaf3_205_balance,"haxe.ds.BalancedTree","balance",0xf7f4e10b,"haxe.ds.BalancedTree.balance","/usr/local/lib/haxe/std/haxe/ds/BalancedTree.hx",205,0xee0b42c4)
+HX_LOCAL_STACK_FRAME(_hx_pos_84f0fad7b22fcaf3_226_compare,"haxe.ds.BalancedTree","compare",0x57d05c94,"haxe.ds.BalancedTree.compare","/usr/local/lib/haxe/std/haxe/ds/BalancedTree.hx",226,0xee0b42c4)
+namespace haxe{
+namespace ds{
+
+void BalancedTree_obj::__construct(){
+ HX_STACKFRAME(&_hx_pos_84f0fad7b22fcaf3_41_new)
+ }
+
+Dynamic BalancedTree_obj::__CreateEmpty() { return new BalancedTree_obj; }
+
+void *BalancedTree_obj::_hx_vtable = 0;
+
+Dynamic BalancedTree_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< BalancedTree_obj > _hx_result = new BalancedTree_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool BalancedTree_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x4cc9cf7f;
+}
+
+static ::haxe::IMap_obj _hx_haxe_ds_BalancedTree__hx_haxe_IMap= {
+ ( ::Dynamic (::hx::Object::*)( ::Dynamic))&::haxe::ds::BalancedTree_obj::get,
+ ( ::Dynamic (::hx::Object::*)())&::haxe::ds::BalancedTree_obj::keys,
+};
+
+void *BalancedTree_obj::_hx_getInterface(int inHash) {
+ switch(inHash) {
+ case (int)0x09c2bd39: return &_hx_haxe_ds_BalancedTree__hx_haxe_IMap;
+ }
+ #ifdef HXCPP_SCRIPTABLE
+ return super::_hx_getInterface(inHash);
+ #else
+ return 0;
+ #endif
+}
+
+void BalancedTree_obj::set( ::Dynamic key, ::Dynamic value){
+ HX_STACKFRAME(&_hx_pos_84f0fad7b22fcaf3_51_set)
+HXDLIN( 51) this->root = this->setLoop(key,value,this->root);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(BalancedTree_obj,set,(void))
+
+ ::Dynamic BalancedTree_obj::get( ::Dynamic key){
+ HX_STACKFRAME(&_hx_pos_84f0fad7b22fcaf3_61_get)
+HXLINE( 62) ::haxe::ds::TreeNode node = this->root;
+HXLINE( 63) while(::hx::IsNotNull( node )){
+HXLINE( 64) int c = this->compare(key,node->key);
+HXLINE( 65) if ((c == 0)) {
+HXLINE( 66) return node->value;
+ }
+HXLINE( 67) if ((c < 0)) {
+HXLINE( 68) node = node->left;
+ }
+ else {
+HXLINE( 70) node = node->right;
+ }
+ }
+HXLINE( 72) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(BalancedTree_obj,get,return )
+
+bool BalancedTree_obj::exists( ::Dynamic key){
+ HX_STACKFRAME(&_hx_pos_84f0fad7b22fcaf3_101_exists)
+HXLINE( 102) ::haxe::ds::TreeNode node = this->root;
+HXLINE( 103) while(::hx::IsNotNull( node )){
+HXLINE( 104) int c = this->compare(key,node->key);
+HXLINE( 105) if ((c == 0)) {
+HXLINE( 106) return true;
+ }
+ else {
+HXLINE( 107) if ((c < 0)) {
+HXLINE( 108) node = node->left;
+ }
+ else {
+HXLINE( 110) node = node->right;
+ }
+ }
+ }
+HXLINE( 112) return false;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(BalancedTree_obj,exists,return )
+
+ ::Dynamic BalancedTree_obj::keys(){
+ HX_GC_STACKFRAME(&_hx_pos_84f0fad7b22fcaf3_138_keys)
+HXLINE( 139) ::cpp::VirtualArray ret = ::cpp::VirtualArray_obj::__new(0);
+HXLINE( 140) this->keysLoop(this->root,ret);
+HXLINE( 141) return ::haxe::iterators::ArrayIterator_obj::__alloc( HX_CTX ,ret);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(BalancedTree_obj,keys,return )
+
+ ::haxe::ds::TreeNode BalancedTree_obj::setLoop( ::Dynamic k, ::Dynamic v, ::haxe::ds::TreeNode node){
+ HX_GC_STACKFRAME(&_hx_pos_84f0fad7b22fcaf3_150_setLoop)
+HXLINE( 151) if (::hx::IsNull( node )) {
+HXLINE( 152) return ::haxe::ds::TreeNode_obj::__alloc( HX_CTX ,null(),k,v,null(),null());
+ }
+HXLINE( 153) int c = this->compare(k,node->key);
+HXLINE( 154) if ((c == 0)) {
+HXLINE( 154) int _hx_tmp;
+HXDLIN( 154) if (::hx::IsNull( node )) {
+HXLINE( 154) _hx_tmp = 0;
+ }
+ else {
+HXLINE( 154) _hx_tmp = node->_height;
+ }
+HXDLIN( 154) return ::haxe::ds::TreeNode_obj::__alloc( HX_CTX ,node->left,k,v,node->right,_hx_tmp);
+ }
+ else {
+HXLINE( 154) if ((c < 0)) {
+HXLINE( 155) ::haxe::ds::TreeNode nl = this->setLoop(k,v,node->left);
+HXLINE( 156) return this->balance(nl,node->key,node->value,node->right);
+ }
+ else {
+HXLINE( 158) ::haxe::ds::TreeNode nr = this->setLoop(k,v,node->right);
+HXLINE( 159) return this->balance(node->left,node->key,node->value,nr);
+ }
+ }
+HXLINE( 154) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(BalancedTree_obj,setLoop,return )
+
+void BalancedTree_obj::keysLoop( ::haxe::ds::TreeNode node,::cpp::VirtualArray acc){
+ HX_STACKFRAME(&_hx_pos_84f0fad7b22fcaf3_181_keysLoop)
+HXDLIN( 181) if (::hx::IsNotNull( node )) {
+HXLINE( 182) this->keysLoop(node->left,acc);
+HXLINE( 183) acc->push(node->key);
+HXLINE( 184) this->keysLoop(node->right,acc);
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(BalancedTree_obj,keysLoop,(void))
+
+ ::haxe::ds::TreeNode BalancedTree_obj::balance( ::haxe::ds::TreeNode l, ::Dynamic k, ::Dynamic v, ::haxe::ds::TreeNode r){
+ HX_GC_STACKFRAME(&_hx_pos_84f0fad7b22fcaf3_205_balance)
+HXLINE( 206) int hl;
+HXDLIN( 206) if (::hx::IsNull( l )) {
+HXLINE( 206) hl = 0;
+ }
+ else {
+HXLINE( 206) hl = l->_height;
+ }
+HXLINE( 207) int hr;
+HXDLIN( 207) if (::hx::IsNull( r )) {
+HXLINE( 207) hr = 0;
+ }
+ else {
+HXLINE( 207) hr = r->_height;
+ }
+HXLINE( 208) if ((hl > (hr + 2))) {
+HXLINE( 209) ::haxe::ds::TreeNode _this = l->left;
+HXDLIN( 209) int _hx_tmp;
+HXDLIN( 209) if (::hx::IsNull( _this )) {
+HXLINE( 209) _hx_tmp = 0;
+ }
+ else {
+HXLINE( 209) _hx_tmp = _this->_height;
+ }
+HXDLIN( 209) ::haxe::ds::TreeNode _this1 = l->right;
+HXDLIN( 209) int _hx_tmp1;
+HXDLIN( 209) if (::hx::IsNull( _this1 )) {
+HXLINE( 209) _hx_tmp1 = 0;
+ }
+ else {
+HXLINE( 209) _hx_tmp1 = _this1->_height;
+ }
+HXDLIN( 209) if ((_hx_tmp >= _hx_tmp1)) {
+HXLINE( 210) ::haxe::ds::TreeNode l1 = l->left;
+HXDLIN( 210) ::Dynamic l2 = l->key;
+HXDLIN( 210) ::Dynamic l3 = l->value;
+HXDLIN( 210) return ::haxe::ds::TreeNode_obj::__alloc( HX_CTX ,l1,l2,l3, ::haxe::ds::TreeNode_obj::__alloc( HX_CTX ,l->right,k,v,r,null()),null());
+ }
+ else {
+HXLINE( 212) ::haxe::ds::TreeNode _hx_tmp2 = ::haxe::ds::TreeNode_obj::__alloc( HX_CTX ,l->left,l->key,l->value,l->right->left,null());
+HXDLIN( 212) ::Dynamic l4 = l->right->key;
+HXDLIN( 212) ::Dynamic l5 = l->right->value;
+HXDLIN( 212) return ::haxe::ds::TreeNode_obj::__alloc( HX_CTX ,_hx_tmp2,l4,l5, ::haxe::ds::TreeNode_obj::__alloc( HX_CTX ,l->right->right,k,v,r,null()),null());
+ }
+ }
+ else {
+HXLINE( 214) if ((hr > (hl + 2))) {
+HXLINE( 215) ::haxe::ds::TreeNode _this2 = r->right;
+HXDLIN( 215) int _hx_tmp3;
+HXDLIN( 215) if (::hx::IsNull( _this2 )) {
+HXLINE( 215) _hx_tmp3 = 0;
+ }
+ else {
+HXLINE( 215) _hx_tmp3 = _this2->_height;
+ }
+HXDLIN( 215) ::haxe::ds::TreeNode _this3 = r->left;
+HXDLIN( 215) int _hx_tmp4;
+HXDLIN( 215) if (::hx::IsNull( _this3 )) {
+HXLINE( 215) _hx_tmp4 = 0;
+ }
+ else {
+HXLINE( 215) _hx_tmp4 = _this3->_height;
+ }
+HXDLIN( 215) if ((_hx_tmp3 > _hx_tmp4)) {
+HXLINE( 216) return ::haxe::ds::TreeNode_obj::__alloc( HX_CTX , ::haxe::ds::TreeNode_obj::__alloc( HX_CTX ,l,k,v,r->left,null()),r->key,r->value,r->right,null());
+ }
+ else {
+HXLINE( 218) ::haxe::ds::TreeNode _hx_tmp5 = ::haxe::ds::TreeNode_obj::__alloc( HX_CTX ,l,k,v,r->left->left,null());
+HXDLIN( 218) ::Dynamic r1 = r->left->key;
+HXDLIN( 218) ::Dynamic r2 = r->left->value;
+HXDLIN( 218) return ::haxe::ds::TreeNode_obj::__alloc( HX_CTX ,_hx_tmp5,r1,r2, ::haxe::ds::TreeNode_obj::__alloc( HX_CTX ,r->left->right,r->key,r->value,r->right,null()),null());
+ }
+ }
+ else {
+HXLINE( 221) int _hx_tmp6;
+HXDLIN( 221) if ((hl > hr)) {
+HXLINE( 221) _hx_tmp6 = hl;
+ }
+ else {
+HXLINE( 221) _hx_tmp6 = hr;
+ }
+HXDLIN( 221) return ::haxe::ds::TreeNode_obj::__alloc( HX_CTX ,l,k,v,r,(_hx_tmp6 + 1));
+ }
+ }
+HXLINE( 208) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC4(BalancedTree_obj,balance,return )
+
+int BalancedTree_obj::compare( ::Dynamic k1, ::Dynamic k2){
+ HX_STACKFRAME(&_hx_pos_84f0fad7b22fcaf3_226_compare)
+HXDLIN( 226) return ::Reflect_obj::compare(k1,k2);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(BalancedTree_obj,compare,return )
+
+
+::hx::ObjectPtr< BalancedTree_obj > BalancedTree_obj::__new() {
+ ::hx::ObjectPtr< BalancedTree_obj > __this = new BalancedTree_obj();
+ __this->__construct();
+ return __this;
+}
+
+::hx::ObjectPtr< BalancedTree_obj > BalancedTree_obj::__alloc(::hx::Ctx *_hx_ctx) {
+ BalancedTree_obj *__this = (BalancedTree_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(BalancedTree_obj), true, "haxe.ds.BalancedTree"));
+ *(void **)__this = BalancedTree_obj::_hx_vtable;
+ __this->__construct();
+ return __this;
+}
+
+BalancedTree_obj::BalancedTree_obj()
+{
+}
+
+void BalancedTree_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(BalancedTree);
+ HX_MARK_MEMBER_NAME(root,"root");
+ HX_MARK_END_CLASS();
+}
+
+void BalancedTree_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(root,"root");
+}
+
+::hx::Val BalancedTree_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"set") ) { return ::hx::Val( set_dyn() ); }
+ if (HX_FIELD_EQ(inName,"get") ) { return ::hx::Val( get_dyn() ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"root") ) { return ::hx::Val( root ); }
+ if (HX_FIELD_EQ(inName,"keys") ) { return ::hx::Val( keys_dyn() ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"exists") ) { return ::hx::Val( exists_dyn() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"setLoop") ) { return ::hx::Val( setLoop_dyn() ); }
+ if (HX_FIELD_EQ(inName,"balance") ) { return ::hx::Val( balance_dyn() ); }
+ if (HX_FIELD_EQ(inName,"compare") ) { return ::hx::Val( compare_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"keysLoop") ) { return ::hx::Val( keysLoop_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val BalancedTree_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"root") ) { root=inValue.Cast< ::haxe::ds::TreeNode >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void BalancedTree_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("root",22,ee,ae,4b));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo BalancedTree_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::haxe::ds::TreeNode */ ,(int)offsetof(BalancedTree_obj,root),HX_("root",22,ee,ae,4b)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *BalancedTree_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String BalancedTree_obj_sMemberFields[] = {
+ HX_("root",22,ee,ae,4b),
+ HX_("set",a2,9b,57,00),
+ HX_("get",96,80,4e,00),
+ HX_("exists",dc,1d,e0,bf),
+ HX_("keys",f4,e1,06,47),
+ HX_("setLoop",26,e7,3b,0d),
+ HX_("keysLoop",78,be,e1,1a),
+ HX_("balance",1c,9d,8d,23),
+ HX_("compare",a5,18,69,83),
+ ::String(null()) };
+
+::hx::Class BalancedTree_obj::__mClass;
+
+void BalancedTree_obj::__register()
+{
+ BalancedTree_obj _hx_dummy;
+ BalancedTree_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.ds.BalancedTree",5d,9d,3e,70);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(BalancedTree_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< BalancedTree_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = BalancedTree_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = BalancedTree_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
+} // end namespace ds
diff --git a/Sources/c_snikket/src/haxe/ds/Either.cpp b/Sources/c_snikket/src/haxe/ds/Either.cpp
new file mode 100644
index 0000000..d94ed1a
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/ds/Either.cpp
@@ -0,0 +1,86 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_ds_Either
+#include <haxe/ds/Either.h>
+#endif
+namespace haxe{
+namespace ds{
+
+::haxe::ds::Either Either_obj::Left( ::Dynamic v)
+{
+ return ::hx::CreateEnum< Either_obj >(HX_("Left",27,34,89,32),0,1)->_hx_init(0,v);
+}
+
+::haxe::ds::Either Either_obj::Right( ::Dynamic v)
+{
+ return ::hx::CreateEnum< Either_obj >(HX_("Right",bc,7b,91,7c),1,1)->_hx_init(0,v);
+}
+
+bool Either_obj::__GetStatic(const ::String &inName, ::Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ if (inName==HX_("Left",27,34,89,32)) { outValue = Either_obj::Left_dyn(); return true; }
+ if (inName==HX_("Right",bc,7b,91,7c)) { outValue = Either_obj::Right_dyn(); return true; }
+ return super::__GetStatic(inName, outValue, inCallProp);
+}
+
+HX_DEFINE_CREATE_ENUM(Either_obj)
+
+int Either_obj::__FindIndex(::String inName)
+{
+ if (inName==HX_("Left",27,34,89,32)) return 0;
+ if (inName==HX_("Right",bc,7b,91,7c)) return 1;
+ return super::__FindIndex(inName);
+}
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Either_obj,Left,return)
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Either_obj,Right,return)
+
+int Either_obj::__FindArgCount(::String inName)
+{
+ if (inName==HX_("Left",27,34,89,32)) return 1;
+ if (inName==HX_("Right",bc,7b,91,7c)) return 1;
+ return super::__FindArgCount(inName);
+}
+
+::hx::Val Either_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ if (inName==HX_("Left",27,34,89,32)) return Left_dyn();
+ if (inName==HX_("Right",bc,7b,91,7c)) return Right_dyn();
+ return super::__Field(inName,inCallProp);
+}
+
+static ::String Either_obj_sStaticFields[] = {
+ HX_("Left",27,34,89,32),
+ HX_("Right",bc,7b,91,7c),
+ ::String(null())
+};
+
+::hx::Class Either_obj::__mClass;
+
+Dynamic __Create_Either_obj() { return new Either_obj; }
+
+void Either_obj::__register()
+{
+
+::hx::Static(__mClass) = ::hx::_hx_RegisterClass(HX_("haxe.ds.Either",1c,1a,b7,a4), ::hx::TCanCast< Either_obj >,Either_obj_sStaticFields,0,
+ &__Create_Either_obj, &__Create,
+ &super::__SGetClass(), &CreateEither_obj, 0
+#ifdef HXCPP_VISIT_ALLOCS
+ , 0
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ , 0
+#endif
+);
+ __mClass->mGetStaticField = &Either_obj::__GetStatic;
+}
+
+void Either_obj::__boot()
+{
+}
+
+
+} // end namespace haxe
+} // end namespace ds
diff --git a/Sources/c_snikket/src/haxe/ds/EnumValueMap.cpp b/Sources/c_snikket/src/haxe/ds/EnumValueMap.cpp
new file mode 100644
index 0000000..a7dc74a
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/ds/EnumValueMap.cpp
@@ -0,0 +1,218 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_Type
+#include <Type.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_BalancedTree
+#include <haxe/ds/BalancedTree.h>
+#endif
+#ifndef INCLUDED_haxe_ds_EnumValueMap
+#include <haxe/ds/EnumValueMap.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_2be74ae4095285fe_31_new,"haxe.ds.EnumValueMap","new",0x9ce29655,"haxe.ds.EnumValueMap.new","/usr/local/lib/haxe/std/haxe/ds/EnumValueMap.hx",31,0xc570effe)
+HX_LOCAL_STACK_FRAME(_hx_pos_2be74ae4095285fe_32_compare,"haxe.ds.EnumValueMap","compare",0x806a7d1a,"haxe.ds.EnumValueMap.compare","/usr/local/lib/haxe/std/haxe/ds/EnumValueMap.hx",32,0xc570effe)
+HX_LOCAL_STACK_FRAME(_hx_pos_2be74ae4095285fe_57_compareArgs,"haxe.ds.EnumValueMap","compareArgs",0x37a5cb97,"haxe.ds.EnumValueMap.compareArgs","/usr/local/lib/haxe/std/haxe/ds/EnumValueMap.hx",57,0xc570effe)
+HX_LOCAL_STACK_FRAME(_hx_pos_2be74ae4095285fe_70_compareArg,"haxe.ds.EnumValueMap","compareArg",0xcee2e55c,"haxe.ds.EnumValueMap.compareArg","/usr/local/lib/haxe/std/haxe/ds/EnumValueMap.hx",70,0xc570effe)
+namespace haxe{
+namespace ds{
+
+void EnumValueMap_obj::__construct(){
+ HX_STACKFRAME(&_hx_pos_2be74ae4095285fe_31_new)
+HXDLIN( 31) super::__construct();
+ }
+
+Dynamic EnumValueMap_obj::__CreateEmpty() { return new EnumValueMap_obj; }
+
+void *EnumValueMap_obj::_hx_vtable = 0;
+
+Dynamic EnumValueMap_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< EnumValueMap_obj > _hx_result = new EnumValueMap_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool EnumValueMap_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x34ccfa05) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x34ccfa05;
+ } else {
+ return inClassId==(int)0x4cc9cf7f;
+ }
+}
+
+static ::haxe::IMap_obj _hx_haxe_ds_EnumValueMap__hx_haxe_IMap= {
+ ( ::Dynamic (::hx::Object::*)( ::Dynamic))&::haxe::ds::EnumValueMap_obj::get,
+ ( ::Dynamic (::hx::Object::*)())&::haxe::ds::EnumValueMap_obj::keys,
+};
+
+void *EnumValueMap_obj::_hx_getInterface(int inHash) {
+ switch(inHash) {
+ case (int)0x09c2bd39: return &_hx_haxe_ds_EnumValueMap__hx_haxe_IMap;
+ }
+ return super::_hx_getInterface(inHash);
+}
+
+int EnumValueMap_obj::compare( ::Dynamic _tmp_k1, ::Dynamic _tmp_k2){
+ HX_STACKFRAME(&_hx_pos_2be74ae4095285fe_32_compare)
+HXLINE( 33) ::Dynamic k1 = _tmp_k1;
+HXDLIN( 33) ::Dynamic k2 = _tmp_k2;
+HXDLIN( 33) int d = _hx_getEnumValueIndex(k1);
+HXDLIN( 33) int d1 = (d - _hx_getEnumValueIndex(k2));
+HXLINE( 34) if ((d1 != 0)) {
+HXLINE( 35) return d1;
+ }
+HXLINE( 49) ::cpp::VirtualArray p1 = ::Type_obj::enumParameters(k1);
+HXLINE( 50) ::cpp::VirtualArray p2 = ::Type_obj::enumParameters(k2);
+HXLINE( 51) bool _hx_tmp;
+HXDLIN( 51) if ((p1->get_length() == 0)) {
+HXLINE( 51) _hx_tmp = (p2->get_length() == 0);
+ }
+ else {
+HXLINE( 51) _hx_tmp = false;
+ }
+HXDLIN( 51) if (_hx_tmp) {
+HXLINE( 52) return 0;
+ }
+HXLINE( 53) return this->compareArgs(p1,p2);
+ }
+
+
+int EnumValueMap_obj::compareArgs(::cpp::VirtualArray a1,::cpp::VirtualArray a2){
+ HX_STACKFRAME(&_hx_pos_2be74ae4095285fe_57_compareArgs)
+HXLINE( 58) int ld = (a1->get_length() - a2->get_length());
+HXLINE( 59) if ((ld != 0)) {
+HXLINE( 60) return ld;
+ }
+HXLINE( 61) {
+HXLINE( 61) int _g = 0;
+HXDLIN( 61) int _g1 = a1->get_length();
+HXDLIN( 61) while((_g < _g1)){
+HXLINE( 61) _g = (_g + 1);
+HXDLIN( 61) int i = (_g - 1);
+HXLINE( 62) int d = this->compareArg(a1->__get(i),a2->__get(i));
+HXLINE( 63) if ((d != 0)) {
+HXLINE( 64) return d;
+ }
+ }
+ }
+HXLINE( 66) return 0;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(EnumValueMap_obj,compareArgs,return )
+
+int EnumValueMap_obj::compareArg( ::Dynamic v1, ::Dynamic v2){
+ HX_STACKFRAME(&_hx_pos_2be74ae4095285fe_70_compareArg)
+HXDLIN( 70) bool _hx_tmp;
+HXDLIN( 70) if (::Reflect_obj::isEnumValue(v1)) {
+HXDLIN( 70) _hx_tmp = ::Reflect_obj::isEnumValue(v2);
+ }
+ else {
+HXDLIN( 70) _hx_tmp = false;
+ }
+HXDLIN( 70) if (_hx_tmp) {
+HXLINE( 71) return this->compare(v1,v2);
+ }
+ else {
+HXLINE( 72) bool _hx_tmp1;
+HXDLIN( 72) if (::Std_obj::isOfType(v1,::hx::ArrayBase::__mClass)) {
+HXLINE( 72) _hx_tmp1 = ::Std_obj::isOfType(v2,::hx::ArrayBase::__mClass);
+ }
+ else {
+HXLINE( 72) _hx_tmp1 = false;
+ }
+HXDLIN( 72) if (_hx_tmp1) {
+HXLINE( 73) return this->compareArgs(( (::cpp::VirtualArray)(v1) ),( (::cpp::VirtualArray)(v2) ));
+ }
+ else {
+HXLINE( 75) return ::Reflect_obj::compare(v1,v2);
+ }
+ }
+HXLINE( 70) return 0;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(EnumValueMap_obj,compareArg,return )
+
+
+::hx::ObjectPtr< EnumValueMap_obj > EnumValueMap_obj::__new() {
+ ::hx::ObjectPtr< EnumValueMap_obj > __this = new EnumValueMap_obj();
+ __this->__construct();
+ return __this;
+}
+
+::hx::ObjectPtr< EnumValueMap_obj > EnumValueMap_obj::__alloc(::hx::Ctx *_hx_ctx) {
+ EnumValueMap_obj *__this = (EnumValueMap_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(EnumValueMap_obj), true, "haxe.ds.EnumValueMap"));
+ *(void **)__this = EnumValueMap_obj::_hx_vtable;
+ __this->__construct();
+ return __this;
+}
+
+EnumValueMap_obj::EnumValueMap_obj()
+{
+}
+
+::hx::Val EnumValueMap_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 7:
+ if (HX_FIELD_EQ(inName,"compare") ) { return ::hx::Val( compare_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"compareArg") ) { return ::hx::Val( compareArg_dyn() ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"compareArgs") ) { return ::hx::Val( compareArgs_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *EnumValueMap_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *EnumValueMap_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String EnumValueMap_obj_sMemberFields[] = {
+ HX_("compare",a5,18,69,83),
+ HX_("compareArgs",a2,88,40,b6),
+ HX_("compareArg",b1,d2,97,0e),
+ ::String(null()) };
+
+::hx::Class EnumValueMap_obj::__mClass;
+
+void EnumValueMap_obj::__register()
+{
+ EnumValueMap_obj _hx_dummy;
+ EnumValueMap_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.ds.EnumValueMap",e3,c7,41,58);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(EnumValueMap_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< EnumValueMap_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = EnumValueMap_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = EnumValueMap_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
+} // end namespace ds
diff --git a/Sources/c_snikket/src/haxe/ds/IntMap.cpp b/Sources/c_snikket/src/haxe/ds/IntMap.cpp
new file mode 100644
index 0000000..53efbe1
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/ds/IntMap.cpp
@@ -0,0 +1,199 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_IntMap
+#include <haxe/ds/IntMap.h>
+#endif
+#ifndef INCLUDED_haxe_iterators_ArrayIterator
+#include <haxe/iterators/ArrayIterator.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_51ea85db291dbdd4_60_new,"haxe.ds.IntMap","new",0x7222c4b6,"haxe.ds.IntMap.new","/usr/local/lib/haxe/std/cpp/_std/haxe/ds/IntMap.hx",60,0xc8b34118)
+HX_LOCAL_STACK_FRAME(_hx_pos_51ea85db291dbdd4_63_set,"haxe.ds.IntMap","set",0x72268ff8,"haxe.ds.IntMap.set","/usr/local/lib/haxe/std/cpp/_std/haxe/ds/IntMap.hx",63,0xc8b34118)
+HX_LOCAL_STACK_FRAME(_hx_pos_51ea85db291dbdd4_67_get,"haxe.ds.IntMap","get",0x721d74ec,"haxe.ds.IntMap.get","/usr/local/lib/haxe/std/cpp/_std/haxe/ds/IntMap.hx",67,0xc8b34118)
+HX_LOCAL_STACK_FRAME(_hx_pos_51ea85db291dbdd4_75_remove,"haxe.ds.IntMap","remove",0xa86281ae,"haxe.ds.IntMap.remove","/usr/local/lib/haxe/std/cpp/_std/haxe/ds/IntMap.hx",75,0xc8b34118)
+HX_LOCAL_STACK_FRAME(_hx_pos_51ea85db291dbdd4_78_keys,"haxe.ds.IntMap","keys",0x6a4db8de,"haxe.ds.IntMap.keys","/usr/local/lib/haxe/std/cpp/_std/haxe/ds/IntMap.hx",78,0xc8b34118)
+namespace haxe{
+namespace ds{
+
+void IntMap_obj::__construct(){
+ HX_STACKFRAME(&_hx_pos_51ea85db291dbdd4_60_new)
+ }
+
+Dynamic IntMap_obj::__CreateEmpty() { return new IntMap_obj; }
+
+void *IntMap_obj::_hx_vtable = 0;
+
+Dynamic IntMap_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< IntMap_obj > _hx_result = new IntMap_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool IntMap_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x269a1502;
+}
+
+static ::haxe::IMap_obj _hx_haxe_ds_IntMap__hx_haxe_IMap= {
+ ( ::Dynamic (::hx::Object::*)( ::Dynamic))&::haxe::ds::IntMap_obj::get_a7a2487a,
+ ( ::Dynamic (::hx::Object::*)())&::haxe::ds::IntMap_obj::keys,
+};
+
+ ::Dynamic IntMap_obj::get_a7a2487a( ::Dynamic k) {
+ return get(k);
+}
+void *IntMap_obj::_hx_getInterface(int inHash) {
+ switch(inHash) {
+ case (int)0x09c2bd39: return &_hx_haxe_ds_IntMap__hx_haxe_IMap;
+ }
+ #ifdef HXCPP_SCRIPTABLE
+ return super::_hx_getInterface(inHash);
+ #else
+ return 0;
+ #endif
+}
+
+void IntMap_obj::set(int key, ::Dynamic value){
+ HX_STACKFRAME(&_hx_pos_51ea85db291dbdd4_63_set)
+HXDLIN( 63) ::__int_hash_set(HX_MAP_THIS,key,value);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(IntMap_obj,set,(void))
+
+ ::Dynamic IntMap_obj::get(int key){
+ HX_STACKFRAME(&_hx_pos_51ea85db291dbdd4_67_get)
+HXDLIN( 67) return ::__int_hash_get(this->h,key);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(IntMap_obj,get,return )
+
+bool IntMap_obj::remove(int key){
+ HX_STACKFRAME(&_hx_pos_51ea85db291dbdd4_75_remove)
+HXDLIN( 75) return ::__int_hash_remove(this->h,key);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(IntMap_obj,remove,return )
+
+ ::Dynamic IntMap_obj::keys(){
+ HX_GC_STACKFRAME(&_hx_pos_51ea85db291dbdd4_78_keys)
+HXLINE( 79) ::Array< int > a = ::__int_hash_keys(this->h);
+HXLINE( 80) return ::haxe::iterators::ArrayIterator_obj::__alloc( HX_CTX ,a);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(IntMap_obj,keys,return )
+
+
+::hx::ObjectPtr< IntMap_obj > IntMap_obj::__new() {
+ ::hx::ObjectPtr< IntMap_obj > __this = new IntMap_obj();
+ __this->__construct();
+ return __this;
+}
+
+::hx::ObjectPtr< IntMap_obj > IntMap_obj::__alloc(::hx::Ctx *_hx_ctx) {
+ IntMap_obj *__this = (IntMap_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(IntMap_obj), true, "haxe.ds.IntMap"));
+ *(void **)__this = IntMap_obj::_hx_vtable;
+ __this->__construct();
+ return __this;
+}
+
+IntMap_obj::IntMap_obj()
+{
+}
+
+void IntMap_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(IntMap);
+ HX_MARK_MEMBER_NAME(h,"h");
+ HX_MARK_END_CLASS();
+}
+
+void IntMap_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(h,"h");
+}
+
+::hx::Val IntMap_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 1:
+ if (HX_FIELD_EQ(inName,"h") ) { return ::hx::Val( h ); }
+ break;
+ case 3:
+ if (HX_FIELD_EQ(inName,"set") ) { return ::hx::Val( set_dyn() ); }
+ if (HX_FIELD_EQ(inName,"get") ) { return ::hx::Val( get_dyn() ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"keys") ) { return ::hx::Val( keys_dyn() ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"remove") ) { return ::hx::Val( remove_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val IntMap_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 1:
+ if (HX_FIELD_EQ(inName,"h") ) { h=inValue.Cast< ::Dynamic >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void IntMap_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("h",68,00,00,00));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo IntMap_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(IntMap_obj,h),HX_("h",68,00,00,00)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *IntMap_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String IntMap_obj_sMemberFields[] = {
+ HX_("h",68,00,00,00),
+ HX_("set",a2,9b,57,00),
+ HX_("get",96,80,4e,00),
+ HX_("remove",44,9c,88,04),
+ HX_("keys",f4,e1,06,47),
+ ::String(null()) };
+
+::hx::Class IntMap_obj::__mClass;
+
+void IntMap_obj::__register()
+{
+ IntMap_obj _hx_dummy;
+ IntMap_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.ds.IntMap",c4,f1,10,1f);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(IntMap_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< IntMap_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = IntMap_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = IntMap_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
+} // end namespace ds
diff --git a/Sources/c_snikket/src/haxe/ds/List.cpp b/Sources/c_snikket/src/haxe/ds/List.cpp
new file mode 100644
index 0000000..a286030
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/ds/List.cpp
@@ -0,0 +1,185 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_ds_List
+#include <haxe/ds/List.h>
+#endif
+#ifndef INCLUDED_haxe_ds__List_ListNode
+#include <haxe/ds/_List/ListNode.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_28668287f4db9634_45_new,"haxe.ds.List","new",0x82be24e7,"haxe.ds.List.new","/usr/local/lib/haxe/std/haxe/ds/List.hx",45,0x54f95eac)
+HX_LOCAL_STACK_FRAME(_hx_pos_28668287f4db9634_68_push,"haxe.ds.List","push",0xe500b373,"haxe.ds.List.push","/usr/local/lib/haxe/std/haxe/ds/List.hx",68,0x54f95eac)
+HX_LOCAL_STACK_FRAME(_hx_pos_28668287f4db9634_99_pop,"haxe.ds.List","pop",0x82bfb218,"haxe.ds.List.pop","/usr/local/lib/haxe/std/haxe/ds/List.hx",99,0x54f95eac)
+namespace haxe{
+namespace ds{
+
+void List_obj::__construct(){
+ HX_STACKFRAME(&_hx_pos_28668287f4db9634_45_new)
+HXDLIN( 45) this->length = 0;
+ }
+
+Dynamic List_obj::__CreateEmpty() { return new List_obj; }
+
+void *List_obj::_hx_vtable = 0;
+
+Dynamic List_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< List_obj > _hx_result = new List_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool List_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x39a75d33;
+}
+
+void List_obj::push( ::Dynamic item){
+ HX_GC_STACKFRAME(&_hx_pos_28668287f4db9634_68_push)
+HXLINE( 69) ::haxe::ds::_List::ListNode x = ::haxe::ds::_List::ListNode_obj::__alloc( HX_CTX ,item,this->h);
+HXLINE( 70) this->h = x;
+HXLINE( 71) if (::hx::IsNull( this->q )) {
+HXLINE( 72) this->q = x;
+ }
+HXLINE( 73) this->length++;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(List_obj,push,(void))
+
+ ::Dynamic List_obj::pop(){
+ HX_STACKFRAME(&_hx_pos_28668287f4db9634_99_pop)
+HXLINE( 100) if (::hx::IsNull( this->h )) {
+HXLINE( 101) return null();
+ }
+HXLINE( 102) ::Dynamic x = this->h->item;
+HXLINE( 103) this->h = this->h->next;
+HXLINE( 104) if (::hx::IsNull( this->h )) {
+HXLINE( 105) this->q = null();
+ }
+HXLINE( 106) this->length--;
+HXLINE( 107) return x;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(List_obj,pop,return )
+
+
+::hx::ObjectPtr< List_obj > List_obj::__new() {
+ ::hx::ObjectPtr< List_obj > __this = new List_obj();
+ __this->__construct();
+ return __this;
+}
+
+::hx::ObjectPtr< List_obj > List_obj::__alloc(::hx::Ctx *_hx_ctx) {
+ List_obj *__this = (List_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(List_obj), true, "haxe.ds.List"));
+ *(void **)__this = List_obj::_hx_vtable;
+ __this->__construct();
+ return __this;
+}
+
+List_obj::List_obj()
+{
+}
+
+void List_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(List);
+ HX_MARK_MEMBER_NAME(h,"h");
+ HX_MARK_MEMBER_NAME(q,"q");
+ HX_MARK_MEMBER_NAME(length,"length");
+ HX_MARK_END_CLASS();
+}
+
+void List_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(h,"h");
+ HX_VISIT_MEMBER_NAME(q,"q");
+ HX_VISIT_MEMBER_NAME(length,"length");
+}
+
+::hx::Val List_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 1:
+ if (HX_FIELD_EQ(inName,"h") ) { return ::hx::Val( h ); }
+ if (HX_FIELD_EQ(inName,"q") ) { return ::hx::Val( q ); }
+ break;
+ case 3:
+ if (HX_FIELD_EQ(inName,"pop") ) { return ::hx::Val( pop_dyn() ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"push") ) { return ::hx::Val( push_dyn() ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"length") ) { return ::hx::Val( length ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val List_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 1:
+ if (HX_FIELD_EQ(inName,"h") ) { h=inValue.Cast< ::haxe::ds::_List::ListNode >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"q") ) { q=inValue.Cast< ::haxe::ds::_List::ListNode >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"length") ) { length=inValue.Cast< int >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void List_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("h",68,00,00,00));
+ outFields->push(HX_("q",71,00,00,00));
+ outFields->push(HX_("length",e6,94,07,9f));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo List_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::haxe::ds::_List::ListNode */ ,(int)offsetof(List_obj,h),HX_("h",68,00,00,00)},
+ {::hx::fsObject /* ::haxe::ds::_List::ListNode */ ,(int)offsetof(List_obj,q),HX_("q",71,00,00,00)},
+ {::hx::fsInt,(int)offsetof(List_obj,length),HX_("length",e6,94,07,9f)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *List_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String List_obj_sMemberFields[] = {
+ HX_("h",68,00,00,00),
+ HX_("q",71,00,00,00),
+ HX_("length",e6,94,07,9f),
+ HX_("push",da,11,61,4a),
+ HX_("pop",91,5d,55,00),
+ ::String(null()) };
+
+::hx::Class List_obj::__mClass;
+
+void List_obj::__register()
+{
+ List_obj _hx_dummy;
+ List_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.ds.List",75,25,aa,15);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(List_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< List_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = List_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = List_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
+} // end namespace ds
diff --git a/Sources/c_snikket/src/haxe/ds/ObjectMap.cpp b/Sources/c_snikket/src/haxe/ds/ObjectMap.cpp
new file mode 100644
index 0000000..0483f59
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/ds/ObjectMap.cpp
@@ -0,0 +1,183 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_ObjectMap
+#include <haxe/ds/ObjectMap.h>
+#endif
+#ifndef INCLUDED_haxe_iterators_ArrayIterator
+#include <haxe/iterators/ArrayIterator.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_d1a78e92de9dff66_59_new,"haxe.ds.ObjectMap","new",0x27af5498,"haxe.ds.ObjectMap.new","/usr/local/lib/haxe/std/cpp/_std/haxe/ds/ObjectMap.hx",59,0xa4879efa)
+HX_LOCAL_STACK_FRAME(_hx_pos_d1a78e92de9dff66_62_set,"haxe.ds.ObjectMap","set",0x27b31fda,"haxe.ds.ObjectMap.set","/usr/local/lib/haxe/std/cpp/_std/haxe/ds/ObjectMap.hx",62,0xa4879efa)
+HX_LOCAL_STACK_FRAME(_hx_pos_d1a78e92de9dff66_66_get,"haxe.ds.ObjectMap","get",0x27aa04ce,"haxe.ds.ObjectMap.get","/usr/local/lib/haxe/std/cpp/_std/haxe/ds/ObjectMap.hx",66,0xa4879efa)
+HX_LOCAL_STACK_FRAME(_hx_pos_d1a78e92de9dff66_77_keys,"haxe.ds.ObjectMap","keys",0x8fbf0ebc,"haxe.ds.ObjectMap.keys","/usr/local/lib/haxe/std/cpp/_std/haxe/ds/ObjectMap.hx",77,0xa4879efa)
+namespace haxe{
+namespace ds{
+
+void ObjectMap_obj::__construct(){
+ HX_STACKFRAME(&_hx_pos_d1a78e92de9dff66_59_new)
+ }
+
+Dynamic ObjectMap_obj::__CreateEmpty() { return new ObjectMap_obj; }
+
+void *ObjectMap_obj::_hx_vtable = 0;
+
+Dynamic ObjectMap_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< ObjectMap_obj > _hx_result = new ObjectMap_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool ObjectMap_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x6cba6d44;
+}
+
+static ::haxe::IMap_obj _hx_haxe_ds_ObjectMap__hx_haxe_IMap= {
+ ( ::Dynamic (::hx::Object::*)( ::Dynamic))&::haxe::ds::ObjectMap_obj::get,
+ ( ::Dynamic (::hx::Object::*)())&::haxe::ds::ObjectMap_obj::keys,
+};
+
+void *ObjectMap_obj::_hx_getInterface(int inHash) {
+ switch(inHash) {
+ case (int)0x09c2bd39: return &_hx_haxe_ds_ObjectMap__hx_haxe_IMap;
+ }
+ #ifdef HXCPP_SCRIPTABLE
+ return super::_hx_getInterface(inHash);
+ #else
+ return 0;
+ #endif
+}
+
+void ObjectMap_obj::set( ::Dynamic key, ::Dynamic value){
+ HX_STACKFRAME(&_hx_pos_d1a78e92de9dff66_62_set)
+HXDLIN( 62) ::__object_hash_set(HX_MAP_THIS,key,value);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(ObjectMap_obj,set,(void))
+
+ ::Dynamic ObjectMap_obj::get( ::Dynamic key){
+ HX_STACKFRAME(&_hx_pos_d1a78e92de9dff66_66_get)
+HXDLIN( 66) return ::__object_hash_get(this->h,key);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(ObjectMap_obj,get,return )
+
+ ::Dynamic ObjectMap_obj::keys(){
+ HX_GC_STACKFRAME(&_hx_pos_d1a78e92de9dff66_77_keys)
+HXLINE( 78) ::cpp::VirtualArray a = ::__object_hash_keys(this->h);
+HXLINE( 79) return ::haxe::iterators::ArrayIterator_obj::__alloc( HX_CTX ,a);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ObjectMap_obj,keys,return )
+
+
+::hx::ObjectPtr< ObjectMap_obj > ObjectMap_obj::__new() {
+ ::hx::ObjectPtr< ObjectMap_obj > __this = new ObjectMap_obj();
+ __this->__construct();
+ return __this;
+}
+
+::hx::ObjectPtr< ObjectMap_obj > ObjectMap_obj::__alloc(::hx::Ctx *_hx_ctx) {
+ ObjectMap_obj *__this = (ObjectMap_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(ObjectMap_obj), true, "haxe.ds.ObjectMap"));
+ *(void **)__this = ObjectMap_obj::_hx_vtable;
+ __this->__construct();
+ return __this;
+}
+
+ObjectMap_obj::ObjectMap_obj()
+{
+}
+
+void ObjectMap_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(ObjectMap);
+ HX_MARK_MEMBER_NAME(h,"h");
+ HX_MARK_END_CLASS();
+}
+
+void ObjectMap_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(h,"h");
+}
+
+::hx::Val ObjectMap_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 1:
+ if (HX_FIELD_EQ(inName,"h") ) { return ::hx::Val( h ); }
+ break;
+ case 3:
+ if (HX_FIELD_EQ(inName,"set") ) { return ::hx::Val( set_dyn() ); }
+ if (HX_FIELD_EQ(inName,"get") ) { return ::hx::Val( get_dyn() ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"keys") ) { return ::hx::Val( keys_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val ObjectMap_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 1:
+ if (HX_FIELD_EQ(inName,"h") ) { h=inValue.Cast< ::Dynamic >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void ObjectMap_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("h",68,00,00,00));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo ObjectMap_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(ObjectMap_obj,h),HX_("h",68,00,00,00)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *ObjectMap_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String ObjectMap_obj_sMemberFields[] = {
+ HX_("h",68,00,00,00),
+ HX_("set",a2,9b,57,00),
+ HX_("get",96,80,4e,00),
+ HX_("keys",f4,e1,06,47),
+ ::String(null()) };
+
+::hx::Class ObjectMap_obj::__mClass;
+
+void ObjectMap_obj::__register()
+{
+ ObjectMap_obj _hx_dummy;
+ ObjectMap_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.ds.ObjectMap",a6,68,9b,de);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(ObjectMap_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< ObjectMap_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = ObjectMap_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = ObjectMap_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
+} // end namespace ds
diff --git a/Sources/c_snikket/src/haxe/ds/Option.cpp b/Sources/c_snikket/src/haxe/ds/Option.cpp
new file mode 100644
index 0000000..116d140
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/ds/Option.cpp
@@ -0,0 +1,82 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_ds_Option
+#include <haxe/ds/Option.h>
+#endif
+namespace haxe{
+namespace ds{
+
+::haxe::ds::Option Option_obj::None;
+
+::haxe::ds::Option Option_obj::Some( ::Dynamic v)
+{
+ return ::hx::CreateEnum< Option_obj >(HX_("Some",14,4f,31,37),0,1)->_hx_init(0,v);
+}
+
+bool Option_obj::__GetStatic(const ::String &inName, ::Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ if (inName==HX_("None",d8,3e,e3,33)) { outValue = Option_obj::None; return true; }
+ if (inName==HX_("Some",14,4f,31,37)) { outValue = Option_obj::Some_dyn(); return true; }
+ return super::__GetStatic(inName, outValue, inCallProp);
+}
+
+HX_DEFINE_CREATE_ENUM(Option_obj)
+
+int Option_obj::__FindIndex(::String inName)
+{
+ if (inName==HX_("None",d8,3e,e3,33)) return 1;
+ if (inName==HX_("Some",14,4f,31,37)) return 0;
+ return super::__FindIndex(inName);
+}
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Option_obj,Some,return)
+
+int Option_obj::__FindArgCount(::String inName)
+{
+ if (inName==HX_("None",d8,3e,e3,33)) return 0;
+ if (inName==HX_("Some",14,4f,31,37)) return 1;
+ return super::__FindArgCount(inName);
+}
+
+::hx::Val Option_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ if (inName==HX_("None",d8,3e,e3,33)) return None;
+ if (inName==HX_("Some",14,4f,31,37)) return Some_dyn();
+ return super::__Field(inName,inCallProp);
+}
+
+static ::String Option_obj_sStaticFields[] = {
+ HX_("Some",14,4f,31,37),
+ HX_("None",d8,3e,e3,33),
+ ::String(null())
+};
+
+::hx::Class Option_obj::__mClass;
+
+Dynamic __Create_Option_obj() { return new Option_obj; }
+
+void Option_obj::__register()
+{
+
+::hx::Static(__mClass) = ::hx::_hx_RegisterClass(HX_("haxe.ds.Option",4c,90,17,ac), ::hx::TCanCast< Option_obj >,Option_obj_sStaticFields,0,
+ &__Create_Option_obj, &__Create,
+ &super::__SGetClass(), &CreateOption_obj, 0
+#ifdef HXCPP_VISIT_ALLOCS
+ , 0
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ , 0
+#endif
+);
+ __mClass->mGetStaticField = &Option_obj::__GetStatic;
+}
+
+void Option_obj::__boot()
+{
+None = ::hx::CreateConstEnum< Option_obj >(HX_("None",d8,3e,e3,33),1);
+}
+
+
+} // end namespace haxe
+} // end namespace ds
diff --git a/Sources/c_snikket/src/haxe/ds/StringMap.cpp b/Sources/c_snikket/src/haxe/ds/StringMap.cpp
new file mode 100644
index 0000000..0a68889
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/ds/StringMap.cpp
@@ -0,0 +1,237 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_StringMap
+#include <haxe/ds/StringMap.h>
+#endif
+#ifndef INCLUDED_haxe_iterators_ArrayIterator
+#include <haxe/iterators/ArrayIterator.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_8577865ab46301b9_60_new,"haxe.ds.StringMap","new",0x0f13f0c6,"haxe.ds.StringMap.new","/usr/local/lib/haxe/std/cpp/_std/haxe/ds/StringMap.hx",60,0x61d6228c)
+HX_LOCAL_STACK_FRAME(_hx_pos_8577865ab46301b9_63_set,"haxe.ds.StringMap","set",0x0f17bc08,"haxe.ds.StringMap.set","/usr/local/lib/haxe/std/cpp/_std/haxe/ds/StringMap.hx",63,0x61d6228c)
+HX_LOCAL_STACK_FRAME(_hx_pos_8577865ab46301b9_67_get,"haxe.ds.StringMap","get",0x0f0ea0fc,"haxe.ds.StringMap.get","/usr/local/lib/haxe/std/cpp/_std/haxe/ds/StringMap.hx",67,0x61d6228c)
+HX_LOCAL_STACK_FRAME(_hx_pos_8577865ab46301b9_71_exists,"haxe.ds.StringMap","exists",0xd35fc136,"haxe.ds.StringMap.exists","/usr/local/lib/haxe/std/cpp/_std/haxe/ds/StringMap.hx",71,0x61d6228c)
+HX_LOCAL_STACK_FRAME(_hx_pos_8577865ab46301b9_75_remove,"haxe.ds.StringMap","remove",0x18083f9e,"haxe.ds.StringMap.remove","/usr/local/lib/haxe/std/cpp/_std/haxe/ds/StringMap.hx",75,0x61d6228c)
+HX_LOCAL_STACK_FRAME(_hx_pos_8577865ab46301b9_78_keys,"haxe.ds.StringMap","keys",0x20631ace,"haxe.ds.StringMap.keys","/usr/local/lib/haxe/std/cpp/_std/haxe/ds/StringMap.hx",78,0x61d6228c)
+HX_LOCAL_STACK_FRAME(_hx_pos_8577865ab46301b9_83_iterator,"haxe.ds.StringMap","iterator",0x40ccf7c8,"haxe.ds.StringMap.iterator","/usr/local/lib/haxe/std/cpp/_std/haxe/ds/StringMap.hx",83,0x61d6228c)
+HX_LOCAL_STACK_FRAME(_hx_pos_8577865ab46301b9_105_clear,"haxe.ds.StringMap","clear",0x9fb0f773,"haxe.ds.StringMap.clear","/usr/local/lib/haxe/std/cpp/_std/haxe/ds/StringMap.hx",105,0x61d6228c)
+namespace haxe{
+namespace ds{
+
+void StringMap_obj::__construct(){
+ HX_STACKFRAME(&_hx_pos_8577865ab46301b9_60_new)
+ }
+
+Dynamic StringMap_obj::__CreateEmpty() { return new StringMap_obj; }
+
+void *StringMap_obj::_hx_vtable = 0;
+
+Dynamic StringMap_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< StringMap_obj > _hx_result = new StringMap_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool StringMap_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x4260cd56;
+}
+
+static ::haxe::IMap_obj _hx_haxe_ds_StringMap__hx_haxe_IMap= {
+ ( ::Dynamic (::hx::Object::*)( ::Dynamic))&::haxe::ds::StringMap_obj::get_a7a2487a,
+ ( ::Dynamic (::hx::Object::*)())&::haxe::ds::StringMap_obj::keys,
+};
+
+ ::Dynamic StringMap_obj::get_a7a2487a( ::Dynamic k) {
+ return get(k);
+}
+void *StringMap_obj::_hx_getInterface(int inHash) {
+ switch(inHash) {
+ case (int)0x09c2bd39: return &_hx_haxe_ds_StringMap__hx_haxe_IMap;
+ }
+ #ifdef HXCPP_SCRIPTABLE
+ return super::_hx_getInterface(inHash);
+ #else
+ return 0;
+ #endif
+}
+
+void StringMap_obj::set(::String key, ::Dynamic value){
+ HX_STACKFRAME(&_hx_pos_8577865ab46301b9_63_set)
+HXDLIN( 63) ::__string_hash_set(HX_MAP_THIS,key,value);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(StringMap_obj,set,(void))
+
+ ::Dynamic StringMap_obj::get(::String key){
+ HX_STACKFRAME(&_hx_pos_8577865ab46301b9_67_get)
+HXDLIN( 67) return ::__string_hash_get(this->h,key);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(StringMap_obj,get,return )
+
+bool StringMap_obj::exists(::String key){
+ HX_STACKFRAME(&_hx_pos_8577865ab46301b9_71_exists)
+HXDLIN( 71) return ::__string_hash_exists(this->h,key);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(StringMap_obj,exists,return )
+
+bool StringMap_obj::remove(::String key){
+ HX_STACKFRAME(&_hx_pos_8577865ab46301b9_75_remove)
+HXDLIN( 75) return ::__string_hash_remove(this->h,key);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(StringMap_obj,remove,return )
+
+ ::Dynamic StringMap_obj::keys(){
+ HX_GC_STACKFRAME(&_hx_pos_8577865ab46301b9_78_keys)
+HXLINE( 79) ::Array< ::String > a = ::__string_hash_keys(this->h);
+HXLINE( 80) return ::haxe::iterators::ArrayIterator_obj::__alloc( HX_CTX ,a);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(StringMap_obj,keys,return )
+
+ ::Dynamic StringMap_obj::iterator(){
+ HX_GC_STACKFRAME(&_hx_pos_8577865ab46301b9_83_iterator)
+HXLINE( 84) ::cpp::VirtualArray a = ::__string_hash_values(this->h);
+HXLINE( 85) return ::haxe::iterators::ArrayIterator_obj::__alloc( HX_CTX ,a);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(StringMap_obj,iterator,return )
+
+void StringMap_obj::clear(){
+ HX_STACKFRAME(&_hx_pos_8577865ab46301b9_105_clear)
+HXDLIN( 105) ::__string_hash_clear(this->h);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(StringMap_obj,clear,(void))
+
+
+::hx::ObjectPtr< StringMap_obj > StringMap_obj::__new() {
+ ::hx::ObjectPtr< StringMap_obj > __this = new StringMap_obj();
+ __this->__construct();
+ return __this;
+}
+
+::hx::ObjectPtr< StringMap_obj > StringMap_obj::__alloc(::hx::Ctx *_hx_ctx) {
+ StringMap_obj *__this = (StringMap_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(StringMap_obj), true, "haxe.ds.StringMap"));
+ *(void **)__this = StringMap_obj::_hx_vtable;
+ __this->__construct();
+ return __this;
+}
+
+StringMap_obj::StringMap_obj()
+{
+}
+
+void StringMap_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(StringMap);
+ HX_MARK_MEMBER_NAME(h,"h");
+ HX_MARK_END_CLASS();
+}
+
+void StringMap_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(h,"h");
+}
+
+::hx::Val StringMap_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 1:
+ if (HX_FIELD_EQ(inName,"h") ) { return ::hx::Val( h ); }
+ break;
+ case 3:
+ if (HX_FIELD_EQ(inName,"set") ) { return ::hx::Val( set_dyn() ); }
+ if (HX_FIELD_EQ(inName,"get") ) { return ::hx::Val( get_dyn() ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"keys") ) { return ::hx::Val( keys_dyn() ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"clear") ) { return ::hx::Val( clear_dyn() ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"exists") ) { return ::hx::Val( exists_dyn() ); }
+ if (HX_FIELD_EQ(inName,"remove") ) { return ::hx::Val( remove_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"iterator") ) { return ::hx::Val( iterator_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val StringMap_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 1:
+ if (HX_FIELD_EQ(inName,"h") ) { h=inValue.Cast< ::Dynamic >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void StringMap_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("h",68,00,00,00));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo StringMap_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(StringMap_obj,h),HX_("h",68,00,00,00)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *StringMap_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String StringMap_obj_sMemberFields[] = {
+ HX_("h",68,00,00,00),
+ HX_("set",a2,9b,57,00),
+ HX_("get",96,80,4e,00),
+ HX_("exists",dc,1d,e0,bf),
+ HX_("remove",44,9c,88,04),
+ HX_("keys",f4,e1,06,47),
+ HX_("iterator",ee,49,9a,93),
+ HX_("clear",8d,71,5b,48),
+ ::String(null()) };
+
+::hx::Class StringMap_obj::__mClass;
+
+void StringMap_obj::__register()
+{
+ StringMap_obj _hx_dummy;
+ StringMap_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.ds.StringMap",d4,d5,d6,62);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(StringMap_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< StringMap_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = StringMap_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = StringMap_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
+} // end namespace ds
diff --git a/Sources/c_snikket/src/haxe/ds/TreeNode.cpp b/Sources/c_snikket/src/haxe/ds/TreeNode.cpp
new file mode 100644
index 0000000..9605420
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/ds/TreeNode.cpp
@@ -0,0 +1,196 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_ds_TreeNode
+#include <haxe/ds/TreeNode.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_bd32df1abf02b23a_252_new,"haxe.ds.TreeNode","new",0x88d32f89,"haxe.ds.TreeNode.new","/usr/local/lib/haxe/std/haxe/ds/BalancedTree.hx",252,0xee0b42c4)
+namespace haxe{
+namespace ds{
+
+void TreeNode_obj::__construct( ::haxe::ds::TreeNode l, ::Dynamic k, ::Dynamic v, ::haxe::ds::TreeNode r,::hx::Null< int > __o_h){
+ int h = __o_h.Default(-1);
+ HX_STACKFRAME(&_hx_pos_bd32df1abf02b23a_252_new)
+HXLINE( 253) this->left = l;
+HXLINE( 254) this->key = k;
+HXLINE( 255) this->value = v;
+HXLINE( 256) this->right = r;
+HXLINE( 257) if ((h == -1)) {
+HXLINE( 258) int _hx_tmp;
+HXDLIN( 258) ::haxe::ds::TreeNode _this = this->left;
+HXDLIN( 258) int _hx_tmp1;
+HXDLIN( 258) if (::hx::IsNull( _this )) {
+HXLINE( 258) _hx_tmp1 = 0;
+ }
+ else {
+HXLINE( 258) _hx_tmp1 = _this->_height;
+ }
+HXDLIN( 258) ::haxe::ds::TreeNode _this1 = this->right;
+HXDLIN( 258) int _hx_tmp2;
+HXDLIN( 258) if (::hx::IsNull( _this1 )) {
+HXLINE( 258) _hx_tmp2 = 0;
+ }
+ else {
+HXLINE( 258) _hx_tmp2 = _this1->_height;
+ }
+HXDLIN( 258) if ((_hx_tmp1 > _hx_tmp2)) {
+HXLINE( 258) ::haxe::ds::TreeNode _this2 = this->left;
+HXDLIN( 258) if (::hx::IsNull( _this2 )) {
+HXLINE( 258) _hx_tmp = 0;
+ }
+ else {
+HXLINE( 258) _hx_tmp = _this2->_height;
+ }
+ }
+ else {
+HXLINE( 258) ::haxe::ds::TreeNode _this3 = this->right;
+HXDLIN( 258) if (::hx::IsNull( _this3 )) {
+HXLINE( 258) _hx_tmp = 0;
+ }
+ else {
+HXLINE( 258) _hx_tmp = _this3->_height;
+ }
+ }
+HXDLIN( 258) this->_height = (_hx_tmp + 1);
+ }
+ else {
+HXLINE( 260) this->_height = h;
+ }
+ }
+
+Dynamic TreeNode_obj::__CreateEmpty() { return new TreeNode_obj; }
+
+void *TreeNode_obj::_hx_vtable = 0;
+
+Dynamic TreeNode_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< TreeNode_obj > _hx_result = new TreeNode_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4]);
+ return _hx_result;
+}
+
+bool TreeNode_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x723fa5d5;
+}
+
+
+TreeNode_obj::TreeNode_obj()
+{
+}
+
+void TreeNode_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(TreeNode);
+ HX_MARK_MEMBER_NAME(left,"left");
+ HX_MARK_MEMBER_NAME(right,"right");
+ HX_MARK_MEMBER_NAME(key,"key");
+ HX_MARK_MEMBER_NAME(value,"value");
+ HX_MARK_MEMBER_NAME(_height,"_height");
+ HX_MARK_END_CLASS();
+}
+
+void TreeNode_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(left,"left");
+ HX_VISIT_MEMBER_NAME(right,"right");
+ HX_VISIT_MEMBER_NAME(key,"key");
+ HX_VISIT_MEMBER_NAME(value,"value");
+ HX_VISIT_MEMBER_NAME(_height,"_height");
+}
+
+::hx::Val TreeNode_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"key") ) { return ::hx::Val( key ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"left") ) { return ::hx::Val( left ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"right") ) { return ::hx::Val( right ); }
+ if (HX_FIELD_EQ(inName,"value") ) { return ::hx::Val( value ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"_height") ) { return ::hx::Val( _height ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val TreeNode_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"key") ) { key=inValue.Cast< ::Dynamic >(); return inValue; }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"left") ) { left=inValue.Cast< ::haxe::ds::TreeNode >(); return inValue; }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"right") ) { right=inValue.Cast< ::haxe::ds::TreeNode >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"value") ) { value=inValue.Cast< ::Dynamic >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"_height") ) { _height=inValue.Cast< int >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void TreeNode_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("left",07,08,b0,47));
+ outFields->push(HX_("right",dc,0b,64,e9));
+ outFields->push(HX_("key",9f,89,51,00));
+ outFields->push(HX_("value",71,7f,b8,31));
+ outFields->push(HX_("_height",86,19,c3,70));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo TreeNode_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::haxe::ds::TreeNode */ ,(int)offsetof(TreeNode_obj,left),HX_("left",07,08,b0,47)},
+ {::hx::fsObject /* ::haxe::ds::TreeNode */ ,(int)offsetof(TreeNode_obj,right),HX_("right",dc,0b,64,e9)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(TreeNode_obj,key),HX_("key",9f,89,51,00)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(TreeNode_obj,value),HX_("value",71,7f,b8,31)},
+ {::hx::fsInt,(int)offsetof(TreeNode_obj,_height),HX_("_height",86,19,c3,70)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *TreeNode_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String TreeNode_obj_sMemberFields[] = {
+ HX_("left",07,08,b0,47),
+ HX_("right",dc,0b,64,e9),
+ HX_("key",9f,89,51,00),
+ HX_("value",71,7f,b8,31),
+ HX_("_height",86,19,c3,70),
+ ::String(null()) };
+
+::hx::Class TreeNode_obj::__mClass;
+
+void TreeNode_obj::__register()
+{
+ TreeNode_obj _hx_dummy;
+ TreeNode_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.ds.TreeNode",17,b7,b8,9b);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(TreeNode_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< TreeNode_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = TreeNode_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = TreeNode_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
+} // end namespace ds
diff --git a/Sources/c_snikket/src/haxe/ds/_List/ListNode.cpp b/Sources/c_snikket/src/haxe/ds/_List/ListNode.cpp
new file mode 100644
index 0000000..260f747
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/ds/_List/ListNode.cpp
@@ -0,0 +1,121 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_ds__List_ListNode
+#include <haxe/ds/_List/ListNode.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_d7fe8fcac3c6136e_266_new,"haxe.ds._List.ListNode","new",0x5847787a,"haxe.ds._List.ListNode.new","/usr/local/lib/haxe/std/haxe/ds/List.hx",266,0x54f95eac)
+namespace haxe{
+namespace ds{
+namespace _List{
+
+void ListNode_obj::__construct( ::Dynamic item, ::haxe::ds::_List::ListNode next){
+ HX_STACKFRAME(&_hx_pos_d7fe8fcac3c6136e_266_new)
+HXLINE( 267) this->item = item;
+HXLINE( 268) this->next = next;
+ }
+
+Dynamic ListNode_obj::__CreateEmpty() { return new ListNode_obj; }
+
+void *ListNode_obj::_hx_vtable = 0;
+
+Dynamic ListNode_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< ListNode_obj > _hx_result = new ListNode_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1]);
+ return _hx_result;
+}
+
+bool ListNode_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x567ed068;
+}
+
+
+ListNode_obj::ListNode_obj()
+{
+}
+
+void ListNode_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(ListNode);
+ HX_MARK_MEMBER_NAME(item,"item");
+ HX_MARK_MEMBER_NAME(next,"next");
+ HX_MARK_END_CLASS();
+}
+
+void ListNode_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(item,"item");
+ HX_VISIT_MEMBER_NAME(next,"next");
+}
+
+::hx::Val ListNode_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"item") ) { return ::hx::Val( item ); }
+ if (HX_FIELD_EQ(inName,"next") ) { return ::hx::Val( next ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val ListNode_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"item") ) { item=inValue.Cast< ::Dynamic >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"next") ) { next=inValue.Cast< ::haxe::ds::_List::ListNode >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void ListNode_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("item",13,c5,bf,45));
+ outFields->push(HX_("next",f3,84,02,49));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo ListNode_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(ListNode_obj,item),HX_("item",13,c5,bf,45)},
+ {::hx::fsObject /* ::haxe::ds::_List::ListNode */ ,(int)offsetof(ListNode_obj,next),HX_("next",f3,84,02,49)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *ListNode_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String ListNode_obj_sMemberFields[] = {
+ HX_("item",13,c5,bf,45),
+ HX_("next",f3,84,02,49),
+ ::String(null()) };
+
+::hx::Class ListNode_obj::__mClass;
+
+void ListNode_obj::__register()
+{
+ ListNode_obj _hx_dummy;
+ ListNode_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.ds._List.ListNode",88,73,d7,1e);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(ListNode_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< ListNode_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = ListNode_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = ListNode_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
+} // end namespace ds
+} // end namespace _List
diff --git a/Sources/c_snikket/src/haxe/exceptions/NotImplementedException.cpp b/Sources/c_snikket/src/haxe/exceptions/NotImplementedException.cpp
new file mode 100644
index 0000000..f11b7b2
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/exceptions/NotImplementedException.cpp
@@ -0,0 +1,84 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_Exception
+#include <haxe/Exception.h>
+#endif
+#ifndef INCLUDED_haxe_exceptions_NotImplementedException
+#include <haxe/exceptions/NotImplementedException.h>
+#endif
+#ifndef INCLUDED_haxe_exceptions_PosException
+#include <haxe/exceptions/PosException.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_6becf3ac06fb2a12_8_new,"haxe.exceptions.NotImplementedException","new",0xcfd1d5d0,"haxe.exceptions.NotImplementedException.new","/usr/local/lib/haxe/std/haxe/exceptions/NotImplementedException.hx",8,0x37dfbb3d)
+namespace haxe{
+namespace exceptions{
+
+void NotImplementedException_obj::__construct(::String __o_message, ::haxe::Exception previous, ::Dynamic pos){
+ ::String message = __o_message;
+ if (::hx::IsNull(__o_message)) message = HX_("Not implemented",15,1e,32,34);
+ HX_STACKFRAME(&_hx_pos_6becf3ac06fb2a12_8_new)
+HXDLIN( 8) super::__construct(message,previous,pos);
+ }
+
+Dynamic NotImplementedException_obj::__CreateEmpty() { return new NotImplementedException_obj; }
+
+void *NotImplementedException_obj::_hx_vtable = 0;
+
+Dynamic NotImplementedException_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< NotImplementedException_obj > _hx_result = new NotImplementedException_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2]);
+ return _hx_result;
+}
+
+bool NotImplementedException_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x65f7252d) {
+ if (inClassId<=(int)0x081bdbd6) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x081bdbd6;
+ } else {
+ return inClassId==(int)0x65f7252d;
+ }
+ } else {
+ return inClassId==(int)0x677ddc49;
+ }
+}
+
+
+NotImplementedException_obj::NotImplementedException_obj()
+{
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *NotImplementedException_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *NotImplementedException_obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class NotImplementedException_obj::__mClass;
+
+void NotImplementedException_obj::__register()
+{
+ NotImplementedException_obj _hx_dummy;
+ NotImplementedException_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.exceptions.NotImplementedException",de,ed,a6,1b);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< NotImplementedException_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = NotImplementedException_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = NotImplementedException_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
+} // end namespace exceptions
diff --git a/Sources/c_snikket/src/haxe/exceptions/PosException.cpp b/Sources/c_snikket/src/haxe/exceptions/PosException.cpp
new file mode 100644
index 0000000..b71d149
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/exceptions/PosException.cpp
@@ -0,0 +1,136 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_Exception
+#include <haxe/Exception.h>
+#endif
+#ifndef INCLUDED_haxe_exceptions_PosException
+#include <haxe/exceptions/PosException.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_9487fa79a58895e3_12_new,"haxe.exceptions.PosException","new",0x9ed038cf,"haxe.exceptions.PosException.new","/usr/local/lib/haxe/std/haxe/exceptions/PosException.hx",12,0x18a37ec4)
+HX_LOCAL_STACK_FRAME(_hx_pos_9487fa79a58895e3_25_toString,"haxe.exceptions.PosException","toString",0x179675dd,"haxe.exceptions.PosException.toString","/usr/local/lib/haxe/std/haxe/exceptions/PosException.hx",25,0x18a37ec4)
+namespace haxe{
+namespace exceptions{
+
+void PosException_obj::__construct(::String message, ::haxe::Exception previous, ::Dynamic pos){
+ HX_STACKFRAME(&_hx_pos_9487fa79a58895e3_12_new)
+HXLINE( 13) super::__construct(message,previous,null());
+HXLINE( 14) if (::hx::IsNull( pos )) {
+HXLINE( 15) this->posInfos = ::hx::SourceInfo(HX_("(unknown)",87,5d,fc,5f),0,HX_("(unknown)",87,5d,fc,5f),HX_("(unknown)",87,5d,fc,5f));
+ }
+ else {
+HXLINE( 17) this->posInfos = pos;
+ }
+ }
+
+Dynamic PosException_obj::__CreateEmpty() { return new PosException_obj; }
+
+void *PosException_obj::_hx_vtable = 0;
+
+Dynamic PosException_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< PosException_obj > _hx_result = new PosException_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2]);
+ return _hx_result;
+}
+
+bool PosException_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x65f7252d) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x65f7252d;
+ } else {
+ return inClassId==(int)0x677ddc49;
+ }
+}
+
+::String PosException_obj::toString(){
+ HX_STACKFRAME(&_hx_pos_9487fa79a58895e3_25_toString)
+HXDLIN( 25) ::String _hx_tmp = ((HX_("",00,00,00,00) + this->super::toString()) + HX_(" in ",7b,e0,76,15));
+HXDLIN( 25) return ( (::String)((((((((_hx_tmp + this->posInfos->__Field(HX_("className",a3,92,3d,dc),::hx::paccDynamic)) + HX_(".",2e,00,00,00)) + this->posInfos->__Field(HX_("methodName",cc,19,0f,12),::hx::paccDynamic)) + HX_(" at ",ad,d3,70,15)) + this->posInfos->__Field(HX_("fileName",e7,5a,43,62),::hx::paccDynamic)) + HX_(":",3a,00,00,00)) + this->posInfos->__Field(HX_("lineNumber",dd,81,22,76),::hx::paccDynamic))) );
+ }
+
+
+
+PosException_obj::PosException_obj()
+{
+}
+
+void PosException_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(PosException);
+ HX_MARK_MEMBER_NAME(posInfos,"posInfos");
+ ::haxe::Exception_obj::__Mark(HX_MARK_ARG);
+ HX_MARK_END_CLASS();
+}
+
+void PosException_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(posInfos,"posInfos");
+ ::haxe::Exception_obj::__Visit(HX_VISIT_ARG);
+}
+
+::hx::Val PosException_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 8:
+ if (HX_FIELD_EQ(inName,"posInfos") ) { return ::hx::Val( posInfos ); }
+ if (HX_FIELD_EQ(inName,"toString") ) { return ::hx::Val( toString_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val PosException_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 8:
+ if (HX_FIELD_EQ(inName,"posInfos") ) { posInfos=inValue.Cast< ::Dynamic >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void PosException_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("posInfos",11,82,2e,5a));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo PosException_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(PosException_obj,posInfos),HX_("posInfos",11,82,2e,5a)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *PosException_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String PosException_obj_sMemberFields[] = {
+ HX_("posInfos",11,82,2e,5a),
+ HX_("toString",ac,d0,6e,38),
+ ::String(null()) };
+
+::hx::Class PosException_obj::__mClass;
+
+void PosException_obj::__register()
+{
+ PosException_obj _hx_dummy;
+ PosException_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.exceptions.PosException",5d,25,5a,6b);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(PosException_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< PosException_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = PosException_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = PosException_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
+} // end namespace exceptions
diff --git a/Sources/c_snikket/src/haxe/format/JsonParser.cpp b/Sources/c_snikket/src/haxe/format/JsonParser.cpp
new file mode 100644
index 0000000..29776d6
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/format/JsonParser.cpp
@@ -0,0 +1,793 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_StringBuf
+#include <StringBuf.h>
+#endif
+#ifndef INCLUDED_haxe_format_JsonParser
+#include <haxe/format/JsonParser.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_325103750a35722e_51_new,"haxe.format.JsonParser","new",0xa017eec8,"haxe.format.JsonParser.new","/usr/local/lib/haxe/std/haxe/format/JsonParser.hx",51,0x4a8b222b)
+HX_LOCAL_STACK_FRAME(_hx_pos_325103750a35722e_56_doParse,"haxe.format.JsonParser","doParse",0xa959e310,"haxe.format.JsonParser.doParse","/usr/local/lib/haxe/std/haxe/format/JsonParser.hx",56,0x4a8b222b)
+HX_LOCAL_STACK_FRAME(_hx_pos_325103750a35722e_71_parseRec,"haxe.format.JsonParser","parseRec",0xda258b75,"haxe.format.JsonParser.parseRec","/usr/local/lib/haxe/std/haxe/format/JsonParser.hx",71,0x4a8b222b)
+HX_LOCAL_STACK_FRAME(_hx_pos_325103750a35722e_152_parseString,"haxe.format.JsonParser","parseString",0x8c919bcc,"haxe.format.JsonParser.parseString","/usr/local/lib/haxe/std/haxe/format/JsonParser.hx",152,0x4a8b222b)
+HX_LOCAL_STACK_FRAME(_hx_pos_325103750a35722e_316_invalidChar,"haxe.format.JsonParser","invalidChar",0xa9f373d5,"haxe.format.JsonParser.invalidChar","/usr/local/lib/haxe/std/haxe/format/JsonParser.hx",316,0x4a8b222b)
+HX_LOCAL_STACK_FRAME(_hx_pos_325103750a35722e_322_invalidNumber,"haxe.format.JsonParser","invalidNumber",0x8e9d1988,"haxe.format.JsonParser.invalidNumber","/usr/local/lib/haxe/std/haxe/format/JsonParser.hx",322,0x4a8b222b)
+namespace haxe{
+namespace format{
+
+void JsonParser_obj::__construct(::String str){
+ HX_STACKFRAME(&_hx_pos_325103750a35722e_51_new)
+HXLINE( 52) this->str = str;
+HXLINE( 53) this->pos = 0;
+ }
+
+Dynamic JsonParser_obj::__CreateEmpty() { return new JsonParser_obj; }
+
+void *JsonParser_obj::_hx_vtable = 0;
+
+Dynamic JsonParser_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< JsonParser_obj > _hx_result = new JsonParser_obj();
+ _hx_result->__construct(inArgs[0]);
+ return _hx_result;
+}
+
+bool JsonParser_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x0ae51690;
+}
+
+ ::Dynamic JsonParser_obj::doParse(){
+ HX_STACKFRAME(&_hx_pos_325103750a35722e_56_doParse)
+HXLINE( 57) ::Dynamic result = this->parseRec();
+HXLINE( 58) int c;
+HXLINE( 59) while(true){
+HXLINE( 59) c = this->str.cca(this->pos++);
+HXDLIN( 59) if (!((c != 0))) {
+HXLINE( 59) goto _hx_goto_1;
+ }
+HXLINE( 60) switch((int)(c)){
+ case (int)9: case (int)10: case (int)13: case (int)32: {
+ }
+ break;
+ default:{
+HXLINE( 64) this->invalidChar();
+ }
+ }
+ }
+ _hx_goto_1:;
+HXLINE( 67) return result;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(JsonParser_obj,doParse,return )
+
+ ::Dynamic JsonParser_obj::parseRec(){
+ HX_STACKFRAME(&_hx_pos_325103750a35722e_71_parseRec)
+HXDLIN( 71) while(true){
+HXLINE( 72) int c = this->str.cca(this->pos++);
+HXLINE( 73) switch((int)(c)){
+ case (int)9: case (int)10: case (int)13: case (int)32: {
+ }
+ break;
+ case (int)34: {
+HXLINE( 143) return this->parseString();
+ }
+ break;
+ case (int)45: case (int)48: case (int)49: case (int)50: case (int)51: case (int)52: case (int)53: case (int)54: case (int)55: case (int)56: case (int)57: {
+HXLINE( 145) int c1 = c;
+HXDLIN( 145) int start = (this->pos - 1);
+HXDLIN( 145) bool minus = (c1 == 45);
+HXDLIN( 145) bool digit = !(minus);
+HXDLIN( 145) bool zero = (c1 == 48);
+HXDLIN( 145) bool point = false;
+HXDLIN( 145) bool e = false;
+HXDLIN( 145) bool pm = false;
+HXDLIN( 145) bool end = false;
+HXDLIN( 145) do {
+HXLINE( 145) c1 = this->str.cca(this->pos++);
+HXDLIN( 145) switch((int)(c1)){
+ case (int)43: case (int)45: {
+HXLINE( 145) bool _hx_tmp;
+HXDLIN( 145) if (e) {
+HXLINE( 145) _hx_tmp = pm;
+ }
+ else {
+HXLINE( 145) _hx_tmp = true;
+ }
+HXDLIN( 145) if (_hx_tmp) {
+HXLINE( 145) this->invalidNumber(start);
+ }
+HXDLIN( 145) digit = false;
+HXDLIN( 145) pm = true;
+ }
+ break;
+ case (int)46: {
+HXLINE( 145) bool _hx_tmp1;
+HXDLIN( 145) bool _hx_tmp2;
+HXDLIN( 145) if (!(minus)) {
+HXLINE( 145) _hx_tmp2 = point;
+ }
+ else {
+HXLINE( 145) _hx_tmp2 = true;
+ }
+HXDLIN( 145) if (!(_hx_tmp2)) {
+HXLINE( 145) _hx_tmp1 = e;
+ }
+ else {
+HXLINE( 145) _hx_tmp1 = true;
+ }
+HXDLIN( 145) if (_hx_tmp1) {
+HXLINE( 145) this->invalidNumber(start);
+ }
+HXDLIN( 145) digit = false;
+HXDLIN( 145) point = true;
+ }
+ break;
+ case (int)48: {
+HXLINE( 145) bool _hx_tmp3;
+HXDLIN( 145) if (zero) {
+HXLINE( 145) _hx_tmp3 = !(point);
+ }
+ else {
+HXLINE( 145) _hx_tmp3 = false;
+ }
+HXDLIN( 145) if (_hx_tmp3) {
+HXLINE( 145) this->invalidNumber(start);
+ }
+HXDLIN( 145) if (minus) {
+HXLINE( 145) minus = false;
+HXDLIN( 145) zero = true;
+ }
+HXDLIN( 145) digit = true;
+ }
+ break;
+ case (int)49: case (int)50: case (int)51: case (int)52: case (int)53: case (int)54: case (int)55: case (int)56: case (int)57: {
+HXLINE( 145) bool _hx_tmp4;
+HXDLIN( 145) if (zero) {
+HXLINE( 145) _hx_tmp4 = !(point);
+ }
+ else {
+HXLINE( 145) _hx_tmp4 = false;
+ }
+HXDLIN( 145) if (_hx_tmp4) {
+HXLINE( 145) this->invalidNumber(start);
+ }
+HXDLIN( 145) if (minus) {
+HXLINE( 145) minus = false;
+ }
+HXDLIN( 145) digit = true;
+HXDLIN( 145) zero = false;
+ }
+ break;
+ case (int)69: case (int)101: {
+HXLINE( 145) bool _hx_tmp5;
+HXDLIN( 145) bool _hx_tmp6;
+HXDLIN( 145) if (!(minus)) {
+HXLINE( 145) _hx_tmp6 = zero;
+ }
+ else {
+HXLINE( 145) _hx_tmp6 = true;
+ }
+HXDLIN( 145) if (!(_hx_tmp6)) {
+HXLINE( 145) _hx_tmp5 = e;
+ }
+ else {
+HXLINE( 145) _hx_tmp5 = true;
+ }
+HXDLIN( 145) if (_hx_tmp5) {
+HXLINE( 145) this->invalidNumber(start);
+ }
+HXDLIN( 145) digit = false;
+HXDLIN( 145) e = true;
+ }
+ break;
+ default:{
+HXLINE( 145) if (!(digit)) {
+HXLINE( 145) this->invalidNumber(start);
+ }
+HXDLIN( 145) this->pos--;
+HXDLIN( 145) end = true;
+ }
+ }
+ } while(!(end));
+;
+HXDLIN( 145) Float f = ::Std_obj::parseFloat(this->str.substr(start,(this->pos - start)));
+HXDLIN( 145) if (point) {
+HXLINE( 145) return f;
+ }
+ else {
+HXLINE( 145) int i = ::Std_obj::_hx_int(f);
+HXDLIN( 145) if ((i == f)) {
+HXLINE( 145) return i;
+ }
+ else {
+HXLINE( 145) return f;
+ }
+ }
+ }
+ break;
+ case (int)91: {
+HXLINE( 103) ::cpp::VirtualArray arr = ::cpp::VirtualArray_obj::__new(0);
+HXDLIN( 103) ::Dynamic comma = null();
+HXLINE( 104) while(true){
+HXLINE( 105) int c2 = this->str.cca(this->pos++);
+HXLINE( 106) switch((int)(c2)){
+ case (int)9: case (int)10: case (int)13: case (int)32: {
+ }
+ break;
+ case (int)44: {
+HXLINE( 113) if (( (bool)(comma) )) {
+HXLINE( 113) comma = false;
+ }
+ else {
+HXLINE( 113) this->invalidChar();
+ }
+ }
+ break;
+ case (int)93: {
+HXLINE( 110) if (::hx::IsEq( comma,false )) {
+HXLINE( 110) this->invalidChar();
+ }
+HXLINE( 111) return arr;
+ }
+ break;
+ default:{
+HXLINE( 115) if (( (bool)(comma) )) {
+HXLINE( 115) this->invalidChar();
+ }
+HXLINE( 116) this->pos--;
+HXLINE( 117) arr->push(this->parseRec());
+HXLINE( 118) comma = true;
+ }
+ }
+ }
+ }
+ break;
+ case (int)102: {
+HXLINE( 129) int save = this->pos;
+HXLINE( 130) bool _hx_tmp7;
+HXDLIN( 130) bool _hx_tmp8;
+HXDLIN( 130) bool _hx_tmp9;
+HXDLIN( 130) if ((this->str.cca(this->pos++) == 97)) {
+HXLINE( 130) _hx_tmp9 = (this->str.cca(this->pos++) != 108);
+ }
+ else {
+HXLINE( 130) _hx_tmp9 = true;
+ }
+HXDLIN( 130) if (!(_hx_tmp9)) {
+HXLINE( 130) _hx_tmp8 = (this->str.cca(this->pos++) != 115);
+ }
+ else {
+HXLINE( 130) _hx_tmp8 = true;
+ }
+HXDLIN( 130) if (!(_hx_tmp8)) {
+HXLINE( 130) _hx_tmp7 = (this->str.cca(this->pos++) != 101);
+ }
+ else {
+HXLINE( 130) _hx_tmp7 = true;
+ }
+HXDLIN( 130) if (_hx_tmp7) {
+HXLINE( 131) this->pos = save;
+HXLINE( 132) this->invalidChar();
+ }
+HXLINE( 134) return false;
+ }
+ break;
+ case (int)110: {
+HXLINE( 136) int save1 = this->pos;
+HXLINE( 137) bool _hx_tmp10;
+HXDLIN( 137) bool _hx_tmp11;
+HXDLIN( 137) if ((this->str.cca(this->pos++) == 117)) {
+HXLINE( 137) _hx_tmp11 = (this->str.cca(this->pos++) != 108);
+ }
+ else {
+HXLINE( 137) _hx_tmp11 = true;
+ }
+HXDLIN( 137) if (!(_hx_tmp11)) {
+HXLINE( 137) _hx_tmp10 = (this->str.cca(this->pos++) != 108);
+ }
+ else {
+HXLINE( 137) _hx_tmp10 = true;
+ }
+HXDLIN( 137) if (_hx_tmp10) {
+HXLINE( 138) this->pos = save1;
+HXLINE( 139) this->invalidChar();
+ }
+HXLINE( 141) return null();
+ }
+ break;
+ case (int)116: {
+HXLINE( 122) int save2 = this->pos;
+HXLINE( 123) bool _hx_tmp12;
+HXDLIN( 123) bool _hx_tmp13;
+HXDLIN( 123) if ((this->str.cca(this->pos++) == 114)) {
+HXLINE( 123) _hx_tmp13 = (this->str.cca(this->pos++) != 117);
+ }
+ else {
+HXLINE( 123) _hx_tmp13 = true;
+ }
+HXDLIN( 123) if (!(_hx_tmp13)) {
+HXLINE( 123) _hx_tmp12 = (this->str.cca(this->pos++) != 101);
+ }
+ else {
+HXLINE( 123) _hx_tmp12 = true;
+ }
+HXDLIN( 123) if (_hx_tmp12) {
+HXLINE( 124) this->pos = save2;
+HXLINE( 125) this->invalidChar();
+ }
+HXLINE( 127) return true;
+ }
+ break;
+ case (int)123: {
+HXLINE( 77) ::Dynamic obj = ::Dynamic(::hx::Anon_obj::Create(0));
+HXDLIN( 77) ::String field = null();
+HXDLIN( 77) ::Dynamic comma1 = null();
+HXLINE( 78) while(true){
+HXLINE( 79) int c3 = this->str.cca(this->pos++);
+HXLINE( 80) switch((int)(c3)){
+ case (int)9: case (int)10: case (int)13: case (int)32: {
+ }
+ break;
+ case (int)34: {
+HXLINE( 96) bool _hx_tmp14;
+HXDLIN( 96) if (::hx::IsNull( field )) {
+HXLINE( 96) _hx_tmp14 = ( (bool)(comma1) );
+ }
+ else {
+HXLINE( 96) _hx_tmp14 = true;
+ }
+HXDLIN( 96) if (_hx_tmp14) {
+HXLINE( 96) this->invalidChar();
+ }
+HXLINE( 97) field = this->parseString();
+ }
+ break;
+ case (int)44: {
+HXLINE( 94) if (( (bool)(comma1) )) {
+HXLINE( 94) comma1 = false;
+ }
+ else {
+HXLINE( 94) this->invalidChar();
+ }
+ }
+ break;
+ case (int)58: {
+HXLINE( 88) if (::hx::IsNull( field )) {
+HXLINE( 89) this->invalidChar();
+ }
+HXLINE( 90) ::Reflect_obj::setField(obj,field,this->parseRec());
+HXLINE( 91) field = null();
+HXLINE( 92) comma1 = true;
+ }
+ break;
+ case (int)125: {
+HXLINE( 84) bool _hx_tmp15;
+HXDLIN( 84) if (::hx::IsNull( field )) {
+HXLINE( 84) _hx_tmp15 = ::hx::IsEq( comma1,false );
+ }
+ else {
+HXLINE( 84) _hx_tmp15 = true;
+ }
+HXDLIN( 84) if (_hx_tmp15) {
+HXLINE( 85) this->invalidChar();
+ }
+HXLINE( 86) return obj;
+ }
+ break;
+ default:{
+HXLINE( 99) this->invalidChar();
+ }
+ }
+ }
+ }
+ break;
+ default:{
+HXLINE( 147) this->invalidChar();
+ }
+ }
+ }
+HXLINE( 71) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(JsonParser_obj,parseRec,return )
+
+::String JsonParser_obj::parseString(){
+ HX_GC_STACKFRAME(&_hx_pos_325103750a35722e_152_parseString)
+HXLINE( 153) int start = this->pos;
+HXLINE( 154) ::StringBuf buf = null();
+HXLINE( 156) int prev = -1;
+HXLINE( 163) while(true){
+HXLINE( 164) int c = this->str.cca(this->pos++);
+HXLINE( 165) if ((c == 34)) {
+HXLINE( 166) goto _hx_goto_8;
+ }
+HXLINE( 167) if ((c == 92)) {
+HXLINE( 168) if (::hx::IsNull( buf )) {
+HXLINE( 169) buf = ::StringBuf_obj::__alloc( HX_CTX );
+ }
+HXLINE( 171) {
+HXLINE( 171) ::String s = this->str;
+HXDLIN( 171) ::Dynamic len = ((this->pos - start) - 1);
+HXDLIN( 171) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 171) buf->flush();
+ }
+HXDLIN( 171) if (::hx::IsNull( buf->b )) {
+HXLINE( 171) buf->b = ::Array_obj< ::String >::__new(1)->init(0,s.substr(start,len));
+ }
+ else {
+HXLINE( 171) ::Array< ::String > buf1 = buf->b;
+HXDLIN( 171) buf1->push(s.substr(start,len));
+ }
+ }
+HXLINE( 172) c = this->str.cca(this->pos++);
+HXLINE( 174) bool _hx_tmp;
+HXDLIN( 174) if ((c != 117)) {
+HXLINE( 174) _hx_tmp = (prev != -1);
+ }
+ else {
+HXLINE( 174) _hx_tmp = false;
+ }
+HXDLIN( 174) if (_hx_tmp) {
+HXLINE( 175) {
+HXLINE( 175) ::String x = ::String::fromCharCode(65533);
+HXDLIN( 175) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 175) buf->flush();
+ }
+HXDLIN( 175) if (::hx::IsNull( buf->b )) {
+HXLINE( 175) buf->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x));
+ }
+ else {
+HXLINE( 175) ::Array< ::String > buf2 = buf->b;
+HXDLIN( 175) buf2->push(::Std_obj::string(x));
+ }
+ }
+HXDLIN( 175) prev = -1;
+ }
+HXLINE( 177) switch((int)(c)){
+ case (int)34: case (int)47: case (int)92: {
+HXLINE( 189) if ((c >= 127)) {
+HXLINE( 189) ::String x1 = ::String::fromCharCode(c);
+HXDLIN( 189) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 189) buf->flush();
+ }
+HXDLIN( 189) if (::hx::IsNull( buf->b )) {
+HXLINE( 189) buf->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x1));
+ }
+ else {
+HXLINE( 189) ::Array< ::String > buf3 = buf->b;
+HXDLIN( 189) buf3->push(::Std_obj::string(x1));
+ }
+ }
+ else {
+HXLINE( 189) if (::hx::IsNull( buf->charBuf )) {
+HXLINE( 189) buf->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 189) buf->charBuf->push(c);
+ }
+ }
+ break;
+ case (int)98: {
+HXLINE( 185) if (::hx::IsNull( buf->charBuf )) {
+HXLINE( 185) buf->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 185) buf->charBuf->push(8);
+ }
+ break;
+ case (int)102: {
+HXLINE( 187) if (::hx::IsNull( buf->charBuf )) {
+HXLINE( 187) buf->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 187) buf->charBuf->push(12);
+ }
+ break;
+ case (int)110: {
+HXLINE( 181) if (::hx::IsNull( buf->charBuf )) {
+HXLINE( 181) buf->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 181) buf->charBuf->push(10);
+ }
+ break;
+ case (int)114: {
+HXLINE( 179) if (::hx::IsNull( buf->charBuf )) {
+HXLINE( 179) buf->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 179) buf->charBuf->push(13);
+ }
+ break;
+ case (int)116: {
+HXLINE( 183) if (::hx::IsNull( buf->charBuf )) {
+HXLINE( 183) buf->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 183) buf->charBuf->push(9);
+ }
+ break;
+ case (int)117: {
+HXLINE( 191) int uc = ( (int)(::Std_obj::parseInt((HX_("0x",48,2a,00,00) + this->str.substr(this->pos,4)))) );
+HXLINE( 192) ::haxe::format::JsonParser _hx_tmp1 = ::hx::ObjectPtr<OBJ_>(this);
+HXDLIN( 192) _hx_tmp1->pos = (_hx_tmp1->pos + 4);
+HXLINE( 210) if ((prev != -1)) {
+HXLINE( 211) bool _hx_tmp2;
+HXDLIN( 211) if ((uc >= 56320)) {
+HXLINE( 211) _hx_tmp2 = (uc > 57343);
+ }
+ else {
+HXLINE( 211) _hx_tmp2 = true;
+ }
+HXDLIN( 211) if (_hx_tmp2) {
+HXLINE( 212) {
+HXLINE( 212) ::String x2 = ::String::fromCharCode(65533);
+HXDLIN( 212) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 212) buf->flush();
+ }
+HXDLIN( 212) if (::hx::IsNull( buf->b )) {
+HXLINE( 212) buf->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x2));
+ }
+ else {
+HXLINE( 212) ::Array< ::String > buf4 = buf->b;
+HXDLIN( 212) buf4->push(::Std_obj::string(x2));
+ }
+ }
+HXDLIN( 212) prev = -1;
+ }
+ else {
+HXLINE( 214) {
+HXLINE( 214) int c1 = ((((prev - 55296) << 10) + (uc - 56320)) + 65536);
+HXDLIN( 214) if ((c1 >= 127)) {
+HXLINE( 214) ::String x3 = ::String::fromCharCode(c1);
+HXDLIN( 214) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 214) buf->flush();
+ }
+HXDLIN( 214) if (::hx::IsNull( buf->b )) {
+HXLINE( 214) buf->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x3));
+ }
+ else {
+HXLINE( 214) ::Array< ::String > buf5 = buf->b;
+HXDLIN( 214) buf5->push(::Std_obj::string(x3));
+ }
+ }
+ else {
+HXLINE( 214) if (::hx::IsNull( buf->charBuf )) {
+HXLINE( 214) buf->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 214) buf->charBuf->push(c1);
+ }
+ }
+HXLINE( 215) prev = -1;
+ }
+ }
+ else {
+HXLINE( 217) bool _hx_tmp3;
+HXDLIN( 217) if ((uc >= 55296)) {
+HXLINE( 217) _hx_tmp3 = (uc <= 56319);
+ }
+ else {
+HXLINE( 217) _hx_tmp3 = false;
+ }
+HXDLIN( 217) if (_hx_tmp3) {
+HXLINE( 218) prev = uc;
+ }
+ else {
+HXLINE( 220) if ((uc >= 127)) {
+HXLINE( 220) ::String x4 = ::String::fromCharCode(uc);
+HXDLIN( 220) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 220) buf->flush();
+ }
+HXDLIN( 220) if (::hx::IsNull( buf->b )) {
+HXLINE( 220) buf->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x4));
+ }
+ else {
+HXLINE( 220) ::Array< ::String > buf6 = buf->b;
+HXDLIN( 220) buf6->push(::Std_obj::string(x4));
+ }
+ }
+ else {
+HXLINE( 220) if (::hx::IsNull( buf->charBuf )) {
+HXLINE( 220) buf->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 220) buf->charBuf->push(uc);
+ }
+ }
+ }
+ }
+ break;
+ default:{
+HXLINE( 223) HX_STACK_DO_THROW((((HX_("Invalid escape sequence \\",73,af,f7,b2) + ::String::fromCharCode(c)) + HX_(" at position ",0a,c2,01,e0)) + (this->pos - 1)));
+ }
+ }
+HXLINE( 225) start = this->pos;
+ }
+ else {
+HXLINE( 241) if ((c == 0)) {
+HXLINE( 242) HX_STACK_DO_THROW(HX_("Unclosed string",ac,02,ef,ea));
+ }
+ }
+ }
+ _hx_goto_8:;
+HXLINE( 245) if ((prev != -1)) {
+HXLINE( 246) {
+HXLINE( 246) ::String x5 = ::String::fromCharCode(65533);
+HXDLIN( 246) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 246) buf->flush();
+ }
+HXDLIN( 246) if (::hx::IsNull( buf->b )) {
+HXLINE( 246) buf->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x5));
+ }
+ else {
+HXLINE( 246) ::Array< ::String > buf7 = buf->b;
+HXDLIN( 246) buf7->push(::Std_obj::string(x5));
+ }
+ }
+HXDLIN( 246) prev = -1;
+ }
+HXLINE( 248) if (::hx::IsNull( buf )) {
+HXLINE( 249) return this->str.substr(start,((this->pos - start) - 1));
+ }
+ else {
+HXLINE( 251) {
+HXLINE( 251) ::String s1 = this->str;
+HXDLIN( 251) ::Dynamic len1 = ((this->pos - start) - 1);
+HXDLIN( 251) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 251) buf->flush();
+ }
+HXDLIN( 251) if (::hx::IsNull( buf->b )) {
+HXLINE( 251) buf->b = ::Array_obj< ::String >::__new(1)->init(0,s1.substr(start,len1));
+ }
+ else {
+HXLINE( 251) ::Array< ::String > buf8 = buf->b;
+HXDLIN( 251) buf8->push(s1.substr(start,len1));
+ }
+ }
+HXLINE( 252) return buf->toString();
+ }
+HXLINE( 248) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(JsonParser_obj,parseString,return )
+
+void JsonParser_obj::invalidChar(){
+ HX_STACKFRAME(&_hx_pos_325103750a35722e_316_invalidChar)
+HXLINE( 317) this->pos--;
+HXLINE( 318) ::String _hx_tmp = ((HX_("Invalid char ",81,66,ec,29) + this->str.cca(this->pos)) + HX_(" at position ",0a,c2,01,e0));
+HXDLIN( 318) HX_STACK_DO_THROW((_hx_tmp + this->pos));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(JsonParser_obj,invalidChar,(void))
+
+void JsonParser_obj::invalidNumber(int start){
+ HX_STACKFRAME(&_hx_pos_325103750a35722e_322_invalidNumber)
+HXDLIN( 322) HX_STACK_DO_THROW((((HX_("Invalid number at position ",d8,9d,6f,13) + start) + HX_(": ",a6,32,00,00)) + this->str.substr(start,(this->pos - start))));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(JsonParser_obj,invalidNumber,(void))
+
+
+::hx::ObjectPtr< JsonParser_obj > JsonParser_obj::__new(::String str) {
+ ::hx::ObjectPtr< JsonParser_obj > __this = new JsonParser_obj();
+ __this->__construct(str);
+ return __this;
+}
+
+::hx::ObjectPtr< JsonParser_obj > JsonParser_obj::__alloc(::hx::Ctx *_hx_ctx,::String str) {
+ JsonParser_obj *__this = (JsonParser_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(JsonParser_obj), true, "haxe.format.JsonParser"));
+ *(void **)__this = JsonParser_obj::_hx_vtable;
+ __this->__construct(str);
+ return __this;
+}
+
+JsonParser_obj::JsonParser_obj()
+{
+}
+
+void JsonParser_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(JsonParser);
+ HX_MARK_MEMBER_NAME(str,"str");
+ HX_MARK_MEMBER_NAME(pos,"pos");
+ HX_MARK_END_CLASS();
+}
+
+void JsonParser_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(str,"str");
+ HX_VISIT_MEMBER_NAME(pos,"pos");
+}
+
+::hx::Val JsonParser_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"str") ) { return ::hx::Val( str ); }
+ if (HX_FIELD_EQ(inName,"pos") ) { return ::hx::Val( pos ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"doParse") ) { return ::hx::Val( doParse_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"parseRec") ) { return ::hx::Val( parseRec_dyn() ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"parseString") ) { return ::hx::Val( parseString_dyn() ); }
+ if (HX_FIELD_EQ(inName,"invalidChar") ) { return ::hx::Val( invalidChar_dyn() ); }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"invalidNumber") ) { return ::hx::Val( invalidNumber_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val JsonParser_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"str") ) { str=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"pos") ) { pos=inValue.Cast< int >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void JsonParser_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("str",b1,a8,57,00));
+ outFields->push(HX_("pos",94,5d,55,00));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo JsonParser_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(JsonParser_obj,str),HX_("str",b1,a8,57,00)},
+ {::hx::fsInt,(int)offsetof(JsonParser_obj,pos),HX_("pos",94,5d,55,00)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *JsonParser_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String JsonParser_obj_sMemberFields[] = {
+ HX_("str",b1,a8,57,00),
+ HX_("pos",94,5d,55,00),
+ HX_("doParse",a8,70,82,f0),
+ HX_("parseRec",dd,e2,78,d6),
+ HX_("parseString",64,d5,6c,8c),
+ HX_("invalidChar",6d,ad,ce,a9),
+ HX_("invalidNumber",20,e9,eb,a6),
+ ::String(null()) };
+
+::hx::Class JsonParser_obj::__mClass;
+
+void JsonParser_obj::__register()
+{
+ JsonParser_obj _hx_dummy;
+ JsonParser_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.format.JsonParser",d6,2a,bf,29);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(JsonParser_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< JsonParser_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = JsonParser_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = JsonParser_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
+} // end namespace format
diff --git a/Sources/c_snikket/src/haxe/format/JsonPrinter.cpp b/Sources/c_snikket/src/haxe/format/JsonPrinter.cpp
new file mode 100644
index 0000000..3dc30e1
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/format/JsonPrinter.cpp
@@ -0,0 +1,822 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_95f339a1d026d52c
+#define INCLUDED_95f339a1d026d52c
+#include "hxMath.h"
+#endif
+#ifndef INCLUDED_Date
+#include <Date.h>
+#endif
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_StringBuf
+#include <StringBuf.h>
+#endif
+#ifndef INCLUDED_StringTools
+#include <StringTools.h>
+#endif
+#ifndef INCLUDED_Type
+#include <Type.h>
+#endif
+#ifndef INCLUDED_ValueType
+#include <ValueType.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_StringMap
+#include <haxe/ds/StringMap.h>
+#endif
+#ifndef INCLUDED_haxe_format_JsonPrinter
+#include <haxe/format/JsonPrinter.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_9c6ac6b04494726e_56_new,"haxe.format.JsonPrinter","new",0xeb68de75,"haxe.format.JsonPrinter.new","/usr/local/lib/haxe/std/haxe/format/JsonPrinter.hx",56,0xce74b8b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_9c6ac6b04494726e_81_write,"haxe.format.JsonPrinter","write",0x755dea34,"haxe.format.JsonPrinter.write","/usr/local/lib/haxe/std/haxe/format/JsonPrinter.hx",81,0xce74b8b8)
+static const ::String _hx_array_data_f7b98003_4[] = {
+ HX_("null",87,9e,0e,49),
+};
+static const ::String _hx_array_data_f7b98003_5[] = {
+ HX_("\"<fun>\"",09,3c,cc,8b),
+};
+static const ::String _hx_array_data_f7b98003_6[] = {
+ HX_("\"???\"",45,2f,74,bd),
+};
+HX_LOCAL_STACK_FRAME(_hx_pos_9c6ac6b04494726e_158_classString,"haxe.format.JsonPrinter","classString",0x9219ba3e,"haxe.format.JsonPrinter.classString","/usr/local/lib/haxe/std/haxe/format/JsonPrinter.hx",158,0xce74b8b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_9c6ac6b04494726e_165_fieldsString,"haxe.format.JsonPrinter","fieldsString",0x974bd375,"haxe.format.JsonPrinter.fieldsString","/usr/local/lib/haxe/std/haxe/format/JsonPrinter.hx",165,0xce74b8b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_9c6ac6b04494726e_196_quote,"haxe.format.JsonPrinter","quote",0x02f6a091,"haxe.format.JsonPrinter.quote","/usr/local/lib/haxe/std/haxe/format/JsonPrinter.hx",196,0xce74b8b8)
+static const ::String _hx_array_data_f7b98003_12[] = {
+ HX_("\\b",86,50,00,00),
+};
+static const ::String _hx_array_data_f7b98003_13[] = {
+ HX_("\\t",98,50,00,00),
+};
+static const ::String _hx_array_data_f7b98003_14[] = {
+ HX_("\\n",92,50,00,00),
+};
+static const ::String _hx_array_data_f7b98003_15[] = {
+ HX_("\\f",8a,50,00,00),
+};
+static const ::String _hx_array_data_f7b98003_16[] = {
+ HX_("\\r",96,50,00,00),
+};
+static const ::String _hx_array_data_f7b98003_17[] = {
+ HX_("\\\"",46,50,00,00),
+};
+static const ::String _hx_array_data_f7b98003_18[] = {
+ HX_("\\\\",80,50,00,00),
+};
+HX_LOCAL_STACK_FRAME(_hx_pos_9c6ac6b04494726e_44_print,"haxe.format.JsonPrinter","print",0x6d8fd582,"haxe.format.JsonPrinter.print","/usr/local/lib/haxe/std/haxe/format/JsonPrinter.hx",44,0xce74b8b8)
+namespace haxe{
+namespace format{
+
+void JsonPrinter_obj::__construct( ::Dynamic replacer,::String space){
+ HX_GC_STACKFRAME(&_hx_pos_9c6ac6b04494726e_56_new)
+HXLINE( 57) this->replacer = replacer;
+HXLINE( 58) this->indent = space;
+HXLINE( 59) this->pretty = ::hx::IsNotNull( space );
+HXLINE( 60) this->nind = 0;
+HXLINE( 67) this->buf = ::StringBuf_obj::__alloc( HX_CTX );
+ }
+
+Dynamic JsonPrinter_obj::__CreateEmpty() { return new JsonPrinter_obj; }
+
+void *JsonPrinter_obj::_hx_vtable = 0;
+
+Dynamic JsonPrinter_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< JsonPrinter_obj > _hx_result = new JsonPrinter_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1]);
+ return _hx_result;
+}
+
+bool JsonPrinter_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x385642d1;
+}
+
+void JsonPrinter_obj::write( ::Dynamic k, ::Dynamic v){
+ HX_STACKFRAME(&_hx_pos_9c6ac6b04494726e_81_write)
+HXLINE( 82) if (::hx::IsNotNull( this->replacer )) {
+HXLINE( 83) v = this->replacer(k,v);
+ }
+HXLINE( 84) {
+HXLINE( 84) ::ValueType _g = ::Type_obj::_hx_typeof(v);
+HXDLIN( 84) switch((int)(_g->_hx_getIndex())){
+ case (int)0: {
+HXLINE( 136) ::StringBuf _this = this->buf;
+HXDLIN( 136) if (::hx::IsNotNull( _this->charBuf )) {
+HXLINE( 136) _this->flush();
+ }
+HXDLIN( 136) if (::hx::IsNull( _this->b )) {
+HXLINE( 136) _this->b = ::Array_obj< ::String >::fromData( _hx_array_data_f7b98003_4,1);
+ }
+ else {
+HXLINE( 136) _this->b->push(HX_("null",87,9e,0e,49));
+ }
+ }
+ break;
+ case (int)1: {
+HXLINE( 90) ::String v1 = ( (::String)(v) );
+HXDLIN( 90) {
+HXLINE( 90) ::StringBuf _this1 = this->buf;
+HXDLIN( 90) if (::hx::IsNotNull( _this1->charBuf )) {
+HXLINE( 90) _this1->flush();
+ }
+HXDLIN( 90) if (::hx::IsNull( _this1->b )) {
+HXLINE( 90) _this1->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(v1));
+ }
+ else {
+HXLINE( 90) ::Array< ::String > _this2 = _this1->b;
+HXDLIN( 90) _this2->push(::Std_obj::string(v1));
+ }
+ }
+ }
+ break;
+ case (int)2: {
+HXLINE( 92) ::String v2;
+HXDLIN( 92) if (::Math_obj::isFinite(( (Float)(v) ))) {
+HXLINE( 92) v2 = ::Std_obj::string(v);
+ }
+ else {
+HXLINE( 92) v2 = HX_("null",87,9e,0e,49);
+ }
+HXDLIN( 92) {
+HXLINE( 92) ::StringBuf _this3 = this->buf;
+HXDLIN( 92) if (::hx::IsNotNull( _this3->charBuf )) {
+HXLINE( 92) _this3->flush();
+ }
+HXDLIN( 92) if (::hx::IsNull( _this3->b )) {
+HXLINE( 92) _this3->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(v2));
+ }
+ else {
+HXLINE( 92) ::Array< ::String > _this4 = _this3->b;
+HXDLIN( 92) _this4->push(::Std_obj::string(v2));
+ }
+ }
+ }
+ break;
+ case (int)3: {
+HXLINE( 134) ::String v3 = ( (::String)(v) );
+HXDLIN( 134) {
+HXLINE( 134) ::StringBuf _this5 = this->buf;
+HXDLIN( 134) if (::hx::IsNotNull( _this5->charBuf )) {
+HXLINE( 134) _this5->flush();
+ }
+HXDLIN( 134) if (::hx::IsNull( _this5->b )) {
+HXLINE( 134) _this5->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(v3));
+ }
+ else {
+HXLINE( 134) ::Array< ::String > _this6 = _this5->b;
+HXDLIN( 134) _this6->push(::Std_obj::string(v3));
+ }
+ }
+ }
+ break;
+ case (int)4: {
+HXLINE( 88) this->fieldsString(v,::Reflect_obj::fields(v));
+ }
+ break;
+ case (int)5: {
+HXLINE( 94) ::StringBuf _this7 = this->buf;
+HXDLIN( 94) if (::hx::IsNotNull( _this7->charBuf )) {
+HXLINE( 94) _this7->flush();
+ }
+HXDLIN( 94) if (::hx::IsNull( _this7->b )) {
+HXLINE( 94) _this7->b = ::Array_obj< ::String >::fromData( _hx_array_data_f7b98003_5,1);
+ }
+ else {
+HXLINE( 94) _this7->b->push(HX_("\"<fun>\"",09,3c,cc,8b));
+ }
+ }
+ break;
+ case (int)6: {
+HXLINE( 95) ::hx::Class c = _g->_hx_getObject(0).StaticCast< ::hx::Class >();
+HXLINE( 96) if (::hx::IsPointerEq( c,::hx::ClassOf< ::String >() )) {
+HXLINE( 97) this->quote(( (::String)(v) ));
+ }
+ else {
+HXLINE( 98) if (::hx::IsPointerEq( c,::hx::ArrayBase::__mClass )) {
+HXLINE( 99) ::cpp::VirtualArray v4 = ( (::cpp::VirtualArray)(v) );
+HXLINE( 100) {
+HXLINE( 100) ::StringBuf _this8 = this->buf;
+HXDLIN( 100) {
+HXLINE( 100) if (::hx::IsNull( _this8->charBuf )) {
+HXLINE( 100) _this8->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 100) _this8->charBuf->push(91);
+ }
+ }
+HXLINE( 102) int len = v4->get_length();
+HXLINE( 103) int last = (len - 1);
+HXLINE( 104) {
+HXLINE( 104) int _g1 = 0;
+HXDLIN( 104) int _g2 = len;
+HXDLIN( 104) while((_g1 < _g2)){
+HXLINE( 104) _g1 = (_g1 + 1);
+HXDLIN( 104) int i = (_g1 - 1);
+HXLINE( 105) if ((i > 0)) {
+HXLINE( 106) ::StringBuf _this9 = this->buf;
+HXDLIN( 106) {
+HXLINE( 106) if (::hx::IsNull( _this9->charBuf )) {
+HXLINE( 106) _this9->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 106) _this9->charBuf->push(44);
+ }
+ }
+ else {
+HXLINE( 108) this->nind++;
+ }
+HXLINE( 109) if (this->pretty) {
+HXLINE( 109) ::StringBuf _this10 = this->buf;
+HXDLIN( 109) {
+HXLINE( 109) if (::hx::IsNull( _this10->charBuf )) {
+HXLINE( 109) _this10->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 109) _this10->charBuf->push(10);
+ }
+ }
+HXLINE( 110) if (this->pretty) {
+HXLINE( 110) ::String v5 = ::StringTools_obj::lpad(HX_("",00,00,00,00),this->indent,(this->nind * this->indent.length));
+HXDLIN( 110) {
+HXLINE( 110) ::StringBuf _this11 = this->buf;
+HXDLIN( 110) if (::hx::IsNotNull( _this11->charBuf )) {
+HXLINE( 110) _this11->flush();
+ }
+HXDLIN( 110) if (::hx::IsNull( _this11->b )) {
+HXLINE( 110) _this11->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(v5));
+ }
+ else {
+HXLINE( 110) ::Array< ::String > _this12 = _this11->b;
+HXDLIN( 110) _this12->push(::Std_obj::string(v5));
+ }
+ }
+ }
+HXLINE( 111) this->write(i,v4->__get(i));
+HXLINE( 112) if ((i == last)) {
+HXLINE( 113) this->nind--;
+HXLINE( 114) if (this->pretty) {
+HXLINE( 114) ::StringBuf _this13 = this->buf;
+HXDLIN( 114) {
+HXLINE( 114) if (::hx::IsNull( _this13->charBuf )) {
+HXLINE( 114) _this13->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 114) _this13->charBuf->push(10);
+ }
+ }
+HXLINE( 115) if (this->pretty) {
+HXLINE( 115) ::String v6 = ::StringTools_obj::lpad(HX_("",00,00,00,00),this->indent,(this->nind * this->indent.length));
+HXDLIN( 115) {
+HXLINE( 115) ::StringBuf _this14 = this->buf;
+HXDLIN( 115) if (::hx::IsNotNull( _this14->charBuf )) {
+HXLINE( 115) _this14->flush();
+ }
+HXDLIN( 115) if (::hx::IsNull( _this14->b )) {
+HXLINE( 115) _this14->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(v6));
+ }
+ else {
+HXLINE( 115) ::Array< ::String > _this15 = _this14->b;
+HXDLIN( 115) _this15->push(::Std_obj::string(v6));
+ }
+ }
+ }
+ }
+ }
+ }
+HXLINE( 118) {
+HXLINE( 118) ::StringBuf _this16 = this->buf;
+HXDLIN( 118) {
+HXLINE( 118) if (::hx::IsNull( _this16->charBuf )) {
+HXLINE( 118) _this16->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 118) _this16->charBuf->push(93);
+ }
+ }
+ }
+ else {
+HXLINE( 119) if (::hx::IsPointerEq( c,::hx::ClassOf< ::haxe::ds::StringMap >() )) {
+HXLINE( 120) ::haxe::ds::StringMap v7 = ( ( ::haxe::ds::StringMap)(v) );
+HXLINE( 121) ::Dynamic o = ::Dynamic(::hx::Anon_obj::Create(0));
+HXLINE( 122) {
+HXLINE( 122) ::Dynamic k1 = v7->keys();
+HXDLIN( 122) while(( (bool)(k1->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 122) ::String k2 = ( (::String)(k1->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXLINE( 123) ::Reflect_obj::setField(o,k2,v7->get(k2));
+ }
+ }
+HXLINE( 124) {
+HXLINE( 124) ::Dynamic v8 = o;
+HXDLIN( 124) this->fieldsString(v8,::Reflect_obj::fields(v8));
+ }
+ }
+ else {
+HXLINE( 125) if (::hx::IsPointerEq( c,::hx::ClassOf< ::Date >() )) {
+HXLINE( 126) ::Date v9 = ( ( ::Date)(v) );
+HXLINE( 127) this->quote(v9->toString());
+ }
+ else {
+HXLINE( 129) this->classString(v);
+ }
+ }
+ }
+ }
+ }
+ break;
+ case (int)7: {
+HXLINE( 130) ::hx::Class _g3 = _g->_hx_getObject(0).StaticCast< ::hx::Class >();
+HXDLIN( 130) {
+HXLINE( 131) int i1 = _hx_getEnumValueIndex(v);
+HXLINE( 132) {
+HXLINE( 132) ::String v10 = ::Std_obj::string(i1);
+HXDLIN( 132) {
+HXLINE( 132) ::StringBuf _this17 = this->buf;
+HXDLIN( 132) if (::hx::IsNotNull( _this17->charBuf )) {
+HXLINE( 132) _this17->flush();
+ }
+HXDLIN( 132) if (::hx::IsNull( _this17->b )) {
+HXLINE( 132) _this17->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(v10));
+ }
+ else {
+HXLINE( 132) ::Array< ::String > _this18 = _this17->b;
+HXDLIN( 132) _this18->push(::Std_obj::string(v10));
+ }
+ }
+ }
+ }
+ }
+ break;
+ case (int)8: {
+HXLINE( 86) ::StringBuf _this19 = this->buf;
+HXDLIN( 86) if (::hx::IsNotNull( _this19->charBuf )) {
+HXLINE( 86) _this19->flush();
+ }
+HXDLIN( 86) if (::hx::IsNull( _this19->b )) {
+HXLINE( 86) _this19->b = ::Array_obj< ::String >::fromData( _hx_array_data_f7b98003_6,1);
+ }
+ else {
+HXLINE( 86) _this19->b->push(HX_("\"???\"",45,2f,74,bd));
+ }
+ }
+ break;
+ }
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(JsonPrinter_obj,write,(void))
+
+void JsonPrinter_obj::classString( ::Dynamic v){
+ HX_STACKFRAME(&_hx_pos_9c6ac6b04494726e_158_classString)
+HXDLIN( 158) this->fieldsString(v,::Type_obj::getInstanceFields(::Type_obj::getClass(v)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(JsonPrinter_obj,classString,(void))
+
+void JsonPrinter_obj::fieldsString( ::Dynamic v,::Array< ::String > fields){
+ HX_STACKFRAME(&_hx_pos_9c6ac6b04494726e_165_fieldsString)
+HXLINE( 166) {
+HXLINE( 166) ::StringBuf _this = this->buf;
+HXDLIN( 166) {
+HXLINE( 166) if (::hx::IsNull( _this->charBuf )) {
+HXLINE( 166) _this->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 166) _this->charBuf->push(123);
+ }
+ }
+HXLINE( 167) int len = fields->length;
+HXLINE( 168) int last = (len - 1);
+HXLINE( 169) bool first = true;
+HXLINE( 170) {
+HXLINE( 170) int _g = 0;
+HXDLIN( 170) int _g1 = len;
+HXDLIN( 170) while((_g < _g1)){
+HXLINE( 170) _g = (_g + 1);
+HXDLIN( 170) int i = (_g - 1);
+HXLINE( 171) ::String f = fields->__get(i);
+HXLINE( 172) ::Dynamic value = ::Reflect_obj::field(v,f);
+HXLINE( 173) if (::Reflect_obj::isFunction(value)) {
+HXLINE( 174) continue;
+ }
+HXLINE( 175) if (first) {
+HXLINE( 176) this->nind++;
+HXLINE( 177) first = false;
+ }
+ else {
+HXLINE( 179) ::StringBuf _this1 = this->buf;
+HXDLIN( 179) {
+HXLINE( 179) if (::hx::IsNull( _this1->charBuf )) {
+HXLINE( 179) _this1->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 179) _this1->charBuf->push(44);
+ }
+ }
+HXLINE( 180) if (this->pretty) {
+HXLINE( 180) ::StringBuf _this2 = this->buf;
+HXDLIN( 180) {
+HXLINE( 180) if (::hx::IsNull( _this2->charBuf )) {
+HXLINE( 180) _this2->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 180) _this2->charBuf->push(10);
+ }
+ }
+HXLINE( 181) if (this->pretty) {
+HXLINE( 181) ::String v1 = ::StringTools_obj::lpad(HX_("",00,00,00,00),this->indent,(this->nind * this->indent.length));
+HXDLIN( 181) {
+HXLINE( 181) ::StringBuf _this3 = this->buf;
+HXDLIN( 181) if (::hx::IsNotNull( _this3->charBuf )) {
+HXLINE( 181) _this3->flush();
+ }
+HXDLIN( 181) if (::hx::IsNull( _this3->b )) {
+HXLINE( 181) _this3->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(v1));
+ }
+ else {
+HXLINE( 181) ::Array< ::String > _this4 = _this3->b;
+HXDLIN( 181) _this4->push(::Std_obj::string(v1));
+ }
+ }
+ }
+HXLINE( 182) this->quote(f);
+HXLINE( 183) {
+HXLINE( 183) ::StringBuf _this5 = this->buf;
+HXDLIN( 183) {
+HXLINE( 183) if (::hx::IsNull( _this5->charBuf )) {
+HXLINE( 183) _this5->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 183) _this5->charBuf->push(58);
+ }
+ }
+HXLINE( 184) if (this->pretty) {
+HXLINE( 185) ::StringBuf _this6 = this->buf;
+HXDLIN( 185) {
+HXLINE( 185) if (::hx::IsNull( _this6->charBuf )) {
+HXLINE( 185) _this6->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 185) _this6->charBuf->push(32);
+ }
+ }
+HXLINE( 186) this->write(f,value);
+HXLINE( 187) if ((i == last)) {
+HXLINE( 188) this->nind--;
+HXLINE( 189) if (this->pretty) {
+HXLINE( 189) ::StringBuf _this7 = this->buf;
+HXDLIN( 189) {
+HXLINE( 189) if (::hx::IsNull( _this7->charBuf )) {
+HXLINE( 189) _this7->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 189) _this7->charBuf->push(10);
+ }
+ }
+HXLINE( 190) if (this->pretty) {
+HXLINE( 190) ::String v2 = ::StringTools_obj::lpad(HX_("",00,00,00,00),this->indent,(this->nind * this->indent.length));
+HXDLIN( 190) {
+HXLINE( 190) ::StringBuf _this8 = this->buf;
+HXDLIN( 190) if (::hx::IsNotNull( _this8->charBuf )) {
+HXLINE( 190) _this8->flush();
+ }
+HXDLIN( 190) if (::hx::IsNull( _this8->b )) {
+HXLINE( 190) _this8->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(v2));
+ }
+ else {
+HXLINE( 190) ::Array< ::String > _this9 = _this8->b;
+HXDLIN( 190) _this9->push(::Std_obj::string(v2));
+ }
+ }
+ }
+ }
+ }
+ }
+HXLINE( 193) {
+HXLINE( 193) ::StringBuf _this10 = this->buf;
+HXDLIN( 193) {
+HXLINE( 193) if (::hx::IsNull( _this10->charBuf )) {
+HXLINE( 193) _this10->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 193) _this10->charBuf->push(125);
+ }
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(JsonPrinter_obj,fieldsString,(void))
+
+void JsonPrinter_obj::quote(::String s){
+ HX_STACKFRAME(&_hx_pos_9c6ac6b04494726e_196_quote)
+HXLINE( 203) {
+HXLINE( 203) ::StringBuf _this = this->buf;
+HXDLIN( 203) {
+HXLINE( 203) if (::hx::IsNull( _this->charBuf )) {
+HXLINE( 203) _this->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 203) _this->charBuf->push(34);
+ }
+ }
+HXLINE( 204) int i = 0;
+HXLINE( 205) int length = s.length;
+HXLINE( 209) while((i < length)){
+HXLINE( 210) i = (i + 1);
+HXDLIN( 210) int c = s.cca((i - 1));
+HXLINE( 211) switch((int)(c)){
+ case (int)8: {
+HXLINE( 223) ::StringBuf _this1 = this->buf;
+HXDLIN( 223) if (::hx::IsNotNull( _this1->charBuf )) {
+HXLINE( 223) _this1->flush();
+ }
+HXDLIN( 223) if (::hx::IsNull( _this1->b )) {
+HXLINE( 223) _this1->b = ::Array_obj< ::String >::fromData( _hx_array_data_f7b98003_12,1);
+ }
+ else {
+HXLINE( 223) _this1->b->push(HX_("\\b",86,50,00,00));
+ }
+ }
+ break;
+ case (int)9: {
+HXLINE( 221) ::StringBuf _this2 = this->buf;
+HXDLIN( 221) if (::hx::IsNotNull( _this2->charBuf )) {
+HXLINE( 221) _this2->flush();
+ }
+HXDLIN( 221) if (::hx::IsNull( _this2->b )) {
+HXLINE( 221) _this2->b = ::Array_obj< ::String >::fromData( _hx_array_data_f7b98003_13,1);
+ }
+ else {
+HXLINE( 221) _this2->b->push(HX_("\\t",98,50,00,00));
+ }
+ }
+ break;
+ case (int)10: {
+HXLINE( 217) ::StringBuf _this3 = this->buf;
+HXDLIN( 217) if (::hx::IsNotNull( _this3->charBuf )) {
+HXLINE( 217) _this3->flush();
+ }
+HXDLIN( 217) if (::hx::IsNull( _this3->b )) {
+HXLINE( 217) _this3->b = ::Array_obj< ::String >::fromData( _hx_array_data_f7b98003_14,1);
+ }
+ else {
+HXLINE( 217) _this3->b->push(HX_("\\n",92,50,00,00));
+ }
+ }
+ break;
+ case (int)12: {
+HXLINE( 225) ::StringBuf _this4 = this->buf;
+HXDLIN( 225) if (::hx::IsNotNull( _this4->charBuf )) {
+HXLINE( 225) _this4->flush();
+ }
+HXDLIN( 225) if (::hx::IsNull( _this4->b )) {
+HXLINE( 225) _this4->b = ::Array_obj< ::String >::fromData( _hx_array_data_f7b98003_15,1);
+ }
+ else {
+HXLINE( 225) _this4->b->push(HX_("\\f",8a,50,00,00));
+ }
+ }
+ break;
+ case (int)13: {
+HXLINE( 219) ::StringBuf _this5 = this->buf;
+HXDLIN( 219) if (::hx::IsNotNull( _this5->charBuf )) {
+HXLINE( 219) _this5->flush();
+ }
+HXDLIN( 219) if (::hx::IsNull( _this5->b )) {
+HXLINE( 219) _this5->b = ::Array_obj< ::String >::fromData( _hx_array_data_f7b98003_16,1);
+ }
+ else {
+HXLINE( 219) _this5->b->push(HX_("\\r",96,50,00,00));
+ }
+ }
+ break;
+ case (int)34: {
+HXLINE( 213) ::StringBuf _this6 = this->buf;
+HXDLIN( 213) if (::hx::IsNotNull( _this6->charBuf )) {
+HXLINE( 213) _this6->flush();
+ }
+HXDLIN( 213) if (::hx::IsNull( _this6->b )) {
+HXLINE( 213) _this6->b = ::Array_obj< ::String >::fromData( _hx_array_data_f7b98003_17,1);
+ }
+ else {
+HXLINE( 213) _this6->b->push(HX_("\\\"",46,50,00,00));
+ }
+ }
+ break;
+ case (int)92: {
+HXLINE( 215) ::StringBuf _this7 = this->buf;
+HXDLIN( 215) if (::hx::IsNotNull( _this7->charBuf )) {
+HXLINE( 215) _this7->flush();
+ }
+HXDLIN( 215) if (::hx::IsNull( _this7->b )) {
+HXLINE( 215) _this7->b = ::Array_obj< ::String >::fromData( _hx_array_data_f7b98003_18,1);
+ }
+ else {
+HXLINE( 215) _this7->b->push(HX_("\\\\",80,50,00,00));
+ }
+ }
+ break;
+ default:{
+HXLINE( 248) ::StringBuf _this8 = this->buf;
+HXDLIN( 248) if ((c >= 127)) {
+HXLINE( 248) ::String x = ::String::fromCharCode(c);
+HXDLIN( 248) if (::hx::IsNotNull( _this8->charBuf )) {
+HXLINE( 248) _this8->flush();
+ }
+HXDLIN( 248) if (::hx::IsNull( _this8->b )) {
+HXLINE( 248) _this8->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x));
+ }
+ else {
+HXLINE( 248) ::Array< ::String > _this9 = _this8->b;
+HXDLIN( 248) _this9->push(::Std_obj::string(x));
+ }
+ }
+ else {
+HXLINE( 248) if (::hx::IsNull( _this8->charBuf )) {
+HXLINE( 248) _this8->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 248) _this8->charBuf->push(c);
+ }
+ }
+ }
+ }
+HXLINE( 256) {
+HXLINE( 256) ::StringBuf _this10 = this->buf;
+HXDLIN( 256) {
+HXLINE( 256) if (::hx::IsNull( _this10->charBuf )) {
+HXLINE( 256) _this10->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 256) _this10->charBuf->push(34);
+ }
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(JsonPrinter_obj,quote,(void))
+
+::String JsonPrinter_obj::print( ::Dynamic o, ::Dynamic replacer,::String space){
+ HX_GC_STACKFRAME(&_hx_pos_9c6ac6b04494726e_44_print)
+HXLINE( 45) ::haxe::format::JsonPrinter printer = ::haxe::format::JsonPrinter_obj::__alloc( HX_CTX ,replacer,space);
+HXLINE( 46) printer->write(HX_("",00,00,00,00),o);
+HXLINE( 47) return printer->buf->toString();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC3(JsonPrinter_obj,print,return )
+
+
+::hx::ObjectPtr< JsonPrinter_obj > JsonPrinter_obj::__new( ::Dynamic replacer,::String space) {
+ ::hx::ObjectPtr< JsonPrinter_obj > __this = new JsonPrinter_obj();
+ __this->__construct(replacer,space);
+ return __this;
+}
+
+::hx::ObjectPtr< JsonPrinter_obj > JsonPrinter_obj::__alloc(::hx::Ctx *_hx_ctx, ::Dynamic replacer,::String space) {
+ JsonPrinter_obj *__this = (JsonPrinter_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(JsonPrinter_obj), true, "haxe.format.JsonPrinter"));
+ *(void **)__this = JsonPrinter_obj::_hx_vtable;
+ __this->__construct(replacer,space);
+ return __this;
+}
+
+JsonPrinter_obj::JsonPrinter_obj()
+{
+}
+
+void JsonPrinter_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(JsonPrinter);
+ HX_MARK_MEMBER_NAME(buf,"buf");
+ HX_MARK_MEMBER_NAME(replacer,"replacer");
+ HX_MARK_MEMBER_NAME(indent,"indent");
+ HX_MARK_MEMBER_NAME(pretty,"pretty");
+ HX_MARK_MEMBER_NAME(nind,"nind");
+ HX_MARK_END_CLASS();
+}
+
+void JsonPrinter_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(buf,"buf");
+ HX_VISIT_MEMBER_NAME(replacer,"replacer");
+ HX_VISIT_MEMBER_NAME(indent,"indent");
+ HX_VISIT_MEMBER_NAME(pretty,"pretty");
+ HX_VISIT_MEMBER_NAME(nind,"nind");
+}
+
+::hx::Val JsonPrinter_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"buf") ) { return ::hx::Val( buf ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"nind") ) { return ::hx::Val( nind ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"write") ) { return ::hx::Val( write_dyn() ); }
+ if (HX_FIELD_EQ(inName,"quote") ) { return ::hx::Val( quote_dyn() ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"indent") ) { return ::hx::Val( indent ); }
+ if (HX_FIELD_EQ(inName,"pretty") ) { return ::hx::Val( pretty ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"replacer") ) { return ::hx::Val( replacer ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"classString") ) { return ::hx::Val( classString_dyn() ); }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"fieldsString") ) { return ::hx::Val( fieldsString_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool JsonPrinter_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"print") ) { outValue = print_dyn(); return true; }
+ }
+ return false;
+}
+
+::hx::Val JsonPrinter_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"buf") ) { buf=inValue.Cast< ::StringBuf >(); return inValue; }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"nind") ) { nind=inValue.Cast< int >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"indent") ) { indent=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"pretty") ) { pretty=inValue.Cast< bool >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"replacer") ) { replacer=inValue.Cast< ::Dynamic >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void JsonPrinter_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("buf",33,c3,4a,00));
+ outFields->push(HX_("indent",6c,0c,f3,93));
+ outFields->push(HX_("pretty",b6,82,c1,ae));
+ outFields->push(HX_("nind",31,85,05,49));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo JsonPrinter_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::StringBuf */ ,(int)offsetof(JsonPrinter_obj,buf),HX_("buf",33,c3,4a,00)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(JsonPrinter_obj,replacer),HX_("replacer",be,e5,16,18)},
+ {::hx::fsString,(int)offsetof(JsonPrinter_obj,indent),HX_("indent",6c,0c,f3,93)},
+ {::hx::fsBool,(int)offsetof(JsonPrinter_obj,pretty),HX_("pretty",b6,82,c1,ae)},
+ {::hx::fsInt,(int)offsetof(JsonPrinter_obj,nind),HX_("nind",31,85,05,49)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *JsonPrinter_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String JsonPrinter_obj_sMemberFields[] = {
+ HX_("buf",33,c3,4a,00),
+ HX_("replacer",be,e5,16,18),
+ HX_("indent",6c,0c,f3,93),
+ HX_("pretty",b6,82,c1,ae),
+ HX_("nind",31,85,05,49),
+ HX_("write",df,6c,59,d0),
+ HX_("classString",29,0f,79,88),
+ HX_("fieldsString",2a,cc,56,34),
+ HX_("quote",3c,23,f2,5d),
+ ::String(null()) };
+
+::hx::Class JsonPrinter_obj::__mClass;
+
+static ::String JsonPrinter_obj_sStaticFields[] = {
+ HX_("print",2d,58,8b,c8),
+ ::String(null())
+};
+
+void JsonPrinter_obj::__register()
+{
+ JsonPrinter_obj _hx_dummy;
+ JsonPrinter_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.format.JsonPrinter",03,80,b9,f7);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &JsonPrinter_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(JsonPrinter_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(JsonPrinter_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< JsonPrinter_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = JsonPrinter_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = JsonPrinter_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
+} // end namespace format
diff --git a/Sources/c_snikket/src/haxe/http/HttpBase.cpp b/Sources/c_snikket/src/haxe/http/HttpBase.cpp
new file mode 100644
index 0000000..b377b85
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/http/HttpBase.cpp
@@ -0,0 +1,371 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_haxe_http_HttpBase
+#include <haxe/http/HttpBase.h>
+#endif
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+#ifndef INCLUDED_haxe_io_Encoding
+#include <haxe/io/Encoding.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_d3f7691e8659205f_71_new,"haxe.http.HttpBase","new",0x98384fa9,"haxe.http.HttpBase.new","/usr/local/lib/haxe/std/haxe/http/HttpBase.hx",71,0x0b31f0aa)
+HX_LOCAL_STACK_FRAME(_hx_pos_d3f7691e8659205f_85_setHeader,"haxe.http.HttpBase","setHeader",0xf9141ad8,"haxe.http.HttpBase.setHeader","/usr/local/lib/haxe/std/haxe/http/HttpBase.hx",85,0x0b31f0aa)
+HX_LOCAL_STACK_FRAME(_hx_pos_d3f7691e8659205f_142_setPostData,"haxe.http.HttpBase","setPostData",0x36d5f0b5,"haxe.http.HttpBase.setPostData","/usr/local/lib/haxe/std/haxe/http/HttpBase.hx",142,0x0b31f0aa)
+HX_LOCAL_STACK_FRAME(_hx_pos_d3f7691e8659205f_196___default_onData,"haxe.http.HttpBase","__default_onData",0xb2f8141e,"haxe.http.HttpBase.__default_onData","/usr/local/lib/haxe/std/haxe/http/HttpBase.hx",196,0x0b31f0aa)
+HX_LOCAL_STACK_FRAME(_hx_pos_d3f7691e8659205f_205___default_onBytes,"haxe.http.HttpBase","__default_onBytes",0xcf297ff7,"haxe.http.HttpBase.__default_onBytes","/usr/local/lib/haxe/std/haxe/http/HttpBase.hx",205,0x0b31f0aa)
+HX_LOCAL_STACK_FRAME(_hx_pos_d3f7691e8659205f_214___default_onError,"haxe.http.HttpBase","__default_onError",0x84bb4354,"haxe.http.HttpBase.__default_onError","/usr/local/lib/haxe/std/haxe/http/HttpBase.hx",214,0x0b31f0aa)
+HX_LOCAL_STACK_FRAME(_hx_pos_d3f7691e8659205f_223___default_onStatus,"haxe.http.HttpBase","__default_onStatus",0x53b30a26,"haxe.http.HttpBase.__default_onStatus","/usr/local/lib/haxe/std/haxe/http/HttpBase.hx",223,0x0b31f0aa)
+HX_LOCAL_STACK_FRAME(_hx_pos_d3f7691e8659205f_229_hasOnData,"haxe.http.HttpBase","hasOnData",0xc242adec,"haxe.http.HttpBase.hasOnData","/usr/local/lib/haxe/std/haxe/http/HttpBase.hx",229,0x0b31f0aa)
+HX_LOCAL_STACK_FRAME(_hx_pos_d3f7691e8659205f_232_success,"haxe.http.HttpBase","success",0xfe1e7d8c,"haxe.http.HttpBase.success","/usr/local/lib/haxe/std/haxe/http/HttpBase.hx",232,0x0b31f0aa)
+HX_LOCAL_STACK_FRAME(_hx_pos_d3f7691e8659205f_241_get_responseData,"haxe.http.HttpBase","get_responseData",0x92ecd8eb,"haxe.http.HttpBase.get_responseData","/usr/local/lib/haxe/std/haxe/http/HttpBase.hx",241,0x0b31f0aa)
+namespace haxe{
+namespace http{
+
+void HttpBase_obj::__construct(::String url){
+ HX_STACKFRAME(&_hx_pos_d3f7691e8659205f_71_new)
+HXLINE( 72) this->url = url;
+HXLINE( 73) this->headers = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 74) this->params = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 75) this->emptyOnData = this->onData;
+ }
+
+Dynamic HttpBase_obj::__CreateEmpty() { return new HttpBase_obj; }
+
+void *HttpBase_obj::_hx_vtable = 0;
+
+Dynamic HttpBase_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< HttpBase_obj > _hx_result = new HttpBase_obj();
+ _hx_result->__construct(inArgs[0]);
+ return _hx_result;
+}
+
+bool HttpBase_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x10c0921f;
+}
+
+void HttpBase_obj::setHeader(::String name,::String value){
+ HX_STACKFRAME(&_hx_pos_d3f7691e8659205f_85_setHeader)
+HXLINE( 86) {
+HXLINE( 86) int _g = 0;
+HXDLIN( 86) int _g1 = this->headers->length;
+HXDLIN( 86) while((_g < _g1)){
+HXLINE( 86) _g = (_g + 1);
+HXDLIN( 86) int i = (_g - 1);
+HXLINE( 87) if (::hx::IsEq( this->headers->__get(i)->__Field(HX_("name",4b,72,ff,48),::hx::paccDynamic),name )) {
+HXLINE( 88) this->headers[i] = ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("value",71,7f,b8,31),value)
+ ->setFixed(1,HX_("name",4b,72,ff,48),name));
+HXLINE( 89) return;
+ }
+ }
+ }
+HXLINE( 92) this->headers->push( ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("value",71,7f,b8,31),value)
+ ->setFixed(1,HX_("name",4b,72,ff,48),name)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(HttpBase_obj,setHeader,(void))
+
+void HttpBase_obj::setPostData(::String data){
+ HX_STACKFRAME(&_hx_pos_d3f7691e8659205f_142_setPostData)
+HXLINE( 143) this->postData = data;
+HXLINE( 144) this->postBytes = null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(HttpBase_obj,setPostData,(void))
+
+HX_BEGIN_DEFAULT_FUNC(__default_onData,HttpBase_obj)
+void _hx_run(::String data){
+ HX_STACKFRAME(&_hx_pos_d3f7691e8659205f_196___default_onData)
+ }
+HX_END_LOCAL_FUNC1((void))
+HX_END_DEFAULT_FUNC
+
+HX_BEGIN_DEFAULT_FUNC(__default_onBytes,HttpBase_obj)
+void _hx_run( ::haxe::io::Bytes data){
+ HX_STACKFRAME(&_hx_pos_d3f7691e8659205f_205___default_onBytes)
+ }
+HX_END_LOCAL_FUNC1((void))
+HX_END_DEFAULT_FUNC
+
+HX_BEGIN_DEFAULT_FUNC(__default_onError,HttpBase_obj)
+void _hx_run(::String msg){
+ HX_STACKFRAME(&_hx_pos_d3f7691e8659205f_214___default_onError)
+ }
+HX_END_LOCAL_FUNC1((void))
+HX_END_DEFAULT_FUNC
+
+HX_BEGIN_DEFAULT_FUNC(__default_onStatus,HttpBase_obj)
+void _hx_run(int status){
+ HX_STACKFRAME(&_hx_pos_d3f7691e8659205f_223___default_onStatus)
+ }
+HX_END_LOCAL_FUNC1((void))
+HX_END_DEFAULT_FUNC
+
+bool HttpBase_obj::hasOnData(){
+ HX_STACKFRAME(&_hx_pos_d3f7691e8659205f_229_hasOnData)
+HXDLIN( 229) return !(::Reflect_obj::compareMethods(this->onData,this->emptyOnData));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(HttpBase_obj,hasOnData,return )
+
+void HttpBase_obj::success( ::haxe::io::Bytes data){
+ HX_STACKFRAME(&_hx_pos_d3f7691e8659205f_232_success)
+HXLINE( 233) this->responseBytes = data;
+HXLINE( 234) this->responseAsString = null();
+HXLINE( 235) if (this->hasOnData()) {
+HXLINE( 236) ::Dynamic _hx_tmp = this->onData;
+HXDLIN( 236) _hx_tmp(this->get_responseData());
+ }
+HXLINE( 238) this->onBytes(this->responseBytes);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(HttpBase_obj,success,(void))
+
+::String HttpBase_obj::get_responseData(){
+ HX_STACKFRAME(&_hx_pos_d3f7691e8659205f_241_get_responseData)
+HXLINE( 242) bool _hx_tmp;
+HXDLIN( 242) if (::hx::IsNull( this->responseAsString )) {
+HXLINE( 242) _hx_tmp = ::hx::IsNotNull( this->responseBytes );
+ }
+ else {
+HXLINE( 242) _hx_tmp = false;
+ }
+HXDLIN( 242) if (_hx_tmp) {
+HXLINE( 246) this->responseAsString = this->responseBytes->getString(0,this->responseBytes->length,::haxe::io::Encoding_obj::UTF8_dyn());
+ }
+HXLINE( 249) return this->responseAsString;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(HttpBase_obj,get_responseData,return )
+
+
+void HttpBase_obj::__alloc_dynamic_functions(::hx::Ctx *_hx_ctx,HttpBase_obj *_hx_obj) {
+ if (!_hx_obj->onStatus.mPtr) _hx_obj->onStatus = new __default_onStatus(_hx_obj);
+ if (!_hx_obj->onError.mPtr) _hx_obj->onError = new __default_onError(_hx_obj);
+ if (!_hx_obj->onBytes.mPtr) _hx_obj->onBytes = new __default_onBytes(_hx_obj);
+ if (!_hx_obj->onData.mPtr) _hx_obj->onData = new __default_onData(_hx_obj);
+}
+::hx::ObjectPtr< HttpBase_obj > HttpBase_obj::__new(::String url) {
+ ::hx::ObjectPtr< HttpBase_obj > __this = new HttpBase_obj();
+ __this->__construct(url);
+ return __this;
+}
+
+::hx::ObjectPtr< HttpBase_obj > HttpBase_obj::__alloc(::hx::Ctx *_hx_ctx,::String url) {
+ HttpBase_obj *__this = (HttpBase_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(HttpBase_obj), true, "haxe.http.HttpBase"));
+ *(void **)__this = HttpBase_obj::_hx_vtable;
+ haxe::http::HttpBase_obj::__alloc_dynamic_functions(_hx_ctx,__this);
+ __this->__construct(url);
+ return __this;
+}
+
+HttpBase_obj::HttpBase_obj()
+{
+ onStatus = new __default_onStatus(this);
+ onError = new __default_onError(this);
+ onBytes = new __default_onBytes(this);
+ onData = new __default_onData(this);
+}
+
+void HttpBase_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(HttpBase);
+ HX_MARK_MEMBER_NAME(url,"url");
+ HX_MARK_MEMBER_NAME(responseBytes,"responseBytes");
+ HX_MARK_MEMBER_NAME(responseAsString,"responseAsString");
+ HX_MARK_MEMBER_NAME(postData,"postData");
+ HX_MARK_MEMBER_NAME(postBytes,"postBytes");
+ HX_MARK_MEMBER_NAME(headers,"headers");
+ HX_MARK_MEMBER_NAME(params,"params");
+ HX_MARK_MEMBER_NAME(emptyOnData,"emptyOnData");
+ HX_MARK_MEMBER_NAME(onData,"onData");
+ HX_MARK_MEMBER_NAME(onBytes,"onBytes");
+ HX_MARK_MEMBER_NAME(onError,"onError");
+ HX_MARK_MEMBER_NAME(onStatus,"onStatus");
+ HX_MARK_END_CLASS();
+}
+
+void HttpBase_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(url,"url");
+ HX_VISIT_MEMBER_NAME(responseBytes,"responseBytes");
+ HX_VISIT_MEMBER_NAME(responseAsString,"responseAsString");
+ HX_VISIT_MEMBER_NAME(postData,"postData");
+ HX_VISIT_MEMBER_NAME(postBytes,"postBytes");
+ HX_VISIT_MEMBER_NAME(headers,"headers");
+ HX_VISIT_MEMBER_NAME(params,"params");
+ HX_VISIT_MEMBER_NAME(emptyOnData,"emptyOnData");
+ HX_VISIT_MEMBER_NAME(onData,"onData");
+ HX_VISIT_MEMBER_NAME(onBytes,"onBytes");
+ HX_VISIT_MEMBER_NAME(onError,"onError");
+ HX_VISIT_MEMBER_NAME(onStatus,"onStatus");
+}
+
+::hx::Val HttpBase_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"url") ) { return ::hx::Val( url ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"params") ) { return ::hx::Val( params ); }
+ if (HX_FIELD_EQ(inName,"onData") ) { return ::hx::Val( onData ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"headers") ) { return ::hx::Val( headers ); }
+ if (HX_FIELD_EQ(inName,"onBytes") ) { return ::hx::Val( onBytes ); }
+ if (HX_FIELD_EQ(inName,"onError") ) { return ::hx::Val( onError ); }
+ if (HX_FIELD_EQ(inName,"success") ) { return ::hx::Val( success_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"postData") ) { return ::hx::Val( postData ); }
+ if (HX_FIELD_EQ(inName,"onStatus") ) { return ::hx::Val( onStatus ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"postBytes") ) { return ::hx::Val( postBytes ); }
+ if (HX_FIELD_EQ(inName,"setHeader") ) { return ::hx::Val( setHeader_dyn() ); }
+ if (HX_FIELD_EQ(inName,"hasOnData") ) { return ::hx::Val( hasOnData_dyn() ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"emptyOnData") ) { return ::hx::Val( emptyOnData ); }
+ if (HX_FIELD_EQ(inName,"setPostData") ) { return ::hx::Val( setPostData_dyn() ); }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"responseData") ) { if (inCallProp == ::hx::paccAlways) return ::hx::Val( get_responseData() ); }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"responseBytes") ) { return ::hx::Val( responseBytes ); }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"responseAsString") ) { return ::hx::Val( responseAsString ); }
+ if (HX_FIELD_EQ(inName,"get_responseData") ) { return ::hx::Val( get_responseData_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val HttpBase_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"url") ) { url=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"params") ) { params=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"onData") ) { onData=inValue.Cast< ::Dynamic >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"headers") ) { headers=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"onBytes") ) { onBytes=inValue.Cast< ::Dynamic >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"onError") ) { onError=inValue.Cast< ::Dynamic >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"postData") ) { postData=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"onStatus") ) { onStatus=inValue.Cast< ::Dynamic >(); return inValue; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"postBytes") ) { postBytes=inValue.Cast< ::haxe::io::Bytes >(); return inValue; }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"emptyOnData") ) { emptyOnData=inValue.Cast< ::Dynamic >(); return inValue; }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"responseBytes") ) { responseBytes=inValue.Cast< ::haxe::io::Bytes >(); return inValue; }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"responseAsString") ) { responseAsString=inValue.Cast< ::String >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void HttpBase_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("url",6f,2b,59,00));
+ outFields->push(HX_("responseData",4b,05,e9,c4));
+ outFields->push(HX_("responseBytes",2a,96,0b,70));
+ outFields->push(HX_("responseAsString",04,87,c8,68));
+ outFields->push(HX_("postData",aa,b6,a2,00));
+ outFields->push(HX_("postBytes",eb,17,cd,76));
+ outFields->push(HX_("headers",46,52,08,63));
+ outFields->push(HX_("params",46,fb,7a,ed));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo HttpBase_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(HttpBase_obj,url),HX_("url",6f,2b,59,00)},
+ {::hx::fsObject /* ::haxe::io::Bytes */ ,(int)offsetof(HttpBase_obj,responseBytes),HX_("responseBytes",2a,96,0b,70)},
+ {::hx::fsString,(int)offsetof(HttpBase_obj,responseAsString),HX_("responseAsString",04,87,c8,68)},
+ {::hx::fsString,(int)offsetof(HttpBase_obj,postData),HX_("postData",aa,b6,a2,00)},
+ {::hx::fsObject /* ::haxe::io::Bytes */ ,(int)offsetof(HttpBase_obj,postBytes),HX_("postBytes",eb,17,cd,76)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(HttpBase_obj,headers),HX_("headers",46,52,08,63)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(HttpBase_obj,params),HX_("params",46,fb,7a,ed)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(HttpBase_obj,emptyOnData),HX_("emptyOnData",56,f5,15,ad)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(HttpBase_obj,onData),HX_("onData",e9,5e,ed,e4)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(HttpBase_obj,onBytes),HX_("onBytes",cc,a6,d5,53)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(HttpBase_obj,onError),HX_("onError",29,6a,67,09)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(HttpBase_obj,onStatus),HX_("onStatus",b1,dd,a8,e5)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *HttpBase_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String HttpBase_obj_sMemberFields[] = {
+ HX_("url",6f,2b,59,00),
+ HX_("responseBytes",2a,96,0b,70),
+ HX_("responseAsString",04,87,c8,68),
+ HX_("postData",aa,b6,a2,00),
+ HX_("postBytes",eb,17,cd,76),
+ HX_("headers",46,52,08,63),
+ HX_("params",46,fb,7a,ed),
+ HX_("emptyOnData",56,f5,15,ad),
+ HX_("setHeader",cf,7e,a7,5c),
+ HX_("setPostData",6c,80,03,31),
+ HX_("onData",e9,5e,ed,e4),
+ HX_("onBytes",cc,a6,d5,53),
+ HX_("onError",29,6a,67,09),
+ HX_("onStatus",b1,dd,a8,e5),
+ HX_("hasOnData",e3,11,d6,25),
+ HX_("success",c3,25,4e,b8),
+ HX_("get_responseData",d4,f1,87,c9),
+ ::String(null()) };
+
+::hx::Class HttpBase_obj::__mClass;
+
+void HttpBase_obj::__register()
+{
+ HttpBase_obj _hx_dummy;
+ HttpBase_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.http.HttpBase",37,47,c3,bd);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(HttpBase_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< HttpBase_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = HttpBase_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = HttpBase_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
+} // end namespace http
diff --git a/Sources/c_snikket/src/haxe/io/Bytes.cpp b/Sources/c_snikket/src/haxe/io/Bytes.cpp
new file mode 100644
index 0000000..0e6e4aa
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/io/Bytes.cpp
@@ -0,0 +1,441 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_StringBuf
+#include <StringBuf.h>
+#endif
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+#ifndef INCLUDED_haxe_io_Encoding
+#include <haxe/io/Encoding.h>
+#endif
+#ifndef INCLUDED_haxe_io_Error
+#include <haxe/io/Error.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_dd4549ff8fa56c0b_34_new,"haxe.io.Bytes","new",0x3938d57d,"haxe.io.Bytes.new","/usr/local/lib/haxe/std/haxe/io/Bytes.hx",34,0xd68ef8f0)
+HX_LOCAL_STACK_FRAME(_hx_pos_dd4549ff8fa56c0b_90_blit,"haxe.io.Bytes","blit",0xd098ac78,"haxe.io.Bytes.blit","/usr/local/lib/haxe/std/haxe/io/Bytes.hx",90,0xd68ef8f0)
+HX_LOCAL_STACK_FRAME(_hx_pos_dd4549ff8fa56c0b_144_fill,"haxe.io.Bytes","fill",0xd33b42c6,"haxe.io.Bytes.fill","/usr/local/lib/haxe/std/haxe/io/Bytes.hx",144,0xd68ef8f0)
+HX_LOCAL_STACK_FRAME(_hx_pos_dd4549ff8fa56c0b_155_sub,"haxe.io.Bytes","sub",0x393cae9d,"haxe.io.Bytes.sub","/usr/local/lib/haxe/std/haxe/io/Bytes.hx",155,0xd68ef8f0)
+HX_LOCAL_STACK_FRAME(_hx_pos_dd4549ff8fa56c0b_415_getString,"haxe.io.Bytes","getString",0xa16beae4,"haxe.io.Bytes.getString","/usr/local/lib/haxe/std/haxe/io/Bytes.hx",415,0xd68ef8f0)
+HX_LOCAL_STACK_FRAME(_hx_pos_dd4549ff8fa56c0b_516_toString,"haxe.io.Bytes","toString",0x0291226f,"haxe.io.Bytes.toString","/usr/local/lib/haxe/std/haxe/io/Bytes.hx",516,0xd68ef8f0)
+HX_LOCAL_STACK_FRAME(_hx_pos_dd4549ff8fa56c0b_524_toHex,"haxe.io.Bytes","toHex",0x14173a7d,"haxe.io.Bytes.toHex","/usr/local/lib/haxe/std/haxe/io/Bytes.hx",524,0xd68ef8f0)
+HX_LOCAL_STACK_FRAME(_hx_pos_dd4549ff8fa56c0b_549_alloc,"haxe.io.Bytes","alloc",0x2199ead2,"haxe.io.Bytes.alloc","/usr/local/lib/haxe/std/haxe/io/Bytes.hx",549,0xd68ef8f0)
+HX_LOCAL_STACK_FRAME(_hx_pos_dd4549ff8fa56c0b_580_ofString,"haxe.io.Bytes","ofString",0x6e53bb0b,"haxe.io.Bytes.ofString","/usr/local/lib/haxe/std/haxe/io/Bytes.hx",580,0xd68ef8f0)
+HX_LOCAL_STACK_FRAME(_hx_pos_dd4549ff8fa56c0b_664_ofData,"haxe.io.Bytes","ofData",0x4f3005e4,"haxe.io.Bytes.ofData","/usr/local/lib/haxe/std/haxe/io/Bytes.hx",664,0xd68ef8f0)
+HX_LOCAL_STACK_FRAME(_hx_pos_dd4549ff8fa56c0b_673_ofHex,"haxe.io.Bytes","ofHex",0x2d236861,"haxe.io.Bytes.ofHex","/usr/local/lib/haxe/std/haxe/io/Bytes.hx",673,0xd68ef8f0)
+namespace haxe{
+namespace io{
+
+void Bytes_obj::__construct(int length,::Array< unsigned char > b){
+ HX_STACKFRAME(&_hx_pos_dd4549ff8fa56c0b_34_new)
+HXLINE( 35) this->length = length;
+HXLINE( 36) this->b = b;
+ }
+
+Dynamic Bytes_obj::__CreateEmpty() { return new Bytes_obj; }
+
+void *Bytes_obj::_hx_vtable = 0;
+
+Dynamic Bytes_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Bytes_obj > _hx_result = new Bytes_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1]);
+ return _hx_result;
+}
+
+bool Bytes_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x195c64b7;
+}
+
+void Bytes_obj::blit(int pos, ::haxe::io::Bytes src,int srcpos,int len){
+ HX_STACKFRAME(&_hx_pos_dd4549ff8fa56c0b_90_blit)
+HXLINE( 92) bool _hx_tmp;
+HXDLIN( 92) bool _hx_tmp1;
+HXDLIN( 92) bool _hx_tmp2;
+HXDLIN( 92) bool _hx_tmp3;
+HXDLIN( 92) if ((pos >= 0)) {
+HXLINE( 92) _hx_tmp3 = (srcpos < 0);
+ }
+ else {
+HXLINE( 92) _hx_tmp3 = true;
+ }
+HXDLIN( 92) if (!(_hx_tmp3)) {
+HXLINE( 92) _hx_tmp2 = (len < 0);
+ }
+ else {
+HXLINE( 92) _hx_tmp2 = true;
+ }
+HXDLIN( 92) if (!(_hx_tmp2)) {
+HXLINE( 92) _hx_tmp1 = ((pos + len) > this->length);
+ }
+ else {
+HXLINE( 92) _hx_tmp1 = true;
+ }
+HXDLIN( 92) if (!(_hx_tmp1)) {
+HXLINE( 92) _hx_tmp = ((srcpos + len) > src->length);
+ }
+ else {
+HXLINE( 92) _hx_tmp = true;
+ }
+HXDLIN( 92) if (_hx_tmp) {
+HXLINE( 93) HX_STACK_DO_THROW(::haxe::io::Error_obj::OutsideBounds_dyn());
+ }
+HXLINE( 111) this->b->blit(pos,src->b,srcpos,len);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC4(Bytes_obj,blit,(void))
+
+void Bytes_obj::fill(int pos,int len,int value){
+ HX_STACKFRAME(&_hx_pos_dd4549ff8fa56c0b_144_fill)
+HXDLIN( 144) ::__hxcpp_memory_memset(this->b,pos,len,value);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Bytes_obj,fill,(void))
+
+ ::haxe::io::Bytes Bytes_obj::sub(int pos,int len){
+ HX_GC_STACKFRAME(&_hx_pos_dd4549ff8fa56c0b_155_sub)
+HXLINE( 157) bool _hx_tmp;
+HXDLIN( 157) bool _hx_tmp1;
+HXDLIN( 157) if ((pos >= 0)) {
+HXLINE( 157) _hx_tmp1 = (len < 0);
+ }
+ else {
+HXLINE( 157) _hx_tmp1 = true;
+ }
+HXDLIN( 157) if (!(_hx_tmp1)) {
+HXLINE( 157) _hx_tmp = ((pos + len) > this->length);
+ }
+ else {
+HXLINE( 157) _hx_tmp = true;
+ }
+HXDLIN( 157) if (_hx_tmp) {
+HXLINE( 158) HX_STACK_DO_THROW(::haxe::io::Error_obj::OutsideBounds_dyn());
+ }
+HXLINE( 178) return ::haxe::io::Bytes_obj::__alloc( HX_CTX ,len,this->b->slice(pos,(pos + len)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Bytes_obj,sub,return )
+
+::String Bytes_obj::getString(int pos,int len, ::haxe::io::Encoding encoding){
+ HX_STACKFRAME(&_hx_pos_dd4549ff8fa56c0b_415_getString)
+HXLINE( 416) bool _hx_tmp = ::hx::IsNull( encoding );
+HXLINE( 419) bool _hx_tmp1;
+HXDLIN( 419) bool _hx_tmp2;
+HXDLIN( 419) if ((pos >= 0)) {
+HXLINE( 419) _hx_tmp2 = (len < 0);
+ }
+ else {
+HXLINE( 419) _hx_tmp2 = true;
+ }
+HXDLIN( 419) if (!(_hx_tmp2)) {
+HXLINE( 419) _hx_tmp1 = ((pos + len) > this->length);
+ }
+ else {
+HXLINE( 419) _hx_tmp1 = true;
+ }
+HXDLIN( 419) if (_hx_tmp1) {
+HXLINE( 420) HX_STACK_DO_THROW(::haxe::io::Error_obj::OutsideBounds_dyn());
+ }
+HXLINE( 428) ::String result = HX_("",00,00,00,00);
+HXLINE( 429) ::__hxcpp_string_of_bytes(this->b,result,pos,len);
+HXLINE( 430) return result;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Bytes_obj,getString,return )
+
+::String Bytes_obj::toString(){
+ HX_STACKFRAME(&_hx_pos_dd4549ff8fa56c0b_516_toString)
+HXDLIN( 516) return this->getString(0,this->length,null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Bytes_obj,toString,return )
+
+::String Bytes_obj::toHex(){
+ HX_GC_STACKFRAME(&_hx_pos_dd4549ff8fa56c0b_524_toHex)
+HXLINE( 525) ::StringBuf s = ::StringBuf_obj::__alloc( HX_CTX );
+HXLINE( 526) ::Array< ::Dynamic> chars = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 527) ::String str = HX_("0123456789abcdef",68,7e,d5,ef);
+HXLINE( 528) {
+HXLINE( 528) int _g = 0;
+HXDLIN( 528) int _g1 = str.length;
+HXDLIN( 528) while((_g < _g1)){
+HXLINE( 528) _g = (_g + 1);
+HXDLIN( 528) int i = (_g - 1);
+HXLINE( 529) chars->push(str.charCodeAt(i));
+ }
+ }
+HXLINE( 530) {
+HXLINE( 530) int _g2 = 0;
+HXDLIN( 530) int _g3 = this->length;
+HXDLIN( 530) while((_g2 < _g3)){
+HXLINE( 530) _g2 = (_g2 + 1);
+HXDLIN( 530) int i1 = (_g2 - 1);
+HXLINE( 531) int c = ( (int)(this->b->__get(i1)) );
+HXLINE( 532) {
+HXLINE( 532) int c1 = ( (int)(chars->__get((c >> 4))) );
+HXDLIN( 532) if ((c1 >= 127)) {
+HXLINE( 532) ::String x = ::String::fromCharCode(c1);
+HXDLIN( 532) if (::hx::IsNotNull( s->charBuf )) {
+HXLINE( 532) s->flush();
+ }
+HXDLIN( 532) if (::hx::IsNull( s->b )) {
+HXLINE( 532) s->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x));
+ }
+ else {
+HXLINE( 532) ::Array< ::String > s1 = s->b;
+HXDLIN( 532) s1->push(::Std_obj::string(x));
+ }
+ }
+ else {
+HXLINE( 532) if (::hx::IsNull( s->charBuf )) {
+HXLINE( 532) s->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 532) s->charBuf->push(c1);
+ }
+ }
+HXLINE( 533) {
+HXLINE( 533) int c2 = ( (int)(chars->__get((c & 15))) );
+HXDLIN( 533) if ((c2 >= 127)) {
+HXLINE( 533) ::String x1 = ::String::fromCharCode(c2);
+HXDLIN( 533) if (::hx::IsNotNull( s->charBuf )) {
+HXLINE( 533) s->flush();
+ }
+HXDLIN( 533) if (::hx::IsNull( s->b )) {
+HXLINE( 533) s->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x1));
+ }
+ else {
+HXLINE( 533) ::Array< ::String > s2 = s->b;
+HXDLIN( 533) s2->push(::Std_obj::string(x1));
+ }
+ }
+ else {
+HXLINE( 533) if (::hx::IsNull( s->charBuf )) {
+HXLINE( 533) s->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 533) s->charBuf->push(c2);
+ }
+ }
+ }
+ }
+HXLINE( 535) return s->toString();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Bytes_obj,toHex,return )
+
+ ::haxe::io::Bytes Bytes_obj::alloc(int length){
+ HX_GC_STACKFRAME(&_hx_pos_dd4549ff8fa56c0b_549_alloc)
+HXLINE( 557) ::Array< unsigned char > a = ::Array_obj< unsigned char >::__new();
+HXLINE( 558) if ((length > 0)) {
+HXLINE( 559) _hx_array_set_size_exact(a,length);
+ }
+HXLINE( 560) return ::haxe::io::Bytes_obj::__alloc( HX_CTX ,length,a);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Bytes_obj,alloc,return )
+
+ ::haxe::io::Bytes Bytes_obj::ofString(::String s, ::haxe::io::Encoding encoding){
+ HX_GC_STACKFRAME(&_hx_pos_dd4549ff8fa56c0b_580_ofString)
+HXLINE( 591) ::Array< unsigned char > a = ::Array_obj< unsigned char >::__new();
+HXLINE( 592) ::__hxcpp_bytes_of_string(a,s);
+HXLINE( 593) return ::haxe::io::Bytes_obj::__alloc( HX_CTX ,a->length,a);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Bytes_obj,ofString,return )
+
+ ::haxe::io::Bytes Bytes_obj::ofData(::Array< unsigned char > b){
+ HX_GC_STACKFRAME(&_hx_pos_dd4549ff8fa56c0b_664_ofData)
+HXDLIN( 664) return ::haxe::io::Bytes_obj::__alloc( HX_CTX ,b->length,b);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Bytes_obj,ofData,return )
+
+ ::haxe::io::Bytes Bytes_obj::ofHex(::String s){
+ HX_STACKFRAME(&_hx_pos_dd4549ff8fa56c0b_673_ofHex)
+HXLINE( 674) int len = s.length;
+HXLINE( 675) if (((len & 1) != 0)) {
+HXLINE( 676) HX_STACK_DO_THROW(HX_("Not a hex string (odd number of digits)",96,4b,d1,a4));
+ }
+HXLINE( 677) ::haxe::io::Bytes ret = ::haxe::io::Bytes_obj::alloc((len >> 1));
+HXLINE( 678) {
+HXLINE( 678) int _g = 0;
+HXDLIN( 678) int _g1 = ret->length;
+HXDLIN( 678) while((_g < _g1)){
+HXLINE( 678) _g = (_g + 1);
+HXDLIN( 678) int i = (_g - 1);
+HXLINE( 679) int high = s.cca((i * 2));
+HXLINE( 680) int low = s.cca(((i * 2) + 1));
+HXLINE( 681) high = ((high & 15) + (((high & 64) >> 6) * 9));
+HXLINE( 682) low = ((low & 15) + (((low & 64) >> 6) * 9));
+HXLINE( 683) ret->b[i] = ( (unsigned char)((((high << 4) | low) & 255)) );
+ }
+ }
+HXLINE( 686) return ret;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Bytes_obj,ofHex,return )
+
+
+::hx::ObjectPtr< Bytes_obj > Bytes_obj::__new(int length,::Array< unsigned char > b) {
+ ::hx::ObjectPtr< Bytes_obj > __this = new Bytes_obj();
+ __this->__construct(length,b);
+ return __this;
+}
+
+::hx::ObjectPtr< Bytes_obj > Bytes_obj::__alloc(::hx::Ctx *_hx_ctx,int length,::Array< unsigned char > b) {
+ Bytes_obj *__this = (Bytes_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Bytes_obj), true, "haxe.io.Bytes"));
+ *(void **)__this = Bytes_obj::_hx_vtable;
+ __this->__construct(length,b);
+ return __this;
+}
+
+Bytes_obj::Bytes_obj()
+{
+}
+
+void Bytes_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(Bytes);
+ HX_MARK_MEMBER_NAME(length,"length");
+ HX_MARK_MEMBER_NAME(b,"b");
+ HX_MARK_END_CLASS();
+}
+
+void Bytes_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(length,"length");
+ HX_VISIT_MEMBER_NAME(b,"b");
+}
+
+::hx::Val Bytes_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 1:
+ if (HX_FIELD_EQ(inName,"b") ) { return ::hx::Val( b ); }
+ break;
+ case 3:
+ if (HX_FIELD_EQ(inName,"sub") ) { return ::hx::Val( sub_dyn() ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"blit") ) { return ::hx::Val( blit_dyn() ); }
+ if (HX_FIELD_EQ(inName,"fill") ) { return ::hx::Val( fill_dyn() ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"toHex") ) { return ::hx::Val( toHex_dyn() ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"length") ) { return ::hx::Val( length ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"toString") ) { return ::hx::Val( toString_dyn() ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"getString") ) { return ::hx::Val( getString_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool Bytes_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"alloc") ) { outValue = alloc_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"ofHex") ) { outValue = ofHex_dyn(); return true; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"ofData") ) { outValue = ofData_dyn(); return true; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"ofString") ) { outValue = ofString_dyn(); return true; }
+ }
+ return false;
+}
+
+::hx::Val Bytes_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 1:
+ if (HX_FIELD_EQ(inName,"b") ) { b=inValue.Cast< ::Array< unsigned char > >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"length") ) { length=inValue.Cast< int >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void Bytes_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("length",e6,94,07,9f));
+ outFields->push(HX_("b",62,00,00,00));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Bytes_obj_sMemberStorageInfo[] = {
+ {::hx::fsInt,(int)offsetof(Bytes_obj,length),HX_("length",e6,94,07,9f)},
+ {::hx::fsObject /* ::Array< unsigned char > */ ,(int)offsetof(Bytes_obj,b),HX_("b",62,00,00,00)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *Bytes_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Bytes_obj_sMemberFields[] = {
+ HX_("length",e6,94,07,9f),
+ HX_("b",62,00,00,00),
+ HX_("blit",35,38,19,41),
+ HX_("fill",83,ce,bb,43),
+ HX_("sub",80,a9,57,00),
+ HX_("getString",07,b2,86,8d),
+ HX_("toString",ac,d0,6e,38),
+ HX_("toHex",20,f4,10,14),
+ ::String(null()) };
+
+::hx::Class Bytes_obj::__mClass;
+
+static ::String Bytes_obj_sStaticFields[] = {
+ HX_("alloc",75,a4,93,21),
+ HX_("ofString",48,69,31,a4),
+ HX_("ofData",e1,ba,b8,49),
+ HX_("ofHex",04,22,1d,2d),
+ ::String(null())
+};
+
+void Bytes_obj::__register()
+{
+ Bytes_obj _hx_dummy;
+ Bytes_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.io.Bytes",0b,53,6f,9f);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Bytes_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Bytes_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Bytes_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Bytes_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Bytes_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Bytes_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
+} // end namespace io
diff --git a/Sources/c_snikket/src/haxe/io/BytesBuffer.cpp b/Sources/c_snikket/src/haxe/io/BytesBuffer.cpp
new file mode 100644
index 0000000..aa069a8
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/io/BytesBuffer.cpp
@@ -0,0 +1,142 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+#ifndef INCLUDED_haxe_io_BytesBuffer
+#include <haxe/io/BytesBuffer.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_20ad791bf00c982a_52_new,"haxe.io.BytesBuffer","new",0x022790dd,"haxe.io.BytesBuffer.new","/usr/local/lib/haxe/std/haxe/io/BytesBuffer.hx",52,0xad7eed50)
+HX_LOCAL_STACK_FRAME(_hx_pos_20ad791bf00c982a_202_getBytes,"haxe.io.BytesBuffer","getBytes",0x1e9f7258,"haxe.io.BytesBuffer.getBytes","/usr/local/lib/haxe/std/haxe/io/BytesBuffer.hx",202,0xad7eed50)
+namespace haxe{
+namespace io{
+
+void BytesBuffer_obj::__construct(){
+ HX_STACKFRAME(&_hx_pos_20ad791bf00c982a_52_new)
+HXDLIN( 52) this->b = ::Array_obj< unsigned char >::__new();
+ }
+
+Dynamic BytesBuffer_obj::__CreateEmpty() { return new BytesBuffer_obj; }
+
+void *BytesBuffer_obj::_hx_vtable = 0;
+
+Dynamic BytesBuffer_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< BytesBuffer_obj > _hx_result = new BytesBuffer_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool BytesBuffer_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x183160df;
+}
+
+ ::haxe::io::Bytes BytesBuffer_obj::getBytes(){
+ HX_GC_STACKFRAME(&_hx_pos_20ad791bf00c982a_202_getBytes)
+HXLINE( 220) ::haxe::io::Bytes bytes = ::haxe::io::Bytes_obj::__alloc( HX_CTX ,this->b->length,this->b);
+HXLINE( 222) this->b = null();
+HXLINE( 223) return bytes;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(BytesBuffer_obj,getBytes,return )
+
+
+::hx::ObjectPtr< BytesBuffer_obj > BytesBuffer_obj::__new() {
+ ::hx::ObjectPtr< BytesBuffer_obj > __this = new BytesBuffer_obj();
+ __this->__construct();
+ return __this;
+}
+
+::hx::ObjectPtr< BytesBuffer_obj > BytesBuffer_obj::__alloc(::hx::Ctx *_hx_ctx) {
+ BytesBuffer_obj *__this = (BytesBuffer_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(BytesBuffer_obj), true, "haxe.io.BytesBuffer"));
+ *(void **)__this = BytesBuffer_obj::_hx_vtable;
+ __this->__construct();
+ return __this;
+}
+
+BytesBuffer_obj::BytesBuffer_obj()
+{
+}
+
+void BytesBuffer_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(BytesBuffer);
+ HX_MARK_MEMBER_NAME(b,"b");
+ HX_MARK_END_CLASS();
+}
+
+void BytesBuffer_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(b,"b");
+}
+
+::hx::Val BytesBuffer_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 1:
+ if (HX_FIELD_EQ(inName,"b") ) { return ::hx::Val( b ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"getBytes") ) { return ::hx::Val( getBytes_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val BytesBuffer_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 1:
+ if (HX_FIELD_EQ(inName,"b") ) { b=inValue.Cast< ::Array< unsigned char > >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void BytesBuffer_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("b",62,00,00,00));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo BytesBuffer_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::Array< unsigned char > */ ,(int)offsetof(BytesBuffer_obj,b),HX_("b",62,00,00,00)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *BytesBuffer_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String BytesBuffer_obj_sMemberFields[] = {
+ HX_("b",62,00,00,00),
+ HX_("getBytes",f5,17,6f,1d),
+ ::String(null()) };
+
+::hx::Class BytesBuffer_obj::__mClass;
+
+void BytesBuffer_obj::__register()
+{
+ BytesBuffer_obj _hx_dummy;
+ BytesBuffer_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.io.BytesBuffer",6b,de,c4,a0);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(BytesBuffer_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< BytesBuffer_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = BytesBuffer_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = BytesBuffer_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
+} // end namespace io
diff --git a/Sources/c_snikket/src/haxe/io/BytesInput.cpp b/Sources/c_snikket/src/haxe/io/BytesInput.cpp
new file mode 100644
index 0000000..629c960
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/io/BytesInput.cpp
@@ -0,0 +1,266 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+#ifndef INCLUDED_haxe_io_BytesInput
+#include <haxe/io/BytesInput.h>
+#endif
+#ifndef INCLUDED_haxe_io_Eof
+#include <haxe/io/Eof.h>
+#endif
+#ifndef INCLUDED_haxe_io_Error
+#include <haxe/io/Error.h>
+#endif
+#ifndef INCLUDED_haxe_io_Input
+#include <haxe/io/Input.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_3a888173c8ad0c39_39_new,"haxe.io.BytesInput","new",0x7fa18571,"haxe.io.BytesInput.new","/usr/local/lib/haxe/std/haxe/io/BytesInput.hx",39,0x977e71a2)
+HX_LOCAL_STACK_FRAME(_hx_pos_3a888173c8ad0c39_96_readByte,"haxe.io.BytesInput","readByte",0xb70e46cd,"haxe.io.BytesInput.readByte","/usr/local/lib/haxe/std/haxe/io/BytesInput.hx",96,0x977e71a2)
+HX_LOCAL_STACK_FRAME(_hx_pos_3a888173c8ad0c39_119_readBytes,"haxe.io.BytesInput","readBytes",0x756fad06,"haxe.io.BytesInput.readBytes","/usr/local/lib/haxe/std/haxe/io/BytesInput.hx",119,0x977e71a2)
+namespace haxe{
+namespace io{
+
+void BytesInput_obj::__construct( ::haxe::io::Bytes b, ::Dynamic pos, ::Dynamic len){
+ HX_STACKFRAME(&_hx_pos_3a888173c8ad0c39_39_new)
+HXLINE( 40) if (::hx::IsNull( pos )) {
+HXLINE( 41) pos = 0;
+ }
+HXLINE( 42) if (::hx::IsNull( len )) {
+HXLINE( 43) len = (b->length - ( (int)(pos) ));
+ }
+HXLINE( 44) bool _hx_tmp;
+HXDLIN( 44) bool _hx_tmp1;
+HXDLIN( 44) if (::hx::IsGreaterEq( pos,0 )) {
+HXLINE( 44) _hx_tmp1 = ::hx::IsLess( len,0 );
+ }
+ else {
+HXLINE( 44) _hx_tmp1 = true;
+ }
+HXDLIN( 44) if (!(_hx_tmp1)) {
+HXLINE( 44) _hx_tmp = ((pos + len) > b->length);
+ }
+ else {
+HXLINE( 44) _hx_tmp = true;
+ }
+HXDLIN( 44) if (_hx_tmp) {
+HXLINE( 45) HX_STACK_DO_THROW(::haxe::io::Error_obj::OutsideBounds_dyn());
+ }
+HXLINE( 57) this->b = b->b;
+HXLINE( 58) this->pos = ( (int)(pos) );
+HXLINE( 59) this->len = ( (int)(len) );
+HXLINE( 60) this->totlen = ( (int)(len) );
+ }
+
+Dynamic BytesInput_obj::__CreateEmpty() { return new BytesInput_obj; }
+
+void *BytesInput_obj::_hx_vtable = 0;
+
+Dynamic BytesInput_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< BytesInput_obj > _hx_result = new BytesInput_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2]);
+ return _hx_result;
+}
+
+bool BytesInput_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x19e22056) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x19e22056;
+ } else {
+ return inClassId==(int)0x7e26810b;
+ }
+}
+
+int BytesInput_obj::readByte(){
+ HX_GC_STACKFRAME(&_hx_pos_3a888173c8ad0c39_96_readByte)
+HXLINE( 100) if ((this->len == 0)) {
+HXLINE( 101) HX_STACK_DO_THROW( ::haxe::io::Eof_obj::__alloc( HX_CTX ));
+ }
+HXLINE( 102) this->len--;
+HXLINE( 106) return ( (int)(this->b->__get(this->pos++)) );
+ }
+
+
+int BytesInput_obj::readBytes( ::haxe::io::Bytes buf,int pos,int len){
+ HX_GC_STACKFRAME(&_hx_pos_3a888173c8ad0c39_119_readBytes)
+HXLINE( 121) bool _hx_tmp;
+HXDLIN( 121) bool _hx_tmp1;
+HXDLIN( 121) if ((pos >= 0)) {
+HXLINE( 121) _hx_tmp1 = (len < 0);
+ }
+ else {
+HXLINE( 121) _hx_tmp1 = true;
+ }
+HXDLIN( 121) if (!(_hx_tmp1)) {
+HXLINE( 121) _hx_tmp = ((pos + len) > buf->length);
+ }
+ else {
+HXLINE( 121) _hx_tmp = true;
+ }
+HXDLIN( 121) if (_hx_tmp) {
+HXLINE( 122) HX_STACK_DO_THROW(::haxe::io::Error_obj::OutsideBounds_dyn());
+ }
+HXLINE( 151) bool _hx_tmp2;
+HXDLIN( 151) if ((this->len == 0)) {
+HXLINE( 151) _hx_tmp2 = (len > 0);
+ }
+ else {
+HXLINE( 151) _hx_tmp2 = false;
+ }
+HXDLIN( 151) if (_hx_tmp2) {
+HXLINE( 152) HX_STACK_DO_THROW( ::haxe::io::Eof_obj::__alloc( HX_CTX ));
+ }
+HXLINE( 153) if ((this->len < len)) {
+HXLINE( 154) len = this->len;
+ }
+HXLINE( 163) ::Array< unsigned char > b1 = this->b;
+HXLINE( 164) ::Array< unsigned char > b2 = buf->b;
+HXLINE( 165) {
+HXLINE( 165) int _g = 0;
+HXDLIN( 165) int _g1 = len;
+HXDLIN( 165) while((_g < _g1)){
+HXLINE( 165) _g = (_g + 1);
+HXDLIN( 165) int i = (_g - 1);
+HXLINE( 166) b2[(pos + i)] = b1->__get((this->pos + i));
+ }
+ }
+HXLINE( 168) ::haxe::io::BytesInput _hx_tmp3 = ::hx::ObjectPtr<OBJ_>(this);
+HXDLIN( 168) _hx_tmp3->pos = (_hx_tmp3->pos + len);
+HXLINE( 169) ::haxe::io::BytesInput _hx_tmp4 = ::hx::ObjectPtr<OBJ_>(this);
+HXDLIN( 169) _hx_tmp4->len = (_hx_tmp4->len - len);
+HXLINE( 171) return len;
+ }
+
+
+
+::hx::ObjectPtr< BytesInput_obj > BytesInput_obj::__new( ::haxe::io::Bytes b, ::Dynamic pos, ::Dynamic len) {
+ ::hx::ObjectPtr< BytesInput_obj > __this = new BytesInput_obj();
+ __this->__construct(b,pos,len);
+ return __this;
+}
+
+::hx::ObjectPtr< BytesInput_obj > BytesInput_obj::__alloc(::hx::Ctx *_hx_ctx, ::haxe::io::Bytes b, ::Dynamic pos, ::Dynamic len) {
+ BytesInput_obj *__this = (BytesInput_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(BytesInput_obj), true, "haxe.io.BytesInput"));
+ *(void **)__this = BytesInput_obj::_hx_vtable;
+ __this->__construct(b,pos,len);
+ return __this;
+}
+
+BytesInput_obj::BytesInput_obj()
+{
+}
+
+void BytesInput_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(BytesInput);
+ HX_MARK_MEMBER_NAME(b,"b");
+ HX_MARK_MEMBER_NAME(pos,"pos");
+ HX_MARK_MEMBER_NAME(len,"len");
+ HX_MARK_MEMBER_NAME(totlen,"totlen");
+ HX_MARK_END_CLASS();
+}
+
+void BytesInput_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(b,"b");
+ HX_VISIT_MEMBER_NAME(pos,"pos");
+ HX_VISIT_MEMBER_NAME(len,"len");
+ HX_VISIT_MEMBER_NAME(totlen,"totlen");
+}
+
+::hx::Val BytesInput_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 1:
+ if (HX_FIELD_EQ(inName,"b") ) { return ::hx::Val( b ); }
+ break;
+ case 3:
+ if (HX_FIELD_EQ(inName,"pos") ) { return ::hx::Val( pos ); }
+ if (HX_FIELD_EQ(inName,"len") ) { return ::hx::Val( len ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"totlen") ) { return ::hx::Val( totlen ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"readByte") ) { return ::hx::Val( readByte_dyn() ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"readBytes") ) { return ::hx::Val( readBytes_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val BytesInput_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 1:
+ if (HX_FIELD_EQ(inName,"b") ) { b=inValue.Cast< ::Array< unsigned char > >(); return inValue; }
+ break;
+ case 3:
+ if (HX_FIELD_EQ(inName,"pos") ) { pos=inValue.Cast< int >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"len") ) { len=inValue.Cast< int >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"totlen") ) { totlen=inValue.Cast< int >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void BytesInput_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("b",62,00,00,00));
+ outFields->push(HX_("pos",94,5d,55,00));
+ outFields->push(HX_("len",d5,4b,52,00));
+ outFields->push(HX_("totlen",dc,4a,df,97));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo BytesInput_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::Array< unsigned char > */ ,(int)offsetof(BytesInput_obj,b),HX_("b",62,00,00,00)},
+ {::hx::fsInt,(int)offsetof(BytesInput_obj,pos),HX_("pos",94,5d,55,00)},
+ {::hx::fsInt,(int)offsetof(BytesInput_obj,len),HX_("len",d5,4b,52,00)},
+ {::hx::fsInt,(int)offsetof(BytesInput_obj,totlen),HX_("totlen",dc,4a,df,97)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *BytesInput_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String BytesInput_obj_sMemberFields[] = {
+ HX_("b",62,00,00,00),
+ HX_("pos",94,5d,55,00),
+ HX_("len",d5,4b,52,00),
+ HX_("totlen",dc,4a,df,97),
+ HX_("readByte",7e,f9,1a,69),
+ HX_("readBytes",35,55,7f,8e),
+ ::String(null()) };
+
+::hx::Class BytesInput_obj::__mClass;
+
+void BytesInput_obj::__register()
+{
+ BytesInput_obj _hx_dummy;
+ BytesInput_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.io.BytesInput",ff,f8,5b,64);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(BytesInput_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< BytesInput_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = BytesInput_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = BytesInput_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
+} // end namespace io
diff --git a/Sources/c_snikket/src/haxe/io/BytesOutput.cpp b/Sources/c_snikket/src/haxe/io/BytesOutput.cpp
new file mode 100644
index 0000000..c48d74b
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/io/BytesOutput.cpp
@@ -0,0 +1,206 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+#ifndef INCLUDED_haxe_io_BytesBuffer
+#include <haxe/io/BytesBuffer.h>
+#endif
+#ifndef INCLUDED_haxe_io_BytesOutput
+#include <haxe/io/BytesOutput.h>
+#endif
+#ifndef INCLUDED_haxe_io_Error
+#include <haxe/io/Error.h>
+#endif
+#ifndef INCLUDED_haxe_io_Output
+#include <haxe/io/Output.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_d4ef99928b9cced0_40_new,"haxe.io.BytesOutput","new",0x130b775e,"haxe.io.BytesOutput.new","/usr/local/lib/haxe/std/haxe/io/BytesOutput.hx",40,0xe13b11ef)
+HX_LOCAL_STACK_FRAME(_hx_pos_d4ef99928b9cced0_55_writeByte,"haxe.io.BytesOutput","writeByte",0xed1b0d05,"haxe.io.BytesOutput.writeByte","/usr/local/lib/haxe/std/haxe/io/BytesOutput.hx",55,0xe13b11ef)
+HX_LOCAL_STACK_FRAME(_hx_pos_d4ef99928b9cced0_59_writeBytes,"haxe.io.BytesOutput","writeBytes",0x8a9057ce,"haxe.io.BytesOutput.writeBytes","/usr/local/lib/haxe/std/haxe/io/BytesOutput.hx",59,0xe13b11ef)
+HX_LOCAL_STACK_FRAME(_hx_pos_d4ef99928b9cced0_143_getBytes,"haxe.io.BytesOutput","getBytes",0x9fe35837,"haxe.io.BytesOutput.getBytes","/usr/local/lib/haxe/std/haxe/io/BytesOutput.hx",143,0xe13b11ef)
+namespace haxe{
+namespace io{
+
+void BytesOutput_obj::__construct(){
+ HX_GC_STACKFRAME(&_hx_pos_d4ef99928b9cced0_40_new)
+HXDLIN( 40) this->b = ::haxe::io::BytesBuffer_obj::__alloc( HX_CTX );
+ }
+
+Dynamic BytesOutput_obj::__CreateEmpty() { return new BytesOutput_obj; }
+
+void *BytesOutput_obj::_hx_vtable = 0;
+
+Dynamic BytesOutput_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< BytesOutput_obj > _hx_result = new BytesOutput_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool BytesOutput_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x0a55a26d) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x0a55a26d;
+ } else {
+ return inClassId==(int)0x541db2e0;
+ }
+}
+
+void BytesOutput_obj::writeByte(int c){
+ HX_STACKFRAME(&_hx_pos_d4ef99928b9cced0_55_writeByte)
+HXDLIN( 55) this->b->b->push(c);
+ }
+
+
+int BytesOutput_obj::writeBytes( ::haxe::io::Bytes buf,int pos,int len){
+ HX_STACKFRAME(&_hx_pos_d4ef99928b9cced0_59_writeBytes)
+HXLINE( 65) {
+HXLINE( 65) ::haxe::io::BytesBuffer _this = this->b;
+HXDLIN( 65) bool _hx_tmp;
+HXDLIN( 65) bool _hx_tmp1;
+HXDLIN( 65) if ((pos >= 0)) {
+HXLINE( 65) _hx_tmp1 = (len < 0);
+ }
+ else {
+HXLINE( 65) _hx_tmp1 = true;
+ }
+HXDLIN( 65) if (!(_hx_tmp1)) {
+HXLINE( 65) _hx_tmp = ((pos + len) > buf->length);
+ }
+ else {
+HXLINE( 65) _hx_tmp = true;
+ }
+HXDLIN( 65) if (_hx_tmp) {
+HXLINE( 65) HX_STACK_DO_THROW(::haxe::io::Error_obj::OutsideBounds_dyn());
+ }
+HXDLIN( 65) ::Array< unsigned char > b1 = _this->b;
+HXDLIN( 65) ::Array< unsigned char > b2 = buf->b;
+HXDLIN( 65) {
+HXLINE( 65) int _g = pos;
+HXDLIN( 65) int _g1 = (pos + len);
+HXDLIN( 65) while((_g < _g1)){
+HXLINE( 65) _g = (_g + 1);
+HXDLIN( 65) int i = (_g - 1);
+HXDLIN( 65) _this->b->push(b2->__get(i));
+ }
+ }
+ }
+HXLINE( 67) return len;
+ }
+
+
+ ::haxe::io::Bytes BytesOutput_obj::getBytes(){
+ HX_STACKFRAME(&_hx_pos_d4ef99928b9cced0_143_getBytes)
+HXDLIN( 143) return this->b->getBytes();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(BytesOutput_obj,getBytes,return )
+
+
+::hx::ObjectPtr< BytesOutput_obj > BytesOutput_obj::__new() {
+ ::hx::ObjectPtr< BytesOutput_obj > __this = new BytesOutput_obj();
+ __this->__construct();
+ return __this;
+}
+
+::hx::ObjectPtr< BytesOutput_obj > BytesOutput_obj::__alloc(::hx::Ctx *_hx_ctx) {
+ BytesOutput_obj *__this = (BytesOutput_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(BytesOutput_obj), true, "haxe.io.BytesOutput"));
+ *(void **)__this = BytesOutput_obj::_hx_vtable;
+ __this->__construct();
+ return __this;
+}
+
+BytesOutput_obj::BytesOutput_obj()
+{
+}
+
+void BytesOutput_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(BytesOutput);
+ HX_MARK_MEMBER_NAME(b,"b");
+ HX_MARK_END_CLASS();
+}
+
+void BytesOutput_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(b,"b");
+}
+
+::hx::Val BytesOutput_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 1:
+ if (HX_FIELD_EQ(inName,"b") ) { return ::hx::Val( b ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"getBytes") ) { return ::hx::Val( getBytes_dyn() ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"writeByte") ) { return ::hx::Val( writeByte_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"writeBytes") ) { return ::hx::Val( writeBytes_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val BytesOutput_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 1:
+ if (HX_FIELD_EQ(inName,"b") ) { b=inValue.Cast< ::haxe::io::BytesBuffer >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void BytesOutput_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("b",62,00,00,00));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo BytesOutput_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::haxe::io::BytesBuffer */ ,(int)offsetof(BytesOutput_obj,b),HX_("b",62,00,00,00)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *BytesOutput_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String BytesOutput_obj_sMemberFields[] = {
+ HX_("b",62,00,00,00),
+ HX_("writeByte",87,13,d7,49),
+ HX_("writeBytes",0c,03,5a,52),
+ HX_("getBytes",f5,17,6f,1d),
+ ::String(null()) };
+
+::hx::Class BytesOutput_obj::__mClass;
+
+void BytesOutput_obj::__register()
+{
+ BytesOutput_obj _hx_dummy;
+ BytesOutput_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.io.BytesOutput",6c,30,b1,dc);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(BytesOutput_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< BytesOutput_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = BytesOutput_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = BytesOutput_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
+} // end namespace io
diff --git a/Sources/c_snikket/src/haxe/io/Encoding.cpp b/Sources/c_snikket/src/haxe/io/Encoding.cpp
new file mode 100644
index 0000000..15e0ea8
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/io/Encoding.cpp
@@ -0,0 +1,78 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_io_Encoding
+#include <haxe/io/Encoding.h>
+#endif
+namespace haxe{
+namespace io{
+
+::haxe::io::Encoding Encoding_obj::RawNative;
+
+::haxe::io::Encoding Encoding_obj::UTF8;
+
+bool Encoding_obj::__GetStatic(const ::String &inName, ::Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ if (inName==HX_("RawNative",7f,51,9c,e8)) { outValue = Encoding_obj::RawNative; return true; }
+ if (inName==HX_("UTF8",51,1d,6f,38)) { outValue = Encoding_obj::UTF8; return true; }
+ return super::__GetStatic(inName, outValue, inCallProp);
+}
+
+HX_DEFINE_CREATE_ENUM(Encoding_obj)
+
+int Encoding_obj::__FindIndex(::String inName)
+{
+ if (inName==HX_("RawNative",7f,51,9c,e8)) return 1;
+ if (inName==HX_("UTF8",51,1d,6f,38)) return 0;
+ return super::__FindIndex(inName);
+}
+
+int Encoding_obj::__FindArgCount(::String inName)
+{
+ if (inName==HX_("RawNative",7f,51,9c,e8)) return 0;
+ if (inName==HX_("UTF8",51,1d,6f,38)) return 0;
+ return super::__FindArgCount(inName);
+}
+
+::hx::Val Encoding_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ if (inName==HX_("RawNative",7f,51,9c,e8)) return RawNative;
+ if (inName==HX_("UTF8",51,1d,6f,38)) return UTF8;
+ return super::__Field(inName,inCallProp);
+}
+
+static ::String Encoding_obj_sStaticFields[] = {
+ HX_("UTF8",51,1d,6f,38),
+ HX_("RawNative",7f,51,9c,e8),
+ ::String(null())
+};
+
+::hx::Class Encoding_obj::__mClass;
+
+Dynamic __Create_Encoding_obj() { return new Encoding_obj; }
+
+void Encoding_obj::__register()
+{
+
+::hx::Static(__mClass) = ::hx::_hx_RegisterClass(HX_("haxe.io.Encoding",33,a6,6d,22), ::hx::TCanCast< Encoding_obj >,Encoding_obj_sStaticFields,0,
+ &__Create_Encoding_obj, &__Create,
+ &super::__SGetClass(), &CreateEncoding_obj, 0
+#ifdef HXCPP_VISIT_ALLOCS
+ , 0
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ , 0
+#endif
+);
+ __mClass->mGetStaticField = &Encoding_obj::__GetStatic;
+}
+
+void Encoding_obj::__boot()
+{
+RawNative = ::hx::CreateConstEnum< Encoding_obj >(HX_("RawNative",7f,51,9c,e8),1);
+UTF8 = ::hx::CreateConstEnum< Encoding_obj >(HX_("UTF8",51,1d,6f,38),0);
+}
+
+
+} // end namespace haxe
+} // end namespace io
diff --git a/Sources/c_snikket/src/haxe/io/Eof.cpp b/Sources/c_snikket/src/haxe/io/Eof.cpp
new file mode 100644
index 0000000..0c1f1f5
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/io/Eof.cpp
@@ -0,0 +1,89 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_io_Eof
+#include <haxe/io/Eof.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_c4f7e3feda612c90_29_new,"haxe.io.Eof","new",0x2166e64e,"haxe.io.Eof.new","/usr/local/lib/haxe/std/haxe/io/Eof.hx",29,0x6ea6ebff)
+HX_LOCAL_STACK_FRAME(_hx_pos_c4f7e3feda612c90_33_toString,"haxe.io.Eof","toString",0xf9ff7bfe,"haxe.io.Eof.toString","/usr/local/lib/haxe/std/haxe/io/Eof.hx",33,0x6ea6ebff)
+namespace haxe{
+namespace io{
+
+void Eof_obj::__construct(){
+ HX_STACKFRAME(&_hx_pos_c4f7e3feda612c90_29_new)
+ }
+
+Dynamic Eof_obj::__CreateEmpty() { return new Eof_obj; }
+
+void *Eof_obj::_hx_vtable = 0;
+
+Dynamic Eof_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Eof_obj > _hx_result = new Eof_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool Eof_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x1d7955d0;
+}
+
+::String Eof_obj::toString(){
+ HX_STACKFRAME(&_hx_pos_c4f7e3feda612c90_33_toString)
+HXDLIN( 33) return HX_("Eof",9c,bc,34,00);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Eof_obj,toString,return )
+
+
+Eof_obj::Eof_obj()
+{
+}
+
+::hx::Val Eof_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 8:
+ if (HX_FIELD_EQ(inName,"toString") ) { return ::hx::Val( toString_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *Eof_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *Eof_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Eof_obj_sMemberFields[] = {
+ HX_("toString",ac,d0,6e,38),
+ ::String(null()) };
+
+::hx::Class Eof_obj::__mClass;
+
+void Eof_obj::__register()
+{
+ Eof_obj _hx_dummy;
+ Eof_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.io.Eof",5c,67,0e,25);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Eof_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Eof_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Eof_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Eof_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
+} // end namespace io
diff --git a/Sources/c_snikket/src/haxe/io/Error.cpp b/Sources/c_snikket/src/haxe/io/Error.cpp
new file mode 100644
index 0000000..be96d93
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/io/Error.cpp
@@ -0,0 +1,98 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_io_Error
+#include <haxe/io/Error.h>
+#endif
+namespace haxe{
+namespace io{
+
+::haxe::io::Error Error_obj::Blocked;
+
+::haxe::io::Error Error_obj::Custom( ::Dynamic e)
+{
+ return ::hx::CreateEnum< Error_obj >(HX_("Custom",d1,fb,26,74),3,1)->_hx_init(0,e);
+}
+
+::haxe::io::Error Error_obj::OutsideBounds;
+
+::haxe::io::Error Error_obj::Overflow;
+
+bool Error_obj::__GetStatic(const ::String &inName, ::Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ if (inName==HX_("Blocked",cc,a2,4f,12)) { outValue = Error_obj::Blocked; return true; }
+ if (inName==HX_("Custom",d1,fb,26,74)) { outValue = Error_obj::Custom_dyn(); return true; }
+ if (inName==HX_("OutsideBounds",5a,c1,82,38)) { outValue = Error_obj::OutsideBounds; return true; }
+ if (inName==HX_("Overflow",62,9f,ed,1a)) { outValue = Error_obj::Overflow; return true; }
+ return super::__GetStatic(inName, outValue, inCallProp);
+}
+
+HX_DEFINE_CREATE_ENUM(Error_obj)
+
+int Error_obj::__FindIndex(::String inName)
+{
+ if (inName==HX_("Blocked",cc,a2,4f,12)) return 0;
+ if (inName==HX_("Custom",d1,fb,26,74)) return 3;
+ if (inName==HX_("OutsideBounds",5a,c1,82,38)) return 2;
+ if (inName==HX_("Overflow",62,9f,ed,1a)) return 1;
+ return super::__FindIndex(inName);
+}
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Error_obj,Custom,return)
+
+int Error_obj::__FindArgCount(::String inName)
+{
+ if (inName==HX_("Blocked",cc,a2,4f,12)) return 0;
+ if (inName==HX_("Custom",d1,fb,26,74)) return 1;
+ if (inName==HX_("OutsideBounds",5a,c1,82,38)) return 0;
+ if (inName==HX_("Overflow",62,9f,ed,1a)) return 0;
+ return super::__FindArgCount(inName);
+}
+
+::hx::Val Error_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ if (inName==HX_("Blocked",cc,a2,4f,12)) return Blocked;
+ if (inName==HX_("Custom",d1,fb,26,74)) return Custom_dyn();
+ if (inName==HX_("OutsideBounds",5a,c1,82,38)) return OutsideBounds;
+ if (inName==HX_("Overflow",62,9f,ed,1a)) return Overflow;
+ return super::__Field(inName,inCallProp);
+}
+
+static ::String Error_obj_sStaticFields[] = {
+ HX_("Blocked",cc,a2,4f,12),
+ HX_("Overflow",62,9f,ed,1a),
+ HX_("OutsideBounds",5a,c1,82,38),
+ HX_("Custom",d1,fb,26,74),
+ ::String(null())
+};
+
+::hx::Class Error_obj::__mClass;
+
+Dynamic __Create_Error_obj() { return new Error_obj; }
+
+void Error_obj::__register()
+{
+
+::hx::Static(__mClass) = ::hx::_hx_RegisterClass(HX_("haxe.io.Error",68,16,01,55), ::hx::TCanCast< Error_obj >,Error_obj_sStaticFields,0,
+ &__Create_Error_obj, &__Create,
+ &super::__SGetClass(), &CreateError_obj, 0
+#ifdef HXCPP_VISIT_ALLOCS
+ , 0
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ , 0
+#endif
+);
+ __mClass->mGetStaticField = &Error_obj::__GetStatic;
+}
+
+void Error_obj::__boot()
+{
+Blocked = ::hx::CreateConstEnum< Error_obj >(HX_("Blocked",cc,a2,4f,12),0);
+OutsideBounds = ::hx::CreateConstEnum< Error_obj >(HX_("OutsideBounds",5a,c1,82,38),2);
+Overflow = ::hx::CreateConstEnum< Error_obj >(HX_("Overflow",62,9f,ed,1a),1);
+}
+
+
+} // end namespace haxe
+} // end namespace io
diff --git a/Sources/c_snikket/src/haxe/io/Input.cpp b/Sources/c_snikket/src/haxe/io/Input.cpp
new file mode 100644
index 0000000..ad91507
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/io/Input.cpp
@@ -0,0 +1,309 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_haxe_Exception
+#include <haxe/Exception.h>
+#endif
+#ifndef INCLUDED_haxe_ValueException
+#include <haxe/ValueException.h>
+#endif
+#ifndef INCLUDED_haxe_exceptions_NotImplementedException
+#include <haxe/exceptions/NotImplementedException.h>
+#endif
+#ifndef INCLUDED_haxe_exceptions_PosException
+#include <haxe/exceptions/PosException.h>
+#endif
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+#ifndef INCLUDED_haxe_io_BytesBuffer
+#include <haxe/io/BytesBuffer.h>
+#endif
+#ifndef INCLUDED_haxe_io_Eof
+#include <haxe/io/Eof.h>
+#endif
+#ifndef INCLUDED_haxe_io_Error
+#include <haxe/io/Error.h>
+#endif
+#ifndef INCLUDED_haxe_io_Input
+#include <haxe/io/Input.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_220702dcc8429dc4_51_readByte,"haxe.io.Input","readByte",0x4de8a3c2,"haxe.io.Input.readByte","/usr/local/lib/haxe/std/haxe/io/Input.hx",51,0x3b290ab1)
+HX_LOCAL_STACK_FRAME(_hx_pos_220702dcc8429dc4_64_readBytes,"haxe.io.Input","readBytes",0xdda6a671,"haxe.io.Input.readBytes","/usr/local/lib/haxe/std/haxe/io/Input.hx",64,0x3b290ab1)
+HX_LOCAL_STACK_FRAME(_hx_pos_220702dcc8429dc4_92_close,"haxe.io.Input","close",0xfc421af4,"haxe.io.Input.close","/usr/local/lib/haxe/std/haxe/io/Input.hx",92,0x3b290ab1)
+HX_LOCAL_STACK_FRAME(_hx_pos_220702dcc8429dc4_94_set_bigEndian,"haxe.io.Input","set_bigEndian",0x96732a9a,"haxe.io.Input.set_bigEndian","/usr/local/lib/haxe/std/haxe/io/Input.hx",94,0x3b290ab1)
+HX_LOCAL_STACK_FRAME(_hx_pos_220702dcc8429dc4_106_readAll,"haxe.io.Input","readAll",0xaed6e9a7,"haxe.io.Input.readAll","/usr/local/lib/haxe/std/haxe/io/Input.hx",106,0x3b290ab1)
+HX_LOCAL_STACK_FRAME(_hx_pos_220702dcc8429dc4_281_readInt32,"haxe.io.Input","readInt32",0xde2f3154,"haxe.io.Input.readInt32","/usr/local/lib/haxe/std/haxe/io/Input.hx",281,0x3b290ab1)
+namespace haxe{
+namespace io{
+
+void Input_obj::__construct() { }
+
+Dynamic Input_obj::__CreateEmpty() { return new Input_obj; }
+
+void *Input_obj::_hx_vtable = 0;
+
+Dynamic Input_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Input_obj > _hx_result = new Input_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool Input_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x19e22056;
+}
+
+int Input_obj::readByte(){
+ HX_GC_STACKFRAME(&_hx_pos_220702dcc8429dc4_51_readByte)
+HXDLIN( 51) HX_STACK_DO_THROW( ::haxe::exceptions::NotImplementedException_obj::__alloc( HX_CTX ,null(),null(),::hx::SourceInfo(HX_("haxe/io/Input.hx",f4,10,5a,cd),51,HX_("haxe.io.Input",aa,0e,f5,9f),HX_("readByte",7e,f9,1a,69))));
+HXDLIN( 51) return 0;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Input_obj,readByte,return )
+
+int Input_obj::readBytes( ::haxe::io::Bytes s,int pos,int len){
+ HX_STACKFRAME(&_hx_pos_220702dcc8429dc4_64_readBytes)
+HXLINE( 65) int k = len;
+HXLINE( 66) ::Array< unsigned char > b = s->b;
+HXLINE( 67) bool _hx_tmp;
+HXDLIN( 67) bool _hx_tmp1;
+HXDLIN( 67) if ((pos >= 0)) {
+HXLINE( 67) _hx_tmp1 = (len < 0);
+ }
+ else {
+HXLINE( 67) _hx_tmp1 = true;
+ }
+HXDLIN( 67) if (!(_hx_tmp1)) {
+HXLINE( 67) _hx_tmp = ((pos + len) > s->length);
+ }
+ else {
+HXLINE( 67) _hx_tmp = true;
+ }
+HXDLIN( 67) if (_hx_tmp) {
+HXLINE( 68) HX_STACK_DO_THROW(::haxe::io::Error_obj::OutsideBounds_dyn());
+ }
+HXLINE( 69) try {
+ HX_STACK_CATCHABLE( ::haxe::io::Eof, 0);
+ HX_STACK_CATCHABLE( ::haxe::ValueException, 1);
+HXLINE( 70) while((k > 0)){
+HXLINE( 76) b[pos] = ( (unsigned char)(this->readByte()) );
+HXLINE( 80) pos = (pos + 1);
+HXLINE( 81) k = (k - 1);
+ }
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::haxe::io::Eof >() ){
+ HX_STACK_BEGIN_CATCH
+ ::haxe::io::Eof eof = _hx_e;
+ }
+ else if (_hx_e.IsClass< ::haxe::ValueException >() ){
+ HX_STACK_BEGIN_CATCH
+ ::haxe::ValueException _g = _hx_e;
+HXLINE( 83) {
+HXLINE( 83) null();
+ }
+HXLINE( 69) if (!(::Std_obj::isOfType(_g->value,::hx::ClassOf< ::haxe::io::Eof >()))) {
+HXLINE( 69) HX_STACK_DO_THROW(_g);
+ }
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+HXLINE( 84) return (len - k);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Input_obj,readBytes,return )
+
+void Input_obj::close(){
+ HX_STACKFRAME(&_hx_pos_220702dcc8429dc4_92_close)
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Input_obj,close,(void))
+
+bool Input_obj::set_bigEndian(bool b){
+ HX_STACKFRAME(&_hx_pos_220702dcc8429dc4_94_set_bigEndian)
+HXLINE( 95) this->bigEndian = b;
+HXLINE( 96) return b;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Input_obj,set_bigEndian,return )
+
+ ::haxe::io::Bytes Input_obj::readAll( ::Dynamic bufsize){
+ HX_GC_STACKFRAME(&_hx_pos_220702dcc8429dc4_106_readAll)
+HXLINE( 107) if (::hx::IsNull( bufsize )) {
+HXLINE( 111) bufsize = 16384;
+ }
+HXLINE( 114) ::haxe::io::Bytes buf = ::haxe::io::Bytes_obj::alloc(( (int)(bufsize) ));
+HXLINE( 115) ::haxe::io::BytesBuffer total = ::haxe::io::BytesBuffer_obj::__alloc( HX_CTX );
+HXLINE( 116) try {
+ HX_STACK_CATCHABLE( ::haxe::io::Eof, 0);
+ HX_STACK_CATCHABLE( ::haxe::ValueException, 1);
+HXLINE( 117) while(true){
+HXLINE( 118) int len = this->readBytes(buf,0,( (int)(bufsize) ));
+HXLINE( 119) if ((len == 0)) {
+HXLINE( 120) HX_STACK_DO_THROW(::haxe::io::Error_obj::Blocked_dyn());
+ }
+HXLINE( 121) {
+HXLINE( 121) bool _hx_tmp;
+HXDLIN( 121) if ((len >= 0)) {
+HXLINE( 121) _hx_tmp = (len > buf->length);
+ }
+ else {
+HXLINE( 121) _hx_tmp = true;
+ }
+HXDLIN( 121) if (_hx_tmp) {
+HXLINE( 121) HX_STACK_DO_THROW(::haxe::io::Error_obj::OutsideBounds_dyn());
+ }
+HXDLIN( 121) ::Array< unsigned char > b1 = total->b;
+HXDLIN( 121) ::Array< unsigned char > b2 = buf->b;
+HXDLIN( 121) {
+HXLINE( 121) int _g = 0;
+HXDLIN( 121) int _g1 = len;
+HXDLIN( 121) while((_g < _g1)){
+HXLINE( 121) _g = (_g + 1);
+HXDLIN( 121) int i = (_g - 1);
+HXDLIN( 121) total->b->push(b2->__get(i));
+ }
+ }
+ }
+ }
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::haxe::io::Eof >() ){
+ HX_STACK_BEGIN_CATCH
+ ::haxe::io::Eof e = _hx_e;
+ }
+ else if (_hx_e.IsClass< ::haxe::ValueException >() ){
+ HX_STACK_BEGIN_CATCH
+ ::haxe::ValueException _g2 = _hx_e;
+HXLINE( 123) {
+HXLINE( 123) null();
+ }
+HXLINE( 116) if (!(::Std_obj::isOfType(_g2->value,::hx::ClassOf< ::haxe::io::Eof >()))) {
+HXLINE( 116) HX_STACK_DO_THROW(_g2);
+ }
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+HXLINE( 124) return total->getBytes();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Input_obj,readAll,return )
+
+int Input_obj::readInt32(){
+ HX_STACKFRAME(&_hx_pos_220702dcc8429dc4_281_readInt32)
+HXLINE( 282) int ch1 = this->readByte();
+HXLINE( 283) int ch2 = this->readByte();
+HXLINE( 284) int ch3 = this->readByte();
+HXLINE( 285) int ch4 = this->readByte();
+HXLINE( 297) if (this->bigEndian) {
+HXLINE( 297) return (((ch4 | (ch3 << 8)) | (ch2 << 16)) | (ch1 << 24));
+ }
+ else {
+HXLINE( 297) return (((ch1 | (ch2 << 8)) | (ch3 << 16)) | (ch4 << 24));
+ }
+HXDLIN( 297) return 0;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Input_obj,readInt32,return )
+
+
+Input_obj::Input_obj()
+{
+}
+
+::hx::Val Input_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"close") ) { return ::hx::Val( close_dyn() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"readAll") ) { return ::hx::Val( readAll_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"readByte") ) { return ::hx::Val( readByte_dyn() ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"bigEndian") ) { return ::hx::Val( bigEndian ); }
+ if (HX_FIELD_EQ(inName,"readBytes") ) { return ::hx::Val( readBytes_dyn() ); }
+ if (HX_FIELD_EQ(inName,"readInt32") ) { return ::hx::Val( readInt32_dyn() ); }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"set_bigEndian") ) { return ::hx::Val( set_bigEndian_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val Input_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 9:
+ if (HX_FIELD_EQ(inName,"bigEndian") ) { if (inCallProp == ::hx::paccAlways) return ::hx::Val( set_bigEndian(inValue.Cast< bool >()) );bigEndian=inValue.Cast< bool >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void Input_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("bigEndian",7b,d5,5a,20));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Input_obj_sMemberStorageInfo[] = {
+ {::hx::fsBool,(int)offsetof(Input_obj,bigEndian),HX_("bigEndian",7b,d5,5a,20)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *Input_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Input_obj_sMemberFields[] = {
+ HX_("bigEndian",7b,d5,5a,20),
+ HX_("readByte",7e,f9,1a,69),
+ HX_("readBytes",35,55,7f,8e),
+ HX_("close",b8,17,63,48),
+ HX_("set_bigEndian",5e,8b,c4,26),
+ HX_("readAll",6b,9f,c3,02),
+ HX_("readInt32",18,e0,07,8f),
+ ::String(null()) };
+
+::hx::Class Input_obj::__mClass;
+
+void Input_obj::__register()
+{
+ Input_obj _hx_dummy;
+ Input_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.io.Input",aa,0e,f5,9f);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Input_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Input_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Input_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Input_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
+} // end namespace io
diff --git a/Sources/c_snikket/src/haxe/io/Output.cpp b/Sources/c_snikket/src/haxe/io/Output.cpp
new file mode 100644
index 0000000..e676bd4
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/io/Output.cpp
@@ -0,0 +1,216 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_Exception
+#include <haxe/Exception.h>
+#endif
+#ifndef INCLUDED_haxe_exceptions_NotImplementedException
+#include <haxe/exceptions/NotImplementedException.h>
+#endif
+#ifndef INCLUDED_haxe_exceptions_PosException
+#include <haxe/exceptions/PosException.h>
+#endif
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+#ifndef INCLUDED_haxe_io_Encoding
+#include <haxe/io/Encoding.h>
+#endif
+#ifndef INCLUDED_haxe_io_Error
+#include <haxe/io/Error.h>
+#endif
+#ifndef INCLUDED_haxe_io_Output
+#include <haxe/io/Output.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_0e34c0ce46c21137_47_writeByte,"haxe.io.Output","writeByte",0xb4fe513a,"haxe.io.Output.writeByte","/usr/local/lib/haxe/std/haxe/io/Output.hx",47,0x72d66600)
+HX_LOCAL_STACK_FRAME(_hx_pos_0e34c0ce46c21137_57_writeBytes,"haxe.io.Output","writeBytes",0xa988c1f9,"haxe.io.Output.writeBytes","/usr/local/lib/haxe/std/haxe/io/Output.hx",57,0x72d66600)
+HX_LOCAL_STACK_FRAME(_hx_pos_0e34c0ce46c21137_92_close,"haxe.io.Output","close",0xe726bfeb,"haxe.io.Output.close","/usr/local/lib/haxe/std/haxe/io/Output.hx",92,0x72d66600)
+HX_LOCAL_STACK_FRAME(_hx_pos_0e34c0ce46c21137_103_write,"haxe.io.Output","write",0x6f1d1512,"haxe.io.Output.write","/usr/local/lib/haxe/std/haxe/io/Output.hx",103,0x72d66600)
+HX_LOCAL_STACK_FRAME(_hx_pos_0e34c0ce46c21137_121_writeFullBytes,"haxe.io.Output","writeFullBytes",0xc2c420ea,"haxe.io.Output.writeFullBytes","/usr/local/lib/haxe/std/haxe/io/Output.hx",121,0x72d66600)
+HX_LOCAL_STACK_FRAME(_hx_pos_0e34c0ce46c21137_246_prepare,"haxe.io.Output","prepare",0xcd01ec7a,"haxe.io.Output.prepare","/usr/local/lib/haxe/std/haxe/io/Output.hx",246,0x72d66600)
+HX_LOCAL_STACK_FRAME(_hx_pos_0e34c0ce46c21137_278_writeString,"haxe.io.Output","writeString",0x97e1cb83,"haxe.io.Output.writeString","/usr/local/lib/haxe/std/haxe/io/Output.hx",278,0x72d66600)
+namespace haxe{
+namespace io{
+
+void Output_obj::__construct() { }
+
+Dynamic Output_obj::__CreateEmpty() { return new Output_obj; }
+
+void *Output_obj::_hx_vtable = 0;
+
+Dynamic Output_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Output_obj > _hx_result = new Output_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool Output_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x0a55a26d;
+}
+
+void Output_obj::writeByte(int c){
+ HX_GC_STACKFRAME(&_hx_pos_0e34c0ce46c21137_47_writeByte)
+HXDLIN( 47) HX_STACK_DO_THROW( ::haxe::exceptions::NotImplementedException_obj::__alloc( HX_CTX ,null(),null(),::hx::SourceInfo(HX_("haxe/io/Output.hx",5d,da,8a,cb),47,HX_("haxe.io.Output",61,10,0b,c7),HX_("writeByte",87,13,d7,49))));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Output_obj,writeByte,(void))
+
+int Output_obj::writeBytes( ::haxe::io::Bytes s,int pos,int len){
+ HX_STACKFRAME(&_hx_pos_0e34c0ce46c21137_57_writeBytes)
+HXLINE( 59) bool _hx_tmp;
+HXDLIN( 59) bool _hx_tmp1;
+HXDLIN( 59) if ((pos >= 0)) {
+HXLINE( 59) _hx_tmp1 = (len < 0);
+ }
+ else {
+HXLINE( 59) _hx_tmp1 = true;
+ }
+HXDLIN( 59) if (!(_hx_tmp1)) {
+HXLINE( 59) _hx_tmp = ((pos + len) > s->length);
+ }
+ else {
+HXLINE( 59) _hx_tmp = true;
+ }
+HXDLIN( 59) if (_hx_tmp) {
+HXLINE( 60) HX_STACK_DO_THROW(::haxe::io::Error_obj::OutsideBounds_dyn());
+ }
+HXLINE( 62) ::Array< unsigned char > b = s->b;
+HXLINE( 63) int k = len;
+HXLINE( 64) while((k > 0)){
+HXLINE( 70) this->writeByte(( (int)(b->__get(pos)) ));
+HXLINE( 76) pos = (pos + 1);
+HXLINE( 77) k = (k - 1);
+ }
+HXLINE( 79) return len;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Output_obj,writeBytes,return )
+
+void Output_obj::close(){
+ HX_STACKFRAME(&_hx_pos_0e34c0ce46c21137_92_close)
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Output_obj,close,(void))
+
+void Output_obj::write( ::haxe::io::Bytes s){
+ HX_STACKFRAME(&_hx_pos_0e34c0ce46c21137_103_write)
+HXLINE( 104) int l = s->length;
+HXLINE( 105) int p = 0;
+HXLINE( 106) while((l > 0)){
+HXLINE( 107) int k = this->writeBytes(s,p,l);
+HXLINE( 108) if ((k == 0)) {
+HXLINE( 109) HX_STACK_DO_THROW(::haxe::io::Error_obj::Blocked_dyn());
+ }
+HXLINE( 110) p = (p + k);
+HXLINE( 111) l = (l - k);
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Output_obj,write,(void))
+
+void Output_obj::writeFullBytes( ::haxe::io::Bytes s,int pos,int len){
+ HX_STACKFRAME(&_hx_pos_0e34c0ce46c21137_121_writeFullBytes)
+HXDLIN( 121) while((len > 0)){
+HXLINE( 122) int k = this->writeBytes(s,pos,len);
+HXLINE( 123) pos = (pos + k);
+HXLINE( 124) len = (len - k);
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Output_obj,writeFullBytes,(void))
+
+void Output_obj::prepare(int nbytes){
+ HX_STACKFRAME(&_hx_pos_0e34c0ce46c21137_246_prepare)
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Output_obj,prepare,(void))
+
+void Output_obj::writeString(::String s, ::haxe::io::Encoding encoding){
+ HX_STACKFRAME(&_hx_pos_0e34c0ce46c21137_278_writeString)
+HXLINE( 282) ::haxe::io::Bytes b = ::haxe::io::Bytes_obj::ofString(s,encoding);
+HXLINE( 284) this->writeFullBytes(b,0,b->length);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Output_obj,writeString,(void))
+
+
+Output_obj::Output_obj()
+{
+}
+
+::hx::Val Output_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"close") ) { return ::hx::Val( close_dyn() ); }
+ if (HX_FIELD_EQ(inName,"write") ) { return ::hx::Val( write_dyn() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"prepare") ) { return ::hx::Val( prepare_dyn() ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"writeByte") ) { return ::hx::Val( writeByte_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"writeBytes") ) { return ::hx::Val( writeBytes_dyn() ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"writeString") ) { return ::hx::Val( writeString_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"writeFullBytes") ) { return ::hx::Val( writeFullBytes_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *Output_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *Output_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Output_obj_sMemberFields[] = {
+ HX_("writeByte",87,13,d7,49),
+ HX_("writeBytes",0c,03,5a,52),
+ HX_("close",b8,17,63,48),
+ HX_("write",df,6c,59,d0),
+ HX_("writeFullBytes",7d,e7,66,a4),
+ HX_("prepare",87,91,dd,37),
+ HX_("writeString",10,7b,29,a6),
+ ::String(null()) };
+
+::hx::Class Output_obj::__mClass;
+
+void Output_obj::__register()
+{
+ Output_obj _hx_dummy;
+ Output_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.io.Output",61,10,0b,c7);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Output_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Output_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Output_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Output_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
+} // end namespace io
diff --git a/Sources/c_snikket/src/haxe/io/Path.cpp b/Sources/c_snikket/src/haxe/io/Path.cpp
new file mode 100644
index 0000000..f7c576a
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/io/Path.cpp
@@ -0,0 +1,587 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_StringBuf
+#include <StringBuf.h>
+#endif
+#ifndef INCLUDED_StringTools
+#include <StringTools.h>
+#endif
+#ifndef INCLUDED_haxe_io_Path
+#include <haxe/io/Path.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_9ba24db561a9c477_76_new,"haxe.io.Path","new",0x1b96d677,"haxe.io.Path.new","/usr/local/lib/haxe/std/haxe/io/Path.hx",76,0xc99b0f1c)
+HX_LOCAL_STACK_FRAME(_hx_pos_9ba24db561a9c477_115_toString,"haxe.io.Path","toString",0xc0ab5735,"haxe.io.Path.toString","/usr/local/lib/haxe/std/haxe/io/Path.hx",115,0xc99b0f1c)
+HX_LOCAL_STACK_FRAME(_hx_pos_9ba24db561a9c477_134_withoutDirectory,"haxe.io.Path","withoutDirectory",0xdf35ce8e,"haxe.io.Path.withoutDirectory","/usr/local/lib/haxe/std/haxe/io/Path.hx",134,0xc99b0f1c)
+HX_LOCAL_STACK_FRAME(_hx_pos_9ba24db561a9c477_189_join,"haxe.io.Path","join",0x05c781f3,"haxe.io.Path.join","/usr/local/lib/haxe/std/haxe/io/Path.hx",189,0xc99b0f1c)
+HX_LOCAL_STACK_FRAME(_hx_pos_9ba24db561a9c477_210_normalize,"haxe.io.Path","normalize",0x585a68e4,"haxe.io.Path.normalize","/usr/local/lib/haxe/std/haxe/io/Path.hx",210,0xc99b0f1c)
+static const ::String _hx_array_data_4ec6cf05_10[] = {
+ HX_("/",2f,00,00,00),
+};
+static const ::String _hx_array_data_4ec6cf05_11[] = {
+ HX_(":",3a,00,00,00),
+};
+static const ::String _hx_array_data_4ec6cf05_12[] = {
+ HX_("/",2f,00,00,00),
+};
+HX_LOCAL_STACK_FRAME(_hx_pos_9ba24db561a9c477_271_addTrailingSlash,"haxe.io.Path","addTrailingSlash",0x8b4f8e69,"haxe.io.Path.addTrailingSlash","/usr/local/lib/haxe/std/haxe/io/Path.hx",271,0xc99b0f1c)
+HX_LOCAL_STACK_FRAME(_hx_pos_9ba24db561a9c477_299_removeTrailingSlashes,"haxe.io.Path","removeTrailingSlashes",0x2dc73462,"haxe.io.Path.removeTrailingSlashes","/usr/local/lib/haxe/std/haxe/io/Path.hx",299,0xc99b0f1c)
+HX_LOCAL_STACK_FRAME(_hx_pos_9ba24db561a9c477_314_isAbsolute,"haxe.io.Path","isAbsolute",0xb396db4a,"haxe.io.Path.isAbsolute","/usr/local/lib/haxe/std/haxe/io/Path.hx",314,0xc99b0f1c)
+namespace haxe{
+namespace io{
+
+void Path_obj::__construct(::String path){
+ HX_STACKFRAME(&_hx_pos_9ba24db561a9c477_76_new)
+HXLINE( 77) ::String _hx_switch_0 = path;
+ if ( (_hx_switch_0==HX_(".",2e,00,00,00)) || (_hx_switch_0==HX_("..",40,28,00,00)) ){
+HXLINE( 79) this->dir = path;
+HXLINE( 80) this->file = HX_("",00,00,00,00);
+HXLINE( 81) return;
+HXLINE( 78) goto _hx_goto_0;
+ }
+ _hx_goto_0:;
+HXLINE( 83) int c1 = path.lastIndexOf(HX_("/",2f,00,00,00),null());
+HXLINE( 84) int c2 = path.lastIndexOf(HX_("\\",5c,00,00,00),null());
+HXLINE( 85) if ((c1 < c2)) {
+HXLINE( 86) this->dir = path.substr(0,c2);
+HXLINE( 87) path = path.substr((c2 + 1),null());
+HXLINE( 88) this->backslash = true;
+ }
+ else {
+HXLINE( 89) if ((c2 < c1)) {
+HXLINE( 90) this->dir = path.substr(0,c1);
+HXLINE( 91) path = path.substr((c1 + 1),null());
+ }
+ else {
+HXLINE( 93) this->dir = null();
+ }
+ }
+HXLINE( 94) int cp = path.lastIndexOf(HX_(".",2e,00,00,00),null());
+HXLINE( 95) if ((cp != -1)) {
+HXLINE( 96) this->ext = path.substr((cp + 1),null());
+HXLINE( 97) this->file = path.substr(0,cp);
+ }
+ else {
+HXLINE( 99) this->ext = null();
+HXLINE( 100) this->file = path;
+ }
+ }
+
+Dynamic Path_obj::__CreateEmpty() { return new Path_obj; }
+
+void *Path_obj::_hx_vtable = 0;
+
+Dynamic Path_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Path_obj > _hx_result = new Path_obj();
+ _hx_result->__construct(inArgs[0]);
+ return _hx_result;
+}
+
+bool Path_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x026896d9;
+}
+
+::String Path_obj::toString(){
+ HX_STACKFRAME(&_hx_pos_9ba24db561a9c477_115_toString)
+HXDLIN( 115) ::String _hx_tmp;
+HXDLIN( 115) if (::hx::IsNull( this->dir )) {
+HXDLIN( 115) _hx_tmp = HX_("",00,00,00,00);
+ }
+ else {
+HXDLIN( 115) ::String _hx_tmp1;
+HXDLIN( 115) if (this->backslash) {
+HXDLIN( 115) _hx_tmp1 = HX_("\\",5c,00,00,00);
+ }
+ else {
+HXDLIN( 115) _hx_tmp1 = HX_("/",2f,00,00,00);
+ }
+HXDLIN( 115) _hx_tmp = (this->dir + _hx_tmp1);
+ }
+HXDLIN( 115) ::String _hx_tmp2;
+HXDLIN( 115) if (::hx::IsNull( this->ext )) {
+HXDLIN( 115) _hx_tmp2 = HX_("",00,00,00,00);
+ }
+ else {
+HXDLIN( 115) _hx_tmp2 = (HX_(".",2e,00,00,00) + this->ext);
+ }
+HXDLIN( 115) return ((_hx_tmp + this->file) + _hx_tmp2);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Path_obj,toString,return )
+
+::String Path_obj::withoutDirectory(::String path){
+ HX_GC_STACKFRAME(&_hx_pos_9ba24db561a9c477_134_withoutDirectory)
+HXLINE( 135) ::haxe::io::Path s = ::haxe::io::Path_obj::__alloc( HX_CTX ,path);
+HXLINE( 136) s->dir = null();
+HXLINE( 137) return s->toString();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Path_obj,withoutDirectory,return )
+
+::String Path_obj::join(::Array< ::String > paths){
+ HX_STACKFRAME(&_hx_pos_9ba24db561a9c477_189_join)
+HXLINE( 190) ::Array< ::String > _g = ::Array_obj< ::String >::__new(0);
+HXDLIN( 190) {
+HXLINE( 190) int _g1 = 0;
+HXDLIN( 190) ::Array< ::String > _g2 = paths;
+HXDLIN( 190) while((_g1 < _g2->length)){
+HXLINE( 190) ::String v = _g2->__get(_g1);
+HXDLIN( 190) _g1 = (_g1 + 1);
+HXDLIN( 190) bool _hx_tmp;
+HXDLIN( 190) if (::hx::IsNotNull( v )) {
+HXLINE( 190) _hx_tmp = (v != HX_("",00,00,00,00));
+ }
+ else {
+HXLINE( 190) _hx_tmp = false;
+ }
+HXDLIN( 190) if (_hx_tmp) {
+HXLINE( 190) _g->push(v);
+ }
+ }
+ }
+HXDLIN( 190) ::Array< ::String > paths1 = _g;
+HXLINE( 191) if ((paths1->length == 0)) {
+HXLINE( 192) return HX_("",00,00,00,00);
+ }
+HXLINE( 194) ::String path = paths1->__get(0);
+HXLINE( 195) {
+HXLINE( 195) int _g3 = 1;
+HXDLIN( 195) int _g4 = paths1->length;
+HXDLIN( 195) while((_g3 < _g4)){
+HXLINE( 195) _g3 = (_g3 + 1);
+HXDLIN( 195) int i = (_g3 - 1);
+HXLINE( 196) path = ::haxe::io::Path_obj::addTrailingSlash(path);
+HXLINE( 197) path = (path + paths1->__get(i));
+ }
+ }
+HXLINE( 199) return ::haxe::io::Path_obj::normalize(path);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Path_obj,join,return )
+
+::String Path_obj::normalize(::String path){
+ HX_GC_STACKFRAME(&_hx_pos_9ba24db561a9c477_210_normalize)
+HXLINE( 211) ::String slash = HX_("/",2f,00,00,00);
+HXLINE( 212) path = path.split(HX_("\\",5c,00,00,00))->join(slash);
+HXLINE( 213) if ((path == slash)) {
+HXLINE( 214) return slash;
+ }
+HXLINE( 216) ::Array< ::String > target = ::Array_obj< ::String >::__new(0);
+HXLINE( 218) {
+HXLINE( 218) int _g = 0;
+HXDLIN( 218) ::Array< ::String > _g1 = path.split(slash);
+HXDLIN( 218) while((_g < _g1->length)){
+HXLINE( 218) ::String token = _g1->__get(_g);
+HXDLIN( 218) _g = (_g + 1);
+HXLINE( 219) bool _hx_tmp;
+HXDLIN( 219) bool _hx_tmp1;
+HXDLIN( 219) if ((token == HX_("..",40,28,00,00))) {
+HXLINE( 219) _hx_tmp1 = (target->length > 0);
+ }
+ else {
+HXLINE( 219) _hx_tmp1 = false;
+ }
+HXDLIN( 219) if (_hx_tmp1) {
+HXLINE( 219) _hx_tmp = (target->__get((target->length - 1)) != HX_("..",40,28,00,00));
+ }
+ else {
+HXLINE( 219) _hx_tmp = false;
+ }
+HXDLIN( 219) if (_hx_tmp) {
+HXLINE( 220) target->pop();
+ }
+ else {
+HXLINE( 221) if ((token == HX_("",00,00,00,00))) {
+HXLINE( 222) bool _hx_tmp2;
+HXDLIN( 222) if ((target->length <= 0)) {
+HXLINE( 222) _hx_tmp2 = ::hx::IsEq( path.charCodeAt(0),47 );
+ }
+ else {
+HXLINE( 222) _hx_tmp2 = true;
+ }
+HXDLIN( 222) if (_hx_tmp2) {
+HXLINE( 223) target->push(token);
+ }
+ }
+ else {
+HXLINE( 225) if ((token != HX_(".",2e,00,00,00))) {
+HXLINE( 226) target->push(token);
+ }
+ }
+ }
+ }
+ }
+HXLINE( 230) ::String tmp = target->join(slash);
+HXLINE( 231) ::StringBuf acc = ::StringBuf_obj::__alloc( HX_CTX );
+HXLINE( 232) bool colon = false;
+HXLINE( 233) bool slashes = false;
+HXLINE( 235) {
+HXLINE( 235) int _g_offset = 0;
+HXDLIN( 235) ::String _g_s = tmp;
+HXDLIN( 235) while((_g_offset < _g_s.length)){
+HXLINE( 235) ::String s = _g_s;
+HXDLIN( 235) _g_offset = (_g_offset + 1);
+HXDLIN( 235) int index = (_g_offset - 1);
+HXDLIN( 235) int c = s.cca(index);
+HXDLIN( 235) bool _hx_tmp3;
+HXDLIN( 235) if ((c >= 55296)) {
+HXLINE( 235) _hx_tmp3 = (c <= 56319);
+ }
+ else {
+HXLINE( 235) _hx_tmp3 = false;
+ }
+HXDLIN( 235) if (_hx_tmp3) {
+HXLINE( 639) c = (((c - 55232) << 10) | (s.cca((index + 1)) & 1023));
+ }
+HXLINE( 235) int c1 = c;
+HXDLIN( 235) if ((c1 >= 65536)) {
+HXLINE( 235) _g_offset = (_g_offset + 1);
+ }
+HXDLIN( 235) int c2 = c1;
+HXLINE( 236) switch((int)(c2)){
+ case (int)47: {
+HXLINE( 244) if (!(colon)) {
+HXLINE( 245) slashes = true;
+ }
+ else {
+HXLINE( 246) int i = c2;
+HXDLIN( 246) {
+HXLINE( 247) colon = false;
+HXLINE( 248) if (slashes) {
+HXLINE( 249) {
+HXLINE( 249) if (::hx::IsNotNull( acc->charBuf )) {
+HXLINE( 249) acc->flush();
+ }
+HXDLIN( 249) if (::hx::IsNull( acc->b )) {
+HXLINE( 249) acc->b = ::Array_obj< ::String >::fromData( _hx_array_data_4ec6cf05_10,1);
+ }
+ else {
+HXLINE( 249) acc->b->push(HX_("/",2f,00,00,00));
+ }
+ }
+HXLINE( 250) slashes = false;
+ }
+HXLINE( 252) if ((i >= 127)) {
+HXLINE( 252) ::String x = ::String::fromCharCode(i);
+HXDLIN( 252) if (::hx::IsNotNull( acc->charBuf )) {
+HXLINE( 252) acc->flush();
+ }
+HXDLIN( 252) if (::hx::IsNull( acc->b )) {
+HXLINE( 252) acc->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x));
+ }
+ else {
+HXLINE( 252) ::Array< ::String > acc1 = acc->b;
+HXDLIN( 252) acc1->push(::Std_obj::string(x));
+ }
+ }
+ else {
+HXLINE( 252) if (::hx::IsNull( acc->charBuf )) {
+HXLINE( 252) acc->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 252) acc->charBuf->push(i);
+ }
+ }
+ }
+ }
+ break;
+ case (int)58: {
+HXLINE( 242) {
+HXLINE( 242) if (::hx::IsNotNull( acc->charBuf )) {
+HXLINE( 242) acc->flush();
+ }
+HXDLIN( 242) if (::hx::IsNull( acc->b )) {
+HXLINE( 242) acc->b = ::Array_obj< ::String >::fromData( _hx_array_data_4ec6cf05_11,1);
+ }
+ else {
+HXLINE( 242) acc->b->push(HX_(":",3a,00,00,00));
+ }
+ }
+HXLINE( 243) colon = true;
+ }
+ break;
+ default:{
+HXLINE( 246) int i1 = c2;
+HXDLIN( 246) {
+HXLINE( 247) colon = false;
+HXLINE( 248) if (slashes) {
+HXLINE( 249) {
+HXLINE( 249) if (::hx::IsNotNull( acc->charBuf )) {
+HXLINE( 249) acc->flush();
+ }
+HXDLIN( 249) if (::hx::IsNull( acc->b )) {
+HXLINE( 249) acc->b = ::Array_obj< ::String >::fromData( _hx_array_data_4ec6cf05_12,1);
+ }
+ else {
+HXLINE( 249) acc->b->push(HX_("/",2f,00,00,00));
+ }
+ }
+HXLINE( 250) slashes = false;
+ }
+HXLINE( 252) if ((i1 >= 127)) {
+HXLINE( 252) ::String x1 = ::String::fromCharCode(i1);
+HXDLIN( 252) if (::hx::IsNotNull( acc->charBuf )) {
+HXLINE( 252) acc->flush();
+ }
+HXDLIN( 252) if (::hx::IsNull( acc->b )) {
+HXLINE( 252) acc->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x1));
+ }
+ else {
+HXLINE( 252) ::Array< ::String > acc2 = acc->b;
+HXDLIN( 252) acc2->push(::Std_obj::string(x1));
+ }
+ }
+ else {
+HXLINE( 252) if (::hx::IsNull( acc->charBuf )) {
+HXLINE( 252) acc->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 252) acc->charBuf->push(i1);
+ }
+ }
+ }
+ }
+ }
+ }
+HXLINE( 256) return acc->toString();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Path_obj,normalize,return )
+
+::String Path_obj::addTrailingSlash(::String path){
+ HX_STACKFRAME(&_hx_pos_9ba24db561a9c477_271_addTrailingSlash)
+HXLINE( 272) if ((path.length == 0)) {
+HXLINE( 273) return HX_("/",2f,00,00,00);
+ }
+HXLINE( 274) int c1 = path.lastIndexOf(HX_("/",2f,00,00,00),null());
+HXLINE( 275) int c2 = path.lastIndexOf(HX_("\\",5c,00,00,00),null());
+HXLINE( 276) if ((c1 < c2)) {
+HXLINE( 277) if ((c2 != (path.length - 1))) {
+HXLINE( 278) return (path + HX_("\\",5c,00,00,00));
+ }
+ else {
+HXLINE( 280) return path;
+ }
+ }
+ else {
+HXLINE( 282) if ((c1 != (path.length - 1))) {
+HXLINE( 283) return (path + HX_("/",2f,00,00,00));
+ }
+ else {
+HXLINE( 285) return path;
+ }
+ }
+HXLINE( 276) return null();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Path_obj,addTrailingSlash,return )
+
+::String Path_obj::removeTrailingSlashes(::String path){
+ HX_STACKFRAME(&_hx_pos_9ba24db561a9c477_299_removeTrailingSlashes)
+HXLINE( 300) while(true){
+HXLINE( 301) ::Dynamic _g = path.charCodeAt((path.length - 1));
+HXDLIN( 301) if (::hx::IsNull( _g )) {
+HXLINE( 305) goto _hx_goto_14;
+ }
+ else {
+HXLINE( 301) ::Dynamic _hx_switch_0 = _g;
+ if ( (_hx_switch_0==47) || (_hx_switch_0==92) ){
+HXLINE( 303) path = path.substr(0,-1);
+HXDLIN( 303) goto _hx_goto_15;
+ }
+ /* default */{
+HXLINE( 305) goto _hx_goto_14;
+ }
+ _hx_goto_15:;
+ }
+ }
+ _hx_goto_14:;
+HXLINE( 308) return path;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Path_obj,removeTrailingSlashes,return )
+
+bool Path_obj::isAbsolute(::String path){
+ HX_STACKFRAME(&_hx_pos_9ba24db561a9c477_314_isAbsolute)
+HXLINE( 315) if (::StringTools_obj::startsWith(path,HX_("/",2f,00,00,00))) {
+HXLINE( 316) return true;
+ }
+HXLINE( 317) if ((path.charAt(1) == HX_(":",3a,00,00,00))) {
+HXLINE( 318) return true;
+ }
+HXLINE( 319) if (::StringTools_obj::startsWith(path,HX_("\\\\",80,50,00,00))) {
+HXLINE( 320) return true;
+ }
+HXLINE( 321) return false;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Path_obj,isAbsolute,return )
+
+
+::hx::ObjectPtr< Path_obj > Path_obj::__new(::String path) {
+ ::hx::ObjectPtr< Path_obj > __this = new Path_obj();
+ __this->__construct(path);
+ return __this;
+}
+
+::hx::ObjectPtr< Path_obj > Path_obj::__alloc(::hx::Ctx *_hx_ctx,::String path) {
+ Path_obj *__this = (Path_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Path_obj), true, "haxe.io.Path"));
+ *(void **)__this = Path_obj::_hx_vtable;
+ __this->__construct(path);
+ return __this;
+}
+
+Path_obj::Path_obj()
+{
+}
+
+void Path_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(Path);
+ HX_MARK_MEMBER_NAME(dir,"dir");
+ HX_MARK_MEMBER_NAME(file,"file");
+ HX_MARK_MEMBER_NAME(ext,"ext");
+ HX_MARK_MEMBER_NAME(backslash,"backslash");
+ HX_MARK_END_CLASS();
+}
+
+void Path_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(dir,"dir");
+ HX_VISIT_MEMBER_NAME(file,"file");
+ HX_VISIT_MEMBER_NAME(ext,"ext");
+ HX_VISIT_MEMBER_NAME(backslash,"backslash");
+}
+
+::hx::Val Path_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"dir") ) { return ::hx::Val( dir ); }
+ if (HX_FIELD_EQ(inName,"ext") ) { return ::hx::Val( ext ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"file") ) { return ::hx::Val( file ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"toString") ) { return ::hx::Val( toString_dyn() ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"backslash") ) { return ::hx::Val( backslash ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool Path_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"join") ) { outValue = join_dyn(); return true; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"normalize") ) { outValue = normalize_dyn(); return true; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"isAbsolute") ) { outValue = isAbsolute_dyn(); return true; }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"withoutDirectory") ) { outValue = withoutDirectory_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"addTrailingSlash") ) { outValue = addTrailingSlash_dyn(); return true; }
+ break;
+ case 21:
+ if (HX_FIELD_EQ(inName,"removeTrailingSlashes") ) { outValue = removeTrailingSlashes_dyn(); return true; }
+ }
+ return false;
+}
+
+::hx::Val Path_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"dir") ) { dir=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"ext") ) { ext=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"file") ) { file=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"backslash") ) { backslash=inValue.Cast< bool >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void Path_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("dir",4d,3d,4c,00));
+ outFields->push(HX_("file",7c,ce,bb,43));
+ outFields->push(HX_("ext",a1,0c,4d,00));
+ outFields->push(HX_("backslash",b6,b8,45,c8));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Path_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(Path_obj,dir),HX_("dir",4d,3d,4c,00)},
+ {::hx::fsString,(int)offsetof(Path_obj,file),HX_("file",7c,ce,bb,43)},
+ {::hx::fsString,(int)offsetof(Path_obj,ext),HX_("ext",a1,0c,4d,00)},
+ {::hx::fsBool,(int)offsetof(Path_obj,backslash),HX_("backslash",b6,b8,45,c8)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *Path_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Path_obj_sMemberFields[] = {
+ HX_("dir",4d,3d,4c,00),
+ HX_("file",7c,ce,bb,43),
+ HX_("ext",a1,0c,4d,00),
+ HX_("backslash",b6,b8,45,c8),
+ HX_("toString",ac,d0,6e,38),
+ ::String(null()) };
+
+::hx::Class Path_obj::__mClass;
+
+static ::String Path_obj_sStaticFields[] = {
+ HX_("withoutDirectory",05,17,d2,7a),
+ HX_("join",ea,33,65,46),
+ HX_("normalize",8d,37,a1,ab),
+ HX_("addTrailingSlash",e0,d6,eb,26),
+ HX_("removeTrailingSlashes",8b,dc,1d,43),
+ HX_("isAbsolute",81,e0,44,3e),
+ ::String(null())
+};
+
+void Path_obj::__register()
+{
+ Path_obj _hx_dummy;
+ Path_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.io.Path",05,cf,c6,4e);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Path_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Path_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Path_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Path_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Path_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Path_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
+} // end namespace io
diff --git a/Sources/c_snikket/src/haxe/iterators/ArrayIterator.cpp b/Sources/c_snikket/src/haxe/iterators/ArrayIterator.cpp
new file mode 100644
index 0000000..be23a06
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/iterators/ArrayIterator.cpp
@@ -0,0 +1,147 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_iterators_ArrayIterator
+#include <haxe/iterators/ArrayIterator.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_44ded26575b0f4de_28_new,"haxe.iterators.ArrayIterator","new",0x70a754c8,"haxe.iterators.ArrayIterator.new","/usr/local/lib/haxe/std/haxe/iterators/ArrayIterator.hx",28,0xb40d6dcd)
+HX_LOCAL_STACK_FRAME(_hx_pos_44ded26575b0f4de_45_hasNext,"haxe.iterators.ArrayIterator","hasNext",0x74587dd5,"haxe.iterators.ArrayIterator.hasNext","/usr/local/lib/haxe/std/haxe/iterators/ArrayIterator.hx",45,0xb40d6dcd)
+HX_LOCAL_STACK_FRAME(_hx_pos_44ded26575b0f4de_53_next,"haxe.iterators.ArrayIterator","next",0x21c2db8b,"haxe.iterators.ArrayIterator.next","/usr/local/lib/haxe/std/haxe/iterators/ArrayIterator.hx",53,0xb40d6dcd)
+namespace haxe{
+namespace iterators{
+
+void ArrayIterator_obj::__construct(::cpp::VirtualArray array){
+ HX_STACKFRAME(&_hx_pos_44ded26575b0f4de_28_new)
+HXLINE( 30) this->current = 0;
+HXLINE( 37) this->array = array;
+ }
+
+Dynamic ArrayIterator_obj::__CreateEmpty() { return new ArrayIterator_obj; }
+
+void *ArrayIterator_obj::_hx_vtable = 0;
+
+Dynamic ArrayIterator_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< ArrayIterator_obj > _hx_result = new ArrayIterator_obj();
+ _hx_result->__construct(inArgs[0]);
+ return _hx_result;
+}
+
+bool ArrayIterator_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x189859c8;
+}
+
+bool ArrayIterator_obj::hasNext(){
+ HX_STACKFRAME(&_hx_pos_44ded26575b0f4de_45_hasNext)
+HXDLIN( 45) return (this->current < this->array->get_length());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ArrayIterator_obj,hasNext,return )
+
+ ::Dynamic ArrayIterator_obj::next(){
+ HX_STACKFRAME(&_hx_pos_44ded26575b0f4de_53_next)
+HXDLIN( 53) return this->array->__get(this->current++);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ArrayIterator_obj,next,return )
+
+
+ArrayIterator_obj::ArrayIterator_obj()
+{
+}
+
+void ArrayIterator_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(ArrayIterator);
+ HX_MARK_MEMBER_NAME(array,"array");
+ HX_MARK_MEMBER_NAME(current,"current");
+ HX_MARK_END_CLASS();
+}
+
+void ArrayIterator_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(array,"array");
+ HX_VISIT_MEMBER_NAME(current,"current");
+}
+
+::hx::Val ArrayIterator_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"next") ) { return ::hx::Val( next_dyn() ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"array") ) { return ::hx::Val( array ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"current") ) { return ::hx::Val( current ); }
+ if (HX_FIELD_EQ(inName,"hasNext") ) { return ::hx::Val( hasNext_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val ArrayIterator_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"array") ) { array=inValue.Cast< ::cpp::VirtualArray >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"current") ) { current=inValue.Cast< int >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void ArrayIterator_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("array",99,6d,8f,25));
+ outFields->push(HX_("current",39,9c,e3,cb));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo ArrayIterator_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::cpp::VirtualArray */ ,(int)offsetof(ArrayIterator_obj,array),HX_("array",99,6d,8f,25)},
+ {::hx::fsInt,(int)offsetof(ArrayIterator_obj,current),HX_("current",39,9c,e3,cb)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *ArrayIterator_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String ArrayIterator_obj_sMemberFields[] = {
+ HX_("array",99,6d,8f,25),
+ HX_("current",39,9c,e3,cb),
+ HX_("hasNext",6d,a5,46,18),
+ HX_("next",f3,84,02,49),
+ ::String(null()) };
+
+::hx::Class ArrayIterator_obj::__mClass;
+
+void ArrayIterator_obj::__register()
+{
+ ArrayIterator_obj _hx_dummy;
+ ArrayIterator_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.iterators.ArrayIterator",d6,90,23,99);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(ArrayIterator_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< ArrayIterator_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = ArrayIterator_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = ArrayIterator_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
+} // end namespace iterators
diff --git a/Sources/c_snikket/src/haxe/iterators/MapKeyValueIterator.cpp b/Sources/c_snikket/src/haxe/iterators/MapKeyValueIterator.cpp
new file mode 100644
index 0000000..1c9f88b
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/iterators/MapKeyValueIterator.cpp
@@ -0,0 +1,166 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_iterators_MapKeyValueIterator
+#include <haxe/iterators/MapKeyValueIterator.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_2013d4993119aacc_35_new,"haxe.iterators.MapKeyValueIterator","new",0x902a97fd,"haxe.iterators.MapKeyValueIterator.new","/usr/local/lib/haxe/std/haxe/iterators/MapKeyValueIterator.hx",35,0x99dcf1f8)
+HX_LOCAL_STACK_FRAME(_hx_pos_2013d4993119aacc_44_hasNext,"haxe.iterators.MapKeyValueIterator","hasNext",0x6e75ff8a,"haxe.iterators.MapKeyValueIterator.hasNext","/usr/local/lib/haxe/std/haxe/iterators/MapKeyValueIterator.hx",44,0x99dcf1f8)
+HX_LOCAL_STACK_FRAME(_hx_pos_2013d4993119aacc_50_next,"haxe.iterators.MapKeyValueIterator","next",0x951a66b6,"haxe.iterators.MapKeyValueIterator.next","/usr/local/lib/haxe/std/haxe/iterators/MapKeyValueIterator.hx",50,0x99dcf1f8)
+namespace haxe{
+namespace iterators{
+
+void MapKeyValueIterator_obj::__construct(::Dynamic map){
+ HX_STACKFRAME(&_hx_pos_2013d4993119aacc_35_new)
+HXLINE( 36) this->map = map;
+HXLINE( 37) this->keys = ::haxe::IMap_obj::keys(map);
+ }
+
+Dynamic MapKeyValueIterator_obj::__CreateEmpty() { return new MapKeyValueIterator_obj; }
+
+void *MapKeyValueIterator_obj::_hx_vtable = 0;
+
+Dynamic MapKeyValueIterator_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< MapKeyValueIterator_obj > _hx_result = new MapKeyValueIterator_obj();
+ _hx_result->__construct(inArgs[0]);
+ return _hx_result;
+}
+
+bool MapKeyValueIterator_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x5732dffd;
+}
+
+bool MapKeyValueIterator_obj::hasNext(){
+ HX_STACKFRAME(&_hx_pos_2013d4993119aacc_44_hasNext)
+HXDLIN( 44) return ( (bool)(this->keys->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) );
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(MapKeyValueIterator_obj,hasNext,return )
+
+ ::Dynamic MapKeyValueIterator_obj::next(){
+ HX_STACKFRAME(&_hx_pos_2013d4993119aacc_50_next)
+HXLINE( 51) ::Dynamic key = this->keys->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)();
+HXLINE( 52) return ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("key",9f,89,51,00),key)
+ ->setFixed(1,HX_("value",71,7f,b8,31),::haxe::IMap_obj::get(this->map,key)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(MapKeyValueIterator_obj,next,return )
+
+
+::hx::ObjectPtr< MapKeyValueIterator_obj > MapKeyValueIterator_obj::__new(::Dynamic map) {
+ ::hx::ObjectPtr< MapKeyValueIterator_obj > __this = new MapKeyValueIterator_obj();
+ __this->__construct(map);
+ return __this;
+}
+
+::hx::ObjectPtr< MapKeyValueIterator_obj > MapKeyValueIterator_obj::__alloc(::hx::Ctx *_hx_ctx,::Dynamic map) {
+ MapKeyValueIterator_obj *__this = (MapKeyValueIterator_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(MapKeyValueIterator_obj), true, "haxe.iterators.MapKeyValueIterator"));
+ *(void **)__this = MapKeyValueIterator_obj::_hx_vtable;
+ __this->__construct(map);
+ return __this;
+}
+
+MapKeyValueIterator_obj::MapKeyValueIterator_obj()
+{
+}
+
+void MapKeyValueIterator_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(MapKeyValueIterator);
+ HX_MARK_MEMBER_NAME(map,"map");
+ HX_MARK_MEMBER_NAME(keys,"keys");
+ HX_MARK_END_CLASS();
+}
+
+void MapKeyValueIterator_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(map,"map");
+ HX_VISIT_MEMBER_NAME(keys,"keys");
+}
+
+::hx::Val MapKeyValueIterator_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"map") ) { return ::hx::Val( map ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"keys") ) { return ::hx::Val( keys ); }
+ if (HX_FIELD_EQ(inName,"next") ) { return ::hx::Val( next_dyn() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"hasNext") ) { return ::hx::Val( hasNext_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val MapKeyValueIterator_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"map") ) { map=inValue.Cast< ::Dynamic >(); return inValue; }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"keys") ) { keys=inValue.Cast< ::Dynamic >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void MapKeyValueIterator_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("map",9c,0a,53,00));
+ outFields->push(HX_("keys",f4,e1,06,47));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo MapKeyValueIterator_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(MapKeyValueIterator_obj,map),HX_("map",9c,0a,53,00)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(MapKeyValueIterator_obj,keys),HX_("keys",f4,e1,06,47)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *MapKeyValueIterator_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String MapKeyValueIterator_obj_sMemberFields[] = {
+ HX_("map",9c,0a,53,00),
+ HX_("keys",f4,e1,06,47),
+ HX_("hasNext",6d,a5,46,18),
+ HX_("next",f3,84,02,49),
+ ::String(null()) };
+
+::hx::Class MapKeyValueIterator_obj::__mClass;
+
+void MapKeyValueIterator_obj::__register()
+{
+ MapKeyValueIterator_obj _hx_dummy;
+ MapKeyValueIterator_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.iterators.MapKeyValueIterator",8b,d5,ad,b4);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(MapKeyValueIterator_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< MapKeyValueIterator_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = MapKeyValueIterator_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = MapKeyValueIterator_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
+} // end namespace iterators
diff --git a/Sources/c_snikket/src/haxe/xml/Parser.cpp b/Sources/c_snikket/src/haxe/xml/Parser.cpp
new file mode 100644
index 0000000..1237bc5
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/xml/Parser.cpp
@@ -0,0 +1,1062 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_StringBuf
+#include <StringBuf.h>
+#endif
+#ifndef INCLUDED_Xml
+#include <Xml.h>
+#endif
+#ifndef INCLUDED__Xml_XmlType_Impl_
+#include <_Xml/XmlType_Impl_.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_StringMap
+#include <haxe/ds/StringMap.h>
+#endif
+#ifndef INCLUDED_haxe_xml_Parser
+#include <haxe/xml/Parser.h>
+#endif
+#ifndef INCLUDED_haxe_xml_XmlParserException
+#include <haxe/xml/XmlParserException.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_4387901c245e1a2b_115_parse,"haxe.xml.Parser","parse",0x937905c3,"haxe.xml.Parser.parse","/usr/local/lib/haxe/std/haxe/xml/Parser.hx",115,0x9bd139bb)
+HX_LOCAL_STACK_FRAME(_hx_pos_4387901c245e1a2b_121_doParse,"haxe.xml.Parser","doParse",0x2e9a6a38,"haxe.xml.Parser.doParse","/usr/local/lib/haxe/std/haxe/xml/Parser.hx",121,0x9bd139bb)
+HX_LOCAL_STACK_FRAME(_hx_pos_4387901c245e1a2b_100_boot,"haxe.xml.Parser","boot",0x0af6f0a2,"haxe.xml.Parser.boot","/usr/local/lib/haxe/std/haxe/xml/Parser.hx",100,0x9bd139bb)
+namespace haxe{
+namespace xml{
+
+void Parser_obj::__construct() { }
+
+Dynamic Parser_obj::__CreateEmpty() { return new Parser_obj; }
+
+void *Parser_obj::_hx_vtable = 0;
+
+Dynamic Parser_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Parser_obj > _hx_result = new Parser_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool Parser_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x1c6f1730;
+}
+
+ ::haxe::ds::StringMap Parser_obj::escapes;
+
+ ::Xml Parser_obj::parse(::String str,::hx::Null< bool > __o_strict){
+ bool strict = __o_strict.Default(false);
+ HX_STACKFRAME(&_hx_pos_4387901c245e1a2b_115_parse)
+HXLINE( 116) ::Xml doc = ::Xml_obj::createDocument();
+HXLINE( 117) ::haxe::xml::Parser_obj::doParse(str,strict,0,doc);
+HXLINE( 118) return doc;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Parser_obj,parse,return )
+
+int Parser_obj::doParse(::String str,bool strict,::hx::Null< int > __o_p, ::Xml parent){
+ int p = __o_p.Default(0);
+ HX_GC_STACKFRAME(&_hx_pos_4387901c245e1a2b_121_doParse)
+HXLINE( 122) ::Xml xml = null();
+HXLINE( 123) int state = 1;
+HXLINE( 124) int next = 1;
+HXLINE( 125) ::String aname = null();
+HXLINE( 126) int start = 0;
+HXLINE( 127) int nsubs = 0;
+HXLINE( 128) int nbrackets = 0;
+HXLINE( 129) ::StringBuf buf = ::StringBuf_obj::__alloc( HX_CTX );
+HXLINE( 131) int escapeNext = 1;
+HXLINE( 132) int attrValQuote = -1;
+HXLINE( 137) while((p < str.length)){
+HXLINE( 138) int c = str.cca(p);
+HXLINE( 139) switch((int)(state)){
+ case (int)0: {
+HXLINE( 141) switch((int)(c)){
+ case (int)9: case (int)10: case (int)13: case (int)32: {
+ }
+ break;
+ default:{
+HXLINE( 144) state = next;
+HXLINE( 145) continue;
+ }
+ }
+ }
+ break;
+ case (int)1: {
+HXLINE( 148) if ((c == 60)) {
+HXLINE( 150) state = 0;
+HXLINE( 151) next = 2;
+ }
+ else {
+HXLINE( 153) start = p;
+HXLINE( 154) state = 13;
+HXLINE( 155) continue;
+ }
+ }
+ break;
+ case (int)2: {
+HXLINE( 179) switch((int)(c)){
+ case (int)33: {
+HXLINE( 181) if ((str.cca((p + 1)) == 91)) {
+HXLINE( 182) p = (p + 2);
+HXLINE( 183) if ((str.substr(p,6).toUpperCase() != HX_("CDATA[",ce,73,5f,1c))) {
+HXLINE( 184) HX_STACK_DO_THROW( ::haxe::xml::XmlParserException_obj::__alloc( HX_CTX ,HX_("Expected <![CDATA[",1c,11,1f,2d),str,p));
+ }
+HXLINE( 185) p = (p + 5);
+HXLINE( 186) state = 17;
+HXLINE( 187) start = (p + 1);
+ }
+ else {
+HXLINE( 188) bool _hx_tmp;
+HXDLIN( 188) if ((str.cca((p + 1)) != 68)) {
+HXLINE( 188) _hx_tmp = (str.cca((p + 1)) == 100);
+ }
+ else {
+HXLINE( 188) _hx_tmp = true;
+ }
+HXDLIN( 188) if (_hx_tmp) {
+HXLINE( 189) if ((str.substr((p + 2),6).toUpperCase() != HX_("OCTYPE",ce,19,d4,61))) {
+HXLINE( 190) HX_STACK_DO_THROW( ::haxe::xml::XmlParserException_obj::__alloc( HX_CTX ,HX_("Expected <!DOCTYPE",c5,0b,26,b6),str,p));
+ }
+HXLINE( 191) p = (p + 8);
+HXLINE( 192) state = 16;
+HXLINE( 193) start = (p + 1);
+ }
+ else {
+HXLINE( 194) bool _hx_tmp1;
+HXDLIN( 194) if ((str.cca((p + 1)) == 45)) {
+HXLINE( 194) _hx_tmp1 = (str.cca((p + 2)) != 45);
+ }
+ else {
+HXLINE( 194) _hx_tmp1 = true;
+ }
+HXDLIN( 194) if (_hx_tmp1) {
+HXLINE( 194) HX_STACK_DO_THROW( ::haxe::xml::XmlParserException_obj::__alloc( HX_CTX ,HX_("Expected <!--",8d,3d,c1,53),str,p));
+ }
+ else {
+HXLINE( 196) p = (p + 2);
+HXLINE( 197) state = 15;
+HXLINE( 198) start = (p + 1);
+ }
+ }
+ }
+ }
+ break;
+ case (int)47: {
+HXLINE( 204) if (::hx::IsNull( parent )) {
+HXLINE( 205) HX_STACK_DO_THROW( ::haxe::xml::XmlParserException_obj::__alloc( HX_CTX ,HX_("Expected node name",a1,85,63,3f),str,p));
+ }
+HXLINE( 206) start = (p + 1);
+HXLINE( 207) state = 0;
+HXLINE( 208) next = 10;
+ }
+ break;
+ case (int)63: {
+HXLINE( 201) state = 14;
+HXLINE( 202) start = p;
+ }
+ break;
+ default:{
+HXLINE( 210) state = 3;
+HXLINE( 211) start = p;
+HXLINE( 212) continue;
+ }
+ }
+ }
+ break;
+ case (int)3: {
+HXLINE( 215) bool _hx_tmp2;
+HXDLIN( 215) bool _hx_tmp3;
+HXDLIN( 215) bool _hx_tmp4;
+HXDLIN( 215) bool _hx_tmp5;
+HXDLIN( 215) bool _hx_tmp6;
+HXDLIN( 215) bool _hx_tmp7;
+HXDLIN( 215) bool _hx_tmp8;
+HXDLIN( 215) if ((c >= 97)) {
+HXLINE( 215) _hx_tmp8 = (c <= 122);
+ }
+ else {
+HXLINE( 215) _hx_tmp8 = false;
+ }
+HXDLIN( 215) if (!(_hx_tmp8)) {
+HXLINE( 215) if ((c >= 65)) {
+HXLINE( 215) _hx_tmp7 = (c <= 90);
+ }
+ else {
+HXLINE( 215) _hx_tmp7 = false;
+ }
+ }
+ else {
+HXLINE( 215) _hx_tmp7 = true;
+ }
+HXDLIN( 215) if (!(_hx_tmp7)) {
+HXLINE( 215) if ((c >= 48)) {
+HXLINE( 215) _hx_tmp6 = (c <= 57);
+ }
+ else {
+HXLINE( 215) _hx_tmp6 = false;
+ }
+ }
+ else {
+HXLINE( 215) _hx_tmp6 = true;
+ }
+HXDLIN( 215) if (!(_hx_tmp6)) {
+HXLINE( 215) _hx_tmp5 = (c == 58);
+ }
+ else {
+HXLINE( 215) _hx_tmp5 = true;
+ }
+HXDLIN( 215) if (!(_hx_tmp5)) {
+HXLINE( 215) _hx_tmp4 = (c == 46);
+ }
+ else {
+HXLINE( 215) _hx_tmp4 = true;
+ }
+HXDLIN( 215) if (!(_hx_tmp4)) {
+HXLINE( 215) _hx_tmp3 = (c == 95);
+ }
+ else {
+HXLINE( 215) _hx_tmp3 = true;
+ }
+HXDLIN( 215) if (!(_hx_tmp3)) {
+HXLINE( 215) _hx_tmp2 = (c == 45);
+ }
+ else {
+HXLINE( 215) _hx_tmp2 = true;
+ }
+HXDLIN( 215) if (!(_hx_tmp2)) {
+HXLINE( 216) if ((p == start)) {
+HXLINE( 217) HX_STACK_DO_THROW( ::haxe::xml::XmlParserException_obj::__alloc( HX_CTX ,HX_("Expected node name",a1,85,63,3f),str,p));
+ }
+HXLINE( 218) xml = ::Xml_obj::createElement(str.substr(start,(p - start)));
+HXLINE( 219) {
+HXLINE( 219) parent->addChild(xml);
+HXDLIN( 219) nsubs = (nsubs + 1);
+ }
+HXLINE( 220) state = 0;
+HXLINE( 221) next = 4;
+HXLINE( 222) continue;
+ }
+ }
+ break;
+ case (int)4: {
+HXLINE( 225) switch((int)(c)){
+ case (int)47: {
+HXLINE( 227) state = 11;
+ }
+ break;
+ case (int)62: {
+HXLINE( 229) state = 9;
+ }
+ break;
+ default:{
+HXLINE( 231) state = 5;
+HXLINE( 232) start = p;
+HXLINE( 233) continue;
+ }
+ }
+ }
+ break;
+ case (int)5: {
+HXLINE( 236) bool _hx_tmp9;
+HXDLIN( 236) bool _hx_tmp10;
+HXDLIN( 236) bool _hx_tmp11;
+HXDLIN( 236) bool _hx_tmp12;
+HXDLIN( 236) bool _hx_tmp13;
+HXDLIN( 236) bool _hx_tmp14;
+HXDLIN( 236) bool _hx_tmp15;
+HXDLIN( 236) if ((c >= 97)) {
+HXLINE( 236) _hx_tmp15 = (c <= 122);
+ }
+ else {
+HXLINE( 236) _hx_tmp15 = false;
+ }
+HXDLIN( 236) if (!(_hx_tmp15)) {
+HXLINE( 236) if ((c >= 65)) {
+HXLINE( 236) _hx_tmp14 = (c <= 90);
+ }
+ else {
+HXLINE( 236) _hx_tmp14 = false;
+ }
+ }
+ else {
+HXLINE( 236) _hx_tmp14 = true;
+ }
+HXDLIN( 236) if (!(_hx_tmp14)) {
+HXLINE( 236) if ((c >= 48)) {
+HXLINE( 236) _hx_tmp13 = (c <= 57);
+ }
+ else {
+HXLINE( 236) _hx_tmp13 = false;
+ }
+ }
+ else {
+HXLINE( 236) _hx_tmp13 = true;
+ }
+HXDLIN( 236) if (!(_hx_tmp13)) {
+HXLINE( 236) _hx_tmp12 = (c == 58);
+ }
+ else {
+HXLINE( 236) _hx_tmp12 = true;
+ }
+HXDLIN( 236) if (!(_hx_tmp12)) {
+HXLINE( 236) _hx_tmp11 = (c == 46);
+ }
+ else {
+HXLINE( 236) _hx_tmp11 = true;
+ }
+HXDLIN( 236) if (!(_hx_tmp11)) {
+HXLINE( 236) _hx_tmp10 = (c == 95);
+ }
+ else {
+HXLINE( 236) _hx_tmp10 = true;
+ }
+HXDLIN( 236) if (!(_hx_tmp10)) {
+HXLINE( 236) _hx_tmp9 = (c == 45);
+ }
+ else {
+HXLINE( 236) _hx_tmp9 = true;
+ }
+HXDLIN( 236) if (!(_hx_tmp9)) {
+HXLINE( 238) if ((start == p)) {
+HXLINE( 239) HX_STACK_DO_THROW( ::haxe::xml::XmlParserException_obj::__alloc( HX_CTX ,HX_("Expected attribute name",57,65,2b,54),str,p));
+ }
+HXLINE( 237) ::String tmp = str.substr(start,(p - start));
+HXLINE( 241) aname = tmp;
+HXLINE( 242) if (xml->exists(aname)) {
+HXLINE( 243) HX_STACK_DO_THROW( ::haxe::xml::XmlParserException_obj::__alloc( HX_CTX ,((HX_("Duplicate attribute [",22,75,cb,05) + aname) + HX_("]",5d,00,00,00)),str,p));
+ }
+HXLINE( 244) state = 0;
+HXLINE( 245) next = 6;
+HXLINE( 246) continue;
+ }
+ }
+ break;
+ case (int)6: {
+HXLINE( 249) if ((c == 61)) {
+HXLINE( 251) state = 0;
+HXLINE( 252) next = 7;
+ }
+ else {
+HXLINE( 254) HX_STACK_DO_THROW( ::haxe::xml::XmlParserException_obj::__alloc( HX_CTX ,HX_("Expected =",b5,dc,23,c6),str,p));
+ }
+ }
+ break;
+ case (int)7: {
+HXLINE( 257) switch((int)(c)){
+ case (int)34: case (int)39: {
+HXLINE( 259) buf = ::StringBuf_obj::__alloc( HX_CTX );
+HXLINE( 260) state = 8;
+HXLINE( 261) start = (p + 1);
+HXLINE( 262) attrValQuote = c;
+ }
+ break;
+ default:{
+HXLINE( 264) HX_STACK_DO_THROW( ::haxe::xml::XmlParserException_obj::__alloc( HX_CTX ,HX_("Expected \"",9a,dc,23,c6),str,p));
+ }
+ }
+ }
+ break;
+ case (int)8: {
+HXLINE( 267) switch((int)(c)){
+ case (int)38: {
+HXLINE( 269) {
+HXLINE( 269) ::Dynamic len = (p - start);
+HXDLIN( 269) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 269) buf->flush();
+ }
+HXDLIN( 269) if (::hx::IsNull( buf->b )) {
+HXLINE( 269) buf->b = ::Array_obj< ::String >::__new(1)->init(0,str.substr(start,len));
+ }
+ else {
+HXLINE( 269) ::Array< ::String > buf1 = buf->b;
+HXDLIN( 269) buf1->push(str.substr(start,len));
+ }
+ }
+HXLINE( 270) state = 18;
+HXLINE( 271) escapeNext = 8;
+HXLINE( 272) start = (p + 1);
+ }
+ break;
+ case (int)60: case (int)62: {
+HXLINE( 273) if (strict) {
+HXLINE( 275) HX_STACK_DO_THROW( ::haxe::xml::XmlParserException_obj::__alloc( HX_CTX ,((HX_("Invalid unescaped ",ff,da,cb,cc) + ::String::fromCharCode(c)) + HX_(" in attribute value",52,5a,ca,13)),str,p));
+ }
+ else {
+HXLINE( 276) if ((c == attrValQuote)) {
+HXLINE( 277) {
+HXLINE( 277) ::Dynamic len1 = (p - start);
+HXDLIN( 277) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 277) buf->flush();
+ }
+HXDLIN( 277) if (::hx::IsNull( buf->b )) {
+HXLINE( 277) buf->b = ::Array_obj< ::String >::__new(1)->init(0,str.substr(start,len1));
+ }
+ else {
+HXLINE( 277) ::Array< ::String > buf2 = buf->b;
+HXDLIN( 277) buf2->push(str.substr(start,len1));
+ }
+ }
+HXLINE( 278) ::String val = buf->toString();
+HXLINE( 279) buf = ::StringBuf_obj::__alloc( HX_CTX );
+HXLINE( 280) xml->set(aname,val);
+HXLINE( 281) state = 0;
+HXLINE( 282) next = 4;
+ }
+ }
+ }
+ break;
+ default:{
+HXLINE( 276) if ((c == attrValQuote)) {
+HXLINE( 277) {
+HXLINE( 277) ::Dynamic len2 = (p - start);
+HXDLIN( 277) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 277) buf->flush();
+ }
+HXDLIN( 277) if (::hx::IsNull( buf->b )) {
+HXLINE( 277) buf->b = ::Array_obj< ::String >::__new(1)->init(0,str.substr(start,len2));
+ }
+ else {
+HXLINE( 277) ::Array< ::String > buf3 = buf->b;
+HXDLIN( 277) buf3->push(str.substr(start,len2));
+ }
+ }
+HXLINE( 278) ::String val1 = buf->toString();
+HXLINE( 279) buf = ::StringBuf_obj::__alloc( HX_CTX );
+HXLINE( 280) xml->set(aname,val1);
+HXLINE( 281) state = 0;
+HXLINE( 282) next = 4;
+ }
+ }
+ }
+ }
+ break;
+ case (int)9: {
+HXLINE( 285) p = ::haxe::xml::Parser_obj::doParse(str,strict,p,xml);
+HXLINE( 286) start = p;
+HXLINE( 287) state = 1;
+ }
+ break;
+ case (int)10: {
+HXLINE( 305) bool _hx_tmp16;
+HXDLIN( 305) bool _hx_tmp17;
+HXDLIN( 305) bool _hx_tmp18;
+HXDLIN( 305) bool _hx_tmp19;
+HXDLIN( 305) bool _hx_tmp20;
+HXDLIN( 305) bool _hx_tmp21;
+HXDLIN( 305) bool _hx_tmp22;
+HXDLIN( 305) if ((c >= 97)) {
+HXLINE( 305) _hx_tmp22 = (c <= 122);
+ }
+ else {
+HXLINE( 305) _hx_tmp22 = false;
+ }
+HXDLIN( 305) if (!(_hx_tmp22)) {
+HXLINE( 305) if ((c >= 65)) {
+HXLINE( 305) _hx_tmp21 = (c <= 90);
+ }
+ else {
+HXLINE( 305) _hx_tmp21 = false;
+ }
+ }
+ else {
+HXLINE( 305) _hx_tmp21 = true;
+ }
+HXDLIN( 305) if (!(_hx_tmp21)) {
+HXLINE( 305) if ((c >= 48)) {
+HXLINE( 305) _hx_tmp20 = (c <= 57);
+ }
+ else {
+HXLINE( 305) _hx_tmp20 = false;
+ }
+ }
+ else {
+HXLINE( 305) _hx_tmp20 = true;
+ }
+HXDLIN( 305) if (!(_hx_tmp20)) {
+HXLINE( 305) _hx_tmp19 = (c == 58);
+ }
+ else {
+HXLINE( 305) _hx_tmp19 = true;
+ }
+HXDLIN( 305) if (!(_hx_tmp19)) {
+HXLINE( 305) _hx_tmp18 = (c == 46);
+ }
+ else {
+HXLINE( 305) _hx_tmp18 = true;
+ }
+HXDLIN( 305) if (!(_hx_tmp18)) {
+HXLINE( 305) _hx_tmp17 = (c == 95);
+ }
+ else {
+HXLINE( 305) _hx_tmp17 = true;
+ }
+HXDLIN( 305) if (!(_hx_tmp17)) {
+HXLINE( 305) _hx_tmp16 = (c == 45);
+ }
+ else {
+HXLINE( 305) _hx_tmp16 = true;
+ }
+HXDLIN( 305) if (!(_hx_tmp16)) {
+HXLINE( 306) if ((start == p)) {
+HXLINE( 307) HX_STACK_DO_THROW( ::haxe::xml::XmlParserException_obj::__alloc( HX_CTX ,HX_("Expected node name",a1,85,63,3f),str,p));
+ }
+HXLINE( 309) ::String v = str.substr(start,(p - start));
+HXLINE( 310) bool _hx_tmp23;
+HXDLIN( 310) if (::hx::IsNotNull( parent )) {
+HXLINE( 310) _hx_tmp23 = (parent->nodeType != 0);
+ }
+ else {
+HXLINE( 310) _hx_tmp23 = true;
+ }
+HXDLIN( 310) if (_hx_tmp23) {
+HXLINE( 311) HX_STACK_DO_THROW( ::haxe::xml::XmlParserException_obj::__alloc( HX_CTX ,((HX_("Unexpected </",42,6f,35,1e) + v) + HX_(">, tag is not open",35,30,75,b8)),str,p));
+ }
+HXLINE( 313) if ((parent->nodeType != ::Xml_obj::Element)) {
+HXLINE( 313) HX_STACK_DO_THROW((HX_("Bad node type, expected Element but found ",d8,90,8b,bb) + ::_Xml::XmlType_Impl__obj::toString(parent->nodeType)));
+ }
+HXDLIN( 313) if ((v != parent->nodeName)) {
+HXLINE( 314) if ((parent->nodeType != ::Xml_obj::Element)) {
+HXLINE( 314) HX_STACK_DO_THROW((HX_("Bad node type, expected Element but found ",d8,90,8b,bb) + ::_Xml::XmlType_Impl__obj::toString(parent->nodeType)));
+ }
+HXDLIN( 314) HX_STACK_DO_THROW( ::haxe::xml::XmlParserException_obj::__alloc( HX_CTX ,((HX_("Expected </",fb,40,3d,99) + parent->nodeName) + HX_(">",3e,00,00,00)),str,p));
+ }
+HXLINE( 316) state = 0;
+HXLINE( 317) next = 12;
+HXLINE( 318) continue;
+ }
+ }
+ break;
+ case (int)11: {
+HXLINE( 289) if ((c == 62)) {
+HXLINE( 291) state = 1;
+ }
+ else {
+HXLINE( 293) HX_STACK_DO_THROW( ::haxe::xml::XmlParserException_obj::__alloc( HX_CTX ,HX_("Expected >",b6,dc,23,c6),str,p));
+ }
+ }
+ break;
+ case (int)12: {
+HXLINE( 296) if ((c == 62)) {
+HXLINE( 298) if ((nsubs == 0)) {
+HXLINE( 299) parent->addChild(::Xml_obj::createPCData(HX_("",00,00,00,00)));
+ }
+HXLINE( 300) return p;
+ }
+ else {
+HXLINE( 302) HX_STACK_DO_THROW( ::haxe::xml::XmlParserException_obj::__alloc( HX_CTX ,HX_("Expected >",b6,dc,23,c6),str,p));
+ }
+ }
+ break;
+ case (int)13: {
+HXLINE( 158) if ((c == 60)) {
+HXLINE( 159) {
+HXLINE( 159) ::Dynamic len3 = (p - start);
+HXDLIN( 159) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 159) buf->flush();
+ }
+HXDLIN( 159) if (::hx::IsNull( buf->b )) {
+HXLINE( 159) buf->b = ::Array_obj< ::String >::__new(1)->init(0,str.substr(start,len3));
+ }
+ else {
+HXLINE( 159) ::Array< ::String > buf4 = buf->b;
+HXDLIN( 159) buf4->push(str.substr(start,len3));
+ }
+ }
+HXLINE( 160) ::Xml child = ::Xml_obj::createPCData(buf->toString());
+HXLINE( 161) buf = ::StringBuf_obj::__alloc( HX_CTX );
+HXLINE( 162) {
+HXLINE( 162) parent->addChild(child);
+HXDLIN( 162) nsubs = (nsubs + 1);
+ }
+HXLINE( 163) state = 0;
+HXLINE( 164) next = 2;
+ }
+ else {
+HXLINE( 165) if ((c == 38)) {
+HXLINE( 166) {
+HXLINE( 166) ::Dynamic len4 = (p - start);
+HXDLIN( 166) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 166) buf->flush();
+ }
+HXDLIN( 166) if (::hx::IsNull( buf->b )) {
+HXLINE( 166) buf->b = ::Array_obj< ::String >::__new(1)->init(0,str.substr(start,len4));
+ }
+ else {
+HXLINE( 166) ::Array< ::String > buf5 = buf->b;
+HXDLIN( 166) buf5->push(str.substr(start,len4));
+ }
+ }
+HXLINE( 167) state = 18;
+HXLINE( 168) escapeNext = 13;
+HXLINE( 169) start = (p + 1);
+ }
+ }
+ }
+ break;
+ case (int)14: {
+HXLINE( 336) bool _hx_tmp24;
+HXDLIN( 336) if ((c == 63)) {
+HXLINE( 336) _hx_tmp24 = (str.cca((p + 1)) == 62);
+ }
+ else {
+HXLINE( 336) _hx_tmp24 = false;
+ }
+HXDLIN( 336) if (_hx_tmp24) {
+HXLINE( 337) p = (p + 1);
+HXLINE( 338) ::String str1 = str.substr((start + 1),((p - start) - 2));
+HXLINE( 339) {
+HXLINE( 339) parent->addChild(::Xml_obj::createProcessingInstruction(str1));
+HXDLIN( 339) nsubs = (nsubs + 1);
+ }
+HXLINE( 340) state = 1;
+ }
+ }
+ break;
+ case (int)15: {
+HXLINE( 321) bool _hx_tmp25;
+HXDLIN( 321) bool _hx_tmp26;
+HXDLIN( 321) if ((c == 45)) {
+HXLINE( 321) _hx_tmp26 = (str.cca((p + 1)) == 45);
+ }
+ else {
+HXLINE( 321) _hx_tmp26 = false;
+ }
+HXDLIN( 321) if (_hx_tmp26) {
+HXLINE( 321) _hx_tmp25 = (str.cca((p + 2)) == 62);
+ }
+ else {
+HXLINE( 321) _hx_tmp25 = false;
+ }
+HXDLIN( 321) if (_hx_tmp25) {
+HXLINE( 322) {
+HXLINE( 322) parent->addChild(::Xml_obj::createComment(str.substr(start,(p - start))));
+HXDLIN( 322) nsubs = (nsubs + 1);
+ }
+HXLINE( 323) p = (p + 2);
+HXLINE( 324) state = 1;
+ }
+ }
+ break;
+ case (int)16: {
+HXLINE( 327) if ((c == 91)) {
+HXLINE( 328) nbrackets = (nbrackets + 1);
+ }
+ else {
+HXLINE( 329) if ((c == 93)) {
+HXLINE( 330) nbrackets = (nbrackets - 1);
+ }
+ else {
+HXLINE( 331) bool _hx_tmp27;
+HXDLIN( 331) if ((c == 62)) {
+HXLINE( 331) _hx_tmp27 = (nbrackets == 0);
+ }
+ else {
+HXLINE( 331) _hx_tmp27 = false;
+ }
+HXDLIN( 331) if (_hx_tmp27) {
+HXLINE( 332) {
+HXLINE( 332) parent->addChild(::Xml_obj::createDocType(str.substr(start,(p - start))));
+HXDLIN( 332) nsubs = (nsubs + 1);
+ }
+HXLINE( 333) state = 1;
+ }
+ }
+ }
+ }
+ break;
+ case (int)17: {
+HXLINE( 172) bool _hx_tmp28;
+HXDLIN( 172) bool _hx_tmp29;
+HXDLIN( 172) if ((c == 93)) {
+HXLINE( 172) _hx_tmp29 = (str.cca((p + 1)) == 93);
+ }
+ else {
+HXLINE( 172) _hx_tmp29 = false;
+ }
+HXDLIN( 172) if (_hx_tmp29) {
+HXLINE( 172) _hx_tmp28 = (str.cca((p + 2)) == 62);
+ }
+ else {
+HXLINE( 172) _hx_tmp28 = false;
+ }
+HXDLIN( 172) if (_hx_tmp28) {
+HXLINE( 173) ::Xml child1 = ::Xml_obj::createCData(str.substr(start,(p - start)));
+HXLINE( 174) {
+HXLINE( 174) parent->addChild(child1);
+HXDLIN( 174) nsubs = (nsubs + 1);
+ }
+HXLINE( 175) p = (p + 2);
+HXLINE( 176) state = 1;
+ }
+ }
+ break;
+ case (int)18: {
+HXLINE( 343) if ((c == 59)) {
+HXLINE( 344) ::String s = str.substr(start,(p - start));
+HXLINE( 345) if ((s.cca(0) == 35)) {
+HXLINE( 346) ::Dynamic c1;
+HXDLIN( 346) if ((s.cca(1) == 120)) {
+HXLINE( 346) c1 = ::Std_obj::parseInt((HX_("0",30,00,00,00) + s.substr(1,(s.length - 1))));
+ }
+ else {
+HXLINE( 346) c1 = ::Std_obj::parseInt(s.substr(1,(s.length - 1)));
+ }
+HXLINE( 366) {
+HXLINE( 366) int c2 = ( (int)(c1) );
+HXDLIN( 366) if ((c2 >= 127)) {
+HXLINE( 366) ::String x = ::String::fromCharCode(c2);
+HXDLIN( 366) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 366) buf->flush();
+ }
+HXDLIN( 366) if (::hx::IsNull( buf->b )) {
+HXLINE( 366) buf->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x));
+ }
+ else {
+HXLINE( 366) ::Array< ::String > buf6 = buf->b;
+HXDLIN( 366) buf6->push(::Std_obj::string(x));
+ }
+ }
+ else {
+HXLINE( 366) if (::hx::IsNull( buf->charBuf )) {
+HXLINE( 366) buf->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 366) buf->charBuf->push(c2);
+ }
+ }
+ }
+ else {
+HXLINE( 367) if (!(::haxe::xml::Parser_obj::escapes->exists(s))) {
+HXLINE( 368) if (strict) {
+HXLINE( 369) HX_STACK_DO_THROW( ::haxe::xml::XmlParserException_obj::__alloc( HX_CTX ,(HX_("Undefined entity: ",39,48,f2,48) + s),str,p));
+ }
+HXLINE( 370) {
+HXLINE( 370) ::String x1 = ((HX_("&",26,00,00,00) + s) + HX_(";",3b,00,00,00));
+HXDLIN( 370) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 370) buf->flush();
+ }
+HXDLIN( 370) if (::hx::IsNull( buf->b )) {
+HXLINE( 370) buf->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x1));
+ }
+ else {
+HXLINE( 370) ::Array< ::String > buf7 = buf->b;
+HXDLIN( 370) buf7->push(::Std_obj::string(x1));
+ }
+ }
+ }
+ else {
+HXLINE( 372) ::String x2 = ::haxe::xml::Parser_obj::escapes->get_string(s);
+HXDLIN( 372) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 372) buf->flush();
+ }
+HXDLIN( 372) if (::hx::IsNull( buf->b )) {
+HXLINE( 372) buf->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x2));
+ }
+ else {
+HXLINE( 372) ::Array< ::String > buf8 = buf->b;
+HXDLIN( 372) buf8->push(::Std_obj::string(x2));
+ }
+ }
+ }
+HXLINE( 374) start = (p + 1);
+HXLINE( 375) state = escapeNext;
+ }
+ else {
+HXLINE( 376) bool _hx_tmp30;
+HXDLIN( 376) bool _hx_tmp31;
+HXDLIN( 376) bool _hx_tmp32;
+HXDLIN( 376) bool _hx_tmp33;
+HXDLIN( 376) bool _hx_tmp34;
+HXDLIN( 376) bool _hx_tmp35;
+HXDLIN( 376) bool _hx_tmp36;
+HXDLIN( 376) bool _hx_tmp37;
+HXDLIN( 376) if ((c >= 97)) {
+HXLINE( 376) _hx_tmp37 = (c <= 122);
+ }
+ else {
+HXLINE( 376) _hx_tmp37 = false;
+ }
+HXDLIN( 376) if (!(_hx_tmp37)) {
+HXLINE( 376) if ((c >= 65)) {
+HXLINE( 376) _hx_tmp36 = (c <= 90);
+ }
+ else {
+HXLINE( 376) _hx_tmp36 = false;
+ }
+ }
+ else {
+HXLINE( 376) _hx_tmp36 = true;
+ }
+HXDLIN( 376) if (!(_hx_tmp36)) {
+HXLINE( 376) if ((c >= 48)) {
+HXLINE( 376) _hx_tmp35 = (c <= 57);
+ }
+ else {
+HXLINE( 376) _hx_tmp35 = false;
+ }
+ }
+ else {
+HXLINE( 376) _hx_tmp35 = true;
+ }
+HXDLIN( 376) if (!(_hx_tmp35)) {
+HXLINE( 376) _hx_tmp34 = (c == 58);
+ }
+ else {
+HXLINE( 376) _hx_tmp34 = true;
+ }
+HXDLIN( 376) if (!(_hx_tmp34)) {
+HXLINE( 376) _hx_tmp33 = (c == 46);
+ }
+ else {
+HXLINE( 376) _hx_tmp33 = true;
+ }
+HXDLIN( 376) if (!(_hx_tmp33)) {
+HXLINE( 376) _hx_tmp32 = (c == 95);
+ }
+ else {
+HXLINE( 376) _hx_tmp32 = true;
+ }
+HXDLIN( 376) if (!(_hx_tmp32)) {
+HXLINE( 376) _hx_tmp31 = (c == 45);
+ }
+ else {
+HXLINE( 376) _hx_tmp31 = true;
+ }
+HXDLIN( 376) if (!(_hx_tmp31)) {
+HXLINE( 376) _hx_tmp30 = (c != 35);
+ }
+ else {
+HXLINE( 376) _hx_tmp30 = false;
+ }
+HXDLIN( 376) if (_hx_tmp30) {
+HXLINE( 377) if (strict) {
+HXLINE( 378) HX_STACK_DO_THROW( ::haxe::xml::XmlParserException_obj::__alloc( HX_CTX ,(HX_("Invalid character in entity: ",24,85,11,30) + ::String::fromCharCode(c)),str,p));
+ }
+HXLINE( 379) {
+HXLINE( 379) if (::hx::IsNull( buf->charBuf )) {
+HXLINE( 379) buf->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 379) buf->charBuf->push(38);
+ }
+HXLINE( 380) {
+HXLINE( 380) ::Dynamic len5 = (p - start);
+HXDLIN( 380) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 380) buf->flush();
+ }
+HXDLIN( 380) if (::hx::IsNull( buf->b )) {
+HXLINE( 380) buf->b = ::Array_obj< ::String >::__new(1)->init(0,str.substr(start,len5));
+ }
+ else {
+HXLINE( 380) ::Array< ::String > buf9 = buf->b;
+HXDLIN( 380) buf9->push(str.substr(start,len5));
+ }
+ }
+HXLINE( 381) p = (p - 1);
+HXLINE( 382) start = (p + 1);
+HXLINE( 383) state = escapeNext;
+ }
+ }
+ }
+ break;
+ }
+HXLINE( 386) p = (p + 1);
+ }
+HXLINE( 389) if ((state == 1)) {
+HXLINE( 390) start = p;
+HXLINE( 391) state = 13;
+ }
+HXLINE( 394) if ((state == 13)) {
+HXLINE( 395) if ((parent->nodeType == 0)) {
+HXLINE( 396) if ((parent->nodeType != ::Xml_obj::Element)) {
+HXLINE( 396) HX_STACK_DO_THROW((HX_("Bad node type, expected Element but found ",d8,90,8b,bb) + ::_Xml::XmlType_Impl__obj::toString(parent->nodeType)));
+ }
+HXDLIN( 396) HX_STACK_DO_THROW( ::haxe::xml::XmlParserException_obj::__alloc( HX_CTX ,((HX_("Unclosed node <",79,04,e1,00) + parent->nodeName) + HX_(">",3e,00,00,00)),str,p));
+ }
+HXLINE( 398) bool _hx_tmp38;
+HXDLIN( 398) if ((p == start)) {
+HXLINE( 398) _hx_tmp38 = (nsubs == 0);
+ }
+ else {
+HXLINE( 398) _hx_tmp38 = true;
+ }
+HXDLIN( 398) if (_hx_tmp38) {
+HXLINE( 399) {
+HXLINE( 399) ::Dynamic len6 = (p - start);
+HXDLIN( 399) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 399) buf->flush();
+ }
+HXDLIN( 399) if (::hx::IsNull( buf->b )) {
+HXLINE( 399) buf->b = ::Array_obj< ::String >::__new(1)->init(0,str.substr(start,len6));
+ }
+ else {
+HXLINE( 399) ::Array< ::String > buf10 = buf->b;
+HXDLIN( 399) buf10->push(str.substr(start,len6));
+ }
+ }
+HXLINE( 400) {
+HXLINE( 400) parent->addChild(::Xml_obj::createPCData(buf->toString()));
+HXDLIN( 400) nsubs = (nsubs + 1);
+ }
+ }
+HXLINE( 402) return p;
+ }
+HXLINE( 405) bool _hx_tmp39;
+HXDLIN( 405) bool _hx_tmp40;
+HXDLIN( 405) if (!(strict)) {
+HXLINE( 405) _hx_tmp40 = (state == 18);
+ }
+ else {
+HXLINE( 405) _hx_tmp40 = false;
+ }
+HXDLIN( 405) if (_hx_tmp40) {
+HXLINE( 405) _hx_tmp39 = (escapeNext == 13);
+ }
+ else {
+HXLINE( 405) _hx_tmp39 = false;
+ }
+HXDLIN( 405) if (_hx_tmp39) {
+HXLINE( 406) {
+HXLINE( 406) if (::hx::IsNull( buf->charBuf )) {
+HXLINE( 406) buf->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 406) buf->charBuf->push(38);
+ }
+HXLINE( 407) {
+HXLINE( 407) ::Dynamic len7 = (p - start);
+HXDLIN( 407) if (::hx::IsNotNull( buf->charBuf )) {
+HXLINE( 407) buf->flush();
+ }
+HXDLIN( 407) if (::hx::IsNull( buf->b )) {
+HXLINE( 407) buf->b = ::Array_obj< ::String >::__new(1)->init(0,str.substr(start,len7));
+ }
+ else {
+HXLINE( 407) ::Array< ::String > buf11 = buf->b;
+HXDLIN( 407) buf11->push(str.substr(start,len7));
+ }
+ }
+HXLINE( 408) {
+HXLINE( 408) parent->addChild(::Xml_obj::createPCData(buf->toString()));
+HXDLIN( 408) nsubs = (nsubs + 1);
+ }
+HXLINE( 409) return p;
+ }
+HXLINE( 412) HX_STACK_DO_THROW( ::haxe::xml::XmlParserException_obj::__alloc( HX_CTX ,HX_("Unexpected end",2c,3e,ab,50),str,p));
+HXDLIN( 412) return 0;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC4(Parser_obj,doParse,return )
+
+
+Parser_obj::Parser_obj()
+{
+}
+
+bool Parser_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"parse") ) { outValue = parse_dyn(); return true; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"escapes") ) { outValue = ( escapes ); return true; }
+ if (HX_FIELD_EQ(inName,"doParse") ) { outValue = doParse_dyn(); return true; }
+ }
+ return false;
+}
+
+bool Parser_obj::__SetStatic(const ::String &inName,Dynamic &ioValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 7:
+ if (HX_FIELD_EQ(inName,"escapes") ) { escapes=ioValue.Cast< ::haxe::ds::StringMap >(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *Parser_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo Parser_obj_sStaticStorageInfo[] = {
+ {::hx::fsObject /* ::haxe::ds::StringMap */ ,(void *) &Parser_obj::escapes,HX_("escapes",d2,cd,20,a4)},
+ { ::hx::fsUnknown, 0, null()}
+};
+#endif
+
+static void Parser_obj_sMarkStatics(HX_MARK_PARAMS) {
+ HX_MARK_MEMBER_NAME(Parser_obj::escapes,"escapes");
+};
+
+#ifdef HXCPP_VISIT_ALLOCS
+static void Parser_obj_sVisitStatics(HX_VISIT_PARAMS) {
+ HX_VISIT_MEMBER_NAME(Parser_obj::escapes,"escapes");
+};
+
+#endif
+
+::hx::Class Parser_obj::__mClass;
+
+static ::String Parser_obj_sStaticFields[] = {
+ HX_("escapes",d2,cd,20,a4),
+ HX_("parse",33,90,55,bd),
+ HX_("doParse",a8,70,82,f0),
+ ::String(null())
+};
+
+void Parser_obj::__register()
+{
+ Parser_obj _hx_dummy;
+ Parser_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.xml.Parser",fe,49,90,c4);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Parser_obj::__GetStatic;
+ __mClass->mSetStaticField = &Parser_obj::__SetStatic;
+ __mClass->mMarkFunc = Parser_obj_sMarkStatics;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Parser_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< Parser_obj >;
+#ifdef HXCPP_VISIT_ALLOCS
+ __mClass->mVisitFunc = Parser_obj_sVisitStatics;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Parser_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Parser_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void Parser_obj::__boot()
+{
+{
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(0)
+ ::haxe::ds::StringMap _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_4387901c245e1a2b_100_boot)
+HXLINE( 101) ::haxe::ds::StringMap h = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXLINE( 102) h->set(HX_("lt",88,5e,00,00),HX_("<",3c,00,00,00));
+HXLINE( 103) h->set(HX_("gt",2d,5a,00,00),HX_(">",3e,00,00,00));
+HXLINE( 104) h->set(HX_("amp",04,fa,49,00),HX_("&",26,00,00,00));
+HXLINE( 105) h->set(HX_("quot",09,45,0a,4b),HX_("\"",22,00,00,00));
+HXLINE( 106) h->set(HX_("apos",d3,0f,73,40),HX_("'",27,00,00,00));
+HXLINE( 107) return h;
+ }
+ HX_END_LOCAL_FUNC0(return)
+
+ HX_STACKFRAME(&_hx_pos_4387901c245e1a2b_100_boot)
+HXDLIN( 100) escapes = ( ( ::haxe::ds::StringMap)( ::Dynamic(new _hx_Closure_0())()) );
+ }
+}
+
+} // end namespace haxe
+} // end namespace xml
diff --git a/Sources/c_snikket/src/haxe/xml/Printer.cpp b/Sources/c_snikket/src/haxe/xml/Printer.cpp
new file mode 100644
index 0000000..6e89882
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/xml/Printer.cpp
@@ -0,0 +1,782 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_EReg
+#include <EReg.h>
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_StringBuf
+#include <StringBuf.h>
+#endif
+#ifndef INCLUDED_StringTools
+#include <StringTools.h>
+#endif
+#ifndef INCLUDED_Xml
+#include <Xml.h>
+#endif
+#ifndef INCLUDED__Xml_XmlType_Impl_
+#include <_Xml/XmlType_Impl_.h>
+#endif
+#ifndef INCLUDED_haxe_xml_Printer
+#include <haxe/xml/Printer.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_2f9c3fa4cd4885c0_44_new,"haxe.xml.Printer","new",0x896dce4d,"haxe.xml.Printer.new","/usr/local/lib/haxe/std/haxe/xml/Printer.hx",44,0x9a833f28)
+HX_LOCAL_STACK_FRAME(_hx_pos_2f9c3fa4cd4885c0_50_writeNode,"haxe.xml.Printer","writeNode",0x6952ac2e,"haxe.xml.Printer.writeNode","/usr/local/lib/haxe/std/haxe/xml/Printer.hx",50,0x9a833f28)
+static const ::String _hx_array_data_d3e3a3db_5[] = {
+ HX_("\"",22,00,00,00),
+};
+static const ::String _hx_array_data_d3e3a3db_6[] = {
+ HX_(">",3e,00,00,00),
+};
+static const ::String _hx_array_data_d3e3a3db_7[] = {
+ HX_("\n",0a,00,00,00),
+};
+static const ::String _hx_array_data_d3e3a3db_8[] = {
+ HX_(">",3e,00,00,00),
+};
+static const ::String _hx_array_data_d3e3a3db_9[] = {
+ HX_("\n",0a,00,00,00),
+};
+static const ::String _hx_array_data_d3e3a3db_10[] = {
+ HX_("/>",2f,29,00,00),
+};
+static const ::String _hx_array_data_d3e3a3db_11[] = {
+ HX_("\n",0a,00,00,00),
+};
+static const ::String _hx_array_data_d3e3a3db_12[] = {
+ HX_("\n",0a,00,00,00),
+};
+static const ::String _hx_array_data_d3e3a3db_13[] = {
+ HX_("]]>",de,e2,46,00),
+};
+static const ::String _hx_array_data_d3e3a3db_14[] = {
+ HX_("\n",0a,00,00,00),
+};
+static const ::String _hx_array_data_d3e3a3db_15[] = {
+ HX_("\n",0a,00,00,00),
+};
+static const ::String _hx_array_data_d3e3a3db_16[] = {
+ HX_("\n",0a,00,00,00),
+};
+static const ::String _hx_array_data_d3e3a3db_17[] = {
+ HX_("\n",0a,00,00,00),
+};
+HX_LOCAL_STACK_FRAME(_hx_pos_2f9c3fa4cd4885c0_114_hasChildren,"haxe.xml.Printer","hasChildren",0xeb7e31a6,"haxe.xml.Printer.hasChildren","/usr/local/lib/haxe/std/haxe/xml/Printer.hx",114,0x9a833f28)
+HX_LOCAL_STACK_FRAME(_hx_pos_2f9c3fa4cd4885c0_35_print,"haxe.xml.Printer","print",0x4a926b5a,"haxe.xml.Printer.print","/usr/local/lib/haxe/std/haxe/xml/Printer.hx",35,0x9a833f28)
+namespace haxe{
+namespace xml{
+
+void Printer_obj::__construct(bool pretty){
+ HX_GC_STACKFRAME(&_hx_pos_2f9c3fa4cd4885c0_44_new)
+HXLINE( 45) this->output = ::StringBuf_obj::__alloc( HX_CTX );
+HXLINE( 46) this->pretty = pretty;
+ }
+
+Dynamic Printer_obj::__CreateEmpty() { return new Printer_obj; }
+
+void *Printer_obj::_hx_vtable = 0;
+
+Dynamic Printer_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Printer_obj > _hx_result = new Printer_obj();
+ _hx_result->__construct(inArgs[0]);
+ return _hx_result;
+}
+
+bool Printer_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x5ef86269;
+}
+
+void Printer_obj::writeNode( ::Xml value,::String tabs){
+ HX_GC_STACKFRAME(&_hx_pos_2f9c3fa4cd4885c0_50_writeNode)
+HXDLIN( 50) switch((int)(value->nodeType)){
+ case (int)0: {
+HXLINE( 68) {
+HXLINE( 68) ::String input = (tabs + HX_("<",3c,00,00,00));
+HXDLIN( 68) {
+HXLINE( 68) ::StringBuf _this = this->output;
+HXDLIN( 68) if (::hx::IsNotNull( _this->charBuf )) {
+HXLINE( 68) _this->flush();
+ }
+HXDLIN( 68) if (::hx::IsNull( _this->b )) {
+HXLINE( 68) _this->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(input));
+ }
+ else {
+HXLINE( 68) ::Array< ::String > _this1 = _this->b;
+HXDLIN( 68) _this1->push(::Std_obj::string(input));
+ }
+ }
+ }
+HXLINE( 69) {
+HXLINE( 69) if ((value->nodeType != ::Xml_obj::Element)) {
+HXLINE( 69) HX_STACK_DO_THROW((HX_("Bad node type, expected Element but found ",d8,90,8b,bb) + ::_Xml::XmlType_Impl__obj::toString(value->nodeType)));
+ }
+HXDLIN( 69) ::String input1 = value->nodeName;
+HXDLIN( 69) {
+HXLINE( 69) ::StringBuf _this2 = this->output;
+HXDLIN( 69) if (::hx::IsNotNull( _this2->charBuf )) {
+HXLINE( 69) _this2->flush();
+ }
+HXDLIN( 69) if (::hx::IsNull( _this2->b )) {
+HXLINE( 69) _this2->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(input1));
+ }
+ else {
+HXLINE( 69) ::Array< ::String > _this3 = _this2->b;
+HXDLIN( 69) _this3->push(::Std_obj::string(input1));
+ }
+ }
+ }
+HXLINE( 70) {
+HXLINE( 70) ::Dynamic attribute = value->attributes();
+HXDLIN( 70) while(( (bool)(attribute->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 70) ::String attribute1 = ( (::String)(attribute->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXLINE( 71) {
+HXLINE( 71) ::String input2 = ((HX_(" ",20,00,00,00) + attribute1) + HX_("=\"",45,35,00,00));
+HXDLIN( 71) {
+HXLINE( 71) ::StringBuf _this4 = this->output;
+HXDLIN( 71) if (::hx::IsNotNull( _this4->charBuf )) {
+HXLINE( 71) _this4->flush();
+ }
+HXDLIN( 71) if (::hx::IsNull( _this4->b )) {
+HXLINE( 71) _this4->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(input2));
+ }
+ else {
+HXLINE( 71) ::Array< ::String > _this5 = _this4->b;
+HXDLIN( 71) _this5->push(::Std_obj::string(input2));
+ }
+ }
+ }
+HXLINE( 72) {
+HXLINE( 72) ::String input3 = ::StringTools_obj::htmlEscape(value->get(attribute1),true);
+HXDLIN( 72) {
+HXLINE( 72) ::StringBuf _this6 = this->output;
+HXDLIN( 72) if (::hx::IsNotNull( _this6->charBuf )) {
+HXLINE( 72) _this6->flush();
+ }
+HXDLIN( 72) if (::hx::IsNull( _this6->b )) {
+HXLINE( 72) _this6->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(input3));
+ }
+ else {
+HXLINE( 72) ::Array< ::String > _this7 = _this6->b;
+HXDLIN( 72) _this7->push(::Std_obj::string(input3));
+ }
+ }
+ }
+HXLINE( 73) {
+HXLINE( 73) ::StringBuf _this8 = this->output;
+HXDLIN( 73) if (::hx::IsNotNull( _this8->charBuf )) {
+HXLINE( 73) _this8->flush();
+ }
+HXDLIN( 73) if (::hx::IsNull( _this8->b )) {
+HXLINE( 73) _this8->b = ::Array_obj< ::String >::fromData( _hx_array_data_d3e3a3db_5,1);
+ }
+ else {
+HXLINE( 73) _this8->b->push(HX_("\"",22,00,00,00));
+ }
+ }
+ }
+ }
+HXLINE( 75) if (this->hasChildren(value)) {
+HXLINE( 76) {
+HXLINE( 76) ::StringBuf _this9 = this->output;
+HXDLIN( 76) if (::hx::IsNotNull( _this9->charBuf )) {
+HXLINE( 76) _this9->flush();
+ }
+HXDLIN( 76) if (::hx::IsNull( _this9->b )) {
+HXLINE( 76) _this9->b = ::Array_obj< ::String >::fromData( _hx_array_data_d3e3a3db_6,1);
+ }
+ else {
+HXLINE( 76) _this9->b->push(HX_(">",3e,00,00,00));
+ }
+ }
+HXLINE( 77) if (this->pretty) {
+HXLINE( 77) ::StringBuf _this10 = this->output;
+HXDLIN( 77) if (::hx::IsNotNull( _this10->charBuf )) {
+HXLINE( 77) _this10->flush();
+ }
+HXDLIN( 77) if (::hx::IsNull( _this10->b )) {
+HXLINE( 77) _this10->b = ::Array_obj< ::String >::fromData( _hx_array_data_d3e3a3db_7,1);
+ }
+ else {
+HXLINE( 77) _this10->b->push(HX_("\n",0a,00,00,00));
+ }
+ }
+HXLINE( 78) {
+HXLINE( 78) bool _hx_tmp;
+HXDLIN( 78) if ((value->nodeType != ::Xml_obj::Document)) {
+HXLINE( 78) _hx_tmp = (value->nodeType != ::Xml_obj::Element);
+ }
+ else {
+HXLINE( 78) _hx_tmp = false;
+ }
+HXDLIN( 78) if (_hx_tmp) {
+HXLINE( 78) HX_STACK_DO_THROW((HX_("Bad node type, expected Element or Document but found ",a0,d6,ba,79) + ::_Xml::XmlType_Impl__obj::toString(value->nodeType)));
+ }
+HXDLIN( 78) int _g_current = 0;
+HXDLIN( 78) ::Array< ::Dynamic> _g_array = value->children;
+HXDLIN( 78) while((_g_current < _g_array->length)){
+HXLINE( 78) _g_current = (_g_current + 1);
+HXDLIN( 78) ::Xml child = _g_array->__get((_g_current - 1)).StaticCast< ::Xml >();
+HXLINE( 79) ::String _hx_tmp1;
+HXDLIN( 79) if (this->pretty) {
+HXLINE( 79) _hx_tmp1 = (tabs + HX_("\t",09,00,00,00));
+ }
+ else {
+HXLINE( 79) _hx_tmp1 = tabs;
+ }
+HXDLIN( 79) this->writeNode(child,_hx_tmp1);
+ }
+ }
+HXLINE( 81) {
+HXLINE( 81) ::String input4 = (tabs + HX_("</",73,34,00,00));
+HXDLIN( 81) {
+HXLINE( 81) ::StringBuf _this11 = this->output;
+HXDLIN( 81) if (::hx::IsNotNull( _this11->charBuf )) {
+HXLINE( 81) _this11->flush();
+ }
+HXDLIN( 81) if (::hx::IsNull( _this11->b )) {
+HXLINE( 81) _this11->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(input4));
+ }
+ else {
+HXLINE( 81) ::Array< ::String > _this12 = _this11->b;
+HXDLIN( 81) _this12->push(::Std_obj::string(input4));
+ }
+ }
+ }
+HXLINE( 82) {
+HXLINE( 82) if ((value->nodeType != ::Xml_obj::Element)) {
+HXLINE( 82) HX_STACK_DO_THROW((HX_("Bad node type, expected Element but found ",d8,90,8b,bb) + ::_Xml::XmlType_Impl__obj::toString(value->nodeType)));
+ }
+HXDLIN( 82) ::String input5 = value->nodeName;
+HXDLIN( 82) {
+HXLINE( 82) ::StringBuf _this13 = this->output;
+HXDLIN( 82) if (::hx::IsNotNull( _this13->charBuf )) {
+HXLINE( 82) _this13->flush();
+ }
+HXDLIN( 82) if (::hx::IsNull( _this13->b )) {
+HXLINE( 82) _this13->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(input5));
+ }
+ else {
+HXLINE( 82) ::Array< ::String > _this14 = _this13->b;
+HXDLIN( 82) _this14->push(::Std_obj::string(input5));
+ }
+ }
+ }
+HXLINE( 83) {
+HXLINE( 83) ::StringBuf _this15 = this->output;
+HXDLIN( 83) if (::hx::IsNotNull( _this15->charBuf )) {
+HXLINE( 83) _this15->flush();
+ }
+HXDLIN( 83) if (::hx::IsNull( _this15->b )) {
+HXLINE( 83) _this15->b = ::Array_obj< ::String >::fromData( _hx_array_data_d3e3a3db_8,1);
+ }
+ else {
+HXLINE( 83) _this15->b->push(HX_(">",3e,00,00,00));
+ }
+ }
+HXLINE( 84) if (this->pretty) {
+HXLINE( 84) ::StringBuf _this16 = this->output;
+HXDLIN( 84) if (::hx::IsNotNull( _this16->charBuf )) {
+HXLINE( 84) _this16->flush();
+ }
+HXDLIN( 84) if (::hx::IsNull( _this16->b )) {
+HXLINE( 84) _this16->b = ::Array_obj< ::String >::fromData( _hx_array_data_d3e3a3db_9,1);
+ }
+ else {
+HXLINE( 84) _this16->b->push(HX_("\n",0a,00,00,00));
+ }
+ }
+ }
+ else {
+HXLINE( 86) {
+HXLINE( 86) ::StringBuf _this17 = this->output;
+HXDLIN( 86) if (::hx::IsNotNull( _this17->charBuf )) {
+HXLINE( 86) _this17->flush();
+ }
+HXDLIN( 86) if (::hx::IsNull( _this17->b )) {
+HXLINE( 86) _this17->b = ::Array_obj< ::String >::fromData( _hx_array_data_d3e3a3db_10,1);
+ }
+ else {
+HXLINE( 86) _this17->b->push(HX_("/>",2f,29,00,00));
+ }
+ }
+HXLINE( 87) if (this->pretty) {
+HXLINE( 87) ::StringBuf _this18 = this->output;
+HXDLIN( 87) if (::hx::IsNotNull( _this18->charBuf )) {
+HXLINE( 87) _this18->flush();
+ }
+HXDLIN( 87) if (::hx::IsNull( _this18->b )) {
+HXLINE( 87) _this18->b = ::Array_obj< ::String >::fromData( _hx_array_data_d3e3a3db_11,1);
+ }
+ else {
+HXLINE( 87) _this18->b->push(HX_("\n",0a,00,00,00));
+ }
+ }
+ }
+ }
+ break;
+ case (int)1: {
+HXLINE( 90) bool _hx_tmp2;
+HXDLIN( 90) if ((value->nodeType != ::Xml_obj::Document)) {
+HXLINE( 90) _hx_tmp2 = (value->nodeType == ::Xml_obj::Element);
+ }
+ else {
+HXLINE( 90) _hx_tmp2 = true;
+ }
+HXDLIN( 90) if (_hx_tmp2) {
+HXLINE( 90) HX_STACK_DO_THROW((HX_("Bad node type, unexpected ",be,79,d5,11) + ::_Xml::XmlType_Impl__obj::toString(value->nodeType)));
+ }
+HXDLIN( 90) ::String nodeValue = value->nodeValue;
+HXLINE( 91) if ((nodeValue.length != 0)) {
+HXLINE( 92) {
+HXLINE( 92) ::String input6 = (tabs + ::StringTools_obj::htmlEscape(nodeValue,null()));
+HXDLIN( 92) {
+HXLINE( 92) ::StringBuf _this19 = this->output;
+HXDLIN( 92) if (::hx::IsNotNull( _this19->charBuf )) {
+HXLINE( 92) _this19->flush();
+ }
+HXDLIN( 92) if (::hx::IsNull( _this19->b )) {
+HXLINE( 92) _this19->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(input6));
+ }
+ else {
+HXLINE( 92) ::Array< ::String > _this20 = _this19->b;
+HXDLIN( 92) _this20->push(::Std_obj::string(input6));
+ }
+ }
+ }
+HXLINE( 93) if (this->pretty) {
+HXLINE( 93) ::StringBuf _this21 = this->output;
+HXDLIN( 93) if (::hx::IsNotNull( _this21->charBuf )) {
+HXLINE( 93) _this21->flush();
+ }
+HXDLIN( 93) if (::hx::IsNull( _this21->b )) {
+HXLINE( 93) _this21->b = ::Array_obj< ::String >::fromData( _hx_array_data_d3e3a3db_12,1);
+ }
+ else {
+HXLINE( 93) _this21->b->push(HX_("\n",0a,00,00,00));
+ }
+ }
+ }
+ }
+ break;
+ case (int)2: {
+HXLINE( 52) {
+HXLINE( 52) ::String input7 = (tabs + HX_("<![CDATA[",a4,fc,95,b4));
+HXDLIN( 52) {
+HXLINE( 52) ::StringBuf _this22 = this->output;
+HXDLIN( 52) if (::hx::IsNotNull( _this22->charBuf )) {
+HXLINE( 52) _this22->flush();
+ }
+HXDLIN( 52) if (::hx::IsNull( _this22->b )) {
+HXLINE( 52) _this22->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(input7));
+ }
+ else {
+HXLINE( 52) ::Array< ::String > _this23 = _this22->b;
+HXDLIN( 52) _this23->push(::Std_obj::string(input7));
+ }
+ }
+ }
+HXLINE( 53) {
+HXLINE( 53) bool _hx_tmp3;
+HXDLIN( 53) if ((value->nodeType != ::Xml_obj::Document)) {
+HXLINE( 53) _hx_tmp3 = (value->nodeType == ::Xml_obj::Element);
+ }
+ else {
+HXLINE( 53) _hx_tmp3 = true;
+ }
+HXDLIN( 53) if (_hx_tmp3) {
+HXLINE( 53) HX_STACK_DO_THROW((HX_("Bad node type, unexpected ",be,79,d5,11) + ::_Xml::XmlType_Impl__obj::toString(value->nodeType)));
+ }
+HXDLIN( 53) ::String input8 = value->nodeValue;
+HXDLIN( 53) {
+HXLINE( 53) ::StringBuf _this24 = this->output;
+HXDLIN( 53) if (::hx::IsNotNull( _this24->charBuf )) {
+HXLINE( 53) _this24->flush();
+ }
+HXDLIN( 53) if (::hx::IsNull( _this24->b )) {
+HXLINE( 53) _this24->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(input8));
+ }
+ else {
+HXLINE( 53) ::Array< ::String > _this25 = _this24->b;
+HXDLIN( 53) _this25->push(::Std_obj::string(input8));
+ }
+ }
+ }
+HXLINE( 54) {
+HXLINE( 54) ::StringBuf _this26 = this->output;
+HXDLIN( 54) if (::hx::IsNotNull( _this26->charBuf )) {
+HXLINE( 54) _this26->flush();
+ }
+HXDLIN( 54) if (::hx::IsNull( _this26->b )) {
+HXLINE( 54) _this26->b = ::Array_obj< ::String >::fromData( _hx_array_data_d3e3a3db_13,1);
+ }
+ else {
+HXLINE( 54) _this26->b->push(HX_("]]>",de,e2,46,00));
+ }
+ }
+HXLINE( 55) if (this->pretty) {
+HXLINE( 55) ::StringBuf _this27 = this->output;
+HXDLIN( 55) if (::hx::IsNotNull( _this27->charBuf )) {
+HXLINE( 55) _this27->flush();
+ }
+HXDLIN( 55) if (::hx::IsNull( _this27->b )) {
+HXLINE( 55) _this27->b = ::Array_obj< ::String >::fromData( _hx_array_data_d3e3a3db_14,1);
+ }
+ else {
+HXLINE( 55) _this27->b->push(HX_("\n",0a,00,00,00));
+ }
+ }
+ }
+ break;
+ case (int)3: {
+HXLINE( 57) bool _hx_tmp4;
+HXDLIN( 57) if ((value->nodeType != ::Xml_obj::Document)) {
+HXLINE( 57) _hx_tmp4 = (value->nodeType == ::Xml_obj::Element);
+ }
+ else {
+HXLINE( 57) _hx_tmp4 = true;
+ }
+HXDLIN( 57) if (_hx_tmp4) {
+HXLINE( 57) HX_STACK_DO_THROW((HX_("Bad node type, unexpected ",be,79,d5,11) + ::_Xml::XmlType_Impl__obj::toString(value->nodeType)));
+ }
+HXDLIN( 57) ::String commentContent = value->nodeValue;
+HXLINE( 58) commentContent = ::EReg_obj::__alloc( HX_CTX ,HX_("[\n\r\t]+",59,8e,1a,2d),HX_("g",67,00,00,00))->replace(commentContent,HX_("",00,00,00,00));
+HXLINE( 59) commentContent = ((HX_("<!--",05,ff,c1,27) + commentContent) + HX_("-->",de,4c,22,00));
+HXLINE( 60) {
+HXLINE( 60) ::StringBuf _this28 = this->output;
+HXDLIN( 60) if (::hx::IsNotNull( _this28->charBuf )) {
+HXLINE( 60) _this28->flush();
+ }
+HXDLIN( 60) if (::hx::IsNull( _this28->b )) {
+HXLINE( 60) _this28->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(tabs));
+ }
+ else {
+HXLINE( 60) ::Array< ::String > _this29 = _this28->b;
+HXDLIN( 60) _this29->push(::Std_obj::string(tabs));
+ }
+ }
+HXLINE( 61) {
+HXLINE( 61) ::String input9 = ::StringTools_obj::trim(commentContent);
+HXDLIN( 61) {
+HXLINE( 61) ::StringBuf _this30 = this->output;
+HXDLIN( 61) if (::hx::IsNotNull( _this30->charBuf )) {
+HXLINE( 61) _this30->flush();
+ }
+HXDLIN( 61) if (::hx::IsNull( _this30->b )) {
+HXLINE( 61) _this30->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(input9));
+ }
+ else {
+HXLINE( 61) ::Array< ::String > _this31 = _this30->b;
+HXDLIN( 61) _this31->push(::Std_obj::string(input9));
+ }
+ }
+ }
+HXLINE( 62) if (this->pretty) {
+HXLINE( 62) ::StringBuf _this32 = this->output;
+HXDLIN( 62) if (::hx::IsNotNull( _this32->charBuf )) {
+HXLINE( 62) _this32->flush();
+ }
+HXDLIN( 62) if (::hx::IsNull( _this32->b )) {
+HXLINE( 62) _this32->b = ::Array_obj< ::String >::fromData( _hx_array_data_d3e3a3db_15,1);
+ }
+ else {
+HXLINE( 62) _this32->b->push(HX_("\n",0a,00,00,00));
+ }
+ }
+ }
+ break;
+ case (int)4: {
+HXLINE( 99) {
+HXLINE( 99) bool input10;
+HXDLIN( 99) if ((value->nodeType != ::Xml_obj::Document)) {
+HXLINE( 99) input10 = (value->nodeType == ::Xml_obj::Element);
+ }
+ else {
+HXLINE( 99) input10 = true;
+ }
+HXDLIN( 99) if (input10) {
+HXLINE( 99) HX_STACK_DO_THROW((HX_("Bad node type, unexpected ",be,79,d5,11) + ::_Xml::XmlType_Impl__obj::toString(value->nodeType)));
+ }
+HXDLIN( 99) ::String input11 = ((HX_("<!DOCTYPE ",33,6c,bb,ab) + value->nodeValue) + HX_(">",3e,00,00,00));
+HXDLIN( 99) {
+HXLINE( 99) ::StringBuf _this33 = this->output;
+HXDLIN( 99) if (::hx::IsNotNull( _this33->charBuf )) {
+HXLINE( 99) _this33->flush();
+ }
+HXDLIN( 99) if (::hx::IsNull( _this33->b )) {
+HXLINE( 99) _this33->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(input11));
+ }
+ else {
+HXLINE( 99) ::Array< ::String > _this34 = _this33->b;
+HXDLIN( 99) _this34->push(::Std_obj::string(input11));
+ }
+ }
+ }
+HXLINE( 100) if (this->pretty) {
+HXLINE( 100) ::StringBuf _this35 = this->output;
+HXDLIN( 100) if (::hx::IsNotNull( _this35->charBuf )) {
+HXLINE( 100) _this35->flush();
+ }
+HXDLIN( 100) if (::hx::IsNull( _this35->b )) {
+HXLINE( 100) _this35->b = ::Array_obj< ::String >::fromData( _hx_array_data_d3e3a3db_16,1);
+ }
+ else {
+HXLINE( 100) _this35->b->push(HX_("\n",0a,00,00,00));
+ }
+ }
+ }
+ break;
+ case (int)5: {
+HXLINE( 96) {
+HXLINE( 96) bool input12;
+HXDLIN( 96) if ((value->nodeType != ::Xml_obj::Document)) {
+HXLINE( 96) input12 = (value->nodeType == ::Xml_obj::Element);
+ }
+ else {
+HXLINE( 96) input12 = true;
+ }
+HXDLIN( 96) if (input12) {
+HXLINE( 96) HX_STACK_DO_THROW((HX_("Bad node type, unexpected ",be,79,d5,11) + ::_Xml::XmlType_Impl__obj::toString(value->nodeType)));
+ }
+HXDLIN( 96) ::String input13 = ((HX_("<?",83,34,00,00) + value->nodeValue) + HX_("?>",1f,37,00,00));
+HXDLIN( 96) {
+HXLINE( 96) ::StringBuf _this36 = this->output;
+HXDLIN( 96) if (::hx::IsNotNull( _this36->charBuf )) {
+HXLINE( 96) _this36->flush();
+ }
+HXDLIN( 96) if (::hx::IsNull( _this36->b )) {
+HXLINE( 96) _this36->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(input13));
+ }
+ else {
+HXLINE( 96) ::Array< ::String > _this37 = _this36->b;
+HXDLIN( 96) _this37->push(::Std_obj::string(input13));
+ }
+ }
+ }
+HXLINE( 97) if (this->pretty) {
+HXLINE( 97) ::StringBuf _this38 = this->output;
+HXDLIN( 97) if (::hx::IsNotNull( _this38->charBuf )) {
+HXLINE( 97) _this38->flush();
+ }
+HXDLIN( 97) if (::hx::IsNull( _this38->b )) {
+HXLINE( 97) _this38->b = ::Array_obj< ::String >::fromData( _hx_array_data_d3e3a3db_17,1);
+ }
+ else {
+HXLINE( 97) _this38->b->push(HX_("\n",0a,00,00,00));
+ }
+ }
+ }
+ break;
+ case (int)6: {
+HXLINE( 64) bool _hx_tmp5;
+HXDLIN( 64) if ((value->nodeType != ::Xml_obj::Document)) {
+HXLINE( 64) _hx_tmp5 = (value->nodeType != ::Xml_obj::Element);
+ }
+ else {
+HXLINE( 64) _hx_tmp5 = false;
+ }
+HXDLIN( 64) if (_hx_tmp5) {
+HXLINE( 64) HX_STACK_DO_THROW((HX_("Bad node type, expected Element or Document but found ",a0,d6,ba,79) + ::_Xml::XmlType_Impl__obj::toString(value->nodeType)));
+ }
+HXDLIN( 64) int _g_current1 = 0;
+HXDLIN( 64) ::Array< ::Dynamic> _g_array1 = value->children;
+HXDLIN( 64) while((_g_current1 < _g_array1->length)){
+HXLINE( 64) _g_current1 = (_g_current1 + 1);
+HXDLIN( 64) ::Xml child1 = _g_array1->__get((_g_current1 - 1)).StaticCast< ::Xml >();
+HXLINE( 65) this->writeNode(child1,tabs);
+ }
+ }
+ break;
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Printer_obj,writeNode,(void))
+
+bool Printer_obj::hasChildren( ::Xml value){
+ HX_STACKFRAME(&_hx_pos_2f9c3fa4cd4885c0_114_hasChildren)
+HXLINE( 115) {
+HXLINE( 115) bool _hx_tmp;
+HXDLIN( 115) if ((value->nodeType != ::Xml_obj::Document)) {
+HXLINE( 115) _hx_tmp = (value->nodeType != ::Xml_obj::Element);
+ }
+ else {
+HXLINE( 115) _hx_tmp = false;
+ }
+HXDLIN( 115) if (_hx_tmp) {
+HXLINE( 115) HX_STACK_DO_THROW((HX_("Bad node type, expected Element or Document but found ",a0,d6,ba,79) + ::_Xml::XmlType_Impl__obj::toString(value->nodeType)));
+ }
+HXDLIN( 115) int _g_current = 0;
+HXDLIN( 115) ::Array< ::Dynamic> _g_array = value->children;
+HXDLIN( 115) while((_g_current < _g_array->length)){
+HXLINE( 115) _g_current = (_g_current + 1);
+HXDLIN( 115) ::Xml child = _g_array->__get((_g_current - 1)).StaticCast< ::Xml >();
+HXLINE( 116) switch((int)(child->nodeType)){
+ case (int)0: case (int)1: {
+HXLINE( 118) return true;
+ }
+ break;
+ case (int)2: case (int)3: {
+HXLINE( 120) bool _hx_tmp1;
+HXDLIN( 120) if ((child->nodeType != ::Xml_obj::Document)) {
+HXLINE( 120) _hx_tmp1 = (child->nodeType == ::Xml_obj::Element);
+ }
+ else {
+HXLINE( 120) _hx_tmp1 = true;
+ }
+HXDLIN( 120) if (_hx_tmp1) {
+HXLINE( 120) HX_STACK_DO_THROW((HX_("Bad node type, unexpected ",be,79,d5,11) + ::_Xml::XmlType_Impl__obj::toString(child->nodeType)));
+ }
+HXDLIN( 120) if ((::StringTools_obj::ltrim(child->nodeValue).length != 0)) {
+HXLINE( 121) return true;
+ }
+ }
+ break;
+ default:{
+ }
+ }
+ }
+ }
+HXLINE( 126) return false;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Printer_obj,hasChildren,return )
+
+::String Printer_obj::print( ::Xml xml, ::Dynamic __o_pretty){
+ ::Dynamic pretty = __o_pretty;
+ if (::hx::IsNull(__o_pretty)) pretty = false;
+ HX_GC_STACKFRAME(&_hx_pos_2f9c3fa4cd4885c0_35_print)
+HXLINE( 36) ::haxe::xml::Printer printer = ::haxe::xml::Printer_obj::__alloc( HX_CTX ,( (bool)(pretty) ));
+HXLINE( 37) printer->writeNode(xml,HX_("",00,00,00,00));
+HXLINE( 38) return printer->output->toString();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Printer_obj,print,return )
+
+
+::hx::ObjectPtr< Printer_obj > Printer_obj::__new(bool pretty) {
+ ::hx::ObjectPtr< Printer_obj > __this = new Printer_obj();
+ __this->__construct(pretty);
+ return __this;
+}
+
+::hx::ObjectPtr< Printer_obj > Printer_obj::__alloc(::hx::Ctx *_hx_ctx,bool pretty) {
+ Printer_obj *__this = (Printer_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Printer_obj), true, "haxe.xml.Printer"));
+ *(void **)__this = Printer_obj::_hx_vtable;
+ __this->__construct(pretty);
+ return __this;
+}
+
+Printer_obj::Printer_obj()
+{
+}
+
+void Printer_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(Printer);
+ HX_MARK_MEMBER_NAME(output,"output");
+ HX_MARK_MEMBER_NAME(pretty,"pretty");
+ HX_MARK_END_CLASS();
+}
+
+void Printer_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(output,"output");
+ HX_VISIT_MEMBER_NAME(pretty,"pretty");
+}
+
+::hx::Val Printer_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 6:
+ if (HX_FIELD_EQ(inName,"output") ) { return ::hx::Val( output ); }
+ if (HX_FIELD_EQ(inName,"pretty") ) { return ::hx::Val( pretty ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"writeNode") ) { return ::hx::Val( writeNode_dyn() ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"hasChildren") ) { return ::hx::Val( hasChildren_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool Printer_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"print") ) { outValue = print_dyn(); return true; }
+ }
+ return false;
+}
+
+::hx::Val Printer_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 6:
+ if (HX_FIELD_EQ(inName,"output") ) { output=inValue.Cast< ::StringBuf >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"pretty") ) { pretty=inValue.Cast< bool >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void Printer_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("output",01,0f,81,0c));
+ outFields->push(HX_("pretty",b6,82,c1,ae));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Printer_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::StringBuf */ ,(int)offsetof(Printer_obj,output),HX_("output",01,0f,81,0c)},
+ {::hx::fsBool,(int)offsetof(Printer_obj,pretty),HX_("pretty",b6,82,c1,ae)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *Printer_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Printer_obj_sMemberFields[] = {
+ HX_("output",01,0f,81,0c),
+ HX_("pretty",b6,82,c1,ae),
+ HX_("writeNode",81,fe,bd,51),
+ HX_("hasChildren",b9,fe,20,43),
+ ::String(null()) };
+
+::hx::Class Printer_obj::__mClass;
+
+static ::String Printer_obj_sStaticFields[] = {
+ HX_("print",2d,58,8b,c8),
+ ::String(null())
+};
+
+void Printer_obj::__register()
+{
+ Printer_obj _hx_dummy;
+ Printer_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.xml.Printer",db,a3,e3,d3);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Printer_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Printer_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Printer_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Printer_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Printer_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Printer_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
+} // end namespace xml
diff --git a/Sources/c_snikket/src/haxe/xml/XmlParserException.cpp b/Sources/c_snikket/src/haxe/xml/XmlParserException.cpp
new file mode 100644
index 0000000..d304181
--- /dev/null
+++ b/Sources/c_snikket/src/haxe/xml/XmlParserException.cpp
@@ -0,0 +1,205 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Type
+#include <Type.h>
+#endif
+#ifndef INCLUDED_haxe_xml_XmlParserException
+#include <haxe/xml/XmlParserException.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_6a0d351bb43bf432_75_new,"haxe.xml.XmlParserException","new",0xcd6fdfea,"haxe.xml.XmlParserException.new","/usr/local/lib/haxe/std/haxe/xml/Parser.hx",75,0x9bd139bb)
+HX_LOCAL_STACK_FRAME(_hx_pos_6a0d351bb43bf432_95_toString,"haxe.xml.XmlParserException","toString",0xed7c2ce2,"haxe.xml.XmlParserException.toString","/usr/local/lib/haxe/std/haxe/xml/Parser.hx",95,0x9bd139bb)
+namespace haxe{
+namespace xml{
+
+void XmlParserException_obj::__construct(::String message,::String xml,int position){
+ HX_STACKFRAME(&_hx_pos_6a0d351bb43bf432_75_new)
+HXLINE( 76) this->xml = xml;
+HXLINE( 77) this->message = message;
+HXLINE( 78) this->position = position;
+HXLINE( 79) this->lineNumber = 1;
+HXLINE( 80) this->positionAtLine = 0;
+HXLINE( 82) {
+HXLINE( 82) int _g = 0;
+HXDLIN( 82) int _g1 = position;
+HXDLIN( 82) while((_g < _g1)){
+HXLINE( 82) _g = (_g + 1);
+HXDLIN( 82) int i = (_g - 1);
+HXLINE( 83) int c = xml.cca(i);
+HXLINE( 84) if ((c == 10)) {
+HXLINE( 85) this->lineNumber++;
+HXLINE( 86) this->positionAtLine = 0;
+ }
+ else {
+HXLINE( 88) if ((c != 13)) {
+HXLINE( 89) this->positionAtLine++;
+ }
+ }
+ }
+ }
+ }
+
+Dynamic XmlParserException_obj::__CreateEmpty() { return new XmlParserException_obj; }
+
+void *XmlParserException_obj::_hx_vtable = 0;
+
+Dynamic XmlParserException_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< XmlParserException_obj > _hx_result = new XmlParserException_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2]);
+ return _hx_result;
+}
+
+bool XmlParserException_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x75f2332a;
+}
+
+::String XmlParserException_obj::toString(){
+ HX_STACKFRAME(&_hx_pos_6a0d351bb43bf432_95_toString)
+HXDLIN( 95) ::String _hx_tmp = (::Type_obj::getClassName(::Type_obj::getClass(::hx::ObjectPtr<OBJ_>(this))) + HX_(": ",a6,32,00,00));
+HXDLIN( 95) return (((((_hx_tmp + this->message) + HX_(" at line ",df,96,71,22)) + this->lineNumber) + HX_(" char ",6a,28,1f,11)) + this->positionAtLine);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(XmlParserException_obj,toString,return )
+
+
+::hx::ObjectPtr< XmlParserException_obj > XmlParserException_obj::__new(::String message,::String xml,int position) {
+ ::hx::ObjectPtr< XmlParserException_obj > __this = new XmlParserException_obj();
+ __this->__construct(message,xml,position);
+ return __this;
+}
+
+::hx::ObjectPtr< XmlParserException_obj > XmlParserException_obj::__alloc(::hx::Ctx *_hx_ctx,::String message,::String xml,int position) {
+ XmlParserException_obj *__this = (XmlParserException_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(XmlParserException_obj), true, "haxe.xml.XmlParserException"));
+ *(void **)__this = XmlParserException_obj::_hx_vtable;
+ __this->__construct(message,xml,position);
+ return __this;
+}
+
+XmlParserException_obj::XmlParserException_obj()
+{
+}
+
+void XmlParserException_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(XmlParserException);
+ HX_MARK_MEMBER_NAME(message,"message");
+ HX_MARK_MEMBER_NAME(lineNumber,"lineNumber");
+ HX_MARK_MEMBER_NAME(positionAtLine,"positionAtLine");
+ HX_MARK_MEMBER_NAME(position,"position");
+ HX_MARK_MEMBER_NAME(xml,"xml");
+ HX_MARK_END_CLASS();
+}
+
+void XmlParserException_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(message,"message");
+ HX_VISIT_MEMBER_NAME(lineNumber,"lineNumber");
+ HX_VISIT_MEMBER_NAME(positionAtLine,"positionAtLine");
+ HX_VISIT_MEMBER_NAME(position,"position");
+ HX_VISIT_MEMBER_NAME(xml,"xml");
+}
+
+::hx::Val XmlParserException_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"xml") ) { return ::hx::Val( xml ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"message") ) { return ::hx::Val( message ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"position") ) { return ::hx::Val( position ); }
+ if (HX_FIELD_EQ(inName,"toString") ) { return ::hx::Val( toString_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"lineNumber") ) { return ::hx::Val( lineNumber ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"positionAtLine") ) { return ::hx::Val( positionAtLine ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val XmlParserException_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"xml") ) { xml=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"message") ) { message=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"position") ) { position=inValue.Cast< int >(); return inValue; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"lineNumber") ) { lineNumber=inValue.Cast< int >(); return inValue; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"positionAtLine") ) { positionAtLine=inValue.Cast< int >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void XmlParserException_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("message",c7,35,11,9a));
+ outFields->push(HX_("lineNumber",dd,81,22,76));
+ outFields->push(HX_("positionAtLine",10,08,98,1a));
+ outFields->push(HX_("position",a9,a0,fa,ca));
+ outFields->push(HX_("xml",d7,6d,5b,00));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo XmlParserException_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(XmlParserException_obj,message),HX_("message",c7,35,11,9a)},
+ {::hx::fsInt,(int)offsetof(XmlParserException_obj,lineNumber),HX_("lineNumber",dd,81,22,76)},
+ {::hx::fsInt,(int)offsetof(XmlParserException_obj,positionAtLine),HX_("positionAtLine",10,08,98,1a)},
+ {::hx::fsInt,(int)offsetof(XmlParserException_obj,position),HX_("position",a9,a0,fa,ca)},
+ {::hx::fsString,(int)offsetof(XmlParserException_obj,xml),HX_("xml",d7,6d,5b,00)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *XmlParserException_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String XmlParserException_obj_sMemberFields[] = {
+ HX_("message",c7,35,11,9a),
+ HX_("lineNumber",dd,81,22,76),
+ HX_("positionAtLine",10,08,98,1a),
+ HX_("position",a9,a0,fa,ca),
+ HX_("xml",d7,6d,5b,00),
+ HX_("toString",ac,d0,6e,38),
+ ::String(null()) };
+
+::hx::Class XmlParserException_obj::__mClass;
+
+void XmlParserException_obj::__register()
+{
+ XmlParserException_obj _hx_dummy;
+ XmlParserException_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("haxe.xml.XmlParserException",f8,62,fb,04);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(XmlParserException_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< XmlParserException_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = XmlParserException_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = XmlParserException_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace haxe
+} // end namespace xml
diff --git a/Sources/c_snikket/src/hsluv/Hsluv.cpp b/Sources/c_snikket/src/hsluv/Hsluv.cpp
new file mode 100644
index 0000000..28f479c
--- /dev/null
+++ b/Sources/c_snikket/src/hsluv/Hsluv.cpp
@@ -0,0 +1,841 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_95f339a1d026d52c
+#define INCLUDED_95f339a1d026d52c
+#include "hxMath.h"
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_hsluv_Hsluv
+#include <hsluv/Hsluv.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_72_new,"hsluv.Hsluv","new",0xd01091a8,"hsluv.Hsluv.new","hsluv/Hsluv.hx",72,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_151_rgbToHex,"hsluv.Hsluv","rgbToHex",0x5aeaf38b,"hsluv.Hsluv.rgbToHex","hsluv/Hsluv.hx",151,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_165_xyzToRgb,"hsluv.Hsluv","xyzToRgb",0x37343af1,"hsluv.Hsluv.xyzToRgb","hsluv/Hsluv.hx",165,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_204_luvToXyz,"hsluv.Hsluv","luvToXyz",0x49183249,"hsluv.Hsluv.luvToXyz","hsluv/Hsluv.hx",204,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_237_lchToLuv,"hsluv.Hsluv","lchToLuv",0xc38dacf9,"hsluv.Hsluv.lchToLuv","hsluv/Hsluv.hx",237,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_249_calculateBoundingLines,"hsluv.Hsluv","calculateBoundingLines",0xe9896a6d,"hsluv.Hsluv.calculateBoundingLines","hsluv/Hsluv.hx",249,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_335_calcMaxChromaHsluv,"hsluv.Hsluv","calcMaxChromaHsluv",0x9a0d4135,"hsluv.Hsluv.calcMaxChromaHsluv","hsluv/Hsluv.hx",335,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_346_hsluvToLch,"hsluv.Hsluv","hsluvToLch",0xd6a5c00c,"hsluv.Hsluv.hsluvToLch","hsluv/Hsluv.hx",346,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_414_hsluvToRgb,"hsluv.Hsluv","hsluvToRgb",0xd6aa5108,"hsluv.Hsluv.hsluvToRgb","hsluv/Hsluv.hx",414,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_428_hsluvToHex,"hsluv.Hsluv","hsluvToHex",0xd6a2b8d6,"hsluv.Hsluv.hsluvToHex","hsluv/Hsluv.hx",428,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_100_fromLinear,"hsluv.Hsluv","fromLinear",0x2de1cea7,"hsluv.Hsluv.fromLinear","hsluv/Hsluv.hx",100,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_130_lToY,"hsluv.Hsluv","lToY",0x3d0f872a,"hsluv.Hsluv.lToY","hsluv/Hsluv.hx",130,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_137_rgbChannelToHex,"hsluv.Hsluv","rgbChannelToHex",0x76cd5452,"hsluv.Hsluv.rgbChannelToHex","hsluv/Hsluv.hx",137,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_298_distanceFromOriginAngle,"hsluv.Hsluv","distanceFromOriginAngle",0xf7a4dc56,"hsluv.Hsluv.distanceFromOriginAngle","hsluv/Hsluv.hx",298,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_312_min6,"hsluv.Hsluv","min6",0x3dc8ac1c,"hsluv.Hsluv.min6","hsluv/Hsluv.hx",312,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_74_boot,"hsluv.Hsluv","boot",0x3687e1ea,"hsluv.Hsluv.boot","hsluv/Hsluv.hx",74,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_76_boot,"hsluv.Hsluv","boot",0x3687e1ea,"hsluv.Hsluv.boot","hsluv/Hsluv.hx",76,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_78_boot,"hsluv.Hsluv","boot",0x3687e1ea,"hsluv.Hsluv.boot","hsluv/Hsluv.hx",78,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_79_boot,"hsluv.Hsluv","boot",0x3687e1ea,"hsluv.Hsluv.boot","hsluv/Hsluv.hx",79,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_82_boot,"hsluv.Hsluv","boot",0x3687e1ea,"hsluv.Hsluv.boot","hsluv/Hsluv.hx",82,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_83_boot,"hsluv.Hsluv","boot",0x3687e1ea,"hsluv.Hsluv.boot","hsluv/Hsluv.hx",83,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_86_boot,"hsluv.Hsluv","boot",0x3687e1ea,"hsluv.Hsluv.boot","hsluv/Hsluv.hx",86,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_87_boot,"hsluv.Hsluv","boot",0x3687e1ea,"hsluv.Hsluv.boot","hsluv/Hsluv.hx",87,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_88_boot,"hsluv.Hsluv","boot",0x3687e1ea,"hsluv.Hsluv.boot","hsluv/Hsluv.hx",88,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_90_boot,"hsluv.Hsluv","boot",0x3687e1ea,"hsluv.Hsluv.boot","hsluv/Hsluv.hx",90,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_91_boot,"hsluv.Hsluv","boot",0x3687e1ea,"hsluv.Hsluv.boot","hsluv/Hsluv.hx",91,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_92_boot,"hsluv.Hsluv","boot",0x3687e1ea,"hsluv.Hsluv.boot","hsluv/Hsluv.hx",92,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_94_boot,"hsluv.Hsluv","boot",0x3687e1ea,"hsluv.Hsluv.boot","hsluv/Hsluv.hx",94,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_95_boot,"hsluv.Hsluv","boot",0x3687e1ea,"hsluv.Hsluv.boot","hsluv/Hsluv.hx",95,0x09d4c3c9)
+HX_LOCAL_STACK_FRAME(_hx_pos_d5dc22b6e2ff60be_96_boot,"hsluv.Hsluv","boot",0x3687e1ea,"hsluv.Hsluv.boot","hsluv/Hsluv.hx",96,0x09d4c3c9)
+namespace hsluv{
+
+void Hsluv_obj::__construct(){
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_72_new)
+ }
+
+Dynamic Hsluv_obj::__CreateEmpty() { return new Hsluv_obj; }
+
+void *Hsluv_obj::_hx_vtable = 0;
+
+Dynamic Hsluv_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Hsluv_obj > _hx_result = new Hsluv_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool Hsluv_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x29e47ee8;
+}
+
+void Hsluv_obj::rgbToHex(){
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_151_rgbToHex)
+HXLINE( 152) this->hex = HX_("#",23,00,00,00);
+HXLINE( 153) ::hsluv::Hsluv _hx_tmp = ::hx::ObjectPtr<OBJ_>(this);
+HXDLIN( 153) ::String _hx_tmp1 = _hx_tmp->hex;
+HXDLIN( 153) _hx_tmp->hex = (_hx_tmp1 + ::hsluv::Hsluv_obj::rgbChannelToHex(this->rgb_r));
+HXLINE( 154) ::hsluv::Hsluv _hx_tmp2 = ::hx::ObjectPtr<OBJ_>(this);
+HXDLIN( 154) ::String _hx_tmp3 = _hx_tmp2->hex;
+HXDLIN( 154) _hx_tmp2->hex = (_hx_tmp3 + ::hsluv::Hsluv_obj::rgbChannelToHex(this->rgb_g));
+HXLINE( 155) ::hsluv::Hsluv _hx_tmp4 = ::hx::ObjectPtr<OBJ_>(this);
+HXDLIN( 155) ::String _hx_tmp5 = _hx_tmp4->hex;
+HXDLIN( 155) _hx_tmp4->hex = (_hx_tmp5 + ::hsluv::Hsluv_obj::rgbChannelToHex(this->rgb_b));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Hsluv_obj,rgbToHex,(void))
+
+void Hsluv_obj::xyzToRgb(){
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_165_xyzToRgb)
+HXLINE( 166) this->rgb_r = ::hsluv::Hsluv_obj::fromLinear((((::hsluv::Hsluv_obj::m_r0 * this->xyz_x) + (::hsluv::Hsluv_obj::m_r1 * this->xyz_y)) + (::hsluv::Hsluv_obj::m_r2 * this->xyz_z)));
+HXLINE( 167) this->rgb_g = ::hsluv::Hsluv_obj::fromLinear((((::hsluv::Hsluv_obj::m_g0 * this->xyz_x) + (::hsluv::Hsluv_obj::m_g1 * this->xyz_y)) + (::hsluv::Hsluv_obj::m_g2 * this->xyz_z)));
+HXLINE( 168) this->rgb_b = ::hsluv::Hsluv_obj::fromLinear((((::hsluv::Hsluv_obj::m_b0 * this->xyz_x) + (::hsluv::Hsluv_obj::m_b1 * this->xyz_y)) + (::hsluv::Hsluv_obj::m_b2 * this->xyz_z)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Hsluv_obj,xyzToRgb,(void))
+
+void Hsluv_obj::luvToXyz(){
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_204_luvToXyz)
+HXLINE( 205) if ((this->luv_l == 0)) {
+HXLINE( 206) this->xyz_x = ( (Float)(0) );
+HXLINE( 207) this->xyz_y = ( (Float)(0) );
+HXLINE( 208) this->xyz_z = ( (Float)(0) );
+HXLINE( 209) return;
+ }
+HXLINE( 212) Float varU = ((this->luv_u / (( (Float)(13) ) * this->luv_l)) + ::hsluv::Hsluv_obj::refU);
+HXLINE( 213) Float varV = ((this->luv_v / (( (Float)(13) ) * this->luv_l)) + ::hsluv::Hsluv_obj::refV);
+HXLINE( 215) this->xyz_y = ::hsluv::Hsluv_obj::lToY(this->luv_l);
+HXLINE( 216) this->xyz_x = (( (Float)(0) ) - (((( (Float)(9) ) * this->xyz_y) * varU) / (((varU - ( (Float)(4) )) * varV) - (varU * varV))));
+HXLINE( 217) this->xyz_z = ((((( (Float)(9) ) * this->xyz_y) - ((( (Float)(15) ) * varV) * this->xyz_y)) - (varV * this->xyz_x)) / (( (Float)(3) ) * varV));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Hsluv_obj,luvToXyz,(void))
+
+void Hsluv_obj::lchToLuv(){
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_237_lchToLuv)
+HXLINE( 238) Float Hrad = ((this->lch_h / ((Float)180.0)) * ::Math_obj::PI);
+HXLINE( 239) this->luv_l = this->lch_l;
+HXLINE( 240) this->luv_u = (::Math_obj::cos(Hrad) * this->lch_c);
+HXLINE( 241) this->luv_v = (::Math_obj::sin(Hrad) * this->lch_c);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Hsluv_obj,lchToLuv,(void))
+
+void Hsluv_obj::calculateBoundingLines(Float l){
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_249_calculateBoundingLines)
+HXLINE( 250) Float sub1 = (::Math_obj::pow((l + 16),( (Float)(3) )) / ( (Float)(1560896) ));
+HXLINE( 251) Float sub2;
+HXDLIN( 251) if ((sub1 > ::hsluv::Hsluv_obj::epsilon)) {
+HXLINE( 251) sub2 = sub1;
+ }
+ else {
+HXLINE( 251) sub2 = (l / ::hsluv::Hsluv_obj::kappa);
+ }
+HXLINE( 253) Float s1r = (sub2 * ((( (Float)(284517) ) * ::hsluv::Hsluv_obj::m_r0) - (( (Float)(94839) ) * ::hsluv::Hsluv_obj::m_r2)));
+HXLINE( 254) Float s2r = (sub2 * (((( (Float)(838422) ) * ::hsluv::Hsluv_obj::m_r2) + (( (Float)(769860) ) * ::hsluv::Hsluv_obj::m_r1)) + (( (Float)(731718) ) * ::hsluv::Hsluv_obj::m_r0)));
+HXLINE( 255) Float s3r = (sub2 * ((( (Float)(632260) ) * ::hsluv::Hsluv_obj::m_r2) - (( (Float)(126452) ) * ::hsluv::Hsluv_obj::m_r1)));
+HXLINE( 257) Float s1g = (sub2 * ((( (Float)(284517) ) * ::hsluv::Hsluv_obj::m_g0) - (( (Float)(94839) ) * ::hsluv::Hsluv_obj::m_g2)));
+HXLINE( 258) Float s2g = (sub2 * (((( (Float)(838422) ) * ::hsluv::Hsluv_obj::m_g2) + (( (Float)(769860) ) * ::hsluv::Hsluv_obj::m_g1)) + (( (Float)(731718) ) * ::hsluv::Hsluv_obj::m_g0)));
+HXLINE( 259) Float s3g = (sub2 * ((( (Float)(632260) ) * ::hsluv::Hsluv_obj::m_g2) - (( (Float)(126452) ) * ::hsluv::Hsluv_obj::m_g1)));
+HXLINE( 261) Float s1b = (sub2 * ((( (Float)(284517) ) * ::hsluv::Hsluv_obj::m_b0) - (( (Float)(94839) ) * ::hsluv::Hsluv_obj::m_b2)));
+HXLINE( 262) Float s2b = (sub2 * (((( (Float)(838422) ) * ::hsluv::Hsluv_obj::m_b2) + (( (Float)(769860) ) * ::hsluv::Hsluv_obj::m_b1)) + (( (Float)(731718) ) * ::hsluv::Hsluv_obj::m_b0)));
+HXLINE( 263) Float s3b = (sub2 * ((( (Float)(632260) ) * ::hsluv::Hsluv_obj::m_b2) - (( (Float)(126452) ) * ::hsluv::Hsluv_obj::m_b1)));
+HXLINE( 265) this->r0s = (s1r / s3r);
+HXLINE( 266) this->r0i = ((s2r * l) / s3r);
+HXLINE( 267) this->r1s = (s1r / (s3r + 126452));
+HXLINE( 268) this->r1i = (((s2r - ( (Float)(769860) )) * l) / (s3r + 126452));
+HXLINE( 270) this->g0s = (s1g / s3g);
+HXLINE( 271) this->g0i = ((s2g * l) / s3g);
+HXLINE( 272) this->g1s = (s1g / (s3g + 126452));
+HXLINE( 273) this->g1i = (((s2g - ( (Float)(769860) )) * l) / (s3g + 126452));
+HXLINE( 275) this->b0s = (s1b / s3b);
+HXLINE( 276) this->b0i = ((s2b * l) / s3b);
+HXLINE( 277) this->b1s = (s1b / (s3b + 126452));
+HXLINE( 278) this->b1i = (((s2b - ( (Float)(769860) )) * l) / (s3b + 126452));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Hsluv_obj,calculateBoundingLines,(void))
+
+Float Hsluv_obj::calcMaxChromaHsluv(Float h){
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_335_calcMaxChromaHsluv)
+HXLINE( 336) Float hueRad = (((h / ( (Float)(360) )) * ::Math_obj::PI) * ( (Float)(2) ));
+HXLINE( 337) Float r0 = ::hsluv::Hsluv_obj::distanceFromOriginAngle(this->r0s,this->r0i,hueRad);
+HXLINE( 338) Float r1 = ::hsluv::Hsluv_obj::distanceFromOriginAngle(this->r1s,this->r1i,hueRad);
+HXLINE( 339) Float g0 = ::hsluv::Hsluv_obj::distanceFromOriginAngle(this->g0s,this->g0i,hueRad);
+HXLINE( 340) Float g1 = ::hsluv::Hsluv_obj::distanceFromOriginAngle(this->g1s,this->g1i,hueRad);
+HXLINE( 341) Float b0 = ::hsluv::Hsluv_obj::distanceFromOriginAngle(this->b0s,this->b0i,hueRad);
+HXLINE( 342) Float b1 = ::hsluv::Hsluv_obj::distanceFromOriginAngle(this->b1s,this->b1i,hueRad);
+HXLINE( 343) return ::hsluv::Hsluv_obj::min6(r0,r1,g0,g1,b0,b1);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Hsluv_obj,calcMaxChromaHsluv,return )
+
+void Hsluv_obj::hsluvToLch(){
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_346_hsluvToLch)
+HXLINE( 348) if ((this->hsluv_l > ((Float)99.9999999))) {
+HXLINE( 349) this->lch_l = ( (Float)(100) );
+HXLINE( 350) this->lch_c = ( (Float)(0) );
+ }
+ else {
+HXLINE( 351) if ((this->hsluv_l < ((Float)0.00000001))) {
+HXLINE( 352) this->lch_l = ( (Float)(0) );
+HXLINE( 353) this->lch_c = ( (Float)(0) );
+ }
+ else {
+HXLINE( 355) this->lch_l = this->hsluv_l;
+HXLINE( 356) this->calculateBoundingLines(this->hsluv_l);
+HXLINE( 357) Float max = this->calcMaxChromaHsluv(this->hsluv_h);
+HXLINE( 358) this->lch_c = ((max / ( (Float)(100) )) * this->hsluv_s);
+ }
+ }
+HXLINE( 360) this->lch_h = this->hsluv_h;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Hsluv_obj,hsluvToLch,(void))
+
+void Hsluv_obj::hsluvToRgb(){
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_414_hsluvToRgb)
+HXLINE( 415) this->hsluvToLch();
+HXLINE( 416) this->lchToLuv();
+HXLINE( 417) this->luvToXyz();
+HXLINE( 418) this->xyzToRgb();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Hsluv_obj,hsluvToRgb,(void))
+
+void Hsluv_obj::hsluvToHex(){
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_428_hsluvToHex)
+HXLINE( 429) this->hsluvToRgb();
+HXLINE( 430) this->rgbToHex();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Hsluv_obj,hsluvToHex,(void))
+
+::String Hsluv_obj::hexChars;
+
+Float Hsluv_obj::refY;
+
+Float Hsluv_obj::refU;
+
+Float Hsluv_obj::refV;
+
+Float Hsluv_obj::kappa;
+
+Float Hsluv_obj::epsilon;
+
+Float Hsluv_obj::m_r0;
+
+Float Hsluv_obj::m_r1;
+
+Float Hsluv_obj::m_r2;
+
+Float Hsluv_obj::m_g0;
+
+Float Hsluv_obj::m_g1;
+
+Float Hsluv_obj::m_g2;
+
+Float Hsluv_obj::m_b0;
+
+Float Hsluv_obj::m_b1;
+
+Float Hsluv_obj::m_b2;
+
+Float Hsluv_obj::fromLinear(Float c){
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_100_fromLinear)
+HXDLIN( 100) if ((c <= ((Float)0.0031308))) {
+HXLINE( 101) return (((Float)12.92) * c);
+ }
+ else {
+HXLINE( 103) return ((((Float)1.055) * ::Math_obj::pow(c,((Float)0.416666666666666685))) - ((Float)0.055));
+ }
+HXLINE( 100) return ((Float)0.);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Hsluv_obj,fromLinear,return )
+
+Float Hsluv_obj::lToY(Float L){
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_130_lToY)
+HXDLIN( 130) if ((L <= 8)) {
+HXLINE( 131) return ((::hsluv::Hsluv_obj::refY * L) / ::hsluv::Hsluv_obj::kappa);
+ }
+ else {
+HXLINE( 133) return (::hsluv::Hsluv_obj::refY * ::Math_obj::pow(((L + 16) / ( (Float)(116) )),( (Float)(3) )));
+ }
+HXLINE( 130) return ((Float)0.);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Hsluv_obj,lToY,return )
+
+::String Hsluv_obj::rgbChannelToHex(Float chan){
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_137_rgbChannelToHex)
+HXLINE( 138) int c = ::Math_obj::round((chan * ( (Float)(255) )));
+HXLINE( 139) int digit2 = ::hx::Mod(c,16);
+HXLINE( 140) int digit1 = ::Std_obj::_hx_int((( (Float)((c - digit2)) ) / ( (Float)(16) )));
+HXLINE( 141) ::String _hx_tmp = ::hsluv::Hsluv_obj::hexChars.charAt(digit1);
+HXDLIN( 141) return (_hx_tmp + ::hsluv::Hsluv_obj::hexChars.charAt(digit2));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Hsluv_obj,rgbChannelToHex,return )
+
+Float Hsluv_obj::distanceFromOriginAngle(Float slope,Float intercept,Float angle){
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_298_distanceFromOriginAngle)
+HXLINE( 299) Float d = (intercept / (::Math_obj::sin(angle) - (slope * ::Math_obj::cos(angle))));
+HXLINE( 300) if ((d < 0)) {
+HXLINE( 301) return ::Math_obj::POSITIVE_INFINITY;
+ }
+ else {
+HXLINE( 303) return d;
+ }
+HXLINE( 300) return ((Float)0.);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC3(Hsluv_obj,distanceFromOriginAngle,return )
+
+Float Hsluv_obj::min6(Float f1,Float f2,Float f3,Float f4,Float f5,Float f6){
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_312_min6)
+HXDLIN( 312) return ::Math_obj::min(f1,::Math_obj::min(f2,::Math_obj::min(f3,::Math_obj::min(f4,::Math_obj::min(f5,f6)))));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC6(Hsluv_obj,min6,return )
+
+
+::hx::ObjectPtr< Hsluv_obj > Hsluv_obj::__new() {
+ ::hx::ObjectPtr< Hsluv_obj > __this = new Hsluv_obj();
+ __this->__construct();
+ return __this;
+}
+
+::hx::ObjectPtr< Hsluv_obj > Hsluv_obj::__alloc(::hx::Ctx *_hx_ctx) {
+ Hsluv_obj *__this = (Hsluv_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Hsluv_obj), true, "hsluv.Hsluv"));
+ *(void **)__this = Hsluv_obj::_hx_vtable;
+ __this->__construct();
+ return __this;
+}
+
+Hsluv_obj::Hsluv_obj()
+{
+}
+
+void Hsluv_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(Hsluv);
+ HX_MARK_MEMBER_NAME(hex,"hex");
+ HX_MARK_MEMBER_NAME(rgb_r,"rgb_r");
+ HX_MARK_MEMBER_NAME(rgb_g,"rgb_g");
+ HX_MARK_MEMBER_NAME(rgb_b,"rgb_b");
+ HX_MARK_MEMBER_NAME(xyz_x,"xyz_x");
+ HX_MARK_MEMBER_NAME(xyz_y,"xyz_y");
+ HX_MARK_MEMBER_NAME(xyz_z,"xyz_z");
+ HX_MARK_MEMBER_NAME(luv_l,"luv_l");
+ HX_MARK_MEMBER_NAME(luv_u,"luv_u");
+ HX_MARK_MEMBER_NAME(luv_v,"luv_v");
+ HX_MARK_MEMBER_NAME(lch_l,"lch_l");
+ HX_MARK_MEMBER_NAME(lch_c,"lch_c");
+ HX_MARK_MEMBER_NAME(lch_h,"lch_h");
+ HX_MARK_MEMBER_NAME(hsluv_h,"hsluv_h");
+ HX_MARK_MEMBER_NAME(hsluv_s,"hsluv_s");
+ HX_MARK_MEMBER_NAME(hsluv_l,"hsluv_l");
+ HX_MARK_MEMBER_NAME(r0s,"r0s");
+ HX_MARK_MEMBER_NAME(r0i,"r0i");
+ HX_MARK_MEMBER_NAME(r1s,"r1s");
+ HX_MARK_MEMBER_NAME(r1i,"r1i");
+ HX_MARK_MEMBER_NAME(g0s,"g0s");
+ HX_MARK_MEMBER_NAME(g0i,"g0i");
+ HX_MARK_MEMBER_NAME(g1s,"g1s");
+ HX_MARK_MEMBER_NAME(g1i,"g1i");
+ HX_MARK_MEMBER_NAME(b0s,"b0s");
+ HX_MARK_MEMBER_NAME(b0i,"b0i");
+ HX_MARK_MEMBER_NAME(b1s,"b1s");
+ HX_MARK_MEMBER_NAME(b1i,"b1i");
+ HX_MARK_END_CLASS();
+}
+
+void Hsluv_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(hex,"hex");
+ HX_VISIT_MEMBER_NAME(rgb_r,"rgb_r");
+ HX_VISIT_MEMBER_NAME(rgb_g,"rgb_g");
+ HX_VISIT_MEMBER_NAME(rgb_b,"rgb_b");
+ HX_VISIT_MEMBER_NAME(xyz_x,"xyz_x");
+ HX_VISIT_MEMBER_NAME(xyz_y,"xyz_y");
+ HX_VISIT_MEMBER_NAME(xyz_z,"xyz_z");
+ HX_VISIT_MEMBER_NAME(luv_l,"luv_l");
+ HX_VISIT_MEMBER_NAME(luv_u,"luv_u");
+ HX_VISIT_MEMBER_NAME(luv_v,"luv_v");
+ HX_VISIT_MEMBER_NAME(lch_l,"lch_l");
+ HX_VISIT_MEMBER_NAME(lch_c,"lch_c");
+ HX_VISIT_MEMBER_NAME(lch_h,"lch_h");
+ HX_VISIT_MEMBER_NAME(hsluv_h,"hsluv_h");
+ HX_VISIT_MEMBER_NAME(hsluv_s,"hsluv_s");
+ HX_VISIT_MEMBER_NAME(hsluv_l,"hsluv_l");
+ HX_VISIT_MEMBER_NAME(r0s,"r0s");
+ HX_VISIT_MEMBER_NAME(r0i,"r0i");
+ HX_VISIT_MEMBER_NAME(r1s,"r1s");
+ HX_VISIT_MEMBER_NAME(r1i,"r1i");
+ HX_VISIT_MEMBER_NAME(g0s,"g0s");
+ HX_VISIT_MEMBER_NAME(g0i,"g0i");
+ HX_VISIT_MEMBER_NAME(g1s,"g1s");
+ HX_VISIT_MEMBER_NAME(g1i,"g1i");
+ HX_VISIT_MEMBER_NAME(b0s,"b0s");
+ HX_VISIT_MEMBER_NAME(b0i,"b0i");
+ HX_VISIT_MEMBER_NAME(b1s,"b1s");
+ HX_VISIT_MEMBER_NAME(b1i,"b1i");
+}
+
+::hx::Val Hsluv_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"hex") ) { return ::hx::Val( hex ); }
+ if (HX_FIELD_EQ(inName,"r0s") ) { return ::hx::Val( r0s ); }
+ if (HX_FIELD_EQ(inName,"r0i") ) { return ::hx::Val( r0i ); }
+ if (HX_FIELD_EQ(inName,"r1s") ) { return ::hx::Val( r1s ); }
+ if (HX_FIELD_EQ(inName,"r1i") ) { return ::hx::Val( r1i ); }
+ if (HX_FIELD_EQ(inName,"g0s") ) { return ::hx::Val( g0s ); }
+ if (HX_FIELD_EQ(inName,"g0i") ) { return ::hx::Val( g0i ); }
+ if (HX_FIELD_EQ(inName,"g1s") ) { return ::hx::Val( g1s ); }
+ if (HX_FIELD_EQ(inName,"g1i") ) { return ::hx::Val( g1i ); }
+ if (HX_FIELD_EQ(inName,"b0s") ) { return ::hx::Val( b0s ); }
+ if (HX_FIELD_EQ(inName,"b0i") ) { return ::hx::Val( b0i ); }
+ if (HX_FIELD_EQ(inName,"b1s") ) { return ::hx::Val( b1s ); }
+ if (HX_FIELD_EQ(inName,"b1i") ) { return ::hx::Val( b1i ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"rgb_r") ) { return ::hx::Val( rgb_r ); }
+ if (HX_FIELD_EQ(inName,"rgb_g") ) { return ::hx::Val( rgb_g ); }
+ if (HX_FIELD_EQ(inName,"rgb_b") ) { return ::hx::Val( rgb_b ); }
+ if (HX_FIELD_EQ(inName,"xyz_x") ) { return ::hx::Val( xyz_x ); }
+ if (HX_FIELD_EQ(inName,"xyz_y") ) { return ::hx::Val( xyz_y ); }
+ if (HX_FIELD_EQ(inName,"xyz_z") ) { return ::hx::Val( xyz_z ); }
+ if (HX_FIELD_EQ(inName,"luv_l") ) { return ::hx::Val( luv_l ); }
+ if (HX_FIELD_EQ(inName,"luv_u") ) { return ::hx::Val( luv_u ); }
+ if (HX_FIELD_EQ(inName,"luv_v") ) { return ::hx::Val( luv_v ); }
+ if (HX_FIELD_EQ(inName,"lch_l") ) { return ::hx::Val( lch_l ); }
+ if (HX_FIELD_EQ(inName,"lch_c") ) { return ::hx::Val( lch_c ); }
+ if (HX_FIELD_EQ(inName,"lch_h") ) { return ::hx::Val( lch_h ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"hsluv_h") ) { return ::hx::Val( hsluv_h ); }
+ if (HX_FIELD_EQ(inName,"hsluv_s") ) { return ::hx::Val( hsluv_s ); }
+ if (HX_FIELD_EQ(inName,"hsluv_l") ) { return ::hx::Val( hsluv_l ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"rgbToHex") ) { return ::hx::Val( rgbToHex_dyn() ); }
+ if (HX_FIELD_EQ(inName,"xyzToRgb") ) { return ::hx::Val( xyzToRgb_dyn() ); }
+ if (HX_FIELD_EQ(inName,"luvToXyz") ) { return ::hx::Val( luvToXyz_dyn() ); }
+ if (HX_FIELD_EQ(inName,"lchToLuv") ) { return ::hx::Val( lchToLuv_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"hsluvToLch") ) { return ::hx::Val( hsluvToLch_dyn() ); }
+ if (HX_FIELD_EQ(inName,"hsluvToRgb") ) { return ::hx::Val( hsluvToRgb_dyn() ); }
+ if (HX_FIELD_EQ(inName,"hsluvToHex") ) { return ::hx::Val( hsluvToHex_dyn() ); }
+ break;
+ case 18:
+ if (HX_FIELD_EQ(inName,"calcMaxChromaHsluv") ) { return ::hx::Val( calcMaxChromaHsluv_dyn() ); }
+ break;
+ case 22:
+ if (HX_FIELD_EQ(inName,"calculateBoundingLines") ) { return ::hx::Val( calculateBoundingLines_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool Hsluv_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"refY") ) { outValue = ( refY ); return true; }
+ if (HX_FIELD_EQ(inName,"refU") ) { outValue = ( refU ); return true; }
+ if (HX_FIELD_EQ(inName,"refV") ) { outValue = ( refV ); return true; }
+ if (HX_FIELD_EQ(inName,"m_r0") ) { outValue = ( m_r0 ); return true; }
+ if (HX_FIELD_EQ(inName,"m_r1") ) { outValue = ( m_r1 ); return true; }
+ if (HX_FIELD_EQ(inName,"m_r2") ) { outValue = ( m_r2 ); return true; }
+ if (HX_FIELD_EQ(inName,"m_g0") ) { outValue = ( m_g0 ); return true; }
+ if (HX_FIELD_EQ(inName,"m_g1") ) { outValue = ( m_g1 ); return true; }
+ if (HX_FIELD_EQ(inName,"m_g2") ) { outValue = ( m_g2 ); return true; }
+ if (HX_FIELD_EQ(inName,"m_b0") ) { outValue = ( m_b0 ); return true; }
+ if (HX_FIELD_EQ(inName,"m_b1") ) { outValue = ( m_b1 ); return true; }
+ if (HX_FIELD_EQ(inName,"m_b2") ) { outValue = ( m_b2 ); return true; }
+ if (HX_FIELD_EQ(inName,"lToY") ) { outValue = lToY_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"min6") ) { outValue = min6_dyn(); return true; }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"kappa") ) { outValue = ( kappa ); return true; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"epsilon") ) { outValue = ( epsilon ); return true; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"hexChars") ) { outValue = ( hexChars ); return true; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"fromLinear") ) { outValue = fromLinear_dyn(); return true; }
+ break;
+ case 15:
+ if (HX_FIELD_EQ(inName,"rgbChannelToHex") ) { outValue = rgbChannelToHex_dyn(); return true; }
+ break;
+ case 23:
+ if (HX_FIELD_EQ(inName,"distanceFromOriginAngle") ) { outValue = distanceFromOriginAngle_dyn(); return true; }
+ }
+ return false;
+}
+
+::hx::Val Hsluv_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"hex") ) { hex=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"r0s") ) { r0s=inValue.Cast< Float >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"r0i") ) { r0i=inValue.Cast< Float >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"r1s") ) { r1s=inValue.Cast< Float >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"r1i") ) { r1i=inValue.Cast< Float >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"g0s") ) { g0s=inValue.Cast< Float >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"g0i") ) { g0i=inValue.Cast< Float >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"g1s") ) { g1s=inValue.Cast< Float >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"g1i") ) { g1i=inValue.Cast< Float >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"b0s") ) { b0s=inValue.Cast< Float >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"b0i") ) { b0i=inValue.Cast< Float >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"b1s") ) { b1s=inValue.Cast< Float >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"b1i") ) { b1i=inValue.Cast< Float >(); return inValue; }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"rgb_r") ) { rgb_r=inValue.Cast< Float >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"rgb_g") ) { rgb_g=inValue.Cast< Float >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"rgb_b") ) { rgb_b=inValue.Cast< Float >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"xyz_x") ) { xyz_x=inValue.Cast< Float >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"xyz_y") ) { xyz_y=inValue.Cast< Float >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"xyz_z") ) { xyz_z=inValue.Cast< Float >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"luv_l") ) { luv_l=inValue.Cast< Float >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"luv_u") ) { luv_u=inValue.Cast< Float >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"luv_v") ) { luv_v=inValue.Cast< Float >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"lch_l") ) { lch_l=inValue.Cast< Float >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"lch_c") ) { lch_c=inValue.Cast< Float >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"lch_h") ) { lch_h=inValue.Cast< Float >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"hsluv_h") ) { hsluv_h=inValue.Cast< Float >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"hsluv_s") ) { hsluv_s=inValue.Cast< Float >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"hsluv_l") ) { hsluv_l=inValue.Cast< Float >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+bool Hsluv_obj::__SetStatic(const ::String &inName,Dynamic &ioValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"refY") ) { refY=ioValue.Cast< Float >(); return true; }
+ if (HX_FIELD_EQ(inName,"refU") ) { refU=ioValue.Cast< Float >(); return true; }
+ if (HX_FIELD_EQ(inName,"refV") ) { refV=ioValue.Cast< Float >(); return true; }
+ if (HX_FIELD_EQ(inName,"m_r0") ) { m_r0=ioValue.Cast< Float >(); return true; }
+ if (HX_FIELD_EQ(inName,"m_r1") ) { m_r1=ioValue.Cast< Float >(); return true; }
+ if (HX_FIELD_EQ(inName,"m_r2") ) { m_r2=ioValue.Cast< Float >(); return true; }
+ if (HX_FIELD_EQ(inName,"m_g0") ) { m_g0=ioValue.Cast< Float >(); return true; }
+ if (HX_FIELD_EQ(inName,"m_g1") ) { m_g1=ioValue.Cast< Float >(); return true; }
+ if (HX_FIELD_EQ(inName,"m_g2") ) { m_g2=ioValue.Cast< Float >(); return true; }
+ if (HX_FIELD_EQ(inName,"m_b0") ) { m_b0=ioValue.Cast< Float >(); return true; }
+ if (HX_FIELD_EQ(inName,"m_b1") ) { m_b1=ioValue.Cast< Float >(); return true; }
+ if (HX_FIELD_EQ(inName,"m_b2") ) { m_b2=ioValue.Cast< Float >(); return true; }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"kappa") ) { kappa=ioValue.Cast< Float >(); return true; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"epsilon") ) { epsilon=ioValue.Cast< Float >(); return true; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"hexChars") ) { hexChars=ioValue.Cast< ::String >(); return true; }
+ }
+ return false;
+}
+
+void Hsluv_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("hex",db,42,4f,00));
+ outFields->push(HX_("rgb_r",80,cb,0d,e8));
+ outFields->push(HX_("rgb_g",75,cb,0d,e8));
+ outFields->push(HX_("rgb_b",70,cb,0d,e8));
+ outFields->push(HX_("xyz_x",d2,53,6d,68));
+ outFields->push(HX_("xyz_y",d3,53,6d,68));
+ outFields->push(HX_("xyz_z",d4,53,6d,68));
+ outFields->push(HX_("luv_l",3a,7a,f6,7c));
+ outFields->push(HX_("luv_u",43,7a,f6,7c));
+ outFields->push(HX_("luv_v",44,7a,f6,7c));
+ outFields->push(HX_("lch_l",7e,03,06,71));
+ outFields->push(HX_("lch_c",75,03,06,71));
+ outFields->push(HX_("lch_h",7a,03,06,71));
+ outFields->push(HX_("hsluv_h",4b,37,b9,5c));
+ outFields->push(HX_("hsluv_s",56,37,b9,5c));
+ outFields->push(HX_("hsluv_l",4f,37,b9,5c));
+ outFields->push(HX_("r0s",35,ab,56,00));
+ outFields->push(HX_("r0i",2b,ab,56,00));
+ outFields->push(HX_("r1s",14,ac,56,00));
+ outFields->push(HX_("r1i",0a,ac,56,00));
+ outFields->push(HX_("g0s",6a,52,4e,00));
+ outFields->push(HX_("g0i",60,52,4e,00));
+ outFields->push(HX_("g1s",49,53,4e,00));
+ outFields->push(HX_("g1i",3f,53,4e,00));
+ outFields->push(HX_("b0s",25,87,4a,00));
+ outFields->push(HX_("b0i",1b,87,4a,00));
+ outFields->push(HX_("b1s",04,88,4a,00));
+ outFields->push(HX_("b1i",fa,87,4a,00));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Hsluv_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(Hsluv_obj,hex),HX_("hex",db,42,4f,00)},
+ {::hx::fsFloat,(int)offsetof(Hsluv_obj,rgb_r),HX_("rgb_r",80,cb,0d,e8)},
+ {::hx::fsFloat,(int)offsetof(Hsluv_obj,rgb_g),HX_("rgb_g",75,cb,0d,e8)},
+ {::hx::fsFloat,(int)offsetof(Hsluv_obj,rgb_b),HX_("rgb_b",70,cb,0d,e8)},
+ {::hx::fsFloat,(int)offsetof(Hsluv_obj,xyz_x),HX_("xyz_x",d2,53,6d,68)},
+ {::hx::fsFloat,(int)offsetof(Hsluv_obj,xyz_y),HX_("xyz_y",d3,53,6d,68)},
+ {::hx::fsFloat,(int)offsetof(Hsluv_obj,xyz_z),HX_("xyz_z",d4,53,6d,68)},
+ {::hx::fsFloat,(int)offsetof(Hsluv_obj,luv_l),HX_("luv_l",3a,7a,f6,7c)},
+ {::hx::fsFloat,(int)offsetof(Hsluv_obj,luv_u),HX_("luv_u",43,7a,f6,7c)},
+ {::hx::fsFloat,(int)offsetof(Hsluv_obj,luv_v),HX_("luv_v",44,7a,f6,7c)},
+ {::hx::fsFloat,(int)offsetof(Hsluv_obj,lch_l),HX_("lch_l",7e,03,06,71)},
+ {::hx::fsFloat,(int)offsetof(Hsluv_obj,lch_c),HX_("lch_c",75,03,06,71)},
+ {::hx::fsFloat,(int)offsetof(Hsluv_obj,lch_h),HX_("lch_h",7a,03,06,71)},
+ {::hx::fsFloat,(int)offsetof(Hsluv_obj,hsluv_h),HX_("hsluv_h",4b,37,b9,5c)},
+ {::hx::fsFloat,(int)offsetof(Hsluv_obj,hsluv_s),HX_("hsluv_s",56,37,b9,5c)},
+ {::hx::fsFloat,(int)offsetof(Hsluv_obj,hsluv_l),HX_("hsluv_l",4f,37,b9,5c)},
+ {::hx::fsFloat,(int)offsetof(Hsluv_obj,r0s),HX_("r0s",35,ab,56,00)},
+ {::hx::fsFloat,(int)offsetof(Hsluv_obj,r0i),HX_("r0i",2b,ab,56,00)},
+ {::hx::fsFloat,(int)offsetof(Hsluv_obj,r1s),HX_("r1s",14,ac,56,00)},
+ {::hx::fsFloat,(int)offsetof(Hsluv_obj,r1i),HX_("r1i",0a,ac,56,00)},
+ {::hx::fsFloat,(int)offsetof(Hsluv_obj,g0s),HX_("g0s",6a,52,4e,00)},
+ {::hx::fsFloat,(int)offsetof(Hsluv_obj,g0i),HX_("g0i",60,52,4e,00)},
+ {::hx::fsFloat,(int)offsetof(Hsluv_obj,g1s),HX_("g1s",49,53,4e,00)},
+ {::hx::fsFloat,(int)offsetof(Hsluv_obj,g1i),HX_("g1i",3f,53,4e,00)},
+ {::hx::fsFloat,(int)offsetof(Hsluv_obj,b0s),HX_("b0s",25,87,4a,00)},
+ {::hx::fsFloat,(int)offsetof(Hsluv_obj,b0i),HX_("b0i",1b,87,4a,00)},
+ {::hx::fsFloat,(int)offsetof(Hsluv_obj,b1s),HX_("b1s",04,88,4a,00)},
+ {::hx::fsFloat,(int)offsetof(Hsluv_obj,b1i),HX_("b1i",fa,87,4a,00)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo Hsluv_obj_sStaticStorageInfo[] = {
+ {::hx::fsString,(void *) &Hsluv_obj::hexChars,HX_("hexChars",02,90,2a,78)},
+ {::hx::fsFloat,(void *) &Hsluv_obj::refY,HX_("refY",a6,4f,a7,4b)},
+ {::hx::fsFloat,(void *) &Hsluv_obj::refU,HX_("refU",a2,4f,a7,4b)},
+ {::hx::fsFloat,(void *) &Hsluv_obj::refV,HX_("refV",a3,4f,a7,4b)},
+ {::hx::fsFloat,(void *) &Hsluv_obj::kappa,HX_("kappa",8b,22,53,dc)},
+ {::hx::fsFloat,(void *) &Hsluv_obj::epsilon,HX_("epsilon",6a,b5,be,ac)},
+ {::hx::fsFloat,(void *) &Hsluv_obj::m_r0,HX_("m_r0",50,bb,54,48)},
+ {::hx::fsFloat,(void *) &Hsluv_obj::m_r1,HX_("m_r1",51,bb,54,48)},
+ {::hx::fsFloat,(void *) &Hsluv_obj::m_r2,HX_("m_r2",52,bb,54,48)},
+ {::hx::fsFloat,(void *) &Hsluv_obj::m_g0,HX_("m_g0",bb,b1,54,48)},
+ {::hx::fsFloat,(void *) &Hsluv_obj::m_g1,HX_("m_g1",bc,b1,54,48)},
+ {::hx::fsFloat,(void *) &Hsluv_obj::m_g2,HX_("m_g2",bd,b1,54,48)},
+ {::hx::fsFloat,(void *) &Hsluv_obj::m_b0,HX_("m_b0",60,ad,54,48)},
+ {::hx::fsFloat,(void *) &Hsluv_obj::m_b1,HX_("m_b1",61,ad,54,48)},
+ {::hx::fsFloat,(void *) &Hsluv_obj::m_b2,HX_("m_b2",62,ad,54,48)},
+ { ::hx::fsUnknown, 0, null()}
+};
+#endif
+
+static ::String Hsluv_obj_sMemberFields[] = {
+ HX_("hex",db,42,4f,00),
+ HX_("rgb_r",80,cb,0d,e8),
+ HX_("rgb_g",75,cb,0d,e8),
+ HX_("rgb_b",70,cb,0d,e8),
+ HX_("xyz_x",d2,53,6d,68),
+ HX_("xyz_y",d3,53,6d,68),
+ HX_("xyz_z",d4,53,6d,68),
+ HX_("luv_l",3a,7a,f6,7c),
+ HX_("luv_u",43,7a,f6,7c),
+ HX_("luv_v",44,7a,f6,7c),
+ HX_("lch_l",7e,03,06,71),
+ HX_("lch_c",75,03,06,71),
+ HX_("lch_h",7a,03,06,71),
+ HX_("hsluv_h",4b,37,b9,5c),
+ HX_("hsluv_s",56,37,b9,5c),
+ HX_("hsluv_l",4f,37,b9,5c),
+ HX_("r0s",35,ab,56,00),
+ HX_("r0i",2b,ab,56,00),
+ HX_("r1s",14,ac,56,00),
+ HX_("r1i",0a,ac,56,00),
+ HX_("g0s",6a,52,4e,00),
+ HX_("g0i",60,52,4e,00),
+ HX_("g1s",49,53,4e,00),
+ HX_("g1i",3f,53,4e,00),
+ HX_("b0s",25,87,4a,00),
+ HX_("b0i",1b,87,4a,00),
+ HX_("b1s",04,88,4a,00),
+ HX_("b1i",fa,87,4a,00),
+ HX_("rgbToHex",d3,59,d1,09),
+ HX_("xyzToRgb",39,a1,1a,e6),
+ HX_("luvToXyz",91,98,fe,f7),
+ HX_("lchToLuv",41,13,74,72),
+ HX_("calculateBoundingLines",b5,3e,5b,c7),
+ HX_("calcMaxChromaHsluv",7d,51,bd,01),
+ HX_("hsluvToLch",54,48,a8,d8),
+ HX_("hsluvToRgb",50,d9,ac,d8),
+ HX_("hsluvToHex",1e,41,a5,d8),
+ ::String(null()) };
+
+static void Hsluv_obj_sMarkStatics(HX_MARK_PARAMS) {
+ HX_MARK_MEMBER_NAME(Hsluv_obj::hexChars,"hexChars");
+ HX_MARK_MEMBER_NAME(Hsluv_obj::refY,"refY");
+ HX_MARK_MEMBER_NAME(Hsluv_obj::refU,"refU");
+ HX_MARK_MEMBER_NAME(Hsluv_obj::refV,"refV");
+ HX_MARK_MEMBER_NAME(Hsluv_obj::kappa,"kappa");
+ HX_MARK_MEMBER_NAME(Hsluv_obj::epsilon,"epsilon");
+ HX_MARK_MEMBER_NAME(Hsluv_obj::m_r0,"m_r0");
+ HX_MARK_MEMBER_NAME(Hsluv_obj::m_r1,"m_r1");
+ HX_MARK_MEMBER_NAME(Hsluv_obj::m_r2,"m_r2");
+ HX_MARK_MEMBER_NAME(Hsluv_obj::m_g0,"m_g0");
+ HX_MARK_MEMBER_NAME(Hsluv_obj::m_g1,"m_g1");
+ HX_MARK_MEMBER_NAME(Hsluv_obj::m_g2,"m_g2");
+ HX_MARK_MEMBER_NAME(Hsluv_obj::m_b0,"m_b0");
+ HX_MARK_MEMBER_NAME(Hsluv_obj::m_b1,"m_b1");
+ HX_MARK_MEMBER_NAME(Hsluv_obj::m_b2,"m_b2");
+};
+
+#ifdef HXCPP_VISIT_ALLOCS
+static void Hsluv_obj_sVisitStatics(HX_VISIT_PARAMS) {
+ HX_VISIT_MEMBER_NAME(Hsluv_obj::hexChars,"hexChars");
+ HX_VISIT_MEMBER_NAME(Hsluv_obj::refY,"refY");
+ HX_VISIT_MEMBER_NAME(Hsluv_obj::refU,"refU");
+ HX_VISIT_MEMBER_NAME(Hsluv_obj::refV,"refV");
+ HX_VISIT_MEMBER_NAME(Hsluv_obj::kappa,"kappa");
+ HX_VISIT_MEMBER_NAME(Hsluv_obj::epsilon,"epsilon");
+ HX_VISIT_MEMBER_NAME(Hsluv_obj::m_r0,"m_r0");
+ HX_VISIT_MEMBER_NAME(Hsluv_obj::m_r1,"m_r1");
+ HX_VISIT_MEMBER_NAME(Hsluv_obj::m_r2,"m_r2");
+ HX_VISIT_MEMBER_NAME(Hsluv_obj::m_g0,"m_g0");
+ HX_VISIT_MEMBER_NAME(Hsluv_obj::m_g1,"m_g1");
+ HX_VISIT_MEMBER_NAME(Hsluv_obj::m_g2,"m_g2");
+ HX_VISIT_MEMBER_NAME(Hsluv_obj::m_b0,"m_b0");
+ HX_VISIT_MEMBER_NAME(Hsluv_obj::m_b1,"m_b1");
+ HX_VISIT_MEMBER_NAME(Hsluv_obj::m_b2,"m_b2");
+};
+
+#endif
+
+::hx::Class Hsluv_obj::__mClass;
+
+static ::String Hsluv_obj_sStaticFields[] = {
+ HX_("hexChars",02,90,2a,78),
+ HX_("refY",a6,4f,a7,4b),
+ HX_("refU",a2,4f,a7,4b),
+ HX_("refV",a3,4f,a7,4b),
+ HX_("kappa",8b,22,53,dc),
+ HX_("epsilon",6a,b5,be,ac),
+ HX_("m_r0",50,bb,54,48),
+ HX_("m_r1",51,bb,54,48),
+ HX_("m_r2",52,bb,54,48),
+ HX_("m_g0",bb,b1,54,48),
+ HX_("m_g1",bc,b1,54,48),
+ HX_("m_g2",bd,b1,54,48),
+ HX_("m_b0",60,ad,54,48),
+ HX_("m_b1",61,ad,54,48),
+ HX_("m_b2",62,ad,54,48),
+ HX_("fromLinear",ef,56,e4,2f),
+ HX_("lToY",72,29,a3,47),
+ HX_("rgbChannelToHex",0a,c7,4f,40),
+ HX_("distanceFromOriginAngle",0e,c7,6c,31),
+ HX_("min6",64,4e,5c,48),
+ ::String(null())
+};
+
+void Hsluv_obj::__register()
+{
+ Hsluv_obj _hx_dummy;
+ Hsluv_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("hsluv.Hsluv",b6,dd,34,2e);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Hsluv_obj::__GetStatic;
+ __mClass->mSetStaticField = &Hsluv_obj::__SetStatic;
+ __mClass->mMarkFunc = Hsluv_obj_sMarkStatics;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Hsluv_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Hsluv_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Hsluv_obj >;
+#ifdef HXCPP_VISIT_ALLOCS
+ __mClass->mVisitFunc = Hsluv_obj_sVisitStatics;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Hsluv_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Hsluv_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void Hsluv_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_74_boot)
+HXDLIN( 74) hexChars = HX_("0123456789abcdef",68,7e,d5,ef);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_76_boot)
+HXDLIN( 76) refY = ((Float)1.0);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_78_boot)
+HXDLIN( 78) refU = ((Float)0.19783000664283);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_79_boot)
+HXDLIN( 79) refV = ((Float)0.46831999493879);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_82_boot)
+HXDLIN( 82) kappa = ((Float)903.2962962);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_83_boot)
+HXDLIN( 83) epsilon = ((Float)0.0088564516);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_86_boot)
+HXDLIN( 86) m_r0 = ((Float)3.240969941904521);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_87_boot)
+HXDLIN( 87) m_r1 = ((Float)-1.537383177570093);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_88_boot)
+HXDLIN( 88) m_r2 = ((Float)-0.498610760293);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_90_boot)
+HXDLIN( 90) m_g0 = ((Float)-0.96924363628087);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_91_boot)
+HXDLIN( 91) m_g1 = ((Float)1.87596750150772);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_92_boot)
+HXDLIN( 92) m_g2 = ((Float)0.041555057407175);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_94_boot)
+HXDLIN( 94) m_b0 = ((Float)0.055630079696993);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_95_boot)
+HXDLIN( 95) m_b1 = ((Float)-0.20397695888897);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_d5dc22b6e2ff60be_96_boot)
+HXDLIN( 96) m_b2 = ((Float)1.056971514242878);
+ }
+}
+
+} // end namespace hsluv
diff --git a/Sources/c_snikket/src/htmlparser/HtmlAttribute.cpp b/Sources/c_snikket/src/htmlparser/HtmlAttribute.cpp
new file mode 100644
index 0000000..f01ad06
--- /dev/null
+++ b/Sources/c_snikket/src/htmlparser/HtmlAttribute.cpp
@@ -0,0 +1,129 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_htmlparser_HtmlAttribute
+#include <htmlparser/HtmlAttribute.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_630f17b70ccedfe6_10_new,"htmlparser.HtmlAttribute","new",0x2f20ed9f,"htmlparser.HtmlAttribute.new","htmlparser/HtmlAttribute.hx",10,0x8ea4bcb2)
+namespace htmlparser{
+
+void HtmlAttribute_obj::__construct(::String name,::String value,::String quote){
+ HX_STACKFRAME(&_hx_pos_630f17b70ccedfe6_10_new)
+HXLINE( 11) this->name = name;
+HXLINE( 12) this->value = value;
+HXLINE( 13) this->quote = quote;
+ }
+
+Dynamic HtmlAttribute_obj::__CreateEmpty() { return new HtmlAttribute_obj; }
+
+void *HtmlAttribute_obj::_hx_vtable = 0;
+
+Dynamic HtmlAttribute_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< HtmlAttribute_obj > _hx_result = new HtmlAttribute_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2]);
+ return _hx_result;
+}
+
+bool HtmlAttribute_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x49e2a647;
+}
+
+
+HtmlAttribute_obj::HtmlAttribute_obj()
+{
+}
+
+void HtmlAttribute_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(HtmlAttribute);
+ HX_MARK_MEMBER_NAME(name,"name");
+ HX_MARK_MEMBER_NAME(value,"value");
+ HX_MARK_MEMBER_NAME(quote,"quote");
+ HX_MARK_END_CLASS();
+}
+
+void HtmlAttribute_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(name,"name");
+ HX_VISIT_MEMBER_NAME(value,"value");
+ HX_VISIT_MEMBER_NAME(quote,"quote");
+}
+
+::hx::Val HtmlAttribute_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"name") ) { return ::hx::Val( name ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"value") ) { return ::hx::Val( value ); }
+ if (HX_FIELD_EQ(inName,"quote") ) { return ::hx::Val( quote ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val HtmlAttribute_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"name") ) { name=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"value") ) { value=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"quote") ) { quote=inValue.Cast< ::String >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void HtmlAttribute_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("name",4b,72,ff,48));
+ outFields->push(HX_("value",71,7f,b8,31));
+ outFields->push(HX_("quote",3c,23,f2,5d));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo HtmlAttribute_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(HtmlAttribute_obj,name),HX_("name",4b,72,ff,48)},
+ {::hx::fsString,(int)offsetof(HtmlAttribute_obj,value),HX_("value",71,7f,b8,31)},
+ {::hx::fsString,(int)offsetof(HtmlAttribute_obj,quote),HX_("quote",3c,23,f2,5d)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *HtmlAttribute_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String HtmlAttribute_obj_sMemberFields[] = {
+ HX_("name",4b,72,ff,48),
+ HX_("value",71,7f,b8,31),
+ HX_("quote",3c,23,f2,5d),
+ ::String(null()) };
+
+::hx::Class HtmlAttribute_obj::__mClass;
+
+void HtmlAttribute_obj::__register()
+{
+ HtmlAttribute_obj _hx_dummy;
+ HtmlAttribute_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("htmlparser.HtmlAttribute",2d,32,5c,c0);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(HtmlAttribute_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< HtmlAttribute_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = HtmlAttribute_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = HtmlAttribute_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace htmlparser
diff --git a/Sources/c_snikket/src/htmlparser/HtmlNode.cpp b/Sources/c_snikket/src/htmlparser/HtmlNode.cpp
new file mode 100644
index 0000000..2c4b39c
--- /dev/null
+++ b/Sources/c_snikket/src/htmlparser/HtmlNode.cpp
@@ -0,0 +1,108 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_htmlparser_HtmlNode
+#include <htmlparser/HtmlNode.h>
+#endif
+#ifndef INCLUDED_htmlparser_HtmlNodeElement
+#include <htmlparser/HtmlNodeElement.h>
+#endif
+
+namespace htmlparser{
+
+void HtmlNode_obj::__construct() { }
+
+Dynamic HtmlNode_obj::__CreateEmpty() { return new HtmlNode_obj; }
+
+void *HtmlNode_obj::_hx_vtable = 0;
+
+Dynamic HtmlNode_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< HtmlNode_obj > _hx_result = new HtmlNode_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool HtmlNode_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x0ca65a7f;
+}
+
+
+HtmlNode_obj::HtmlNode_obj()
+{
+}
+
+void HtmlNode_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(HtmlNode);
+ HX_MARK_MEMBER_NAME(parent,"parent");
+ HX_MARK_END_CLASS();
+}
+
+void HtmlNode_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(parent,"parent");
+}
+
+::hx::Val HtmlNode_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 6:
+ if (HX_FIELD_EQ(inName,"parent") ) { return ::hx::Val( parent ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val HtmlNode_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 6:
+ if (HX_FIELD_EQ(inName,"parent") ) { parent=inValue.Cast< ::htmlparser::HtmlNodeElement >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void HtmlNode_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("parent",2a,05,7e,ed));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo HtmlNode_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::htmlparser::HtmlNodeElement */ ,(int)offsetof(HtmlNode_obj,parent),HX_("parent",2a,05,7e,ed)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *HtmlNode_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String HtmlNode_obj_sMemberFields[] = {
+ HX_("parent",2a,05,7e,ed),
+ ::String(null()) };
+
+::hx::Class HtmlNode_obj::__mClass;
+
+void HtmlNode_obj::__register()
+{
+ HtmlNode_obj _hx_dummy;
+ HtmlNode_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("htmlparser.HtmlNode",91,81,77,fd);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(HtmlNode_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< HtmlNode_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = HtmlNode_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = HtmlNode_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace htmlparser
diff --git a/Sources/c_snikket/src/htmlparser/HtmlNodeElement.cpp b/Sources/c_snikket/src/htmlparser/HtmlNodeElement.cpp
new file mode 100644
index 0000000..3386084
--- /dev/null
+++ b/Sources/c_snikket/src/htmlparser/HtmlNodeElement.cpp
@@ -0,0 +1,214 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_haxe_Exception
+#include <haxe/Exception.h>
+#endif
+#ifndef INCLUDED_htmlparser_HtmlAttribute
+#include <htmlparser/HtmlAttribute.h>
+#endif
+#ifndef INCLUDED_htmlparser_HtmlNode
+#include <htmlparser/HtmlNode.h>
+#endif
+#ifndef INCLUDED_htmlparser_HtmlNodeElement
+#include <htmlparser/HtmlNodeElement.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_230db80db2eef571_30_new,"htmlparser.HtmlNodeElement","new",0x871a2b9d,"htmlparser.HtmlNodeElement.new","htmlparser/HtmlNodeElement.hx",30,0x4baf0ab4)
+HX_LOCAL_STACK_FRAME(_hx_pos_230db80db2eef571_39_addChild,"htmlparser.HtmlNodeElement","addChild",0xc82b975e,"htmlparser.HtmlNodeElement.addChild","htmlparser/HtmlNodeElement.hx",39,0x4baf0ab4)
+namespace htmlparser{
+
+void HtmlNodeElement_obj::__construct(::String name,::Array< ::Dynamic> attributes){
+ HX_STACKFRAME(&_hx_pos_230db80db2eef571_30_new)
+HXLINE( 31) this->name = name;
+HXLINE( 32) this->attributes = attributes;
+HXLINE( 33) this->nodes = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 34) this->children = ::Array_obj< ::Dynamic>::__new(0);
+ }
+
+Dynamic HtmlNodeElement_obj::__CreateEmpty() { return new HtmlNodeElement_obj; }
+
+void *HtmlNodeElement_obj::_hx_vtable = 0;
+
+Dynamic HtmlNodeElement_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< HtmlNodeElement_obj > _hx_result = new HtmlNodeElement_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1]);
+ return _hx_result;
+}
+
+bool HtmlNodeElement_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x0ca65a7f) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x0ca65a7f;
+ } else {
+ return inClassId==(int)0x234247c5;
+ }
+}
+
+void HtmlNodeElement_obj::addChild( ::htmlparser::HtmlNode node, ::htmlparser::HtmlNode beforeNode){
+ HX_GC_STACKFRAME(&_hx_pos_230db80db2eef571_39_addChild)
+HXDLIN( 39) if (::hx::IsNull( beforeNode )) {
+HXLINE( 41) this->nodes->push(node);
+HXLINE( 42) node->parent = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 43) if (::Std_obj::isOfType(node,::hx::ClassOf< ::htmlparser::HtmlNodeElement >())) {
+HXLINE( 43) this->children->push(( ( ::htmlparser::HtmlNodeElement)(node) ));
+ }
+ }
+ else {
+HXLINE( 47) int n = this->nodes->indexOf(beforeNode,null());
+HXLINE( 48) if ((n < 0)) {
+HXLINE( 48) HX_STACK_DO_THROW( ::haxe::Exception_obj::__alloc( HX_CTX ,HX_("`beforeNode` is not found.",6e,0e,bc,84),null(),null()));
+ }
+HXLINE( 49) this->nodes->insert(n,node);
+HXLINE( 50) node->parent = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 51) ::Array< ::Dynamic> _g = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 51) {
+HXLINE( 51) int _g1 = 0;
+HXDLIN( 51) ::Array< ::Dynamic> _g2 = this->nodes;
+HXDLIN( 51) while((_g1 < _g2->length)){
+HXLINE( 51) ::htmlparser::HtmlNode v = _g2->__get(_g1).StaticCast< ::htmlparser::HtmlNode >();
+HXDLIN( 51) _g1 = (_g1 + 1);
+HXDLIN( 51) if (::Std_obj::isOfType(v,::hx::ClassOf< ::htmlparser::HtmlNodeElement >())) {
+HXLINE( 51) _g->push(v);
+ }
+ }
+ }
+HXDLIN( 51) this->children = _g;
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(HtmlNodeElement_obj,addChild,(void))
+
+
+::hx::ObjectPtr< HtmlNodeElement_obj > HtmlNodeElement_obj::__new(::String name,::Array< ::Dynamic> attributes) {
+ ::hx::ObjectPtr< HtmlNodeElement_obj > __this = new HtmlNodeElement_obj();
+ __this->__construct(name,attributes);
+ return __this;
+}
+
+::hx::ObjectPtr< HtmlNodeElement_obj > HtmlNodeElement_obj::__alloc(::hx::Ctx *_hx_ctx,::String name,::Array< ::Dynamic> attributes) {
+ HtmlNodeElement_obj *__this = (HtmlNodeElement_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(HtmlNodeElement_obj), true, "htmlparser.HtmlNodeElement"));
+ *(void **)__this = HtmlNodeElement_obj::_hx_vtable;
+ __this->__construct(name,attributes);
+ return __this;
+}
+
+HtmlNodeElement_obj::HtmlNodeElement_obj()
+{
+}
+
+void HtmlNodeElement_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(HtmlNodeElement);
+ HX_MARK_MEMBER_NAME(name,"name");
+ HX_MARK_MEMBER_NAME(attributes,"attributes");
+ HX_MARK_MEMBER_NAME(nodes,"nodes");
+ HX_MARK_MEMBER_NAME(children,"children");
+ ::htmlparser::HtmlNode_obj::__Mark(HX_MARK_ARG);
+ HX_MARK_END_CLASS();
+}
+
+void HtmlNodeElement_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(name,"name");
+ HX_VISIT_MEMBER_NAME(attributes,"attributes");
+ HX_VISIT_MEMBER_NAME(nodes,"nodes");
+ HX_VISIT_MEMBER_NAME(children,"children");
+ ::htmlparser::HtmlNode_obj::__Visit(HX_VISIT_ARG);
+}
+
+::hx::Val HtmlNodeElement_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"name") ) { return ::hx::Val( name ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"nodes") ) { return ::hx::Val( nodes ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"children") ) { return ::hx::Val( children ); }
+ if (HX_FIELD_EQ(inName,"addChild") ) { return ::hx::Val( addChild_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"attributes") ) { return ::hx::Val( attributes ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val HtmlNodeElement_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"name") ) { name=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"nodes") ) { nodes=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"children") ) { children=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"attributes") ) { attributes=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void HtmlNodeElement_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("name",4b,72,ff,48));
+ outFields->push(HX_("attributes",d7,a8,71,97));
+ outFields->push(HX_("nodes",31,b8,be,9f));
+ outFields->push(HX_("children",3f,19,6a,70));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo HtmlNodeElement_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(HtmlNodeElement_obj,name),HX_("name",4b,72,ff,48)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(HtmlNodeElement_obj,attributes),HX_("attributes",d7,a8,71,97)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(HtmlNodeElement_obj,nodes),HX_("nodes",31,b8,be,9f)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(HtmlNodeElement_obj,children),HX_("children",3f,19,6a,70)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *HtmlNodeElement_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String HtmlNodeElement_obj_sMemberFields[] = {
+ HX_("name",4b,72,ff,48),
+ HX_("attributes",d7,a8,71,97),
+ HX_("nodes",31,b8,be,9f),
+ HX_("children",3f,19,6a,70),
+ HX_("addChild",bb,cf,16,bf),
+ ::String(null()) };
+
+::hx::Class HtmlNodeElement_obj::__mClass;
+
+void HtmlNodeElement_obj::__register()
+{
+ HtmlNodeElement_obj _hx_dummy;
+ HtmlNodeElement_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("htmlparser.HtmlNodeElement",2b,19,23,54);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(HtmlNodeElement_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< HtmlNodeElement_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = HtmlNodeElement_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = HtmlNodeElement_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace htmlparser
diff --git a/Sources/c_snikket/src/htmlparser/HtmlNodeText.cpp b/Sources/c_snikket/src/htmlparser/HtmlNodeText.cpp
new file mode 100644
index 0000000..43c6ba6
--- /dev/null
+++ b/Sources/c_snikket/src/htmlparser/HtmlNodeText.cpp
@@ -0,0 +1,147 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_htmlparser_HtmlNode
+#include <htmlparser/HtmlNode.h>
+#endif
+#ifndef INCLUDED_htmlparser_HtmlNodeText
+#include <htmlparser/HtmlNodeText.h>
+#endif
+#ifndef INCLUDED_htmlparser_HtmlTools
+#include <htmlparser/HtmlTools.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_8a9116cd313e44a4_9_new,"htmlparser.HtmlNodeText","new",0xfdac7ed0,"htmlparser.HtmlNodeText.new","htmlparser/HtmlNodeText.hx",9,0xb3a973bf)
+HX_LOCAL_STACK_FRAME(_hx_pos_8a9116cd313e44a4_19_toText,"htmlparser.HtmlNodeText","toText",0xb9832f58,"htmlparser.HtmlNodeText.toText","htmlparser/HtmlNodeText.hx",19,0xb3a973bf)
+namespace htmlparser{
+
+void HtmlNodeText_obj::__construct(::String text){
+ HX_STACKFRAME(&_hx_pos_8a9116cd313e44a4_9_new)
+HXDLIN( 9) this->text = text;
+ }
+
+Dynamic HtmlNodeText_obj::__CreateEmpty() { return new HtmlNodeText_obj; }
+
+void *HtmlNodeText_obj::_hx_vtable = 0;
+
+Dynamic HtmlNodeText_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< HtmlNodeText_obj > _hx_result = new HtmlNodeText_obj();
+ _hx_result->__construct(inArgs[0]);
+ return _hx_result;
+}
+
+bool HtmlNodeText_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x0ca65a7f) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x0ca65a7f;
+ } else {
+ return inClassId==(int)0x699e2404;
+ }
+}
+
+::String HtmlNodeText_obj::toText(){
+ HX_STACKFRAME(&_hx_pos_8a9116cd313e44a4_19_toText)
+HXDLIN( 19) return ::htmlparser::HtmlTools_obj::unescape(this->text);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(HtmlNodeText_obj,toText,return )
+
+
+::hx::ObjectPtr< HtmlNodeText_obj > HtmlNodeText_obj::__new(::String text) {
+ ::hx::ObjectPtr< HtmlNodeText_obj > __this = new HtmlNodeText_obj();
+ __this->__construct(text);
+ return __this;
+}
+
+::hx::ObjectPtr< HtmlNodeText_obj > HtmlNodeText_obj::__alloc(::hx::Ctx *_hx_ctx,::String text) {
+ HtmlNodeText_obj *__this = (HtmlNodeText_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(HtmlNodeText_obj), true, "htmlparser.HtmlNodeText"));
+ *(void **)__this = HtmlNodeText_obj::_hx_vtable;
+ __this->__construct(text);
+ return __this;
+}
+
+HtmlNodeText_obj::HtmlNodeText_obj()
+{
+}
+
+void HtmlNodeText_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(HtmlNodeText);
+ HX_MARK_MEMBER_NAME(text,"text");
+ ::htmlparser::HtmlNode_obj::__Mark(HX_MARK_ARG);
+ HX_MARK_END_CLASS();
+}
+
+void HtmlNodeText_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(text,"text");
+ ::htmlparser::HtmlNode_obj::__Visit(HX_VISIT_ARG);
+}
+
+::hx::Val HtmlNodeText_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"text") ) { return ::hx::Val( text ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"toText") ) { return ::hx::Val( toText_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val HtmlNodeText_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"text") ) { text=inValue.Cast< ::String >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void HtmlNodeText_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("text",ad,cc,f9,4c));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo HtmlNodeText_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(HtmlNodeText_obj,text),HX_("text",ad,cc,f9,4c)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *HtmlNodeText_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String HtmlNodeText_obj_sMemberFields[] = {
+ HX_("text",ad,cc,f9,4c),
+ HX_("toText",c8,37,b3,82),
+ ::String(null()) };
+
+::hx::Class HtmlNodeText_obj::__mClass;
+
+void HtmlNodeText_obj::__register()
+{
+ HtmlNodeText_obj _hx_dummy;
+ HtmlNodeText_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("htmlparser.HtmlNodeText",de,16,b9,ea);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(HtmlNodeText_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< HtmlNodeText_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = HtmlNodeText_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = HtmlNodeText_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace htmlparser
diff --git a/Sources/c_snikket/src/htmlparser/HtmlParser.cpp b/Sources/c_snikket/src/htmlparser/HtmlParser.cpp
new file mode 100644
index 0000000..cbe42cb
--- /dev/null
+++ b/Sources/c_snikket/src/htmlparser/HtmlParser.cpp
@@ -0,0 +1,1128 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_EReg
+#include <EReg.h>
+#endif
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_htmlparser_HtmlAttribute
+#include <htmlparser/HtmlAttribute.h>
+#endif
+#ifndef INCLUDED_htmlparser_HtmlNode
+#include <htmlparser/HtmlNode.h>
+#endif
+#ifndef INCLUDED_htmlparser_HtmlNodeElement
+#include <htmlparser/HtmlNodeElement.h>
+#endif
+#ifndef INCLUDED_htmlparser_HtmlNodeText
+#include <htmlparser/HtmlNodeText.h>
+#endif
+#ifndef INCLUDED_htmlparser_HtmlParser
+#include <htmlparser/HtmlParser.h>
+#endif
+#ifndef INCLUDED_htmlparser_HtmlParserException
+#include <htmlparser/HtmlParserException.h>
+#endif
+#ifndef INCLUDED_htmlparser_HtmlTools
+#include <htmlparser/HtmlTools.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_8ccefc64b7335ec2_34_new,"htmlparser.HtmlParser","new",0x51fba620,"htmlparser.HtmlParser.new","htmlparser/HtmlParser.hx",34,0x7063d0af)
+HX_LOCAL_STACK_FRAME(_hx_pos_8ccefc64b7335ec2_37_parse,"htmlparser.HtmlParser","parse",0xa8ee55f3,"htmlparser.HtmlParser.parse","htmlparser/HtmlParser.hx",37,0x7063d0af)
+HX_LOCAL_STACK_FRAME(_hx_pos_8ccefc64b7335ec2_94_processMatches,"htmlparser.HtmlParser","processMatches",0xa35b0084,"htmlparser.HtmlParser.processMatches","htmlparser/HtmlParser.hx",94,0x7063d0af)
+HX_LOCAL_STACK_FRAME(_hx_pos_8ccefc64b7335ec2_168_parseElement,"htmlparser.HtmlParser","parseElement",0x4f3e7509,"htmlparser.HtmlParser.parseElement","htmlparser/HtmlParser.hx",168,0x7063d0af)
+HX_LOCAL_STACK_FRAME(_hx_pos_8ccefc64b7335ec2_200_isSelfClosingTag,"htmlparser.HtmlParser","isSelfClosingTag",0x64def8db,"htmlparser.HtmlParser.isSelfClosingTag","htmlparser/HtmlParser.hx",200,0x7063d0af)
+HX_LOCAL_STACK_FRAME(_hx_pos_8ccefc64b7335ec2_202_newElement,"htmlparser.HtmlParser","newElement",0x6359347c,"htmlparser.HtmlParser.newElement","htmlparser/HtmlParser.hx",202,0x7063d0af)
+HX_LOCAL_STACK_FRAME(_hx_pos_8ccefc64b7335ec2_239_getPosition,"htmlparser.HtmlParser","getPosition",0xd301f91f,"htmlparser.HtmlParser.getPosition","htmlparser/HtmlParser.hx",239,0x7063d0af)
+HX_LOCAL_STACK_FRAME(_hx_pos_8ccefc64b7335ec2_32_run,"htmlparser.HtmlParser","run",0x51febd0b,"htmlparser.HtmlParser.run","htmlparser/HtmlParser.hx",32,0x7063d0af)
+HX_LOCAL_STACK_FRAME(_hx_pos_8ccefc64b7335ec2_205_parseAttrs,"htmlparser.HtmlParser","parseAttrs",0x70c7172f,"htmlparser.HtmlParser.parseAttrs","htmlparser/HtmlParser.hx",205,0x7063d0af)
+HX_LOCAL_STACK_FRAME(_hx_pos_8ccefc64b7335ec2_9_boot,"htmlparser.HtmlParser","boot",0x624eb672,"htmlparser.HtmlParser.boot","htmlparser/HtmlParser.hx",9,0x7063d0af)
+HX_LOCAL_STACK_FRAME(_hx_pos_8ccefc64b7335ec2_11_boot,"htmlparser.HtmlParser","boot",0x624eb672,"htmlparser.HtmlParser.boot","htmlparser/HtmlParser.hx",11,0x7063d0af)
+HX_LOCAL_STACK_FRAME(_hx_pos_8ccefc64b7335ec2_12_boot,"htmlparser.HtmlParser","boot",0x624eb672,"htmlparser.HtmlParser.boot","htmlparser/HtmlParser.hx",12,0x7063d0af)
+HX_LOCAL_STACK_FRAME(_hx_pos_8ccefc64b7335ec2_14_boot,"htmlparser.HtmlParser","boot",0x624eb672,"htmlparser.HtmlParser.boot","htmlparser/HtmlParser.hx",14,0x7063d0af)
+HX_LOCAL_STACK_FRAME(_hx_pos_8ccefc64b7335ec2_15_boot,"htmlparser.HtmlParser","boot",0x624eb672,"htmlparser.HtmlParser.boot","htmlparser/HtmlParser.hx",15,0x7063d0af)
+HX_LOCAL_STACK_FRAME(_hx_pos_8ccefc64b7335ec2_16_boot,"htmlparser.HtmlParser","boot",0x624eb672,"htmlparser.HtmlParser.boot","htmlparser/HtmlParser.hx",16,0x7063d0af)
+HX_LOCAL_STACK_FRAME(_hx_pos_8ccefc64b7335ec2_17_boot,"htmlparser.HtmlParser","boot",0x624eb672,"htmlparser.HtmlParser.boot","htmlparser/HtmlParser.hx",17,0x7063d0af)
+HX_LOCAL_STACK_FRAME(_hx_pos_8ccefc64b7335ec2_18_boot,"htmlparser.HtmlParser","boot",0x624eb672,"htmlparser.HtmlParser.boot","htmlparser/HtmlParser.hx",18,0x7063d0af)
+HX_LOCAL_STACK_FRAME(_hx_pos_8ccefc64b7335ec2_19_boot,"htmlparser.HtmlParser","boot",0x624eb672,"htmlparser.HtmlParser.boot","htmlparser/HtmlParser.hx",19,0x7063d0af)
+HX_LOCAL_STACK_FRAME(_hx_pos_8ccefc64b7335ec2_20_boot,"htmlparser.HtmlParser","boot",0x624eb672,"htmlparser.HtmlParser.boot","htmlparser/HtmlParser.hx",20,0x7063d0af)
+HX_LOCAL_STACK_FRAME(_hx_pos_8ccefc64b7335ec2_21_boot,"htmlparser.HtmlParser","boot",0x624eb672,"htmlparser.HtmlParser.boot","htmlparser/HtmlParser.hx",21,0x7063d0af)
+HX_LOCAL_STACK_FRAME(_hx_pos_8ccefc64b7335ec2_23_boot,"htmlparser.HtmlParser","boot",0x624eb672,"htmlparser.HtmlParser.boot","htmlparser/HtmlParser.hx",23,0x7063d0af)
+HX_LOCAL_STACK_FRAME(_hx_pos_8ccefc64b7335ec2_25_boot,"htmlparser.HtmlParser","boot",0x624eb672,"htmlparser.HtmlParser.boot","htmlparser/HtmlParser.hx",25,0x7063d0af)
+namespace htmlparser{
+
+void HtmlParser_obj::__construct(){
+ HX_STACKFRAME(&_hx_pos_8ccefc64b7335ec2_34_new)
+ }
+
+Dynamic HtmlParser_obj::__CreateEmpty() { return new HtmlParser_obj; }
+
+void *HtmlParser_obj::_hx_vtable = 0;
+
+Dynamic HtmlParser_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< HtmlParser_obj > _hx_result = new HtmlParser_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool HtmlParser_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x0d37c69c;
+}
+
+::Array< ::Dynamic> HtmlParser_obj::parse(::String str,::hx::Null< bool > __o_tolerant){
+ bool tolerant = __o_tolerant.Default(false);
+ HX_GC_STACKFRAME(&_hx_pos_8ccefc64b7335ec2_37_parse)
+HXLINE( 38) this->tolerant = tolerant;
+HXLINE( 40) this->matches = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 41) int pos = 0;
+HXDLIN( 41) while(true){
+HXLINE( 41) bool _hx_tmp;
+HXDLIN( 41) if ((pos < str.length)) {
+HXLINE( 41) _hx_tmp = ::htmlparser::HtmlParser_obj::reMain->matchSub(str,pos,null());
+ }
+ else {
+HXLINE( 41) _hx_tmp = false;
+ }
+HXDLIN( 41) if (!(_hx_tmp)) {
+HXLINE( 41) goto _hx_goto_1;
+ }
+HXLINE( 43) ::Dynamic p = ::htmlparser::HtmlParser_obj::reMain->matchedPos();
+HXLINE( 44) ::EReg re = ::htmlparser::HtmlParser_obj::reMain;
+HXDLIN( 44) ::String cdata;
+HXDLIN( 44) try {
+ HX_STACK_CATCHABLE( ::Dynamic, 0);
+HXLINE( 44) cdata = re->matched(1);
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::Dynamic >() ){
+ HX_STACK_BEGIN_CATCH
+ ::Dynamic _g = _hx_e;
+HXLINE( 268) {
+HXLINE( 268) null();
+ }
+HXLINE( 44) cdata = null();
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+HXLINE( 45) bool _hx_tmp1;
+HXDLIN( 45) if (::hx::IsNotNull( cdata )) {
+HXLINE( 45) _hx_tmp1 = (cdata == HX_("",00,00,00,00));
+ }
+ else {
+HXLINE( 45) _hx_tmp1 = true;
+ }
+HXDLIN( 45) if (_hx_tmp1) {
+HXLINE( 49) ::String r = ::htmlparser::HtmlParser_obj::reMain->matched(0);
+HXLINE( 50) int p1 = ( (int)(p->__Field(HX_("pos",94,5d,55,00),::hx::paccDynamic)) );
+HXLINE( 52) ::EReg re1 = ::htmlparser::HtmlParser_obj::reMain;
+HXDLIN( 52) ::String r1;
+HXDLIN( 52) try {
+ HX_STACK_CATCHABLE( ::Dynamic, 0);
+HXLINE( 52) r1 = re1->matched(2);
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::Dynamic >() ){
+ HX_STACK_BEGIN_CATCH
+ ::Dynamic _g1 = _hx_e;
+HXLINE( 268) {
+HXLINE( 268) null();
+ }
+HXLINE( 52) r1 = null();
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+HXLINE( 53) ::EReg re2 = ::htmlparser::HtmlParser_obj::reMain;
+HXDLIN( 53) ::String r2;
+HXDLIN( 53) try {
+ HX_STACK_CATCHABLE( ::Dynamic, 0);
+HXLINE( 53) r2 = re2->matched(3);
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::Dynamic >() ){
+ HX_STACK_BEGIN_CATCH
+ ::Dynamic _g2 = _hx_e;
+HXLINE( 268) {
+HXLINE( 268) null();
+ }
+HXLINE( 53) r2 = null();
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+HXLINE( 54) ::EReg re3 = ::htmlparser::HtmlParser_obj::reMain;
+HXDLIN( 54) ::String r3;
+HXDLIN( 54) try {
+ HX_STACK_CATCHABLE( ::Dynamic, 0);
+HXLINE( 54) r3 = re3->matched(4);
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::Dynamic >() ){
+ HX_STACK_BEGIN_CATCH
+ ::Dynamic _g3 = _hx_e;
+HXLINE( 268) {
+HXLINE( 268) null();
+ }
+HXLINE( 54) r3 = null();
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+HXLINE( 55) ::EReg re4 = ::htmlparser::HtmlParser_obj::reMain;
+HXDLIN( 55) ::String r4;
+HXDLIN( 55) try {
+ HX_STACK_CATCHABLE( ::Dynamic, 0);
+HXLINE( 55) r4 = re4->matched(5);
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::Dynamic >() ){
+ HX_STACK_BEGIN_CATCH
+ ::Dynamic _g4 = _hx_e;
+HXLINE( 268) {
+HXLINE( 268) null();
+ }
+HXLINE( 55) r4 = null();
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+HXLINE( 56) ::EReg re5 = ::htmlparser::HtmlParser_obj::reMain;
+HXDLIN( 56) ::String r5;
+HXDLIN( 56) try {
+ HX_STACK_CATCHABLE( ::Dynamic, 0);
+HXLINE( 56) r5 = re5->matched(6);
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::Dynamic >() ){
+ HX_STACK_BEGIN_CATCH
+ ::Dynamic _g5 = _hx_e;
+HXLINE( 268) {
+HXLINE( 268) null();
+ }
+HXLINE( 56) r5 = null();
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+HXLINE( 57) ::EReg re6 = ::htmlparser::HtmlParser_obj::reMain;
+HXDLIN( 57) ::String r6;
+HXDLIN( 57) try {
+ HX_STACK_CATCHABLE( ::Dynamic, 0);
+HXLINE( 57) r6 = re6->matched(7);
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::Dynamic >() ){
+ HX_STACK_BEGIN_CATCH
+ ::Dynamic _g6 = _hx_e;
+HXLINE( 268) {
+HXLINE( 268) null();
+ }
+HXLINE( 57) r6 = null();
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+HXLINE( 58) ::EReg re7 = ::htmlparser::HtmlParser_obj::reMain;
+HXDLIN( 58) ::String r7;
+HXDLIN( 58) try {
+ HX_STACK_CATCHABLE( ::Dynamic, 0);
+HXLINE( 58) r7 = re7->matched(8);
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::Dynamic >() ){
+ HX_STACK_BEGIN_CATCH
+ ::Dynamic _g7 = _hx_e;
+HXLINE( 268) {
+HXLINE( 268) null();
+ }
+HXLINE( 58) r7 = null();
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+HXLINE( 59) ::EReg re8 = ::htmlparser::HtmlParser_obj::reMain;
+HXDLIN( 59) ::String r8;
+HXDLIN( 59) try {
+ HX_STACK_CATCHABLE( ::Dynamic, 0);
+HXLINE( 59) r8 = re8->matched(9);
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::Dynamic >() ){
+ HX_STACK_BEGIN_CATCH
+ ::Dynamic _g8 = _hx_e;
+HXLINE( 268) {
+HXLINE( 268) null();
+ }
+HXLINE( 59) r8 = null();
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+HXLINE( 60) ::EReg re9 = ::htmlparser::HtmlParser_obj::reMain;
+HXDLIN( 60) ::String r9;
+HXDLIN( 60) try {
+ HX_STACK_CATCHABLE( ::Dynamic, 0);
+HXLINE( 60) r9 = re9->matched(10);
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::Dynamic >() ){
+ HX_STACK_BEGIN_CATCH
+ ::Dynamic _g9 = _hx_e;
+HXLINE( 268) {
+HXLINE( 268) null();
+ }
+HXLINE( 60) r9 = null();
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+HXLINE( 61) ::EReg re10 = ::htmlparser::HtmlParser_obj::reMain;
+HXDLIN( 61) ::String r10;
+HXDLIN( 61) try {
+ HX_STACK_CATCHABLE( ::Dynamic, 0);
+HXLINE( 61) r10 = re10->matched(11);
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::Dynamic >() ){
+ HX_STACK_BEGIN_CATCH
+ ::Dynamic _g10 = _hx_e;
+HXLINE( 268) {
+HXLINE( 268) null();
+ }
+HXLINE( 61) r10 = null();
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+HXLINE( 62) ::EReg re11 = ::htmlparser::HtmlParser_obj::reMain;
+HXDLIN( 62) ::String r11;
+HXDLIN( 62) try {
+ HX_STACK_CATCHABLE( ::Dynamic, 0);
+HXLINE( 62) r11 = re11->matched(12);
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::Dynamic >() ){
+ HX_STACK_BEGIN_CATCH
+ ::Dynamic _g11 = _hx_e;
+HXLINE( 268) {
+HXLINE( 268) null();
+ }
+HXLINE( 62) r11 = null();
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+HXLINE( 63) ::EReg re12 = ::htmlparser::HtmlParser_obj::reMain;
+HXDLIN( 63) ::String r12;
+HXDLIN( 63) try {
+ HX_STACK_CATCHABLE( ::Dynamic, 0);
+HXLINE( 63) r12 = re12->matched(13);
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::Dynamic >() ){
+ HX_STACK_BEGIN_CATCH
+ ::Dynamic _g12 = _hx_e;
+HXLINE( 268) {
+HXLINE( 268) null();
+ }
+HXLINE( 63) r12 = null();
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+HXLINE( 64) ::EReg re13 = ::htmlparser::HtmlParser_obj::reMain;
+HXDLIN( 64) ::String r13;
+HXDLIN( 64) try {
+ HX_STACK_CATCHABLE( ::Dynamic, 0);
+HXLINE( 64) r13 = re13->matched(14);
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::Dynamic >() ){
+ HX_STACK_BEGIN_CATCH
+ ::Dynamic _g13 = _hx_e;
+HXLINE( 268) {
+HXLINE( 268) null();
+ }
+HXLINE( 64) r13 = null();
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+HXLINE( 47) ::Dynamic r14 = ::Dynamic(::hx::Anon_obj::Create(17)
+ ->setFixed(0,HX_("comment",5f,7a,70,81),r13)
+ ->setFixed(1,HX_("style",31,a5,1d,84),r4)
+ ->setFixed(2,HX_("styleAttrs",31,c7,d9,a6),r5)
+ ->setFixed(3,HX_("tagClose",fe,66,d0,b6),r12)
+ ->setFixed(4,HX_("styleText",7e,8a,c9,e2),r6)
+ ->setFixed(5,HX_("scriptAttrs",17,c8,c2,f2),r2)
+ ->setFixed(6,HX_("all",21,f9,49,00),r)
+ ->setFixed(7,HX_("tagOpen",44,bf,2a,23),r8)
+ ->setFixed(8,HX_("attrs",22,6e,e3,26),r9)
+ ->setFixed(9,HX_("allPos",f3,c6,84,3f),p1)
+ ->setFixed(10,HX_("elem",8f,d8,14,43),r7)
+ ->setFixed(11,HX_("scriptText",58,a8,da,45),r3)
+ ->setFixed(12,HX_("script",0b,4e,60,47),r1)
+ ->setFixed(13,HX_("close",b8,17,63,48),r11)
+ ->setFixed(14,HX_("tagOpenLC",bb,5a,cc,52),null())
+ ->setFixed(15,HX_("tagCloseLC",f5,e4,f6,58),null())
+ ->setFixed(16,HX_("tagEnd",a1,d5,8d,7f),r10));
+HXLINE( 70) if (::hx::IsNotNull( r14->__Field(HX_("tagOpen",44,bf,2a,23),::hx::paccDynamic) )) {
+HXLINE( 70) r14->__SetField(HX_("tagOpenLC",bb,5a,cc,52),( (::String)(r14->__Field(HX_("tagOpen",44,bf,2a,23),::hx::paccDynamic)) ).toLowerCase(),::hx::paccDynamic);
+ }
+HXLINE( 71) if (::hx::IsNotNull( r14->__Field(HX_("tagClose",fe,66,d0,b6),::hx::paccDynamic) )) {
+HXLINE( 71) r14->__SetField(HX_("tagCloseLC",f5,e4,f6,58),( (::String)(r14->__Field(HX_("tagClose",fe,66,d0,b6),::hx::paccDynamic)) ).toLowerCase(),::hx::paccDynamic);
+ }
+HXLINE( 73) this->matches->push(r14);
+ }
+HXLINE( 75) pos = ( (int)((p->__Field(HX_("pos",94,5d,55,00),::hx::paccDynamic) + p->__Field(HX_("len",d5,4b,52,00),::hx::paccDynamic))) );
+ }
+ _hx_goto_1:;
+HXLINE( 78) if ((this->matches->length > 0)) {
+HXLINE( 80) this->str = str;
+HXLINE( 81) this->i = 0;
+HXLINE( 82) ::Array< ::Dynamic> nodes = ( (::Array< ::Dynamic>)(this->processMatches(::Array_obj< ::String >::__new(0))->__Field(HX_("nodes",31,b8,be,9f),::hx::paccDynamic)) );
+HXLINE( 83) if ((this->i < this->matches->length)) {
+HXLINE( 85) HX_STACK_DO_THROW( ::htmlparser::HtmlParserException_obj::__alloc( HX_CTX ,HX_("Not all nodes processed.",9b,bd,31,84),this->getPosition(this->i)));
+ }
+HXLINE( 87) return nodes;
+ }
+HXLINE( 90) if ((str.length > 0)) {
+HXLINE( 90) return ::Array_obj< ::Dynamic>::__new(1)->init(0, ::htmlparser::HtmlNodeText_obj::__alloc( HX_CTX ,str));
+ }
+ else {
+HXLINE( 90) return ::Array_obj< ::Dynamic>::__new(0);
+ }
+HXDLIN( 90) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(HtmlParser_obj,parse,return )
+
+ ::Dynamic HtmlParser_obj::processMatches(::Array< ::String > openedTagsLC){
+ HX_GC_STACKFRAME(&_hx_pos_8ccefc64b7335ec2_94_processMatches)
+HXLINE( 95) ::Array< ::Dynamic> nodes = ::Array_obj< ::Dynamic>::__new();
+HXLINE( 97) int prevEnd;
+HXDLIN( 97) if ((this->i > 0)) {
+HXLINE( 97) prevEnd = ( (int)((this->matches->__get((this->i - 1))->__Field(HX_("allPos",f3,c6,84,3f),::hx::paccDynamic) + ( (::String)(this->matches->__get((this->i - 1))->__Field(HX_("all",21,f9,49,00),::hx::paccDynamic)) ).length)) );
+ }
+ else {
+HXLINE( 97) prevEnd = 0;
+ }
+HXLINE( 98) int curStart = ( (int)(this->matches->__get(this->i)->__Field(HX_("allPos",f3,c6,84,3f),::hx::paccDynamic)) );
+HXLINE( 100) if ((prevEnd < curStart)) {
+HXLINE( 102) nodes->push( ::htmlparser::HtmlNodeText_obj::__alloc( HX_CTX ,this->str.substr(prevEnd,(curStart - prevEnd))));
+ }
+HXLINE( 105) while((this->i < this->matches->length)){
+HXLINE( 107) ::Dynamic m = this->matches->__get(this->i);
+HXLINE( 109) bool _hx_tmp;
+HXDLIN( 109) if (::hx::IsNotNull( m->__Field(HX_("elem",8f,d8,14,43),::hx::paccDynamic) )) {
+HXLINE( 109) _hx_tmp = ::hx::IsNotEq( m->__Field(HX_("elem",8f,d8,14,43),::hx::paccDynamic),HX_("",00,00,00,00) );
+ }
+ else {
+HXLINE( 109) _hx_tmp = false;
+ }
+HXDLIN( 109) if (_hx_tmp) {
+HXLINE( 111) ::Dynamic ee = this->parseElement(openedTagsLC);
+HXLINE( 112) nodes->push( ::Dynamic(ee->__Field(HX_("element",bc,ae,54,06),::hx::paccDynamic)));
+HXLINE( 113) if (::hx::IsNotEq( ee->__Field(HX_("closeTagLC",79,c4,c8,d5),::hx::paccDynamic),HX_("",00,00,00,00) )) {
+HXLINE( 113) return ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("nodes",31,b8,be,9f),nodes)
+ ->setFixed(1,HX_("closeTagLC",79,c4,c8,d5), ::Dynamic(ee->__Field(HX_("closeTagLC",79,c4,c8,d5),::hx::paccDynamic))));
+ }
+ }
+ else {
+HXLINE( 116) bool _hx_tmp1;
+HXDLIN( 116) if (::hx::IsNotNull( m->__Field(HX_("script",0b,4e,60,47),::hx::paccDynamic) )) {
+HXLINE( 116) _hx_tmp1 = ::hx::IsNotEq( m->__Field(HX_("script",0b,4e,60,47),::hx::paccDynamic),HX_("",00,00,00,00) );
+ }
+ else {
+HXLINE( 116) _hx_tmp1 = false;
+ }
+HXDLIN( 116) if (_hx_tmp1) {
+HXLINE( 118) ::htmlparser::HtmlNodeElement scriptNode = this->newElement(HX_("script",0b,4e,60,47),::htmlparser::HtmlParser_obj::parseAttrs(( (::String)(m->__Field(HX_("scriptAttrs",17,c8,c2,f2),::hx::paccDynamic)) )));
+HXLINE( 119) scriptNode->addChild( ::htmlparser::HtmlNodeText_obj::__alloc( HX_CTX ,( (::String)(m->__Field(HX_("scriptText",58,a8,da,45),::hx::paccDynamic)) )),null());
+HXLINE( 120) nodes->push(scriptNode);
+ }
+ else {
+HXLINE( 123) bool _hx_tmp2;
+HXDLIN( 123) if (::hx::IsNotNull( m->__Field(HX_("style",31,a5,1d,84),::hx::paccDynamic) )) {
+HXLINE( 123) _hx_tmp2 = ::hx::IsNotEq( m->__Field(HX_("style",31,a5,1d,84),::hx::paccDynamic),HX_("",00,00,00,00) );
+ }
+ else {
+HXLINE( 123) _hx_tmp2 = false;
+ }
+HXDLIN( 123) if (_hx_tmp2) {
+HXLINE( 125) ::htmlparser::HtmlNodeElement styleNode = this->newElement(HX_("style",31,a5,1d,84),::htmlparser::HtmlParser_obj::parseAttrs(( (::String)(m->__Field(HX_("styleAttrs",31,c7,d9,a6),::hx::paccDynamic)) )));
+HXLINE( 126) styleNode->addChild( ::htmlparser::HtmlNodeText_obj::__alloc( HX_CTX ,( (::String)(m->__Field(HX_("styleText",7e,8a,c9,e2),::hx::paccDynamic)) )),null());
+HXLINE( 127) nodes->push(styleNode);
+ }
+ else {
+HXLINE( 130) bool _hx_tmp3;
+HXDLIN( 130) if (::hx::IsNotNull( m->__Field(HX_("close",b8,17,63,48),::hx::paccDynamic) )) {
+HXLINE( 130) _hx_tmp3 = ::hx::IsNotEq( m->__Field(HX_("close",b8,17,63,48),::hx::paccDynamic),HX_("",00,00,00,00) );
+ }
+ else {
+HXLINE( 130) _hx_tmp3 = false;
+ }
+HXDLIN( 130) if (_hx_tmp3) {
+HXLINE( 132) if (::hx::IsEq( m->__Field(HX_("tagCloseLC",f5,e4,f6,58),::hx::paccDynamic),openedTagsLC->__get((openedTagsLC->length - 1)) )) {
+HXLINE( 132) goto _hx_goto_3;
+ }
+HXLINE( 133) if (this->tolerant) {
+HXLINE( 135) if ((openedTagsLC->lastIndexOf( ::Dynamic(m->__Field(HX_("tagCloseLC",f5,e4,f6,58),::hx::paccDynamic)),null()) >= 0)) {
+HXLINE( 135) goto _hx_goto_3;
+ }
+ }
+ else {
+HXLINE( 139) ::String _hx_tmp4 = ( (::String)(((((HX_("Closed tag <",a2,4b,47,5b) + m->__Field(HX_("tagClose",fe,66,d0,b6),::hx::paccDynamic)) + HX_("> don't match to open tag <",b8,7f,a8,03)) + openedTagsLC->__get((openedTagsLC->length - 1))) + HX_(">.",30,36,00,00))) );
+HXDLIN( 139) HX_STACK_DO_THROW( ::htmlparser::HtmlParserException_obj::__alloc( HX_CTX ,_hx_tmp4,this->getPosition(this->i)));
+ }
+ }
+ else {
+HXLINE( 143) bool _hx_tmp5;
+HXDLIN( 143) if (::hx::IsNotNull( m->__Field(HX_("comment",5f,7a,70,81),::hx::paccDynamic) )) {
+HXLINE( 143) _hx_tmp5 = ::hx::IsNotEq( m->__Field(HX_("comment",5f,7a,70,81),::hx::paccDynamic),HX_("",00,00,00,00) );
+ }
+ else {
+HXLINE( 143) _hx_tmp5 = false;
+ }
+HXDLIN( 143) if (_hx_tmp5) {
+HXLINE( 145) nodes->push( ::htmlparser::HtmlNodeText_obj::__alloc( HX_CTX ,( (::String)(m->__Field(HX_("comment",5f,7a,70,81),::hx::paccDynamic)) )));
+ }
+ else {
+HXLINE( 149) HX_STACK_DO_THROW( ::htmlparser::HtmlParserException_obj::__alloc( HX_CTX ,HX_("Unexpected XML node.",d4,3d,c2,6a),this->getPosition(this->i)));
+ }
+ }
+ }
+ }
+ }
+HXLINE( 152) bool _hx_tmp6;
+HXDLIN( 152) if (this->tolerant) {
+HXLINE( 152) _hx_tmp6 = (this->i >= this->matches->length);
+ }
+ else {
+HXLINE( 152) _hx_tmp6 = false;
+ }
+HXDLIN( 152) if (_hx_tmp6) {
+HXLINE( 152) goto _hx_goto_3;
+ }
+HXLINE( 154) int curEnd = ( (int)((this->matches->__get(this->i)->__Field(HX_("allPos",f3,c6,84,3f),::hx::paccDynamic) + ( (::String)(this->matches->__get(this->i)->__Field(HX_("all",21,f9,49,00),::hx::paccDynamic)) ).length)) );
+HXLINE( 155) int nextStart;
+HXDLIN( 155) if (((this->i + 1) < this->matches->length)) {
+HXLINE( 155) nextStart = ( (int)(this->matches->__get((this->i + 1))->__Field(HX_("allPos",f3,c6,84,3f),::hx::paccDynamic)) );
+ }
+ else {
+HXLINE( 155) nextStart = this->str.length;
+ }
+HXLINE( 156) if ((curEnd < nextStart)) {
+HXLINE( 158) nodes->push( ::htmlparser::HtmlNodeText_obj::__alloc( HX_CTX ,this->str.substr(curEnd,(nextStart - curEnd))));
+ }
+HXLINE( 161) this->i++;
+ }
+ _hx_goto_3:;
+HXLINE( 164) return ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("nodes",31,b8,be,9f),nodes)
+ ->setFixed(1,HX_("closeTagLC",79,c4,c8,d5),HX_("",00,00,00,00)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(HtmlParser_obj,processMatches,return )
+
+ ::Dynamic HtmlParser_obj::parseElement(::Array< ::String > openedTagsLC){
+ HX_GC_STACKFRAME(&_hx_pos_8ccefc64b7335ec2_168_parseElement)
+HXLINE( 169) ::String tag = ( (::String)(this->matches->__get(this->i)->__Field(HX_("tagOpen",44,bf,2a,23),::hx::paccDynamic)) );
+HXLINE( 170) ::String tagLC = ( (::String)(this->matches->__get(this->i)->__Field(HX_("tagOpenLC",bb,5a,cc,52),::hx::paccDynamic)) );
+HXLINE( 171) ::String attrs = ( (::String)(this->matches->__get(this->i)->__Field(HX_("attrs",22,6e,e3,26),::hx::paccDynamic)) );
+HXLINE( 172) bool isWithClose;
+HXDLIN( 172) bool isWithClose1;
+HXDLIN( 172) if (::hx::IsNotNull( this->matches->__get(this->i)->__Field(HX_("tagEnd",a1,d5,8d,7f),::hx::paccDynamic) )) {
+HXLINE( 172) isWithClose1 = ::hx::IsNotEq( this->matches->__get(this->i)->__Field(HX_("tagEnd",a1,d5,8d,7f),::hx::paccDynamic),HX_("",00,00,00,00) );
+ }
+ else {
+HXLINE( 172) isWithClose1 = false;
+ }
+HXDLIN( 172) if (!(isWithClose1)) {
+HXLINE( 172) isWithClose = this->isSelfClosingTag(tagLC);
+ }
+ else {
+HXLINE( 172) isWithClose = true;
+ }
+HXLINE( 174) ::htmlparser::HtmlNodeElement elem = this->newElement(tag,::htmlparser::HtmlParser_obj::parseAttrs(attrs));
+HXLINE( 175) ::String closeTagLC = HX_("",00,00,00,00);
+HXLINE( 176) if (!(isWithClose)) {
+HXLINE( 178) this->i++;
+HXLINE( 180) openedTagsLC->push(tagLC);
+HXLINE( 181) ::Dynamic m = this->processMatches(openedTagsLC);
+HXLINE( 182) {
+HXLINE( 182) int _g = 0;
+HXDLIN( 182) ::Array< ::Dynamic> _g1 = ( (::Array< ::Dynamic>)(m->__Field(HX_("nodes",31,b8,be,9f),::hx::paccDynamic)) );
+HXDLIN( 182) while((_g < _g1->length)){
+HXLINE( 182) ::htmlparser::HtmlNode node = _g1->__get(_g).StaticCast< ::htmlparser::HtmlNode >();
+HXDLIN( 182) _g = (_g + 1);
+HXDLIN( 182) elem->addChild(node,null());
+ }
+ }
+HXLINE( 183) openedTagsLC->pop();
+HXLINE( 185) if (::hx::IsNotEq( m->__Field(HX_("closeTagLC",79,c4,c8,d5),::hx::paccDynamic),tagLC )) {
+HXLINE( 185) closeTagLC = ( (::String)(m->__Field(HX_("closeTagLC",79,c4,c8,d5),::hx::paccDynamic)) );
+ }
+ else {
+HXLINE( 185) closeTagLC = HX_("",00,00,00,00);
+ }
+HXLINE( 187) bool _hx_tmp;
+HXDLIN( 187) if ((this->i >= this->matches->length)) {
+HXLINE( 187) _hx_tmp = !(this->tolerant);
+ }
+ else {
+HXLINE( 187) _hx_tmp = true;
+ }
+HXDLIN( 187) if (_hx_tmp) {
+HXLINE( 189) bool _hx_tmp1;
+HXDLIN( 189) bool _hx_tmp2;
+HXDLIN( 189) if (::hx::IsNotNull( this->matches->__get(this->i)->__Field(HX_("close",b8,17,63,48),::hx::paccDynamic) )) {
+HXLINE( 189) _hx_tmp2 = ::hx::IsEq( this->matches->__get(this->i)->__Field(HX_("close",b8,17,63,48),::hx::paccDynamic),HX_("",00,00,00,00) );
+ }
+ else {
+HXLINE( 189) _hx_tmp2 = true;
+ }
+HXDLIN( 189) if (!(_hx_tmp2)) {
+HXLINE( 189) _hx_tmp1 = ::hx::IsNotEq( this->matches->__get(this->i)->__Field(HX_("tagCloseLC",f5,e4,f6,58),::hx::paccDynamic),tagLC );
+ }
+ else {
+HXLINE( 189) _hx_tmp1 = true;
+ }
+HXDLIN( 189) if (_hx_tmp1) {
+HXLINE( 191) if (!(this->tolerant)) {
+HXLINE( 191) HX_STACK_DO_THROW( ::htmlparser::HtmlParserException_obj::__alloc( HX_CTX ,((HX_("Tag <",d6,b0,14,9e) + tag) + HX_("> not closed.",13,ce,3c,11)),this->getPosition(this->i)));
+ }
+ else {
+HXLINE( 192) closeTagLC = ( (::String)(this->matches->__get(this->i)->__Field(HX_("tagCloseLC",f5,e4,f6,58),::hx::paccDynamic)) );
+ }
+ }
+ }
+ }
+HXLINE( 197) return ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("closeTagLC",79,c4,c8,d5),closeTagLC)
+ ->setFixed(1,HX_("element",bc,ae,54,06),elem));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(HtmlParser_obj,parseElement,return )
+
+bool HtmlParser_obj::isSelfClosingTag(::String tag){
+ HX_STACKFRAME(&_hx_pos_8ccefc64b7335ec2_200_isSelfClosingTag)
+HXDLIN( 200) return ::Reflect_obj::hasField(::htmlparser::HtmlParser_obj::SELF_CLOSING_TAGS_HTML,tag);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(HtmlParser_obj,isSelfClosingTag,return )
+
+ ::htmlparser::HtmlNodeElement HtmlParser_obj::newElement(::String name,::Array< ::Dynamic> attributes){
+ HX_GC_STACKFRAME(&_hx_pos_8ccefc64b7335ec2_202_newElement)
+HXDLIN( 202) return ::htmlparser::HtmlNodeElement_obj::__alloc( HX_CTX ,name,attributes);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(HtmlParser_obj,newElement,return )
+
+ ::Dynamic HtmlParser_obj::getPosition(int matchIndex){
+ HX_STACKFRAME(&_hx_pos_8ccefc64b7335ec2_239_getPosition)
+HXLINE( 240) ::Dynamic m = this->matches->__get(matchIndex);
+HXLINE( 241) int line = 1;
+HXLINE( 242) int lastNewLinePos = -1;
+HXLINE( 243) int i = 0;
+HXDLIN( 243) while(::hx::IsLess( i,m->__Field(HX_("allPos",f3,c6,84,3f),::hx::paccDynamic) )){
+HXLINE( 245) ::String chars;
+HXDLIN( 245) if (((i + 1) < this->str.length)) {
+HXLINE( 245) chars = this->str.substring(i,(i + 2));
+ }
+ else {
+HXLINE( 245) chars = this->str.charAt(i);
+ }
+HXLINE( 246) if ((chars == HX_("\r\n",5d,0b,00,00))) {
+HXLINE( 248) i = (i + 2);
+HXLINE( 249) lastNewLinePos = i;
+HXLINE( 250) line = (line + 1);
+ }
+ else {
+HXLINE( 253) bool _hx_tmp;
+HXDLIN( 253) if ((chars.charAt(0) != HX_("\n",0a,00,00,00))) {
+HXLINE( 253) _hx_tmp = (chars.charAt(0) == HX_("\r",0d,00,00,00));
+ }
+ else {
+HXLINE( 253) _hx_tmp = true;
+ }
+HXDLIN( 253) if (_hx_tmp) {
+HXLINE( 255) i = (i + 1);
+HXLINE( 256) lastNewLinePos = i;
+HXLINE( 257) line = (line + 1);
+ }
+ else {
+HXLINE( 261) i = (i + 1);
+ }
+ }
+ }
+HXLINE( 265) return ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("length",e6,94,07,9f),( (::String)(m->__Field(HX_("all",21,f9,49,00),::hx::paccDynamic)) ).length)
+ ->setFixed(1,HX_("column",d6,4e,8b,c6),(( (int)(m->__Field(HX_("allPos",f3,c6,84,3f),::hx::paccDynamic)) ) - lastNewLinePos))
+ ->setFixed(2,HX_("line",f4,17,b3,47),line));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(HtmlParser_obj,getPosition,return )
+
+ ::Dynamic HtmlParser_obj::SELF_CLOSING_TAGS_HTML;
+
+::String HtmlParser_obj::reID;
+
+::String HtmlParser_obj::reNamespacedID;
+
+::String HtmlParser_obj::reCDATA;
+
+::String HtmlParser_obj::reScript;
+
+::String HtmlParser_obj::reStyle;
+
+::String HtmlParser_obj::reElementOpen;
+
+::String HtmlParser_obj::reAttr;
+
+::String HtmlParser_obj::reElementEnd;
+
+::String HtmlParser_obj::reElementClose;
+
+::String HtmlParser_obj::reComment;
+
+ ::EReg HtmlParser_obj::reMain;
+
+ ::EReg HtmlParser_obj::reParseAttrs;
+
+::Array< ::Dynamic> HtmlParser_obj::run(::String str,::hx::Null< bool > __o_tolerant){
+ bool tolerant = __o_tolerant.Default(false);
+ HX_GC_STACKFRAME(&_hx_pos_8ccefc64b7335ec2_32_run)
+HXDLIN( 32) return ::htmlparser::HtmlParser_obj::__alloc( HX_CTX )->parse(str,tolerant);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(HtmlParser_obj,run,return )
+
+::Array< ::Dynamic> HtmlParser_obj::parseAttrs(::String str){
+ HX_GC_STACKFRAME(&_hx_pos_8ccefc64b7335ec2_205_parseAttrs)
+HXLINE( 206) ::Array< ::Dynamic> attributes = ::Array_obj< ::Dynamic>::__new();
+HXLINE( 208) int pos = 0;
+HXDLIN( 208) while(true){
+HXLINE( 208) bool _hx_tmp;
+HXDLIN( 208) if ((pos < str.length)) {
+HXLINE( 208) _hx_tmp = ::htmlparser::HtmlParser_obj::reParseAttrs->matchSub(str,pos,null());
+ }
+ else {
+HXLINE( 208) _hx_tmp = false;
+ }
+HXDLIN( 208) if (!(_hx_tmp)) {
+HXLINE( 208) goto _hx_goto_12;
+ }
+HXLINE( 210) ::String name = ::htmlparser::HtmlParser_obj::reParseAttrs->matched(1);
+HXLINE( 211) ::String value = ::htmlparser::HtmlParser_obj::reParseAttrs->matched(2);
+HXLINE( 213) ::String quote = null();
+HXLINE( 214) ::String unescaped = null();
+HXLINE( 215) if (::hx::IsNotNull( value )) {
+HXLINE( 217) quote = value.substr(0,1);
+HXLINE( 218) bool _hx_tmp1;
+HXDLIN( 218) if ((quote != HX_("\"",22,00,00,00))) {
+HXLINE( 218) _hx_tmp1 = (quote == HX_("'",27,00,00,00));
+ }
+ else {
+HXLINE( 218) _hx_tmp1 = true;
+ }
+HXDLIN( 218) if (_hx_tmp1) {
+HXLINE( 220) value = value.substr(1,(value.length - 2));
+ }
+ else {
+HXLINE( 224) quote = HX_("",00,00,00,00);
+ }
+HXLINE( 226) unescaped = ::htmlparser::HtmlTools_obj::unescape(value);
+ }
+HXLINE( 229) attributes->push( ::htmlparser::HtmlAttribute_obj::__alloc( HX_CTX ,name,unescaped,quote));
+HXLINE( 231) ::Dynamic p = ::htmlparser::HtmlParser_obj::reParseAttrs->matchedPos();
+HXLINE( 232) pos = ( (int)((p->__Field(HX_("pos",94,5d,55,00),::hx::paccDynamic) + p->__Field(HX_("len",d5,4b,52,00),::hx::paccDynamic))) );
+ }
+ _hx_goto_12:;
+HXLINE( 235) return attributes;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(HtmlParser_obj,parseAttrs,return )
+
+
+::hx::ObjectPtr< HtmlParser_obj > HtmlParser_obj::__new() {
+ ::hx::ObjectPtr< HtmlParser_obj > __this = new HtmlParser_obj();
+ __this->__construct();
+ return __this;
+}
+
+::hx::ObjectPtr< HtmlParser_obj > HtmlParser_obj::__alloc(::hx::Ctx *_hx_ctx) {
+ HtmlParser_obj *__this = (HtmlParser_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(HtmlParser_obj), true, "htmlparser.HtmlParser"));
+ *(void **)__this = HtmlParser_obj::_hx_vtable;
+ __this->__construct();
+ return __this;
+}
+
+HtmlParser_obj::HtmlParser_obj()
+{
+}
+
+void HtmlParser_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(HtmlParser);
+ HX_MARK_MEMBER_NAME(tolerant,"tolerant");
+ HX_MARK_MEMBER_NAME(matches,"matches");
+ HX_MARK_MEMBER_NAME(str,"str");
+ HX_MARK_MEMBER_NAME(i,"i");
+ HX_MARK_END_CLASS();
+}
+
+void HtmlParser_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(tolerant,"tolerant");
+ HX_VISIT_MEMBER_NAME(matches,"matches");
+ HX_VISIT_MEMBER_NAME(str,"str");
+ HX_VISIT_MEMBER_NAME(i,"i");
+}
+
+::hx::Val HtmlParser_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 1:
+ if (HX_FIELD_EQ(inName,"i") ) { return ::hx::Val( i ); }
+ break;
+ case 3:
+ if (HX_FIELD_EQ(inName,"str") ) { return ::hx::Val( str ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"parse") ) { return ::hx::Val( parse_dyn() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"matches") ) { return ::hx::Val( matches ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"tolerant") ) { return ::hx::Val( tolerant ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"newElement") ) { return ::hx::Val( newElement_dyn() ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"getPosition") ) { return ::hx::Val( getPosition_dyn() ); }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"parseElement") ) { return ::hx::Val( parseElement_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"processMatches") ) { return ::hx::Val( processMatches_dyn() ); }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"isSelfClosingTag") ) { return ::hx::Val( isSelfClosingTag_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool HtmlParser_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"run") ) { outValue = run_dyn(); return true; }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"reID") ) { outValue = ( reID ); return true; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"reAttr") ) { outValue = ( reAttr ); return true; }
+ if (HX_FIELD_EQ(inName,"reMain") ) { outValue = ( reMain ); return true; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"reCDATA") ) { outValue = ( reCDATA ); return true; }
+ if (HX_FIELD_EQ(inName,"reStyle") ) { outValue = ( reStyle ); return true; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"reScript") ) { outValue = ( reScript ); return true; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"reComment") ) { outValue = ( reComment ); return true; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"parseAttrs") ) { outValue = parseAttrs_dyn(); return true; }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"reElementEnd") ) { outValue = ( reElementEnd ); return true; }
+ if (HX_FIELD_EQ(inName,"reParseAttrs") ) { outValue = ( reParseAttrs ); return true; }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"reElementOpen") ) { outValue = ( reElementOpen ); return true; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"reNamespacedID") ) { outValue = ( reNamespacedID ); return true; }
+ if (HX_FIELD_EQ(inName,"reElementClose") ) { outValue = ( reElementClose ); return true; }
+ break;
+ case 22:
+ if (HX_FIELD_EQ(inName,"SELF_CLOSING_TAGS_HTML") ) { outValue = ( SELF_CLOSING_TAGS_HTML ); return true; }
+ }
+ return false;
+}
+
+::hx::Val HtmlParser_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 1:
+ if (HX_FIELD_EQ(inName,"i") ) { i=inValue.Cast< int >(); return inValue; }
+ break;
+ case 3:
+ if (HX_FIELD_EQ(inName,"str") ) { str=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"matches") ) { matches=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"tolerant") ) { tolerant=inValue.Cast< bool >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+bool HtmlParser_obj::__SetStatic(const ::String &inName,Dynamic &ioValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"reID") ) { reID=ioValue.Cast< ::String >(); return true; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"reAttr") ) { reAttr=ioValue.Cast< ::String >(); return true; }
+ if (HX_FIELD_EQ(inName,"reMain") ) { reMain=ioValue.Cast< ::EReg >(); return true; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"reCDATA") ) { reCDATA=ioValue.Cast< ::String >(); return true; }
+ if (HX_FIELD_EQ(inName,"reStyle") ) { reStyle=ioValue.Cast< ::String >(); return true; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"reScript") ) { reScript=ioValue.Cast< ::String >(); return true; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"reComment") ) { reComment=ioValue.Cast< ::String >(); return true; }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"reElementEnd") ) { reElementEnd=ioValue.Cast< ::String >(); return true; }
+ if (HX_FIELD_EQ(inName,"reParseAttrs") ) { reParseAttrs=ioValue.Cast< ::EReg >(); return true; }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"reElementOpen") ) { reElementOpen=ioValue.Cast< ::String >(); return true; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"reNamespacedID") ) { reNamespacedID=ioValue.Cast< ::String >(); return true; }
+ if (HX_FIELD_EQ(inName,"reElementClose") ) { reElementClose=ioValue.Cast< ::String >(); return true; }
+ break;
+ case 22:
+ if (HX_FIELD_EQ(inName,"SELF_CLOSING_TAGS_HTML") ) { SELF_CLOSING_TAGS_HTML=ioValue.Cast< ::Dynamic >(); return true; }
+ }
+ return false;
+}
+
+void HtmlParser_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("tolerant",69,10,52,94));
+ outFields->push(HX_("matches",f3,3c,7c,89));
+ outFields->push(HX_("str",b1,a8,57,00));
+ outFields->push(HX_("i",69,00,00,00));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo HtmlParser_obj_sMemberStorageInfo[] = {
+ {::hx::fsBool,(int)offsetof(HtmlParser_obj,tolerant),HX_("tolerant",69,10,52,94)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(HtmlParser_obj,matches),HX_("matches",f3,3c,7c,89)},
+ {::hx::fsString,(int)offsetof(HtmlParser_obj,str),HX_("str",b1,a8,57,00)},
+ {::hx::fsInt,(int)offsetof(HtmlParser_obj,i),HX_("i",69,00,00,00)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo HtmlParser_obj_sStaticStorageInfo[] = {
+ {::hx::fsObject /* ::Dynamic */ ,(void *) &HtmlParser_obj::SELF_CLOSING_TAGS_HTML,HX_("SELF_CLOSING_TAGS_HTML",f4,7f,9d,00)},
+ {::hx::fsString,(void *) &HtmlParser_obj::reID,HX_("reID",4e,36,a7,4b)},
+ {::hx::fsString,(void *) &HtmlParser_obj::reNamespacedID,HX_("reNamespacedID",d7,79,13,1b)},
+ {::hx::fsString,(void *) &HtmlParser_obj::reCDATA,HX_("reCDATA",5a,4f,97,a7)},
+ {::hx::fsString,(void *) &HtmlParser_obj::reScript,HX_("reScript",1e,6e,63,5c)},
+ {::hx::fsString,(void *) &HtmlParser_obj::reStyle,HX_("reStyle",7e,68,e5,fd)},
+ {::hx::fsString,(void *) &HtmlParser_obj::reElementOpen,HX_("reElementOpen",b3,a7,96,d1)},
+ {::hx::fsString,(void *) &HtmlParser_obj::reAttr,HX_("reAttr",84,02,77,e7)},
+ {::hx::fsString,(void *) &HtmlParser_obj::reElementEnd,HX_("reElementEnd",12,10,75,3b)},
+ {::hx::fsString,(void *) &HtmlParser_obj::reElementClose,HX_("reElementClose",af,df,cf,a6)},
+ {::hx::fsString,(void *) &HtmlParser_obj::reComment,HX_("reComment",ec,6a,29,cf)},
+ {::hx::fsObject /* ::EReg */ ,(void *) &HtmlParser_obj::reMain,HX_("reMain",8c,1d,57,ef)},
+ {::hx::fsObject /* ::EReg */ ,(void *) &HtmlParser_obj::reParseAttrs,HX_("reParseAttrs",82,da,74,66)},
+ { ::hx::fsUnknown, 0, null()}
+};
+#endif
+
+static ::String HtmlParser_obj_sMemberFields[] = {
+ HX_("tolerant",69,10,52,94),
+ HX_("matches",f3,3c,7c,89),
+ HX_("str",b1,a8,57,00),
+ HX_("i",69,00,00,00),
+ HX_("parse",33,90,55,bd),
+ HX_("processMatches",44,7e,da,3b),
+ HX_("parseElement",c9,02,2f,60),
+ HX_("isSelfClosingTag",9b,66,89,ba),
+ HX_("newElement",3c,d2,56,43),
+ HX_("getPosition",5f,63,ee,f0),
+ ::String(null()) };
+
+static void HtmlParser_obj_sMarkStatics(HX_MARK_PARAMS) {
+ HX_MARK_MEMBER_NAME(HtmlParser_obj::SELF_CLOSING_TAGS_HTML,"SELF_CLOSING_TAGS_HTML");
+ HX_MARK_MEMBER_NAME(HtmlParser_obj::reID,"reID");
+ HX_MARK_MEMBER_NAME(HtmlParser_obj::reNamespacedID,"reNamespacedID");
+ HX_MARK_MEMBER_NAME(HtmlParser_obj::reCDATA,"reCDATA");
+ HX_MARK_MEMBER_NAME(HtmlParser_obj::reScript,"reScript");
+ HX_MARK_MEMBER_NAME(HtmlParser_obj::reStyle,"reStyle");
+ HX_MARK_MEMBER_NAME(HtmlParser_obj::reElementOpen,"reElementOpen");
+ HX_MARK_MEMBER_NAME(HtmlParser_obj::reAttr,"reAttr");
+ HX_MARK_MEMBER_NAME(HtmlParser_obj::reElementEnd,"reElementEnd");
+ HX_MARK_MEMBER_NAME(HtmlParser_obj::reElementClose,"reElementClose");
+ HX_MARK_MEMBER_NAME(HtmlParser_obj::reComment,"reComment");
+ HX_MARK_MEMBER_NAME(HtmlParser_obj::reMain,"reMain");
+ HX_MARK_MEMBER_NAME(HtmlParser_obj::reParseAttrs,"reParseAttrs");
+};
+
+#ifdef HXCPP_VISIT_ALLOCS
+static void HtmlParser_obj_sVisitStatics(HX_VISIT_PARAMS) {
+ HX_VISIT_MEMBER_NAME(HtmlParser_obj::SELF_CLOSING_TAGS_HTML,"SELF_CLOSING_TAGS_HTML");
+ HX_VISIT_MEMBER_NAME(HtmlParser_obj::reID,"reID");
+ HX_VISIT_MEMBER_NAME(HtmlParser_obj::reNamespacedID,"reNamespacedID");
+ HX_VISIT_MEMBER_NAME(HtmlParser_obj::reCDATA,"reCDATA");
+ HX_VISIT_MEMBER_NAME(HtmlParser_obj::reScript,"reScript");
+ HX_VISIT_MEMBER_NAME(HtmlParser_obj::reStyle,"reStyle");
+ HX_VISIT_MEMBER_NAME(HtmlParser_obj::reElementOpen,"reElementOpen");
+ HX_VISIT_MEMBER_NAME(HtmlParser_obj::reAttr,"reAttr");
+ HX_VISIT_MEMBER_NAME(HtmlParser_obj::reElementEnd,"reElementEnd");
+ HX_VISIT_MEMBER_NAME(HtmlParser_obj::reElementClose,"reElementClose");
+ HX_VISIT_MEMBER_NAME(HtmlParser_obj::reComment,"reComment");
+ HX_VISIT_MEMBER_NAME(HtmlParser_obj::reMain,"reMain");
+ HX_VISIT_MEMBER_NAME(HtmlParser_obj::reParseAttrs,"reParseAttrs");
+};
+
+#endif
+
+::hx::Class HtmlParser_obj::__mClass;
+
+static ::String HtmlParser_obj_sStaticFields[] = {
+ HX_("SELF_CLOSING_TAGS_HTML",f4,7f,9d,00),
+ HX_("reID",4e,36,a7,4b),
+ HX_("reNamespacedID",d7,79,13,1b),
+ HX_("reCDATA",5a,4f,97,a7),
+ HX_("reScript",1e,6e,63,5c),
+ HX_("reStyle",7e,68,e5,fd),
+ HX_("reElementOpen",b3,a7,96,d1),
+ HX_("reAttr",84,02,77,e7),
+ HX_("reElementEnd",12,10,75,3b),
+ HX_("reElementClose",af,df,cf,a6),
+ HX_("reComment",ec,6a,29,cf),
+ HX_("reMain",8c,1d,57,ef),
+ HX_("reParseAttrs",82,da,74,66),
+ HX_("run",4b,e7,56,00),
+ HX_("parseAttrs",ef,b4,c4,50),
+ ::String(null())
+};
+
+void HtmlParser_obj::__register()
+{
+ HtmlParser_obj _hx_dummy;
+ HtmlParser_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("htmlparser.HtmlParser",2e,56,ee,b1);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &HtmlParser_obj::__GetStatic;
+ __mClass->mSetStaticField = &HtmlParser_obj::__SetStatic;
+ __mClass->mMarkFunc = HtmlParser_obj_sMarkStatics;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(HtmlParser_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(HtmlParser_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< HtmlParser_obj >;
+#ifdef HXCPP_VISIT_ALLOCS
+ __mClass->mVisitFunc = HtmlParser_obj_sVisitStatics;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = HtmlParser_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = HtmlParser_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void HtmlParser_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_8ccefc64b7335ec2_9_boot)
+HXDLIN( 9) SELF_CLOSING_TAGS_HTML = ::Dynamic(::hx::Anon_obj::Create(11)
+ ->setFixed(0,HX_("spacer",ec,a0,54,b8),1)
+ ->setFixed(1,HX_("param",8d,80,55,bd),1)
+ ->setFixed(2,HX_("input",0a,c4,1d,be),1)
+ ->setFixed(3,HX_("br",d0,55,00,00),1)
+ ->setFixed(4,HX_("hr",0a,5b,00,00),1)
+ ->setFixed(5,HX_("img",03,0c,50,00),1)
+ ->setFixed(6,HX_("source",db,b0,31,32),1)
+ ->setFixed(7,HX_("base",11,e8,10,41),1)
+ ->setFixed(8,HX_("link",fa,17,b3,47),1)
+ ->setFixed(9,HX_("meta",c5,4a,59,48),1)
+ ->setFixed(10,HX_("embed",d9,8d,cf,6f),1));
+ }
+{
+ HX_STACKFRAME(&_hx_pos_8ccefc64b7335ec2_11_boot)
+HXDLIN( 11) reID = HX_("[a-z](?:-?[_a-z0-9])*",e1,82,9a,3a);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_8ccefc64b7335ec2_12_boot)
+HXDLIN( 12) reNamespacedID = (((::htmlparser::HtmlParser_obj::reID + HX_("(?::",97,89,a0,1a)) + ::htmlparser::HtmlParser_obj::reID) + HX_(")?",f6,23,00,00));
+ }
+{
+ HX_STACKFRAME(&_hx_pos_8ccefc64b7335ec2_14_boot)
+HXDLIN( 14) reCDATA = HX_("[<]!\\[CDATA\\[[\\s\\S]*?\\]\\][>]",a7,ae,9c,cf);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_8ccefc64b7335ec2_15_boot)
+HXDLIN( 15) reScript = HX_("[<]\\s*script\\s*([^>]*)>([\\s\\S]*?)<\\s*/\\s*script\\s*>",6f,5f,7c,b6);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_8ccefc64b7335ec2_16_boot)
+HXDLIN( 16) reStyle = HX_("<\\s*style\\s*([^>]*)>([\\s\\S]*?)<\\s*/\\s*style\\s*>",5b,c4,8b,bb);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_8ccefc64b7335ec2_17_boot)
+HXDLIN( 17) reElementOpen = ((HX_("<\\s*(",51,d7,31,c9) + ::htmlparser::HtmlParser_obj::reNamespacedID) + HX_(")",29,00,00,00));
+ }
+{
+ HX_STACKFRAME(&_hx_pos_8ccefc64b7335ec2_18_boot)
+HXDLIN( 18) reAttr = (::htmlparser::HtmlParser_obj::reNamespacedID + HX_("(?:\\s*=\\s*(?:'[^']*?'|\"[^\"]*?\"|[-_a-z0-9]+))?",f8,b4,8a,50));
+ }
+{
+ HX_STACKFRAME(&_hx_pos_8ccefc64b7335ec2_19_boot)
+HXDLIN( 19) reElementEnd = HX_("(/)?\\s*>",68,02,5a,7a);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_8ccefc64b7335ec2_20_boot)
+HXDLIN( 20) reElementClose = ((HX_("<\\s*/\\s*(",6d,6c,d3,c4) + ::htmlparser::HtmlParser_obj::reNamespacedID) + HX_(")\\s*>",d4,d1,94,d8));
+ }
+{
+ HX_STACKFRAME(&_hx_pos_8ccefc64b7335ec2_21_boot)
+HXDLIN( 21) reComment = HX_("<!--[\\s\\S]*?-->",30,12,75,12);
+ }
+{
+ HX_GC_STACKFRAME(&_hx_pos_8ccefc64b7335ec2_23_boot)
+HXDLIN( 23) reMain = ::EReg_obj::__alloc( HX_CTX ,((((((((((((((((HX_("(",28,00,00,00) + ::htmlparser::HtmlParser_obj::reCDATA) + HX_(")|(",95,88,1f,00)) + ::htmlparser::HtmlParser_obj::reScript) + HX_(")|(",95,88,1f,00)) + ::htmlparser::HtmlParser_obj::reStyle) + HX_(")|(",95,88,1f,00)) + ::htmlparser::HtmlParser_obj::reElementOpen) + HX_("((?:\\s+",79,1c,7c,ea)) + ::htmlparser::HtmlParser_obj::reAttr) + HX_(")*)\\s*",8b,1b,d6,ae)) + ::htmlparser::HtmlParser_obj::reElementEnd) + HX_(")|(",95,88,1f,00)) + ::htmlparser::HtmlParser_obj::reElementClose) + HX_(")|(",95,88,1f,00)) + ::htmlparser::HtmlParser_obj::reComment) + HX_(")",29,00,00,00)),HX_("ig",de,5b,00,00));
+ }
+{
+ HX_GC_STACKFRAME(&_hx_pos_8ccefc64b7335ec2_25_boot)
+HXDLIN( 25) reParseAttrs = ::EReg_obj::__alloc( HX_CTX ,((HX_("(",28,00,00,00) + ::htmlparser::HtmlParser_obj::reNamespacedID) + HX_(")(?:\\s*=\\s*('[^']*'|\"[^\"]*\"|[-_a-z0-9]+))?",92,0f,f7,ad)),HX_("ig",de,5b,00,00));
+ }
+}
+
+} // end namespace htmlparser
diff --git a/Sources/c_snikket/src/htmlparser/HtmlParserException.cpp b/Sources/c_snikket/src/htmlparser/HtmlParserException.cpp
new file mode 100644
index 0000000..566fcce
--- /dev/null
+++ b/Sources/c_snikket/src/htmlparser/HtmlParserException.cpp
@@ -0,0 +1,154 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_htmlparser_HtmlParserException
+#include <htmlparser/HtmlParserException.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_8ec4e8a8c4e51446_12_new,"htmlparser.HtmlParserException","new",0xd1aeb9b3,"htmlparser.HtmlParserException.new","htmlparser/HtmlParserException.hx",12,0x545e05de)
+HX_LOCAL_STACK_FRAME(_hx_pos_8ec4e8a8c4e51446_20_toString,"htmlparser.HtmlParserException","toString",0x97863a79,"htmlparser.HtmlParserException.toString","htmlparser/HtmlParserException.hx",20,0x545e05de)
+namespace htmlparser{
+
+void HtmlParserException_obj::__construct(::String message, ::Dynamic pos){
+ HX_STACKFRAME(&_hx_pos_8ec4e8a8c4e51446_12_new)
+HXLINE( 13) this->message = message;
+HXLINE( 15) this->line = ( (int)(pos->__Field(HX_("line",f4,17,b3,47),::hx::paccDynamic)) );
+HXLINE( 16) this->column = ( (int)(pos->__Field(HX_("column",d6,4e,8b,c6),::hx::paccDynamic)) );
+HXLINE( 17) this->length = ( (int)(pos->__Field(HX_("length",e6,94,07,9f),::hx::paccDynamic)) );
+ }
+
+Dynamic HtmlParserException_obj::__CreateEmpty() { return new HtmlParserException_obj; }
+
+void *HtmlParserException_obj::_hx_vtable = 0;
+
+Dynamic HtmlParserException_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< HtmlParserException_obj > _hx_result = new HtmlParserException_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1]);
+ return _hx_result;
+}
+
+bool HtmlParserException_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x0872044b;
+}
+
+::String HtmlParserException_obj::toString(){
+ HX_STACKFRAME(&_hx_pos_8ec4e8a8c4e51446_20_toString)
+HXDLIN( 20) return (((((HX_("Parse error at ",28,15,14,1d) + this->line) + HX_(":",3a,00,00,00)) + this->column) + HX_(". ",32,28,00,00)) + this->message);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(HtmlParserException_obj,toString,return )
+
+
+HtmlParserException_obj::HtmlParserException_obj()
+{
+}
+
+void HtmlParserException_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(HtmlParserException);
+ HX_MARK_MEMBER_NAME(message,"message");
+ HX_MARK_MEMBER_NAME(line,"line");
+ HX_MARK_MEMBER_NAME(column,"column");
+ HX_MARK_MEMBER_NAME(length,"length");
+ HX_MARK_END_CLASS();
+}
+
+void HtmlParserException_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(message,"message");
+ HX_VISIT_MEMBER_NAME(line,"line");
+ HX_VISIT_MEMBER_NAME(column,"column");
+ HX_VISIT_MEMBER_NAME(length,"length");
+}
+
+::hx::Val HtmlParserException_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"line") ) { return ::hx::Val( line ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"column") ) { return ::hx::Val( column ); }
+ if (HX_FIELD_EQ(inName,"length") ) { return ::hx::Val( length ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"message") ) { return ::hx::Val( message ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"toString") ) { return ::hx::Val( toString_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val HtmlParserException_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"line") ) { line=inValue.Cast< int >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"column") ) { column=inValue.Cast< int >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"length") ) { length=inValue.Cast< int >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"message") ) { message=inValue.Cast< ::String >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void HtmlParserException_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("message",c7,35,11,9a));
+ outFields->push(HX_("line",f4,17,b3,47));
+ outFields->push(HX_("column",d6,4e,8b,c6));
+ outFields->push(HX_("length",e6,94,07,9f));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo HtmlParserException_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(HtmlParserException_obj,message),HX_("message",c7,35,11,9a)},
+ {::hx::fsInt,(int)offsetof(HtmlParserException_obj,line),HX_("line",f4,17,b3,47)},
+ {::hx::fsInt,(int)offsetof(HtmlParserException_obj,column),HX_("column",d6,4e,8b,c6)},
+ {::hx::fsInt,(int)offsetof(HtmlParserException_obj,length),HX_("length",e6,94,07,9f)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *HtmlParserException_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String HtmlParserException_obj_sMemberFields[] = {
+ HX_("message",c7,35,11,9a),
+ HX_("line",f4,17,b3,47),
+ HX_("column",d6,4e,8b,c6),
+ HX_("length",e6,94,07,9f),
+ HX_("toString",ac,d0,6e,38),
+ ::String(null()) };
+
+::hx::Class HtmlParserException_obj::__mClass;
+
+void HtmlParserException_obj::__register()
+{
+ HtmlParserException_obj _hx_dummy;
+ HtmlParserException_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("htmlparser.HtmlParserException",41,64,65,1d);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(HtmlParserException_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< HtmlParserException_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = HtmlParserException_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = HtmlParserException_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace htmlparser
diff --git a/Sources/c_snikket/src/htmlparser/HtmlTools.cpp b/Sources/c_snikket/src/htmlparser/HtmlTools.cpp
new file mode 100644
index 0000000..7dbbc62
--- /dev/null
+++ b/Sources/c_snikket/src/htmlparser/HtmlTools.cpp
@@ -0,0 +1,288 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_EReg
+#include <EReg.h>
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_StringMap
+#include <haxe/ds/StringMap.h>
+#endif
+#ifndef INCLUDED_htmlparser_HtmlTools
+#include <htmlparser/HtmlTools.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_afb72cddd227e1ec_9_get_htmlUnescapeMap,"htmlparser.HtmlTools","get_htmlUnescapeMap",0x8f1cd9cc,"htmlparser.HtmlTools.get_htmlUnescapeMap","htmlparser/HtmlTools.hx",9,0x09b71c13)
+HX_LOCAL_STACK_FRAME(_hx_pos_afb72cddd227e1ec_135_unescape,"htmlparser.HtmlTools","unescape",0x3992439c,"htmlparser.HtmlTools.unescape","htmlparser/HtmlTools.hx",135,0x09b71c13)
+HX_LOCAL_STACK_FRAME(_hx_pos_afb72cddd227e1ec_134_unescape,"htmlparser.HtmlTools","unescape",0x3992439c,"htmlparser.HtmlTools.unescape","htmlparser/HtmlTools.hx",134,0x09b71c13)
+namespace htmlparser{
+
+void HtmlTools_obj::__construct() { }
+
+Dynamic HtmlTools_obj::__CreateEmpty() { return new HtmlTools_obj; }
+
+void *HtmlTools_obj::_hx_vtable = 0;
+
+Dynamic HtmlTools_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< HtmlTools_obj > _hx_result = new HtmlTools_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool HtmlTools_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x319122e2;
+}
+
+ ::haxe::ds::StringMap HtmlTools_obj::htmlUnescapeMap;
+
+ ::haxe::ds::StringMap HtmlTools_obj::get_htmlUnescapeMap(){
+ HX_GC_STACKFRAME(&_hx_pos_afb72cddd227e1ec_9_get_htmlUnescapeMap)
+HXLINE( 10) if (::hx::IsNull( ::htmlparser::HtmlTools_obj::htmlUnescapeMap )) {
+HXLINE( 13) ::haxe::ds::StringMap _g = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXDLIN( 13) _g->set(HX_("nbsp",d1,39,00,49),HX_(" ",20,00,00,00));
+HXDLIN( 13) _g->set(HX_("amp",04,fa,49,00),HX_("&",26,00,00,00));
+HXDLIN( 13) _g->set(HX_("lt",88,5e,00,00),HX_("<",3c,00,00,00));
+HXDLIN( 13) _g->set(HX_("gt",2d,5a,00,00),HX_(">",3e,00,00,00));
+HXDLIN( 13) _g->set(HX_("quot",09,45,0a,4b),HX_("\"",22,00,00,00));
+HXDLIN( 13) _g->set(HX_("apos",d3,0f,73,40),HX_("'",27,00,00,00));
+HXDLIN( 13) _g->set(HX_("euro",2d,b8,1b,43),HX_W(u"\u20ac",ef4c,00ab));
+HXDLIN( 13) _g->set(HX_("iexcl",c5,da,30,b8),HX_W(u"\u00a1",a99f,0000));
+HXDLIN( 13) _g->set(HX_("cent",68,23,bd,41),HX_W(u"\u00a2",a9a0,0000));
+HXDLIN( 13) _g->set(HX_("pound",4c,cf,98,c6),HX_W(u"\u00a3",a9a1,0000));
+HXDLIN( 13) _g->set(HX_("curren",db,c3,e7,3e),HX_W(u"\u00a4",a9a2,0000));
+HXDLIN( 13) _g->set(HX_("yen",22,29,5c,00),HX_W(u"\u00a5",a9a3,0000));
+HXDLIN( 13) _g->set(HX_("brvbar",ed,5c,f1,20),HX_W(u"\u00a6",a9a4,0000));
+HXDLIN( 13) _g->set(HX_("sect",c3,83,50,4c),HX_W(u"\u00a7",a9a5,0000));
+HXDLIN( 13) _g->set(HX_("uml",14,27,59,00),HX_W(u"\u00a8",a9a6,0000));
+HXDLIN( 13) _g->set(HX_("copy",b5,bb,c4,41),HX_W(u"\u00a9",a9a7,0000));
+HXDLIN( 13) _g->set(HX_("ordf",65,87,b5,49),HX_W(u"\u00aa",a9a8,0000));
+HXDLIN( 13) _g->set(HX_("not",13,d9,53,00),HX_W(u"\u00ac",a9aa,0000));
+HXDLIN( 13) _g->set(HX_("shy",44,9e,57,00),HX_W(u"\u00ad",a9ab,0000));
+HXDLIN( 13) _g->set(HX_("reg",54,d9,56,00),HX_W(u"\u00ae",a9ac,0000));
+HXDLIN( 13) _g->set(HX_("macr",03,33,56,48),HX_W(u"\u00af",a9ad,0000));
+HXDLIN( 13) _g->set(HX_("deg",c6,39,4c,00),HX_W(u"\u00b0",a9ae,0000));
+HXDLIN( 13) _g->set(HX_("plusmn",3b,a9,ec,44),HX_W(u"\u00b1",a9af,0000));
+HXDLIN( 13) _g->set(HX_("sup2",e4,b2,5c,4c),HX_W(u"\u00b2",a9b0,0000));
+HXDLIN( 13) _g->set(HX_("sup3",e5,b2,5c,4c),HX_W(u"\u00b3",a9b1,0000));
+HXDLIN( 13) _g->set(HX_("acute",84,91,a7,1b),HX_W(u"\u00b4",a9b2,0000));
+HXDLIN( 13) _g->set(HX_("micro",04,25,60,08),HX_W(u"\u00b5",a9b3,0000));
+HXDLIN( 13) _g->set(HX_("para",e0,e3,51,4a),HX_W(u"\u00b6",a9b4,0000));
+HXDLIN( 13) _g->set(HX_("middot",01,d6,5e,4c),HX_W(u"\u00b7",a9b5,0000));
+HXDLIN( 13) _g->set(HX_("cedil",e5,37,ba,43),HX_W(u"\u00b8",a9b6,0000));
+HXDLIN( 13) _g->set(HX_("sup1",e3,b2,5c,4c),HX_W(u"\u00b9",a9b7,0000));
+HXDLIN( 13) _g->set(HX_("ordm",6c,87,b5,49),HX_W(u"\u00ba",a9b8,0000));
+HXDLIN( 13) _g->set(HX_("raquo",bc,f8,21,e4),HX_W(u"\u00bb",a9b9,0000));
+HXDLIN( 13) _g->set(HX_("frac14",91,eb,7d,ac),HX_W(u"\u00bc",a9ba,0000));
+HXDLIN( 13) _g->set(HX_("frac12",8f,eb,7d,ac),HX_W(u"\u00bd",a9bb,0000));
+HXDLIN( 13) _g->set(HX_("frac34",4f,ed,7d,ac),HX_W(u"\u00be",a9bc,0000));
+HXDLIN( 13) _g->set(HX_("iquest",d9,6e,63,59),HX_W(u"\u00bf",a9bd,0000));
+HXDLIN( 13) _g->set(HX_("Agrave",a4,88,1c,97),HX_W(u"\u00c0",aa5d,0000));
+HXDLIN( 13) _g->set(HX_("Aacute",a3,05,da,18),HX_W(u"\u00c1",aa5e,0000));
+HXDLIN( 13) _g->set(HX_("Acirc",98,e4,cb,ae),HX_W(u"\u00c2",aa5f,0000));
+HXDLIN( 13) _g->set(HX_("Atilde",b7,70,67,0d),HX_W(u"\u00c3",aa60,0000));
+HXDLIN( 13) _g->set(HX_("Auml",73,05,50,2b),HX_W(u"\u00c4",aa61,0000));
+HXDLIN( 13) _g->set(HX_("Aring",71,14,b6,b8),HX_W(u"\u00c5",aa62,0000));
+HXDLIN( 13) _g->set(HX_("AElig",e6,bc,f9,9a),HX_W(u"\u00c6",aa63,0000));
+HXDLIN( 13) _g->set(HX_("Ccedil",c2,64,a3,0d),HX_W(u"\u00c7",aa64,0000));
+HXDLIN( 13) _g->set(HX_("Egrave",20,fa,89,30),HX_W(u"\u00c8",aa65,0000));
+HXDLIN( 13) _g->set(HX_("Eacute",1f,77,47,b2),HX_W(u"\u00c9",aa66,0000));
+HXDLIN( 13) _g->set(HX_("Ecirc",9c,36,66,fc),HX_W(u"\u00ca",aa67,0000));
+HXDLIN( 13) _g->set(HX_("Euml",ef,df,f4,2d),HX_W(u"\u00cb",aa68,0000));
+HXDLIN( 13) _g->set(HX_("Igrave",9c,6b,f7,c9),HX_W(u"\u00cc",aa69,0000));
+HXDLIN( 13) _g->set(HX_("Iacute",9b,e8,b4,4b),HX_W(u"\u00cd",aa6a,0000));
+HXDLIN( 13) _g->set(HX_("Icirc",a0,88,00,4a),HX_W(u"\u00ce",aa6b,0000));
+HXDLIN( 13) _g->set(HX_("Iuml",6b,ba,99,30),HX_W(u"\u00cf",aa6c,0000));
+HXDLIN( 13) _g->set(HX_("ETH",f9,a4,34,00),HX_W(u"\u00d0",aa6d,0000));
+HXDLIN( 13) _g->set(HX_("Ntilde",8a,21,0b,40),HX_W(u"\u00d1",aa6e,0000));
+HXDLIN( 13) _g->set(HX_("Ograve",d6,95,1b,30),HX_W(u"\u00d2",aa6f,0000));
+HXDLIN( 13) _g->set(HX_("Oacute",d5,12,d9,b1),HX_W(u"\u00d3",aa70,0000));
+HXDLIN( 13) _g->set(HX_("Ocirc",a6,03,68,be),HX_W(u"\u00d4",aa71,0000));
+HXDLIN( 13) _g->set(HX_("Otilde",e9,7d,66,a6),HX_W(u"\u00d5",aa72,0000));
+HXDLIN( 13) _g->set(HX_("Ouml",25,02,91,34),HX_W(u"\u00d6",aa73,0000));
+HXDLIN( 13) _g->set(HX_("times",c6,bf,35,10),HX_W(u"\u00d7",aa74,0000));
+HXDLIN( 13) _g->set(HX_("Oslash",8e,41,f3,14),HX_W(u"\u00d8",aa75,0000));
+HXDLIN( 13) _g->set(HX_("Ugrave",10,c0,3f,96),HX_W(u"\u00d9",aa76,0000));
+HXDLIN( 13) _g->set(HX_("Uacute",0f,3d,fd,17),HX_W(u"\u00da",aa77,0000));
+HXDLIN( 13) _g->set(HX_("Ucirc",ac,7e,cf,32),HX_W(u"\u00db",aa78,0000));
+HXDLIN( 13) _g->set(HX_("Uuml",df,49,88,38),HX_W(u"\u00dc",aa79,0000));
+HXDLIN( 13) _g->set(HX_("Yacute",8b,ae,6a,b1),HX_W(u"\u00dd",aa7a,0000));
+HXDLIN( 13) _g->set(HX_("THORN",d7,50,7c,8d),HX_W(u"\u00de",aa7b,0000));
+HXDLIN( 13) _g->set(HX_("szlig",03,0d,0b,88),HX_W(u"\u00df",aa7c,0000));
+HXDLIN( 13) _g->set(HX_("agrave",84,14,88,62),HX_W(u"\u00e0",aa7d,0000));
+HXDLIN( 13) _g->set(HX_("aacute",83,91,45,e4),HX_W(u"\u00e1",aa7e,0000));
+HXDLIN( 13) _g->set(HX_("acirc",b8,74,9e,1b),HX_W(u"\u00e2",aa7f,0000));
+HXDLIN( 13) _g->set(HX_("atilde",97,fc,d2,d8),HX_W(u"\u00e3",aa80,0000));
+HXDLIN( 13) _g->set(HX_("auml",53,d9,76,40),HX_W(u"\u00e4",aa81,0000));
+HXDLIN( 13) _g->set(HX_("aring",91,a4,88,25),HX_W(u"\u00e5",aa82,0000));
+HXDLIN( 13) _g->set(HX_("aelig",e6,20,f3,1c),HX_W(u"\u00e6",aa83,0000));
+HXDLIN( 13) _g->set(HX_("ccedil",a2,f0,0e,d9),HX_W(u"\u00e7",aa84,0000));
+HXDLIN( 13) _g->set(HX_("egrave",00,86,f5,fb),HX_W(u"\u00e8",aa85,0000));
+HXDLIN( 13) _g->set(HX_("eacute",ff,02,b3,7d),HX_W(u"\u00e9",aa86,0000));
+HXDLIN( 13) _g->set(HX_("ecirc",bc,c6,38,69),HX_W(u"\u00ea",aa87,0000));
+HXDLIN( 13) _g->set(HX_("euml",cf,b3,1b,43),HX_W(u"\u00eb",aa88,0000));
+HXDLIN( 13) _g->set(HX_("igrave",7c,f7,62,95),HX_W(u"\u00ec",aa89,0000));
+HXDLIN( 13) _g->set(HX_("iacute",7b,74,20,17),HX_W(u"\u00ed",aa8a,0000));
+HXDLIN( 13) _g->set(HX_("icirc",c0,18,d3,b6),HX_W(u"\u00ee",aa8b,0000));
+HXDLIN( 13) _g->set(HX_("iuml",4b,8e,c0,45),HX_W(u"\u00ef",aa8c,0000));
+HXDLIN( 13) _g->set(HX_("eth",19,09,4d,00),HX_W(u"\u00f0",aa8d,0000));
+HXDLIN( 13) _g->set(HX_("ntilde",6a,ad,76,0b),HX_W(u"\u00f1",aa8e,0000));
+HXDLIN( 13) _g->set(HX_("ograve",b6,21,87,fb),HX_W(u"\u00f2",aa8f,0000));
+HXDLIN( 13) _g->set(HX_("oacute",b5,9e,44,7d),HX_W(u"\u00f3",aa90,0000));
+HXDLIN( 13) _g->set(HX_("ocirc",c6,93,3a,2b),HX_W(u"\u00f4",aa91,0000));
+HXDLIN( 13) _g->set(HX_("otilde",c9,09,d2,71),HX_W(u"\u00f5",aa92,0000));
+HXDLIN( 13) _g->set(HX_("ouml",05,d6,b7,49),HX_W(u"\u00f6",aa93,0000));
+HXDLIN( 13) _g->set(HX_("divide",79,2f,12,bf),HX_W(u"\u00f7",aa94,0000));
+HXDLIN( 13) _g->set(HX_("oslash",6e,cd,5e,e0),HX_W(u"\u00f8",aa95,0000));
+HXDLIN( 13) _g->set(HX_("ugrave",f0,4b,ab,61),HX_W(u"\u00f9",aa96,0000));
+HXDLIN( 13) _g->set(HX_("uacute",ef,c8,68,e3),HX_W(u"\u00fa",aa97,0000));
+HXDLIN( 13) _g->set(HX_("ucirc",cc,0e,a2,9f),HX_W(u"\u00fb",aa98,0000));
+HXDLIN( 13) _g->set(HX_("uuml",bf,1d,af,4d),HX_W(u"\u00fc",aa99,0000));
+HXDLIN( 13) _g->set(HX_("yacute",6b,3a,d6,7c),HX_W(u"\u00fd",aa9a,0000));
+HXDLIN( 13) _g->set(HX_("thorn",f7,18,8e,0f),HX_W(u"\u00fe",aa9b,0000));
+HXLINE( 12) ::htmlparser::HtmlTools_obj::htmlUnescapeMap = _g;
+ }
+HXLINE( 116) return ::htmlparser::HtmlTools_obj::htmlUnescapeMap;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC0(HtmlTools_obj,get_htmlUnescapeMap,return )
+
+::String HtmlTools_obj::unescape(::String text){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ ::String _hx_run( ::EReg re){
+ HX_GC_STACKFRAME(&_hx_pos_afb72cddd227e1ec_135_unescape)
+HXLINE( 136) ::String s = re->matched(0);
+HXLINE( 137) if ((s.charAt(0) == HX_("&",26,00,00,00))) {
+HXLINE( 139) if ((s.charAt(1) == HX_("#",23,00,00,00))) {
+HXLINE( 141) ::String numbers = s.substring(2,(s.length - 1));
+HXLINE( 142) if ((numbers.charAt(0) == HX_("x",78,00,00,00))) {
+HXLINE( 142) numbers = (HX_("0",30,00,00,00) + numbers);
+ }
+HXLINE( 143) ::Dynamic code = ::Std_obj::parseInt(numbers);
+HXLINE( 144) bool _hx_tmp;
+HXDLIN( 144) if (::hx::IsNotNull( code )) {
+HXLINE( 144) _hx_tmp = ::hx::IsNotEq( code,0 );
+ }
+ else {
+HXLINE( 144) _hx_tmp = false;
+ }
+HXDLIN( 144) if (_hx_tmp) {
+HXLINE( 144) return ::String::fromCharCode(( (int)(code) ));
+ }
+ else {
+HXLINE( 144) return s;
+ }
+ }
+ else {
+HXLINE( 148) ::Dynamic this1 = ::htmlparser::HtmlTools_obj::get_htmlUnescapeMap();
+HXDLIN( 148) ::String r = ( ( ::haxe::ds::StringMap)(this1) )->get_string(s.substring(1,(s.length - 1)));
+HXLINE( 149) if (::hx::IsNotNull( r )) {
+HXLINE( 149) return r;
+ }
+ else {
+HXLINE( 149) return s;
+ }
+ }
+ }
+HXLINE( 152) return re->matched(1);
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_afb72cddd227e1ec_134_unescape)
+HXDLIN( 134) return ::EReg_obj::__alloc( HX_CTX ,HX_("[<]!\\[CDATA\\[((?:.|[\r\n])*?)\\]\\][>]|&[^;]+;",d6,26,fb,65),HX_("g",67,00,00,00))->map(text, ::Dynamic(new _hx_Closure_0()));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(HtmlTools_obj,unescape,return )
+
+
+HtmlTools_obj::HtmlTools_obj()
+{
+}
+
+bool HtmlTools_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 8:
+ if (HX_FIELD_EQ(inName,"unescape") ) { outValue = unescape_dyn(); return true; }
+ break;
+ case 15:
+ if (HX_FIELD_EQ(inName,"htmlUnescapeMap") ) { outValue = ( inCallProp == ::hx::paccAlways ? get_htmlUnescapeMap() : htmlUnescapeMap ); return true; }
+ break;
+ case 19:
+ if (HX_FIELD_EQ(inName,"get_htmlUnescapeMap") ) { outValue = get_htmlUnescapeMap_dyn(); return true; }
+ }
+ return false;
+}
+
+bool HtmlTools_obj::__SetStatic(const ::String &inName,Dynamic &ioValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 15:
+ if (HX_FIELD_EQ(inName,"htmlUnescapeMap") ) { htmlUnescapeMap=ioValue.Cast< ::haxe::ds::StringMap >(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *HtmlTools_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo HtmlTools_obj_sStaticStorageInfo[] = {
+ {::hx::fsObject /* ::haxe::ds::StringMap */ ,(void *) &HtmlTools_obj::htmlUnescapeMap,HX_("htmlUnescapeMap",77,60,84,1e)},
+ { ::hx::fsUnknown, 0, null()}
+};
+#endif
+
+static void HtmlTools_obj_sMarkStatics(HX_MARK_PARAMS) {
+ HX_MARK_MEMBER_NAME(HtmlTools_obj::htmlUnescapeMap,"htmlUnescapeMap");
+};
+
+#ifdef HXCPP_VISIT_ALLOCS
+static void HtmlTools_obj_sVisitStatics(HX_VISIT_PARAMS) {
+ HX_VISIT_MEMBER_NAME(HtmlTools_obj::htmlUnescapeMap,"htmlUnescapeMap");
+};
+
+#endif
+
+::hx::Class HtmlTools_obj::__mClass;
+
+static ::String HtmlTools_obj_sStaticFields[] = {
+ HX_("htmlUnescapeMap",77,60,84,1e),
+ HX_("get_htmlUnescapeMap",8e,2f,8f,a9),
+ HX_("unescape",9a,72,21,dd),
+ ::String(null())
+};
+
+void HtmlTools_obj::__register()
+{
+ HtmlTools_obj _hx_dummy;
+ HtmlTools_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("htmlparser.HtmlTools",ac,b7,89,3f);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &HtmlTools_obj::__GetStatic;
+ __mClass->mSetStaticField = &HtmlTools_obj::__SetStatic;
+ __mClass->mMarkFunc = HtmlTools_obj_sMarkStatics;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(HtmlTools_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< HtmlTools_obj >;
+#ifdef HXCPP_VISIT_ALLOCS
+ __mClass->mVisitFunc = HtmlTools_obj_sVisitStatics;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = HtmlTools_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = HtmlTools_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace htmlparser
diff --git a/Sources/c_snikket/src/httpstatus/_HttpStatusMessage/HttpStatusMessage_Impl_.cpp b/Sources/c_snikket/src/httpstatus/_HttpStatusMessage/HttpStatusMessage_Impl_.cpp
new file mode 100644
index 0000000..d8254d2
--- /dev/null
+++ b/Sources/c_snikket/src/httpstatus/_HttpStatusMessage/HttpStatusMessage_Impl_.cpp
@@ -0,0 +1,336 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_httpstatus__HttpStatusMessage_HttpStatusMessage_Impl_
+#include <httpstatus/_HttpStatusMessage/HttpStatusMessage_Impl_.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_29343a8e513e00a9_9_fromCode,"httpstatus._HttpStatusMessage.HttpStatusMessage_Impl_","fromCode",0x5ecb8a04,"httpstatus._HttpStatusMessage.HttpStatusMessage_Impl_.fromCode","httpstatus/HttpStatusMessage.hx",9,0x8734b7a6)
+namespace httpstatus{
+namespace _HttpStatusMessage{
+
+void HttpStatusMessage_Impl__obj::__construct() { }
+
+Dynamic HttpStatusMessage_Impl__obj::__CreateEmpty() { return new HttpStatusMessage_Impl__obj; }
+
+void *HttpStatusMessage_Impl__obj::_hx_vtable = 0;
+
+Dynamic HttpStatusMessage_Impl__obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< HttpStatusMessage_Impl__obj > _hx_result = new HttpStatusMessage_Impl__obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool HttpStatusMessage_Impl__obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x0de4d9f9;
+}
+
+::String HttpStatusMessage_Impl__obj::fromCode(int statusCode){
+ HX_STACKFRAME(&_hx_pos_29343a8e513e00a9_9_fromCode)
+HXDLIN( 9) switch((int)(statusCode)){
+ case (int)100: {
+HXLINE( 10) return HX_("Continue",87,9c,7a,0b);
+ }
+ break;
+ case (int)101: {
+HXLINE( 11) return HX_("Switching Protocols",a9,d3,99,92);
+ }
+ break;
+ case (int)102: {
+HXLINE( 12) return HX_("Processing",f3,5d,e6,cd);
+ }
+ break;
+ case (int)200: {
+HXLINE( 13) return HX_("OK",1c,45,00,00);
+ }
+ break;
+ case (int)201: {
+HXLINE( 14) return HX_("Created",c8,dd,bb,de);
+ }
+ break;
+ case (int)202: {
+HXLINE( 15) return HX_("Accepted",87,79,c9,a1);
+ }
+ break;
+ case (int)203: {
+HXLINE( 16) return HX_("Non-Authoritative Information",bb,a3,63,e2);
+ }
+ break;
+ case (int)204: {
+HXLINE( 17) return HX_("No Content",5a,06,74,1a);
+ }
+ break;
+ case (int)205: {
+HXLINE( 18) return HX_("Reset Content",a8,79,f4,ab);
+ }
+ break;
+ case (int)206: {
+HXLINE( 19) return HX_("Partial Content",5a,c1,24,ef);
+ }
+ break;
+ case (int)207: {
+HXLINE( 20) return HX_("Multi-Status",06,2e,90,60);
+ }
+ break;
+ case (int)208: {
+HXLINE( 21) return HX_("Already Reported",db,97,92,dc);
+ }
+ break;
+ case (int)226: {
+HXLINE( 22) return HX_("IM Used",19,f4,72,4a);
+ }
+ break;
+ case (int)300: {
+HXLINE( 23) return HX_("Multiple Choices",e2,6f,07,3b);
+ }
+ break;
+ case (int)301: {
+HXLINE( 24) return HX_("Moved Permanently",8e,8c,fc,4c);
+ }
+ break;
+ case (int)302: {
+HXLINE( 25) return HX_("Found",22,72,c4,97);
+ }
+ break;
+ case (int)303: {
+HXLINE( 26) return HX_("See Other",43,4e,33,f2);
+ }
+ break;
+ case (int)304: {
+HXLINE( 27) return HX_("Not Modified",36,f0,28,59);
+ }
+ break;
+ case (int)305: {
+HXLINE( 28) return HX_("Use Proxy",95,e5,f1,4a);
+ }
+ break;
+ case (int)306: {
+HXLINE( 29) return HX_("Switch Proxy",42,6f,c6,d6);
+ }
+ break;
+ case (int)307: {
+HXLINE( 30) return HX_("Temporary Redirect",cb,73,f1,2d);
+ }
+ break;
+ case (int)308: {
+HXLINE( 31) return HX_("Permanent Redirect",8e,d3,f2,8e);
+ }
+ break;
+ case (int)400: {
+HXLINE( 32) return HX_("Bad Request",b4,61,00,b4);
+ }
+ break;
+ case (int)401: {
+HXLINE( 33) return HX_("Unauthorized",54,5a,51,93);
+ }
+ break;
+ case (int)402: {
+HXLINE( 34) return HX_("Payment Required",f9,4d,5e,c5);
+ }
+ break;
+ case (int)403: {
+HXLINE( 35) return HX_("Forbidden",d9,e8,e2,e5);
+ }
+ break;
+ case (int)404: {
+HXLINE( 36) return HX_("Not Found",35,47,57,4d);
+ }
+ break;
+ case (int)405: {
+HXLINE( 37) return HX_("Method Not Allowed",3c,b5,d0,70);
+ }
+ break;
+ case (int)406: {
+HXLINE( 38) return HX_("Not Acceptable",cf,0e,6b,35);
+ }
+ break;
+ case (int)407: {
+HXLINE( 39) return HX_("Proxy Authentication Required",35,f1,30,06);
+ }
+ break;
+ case (int)408: {
+HXLINE( 40) return HX_("Request Timeout",90,d4,9d,f8);
+ }
+ break;
+ case (int)409: {
+HXLINE( 41) return HX_("Conflict",72,46,d6,fd);
+ }
+ break;
+ case (int)410: {
+HXLINE( 42) return HX_("Gone",7f,c0,42,2f);
+ }
+ break;
+ case (int)411: {
+HXLINE( 43) return HX_("Length Required",d9,13,1b,e3);
+ }
+ break;
+ case (int)412: {
+HXLINE( 44) return HX_("Precondition Failed",c5,ef,a0,89);
+ }
+ break;
+ case (int)413: {
+HXLINE( 45) return HX_("Payload Too Large",bd,55,e7,53);
+ }
+ break;
+ case (int)414: {
+HXLINE( 46) return HX_("URI Too Long",1c,6e,93,1c);
+ }
+ break;
+ case (int)415: {
+HXLINE( 47) return HX_("Unsupported Media Type",61,45,31,c9);
+ }
+ break;
+ case (int)416: {
+HXLINE( 48) return HX_("Range Not Satisfiable",9d,7a,7b,53);
+ }
+ break;
+ case (int)417: {
+HXLINE( 49) return HX_("Expectation Failed",61,e3,49,ae);
+ }
+ break;
+ case (int)418: {
+HXLINE( 50) return HX_("I'm a teapot",f5,5a,78,47);
+ }
+ break;
+ case (int)421: {
+HXLINE( 51) return HX_("Misdirected Request",4e,3a,3b,51);
+ }
+ break;
+ case (int)422: {
+HXLINE( 52) return HX_("Unprocessable Entity",b3,bb,45,9b);
+ }
+ break;
+ case (int)423: {
+HXLINE( 53) return HX_("Locked",2a,79,5b,8e);
+ }
+ break;
+ case (int)424: {
+HXLINE( 54) return HX_("Failed Dependency",4e,8c,3e,61);
+ }
+ break;
+ case (int)426: {
+HXLINE( 55) return HX_("Upgrade Required",a3,21,95,bc);
+ }
+ break;
+ case (int)428: {
+HXLINE( 56) return HX_("Precondition Required",67,4d,69,a0);
+ }
+ break;
+ case (int)429: {
+HXLINE( 57) return HX_("Too Many Requests",39,d7,77,53);
+ }
+ break;
+ case (int)431: {
+HXLINE( 58) return HX_("Request Header Fields Too Large",8a,a4,23,6a);
+ }
+ break;
+ case (int)451: {
+HXLINE( 59) return HX_("Unavailable For Legal Reasons",a1,79,b9,fc);
+ }
+ break;
+ case (int)500: {
+HXLINE( 60) return HX_("Internal Server Error",4e,49,be,d4);
+ }
+ break;
+ case (int)501: {
+HXLINE( 61) return HX_("Not Implemented",f5,b5,64,18);
+ }
+ break;
+ case (int)502: {
+HXLINE( 62) return HX_("Bad Gateway",69,c2,d4,00);
+ }
+ break;
+ case (int)503: {
+HXLINE( 63) return HX_("Service Unavailable",a5,bb,e8,07);
+ }
+ break;
+ case (int)504: {
+HXLINE( 64) return HX_("Gateway Timeout",45,72,81,e5);
+ }
+ break;
+ case (int)505: {
+HXLINE( 65) return HX_("HTTP Version Not Supported",e1,52,c5,3e);
+ }
+ break;
+ case (int)506: {
+HXLINE( 66) return HX_("Variant Also Negotiates",f3,a2,fb,f7);
+ }
+ break;
+ case (int)507: {
+HXLINE( 67) return HX_("Insufficient Storage",1e,5a,8e,43);
+ }
+ break;
+ case (int)508: {
+HXLINE( 68) return HX_("Loop Detected",be,f6,5c,fa);
+ }
+ break;
+ case (int)510: {
+HXLINE( 69) return HX_("Not Extended",a6,e9,37,23);
+ }
+ break;
+ case (int)511: {
+HXLINE( 70) return HX_("Network Authentication Required",75,3f,0a,86);
+ }
+ break;
+ default:{
+HXLINE( 71) return HX_("Unknown Status",48,89,45,e6);
+ }
+ }
+HXLINE( 9) return null();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(HttpStatusMessage_Impl__obj,fromCode,return )
+
+
+HttpStatusMessage_Impl__obj::HttpStatusMessage_Impl__obj()
+{
+}
+
+bool HttpStatusMessage_Impl__obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 8:
+ if (HX_FIELD_EQ(inName,"fromCode") ) { outValue = fromCode_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *HttpStatusMessage_Impl__obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *HttpStatusMessage_Impl__obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class HttpStatusMessage_Impl__obj::__mClass;
+
+static ::String HttpStatusMessage_Impl__obj_sStaticFields[] = {
+ HX_("fromCode",b7,7f,90,9f),
+ ::String(null())
+};
+
+void HttpStatusMessage_Impl__obj::__register()
+{
+ HttpStatusMessage_Impl__obj _hx_dummy;
+ HttpStatusMessage_Impl__obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("httpstatus._HttpStatusMessage.HttpStatusMessage_Impl_",c1,d3,37,02);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &HttpStatusMessage_Impl__obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(HttpStatusMessage_Impl__obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< HttpStatusMessage_Impl__obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = HttpStatusMessage_Impl__obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = HttpStatusMessage_Impl__obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace httpstatus
+} // end namespace _HttpStatusMessage
diff --git a/Sources/c_snikket/src/hx/Anon.cpp b/Sources/c_snikket/src/hx/Anon.cpp
new file mode 100644
index 0000000..6374367
--- /dev/null
+++ b/Sources/c_snikket/src/hx/Anon.cpp
@@ -0,0 +1,449 @@
+#include <hxcpp.h>
+#undef RegisterClass
+namespace hx
+{
+
+Dynamic FieldMapCreate() { return Dynamic(); }
+
+bool FieldMapGet(FieldMap *inMap, const String &inName, Dynamic &outValue)
+{
+ if (!inMap || !inMap->mPtr)
+ return false;
+
+ if (!__string_hash_exists(*inMap,inName))
+ return false;
+ outValue = __string_hash_get(*inMap, inName);
+ return true;
+}
+
+
+bool FieldMapGet(FieldMap *inMap, int inId, Dynamic &outValue)
+{
+ if (!inMap || !inMap->mPtr)
+ return false;
+
+ const String &key = __hxcpp_field_from_id(inId);
+ if (!__string_hash_exists(*inMap,key))
+ return false;
+ outValue = __string_hash_get(*inMap, key);
+ return true;
+}
+
+
+
+
+bool FieldMapHas(FieldMap *inMap, const String &inName)
+{
+ return inMap && inMap->mPtr && __string_hash_exists(*inMap,inName);
+}
+
+
+#ifdef HXCPP_GC_GENERATIONAL
+void FieldMapSet(hx::Object *inThis,FieldMap *inMap, const String &inName, const Dynamic &inValue)
+{
+ __string_hash_set(inThis,*inMap, inName, inValue,true);
+}
+#else
+void FieldMapSet(FieldMap *inMap, const String &inName, const Dynamic &inValue)
+{
+ __string_hash_set(*inMap, inName, inValue,true);
+}
+#endif
+
+
+void FieldMapAppendFields(FieldMap *inMap,Array<String> &outFields)
+{
+ Array<String> keys = __string_hash_keys(*inMap);
+ if (outFields->length==0)
+ outFields = keys;
+ else
+ outFields = outFields->concat(keys);
+}
+
+
+// -- Anon_obj -------------------------------------------------
+
+
+
+Anon_obj::Anon_obj(int inElements)
+{
+ mFixedFields = inElements;
+ //mFields = hx::FieldMapCreate();
+}
+
+void Anon_obj::__Mark(hx::MarkContext *__inCtx)
+{
+ if (mFixedFields)
+ {
+ VariantKey *fixed = getFixed();
+ for(int i=0;i<mFixedFields;i++)
+ HX_MARK_MEMBER(fixed[i].value);
+ }
+ HX_MARK_MEMBER(mFields);
+}
+
+#ifdef HXCPP_VISIT_ALLOCS
+void Anon_obj::__Visit(hx::VisitContext *__inCtx)
+{
+ if (mFixedFields)
+ {
+ VariantKey *fixed = getFixed();
+ for(int i=0;i<mFixedFields;i++)
+ HX_VISIT_MEMBER(fixed[i].value);
+ }
+ HX_VISIT_MEMBER(mFields);
+}
+#endif
+
+inline int Anon_obj::findFixed(const ::String &inKey, bool inSkip5)
+{
+ if (!mFixedFields || !inKey.isAsciiEncoded() )
+ return -1;
+ VariantKey *fixed = getFixed();
+
+ if (!inSkip5)
+ if (inKey.__s[HX_GC_CONST_ALLOC_MARK_OFFSET] & HX_GC_CONST_ALLOC_MARK_BIT)
+ {
+ for(int i=0;i<mFixedFields;i++)
+ {
+ if (fixed[i].key.__s == inKey.__s)
+ return i;
+ }
+ }
+
+
+ int sought = inKey.hash();
+
+ if (!inSkip5)
+ {
+ if (mFixedFields<5)
+ {
+ for(int i=0;i<mFixedFields;i++)
+ if (fixed[i].hash==sought && (
+ (fixed[i].key.length == inKey.length && !memcmp(fixed[i].key.raw_ptr(),inKey.raw_ptr(), inKey.length))))
+ return i;
+ return -1;
+ }
+ }
+
+ // Find node with same hash...
+ /* hash example
+ [0] = -3 <- min
+ [1] = -1
+ [2] = -1 (sought -1)
+ [3] = 4
+ [4] = 4 <- max
+ */
+
+ int min = inSkip5 ? 5 : 0;
+ if (fixed[min].hash>sought)
+ return -1;
+ if (fixed[min].hash!=sought)
+ {
+ int max = mFixedFields;
+ if (fixed[max-1].hash<sought)
+ return -1;
+
+ while(max>min+1)
+ {
+ int mid = (max+min)>>1;
+ if (fixed[mid].hash <= sought)
+ min = mid;
+ else
+ max = mid;
+ }
+ }
+
+ while(fixed[min].hash==sought)
+ {
+ // Might be multiple?
+ if ( fixed[min].key.length == inKey.length && !memcmp(fixed[min].key.raw_ptr(),inKey.raw_ptr(), inKey.length))
+ return min;
+
+ min++;
+ if (min>=mFixedFields)
+ break;
+ }
+
+ return -1;
+}
+
+hx::Val Anon_obj::__Field(const String &inName, hx::PropertyAccess inCallProp)
+{
+
+ #ifdef HX_SMART_STRINGS
+ if (inName.isAsciiEncodedQ())
+ #endif
+ if (mFixedFields>0)
+ {
+ VariantKey *fixed = getFixed();
+ if (inName.__s[HX_GC_CONST_ALLOC_MARK_OFFSET] & HX_GC_CONST_ALLOC_MARK_BIT)
+ {
+ for(int i=0;i<mFixedFields;i++)
+ {
+ if (fixed[i].key.__s == inName.__s)
+ return fixed[i].value;
+ }
+ }
+
+ int hash = inName.hash();
+ if (fixed->hash==hash && HX_QSTR_EQ_AE(fixed->key,inName))
+ return fixed->value;
+ if (mFixedFields>1)
+ {
+ fixed++;
+ if (fixed->hash==hash && HX_QSTR_EQ_AE(fixed->key,inName))
+ return fixed->value;
+ if (mFixedFields>2)
+ {
+ fixed++;
+ if (fixed->hash==hash && HX_QSTR_EQ_AE(fixed->key,inName))
+ return fixed->value;
+ if (mFixedFields>3)
+ {
+ fixed++;
+ if (fixed->hash==hash && HX_QSTR_EQ_AE(fixed->key,inName))
+ return fixed->value;
+ if (mFixedFields>4)
+ {
+ fixed++;
+ if (fixed->hash==hash && HX_QSTR_EQ_AE(fixed->key,inName))
+ return fixed->value;
+
+ int fixed = findFixed(inName,true);
+ if (fixed>=0)
+ return getFixed()[fixed].value;
+ }
+ }
+ }
+ }
+ }
+
+
+ if (!mFields.mPtr)
+ return hx::Val();
+
+ return __string_hash_get(mFields,inName);
+}
+
+bool Anon_obj::__HasField(const String &inName)
+{
+ if (findFixed(inName)>=0)
+ return true;
+ if (!mFields.mPtr)
+ return false;
+ return __string_hash_exists(mFields,inName);
+}
+
+bool Anon_obj::__Remove(String inKey)
+{
+ int slot = findFixed(inKey);
+ if (slot>=0)
+ {
+ VariantKey *fixed = getFixed();
+ while(slot<mFixedFields)
+ {
+ fixed[slot] = fixed[slot+1];
+ slot++;
+ }
+ mFixedFields--;
+ return true;
+ }
+
+ if (!mFields.mPtr)
+ return false;
+ return __string_hash_remove(mFields,inKey);
+}
+
+
+hx::Val Anon_obj::__SetField(const String &inName,const hx::Val &inValue, hx::PropertyAccess inCallProp)
+{
+ int slot = findFixed(inName);
+ if (slot>=0)
+ {
+ #ifdef HXCPP_GC_GENERATIONAL
+ VariantKey *fixed = getFixed() + slot;
+ fixed->value=inValue;
+ if (fixed->value.type <= cpp::Variant::typeString)
+ HX_OBJ_WB_GET(this, fixed->value.valObject);
+ #else
+ getFixed()[slot].value=inValue;
+ #endif
+ return inValue;
+ }
+
+ // TODO - fixed
+ if (!mFields.mPtr)
+ {
+ mFields = hx::FieldMapCreate();
+ HX_OBJ_WB_GET(this, mFields.mPtr);
+ }
+
+ __string_hash_set(HX_MAP_THIS_ mFields,inName,inValue,true);
+ return inValue;
+}
+
+Anon_obj *Anon_obj::Add(const String &inName,const Dynamic &inValue,bool inSetThisPointer)
+{
+ // TODO - fixed
+ if (!mFields.mPtr)
+ {
+ mFields = hx::FieldMapCreate();
+ HX_OBJ_WB_GET(this, mFields.mPtr);
+ }
+
+ __string_hash_set(HX_MAP_THIS_ mFields,inName,inValue,true);
+ if (inSetThisPointer && inValue.GetPtr())
+ inValue.GetPtr()->__SetThis(this);
+ return this;
+}
+
+static int _hx_toString_depth = 0;
+String Anon_obj::toString()
+{
+ if (!mFields.mPtr && !mFixedFields)
+ return HX_CSTRING("{ }");
+
+ if (_hx_toString_depth >= 5)
+ return HX_CSTRING("...");
+
+ _hx_toString_depth++;
+
+ try
+ {
+ int fixedToString = findFixed(HX_CSTRING("toString"));
+ if (fixedToString>=0)
+ {
+ Dynamic func = getFixed()[fixedToString].value;
+ if (func!=null())
+ {
+ String res = func();
+ _hx_toString_depth--;
+ return res;
+ }
+ }
+
+ Dynamic func;
+ if (FieldMapGet(&mFields, HX_CSTRING("toString"), func))
+ {
+ String res = func();
+ _hx_toString_depth--;
+ return res;
+ }
+
+ if (mFixedFields)
+ {
+ Array<String> array = Array<String>(0,mFixedFields*4+4);
+ array->push(HX_CSTRING("{ "));
+
+ if (mFields.mPtr)
+ {
+ String val = __string_hash_to_string_raw(mFields);
+ if (val.raw_ptr())
+ array->push(val);
+ }
+
+ VariantKey *fixed = getFixed();
+ for(int i=0;i<mFixedFields;i++)
+ {
+ if (array->length>1)
+ array->push(HX_CSTRING(", "));
+
+ array->push(fixed[i].key);
+ array->push(HX_CSTRING(" => "));
+ array->push(fixed[i].value);
+ }
+ array->push(HX_CSTRING(" }"));
+ _hx_toString_depth--;
+ return array->join(HX_CSTRING(""));
+ }
+
+ String ret = __string_hash_to_string(mFields);
+ _hx_toString_depth--;
+ return ret;
+ } catch (...)
+ {
+ _hx_toString_depth--;
+ throw;
+ }
+}
+
+void Anon_obj::__GetFields(Array<String> &outFields)
+{
+ if (mFields.mPtr)
+ outFields = __string_hash_keys(mFields);
+ if (mFixedFields>0)
+ {
+ VariantKey *fixed = getFixed();
+ for(int i=0;i<mFixedFields;i++)
+ outFields->push( fixed[i].key );
+ }
+}
+
+
+String Anon_obj::__ToString() const { return HX_CSTRING("Anon"); }
+
+Dynamic Anon_obj::__Create(DynamicArray inArgs) { return Anon(new (0) Anon_obj); }
+
+hx::Class Anon_obj::__mClass;
+
+
+void Anon_obj::__boot()
+{
+ Static(__mClass) = hx::_hx_RegisterClass(HX_CSTRING("__Anon"),TCanCast<Anon_obj>,sNone,sNone,0,0,0,0);
+}
+
+
+
+Anon SourceInfo(String inFile, int inLine, String inClass, String inMethod)
+{
+ Anon result = Anon_obj::Create();
+ result->Add(HX_CSTRING("fileName"),inFile);
+ result->Add(HX_CSTRING("lineNumber"),inLine);
+ result->Add(HX_CSTRING("className"),inClass);
+ result->Add(HX_CSTRING("methodName"),inMethod);
+ return result;
+}
+
+String StringFromAnonFields(hx::Object *inPtr)
+{
+ Array<String> fields = Array_obj<String>::__new();
+ inPtr->__GetFields(fields);
+
+ int n = fields->length;
+ Array<String> array = Array<String>(0,n*4+4);
+ array->push(HX_CSTRING("{ "));
+ for(int i=0;i<n;i++)
+ {
+ if (array->length>1)
+ array->push(HX_CSTRING(", "));
+
+ array->push(fields[i]);
+ array->push(HX_CSTRING(" => "));
+ array->push( inPtr->__Field( fields[i], HX_PROP_DYNAMIC) );
+ }
+ array->push(HX_CSTRING(" }"));
+ return array->join(HX_CSTRING(""));
+}
+
+
+
+
+}
+
+bool __hxcpp_anon_remove(Dynamic inObj,String inKey)
+{
+ hx::Anon_obj *anon = dynamic_cast<hx::Anon_obj *>(inObj.mPtr);
+ if (anon)
+ {
+ bool removed = anon->__Remove(inKey);
+ if (removed)
+ return true;
+ }
+ Dynamic *map = inObj->__GetFieldMap();
+ if (map)
+ return __string_hash_remove(*map,inKey);
+ return false;
+}
+
+
diff --git a/Sources/c_snikket/src/hx/Boot.cpp b/Sources/c_snikket/src/hx/Boot.cpp
new file mode 100644
index 0000000..5378960
--- /dev/null
+++ b/Sources/c_snikket/src/hx/Boot.cpp
@@ -0,0 +1,35 @@
+#include <hxcpp.h>
+#include <hxMath.h>
+
+#ifdef HX_WINRT
+#include<Roapi.h>
+#endif
+namespace hx
+{
+
+void Boot()
+{
+ //__hxcpp_enable(false);
+ #ifdef HX_WINRT
+ HRESULT hr = ::RoInitialize( RO_INIT_MULTITHREADED );
+ #endif
+
+ #ifdef GPH
+ setvbuf( stdout , 0 , _IONBF , 0 );
+ setvbuf( stderr , 0 , _IONBF , 0 );
+ #endif
+
+ __hxcpp_stdlibs_boot();
+ Object::__boot();
+ Dynamic::__boot();
+ hx::Class_obj::__boot();
+ String::__boot();
+ Anon_obj::__boot();
+ ArrayBase::__boot();
+ EnumBase_obj::__boot();
+ Math_obj::__boot();
+}
+
+}
+
+
diff --git a/Sources/c_snikket/src/hx/CFFI.cpp b/Sources/c_snikket/src/hx/CFFI.cpp
new file mode 100644
index 0000000..c299571
--- /dev/null
+++ b/Sources/c_snikket/src/hx/CFFI.cpp
@@ -0,0 +1,1013 @@
+#include <hxcpp.h>
+#include <stdio.h>
+#include <hx/Memory.h>
+#include <hx/OS.h>
+
+#define IGNORE_CFFI_API_H
+
+#include <hx/CFFI.h>
+#include <map>
+#include <string>
+
+#ifdef _MSC_VER
+#pragma warning( disable : 4190 )
+#endif
+
+
+// Class for boxing external handles
+
+namespace hx
+{
+
+class Abstract_obj : public Object
+{
+public:
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdAbstract };
+
+ Abstract_obj(int inType,void *inData)
+ {
+ mType = inType;
+ mHandle = inData;
+ mFinalizer = 0;
+ mMarkSize = 0;
+ }
+
+ Abstract_obj(int inType,int inSize, finalizer inFinalizer)
+ {
+ mType = inType;
+ mFinalizer = 0;
+ mMarkSize = 0;
+ mHandle = 0;
+ if (inSize)
+ {
+ mMarkSize = inSize;
+ mHandle = HxAlloc(inSize);
+ memset(mHandle,0,mMarkSize);
+ }
+
+ SetFinalizer(inFinalizer);
+ }
+
+
+ virtual int __GetType() const { return mType; }
+ virtual hx::ObjectPtr<hx::Class_obj> __GetClass() const { return 0; }
+ virtual bool __IsClass(hx::Class inClass ) const { return false; }
+
+ virtual void *__GetHandle() const
+ {
+ return mHandle;
+ }
+
+ void __Mark(hx::MarkContext *__inCtx)
+ {
+ HX_MARK_MEMBER(_hxcpp_toString);
+ if (mMarkSize>=sizeof(void *) && mHandle)
+ {
+ hx::MarkConservative((int *)mHandle, ((int *)mHandle) + (mMarkSize/sizeof(int)), __inCtx );
+ }
+ }
+
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx)
+ {
+ HX_VISIT_MEMBER(_hxcpp_toString);
+ if (mFinalizer)
+ mFinalizer->Visit(__inCtx);
+ }
+ #endif
+
+ void SetFinalizer(finalizer inFinalizer)
+ {
+ if (!inFinalizer)
+ {
+ if (mFinalizer)
+ mFinalizer->Detach();
+ mFinalizer = 0;
+ }
+ else
+ {
+ if (!mFinalizer)
+ mFinalizer = new hx::InternalFinalizer(this);
+ mFinalizer->mFinalizer = inFinalizer;
+ }
+ }
+ void Clear()
+ {
+ SetFinalizer(0);
+ mType = 0;
+ if (mMarkSize && mHandle)
+ HxFree(mHandle);
+ mHandle = 0;
+ }
+
+ String toString()
+ {
+ if (_hxcpp_toString.mPtr)
+ return _hxcpp_toString( Dynamic(this) );
+
+ char buffer[40];
+ snprintf(buffer,sizeof(buffer),"0x%p", mHandle);
+
+ return HX_CSTRING("Abstract(") +
+ __hxcpp_get_kind(this) +
+ HX_CSTRING(":") +
+ String::create(buffer,strlen(buffer)) +
+ HX_CSTRING(")");
+ }
+
+ hx::Val __Field(const String &inString, hx::PropertyAccess inCallProp)
+ {
+ if (inString==HX_CSTRING("_hxcpp_toString")) return _hxcpp_toString;
+ if (inString==HX_CSTRING("_hxcpp_kind")) return __hxcpp_get_kind(this);
+ return hx::Object::__Field(inString, inCallProp);
+ }
+
+ hx::Val __SetField(const String &inName,const hx::Val &inValue, hx::PropertyAccess inCallProp)
+ {
+ if (inName==HX_CSTRING("_hxcpp_toString"))
+ {
+ _hxcpp_toString = inValue;
+ return inValue;
+ }
+ return hx::Object::__SetField(inName, inValue,inCallProp);
+ }
+
+
+ Dynamic _hxcpp_toString;
+ hx::InternalFinalizer *mFinalizer;
+ void *mHandle;
+ int mType;
+ int mMarkSize;
+};
+
+typedef ObjectPtr<Abstract_obj> Abstract;
+
+} // end namespace hx
+
+vkind k_int32 = (vkind)vtAbstractBase;
+vkind k_hash = (vkind)(vtAbstractBase + 1);
+vkind k_cpp_pointer = (vkind)(vtAbstractBase + 2);
+vkind k_cpp_struct = (vkind)(vtAbstractBase + 3);
+vkind k_cpp_objc = (vkind)(vtAbstractBase + 4);
+static int sgKinds = (int)(vtAbstractBase + 5);
+
+typedef std::map<std::string,int> KindMap;
+typedef std::map<int,std::string> ReverseKindMap;
+static KindMap sgKindMap;
+static ReverseKindMap sgReverseKindMap;
+
+
+int hxcpp_alloc_kind()
+{
+ return ++sgKinds;
+}
+
+
+void hxcpp_kind_share(int &ioKind,const char *inName)
+{
+ int &kind = sgKindMap[inName];
+ if (kind==0)
+ kind = hxcpp_alloc_kind();
+ ioKind = kind;
+ sgReverseKindMap[kind] = inName;
+}
+
+String __hxcpp_get_kind(Dynamic inObject)
+{
+ int type = inObject->__GetType();
+ if (type<vtAbstractBase)
+ return null();
+ if (type==(int)(size_t)k_cpp_pointer)
+ return HX_CSTRING("cpp.Pointer");
+ ReverseKindMap::const_iterator it = sgReverseKindMap.find(type);
+ if (it==sgReverseKindMap.end())
+ return null();
+ return String::create(it->second.c_str(), it->second.size());
+}
+
+
+//#define THROWS throw(Dynamic)
+#define THROWS
+
+
+extern "C" {
+
+
+/*
+ This bit of Macro magic is used to define extern function pointers
+ in ndlls, define stub implementations that link back to the hxcpp dll
+ and glue up the implementation in the hxcpp runtime.
+
+ For the static link case, these functions are linked directly.
+*/
+
+void hx_error() THROWS
+{
+ hx::Throw( HX_CSTRING("ERROR") );
+}
+
+
+void val_throw(hx::Object * arg1) THROWS
+{
+ if (arg1==0)
+ hx::Throw( null() );
+ hx::Throw( arg1 );
+}
+
+
+void hx_fail(const char * inMessage,const char * inFile,int inLine)
+{
+ if (inFile!=0 && inLine!=0)
+ hx::Throw( HX_CSTRING("Failure ") + String(inMessage) + HX_CSTRING(" @ ") +
+ String(inFile) + HX_CSTRING(":") + Dynamic(inLine) );
+ else
+ hx::Throw( HX_CSTRING("Failure ") + String(inMessage) );
+}
+
+
+
+// Determine hx::Object * type
+int val_type(hx::Object * arg1)
+{
+ if (arg1==0)
+ return valtNull;
+ return arg1->__GetType();
+}
+
+\
+vkind val_kind(hx::Object * arg1) THROWS
+{
+ if (arg1==0)
+ hx::Throw( HX_CSTRING("Value has no 'kind'") );
+ int type = arg1->__GetType();
+ if (type<valtAbstractBase)
+ hx::Throw( HX_CSTRING("Value has no 'kind'") );
+ return (vkind)(intptr_t)(type);
+}
+
+
+void * val_to_kind(hx::Object * arg1,vkind arg2)
+{
+ if (arg1==0)
+ return 0;
+ if ((int)(intptr_t)arg2 == arg1->__GetType())
+ return arg1->__GetHandle();
+ return 0;
+}
+
+
+// don't check the 'kind' ...
+void * val_data(hx::Object * arg1)
+{
+ if (arg1==0)
+ return 0;
+ return arg1->__GetHandle();
+}
+
+
+int val_fun_nargs(hx::Object * arg1)
+{
+ if (arg1==0)
+ return faNotFunction;
+ return arg1->__ArgCount();
+}
+
+
+
+
+// Extract hx::Object * type
+bool val_bool(hx::Object * arg1)
+{
+ if (arg1==0) return false;
+ return arg1->__ToInt()!=0;
+}
+
+
+int val_int(hx::Object * arg1)
+{
+ if (arg1==0) return 0;
+ return arg1->__ToInt();
+}
+
+
+double val_float(hx::Object * arg1)
+{
+ if (arg1==0) return 0.0;
+ return arg1->__ToDouble();
+}
+
+
+double val_number(hx::Object * arg1)
+{
+ if (arg1==0) return 0.0;
+ return arg1->__ToDouble();
+}
+
+
+
+// Create hx::Object * type
+
+hx::Object * alloc_null() { return 0; }
+hx::Object * alloc_bool(bool arg1) { return Dynamic(arg1).GetPtr(); }
+hx::Object * alloc_int(int arg1) { return Dynamic(arg1).GetPtr(); }
+hx::Object * alloc_float(double arg1) { return Dynamic(arg1).GetPtr(); }
+hx::Object * alloc_empty_object() { return new hx::Anon_obj(); }
+
+
+hx::Object * alloc_abstract(vkind arg1,void * arg2)
+{
+ int type = (int)(intptr_t)arg1;
+ return new hx::Abstract_obj(type,arg2);
+}
+
+hx::Object *create_abstract(vkind inKind,int inMemSize, hx::finalizer inFree )
+{
+ int type = (int)(intptr_t)inKind;
+
+ return new hx::Abstract_obj(type,inMemSize,inFree);
+}
+
+
+void free_abstract(hx::Object *obj)
+{
+ if (obj)
+ {
+ hx::Abstract_obj *abstract = dynamic_cast<hx::Abstract_obj *>(obj);
+ if (abstract)
+ abstract->Clear();
+ }
+}
+
+hx::Object * alloc_best_int(int arg1) { return Dynamic(arg1).GetPtr(); }
+hx::Object * alloc_int32(int arg1) { return Dynamic(arg1).GetPtr(); }
+
+
+
+// String access
+int val_strlen(hx::Object * arg1)
+{
+ if (arg1==0) return 0;
+ return arg1->toString().length;
+}
+
+
+const wchar_t * val_wstring(hx::Object * arg1)
+{
+ if (arg1==0) return L"";
+ return arg1->toString().__WCStr();
+}
+
+
+const char * val_string(hx::Object * arg1)
+{
+ if (arg1==0) return "";
+ return arg1->__CStr();
+}
+
+
+hx::Object * alloc_string(const char * arg1)
+{
+ return Dynamic( String::create(arg1) ).GetPtr();
+}
+
+hx::StringEncoding hxs_encoding(const String &str)
+{
+ #ifdef HX_SMART_STRINGS
+ if (str.isUTF16Encoded())
+ return hx::StringUtf16;
+ else
+ return hx::StringAscii;
+ #else
+ return hx::StringUtf8;
+ #endif
+}
+
+
+wchar_t * val_dup_wstring(value inVal)
+{
+ hx::Object *obj = (hx::Object *)inVal;
+ if (!obj)
+ return 0;
+ String s = obj->toString();
+ if (!s.raw_ptr())
+ return 0;
+ #ifdef HX_SMART_STRINGS
+ if ( sizeof(wchar_t)==2 && s.isUTF16Encoded())
+ {
+ wchar_t *result = (wchar_t *)hx::NewGCBytes(0,(s.length+1)*2);
+ memcpy(result, s.wchar_str(), s.length*2 );
+ result[s.length]=0;
+ return result;
+ }
+ #endif
+ return (wchar_t *)s.wchar_str();
+}
+
+char * val_dup_string(value inVal)
+{
+ hx::Object *obj = (hx::Object *)inVal;
+ if (!obj) return 0;
+ String s = obj->toString();
+ if (!s.raw_ptr())
+ return 0;
+ #ifdef HX_SMART_STRINGS
+ if (s.isUTF16Encoded())
+ return (char *)s.utf8_str();
+ #endif
+
+ char *result = (char *)hx::NewGCBytes(0,s.length+1);
+ memcpy(result, s.raw_ptr(), s.length);
+ result[s.length] = 0;
+ return result;
+}
+
+
+char *alloc_string_data(const char *inData, int inLength)
+{
+ char *result = (char *)hx::NewGCBytes(0,inLength+1);
+ if (inData)
+ {
+ memcpy(result, inData, inLength);
+ result[inLength] = 0;
+ }
+ return result;
+}
+
+hx::Object *alloc_string_len(const char *inStr,int inLen)
+{
+ return Dynamic( String::create(inStr,inLen) ).GetPtr();
+}
+
+hx::Object *alloc_wstring_len(const wchar_t *inStr,int inLen)
+{
+ String str = String::create(inStr,inLen);
+ return Dynamic(str).GetPtr();
+}
+
+// Array access - generic
+int val_array_size(hx::Object * arg1)
+{
+ if (arg1==0) return 0;
+ return arg1->__length();
+}
+
+
+hx::Object * val_array_i(hx::Object * arg1,int arg2)
+{
+ if (arg1==0) return 0;
+ return arg1->__GetItem(arg2).GetPtr();
+}
+
+void val_array_set_i(hx::Object * arg1,int arg2,hx::Object *inVal)
+{
+ if (arg1==0) return;
+ arg1->__SetItem(arg2, Dynamic(inVal) );
+}
+
+void val_array_set_size(hx::Object * arg1,int inLen)
+{
+ hx::ArrayBase *base = dynamic_cast<hx::ArrayBase *>(arg1);
+ if (base)
+ {
+ base->__SetSize(inLen);
+ }
+ else
+ {
+ cpp::VirtualArray_obj *va = dynamic_cast<cpp::VirtualArray_obj *>(arg1);
+ if (va)
+ va->__SetSize(inLen);
+ }
+}
+
+void val_array_push(hx::Object * arg1,hx::Object *inValue)
+{
+ hx::ArrayBase *base = dynamic_cast<hx::ArrayBase *>(arg1);
+ if (base==0) return;
+ base->__push(inValue);
+}
+
+
+hx::Object * alloc_array(int arg1)
+{
+ Array<Dynamic> array(arg1,arg1);
+ return array.GetPtr();
+}
+
+
+
+// Array access - fast if possible - may return null
+// Resizing the array may invalidate the pointer
+bool * val_array_bool(hx::Object * arg1)
+{
+ hx::ArrayCommon *common = dynamic_cast< hx::ArrayCommon * >(arg1);
+ if (!common) return 0;
+ arg1 = common->__GetRealObject();
+ Array_obj<bool> *a = dynamic_cast< Array_obj<bool> * >(arg1);
+ if (a==0)
+ return 0;
+ return (bool *)a->GetBase();
+}
+
+
+int * val_array_int(hx::Object * arg1)
+{
+ hx::ArrayCommon *common = dynamic_cast< hx::ArrayCommon * >(arg1);
+ if (!common) return 0;
+ arg1 = common->__GetRealObject();
+ Array_obj<int> *a = dynamic_cast< Array_obj<int> * >(arg1);
+ if (a==0)
+ return 0;
+ return (int *)a->GetBase();
+}
+
+
+double * val_array_double(hx::Object * arg1)
+{
+ hx::ArrayCommon *common = dynamic_cast< hx::ArrayCommon * >(arg1);
+ if (!common) return 0;
+ arg1 = common->__GetRealObject();
+ Array_obj<double> *a = dynamic_cast< Array_obj<double> * >(arg1);
+ if (a==0)
+ return 0;
+ return (double *)a->GetBase();
+}
+
+
+float * val_array_float(hx::Object * arg1)
+{
+ hx::ArrayCommon *common = dynamic_cast< hx::ArrayCommon * >(arg1);
+ if (!common) return 0;
+ arg1 = common->__GetRealObject();
+ Array_obj<float> *a = dynamic_cast< Array_obj<float> * >(arg1);
+ if (a==0)
+ return 0;
+ return (float *)a->GetBase();
+}
+
+value * val_array_value(hx::Object * arg1)
+{
+ return 0;
+}
+
+
+
+
+typedef Array_obj<unsigned char> *ByteArray;
+
+// Byte arrays
+// The byte array may be a string or a Array<bytes> depending on implementation
+buffer val_to_buffer(hx::Object * arg1)
+{
+ ByteArray b = dynamic_cast< ByteArray >(arg1);
+ return (buffer)b;
+}
+
+bool val_is_buffer(value inVal) { return val_to_buffer((hx::Object *)inVal)!=0; }
+
+
+
+buffer alloc_buffer(const char *inStr)
+{
+ int len = inStr ? strlen(inStr) : 0;
+ ByteArray b = new Array_obj<unsigned char>(len,len);
+ if (len)
+ memcpy(b->GetBase(),inStr,len);
+ return (buffer)b;
+}
+
+
+buffer alloc_buffer_len(int inLen)
+{
+ ByteArray b = new Array_obj<unsigned char>(inLen,inLen);
+ return (buffer)b;
+}
+
+
+value buffer_val(buffer b)
+{
+ return (value)b;
+}
+
+
+value buffer_to_string(buffer inBuffer)
+{
+ ByteArray b = (ByteArray) inBuffer;
+ String str(b->GetBase(),b->length);
+ Dynamic d(str);
+ return (value)d.GetPtr();
+}
+
+
+void buffer_append(buffer inBuffer,const char *inStr)
+{
+ ByteArray b = (ByteArray)inBuffer;
+ int olen = b->length;
+ int len = strlen(inStr);
+ b->__SetSize(olen+len);
+ memcpy(b->GetBase()+olen,inStr,len);
+
+}
+
+
+int buffer_size(buffer inBuffer)
+{
+ ByteArray b = (ByteArray)inBuffer;
+ return b->length;
+}
+
+
+void buffer_set_size(buffer inBuffer,int inLen)
+{
+ ByteArray b = (ByteArray)inBuffer;
+ b->__SetSize(inLen);
+}
+
+
+void buffer_append_sub(buffer inBuffer,const char *inStr,int inLen)
+{
+ ByteArray b = (ByteArray)inBuffer;
+ int olen = b->length;
+ b->__SetSize(olen+inLen);
+ memcpy(b->GetBase()+olen,inStr,inLen);
+}
+
+
+void buffer_append_char(buffer inBuffer,int inChar)
+{
+ ByteArray b = (ByteArray)inBuffer;
+ b->Add(inChar);
+}
+
+
+char * buffer_data(buffer inBuffer)
+{
+ ByteArray b = (ByteArray)inBuffer;
+ return b->GetBase();
+}
+
+
+// Append value to buffer
+void val_buffer(buffer inBuffer,value inValue)
+{
+ hx::Object *obj = (hx::Object *)inValue;
+ if (obj)
+ {
+ buffer_append(inBuffer, obj->toString().__CStr());
+ }
+ else
+ {
+ buffer_append_sub(inBuffer,"null",4);
+ }
+}
+
+
+
+
+
+
+// Call Function
+hx::Object * val_call0(hx::Object * arg1) THROWS
+{
+ if (!arg1) Dynamic::ThrowBadFunctionError();
+ return arg1->__run().GetPtr();
+}
+
+hx::Object * val_call0_traceexcept(hx::Object * arg1) THROWS
+{
+ try
+ {
+ if (!arg1) Dynamic::ThrowBadFunctionError();
+ return arg1->__run().GetPtr();
+ }
+ catch(Dynamic e)
+ {
+ String s = e;
+ fprintf(stderr,"Fatal Error : %s\n",s.__CStr());
+ exit(1);
+ }
+ return 0;
+}
+
+
+hx::Object * val_call1(hx::Object * arg1,hx::Object * arg2) THROWS
+{
+ if (!arg1) Dynamic::ThrowBadFunctionError();
+ return arg1->__run(arg2).GetPtr();
+}
+
+
+hx::Object * val_call2(hx::Object * arg1,hx::Object * arg2,hx::Object * arg3) THROWS
+{
+ if (!arg1) Dynamic::ThrowBadFunctionError();
+ return arg1->__run(arg2,arg3).GetPtr();
+}
+
+
+hx::Object * val_call3(hx::Object * arg1,hx::Object * arg2,hx::Object * arg3,hx::Object * arg4) THROWS
+{
+ if (!arg1) Dynamic::ThrowBadFunctionError();
+ return arg1->__run(arg2,arg3,arg4).GetPtr();
+}
+
+
+hx::Object * val_callN(hx::Object * arg1,hx::Object ** arg2, int nCount) THROWS
+{
+ if (!arg1) Dynamic::ThrowBadFunctionError();
+ Array<Dynamic> args = Array_obj<Dynamic>::__new(0, nCount);
+ while (nCount--)
+ args << *arg2++;
+ return arg1->__Run( args ).GetPtr();
+}
+
+
+// Call object field
+hx::Object * val_ocall0(hx::Object * arg1,int arg2) THROWS
+{
+ if (!arg1) hx::Throw(HX_INVALID_OBJECT);
+ return arg1->__IField(arg2)->__run().GetPtr();
+}
+
+
+hx::Object * val_ocall1(hx::Object * arg1,int arg2,hx::Object * arg3) THROWS
+{
+ if (!arg1) hx::Throw(HX_INVALID_OBJECT);
+ return arg1->__IField(arg2)->__run(arg3).GetPtr();
+}
+
+
+hx::Object * val_ocall2(hx::Object * arg1,int arg2,hx::Object * arg3,hx::Object * arg4) THROWS
+{
+ if (!arg1) hx::Throw(HX_INVALID_OBJECT);
+ return arg1->__IField(arg2)->__run(arg3,arg4).GetPtr();
+}
+
+
+hx::Object * val_ocall3(hx::Object * arg1,int arg2,hx::Object * arg3,hx::Object * arg4,hx::Object * arg5) THROWS
+{
+ if (!arg1) hx::Throw(HX_INVALID_OBJECT);
+ return arg1->__IField(arg2)->__run(arg3,arg4,arg5).GetPtr();
+}
+
+
+hx::Object * val_ocallN(hx::Object * arg1,int arg2,hx::Object * arg3) THROWS
+{
+ if (!arg1) hx::Throw(HX_INVALID_OBJECT);
+ return arg1->__IField(arg2)->__run(Dynamic(arg3)).GetPtr();
+}
+
+
+
+// Objects access
+int val_id(const char * arg1)
+{
+ return __hxcpp_field_to_id(arg1);
+}
+
+
+void alloc_field(hx::Object * arg1,int arg2,hx::Object * arg3) THROWS
+{
+ //hx::InternalCollect();
+ if (!arg1) hx::Throw(HX_INVALID_OBJECT);
+ arg1->__SetField(__hxcpp_field_from_id(arg2),arg3, HX_PROP_DYNAMIC );
+}
+void hxcpp_alloc_field(hx::Object * arg1,int arg2,hx::Object * arg3)
+{
+ return alloc_field(arg1,arg2,arg3);
+}
+
+void alloc_field_numeric(hx::Object * arg1,int arg2,double arg3) THROWS
+{
+ //hx::InternalCollect();
+ if (!arg1) hx::Throw(HX_INVALID_OBJECT);
+ arg1->__SetField(__hxcpp_field_from_id(arg2),arg3, HX_PROP_DYNAMIC );
+}
+void hxcpp_alloc_field_numeric(hx::Object * arg1,int arg2,double arg3)
+{
+ return alloc_field_numeric(arg1,arg2,arg3);
+}
+
+
+
+hx::Object * val_field(hx::Object * arg1,int arg2) THROWS
+{
+ if (!arg1) hx::Throw(HX_INVALID_OBJECT);
+ return arg1->__IField(arg2).GetPtr();
+}
+
+double val_field_numeric(hx::Object * arg1,int arg2) THROWS
+{
+ if (!arg1) hx::Throw(HX_INVALID_OBJECT);
+ return arg1->__INumField(arg2);
+}
+
+value val_field_name(field inField)
+{
+ return (value)Dynamic(__hxcpp_field_from_id(inField)).mPtr;
+}
+
+
+void val_iter_field_vals(hx::Object *inObj, __hx_field_iter inFunc ,void *inCookie)
+{
+ if (inObj)
+ {
+ Array<String> fields = Array_obj<String>::__new(0,0);
+
+ inObj->__GetFields(fields);
+
+ for(int i=0;i<fields->length;i++)
+ {
+ inFunc((value)Dynamic(inObj->__Field(fields[i], HX_PROP_NEVER )).mPtr, __hxcpp_field_to_id(fields[i].__CStr()), inCookie);
+ }
+ }
+}
+
+
+void val_iter_fields(hx::Object *inObj, __hx_field_iter inFunc ,void *inCookie)
+{
+ if (inObj)
+ {
+ Array<String> fields = Array_obj<String>::__new(0,0);
+
+ inObj->__GetFields(fields);
+
+ for(int i=0;i<fields->length;i++)
+ {
+ inFunc((value)inObj, __hxcpp_field_to_id(fields[i].__CStr()), inCookie);
+ }
+ }
+}
+
+
+
+ // Abstract types
+vkind alloc_kind()
+{
+ return (vkind)(intptr_t)hxcpp_alloc_kind();
+}
+
+void kind_share(vkind *inKind,const char *inName)
+{
+ int k = (int)(intptr_t)*inKind;
+ hxcpp_kind_share(k,inName);
+ *inKind = (vkind)(intptr_t)k;
+}
+
+
+
+// Garbage Collection
+void * hx_alloc(int arg1)
+{
+ return hx::NewGCBytes(0,arg1);
+}
+
+
+void * alloc_private(int arg1)
+{
+ return hx::NewGCPrivate(0,arg1);
+}
+
+hx::Object * alloc_raw_string(int length)
+{
+ return Dynamic( String( (HX_CHAR *) alloc_private(length+1), length) ).GetPtr();
+}
+
+void val_gc(hx::Object * arg1,hx::finalizer arg2) THROWS
+{
+ hx::Abstract_obj *abstract = dynamic_cast<hx::Abstract_obj *>(arg1);
+ if (!abstract)
+ {
+ hx::GCSetFinalizer(arg1,arg2);
+ //hx::Throw(HX_CSTRING("Finalizer not on abstract object"));
+ }
+ else
+ abstract->SetFinalizer(arg2);
+}
+
+void val_gc_ptr(void * arg1,hxPtrFinalizer arg2) THROWS
+{
+ hx::Throw(HX_CSTRING("Finalizer not supported here"));
+}
+
+void val_gc_add_root(hx::Object **inRoot)
+{
+ hx::GCAddRoot(inRoot);
+}
+
+
+void val_gc_remove_root(hx::Object **inRoot)
+{
+ hx::GCRemoveRoot(inRoot);
+}
+
+void gc_set_top_of_stack(int *inTopOfStack,bool inForce)
+{
+ hx::SetTopOfStack(inTopOfStack,inForce);
+}
+
+
+void gc_change_managed_memory(int inDelta, const char *inWhy)
+{
+ hx::GCChangeManagedMemory(inDelta, inWhy);
+}
+
+
+value *alloc_root()
+{
+ hx::Object ** result = new hx::Object *();
+ hx::GCAddRoot(result);
+ return (value *)result;
+}
+
+void free_root(value *inValue)
+{
+ hx::Object **root = (hx::Object **) inValue;
+ hx::GCRemoveRoot(root);
+ delete root;
+}
+
+
+// Used for finding functions in static libraries
+int hx_register_prim( const char * arg1, void* arg2)
+{
+ __hxcpp_register_prim(arg1,arg2);
+ return 0;
+}
+
+void gc_enter_blocking()
+{
+ hx::EnterGCFreeZone();
+}
+
+void gc_exit_blocking()
+{
+ hx::ExitGCFreeZone();
+}
+
+
+bool gc_try_blocking()
+{
+ return hx::TryGCFreeZone();
+}
+
+bool gc_try_unblocking()
+{
+ return hx::TryExitGCFreeZone();
+}
+
+
+void gc_safe_point()
+{
+ if (hx::gPauseForCollect)
+ hx::PauseForCollect();
+}
+
+gcroot create_root(value) { return 0; }
+value query_root(gcroot) { return 0; }
+void destroy_root(gcroot) { }
+
+
+String alloc_hxs_wchar(const wchar_t *ptr,int size)
+{
+ return String::create(ptr,size);
+}
+
+String alloc_hxs_utf16(const char16_t *ptr,int size)
+{
+ return String::create(ptr,size);
+}
+
+String alloc_hxs_utf8(const char *ptr,int size)
+{
+ return String::create(ptr,size);
+}
+
+const char * hxs_utf8(const String &string,hx::IStringAlloc *alloc)
+{
+ return string.utf8_str(alloc);
+}
+
+const wchar_t * hxs_wchar(const String &string,hx::IStringAlloc *alloc)
+{
+ return string.wchar_str(alloc);
+}
+
+const char16_t * hxs_utf16(const String &string,hx::IStringAlloc *alloc)
+{
+ return string.wc_str(alloc);
+}
+
+
+#ifndef HXCPP_STATIC_CFFI
+EXPORT
+#endif
+void * hx_cffi(const char *inName)
+{
+ #define HXCPP_PRIME
+ #define DEFFUNC(name,r,b,c) if ( !strcmp(inName,#name) ) return (void *)name;
+
+ #include <hx/CFFIAPI.h>
+
+ return 0;
+}
+
+}
diff --git a/Sources/c_snikket/src/hx/Class.cpp b/Sources/c_snikket/src/hx/Class.cpp
new file mode 100644
index 0000000..554775a
--- /dev/null
+++ b/Sources/c_snikket/src/hx/Class.cpp
@@ -0,0 +1,373 @@
+#include <hxcpp.h>
+#include <map>
+
+#ifdef ANDROID
+#include <android/log.h>
+#endif
+
+
+namespace hx
+{
+
+typedef std::map<String,Class> ClassMap;
+static ClassMap *sClassMap = 0;
+
+Class _hx_RegisterClass(const String &inClassName, CanCastFunc inCanCast,
+ String inStatics[], String inMembers[],
+ ConstructEmptyFunc inConstructEmpty, ConstructArgsFunc inConstructArgs,
+ Class *inSuperClass, ConstructEnumFunc inConstructEnum,
+ MarkFunc inMarkFunc
+ #ifdef HXCPP_VISIT_ALLOCS
+ ,VisitFunc inVisitFunc
+ #endif
+ #ifdef HXCPP_SCRIPTABLE
+ ,const hx::StorageInfo *inStorageInfo
+ ,const hx::StaticInfo *inStaticInfo
+ #endif
+ )
+{
+ if (sClassMap==0)
+ sClassMap = new ClassMap;
+
+ Class_obj *obj = new Class_obj(inClassName, inStatics, inMembers,
+ inConstructEmpty, inConstructArgs, inSuperClass,
+ inConstructEnum, inCanCast, inMarkFunc
+ #ifdef HXCPP_VISIT_ALLOCS
+ ,inVisitFunc
+ #endif
+ #ifdef HXCPP_SCRIPTABLE
+ ,inStorageInfo
+ ,inStaticInfo
+ #endif
+ );
+ Class c(obj);
+ (*sClassMap)[inClassName] = c;
+ return c;
+}
+
+void _hx_RegisterClass(const String &inClassName, Class inClass)
+{
+ if (sClassMap==0)
+ sClassMap = new ClassMap;
+ (*sClassMap)[inClassName] = inClass;
+}
+
+
+
+// -------- Class ---------------------------------------
+
+
+Class_obj::Class_obj(const String &inClassName,String inStatics[], String inMembers[],
+ ConstructEmptyFunc inConstructEmpty, ConstructArgsFunc inConstructArgs,
+ Class *inSuperClass,ConstructEnumFunc inConstructEnum,
+ CanCastFunc inCanCast, MarkFunc inFunc
+ #ifdef HXCPP_VISIT_ALLOCS
+ ,VisitFunc inVisitFunc
+ #endif
+ #ifdef HXCPP_SCRIPTABLE
+ ,const hx::StorageInfo *inStorageInfo
+ ,const hx::StaticInfo *inStaticInfo
+ #endif
+ )
+{
+ mName = inClassName.makePermanent();
+ mSuper = inSuperClass;
+ mConstructEmpty = inConstructEmpty;
+ mConstructArgs = inConstructArgs;
+ mConstructEnum = inConstructEnum;
+ mMarkFunc = inFunc;
+ #ifdef HXCPP_VISIT_ALLOCS
+ mVisitFunc = inVisitFunc;
+ #endif
+
+ #ifdef HXCPP_SCRIPTABLE
+ mMemberStorageInfo = inStorageInfo;
+ mStaticStorageInfo = inStaticInfo;
+ #endif
+
+ mStatics = dupFunctions(inStatics);
+ mMembers = dupFunctions(inMembers);
+ mCanCast = inCanCast;
+}
+
+bool Class_obj::GetNoStaticField(const String &inString, Dynamic &outValue, hx::PropertyAccess inCallProp)
+{
+ return false;
+}
+bool Class_obj::SetNoStaticField(const String &inString, Dynamic &ioValue, hx::PropertyAccess inCallProp)
+{
+ return false;
+}
+
+
+
+::Array< ::String > Class_obj::dupFunctions(String inFuncs[])
+{
+ if (!inFuncs)
+ return null();
+
+ int count = 0;
+ for(String *s = inFuncs; s->length; s++)
+ count++;
+
+ Array<String> result = Array_obj<String>::__newConstWrapper(&inFuncs[0],count);
+
+ return result;
+}
+
+void Class_obj::registerScriptable(bool inOverwrite)
+{
+ if (!inOverwrite && sClassMap->find(mName)!=sClassMap->end())
+ return;
+ (*sClassMap)[ mName ] = this;
+}
+
+Class Class_obj::GetSuper()
+{
+ if (!mSuper)
+ return null();
+ if (mSuper==&hx::Object::__SGetClass())
+ return null();
+ return *mSuper;
+}
+
+
+Class Class_obj__mClass;
+
+Class Class_obj::__GetClass() const { return Class_obj__mClass; }
+Class &Class_obj::__SGetClass() { return Class_obj__mClass; }
+
+void Class_obj::__boot()
+{
+Static(Class_obj__mClass) = hx::_hx_RegisterClass(HX_CSTRING("Class"),TCanCast<Class_obj>,sNone,sNone, 0,0 , 0, 0 );
+}
+
+
+void Class_obj::MarkStatics(hx::MarkContext *__inCtx)
+{
+ HX_MARK_MEMBER(__meta__);
+ if (mMarkFunc)
+ mMarkFunc(__inCtx);
+}
+#ifdef HXCPP_VISIT_ALLOCS
+void Class_obj::VisitStatics(hx::VisitContext *__inCtx)
+{
+ HX_VISIT_MEMBER(__meta__);
+ if (mVisitFunc)
+ mVisitFunc(__inCtx);
+}
+#endif
+
+Class Class_obj::Resolve(String inName)
+{
+ ClassMap::const_iterator i = sClassMap->find(inName);
+ if (i==sClassMap->end())
+ {
+ // Class class...
+ if (inName==HX_CSTRING("Enum"))
+ return Class_obj__mClass;
+ return null();
+ }
+ return i->second;
+}
+
+Dynamic Class_obj::ConstructEmpty()
+{
+ return mConstructEmpty();
+}
+
+Dynamic Class_obj::ConstructArgs(DynamicArray inArgs)
+{
+ return mConstructArgs(inArgs);
+}
+
+Dynamic Class_obj::ConstructEnum(String inName,DynamicArray inArgs)
+{
+ if (mConstructEnum==0)
+ return null();
+ return mConstructEnum(inName,inArgs);
+}
+
+
+
+String Class_obj::__ToString() const { return mName; }
+
+
+Array<String> Class_obj::GetInstanceFields()
+{
+ Array<String> result = mSuper && (*mSuper).mPtr != this ? (*mSuper)->GetInstanceFields() : Array<String>(0,0);
+ if (mMembers.mPtr)
+ for(int m=0;m<mMembers->size();m++)
+ {
+ const String &mem = mMembers[m];
+ if (result->Find(mem)==-1)
+ result.Add(mem);
+ }
+ return result;
+}
+
+Array<String> Class_obj::GetClassFields()
+{
+ Array<String> result = mStatics.mPtr ? mStatics->copy() : new Array_obj<String>(0,0);
+ if (__rtti__.raw_ptr())
+ result->push( HX_CSTRING("__rtti") );
+ return result;
+}
+
+bool Class_obj::__HasField(const String &inString)
+{
+ if (__rtti__.raw_ptr() && inString==HX_CSTRING("__rtti"))
+ return true;
+
+ if (mStatics.mPtr)
+ for(int s=0;s<mStatics->size();s++)
+ if (mStatics[s]==inString)
+ return true;
+ return false;
+}
+
+hx::Val Class_obj::__Field(const String &inString, hx::PropertyAccess inCallProp)
+{
+ if (inString==HX_CSTRING("__meta__"))
+ return __meta__;
+ if (inString==HX_CSTRING("__rtti"))
+ return __rtti__;
+
+ if (mGetStaticField)
+ {
+ Dynamic result;
+ if (mGetStaticField(inString,result,inCallProp))
+ return result;
+
+ // Throw ?
+ return null();
+ }
+
+ // Not the most efficient way of doing this!
+ if (!mConstructEmpty)
+ return null();
+ Dynamic instance = mConstructEmpty();
+ return instance->__Field(inString, inCallProp);
+}
+
+hx::Val Class_obj::__SetField(const String &inString,const hx::Val &inValue, hx::PropertyAccess inCallProp)
+{
+
+ if (mSetStaticField)
+ {
+ Dynamic result = inValue;
+ if (mSetStaticField(inString,result,inCallProp))
+ return result;
+
+ // Throw ?
+ return inValue;
+ }
+
+
+
+
+ // Not the most efficient way of doing this!
+ if (!mConstructEmpty)
+ return null();
+ Dynamic instance = mConstructEmpty();
+ return instance->__SetField(inString,inValue, inCallProp);
+}
+
+bool Class_obj::__IsEnum()
+{
+ return mConstructEnum || this==GetVoidClass().GetPtr() || this==GetBoolClass().GetPtr();
+}
+
+#ifdef HXCPP_SCRIPTABLE
+const hx::StorageInfo* Class_obj::GetMemberStorage(String inName)
+{
+ if (mMemberStorageInfo)
+ {
+ for(const StorageInfo *s = mMemberStorageInfo; s->offset; s++)
+ {
+ if (s->name == inName)
+ return s;
+ }
+ }
+ if (mSuper)
+ return (*mSuper)->GetMemberStorage(inName);
+ return 0;
+}
+
+
+const hx::StaticInfo* Class_obj::GetStaticStorage(String inName)
+{
+ if (mStaticStorageInfo)
+ {
+ for(const StaticInfo *s = mStaticStorageInfo; s->address; s++)
+ {
+ if (s->name == inName)
+ return s;
+ }
+ }
+ return 0;
+}
+
+
+#endif
+
+
+
+void MarkClassStatics(hx::MarkContext *__inCtx)
+{
+ #ifdef HXCPP_DEBUG
+ MarkPushClass("MarkClassStatics",__inCtx);
+ #endif
+ ClassMap::iterator end = sClassMap->end();
+ for(ClassMap::iterator i = sClassMap->begin(); i!=end; ++i)
+ {
+ Class c = i->second;
+ if (c->__meta__.mPtr || c->mMarkFunc)
+ {
+ #ifdef HXCPP_DEBUG
+ hx::MarkPushClass(i->first.raw_ptr(),__inCtx);
+ hx::MarkSetMember("statics",__inCtx);
+ #endif
+
+ c->MarkStatics(__inCtx);
+
+ #ifdef HXCPP_DEBUG
+ hx::MarkPopClass(__inCtx);
+ #endif
+ }
+ }
+ #ifdef HXCPP_DEBUG
+ MarkPopClass(__inCtx);
+ #endif
+}
+
+#ifdef HXCPP_VISIT_ALLOCS
+
+void VisitClassStatics(hx::VisitContext *__inCtx)
+{
+ HX_VISIT_MEMBER(Class_obj__mClass);
+ ClassMap::iterator end = sClassMap->end();
+ for(ClassMap::iterator i = sClassMap->begin(); i!=end; ++i)
+ i->second->VisitStatics(__inCtx);
+}
+
+#endif
+
+
+} // End namespace hx
+
+Array<String> __hxcpp_get_class_list()
+{
+ Array<String> result = Array_obj<String>::__new();
+ if (hx::sClassMap)
+ {
+ for(hx::ClassMap::iterator i=hx::sClassMap->begin(); i!=hx::sClassMap->end(); ++i)
+ {
+ if (i->second.mPtr)
+ result->push( i->first );
+ }
+ }
+ return result;
+}
+
+
diff --git a/Sources/c_snikket/src/hx/Date.cpp b/Sources/c_snikket/src/hx/Date.cpp
new file mode 100644
index 0000000..cdc665b
--- /dev/null
+++ b/Sources/c_snikket/src/hx/Date.cpp
@@ -0,0 +1,428 @@
+#include <hxcpp.h>
+
+#include <time.h>
+
+#ifdef HX_WINDOWS
+ #include <windows.h>
+#else
+ #include <stdint.h>
+ #if defined(__unix__) || defined(__APPLE__)
+ #include <unistd.h>
+ #include <stdio.h>
+ #if (_POSIX_VERSION >= 1)
+ #define USE_TIME_R
+ #endif
+ #if (_POSIX_VERSION >= 199309L)
+ #include <sys/time.h>
+ #define USE_CLOCK_GETTIME
+ #define USE_GETTIMEOFDAY
+ #endif
+ #endif
+ #if defined(__ORBIS__)
+ // fill in for a missing localtime_r with localtime_s
+ #define localtime_r localtime_s
+ #define gmtime_r gmtime_s
+ #endif
+#endif
+
+#ifdef HX_MACOS
+#include <mach/mach_time.h>
+#include <mach-o/dyld.h>
+#include <CoreServices/CoreServices.h>
+#endif
+
+#if defined(IPHONE) || defined(APPLETV)
+#include <QuartzCore/QuartzCore.h>
+#endif
+
+
+//#include <hxMacros.h>
+
+static double t0 = 0;
+double __hxcpp_time_stamp()
+{
+#ifdef HX_WINDOWS
+ static __int64 t0=0;
+ static double period=0;
+ __int64 now;
+
+ if (QueryPerformanceCounter((LARGE_INTEGER*)&now))
+ {
+ if (t0==0)
+ {
+ t0 = now;
+ __int64 freq;
+ QueryPerformanceFrequency((LARGE_INTEGER*)&freq);
+ if (freq!=0)
+ period = 1.0/freq;
+ }
+ if (period!=0)
+ return (now-t0)*period;
+ }
+
+ return (double)clock() / ( (double)CLOCKS_PER_SEC);
+#elif defined(HX_MACOS)
+ static double time_scale = 0.0;
+ if (time_scale==0.0)
+ {
+ mach_timebase_info_data_t info;
+ mach_timebase_info(&info);
+ time_scale = 1e-9 * (double)info.numer / info.denom;
+ }
+ double r = mach_absolute_time() * time_scale;
+ return mach_absolute_time() * time_scale;
+#else
+ #if defined(IPHONE) || defined(APPLETV)
+ double t = CACurrentMediaTime();
+ #elif defined(USE_GETTIMEOFDAY)
+ struct timeval tv;
+ if( gettimeofday(&tv,NULL) )
+ return 0;
+ double t = ( tv.tv_sec + ((double)tv.tv_usec) / 1000000.0 );
+ #elif defined(USE_CLOCK_GETTIME)
+ struct timespec ts;
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+ double t = ( ts.tv_sec + ((double)ts.tv_nsec)*1e-9 );
+ #else
+ double t = (double)clock() * (1.0 / CLOCKS_PER_SEC);
+ #endif
+ if (t0==0) t0 = t;
+ return t-t0;
+#endif
+}
+
+/*
+ * for the provided Epoch time, fills the passed struct tm with date_time representation in local time zone
+ */
+void __internal_localtime(double inSeconds, struct tm* time)
+{
+ time_t t = (time_t) inSeconds;
+ #ifdef USE_TIME_R
+ localtime_r(&t, time);
+ #else
+ struct tm *result = localtime(&t);
+ if (result)
+ *time = *result;
+ else
+ memset(time, 0, sizeof(*time) );
+ #endif
+}
+
+/*
+ * for the provided Epoch time, fills the passed struct tm with with date_time representation in UTC
+ */
+void __internal_gmtime(double inSeconds, struct tm* time)
+{
+ time_t t = (time_t) inSeconds;
+ #ifdef USE_TIME_R
+ gmtime_r(&t, time);
+ #else
+ *time = *gmtime(&t);
+ #endif
+}
+
+/*
+ * input: takes Y-M-D h:m:s.ms (considers that date parts are in local date_time representation)
+ * output: returns UTC time stamp (Epoch), in seconds
+ */
+double __hxcpp_new_date(int inYear,int inMonth,int inDay,int inHour, int inMin, int inSeconds, int inMilliseconds)
+{
+ struct tm time;
+
+ time.tm_isdst = -1;
+ time.tm_year = inYear - 1900;
+ time.tm_mon = inMonth;
+ time.tm_mday = inDay;
+ time.tm_hour = inHour;
+ time.tm_min = inMin;
+ time.tm_sec = inSeconds;
+
+ return (mktime(&time) + ((double) inMilliseconds * 0.001));
+}
+
+// Used by DateTools.makeUtc
+double __hxcpp_utc_date(int inYear,int inMonth,int inDay,int inHour, int inMin, int inSeconds)
+{
+ int diff;
+ time_t a, b;
+ struct tm time, *temp;
+
+ time.tm_year = inYear;
+ time.tm_isdst = -1;
+ time.tm_year = inYear - 1900;
+ time.tm_mon = inMonth;
+ time.tm_mday = inDay;
+ time.tm_hour = inHour;
+ time.tm_min = inMin;
+ time.tm_sec = inSeconds;
+
+ a = mktime(&time); //timestamp based on local interpretation of date parts
+ temp = gmtime(&a); //get utc date parts corresponding to this timestamp
+ temp->tm_isdst=-1; //reset dst flag for use in mktime
+ b = mktime(temp); //get timestamp for local interpretation of utc date parts
+ diff= a - b; //find difference in timestamp values .
+
+ return a+diff;
+}
+
+/*
+ * returns hh value (in hh:mm:ss) of date_time representation in local time zone
+ */
+int __hxcpp_get_hours(double inSeconds)
+{
+ struct tm time;
+ __internal_localtime( inSeconds, &time);
+ return time.tm_hour;
+}
+
+/*
+ * returns mm value (in hh:mm:ss) of date_time representation in local time zone
+ */
+int __hxcpp_get_minutes(double inSeconds)
+{
+ struct tm time;
+ __internal_localtime( inSeconds, &time);
+ return time.tm_min;
+}
+
+/*
+ * returns ss value (in hh:mm:ss) of date_time representation in local time zone
+ */
+int __hxcpp_get_seconds(double inSeconds)
+{
+ struct tm time;
+ __internal_localtime( inSeconds, &time);
+ return time.tm_sec;
+}
+
+/*
+ * returns YYYY value (in YYYY-MM-DD) of date_time representation in local time zone
+ */
+int __hxcpp_get_year(double inSeconds)
+{
+ struct tm time;
+ __internal_localtime( inSeconds, &time);
+ return (time.tm_year + 1900);
+}
+
+/*
+ * returns MM value (in YYYY-MM-DD) of date_time representation in local time zone
+ */
+int __hxcpp_get_month(double inSeconds)
+{
+ struct tm time;
+ __internal_localtime( inSeconds, &time);
+ return time.tm_mon;
+}
+
+/*
+ * returns DD value (in YYYY-MM-DD) of date_time representation in local time zone
+ */
+int __hxcpp_get_date(double inSeconds)
+{
+ struct tm time;
+ __internal_localtime( inSeconds, &time);
+ return time.tm_mday;
+}
+
+/*
+ * returns week day (as int, Sun=0...Sat=6) of date_time representation in local time zone
+ */
+int __hxcpp_get_day(double inSeconds)
+{
+ struct tm time;
+ __internal_localtime( inSeconds, &time);
+ return time.tm_wday;
+}
+
+/*
+ * returns hh value (in hh:mm:ss) of date_time representation in UTC
+ */
+int __hxcpp_get_utc_hours(double inSeconds)
+{
+ struct tm time;
+ __internal_gmtime( inSeconds, &time);
+ return time.tm_hour;
+}
+
+/*
+ * returns mm value (in hh:mm:ss) of date_time representation in UTC
+ */
+int __hxcpp_get_utc_minutes(double inSeconds)
+{
+ struct tm time;
+ __internal_gmtime( inSeconds, &time);
+ return time.tm_min;
+}
+
+/*
+ * returns ss value (in hh:mm:ss) of date_time representation in UTC
+ */
+int __hxcpp_get_utc_seconds(double inSeconds)
+{
+ struct tm time;
+ __internal_gmtime( inSeconds, &time);
+ return time.tm_sec;
+}
+
+/*
+ * returns YYYY value (in YYYY-MM-DD) of date_time representation in UTC
+ */
+int __hxcpp_get_utc_year(double inSeconds)
+{
+ struct tm time;
+ __internal_gmtime( inSeconds, &time);
+ return (time.tm_year + 1900);
+}
+
+/*
+ * returns MM value (in YYYY-MM-DD) of date_time representation in UTC
+ */
+int __hxcpp_get_utc_month(double inSeconds)
+{
+ struct tm time;
+ __internal_gmtime( inSeconds, &time);
+ return time.tm_mon;
+}
+
+/*
+ * returns DD value (in YYYY-MM-DD) of date_time representation in UTC
+ */
+int __hxcpp_get_utc_date(double inSeconds)
+{
+ struct tm time;
+ __internal_gmtime( inSeconds, &time);
+ return time.tm_mday;
+}
+
+/*
+ * returns week day (as int, Sun=0...Sat=6) of date_time representation in UTC
+ */
+int __hxcpp_get_utc_day(double inSeconds)
+{
+ struct tm time;
+ __internal_gmtime( inSeconds, &time);
+ return time.tm_wday;
+}
+
+/*
+ * similar to __hxcpp_new_date but, takes no date parts as input because, it assumes NOW date_time
+ */
+double __hxcpp_date_now()
+{
+ #ifdef HX_WINDOWS
+ typedef unsigned __int64 uint64_t;
+ static const uint64_t EPOCH = ((uint64_t) 116444736000000000ULL);
+
+ SYSTEMTIME system_time;
+ FILETIME file_time;
+ ULARGE_INTEGER ularge;
+
+ GetSystemTime( &system_time );
+ SystemTimeToFileTime( &system_time, &file_time );
+
+ ularge.LowPart = file_time.dwLowDateTime;
+ ularge.HighPart = file_time.dwHighDateTime;
+
+ return (double)( (long) ((ularge.QuadPart - EPOCH) / 10000000L) ) +
+ system_time.wMilliseconds*0.001;
+ #elif defined(USE_GETTIMEOFDAY)
+ struct timeval tv;
+ gettimeofday(&tv, 0);
+ return (tv.tv_sec + (((double) tv.tv_usec) / (1000 * 1000)));
+ #else
+ // per-second time resolution. not ideal, but OK given the docs for Date.now
+ time_t t;
+ struct tm ti;
+ time(&t);
+ __internal_localtime((double)t, &ti);
+ return mktime(&ti);
+ #endif
+}
+
+/*
+ * for the input Epoch time, returns whether the corresponding local time would be in DST
+ * 1 : yes, in DST ; 0 : no, not in DST
+ */
+int __hxcpp_is_dst(double inSeconds)
+{
+ struct tm time;
+ __internal_localtime( inSeconds, &time);
+ return time.tm_isdst;
+}
+
+/*
+ * for the input Epoch time, returns the correct timezone offset of local time zone;
+ * return value is in seconds e.g. -28800 (that would be -8 hrs)
+ */
+double __hxcpp_timezone_offset(double inSeconds)
+{
+ struct tm localTime;
+ __internal_localtime( inSeconds, &localTime);
+
+ #if defined(HX_WINDOWS) || defined(__SNC__) || defined(__ORBIS__)
+ struct tm gmTime;
+ __internal_gmtime(inSeconds, &gmTime );
+
+ return mktime(&localTime) - mktime(&gmTime);
+ #else
+ return localTime.tm_gmtoff;
+ #endif
+}
+
+String __internal_to_string(struct tm time)
+{
+ // YYYY-MM-DD hh:mm:ss
+
+ char buf[100];
+ strftime(buf,100, "%Y-%m-%d %H:%M:%S", &time);
+ return String::create(buf);
+}
+
+/*
+ * string form of a given Epoch time, without milliseconds,
+ * as in format [YYYY-MM-DD hh:mm:ss +hhmm] ex: [1997-07-16 19:20:30 +0100].
+ */
+String __hxcpp_to_utc_string(double inSeconds)
+{
+ struct tm time;
+ __internal_gmtime( inSeconds, &time);
+ return __internal_to_string( time);
+}
+
+/*
+ * string form of a given Epoch time, without milliseconds and timezone offset,
+ * as in format [YYYY-MM-DD hh:mm:ss] ex: [1997-07-16 19:20:30].
+ */
+String __hxcpp_to_string(double inSeconds)
+{
+ struct tm time;
+ __internal_localtime( inSeconds, &time);
+ return __internal_to_string( time);
+}
+
+/*
+ * input: takes Y-M-D h:m:s.ms (considers that date parts are in UTC date_time representation)
+ * output: returns UTC time stamp (Epoch), in seconds
+ */
+double __hxcpp_from_utc(int inYear,int inMonth,int inDay,int inHour, int inMin, int inSeconds, int inMilliseconds)
+{
+ struct tm time;
+
+ time.tm_isdst = -1;
+ time.tm_year = inYear - 1900;
+ time.tm_mon = inMonth;
+ time.tm_mday = inDay;
+ time.tm_hour = inHour;
+ time.tm_min = inMin;
+ time.tm_sec = inSeconds;
+
+ time_t z = mktime(&time);
+ time_t t = z + __hxcpp_timezone_offset(z);
+
+ struct tm local_tm;
+ __internal_localtime( t, &local_tm);
+
+ return (mktime(&local_tm) + ((double) inMilliseconds * 0.001));
+}
+
diff --git a/Sources/c_snikket/src/hx/Debug.cpp b/Sources/c_snikket/src/hx/Debug.cpp
new file mode 100644
index 0000000..25c7d4d
--- /dev/null
+++ b/Sources/c_snikket/src/hx/Debug.cpp
@@ -0,0 +1,573 @@
+#include <hxcpp.h>
+#include <list>
+#include <map>
+#include <vector>
+#include <string>
+#include <hx/Debug.h>
+#include <hx/Thread.h>
+#include <hx/Telemetry.h>
+#include <hx/Unordered.h>
+#include <hx/OS.h>
+
+
+#if defined(HXCPP_CATCH_SEGV) && !defined(_MSC_VER)
+#include <signal.h>
+#endif
+
+
+
+#ifdef HX_WINRT
+#define DBGLOG WINRT_LOG
+#elif defined(ANDROID)
+#include <android/log.h>
+#define DBGLOG(...) __android_log_print(ANDROID_LOG_INFO, "HXCPP", __VA_ARGS__)
+#else
+#include <stdio.h>
+#define DBGLOG printf
+#endif
+
+#if _MSC_VER
+#ifndef snprintf
+#define snprintf _snprintf
+#endif
+#endif
+
+#ifndef __has_builtin
+#define __has_builtin(x) 0
+#endif
+
+
+
+
+namespace hx
+{
+
+const char* EXTERN_CLASS_NAME = "extern";
+
+#ifdef HXCPP_STACK_IDS
+static HxMutex sStackMapMutex;
+typedef UnorderedMap<int, StackContext *> StackMap;
+static StackMap sStackMap;
+#endif
+
+// User settable String->Void
+// String : message
+// You can 'throw' to prevent default action
+static Dynamic sCriticalErrorHandler;
+
+
+static void setStaticHandler(Dynamic &inStore, Dynamic inValue)
+{
+ if ( inStore==null() != inValue==null())
+ {
+ if ( inValue!=null() )
+ GCAddRoot(&inStore.mPtr);
+ else
+ GCRemoveRoot(&inStore.mPtr);
+ }
+ inStore = inValue;
+}
+
+
+
+static void CriticalErrorHandler(String inErr, bool allowFixup)
+{
+#ifdef HXCPP_DEBUGGER
+ if (allowFixup && __hxcpp_dbg_fix_critical_error(inErr))
+ return;
+#endif
+
+#ifdef HXCPP_STACK_TRACE
+ hx::StackContext *ctx = hx::StackContext::getCurrent();
+ ctx->beginCatch(true);
+#endif
+
+ if (sCriticalErrorHandler!=null())
+ sCriticalErrorHandler(inErr);
+
+#ifdef HXCPP_STACK_TRACE
+ ctx->dumpExceptionStack();
+#endif
+
+ DBGLOG("Critical Error: %s\n", inErr.utf8_str());
+
+#if defined(HX_WINDOWS) && !defined(HX_WINRT)
+ MessageBoxA(0, inErr.utf8_str(), "Critical Error - program must terminate",
+ MB_ICONEXCLAMATION|MB_OK);
+#endif
+
+ // Good when using gdb, and to collect a core ...
+ #if __has_builtin(__builtin_trap)
+ __builtin_trap();
+ #else
+ (* (int *) 0) = 0;
+ #endif
+
+ // Just in case that didn't do it ...
+ exit(1);
+}
+
+void CriticalError(const String &inErr, bool inAllowFixup)
+{
+ CriticalErrorHandler(inErr, inAllowFixup);
+}
+
+
+#ifdef HXCPP_CATCH_SEGV
+class hxSehException : public hx::Object
+{
+public:
+ int code;
+
+ inline void *operator new( size_t inSize )
+ {
+ return hx::InternalCreateConstBuffer(0,(int)inSize);
+ }
+ void operator delete( void *) { }
+
+ hxSehException(int inCode) : code(inCode) { }
+
+ String __ToString() const { return HX_CSTRING("hxSehException"); }
+
+ int __GetType() const { return vtObject; }
+};
+
+static hx::Object *sException = new hxSehException(1);
+
+#ifdef _MSC_VER
+void __cdecl hxSignalFunction(unsigned int, struct _EXCEPTION_POINTERS* )
+{
+ hx::Throw(sException);
+}
+#else
+void hxSignalFunction(int)
+{
+ hx::Throw(sException);
+}
+#endif
+
+#endif
+
+
+String FormatStack(const char *file, const char *clazz, const char *func, int line, bool display)
+{
+ // Not sure if the following is even possible but the old debugger did it so ...
+ char buf[1024];
+ if (!file || file[0]=='?')
+ {
+ if (display)
+ snprintf(buf, sizeof(buf), "%s::%s", clazz, func);
+ else
+ snprintf(buf, sizeof(buf), "%s::%s::%d", clazz, func,line);
+ }
+ else
+ {
+ // Old-style combined file::class...
+ if (!clazz || !clazz[0])
+ {
+ if (line>0 || !display)
+ snprintf(buf, sizeof(buf), display ? "%s %s line %d" : "%s::%s::%d", func, file, line);
+ else
+ snprintf(buf, sizeof(buf), "%s %s", func, file);
+ }
+ else
+ {
+ if (line>0 || !display)
+ snprintf(buf, sizeof(buf), display ? "%s::%s %s line %d" : "%s::%s::%s::%d", clazz, func, file, line);
+ else
+ snprintf(buf, sizeof(buf), "%s::%s %s", clazz, func, file);
+ }
+ }
+ return ::String(buf);
+}
+
+
+
+
+
+
+StackContext::StackContext()
+{
+ #ifdef HXCPP_STACK_TRACE
+ mIsUnwindingException = false;
+ #endif
+
+ #if HXCPP_TELEMETRY
+ mTelemetry = tlmCreate(this);
+ #endif
+
+ #ifdef HXCPP_DEBUGGER
+ mDebugger = 0;
+ #endif
+
+ #ifdef HXCPP_PROFILER
+ mProfiler = 0;
+ #endif
+
+ #ifdef HXCPP_SCRIPTABLE
+ stack = new unsigned char[128*1024];
+ pointer = &stack[0];
+ push((hx::Object *)0);
+ frame = pointer;
+ exception = 0;
+ breakContReturn = 0;
+ #endif
+
+ #ifdef HXCPP_COMBINE_STRINGS
+ stringSet = 0;
+ #endif
+}
+
+StackContext::~StackContext()
+{
+ #ifdef HXCPP_DEBUGGER
+ if (mDebugger)
+ dbgCtxDestroy(mDebugger);
+ #endif
+
+ #ifdef HXCPP_TELEMETRY
+ if (mTelemetry)
+ tlmDestroy(mTelemetry);
+ #endif
+
+ #ifdef HXCPP_PROFILER
+ if (mProfiler)
+ profDestroy(mProfiler);
+ #endif
+
+ #ifdef HXCPP_SCRIPTABLE
+ delete [] stack;
+ #endif
+}
+
+void StackContext::onThreadAttach()
+{
+ #ifdef HXCPP_STACK_IDS
+ mThreadId = __hxcpp_GetCurrentThreadNumber();
+
+ sStackMapMutex.Lock();
+ sStackMap[mThreadId] = this;
+ sStackMapMutex.Unlock();
+ #endif
+
+ #ifdef HXCPP_DEBUGGER
+ if (!mDebugger)
+ mDebugger = dbgCtxCreate(this);
+ if (mDebugger)
+ dbgCtxAttach(mDebugger,this);
+ #endif
+
+ #ifdef HXCPP_TELEMETRY
+ if (mTelemetry)
+ tlmAttach(mTelemetry,this);
+ #endif
+
+ #ifdef HXCPP_PROFILER
+ if (mProfiler)
+ profAttach(mProfiler,this);
+ #endif
+
+ #ifdef HXCPP_CATCH_SEGV
+ #ifdef _MSC_VER
+ mOldSignalFunc = _set_se_translator( hxSignalFunction );
+ #else
+ mOldSignalFunc = signal( SIGSEGV, hxSignalFunction );
+ #endif
+ #endif
+}
+
+void StackContext::onThreadDetach()
+{
+ #ifdef HXCPP_CATCH_SEGV
+ #ifdef _MSC_VER
+ _set_se_translator( mOldSignalFunc );
+ #else
+ signal( SIGSEGV, mOldSignalFunc );
+ #endif
+ #endif
+
+ #ifdef HXCPP_DEBUGGER
+ if (mDebugger)
+ dbgCtxDetach(mDebugger);
+ #endif
+
+ #ifdef HXCPP_TELEMETRY
+ if (mTelemetry)
+ tlmDetach(mTelemetry);
+ #endif
+
+ #ifdef HXCPP_PROFILER
+ if (mProfiler)
+ profDetach(mProfiler,this);
+ #endif
+
+ #ifdef HXCPP_STACK_IDS
+ sStackMapMutex.Lock();
+ sStackMap.erase(mThreadId);
+ sStackMapMutex.Unlock();
+ mThreadId = 0;
+ #endif
+
+ #ifdef HXCPP_COMBINE_STRINGS
+ stringSet = 0;
+ #endif
+}
+
+#ifdef HXCPP_STACK_IDS
+void StackContext::getAllStackIds( QuickVec<int> &outIds )
+{
+ outIds.clear();
+ sStackMapMutex.Lock();
+ for(StackMap::iterator i=sStackMap.begin(); i!=sStackMap.end(); ++i)
+ outIds.push(i->first);
+ sStackMapMutex.Unlock();
+}
+
+StackContext *StackContext::getStackForId(int id)
+{
+ sStackMapMutex.Lock();
+ StackContext *result = sStackMap[id];
+ sStackMapMutex.Unlock();
+ return result;
+}
+#endif
+
+
+#ifdef HXCPP_STACK_TRACE // {
+
+void StackContext::tracePosition( )
+{
+ StackFrame *frame = mStackFrames[mStackFrames.size()-1];
+ #ifdef HXCPP_STACK_LINE
+ DBGLOG("%s::%s : %d\n", frame->position->className, frame->position->functionName, frame->lineNumber);
+ #else
+ DBGLOG("%s::%s\n", frame->position->className, frame->position->functionName);
+ #endif
+}
+
+void StackContext::getCurrentCallStackAsStrings(Array<String> result, bool skipLast)
+{
+ int n = mStackFrames.size() - (skipLast ? 1 : 0);
+
+ for (int i = 0; i < n; i++)
+ {
+ // Reverse call stack to match exception stack
+ StackFrame *frame = mStackFrames[n-1-i];
+ result->push(frame->toString());
+ }
+}
+
+void StackContext::getCurrentExceptionStackAsStrings(Array<String> result)
+{
+ int size = mExceptionStack.size();
+
+ for (int i = 0; i < size; i++)
+ {
+ result->push(mExceptionStack[i].toString());
+ }
+}
+
+void StackContext::beginCatch(bool inAll)
+{
+ if (inAll)
+ {
+ mExceptionStack.clear();
+ // Copy remaineder of stack frames to exception stack...
+ // This will use the default operator=, which will copy the pointers.
+ // This is what we want, since the pointers are pointers to constant data
+ for(int i=mStackFrames.size()-1;i>=0;--i)
+ mExceptionStack.push( *mStackFrames[i] );
+ }
+ // Lock-in the excpetion stack
+ mIsUnwindingException = false;
+}
+
+
+
+// Called when a throw occurs
+void StackContext::setLastException()
+{
+ mExceptionStack.clear();
+ mIsUnwindingException = true;
+}
+
+
+// Called when a throw occurs
+void StackContext::pushLastException()
+{
+ mIsUnwindingException = true;
+}
+
+
+
+void StackContext::dumpExceptionStack()
+{
+ #ifdef ANDROID
+ #define EXCEPTION_PRINT(...) \
+ __android_log_print(ANDROID_LOG_ERROR, "HXCPP", __VA_ARGS__)
+ #else
+ #define EXCEPTION_PRINT(...) \
+ printf(__VA_ARGS__)
+ #endif
+
+ int size = mExceptionStack.size();
+ for(int i = size - 1; i >= 0; i--)
+ {
+ EXCEPTION_PRINT("Called from %s\n", mExceptionStack[i].toDisplay().utf8_str());
+ }
+}
+
+
+// ---- StackFrame -------
+
+
+::String StackFrame::toDisplay()
+{
+ #ifndef HXCPP_STACK_LINE
+ int lineNumber=0;
+ #endif
+ return FormatStack(position->fileName, position->className, position->functionName, lineNumber,true);
+}
+
+
+::String StackFrame::toString()
+{
+ #ifndef HXCPP_STACK_LINE
+ int lineNumber=0;
+ #endif
+
+ return FormatStack(position->fileName, position->className, position->functionName, lineNumber,false);
+}
+
+
+
+
+ExceptionStackFrame::ExceptionStackFrame(const StackFrame &inFrame)
+{
+ // It is safe to use the pointer in 331+
+ position = inFrame.position;
+
+ #ifdef HXCPP_STACK_LINE
+ line = inFrame.lineNumber;
+ #endif
+}
+
+::String ExceptionStackFrame::format(bool inForDisplay)
+{
+ #ifndef HXCPP_STACK_LINE
+ int line=0;
+ #endif
+
+ const char *fileName = position->fileName;
+ const char *className = position->className;
+ const char *functionName = position->functionName;
+
+ return FormatStack(fileName, className, functionName, line, inForDisplay);
+}
+
+::String ExceptionStackFrame::toDisplay() { return format(true); }
+::String ExceptionStackFrame::toString() { return format(false); }
+
+
+#endif // } HXCPP_STACK_TRACE
+
+
+HXCPP_EXTERN_CLASS_ATTRIBUTES void NullReference(const char *type, bool allowFixup)
+{
+#ifdef HXCPP_DEBUGGER
+ String err(HX_CSTRING("Null ") + String(type) + HX_CSTRING(" Reference"));
+ if (__hxcpp_dbg_fix_critical_error(err))
+ return;
+#endif
+
+ __hxcpp_dbg_checkedThrow(HX_CSTRING("Null Object Reference"));
+}
+
+
+} // end namspace hx
+
+#ifndef HXCPP_DEBUGGER
+void __hxcpp_execution_trace(int inLevel) { }
+#endif
+
+
+void __hx_dump_stack()
+{
+#ifdef HXCPP_STACK_TRACE
+ hx::StackContext *ctx = hx::StackContext::getCurrent();
+ ctx->beginCatch(false);
+ ctx->dumpExceptionStack();
+#endif
+}
+
+
+void __hx_stack_set_last_exception()
+{
+#ifdef HXCPP_STACK_TRACE
+ hx::StackContext *ctx = hx::StackContext::getCurrent();
+ ctx->setLastException();
+#endif
+}
+
+
+void __hx_stack_push_last_exception()
+{
+#ifdef HXCPP_STACK_TRACE
+ hx::StackContext *ctx = hx::StackContext::getCurrent();
+ ctx->pushLastException();
+#endif
+}
+
+
+void __hxcpp_stack_begin_catch()
+{
+#ifdef HXCPP_STACK_TRACE
+ hx::StackContext *ctx = hx::StackContext::getCurrent();
+ ctx->beginCatch(false);
+#endif
+}
+
+
+Array<String> __hxcpp_get_call_stack(bool inSkipLast)
+{
+ Array<String> result = Array_obj<String>::__new();
+
+#ifdef HXCPP_STACK_TRACE
+ hx::StackContext *ctx = hx::StackContext::getCurrent();
+ ctx->getCurrentCallStackAsStrings(result,inSkipLast);
+#endif
+ return result;
+}
+
+
+Array<String> __hxcpp_get_exception_stack()
+{
+ Array<String> result = Array_obj<String>::__new();
+
+#ifdef HXCPP_STACK_TRACE
+ hx::StackContext *ctx = hx::StackContext::getCurrent();
+ ctx->getCurrentExceptionStackAsStrings(result);
+#endif
+
+ return result;
+}
+
+void __hxcpp_set_critical_error_handler(Dynamic inHandler)
+{
+ hx::setStaticHandler(hx::sCriticalErrorHandler,inHandler);
+}
+
+#ifndef HXCPP_DEBUGGER
+void __hxcpp_set_debugger_info(const char **inAllClasses, const char **inFullPaths) { }
+#endif
+
+
+#ifndef HXCPP_PROFILER
+void __hxcpp_start_profiler(::String inDumpFile)
+{
+ DBGLOG("Warning - profiler has no effect without HXCPP_PROFILER\n");
+}
+void __hxcpp_stop_profiler() { }
+#endif
+
+
diff --git a/Sources/c_snikket/src/hx/Hash.cpp b/Sources/c_snikket/src/hx/Hash.cpp
new file mode 100644
index 0000000..61a6f6f
--- /dev/null
+++ b/Sources/c_snikket/src/hx/Hash.cpp
@@ -0,0 +1,1242 @@
+#include <hxcpp.h>
+#include "Hash.h"
+
+
+using namespace hx;
+
+
+// --- HashRoot ---------------------------------------------------
+
+int __root_hash_size(Dynamic &rtHash)
+{
+ HashRoot *hash = static_cast<HashRoot *>(rtHash.GetPtr());
+ if(!hash)
+ return 0;
+ return hash->getSize();
+}
+
+
+// --- IntHash ----------------------------------------------------
+
+namespace
+{
+typedef hx::HashBase<int> IntHashBase;
+typedef hx::Hash< TIntElement<Dynamic> > IntHashObject;
+typedef hx::Hash< TIntElement<int> > IntHashInt;
+typedef hx::Hash< TIntElement<Float> > IntHashFloat;
+typedef hx::Hash< TIntElement<String> > IntHashString;
+typedef hx::Hash< TIntElement<cpp::Int64> > IntHashInt64;
+}
+
+void __int_hash_set(HX_MAP_THIS_ARG,int inKey,const Dynamic &value)
+{
+ IntHashBase *hash = static_cast<IntHashBase *>(ioHash.GetPtr());
+ if (!hash)
+ {
+ if (value==null())
+ {
+ hash = new IntHashObject();
+ }
+ else
+ {
+ hxObjectType type = (hxObjectType)value->__GetType();
+ switch (type)
+ {
+ case vtInt : hash = new IntHashInt(); break;
+ case vtFloat : hash = new IntHashFloat(); break;
+ case vtString: hash = new IntHashString(); break;
+ case vtInt64 : hash = new IntHashInt64(); break;
+ default : hash = new IntHashObject(); break;
+ }
+ }
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+ else if (hash->store!=hashObject)
+ {
+ HashStore want = hashObject;
+ if (value!=null())
+ {
+ hxObjectType type = (hxObjectType)value->__GetType();
+ if (type==vtInt)
+ {
+ if (hash->store==hashFloat)
+ want = hashFloat;
+ else if (hash->store==hashInt)
+ want = hashInt;
+ else if (hash->store==hashInt64)
+ want = hashInt64;
+ }
+ else if (type==vtFloat)
+ {
+ if (hash->store==hashInt || hash->store==hashFloat)
+ want = hashFloat;
+ }
+ else if (type==vtString)
+ {
+ if (hash->store==hashString)
+ want = hashString;
+ }
+ else if (type==vtInt64)
+ {
+ if (hash->store==hashInt || hash->store==hashInt64)
+ want = hashInt64;
+ }
+ }
+ if (hash->store!=want)
+ {
+ hash = hash->convertStore(want);
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+ }
+
+ hash->set(inKey,value);
+}
+
+void __int_hash_set_int(HX_MAP_THIS_ARG,int inKey,int inValue)
+{
+ IntHashBase *hash = static_cast<IntHashBase *>(ioHash.GetPtr());
+ if (!hash)
+ {
+ hash = new IntHashInt();
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+ else if (hash->store==hashString)
+ {
+ hash = hash->convertStore(hashObject);
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+
+ hash->set(inKey,inValue);
+}
+
+
+void __int_hash_set_float(HX_MAP_THIS_ARG,int inKey,Float inValue)
+{
+ IntHashBase *hash = static_cast<IntHashBase *>(ioHash.GetPtr());
+ if (!hash)
+ {
+ hash = new IntHashFloat();
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+ else if (hash->store==hashString || hash->store==hashInt64)
+ {
+ hash = hash->convertStore(hashObject);
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+ else if (hash->store==hashInt)
+ {
+ hash = hash->convertStore(hashFloat);
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+
+ hash->set(inKey,inValue);
+}
+
+
+
+void __int_hash_set_string(HX_MAP_THIS_ARG,int inKey, ::String inValue)
+{
+ IntHashBase *hash = static_cast<IntHashBase *>(ioHash.GetPtr());
+ if (!hash)
+ {
+ hash = new IntHashString();
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+ else if (hash->store==hashInt || hash->store==hashFloat || hash->store==hashInt64)
+ {
+ hash = hash->convertStore(hashObject);
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+
+ hash->set(inKey,inValue);
+}
+
+void __int_hash_set_int64(HX_MAP_THIS_ARG, int inKey, cpp::Int64 inValue)
+{
+ IntHashBase *hash = static_cast<IntHashBase*>(ioHash.GetPtr());
+ if (!hash)
+ {
+ hash = new IntHashInt64();
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+ else if (hash->store==hashInt)
+ {
+ hash = hash->convertStore(hashInt64);
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+ else if (hash->store==hashString || hash->store==hashFloat)
+ {
+ hash = hash->convertStore(hashObject);
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+
+ hash->set(inKey, inValue);
+}
+
+Dynamic __int_hash_get(Dynamic inHash,int inKey)
+{
+ IntHashBase *hash = static_cast<IntHashBase *>(inHash.GetPtr());
+ if (!hash)
+ return null();
+
+ Dynamic result = null();
+ hash->query(inKey,result);
+ return result;
+}
+
+int __int_hash_get_int(Dynamic inHash,int inKey)
+{
+ IntHashBase *hash = static_cast<IntHashBase *>(inHash.GetPtr());
+ if (!hash)
+ return 0;
+
+ int result = 0;
+ hash->query(inKey,result);
+ return result;
+}
+
+
+Float __int_hash_get_float(Dynamic inHash,int inKey)
+{
+ IntHashBase *hash = static_cast<IntHashBase *>(inHash.GetPtr());
+ if (!hash)
+ return 0;
+
+ Float result = 0;
+ hash->query(inKey,result);
+ return result;
+}
+
+String __int_hash_get_string(Dynamic inHash,int inKey)
+{
+ IntHashBase *hash = static_cast<IntHashBase *>(inHash.GetPtr());
+ if (!hash)
+ return String();
+
+ String result;
+ hash->query(inKey,result);
+ return result;
+}
+
+cpp::Int64 __int_hash_get_int64(Dynamic inHash, int inKey)
+{
+ IntHashBase *hash = static_cast<IntHashBase*>(inHash.GetPtr());
+ if (!hash)
+ return 0;
+
+ cpp::Int64 result = 0;
+ hash->query(inKey, result);
+ return result;
+}
+
+
+bool __int_hash_exists(Dynamic &ioHash,int inKey)
+{
+ IntHashBase *hash = static_cast<IntHashBase *>(ioHash.GetPtr());
+ if (!hash)
+ return false;
+ return hash->exists(inKey);
+}
+
+bool __int_hash_remove(Dynamic &ioHash,int inKey)
+{
+ IntHashBase *hash = static_cast<IntHashBase *>(ioHash.GetPtr());
+ if (!hash)
+ return false;
+ return hash->remove(inKey);
+}
+
+Array<int> __int_hash_keys(Dynamic &ioHash)
+{
+ IntHashBase *hash = static_cast<IntHashBase *>(ioHash.GetPtr());
+ if (!hash)
+ return Array_obj<int>::__new();
+ return hash->keys();
+}
+
+Dynamic __int_hash_values(Dynamic &ioHash)
+{
+ IntHashBase *hash = static_cast<IntHashBase *>(ioHash.GetPtr());
+ if (!hash)
+ return Array_obj<Dynamic>::__new();
+ return hash->values();
+}
+
+
+String __int_hash_to_string(Dynamic &ioHash)
+{
+ IntHashBase *hash = static_cast<IntHashBase *>(ioHash.GetPtr());
+ if (hash)
+ return hash->toString();
+ #if (HXCPP_API_LEVEL >= 430)
+ return HX_CSTRING("[]");
+ #else
+ return HX_CSTRING("{}");
+ #endif
+}
+
+void __int_hash_clear(Dynamic &ioHash)
+{
+ IntHashBase *hash = static_cast<IntHashBase *>(ioHash.GetPtr());
+ if (hash)
+ hash->clear();
+}
+
+// --- Int64Hash -----------------------------------------------------
+
+
+namespace
+{
+typedef hx::HashBase<cpp::Int64> Int64HashBase;
+typedef hx::Hash< TInt64Element<Dynamic> > Int64HashObject;
+typedef hx::Hash< TInt64Element<int> > Int64HashInt;
+typedef hx::Hash< TInt64Element<Float> > Int64HashFloat;
+typedef hx::Hash< TInt64Element<String> > Int64HashString;
+typedef hx::Hash< TInt64Element<cpp::Int64> > Int64HashInt64;
+}
+
+void __int64_hash_set(HX_MAP_THIS_ARG, cpp::Int64 inKey, const Dynamic &value)
+{
+ Int64HashBase *hash = static_cast<Int64HashBase *>(ioHash.GetPtr());
+ if (!hash)
+ {
+ if (value==null())
+ {
+ hash = new Int64HashObject();
+ }
+ else
+ {
+ hxObjectType type = (hxObjectType)value->__GetType();
+ switch (type)
+ {
+ case vtInt: hash = new Int64HashInt(); break;
+ case vtFloat: hash = new Int64HashFloat(); break;
+ case vtString: hash = new Int64HashString(); break;
+ case vtInt64: hash = new Int64HashInt64(); break;
+ default: hash = new Int64HashObject(); break;
+ }
+ }
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner, hash);
+ }
+ else if (hash->store != hashObject)
+ {
+ HashStore want = hashObject;
+ if (value!=null())
+ {
+ hxObjectType type = (hxObjectType)value->__GetType();
+ if (type==vtInt)
+ {
+ if (hash->store==hashFloat)
+ want = hashFloat;
+ else if (hash->store==hashInt)
+ want = hashInt;
+ else if (hash->store==hashInt64)
+ want = hashInt64;
+ }
+ else if (type==vtFloat)
+ {
+ if (hash->store==hashInt || hash->store==hashFloat)
+ want = hashFloat;
+ }
+ else if (type==vtString)
+ {
+ if (hash->store==hashString)
+ want = hashString;
+ }
+ }
+ if (hash->store!=want)
+ {
+ hash = hash->convertStore(want);
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner, hash);
+ }
+ }
+
+ hash->set(inKey, value);
+}
+
+void __int64_hash_set_int(HX_MAP_THIS_ARG, cpp::Int64 inKey, int inValue)
+{
+ Int64HashBase *hash = static_cast<Int64HashBase *>(ioHash.GetPtr());
+ if (!hash)
+ {
+ hash = new Int64HashInt();
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner, hash);
+ }
+ else if (hash->store==hashString)
+ {
+ hash = hash->convertStore(hashObject);
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner, hash);
+ }
+
+ hash->set(inKey, inValue);
+}
+
+void __int64_hash_set_float(HX_MAP_THIS_ARG, cpp::Int64 inKey, Float inValue)
+{
+ Int64HashBase *hash = static_cast<Int64HashBase *>(ioHash.GetPtr());
+ if (!hash)
+ {
+ hash = new Int64HashFloat();
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner, hash);
+ }
+ else if (hash->store==hashString || hash->store==hashInt64)
+ {
+ hash = hash->convertStore(hashObject);
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner, hash);
+ }
+ else if (hash->store==hashInt)
+ {
+ hash = hash->convertStore(hashFloat);
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner, hash);
+ }
+
+ hash->set(inKey, inValue);
+}
+
+void __int64_hash_set_string(HX_MAP_THIS_ARG, cpp::Int64 inKey, ::String inValue)
+{
+ Int64HashBase *hash = static_cast<Int64HashBase *>(ioHash.GetPtr());
+ if (!hash)
+ {
+ hash = new Int64HashString();
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner, hash);
+ }
+ else if (hash->store==hashInt || hash->store==hashFloat || hash->store==hashInt64)
+ {
+ hash = hash->convertStore(hashObject);
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner, hash);
+ }
+
+ hash->set(inKey, inValue);
+}
+
+void __int64_hash_set_int64(HX_MAP_THIS_ARG, cpp::Int64 inKey, cpp::Int64 inValue)
+{
+ Int64HashBase *hash = static_cast<Int64HashBase *>(ioHash.GetPtr());
+ if (!hash)
+ {
+ hash = new Int64HashInt64();
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner, hash);
+ }
+ else if (hash->store==hashInt)
+ {
+ hash = hash->convertStore(hashInt64);
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner, hash);
+ }
+ else if (hash->store==hashString || hash->store==hashFloat)
+ {
+ hash = hash->convertStore(hashObject);
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner, hash);
+ }
+
+ hash->set(inKey, inValue);
+}
+
+Dynamic __int64_hash_get(Dynamic inHash, cpp::Int64 inKey)
+{
+ Int64HashBase *hash = static_cast<Int64HashBase *>(inHash.GetPtr());
+ if (!hash)
+ return null();
+
+ Dynamic result = null();
+ hash->query(inKey, result);
+ return result;
+}
+
+int __int64_hash_get_int(Dynamic inHash, cpp::Int64 inKey)
+{
+ Int64HashBase *hash = static_cast<Int64HashBase *>(inHash.GetPtr());
+ if (!hash)
+ return 0;
+
+ int result = 0;
+ hash->query(inKey, result);
+ return result;
+}
+
+Float __int64_hash_get_float(Dynamic inHash, cpp::Int64 inKey)
+{
+ Int64HashBase *hash = static_cast<Int64HashBase *>(inHash.GetPtr());
+ if (!hash)
+ return 0;
+
+ Float result = 0;
+ hash->query(inKey, result);
+ return result;
+}
+
+String __int64_hash_get_string(Dynamic inHash, cpp::Int64 inKey)
+{
+ Int64HashBase *hash = static_cast<Int64HashBase *>(inHash.GetPtr());
+ if (!hash)
+ return String();
+
+ String result;
+ hash->query(inKey, result);
+ return result;
+}
+
+cpp::Int64 __int64_hash_get_int64(Dynamic inHash, cpp::Int64 inKey)
+{
+ Int64HashBase *hash = static_cast<Int64HashBase *>(inHash.GetPtr());
+ if (!hash)
+ return 0;
+
+ cpp::Int64 result = 0;
+ hash->query(inKey, result);
+ return result;
+}
+
+bool __int64_hash_exists(Dynamic &inHash, cpp::Int64 inKey)
+{
+ Int64HashBase *hash = static_cast<Int64HashBase *>(inHash.GetPtr());
+ if (!hash)
+ return false;
+
+ return hash->exists(inKey);
+}
+
+bool __int64_hash_remove(Dynamic &ioHash, cpp::Int64 inKey)
+{
+ Int64HashBase *hash = static_cast<Int64HashBase *>(ioHash.GetPtr());
+ if (!hash)
+ return false;
+
+ return hash->remove(inKey);
+}
+
+Array<cpp::Int64> __int64_hash_keys(Dynamic &ioHash)
+{
+ Int64HashBase *hash = static_cast<Int64HashBase *>(ioHash.GetPtr());
+ if (!hash)
+ return Array_obj<cpp::Int64>::__new();
+
+ return hash->keys();
+}
+
+Dynamic __int64_hash_values(Dynamic &ioHash)
+{
+ Int64HashBase *hash = static_cast<Int64HashBase *>(ioHash.GetPtr());
+ if (!hash)
+ return Array_obj<Dynamic>::__new();
+
+ return hash->values();
+}
+
+String __int64_hash_to_string(Dynamic &ioHash)
+{
+ Int64HashBase *hash = static_cast<Int64HashBase *>(ioHash.GetPtr());
+ if (!hash)
+ return HX_CSTRING("{}");
+
+ return hash->toString();
+}
+
+void __int64_hash_clear(Dynamic &ioHash)
+{
+ Int64HashBase *hash = static_cast<Int64HashBase *>(ioHash.GetPtr());
+ if (hash)
+ hash->clear();
+}
+
+// --- StringHash ----------------------------------------------------
+
+
+namespace
+{
+typedef hx::HashBase<String> StringHashBase;
+typedef hx::Hash< TStringElement<Dynamic> > StringHashObject;
+typedef hx::Hash< TStringElement<int> > StringHashInt;
+typedef hx::Hash< TStringElement<Float> > StringHashFloat;
+typedef hx::Hash< TStringElement<String> > StringHashString;
+typedef hx::Hash< TStringElement<cpp::Int64> > StringHashInt64;
+}
+
+
+void __string_hash_set(HX_MAP_THIS_ARG,String inKey,const Dynamic &value, bool inForceDynamic)
+{
+ StringHashBase *hash = static_cast<StringHashBase *>(ioHash.GetPtr());
+ if (!hash)
+ {
+ if (inForceDynamic || value==null() )
+ {
+ hash = new StringHashObject();
+ }
+ else
+ {
+ hxObjectType type = (hxObjectType)value->__GetType();
+ switch (type)
+ {
+ case vtInt : hash = new StringHashInt(); break;
+ case vtFloat : hash = new StringHashFloat(); break;
+ case vtString: hash = new StringHashString(); break;
+ case vtInt64 : hash = new StringHashInt64(); break;
+ default : hash = new StringHashObject(); break;
+ }
+ }
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+ else if (hash->store!=hashObject)
+ {
+ HashStore want = hashObject;
+ if (value!=null())
+ {
+ hxObjectType type = (hxObjectType)value->__GetType();
+ if (type==vtInt)
+ {
+ if (hash->store==hashFloat)
+ want = hashFloat;
+ else if (hash->store==hashInt)
+ want = hashInt;
+ else if (hash->store==hashInt64)
+ want = hashInt64;
+ }
+ else if (type==vtFloat)
+ {
+ if (hash->store==hashInt || hash->store==hashFloat)
+ want = hashFloat;
+ }
+ else if (type==vtString)
+ {
+ if (hash->store==hashString)
+ want = hashString;
+ }
+ else if (type==vtInt64)
+ {
+ if (hash->store==hashInt || hash->store==hashInt64)
+ want = hashInt64;
+ }
+ }
+ if (hash->store!=want)
+ {
+ hash = hash->convertStore(want);
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+ }
+
+ hash->set(inKey,value);
+}
+
+void __string_hash_set_int(HX_MAP_THIS_ARG,String inKey,int inValue)
+{
+ StringHashBase *hash = static_cast<StringHashBase *>(ioHash.GetPtr());
+ if (!hash)
+ {
+ hash = new StringHashInt();
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+ else if (hash->store==hashString)
+ {
+ hash = hash->convertStore(hashObject);
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+
+ hash->set(inKey,inValue);
+}
+
+
+void __string_hash_set_float(HX_MAP_THIS_ARG,String inKey,Float inValue)
+{
+ StringHashBase *hash = static_cast<StringHashBase *>(ioHash.GetPtr());
+ if (!hash)
+ {
+ hash = new StringHashFloat();
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+ else if (hash->store==hashString || hash->store==hashInt64)
+ {
+ hash = hash->convertStore(hashObject);
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+ else if (hash->store==hashInt)
+ {
+ hash = hash->convertStore(hashFloat);
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+
+ hash->set(inKey,inValue);
+}
+
+
+
+void __string_hash_set_string(HX_MAP_THIS_ARG,String inKey, ::String inValue)
+{
+ StringHashBase *hash = static_cast<StringHashBase *>(ioHash.GetPtr());
+ if (!hash)
+ {
+ hash = new StringHashString();
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+ else if (hash->store==hashInt || hash->store==hashFloat || hash->store==hashInt64)
+ {
+ hash = hash->convertStore(hashObject);
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+
+ hash->set(inKey,inValue);
+}
+
+void __string_hash_set_int64(HX_MAP_THIS_ARG, String inKey, cpp::Int64 inValue)
+{
+ StringHashBase *hash = static_cast<StringHashBase *>(ioHash.GetPtr());
+ if (!hash)
+ {
+ hash = new StringHashInt64();
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+ else if (hash->store==hashInt)
+ {
+ hash = hash->convertStore(hashInt64);
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+ else if (hash->store==hashString || hash->store==hashFloat)
+ {
+ hash = hash->convertStore(hashObject);
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+
+ hash->set(inKey, inValue);
+}
+
+::String __string_hash_map_substr(HX_MAP_THIS_ARG,String inKey, int inStart, int inLength)
+{
+ StringHashBase *sash = static_cast<StringHashBase *>(ioHash.GetPtr());
+ if (!sash)
+ {
+ sash = new StringHashInt();
+ ioHash = sash;
+ HX_OBJ_WB_GET(owner,sash);
+ }
+ else if (sash->store!=hashInt)
+ {
+ sash = sash->convertStore(hashInt);
+ ioHash = sash;
+ HX_OBJ_WB_GET(owner,sash);
+ }
+
+ StringHashInt *shi = static_cast<StringHashInt *>(sash);
+
+
+ struct Finder
+ {
+ ::String bigString;
+ int len;
+ int offset;
+
+ Finder(const String &inBigStr, int inStart, int inLength) : bigString(inBigStr), offset(inStart), len(inLength) { }
+
+ bool operator==(const String &inKey) const
+ {
+ if (inKey.length!=len)
+ return false;
+ #ifdef HX_SMART_STRINGS
+ if (inKey.isUTF16Encoded())
+ {
+ // Has no wide chars, so can't match
+ if (!bigString.isUTF16Encoded())
+ return false;
+ return !memcmp(inKey.__w, bigString.__w+offset, sizeof(char16_t)*len);
+ }
+ else if (bigString.isUTF16Encoded())
+ {
+ const char *k = inKey.__s;
+ const char16_t *v = bigString.__w + offset;
+ for(int i=0;i<len;i++)
+ if (k[i] != v[i])
+ return false;
+ return true;
+ }
+ // fallthough...
+ #endif
+ return !memcmp(inKey.__s, bigString.__s+offset, len);
+ }
+ };
+ Finder finder(inKey, inStart, inLength);
+
+ unsigned int code = inKey.calcSubHash(inStart,inLength);
+ String found;
+ if (shi->findEquivalentKey(found,code,finder))
+ return found;
+ String k = inKey.substr(inStart, inLength);
+ shi->set(k,1);
+ return k;
+}
+
+
+Dynamic __string_hash_get(Dynamic inHash,String inKey)
+{
+ StringHashBase *hash = static_cast<StringHashBase *>(inHash.GetPtr());
+ if (!hash)
+ return null();
+
+ Dynamic result = null();
+ hash->query(inKey,result);
+ return result;
+}
+
+int __string_hash_get_int(Dynamic inHash,String inKey)
+{
+ StringHashBase *hash = static_cast<StringHashBase *>(inHash.GetPtr());
+ if (!hash)
+ return null();
+
+ int result = 0;
+ hash->query(inKey,result);
+ return result;
+}
+
+
+Float __string_hash_get_float(Dynamic inHash,String inKey)
+{
+ StringHashBase *hash = static_cast<StringHashBase *>(inHash.GetPtr());
+ if (!hash)
+ return null();
+
+ Float result = 0;
+ hash->query(inKey,result);
+ return result;
+}
+
+String __string_hash_get_string(Dynamic inHash,String inKey)
+{
+ StringHashBase *hash = static_cast<StringHashBase *>(inHash.GetPtr());
+ if (!hash)
+ return null();
+
+ String result;
+ hash->query(inKey,result);
+ return result;
+}
+
+cpp::Int64 __string_hash_get_int64(Dynamic inHash,String inKey)
+{
+ StringHashBase *hash = static_cast<StringHashBase *>(inHash.GetPtr());
+ if (!hash)
+ return null();
+
+ cpp::Int64 result = 0;
+ hash->query(inKey,result);
+ return result;
+}
+
+bool __string_hash_exists(Dynamic &ioHash,String inKey)
+{
+ StringHashBase *hash = static_cast<StringHashBase *>(ioHash.GetPtr());
+ if (!hash)
+ return false;
+ return hash->exists(inKey);
+}
+
+bool __string_hash_remove(Dynamic &ioHash,String inKey)
+{
+ StringHashBase *hash = static_cast<StringHashBase *>(ioHash.GetPtr());
+ if (!hash)
+ return false;
+ return hash->remove(inKey);
+}
+
+Array<String> __string_hash_keys(Dynamic &ioHash)
+{
+ StringHashBase *hash = static_cast<StringHashBase *>(ioHash.GetPtr());
+ if (!hash)
+ return Array_obj<String>::__new();
+ return hash->keys();
+}
+
+Dynamic __string_hash_values(Dynamic &ioHash)
+{
+ StringHashBase *hash = static_cast<StringHashBase *>(ioHash.GetPtr());
+ if (!hash)
+ return Array_obj<Dynamic>::__new();
+ return hash->values();
+}
+
+String __string_hash_to_string(Dynamic &ioHash)
+{
+ StringHashBase *hash = static_cast<StringHashBase *>(ioHash.GetPtr());
+ if (hash)
+ return hash->toString();
+ #if (HXCPP_API_LEVEL >= 430)
+ return HX_CSTRING("[]");
+ #else
+ return HX_CSTRING("{}");
+ #endif
+}
+
+String __string_hash_to_string_raw(Dynamic &ioHash)
+{
+ StringHashBase *hash = static_cast<StringHashBase *>(ioHash.GetPtr());
+ if (hash)
+ return hash->toStringRaw();
+ return null();
+}
+
+void __string_hash_clear(Dynamic &ioHash)
+{
+ StringHashBase *hash = static_cast<StringHashBase *>(ioHash.GetPtr());
+ if (hash)
+ hash->clear();
+}
+
+
+
+// --- ObjectHash ----------------------------------------------------
+
+
+namespace
+{
+typedef hx::HashBase<Dynamic> DynamicHashBase;
+
+typedef hx::Hash< TDynamicElement<Dynamic,false> > DynamicHashObject;
+typedef hx::Hash< TDynamicElement<int,false> > DynamicHashInt;
+typedef hx::Hash< TDynamicElement<Float,false> > DynamicHashFloat;
+typedef hx::Hash< TDynamicElement<String,false> > DynamicHashString;
+typedef hx::Hash< TDynamicElement<cpp::Int64,false> > DynamicHashInt64;
+
+typedef hx::Hash< TDynamicElement<Dynamic,true> > WeakDynamicHashObject;
+typedef hx::Hash< TDynamicElement<int,true> > WeakDynamicHashInt;
+typedef hx::Hash< TDynamicElement<Float,true> > WeakDynamicHashFloat;
+typedef hx::Hash< TDynamicElement<String,true> > WeakDynamicHashString;
+typedef hx::Hash< TDynamicElement<cpp::Int64,true> > WeakDynamicHashInt64;
+
+#define toRealObject(x)
+}
+
+
+void __object_hash_set(HX_MAP_THIS_ARG,Dynamic inKey,const Dynamic &value,bool inWeakKeys)
+{
+ toRealObject(inKey);
+ DynamicHashBase *hash = static_cast<DynamicHashBase *>(ioHash.GetPtr());
+ if (!hash)
+ {
+ if (value==null())
+ {
+ hash = inWeakKeys ? (DynamicHashBase *)new WeakDynamicHashObject() :
+ (DynamicHashBase *)new DynamicHashObject();
+ }
+ else
+ {
+ hxObjectType type = (hxObjectType)value->__GetType();
+ switch (type)
+ {
+ case vtInt:
+ hash = inWeakKeys ? (DynamicHashBase *)new WeakDynamicHashInt() :
+ (DynamicHashBase *)new DynamicHashInt();
+ break;
+ case vtFloat:
+ hash = inWeakKeys ? (DynamicHashBase *)new WeakDynamicHashFloat() :
+ (DynamicHashBase *)new DynamicHashFloat();
+ break;
+ case vtString:
+ hash = inWeakKeys ? (DynamicHashBase *)new WeakDynamicHashString() :
+ (DynamicHashBase *)new DynamicHashString();
+ break;
+ case vtInt64:
+ hash = inWeakKeys ? (DynamicHashBase *)new WeakDynamicHashInt64() :
+ (DynamicHashBase *)new DynamicHashInt64();
+ break;
+ default:
+ hash = inWeakKeys ? (DynamicHashBase *)new WeakDynamicHashObject() :
+ (DynamicHashBase *)new DynamicHashObject();
+ break;
+ }
+ }
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+ else if (hash->store!=hashObject)
+ {
+ HashStore want = hashObject;
+ if (value!=null())
+ {
+ hxObjectType type = (hxObjectType)value->__GetType();
+ if (type==vtInt)
+ {
+ if (hash->store==hashFloat)
+ want = hashFloat;
+ else if (hash->store==hashInt)
+ want = hashInt;
+ else if (hash->store==hashInt64)
+ want = hashInt64;
+ }
+ else if (type==vtFloat)
+ {
+ if (hash->store==hashInt || hash->store==hashFloat)
+ want = hashFloat;
+ }
+ else if (type==vtString)
+ {
+ if (hash->store==hashString)
+ want = hashString;
+ }
+ else if (type==vtInt64)
+ {
+ if (hash->store==hashInt || hash->store==hashInt64)
+ want = hashInt64;
+ }
+ }
+ if (hash->store!=want)
+ {
+ hash = hash->convertStore(want);
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+ }
+
+ hash->set(inKey,value);
+}
+
+void __object_hash_set_int(HX_MAP_THIS_ARG,Dynamic inKey,int inValue,bool inWeakKeys)
+{
+ toRealObject(inKey);
+ DynamicHashBase *hash = static_cast<DynamicHashBase *>(ioHash.GetPtr());
+ if (!hash)
+ {
+ hash = inWeakKeys ? (DynamicHashBase *)new WeakDynamicHashInt() :
+ (DynamicHashBase *)new DynamicHashInt();
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+ else if (hash->store==hashString)
+ {
+ hash = hash->convertStore(hashObject);
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+
+ hash->set(inKey,inValue);
+}
+
+
+void __object_hash_set_float(HX_MAP_THIS_ARG,Dynamic inKey,Float inValue,bool inWeakKeys)
+{
+ toRealObject(inKey);
+ DynamicHashBase *hash = static_cast<DynamicHashBase *>(ioHash.GetPtr());
+ if (!hash)
+ {
+ hash = inWeakKeys ? (DynamicHashBase *)new WeakDynamicHashFloat() :
+ (DynamicHashBase *)new DynamicHashFloat();
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+ else if (hash->store==hashString)
+ {
+ hash = hash->convertStore(hashObject);
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+ else if (hash->store==hashInt || hash->store==hashInt64)
+ {
+ hash = hash->convertStore(hashFloat);
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+
+ hash->set(inKey,inValue);
+}
+
+
+
+void __object_hash_set_string(HX_MAP_THIS_ARG,Dynamic inKey, ::String inValue,bool inWeakKeys)
+{
+ toRealObject(inKey);
+ DynamicHashBase *hash = static_cast<DynamicHashBase *>(ioHash.GetPtr());
+ if (!hash)
+ {
+ hash = inWeakKeys ? (DynamicHashBase *)new WeakDynamicHashString() :
+ (DynamicHashBase *)new DynamicHashString();
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+ else if (hash->store==hashInt || hash->store==hashFloat || hash->store==hashInt64)
+ {
+ hash = hash->convertStore(hashObject);
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+
+ hash->set(inKey,inValue);
+}
+
+void __object_hash_set_int64(HX_MAP_THIS_ARG,Dynamic inKey, cpp::Int64 inValue,bool inWeakKeys)
+{
+ toRealObject(inKey);
+ DynamicHashBase *hash = static_cast<DynamicHashBase *>(ioHash.GetPtr());
+ if (!hash)
+ {
+ hash = inWeakKeys ? (DynamicHashBase *)new WeakDynamicHashInt64() :
+ (DynamicHashBase *)new DynamicHashInt64();
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+ else if (hash->store==hashString || hash->store==hashFloat)
+ {
+ hash = hash->convertStore(hashObject);
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+ else if (hash->store==hashInt)
+ {
+ hash = hash->convertStore(hashInt64);
+ ioHash = hash;
+ HX_OBJ_WB_GET(owner,hash);
+ }
+
+ hash->set(inKey,inValue);
+}
+
+Dynamic __object_hash_get(Dynamic inHash,Dynamic inKey)
+{
+ toRealObject(inKey);
+ DynamicHashBase *hash = static_cast<DynamicHashBase *>(inHash.GetPtr());
+ if (!hash)
+ return null();
+
+ Dynamic result = null();
+ hash->query(inKey,result);
+ return result;
+}
+
+
+int __object_hash_get_int(Dynamic inHash,Dynamic inKey)
+{
+ toRealObject(inKey);
+ DynamicHashBase *hash = static_cast<DynamicHashBase *>(inHash.GetPtr());
+ if (!hash)
+ return null();
+
+ int result = 0;
+ hash->query(inKey,result);
+ return result;
+}
+
+
+Float __object_hash_get_float(Dynamic inHash,Dynamic inKey)
+{
+ toRealObject(inKey);
+ DynamicHashBase *hash = static_cast<DynamicHashBase *>(inHash.GetPtr());
+ if (!hash)
+ return null();
+
+ Float result = 0;
+ hash->query(inKey,result);
+ return result;
+}
+
+
+String __object_hash_get_string(Dynamic inHash,Dynamic inKey)
+{
+ toRealObject(inKey);
+ DynamicHashBase *hash = static_cast<DynamicHashBase *>(inHash.GetPtr());
+ if (!hash)
+ return null();
+
+ String result;
+ hash->query(inKey,result);
+ return result;
+}
+
+
+cpp::Int64 __object_hash_get_int64(Dynamic inHash,Dynamic inKey)
+{
+ toRealObject(inKey);
+ DynamicHashBase *hash = static_cast<DynamicHashBase *>(inHash.GetPtr());
+ if (!hash)
+ return null();
+
+ cpp::Int64 result = 0;
+ hash->query(inKey,result);
+ return result;
+}
+
+
+
+bool __object_hash_exists(Dynamic &ioHash,Dynamic inKey)
+{
+ toRealObject(inKey);
+ DynamicHashBase *hash = static_cast<DynamicHashBase *>(ioHash.GetPtr());
+ if (!hash)
+ return false;
+ return hash->exists(inKey);
+}
+
+bool __object_hash_remove(Dynamic &ioHash,Dynamic inKey)
+{
+ toRealObject(inKey);
+ DynamicHashBase *hash = static_cast<DynamicHashBase *>(ioHash.GetPtr());
+ if (!hash)
+ return false;
+ return hash->remove(inKey);
+}
+
+Array<Dynamic> __object_hash_keys(Dynamic &ioHash)
+{
+ DynamicHashBase *hash = static_cast<DynamicHashBase *>(ioHash.GetPtr());
+ if (!hash)
+ return Array_obj<String>::__new();
+ return hash->keys();
+}
+
+Dynamic __object_hash_values(Dynamic &ioHash)
+{
+ DynamicHashBase *hash = static_cast<DynamicHashBase *>(ioHash.GetPtr());
+ if (!hash)
+ return Array_obj<Dynamic>::__new();
+ return hash->values();
+}
+
+String __object_hash_to_string(Dynamic &ioHash)
+{
+ DynamicHashBase *hash = static_cast<DynamicHashBase *>(ioHash.GetPtr());
+ if (hash)
+ return hash->toString();
+ #if (HXCPP_API_LEVEL >= 430)
+ return HX_CSTRING("[]");
+ #else
+ return HX_CSTRING("{}");
+ #endif
+}
+
+void __object_hash_clear(Dynamic &ioHash)
+{
+ DynamicHashBase *hash = static_cast<DynamicHashBase *>(ioHash.GetPtr());
+ if (hash)
+ hash->clear();
+}
+
diff --git a/Sources/c_snikket/src/hx/Hash.h b/Sources/c_snikket/src/hx/Hash.h
new file mode 100644
index 0000000..0fde32d
--- /dev/null
+++ b/Sources/c_snikket/src/hx/Hash.h
@@ -0,0 +1,827 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifdef HXCPP_TELEMETRY
+extern void __hxt_new_hash(void* obj, int size);
+#endif
+
+namespace hx
+{
+
+
+inline unsigned int HashCalcHash(int inKey) { return inKey; }
+inline unsigned int HashCalcHash(cpp::Int64 inKey) { return (unsigned int)((inKey >> 32) ^ inKey); }
+inline unsigned int HashCalcHash(const String &inKey) { return inKey.hash(); }
+inline unsigned int HashCalcHash(const Dynamic &inKey)
+{
+ return __hxcpp_obj_hash(inKey);
+}
+
+inline void HashClear(int &ioValue) { }
+inline void HashClear(Dynamic &ioValue) { ioValue=null(); }
+inline void HashClear(String &ioValue) { ioValue=String(); }
+inline void HashClear(Float &ioValue) { }
+inline void HashClear(cpp::Int64 &ioValue) { }
+
+template<typename T>
+struct NeedsMarking { enum { Yes = 0 }; };
+template<> struct NeedsMarking<Dynamic> { enum { Yes = 1 }; };
+template<> struct NeedsMarking<String> { enum { Yes = 1 }; };
+
+// An int element has key = hash
+template<typename VALUE>
+struct TIntElement
+{
+ typedef int Key;
+ typedef VALUE Value;
+
+ enum { IgnoreHash = 1 };
+ enum { WeakKeys = 0 };
+ enum { ManageKeys = 0 };
+
+ typedef TIntElement<int> IntValue;
+ typedef TIntElement<Float> FloatValue;
+ typedef TIntElement<Dynamic> DynamicValue;
+ typedef TIntElement<String> StringValue;
+ typedef TIntElement<cpp::Int64> Int64Value;
+
+public:
+ inline void setKey(int inKey, unsigned int )
+ {
+ key = inKey;
+ }
+ inline unsigned int getHash() { return key; }
+
+ Value value;
+ Key key;
+ TIntElement<VALUE> *next;
+};
+
+//
+template<typename VALUE>
+struct TInt64Element
+{
+ typedef cpp::Int64 Key;
+ typedef VALUE Value;
+
+ enum { IgnoreHash = 0 };
+ enum { WeakKeys = 0 };
+ enum { ManageKeys = 1 };
+
+ typedef TInt64Element<int> IntValue;
+ typedef TInt64Element<Float> FloatValue;
+ typedef TInt64Element<Dynamic> DynamicValue;
+ typedef TInt64Element<String> StringValue;
+ typedef TInt64Element<cpp::Int64> Int64Value;
+
+public:
+ inline void setKey(cpp::Int64 inKey, unsigned int inHash)
+ {
+ key = inKey;
+ hash = inHash;
+ }
+ inline unsigned int getHash() { return hash; }
+
+ Value value;
+ Key key;
+ unsigned int hash;
+ TInt64Element<VALUE> *next;
+};
+
+// An string element gets hash from string or calculates it
+template<typename VALUE>
+struct TStringElement
+{
+ typedef String Key;
+ typedef VALUE Value;
+
+ enum { IgnoreHash = 0 };
+ enum { WeakKeys = 0 };
+ enum { ManageKeys = 1 };
+
+ typedef TStringElement<int> IntValue;
+ typedef TStringElement<Float> FloatValue;
+ typedef TStringElement<Dynamic> DynamicValue;
+ typedef TStringElement<String> StringValue;
+ typedef TStringElement<cpp::Int64> Int64Value;
+
+
+public:
+ inline void setKey(String inKey, unsigned int inHash)
+ {
+ key = inKey;
+ hash = inHash;
+ }
+ inline unsigned int getHash() { return hash; }
+
+ Value value;
+ Key key;
+ unsigned int hash;
+ TStringElement<VALUE> *next;
+};
+
+
+struct TWeakStringSet
+{
+ typedef null Value;
+ typedef String Key;
+
+ enum { IgnoreHash = 0 };
+ enum { WeakKeys = 1 };
+ enum { ManageKeys = 1 };
+
+ typedef TWeakStringSet IntValue;
+ typedef TWeakStringSet FloatValue;
+ typedef TWeakStringSet DynamicValue;
+ typedef TWeakStringSet StringValue;
+ typedef TWeakStringSet Int64Value;
+
+
+public:
+ inline void setKey(String inKey, unsigned int inHash)
+ {
+ key = inKey;
+ hash = inHash;
+ }
+ inline unsigned int getHash() { return hash; }
+
+ Key key;
+ unsigned int hash;
+ Value value;
+ TWeakStringSet *next;
+};
+
+
+struct TNonGcStringSet
+{
+ typedef null Value;
+ typedef String Key;
+
+ enum { IgnoreHash = 0 };
+ enum { WeakKeys = 1 };
+ enum { ManageKeys = 0 };
+
+ typedef TNonGcStringSet IntValue;
+ typedef TNonGcStringSet FloatValue;
+ typedef TNonGcStringSet DynamicValue;
+ typedef TNonGcStringSet StringValue;
+ typedef TNonGcStringSet Int64Value;
+
+
+public:
+ inline void setKey(String inKey, unsigned int inHash)
+ {
+ key = inKey;
+ hash = inHash;
+ }
+ inline unsigned int getHash() { return hash; }
+
+ Key key;
+ unsigned int hash;
+ Value value;
+ TNonGcStringSet *next;
+};
+
+
+
+
+// An Dyanamic element must use the GC code to get a hash
+template<typename VALUE,bool WEAK>
+struct TDynamicElement
+{
+ typedef Dynamic Key;
+ typedef VALUE Value;
+
+ enum { IgnoreHash = 0 };
+ enum { WeakKeys = WEAK };
+ enum { ManageKeys = 1 };
+
+ typedef TDynamicElement<int,WEAK> IntValue;
+ typedef TDynamicElement<Float,WEAK> FloatValue;
+ typedef TDynamicElement<Dynamic,WEAK> DynamicValue;
+ typedef TDynamicElement<String,WEAK> StringValue;
+ typedef TDynamicElement<cpp::Int64,WEAK> Int64Value;
+
+public:
+ inline void setKey(Dynamic inKey, unsigned int inHash)
+ {
+ key = inKey;
+ hash = inHash;
+ }
+ inline unsigned int getHash() { return hash; }
+
+ Value value;
+ Key key;
+ unsigned int hash;
+ TDynamicElement<VALUE,WEAK> *next;
+};
+
+
+
+
+enum HashStore
+{
+ hashInt,
+ hashFloat,
+ hashString,
+ hashObject,
+ hashNull,
+ hashInt64
+};
+template<typename T> struct StoreOf{ enum {store=hashObject}; };
+template<> struct StoreOf<int> { enum {store=hashInt}; };
+template<> struct StoreOf< ::String> { enum {store=hashString}; };
+template<> struct StoreOf<Float> { enum {store=hashFloat}; };
+template<> struct StoreOf<null> { enum {store=hashNull}; };
+template<> struct StoreOf<cpp::Int64> { enum {store=hashInt64}; };
+
+namespace
+{
+inline void CopyValue(Dynamic &outValue, const Dynamic &inValue) { outValue = inValue; }
+inline void CopyValue(String &outValue, const String &inValue) { outValue = inValue; }
+inline void CopyValue(String &outValue, Float inValue) { }
+inline void CopyValue(String &outValue, const Dynamic &inValue) { outValue = inValue; }
+inline void CopyValue(int &outValue, int inValue) { outValue = inValue; }
+inline void CopyValue(int &outValue, cpp::Int64 inValue) { }
+inline void CopyValue(int &outValue, Float inValue) { outValue = inValue; }
+inline void CopyValue(int &outValue, const Dynamic &inValue) { outValue = inValue; }
+inline void CopyValue(int &outValue, const String &inValue) { }
+inline void CopyValue(Float &outValue, Float inValue) { outValue = inValue; }
+inline void CopyValue(Float &outValue, const Dynamic &inValue) { outValue = inValue; }
+inline void CopyValue(Float &outValue, const String &inValue) { }
+inline void CopyValue(cpp::Int64 &outValue, cpp::Int64 inValue) { outValue = inValue; }
+inline void CopyValue(cpp::Int64 &outValue, int inValue) { outValue = inValue; }
+inline void CopyValue(cpp::Int64 &outValue, Float inValue) { }
+inline void CopyValue(cpp::Int64 &outValue, const Dynamic &inValue) { outValue = inValue; }
+inline void CopyValue(cpp::Int64 &outValue, const String &inValue) { }
+inline void CopyValue(null &, const null &) { }
+template<typename T> inline void CopyValue(T &outValue, const null &) { }
+template<typename T> inline void CopyValue(null &, const T &) { }
+}
+
+
+struct HashRoot : public Object
+{
+ HashStore store;
+ int size;
+ int mask;
+ int bucketCount;
+
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdHash };
+
+ virtual void updateAfterGc() = 0;
+
+ inline int getSize() { return size; }
+};
+
+template<typename KEY>
+struct HashBase : public HashRoot
+{
+ HashBase(int inStore)
+ {
+ store = (HashStore)inStore;
+ size = 0;
+ mask = 0;
+ bucketCount = 0;
+ }
+
+
+ virtual bool query(KEY inKey,int &outValue) = 0;
+ virtual bool query(KEY inKey,::String &outValue) = 0;
+ virtual bool query(KEY inKey,Float &outValue) = 0;
+ virtual bool query(KEY inKey,Dynamic &outValue) = 0;
+ virtual bool query(KEY inKey,cpp::Int64 &outValue) = 0;
+
+ virtual void set(KEY inKey, const int &inValue) = 0;
+ virtual void set(KEY inKey, const ::String &inValue) = 0;
+ virtual void set(KEY inKey, const Float &inValue) = 0;
+ virtual void set(KEY inKey, const Dynamic &inValue) = 0;
+ virtual void set(KEY inKey, const cpp::Int64 &inValue) = 0;
+
+ virtual void clear() = 0;
+
+ virtual HashBase<KEY> *convertStore(HashStore inStore) = 0;
+
+ virtual bool remove(KEY inKey) = 0;
+ virtual bool exists(KEY inKey) = 0;
+ virtual Array<KEY> keys() = 0;
+ virtual Dynamic values() = 0;
+
+ virtual ::String toStringRaw() { return toString(); }
+};
+
+extern void RegisterWeakHash(HashBase<Dynamic> *);
+extern void RegisterWeakHash(HashBase< ::String> *);
+
+inline void RegisterWeakHash(HashBase<int> *) { };
+inline void RegisterWeakHash(HashBase<cpp::Int64> *) { };
+
+
+template<typename T>
+struct ArrayValueOf{ typedef T Value; };
+template<> struct ArrayValueOf<null> { typedef Dynamic Value; };
+
+template<typename ELEMENT>
+struct Hash : public HashBase< typename ELEMENT::Key >
+{
+ using HashRoot::size;
+ using HashRoot::mask;
+ using HashRoot::bucketCount;
+ using HashRoot::getSize;
+
+ typedef typename ELEMENT::Key Key;
+ typedef typename ELEMENT::Value Value;
+ typedef typename ArrayValueOf<Value>::Value ArrayValue;
+
+ typedef ELEMENT Element;
+ enum { IgnoreHash = Element::IgnoreHash };
+
+
+ ELEMENT **bucket;
+
+
+ Hash() : HashBase<Key>( StoreOf<Value>::store )
+ {
+ bucket = 0;
+ if (ELEMENT::WeakKeys && Element::ManageKeys)
+ RegisterWeakHash(this);
+ }
+
+ template<typename T>
+ bool TIsWeakRefValid(T &) { return true; }
+ bool TIsWeakRefValid(Dynamic &key) { return IsWeakRefValid(key.mPtr); }
+ bool TIsWeakRefValid(String &key) { return IsWeakRefValid(key.raw_ptr()); }
+
+
+ void updateAfterGc()
+ {
+ if (Element::WeakKeys && Element::ManageKeys)
+ {
+ for(int b=0;b<bucketCount;b++)
+ {
+ Element **headPtr = &bucket[b];
+ while(*headPtr)
+ {
+ Element &el = **headPtr;
+ if (!TIsWeakRefValid(el.key))
+ {
+ *headPtr = el.next;
+ size--;
+ }
+ else
+ headPtr = &el.next;
+ }
+ }
+ }
+ }
+
+ void rebucket(int inNewCount)
+ {
+#ifdef HXCPP_TELEMETRY
+ bool is_new = bucket==0;
+#endif
+ mask = inNewCount-1;
+ //printf("expand %d -> %d\n",bucketCount, inNewCount);
+ bucket = (Element **)InternalRealloc(bucketCount*sizeof(ELEMENT *), bucket,inNewCount*sizeof(ELEMENT *));
+ HX_OBJ_WB_GET(this, bucket);
+ //for(int b=bucketCount;b<inNewCount;b++)
+ // bucket[b] = 0;
+
+#ifdef HXCPP_TELEMETRY
+ if (is_new) __hxt_new_hash(bucket, inNewCount*sizeof(ELEMENT *));
+#endif
+
+
+ for(int b=0;b<bucketCount;b++)
+ {
+ Element **head = &bucket[b];
+ while(*head)
+ {
+ Element &e = **head;
+ int newBucket = e.getHash()&mask;
+ if ( newBucket != b )
+ {
+ *head = e.next;
+ e.next = bucket[newBucket];
+ bucket[newBucket] = &e;
+ }
+ else
+ head = &e.next;
+ }
+ }
+
+ bucketCount = inNewCount;
+ }
+
+ void reserve(int inSize)
+ {
+ if (inSize<8)
+ inSize = 8;
+
+ expandBuckets(inSize);
+ }
+
+ void compact()
+ {
+ int origSize = bucketCount;
+ int newSize = bucketCount>>1;
+ // printf("compact -> %d\n", newSize);
+ mask = newSize-1;
+ for(int b=newSize; b<bucketCount; b++)
+ {
+ Element *head = bucket[b];
+ if (head)
+ {
+ Element *oldHead = bucket[b-newSize];
+ bucket[b-newSize] = head;
+
+ if (oldHead)
+ {
+ // Append to last element
+ Element **lastPtr = &(head->next);
+ while(*lastPtr)
+ lastPtr = & (*lastPtr)->next;
+ *lastPtr = oldHead;
+ }
+ bucket[b] = 0;
+ }
+ }
+ bucketCount = newSize;
+ bucket = (Element **)InternalRealloc(origSize*sizeof(ELEMENT *),bucket, sizeof(ELEMENT *)*bucketCount );
+ HX_OBJ_WB_GET(this, bucket);
+ }
+
+ bool remove(Key inKey)
+ {
+ if (!bucket)
+ return false;
+ unsigned int hash = HashCalcHash(inKey);
+ Element **head = bucket + (hash&mask);
+ while(*head)
+ {
+ Element &el = **head;
+ if ( (IgnoreHash || el.getHash()==hash) && el.key==inKey)
+ {
+ *head = el.next;
+ size--;
+ if (bucketCount>8 && size < (bucketCount>>1) )
+ compact();
+ return true;
+ }
+ head = &el.next;
+ }
+ return false;
+ }
+
+ ELEMENT *allocElement()
+ {
+ ELEMENT *result = (ELEMENT *)InternalNew( sizeof(ELEMENT), false );
+ size++;
+ expandBuckets(size);
+ return result;
+ }
+
+ inline void expandBuckets(int inSize)
+ {
+ // Trades memory vs bucket occupancy - more memory is used for elements anyhow, so not too critical
+ enum { LOG_ELEMS_PER_BUCKET = 1 };
+ if ( inSize > (bucketCount<<LOG_ELEMS_PER_BUCKET) )
+ {
+ int newCount = bucketCount;
+ if (newCount==0)
+ newCount = 2;
+ else
+ while( inSize > (newCount<<LOG_ELEMS_PER_BUCKET) )
+ newCount<<=1;
+ if (newCount!=bucketCount)
+ rebucket(newCount);
+ }
+ }
+
+ Element *find(int inHash, Key inKey)
+ {
+ if (!bucket) return 0;
+ Element *head = bucket[inHash & mask];
+ while(head)
+ {
+ if ( (IgnoreHash || head->getHash()==inHash) && head->key==inKey)
+ return head;
+ head = head->next;
+ }
+ return 0;
+ }
+
+ bool exists(Key inKey) { return find( HashCalcHash(inKey), inKey ); }
+
+
+ HashBase<Key> *convertStore(HashStore inStore)
+ {
+ switch(inStore)
+ {
+ case hashInt:
+ return TConvertStore< typename ELEMENT::IntValue >();
+ case hashFloat:
+ return TConvertStore< typename ELEMENT::FloatValue >();
+ case hashString:
+ return TConvertStore< typename ELEMENT::StringValue >();
+ case hashObject:
+ return TConvertStore< typename ELEMENT::DynamicValue >();
+ case hashInt64:
+ return TConvertStore< typename ELEMENT::Int64Value >();
+ case hashNull:
+ ;
+ }
+ return 0;
+ }
+
+
+ template<typename OUT_VALUE>
+ bool TQuery(Key inKey,OUT_VALUE &outValue)
+ {
+ Element *result = find( HashCalcHash(inKey), inKey );
+ if (!result)
+ return false;
+ CopyValue(outValue,result->value);
+ return true;
+ }
+
+ bool query(Key inKey,int &outValue) { return TQuery(inKey,outValue); }
+ bool query(Key inKey,::String &outValue) { return TQuery(inKey,outValue); }
+ bool query(Key inKey,Float &outValue) { return TQuery(inKey,outValue); }
+ bool query(Key inKey,Dynamic &outValue) { return TQuery(inKey,outValue); }
+ bool query(Key inKey,cpp::Int64 &outValue) { return TQuery(inKey, outValue); }
+
+
+ Value get(Key inKey)
+ {
+ Element *result = find( HashCalcHash(inKey), inKey );
+ if (result)
+ return result->value;
+ return 0;
+ }
+
+
+ template<typename Finder>
+ bool findEquivalentKey(Key &outKey, int inHash, const Finder &inFinder)
+ {
+ if (!bucket) return false;
+ Element *head = bucket[inHash & mask];
+ while(head)
+ {
+ if ( (IgnoreHash || head->getHash()==inHash) && inFinder==head->key)
+ {
+ outKey = head->key;
+ return true;
+ }
+ head = head->next;
+ }
+ return false;
+ }
+
+ static inline bool IsNursery(const void *inPtr)
+ {
+ return inPtr && !(((unsigned char *)inPtr)[ HX_ENDIAN_MARK_ID_BYTE]);
+ }
+
+ template<typename SET>
+ void TSet(Key inKey, const SET &inValue)
+ {
+ unsigned int hash = HashCalcHash(inKey);
+ Element *el = find(hash,inKey);
+ if (el)
+ {
+ CopyValue(el->value,inValue);
+ if (hx::ContainsPointers<Value>())
+ HX_OBJ_WB_GET(this,hx::PointerOf(el->value));
+ return;
+ }
+ el = allocElement();
+ el->setKey(inKey,hash);
+ CopyValue(el->value,inValue);
+ el->next = bucket[hash&mask];
+ bucket[hash&mask] = el;
+
+ #ifdef HXCPP_GC_GENERATIONAL
+ unsigned char &mark = ((unsigned char *)(this))[ HX_ENDIAN_MARK_ID_BYTE];
+ if (mark == hx::gByteMarkID)
+ {
+ // Look for nursery objects...
+ if ( IsNursery(el) || IsNursery(hx::PointerOf(el->key)) ||
+ (hx::ContainsPointers<Value>() && IsNursery(hx::PointerOf(el->value)) ) )
+ {
+ mark|=HX_GC_REMEMBERED;
+ (HX_CTX_GET)->pushReferrer(this);
+ }
+ }
+ #endif
+ }
+
+ void set(Key inKey, const int &inValue) { TSet(inKey, inValue); }
+ void set(Key inKey, const ::String &inValue) { TSet(inKey, inValue); }
+ void set(Key inKey, const Float &inValue) { TSet(inKey, inValue); }
+ void set(Key inKey, const Dynamic &inValue) { TSet(inKey, inValue); }
+ void set(Key inKey, const null &inValue) { TSet(inKey, inValue); }
+ void set(Key inKey, const cpp::Int64 &inValue) { TSet(inKey, inValue); }
+
+ void clear()
+ {
+ bucket = 0;
+ size = 0;
+ mask = 0;
+ bucketCount = 0;
+ }
+
+
+ template<typename F>
+ void iterate(F &inFunc)
+ {
+ for(int b=0;b<bucketCount;b++)
+ {
+ Element *el = bucket[b];
+ while(el)
+ {
+ inFunc(el);
+ el = el->next;
+ }
+ }
+ }
+
+ // Convert
+ template<typename NEW>
+ struct Converter
+ {
+ NEW *result;
+
+ Converter(NEW *inResult) : result(inResult) { }
+
+ void operator()(typename Hash::Element *elem)
+ {
+ result->set(elem->key,elem->value);
+ }
+ };
+
+
+ template<typename NEW_ELEM>
+ HashBase<Key> *TConvertStore()
+ {
+ Hash<NEW_ELEM> *result = new Hash<NEW_ELEM>();
+
+ result->reserve(getSize()*3/2);
+
+ Converter< Hash<NEW_ELEM> > converter(result);
+
+ iterate(converter);
+
+ return result;
+ }
+
+
+
+ // Keys ...
+ struct KeyBuilder
+ {
+ Array<Key> array;
+
+ KeyBuilder(int inReserve = 0)
+ {
+ array = Array<Key>(0,inReserve);
+ }
+ void operator()(typename Hash::Element *elem)
+ {
+ array->push(elem->key);
+ }
+ };
+ Array<Key> keys()
+ {
+ KeyBuilder builder(getSize());
+ iterate(builder);
+ return builder.array;;
+ }
+
+
+ // Values...
+ struct ValueBuilder
+ {
+ Array<ArrayValue> array;
+ ValueBuilder(int inReserve = 0)
+ {
+ array = Array<ArrayValue>(0,inReserve);
+ }
+
+ void operator()(typename Hash::Element *elem)
+ {
+ array->push(elem->value);
+ }
+ };
+ Dynamic values()
+ {
+ ValueBuilder builder(getSize());
+ iterate(builder);
+ return builder.array;;
+ }
+
+
+ // Strings ...
+ struct StringBuilder
+ {
+ Array<String> array;
+ bool raw;
+
+ StringBuilder(int inReserve = 0,bool inRaw=false)
+ {
+ raw = inRaw;
+ array = Array<String>(0,inReserve*4+1);
+ if (!raw) {
+ #if (HXCPP_API_LEVEL >= 430)
+ array->push(HX_CSTRING("["));
+ #else
+ array->push(HX_CSTRING("{ "));
+ #endif
+ }
+ }
+ void operator()(typename Hash::Element *elem)
+ {
+ if (array->length>1)
+ array->push(HX_CSTRING(", "));
+ array->push(String(elem->key));
+ array->push(HX_CSTRING(" => "));
+ array->push(String(elem->value));
+ }
+ ::String toString()
+ {
+ if (!raw) {
+ #if (HXCPP_API_LEVEL >= 430)
+ array->push(HX_CSTRING("]"));
+ #else
+ array->push(HX_CSTRING(" }"));
+ #endif
+ }
+ return array->length==0 ? String() : array->join(HX_CSTRING(""));
+ }
+ };
+
+ String toString()
+ {
+ StringBuilder builder(getSize());
+ iterate(builder);
+ return builder.toString();
+ }
+
+
+ String toStringRaw()
+ {
+ StringBuilder builder(getSize(),true);
+ iterate(builder);
+ return builder.toString();
+ }
+
+
+ // Mark ...
+ struct HashMarker
+ {
+ hx::MarkContext *__inCtx;
+ HashMarker(hx::MarkContext *ctx) : __inCtx(ctx) { }
+ void operator()(typename Hash::Element *inElem)
+ {
+ HX_MARK_ARRAY(inElem);
+ if (!Hash::Element::WeakKeys)
+ {
+ HX_MARK_MEMBER(inElem->key);
+ }
+ HX_MARK_MEMBER(inElem->value);
+ }
+ };
+
+ void __Mark(hx::MarkContext *__inCtx)
+ {
+ HX_MARK_ARRAY(bucket);
+
+ HashMarker marker(__inCtx);
+ iterate(marker);
+ }
+
+#ifdef HXCPP_VISIT_ALLOCS
+
+ void __Visit(hx::VisitContext *__inCtx)
+ {
+ //printf(" visit hash %p\n", this);
+ HX_VISIT_ARRAY(bucket);
+ for(int b=0;b<bucketCount;b++)
+ {
+ HX_VISIT_ARRAY(bucket[b]);
+ Element *el = bucket[b];
+ while(el)
+ {
+ HX_VISIT_MEMBER(el->key);
+ HX_VISIT_MEMBER(el->value);
+ HX_VISIT_ARRAY(el->next);
+ el = el->next;
+ }
+ }
+ }
+#endif
+};
+
+
+} // end namespace hx
+
diff --git a/Sources/c_snikket/src/hx/Lib.cpp b/Sources/c_snikket/src/hx/Lib.cpp
new file mode 100644
index 0000000..3a1d3f2
--- /dev/null
+++ b/Sources/c_snikket/src/hx/Lib.cpp
@@ -0,0 +1,807 @@
+#include <hxcpp.h>
+
+#include <stdio.h>
+#include <string>
+#include <map>
+#include <vector>
+#include <stdlib.h>
+
+#ifdef ANDROID
+#include <android/log.h>
+#include <unistd.h>
+#endif
+
+#if (defined (IPHONE) || defined(EMSCRIPTEN) || defined(STATIC_LINK) || defined(APPLETV) ) && \
+ !defined(HXCPP_DLL_IMPORT) && (!defined(HXCPP_DLL_EXPORT) || defined(HXCPP_SCRIPTABLE) )
+#define HXCPP_NO_DYNAMIC_LOADING
+#elif !defined(ANDROID) && !defined(HX_WINRT) && !defined(IPHONE) && !defined(EMSCRIPTEN) && \
+ !defined(STATIC_LINK) && !defined(APPLETV)
+#define HXCPP_TRY_HAXELIB
+#endif
+
+#ifdef HXCPP_TRY_HAXELIB
+#include <sys/types.h>
+#include <sys/stat.h>
+#endif
+#if defined(BLACKBERRY)
+using namespace std;
+#endif
+#ifdef HXCPP_LOAD_DEBUG
+bool gLoadDebug = true;
+#else
+bool gLoadDebug = false;
+#endif
+
+#ifdef HXCPP_NO_DYNAMIC_LOADING
+
+typedef void *Module;
+Module hxLoadLibrary(const String &) { return 0; }
+void hxFreeLibrary(Module) { }
+
+#elif defined _WIN32
+
+#include <windows.h>
+typedef HMODULE Module;
+
+#ifdef HX_WINRT
+Module hxLoadLibrary(String inLib) { return LoadPackagedLibrary(inLib.__WCStr(),0); }
+#else // Windows, not WinRT
+Module hxLoadLibrary(String inLib)
+{
+ HMODULE result = LoadLibraryW(inLib.__WCStr());
+ if (gLoadDebug)
+ {
+ if (result)
+ printf("Loaded module : %S.\n", inLib.__WCStr());
+ }
+ return result;
+}
+#endif
+
+void *hxFindSymbol(Module inModule, const char *inSymbol) { return (void *)GetProcAddress(inModule,inSymbol); }
+
+void hxFreeLibrary(Module inModule) { FreeLibrary(inModule); }
+
+#else
+
+typedef void *Module;
+
+#include <dlfcn.h>
+typedef void *Module;
+Module hxLoadLibrary(String inLib)
+{
+ int flags = RTLD_GLOBAL;
+ #if defined(HXCPP_RTLD_LAZY) || defined(IPHONE) || defined(EMSCRIPTEN) || defined(STATIC_LINK) || defined(APPLETV)
+ flags |= RTLD_LAZY;
+ #else
+ flags |= RTLD_NOW;
+ #endif
+
+ Module result = dlopen(inLib.__CStr(), flags);
+ if (gLoadDebug)
+ {
+#ifdef HX_WINRT
+ if (result)
+ WINRT_LOG("Loaded : %s.\n", inLib.__CStr());
+ else
+ WINRT_LOG("Error loading library: (%s) %s\n", inLib.__CStr(), dlerror());
+#else
+ if (result)
+ printf("Loaded : %s.\n", inLib.__CStr());
+ else
+ printf("Error loading library: (%s) %s\n", inLib.__CStr(), dlerror());
+#endif
+ }
+ return result;
+}
+void *hxFindSymbol(Module inModule, const char *inSymbol) { return dlsym(inModule,inSymbol); }
+
+void hxFreeLibrary(Module inModule) { dlclose(inModule); }
+
+#endif
+
+typedef std::map<std::string,Module> LoadedModule;
+
+static LoadedModule sgLoadedModule;
+typedef std::vector<Module> ModuleList;
+static ModuleList sgOrderedModules;
+
+typedef hx::Object * (*prim_0)();
+typedef hx::Object * (*prim_1)(hx::Object *);
+typedef hx::Object * (*prim_2)(hx::Object *,hx::Object *);
+typedef hx::Object * (*prim_3)(hx::Object *,hx::Object *,hx::Object *);
+typedef hx::Object * (*prim_4)(hx::Object *,hx::Object *,hx::Object *,hx::Object *);
+typedef hx::Object * (*prim_5)(hx::Object *,hx::Object *,hx::Object *,hx::Object *,hx::Object *);
+typedef hx::Object * (*prim_mult)(hx::Object **inArray,int inArgs);
+
+typedef void *(*FundFunc)();
+
+
+class ExternalPrimitive : public hx::Object
+{
+public:
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdExternalPrimitive };
+
+ inline void *operator new( size_t inSize )
+ { return hx::InternalCreateConstBuffer(0,(int)inSize); }
+ void operator delete( void *) { }
+
+ ExternalPrimitive(void *inProc,int inArgCount,const String &inName) :
+ mProc(inProc), mArgCount(inArgCount), mName(inName.makePermanent())
+ {
+ functionName = ("extern::cffi "+mName).makePermanent().raw_ptr();
+ }
+
+ virtual int __GetType() const { return vtFunction; }
+ String __ToString() const { return mName; }
+
+ Dynamic __run()
+ {
+ HX_STACK_FRAME(hx::EXTERN_CLASS_NAME, "cffi",0, functionName, __FILE__, __LINE__,0);
+ if (mArgCount!=0) throw HX_INVALID_ARG_COUNT;
+ if (mProc==0) hx::Throw( HX_NULL_FUNCTION_POINTER );
+ return ((prim_0)mProc)();
+ }
+ Dynamic __run(D a)
+ {
+ HX_STACK_FRAME(hx::EXTERN_CLASS_NAME, "cffi",0, functionName, __FILE__, __LINE__,0);
+ if (mArgCount!=1) throw HX_INVALID_ARG_COUNT;
+ if (mProc==0) hx::Throw( HX_NULL_FUNCTION_POINTER );
+ return ((prim_1)mProc)(a.GetPtr());
+ }
+ Dynamic __run(D a,D b)
+ {
+ HX_STACK_FRAME(hx::EXTERN_CLASS_NAME, "cffi",0, functionName, __FILE__, __LINE__,0);
+ if (mArgCount!=2) throw HX_INVALID_ARG_COUNT;
+ if (mProc==0) hx::Throw( HX_NULL_FUNCTION_POINTER );
+ return ((prim_2)mProc)(a.GetPtr(),b.GetPtr());
+ }
+ Dynamic __run(D a,D b,D c)
+ {
+ HX_STACK_FRAME(hx::EXTERN_CLASS_NAME, "cffi",0, functionName, __FILE__, __LINE__,0);
+ if (mArgCount!=3) throw HX_INVALID_ARG_COUNT;
+ if (mProc==0) hx::Throw( HX_NULL_FUNCTION_POINTER );
+ return ((prim_3)mProc)(a.GetPtr(),b.GetPtr(),c.GetPtr());
+ }
+ Dynamic __run(D a,D b,D c,D d)
+ {
+ HX_STACK_FRAME(hx::EXTERN_CLASS_NAME, "cffi",0, functionName, __FILE__, __LINE__,0);
+ if (mArgCount!=4) throw HX_INVALID_ARG_COUNT;
+ if (mProc==0) hx::Throw( HX_NULL_FUNCTION_POINTER );
+ return ((prim_4)mProc)(a.GetPtr(),b.GetPtr(),c.GetPtr(),d.GetPtr());
+ }
+ Dynamic __run(D a,D b,D c,D d,D e)
+ {
+ HX_STACK_FRAME(hx::EXTERN_CLASS_NAME, "cffi",0, functionName, __FILE__, __LINE__,0);
+ if (mArgCount!=5) throw HX_INVALID_ARG_COUNT;
+ if (mProc==0) hx::Throw( HX_NULL_FUNCTION_POINTER );
+ return ((prim_5)mProc)(a.GetPtr(),b.GetPtr(),c.GetPtr(),d.GetPtr(),e.GetPtr());
+ }
+
+ Dynamic __Run(const Array<Dynamic> &inArgs)
+ {
+ HX_STACK_FRAME(hx::EXTERN_CLASS_NAME, "cffi",0, functionName, __FILE__, __LINE__,0);
+ if (mArgCount!=-1 && mArgCount!=inArgs->length)
+ throw HX_INVALID_ARG_COUNT;
+ if (mProc==0) hx::Throw( HX_NULL_FUNCTION_POINTER );
+ return ((prim_mult)mProc)( (hx::Object **)inArgs->GetBase(), inArgs->length );
+ }
+
+ int __Compare(const hx::Object *inRHS) const
+ {
+ const ExternalPrimitive *other = dynamic_cast<const ExternalPrimitive *>(inRHS);
+ if (!other)
+ return -1;
+ return mProc==other->mProc;
+ }
+
+
+ void *mProc;
+ int mArgCount;
+ String mName;
+ const char* functionName;
+};
+
+
+namespace
+{
+typedef std::map<String,ExternalPrimitive *> LoadedMap;
+LoadedMap sLoadedMap;
+}
+
+
+typedef void (*SetLoaderProcFunc)(void *(*)(const char *));
+typedef void *(*GetNekoEntryFunc)();
+typedef void (*NekoEntryFunc)();
+
+
+#ifdef HXCPP_TRY_HAXELIB
+
+static String GetFileContents(String inFile)
+{
+#ifndef _MSC_VER
+ FILE *file = fopen(inFile.__CStr(),"rb");
+#else
+ FILE *file = _wfopen(inFile.__WCStr(),L"rb");
+#endif
+ if (!file)
+ {
+ // printf("Could not open %S\n", inFile.__s);
+ return null();
+ }
+
+ char buf[2049];
+ int bytes = fread(buf,1,2048,file);
+ fclose(file);
+ if (bytes<1)
+ return null();
+ buf[bytes]='\0';
+ return String::create(buf);
+}
+
+static String GetEnv(const char *inPath)
+{
+ const char *env = getenv(inPath);
+ String result(env,env?strlen(env):0);
+ return result;
+}
+
+static String FindHaxelib(String inLib)
+{
+ bool loadDebug = getenv("HXCPP_LOAD_DEBUG");
+
+ // printf("FindHaxelib %S\n", inLib.__s);
+
+ String haxepath;
+ hx::strbuf convertBuf;
+ hx::strbuf convertBuf1;
+
+ struct stat s;
+ if ( (stat(".haxelib",&s)==0 && (s.st_mode & S_IFDIR) ) )
+ haxepath = HX_CSTRING(".haxelib");
+ if (loadDebug)
+ printf( haxepath.length ? "Found local .haxelib\n" : "No local .haxelib\n");
+
+ if (haxepath.length==0)
+ {
+ haxepath = GetEnv("HAXELIB_PATH");
+ if (loadDebug)
+ printf("HAXELIB_PATH env:%s\n", haxepath.out_str(&convertBuf));
+ }
+
+ if (haxepath.length==0)
+ {
+ #ifdef _WIN32
+ String home = GetEnv("HOMEDRIVE") + GetEnv("HOMEPATH") + HX_CSTRING("/.haxelib");
+ #else
+ String home = GetEnv("HOME") + HX_CSTRING("/.haxelib");
+ #endif
+ haxepath = GetFileContents(home);
+ if (loadDebug)
+ printf("HAXEPATH home:%s\n", haxepath.out_str(&convertBuf));
+ }
+
+ if (haxepath.length==0)
+ {
+ haxepath = GetEnv("HAXEPATH");
+ if (loadDebug)
+ printf("HAXEPATH env:%s\n", haxepath.out_str(&convertBuf));
+ if (haxepath.length>0)
+ {
+ haxepath += HX_CSTRING("/lib");
+ }
+ }
+
+ if (loadDebug)
+ printf("HAXEPATH dir:%s\n", haxepath.out_str(&convertBuf));
+
+ if (haxepath.length==0)
+ {
+ haxepath = GetFileContents(HX_CSTRING("/etc/.haxepath"));
+ if (loadDebug) printf("HAXEPATH etc:%s\n", haxepath.out_str(&convertBuf));
+ }
+
+ if (haxepath.length==0)
+ {
+ #ifdef _WIN32
+ haxepath = HX_CSTRING("C:\\HaxeToolkit\\haxe\\lib");
+ #else
+ haxepath = HX_CSTRING("/usr/lib/haxe/lib");
+ #endif
+ if (loadDebug) printf("HAXEPATH default:%s\n", haxepath.out_str(&convertBuf));
+ }
+
+ String dir = haxepath + HX_CSTRING("/") + inLib + HX_CSTRING("/");
+
+
+ String dev = dir + HX_CSTRING(".dev");
+ String path = GetFileContents(dev);
+ if (loadDebug) printf("Read dev location from file :%s, got %s\n", dev.out_str(&convertBuf), path.out_str(&convertBuf1));
+ if (path.length==0)
+ {
+ path = GetFileContents(dir + HX_CSTRING(".current"));
+ if (path.length==0)
+ return null();
+ // Replace "." with "," ...
+ String with_commas;
+ for(int i=0;i<path.length;i++)
+ if (path.getChar(i)=='.')
+ with_commas += HX_CSTRING(",");
+ else
+ with_commas += path.substr(i,1);
+
+ path = dir + with_commas + HX_CSTRING("/");
+ }
+
+ return path;
+}
+
+#endif // HXCPP_TRY_HAXELIB
+
+
+typedef std::map<std::string,void *> RegistrationMap;
+RegistrationMap *sgRegisteredPrims=0;
+
+
+
+static std::vector<String> sgLibPath;
+
+static bool sgLibPathIsInit = false;
+
+String __hxcpp_get_bin_dir()
+{
+ return
+#if defined(HX_WINRT)
+ #ifdef HXCPP_M64
+ HX_CSTRING("WinRT64");
+ #else
+ HX_CSTRING("WinRT");
+ #endif
+#elif defined(_WIN32)
+ #ifdef HXCPP_M64
+ HX_CSTRING("Windows64");
+ #else
+ HX_CSTRING("Windows");
+ #endif
+// Unix...
+#elif defined(__APPLE__)
+ #ifdef HXCPP_ARM64
+ HX_CSTRING("MacArm64");
+ #elif defined(HXCPP_M64)
+ HX_CSTRING("Mac64");
+ #else
+ HX_CSTRING("Mac");
+ #endif
+#elif defined (ANDROID)
+ HX_CSTRING("Android");
+#elif defined(WEBOS)
+ HX_CSTRING("webOS");
+#elif defined(BLACKBERRY)
+ HX_CSTRING("BlackBerry");
+#elif defined(RASPBERRYPI)
+ HX_CSTRING("RPi");
+#elif defined(EMSCRIPTEN)
+ HX_CSTRING("Emscripten");
+#elif defined(TIZEN)
+ HX_CSTRING("Tizen");
+#elif defined(IPHONESIM)
+ HX_CSTRING("IPhoneSim");
+#elif defined(IPHONEOS)
+ HX_CSTRING("IPhoneOs");
+#elif defined(APPLETVSIM)
+ HX_CSTRING("AppleTVSim");
+#elif defined(APPLETVOS)
+ HX_CSTRING("AppleTVOS");
+#else
+ #ifdef HXCPP_M64
+ HX_CSTRING("Linux64");
+ #else
+ HX_CSTRING("Linux");
+ #endif
+#endif
+}
+
+String __hxcpp_get_dll_extension()
+{
+ return
+#if defined(_WIN32) || defined(HX_WINRT)
+ HX_CSTRING(".dll");
+#elif defined(IPHONEOS)
+ HX_CSTRING(".ios.dylib");
+#elif defined(IPHONESIM)
+ HX_CSTRING(".sim.dylib");
+#elif defined(APPLETVOS)
+ HX_CSTRING(".tvos.dylib");
+#elif defined(APPLETVSIM)
+ HX_CSTRING(".sim.dylib");
+#elif defined(__APPLE__)
+ HX_CSTRING(".dylib");
+#elif defined(ANDROID) || defined(GPH) || defined(WEBOS) || defined(BLACKBERRY) || defined(EMSCRIPTEN) || defined(TIZEN)
+ HX_CSTRING(".so");
+#else
+ HX_CSTRING(".dso");
+#endif
+}
+
+void __hxcpp_push_dll_path(String inPath)
+{
+ int last = inPath.length-1;
+ int lastCode = (last>0) ? inPath.cca(last) : -1;
+
+ if ( lastCode!='\\' && lastCode!='/')
+ sgLibPath.push_back( (inPath + HX_CSTRING("/")).makePermanent() );
+ else
+ sgLibPath.push_back( inPath.makePermanent() );
+}
+
+
+
+#ifdef HXCPP_NO_DYNAMIC_LOADING
+
+Dynamic __loadprim(String inLib, String inPrim,int inArgCount)
+{
+ String full_name = inPrim;
+ switch(inArgCount)
+ {
+ case 0: full_name += HX_CSTRING("__0"); break;
+ case 1: full_name += HX_CSTRING("__1"); break;
+ case 2: full_name += HX_CSTRING("__2"); break;
+ case 3: full_name += HX_CSTRING("__3"); break;
+ case 4: full_name += HX_CSTRING("__4"); break;
+ case 5: full_name += HX_CSTRING("__5"); break;
+ default:
+ full_name += HX_CSTRING("__MULT");
+ }
+
+ String libString = inLib + HX_CSTRING("_") + full_name;
+ ExternalPrimitive *prim = sLoadedMap[libString];
+ if (prim)
+ return Dynamic(prim);
+
+ if (sgRegisteredPrims)
+ {
+ void *registered = (*sgRegisteredPrims)[full_name.__CStr()];
+ // Try with lib name ...
+ if (!registered)
+ {
+ registered = (*sgRegisteredPrims)[libString.__CStr()];
+ if (registered)
+ full_name = libString;
+ }
+
+ if (registered)
+ {
+ libString = libString.makePermanent();
+ prim = new ExternalPrimitive(registered,inArgCount,libString);
+ sLoadedMap[libString] = prim;
+ return Dynamic(prim);
+ }
+ }
+
+ printf("Primitive not found : %s\n", full_name.__CStr() );
+ return null();
+}
+
+void *__hxcpp_get_proc_address(String inLib, String inPrim,bool ,bool inQuietFail)
+{
+ if (sgRegisteredPrims)
+ return (*sgRegisteredPrims)[inPrim.__CStr()];
+
+ if (!inQuietFail)
+ printf("Primitive not found : %s\n", inPrim.__CStr() );
+ return 0;
+}
+
+int __hxcpp_unload_all_libraries() { return 0; }
+
+
+#else
+
+
+extern "C" void *hx_cffi(const char *inName);
+
+
+void *__hxcpp_get_proc_address(String inLib, String full_name,bool inNdllProc,bool inQuietFail)
+{
+ if (inLib.length==0)
+ {
+ if (sgRegisteredPrims)
+ {
+ void *registered = (*sgRegisteredPrims)[full_name.__CStr()];
+ if (registered)
+ return registered;
+ }
+ if (!inQuietFail)
+ {
+ #ifdef ANDROID
+ __android_log_print(ANDROID_LOG_ERROR, "loader", "Could not find primitive %s in static link", full_name.__CStr());
+ #else
+ fprintf(stderr,"Could not find primitive %s in static link.\n", full_name.__CStr());
+ #endif
+ }
+ return nullptr;
+ }
+
+ String bin = __hxcpp_get_bin_dir();
+ String deviceExt = __hxcpp_get_dll_extension();
+
+
+ #ifdef HX_ANDROID
+ String module_name = HX_CSTRING("lib") + inLib;
+ #else
+ String module_name = inLib;
+ #endif
+
+ #if defined(HX_WINRT) && defined(HXCPP_DEBUG)
+ gLoadDebug = true;
+ #elif defined(IPHONE) || defined(APPLETV)
+ gLoadDebug = true;
+ setenv("DYLD_PRINT_APIS","1",true);
+
+ #elif !defined(HX_WINRT)
+ gLoadDebug = gLoadDebug || getenv("HXCPP_LOAD_DEBUG");
+ #endif
+
+ if (!sgLibPathIsInit)
+ {
+ sgLibPathIsInit = true;
+ #ifndef HX_WINRT
+ sgLibPath.push_back( HX_CSTRING("./") );
+ #endif
+ #ifdef HX_MACOS
+ sgLibPath.push_back( HX_CSTRING("@executable_path/") );
+ #endif
+ sgLibPath.push_back( HX_CSTRING("") );
+
+ #ifdef HXCPP_TRY_HAXELIB
+ String hxcpp = GetEnv("HXCPP");
+ if (hxcpp.length==0)
+ hxcpp = FindHaxelib( HX_CSTRING("hxcpp") );
+ if (hxcpp.length!=0)
+ __hxcpp_push_dll_path(hxcpp+HX_CSTRING("/bin/") + bin + HX_CSTRING("/"));
+ #endif
+ }
+
+ hx::strbuf convertBuf;
+
+
+ Module module = sgLoadedModule[module_name.utf8_str()];
+
+ bool new_module = module==0;
+
+ if (!module && sgRegisteredPrims)
+ {
+ void *registered = (*sgRegisteredPrims)[full_name.__CStr()];
+ // Try with lib name ...
+ if (!registered)
+ {
+ String libString = inLib + HX_CSTRING("_") + full_name;
+ registered = (*sgRegisteredPrims)[libString.__CStr()];
+ }
+
+ if (registered)
+ return registered;
+ }
+
+ if (!module && gLoadDebug)
+ {
+ #ifdef HX_WINRT
+ WINRT_LOG("Searching for %s...\n", inLib.out_str(&convertBuf));
+ #elif defined(ANDROID)
+ __android_log_print(ANDROID_LOG_INFO, "loader", "Searching for %s...", module_name.out_str(&convertBuf));
+ #else
+ printf("Searching for %s...\n", inLib.out_str(&convertBuf));
+ #endif
+ }
+
+ String haxelibPath;
+
+#ifdef HX_WINRT
+ for(int e=0; module==0 && e<1; e++) //only accept DLL
+#else
+ for(int e=0; module==0 && e<3; e++)
+#endif
+ {
+ String extension = e==0 ? deviceExt : e==1 ? HX_CSTRING(".ndll") : HX_CSTRING("");
+
+ for(int path=0;path<sgLibPath.size();path++)
+ {
+ #ifdef HX_WINRT
+ String testPath = module_name + extension;
+ #else
+ String testPath = sgLibPath[path] + module_name + extension;
+ #endif
+ if (gLoadDebug)
+ {
+ #ifdef HX_WINRT
+ WINRT_LOG(" try %s...\n", testPath.out_str(&convertBuf));
+ #elif !defined(ANDROID)
+ printf(" try %s...\n", testPath.out_str(&convertBuf));
+ #else
+ __android_log_print(ANDROID_LOG_INFO, "loader", "Try %s", testPath.out_str(&convertBuf));
+ #endif
+ }
+ module = hxLoadLibrary(testPath);
+ if (module)
+ {
+ if (gLoadDebug)
+ {
+ #ifdef HX_WINRT
+ WINRT_LOG("Found %s\n", testPath.out_str(&convertBuf));
+ #elif !defined(ANDROID)
+ printf("Found %s\n", testPath.out_str(&convertBuf));
+ #else
+ __android_log_print(ANDROID_LOG_INFO, "loader", "Found %s", testPath.out_str(&convertBuf));
+ #endif
+ }
+ break;
+ }
+ }
+
+ #ifdef HXCPP_TRY_HAXELIB
+ if (!module)
+ {
+ if (e==0)
+ haxelibPath = FindHaxelib(inLib);
+
+ if (haxelibPath.length!=0)
+ {
+ String testPath = haxelibPath + HX_CSTRING("/ndll/") + bin + HX_CSTRING("/") + inLib + extension;
+ if (gLoadDebug)
+ printf(" try %s...\n", testPath.out_str(&convertBuf));
+ module = hxLoadLibrary(testPath);
+ if (module && gLoadDebug)
+ {
+ printf("Found %s\n", testPath.out_str(&convertBuf));
+ }
+
+
+ #if defined(HX_MACOS) && defined(HXCPP_ARM64)
+ if (!module)
+ {
+ // Fat binary?
+ String testPath = haxelibPath + HX_CSTRING("/ndll/Mac64/") + inLib + extension;
+ if (gLoadDebug)
+ printf(" try %s...\n", testPath.out_str(&convertBuf));
+ module = hxLoadLibrary(testPath);
+ if (module && gLoadDebug)
+ {
+ printf("Found %s\n", testPath.out_str(&convertBuf));
+ }
+ }
+ #endif
+ }
+ }
+ #endif
+ }
+
+ if (!module)
+ {
+ hx::Throw(HX_CSTRING("Could not load module ") + inLib + HX_CSTRING("@") + full_name);
+ }
+
+
+ if (new_module)
+ {
+ sgLoadedModule[module_name.utf8_str()] = module;
+
+ sgOrderedModules.push_back(module);
+
+ SetLoaderProcFunc set_loader = (SetLoaderProcFunc)hxFindSymbol(module,"hx_set_loader");
+ if (set_loader)
+ set_loader(hx_cffi);
+
+ GetNekoEntryFunc func = (GetNekoEntryFunc)hxFindSymbol(module,"__neko_entry_point");
+ if (func)
+ {
+ NekoEntryFunc entry = (NekoEntryFunc)func();
+ if (entry)
+ entry();
+ }
+ }
+
+ FundFunc proc_query = (FundFunc)hxFindSymbol(module,full_name.__CStr());
+ if (!proc_query)
+ proc_query = (FundFunc)hxFindSymbol(module, (inLib + HX_CSTRING("_") + full_name).__CStr());
+
+ if (!proc_query && !inQuietFail)
+ {
+ #ifdef ANDROID
+ __android_log_print(ANDROID_LOG_ERROR, "loader", "Could not find primitive %s in %p",
+ full_name.__CStr(), module);
+ #else
+ fprintf(stderr,"Could not find primitive %s.\n", full_name.__CStr());
+ #endif
+ return 0;
+ }
+
+ if (!inNdllProc)
+ return (void *)proc_query;
+
+ void *proc = proc_query();
+ if (!proc && !inQuietFail)
+ {
+ #ifdef ANDROID
+ __android_log_print(ANDROID_LOG_ERROR, "loader", "Could not identify primitive %s in %s",
+ full_name.__CStr(), inLib.__CStr() );
+ #else
+ fprintf(stderr,"Could not identify primitive %s in %s\n", full_name.__CStr(),inLib.__CStr());
+ #endif
+ }
+
+ return proc;
+}
+
+int __hxcpp_unload_all_libraries()
+{
+ int unloaded = 0;
+ while(sgOrderedModules.size())
+ {
+ Module module = sgOrderedModules.back();
+ sgOrderedModules.pop_back();
+ hxFreeLibrary(module);
+ unloaded++;
+ }
+ return unloaded;
+}
+
+
+
+Dynamic __loadprim(String inLib, String inPrim,int inArgCount)
+{
+ String full_name = inPrim;
+ switch(inArgCount)
+ {
+ case 0: full_name += HX_CSTRING("__0"); break;
+ case 1: full_name += HX_CSTRING("__1"); break;
+ case 2: full_name += HX_CSTRING("__2"); break;
+ case 3: full_name += HX_CSTRING("__3"); break;
+ case 4: full_name += HX_CSTRING("__4"); break;
+ case 5: full_name += HX_CSTRING("__5"); break;
+ default:
+ full_name += HX_CSTRING("__MULT");
+ }
+
+ String primName = inLib+HX_CSTRING("@")+full_name;
+ ExternalPrimitive *saved = sLoadedMap[primName];
+ if (saved)
+ return Dynamic(saved);
+
+ void *proc = __hxcpp_get_proc_address(inLib,full_name,true);
+ if (proc)
+ {
+ primName = primName.makePermanent();
+
+ saved = new ExternalPrimitive(proc,inArgCount,primName);
+ sLoadedMap[primName] = saved;
+ return Dynamic(saved);
+ }
+ return null();
+}
+
+#endif // not HXCPP_NO_DYNAMIC_LOADING
+
+void __hxcpp_run_dll(String inLib, String inFunc)
+{
+ typedef void (*VoidVoid)();
+
+ void *result = __hxcpp_get_proc_address(inLib,inFunc,false);
+ if (result)
+ ((VoidVoid)result)();
+}
+
+// This can be used to find symbols in static libraries
+
+int __hxcpp_register_prim(const char *inName,void *inProc)
+{
+ if (sgRegisteredPrims==0)
+ sgRegisteredPrims = new RegistrationMap();
+ void * &proc = (*sgRegisteredPrims)[inName];
+ if (proc)
+ {
+ printf("Warning : duplicate symbol %s\n", inName);
+ }
+ proc = inProc;
+ return 0;
+}
+
diff --git a/Sources/c_snikket/src/hx/Object.cpp b/Sources/c_snikket/src/hx/Object.cpp
new file mode 100644
index 0000000..64050b5
--- /dev/null
+++ b/Sources/c_snikket/src/hx/Object.cpp
@@ -0,0 +1,205 @@
+#include <hxcpp.h>
+
+#include <stdio.h>
+#include <hxMath.h>
+//#include <hxMacros.h>
+#include <cpp/CppInt32__.h>
+#include <map>
+
+
+#ifdef _WIN32
+
+#include <windows.h>
+// Stoopid windows ...
+#ifdef RegisterClass
+#undef RegisterClass
+#endif
+#ifdef abs
+#undef abs
+#endif
+
+#else
+
+#include <wchar.h>
+#ifndef EMSCRIPTEN
+typedef int64_t __int64;
+#endif
+
+#endif
+
+#ifdef HXCPP_SCRIPTABLE
+#include <hx/Scriptable.h>
+#endif
+
+
+// --- hxObject -----------------------------------------
+
+namespace hx
+{
+
+String sNone[] = { String(null()) };
+
+bool Object::_hx_isInstanceOf(int inClassId)
+{
+ return inClassId == hx::Object::_hx_ClassId;
+}
+
+Dynamic Object::__IField(int inFieldID)
+{
+ return __Field( __hxcpp_field_from_id(inFieldID), HX_PROP_DYNAMIC );
+}
+
+double Object::__INumField(int inFieldID)
+{
+ return __Field( __hxcpp_field_from_id(inFieldID), HX_PROP_DYNAMIC );
+}
+
+Dynamic *Object::__GetFieldMap() { return 0; }
+
+
+int Object::__Compare(const Object *inRHS) const
+{
+ hx::Object *real = const_cast<Object *>(this);
+ return real < inRHS ? -1 : real==inRHS ? 0 : 1;
+}
+
+
+hx::Val Object::__Field(const String &inString, hx::PropertyAccess inCallProp)
+{
+ #if 0
+ // Will be true for 'Implements dynamic'
+ if (inCallProp && __GetFieldMap())
+ {
+ Dynamic resolve = __Field(HX_CSTRING("resolve"), false);
+ if (resolve.mPtr)
+ return resolve(inString);
+ }
+ #endif
+ return null();
+}
+
+bool Object::__HasField(const String &inString)
+{
+ return false;
+}
+Dynamic Object::__Run(const Array<Dynamic> &inArgs) { return 0; }
+Dynamic Object::__GetItem(int inIndex) const { return null(); }
+Dynamic Object::__SetItem(int inIndex,Dynamic) { return null(); }
+
+
+void Object::__SetThis(Dynamic inThis) { }
+
+hx::Class Object__mClass;
+
+bool AlwaysCast(Object *inPtr) { return inPtr!=0; }
+
+#if !defined(HXCPP_SCRIPTABLE)
+// Other implementation is in Cppia.cpp
+void *hx::Object::_hx_getInterface(int inId)
+{
+ return 0;
+}
+#endif
+
+
+
+#ifdef HXCPP_SCRIPTABLE
+
+class Object__scriptable : public hx::Object {
+ typedef Object__scriptable __ME;
+ void __construct() { }
+ typedef hx::Object super;
+ typedef hx::Object __superString;
+ HX_DEFINE_SCRIPTABLE(HX_ARR_LIST0);
+ HX_DEFINE_SCRIPTABLE_DYNAMIC;
+};
+
+hx::ScriptFunction Object::__script_construct;
+
+static void CPPIA_CALL __s_toString(hx::CppiaCtx *ctx) {
+ ctx->returnString((ctx->getThis())->toString());
+}
+static hx::ScriptNamedFunction __scriptableFunctions[] = {
+ hx::ScriptNamedFunction("toString",__s_toString,"s"),
+ hx::ScriptNamedFunction(0,0,0) };
+
+#endif
+
+void Object::__boot()
+{
+ Static(Object__mClass) = hx::_hx_RegisterClass(HX_CSTRING("Dynamic"),AlwaysCast,sNone,sNone,0,0, 0, 0 );
+
+ #ifdef HXCPP_SCRIPTABLE
+ hx::ScriptableRegisterClass( HX_CSTRING("hx.Object"), (int)sizeof(hx::Object__scriptable), __scriptableFunctions, Object__scriptable::__script_create, Object::__script_construct );
+ #endif
+}
+
+
+hx::Class &Object::__SGetClass() { return Object__mClass; }
+
+hx::Class Object::__GetClass() const { return Object__mClass; }
+
+hx::FieldRef Object::__FieldRef(const String &inString) { return hx::FieldRef(this,inString); }
+
+String Object::__ToString() const { return HX_CSTRING("Object"); }
+
+const char * Object::__CStr() const { return __ToString().__CStr(); }
+
+
+hx::Val Object::__SetField(const String &inField,const hx::Val &inValue, hx::PropertyAccess inCallProp)
+{
+ hx::Throw( HX_CSTRING("Invalid field:") + inField );
+ return null();
+}
+
+Dynamic Object::__run()
+{
+ return __Run(Array_obj<Dynamic>::__new());
+}
+
+Dynamic Object::__run(D a)
+{
+ return __Run( Array_obj<Dynamic>::__new(0,1) << a );
+}
+
+Dynamic Object::__run(D a,D b)
+{
+ return __Run( Array_obj<Dynamic>::__new(0,2) << a << b );
+}
+
+Dynamic Object::__run(D a,D b,D c)
+{
+ return __Run( Array_obj<Dynamic>::__new(0,3) << a << b << c);
+}
+Dynamic Object::__run(D a,D b,D c,D d)
+{
+ return __Run( Array_obj<Dynamic>::__new(0,4) << a << b << c << d);
+}
+Dynamic Object::__run(D a,D b,D c,D d,D e)
+{
+ return __Run( Array_obj<Dynamic>::__new(0,5) << a << b << c << d << e);
+}
+
+void Object::__GetFields(Array<String> &outFields)
+{
+}
+
+
+String Object::toString()
+{
+ Dynamic *m = __GetFieldMap();
+ if (m)
+ {
+ Dynamic func;
+ if (FieldMapGet(m,HX_CSTRING("toString"),func))
+ return func();
+ }
+ return __ToString();
+}
+
+
+} // end namespace hx
+
+
+
+
diff --git a/Sources/c_snikket/src/hx/StdLibs.cpp b/Sources/c_snikket/src/hx/StdLibs.cpp
new file mode 100644
index 0000000..f4c4890
--- /dev/null
+++ b/Sources/c_snikket/src/hx/StdLibs.cpp
@@ -0,0 +1,833 @@
+#include <hxcpp.h>
+#include <hxMath.h>
+#include <hx/Memory.h>
+#include <hx/Thread.h>
+
+#ifdef HX_WINDOWS
+#include <windows.h>
+#include <io.h>
+#elif defined(__unix__) || defined(__APPLE__)
+#include <sys/time.h>
+#ifndef EMSCRIPTEN
+typedef int64_t __int64;
+#endif
+#endif
+
+#ifdef ANDROID
+#include <android/log.h>
+#endif
+#ifdef WEBOS
+#include <syslog.h>
+#endif
+#ifdef TIZEN
+#include <dlog.h>
+#endif
+#if defined(BLACKBERRY) || defined(GCW0)
+#include <unistd.h>
+#endif
+#include <string>
+#include <map>
+#include <stdio.h>
+#include <time.h>
+#include <clocale>
+
+
+#ifdef HX_ANDROID
+#define rand() lrand48()
+#define srand(x) srand48(x)
+#endif
+
+#ifdef HX_WINRT
+#define PRINTF WINRT_PRINTF
+#elif defined(TIZEN)
+#define PRINTF(fmt, ...) dlog_dprint(DLOG_INFO, "trace", fmt, __VA_ARGS__);
+#elif defined(HX_ANDROID) && !defined(HXCPP_EXE_LINK)
+#define PRINTF(fmt, ...) __android_log_print(ANDROID_LOG_INFO, "trace", fmt, __VA_ARGS__);
+#elif defined(WEBOS)
+#define PRINTF(fmt, ...) syslog(LOG_INFO, "trace", fmt, __VA_ARGS__);
+#else
+#define PRINTF printf
+#endif
+
+void __hx_stack_set_last_exception();
+void __hx_stack_push_last_exception();
+
+int _hxcpp_argc = 0;
+char **_hxcpp_argv = 0;
+
+namespace hx
+{
+
+Dynamic Throw(Dynamic inDynamic)
+{
+ #ifdef HXCPP_STACK_TRACE
+ __hx_stack_set_last_exception();
+ #endif
+ throw inDynamic;
+ return null();
+}
+
+
+Dynamic Rethrow(Dynamic inDynamic)
+{
+ #ifdef HXCPP_STACK_TRACE
+ __hx_stack_push_last_exception();
+ #endif
+ throw inDynamic;
+ return null();
+}
+
+
+null NullArithmetic(const char *inErr)
+{
+ Throw( String::create(inErr) );
+ return null();
+}
+
+}
+
+// -------- Resources ---------------------------------------
+
+namespace hx
+{
+
+//typedef std::map<std::wstring,Resource> ResourceSet;
+//static ResourceSet sgResources;
+
+Resource *sgResources = 0;
+Resource *sgSecondResources = 0;
+
+void RegisterResources(Resource *inResources)
+{
+ if (sgResources)
+ sgSecondResources = inResources;
+ else
+ sgResources = inResources;
+}
+
+}
+
+using namespace hx;
+
+Array<String> __hxcpp_resource_names()
+{
+ Array<String> result(0,0);
+
+ if (sgResources)
+ for(Resource *reso = sgResources; reso->mData; reso++)
+ result->push( reso->mName );
+
+ if (sgSecondResources)
+ for(Resource *reso = sgSecondResources; reso->mData; reso++)
+ result->push( reso->mName );
+
+ return result;
+}
+
+String __hxcpp_resource_string(String inName)
+{
+ if (sgResources)
+ for(Resource *reso = sgResources; reso->mData; reso++)
+ {
+ if (reso->mName == inName)
+ #if (HXCPP_API_LEVEL > 0)
+ {
+ #ifdef HX_SMART_STRINGS
+ const unsigned char *p = reso->mData;
+ for(int i=0;i<reso->mDataLength;i++)
+ if (p[i]>127)
+ return String::create((const char *)p, reso->mDataLength);
+ #endif
+ return String((const char *) reso->mData, reso->mDataLength );
+ }
+ #else
+ return String::create((const char *) reso->mData, reso->mDataLength );
+ #endif
+ }
+
+ if (sgSecondResources)
+ {
+ for(Resource *reso = sgSecondResources; reso->mData; reso++)
+ if (reso->mName == inName)
+ {
+ #ifdef HX_SMART_STRINGS
+ const unsigned char *p = reso->mData;
+ for(int i=0;i<reso->mDataLength;i++)
+ if (p[i]>127)
+ return _hx_utf8_to_utf16(p, reso->mDataLength,false);
+ #endif
+ return String((const char *) reso->mData, reso->mDataLength );
+
+ return String((const char *) reso->mData, reso->mDataLength );
+ }
+ }
+ return null();
+}
+
+Array<unsigned char> __hxcpp_resource_bytes(String inName)
+{
+ if (sgResources)
+ for(Resource *reso = sgResources; reso->mData; reso++)
+ {
+ if (reso->mName == inName)
+ {
+ int len = reso->mDataLength;
+ Array<unsigned char> result( len, 0);
+ memcpy( result->GetBase() , reso->mData, len );
+ return result;
+ }
+ }
+ if (sgSecondResources)
+ for(Resource *reso = sgSecondResources; reso->mData; reso++)
+ {
+ if (reso->mName == inName)
+ {
+ int len = reso->mDataLength;
+ Array<unsigned char> result( len, 0);
+ memcpy( result->GetBase() , reso->mData, len );
+ return result;
+ }
+ }
+
+ return null();
+}
+
+// -- hx::Native -------
+
+extern "C" void __hxcpp_lib_main();
+namespace hx
+{
+ static std::string initReturnBuffer;
+ const char *Init(bool stayAttached)
+ {
+ try
+ {
+ __hxcpp_lib_main();
+ if (!stayAttached)
+ SetTopOfStack(0,true);
+ return 0;
+ }
+ catch(Dynamic e)
+ {
+ HX_TOP_OF_STACK
+ if (!stayAttached)
+ {
+ initReturnBuffer = e->toString().utf8_str();
+ SetTopOfStack(0,true);
+ return initReturnBuffer.c_str();
+ }
+ return e->toString().utf8_str();
+ }
+ }
+}
+
+// --- System ---------------------------------------------------------------------
+
+// --- Maths ---------------------------------------------------------
+static double rand_scale = 1.0 / (1<<16) / (1<<16);
+double __hxcpp_drand()
+{
+ unsigned int lo = rand() & 0xfff;
+ unsigned int mid = rand() & 0xfff;
+ unsigned int hi = rand() & 0xff;
+ double result = (lo | (mid<<12) | (hi<<24) ) * rand_scale;
+ return result;
+}
+
+int __hxcpp_irand(int inMax)
+{
+ unsigned int lo = rand() & 0xfff;
+ unsigned int mid = rand() & 0xfff;
+ unsigned int hi = rand() & 0xff;
+ return (lo | (mid<<12) | (hi<<24) ) % inMax;
+}
+
+void __hxcpp_stdlibs_boot()
+{
+ #if defined(_MSC_VER) && !defined(HX_WINRT)
+ HMODULE kernel32 = LoadLibraryA("kernel32");
+ if (kernel32)
+ {
+ typedef BOOL (WINAPI *AttachConsoleFunc)(DWORD);
+ typedef HWND (WINAPI *GetConsoleWindowFunc)(void);
+ AttachConsoleFunc attach = (AttachConsoleFunc)GetProcAddress(kernel32,"AttachConsole");
+ GetConsoleWindowFunc getConsole = (GetConsoleWindowFunc)GetProcAddress(kernel32,"GetConsoleWindow");
+ if (attach && getConsole)
+ {
+ if (!attach( /*ATTACH_PARENT_PROCESS*/ (DWORD)-1 ))
+ {
+ //printf("Could not attach to parent console : %d\n",GetLastError());
+ }
+ else if (getConsole())
+ {
+ if (_fileno(stdout) < 0 || _get_osfhandle(fileno(stdout)) < 0)
+ freopen("CONOUT$", "w", stdout);
+ if (_fileno(stderr) < 0 || _get_osfhandle(fileno(stderr)) < 0)
+ freopen("CONOUT$", "w", stderr);
+ if (_fileno(stdin) < 0 || _get_osfhandle(fileno(stdin)) < 0)
+ freopen("CONIN$", "r", stdin);
+ }
+ }
+ }
+ //_setmode(_fileno(stdout), 0x00040000); // _O_U8TEXT
+ //_setmode(_fileno(stderr), 0x00040000); // _O_U8TEXT
+ //_setmode(_fileno(stdin), 0x00040000); // _O_U8TEXT
+ #endif
+
+ // This is necessary for UTF-8 output to work correctly.
+ setlocale(LC_ALL, "");
+ setlocale(LC_NUMERIC, "C");
+
+ // I think this does more harm than good.
+ // It does not cause fread to return immediately - as perhaps desired.
+ // But it does cause some new-line characters to be lost.
+ //setbuf(stdin, 0);
+ setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
+ setbuf(stderr, 0);
+}
+
+void __trace(Dynamic inObj, Dynamic info)
+{
+ String text;
+ if (inObj != null())
+ text = inObj->toString();
+
+
+ hx::strbuf convertBuf;
+ if (info==null())
+ {
+ PRINTF("?? %s\n", text.raw_ptr() ? text.out_str(&convertBuf) : "null");
+ }
+ else
+ {
+ const char *filename = Dynamic((info)->__Field(HX_CSTRING("fileName"), HX_PROP_DYNAMIC))->toString().utf8_str(0,false);
+ int line = Dynamic((info)->__Field( HX_CSTRING("lineNumber") , HX_PROP_DYNAMIC))->__ToInt();
+
+ hx::strbuf convertBuf;
+ //PRINTF("%s:%d: %s\n", filename, line, text.raw_ptr() ? text.out_str(&convertBuf) : "null");
+ PRINTF("%s:%d: %s\n", filename, line, text.raw_ptr() ? text.out_str(&convertBuf) : "null");
+ }
+ fflush(stdout);
+}
+
+void __hxcpp_exit(int inExitCode)
+{
+ exit(inExitCode);
+}
+
+double __time_stamp()
+{
+#ifdef HX_WINDOWS
+ static __int64 t0=0;
+ static double period=0;
+ __int64 now;
+
+ if (QueryPerformanceCounter((LARGE_INTEGER*)&now))
+ {
+ if (t0==0)
+ {
+ t0 = now;
+ __int64 freq;
+ QueryPerformanceFrequency((LARGE_INTEGER*)&freq);
+ if (freq!=0)
+ period = 1.0/freq;
+ }
+ if (period!=0)
+ return (now-t0)*period;
+ }
+ return (double)clock() / ( (double)CLOCKS_PER_SEC);
+#elif defined(__unix__) || defined(__APPLE__)
+ static double t0 = 0;
+ struct timeval tv;
+ if( gettimeofday(&tv,0) )
+ throw Dynamic("Could not get time");
+ double t = ( tv.tv_sec + ((double)tv.tv_usec) / 1000000.0 );
+ if (t0==0) t0 = t;
+ return t-t0;
+#else
+ return (double)clock() / ( (double)CLOCKS_PER_SEC);
+#endif
+}
+
+#if defined(HX_WINDOWS) && !defined(HX_WINRT)
+
+/*
+ISWHITE and ParseCommandLine are based on the implementation of the
+.NET Core runtime, CoreCLR, which is licensed under the MIT license:
+Copyright (c) Microsoft. All rights reserved.
+See LICENSE file in the CoreCLR project root for full license information.
+
+The original source code of ParseCommandLine can be found in
+https://github.com/dotnet/coreclr/blob/master/src/vm/util.cpp
+*/
+
+#define ISWHITE(x) ((x)==(' ') || (x)==('\t') || (x)==('\n') || (x)==('\r') )
+
+static void ParseCommandLine(LPWSTR psrc, Array<String> &out)
+{
+ unsigned int argcount = 1; // discovery of arg0 is unconditional, below
+
+ bool fInQuotes;
+ int iSlash;
+
+ /* A quoted program name is handled here. The handling is much
+ simpler than for other arguments. Basically, whatever lies
+ between the leading double-quote and next one, or a terminal null
+ character is simply accepted. Fancier handling is not required
+ because the program name must be a legal NTFS/HPFS file name.
+ Note that the double-quote characters are not copied, nor do they
+ contribute to numchars.
+
+ This "simplification" is necessary for compatibility reasons even
+ though it leads to mishandling of certain cases. For example,
+ "c:\tests\"test.exe will result in an arg0 of c:\tests\ and an
+ arg1 of test.exe. In any rational world this is incorrect, but
+ we need to preserve compatibility.
+ */
+
+ LPWSTR pStart = psrc;
+ bool skipQuote = false;
+
+ // Pairs of double-quotes vanish...
+ while(psrc[0]=='\"' && psrc[1]=='\"')
+ psrc += 2;
+
+ if (*psrc == '\"')
+ {
+ // scan from just past the first double-quote through the next
+ // double-quote, or up to a null, whichever comes first
+ psrc++;
+ while ((*psrc!= '\"') && (*psrc != '\0'))
+ {
+ psrc++;
+ // Pairs of double-quotes vanish...
+ while(psrc[0]=='\"' && psrc[1]=='\"')
+ psrc += 2;
+ }
+
+ skipQuote = true;
+ }
+ else
+ {
+ /* Not a quoted program name */
+
+ while (!ISWHITE(*psrc) && *psrc != '\0')
+ psrc++;
+ }
+
+ // We have now identified arg0 as pStart (or pStart+1 if we have a leading
+ // quote) through psrc-1 inclusive
+ if (skipQuote)
+ pStart++;
+ String arg0("");
+ while (pStart < psrc)
+ {
+ arg0 += String::fromCharCode(*pStart);
+ pStart++;
+ }
+ // out.Add(arg0); // the command isn't part of Sys.args()
+
+ // if we stopped on a double-quote when arg0 is quoted, skip over it
+ if (skipQuote && *psrc == '\"')
+ psrc++;
+
+ while ( *psrc != '\0')
+ {
+LEADINGWHITE:
+
+ // The outofarg state.
+ while (ISWHITE(*psrc))
+ psrc++;
+
+ if (*psrc == '\0')
+ break;
+ else
+ if (*psrc == '#')
+ {
+ while (*psrc != '\0' && *psrc != '\n')
+ psrc++; // skip to end of line
+
+ goto LEADINGWHITE;
+ }
+
+ argcount++;
+ fInQuotes = FALSE;
+
+ String arg("");
+
+ while ((!ISWHITE(*psrc) || fInQuotes) && *psrc != '\0')
+ {
+ switch (*psrc)
+ {
+ case '\\':
+ iSlash = 0;
+ while (*psrc == '\\')
+ {
+ iSlash++;
+ psrc++;
+ }
+
+ if (*psrc == '\"')
+ {
+ for ( ; iSlash >= 2; iSlash -= 2)
+ {
+ arg += String("\\");
+ }
+
+ if (iSlash & 1)
+ {
+ arg += String::fromCharCode(*psrc);
+ psrc++;
+ }
+ else
+ {
+ fInQuotes = !fInQuotes;
+ psrc++;
+ }
+ }
+ else
+ for ( ; iSlash > 0; iSlash--)
+ {
+ arg += String("\\");
+ }
+
+ break;
+
+ case '\"':
+ fInQuotes = !fInQuotes;
+ psrc++;
+ break;
+
+ default:
+ arg += String::fromCharCode(*psrc);
+ psrc++;
+ }
+ }
+
+ out.Add(arg);
+ arg = String("");
+ }
+}
+#endif
+
+
+#ifdef __APPLE__
+ #if !defined(IPHONE) && !defined(APPLETV) && !defined(HX_APPLEWATCH)
+ extern "C" {
+ extern int *_NSGetArgc(void);
+ extern char ***_NSGetArgv(void);
+ }
+ #endif
+#endif
+Array<String> __get_args()
+{
+ Array<String> result(0,0);
+ if (_hxcpp_argc)
+ {
+ for(int i=1;i<_hxcpp_argc;i++)
+ result->push( String::create(_hxcpp_argv[i],strlen(_hxcpp_argv[i])) );
+ return result;
+ }
+
+ #ifdef HX_WINRT
+ // Do nothing
+ #elif defined(HX_WINDOWS)
+ LPWSTR str = GetCommandLineW();
+ ParseCommandLine(str, result);
+ #else
+ #ifdef __APPLE__
+
+ #if !defined(IPHONE) && !defined(APPLETV) && !defined(HX_APPLEWATCH)
+ int argc = *_NSGetArgc();
+ char **argv = *_NSGetArgv();
+ for(int i=1;i<argc;i++)
+ result->push( String::create(argv[i],strlen(argv[i])) );
+ #endif
+
+ #else
+ #ifdef ANDROID
+ // TODO: Get from java
+ #elif defined(__linux__)
+ char buf[80];
+ sprintf(buf, "/proc/%d/cmdline", getpid());
+ FILE *cmd = fopen(buf,"rb");
+ bool real_arg = 0;
+ if (cmd)
+ {
+ hx::QuickVec<char> arg;
+
+ buf[0] = '\0';
+ while (fread(buf, 1, 1, cmd))
+ {
+ if ((unsigned char)buf[0] == 0) // line terminator
+ {
+ if (real_arg)
+ result->push( String::create(arg.mPtr, arg.mSize) );
+ real_arg = true;
+ arg.clear();
+ }
+ else
+ arg.push(buf[0]);
+ }
+ fclose(cmd);
+ }
+ #endif
+
+ #endif
+ #endif
+ return result;
+}
+
+
+void __hxcpp_print_string(const String &inV)
+{
+ hx::strbuf convertBuf;
+ PRINTF("%s", inV.out_str(&convertBuf) );
+}
+
+void __hxcpp_println_string(const String &inV)
+{
+ hx::strbuf convertBuf;
+ PRINTF("%s\n", inV.out_str(&convertBuf));
+ fflush(stdout);
+}
+
+
+// --- Casting/Converting ---------------------------------------------------------
+
+
+bool __instanceof(const Dynamic &inValue, const Dynamic &inType)
+{
+ if (inValue==null())
+ return false;
+ if (inType==hx::Object::__SGetClass())
+ return true;
+ hx::Class c = inType;
+ if (c==null())
+ return false;
+ return c->CanCast(inValue.GetPtr());
+}
+
+
+int __int__(double x)
+{
+ #ifndef EMSCRIPTEN
+ if (x < -0x7fffffff || x>0x7fffffff )
+ {
+ __int64 big_int = (__int64)(x);
+ return big_int & 0xffffffff;
+ }
+ else
+ #endif
+ return (int)x;
+}
+
+
+static inline bool is_hex_string(const char *c, int len)
+{
+ return (len > 2 && c[0] == '0' && (c[1] == 'x' || c[1] == 'X'))
+ || (len > 3 && (c[0] == '-' || c[0] == '+') && c[1] == '0' && (c[2] == 'x' || c[2] == 'X'));
+}
+
+Dynamic __hxcpp_parse_int(const String &inString)
+{
+ if (!inString.raw_ptr())
+ return null();
+ hx::strbuf buf;
+ const char *str = inString.utf8_str(&buf);
+
+ // On the first non space char check to see if we've got a hex string
+ while (isspace(*str)) ++str;
+ bool isHex = is_hex_string(str, strlen(str));
+ char *end = 0;
+ long result;
+ if (isHex)
+ {
+ bool neg = str[0] == '-';
+ if (neg) str++;
+ result = strtoul(str,&end,16);
+ if (neg) result = -result;
+ }
+ else
+ result = strtol(str,&end,10);
+ #ifdef HX_WINDOWS
+ if (str==end && !isHex)
+ #else
+ if (str==end)
+ #endif
+ return null();
+ return (int)result;
+}
+
+
+double __hxcpp_parse_substr_float(const String &inString,int start, int length)
+{
+ if (start>=inString.length || length<1 || (start+length)>inString.length )
+ return Math_obj::NaN;
+
+ hx::strbuf buf;
+ const char *str = inString.ascii_substr(&buf,start,length);
+ char *end = (char *)str;
+ double result = str ? strtod(str,&end) : 0;
+
+ if (end==str)
+ return Math_obj::NaN;
+
+ return result;
+}
+
+
+double __hxcpp_parse_float(const String &inString)
+{
+ if (!inString.raw_ptr())
+ return Math_obj::NaN;
+
+ hx::strbuf buf;
+ const char *str = inString.utf8_str(&buf);
+ char *end = (char *)str;
+ double result = str ? strtod(str,&end) : 0;
+
+ if (end==str)
+ return Math_obj::NaN;
+
+ return result;
+}
+
+
+bool __hxcpp_same_closure(Dynamic &inF1,Dynamic &inF2)
+{
+ hx::Object *p1 = inF1.GetPtr();
+ hx::Object *p2 = inF2.GetPtr();
+ if (p1==0 || p2==0)
+ return false;
+ if ( (p1->__GetHandle() != p2->__GetHandle()))
+ return false;
+ return p1->__Compare(p2)==0;
+}
+
+namespace hx
+{
+
+struct VarArgFunc : public hx::Object
+{
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdClosure };
+
+ VarArgFunc(Dynamic &inFunc) : mRealFunc(inFunc) {
+ HX_OBJ_WB_NEW_MARKED_OBJECT(this)
+ }
+
+ int __GetType() const { return vtFunction; }
+ ::String __ToString() const { return mRealFunc->__ToString() ; }
+
+ void __Mark(hx::MarkContext *__inCtx) { HX_MARK_MEMBER(mRealFunc); }
+
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx) { HX_VISIT_MEMBER(mRealFunc); }
+ #endif
+
+ void *__GetHandle() const { return mRealFunc.GetPtr(); }
+ Dynamic __Run(const Array<Dynamic> &inArgs)
+ {
+ return mRealFunc->__run(inArgs);
+ }
+
+ Dynamic mRealFunc;
+};
+
+}
+
+Dynamic __hxcpp_create_var_args(Dynamic &inArrayFunc)
+{
+ return Dynamic(new hx::VarArgFunc(inArrayFunc));
+}
+
+// --- CFFI helpers ------------------------------------------------------------------
+
+
+// Field name management
+
+
+
+static HxMutex sgFieldMapMutex;
+
+typedef std::map<std::string,int> StringToField;
+
+// These need to be pointers because of the unknown order of static object construction.
+String *sgFieldToString=0;
+int sgFieldToStringSize=0;
+int sgFieldToStringAlloc=0;
+StringToField *sgStringToField=0;
+
+static String sgNullString;
+
+
+const String &__hxcpp_field_from_id( int f )
+{
+ if (!sgFieldToString)
+ return sgNullString;
+
+ return sgFieldToString[f];
+}
+
+
+int __hxcpp_field_to_id( const char *inFieldName )
+{
+ AutoLock lock(sgFieldMapMutex);
+
+ if (!sgFieldToStringAlloc)
+ {
+ sgFieldToStringAlloc = 100;
+ sgFieldToString = (String *)HxAlloc(sgFieldToStringAlloc * sizeof(String));
+
+ sgStringToField = new StringToField;
+ }
+
+ std::string f(inFieldName);
+ StringToField::iterator i = sgStringToField->find(f);
+ if (i!=sgStringToField->end())
+ return i->second;
+
+ int result = sgFieldToStringSize;
+ (*sgStringToField)[f] = result;
+ String str(inFieldName,strlen(inFieldName));
+
+ // Make into "const" string that will not get collected...
+ str = String((char *)hx::InternalCreateConstBuffer(str.raw_ptr(),(str.length+1) * sizeof(char),true), str.length );
+
+ if (sgFieldToStringAlloc<=sgFieldToStringSize+1)
+ {
+ int oldAlloc = sgFieldToStringAlloc;
+ String *oldData = sgFieldToString;
+ sgFieldToStringAlloc *= 2;
+ String *newData = (String *)malloc(sgFieldToStringAlloc*sizeof(String));
+ if (oldAlloc)
+ memcpy(newData, oldData, oldAlloc*sizeof(String));
+ // Let oldData dangle to keep it thread safe, rather than require mutex on id read.
+ sgFieldToString = newData;
+ }
+ sgFieldToString[sgFieldToStringSize++] = str;
+ return result;
+}
+
+// --- haxe.Int32 ---------------------------------------------------------------------
+void __hxcpp_check_overflow(int x)
+{
+ if( (((x) >> 30) & 1) != ((unsigned int)(x) >> 31) )
+ throw Dynamic(HX_CSTRING("Overflow ")+x);
+}
+
+// --- Memory ---------------------------------------------------------------------
+
+unsigned char *__hxcpp_memory = 0;
+
+void __hxcpp_memory_memset(Array<unsigned char> &inBuffer ,int pos, int len, int value)
+{
+ if (pos<inBuffer->length)
+ {
+ if (pos+len>inBuffer->length)
+ len = inBuffer->length - pos;
+ if (len>0)
+ memset( inBuffer->Pointer() + pos, value, len);
+ }
+}
+
diff --git a/Sources/c_snikket/src/hx/Thread.cpp b/Sources/c_snikket/src/hx/Thread.cpp
new file mode 100644
index 0000000..e5af49d
--- /dev/null
+++ b/Sources/c_snikket/src/hx/Thread.cpp
@@ -0,0 +1,950 @@
+#include <hxcpp.h>
+
+#include <hx/Thread.h>
+#include <time.h>
+
+DECLARE_TLS_DATA(class hxThreadInfo, tlsCurrentThread);
+
+// g_threadInfoMutex allows atomic access to g_nextThreadNumber
+static HxMutex g_threadInfoMutex;
+// Thread number 0 is reserved for the main thread
+static int g_nextThreadNumber = 1;
+
+
+// How to manage hxThreadInfo references for non haxe threads (main, extenal)?
+// HXCPP_THREAD_INFO_PTHREAD - use pthread api
+// HXCPP_THREAD_INFO_LOCAL - use thread_local storage
+// HXCPP_THREAD_INFO_SINGLETON - use one structure for all threads. Not ideal.
+
+#if __cplusplus > 199711L && !defined(__BORLANDC__)
+ #define HXCPP_THREAD_INFO_LOCAL
+#elif defined (HXCPP_PTHREADS)
+ #define HXCPP_THREAD_INFO_PTHREAD
+#else
+ #define HXCPP_THREAD_INFO_SINGLETON
+#endif
+
+
+// --- Deque ----------------------------------------------------------
+
+struct Deque : public Array_obj<Dynamic>
+{
+ Deque() : Array_obj<Dynamic>(0,0) { }
+
+ static Deque *Create()
+ {
+ Deque *result = new Deque();
+ result->mFinalizer = new hx::InternalFinalizer(result,clean);
+ return result;
+ }
+ static void clean(hx::Object *inObj)
+ {
+ Deque *d = dynamic_cast<Deque *>(inObj);
+ if (d) d->Clean();
+ }
+ void Clean()
+ {
+ #ifdef HX_WINDOWS
+ mMutex.Clean();
+ #endif
+ mSemaphore.Clean();
+ }
+
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx)
+ {
+ Array_obj<Dynamic>::__Visit(__inCtx);
+ mFinalizer->Visit(__inCtx);
+ }
+ #endif
+
+
+ #ifndef HX_THREAD_SEMAPHORE_LOCKABLE
+ HxMutex mMutex;
+ void PushBack(Dynamic inValue)
+ {
+ hx::EnterGCFreeZone();
+ AutoLock lock(mMutex);
+ hx::ExitGCFreeZone();
+
+ push(inValue);
+ mSemaphore.Set();
+ }
+ void PushFront(Dynamic inValue)
+ {
+ hx::EnterGCFreeZone();
+ AutoLock lock(mMutex);
+ hx::ExitGCFreeZone();
+
+ unshift(inValue);
+ mSemaphore.Set();
+ }
+
+
+ Dynamic PopFront(bool inBlock)
+ {
+ hx::EnterGCFreeZone();
+ AutoLock lock(mMutex);
+ if (!inBlock)
+ {
+ hx::ExitGCFreeZone();
+ return shift();
+ }
+ // Ok - wait for something on stack...
+ while(!length)
+ {
+ mSemaphore.Reset();
+ lock.Unlock();
+ mSemaphore.Wait();
+ lock.Lock();
+ }
+ hx::ExitGCFreeZone();
+ if (length==1)
+ mSemaphore.Reset();
+ return shift();
+ }
+ #else
+ void PushBack(Dynamic inValue)
+ {
+ hx::EnterGCFreeZone();
+ AutoLock lock(mSemaphore);
+ hx::ExitGCFreeZone();
+ push(inValue);
+ mSemaphore.QSet();
+ }
+ void PushFront(Dynamic inValue)
+ {
+ hx::EnterGCFreeZone();
+ AutoLock lock(mSemaphore);
+ hx::ExitGCFreeZone();
+ unshift(inValue);
+ mSemaphore.QSet();
+ }
+
+
+ Dynamic PopFront(bool inBlock)
+ {
+ hx::EnterGCFreeZone();
+ AutoLock lock(mSemaphore);
+ while(inBlock && !length)
+ mSemaphore.QWait();
+ hx::ExitGCFreeZone();
+ Dynamic result = shift();
+ if (length)
+ mSemaphore.QSet();
+ return result;
+ }
+ #endif
+
+ hx::InternalFinalizer *mFinalizer;
+ HxSemaphore mSemaphore;
+};
+
+Dynamic __hxcpp_deque_create()
+{
+ return Deque::Create();
+}
+
+void __hxcpp_deque_add(Dynamic q,Dynamic inVal)
+{
+ Deque *d = dynamic_cast<Deque *>(q.mPtr);
+ if (!d)
+ throw HX_INVALID_OBJECT;
+ d->PushBack(inVal);
+}
+
+void __hxcpp_deque_push(Dynamic q,Dynamic inVal)
+{
+ Deque *d = dynamic_cast<Deque *>(q.mPtr);
+ if (!d)
+ throw HX_INVALID_OBJECT;
+ d->PushFront(inVal);
+}
+
+Dynamic __hxcpp_deque_pop(Dynamic q,bool block)
+{
+ Deque *d = dynamic_cast<Deque *>(q.mPtr);
+ if (!d)
+ throw HX_INVALID_OBJECT;
+ return d->PopFront(block);
+}
+
+
+
+// --- Thread ----------------------------------------------------------
+
+class hxThreadInfo : public hx::Object
+{
+public:
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdThreadInfo };
+
+ hxThreadInfo(Dynamic inFunction, int inThreadNumber)
+ : mFunction(inFunction), mThreadNumber(inThreadNumber), mTLS(0,0)
+ {
+ mSemaphore = new HxSemaphore;
+ mDeque = Deque::Create();
+ HX_OBJ_WB_NEW_MARKED_OBJECT(this);
+ }
+ hxThreadInfo()
+ {
+ mSemaphore = 0;
+ mDeque = Deque::Create();
+ HX_OBJ_WB_NEW_MARKED_OBJECT(this);
+ }
+ int GetThreadNumber() const
+ {
+ return mThreadNumber;
+ }
+ void CleanSemaphore()
+ {
+ delete mSemaphore;
+ mSemaphore = 0;
+ }
+ void Send(Dynamic inMessage)
+ {
+ mDeque->PushBack(inMessage);
+ }
+ Dynamic ReadMessage(bool inBlocked)
+ {
+ return mDeque->PopFront(inBlocked);
+ }
+ String toString()
+ {
+ return String(GetThreadNumber());
+ }
+ void SetTLS(int inID,Dynamic inVal) {
+ mTLS->__SetItem(inID,inVal);
+ }
+ Dynamic GetTLS(int inID) { return mTLS[inID]; }
+
+ void __Mark(hx::MarkContext *__inCtx)
+ {
+ HX_MARK_MEMBER(mFunction);
+ HX_MARK_MEMBER(mTLS);
+ if (mDeque)
+ HX_MARK_OBJECT(mDeque);
+ }
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx)
+ {
+ HX_VISIT_MEMBER(mFunction);
+ HX_VISIT_MEMBER(mTLS);
+ if (mDeque)
+ HX_VISIT_OBJECT(mDeque);
+ }
+ #endif
+
+
+ Array<Dynamic> mTLS;
+ HxSemaphore *mSemaphore;
+ Dynamic mFunction;
+ int mThreadNumber;
+ Deque *mDeque;
+};
+
+
+THREAD_FUNC_TYPE hxThreadFunc( void *inInfo )
+{
+ // info[1] will the the "top of stack" - values under this
+ // (ie info[0] and other stack values) will be in the GC conservative range
+ hxThreadInfo *info[2];
+ info[0] = (hxThreadInfo *)inInfo;
+ info[1] = 0;
+
+ tlsCurrentThread = info[0];
+
+ hx::SetTopOfStack((int *)&info[1], true);
+
+ // Release the creation function
+ info[0]->mSemaphore->Set();
+
+ // Call the debugger function to annouce that a thread has been created
+ //__hxcpp_dbg_threadCreatedOrTerminated(info[0]->GetThreadNumber(), true);
+
+ if ( info[0]->mFunction.GetPtr() )
+ {
+ // Try ... catch
+ info[0]->mFunction->__run();
+ }
+
+ // Call the debugger function to annouce that a thread has terminated
+ //__hxcpp_dbg_threadCreatedOrTerminated(info[0]->GetThreadNumber(), false);
+
+ hx::UnregisterCurrentThread();
+
+ tlsCurrentThread = 0;
+
+ THREAD_FUNC_RET
+}
+
+
+
+Dynamic __hxcpp_thread_create(Dynamic inStart)
+{
+ #ifdef EMSCRIPTEN
+ return hx::Throw( HX_CSTRING("Threads are not supported on Emscripten") );
+ #else
+ g_threadInfoMutex.Lock();
+ int threadNumber = g_nextThreadNumber++;
+ g_threadInfoMutex.Unlock();
+
+ hxThreadInfo *info = new hxThreadInfo(inStart, threadNumber);
+
+ hx::GCPrepareMultiThreaded();
+ hx::EnterGCFreeZone();
+
+ bool ok = HxCreateDetachedThread(hxThreadFunc, info);
+ if (ok)
+ {
+ info->mSemaphore->Wait();
+ }
+
+ hx::ExitGCFreeZone();
+ info->CleanSemaphore();
+
+ if (!ok)
+ throw Dynamic( HX_CSTRING("Could not create thread") );
+ return info;
+ #endif
+}
+
+#ifdef HXCPP_THREAD_INFO_PTHREAD
+static pthread_key_t externThreadInfoKey;;
+static pthread_once_t key_once = PTHREAD_ONCE_INIT;
+static void destroyThreadInfo(void *i)
+{
+ hx::Object **threadRoot = (hx::Object **)i;
+ hx::GCRemoveRoot(threadRoot);
+ delete threadRoot;
+}
+static void make_key()
+{
+ pthread_key_create(&externThreadInfoKey, destroyThreadInfo);
+}
+#elif defined(HXCPP_THREAD_INFO_LOCAL)
+struct ThreadInfoHolder
+{
+ hx::Object **threadRoot;
+ ThreadInfoHolder() : threadRoot(0) { }
+ ~ThreadInfoHolder()
+ {
+ if (threadRoot)
+ {
+ hx::GCRemoveRoot(threadRoot);
+ delete threadRoot;
+ }
+ }
+ void set(hx::Object **info) { threadRoot = info; }
+ hxThreadInfo *get() { return threadRoot ? (hxThreadInfo *)*threadRoot : nullptr; }
+
+};
+static thread_local ThreadInfoHolder threadHolder;
+#else
+static hx::Object **sMainThreadInfoRoot = 0;
+#endif
+
+static hxThreadInfo *GetCurrentInfo(bool createNew = true)
+{
+ hxThreadInfo *info = tlsCurrentThread;
+ if (!info)
+ {
+ #ifdef HXCPP_THREAD_INFO_PTHREAD
+ pthread_once(&key_once, make_key);
+ hxThreadInfo **pp = (hxThreadInfo **)pthread_getspecific(externThreadInfoKey);
+ if (pp)
+ info = *pp;
+ #elif defined(HXCPP_THREAD_INFO_LOCAL)
+ info = threadHolder.get();
+ #else
+ if (sMainThreadInfoRoot)
+ info = (hxThreadInfo *)*sMainThreadInfoRoot;
+ #endif
+ }
+
+ if (!info && createNew)
+ {
+ // New, non-haxe thread - might be the first thread, or might be a new
+ // foreign thread.
+ info = new hxThreadInfo(null(), 0);
+ hx::Object **threadRoot = new hx::Object *;
+ *threadRoot = info;
+ hx::GCAddRoot(threadRoot);
+ #ifdef HXCPP_THREAD_INFO_PTHREAD
+ pthread_setspecific(externThreadInfoKey, threadRoot);
+ #elif defined(HXCPP_THREAD_INFO_LOCAL)
+ threadHolder.set(threadRoot);
+ #else
+ sMainThreadInfoRoot = threadRoot;
+ #endif
+ }
+ return info;
+}
+
+Dynamic __hxcpp_thread_current()
+{
+ return GetCurrentInfo();
+}
+
+void __hxcpp_thread_send(Dynamic inThread, Dynamic inMessage)
+{
+ hxThreadInfo *info = dynamic_cast<hxThreadInfo *>(inThread.mPtr);
+ if (!info)
+ throw HX_INVALID_OBJECT;
+ info->Send(inMessage);
+}
+
+Dynamic __hxcpp_thread_read_message(bool inBlocked)
+{
+ hxThreadInfo *info = GetCurrentInfo();
+ return info->ReadMessage(inBlocked);
+}
+
+bool __hxcpp_is_current_thread(hx::Object *inThread)
+{
+ hxThreadInfo *info = tlsCurrentThread;
+ return info==inThread;
+}
+
+// --- TLS ------------------------------------------------------------
+
+Dynamic __hxcpp_tls_get(int inID)
+{
+ return GetCurrentInfo()->GetTLS(inID);
+}
+
+void __hxcpp_tls_set(int inID,Dynamic inVal)
+{
+ GetCurrentInfo()->SetTLS(inID,inVal);
+}
+
+
+
+// --- Mutex ------------------------------------------------------------
+
+class hxMutex : public hx::Object
+{
+public:
+
+ hxMutex()
+ {
+ mFinalizer = new hx::InternalFinalizer(this);
+ mFinalizer->mFinalizer = clean;
+ }
+
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdMutex };
+
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx) { mFinalizer->Visit(__inCtx); }
+ #endif
+
+ hx::InternalFinalizer *mFinalizer;
+
+ static void clean(hx::Object *inObj)
+ {
+ hxMutex *m = dynamic_cast<hxMutex *>(inObj);
+ if (m) m->mMutex.Clean();
+ }
+ bool Try()
+ {
+ return mMutex.TryLock();
+ }
+ void Acquire()
+ {
+ hx::EnterGCFreeZone();
+ mMutex.Lock();
+ hx::ExitGCFreeZone();
+ }
+ void Release()
+ {
+ mMutex.Unlock();
+ }
+
+
+ HxMutex mMutex;
+};
+
+
+
+Dynamic __hxcpp_mutex_create()
+{
+ return new hxMutex;
+}
+void __hxcpp_mutex_acquire(Dynamic inMutex)
+{
+ hxMutex *mutex = dynamic_cast<hxMutex *>(inMutex.mPtr);
+ if (!mutex)
+ throw HX_INVALID_OBJECT;
+ mutex->Acquire();
+}
+bool __hxcpp_mutex_try(Dynamic inMutex)
+{
+ hxMutex *mutex = dynamic_cast<hxMutex *>(inMutex.mPtr);
+ if (!mutex)
+ throw HX_INVALID_OBJECT;
+ return mutex->Try();
+}
+void __hxcpp_mutex_release(Dynamic inMutex)
+{
+ hxMutex *mutex = dynamic_cast<hxMutex *>(inMutex.mPtr);
+ if (!mutex)
+ throw HX_INVALID_OBJECT;
+ return mutex->Release();
+}
+
+#if defined(HX_LINUX) || defined(HX_ANDROID)
+#define POSIX_SEMAPHORE
+#include <semaphore.h>
+#endif
+
+#if defined(HX_MACOS) || defined(IPHONE) || defined(APPLETV)
+#define APPLE_SEMAPHORE
+#include <dispatch/dispatch.h>
+#endif
+
+class hxSemaphore : public hx::Object {
+public:
+ hx::InternalFinalizer *mFinalizer;
+#ifdef HX_WINDOWS
+ HANDLE sem;
+#elif defined (POSIX_SEMAPHORE)
+ sem_t sem;
+#elif defined(APPLE_SEMAPHORE)
+ dispatch_semaphore_t sem;
+#endif
+ bool valid;
+
+ hxSemaphore(int value) {
+ mFinalizer = new hx::InternalFinalizer(this);
+ mFinalizer->mFinalizer = clean;
+#ifdef HX_WINDOWS
+ sem = CreateSemaphoreW(NULL, value, 0x7FFFFFFF, NULL);
+#elif defined(POSIX_SEMAPHORE)
+ sem_init(&sem, 0, value);
+#elif defined(APPLE_SEMAPHORE)
+ sem = dispatch_semaphore_create(value);
+#endif
+ valid = true;
+ }
+
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdSemaphore };
+
+#ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx) { mFinalizer->Visit(__inCtx); }
+#endif
+
+ void Acquire() {
+#if HX_WINDOWS
+ WaitForSingleObject(sem, INFINITE);
+#elif defined(POSIX_SEMAPHORE)
+ sem_wait(&sem);
+#elif defined(APPLE_SEMAPHORE)
+ dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
+#endif
+ }
+
+ bool TryAcquire(double timeout) {
+#ifdef HX_WINDOWS
+ return WaitForSingleObject(sem, (DWORD)((FLOAT)timeout * 1000.0)) == 0;
+#elif defined(POSIX_SEMAPHORE)
+ if (timeout == 0) {
+ return sem_trywait(&sem) == 0;
+ } else {
+ struct timeval tv;
+ struct timespec t;
+ double delta = timeout;
+ int idelta = (int)delta, idelta2;
+ delta -= idelta;
+ delta *= 1.0e9;
+ gettimeofday(&tv, NULL);
+ delta += tv.tv_usec * 1000.0;
+ idelta2 = (int)(delta / 1e9);
+ delta -= idelta2 * 1e9;
+ t.tv_sec = tv.tv_sec + idelta + idelta2;
+ t.tv_nsec = (long)delta;
+ return sem_timedwait(&sem, &t) == 0;
+ }
+#elif defined(APPLE_SEMAPHORE)
+ return dispatch_semaphore_wait(
+ sem,
+ dispatch_time(DISPATCH_TIME_NOW,
+ (int64_t)(timeout * 1000 * 1000 * 1000))) == 0;
+#else
+ return false;
+#endif
+ }
+
+ void Release() {
+#if HX_WINDOWS
+ ReleaseSemaphore(sem, 1, NULL);
+#elif defined(POSIX_SEMAPHORE)
+ sem_post(&sem);
+#elif defined(APPLE_SEMAPHORE)
+ dispatch_semaphore_signal(sem);
+#endif
+ }
+
+ static void clean(hx::Object *inObj) {
+ hxSemaphore *l = dynamic_cast<hxSemaphore *>(inObj);
+ if (l) {
+ if(l->valid) {
+#ifdef HX_WINDOWS
+ CloseHandle(l->sem);
+#elif defined(POSIX_SEMAPHORE)
+ sem_destroy(&l->sem);
+#endif
+ l->valid = false;
+ }
+ }
+ }
+};
+
+Dynamic __hxcpp_semaphore_create(int value) {
+ return new hxSemaphore(value);
+}
+void __hxcpp_semaphore_acquire(Dynamic inSemaphore) {
+ hxSemaphore *semaphore = dynamic_cast<hxSemaphore *>(inSemaphore.mPtr);
+ if (!semaphore)
+ throw HX_INVALID_OBJECT;
+ semaphore->Acquire();
+}
+bool __hxcpp_semaphore_try_acquire(Dynamic inSemaphore, double timeout) {
+ hxSemaphore *semaphore = dynamic_cast<hxSemaphore *>(inSemaphore.mPtr);
+ if (!semaphore)
+ throw HX_INVALID_OBJECT;
+ return semaphore->TryAcquire(timeout);
+}
+void __hxcpp_semaphore_release(Dynamic inSemaphore) {
+ hxSemaphore *semaphore = dynamic_cast<hxSemaphore *>(inSemaphore.mPtr);
+ if (!semaphore)
+ throw HX_INVALID_OBJECT;
+ semaphore->Release();
+}
+
+class hxCondition : public hx::Object {
+public:
+#ifdef HX_WINDOWS
+#ifndef HXCPP_WINXP_COMPAT
+ CRITICAL_SECTION cs;
+ CONDITION_VARIABLE cond;
+#endif
+#else
+ pthread_cond_t *cond;
+ pthread_mutex_t *mutex;
+#endif
+ hx::InternalFinalizer *mFinalizer;
+ hxCondition() {
+ mFinalizer = new hx::InternalFinalizer(this);
+ mFinalizer->mFinalizer = clean;
+#ifdef HX_WINDOWS
+#ifndef HXCPP_WINXP_COMPAT
+ InitializeCriticalSection(&cs);
+ InitializeConditionVariable(&cond);
+#else
+ throw Dynamic(HX_CSTRING("Condition variables are not supported on Windows XP"));
+#endif
+#else
+ pthread_condattr_t cond_attr;
+ pthread_condattr_init(&cond_attr);
+ cond = new pthread_cond_t();
+ pthread_cond_init(cond, &cond_attr);
+ pthread_condattr_destroy(&cond_attr);
+ pthread_mutexattr_t mutex_attr;
+ pthread_mutexattr_init(&mutex_attr);
+ mutex = new pthread_mutex_t();
+ pthread_mutex_init(mutex, &mutex_attr);
+ pthread_mutexattr_destroy(&mutex_attr);
+#endif
+ }
+
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdCondition };
+
+#ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx) { mFinalizer->Visit(__inCtx); }
+#endif
+ static void clean(hx::Object *inObj) {
+ hxCondition *cond = dynamic_cast<hxCondition *>(inObj);
+ if (cond) {
+#ifdef HX_WINDOWS
+#ifndef HXCPP_WINXP_COMPAT
+ DeleteCriticalSection(&cond->cs);
+#endif
+#else
+ pthread_cond_destroy(cond->cond);
+ delete cond->cond;
+ pthread_mutex_destroy(cond->mutex);
+ delete cond->mutex;
+#endif
+ }
+ }
+
+ void Acquire() {
+#ifdef HX_WINDOWS
+#ifndef HXCPP_WINXP_COMPAT
+ EnterCriticalSection(&cs);
+#endif
+#else
+ pthread_mutex_lock(mutex);
+#endif
+ }
+
+ bool TryAcquire() {
+#ifdef HX_WINDOWS
+#ifndef HXCPP_WINXP_COMPAT
+ return (bool)TryEnterCriticalSection(&cs);
+#else
+ return false;
+#endif
+#else
+ return pthread_mutex_trylock(mutex);
+#endif
+ }
+
+ void Release() {
+#ifdef HX_WINDOWS
+#ifndef HXCPP_WINXP_COMPAT
+ LeaveCriticalSection(&cs);
+#endif
+#else
+ pthread_mutex_unlock(mutex);
+#endif
+ }
+
+ void Wait() {
+#ifdef HX_WINDOWS
+#ifndef HXCPP_WINXP_COMPAT
+ SleepConditionVariableCS(&cond,&cs,INFINITE);
+#endif
+#else
+ pthread_cond_wait(cond, mutex);
+#endif
+ }
+
+ bool TimedWait(double timeout) {
+#ifdef HX_WINDOWS
+#ifndef HXCPP_WINXP_COMPAT
+ return (bool)SleepConditionVariableCS(&cond, &cs, (DWORD)((FLOAT)timeout * 1000.0));
+#else
+ return false;
+#endif
+#else
+ struct timeval tv;
+ struct timespec t;
+ double delta = timeout;
+ int idelta = (int)delta, idelta2;
+ delta -= idelta;
+ delta *= 1.0e9;
+ gettimeofday(&tv, NULL);
+ delta += tv.tv_usec * 1000.0;
+ idelta2 = (int)(delta / 1e9);
+ delta -= idelta2 * 1e9;
+ t.tv_sec = tv.tv_sec + idelta + idelta2;
+ t.tv_nsec = (long)delta;
+ return pthread_cond_timedwait(cond, mutex, &t);
+#endif
+ }
+ void Signal() {
+#ifdef HX_WINDOWS
+#ifndef HXCPP_WINXP_COMPAT
+ WakeConditionVariable(&cond);
+#endif
+#else
+ pthread_cond_signal(cond);
+#endif
+ }
+ void Broadcast() {
+#ifdef HX_WINDOWS
+#ifndef HXCPP_WINXP_COMPAT
+ WakeAllConditionVariable(&cond);
+#endif
+#else
+ pthread_cond_broadcast(cond);
+#endif
+ }
+};
+
+Dynamic __hxcpp_condition_create(void) {
+ return new hxCondition;
+}
+void __hxcpp_condition_acquire(Dynamic inCond) {
+ hxCondition *cond = dynamic_cast<hxCondition *>(inCond.mPtr);
+ if (!cond)
+ throw HX_INVALID_OBJECT;
+ cond->Acquire();
+}
+bool __hxcpp_condition_try_acquire(Dynamic inCond) {
+ hxCondition *cond = dynamic_cast<hxCondition *>(inCond.mPtr);
+ if (!cond)
+ throw HX_INVALID_OBJECT;
+ return cond->TryAcquire();
+}
+void __hxcpp_condition_release(Dynamic inCond) {
+ hxCondition *cond = dynamic_cast<hxCondition *>(inCond.mPtr);
+ if (!cond)
+ throw HX_INVALID_OBJECT;
+ cond->Release();
+}
+void __hxcpp_condition_wait(Dynamic inCond) {
+ hxCondition *cond = dynamic_cast<hxCondition *>(inCond.mPtr);
+ if (!cond)
+ throw HX_INVALID_OBJECT;
+ cond->Wait();
+}
+bool __hxcpp_condition_timed_wait(Dynamic inCond, double timeout) {
+ hxCondition *cond = dynamic_cast<hxCondition *>(inCond.mPtr);
+ if (!cond)
+ throw HX_INVALID_OBJECT;
+ return cond->TimedWait(timeout);
+}
+void __hxcpp_condition_signal(Dynamic inCond) {
+ hxCondition *cond = dynamic_cast<hxCondition *>(inCond.mPtr);
+ if (!cond)
+ throw HX_INVALID_OBJECT;
+ cond->Signal();
+}
+void __hxcpp_condition_broadcast(Dynamic inCond) {
+ hxCondition *cond = dynamic_cast<hxCondition *>(inCond.mPtr);
+ if (!cond)
+ throw HX_INVALID_OBJECT;
+ cond->Broadcast();
+}
+
+// --- Lock ------------------------------------------------------------
+
+class hxLock : public hx::Object
+{
+public:
+
+ hxLock()
+ {
+ mFinalizer = new hx::InternalFinalizer(this);
+ mFinalizer->mFinalizer = clean;
+ }
+
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdLock };
+
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx) { mFinalizer->Visit(__inCtx); }
+ #endif
+
+ hx::InternalFinalizer *mFinalizer;
+
+ #if defined(HX_WINDOWS) || defined(__SNC__)
+ double Now()
+ {
+ return (double)clock()/CLOCKS_PER_SEC;
+ }
+ #else
+ double Now()
+ {
+ struct timeval tv;
+ gettimeofday(&tv,0);
+ return tv.tv_sec + tv.tv_usec*0.000001;
+ }
+ #endif
+
+ static void clean(hx::Object *inObj)
+ {
+ hxLock *l = dynamic_cast<hxLock *>(inObj);
+ if (l)
+ {
+ l->mNotEmpty.Clean();
+ l->mAvailableLock.Clean();
+ }
+ }
+ bool Wait(double inTimeout)
+ {
+ double stop = 0;
+ if (inTimeout>=0)
+ stop = Now() + inTimeout;
+ while(1)
+ {
+ mAvailableLock.Lock();
+ if (mAvailable)
+ {
+ --mAvailable;
+ if (mAvailable>0)
+ mNotEmpty.Set();
+ mAvailableLock.Unlock();
+ return true;
+ }
+ mAvailableLock.Unlock();
+ double wait = 0;
+ if (inTimeout>=0)
+ {
+ wait = stop-Now();
+ if (wait<=0)
+ return false;
+ }
+
+ hx::EnterGCFreeZone();
+ if (inTimeout<0)
+ mNotEmpty.Wait( );
+ else
+ mNotEmpty.WaitSeconds(wait);
+ hx::ExitGCFreeZone();
+ }
+ }
+ void Release()
+ {
+ AutoLock lock(mAvailableLock);
+ mAvailable++;
+ mNotEmpty.Set();
+ }
+
+
+ HxSemaphore mNotEmpty;
+ HxMutex mAvailableLock;
+ int mAvailable;
+};
+
+
+
+Dynamic __hxcpp_lock_create()
+{
+ return new hxLock;
+}
+bool __hxcpp_lock_wait(Dynamic inlock,double inTime)
+{
+ hxLock *lock = dynamic_cast<hxLock *>(inlock.mPtr);
+ if (!lock)
+ throw HX_INVALID_OBJECT;
+ return lock->Wait(inTime);
+}
+void __hxcpp_lock_release(Dynamic inlock)
+{
+ hxLock *lock = dynamic_cast<hxLock *>(inlock.mPtr);
+ if (!lock)
+ throw HX_INVALID_OBJECT;
+ lock->Release();
+}
+
+
+int __hxcpp_GetCurrentThreadNumber()
+{
+ // Can't allow GetCurrentInfo() to create the main thread's info
+ // because that can cause a call loop.
+ hxThreadInfo *threadInfo = GetCurrentInfo(false);
+ if (!threadInfo) {
+ return 0;
+ }
+ return threadInfo->GetThreadNumber();
+}
+
+// --- Atomic ---
+
+bool _hx_atomic_exchange_if(::cpp::Pointer<cpp::AtomicInt> inPtr, int test, int newVal )
+{
+ return _hx_atomic_compare_exchange(inPtr, test, newVal) == test;
+}
+
+int _hx_atomic_inc(::cpp::Pointer<cpp::AtomicInt> inPtr )
+{
+ return _hx_atomic_add(inPtr, 1);
+}
+
+int _hx_atomic_dec(::cpp::Pointer<cpp::AtomicInt> inPtr )
+{
+ return _hx_atomic_sub(inPtr, 1);
+}
+
+
diff --git a/Sources/c_snikket/src/hx/Unicase.h b/Sources/c_snikket/src/hx/Unicase.h
new file mode 100755
index 0000000..564c0e4
--- /dev/null
+++ b/Sources/c_snikket/src/hx/Unicase.h
@@ -0,0 +1,125 @@
+#define UL_BITS 6
+#define UL_SIZE 64
+static unsigned short _E[UL_SIZE] = {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,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};
+static unsigned short L1[UL_SIZE] = {0,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,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};
+static unsigned short L3[UL_SIZE] = {224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,0,248,249,250,251,252,253,254,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};
+static unsigned short L4[UL_SIZE] = {257,0,259,0,261,0,263,0,265,0,267,0,269,0,271,0,273,0,275,0,277,0,279,0,281,0,283,0,285,0,287,0,289,0,291,0,293,0,295,0,297,0,299,0,301,0,303,0,105,0,307,0,309,0,311,0,0,314,0,316,0,318,0,320};
+static unsigned short L5[UL_SIZE] = {0,322,0,324,0,326,0,328,0,0,331,0,333,0,335,0,337,0,339,0,341,0,343,0,345,0,347,0,349,0,351,0,353,0,355,0,357,0,359,0,361,0,363,0,365,0,367,0,369,0,371,0,373,0,375,0,255,378,0,380,0,382,0,0};
+static unsigned short L6[UL_SIZE] = {0,595,387,0,389,0,596,392,0,598,599,396,0,0,477,601,603,402,0,608,611,0,617,616,409,0,0,0,623,626,0,629,417,0,419,0,421,0,640,424,0,643,0,0,429,0,648,432,0,650,651,436,0,438,0,658,441,0,0,0,445,0,0,0};
+static unsigned short L7[UL_SIZE] = {0,0,0,0,454,454,0,457,457,0,460,460,0,462,0,464,0,466,0,468,0,470,0,472,0,474,0,476,0,0,479,0,481,0,483,0,485,0,487,0,489,0,491,0,493,0,495,0,0,499,499,0,501,0,405,447,505,0,507,0,509,0,511,0};
+static unsigned short L8[UL_SIZE] = {513,0,515,0,517,0,519,0,521,0,523,0,525,0,527,0,529,0,531,0,533,0,535,0,537,0,539,0,541,0,543,0,414,0,547,0,549,0,551,0,553,0,555,0,557,0,559,0,561,0,563,0,0,0,0,0,0,0,11365,572,0,410,11366,0};
+static unsigned short L9[UL_SIZE] = {0,578,0,384,649,652,583,0,585,0,587,0,589,0,591,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,0,0,0,0,0,0,0,0,0,0,0};
+static unsigned short L13[UL_SIZE] = {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,0,0,0,0,0,0,0,0,0,0,881,0,883,0,0,0,887,0,0,0,0,0,0,0,0,1011};
+static unsigned short L14[UL_SIZE] = {0,0,0,0,0,0,940,0,941,942,943,0,972,0,973,974,0,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,0,963,964,965,966,967,968,969,970,971,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+static unsigned short L15[UL_SIZE] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,983,0,0,0,0,0,0,0,0,985,0,987,0,989,0,991,0,993,0,995,0,997,0,999,0,1001,0,1003,0,1005,0,1007,0,0,0,0,0,952,0,0,1016,0,1010,1019,0,0,891,892,893};
+static unsigned short L16[UL_SIZE] = {1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,1117,1118,1119,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+static unsigned short L17[UL_SIZE] = {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,1121,0,1123,0,1125,0,1127,0,1129,0,1131,0,1133,0,1135,0,1137,0,1139,0,1141,0,1143,0,1145,0,1147,0,1149,0,1151,0};
+static unsigned short L18[UL_SIZE] = {1153,0,0,0,0,0,0,0,0,0,1163,0,1165,0,1167,0,1169,0,1171,0,1173,0,1175,0,1177,0,1179,0,1181,0,1183,0,1185,0,1187,0,1189,0,1191,0,1193,0,1195,0,1197,0,1199,0,1201,0,1203,0,1205,0,1207,0,1209,0,1211,0,1213,0,1215,0};
+static unsigned short L19[UL_SIZE] = {1231,1218,0,1220,0,1222,0,1224,0,1226,0,1228,0,1230,0,0,1233,0,1235,0,1237,0,1239,0,1241,0,1243,0,1245,0,1247,0,1249,0,1251,0,1253,0,1255,0,1257,0,1259,0,1261,0,1263,0,1265,0,1267,0,1269,0,1271,0,1273,0,1275,0,1277,0,1279,0};
+static unsigned short L20[UL_SIZE] = {1281,0,1283,0,1285,0,1287,0,1289,0,1291,0,1293,0,1295,0,1297,0,1299,0,1301,0,1303,0,1305,0,1307,0,1309,0,1311,0,1313,0,1315,0,1317,0,1319,0,1321,0,1323,0,1325,0,1327,0,0,1377,1378,1379,1380,1381,1382,1383,1384,1385,1386,1387,1388,1389,1390,1391};
+static unsigned short L21[UL_SIZE] = {1392,1393,1394,1395,1396,1397,1398,1399,1400,1401,1402,1403,1404,1405,1406,1407,1408,1409,1410,1411,1412,1413,1414,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,0,0,0};
+static unsigned short L66[UL_SIZE] = {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,11520,11521,11522,11523,11524,11525,11526,11527,11528,11529,11530,11531,11532,11533,11534,11535,11536,11537,11538,11539,11540,11541,11542,11543,11544,11545,11546,11547,11548,11549,11550,11551};
+static unsigned short L67[UL_SIZE] = {11552,11553,11554,11555,11556,11557,0,11559,0,0,0,0,0,11565,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,0,0,0,0,0,0,0,0,0,0,0,0};
+static unsigned short L78[UL_SIZE] = {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,43888,43889,43890,43891,43892,43893,43894,43895,43896,43897,43898,43899,43900,43901,43902,43903,43904,43905,43906,43907,43908,43909,43910,43911,43912,43913,43914,43915,43916,43917,43918,43919};
+static unsigned short L79[UL_SIZE] = {43920,43921,43922,43923,43924,43925,43926,43927,43928,43929,43930,43931,43932,43933,43934,43935,43936,43937,43938,43939,43940,43941,43942,43943,43944,43945,43946,43947,43948,43949,43950,43951,43952,43953,43954,43955,43956,43957,43958,43959,43960,43961,43962,43963,43964,43965,43966,43967,5112,5113,5114,5115,5116,5117,0,0,0,0,0,0,0,0,0,0};
+static unsigned short L120[UL_SIZE] = {7681,0,7683,0,7685,0,7687,0,7689,0,7691,0,7693,0,7695,0,7697,0,7699,0,7701,0,7703,0,7705,0,7707,0,7709,0,7711,0,7713,0,7715,0,7717,0,7719,0,7721,0,7723,0,7725,0,7727,0,7729,0,7731,0,7733,0,7735,0,7737,0,7739,0,7741,0,7743,0};
+static unsigned short L121[UL_SIZE] = {7745,0,7747,0,7749,0,7751,0,7753,0,7755,0,7757,0,7759,0,7761,0,7763,0,7765,0,7767,0,7769,0,7771,0,7773,0,7775,0,7777,0,7779,0,7781,0,7783,0,7785,0,7787,0,7789,0,7791,0,7793,0,7795,0,7797,0,7799,0,7801,0,7803,0,7805,0,7807,0};
+static unsigned short L122[UL_SIZE] = {7809,0,7811,0,7813,0,7815,0,7817,0,7819,0,7821,0,7823,0,7825,0,7827,0,7829,0,0,0,0,0,0,0,0,0,223,0,7841,0,7843,0,7845,0,7847,0,7849,0,7851,0,7853,0,7855,0,7857,0,7859,0,7861,0,7863,0,7865,0,7867,0,7869,0,7871,0};
+static unsigned short L123[UL_SIZE] = {7873,0,7875,0,7877,0,7879,0,7881,0,7883,0,7885,0,7887,0,7889,0,7891,0,7893,0,7895,0,7897,0,7899,0,7901,0,7903,0,7905,0,7907,0,7909,0,7911,0,7913,0,7915,0,7917,0,7919,0,7921,0,7923,0,7925,0,7927,0,7929,0,7931,0,7933,0,7935,0};
+static unsigned short L124[UL_SIZE] = {0,0,0,0,0,0,0,0,7936,7937,7938,7939,7940,7941,7942,7943,0,0,0,0,0,0,0,0,7952,7953,7954,7955,7956,7957,0,0,0,0,0,0,0,0,0,0,7968,7969,7970,7971,7972,7973,7974,7975,0,0,0,0,0,0,0,0,7984,7985,7986,7987,7988,7989,7990,7991};
+static unsigned short L125[UL_SIZE] = {0,0,0,0,0,0,0,0,8000,8001,8002,8003,8004,8005,0,0,0,0,0,0,0,0,0,0,0,8017,0,8019,0,8021,0,8023,0,0,0,0,0,0,0,0,8032,8033,8034,8035,8036,8037,8038,8039,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+static unsigned short L126[UL_SIZE] = {0,0,0,0,0,0,0,0,8064,8065,8066,8067,8068,8069,8070,8071,0,0,0,0,0,0,0,0,8080,8081,8082,8083,8084,8085,8086,8087,0,0,0,0,0,0,0,0,8096,8097,8098,8099,8100,8101,8102,8103,0,0,0,0,0,0,0,0,8112,8113,8048,8049,8115,0,0,0};
+static unsigned short L127[UL_SIZE] = {0,0,0,0,0,0,0,0,8050,8051,8052,8053,8131,0,0,0,0,0,0,0,0,0,0,0,8144,8145,8054,8055,0,0,0,0,0,0,0,0,0,0,0,0,8160,8161,8058,8059,8165,0,0,0,0,0,0,0,0,0,0,0,8056,8057,8060,8061,8179,0,0,0};
+static unsigned short L132[UL_SIZE] = {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,969,0,0,0,107,229,0,0,0,0,0,0,8526,0,0,0,0,0,0,0,0,0,0,0,0,0};
+static unsigned short L133[UL_SIZE] = {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,8560,8561,8562,8563,8564,8565,8566,8567,8568,8569,8570,8571,8572,8573,8574,8575,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+static unsigned short L134[UL_SIZE] = {0,0,0,8580,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+static unsigned short L146[UL_SIZE] = {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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9424,9425,9426,9427,9428,9429,9430,9431,9432,9433};
+static unsigned short L147[UL_SIZE] = {9434,9435,9436,9437,9438,9439,9440,9441,9442,9443,9444,9445,9446,9447,9448,9449,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,0,0,0,0,0,0,0,0,0,0};
+static unsigned short L176[UL_SIZE] = {11312,11313,11314,11315,11316,11317,11318,11319,11320,11321,11322,11323,11324,11325,11326,11327,11328,11329,11330,11331,11332,11333,11334,11335,11336,11337,11338,11339,11340,11341,11342,11343,11344,11345,11346,11347,11348,11349,11350,11351,11352,11353,11354,11355,11356,11357,11358,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+static unsigned short L177[UL_SIZE] = {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,11361,0,619,7549,637,0,0,11368,0,11370,0,11372,0,593,625,592,594,0,11379,0,0,11382,0,0,0,0,0,0,0,0,575,576};
+static unsigned short L178[UL_SIZE] = {11393,0,11395,0,11397,0,11399,0,11401,0,11403,0,11405,0,11407,0,11409,0,11411,0,11413,0,11415,0,11417,0,11419,0,11421,0,11423,0,11425,0,11427,0,11429,0,11431,0,11433,0,11435,0,11437,0,11439,0,11441,0,11443,0,11445,0,11447,0,11449,0,11451,0,11453,0,11455,0};
+static unsigned short L179[UL_SIZE] = {11457,0,11459,0,11461,0,11463,0,11465,0,11467,0,11469,0,11471,0,11473,0,11475,0,11477,0,11479,0,11481,0,11483,0,11485,0,11487,0,11489,0,11491,0,0,0,0,0,0,0,0,11500,0,11502,0,0,0,0,11507,0,0,0,0,0,0,0,0,0,0,0,0,0};
+static unsigned short L665[UL_SIZE] = {42561,0,42563,0,42565,0,42567,0,42569,0,42571,0,42573,0,42575,0,42577,0,42579,0,42581,0,42583,0,42585,0,42587,0,42589,0,42591,0,42593,0,42595,0,42597,0,42599,0,42601,0,42603,0,42605,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+static unsigned short L666[UL_SIZE] = {42625,0,42627,0,42629,0,42631,0,42633,0,42635,0,42637,0,42639,0,42641,0,42643,0,42645,0,42647,0,42649,0,42651,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};
+static unsigned short L668[UL_SIZE] = {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,42787,0,42789,0,42791,0,42793,0,42795,0,42797,0,42799,0,0,0,42803,0,42805,0,42807,0,42809,0,42811,0,42813,0,42815,0};
+static unsigned short L669[UL_SIZE] = {42817,0,42819,0,42821,0,42823,0,42825,0,42827,0,42829,0,42831,0,42833,0,42835,0,42837,0,42839,0,42841,0,42843,0,42845,0,42847,0,42849,0,42851,0,42853,0,42855,0,42857,0,42859,0,42861,0,42863,0,0,0,0,0,0,0,0,0,0,42874,0,42876,0,7545,42879,0};
+static unsigned short L670[UL_SIZE] = {42881,0,42883,0,42885,0,42887,0,0,0,0,42892,0,613,0,0,42897,0,42899,0,0,0,42903,0,42905,0,42907,0,42909,0,42911,0,42913,0,42915,0,42917,0,42919,0,42921,0,614,604,609,620,0,0,670,647,669,43859,42933,0,42935,0,0,0,0,0,0,0,0,0};
+static unsigned short L1020[UL_SIZE] = {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,65345,65346,65347,65348,65349,65350,65351,65352,65353,65354,65355,65356,65357,65358,65359,65360,65361,65362,65363,65364,65365,65366,65367,65368,65369,65370,0,0,0,0,0};
+static unsigned short U1[UL_SIZE] = {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,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,0,0,0,0,0};
+static unsigned short U2[UL_SIZE] = {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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,924,0,0,0,0,0,0,0,0,0,0};
+static unsigned short U3[UL_SIZE] = {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,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,0,216,217,218,219,220,221,222,376};
+static unsigned short U4[UL_SIZE] = {0,256,0,258,0,260,0,262,0,264,0,266,0,268,0,270,0,272,0,274,0,276,0,278,0,280,0,282,0,284,0,286,0,288,0,290,0,292,0,294,0,296,0,298,0,300,0,302,0,73,0,306,0,308,0,310,0,0,313,0,315,0,317,0};
+static unsigned short U5[UL_SIZE] = {319,0,321,0,323,0,325,0,327,0,0,330,0,332,0,334,0,336,0,338,0,340,0,342,0,344,0,346,0,348,0,350,0,352,0,354,0,356,0,358,0,360,0,362,0,364,0,366,0,368,0,370,0,372,0,374,0,0,377,0,379,0,381,83};
+static unsigned short U6[UL_SIZE] = {579,0,0,386,0,388,0,0,391,0,0,0,395,0,0,0,0,0,401,0,0,502,0,0,0,408,573,0,0,0,544,0,0,416,0,418,0,420,0,0,423,0,0,0,0,428,0,0,431,0,0,0,435,0,437,0,0,440,0,0,0,444,0,503};
+static unsigned short U7[UL_SIZE] = {0,0,0,0,453,453,453,456,456,456,459,459,459,0,461,0,463,0,465,0,467,0,469,0,471,0,473,0,475,398,0,478,0,480,0,482,0,484,0,486,0,488,0,490,0,492,0,494,0,498,498,498,0,500,0,0,0,504,0,506,0,508,0,510};
+static unsigned short U8[UL_SIZE] = {0,512,0,514,0,516,0,518,0,520,0,522,0,524,0,526,0,528,0,530,0,532,0,534,0,536,0,538,0,540,0,542,0,0,0,546,0,548,0,550,0,552,0,554,0,556,0,558,0,560,0,562,0,0,0,0,0,0,0,0,571,0,0,11390};
+static unsigned short U9[UL_SIZE] = {11391,0,577,0,0,0,0,582,0,584,0,586,0,588,0,590,11375,11373,11376,385,390,0,393,394,0,399,0,400,42923,0,0,0,403,42924,0,404,0,42893,42922,0,407,406,0,11362,42925,0,0,412,0,11374,413,0,0,415,0,0,0,0,0,0,0,11364,0,0};
+static unsigned short U10[UL_SIZE] = {422,0,0,425,0,0,0,42929,430,580,433,434,581,0,0,0,0,0,439,0,0,0,0,0,0,0,0,0,0,42930,42928,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};
+static unsigned short U13[UL_SIZE] = {0,0,0,0,0,921,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,0,0,0,0,0,880,0,882,0,0,0,886,0,0,0,1021,1022,1023,0,0};
+static unsigned short U14[UL_SIZE] = {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,0,0,0,0,0,0,902,904,905,906,0,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927};
+static unsigned short U15[UL_SIZE] = {928,929,931,931,932,933,934,935,936,937,938,939,908,910,911,0,914,920,0,0,0,934,928,975,0,984,0,986,0,988,0,990,0,992,0,994,0,996,0,998,0,1000,0,1002,0,1004,0,1006,922,929,1017,895,0,917,0,0,1015,0,0,1018,0,0,0,0};
+static unsigned short U16[UL_SIZE] = {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,0,0,0,0,0,0,0,0,0,0,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055};
+static unsigned short U17[UL_SIZE] = {1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1024,1025,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,1037,1038,1039,0,1120,0,1122,0,1124,0,1126,0,1128,0,1130,0,1132,0,1134,0,1136,0,1138,0,1140,0,1142,0,1144,0,1146,0,1148,0,1150};
+static unsigned short U18[UL_SIZE] = {0,1152,0,0,0,0,0,0,0,0,0,1162,0,1164,0,1166,0,1168,0,1170,0,1172,0,1174,0,1176,0,1178,0,1180,0,1182,0,1184,0,1186,0,1188,0,1190,0,1192,0,1194,0,1196,0,1198,0,1200,0,1202,0,1204,0,1206,0,1208,0,1210,0,1212,0,1214};
+static unsigned short U19[UL_SIZE] = {0,0,1217,0,1219,0,1221,0,1223,0,1225,0,1227,0,1229,1216,0,1232,0,1234,0,1236,0,1238,0,1240,0,1242,0,1244,0,1246,0,1248,0,1250,0,1252,0,1254,0,1256,0,1258,0,1260,0,1262,0,1264,0,1266,0,1268,0,1270,0,1272,0,1274,0,1276,0,1278};
+static unsigned short U20[UL_SIZE] = {0,1280,0,1282,0,1284,0,1286,0,1288,0,1290,0,1292,0,1294,0,1296,0,1298,0,1300,0,1302,0,1304,0,1306,0,1308,0,1310,0,1312,0,1314,0,1316,0,1318,0,1320,0,1322,0,1324,0,1326,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+static unsigned short U21[UL_SIZE] = {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,1329,1330,1331,1332,1333,1334,1335,1336,1337,1338,1339,1340,1341,1342,1343,1344,1345,1346,1347,1348,1349,1350,1351,1352,1353,1354,1355,1356,1357,1358,1359};
+static unsigned short U22[UL_SIZE] = {1360,1361,1362,1363,1364,1365,1366,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+static unsigned short U79[UL_SIZE] = {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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5104,5105,5106,5107,5108,5109,0,0};
+static unsigned short U117[UL_SIZE] = {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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42877,0,0,0,11363,0,0};
+static unsigned short U120[UL_SIZE] = {0,7680,0,7682,0,7684,0,7686,0,7688,0,7690,0,7692,0,7694,0,7696,0,7698,0,7700,0,7702,0,7704,0,7706,0,7708,0,7710,0,7712,0,7714,0,7716,0,7718,0,7720,0,7722,0,7724,0,7726,0,7728,0,7730,0,7732,0,7734,0,7736,0,7738,0,7740,0,7742};
+static unsigned short U121[UL_SIZE] = {0,7744,0,7746,0,7748,0,7750,0,7752,0,7754,0,7756,0,7758,0,7760,0,7762,0,7764,0,7766,0,7768,0,7770,0,7772,0,7774,0,7776,0,7778,0,7780,0,7782,0,7784,0,7786,0,7788,0,7790,0,7792,0,7794,0,7796,0,7798,0,7800,0,7802,0,7804,0,7806};
+static unsigned short U122[UL_SIZE] = {0,7808,0,7810,0,7812,0,7814,0,7816,0,7818,0,7820,0,7822,0,7824,0,7826,0,7828,0,0,0,0,0,7776,0,0,0,0,0,7840,0,7842,0,7844,0,7846,0,7848,0,7850,0,7852,0,7854,0,7856,0,7858,0,7860,0,7862,0,7864,0,7866,0,7868,0,7870};
+static unsigned short U123[UL_SIZE] = {0,7872,0,7874,0,7876,0,7878,0,7880,0,7882,0,7884,0,7886,0,7888,0,7890,0,7892,0,7894,0,7896,0,7898,0,7900,0,7902,0,7904,0,7906,0,7908,0,7910,0,7912,0,7914,0,7916,0,7918,0,7920,0,7922,0,7924,0,7926,0,7928,0,7930,0,7932,0,7934};
+static unsigned short U124[UL_SIZE] = {7944,7945,7946,7947,7948,7949,7950,7951,0,0,0,0,0,0,0,0,7960,7961,7962,7963,7964,7965,0,0,0,0,0,0,0,0,0,0,7976,7977,7978,7979,7980,7981,7982,7983,0,0,0,0,0,0,0,0,7992,7993,7994,7995,7996,7997,7998,7999,0,0,0,0,0,0,0,0};
+static unsigned short U125[UL_SIZE] = {8008,8009,8010,8011,8012,8013,0,0,0,0,0,0,0,0,0,0,0,8025,0,8027,0,8029,0,8031,0,0,0,0,0,0,0,0,8040,8041,8042,8043,8044,8045,8046,8047,0,0,0,0,0,0,0,0,8122,8123,8136,8137,8138,8139,8154,8155,8184,8185,8170,8171,8186,8187,0,0};
+static unsigned short U126[UL_SIZE] = {8072,8073,8074,8075,8076,8077,8078,8079,0,0,0,0,0,0,0,0,8088,8089,8090,8091,8092,8093,8094,8095,0,0,0,0,0,0,0,0,8104,8105,8106,8107,8108,8109,8110,8111,0,0,0,0,0,0,0,0,8120,8121,0,8124,0,0,0,0,0,0,0,0,0,0,921,0};
+static unsigned short U127[UL_SIZE] = {0,0,0,8140,0,0,0,0,0,0,0,0,0,0,0,0,8152,8153,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8168,8169,0,0,0,8172,0,0,0,0,0,0,0,0,0,0,0,0,0,8188,0,0,0,0,0,0,0,0,0,0,0,0};
+static unsigned short U133[UL_SIZE] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,8498,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,8544,8545,8546,8547,8548,8549,8550,8551,8552,8553,8554,8555,8556,8557,8558,8559};
+static unsigned short U134[UL_SIZE] = {0,0,0,0,8579,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+static unsigned short U147[UL_SIZE] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9398,9399,9400,9401,9402,9403,9404,9405,9406,9407,9408,9409,9410,9411,9412,9413,9414,9415,9416,9417,9418,9419,9420,9421,9422,9423,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+static unsigned short U176[UL_SIZE] = {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,0,0,0,0,0,0,0,0,0,0,11264,11265,11266,11267,11268,11269,11270,11271,11272,11273,11274,11275,11276,11277,11278,11279};
+static unsigned short U177[UL_SIZE] = {11280,11281,11282,11283,11284,11285,11286,11287,11288,11289,11290,11291,11292,11293,11294,11295,11296,11297,11298,11299,11300,11301,11302,11303,11304,11305,11306,11307,11308,11309,11310,0,0,11360,0,0,0,570,574,0,11367,0,11369,0,11371,0,0,0,0,0,0,11378,0,0,11381,0,0,0,0,0,0,0,0,0};
+static unsigned short U178[UL_SIZE] = {0,11392,0,11394,0,11396,0,11398,0,11400,0,11402,0,11404,0,11406,0,11408,0,11410,0,11412,0,11414,0,11416,0,11418,0,11420,0,11422,0,11424,0,11426,0,11428,0,11430,0,11432,0,11434,0,11436,0,11438,0,11440,0,11442,0,11444,0,11446,0,11448,0,11450,0,11452,0,11454};
+static unsigned short U179[UL_SIZE] = {0,11456,0,11458,0,11460,0,11462,0,11464,0,11466,0,11468,0,11470,0,11472,0,11474,0,11476,0,11478,0,11480,0,11482,0,11484,0,11486,0,11488,0,11490,0,0,0,0,0,0,0,0,11499,0,11501,0,0,0,0,11506,0,0,0,0,0,0,0,0,0,0,0,0};
+static unsigned short U180[UL_SIZE] = {4256,4257,4258,4259,4260,4261,4262,4263,4264,4265,4266,4267,4268,4269,4270,4271,4272,4273,4274,4275,4276,4277,4278,4279,4280,4281,4282,4283,4284,4285,4286,4287,4288,4289,4290,4291,4292,4293,0,4295,0,0,0,0,0,4301,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+static unsigned short U665[UL_SIZE] = {0,42560,0,42562,0,42564,0,42566,0,42568,0,42570,0,42572,0,42574,0,42576,0,42578,0,42580,0,42582,0,42584,0,42586,0,42588,0,42590,0,42592,0,42594,0,42596,0,42598,0,42600,0,42602,0,42604,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+static unsigned short U666[UL_SIZE] = {0,42624,0,42626,0,42628,0,42630,0,42632,0,42634,0,42636,0,42638,0,42640,0,42642,0,42644,0,42646,0,42648,0,42650,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};
+static unsigned short U668[UL_SIZE] = {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,42786,0,42788,0,42790,0,42792,0,42794,0,42796,0,42798,0,0,0,42802,0,42804,0,42806,0,42808,0,42810,0,42812,0,42814};
+static unsigned short U669[UL_SIZE] = {0,42816,0,42818,0,42820,0,42822,0,42824,0,42826,0,42828,0,42830,0,42832,0,42834,0,42836,0,42838,0,42840,0,42842,0,42844,0,42846,0,42848,0,42850,0,42852,0,42854,0,42856,0,42858,0,42860,0,42862,0,0,0,0,0,0,0,0,0,0,42873,0,42875,0,0,42878};
+static unsigned short U670[UL_SIZE] = {0,42880,0,42882,0,42884,0,42886,0,0,0,0,42891,0,0,0,0,42896,0,42898,0,0,0,42902,0,42904,0,42906,0,42908,0,42910,0,42912,0,42914,0,42916,0,42918,0,42920,0,0,0,0,0,0,0,0,0,0,0,42932,0,42934,0,0,0,0,0,0,0,0};
+static unsigned short U685[UL_SIZE] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42931,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,5024,5025,5026,5027,5028,5029,5030,5031,5032,5033,5034,5035,5036,5037,5038,5039};
+static unsigned short U686[UL_SIZE] = {5040,5041,5042,5043,5044,5045,5046,5047,5048,5049,5050,5051,5052,5053,5054,5055,5056,5057,5058,5059,5060,5061,5062,5063,5064,5065,5066,5067,5068,5069,5070,5071,5072,5073,5074,5075,5076,5077,5078,5079,5080,5081,5082,5083,5084,5085,5086,5087,5088,5089,5090,5091,5092,5093,5094,5095,5096,5097,5098,5099,5100,5101,5102,5103};
+static unsigned short U1021[UL_SIZE] = {0,65313,65314,65315,65316,65317,65318,65319,65320,65321,65322,65323,65324,65325,65326,65327,65328,65329,65330,65331,65332,65333,65334,65335,65336,65337,65338,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};
+#define LMAX 1021
+#define UMAX 1022
+static unsigned short *LOWER[LMAX] = {_E,L1,_E,L3,L4,L5,L6,L7,L8,L9,_E,_E,_E,L13,L14,L15,L16,L17,L18,L19,L20,L21,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,L66,L67,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,L78,L79,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,L120,L121,L122,L123,L124,L125,L126,L127,_E,_E,_E,_E,L132,L133,L134,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,L146,L147,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,L176,L177,L178,L179,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,L665,L666,_E,L668,L669,L670,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,L1020};
+static unsigned short *UPPER[UMAX] = {_E,U1,U2,U3,U4,U5,U6,U7,U8,U9,U10,_E,_E,U13,U14,U15,U16,U17,U18,U19,U20,U21,U22,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,U79,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,U117,_E,_E,U120,U121,U122,U123,U124,U125,U126,U127,_E,_E,_E,_E,_E,U133,U134,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,U147,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,U176,U177,U178,U179,U180,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,U665,U666,_E,U668,U669,U670,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,U685,U686,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,_E,U1021};
+
+
+
+inline int unicase_toupper(int c)
+{
+ int up = c >> UL_BITS;
+ if( up < UMAX )
+ {
+ unsigned int c2 = UPPER[up][c&((1<<UL_BITS)-1)];
+ if( c2 )
+ return c2;
+ }
+ return c;
+}
+
+inline int unicase_tolower(int c)
+{
+ int up = c >> UL_BITS;
+ if( up < LMAX )
+ {
+ unsigned int c2 = LOWER[up][c&((1<<UL_BITS)-1)];
+ if( c2 )
+ return c2;
+ }
+ return c;
+}
+
+
diff --git a/Sources/c_snikket/src/hx/gc/GcCommon.cpp b/Sources/c_snikket/src/hx/gc/GcCommon.cpp
new file mode 100644
index 0000000..f336fd6
--- /dev/null
+++ b/Sources/c_snikket/src/hx/gc/GcCommon.cpp
@@ -0,0 +1,182 @@
+#include <hxcpp.h>
+
+#include <map>
+#include <vector>
+#include <set>
+#include <stdlib.h>
+
+#if defined(HXCPP_CAPTURE_x64) && !defined(__GNUC__)
+#include <windows.h>
+#endif
+
+
+#ifdef _WIN32
+
+#define GC_WIN32_THREADS
+#include <time.h>
+
+#endif
+
+#ifdef HXCPP_TELEMETRY
+extern void __hxt_new_string(void* result, int size);
+#endif
+
+
+
+
+namespace hx
+{
+#if defined(HX_MACOS) || defined(HX_WINDOWS) || defined(HX_LINUX) || defined(__ORBIS__)
+int sgMinimumWorkingMemory = 20*1024*1024;
+int sgMinimumFreeSpace = 10*1024*1024;
+#else
+int sgMinimumWorkingMemory = 8*1024*1024;
+int sgMinimumFreeSpace = 4*1024*1024;
+#endif
+// Once you use more than the minimum, this kicks in...
+int sgTargetFreeSpacePercentage = 100;
+
+
+
+
+
+
+// Called internally before and GC operations
+void CommonInitAlloc()
+{
+ #if !defined(HX_WINRT) && !defined(__SNC__) && !defined(__ORBIS__)
+ const char *minimumWorking = getenv("HXCPP_MINIMUM_WORKING_MEMORY");
+ if (minimumWorking)
+ {
+ int mem = atoi(minimumWorking);
+ if (mem>0)
+ sgMinimumWorkingMemory = mem;
+ }
+
+ const char *minimumFreeSpace = getenv("HXCPP_MINIMUM_FREE_SPACE");
+ if (minimumFreeSpace)
+ {
+ int mem = atoi(minimumFreeSpace);
+ if (mem>0)
+ sgMinimumFreeSpace = mem;
+ }
+
+
+ const char *targetFree = getenv("HXCPP_TARGET_FREE_SPACE");
+ if (targetFree)
+ {
+ int percent = atoi(targetFree);
+ if (percent>0)
+ sgTargetFreeSpacePercentage = percent;
+ }
+ #endif
+}
+
+} // end namespace hx
+
+
+
+void *String::operator new( size_t inSize )
+{
+ return hx::InternalNew(inSize,false);
+}
+
+
+void __hxcpp_collect(bool inMajor)
+{
+ hx::InternalCollect(inMajor,inMajor);
+}
+
+
+void __hxcpp_gc_compact()
+{
+ int mem = hx::InternalCollect(true,true);
+ while(true)
+ {
+ int compact = hx::InternalCollect(true,true);
+ if (compact>=mem-16384)
+ break;
+ mem = compact;
+ }
+}
+
+namespace hx
+{
+
+void GCAddFinalizer(hx::Object *v, finalizer f)
+{
+ if (v)
+ {
+ throw Dynamic(HX_CSTRING("Add finalizer error"));
+ }
+}
+
+HX_CHAR *NewString(int inLen)
+{
+ char *result = (char *)hx::InternalNew( (inLen+1)*sizeof(char), false );
+ result[inLen] = '\0';
+#ifdef HXCPP_TELEMETRY
+ __hxt_new_string(result, inLen+1);
+#endif
+ return result;
+
+}
+
+void *NewGCBytes(void *inData,int inSize)
+{
+ void *result = hx::InternalNew(inSize,false);
+ if (inData)
+ {
+ memcpy(result,inData,inSize);
+ }
+ return result;
+}
+
+
+void *NewGCPrivate(void *inData,int inSize)
+{
+ void *result = InternalNew(inSize,false);
+ if (inData)
+ {
+ memcpy(result,inData,inSize);
+ }
+ return result;
+}
+
+
+
+} // end namespace hx
+
+
+
+
+void __hxcpp_enable(bool inEnable)
+{
+ hx::InternalEnableGC(inEnable);
+}
+
+void __hxcpp_set_minimum_working_memory(int inBytes)
+{
+ hx::sgMinimumWorkingMemory = inBytes;
+}
+
+void __hxcpp_set_minimum_free_space(int inBytes)
+{
+ hx::sgMinimumFreeSpace = inBytes;
+}
+
+void __hxcpp_set_target_free_space_percentage(int inPercentage)
+{
+ hx::sgTargetFreeSpacePercentage = inPercentage;
+}
+
+bool __hxcpp_is_const_string(const ::String &inString)
+{
+ #ifdef HXCPP_ALIGN_ALLOC
+ // Unaligned must be native const
+ if ( ((size_t)inString.__s) & 0x3 )
+ return true;
+ #endif
+ return ((unsigned int *)inString.raw_ptr())[-1] & HX_GC_CONST_ALLOC_BIT;
+}
+
diff --git a/Sources/c_snikket/src/hx/gc/GcRegCapture.cpp b/Sources/c_snikket/src/hx/gc/GcRegCapture.cpp
new file mode 100644
index 0000000..00a3859
--- /dev/null
+++ b/Sources/c_snikket/src/hx/gc/GcRegCapture.cpp
@@ -0,0 +1,159 @@
+#include "GcRegCapture.h"
+
+#ifdef HXCPP_CAPTURE_SETJMP // {
+
+// Nothing
+
+#elif defined(HXCPP_CAPTURE_x86) // } {
+
+#pragma optimize( "", off )
+
+
+namespace hx {
+
+void CaptureX86(RegisterCaptureBuffer &outBuffer)
+{
+ void *regEsi;
+ void *regEdi;
+ void *regEbx;
+ #ifdef __GNUC__
+ asm ("mov %%esi, %0\n\t" : "=r" (regEsi) );
+ asm ("mov %%edi, %0\n\t" : "=r" (regEdi) );
+ asm ("mov %%ebx, %0\n\t" : "=r" (regEbx) );
+ #else
+ __asm {
+ mov regEsi, esi
+ mov regEdi, edi
+ mov regEbx, ebx
+ }
+ #endif
+ outBuffer.esi = regEsi;
+ outBuffer.edi = regEdi;
+ outBuffer.ebx = regEbx;
+}
+
+} // end namespace hx
+
+#elif defined(HXCPP_CAPTURE_x64) // } {
+
+#if !defined(__GNUC__)
+#include <windows.h>
+#endif
+
+namespace hx {
+
+void CaptureX64(RegisterCaptureBuffer &outBuffer)
+{
+ #if !defined(__GNUC__)
+ CONTEXT context;
+
+ context.ContextFlags = CONTEXT_INTEGER;
+ RtlCaptureContext(&context);
+
+ outBuffer.rbx = (void *)context.Rbx;
+ outBuffer.rbp = (void *)context.Rbp;
+ outBuffer.rdi = (void *)context.Rdi;
+ outBuffer.r12 = (void *)context.R12;
+ outBuffer.r13 = (void *)context.R13;
+ outBuffer.r14 = (void *)context.R14;
+ outBuffer.r15 = (void *)context.R15;
+ memcpy(outBuffer.xmm, &context.Xmm0, sizeof(outBuffer.xmm));
+ #else
+ void *regBx;
+ void *regBp;
+ void *regDi;
+ void *reg12;
+ void *reg13;
+ void *reg14;
+ void *reg15;
+ asm ("movq %%rbx, %0\n\t" : "=r" (regBx) );
+ asm ("movq %%rbp, %0\n\t" : "=r" (regBp) );
+ asm ("movq %%rdi, %0\n\t" : "=r" (regDi) );
+ asm ("movq %%r12, %0\n\t" : "=r" (reg12) );
+ asm ("movq %%r13, %0\n\t" : "=r" (reg13) );
+ asm ("movq %%r14, %0\n\t" : "=r" (reg14) );
+ asm ("movq %%r15, %0\n\t" : "=r" (reg15) );
+ outBuffer.rbx = regBx;
+ outBuffer.rbp = regBp;
+ outBuffer.r12 = reg12;
+ outBuffer.r13 = reg13;
+ outBuffer.r14 = reg14;
+ outBuffer.r15 = reg15;
+ #endif
+}
+
+} // end namespace hx
+
+
+#elif defined(HXCPP_CAPTURE_ARM64) // } {
+
+namespace hx {
+
+void CaptureArm64(RegisterCaptureBuffer &outBuffer)
+{
+ void *regX19;
+ void *regX20;
+ void *regX21;
+ void *regX22;
+ void *regX23;
+ void *regX24;
+ void *regX25;
+ void *regX26;
+ void *regX27;
+ void *regX28;
+ asm ("mov %0, x19\n\t" : "=r" (regX19) );
+ asm ("mov %0, x20\n\t" : "=r" (regX20) );
+ asm ("mov %0, x21\n\t" : "=r" (regX21) );
+ asm ("mov %0, x22\n\t" : "=r" (regX22) );
+ asm ("mov %0, x23\n\t" : "=r" (regX23) );
+ asm ("mov %0, x24\n\t" : "=r" (regX24) );
+ asm ("mov %0, x25\n\t" : "=r" (regX25) );
+ asm ("mov %0, x26\n\t" : "=r" (regX26) );
+ asm ("mov %0, x27\n\t" : "=r" (regX27) );
+ asm ("mov %0, x28\n\t" : "=r" (regX28) );
+ outBuffer.x19 = regX19;
+ outBuffer.x20 = regX20;
+ outBuffer.x21 = regX21;
+ outBuffer.x22 = regX22;
+ outBuffer.x23 = regX23;
+ outBuffer.x24 = regX24;
+ outBuffer.x25 = regX25;
+ outBuffer.x26 = regX26;
+ outBuffer.x27 = regX27;
+ outBuffer.x28 = regX28;
+}
+
+} // end namespace
+
+#else // } {
+
+#include <string.h>
+
+namespace hx {
+
+// Put this function here so we can be reasonablly sure that "this" register and
+// the 4 registers that may be used to pass args are on the stack.
+int RegisterCapture::Capture(int *inTopOfStack,int **inBuf,int &outSize,int inMaxSize, int *inBottom)
+{
+ int size = ( (char *)inTopOfStack - (char *)inBottom )/sizeof(void *);
+ if (size>inMaxSize)
+ size = inMaxSize;
+ outSize = size;
+ if (size>0)
+ memcpy(inBuf,inBottom,size*sizeof(void*));
+ return 1;
+}
+
+
+RegisterCapture *gRegisterCaptureInstance = 0;
+RegisterCapture *RegisterCapture::Instance()
+{
+ if (!gRegisterCaptureInstance)
+ gRegisterCaptureInstance = new RegisterCapture();
+ return gRegisterCaptureInstance;
+}
+
+} // end namespace hx
+
+#endif // }
+
diff --git a/Sources/c_snikket/src/hx/gc/GcRegCapture.h b/Sources/c_snikket/src/hx/gc/GcRegCapture.h
new file mode 100644
index 0000000..61e4171
--- /dev/null
+++ b/Sources/c_snikket/src/hx/gc/GcRegCapture.h
@@ -0,0 +1,140 @@
+#ifndef HX_GC_HELPERS_INCLUDED
+#define HX_GC_HELPERS_INCLUDED
+
+#if defined(HX_WINDOWS) && defined(HXCPP_ARM64)
+// Eg, Microsoft Surface
+#define HXCPP_CAPTURE_SETJMP
+#endif
+
+#ifdef HXCPP_CAPTURE_SETJMP
+ #include <setjmp.h>
+#else
+
+ #if (defined(HX_WINDOWS) || defined(HX_MACOS) || (defined(HX_LINUX) && defined(__i386__))) && !defined(HXCPP_M64)
+ #define HXCPP_CAPTURE_x86
+ #endif
+
+ #if (defined(HX_MACOS) || (defined(HX_WINDOWS) && !defined(HX_WINRT)) || defined(_XBOX_ONE) || (defined(HX_LINUX) && defined(__x86_64__)) ) && defined(HXCPP_M64)
+ #define HXCPP_CAPTURE_x64
+ #endif
+
+ #if defined(HXCPP_ARM64)
+ //#define HXCPP_CAPTURE_ARM64
+ // Awlays use setjmp on arm64
+ #include <setjmp.h>
+ #define HXCPP_CAPTURE_SETJMP
+ #endif
+
+#endif
+
+
+namespace hx
+{
+
+// Capture Registers
+//
+#ifdef HXCPP_CAPTURE_SETJMP // {
+
+typedef jmp_buf RegisterCaptureBuffer;
+
+#define CAPTURE_REGS \
+ setjmp(mRegisterBuf);
+
+#define CAPTURE_REG_START (int *)(&mRegisterBuf)
+#define CAPTURE_REG_END (int *)(&mRegisterBuf+1)
+
+#elif defined(HXCPP_CAPTURE_x86) // } {
+
+struct RegisterCaptureBuffer
+{
+ void *ebx;
+ void *edi;
+ void *esi;
+};
+
+void CaptureX86(RegisterCaptureBuffer &outBuffer);
+
+#define CAPTURE_REGS \
+ hx::CaptureX86(mRegisterBuf);
+
+#define CAPTURE_REG_START (int *)(&mRegisterBuf)
+#define CAPTURE_REG_END (int *)(&mRegisterBuf+1)
+
+#elif defined(HXCPP_CAPTURE_x64) // } {
+
+
+struct RegisterCaptureBuffer
+{
+ void *rbx;
+ void *rbp;
+ void *rdi;
+ void *r12;
+ void *r13;
+ void *r14;
+ void *r15;
+
+ void *xmm[16*2];
+};
+
+void CaptureX64(RegisterCaptureBuffer &outBuffer);
+
+#define CAPTURE_REGS \
+ hx::CaptureX64(mRegisterBuf);
+
+#define CAPTURE_REG_START (int *)(&mRegisterBuf)
+#define CAPTURE_REG_END (int *)(&mRegisterBuf+1)
+
+
+#elif defined(HXCPP_CAPTURE_ARM64) // } {
+
+
+struct RegisterCaptureBuffer
+{
+ void *x19;
+ void *x20;
+ void *x21;
+ void *x22;
+ void *x23;
+ void *x24;
+ void *x25;
+ void *x26;
+ void *x27;
+ void *x28;
+};
+
+void CaptureArm64(RegisterCaptureBuffer &outBuffer);
+
+#define CAPTURE_REGS \
+ hx::CaptureArm64(mRegisterBuf);
+
+#define CAPTURE_REG_START (int *)(&mRegisterBuf)
+#define CAPTURE_REG_END (int *)(&mRegisterBuf+1)
+
+
+#else // } default capture... {
+
+
+class RegisterCapture
+{
+public:
+ virtual int Capture(int *inTopOfStack,int **inBuf,int &outSize,int inMaxSize,int *inDummy);
+ static RegisterCapture *Instance();
+};
+
+typedef int *RegisterCaptureBuffer[20];
+
+#define CAPTURE_REGS \
+ hx::RegisterCapture::Instance()->Capture(mTopOfStack, \
+ mRegisterBuf,mRegisterBufSize,20,mBottomOfStack); \
+
+#define CAPTURE_REG_START (int *)mRegisterBuf
+#define CAPTURE_REG_END (int *)(mRegisterBuf+mRegisterBufSize)
+
+#endif // }
+
+
+
+}
+
+
+#endif
diff --git a/Sources/c_snikket/src/hx/gc/Immix.cpp b/Sources/c_snikket/src/hx/gc/Immix.cpp
new file mode 100644
index 0000000..880b51c
--- /dev/null
+++ b/Sources/c_snikket/src/hx/gc/Immix.cpp
@@ -0,0 +1,7139 @@
+#include <hxcpp.h>
+
+#include <hx/GC.h>
+#include <hx/Memory.h>
+#include <hx/Thread.h>
+#include "../Hash.h"
+#include "GcRegCapture.h"
+#include <hx/Unordered.h>
+
+#ifdef EMSCRIPTEN
+ #include <emscripten/stack.h>
+ #ifdef HXCPP_SINGLE_THREADED_APP
+ // Use provided tools to measure stack extent
+ #define HXCPP_EXPLICIT_STACK_EXTENT
+ #endif
+#endif
+
+#include <string>
+#include <stdlib.h>
+
+
+static bool sgIsCollecting = false;
+
+namespace hx
+{
+ int gByteMarkID = 0x10;
+ int gRememberedByteMarkID = 0x10 | HX_GC_REMEMBERED;
+
+
+int gFastPath = 0;
+int gSlowPath = 0;
+
+
+}
+
+using hx::gByteMarkID;
+using hx::gRememberedByteMarkID;
+
+
+namespace hx
+{
+#ifdef HXCPP_GC_DEBUG_ALWAYS_MOVE
+
+enum { gAlwaysMove = true };
+typedef hx::UnorderedSet<void *> PointerMovedSet;
+PointerMovedSet sgPointerMoved;
+
+#else
+enum { gAlwaysMove = false };
+#endif
+}
+
+#ifdef ANDROID
+#include <android/log.h>
+#endif
+
+#ifdef HX_WINDOWS
+#include <windows.h>
+#endif
+
+#include <vector>
+#include <stdio.h>
+
+#include <hx/QuickVec.h>
+
+// #define HXCPP_GC_BIG_BLOCKS
+
+
+#ifndef __has_builtin
+#define __has_builtin(x) 0
+#endif
+namespace {
+void DebuggerTrap()
+{
+ static bool triggeredOnce = false;
+
+ if (!triggeredOnce)
+ {
+ triggeredOnce = true;
+
+ #if __has_builtin(__builtin_trap)
+ __builtin_trap();
+ #else
+ *(int *)0=0;
+ #endif
+ }
+}
+}
+
+
+
+
+static bool sgAllocInit = 0;
+static bool sgInternalEnable = true;
+static void *sgObject_root = 0;
+// With virtual inheritance, stack pointers can point to the middle of an object
+#ifdef _MSC_VER
+// MSVC optimizes by taking the address of an initernal data member
+static int sgCheckInternalOffset = sizeof(void *)*2;
+static int sgCheckInternalOffsetRows = 1;
+#else
+static int sgCheckInternalOffset = 0;
+static int sgCheckInternalOffsetRows = 0;
+#endif
+
+int gInAlloc = false;
+
+// This is recalculated from the other parameters
+static size_t sWorkingMemorySize = 10*1024*1024;
+
+#ifdef HXCPP_GC_MOVING
+// Just not sure what this shold be
+static size_t sgMaximumFreeSpace = 1024*1024*1024;
+#else
+static size_t sgMaximumFreeSpace = 1024*1024*1024;
+#endif
+
+
+// #define HXCPP_GC_DEBUG_LEVEL 1
+
+#if HXCPP_GC_DEBUG_LEVEL>1
+ #define PROFILE_COLLECT
+ #if HXCPP_GC_DEBUG_LEVEL>2
+ #define SHOW_FRAGMENTATION
+ #if HXCPP_GC_DEBUG_LEVEL>3
+ #define SHOW_MEM_EVENTS
+ #endif
+ #endif
+#endif
+
+// #define SHOW_FRAGMENTATION_BLOCKS
+#if defined SHOW_FRAGMENTATION_BLOCKS
+ #define SHOW_FRAGMENTATION
+#endif
+
+#define RECYCLE_LARGE
+
+// HXCPP_GC_DYNAMIC_SIZE
+
+//#define HXCPP_GC_SUMMARY
+//#define PROFILE_COLLECT
+//#define PROFILE_THREAD_USAGE
+//#define HXCPP_GC_VERIFY
+//#define HX_GC_VERIFY_ALLOC_START
+//#define SHOW_MEM_EVENTS
+//#define SHOW_MEM_EVENTS_VERBOSE
+//#define SHOW_FRAGMENTATION
+//
+// Setting this can make it easier to reproduce this problem since it takes
+// the timing of the zeroing out of the equation
+//#define HX_GC_ZERO_EARLY
+
+// Setting this on windows64 will mean this objects are allocated in the same place,
+// which can make native debugging easier
+//#define HX_GC_FIXED_BLOCKS
+//
+// If the problem happens on the same object, you can print info about the object
+// every collect so you can see where it goes wrong (usually requires HX_GC_FIXED_BLOCKS)
+//#define HX_WATCH
+
+#if defined(HXCPP_GC_VERIFY) && defined(HXCPP_GC_GENERATIONAL)
+#define HX_GC_VERIFY_GENERATIONAL
+#endif
+
+
+#ifdef HX_WATCH
+void *hxWatchList[] = {
+ (void *)0x0000000100000200,
+ (void *)0
+};
+bool hxInWatchList(void *watch)
+{
+ for(void **t = hxWatchList; *t; t++)
+ if (*t==watch)
+ return true;
+ return false;
+}
+#endif
+
+#ifdef HX_GC_FIXED_BLOCKS
+#ifdef HX_WINDOWS
+#include <Memoryapi.h>
+#endif
+#endif
+
+#ifdef PROFILE_COLLECT
+ #define HXCPP_GC_SUMMARY
+#endif
+
+#ifdef HX_GC_VERIFY_GENERATIONAL
+static bool sGcVerifyGenerational = false;
+#endif
+
+
+#if HX_HAS_ATOMIC && (HXCPP_GC_DEBUG_LEVEL==0) && !defined(HXCPP_GC_VERIFY) && !defined(EMSCRIPTEN)
+ #if defined(HX_MACOS) || defined(HX_WINDOWS) || defined(HX_LINUX)
+ enum { MAX_GC_THREADS = 4 };
+ #else
+ enum { MAX_GC_THREADS = 2 };
+ #endif
+#else
+ enum { MAX_GC_THREADS = 1 };
+#endif
+
+#if (MAX_GC_THREADS>1)
+ // You can uncomment this for better call stacks if it crashes while collecting
+ #define HX_MULTI_THREAD_MARKING
+#endif
+
+#ifdef PROFILE_THREAD_USAGE
+static int sThreadMarkCountData[MAX_GC_THREADS+1];
+static int sThreadArrayMarkCountData[MAX_GC_THREADS+1];
+static int *sThreadMarkCount = sThreadMarkCountData + 1;
+static int *sThreadArrayMarkCount = sThreadArrayMarkCountData + 1;
+static int sThreadChunkPushCount;
+static int sThreadChunkWakes;
+static int sSpinCount = 0;
+static int sThreadZeroWaits = 0;
+static int sThreadZeroPokes = 0;
+static int sThreadBlockZeroCount = 0;
+static volatile int sThreadZeroMisses = 0;
+#endif
+
+enum { MARK_BYTE_MASK = 0x0f };
+enum { FULL_MARK_BYTE_MASK = 0x3f };
+
+
+enum
+{
+ MEM_INFO_USAGE = 0,
+ MEM_INFO_RESERVED = 1,
+ MEM_INFO_CURRENT = 2,
+ MEM_INFO_LARGE = 3,
+};
+
+enum GcMode
+{
+ gcmFull,
+ gcmGenerational,
+};
+
+// Start with full gc - since all objects will be new
+static GcMode sGcMode = gcmFull;
+
+
+
+#ifndef HXCPP_GC_MOVING
+ #ifdef HXCPP_GC_DEBUG_ALWAYS_MOVE
+ #define HXCPP_GC_MOVING
+ #endif
+// Enable moving collector...
+//#define HXCPP_GC_MOVING
+#endif
+
+// Allocate this many blocks at a time - this will increase memory usage % when rounding to block size must be done.
+// However, a bigger number makes it harder to release blocks due to pinning
+#define IMMIX_BLOCK_GROUP_BITS 5
+
+
+#ifdef HXCPP_DEBUG
+static hx::Object *gCollectTrace = 0;
+static bool gCollectTraceDoPrint = false;
+static int gCollectTraceCount = 0;
+static int sgSpamCollects = 0;
+#endif
+
+#if defined(HXCPP_DEBUG) || defined(HXCPP_GC_DEBUG_ALWAYS_MOVE)
+volatile int sgAllocsSinceLastSpam = 0;
+#endif
+
+#ifdef ANDROID
+#define GCLOG(...) __android_log_print(ANDROID_LOG_INFO, "gclog", __VA_ARGS__)
+#else
+#define GCLOG printf
+#endif
+
+#ifdef PROFILE_COLLECT
+ #define STAMP(t) double t = __hxcpp_time_stamp();
+ #define MEM_STAMP(t) t = __hxcpp_time_stamp();
+ static double sLastCollect = __hxcpp_time_stamp();
+ static int sObjectMarks =0;
+ static int sAllocMarks =0;
+
+#else
+ #define STAMP(t)
+ #define MEM_STAMP(t)
+#endif
+
+#if defined(HXCPP_GC_SUMMARY) || defined(HXCPP_GC_DYNAMIC_SIZE)
+struct ProfileCollectSummary
+{
+ enum { COUNT = 10 };
+ double timeWindow[COUNT];
+ int windowIdx;
+ double startTime;
+ double lastTime;
+ double totalCollecting;
+ double maxStall;
+ double spaceFactor;
+
+ ProfileCollectSummary()
+ {
+ startTime = __hxcpp_time_stamp();
+ lastTime = startTime;
+ totalCollecting = 0;
+ maxStall = 0;
+ windowIdx = 0;
+ spaceFactor = 1.0;
+ for(int i=0;i<COUNT;i++)
+ timeWindow[i] = 0.1;
+ }
+ ~ProfileCollectSummary()
+ {
+ #ifdef HXCPP_GC_SUMMARY
+ double time = __hxcpp_time_stamp() - startTime;
+ GCLOG("Total time : %.2fms\n", time*1000.0);
+ GCLOG("Collecting time: %.2fms\n", totalCollecting*1000.0);
+ GCLOG("Max Stall time : %.2fms\n", maxStall*1000.0);
+ if (time==0) time = 1;
+ GCLOG(" Fraction : %.2f%%\n",totalCollecting*100.0/time);
+
+ #ifdef HXCPP_GC_DYNAMIC_SIZE
+ GCLOG("Space factor : %.2fx\n",spaceFactor);
+ #endif
+ #endif
+ }
+
+ void addTime(double inCollectStart)
+ {
+ double now = __hxcpp_time_stamp();
+ double dt = now-inCollectStart;
+ if (dt>maxStall)
+ maxStall = dt;
+ totalCollecting += dt;
+ #ifdef HXCPP_GC_DYNAMIC_SIZE
+ double wholeTime = now - lastTime;
+ if (wholeTime)
+ {
+ lastTime = now;
+ double ratio = dt/wholeTime;
+ windowIdx = (windowIdx +1)%COUNT;
+ timeWindow[windowIdx] = ratio;
+ double sum = 0;
+ for(int i=0;i<COUNT;i++)
+ sum += timeWindow[i];
+ ratio = sum/COUNT;
+
+ if (ratio<0.05)
+ {
+ if (spaceFactor>1.0)
+ {
+ spaceFactor -= 0.2;
+ if (spaceFactor<1.0)
+ spaceFactor = 1.0;
+ }
+ }
+ else if (ratio>0.12)
+ {
+ if (ratio>0.2)
+ spaceFactor += 0.5;
+ else
+ spaceFactor += 0.2;
+
+ if (spaceFactor>5.0)
+ spaceFactor = 5.0;
+ }
+ }
+ #endif
+ }
+
+};
+
+static ProfileCollectSummary profileCollectSummary;
+#define PROFILE_COLLECT_SUMMARY_START double collectT0 = __hxcpp_time_stamp();
+#define PROFILE_COLLECT_SUMMARY_END profileCollectSummary.addTime(collectT0);
+
+#else
+#define PROFILE_COLLECT_SUMMARY_START
+#define PROFILE_COLLECT_SUMMARY_END
+#endif
+
+
+
+// TODO: Telemetry.h ?
+#ifdef HXCPP_TELEMETRY
+extern void __hxt_gc_realloc(void* old_obj, void* new_obj, int new_size);
+extern void __hxt_gc_start();
+extern void __hxt_gc_end();
+extern void __hxt_gc_after_mark(int gByteMarkID, int markIdByte);
+#endif
+
+static int sgTimeToNextTableUpdate = 1;
+
+
+
+
+HxMutex *gThreadStateChangeLock=0;
+HxMutex *gSpecialObjectLock=0;
+
+class LocalAllocator;
+enum LocalAllocState { lasNew, lasRunning, lasStopped, lasWaiting, lasTerminal };
+
+
+static void MarkLocalAlloc(LocalAllocator *inAlloc,hx::MarkContext *__inCtx);
+#ifdef HXCPP_VISIT_ALLOCS
+static void VisitLocalAlloc(LocalAllocator *inAlloc,hx::VisitContext *__inCtx);
+#endif
+static void WaitForSafe(LocalAllocator *inAlloc);
+static void ReleaseFromSafe(LocalAllocator *inAlloc);
+static void ClearPooledAlloc(LocalAllocator *inAlloc);
+static void CollectFromThisThread(bool inMajor,bool inForceCompact);
+
+namespace hx
+{
+int gPauseForCollect = 0x00000000;
+
+StackContext *gMainThreadContext = 0;
+
+unsigned int gImmixStartFlag[128];
+
+int gMarkID = 0x10 << 24;
+int gMarkIDWithContainer = (0x10 << 24) | IMMIX_ALLOC_IS_CONTAINER;
+
+int gPrevByteMarkID = 0x2f;
+unsigned int gPrevMarkIdMask = ((~0x2f000000) & 0x30000000) | HX_GC_CONST_ALLOC_BIT;
+
+
+
+
+void ExitGCFreeZoneLocked();
+
+
+DECLARE_FAST_TLS_DATA(StackContext, tlsStackContext);
+
+#ifdef HXCPP_SCRIPTABLE
+extern void scriptMarkStack(hx::MarkContext *);
+#endif
+}
+
+//#define DEBUG_ALLOC_PTR ((char *)0xb68354)
+
+
+#ifdef HX_WINDOWS
+#define ZERO_MEM(ptr, n) ZeroMemory(ptr,n)
+#else
+#define ZERO_MEM(ptr, n) memset(ptr,0,n)
+#endif
+
+
+// --- Internal GC - IMMIX Implementation ------------------------------
+
+
+
+// Some inline implementations ...
+// Use macros to allow for mark/move
+
+
+
+/*
+ IMMIX block size, and various masks for converting addresses
+
+*/
+
+#ifdef HXCPP_GC_BIG_BLOCKS
+ #define IMMIX_BLOCK_BITS 16
+ typedef unsigned int BlockIdType;
+#else
+ #define IMMIX_BLOCK_BITS 15
+ typedef unsigned short BlockIdType;
+#endif
+
+#define IMMIX_BLOCK_SIZE (1<<IMMIX_BLOCK_BITS)
+#define IMMIX_BLOCK_OFFSET_MASK (IMMIX_BLOCK_SIZE-1)
+#define IMMIX_BLOCK_BASE_MASK (~(size_t)(IMMIX_BLOCK_OFFSET_MASK))
+#define IMMIX_LINE_COUNT_BITS (IMMIX_BLOCK_BITS-IMMIX_LINE_BITS)
+#define IMMIX_LINES (1<<IMMIX_LINE_COUNT_BITS)
+
+
+#define IMMIX_HEADER_LINES (IMMIX_LINES>>IMMIX_LINE_BITS)
+#define IMMIX_USEFUL_LINES (IMMIX_LINES - IMMIX_HEADER_LINES)
+
+#define IMMIX_MAX_ALLOC_GROUPS_SIZE (1<<IMMIX_BLOCK_GROUP_BITS)
+
+
+// Every second line used
+#define MAX_HOLES (IMMIX_USEFUL_LINES>>1)
+
+/*
+
+ IMMIX Alloc Header - 32 bits
+
+
+ The header is placed in the 4 bytes before the object pointer, and it is placed there using a uint32.
+ When addressed as the uint32, you can use the bitmasks below to extract the various data.
+
+ The "mark id" can conveniently be interpreted as a byte, however the offsets well
+ be different depending on whether the system is little endian or big endian.
+
+
+ Little endian - lsb first
+
+ 7 0 15 8 23 16 31 24
+ -----------------------
+ | | | | MID | obj start here .....
+ -----------------------
+
+
+
+ Big endian - msb first
+
+ 31 24 23 16 15 8 7 0
+ -----------------------
+ |MID | | | | obj start here .....
+ -----------------------
+
+MID = HX_ENDIAN_MARK_ID_BYTE = is measured from the object pointer
+ HX_ENDIAN_MARK_ID_BYTE_HEADER = is measured from the header pointer (4 bytes before object)
+
+
+*/
+
+#define HX_ENDIAN_MARK_ID_BYTE_HEADER (HX_ENDIAN_MARK_ID_BYTE + 4)
+
+
+// Used by strings
+// HX_GC_CONST_ALLOC_BIT 0x80000000
+
+//#define HX_GC_REMEMBERED 0x40000000
+#define IMMIX_ALLOC_MARK_ID 0x3f000000
+//#define IMMIX_ALLOC_IS_CONTAINER 0x00800000
+//#define IMMIX_ALLOC_IS_PINNED not used at object level
+//#define HX_GX_STRING_EXTENDED 0x00200000
+//#define HX_GC_STRING_HASH 0x00100000
+// size will shift-right IMMIX_ALLOC_SIZE_SHIFT (6). Low two bits are 0
+#define IMMIX_ALLOC_SIZE_MASK 0x000fff00
+#define IMMIX_ALLOC_ROW_COUNT 0x000000ff
+
+#define IMMIX_HEADER_PRESERVE 0x00f00000
+
+
+#define IMMIX_OBJECT_HAS_MOVED 0x000000fe
+
+
+// Bigger than this, and they go in the large object pool
+#define IMMIX_LARGE_OBJ_SIZE 4000
+
+#ifdef allocString
+#undef allocString
+#endif
+
+
+void CriticalGCError(const char *inMessage)
+{
+ // Can't perfrom normal handling because it needs the GC system
+ #ifdef ANDROID
+ __android_log_print(ANDROID_LOG_ERROR, "HXCPP", "Critical Error: %s", inMessage);
+ #elif defined(HX_WINRT)
+ WINRT_LOG("HXCPP Critical Error: %s\n", inMessage);
+ #else
+ printf("Critical Error: %s\n", inMessage);
+ #endif
+
+ DebuggerTrap();
+}
+
+
+
+
+
+enum AllocType { allocNone, allocString, allocObject, allocMarked };
+
+struct BlockDataInfo *gBlockStack = 0;
+typedef hx::QuickVec<hx::Object *> ObjectStack;
+
+
+typedef HxMutex ThreadPoolLock;
+
+static ThreadPoolLock sThreadPoolLock;
+
+#if !defined(HX_WINDOWS) && !defined(EMSCRIPTEN) && \
+ !defined(__SNC__) && !defined(__ORBIS__)
+#define HX_GC_PTHREADS
+typedef pthread_cond_t ThreadPoolSignal;
+inline void WaitThreadLocked(ThreadPoolSignal &ioSignal)
+{
+ pthread_cond_wait(&ioSignal, sThreadPoolLock.mMutex);
+}
+#else
+typedef HxSemaphore ThreadPoolSignal;
+#endif
+
+typedef TAutoLock<ThreadPoolLock> ThreadPoolAutoLock;
+
+// For threaded marking/block reclaiming
+static unsigned int sRunningThreads = 0;
+static unsigned int sAllThreads = 0;
+static bool sLazyThreads = false;
+static bool sThreadPoolInit = false;
+
+enum ThreadPoolJob
+{
+ tpjNone,
+ tpjMark,
+ tpjReclaim,
+ tpjReclaimFull,
+ tpjCountRows,
+ tpjAsyncZero,
+ tpjAsyncZeroJit,
+ tpjGetStats,
+ tpjVisitBlocks,
+};
+
+int sgThreadCount = 0;
+static ThreadPoolJob sgThreadPoolJob = tpjNone;
+static bool sgThreadPoolAbort = false;
+
+// Pthreads enters the sleep state while holding a mutex, so it no cost to update
+// the sleeping state and thereby avoid over-signalling the condition
+bool sThreadSleeping[MAX_GC_THREADS];
+ThreadPoolSignal sThreadWake[MAX_GC_THREADS];
+bool sThreadJobDoneSleeping = false;
+ThreadPoolSignal sThreadJobDone;
+
+
+static inline void SignalThreadPool(ThreadPoolSignal &ioSignal, bool sThreadSleeping)
+{
+ #ifdef HX_GC_PTHREADS
+ if (sThreadSleeping)
+ pthread_cond_signal(&ioSignal);
+ #else
+ ioSignal.Set();
+ #endif
+}
+
+static void wakeThreadLocked(int inThreadId)
+{
+ sRunningThreads |= (1<<inThreadId);
+ sLazyThreads = sRunningThreads != sAllThreads;
+ SignalThreadPool(sThreadWake[inThreadId],sThreadSleeping[inThreadId]);
+}
+
+union BlockData
+{
+ // First 2/4 bytes are not needed for row markers (first 2/4 rows are for flags)
+ BlockIdType mId;
+
+ // First 2/4 rows contain a byte-flag-per-row
+ unsigned char mRowMarked[IMMIX_LINES];
+ // Row data as union - don't use first 2/4 rows
+ unsigned char mRow[IMMIX_LINES][IMMIX_LINE_LEN];
+
+};
+
+struct BlockDataStats
+{
+ void clear() { ZERO_MEM(this, sizeof(BlockDataStats)); }
+ void add(const BlockDataStats &inOther)
+ {
+ rowsInUse += inOther.rowsInUse;
+ bytesInUse += inOther.bytesInUse;
+ emptyBlocks += inOther.emptyBlocks;
+ fraggedBlocks += inOther.fraggedBlocks;
+ fragScore += inOther.fragScore;
+ fraggedRows += inOther.fraggedRows;
+ }
+
+ int rowsInUse;
+ size_t bytesInUse;
+ int emptyBlocks;
+ int fragScore;
+ int fraggedBlocks;
+ int fraggedRows;
+};
+
+static BlockDataStats sThreadBlockDataStats[MAX_GC_THREADS];
+#ifdef HXCPP_VISIT_ALLOCS
+static hx::VisitContext *sThreadVisitContext = 0;
+#endif
+
+
+
+namespace hx { void MarkerReleaseWorkerLocked(); }
+
+
+
+
+struct GroupInfo
+{
+ int blocks;
+ char *alloc;
+
+ bool pinned;
+ bool isEmpty;
+ int usedBytes;
+ int usedSpace;
+
+ void clear()
+ {
+ pinned = false;
+ usedBytes = 0;
+ usedSpace = 0;
+ isEmpty = true;
+ }
+ int getMoveScore()
+ {
+ return pinned ? 0 : usedSpace-usedBytes;
+ }
+
+};
+
+hx::QuickVec<GroupInfo> gAllocGroups;
+
+
+
+struct HoleRange
+{
+ unsigned short start;
+ unsigned short length;
+};
+
+
+hx::QuickVec<struct BlockDataInfo *> *gBlockInfo = 0;
+static int gBlockInfoEmptySlots = 0;
+
+#define FRAG_THRESH 14
+
+#define ZEROED_NOT 0
+#define ZEROED_THREAD 1
+#define ZEROED_AUTO 2
+
+// Align padding based on block offset
+#ifdef HXCPP_ALIGN_ALLOC
+ #define ALIGN_PADDING(x) (4-(x&4))
+#else
+ #define ALIGN_PADDING(x) 0
+#endif
+
+struct BlockDataInfo
+{
+ int mId;
+ int mGroupId;
+ BlockData *mPtr;
+
+ unsigned int allocStart[IMMIX_LINES];
+
+ HoleRange mRanges[MAX_HOLES];
+ int mHoles;
+
+ int mUsedRows;
+ int mMaxHoleSize;
+ int mMoveScore;
+ int mUsedBytes;
+ int mFraggedRows;
+ bool mPinned;
+ unsigned char mZeroed;
+ bool mReclaimed;
+ bool mOwned;
+ #ifdef HXCPP_GC_GENERATIONAL
+ bool mHasSurvivor;
+ #endif
+ volatile int mZeroLock;
+
+
+ BlockDataInfo(int inGid, BlockData *inData)
+ {
+ if (gBlockInfoEmptySlots)
+ {
+ for(int i=0;i<gBlockInfo->size();i++)
+ if ( !(*gBlockInfo)[i] )
+ {
+ gBlockInfoEmptySlots--;
+ mId = i;
+ (*gBlockInfo)[i] = this;
+ break;
+ }
+ }
+ else
+ {
+ if (gBlockInfo==0)
+ gBlockInfo = new hx::QuickVec<BlockDataInfo *>;
+ mId = gBlockInfo->size();
+ gBlockInfo->push( this );
+ }
+
+
+ mZeroLock = 0;
+ mOwned = false;
+ mGroupId = inGid;
+ mPtr = inData;
+ inData->mId = mId;
+ #ifdef SHOW_MEM_EVENTS
+ //GCLOG(" create block %d : %p -> %p\n", mId, this, mPtr );
+ #endif
+ clear();
+ }
+
+ void clear()
+ {
+ mUsedRows = 0;
+ mUsedBytes = 0;
+ mFraggedRows = 0;
+ mPinned = false;
+ ZERO_MEM(allocStart,sizeof(int)*IMMIX_LINES);
+ ZERO_MEM(mPtr->mRowMarked+IMMIX_HEADER_LINES, IMMIX_USEFUL_LINES);
+ mRanges[0].start = IMMIX_HEADER_LINES << IMMIX_LINE_BITS;
+ mRanges[0].length = IMMIX_USEFUL_LINES << IMMIX_LINE_BITS;
+ mMaxHoleSize = mRanges[0].length;
+ mMoveScore = 0;
+ mHoles = 1;
+ mZeroed = ZEROED_NOT;
+ mReclaimed = true;
+ mZeroLock = 0;
+ mOwned = false;
+ }
+
+ void makeFull()
+ {
+ mUsedRows = IMMIX_USEFUL_LINES;
+ mUsedBytes = mUsedRows<<IMMIX_LINE_BITS;
+ mFraggedRows = 0;
+ memset(mPtr->mRowMarked+IMMIX_HEADER_LINES, 1,IMMIX_USEFUL_LINES);
+ mRanges[0].start = 0;
+ mRanges[0].length = 0;
+ mMaxHoleSize = 0;
+ mMoveScore = 0;
+ mHoles = 0;
+ mZeroed = ZEROED_AUTO;
+ mReclaimed = true;
+ mZeroLock = 0;
+ mOwned = false;
+ }
+
+
+ void clearBlockMarks()
+ {
+ mPinned = false;
+ #ifdef HXCPP_GC_GENERATIONAL
+ mHasSurvivor = false;
+ #endif
+ }
+
+ void clearRowMarks()
+ {
+ clearBlockMarks();
+ ZERO_MEM((char *)mPtr+IMMIX_HEADER_LINES, IMMIX_USEFUL_LINES);
+ }
+
+ inline int GetFreeRows() const { return (IMMIX_USEFUL_LINES - mUsedRows); }
+ inline int GetFreeData() const { return (IMMIX_USEFUL_LINES - mUsedRows)<<IMMIX_LINE_BITS; }
+
+
+ bool zeroAndUnlock()
+ {
+ bool doZero = !mZeroed;
+ if (doZero)
+ {
+ if (!mReclaimed)
+ reclaim<false>(0);
+
+ for(int i=0;i<mHoles;i++)
+ ZERO_MEM( (char *)mPtr+mRanges[i].start, mRanges[i].length );
+ mZeroed = ZEROED_THREAD;
+ }
+ mZeroLock = 0;
+ return doZero;
+ }
+
+ bool tryZero()
+ {
+ if (mZeroed)
+ return false;
+
+ if (_hx_atomic_compare_exchange(&mZeroLock, 0,1) == 0)
+ return zeroAndUnlock();
+
+ return false;
+ }
+
+ void destroy()
+ {
+ #ifdef SHOW_MEM_EVENTS_VERBOSE
+ GCLOG(" release block %d : %p\n", mId, this );
+ #endif
+ (*gBlockInfo)[mId] = 0;
+ gBlockInfoEmptySlots++;
+ delete this;
+ }
+
+ bool isEmpty() const { return mUsedRows == 0; }
+ int getUsedRows() const { return mUsedRows; }
+
+ void getStats(BlockDataStats &outStats)
+ {
+ outStats.rowsInUse += mUsedRows;
+ outStats.bytesInUse += mUsedBytes;
+ outStats.fraggedRows += mFraggedRows;
+ //outStats.bytesInUse += 0;
+ outStats.fragScore += mPinned ? (mMoveScore>0?1:0) : mMoveScore;
+
+ if (mUsedRows==0)
+ outStats.emptyBlocks++;
+ if (mMoveScore> FRAG_THRESH )
+ outStats.fraggedBlocks++;
+ }
+
+ #ifdef HX_GC_VERIFY_ALLOC_START
+ void verifyAllocStart()
+ {
+ unsigned char *rowMarked = mPtr->mRowMarked;
+
+ for(int r = IMMIX_HEADER_LINES; r<IMMIX_LINES; r++)
+ {
+ if (!rowMarked[r] && allocStart[r])
+ {
+ printf("allocStart set without marking\n");
+ DebuggerTrap();
+ }
+ }
+ }
+ #endif
+
+ void countRows(BlockDataStats &outStats)
+ {
+ unsigned char *rowMarked = mPtr->mRowMarked;
+ unsigned int *rowTotals = ((unsigned int *)rowMarked) + 1;
+
+ // TODO - sse/neon
+ #ifdef HXCPP_GC_BIG_BLOCKS
+ unsigned int total = 0;
+ #else
+ unsigned int total = rowMarked[2] + rowMarked[3];
+ #endif
+
+ total +=
+ rowTotals[0] + rowTotals[1] + rowTotals[2] + rowTotals[3] + rowTotals[4] +
+ rowTotals[5] + rowTotals[6] + rowTotals[7] + rowTotals[8] + rowTotals[9] +
+ rowTotals[10] + rowTotals[11] + rowTotals[12] + rowTotals[13] + rowTotals[14] +
+ rowTotals[15] + rowTotals[16] + rowTotals[17] + rowTotals[18] + rowTotals[19] +
+ rowTotals[20] + rowTotals[21] + rowTotals[22] + rowTotals[23] + rowTotals[24] +
+ rowTotals[25] + rowTotals[26] + rowTotals[27] + rowTotals[28] + rowTotals[29] +
+ rowTotals[30] + rowTotals[31] + rowTotals[32] + rowTotals[33] + rowTotals[34] +
+ rowTotals[35] + rowTotals[36] + rowTotals[37] + rowTotals[38] + rowTotals[39] +
+ rowTotals[40] + rowTotals[41] + rowTotals[42] + rowTotals[43] + rowTotals[44] +
+ rowTotals[45] + rowTotals[46] + rowTotals[47] + rowTotals[48] + rowTotals[49] +
+ rowTotals[50] + rowTotals[51] + rowTotals[52] + rowTotals[53] + rowTotals[54] +
+ rowTotals[55] + rowTotals[56] + rowTotals[57] + rowTotals[58] + rowTotals[59] +
+ rowTotals[60] + rowTotals[61] + rowTotals[62];
+
+
+ #ifdef HXCPP_GC_BIG_BLOCKS
+ rowTotals += 63;
+ total +=
+ rowTotals[0] + rowTotals[1] + rowTotals[2] + rowTotals[3] + rowTotals[4] +
+ rowTotals[5] + rowTotals[6] + rowTotals[7] + rowTotals[8] + rowTotals[9] +
+ rowTotals[10] + rowTotals[11] + rowTotals[12] + rowTotals[13] + rowTotals[14] +
+ rowTotals[15] + rowTotals[16] + rowTotals[17] + rowTotals[18] + rowTotals[19] +
+ rowTotals[20] + rowTotals[21] + rowTotals[22] + rowTotals[23] + rowTotals[24] +
+ rowTotals[25] + rowTotals[26] + rowTotals[27] + rowTotals[28] + rowTotals[29] +
+ rowTotals[30] + rowTotals[31] + rowTotals[32] + rowTotals[33] + rowTotals[34] +
+ rowTotals[35] + rowTotals[36] + rowTotals[37] + rowTotals[38] + rowTotals[39] +
+ rowTotals[40] + rowTotals[41] + rowTotals[42] + rowTotals[43] + rowTotals[44] +
+ rowTotals[45] + rowTotals[46] + rowTotals[47] + rowTotals[48] + rowTotals[49] +
+ rowTotals[50] + rowTotals[51] + rowTotals[52] + rowTotals[53] + rowTotals[54] +
+ rowTotals[55] + rowTotals[56] + rowTotals[57] + rowTotals[58] + rowTotals[59] +
+ rowTotals[60] + rowTotals[61] + rowTotals[62] + rowTotals[63];
+
+ #endif
+
+ mUsedRows = (total & 0xff) + ((total>>8) & 0xff) + ((total>>16)&0xff) + ((total>>24)&0xff);
+ mUsedBytes = mUsedRows<<IMMIX_LINE_BITS;
+
+ mZeroLock = 0;
+ mOwned = false;
+ outStats.rowsInUse += mUsedRows;
+ outStats.bytesInUse += mUsedBytes;
+ outStats.fraggedRows += mFraggedRows;
+ mFraggedRows = 0;
+ mHoles = 0;
+
+ if (mUsedRows==IMMIX_USEFUL_LINES)
+ {
+ // All rows used - write the block off
+ mMoveScore = 0;
+ mZeroed = ZEROED_AUTO;
+ mReclaimed = true;
+ }
+ else
+ {
+ mZeroed = ZEROED_NOT;
+ mReclaimed = false;
+ }
+
+ int left = (IMMIX_USEFUL_LINES - mUsedRows) << IMMIX_LINE_BITS;
+ if (left<mMaxHoleSize)
+ mMaxHoleSize = left;
+ }
+
+ template<bool FULL>
+ void reclaim(BlockDataStats *outStats)
+ {
+ HoleRange *ranges = mRanges;
+ ranges[0].length = 0;
+ mZeroed = ZEROED_NOT;
+ int usedBytes = 0;
+
+ unsigned char *rowMarked = mPtr->mRowMarked;
+
+ int r = IMMIX_HEADER_LINES;
+ // Count unused rows ....
+
+ // start on 4-byte boundary...
+ #ifdef HXCPP_ALIGN_ALLOC
+ while(r<4 && rowMarked[r]==0)
+ r++;
+ if (!rowMarked[r])
+ #endif
+ {
+ while(r<(IMMIX_LINES-4) && *(int *)(rowMarked+r)==0 )
+ r += 4;
+ while(r<(IMMIX_LINES) && rowMarked[r]==0)
+ r++;
+ }
+
+ if (r==IMMIX_LINES)
+ {
+ ranges[0].start = IMMIX_HEADER_LINES<<IMMIX_LINE_BITS;
+ ranges[0].length = (IMMIX_USEFUL_LINES)<<IMMIX_LINE_BITS;
+ mMaxHoleSize = (IMMIX_USEFUL_LINES)<<IMMIX_LINE_BITS;
+ mUsedRows = 0;
+ mHoles = 1;
+ mMoveScore = 0;
+ ZERO_MEM(allocStart+IMMIX_HEADER_LINES, IMMIX_USEFUL_LINES*sizeof(int));
+ }
+ else
+ {
+ int hole = 0;
+
+ if (r>IMMIX_HEADER_LINES)
+ {
+ ranges[hole].start = IMMIX_HEADER_LINES;
+ ranges[hole].length = r-IMMIX_HEADER_LINES;
+ hole++;
+ }
+
+ while(r<IMMIX_LINES)
+ {
+ if (rowMarked[r])
+ {
+ if (FULL)
+ {
+ unsigned int &starts = allocStart[r];
+ if (starts)
+ {
+ unsigned int *headerPtr = ((unsigned int *)mPtr->mRow[r]);
+ #define CHECK_FLAG(i,byteMask) \
+ { \
+ unsigned int mask = 1<<i; \
+ if ( starts & mask ) \
+ { \
+ unsigned int header = headerPtr[i]; \
+ if ( (header & IMMIX_ALLOC_MARK_ID) != hx::gMarkID ) \
+ { \
+ starts ^= mask; \
+ if (!(starts & byteMask)) \
+ break; \
+ } \
+ else \
+ usedBytes += sizeof(int) + ((header & IMMIX_ALLOC_SIZE_MASK) >> IMMIX_ALLOC_SIZE_SHIFT); \
+ } \
+ }
+
+ if (starts & 0x000000ff)
+ for(int i=0;i<8;i++)
+ CHECK_FLAG(i,0x000000ff);
+
+ if (starts & 0x0000ff00)
+ for(int i=8;i<16;i++)
+ CHECK_FLAG(i,0x0000ff00);
+
+ if (starts & 0x00ff0000)
+ for(int i=16;i<24;i++)
+ CHECK_FLAG(i,0x00ff0000);
+
+ if (starts & 0xff000000)
+ for(int i=24;i<32;i++)
+ CHECK_FLAG(i,0xff000000);
+ }
+ }
+ r++;
+ }
+ else
+ {
+ int start = r;
+ ranges[hole].start = start;
+
+ #ifdef HXCPP_ALIGN_ALLOC
+ int alignR = (r+3) & ~3;
+ while(r<alignR && rowMarked[r]==0)
+ r++;
+ if (!rowMarked[r])
+ #endif
+ {
+ while(r<(IMMIX_LINES-4) && *(int *)(rowMarked+r)==0 )
+ r += 4;
+ while(r<(IMMIX_LINES) && rowMarked[r]==0)
+ r++;
+ }
+ ranges[hole].length = r-start;
+ hole++;
+ }
+ }
+
+
+ int freeLines = 0;
+ // Convert hole rows to hole bytes...
+ mMaxHoleSize = 0;
+ for(int h=0;h<hole;h++)
+ {
+ int s = ranges->start;
+ int l = ranges->length;
+ freeLines += l;
+ ZERO_MEM(allocStart+s, l*sizeof(int));
+
+ int sBytes = s<<IMMIX_LINE_BITS;
+ ranges->start = sBytes;
+
+ int lBytes = l<<IMMIX_LINE_BITS;
+ ranges->length = lBytes;
+
+ if (lBytes>mMaxHoleSize)
+ mMaxHoleSize = lBytes;
+
+ ranges++;
+ }
+ mUsedRows = IMMIX_USEFUL_LINES - freeLines;
+ mHoles = hole;
+ }
+
+ mUsedBytes = FULL ? usedBytes : (mUsedRows<<IMMIX_LINE_BITS);
+ mMoveScore = calcFragScore();
+ mReclaimed = true;
+
+ if (outStats)
+ {
+ outStats->rowsInUse += mUsedRows;
+ outStats->bytesInUse += mUsedBytes;
+ outStats->fragScore += mMoveScore;
+ outStats->fraggedRows += mFraggedRows;
+
+ if (mUsedRows==0)
+ outStats->emptyBlocks++;
+ if (mMoveScore> FRAG_THRESH )
+ outStats->fraggedBlocks++;
+ }
+
+ mFraggedRows = 0;
+ }
+
+ int calcFragScore()
+ {
+ return mPinned ? 0 : (mHoles>3 ? mHoles-3 : 0) + 8 * (mUsedRows<<IMMIX_LINE_BITS) / (mUsedBytes+IMMIX_LINE_LEN);
+ }
+
+
+ // When known to be an actual object start...
+ AllocType GetAllocTypeChecked(int inOffset, bool allowPrevious)
+ {
+ char time = mPtr->mRow[0][inOffset+HX_ENDIAN_MARK_ID_BYTE_HEADER];
+ if ( ((time+1) & MARK_BYTE_MASK) != (gByteMarkID & MARK_BYTE_MASK) )
+ {
+ // Object is either out-of-date, or already marked....
+ return time==gByteMarkID ? allocMarked : allocNone;
+ }
+
+ if (!allowPrevious)
+ return allocNone;
+
+ if (*(unsigned int *)(mPtr->mRow[0] + inOffset) & IMMIX_ALLOC_IS_CONTAINER)
+ {
+ // See if object::new has been called, but not constructed yet ...
+ void **vtable = (void **)(mPtr->mRow[0] + inOffset + sizeof(int));
+ if (vtable[0]==0)
+ {
+ // GCLOG("Partially constructed object.");
+ return allocString;
+ }
+ return allocObject;
+ }
+
+ return allocString;
+ }
+
+ #ifdef HXCPP_GC_NURSERY
+ AllocType GetEnclosingNurseryType(int inOffset, void **outPtr)
+ {
+ // The block did not get used in the previous cycle, so allocStart is invalid and
+ // no new objects should be in here
+ if (!mZeroed)
+ return allocNone;
+ // For the nursery(generational) case, the allocStart markers are not set
+ // So trace tne new object links through the new allocation holes
+ for(int h=0;h<mHoles;h++)
+ {
+ int scan = mRanges[h].start;
+ if (inOffset<scan)
+ break;
+
+ int size = 0;
+ int last = scan + mRanges[h].length;
+ if (inOffset<last)
+ {
+ #ifdef HXCPP_ALIGN_ALLOC
+ // Make sure header scan is odd-int aligned so the following object will be even-int
+ // aligned
+ if (!(scan & 0x4))
+ scan += 4;
+ #endif
+
+ // Found hole that the object was possibly allocated in
+ while(scan<=inOffset)
+ {
+ // Trace along the hole...
+ unsigned int header = *(unsigned int *)(mPtr->mRow[0]+scan);
+ if (!(header & 0xff000000))
+ size = header & 0x0000ffff;
+ else
+ size = (header & IMMIX_ALLOC_SIZE_MASK) >> IMMIX_ALLOC_SIZE_SHIFT;
+
+ int end = scan+size+sizeof(int);
+ if (!size || end > last)
+ return allocNone;
+
+ if (inOffset>=scan && inOffset<end)
+ {
+ if (inOffset>scan+sgCheckInternalOffset)
+ return allocNone;
+
+ *outPtr = mPtr->mRow[0] + scan + sizeof(int);
+
+ if (header & IMMIX_ALLOC_IS_CONTAINER)
+ {
+ // See if object::new has been called, but not constructed yet ...
+ void **vtable = (void **)(mPtr->mRow[0] + scan + sizeof(int));
+ if (vtable[0]==0)
+ {
+ // GCLOG("Partially constructed object.");
+ return allocString;
+ }
+ return allocObject;
+ }
+ return allocString;
+ }
+ scan = end;
+ #ifdef HXCPP_ALIGN_ALLOC
+ // Make sure scan is odd-int aligned so the following object will be even-int
+ // aligned
+ if (!(scan & 0x4))
+ scan += 4;
+ #endif
+ }
+ break;
+ }
+ }
+ return allocNone;
+}
+ #endif
+
+ AllocType GetAllocType(int inOffset,bool inAllowPrevious)
+ {
+ // Row that the header would be on
+ int r = inOffset >> IMMIX_LINE_BITS;
+
+ // Out of bounds - can't be a new object start
+ if (r < IMMIX_HEADER_LINES || r >= IMMIX_LINES)
+ {
+ return allocNone;
+ }
+
+ // Does a live object start on this row
+ if ( !( allocStart[r] & hx::gImmixStartFlag[inOffset &127]) )
+ {
+ #ifdef HXCPP_GC_NURSERY
+ void *ptr;
+ return GetEnclosingNurseryType(inOffset,&ptr);
+ #endif
+ //Not a actual start...
+ return allocNone;
+ }
+
+ return GetAllocTypeChecked(inOffset,inAllowPrevious);
+ }
+
+ AllocType GetEnclosingAllocType(int inOffset,void **outPtr,bool inAllowPrevious)
+ {
+ for(int dx=0;dx<=sgCheckInternalOffset;dx+=4)
+ {
+ int blockOffset = inOffset - dx;
+ if (blockOffset >= 0)
+ {
+ int r = blockOffset >> IMMIX_LINE_BITS;
+ if (r >= IMMIX_HEADER_LINES && r < IMMIX_LINES)
+ {
+ // Normal, good alloc
+ int rowPos = hx::gImmixStartFlag[blockOffset &127];
+ if ( allocStart[r] & rowPos )
+ {
+ // Found last valid object - is it big enough?
+ unsigned int header = *(unsigned int *)((char *)mPtr + blockOffset);
+ int size = (header & IMMIX_ALLOC_SIZE_MASK) >> IMMIX_ALLOC_SIZE_SHIFT;
+ // Valid object not big enough...
+ if (blockOffset + size +sizeof(int) <= inOffset )
+ break;
+
+ // If the object is old, it could be the tail end of an old row that
+ // thinks is is covering this row, but it is not because this row is reused.
+ // So we can say there is no other object that could be covering
+ // this spot, but not that it is not a nursery object.
+ AllocType result = GetAllocTypeChecked(blockOffset,inAllowPrevious);
+ if (result!=allocNone)
+ {
+ *outPtr = (void *)(mPtr->mRow[0] + blockOffset + sizeof(int));
+ return result;
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ #ifdef HXCPP_GC_NURSERY
+ return GetEnclosingNurseryType(inOffset,outPtr);
+ #endif
+ // Not a actual start...
+ return allocNone;
+ }
+
+
+ void pin() { mPinned = true; }
+
+
+ #ifdef HXCPP_VISIT_ALLOCS
+ void VisitBlock(hx::VisitContext *inCtx)
+ {
+ if (isEmpty())
+ return;
+
+ unsigned char *rowMarked = mPtr->mRowMarked;
+ for(int r=IMMIX_HEADER_LINES;r<IMMIX_LINES;r++)
+ {
+ if (rowMarked[r])
+ {
+ unsigned int starts = allocStart[r];
+ if (!starts)
+ continue;
+ unsigned char *row = mPtr->mRow[r];
+ for(int i=0;i<32;i++)
+ {
+ int pos = i<<2;
+ if ( (starts & (1<<i)) &&
+ (row[pos+HX_ENDIAN_MARK_ID_BYTE_HEADER]&FULL_MARK_BYTE_MASK) == gByteMarkID)
+ {
+ if ( (*(unsigned int *)(row+pos)) & IMMIX_ALLOC_IS_CONTAINER )
+ {
+ hx::Object *obj = (hx::Object *)(row+pos+4);
+ // May be partially constructed
+ if (*(void **)obj)
+ obj->__Visit(inCtx);
+ }
+ }
+ }
+ }
+ }
+ }
+ #endif
+
+ #ifdef HXCPP_GC_VERIFY
+ void verify(const char *inWhere)
+ {
+ for(int i=IMMIX_HEADER_LINES;i<IMMIX_LINES;i++)
+ {
+ for(int j=0;j<32;j++)
+ if (allocStart[i] & (1<<j))
+ {
+ unsigned int header = *(unsigned int *)( (char *)mPtr + i*IMMIX_LINE_LEN + j*4 );
+ if ((header & IMMIX_ALLOC_MARK_ID) == hx::gMarkID )
+ {
+ int rows = header & IMMIX_ALLOC_ROW_COUNT;
+ if (rows==0)
+ {
+ printf("BAD ROW0 %s\n", inWhere);
+ DebuggerTrap();
+ }
+ for(int r=0;r<rows;r++)
+ if (!mPtr->mRowMarked[r+i])
+ {
+ printf("Unmarked row %dx %d/%d %s, t=%d!\n", i, r, rows, inWhere,sgTimeToNextTableUpdate);
+ DebuggerTrap();
+ }
+ }
+ }
+ }
+
+ }
+ #endif
+};
+
+
+
+
+
+bool MostUsedFirst(BlockDataInfo *inA, BlockDataInfo *inB)
+{
+ return inA->getUsedRows() > inB->getUsedRows();
+}
+
+bool BiggestFreeFirst(BlockDataInfo *inA, BlockDataInfo *inB)
+{
+ return inA->mMaxHoleSize > inB->mMaxHoleSize;
+}
+bool SmallestFreeFirst(BlockDataInfo *inA, BlockDataInfo *inB)
+{
+ return inA->mMaxHoleSize < inB->mMaxHoleSize;
+}
+
+
+bool LeastUsedFirst(BlockDataInfo *inA, BlockDataInfo *inB)
+{
+ return inA->getUsedRows() < inB->getUsedRows();
+}
+
+
+
+bool SortMoveOrder(BlockDataInfo *inA, BlockDataInfo *inB)
+{
+ return inA->mMoveScore > inB->mMoveScore;
+}
+
+
+namespace hx
+{
+
+
+
+void BadImmixAlloc()
+{
+
+ #ifdef HX_WINRT
+ WINRT_LOG("Bad local allocator - requesting memory from unregistered thread!");
+ #else
+ #ifdef ANDROID
+ __android_log_print(ANDROID_LOG_ERROR, "hxcpp",
+ #else
+ fprintf(stderr,
+ #endif
+
+ "Bad local allocator - requesting memory from unregistered thread!"
+
+ #ifdef ANDROID
+ );
+ #else
+ );
+ #endif
+ #endif
+
+ DebuggerTrap();
+}
+
+
+
+void GCCheckPointer(void *inPtr)
+{
+ #ifdef HXCPP_GC_DEBUG_ALWAYS_MOVE
+ if (hx::sgPointerMoved.find(inPtr)!=hx::sgPointerMoved.end())
+ {
+ GCLOG("Accessing moved pointer %p\n", inPtr);
+ DebuggerTrap();
+ }
+ #endif
+
+ unsigned char&mark = ((unsigned char *)inPtr)[HX_ENDIAN_MARK_ID_BYTE];
+ #ifdef HXCPP_GC_NURSERY
+ if (mark)
+ #endif
+ if ( !(mark & HX_GC_CONST_ALLOC_MARK_BIT) && (mark&FULL_MARK_BYTE_MASK)!=gByteMarkID )
+ {
+ GCLOG("Old object access %p\n", inPtr);
+ NullReference("Object", false);
+ }
+}
+
+
+void GCOnNewPointer(void *inPtr)
+{
+ #ifdef HXCPP_ALIGN_ALLOC
+ if ( (size_t)inPtr & 0x7 )
+ {
+ GCLOG("Misaligned pointer %p\n", inPtr);
+ NullReference("Object", false);
+ }
+ #endif
+
+ #ifdef HXCPP_GC_DEBUG_ALWAYS_MOVE
+ hx::sgPointerMoved.erase(inPtr);
+ _hx_atomic_add(&sgAllocsSinceLastSpam, 1);
+ #endif
+}
+
+// --- Marking ------------------------------------
+
+struct MarkInfo
+{
+ const char *mClass;
+ const char *mMember;
+};
+
+struct GlobalChunks
+{
+ volatile MarkChunk *processList;
+ volatile int processListPopLock;
+ volatile MarkChunk *freeList;
+ volatile int freeListPopLock;
+
+ GlobalChunks()
+ {
+ processList = 0;
+ freeList = 0;
+ freeListPopLock = 0;
+ processListPopLock = 0;
+ }
+
+ MarkChunk *pushJobNoWake(MarkChunk *inChunk)
+ {
+ while(true)
+ {
+ MarkChunk *head = (MarkChunk *)processList;
+ inChunk->next = head;
+ if (_hx_atomic_compare_exchange_cast_ptr(&processList, head, inChunk) == head)
+ break;
+ }
+
+ return alloc();
+ }
+
+ MarkChunk *pushJob(MarkChunk *inChunk,bool inAndAlloc)
+ {
+ while(true)
+ {
+ MarkChunk *head = (MarkChunk *)processList;
+ inChunk->next = head;
+ if (_hx_atomic_compare_exchange_cast_ptr(&processList, head, inChunk) == head)
+ break;
+ }
+
+ #ifdef PROFILE_THREAD_USAGE
+ _hx_atomic_add(&sThreadChunkPushCount, 1);
+ #endif
+
+ if (MAX_GC_THREADS>1 && sLazyThreads)
+ {
+ ThreadPoolAutoLock l(sThreadPoolLock);
+
+ #ifdef PROFILE_THREAD_USAGE
+ #define CHECK_THREAD_WAKE(tid) \
+ if (MAX_GC_THREADS >tid && sgThreadCount>tid && (!(sRunningThreads & (1<<tid)))) { \
+ wakeThreadLocked(tid); \
+ sThreadChunkWakes++; \
+ }
+ #else
+ #define CHECK_THREAD_WAKE(tid) \
+ if (MAX_GC_THREADS >tid && sgThreadCount>tid && (!(sRunningThreads & (1<<tid)))) { \
+ wakeThreadLocked(tid); \
+ }
+ #endif
+
+
+ CHECK_THREAD_WAKE(0)
+ else CHECK_THREAD_WAKE(1)
+ else CHECK_THREAD_WAKE(2)
+ else CHECK_THREAD_WAKE(3)
+ else CHECK_THREAD_WAKE(4)
+ else CHECK_THREAD_WAKE(5)
+ else CHECK_THREAD_WAKE(6)
+ else CHECK_THREAD_WAKE(7)
+ }
+
+ if (inAndAlloc)
+ return alloc();
+ return 0;
+ }
+
+ void addLocked(MarkChunk *inChunk)
+ {
+ inChunk->next = (MarkChunk *)processList;
+ processList = (volatile MarkChunk *)inChunk;
+ }
+
+ void copyPointers( QuickVec<hx::Object *> &outPointers,bool andFree=false)
+ {
+ int size = 0;
+ for(MarkChunk *c =(MarkChunk *)processList; c; c=c->next )
+ size += c->count;
+
+ outPointers.setSize(size);
+ int idx = 0;
+ if (andFree)
+ {
+ while(processList)
+ {
+ MarkChunk *c = (MarkChunk *)processList;
+ processList = c->next;
+
+ for(int i=0;i<c->count;i++)
+ outPointers[idx++] = c->stack[i];
+ c->count = 0;
+ c->next = (MarkChunk *)freeList;
+ freeList = c;
+ }
+ }
+ else
+ {
+ for(MarkChunk *c = (MarkChunk *)processList; c; c=c->next )
+ {
+ for(int i=0;i<c->count;i++)
+ outPointers[idx++] = c->stack[i];
+ }
+ }
+ }
+
+ int takeArrayJob(hx::Object **inPtr, int inLen)
+ {
+ if (sLazyThreads)
+ {
+ int n = (inLen/2) & ~15;
+
+ if (n)
+ {
+ MarkChunk *chunk = alloc();
+ chunk->count = MarkChunk::OBJ_ARRAY_JOB;
+ chunk->arrayBase = inPtr;
+ chunk->arrayElements = n;
+
+ pushJob(chunk,false);
+ }
+
+ // Return how many to skip
+ return n;
+ }
+
+ return 0;
+ }
+
+ inline void release(MarkChunk *inChunk)
+ {
+ while(true)
+ {
+ MarkChunk *head = (MarkChunk *)freeList;
+ inChunk->next = head;
+ if (_hx_atomic_compare_exchange_cast_ptr(&freeList, head, inChunk) == head)
+ return;
+ }
+ }
+
+
+ MarkChunk *popJobLocked(MarkChunk *inChunk)
+ {
+ if (inChunk)
+ release(inChunk);
+
+ while(_hx_atomic_compare_exchange(&processListPopLock, 0, 1) != 0)
+ {
+ // Spin
+ #ifdef PROFILE_THREAD_USAGE
+ _hx_atomic_add(&sSpinCount, 1);
+ #endif
+ }
+
+ while(true)
+ {
+ MarkChunk *head = (MarkChunk *)processList;
+ if (!head)
+ {
+ processListPopLock = 0;
+ return 0;
+ }
+ MarkChunk *next = head->next;
+ if (_hx_atomic_compare_exchange_cast_ptr(&processList, head, next) == head)
+ {
+ processListPopLock = 0;
+
+ head->next = 0;
+ return head;
+ }
+ }
+ return 0;
+ }
+
+
+ void completeThreadLocked(int inThreadId)
+ {
+ if (!(sRunningThreads & (1<<inThreadId)))
+ {
+ printf("Complete non-running thread?\n");
+ DebuggerTrap();
+ }
+ sRunningThreads &= ~(1<<inThreadId);
+ sLazyThreads = sRunningThreads != sAllThreads;
+
+ if (!sRunningThreads)
+ SignalThreadPool(sThreadJobDone,sThreadJobDoneSleeping);
+ }
+
+
+ // Optionally returns inChunk to empty pool (while we have the lock),
+ // and returns a new job if there is one
+ MarkChunk *popJobOrFinish(MarkChunk *inChunk,int inThreadId)
+ {
+ #ifdef HX_MULTI_THREAD_MARKING
+ if (sAllThreads)
+ {
+ MarkChunk *result = popJobLocked(inChunk);
+ if (!result)
+ {
+ for(int spinCount = 0; spinCount<10000; spinCount++)
+ {
+ if ( sgThreadPoolAbort || sAllThreads == (1<<inThreadId) )
+ break;
+ if (processList)
+ {
+ result = popJobLocked(0);
+ if (result)
+ return result;
+ }
+ }
+ ThreadPoolAutoLock l(sThreadPoolLock);
+ completeThreadLocked(inThreadId);
+ }
+ return result;
+ }
+ #endif
+
+ return popJobLocked(inChunk);
+ }
+
+
+ void free(MarkChunk *inChunk)
+ {
+ release(inChunk);
+ }
+
+ inline MarkChunk *alloc()
+ {
+ while(_hx_atomic_compare_exchange(&freeListPopLock, 0, 1) != 0)
+ {
+ // Spin
+ #ifdef PROFILE_THREAD_USAGE
+ _hx_atomic_add(&sSpinCount, 1);
+ #endif
+ }
+
+ while(true)
+ {
+ MarkChunk *head = (MarkChunk *)freeList;
+ if (!head)
+ {
+ freeListPopLock = 0;
+ return new MarkChunk;
+ }
+ MarkChunk *next = head->next;
+ if (_hx_atomic_compare_exchange_cast_ptr(&freeList, head, next) == head)
+ {
+ freeListPopLock = 0;
+
+ head->next = 0;
+ return head;
+ }
+ }
+ }
+
+
+
+
+ MarkChunk *getInitJob()
+ {
+ MarkChunk *result = popJobLocked(0);
+ if (result)
+ {
+ if (result->count==MarkChunk::OBJ_ARRAY_JOB)
+ {
+ GCLOG("Popped array job?\n");
+ pushJob(result,false);
+ }
+ else
+ return result;
+ }
+ return alloc();
+ }
+
+};
+
+GlobalChunks sGlobalChunks;
+
+class MarkContext
+{
+ #ifdef HXCPP_DEBUG
+ MarkInfo *mInfo;
+ int mPos;
+ #endif
+
+ int mThreadId;
+ MarkChunk *marking;
+
+
+public:
+ enum { StackSize = 8192 };
+
+ bool isGenerational;
+
+ MarkContext(int inThreadId = -1)
+ {
+ #ifdef HXCPP_DEBUG
+ mInfo = new MarkInfo[StackSize];
+ mPos = 0;
+ #endif
+ mThreadId = inThreadId;
+ marking = sGlobalChunks.alloc();
+
+ isGenerational = false;
+ }
+ ~MarkContext()
+ {
+ if (marking) sGlobalChunks.free(marking);
+ #ifdef HXCPP_DEBUG
+ delete [] mInfo;
+ #endif
+ // TODO: Free slabs
+ }
+
+
+ #ifdef HXCPP_DEBUG
+ void PushClass(const char *inClass)
+ {
+ if (mPos<StackSize-1)
+ {
+ mInfo[mPos].mClass = inClass;
+ mInfo[mPos].mMember = 0;
+ }
+ mPos++;
+ }
+
+
+ void SetMember(const char *inMember)
+ {
+ // Should not happen...
+ if (mPos==0)
+ return;
+ if (mPos<StackSize)
+ mInfo[mPos-1].mMember = inMember ? inMember : "Unknown";
+ }
+ void PopClass() { mPos--; }
+
+ void Trace()
+ {
+ int n = mPos < StackSize ? mPos : StackSize;
+ #ifdef ANDROID
+ __android_log_print(ANDROID_LOG_ERROR, "trace", "Class referenced from");
+ #else
+ printf("Class referenced from:\n");
+ #endif
+
+ for(int i=0;i<n;i++)
+ #ifdef ANDROID
+ __android_log_print(ANDROID_LOG_INFO, "trace", "%s.%s", mInfo[i].mClass, mInfo[i].mMember );
+ #else
+ printf("%s.%s\n", mInfo[i].mClass, mInfo[i].mMember );
+ #endif
+
+ if (mPos>=StackSize)
+ {
+ #ifdef ANDROID
+ __android_log_print(ANDROID_LOG_INFO, "trace", "... + deeper");
+ #else
+ printf("... + deeper\n");
+ #endif
+ }
+ }
+ #endif
+
+
+ void pushObj(hx::Object *inObject)
+ {
+ if (marking->count < MarkChunk::SIZE)
+ {
+ marking->push(inObject);
+ }
+ else
+ {
+ marking = sGlobalChunks.pushJob(marking,true);
+ marking->push(inObject);
+ }
+ }
+
+ void init()
+ {
+ if (!marking)
+ marking = sGlobalChunks.getInitJob();
+ }
+
+ void releaseJobs()
+ {
+ if (marking && marking->count)
+ {
+ sGlobalChunks.pushJob(marking,false);
+ }
+ else if (marking)
+ {
+ sGlobalChunks.release(marking);
+ }
+ marking = 0;
+ }
+
+ void processMarkStack()
+ {
+ while(true)
+ {
+ if (!marking || !marking->count)
+ {
+ #ifdef HX_MULTI_THREAD_MARKING
+ if (sgThreadPoolAbort)
+ {
+ releaseJobs();
+ return;
+ }
+ #endif
+
+ marking = sGlobalChunks.popJobOrFinish(marking,mThreadId);
+ if (!marking)
+ break;
+
+ if (marking->count==MarkChunk::OBJ_ARRAY_JOB)
+ {
+ int n = marking->arrayElements;
+ hx::Object **elems = marking->arrayBase;
+ marking->count = 0;
+ MarkObjectArray(elems, n, this);
+ continue;
+ }
+ }
+
+ while(marking)
+ {
+ hx::Object *obj = marking->pop();
+ if (obj)
+ {
+ obj->__Mark(this);
+ #if HX_MULTI_THREAD_MARKING
+ // Load balance
+ if (sLazyThreads && marking->count>32)
+ {
+ MarkChunk *c = sGlobalChunks.alloc();
+ marking->count -= 16;
+ c->count = 16;
+ memcpy( c->stack, marking->stack + marking->count, 16*sizeof(hx::Object *));
+ sGlobalChunks.pushJob(c,false);
+ }
+ #ifdef PROFILE_THREAD_USAGE
+ sThreadMarkCount[mThreadId]++;
+ #endif
+ #endif
+ }
+ else
+ break;
+ }
+ }
+ }
+};
+
+
+/*
+void MarkerReleaseWorkerLocked( )
+{
+ //printf("Release...\n");
+ for(int i=0;i<sAllThreads;i++)
+ {
+ if ( ! (sRunningThreads & (1<<i) ) )
+ {
+ //printf("Wake %d\n",i);
+ sRunningThreads |= (1<<i);
+ sThreadWake[i]->Set();
+ return;
+ }
+ }
+}
+*/
+
+
+
+#ifdef HXCPP_DEBUG
+static bool breakOnce = 1;
+void MarkSetMember(const char *inName,hx::MarkContext *__inCtx)
+{
+ if (gCollectTrace)
+ __inCtx->SetMember(inName);
+}
+
+void MarkPushClass(const char *inName,hx::MarkContext *__inCtx)
+{
+ if (gCollectTrace)
+ __inCtx->PushClass(inName);
+}
+
+void MarkPopClass(hx::MarkContext *__inCtx)
+{
+ if (gCollectTrace)
+ __inCtx->PopClass();
+}
+#endif
+
+
+
+
+struct AutoMarkPush
+{
+ hx::MarkContext *mCtx;
+ AutoMarkPush(hx::MarkContext *ctx, const char *cls, const char *member)
+ {
+ #ifdef HXCPP_DEBUG
+ mCtx = ctx;
+ MarkPushClass(cls,mCtx);
+ MarkSetMember(member,mCtx);
+ #endif
+ }
+ ~AutoMarkPush()
+ {
+ #ifdef HXCPP_DEBUG
+ MarkPopClass(mCtx);
+ #endif
+ }
+};
+
+
+
+
+
+
+void MarkAllocUnchecked(void *inPtr,hx::MarkContext *__inCtx)
+{
+ #ifdef PROFILE_COLLECT
+ sAllocMarks++;
+ #endif
+
+ size_t ptr_i = ((size_t)inPtr)-sizeof(int);
+ unsigned int flags = *((unsigned int *)ptr_i);
+
+ #ifdef HXCPP_GC_NURSERY
+ if (!(flags & 0xff000000))
+ {
+ #ifdef HX_GC_VERIFY_GENERATIONAL
+ if (sGcVerifyGenerational)
+ {
+ printf("Nursery alloc escaped generational collection %p\n", inPtr);
+ DebuggerTrap();
+ }
+ #endif
+
+ int size = flags & 0xffff;
+ // Size will be 0 for large allocs -> no need to mark block
+ if (size)
+ {
+ int start = (int)(ptr_i & IMMIX_BLOCK_OFFSET_MASK);
+ int startRow = start>>IMMIX_LINE_BITS;
+ int blockId = *(BlockIdType *)(ptr_i & IMMIX_BLOCK_BASE_MASK);
+ BlockDataInfo *info = (*gBlockInfo)[blockId];
+
+ int endRow = (start + size + sizeof(int) + IMMIX_LINE_LEN-1)>>IMMIX_LINE_BITS;
+ *(unsigned int *)ptr_i = flags = (flags & IMMIX_HEADER_PRESERVE) |
+ (endRow -startRow) |
+ (size<<IMMIX_ALLOC_SIZE_SHIFT) |
+ gMarkID;
+
+ unsigned int *pos = info->allocStart + startRow;
+ unsigned int val = *pos;
+ while(_hx_atomic_compare_exchange((volatile int *)pos, val,val|gImmixStartFlag[start&127]) != val)
+ val = *pos;
+
+ #ifdef HXCPP_GC_GENERATIONAL
+ info->mHasSurvivor = true;
+ #endif
+ }
+ else
+ {
+ // Large nursury object
+ ((unsigned char *)inPtr)[HX_ENDIAN_MARK_ID_BYTE] = gByteMarkID;
+ }
+ }
+ else
+ #endif
+ {
+ #ifdef HX_GC_VERIFY_GENERATIONAL
+ if (sGcVerifyGenerational && ((unsigned char *)inPtr)[HX_ENDIAN_MARK_ID_BYTE] != gPrevByteMarkID)
+ {
+ printf("Alloc missed int generational collection %p\n", inPtr);
+ DebuggerTrap();
+ }
+ #endif
+ ((unsigned char *)inPtr)[HX_ENDIAN_MARK_ID_BYTE] = gByteMarkID;
+ }
+
+ int rows = flags & IMMIX_ALLOC_ROW_COUNT;
+ if (rows)
+ {
+ #if HXCPP_GC_DEBUG_LEVEL>0
+ if ( ((ptr_i & IMMIX_BLOCK_OFFSET_MASK)>>IMMIX_LINE_BITS) + rows > IMMIX_LINES) DebuggerTrap();
+ #endif
+
+ char *block = (char *)(ptr_i & IMMIX_BLOCK_BASE_MASK);
+ char *rowMark = block + ((ptr_i & IMMIX_BLOCK_OFFSET_MASK)>>IMMIX_LINE_BITS);
+ *rowMark = 1;
+ if (rows>1)
+ {
+ rowMark[1] = 1;
+ if (rows>2)
+ {
+ rowMark[2] = 1;
+ if (rows>3)
+ {
+ rowMark[3] = 1;
+ for(int r=4; r<rows; r++)
+ rowMark[r]=1;
+ }
+ }
+ }
+
+ // MARK_ROWS_UNCHECKED_END
+ }
+}
+
+void MarkObjectAllocUnchecked(hx::Object *inPtr,hx::MarkContext *__inCtx)
+{
+ size_t ptr_i = ((size_t)inPtr)-sizeof(int);
+ unsigned int flags = *((unsigned int *)ptr_i);
+ #ifdef HXCPP_GC_NURSERY
+ if (!(flags & 0xff000000))
+ {
+ #if defined(HX_GC_VERIFY_GENERATIONAL)
+ if (sGcVerifyGenerational)
+ {
+ printf("Nursery object escaped generational collection %p\n", inPtr);
+ DebuggerTrap();
+ }
+ #endif
+
+
+ int size = flags & 0xffff;
+ int start = (int)(ptr_i & IMMIX_BLOCK_OFFSET_MASK);
+ int startRow = start>>IMMIX_LINE_BITS;
+ int blockId = *(BlockIdType *)(ptr_i & IMMIX_BLOCK_BASE_MASK);
+ BlockDataInfo *info = (*gBlockInfo)[blockId];
+
+ int endRow = (start + size + sizeof(int) + IMMIX_LINE_LEN-1)>>IMMIX_LINE_BITS;
+ *(unsigned int *)ptr_i = flags = (flags & IMMIX_HEADER_PRESERVE) |
+ (endRow -startRow) |
+ (size<<IMMIX_ALLOC_SIZE_SHIFT) |
+ gMarkID;
+
+ unsigned int *pos = info->allocStart + startRow;
+ unsigned int val = *pos;
+ while(_hx_atomic_compare_exchange( (volatile int *)pos, val, val|gImmixStartFlag[start&127]) != val)
+ val = *pos;
+ #ifdef HXCPP_GC_GENERATIONAL
+ info->mHasSurvivor = true;
+ #endif
+ }
+ else
+ #endif
+ ((unsigned char *)inPtr)[HX_ENDIAN_MARK_ID_BYTE] = gByteMarkID;
+
+ int rows = flags & IMMIX_ALLOC_ROW_COUNT;
+ if (rows)
+ {
+ char *block = (char *)(ptr_i & IMMIX_BLOCK_BASE_MASK);
+ char *rowMark = block + ((ptr_i & IMMIX_BLOCK_OFFSET_MASK)>>IMMIX_LINE_BITS);
+ #if HXCPP_GC_DEBUG_LEVEL>0
+ if ( ((ptr_i & IMMIX_BLOCK_OFFSET_MASK)>>IMMIX_LINE_BITS) + rows > IMMIX_LINES) DebuggerTrap();
+ #endif
+
+ *rowMark = 1;
+ if (rows>1)
+ {
+ rowMark[1] = 1;
+ if (rows>2)
+ {
+ rowMark[2] = 1;
+ if (rows>3)
+ {
+ rowMark[3] = 1;
+ for(int r=4; r<rows; r++)
+ rowMark[r]=1;
+ }
+ }
+ }
+
+ if (flags & IMMIX_ALLOC_IS_CONTAINER)
+ {
+ #ifdef PROFILE_COLLECT
+ sObjectMarks++;
+ #endif
+
+ #ifdef HXCPP_DEBUG
+ if (gCollectTrace && gCollectTrace==inPtr->__GetClass().GetPtr())
+ {
+ gCollectTraceCount++;
+ if (gCollectTraceDoPrint)
+ __inCtx->Trace();
+ }
+
+ // Recursive mark so stack stays intact..
+ #if (HXCPP_GC_DEBUG_LEVEL>0)
+ inPtr->__Mark(__inCtx);
+ #else
+ if (gCollectTrace)
+ inPtr->__Mark(__inCtx);
+ else
+ __inCtx->pushObj(inPtr);
+ #endif
+ #else // Not debug
+
+ // There is a slight performance gain by calling recursively, but you
+ // run the risk of stack overflow. Also, a parallel mark algorithm could be
+ // done when the marking is stack based.
+ //inPtr->__Mark(__inCtx);
+ #if (HXCPP_GC_DEBUG_LEVEL>0)
+ inPtr->__Mark(__inCtx);
+ #else
+ __inCtx->pushObj(inPtr);
+ #endif
+ #endif
+ }
+ else
+ {
+ #ifdef PROFILE_COLLECT
+ sAllocMarks++;
+ #endif
+ }
+
+ // MARK_ROWS_UNCHECKED_END
+ }
+}
+
+
+void MarkObjectArray(hx::Object **inPtr, int inLength, hx::MarkContext *__inCtx)
+{
+ hx::Object *tmp;
+
+ int extra = inLength & 0x0f;
+ for(int i=0;i<extra;i++)
+ if (inPtr[i]) MarkObjectAlloc(inPtr[i],__inCtx);
+ if (inLength==extra)
+ return;
+
+ inLength -= extra;
+ hx::Object **ptrI = inPtr + extra;
+ hx::Object **end = ptrI + inLength;
+
+
+ #define MARK_PTR_I \
+ tmp = *ptrI++; \
+ if (tmp) MarkObjectAlloc(tmp,__inCtx);
+
+
+
+ #ifdef HX_MULTI_THREAD_MARKING
+ if (sAllThreads && inLength>4096)
+ {
+ hx::Object **dishOffEnd = end - 4096;
+ while(ptrI<end)
+ {
+ // Are the other threads slacking off?
+ if ((sRunningThreads != sAllThreads) && ptrI<dishOffEnd)
+ {
+ ptrI += sGlobalChunks.takeArrayJob(ptrI, end-ptrI);
+ }
+ else
+ {
+ MARK_PTR_I;
+ MARK_PTR_I;
+ MARK_PTR_I;
+ MARK_PTR_I;
+
+ MARK_PTR_I;
+ MARK_PTR_I;
+ MARK_PTR_I;
+ MARK_PTR_I;
+
+ MARK_PTR_I;
+ MARK_PTR_I;
+ MARK_PTR_I;
+ MARK_PTR_I;
+
+ MARK_PTR_I;
+ MARK_PTR_I;
+ MARK_PTR_I;
+ MARK_PTR_I;
+ }
+ }
+ }
+ else
+ #endif
+ {
+ while(ptrI<end)
+ {
+ MARK_PTR_I;
+ MARK_PTR_I;
+ MARK_PTR_I;
+ MARK_PTR_I;
+
+ MARK_PTR_I;
+ MARK_PTR_I;
+ MARK_PTR_I;
+ MARK_PTR_I;
+
+ MARK_PTR_I;
+ MARK_PTR_I;
+ MARK_PTR_I;
+ MARK_PTR_I;
+
+ MARK_PTR_I;
+ MARK_PTR_I;
+ MARK_PTR_I;
+ MARK_PTR_I;
+ }
+ }
+}
+
+void MarkStringArray(String *inPtr, int inLength, hx::MarkContext *__inCtx)
+{
+ #if 0
+ if (MAX_GC_THREADS>1 && sAllThreads && inLength>4096)
+ {
+ int extra = inLength & 0x0f;
+ for(int i=0;i<extra;i++)
+ if (inPtr[i]) MarkObjectAlloc(inPtr[i],__inCtx);
+
+ hx::Object **ptrI = inPtr + extra;
+ hx::Object **end = ptrI + (inLength& ~0x0f);
+ hx::Object **dishOffEnd = end - 4096;
+ while(ptrI<end)
+ {
+ // Are the other threads slacking off?
+ if ((sRunningThreads != sAllThreads) && ptrI<dishOffEnd)
+ {
+ ptrI += sGlobalChunks.takeArrayJob(ptrI, end-ptrI);
+ }
+
+ if (*ptrI) MarkObjectAlloc(*ptrI,__inCtx); ptrI++;
+ if (*ptrI) MarkObjectAlloc(*ptrI,__inCtx); ptrI++;
+ if (*ptrI) MarkObjectAlloc(*ptrI,__inCtx); ptrI++;
+ if (*ptrI) MarkObjectAlloc(*ptrI,__inCtx); ptrI++;
+ if (*ptrI) MarkObjectAlloc(*ptrI,__inCtx); ptrI++;
+ if (*ptrI) MarkObjectAlloc(*ptrI,__inCtx); ptrI++;
+ if (*ptrI) MarkObjectAlloc(*ptrI,__inCtx); ptrI++;
+ if (*ptrI) MarkObjectAlloc(*ptrI,__inCtx); ptrI++;
+ if (*ptrI) MarkObjectAlloc(*ptrI,__inCtx); ptrI++;
+ if (*ptrI) MarkObjectAlloc(*ptrI,__inCtx); ptrI++;
+ if (*ptrI) MarkObjectAlloc(*ptrI,__inCtx); ptrI++;
+ if (*ptrI) MarkObjectAlloc(*ptrI,__inCtx); ptrI++;
+ if (*ptrI) MarkObjectAlloc(*ptrI,__inCtx); ptrI++;
+ if (*ptrI) MarkObjectAlloc(*ptrI,__inCtx); ptrI++;
+ if (*ptrI) MarkObjectAlloc(*ptrI,__inCtx); ptrI++;
+ if (*ptrI) MarkObjectAlloc(*ptrI,__inCtx); ptrI++;
+ }
+ }
+ else
+ #endif
+ {
+ for(int i=0;i<inLength;i++)
+ {
+ const char *str = inPtr[i].raw_ptr();
+ HX_MARK_STRING(str);
+ }
+ }
+}
+
+#ifdef HXCPP_DEBUG
+#define FILE_SCOPE
+#else
+#define FILE_SCOPE static
+#endif
+
+// --- Roots -------------------------------
+
+FILE_SCOPE HxMutex *sGCRootLock = 0;
+typedef hx::UnorderedSet<hx::Object **> RootSet;
+static RootSet sgRootSet;
+
+typedef hx::UnorderedMap<void *,int> OffsetRootSet;
+static OffsetRootSet *sgOffsetRootSet=0;
+
+void GCAddRoot(hx::Object **inRoot)
+{
+ AutoLock lock(*sGCRootLock);
+ sgRootSet.insert(inRoot);
+}
+
+void GCRemoveRoot(hx::Object **inRoot)
+{
+ AutoLock lock(*sGCRootLock);
+ sgRootSet.erase(inRoot);
+}
+
+
+void GcAddOffsetRoot(void *inRoot, int inOffset)
+{
+ AutoLock lock(*sGCRootLock);
+ if (!sgOffsetRootSet)
+ sgOffsetRootSet = new OffsetRootSet();
+ (*sgOffsetRootSet)[inRoot] = inOffset;
+}
+
+void GcSetOffsetRoot(void *inRoot, int inOffset)
+{
+ AutoLock lock(*sGCRootLock);
+ (*sgOffsetRootSet)[inRoot] = inOffset;
+}
+
+void GcRemoveOffsetRoot(void *inRoot)
+{
+ AutoLock lock(*sGCRootLock);
+ OffsetRootSet::iterator r = sgOffsetRootSet->find(inRoot);
+ sgOffsetRootSet->erase(r);
+}
+
+
+
+
+// --- Finalizers -------------------------------
+
+
+class WeakRef;
+typedef hx::QuickVec<WeakRef *> WeakRefs;
+
+FILE_SCOPE HxMutex *sFinalizerLock = 0;
+FILE_SCOPE WeakRefs sWeakRefs;
+
+class WeakRef : public hx::Object
+{
+public:
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdWeakRef };
+
+ WeakRef(Dynamic inRef)
+ {
+ mRef = inRef;
+ if (mRef.mPtr)
+ {
+ sFinalizerLock->Lock();
+ sWeakRefs.push(this);
+ sFinalizerLock->Unlock();
+ }
+ }
+
+ // Don't mark our ref !
+
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx) { HX_VISIT_MEMBER(mRef); }
+ #endif
+
+ Dynamic mRef;
+};
+
+
+
+typedef hx::QuickVec<InternalFinalizer *> FinalizerList;
+
+FILE_SCOPE FinalizerList *sgFinalizers = 0;
+
+typedef hx::UnorderedMap<hx::Object *,hx::finalizer> FinalizerMap;
+FILE_SCOPE FinalizerMap sFinalizerMap;
+
+typedef void (*HaxeFinalizer)(Dynamic);
+typedef hx::UnorderedMap<hx::Object *,HaxeFinalizer> HaxeFinalizerMap;
+FILE_SCOPE HaxeFinalizerMap sHaxeFinalizerMap;
+
+hx::QuickVec<int> sFreeObjectIds;
+typedef hx::UnorderedMap<hx::Object *,int> ObjectIdMap;
+typedef hx::QuickVec<hx::Object *> IdObjectMap;
+FILE_SCOPE ObjectIdMap sObjectIdMap;
+FILE_SCOPE IdObjectMap sIdObjectMap;
+
+typedef hx::UnorderedSet<hx::Object *> MakeZombieSet;
+FILE_SCOPE MakeZombieSet sMakeZombieSet;
+
+typedef hx::QuickVec<hx::Object *> ZombieList;
+FILE_SCOPE ZombieList sZombieList;
+
+typedef hx::QuickVec<hx::HashRoot *> WeakHashList;
+FILE_SCOPE WeakHashList sWeakHashList;
+
+
+InternalFinalizer::InternalFinalizer(hx::Object *inObj, finalizer inFinalizer)
+{
+ mValid = true;
+ mObject = inObj;
+ mFinalizer = inFinalizer;
+
+ // Ensure this survives generational collect
+ AutoLock lock(*gSpecialObjectLock);
+ sgFinalizers->push(this);
+}
+
+#ifdef HXCPP_VISIT_ALLOCS
+void InternalFinalizer::Visit(VisitContext *__inCtx)
+{
+ HX_VISIT_OBJECT(mObject);
+}
+#endif
+
+void InternalFinalizer::Detach()
+{
+ mValid = false;
+}
+
+void FindZombies(MarkContext &inContext)
+{
+ for(MakeZombieSet::iterator i=sMakeZombieSet.begin(); i!=sMakeZombieSet.end(); )
+ {
+ hx::Object *obj = *i;
+ MakeZombieSet::iterator next = i;
+ ++next;
+
+ unsigned char mark = ((unsigned char *)obj)[HX_ENDIAN_MARK_ID_BYTE];
+ if ( mark!=gByteMarkID )
+ {
+ sZombieList.push(obj);
+ sMakeZombieSet.erase(i);
+
+ // Mark now to prevent secondary zombies...
+ inContext.init();
+ hx::MarkObjectAlloc(obj , &inContext );
+ inContext.processMarkStack();
+ }
+
+ i = next;
+ }
+}
+
+bool IsWeakRefValid(const HX_CHAR *inPtr)
+{
+ unsigned char mark = ((unsigned char *)inPtr)[HX_ENDIAN_MARK_ID_BYTE];
+
+ // Special case of member closure - check if the 'this' pointer is still alive
+ return mark==gByteMarkID;
+}
+
+bool IsWeakRefValid(hx::Object *inPtr)
+{
+ unsigned char mark = ((unsigned char *)inPtr)[HX_ENDIAN_MARK_ID_BYTE];
+
+ // Special case of member closure - check if the 'this' pointer is still alive
+ bool isCurrent = mark==gByteMarkID;
+ if ( !isCurrent && inPtr->__GetType()==vtFunction)
+ {
+ hx::Object *thiz = (hx::Object *)inPtr->__GetHandle();
+ if (thiz)
+ {
+ mark = ((unsigned char *)thiz)[HX_ENDIAN_MARK_ID_BYTE];
+ if (mark==gByteMarkID)
+ {
+ // The object is still alive, so mark the closure and continue
+ MarkAlloc(inPtr,0);
+ return true;
+ }
+ }
+ }
+ return isCurrent;
+}
+
+static void someHackyFunc(hx::Object *)
+{
+}
+
+static void (*hackyFunctionCall)(hx::Object *) = someHackyFunc;
+
+struct Finalizable
+{
+ union
+ {
+ _hx_member_finalizer member;
+ _hx_alloc_finalizer alloc;
+ };
+ void *base;
+ bool pin;
+ bool isMember;
+
+ Finalizable(hx::Object *inBase, _hx_member_finalizer inMember, bool inPin)
+ {
+ base = inBase;
+ member = inMember;
+ pin = inPin;
+ isMember = true;
+ }
+
+ Finalizable(void *inBase, _hx_alloc_finalizer inAlloc, bool inPin)
+ {
+ base = inBase;
+ alloc = inAlloc;
+ pin = inPin;
+ isMember = false;
+ }
+ void run()
+ {
+ if (isMember)
+ {
+ hx::Object *object = (hx::Object *)base;
+ // I can't tell if it is msvc over-optimizing this code, to I am not
+ // quite calling things right, but this seems to fix it...
+ hackyFunctionCall(object);
+ (object->*member)();
+ }
+ else
+ alloc( base );
+ }
+};
+typedef hx::QuickVec< Finalizable > FinalizableList;
+FILE_SCOPE FinalizableList sFinalizableList;
+
+
+static double tFinalizers;
+static int finalizerCount;
+static int localCount;
+static int localObjects;
+static int localAllocs;
+static int rootObjects;
+static int rootAllocs;
+
+void RunFinalizers()
+{
+ finalizerCount = 0;
+
+ FinalizerList &list = *sgFinalizers;
+ int idx = 0;
+ while(idx<list.size())
+ {
+ InternalFinalizer *f = list[idx];
+ if (!f->mValid)
+ {
+ list.qerase(idx);
+ delete f;
+ }
+ else if (((unsigned char *)(f->mObject))[HX_ENDIAN_MARK_ID_BYTE] != gByteMarkID)
+ {
+ if (f->mFinalizer)
+ {
+ f->mFinalizer(f->mObject);
+ finalizerCount++;
+ }
+ list.qerase(idx);
+ delete f;
+ }
+ else
+ {
+ idx++;
+ }
+ }
+
+ idx = 0;
+ while(idx<sFinalizableList.size())
+ {
+ Finalizable &f = sFinalizableList[idx];
+ unsigned char mark = ((unsigned char *)f.base)[HX_ENDIAN_MARK_ID_BYTE];
+ if ( mark!=gByteMarkID )
+ {
+ finalizerCount++;
+ f.run();
+ sFinalizableList.qerase(idx);
+ }
+ else
+ idx++;
+ }
+
+ for(FinalizerMap::iterator i=sFinalizerMap.begin(); i!=sFinalizerMap.end(); )
+ {
+ hx::Object *obj = i->first;
+ FinalizerMap::iterator next = i;
+ ++next;
+
+ unsigned char mark = ((unsigned char *)obj)[HX_ENDIAN_MARK_ID_BYTE];
+ if ( mark!=gByteMarkID )
+ {
+ finalizerCount++;
+ (*i->second)(obj);
+ sFinalizerMap.erase(i);
+ }
+
+ i = next;
+ }
+
+
+ for(HaxeFinalizerMap::iterator i=sHaxeFinalizerMap.begin(); i!=sHaxeFinalizerMap.end(); )
+ {
+ hx::Object *obj = i->first;
+ HaxeFinalizerMap::iterator next = i;
+ ++next;
+
+ unsigned char mark = ((unsigned char *)obj)[HX_ENDIAN_MARK_ID_BYTE];
+ if ( mark!=gByteMarkID )
+ {
+ finalizerCount++;
+ (*i->second)(obj);
+ sHaxeFinalizerMap.erase(i);
+ }
+
+ i = next;
+ }
+
+ MEM_STAMP(hx::tFinalizers);
+
+ for(ObjectIdMap::iterator i=sObjectIdMap.begin(); i!=sObjectIdMap.end(); )
+ {
+ ObjectIdMap::iterator next = i;
+ next++;
+
+ hx::Object *o = i->first;
+ unsigned char mark = ((unsigned char *)o)[HX_ENDIAN_MARK_ID_BYTE];
+ if ( mark!=gByteMarkID && !(((unsigned int *)o)[-1] & HX_GC_CONST_ALLOC_BIT))
+ {
+ sFreeObjectIds.push(i->second);
+ sIdObjectMap[i->second] = 0;
+ sObjectIdMap.erase(i);
+ }
+
+ i = next;
+ }
+
+ for(int i=0;i<sWeakHashList.size(); )
+ {
+ HashRoot *ref = sWeakHashList[i];
+ unsigned char mark = ((unsigned char *)ref)[HX_ENDIAN_MARK_ID_BYTE];
+ // Object itself is gone - no need to worry about that again
+ if ( mark!=gByteMarkID )
+ {
+ sWeakHashList.qerase(i);
+ // no i++ ...
+ }
+ else
+ {
+ ref->updateAfterGc();
+ i++;
+ }
+ }
+
+
+
+ for(int i=0;i<sWeakRefs.size(); )
+ {
+ WeakRef *ref = sWeakRefs[i];
+ unsigned char mark = ((unsigned char *)ref)[HX_ENDIAN_MARK_ID_BYTE];
+ // Object itself is gone ...
+ if ( mark!=gByteMarkID )
+ {
+ sWeakRefs.qerase(i);
+ // no i++ ...
+ }
+ else
+ {
+ // what about the reference?
+ hx::Object *r = ref->mRef.mPtr;
+ unsigned char mark = ((unsigned char *)r)[HX_ENDIAN_MARK_ID_BYTE];
+
+ // Special case of member closure - check if the 'this' pointer is still alive
+ if ( mark!=gByteMarkID && r->__GetType()==vtFunction)
+ {
+ hx::Object *thiz = (hx::Object *)r->__GetHandle();
+ if (thiz)
+ {
+ mark = ((unsigned char *)thiz)[HX_ENDIAN_MARK_ID_BYTE];
+ if (mark==gByteMarkID)
+ {
+ // The object is still alive, so mark the closure and continue
+ MarkAlloc(r,0);
+ }
+ }
+ }
+
+ if ( mark!=gByteMarkID )
+ {
+ ref->mRef.mPtr = 0;
+ sWeakRefs.qerase(i);
+ }
+ else
+ i++;
+ }
+ }
+}
+
+// Callback finalizer on non-abstract type;
+void GCSetFinalizer( hx::Object *obj, hx::finalizer f )
+{
+ if (!obj)
+ throw Dynamic(HX_CSTRING("set_finalizer - invalid null object"));
+ if (((unsigned int *)obj)[-1] & HX_GC_CONST_ALLOC_BIT)
+ throw Dynamic(HX_CSTRING("set_finalizer - invalid const object"));
+
+ AutoLock lock(*gSpecialObjectLock);
+ if (f==0)
+ {
+ FinalizerMap::iterator i = sFinalizerMap.find(obj);
+ if (i!=sFinalizerMap.end())
+ sFinalizerMap.erase(i);
+ }
+ else
+ sFinalizerMap[obj] = f;
+}
+
+
+// Callback finalizer on non-abstract type;
+void GCSetHaxeFinalizer( hx::Object *obj, HaxeFinalizer f )
+{
+ if (!obj)
+ throw Dynamic(HX_CSTRING("set_finalizer - invalid null object"));
+ if (((unsigned int *)obj)[-1] & HX_GC_CONST_ALLOC_BIT)
+ throw Dynamic(HX_CSTRING("set_finalizer - invalid const object"));
+
+ AutoLock lock(*gSpecialObjectLock);
+ if (f==0)
+ {
+ HaxeFinalizerMap::iterator i = sHaxeFinalizerMap.find(obj);
+ if (i!=sHaxeFinalizerMap.end())
+ sHaxeFinalizerMap.erase(i);
+ }
+ else
+ sHaxeFinalizerMap[obj] = f;
+}
+
+void GCDoNotKill(hx::Object *inObj)
+{
+ if (!inObj)
+ throw Dynamic(HX_CSTRING("doNotKill - invalid null object"));
+ if (((unsigned int *)inObj)[-1] & HX_GC_CONST_ALLOC_BIT)
+ throw Dynamic(HX_CSTRING("doNotKill - invalid const object"));
+
+ AutoLock lock(*gSpecialObjectLock);
+ sMakeZombieSet.insert(inObj);
+}
+
+hx::Object *GCGetNextZombie()
+{
+ AutoLock lock(*gSpecialObjectLock);
+ if (sZombieList.empty())
+ return 0;
+ hx::Object *result = sZombieList.pop();
+ return result;
+}
+
+void RegisterWeakHash(HashBase<String> *inHash)
+{
+ AutoLock lock(*gSpecialObjectLock);
+ sWeakHashList.push(inHash);
+}
+
+void RegisterWeakHash(HashBase<Dynamic> *inHash)
+{
+ AutoLock lock(*gSpecialObjectLock);
+ sWeakHashList.push(inHash);
+}
+
+
+
+void InternalEnableGC(bool inEnable)
+{
+ //printf("Enable %d\n", sgInternalEnable);
+ sgInternalEnable = inEnable;
+}
+
+bool IsConstAlloc(const void *inData)
+{
+ unsigned int *header = (unsigned int *)inData;
+ return header[-1] & HX_GC_CONST_ALLOC_BIT;
+}
+
+void *InternalCreateConstBuffer(const void *inData,int inSize,bool inAddStringHash)
+{
+ bool addHash = inAddStringHash && inSize>0;
+
+ int *result = (int *)HxAlloc(inSize + sizeof(int) + (addHash ? sizeof(int):0) );
+ if (addHash)
+ {
+ unsigned int hash = 0;
+ if (inData)
+ for(int i=0;i<inSize-1;i++)
+ hash = hash*223 + ((unsigned char *)inData)[i];
+
+ //*((unsigned int *)((char *)result + inSize + sizeof(int))) = hash;
+ *result++ = hash;
+ *result++ = HX_GC_CONST_ALLOC_BIT | HX_GC_STRING_HASH;
+ }
+ else
+ {
+ *result++ = HX_GC_CONST_ALLOC_BIT;
+ }
+
+ if (inData)
+ {
+ memcpy(result,inData,inSize);
+ }
+ else if (inSize)
+ {
+ ZERO_MEM(result,inSize);
+ }
+
+ return result;
+}
+
+// Used when the allocation size is zero for a non-null pointer
+void *emptyAlloc = InternalCreateConstBuffer(0,0,false);
+
+
+} // namespace hx
+
+
+hx::Object *__hxcpp_weak_ref_create(Dynamic inObject)
+{
+ return new hx::WeakRef(inObject);
+}
+
+hx::Object *__hxcpp_weak_ref_get(Dynamic inRef)
+{
+ #ifdef HXCPP_DEBUG
+ hx::WeakRef *ref = dynamic_cast<hx::WeakRef *>(inRef.mPtr);
+ #else
+ hx::WeakRef *ref = static_cast<hx::WeakRef *>(inRef.mPtr);
+ #endif
+ return ref->mRef.mPtr;
+}
+
+
+// --- GlobalAllocator -------------------------------------------------------
+
+typedef hx::QuickVec<BlockDataInfo *> BlockList;
+
+typedef hx::QuickVec<unsigned int *> LargeList;
+
+enum MemType { memUnmanaged, memBlock, memLarge };
+
+
+
+
+#ifdef HXCPP_VISIT_ALLOCS
+class AllocCounter : public hx::VisitContext
+{
+public:
+ int count;
+
+ AllocCounter() { count = 0; }
+
+ void visitObject(hx::Object **ioPtr) { count ++; }
+ void visitAlloc(void **ioPtr) { count ++; }
+};
+
+
+#endif
+
+
+class GlobalAllocator *sGlobalAlloc = 0;
+
+
+inline bool SortByBlockPtr(BlockDataInfo *inA, BlockDataInfo *inB)
+{
+ return inA->mPtr < inB->mPtr;
+}
+
+struct MoveBlockJob
+{
+ BlockList blocks;
+ int from;
+ int to;
+
+ MoveBlockJob(BlockList &inAllBlocks)
+ {
+ blocks.setSize(inAllBlocks.size());
+ memcpy(&blocks[0], &inAllBlocks[0], inAllBlocks.size()*sizeof(void*));
+
+ std::sort(&blocks[0], &blocks[0]+blocks.size(), SortMoveOrder );
+ from = 0;
+ to = blocks.size()-1;
+ }
+
+ BlockDataInfo *getFrom()
+ {
+ while(true)
+ {
+ if (from>=to)
+ {
+ //printf("Caught up!\n");
+ return 0;
+ }
+ #ifndef HXCPP_GC_DEBUG_ALWAYS_MOVE
+ // Pinned / full
+ if (blocks[from]->mMoveScore<2)
+ {
+ //printf("All other blocks good!\n");
+ while(from<to)
+ {
+ //printf("Ignore DEFRAG %p ... %p\n", blocks[from]->mPtr, blocks[from]->mPtr+1);
+ from++;
+ }
+ return 0;
+ }
+ #endif
+ if (blocks[from]->mPinned)
+ {
+ //printf("PINNED DEFRAG %p ... %p\n", blocks[from]->mPtr, blocks[from]->mPtr+1);
+ from++;
+ }
+ else // Found one...
+ break;
+ }
+ //printf("From block %d (id=%d)\n", from, blocks[from]->mId);
+ BlockDataInfo *result = blocks[from++];
+ ////printf("FROM DEFRAG %p ... %p\n", result->mPtr, result->mPtr + 1 );
+ return result;
+ }
+ BlockDataInfo *getTo()
+ {
+ if (from>=to)
+ {
+ //printf("No more room!\n");
+ return 0;
+ }
+ //printf("To block %d (id=%d)\n", to, blocks[to]->mId);
+ BlockDataInfo *result = blocks[to--];
+ //printf("TO DEFRAG %p ... %p\n", result->mPtr, result->mPtr + 1 );
+ return result;
+ }
+};
+
+
+#ifndef HX_MEMORY_H_OVERRIDE
+
+#if 0
+static hx::QuickVec<void *> sBlockPool;
+static int gcBlockAllocs = 0;
+
+void *HxAllocGCBlock(size_t size)
+{
+ if (sBlockPool.size())
+ return sBlockPool.pop();
+ gcBlockAllocs++;
+ GCLOG("===========================================> New Chunk (%d)\n", gcBlockAllocs);
+ return HxAlloc(size);
+}
+
+void HxFreeGCBlock(void *p)
+{
+ sBlockPool.push(p);
+}
+
+#else
+
+#ifdef HX_GC_FIXED_BLOCKS
+unsigned char *chunkData = 0;
+void *HxAllocGCBlock(size_t inSize)
+{
+ if (!chunkData)
+ {
+ size_t size = 65536;
+ size *= IMMIX_BLOCK_SIZE;
+ #if defined(HX_WINDOWS) && defined(HXCPP_M64)
+ chunkData = (unsigned char *)0x100000000;
+ VirtualAlloc(chunkData,size,MEM_COMMIT|MEM_RESERVE,PAGE_READWRITE);
+ #else
+ chunkData = (unsigned char *)HxAlloc(size);
+ size_t ptr_i = (size_t)(chunkData+0xffff) & ~((size_t)0xffff);
+ chunkData = (unsigned char *)ptr_i;
+ #endif
+ //printf("Using fixed blocks %p...%p\n", chunkData, chunkData+size);
+ }
+ void *result = chunkData;
+ //printf(" %p\n", result);
+ chunkData += inSize;
+ return result;
+}
+void HxFreeGCBlock(void *p)
+{
+ printf("todo - HX_GC_FIXED_BLOCKS %p\n",p);
+}
+#else
+void *HxAllocGCBlock(size_t size) { return HxAlloc(size); }
+void HxFreeGCBlock(void *p) { HxFree(p); }
+#endif
+
+#endif
+
+#endif // HX_MEMORY_H_OVERRIDE
+
+
+//#define VERIFY_STACK_READ
+
+#ifdef VERIFY_STACK_READ
+// Just have something to do...
+int gVerifyVoidCount = 0;
+void VerifyStackRead(int *inBottom, int *inTop)
+{
+ #ifdef HXCPP_STACK_UP
+ int *start = inTop-1;
+ inTop = inBottom+1;
+ inBottom = start;
+ #endif
+
+ int n = inTop - inBottom;
+ int check = std::min(n,5);
+ for(int c=0;c<check;c++)
+ {
+ if (inBottom[c]==0)
+ gVerifyVoidCount++;
+ if (inTop[-1-c]==0)
+ gVerifyVoidCount++;
+ }
+}
+#endif
+
+// TODO - work out best size based on cache size?
+#ifdef HXCPP_GC_BIG_BLOCKS
+static int sMinZeroQueueSize = 4;
+static int sMaxZeroQueueSize = 16;
+#else
+static int sMinZeroQueueSize = 8;
+static int sMaxZeroQueueSize = 32;
+#endif
+
+#define BLOCK_OFSIZE_COUNT 12
+
+
+class GlobalAllocator
+{
+ enum { LOCAL_POOL_SIZE = 2 };
+
+public:
+ GlobalAllocator()
+ {
+ memset((void *)mNextFreeBlockOfSize,0,sizeof(mNextFreeBlockOfSize));
+ mRowsInUse = 0;
+ mLargeAllocated = 0;
+ mLargeAllocSpace = 40 << 20;
+ mLargeAllocForceRefresh = mLargeAllocSpace;
+ // Start at 1 Meg...
+ mTotalAfterLastCollect = 1<<20;
+ mCurrentRowsInUse = 0;
+ mAllBlocksCount = 0;
+ mGenerationalRetainEstimate = 0.5;
+ for(int p=0;p<LOCAL_POOL_SIZE;p++)
+ mLocalPool[p] = 0;
+
+ createFreeList();
+ }
+ void AddLocal(LocalAllocator *inAlloc)
+ {
+ if (!gThreadStateChangeLock)
+ {
+ gThreadStateChangeLock = new HxMutex();
+ gSpecialObjectLock = new HxMutex();
+ }
+ // Until we add ourselves, the collector will not wait
+ // on us - ie, we are assumed ot be in a GC free zone.
+ AutoLock lock(*gThreadStateChangeLock);
+ mLocalAllocs.push(inAlloc);
+ // TODO Attach debugger
+ }
+
+ bool ReturnToPoolLocked(LocalAllocator *inAlloc)
+ {
+ // Until we add ourselves, the colled will not wait
+ // on us - ie, we are assumed ot be in a GC free zone.
+ for(int p=0;p<LOCAL_POOL_SIZE;p++)
+ {
+ if (!mLocalPool[p])
+ {
+ mLocalPool[p] = inAlloc;
+ return true;
+ }
+ }
+ // I told him we already got one
+ return false;
+ }
+
+ LocalAllocator *GetPooledAllocator()
+ {
+ AutoLock lock(*gThreadStateChangeLock);
+ for(int p=0;p<LOCAL_POOL_SIZE;p++)
+ {
+ if (mLocalPool[p])
+ {
+ LocalAllocator *result = mLocalPool[p];
+ mLocalPool[p] = 0;
+ return result;
+ }
+ }
+ return 0;
+ }
+
+ void RemoveLocalLocked(LocalAllocator *inAlloc)
+ {
+ // You should be in the GC free zone before you call this...
+ if (!mLocalAllocs.qerase_val(inAlloc))
+ {
+ CriticalGCError("LocalAllocator removed without being added");
+ }
+ }
+
+ void FreeLarge(void *inLarge)
+ {
+#ifdef HXCPP_TELEMETRY
+ __hxt_gc_free_large(inLarge);
+#endif
+
+ ((unsigned char *)inLarge)[HX_ENDIAN_MARK_ID_BYTE] = 0;
+ // AllocLarge will not lock this list unless it decides there is a suitable
+ // value, so we can't doa realloc without potentially crashing it.
+ if (largeObjectRecycle.hasExtraCapacity(1))
+ {
+ unsigned int *blob = ((unsigned int *)inLarge) - 2;
+ unsigned int size = *blob;
+ mLargeListLock.Lock();
+ mLargeAllocated -= size;
+ // Could somehow keep it in the list, but mark as recycled?
+ mLargeList.qerase_val(blob);
+ // We could maybe free anyhow?
+ if (!largeObjectRecycle.hasExtraCapacity(1))
+ {
+ mLargeListLock.Unlock();
+ HxFree(blob);
+ return;
+ }
+ largeObjectRecycle.push(blob);
+ mLargeListLock.Unlock();
+ }
+ }
+
+ void *AllocLarge(int inSize, bool inClear)
+ {
+ if (hx::gPauseForCollect)
+ __hxcpp_gc_safe_point();
+
+ //Should we force a collect ? - the 'large' data are not considered when allocating objects
+ // from the blocks, and can 'pile up' between smalll object allocations
+ if ((inSize+mLargeAllocated > mLargeAllocForceRefresh) && sgInternalEnable)
+ {
+ #ifdef SHOW_MEM_EVENTS
+ //GCLOG("Large alloc causing collection");
+ #endif
+ CollectFromThisThread(false,false);
+ }
+
+ inSize = (inSize +3) & ~3;
+
+ if (inSize<<1 > mLargeAllocSpace)
+ mLargeAllocSpace = inSize<<1;
+
+ unsigned int *result = 0;
+ #ifndef HXCPP_SINGLE_THREADED_APP
+ bool do_lock = true;
+ #else
+ bool do_lock = false;
+ #endif
+ bool isLocked = false;
+
+
+ if (largeObjectRecycle.size())
+ {
+ for(int i=0;i<largeObjectRecycle.size();i++)
+ {
+ if ( largeObjectRecycle[i][0] == inSize )
+ {
+ if (do_lock && !isLocked)
+ {
+ mLargeListLock.Lock();
+ isLocked = true;
+ if ( i>=largeObjectRecycle.size() || largeObjectRecycle[i][0] != inSize )
+ continue;
+ }
+
+ result = largeObjectRecycle[i];
+ largeObjectRecycle.qerase(i);
+ // You can use this to test race condition
+ //Sleep(1);
+ break;
+ }
+ }
+ }
+
+ if (!result)
+ result = (unsigned int *)HxAlloc(inSize + sizeof(int)*2);
+
+ if (!result)
+ {
+ #ifdef SHOW_MEM_EVENTS
+ GCLOG("Large alloc failed - forcing collect\n");
+ #endif
+
+ if (isLocked)
+ {
+ mLargeListLock.Unlock();
+ isLocked = false;
+ }
+
+ CollectFromThisThread(true,true);
+ result = (unsigned int *)HxAlloc(inSize + sizeof(int)*2);
+ }
+
+ if (!result)
+ {
+ GCLOG("Memory Exhausted!\n");
+ DebuggerTrap();
+ }
+
+ if (inClear)
+ ZERO_MEM(result, inSize + sizeof(int)*2);
+
+ result[0] = inSize;
+ #ifdef HXCPP_GC_NURSERY
+ result[1] = 0;
+ #else
+ result[1] = hx::gMarkID;
+ #endif
+
+ if (do_lock && !isLocked)
+ mLargeListLock.Lock();
+
+ mLargeList.push(result);
+ mLargeAllocated += inSize;
+
+ if (do_lock)
+ mLargeListLock.Unlock();
+
+#ifdef HXCPP_TELEMETRY
+ __hxt_gc_alloc(result + 2, inSize);
+#endif
+
+ return result+2;
+ }
+
+ void onMemoryChange(int inDelta, const char *inWhy)
+ {
+ if (hx::gPauseForCollect)
+ __hxcpp_gc_safe_point();
+
+ if (inDelta>0)
+ {
+ //Should we force a collect ? - the 'large' data are not considered when allocating objects
+ // from the blocks, and can 'pile up' between smalll object allocations
+ if (inDelta>0 && (inDelta+mLargeAllocated > mLargeAllocForceRefresh) && sgInternalEnable)
+ {
+ //GCLOG("onMemoryChange alloc causing collection");
+ CollectFromThisThread(false,false);
+ }
+
+ int rounded = (inDelta +3) & ~3;
+
+ if (rounded<<1 > mLargeAllocSpace)
+ mLargeAllocSpace = rounded<<1;
+ }
+
+ #ifndef HXCPP_SINGLE_THREADED_APP
+ bool do_lock = true;
+ #else
+ bool do_lock = false;
+ #endif
+
+ if (do_lock)
+ mLargeListLock.Lock();
+
+ mLargeAllocated += inDelta;
+
+ if (do_lock)
+ mLargeListLock.Unlock();
+ }
+
+ // Gets a block with the 'zeroLock' acquired, which means the zeroing thread
+ // will leave it alone from now on
+ //
+ // This contains some "lock free" code that triggers the thread sanitizer.
+ // * mOwned can only be changed with the mZeroLock
+ // * mFreeBlocks may increase size, but it is not critical whether the mNextFreeBlockOfSize
+ // is increased since skipping only leads to a bit of extra searhing for the
+ // next allocation
+ #if defined(__has_feature)
+ #if __has_feature(thread_sanitizer)
+ __attribute__((no_sanitize("thread")))
+ #endif
+ #endif
+ BlockDataInfo *GetNextFree(int inRequiredBytes)
+ {
+ bool failedLock = true;
+ int sizeSlot = inRequiredBytes>>IMMIX_LINE_BITS;
+ if (sizeSlot>=BLOCK_OFSIZE_COUNT)
+ sizeSlot = BLOCK_OFSIZE_COUNT-1;
+ //volatile int &nextFreeBlock = mNextFreeBlockOfSize[sizeSlot];
+ int nextFreeBlock = mNextFreeBlockOfSize[sizeSlot];
+ while(failedLock && nextFreeBlock<mFreeBlocks.size())
+ {
+ failedLock = false;
+
+ for(int i=nextFreeBlock; i<mFreeBlocks.size(); i++)
+ {
+ BlockDataInfo *info = mFreeBlocks[i];
+ if (!info->mOwned && info->mMaxHoleSize>=inRequiredBytes)
+ {
+ // Acquire the zero-lock
+ if (_hx_atomic_compare_exchange(&info->mZeroLock, 0, 1) == 0)
+ {
+ // Acquire ownership...
+ if (info->mOwned)
+ {
+ // Someone else got it...
+ info->mZeroLock = 0;
+ }
+ else
+ {
+ info->mOwned = true;
+
+ // Increase the mNextFreeBlockOfSize
+ int idx = nextFreeBlock;
+ while(idx<mFreeBlocks.size() && mFreeBlocks[idx]->mOwned)
+ {
+ _hx_atomic_compare_exchange(mNextFreeBlockOfSize+sizeSlot, idx, idx+1);
+ idx++;
+ }
+
+ if (sgThreadPoolJob==tpjAsyncZeroJit)
+ {
+ if (info->mZeroed==ZEROED_THREAD)
+ onZeroedBlockDequeued();
+ #ifdef PROFILE_THREAD_USAGE
+ else
+ {
+ if (!info->mZeroed)
+ _hx_atomic_add(&sThreadZeroMisses, 1);
+ }
+ #endif
+ }
+
+ return info;
+ }
+ }
+ else if (!info->mOwned)
+ {
+ // Zeroing thread is currently working on this block
+ // Go to next one or spin around again
+ failedLock = true;
+ }
+ }
+ }
+ }
+
+ return 0;
+ }
+
+ inline size_t GetWorkingMemory()
+ {
+ return ((size_t)mAllBlocks.size()) << IMMIX_BLOCK_BITS;
+ }
+
+ // Making this function "virtual" is actually a (big) performance enhancement!
+ // On the iphone, sjlj (set-jump-long-jump) exceptions are used, which incur a
+ // performance overhead. It seems that the overhead in only in routines that call
+ // malloc/new. This is not called very often, so the overhead should be minimal.
+ // However, gcc inlines this function! requiring every alloc the have sjlj overhead.
+ // Making it virtual prevents the overhead.
+ virtual bool AllocMoreBlocks(bool &outForceCompact, bool inJustBorrowing)
+ {
+ enum { newBlockCount = 1<<(IMMIX_BLOCK_GROUP_BITS) };
+
+ #ifdef HXCPP_GC_MOVING
+ if (!inJustBorrowing)
+ {
+ // Do compact next collect sooner
+ if (sgTimeToNextTableUpdate>1)
+ {
+ #ifdef SHOW_FRAGMENTATION
+ #ifdef SHOW_MEM_EVENTS_VERBOSE
+ GCLOG(" alloc -> enable full collect\n");
+ #endif
+ #endif
+ //sgTimeToNextTableUpdate = 1;
+ }
+ }
+ #endif
+
+ #ifndef HXCPP_GC_BIG_BLOCKS
+ // Currently, we only have 2 bytes for a block header
+ if (mAllBlocks.size()+newBlockCount >= 0xfffe )
+ {
+ #if defined(SHOW_MEM_EVENTS) || defined(SHOW_FRAGMENTATION)
+ GCLOG("Block id count used - collect");
+ #endif
+ // The problem is we are out of blocks, not out of memory
+ outForceCompact = false;
+ return false;
+ }
+ #endif
+
+ // Find spare group...
+ int gid = -1;
+ for(int i=0;i<gAllocGroups.size();i++)
+ if (!gAllocGroups[i].alloc)
+ {
+ gid = i;
+ break;
+ }
+ if (gid<0)
+ {
+ if (!gAllocGroups.safeReserveExtra(1))
+ {
+ outForceCompact = true;
+ return false;
+ }
+ gid = gAllocGroups.next();
+ gAllocGroups[gid].alloc = 0;
+ }
+
+ int n = 1<<IMMIX_BLOCK_GROUP_BITS;
+
+
+ if (!mAllBlocks.safeReserveExtra(n) || !mFreeBlocks.hasExtraCapacity(n))
+ {
+ outForceCompact = true;
+ return false;
+ }
+
+ char *chunk = (char *)HxAllocGCBlock( 1<<(IMMIX_BLOCK_GROUP_BITS + IMMIX_BLOCK_BITS) );
+ if (!chunk)
+ {
+ //DebuggerTrap();
+ #ifdef SHOW_MEM_EVENTS
+ GCLOG("Alloc failed - try collect\n");
+ #endif
+ outForceCompact = true;
+ return false;
+ }
+
+ char *aligned = (char *)( (((size_t)chunk) + IMMIX_BLOCK_SIZE-1) & IMMIX_BLOCK_BASE_MASK);
+ if (aligned!=chunk)
+ n--;
+ gAllocGroups[gid].alloc = chunk;
+ gAllocGroups[gid].blocks = n;
+ gAllocGroups[gid].clear();
+
+ int newSize = mFreeBlocks.size();
+ for(int i=0;i<n;i++)
+ {
+ BlockData *block = (BlockData *)(aligned + i*IMMIX_BLOCK_SIZE);
+ BlockDataInfo *info = new BlockDataInfo(gid,block);
+
+ mAllBlocks.push(info);
+ mFreeBlocks.push(info);
+ }
+ std::stable_sort(&mAllBlocks[0], &mAllBlocks[0] + mAllBlocks.size(), SortByBlockPtr );
+ mAllBlocksCount = mAllBlocks.size();
+ for(int i=0;i<BLOCK_OFSIZE_COUNT;i++)
+ mNextFreeBlockOfSize[i] = newSize;
+
+ #ifdef HXCPP_GC_VERIFY
+ VerifyBlockOrder();
+ #endif
+
+ #if defined(SHOW_MEM_EVENTS_VERBOSE) || defined(SHOW_FRAGMENTATION_BLOCKS)
+ if (inJustBorrowing)
+ {
+ GCLOG("Borrow Blocks %d = %d k\n", mAllBlocks.size(), (mAllBlocks.size() << IMMIX_BLOCK_BITS)>>10);
+ }
+ else
+ {
+ GCLOG("Blocks %d = %d k\n", mAllBlocks.size(), (mAllBlocks.size() << IMMIX_BLOCK_BITS)>>10);
+ }
+ #endif
+
+
+ return true;
+ }
+
+ bool allowMoreBlocks()
+ {
+ #ifdef HXCPP_GC_GENERATIONAL
+ return sGcMode==gcmFull;
+ #else
+ return true;
+ #endif
+ }
+
+ void repoolReclaimedBlock(BlockDataInfo *block)
+ {
+ // The mMaxHoleSize has changed - possibly return to one of the pools
+ }
+
+
+ BlockDataInfo *GetFreeBlock(int inRequiredBytes, hx::ImmixAllocator *inAlloc)
+ {
+ while(true)
+ {
+ BlockDataInfo *result = GetNextFree(inRequiredBytes);
+ if (result)
+ {
+ result->zeroAndUnlock();
+
+ // After zero/reclaim, it might be that the hole size is smaller than we thought.
+ if (result->mMaxHoleSize>=inRequiredBytes)
+ return result;
+
+ repoolReclaimedBlock(result);
+ continue;
+ }
+
+ if (hx::gPauseForCollect)
+ {
+ hx::PauseForCollect();
+ continue;
+ }
+
+ #ifndef HXCPP_SINGLE_THREADED_APP
+ hx::EnterGCFreeZone();
+ gThreadStateChangeLock->Lock();
+ hx::ExitGCFreeZoneLocked();
+
+ result = GetNextFree(inRequiredBytes);
+ #endif
+
+ bool forceCompact = false;
+ if (!result && allowMoreBlocks() && (!sgInternalEnable || GetWorkingMemory()<sWorkingMemorySize))
+ {
+ if (AllocMoreBlocks(forceCompact,false))
+ result = GetNextFree(inRequiredBytes);
+ }
+
+ if (!result)
+ {
+ inAlloc->SetupStackAndCollect(false,forceCompact,true,true);
+ result = GetNextFree(inRequiredBytes);
+ }
+
+ if (!result && !forceCompact)
+ {
+ // Try with compact this time...
+ forceCompact = true;
+ inAlloc->SetupStackAndCollect(false,forceCompact,true,true);
+ result = GetNextFree(inRequiredBytes);
+ }
+
+ if (!result)
+ {
+ if (AllocMoreBlocks(forceCompact,false))
+ result = GetNextFree(inRequiredBytes);
+ }
+
+ if (!result)
+ {
+ GCLOG("Memory exhausted.\n");
+ #ifndef HXCPP_M64
+ GCLOG(" try 64 bit build.\n");
+ #endif
+ #ifndef HXCPP_GC_BIG_BLOCKS
+ GCLOG(" try HXCPP_GC_BIG_BLOCKS.\n");
+ #endif
+ DebuggerTrap();
+ }
+
+ // Assume all wil be used
+ mCurrentRowsInUse += result->GetFreeRows();
+
+ #ifndef HXCPP_SINGLE_THREADED_APP
+ gThreadStateChangeLock->Unlock();
+ #endif
+
+
+ result->zeroAndUnlock();
+
+ // After zero/reclaim, it might be that the hole size is smaller than we thought.
+ if (result->mMaxHoleSize>=inRequiredBytes)
+ return result;
+
+ repoolReclaimedBlock(result);
+ }
+ }
+
+ #if defined(HXCPP_VISIT_ALLOCS) // {
+
+ void MoveSpecial(hx::Object *inTo, hx::Object *inFrom, int size)
+ {
+ #ifdef HX_WATCH
+ if (hxInWatchList(inFrom))
+ GCLOG("****** watch MOVE from %p\n",inFrom);
+ if (hxInWatchList(inTo))
+ GCLOG("****** watch MOVE to %p\n",inTo);
+ #endif
+ // FinalizerList will get visited...
+
+ hx::FinalizerMap::iterator i = hx::sFinalizerMap.find(inFrom);
+ if (i!=hx::sFinalizerMap.end())
+ {
+ hx::finalizer f = i->second;
+ hx::sFinalizerMap.erase(i);
+ hx::sFinalizerMap[inTo] = f;
+ }
+
+ hx::HaxeFinalizerMap::iterator h = hx::sHaxeFinalizerMap.find(inFrom);
+ if (h!=hx::sHaxeFinalizerMap.end())
+ {
+ hx::HaxeFinalizer f = h->second;
+ hx::sHaxeFinalizerMap.erase(h);
+ hx::sHaxeFinalizerMap[inTo] = f;
+ }
+
+ hx::MakeZombieSet::iterator mz = hx::sMakeZombieSet.find(inFrom);
+ if (mz!=hx::sMakeZombieSet.end())
+ {
+ hx::sMakeZombieSet.erase(mz);
+ hx::sMakeZombieSet.insert(inTo);
+ }
+
+ hx::ObjectIdMap::iterator id = hx::sObjectIdMap.find(inFrom);
+ if (id!=hx::sObjectIdMap.end())
+ {
+ hx::sIdObjectMap[id->second] = inTo;
+ hx::sObjectIdMap[inTo] = id->second;
+ hx::sObjectIdMap.erase(id);
+ }
+
+ // Maybe do something faster with weakmaps
+
+#ifdef HXCPP_TELEMETRY
+ //printf(" -- moving %018x to %018x, size %d\n", inFrom, inTo, size);
+ __hxt_gc_realloc(inFrom, inTo, size);
+#endif
+
+ }
+
+
+
+ bool MoveBlocks(MoveBlockJob &inJob,BlockDataStats &ioStats)
+ {
+ BlockData *dest = 0;
+ BlockDataInfo *destInfo = 0;
+ unsigned int *destStarts = 0;
+ int hole = -1;
+ int holes = 0;
+ int destPos = 0;
+ int destLen = 0;
+
+ int moveObjs = 0;
+ int clearedBlocks = 0;
+
+ while(true)
+ {
+ BlockDataInfo *from = inJob.getFrom();
+ if (!from)
+ break;
+ if (from->calcFragScore()>FRAG_THRESH)
+ ioStats.fraggedBlocks--;
+ ioStats.rowsInUse -= from->mUsedRows;
+ if (!from->isEmpty())
+ ioStats.emptyBlocks ++;
+
+ unsigned int *allocStart = from->allocStart;
+ #ifdef SHOW_MEM_EVENTS
+ //GCLOG("Move from %p (%d x %d)\n", from, from->mUsedRows, from->mHoles );
+ #endif
+
+ const unsigned char *rowMarked = from->mPtr->mRowMarked;
+ for(int r=IMMIX_HEADER_LINES;r<IMMIX_LINES;r++)
+ {
+ if (rowMarked[r])
+ {
+ unsigned int starts = allocStart[r];
+ if (!starts)
+ continue;
+ for(int i=0;i<32;i++)
+ {
+ if ( starts & (1<<i))
+ {
+ unsigned int *row = (unsigned int *)from->mPtr->mRow[r];
+ unsigned int &header = row[i];
+
+ if ((header&IMMIX_ALLOC_MARK_ID) == hx::gMarkID)
+ {
+ int size = ((header & IMMIX_ALLOC_SIZE_MASK) >> IMMIX_ALLOC_SIZE_SHIFT);
+ int allocSize = size + sizeof(int);
+
+ while(allocSize + ALIGN_PADDING(destPos)>destLen)
+ {
+ hole++;
+ if (hole<holes)
+ {
+ destPos = destInfo->mRanges[hole].start;
+ destLen = destInfo->mRanges[hole].length;
+ }
+ else
+ {
+ if (destInfo)
+ destInfo->makeFull();
+ do
+ {
+ destInfo = inJob.getTo();
+ if (!destInfo)
+ goto all_done;
+ } while(destInfo->mHoles==0);
+
+
+ ioStats.rowsInUse += IMMIX_USEFUL_LINES - destInfo->mUsedRows;
+ //destInfo->zero();
+ dest = destInfo->mPtr;
+ destStarts = destInfo->allocStart;
+
+ hole = 0;
+ holes = destInfo->mHoles;
+ destPos = destInfo->mRanges[hole].start;
+ destLen = destInfo->mRanges[hole].length;
+ }
+ }
+
+ #ifdef HXCPP_ALIGN_ALLOC
+ destPos += ALIGN_PADDING(destPos);
+ #endif
+
+ int startRow = destPos>>IMMIX_LINE_BITS;
+
+ destStarts[ startRow ] |= hx::gImmixStartFlag[destPos&127];
+
+ unsigned int *buffer = (unsigned int *)((char *)dest + destPos);
+
+ unsigned int headerPreserve = header & IMMIX_HEADER_PRESERVE;
+
+ int end = destPos + allocSize;
+
+ *buffer++ = (( (end+(IMMIX_LINE_LEN-1))>>IMMIX_LINE_BITS) -startRow) |
+ (size<<IMMIX_ALLOC_SIZE_SHIFT) |
+ headerPreserve |
+ hx::gMarkID;
+ destPos = end;
+ destLen -= allocSize;
+
+ unsigned int *src = row + i + 1;
+
+ MoveSpecial((hx::Object *)buffer,(hx::Object *)src, size);
+
+ // Result has moved - store movement in original position...
+ memcpy(buffer, src, size);
+ //GCLOG(" move %p -> %p %d (%08x %08x )\n", src, buffer, size, buffer[-1], buffer[1] );
+
+ *(unsigned int **)src = buffer;
+ header = IMMIX_OBJECT_HAS_MOVED;
+ moveObjs++;
+
+ starts &= ~(1<<i);
+ if (!starts)
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ all_done:
+ if (destInfo)
+ {
+ // Still have space, which means from finished.
+ destInfo->makeFull();
+ from->clear();
+ clearedBlocks++;
+ // Could remove some used rows from stats
+ }
+ else
+ {
+ // Partialy cleared, then ran out of to blocks - remove from allocation this round
+ if (from)
+ {
+ // Could maybe be a bit smarter here
+ ioStats.rowsInUse += from->mUsedRows;
+ from->makeFull();
+ }
+ }
+ }
+
+ #ifdef SHOW_FRAGMENTATION
+ GCLOG("Moved %d objects (%d/%d blocks)\n", moveObjs, clearedBlocks, mAllBlocks.size());
+ #endif
+
+ if (moveObjs)
+ {
+ AdjustPointers(0);
+ }
+
+
+ return moveObjs;
+ }
+
+ void AdjustPointers(hx::QuickVec<hx::Object *> *inRemembered)
+ {
+ class AdjustPointer : public hx::VisitContext
+ {
+ GlobalAllocator *mAlloc;
+ public:
+ AdjustPointer(GlobalAllocator *inAlloc) : mAlloc(inAlloc) { }
+
+ void visitObject(hx::Object **ioPtr)
+ {
+ if ( ((*(unsigned int **)ioPtr)[-1]) == IMMIX_OBJECT_HAS_MOVED )
+ {
+ //GCLOG(" patch object to %p -> %p\n", *ioPtr, (*(hx::Object ***)ioPtr)[0]);
+ *ioPtr = (*(hx::Object ***)ioPtr)[0];
+ //GCLOG(" %08x %08x ...\n", ((int *)(*ioPtr))[0], ((int *)(*ioPtr))[1] );
+ }
+ }
+
+ void visitAlloc(void **ioPtr)
+ {
+ if ( ((*(unsigned int **)ioPtr)[-1]) == IMMIX_OBJECT_HAS_MOVED )
+ {
+ //GCLOG(" patch reference to %p -> %p\n", *ioPtr, (*(void ***)ioPtr)[0]);
+ *ioPtr = (*(void ***)ioPtr)[0];
+ //GCLOG(" %08x %08x ...\n", ((int *)(*ioPtr))[0], ((int *)(*ioPtr))[1] );
+ }
+ }
+ };
+
+
+ AdjustPointer adjust(this);
+ VisitAll(&adjust,true, inRemembered);
+ }
+
+
+ #ifdef HXCPP_GC_GENERATIONAL
+ BlockDataInfo *getNextBlockWithoutSurvivors(int &ioPosition)
+ {
+ while(ioPosition<mAllBlocks.size())
+ {
+ BlockDataInfo *b = mAllBlocks[ioPosition++];
+ if (b->mHoles>0 && !b->mHasSurvivor)
+ return b;
+ }
+ return 0;
+ }
+
+
+
+ int MoveSurvivors(hx::QuickVec<hx::Object *> *inRemembered)
+ {
+ int sourceScan = 0;
+ int destScan = 0;
+ int moveObjs = 0;
+ int clearedBlocks = 0;
+
+ BlockDataInfo *destInfo = 0;
+ BlockData *dest = 0;
+ int destHole = 0;
+ int destPos = 0;
+ int destLen = 0;
+ unsigned int *destStarts = 0;
+
+ BlockDataInfo *from = 0;
+
+ int tested = 0;
+
+ int all = mAllBlocks.size();
+ for(int srcBlock=0; srcBlock<all; srcBlock++)
+ {
+ from = mAllBlocks[srcBlock];
+ if (from->mPinned || !from->mHasSurvivor)
+ {
+ from = 0;
+ continue;
+ }
+ tested++;
+ unsigned int *srcStart = from->allocStart;
+
+ // Scan nursery for survivors
+ for(int hole = 0; hole<from->mHoles; hole++)
+ {
+ int start = from->mRanges[hole].start;
+ int len = from->mRanges[hole].length;
+ int startRow = start >> IMMIX_LINE_BITS;
+ int end = startRow + (len >> IMMIX_LINE_BITS);
+ for(int r = startRow; r<end;r++)
+ {
+ unsigned int &startFlags = srcStart[r];
+ if (startFlags)
+ {
+ for(int loc=0;loc<32;loc++)
+ if (startFlags & (1<<loc))
+ {
+ unsigned int *row = (unsigned int *)from->mPtr->mRow[r];
+ unsigned int &header = row[loc];
+
+ if ((header&IMMIX_ALLOC_MARK_ID) == hx::gMarkID)
+ {
+ int size = ((header & IMMIX_ALLOC_SIZE_MASK) >> IMMIX_ALLOC_SIZE_SHIFT);
+ int allocSize = size + sizeof(int);
+
+ // Find dest reqion ...
+ while(destHole==0 || destLen < ALIGN_PADDING(destPos) + allocSize)
+ {
+ if (destHole==0)
+ {
+ if (destInfo)
+ destInfo->makeFull();
+ destInfo = getNextBlockWithoutSurvivors(destScan);
+ if (!destInfo)
+ goto no_more_moves;
+
+ destHole = -1;
+ destLen = 0;
+ }
+ if (destLen + ALIGN_PADDING(0)<allocSize)
+ {
+ destHole++;
+ if (destHole>=destInfo->mHoles)
+ destHole = 0;
+ else
+ {
+ dest = destInfo->mPtr;
+ destPos = destInfo->mRanges[destHole].start;
+ destLen = destInfo->mRanges[destHole].length;
+ destStarts = destInfo->allocStart;
+ }
+ }
+ }
+
+ // TODO - not copy + paste
+
+ printf("Move!\n");
+ #ifdef HXCPP_ALIGN_ALLOC
+ destPos += ALIGN_PADDING(destPos);
+ #endif
+
+ int startRow = destPos>>IMMIX_LINE_BITS;
+
+ destStarts[ startRow ] |= hx::gImmixStartFlag[destPos&127];
+
+ unsigned int *buffer = (unsigned int *)((char *)dest + destPos);
+
+ unsigned int headerPreserve = header & IMMIX_HEADER_PRESERVE;
+
+ int end = destPos + allocSize;
+
+ *buffer++ = (( (end+(IMMIX_LINE_LEN-1))>>IMMIX_LINE_BITS) -startRow) |
+ (size<<IMMIX_ALLOC_SIZE_SHIFT) |
+ headerPreserve |
+ hx::gMarkID;
+ destPos = end;
+ destLen -= allocSize;
+
+ unsigned int *src = row + loc + 1;
+
+ MoveSpecial((hx::Object *)buffer,(hx::Object *)src, size);
+
+ // Result has moved - store movement in original position...
+ memcpy(buffer, src, size);
+ //GCLOG(" move %p -> %p %d (%08x %08x )\n", src, buffer, size, buffer[-1], buffer[1] );
+
+ *(unsigned int **)src = buffer;
+ header = IMMIX_OBJECT_HAS_MOVED;
+ moveObjs++;
+
+ startFlags &= ~(1<<loc);
+ if (!startFlags)
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ no_more_moves:
+ if (destInfo)
+ {
+ destInfo->makeFull();
+ clearedBlocks++;
+ }
+ else
+ {
+ // Partialy cleared, then ran out of to blocks - remove from allocation this round
+ if (from && moveObjs)
+ {
+ // Could maybe be a bit smarter here
+ //ioStats.rowsInUse += from->mUsedRows;
+ from->makeFull();
+ }
+ }
+ }
+
+ #ifdef SHOW_FRAGMENTATION
+ //GCLOG("Compacted nursery %d objects (%d/%d blocks)\n", moveObjs, clearedBlocks, mAllBlocks.size());
+ #endif
+
+ if (moveObjs)
+ {
+ AdjustPointers(inRemembered);
+ }
+
+ return moveObjs;
+ }
+ #endif
+
+ int releaseEmptyGroups(BlockDataStats &outStats, size_t releaseSize)
+ {
+ int released=0;
+ int groups=0;
+ for(int i=0; i<mAllBlocks.size(); i++ )
+ {
+ if (!mAllBlocks[i]->isEmpty())
+ gAllocGroups[mAllBlocks[i]->mGroupId].isEmpty=false;
+ }
+
+ #ifdef HXCPP_GC_VERIFY
+ typedef std::pair< void *, void * > ReleasedRange;
+ std::vector<ReleasedRange> releasedRange;
+ std::vector<int> releasedGids;
+ #endif
+
+ for(int i=0;i<gAllocGroups.size();i++)
+ {
+ GroupInfo &g = gAllocGroups[i];
+ if (g.alloc && g.isEmpty && !g.pinned)
+ {
+ size_t groupBytes = g.blocks << (IMMIX_BLOCK_BITS);
+
+ #ifdef SHOW_MEM_EVENTS_VERBOSE
+ GCLOG("Release group %d: %p -> %p\n", i, g.alloc, g.alloc+groupBytes);
+ #endif
+ #ifdef HXCPP_GC_VERIFY
+ releasedRange.push_back( ReleasedRange(g.alloc, g.alloc+groupBytes) );
+ releasedGids.push_back(i);
+ #endif
+
+ HxFreeGCBlock(g.alloc);
+ g.alloc = 0;
+
+ groups++;
+
+ if (groupBytes > releaseSize)
+ break;
+
+ releaseSize -= groupBytes;
+ }
+ }
+
+ // Release blocks
+ for(int i=0; i<mAllBlocks.size(); )
+ {
+ if (!gAllocGroups[mAllBlocks[i]->mGroupId].alloc)
+ {
+ outStats.emptyBlocks--;
+ released++;
+ mAllBlocks[i]->destroy();
+ mAllBlocks.erase(i);
+ }
+ else
+ {
+ #ifdef HXCPP_GC_VERIFY
+ for(int g=0;g<releasedGids.size();g++)
+ if (mAllBlocks[i]->mGroupId == releasedGids[g])
+ {
+ printf("Group %d should be released.\n", mAllBlocks[i]->mGroupId);
+ DebuggerTrap();
+ }
+ #endif
+ i++;
+ }
+ }
+
+ #ifdef HXCPP_GC_VERIFY
+ for(int i=0;i<mAllBlocks.size();i++)
+ {
+ BlockDataInfo *info = mAllBlocks[i];
+ void *ptr = info->mPtr;
+ for(int r=0;r<releasedRange.size();r++)
+ if ( ptr>=releasedRange[r].first && ptr<releasedRange[r].second )
+ {
+ printf("Released block %p(%d:%p) still in list\n", info, info->mId, info->mPtr );
+ DebuggerTrap();
+ }
+ }
+
+ VerifyBlockOrder();
+ #endif
+
+
+ #if defined(SHOW_MEM_EVENTS) || defined(SHOW_FRAGMENTATION)
+ GCLOG("Release %d blocks, %d groups, %s\n", released, groups, formatBytes((size_t)released<<(IMMIX_BLOCK_BITS)).c_str());
+ #endif
+ return released;
+ }
+
+
+ void calcMoveOrder()
+ {
+ for(int i=0;i<gAllocGroups.size();i++)
+ gAllocGroups[i].clear();
+
+ for(int i=0; i<mAllBlocks.size(); i++ )
+ {
+ BlockDataInfo &block = *mAllBlocks[i];
+ GroupInfo &g = gAllocGroups[block.mGroupId];
+ if (block.mPinned)
+ g.pinned = true;
+ g.usedBytes += block.mUsedBytes;
+ g.usedSpace += block.mUsedRows<<IMMIX_LINE_BITS;
+ }
+
+ for(int i=0; i<mAllBlocks.size(); i++ )
+ {
+ BlockDataInfo &block = *mAllBlocks[i];
+ GroupInfo &g = gAllocGroups[block.mGroupId];
+ // Base on group wasted space (when not pinned)
+ block.mMoveScore = g.getMoveScore();
+ }
+ }
+
+ #endif // } defined(HXCPP_VISIT_ALLOCS)
+
+ void *GetIDObject(int inIndex)
+ {
+ AutoLock lock(*gSpecialObjectLock);
+ if (inIndex<0 || inIndex>hx::sIdObjectMap.size())
+ return 0;
+ return hx::sIdObjectMap[inIndex];
+ }
+
+ int GetObjectID(void * inPtr)
+ {
+ AutoLock lock(*gSpecialObjectLock);
+ hx::ObjectIdMap::iterator i = hx::sObjectIdMap.find( (hx::Object *)inPtr );
+ if (i!=hx::sObjectIdMap.end())
+ return i->second;
+
+ int id = 0;
+ if (hx::sFreeObjectIds.size()>0)
+ {
+ id = hx::sFreeObjectIds.pop();
+ }
+ else
+ {
+ id = hx::sObjectIdMap.size();
+ hx::sIdObjectMap.push(0);
+ }
+ hx::sObjectIdMap[(hx::Object *)inPtr] = id;
+ hx::sIdObjectMap[id] = (hx::Object *)inPtr;
+ return id;
+ }
+
+
+ void ClearRowMarks()
+ {
+ for(int i=0;i<mAllBlocks.size();i++)
+ mAllBlocks[i]->clearRowMarks();
+ }
+
+
+ void ClearBlockMarks()
+ {
+ for(int i=0;i<mAllBlocks.size();i++)
+ mAllBlocks[i]->clearBlockMarks();
+ }
+
+ #ifdef HXCPP_VISIT_ALLOCS
+ void VisitAll(hx::VisitContext *inCtx,bool inMultithread = false,hx::QuickVec<hx::Object *> *inRemembered = 0)
+ {
+ if (inRemembered)
+ {
+ int n = inRemembered->size();
+ for(int i=0;i<n;i++)
+ (*inRemembered)[i]->__Visit(inCtx);
+ }
+ else if (MAX_GC_THREADS>1 && inMultithread && mAllBlocks.size())
+ {
+ sThreadVisitContext = inCtx;
+ StartThreadJobs(tpjVisitBlocks, mAllBlocks.size(), true);
+ sThreadVisitContext = 0;
+ }
+ else
+ for(int i=0;i<mAllBlocks.size();i++)
+ mAllBlocks[i]->VisitBlock(inCtx);
+
+ for(int i=0;i<mLocalAllocs.size();i++)
+ VisitLocalAlloc(mLocalAllocs[i], inCtx);
+
+ hx::VisitClassStatics(inCtx);
+
+ for(hx::RootSet::iterator i = hx::sgRootSet.begin(); i!=hx::sgRootSet.end(); ++i)
+ {
+ hx::Object **obj = *i;
+ if (*obj)
+ inCtx->visitObject(obj);
+ }
+
+
+ if (hx::sgOffsetRootSet)
+ for(hx::OffsetRootSet::iterator i = hx::sgOffsetRootSet->begin(); i!=hx::sgOffsetRootSet->end(); ++i)
+ {
+ char *ptr = *(char **)(i->first);
+ int offset = i->second;
+ hx::Object *obj = (hx::Object *)(ptr - offset);
+
+ if (obj)
+ {
+ hx::Object *obj0 = obj;
+ inCtx->visitObject(&obj);
+ if (obj!=obj0)
+ *(char **)(i->first) = (char *)(obj) + offset;
+ }
+ }
+
+ if (hx::sgFinalizers)
+ for(int i=0;i<hx::sgFinalizers->size();i++)
+ (*hx::sgFinalizers)[i]->Visit(inCtx);
+
+ for(int i=0;i<hx::sFinalizableList.size();i++)
+ inCtx->visitAlloc( &hx::sFinalizableList[i].base );
+
+ for(int i=0;i<hx::sZombieList.size();i++)
+ inCtx->visitObject( &hx::sZombieList[i] );
+
+ for(int i=0;i<hx::sWeakRefs.size(); i++)
+ inCtx->visitObject( (hx::Object **) &hx::sWeakRefs[i] );
+
+ for(int i=0;i<hx::sWeakHashList.size();i++)
+ inCtx->visitObject( (hx::Object **) &hx::sWeakHashList[i] );
+
+ }
+
+ #endif
+
+ void ReclaimAsync(BlockDataStats &outStats)
+ {
+ while(!sgThreadPoolAbort)
+ {
+ int blockId = _hx_atomic_add(&mThreadJobId, 1);
+ if (blockId>=mAllBlocks.size())
+ break;
+
+ if ( sgThreadPoolJob==tpjReclaimFull)
+ mAllBlocks[blockId]->reclaim<true>(&outStats);
+ else
+ mAllBlocks[blockId]->reclaim<false>(&outStats);
+ }
+ }
+
+ void CountAsync(BlockDataStats &outStats)
+ {
+ while(!sgThreadPoolAbort)
+ {
+ int blockId = _hx_atomic_add(&mThreadJobId, 1);
+ if (blockId>=mAllBlocks.size())
+ break;
+
+ mAllBlocks[blockId]->countRows(outStats);
+ }
+ }
+
+
+ void GetStatsAsync(BlockDataStats &outStats)
+ {
+ while(!sgThreadPoolAbort)
+ {
+ int blockId = _hx_atomic_add(&mThreadJobId, 1);
+ if (blockId>=mAllBlocks.size())
+ break;
+
+ mAllBlocks[blockId]->getStats( outStats );
+ }
+ }
+
+
+
+ #ifdef HXCPP_VISIT_ALLOCS
+ void VisitBlockAsync(hx::VisitContext *inCtx)
+ {
+ while(!sgThreadPoolAbort)
+ {
+ int blockId = _hx_atomic_add(&mThreadJobId, 1);
+ if (blockId>=mAllBlocks.size())
+ break;
+
+ mAllBlocks[blockId]->VisitBlock(inCtx);
+ }
+ }
+ #endif
+
+
+ void ZeroAsync()
+ {
+ while(!sgThreadPoolAbort)
+ {
+ int zeroListId = _hx_atomic_add(&mThreadJobId, 1);
+ if (zeroListId>=mZeroList.size())
+ break;
+
+ BlockDataInfo *info = mZeroList[zeroListId];
+ info->tryZero();
+ }
+ }
+
+ bool ZeroAsyncJit()
+ {
+ int spinCount = 0;
+ while(!sgThreadPoolAbort)
+ {
+ if (mZeroListQueue>=sMaxZeroQueueSize)
+ {
+ spinCount++;
+ if (spinCount<10000)
+ // Spin
+ continue;
+ // Full for now, so sleep...
+ return true;
+ }
+ spinCount = 0;
+
+ // Look at next block...
+ int zeroListId = _hx_atomic_add(&mThreadJobId, 1);
+ if (zeroListId>=mZeroList.size())
+ {
+ // Done, so sleep...
+ return true;
+ }
+
+ BlockDataInfo *info = mZeroList[zeroListId];
+ if (info->tryZero())
+ {
+ // We zeroed it, so increase queue count
+ _hx_atomic_add(&mZeroListQueue, 1);
+ #ifdef PROFILE_THREAD_USAGE
+ sThreadBlockZeroCount++;
+ #endif
+ }
+ }
+
+ return true;
+ }
+
+ // Try to maintain between sMinZeroQueueSize and sMaxZeroQueueSize pre-zeroed blocks
+ void onZeroedBlockDequeued()
+ {
+ // Wake the thread?
+ if (_hx_atomic_sub(&mZeroListQueue, 1)<sMinZeroQueueSize && !sRunningThreads)
+ {
+ if (mZeroListQueue + mThreadJobId < mZeroList.size())
+ {
+ // Wake zeroing thread
+ ThreadPoolAutoLock l(sThreadPoolLock);
+ if (!(sRunningThreads & 0x01))
+ {
+ #ifdef PROFILE_THREAD_USAGE
+ sThreadZeroPokes++;
+ #endif
+ wakeThreadLocked(0);
+ }
+ }
+ }
+ }
+
+
+ void finishThreadJob(int inId)
+ {
+ ThreadPoolAutoLock l(sThreadPoolLock);
+ if (sRunningThreads & (1<<inId))
+ {
+ sRunningThreads &= ~(1<<inId);
+ sLazyThreads = sRunningThreads != sAllThreads;
+
+ if (!sRunningThreads)
+ SignalThreadPool(sThreadJobDone,sThreadJobDoneSleeping);
+ }
+ else
+ {
+ printf("Finishe non-runnning thread?\n");
+ DebuggerTrap();
+ }
+ }
+
+ void waitForThreadWake(int inId)
+ {
+ #ifdef HX_GC_PTHREADS
+ {
+ ThreadPoolAutoLock l(sThreadPoolLock);
+ int count = 0;
+
+ // May be woken multiple times if sRunningThreads is set to 0 then 1 before we sleep
+ sThreadSleeping[inId] = true;
+ // Spurious wake?
+ while( !(sRunningThreads & (1<<inId) ) )
+ WaitThreadLocked(sThreadWake[inId]);
+ sThreadSleeping[inId] = false;
+ }
+ #else
+ while( !(sRunningThreads & (1<<inId) ) )
+ sThreadWake[inId].Wait();
+ #endif
+ }
+
+
+ void ThreadLoop(int inId)
+ {
+ hx::MarkContext context(inId);
+
+ while(true)
+ {
+ waitForThreadWake(inId);
+
+ #ifdef HXCPP_GC_VERIFY
+ if (! (sRunningThreads & (1<<inId)) )
+ printf("Bad running threads!\n");
+ #endif
+
+ if (sgThreadPoolJob==tpjMark)
+ {
+ context.processMarkStack();
+ }
+ else if (sgThreadPoolJob==tpjAsyncZeroJit)
+ {
+ #ifdef PROFILE_THREAD_USAGE
+ sThreadZeroWaits++;
+ #endif
+ if (ZeroAsyncJit())
+ finishThreadJob(inId);
+ }
+ else
+ {
+ if (sgThreadPoolJob==tpjReclaimFull || sgThreadPoolJob==tpjReclaim)
+ ReclaimAsync(sThreadBlockDataStats[inId]);
+
+ else if (sgThreadPoolJob==tpjCountRows)
+ CountAsync(sThreadBlockDataStats[inId]);
+
+ else if (sgThreadPoolJob==tpjGetStats)
+ GetStatsAsync(sThreadBlockDataStats[inId]);
+
+ #ifdef HXCPP_VISIT_ALLOCS
+ else if (sgThreadPoolJob==tpjVisitBlocks)
+ VisitBlockAsync(sThreadVisitContext);
+ #endif
+
+ else if (sgThreadPoolJob==tpjAsyncZero)
+ ZeroAsync();
+
+ finishThreadJob(inId);
+ }
+ }
+ }
+
+ static THREAD_FUNC_TYPE SThreadLoop( void *inInfo )
+ {
+ sGlobalAlloc->ThreadLoop((int)(size_t)inInfo);
+ THREAD_FUNC_RET;
+ }
+
+ void CreateWorker(int inId)
+ {
+ void *info = (void *)(size_t)inId;
+
+ #ifdef HX_GC_PTHREADS
+ pthread_cond_init(&sThreadWake[inId],0);
+ sThreadSleeping[inId] = false;
+ if (inId==0)
+ pthread_cond_init(&sThreadJobDone,0);
+
+ pthread_t result = 0;
+ int created = pthread_create(&result,0,SThreadLoop,info);
+ bool ok = created==0;
+ #elif defined(EMSCRIPTEN)
+ // Only one thread
+ #else
+ bool ok = HxCreateDetachedThread(SThreadLoop, info);
+ #endif
+ }
+
+ void StopThreadJobs(bool inKill)
+ {
+ bool maybeExtraWake = false;
+
+ if (sAllThreads)
+ {
+ if (inKill)
+ {
+ sgThreadPoolAbort = true;
+ if (sgThreadPoolJob==tpjAsyncZeroJit)
+ {
+ ThreadPoolAutoLock l(sThreadPoolLock);
+ // Thread will be waiting, but not finished
+ if (sRunningThreads & 0x1)
+ {
+ sgThreadPoolJob = tpjNone;
+ maybeExtraWake = true;
+ wakeThreadLocked(0);
+ }
+ }
+ }
+
+
+ #ifdef HX_GC_PTHREADS
+ ThreadPoolAutoLock lock(sThreadPoolLock);
+ sThreadJobDoneSleeping = true;
+ while(sRunningThreads)
+ WaitThreadLocked(sThreadJobDone);
+ sThreadJobDoneSleeping = false;
+ #else
+ while(sRunningThreads)
+ sThreadJobDone.Wait();
+ #endif
+ sgThreadPoolAbort = false;
+ sAllThreads = 0;
+ sgThreadPoolJob = tpjNone;
+ sLazyThreads = 0;
+ }
+ }
+
+
+ void StartThreadJobs(ThreadPoolJob inJob, int inWorkers, bool inWait, int inThreadLimit = -1)
+ {
+ mThreadJobId = 0;
+
+ if (!inWorkers)
+ return;
+
+ if (!sThreadPoolInit)
+ {
+ sThreadPoolInit = true;
+ for(int i=0;i<MAX_GC_THREADS;i++)
+ CreateWorker(i);
+ }
+
+ #ifdef HX_GC_PTHREADS
+ ThreadPoolAutoLock lock(sThreadPoolLock);
+ #endif
+
+
+ sgThreadPoolJob = inJob;
+
+ sgThreadCount = inThreadLimit<0 ? MAX_GC_THREADS : std::min((int)MAX_GC_THREADS, inThreadLimit) ;
+
+ int start = std::min(inWorkers, sgThreadCount );
+
+ sAllThreads = (1<<sgThreadCount) - 1;
+
+ sRunningThreads = (1<<start) - 1;
+
+ sLazyThreads = sRunningThreads != sAllThreads;
+
+ for(int i=0;i<start;i++)
+ SignalThreadPool(sThreadWake[i],sThreadSleeping[i]);
+
+ if (inWait)
+ {
+ // Join the workers...
+ #ifdef HX_GC_PTHREADS
+ sThreadJobDoneSleeping = true;
+ while(sRunningThreads)
+ WaitThreadLocked(sThreadJobDone);
+ sThreadJobDoneSleeping = false;
+ #else
+ while(sRunningThreads)
+ sThreadJobDone.Wait();
+ #endif
+
+ sAllThreads = 0;
+ sgThreadPoolJob = tpjNone;
+ sLazyThreads = 0;
+
+ if (sRunningThreads)
+ {
+ printf("Bad thread stop %d\n", sRunningThreads);
+ DebuggerTrap();
+ }
+ }
+ }
+
+
+ #if defined(SHOW_FRAGMENTATION) || defined(SHOW_MEM_EVENTS)
+ std::string formatBytes(size_t bytes)
+ {
+ size_t k = 1<<10;
+ size_t meg = 1<<20;
+
+ char strBuf[100];
+ if (bytes<k)
+ snprintf(strBuf,sizeof(strBuf),"%d", (int)bytes);
+ else if (bytes<meg)
+ snprintf(strBuf,sizeof(strBuf),"%.2fk", (double)bytes/k);
+ else
+ snprintf(strBuf,sizeof(strBuf),"%.2fmb", (double)bytes/meg);
+ return strBuf;
+ }
+ #endif
+
+
+ double tMarkInit;
+ double tMarkLocal;
+ double tMarkLocalEnd;
+ double tMarked;
+ void MarkAll(bool inGenerational)
+ {
+ if (!inGenerational)
+ {
+ hx::gPrevByteMarkID = hx::gByteMarkID;
+
+ // The most-significant header byte looks like:
+ // C nH Odd Even c c c c
+ // C = "is const alloc bit" - in this case Odd and Even will be false
+ // nH = non-hashed const string bit
+ // Odd = true if cycle is odd
+ // Even = true if cycle is even
+ // c c c c = 4 bit cycle code
+ //
+ hx::gPrevMarkIdMask = ((~hx::gMarkID) & 0x30000000) | HX_GC_CONST_ALLOC_BIT;
+
+ // 4 bits of cycle
+ gByteMarkID = (gByteMarkID + 1) & 0x0f;
+ if (gByteMarkID & 0x1)
+ gByteMarkID |= 0x20;
+ else
+ gByteMarkID |= 0x10;
+
+ hx::gMarkID = gByteMarkID << 24;
+ hx::gMarkIDWithContainer = (gByteMarkID << 24) | IMMIX_ALLOC_IS_CONTAINER;
+ gRememberedByteMarkID = gByteMarkID | HX_GC_REMEMBERED;
+
+ #ifdef HX_WATCH
+ GCLOG(" non-gen mark byte -> %02x\n", hx::gByteMarkID);
+ #endif
+ gBlockStack = 0;
+
+ ClearRowMarks();
+ }
+ else
+ {
+ #ifdef HX_WATCH
+ GCLOG(" generational mark byte -> %02x\n", hx::gByteMarkID);
+ #endif
+ ClearBlockMarks();
+ }
+
+ MEM_STAMP(tMarkInit);
+
+ #ifdef PROFILE_THREAD_USAGE
+ for(int i=-1;i<MAX_GC_THREADS;i++)
+ sThreadChunkPushCount = sThreadChunkWakes = sThreadMarkCount[i] = sThreadArrayMarkCount[i] = 0;
+ #endif
+
+
+
+ mMarker.init();
+
+ hx::MarkClassStatics(&mMarker);
+
+ {
+ hx::AutoMarkPush info(&mMarker,"Roots","root");
+
+ for(hx::RootSet::iterator i = hx::sgRootSet.begin(); i!=hx::sgRootSet.end(); ++i)
+ {
+ hx::Object *&obj = **i;
+ if (obj)
+ hx::MarkObjectAlloc(obj , &mMarker );
+ }
+
+ if (hx::sgOffsetRootSet)
+ for(hx::OffsetRootSet::iterator i = hx::sgOffsetRootSet->begin(); i!=hx::sgOffsetRootSet->end(); ++i)
+ {
+ char *ptr = *(char **)(i->first);
+ int offset = i->second;
+ hx::Object *obj = (hx::Object *)(ptr - offset);
+
+ if (obj)
+ hx::MarkObjectAlloc(obj , &mMarker );
+ }
+ } // automark
+
+ #ifdef PROFILE_COLLECT
+ hx::rootObjects = sObjectMarks;
+ hx::rootAllocs = sAllocMarks;
+ #endif
+
+
+ {
+ hx::AutoMarkPush info(&mMarker,"Zombies","zombie");
+ // Mark zombies too....
+ for(int i=0;i<hx::sZombieList.size();i++)
+ hx::MarkObjectAlloc(hx::sZombieList[i] , &mMarker );
+ } // automark
+
+ MEM_STAMP(tMarkLocal);
+ hx::localCount = 0;
+
+ mMarker.isGenerational = inGenerational;
+
+ // Mark local stacks
+ for(int i=0;i<mLocalAllocs.size();i++)
+ MarkLocalAlloc(mLocalAllocs[i] , &mMarker);
+
+ #ifdef PROFILE_COLLECT
+ hx::localObjects = sObjectMarks;
+ hx::localAllocs = sAllocMarks;
+ #endif
+
+ MEM_STAMP(tMarkLocalEnd);
+
+ #ifdef HX_MULTI_THREAD_MARKING
+ mMarker.releaseJobs();
+
+ // Unleash the workers...
+ StartThreadJobs(tpjMark, MAX_GC_THREADS, true);
+ #else
+ mMarker.processMarkStack();
+ #endif
+
+
+
+ MEM_STAMP(tMarked);
+
+ hx::FindZombies(mMarker);
+
+ hx::RunFinalizers();
+
+ #ifdef HXCPP_GC_VERIFY
+ for(int i=0;i<mAllBlocks.size();i++)
+ mAllBlocks[i]->verify("After mark");
+ #endif
+
+ #ifdef HX_WATCH
+ for(void **watch = hxWatchList; *watch; watch++)
+ {
+ GCLOG("********* Watch mark : %p %08x\n",*watch, ((unsigned int *)*watch)[-1]);
+ GCLOG(" ******** is marked : %d\n", (((unsigned char *)(*watch))[HX_ENDIAN_MARK_ID_BYTE]== gByteMarkID));
+ }
+ #endif
+ }
+
+
+
+ #ifdef HX_GC_VERIFY_ALLOC_START
+ void verifyAllocStart()
+ {
+ for(int i=1;i<mAllBlocks.size();i++)
+ mAllBlocks[i]->verifyAllocStart();
+ }
+ #endif
+
+ #ifdef HXCPP_GC_VERIFY
+ void VerifyBlockOrder()
+ {
+ for(int i=1;i<mAllBlocks.size();i++)
+ {
+ if ( mAllBlocks[i-1]->mPtr >= mAllBlocks[i]->mPtr)
+ {
+ printf("Bad block order block[%d]=%p >= block[%d]=%p / %d\n", i-1, mAllBlocks[i-1]->mPtr,
+ i, mAllBlocks[i]->mPtr, mAllBlocks.size() );
+ DebuggerTrap();
+ }
+ }
+ }
+ #endif
+
+ void Collect(bool inMajor, bool inForceCompact, bool inLocked,bool inFreeIsFragged)
+ {
+ PROFILE_COLLECT_SUMMARY_START;
+
+ #ifndef HXCPP_SINGLE_THREADED_APP
+ // If we set the flag from 0 -> 0xffffffff then we are the collector
+ // otherwise, someone else is collecting at the moment - so wait...
+ if (_hx_atomic_compare_exchange((volatile int *)&hx::gPauseForCollect, 0, 0xffffffff) != 0)
+ {
+ if (inLocked)
+ {
+ gThreadStateChangeLock->Unlock();
+
+ hx::PauseForCollect();
+
+ hx::EnterGCFreeZone();
+ gThreadStateChangeLock->Lock();
+ hx::ExitGCFreeZoneLocked();
+ }
+ else
+ {
+ hx::PauseForCollect();
+ }
+ return;
+ }
+ #endif
+
+ STAMP(t0)
+
+ // We are the collector - all must wait for us
+ LocalAllocator *this_local = 0;
+ #ifndef HXCPP_SINGLE_THREADED_APP
+ this_local = (LocalAllocator *)(hx::ImmixAllocator *)hx::tlsStackContext;
+
+ if (!inLocked)
+ gThreadStateChangeLock->Lock();
+
+ for(int i=0;i<mLocalAllocs.size();i++)
+ if (mLocalAllocs[i]!=this_local)
+ WaitForSafe(mLocalAllocs[i]);
+ #endif
+
+ sgIsCollecting = true;
+
+ StopThreadJobs(true);
+ #ifdef HXCPP_DEBUG
+ sgAllocsSinceLastSpam = 0;
+ #endif
+
+ HX_STACK_FRAME("GC", "collect", 0, "GC::collect", __FILE__, __LINE__,0)
+ #ifdef SHOW_MEM_EVENTS
+ int here = 0;
+ GCLOG("=== Collect === %p\n",&here);
+ #endif
+
+
+ #ifdef PROFILE_THREAD_USAGE
+ GCLOG("Thread zero waits %d/%d/%d, misses=%d, hits=%d\n", sThreadZeroPokes, sThreadZeroWaits, mFreeBlocks.size(), sThreadZeroMisses, sThreadBlockZeroCount);
+ sThreadZeroWaits = 0;
+ sThreadZeroPokes = 0;
+ sThreadZeroMisses = 0;
+ sThreadBlockZeroCount = 0;
+ #endif
+
+
+
+ #ifdef HXCPP_TELEMETRY
+ __hxt_gc_start();
+ #endif
+
+ size_t freeFraggedRows = 0;
+ if (inFreeIsFragged)
+ {
+ for(int i=mNextFreeBlockOfSize[0]; i<mFreeBlocks.size(); i++)
+ freeFraggedRows += mFreeBlocks[i]->GetFreeRows();
+ }
+
+ // Now all threads have mTopOfStack & mBottomOfStack set.
+ bool generational = false;
+
+ #ifdef HXCPP_GC_GENERATIONAL
+ bool compactSurviors = false;
+
+ if (sGcMode==gcmGenerational)
+ {
+ for(int i=0;i<mLocalAllocs.size();i++)
+ {
+ hx::StackContext *ctx = (hx::StackContext *)mLocalAllocs[i];
+ if( ctx->mOldReferrers->count )
+ hx::sGlobalChunks.addLocked( ctx->mOldReferrers );
+ else
+ hx::sGlobalChunks.free( ctx->mOldReferrers );
+ ctx->mOldReferrers = 0;
+ }
+ }
+
+ hx::QuickVec<hx::Object *> rememberedSet;
+ generational = !inMajor && !inForceCompact && sGcMode == gcmGenerational;
+ if (sGcMode==gcmGenerational)
+ {
+ hx::sGlobalChunks.copyPointers(rememberedSet,!generational);
+ #ifdef SHOW_MEM_EVENTS
+ GCLOG("Patch remembered set marks %d\n", rememberedSet.size());
+ #endif
+ for(int i=0;i<rememberedSet.size();i++)
+ ((unsigned char *)rememberedSet[i])[HX_ENDIAN_MARK_ID_BYTE] = gByteMarkID;
+ }
+ #endif
+
+ STAMP(t1)
+
+ MarkAll(generational);
+
+ #ifdef HX_GC_VERIFY_GENERATIONAL
+ {
+ #ifdef SHOW_MEM_EVENTS
+ GCLOG("verify generational [\n");
+ #endif
+ sGcVerifyGenerational = true;
+ sgTimeToNextTableUpdate--;
+ MarkAll(false);
+ sGcVerifyGenerational = false;
+ #ifdef SHOW_MEM_EVENTS
+ GCLOG("] verify generational\n");
+ #endif
+ }
+ #endif
+
+ STAMP(t2)
+
+
+ // Sweep blocks
+
+ // Update table entries? This needs to be done before the gMarkID count clocks
+ // back to the same number
+ if (!generational)
+ sgTimeToNextTableUpdate--;
+
+ bool full = inMajor || (sgTimeToNextTableUpdate<=0) || inForceCompact;
+
+ // Setup memory target ...
+ // Count free rows, and prep blocks for sorting
+ BlockDataStats stats;
+
+ /*
+ This reduces the stall time, but adds a bit of background cpu usage
+ Might be good to just countRows for non-generational too
+ */
+ if (!full && generational)
+ {
+ countRows(stats);
+ size_t currentRows = stats.rowsInUse + stats.fraggedRows + freeFraggedRows;
+ double filled = (double)(currentRows) / (double)(mAllBlocks.size()*IMMIX_USEFUL_LINES);
+ if (filled>0.85)
+ {
+ // Failure of generational estimation
+ int retained = currentRows - mRowsInUse;
+ int space = mAllBlocks.size()*IMMIX_USEFUL_LINES - mRowsInUse;
+ if (space<retained)
+ space = retained;
+ if (space<1)
+ space = 1;
+ mGenerationalRetainEstimate = (double)retained/(double)space;
+ #ifdef SHOW_MEM_EVENTS
+ GCLOG("Generational retention/fragmentation too high %f, do normal collect\n", mGenerationalRetainEstimate);
+ #endif
+
+ #ifdef HX_GC_VERIFY_ALLOC_START
+ verifyAllocStart();
+ #endif
+
+ generational = false;
+ MarkAll(generational);
+
+ sgTimeToNextTableUpdate--;
+ full = sgTimeToNextTableUpdate<=0;
+
+ stats.clear();
+ reclaimBlocks(full,stats);
+ }
+ }
+ else
+ {
+ reclaimBlocks(full,stats);
+ }
+
+
+ #ifdef HXCPP_GC_GENERATIONAL
+ if (compactSurviors)
+ {
+ MoveSurvivors(&rememberedSet);
+ }
+ #endif
+
+
+ #ifdef HXCPP_GC_MOVING
+ if (!full)
+ {
+ double useRatio = (double)(mRowsInUse<<IMMIX_LINE_BITS) / (sWorkingMemorySize);
+ #if defined(SHOW_FRAGMENTATION) || defined(SHOW_MEM_EVENTS)
+ GCLOG("Row use ratio:%f\n", useRatio);
+ #endif
+ // Could be either expanding, or fragmented...
+ if (useRatio>0.75)
+ {
+ #if defined(SHOW_FRAGMENTATION) || defined(SHOW_MEM_EVENTS)
+ GCLOG("Do full stats\n", useRatio);
+ #endif
+ full = true;
+ stats.clear();
+ reclaimBlocks(full,stats);
+ }
+ }
+ #endif
+
+ if (full)
+ {
+ #ifdef HXCPP_GC_MOVING
+ sgTimeToNextTableUpdate = 7;
+ #else
+ sgTimeToNextTableUpdate = 15;
+ #endif
+ }
+
+ size_t oldRowsInUse = mRowsInUse;
+ mRowsInUse = stats.rowsInUse + stats.fraggedRows + freeFraggedRows;
+
+ bool moved = false;
+
+ #if defined(SHOW_FRAGMENTATION) || defined(SHOW_MEM_EVENTS)
+ GCLOG("Total memory : %s\n", formatBytes(GetWorkingMemory()).c_str());
+ GCLOG(" reserved bytes : %s\n", formatBytes(mRowsInUse*IMMIX_LINE_LEN).c_str());
+ if (full)
+ {
+ GCLOG(" active bytes : %s\n", formatBytes(stats.bytesInUse).c_str());
+ GCLOG(" active ratio : %f\n", (double)stats.bytesInUse/( mRowsInUse*IMMIX_LINE_LEN));
+ GCLOG(" fragged blocks : %d (%.1f%%)\n", stats.fraggedBlocks, stats.fraggedBlocks*100.0/mAllBlocks.size() );
+ GCLOG(" fragged score : %f\n", (double)stats.fragScore/mAllBlocks.size() );
+ }
+ GCLOG(" large size : %s\n", formatBytes(mLargeAllocated).c_str());
+ GCLOG(" empty blocks : %d (%.1f%%)\n", stats.emptyBlocks, stats.emptyBlocks*100.0/mAllBlocks.size());
+ #endif
+
+ size_t bytesInUse = mRowsInUse<<IMMIX_LINE_BITS;
+
+ STAMP(t3)
+
+
+ #ifdef HXCPP_TELEMETRY
+ // Detect deallocations - TODO: add STAMP() ?
+ __hxt_gc_after_mark(gByteMarkID, HX_ENDIAN_MARK_ID_BYTE);
+ #endif
+
+ // Sweep large
+
+ // Manage recycle size ?
+ // clear old frames recycle objects
+ int l2 = largeObjectRecycle.size();
+ for(int i=0;i<largeObjectRecycle.size();i++)
+ HxFree(largeObjectRecycle[i]);
+ largeObjectRecycle.setSize(0);
+
+ size_t recycleRemaining = 0;
+ #ifdef RECYCLE_LARGE
+ if (!inForceCompact)
+ recycleRemaining = mLargeAllocForceRefresh;
+ #endif
+
+ int idx = 0;
+ int l0 = mLargeList.size();
+ while(idx<mLargeList.size())
+ {
+ unsigned int *blob = mLargeList[idx];
+ if ( (blob[1] & IMMIX_ALLOC_MARK_ID) != hx::gMarkID )
+ {
+ unsigned int size = *blob;
+ mLargeAllocated -= size;
+ if (size < recycleRemaining)
+ {
+ recycleRemaining -= size;
+ largeObjectRecycle.push(blob);
+ }
+ else
+ {
+ HxFree(blob);
+ }
+
+ mLargeList.qerase(idx);
+ }
+ else
+ idx++;
+ }
+
+ int l1 = mLargeList.size();
+
+
+ STAMP(t4)
+
+ bool defragged = false;
+
+ // Compact/Defrag?
+ #if defined(HXCPP_GC_MOVING) && defined(HXCPP_VISIT_ALLOCS)
+ if (full)
+ {
+ bool doRelease = false;
+
+ if (inForceCompact)
+ doRelease = true;
+ else
+ {
+ size_t mem = mRowsInUse<<IMMIX_LINE_BITS;
+ size_t targetFree = std::max((size_t)hx::sgMinimumFreeSpace, mem/100 * (size_t)hx::sgTargetFreeSpacePercentage );
+ targetFree = std::min(targetFree, (size_t)sgMaximumFreeSpace );
+ sWorkingMemorySize = std::max( mem + targetFree, (size_t)hx::sgMinimumWorkingMemory);
+
+ size_t allMem = GetWorkingMemory();
+ // 8 Meg too much?
+ size_t allowExtra = std::max( (size_t)8*1024*1024, sWorkingMemorySize*5/4 );
+
+ if ( allMem > sWorkingMemorySize + allowExtra )
+ {
+ #if defined(SHOW_FRAGMENTATION) || defined(SHOW_MEM_EVENTS)
+ int releaseGroups = (int)((allMem - sWorkingMemorySize) / (IMMIX_BLOCK_SIZE<<IMMIX_BLOCK_GROUP_BITS));
+ if (releaseGroups)
+ GCLOG("Try to release %d groups\n", releaseGroups );
+ #endif
+ doRelease = true;
+ }
+ }
+
+
+ bool isFragged = stats.fragScore > mAllBlocks.size()*FRAG_THRESH;
+ if (doRelease || isFragged || hx::gAlwaysMove)
+ {
+ if (isFragged && sgTimeToNextTableUpdate>3)
+ sgTimeToNextTableUpdate = 3;
+ calcMoveOrder( );
+
+ // Borrow some blocks to ensuure space to defrag into
+ int workingBlocks = mAllBlocks.size()*3/2 - stats.emptyBlocks;
+ int borrowed = 0;
+ while( mAllBlocks.size()<workingBlocks )
+ {
+ bool dummy = false;
+ if (!AllocMoreBlocks(dummy, true))
+ break;
+ doRelease = true;
+ borrowed++;
+ }
+ stats.emptyBlocks += borrowed;
+ #if defined(SHOW_FRAGMENTATION)
+ GCLOG("Borrowed %d groups for %d target blocks\n", borrowed, workingBlocks);
+ #endif
+
+ MoveBlockJob job(mAllBlocks);
+
+ if (MoveBlocks(job,stats) || doRelease)
+ {
+ if (doRelease)
+ {
+ size_t mem = mRowsInUse<<IMMIX_LINE_BITS;
+ size_t targetFree = std::max((size_t)hx::sgMinimumFreeSpace, bytesInUse/100 *hx::sgTargetFreeSpacePercentage );
+ targetFree = std::min(targetFree, (size_t)sgMaximumFreeSpace );
+ size_t targetMem = std::max( mem + targetFree, (size_t)hx::sgMinimumWorkingMemory) +
+ (2<<(IMMIX_BLOCK_GROUP_BITS+IMMIX_BLOCK_BITS));
+
+ if (inForceCompact)
+ targetMem = 0;
+ size_t have = GetWorkingMemory();
+ if (targetMem<have)
+ {
+ size_t releaseSize = have - targetMem;
+ #ifdef SHOW_FRAGMENTATION
+ GCLOG(" Release %s bytes to leave %s\n", formatBytes(releaseSize).c_str(), formatBytes(targetMem).c_str() );
+ #endif
+
+ int releasedBlocks = releaseEmptyGroups(stats, releaseSize);
+ #ifdef SHOW_FRAGMENTATION
+ int releasedGroups = releasedBlocks >> IMMIX_BLOCK_GROUP_BITS;
+ GCLOG(" Released %s, %d groups\n", formatBytes((size_t)releasedBlocks<<IMMIX_BLOCK_BITS).c_str(), releasedGroups );
+ #endif
+ }
+ }
+
+ // Reduce sWorkingMemorySize now we have defragged
+ #if defined(SHOW_FRAGMENTATION) || defined(SHOW_MEM_EVENTS)
+ GCLOG("After compacting---\n");
+ GCLOG(" total memory : %s\n", formatBytes(GetWorkingMemory()).c_str() );
+ GCLOG(" total needed : %s\n", formatBytes((size_t)mRowsInUse*IMMIX_LINE_LEN).c_str() );
+ GCLOG(" for bytes : %s\n", formatBytes(bytesInUse).c_str() );
+ GCLOG(" empty blocks : %d (%.1f%%)\n", stats.emptyBlocks, stats.emptyBlocks*100.0/mAllBlocks.size());
+ GCLOG(" fragged blocks : %d (%.1f%%)\n", stats.fraggedBlocks, stats.fraggedBlocks*100.0/mAllBlocks.size() );
+ #endif
+ }
+
+ std::stable_sort(&mAllBlocks[0], &mAllBlocks[0] + mAllBlocks.size(), SortByBlockPtr );
+
+ #ifdef HXCPP_GC_VERIFY
+ VerifyBlockOrder();
+ #endif
+ }
+ }
+ #endif
+
+
+ STAMP(t5)
+
+ size_t mem = mRowsInUse<<IMMIX_LINE_BITS;
+ size_t baseMem = full ? bytesInUse : mem;
+ #ifdef HXCPP_GC_DYNAMIC_SIZE
+ size_t targetFree = std::max((size_t)hx::sgMinimumFreeSpace, (size_t)(baseMem * profileCollectSummary.spaceFactor ) );
+ #else
+ size_t targetFree = std::max((size_t)hx::sgMinimumFreeSpace, baseMem/100 *hx::sgTargetFreeSpacePercentage );
+ #endif
+ targetFree = std::min(targetFree, (size_t)sgMaximumFreeSpace );
+ // Only adjust if non-generational
+ if (!generational)
+ sWorkingMemorySize = std::max( mem + targetFree, (size_t)hx::sgMinimumWorkingMemory);
+
+ #if defined(SHOW_FRAGMENTATION) || defined(SHOW_MEM_EVENTS)
+ GCLOG("Target memory %s, using %s\n", formatBytes(sWorkingMemorySize).c_str(), formatBytes(mem).c_str() );
+ #endif
+
+ // Large alloc target
+ int blockSize = mAllBlocks.size()<<IMMIX_BLOCK_BITS;
+ if (blockSize > mLargeAllocSpace)
+ mLargeAllocSpace = blockSize;
+ mLargeAllocForceRefresh = mLargeAllocated + mLargeAllocSpace;
+
+ mTotalAfterLastCollect = MemUsage();
+
+ #ifdef HXCPP_GC_GENERATIONAL
+ if (generational)
+ {
+ // TODO - include large too?
+ int retained = mRowsInUse - oldRowsInUse;
+ int space = mAllBlocks.size()*IMMIX_USEFUL_LINES - oldRowsInUse;
+ if (space<retained)
+ space = retained;
+
+ mGenerationalRetainEstimate = (double)retained/(double)space;
+ }
+ else
+ {
+ // move towards 0.2
+ mGenerationalRetainEstimate += (0.2-mGenerationalRetainEstimate)*0.25;
+ }
+
+ double filled_ratio = (double)mRowsInUse/(double)(mAllBlocksCount*IMMIX_USEFUL_LINES);
+ double after_gen = filled_ratio + (1.0-filled_ratio)*mGenerationalRetainEstimate;
+
+ if (after_gen<0.75)
+ {
+ sGcMode = gcmGenerational;
+ }
+ else
+ {
+ sGcMode = gcmFull;
+ // What was I thinking here? This breaks #851
+ //gByteMarkID |= 0x30;
+ }
+
+ #ifdef SHOW_MEM_EVENTS
+ GCLOG("filled=%.2f%% + estimate = %.2f%% = %.2f%% -> %s\n",
+ filled_ratio*100, mGenerationalRetainEstimate*100, after_gen*100, sGcMode==gcmFull?"Full":"Generational");
+ #endif
+
+ #endif
+
+ createFreeList();
+
+ // This saves some running/stall time, but increases the total CPU usage
+ // Delaying it until just before the block is used to improve the cache locality
+ backgroundProcessFreeList(true);
+
+ mAllBlocksCount = mAllBlocks.size();
+ mCurrentRowsInUse = mRowsInUse;
+
+ #ifdef SHOW_MEM_EVENTS
+ GCLOG("Collect Done\n");
+ #endif
+
+ #ifdef PROFILE_COLLECT
+ STAMP(t6)
+ double period = t6-sLastCollect;
+ sLastCollect=t6;
+ GCLOG("Collect time %s total=%.2fms =%.1f%%\n setup=%.2f\n %s=%.2f(init=%.2f/roots=%.2f %d+%d/loc=%.2f*%d %d+%d/mark=%.2f %d+%d/fin=%.2f*%d/ids=%.2f)\n reclaim=%.2f\n large(%d->%d, recyc %d)=%.2f\n defrag=%.2f\n",
+ generational ? "gen" : "std",
+ (t6-t0)*1000, (t6-t0)*100.0/period, // total %
+ (t1-t0)*1000, // sync/setup
+ generational ? "mark gen" : "mark", (t2-t1)*1000,
+ (tMarkInit-t1)*1000,
+ (tMarkLocal-tMarkInit)*1000, hx::rootObjects, hx::rootAllocs,
+ (tMarkLocalEnd-tMarkLocal)*1000, hx::localCount, hx::localObjects-hx::rootObjects, hx::localAllocs-hx::rootAllocs,
+ (tMarked-tMarkLocalEnd)*1000, sObjectMarks-hx::localObjects, sAllocMarks-hx::localAllocs,
+ (hx::tFinalizers-tMarked)*1000, hx::finalizerCount,
+ (t2-hx::tFinalizers)*1000,
+ (t3-t2)*1000, // reclaim
+ l0, l1, l2, (t4-t3)*1000, // large
+ (t5-t4)*1000 // defrag
+ );
+ sObjectMarks = sAllocMarks = 0;
+
+ #endif
+
+ #ifdef PROFILE_THREAD_USAGE
+ GCLOG("Thread chunks:%d, wakes=%d\n", sThreadChunkPushCount, sThreadChunkWakes);
+ for(int i=-1;i<MAX_GC_THREADS;i++)
+ GCLOG(" thread %d] %d + %d\n", i, sThreadMarkCount[i], sThreadArrayMarkCount[i]);
+ GCLOG("Locking spins : %d\n", sSpinCount);
+ sSpinCount = 0;
+ #endif
+
+ #ifdef HXCPP_GC_GENERATIONAL
+ if (sGcMode==gcmGenerational)
+ for(int i=0;i<mLocalAllocs.size();i++)
+ {
+ hx::StackContext *ctx = (hx::StackContext *)mLocalAllocs[i];
+ ctx->mOldReferrers = hx::sGlobalChunks.alloc();
+ }
+ #endif
+
+
+ #ifdef HXCPP_GC_VERIFY
+ VerifyBlockOrder();
+ #endif
+
+ for(int i=0;i<LOCAL_POOL_SIZE;i++)
+ {
+ LocalAllocator *l = mLocalPool[i];
+ if (l)
+ ClearPooledAlloc(l);
+ }
+
+ #ifdef HXCPP_TELEMETRY
+ __hxt_gc_end();
+ #endif
+
+ sgIsCollecting = false;
+
+
+ hx::gPauseForCollect = 0x00000000;
+ #ifndef HXCPP_SINGLE_THREADED_APP
+ for(int i=0;i<mLocalAllocs.size();i++)
+ {
+ #ifdef HXCPP_SCRIPTABLE
+ ((hx::StackContext *)mLocalAllocs[i])->byteMarkId = hx::gByteMarkID;
+ #endif
+ if (mLocalAllocs[i]!=this_local)
+ ReleaseFromSafe(mLocalAllocs[i]);
+ }
+
+ if (!inLocked)
+ gThreadStateChangeLock->Unlock();
+ #else
+ #ifdef HXCPP_SCRIPTABLE
+ hx::gMainThreadContext->byteMarkId = hx::gByteMarkID;
+ #endif
+ #endif
+
+
+ PROFILE_COLLECT_SUMMARY_END;
+ }
+
+ void reclaimBlocks(bool full, BlockDataStats &outStats)
+ {
+ if (MAX_GC_THREADS>1)
+ {
+ for(int i=0;i<MAX_GC_THREADS;i++)
+ sThreadBlockDataStats[i].clear();
+ StartThreadJobs(full ? tpjReclaimFull : tpjReclaim, mAllBlocks.size(), true);
+ outStats = sThreadBlockDataStats[0];
+ for(int i=1;i<MAX_GC_THREADS;i++)
+ outStats.add(sThreadBlockDataStats[i]);
+ }
+ else
+ {
+ outStats.clear();
+ for(int i=0;i<mAllBlocks.size();i++)
+ {
+ if (full)
+ mAllBlocks[i]->reclaim<true>(&outStats);
+ else
+ mAllBlocks[i]->reclaim<false>(&outStats);
+ }
+ }
+ }
+
+
+ void countRows(BlockDataStats &outStats)
+ {
+ if (MAX_GC_THREADS>1)
+ {
+ for(int i=0;i<MAX_GC_THREADS;i++)
+ sThreadBlockDataStats[i].clear();
+ StartThreadJobs(tpjCountRows, mAllBlocks.size(), true);
+ outStats = sThreadBlockDataStats[0];
+ for(int i=1;i<MAX_GC_THREADS;i++)
+ outStats.add(sThreadBlockDataStats[i]);
+ }
+ else
+ {
+ outStats.clear();
+ for(int i=0;i<mAllBlocks.size();i++)
+ mAllBlocks[i]->countRows(outStats);
+ }
+ }
+
+
+ // buils mFreeBlocks and maybe starts the async-zero process on mZeroList
+ void createFreeList()
+ {
+ mFreeBlocks.clear();
+
+ for(int i=0;i<mAllBlocks.size();i++)
+ {
+ BlockDataInfo *info = mAllBlocks[i];
+ if (info->GetFreeRows() > 0 && info->mMaxHoleSize>256)
+ {
+ info->mOwned = false;
+ mFreeBlocks.push(info);
+ }
+ }
+
+ int extra = std::max( mAllBlocks.size(), 8<<IMMIX_BLOCK_GROUP_BITS);
+ mFreeBlocks.safeReserveExtra(extra);
+
+ std::sort(&mFreeBlocks[0], &mFreeBlocks[0] + mFreeBlocks.size(), SmallestFreeFirst );
+
+ for(int i=0;i<BLOCK_OFSIZE_COUNT;i++)
+ mNextFreeBlockOfSize[i] = mFreeBlocks.size();
+
+ for(int i=mFreeBlocks.size()-1;i>=0;i--)
+ {
+ int slot = mFreeBlocks[i]->mMaxHoleSize >> IMMIX_LINE_BITS;
+ if (slot>=BLOCK_OFSIZE_COUNT)
+ slot = BLOCK_OFSIZE_COUNT-1;
+ mNextFreeBlockOfSize[slot] = i;
+ }
+
+ for(int i=BLOCK_OFSIZE_COUNT-2;i>=0;i--)
+ if (mNextFreeBlockOfSize[i]>mNextFreeBlockOfSize[i+1])
+ mNextFreeBlockOfSize[i] = mNextFreeBlockOfSize[i+1];
+
+ mZeroList.clear();
+ }
+
+ void backgroundProcessFreeList(bool inJit)
+ {
+ mZeroListQueue = 0;
+ #ifdef HX_GC_ZERO_EARLY
+ mZeroList.setSize(mFreeBlocks.size());
+ memcpy( &mZeroList[0], &mFreeBlocks[0], mFreeBlocks.size()*sizeof(void *));
+
+ StartThreadJobs(tpjAsyncZero, mZeroList.size(),true);
+ #else
+ if ( MAX_GC_THREADS>1 && mFreeBlocks.size()>4)
+ {
+ mZeroList.setSize(mFreeBlocks.size());
+ memcpy( &mZeroList[0], &mFreeBlocks[0], mFreeBlocks.size()*sizeof(void *));
+
+ // Only use one thread for parallel zeroing. Try to get though the work wihout
+ // slowing down the main thread
+ StartThreadJobs(inJit ? tpjAsyncZeroJit : tpjAsyncZero, mZeroList.size(), false, 1);
+ }
+ #endif
+ }
+
+
+
+
+ size_t MemLarge()
+ {
+ return mLargeAllocated;
+ }
+
+ size_t MemReserved()
+ {
+ return mLargeAllocated + (mAllBlocksCount*IMMIX_USEFUL_LINES<<IMMIX_LINE_BITS);
+ }
+
+ size_t MemCurrent()
+ {
+ return mLargeAllocated + (mCurrentRowsInUse<<IMMIX_LINE_BITS);
+ }
+
+ size_t MemUsage()
+ {
+ return mLargeAllocated + (mRowsInUse<<IMMIX_LINE_BITS);
+ }
+
+ bool IsAllBlock(BlockData *block)
+ {
+ if (mAllBlocks.size())
+ {
+ int min = 0;
+ int max = mAllBlocks.size()-1;
+ if (block==mAllBlocks[0]->mPtr)
+ return true;
+ if (block==mAllBlocks[max]->mPtr)
+ return true;
+ if (block>mAllBlocks[0]->mPtr && block<mAllBlocks[max]->mPtr)
+ {
+ while(min<max-1)
+ {
+ int mid = (max+min)>>1;
+ if (mAllBlocks[mid]->mPtr==block)
+ return true;
+
+ if (mAllBlocks[mid]->mPtr<block)
+ min = mid;
+ else
+ max = mid;
+ }
+ }
+ }
+ return false;
+ }
+
+ MemType GetMemType(void *inPtr)
+ {
+ BlockData *block = (BlockData *)( ((size_t)inPtr) & IMMIX_BLOCK_BASE_MASK);
+
+ bool isBlock = IsAllBlock(block);
+ /*
+ bool found = false;
+ for(int i=0;i<mAllBlocks.size();i++)
+ {
+ if (mAllBlocks[i]==block)
+ {
+ found = true;
+ break;
+ }
+ }
+ */
+
+ if (isBlock)
+ return memBlock;
+
+ for(int i=0;i<mLargeList.size();i++)
+ {
+ unsigned int *blob = mLargeList[i] + 2;
+ if (blob==inPtr)
+ return memLarge;
+ }
+
+ return memUnmanaged;
+ }
+
+
+ size_t mRowsInUse;
+ size_t mCurrentRowsInUse;
+ size_t mLargeAllocSpace;
+ size_t mLargeAllocForceRefresh;
+ size_t mLargeAllocated;
+ size_t mTotalAfterLastCollect;
+ size_t mAllBlocksCount;
+ double mGenerationalRetainEstimate;
+
+ hx::MarkContext mMarker;
+
+ volatile int mNextFreeBlockOfSize[BLOCK_OFSIZE_COUNT];
+ volatile int mThreadJobId;
+
+ BlockList mAllBlocks;
+ BlockList mFreeBlocks;
+ BlockList mZeroList;
+ volatile int mZeroListQueue;
+
+ LargeList mLargeList;
+ HxMutex mLargeListLock;
+ hx::QuickVec<LocalAllocator *> mLocalAllocs;
+ LocalAllocator *mLocalPool[LOCAL_POOL_SIZE];
+ hx::QuickVec<unsigned int *> largeObjectRecycle;
+};
+
+
+
+namespace hx
+{
+
+MarkChunk *MarkChunk::swapForNew()
+{
+ return sGlobalChunks.pushJobNoWake(this);
+}
+
+
+
+void MarkConservative(int *inBottom, int *inTop,hx::MarkContext *__inCtx)
+{
+ #ifdef VERIFY_STACK_READ
+ VerifyStackRead(inBottom, inTop);
+ #endif
+
+ #ifdef SHOW_MEM_EVENTS
+ GCLOG("Mark conservative %p...%p (%d) [...", inBottom, inTop, (int)(inTop-inBottom) );
+ #ifdef HX_WATCH
+ GCLOG("\n");
+ #endif
+ #endif
+
+ #ifdef HXCPP_STACK_UP
+ int *start = inTop-1;
+ inTop = inBottom+1;
+ inBottom = start;
+ #endif
+
+ if (sizeof(int)==4 && sizeof(void *)==8)
+ {
+ // Can't start pointer on last integer boundary...
+ inTop--;
+ }
+
+ void *prev = 0;
+ void *lastPin = 0;
+ #ifdef HX_WATCH
+ void *lastWatch = 0;
+ bool isWatch = false;
+ #endif
+
+ #ifdef HXCPP_GC_GENERATIONAL
+ // If this is a generational mark, then the byte marker has not been increased.
+ // Previous mark Ids are therfore from more than 1 collection ago
+ bool allowPrevious = !__inCtx->isGenerational;
+ #else
+ const bool allowPrevious = true;
+ #endif
+
+
+ for(int *ptr = inBottom ; ptr<inTop; ptr++)
+ {
+ void *vptr = *(void **)ptr;
+
+ MemType mem;
+ #ifdef HXCPP_ALIGN_ALLOC
+ const size_t validObjectMask = 0x07;
+ #else
+ const size_t validObjectMask = 0x03;
+ #endif
+
+ if (vptr && !((size_t)vptr & validObjectMask) && vptr!=prev && vptr!=lastPin)
+ {
+
+ #ifdef PROFILE_COLLECT
+ hx::localCount++;
+ #endif
+ MemType mem = sGlobalAlloc->GetMemType(vptr);
+
+ #ifdef HX_WATCH
+ isWatch = false;
+ if (hxInWatchList(vptr) && vptr!=lastWatch)
+ {
+ isWatch = true;
+ lastWatch = vptr;
+ GCLOG("********* Watch location conservative mark %p:%d\n",vptr,mem);
+ }
+ #endif
+
+ if (mem!=memUnmanaged)
+ {
+ if (mem==memLarge)
+ {
+ unsigned char &mark = ((unsigned char *)(vptr))[HX_ENDIAN_MARK_ID_BYTE];
+ if (mark!=gByteMarkID)
+ mark = gByteMarkID;
+ }
+ else
+ {
+ BlockData *block = (BlockData *)( ((size_t)vptr) & IMMIX_BLOCK_BASE_MASK);
+ BlockDataInfo *info = (*gBlockInfo)[block->mId];
+
+ int pos = (int)(((size_t)vptr) & IMMIX_BLOCK_OFFSET_MASK);
+ AllocType t = sgCheckInternalOffset ?
+ info->GetEnclosingAllocType(pos-sizeof(int),&vptr, allowPrevious):
+ info->GetAllocType(pos-sizeof(int), allowPrevious);
+
+ #ifdef HX_WATCH
+ if (!isWatch && hxInWatchList(vptr))
+ {
+ isWatch = true;
+ GCLOG("********* Watch location conservative mark offset %p:%d\n",vptr,mem);
+ }
+ #endif
+
+
+ if ( t==allocObject )
+ {
+ #ifdef HX_WATCH
+ if (isWatch)
+ {
+ GCLOG(" Mark object %p (%p)\n", vptr,ptr);
+ }
+ #endif
+ hx::MarkObjectAlloc( ((hx::Object *)vptr), __inCtx );
+ lastPin = vptr;
+ info->pin();
+ }
+ else if (t==allocString)
+ {
+ #ifdef HX_WATCH
+ if (isWatch)
+ GCLOG(" Mark string %p (%p)\n", vptr,ptr);
+ #endif
+ HX_MARK_STRING(vptr);
+ lastPin = vptr;
+ info->pin();
+ }
+ else if (t==allocMarked)
+ {
+ #ifdef HX_WATCH
+ if (isWatch)
+ GCLOG(" pin alloced %p (%p)\n", vptr,ptr);
+ #endif
+ lastPin = vptr;
+ info->pin();
+ }
+ #ifdef HX_WATCH
+ else // memBlock
+ {
+ if (isWatch)
+ {
+ GCLOG(" missed watch %p:%d\n", vptr,t);
+ int x = info->GetAllocType(pos-sizeof(int),allowPrevious);
+ int y = info->GetEnclosingAllocType(pos-sizeof(int),&vptr,allowPrevious);
+ #ifdef HXCPP_GC_NURSERY
+ void *nptr;
+ int z = info->GetEnclosingNurseryType(pos-sizeof(int),&nptr);
+ #else
+ int z = 0;
+ #endif
+ printf("but got alloc type=%d, enclosing=%d nurs=%d o=%d\n",x,y,z,sgCheckInternalOffset);
+ }
+ }
+ #endif
+ }
+ }
+ // GCLOG(" rejected %p %p %d %p %d=%d\n", ptr, vptr, !((size_t)vptr & 0x03), prev,
+ // sGlobalAlloc->GetMemType(vptr) , memUnmanaged );
+ }
+ }
+ #ifdef SHOW_MEM_EVENTS
+ GCLOG("...]\n");
+ #endif
+}
+
+} // namespace hx
+
+
+// --- LocalAllocator -------------------------------------------------------
+//
+// One per thread ...
+
+static int sFragIgnore=0;
+
+class LocalAllocator : public hx::StackContext
+{
+ int mCurrentHole;
+ int mCurrentHoles;
+ HoleRange *mCurrentRange;
+ int *mFraggedRows;
+
+ bool mMoreHoles;
+
+ #ifndef HXCPP_EXPLICIT_STACK_EXTENT
+ int *mTopOfStack;
+ int *mBottomOfStack;
+ #endif
+
+ hx::RegisterCaptureBuffer mRegisterBuf;
+ int mRegisterBufSize;
+
+ #ifndef HXCPP_SINGLE_THREADED_APP
+ bool mGCFreeZone;
+ HxSemaphore mReadyForCollect;
+ HxSemaphore mCollectDone;
+ #endif
+
+ int mID;
+
+
+ // Must be called locked
+ ~LocalAllocator()
+ {
+ }
+
+public:
+ bool mGlobalStackLock;
+ int mStackLocks;
+
+public:
+ LocalAllocator(int *inTopOfStack=0)
+ {
+ Reset();
+
+ #ifdef HXCPP_GC_GENERATIONAL
+ mOldReferrers = 0;
+ #endif
+
+ AttachThread(inTopOfStack);
+ }
+
+
+ void AttachThread(int *inTopOfStack)
+ {
+ #ifndef HXCPP_EXPLICIT_STACK_EXTENT
+ mTopOfStack = mBottomOfStack = inTopOfStack;
+ #endif
+
+ mRegisterBufSize = 0;
+ mStackLocks = 0;
+ mGlobalStackLock = false;
+ #ifdef HX_WINDOWS
+ mID = GetCurrentThreadId();
+ #endif
+
+ #ifdef HXCPP_GC_GENERATIONAL
+ if (mOldReferrers)
+ {
+ GCLOG("Uncleaned referrers\n");
+ }
+
+ if (sGcMode==gcmGenerational)
+ mOldReferrers = hx::sGlobalChunks.alloc();
+ else
+ mOldReferrers = 0;
+ #endif
+
+
+ // It is in the free zone - wait for 'SetTopOfStack' to activate
+ #ifndef HXCPP_SINGLE_THREADED_APP
+ mGCFreeZone = true;
+ mReadyForCollect.Set();
+ #endif
+ sGlobalAlloc->AddLocal(this);
+ }
+
+ void Release()
+ {
+ mStackLocks = 0;
+
+ onThreadDetach();
+
+ #ifndef HXCPP_SINGLE_THREADED_APP
+ if (!mGCFreeZone)
+ EnterGCFreeZone();
+ #endif
+
+ AutoLock lock(*gThreadStateChangeLock);
+
+ #ifdef HX_WINDOWS
+ mID = 0;
+ #endif
+
+ #ifdef HXCPP_GC_GENERATIONAL
+ if (mOldReferrers)
+ {
+ if ( mOldReferrers->count )
+ hx::sGlobalChunks.pushJob( mOldReferrers, false );
+ else
+ hx::sGlobalChunks.free( mOldReferrers );
+ mOldReferrers = 0;
+ }
+ #endif
+
+ #ifndef HXCPP_EXPLICIT_STACK_EXTENT
+ mTopOfStack = mBottomOfStack = 0;
+ #endif
+
+ sGlobalAlloc->RemoveLocalLocked(this);
+
+ hx::tlsStackContext = 0;
+
+ if (!sGlobalAlloc->ReturnToPoolLocked(this))
+ delete this;
+ }
+
+ void Reset()
+ {
+ allocBase = 0;
+ mCurrentHole = 0;
+ mCurrentHoles = 0;
+ mFraggedRows = 0;
+ #ifdef HXCPP_GC_NURSERY
+ spaceFirst = 0;
+ spaceOversize = 0;
+ #else
+ spaceEnd = 0;
+ spaceStart = 0;
+ #endif
+ mMoreHoles = false;
+ }
+
+ // The main of haxe calls SetTopOfStack(top,false)
+ // via hxcpp_set_top_of_stack or HX_TOP_OF_STACK in HxcppMain.cpp/Macros.h
+ // The means "register current thread indefinitely"
+ // Other places may call this to ensure the the current thread is registered
+ // indefinitely (until forcefully revoked)
+ //
+ // Normally libraries/mains will then let this dangle.
+ //
+ // However after the main, on android it calls SetTopOfStack(0,true), to unregister the thread,
+ // because it is likely to be the ui thread, and the remaining call will be from
+ // callbacks from the render thread.
+ //
+ // When threads want to attach temporarily, they will call
+ // gc_set_top_of_stack(top,true)
+ // -> SetTopOfStack(top,true)
+ // do stuff...
+ // gc_set_top_of_stack(0,true)
+ // -> SetTopOfStack(0,true)
+ //
+ // OR
+ //
+ // PushTopOfStack(top)
+ // ...
+ // PopTopOfStack
+ //
+ // However, we really want the gc_set_top_of_stack(top,true) to allow recursive locks so:
+ //
+ // SetTopOfStack(top,false) -> ensure global stack lock exists
+ // SetTopOfStack(top,true) -> add stack lock
+ // SetTopOfStack(0,_) -> pop stack lock. If all gone, clear global stack lock
+ //
+
+ #ifdef HXCPP_EXPLICIT_STACK_EXTENT // {
+
+ void SetTopOfStack(int *inTop,bool inPush) { }
+ void PushTopOfStack(void *inTop) { }
+ void PopTopOfStack() { }
+ void SetBottomOfStack(int *inBottom) { }
+ void PauseForCollect() { }
+ void EnterGCFreeZone() { }
+ bool TryGCFreeZone() { return true; }
+ bool TryExitGCFreeZone() { return false; }
+ void ExitGCFreeZoneLocked() { }
+
+
+ #else // } !HXCPP_EXPLICIT_STACK_EXTENT {
+ void SetTopOfStack(int *inTop,bool inPush)
+ {
+ if (inTop)
+ {
+ if (!mTopOfStack)
+ mTopOfStack = inTop;
+ // EMSCRIPTEN the stack grows upwards - not wasm.
+ // It could be that the main routine was called from deep with in the stack,
+ // then some callback was called from a higher location on the stack
+ #ifdef HXCPP_STACK_UP
+ else if (inTop < mTopOfStack)
+ mTopOfStack = inTop;
+ #else
+ else if (inTop > mTopOfStack)
+ mTopOfStack = inTop;
+ #endif
+
+ if (inPush)
+ mStackLocks++;
+ else
+ mGlobalStackLock = true;
+
+ #ifndef HXCPP_SINGLE_THREADED_APP
+ if (mGCFreeZone)
+ ExitGCFreeZone();
+ #endif
+ }
+ else
+ {
+ if (mStackLocks>0)
+ mStackLocks--;
+ else
+ mGlobalStackLock = false;
+
+ if (!mStackLocks && !mGlobalStackLock)
+ {
+ Release();
+ }
+ }
+
+ #ifdef VerifyStackRead
+ VerifyStackRead(mBottomOfStack, mTopOfStack)
+ #endif
+ }
+
+
+ void PushTopOfStack(void *inTop)
+ {
+ SetTopOfStack((int *)inTop,true);
+ }
+
+
+ void PopTopOfStack()
+ {
+ mStackLocks--;
+ if (mStackLocks<=0 && !mGlobalStackLock)
+ {
+ Release();
+ }
+ }
+
+
+
+ void SetBottomOfStack(int *inBottom)
+ {
+ mBottomOfStack = inBottom;
+ #ifdef VerifyStackRead
+ VerifyStackRead(mBottomOfStack, mTopOfStack)
+ #endif
+ }
+
+
+ void PauseForCollect()
+ {
+ #ifndef HXCPP_SINGLE_THREADED_APP
+ volatile int dummy = 1;
+ mBottomOfStack = (int *)&dummy;
+ CAPTURE_REGS;
+ #ifdef VerifyStackRead
+ VerifyStackRead(mBottomOfStack, mTopOfStack)
+ #endif
+
+ if (sgIsCollecting)
+ CriticalGCError("Bad Allocation while collecting - from finalizer?");
+
+ mReadyForCollect.Set();
+ mCollectDone.Wait();
+ #endif
+ }
+
+ void EnterGCFreeZone()
+ {
+ #ifndef HXCPP_SINGLE_THREADED_APP
+ volatile int dummy = 1;
+ mBottomOfStack = (int *)&dummy;
+ if (mTopOfStack)
+ {
+ CAPTURE_REGS;
+ }
+ #ifdef VerifyStackRead
+ VerifyStackRead(mBottomOfStack, mTopOfStack)
+ #endif
+
+ mGCFreeZone = true;
+ mReadyForCollect.Set();
+ #endif
+ }
+
+ bool TryGCFreeZone()
+ {
+ #ifndef HXCPP_SINGLE_THREADED_APP
+ if (mGCFreeZone)
+ return false;
+ EnterGCFreeZone();
+ #endif
+ return true;
+ }
+
+ bool TryExitGCFreeZone()
+ {
+ #ifndef HXCPP_SINGLE_THREADED_APP
+ if (!mGCFreeZone)
+ return false;
+ ExitGCFreeZone();
+ return true;
+ #endif
+ return false;
+ }
+
+
+ void ExitGCFreeZone()
+ {
+ #ifndef HXCPP_SINGLE_THREADED_APP
+ if (!mGCFreeZone)
+ CriticalGCError("GCFree Zone mismatch");
+
+ AutoLock lock(*gThreadStateChangeLock);
+ mReadyForCollect.Reset();
+ mGCFreeZone = false;
+ #endif
+ }
+ // For when we already hold the lock
+ void ExitGCFreeZoneLocked()
+ {
+ #ifndef HXCPP_SINGLE_THREADED_APP
+ mReadyForCollect.Reset();
+ mGCFreeZone = false;
+ #endif
+ }
+
+
+
+ // Called by the collecting thread to make sure this allocator is paused.
+ // The collecting thread has the lock, and will not be releasing it until
+ // it has finished the collect.
+ //
+ // The mGCFreeZone is set without a lock in the EnterGCFreeZone code, and then
+ // mReadyForCollect is set. So it is possible the mGCFreeZone check may or may not
+ // trigger. If this call happens first, mGCFreeZone will be zero, and mReadyForCollect
+ // will wait. By this time mGCFreeZone will be set and the next call not check
+ // mReadyForCollect again. If this one happens later, it is possible mReadyForCollect
+ // will not be waited on. mReadyForCollect will be cleared when the zone is left.
+ //
+ // The mMoreHoles/spaceOversize/spaceEnd get zeroed without a lock. The timing should
+ // not be critical since the allocation code shold expect that these are volatile.
+ // If the allocation works, all is good. If it fails then the collection will happed soon.
+ #if defined(__has_feature)
+ #if __has_feature(thread_sanitizer)
+ __attribute__((no_sanitize("thread")))
+ #endif
+ #endif
+ void WaitForSafe()
+ {
+ #ifndef HXCPP_SINGLE_THREADED_APP
+ if (!mGCFreeZone)
+ {
+ // Cause allocation routines to fail ...
+ mMoreHoles = false;
+ #ifdef HXCPP_GC_NURSERY
+ spaceOversize = 0;
+ #else
+ spaceEnd = 0;
+ #endif
+ mReadyForCollect.Wait();
+ }
+ #endif
+ }
+
+ void ReleaseFromSafe()
+ {
+ #ifndef HXCPP_SINGLE_THREADED_APP
+ if (!mGCFreeZone)
+ mCollectDone.Set();
+ #endif
+ }
+
+ #endif // } HXCPP_EXPLICIT_STACK_EXTENT
+
+
+ void SetupStackAndCollect(bool inMajor, bool inForceCompact, bool inLocked=false,bool inFreeIsFragged=false)
+ {
+ #ifndef HXCPP_SINGLE_THREADED_APP
+ #if HXCPP_DEBUG
+ if (mGCFreeZone)
+ CriticalGCError("Collecting from a GC-free thread");
+ #endif
+ #endif
+
+ #ifndef HXCPP_EXPLICIT_STACK_EXTENT
+ volatile int dummy = 1;
+ mBottomOfStack = (int *)&dummy;
+
+ CAPTURE_REGS;
+
+ if (!mTopOfStack)
+ mTopOfStack = mBottomOfStack;
+
+ // EMSCRIPTEN the stack grows upwards
+ #ifdef HXCPP_STACK_UP
+ if (mBottomOfStack < mTopOfStack)
+ mTopOfStack = mBottomOfStack;
+ #else
+ if (mBottomOfStack > mTopOfStack)
+ mTopOfStack = mBottomOfStack;
+ #endif
+
+ #ifdef VerifyStackRead
+ VerifyStackRead(mBottomOfStack, mTopOfStack)
+ #endif
+
+ #endif
+
+
+ sGlobalAlloc->Collect(inMajor, inForceCompact, inLocked, inFreeIsFragged);
+ }
+
+
+
+ void ExpandAlloc(int &ioSize)
+ {
+ #ifdef HXCPP_ALIGN_ALLOC
+ // Do nothing here - aligning to the end of the row will bump the
+ // next allocation, so it's not clear if its a good idea.
+ #else
+ #ifdef HXCPP_GC_NURSERY
+ int spaceStart = spaceFirst - allocBase - 4;
+ int spaceEnd = spaceOversize - allocBase - 4;
+ #endif
+
+ int size = ioSize + sizeof(int);
+ int end = spaceStart + size;
+ if (end <= spaceEnd)
+ {
+ int linePad = IMMIX_LINE_LEN - (end & (IMMIX_LINE_LEN-1));
+ if (linePad>0 && linePad<=64)
+ ioSize += linePad;
+ }
+ #endif
+ }
+
+
+ void *CallAlloc(int inSize,unsigned int inObjectFlags)
+ {
+ #ifndef HXCPP_SINGLE_THREADED_APP
+ #if HXCPP_DEBUG
+ if (mGCFreeZone)
+ CriticalGCError("Allocating from a GC-free thread");
+ #endif
+ if (hx::gPauseForCollect)
+ PauseForCollect();
+ #endif
+
+ if (inSize==0)
+ return hx::emptyAlloc;
+
+ #if defined(HXCPP_VISIT_ALLOCS) && (defined(HXCPP_M64)||defined(HXCPP_ARM64))
+ // Make sure we can fit a relocation pointer
+ int allocSize = sizeof(int) + std::max(8,inSize);
+ #else
+ int allocSize = sizeof(int) + inSize;
+ #endif
+
+ #if HXCPP_GC_DEBUG_LEVEL>0
+ if (inSize & 3) DebuggerTrap();
+ #endif
+
+ while(1)
+ {
+ #ifdef HXCPP_GC_NURSERY
+ unsigned char *buffer = spaceFirst;
+ #ifdef HXCPP_ALIGN_ALLOC
+ if ((size_t)buffer & 0x4 )
+ buffer += 4;
+ #endif
+ unsigned char *end = buffer + allocSize;
+
+ if ( end <= spaceOversize )
+ {
+ spaceFirst = end;
+
+ int size = allocSize - 4;
+ ((unsigned int *)buffer)[-1] = size | inObjectFlags;
+
+ #if defined(HXCPP_GC_CHECK_POINTER) && defined(HXCPP_GC_DEBUG_ALWAYS_MOVE)
+ hx::GCOnNewPointer(buffer);
+ #endif
+
+ return buffer;
+ }
+ // spaceOversize might have been set to zero for quick-termination of alloc.
+ unsigned char *s = spaceOversize;
+ if (s>spaceFirst && mFraggedRows)
+ *mFraggedRows += (s - spaceFirst)>>IMMIX_LINE_BITS;
+ #else
+ #ifdef HXCPP_ALIGN_ALLOC
+ if (!((size_t)spaceStart & 0x4 ))
+ spaceStart += 4;
+ #endif
+
+ int end = spaceStart + allocSize;
+ if (end <= spaceEnd)
+ {
+ unsigned int *buffer = (unsigned int *)(allocBase + spaceStart);
+
+ int startRow = spaceStart>>IMMIX_LINE_BITS;
+ allocStartFlags[ startRow ] |= hx::gImmixStartFlag[spaceStart &127];
+
+ int endRow = (end+(IMMIX_LINE_LEN-1))>>IMMIX_LINE_BITS;
+
+ *buffer++ = inObjectFlags | hx::gMarkID |
+ (inSize<<IMMIX_ALLOC_SIZE_SHIFT) | (endRow-startRow);
+
+ spaceStart = end;
+
+ #if defined(HXCPP_GC_CHECK_POINTER) && defined(HXCPP_GC_DEBUG_ALWAYS_MOVE)
+ hx::GCOnNewPointer(buffer);
+ #endif
+
+ #ifdef HXCPP_TELEMETRY
+ __hxt_gc_alloc(buffer, inSize);
+ #endif
+
+ return buffer;
+ }
+ if (mFraggedRows)
+ {
+ int frag = spaceEnd-spaceStart;
+ if (frag>0)
+ *mFraggedRows += frag>>IMMIX_LINE_BITS;
+ }
+ #endif
+
+
+ if (mMoreHoles)
+ {
+ #ifdef HXCPP_GC_NURSERY
+ spaceFirst = allocBase + mCurrentRange[mCurrentHole].start + sizeof(int);
+ spaceOversize = spaceFirst + mCurrentRange[mCurrentHole].length;
+ #else
+ spaceStart = mCurrentRange[mCurrentHole].start;
+ spaceEnd = spaceStart + mCurrentRange[mCurrentHole].length;
+ #endif
+ mCurrentHole++;
+ mMoreHoles = mCurrentHole<mCurrentHoles;
+
+ }
+ else
+ {
+ // For opmtimized windows 64 builds, this dummy var technique does not
+ // quite work, since the compiler might recycle one of the earlier stack
+ // slots, and place dummy behind the stack values we are actually trying to
+ // capture. Moving the dummy into the GetFreeBlock seems to have fixed this.
+ // Not 100% sure this is the best answer, but it is working.
+ //volatile int dummy = 1;
+ //mBottomOfStack = (int *)&dummy;
+ //CAPTURE_REGS;
+
+ BlockDataInfo *info = sGlobalAlloc->GetFreeBlock(allocSize,this);
+
+ allocBase = (unsigned char *)info->mPtr;
+ mCurrentRange = info->mRanges;
+ allocStartFlags = info->allocStart;
+ mCurrentHoles = info->mHoles;
+ mFraggedRows = &info->mFraggedRows;
+ #ifdef HXCPP_GC_NURSERY
+ spaceFirst = allocBase + mCurrentRange->start + sizeof(int);
+ spaceOversize = spaceFirst + mCurrentRange->length;
+ #else
+ spaceStart = mCurrentRange->start;
+ spaceEnd = spaceStart + mCurrentRange->length;
+ #endif
+ mCurrentHole = 1;
+ mMoreHoles = mCurrentHole<mCurrentHoles;
+ }
+
+ // Other thread may have started collect, in which case we may just
+ // overwritted the 'mMoreHoles' and 'spaceEnd' termination attempt
+ if (hx::gPauseForCollect)
+ {
+ mMoreHoles = 0;
+ #ifdef HXCPP_GC_NURSERY
+ spaceOversize = 0;
+ #else
+ spaceEnd = 0;
+ #endif
+ }
+ }
+ return 0;
+ }
+
+ #ifdef HXCPP_VISIT_ALLOCS
+ void Visit(hx::VisitContext *__inCtx)
+ {
+ #ifdef HXCPP_COMBINE_STRINGS
+ if (stringSet)
+ {
+ __inCtx->visitObject( (hx::Object **)&stringSet);
+ }
+ #endif
+ }
+ #endif
+
+
+ void Mark(hx::MarkContext *__inCtx)
+ {
+ #ifndef HXCPP_SINGLE_THREADED_APP
+ if (!mTopOfStack)
+ {
+ Reset();
+ return;
+ }
+ #endif
+
+ #ifdef SHOW_MEM_EVENTS
+ //int here = 0;
+ //GCLOG("=========== Mark Stack ==================== %p ... %p (%p)\n",mBottomOfStack,mTopOfStack,&here);
+ #endif
+
+ #ifdef HXCPP_DEBUG
+ MarkPushClass("Stack",__inCtx);
+ MarkSetMember("Stack",__inCtx);
+
+ #ifdef HXCPP_EXPLICIT_STACK_EXTENT
+ hx::MarkConservative( (int *)emscripten_stack_get_current(),(int *)emscripten_stack_get_base(), __inCtx);
+ #else
+ if (mTopOfStack && mBottomOfStack)
+ hx::MarkConservative(mBottomOfStack, mTopOfStack , __inCtx);
+ #endif
+
+ #ifdef HXCPP_SCRIPTABLE
+ MarkSetMember("ScriptStack",__inCtx);
+ hx::MarkConservative((int *)(stack), (int *)(pointer),__inCtx);
+ #endif
+ MarkSetMember("Registers",__inCtx);
+ hx::MarkConservative(CAPTURE_REG_START, CAPTURE_REG_END, __inCtx);
+
+
+ MarkPopClass(__inCtx);
+ #else
+
+ #ifdef HXCPP_EXPLICIT_STACK_EXTENT
+ hx::MarkConservative( (int *)emscripten_stack_get_current(), (int *) emscripten_stack_get_base(), __inCtx);
+ #else
+ if (mTopOfStack && mBottomOfStack)
+ hx::MarkConservative(mBottomOfStack, mTopOfStack , __inCtx);
+ hx::MarkConservative(CAPTURE_REG_START, CAPTURE_REG_END, __inCtx);
+ #endif
+
+ #ifdef HXCPP_SCRIPTABLE
+ hx::MarkConservative((int *)(stack), (int *)(pointer),__inCtx);
+ #endif
+ #endif
+
+ #ifdef HXCPP_COMBINE_STRINGS
+ if (stringSet)
+ MarkMember( *(hx::Object **)&stringSet, __inCtx);
+ #endif
+
+ Reset();
+
+ }
+
+};
+
+
+
+
+inline LocalAllocator *GetLocalAlloc(bool inAllowEmpty=false)
+{
+ #ifndef HXCPP_SINGLE_THREADED_APP
+ LocalAllocator *result = (LocalAllocator *)(hx::ImmixAllocator *)hx::tlsStackContext;
+ if (!result && !inAllowEmpty)
+ hx::BadImmixAlloc();
+
+ return result;
+ #else
+ return (LocalAllocator *)hx::gMainThreadContext;
+ #endif
+}
+
+#ifndef HXCPP_SINGLE_THREADED_APP
+void WaitForSafe(LocalAllocator *inAlloc)
+{
+ inAlloc->WaitForSafe();
+}
+
+void ReleaseFromSafe(LocalAllocator *inAlloc)
+{
+ inAlloc->ReleaseFromSafe();
+}
+#endif
+
+void MarkLocalAlloc(LocalAllocator *inAlloc,hx::MarkContext *__inCtx)
+{
+ inAlloc->Mark(__inCtx);
+}
+
+void ClearPooledAlloc(LocalAllocator *inAlloc)
+{
+ inAlloc->Reset();
+}
+
+#ifdef HXCPP_VISIT_ALLOCS
+void VisitLocalAlloc(LocalAllocator *inAlloc,hx::VisitContext *__inCtx)
+{
+ inAlloc->Visit(__inCtx);
+}
+#endif
+
+
+
+void CollectFromThisThread(bool inMajor,bool inForceCompact)
+{
+ LocalAllocator *la = GetLocalAlloc();
+ la->SetupStackAndCollect(inMajor,inForceCompact);
+}
+
+namespace hx
+{
+
+void *ImmixAllocator::CallAlloc(int inSize,unsigned int inObjectFlags)
+{
+ return reinterpret_cast<LocalAllocator *>(this)->CallAlloc(inSize, inObjectFlags);
+}
+
+
+
+void PauseForCollect()
+{
+ GetLocalAlloc()->PauseForCollect();
+}
+
+
+
+void EnterGCFreeZone()
+{
+ #ifndef HXCPP_SINGLE_THREADED_APP
+ LocalAllocator *tla = GetLocalAlloc();
+ tla->EnterGCFreeZone();
+ #endif
+}
+
+
+bool TryGCFreeZone()
+{
+ #ifndef HXCPP_SINGLE_THREADED_APP
+ LocalAllocator *tla = GetLocalAlloc();
+ return tla->TryGCFreeZone();
+ #else
+ return false;
+ #endif
+}
+
+bool TryExitGCFreeZone()
+{
+ #ifndef HXCPP_SINGLE_THREADED_APP
+ LocalAllocator *tla = GetLocalAlloc(true);
+ if (!tla)
+ return 0;
+ bool left = tla->TryExitGCFreeZone();
+ return left;
+ #else
+ return false;
+ #endif
+}
+
+
+void ExitGCFreeZone()
+{
+ #ifndef HXCPP_SINGLE_THREADED_APP
+ LocalAllocator *tla = GetLocalAlloc();
+ tla->ExitGCFreeZone();
+ #endif
+}
+
+void ExitGCFreeZoneLocked()
+{
+ #ifndef HXCPP_SINGLE_THREADED_APP
+ LocalAllocator *tla = GetLocalAlloc();
+ tla->ExitGCFreeZoneLocked();
+ #endif
+}
+
+void InitAlloc()
+{
+ for(int i=0;i<IMMIX_LINE_LEN;i++)
+ gImmixStartFlag[i] = 1<<( i>>2 ) ;
+
+ hx::CommonInitAlloc();
+ sgAllocInit = true;
+ sGlobalAlloc = new GlobalAllocator();
+ sgFinalizers = new FinalizerList();
+ sFinalizerLock = new HxMutex();
+ sGCRootLock = new HxMutex();
+ hx::Object tmp;
+ void **stack = *(void ***)(&tmp);
+ sgObject_root = stack[0];
+
+ //GCLOG("__root pointer %p\n", sgObject_root);
+ gMainThreadContext = new LocalAllocator();
+
+ tlsStackContext = gMainThreadContext;
+
+ ExitGCFreeZone();
+
+ // Setup main thread ...
+ __hxcpp_thread_current();
+
+ gMainThreadContext->onThreadAttach();
+}
+
+
+void GCPrepareMultiThreaded()
+{
+ #ifdef HXCPP_SINGLE_THREADED_APP
+ CriticalGCError("GCPrepareMultiThreaded called with HXCPP_SINGLE_THREADED_APP");
+ #endif
+}
+
+
+
+void SetTopOfStack(int *inTop,bool inForce)
+{
+ bool threadAttached = false;
+ if (inTop)
+ {
+ if (!sgAllocInit)
+ InitAlloc();
+ else
+ {
+ if (tlsStackContext==0)
+ {
+ GCPrepareMultiThreaded();
+ RegisterCurrentThread(inTop);
+ threadAttached = true;
+ }
+ }
+ }
+
+ LocalAllocator *tla = (LocalAllocator *)(hx::ImmixAllocator *)tlsStackContext;
+
+ if (tla)
+ {
+ tla->SetTopOfStack(inTop,inForce);
+ if (threadAttached)
+ tla->onThreadAttach();
+ }
+}
+
+
+void *InternalNew(int inSize,bool inIsObject)
+{
+ // HX_STACK_FRAME("GC", "new", 0, "GC::new", __FILE__, __LINE__, 0)
+
+ #ifdef HXCPP_DEBUG
+ if (sgSpamCollects && sgAllocsSinceLastSpam>=sgSpamCollects)
+ {
+ //GCLOG("InternalNew spam\n");
+ CollectFromThisThread(false,false);
+ }
+ _hx_atomic_add(&sgAllocsSinceLastSpam, 1);
+ #endif
+
+ if (inSize>=IMMIX_LARGE_OBJ_SIZE)
+ {
+ void *result = sGlobalAlloc->AllocLarge(inSize, true);
+ return result;
+ }
+ else
+ {
+ LocalAllocator *tla = GetLocalAlloc();
+
+ if (inIsObject)
+ {
+ void* result = tla->CallAlloc(inSize,IMMIX_ALLOC_IS_CONTAINER);
+ return result;
+ }
+ else
+ {
+ #if defined(HXCPP_GC_MOVING) && defined(HXCPP_M64)
+ if (inSize<8)
+ return tla->CallAlloc(8,0);
+ #endif
+
+ void* result = tla->CallAlloc( (inSize+3)&~3,0);
+ return result;
+ }
+ }
+}
+
+
+// Force global collection - should only be called from 1 thread.
+int InternalCollect(bool inMajor,bool inCompact)
+{
+ if (!sgAllocInit)
+ return 0;
+
+ GetLocalAlloc()->SetupStackAndCollect(inMajor, inCompact);
+
+ return sGlobalAlloc->MemUsage();
+}
+
+inline unsigned int ObjectSize(void *inData)
+{
+ unsigned int header = ((unsigned int *)(inData))[-1];
+
+ return (header & IMMIX_ALLOC_ROW_COUNT) ?
+ ( (header & IMMIX_ALLOC_SIZE_MASK) >> IMMIX_ALLOC_SIZE_SHIFT) :
+ ((unsigned int *)(inData))[-2];
+}
+
+
+unsigned int ObjectSizeSafe(void *inData)
+{
+ unsigned int header = ((unsigned int *)(inData))[-1];
+ if (header & HX_GC_CONST_ALLOC_BIT)
+ return 0;
+
+ #ifdef HXCPP_GC_NURSERY
+ if (!(header & 0xff000000))
+ {
+ // Small object
+ if (header & 0x00ffffff)
+ return header & 0x0000ffff;
+ // Large object
+ }
+ #endif
+
+
+ return (header & IMMIX_ALLOC_ROW_COUNT) ?
+ ( (header & IMMIX_ALLOC_SIZE_MASK) >> IMMIX_ALLOC_SIZE_SHIFT) :
+ ((unsigned int *)(inData))[-2];
+}
+
+void GCChangeManagedMemory(int inDelta, const char *inWhy)
+{
+ sGlobalAlloc->onMemoryChange(inDelta, inWhy);
+}
+
+void InternalReleaseMem(void *inMem)
+{
+ if (inMem)
+ {
+ unsigned int s = ObjectSizeSafe(inMem);
+ if (s>=IMMIX_LARGE_OBJ_SIZE)
+ {
+ //Can release asap
+ sGlobalAlloc->FreeLarge(inMem);
+ }
+ }
+}
+
+
+
+void *InternalRealloc(int inFromSize, void *inData,int inSize, bool inExpand)
+{
+ if (inData==0 || inFromSize==0)
+ {
+ if (inData)
+ InternalReleaseMem(inData);
+ return hx::InternalNew(inSize,false);
+ }
+
+ // HX_STACK_FRAME("GC", "realloc", 0, "GC::relloc", __FILE__ , __LINE__, 0)
+
+ #ifdef HXCPP_DEBUG
+ if (sgSpamCollects && sgAllocsSinceLastSpam>=sgSpamCollects)
+ {
+ //GCLOG("InternalNew spam\n");
+ CollectFromThisThread(false,false);
+ }
+ _hx_atomic_add(&sgAllocsSinceLastSpam, 1);
+ #endif
+
+ void *new_data = 0;
+ if (inSize==0)
+ {
+ new_data = hx::emptyAlloc;
+ }
+ else if (inSize>=IMMIX_LARGE_OBJ_SIZE)
+ {
+ new_data = sGlobalAlloc->AllocLarge(inSize, false);
+ if (inSize>inFromSize)
+ ZERO_MEM((char *)new_data + inFromSize,inSize-inFromSize);
+ }
+ else
+ {
+ LocalAllocator *tla = GetLocalAlloc();
+
+ #if defined(HXCPP_GC_MOVING) && defined(HXCPP_M64)
+ if (inSize<8)
+ new_data = tla->CallAlloc(8,0);
+ else
+ #endif
+ {
+ inSize = (inSize+3) & ~3;
+ if (inExpand)
+ tla->ExpandAlloc(inSize);
+
+ new_data = tla->CallAlloc(inSize,0);
+ }
+ }
+
+
+#ifdef HXCPP_TELEMETRY
+ //printf(" -- reallocating %018x to %018x, size from %d to %d\n", inData, new_data, s, inSize);
+ __hxt_gc_realloc(inData, new_data, inSize);
+#endif
+
+ int min_size = inFromSize < inSize ? inFromSize : inSize;
+
+ if (min_size)
+ memcpy(new_data, inData, min_size );
+
+ InternalReleaseMem(inData);
+
+ return new_data;
+}
+
+#ifdef HXCPP_GC_GENERATIONAL
+void NewMarkedObject(hx::Object *inPtr)
+{
+ HX_OBJ_WB_PESSIMISTIC_GET(inPtr);
+}
+#endif
+
+void RegisterCurrentThread(void *inTopOfStack)
+{
+ // Create a local-alloc
+ LocalAllocator *local = sGlobalAlloc->GetPooledAllocator();
+ if (!local)
+ {
+ local = new LocalAllocator((int *)inTopOfStack);
+ }
+ else
+ {
+ local->AttachThread((int *)inTopOfStack);
+ }
+
+ tlsStackContext = local;
+ #ifdef HXCPP_SCRIPTABLE
+ local->byteMarkId = hx::gByteMarkID;
+ #endif
+}
+
+void UnregisterCurrentThread()
+{
+ LocalAllocator *local = (LocalAllocator *)(hx::ImmixAllocator *)tlsStackContext;
+ local->Release();
+}
+
+void RegisterVTableOffset(int inOffset)
+{
+ if (inOffset>sgCheckInternalOffset)
+ {
+ sgCheckInternalOffset = inOffset;
+ sgCheckInternalOffsetRows = 1 + (inOffset>>IMMIX_LINE_BITS);
+ }
+}
+
+void PushTopOfStack(void *inTop)
+{
+ bool threadAttached = false;
+ if (!sgAllocInit)
+ InitAlloc();
+ else
+ {
+ if (tlsStackContext==0)
+ {
+ GCPrepareMultiThreaded();
+ RegisterCurrentThread(inTop);
+ threadAttached = true;
+ }
+ }
+
+ LocalAllocator *tla = GetLocalAlloc();
+ tla->PushTopOfStack(inTop);
+ if (threadAttached)
+ tla->onThreadAttach();
+}
+
+void PopTopOfStack()
+{
+ LocalAllocator *tla = GetLocalAlloc();
+ tla->PopTopOfStack();
+}
+
+int GcGetThreadAttachedCount()
+{
+ LocalAllocator *tla = GetLocalAlloc(true);
+ if (!tla)
+ return 0;
+ return tla->mStackLocks + (tla->mGlobalStackLock ? 1 : 0);
+}
+
+
+#ifdef HXCPP_VISIT_ALLOCS
+class GcFreezer : public hx::VisitContext
+{
+public:
+ void visitObject(hx::Object **ioPtr)
+ {
+ hx::Object *obj = *ioPtr;
+ if (!obj || IsConstAlloc(obj))
+ return;
+
+ unsigned int s = ObjectSize(obj);
+ void *result = InternalCreateConstBuffer(obj,s,false);
+ //printf(" Freeze %d\n", s);
+ *ioPtr = (hx::Object *)result;
+ (*ioPtr)->__Visit(this);
+ }
+
+ void visitAlloc(void **ioPtr)
+ {
+ void *data = *ioPtr;
+ if (!data || IsConstAlloc(data))
+ return;
+ unsigned int s = ObjectSize(data);
+ //printf(" Freeze %d\n", s);
+ void *result = InternalCreateConstBuffer(data,s,false);
+ *ioPtr = result;
+ }
+};
+#endif
+
+
+} // end namespace hx
+
+
+Dynamic _hx_gc_freeze(Dynamic inObject)
+{
+#ifdef HXCPP_VISIT_ALLOCS
+ hx::GcFreezer freezer;
+ hx::Object *base = inObject.mPtr;
+ freezer.visitObject(&base);
+ return base;
+#else
+ return inObject;
+#endif
+}
+
+
+
+void __hxcpp_spam_collects(int inEveryNCalls)
+{
+ #ifdef HXCPP_DEBUG
+ sgSpamCollects = inEveryNCalls;
+ #else
+ GCLOG("Spam collects only available on debug versions\n");
+ #endif
+}
+
+int __hxcpp_gc_trace(hx::Class inClass,bool inPrint)
+{
+ #if !defined(HXCPP_DEBUG)
+ #ifdef ANDROID
+ __android_log_print(ANDROID_LOG_ERROR, "hxcpp", "GC trace not enabled in release build.");
+ #elif defined(HX_WINRT)
+ WINRT_LOG("GC trace not enabled in release build.");
+ #else
+ printf("WARNING : GC trace not enabled in release build.\n");
+ #endif
+ return 0;
+ #else
+ gCollectTrace = inClass.GetPtr();
+ gCollectTraceCount = 0;
+ gCollectTraceDoPrint = inPrint;
+ hx::InternalCollect(false,false);
+ gCollectTrace = 0;
+ return gCollectTraceCount;
+ #endif
+}
+
+int __hxcpp_gc_large_bytes()
+{
+ return sGlobalAlloc->MemLarge();
+}
+
+int __hxcpp_gc_reserved_bytes()
+{
+ return sGlobalAlloc->MemReserved();
+}
+
+double __hxcpp_gc_mem_info(int inWhich)
+{
+ switch(inWhich)
+ {
+ case MEM_INFO_USAGE:
+ return (double)sGlobalAlloc->MemUsage();
+ case MEM_INFO_RESERVED:
+ return (double)sGlobalAlloc->MemReserved();
+ case MEM_INFO_CURRENT:
+ return (double)sGlobalAlloc->MemCurrent();
+ case MEM_INFO_LARGE:
+ return (double)sGlobalAlloc->MemLarge();
+ }
+ return 0;
+}
+
+int __hxcpp_gc_used_bytes()
+{
+ return sGlobalAlloc->MemUsage();
+}
+
+void __hxcpp_gc_do_not_kill(Dynamic inObj)
+{
+ hx::GCDoNotKill(inObj.GetPtr());
+}
+
+hx::Object *__hxcpp_get_next_zombie()
+{
+ return hx::GCGetNextZombie();
+}
+
+
+void _hx_set_finalizer(Dynamic inObj, void (*inFunc)(Dynamic) )
+{
+ GCSetHaxeFinalizer( inObj.mPtr, inFunc );
+}
+
+void __hxcpp_set_finalizer(Dynamic inObj, void *inFunc)
+{
+ GCSetHaxeFinalizer( inObj.mPtr, (hx::HaxeFinalizer) inFunc );
+}
+
+void __hxcpp_add_member_finalizer(hx::Object *inObject, _hx_member_finalizer f, bool inPin)
+{
+ AutoLock lock(*gSpecialObjectLock);
+ hx::sFinalizableList.push( hx::Finalizable(inObject, f, inPin) );
+}
+
+void __hxcpp_add_alloc_finalizer(void *inAlloc, _hx_alloc_finalizer f, bool inPin)
+{
+ AutoLock lock(*gSpecialObjectLock);
+ hx::sFinalizableList.push( hx::Finalizable(inAlloc, f, inPin) );
+}
+
+
+
+extern "C"
+{
+void hxcpp_set_top_of_stack()
+{
+ int i = 0;
+ hx::SetTopOfStack(&i,false);
+}
+}
+
+void __hxcpp_enter_gc_free_zone()
+{
+ hx::EnterGCFreeZone();
+}
+
+
+bool __hxcpp_try_gc_free_zone()
+{
+ return hx::TryGCFreeZone();
+}
+
+
+
+void __hxcpp_exit_gc_free_zone()
+{
+ hx::ExitGCFreeZone();
+}
+
+
+void __hxcpp_gc_safe_point()
+{
+ if (hx::gPauseForCollect)
+ hx::PauseForCollect();
+}
+
+//#define HXCPP_FORCE_OBJ_MAP
+
+#if defined(HXCPP_M64) || defined(HXCPP_GC_MOVING) || defined(HXCPP_FORCE_OBJ_MAP)
+#define HXCPP_USE_OBJECT_MAP
+#endif
+
+int __hxcpp_obj_id(Dynamic inObj)
+{
+ hx::Object *obj = inObj.mPtr;
+ if (!obj) return -1;
+ #ifdef HXCPP_USE_OBJECT_MAP
+ return sGlobalAlloc->GetObjectID(obj);
+ #else
+ return (int)(obj);
+ #endif
+}
+
+hx::Object *__hxcpp_id_obj(int inId)
+{
+ #ifdef HXCPP_USE_OBJECT_MAP
+ return (hx::Object *)sGlobalAlloc->GetIDObject(inId);
+ #else
+ return (hx::Object *)(inId);
+ #endif
+}
+
+#ifdef HXCPP_USE_OBJECT_MAP
+unsigned int __hxcpp_obj_hash(Dynamic inObj)
+{
+ return __hxcpp_obj_id(inObj);
+}
+#else
+unsigned int __hxcpp_obj_hash(Dynamic inObj)
+{
+ if (!inObj.mPtr) return 0;
+ hx::Object *obj = inObj.mPtr;
+ #if defined(HXCPP_M64)
+ size_t h64 = (size_t)obj;
+ return (unsigned int)(h64>>2) ^ (unsigned int)(h64>>32);
+ #else
+ return ((unsigned int)inObj.mPtr) >> 4;
+ #endif
+}
+#endif
+
+
+
+
+void DummyFunction(void *inPtr) { }
+
diff --git a/Sources/c_snikket/src/hx/libs/regexp/Build.xml b/Sources/c_snikket/src/hx/libs/regexp/Build.xml
new file mode 100644
index 0000000..46a1fba
--- /dev/null
+++ b/Sources/c_snikket/src/hx/libs/regexp/Build.xml
@@ -0,0 +1,45 @@
+<xml>
+
+<pragma once="true" />
+
+<set name="PCRE_DIR" value="${HXCPP}/project/thirdparty/pcre2-10.42/src" />
+
+<files id="pcre2-8" tags="" >
+ <depend files="hxcpp-depends"/>
+ <depend name="${this_dir}/Build.xml" dateOnly="true" />
+ <cache value="true" asLibrary="true" />
+
+ <compilerflag value="-DPCRE2_CODE_UNIT_WIDTH=8" />
+ <compilerflag value="-DSUPPORT_PCRE2_8" />
+
+ <include name="${this_dir}/pcre2_sources.xml" />
+</files>
+
+<files id="pcre2-16" tags="" >
+ <depend files="hxcpp-depends"/>
+ <depend name="${this_dir}/Build.xml" dateOnly="true" />
+ <cache value="true" asLibrary="true" />
+
+ <compilerflag value="-DPCRE2_CODE_UNIT_WIDTH=16" />
+ <compilerflag value="-DSUPPORT_PCRE2_16" />
+
+ <include name="${this_dir}/pcre2_sources.xml" />
+</files>
+
+<files id="hxcpp_regexp">
+ <depend files="hxcpp-depends"/>
+ <depend name="${this_dir}/Build.xml" dateOnly="true" />
+ <cache value="true" asLibrary="true" />
+
+ <compilerflag value="-I${PCRE_DIR}"/>
+
+ <file name="${this_dir}/RegExp.cpp"/>
+</files>
+
+<target id="haxe">
+ <files id="hxcpp_regexp" />
+ <files id="pcre2-8" />
+ <files id="pcre2-16" if="hxcpp_smart_strings" />
+</target>
+
+</xml>
diff --git a/Sources/c_snikket/src/hx/libs/regexp/RegExp.cpp b/Sources/c_snikket/src/hx/libs/regexp/RegExp.cpp
new file mode 100644
index 0000000..9c66167
--- /dev/null
+++ b/Sources/c_snikket/src/hx/libs/regexp/RegExp.cpp
@@ -0,0 +1,292 @@
+#include <hxcpp.h>
+#include <string.h>
+
+#define PCRE2_STATIC
+#define PCRE2_CODE_UNIT_WIDTH 0
+
+#include <pcre2.h>
+
+#define PCRE(o) ((pcredata*)o.mPtr)
+
+static void regexp_compilation_error(String pattern, int error_code, size_t error_offset) {
+ PCRE2_UCHAR8 error_buffer[128];
+ pcre2_get_error_message_8(error_code, error_buffer, sizeof(error_buffer));
+ hx::Throw(HX_CSTRING("Regexp compilation error : ") + String((const char*)error_buffer) + HX_CSTRING(" in ") + pattern);
+}
+
+struct pcredata : public hx::Object
+{
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdPcreData };
+
+ pcre2_code_8 *rUtf8;
+ #ifdef HX_SMART_STRINGS
+ pcre2_code_16 *rUtf16;
+ #endif
+
+ int n_groups;
+ pcre2_match_data_8* match_data8;
+ #ifdef HX_SMART_STRINGS
+ pcre2_match_data_16* match_data16;
+ #endif
+
+ unsigned int flags;
+ String string;
+ String expr;
+
+ void create8(pcre2_code_8 *inR, String inExpr, int inFlags)
+ {
+ rUtf8 = inR;
+ #ifdef HX_SMART_STRINGS
+ rUtf16 = 0;
+ #endif
+ expr = inExpr;
+ HX_OBJ_WB_GET(this, expr.raw_ref());
+ flags = inFlags;
+
+ n_groups = 0;
+ pcre2_pattern_info_8(rUtf8,PCRE2_INFO_CAPTURECOUNT,&n_groups);
+ n_groups++;
+ match_data8 = pcre2_match_data_create_from_pattern_8(rUtf8, NULL);
+ #ifdef HX_SMART_STRINGS
+ match_data16 = 0;
+ #endif
+
+ _hx_set_finalizer(this, finalize);
+ }
+
+ #ifdef HX_SMART_STRINGS
+ void create16(pcre2_code_16 *inR, String inExpr, int inFlags)
+ {
+ rUtf8 = 0;
+ rUtf16 = inR;
+ expr = inExpr;
+ HX_OBJ_WB_GET(this, expr.raw_ref());
+ flags = inFlags;
+
+ n_groups = 0;
+ pcre2_pattern_info_16(rUtf16,PCRE2_INFO_CAPTURECOUNT,&n_groups);
+ n_groups++;
+ match_data8 = 0;
+ match_data16 = pcre2_match_data_create_from_pattern_16(rUtf16, NULL);
+
+ _hx_set_finalizer(this, finalize);
+ }
+ #endif
+
+ bool run(String string,int pos,int len)
+ {
+ #ifdef HX_SMART_STRINGS
+ if (string.isUTF16Encoded())
+ {
+ if (!rUtf16)
+ {
+ int error_code;
+ size_t error_offset;
+ hx::strbuf buf;
+ int utf16Length = 0;
+ PCRE2_SPTR16 utf16 = (PCRE2_SPTR16)expr.wc_str(&buf, &utf16Length);
+ rUtf16 = pcre2_compile_16((PCRE2_SPTR16)expr.wc_str(&buf),utf16Length,flags,&error_code,&error_offset,NULL);
+ if (!rUtf16) {
+ regexp_compilation_error(expr,error_code,error_offset);
+ }
+ match_data16 = pcre2_match_data_create_from_pattern_16(rUtf16, NULL);
+ }
+
+ int n = pcre2_match_16(rUtf16,(PCRE2_SPTR16)string.raw_wptr(),pos+len,pos,PCRE2_NO_UTF_CHECK,match_data16,NULL);
+ return n>=0;
+ }
+
+ if (!rUtf8)
+ {
+ int error_code;
+ size_t error_offset;
+ int utf8Length = 0;
+ PCRE2_SPTR8 utf8 = (PCRE2_SPTR8)expr.utf8_str(NULL, true, &utf8Length);
+ rUtf8 = pcre2_compile_8(utf8, utf8Length, flags, &error_code, &error_offset, NULL);
+ if (!rUtf8) {
+ regexp_compilation_error(expr,error_code,error_offset);
+ }
+ match_data8 = pcre2_match_data_create_from_pattern_8(rUtf8, NULL);
+ }
+
+ #endif
+ return pcre2_match_8(rUtf8,(PCRE2_SPTR8)string.utf8_str(),pos+len,pos,PCRE2_NO_UTF_CHECK,match_data8,NULL) >= 0;
+ }
+
+ size_t* get_matches() {
+ #ifdef HX_SMART_STRINGS
+ if (string.isUTF16Encoded()) {
+ return pcre2_get_ovector_pointer_16(match_data16);
+ }
+ #endif
+ return pcre2_get_ovector_pointer_8(match_data8);
+ }
+
+ void destroy()
+ {
+ pcre2_code_free_8( rUtf8 );
+ pcre2_match_data_free_8( match_data8 );
+
+ #ifdef HX_SMART_STRINGS
+ pcre2_code_free_16( rUtf16 );
+ pcre2_match_data_free_16( match_data16 );
+ #endif
+ }
+
+ void __Mark(hx::MarkContext *__inCtx) { HX_MARK_MEMBER(string); HX_MARK_MEMBER(expr); }
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx) { HX_VISIT_MEMBER(string); HX_VISIT_MEMBER(expr); }
+ #endif
+
+ static void finalize(Dynamic obj)
+ {
+ ((pcredata *)(obj.mPtr))->destroy();
+ }
+
+ String toString() { return expr; }
+};
+
+
+/**
+ regexp_new_options : reg:string -> options:string -> 'regexp
+ <doc>Build a new regexpr with the following options :
+ <ul>
+ <li>i : case insensitive matching</li>
+ <li>s : . match anything including newlines</li>
+ <li>m : treat the input as a multiline string</li>
+ <li>u : run in utf8 mode</li>
+ <li>g : turn off greedy behavior</li>
+ </ul>
+ </doc>
+**/
+
+Dynamic _hx_regexp_new_options(String s, String opt)
+{
+ hx::strbuf buf;
+ const char *o = opt.utf8_str(&buf);
+ int options = PCRE2_UCP | PCRE2_UTF;
+ while( *o )
+ {
+ switch( *o++ )
+ {
+ case 'i':
+ options |= PCRE2_CASELESS;
+ break;
+ case 's':
+ options |= PCRE2_DOTALL;
+ break;
+ case 'm':
+ options |= PCRE2_MULTILINE;
+ break;
+ case 'g':
+ options |= PCRE2_UNGREEDY;
+ break;
+ case 'u':
+ break;
+ default:
+ hx::Throw( HX_CSTRING("Regexp unknown modifier : ") + String::fromCharCode(o[-1]) );
+ break;
+ }
+ }
+
+ #ifdef HX_SMART_STRINGS
+ if (s.isUTF16Encoded())
+ {
+ int error_code;
+ size_t error_offset;
+ pcre2_code_16 *p = pcre2_compile_16((PCRE2_SPTR16)s.raw_wptr(),s.length,options,&error_code,&error_offset,NULL);
+ if( !p ) {
+ regexp_compilation_error(s,error_code,error_offset);
+ }
+
+ pcredata *pdata = new pcredata;
+ pdata->create16(p,s,options);
+ return pdata;
+ }
+ else
+ #endif
+ {
+ int error_code = 0;
+ size_t error_offset;
+ pcre2_code_8 *p = pcre2_compile_8((PCRE2_SPTR8)s.utf8_str(),s.length,options,&error_code,&error_offset,NULL);
+ if( !p ) {
+ regexp_compilation_error(s,error_code,error_offset);
+ }
+
+ pcredata *pdata = new pcredata;
+ pdata->create8(p,s,options);
+ return pdata;
+ }
+}
+
+bool _hx_regexp_match(Dynamic handle, String string, int pos, int len)
+{
+ if( pos < 0 || len < 0 || pos > string.length || pos + len > string.length )
+ return false;
+
+ pcredata *d = PCRE(handle);
+
+ if( d->run(string,pos,len) )
+ {
+ d->string = string;
+ HX_OBJ_WB_GET(d, d->string.raw_ref());
+ return true;
+ }
+ else
+ {
+ d->string = String();
+ return false;
+ }
+}
+
+String _hx_regexp_matched(Dynamic handle, int m)
+{
+ pcredata *d = PCRE(handle);
+
+ if( m < 0 || m >= d->n_groups || !d->string.raw_ptr() )
+ hx::Throw( HX_CSTRING("regexp_matched - no valid match"));
+
+ size_t* matches = d->get_matches();
+ int start = matches[m*2];
+ int len = matches[m*2+1] - start;
+ if( start == -1 )
+ return String();
+ return d->string.substr(start, len);
+}
+
+/**
+ regexp_matched_pos : 'regexp -> n:int -> { pos => int, len => int }
+ <doc>Return the [n]th matched block position by the regexp. If [n] is 0 then
+ return the whole matched substring position</doc>
+**/
+Dynamic _hx_regexp_matched_pos(Dynamic handle, int m)
+{
+ pcredata *d = PCRE(handle);
+ if (m < 0 || m >= d->n_groups || !d->string.raw_ptr())
+ return null();
+
+ size_t* matches = d->get_matches();
+ int start = matches[m*2];
+ int len = matches[m*2+1] - start;
+
+ return hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("len",d5,4b,52,00),len)
+ ->setFixed(1,HX_("pos",94,5d,55,00),start);
+}
+
+/**
+ regexp_matched_num : 'regexp -> int
+ <doc>Return the total number of matched groups, or -1 if the regexp has not
+ been matched yet</doc>
+**/
+int _hx_regexp_matched_num(Dynamic handle)
+{
+ pcredata *d = PCRE(handle);
+
+ if( !d->string.raw_ptr() )
+ return -1;
+ else
+ return d->n_groups;
+}
+
+
diff --git a/Sources/c_snikket/src/hx/libs/regexp/pcre2_sources.xml b/Sources/c_snikket/src/hx/libs/regexp/pcre2_sources.xml
new file mode 100644
index 0000000..a70d8fa
--- /dev/null
+++ b/Sources/c_snikket/src/hx/libs/regexp/pcre2_sources.xml
@@ -0,0 +1,35 @@
+<xml>
+ <compilerflag value="-DHAVE_CONFIG_H" />
+ <compilerflag value="-DPCRE2_STATIC" />
+ <compilerflag value="-DSUPPORT_UNICODE" />
+ <compilerflag value="-I${PCRE_DIR}" />
+ <compilerflag value="-std=c99" unless="MSVC_VER" />
+
+ <file name="${PCRE_DIR}/pcre2_auto_possess.c" />
+ <file name="${PCRE_DIR}/pcre2_chartables.c" />
+ <file name="${PCRE_DIR}/pcre2_compile.c" />
+ <file name="${PCRE_DIR}/pcre2_config.c" />
+ <file name="${PCRE_DIR}/pcre2_context.c" />
+ <file name="${PCRE_DIR}/pcre2_convert.c" />
+ <file name="${PCRE_DIR}/pcre2_dfa_match.c" />
+ <file name="${PCRE_DIR}/pcre2_error.c" />
+ <file name="${PCRE_DIR}/pcre2_extuni.c" />
+ <file name="${PCRE_DIR}/pcre2_find_bracket.c" />
+ <file name="${PCRE_DIR}/pcre2_jit_compile.c" />
+ <file name="${PCRE_DIR}/pcre2_maketables.c" />
+ <file name="${PCRE_DIR}/pcre2_match.c" />
+ <file name="${PCRE_DIR}/pcre2_match_data.c" />
+ <file name="${PCRE_DIR}/pcre2_newline.c" />
+ <file name="${PCRE_DIR}/pcre2_ord2utf.c" />
+ <file name="${PCRE_DIR}/pcre2_pattern_info.c" />
+ <file name="${PCRE_DIR}/pcre2_script_run.c" />
+ <file name="${PCRE_DIR}/pcre2_serialize.c" />
+ <file name="${PCRE_DIR}/pcre2_string_utils.c" />
+ <file name="${PCRE_DIR}/pcre2_study.c" />
+ <file name="${PCRE_DIR}/pcre2_substitute.c" />
+ <file name="${PCRE_DIR}/pcre2_substring.c" />
+ <file name="${PCRE_DIR}/pcre2_tables.c" />
+ <file name="${PCRE_DIR}/pcre2_ucd.c" />
+ <file name="${PCRE_DIR}/pcre2_valid_utf.c" />
+ <file name="${PCRE_DIR}/pcre2_xclass.c" />
+</xml>
\ No newline at end of file
diff --git a/Sources/c_snikket/src/hx/libs/sqlite/Build.xml b/Sources/c_snikket/src/hx/libs/sqlite/Build.xml
new file mode 100644
index 0000000..40f9246
--- /dev/null
+++ b/Sources/c_snikket/src/hx/libs/sqlite/Build.xml
@@ -0,0 +1,25 @@
+<xml>
+
+<pragma once="true" />
+
+<set name="SQLITE_DIR" value="${HXCPP}/project/thirdparty/sqlite-3.49.1"/>
+
+<files id="hxcpp_sqlite" dir="${this_dir}" >
+ <depend files="hxcpp-depends"/>
+ <depend name="${this_dir}/Build.xml" dateOnly="true" />
+ <cache value="true" asLibrary="true" />
+
+ <compilerflag value="-I${SQLITE_DIR}"/>
+
+ <file name="Sqlite.cpp"/>
+
+ <depend name="${SQLITE_DIR}/sqlite3.h" />
+ <file name="${SQLITE_DIR}/sqlite3.c" tags="" />
+</files>
+
+<target id="haxe">
+ <files id="hxcpp_sqlite"/>
+ <lib name="-lpthread" if="linux" unless="static_link" />
+</target>
+
+</xml>
diff --git a/Sources/c_snikket/src/hx/libs/sqlite/Sqlite.cpp b/Sources/c_snikket/src/hx/libs/sqlite/Sqlite.cpp
new file mode 100644
index 0000000..211c934
--- /dev/null
+++ b/Sources/c_snikket/src/hx/libs/sqlite/Sqlite.cpp
@@ -0,0 +1,404 @@
+/*
+ * Copyright (C)2005-2012 Haxe Foundation
+ *
+ * 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 THE
+ * AUTHORS OR COPYRIGHT HOLDERS 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.
+ */
+
+#include <hxcpp.h>
+#include "sqlite3.h"
+#include <stdlib.h>
+
+
+// Put in anon-namespace to avoid conflicts if static-linked
+namespace {
+
+
+
+struct result : public hx::Object
+{
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdSqlite };
+
+ sqlite3 *db;
+ sqlite3_stmt *r;
+ int ncols;
+ int count;
+ String *names;
+ int *bools;
+ int done;
+ int first;
+
+ void create(sqlite3 *inDb, sqlite3_stmt *inR, String sql)
+ {
+ _hx_set_finalizer(this, finalize);
+
+ db = inDb;
+ r = inR;
+
+ ncols = sqlite3_column_count(r);
+ names = (String *)malloc(sizeof(String)*ncols);
+ bools = (int*)malloc(sizeof(int)*ncols);
+ first = 1;
+ done = 0;
+ for(int i=0;i<ncols;i++)
+ {
+ names[i] = String::createPermanent(sqlite3_column_name(r,i),-1);
+ for(int j=0;j<i;j++)
+ if( names[j] == names[i] )
+ hx::Throw(HX_CSTRING("Error, same field is two times in the request ") + sql);
+
+ const char *dtype = sqlite3_column_decltype(r,i);
+ bools[i] = dtype?(strcmp(dtype,"BOOL") == 0):0;
+ }
+ }
+
+ static void finalize(Dynamic obj) { ((result *)(obj.mPtr))->destroy(false); }
+ void destroy(bool inThrowError)
+ {
+ if (bools)
+ {
+ free(bools);
+ bools = 0;
+ }
+ if (names)
+ {
+ free(names);
+ names = 0;
+ }
+ if (r)
+ {
+ first = 0;
+ done = 1;
+ if( ncols == 0 )
+ count = sqlite3_changes(db);
+
+ bool err = sqlite3_finalize(r) != SQLITE_OK;
+ db = 0;
+ r = 0;
+
+ if( err && inThrowError)
+ hx::Throw(HX_CSTRING("Could not finalize request"));
+ }
+ }
+
+ String toString() { return HX_CSTRING("Sqlite Result"); }
+
+ //static void finalize_result( result *r, int exc, bool throwError = true )
+};
+
+
+
+/**
+ <doc>
+ <h1>SQLite</h1>
+ <p>
+ Sqlite is a small embeddable SQL database that store all its data into
+ a single file. See http://sqlite.org for more details.
+ </p>
+ </doc>
+**/
+
+struct database : public hx::Object
+{
+ sqlite3 *db;
+ hx::ObjectPtr<result> last;
+
+ void create(sqlite3 *inDb)
+ {
+ db = inDb;
+ _hx_set_finalizer(this, finalize);
+ }
+ static void finalize(Dynamic obj) { ((database *)(obj.mPtr))->destroy(false); }
+ void destroy(bool inThrowError)
+ {
+ if (db)
+ {
+ if (last.mPtr)
+ {
+ last->destroy(inThrowError);
+ last = null();
+ }
+
+ if( sqlite3_close(db) != SQLITE_OK )
+ {
+ if (inThrowError)
+ hx::Throw(HX_CSTRING("Sqlite: could not close"));
+ }
+ db = 0;
+ }
+ }
+
+
+ void setResult(result *inResult)
+ {
+ if (last.mPtr)
+ last->destroy(true);
+
+ last = inResult;
+ HX_OBJ_WB_GET(this, last.mPtr);
+ }
+
+ void __Mark(hx::MarkContext *__inCtx) { HX_MARK_MEMBER(last); }
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx) { HX_VISIT_MEMBER(last); }
+ #endif
+
+ String toString() { return HX_CSTRING("Sqlite Databse"); }
+};
+
+static void sqlite_error( sqlite3 *db ) {
+ hx::Throw( HX_CSTRING("Sqlite error : ") + String(sqlite3_errmsg(db)) );
+}
+
+database *getDatabase(Dynamic handle)
+{
+ database *db = dynamic_cast<database *>(handle.mPtr);
+ if (!db || !db->db)
+ hx::Throw( HX_CSTRING("Invalid sqlite database") );
+ return db;
+}
+
+
+result *getResult(Dynamic handle, bool inRequireStatement)
+{
+ result *r = dynamic_cast<result *>(handle.mPtr);
+ if (!r || (inRequireStatement && !r->r))
+ hx::Throw( HX_CSTRING("Invalid sqlite result") );
+ return r;
+}
+
+
+} // End anon-namespace
+
+
+
+
+/**
+ connect : filename:string -> 'db
+ <doc>Open or create the database stored in the specified file.</doc>
+**/
+Dynamic _hx_sqlite_connect(String filename)
+{
+ int err;
+ sqlite3 *sqlDb = 0;
+ if( (err = sqlite3_open(filename.utf8_str(),&sqlDb)) != SQLITE_OK )
+ sqlite_error(sqlDb);
+
+ database *db = new database();
+ db->create(sqlDb);
+ return db;
+}
+
+
+/**
+ close : 'db -> void
+ <doc>Closes the database.</doc>
+**/
+void _hx_sqlite_close(Dynamic handle)
+{
+ database *db = getDatabase(handle);
+ db->destroy(true);
+}
+
+/**
+ last_insert_id : 'db -> int
+ <doc>Returns the last inserted auto_increment id.</doc>
+**/
+int _hx_sqlite_last_insert_id(Dynamic handle)
+{
+ database *db = getDatabase(handle);
+ return sqlite3_last_insert_rowid(db->db);
+}
+
+/**
+ request : 'db -> sql:string -> 'result
+ <doc>Executes the SQL request and returns its result</doc>
+**/
+Dynamic _hx_sqlite_request(Dynamic handle,String sql)
+{
+ database *db = getDatabase(handle);
+
+ int byteLength = 0;
+ const char * sqlStr = sql.utf8_str(0, true, &byteLength);
+ sqlite3_stmt *statement = 0;
+ const char *tl = 0;
+ if( sqlite3_prepare(db->db,sqlStr,byteLength,&statement,&tl) != SQLITE_OK )
+ {
+ hx::Throw( HX_CSTRING("Sqlite error in ") + sql + HX_CSTRING(" : ") +
+ String(sqlite3_errmsg(db->db) ) );
+ }
+ if( *tl )
+ {
+ sqlite3_finalize(statement);
+ hx::Throw(HX_CSTRING("Cannot execute several SQL requests at the same time"));
+ }
+
+ int i,j;
+
+ result *r = new result();
+ r->create(db->db, statement,sql);
+
+ db->setResult(r);
+
+ return r;
+}
+
+
+
+
+
+
+
+/**
+ result_get_length : 'result -> int
+ <doc>Returns the number of rows in the result or the number of rows changed by the request.</doc>
+**/
+int _hx_sqlite_result_get_length(Dynamic handle)
+{
+ result *r = getResult(handle,false);
+ if( r->ncols != 0 )
+ hx::Throw(HX_CSTRING("Getting change count from non-change request")); // ???
+ return r->count;
+}
+
+/**
+ result_get_nfields : 'result -> int
+ <doc>Returns the number of fields in the result.</doc>
+**/
+int _hx_sqlite_result_get_nfields(Dynamic handle)
+{
+ return getResult(handle,false)->ncols;
+}
+
+/**
+ result_next : 'result -> object?
+ <doc>Returns the next row in the result or [null] if no more result.</doc>
+**/
+
+Dynamic _hx_sqlite_result_next(Dynamic handle)
+{
+ result *r = getResult(handle,false);
+ if( r->done )
+ return null();
+
+ switch( sqlite3_step(r->r) )
+ {
+ case SQLITE_ROW:
+ {
+ hx::Anon v = hx::Anon_obj::Create();
+ r->first = 0;
+ for(int i=0;i<r->ncols;i++)
+ {
+ Dynamic f;
+ switch( sqlite3_column_type(r->r,i) )
+ {
+ case SQLITE_NULL:
+ break;
+ case SQLITE_INTEGER:
+ if( r->bools[i] )
+ f = bool(sqlite3_column_int(r->r,i));
+ else
+ f = int(sqlite3_column_int(r->r,i));
+ break;
+ case SQLITE_FLOAT:
+ f = Float(sqlite3_column_double(r->r,i));
+ break;
+ case SQLITE_TEXT:
+ f = String((char*)sqlite3_column_text(r->r,i));
+ break;
+ case SQLITE_BLOB:
+ {
+ int size = sqlite3_column_bytes(r->r,i);
+ f = Array_obj<unsigned char>::fromData((const unsigned char *)sqlite3_column_blob(r->r,i),size);
+ break;
+ }
+ default:
+ {
+ hx::Throw( HX_CSTRING("Unknown Sqlite type #") +
+ String((int)sqlite3_column_type(r->r,i)));
+ }
+ }
+ v->__SetField(r->names[i],f,hx::paccDynamic);
+ }
+ return v;
+ }
+ case SQLITE_DONE:
+ r->destroy(true);
+ return null();
+ case SQLITE_BUSY:
+ hx::Throw(HX_CSTRING("Database is busy"));
+ case SQLITE_ERROR:
+ sqlite_error(r->db);
+ default:
+ hx::Throw(HX_CSTRING("Unkown sqlite result"));
+ }
+
+ return null();
+}
+
+
+static sqlite3_stmt *prepStatement(Dynamic handle,int n)
+{
+ result *r = getResult(handle,true);
+ if( n < 0 || n >= r->ncols )
+ hx::Throw( HX_CSTRING("Sqlite: Invalid index") );
+
+ if( r->first )
+ _hx_sqlite_result_next(handle);
+
+ if( r->done )
+ hx::Throw( HX_CSTRING("Sqlite: no more results") );
+
+ return r->r;
+}
+
+/**
+ result_get : 'result -> n:int -> string
+ <doc>Return the [n]th field of the current result row.</doc>
+**/
+
+
+String _hx_sqlite_result_get(Dynamic handle,int n)
+{
+ sqlite3_stmt *r = prepStatement(handle,n);
+ return String((char*)sqlite3_column_text(r,n));
+}
+
+/**
+ result_get_int : 'result -> n:int -> int
+ <doc>Return the [n]th field of the current result row as an integer.</doc>
+**/
+int _hx_sqlite_result_get_int(Dynamic handle,int n)
+{
+ sqlite3_stmt *r = prepStatement(handle,n);
+ return sqlite3_column_int(r,n);
+}
+
+/**
+ result_get_float : 'result -> n:int -> float
+ <doc>Return the [n]th field of the current result row as a float.</doc>
+**/
+Float _hx_sqlite_result_get_float(Dynamic handle,int n)
+{
+ sqlite3_stmt *r = prepStatement(handle,n);
+ return sqlite3_column_double(r,n);
+}
+
+
+
+
diff --git a/Sources/c_snikket/src/hx/libs/ssl/SSL.cpp b/Sources/c_snikket/src/hx/libs/ssl/SSL.cpp
new file mode 100644
index 0000000..2c4904a
--- /dev/null
+++ b/Sources/c_snikket/src/hx/libs/ssl/SSL.cpp
@@ -0,0 +1,898 @@
+#include <string.h>
+
+#ifdef HX_WINDOWS
+# include <winsock2.h>
+# include <wincrypt.h>
+#else
+# include <sys/socket.h>
+# include <strings.h>
+# include <errno.h>
+typedef int SOCKET;
+#endif
+
+
+#include <hxcpp.h>
+#include <hx/OS.h>
+
+#if defined(NEKO_MAC) && !defined(IPHONE) && !defined(APPLETV)
+#include <Security/Security.h>
+#endif
+
+typedef size_t socket_int;
+
+#define SOCKET_ERROR (-1)
+#define NRETRYS 20
+
+#include "mbedtls/error.h"
+#include "mbedtls/entropy.h"
+#include "mbedtls/ctr_drbg.h"
+#include "mbedtls/md.h"
+#include "mbedtls/pk.h"
+#include "mbedtls/oid.h"
+#include "mbedtls/x509_crt.h"
+#include "mbedtls/ssl.h"
+#include "mbedtls/net.h"
+#include "mbedtls/debug.h"
+
+#define val_ssl(o) ((sslctx*)o.mPtr)
+#define val_conf(o) ((sslconf*)o.mPtr)
+#define val_cert(o) ((sslcert*)o.mPtr)
+#define val_pkey(o) ((sslpkey*)o.mPtr)
+
+struct SocketWrapper : public hx::Object
+{
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdSocket };
+ SOCKET socket;
+};
+
+struct sslctx : public hx::Object
+{
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdSsl };
+
+ mbedtls_ssl_context *s;
+
+ void create()
+ {
+ s = (mbedtls_ssl_context *)malloc(sizeof(mbedtls_ssl_context));
+ mbedtls_ssl_init(s);
+ _hx_set_finalizer(this, finalize);
+ }
+
+ void destroy()
+ {
+ if( s )
+ {
+ mbedtls_ssl_free( s );
+ free(s);
+ s = 0;
+ }
+ }
+
+ static void finalize(Dynamic obj)
+ {
+ ((sslctx *)(obj.mPtr))->destroy();
+ }
+
+ String toString() { return HX_CSTRING("sslctx"); }
+};
+
+struct sslconf : public hx::Object
+{
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdSslConf };
+
+ mbedtls_ssl_config *c;
+
+ void create()
+ {
+ c = (mbedtls_ssl_config *)malloc(sizeof(mbedtls_ssl_config));
+ mbedtls_ssl_config_init(c);
+ _hx_set_finalizer(this, finalize);
+ }
+
+ void destroy()
+ {
+ if( c )
+ {
+ mbedtls_ssl_config_free( c );
+ free(c);
+ c = 0;
+ }
+ }
+
+ static void finalize(Dynamic obj)
+ {
+ ((sslconf *)(obj.mPtr))->destroy();
+ }
+
+ String toString() { return HX_CSTRING("sslconfig"); }
+};
+
+struct sslcert : public hx::Object
+{
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdSslCert };
+
+ mbedtls_x509_crt *c;
+ bool head;
+
+ void create(const mbedtls_x509_crt *inC)
+ {
+
+ if( inC ){
+ c = (mbedtls_x509_crt *)inC;
+ head = false;
+ }else{
+ c = (mbedtls_x509_crt *)malloc(sizeof(mbedtls_x509_crt));
+ mbedtls_x509_crt_init(c);
+ head = true;
+ }
+ _hx_set_finalizer(this, finalize);
+ }
+
+ void destroy()
+ {
+ if( c && head )
+ {
+ mbedtls_x509_crt_free( c );
+ free(c);
+ head = 0;
+ }
+ c = 0;
+ }
+
+ static void finalize(Dynamic obj)
+ {
+ ((sslcert *)(obj.mPtr))->destroy();
+ }
+
+ String toString() { return HX_CSTRING("sslcert"); }
+};
+
+struct sslpkey : public hx::Object
+{
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdSslKey };
+
+ mbedtls_pk_context *k;
+
+ void create()
+ {
+ k = (mbedtls_pk_context *)malloc(sizeof(mbedtls_pk_context));
+ mbedtls_pk_init(k);
+ _hx_set_finalizer(this, finalize);
+ }
+
+ void destroy()
+ {
+ if( k )
+ {
+ mbedtls_pk_free(k);
+ free(k);
+ k = 0;
+ }
+ }
+
+ static void finalize(Dynamic obj)
+ {
+ ((sslpkey *)(obj.mPtr))->destroy();
+ }
+
+ String toString() { return HX_CSTRING("sslpkey"); }
+};
+
+static mbedtls_entropy_context entropy;
+static mbedtls_ctr_drbg_context ctr_drbg;
+
+static bool is_ssl_blocking( int r ) {
+ return r == MBEDTLS_ERR_SSL_WANT_READ || r == MBEDTLS_ERR_SSL_WANT_WRITE;
+}
+
+static bool is_block_error() {
+ #ifdef NEKO_WINDOWS
+ int err = WSAGetLastError();
+ if( err == WSAEWOULDBLOCK || err == WSAEALREADY || err == WSAETIMEDOUT )
+ #else
+ if( errno == EAGAIN || errno == EWOULDBLOCK || errno == EINPROGRESS || errno == EALREADY )
+ #endif
+ return true;
+ return false;
+}
+
+static void ssl_error( int ret ){
+ char buf[256];
+ mbedtls_strerror(ret, buf, sizeof(buf));
+ hx::Throw( String(buf) );
+}
+
+Dynamic _hx_ssl_new( Dynamic hconf ) {
+ int ret;
+ sslctx *ssl = new sslctx();
+ ssl->create();
+ sslconf *conf = val_conf(hconf);
+ if( ret = mbedtls_ssl_setup(ssl->s, conf->c) != 0 ){
+ ssl->destroy();
+ ssl_error(ret);
+ }
+ return ssl;
+}
+
+void _hx_ssl_close( Dynamic hssl ) {
+ sslctx *ssl = val_ssl(hssl);
+ ssl->destroy();
+}
+
+void _hx_ssl_debug_set (int i) {
+ mbedtls_debug_set_threshold(i);
+}
+
+void _hx_ssl_handshake( Dynamic hssl ) {
+ int r;
+ sslctx *ssl = val_ssl(hssl);
+ POSIX_LABEL(handshake_again);
+ r = mbedtls_ssl_handshake( ssl->s );
+ if ( is_ssl_blocking(r) ) {
+ HANDLE_EINTR(handshake_again);
+ hx::Throw(HX_CSTRING("Blocking"));
+ }else if( r == SOCKET_ERROR ) {
+ HANDLE_EINTR(handshake_again);
+ hx::Throw(HX_CSTRING("ssl network error"));
+ }else if( r != 0 )
+ ssl_error(r);
+}
+
+int net_read( void *fd, unsigned char *buf, size_t len ){
+ hx::EnterGCFreeZone();
+ int r = recv((SOCKET)(socket_int)fd, (char *)buf, len, 0);
+ if( r == SOCKET_ERROR && is_block_error() )
+ r = MBEDTLS_ERR_SSL_WANT_READ;
+ hx::ExitGCFreeZone();
+ return r;
+}
+
+int net_write( void *fd, const unsigned char *buf, size_t len ){
+ hx::EnterGCFreeZone();
+ int r = send((SOCKET)(socket_int)fd, (char *)buf, len, 0);
+ if( r == SOCKET_ERROR && is_block_error() )
+ r = MBEDTLS_ERR_SSL_WANT_WRITE;
+ hx::ExitGCFreeZone();
+ return r;
+}
+
+void _hx_ssl_set_socket( Dynamic hssl, Dynamic hsocket ) {
+ sslctx *ssl = val_ssl(hssl);
+ SocketWrapper *socket = (SocketWrapper *)hsocket.mPtr;
+ mbedtls_ssl_set_bio( ssl->s, (void *)(socket_int)socket->socket, net_write, net_read, NULL );
+}
+
+void _hx_ssl_set_hostname( Dynamic hssl, String hostname ){
+ int ret;
+ sslctx *ssl = val_ssl(hssl);
+ hx::strbuf buf;
+ if( ret = mbedtls_ssl_set_hostname(ssl->s, hostname.utf8_str(&buf)) != 0 )
+ ssl_error(ret);
+}
+
+Dynamic _hx_ssl_get_peer_certificate( Dynamic hssl ){
+ sslctx *ssl = val_ssl(hssl);
+ const mbedtls_x509_crt *crt = mbedtls_ssl_get_peer_cert(ssl->s);
+ if( crt == NULL )
+ return null();
+ sslcert *cert = new sslcert();
+ cert->create( crt );
+ return cert;
+}
+
+bool _hx_ssl_get_verify_result( Dynamic hssl ){
+ sslctx *ssl = val_ssl(hssl);
+ int r = mbedtls_ssl_get_verify_result( ssl->s );
+ if( r == 0 )
+ return true;
+ else if( r != -1 )
+ return false;
+ hx::Throw( HX_CSTRING("not available") );
+ return false;
+}
+
+void _hx_ssl_send_char( Dynamic hssl, int c ) {
+ if( c < 0 || c > 255 )
+ hx::Throw( HX_CSTRING("invalid char") );
+ sslctx *ssl = val_ssl(hssl);
+ const unsigned char cc = c;
+ mbedtls_ssl_write( ssl->s, &cc, 1 );
+}
+
+int _hx_ssl_send( Dynamic hssl, Array<unsigned char> buf, int p, int l ) {
+ sslctx *ssl = val_ssl(hssl);
+ int dlen = buf->length;
+ if( p < 0 || l < 0 || p > dlen || p + l > dlen )
+ hx::Throw( HX_CSTRING("ssl_send") );
+ POSIX_LABEL(send_again);
+ const unsigned char *base = (const unsigned char *)&buf[0];
+ dlen = mbedtls_ssl_write( ssl->s, base + p, l );
+ if ( is_ssl_blocking(dlen) ) {
+ HANDLE_EINTR(send_again);
+ hx::Throw(HX_CSTRING("Blocking"));
+ }else if( dlen == SOCKET_ERROR ) {
+ HANDLE_EINTR(send_again);
+ hx::Throw(HX_CSTRING("ssl network error"));
+ }
+ return dlen;
+}
+
+void _hx_ssl_write( Dynamic hssl, Array<unsigned char> buf ) {
+ sslctx *ssl = val_ssl(hssl);
+ int len = buf->length;
+ unsigned char *cdata = &buf[0];
+ while( len > 0 ) {
+ POSIX_LABEL( write_again );
+ int slen = mbedtls_ssl_write( ssl->s, cdata, len );
+ if ( is_ssl_blocking(slen) ) {
+ HANDLE_EINTR( write_again );
+ hx::Throw(HX_CSTRING("Blocking"));
+ }else if( slen == SOCKET_ERROR ) {
+ HANDLE_EINTR( write_again );
+ hx::Throw(HX_CSTRING("ssl network error"));
+ }
+ cdata += slen;
+ len -= slen;
+ }
+}
+
+int _hx_ssl_recv_char( Dynamic hssl ) {
+ sslctx *ssl = val_ssl(hssl);
+ unsigned char cc;
+ int r = mbedtls_ssl_read( ssl->s, &cc, 1 );
+ if( r <= 0 )
+ hx::Throw( HX_CSTRING("ssl_recv_char") );
+ return (int)cc;
+}
+
+int _hx_ssl_recv( Dynamic hssl, Array<unsigned char> buf, int p, int l ) {
+ sslctx *ssl = val_ssl(hssl);
+ int dlen = buf->length;
+ if( p < 0 || l < 0 || p > dlen || p + l > dlen )
+ hx::Throw( HX_CSTRING("ssl_recv") );
+
+ unsigned char *base = &buf[0];
+ POSIX_LABEL(recv_again);
+ dlen = mbedtls_ssl_read( ssl->s, base + p, l );
+ if ( is_ssl_blocking(dlen) ) {
+ HANDLE_EINTR(recv_again);
+ hx::Throw(HX_CSTRING("Blocking"));
+ }else if( dlen == SOCKET_ERROR ) {
+ HANDLE_EINTR(recv_again);
+ hx::Throw(HX_CSTRING("ssl network error"));
+ }
+ if( dlen < 0 ) {
+ if( dlen == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY ) {
+ mbedtls_ssl_close_notify( ssl->s );
+ return 0;
+ }
+ hx::Throw( HX_CSTRING("ssl_recv") );
+ }
+ return dlen;
+}
+
+Array<unsigned char> _hx_ssl_read( Dynamic hssl ) {
+ sslctx *ssl = val_ssl(hssl);
+ Array<unsigned char> result = Array_obj<unsigned char>::__new();
+ unsigned char buf[256];
+
+ while( true ) {
+ POSIX_LABEL(read_again);
+ int len = mbedtls_ssl_read( ssl->s, buf, 256 );
+ if ( is_ssl_blocking(len) ) {
+ HANDLE_EINTR(read_again);
+ hx::Throw(HX_CSTRING("Blocking"));
+ }else if( len == SOCKET_ERROR ) {
+ HANDLE_EINTR(read_again);
+ hx::Throw(HX_CSTRING("ssl network error"));
+ }
+ if( len == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY ) {
+ mbedtls_ssl_close_notify( ssl->s );
+ len = 0;
+ }
+ if( len == 0 )
+ break;
+ result->memcpy(result->length, buf, len);
+ }
+ return result;
+}
+
+#ifdef NEKO_WINDOWS
+static int verify_callback(void* param, mbedtls_x509_crt *crt, int depth, uint32_t *flags) {
+ if (*flags == 0 || *flags & MBEDTLS_X509_BADCERT_CN_MISMATCH) {
+ return 0;
+ }
+
+ HCERTSTORE store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0, CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG, NULL);
+ if(store == NULL) {
+ return MBEDTLS_ERR_X509_FATAL_ERROR;
+ }
+ PCCERT_CONTEXT primary_context = {0};
+ if(!CertAddEncodedCertificateToStore(store, X509_ASN_ENCODING, crt->raw.p, crt->raw.len, CERT_STORE_ADD_REPLACE_EXISTING, &primary_context)) {
+ CertCloseStore(store, 0);
+ return MBEDTLS_ERR_X509_FATAL_ERROR;
+ }
+ PCCERT_CHAIN_CONTEXT chain_context = {0};
+ CERT_CHAIN_PARA parameters = {0};
+ if(!CertGetCertificateChain(NULL, primary_context, NULL, store, ¶meters, 0, NULL, &chain_context)) {
+ CertFreeCertificateContext(primary_context);
+ CertCloseStore(store, 0);
+ return MBEDTLS_ERR_X509_FATAL_ERROR;
+ }
+ CERT_CHAIN_POLICY_PARA policy_parameters = {0};
+ CERT_CHAIN_POLICY_STATUS policy_status = {0};
+ if(!CertVerifyCertificateChainPolicy(CERT_CHAIN_POLICY_SSL, chain_context, &policy_parameters, &policy_status)) {
+ CertFreeCertificateChain(chain_context);
+ CertFreeCertificateContext(primary_context);
+ CertCloseStore(store, 0);
+ return MBEDTLS_ERR_X509_FATAL_ERROR;
+ }
+ if(policy_status.dwError == 0) {
+ *flags = 0;
+ } else {
+ // if we ever want to read the verification result,
+ // we need to properly map dwError to flags
+ *flags |= MBEDTLS_X509_BADCERT_OTHER;
+ }
+ CertFreeCertificateChain(chain_context);
+ CertFreeCertificateContext(primary_context);
+ CertCloseStore(store, 0);
+ return 0;
+}
+#endif
+
+Dynamic _hx_ssl_conf_new( bool server ) {
+ int ret;
+ sslconf *conf = new sslconf();
+ conf->create();
+ if( ret = mbedtls_ssl_config_defaults( conf->c,
+ server ? MBEDTLS_SSL_IS_SERVER : MBEDTLS_SSL_IS_CLIENT,
+ MBEDTLS_SSL_TRANSPORT_STREAM, 0 ) != 0 ){
+ conf->destroy();
+ ssl_error( ret );
+ }
+#ifdef NEKO_WINDOWS
+ mbedtls_ssl_conf_verify(conf->c, verify_callback, NULL);
+#endif
+ mbedtls_ssl_conf_rng( conf->c, mbedtls_ctr_drbg_random, &ctr_drbg );
+ return conf;
+}
+
+void _hx_ssl_conf_close( Dynamic hconf ) {
+ sslconf *conf = val_conf(hconf);
+ conf->destroy();
+}
+
+void _hx_ssl_conf_set_ca( Dynamic hconf, Dynamic hcert ) {
+ sslconf *conf = val_conf(hconf);
+ if( hconf.mPtr ){
+ sslcert *cert = val_cert(hcert);
+ mbedtls_ssl_conf_ca_chain( conf->c, cert->c, NULL );
+ }else{
+ mbedtls_ssl_conf_ca_chain( conf->c, NULL, NULL );
+ }
+}
+
+void _hx_ssl_conf_set_verify( Dynamic hconf, int mode ) {
+ sslconf *conf = val_conf(hconf);
+ if( mode == 2 )
+ mbedtls_ssl_conf_authmode(conf->c, MBEDTLS_SSL_VERIFY_OPTIONAL);
+ else if( mode == 1 )
+ mbedtls_ssl_conf_authmode(conf->c, MBEDTLS_SSL_VERIFY_REQUIRED);
+ else
+ mbedtls_ssl_conf_authmode(conf->c, MBEDTLS_SSL_VERIFY_NONE);
+}
+
+void _hx_ssl_conf_set_cert( Dynamic hconf, Dynamic hcert, Dynamic hpkey ) {
+ int r;
+ sslconf *conf = val_conf(hconf);
+ sslcert *cert = val_cert(hcert);
+ sslpkey *pkey = val_pkey(hpkey);
+
+ if( r = mbedtls_ssl_conf_own_cert(conf->c, cert->c, pkey->k) != 0 )
+ ssl_error(r);
+}
+
+static int sni_callback( void *arg, mbedtls_ssl_context *ctx, const unsigned char *name, size_t len ){
+ if( name && arg ){
+ Dynamic cb = new Dynamic();
+ cb.mPtr = (hx::Object*)arg;
+ const char *n = (const char *)name;
+ Dynamic ret = cb->__run( String(n,strlen(n)) );
+ if( ret != null() ){
+ // TODO authmode and ca
+ Dynamic hcert = ret->__Field(HX_CSTRING("cert"), hx::paccDynamic);
+ Dynamic hpkey = ret->__Field(HX_CSTRING("key"), hx::paccDynamic);
+ sslcert *cert = val_cert(hcert);
+ sslpkey *pk = val_pkey(hpkey);
+
+ return mbedtls_ssl_set_hs_own_cert( ctx, cert->c, pk->k );
+ }
+ }
+ return -1;
+}
+
+void _hx_ssl_conf_set_servername_callback( Dynamic hconf, Dynamic cb ){
+ sslconf *conf = val_conf(hconf);
+ mbedtls_ssl_conf_sni( conf->c, sni_callback, (void *)cb.mPtr );
+}
+
+Dynamic _hx_ssl_cert_load_defaults(){
+#if defined(NEKO_WINDOWS)
+ HCERTSTORE store;
+ PCCERT_CONTEXT cert;
+ sslcert *chain = NULL;
+ if( store = CertOpenSystemStore(0, (LPCSTR)"Root") ){
+ cert = NULL;
+ while( cert = CertEnumCertificatesInStore(store, cert) ){
+ if( chain == NULL ){
+ chain = new sslcert();
+ chain->create( NULL );
+ }
+ mbedtls_x509_crt_parse_der( chain->c, (unsigned char *)cert->pbCertEncoded, cert->cbCertEncoded );
+ }
+ CertCloseStore(store, 0);
+ }
+ if( chain != NULL )
+ return chain;
+#elif defined(NEKO_MAC) && !defined(IPHONE) && !defined(APPLETV)
+ CFMutableDictionaryRef search;
+ CFArrayRef result;
+ SecKeychainRef keychain;
+ SecCertificateRef item;
+ CFDataRef dat;
+ sslcert *chain = NULL;
+
+ // Load keychain
+ if( SecKeychainOpen("/System/Library/Keychains/SystemRootCertificates.keychain",&keychain) != errSecSuccess )
+ return null();
+
+ // Search for certificates
+ search = CFDictionaryCreateMutable( NULL, 0, NULL, NULL );
+ CFDictionarySetValue( search, kSecClass, kSecClassCertificate );
+ CFDictionarySetValue( search, kSecMatchLimit, kSecMatchLimitAll );
+ CFDictionarySetValue( search, kSecReturnRef, kCFBooleanTrue );
+ CFDictionarySetValue( search, kSecMatchSearchList, CFArrayCreate(NULL, (const void **)&keychain, 1, NULL) );
+ if( SecItemCopyMatching( search, (CFTypeRef *)&result ) == errSecSuccess ){
+ CFIndex n = CFArrayGetCount( result );
+ for( CFIndex i = 0; i < n; i++ ){
+ item = (SecCertificateRef)CFArrayGetValueAtIndex( result, i );
+
+ // Get certificate in DER format
+ dat = SecCertificateCopyData( item );
+ if( dat ){
+ if( chain == NULL ){
+ chain = new sslcert();
+ chain->create( NULL );
+ }
+ mbedtls_x509_crt_parse_der( chain->c, (unsigned char *)CFDataGetBytePtr(dat), CFDataGetLength(dat) );
+ CFRelease( dat );
+ }
+ }
+ }
+ CFRelease(keychain);
+ if( chain != NULL )
+ return chain;
+#endif
+ return null();
+}
+
+Dynamic _hx_ssl_cert_load_file( String file ){
+ int r;
+ sslcert *cert = new sslcert();
+ cert->create( NULL );
+ hx::strbuf buf;
+ if( r = mbedtls_x509_crt_parse_file(cert->c, file.utf8_str(&buf)) != 0 ){
+ cert->destroy();
+ ssl_error(r);
+ }
+ return cert;
+}
+
+Dynamic _hx_ssl_cert_load_path( String path ){
+ int r;
+ sslcert *cert = new sslcert();
+ cert->create( NULL );
+ hx::strbuf buf;
+ if( r = mbedtls_x509_crt_parse_path(cert->c, path.utf8_str(&buf)) != 0 ){
+ cert->destroy();
+ ssl_error(r);
+ }
+ return cert;
+}
+
+static String asn1_buf_to_string( mbedtls_asn1_buf *dat ){
+ unsigned int i, c;
+ HX_CHAR *result = hx::NewString( dat->len );
+ for( i = 0; i < dat->len; i++ ) {
+ c = dat->p[i];
+ if( c < 32 || c == 127 || ( c > 128 && c < 160 ) )
+ result[i] = '?';
+ else
+ result[i] = c;
+ }
+ result[i] = '\0';
+ return String(result,dat->len);
+}
+
+String _hx_ssl_cert_get_subject( Dynamic hcert, String objname ){
+ mbedtls_x509_name *obj;
+ int r;
+ const char *oname;
+ sslcert *cert = val_cert(hcert);
+ obj = &cert->c->subject;
+ if( obj == NULL )
+ hx::Throw( HX_CSTRING("cert_get_subject") );
+ hx::strbuf buf;
+ while( obj != NULL ){
+ r = mbedtls_oid_get_attr_short_name( &obj->oid, &oname );
+ if( r == 0 && strcmp( oname, objname.utf8_str(&buf) ) == 0 )
+ return asn1_buf_to_string( &obj->val );
+ obj = obj->next;
+ }
+ return String();
+}
+
+String _hx_ssl_cert_get_issuer( Dynamic hcert, String objname ){
+ mbedtls_x509_name *obj;
+ int r;
+ const char *oname;
+ sslcert *cert = val_cert(hcert);
+ obj = &cert->c->issuer;
+ if( obj == NULL )
+ hx::Throw( HX_CSTRING("cert_get_issuer") );
+ hx::strbuf buf;
+ while( obj != NULL ){
+ r = mbedtls_oid_get_attr_short_name( &obj->oid, &oname );
+ if( r == 0 && strcmp( oname, objname.utf8_str(&buf) ) == 0 )
+ return asn1_buf_to_string( &obj->val );
+ obj = obj->next;
+ }
+ return String();
+}
+
+Array<String> _hx_ssl_cert_get_altnames( Dynamic hcert ){
+ sslcert *cert = val_cert(hcert);
+ mbedtls_asn1_sequence *cur;
+ Array<String> result(0,1);
+ if( cert->c->ext_types & MBEDTLS_X509_EXT_SUBJECT_ALT_NAME ){
+ cur = &cert->c->subject_alt_names;
+
+ while( cur != NULL ){
+ result.Add( asn1_buf_to_string(&cur->buf) );
+ cur = cur->next;
+ }
+ }
+ return result;
+}
+
+static Array<int> x509_time_to_array( mbedtls_x509_time *t ){
+ if( !t )
+ hx::Throw( HX_CSTRING("x509_time_to_array") );
+ Array<int> result(6,6);
+ result[0] = t->year;
+ result[1] = t->mon;
+ result[2] = t->day;
+ result[3] = t->hour;
+ result[4] = t->min;
+ result[5] = t->sec;
+ return result;
+}
+
+Array<int> _hx_ssl_cert_get_notbefore( Dynamic hcert ){
+ sslcert *cert = val_cert(hcert);
+ if( !cert->c )
+ hx::Throw( HX_CSTRING("cert_get_notbefore") );
+ return x509_time_to_array( &cert->c->valid_from );
+}
+
+Array<int> _hx_ssl_cert_get_notafter( Dynamic hcert ){
+ sslcert *cert = val_cert(hcert);
+ if( !cert->c )
+ hx::Throw( HX_CSTRING("cert_get_notafter") );
+ return x509_time_to_array( &cert->c->valid_to );
+}
+
+Dynamic _hx_ssl_cert_get_next( Dynamic hcert ){
+ sslcert *cert = val_cert(hcert);
+ mbedtls_x509_crt *crt = cert->c->next;
+ if( crt == NULL )
+ return null();
+ cert = new sslcert();
+ cert->create(crt);
+ return cert;
+}
+
+Dynamic _hx_ssl_cert_add_pem( Dynamic hcert, String data ){
+ #ifdef HX_SMART_STRINGS
+ if (data.isUTF16Encoded())
+ hx::Throw( HX_CSTRING("Invalid data encoding") );
+ #endif
+ sslcert *cert = val_cert(hcert);
+ int r;
+ bool isnew = 0;
+ if( !cert ){
+ cert = new sslcert();
+ cert->create( NULL );
+ isnew = 1;
+ }
+ unsigned char *b = (unsigned char *)malloc((data.length+1) * sizeof(unsigned char));
+ memcpy(b,data.raw_ptr(),data.length);
+ b[data.length] = '\0';
+ r = mbedtls_x509_crt_parse( cert->c, b, data.length+1 );
+ free(b);
+ if( r < 0 ){
+ if( isnew )
+ cert->destroy();
+ ssl_error(r);
+ }
+ return cert;
+}
+
+Dynamic _hx_ssl_cert_add_der( Dynamic hcert, Array<unsigned char> buf ){
+ sslcert *cert = val_cert(hcert);
+ int r;
+ bool isnew = 0;
+ if( !cert ){
+ cert = new sslcert();
+ cert->create( NULL );
+ isnew = 1;
+ }
+ if( (r = mbedtls_x509_crt_parse_der( cert->c, &buf[0], buf->length)) < 0 ){
+ if( isnew )
+ cert->destroy();
+ ssl_error(r);
+ }
+ return cert;
+}
+
+Dynamic _hx_ssl_key_from_der( Array<unsigned char> buf, bool pub ){
+ sslpkey *pk = new sslpkey();
+ pk->create();
+ int r;
+ if( pub )
+ r = mbedtls_pk_parse_public_key( pk->k, &buf[0], buf->length );
+ else
+ r = mbedtls_pk_parse_key( pk->k, &buf[0], buf->length, NULL, 0 );
+ if( r != 0 ){
+ pk->destroy();
+ ssl_error(r);
+ }
+ return pk;
+}
+
+Dynamic _hx_ssl_key_from_pem( String data, bool pub, String pass ){
+ #ifdef HX_SMART_STRINGS
+ if (data.isUTF16Encoded())
+ hx::Throw( HX_CSTRING("Invalid data encoding") );
+ #endif
+ sslpkey *pk = new sslpkey();
+ pk->create();
+ int r;
+ unsigned char *b = (unsigned char *)malloc((data.length+1) * sizeof(unsigned char));
+ memcpy(b,data.raw_ptr(),data.length);
+ b[data.length] = '\0';
+ if( pub ){
+ r = mbedtls_pk_parse_public_key( pk->k, b, data.length+1 );
+ }else if( pass == null() ){
+ r = mbedtls_pk_parse_key( pk->k, b, data.length+1, NULL, 0 );
+ }else{
+ Array<unsigned char> pbytes(0,0);
+ __hxcpp_bytes_of_string(pbytes,pass);
+ r = mbedtls_pk_parse_key( pk->k, b, data.length+1, (const unsigned char *)pbytes->GetBase(), pbytes->length );
+ }
+ free(b);
+ if( r != 0 ){
+ pk->destroy();
+ ssl_error(r);
+ }
+ return pk;
+}
+
+Array<unsigned char> _hx_ssl_dgst_make( Array<unsigned char> buf, String alg ){
+ hx::strbuf ubuf;
+ const mbedtls_md_info_t *md = mbedtls_md_info_from_string(alg.utf8_str(&ubuf));
+ if( md == NULL )
+ hx::Throw( HX_CSTRING("Invalid hash algorithm") );
+
+ int size = mbedtls_md_get_size(md);
+ Array<unsigned char> out = Array_obj<int>::__new(size,size);
+ int r = -1;
+ if( r = mbedtls_md( md, &buf[0], buf->length, &out[0] ) != 0 )
+ ssl_error(r);
+
+ return out;
+}
+
+Array<unsigned char> _hx_ssl_dgst_sign( Array<unsigned char> buf, Dynamic hpkey, String alg ){
+ int r = -1;
+ size_t olen = 0;
+ unsigned char hash[32];
+ sslpkey *pk = val_pkey(hpkey);
+
+ hx::strbuf ubuf;
+ const mbedtls_md_info_t *md = mbedtls_md_info_from_string( alg.utf8_str(&ubuf) );
+ if( md == NULL )
+ hx::Throw( HX_CSTRING("Invalid hash algorithm") );
+
+ if( r = mbedtls_md( md, &buf[0], buf->length, hash ) != 0 )
+ ssl_error(r);
+
+ Array<unsigned char> result = Array_obj<unsigned char>::__new(MBEDTLS_MPI_MAX_SIZE,MBEDTLS_MPI_MAX_SIZE);
+ if( r = mbedtls_pk_sign( pk->k, mbedtls_md_get_type(md), hash, 0, &result[0], &olen, mbedtls_ctr_drbg_random, &ctr_drbg ) != 0 )
+ ssl_error(r);
+
+ result[olen] = 0;
+ result->__SetSize(olen);
+ return result;
+}
+
+bool _hx_ssl_dgst_verify( Array<unsigned char> buf, Array<unsigned char> sign, Dynamic hpkey, String alg ){
+ const mbedtls_md_info_t *md;
+ int r = -1;
+ unsigned char hash[32];
+ sslpkey *pk = val_pkey(hpkey);
+
+ hx::strbuf ubuf;
+ md = mbedtls_md_info_from_string( alg.utf8_str(&ubuf) );
+ if( md == NULL )
+ hx::Throw( HX_CSTRING("Invalid hash algorithm") );
+
+ if( r = mbedtls_md( md, &buf[0], buf->length, hash ) != 0 )
+ ssl_error(r);
+
+ if( r = mbedtls_pk_verify( pk->k, mbedtls_md_get_type(md), hash, 0, &sign[0], sign->length ) != 0 )
+ return false;
+
+ return true;
+}
+
+#if (_MSC_VER || defined(WIN32))
+
+static void threading_mutex_init_alt( mbedtls_threading_mutex_t *mutex ){
+ if( mutex == NULL )
+ return;
+ InitializeCriticalSection( &mutex->cs );
+ mutex->is_valid = 1;
+}
+
+static void threading_mutex_free_alt( mbedtls_threading_mutex_t *mutex ){
+ if( mutex == NULL || !mutex->is_valid )
+ return;
+ DeleteCriticalSection( &mutex->cs );
+ mutex->is_valid = 0;
+}
+
+static int threading_mutex_lock_alt( mbedtls_threading_mutex_t *mutex ){
+ if( mutex == NULL || !mutex->is_valid )
+ return( MBEDTLS_ERR_THREADING_BAD_INPUT_DATA );
+
+ EnterCriticalSection( &mutex->cs );
+ return( 0 );
+}
+
+static int threading_mutex_unlock_alt( mbedtls_threading_mutex_t *mutex ){
+ if( mutex == NULL || !mutex->is_valid )
+ return( MBEDTLS_ERR_THREADING_BAD_INPUT_DATA );
+
+ LeaveCriticalSection( &mutex->cs );
+ return( 0 );
+}
+
+#endif
+
+static bool _hx_ssl_inited = false;
+void _hx_ssl_init() {
+ if (_hx_ssl_inited) return;
+ _hx_ssl_inited = true;
+
+#if (_MSC_VER || defined(WIN32))
+ mbedtls_threading_set_alt( threading_mutex_init_alt, threading_mutex_free_alt,
+ threading_mutex_lock_alt, threading_mutex_unlock_alt );
+#endif
+
+ // Init RNG
+ mbedtls_entropy_init( &entropy );
+ mbedtls_ctr_drbg_init( &ctr_drbg );
+ mbedtls_ctr_drbg_seed( &ctr_drbg, mbedtls_entropy_func, &entropy, NULL, 0 );
+}
diff --git a/Sources/c_snikket/src/hx/libs/std/Build.xml b/Sources/c_snikket/src/hx/libs/std/Build.xml
new file mode 100644
index 0000000..f18ee01
--- /dev/null
+++ b/Sources/c_snikket/src/hx/libs/std/Build.xml
@@ -0,0 +1,26 @@
+<xml>
+
+<pragma once="true" />
+
+<files id="hxcpp_std" dir="${this_dir}" >
+ <depend files="hxcpp-depends"/>
+ <depend name="${this_dir}/Build.xml" dateOnly="true" />
+ <cache value="1" asLibrary="true" />
+
+ <file name="File.cpp"/>
+ <file name="Sys.cpp"/>
+ <file name="Process.cpp"/>
+ <file name="Random.cpp"/>
+ <file name="Socket.cpp" />
+
+</files>
+
+
+<target id="haxe">
+ <files id="hxcpp_std"/>
+ <lib name="ws2_32.lib" if="windows" unless="static_link" />
+ <lib name="-lsocket" if="blackberry" unless="static_link" />
+</target>
+
+
+</xml>
diff --git a/Sources/c_snikket/src/hx/libs/std/File.cpp b/Sources/c_snikket/src/hx/libs/std/File.cpp
new file mode 100644
index 0000000..57a364f
--- /dev/null
+++ b/Sources/c_snikket/src/hx/libs/std/File.cpp
@@ -0,0 +1,425 @@
+#include <hxcpp.h>
+#include <stdio.h>
+#include <string.h>
+#include <vector>
+
+#include <hx/OS.h>
+
+#ifdef NEKO_WINDOWS
+# include <windows.h>
+#endif
+
+/**
+ <doc>
+ <h1>File</h1>
+ <p>
+ The file api can be used for different kind of file I/O.
+ </p>
+ </doc>
+**/
+
+namespace
+{
+
+struct fio : public hx::Object
+{
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdFio };
+
+ String name;
+ FILE *io;
+ bool closeIo;
+
+ void create(FILE *inFile, String inName, bool inClose)
+ {
+ name = inName;
+ HX_OBJ_WB_GET(this,name.raw_ref());
+ io = inFile;
+ closeIo = inClose;
+
+ _hx_set_finalizer(this, finalize);
+ }
+
+ void destroy(bool inForceClose = false)
+ {
+ if (io && (inForceClose || closeIo))
+ fclose(io);
+ io = 0;
+ name = String();
+ }
+
+ void __Mark(hx::MarkContext *__inCtx) { HX_MARK_MEMBER(name); }
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx) { HX_VISIT_MEMBER(name); }
+ #endif
+
+ static void finalize(Dynamic inObj)
+ {
+ ((fio *)(inObj.mPtr))->destroy();
+ }
+
+ String toString() { return HX_CSTRING("fio:") + name; }
+
+};
+
+fio *getFio(Dynamic handle, bool inRequireFile=true)
+{
+ fio *result = dynamic_cast<fio *>(handle.mPtr);
+ if (!result || (!result->io && inRequireFile))
+ hx::Throw( HX_CSTRING("Bad file handle") );
+ return result;
+}
+
+
+static void file_error(const char *msg, String inName)
+{
+ hx::ExitGCFreeZone();
+ Array<String> err = Array_obj<String>::__new(2,2);
+ err[0] = String(msg);
+ err[1] = inName;
+ hx::Throw(err);
+}
+
+}
+
+/**
+ file_open : f:string -> r:string -> 'file
+ <doc>
+ Call the C function [fopen] with the file path and access rights.
+ Return the opened file or throw an exception if the file couldn't be open.
+ </doc>
+**/
+Dynamic _hx_std_file_open( String fname, String r )
+{
+ FILE *file = 0;
+
+ hx::strbuf buf0;
+ hx::strbuf buf1;
+#ifdef NEKO_WINDOWS
+ hx::EnterGCFreeZone();
+ file = _wfopen(fname.wchar_str(&buf0),r.wchar_str(&buf1));
+#else
+ hx::EnterGCFreeZone();
+ file = fopen(fname.utf8_str(&buf0),r.utf8_str(&buf1));
+#endif
+ if (!file)
+ file_error("file_open",fname);
+ hx::ExitGCFreeZone();
+
+ fio *f = new fio;
+ f->create(file,fname,true);
+ return f;
+}
+
+/**
+ file_close : 'file -> void
+ <doc>Close an file. Any other operations on this file will fail</doc>
+**/
+void _hx_std_file_close( Dynamic handle )
+{
+ fio *fio = getFio(handle);
+ fio->destroy(true);
+}
+
+/**
+ file_name : 'file -> string
+ <doc>Return the name of the file which was opened</doc>
+**/
+String hx_std_file_name( Dynamic handle )
+{
+ fio *fio = getFio(handle);
+ return fio->name;
+}
+
+/**
+ file_write : 'file -> s:string -> p:int -> l:int -> int
+ <doc>
+ Write up to [l] chars of string [s] starting at position [p].
+ Returns the number of chars written which is >= 0.
+ </doc>
+**/
+int _hx_std_file_write( Dynamic handle, Array<unsigned char> s, int p, int n )
+{
+ fio *f = getFio(handle);
+
+ int buflen = s->length;
+ int len = n;
+ if( p < 0 || len < 0 || p > buflen || p + len > buflen )
+ return 0;
+
+ hx::EnterGCFreeZone();
+ while( len > 0 )
+ {
+ POSIX_LABEL(file_write_again);
+ int d = (int)fwrite(&s[p],1,len,f->io);
+ if( d <= 0 )
+ {
+ HANDLE_FINTR(f->io,file_write_again);
+ file_error("file_write",f->name);
+ }
+ p += d;
+ len -= d;
+ }
+ hx::ExitGCFreeZone();
+ return n;
+}
+
+/**
+ file_read : 'file -> s:string -> p:int -> l:int -> int
+ <doc>
+ Read up to [l] chars into the string [s] starting at position [p].
+ Returns the number of chars readed which is > 0 (or 0 if l == 0).
+ </doc>
+**/
+int _hx_std_file_read( Dynamic handle, Array<unsigned char> buf, int p, int n )
+{
+ fio *f = getFio(handle);
+
+ int buf_len = buf->length;
+ int len = n;
+ if( p < 0 || len < 0 || p > buf_len || p + len > buf_len )
+ return 0;
+
+ hx::EnterGCFreeZone();
+ // Attempt to increase the chances of pinning on the stack...
+ unsigned char *bufPtr = &buf[0];
+ while( len > 0 )
+ {
+ POSIX_LABEL(file_read_again);
+ int d = (int)fread(bufPtr + p,1,len,f->io);
+ if( d <= 0 )
+ {
+ int size = n - len;
+ HANDLE_FINTR(f->io,file_read_again);
+ if( size == 0 )
+ file_error("file_read",f->name);
+ hx::ExitGCFreeZone();
+ return size;
+ }
+ p += d;
+ len -= d;
+ }
+ hx::ExitGCFreeZone();
+ return n;
+}
+
+/**
+ file_write_char : 'file -> c:int -> void
+ <doc>Write the char [c]. Error if [c] outside of the range 0..255</doc>
+**/
+void _hx_std_file_write_char( Dynamic handle, int c )
+{
+ fio *f = getFio(handle);
+ if( c < 0 || c > 255 )
+ return;
+ char cc = (char)c;
+
+ hx::EnterGCFreeZone();
+ POSIX_LABEL(write_char_again);
+ if( fwrite(&cc,1,1,f->io) != 1 )
+ {
+ HANDLE_FINTR(f->io,write_char_again);
+ file_error("file_write_char",f->name);
+ }
+ hx::ExitGCFreeZone();
+}
+
+/**
+ file_read_char : 'file -> int
+ <doc>Read a char from the file. Exception on error</doc>
+**/
+int _hx_std_file_read_char( Dynamic handle )
+{
+ fio *f = getFio(handle);
+
+ unsigned char cc = 0;
+ hx::EnterGCFreeZone();
+ POSIX_LABEL(read_char_again);
+ if( fread(&cc,1,1,f->io) != 1 )
+ {
+ HANDLE_FINTR(f->io,read_char_again);
+ file_error("file_read_char",f->name);
+ }
+ hx::ExitGCFreeZone();
+ return cc;
+}
+
+/**
+ file_seek : 'file -> pos:int -> mode:int -> void
+ <doc>Use [fseek] to move the file pointer.</doc>
+**/
+void _hx_std_file_seek( Dynamic handle, int pos, int kind )
+{
+ fio *f = getFio(handle);
+ hx::EnterGCFreeZone();
+ if( fseek(f->io,pos,kind) != 0 )
+ file_error("file_seek",f->name);
+ hx::ExitGCFreeZone();
+}
+
+/**
+ file_tell : 'file -> int
+ <doc>Return the current position in the file</doc>
+**/
+int _hx_std_file_tell( Dynamic handle )
+{
+ fio *f = getFio(handle);
+ hx::EnterGCFreeZone();
+ int p = ftell(f->io);
+ if( p == -1 )
+ file_error("file_tell",f->name);
+ hx::ExitGCFreeZone();
+ return p;
+}
+
+/**
+ file_eof : 'file -> bool
+ <doc>Tell if we have reached the end of the file</doc>
+**/
+bool _hx_std_file_eof( Dynamic handle )
+{
+ fio *f = getFio(handle);
+ return feof(f->io);
+}
+
+/**
+ file_flush : 'file -> void
+ <doc>Flush the file buffer</doc>
+**/
+void _hx_std_file_flush( Dynamic handle )
+{
+ fio *f = getFio(handle);
+ hx::EnterGCFreeZone();
+ if( fflush( f->io ) != 0 )
+ file_error("file_flush",f->name);
+ hx::ExitGCFreeZone();
+}
+
+/**
+ file_contents : f:string -> string
+ <doc>Read the content of the file [f] and return it.</doc>
+**/
+String _hx_std_file_contents_string( String name )
+{
+ std::vector<char> buffer;
+
+ hx::strbuf buf;
+#ifdef NEKO_WINDOWS
+ hx::EnterGCFreeZone();
+ FILE *file = _wfopen(name.wchar_str(&buf), L"rb");
+#else
+ hx::EnterGCFreeZone();
+ FILE *file = fopen(name.utf8_str(&buf), "rb");
+#endif
+ if(!file)
+ file_error("file_contents",name);
+
+ fseek(file,0,SEEK_END);
+ int len = ftell(file);
+ if (len<0)
+ file_error("file_ftell",name);
+ if (len==0)
+ {
+ fclose(file);
+ hx::ExitGCFreeZone();
+ return String::emptyString;
+ }
+
+ fseek(file,0,SEEK_SET);
+ buffer.resize(len);
+ int p = 0;
+ while( len > 0 )
+ {
+ POSIX_LABEL(file_contents);
+ int d = (int)fread(&buffer[p],1,len,file);
+ if( d <= 0 )
+ {
+ HANDLE_FINTR(file,file_contents);
+ fclose(file);
+ file_error("file_contents",name);
+ }
+ p += d;
+ len -= d;
+ }
+ fclose(file);
+ hx::ExitGCFreeZone();
+
+ return String::create(&buffer[0], buffer.size());
+}
+
+
+
+/**
+ file_contents : f:string -> string
+ <doc>Read the content of the file [f] and return it.</doc>
+**/
+Array<unsigned char> _hx_std_file_contents_bytes( String name )
+{
+ hx::strbuf buf;
+#ifdef NEKO_WINDOWS
+ hx::EnterGCFreeZone();
+ FILE *file = _wfopen(name.wchar_str(&buf), L"rb");
+#else
+ hx::EnterGCFreeZone();
+ FILE *file = fopen(name.utf8_str(&buf), "rb");
+#endif
+ if(!file)
+ file_error("file_contents",name);
+
+ fseek(file,0,SEEK_END);
+ int len = ftell(file);
+ if (len<0)
+ file_error("file_ftell",name);
+
+ fseek(file,0,SEEK_SET);
+ hx::ExitGCFreeZone();
+
+ Array<unsigned char> buffer = Array_obj<unsigned char>::__new(len,len);
+ hx::EnterGCFreeZone();
+ if (len)
+ {
+ char *dest = (char *)&buffer[0];
+
+ int p = 0;
+ while( len > 0 )
+ {
+ POSIX_LABEL(file_contents1);
+ int d = (int)fread(dest + p,1,len,file);
+ if( d <= 0 )
+ {
+ HANDLE_FINTR(file,file_contents1);
+ fclose(file);
+ file_error("file_contents",name);
+ }
+ p += d;
+ len -= d;
+ }
+ }
+ fclose(file);
+ hx::ExitGCFreeZone();
+ return buffer;
+}
+
+
+
+Dynamic _hx_std_file_stdin()
+{
+ fio *f = new fio();
+ f->create(stdin, HX_CSTRING("stdin"), false);
+ return f;
+}
+
+
+Dynamic _hx_std_file_stdout()
+{
+ fio *f = new fio();
+ f->create(stdout, HX_CSTRING("stdout"), false);
+ return f;
+}
+
+Dynamic _hx_std_file_stderr()
+{
+ fio *f = new fio();
+ f->create(stderr, HX_CSTRING("stderr"), false);
+ return f;
+}
+
diff --git a/Sources/c_snikket/src/hx/libs/std/Process.cpp b/Sources/c_snikket/src/hx/libs/std/Process.cpp
new file mode 100644
index 0000000..d9f020e
--- /dev/null
+++ b/Sources/c_snikket/src/hx/libs/std/Process.cpp
@@ -0,0 +1,603 @@
+#include <hxcpp.h>
+#include <hx/OS.h>
+
+#if !defined(HX_WINRT) && !defined(EPPC)
+
+#ifdef NEKO_WINDOWS
+# include <windows.h>
+#else
+# include <sys/types.h>
+# include <unistd.h>
+# include <memory.h>
+# include <errno.h>
+# include <signal.h>
+# if defined(ANDROID) || defined(BLACKBERRY) || defined(EMSCRIPTEN)
+# include <sys/wait.h>
+# elif !defined(NEKO_MAC)
+# include <wait.h>
+# endif
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <vector>
+#include <string>
+
+namespace
+{
+
+#ifndef NEKO_WINDOWS
+static int do_close( int fd )
+{
+ POSIX_LABEL(close_again);
+ if( close(fd) != 0 ) {
+ HANDLE_EINTR(close_again);
+ return 1;
+ }
+ return 0;
+}
+#endif
+
+
+struct vprocess : public hx::Object
+{
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdProcess };
+
+ bool open;
+#ifdef NEKO_WINDOWS
+ HANDLE oread;
+ HANDLE eread;
+ HANDLE iwrite;
+ PROCESS_INFORMATION pinf;
+ #define HANDLE_INIT 0
+#else
+ int oread;
+ int eread;
+ int iwrite;
+ int pid;
+ #define HANDLE_INIT -1
+#endif
+
+ void create()
+ {
+ open = true;
+ oread = HANDLE_INIT;
+ eread = HANDLE_INIT;
+ iwrite = HANDLE_INIT;
+ _hx_set_finalizer(this, finalize);
+ }
+
+ void destroy()
+ {
+ if (open)
+ {
+ #ifdef NEKO_WINDOWS
+ if (eread)
+ CloseHandle(eread);
+ if (oread)
+ CloseHandle(oread);
+ if (iwrite)
+ CloseHandle(iwrite);
+ CloseHandle(pinf.hProcess);
+ CloseHandle(pinf.hThread);
+ #else
+ if (eread!=-1)
+ do_close(eread);
+ if (oread!=-1)
+ do_close(oread);
+ if (iwrite!=-1)
+ do_close(iwrite);
+ #endif
+ open = false;
+ }
+ }
+
+ static void finalize(Dynamic obj)
+ {
+ ((vprocess *)(obj.mPtr))->destroy();
+ }
+
+ String toString() { return HX_CSTRING("vprocess"); }
+};
+
+vprocess *getProcess(Dynamic handle)
+{
+ vprocess *p = dynamic_cast<vprocess *>(handle.mPtr);
+ if (!p)
+ hx::Throw(HX_CSTRING("Invalid process"));
+ return p;
+}
+
+
+/**
+ <doc>
+ <h1>Process</h1>
+ <p>
+ An API for starting and communication with sub processes.
+ </p>
+ </doc>
+**/
+
+} // end anon namespace
+
+
+
+template<typename T>
+static String TQuoted(const T *ptr, int len)
+{
+ std::vector<T> quoted;
+ quoted.reserve(len*2);
+
+ unsigned int bs_count = 0;
+ for(int j=0;j<len;j++)
+ {
+ T c = ptr[j];
+ switch( c )
+ {
+ case '"':
+ // Double backslashes.
+ for (int k=0;k<bs_count*2;k++)
+ quoted.push_back('\\');
+ bs_count = 0;
+ quoted.push_back('\\');
+ quoted.push_back('"');
+ break;
+ case '\\':
+ // Don't know if we need to double yet.
+ bs_count++;
+ break;
+ default:
+ // Normal char
+ for (int k=0;k<bs_count;k++)
+ quoted.push_back('\\');
+ bs_count = 0;
+ quoted.push_back(c);
+ break;
+ }
+ }
+ // Add remaining backslashes, if any.
+ for (int k=0;k<bs_count*2;k++)
+ quoted.push_back('\\');
+ int qlen = (int)quoted.size();
+ quoted.push_back('\0');
+
+ return String::create( "ed[0], qlen );
+}
+
+static String quoteString(String v)
+{
+ #ifdef HX_SMART_STRINGS
+ if (v.isUTF16Encoded())
+ return TQuoted(v.raw_wptr(),v.length);
+ #endif
+ return TQuoted(v.raw_ptr(),v.length);
+}
+
+
+
+/**
+ process_run : cmd:string -> args:string array -> 'process
+ <doc>
+ Start a process using a command.
+ When args is not null, cmd and args will be auto-quoted/escaped.
+ If no auto-quoting/escaping is desired, you should append necessary
+ arguments to cmd as if it is inputted to the shell directly, and pass
+ null to args.
+
+ inShowParam = only for windows, SHOW_* from "ShowWindow" function
+ default = 1 = SHOW_WINDOW
+ </doc>
+**/
+Dynamic _hx_std_process_run( String cmd, Array<String> vargs, int inShowParam )
+{
+ #if defined(APPLETV) || defined(HX_APPLEWATCH)
+ return null();
+
+ #else
+ vprocess *p = 0;
+ bool isRaw = !vargs.mPtr;
+
+ #ifdef NEKO_WINDOWS
+ {
+ SECURITY_ATTRIBUTES sattr;
+ STARTUPINFOW sinf;
+ HANDLE proc = GetCurrentProcess();
+ HANDLE oread,eread,iwrite;
+ // creates commandline
+ String b;
+ if (isRaw)
+ {
+ b = HX_CSTRING("\"");
+ const char* cmdexe = getenv("COMSPEC");
+ if (!cmdexe) cmdexe = "cmd.exe";
+ b += String(cmdexe) + HX_CSTRING("\" /C \"") + cmd + HX_CSTRING("\"");
+ }
+ else
+ {
+ b = HX_CSTRING("\"") + cmd + HX_CSTRING("\"");
+
+ for(int i=0;i<vargs->length;i++)
+ {
+ b += HX_CSTRING(" \"");
+ if (vargs[i].length)
+ b += quoteString(vargs[i]);
+ b += HX_CSTRING("\"");
+ }
+ }
+
+ const wchar_t *name = b.__WCStr();
+
+ hx::EnterGCFreeZone();
+ // startup process
+ sattr.nLength = sizeof(sattr);
+ sattr.bInheritHandle = TRUE;
+ sattr.lpSecurityDescriptor = NULL;
+ memset(&sinf,0,sizeof(sinf));
+ sinf.cb = sizeof(sinf);
+ sinf.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
+ sinf.wShowWindow = inShowParam;
+ CreatePipe(&oread,&sinf.hStdOutput,&sattr,0);
+ CreatePipe(&eread,&sinf.hStdError,&sattr,0);
+ CreatePipe(&sinf.hStdInput,&iwrite,&sattr,0);
+
+ HANDLE procOread,procEread,procIwrite;
+
+ DuplicateHandle(proc,oread,proc,&procOread,0,FALSE,DUPLICATE_SAME_ACCESS);
+ DuplicateHandle(proc,eread,proc,&procEread,0,FALSE,DUPLICATE_SAME_ACCESS);
+ DuplicateHandle(proc,iwrite,proc,&procIwrite,0,FALSE,DUPLICATE_SAME_ACCESS);
+ CloseHandle(oread);
+ CloseHandle(eread);
+ CloseHandle(iwrite);
+ //printf("Cmd %s\n",val_string(cmd));
+ PROCESS_INFORMATION pinf;
+ memset(&pinf,0,sizeof(pinf));
+ if( !CreateProcessW(NULL,(wchar_t *)name,NULL,NULL,TRUE,CREATE_NO_WINDOW,NULL,NULL,&sinf,&pinf) )
+ {
+ hx::ExitGCFreeZone();
+ hx::Throw(HX_CSTRING("Could not start process"));
+ }
+ // close unused pipes
+ CloseHandle(sinf.hStdOutput);
+ CloseHandle(sinf.hStdError);
+ CloseHandle(sinf.hStdInput);
+ hx::ExitGCFreeZone();
+
+ p = new vprocess;
+ p->create();
+ p->oread = procOread;
+ p->eread = procEread;
+ p->iwrite = procIwrite;
+ p->pinf = pinf;
+ }
+ #else // not windows ...
+ {
+ int input[2], output[2], error[2];
+ if( pipe(input) || pipe(output) || pipe(error) )
+ return null();
+
+ hx::strbuf buf;
+ std::vector< std::string > values;
+ if (isRaw)
+ {
+ values.resize(3);
+ values[0] = "/bin/sh";
+ values[1] = "-c";
+ values[2] = cmd.utf8_str(&buf);
+ }
+ else
+ {
+ values.resize(vargs->length+1);
+
+ values[0] = cmd.utf8_str(&buf);
+ for(int i=0;i<vargs->length;i++)
+ values[i+1] = vargs[i].utf8_str(&buf);
+ }
+
+ std::vector<const char *> argv(values.size()+1);
+ for(int i=0;i<values.size();i++)
+ argv[i] = values[i].c_str();
+
+ int pid = fork();
+ if( pid == -1 )
+ return null();
+
+ // child
+ if( pid == 0 )
+ {
+ close(input[1]);
+ close(output[0]);
+ close(error[0]);
+ dup2(input[0],0);
+ dup2(output[1],1);
+ dup2(error[1],2);
+ execvp(argv[0],(char* const*)&argv[0]);
+ fprintf(stderr,"Command not found : %S\n",cmd.wchar_str());
+ exit(1);
+ }
+
+ // parent
+ do_close(input[0]);
+ do_close(output[1]);
+ do_close(error[1]);
+
+ p = new vprocess;
+ p->create();
+ p->iwrite = input[1];
+ p->oread = output[0];
+ p->eread = error[0];
+ p->pid = pid;
+ }
+ #endif
+
+ return p;
+
+ #endif // not APPLETV/HX_APPLEWATCH
+}
+
+
+/**
+ process_stdout_read : 'process -> buf:string -> pos:int -> len:int -> int
+ <doc>
+ Read up to [len] bytes in [buf] starting at [pos] from the process stdout.
+ Returns the number of bytes readed this way. Raise an exception if this
+ process stdout is closed and no more data is available for reading.
+
+ For hxcpp, the input buffer is in bytes, not characters
+ </doc>
+**/
+int _hx_std_process_stdout_read( Dynamic handle, Array<unsigned char> buf, int pos, int len )
+{
+ if( pos < 0 || len < 0 || pos + len > buf->length )
+ return 0;
+ vprocess *p = getProcess(handle);
+
+ unsigned char *dest = &buf[0];
+ hx::EnterGCFreeZone();
+ #ifdef NEKO_WINDOWS
+ DWORD nbytes = 0;
+ if( !ReadFile(p->oread,dest+pos,len,&nbytes,0) )
+ nbytes = 0;
+ #else
+ int nbytes = read(p->oread,dest + pos,len);
+ if( nbytes <= 0 )
+ nbytes = 0;
+ #endif
+
+ hx::ExitGCFreeZone();
+ return nbytes;
+}
+
+
+/**
+ process_stderr_read : 'process -> buf:string -> pos:int -> len:int -> int
+ <doc>
+ Read up to [len] bytes in [buf] starting at [pos] from the process stderr.
+ Returns the number of bytes readed this way. Raise an exception if this
+ process stderr is closed and no more data is available for reading.
+ </doc>
+**/
+int _hx_std_process_stderr_read( Dynamic handle, Array<unsigned char> buf, int pos, int len )
+{
+ if( pos < 0 || len < 0 || pos + len > buf->length )
+ return 0;
+ vprocess *p = getProcess(handle);
+
+ unsigned char *dest = &buf[0];
+ hx::EnterGCFreeZone();
+ #ifdef NEKO_WINDOWS
+ DWORD nbytes = 0;
+ if( !ReadFile(p->eread,dest+pos,len,&nbytes,0) )
+ nbytes = 0;
+ #else
+ int nbytes = read(p->eread,dest + pos,len);
+ if( nbytes <= 0 )
+ nbytes = 0;
+ #endif
+
+ hx::ExitGCFreeZone();
+ return nbytes;
+}
+
+/**
+ process_stdin_write : 'process -> buf:string -> pos:int -> len:int -> int
+ <doc>
+ Write up to [len] bytes from [buf] starting at [pos] to the process stdin.
+ Returns the number of bytes writen this way. Raise an exception if this
+ process stdin is closed.
+ </doc>
+**/
+int _hx_std_process_stdin_write( Dynamic handle, Array<unsigned char> buf, int pos, int len )
+{
+ if( pos < 0 || len < 0 || pos + len > buf->length )
+ return 0;
+ vprocess *p = getProcess(handle);
+
+ unsigned char *src = &buf[0];
+
+
+ hx::EnterGCFreeZone();
+ #ifdef NEKO_WINDOWS
+ DWORD nbytes =0;
+ if( !WriteFile(p->iwrite,src+pos,len,&nbytes,0) )
+ nbytes = 0;
+ #else
+ int nbytes = write(p->iwrite,src+pos,len);
+ if( nbytes == -1 )
+ nbytes = 0;
+ #endif
+
+ hx::ExitGCFreeZone();
+ return nbytes;
+}
+
+/**
+ process_stdin_close : 'process -> void
+ <doc>
+ Close the process standard input.
+ </doc>
+**/
+void _hx_std_process_stdin_close( Dynamic handle )
+{
+ vprocess *p = getProcess(handle);
+
+ #ifdef NEKO_WINDOWS
+ if ( p->iwrite )
+ CloseHandle(p->iwrite);
+ #else
+ if( p->iwrite!=-1 )
+ do_close(p->iwrite);
+ #endif
+ p->iwrite = HANDLE_INIT;
+}
+
+/**
+ process_exit : 'process -> int
+ <doc>
+ Wait until the process terminate, then returns its exit code.
+ </doc>
+**/
+#if (HXCPP_API_LEVEL > 420)
+Dynamic _hx_std_process_exit( Dynamic handle, bool block )
+{
+ vprocess *p = getProcess(handle);
+
+ hx::EnterGCFreeZone();
+ #ifdef NEKO_WINDOWS
+ {
+ DWORD rval;
+ DWORD wait = INFINITE;
+ if (!block)
+ wait = 0;
+
+ WaitForSingleObject(p->pinf.hProcess,wait);
+ hx::ExitGCFreeZone();
+
+ if( !GetExitCodeProcess(p->pinf.hProcess,&rval) && block)
+ return 0;
+ else if (!block && rval == STILL_ACTIVE)
+ return null();
+ else
+ return rval;
+ }
+ #else
+ int options=0;
+ if (!block)
+ options = WNOHANG;
+
+ int rval=0;
+ pid_t ret=-1;
+ while( (ret = waitpid(p->pid,&rval,options)) != p->pid )
+ {
+ if( errno == EINTR )
+ continue;
+
+ if (!block && ret == 0)
+ {
+ hx::ExitGCFreeZone();
+ return null();
+ }
+
+ hx::ExitGCFreeZone();
+ return 0;
+ }
+ hx::ExitGCFreeZone();
+ if( !WIFEXITED(rval) )
+ return 0;
+
+ return WEXITSTATUS(rval);
+ #endif
+}
+#else
+int _hx_std_process_exit( Dynamic handle )
+{
+ vprocess *p = getProcess(handle);
+
+ hx::EnterGCFreeZone();
+ #ifdef NEKO_WINDOWS
+ {
+ DWORD rval;
+ WaitForSingleObject(p->pinf.hProcess,INFINITE);
+ hx::ExitGCFreeZone();
+
+ if( !GetExitCodeProcess(p->pinf.hProcess,&rval) )
+ return 0;
+ return rval;
+ }
+ #else
+ int rval=0;
+ while( waitpid(p->pid,&rval,0) != p->pid )
+ {
+ if( errno == EINTR )
+ continue;
+ hx::ExitGCFreeZone();
+ return 0;
+ }
+ hx::ExitGCFreeZone();
+ if( !WIFEXITED(rval) )
+ return 0;
+
+ return WEXITSTATUS(rval);
+ #endif
+}
+#endif
+
+/**
+ process_pid : 'process -> int
+ <doc>
+ Returns the process id.
+ </doc>
+**/
+int _hx_std_process_pid( Dynamic handle )
+{
+ vprocess *p = getProcess(handle);
+
+ #ifdef NEKO_WINDOWS
+ return p->pinf.dwProcessId;
+ #else
+ return p->pid;
+ #endif
+}
+
+void _hx_std_process_kill( Dynamic handle )
+{
+ vprocess *p = getProcess(handle);
+
+ #ifdef NEKO_WINDOWS
+ TerminateProcess(p->pinf.hProcess, -1);
+ #else
+ kill(p->pid, SIGTERM);
+ #endif
+}
+
+
+
+/**
+ process_close : 'process -> void
+ <doc>
+ Close the process I/O.
+ </doc>
+**/
+void _hx_std_process_close( Dynamic handle )
+{
+ vprocess *p = getProcess(handle);
+ p->destroy();
+}
+
+#else // !HX_WINRT
+
+Dynamic _hx_std_process_run( String cmd, Array<String> vargs, int inShowParam ){ return null(); }
+int _hx_std_process_stdout_read( Dynamic handle, Array<unsigned char> buf, int pos, int len ) { return 0; }
+int _hx_std_process_stderr_read( Dynamic handle, Array<unsigned char> buf, int pos, int len ) { return 0; }
+int _hx_std_process_stdin_write( Dynamic handle, Array<unsigned char> buf, int pos, int len ) { return 0; }
+void _hx_std_process_stdin_close( Dynamic handle ) { }
+#if (HXCPP_API_LEVEL > 420)
+Dynamic _hx_std_process_exit( Dynamic handle, bool block ) { return 0; }
+#else
+int _hx_std_process_exit( Dynamic handle ) { return 0; }
+#endif
+int _hx_std_process_pid( Dynamic handle ) { return 0; }
+void _hx_std_process_close( Dynamic handle ) { }
+void _hx_std_process_kill( Dynamic handle ) { }
+
+#endif // HX_WINRT
+
diff --git a/Sources/c_snikket/src/hx/libs/std/Random.cpp b/Sources/c_snikket/src/hx/libs/std/Random.cpp
new file mode 100644
index 0000000..af59c15
--- /dev/null
+++ b/Sources/c_snikket/src/hx/libs/std/Random.cpp
@@ -0,0 +1,178 @@
+#include <hxcpp.h>
+#include <hx/OS.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <time.h>
+#include <string.h>
+#ifdef HX_WINDOWS
+# include <windows.h>
+# include <process.h>
+#elif defined(EPPC)
+# include <time.h>
+#else
+# include <sys/time.h>
+# include <sys/types.h>
+# include <unistd.h>
+#endif
+
+
+/**
+ <doc>
+ <h1>Random</h1>
+ <p>A seeded pseudo-random generator</p>
+ </doc>
+**/
+
+
+
+#define NSEEDS 25
+#define MAX 7
+
+namespace
+{
+
+struct rnd : public hx::Object
+{
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdRandom };
+
+ unsigned long seeds[NSEEDS];
+ unsigned long cur;
+
+ String toString() { return HX_CSTRING("rand"); }
+};
+
+static unsigned long mag01[2]={
+ 0x0, 0x8ebfd028 // magic, don't change
+};
+
+static const unsigned long init_seeds[] = {
+ 0x95f24dab, 0x0b685215, 0xe76ccae7, 0xaf3ec239, 0x715fad23,
+ 0x24a590ad, 0x69e4b5ef, 0xbf456141, 0x96bc1b7b, 0xa7bdf825,
+ 0xc1de75b7, 0x8858a9c9, 0x2da87693, 0xb657f9dd, 0xffdc8a9f,
+ 0x8121da71, 0x8b823ecb, 0x885d05f5, 0x4e20cd47, 0x5a9ad5d9,
+ 0x512c0c03, 0xea857ccd, 0x4cc1d30f, 0x8891a8a1, 0xa6b7aadb
+};
+
+
+
+static void rnd_set_seed( rnd *r, int s )
+{
+ int i;
+ r->cur = 0;
+ memcpy(r->seeds,init_seeds,sizeof(init_seeds));
+ for(i=0;i<NSEEDS;i++)
+ r->seeds[i] ^= s;
+}
+
+rnd *getRnd(Dynamic handle)
+{
+ rnd *r = dynamic_cast<rnd *>(handle.mPtr);
+ if (!r)
+ hx::Throw(HX_CSTRING("Invalid random handle"));
+ return r;
+}
+
+} // end anon namespace
+
+Dynamic _hx_std_random_new()
+{
+ rnd *r = new rnd();
+
+#if defined(NEKO_WINDOWS)
+ #if defined(HX_WINRT) && defined(__cplusplus_winrt)
+ int pid = Windows::Security::Cryptography::CryptographicBuffer::GenerateRandomNumber();
+ #else
+ int pid = GetCurrentProcessId();
+ #endif
+#elif defined(EPPC)
+ int pid = 1;
+#else
+ int pid = getpid();
+#endif
+
+ unsigned int t;
+#ifdef HX_WINRT
+ t = (unsigned int)GetTickCount64();
+#elif defined(NEKO_WINDOWS)
+ t = GetTickCount();
+#elif defined(EPPC)
+ time_t tod;
+ time(&tod);
+ t = (double)tod;
+#else
+ struct timeval tv;
+ gettimeofday(&tv,NULL);
+ t = tv.tv_sec * 1000000 + tv.tv_usec;
+#endif
+
+
+ rnd_set_seed(r,t ^ (pid | (pid << 16)));
+ return r;
+}
+
+static unsigned int rnd_int( rnd *r )
+{
+ unsigned int y;
+ int pos = r->cur++;
+ if( pos >= NSEEDS ) {
+ int kk;
+ for(kk=0;kk<NSEEDS-MAX;kk++)
+ r->seeds[kk] = r->seeds[kk+MAX] ^ (r->seeds[kk] >> 1) ^ mag01[r->seeds[kk] % 2];
+ for(;kk<NSEEDS;kk++)
+ r->seeds[kk] = r->seeds[kk+(MAX-NSEEDS)] ^ (r->seeds[kk] >> 1) ^ mag01[r->seeds[kk] % 2];
+ r->cur = 1;
+ pos = 0;
+ }
+ y = r->seeds[pos];
+ y ^= (y << 7) & 0x2b5b2500;
+ y ^= (y << 15) & 0xdb8b0000;
+ y ^= (y >> 16);
+ return y;
+}
+
+static double rnd_float( rnd *r )
+{
+ double big = 4294967296.0;
+ return ((rnd_int(r) / big + rnd_int(r)) / big + rnd_int(r)) / big;
+}
+
+/**
+ random_new : void -> 'random
+ <doc>Create a new random with random seed</doc>
+**/
+
+
+#include<stdlib.h>
+
+
+/**
+ random_set_seed : 'random -> int -> void
+ <doc>Set the generator seed</doc>
+**/
+void _hx_std_random_set_seed( Dynamic handle, int v )
+{
+ rnd_set_seed( getRnd(handle) ,v);
+}
+
+/**
+ random_int : 'random -> max:int -> int
+ <doc>Return a random integer modulo [max]</doc>
+**/
+int _hx_std_random_int( Dynamic handle, int max )
+{
+ if( max <= 0 )
+ return 0;
+ return (rnd_int( getRnd(handle)) & 0x3FFFFFFF) % max;
+}
+
+/**
+ random_float : 'random -> float
+ <doc>Return a random float</doc>
+**/
+double _hx_std_random_float( Dynamic handle )
+{
+ return rnd_float(getRnd(handle));
+}
+
+
diff --git a/Sources/c_snikket/src/hx/libs/std/Socket.cpp b/Sources/c_snikket/src/hx/libs/std/Socket.cpp
new file mode 100644
index 0000000..fe77cdc
--- /dev/null
+++ b/Sources/c_snikket/src/hx/libs/std/Socket.cpp
@@ -0,0 +1,1392 @@
+#if !defined(HX_WINRT) && !defined(EPPC)
+#include <hxcpp.h>
+#include <hx/OS.h>
+
+#include <string.h>
+
+
+#ifdef NEKO_WINDOWS
+
+#ifdef __GNUC__
+ // Mingw / gcc on windows
+ #define _WIN32_WINNT 0x0501
+ #include <winsock2.h>
+ #include <ws2tcpip.h>
+#else
+ // Windows...
+ #include <winsock2.h>
+ #include <In6addr.h>
+ #include <Ws2tcpip.h>
+#endif
+
+
+#define DYNAMIC_INET_FUNCS 1
+typedef WINSOCK_API_LINKAGE INT (WSAAPI *inet_pton_func)( INT Family, PCSTR pszAddrString, PVOID pAddrBuf);
+typedef WINSOCK_API_LINKAGE PCSTR (WSAAPI *inet_ntop_func)(INT Family, PVOID pAddr, PSTR pStringBuf, size_t StringBufSize);
+
+
+
+
+
+# define FDSIZE(n) (sizeof(u_int) + (n) * sizeof(SOCKET))
+# define SHUT_WR SD_SEND
+# define SHUT_RD SD_RECEIVE
+# define SHUT_RDWR SD_BOTH
+ static bool init_done = false;
+ static WSADATA init_data;
+typedef int SocketLen;
+#else
+# include <sys/types.h>
+# include <sys/socket.h>
+# include <sys/time.h>
+# include <netinet/in.h>
+# include <netinet/tcp.h>
+# include <arpa/inet.h>
+# include <unistd.h>
+# include <netdb.h>
+# include <fcntl.h>
+# include <errno.h>
+# include <stdio.h>
+# include <poll.h>
+ typedef int SOCKET;
+# define closesocket close
+# define SOCKET_ERROR (-1)
+# define INVALID_SOCKET (-1)
+typedef socklen_t SocketLen;
+#endif
+
+#if (defined(NEKO_WINDOWS) || defined(NEKO_MAC)) && !defined(MSG_NOSIGNAL)
+# define MSG_NOSIGNAL 0
+#endif
+
+
+
+namespace
+{
+
+static int socketType = 0;
+
+struct SocketWrapper : public hx::Object
+{
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdSocket };
+
+ SOCKET socket;
+
+ int __GetType() const { return socketType; }
+};
+
+
+SOCKET val_sock(Dynamic inValue)
+{
+ if (inValue.mPtr)
+ {
+ int type = inValue->__GetType();
+ if (type==vtClass)
+ {
+ inValue = inValue->__Field( HX_CSTRING("__s"), hx::paccNever );
+ if (inValue.mPtr==0)
+ return 0;
+ type = inValue->__GetType();
+ }
+
+ if (type==socketType)
+ return static_cast<SocketWrapper *>(inValue.mPtr)->socket;
+ }
+
+ hx::Throw(HX_CSTRING("Invalid socket handle"));
+ return 0;
+}
+
+
+void reset_sock(Dynamic inValue)
+{
+ if (inValue.mPtr)
+ {
+ int type = inValue->__GetType();
+ if (type==vtClass)
+ {
+ inValue = inValue->__Field( HX_CSTRING("__s"), hx::paccNever );
+ if (inValue.mPtr==0)
+ return;
+ type = inValue->__GetType();
+ }
+
+ if (type==socketType) {
+ static_cast<SocketWrapper *>(inValue.mPtr)->socket = INVALID_SOCKET;
+ return;
+ }
+ }
+
+ hx::Throw(HX_CSTRING("Invalid socket handle"));
+}
+
+
+/**
+ <doc>
+ <h1>Socket</h1>
+ <p>
+ TCP and UDP sockets
+ </p>
+ </doc>
+**/
+
+static void block_error()
+{
+
+#ifdef NEKO_WINDOWS
+ int err = WSAGetLastError();
+ // call ExitGCFreeZone after WSAGetLastError, WSAGetLastError is just an alias for GetLastError and
+ // calling ExitGCFreeZone will on some cases clear the lastError code.
+ hx::ExitGCFreeZone();
+ if( err == WSAEWOULDBLOCK || err == WSAEALREADY )
+
+#else
+ hx::ExitGCFreeZone();
+ if( errno == EAGAIN || errno == EWOULDBLOCK || errno == EINPROGRESS || errno == EALREADY )
+#endif
+ hx::Throw(HX_CSTRING("Blocking"));
+ else {
+ hx::Throw(HX_CSTRING("EOF"));
+ }
+}
+
+}
+
+/**
+ socket_init : void -> void
+ <doc>
+ Initialize the socket API. Must be called at least once per process
+ before using any socket or host function.
+ </doc>
+**/
+void _hx_std_socket_init()
+{
+#ifdef NEKO_WINDOWS
+ if( !init_done ) {
+ WSAStartup(MAKEWORD(2,0),&init_data);
+ init_done = true;
+ }
+#endif
+}
+
+
+/**
+ socket_new : udp:bool -> 'socket
+ <doc>Create a new socket, TCP or UDP</doc>
+**/
+Dynamic _hx_std_socket_new( bool udp, bool ipv6 )
+{
+ if (!socketType)
+ socketType = hxcpp_alloc_kind();
+
+ SOCKET s;
+ int family = ipv6 ? AF_INET6 : AF_INET;
+ if( udp )
+ s = socket(family,SOCK_DGRAM,0);
+ else
+ s = socket(family,SOCK_STREAM,0);
+
+ if( s == INVALID_SOCKET )
+ return null();
+
+ #ifdef NEKO_MAC
+ int set = 1;
+ setsockopt(s,SOL_SOCKET,SO_NOSIGPIPE,(void *)&set, sizeof(int));
+ #endif
+
+ #ifdef NEKO_POSIX
+ // we don't want sockets to be inherited in case of exec
+ int old = fcntl(s,F_GETFD,0);
+ if( old >= 0 ) fcntl(s,F_SETFD,old|FD_CLOEXEC);
+ #endif
+
+ SocketWrapper *wrap = new SocketWrapper();
+ wrap->socket = s;
+ return wrap;
+}
+
+/**
+ socket_close : 'socket -> void
+ <doc>Close a socket. Any subsequent operation on this socket will fail</doc>
+**/
+void _hx_std_socket_close( Dynamic handle )
+{
+ SOCKET s = val_sock(handle);
+ POSIX_LABEL(close_again);
+ if( s != INVALID_SOCKET && closesocket(s) ) {
+ HANDLE_EINTR(close_again);
+ }
+ reset_sock(handle);
+}
+
+/**
+ socket_send_char : 'socket -> int -> void
+ <doc>Send a character over a connected socket. Must be in the range 0..255</doc>
+**/
+void _hx_std_socket_send_char( Dynamic o, int c )
+{
+ SOCKET sock = val_sock(o);
+ if( c < 0 || c > 255 )
+ return;
+
+ unsigned char cc = (unsigned char)c;
+
+ hx::EnterGCFreeZone();
+ POSIX_LABEL(send_char_again);
+ if( send(sock,(const char *)&cc,1,MSG_NOSIGNAL) == SOCKET_ERROR )
+ {
+ HANDLE_EINTR(send_char_again);
+ block_error();
+ }
+ hx::ExitGCFreeZone();
+}
+
+/**
+ socket_send : 'socket -> buf:string -> pos:int -> len:int -> int
+ <doc>Send up to [len] bytes from [buf] starting at [pos] over a connected socket.
+ Return the number of bytes sent.</doc>
+**/
+int _hx_std_socket_send( Dynamic o, Array<unsigned char> buf, int p, int l )
+{
+ SOCKET sock = val_sock(o);
+ int dlen = buf->length;
+ if( p < 0 || l < 0 || p > dlen || p + l > dlen )
+ return 0;
+
+ const char *base = (const char *)&buf[0];
+ hx::EnterGCFreeZone();
+ dlen = send(sock, base + p , l, MSG_NOSIGNAL);
+ if( dlen == SOCKET_ERROR )
+ block_error();
+ hx::ExitGCFreeZone();
+ return dlen;
+}
+
+/**
+ socket_recv : 'socket -> buf:string -> pos:int -> len:int -> int
+ <doc>Read up to [len] bytes from [buf] starting at [pos] from a connected socket.
+ Return the number of bytes readed.</doc>
+**/
+int _hx_std_socket_recv( Dynamic o, Array<unsigned char> buf, int p, int l )
+{
+ SOCKET sock = val_sock(o);
+ int dlen = buf->length;
+ if( p < 0 || l < 0 || p > dlen || p + l > dlen )
+ return 0;
+
+ char *base = (char *)&buf[0];
+ hx::EnterGCFreeZone();
+ POSIX_LABEL(recv_again);
+ dlen = recv(sock, base + p, l, MSG_NOSIGNAL);
+ if( dlen == SOCKET_ERROR )
+ {
+ HANDLE_EINTR(recv_again);
+ block_error();
+ }
+ hx::ExitGCFreeZone();
+ return dlen;
+}
+
+/**
+ socket_recv_char : 'socket -> int
+ <doc>Read a single char from a connected socket.</doc>
+**/
+int _hx_std_socket_recv_char( Dynamic o )
+{
+ SOCKET sock = val_sock(o);
+
+ hx::EnterGCFreeZone();
+ POSIX_LABEL(recv_char_again);
+ unsigned char cc = 0;
+ int ret = recv(sock,(char *)&cc,1,MSG_NOSIGNAL);
+ if( ret == SOCKET_ERROR )
+ {
+ HANDLE_EINTR(recv_char_again);
+ block_error();
+ }
+ hx::ExitGCFreeZone();
+ if( ret == 0 )
+ hx::Throw(HX_CSTRING("Connection closed"));
+ return cc;
+}
+
+
+/**
+ socket_write : 'socket -> string -> void
+ <doc>Send the whole content of a string over a connected socket.</doc>
+**/
+void _hx_std_socket_write( Dynamic o, Array<unsigned char> buf )
+{
+ SOCKET sock = val_sock(o);
+ int datalen = buf->length;
+ const char *cdata = (const char *)&buf[0];
+ int pos = 0;
+
+ hx::EnterGCFreeZone();
+ while( datalen > 0 )
+ {
+ POSIX_LABEL(write_again);
+ int slen = send(sock,cdata + pos,datalen,MSG_NOSIGNAL);
+ if( slen == SOCKET_ERROR ) {
+ HANDLE_EINTR(write_again);
+ block_error();
+ }
+ pos += slen;
+ datalen -= slen;
+ }
+ hx::ExitGCFreeZone();
+}
+
+
+/**
+ socket_read : 'socket -> string
+ <doc>Read the whole content of a the data available from a socket until the connection close.
+ If the socket hasn't been close by the other side, the function might block.
+ </doc>
+**/
+Array<unsigned char> _hx_std_socket_read( Dynamic o )
+{
+ SOCKET sock = val_sock(o);
+ Array<unsigned char> result = Array_obj<unsigned char>::__new();
+ char buf[256];
+
+ hx::EnterGCFreeZone();
+ while( true )
+ {
+ POSIX_LABEL(read_again);
+ int len = recv(sock,buf,256,MSG_NOSIGNAL);
+ if( len == SOCKET_ERROR ) {
+ HANDLE_EINTR(read_again);
+ block_error();
+ }
+ if( len == 0 )
+ break;
+
+ hx::ExitGCFreeZone();
+ result->memcpy(result->length, (unsigned char *)buf, len );
+ hx::EnterGCFreeZone();
+ }
+
+ hx::ExitGCFreeZone();
+ return result;
+}
+
+/**
+ host_resolve : string -> 'int32
+ <doc>Resolve the given host string into an IP address.</doc>
+**/
+int _hx_std_host_resolve( String host )
+{
+ unsigned int ip;
+
+ hx::EnterGCFreeZone();
+ hx::strbuf buf;
+ ip = inet_addr(host.utf8_str(&buf));
+ if( ip == INADDR_NONE )
+ {
+ struct hostent *h = 0;
+ hx::strbuf hostBuf;
+
+# if defined(NEKO_WINDOWS) || defined(NEKO_MAC) || defined(BLACKBERRY) || defined(EMSCRIPTEN)
+ h = gethostbyname(host.utf8_str(&hostBuf));
+# else
+ struct hostent hbase;
+ char buf[1024];
+ int errcode;
+ gethostbyname_r(host.utf8_str(&hostBuf),&hbase,buf,1024,&h,&errcode);
+# endif
+ if( !h ) {
+ hx::ExitGCFreeZone();
+ return hx::Throw( HX_CSTRING("Unknown host:") + host );
+ }
+ ip = *((unsigned int*)h->h_addr);
+ }
+ hx::ExitGCFreeZone();
+ return ip;
+}
+
+#ifdef DYNAMIC_INET_FUNCS
+bool dynamic_inet_pton_tried = false;
+inet_pton_func dynamic_inet_pton = 0;
+#endif
+
+Array<unsigned char> _hx_std_host_resolve_ipv6( String host, bool )
+{
+ in6_addr ipv6;
+
+ hx::strbuf hostBuf;
+ const char *hostStr = host.utf8_str(&hostBuf);
+ #ifdef DYNAMIC_INET_FUNCS
+ if (!dynamic_inet_pton_tried)
+ {
+ dynamic_inet_pton_tried = true;
+ HMODULE module = LoadLibraryA("WS2_32.dll");
+ if (module)
+ dynamic_inet_pton = (inet_pton_func)GetProcAddress(module,"inet_pton");
+ }
+ int ok = dynamic_inet_pton ? dynamic_inet_pton(AF_INET6, hostStr, (void *)&ipv6) : 0;
+ #else
+ int ok = inet_pton(AF_INET6, hostStr, (void *)&ipv6);
+ #endif
+
+ if (!ok)
+ {
+ addrinfo hints;
+
+ memset(&hints, 0, sizeof(struct addrinfo));
+ hints.ai_family = AF_INET6; // IPv6
+ hints.ai_socktype = 0; // any - SOCK_STREAM or SOCK_DGRAM
+ hints.ai_flags = AI_PASSIVE; // For wildcard IP address
+ hints.ai_protocol = 0; // Any protocol
+ hints.ai_canonname = 0;
+ hints.ai_addr = 0;
+ hints.ai_next = 0;
+
+ addrinfo *result = 0;
+ hx::EnterGCFreeZone();
+ int err = getaddrinfo( hostStr, 0, &hints, &result);
+ hx::ExitGCFreeZone();
+ if (err==0)
+ {
+ for(addrinfo * rp = result; rp; rp = rp->ai_next)
+ {
+ if (rp->ai_family==AF_INET6)
+ {
+ sockaddr_in6 *s6 = (sockaddr_in6 *)rp->ai_addr;
+ ipv6 = s6->sin6_addr;
+ ok = true;
+ break;
+ }
+ else
+ {
+ freeaddrinfo(result);
+ hx::Throw( HX_CSTRING("Unkown ai_family") );
+ }
+ }
+ freeaddrinfo(result);
+ }
+ else
+ {
+ hx::Throw( host + HX_CSTRING(":") + String(gai_strerror(err)) );
+ }
+ }
+
+ if (!ok)
+ return null();
+
+ return Array_obj<unsigned char>::fromData( (unsigned char *)&ipv6, 16 );
+}
+
+
+
+/**
+ host_to_string : 'int32 -> string
+ <doc>Return a string representation of the IP address.</doc>
+**/
+String _hx_std_host_to_string( int ip )
+{
+ struct in_addr i;
+ *(int*)&i = ip;
+ return String( inet_ntoa(i) );
+}
+
+
+#ifdef DYNAMIC_INET_FUNCS
+bool dynamic_inet_ntop_tried = false;
+inet_ntop_func dynamic_inet_ntop = 0;
+#endif
+
+
+String _hx_std_host_to_string_ipv6( Array<unsigned char> ip )
+{
+ char buf[100];
+ #ifdef DYNAMIC_INET_FUNCS
+ if (!dynamic_inet_ntop_tried)
+ {
+ dynamic_inet_ntop_tried = true;
+ HMODULE module = LoadLibraryA("WS2_32.dll");
+ if (module)
+ dynamic_inet_ntop = (inet_ntop_func)GetProcAddress(module,"inet_ntop");
+ }
+ if (!dynamic_inet_ntop)
+ return String();
+ return String( dynamic_inet_ntop(AF_INET6, &ip[0], buf, 100) );
+ #else
+ return String( inet_ntop(AF_INET6, &ip[0], buf, 100) );
+ #endif
+}
+
+/**
+ host_reverse : 'int32 -> string
+ <doc>Reverse the DNS of the given IP address.</doc>
+**/
+String _hx_std_host_reverse( int host )
+{
+ struct hostent *h = 0;
+ unsigned int ip = host;
+ hx::EnterGCFreeZone();
+ #if defined(NEKO_WINDOWS) || defined(NEKO_MAC) || defined(ANDROID) || defined(BLACKBERRY) || defined(EMSCRIPTEN)
+ h = gethostbyaddr((char *)&ip,4,AF_INET);
+ #else
+ struct hostent htmp;
+ int errcode;
+ char buf[1024];
+ gethostbyaddr_r((char *)&ip,4,AF_INET,&htmp,buf,1024,&h,&errcode);
+ #endif
+ hx::ExitGCFreeZone();
+ if( !h )
+ return String();
+ return String( h->h_name );
+}
+
+String _hx_std_host_reverse_ipv6( Array<unsigned char> host )
+{
+ if (!host.mPtr || host->length!=16)
+ return String();
+
+ struct hostent *h = 0;
+ hx::EnterGCFreeZone();
+ #if defined(NEKO_WINDOWS) || defined(NEKO_MAC) || defined(ANDROID) || defined(BLACKBERRY) || defined(EMSCRIPTEN)
+ h = gethostbyaddr((char *)&host[0],16,AF_INET6);
+ #else
+ struct hostent htmp;
+ int errcode;
+ char buf[1024];
+ gethostbyaddr_r((char *)&host[0],16,AF_INET6,&htmp,buf,1024,&h,&errcode);
+ #endif
+ hx::ExitGCFreeZone();
+ if( !h )
+ return String();
+ return String( h->h_name );
+}
+
+
+/**
+ host_local : void -> string
+ <doc>Return the local host name.</doc>
+**/
+String _hx_std_host_local()
+{
+ char buf[256];
+ hx::EnterGCFreeZone();
+ if( gethostname(buf,256) == SOCKET_ERROR )
+ {
+ hx::ExitGCFreeZone();
+ return String();
+ }
+ hx::ExitGCFreeZone();
+ return String(buf);
+}
+
+/**
+ socket_connect : 'socket -> host:'int32 -> port:int -> void
+ <doc>Connect the socket the given [host] and [port]</doc>
+**/
+void _hx_std_socket_connect( Dynamic o, int host, int port )
+{
+ struct sockaddr_in addr;
+ memset(&addr,0,sizeof(addr));
+ addr.sin_family = AF_INET;
+ addr.sin_port = htons(port);
+ *(int*)&addr.sin_addr.s_addr = host;
+
+ hx::EnterGCFreeZone();
+ if( connect(val_sock(o),(struct sockaddr*)&addr,sizeof(addr)) == SOCKET_ERROR )
+ {
+ // This will throw a "Blocking" exception if the "error" was because
+ // it's a non-blocking socket with connection in progress, otherwise
+ // it will do nothing.
+ //
+ // - now it always throws
+ block_error();
+ }
+ hx::ExitGCFreeZone();
+}
+
+
+/**
+ socket_connect - to ipv6 host
+**/
+void _hx_std_socket_connect_ipv6( Dynamic o, Array<unsigned char> host, int port )
+{
+ struct sockaddr_in6 addr;
+ memset(&addr,0,sizeof(addr));
+ addr.sin6_family = AF_INET6;
+ addr.sin6_port = htons(port);
+ memcpy(&addr.sin6_addr,&host[0],16);
+
+ hx::EnterGCFreeZone();
+ if( connect(val_sock(o),(struct sockaddr*)&addr,sizeof(addr)) != 0 )
+ {
+ // This will throw a "Blocking" exception if the "error" was because
+ // it's a non-blocking socket with connection in progress, otherwise
+ // it will do nothing.
+ //
+ // - now it always throws
+ block_error();
+ }
+ hx::ExitGCFreeZone();
+}
+
+/**
+ socket_listen : 'socket -> int -> void
+ <doc>Listen for a number of connections</doc>
+**/
+void _hx_std_socket_listen( Dynamic o, int n )
+{
+ SOCKET sock = val_sock(o);
+ hx::EnterGCFreeZone();
+ if( listen(sock,n) == SOCKET_ERROR )
+ {
+ hx::ExitGCFreeZone();
+ return;
+ }
+ hx::ExitGCFreeZone();
+}
+
+static fd_set INVALID;
+
+static fd_set *make_socket_array( Array<Dynamic> a, fd_set *tmp, SOCKET *n )
+{
+ FD_ZERO(tmp);
+ if( !a.mPtr )
+ return tmp;
+
+ int len = a->length;
+ if( len > FD_SETSIZE )
+ hx::Throw(HX_CSTRING("Too many sockets in select"));
+
+ for(int i=0;i<len;i++)
+ {
+ // make sure it is a socket...
+ SOCKET sock = val_sock( a[i] );
+ if( sock > *n )
+ *n = sock;
+ FD_SET(sock,tmp);
+ }
+ return tmp;
+}
+
+static Array<Dynamic> make_array_result( Array<Dynamic> a, fd_set *tmp )
+{
+ if (!tmp || !a.mPtr)
+ return null();
+
+ int len = a->length;
+ Array<Dynamic> r = Array_obj<Dynamic>::__new();
+ for(int i=0;i<len;i++)
+ {
+ Dynamic s = a[i];
+ if( FD_ISSET(val_sock(s),tmp) )
+ r->push(s);
+ }
+ return r;
+}
+
+static void make_array_result_inplace(Array<Dynamic> a, fd_set *tmp)
+{
+ if (!a.mPtr)
+ return;
+
+ if (tmp == NULL)
+ {
+ a->__SetSize(0);
+ return;
+ }
+
+ int len = a->length;
+ int destPos = 0;
+ for(int i = 0; i < len; i++)
+ {
+ Dynamic s = a[i];
+ if (FD_ISSET(val_sock(s), tmp)) {
+ a[destPos++] = s;
+ }
+ }
+
+ a->__SetSize(destPos);
+}
+
+static struct timeval *init_timeval( double f, struct timeval *t ) {
+ if (f<0)
+ return 0;
+ t->tv_usec = (f - (int)f ) * 1000000;
+ t->tv_sec = (int)f;
+ return t;
+}
+
+/**
+ socket_select : read : 'socket array -> write : 'socket array -> others : 'socket array -> timeout:number? -> 'socket array array
+ <doc>Perform the [select] operation. Timeout is in seconds or [null] if infinite</doc>
+**/
+Array<Dynamic> _hx_std_socket_select( Array<Dynamic> rs, Array<Dynamic> ws, Array<Dynamic> es, Dynamic timeout )
+{
+ SOCKET n = 0;
+ fd_set rx, wx, ex;
+ fd_set *ra, *wa, *ea;
+
+ POSIX_LABEL(select_again);
+ ra = make_socket_array(rs,&rx,&n);
+ wa = make_socket_array(ws,&wx,&n);
+ ea = make_socket_array(es,&ex,&n);
+ if( ra == &INVALID || wa == &INVALID || ea == &INVALID )
+ hx::Throw( HX_CSTRING("No valid sockets") );
+
+ struct timeval tval;
+ struct timeval *tt = 0;
+ if( timeout.mPtr )
+ tt = init_timeval(timeout,&tval);
+
+ hx::EnterGCFreeZone();
+ if( select((int)(n+1),ra,wa,ea,tt) == SOCKET_ERROR )
+ {
+ hx::ExitGCFreeZone();
+ HANDLE_EINTR(select_again);
+ hx::Throw( HX_CSTRING("Select error ") + String((int)errno) );
+ }
+ hx::ExitGCFreeZone();
+
+ Array<Dynamic> r = Array_obj<Dynamic>::__new(3,3);
+ r[0] = make_array_result(rs,ra);
+ r[1] = make_array_result(ws,wa);
+ r[2] = make_array_result(es,ea);
+ return r;
+}
+
+/**
+ socket_select : read : 'socket array -> write : 'socket array -> others : 'socket array -> timeout:number?
+ <doc>Perform the [select] operation. Timeout is in seconds or [null] if infinite</doc>
+**/
+void _hx_std_socket_fast_select( Array<Dynamic> rs, Array<Dynamic> ws, Array<Dynamic> es, Dynamic timeout )
+{
+ SOCKET n = 0;
+ fd_set rx, wx, ex;
+ fd_set *ra, *wa, *ea;
+
+ POSIX_LABEL(select_again);
+ ra = make_socket_array(rs,&rx,&n);
+ wa = make_socket_array(ws,&wx,&n);
+ ea = make_socket_array(es,&ex,&n);
+
+ if( ra == &INVALID || wa == &INVALID || ea == &INVALID )
+ hx::Throw( HX_CSTRING("No valid sockets") );
+
+
+ struct timeval tval;
+ struct timeval *tt = 0;
+ if( timeout.mPtr )
+ tt = init_timeval(timeout,&tval);
+
+ hx::EnterGCFreeZone();
+ if( select((int)(n+1),ra,wa,ea,tt) == SOCKET_ERROR )
+ {
+ hx::ExitGCFreeZone();
+ HANDLE_EINTR(select_again);
+ #ifdef NEKO_WINDOWS
+ hx::Throw( HX_CSTRING("Select error ") + String((int)WSAGetLastError()) );
+ #else
+ hx::Throw( HX_CSTRING("Select error ") + String((int)errno) );
+ #endif
+ }
+
+ hx::ExitGCFreeZone();
+ make_array_result_inplace(rs, ra);
+ make_array_result_inplace(ws, wa);
+ make_array_result_inplace(es, ea);
+}
+
+/**
+ socket_bind : 'socket -> host : 'int -> port:int -> void
+ <doc>Bind the socket for server usage on the given host and port</doc>
+**/
+void _hx_std_socket_bind( Dynamic o, int host, int port )
+{
+ SOCKET sock = val_sock(o);
+
+ int opt = 1;
+ struct sockaddr_in addr;
+ memset(&addr,0,sizeof(addr));
+ addr.sin_family = AF_INET;
+ addr.sin_port = htons(port);
+ *(int*)&addr.sin_addr.s_addr = host;
+ #ifndef NEKO_WINDOWS
+ setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,(char*)&opt,sizeof(opt));
+ #endif
+
+ hx::EnterGCFreeZone();
+ if( bind(sock,(struct sockaddr*)&addr,sizeof(addr)) == SOCKET_ERROR )
+ {
+ hx::ExitGCFreeZone();
+ hx::Throw(HX_CSTRING("Bind failed"));
+ }
+ hx::ExitGCFreeZone();
+}
+
+
+/**
+ socket_bind - ipv6 version
+ <doc>Bind the socket for server usage on the given host and port</doc>
+**/
+void _hx_std_socket_bind_ipv6( Dynamic o, Array<unsigned char> host, int port )
+{
+ SOCKET sock = val_sock(o);
+
+ int opt = 1;
+
+ struct sockaddr_in6 addr;
+ memset(&addr,0,sizeof(addr));
+ addr.sin6_family = AF_INET6;
+ addr.sin6_port = htons(port);
+ memcpy(&addr.sin6_addr,&host[0], 16);
+ #ifndef NEKO_WINDOWS
+ setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,(char*)&opt,sizeof(opt));
+ #endif
+
+ hx::EnterGCFreeZone();
+ if( bind(sock,(struct sockaddr*)&addr,sizeof(addr)) == SOCKET_ERROR )
+ {
+ hx::ExitGCFreeZone();
+ hx::Throw(HX_CSTRING("Bind failed"));
+ }
+ hx::ExitGCFreeZone();
+}
+
+
+/**
+ socket_accept : 'socket -> 'socket
+ <doc>Accept an incoming connection request</doc>
+**/
+
+#ifdef _WIN32
+ typedef int SockLen;
+#elif defined(ANDROID)
+ typedef socklen_t SockLen;
+#else
+ typedef unsigned int SockLen;
+#endif
+
+Dynamic _hx_std_socket_accept( Dynamic o )
+{
+ SOCKET sock = val_sock(o);
+ struct sockaddr_in addr;
+ SockLen addrlen = sizeof(addr);
+ SOCKET s;
+ hx::EnterGCFreeZone();
+ s = accept(sock,(struct sockaddr*)&addr,&addrlen);
+ if( s == INVALID_SOCKET )
+ block_error();
+ hx::ExitGCFreeZone();
+
+ SocketWrapper *wrap = new SocketWrapper();
+ wrap->socket = s;
+ return wrap;
+}
+
+/**
+ socket_peer : 'socket -> #address
+ <doc>Return the socket connected peer address composed of an (host,port) array</doc>
+**/
+Array<int> _hx_std_socket_peer( Dynamic o )
+{
+ SOCKET sock = val_sock(o);
+ struct sockaddr_in addr;
+ SockLen addrlen = sizeof(addr);
+ hx::EnterGCFreeZone();
+ if( getpeername(sock,(struct sockaddr*)&addr,&addrlen) == SOCKET_ERROR )
+ {
+ hx::ExitGCFreeZone();
+ return null();
+ }
+ hx::ExitGCFreeZone();
+
+ Array<int> ret = Array_obj<int>::__new(2,2);
+ ret[0] = *(int*)&addr.sin_addr;
+ ret[1] = ntohs(addr.sin_port);
+ return ret;
+}
+
+/**
+ socket_host : 'socket -> #address
+ <doc>Return the socket local address composed of an (host,port) array</doc>
+**/
+Array<int> _hx_std_socket_host( Dynamic o )
+{
+ SOCKET sock = val_sock(o);
+ struct sockaddr_in addr;
+ SockLen addrlen = sizeof(addr);
+ hx::EnterGCFreeZone();
+ if( getsockname(sock,(struct sockaddr*)&addr,&addrlen) == SOCKET_ERROR )
+ {
+ hx::ExitGCFreeZone();
+ return null();
+ }
+ hx::ExitGCFreeZone();
+
+ Array<int> ret = Array_obj<int>::__new(2,2);
+ ret[0] = *(int*)&addr.sin_addr;
+ ret[1] = ntohs(addr.sin_port);
+ return ret;
+}
+
+/**
+ socket_set_timeout : 'socket -> timout:number? -> void
+ <doc>Set the socket send and recv timeout in seconds to the given value (or null for blocking)</doc>
+**/
+void _hx_std_socket_set_timeout( Dynamic o, Dynamic t )
+{
+ SOCKET sock = val_sock(o);
+
+#ifdef NEKO_WINDOWS
+ int time;
+ if( !t.mPtr )
+ time = 0;
+ else {
+ time = (int)((double)(t) * 1000);
+ }
+#else
+ struct timeval time;
+ if( t.mPtr==0 ) {
+ time.tv_usec = 0;
+ time.tv_sec = 0;
+ } else {
+ init_timeval(t,&time);
+ }
+#endif
+
+ hx::EnterGCFreeZone();
+ if( setsockopt(sock,SOL_SOCKET,SO_SNDTIMEO,(char*)&time,sizeof(time)) != 0 )
+ {
+ hx::ExitGCFreeZone();
+ return;
+ }
+ if( setsockopt(sock,SOL_SOCKET,SO_RCVTIMEO,(char*)&time,sizeof(time)) != 0 )
+ {
+ hx::ExitGCFreeZone();
+ return;
+ }
+ hx::ExitGCFreeZone();
+}
+
+/**
+ socket_shutdown : 'socket -> read:bool -> write:bool -> void
+ <doc>Prevent the socket from further reading or writing or both.</doc>
+**/
+void _hx_std_socket_shutdown( Dynamic o, bool r, bool w )
+{
+ SOCKET sock = val_sock(o);
+ if( !r && !w )
+ return;
+
+ hx::EnterGCFreeZone();
+ if( shutdown(sock,(r)?((w)?SHUT_RDWR:SHUT_RD):SHUT_WR) )
+ {
+ hx::ExitGCFreeZone();
+ return;
+ }
+ hx::ExitGCFreeZone();
+}
+
+/**
+ socket_set_blocking : 'socket -> bool -> void
+ <doc>Turn on/off the socket blocking mode.</doc>
+**/
+#include <stdlib.h>
+
+void _hx_std_socket_set_blocking( Dynamic o, bool b )
+{
+ SOCKET sock = val_sock(o);
+ hx::EnterGCFreeZone();
+#ifdef NEKO_WINDOWS
+ {
+ unsigned long arg = b?0:1;
+ if( ioctlsocket(sock,FIONBIO,&arg) != 0 )
+ {
+ hx::ExitGCFreeZone();
+ return;
+ }
+ }
+#else
+ {
+ int rights = fcntl(sock,F_GETFL);
+ if( rights == -1 )
+ {
+ hx::ExitGCFreeZone();
+ return;
+ }
+ if( b )
+ rights &= ~O_NONBLOCK;
+ else
+ rights |= O_NONBLOCK;
+ if( fcntl(sock,F_SETFL,rights) == -1 )
+ {
+ hx::ExitGCFreeZone();
+ return;
+ }
+ }
+#endif
+ hx::ExitGCFreeZone();
+ return;
+}
+
+
+void _hx_std_socket_set_fast_send( Dynamic o, bool b )
+{
+ SOCKET sock = val_sock(o);
+ int fast = (b);
+ hx::EnterGCFreeZone();
+ setsockopt(sock,IPPROTO_TCP,TCP_NODELAY,(char*)&fast,sizeof(fast));
+ hx::ExitGCFreeZone();
+}
+
+void _hx_std_socket_set_broadcast( Dynamic o, bool b )
+{
+ SOCKET sock = val_sock(o);
+ int broadcast = (b);
+ hx::EnterGCFreeZone();
+ setsockopt(sock,SOL_SOCKET,SO_BROADCAST,(char*)&broadcast,sizeof(broadcast));
+ hx::ExitGCFreeZone();
+}
+
+
+/**
+ socket_poll_alloc : int -> 'poll
+ <doc>Allocate memory to perform polling on a given number of sockets</doc>
+**/
+
+namespace
+{
+
+static int pollType = 0;
+
+struct polldata : public hx::Object
+{
+ HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdPollData };
+
+ bool ok;
+ int max;
+ #ifdef NEKO_WINDOWS
+ struct fd_set *fdr;
+ struct fd_set *fdw;
+ struct fd_set *outr;
+ struct fd_set *outw;
+ #else
+ struct pollfd *fds;
+ int rcount;
+ int wcount;
+ #endif
+ Array<int> ridx;
+ Array<int> widx;
+
+ void create(int nsocks)
+ {
+ ok = true;
+ max = nsocks;
+ #ifdef NEKO_WINDOWS
+ fdr = (fd_set*)malloc(FDSIZE(max));
+ fdw = (fd_set*)malloc(FDSIZE(max));
+ outr = (fd_set*)malloc(FDSIZE(max));
+ outw = (fd_set*)malloc(FDSIZE(max));
+ fdr->fd_count = 0;
+ fdw->fd_count = 0;
+
+ #else
+ fds = (struct pollfd*)malloc(sizeof(struct pollfd) * max);
+ rcount = 0;
+ wcount = 0;
+ #endif
+
+ ridx = Array_obj<int>::__new(max+1,max+1);
+ HX_OBJ_WB_GET(this, ridx.mPtr);
+ widx = Array_obj<int>::__new(max+1,max+1);
+ HX_OBJ_WB_GET(this, widx.mPtr);
+ for(int i=0;i<=max;i++)
+ {
+ ridx[i] = -1;
+ widx[i] = -1;
+ }
+
+ _hx_set_finalizer(this, finalize);
+ }
+
+ void destroy()
+ {
+ if (ok)
+ {
+ ok = false;
+ #ifdef NEKO_WINDOWS
+ free(fdr);
+ free(fdw);
+ free(outr);
+ free(outw);
+ #else
+ // ???
+ free(fds);
+ #endif
+ }
+ }
+
+ void __Mark(hx::MarkContext *__inCtx) { HX_MARK_MEMBER(ridx); HX_MARK_MEMBER(widx); }
+ #ifdef HXCPP_VISIT_ALLOCS
+ void __Visit(hx::VisitContext *__inCtx) { HX_VISIT_MEMBER(ridx); HX_VISIT_MEMBER(widx); }
+ #endif
+
+ int __GetType() const { return pollType; }
+
+ static void finalize(Dynamic obj)
+ {
+ ((polldata *)(obj.mPtr))->destroy();
+ }
+
+ String toString() { return HX_CSTRING("polldata"); }
+};
+
+polldata *val_poll(Dynamic o)
+{
+ if (!o.mPtr || o->__GetType()!=pollType)
+ hx::Throw(HX_CSTRING("Invalid polldata:") + o);
+ return static_cast<polldata *>(o.mPtr);
+}
+
+
+} // end namespace
+
+
+
+Dynamic _hx_std_socket_poll_alloc( int nsocks )
+{
+ if( nsocks < 0 || nsocks > 1000000 )
+ return null();
+
+ if (pollType==0)
+ pollType = hxcpp_alloc_kind();
+
+ polldata *p = new polldata;
+ p->create(nsocks);
+ return p;
+}
+
+/**
+ socket_poll_prepare : 'poll -> read:'socket array -> write:'socket array -> int array array
+ <doc>
+ Prepare a poll for scanning events on sets of sockets.
+ </doc>
+**/
+Array<Dynamic> _hx_std_socket_poll_prepare( Dynamic pdata, Array<Dynamic> rsocks, Array<Dynamic> wsocks )
+{
+ polldata *p = val_poll(pdata);
+
+ int len = rsocks.mPtr ? rsocks->length : 0;
+ int wlen = wsocks.mPtr ? wsocks->length : 0;
+ if( len + wlen > p->max )
+ hx::Throw(HX_CSTRING("Too many sockets in poll"));
+
+ #ifdef NEKO_WINDOWS
+ for(int i=0;i<len;i++)
+ p->fdr->fd_array[i] = val_sock( rsocks[i] );
+ p->fdr->fd_count = len;
+
+ len = wlen;
+ for(int i=0;i<len;i++)
+ p->fdw->fd_array[i] = val_sock( wsocks[i]);
+ p->fdw->fd_count = len;
+
+ #else
+
+ for(int i=0;i<len;i++)
+ {
+ p->fds[i].fd = val_sock( rsocks[i] );
+ p->fds[i].events = POLLIN;
+ p->fds[i].revents = 0;
+ }
+ p->rcount = len;
+ len = wlen;
+ for(int i=0;i<len;i++)
+ {
+ int k = i + p->rcount;
+ p->fds[k].fd = val_sock(wsocks[i]);
+ p->fds[k].events = POLLOUT;
+ p->fds[k].revents = 0;
+ }
+ p->wcount = len;
+
+ #endif
+
+ Array<Dynamic> a = Array_obj<Dynamic>::__new(2,2);
+ a[0] = p->ridx;
+ a[1] = p->widx;
+ return a;
+}
+
+
+/**
+ socket_poll_events : 'poll -> timeout:float -> void
+ <doc>
+ Update the read/write flags arrays that were created with [socket_poll_prepare].
+ </doc>
+**/
+void _hx_std_socket_poll_events( Dynamic pdata, double timeout )
+{
+ polldata *p = val_poll(pdata);
+
+ #ifdef NEKO_WINDOWS
+ memcpy(p->outr,p->fdr,FDSIZE(p->fdr->fd_count));
+ memcpy(p->outw,p->fdw,FDSIZE(p->fdw->fd_count));
+
+ struct timeval t;
+ struct timeval *tt = init_timeval(timeout,&t);
+
+ hx::EnterGCFreeZone();
+ if( select(0/* Ignored */, p->fdr->fd_count ? p->outr : 0, p->fdw->fd_count ?p->outw : 0,NULL,tt) == SOCKET_ERROR )
+ {
+ hx::ExitGCFreeZone();
+ return;
+ }
+ hx::ExitGCFreeZone();
+
+ int k = 0;
+ for(int i=0;i<p->fdr->fd_count;i++)
+ if( FD_ISSET(p->fdr->fd_array[i],p->outr) )
+ p->ridx[k++] = i;
+ p->ridx[k] = -1;
+
+ k = 0;
+ for(int i=0;i<p->fdw->fd_count;i++)
+ if( FD_ISSET(p->fdw->fd_array[i],p->outw) )
+ p->widx[k++] = i;
+ p->widx[k] = -1;
+
+ #else
+
+ int tot = p->rcount + p->wcount;
+ hx::EnterGCFreeZone();
+ POSIX_LABEL(poll_events_again);
+ if( poll(p->fds,tot,(int)(timeout * 1000)) < 0 )
+ {
+ HANDLE_EINTR(poll_events_again);
+ hx::ExitGCFreeZone();
+ return;
+ }
+ hx::ExitGCFreeZone();
+
+ int k = 0;
+ int i = 0;
+ for(i=0;i<p->rcount;i++)
+ if( p->fds[i].revents & (POLLIN|POLLHUP) )
+ p->ridx[k++] = i;
+ p->ridx[k] = -1;
+ k = 0;
+ for(;i<tot;i++)
+ if( p->fds[i].revents & (POLLOUT|POLLHUP) )
+ p->widx[k++] = i - p->rcount;
+ p->widx[k] = -1;
+ #endif
+}
+
+
+/**
+ socket_poll : 'socket array -> 'poll -> timeout:float -> 'socket array
+ <doc>
+ Perform a polling for data available over a given set of sockets. This is similar to [socket_select]
+ except that [socket_select] is limited to a given number of simultaneous sockets to check.
+ </doc>
+**/
+Array<Dynamic> _hx_std_socket_poll( Array<Dynamic> socks, Dynamic pdata, double timeout )
+{
+ polldata *p = val_poll(pdata);
+
+ _hx_std_socket_poll_prepare(pdata,socks,null());
+
+ _hx_std_socket_poll_events(pdata,timeout);
+
+ int rcount = 0;
+ while( p->ridx[rcount] != -1 )
+ rcount++;
+
+ Array<Dynamic> a = Array_obj<Dynamic>::__new(rcount,rcount);
+ for(int i=0;i<rcount;i++)
+ a[i] = socks[p->ridx[i]];
+ return a;
+}
+
+
+
+/**
+ socket_send_to : 'socket -> buf:string -> pos:int -> length:int -> addr:{host:'int32,port:int} -> int
+ <doc>
+ Send data from an unconnected UDP socket to the given address.
+ </doc>
+**/
+int _hx_std_socket_send_to( Dynamic o, Array<unsigned char> buf, int p, int l, Dynamic inAddr )
+{
+ SOCKET sock = val_sock(o);
+
+ const char *cdata = (const char *)&buf[0];
+ int dlen = buf->length;
+ if( p < 0 || l < 0 || p > dlen || p + l > dlen )
+ hx::Throw(HX_CSTRING("Invalid data position"));
+
+
+ int host = inAddr->__Field(HX_CSTRING("host"), hx::paccDynamic);
+ int port = inAddr->__Field(HX_CSTRING("port"), hx::paccDynamic);
+ struct sockaddr_in addr;
+ memset(&addr,0,sizeof(addr));
+ addr.sin_family = AF_INET;
+ addr.sin_port = htons(port);
+ *(int*)&addr.sin_addr.s_addr = host;
+
+
+ hx::EnterGCFreeZone();
+ POSIX_LABEL(send_again);
+ dlen = sendto(sock, cdata + p , l, MSG_NOSIGNAL, (struct sockaddr*)&addr, sizeof(addr));
+ if( dlen == SOCKET_ERROR ) {
+ HANDLE_EINTR(send_again);
+ block_error();
+ }
+ hx::ExitGCFreeZone();
+ return dlen;
+}
+
+/**
+ socket_recv_from : 'socket -> buf:string -> pos:int -> length:int -> addr:{host:'int32,port:int} -> int
+ <doc>
+ Read data from an unconnected UDP socket, store the address from which we received data in addr.
+ </doc>
+**/
+#define NRETRYS 20
+int _hx_std_socket_recv_from( Dynamic o, Array<unsigned char> buf, int p, int l, Dynamic outAddr)
+{
+ int retry = 0;
+ SOCKET sock = val_sock(o);
+
+ char *data = (char *)&buf[0];
+ int dlen = buf->length;
+ if( p < 0 || l < 0 || p > dlen || p + l > dlen )
+ hx::Throw(HX_CSTRING("Invalid data position"));
+
+ struct sockaddr_in saddr;
+ SockLen slen = sizeof(saddr);
+
+ int ret = 0;
+ hx::EnterGCFreeZone();
+ POSIX_LABEL(recv_from_again);
+ if( retry++ > NRETRYS ) {
+ ret = recv(sock,data+p,l,MSG_NOSIGNAL);
+ } else
+ ret = recvfrom(sock, data + p , l, MSG_NOSIGNAL, (struct sockaddr*)&saddr, &slen);
+ if( ret == SOCKET_ERROR ) {
+ HANDLE_EINTR(recv_from_again);
+ block_error();
+ }
+
+ hx::ExitGCFreeZone();
+ outAddr->__SetField(HX_CSTRING("host"),*(int*)&saddr.sin_addr, hx::paccDynamic);
+ outAddr->__SetField(HX_CSTRING("port"),ntohs(saddr.sin_port), hx::paccDynamic);
+
+ return ret;
+}
+
+
+#else // !HX_WINRT
+// TODO: WinRT StreamSocket port
+#endif // HX_WINRT
+
diff --git a/Sources/c_snikket/src/hx/libs/std/Sys.cpp b/Sources/c_snikket/src/hx/libs/std/Sys.cpp
new file mode 100644
index 0000000..371addf
--- /dev/null
+++ b/Sources/c_snikket/src/hx/libs/std/Sys.cpp
@@ -0,0 +1,908 @@
+#include <hxcpp.h>
+#include <hx/OS.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+
+#ifndef EPPC
+#include <sys/types.h>
+#include <sys/stat.h>
+#endif
+
+
+
+#ifdef NEKO_WINDOWS
+ #include <windows.h>
+ #include <direct.h>
+ #include <conio.h>
+ #include <locale.h>
+#else
+ #include <errno.h>
+ #ifndef EPPC
+ #include <unistd.h>
+ #include <dirent.h>
+ #include <termios.h>
+ #include <sys/time.h>
+ #include <sys/times.h>
+ #endif
+ #include <limits.h>
+ #ifndef ANDROID
+ #include <locale.h>
+ #if !defined(BLACKBERRY) && !defined(EPPC) && !defined(GCW0) && !defined(__GLIBC__)
+ #include <xlocale.h>
+ #endif
+ #endif
+#endif
+
+#ifdef EMSCRIPTEN
+ #include <sys/wait.h>
+#endif
+
+#if !defined(IPHONE) && !defined(APPLETV) && !defined(HX_APPLEWATCH)
+ #ifdef NEKO_MAC
+ #include <sys/syslimits.h>
+ #include <limits.h>
+ #include <mach-o/dyld.h>
+ #endif
+#endif
+
+#if defined(HX_WINRT) && !defined(_XBOX_ONE)
+ #include <string>
+#endif
+
+#ifdef HX_ANDROID
+ #include <sys/wait.h>
+#endif
+
+#ifndef CLK_TCK
+ #define CLK_TCK 100
+#endif
+
+
+/**
+ <doc>
+ <h1>System</h1>
+ <p>
+ Interactions with the operating system.
+ </p>
+ </doc>
+**/
+
+/**
+ get_env : string -> string?
+ <doc>Get some environment variable if exists</doc>
+**/
+
+String _hx_std_get_env( String v )
+{
+ #ifdef HX_WINRT
+ return String();
+ #else
+ #if defined(NEKO_WINDOWS) && defined(HX_SMART_STRINGS)
+ hx::strbuf wbuf;
+ return String::create( _wgetenv( v.wchar_str(&wbuf) ) );
+ #else
+ hx::strbuf buf;
+ return String::create( getenv(v.utf8_str(&buf)) );
+ #endif
+ #endif
+}
+
+/**
+ put_env : var:string -> val:string -> void
+ <doc>Set some environment variable value</doc>
+**/
+void _hx_std_put_env( String e, String v )
+{
+#ifdef HX_WINRT
+ // Do nothing
+#elif defined(NEKO_WINDOWS)
+ String set = e + HX_CSTRING("=") + (v != null()?v:"");
+
+ #ifdef HX_SMART_STRINGS
+ if (set.isUTF16Encoded())
+ _wputenv(set.wchar_str());
+ else
+ #endif
+ putenv(set.utf8_str());
+#else
+ if (v == null())
+ unsetenv(e.utf8_str());
+ else
+ setenv(e.utf8_str(),v.utf8_str(),1);
+#endif
+}
+
+/**
+ sys_sleep : number -> void
+ <doc>Sleep a given number of seconds</doc>
+**/
+
+void _hx_std_sys_sleep( double f )
+{
+ hx::EnterGCFreeZone();
+#if defined(NEKO_WINDOWS)
+ Sleep((DWORD)(f * 1000));
+#elif defined(EPPC)
+//TODO: Implement sys_sleep for EPPC
+#else
+ {
+ struct timespec t;
+ struct timespec tmp;
+ t.tv_sec = (int)(f);
+ t.tv_nsec = (int)(((f) - t.tv_sec) * 1e9);
+ while( nanosleep(&t,&tmp) == -1 )
+ {
+ if( errno != EINTR )
+ {
+ hx::ExitGCFreeZone();
+ return;
+ }
+ t = tmp;
+ }
+ }
+#endif
+ hx::ExitGCFreeZone();
+}
+
+/**
+ set_time_locale : string -> bool
+ <doc>Set the locale for LC_TIME, returns true on success</doc>
+**/
+bool _hx_std_set_time_locale( String l )
+{
+#if defined(ANDROID) || defined(GCW0)
+ return false;
+#else
+
+#ifdef NEKO_POSIX
+ locale_t lc, old;
+ lc = newlocale(LC_TIME_MASK,l.utf8_str(),NULL);
+ if( !lc )
+ return false;
+ old = uselocale(lc);
+ if( !old )
+ {
+ freelocale(lc);
+ return false;
+ }
+ if( old != LC_GLOBAL_LOCALE )
+ freelocale(old);
+ return true;
+#else
+ #if defined(NEKO_WINDOWS) && defined(HX_SMART_STRINGS)
+ if (l.isUTF16Encoded())
+ return _wsetlocale(LC_TIME,l.wchar_str());
+ #endif
+ return setlocale(LC_TIME,l.utf8_str());
+#endif
+
+#endif // !Android
+}
+
+/**
+ get_cwd : void -> string
+ <doc>Return current working directory</doc>
+**/
+String _hx_std_get_cwd()
+{
+ #ifdef HX_WINRT
+ return HX_CSTRING("ms-appdata:///local/");
+ #elif defined(EPPC)
+ return String();
+ #else
+#ifdef NEKO_WINDOWS
+ wchar_t buf[261];
+ int l;
+ if( !GetCurrentDirectoryW(260,buf) )
+ return String();
+ l = (int)wcslen(buf);
+ if( buf[l-1] != '/' && buf[l-1] != '\\' ) {
+ buf[l] = '/';
+ buf[l+1] = 0;
+ }
+#else
+ char buf[1025];
+ int l;
+ if( getcwd(buf,1024) == NULL )
+ return String();
+ l = (int)strlen(buf);
+ if( buf[l-1] != '/' && buf[l-1] != '\\' ) {
+ buf[l] = '/';
+ buf[l+1] = 0;
+ }
+#endif
+ return String::create(buf);
+ #endif
+}
+
+/**
+ set_cwd : string -> void
+ <doc>Set current working directory</doc>
+**/
+bool _hx_std_set_cwd( String d )
+{
+ #if !defined(HX_WINRT) && !defined(EPPC)
+#ifdef NEKO_WINDOWS
+ return SetCurrentDirectoryW(d.wchar_str()) == 0;
+#else
+ return chdir(d.utf8_str()) == 0;
+#endif
+ #else
+ return false;
+ #endif
+}
+
+
+/**
+ sys_string : void -> string
+ <doc>
+ Return the local system string. The current value are possible :
+ <ul>
+ <li>[Windows]</li>
+ <li>[Linux]</li>
+ <li>[BSD]</li>
+ <li>[Mac]</li>
+ </ul>
+ </doc>
+**/
+String _hx_std_sys_string()
+{
+#if defined(HX_WINRT)
+ return HX_CSTRING("WinRT");
+#elif defined(NEKO_WINDOWS)
+ return HX_CSTRING("Windows");
+#elif defined(NEKO_GNUKBSD)
+ return HX_CSTRING("GNU/kFreeBSD");
+#elif defined(NEKO_LINUX)
+ return HX_CSTRING("Linux");
+#elif defined(NEKO_BSD)
+ return HX_CSTRING("BSD");
+#elif defined(NEKO_MAC)
+ return HX_CSTRING("Mac");
+#elif defined(ANDROID)
+ return HX_CSTRING("Android");
+#elif defined(BLACKBERRY)
+ return HX_CSTRING("BlackBerry");
+#elif defined(EMSCRIPTEN)
+ return HX_CSTRING("Emscripten");
+#elif defined(EPPC)
+ return HX_CSTRING("EPPC");
+#else
+#error Unknow system string
+#endif
+}
+
+/**
+ sys_is64 : void -> bool
+ <doc>
+ Returns true if we are on a 64-bit system
+ </doc>
+**/
+bool _hx_std_sys_is64()
+{
+#ifdef NEKO_64BITS
+ return true;
+#else
+ return false;
+#endif
+}
+
+/**
+ sys_command : string -> int
+ <doc>Run the shell command and return exit code</doc>
+**/
+int _hx_std_sys_command( String cmd )
+{
+ #if defined(HX_WINRT) || defined(EMSCRIPTEN) || defined(EPPC) || defined(IPHONE) || defined(APPLETV) || defined(HX_APPLEWATCH)
+ return -1;
+ #else
+ if( !cmd.raw_ptr() || !cmd.length )
+ return -1;
+
+#ifdef NEKO_WINDOWS
+ int result = 0;
+ hx::EnterGCFreeZone();
+
+ #ifdef HX_SMART_STRINGS
+ if (!cmd.isUTF16Encoded())
+ result = system(cmd.raw_ptr());
+ else
+ #endif
+ {
+ hx::strbuf wbuf;
+ result = _wsystem(cmd.wchar_str(&wbuf));
+ }
+#else
+ hx::strbuf buf;
+ hx::EnterGCFreeZone();
+ int result = system(cmd.utf8_str(&buf));
+#endif
+ hx::ExitGCFreeZone();
+
+ #if !defined(NEKO_WINDOWS)
+ result = WEXITSTATUS(result) | (WTERMSIG(result) << 8);
+ #endif
+
+ return result;
+ #endif
+}
+
+
+/**
+ sys_exit : int -> void
+ <doc>Exit with the given errorcode. Never returns.</doc>
+**/
+void _hx_std_sys_exit( int code )
+{
+ exit(code);
+}
+
+/**
+ sys_exists : string -> bool
+ <doc>Returns true if the file or directory exists.</doc>
+**/
+bool _hx_std_sys_exists( String path )
+{
+ #ifdef EPPC
+ return true;
+ #else
+
+#ifdef NEKO_WINDOWS
+ const wchar_t * wpath = path.wchar_str();
+ hx::EnterGCFreeZone();
+ bool result = GetFileAttributesW(wpath) != INVALID_FILE_ATTRIBUTES;
+#else
+ struct stat st;
+ hx::EnterGCFreeZone();
+ hx::strbuf buf;
+ bool result = stat(path.utf8_str(&buf),&st) == 0;
+#endif
+ hx::ExitGCFreeZone();
+
+ return result;
+ #endif
+}
+
+/**
+ file_delete : string -> void
+ <doc>Delete the file. Exception on error.</doc>
+**/
+void _hx_std_file_delete( String path )
+{
+ #ifndef EPPC
+ hx::EnterGCFreeZone();
+
+ bool err = false;
+ #if defined(NEKO_WINDOWS) && defined(HX_SMART_STRINGS)
+ if (path.isUTF16Encoded())
+ err = _wunlink(path.wchar_str());
+ else
+ #endif
+ {
+ hx::strbuf buf;
+ err = unlink(path.utf8_str(&buf));
+ }
+
+ hx::ExitGCFreeZone();
+
+ if (err)
+ hx::Throw( HX_CSTRING("Could not delete ") + path );
+ #endif
+}
+
+/**
+ sys_rename : from:string -> to:string -> void
+ <doc>Rename the file or directory. Exception on error.</doc>
+**/
+void _hx_std_sys_rename( String path, String newname )
+{
+ hx::EnterGCFreeZone();
+
+ hx::strbuf buf0;
+ hx::strbuf buf1;
+ #ifdef NEKO_WINDOWS
+ bool err = _wrename(path.wchar_str(&buf0),newname.wchar_str(&buf1));
+ #else
+ bool err = rename(path.utf8_str(&buf0),newname.utf8_str(&buf1));
+ #endif
+
+ hx::ExitGCFreeZone();
+
+ if (err)
+ hx::Throw(HX_CSTRING("Could not rename"));
+}
+
+#define STATF(f) o->Add(HX_CSTRING(#f),(int)(s.st_##f))
+
+/**
+ sys_stat : string -> {
+ gid => int,
+ uid => int,
+ atime => 'int,
+ mtime => 'int,
+ ctime => 'int,
+ dev => int,
+ ino => int,
+ nlink => int,
+ rdev => int,
+ mode => int,
+ size => int
+ }
+ <doc>Run the [stat] command on the given file or directory.</doc>
+**/
+Dynamic _hx_std_sys_stat( String path )
+{
+ #ifdef EPPC
+ return alloc_null();
+ #else
+ hx::EnterGCFreeZone();
+ bool err = false;
+ #if defined(NEKO_WINDOWS)
+ struct _stat s;
+ #if defined(HX_SMART_STRINGS)
+ if (path.isUTF16Encoded())
+ {
+ hx::strbuf buf;
+ err = _wstat(path.wchar_str(&buf),&s);
+ }
+ else
+ #endif
+ {
+ hx::strbuf buf;
+ err = _stat(path.utf8_str(&buf),&s);
+ }
+ #else
+ struct stat s;
+ hx::strbuf buf;
+ err = stat(path.utf8_str(&buf),&s);
+ #endif
+
+ hx::ExitGCFreeZone();
+ if (err)
+ return null();
+ hx::Anon o = hx::Anon_obj::Create();
+
+ STATF(gid);
+ STATF(uid);
+ STATF(atime);
+ STATF(mtime);
+ STATF(ctime);
+ STATF(dev);
+ STATF(ino);
+ STATF(mode);
+ STATF(nlink);
+ STATF(rdev);
+ STATF(size);
+ STATF(mode);
+
+ return o;
+ #endif
+}
+
+/**
+ sys_file_type : string -> string
+ <doc>
+ Return the type of the file. The current values are possible :
+ <ul>
+ <li>[file]</li>
+ <li>[dir]</li>
+ <li>[symlink]</li>
+ <li>[sock]</li>
+ <li>[char]</li>
+ <li>[block]</li>
+ <li>[fifo]</li>
+ </ul>
+ </doc>
+**/
+String _hx_std_sys_file_type( String path )
+{
+ if (path==null())
+ return String();
+ #ifdef EPPC
+ return String();
+ #else
+ hx::EnterGCFreeZone();
+ bool err = false;
+ #if defined(NEKO_WINDOWS)
+ struct _stat s;
+ #if defined(HX_SMART_STRINGS)
+ if (path.isUTF16Encoded())
+ {
+ hx::strbuf buf;
+ err = _wstat(path.wchar_str(&buf),&s);
+ }
+ else
+ #endif
+ {
+ hx::strbuf buf;
+ err = _stat(path.utf8_str(&buf),&s);
+ }
+ #else
+ struct stat s;
+ hx::strbuf buf;
+ err = stat(path.utf8_str(&buf),&s);
+ #endif
+ hx::ExitGCFreeZone();
+ if (err)
+ return String();
+
+ if( s.st_mode & S_IFREG )
+ return HX_CSTRING("file");
+ if( s.st_mode & S_IFDIR )
+ return HX_CSTRING("dir");
+ if( s.st_mode & S_IFCHR )
+ return HX_CSTRING("char");
+#ifndef NEKO_WINDOWS
+ if( s.st_mode & S_IFLNK )
+ return HX_CSTRING("symlink");
+ if( s.st_mode & S_IFBLK )
+ return HX_CSTRING("block");
+ if( s.st_mode & S_IFIFO )
+ return HX_CSTRING("fifo");
+ if( s.st_mode & S_IFSOCK )
+ return HX_CSTRING("sock");
+#endif
+ return String();
+ #endif
+}
+
+/**
+ sys_create_dir : string -> mode:int -> void
+ <doc>Create a directory with the specified rights</doc>
+**/
+bool _hx_std_sys_create_dir( String path, int mode )
+{
+ #ifdef EPPC
+ return true;
+ #else
+#ifdef NEKO_WINDOWS
+ const wchar_t * wpath = path.wchar_str();
+ hx::EnterGCFreeZone();
+ bool err = _wmkdir(wpath);
+#else
+ hx::EnterGCFreeZone();
+ hx::strbuf buf;
+ bool err = mkdir(path.utf8_str(&buf), mode);
+#endif
+ hx::ExitGCFreeZone();
+ return !err;
+ #endif
+}
+
+/**
+ sys_remove_dir : string -> void
+ <doc>Remove a directory. Exception on error</doc>
+**/
+void _hx_std_sys_remove_dir( String path )
+{
+ #ifdef EPPC
+ return true;
+ #else
+ hx::EnterGCFreeZone();
+
+ bool ok = false;
+
+ #if defined(NEKO_WINDOWS) && defined(HX_SMART_STRINGS)
+ if (path.isUTF16Encoded())
+ {
+ ok = _wrmdir(path.wchar_str()) == 0;
+ }
+ else
+ #endif
+ {
+ hx::strbuf buf;
+ ok = rmdir(path.utf8_str(&buf)) == 0;
+ }
+
+
+ hx::ExitGCFreeZone();
+ if (!ok)
+ hx::Throw(HX_CSTRING("Could not remove directory"));
+ #endif
+}
+
+/**
+ sys_time : void -> float
+ <doc>Return an accurate local time stamp in seconds since Jan 1 1970</doc>
+**/
+double _hx_std_sys_time()
+{
+#ifdef NEKO_WINDOWS
+#define EPOCH_DIFF (134774*24*60*60.0)
+ SYSTEMTIME t;
+ FILETIME ft;
+ ULARGE_INTEGER ui;
+ GetSystemTime(&t);
+ if( !SystemTimeToFileTime(&t,&ft) )
+ return 0;
+ ui.LowPart = ft.dwLowDateTime;
+ ui.HighPart = ft.dwHighDateTime;
+ return ( ((double)ui.QuadPart) / 10000000.0 - EPOCH_DIFF );
+#elif defined(EPPC)
+ time_t tod;
+ time(&tod);
+ return ((double)tod);
+#else
+ struct timeval tv;
+ if( gettimeofday(&tv,NULL) != 0 )
+ return 0;
+ return ( tv.tv_sec + ((double)tv.tv_usec) / 1000000.0 );
+#endif
+}
+
+/**
+ sys_cpu_time : void -> float
+ <doc>Return the most accurate CPU time spent since the process started (in seconds)</doc>
+**/
+double _hx_std_sys_cpu_time()
+{
+#if defined(HX_WINRT) && !defined(_XBOX_ONE)
+ return ((double)GetTickCount64()/1000.0);
+#elif defined(NEKO_WINDOWS)
+ FILETIME unused;
+ FILETIME stime;
+ FILETIME utime;
+ if( !GetProcessTimes(GetCurrentProcess(),&unused,&unused,&stime,&utime) )
+ return 0;
+ return ( ((double)(utime.dwHighDateTime+stime.dwHighDateTime)) * 65.536 * 6.5536 + (((double)utime.dwLowDateTime + (double)stime.dwLowDateTime) / 10000000) );
+#elif defined(EPPC)
+ return ((double)clock()/(double)CLOCKS_PER_SEC);
+#else
+ struct tms t;
+ times(&t);
+ return ( ((double)(t.tms_utime + t.tms_stime)) / CLK_TCK );
+#endif
+}
+
+/**
+ sys_read_dir : string -> string list
+ <doc>Return the content of a directory</doc>
+**/
+Array<String> _hx_std_sys_read_dir( String p )
+{
+ Array<String> result = Array_obj<String>::__new();
+
+#if defined(NEKO_WINDOWS)
+ const wchar_t *path = p.wchar_str();
+ size_t len = wcslen(path);
+ if (len>MAX_PATH)
+ hx::Throw(HX_CSTRING("Invalid directory"));
+
+ WIN32_FIND_DATAW d;
+ HANDLE handle;
+ #if defined(HX_WINRT) && !defined(_XBOX_ONE)
+ std::wstring tempWStr(path);
+ std::string searchPath(tempWStr.begin(), tempWStr.end());
+ #else
+ wchar_t searchPath[ MAX_PATH + 4 ];
+ memcpy(searchPath,path, len*sizeof(wchar_t));
+ #endif
+
+
+ if( len && path[len-1] != '/' && path[len-1] != '\\' )
+ searchPath[len++] = '/';
+ searchPath[len++] = '*';
+ searchPath[len++] = '.';
+ searchPath[len++] = '*';
+ searchPath[len] = '\0';
+
+ hx::EnterGCFreeZone();
+ #if defined(HX_WINRT) && !defined(_XBOX_ONE)
+ handle = FindFirstFileEx(searchPath.c_str(), FindExInfoStandard, &d, FindExSearchNameMatch, NULL, 0);
+ #else
+ handle = FindFirstFileW(searchPath,&d);
+ #endif
+ if( handle == INVALID_HANDLE_VALUE )
+ {
+ hx::ExitGCFreeZone();
+ hx::Throw(HX_CSTRING("Invalid directory"));
+ }
+ while( true )
+ {
+ // skip magic dirs
+ if( d.cFileName[0] != '.' || (d.cFileName[1] != 0 && (d.cFileName[1] != '.' || d.cFileName[2] != 0)) )
+ {
+ hx::ExitGCFreeZone();
+ result->push(String::create(d.cFileName));
+ hx::EnterGCFreeZone();
+ }
+ if( !FindNextFileW(handle,&d) )
+ break;
+ }
+ FindClose(handle);
+#elif !defined(EPPC)
+ const char *name = p.utf8_str();
+ hx::EnterGCFreeZone();
+ DIR *d = opendir(name);
+ if( d == NULL )
+ {
+ hx::ExitGCFreeZone();
+ hx::Throw(HX_CSTRING("Invalid directory"));
+ }
+ while( true )
+ {
+ struct dirent *e = readdir(d);
+ if( e == NULL )
+ break;
+ // skip magic dirs
+ if( e->d_name[0] == '.' && (e->d_name[1] == 0 || (e->d_name[1] == '.' && e->d_name[2] == 0)) )
+ continue;
+ hx::ExitGCFreeZone();
+ result->push( String::create(e->d_name) );
+ hx::EnterGCFreeZone();
+ }
+ closedir(d);
+#endif
+ hx::ExitGCFreeZone();
+
+ return result;
+}
+
+/**
+ file_full_path : string -> string
+ <doc>Return an absolute path from a relative one. The file or directory must exists</doc>
+**/
+String _hx_std_file_full_path( String path )
+{
+#if defined(HX_WINRT)
+ return path;
+#elif defined(NEKO_WINDOWS)
+ wchar_t buf[MAX_PATH+1];
+ hx::strbuf wbuf;
+ if( GetFullPathNameW(path.wchar_str(&wbuf),MAX_PATH+1,buf,NULL) == 0 )
+ return null();
+ return String::create(buf);
+#elif defined(EPPC)
+ return path;
+#else
+ char buf[PATH_MAX];
+ hx::strbuf ubuf;
+ if( realpath(path.utf8_str(&ubuf),buf) == NULL )
+ return null();
+ return String::create(buf);
+#endif
+}
+
+/**
+ sys_exe_path : void -> string
+ <doc>Return the path of the executable</doc>
+**/
+String _hx_std_sys_exe_path()
+{
+#if defined(HX_WINRT) && defined(__cplusplus_winrt)
+ Windows::ApplicationModel::Package^ package = Windows::ApplicationModel::Package::Current;
+ Windows::Storage::StorageFolder^ installedLocation = package->InstalledLocation;
+ return(String::create(installedLocation->Path->Data()));
+#elif defined(NEKO_WINDOWS)
+ wchar_t path[MAX_PATH];
+ if( GetModuleFileNameW(NULL,path,MAX_PATH) == 0 )
+ return null();
+ return String::create(path);
+#elif defined(NEKO_MAC) && !defined(IPHONE) && !defined(APPLETV) && !defined(HX_APPLEWATCH)
+ char path[PATH_MAX+1];
+ uint32_t path_len = PATH_MAX;
+ if( _NSGetExecutablePath(path, &path_len) )
+ return null();
+ return String::create(path);
+#elif defined(EPPC)
+ return HX_CSTRING("");
+#else
+ {
+ char path[PATH_MAX];
+ int length = readlink("/proc/self/exe", path, sizeof(path));
+ if( length < 0 )
+ {
+ const char *p = getenv("_");
+ if (p)
+ return String::create(p);
+ return null();
+ }
+ path[length] = '\0';
+ return String::create(path);
+ }
+#endif
+}
+
+#if !defined(IPHONE) && !defined(APPLETV) && !defined(HX_APPLEWATCH)
+#ifdef NEKO_MAC
+#include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+#endif
+#endif
+
+#ifndef NEKO_WINDOWS
+extern char **environ;
+#endif
+
+/**
+ sys_env : void -> #list
+ <doc>Return all the (key,value) pairs in the environment as a chained list</doc>
+**/
+Array<String> _hx_std_sys_env()
+{
+ Array<String> result = Array_obj<String>::__new();
+ #ifndef HX_WINRT
+ char **e = environ;
+ while( *e )
+ {
+ char *x = strchr(*e,'=');
+ if( x == NULL )
+ {
+ e++;
+ continue;
+ }
+ result->push(String::create(*e,(int)(x-*e)));
+ result->push(String::create(x+1));
+ e++;
+ }
+ #endif
+ return result;
+}
+
+#ifdef HX_ANDROID
+ #define tcsetattr(fd,opt,s) ioctl(fd,opt,s)
+ #define tcgetattr(fd,s) ioctl(fd,TCGETS,s)
+
+ static __inline__ void inline_cfmakeraw(struct termios *s)
+ {
+ s->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
+ s->c_oflag &= ~OPOST;
+ s->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
+ s->c_cflag &= ~(CSIZE|PARENB);
+ s->c_cflag |= CS8;
+ }
+
+ #define cfmakeraw inline_cfmakeraw
+
+#endif
+
+/**
+ sys_getch : bool -> int
+ <doc>Read a character from stdin with or without echo</doc>
+**/
+int _hx_std_sys_getch( bool b )
+{
+#if defined(HX_WINRT) || defined(EMSCRIPTEN) || defined(EPPC)
+ return 0;
+#elif defined(NEKO_WINDOWS)
+ hx::EnterGCFreeZone();
+ int result = b?getche():getch();
+ hx::ExitGCFreeZone();
+
+ return result;
+#else
+ // took some time to figure out how to do that
+ // without relying on ncurses, which clear the
+ // terminal on initscr()
+ int c;
+ struct termios term, old;
+ hx::EnterGCFreeZone();
+ tcgetattr(fileno(stdin), &old);
+ term = old;
+ cfmakeraw(&term);
+ tcsetattr(fileno(stdin), 0, &term);
+ c = getchar();
+ tcsetattr(fileno(stdin), 0, &old);
+ if( b ) fputc(c,stdout);
+ hx::ExitGCFreeZone();
+ return c;
+# endif
+}
+
+/**
+ sys_get_pid : void -> int
+ <doc>Returns the current process identifier</doc>
+**/
+int _hx_std_sys_get_pid()
+{
+# ifdef NEKO_WINDOWS
+ return (int)(GetCurrentProcessId());
+#elif defined(EPPC)
+ return (1);
+# else
+ return (getpid());
+# endif
+}
diff --git a/Sources/c_snikket/src/hx/strings/RandomStrings.cpp b/Sources/c_snikket/src/hx/strings/RandomStrings.cpp
new file mode 100644
index 0000000..30dbd80
--- /dev/null
+++ b/Sources/c_snikket/src/hx/strings/RandomStrings.cpp
@@ -0,0 +1,312 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_95f339a1d026d52c
+#define INCLUDED_95f339a1d026d52c
+#include "hxMath.h"
+#endif
+#ifndef INCLUDED_StringTools
+#include <StringTools.h>
+#endif
+#ifndef INCLUDED_hx_strings_RandomStrings
+#include <hx/strings/RandomStrings.h>
+#endif
+#ifndef INCLUDED_hx_strings_StringBuilder
+#include <hx/strings/StringBuilder.h>
+#endif
+#ifndef INCLUDED_hx_strings_Strings
+#include <hx/strings/Strings.h>
+#endif
+#ifndef INCLUDED_hx_strings_internal__Either2__Either2
+#include <hx/strings/internal/_Either2/_Either2.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_935183b2282eb90a_20__genAsciiAlpha,"hx.strings.RandomStrings","_genAsciiAlpha",0x19b4d5b7,"hx.strings.RandomStrings._genAsciiAlpha","hx/strings/RandomStrings.hx",20,0xcc1efb0b)
+HX_LOCAL_STACK_FRAME(_hx_pos_935183b2282eb90a_89_random,"hx.strings.RandomStrings","random",0x24aa257c,"hx.strings.RandomStrings.random","hx/strings/RandomStrings.hx",89,0xcc1efb0b)
+HX_LOCAL_STACK_FRAME(_hx_pos_935183b2282eb90a_160_randomUUIDv4,"hx.strings.RandomStrings","randomUUIDv4",0xdc92f875,"hx.strings.RandomStrings.randomUUIDv4","hx/strings/RandomStrings.hx",160,0xcc1efb0b)
+HX_LOCAL_STACK_FRAME(_hx_pos_935183b2282eb90a_18_boot,"hx.strings.RandomStrings","boot",0x7f84876b,"hx.strings.RandomStrings.boot","hx/strings/RandomStrings.hx",18,0xcc1efb0b)
+HX_LOCAL_STACK_FRAME(_hx_pos_935183b2282eb90a_29_boot,"hx.strings.RandomStrings","boot",0x7f84876b,"hx.strings.RandomStrings.boot","hx/strings/RandomStrings.hx",29,0xcc1efb0b)
+HX_LOCAL_STACK_FRAME(_hx_pos_935183b2282eb90a_30_boot,"hx.strings.RandomStrings","boot",0x7f84876b,"hx.strings.RandomStrings.boot","hx/strings/RandomStrings.hx",30,0xcc1efb0b)
+namespace hx{
+namespace strings{
+
+void RandomStrings_obj::__construct() { }
+
+Dynamic RandomStrings_obj::__CreateEmpty() { return new RandomStrings_obj; }
+
+void *RandomStrings_obj::_hx_vtable = 0;
+
+Dynamic RandomStrings_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< RandomStrings_obj > _hx_result = new RandomStrings_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool RandomStrings_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x48d6a291;
+}
+
+::Array< int > RandomStrings_obj::DIGITS;
+
+::Array< int > RandomStrings_obj::_genAsciiAlpha(){
+ HX_STACKFRAME(&_hx_pos_935183b2282eb90a_20__genAsciiAlpha)
+HXLINE( 21) ::Array< int > chars = ::Array_obj< int >::__new();
+HXLINE( 22) {
+HXLINE( 23) chars->push(65);
+HXDLIN( 23) chars->push(66);
+HXDLIN( 23) chars->push(67);
+HXDLIN( 23) chars->push(68);
+HXDLIN( 23) chars->push(69);
+HXDLIN( 23) chars->push(70);
+HXDLIN( 23) chars->push(71);
+HXDLIN( 23) chars->push(72);
+HXDLIN( 23) chars->push(73);
+HXDLIN( 23) chars->push(74);
+HXDLIN( 23) chars->push(75);
+HXDLIN( 23) chars->push(76);
+HXDLIN( 23) chars->push(77);
+HXDLIN( 23) chars->push(78);
+HXDLIN( 23) chars->push(79);
+HXDLIN( 23) chars->push(80);
+HXDLIN( 23) chars->push(81);
+HXDLIN( 23) chars->push(82);
+HXDLIN( 23) chars->push(83);
+HXDLIN( 23) chars->push(84);
+HXDLIN( 23) chars->push(85);
+HXDLIN( 23) chars->push(86);
+HXDLIN( 23) chars->push(87);
+HXDLIN( 23) chars->push(88);
+HXDLIN( 23) chars->push(89);
+HXDLIN( 23) chars->push(90);
+ }
+HXLINE( 24) {
+HXLINE( 25) chars->push(97);
+HXDLIN( 25) chars->push(98);
+HXDLIN( 25) chars->push(99);
+HXDLIN( 25) chars->push(100);
+HXDLIN( 25) chars->push(101);
+HXDLIN( 25) chars->push(102);
+HXDLIN( 25) chars->push(103);
+HXDLIN( 25) chars->push(104);
+HXDLIN( 25) chars->push(105);
+HXDLIN( 25) chars->push(106);
+HXDLIN( 25) chars->push(107);
+HXDLIN( 25) chars->push(108);
+HXDLIN( 25) chars->push(109);
+HXDLIN( 25) chars->push(110);
+HXDLIN( 25) chars->push(111);
+HXDLIN( 25) chars->push(112);
+HXDLIN( 25) chars->push(113);
+HXDLIN( 25) chars->push(114);
+HXDLIN( 25) chars->push(115);
+HXDLIN( 25) chars->push(116);
+HXDLIN( 25) chars->push(117);
+HXDLIN( 25) chars->push(118);
+HXDLIN( 25) chars->push(119);
+HXDLIN( 25) chars->push(120);
+HXDLIN( 25) chars->push(121);
+HXDLIN( 25) chars->push(122);
+ }
+HXLINE( 26) return chars;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC0(RandomStrings_obj,_genAsciiAlpha,return )
+
+::Array< int > RandomStrings_obj::ASCII_ALPHA;
+
+::Array< int > RandomStrings_obj::ASCII_ALPHA_NUMERIC;
+
+::String RandomStrings_obj::random(int length, ::hx::strings::internal::_Either2::_Either2 chars){
+ HX_GC_STACKFRAME(&_hx_pos_935183b2282eb90a_89_random)
+HXLINE( 90) if ((length == 0)) {
+HXLINE( 91) return HX_("",00,00,00,00);
+ }
+HXLINE( 93) if ((length < 0)) {
+HXLINE( 94) HX_STACK_DO_THROW(HX_("[count] must be positive value",a7,d2,38,15));
+ }
+HXLINE( 96) if (::hx::IsNull( chars )) {
+HXLINE( 97) HX_STACK_DO_THROW(HX_("[chars] must not be null",a5,53,b7,f5));
+ }
+HXLINE( 99) ::Array< int > charsArray;
+HXDLIN( 99) ::hx::strings::internal::_Either2::_Either2 _g = chars;
+HXDLIN( 99) switch((int)(_g->_hx_getIndex())){
+ case (int)0: {
+HXLINE( 100) ::String str = ( (::String)(_g->_hx_getObject(0)) );
+HXLINE( 99) charsArray = ::hx::strings::Strings_obj::toChars(str);
+ }
+ break;
+ case (int)1: {
+HXLINE( 101) ::Array< int > chars1 = ( (::Array< int >)(_g->_hx_getObject(0)) );
+HXLINE( 99) charsArray = chars1;
+ }
+ break;
+ }
+HXLINE( 104) if ((charsArray->length == 0)) {
+HXLINE( 105) HX_STACK_DO_THROW(HX_("[chars] must not be empty",af,ff,cf,d6));
+ }
+HXLINE( 107) ::hx::strings::StringBuilder result = ::hx::strings::StringBuilder_obj::__alloc( HX_CTX ,null());
+HXLINE( 108) {
+HXLINE( 108) int _g1 = 0;
+HXDLIN( 108) int _g2 = length;
+HXDLIN( 108) while((_g1 < _g2)){
+HXLINE( 108) _g1 = (_g1 + 1);
+HXDLIN( 108) int i = (_g1 - 1);
+HXLINE( 109) result->addChar(charsArray->__get(::Math_obj::floor((( (Float)(charsArray->length) ) * ::Math_obj::random()))));
+ }
+ }
+HXLINE( 111) return result->toString();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(RandomStrings_obj,random,return )
+
+::String RandomStrings_obj::randomUUIDv4(::String __o_separator){
+ ::String separator = __o_separator;
+ if (::hx::IsNull(__o_separator)) separator = HX_("-",2d,00,00,00);
+ HX_STACKFRAME(&_hx_pos_935183b2282eb90a_160_randomUUIDv4)
+HXLINE( 161) if (::hx::IsNull( separator )) {
+HXLINE( 162) HX_STACK_DO_THROW(HX_("[separator] must not be null",ad,ff,54,c9));
+ }
+HXLINE( 165) int variantByte = ::Math_obj::floor((::Math_obj::random() * ( (Float)(16) )));
+HXLINE( 166) variantByte = (variantByte | 8);
+HXLINE( 167) variantByte = (variantByte & -5);
+HXLINE( 170) ::String _hx_tmp = ::StringTools_obj::hex(::Math_obj::floor((::Math_obj::random() * ( (Float)(65536) ))),4);
+HXDLIN( 170) ::String _hx_tmp1 = ((_hx_tmp + ::StringTools_obj::hex(::Math_obj::floor((::Math_obj::random() * ( (Float)(65536) ))),4)) + separator);
+HXDLIN( 170) ::String _hx_tmp2 = (((_hx_tmp1 + ::StringTools_obj::hex(::Math_obj::floor((::Math_obj::random() * ( (Float)(65536) ))),4)) + separator) + HX_("4",34,00,00,00));
+HXDLIN( 170) ::String _hx_tmp3 = ((_hx_tmp2 + ::StringTools_obj::hex(::Math_obj::floor((::Math_obj::random() * ( (Float)(4096) ))),3)) + separator);
+HXDLIN( 170) ::String _hx_tmp4 = (_hx_tmp3 + ::StringTools_obj::hex(variantByte,null()));
+HXDLIN( 170) ::String _hx_tmp5 = ((_hx_tmp4 + ::StringTools_obj::hex(::Math_obj::floor((::Math_obj::random() * ( (Float)(4096) ))),3)) + separator);
+HXDLIN( 170) ::String _hx_tmp6 = (_hx_tmp5 + ::StringTools_obj::hex(::Math_obj::floor((::Math_obj::random() * ( (Float)(65536) ))),4));
+HXDLIN( 170) ::String _hx_tmp7 = (_hx_tmp6 + ::StringTools_obj::hex(::Math_obj::floor((::Math_obj::random() * ( (Float)(65536) ))),4));
+HXLINE( 169) return (_hx_tmp7 + ::StringTools_obj::hex(::Math_obj::floor((::Math_obj::random() * ( (Float)(65536) ))),4)).toLowerCase();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(RandomStrings_obj,randomUUIDv4,return )
+
+
+RandomStrings_obj::RandomStrings_obj()
+{
+}
+
+bool RandomStrings_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 6:
+ if (HX_FIELD_EQ(inName,"DIGITS") ) { outValue = ( DIGITS ); return true; }
+ if (HX_FIELD_EQ(inName,"random") ) { outValue = random_dyn(); return true; }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"ASCII_ALPHA") ) { outValue = ( ASCII_ALPHA ); return true; }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"randomUUIDv4") ) { outValue = randomUUIDv4_dyn(); return true; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"_genAsciiAlpha") ) { outValue = _genAsciiAlpha_dyn(); return true; }
+ break;
+ case 19:
+ if (HX_FIELD_EQ(inName,"ASCII_ALPHA_NUMERIC") ) { outValue = ( ASCII_ALPHA_NUMERIC ); return true; }
+ }
+ return false;
+}
+
+bool RandomStrings_obj::__SetStatic(const ::String &inName,Dynamic &ioValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 6:
+ if (HX_FIELD_EQ(inName,"DIGITS") ) { DIGITS=ioValue.Cast< ::Array< int > >(); return true; }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"ASCII_ALPHA") ) { ASCII_ALPHA=ioValue.Cast< ::Array< int > >(); return true; }
+ break;
+ case 19:
+ if (HX_FIELD_EQ(inName,"ASCII_ALPHA_NUMERIC") ) { ASCII_ALPHA_NUMERIC=ioValue.Cast< ::Array< int > >(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *RandomStrings_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo RandomStrings_obj_sStaticStorageInfo[] = {
+ {::hx::fsObject /* ::Array< int > */ ,(void *) &RandomStrings_obj::DIGITS,HX_("DIGITS",26,b6,aa,67)},
+ {::hx::fsObject /* ::Array< int > */ ,(void *) &RandomStrings_obj::ASCII_ALPHA,HX_("ASCII_ALPHA",70,22,3a,0c)},
+ {::hx::fsObject /* ::Array< int > */ ,(void *) &RandomStrings_obj::ASCII_ALPHA_NUMERIC,HX_("ASCII_ALPHA_NUMERIC",9e,22,17,95)},
+ { ::hx::fsUnknown, 0, null()}
+};
+#endif
+
+static void RandomStrings_obj_sMarkStatics(HX_MARK_PARAMS) {
+ HX_MARK_MEMBER_NAME(RandomStrings_obj::DIGITS,"DIGITS");
+ HX_MARK_MEMBER_NAME(RandomStrings_obj::ASCII_ALPHA,"ASCII_ALPHA");
+ HX_MARK_MEMBER_NAME(RandomStrings_obj::ASCII_ALPHA_NUMERIC,"ASCII_ALPHA_NUMERIC");
+};
+
+#ifdef HXCPP_VISIT_ALLOCS
+static void RandomStrings_obj_sVisitStatics(HX_VISIT_PARAMS) {
+ HX_VISIT_MEMBER_NAME(RandomStrings_obj::DIGITS,"DIGITS");
+ HX_VISIT_MEMBER_NAME(RandomStrings_obj::ASCII_ALPHA,"ASCII_ALPHA");
+ HX_VISIT_MEMBER_NAME(RandomStrings_obj::ASCII_ALPHA_NUMERIC,"ASCII_ALPHA_NUMERIC");
+};
+
+#endif
+
+::hx::Class RandomStrings_obj::__mClass;
+
+static ::String RandomStrings_obj_sStaticFields[] = {
+ HX_("DIGITS",26,b6,aa,67),
+ HX_("_genAsciiAlpha",3e,31,44,11),
+ HX_("ASCII_ALPHA",70,22,3a,0c),
+ HX_("ASCII_ALPHA_NUMERIC",9e,22,17,95),
+ HX_("random",03,22,8f,b7),
+ HX_("randomUUIDv4",3c,94,2e,c1),
+ ::String(null())
+};
+
+void RandomStrings_obj::__register()
+{
+ RandomStrings_obj _hx_dummy;
+ RandomStrings_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("hx.strings.RandomStrings",d5,27,9c,7d);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &RandomStrings_obj::__GetStatic;
+ __mClass->mSetStaticField = &RandomStrings_obj::__SetStatic;
+ __mClass->mMarkFunc = RandomStrings_obj_sMarkStatics;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(RandomStrings_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< RandomStrings_obj >;
+#ifdef HXCPP_VISIT_ALLOCS
+ __mClass->mVisitFunc = RandomStrings_obj_sVisitStatics;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = RandomStrings_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = RandomStrings_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void RandomStrings_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_935183b2282eb90a_18_boot)
+HXDLIN( 18) DIGITS = ::hx::strings::Strings_obj::toChars(HX_("0123456789",05,7a,73,55));
+ }
+{
+ HX_STACKFRAME(&_hx_pos_935183b2282eb90a_29_boot)
+HXDLIN( 29) ASCII_ALPHA = ::hx::strings::RandomStrings_obj::_genAsciiAlpha();
+ }
+{
+ HX_STACKFRAME(&_hx_pos_935183b2282eb90a_30_boot)
+HXDLIN( 30) ASCII_ALPHA_NUMERIC = ::hx::strings::RandomStrings_obj::DIGITS->concat(::hx::strings::RandomStrings_obj::ASCII_ALPHA);
+ }
+}
+
+} // end namespace hx
+} // end namespace strings
diff --git a/Sources/c_snikket/src/hx/strings/StringBuilder.cpp b/Sources/c_snikket/src/hx/strings/StringBuilder.cpp
new file mode 100644
index 0000000..5ecc7f1
--- /dev/null
+++ b/Sources/c_snikket/src/hx/strings/StringBuilder.cpp
@@ -0,0 +1,298 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_StringBuf
+#include <StringBuf.h>
+#endif
+#ifndef INCLUDED_hx_strings_StringBuilder
+#include <hx/strings/StringBuilder.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_b646f356da37ac48_21_new,"hx.strings.StringBuilder","new",0xee97d452,"hx.strings.StringBuilder.new","hx/strings/StringBuilder.hx",21,0x236fa860)
+HX_LOCAL_STACK_FRAME(_hx_pos_b646f356da37ac48_68_add,"hx.strings.StringBuilder","add",0xee8df613,"hx.strings.StringBuilder.add","hx/strings/StringBuilder.hx",68,0x236fa860)
+HX_LOCAL_STACK_FRAME(_hx_pos_b646f356da37ac48_85_addChar,"hx.strings.StringBuilder","addChar",0x68f68689,"hx.strings.StringBuilder.addChar","hx/strings/StringBuilder.hx",85,0x236fa860)
+HX_LOCAL_STACK_FRAME(_hx_pos_b646f356da37ac48_129_clear,"hx.strings.StringBuilder","clear",0x529dd5ff,"hx.strings.StringBuilder.clear","hx/strings/StringBuilder.hx",129,0x236fa860)
+HX_LOCAL_STACK_FRAME(_hx_pos_b646f356da37ac48_440_toString,"hx.strings.StringBuilder","toString",0xe81d3f7a,"hx.strings.StringBuilder.toString","hx/strings/StringBuilder.hx",440,0x236fa860)
+HX_LOCAL_STACK_FRAME(_hx_pos_b646f356da37ac48_21_boot,"hx.strings.StringBuilder","boot",0xce5af400,"hx.strings.StringBuilder.boot","hx/strings/StringBuilder.hx",21,0x236fa860)
+namespace hx{
+namespace strings{
+
+void StringBuilder_obj::__construct(::String initialContent){
+ HX_GC_STACKFRAME(&_hx_pos_b646f356da37ac48_21_new)
+HXLINE( 27) this->len = 0;
+HXLINE( 26) this->pre = null();
+HXLINE( 23) this->sb = ::StringBuf_obj::__alloc( HX_CTX );
+HXLINE( 33) if (::hx::IsNotNull( initialContent )) {
+HXLINE( 34) this->add(initialContent);
+ }
+ }
+
+Dynamic StringBuilder_obj::__CreateEmpty() { return new StringBuilder_obj; }
+
+void *StringBuilder_obj::_hx_vtable = 0;
+
+Dynamic StringBuilder_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< StringBuilder_obj > _hx_result = new StringBuilder_obj();
+ _hx_result->__construct(inArgs[0]);
+ return _hx_result;
+}
+
+bool StringBuilder_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x32066fb8;
+}
+
+ ::hx::strings::StringBuilder StringBuilder_obj::add(::String item){
+ HX_STACKFRAME(&_hx_pos_b646f356da37ac48_68_add)
+HXLINE( 69) {
+HXLINE( 69) ::StringBuf _this = this->sb;
+HXDLIN( 69) ::String x;
+HXDLIN( 69) if (::hx::IsNull( item )) {
+HXLINE( 69) x = HX_("null",87,9e,0e,49);
+ }
+ else {
+HXLINE( 69) x = item;
+ }
+HXDLIN( 69) if (::hx::IsNotNull( _this->charBuf )) {
+HXLINE( 69) _this->flush();
+ }
+HXDLIN( 69) if (::hx::IsNull( _this->b )) {
+HXLINE( 69) _this->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x));
+ }
+ else {
+HXLINE( 69) ::Array< ::String > _this1 = _this->b;
+HXDLIN( 69) _this1->push(::Std_obj::string(x));
+ }
+ }
+HXLINE( 71) ::hx::strings::StringBuilder _hx_tmp = ::hx::ObjectPtr<OBJ_>(this);
+HXDLIN( 71) int _hx_tmp1;
+HXDLIN( 71) if (::hx::IsNull( item )) {
+HXLINE( 71) _hx_tmp1 = 0;
+ }
+ else {
+HXLINE( 71) _hx_tmp1 = item.length;
+ }
+HXDLIN( 71) _hx_tmp->len = (_hx_tmp->len + _hx_tmp1);
+HXLINE( 73) return ::hx::ObjectPtr<OBJ_>(this);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(StringBuilder_obj,add,return )
+
+ ::hx::strings::StringBuilder StringBuilder_obj::addChar(int ch){
+ HX_STACKFRAME(&_hx_pos_b646f356da37ac48_85_addChar)
+HXLINE( 89) bool _hx_tmp;
+HXDLIN( 89) if ((ch > -1)) {
+HXLINE( 89) _hx_tmp = (ch < 128);
+ }
+ else {
+HXLINE( 89) _hx_tmp = false;
+ }
+HXDLIN( 89) if (_hx_tmp) {
+HXLINE( 90) ::StringBuf _this = this->sb;
+HXDLIN( 90) int c = ch;
+HXDLIN( 90) if ((c >= 127)) {
+HXLINE( 90) ::String x = ::String::fromCharCode(c);
+HXDLIN( 90) if (::hx::IsNotNull( _this->charBuf )) {
+HXLINE( 90) _this->flush();
+ }
+HXDLIN( 90) if (::hx::IsNull( _this->b )) {
+HXLINE( 90) _this->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x));
+ }
+ else {
+HXLINE( 90) ::Array< ::String > _this1 = _this->b;
+HXDLIN( 90) _this1->push(::Std_obj::string(x));
+ }
+ }
+ else {
+HXLINE( 90) if (::hx::IsNull( _this->charBuf )) {
+HXLINE( 90) _this->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 90) _this->charBuf->push(c);
+ }
+ }
+ else {
+HXLINE( 92) ::StringBuf _this2 = this->sb;
+HXDLIN( 92) ::String x1 = ::String::fromCharCode(ch);
+HXDLIN( 92) if (::hx::IsNotNull( _this2->charBuf )) {
+HXLINE( 92) _this2->flush();
+ }
+HXDLIN( 92) if (::hx::IsNull( _this2->b )) {
+HXLINE( 92) _this2->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x1));
+ }
+ else {
+HXLINE( 92) ::Array< ::String > _this3 = _this2->b;
+HXDLIN( 92) _this3->push(::Std_obj::string(x1));
+ }
+ }
+HXLINE( 96) this->len++;
+HXLINE( 98) return ::hx::ObjectPtr<OBJ_>(this);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(StringBuilder_obj,addChar,return )
+
+ ::hx::strings::StringBuilder StringBuilder_obj::clear(){
+ HX_GC_STACKFRAME(&_hx_pos_b646f356da37ac48_129_clear)
+HXLINE( 135) this->pre = null();
+HXLINE( 136) this->sb = ::StringBuf_obj::__alloc( HX_CTX );
+HXLINE( 137) this->len = 0;
+HXLINE( 139) return ::hx::ObjectPtr<OBJ_>(this);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(StringBuilder_obj,clear,return )
+
+::String StringBuilder_obj::toString(){
+ HX_STACKFRAME(&_hx_pos_b646f356da37ac48_440_toString)
+HXLINE( 444) if (::hx::IsNull( this->pre )) {
+HXLINE( 445) return this->sb->toString();
+ }
+HXLINE( 446) ::String str = this->pre->join(HX_("",00,00,00,00));
+HXDLIN( 446) ::String str1 = (str + this->sb->toString());
+HXLINE( 447) this->clear();
+HXLINE( 448) this->add(str1);
+HXLINE( 449) return str1;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(StringBuilder_obj,toString,return )
+
+
+::hx::ObjectPtr< StringBuilder_obj > StringBuilder_obj::__new(::String initialContent) {
+ ::hx::ObjectPtr< StringBuilder_obj > __this = new StringBuilder_obj();
+ __this->__construct(initialContent);
+ return __this;
+}
+
+::hx::ObjectPtr< StringBuilder_obj > StringBuilder_obj::__alloc(::hx::Ctx *_hx_ctx,::String initialContent) {
+ StringBuilder_obj *__this = (StringBuilder_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(StringBuilder_obj), true, "hx.strings.StringBuilder"));
+ *(void **)__this = StringBuilder_obj::_hx_vtable;
+ __this->__construct(initialContent);
+ return __this;
+}
+
+StringBuilder_obj::StringBuilder_obj()
+{
+}
+
+void StringBuilder_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(StringBuilder);
+ HX_MARK_MEMBER_NAME(sb,"sb");
+ HX_MARK_MEMBER_NAME(pre,"pre");
+ HX_MARK_MEMBER_NAME(len,"len");
+ HX_MARK_END_CLASS();
+}
+
+void StringBuilder_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(sb,"sb");
+ HX_VISIT_MEMBER_NAME(pre,"pre");
+ HX_VISIT_MEMBER_NAME(len,"len");
+}
+
+::hx::Val StringBuilder_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 2:
+ if (HX_FIELD_EQ(inName,"sb") ) { return ::hx::Val( sb ); }
+ break;
+ case 3:
+ if (HX_FIELD_EQ(inName,"pre") ) { return ::hx::Val( pre ); }
+ if (HX_FIELD_EQ(inName,"len") ) { return ::hx::Val( len ); }
+ if (HX_FIELD_EQ(inName,"add") ) { return ::hx::Val( add_dyn() ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"clear") ) { return ::hx::Val( clear_dyn() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"addChar") ) { return ::hx::Val( addChar_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"toString") ) { return ::hx::Val( toString_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val StringBuilder_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 2:
+ if (HX_FIELD_EQ(inName,"sb") ) { sb=inValue.Cast< ::StringBuf >(); return inValue; }
+ break;
+ case 3:
+ if (HX_FIELD_EQ(inName,"pre") ) { pre=inValue.Cast< ::Array< ::String > >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"len") ) { len=inValue.Cast< int >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void StringBuilder_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("sb",8f,64,00,00));
+ outFields->push(HX_("pre",23,60,55,00));
+ outFields->push(HX_("len",d5,4b,52,00));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo StringBuilder_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::StringBuf */ ,(int)offsetof(StringBuilder_obj,sb),HX_("sb",8f,64,00,00)},
+ {::hx::fsObject /* ::Array< ::String > */ ,(int)offsetof(StringBuilder_obj,pre),HX_("pre",23,60,55,00)},
+ {::hx::fsInt,(int)offsetof(StringBuilder_obj,len),HX_("len",d5,4b,52,00)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *StringBuilder_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String StringBuilder_obj_sMemberFields[] = {
+ HX_("sb",8f,64,00,00),
+ HX_("pre",23,60,55,00),
+ HX_("len",d5,4b,52,00),
+ HX_("add",21,f2,49,00),
+ HX_("addChar",97,a1,fc,7d),
+ HX_("clear",8d,71,5b,48),
+ HX_("toString",ac,d0,6e,38),
+ ::String(null()) };
+
+::hx::Class StringBuilder_obj::__mClass;
+
+void StringBuilder_obj::__register()
+{
+ StringBuilder_obj _hx_dummy;
+ StringBuilder_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("hx.strings.StringBuilder",60,03,27,b6);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(StringBuilder_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< StringBuilder_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = StringBuilder_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = StringBuilder_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void StringBuilder_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_b646f356da37ac48_21_boot)
+HXDLIN( 21) __mClass->__meta__ = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("obj",f7,8f,54,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("notThreadSafe",2a,64,46,1e),null()))));
+ }
+}
+
+} // end namespace hx
+} // end namespace strings
diff --git a/Sources/c_snikket/src/hx/strings/Strings.cpp b/Sources/c_snikket/src/hx/strings/Strings.cpp
new file mode 100644
index 0000000..eff51e7
--- /dev/null
+++ b/Sources/c_snikket/src/hx/strings/Strings.cpp
@@ -0,0 +1,110 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_hx_strings_Strings
+#include <hx/strings/Strings.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_fd0a69697a336cdd_3475_toChars,"hx.strings.Strings","toChars",0x51e23a0c,"hx.strings.Strings.toChars","hx/strings/Strings.hx",3475,0x74f74a28)
+namespace hx{
+namespace strings{
+
+void Strings_obj::__construct() { }
+
+Dynamic Strings_obj::__CreateEmpty() { return new Strings_obj; }
+
+void *Strings_obj::_hx_vtable = 0;
+
+Dynamic Strings_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Strings_obj > _hx_result = new Strings_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool Strings_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x0e5b539c;
+}
+
+::Array< int > Strings_obj::toChars(::String str){
+ HX_STACKFRAME(&_hx_pos_fd0a69697a336cdd_3475_toChars)
+HXLINE(3476) if (::hx::IsNull( str )) {
+HXLINE(3478) return null();
+ }
+HXLINE(3480) int strLen;
+HXDLIN(3480) if (::hx::IsNull( str )) {
+HXLINE(3480) strLen = 0;
+ }
+ else {
+HXLINE(3480) strLen = str.length;
+ }
+HXLINE(3482) if ((strLen == 0)) {
+HXLINE(3483) return ::Array_obj< int >::__new(0);
+ }
+HXLINE(3485) ::Array< int > _g = ::Array_obj< int >::__new(0);
+HXDLIN(3485) {
+HXLINE(3485) int _g1 = 0;
+HXDLIN(3485) int _g2 = strLen;
+HXDLIN(3485) while((_g1 < _g2)){
+HXLINE(3485) _g1 = (_g1 + 1);
+HXDLIN(3485) int i = (_g1 - 1);
+HXDLIN(3485) _g->push(( (int)(str.charCodeAt(i)) ));
+ }
+ }
+HXDLIN(3485) return _g;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Strings_obj,toChars,return )
+
+
+Strings_obj::Strings_obj()
+{
+}
+
+bool Strings_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 7:
+ if (HX_FIELD_EQ(inName,"toChars") ) { outValue = toChars_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *Strings_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *Strings_obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class Strings_obj::__mClass;
+
+static ::String Strings_obj_sStaticFields[] = {
+ HX_("toChars",62,e9,37,12),
+ ::String(null())
+};
+
+void Strings_obj::__register()
+{
+ Strings_obj _hx_dummy;
+ Strings_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("hx.strings.Strings",18,f7,a8,5d);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Strings_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Strings_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< Strings_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Strings_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Strings_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace hx
+} // end namespace strings
diff --git a/Sources/c_snikket/src/hx/strings/internal/_Either2/_Either2.cpp b/Sources/c_snikket/src/hx/strings/internal/_Either2/_Either2.cpp
new file mode 100644
index 0000000..83c29e4
--- /dev/null
+++ b/Sources/c_snikket/src/hx/strings/internal/_Either2/_Either2.cpp
@@ -0,0 +1,90 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_hx_strings_internal__Either2__Either2
+#include <hx/strings/internal/_Either2/_Either2.h>
+#endif
+namespace hx{
+namespace strings{
+namespace internal{
+namespace _Either2{
+
+::hx::strings::internal::_Either2::_Either2 _Either2_obj::a( ::Dynamic v)
+{
+ return ::hx::CreateEnum< _Either2_obj >(HX_("a",61,00,00,00),0,1)->_hx_init(0,v);
+}
+
+::hx::strings::internal::_Either2::_Either2 _Either2_obj::b( ::Dynamic v)
+{
+ return ::hx::CreateEnum< _Either2_obj >(HX_("b",62,00,00,00),1,1)->_hx_init(0,v);
+}
+
+bool _Either2_obj::__GetStatic(const ::String &inName, ::Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ if (inName==HX_("a",61,00,00,00)) { outValue = _Either2_obj::a_dyn(); return true; }
+ if (inName==HX_("b",62,00,00,00)) { outValue = _Either2_obj::b_dyn(); return true; }
+ return super::__GetStatic(inName, outValue, inCallProp);
+}
+
+HX_DEFINE_CREATE_ENUM(_Either2_obj)
+
+int _Either2_obj::__FindIndex(::String inName)
+{
+ if (inName==HX_("a",61,00,00,00)) return 0;
+ if (inName==HX_("b",62,00,00,00)) return 1;
+ return super::__FindIndex(inName);
+}
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(_Either2_obj,a,return)
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(_Either2_obj,b,return)
+
+int _Either2_obj::__FindArgCount(::String inName)
+{
+ if (inName==HX_("a",61,00,00,00)) return 1;
+ if (inName==HX_("b",62,00,00,00)) return 1;
+ return super::__FindArgCount(inName);
+}
+
+::hx::Val _Either2_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ if (inName==HX_("a",61,00,00,00)) return a_dyn();
+ if (inName==HX_("b",62,00,00,00)) return b_dyn();
+ return super::__Field(inName,inCallProp);
+}
+
+static ::String _Either2_obj_sStaticFields[] = {
+ HX_("a",61,00,00,00),
+ HX_("b",62,00,00,00),
+ ::String(null())
+};
+
+::hx::Class _Either2_obj::__mClass;
+
+Dynamic __Create__Either2_obj() { return new _Either2_obj; }
+
+void _Either2_obj::__register()
+{
+
+::hx::Static(__mClass) = ::hx::_hx_RegisterClass(HX_("hx.strings.internal._Either2._Either2",07,08,e6,82), ::hx::TCanCast< _Either2_obj >,_Either2_obj_sStaticFields,0,
+ &__Create__Either2_obj, &__Create,
+ &super::__SGetClass(), &Create_Either2_obj, 0
+#ifdef HXCPP_VISIT_ALLOCS
+ , 0
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ , 0
+#endif
+);
+ __mClass->mGetStaticField = &_Either2_obj::__GetStatic;
+}
+
+void _Either2_obj::__boot()
+{
+}
+
+
+} // end namespace hx
+} // end namespace strings
+} // end namespace internal
+} // end namespace _Either2
diff --git a/Sources/c_snikket/src/sha/Hash.cpp b/Sources/c_snikket/src/sha/Hash.cpp
new file mode 100644
index 0000000..6212b6c
--- /dev/null
+++ b/Sources/c_snikket/src/sha/Hash.cpp
@@ -0,0 +1,223 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+#ifndef INCLUDED_sha_Hash
+#include <sha/Hash.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_a9cd7e4aca9fcb58_10_new,"sha.Hash","new",0x7a36a662,"sha.Hash.new","sha/Hash.hx",10,0x66842d6d)
+HX_LOCAL_STACK_FRAME(_hx_pos_a9cd7e4aca9fcb58_28_update,"sha.Hash","update",0x5b5edd47,"sha.Hash.update","sha/Hash.hx",28,0x66842d6d)
+HX_LOCAL_STACK_FRAME(_hx_pos_a9cd7e4aca9fcb58_52_digest,"sha.Hash","digest",0x897e5782,"sha.Hash.digest","sha/Hash.hx",52,0x66842d6d)
+namespace sha{
+
+void Hash_obj::__construct(int blockSize,int finalSize){
+ HX_STACKFRAME(&_hx_pos_a9cd7e4aca9fcb58_10_new)
+HXLINE( 11) this->finalSize = finalSize;
+HXLINE( 12) this->block = ::haxe::io::Bytes_obj::alloc(blockSize);
+HXLINE( 13) this->length = 0;
+ }
+
+bool Hash_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x49a7eb1a;
+}
+
+ ::sha::Hash Hash_obj::update( ::haxe::io::Bytes data){
+ HX_STACKFRAME(&_hx_pos_a9cd7e4aca9fcb58_28_update)
+HXLINE( 29) int accum = this->length;
+HXLINE( 31) int offset = 0;
+HXLINE( 32) while((offset < data->length)){
+HXLINE( 33) int assigned = ::hx::Mod(accum,this->block->length);
+HXLINE( 34) int a = (data->length - offset);
+HXDLIN( 34) int b = (this->block->length - assigned);
+HXDLIN( 34) int remainder;
+HXDLIN( 34) if ((a < b)) {
+HXLINE( 34) remainder = a;
+ }
+ else {
+HXLINE( 34) remainder = b;
+ }
+HXLINE( 36) {
+HXLINE( 36) int _g = 0;
+HXDLIN( 36) int _g1 = remainder;
+HXDLIN( 36) while((_g < _g1)){
+HXLINE( 36) _g = (_g + 1);
+HXDLIN( 36) int i = (_g - 1);
+HXLINE( 37) this->block->b[(assigned + i)] = data->b->__get((offset + i));
+ }
+ }
+HXLINE( 40) accum = (accum + remainder);
+HXLINE( 41) offset = (offset + remainder);
+HXLINE( 43) if ((::hx::Mod(accum,this->block->length) == 0)) {
+HXLINE( 44) this->_update(this->block);
+ }
+ }
+HXLINE( 48) ::sha::Hash _hx_tmp = ::hx::ObjectPtr<OBJ_>(this);
+HXDLIN( 48) _hx_tmp->length = (_hx_tmp->length + data->length);
+HXLINE( 49) return ::hx::ObjectPtr<OBJ_>(this);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Hash_obj,update,return )
+
+ ::haxe::io::Bytes Hash_obj::digest(){
+ HX_STACKFRAME(&_hx_pos_a9cd7e4aca9fcb58_52_digest)
+HXLINE( 53) int rem = ::hx::Mod(this->length,this->block->length);
+HXLINE( 55) this->block->b[rem] = ( (unsigned char)(128) );
+HXLINE( 57) this->block->fill((rem + 1),(this->block->length - (rem + 1)),0);
+HXLINE( 59) if ((rem >= this->finalSize)) {
+HXLINE( 60) this->_update(this->block);
+HXLINE( 61) this->block->fill(0,this->block->length,0);
+ }
+HXLINE( 64) int bits = (this->length * 8);
+HXLINE( 66) if ((bits <= -1)) {
+HXLINE( 67) ::haxe::io::Bytes b = this->block;
+HXDLIN( 67) int pos = (this->block->length - 4);
+HXDLIN( 67) b->b[pos] = ( (unsigned char)((bits >> 24)) );
+HXDLIN( 67) b->b[(pos + 1)] = ( (unsigned char)(((bits >> 16) & 255)) );
+HXDLIN( 67) b->b[(pos + 2)] = ( (unsigned char)(((bits >> 8) & 255)) );
+HXDLIN( 67) b->b[(pos + 3)] = ( (unsigned char)((bits & 255)) );
+ }
+ else {
+HXLINE( 69) int lowBits = ::hx::UShr((bits & -1),0);
+HXLINE( 70) int highBits = ::Std_obj::_hx_int((( (Float)((bits - lowBits)) ) / ((Float)4294967296)));
+HXLINE( 72) {
+HXLINE( 72) ::haxe::io::Bytes b1 = this->block;
+HXDLIN( 72) int pos1 = (this->block->length - 8);
+HXDLIN( 72) b1->b[pos1] = ( (unsigned char)((highBits >> 24)) );
+HXDLIN( 72) b1->b[(pos1 + 1)] = ( (unsigned char)(((highBits >> 16) & 255)) );
+HXDLIN( 72) b1->b[(pos1 + 2)] = ( (unsigned char)(((highBits >> 8) & 255)) );
+HXDLIN( 72) b1->b[(pos1 + 3)] = ( (unsigned char)((highBits & 255)) );
+ }
+HXLINE( 73) {
+HXLINE( 73) ::haxe::io::Bytes b2 = this->block;
+HXDLIN( 73) int pos2 = (this->block->length - 4);
+HXDLIN( 73) b2->b[pos2] = ( (unsigned char)((lowBits >> 24)) );
+HXDLIN( 73) b2->b[(pos2 + 1)] = ( (unsigned char)(((lowBits >> 16) & 255)) );
+HXDLIN( 73) b2->b[(pos2 + 2)] = ( (unsigned char)(((lowBits >> 8) & 255)) );
+HXDLIN( 73) b2->b[(pos2 + 3)] = ( (unsigned char)((lowBits & 255)) );
+ }
+ }
+HXLINE( 76) this->_update(this->block);
+HXLINE( 78) return this->_hash();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Hash_obj,digest,return )
+
+HX_DEFINE_DYNAMIC_FUNC1(Hash_obj,_update,(void))
+
+HX_DEFINE_DYNAMIC_FUNC0(Hash_obj,_hash,return )
+
+
+Hash_obj::Hash_obj()
+{
+}
+
+void Hash_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(Hash);
+ HX_MARK_MEMBER_NAME(finalSize,"finalSize");
+ HX_MARK_MEMBER_NAME(length,"length");
+ HX_MARK_MEMBER_NAME(block,"block");
+ HX_MARK_END_CLASS();
+}
+
+void Hash_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(finalSize,"finalSize");
+ HX_VISIT_MEMBER_NAME(length,"length");
+ HX_VISIT_MEMBER_NAME(block,"block");
+}
+
+::hx::Val Hash_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"block") ) { return ::hx::Val( block ); }
+ if (HX_FIELD_EQ(inName,"_hash") ) { return ::hx::Val( _hash_dyn() ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"length") ) { return ::hx::Val( length ); }
+ if (HX_FIELD_EQ(inName,"update") ) { return ::hx::Val( update_dyn() ); }
+ if (HX_FIELD_EQ(inName,"digest") ) { return ::hx::Val( digest_dyn() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"_update") ) { return ::hx::Val( _update_dyn() ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"finalSize") ) { return ::hx::Val( finalSize ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val Hash_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"block") ) { block=inValue.Cast< ::haxe::io::Bytes >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"length") ) { length=inValue.Cast< int >(); return inValue; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"finalSize") ) { finalSize=inValue.Cast< int >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void Hash_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("finalSize",57,1f,2b,8f));
+ outFields->push(HX_("length",e6,94,07,9f));
+ outFields->push(HX_("block",4d,75,fc,b4));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Hash_obj_sMemberStorageInfo[] = {
+ {::hx::fsInt,(int)offsetof(Hash_obj,finalSize),HX_("finalSize",57,1f,2b,8f)},
+ {::hx::fsInt,(int)offsetof(Hash_obj,length),HX_("length",e6,94,07,9f)},
+ {::hx::fsObject /* ::haxe::io::Bytes */ ,(int)offsetof(Hash_obj,block),HX_("block",4d,75,fc,b4)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *Hash_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Hash_obj_sMemberFields[] = {
+ HX_("finalSize",57,1f,2b,8f),
+ HX_("length",e6,94,07,9f),
+ HX_("block",4d,75,fc,b4),
+ HX_("update",09,86,05,87),
+ HX_("digest",44,00,25,b5),
+ HX_("_update",a8,97,7c,f5),
+ HX_("_hash",ad,4b,19,f8),
+ ::String(null()) };
+
+::hx::Class Hash_obj::__mClass;
+
+void Hash_obj::__register()
+{
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("sha.Hash",70,8d,4f,0b);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Hash_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Hash_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Hash_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Hash_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace sha
diff --git a/Sources/c_snikket/src/sha/SHA256.cpp b/Sources/c_snikket/src/sha/SHA256.cpp
new file mode 100644
index 0000000..da7ca3c
--- /dev/null
+++ b/Sources/c_snikket/src/sha/SHA256.cpp
@@ -0,0 +1,406 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+#ifndef INCLUDED_sha_Hash
+#include <sha/Hash.h>
+#endif
+#ifndef INCLUDED_sha_SHA256
+#include <sha/SHA256.h>
+#endif
+#ifndef INCLUDED_sha__SHA256_SHA256_Fields_
+#include <sha/_SHA256/SHA256_Fields_.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_6226bdf42cc6cc66_24_new,"sha.SHA256","new",0x93e2e3fb,"sha.SHA256.new","sha/SHA256.hx",24,0xdc816bb4)
+HX_LOCAL_STACK_FRAME(_hx_pos_6226bdf42cc6cc66_40_sigma0,"sha.SHA256","sigma0",0x79d84b30,"sha.SHA256.sigma0","sha/SHA256.hx",40,0xdc816bb4)
+HX_LOCAL_STACK_FRAME(_hx_pos_6226bdf42cc6cc66_44_sigma1,"sha.SHA256","sigma1",0x79d84b31,"sha.SHA256.sigma1","sha/SHA256.hx",44,0xdc816bb4)
+HX_LOCAL_STACK_FRAME(_hx_pos_6226bdf42cc6cc66_48_gamma0,"sha.SHA256","gamma0",0x16529a6e,"sha.SHA256.gamma0","sha/SHA256.hx",48,0xdc816bb4)
+HX_LOCAL_STACK_FRAME(_hx_pos_6226bdf42cc6cc66_52_gamma1,"sha.SHA256","gamma1",0x16529a6f,"sha.SHA256.gamma1","sha/SHA256.hx",52,0xdc816bb4)
+HX_LOCAL_STACK_FRAME(_hx_pos_6226bdf42cc6cc66_56_ch,"sha.SHA256","ch",0x1c36ef6a,"sha.SHA256.ch","sha/SHA256.hx",56,0xdc816bb4)
+HX_LOCAL_STACK_FRAME(_hx_pos_6226bdf42cc6cc66_60_maj,"sha.SHA256","maj",0x93e21e31,"sha.SHA256.maj","sha/SHA256.hx",60,0xdc816bb4)
+HX_LOCAL_STACK_FRAME(_hx_pos_6226bdf42cc6cc66_63__update,"sha.SHA256","_update",0xd8ad14c3,"sha.SHA256._update","sha/SHA256.hx",63,0xdc816bb4)
+HX_LOCAL_STACK_FRAME(_hx_pos_6226bdf42cc6cc66_107__hash,"sha.SHA256","_hash",0xdc48bc08,"sha.SHA256._hash","sha/SHA256.hx",107,0xdc816bb4)
+namespace sha{
+
+void SHA256_obj::__construct(){
+ HX_STACKFRAME(&_hx_pos_6226bdf42cc6cc66_24_new)
+HXLINE( 33) this->_w = ::Array_obj< int >::__new(0);
+HXLINE( 32) this->_h = (int)1541459225;
+HXLINE( 31) this->_g = 528734635;
+HXLINE( 30) this->_f = (int)-1694144372;
+HXLINE( 29) this->_e = (int)1359893119;
+HXLINE( 28) this->_d = (int)-1521486534;
+HXLINE( 27) this->_c = (int)1013904242;
+HXLINE( 26) this->_b = (int)-1150833019;
+HXLINE( 25) this->_a = (int)1779033703;
+HXLINE( 36) super::__construct(64,56);
+ }
+
+Dynamic SHA256_obj::__CreateEmpty() { return new SHA256_obj; }
+
+void *SHA256_obj::_hx_vtable = 0;
+
+Dynamic SHA256_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< SHA256_obj > _hx_result = new SHA256_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool SHA256_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x0251ab23) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x0251ab23;
+ } else {
+ return inClassId==(int)0x49a7eb1a;
+ }
+}
+
+int SHA256_obj::sigma0(int x){
+ HX_STACKFRAME(&_hx_pos_6226bdf42cc6cc66_40_sigma0)
+HXDLIN( 40) return (((::hx::UShr(x,2) | (x << 30)) ^ (::hx::UShr(x,13) | (x << 19))) ^ (::hx::UShr(x,22) | (x << 10)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(SHA256_obj,sigma0,return )
+
+int SHA256_obj::sigma1(int x){
+ HX_STACKFRAME(&_hx_pos_6226bdf42cc6cc66_44_sigma1)
+HXDLIN( 44) return (((::hx::UShr(x,6) | (x << 26)) ^ (::hx::UShr(x,11) | (x << 21))) ^ (::hx::UShr(x,25) | (x << 7)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(SHA256_obj,sigma1,return )
+
+int SHA256_obj::gamma0(int x){
+ HX_STACKFRAME(&_hx_pos_6226bdf42cc6cc66_48_gamma0)
+HXDLIN( 48) return (((::hx::UShr(x,7) | (x << 25)) ^ (::hx::UShr(x,18) | (x << 14))) ^ ::hx::UShr(x,3));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(SHA256_obj,gamma0,return )
+
+int SHA256_obj::gamma1(int x){
+ HX_STACKFRAME(&_hx_pos_6226bdf42cc6cc66_52_gamma1)
+HXDLIN( 52) return (((::hx::UShr(x,17) | (x << 15)) ^ (::hx::UShr(x,19) | (x << 13))) ^ ::hx::UShr(x,10));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(SHA256_obj,gamma1,return )
+
+int SHA256_obj::ch(int x,int y,int z){
+ HX_STACKFRAME(&_hx_pos_6226bdf42cc6cc66_56_ch)
+HXDLIN( 56) return (z ^ (x & (y ^ z)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(SHA256_obj,ch,return )
+
+int SHA256_obj::maj(int x,int y,int z){
+ HX_STACKFRAME(&_hx_pos_6226bdf42cc6cc66_60_maj)
+HXDLIN( 60) return ((x & y) | (z & (x | y)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(SHA256_obj,maj,return )
+
+void SHA256_obj::_update( ::haxe::io::Bytes data){
+ HX_STACKFRAME(&_hx_pos_6226bdf42cc6cc66_63__update)
+HXLINE( 64) ::Array< int > W = this->_w;
+HXLINE( 66) int a = (this->_a | 0);
+HXLINE( 67) int b = (this->_b | 0);
+HXLINE( 68) int c = (this->_c | 0);
+HXLINE( 69) int d = (this->_d | 0);
+HXLINE( 70) int e = (this->_e | 0);
+HXLINE( 71) int f = (this->_f | 0);
+HXLINE( 72) int g = (this->_g | 0);
+HXLINE( 73) int h = (this->_h | 0);
+HXLINE( 75) {
+HXLINE( 75) int _g = 0;
+HXDLIN( 75) while((_g < 16)){
+HXLINE( 75) _g = (_g + 1);
+HXDLIN( 75) int i = (_g - 1);
+HXLINE( 76) W[i] = ((((( (int)(data->b->__get((i * 4))) ) << 24) | (( (int)(data->b->__get(((i * 4) + 1))) ) << 16)) | (( (int)(data->b->__get(((i * 4) + 2))) ) << 8)) | ( (int)(data->b->__get(((i * 4) + 3))) ));
+ }
+ }
+HXLINE( 79) {
+HXLINE( 79) int _g1 = 16;
+HXDLIN( 79) while((_g1 < 64)){
+HXLINE( 79) _g1 = (_g1 + 1);
+HXDLIN( 79) int i1 = (_g1 - 1);
+HXLINE( 80) int _hx_tmp = this->gamma1(W->__get((i1 - 2)));
+HXDLIN( 80) int _hx_tmp1 = (_hx_tmp + W->__get((i1 - 7)));
+HXDLIN( 80) int _hx_tmp2 = (_hx_tmp1 + this->gamma0(W->__get((i1 - 15))));
+HXDLIN( 80) W[i1] = ((_hx_tmp2 + W->__get((i1 - 16))) | 0);
+ }
+ }
+HXLINE( 83) {
+HXLINE( 83) int _g2 = 0;
+HXDLIN( 83) while((_g2 < 64)){
+HXLINE( 83) _g2 = (_g2 + 1);
+HXDLIN( 83) int j = (_g2 - 1);
+HXLINE( 84) int T1 = (h + this->sigma1(e));
+HXDLIN( 84) int T11 = (T1 + this->ch(e,f,g));
+HXDLIN( 84) int T12 = (((T11 + ::sha::_SHA256::SHA256_Fields__obj::K->__get(j)) + W->__get(j)) | 0);
+HXLINE( 85) int T2 = this->sigma0(a);
+HXDLIN( 85) int T21 = ((T2 + this->maj(a,b,c)) | 0);
+HXLINE( 87) h = g;
+HXLINE( 88) g = f;
+HXLINE( 89) f = e;
+HXLINE( 90) e = ((d + T12) | 0);
+HXLINE( 91) d = c;
+HXLINE( 92) c = b;
+HXLINE( 93) b = a;
+HXLINE( 94) a = ((T12 + T21) | 0);
+ }
+ }
+HXLINE( 97) this->_a = ((a + this->_a) | 0);
+HXLINE( 98) this->_b = ((b + this->_b) | 0);
+HXLINE( 99) this->_c = ((c + this->_c) | 0);
+HXLINE( 100) this->_d = ((d + this->_d) | 0);
+HXLINE( 101) this->_e = ((e + this->_e) | 0);
+HXLINE( 102) this->_f = ((f + this->_f) | 0);
+HXLINE( 103) this->_g = ((g + this->_g) | 0);
+HXLINE( 104) this->_h = ((h + this->_h) | 0);
+ }
+
+
+ ::haxe::io::Bytes SHA256_obj::_hash(){
+ HX_STACKFRAME(&_hx_pos_6226bdf42cc6cc66_107__hash)
+HXLINE( 108) ::haxe::io::Bytes b = ::haxe::io::Bytes_obj::alloc(32);
+HXLINE( 110) {
+HXLINE( 110) int i = this->_a;
+HXDLIN( 110) b->b[0] = ( (unsigned char)((i >> 24)) );
+HXDLIN( 110) b->b[1] = ( (unsigned char)(((i >> 16) & 255)) );
+HXDLIN( 110) b->b[2] = ( (unsigned char)(((i >> 8) & 255)) );
+HXDLIN( 110) b->b[3] = ( (unsigned char)((i & 255)) );
+ }
+HXLINE( 111) {
+HXLINE( 111) int i1 = this->_b;
+HXDLIN( 111) b->b[4] = ( (unsigned char)((i1 >> 24)) );
+HXDLIN( 111) b->b[5] = ( (unsigned char)(((i1 >> 16) & 255)) );
+HXDLIN( 111) b->b[6] = ( (unsigned char)(((i1 >> 8) & 255)) );
+HXDLIN( 111) b->b[7] = ( (unsigned char)((i1 & 255)) );
+ }
+HXLINE( 112) {
+HXLINE( 112) int i2 = this->_c;
+HXDLIN( 112) b->b[8] = ( (unsigned char)((i2 >> 24)) );
+HXDLIN( 112) b->b[9] = ( (unsigned char)(((i2 >> 16) & 255)) );
+HXDLIN( 112) b->b[10] = ( (unsigned char)(((i2 >> 8) & 255)) );
+HXDLIN( 112) b->b[11] = ( (unsigned char)((i2 & 255)) );
+ }
+HXLINE( 113) {
+HXLINE( 113) int i3 = this->_d;
+HXDLIN( 113) b->b[12] = ( (unsigned char)((i3 >> 24)) );
+HXDLIN( 113) b->b[13] = ( (unsigned char)(((i3 >> 16) & 255)) );
+HXDLIN( 113) b->b[14] = ( (unsigned char)(((i3 >> 8) & 255)) );
+HXDLIN( 113) b->b[15] = ( (unsigned char)((i3 & 255)) );
+ }
+HXLINE( 114) {
+HXLINE( 114) int i4 = this->_e;
+HXDLIN( 114) b->b[16] = ( (unsigned char)((i4 >> 24)) );
+HXDLIN( 114) b->b[17] = ( (unsigned char)(((i4 >> 16) & 255)) );
+HXDLIN( 114) b->b[18] = ( (unsigned char)(((i4 >> 8) & 255)) );
+HXDLIN( 114) b->b[19] = ( (unsigned char)((i4 & 255)) );
+ }
+HXLINE( 115) {
+HXLINE( 115) int i5 = this->_f;
+HXDLIN( 115) b->b[20] = ( (unsigned char)((i5 >> 24)) );
+HXDLIN( 115) b->b[21] = ( (unsigned char)(((i5 >> 16) & 255)) );
+HXDLIN( 115) b->b[22] = ( (unsigned char)(((i5 >> 8) & 255)) );
+HXDLIN( 115) b->b[23] = ( (unsigned char)((i5 & 255)) );
+ }
+HXLINE( 116) {
+HXLINE( 116) int i6 = this->_g;
+HXDLIN( 116) b->b[24] = ( (unsigned char)((i6 >> 24)) );
+HXDLIN( 116) b->b[25] = ( (unsigned char)(((i6 >> 16) & 255)) );
+HXDLIN( 116) b->b[26] = ( (unsigned char)(((i6 >> 8) & 255)) );
+HXDLIN( 116) b->b[27] = ( (unsigned char)((i6 & 255)) );
+ }
+HXLINE( 117) {
+HXLINE( 117) int i7 = this->_h;
+HXDLIN( 117) b->b[28] = ( (unsigned char)((i7 >> 24)) );
+HXDLIN( 117) b->b[29] = ( (unsigned char)(((i7 >> 16) & 255)) );
+HXDLIN( 117) b->b[30] = ( (unsigned char)(((i7 >> 8) & 255)) );
+HXDLIN( 117) b->b[31] = ( (unsigned char)((i7 & 255)) );
+ }
+HXLINE( 119) return b;
+ }
+
+
+
+::hx::ObjectPtr< SHA256_obj > SHA256_obj::__new() {
+ ::hx::ObjectPtr< SHA256_obj > __this = new SHA256_obj();
+ __this->__construct();
+ return __this;
+}
+
+::hx::ObjectPtr< SHA256_obj > SHA256_obj::__alloc(::hx::Ctx *_hx_ctx) {
+ SHA256_obj *__this = (SHA256_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(SHA256_obj), true, "sha.SHA256"));
+ *(void **)__this = SHA256_obj::_hx_vtable;
+ __this->__construct();
+ return __this;
+}
+
+SHA256_obj::SHA256_obj()
+{
+}
+
+void SHA256_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(SHA256);
+ HX_MARK_MEMBER_NAME(_a,"_a");
+ HX_MARK_MEMBER_NAME(_b,"_b");
+ HX_MARK_MEMBER_NAME(_c,"_c");
+ HX_MARK_MEMBER_NAME(_d,"_d");
+ HX_MARK_MEMBER_NAME(_e,"_e");
+ HX_MARK_MEMBER_NAME(_f,"_f");
+ HX_MARK_MEMBER_NAME(_g,"_g");
+ HX_MARK_MEMBER_NAME(_h,"_h");
+ HX_MARK_MEMBER_NAME(_w,"_w");
+ ::sha::Hash_obj::__Mark(HX_MARK_ARG);
+ HX_MARK_END_CLASS();
+}
+
+void SHA256_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(_a,"_a");
+ HX_VISIT_MEMBER_NAME(_b,"_b");
+ HX_VISIT_MEMBER_NAME(_c,"_c");
+ HX_VISIT_MEMBER_NAME(_d,"_d");
+ HX_VISIT_MEMBER_NAME(_e,"_e");
+ HX_VISIT_MEMBER_NAME(_f,"_f");
+ HX_VISIT_MEMBER_NAME(_g,"_g");
+ HX_VISIT_MEMBER_NAME(_h,"_h");
+ HX_VISIT_MEMBER_NAME(_w,"_w");
+ ::sha::Hash_obj::__Visit(HX_VISIT_ARG);
+}
+
+::hx::Val SHA256_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 2:
+ if (HX_FIELD_EQ(inName,"_a") ) { return ::hx::Val( _a ); }
+ if (HX_FIELD_EQ(inName,"_b") ) { return ::hx::Val( _b ); }
+ if (HX_FIELD_EQ(inName,"_c") ) { return ::hx::Val( _c ); }
+ if (HX_FIELD_EQ(inName,"_d") ) { return ::hx::Val( _d ); }
+ if (HX_FIELD_EQ(inName,"_e") ) { return ::hx::Val( _e ); }
+ if (HX_FIELD_EQ(inName,"_f") ) { return ::hx::Val( _f ); }
+ if (HX_FIELD_EQ(inName,"_g") ) { return ::hx::Val( _g ); }
+ if (HX_FIELD_EQ(inName,"_h") ) { return ::hx::Val( _h ); }
+ if (HX_FIELD_EQ(inName,"_w") ) { return ::hx::Val( _w ); }
+ if (HX_FIELD_EQ(inName,"ch") ) { return ::hx::Val( ch_dyn() ); }
+ break;
+ case 3:
+ if (HX_FIELD_EQ(inName,"maj") ) { return ::hx::Val( maj_dyn() ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"_hash") ) { return ::hx::Val( _hash_dyn() ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"sigma0") ) { return ::hx::Val( sigma0_dyn() ); }
+ if (HX_FIELD_EQ(inName,"sigma1") ) { return ::hx::Val( sigma1_dyn() ); }
+ if (HX_FIELD_EQ(inName,"gamma0") ) { return ::hx::Val( gamma0_dyn() ); }
+ if (HX_FIELD_EQ(inName,"gamma1") ) { return ::hx::Val( gamma1_dyn() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"_update") ) { return ::hx::Val( _update_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val SHA256_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 2:
+ if (HX_FIELD_EQ(inName,"_a") ) { _a=inValue.Cast< int >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"_b") ) { _b=inValue.Cast< int >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"_c") ) { _c=inValue.Cast< int >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"_d") ) { _d=inValue.Cast< int >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"_e") ) { _e=inValue.Cast< int >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"_f") ) { _f=inValue.Cast< int >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"_g") ) { _g=inValue.Cast< int >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"_h") ) { _h=inValue.Cast< int >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"_w") ) { _w=inValue.Cast< ::Array< int > >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void SHA256_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("_a",22,53,00,00));
+ outFields->push(HX_("_b",23,53,00,00));
+ outFields->push(HX_("_c",24,53,00,00));
+ outFields->push(HX_("_d",25,53,00,00));
+ outFields->push(HX_("_e",26,53,00,00));
+ outFields->push(HX_("_f",27,53,00,00));
+ outFields->push(HX_("_g",28,53,00,00));
+ outFields->push(HX_("_h",29,53,00,00));
+ outFields->push(HX_("_w",38,53,00,00));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo SHA256_obj_sMemberStorageInfo[] = {
+ {::hx::fsInt,(int)offsetof(SHA256_obj,_a),HX_("_a",22,53,00,00)},
+ {::hx::fsInt,(int)offsetof(SHA256_obj,_b),HX_("_b",23,53,00,00)},
+ {::hx::fsInt,(int)offsetof(SHA256_obj,_c),HX_("_c",24,53,00,00)},
+ {::hx::fsInt,(int)offsetof(SHA256_obj,_d),HX_("_d",25,53,00,00)},
+ {::hx::fsInt,(int)offsetof(SHA256_obj,_e),HX_("_e",26,53,00,00)},
+ {::hx::fsInt,(int)offsetof(SHA256_obj,_f),HX_("_f",27,53,00,00)},
+ {::hx::fsInt,(int)offsetof(SHA256_obj,_g),HX_("_g",28,53,00,00)},
+ {::hx::fsInt,(int)offsetof(SHA256_obj,_h),HX_("_h",29,53,00,00)},
+ {::hx::fsObject /* ::Array< int > */ ,(int)offsetof(SHA256_obj,_w),HX_("_w",38,53,00,00)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *SHA256_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String SHA256_obj_sMemberFields[] = {
+ HX_("_a",22,53,00,00),
+ HX_("_b",23,53,00,00),
+ HX_("_c",24,53,00,00),
+ HX_("_d",25,53,00,00),
+ HX_("_e",26,53,00,00),
+ HX_("_f",27,53,00,00),
+ HX_("_g",28,53,00,00),
+ HX_("_h",29,53,00,00),
+ HX_("_w",38,53,00,00),
+ HX_("sigma0",eb,6b,85,b4),
+ HX_("sigma1",ec,6b,85,b4),
+ HX_("gamma0",29,bb,ff,50),
+ HX_("gamma1",2a,bb,ff,50),
+ HX_("ch",a5,56,00,00),
+ HX_("maj",96,0a,53,00),
+ HX_("_update",a8,97,7c,f5),
+ HX_("_hash",ad,4b,19,f8),
+ ::String(null()) };
+
+::hx::Class SHA256_obj::__mClass;
+
+void SHA256_obj::__register()
+{
+ SHA256_obj _hx_dummy;
+ SHA256_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("sha.SHA256",89,ca,14,08);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(SHA256_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< SHA256_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = SHA256_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = SHA256_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace sha
diff --git a/Sources/c_snikket/src/sha/_SHA256/SHA256_Fields_.cpp b/Sources/c_snikket/src/sha/_SHA256/SHA256_Fields_.cpp
new file mode 100644
index 0000000..edd16c6
--- /dev/null
+++ b/Sources/c_snikket/src/sha/_SHA256/SHA256_Fields_.cpp
@@ -0,0 +1,119 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_sha__SHA256_SHA256_Fields_
+#include <sha/_SHA256/SHA256_Fields_.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_28eeb24f2f42c3b1_5_boot,"sha._SHA256.SHA256_Fields_","boot",0x84d19c68,"sha._SHA256.SHA256_Fields_.boot","sha/SHA256.hx",5,0xdc816bb4)
+static const int _hx_array_data_510133f8_1[] = {
+ (int)1116352408,(int)1899447441,(int)-1245643825,(int)-373957723,(int)961987163,(int)1508970993,(int)-1841331548,(int)-1424204075,(int)-670586216,(int)310598401,(int)607225278,(int)1426881987,(int)1925078388,(int)-2132889090,(int)-1680079193,(int)-1046744716,(int)-459576895,(int)-272742522,(int)264347078,(int)604807628,(int)770255983,(int)1249150122,(int)1555081692,(int)1996064986,(int)-1740746414,(int)-1473132947,(int)-1341970488,(int)-1084653625,(int)-958395405,(int)-710438585,(int)113926993,(int)338241895,(int)666307205,(int)773529912,(int)1294757372,(int)1396182291,(int)1695183700,(int)1986661051,(int)-2117940946,(int)-1838011259,(int)-1564481375,(int)-1474664885,(int)-1035236496,(int)-949202525,(int)-778901479,(int)-694614492,(int)-200395387,(int)275423344,(int)430227734,(int)506948616,(int)659060556,(int)883997877,(int)958139571,(int)1322822218,(int)1537002063,(int)1747873779,(int)1955562222,(int)2024104815,(int)-2067236844,(int)-1933114872,(int)-1866530822,(int)-1538233109,(int)-1090935817,(int)-965641998,
+};
+namespace sha{
+namespace _SHA256{
+
+void SHA256_Fields__obj::__construct() { }
+
+Dynamic SHA256_Fields__obj::__CreateEmpty() { return new SHA256_Fields__obj; }
+
+void *SHA256_Fields__obj::_hx_vtable = 0;
+
+Dynamic SHA256_Fields__obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< SHA256_Fields__obj > _hx_result = new SHA256_Fields__obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool SHA256_Fields__obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x07d39014;
+}
+
+::Array< int > SHA256_Fields__obj::K;
+
+
+SHA256_Fields__obj::SHA256_Fields__obj()
+{
+}
+
+bool SHA256_Fields__obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 1:
+ if (HX_FIELD_EQ(inName,"K") ) { outValue = ( K ); return true; }
+ }
+ return false;
+}
+
+bool SHA256_Fields__obj::__SetStatic(const ::String &inName,Dynamic &ioValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 1:
+ if (HX_FIELD_EQ(inName,"K") ) { K=ioValue.Cast< ::Array< int > >(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *SHA256_Fields__obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo SHA256_Fields__obj_sStaticStorageInfo[] = {
+ {::hx::fsObject /* ::Array< int > */ ,(void *) &SHA256_Fields__obj::K,HX_("K",4b,00,00,00)},
+ { ::hx::fsUnknown, 0, null()}
+};
+#endif
+
+static void SHA256_Fields__obj_sMarkStatics(HX_MARK_PARAMS) {
+ HX_MARK_MEMBER_NAME(SHA256_Fields__obj::K,"K");
+};
+
+#ifdef HXCPP_VISIT_ALLOCS
+static void SHA256_Fields__obj_sVisitStatics(HX_VISIT_PARAMS) {
+ HX_VISIT_MEMBER_NAME(SHA256_Fields__obj::K,"K");
+};
+
+#endif
+
+::hx::Class SHA256_Fields__obj::__mClass;
+
+static ::String SHA256_Fields__obj_sStaticFields[] = {
+ HX_("K",4b,00,00,00),
+ ::String(null())
+};
+
+void SHA256_Fields__obj::__register()
+{
+ SHA256_Fields__obj _hx_dummy;
+ SHA256_Fields__obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("sha._SHA256.SHA256_Fields_",f8,33,01,51);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &SHA256_Fields__obj::__GetStatic;
+ __mClass->mSetStaticField = &SHA256_Fields__obj::__SetStatic;
+ __mClass->mMarkFunc = SHA256_Fields__obj_sMarkStatics;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(SHA256_Fields__obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< SHA256_Fields__obj >;
+#ifdef HXCPP_VISIT_ALLOCS
+ __mClass->mVisitFunc = SHA256_Fields__obj_sVisitStatics;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = SHA256_Fields__obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = SHA256_Fields__obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void SHA256_Fields__obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_28eeb24f2f42c3b1_5_boot)
+HXDLIN( 5) K = ::Array_obj< int >::fromData( _hx_array_data_510133f8_1,64);
+ }
+}
+
+} // end namespace sha
+} // end namespace _SHA256
diff --git a/Sources/c_snikket/src/snikket/AttachmentSource.cpp b/Sources/c_snikket/src/snikket/AttachmentSource.cpp
new file mode 100644
index 0000000..49b7eeb
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/AttachmentSource.cpp
@@ -0,0 +1,275 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+#ifndef INCLUDED_haxe_io_Input
+#include <haxe/io/Input.h>
+#endif
+#ifndef INCLUDED_haxe_io_Path
+#include <haxe/io/Path.h>
+#endif
+#ifndef INCLUDED_snikket_AttachmentSource
+#include <snikket/AttachmentSource.h>
+#endif
+#ifndef INCLUDED_sys_FileSystem
+#include <sys/FileSystem.h>
+#endif
+#ifndef INCLUDED_sys_io_File
+#include <sys/io/File.h>
+#endif
+#ifndef INCLUDED_sys_io_FileInput
+#include <sys/io/FileInput.h>
+#endif
+#ifndef INCLUDED_tink_io_WorkerObject
+#include <tink/io/WorkerObject.h>
+#endif
+#ifndef INCLUDED_tink_io__Worker_Worker_Impl_
+#include <tink/io/_Worker/Worker_Impl_.h>
+#endif
+#ifndef INCLUDED_tink_io_std_InputSource
+#include <tink/io/std/InputSource.h>
+#endif
+#ifndef INCLUDED_tink_streams_Generator
+#include <tink/streams/Generator.h>
+#endif
+#ifndef INCLUDED_tink_streams_StreamBase
+#include <tink/streams/StreamBase.h>
+#endif
+#ifndef INCLUDED_tink_streams_StreamObject
+#include <tink/streams/StreamObject.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_1589e03dacb7e96d_18_new,"snikket.AttachmentSource","new",0xbdfe18c1,"snikket.AttachmentSource.new","snikket/AttachmentSource.cpp.hx",18,0x88ae23d9)
+HX_LOCAL_STACK_FRAME(_hx_pos_178ee577f3d4b8ba_307_path__fromC,"snikket.AttachmentSource","path__fromC",0xcaffcad5,"snikket.AttachmentSource.path__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_178ee577f3d4b8ba_307_type__fromC,"snikket.AttachmentSource","type__fromC",0xde17ba60,"snikket.AttachmentSource.type__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_178ee577f3d4b8ba_307_name__fromC,"snikket.AttachmentSource","name__fromC",0x5911beef,"snikket.AttachmentSource.name__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_178ee577f3d4b8ba_307_size__fromC,"snikket.AttachmentSource","size__fromC",0x95ffeb39,"snikket.AttachmentSource.size__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_1589e03dacb7e96d_27_tinkSource,"snikket.AttachmentSource","tinkSource",0x8a7a292c,"snikket.AttachmentSource.tinkSource","snikket/AttachmentSource.cpp.hx",27,0x88ae23d9)
+HX_LOCAL_STACK_FRAME(_hx_pos_1589e03dacb7e96d_12_boot,"snikket.AttachmentSource","boot",0x787090b1,"snikket.AttachmentSource.boot","snikket/AttachmentSource.cpp.hx",12,0x88ae23d9)
+namespace snikket{
+
+void AttachmentSource_obj::__construct(::String path,::String mime){
+ HX_STACKFRAME(&_hx_pos_1589e03dacb7e96d_18_new)
+HXLINE( 19) this->name = ::haxe::io::Path_obj::withoutDirectory(path);
+HXLINE( 20) this->path = ::sys::FileSystem_obj::fullPath(path);
+HXLINE( 21) this->size = ( (int)(::sys::FileSystem_obj::stat(this->path)->__Field(HX_("size",c1,a0,53,4c),::hx::paccDynamic)) );
+HXLINE( 22) this->type = mime;
+ }
+
+Dynamic AttachmentSource_obj::__CreateEmpty() { return new AttachmentSource_obj; }
+
+void *AttachmentSource_obj::_hx_vtable = 0;
+
+Dynamic AttachmentSource_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< AttachmentSource_obj > _hx_result = new AttachmentSource_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1]);
+ return _hx_result;
+}
+
+bool AttachmentSource_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x3b403b17;
+}
+
+::String AttachmentSource_obj::path__fromC(){
+ HX_STACKFRAME(&_hx_pos_178ee577f3d4b8ba_307_path__fromC)
+HXDLIN( 307) return this->path;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(AttachmentSource_obj,path__fromC,return )
+
+::String AttachmentSource_obj::type__fromC(){
+ HX_STACKFRAME(&_hx_pos_178ee577f3d4b8ba_307_type__fromC)
+HXDLIN( 307) return this->type;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(AttachmentSource_obj,type__fromC,return )
+
+::String AttachmentSource_obj::name__fromC(){
+ HX_STACKFRAME(&_hx_pos_178ee577f3d4b8ba_307_name__fromC)
+HXDLIN( 307) return this->name;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(AttachmentSource_obj,name__fromC,return )
+
+int AttachmentSource_obj::size__fromC(){
+ HX_STACKFRAME(&_hx_pos_178ee577f3d4b8ba_307_size__fromC)
+HXDLIN( 307) return this->size;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(AttachmentSource_obj,size__fromC,return )
+
+::Dynamic AttachmentSource_obj::tinkSource(){
+ HX_GC_STACKFRAME(&_hx_pos_1589e03dacb7e96d_27_tinkSource)
+HXDLIN( 27) ::String name = this->name;
+HXDLIN( 27) ::haxe::io::Input input = ::sys::io::File_obj::read(this->path,null());
+HXDLIN( 27) ::Dynamic options = null();
+HXDLIN( 27) if (::hx::IsNull( options )) {
+HXDLIN( 27) options = ::Dynamic(::hx::Anon_obj::Create(0));
+ }
+HXDLIN( 27) ::Dynamic _hx_tmp = ::tink::io::_Worker::Worker_Impl__obj::ensure( ::Dynamic(options->__Field(HX_("worker",7e,30,9e,c9),::hx::paccDynamic)));
+HXDLIN( 27) ::Dynamic _g = options->__Field(HX_("chunkSize",ce,cd,77,9f),::hx::paccDynamic);
+HXDLIN( 27) int _hx_tmp1;
+HXDLIN( 27) if (::hx::IsNull( _g )) {
+HXDLIN( 27) _hx_tmp1 = 65536;
+ }
+ else {
+HXDLIN( 27) ::Dynamic v = _g;
+HXDLIN( 27) _hx_tmp1 = ( (int)(v) );
+ }
+HXDLIN( 27) return ::tink::io::std::InputSource_obj::__alloc( HX_CTX ,name,input,_hx_tmp,::haxe::io::Bytes_obj::alloc(_hx_tmp1),0);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(AttachmentSource_obj,tinkSource,return )
+
+
+::hx::ObjectPtr< AttachmentSource_obj > AttachmentSource_obj::__new(::String path,::String mime) {
+ ::hx::ObjectPtr< AttachmentSource_obj > __this = new AttachmentSource_obj();
+ __this->__construct(path,mime);
+ return __this;
+}
+
+::hx::ObjectPtr< AttachmentSource_obj > AttachmentSource_obj::__alloc(::hx::Ctx *_hx_ctx,::String path,::String mime) {
+ AttachmentSource_obj *__this = (AttachmentSource_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(AttachmentSource_obj), true, "snikket.AttachmentSource"));
+ *(void **)__this = AttachmentSource_obj::_hx_vtable;
+ __this->__construct(path,mime);
+ return __this;
+}
+
+AttachmentSource_obj::AttachmentSource_obj()
+{
+}
+
+void AttachmentSource_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(AttachmentSource);
+ HX_MARK_MEMBER_NAME(path,"path");
+ HX_MARK_MEMBER_NAME(type,"type");
+ HX_MARK_MEMBER_NAME(name,"name");
+ HX_MARK_MEMBER_NAME(size,"size");
+ HX_MARK_END_CLASS();
+}
+
+void AttachmentSource_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(path,"path");
+ HX_VISIT_MEMBER_NAME(type,"type");
+ HX_VISIT_MEMBER_NAME(name,"name");
+ HX_VISIT_MEMBER_NAME(size,"size");
+}
+
+::hx::Val AttachmentSource_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"path") ) { return ::hx::Val( path ); }
+ if (HX_FIELD_EQ(inName,"type") ) { return ::hx::Val( type ); }
+ if (HX_FIELD_EQ(inName,"name") ) { return ::hx::Val( name ); }
+ if (HX_FIELD_EQ(inName,"size") ) { return ::hx::Val( size ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"tinkSource") ) { return ::hx::Val( tinkSource_dyn() ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"path__fromC") ) { return ::hx::Val( path__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"type__fromC") ) { return ::hx::Val( type__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"name__fromC") ) { return ::hx::Val( name__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"size__fromC") ) { return ::hx::Val( size__fromC_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val AttachmentSource_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"path") ) { path=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"type") ) { type=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"name") ) { name=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"size") ) { size=inValue.Cast< int >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void AttachmentSource_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("path",a5,e5,51,4a));
+ outFields->push(HX_("type",ba,f2,08,4d));
+ outFields->push(HX_("name",4b,72,ff,48));
+ outFields->push(HX_("size",c1,a0,53,4c));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo AttachmentSource_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(AttachmentSource_obj,path),HX_("path",a5,e5,51,4a)},
+ {::hx::fsString,(int)offsetof(AttachmentSource_obj,type),HX_("type",ba,f2,08,4d)},
+ {::hx::fsString,(int)offsetof(AttachmentSource_obj,name),HX_("name",4b,72,ff,48)},
+ {::hx::fsInt,(int)offsetof(AttachmentSource_obj,size),HX_("size",c1,a0,53,4c)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *AttachmentSource_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String AttachmentSource_obj_sMemberFields[] = {
+ HX_("path",a5,e5,51,4a),
+ HX_("path__fromC",74,b9,54,80),
+ HX_("type",ba,f2,08,4d),
+ HX_("type__fromC",ff,a8,6c,93),
+ HX_("name",4b,72,ff,48),
+ HX_("name__fromC",8e,ad,66,0e),
+ HX_("size",c1,a0,53,4c),
+ HX_("size__fromC",d8,d9,54,4b),
+ HX_("tinkSource",6d,33,ae,02),
+ ::String(null()) };
+
+::hx::Class AttachmentSource_obj::__mClass;
+
+void AttachmentSource_obj::__register()
+{
+ AttachmentSource_obj _hx_dummy;
+ AttachmentSource_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.AttachmentSource",4f,a4,78,4f);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(AttachmentSource_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< AttachmentSource_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = AttachmentSource_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = AttachmentSource_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void AttachmentSource_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_1589e03dacb7e96d_12_boot)
+HXDLIN( 12) __mClass->__meta__ = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("fields",79,8e,8e,80), ::Dynamic(::hx::Anon_obj::Create(4)
+ ->setFixed(0,HX_("path__fromC",74,b9,54,80), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(1,HX_("type__fromC",ff,a8,6c,93), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(2,HX_("name__fromC",8e,ad,66,0e), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(3,HX_("size__fromC",d8,d9,54,4b), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null()))))));
+ }
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/Autolink.cpp b/Sources/c_snikket/src/snikket/Autolink.cpp
new file mode 100644
index 0000000..02b59de
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/Autolink.cpp
@@ -0,0 +1,573 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_EReg
+#include <EReg.h>
+#endif
+#ifndef INCLUDED_Lambda
+#include <Lambda.h>
+#endif
+#ifndef INCLUDED_snikket_Autolink
+#include <snikket/Autolink.h>
+#endif
+#ifndef INCLUDED_snikket_Node
+#include <snikket/Node.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_341_one,"snikket.Autolink","one",0x4e62ad12,"snikket.Autolink.one","snikket/Autolink.hx",341,0x041baf83)
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_342_one,"snikket.Autolink","one",0x4e62ad12,"snikket.Autolink.one","snikket/Autolink.hx",342,0x041baf83)
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_334_one,"snikket.Autolink","one",0x4e62ad12,"snikket.Autolink.one","snikket/Autolink.hx",334,0x041baf83)
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_345_match,"snikket.Autolink","match",0x7edc5ef1,"snikket.Autolink.match","snikket/Autolink.hx",345,0x041baf83)
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_28_boot,"snikket.Autolink","boot",0x3f5dc806,"snikket.Autolink.boot","snikket/Autolink.hx",28,0x041baf83)
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_40_boot,"snikket.Autolink","boot",0x3f5dc806,"snikket.Autolink.boot","snikket/Autolink.hx",40,0x041baf83)
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_162_boot,"snikket.Autolink","boot",0x3f5dc806,"snikket.Autolink.boot","snikket/Autolink.hx",162,0x041baf83)
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_164_boot,"snikket.Autolink","boot",0x3f5dc806,"snikket.Autolink.boot","snikket/Autolink.hx",164,0x041baf83)
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_181_boot,"snikket.Autolink","boot",0x3f5dc806,"snikket.Autolink.boot","snikket/Autolink.hx",181,0x041baf83)
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_202_boot,"snikket.Autolink","boot",0x3f5dc806,"snikket.Autolink.boot","snikket/Autolink.hx",202,0x041baf83)
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_224_boot,"snikket.Autolink","boot",0x3f5dc806,"snikket.Autolink.boot","snikket/Autolink.hx",224,0x041baf83)
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_233_boot,"snikket.Autolink","boot",0x3f5dc806,"snikket.Autolink.boot","snikket/Autolink.hx",233,0x041baf83)
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_237_boot,"snikket.Autolink","boot",0x3f5dc806,"snikket.Autolink.boot","snikket/Autolink.hx",237,0x041baf83)
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_242_boot,"snikket.Autolink","boot",0x3f5dc806,"snikket.Autolink.boot","snikket/Autolink.hx",242,0x041baf83)
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_244_boot,"snikket.Autolink","boot",0x3f5dc806,"snikket.Autolink.boot","snikket/Autolink.hx",244,0x041baf83)
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_245_boot,"snikket.Autolink","boot",0x3f5dc806,"snikket.Autolink.boot","snikket/Autolink.hx",245,0x041baf83)
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_248_boot,"snikket.Autolink","boot",0x3f5dc806,"snikket.Autolink.boot","snikket/Autolink.hx",248,0x041baf83)
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_249_boot,"snikket.Autolink","boot",0x3f5dc806,"snikket.Autolink.boot","snikket/Autolink.hx",249,0x041baf83)
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_252_boot,"snikket.Autolink","boot",0x3f5dc806,"snikket.Autolink.boot","snikket/Autolink.hx",252,0x041baf83)
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_269_boot,"snikket.Autolink","boot",0x3f5dc806,"snikket.Autolink.boot","snikket/Autolink.hx",269,0x041baf83)
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_274_boot,"snikket.Autolink","boot",0x3f5dc806,"snikket.Autolink.boot","snikket/Autolink.hx",274,0x041baf83)
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_281_boot,"snikket.Autolink","boot",0x3f5dc806,"snikket.Autolink.boot","snikket/Autolink.hx",281,0x041baf83)
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_286_boot,"snikket.Autolink","boot",0x3f5dc806,"snikket.Autolink.boot","snikket/Autolink.hx",286,0x041baf83)
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_291_boot,"snikket.Autolink","boot",0x3f5dc806,"snikket.Autolink.boot","snikket/Autolink.hx",291,0x041baf83)
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_304_boot,"snikket.Autolink","boot",0x3f5dc806,"snikket.Autolink.boot","snikket/Autolink.hx",304,0x041baf83)
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_321_boot,"snikket.Autolink","boot",0x3f5dc806,"snikket.Autolink.boot","snikket/Autolink.hx",321,0x041baf83)
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_324_boot,"snikket.Autolink","boot",0x3f5dc806,"snikket.Autolink.boot","snikket/Autolink.hx",324,0x041baf83)
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_327_boot,"snikket.Autolink","boot",0x3f5dc806,"snikket.Autolink.boot","snikket/Autolink.hx",327,0x041baf83)
+HX_LOCAL_STACK_FRAME(_hx_pos_e03e81a8315e14a8_329_boot,"snikket.Autolink","boot",0x3f5dc806,"snikket.Autolink.boot","snikket/Autolink.hx",329,0x041baf83)
+namespace snikket{
+
+void Autolink_obj::__construct() { }
+
+Dynamic Autolink_obj::__CreateEmpty() { return new Autolink_obj; }
+
+void *Autolink_obj::_hx_vtable = 0;
+
+Dynamic Autolink_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Autolink_obj > _hx_result = new Autolink_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool Autolink_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x257fedc6;
+}
+
+::String Autolink_obj::IANA_TOP_LEVEL_DOMAINS;
+
+::String Autolink_obj::GOOD_IRI_CHAR;
+
+::String Autolink_obj::IP_ADDRESS;
+
+::String Autolink_obj::IP6_ADDRESS;
+
+::String Autolink_obj::UCS_CHAR;
+
+::String Autolink_obj::LABEL_CHAR;
+
+::String Autolink_obj::IRI_LABEL;
+
+::String Autolink_obj::PUNYCODE_TLD;
+
+::String Autolink_obj::PROTOCOL;
+
+::String Autolink_obj::WORD_BOUNDARY;
+
+::String Autolink_obj::USER_INFO;
+
+::String Autolink_obj::PORT_NUMBER;
+
+::String Autolink_obj::PATH_CHAR;
+
+::String Autolink_obj::PATH_AND_QUERY;
+
+::String Autolink_obj::STRICT_TLD;
+
+::String Autolink_obj::STRICT_HOST_NAME;
+
+::String Autolink_obj::STRICT_DOMAIN_NAME;
+
+::String Autolink_obj::RELAXED_DOMAIN_NAME;
+
+::String Autolink_obj::WEB_URL_WITHOUT_PROTOCOL;
+
+::String Autolink_obj::WEB_URL_WITH_PROTOCOL;
+
+::String Autolink_obj::AUTOLINK_WEB_URL;
+
+::String Autolink_obj::TEL_URI;
+
+::String Autolink_obj::SMS_URI;
+
+::String Autolink_obj::XMPP_URI;
+
+ ::Dynamic Autolink_obj::one(::String s,int start){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(2)
+ int _hx_run( ::Dynamic x, ::Dynamic y){
+ HX_STACKFRAME(&_hx_pos_e03e81a8315e14a8_341_one)
+HXLINE( 341) return (( (int)(x->__Field(HX_("start",62,74,0b,84),::hx::paccDynamic)) ) - ( (int)(y->__Field(HX_("start",62,74,0b,84),::hx::paccDynamic)) ));
+ }
+ HX_END_LOCAL_FUNC2(return)
+
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_1) HXARGC(1)
+ bool _hx_run( ::Dynamic match){
+ HX_STACKFRAME(&_hx_pos_e03e81a8315e14a8_342_one)
+HXLINE( 342) return ::hx::IsNotNull( match->__Field(HX_("span",ca,da,58,4c),::hx::paccDynamic) );
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_e03e81a8315e14a8_334_one)
+HXLINE( 336) ::Dynamic matches = ::snikket::Autolink_obj::match(s,start,::snikket::Autolink_obj::XMPP_URI,false);
+HXLINE( 337) ::Dynamic matches1 = ::snikket::Autolink_obj::match(s,start,::snikket::Autolink_obj::TEL_URI,false);
+HXLINE( 338) ::Dynamic matches2 = ::snikket::Autolink_obj::match(s,start,::snikket::Autolink_obj::SMS_URI,false);
+HXLINE( 335) ::Array< ::Dynamic> matches3 = ::Array_obj< ::Dynamic>::__new(4)->init(0,matches)->init(1,matches1)->init(2,matches2)->init(3,::snikket::Autolink_obj::match(s,start,::snikket::Autolink_obj::AUTOLINK_WEB_URL,true));
+HXLINE( 341) matches3->sort( ::Dynamic(new _hx_Closure_0()));
+HXLINE( 342) ::Dynamic tmp = ::Lambda_obj::find(matches3, ::Dynamic(new _hx_Closure_1()));
+HXDLIN( 342) if (::hx::IsNotNull( tmp )) {
+HXLINE( 342) return tmp;
+ }
+ else {
+HXLINE( 342) return matches3->__get(0);
+ }
+HXDLIN( 342) return null();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Autolink_obj,one,return )
+
+ ::Dynamic Autolink_obj::match(::String s,int start,::String pattern,bool addHttps){
+ HX_GC_STACKFRAME(&_hx_pos_e03e81a8315e14a8_345_match)
+HXLINE( 347) ::EReg pattern1 = ::EReg_obj::__alloc( HX_CTX ,pattern,HX_("u",75,00,00,00));
+HXLINE( 348) if (pattern1->matchSub(s,start,null())) {
+HXLINE( 349) ::Dynamic pos = pattern1->matchedPos();
+HXLINE( 350) ::String link = pattern1->matched(0);
+HXLINE( 351) ::String uri;
+HXDLIN( 351) bool uri1;
+HXDLIN( 351) if (addHttps) {
+HXLINE( 351) uri1 = (link.indexOf(HX_("://",da,2b,2c,00),null()) != -1);
+ }
+ else {
+HXLINE( 351) uri1 = true;
+ }
+HXDLIN( 351) if (uri1) {
+HXLINE( 351) uri = link;
+ }
+ else {
+HXLINE( 351) uri = (HX_("https://",cf,b4,ae,3e) + link);
+ }
+HXLINE( 353) ::snikket::Node _hx_tmp = ::snikket::Node_obj::Element( ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("a",61,00,00,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("href",eb,09,15,45),uri)))->text(link));
+HXDLIN( 353) return ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("start",62,74,0b,84), ::Dynamic(pos->__Field(HX_("pos",94,5d,55,00),::hx::paccDynamic)))
+ ->setFixed(1,HX_("end",db,03,4d,00), ::Dynamic((pos->__Field(HX_("pos",94,5d,55,00),::hx::paccDynamic) + pos->__Field(HX_("len",d5,4b,52,00),::hx::paccDynamic))))
+ ->setFixed(2,HX_("span",ca,da,58,4c),_hx_tmp));
+ }
+ else {
+HXLINE( 355) return ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("start",62,74,0b,84),s.length)
+ ->setFixed(1,HX_("end",db,03,4d,00),s.length)
+ ->setFixed(2,HX_("span",ca,da,58,4c),null()));
+ }
+HXLINE( 348) return null();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC4(Autolink_obj,match,return )
+
+
+Autolink_obj::Autolink_obj()
+{
+}
+
+bool Autolink_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"one") ) { outValue = one_dyn(); return true; }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"match") ) { outValue = match_dyn(); return true; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"TEL_URI") ) { outValue = ( TEL_URI ); return true; }
+ if (HX_FIELD_EQ(inName,"SMS_URI") ) { outValue = ( SMS_URI ); return true; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"UCS_CHAR") ) { outValue = ( UCS_CHAR ); return true; }
+ if (HX_FIELD_EQ(inName,"PROTOCOL") ) { outValue = ( PROTOCOL ); return true; }
+ if (HX_FIELD_EQ(inName,"XMPP_URI") ) { outValue = ( XMPP_URI ); return true; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"IRI_LABEL") ) { outValue = ( IRI_LABEL ); return true; }
+ if (HX_FIELD_EQ(inName,"USER_INFO") ) { outValue = ( USER_INFO ); return true; }
+ if (HX_FIELD_EQ(inName,"PATH_CHAR") ) { outValue = ( PATH_CHAR ); return true; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"IP_ADDRESS") ) { outValue = ( IP_ADDRESS ); return true; }
+ if (HX_FIELD_EQ(inName,"LABEL_CHAR") ) { outValue = ( LABEL_CHAR ); return true; }
+ if (HX_FIELD_EQ(inName,"STRICT_TLD") ) { outValue = ( STRICT_TLD ); return true; }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"IP6_ADDRESS") ) { outValue = ( IP6_ADDRESS ); return true; }
+ if (HX_FIELD_EQ(inName,"PORT_NUMBER") ) { outValue = ( PORT_NUMBER ); return true; }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"PUNYCODE_TLD") ) { outValue = ( PUNYCODE_TLD ); return true; }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"GOOD_IRI_CHAR") ) { outValue = ( GOOD_IRI_CHAR ); return true; }
+ if (HX_FIELD_EQ(inName,"WORD_BOUNDARY") ) { outValue = ( WORD_BOUNDARY ); return true; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"PATH_AND_QUERY") ) { outValue = ( PATH_AND_QUERY ); return true; }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"STRICT_HOST_NAME") ) { outValue = ( STRICT_HOST_NAME ); return true; }
+ if (HX_FIELD_EQ(inName,"AUTOLINK_WEB_URL") ) { outValue = ( AUTOLINK_WEB_URL ); return true; }
+ break;
+ case 18:
+ if (HX_FIELD_EQ(inName,"STRICT_DOMAIN_NAME") ) { outValue = ( STRICT_DOMAIN_NAME ); return true; }
+ break;
+ case 19:
+ if (HX_FIELD_EQ(inName,"RELAXED_DOMAIN_NAME") ) { outValue = ( RELAXED_DOMAIN_NAME ); return true; }
+ break;
+ case 21:
+ if (HX_FIELD_EQ(inName,"WEB_URL_WITH_PROTOCOL") ) { outValue = ( WEB_URL_WITH_PROTOCOL ); return true; }
+ break;
+ case 22:
+ if (HX_FIELD_EQ(inName,"IANA_TOP_LEVEL_DOMAINS") ) { outValue = ( IANA_TOP_LEVEL_DOMAINS ); return true; }
+ break;
+ case 24:
+ if (HX_FIELD_EQ(inName,"WEB_URL_WITHOUT_PROTOCOL") ) { outValue = ( WEB_URL_WITHOUT_PROTOCOL ); return true; }
+ }
+ return false;
+}
+
+bool Autolink_obj::__SetStatic(const ::String &inName,Dynamic &ioValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 7:
+ if (HX_FIELD_EQ(inName,"TEL_URI") ) { TEL_URI=ioValue.Cast< ::String >(); return true; }
+ if (HX_FIELD_EQ(inName,"SMS_URI") ) { SMS_URI=ioValue.Cast< ::String >(); return true; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"UCS_CHAR") ) { UCS_CHAR=ioValue.Cast< ::String >(); return true; }
+ if (HX_FIELD_EQ(inName,"PROTOCOL") ) { PROTOCOL=ioValue.Cast< ::String >(); return true; }
+ if (HX_FIELD_EQ(inName,"XMPP_URI") ) { XMPP_URI=ioValue.Cast< ::String >(); return true; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"IRI_LABEL") ) { IRI_LABEL=ioValue.Cast< ::String >(); return true; }
+ if (HX_FIELD_EQ(inName,"USER_INFO") ) { USER_INFO=ioValue.Cast< ::String >(); return true; }
+ if (HX_FIELD_EQ(inName,"PATH_CHAR") ) { PATH_CHAR=ioValue.Cast< ::String >(); return true; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"IP_ADDRESS") ) { IP_ADDRESS=ioValue.Cast< ::String >(); return true; }
+ if (HX_FIELD_EQ(inName,"LABEL_CHAR") ) { LABEL_CHAR=ioValue.Cast< ::String >(); return true; }
+ if (HX_FIELD_EQ(inName,"STRICT_TLD") ) { STRICT_TLD=ioValue.Cast< ::String >(); return true; }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"IP6_ADDRESS") ) { IP6_ADDRESS=ioValue.Cast< ::String >(); return true; }
+ if (HX_FIELD_EQ(inName,"PORT_NUMBER") ) { PORT_NUMBER=ioValue.Cast< ::String >(); return true; }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"PUNYCODE_TLD") ) { PUNYCODE_TLD=ioValue.Cast< ::String >(); return true; }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"GOOD_IRI_CHAR") ) { GOOD_IRI_CHAR=ioValue.Cast< ::String >(); return true; }
+ if (HX_FIELD_EQ(inName,"WORD_BOUNDARY") ) { WORD_BOUNDARY=ioValue.Cast< ::String >(); return true; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"PATH_AND_QUERY") ) { PATH_AND_QUERY=ioValue.Cast< ::String >(); return true; }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"STRICT_HOST_NAME") ) { STRICT_HOST_NAME=ioValue.Cast< ::String >(); return true; }
+ if (HX_FIELD_EQ(inName,"AUTOLINK_WEB_URL") ) { AUTOLINK_WEB_URL=ioValue.Cast< ::String >(); return true; }
+ break;
+ case 18:
+ if (HX_FIELD_EQ(inName,"STRICT_DOMAIN_NAME") ) { STRICT_DOMAIN_NAME=ioValue.Cast< ::String >(); return true; }
+ break;
+ case 19:
+ if (HX_FIELD_EQ(inName,"RELAXED_DOMAIN_NAME") ) { RELAXED_DOMAIN_NAME=ioValue.Cast< ::String >(); return true; }
+ break;
+ case 21:
+ if (HX_FIELD_EQ(inName,"WEB_URL_WITH_PROTOCOL") ) { WEB_URL_WITH_PROTOCOL=ioValue.Cast< ::String >(); return true; }
+ break;
+ case 22:
+ if (HX_FIELD_EQ(inName,"IANA_TOP_LEVEL_DOMAINS") ) { IANA_TOP_LEVEL_DOMAINS=ioValue.Cast< ::String >(); return true; }
+ break;
+ case 24:
+ if (HX_FIELD_EQ(inName,"WEB_URL_WITHOUT_PROTOCOL") ) { WEB_URL_WITHOUT_PROTOCOL=ioValue.Cast< ::String >(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *Autolink_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo Autolink_obj_sStaticStorageInfo[] = {
+ {::hx::fsString,(void *) &Autolink_obj::IANA_TOP_LEVEL_DOMAINS,HX_("IANA_TOP_LEVEL_DOMAINS",76,8c,95,2a)},
+ {::hx::fsString,(void *) &Autolink_obj::GOOD_IRI_CHAR,HX_("GOOD_IRI_CHAR",f7,b8,57,73)},
+ {::hx::fsString,(void *) &Autolink_obj::IP_ADDRESS,HX_("IP_ADDRESS",fc,9d,44,17)},
+ {::hx::fsString,(void *) &Autolink_obj::IP6_ADDRESS,HX_("IP6_ADDRESS",84,d0,35,ac)},
+ {::hx::fsString,(void *) &Autolink_obj::UCS_CHAR,HX_("UCS_CHAR",50,2e,0e,ef)},
+ {::hx::fsString,(void *) &Autolink_obj::LABEL_CHAR,HX_("LABEL_CHAR",61,5c,62,dc)},
+ {::hx::fsString,(void *) &Autolink_obj::IRI_LABEL,HX_("IRI_LABEL",55,e9,22,3e)},
+ {::hx::fsString,(void *) &Autolink_obj::PUNYCODE_TLD,HX_("PUNYCODE_TLD",0a,3e,93,39)},
+ {::hx::fsString,(void *) &Autolink_obj::PROTOCOL,HX_("PROTOCOL",58,e6,e8,59)},
+ {::hx::fsString,(void *) &Autolink_obj::WORD_BOUNDARY,HX_("WORD_BOUNDARY",3f,bd,f5,47)},
+ {::hx::fsString,(void *) &Autolink_obj::USER_INFO,HX_("USER_INFO",22,92,9c,77)},
+ {::hx::fsString,(void *) &Autolink_obj::PORT_NUMBER,HX_("PORT_NUMBER",07,db,d1,b4)},
+ {::hx::fsString,(void *) &Autolink_obj::PATH_CHAR,HX_("PATH_CHAR",f0,fe,8d,bf)},
+ {::hx::fsString,(void *) &Autolink_obj::PATH_AND_QUERY,HX_("PATH_AND_QUERY",c6,8d,28,99)},
+ {::hx::fsString,(void *) &Autolink_obj::STRICT_TLD,HX_("STRICT_TLD",96,e8,bf,23)},
+ {::hx::fsString,(void *) &Autolink_obj::STRICT_HOST_NAME,HX_("STRICT_HOST_NAME",0c,82,05,83)},
+ {::hx::fsString,(void *) &Autolink_obj::STRICT_DOMAIN_NAME,HX_("STRICT_DOMAIN_NAME",30,25,e6,f0)},
+ {::hx::fsString,(void *) &Autolink_obj::RELAXED_DOMAIN_NAME,HX_("RELAXED_DOMAIN_NAME",b6,71,df,1f)},
+ {::hx::fsString,(void *) &Autolink_obj::WEB_URL_WITHOUT_PROTOCOL,HX_("WEB_URL_WITHOUT_PROTOCOL",aa,4d,e7,46)},
+ {::hx::fsString,(void *) &Autolink_obj::WEB_URL_WITH_PROTOCOL,HX_("WEB_URL_WITH_PROTOCOL",f6,04,a9,cf)},
+ {::hx::fsString,(void *) &Autolink_obj::AUTOLINK_WEB_URL,HX_("AUTOLINK_WEB_URL",2e,ec,59,4b)},
+ {::hx::fsString,(void *) &Autolink_obj::TEL_URI,HX_("TEL_URI",88,ff,2a,3d)},
+ {::hx::fsString,(void *) &Autolink_obj::SMS_URI,HX_("SMS_URI",46,7b,3e,4e)},
+ {::hx::fsString,(void *) &Autolink_obj::XMPP_URI,HX_("XMPP_URI",02,45,f3,76)},
+ { ::hx::fsUnknown, 0, null()}
+};
+#endif
+
+static void Autolink_obj_sMarkStatics(HX_MARK_PARAMS) {
+ HX_MARK_MEMBER_NAME(Autolink_obj::IANA_TOP_LEVEL_DOMAINS,"IANA_TOP_LEVEL_DOMAINS");
+ HX_MARK_MEMBER_NAME(Autolink_obj::GOOD_IRI_CHAR,"GOOD_IRI_CHAR");
+ HX_MARK_MEMBER_NAME(Autolink_obj::IP_ADDRESS,"IP_ADDRESS");
+ HX_MARK_MEMBER_NAME(Autolink_obj::IP6_ADDRESS,"IP6_ADDRESS");
+ HX_MARK_MEMBER_NAME(Autolink_obj::UCS_CHAR,"UCS_CHAR");
+ HX_MARK_MEMBER_NAME(Autolink_obj::LABEL_CHAR,"LABEL_CHAR");
+ HX_MARK_MEMBER_NAME(Autolink_obj::IRI_LABEL,"IRI_LABEL");
+ HX_MARK_MEMBER_NAME(Autolink_obj::PUNYCODE_TLD,"PUNYCODE_TLD");
+ HX_MARK_MEMBER_NAME(Autolink_obj::PROTOCOL,"PROTOCOL");
+ HX_MARK_MEMBER_NAME(Autolink_obj::WORD_BOUNDARY,"WORD_BOUNDARY");
+ HX_MARK_MEMBER_NAME(Autolink_obj::USER_INFO,"USER_INFO");
+ HX_MARK_MEMBER_NAME(Autolink_obj::PORT_NUMBER,"PORT_NUMBER");
+ HX_MARK_MEMBER_NAME(Autolink_obj::PATH_CHAR,"PATH_CHAR");
+ HX_MARK_MEMBER_NAME(Autolink_obj::PATH_AND_QUERY,"PATH_AND_QUERY");
+ HX_MARK_MEMBER_NAME(Autolink_obj::STRICT_TLD,"STRICT_TLD");
+ HX_MARK_MEMBER_NAME(Autolink_obj::STRICT_HOST_NAME,"STRICT_HOST_NAME");
+ HX_MARK_MEMBER_NAME(Autolink_obj::STRICT_DOMAIN_NAME,"STRICT_DOMAIN_NAME");
+ HX_MARK_MEMBER_NAME(Autolink_obj::RELAXED_DOMAIN_NAME,"RELAXED_DOMAIN_NAME");
+ HX_MARK_MEMBER_NAME(Autolink_obj::WEB_URL_WITHOUT_PROTOCOL,"WEB_URL_WITHOUT_PROTOCOL");
+ HX_MARK_MEMBER_NAME(Autolink_obj::WEB_URL_WITH_PROTOCOL,"WEB_URL_WITH_PROTOCOL");
+ HX_MARK_MEMBER_NAME(Autolink_obj::AUTOLINK_WEB_URL,"AUTOLINK_WEB_URL");
+ HX_MARK_MEMBER_NAME(Autolink_obj::TEL_URI,"TEL_URI");
+ HX_MARK_MEMBER_NAME(Autolink_obj::SMS_URI,"SMS_URI");
+ HX_MARK_MEMBER_NAME(Autolink_obj::XMPP_URI,"XMPP_URI");
+};
+
+#ifdef HXCPP_VISIT_ALLOCS
+static void Autolink_obj_sVisitStatics(HX_VISIT_PARAMS) {
+ HX_VISIT_MEMBER_NAME(Autolink_obj::IANA_TOP_LEVEL_DOMAINS,"IANA_TOP_LEVEL_DOMAINS");
+ HX_VISIT_MEMBER_NAME(Autolink_obj::GOOD_IRI_CHAR,"GOOD_IRI_CHAR");
+ HX_VISIT_MEMBER_NAME(Autolink_obj::IP_ADDRESS,"IP_ADDRESS");
+ HX_VISIT_MEMBER_NAME(Autolink_obj::IP6_ADDRESS,"IP6_ADDRESS");
+ HX_VISIT_MEMBER_NAME(Autolink_obj::UCS_CHAR,"UCS_CHAR");
+ HX_VISIT_MEMBER_NAME(Autolink_obj::LABEL_CHAR,"LABEL_CHAR");
+ HX_VISIT_MEMBER_NAME(Autolink_obj::IRI_LABEL,"IRI_LABEL");
+ HX_VISIT_MEMBER_NAME(Autolink_obj::PUNYCODE_TLD,"PUNYCODE_TLD");
+ HX_VISIT_MEMBER_NAME(Autolink_obj::PROTOCOL,"PROTOCOL");
+ HX_VISIT_MEMBER_NAME(Autolink_obj::WORD_BOUNDARY,"WORD_BOUNDARY");
+ HX_VISIT_MEMBER_NAME(Autolink_obj::USER_INFO,"USER_INFO");
+ HX_VISIT_MEMBER_NAME(Autolink_obj::PORT_NUMBER,"PORT_NUMBER");
+ HX_VISIT_MEMBER_NAME(Autolink_obj::PATH_CHAR,"PATH_CHAR");
+ HX_VISIT_MEMBER_NAME(Autolink_obj::PATH_AND_QUERY,"PATH_AND_QUERY");
+ HX_VISIT_MEMBER_NAME(Autolink_obj::STRICT_TLD,"STRICT_TLD");
+ HX_VISIT_MEMBER_NAME(Autolink_obj::STRICT_HOST_NAME,"STRICT_HOST_NAME");
+ HX_VISIT_MEMBER_NAME(Autolink_obj::STRICT_DOMAIN_NAME,"STRICT_DOMAIN_NAME");
+ HX_VISIT_MEMBER_NAME(Autolink_obj::RELAXED_DOMAIN_NAME,"RELAXED_DOMAIN_NAME");
+ HX_VISIT_MEMBER_NAME(Autolink_obj::WEB_URL_WITHOUT_PROTOCOL,"WEB_URL_WITHOUT_PROTOCOL");
+ HX_VISIT_MEMBER_NAME(Autolink_obj::WEB_URL_WITH_PROTOCOL,"WEB_URL_WITH_PROTOCOL");
+ HX_VISIT_MEMBER_NAME(Autolink_obj::AUTOLINK_WEB_URL,"AUTOLINK_WEB_URL");
+ HX_VISIT_MEMBER_NAME(Autolink_obj::TEL_URI,"TEL_URI");
+ HX_VISIT_MEMBER_NAME(Autolink_obj::SMS_URI,"SMS_URI");
+ HX_VISIT_MEMBER_NAME(Autolink_obj::XMPP_URI,"XMPP_URI");
+};
+
+#endif
+
+::hx::Class Autolink_obj::__mClass;
+
+static ::String Autolink_obj_sStaticFields[] = {
+ HX_("IANA_TOP_LEVEL_DOMAINS",76,8c,95,2a),
+ HX_("GOOD_IRI_CHAR",f7,b8,57,73),
+ HX_("IP_ADDRESS",fc,9d,44,17),
+ HX_("IP6_ADDRESS",84,d0,35,ac),
+ HX_("UCS_CHAR",50,2e,0e,ef),
+ HX_("LABEL_CHAR",61,5c,62,dc),
+ HX_("IRI_LABEL",55,e9,22,3e),
+ HX_("PUNYCODE_TLD",0a,3e,93,39),
+ HX_("PROTOCOL",58,e6,e8,59),
+ HX_("WORD_BOUNDARY",3f,bd,f5,47),
+ HX_("USER_INFO",22,92,9c,77),
+ HX_("PORT_NUMBER",07,db,d1,b4),
+ HX_("PATH_CHAR",f0,fe,8d,bf),
+ HX_("PATH_AND_QUERY",c6,8d,28,99),
+ HX_("STRICT_TLD",96,e8,bf,23),
+ HX_("STRICT_HOST_NAME",0c,82,05,83),
+ HX_("STRICT_DOMAIN_NAME",30,25,e6,f0),
+ HX_("RELAXED_DOMAIN_NAME",b6,71,df,1f),
+ HX_("WEB_URL_WITHOUT_PROTOCOL",aa,4d,e7,46),
+ HX_("WEB_URL_WITH_PROTOCOL",f6,04,a9,cf),
+ HX_("AUTOLINK_WEB_URL",2e,ec,59,4b),
+ HX_("TEL_URI",88,ff,2a,3d),
+ HX_("SMS_URI",46,7b,3e,4e),
+ HX_("XMPP_URI",02,45,f3,76),
+ HX_("one",66,9a,54,00),
+ HX_("match",45,49,23,03),
+ ::String(null())
+};
+
+void Autolink_obj::__register()
+{
+ Autolink_obj _hx_dummy;
+ Autolink_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.Autolink",1a,ad,e0,f4);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Autolink_obj::__GetStatic;
+ __mClass->mSetStaticField = &Autolink_obj::__SetStatic;
+ __mClass->mMarkFunc = Autolink_obj_sMarkStatics;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Autolink_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< Autolink_obj >;
+#ifdef HXCPP_VISIT_ALLOCS
+ __mClass->mVisitFunc = Autolink_obj_sVisitStatics;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Autolink_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Autolink_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void Autolink_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_e03e81a8315e14a8_28_boot)
+HXDLIN( 28) __mClass->__meta__ = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("statics",05,3c,65,36), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("GOOD_IRI_CHAR",f7,b8,57,73), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("Deprecated",93,03,d4,7a),null()))))));
+ }
+{
+ HX_STACKFRAME(&_hx_pos_e03e81a8315e14a8_40_boot)
+HXDLIN( 40) IANA_TOP_LEVEL_DOMAINS = ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((HX_("(?:",43,91,1e,00) + HX_("(?:aaa|aarp|abb|abbott|abogado|academy|accenture|accountant|accountants|aco|active",90,12,72,e0)) + HX_("|actor|ads|adult|aeg|aero|afl|agency|aig|airforce|airtel|allfinanz|alsace|amica|amsterdam",4b,e1,62,2e)) + HX_("|android|apartments|app|apple|aquarelle|aramco|archi|army|arpa|arte|asia|associates",8f,9a,6b,09)) + HX_("|attorney|auction|audio|auto|autos|axa|azure|a[cdefgilmoqrstuwxz])",ff,35,8a,a6)) + HX_("|(?:band|bank|bar|barcelona|barclaycard|barclays|bargains|bauhaus|bayern|bbc|bbva",fa,5a,d9,ba)) + HX_("|bcn|beats|beer|bentley|berlin|best|bet|bharti|bible|bid|bike|bing|bingo|bio|biz|black",cd,34,df,8a)) + HX_("|blackfriday|bloomberg|blue|bms|bmw|bnl|bnpparibas|boats|bom|bond|boo|boots|boutique",a0,59,71,55)) + HX_("|bradesco|bridgestone|broadway|broker|brother|brussels|budapest|build|builders|business",d2,de,1e,e1)) + HX_("|buzz|bzh|b[abdefghijmnorstvwyz])",87,31,5b,fc)) + HX_("|(?:cab|cafe|cal|camera|camp|cancerresearch|canon|capetown|capital|car|caravan|cards",26,5e,8c,48)) + HX_("|care|career|careers|cars|cartier|casa|cash|casino|cat|catering|cba|cbn|ceb|center|ceo",7f,64,bf,5f)) + HX_("|cern|cfa|cfd|chanel|channel|chat|cheap|chloe|christmas|chrome|church|cipriani|cisco",f4,85,3e,a7)) + HX_("|citic|city|cityeats|claims|cleaning|click|clinic|clothing|cloud|club|clubmed|coach",fc,f4,94,ae)) + HX_("|codes|coffee|college|cologne|com|commbank|community|company|computer|comsec|condos",4c,80,70,64)) + HX_("|construction|consulting|contractors|cooking|cool|coop|corsica|country|coupons|courses",ce,0a,99,55)) + HX_("|credit|creditcard|creditunion|cricket|crown|crs|cruises|csc|cuisinella|cymru|cyou|c[acdfghiklmnoruvwxyz])",40,d2,44,eb)) + HX_("|(?:dabur|dad|dance|date|dating|datsun|day|dclk|deals|degree|delivery|dell|delta",23,e0,18,1d)) + HX_("|democrat|dental|dentist|desi|design|dev|diamonds|diet|digital|direct|directory|discount",0c,44,48,a2)) + HX_("|dnp|docs|dog|doha|domains|doosan|download|drive|durban|dvag|d[ejkmoz])",47,96,49,b1)) + HX_("|(?:earth|eat|edu|education|email|emerck|energy|engineer|engineering|enterprises",48,37,7e,b3)) + HX_("|epson|equipment|erni|esq|estate|eurovision|eus|events|everbank|exchange|expert|exposed",ea,8d,a9,49)) + HX_("|express|e[cegrstu])",95,df,9a,c7)) + HX_("|(?:fage|fail|fairwinds|faith|family|fan|fans|farm|fashion|feedback|ferrero|film",b6,d0,f7,65)) + HX_("|final|finance|financial|firmdale|fish|fishing|fit|fitness|flights|florist|flowers|flsmidth",cb,ea,89,98)) + HX_("|fly|foo|football|forex|forsale|forum|foundation|frl|frogans|fund|furniture|futbol|fyi",31,b9,85,c5)) + HX_("|f[ijkmor])",03,5c,5e,87)) + HX_("|(?:gal|gallery|game|garden|gbiz|gdn|gea|gent|genting|ggee|gift|gifts|gives|giving",cb,a8,f7,39)) + HX_("|glass|gle|global|globo|gmail|gmo|gmx|gold|goldpoint|golf|goo|goog|google|gop|gov|grainger",2a,8a,a8,8e)) + HX_("|graphics|gratis|green|gripe|group|gucci|guge|guide|guitars|guru|g[abdefghilmnpqrstuwy])",1f,1b,e4,52)) + HX_("|(?:hamburg|hangout|haus|healthcare|help|here|hermes|hiphop|hitachi|hiv|hockey|holdings",2e,43,06,62)) + HX_("|holiday|homedepot|homes|honda|horse|host|hosting|hoteles|hotmail|house|how|hsbc|hyundai",9c,5b,64,3e)) + HX_("|h[kmnrtu])",c2,e7,7b,0e)) + HX_("|(?:ibm|icbc|ice|icu|ifm|iinet|immo|immobilien|industries|infiniti|info|ing|ink|institute",3d,b0,f2,8e)) + HX_("|insure|int|international|investments|ipiranga|irish|ist|istanbul|itau|iwc|i[delmnoqrst])",2e,f1,11,5d)) + HX_("|(?:jaguar|java|jcb|jetzt|jewelry|jlc|jll|jobs|joburg|jprs|juegos|j[emop])",bb,82,cb,ba)) + HX_("|(?:kaufen|kddi|kia|kim|kinder|kitchen|kiwi|koeln|komatsu|krd|kred|kyoto|k[eghimnprwyz])",46,a6,bf,15)) + HX_("|(?:lacaixa|lancaster|land|landrover|lasalle|lat|latrobe|law|lawyer|lds|lease|leclerc",fe,35,4b,75)) + HX_("|legal|lexus|lgbt|liaison|lidl|life|lifestyle|lighting|limited|limo|linde|link|live",29,e6,bf,f7)) + HX_("|lixil|loan|loans|lol|london|lotte|lotto|love|ltd|ltda|lupin|luxe|luxury|l[abcikrstuvy])",50,fd,87,80)) + HX_("|(?:madrid|maif|maison|man|management|mango|market|marketing|markets|marriott|mba",00,a2,ea,8e)) + HX_("|media|meet|melbourne|meme|memorial|men|menu|meo|miami|microsoft|mil|mini|mma|mobi|moda",07,7c,ba,11)) + HX_("|moe|moi|mom|monash|money|montblanc|mormon|mortgage|moscow|motorcycles|mov|movie|movistar",ac,41,4a,c3)) + HX_("|mtn|mtpc|mtr|museum|mutuelle|m[acdeghklmnopqrstuvwxyz])",b1,03,a3,ca)) + HX_("|(?:nadex|nagoya|name|navy|nec|net|netbank|network|neustar|new|news|nexus|ngo|nhk",fc,80,12,90)) + HX_("|nico|ninja|nissan|nokia|nra|nrw|ntt|nyc|n[acefgilopruz])",e5,7d,53,82)) + HX_("|(?:obi|office|okinawa|omega|one|ong|onl|online|ooo|oracle|orange|org|organic|osaka",5d,86,2b,53)) + HX_("|otsuka|ovh|om)",0d,48,d1,07)) + HX_("|(?:page|panerai|paris|partners|parts|party|pet|pharmacy|philips|photo|photography",be,5b,5c,40)) + HX_("|photos|physio|piaget|pics|pictet|pictures|ping|pink|pizza|place|play|playstation|plumbing",65,ea,54,41)) + HX_("|plus|pohl|poker|porn|post|praxi|press|pro|prod|productions|prof|properties|property",3d,f7,19,81)) + HX_("|protection|pub|p[aefghklmnrstwy])",6d,00,62,8f)) + HX_("|(?:qpon|quebec|qa)",d3,62,8c,00)) + HX_("|(?:racing|realtor|realty|recipes|red|redstone|rehab|reise|reisen|reit|ren|rent|rentals",e6,72,5b,c0)) + HX_("|repair|report|republican|rest|restaurant|review|reviews|rich|ricoh|rio|rip|rocher|rocks",4f,a5,81,71)) + HX_("|rodeo|rsvp|ruhr|run|rwe|ryukyu|r[eosuw])",0d,f8,7c,93)) + HX_("|(?:saarland|sakura|sale|samsung|sandvik|sandvikcoromant|sanofi|sap|sapo|sarl|saxo",b4,fd,07,1b)) + HX_("|sbs|sca|scb|schmidt|scholarships|school|schule|schwarz|science|scor|scot|seat|security",e7,bf,c7,9c)) + HX_("|seek|sener|services|seven|sew|sex|sexy|shiksha|shoes|show|shriram|singles|site|ski",b1,33,76,93)) + HX_("|sky|skype|sncf|soccer|social|software|sohu|solar|solutions|sony|soy|space|spiegel|spreadbetting",73,b6,26,86)) + HX_("|srl|stada|starhub|statoil|stc|stcgroup|stockholm|studio|study|style|sucks|supplies",e2,19,59,1c)) + HX_("|supply|support|surf|surgery|suzuki|swatch|swiss|sydney|systems|s[abcdeghijklmnortuvxyz])",27,0f,08,e0)) + HX_("|(?:tab|taipei|tatamotors|tatar|tattoo|tax|taxi|team|tech|technology|tel|telefonica",06,b2,cb,da)) + HX_("|temasek|tennis|thd|theater|theatre|tickets|tienda|tips|tires|tirol|today|tokyo|tools",46,a4,93,59)) + HX_("|top|toray|toshiba|tours|town|toyota|toys|trade|trading|training|travel|trust|tui|t[cdfghjklmnortvwz])",4a,a8,cf,d8)) + HX_("|(?:ubs|university|uno|uol|u[agksyz])",62,2b,28,35)) + HX_("|(?:vacations|vana|vegas|ventures|versicherung|vet|viajes|video|villas|vin|virgin",89,ce,ff,38)) + HX_("|vision|vista|vistaprint|viva|vlaanderen|vodka|vote|voting|voto|voyage|v[aceginu])",8f,f6,66,49)) + HX_("|(?:wales|walter|wang|watch|webcam|website|wed|wedding|weir|whoswho|wien|wiki|williamhill",55,25,7c,0c)) + HX_("|win|windows|wine|wme|work|works|world|wtc|wtf|w[fs])",8a,06,13,28)) + HX_W(u"|(?:\u03b5\u03bb|\u0431\u0435\u043b|\u0434\u0435\u0442\u0438|\u043a\u043e\u043c|\u043c\u043a\u0434",20c2,d82d)) + HX_W(u"|\u043c\u043e\u043d|\u043c\u043e\u0441\u043a\u0432\u0430|\u043e\u043d\u043b\u0430\u0439\u043d",af29,60d6)) + HX_W(u"|\u043e\u0440\u0433|\u0440\u0443\u0441|\u0440\u0444|\u0441\u0430\u0439\u0442|\u0441\u0440\u0431",8703,6750)) + HX_W(u"|\u0443\u043a\u0440|\u049b\u0430\u0437|\u0570\u0561\u0575|\u05e7\u05d5\u05dd|\u0627\u0631\u0627\u0645\u0643\u0648",d486,b572)) + HX_W(u"|\u0627\u0644\u0627\u0631\u062f\u0646|\u0627\u0644\u062c\u0632\u0627\u0626\u0631|\u0627\u0644\u0633\u0639\u0648\u062f\u064a\u0629",ea02,31c4)) + HX_W(u"|\u0627\u0644\u0645\u063a\u0631\u0628|\u0627\u0645\u0627\u0631\u0627\u062a|\u0627\u06cc\u0631\u0627\u0646",a05e,3858)) + HX_W(u"|\u0628\u0627\u0632\u0627\u0631|\u0628\u06be\u0627\u0631\u062a|\u062a\u0648\u0646\u0633",ae38,f5ba)) + HX_W(u"|\u0633\u0648\u062f\u0627\u0646|\u0633\u0648\u0631\u064a\u0629|\u0634\u0628\u0643\u0629",54db,e7f3)) + HX_W(u"|\u0639\u0631\u0627\u0642|\u0639\u0645\u0627\u0646|\u0641\u0644\u0633\u0637\u064a\u0646",bc90,2d48)) + HX_W(u"|\u0642\u0637\u0631|\u0643\u0648\u0645|\u0645\u0635\u0631|\u0645\u0644\u064a\u0633\u064a\u0627",b1a5,4ee2)) + HX_W(u"|\u0645\u0648\u0642\u0639|\u0915\u0949\u092e|\u0928\u0947\u091f|\u092d\u093e\u0930\u0924",8084,0878)) + HX_W(u"|\u0938\u0902\u0917\u0920\u0928|\u09ad\u09be\u09b0\u09a4|\u0a2d\u0a3e\u0a30\u0a24|\u0aad\u0abe\u0ab0\u0aa4",0d0c,87cd)) + HX_W(u"|\u0b87\u0ba8\u0bcd\u0ba4\u0bbf\u0baf\u0bbe|\u0b87\u0bb2\u0b99\u0bcd\u0b95\u0bc8|\u0b9a\u0bbf\u0b99\u0bcd\u0b95\u0baa\u0bcd\u0baa\u0bc2\u0bb0\u0bcd",9669,715f)) + HX_W(u"|\u0c2d\u0c3e\u0c30\u0c24\u0c4d|\u0dbd\u0d82\u0d9a\u0dcf|\u0e04\u0e2d\u0e21|\u0e44\u0e17\u0e22",c9f8,03d8)) + HX_W(u"|\u10d2\u10d4|\u307f\u3093\u306a|\u30b0\u30fc\u30b0\u30eb|\u30b3\u30e0|\u4e16\u754c",3e56,d9f4)) + HX_W(u"|\u4e2d\u4fe1|\u4e2d\u56fd|\u4e2d\u570b|\u4e2d\u6587\u7f51|\u4f01\u4e1a|\u4f5b\u5c71",98dd,a513)) + HX_W(u"|\u4fe1\u606f|\u5065\u5eb7|\u516b\u5366|\u516c\u53f8|\u516c\u76ca|\u53f0\u6e7e|\u53f0\u7063",726a,464b)) + HX_W(u"|\u5546\u57ce|\u5546\u5e97|\u5546\u6807|\u5728\u7ebf|\u5927\u62ff|\u5a31\u4e50|\u5de5\u884c",9c2f,d387)) + HX_W(u"|\u5e7f\u4e1c|\u6148\u5584|\u6211\u7231\u4f60|\u624b\u673a|\u653f\u52a1|\u653f\u5e9c",628c,454d)) + HX_W(u"|\u65b0\u52a0\u5761|\u65b0\u95fb|\u65f6\u5c1a|\u673a\u6784|\u6de1\u9a6c\u9521|\u6e38\u620f",7310,b961)) + HX_W(u"|\u70b9\u770b|\u79fb\u52a8|\u7ec4\u7ec7\u673a\u6784|\u7f51\u5740|\u7f51\u5e97|\u7f51\u7edc",a798,3a2c)) + HX_W(u"|\u8c37\u6b4c|\u96c6\u56e2|\u98de\u5229\u6d66|\u9910\u5385|\u9999\u6e2f|\ub2f7\ub137",68ee,8358)) + HX_W(u"|\ub2f7\ucef4|\uc0bc\uc131|\ud55c\uad6d|xbox",e96a,311e)) + HX_("|xerox|xin|xn\\-\\-11b4c3d|xn\\-\\-1qqw23a|xn\\-\\-30rr7y|xn\\-\\-3bst00m|xn\\-\\-3ds443g",57,7e,62,ed)) + HX_("|xn\\-\\-3e0b707e|xn\\-\\-3pxu8k|xn\\-\\-42c2d9a|xn\\-\\-45brj9c|xn\\-\\-45q11c|xn\\-\\-4gbrim",d0,1e,fc,bc)) + HX_("|xn\\-\\-55qw42g|xn\\-\\-55qx5d|xn\\-\\-6frz82g|xn\\-\\-6qq986b3xl|xn\\-\\-80adxhks",69,cd,8a,d8)) + HX_("|xn\\-\\-80ao21a|xn\\-\\-80asehdb|xn\\-\\-80aswg|xn\\-\\-90a3ac|xn\\-\\-90ais|xn\\-\\-9dbq2a",15,39,69,5f)) + HX_("|xn\\-\\-9et52u|xn\\-\\-b4w605ferd|xn\\-\\-c1avg|xn\\-\\-c2br7g|xn\\-\\-cg4bki|xn\\-\\-clchc0ea0b2g2a9gcd",48,af,c0,fd)) + HX_("|xn\\-\\-czr694b|xn\\-\\-czrs0t|xn\\-\\-czru2d|xn\\-\\-d1acj3b|xn\\-\\-d1alf|xn\\-\\-efvy88h",88,69,2a,f4)) + HX_("|xn\\-\\-estv75g|xn\\-\\-fhbei|xn\\-\\-fiq228c5hs|xn\\-\\-fiq64b|xn\\-\\-fiqs8s|xn\\-\\-fiqz9s",2a,cc,fa,7f)) + HX_("|xn\\-\\-fjq720a|xn\\-\\-flw351e|xn\\-\\-fpcrj9c3d|xn\\-\\-fzc2c9e2c|xn\\-\\-gecrj9c",6c,32,a5,ee)) + HX_("|xn\\-\\-h2brj9c|xn\\-\\-hxt814e|xn\\-\\-i1b6b1a6a2e|xn\\-\\-imr513n|xn\\-\\-io0a7i",2c,7e,dd,fd)) + HX_("|xn\\-\\-j1aef|xn\\-\\-j1amh|xn\\-\\-j6w193g|xn\\-\\-kcrx77d1x4a|xn\\-\\-kprw13d|xn\\-\\-kpry57d",c7,1f,00,ba)) + HX_("|xn\\-\\-kput3i|xn\\-\\-l1acc|xn\\-\\-lgbbat1ad8j|xn\\-\\-mgb9awbf|xn\\-\\-mgba3a3ejt",b2,56,7b,5e)) + HX_("|xn\\-\\-mgba3a4f16a|xn\\-\\-mgbaam7a8h|xn\\-\\-mgbab2bd|xn\\-\\-mgbayh7gpa|xn\\-\\-mgbbh1a71e",ff,4d,c9,1b)) + HX_("|xn\\-\\-mgbc0a9azcg|xn\\-\\-mgberp4a5d4ar|xn\\-\\-mgbpl2fh|xn\\-\\-mgbtx2b|xn\\-\\-mgbx4cd0ab",44,2b,3c,25)) + HX_("|xn\\-\\-mk1bu44c|xn\\-\\-mxtq1m|xn\\-\\-ngbc5azd|xn\\-\\-node|xn\\-\\-nqv7f|xn\\-\\-nqv7fs00ema",7b,d7,30,dc)) + HX_("|xn\\-\\-nyqy26a|xn\\-\\-o3cw4h|xn\\-\\-ogbpf8fl|xn\\-\\-p1acf|xn\\-\\-p1ai|xn\\-\\-pgbs0dh",7e,50,60,09)) + HX_("|xn\\-\\-pssy2u|xn\\-\\-q9jyb4c|xn\\-\\-qcka1pmc|xn\\-\\-qxam|xn\\-\\-rhqv96g|xn\\-\\-s9brj9c",81,31,e0,2c)) + HX_("|xn\\-\\-ses554g|xn\\-\\-t60b56a|xn\\-\\-tckwe|xn\\-\\-unup4y|xn\\-\\-vermgensberater\\-ctb",53,43,3d,7f)) + HX_("|xn\\-\\-vermgensberatung\\-pwb|xn\\-\\-vhquv|xn\\-\\-vuq861b|xn\\-\\-wgbh1c|xn\\-\\-wgbl6a",93,33,8f,07)) + HX_("|xn\\-\\-xhq521b|xn\\-\\-xkc2al3hye2a|xn\\-\\-xkc2dl3a5ee0h|xn\\-\\-y9a3aq|xn\\-\\-yfro4i67o",9a,35,82,bc)) + HX_("|xn\\-\\-ygbi2ammx|xn\\-\\-zfr164b|xperia|xxx|xyz)",dc,3c,8a,29)) + HX_("|(?:yachts|yamaxun|yandex|yodobashi|yoga|yokohama|youtube|y[et])",a2,ef,ff,21)) + HX_("|(?:zara|zip|zone|zuerich|z[amw]))",9f,cf,ff,38));
+ }
+{
+ HX_STACKFRAME(&_hx_pos_e03e81a8315e14a8_162_boot)
+HXDLIN( 162) GOOD_IRI_CHAR = HX_W(u"a-zA-Z0-9\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef",428f,00c6);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_e03e81a8315e14a8_164_boot)
+HXDLIN( 164) IP_ADDRESS = (((HX_("((25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\\.(25[0-5]|2[0-4]",77,34,c5,07) + HX_("[0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1]",27,09,31,49)) + HX_("[0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}",8d,b1,49,66)) + HX_("|[1-9][0-9]|[0-9]))",fd,a4,5b,ea));
+ }
+{
+ HX_STACKFRAME(&_hx_pos_e03e81a8315e14a8_181_boot)
+HXDLIN( 181) IP6_ADDRESS = (((((((((((((((((HX_("\\[",7f,50,00,00) + HX_("(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|",95,9e,ad,bb)) + HX_("([0-9a-fA-F]{1,4}:){1,7}:|",24,ce,ee,30)) + HX_("([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|",a2,da,a4,21)) + HX_("([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|",4b,b7,dc,9c)) + HX_("([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|",4b,bc,50,d7)) + HX_("([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|",4b,c1,c4,11)) + HX_("([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|",4b,c6,38,4c)) + HX_("[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|",4d,77,45,e4)) + HX_(":((:[0-9a-fA-F]{1,4}){1,7}|:)|",27,df,3d,33)) + HX_("fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|",ee,41,f7,25)) + HX_("::(ffff(:0{1,4}){0,1}:){0,1}",b1,6f,8b,25)) + HX_("((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}",34,d9,ed,ae)) + HX_("(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|",97,b1,d5,90)) + HX_("([0-9a-fA-F]{1,4}:){1,4}:",95,58,1a,e8)) + HX_("((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}",34,d9,ed,ae)) + HX_("(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))",44,b1,d5,90)) + HX_("\\]",81,50,00,00));
+ }
+{
+ HX_STACKFRAME(&_hx_pos_e03e81a8315e14a8_202_boot)
+HXDLIN( 202) UCS_CHAR = (((HX_("[",5b,00,00,00) + HX_("\\x{00A0}-\\x{D7FF}",29,32,b0,f1)) + HX_("\\x{F900}-\\x{FDCF}",9f,26,06,f2)) + HX_("\\x{FDF0}-\\x{FFEF}",94,e8,12,99));
+ }
+{
+ HX_STACKFRAME(&_hx_pos_e03e81a8315e14a8_224_boot)
+HXDLIN( 224) LABEL_CHAR = (HX_("a-zA-Z0-9",1c,c7,6d,ee) + ::snikket::Autolink_obj::UCS_CHAR);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_e03e81a8315e14a8_233_boot)
+HXDLIN( 233) IRI_LABEL = ((((((HX_("[",5b,00,00,00) + ::snikket::Autolink_obj::LABEL_CHAR) + HX_("](?:[",95,7c,e4,a6)) + ::snikket::Autolink_obj::LABEL_CHAR) + HX_("\\-]{0,61}[",84,06,f0,9b)) + ::snikket::Autolink_obj::LABEL_CHAR) + HX_("]){0,1}",77,15,13,72));
+ }
+{
+ HX_STACKFRAME(&_hx_pos_e03e81a8315e14a8_237_boot)
+HXDLIN( 237) PUNYCODE_TLD = HX_("xn\\-\\-[\\w\\-]{0,58}\\w",0c,c7,30,ad);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_e03e81a8315e14a8_242_boot)
+HXDLIN( 242) PROTOCOL = HX_("(?:http|https|rtsp):\\/\\/",38,1d,38,84);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_e03e81a8315e14a8_244_boot)
+HXDLIN( 244) WORD_BOUNDARY = HX_("(?:\\b|$|^)",36,7d,03,89);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_e03e81a8315e14a8_245_boot)
+HXDLIN( 245) USER_INFO = ((HX_("(?:[a-zA-Z0-9\\$\\-\\_\\.\\+\\!\\*\\'\\(\\)",98,4a,e0,1a) + HX_("\\,\\;\\?\\&\\=]|(?:\\%[a-fA-F0-9]{2})){1,64}(?:\\:(?:[a-zA-Z0-9\\$\\-\\_",82,eb,76,e5)) + HX_("\\.\\+\\!\\*\\'\\(\\)\\,\\;\\?\\&\\=]|(?:\\%[a-fA-F0-9]{2})){1,25})?\\@",60,f3,93,36));
+ }
+{
+ HX_STACKFRAME(&_hx_pos_e03e81a8315e14a8_248_boot)
+HXDLIN( 248) PORT_NUMBER = HX_("\\:\\d{1,5}",18,ba,64,a4);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_e03e81a8315e14a8_249_boot)
+HXDLIN( 249) PATH_CHAR = (((HX_("(?:(?:[",7b,78,b4,2f) + ::snikket::Autolink_obj::LABEL_CHAR) + HX_("\\;\\/\\?\\:\\@\\&\\=\\#\\~",6b,f2,13,64)) + HX_("\\-\\.\\+\\!\\*\\'\\(\\)\\,\\_\\$])|(?:\\%[a-fA-F0-9]{2}))",ca,f2,2d,5c));
+ }
+{
+ HX_STACKFRAME(&_hx_pos_e03e81a8315e14a8_252_boot)
+HXDLIN( 252) PATH_AND_QUERY = ((HX_("\\/",53,50,00,00) + ::snikket::Autolink_obj::PATH_CHAR) + HX_("*",2a,00,00,00));
+ }
+{
+ HX_STACKFRAME(&_hx_pos_e03e81a8315e14a8_269_boot)
+HXDLIN( 269) STRICT_TLD = ((((HX_("(?:",43,91,1e,00) + ::snikket::Autolink_obj::IANA_TOP_LEVEL_DOMAINS) + HX_("|",7c,00,00,00)) + ::snikket::Autolink_obj::PUNYCODE_TLD) + HX_(")",29,00,00,00));
+ }
+{
+ HX_STACKFRAME(&_hx_pos_e03e81a8315e14a8_274_boot)
+HXDLIN( 274) STRICT_HOST_NAME = ((((HX_("(?:(?:",e0,eb,f9,6a) + ::snikket::Autolink_obj::IRI_LABEL) + HX_("\\.)+",b4,ac,f2,3c)) + ::snikket::Autolink_obj::STRICT_TLD) + HX_(")",29,00,00,00));
+ }
+{
+ HX_STACKFRAME(&_hx_pos_e03e81a8315e14a8_281_boot)
+HXDLIN( 281) STRICT_DOMAIN_NAME = ((((((HX_("(?:",43,91,1e,00) + ::snikket::Autolink_obj::STRICT_HOST_NAME) + HX_("|",7c,00,00,00)) + ::snikket::Autolink_obj::IP_ADDRESS) + HX_("|",7c,00,00,00)) + ::snikket::Autolink_obj::IP6_ADDRESS) + HX_(")",29,00,00,00));
+ }
+{
+ HX_STACKFRAME(&_hx_pos_e03e81a8315e14a8_286_boot)
+HXDLIN( 286) RELAXED_DOMAIN_NAME = (((((((((HX_("(?:",43,91,1e,00) + HX_("(?:",43,91,1e,00)) + ::snikket::Autolink_obj::IRI_LABEL) + HX_("(?:\\.(?=\\S))",a8,58,ad,af)) + HX_("?)+",e1,f1,2f,00)) + HX_("|",7c,00,00,00)) + ::snikket::Autolink_obj::IP_ADDRESS) + HX_("|",7c,00,00,00)) + ::snikket::Autolink_obj::IP6_ADDRESS) + HX_(")",29,00,00,00));
+ }
+{
+ HX_STACKFRAME(&_hx_pos_e03e81a8315e14a8_291_boot)
+HXDLIN( 291) WEB_URL_WITHOUT_PROTOCOL = ((((((((((((((HX_("(",28,00,00,00) + ::snikket::Autolink_obj::WORD_BOUNDARY) + HX_("(?<!:\\/\\/)",c5,eb,09,02)) + HX_("(",28,00,00,00)) + HX_("(?:",43,91,1e,00)) + ::snikket::Autolink_obj::STRICT_DOMAIN_NAME) + HX_(")",29,00,00,00)) + HX_("(?:",43,91,1e,00)) + ::snikket::Autolink_obj::PORT_NUMBER) + HX_(")?",f6,23,00,00)) + HX_(")",29,00,00,00)) + HX_("(?:",43,91,1e,00)) + ::snikket::Autolink_obj::PATH_AND_QUERY) + HX_(")?",f6,23,00,00)) + HX_(")",29,00,00,00));
+ }
+{
+ HX_STACKFRAME(&_hx_pos_e03e81a8315e14a8_304_boot)
+HXDLIN( 304) WEB_URL_WITH_PROTOCOL = (((((((((((((((((((HX_("(",28,00,00,00) + ::snikket::Autolink_obj::WORD_BOUNDARY) + HX_("(?:",43,91,1e,00)) + HX_("(?:",43,91,1e,00)) + ::snikket::Autolink_obj::PROTOCOL) + HX_("(?:",43,91,1e,00)) + ::snikket::Autolink_obj::USER_INFO) + HX_(")?",f6,23,00,00)) + HX_(")",29,00,00,00)) + HX_("(?:",43,91,1e,00)) + ::snikket::Autolink_obj::RELAXED_DOMAIN_NAME) + HX_(")?",f6,23,00,00)) + HX_("(?:",43,91,1e,00)) + ::snikket::Autolink_obj::PORT_NUMBER) + HX_(")?",f6,23,00,00)) + HX_(")",29,00,00,00)) + HX_("(?:",43,91,1e,00)) + ::snikket::Autolink_obj::PATH_AND_QUERY) + HX_(")?",f6,23,00,00)) + HX_(")",29,00,00,00));
+ }
+{
+ HX_STACKFRAME(&_hx_pos_e03e81a8315e14a8_321_boot)
+HXDLIN( 321) AUTOLINK_WEB_URL = (((((HX_("(",28,00,00,00) + ::snikket::Autolink_obj::WEB_URL_WITH_PROTOCOL) + HX_("|",7c,00,00,00)) + ::snikket::Autolink_obj::WEB_URL_WITHOUT_PROTOCOL) + HX_(")",29,00,00,00)) + ::snikket::Autolink_obj::WORD_BOUNDARY);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_e03e81a8315e14a8_324_boot)
+HXDLIN( 324) TEL_URI = ((HX_("tel:(?:(?:\\+\\d+)|(?:\\d+;phone-context=",00,31,ab,3d) + ::snikket::Autolink_obj::PATH_CHAR) + HX_("+))",cb,c4,20,00));
+ }
+{
+ HX_STACKFRAME(&_hx_pos_e03e81a8315e14a8_327_boot)
+HXDLIN( 327) SMS_URI = ((HX_("sms:(?:(?:\\+\\d+)|(?:\\d+;phone-context=",02,3f,54,78) + ::snikket::Autolink_obj::PATH_CHAR) + HX_("+))",cb,c4,20,00));
+ }
+{
+ HX_STACKFRAME(&_hx_pos_e03e81a8315e14a8_329_boot)
+HXDLIN( 329) XMPP_URI = (((HX_("xmpp\\:(?:(?:[",08,ef,83,26) + ::snikket::Autolink_obj::GOOD_IRI_CHAR) + HX_("\\;\\/\\?\\@\\&\\=\\#\\~\\-\\.\\+\\!\\*\\'\\(\\)\\,\\_])",75,2a,04,95)) + HX_("|(?:\\%[a-fA-F0-9]{2}))+",d1,f8,1c,37));
+ }
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/AvailableChat.cpp b/Sources/c_snikket/src/snikket/AvailableChat.cpp
new file mode 100644
index 0000000..567be00
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/AvailableChat.cpp
@@ -0,0 +1,223 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_AvailableChat
+#include <snikket/AvailableChat.h>
+#endif
+#ifndef INCLUDED_snikket_Caps
+#include <snikket/Caps.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_eb4b7fa35bcf9ef4_1546_new,"snikket.AvailableChat","new",0xe206b262,"snikket.AvailableChat.new","snikket/Chat.hx",1546,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_84f492ff0c9cb600_307_chatId__fromC,"snikket.AvailableChat","chatId__fromC",0xa5503488,"snikket.AvailableChat.chatId__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_84f492ff0c9cb600_307_displayName__fromC,"snikket.AvailableChat","displayName__fromC",0x0c214eaa,"snikket.AvailableChat.displayName__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_84f492ff0c9cb600_307_note__fromC,"snikket.AvailableChat","note__fromC",0xff5acec9,"snikket.AvailableChat.note__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_eb4b7fa35bcf9ef4_1542_isChannel,"snikket.AvailableChat","isChannel",0x4a03cd7b,"snikket.AvailableChat.isChannel","snikket/Chat.hx",1542,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_eb4b7fa35bcf9ef4_1522_boot,"snikket.AvailableChat","boot",0xdbee63f0,"snikket.AvailableChat.boot","snikket/Chat.hx",1522,0x18616bf4)
+namespace snikket{
+
+void AvailableChat_obj::__construct(::String chatId,::String displayName,::String note, ::snikket::Caps caps){
+ HX_STACKFRAME(&_hx_pos_eb4b7fa35bcf9ef4_1546_new)
+HXLINE(1547) this->chatId = chatId;
+HXLINE(1548) this->displayName = displayName;
+HXLINE(1549) this->note = note;
+HXLINE(1550) this->caps = caps;
+ }
+
+Dynamic AvailableChat_obj::__CreateEmpty() { return new AvailableChat_obj; }
+
+void *AvailableChat_obj::_hx_vtable = 0;
+
+Dynamic AvailableChat_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< AvailableChat_obj > _hx_result = new AvailableChat_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2],inArgs[3]);
+ return _hx_result;
+}
+
+bool AvailableChat_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x7aa46944;
+}
+
+::String AvailableChat_obj::chatId__fromC(){
+ HX_STACKFRAME(&_hx_pos_84f492ff0c9cb600_307_chatId__fromC)
+HXDLIN( 307) return this->chatId;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(AvailableChat_obj,chatId__fromC,return )
+
+::String AvailableChat_obj::displayName__fromC(){
+ HX_STACKFRAME(&_hx_pos_84f492ff0c9cb600_307_displayName__fromC)
+HXDLIN( 307) return this->displayName;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(AvailableChat_obj,displayName__fromC,return )
+
+::String AvailableChat_obj::note__fromC(){
+ HX_STACKFRAME(&_hx_pos_84f492ff0c9cb600_307_note__fromC)
+HXDLIN( 307) return this->note;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(AvailableChat_obj,note__fromC,return )
+
+bool AvailableChat_obj::isChannel(){
+ HX_STACKFRAME(&_hx_pos_eb4b7fa35bcf9ef4_1542_isChannel)
+HXDLIN(1542) return this->caps->isChannel(this->chatId);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(AvailableChat_obj,isChannel,return )
+
+
+::hx::ObjectPtr< AvailableChat_obj > AvailableChat_obj::__new(::String chatId,::String displayName,::String note, ::snikket::Caps caps) {
+ ::hx::ObjectPtr< AvailableChat_obj > __this = new AvailableChat_obj();
+ __this->__construct(chatId,displayName,note,caps);
+ return __this;
+}
+
+::hx::ObjectPtr< AvailableChat_obj > AvailableChat_obj::__alloc(::hx::Ctx *_hx_ctx,::String chatId,::String displayName,::String note, ::snikket::Caps caps) {
+ AvailableChat_obj *__this = (AvailableChat_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(AvailableChat_obj), true, "snikket.AvailableChat"));
+ *(void **)__this = AvailableChat_obj::_hx_vtable;
+ __this->__construct(chatId,displayName,note,caps);
+ return __this;
+}
+
+AvailableChat_obj::AvailableChat_obj()
+{
+}
+
+void AvailableChat_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(AvailableChat);
+ HX_MARK_MEMBER_NAME(chatId,"chatId");
+ HX_MARK_MEMBER_NAME(displayName,"displayName");
+ HX_MARK_MEMBER_NAME(note,"note");
+ HX_MARK_MEMBER_NAME(caps,"caps");
+ HX_MARK_END_CLASS();
+}
+
+void AvailableChat_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(chatId,"chatId");
+ HX_VISIT_MEMBER_NAME(displayName,"displayName");
+ HX_VISIT_MEMBER_NAME(note,"note");
+ HX_VISIT_MEMBER_NAME(caps,"caps");
+}
+
+::hx::Val AvailableChat_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"note") ) { return ::hx::Val( note ); }
+ if (HX_FIELD_EQ(inName,"caps") ) { return ::hx::Val( caps ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"chatId") ) { return ::hx::Val( chatId ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"isChannel") ) { return ::hx::Val( isChannel_dyn() ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"displayName") ) { return ::hx::Val( displayName ); }
+ if (HX_FIELD_EQ(inName,"note__fromC") ) { return ::hx::Val( note__fromC_dyn() ); }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"chatId__fromC") ) { return ::hx::Val( chatId__fromC_dyn() ); }
+ break;
+ case 18:
+ if (HX_FIELD_EQ(inName,"displayName__fromC") ) { return ::hx::Val( displayName__fromC_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val AvailableChat_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"note") ) { note=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"caps") ) { caps=inValue.Cast< ::snikket::Caps >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"chatId") ) { chatId=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"displayName") ) { displayName=inValue.Cast< ::String >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void AvailableChat_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("chatId",d3,04,77,b7));
+ outFields->push(HX_("displayName",ad,11,f2,30));
+ outFields->push(HX_("note",f2,17,0a,49));
+ outFields->push(HX_("caps",21,1c,ba,41));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo AvailableChat_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(AvailableChat_obj,chatId),HX_("chatId",d3,04,77,b7)},
+ {::hx::fsString,(int)offsetof(AvailableChat_obj,displayName),HX_("displayName",ad,11,f2,30)},
+ {::hx::fsString,(int)offsetof(AvailableChat_obj,note),HX_("note",f2,17,0a,49)},
+ {::hx::fsObject /* ::snikket::Caps */ ,(int)offsetof(AvailableChat_obj,caps),HX_("caps",21,1c,ba,41)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *AvailableChat_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String AvailableChat_obj_sMemberFields[] = {
+ HX_("chatId",d3,04,77,b7),
+ HX_("chatId__fromC",06,fc,b1,94),
+ HX_("displayName",ad,11,f2,30),
+ HX_("displayName__fromC",6c,9e,e5,22),
+ HX_("note",f2,17,0a,49),
+ HX_("note__fromC",c7,1a,13,57),
+ HX_("caps",21,1c,ba,41),
+ HX_("isChannel",f9,7d,d0,d0),
+ ::String(null()) };
+
+::hx::Class AvailableChat_obj::__mClass;
+
+void AvailableChat_obj::__register()
+{
+ AvailableChat_obj _hx_dummy;
+ AvailableChat_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.AvailableChat",70,99,29,af);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(AvailableChat_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< AvailableChat_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = AvailableChat_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = AvailableChat_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void AvailableChat_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_eb4b7fa35bcf9ef4_1522_boot)
+HXDLIN(1522) __mClass->__meta__ = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("fields",79,8e,8e,80), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("chatId__fromC",06,fc,b1,94), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(1,HX_("displayName__fromC",6c,9e,e5,22), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(2,HX_("note__fromC",c7,1a,13,57), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null()))))));
+ }
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/Builder.cpp b/Sources/c_snikket/src/snikket/Builder.cpp
new file mode 100644
index 0000000..cb6b08f
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/Builder.cpp
@@ -0,0 +1,338 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_Builder
+#include <snikket/Builder.h>
+#endif
+#ifndef INCLUDED_snikket_Emoji
+#include <snikket/Emoji.h>
+#endif
+#ifndef INCLUDED_snikket_EmojiUtil
+#include <snikket/EmojiUtil.h>
+#endif
+#ifndef INCLUDED_snikket_Other
+#include <snikket/Other.h>
+#endif
+#ifndef INCLUDED_snikket_Symbol
+#include <snikket/Symbol.h>
+#endif
+#ifndef INCLUDED_snikket_UnicodeBlocks
+#include <snikket/UnicodeBlocks.h>
+#endif
+#ifndef INCLUDED_snikket_UnicodeRange
+#include <snikket/UnicodeRange.h>
+#endif
+#ifndef INCLUDED_snikket_UnicodeSet
+#include <snikket/UnicodeSet.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_ac332627541f656c_155_new,"snikket.Builder","new",0xc6a387fc,"snikket.Builder.new","snikket/EmojiUtil.hx",155,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_ac332627541f656c_159_offer,"snikket.Builder","offer",0xf095bc38,"snikket.Builder.offer","snikket/EmojiUtil.hx",159,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_ac332627541f656c_203_build,"snikket.Builder","build",0x7e4cb1ca,"snikket.Builder.build","snikket/EmojiUtil.hx",203,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_ac332627541f656c_200_isMerger,"snikket.Builder","isMerger",0x0a768d28,"snikket.Builder.isMerger","snikket/EmojiUtil.hx",200,0x30de6948)
+namespace snikket{
+
+void Builder_obj::__construct(){
+ HX_STACKFRAME(&_hx_pos_ac332627541f656c_155_new)
+HXDLIN( 155) this->codepoints = ::Array_obj< int >::__new(0);
+ }
+
+Dynamic Builder_obj::__CreateEmpty() { return new Builder_obj; }
+
+void *Builder_obj::_hx_vtable = 0;
+
+Dynamic Builder_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Builder_obj > _hx_result = new Builder_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool Builder_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x7b0e9a2a;
+}
+
+bool Builder_obj::offer(int codepoint){
+ HX_STACKFRAME(&_hx_pos_ac332627541f656c_159_offer)
+HXLINE( 160) bool add = false;
+HXLINE( 161) if ((this->codepoints->length == 0)) {
+HXLINE( 162) if (::snikket::EmojiUtil_obj::SYMBOLIZE->contains(codepoint)) {
+HXLINE( 163) add = true;
+ }
+ else {
+HXLINE( 164) if (::snikket::EmojiUtil_obj::REGIONAL_INDICATORS->contains(codepoint)) {
+HXLINE( 165) add = true;
+ }
+ else {
+HXLINE( 166) bool _hx_tmp;
+HXDLIN( 166) bool _hx_tmp1;
+HXDLIN( 166) if (::snikket::EmojiUtil_obj::EMOJIS->contains(codepoint)) {
+HXLINE( 166) _hx_tmp1 = !(::snikket::EmojiUtil_obj::FITZPATRICK->contains(codepoint));
+ }
+ else {
+HXLINE( 166) _hx_tmp1 = false;
+ }
+HXDLIN( 166) if (_hx_tmp1) {
+HXLINE( 166) _hx_tmp = (codepoint != ::snikket::EmojiUtil_obj::ZWJ);
+ }
+ else {
+HXLINE( 166) _hx_tmp = false;
+ }
+HXDLIN( 166) if (_hx_tmp) {
+HXLINE( 167) add = true;
+ }
+ }
+ }
+ }
+ else {
+HXLINE( 170) int previous = this->codepoints->__get((this->codepoints->length - 1));
+HXLINE( 171) if ((this->codepoints->__get(0) == ::snikket::EmojiUtil_obj::BLACK_FLAG)) {
+HXLINE( 172) add = ::snikket::EmojiUtil_obj::TAGS->contains(codepoint);
+ }
+ else {
+HXLINE( 173) if ((::snikket::EmojiUtil_obj::COMBINING_ENCLOSING_KEYCAP == codepoint)) {
+HXLINE( 174) if (!(::snikket::EmojiUtil_obj::KEYCAP_COMBINEABLE->contains(previous))) {
+HXLINE( 174) add = (previous == ::snikket::EmojiUtil_obj::VARIATION_16);
+ }
+ else {
+HXLINE( 174) add = true;
+ }
+ }
+ else {
+HXLINE( 175) if (::snikket::EmojiUtil_obj::SYMBOLIZE->contains(previous)) {
+HXLINE( 176) add = (codepoint == ::snikket::EmojiUtil_obj::VARIATION_16);
+ }
+ else {
+HXLINE( 177) bool _hx_tmp2;
+HXDLIN( 177) if (::snikket::EmojiUtil_obj::REGIONAL_INDICATORS->contains(previous)) {
+HXLINE( 177) _hx_tmp2 = ::snikket::EmojiUtil_obj::REGIONAL_INDICATORS->contains(codepoint);
+ }
+ else {
+HXLINE( 177) _hx_tmp2 = false;
+ }
+HXDLIN( 177) if (_hx_tmp2) {
+HXLINE( 178) add = (this->codepoints->length == 1);
+ }
+ else {
+HXLINE( 179) if ((previous == ::snikket::EmojiUtil_obj::VARIATION_16)) {
+HXLINE( 180) if (!(::snikket::Builder_obj::isMerger(codepoint))) {
+HXLINE( 180) add = (codepoint == ::snikket::EmojiUtil_obj::VARIATION_16);
+ }
+ else {
+HXLINE( 180) add = true;
+ }
+ }
+ else {
+HXLINE( 181) if (::snikket::EmojiUtil_obj::FITZPATRICK->contains(previous)) {
+HXLINE( 182) add = (codepoint == ::snikket::EmojiUtil_obj::ZWJ);
+ }
+ else {
+HXLINE( 183) if ((::snikket::EmojiUtil_obj::ZWJ == previous)) {
+HXLINE( 184) add = ::snikket::EmojiUtil_obj::EMOJIS->contains(codepoint);
+ }
+ else {
+HXLINE( 185) if (::snikket::Builder_obj::isMerger(codepoint)) {
+HXLINE( 186) add = true;
+ }
+ else {
+HXLINE( 187) bool _hx_tmp3;
+HXDLIN( 187) if ((codepoint == ::snikket::EmojiUtil_obj::VARIATION_16)) {
+HXLINE( 187) _hx_tmp3 = ::snikket::EmojiUtil_obj::EMOJIS->contains(previous);
+ }
+ else {
+HXLINE( 187) _hx_tmp3 = false;
+ }
+HXDLIN( 187) if (_hx_tmp3) {
+HXLINE( 188) add = true;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+HXLINE( 191) if (add) {
+HXLINE( 192) this->codepoints->push(codepoint);
+HXLINE( 193) return true;
+ }
+ else {
+HXLINE( 195) return false;
+ }
+HXLINE( 191) return false;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Builder_obj,offer,return )
+
+ ::snikket::Symbol Builder_obj::build(){
+ HX_GC_STACKFRAME(&_hx_pos_ac332627541f656c_203_build)
+HXLINE( 204) bool _hx_tmp;
+HXDLIN( 204) if ((this->codepoints->length > 0)) {
+HXLINE( 204) _hx_tmp = ::snikket::EmojiUtil_obj::SYMBOLIZE->contains(this->codepoints->__get((this->codepoints->length - 1)));
+ }
+ else {
+HXLINE( 204) _hx_tmp = false;
+ }
+HXDLIN( 204) if (_hx_tmp) {
+HXLINE( 205) return ::snikket::Other_obj::__alloc( HX_CTX ,this->codepoints);
+ }
+ else {
+HXLINE( 206) bool _hx_tmp1;
+HXDLIN( 206) bool _hx_tmp2;
+HXDLIN( 206) if ((this->codepoints->length > 1)) {
+HXLINE( 206) _hx_tmp2 = ::snikket::EmojiUtil_obj::KEYCAP_COMBINEABLE->contains(this->codepoints->__get(0));
+ }
+ else {
+HXLINE( 206) _hx_tmp2 = false;
+ }
+HXDLIN( 206) if (_hx_tmp2) {
+HXLINE( 206) _hx_tmp1 = (this->codepoints->__get((this->codepoints->length - 1)) != ::snikket::EmojiUtil_obj::COMBINING_ENCLOSING_KEYCAP);
+ }
+ else {
+HXLINE( 206) _hx_tmp1 = false;
+ }
+HXDLIN( 206) if (_hx_tmp1) {
+HXLINE( 207) return ::snikket::Other_obj::__alloc( HX_CTX ,this->codepoints);
+ }
+ }
+HXLINE( 209) if ((this->codepoints->length == 0)) {
+HXLINE( 209) return ::snikket::Other_obj::__alloc( HX_CTX ,this->codepoints);
+ }
+ else {
+HXLINE( 209) return ::snikket::Emoji_obj::__alloc( HX_CTX ,this->codepoints);
+ }
+HXDLIN( 209) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Builder_obj,build,return )
+
+bool Builder_obj::isMerger(int codepoint){
+ HX_STACKFRAME(&_hx_pos_ac332627541f656c_200_isMerger)
+HXDLIN( 200) if ((codepoint != ::snikket::EmojiUtil_obj::ZWJ)) {
+HXDLIN( 200) return ::snikket::EmojiUtil_obj::FITZPATRICK->contains(codepoint);
+ }
+ else {
+HXDLIN( 200) return true;
+ }
+HXDLIN( 200) return false;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Builder_obj,isMerger,return )
+
+
+::hx::ObjectPtr< Builder_obj > Builder_obj::__new() {
+ ::hx::ObjectPtr< Builder_obj > __this = new Builder_obj();
+ __this->__construct();
+ return __this;
+}
+
+::hx::ObjectPtr< Builder_obj > Builder_obj::__alloc(::hx::Ctx *_hx_ctx) {
+ Builder_obj *__this = (Builder_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Builder_obj), true, "snikket.Builder"));
+ *(void **)__this = Builder_obj::_hx_vtable;
+ __this->__construct();
+ return __this;
+}
+
+Builder_obj::Builder_obj()
+{
+}
+
+void Builder_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(Builder);
+ HX_MARK_MEMBER_NAME(codepoints,"codepoints");
+ HX_MARK_END_CLASS();
+}
+
+void Builder_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(codepoints,"codepoints");
+}
+
+::hx::Val Builder_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"offer") ) { return ::hx::Val( offer_dyn() ); }
+ if (HX_FIELD_EQ(inName,"build") ) { return ::hx::Val( build_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"codepoints") ) { return ::hx::Val( codepoints ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool Builder_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 8:
+ if (HX_FIELD_EQ(inName,"isMerger") ) { outValue = isMerger_dyn(); return true; }
+ }
+ return false;
+}
+
+::hx::Val Builder_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 10:
+ if (HX_FIELD_EQ(inName,"codepoints") ) { codepoints=inValue.Cast< ::Array< int > >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void Builder_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("codepoints",10,63,53,8a));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Builder_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::Array< int > */ ,(int)offsetof(Builder_obj,codepoints),HX_("codepoints",10,63,53,8a)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *Builder_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Builder_obj_sMemberFields[] = {
+ HX_("codepoints",10,63,53,8a),
+ HX_("offer",9c,e5,33,2d),
+ HX_("build",2e,db,ea,ba),
+ ::String(null()) };
+
+::hx::Class Builder_obj::__mClass;
+
+static ::String Builder_obj_sStaticFields[] = {
+ HX_("isMerger",44,5a,71,60),
+ ::String(null())
+};
+
+void Builder_obj::__register()
+{
+ Builder_obj _hx_dummy;
+ Builder_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.Builder",0a,1a,51,7e);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Builder_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Builder_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Builder_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Builder_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Builder_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Builder_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/Caps.cpp b/Sources/c_snikket/src/snikket/Caps.cpp
new file mode 100644
index 0000000..e058fc4
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/Caps.cpp
@@ -0,0 +1,446 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Lambda
+#include <Lambda.h>
+#endif
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+#ifndef INCLUDED_haxe_io_Encoding
+#include <haxe/io/Encoding.h>
+#endif
+#ifndef INCLUDED_snikket_Caps
+#include <snikket/Caps.h>
+#endif
+#ifndef INCLUDED_snikket_Hash
+#include <snikket/Hash.h>
+#endif
+#ifndef INCLUDED_snikket_Identity
+#include <snikket/Identity.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_a541ea7d0210a2a3_10_new,"snikket.Caps","new",0xb2cdb3c4,"snikket.Caps.new","snikket/Caps.hx",10,0xee3b624b)
+HX_LOCAL_STACK_FRAME(_hx_pos_a541ea7d0210a2a3_53_isChannel,"snikket.Caps","isChannel",0xeab9045d,"snikket.Caps.isChannel","snikket/Caps.hx",53,0xee3b624b)
+HX_LOCAL_STACK_FRAME(_hx_pos_a541ea7d0210a2a3_55_isChannel,"snikket.Caps","isChannel",0xeab9045d,"snikket.Caps.isChannel","snikket/Caps.hx",55,0xee3b624b)
+HX_LOCAL_STACK_FRAME(_hx_pos_a541ea7d0210a2a3_58_discoReply,"snikket.Caps","discoReply",0xd5aeac6c,"snikket.Caps.discoReply","snikket/Caps.hx",58,0xee3b624b)
+HX_LOCAL_STACK_FRAME(_hx_pos_a541ea7d0210a2a3_69_addC,"snikket.Caps","addC",0xb896ff1e,"snikket.Caps.addC","snikket/Caps.hx",69,0xee3b624b)
+HX_LOCAL_STACK_FRAME(_hx_pos_a541ea7d0210a2a3_80_computeVer,"snikket.Caps","computeVer",0xc6252848,"snikket.Caps.computeVer","snikket/Caps.hx",80,0xee3b624b)
+HX_LOCAL_STACK_FRAME(_hx_pos_a541ea7d0210a2a3_81_computeVer,"snikket.Caps","computeVer",0xc6252848,"snikket.Caps.computeVer","snikket/Caps.hx",81,0xee3b624b)
+HX_LOCAL_STACK_FRAME(_hx_pos_a541ea7d0210a2a3_79_computeVer,"snikket.Caps","computeVer",0xc6252848,"snikket.Caps.computeVer","snikket/Caps.hx",79,0xee3b624b)
+HX_LOCAL_STACK_FRAME(_hx_pos_a541ea7d0210a2a3_92_verRaw,"snikket.Caps","verRaw",0x4ddd5e61,"snikket.Caps.verRaw","snikket/Caps.hx",92,0xee3b624b)
+HX_LOCAL_STACK_FRAME(_hx_pos_a541ea7d0210a2a3_98_ver,"snikket.Caps","ver",0xb2d3c5c7,"snikket.Caps.ver","snikket/Caps.hx",98,0xee3b624b)
+HX_LOCAL_STACK_FRAME(_hx_pos_a541ea7d0210a2a3_18_withIdentity,"snikket.Caps","withIdentity",0xadb07d80,"snikket.Caps.withIdentity","snikket/Caps.hx",18,0xee3b624b)
+HX_LOCAL_STACK_FRAME(_hx_pos_a541ea7d0210a2a3_33_withFeature,"snikket.Caps","withFeature",0x4980f8b4,"snikket.Caps.withFeature","snikket/Caps.hx",33,0xee3b624b)
+namespace snikket{
+
+void Caps_obj::__construct(::String node,::Array< ::Dynamic> identities,::Array< ::String > features){
+ HX_STACKFRAME(&_hx_pos_a541ea7d0210a2a3_10_new)
+HXLINE( 14) this->_ver = null();
+HXLINE( 48) this->node = node;
+HXLINE( 49) this->identities = identities;
+HXLINE( 50) this->features = features;
+ }
+
+Dynamic Caps_obj::__CreateEmpty() { return new Caps_obj; }
+
+void *Caps_obj::_hx_vtable = 0;
+
+Dynamic Caps_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Caps_obj > _hx_result = new Caps_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2]);
+ return _hx_result;
+}
+
+bool Caps_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x02663c7e;
+}
+
+bool Caps_obj::isChannel(::String chatId){
+ HX_STACKFRAME(&_hx_pos_a541ea7d0210a2a3_53_isChannel)
+HXLINE( 54) if ((chatId.indexOf(HX_("@",40,00,00,00),null()) < 0)) {
+HXLINE( 54) return false;
+ }
+HXLINE( 55) if (this->features->contains(HX_("http://jabber.org/protocol/muc",07,b2,7f,c6))) {
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ bool _hx_run( ::snikket::Identity identity){
+ HX_STACKFRAME(&_hx_pos_a541ea7d0210a2a3_55_isChannel)
+HXLINE( 55) return (identity->category == HX_("conference",1c,2b,83,41));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE( 55) return ::hx::IsNotNull( ::Lambda_obj::find(this->identities, ::Dynamic(new _hx_Closure_0())) );
+ }
+ else {
+HXLINE( 55) return false;
+ }
+HXDLIN( 55) return false;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Caps_obj,isChannel,return )
+
+ ::snikket::Stanza Caps_obj::discoReply(){
+ HX_GC_STACKFRAME(&_hx_pos_a541ea7d0210a2a3_58_discoReply)
+HXLINE( 59) ::snikket::Stanza query = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("query",08,8b,ea,5d), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("http://jabber.org/protocol/disco#info",cb,2b,7f,0b))));
+HXLINE( 60) {
+HXLINE( 60) int _g = 0;
+HXDLIN( 60) ::Array< ::Dynamic> _g1 = this->identities;
+HXDLIN( 60) while((_g < _g1->length)){
+HXLINE( 60) ::snikket::Identity identity = _g1->__get(_g).StaticCast< ::snikket::Identity >();
+HXDLIN( 60) _g = (_g + 1);
+HXLINE( 61) identity->addToDisco(query);
+ }
+ }
+HXLINE( 63) {
+HXLINE( 63) int _g2 = 0;
+HXDLIN( 63) ::Array< ::String > _g3 = this->features;
+HXDLIN( 63) while((_g2 < _g3->length)){
+HXLINE( 63) ::String feature = _g3->__get(_g2);
+HXDLIN( 63) _g2 = (_g2 + 1);
+HXLINE( 64) query->tag(HX_("feature",b6,f2,7c,1a), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("var",e7,de,59,00),feature)))->up();
+ }
+ }
+HXLINE( 66) return query;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Caps_obj,discoReply,return )
+
+ ::snikket::Stanza Caps_obj::addC( ::snikket::Stanza stanza){
+ HX_STACKFRAME(&_hx_pos_a541ea7d0210a2a3_69_addC)
+HXLINE( 73) ::String _hx_tmp = this->node;
+HXLINE( 70) stanza->tag(HX_("c",63,00,00,00), ::Dynamic(::hx::Anon_obj::Create(4)
+ ->setFixed(0,HX_("ver",63,e2,59,00),this->ver())
+ ->setFixed(1,HX_("hash",ce,2f,08,45),HX_("sha-1",90,a8,1c,7c))
+ ->setFixed(2,HX_("node",02,0a,0a,49),_hx_tmp)
+ ->setFixed(3,HX_("xmlns",dc,31,74,60),HX_("http://jabber.org/protocol/caps",95,d0,90,e2))))->up();
+HXLINE( 76) return stanza;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Caps_obj,addC,return )
+
+ ::snikket::Hash Caps_obj::computeVer(){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(2)
+ int _hx_run(::String x,::String y){
+ HX_STACKFRAME(&_hx_pos_a541ea7d0210a2a3_80_computeVer)
+HXLINE( 80) if ((x == y)) {
+HXLINE( 80) return 0;
+ }
+ else {
+HXLINE( 80) if ((x < y)) {
+HXLINE( 80) return -1;
+ }
+ else {
+HXLINE( 80) return 1;
+ }
+ }
+HXDLIN( 80) return 0;
+ }
+ HX_END_LOCAL_FUNC2(return)
+
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_1) HXARGC(2)
+ int _hx_run( ::snikket::Identity x, ::snikket::Identity y){
+ HX_STACKFRAME(&_hx_pos_a541ea7d0210a2a3_81_computeVer)
+HXLINE( 81) ::String _hx_tmp = x->ver();
+HXDLIN( 81) if ((_hx_tmp == y->ver())) {
+HXLINE( 81) return 0;
+ }
+ else {
+HXLINE( 81) ::String _hx_tmp1 = x->ver();
+HXDLIN( 81) if ((_hx_tmp1 < y->ver())) {
+HXLINE( 81) return -1;
+ }
+ else {
+HXLINE( 81) return 1;
+ }
+ }
+HXDLIN( 81) return 0;
+ }
+ HX_END_LOCAL_FUNC2(return)
+
+ HX_STACKFRAME(&_hx_pos_a541ea7d0210a2a3_79_computeVer)
+HXLINE( 80) this->features->sort( ::Dynamic(new _hx_Closure_0()));
+HXLINE( 81) this->identities->sort( ::Dynamic(new _hx_Closure_1()));
+HXLINE( 82) ::String s = HX_("",00,00,00,00);
+HXLINE( 83) {
+HXLINE( 83) int _g = 0;
+HXDLIN( 83) ::Array< ::Dynamic> _g1 = this->identities;
+HXDLIN( 83) while((_g < _g1->length)){
+HXLINE( 83) ::snikket::Identity identity = _g1->__get(_g).StaticCast< ::snikket::Identity >();
+HXDLIN( 83) _g = (_g + 1);
+HXLINE( 84) s = (s + (identity->ver() + HX_("<",3c,00,00,00)));
+ }
+ }
+HXLINE( 86) {
+HXLINE( 86) int _g2 = 0;
+HXDLIN( 86) ::Array< ::String > _g3 = this->features;
+HXDLIN( 86) while((_g2 < _g3->length)){
+HXLINE( 86) ::String feature = _g3->__get(_g2);
+HXDLIN( 86) _g2 = (_g2 + 1);
+HXLINE( 87) s = (s + (feature + HX_("<",3c,00,00,00)));
+ }
+ }
+HXLINE( 89) return ::snikket::Hash_obj::sha1(::haxe::io::Bytes_obj::ofString(s,null()));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Caps_obj,computeVer,return )
+
+ ::snikket::Hash Caps_obj::verRaw(){
+ HX_STACKFRAME(&_hx_pos_a541ea7d0210a2a3_92_verRaw)
+HXLINE( 93) if (::hx::IsNull( this->_ver )) {
+HXLINE( 93) this->_ver = this->computeVer();
+ }
+HXLINE( 94) return this->_ver;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Caps_obj,verRaw,return )
+
+::String Caps_obj::ver(){
+ HX_STACKFRAME(&_hx_pos_a541ea7d0210a2a3_98_ver)
+HXDLIN( 98) return this->verRaw()->toBase64();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Caps_obj,ver,return )
+
+::Array< ::String > Caps_obj::withIdentity( ::Dynamic caps,::String category,::String type){
+ HX_STACKFRAME(&_hx_pos_a541ea7d0210a2a3_18_withIdentity)
+HXLINE( 19) ::Array< ::String > result = ::Array_obj< ::String >::__new(0);
+HXLINE( 20) {
+HXLINE( 20) ::Dynamic cap = caps;
+HXDLIN( 20) while(( (bool)(cap->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 20) ::Dynamic cap1 = cap->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)();
+HXLINE( 21) if (::hx::IsNotNull( cap1->__Field(HX_("value",71,7f,b8,31),::hx::paccDynamic) )) {
+HXLINE( 22) int _g = 0;
+HXDLIN( 22) ::Array< ::Dynamic> _g1 = ( ( ::snikket::Caps)(cap1->__Field(HX_("value",71,7f,b8,31),::hx::paccDynamic)) )->identities;
+HXDLIN( 22) while((_g < _g1->length)){
+HXLINE( 22) ::snikket::Identity identity = _g1->__get(_g).StaticCast< ::snikket::Identity >();
+HXDLIN( 22) _g = (_g + 1);
+HXLINE( 23) bool _hx_tmp;
+HXDLIN( 23) bool _hx_tmp1;
+HXDLIN( 23) if (::hx::IsNotNull( category )) {
+HXLINE( 23) _hx_tmp1 = (category == identity->category);
+ }
+ else {
+HXLINE( 23) _hx_tmp1 = true;
+ }
+HXDLIN( 23) if (_hx_tmp1) {
+HXLINE( 23) if (::hx::IsNotNull( type )) {
+HXLINE( 23) _hx_tmp = (type == identity->type);
+ }
+ else {
+HXLINE( 23) _hx_tmp = true;
+ }
+ }
+ else {
+HXLINE( 23) _hx_tmp = false;
+ }
+HXDLIN( 23) if (_hx_tmp) {
+HXLINE( 24) result->push( ::Dynamic(cap1->__Field(HX_("key",9f,89,51,00),::hx::paccDynamic)));
+ }
+ }
+ }
+ }
+ }
+HXLINE( 29) return result;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC3(Caps_obj,withIdentity,return )
+
+::Array< ::String > Caps_obj::withFeature( ::Dynamic caps,::String feature){
+ HX_STACKFRAME(&_hx_pos_a541ea7d0210a2a3_33_withFeature)
+HXLINE( 34) ::Array< ::String > result = ::Array_obj< ::String >::__new(0);
+HXLINE( 35) {
+HXLINE( 35) ::Dynamic cap = caps;
+HXDLIN( 35) while(( (bool)(cap->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 35) ::Dynamic cap1 = cap->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)();
+HXLINE( 36) if (::hx::IsNotNull( cap1->__Field(HX_("value",71,7f,b8,31),::hx::paccDynamic) )) {
+HXLINE( 37) int _g = 0;
+HXDLIN( 37) ::Array< ::String > _g1 = ( ( ::snikket::Caps)(cap1->__Field(HX_("value",71,7f,b8,31),::hx::paccDynamic)) )->features;
+HXDLIN( 37) while((_g < _g1->length)){
+HXLINE( 37) ::String feat = _g1->__get(_g);
+HXDLIN( 37) _g = (_g + 1);
+HXLINE( 38) if ((feature == feat)) {
+HXLINE( 39) result->push( ::Dynamic(cap1->__Field(HX_("key",9f,89,51,00),::hx::paccDynamic)));
+ }
+ }
+ }
+ }
+ }
+HXLINE( 44) return result;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Caps_obj,withFeature,return )
+
+
+::hx::ObjectPtr< Caps_obj > Caps_obj::__new(::String node,::Array< ::Dynamic> identities,::Array< ::String > features) {
+ ::hx::ObjectPtr< Caps_obj > __this = new Caps_obj();
+ __this->__construct(node,identities,features);
+ return __this;
+}
+
+::hx::ObjectPtr< Caps_obj > Caps_obj::__alloc(::hx::Ctx *_hx_ctx,::String node,::Array< ::Dynamic> identities,::Array< ::String > features) {
+ Caps_obj *__this = (Caps_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Caps_obj), true, "snikket.Caps"));
+ *(void **)__this = Caps_obj::_hx_vtable;
+ __this->__construct(node,identities,features);
+ return __this;
+}
+
+Caps_obj::Caps_obj()
+{
+}
+
+void Caps_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(Caps);
+ HX_MARK_MEMBER_NAME(node,"node");
+ HX_MARK_MEMBER_NAME(identities,"identities");
+ HX_MARK_MEMBER_NAME(features,"features");
+ HX_MARK_MEMBER_NAME(_ver,"_ver");
+ HX_MARK_END_CLASS();
+}
+
+void Caps_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(node,"node");
+ HX_VISIT_MEMBER_NAME(identities,"identities");
+ HX_VISIT_MEMBER_NAME(features,"features");
+ HX_VISIT_MEMBER_NAME(_ver,"_ver");
+}
+
+::hx::Val Caps_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"ver") ) { return ::hx::Val( ver_dyn() ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"node") ) { return ::hx::Val( node ); }
+ if (HX_FIELD_EQ(inName,"_ver") ) { return ::hx::Val( _ver ); }
+ if (HX_FIELD_EQ(inName,"addC") ) { return ::hx::Val( addC_dyn() ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"verRaw") ) { return ::hx::Val( verRaw_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"features") ) { return ::hx::Val( features ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"isChannel") ) { return ::hx::Val( isChannel_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"identities") ) { return ::hx::Val( identities ); }
+ if (HX_FIELD_EQ(inName,"discoReply") ) { return ::hx::Val( discoReply_dyn() ); }
+ if (HX_FIELD_EQ(inName,"computeVer") ) { return ::hx::Val( computeVer_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool Caps_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 11:
+ if (HX_FIELD_EQ(inName,"withFeature") ) { outValue = withFeature_dyn(); return true; }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"withIdentity") ) { outValue = withIdentity_dyn(); return true; }
+ }
+ return false;
+}
+
+::hx::Val Caps_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"node") ) { node=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"_ver") ) { _ver=inValue.Cast< ::snikket::Hash >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"features") ) { features=inValue.Cast< ::Array< ::String > >(); return inValue; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"identities") ) { identities=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void Caps_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("node",02,0a,0a,49));
+ outFields->push(HX_("identities",1c,c5,6d,d7));
+ outFields->push(HX_("features",fd,6c,d7,12));
+ outFields->push(HX_("_ver",64,27,25,3f));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Caps_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(Caps_obj,node),HX_("node",02,0a,0a,49)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(Caps_obj,identities),HX_("identities",1c,c5,6d,d7)},
+ {::hx::fsObject /* ::Array< ::String > */ ,(int)offsetof(Caps_obj,features),HX_("features",fd,6c,d7,12)},
+ {::hx::fsObject /* ::snikket::Hash */ ,(int)offsetof(Caps_obj,_ver),HX_("_ver",64,27,25,3f)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *Caps_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Caps_obj_sMemberFields[] = {
+ HX_("node",02,0a,0a,49),
+ HX_("identities",1c,c5,6d,d7),
+ HX_("features",fd,6c,d7,12),
+ HX_("_ver",64,27,25,3f),
+ HX_("isChannel",f9,7d,d0,d0),
+ HX_("discoReply",50,9b,21,44),
+ HX_("addC",02,eb,69,40),
+ HX_("computeVer",2c,17,98,34),
+ HX_("verRaw",45,0b,2e,a1),
+ HX_("ver",63,e2,59,00),
+ ::String(null()) };
+
+::hx::Class Caps_obj::__mClass;
+
+static ::String Caps_obj_sStaticFields[] = {
+ HX_("withIdentity",64,ed,e7,d1),
+ HX_("withFeature",50,11,9f,7f),
+ ::String(null())
+};
+
+void Caps_obj::__register()
+{
+ Caps_obj _hx_dummy;
+ Caps_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.Caps",d2,c1,77,4c);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Caps_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Caps_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Caps_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Caps_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Caps_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Caps_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/Channel.cpp b/Sources/c_snikket/src/snikket/Channel.cpp
new file mode 100644
index 0000000..9f34407
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/Channel.cpp
@@ -0,0 +1,1750 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Date
+#include <Date.h>
+#endif
+#ifndef INCLUDED_Lambda
+#include <Lambda.h>
+#endif
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_Log
+#include <haxe/Log.h>
+#endif
+#ifndef INCLUDED_haxe_Timer
+#include <haxe/Timer.h>
+#endif
+#ifndef INCLUDED_haxe_ds_StringMap
+#include <haxe/ds/StringMap.h>
+#endif
+#ifndef INCLUDED_snikket_Caps
+#include <snikket/Caps.h>
+#endif
+#ifndef INCLUDED_snikket_Channel
+#include <snikket/Channel.h>
+#endif
+#ifndef INCLUDED_snikket_Chat
+#include <snikket/Chat.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessage
+#include <snikket/ChatMessage.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessageBuilder
+#include <snikket/ChatMessageBuilder.h>
+#endif
+#ifndef INCLUDED_snikket_Client
+#include <snikket/Client.h>
+#endif
+#ifndef INCLUDED_snikket_Color
+#include <snikket/Color.h>
+#endif
+#ifndef INCLUDED_snikket_CustomEmojiReaction
+#include <snikket/CustomEmojiReaction.h>
+#endif
+#ifndef INCLUDED_snikket_Date
+#include <snikket/Date.h>
+#endif
+#ifndef INCLUDED_snikket_DirectChat
+#include <snikket/DirectChat.h>
+#endif
+#ifndef INCLUDED_snikket_EventEmitter
+#include <snikket/EventEmitter.h>
+#endif
+#ifndef INCLUDED_snikket_EventResult
+#include <snikket/EventResult.h>
+#endif
+#ifndef INCLUDED_snikket_GenericStream
+#include <snikket/GenericStream.h>
+#endif
+#ifndef INCLUDED_snikket_Hash
+#include <snikket/Hash.h>
+#endif
+#ifndef INCLUDED_snikket_ID
+#include <snikket/ID.h>
+#endif
+#ifndef INCLUDED_snikket_Identity
+#include <snikket/Identity.h>
+#endif
+#ifndef INCLUDED_snikket_JID
+#include <snikket/JID.h>
+#endif
+#ifndef INCLUDED_snikket_Message
+#include <snikket/Message.h>
+#endif
+#ifndef INCLUDED_snikket_MessageStanza
+#include <snikket/MessageStanza.h>
+#endif
+#ifndef INCLUDED_snikket_MessageSync
+#include <snikket/MessageSync.h>
+#endif
+#ifndef INCLUDED_snikket_ModerationAction
+#include <snikket/ModerationAction.h>
+#endif
+#ifndef INCLUDED_snikket_Participant
+#include <snikket/Participant.h>
+#endif
+#ifndef INCLUDED_snikket_Persistence
+#include <snikket/Persistence.h>
+#endif
+#ifndef INCLUDED_snikket_Presence
+#include <snikket/Presence.h>
+#endif
+#ifndef INCLUDED_snikket_Reaction
+#include <snikket/Reaction.h>
+#endif
+#ifndef INCLUDED_snikket_ReactionUpdate
+#include <snikket/ReactionUpdate.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_queries_DiscoInfoGet
+#include <snikket/queries/DiscoInfoGet.h>
+#endif
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+#ifndef INCLUDED_thenshim_PromiseTools
+#include <thenshim/PromiseTools.h>
+#endif
+#ifndef INCLUDED_thenshim_Thenable
+#include <thenshim/Thenable.h>
+#endif
+#ifndef INCLUDED_thenshim__Promise_Promise_Impl_
+#include <thenshim/_Promise/Promise_Impl_.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_5e4df8d46126c981_975_new,"snikket.Channel","new",0x8a02a1a4,"snikket.Channel.new","snikket/Chat.hx",975,0x18616bf4)
+static const ::String _hx_array_data_db683fb2_1[] = {
+ HX_("http://jabber.org/protocol/muc",07,b2,7f,c6),
+};
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1018_selfPing,"snikket.Channel","selfPing",0x9e7c785a,"snikket.Channel.selfPing","snikket/Chat.hx",1018,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1008_selfPing,"snikket.Channel","selfPing",0x9e7c785a,"snikket.Channel.selfPing","snikket/Chat.hx",1008,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_996_selfPing,"snikket.Channel","selfPing",0x9e7c785a,"snikket.Channel.selfPing","snikket/Chat.hx",996,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1000_selfPing,"snikket.Channel","selfPing",0x9e7c785a,"snikket.Channel.selfPing","snikket/Chat.hx",1000,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1042_join,"snikket.Channel","join",0x35ad7e26,"snikket.Channel.join","snikket/Chat.hx",1042,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1034_join,"snikket.Channel","join",0x35ad7e26,"snikket.Channel.join","snikket/Chat.hx",1034,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1053_selfPingSuccess,"snikket.Channel","selfPingSuccess",0xafddf489,"snikket.Channel.selfPingSuccess","snikket/Chat.hx",1053,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1064_setPresence,"snikket.Channel","setPresence",0x9dbfd141,"snikket.Channel.setPresence","snikket/Chat.hx",1064,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1065_setPresence,"snikket.Channel","setPresence",0x9dbfd141,"snikket.Channel.setPresence","snikket/Chat.hx",1065,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1073_setPresence,"snikket.Channel","setPresence",0x9dbfd141,"snikket.Channel.setPresence","snikket/Chat.hx",1073,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1080_setPresence,"snikket.Channel","setPresence",0x9dbfd141,"snikket.Channel.setPresence","snikket/Chat.hx",1080,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1103_doSync,"snikket.Channel","doSync",0xa5ffb0c2,"snikket.Channel.doSync","snikket/Chat.hx",1103,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1132_doSync,"snikket.Channel","doSync",0xa5ffb0c2,"snikket.Channel.doSync","snikket/Chat.hx",1132,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1134_doSync,"snikket.Channel","doSync",0xa5ffb0c2,"snikket.Channel.doSync","snikket/Chat.hx",1134,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1163_doSync,"snikket.Channel","doSync",0xa5ffb0c2,"snikket.Channel.doSync","snikket/Chat.hx",1163,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1109_doSync,"snikket.Channel","doSync",0xa5ffb0c2,"snikket.Channel.doSync","snikket/Chat.hx",1109,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1125_doSync,"snikket.Channel","doSync",0xa5ffb0c2,"snikket.Channel.doSync","snikket/Chat.hx",1125,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1121_doSync,"snikket.Channel","doSync",0xa5ffb0c2,"snikket.Channel.doSync","snikket/Chat.hx",1121,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1173_doSync,"snikket.Channel","doSync",0xa5ffb0c2,"snikket.Channel.doSync","snikket/Chat.hx",1173,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1086_doSync,"snikket.Channel","doSync",0xa5ffb0c2,"snikket.Channel.doSync","snikket/Chat.hx",1086,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1186_isTrusted,"snikket.Channel","isTrusted",0x2c7a5171,"snikket.Channel.isTrusted","snikket/Chat.hx",1186,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1190_isPrivate,"snikket.Channel","isPrivate",0x9f42c67d,"snikket.Channel.isPrivate","snikket/Chat.hx",1190,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1196_refreshDisco,"snikket.Channel","refreshDisco",0x9d89e5db,"snikket.Channel.refreshDisco","snikket/Chat.hx",1196,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1194_refreshDisco,"snikket.Channel","refreshDisco",0x9d89e5db,"snikket.Channel.refreshDisco","snikket/Chat.hx",1194,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1209_preview,"snikket.Channel","preview",0x1b05a34c,"snikket.Channel.preview","snikket/Chat.hx",1209,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1216_livePresence,"snikket.Channel","livePresence",0x644ddf83,"snikket.Channel.livePresence","snikket/Chat.hx",1216,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1223_syncing,"snikket.Channel","syncing",0x8651c0ab,"snikket.Channel.syncing","snikket/Chat.hx",1223,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1227_canAudioCall,"snikket.Channel","canAudioCall",0x94c730a0,"snikket.Channel.canAudioCall","snikket/Chat.hx",1227,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1231_canVideoCall,"snikket.Channel","canVideoCall",0x9aca02c5,"snikket.Channel.canVideoCall","snikket/Chat.hx",1231,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1235_nickInUse,"snikket.Channel","nickInUse",0x59744703,"snikket.Channel.nickInUse","snikket/Chat.hx",1235,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1239_getFullJid,"snikket.Channel","getFullJid",0xa835e1bc,"snikket.Channel.getFullJid","snikket/Chat.hx",1239,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1245_getParticipants,"snikket.Channel","getParticipants",0x390cb25a,"snikket.Channel.getParticipants","snikket/Chat.hx",1245,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1243_getParticipants,"snikket.Channel","getParticipants",0x390cb25a,"snikket.Channel.getParticipants","snikket/Chat.hx",1243,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1250_getParticipantDetails,"snikket.Channel","getParticipantDetails",0xdfad9dc9,"snikket.Channel.getParticipantDetails","snikket/Chat.hx",1250,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1263_getMessagesBefore,"snikket.Channel","getMessagesBefore",0xefb5f1e5,"snikket.Channel.getMessagesBefore","snikket/Chat.hx",1263,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1269_getMessagesBefore,"snikket.Channel","getMessagesBefore",0xefb5f1e5,"snikket.Channel.getMessagesBefore","snikket/Chat.hx",1269,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1261_getMessagesBefore,"snikket.Channel","getMessagesBefore",0xefb5f1e5,"snikket.Channel.getMessagesBefore","snikket/Chat.hx",1261,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1286_getMessagesAfter,"snikket.Channel","getMessagesAfter",0x103df776,"snikket.Channel.getMessagesAfter","snikket/Chat.hx",1286,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1292_getMessagesAfter,"snikket.Channel","getMessagesAfter",0x103df776,"snikket.Channel.getMessagesAfter","snikket/Chat.hx",1292,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1280_getMessagesAfter,"snikket.Channel","getMessagesAfter",0x103df776,"snikket.Channel.getMessagesAfter","snikket/Chat.hx",1280,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1305_getMessagesAround,"snikket.Channel","getMessagesAround",0x0b8795b3,"snikket.Channel.getMessagesAround","snikket/Chat.hx",1305,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1304_getMessagesAround,"snikket.Channel","getMessagesAround",0x0b8795b3,"snikket.Channel.getMessagesAround","snikket/Chat.hx",1304,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1315_prepareIncomingMessage,"snikket.Channel","prepareIncomingMessage",0x3bfa74f6,"snikket.Channel.prepareIncomingMessage","snikket/Chat.hx",1315,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1326_prepareOutgoingMessage,"snikket.Channel","prepareOutgoingMessage",0xa2273a30,"snikket.Channel.prepareOutgoingMessage","snikket/Chat.hx",1326,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1344_correctMessage,"snikket.Channel","correctMessage",0x4d2d23b9,"snikket.Channel.correctMessage","snikket/Chat.hx",1344,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1339_correctMessage,"snikket.Channel","correctMessage",0x4d2d23b9,"snikket.Channel.correctMessage","snikket/Chat.hx",1339,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1357_sendMessage,"snikket.Channel","sendMessage",0x2aa53ea3,"snikket.Channel.sendMessage","snikket/Chat.hx",1357,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1373_sendMessage,"snikket.Channel","sendMessage",0x2aa53ea3,"snikket.Channel.sendMessage","snikket/Chat.hx",1373,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1380_sendMessage,"snikket.Channel","sendMessage",0x2aa53ea3,"snikket.Channel.sendMessage","snikket/Chat.hx",1380,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1411_removeReaction,"snikket.Channel","removeReaction",0x19751149,"snikket.Channel.removeReaction","snikket/Chat.hx",1411,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1391_removeReaction,"snikket.Channel","removeReaction",0x19751149,"snikket.Channel.removeReaction","snikket/Chat.hx",1391,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1406_removeReaction,"snikket.Channel","removeReaction",0x19751149,"snikket.Channel.removeReaction","snikket/Chat.hx",1406,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1421_lastMessageId,"snikket.Channel","lastMessageId",0xa72b1e90,"snikket.Channel.lastMessageId","snikket/Chat.hx",1421,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1426_markReadUpTo,"snikket.Channel","markReadUpTo",0x9e644e95,"snikket.Channel.markReadUpTo","snikket/Chat.hx",1426,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1425_markReadUpTo,"snikket.Channel","markReadUpTo",0x9e644e95,"snikket.Channel.markReadUpTo","snikket/Chat.hx",1425,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1461_bookmark,"snikket.Channel","bookmark",0x9931a4f2,"snikket.Channel.bookmark","snikket/Chat.hx",1461,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1479_bookmark,"snikket.Channel","bookmark",0x9931a4f2,"snikket.Channel.bookmark","snikket/Chat.hx",1479,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1440_bookmark,"snikket.Channel","bookmark",0x9931a4f2,"snikket.Channel.bookmark","snikket/Chat.hx",1440,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1490_sendChatState,"snikket.Channel","sendChatState",0xee67aff5,"snikket.Channel.sendChatState","snikket/Chat.hx",1490,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_1506_close,"snikket.Channel","close",0xb85bc1fc,"snikket.Channel.close","snikket/Chat.hx",1506,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_5e4df8d46126c981_975_boot,"snikket.Channel","boot",0x3063ce6e,"snikket.Channel.boot","snikket/Chat.hx",975,0x18616bf4)
+namespace snikket{
+
+void Channel_obj::__construct( ::snikket::Client client, ::snikket::GenericStream stream,::Dynamic persistence,::String chatId,::hx::Null< int > __o_uiState,::hx::Null< bool > __o_isBlocked, ::snikket::Stanza extensions,::String readUpToId,::String readUpToBy, ::snikket::Caps disco){
+ int uiState = __o_uiState.Default(1);
+ bool isBlocked = __o_isBlocked.Default(false);
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_975_new)
+HXLINE( 981) this->_nickInUse = null();
+HXLINE( 980) this->forceLive = false;
+HXLINE( 979) this->sync = null();
+HXLINE( 978) this->inSync = true;
+HXLINE( 977) this->disco = ::snikket::Caps_obj::__alloc( HX_CTX ,HX_("",00,00,00,00),::Array_obj< ::Dynamic>::__new(0),::Array_obj< ::String >::fromData( _hx_array_data_db683fb2_1,1));
+HXLINE( 985) super::__construct(client,stream,persistence,chatId,uiState,isBlocked,extensions,readUpToId,readUpToBy);
+HXLINE( 986) if (::hx::IsNotNull( disco )) {
+HXLINE( 987) this->disco = disco;
+HXLINE( 988) if (!(disco->features->contains(HX_("http://jabber.org/protocol/muc",07,b2,7f,c6)))) {
+HXLINE( 990) this->forceLive = true;
+ }
+ }
+ }
+
+Dynamic Channel_obj::__CreateEmpty() { return new Channel_obj; }
+
+void *Channel_obj::_hx_vtable = 0;
+
+Dynamic Channel_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Channel_obj > _hx_result = new Channel_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6],inArgs[7],inArgs[8],inArgs[9]);
+ return _hx_result;
+}
+
+bool Channel_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x026b7f35) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x026b7f35;
+ } else {
+ return inClassId==(int)0x23f2b886;
+ }
+}
+
+void Channel_obj::selfPing(bool refresh){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_3, ::snikket::Channel,_gthis) HXARGC(0)
+ void _hx_run(){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_2, ::snikket::Channel,_gthis) HXARGC(1)
+ void _hx_run( ::snikket::Stanza response){
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1018_selfPing)
+HXLINE(1018) if ((( (::String)(::Reflect_obj::field(response->attr,HX_("type",ba,f2,08,4d))) ) == HX_("error",c8,cb,29,73))) {
+HXLINE(1019) ::snikket::Stanza tmp = response->getChild(HX_("error",c8,cb,29,73),null());
+HXDLIN(1019) ::snikket::Stanza err;
+HXDLIN(1019) if (::hx::IsNotNull( tmp )) {
+HXLINE(1019) err = tmp->getChild(null(),HX_("urn:ietf:params:xml:ns:xmpp-stanzas",27,f2,3d,30));
+ }
+ else {
+HXLINE(1019) err = null();
+ }
+HXLINE(1020) bool _hx_tmp;
+HXDLIN(1020) if ((err->name != HX_("service-unavailable",f8,3c,11,1c))) {
+HXLINE(1020) _hx_tmp = (err->name == HX_("feature-not-implemented",71,20,2e,96));
+ }
+ else {
+HXLINE(1020) _hx_tmp = true;
+ }
+HXDLIN(1020) if (_hx_tmp) {
+HXLINE(1020) _gthis->selfPingSuccess();
+HXDLIN(1020) return;
+ }
+HXLINE(1021) bool _hx_tmp1;
+HXDLIN(1021) if ((err->name != HX_("remote-server-not-found",e5,4f,ca,aa))) {
+HXLINE(1021) _hx_tmp1 = (err->name == HX_("remote-server-timeout",fe,b0,ee,1a));
+ }
+ else {
+HXLINE(1021) _hx_tmp1 = true;
+ }
+HXDLIN(1021) if (_hx_tmp1) {
+HXLINE(1021) _gthis->selfPingSuccess();
+HXDLIN(1021) return;
+ }
+HXLINE(1022) if ((err->name == HX_("item-not-found",4e,b5,9b,5b))) {
+HXLINE(1022) _gthis->selfPingSuccess();
+HXDLIN(1022) return;
+ }
+HXLINE(1023) ::haxe::Log_obj::trace(HX_("SYNC: self-ping fail, join",ea,45,f2,f0), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.Channel",b2,3f,68,db))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,_gthis->chatId))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("selfPing",1e,60,3c,38))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/Chat.hx",f4,6b,61,18))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),1023)));
+HXLINE(1024) _gthis->join();
+ }
+ else {
+HXLINE(1026) _gthis->selfPingSuccess();
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1008_selfPing)
+HXLINE(1009) if (!(_gthis->disco->features->contains(HX_("http://jabber.org/protocol/muc",07,b2,7f,c6)))) {
+HXLINE(1011) _gthis->forceLive = true;
+HXLINE(1012) return;
+ }
+HXLINE(1014) ::snikket::GenericStream _gthis1 = _gthis->stream;
+HXLINE(1015) ::String _hx_tmp = _gthis->getFullJid()->asString();
+HXLINE(1014) _gthis1->sendIq( ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("iq",e8,5b,00,00), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("to",7b,65,00,00),_hx_tmp)
+ ->setFixed(1,HX_("type",ba,f2,08,4d),HX_("get",96,80,4e,00))))->tag(HX_("ping",72,f2,57,4a), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:ping",8e,30,3f,fd))))->up(), ::Dynamic(new _hx_Closure_2(_gthis)));
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_996_selfPing)
+HXDLIN( 996) ::snikket::Channel _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 997) if ((this->uiState == 2)) {
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ ::snikket::Stanza _hx_run( ::snikket::Stanza stanza){
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1000_selfPing)
+HXLINE(1001) ::Reflect_obj::setField(stanza->attr,HX_("type",ba,f2,08,4d),HX_("unavailable",50,e0,29,fd));
+HXLINE(1002) return stanza;
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE( 998) ::snikket::Client _hx_tmp = this->client;
+HXDLIN( 998) _hx_tmp->sendPresence(this->getFullJid()->asString(), ::Dynamic(new _hx_Closure_0()));
+HXLINE(1005) return;
+ }
+HXLINE(1008) ::Dynamic _hx_tmp1;
+HXDLIN(1008) if (refresh) {
+HXLINE(1008) _hx_tmp1 = this->refreshDisco_dyn();
+ }
+ else {
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_1) HXARGC(1)
+ void _hx_run( ::Dynamic cb){
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1008_selfPing)
+HXLINE(1008) cb();
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE(1008) _hx_tmp1 = ::Dynamic(new _hx_Closure_1());
+ }
+HXDLIN(1008) _hx_tmp1( ::Dynamic(new _hx_Closure_3(_gthis)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Channel_obj,selfPing,(void))
+
+void Channel_obj::join(){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::Channel,_gthis) HXARGC(1)
+ ::snikket::Stanza _hx_run( ::snikket::Stanza stanza){
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1042_join)
+HXLINE(1043) stanza->tag(HX_("x",78,00,00,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("http://jabber.org/protocol/muc",07,b2,7f,c6))));
+HXLINE(1044) if (_gthis->disco->features->contains(HX_("urn:xmpp:mam:2",f5,ef,8c,da))) {
+HXLINE(1044) stanza->tag(HX_("history",54,35,47,64), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("maxchars",b9,7f,a3,5c),HX_("0",30,00,00,00))))->up();
+ }
+HXLINE(1046) stanza->up();
+HXLINE(1047) return stanza;
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1034_join)
+HXDLIN(1034) ::snikket::Channel _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE(1035) this->presence = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXLINE(1036) this->_nickInUse = null();
+HXLINE(1037) this->inSync = false;
+HXLINE(1038) this->client->trigger(HX_("chats/update",3d,8e,1d,14),::cpp::VirtualArray_obj::__new(1)->init(0,::hx::ObjectPtr<OBJ_>(this)));
+HXLINE(1039) ::snikket::JID desiredFullJid = ::snikket::JID_obj::parse(this->chatId);
+HXDLIN(1039) ::snikket::JID desiredFullJid1 = desiredFullJid->withResource(this->client->displayName());
+HXLINE(1040) ::snikket::Client _hx_tmp = this->client;
+HXDLIN(1040) _hx_tmp->sendPresence(desiredFullJid1->asString(), ::Dynamic(new _hx_Closure_0(_gthis)));
+HXLINE(1050) ::Dynamic _hx_tmp1 = this->persistence;
+HXDLIN(1050) ::String _hx_tmp2 = this->client->accountId();
+HXDLIN(1050) ::snikket::Persistence_obj::lastId(_hx_tmp1,_hx_tmp2,this->chatId,this->doSync_dyn());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Channel_obj,join,(void))
+
+void Channel_obj::selfPingSuccess(){
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1053_selfPingSuccess)
+HXLINE(1054) ::String _hx_tmp = this->nickInUse();
+HXDLIN(1054) if ((_hx_tmp != this->client->displayName())) {
+HXLINE(1055) ::snikket::JID desiredFullJid = ::snikket::JID_obj::parse(this->chatId);
+HXDLIN(1055) ::snikket::JID desiredFullJid1 = desiredFullJid->withResource(this->client->displayName());
+HXLINE(1056) ::snikket::Client _hx_tmp1 = this->client;
+HXDLIN(1056) _hx_tmp1->sendPresence(desiredFullJid1->asString(),null());
+ }
+HXLINE(1060) this->inSync = false;
+HXLINE(1061) ::Dynamic _hx_tmp2 = this->persistence;
+HXDLIN(1061) ::String _hx_tmp3 = this->client->accountId();
+HXDLIN(1061) ::snikket::Persistence_obj::lastId(_hx_tmp2,_hx_tmp3,this->chatId,this->doSync_dyn());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Channel_obj,selfPingSuccess,(void))
+
+void Channel_obj::setPresence(::String resource, ::snikket::Presence presence){
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1064_setPresence)
+HXLINE(1065) ::snikket::Stanza tmp;
+HXDLIN(1065) if (::hx::IsNotNull( presence )) {
+HXLINE(1065) tmp = presence->mucUser;
+ }
+ else {
+HXLINE(1065) tmp = null();
+ }
+HXDLIN(1065) ::snikket::Stanza oneTen;
+HXDLIN(1065) if (::hx::IsNotNull( tmp )) {
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ bool _hx_run( ::snikket::Stanza status){
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1065_setPresence)
+HXLINE(1065) return (( (::String)(::Reflect_obj::field(status->attr,HX_("code",2d,b1,c4,41))) ) == HX_("110",50,59,25,00));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE(1065) oneTen = ( ( ::snikket::Stanza)(::Lambda_obj::find(tmp->allTags(HX_("status",32,e7,fb,05),null()), ::Dynamic(new _hx_Closure_0()))) );
+ }
+ else {
+HXLINE(1065) oneTen = null();
+ }
+HXLINE(1066) if (::hx::IsNotNull( oneTen )) {
+HXLINE(1067) this->_nickInUse = resource;
+ }
+ else {
+HXLINE(1068) if ((resource == this->_nickInUse)) {
+HXLINE(1069) this->_nickInUse = null();
+ }
+ }
+HXLINE(1071) bool _hx_tmp;
+HXDLIN(1071) bool _hx_tmp1;
+HXDLIN(1071) if (::hx::IsNotNull( presence )) {
+HXLINE(1071) _hx_tmp1 = ::hx::IsNotNull( presence->mucUser );
+ }
+ else {
+HXLINE(1071) _hx_tmp1 = false;
+ }
+HXDLIN(1071) if (_hx_tmp1) {
+HXLINE(1071) _hx_tmp = ::hx::IsNull( oneTen );
+ }
+ else {
+HXLINE(1071) _hx_tmp = false;
+ }
+HXDLIN(1071) if (_hx_tmp) {
+HXLINE(1072) ::snikket::Presence existing = ( ( ::snikket::Presence)(this->presence->get(resource)) );
+HXLINE(1073) bool _hx_tmp2;
+HXDLIN(1073) if (::hx::IsNotNull( existing )) {
+HXLINE(1073) ::snikket::Stanza tmp1;
+HXDLIN(1073) if (::hx::IsNotNull( existing )) {
+HXLINE(1073) tmp1 = existing->mucUser;
+ }
+ else {
+HXLINE(1073) tmp1 = null();
+ }
+HXDLIN(1073) ::snikket::Stanza _hx_tmp3;
+HXDLIN(1073) if (::hx::IsNotNull( tmp1 )) {
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_1) HXARGC(1)
+ bool _hx_run( ::snikket::Stanza status){
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1073_setPresence)
+HXLINE(1073) return (( (::String)(::Reflect_obj::field(status->attr,HX_("code",2d,b1,c4,41))) ) == HX_("110",50,59,25,00));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE(1073) _hx_tmp3 = ( ( ::snikket::Stanza)(::Lambda_obj::find(tmp1->allTags(HX_("status",32,e7,fb,05),null()), ::Dynamic(new _hx_Closure_1()))) );
+ }
+ else {
+HXLINE(1073) _hx_tmp3 = null();
+ }
+HXDLIN(1073) _hx_tmp2 = ::hx::IsNotNull( _hx_tmp3 );
+ }
+ else {
+HXLINE(1073) _hx_tmp2 = false;
+ }
+HXDLIN(1073) if (_hx_tmp2) {
+HXLINE(1074) presence->mucUser->tag(HX_("status",32,e7,fb,05), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("code",2d,b1,c4,41),HX_("110",50,59,25,00))));
+HXLINE(1075) this->setPresence(resource,presence);
+HXLINE(1076) return;
+ }
+ }
+HXLINE(1079) this->super::setPresence(resource,presence);
+HXLINE(1080) ::snikket::Stanza tmp2;
+HXDLIN(1080) if (::hx::IsNotNull( presence )) {
+HXLINE(1080) tmp2 = presence->mucUser;
+ }
+ else {
+HXLINE(1080) tmp2 = null();
+ }
+HXDLIN(1080) ::snikket::Stanza tripleThree;
+HXDLIN(1080) if (::hx::IsNotNull( tmp2 )) {
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_2) HXARGC(1)
+ bool _hx_run( ::snikket::Stanza status){
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1080_setPresence)
+HXLINE(1080) return (( (::String)(::Reflect_obj::field(status->attr,HX_("code",2d,b1,c4,41))) ) == HX_("333",93,df,26,00));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE(1080) tripleThree = ( ( ::snikket::Stanza)(::Lambda_obj::find(tmp2->allTags(HX_("status",32,e7,fb,05),null()), ::Dynamic(new _hx_Closure_2()))) );
+ }
+ else {
+HXLINE(1080) tripleThree = null();
+ }
+HXLINE(1081) bool _hx_tmp4;
+HXDLIN(1081) if (::hx::IsNotNull( oneTen )) {
+HXLINE(1081) _hx_tmp4 = ::hx::IsNotNull( tripleThree );
+ }
+ else {
+HXLINE(1081) _hx_tmp4 = false;
+ }
+HXDLIN(1081) if (_hx_tmp4) {
+HXLINE(1082) this->selfPing(true);
+ }
+ }
+
+
+void Channel_obj::doSync(::String lastId){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::Channel,_gthis) HXARGC(2)
+ ::snikket::ChatMessageBuilder _hx_run( ::snikket::ChatMessageBuilder builder, ::snikket::Stanza stanza){
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1103_doSync)
+HXLINE(1104) builder = _gthis->prepareIncomingMessage(builder,stanza);
+HXLINE(1105) builder->syncPoint = true;
+HXLINE(1106) return builder;
+ }
+ HX_END_LOCAL_FUNC2(return)
+
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_8, ::snikket::Channel,_gthis,::Array< ::Dynamic>,chatMessages) HXARGC(1)
+ void _hx_run( ::Dynamic messageList){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_5, ::snikket::Channel,_gthis,::Array< ::Dynamic>,pageChatMessages) HXARGC(2)
+ void _hx_run( ::Dynamic resolve, ::Dynamic reject){
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1132_doSync)
+HXLINE(1132) _gthis->client->storeMessages(pageChatMessages,resolve);
+ }
+ HX_END_LOCAL_FUNC2((void))
+
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_7, ::snikket::Channel,_gthis,::Array< ::Dynamic>,chatMessages) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> stored){
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1134_doSync)
+HXLINE(1135) {
+HXLINE(1135) int _g = 0;
+HXDLIN(1135) while((_g < stored->length)){
+HXLINE(1135) ::Array< ::Dynamic> messages = stored->__get(_g).StaticCast< ::Array< ::Dynamic> >();
+HXDLIN(1135) _g = (_g + 1);
+HXLINE(1136) if (::hx::IsNotNull( messages )) {
+HXLINE(1137) int _g1 = 0;
+HXDLIN(1137) while((_g1 < messages->length)){
+HXLINE(1137) ::snikket::ChatMessage message = messages->__get(_g1).StaticCast< ::snikket::ChatMessage >();
+HXDLIN(1137) _g1 = (_g1 + 1);
+HXLINE(1138) _gthis->client->notifySyncMessageHandlers(message);
+HXLINE(1139) bool _hx_tmp;
+HXDLIN(1139) if (::hx::IsNotNull( message )) {
+HXLINE(1139) ::String _hx_tmp1 = message->chatId();
+HXDLIN(1139) _hx_tmp = (_hx_tmp1 == _gthis->chatId);
+ }
+ else {
+HXLINE(1139) _hx_tmp = false;
+ }
+HXDLIN(1139) if (_hx_tmp) {
+HXLINE(1139) chatMessages->push(message);
+ }
+HXLINE(1140) if ((chatMessages->length > 1000)) {
+HXLINE(1140) chatMessages->shift().StaticCast< ::snikket::ChatMessage >();
+ }
+ }
+ }
+ }
+ }
+HXLINE(1144) if (_gthis->sync->hasMore()) {
+HXLINE(1145) _gthis->sync->fetchNext();
+ }
+ else {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_6, ::snikket::Channel,_gthis) HXARGC(1)
+ bool _hx_run( ::snikket::ChatMessage m){
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1163_doSync)
+HXLINE(1163) ::String m1 = m->serverId;
+HXDLIN(1163) if ((m1 != _gthis->readUpTo())) {
+HXLINE(1163) return !(m->isIncoming());
+ }
+ else {
+HXLINE(1163) return true;
+ }
+HXDLIN(1163) return false;
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE(1147) _gthis->inSync = true;
+HXLINE(1148) _gthis->sync = null();
+HXLINE(1149) ::snikket::ChatMessage lastFromSync = chatMessages->__get((chatMessages->length - 1)).StaticCast< ::snikket::ChatMessage >();
+HXLINE(1150) bool _hx_tmp2;
+HXDLIN(1150) if (::hx::IsNotNull( lastFromSync )) {
+HXLINE(1150) if (::hx::IsNotNull( _gthis->lastMessageTimestamp() )) {
+HXLINE(1150) ::String lastFromSync1 = lastFromSync->timestamp;
+HXDLIN(1150) _hx_tmp2 = (::Reflect_obj::compare(lastFromSync1,_gthis->lastMessageTimestamp()) > 0);
+ }
+ else {
+HXLINE(1150) _hx_tmp2 = true;
+ }
+ }
+ else {
+HXLINE(1150) _hx_tmp2 = false;
+ }
+HXDLIN(1150) if (_hx_tmp2) {
+HXLINE(1151) _gthis->setLastMessage(lastFromSync);
+HXLINE(1152) _gthis->client->sortChats();
+ }
+HXLINE(1154) ::haxe::ds::StringMap serverIds = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXLINE(1155) ::Array< ::Dynamic> dedupedMessages = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE(1156) chatMessages->reverse();
+HXLINE(1157) {
+HXLINE(1157) int _g2 = 0;
+HXDLIN(1157) while((_g2 < chatMessages->length)){
+HXLINE(1157) ::snikket::ChatMessage m = chatMessages->__get(_g2).StaticCast< ::snikket::ChatMessage >();
+HXDLIN(1157) _g2 = (_g2 + 1);
+HXLINE(1158) ::Dynamic tmp = serverIds->get(m->serverId);
+HXDLIN(1158) bool _hx_tmp3;
+HXDLIN(1158) if (::hx::IsNotNull( tmp )) {
+HXLINE(1158) _hx_tmp3 = ( (bool)(tmp) );
+ }
+ else {
+HXLINE(1158) _hx_tmp3 = false;
+ }
+HXDLIN(1158) if (!(_hx_tmp3)) {
+HXLINE(1159) dedupedMessages->unshift(m);
+HXLINE(1160) serverIds->set(m->serverId,true);
+ }
+ }
+ }
+HXLINE(1163) int readIndex = ::Lambda_obj::findIndex(dedupedMessages, ::Dynamic(new _hx_Closure_6(_gthis)));
+HXLINE(1164) if ((readIndex < 0)) {
+HXLINE(1165) ::snikket::Channel _gthis1 = _gthis;
+HXDLIN(1165) int _hx_tmp4 = _gthis->unreadCount();
+HXDLIN(1165) _gthis1->setUnreadCount((_hx_tmp4 + dedupedMessages->length));
+ }
+ else {
+HXLINE(1167) _gthis->setUnreadCount(((dedupedMessages->length - readIndex) - 1));
+ }
+HXLINE(1169) _gthis->client->trigger(HX_("chats/update",3d,8e,1d,14),::cpp::VirtualArray_obj::__new(1)->init(0,_gthis));
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1109_doSync)
+HXLINE(1110) ::Array< ::Dynamic> promises = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE(1111) ::Array< ::Dynamic> pageChatMessages = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE(1112) {
+HXLINE(1112) int _g = 0;
+HXDLIN(1112) ::Array< ::Dynamic> _g1 = ( (::Array< ::Dynamic>)(messageList->__Field(HX_("messages",cc,d8,fd,34),::hx::paccDynamic)) );
+HXDLIN(1112) while((_g < _g1->length)){
+HXLINE(1112) ::snikket::MessageStanza m = _g1->__get(_g).StaticCast< ::snikket::MessageStanza >();
+HXDLIN(1112) _g = (_g + 1);
+HXLINE(1113) switch((int)(m->_hx_getIndex())){
+ case (int)1: {
+HXLINE(1114) ::snikket::ChatMessage message = m->_hx_getObject(0).StaticCast< ::snikket::ChatMessage >();
+HXDLIN(1114) {
+HXLINE(1115) {
+HXLINE(1115) int _g2 = 0;
+HXDLIN(1115) ::Array< ::Dynamic> _g3 = message->inlineHashReferences();
+HXDLIN(1115) while((_g2 < _g3->length)){
+HXLINE(1115) ::snikket::Hash hash = _g3->__get(_g2).StaticCast< ::snikket::Hash >();
+HXDLIN(1115) _g2 = (_g2 + 1);
+HXLINE(1116) _gthis->client->fetchMediaByHash(::Array_obj< ::Dynamic>::__new(1)->init(0,hash),::Array_obj< ::Dynamic>::__new(1)->init(0,message->from));
+ }
+ }
+HXLINE(1118) pageChatMessages->push(message);
+ }
+ }
+ break;
+ case (int)2: {
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_2, ::snikket::Channel,_gthis, ::snikket::ModerationAction,action) HXARGC(2)
+ void _hx_run( ::Dynamic resolve, ::Dynamic reject){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_1, ::Dynamic,resolve) HXARGC(1)
+ void _hx_run( ::snikket::ChatMessage _){
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1125_doSync)
+HXLINE(1125) resolve(null());
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1125_doSync)
+HXLINE(1125) ::thenshim::_Promise::Promise_Impl__obj::then(_gthis->client->moderateMessage(action), ::Dynamic(new _hx_Closure_1(resolve)),null());
+ }
+ HX_END_LOCAL_FUNC2((void))
+
+HXLINE(1123) ::snikket::ModerationAction action = m->_hx_getObject(0).StaticCast< ::snikket::ModerationAction >();
+HXLINE(1124) promises->push(::thenshim::_Promise::Promise_Impl__obj::_new( ::Dynamic(new _hx_Closure_2(_gthis,action))));
+ }
+ break;
+ case (int)3: {
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_4, ::snikket::Channel,_gthis, ::snikket::ReactionUpdate,update) HXARGC(2)
+ void _hx_run( ::Dynamic resolve, ::Dynamic reject){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_3, ::Dynamic,resolve) HXARGC(1)
+ void _hx_run( ::snikket::ChatMessage _){
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1121_doSync)
+HXLINE(1121) resolve(null());
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1121_doSync)
+HXLINE(1121) ::Dynamic _gthis1 = _gthis->persistence;
+HXDLIN(1121) ::String _hx_tmp = _gthis->client->accountId();
+HXDLIN(1121) ::snikket::Persistence_obj::storeReaction(_gthis1,_hx_tmp,update, ::Dynamic(new _hx_Closure_3(resolve)));
+ }
+ HX_END_LOCAL_FUNC2((void))
+
+HXLINE(1119) ::snikket::ReactionUpdate update = m->_hx_getObject(0).StaticCast< ::snikket::ReactionUpdate >();
+HXLINE(1120) promises->push(::thenshim::_Promise::Promise_Impl__obj::_new( ::Dynamic(new _hx_Closure_4(_gthis,update))));
+ }
+ break;
+ default:{
+ }
+ }
+ }
+ }
+HXLINE(1131) promises->push(::thenshim::_Promise::Promise_Impl__obj::_new( ::Dynamic(new _hx_Closure_5(_gthis,pageChatMessages))));
+HXLINE(1134) ::thenshim::_Promise::Promise_Impl__obj::then(::thenshim::PromiseTools_obj::all(promises), ::Dynamic(new _hx_Closure_7(_gthis,chatMessages)),null());
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_9, ::snikket::Channel,_gthis,::String,lastId) HXARGC(1)
+ void _hx_run( ::snikket::Stanza stanza){
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1173_doSync)
+HXLINE(1174) _gthis->sync = null();
+HXLINE(1175) if (::hx::IsNotNull( lastId )) {
+HXLINE(1177) _gthis->doSync(null());
+ }
+ else {
+HXLINE(1179) ::haxe::Log_obj::trace(HX_("SYNC failed",e2,ec,6f,fa), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.Channel",b2,3f,68,db))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(2)->init(0,_gthis->chatId)->init(1,stanza))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("doSync",86,5f,63,1c))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/Chat.hx",f4,6b,61,18))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),1179)));
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1086_doSync)
+HXDLIN(1086) ::snikket::Channel _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE(1087) if (!(this->disco->features->contains(HX_("urn:xmpp:mam:2",f5,ef,8c,da)))) {
+HXLINE(1088) this->inSync = true;
+HXLINE(1089) return;
+ }
+HXLINE(1091) if (::hx::IsNotNull( this->sync )) {
+HXLINE(1091) return;
+ }
+HXLINE(1093) ::String threeDaysAgo = ::snikket::Date_obj::format(::Date_obj::fromTime((::Date_obj::now()->getTime() + ((Float)-259200000.))));
+HXLINE(1099) ::Dynamic _hx_tmp;
+HXDLIN(1099) if (::hx::IsNull( lastId )) {
+HXLINE(1099) _hx_tmp = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("startTime",8f,45,f0,05),threeDaysAgo));
+ }
+ else {
+HXLINE(1099) _hx_tmp = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("page",4f,da,51,4a), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("after",1c,66,a2,1d),lastId))));
+ }
+HXLINE(1096) this->sync = ::snikket::MessageSync_obj::__alloc( HX_CTX ,this->client,this->stream,_hx_tmp,this->chatId);
+HXLINE(1102) this->sync->setNewestPageFirst(false);
+HXLINE(1103) this->sync->addContext( ::Dynamic(new _hx_Closure_0(_gthis)));
+HXLINE(1108) ::Array< ::Dynamic> chatMessages = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE(1109) this->sync->onMessages( ::Dynamic(new _hx_Closure_8(_gthis,chatMessages)));
+HXLINE(1173) this->sync->onError( ::Dynamic(new _hx_Closure_9(_gthis,lastId)));
+HXLINE(1182) this->sync->fetchNext();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Channel_obj,doSync,(void))
+
+bool Channel_obj::isTrusted(){
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1186_isTrusted)
+HXDLIN(1186) return (this->uiState != 2);
+ }
+
+
+bool Channel_obj::isPrivate(){
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1190_isPrivate)
+HXDLIN(1190) return this->disco->features->contains(HX_("muc_membersonly",41,e9,70,b7));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Channel_obj,isPrivate,return )
+
+void Channel_obj::refreshDisco( ::Dynamic callback){
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_0, ::snikket::Channel,_gthis, ::snikket::queries::DiscoInfoGet,discoGet, ::Dynamic,callback) HXARGC(0)
+ void _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1196_refreshDisco)
+HXLINE(1197) if (::hx::IsNotNull( discoGet->getResult() )) {
+HXLINE(1198) bool setupNotifications;
+HXDLIN(1198) if (::hx::IsNull( _gthis->disco )) {
+HXLINE(1198) setupNotifications = ::hx::IsNull( _gthis->notificationSettings );
+ }
+ else {
+HXLINE(1198) setupNotifications = false;
+ }
+HXLINE(1199) _gthis->disco = discoGet->getResult();
+HXLINE(1200) bool _hx_tmp;
+HXDLIN(1200) if (setupNotifications) {
+HXLINE(1200) _hx_tmp = !(_gthis->isPrivate());
+ }
+ else {
+HXLINE(1200) _hx_tmp = false;
+ }
+HXDLIN(1200) if (_hx_tmp) {
+HXLINE(1200) _gthis->notificationSettings = ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("mention",ea,9e,bf,b9),true)
+ ->setFixed(1,HX_("reply",2a,09,c6,e6),false));
+ }
+HXLINE(1201) ::Dynamic _gthis1 = _gthis->persistence;
+HXDLIN(1201) ::snikket::Persistence_obj::storeCaps(_gthis1,discoGet->getResult());
+HXLINE(1202) ::Dynamic _gthis2 = _gthis->persistence;
+HXDLIN(1202) ::String _hx_tmp1 = _gthis->client->accountId();
+HXDLIN(1202) ::snikket::Persistence_obj::storeChats(_gthis2,_hx_tmp1,::Array_obj< ::Dynamic>::__new(1)->init(0,_gthis));
+ }
+HXLINE(1204) if (::hx::IsNotNull( callback )) {
+HXLINE(1204) callback();
+ }
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1194_refreshDisco)
+HXDLIN(1194) ::snikket::Channel _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE(1195) ::snikket::queries::DiscoInfoGet discoGet = ::snikket::queries::DiscoInfoGet_obj::__alloc( HX_CTX ,this->chatId,null());
+HXLINE(1196) discoGet->onFinished( ::Dynamic(new _hx_Closure_0(_gthis,discoGet,callback)));
+HXLINE(1206) this->client->sendQuery(discoGet);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Channel_obj,refreshDisco,(void))
+
+::String Channel_obj::preview(){
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1209_preview)
+HXLINE(1210) if (::hx::IsNull( this->lastMessage )) {
+HXLINE(1210) return this->super::preview();
+ }
+HXLINE(1212) ::String _hx_tmp = (this->getParticipantDetails(this->lastMessage->senderId)->displayName + HX_(": ",a6,32,00,00));
+HXDLIN(1212) return (_hx_tmp + this->super::preview());
+ }
+
+
+bool Channel_obj::livePresence(){
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1216_livePresence)
+HXLINE(1217) if (this->forceLive) {
+HXLINE(1217) return true;
+ }
+HXLINE(1219) return ::hx::IsNotNull( this->_nickInUse );
+ }
+
+
+bool Channel_obj::syncing(){
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1223_syncing)
+HXDLIN(1223) if (this->inSync) {
+HXDLIN(1223) return !(this->livePresence());
+ }
+ else {
+HXDLIN(1223) return true;
+ }
+HXDLIN(1223) return false;
+ }
+
+
+bool Channel_obj::canAudioCall(){
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1227_canAudioCall)
+HXDLIN(1227) ::snikket::Caps tmp = this->disco;
+HXDLIN(1227) ::Array< ::String > tmp1;
+HXDLIN(1227) if (::hx::IsNotNull( tmp )) {
+HXDLIN(1227) tmp1 = tmp->features;
+ }
+ else {
+HXDLIN(1227) tmp1 = null();
+ }
+HXDLIN(1227) ::Dynamic tmp2;
+HXDLIN(1227) if (::hx::IsNotNull( tmp1 )) {
+HXDLIN(1227) tmp2 = tmp1->contains(HX_("urn:xmpp:jingle:apps:rtp:audio",0f,8b,54,6c));
+ }
+ else {
+HXDLIN(1227) tmp2 = null();
+ }
+HXDLIN(1227) if (::hx::IsNotNull( tmp2 )) {
+HXDLIN(1227) return ( (bool)(tmp2) );
+ }
+ else {
+HXDLIN(1227) return false;
+ }
+HXDLIN(1227) return false;
+ }
+
+
+bool Channel_obj::canVideoCall(){
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1231_canVideoCall)
+HXDLIN(1231) ::snikket::Caps tmp = this->disco;
+HXDLIN(1231) ::Array< ::String > tmp1;
+HXDLIN(1231) if (::hx::IsNotNull( tmp )) {
+HXDLIN(1231) tmp1 = tmp->features;
+ }
+ else {
+HXDLIN(1231) tmp1 = null();
+ }
+HXDLIN(1231) ::Dynamic tmp2;
+HXDLIN(1231) if (::hx::IsNotNull( tmp1 )) {
+HXDLIN(1231) tmp2 = tmp1->contains(HX_("urn:xmpp:jingle:apps:rtp:video",b4,26,d0,7b));
+ }
+ else {
+HXDLIN(1231) tmp2 = null();
+ }
+HXDLIN(1231) if (::hx::IsNotNull( tmp2 )) {
+HXDLIN(1231) return ( (bool)(tmp2) );
+ }
+ else {
+HXDLIN(1231) return false;
+ }
+HXDLIN(1231) return false;
+ }
+
+
+::String Channel_obj::nickInUse(){
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1235_nickInUse)
+HXDLIN(1235) ::String tmp = this->_nickInUse;
+HXDLIN(1235) if (::hx::IsNotNull( tmp )) {
+HXDLIN(1235) return tmp;
+ }
+ else {
+HXDLIN(1235) return this->client->displayName();
+ }
+HXDLIN(1235) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Channel_obj,nickInUse,return )
+
+ ::snikket::JID Channel_obj::getFullJid(){
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1239_getFullJid)
+HXDLIN(1239) ::snikket::JID _hx_tmp = ::snikket::JID_obj::parse(this->chatId);
+HXDLIN(1239) return _hx_tmp->withResource(this->nickInUse());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Channel_obj,getFullJid,return )
+
+::Array< ::String > Channel_obj::getParticipants(){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::Channel,_gthis) HXARGC(0)
+ ::Dynamic _hx_run(){
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1245_getParticipants)
+HXLINE(1245) return _gthis->presence->keys();
+ }
+ HX_END_LOCAL_FUNC0(return)
+
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_1) HXARGC(1)
+ bool _hx_run(::String resource){
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1245_getParticipants)
+HXLINE(1245) return ::hx::IsNotNull( resource );
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1243_getParticipants)
+HXDLIN(1243) ::snikket::Channel _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE(1244) ::snikket::JID jid = ::snikket::JID_obj::parse(this->chatId);
+HXLINE(1245) ::Array< ::String > _this = ::Lambda_obj::filter( ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("iterator",ee,49,9a,93), ::Dynamic(new _hx_Closure_0(_gthis)))), ::Dynamic(new _hx_Closure_1()));
+HXDLIN(1245) ::Array< ::String > result = ::Array_obj< ::String >::__new(_this->length);
+HXDLIN(1245) {
+HXLINE(1245) int _g = 0;
+HXDLIN(1245) int _g1 = _this->length;
+HXDLIN(1245) while((_g < _g1)){
+HXLINE(1245) _g = (_g + 1);
+HXDLIN(1245) int i = (_g - 1);
+HXDLIN(1245) {
+HXLINE(1245) ::String resource = ( (::String)(_hx_array_unsafe_get(_this,i)) );
+HXDLIN(1245) ::String inValue = ::snikket::JID_obj::__alloc( HX_CTX ,jid->node,jid->domain,resource)->asString();
+HXDLIN(1245) result->__unsafe_set(i,inValue);
+ }
+ }
+ }
+HXDLIN(1245) return result;
+ }
+
+
+ ::snikket::Participant Channel_obj::getParticipantDetails(::String participantId){
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1250_getParticipantDetails)
+HXDLIN(1250) if ((participantId == this->getFullJid()->asString())) {
+HXLINE(1251) ::snikket::Client chat = this->client;
+HXDLIN(1251) ::snikket::DirectChat chat1 = chat->getDirectChat(this->client->accountId(),false);
+HXLINE(1252) ::String _hx_tmp = this->client->displayName();
+HXDLIN(1252) ::String _hx_tmp1 = chat1->getPhoto();
+HXDLIN(1252) return ::snikket::Participant_obj::__alloc( HX_CTX ,_hx_tmp,_hx_tmp1,chat1->getPlaceholder(),true);
+ }
+ else {
+HXLINE(1254) ::String nick = ::snikket::JID_obj::parse(participantId)->resource;
+HXLINE(1255) ::String placeholderUri;
+HXDLIN(1255) if (::hx::IsNull( nick )) {
+HXLINE(1255) placeholderUri = HX_(" ",20,00,00,00);
+ }
+ else {
+HXLINE(1255) placeholderUri = nick.charAt(0);
+ }
+HXDLIN(1255) ::String placeholderUri1 = ::snikket::Color_obj::defaultPhoto(participantId,placeholderUri);
+HXLINE(1256) return ::snikket::Participant_obj::__alloc( HX_CTX ,nick,null(),placeholderUri1,false);
+ }
+HXLINE(1250) return null();
+ }
+
+
+void Channel_obj::getMessagesBefore(::String beforeId,::String beforeTime, ::Dynamic handler){
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_1, ::snikket::Channel,_gthis,::String,beforeId, ::Dynamic,handler) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> messages){
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1263_getMessagesBefore)
+HXLINE(1263) if ((messages->length > 0)) {
+HXLINE(1264) handler(messages);
+ }
+ else {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::Channel,_gthis) HXARGC(2)
+ ::snikket::ChatMessageBuilder _hx_run( ::snikket::ChatMessageBuilder builder, ::snikket::Stanza stanza){
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1269_getMessagesBefore)
+HXLINE(1270) builder = _gthis->prepareIncomingMessage(builder,stanza);
+HXLINE(1271) builder->syncPoint = false;
+HXLINE(1272) return builder;
+ }
+ HX_END_LOCAL_FUNC2(return)
+
+HXLINE(1266) ::Dynamic filter = ::Dynamic(::hx::Anon_obj::Create(0));
+HXLINE(1267) if (::hx::IsNotNull( beforeId )) {
+HXLINE(1267) filter->__SetField(HX_("page",4f,da,51,4a), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("before",7f,54,32,9a),beforeId)),::hx::paccDynamic);
+ }
+HXLINE(1268) ::snikket::MessageSync sync = ::snikket::MessageSync_obj::__alloc( HX_CTX ,_gthis->client,_gthis->stream,filter,_gthis->chatId);
+HXLINE(1269) sync->addContext( ::Dynamic(new _hx_Closure_0(_gthis)));
+HXLINE(1274) _gthis->fetchFromSync(sync,handler);
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1261_getMessagesBefore)
+HXDLIN(1261) ::snikket::Channel _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE(1262) ::Dynamic _hx_tmp = this->persistence;
+HXDLIN(1262) ::String _hx_tmp1 = this->client->accountId();
+HXDLIN(1262) ::snikket::Persistence_obj::getMessagesBefore(_hx_tmp,_hx_tmp1,this->chatId,beforeId,beforeTime, ::Dynamic(new _hx_Closure_1(_gthis,beforeId,handler)));
+ }
+
+
+void Channel_obj::getMessagesAfter(::String afterId,::String afterTime, ::Dynamic handler){
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_1, ::snikket::Channel,_gthis,::String,afterId, ::Dynamic,handler) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> messages){
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1286_getMessagesAfter)
+HXLINE(1286) if ((messages->length > 0)) {
+HXLINE(1287) handler(messages);
+ }
+ else {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::Channel,_gthis) HXARGC(2)
+ ::snikket::ChatMessageBuilder _hx_run( ::snikket::ChatMessageBuilder builder, ::snikket::Stanza stanza){
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1292_getMessagesAfter)
+HXLINE(1293) builder = _gthis->prepareIncomingMessage(builder,stanza);
+HXLINE(1294) builder->syncPoint = false;
+HXLINE(1295) return builder;
+ }
+ HX_END_LOCAL_FUNC2(return)
+
+HXLINE(1289) ::Dynamic filter = ::Dynamic(::hx::Anon_obj::Create(0));
+HXLINE(1290) if (::hx::IsNotNull( afterId )) {
+HXLINE(1290) filter->__SetField(HX_("page",4f,da,51,4a), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("after",1c,66,a2,1d),afterId)),::hx::paccDynamic);
+ }
+HXLINE(1291) ::snikket::MessageSync sync = ::snikket::MessageSync_obj::__alloc( HX_CTX ,_gthis->client,_gthis->stream,filter,_gthis->chatId);
+HXLINE(1292) sync->addContext( ::Dynamic(new _hx_Closure_0(_gthis)));
+HXLINE(1297) _gthis->fetchFromSync(sync,handler);
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1280_getMessagesAfter)
+HXDLIN(1280) ::snikket::Channel _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE(1281) bool _hx_tmp;
+HXDLIN(1281) ::String afterId1 = afterId;
+HXDLIN(1281) if ((afterId1 == this->lastMessageId())) {
+HXLINE(1281) _hx_tmp = !(this->syncing());
+ }
+ else {
+HXLINE(1281) _hx_tmp = false;
+ }
+HXDLIN(1281) if (_hx_tmp) {
+HXLINE(1282) handler(::Array_obj< ::Dynamic>::__new(0));
+HXLINE(1283) return;
+ }
+HXLINE(1285) ::Dynamic _hx_tmp1 = this->persistence;
+HXDLIN(1285) ::String _hx_tmp2 = this->client->accountId();
+HXDLIN(1285) ::snikket::Persistence_obj::getMessagesAfter(_hx_tmp1,_hx_tmp2,this->chatId,afterId,afterTime, ::Dynamic(new _hx_Closure_1(_gthis,afterId,handler)));
+ }
+
+
+void Channel_obj::getMessagesAround(::String aroundId,::String aroundTime, ::Dynamic handler){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::Dynamic,handler) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> messages){
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1305_getMessagesAround)
+HXLINE(1305) if ((messages->length > 0)) {
+HXLINE(1306) handler(messages);
+ }
+ else {
+HXLINE(1309) handler(::Array_obj< ::Dynamic>::__new(0));
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1304_getMessagesAround)
+HXDLIN(1304) ::Dynamic _hx_tmp = this->persistence;
+HXDLIN(1304) ::String _hx_tmp1 = this->client->accountId();
+HXDLIN(1304) ::snikket::Persistence_obj::getMessagesAround(_hx_tmp,_hx_tmp1,this->chatId,aroundId,aroundTime, ::Dynamic(new _hx_Closure_0(handler)));
+ }
+
+
+ ::snikket::ChatMessageBuilder Channel_obj::prepareIncomingMessage( ::snikket::ChatMessageBuilder message, ::snikket::Stanza stanza){
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1315_prepareIncomingMessage)
+HXLINE(1316) message->syncPoint = !(this->syncing());
+HXLINE(1317) if ((message->type == 0)) {
+HXLINE(1317) message->type = 3;
+ }
+HXLINE(1318) message->senderId = ( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) );
+HXLINE(1319) ::String _hx_tmp = message->get_senderId();
+HXDLIN(1319) if ((_hx_tmp == this->getFullJid()->asString())) {
+HXLINE(1320) message->recipients = message->replyTo;
+HXLINE(1321) message->direction = 1;
+ }
+HXLINE(1323) return message;
+ }
+
+
+ ::snikket::ChatMessageBuilder Channel_obj::prepareOutgoingMessage( ::snikket::ChatMessageBuilder message){
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1326_prepareOutgoingMessage)
+HXLINE(1327) message->type = 2;
+HXLINE(1328) ::String tmp = message->timestamp;
+HXDLIN(1328) ::String _hx_tmp;
+HXDLIN(1328) if (::hx::IsNotNull( tmp )) {
+HXLINE(1328) _hx_tmp = tmp;
+ }
+ else {
+HXLINE(1328) _hx_tmp = ::snikket::Date_obj::format(::Date_obj::now());
+ }
+HXDLIN(1328) message->timestamp = _hx_tmp;
+HXLINE(1329) message->direction = 1;
+HXLINE(1330) message->from = this->client->jid;
+HXLINE(1331) message->sender = this->getFullJid();
+HXLINE(1332) message->replyTo = ::Array_obj< ::Dynamic>::__new(1)->init(0,message->sender);
+HXLINE(1333) message->to = ::snikket::JID_obj::parse(this->chatId);
+HXLINE(1334) message->recipients = ::Array_obj< ::Dynamic>::__new(1)->init(0,message->to);
+HXLINE(1335) return message;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Channel_obj,prepareOutgoingMessage,return )
+
+void Channel_obj::correctMessage(::String localId, ::snikket::ChatMessageBuilder message){
+ HX_BEGIN_LOCAL_FUNC_S4(::hx::LocalFunc,_hx_Closure_0, ::snikket::Channel,_gthis,::Array< ::Dynamic>,message1,::String,localId,::String,toSendId) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> corrected){
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1344_correctMessage)
+HXLINE(1345) ::Array< ::Dynamic> _hx_tmp;
+HXDLIN(1345) if ((corrected->__get(0).StaticCast< ::snikket::ChatMessage >()->localId == localId)) {
+HXLINE(1345) _hx_tmp = corrected->__get(0).StaticCast< ::snikket::ChatMessage >()->versions;
+ }
+ else {
+HXLINE(1345) _hx_tmp = ::Array_obj< ::Dynamic>::__new(1)->init(0,message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->build());
+ }
+HXDLIN(1345) message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->versions = _hx_tmp;
+HXLINE(1346) message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->localId = toSendId;
+HXLINE(1347) ::snikket::Client _gthis1 = _gthis->client;
+HXDLIN(1347) _gthis1->sendStanza(message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->build()->asStanza());
+HXLINE(1348) _gthis->client->notifyMessageHandlers(corrected->__get(0).StaticCast< ::snikket::ChatMessage >(),1);
+HXLINE(1349) ::snikket::ChatMessage tmp = _gthis->lastMessage;
+HXDLIN(1349) ::String _hx_tmp1;
+HXDLIN(1349) if (::hx::IsNotNull( tmp )) {
+HXLINE(1349) _hx_tmp1 = tmp->localId;
+ }
+ else {
+HXLINE(1349) _hx_tmp1 = null();
+ }
+HXDLIN(1349) if ((localId == _hx_tmp1)) {
+HXLINE(1350) _gthis->setLastMessage(corrected->__get(0).StaticCast< ::snikket::ChatMessage >());
+HXLINE(1351) _gthis->client->trigger(HX_("chats/update",3d,8e,1d,14),::cpp::VirtualArray_obj::__new(1)->init(0,_gthis));
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1339_correctMessage)
+HXDLIN(1339) ::Array< ::Dynamic> message1 = ::Array_obj< ::Dynamic>::__new(1)->init(0,message);
+HXDLIN(1339) ::snikket::Channel _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE(1340) ::String toSendId = message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->localId;
+HXLINE(1341) message1[0] = this->prepareOutgoingMessage(message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >());
+HXLINE(1342) ::snikket::ChatMessage _hx_tmp = message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->build();
+HXDLIN(1342) message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->versions = ::Array_obj< ::Dynamic>::__new(1)->init(0,_hx_tmp);
+HXLINE(1343) message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->localId = localId;
+HXLINE(1344) ::snikket::Client _hx_tmp1 = this->client;
+HXDLIN(1344) _hx_tmp1->storeMessages(::Array_obj< ::Dynamic>::__new(1)->init(0,message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->build()), ::Dynamic(new _hx_Closure_0(_gthis,message1,localId,toSendId)));
+ }
+
+
+void Channel_obj::sendMessage( ::snikket::ChatMessageBuilder message){
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1357_sendMessage)
+HXDLIN(1357) ::snikket::Channel _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE(1358) if (::hx::IsNotNull( this->typingTimer )) {
+HXLINE(1358) this->typingTimer->stop();
+ }
+HXLINE(1359) this->client->chatActivity(::hx::ObjectPtr<OBJ_>(this),null());
+HXLINE(1360) message = this->prepareOutgoingMessage(message);
+HXLINE(1361) ::snikket::Stanza stanza = message->build()->asStanza();
+HXLINE(1363) {
+HXLINE(1363) ::Dynamic this1 = stanza->attr;
+HXDLIN(1363) ::String value = this->getFullJid()->asString();
+HXDLIN(1363) ::Reflect_obj::setField(this1,HX_("from",6a,a5,c2,43),value);
+ }
+HXLINE(1364) ::snikket::MessageStanza fromStanza = ::snikket::Message_obj::fromStanza(stanza,this->client->jid,null())->parsed;
+HXLINE(1365) {
+HXLINE(1365) ::Dynamic this2 = stanza->attr;
+HXDLIN(1365) ::String value1 = this->client->jid->asString();
+HXDLIN(1365) ::Reflect_obj::setField(this2,HX_("from",6a,a5,c2,43),value1);
+ }
+HXLINE(1366) switch((int)(fromStanza->_hx_getIndex())){
+ case (int)1: {
+HXLINE(1367) ::snikket::ChatMessage _g = fromStanza->_hx_getObject(0).StaticCast< ::snikket::ChatMessage >();
+HXDLIN(1367) {
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0, ::snikket::Channel,_gthis, ::snikket::Stanza,stanza) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> stored){
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1373_sendMessage)
+HXLINE(1374) _gthis->client->sendStanza(stanza);
+HXLINE(1375) _gthis->setLastMessage(stored->__get(0).StaticCast< ::snikket::ChatMessage >());
+HXLINE(1376) int _hx_tmp;
+HXDLIN(1376) if ((stored->__get(0).StaticCast< ::snikket::ChatMessage >()->versions->length > 1)) {
+HXLINE(1376) _hx_tmp = 1;
+ }
+ else {
+HXLINE(1376) _hx_tmp = 0;
+ }
+HXDLIN(1376) _gthis->client->notifyMessageHandlers(stored->__get(0).StaticCast< ::snikket::ChatMessage >(),_hx_tmp);
+HXLINE(1377) _gthis->client->trigger(HX_("chats/update",3d,8e,1d,14),::cpp::VirtualArray_obj::__new(1)->init(0,_gthis));
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE(1368) if (::hx::IsNotNull( this->isActive )) {
+HXLINE(1369) this->isActive = true;
+HXLINE(1370) this->activeThread = message->threadId;
+HXLINE(1371) stanza->tag(HX_("active",c6,41,46,16), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("http://jabber.org/protocol/chatstates",8e,6d,41,6d))))->up();
+ }
+HXLINE(1373) ::snikket::Client _hx_tmp = this->client;
+HXDLIN(1373) _hx_tmp->storeMessages(::Array_obj< ::Dynamic>::__new(1)->init(0,message->build()), ::Dynamic(new _hx_Closure_0(_gthis,stanza)));
+ }
+ }
+ break;
+ case (int)3: {
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_1, ::snikket::Channel,_gthis, ::snikket::Stanza,stanza) HXARGC(1)
+ void _hx_run( ::snikket::ChatMessage stored){
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1380_sendMessage)
+HXLINE(1381) _gthis->client->sendStanza(stanza);
+HXLINE(1382) if (::hx::IsNotNull( stored )) {
+HXLINE(1382) _gthis->client->notifyMessageHandlers(stored,2);
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE(1379) ::snikket::ReactionUpdate update = fromStanza->_hx_getObject(0).StaticCast< ::snikket::ReactionUpdate >();
+HXLINE(1380) ::Dynamic _hx_tmp1 = this->persistence;
+HXDLIN(1380) ::snikket::Persistence_obj::storeReaction(_hx_tmp1,this->client->accountId(),update, ::Dynamic(new _hx_Closure_1(_gthis,stanza)));
+ }
+ break;
+ default:{
+HXLINE(1385) ::haxe::Log_obj::trace(HX_("Invalid message",7e,ab,89,95), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.Channel",b2,3f,68,db))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,fromStanza))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("sendMessage",5f,89,1d,24))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/Chat.hx",f4,6b,61,18))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),1385)));
+HXLINE(1386) HX_STACK_DO_THROW(HX_("Trying to send invalid message.",dc,74,a0,91));
+ }
+ }
+ }
+
+
+void Channel_obj::removeReaction( ::snikket::ChatMessage m, ::snikket::Reaction reaction){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_1, ::snikket::Channel,_gthis, ::snikket::ReactionUpdate,update4) HXARGC(1)
+ void _hx_run( ::snikket::ChatMessage stored){
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1411_removeReaction)
+HXLINE(1412) ::snikket::Stanza stanza = update4->asStanza();
+HXLINE(1413) {
+HXLINE(1413) ::String value = _gthis->chatId;
+HXDLIN(1413) ::Reflect_obj::setField(stanza->attr,HX_("to",7b,65,00,00),value);
+ }
+HXLINE(1414) _gthis->client->sendStanza(stanza);
+HXLINE(1415) if (::hx::IsNotNull( stored )) {
+HXLINE(1415) _gthis->client->notifyMessageHandlers(stored,2);
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1391_removeReaction)
+HXDLIN(1391) ::snikket::Channel _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE(1392) if (::Std_obj::isOfType(reaction,::hx::ClassOf< ::snikket::CustomEmojiReaction >())) {
+HXLINE(1393) if (::hx::IsNull( reaction->envelopeId )) {
+HXLINE(1393) HX_STACK_DO_THROW(HX_("Cannot remove custom emoji reaction without envelopeId",90,e6,80,fb));
+ }
+HXLINE(1394) ::snikket::ChatMessageBuilder correct = m->reply();
+HXLINE(1395) correct->localId = ::snikket::ID_obj::_hx_long();
+HXLINE(1396) correct->setHtml(HX_("",00,00,00,00));
+HXLINE(1397) correct->text = null();
+HXLINE(1398) this->correctMessage(reaction->envelopeId,correct);
+HXLINE(1399) return;
+ }
+HXLINE(1403) ::Array< ::Dynamic> reactions = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE(1404) {
+HXLINE(1404) ::Dynamic map = m->reactions;
+HXDLIN(1404) ::Dynamic _g_map = map;
+HXDLIN(1404) ::Dynamic _g_keys = ::haxe::IMap_obj::keys(map);
+HXDLIN(1404) while(( (bool)(_g_keys->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE(1404) ::String key = ( (::String)(_g_keys->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXDLIN(1404) ::Array< ::Dynamic> _g_value = ( (::Array< ::Dynamic>)(::haxe::IMap_obj::get(_g_map,key)) );
+HXDLIN(1404) ::String _g_key = key;
+HXDLIN(1404) ::String areaction = _g_key;
+HXDLIN(1404) ::Array< ::Dynamic> reacts = _g_value;
+HXLINE(1405) if ((areaction != reaction->key)) {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::Channel,_gthis) HXARGC(1)
+ bool _hx_run( ::snikket::Reaction r){
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1406_removeReaction)
+HXLINE(1406) ::String r1 = r->senderId;
+HXDLIN(1406) return (r1 == _gthis->getFullJid()->asString());
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE(1406) ::snikket::Reaction react = ( ( ::snikket::Reaction)(::Lambda_obj::find(reacts, ::Dynamic(new _hx_Closure_0(_gthis)))) );
+HXLINE(1407) bool _hx_tmp;
+HXDLIN(1407) if (::hx::IsNotNull( react )) {
+HXLINE(1407) _hx_tmp = !(::Std_obj::isOfType(react,::hx::ClassOf< ::snikket::CustomEmojiReaction >()));
+ }
+ else {
+HXLINE(1407) _hx_tmp = false;
+ }
+HXDLIN(1407) if (_hx_tmp) {
+HXLINE(1407) reactions->push(react);
+ }
+ }
+ }
+ }
+HXLINE(1410) ::String update = ::snikket::ID_obj::_hx_long();
+HXDLIN(1410) ::String m1 = m->serverId;
+HXDLIN(1410) ::String update1 = m->chatId();
+HXDLIN(1410) ::String update2 = m->chatId();
+HXDLIN(1410) ::String update3 = this->getFullJid()->asString();
+HXDLIN(1410) ::snikket::ReactionUpdate update4 = ::snikket::ReactionUpdate_obj::__alloc( HX_CTX ,update,m1,update1,null(),update2,update3,::snikket::Date_obj::format(::Date_obj::now()),reactions,0);
+HXLINE(1411) ::Dynamic _hx_tmp1 = this->persistence;
+HXDLIN(1411) ::String _hx_tmp2 = this->client->accountId();
+HXDLIN(1411) ::snikket::Persistence_obj::storeReaction(_hx_tmp1,_hx_tmp2,update4, ::Dynamic(new _hx_Closure_1(_gthis,update4)));
+ }
+
+
+::String Channel_obj::lastMessageId(){
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1421_lastMessageId)
+HXDLIN(1421) ::snikket::ChatMessage tmp = this->lastMessage;
+HXDLIN(1421) if (::hx::IsNotNull( tmp )) {
+HXDLIN(1421) return tmp->serverId;
+ }
+ else {
+HXDLIN(1421) return null();
+ }
+HXDLIN(1421) return null();
+ }
+
+
+void Channel_obj::markReadUpTo( ::snikket::ChatMessage message){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0, ::snikket::ChatMessage,message, ::snikket::Channel,_gthis) HXARGC(0)
+ void _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1426_markReadUpTo)
+HXLINE(1427) ::String _gthis1 = _gthis->chatId;
+HXDLIN(1427) ::String stanza = ::snikket::ID_obj::_hx_long();
+HXDLIN(1427) ::snikket::Stanza stanza1 = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("message",c7,35,11,9a), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("id",db,5b,00,00),stanza)
+ ->setFixed(1,HX_("to",7b,65,00,00),_gthis1)
+ ->setFixed(2,HX_("type",ba,f2,08,4d),HX_("groupchat",97,1d,c8,e5))))->tag(HX_("displayed",21,17,db,c1), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("id",db,5b,00,00),message->serverId)
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:chat-markers:0",96,b8,66,e7))))->up();
+HXLINE(1429) if (::hx::IsNotNull( message->threadId )) {
+HXLINE(1430) stanza1->textTag(HX_("thread",ca,7a,b9,8e),message->threadId,null());
+ }
+HXLINE(1432) _gthis->client->sendStanza(stanza1);
+HXLINE(1434) _gthis->publishMds();
+HXLINE(1435) _gthis->client->trigger(HX_("chats/update",3d,8e,1d,14),::cpp::VirtualArray_obj::__new(1)->init(0,_gthis));
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1425_markReadUpTo)
+HXDLIN(1425) ::snikket::Channel _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE(1426) this->markReadUpToMessage(message, ::Dynamic(new _hx_Closure_0(message,_gthis)));
+ }
+
+
+void Channel_obj::bookmark(){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_1, ::snikket::Channel,_gthis) HXARGC(1)
+ void _hx_run( ::snikket::Stanza response){
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1461_bookmark)
+HXLINE(1461) if ((( (::String)(::Reflect_obj::field(response->attr,HX_("type",ba,f2,08,4d))) ) == HX_("error",c8,cb,29,73))) {
+HXLINE(1462) ::snikket::Stanza tmp = response->getChild(HX_("error",c8,cb,29,73),null());
+HXDLIN(1462) ::snikket::Stanza preconditionError;
+HXDLIN(1462) if (::hx::IsNotNull( tmp )) {
+HXLINE(1462) preconditionError = tmp->getChild(HX_("precondition-not-met",2d,db,78,db),HX_("http://jabber.org/protocol/pubsub#errors",97,74,3a,a8));
+ }
+ else {
+HXLINE(1462) preconditionError = null();
+ }
+HXLINE(1463) if (::hx::IsNotNull( preconditionError )) {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::Channel,_gthis) HXARGC(1)
+ void _hx_run( ::snikket::Stanza response){
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1479_bookmark)
+HXLINE(1479) if ((( (::String)(::Reflect_obj::field(response->attr,HX_("type",ba,f2,08,4d))) ) == HX_("result",dd,68,84,08))) {
+HXLINE(1480) _gthis->bookmark();
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE(1465) ::snikket::GenericStream _gthis1 = _gthis->stream;
+HXDLIN(1465) _gthis1->sendIq( ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("iq",e8,5b,00,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("type",ba,f2,08,4d),HX_("set",a2,9b,57,00))))->tag(HX_("pubsub",e3,da,f8,66), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("http://jabber.org/protocol/pubsub#owner",c7,28,a3,08))))->tag(HX_("configure",e6,f9,5b,c0), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("node",02,0a,0a,49),HX_("urn:xmpp:bookmarks:1",58,3c,53,7d))))->tag(HX_("x",78,00,00,00), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("type",ba,f2,08,4d),HX_("submit",18,58,06,9a))
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("jabber:x:data",c2,e1,e9,7c))))->tag(HX_("field",ba,94,93,00), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("var",e7,de,59,00),HX_("FORM_TYPE",d5,96,c9,5a))
+ ->setFixed(1,HX_("type",ba,f2,08,4d),HX_("hidden",6a,ff,95,4c))))->textTag(HX_("value",71,7f,b8,31),HX_("http://jabber.org/protocol/pubsub#publish-options",f4,9c,72,50),null())->up()->tag(HX_("field",ba,94,93,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("var",e7,de,59,00),HX_("pubsub#persist_items",75,44,6b,ad))))->textTag(HX_("value",71,7f,b8,31),HX_("true",4e,a7,03,4d),null())->up()->tag(HX_("field",ba,94,93,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("var",e7,de,59,00),HX_("pubsub#max_items",05,69,9f,7c))))->textTag(HX_("value",71,7f,b8,31),HX_("max",a4,0a,53,00),null())->up()->tag(HX_("field",ba,94,93,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("var",e7,de,59,00),HX_("pubsub#send_last_published_item",b6,21,d2,0a))))->textTag(HX_("value",71,7f,b8,31),HX_("never",8c,3e,30,99),null())->up()->tag(HX_("field",ba,94,93,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("var",e7,de,59,00),HX_("pubsub#access_model",6e,cf,ac,1d))))->textTag(HX_("value",71,7f,b8,31),HX_("whitelist",87,6f,95,29),null())->up()->tag(HX_("field",ba,94,93,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("var",e7,de,59,00),HX_("pubsub#notify_delete",41,3a,35,54))))->textTag(HX_("value",71,7f,b8,31),HX_("true",4e,a7,03,4d),null())->up()->tag(HX_("field",ba,94,93,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("var",e7,de,59,00),HX_("pubsub#notify_retract",2b,3b,48,44))))->textTag(HX_("value",71,7f,b8,31),HX_("true",4e,a7,03,4d),null())->up()->up()->up()->up(), ::Dynamic(new _hx_Closure_0(_gthis)));
+ }
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1440_bookmark)
+HXDLIN(1440) ::snikket::Channel _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE(1441) ::snikket::GenericStream _hx_tmp = this->stream;
+HXLINE(1442) ::snikket::Stanza _hx_tmp1 = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("iq",e8,5b,00,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("type",ba,f2,08,4d),HX_("set",a2,9b,57,00))))->tag(HX_("pubsub",e3,da,f8,66), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("http://jabber.org/protocol/pubsub",57,94,3c,f2))))->tag(HX_("publish",8f,21,1d,ae), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("node",02,0a,0a,49),HX_("urn:xmpp:bookmarks:1",58,3c,53,7d))))->tag(HX_("item",13,c5,bf,45), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("id",db,5b,00,00),this->chatId)));
+HXLINE(1446) ::String _hx_tmp2 = this->getDisplayName();
+HXDLIN(1446) ::String _hx_tmp3;
+HXDLIN(1446) if ((this->uiState == 2)) {
+HXLINE(1446) _hx_tmp3 = HX_("false",a3,35,4f,fb);
+ }
+ else {
+HXLINE(1446) _hx_tmp3 = HX_("true",4e,a7,03,4d);
+ }
+HXLINE(1442) ::snikket::Stanza _hx_tmp4 = _hx_tmp1->tag(HX_("conference",1c,2b,83,41), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("autojoin",d9,f6,b1,3e),_hx_tmp3)
+ ->setFixed(1,HX_("name",4b,72,ff,48),_hx_tmp2)
+ ->setFixed(2,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:bookmarks:1",58,3c,53,7d))));
+HXLINE(1447) ::String _hx_tmp5 = this->client->displayName();
+HXLINE(1441) _hx_tmp->sendIq(_hx_tmp4->textTag(HX_("nick",a3,7b,05,49),_hx_tmp5,null())->addChild(this->extensions)->up()->up()->tag(HX_("publish-options",60,0b,5c,74),null())->tag(HX_("x",78,00,00,00), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("type",ba,f2,08,4d),HX_("submit",18,58,06,9a))
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("jabber:x:data",c2,e1,e9,7c))))->tag(HX_("field",ba,94,93,00), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("var",e7,de,59,00),HX_("FORM_TYPE",d5,96,c9,5a))
+ ->setFixed(1,HX_("type",ba,f2,08,4d),HX_("hidden",6a,ff,95,4c))))->textTag(HX_("value",71,7f,b8,31),HX_("http://jabber.org/protocol/pubsub#publish-options",f4,9c,72,50),null())->up()->tag(HX_("field",ba,94,93,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("var",e7,de,59,00),HX_("pubsub#persist_items",75,44,6b,ad))))->textTag(HX_("value",71,7f,b8,31),HX_("true",4e,a7,03,4d),null())->up()->tag(HX_("field",ba,94,93,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("var",e7,de,59,00),HX_("pubsub#max_items",05,69,9f,7c))))->textTag(HX_("value",71,7f,b8,31),HX_("max",a4,0a,53,00),null())->up()->tag(HX_("field",ba,94,93,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("var",e7,de,59,00),HX_("pubsub#send_last_published_item",b6,21,d2,0a))))->textTag(HX_("value",71,7f,b8,31),HX_("never",8c,3e,30,99),null())->up()->tag(HX_("field",ba,94,93,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("var",e7,de,59,00),HX_("pubsub#access_model",6e,cf,ac,1d))))->textTag(HX_("value",71,7f,b8,31),HX_("whitelist",87,6f,95,29),null())->up()->tag(HX_("field",ba,94,93,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("var",e7,de,59,00),HX_("pubsub#notify_delete",41,3a,35,54))))->textTag(HX_("value",71,7f,b8,31),HX_("true",4e,a7,03,4d),null())->up()->tag(HX_("field",ba,94,93,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("var",e7,de,59,00),HX_("pubsub#notify_retract",2b,3b,48,44))))->textTag(HX_("value",71,7f,b8,31),HX_("true",4e,a7,03,4d),null())->up()->up()->up()->up()->up(), ::Dynamic(new _hx_Closure_1(_gthis)));
+ }
+
+
+void Channel_obj::sendChatState(::String state,::String threadId){
+ HX_GC_STACKFRAME(&_hx_pos_5e4df8d46126c981_1490_sendChatState)
+HXLINE(1492) ::String stanza = ::snikket::ID_obj::_hx_long();
+HXLINE(1494) ::String stanza1 = this->client->jid->asString();
+HXLINE(1491) ::snikket::Stanza stanza2 = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("message",c7,35,11,9a), ::Dynamic(::hx::Anon_obj::Create(4)
+ ->setFixed(0,HX_("id",db,5b,00,00),stanza)
+ ->setFixed(1,HX_("to",7b,65,00,00),this->chatId)
+ ->setFixed(2,HX_("from",6a,a5,c2,43),stanza1)
+ ->setFixed(3,HX_("type",ba,f2,08,4d),HX_("groupchat",97,1d,c8,e5))))->tag(state, ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("http://jabber.org/protocol/chatstates",8e,6d,41,6d))))->up();
+HXLINE(1499) if (::hx::IsNotNull( threadId )) {
+HXLINE(1500) stanza2->textTag(HX_("thread",ca,7a,b9,8e),threadId,null());
+ }
+HXLINE(1502) this->stream->sendStanza(stanza2);
+ }
+
+
+void Channel_obj::close(){
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_1506_close)
+HXLINE(1507) if (::hx::IsNotNull( this->typingTimer )) {
+HXLINE(1507) this->typingTimer->stop();
+ }
+HXLINE(1508) this->uiState = 2;
+HXLINE(1509) ::Dynamic _hx_tmp = this->persistence;
+HXDLIN(1509) ::snikket::Persistence_obj::storeChats(_hx_tmp,this->client->accountId(),::Array_obj< ::Dynamic>::__new(1)->init(0,::hx::ObjectPtr<OBJ_>(this)));
+HXLINE(1510) this->selfPing(false);
+HXLINE(1511) this->bookmark();
+HXLINE(1512) this->sendChatState(HX_("gone",5f,94,69,44),null());
+HXLINE(1513) this->client->trigger(HX_("chats/update",3d,8e,1d,14),::cpp::VirtualArray_obj::__new(1)->init(0,::hx::ObjectPtr<OBJ_>(this)));
+ }
+
+
+
+::hx::ObjectPtr< Channel_obj > Channel_obj::__new( ::snikket::Client client, ::snikket::GenericStream stream,::Dynamic persistence,::String chatId,::hx::Null< int > __o_uiState,::hx::Null< bool > __o_isBlocked, ::snikket::Stanza extensions,::String readUpToId,::String readUpToBy, ::snikket::Caps disco) {
+ ::hx::ObjectPtr< Channel_obj > __this = new Channel_obj();
+ __this->__construct(client,stream,persistence,chatId,__o_uiState,__o_isBlocked,extensions,readUpToId,readUpToBy,disco);
+ return __this;
+}
+
+::hx::ObjectPtr< Channel_obj > Channel_obj::__alloc(::hx::Ctx *_hx_ctx, ::snikket::Client client, ::snikket::GenericStream stream,::Dynamic persistence,::String chatId,::hx::Null< int > __o_uiState,::hx::Null< bool > __o_isBlocked, ::snikket::Stanza extensions,::String readUpToId,::String readUpToBy, ::snikket::Caps disco) {
+ Channel_obj *__this = (Channel_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Channel_obj), true, "snikket.Channel"));
+ *(void **)__this = Channel_obj::_hx_vtable;
+ __this->__construct(client,stream,persistence,chatId,__o_uiState,__o_isBlocked,extensions,readUpToId,readUpToBy,disco);
+ return __this;
+}
+
+Channel_obj::Channel_obj()
+{
+}
+
+void Channel_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(Channel);
+ HX_MARK_MEMBER_NAME(disco,"disco");
+ HX_MARK_MEMBER_NAME(inSync,"inSync");
+ HX_MARK_MEMBER_NAME(sync,"sync");
+ HX_MARK_MEMBER_NAME(forceLive,"forceLive");
+ HX_MARK_MEMBER_NAME(_nickInUse,"_nickInUse");
+ ::snikket::Chat_obj::__Mark(HX_MARK_ARG);
+ HX_MARK_END_CLASS();
+}
+
+void Channel_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(disco,"disco");
+ HX_VISIT_MEMBER_NAME(inSync,"inSync");
+ HX_VISIT_MEMBER_NAME(sync,"sync");
+ HX_VISIT_MEMBER_NAME(forceLive,"forceLive");
+ HX_VISIT_MEMBER_NAME(_nickInUse,"_nickInUse");
+ ::snikket::Chat_obj::__Visit(HX_VISIT_ARG);
+}
+
+::hx::Val Channel_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"sync") ) { return ::hx::Val( sync ); }
+ if (HX_FIELD_EQ(inName,"join") ) { return ::hx::Val( join_dyn() ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"disco") ) { return ::hx::Val( disco ); }
+ if (HX_FIELD_EQ(inName,"close") ) { return ::hx::Val( close_dyn() ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"inSync") ) { return ::hx::Val( inSync ); }
+ if (HX_FIELD_EQ(inName,"doSync") ) { return ::hx::Val( doSync_dyn() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"preview") ) { return ::hx::Val( preview_dyn() ); }
+ if (HX_FIELD_EQ(inName,"syncing") ) { return ::hx::Val( syncing_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"selfPing") ) { return ::hx::Val( selfPing_dyn() ); }
+ if (HX_FIELD_EQ(inName,"bookmark") ) { return ::hx::Val( bookmark_dyn() ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"forceLive") ) { return ::hx::Val( forceLive ); }
+ if (HX_FIELD_EQ(inName,"isTrusted") ) { return ::hx::Val( isTrusted_dyn() ); }
+ if (HX_FIELD_EQ(inName,"isPrivate") ) { return ::hx::Val( isPrivate_dyn() ); }
+ if (HX_FIELD_EQ(inName,"nickInUse") ) { return ::hx::Val( nickInUse_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"_nickInUse") ) { return ::hx::Val( _nickInUse ); }
+ if (HX_FIELD_EQ(inName,"getFullJid") ) { return ::hx::Val( getFullJid_dyn() ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"setPresence") ) { return ::hx::Val( setPresence_dyn() ); }
+ if (HX_FIELD_EQ(inName,"sendMessage") ) { return ::hx::Val( sendMessage_dyn() ); }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"refreshDisco") ) { return ::hx::Val( refreshDisco_dyn() ); }
+ if (HX_FIELD_EQ(inName,"livePresence") ) { return ::hx::Val( livePresence_dyn() ); }
+ if (HX_FIELD_EQ(inName,"canAudioCall") ) { return ::hx::Val( canAudioCall_dyn() ); }
+ if (HX_FIELD_EQ(inName,"canVideoCall") ) { return ::hx::Val( canVideoCall_dyn() ); }
+ if (HX_FIELD_EQ(inName,"markReadUpTo") ) { return ::hx::Val( markReadUpTo_dyn() ); }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"lastMessageId") ) { return ::hx::Val( lastMessageId_dyn() ); }
+ if (HX_FIELD_EQ(inName,"sendChatState") ) { return ::hx::Val( sendChatState_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"correctMessage") ) { return ::hx::Val( correctMessage_dyn() ); }
+ if (HX_FIELD_EQ(inName,"removeReaction") ) { return ::hx::Val( removeReaction_dyn() ); }
+ break;
+ case 15:
+ if (HX_FIELD_EQ(inName,"selfPingSuccess") ) { return ::hx::Val( selfPingSuccess_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getParticipants") ) { return ::hx::Val( getParticipants_dyn() ); }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"getMessagesAfter") ) { return ::hx::Val( getMessagesAfter_dyn() ); }
+ break;
+ case 17:
+ if (HX_FIELD_EQ(inName,"getMessagesBefore") ) { return ::hx::Val( getMessagesBefore_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getMessagesAround") ) { return ::hx::Val( getMessagesAround_dyn() ); }
+ break;
+ case 21:
+ if (HX_FIELD_EQ(inName,"getParticipantDetails") ) { return ::hx::Val( getParticipantDetails_dyn() ); }
+ break;
+ case 22:
+ if (HX_FIELD_EQ(inName,"prepareIncomingMessage") ) { return ::hx::Val( prepareIncomingMessage_dyn() ); }
+ if (HX_FIELD_EQ(inName,"prepareOutgoingMessage") ) { return ::hx::Val( prepareOutgoingMessage_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val Channel_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"sync") ) { sync=inValue.Cast< ::snikket::MessageSync >(); return inValue; }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"disco") ) { disco=inValue.Cast< ::snikket::Caps >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"inSync") ) { inSync=inValue.Cast< bool >(); return inValue; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"forceLive") ) { forceLive=inValue.Cast< bool >(); return inValue; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"_nickInUse") ) { _nickInUse=inValue.Cast< ::String >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void Channel_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("disco",7a,03,d1,d9));
+ outFields->push(HX_("inSync",e0,98,c5,88));
+ outFields->push(HX_("sync",5b,ba,5f,4c));
+ outFields->push(HX_("forceLive",77,ce,f7,4c));
+ outFields->push(HX_("_nickInUse",80,a6,41,a3));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Channel_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::snikket::Caps */ ,(int)offsetof(Channel_obj,disco),HX_("disco",7a,03,d1,d9)},
+ {::hx::fsBool,(int)offsetof(Channel_obj,inSync),HX_("inSync",e0,98,c5,88)},
+ {::hx::fsObject /* ::snikket::MessageSync */ ,(int)offsetof(Channel_obj,sync),HX_("sync",5b,ba,5f,4c)},
+ {::hx::fsBool,(int)offsetof(Channel_obj,forceLive),HX_("forceLive",77,ce,f7,4c)},
+ {::hx::fsString,(int)offsetof(Channel_obj,_nickInUse),HX_("_nickInUse",80,a6,41,a3)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *Channel_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Channel_obj_sMemberFields[] = {
+ HX_("disco",7a,03,d1,d9),
+ HX_("inSync",e0,98,c5,88),
+ HX_("sync",5b,ba,5f,4c),
+ HX_("forceLive",77,ce,f7,4c),
+ HX_("_nickInUse",80,a6,41,a3),
+ HX_("selfPing",1e,60,3c,38),
+ HX_("join",ea,33,65,46),
+ HX_("selfPingSuccess",45,4d,98,ab),
+ HX_("setPresence",fd,1b,38,97),
+ HX_("doSync",86,5f,63,1c),
+ HX_("isTrusted",2d,35,a5,1a),
+ HX_("isPrivate",39,aa,6d,8d),
+ HX_("refreshDisco",9f,ff,52,ed),
+ HX_("preview",08,e0,da,3b),
+ HX_("livePresence",47,f9,16,b4),
+ HX_("syncing",67,fd,26,a7),
+ HX_("canAudioCall",64,4a,90,e4),
+ HX_("canVideoCall",89,1c,93,ea),
+ HX_("nickInUse",bf,2a,9f,47),
+ HX_("getFullJid",80,42,92,1f),
+ HX_("getParticipants",16,0b,c7,34),
+ HX_("getParticipantDetails",85,2b,7d,4d),
+ HX_("getMessagesBefore",a1,f1,44,11),
+ HX_("getMessagesAfter",3a,43,91,57),
+ HX_("getMessagesAround",6f,95,16,2d),
+ HX_("prepareIncomingMessage",ba,eb,c6,e3),
+ HX_("prepareOutgoingMessage",f4,b0,f3,49),
+ HX_("correctMessage",7d,36,c3,f4),
+ HX_("sendMessage",5f,89,1d,24),
+ HX_("removeReaction",0d,24,0b,c1),
+ HX_("lastMessageId",4c,90,58,27),
+ HX_("markReadUpTo",59,68,2d,ee),
+ HX_("bookmark",b6,8c,f1,32),
+ HX_("sendChatState",b1,21,95,6e),
+ HX_("close",b8,17,63,48),
+ ::String(null()) };
+
+::hx::Class Channel_obj::__mClass;
+
+void Channel_obj::__register()
+{
+ Channel_obj _hx_dummy;
+ Channel_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.Channel",b2,3f,68,db);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Channel_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Channel_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Channel_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Channel_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void Channel_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_5e4df8d46126c981_975_boot)
+HXDLIN( 975) __mClass->__meta__ = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("fields",79,8e,8e,80), ::Dynamic(::hx::Anon_obj::Create(19)
+ ->setFixed(0,HX_("setPresence",fd,1b,38,97), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(1,HX_("syncing",67,fd,26,a7), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(2,HX_("livePresence",47,f9,16,b4), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(3,HX_("removeReaction",0d,24,0b,c1), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(4,HX_("canAudioCall",64,4a,90,e4), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(5,HX_("canVideoCall",89,1c,93,ea), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(6,HX_("markReadUpTo",59,68,2d,ee), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(7,HX_("correctMessage",7d,36,c3,f4), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(8,HX_("getMessagesBefore",a1,f1,44,11), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(9,HX_("isTrusted",2d,35,a5,1a), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(10,HX_("sendMessage",5f,89,1d,24), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(11,HX_("lastMessageId",4c,90,58,27), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(12,HX_("getMessagesAround",6f,95,16,2d), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(13,HX_("bookmark",b6,8c,f1,32), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(14,HX_("getParticipants",16,0b,c7,34), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(15,HX_("preview",08,e0,da,3b), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(16,HX_("close",b8,17,63,48), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(17,HX_("getParticipantDetails",85,2b,7d,4d), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(18,HX_("getMessagesAfter",3a,43,91,57), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null()))))));
+ }
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/Chat.cpp b/Sources/c_snikket/src/snikket/Chat.cpp
new file mode 100644
index 0000000..a916fbb
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/Chat.cpp
@@ -0,0 +1,2205 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_StringTools
+#include <StringTools.h>
+#endif
+#ifndef INCLUDED__HaxeCBridge_Internal
+#include <_HaxeCBridge/Internal.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_Timer
+#include <haxe/Timer.h>
+#endif
+#ifndef INCLUDED_haxe_ds_IntMap
+#include <haxe/ds/IntMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_StringMap
+#include <haxe/ds/StringMap.h>
+#endif
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+#ifndef INCLUDED_haxe_iterators_MapKeyValueIterator
+#include <haxe/iterators/MapKeyValueIterator.h>
+#endif
+#ifndef INCLUDED_snikket_Caps
+#include <snikket/Caps.h>
+#endif
+#ifndef INCLUDED_snikket_Chat
+#include <snikket/Chat.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessage
+#include <snikket/ChatMessage.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessageBuilder
+#include <snikket/ChatMessageBuilder.h>
+#endif
+#ifndef INCLUDED_snikket_Client
+#include <snikket/Client.h>
+#endif
+#ifndef INCLUDED_snikket_Color
+#include <snikket/Color.h>
+#endif
+#ifndef INCLUDED_snikket_EventEmitter
+#include <snikket/EventEmitter.h>
+#endif
+#ifndef INCLUDED_snikket_EventResult
+#include <snikket/EventResult.h>
+#endif
+#ifndef INCLUDED_snikket_GenericStream
+#include <snikket/GenericStream.h>
+#endif
+#ifndef INCLUDED_snikket_Hash
+#include <snikket/Hash.h>
+#endif
+#ifndef INCLUDED_snikket_ID
+#include <snikket/ID.h>
+#endif
+#ifndef INCLUDED_snikket_Identity
+#include <snikket/Identity.h>
+#endif
+#ifndef INCLUDED_snikket_JID
+#include <snikket/JID.h>
+#endif
+#ifndef INCLUDED_snikket_MessageStanza
+#include <snikket/MessageStanza.h>
+#endif
+#ifndef INCLUDED_snikket_MessageSync
+#include <snikket/MessageSync.h>
+#endif
+#ifndef INCLUDED_snikket_ModerationAction
+#include <snikket/ModerationAction.h>
+#endif
+#ifndef INCLUDED_snikket_Participant
+#include <snikket/Participant.h>
+#endif
+#ifndef INCLUDED_snikket_Persistence
+#include <snikket/Persistence.h>
+#endif
+#ifndef INCLUDED_snikket_Presence
+#include <snikket/Presence.h>
+#endif
+#ifndef INCLUDED_snikket_Reaction
+#include <snikket/Reaction.h>
+#endif
+#ifndef INCLUDED_snikket_ReactionUpdate
+#include <snikket/ReactionUpdate.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket__Util_Util_Fields_
+#include <snikket/_Util/Util_Fields_.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_DTMFSender
+#include <snikket/jingle/DTMFSender.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_MediaStream
+#include <snikket/jingle/MediaStream.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_MediaStreamTrack
+#include <snikket/jingle/MediaStreamTrack.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_OutgoingProposedSession
+#include <snikket/jingle/OutgoingProposedSession.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_Session
+#include <snikket/jingle/Session.h>
+#endif
+#ifndef INCLUDED_thenshim_Thenable
+#include <thenshim/Thenable.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_43_new,"snikket.Chat","new",0x69f01dfb,"snikket.Chat.new","snikket/Chat.hx",43,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_12e7dd114cfbd541_271_chatId__fromC,"snikket.Chat","chatId__fromC",0x863b7961,"snikket.Chat.chatId__fromC","HaxeCBridge.hx",271,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_12e7dd114cfbd541_271_uiState__fromC,"snikket.Chat","uiState__fromC",0x25366141,"snikket.Chat.uiState__fromC","HaxeCBridge.hx",271,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_12e7dd114cfbd541_271_isBlocked__fromC,"snikket.Chat","isBlocked__fromC",0xbc9aae1c,"snikket.Chat.isBlocked__fromC","HaxeCBridge.hx",271,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_12e7dd114cfbd541_221_getMessagesBefore__fromC,"snikket.Chat","getMessagesBefore__fromC",0x76faff7d,"snikket.Chat.getMessagesBefore__fromC","HaxeCBridge.hx",221,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_12e7dd114cfbd541_244_getMessagesBefore__fromC,"snikket.Chat","getMessagesBefore__fromC",0x76faff7d,"snikket.Chat.getMessagesBefore__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_12e7dd114cfbd541_221_getMessagesAfter__fromC,"snikket.Chat","getMessagesAfter__fromC",0xc6ff459a,"snikket.Chat.getMessagesAfter__fromC","HaxeCBridge.hx",221,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_12e7dd114cfbd541_244_getMessagesAfter__fromC,"snikket.Chat","getMessagesAfter__fromC",0xc6ff459a,"snikket.Chat.getMessagesAfter__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_12e7dd114cfbd541_221_getMessagesAround__fromC,"snikket.Chat","getMessagesAround__fromC",0x0c8b916f,"snikket.Chat.getMessagesAround__fromC","HaxeCBridge.hx",221,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_12e7dd114cfbd541_244_getMessagesAround__fromC,"snikket.Chat","getMessagesAround__fromC",0x0c8b916f,"snikket.Chat.getMessagesAround__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_143_fetchFromSync,"snikket.Chat","fetchFromSync",0xa446a09a,"snikket.Chat.fetchFromSync","snikket/Chat.hx",143,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_128_fetchFromSync,"snikket.Chat","fetchFromSync",0xa446a09a,"snikket.Chat.fetchFromSync","snikket/Chat.hx",128,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_135_fetchFromSync,"snikket.Chat","fetchFromSync",0xa446a09a,"snikket.Chat.fetchFromSync","snikket/Chat.hx",135,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_127_fetchFromSync,"snikket.Chat","fetchFromSync",0xa446a09a,"snikket.Chat.fetchFromSync","snikket/Chat.hx",127,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_12e7dd114cfbd541_244_sendMessage__fromC,"snikket.Chat","sendMessage__fromC",0xcfa599bf,"snikket.Chat.sendMessage__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_12e7dd114cfbd541_244_markReadUpTo__fromC,"snikket.Chat","markReadUpTo__fromC",0xb4ac28db,"snikket.Chat.markReadUpTo__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_12e7dd114cfbd541_244_bookmark__fromC,"snikket.Chat","bookmark__fromC",0xb349509e,"snikket.Chat.bookmark__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_12e7dd114cfbd541_242_getParticipants__fromC,"snikket.Chat","getParticipants__fromC",0x549a1368,"snikket.Chat.getParticipants__fromC","HaxeCBridge.hx",242,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_12e7dd114cfbd541_244_getParticipantDetails__fromC,"snikket.Chat","getParticipantDetails__fromC",0x3039b099,"snikket.Chat.getParticipantDetails__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_12e7dd114cfbd541_244_correctMessage__fromC,"snikket.Chat","correctMessage__fromC",0x7adc83f7,"snikket.Chat.correctMessage__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_203_addReaction,"snikket.Chat","addReaction",0xe26cff85,"snikket.Chat.addReaction","snikket/Chat.hx",203,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_206_addReaction,"snikket.Chat","addReaction",0xe26cff85,"snikket.Chat.addReaction","snikket/Chat.hx",206,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_198_addReaction,"snikket.Chat","addReaction",0xe26cff85,"snikket.Chat.addReaction","snikket/Chat.hx",198,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_12e7dd114cfbd541_244_removeReaction__fromC,"snikket.Chat","removeReaction__fromC",0xb57c6867,"snikket.Chat.removeReaction__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_251_typing,"snikket.Chat","typing",0x22ffe3bc,"snikket.Chat.typing","snikket/Chat.hx",251,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_230_typing,"snikket.Chat","typing",0x22ffe3bc,"snikket.Chat.typing","snikket/Chat.hx",230,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_245_typing,"snikket.Chat","typing",0x22ffe3bc,"snikket.Chat.typing","snikket/Chat.hx",245,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_269_setActive,"snikket.Chat","setActive",0x1ec0aae3,"snikket.Chat.setActive","snikket/Chat.hx",269,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_12e7dd114cfbd541_244_close__fromC,"snikket.Chat","close__fromC",0x4574e6c6,"snikket.Chat.close__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_294_togglePinned,"snikket.Chat","togglePinned",0x82375cd1,"snikket.Chat.togglePinned","snikket/Chat.hx",294,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_304_block,"snikket.Chat","block",0xf87b9fa8,"snikket.Chat.block","snikket/Chat.hx",304,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_321_block,"snikket.Chat","block",0xf87b9fa8,"snikket.Chat.block","snikket/Chat.hx",321,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_328_unblock,"snikket.Chat","unblock",0x32f0236f,"snikket.Chat.unblock","snikket/Chat.hx",328,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_338_unblock,"snikket.Chat","unblock",0x32f0236f,"snikket.Chat.unblock","snikket/Chat.hx",338,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_346_setNotifications,"snikket.Chat","setNotifications",0xb3d8bbab,"snikket.Chat.setNotifications","snikket/Chat.hx",346,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_362_notificationsFiltered,"snikket.Chat","notificationsFiltered",0x958be1ba,"snikket.Chat.notificationsFiltered","snikket/Chat.hx",362,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_369_notifyMention,"snikket.Chat","notifyMention",0x4bac447c,"snikket.Chat.notifyMention","snikket/Chat.hx",369,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_376_notifyReply,"snikket.Chat","notifyReply",0xf1fbc63c,"snikket.Chat.notifyReply","snikket/Chat.hx",376,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_12e7dd114cfbd541_244_lastMessageId__fromC,"snikket.Chat","lastMessageId__fromC",0xf7fe75b2,"snikket.Chat.lastMessageId__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_388_lastMessageTimestamp,"snikket.Chat","lastMessageTimestamp",0x5028348a,"snikket.Chat.lastMessageTimestamp","snikket/Chat.hx",388,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_392_updateFromBookmark,"snikket.Chat","updateFromBookmark",0x2780dcae,"snikket.Chat.updateFromBookmark","snikket/Chat.hx",392,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_401_updateFromRoster,"snikket.Chat","updateFromRoster",0x1d9e4f83,"snikket.Chat.updateFromRoster","snikket/Chat.hx",401,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_409_getPhoto,"snikket.Chat","getPhoto",0xd6c858c1,"snikket.Chat.getPhoto","snikket/Chat.hx",409,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_418_getPlaceholder,"snikket.Chat","getPlaceholder",0xa955f8c2,"snikket.Chat.getPlaceholder","snikket/Chat.hx",418,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_425_readUpTo,"snikket.Chat","readUpTo",0x2aa097b1,"snikket.Chat.readUpTo","snikket/Chat.hx",425,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_432_unreadCount,"snikket.Chat","unreadCount",0x5b4cf8bb,"snikket.Chat.unreadCount","snikket/Chat.hx",432,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_437_setUnreadCount,"snikket.Chat","setUnreadCount",0xaf7385e3,"snikket.Chat.setUnreadCount","snikket/Chat.hx",437,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_443_preview,"snikket.Chat","preview",0xbd3d9723,"snikket.Chat.preview","snikket/Chat.hx",443,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_456_setLastMessage,"snikket.Chat","setLastMessage",0x5d3f57d4,"snikket.Chat.setLastMessage","snikket/Chat.hx",456,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_459_setDisplayName,"snikket.Chat","setDisplayName",0x3f747f70,"snikket.Chat.setDisplayName","snikket/Chat.hx",459,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_467_getDisplayName,"snikket.Chat","getDisplayName",0x1f5496fc,"snikket.Chat.getDisplayName","snikket/Chat.hx",467,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_482_setPresence,"snikket.Chat","setPresence",0x5193fc98,"snikket.Chat.setPresence","snikket/Chat.hx",482,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_486_setCaps,"snikket.Chat","setCaps",0x88a113fe,"snikket.Chat.setCaps","snikket/Chat.hx",486,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_498_removePresence,"snikket.Chat","removePresence",0x97f1c0e4,"snikket.Chat.removePresence","snikket/Chat.hx",498,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_506_getCaps,"snikket.Chat","getCaps",0x959f82f2,"snikket.Chat.getCaps","snikket/Chat.hx",506,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_502_getCaps,"snikket.Chat","getCaps",0x959f82f2,"snikket.Chat.getCaps","snikket/Chat.hx",502,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_515_getResourceCaps,"snikket.Chat","getResourceCaps",0x30ef43e0,"snikket.Chat.getResourceCaps","snikket/Chat.hx",515,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_520_setAvatarSha1,"snikket.Chat","setAvatarSha1",0xd1ceb0db,"snikket.Chat.setAvatarSha1","snikket/Chat.hx",520,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_524_setTrusted,"snikket.Chat","setTrusted",0x7948483a,"snikket.Chat.setTrusted","snikket/Chat.hx",524,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_531_isTrusted,"snikket.Chat","isTrusted",0xc3782908,"snikket.Chat.isTrusted","snikket/Chat.hx",531,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_536_livePresence,"snikket.Chat","livePresence",0x0a1fa04c,"snikket.Chat.livePresence","snikket/Chat.hx",536,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_540_syncing,"snikket.Chat","syncing",0x2889b482,"snikket.Chat.syncing","snikket/Chat.hx",540,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_546_canAudioCall,"snikket.Chat","canAudioCall",0x3a98f169,"snikket.Chat.canAudioCall","snikket/Chat.hx",546,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_557_canVideoCall,"snikket.Chat","canVideoCall",0x409bc38e,"snikket.Chat.canVideoCall","snikket/Chat.hx",557,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_571_startCall,"snikket.Chat","startCall",0xa38085fb,"snikket.Chat.startCall","snikket/Chat.hx",571,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_578_addMedia,"snikket.Chat","addMedia",0x3416ab88,"snikket.Chat.addMedia","snikket/Chat.hx",578,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_587_acceptCall,"snikket.Chat","acceptCall",0xc4d6678b,"snikket.Chat.acceptCall","snikket/Chat.hx",587,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_596_hangup,"snikket.Chat","hangup",0x83c5b792,"snikket.Chat.hangup","snikket/Chat.hx",596,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_605_callStatus,"snikket.Chat","callStatus",0x40ee2a35,"snikket.Chat.callStatus","snikket/Chat.hx",605,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_616_dtmf,"snikket.Chat","dtmf",0x419954ee,"snikket.Chat.dtmf","snikket/Chat.hx",616,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_629_videoTracks,"snikket.Chat","videoTracks",0x7880a2fe,"snikket.Chat.videoTracks","snikket/Chat.hx",629,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_12e7dd114cfbd541_242_videoTracks__fromC,"snikket.Chat","videoTracks__fromC",0xb4b1493b,"snikket.Chat.videoTracks__fromC","HaxeCBridge.hx",242,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_640_markReadUpToId,"snikket.Chat","markReadUpToId",0x495f62d9,"snikket.Chat.markReadUpToId","snikket/Chat.hx",640,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_633_markReadUpToId,"snikket.Chat","markReadUpToId",0x495f62d9,"snikket.Chat.markReadUpToId","snikket/Chat.hx",633,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_659_markReadUpToMessage,"snikket.Chat","markReadUpToMessage",0xab221609,"snikket.Chat.markReadUpToMessage","snikket/Chat.hx",659,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_650_markReadUpToMessage,"snikket.Chat","markReadUpToMessage",0xab221609,"snikket.Chat.markReadUpToMessage","snikket/Chat.hx",650,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_684_publishMds,"snikket.Chat","publishMds",0x809032b2,"snikket.Chat.publishMds","snikket/Chat.hx",684,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_700_publishMds,"snikket.Chat","publishMds",0x809032b2,"snikket.Chat.publishMds","snikket/Chat.hx",700,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_666_publishMds,"snikket.Chat","publishMds",0x809032b2,"snikket.Chat.publishMds","snikket/Chat.hx",666,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_3993c1e3d3f53fe2_43_boot,"snikket.Chat","boot",0x40431e37,"snikket.Chat.boot","snikket/Chat.hx",43,0x18616bf4)
+namespace snikket{
+
+void Chat_obj::__construct( ::snikket::Client client, ::snikket::GenericStream stream,::Dynamic persistence,::String chatId,::hx::Null< int > __o_uiState,::hx::Null< bool > __o_isBlocked, ::snikket::Stanza extensions,::String readUpToId,::String readUpToBy){
+ int uiState = __o_uiState.Default(1);
+ bool isBlocked = __o_isBlocked.Default(false);
+ HX_GC_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_43_new)
+HXLINE( 78) this->notificationSettings = null();
+HXLINE( 77) this->activeThread = null();
+HXLINE( 76) this->isActive = null();
+HXLINE( 75) this->typingTimer = null();
+HXLINE( 74) this->typingThread = null();
+HXLINE( 73) this->isTyping = false;
+HXLINE( 68) this->_unreadCount = 0;
+HXLINE( 65) this->isBlocked = false;
+HXLINE( 64) this->uiState = 1;
+HXLINE( 57) this->jingleSessions = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXLINE( 51) this->trusted = false;
+HXLINE( 50) this->presence = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXLINE( 48) this->avatarSha1 = null();
+HXLINE( 82) this->client = client;
+HXLINE( 83) this->stream = stream;
+HXLINE( 84) this->persistence = persistence;
+HXLINE( 85) this->chatId = chatId;
+HXLINE( 86) this->uiState = uiState;
+HXLINE( 87) this->isBlocked = isBlocked;
+HXLINE( 88) ::snikket::Stanza tmp = extensions;
+HXDLIN( 88) ::snikket::Stanza _hx_tmp;
+HXDLIN( 88) if (::hx::IsNotNull( tmp )) {
+HXLINE( 88) _hx_tmp = tmp;
+ }
+ else {
+HXLINE( 88) _hx_tmp = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("extensions",14,7c,70,89), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:bookmarks:1",58,3c,53,7d))));
+ }
+HXDLIN( 88) this->extensions = _hx_tmp;
+HXLINE( 89) this->readUpToId = readUpToId;
+HXLINE( 90) this->readUpToBy = readUpToBy;
+HXLINE( 91) this->displayName = chatId;
+ }
+
+bool Chat_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x026b7f35;
+}
+
+::String Chat_obj::chatId__fromC(){
+ HX_STACKFRAME(&_hx_pos_12e7dd114cfbd541_271_chatId__fromC)
+HXDLIN( 271) return this->chatId;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,chatId__fromC,return )
+
+int Chat_obj::uiState__fromC(){
+ HX_STACKFRAME(&_hx_pos_12e7dd114cfbd541_271_uiState__fromC)
+HXDLIN( 271) return this->uiState;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,uiState__fromC,return )
+
+bool Chat_obj::isBlocked__fromC(){
+ HX_STACKFRAME(&_hx_pos_12e7dd114cfbd541_271_isBlocked__fromC)
+HXDLIN( 271) return this->isBlocked;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,isBlocked__fromC,return )
+
+HX_DEFINE_DYNAMIC_FUNC2(Chat_obj,prepareIncomingMessage,return )
+
+HX_DEFINE_DYNAMIC_FUNC3(Chat_obj,getMessagesBefore,(void))
+
+void Chat_obj::getMessagesBefore__fromC(::String beforeId,::String beforeTime,::cpp::Function< void (void**,size_t,void*) > handler,void* handler__context){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0,::cpp::Function< void (void** HX_COMMA size_t HX_COMMA void*) >,handler,void*,handler__context) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> a0){
+ HX_GC_STACKFRAME(&_hx_pos_12e7dd114cfbd541_221_getMessagesBefore__fromC)
+HXLINE( 221) ::cpp::Function< void (void**,size_t,void*) > handler1 = handler;
+HXLINE( 211) {
+HXLINE( 211) int _g = 0;
+HXDLIN( 211) while((_g < a0->length)){
+HXLINE( 211) ::snikket::ChatMessage el = a0->__get(_g).StaticCast< ::snikket::ChatMessage >();
+HXDLIN( 211) _g = (_g + 1);
+HXDLIN( 211) {
+HXLINE( 211) ::Dynamic haxeObject = el;
+HXDLIN( 211) void* ptr = haxeObject.mPtr;
+HXDLIN( 211) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(ptr);
+HXDLIN( 211) {
+HXLINE( 211) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 211) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 211) int high = ptrInt64 >> 32;
+HXDLIN( 211) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 211) if (::hx::IsNull( highMap )) {
+HXLINE( 211) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 211) this1->set(low,highMap);
+ }
+HXDLIN( 211) highMap->set(high,haxeObject);
+ }
+ }
+ }
+ }
+HXDLIN( 211) void** ptr1 = (void**)a0->getBase();
+HXDLIN( 211) ::cpp::Int64 ptrInt641 = reinterpret_cast<int64_t>(ptr1);
+HXDLIN( 211) {
+HXLINE( 211) ::haxe::ds::IntMap this2 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 211) int low1 = ptrInt641 & 0xffffffff;
+HXDLIN( 211) int high1 = ptrInt641 >> 32;
+HXDLIN( 211) ::haxe::ds::IntMap highMap1 = ( ( ::haxe::ds::IntMap)(this2->get(low1)) );
+HXDLIN( 211) if (::hx::IsNull( highMap1 )) {
+HXLINE( 211) highMap1 = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 211) this2->set(low1,highMap1);
+ }
+HXDLIN( 211) highMap1->set(high1,a0);
+ }
+HXLINE( 221) handler1(ptr1,( (size_t)(a0->length) ),handler__context);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_12e7dd114cfbd541_244_getMessagesBefore__fromC)
+HXDLIN( 244) this->getMessagesBefore(beforeId,beforeTime, ::Dynamic(new _hx_Closure_0(handler,handler__context)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Chat_obj,getMessagesAfter,(void))
+
+void Chat_obj::getMessagesAfter__fromC(::String afterId,::String afterTime,::cpp::Function< void (void**,size_t,void*) > handler,void* handler__context){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0,::cpp::Function< void (void** HX_COMMA size_t HX_COMMA void*) >,handler,void*,handler__context) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> a0){
+ HX_GC_STACKFRAME(&_hx_pos_12e7dd114cfbd541_221_getMessagesAfter__fromC)
+HXLINE( 221) ::cpp::Function< void (void**,size_t,void*) > handler1 = handler;
+HXLINE( 211) {
+HXLINE( 211) int _g = 0;
+HXDLIN( 211) while((_g < a0->length)){
+HXLINE( 211) ::snikket::ChatMessage el = a0->__get(_g).StaticCast< ::snikket::ChatMessage >();
+HXDLIN( 211) _g = (_g + 1);
+HXDLIN( 211) {
+HXLINE( 211) ::Dynamic haxeObject = el;
+HXDLIN( 211) void* ptr = haxeObject.mPtr;
+HXDLIN( 211) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(ptr);
+HXDLIN( 211) {
+HXLINE( 211) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 211) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 211) int high = ptrInt64 >> 32;
+HXDLIN( 211) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 211) if (::hx::IsNull( highMap )) {
+HXLINE( 211) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 211) this1->set(low,highMap);
+ }
+HXDLIN( 211) highMap->set(high,haxeObject);
+ }
+ }
+ }
+ }
+HXDLIN( 211) void** ptr1 = (void**)a0->getBase();
+HXDLIN( 211) ::cpp::Int64 ptrInt641 = reinterpret_cast<int64_t>(ptr1);
+HXDLIN( 211) {
+HXLINE( 211) ::haxe::ds::IntMap this2 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 211) int low1 = ptrInt641 & 0xffffffff;
+HXDLIN( 211) int high1 = ptrInt641 >> 32;
+HXDLIN( 211) ::haxe::ds::IntMap highMap1 = ( ( ::haxe::ds::IntMap)(this2->get(low1)) );
+HXDLIN( 211) if (::hx::IsNull( highMap1 )) {
+HXLINE( 211) highMap1 = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 211) this2->set(low1,highMap1);
+ }
+HXDLIN( 211) highMap1->set(high1,a0);
+ }
+HXLINE( 221) handler1(ptr1,( (size_t)(a0->length) ),handler__context);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_12e7dd114cfbd541_244_getMessagesAfter__fromC)
+HXDLIN( 244) this->getMessagesAfter(afterId,afterTime, ::Dynamic(new _hx_Closure_0(handler,handler__context)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Chat_obj,getMessagesAround,(void))
+
+void Chat_obj::getMessagesAround__fromC(::String aroundId,::String aroundTime,::cpp::Function< void (void**,size_t,void*) > handler,void* handler__context){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0,::cpp::Function< void (void** HX_COMMA size_t HX_COMMA void*) >,handler,void*,handler__context) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> a0){
+ HX_GC_STACKFRAME(&_hx_pos_12e7dd114cfbd541_221_getMessagesAround__fromC)
+HXLINE( 221) ::cpp::Function< void (void**,size_t,void*) > handler1 = handler;
+HXLINE( 211) {
+HXLINE( 211) int _g = 0;
+HXDLIN( 211) while((_g < a0->length)){
+HXLINE( 211) ::snikket::ChatMessage el = a0->__get(_g).StaticCast< ::snikket::ChatMessage >();
+HXDLIN( 211) _g = (_g + 1);
+HXDLIN( 211) {
+HXLINE( 211) ::Dynamic haxeObject = el;
+HXDLIN( 211) void* ptr = haxeObject.mPtr;
+HXDLIN( 211) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(ptr);
+HXDLIN( 211) {
+HXLINE( 211) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 211) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 211) int high = ptrInt64 >> 32;
+HXDLIN( 211) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 211) if (::hx::IsNull( highMap )) {
+HXLINE( 211) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 211) this1->set(low,highMap);
+ }
+HXDLIN( 211) highMap->set(high,haxeObject);
+ }
+ }
+ }
+ }
+HXDLIN( 211) void** ptr1 = (void**)a0->getBase();
+HXDLIN( 211) ::cpp::Int64 ptrInt641 = reinterpret_cast<int64_t>(ptr1);
+HXDLIN( 211) {
+HXLINE( 211) ::haxe::ds::IntMap this2 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 211) int low1 = ptrInt641 & 0xffffffff;
+HXDLIN( 211) int high1 = ptrInt641 >> 32;
+HXDLIN( 211) ::haxe::ds::IntMap highMap1 = ( ( ::haxe::ds::IntMap)(this2->get(low1)) );
+HXDLIN( 211) if (::hx::IsNull( highMap1 )) {
+HXLINE( 211) highMap1 = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 211) this2->set(low1,highMap1);
+ }
+HXDLIN( 211) highMap1->set(high1,a0);
+ }
+HXLINE( 221) handler1(ptr1,( (size_t)(a0->length) ),handler__context);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_12e7dd114cfbd541_244_getMessagesAround__fromC)
+HXDLIN( 244) this->getMessagesAround(aroundId,aroundTime, ::Dynamic(new _hx_Closure_0(handler,handler__context)));
+ }
+
+
+void Chat_obj::fetchFromSync( ::snikket::MessageSync sync, ::Dynamic callback){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_2, ::snikket::Chat,_gthis, ::Dynamic,callback) HXARGC(1)
+ void _hx_run( ::Dynamic messageList){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_1, ::snikket::Chat,_gthis, ::Dynamic,callback) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> chatMessages){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_143_fetchFromSync)
+HXLINE( 143) ::Dynamic callback1 = callback;
+HXDLIN( 143) ::Array< ::Dynamic> _g = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 143) {
+HXLINE( 143) int _g1 = 0;
+HXDLIN( 143) ::Array< ::Dynamic> _g2 = chatMessages;
+HXDLIN( 143) while((_g1 < _g2->length)){
+HXLINE( 143) ::snikket::ChatMessage v = _g2->__get(_g1).StaticCast< ::snikket::ChatMessage >();
+HXDLIN( 143) _g1 = (_g1 + 1);
+HXDLIN( 143) bool _hx_tmp;
+HXDLIN( 143) if (::hx::IsNotNull( v )) {
+HXLINE( 143) ::String _hx_tmp1 = v->chatId();
+HXDLIN( 143) _hx_tmp = (_hx_tmp1 == _gthis->chatId);
+ }
+ else {
+HXLINE( 143) _hx_tmp = false;
+ }
+HXDLIN( 143) if (_hx_tmp) {
+HXLINE( 143) _g->push(v);
+ }
+ }
+ }
+HXDLIN( 143) callback1(_g);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_128_fetchFromSync)
+HXLINE( 129) ::Array< ::Dynamic> chatMessages = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 130) {
+HXLINE( 130) int _g = 0;
+HXDLIN( 130) ::Array< ::Dynamic> _g1 = ( (::Array< ::Dynamic>)(messageList->__Field(HX_("messages",cc,d8,fd,34),::hx::paccDynamic)) );
+HXDLIN( 130) while((_g < _g1->length)){
+HXLINE( 130) ::snikket::MessageStanza m = _g1->__get(_g).StaticCast< ::snikket::MessageStanza >();
+HXDLIN( 130) _g = (_g + 1);
+HXLINE( 131) switch((int)(m->_hx_getIndex())){
+ case (int)1: {
+HXLINE( 132) ::snikket::ChatMessage message = m->_hx_getObject(0).StaticCast< ::snikket::ChatMessage >();
+HXLINE( 133) chatMessages->push(message);
+ }
+ break;
+ case (int)2: {
+HXLINE( 136) ::snikket::ModerationAction action = m->_hx_getObject(0).StaticCast< ::snikket::ModerationAction >();
+HXLINE( 137) _gthis->client->moderateMessage(action);
+ }
+ break;
+ case (int)3: {
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ void _hx_run( ::snikket::ChatMessage m){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_135_fetchFromSync)
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE( 134) ::snikket::ReactionUpdate update = m->_hx_getObject(0).StaticCast< ::snikket::ReactionUpdate >();
+HXLINE( 135) ::Dynamic _gthis1 = _gthis->persistence;
+HXDLIN( 135) ::snikket::Persistence_obj::storeReaction(_gthis1,_gthis->client->accountId(),update, ::Dynamic(new _hx_Closure_0()));
+ }
+ break;
+ default:{
+ }
+ }
+ }
+ }
+HXLINE( 142) _gthis->client->storeMessages(chatMessages, ::Dynamic(new _hx_Closure_1(_gthis,callback)));
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_127_fetchFromSync)
+HXDLIN( 127) ::snikket::Chat _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 128) sync->onMessages( ::Dynamic(new _hx_Closure_2(_gthis,callback)));
+HXLINE( 146) sync->fetchNext();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Chat_obj,fetchFromSync,(void))
+
+HX_DEFINE_DYNAMIC_FUNC1(Chat_obj,sendMessage,(void))
+
+void Chat_obj::sendMessage__fromC( ::snikket::ChatMessageBuilder message){
+ HX_STACKFRAME(&_hx_pos_12e7dd114cfbd541_244_sendMessage__fromC)
+HXDLIN( 244) this->sendMessage(message);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Chat_obj,sendMessage__fromC,(void))
+
+HX_DEFINE_DYNAMIC_FUNC1(Chat_obj,markReadUpTo,(void))
+
+void Chat_obj::markReadUpTo__fromC( ::snikket::ChatMessage message){
+ HX_STACKFRAME(&_hx_pos_12e7dd114cfbd541_244_markReadUpTo__fromC)
+HXDLIN( 244) this->markReadUpTo(message);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Chat_obj,markReadUpTo__fromC,(void))
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,bookmark,(void))
+
+void Chat_obj::bookmark__fromC(){
+ HX_STACKFRAME(&_hx_pos_12e7dd114cfbd541_244_bookmark__fromC)
+HXDLIN( 244) this->bookmark();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,bookmark__fromC,(void))
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,getParticipants,return )
+
+size_t Chat_obj::getParticipants__fromC(const char*** outPtr){
+ HX_GC_STACKFRAME(&_hx_pos_12e7dd114cfbd541_242_getParticipants__fromC)
+HXDLIN( 242) ::Array< ::String > out = this->getParticipants();
+HXDLIN( 242) if (::hx::IsNotNull( outPtr )) {
+HXDLIN( 242) ::cpp::Pointer< const char** > _hx_tmp = ::cpp::Pointer_obj::fromRaw(outPtr);
+HXDLIN( 242) ::Array< size_t > arr = ::Array_obj< size_t >::__new(out->length);
+HXDLIN( 242) {
+HXDLIN( 242) int _g_current = 0;
+HXDLIN( 242) ::Array< ::String > _g_array = out;
+HXDLIN( 242) while((_g_current < _g_array->length)){
+HXDLIN( 242) ::String _g_value = _g_array->__get(_g_current);
+HXDLIN( 242) _g_current = (_g_current + 1);
+HXDLIN( 242) int _g_key = (_g_current - 1);
+HXDLIN( 242) int i = _g_key;
+HXDLIN( 242) ::String el = _g_value;
+HXDLIN( 242) {
+HXDLIN( 242) const char* cStrPtr = el.utf8_str();
+HXDLIN( 242) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(cStrPtr);
+HXDLIN( 242) {
+HXDLIN( 242) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 242) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 242) int high = ptrInt64 >> 32;
+HXDLIN( 242) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 242) if (::hx::IsNull( highMap )) {
+HXLINE(2083) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXLINE( 242) this1->set(low,highMap);
+ }
+HXDLIN( 242) highMap->set(high,el);
+ }
+HXDLIN( 242) const char* ptr = cStrPtr;
+HXDLIN( 242) arr[i] = reinterpret_cast<size_t>(ptr);
+ }
+ }
+ }
+HXDLIN( 242) void** ptr1 = (void**)arr->getBase();
+HXDLIN( 242) ::cpp::Int64 ptrInt641 = reinterpret_cast<int64_t>(ptr1);
+HXDLIN( 242) {
+HXDLIN( 242) ::haxe::ds::IntMap this2 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 242) int low1 = ptrInt641 & 0xffffffff;
+HXDLIN( 242) int high1 = ptrInt641 >> 32;
+HXDLIN( 242) ::haxe::ds::IntMap highMap1 = ( ( ::haxe::ds::IntMap)(this2->get(low1)) );
+HXDLIN( 242) if (::hx::IsNull( highMap1 )) {
+HXLINE(2083) highMap1 = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXLINE( 242) this2->set(low1,highMap1);
+ }
+HXDLIN( 242) highMap1->set(high1,arr);
+ }
+HXDLIN( 242) _hx_tmp->set_ref(( (const char**)(ptr1) ));
+ }
+HXDLIN( 242) return ( (size_t)(out->length) );
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Chat_obj,getParticipantDetails,return )
+
+ ::snikket::Participant Chat_obj::getParticipantDetails__fromC(::String participantId){
+ HX_STACKFRAME(&_hx_pos_12e7dd114cfbd541_244_getParticipantDetails__fromC)
+HXDLIN( 244) return this->getParticipantDetails(participantId);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Chat_obj,getParticipantDetails__fromC,return )
+
+HX_DEFINE_DYNAMIC_FUNC2(Chat_obj,correctMessage,(void))
+
+void Chat_obj::correctMessage__fromC(::String localId, ::snikket::ChatMessageBuilder message){
+ HX_STACKFRAME(&_hx_pos_12e7dd114cfbd541_244_correctMessage__fromC)
+HXDLIN( 244) this->correctMessage(localId,message);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Chat_obj,correctMessage__fromC,(void))
+
+void Chat_obj::addReaction( ::snikket::ChatMessage m, ::snikket::Reaction reaction){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::ChatMessageBuilder,toSend) HXARGC(1)
+ void _hx_run(::String text){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_203_addReaction)
+HXLINE( 203) toSend->text = ::StringTools_obj::replace(text,HX_W(u"\ufe0f",fb86,00b5),HX_("",00,00,00,00));
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_1, ::snikket::ChatMessageBuilder,toSend) HXARGC(2)
+ void _hx_run(::String text,::String uri){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_206_addReaction)
+HXLINE( 207) ::snikket::Hash hash = ::snikket::Hash_obj::fromUri(uri);
+HXLINE( 208) ::snikket::ChatMessageBuilder toSend1 = toSend;
+HXDLIN( 208) ::String _hx_tmp = ((HX_("<img alt=\"",15,9f,1a,99) + ::snikket::_Util::Util_Fields__obj::xmlEscape(text)) + HX_("\" src=\"",ab,ae,ff,d3));
+HXDLIN( 208) ::String _hx_tmp1;
+HXDLIN( 208) if (::hx::IsNull( hash )) {
+HXLINE( 208) _hx_tmp1 = uri;
+ }
+ else {
+HXLINE( 208) _hx_tmp1 = hash->bobUri();
+ }
+HXDLIN( 208) toSend1->setHtml(((_hx_tmp + ::snikket::_Util::Util_Fields__obj::xmlEscape(_hx_tmp1)) + HX_("\" />",6d,b2,91,16)));
+ }
+ HX_END_LOCAL_FUNC2((void))
+
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_198_addReaction)
+HXLINE( 199) ::snikket::ChatMessageBuilder toSend = m->reply();
+HXLINE( 200) toSend->localId = ::snikket::ID_obj::_hx_long();
+HXLINE( 201) reaction->render( ::Dynamic(new _hx_Closure_0(toSend)), ::Dynamic(new _hx_Closure_1(toSend)));
+HXLINE( 211) this->sendMessage(toSend);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Chat_obj,addReaction,(void))
+
+HX_DEFINE_DYNAMIC_FUNC2(Chat_obj,removeReaction,(void))
+
+void Chat_obj::removeReaction__fromC( ::snikket::ChatMessage m, ::snikket::Reaction reaction){
+ HX_STACKFRAME(&_hx_pos_12e7dd114cfbd541_244_removeReaction__fromC)
+HXDLIN( 244) this->removeReaction(m,reaction);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Chat_obj,removeReaction__fromC,(void))
+
+HX_DEFINE_DYNAMIC_FUNC2(Chat_obj,sendChatState,(void))
+
+void Chat_obj::typing(::String threadId,::String content){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_1, ::snikket::Chat,_gthis) HXARGC(0)
+ void _hx_run(){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_251_typing)
+HXLINE( 252) _gthis->sendChatState(HX_("paused",ae,40,84,ef),_gthis->typingThread);
+HXLINE( 253) _gthis->isTyping = false;
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_230_typing)
+HXDLIN( 230) ::snikket::Chat _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 231) bool _hx_tmp;
+HXDLIN( 231) if ((threadId != this->typingThread)) {
+HXLINE( 231) _hx_tmp = this->isTyping;
+ }
+ else {
+HXLINE( 231) _hx_tmp = false;
+ }
+HXDLIN( 231) if (_hx_tmp) {
+HXLINE( 233) this->sendChatState(HX_("paused",ae,40,84,ef),this->typingThread);
+HXLINE( 234) this->isTyping = false;
+ }
+HXLINE( 237) this->typingThread = threadId;
+HXLINE( 238) if (::hx::IsNotNull( this->typingTimer )) {
+HXLINE( 238) this->typingTimer->stop();
+ }
+HXLINE( 240) if ((content == HX_("",00,00,00,00))) {
+HXLINE( 241) this->isTyping = false;
+HXLINE( 242) this->sendChatState(HX_("active",c6,41,46,16),this->typingThread);
+HXLINE( 243) if (::hx::IsNull( this->isActive )) {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::Chat,_gthis) HXARGC(0)
+ void _hx_run(){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_245_typing)
+HXLINE( 245) _gthis->sendChatState(HX_("inactive",6b,17,30,6a),_gthis->typingThread);
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+HXLINE( 244) this->typingTimer = ::haxe::Timer_obj::delay( ::Dynamic(new _hx_Closure_0(_gthis)),30000);
+ }
+HXLINE( 248) return;
+ }
+HXLINE( 251) this->typingTimer = ::haxe::Timer_obj::delay( ::Dynamic(new _hx_Closure_1(_gthis)),10000);
+HXLINE( 256) if (this->isTyping) {
+HXLINE( 256) return;
+ }
+HXLINE( 257) this->isTyping = true;
+HXLINE( 258) this->sendChatState(HX_("composing",cf,0a,a5,12),this->typingThread);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Chat_obj,typing,(void))
+
+void Chat_obj::setActive(bool active,::String threadId){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_269_setActive)
+HXLINE( 270) if (::hx::IsNotNull( this->typingTimer )) {
+HXLINE( 270) this->typingTimer->stop();
+ }
+HXLINE( 271) this->isTyping = false;
+HXLINE( 273) bool _hx_tmp;
+HXDLIN( 273) bool _hx_tmp1;
+HXDLIN( 273) if (( (bool)(this->isActive) )) {
+HXLINE( 273) _hx_tmp1 = active;
+ }
+ else {
+HXLINE( 273) _hx_tmp1 = false;
+ }
+HXDLIN( 273) if (_hx_tmp1) {
+HXLINE( 273) _hx_tmp = (threadId != this->activeThread);
+ }
+ else {
+HXLINE( 273) _hx_tmp = false;
+ }
+HXDLIN( 273) if (_hx_tmp) {
+HXLINE( 274) this->sendChatState(HX_("inactive",6b,17,30,6a),this->activeThread);
+HXLINE( 275) this->isActive = false;
+ }
+HXLINE( 277) if (::hx::IsNotNull( this->isActive )) {
+HXLINE( 278) bool _hx_tmp2;
+HXDLIN( 278) if (( (bool)(this->isActive) )) {
+HXLINE( 278) _hx_tmp2 = active;
+ }
+ else {
+HXLINE( 278) _hx_tmp2 = false;
+ }
+HXDLIN( 278) if (_hx_tmp2) {
+HXLINE( 278) return;
+ }
+HXLINE( 279) bool _hx_tmp3;
+HXDLIN( 279) if (!(( (bool)(this->isActive) ))) {
+HXLINE( 279) _hx_tmp3 = !(active);
+ }
+ else {
+HXLINE( 279) _hx_tmp3 = false;
+ }
+HXDLIN( 279) if (_hx_tmp3) {
+HXLINE( 279) return;
+ }
+ }
+HXLINE( 281) this->isActive = active;
+HXLINE( 282) this->activeThread = threadId;
+HXLINE( 283) ::String _hx_tmp4;
+HXDLIN( 283) if (active) {
+HXLINE( 283) _hx_tmp4 = HX_("active",c6,41,46,16);
+ }
+ else {
+HXLINE( 283) _hx_tmp4 = HX_("inactive",6b,17,30,6a);
+ }
+HXDLIN( 283) this->sendChatState(_hx_tmp4,this->activeThread);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Chat_obj,setActive,(void))
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,close,(void))
+
+void Chat_obj::close__fromC(){
+ HX_STACKFRAME(&_hx_pos_12e7dd114cfbd541_244_close__fromC)
+HXDLIN( 244) this->close();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,close__fromC,(void))
+
+void Chat_obj::togglePinned(){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_294_togglePinned)
+HXLINE( 295) int _hx_tmp;
+HXDLIN( 295) if ((this->uiState == 0)) {
+HXLINE( 295) _hx_tmp = 1;
+ }
+ else {
+HXLINE( 295) _hx_tmp = 0;
+ }
+HXDLIN( 295) this->uiState = _hx_tmp;
+HXLINE( 296) ::Dynamic _hx_tmp1 = this->persistence;
+HXDLIN( 296) ::snikket::Persistence_obj::storeChats(_hx_tmp1,this->client->accountId(),::Array_obj< ::Dynamic>::__new(1)->init(0,::hx::ObjectPtr<OBJ_>(this)));
+HXLINE( 297) this->client->sortChats();
+HXLINE( 298) this->client->trigger(HX_("chats/update",3d,8e,1d,14),::cpp::VirtualArray_obj::__new(1)->init(0,::hx::ObjectPtr<OBJ_>(this)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,togglePinned,(void))
+
+void Chat_obj::block( ::snikket::ChatMessage reportSpam,bool onServer){
+ HX_GC_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_304_block)
+HXLINE( 305) bool _hx_tmp;
+HXDLIN( 305) if (::hx::IsNotNull( reportSpam )) {
+HXLINE( 305) _hx_tmp = !(onServer);
+ }
+ else {
+HXLINE( 305) _hx_tmp = false;
+ }
+HXDLIN( 305) if (_hx_tmp) {
+HXLINE( 305) HX_STACK_DO_THROW(HX_("Can't report SPAM if not sending to server",60,59,79,c5));
+ }
+HXLINE( 306) this->isBlocked = true;
+HXLINE( 307) if ((this->uiState == 2)) {
+HXLINE( 308) ::Dynamic _hx_tmp1 = this->persistence;
+HXDLIN( 308) ::snikket::Persistence_obj::storeChats(_hx_tmp1,this->client->accountId(),::Array_obj< ::Dynamic>::__new(1)->init(0,::hx::ObjectPtr<OBJ_>(this)));
+ }
+ else {
+HXLINE( 310) this->close();
+ }
+HXLINE( 312) if (onServer) {
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ void _hx_run( ::snikket::Stanza response){
+ HX_GC_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_321_block)
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE( 313) ::String iq = ::snikket::ID_obj::_hx_short();
+HXDLIN( 313) ::snikket::Stanza iq1 = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("iq",e8,5b,00,00), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("id",db,5b,00,00),iq)
+ ->setFixed(1,HX_("type",ba,f2,08,4d),HX_("set",a2,9b,57,00))))->tag(HX_("block",4d,75,fc,b4), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:blocking",d1,a1,46,c3))))->tag(HX_("item",13,c5,bf,45), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("jid",c5,ca,50,00),this->chatId)));
+HXLINE( 316) if (::hx::IsNotNull( reportSpam )) {
+HXLINE( 317) iq1->tag(HX_("report",b4,3c,84,06), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("reason",c4,0f,9d,fc),HX_("urn:xmpp:reporting:spam",b1,09,15,35))
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:reporting:1",49,f0,16,fc))))->tag(HX_("stanza-id",73,8a,54,e9), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("by",d7,55,00,00),reportSpam->serverIdBy)
+ ->setFixed(1,HX_("id",db,5b,00,00),reportSpam->serverId)
+ ->setFixed(2,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:sid:0",a8,4b,37,54))));
+ }
+HXLINE( 321) this->stream->sendIq(iq1, ::Dynamic(new _hx_Closure_0()));
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Chat_obj,block,(void))
+
+void Chat_obj::unblock(bool onServer){
+ HX_GC_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_328_unblock)
+HXLINE( 329) this->isBlocked = false;
+HXLINE( 330) this->uiState = 1;
+HXLINE( 331) ::Dynamic _hx_tmp = this->persistence;
+HXDLIN( 331) ::snikket::Persistence_obj::storeChats(_hx_tmp,this->client->accountId(),::Array_obj< ::Dynamic>::__new(1)->init(0,::hx::ObjectPtr<OBJ_>(this)));
+HXLINE( 332) this->client->trigger(HX_("chats/update",3d,8e,1d,14),::cpp::VirtualArray_obj::__new(1)->init(0,::hx::ObjectPtr<OBJ_>(this)));
+HXLINE( 333) if (onServer) {
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ void _hx_run( ::snikket::Stanza response){
+ HX_GC_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_338_unblock)
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE( 334) ::snikket::GenericStream _hx_tmp1 = this->stream;
+HXLINE( 335) ::String _hx_tmp2 = ::snikket::ID_obj::_hx_short();
+HXLINE( 334) _hx_tmp1->sendIq( ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("iq",e8,5b,00,00), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("id",db,5b,00,00),_hx_tmp2)
+ ->setFixed(1,HX_("type",ba,f2,08,4d),HX_("set",a2,9b,57,00))))->tag(HX_("unblock",54,6c,8d,b1), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:blocking",d1,a1,46,c3))))->tag(HX_("item",13,c5,bf,45), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("jid",c5,ca,50,00),this->chatId)))->up()->up(), ::Dynamic(new _hx_Closure_0()));
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Chat_obj,unblock,(void))
+
+void Chat_obj::setNotifications(bool filtered,bool mention,bool reply){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_346_setNotifications)
+HXLINE( 347) if (filtered) {
+HXLINE( 348) this->notificationSettings = ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("mention",ea,9e,bf,b9),mention)
+ ->setFixed(1,HX_("reply",2a,09,c6,e6),reply));
+ }
+ else {
+HXLINE( 350) this->notificationSettings = null();
+ }
+HXLINE( 352) ::Dynamic _hx_tmp = this->persistence;
+HXDLIN( 352) ::snikket::Persistence_obj::storeChats(_hx_tmp,this->client->accountId(),::Array_obj< ::Dynamic>::__new(1)->init(0,::hx::ObjectPtr<OBJ_>(this)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Chat_obj,setNotifications,(void))
+
+bool Chat_obj::notificationsFiltered(){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_362_notificationsFiltered)
+HXDLIN( 362) return ::hx::IsNotNull( this->notificationSettings );
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,notificationsFiltered,return )
+
+bool Chat_obj::notifyMention(){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_369_notifyMention)
+HXDLIN( 369) if (::hx::IsNotNull( this->notificationSettings )) {
+HXDLIN( 369) return ( (bool)(this->notificationSettings->__Field(HX_("mention",ea,9e,bf,b9),::hx::paccDynamic)) );
+ }
+ else {
+HXDLIN( 369) return true;
+ }
+HXDLIN( 369) return false;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,notifyMention,return )
+
+bool Chat_obj::notifyReply(){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_376_notifyReply)
+HXDLIN( 376) if (::hx::IsNotNull( this->notificationSettings )) {
+HXDLIN( 376) return ( (bool)(this->notificationSettings->__Field(HX_("reply",2a,09,c6,e6),::hx::paccDynamic)) );
+ }
+ else {
+HXDLIN( 376) return true;
+ }
+HXDLIN( 376) return false;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,notifyReply,return )
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,lastMessageId,return )
+
+::String Chat_obj::lastMessageId__fromC(){
+ HX_STACKFRAME(&_hx_pos_12e7dd114cfbd541_244_lastMessageId__fromC)
+HXDLIN( 244) return this->lastMessageId();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,lastMessageId__fromC,return )
+
+::String Chat_obj::lastMessageTimestamp(){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_388_lastMessageTimestamp)
+HXDLIN( 388) ::snikket::ChatMessage tmp = this->lastMessage;
+HXDLIN( 388) if (::hx::IsNotNull( tmp )) {
+HXDLIN( 388) return tmp->timestamp;
+ }
+ else {
+HXDLIN( 388) return null();
+ }
+HXDLIN( 388) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,lastMessageTimestamp,return )
+
+void Chat_obj::updateFromBookmark( ::snikket::Stanza item){
+ HX_GC_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_392_updateFromBookmark)
+HXLINE( 393) ::snikket::Stanza conf = item->getChild(HX_("conference",1c,2b,83,41),HX_("urn:xmpp:bookmarks:1",58,3c,53,7d));
+HXLINE( 394) ::String fn = ( (::String)(::Reflect_obj::field(conf->attr,HX_("name",4b,72,ff,48))) );
+HXLINE( 395) if (::hx::IsNotNull( fn )) {
+HXLINE( 395) this->displayName = fn;
+ }
+HXLINE( 396) int _hx_tmp;
+HXDLIN( 396) bool _hx_tmp1;
+HXDLIN( 396) if ((( (::String)(::Reflect_obj::field(conf->attr,HX_("autojoin",d9,f6,b1,3e))) ) != HX_("1",31,00,00,00))) {
+HXLINE( 396) _hx_tmp1 = (( (::String)(::Reflect_obj::field(conf->attr,HX_("autojoin",d9,f6,b1,3e))) ) == HX_("true",4e,a7,03,4d));
+ }
+ else {
+HXLINE( 396) _hx_tmp1 = true;
+ }
+HXDLIN( 396) if (_hx_tmp1) {
+HXLINE( 396) if ((this->uiState == 0)) {
+HXLINE( 396) _hx_tmp = 0;
+ }
+ else {
+HXLINE( 396) _hx_tmp = 1;
+ }
+ }
+ else {
+HXLINE( 396) _hx_tmp = 2;
+ }
+HXDLIN( 396) this->uiState = _hx_tmp;
+HXLINE( 397) ::snikket::Stanza tmp = conf->getChild(HX_("extensions",14,7c,70,89),null());
+HXDLIN( 397) ::snikket::Stanza _hx_tmp2;
+HXDLIN( 397) if (::hx::IsNotNull( tmp )) {
+HXLINE( 397) _hx_tmp2 = tmp;
+ }
+ else {
+HXLINE( 397) _hx_tmp2 = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("extensions",14,7c,70,89), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:bookmarks:1",58,3c,53,7d))));
+ }
+HXDLIN( 397) this->extensions = _hx_tmp2;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Chat_obj,updateFromBookmark,(void))
+
+void Chat_obj::updateFromRoster( ::Dynamic item){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_401_updateFromRoster)
+HXLINE( 402) bool _hx_tmp;
+HXDLIN( 402) if (::hx::IsNotEq( item->__Field(HX_("subscription",1d,ff,00,36),::hx::paccDynamic),HX_("both",81,88,1b,41) )) {
+HXLINE( 402) _hx_tmp = ::hx::IsEq( item->__Field(HX_("subscription",1d,ff,00,36),::hx::paccDynamic),HX_("from",6a,a5,c2,43) );
+ }
+ else {
+HXLINE( 402) _hx_tmp = true;
+ }
+HXDLIN( 402) this->setTrusted(_hx_tmp);
+HXLINE( 403) bool _hx_tmp1;
+HXDLIN( 403) if (::hx::IsNotNull( item->__Field(HX_("fn",48,59,00,00),::hx::paccDynamic) )) {
+HXLINE( 403) _hx_tmp1 = ::hx::IsNotEq( item->__Field(HX_("fn",48,59,00,00),::hx::paccDynamic),HX_("",00,00,00,00) );
+ }
+ else {
+HXLINE( 403) _hx_tmp1 = false;
+ }
+HXDLIN( 403) if (_hx_tmp1) {
+HXLINE( 403) this->displayName = ( (::String)(item->__Field(HX_("fn",48,59,00,00),::hx::paccDynamic)) );
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Chat_obj,updateFromRoster,(void))
+
+::String Chat_obj::getPhoto(){
+ HX_GC_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_409_getPhoto)
+HXLINE( 410) bool _hx_tmp;
+HXDLIN( 410) if (::hx::IsNotNull( this->avatarSha1 )) {
+HXLINE( 410) _hx_tmp = (::haxe::io::Bytes_obj::ofData(this->avatarSha1)->length < 1);
+ }
+ else {
+HXLINE( 410) _hx_tmp = true;
+ }
+HXDLIN( 410) if (_hx_tmp) {
+HXLINE( 410) return null();
+ }
+HXLINE( 411) return ::snikket::Hash_obj::__alloc( HX_CTX ,HX_("sha-1",90,a8,1c,7c),this->avatarSha1)->toUri();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,getPhoto,return )
+
+::String Chat_obj::getPlaceholder(){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_418_getPlaceholder)
+HXDLIN( 418) ::String _hx_tmp = this->chatId;
+HXDLIN( 418) return ::snikket::Color_obj::defaultPhoto(_hx_tmp,this->getDisplayName().charAt(0).toUpperCase());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,getPlaceholder,return )
+
+::String Chat_obj::readUpTo(){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_425_readUpTo)
+HXDLIN( 425) return this->readUpToId;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,readUpTo,return )
+
+int Chat_obj::unreadCount(){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_432_unreadCount)
+HXDLIN( 432) return this->_unreadCount;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,unreadCount,return )
+
+void Chat_obj::setUnreadCount(int count){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_437_setUnreadCount)
+HXDLIN( 437) this->_unreadCount = count;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Chat_obj,setUnreadCount,(void))
+
+::String Chat_obj::preview(){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_443_preview)
+HXLINE( 444) if (::hx::IsNull( this->lastMessage )) {
+HXLINE( 444) return HX_("",00,00,00,00);
+ }
+HXLINE( 446) if ((this->lastMessage->type == 1)) {
+HXLINE( 448) if (this->lastMessage->isIncoming()) {
+HXLINE( 448) return HX_("Incoming Call",18,e2,4d,47);
+ }
+ else {
+HXLINE( 448) return HX_("Outgoing Call",d2,04,61,e8);
+ }
+ }
+ else {
+HXLINE( 450) return this->lastMessage->text;
+ }
+HXLINE( 446) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,preview,return )
+
+void Chat_obj::setLastMessage( ::snikket::ChatMessage message){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_456_setLastMessage)
+HXDLIN( 456) this->lastMessage = message;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Chat_obj,setLastMessage,(void))
+
+void Chat_obj::setDisplayName(::String fn){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_459_setDisplayName)
+HXLINE( 460) this->displayName = fn;
+HXLINE( 461) this->bookmark();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Chat_obj,setDisplayName,(void))
+
+::String Chat_obj::getDisplayName(){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_467_getDisplayName)
+HXDLIN( 467) ::snikket::Chat _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 468) ::String fn;
+HXDLIN( 468) bool fn1;
+HXDLIN( 468) if ((this->displayName == this->chatId)) {
+HXLINE( 468) ::String fn2 = this->chatId;
+HXDLIN( 468) fn1 = (fn2 == this->client->accountId());
+ }
+ else {
+HXLINE( 468) fn1 = false;
+ }
+HXDLIN( 468) if (fn1) {
+HXLINE( 468) fn = this->client->displayName();
+ }
+ else {
+HXLINE( 468) fn = this->displayName;
+ }
+HXLINE( 469) ::Array< ::String > participants = this->getParticipants();
+HXLINE( 470) bool _hx_tmp;
+HXDLIN( 470) bool _hx_tmp1;
+HXDLIN( 470) if ((fn == this->chatId)) {
+HXLINE( 470) _hx_tmp1 = (participants->length > 2);
+ }
+ else {
+HXLINE( 470) _hx_tmp1 = false;
+ }
+HXDLIN( 470) if (_hx_tmp1) {
+HXLINE( 470) _hx_tmp = (participants->length < 20);
+ }
+ else {
+HXLINE( 470) _hx_tmp = false;
+ }
+HXDLIN( 470) if (_hx_tmp) {
+HXLINE( 471) ::Array< ::String > result = ::Array_obj< ::String >::__new(participants->length);
+HXDLIN( 471) {
+HXLINE( 471) int _g = 0;
+HXDLIN( 471) int _g1 = participants->length;
+HXDLIN( 471) while((_g < _g1)){
+HXLINE( 471) _g = (_g + 1);
+HXDLIN( 471) int i = (_g - 1);
+HXDLIN( 471) {
+HXLINE( 472) ::snikket::Participant p = _gthis->getParticipantDetails(( (::String)(_hx_array_unsafe_get(participants,i)) ));
+HXLINE( 471) ::String inValue;
+HXLINE( 473) if (p->isSelf) {
+HXLINE( 471) inValue = null();
+ }
+ else {
+HXLINE( 471) inValue = p->displayName;
+ }
+HXDLIN( 471) result->__unsafe_set(i,inValue);
+ }
+ }
+ }
+HXDLIN( 471) ::Array< ::String > _g2 = ::Array_obj< ::String >::__new(0);
+HXDLIN( 471) {
+HXLINE( 471) int _g3 = 0;
+HXDLIN( 471) ::Array< ::String > _g4 = result;
+HXDLIN( 471) while((_g3 < _g4->length)){
+HXLINE( 471) ::String v = _g4->__get(_g3);
+HXDLIN( 471) _g3 = (_g3 + 1);
+HXDLIN( 471) if (::hx::IsNotNull( v )) {
+HXLINE( 471) _g2->push(v);
+ }
+ }
+ }
+HXDLIN( 471) return _g2->join(HX_(", ",74,26,00,00));
+ }
+ else {
+HXLINE( 476) return fn;
+ }
+HXLINE( 470) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,getDisplayName,return )
+
+void Chat_obj::setPresence(::String resource, ::snikket::Presence presence){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_482_setPresence)
+HXDLIN( 482) this->presence->set(resource,presence);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Chat_obj,setPresence,(void))
+
+void Chat_obj::setCaps(::String resource, ::snikket::Caps caps){
+ HX_GC_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_486_setCaps)
+HXLINE( 487) ::snikket::Presence presence = ( ( ::snikket::Presence)(this->presence->get(resource)) );
+HXLINE( 488) if (::hx::IsNotNull( presence )) {
+HXLINE( 489) presence->caps = caps;
+HXLINE( 490) this->setPresence(resource,presence);
+ }
+ else {
+HXLINE( 492) this->setPresence(resource, ::snikket::Presence_obj::__alloc( HX_CTX ,caps,null()));
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Chat_obj,setCaps,(void))
+
+void Chat_obj::removePresence(::String resource){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_498_removePresence)
+HXDLIN( 498) this->presence->remove(resource);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Chat_obj,removePresence,(void))
+
+ ::Dynamic Chat_obj::getCaps(){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::Dynamic,iter) HXARGC(0)
+ ::Dynamic _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_506_getCaps)
+HXLINE( 507) ::Dynamic n = iter->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)();
+HXLINE( 508) return ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("key",9f,89,51,00), ::Dynamic(n->__Field(HX_("key",9f,89,51,00),::hx::paccDynamic)))
+ ->setFixed(1,HX_("value",71,7f,b8,31),( ( ::snikket::Presence)(n->__Field(HX_("value",71,7f,b8,31),::hx::paccDynamic)) )->caps));
+ }
+ HX_END_LOCAL_FUNC0(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_502_getCaps)
+HXLINE( 503) ::Dynamic iter = ::haxe::iterators::MapKeyValueIterator_obj::__alloc( HX_CTX ,this->presence);
+HXLINE( 504) return ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("hasNext",6d,a5,46,18), ::Dynamic(iter->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)))
+ ->setFixed(1,HX_("next",f3,84,02,49), ::Dynamic(new _hx_Closure_0(iter))));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,getCaps,return )
+
+ ::snikket::Caps Chat_obj::getResourceCaps(::String resource){
+ HX_GC_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_515_getResourceCaps)
+HXDLIN( 515) ::snikket::Presence tmp = ( ( ::snikket::Presence)(this->presence->get(resource)) );
+HXDLIN( 515) ::snikket::Caps tmp1;
+HXDLIN( 515) if (::hx::IsNotNull( tmp )) {
+HXDLIN( 515) tmp1 = tmp->caps;
+ }
+ else {
+HXDLIN( 515) tmp1 = null();
+ }
+HXDLIN( 515) if (::hx::IsNotNull( tmp1 )) {
+HXDLIN( 515) return tmp1;
+ }
+ else {
+HXDLIN( 515) return ::snikket::Caps_obj::__alloc( HX_CTX ,HX_("",00,00,00,00),::Array_obj< ::Dynamic>::__new(0),::Array_obj< ::String >::__new(0));
+ }
+HXDLIN( 515) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Chat_obj,getResourceCaps,return )
+
+void Chat_obj::setAvatarSha1(::Array< unsigned char > sha1){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_520_setAvatarSha1)
+HXDLIN( 520) this->avatarSha1 = sha1;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Chat_obj,setAvatarSha1,(void))
+
+void Chat_obj::setTrusted(bool trusted){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_524_setTrusted)
+HXDLIN( 524) this->trusted = trusted;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Chat_obj,setTrusted,(void))
+
+bool Chat_obj::isTrusted(){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_531_isTrusted)
+HXDLIN( 531) return this->trusted;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,isTrusted,return )
+
+bool Chat_obj::livePresence(){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_536_livePresence)
+HXDLIN( 536) return true;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,livePresence,return )
+
+bool Chat_obj::syncing(){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_540_syncing)
+HXDLIN( 540) return !(this->client->inSync);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,syncing,return )
+
+bool Chat_obj::canAudioCall(){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_546_canAudioCall)
+HXLINE( 547) {
+HXLINE( 547) ::Dynamic map = this->presence;
+HXDLIN( 547) ::Dynamic _g_map = map;
+HXDLIN( 547) ::Dynamic _g_keys = ::haxe::IMap_obj::keys(map);
+HXDLIN( 547) while(( (bool)(_g_keys->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 547) ::String key = ( (::String)(_g_keys->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXDLIN( 547) ::snikket::Presence _g_value = ( ( ::snikket::Presence)(::haxe::IMap_obj::get(_g_map,key)) );
+HXDLIN( 547) ::String _g_key = key;
+HXDLIN( 547) ::String resource = _g_key;
+HXDLIN( 547) ::snikket::Presence p = _g_value;
+HXLINE( 548) bool _hx_tmp;
+HXDLIN( 548) ::snikket::Caps tmp = p->caps;
+HXDLIN( 548) ::Array< ::String > tmp1;
+HXDLIN( 548) if (::hx::IsNotNull( tmp )) {
+HXLINE( 548) tmp1 = tmp->features;
+ }
+ else {
+HXLINE( 548) tmp1 = null();
+ }
+HXDLIN( 548) ::Dynamic tmp2;
+HXDLIN( 548) if (::hx::IsNotNull( tmp1 )) {
+HXLINE( 548) tmp2 = tmp1->contains(HX_("urn:xmpp:jingle:apps:rtp:audio",0f,8b,54,6c));
+ }
+ else {
+HXLINE( 548) tmp2 = null();
+ }
+HXDLIN( 548) if (::hx::IsNotNull( tmp2 )) {
+HXLINE( 548) _hx_tmp = ( (bool)(tmp2) );
+ }
+ else {
+HXLINE( 548) _hx_tmp = false;
+ }
+HXDLIN( 548) if (_hx_tmp) {
+HXLINE( 548) return true;
+ }
+ }
+ }
+HXLINE( 551) return false;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,canAudioCall,return )
+
+bool Chat_obj::canVideoCall(){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_557_canVideoCall)
+HXLINE( 558) {
+HXLINE( 558) ::Dynamic map = this->presence;
+HXDLIN( 558) ::Dynamic _g_map = map;
+HXDLIN( 558) ::Dynamic _g_keys = ::haxe::IMap_obj::keys(map);
+HXDLIN( 558) while(( (bool)(_g_keys->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 558) ::String key = ( (::String)(_g_keys->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXDLIN( 558) ::snikket::Presence _g_value = ( ( ::snikket::Presence)(::haxe::IMap_obj::get(_g_map,key)) );
+HXDLIN( 558) ::String _g_key = key;
+HXDLIN( 558) ::String resource = _g_key;
+HXDLIN( 558) ::snikket::Presence p = _g_value;
+HXLINE( 559) bool _hx_tmp;
+HXDLIN( 559) ::snikket::Caps tmp = p->caps;
+HXDLIN( 559) ::Array< ::String > tmp1;
+HXDLIN( 559) if (::hx::IsNotNull( tmp )) {
+HXLINE( 559) tmp1 = tmp->features;
+ }
+ else {
+HXLINE( 559) tmp1 = null();
+ }
+HXDLIN( 559) ::Dynamic tmp2;
+HXDLIN( 559) if (::hx::IsNotNull( tmp1 )) {
+HXLINE( 559) tmp2 = tmp1->contains(HX_("urn:xmpp:jingle:apps:rtp:video",b4,26,d0,7b));
+ }
+ else {
+HXLINE( 559) tmp2 = null();
+ }
+HXDLIN( 559) if (::hx::IsNotNull( tmp2 )) {
+HXLINE( 559) _hx_tmp = ( (bool)(tmp2) );
+ }
+ else {
+HXLINE( 559) _hx_tmp = false;
+ }
+HXDLIN( 559) if (_hx_tmp) {
+HXLINE( 559) return true;
+ }
+ }
+ }
+HXLINE( 562) return false;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,canVideoCall,return )
+
+void Chat_obj::startCall(bool audio,bool video){
+ HX_GC_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_571_startCall)
+HXLINE( 572) ::snikket::Client session = this->client;
+HXDLIN( 572) ::snikket::jingle::OutgoingProposedSession session1 = ::snikket::jingle::OutgoingProposedSession_obj::__alloc( HX_CTX ,session,::snikket::JID_obj::parse(this->chatId));
+HXLINE( 573) {
+HXLINE( 573) ::Dynamic this1 = this->jingleSessions;
+HXDLIN( 573) ( ( ::haxe::ds::StringMap)(this1) )->set(session1->get_sid(),session1);
+ }
+HXLINE( 574) session1->propose(audio,video);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Chat_obj,startCall,(void))
+
+void Chat_obj::addMedia(::Array< ::Dynamic> streams){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_578_addMedia)
+HXLINE( 579) if ((this->callStatus() != HX_("ongoing",3b,aa,04,9b))) {
+HXLINE( 579) HX_STACK_DO_THROW(HX_("cannot add media when no call ongoing",6a,0b,2b,6e));
+ }
+HXLINE( 580) ::snikket::jingle::Session_obj::addMedia(this->jingleSessions->iterator()->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)(),streams);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Chat_obj,addMedia,(void))
+
+void Chat_obj::acceptCall(){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_587_acceptCall)
+HXDLIN( 587) ::Dynamic session = this->jingleSessions->iterator();
+HXDLIN( 587) while(( (bool)(session->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXDLIN( 587) ::Dynamic session1 = session->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)();
+HXLINE( 588) ::snikket::jingle::Session_obj::accept(session1);
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,acceptCall,(void))
+
+void Chat_obj::hangup(){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_596_hangup)
+HXDLIN( 596) ::Dynamic session = this->jingleSessions->iterator();
+HXDLIN( 596) while(( (bool)(session->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXDLIN( 596) ::Dynamic session1 = session->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)();
+HXLINE( 597) ::snikket::jingle::Session_obj::hangup(session1);
+HXLINE( 598) {
+HXLINE( 598) ::Dynamic this1 = this->jingleSessions;
+HXDLIN( 598) ( ( ::haxe::ds::StringMap)(this1) )->remove(::snikket::jingle::Session_obj::get_sid(session1));
+ }
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,hangup,(void))
+
+::String Chat_obj::callStatus(){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_605_callStatus)
+HXLINE( 606) {
+HXLINE( 606) ::Dynamic session = this->jingleSessions->iterator();
+HXDLIN( 606) while(( (bool)(session->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 606) ::Dynamic session1 = session->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)();
+HXLINE( 607) return ::snikket::jingle::Session_obj::callStatus(session1);
+ }
+ }
+HXLINE( 610) return HX_("none",b8,12,0a,49);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,callStatus,return )
+
+ ::snikket::jingle::DTMFSender Chat_obj::dtmf(){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_616_dtmf)
+HXLINE( 617) {
+HXLINE( 617) ::Dynamic session = this->jingleSessions->iterator();
+HXDLIN( 617) while(( (bool)(session->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 617) ::Dynamic session1 = session->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)();
+HXLINE( 618) ::snikket::jingle::DTMFSender dtmf = ::snikket::jingle::Session_obj::dtmf(session1);
+HXLINE( 619) if (::hx::IsNotNull( dtmf )) {
+HXLINE( 619) return dtmf;
+ }
+ }
+ }
+HXLINE( 622) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,dtmf,return )
+
+::Array< ::Dynamic> Chat_obj::videoTracks(){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_629_videoTracks)
+HXDLIN( 629) ::Array< ::Dynamic> _g = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 629) {
+HXDLIN( 629) ::Dynamic x = this->jingleSessions->__Field(HX_("iterator",ee,49,9a,93),::hx::paccDynamic)();
+HXDLIN( 629) while(( (bool)(x->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXDLIN( 629) ::Dynamic x1 = x->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)();
+HXDLIN( 629) _g->push(::snikket::jingle::Session_obj::videoTracks(x1));
+ }
+ }
+HXDLIN( 629) ::Array< ::Dynamic> _g1 = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 629) {
+HXDLIN( 629) ::Dynamic e = _g->__Field(HX_("iterator",ee,49,9a,93),::hx::paccDynamic)();
+HXDLIN( 629) while(( (bool)(e->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXDLIN( 629) ::Dynamic e1 = e->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)();
+HXDLIN( 629) {
+HXDLIN( 629) ::Dynamic x2 = e1->__Field(HX_("iterator",ee,49,9a,93),::hx::paccDynamic)();
+HXDLIN( 629) while(( (bool)(x2->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXDLIN( 629) ::snikket::jingle::MediaStreamTrack x3 = ( ( ::snikket::jingle::MediaStreamTrack)(x2->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXDLIN( 629) _g1->push(x3);
+ }
+ }
+ }
+ }
+HXDLIN( 629) return _g1;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,videoTracks,return )
+
+size_t Chat_obj::videoTracks__fromC(void*** outPtr){
+ HX_GC_STACKFRAME(&_hx_pos_12e7dd114cfbd541_242_videoTracks__fromC)
+HXDLIN( 242) ::Array< ::Dynamic> out = this->videoTracks();
+HXDLIN( 242) if (::hx::IsNotNull( outPtr )) {
+HXDLIN( 242) ::cpp::Pointer< void** > _hx_tmp = ::cpp::Pointer_obj::fromRaw(outPtr);
+HXDLIN( 242) {
+HXDLIN( 242) int _g = 0;
+HXDLIN( 242) while((_g < out->length)){
+HXDLIN( 242) ::snikket::jingle::MediaStreamTrack el = out->__get(_g).StaticCast< ::snikket::jingle::MediaStreamTrack >();
+HXDLIN( 242) _g = (_g + 1);
+HXDLIN( 242) {
+HXDLIN( 242) ::Dynamic haxeObject = el;
+HXDLIN( 242) void* ptr = haxeObject.mPtr;
+HXDLIN( 242) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(ptr);
+HXDLIN( 242) {
+HXDLIN( 242) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 242) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 242) int high = ptrInt64 >> 32;
+HXDLIN( 242) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 242) if (::hx::IsNull( highMap )) {
+HXDLIN( 242) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 242) this1->set(low,highMap);
+ }
+HXDLIN( 242) highMap->set(high,haxeObject);
+ }
+ }
+ }
+ }
+HXDLIN( 242) void** ptr1 = (void**)out->getBase();
+HXDLIN( 242) ::cpp::Int64 ptrInt641 = reinterpret_cast<int64_t>(ptr1);
+HXDLIN( 242) {
+HXDLIN( 242) ::haxe::ds::IntMap this2 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 242) int low1 = ptrInt641 & 0xffffffff;
+HXDLIN( 242) int high1 = ptrInt641 >> 32;
+HXDLIN( 242) ::haxe::ds::IntMap highMap1 = ( ( ::haxe::ds::IntMap)(this2->get(low1)) );
+HXDLIN( 242) if (::hx::IsNull( highMap1 )) {
+HXDLIN( 242) highMap1 = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 242) this2->set(low1,highMap1);
+ }
+HXDLIN( 242) highMap1->set(high1,out);
+ }
+HXDLIN( 242) _hx_tmp->set_ref(ptr1);
+ }
+HXDLIN( 242) return ( (size_t)(out->length) );
+ }
+
+
+void Chat_obj::markReadUpToId(::String upTo,::String upToBy, ::Dynamic callback){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0, ::snikket::Chat,_gthis, ::Dynamic,callback) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> messages){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_640_markReadUpToId)
+HXLINE( 641) int i = messages->length;
+HXLINE( 642) while(true){
+HXLINE( 642) i = (i - 1);
+HXDLIN( 642) if (!((i >= 0))) {
+HXLINE( 642) goto _hx_goto_90;
+ }
+HXLINE( 643) bool _hx_tmp;
+HXDLIN( 643) if ((messages->__get(i).StaticCast< ::snikket::ChatMessage >()->serverId != _gthis->readUpToId)) {
+HXLINE( 643) _hx_tmp = !(messages->__get(i).StaticCast< ::snikket::ChatMessage >()->isIncoming());
+ }
+ else {
+HXLINE( 643) _hx_tmp = true;
+ }
+HXDLIN( 643) if (_hx_tmp) {
+HXLINE( 643) goto _hx_goto_90;
+ }
+ }
+ _hx_goto_90:;
+HXLINE( 645) _gthis->setUnreadCount((messages->length - (i + 1)));
+HXLINE( 646) if (::hx::IsNotNull( callback )) {
+HXLINE( 646) callback();
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_633_markReadUpToId)
+HXDLIN( 633) ::snikket::Chat _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 634) if (::hx::IsNull( upTo )) {
+HXLINE( 634) return;
+ }
+HXLINE( 635) if ((this->readUpTo() == upTo)) {
+HXLINE( 635) return;
+ }
+HXLINE( 637) this->readUpToId = upTo;
+HXLINE( 638) this->readUpToBy = upToBy;
+HXLINE( 639) ::Dynamic _hx_tmp = this->persistence;
+HXDLIN( 639) ::snikket::Persistence_obj::storeChats(_hx_tmp,this->client->accountId(),::Array_obj< ::Dynamic>::__new(1)->init(0,::hx::ObjectPtr<OBJ_>(this)));
+HXLINE( 640) ::Dynamic _hx_tmp1 = this->persistence;
+HXDLIN( 640) ::String _hx_tmp2 = this->client->accountId();
+HXDLIN( 640) ::snikket::Persistence_obj::getMessagesBefore(_hx_tmp1,_hx_tmp2,this->chatId,null(),null(), ::Dynamic(new _hx_Closure_0(_gthis,callback)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Chat_obj,markReadUpToId,(void))
+
+void Chat_obj::markReadUpToMessage( ::snikket::ChatMessage message, ::Dynamic callback){
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_0, ::snikket::Chat,_gthis, ::snikket::ChatMessage,message, ::Dynamic,callback) HXARGC(1)
+ void _hx_run( ::snikket::ChatMessage readMessage){
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_659_markReadUpToMessage)
+HXLINE( 660) bool _hx_tmp;
+HXDLIN( 660) if (::hx::IsNotNull( readMessage )) {
+HXLINE( 660) _hx_tmp = (::Reflect_obj::compare(message->timestamp,readMessage->timestamp) <= 0);
+ }
+ else {
+HXLINE( 660) _hx_tmp = false;
+ }
+HXDLIN( 660) if (_hx_tmp) {
+HXLINE( 660) return;
+ }
+HXLINE( 662) _gthis->markReadUpToId(message->serverId,message->serverIdBy,callback);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_650_markReadUpToMessage)
+HXDLIN( 650) ::snikket::Chat _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 651) bool _hx_tmp;
+HXDLIN( 651) if (::hx::IsNotNull( message->serverId )) {
+HXLINE( 651) ::String _hx_tmp1 = message->chatId();
+HXDLIN( 651) _hx_tmp = (_hx_tmp1 != this->chatId);
+ }
+ else {
+HXLINE( 651) _hx_tmp = true;
+ }
+HXDLIN( 651) if (_hx_tmp) {
+HXLINE( 651) return;
+ }
+HXLINE( 652) ::String _hx_tmp2 = this->readUpTo();
+HXDLIN( 652) if ((_hx_tmp2 == message->serverId)) {
+HXLINE( 652) return;
+ }
+HXLINE( 654) if (::hx::IsNull( this->readUpTo() )) {
+HXLINE( 655) this->markReadUpToId(message->serverId,message->serverIdBy,callback);
+HXLINE( 656) return;
+ }
+HXLINE( 659) ::Dynamic _hx_tmp3 = this->persistence;
+HXDLIN( 659) ::String _hx_tmp4 = this->client->accountId();
+HXDLIN( 659) ::String _hx_tmp5 = this->chatId;
+HXDLIN( 659) ::snikket::Persistence_obj::getMessage(_hx_tmp3,_hx_tmp4,_hx_tmp5,this->readUpTo(),null(), ::Dynamic(new _hx_Closure_0(_gthis,message,callback)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Chat_obj,markReadUpToMessage,(void))
+
+void Chat_obj::publishMds(){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_1, ::snikket::Chat,_gthis) HXARGC(1)
+ void _hx_run( ::snikket::Stanza response){
+ HX_GC_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_684_publishMds)
+HXLINE( 684) if ((( (::String)(::Reflect_obj::field(response->attr,HX_("type",ba,f2,08,4d))) ) == HX_("error",c8,cb,29,73))) {
+HXLINE( 685) ::snikket::Stanza tmp = response->getChild(HX_("error",c8,cb,29,73),null());
+HXDLIN( 685) ::snikket::Stanza preconditionError;
+HXDLIN( 685) if (::hx::IsNotNull( tmp )) {
+HXLINE( 685) preconditionError = tmp->getChild(HX_("precondition-not-met",2d,db,78,db),HX_("http://jabber.org/protocol/pubsub#errors",97,74,3a,a8));
+ }
+ else {
+HXLINE( 685) preconditionError = null();
+ }
+HXLINE( 686) if (::hx::IsNotNull( preconditionError )) {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::Chat,_gthis) HXARGC(1)
+ void _hx_run( ::snikket::Stanza response){
+ HX_GC_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_700_publishMds)
+HXLINE( 700) if ((( (::String)(::Reflect_obj::field(response->attr,HX_("type",ba,f2,08,4d))) ) == HX_("result",dd,68,84,08))) {
+HXLINE( 701) _gthis->publishMds();
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE( 688) ::snikket::GenericStream _gthis1 = _gthis->stream;
+HXDLIN( 688) _gthis1->sendIq( ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("iq",e8,5b,00,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("type",ba,f2,08,4d),HX_("set",a2,9b,57,00))))->tag(HX_("pubsub",e3,da,f8,66), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("http://jabber.org/protocol/pubsub#owner",c7,28,a3,08))))->tag(HX_("configure",e6,f9,5b,c0), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("node",02,0a,0a,49),HX_("urn:xmpp:mds:displayed:0",bd,60,cc,fb))))->tag(HX_("x",78,00,00,00), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("type",ba,f2,08,4d),HX_("submit",18,58,06,9a))
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("jabber:x:data",c2,e1,e9,7c))))->tag(HX_("field",ba,94,93,00), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("var",e7,de,59,00),HX_("FORM_TYPE",d5,96,c9,5a))
+ ->setFixed(1,HX_("type",ba,f2,08,4d),HX_("hidden",6a,ff,95,4c))))->textTag(HX_("value",71,7f,b8,31),HX_("http://jabber.org/protocol/pubsub#publish-options",f4,9c,72,50),null())->up()->tag(HX_("field",ba,94,93,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("var",e7,de,59,00),HX_("pubsub#persist_items",75,44,6b,ad))))->textTag(HX_("value",71,7f,b8,31),HX_("true",4e,a7,03,4d),null())->up()->tag(HX_("field",ba,94,93,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("var",e7,de,59,00),HX_("pubsub#max_items",05,69,9f,7c))))->textTag(HX_("value",71,7f,b8,31),HX_("max",a4,0a,53,00),null())->up()->tag(HX_("field",ba,94,93,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("var",e7,de,59,00),HX_("pubsub#send_last_published_item",b6,21,d2,0a))))->textTag(HX_("value",71,7f,b8,31),HX_("never",8c,3e,30,99),null())->up()->tag(HX_("field",ba,94,93,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("var",e7,de,59,00),HX_("pubsub#access_model",6e,cf,ac,1d))))->textTag(HX_("value",71,7f,b8,31),HX_("whitelist",87,6f,95,29),null())->up()->up()->up()->up(), ::Dynamic(new _hx_Closure_0(_gthis)));
+ }
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_666_publishMds)
+HXDLIN( 666) ::snikket::Chat _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 667) ::snikket::GenericStream _hx_tmp = this->stream;
+HXLINE( 668) ::snikket::Stanza _hx_tmp1 = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("iq",e8,5b,00,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("type",ba,f2,08,4d),HX_("set",a2,9b,57,00))))->tag(HX_("pubsub",e3,da,f8,66), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("http://jabber.org/protocol/pubsub",57,94,3c,f2))))->tag(HX_("publish",8f,21,1d,ae), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("node",02,0a,0a,49),HX_("urn:xmpp:mds:displayed:0",bd,60,cc,fb))))->tag(HX_("item",13,c5,bf,45), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("id",db,5b,00,00),this->chatId)))->tag(HX_("displayed",21,17,db,c1), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:mds:displayed:0",bd,60,cc,fb))));
+HXLINE( 673) ::String _hx_tmp2 = this->readUpTo();
+HXLINE( 667) _hx_tmp->sendIq(_hx_tmp1->tag(HX_("stanza-id",73,8a,54,e9), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("by",d7,55,00,00),this->readUpToBy)
+ ->setFixed(1,HX_("id",db,5b,00,00),_hx_tmp2)
+ ->setFixed(2,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:sid:0",a8,4b,37,54))))->up()->up()->up()->tag(HX_("publish-options",60,0b,5c,74),null())->tag(HX_("x",78,00,00,00), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("type",ba,f2,08,4d),HX_("submit",18,58,06,9a))
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("jabber:x:data",c2,e1,e9,7c))))->tag(HX_("field",ba,94,93,00), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("var",e7,de,59,00),HX_("FORM_TYPE",d5,96,c9,5a))
+ ->setFixed(1,HX_("type",ba,f2,08,4d),HX_("hidden",6a,ff,95,4c))))->textTag(HX_("value",71,7f,b8,31),HX_("http://jabber.org/protocol/pubsub#publish-options",f4,9c,72,50),null())->up()->tag(HX_("field",ba,94,93,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("var",e7,de,59,00),HX_("pubsub#persist_items",75,44,6b,ad))))->textTag(HX_("value",71,7f,b8,31),HX_("true",4e,a7,03,4d),null())->up()->tag(HX_("field",ba,94,93,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("var",e7,de,59,00),HX_("pubsub#max_items",05,69,9f,7c))))->textTag(HX_("value",71,7f,b8,31),HX_("max",a4,0a,53,00),null())->up()->tag(HX_("field",ba,94,93,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("var",e7,de,59,00),HX_("pubsub#send_last_published_item",b6,21,d2,0a))))->textTag(HX_("value",71,7f,b8,31),HX_("never",8c,3e,30,99),null())->up()->tag(HX_("field",ba,94,93,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("var",e7,de,59,00),HX_("pubsub#access_model",6e,cf,ac,1d))))->textTag(HX_("value",71,7f,b8,31),HX_("whitelist",87,6f,95,29),null())->up()->up()->up(), ::Dynamic(new _hx_Closure_1(_gthis)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Chat_obj,publishMds,(void))
+
+
+Chat_obj::Chat_obj()
+{
+}
+
+void Chat_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(Chat);
+ HX_MARK_MEMBER_NAME(client,"client");
+ HX_MARK_MEMBER_NAME(stream,"stream");
+ HX_MARK_MEMBER_NAME(persistence,"persistence");
+ HX_MARK_MEMBER_NAME(avatarSha1,"avatarSha1");
+ HX_MARK_MEMBER_NAME(presence,"presence");
+ HX_MARK_MEMBER_NAME(trusted,"trusted");
+ HX_MARK_MEMBER_NAME(chatId,"chatId");
+ HX_MARK_MEMBER_NAME(jingleSessions,"jingleSessions");
+ HX_MARK_MEMBER_NAME(displayName,"displayName");
+ HX_MARK_MEMBER_NAME(uiState,"uiState");
+ HX_MARK_MEMBER_NAME(isBlocked,"isBlocked");
+ HX_MARK_MEMBER_NAME(extensions,"extensions");
+ HX_MARK_MEMBER_NAME(_unreadCount,"_unreadCount");
+ HX_MARK_MEMBER_NAME(lastMessage,"lastMessage");
+ HX_MARK_MEMBER_NAME(readUpToId,"readUpToId");
+ HX_MARK_MEMBER_NAME(readUpToBy,"readUpToBy");
+ HX_MARK_MEMBER_NAME(isTyping,"isTyping");
+ HX_MARK_MEMBER_NAME(typingThread,"typingThread");
+ HX_MARK_MEMBER_NAME(typingTimer,"typingTimer");
+ HX_MARK_MEMBER_NAME(isActive,"isActive");
+ HX_MARK_MEMBER_NAME(activeThread,"activeThread");
+ HX_MARK_MEMBER_NAME(notificationSettings,"notificationSettings");
+ HX_MARK_END_CLASS();
+}
+
+void Chat_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(client,"client");
+ HX_VISIT_MEMBER_NAME(stream,"stream");
+ HX_VISIT_MEMBER_NAME(persistence,"persistence");
+ HX_VISIT_MEMBER_NAME(avatarSha1,"avatarSha1");
+ HX_VISIT_MEMBER_NAME(presence,"presence");
+ HX_VISIT_MEMBER_NAME(trusted,"trusted");
+ HX_VISIT_MEMBER_NAME(chatId,"chatId");
+ HX_VISIT_MEMBER_NAME(jingleSessions,"jingleSessions");
+ HX_VISIT_MEMBER_NAME(displayName,"displayName");
+ HX_VISIT_MEMBER_NAME(uiState,"uiState");
+ HX_VISIT_MEMBER_NAME(isBlocked,"isBlocked");
+ HX_VISIT_MEMBER_NAME(extensions,"extensions");
+ HX_VISIT_MEMBER_NAME(_unreadCount,"_unreadCount");
+ HX_VISIT_MEMBER_NAME(lastMessage,"lastMessage");
+ HX_VISIT_MEMBER_NAME(readUpToId,"readUpToId");
+ HX_VISIT_MEMBER_NAME(readUpToBy,"readUpToBy");
+ HX_VISIT_MEMBER_NAME(isTyping,"isTyping");
+ HX_VISIT_MEMBER_NAME(typingThread,"typingThread");
+ HX_VISIT_MEMBER_NAME(typingTimer,"typingTimer");
+ HX_VISIT_MEMBER_NAME(isActive,"isActive");
+ HX_VISIT_MEMBER_NAME(activeThread,"activeThread");
+ HX_VISIT_MEMBER_NAME(notificationSettings,"notificationSettings");
+}
+
+::hx::Val Chat_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"dtmf") ) { return ::hx::Val( dtmf_dyn() ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"close") ) { return ::hx::Val( close_dyn() ); }
+ if (HX_FIELD_EQ(inName,"block") ) { return ::hx::Val( block_dyn() ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"client") ) { return ::hx::Val( client ); }
+ if (HX_FIELD_EQ(inName,"stream") ) { return ::hx::Val( stream ); }
+ if (HX_FIELD_EQ(inName,"chatId") ) { return ::hx::Val( chatId ); }
+ if (HX_FIELD_EQ(inName,"typing") ) { return ::hx::Val( typing_dyn() ); }
+ if (HX_FIELD_EQ(inName,"hangup") ) { return ::hx::Val( hangup_dyn() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"trusted") ) { return ::hx::Val( trusted ); }
+ if (HX_FIELD_EQ(inName,"uiState") ) { return ::hx::Val( uiState ); }
+ if (HX_FIELD_EQ(inName,"unblock") ) { return ::hx::Val( unblock_dyn() ); }
+ if (HX_FIELD_EQ(inName,"preview") ) { return ::hx::Val( preview_dyn() ); }
+ if (HX_FIELD_EQ(inName,"setCaps") ) { return ::hx::Val( setCaps_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getCaps") ) { return ::hx::Val( getCaps_dyn() ); }
+ if (HX_FIELD_EQ(inName,"syncing") ) { return ::hx::Val( syncing_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"presence") ) { return ::hx::Val( presence ); }
+ if (HX_FIELD_EQ(inName,"isTyping") ) { return ::hx::Val( isTyping ); }
+ if (HX_FIELD_EQ(inName,"isActive") ) { return ::hx::Val( isActive ); }
+ if (HX_FIELD_EQ(inName,"bookmark") ) { return ::hx::Val( bookmark_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getPhoto") ) { return ::hx::Val( getPhoto_dyn() ); }
+ if (HX_FIELD_EQ(inName,"readUpTo") ) { return ::hx::Val( readUpTo_dyn() ); }
+ if (HX_FIELD_EQ(inName,"addMedia") ) { return ::hx::Val( addMedia_dyn() ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"isBlocked") ) { return ::hx::Val( isBlocked ); }
+ if (HX_FIELD_EQ(inName,"setActive") ) { return ::hx::Val( setActive_dyn() ); }
+ if (HX_FIELD_EQ(inName,"isTrusted") ) { return ::hx::Val( isTrusted_dyn() ); }
+ if (HX_FIELD_EQ(inName,"startCall") ) { return ::hx::Val( startCall_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"avatarSha1") ) { return ::hx::Val( avatarSha1 ); }
+ if (HX_FIELD_EQ(inName,"extensions") ) { return ::hx::Val( extensions ); }
+ if (HX_FIELD_EQ(inName,"readUpToId") ) { return ::hx::Val( readUpToId ); }
+ if (HX_FIELD_EQ(inName,"readUpToBy") ) { return ::hx::Val( readUpToBy ); }
+ if (HX_FIELD_EQ(inName,"setTrusted") ) { return ::hx::Val( setTrusted_dyn() ); }
+ if (HX_FIELD_EQ(inName,"acceptCall") ) { return ::hx::Val( acceptCall_dyn() ); }
+ if (HX_FIELD_EQ(inName,"callStatus") ) { return ::hx::Val( callStatus_dyn() ); }
+ if (HX_FIELD_EQ(inName,"publishMds") ) { return ::hx::Val( publishMds_dyn() ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"persistence") ) { return ::hx::Val( persistence ); }
+ if (HX_FIELD_EQ(inName,"displayName") ) { return ::hx::Val( displayName ); }
+ if (HX_FIELD_EQ(inName,"lastMessage") ) { return ::hx::Val( lastMessage ); }
+ if (HX_FIELD_EQ(inName,"typingTimer") ) { return ::hx::Val( typingTimer ); }
+ if (HX_FIELD_EQ(inName,"sendMessage") ) { return ::hx::Val( sendMessage_dyn() ); }
+ if (HX_FIELD_EQ(inName,"addReaction") ) { return ::hx::Val( addReaction_dyn() ); }
+ if (HX_FIELD_EQ(inName,"notifyReply") ) { return ::hx::Val( notifyReply_dyn() ); }
+ if (HX_FIELD_EQ(inName,"unreadCount") ) { return ::hx::Val( unreadCount_dyn() ); }
+ if (HX_FIELD_EQ(inName,"setPresence") ) { return ::hx::Val( setPresence_dyn() ); }
+ if (HX_FIELD_EQ(inName,"videoTracks") ) { return ::hx::Val( videoTracks_dyn() ); }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"_unreadCount") ) { return ::hx::Val( _unreadCount ); }
+ if (HX_FIELD_EQ(inName,"typingThread") ) { return ::hx::Val( typingThread ); }
+ if (HX_FIELD_EQ(inName,"activeThread") ) { return ::hx::Val( activeThread ); }
+ if (HX_FIELD_EQ(inName,"markReadUpTo") ) { return ::hx::Val( markReadUpTo_dyn() ); }
+ if (HX_FIELD_EQ(inName,"close__fromC") ) { return ::hx::Val( close__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"togglePinned") ) { return ::hx::Val( togglePinned_dyn() ); }
+ if (HX_FIELD_EQ(inName,"livePresence") ) { return ::hx::Val( livePresence_dyn() ); }
+ if (HX_FIELD_EQ(inName,"canAudioCall") ) { return ::hx::Val( canAudioCall_dyn() ); }
+ if (HX_FIELD_EQ(inName,"canVideoCall") ) { return ::hx::Val( canVideoCall_dyn() ); }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"chatId__fromC") ) { return ::hx::Val( chatId__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"fetchFromSync") ) { return ::hx::Val( fetchFromSync_dyn() ); }
+ if (HX_FIELD_EQ(inName,"sendChatState") ) { return ::hx::Val( sendChatState_dyn() ); }
+ if (HX_FIELD_EQ(inName,"notifyMention") ) { return ::hx::Val( notifyMention_dyn() ); }
+ if (HX_FIELD_EQ(inName,"lastMessageId") ) { return ::hx::Val( lastMessageId_dyn() ); }
+ if (HX_FIELD_EQ(inName,"setAvatarSha1") ) { return ::hx::Val( setAvatarSha1_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"jingleSessions") ) { return ::hx::Val( jingleSessions ); }
+ if (HX_FIELD_EQ(inName,"uiState__fromC") ) { return ::hx::Val( uiState__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"correctMessage") ) { return ::hx::Val( correctMessage_dyn() ); }
+ if (HX_FIELD_EQ(inName,"removeReaction") ) { return ::hx::Val( removeReaction_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getPlaceholder") ) { return ::hx::Val( getPlaceholder_dyn() ); }
+ if (HX_FIELD_EQ(inName,"setUnreadCount") ) { return ::hx::Val( setUnreadCount_dyn() ); }
+ if (HX_FIELD_EQ(inName,"setLastMessage") ) { return ::hx::Val( setLastMessage_dyn() ); }
+ if (HX_FIELD_EQ(inName,"setDisplayName") ) { return ::hx::Val( setDisplayName_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getDisplayName") ) { return ::hx::Val( getDisplayName_dyn() ); }
+ if (HX_FIELD_EQ(inName,"removePresence") ) { return ::hx::Val( removePresence_dyn() ); }
+ if (HX_FIELD_EQ(inName,"markReadUpToId") ) { return ::hx::Val( markReadUpToId_dyn() ); }
+ break;
+ case 15:
+ if (HX_FIELD_EQ(inName,"bookmark__fromC") ) { return ::hx::Val( bookmark__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getParticipants") ) { return ::hx::Val( getParticipants_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getResourceCaps") ) { return ::hx::Val( getResourceCaps_dyn() ); }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"isBlocked__fromC") ) { return ::hx::Val( isBlocked__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getMessagesAfter") ) { return ::hx::Val( getMessagesAfter_dyn() ); }
+ if (HX_FIELD_EQ(inName,"setNotifications") ) { return ::hx::Val( setNotifications_dyn() ); }
+ if (HX_FIELD_EQ(inName,"updateFromRoster") ) { return ::hx::Val( updateFromRoster_dyn() ); }
+ break;
+ case 17:
+ if (HX_FIELD_EQ(inName,"getMessagesBefore") ) { return ::hx::Val( getMessagesBefore_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getMessagesAround") ) { return ::hx::Val( getMessagesAround_dyn() ); }
+ break;
+ case 18:
+ if (HX_FIELD_EQ(inName,"sendMessage__fromC") ) { return ::hx::Val( sendMessage__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"updateFromBookmark") ) { return ::hx::Val( updateFromBookmark_dyn() ); }
+ break;
+ case 19:
+ if (HX_FIELD_EQ(inName,"markReadUpTo__fromC") ) { return ::hx::Val( markReadUpTo__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"markReadUpToMessage") ) { return ::hx::Val( markReadUpToMessage_dyn() ); }
+ break;
+ case 20:
+ if (HX_FIELD_EQ(inName,"notificationSettings") ) { return ::hx::Val( notificationSettings ); }
+ if (HX_FIELD_EQ(inName,"lastMessageId__fromC") ) { return ::hx::Val( lastMessageId__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"lastMessageTimestamp") ) { return ::hx::Val( lastMessageTimestamp_dyn() ); }
+ break;
+ case 21:
+ if (HX_FIELD_EQ(inName,"getParticipantDetails") ) { return ::hx::Val( getParticipantDetails_dyn() ); }
+ if (HX_FIELD_EQ(inName,"correctMessage__fromC") ) { return ::hx::Val( correctMessage__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"removeReaction__fromC") ) { return ::hx::Val( removeReaction__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"notificationsFiltered") ) { return ::hx::Val( notificationsFiltered_dyn() ); }
+ break;
+ case 22:
+ if (HX_FIELD_EQ(inName,"prepareIncomingMessage") ) { return ::hx::Val( prepareIncomingMessage_dyn() ); }
+ break;
+ case 28:
+ if (HX_FIELD_EQ(inName,"getParticipantDetails__fromC") ) { return ::hx::Val( getParticipantDetails__fromC_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val Chat_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 6:
+ if (HX_FIELD_EQ(inName,"client") ) { client=inValue.Cast< ::snikket::Client >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"stream") ) { stream=inValue.Cast< ::snikket::GenericStream >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"chatId") ) { chatId=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"trusted") ) { trusted=inValue.Cast< bool >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"uiState") ) { uiState=inValue.Cast< int >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"presence") ) { presence=inValue.Cast< ::haxe::ds::StringMap >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"isTyping") ) { isTyping=inValue.Cast< bool >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"isActive") ) { isActive=inValue.Cast< ::Dynamic >(); return inValue; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"isBlocked") ) { isBlocked=inValue.Cast< bool >(); return inValue; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"avatarSha1") ) { avatarSha1=inValue.Cast< ::Array< unsigned char > >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"extensions") ) { extensions=inValue.Cast< ::snikket::Stanza >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"readUpToId") ) { readUpToId=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"readUpToBy") ) { readUpToBy=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"persistence") ) { persistence=inValue.Cast< ::Dynamic >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"displayName") ) { displayName=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"lastMessage") ) { lastMessage=inValue.Cast< ::snikket::ChatMessage >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"typingTimer") ) { typingTimer=inValue.Cast< ::haxe::Timer >(); return inValue; }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"_unreadCount") ) { _unreadCount=inValue.Cast< int >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"typingThread") ) { typingThread=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"activeThread") ) { activeThread=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"jingleSessions") ) { jingleSessions=inValue.Cast< ::haxe::ds::StringMap >(); return inValue; }
+ break;
+ case 20:
+ if (HX_FIELD_EQ(inName,"notificationSettings") ) { notificationSettings=inValue.Cast< ::Dynamic >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void Chat_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("client",4b,ca,4f,0a));
+ outFields->push(HX_("stream",80,14,2d,11));
+ outFields->push(HX_("persistence",5f,17,c4,f6));
+ outFields->push(HX_("avatarSha1",3e,f5,cc,3e));
+ outFields->push(HX_("presence",3b,52,d7,66));
+ outFields->push(HX_("trusted",f7,b7,a6,16));
+ outFields->push(HX_("chatId",d3,04,77,b7));
+ outFields->push(HX_("jingleSessions",ae,50,4d,15));
+ outFields->push(HX_("displayName",ad,11,f2,30));
+ outFields->push(HX_("uiState",1d,0f,01,14));
+ outFields->push(HX_("isBlocked",22,f8,fc,48));
+ outFields->push(HX_("extensions",14,7c,70,89));
+ outFields->push(HX_("_unreadCount",21,c6,fa,06));
+ outFields->push(HX_("lastMessage",11,ea,bc,4e));
+ outFields->push(HX_("readUpToId",27,7a,f8,75));
+ outFields->push(HX_("readUpToBy",23,74,f8,75));
+ outFields->push(HX_("isTyping",01,9a,a3,af));
+ outFields->push(HX_("typingThread",a1,a0,94,6b));
+ outFields->push(HX_("typingTimer",ce,61,a8,b7));
+ outFields->push(HX_("isActive",50,dd,af,6e));
+ outFields->push(HX_("activeThread",30,c9,d4,ee));
+ outFields->push(HX_("notificationSettings",ee,92,7b,79));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Chat_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::snikket::Client */ ,(int)offsetof(Chat_obj,client),HX_("client",4b,ca,4f,0a)},
+ {::hx::fsObject /* ::snikket::GenericStream */ ,(int)offsetof(Chat_obj,stream),HX_("stream",80,14,2d,11)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(Chat_obj,persistence),HX_("persistence",5f,17,c4,f6)},
+ {::hx::fsObject /* ::Array< unsigned char > */ ,(int)offsetof(Chat_obj,avatarSha1),HX_("avatarSha1",3e,f5,cc,3e)},
+ {::hx::fsObject /* ::haxe::ds::StringMap */ ,(int)offsetof(Chat_obj,presence),HX_("presence",3b,52,d7,66)},
+ {::hx::fsBool,(int)offsetof(Chat_obj,trusted),HX_("trusted",f7,b7,a6,16)},
+ {::hx::fsString,(int)offsetof(Chat_obj,chatId),HX_("chatId",d3,04,77,b7)},
+ {::hx::fsObject /* ::haxe::ds::StringMap */ ,(int)offsetof(Chat_obj,jingleSessions),HX_("jingleSessions",ae,50,4d,15)},
+ {::hx::fsString,(int)offsetof(Chat_obj,displayName),HX_("displayName",ad,11,f2,30)},
+ {::hx::fsInt,(int)offsetof(Chat_obj,uiState),HX_("uiState",1d,0f,01,14)},
+ {::hx::fsBool,(int)offsetof(Chat_obj,isBlocked),HX_("isBlocked",22,f8,fc,48)},
+ {::hx::fsObject /* ::snikket::Stanza */ ,(int)offsetof(Chat_obj,extensions),HX_("extensions",14,7c,70,89)},
+ {::hx::fsInt,(int)offsetof(Chat_obj,_unreadCount),HX_("_unreadCount",21,c6,fa,06)},
+ {::hx::fsObject /* ::snikket::ChatMessage */ ,(int)offsetof(Chat_obj,lastMessage),HX_("lastMessage",11,ea,bc,4e)},
+ {::hx::fsString,(int)offsetof(Chat_obj,readUpToId),HX_("readUpToId",27,7a,f8,75)},
+ {::hx::fsString,(int)offsetof(Chat_obj,readUpToBy),HX_("readUpToBy",23,74,f8,75)},
+ {::hx::fsBool,(int)offsetof(Chat_obj,isTyping),HX_("isTyping",01,9a,a3,af)},
+ {::hx::fsString,(int)offsetof(Chat_obj,typingThread),HX_("typingThread",a1,a0,94,6b)},
+ {::hx::fsObject /* ::haxe::Timer */ ,(int)offsetof(Chat_obj,typingTimer),HX_("typingTimer",ce,61,a8,b7)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(Chat_obj,isActive),HX_("isActive",50,dd,af,6e)},
+ {::hx::fsString,(int)offsetof(Chat_obj,activeThread),HX_("activeThread",30,c9,d4,ee)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(Chat_obj,notificationSettings),HX_("notificationSettings",ee,92,7b,79)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *Chat_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Chat_obj_sMemberFields[] = {
+ HX_("client",4b,ca,4f,0a),
+ HX_("stream",80,14,2d,11),
+ HX_("persistence",5f,17,c4,f6),
+ HX_("avatarSha1",3e,f5,cc,3e),
+ HX_("presence",3b,52,d7,66),
+ HX_("trusted",f7,b7,a6,16),
+ HX_("chatId",d3,04,77,b7),
+ HX_("chatId__fromC",06,fc,b1,94),
+ HX_("jingleSessions",ae,50,4d,15),
+ HX_("displayName",ad,11,f2,30),
+ HX_("uiState",1d,0f,01,14),
+ HX_("uiState__fromC",fc,2e,72,be),
+ HX_("isBlocked",22,f8,fc,48),
+ HX_("isBlocked__fromC",97,a0,b1,f6),
+ HX_("extensions",14,7c,70,89),
+ HX_("_unreadCount",21,c6,fa,06),
+ HX_("lastMessage",11,ea,bc,4e),
+ HX_("readUpToId",27,7a,f8,75),
+ HX_("readUpToBy",23,74,f8,75),
+ HX_("isTyping",01,9a,a3,af),
+ HX_("typingThread",a1,a0,94,6b),
+ HX_("typingTimer",ce,61,a8,b7),
+ HX_("isActive",50,dd,af,6e),
+ HX_("activeThread",30,c9,d4,ee),
+ HX_("notificationSettings",ee,92,7b,79),
+ HX_("prepareIncomingMessage",ba,eb,c6,e3),
+ HX_("getMessagesBefore",a1,f1,44,11),
+ HX_("getMessagesAfter",3a,43,91,57),
+ HX_("getMessagesAround",6f,95,16,2d),
+ HX_("fetchFromSync",3f,23,bd,b2),
+ HX_("sendMessage",5f,89,1d,24),
+ HX_("sendMessage__fromC",fa,60,3a,f3),
+ HX_("markReadUpTo",59,68,2d,ee),
+ HX_("markReadUpTo__fromC",40,b5,45,b3),
+ HX_("bookmark",b6,8c,f1,32),
+ HX_("bookmark__fromC",83,86,61,2e),
+ HX_("getParticipants",16,0b,c7,34),
+ HX_("getParticipantDetails",85,2b,7d,4d),
+ HX_("getParticipantDetails__fromC",94,ef,6f,ad),
+ HX_("correctMessage",7d,36,c3,f4),
+ HX_("correctMessage__fromC",9c,b3,3d,7c),
+ HX_("addReaction",ea,1e,11,28),
+ HX_("removeReaction",0d,24,0b,c1),
+ HX_("removeReaction__fromC",0c,98,dd,b6),
+ HX_("sendChatState",b1,21,95,6e),
+ HX_("typing",77,fe,39,57),
+ HX_("setActive",08,b7,ed,75),
+ HX_("close",b8,17,63,48),
+ HX_("close__fromC",c1,3f,6c,ef),
+ HX_("togglePinned",cc,b5,2e,2c),
+ HX_("block",4d,75,fc,b4),
+ HX_("unblock",54,6c,8d,b1),
+ HX_("setNotifications",26,ae,ef,ed),
+ HX_("notificationsFiltered",5f,11,ed,96),
+ HX_("notifyMention",21,c7,22,5a),
+ HX_("notifyReply",a1,e5,9f,37),
+ HX_("lastMessageId",4c,90,58,27),
+ HX_("lastMessageId__fromC",ad,c1,bf,bf),
+ HX_("lastMessageTimestamp",85,80,e9,17),
+ HX_("updateFromBookmark",e9,a3,15,4b),
+ HX_("updateFromRoster",fe,41,b5,57),
+ HX_("getPhoto",3c,d8,ca,21),
+ HX_("getPlaceholder",7d,c6,91,42),
+ HX_("readUpTo",2c,17,a3,75),
+ HX_("unreadCount",20,18,f1,a0),
+ HX_("setUnreadCount",9e,53,af,48),
+ HX_("preview",08,e0,da,3b),
+ HX_("setLastMessage",8f,25,7b,f6),
+ HX_("setDisplayName",2b,4d,b0,d8),
+ HX_("getDisplayName",b7,64,90,b8),
+ HX_("setPresence",fd,1b,38,97),
+ HX_("setCaps",e3,5c,3e,07),
+ HX_("removePresence",9f,8e,2d,31),
+ HX_("getCaps",d7,cb,3c,14),
+ HX_("getResourceCaps",c5,79,07,ac),
+ HX_("setAvatarSha1",80,33,45,e0),
+ HX_("setTrusted",75,dc,85,69),
+ HX_("isTrusted",2d,35,a5,1a),
+ HX_("livePresence",47,f9,16,b4),
+ HX_("syncing",67,fd,26,a7),
+ HX_("canAudioCall",64,4a,90,e4),
+ HX_("canVideoCall",89,1c,93,ea),
+ HX_("startCall",20,92,ad,fa),
+ HX_("addMedia",03,2b,19,7f),
+ HX_("acceptCall",c6,fb,13,b5),
+ HX_("hangup",4d,d2,ff,b7),
+ HX_("callStatus",70,be,2b,31),
+ HX_("dtmf",e9,ba,71,42),
+ HX_("videoTracks",63,c2,24,be),
+ HX_("markReadUpToId",94,30,9b,e2),
+ HX_("markReadUpToMessage",6e,a2,bb,a9),
+ HX_("publishMds",ed,c6,cd,70),
+ ::String(null()) };
+
+::hx::Class Chat_obj::__mClass;
+
+void Chat_obj::__register()
+{
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.Chat",89,04,7d,4c);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Chat_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Chat_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Chat_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Chat_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void Chat_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_3993c1e3d3f53fe2_43_boot)
+HXDLIN( 43) __mClass->__meta__ = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("fields",79,8e,8e,80), ::Dynamic(::hx::Anon_obj::Create(30)
+ ->setFixed(0,HX_("getParticipants__fromC",23,94,42,88), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(1,HX_("chatId__fromC",06,fc,b1,94), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(2,HX_("getParticipantDetails__fromC",94,ef,6f,ad), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(3,HX_("markReadUpTo__fromC",40,b5,45,b3), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(4,HX_("removeReaction__fromC",0c,98,dd,b6), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(5,HX_("videoTracks",63,c2,24,be), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(6,HX_("uiState__fromC",fc,2e,72,be), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(7,HX_("lastMessageId__fromC",ad,c1,bf,bf), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(8,HX_("removeReaction",0d,24,0b,c1), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(9,HX_("getMessagesAfter__fromC",7f,68,c7,c6), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(10,HX_("videoTracks__fromC",76,10,46,d8), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(11,HX_("getMessagesAround__fromC",ea,f6,e1,db), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(12,HX_("markReadUpTo",59,68,2d,ee), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(13,HX_("close__fromC",c1,3f,6c,ef), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(14,HX_("sendMessage__fromC",fa,60,3a,f3), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(15,HX_("correctMessage",7d,36,c3,f4), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(16,HX_("isBlocked__fromC",97,a0,b1,f6), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(17,HX_("getMessagesBefore",a1,f1,44,11), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(18,HX_("sendMessage",5f,89,1d,24), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(19,HX_("lastMessageId",4c,90,58,27), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(20,HX_("getMessagesAround",6f,95,16,2d), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(21,HX_("bookmark__fromC",83,86,61,2e), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(22,HX_("bookmark",b6,8c,f1,32), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(23,HX_("getParticipants",16,0b,c7,34), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(24,HX_("getMessagesBefore__fromC",f8,64,51,46), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(25,HX_("close",b8,17,63,48), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(26,HX_("getParticipantDetails",85,2b,7d,4d), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(27,HX_("getMessagesAfter",3a,43,91,57), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(28,HX_("correctMessage__fromC",9c,b3,3d,7c), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(29,HX_("addMedia",03,2b,19,7f), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null()))))));
+ }
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/ChatAttachment.cpp b/Sources/c_snikket/src/snikket/ChatAttachment.cpp
new file mode 100644
index 0000000..e94b45b
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/ChatAttachment.cpp
@@ -0,0 +1,359 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED__HaxeCBridge_Internal
+#include <_HaxeCBridge/Internal.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_IntMap
+#include <haxe/ds/IntMap.h>
+#endif
+#ifndef INCLUDED_snikket_ChatAttachment
+#include <snikket/ChatAttachment.h>
+#endif
+#ifndef INCLUDED_snikket_Hash
+#include <snikket/Hash.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_ca1a43507843787c_45_new,"snikket.ChatAttachment","new",0x546decbe,"snikket.ChatAttachment.new","snikket/ChatMessage.hx",45,0x79a8b101)
+HX_LOCAL_STACK_FRAME(_hx_pos_78db3de7bf8d6ae8_307_name__fromC,"snikket.ChatAttachment","name__fromC",0xe8a157ec,"snikket.ChatAttachment.name__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_78db3de7bf8d6ae8_307_mime__fromC,"snikket.ChatAttachment","mime__fromC",0x6a16aba3,"snikket.ChatAttachment.mime__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_78db3de7bf8d6ae8_307_size__fromC,"snikket.ChatAttachment","size__fromC",0x258f8436,"snikket.ChatAttachment.size__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_78db3de7bf8d6ae8_297_uris__fromC,"snikket.ChatAttachment","uris__fromC",0x08a4d630,"snikket.ChatAttachment.uris__fromC","HaxeCBridge.hx",297,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_78db3de7bf8d6ae8_297_hashes__fromC,"snikket.ChatAttachment","hashes__fromC",0x7bbb061b,"snikket.ChatAttachment.hashes__fromC","HaxeCBridge.hx",297,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_ca1a43507843787c_55_create,"snikket.ChatAttachment","create",0xf450d95e,"snikket.ChatAttachment.create","snikket/ChatMessage.hx",55,0x79a8b101)
+HX_LOCAL_STACK_FRAME(_hx_pos_ca1a43507843787c_32_boot,"snikket.ChatAttachment","boot",0x83da3a14,"snikket.ChatAttachment.boot","snikket/ChatMessage.hx",32,0x79a8b101)
+namespace snikket{
+
+void ChatAttachment_obj::__construct(::String name,::String mime, ::Dynamic size,::Array< ::String > uris,::Array< ::Dynamic> hashes){
+ HX_STACKFRAME(&_hx_pos_ca1a43507843787c_45_new)
+HXLINE( 46) this->name = name;
+HXLINE( 47) this->mime = mime;
+HXLINE( 48) this->size = size;
+HXLINE( 49) this->uris = uris;
+HXLINE( 50) this->hashes = hashes;
+ }
+
+Dynamic ChatAttachment_obj::__CreateEmpty() { return new ChatAttachment_obj; }
+
+void *ChatAttachment_obj::_hx_vtable = 0;
+
+Dynamic ChatAttachment_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< ChatAttachment_obj > _hx_result = new ChatAttachment_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4]);
+ return _hx_result;
+}
+
+bool ChatAttachment_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x2f907f78;
+}
+
+::String ChatAttachment_obj::name__fromC(){
+ HX_STACKFRAME(&_hx_pos_78db3de7bf8d6ae8_307_name__fromC)
+HXDLIN( 307) return this->name;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatAttachment_obj,name__fromC,return )
+
+::String ChatAttachment_obj::mime__fromC(){
+ HX_STACKFRAME(&_hx_pos_78db3de7bf8d6ae8_307_mime__fromC)
+HXDLIN( 307) return this->mime;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatAttachment_obj,mime__fromC,return )
+
+ ::Dynamic ChatAttachment_obj::size__fromC(){
+ HX_STACKFRAME(&_hx_pos_78db3de7bf8d6ae8_307_size__fromC)
+HXDLIN( 307) return this->size;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatAttachment_obj,size__fromC,return )
+
+size_t ChatAttachment_obj::uris__fromC(const char*** outPtr){
+ HX_GC_STACKFRAME(&_hx_pos_78db3de7bf8d6ae8_297_uris__fromC)
+HXDLIN( 297) ::Array< ::String > x = this->uris;
+HXDLIN( 297) if (::hx::IsNotNull( outPtr )) {
+HXDLIN( 297) ::cpp::Pointer< const char** > _hx_tmp = ::cpp::Pointer_obj::fromRaw(outPtr);
+HXDLIN( 297) ::Array< ::String > x1 = x;
+HXDLIN( 297) ::Array< size_t > arr = ::Array_obj< size_t >::__new(x1->length);
+HXDLIN( 297) {
+HXDLIN( 297) int _g_current = 0;
+HXDLIN( 297) ::Array< ::String > _g_array = x1;
+HXDLIN( 297) while((_g_current < _g_array->length)){
+HXDLIN( 297) ::String _g_value = _g_array->__get(_g_current);
+HXDLIN( 297) _g_current = (_g_current + 1);
+HXDLIN( 297) int _g_key = (_g_current - 1);
+HXDLIN( 297) int i = _g_key;
+HXDLIN( 297) ::String el = _g_value;
+HXDLIN( 297) {
+HXDLIN( 297) const char* cStrPtr = el.utf8_str();
+HXDLIN( 297) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(cStrPtr);
+HXDLIN( 297) {
+HXDLIN( 297) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 297) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 297) int high = ptrInt64 >> 32;
+HXDLIN( 297) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 297) if (::hx::IsNull( highMap )) {
+HXLINE(2083) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXLINE( 297) this1->set(low,highMap);
+ }
+HXDLIN( 297) highMap->set(high,el);
+ }
+HXDLIN( 297) const char* ptr = cStrPtr;
+HXDLIN( 297) arr[i] = reinterpret_cast<size_t>(ptr);
+ }
+ }
+ }
+HXDLIN( 297) void** ptr1 = (void**)arr->getBase();
+HXDLIN( 297) ::cpp::Int64 ptrInt641 = reinterpret_cast<int64_t>(ptr1);
+HXDLIN( 297) {
+HXDLIN( 297) ::haxe::ds::IntMap this2 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 297) int low1 = ptrInt641 & 0xffffffff;
+HXDLIN( 297) int high1 = ptrInt641 >> 32;
+HXDLIN( 297) ::haxe::ds::IntMap highMap1 = ( ( ::haxe::ds::IntMap)(this2->get(low1)) );
+HXDLIN( 297) if (::hx::IsNull( highMap1 )) {
+HXLINE(2083) highMap1 = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXLINE( 297) this2->set(low1,highMap1);
+ }
+HXDLIN( 297) highMap1->set(high1,arr);
+ }
+HXDLIN( 297) _hx_tmp->set_ref(( (const char**)(ptr1) ));
+ }
+HXDLIN( 297) return ( (size_t)(x->length) );
+ }
+
+
+size_t ChatAttachment_obj::hashes__fromC(void*** outPtr){
+ HX_GC_STACKFRAME(&_hx_pos_78db3de7bf8d6ae8_297_hashes__fromC)
+HXDLIN( 297) ::Array< ::Dynamic> x = this->hashes;
+HXDLIN( 297) if (::hx::IsNotNull( outPtr )) {
+HXDLIN( 297) ::cpp::Pointer< void** > _hx_tmp = ::cpp::Pointer_obj::fromRaw(outPtr);
+HXDLIN( 297) ::Array< ::Dynamic> x1 = x;
+HXDLIN( 297) {
+HXDLIN( 297) int _g = 0;
+HXDLIN( 297) while((_g < x1->length)){
+HXDLIN( 297) ::snikket::Hash el = x1->__get(_g).StaticCast< ::snikket::Hash >();
+HXDLIN( 297) _g = (_g + 1);
+HXDLIN( 297) {
+HXDLIN( 297) ::Dynamic haxeObject = el;
+HXDLIN( 297) void* ptr = haxeObject.mPtr;
+HXDLIN( 297) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(ptr);
+HXDLIN( 297) {
+HXDLIN( 297) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 297) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 297) int high = ptrInt64 >> 32;
+HXDLIN( 297) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 297) if (::hx::IsNull( highMap )) {
+HXDLIN( 297) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 297) this1->set(low,highMap);
+ }
+HXDLIN( 297) highMap->set(high,haxeObject);
+ }
+ }
+ }
+ }
+HXDLIN( 297) void** ptr1 = (void**)x1->getBase();
+HXDLIN( 297) ::cpp::Int64 ptrInt641 = reinterpret_cast<int64_t>(ptr1);
+HXDLIN( 297) {
+HXDLIN( 297) ::haxe::ds::IntMap this2 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 297) int low1 = ptrInt641 & 0xffffffff;
+HXDLIN( 297) int high1 = ptrInt641 >> 32;
+HXDLIN( 297) ::haxe::ds::IntMap highMap1 = ( ( ::haxe::ds::IntMap)(this2->get(low1)) );
+HXDLIN( 297) if (::hx::IsNull( highMap1 )) {
+HXDLIN( 297) highMap1 = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 297) this2->set(low1,highMap1);
+ }
+HXDLIN( 297) highMap1->set(high1,x1);
+ }
+HXDLIN( 297) _hx_tmp->set_ref(ptr1);
+ }
+HXDLIN( 297) return ( (size_t)(x->length) );
+ }
+
+
+ ::snikket::ChatAttachment ChatAttachment_obj::create(::String name,::String mime,int size,::String uri){
+ HX_GC_STACKFRAME(&_hx_pos_ca1a43507843787c_55_create)
+HXDLIN( 55) ::Dynamic _hx_tmp;
+HXDLIN( 55) if ((size > 0)) {
+HXDLIN( 55) _hx_tmp = size;
+ }
+ else {
+HXDLIN( 55) _hx_tmp = null();
+ }
+HXDLIN( 55) return ::snikket::ChatAttachment_obj::__alloc( HX_CTX ,name,mime,_hx_tmp,::Array_obj< ::String >::__new(1)->init(0,uri),::Array_obj< ::Dynamic>::__new(0));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC4(ChatAttachment_obj,create,return )
+
+
+::hx::ObjectPtr< ChatAttachment_obj > ChatAttachment_obj::__new(::String name,::String mime, ::Dynamic size,::Array< ::String > uris,::Array< ::Dynamic> hashes) {
+ ::hx::ObjectPtr< ChatAttachment_obj > __this = new ChatAttachment_obj();
+ __this->__construct(name,mime,size,uris,hashes);
+ return __this;
+}
+
+::hx::ObjectPtr< ChatAttachment_obj > ChatAttachment_obj::__alloc(::hx::Ctx *_hx_ctx,::String name,::String mime, ::Dynamic size,::Array< ::String > uris,::Array< ::Dynamic> hashes) {
+ ChatAttachment_obj *__this = (ChatAttachment_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(ChatAttachment_obj), true, "snikket.ChatAttachment"));
+ *(void **)__this = ChatAttachment_obj::_hx_vtable;
+ __this->__construct(name,mime,size,uris,hashes);
+ return __this;
+}
+
+ChatAttachment_obj::ChatAttachment_obj()
+{
+}
+
+void ChatAttachment_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(ChatAttachment);
+ HX_MARK_MEMBER_NAME(name,"name");
+ HX_MARK_MEMBER_NAME(mime,"mime");
+ HX_MARK_MEMBER_NAME(size,"size");
+ HX_MARK_MEMBER_NAME(uris,"uris");
+ HX_MARK_MEMBER_NAME(hashes,"hashes");
+ HX_MARK_END_CLASS();
+}
+
+void ChatAttachment_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(name,"name");
+ HX_VISIT_MEMBER_NAME(mime,"mime");
+ HX_VISIT_MEMBER_NAME(size,"size");
+ HX_VISIT_MEMBER_NAME(uris,"uris");
+ HX_VISIT_MEMBER_NAME(hashes,"hashes");
+}
+
+::hx::Val ChatAttachment_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"name") ) { return ::hx::Val( name ); }
+ if (HX_FIELD_EQ(inName,"mime") ) { return ::hx::Val( mime ); }
+ if (HX_FIELD_EQ(inName,"size") ) { return ::hx::Val( size ); }
+ if (HX_FIELD_EQ(inName,"uris") ) { return ::hx::Val( uris ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"hashes") ) { return ::hx::Val( hashes ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"name__fromC") ) { return ::hx::Val( name__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"mime__fromC") ) { return ::hx::Val( mime__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"size__fromC") ) { return ::hx::Val( size__fromC_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool ChatAttachment_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 6:
+ if (HX_FIELD_EQ(inName,"create") ) { outValue = create_dyn(); return true; }
+ }
+ return false;
+}
+
+::hx::Val ChatAttachment_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"name") ) { name=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"mime") ) { mime=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"size") ) { size=inValue.Cast< ::Dynamic >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"uris") ) { uris=inValue.Cast< ::Array< ::String > >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"hashes") ) { hashes=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void ChatAttachment_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("name",4b,72,ff,48));
+ outFields->push(HX_("mime",b4,4d,5c,48));
+ outFields->push(HX_("size",c1,a0,53,4c));
+ outFields->push(HX_("uris",87,d3,ac,4d));
+ outFields->push(HX_("hashes",bc,97,4e,bb));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo ChatAttachment_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(ChatAttachment_obj,name),HX_("name",4b,72,ff,48)},
+ {::hx::fsString,(int)offsetof(ChatAttachment_obj,mime),HX_("mime",b4,4d,5c,48)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(ChatAttachment_obj,size),HX_("size",c1,a0,53,4c)},
+ {::hx::fsObject /* ::Array< ::String > */ ,(int)offsetof(ChatAttachment_obj,uris),HX_("uris",87,d3,ac,4d)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(ChatAttachment_obj,hashes),HX_("hashes",bc,97,4e,bb)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *ChatAttachment_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String ChatAttachment_obj_sMemberFields[] = {
+ HX_("name",4b,72,ff,48),
+ HX_("name__fromC",8e,ad,66,0e),
+ HX_("mime",b4,4d,5c,48),
+ HX_("mime__fromC",45,01,dc,8f),
+ HX_("size",c1,a0,53,4c),
+ HX_("size__fromC",d8,d9,54,4b),
+ HX_("uris",87,d3,ac,4d),
+ HX_("hashes",bc,97,4e,bb),
+ ::String(null()) };
+
+::hx::Class ChatAttachment_obj::__mClass;
+
+static ::String ChatAttachment_obj_sStaticFields[] = {
+ HX_("create",fc,66,0f,7c),
+ ::String(null())
+};
+
+void ChatAttachment_obj::__register()
+{
+ ChatAttachment_obj _hx_dummy;
+ ChatAttachment_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.ChatAttachment",cc,75,95,ef);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &ChatAttachment_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(ChatAttachment_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(ChatAttachment_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< ChatAttachment_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = ChatAttachment_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = ChatAttachment_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void ChatAttachment_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_ca1a43507843787c_32_boot)
+HXDLIN( 32) __mClass->__meta__ = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("fields",79,8e,8e,80), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("mime__fromC",45,01,dc,8f), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(1,HX_("hashes__fromC",3d,88,ba,9d), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(2,HX_("name__fromC",8e,ad,66,0e), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(3,HX_("uris__fromC",d2,2b,6a,2e), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(4,HX_("size__fromC",d8,d9,54,4b), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null()))))));
+ }
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/ChatMessage.cpp b/Sources/c_snikket/src/snikket/ChatMessage.cpp
new file mode 100644
index 0000000..d412501
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/ChatMessage.cpp
@@ -0,0 +1,1780 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_EReg
+#include <EReg.h>
+#endif
+#ifndef INCLUDED_Lambda
+#include <Lambda.h>
+#endif
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_StringTools
+#include <StringTools.h>
+#endif
+#ifndef INCLUDED__HaxeCBridge_Internal
+#include <_HaxeCBridge/Internal.h>
+#endif
+#ifndef INCLUDED_datetime__DateTimeInterval_DateTimeInterval_Impl_
+#include <datetime/_DateTimeInterval/DateTimeInterval_Impl_.h>
+#endif
+#ifndef INCLUDED_datetime_cores_DateTimeIntervalCore
+#include <datetime/cores/DateTimeIntervalCore.h>
+#endif
+#ifndef INCLUDED_datetime_utils_DateTimeIntervalUtils
+#include <datetime/utils/DateTimeIntervalUtils.h>
+#endif
+#ifndef INCLUDED_datetime_utils_DateTimeUtils
+#include <datetime/utils/DateTimeUtils.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_crypto_Base64
+#include <haxe/crypto/Base64.h>
+#endif
+#ifndef INCLUDED_haxe_ds_IntMap
+#include <haxe/ds/IntMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_StringMap
+#include <haxe/ds/StringMap.h>
+#endif
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+#ifndef INCLUDED_snikket_ChatAttachment
+#include <snikket/ChatAttachment.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessage
+#include <snikket/ChatMessage.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessageBuilder
+#include <snikket/ChatMessageBuilder.h>
+#endif
+#ifndef INCLUDED_snikket_EmojiUtil
+#include <snikket/EmojiUtil.h>
+#endif
+#ifndef INCLUDED_snikket_Hash
+#include <snikket/Hash.h>
+#endif
+#ifndef INCLUDED_snikket_ID
+#include <snikket/ID.h>
+#endif
+#ifndef INCLUDED_snikket_Identicon
+#include <snikket/Identicon.h>
+#endif
+#ifndef INCLUDED_snikket_JID
+#include <snikket/JID.h>
+#endif
+#ifndef INCLUDED_snikket_Message
+#include <snikket/Message.h>
+#endif
+#ifndef INCLUDED_snikket_MessageStanza
+#include <snikket/MessageStanza.h>
+#endif
+#ifndef INCLUDED_snikket_Node
+#include <snikket/Node.h>
+#endif
+#ifndef INCLUDED_snikket_Reaction
+#include <snikket/Reaction.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket_StringUtil
+#include <snikket/StringUtil.h>
+#endif
+#ifndef INCLUDED_snikket_XEP0393
+#include <snikket/XEP0393.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_b3673a050e0c4d12_190_new,"snikket.ChatMessage","new",0x32c68430,"snikket.ChatMessage.new","snikket/ChatMessage.hx",190,0x79a8b101)
+HX_LOCAL_STACK_FRAME(_hx_pos_672f2a9d33b9a067_307_localId__fromC,"snikket.ChatMessage","localId__fromC",0xd3c36543,"snikket.ChatMessage.localId__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_672f2a9d33b9a067_307_serverId__fromC,"snikket.ChatMessage","serverId__fromC",0xdb59e68b,"snikket.ChatMessage.serverId__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_672f2a9d33b9a067_307_serverIdBy__fromC,"snikket.ChatMessage","serverIdBy__fromC",0xd54611f4,"snikket.ChatMessage.serverIdBy__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_672f2a9d33b9a067_307_type__fromC,"snikket.ChatMessage","type__fromC",0xb86faccf,"snikket.ChatMessage.type__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_672f2a9d33b9a067_307_timestamp__fromC,"snikket.ChatMessage","timestamp__fromC",0xe3f8ac93,"snikket.ChatMessage.timestamp__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_672f2a9d33b9a067_307_senderId__fromC,"snikket.ChatMessage","senderId__fromC",0x24e23b59,"snikket.ChatMessage.senderId__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_672f2a9d33b9a067_271_replyToMessage__fromC,"snikket.ChatMessage","replyToMessage__fromC",0x89f44d87,"snikket.ChatMessage.replyToMessage__fromC","HaxeCBridge.hx",271,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_672f2a9d33b9a067_307_threadId__fromC,"snikket.ChatMessage","threadId__fromC",0xd31afda4,"snikket.ChatMessage.threadId__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_672f2a9d33b9a067_297_attachments__fromC,"snikket.ChatMessage","attachments__fromC",0xb2a7ed79,"snikket.ChatMessage.attachments__fromC","HaxeCBridge.hx",297,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_672f2a9d33b9a067_307_text__fromC,"snikket.ChatMessage","text__fromC",0xa41e473c,"snikket.ChatMessage.text__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_672f2a9d33b9a067_307_lang__fromC,"snikket.ChatMessage","lang__fromC",0x7703281b,"snikket.ChatMessage.lang__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_672f2a9d33b9a067_307_direction__fromC,"snikket.ChatMessage","direction__fromC",0x58338e4a,"snikket.ChatMessage.direction__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_672f2a9d33b9a067_307_status__fromC,"snikket.ChatMessage","status__fromC",0x4fcd4b57,"snikket.ChatMessage.status__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_672f2a9d33b9a067_318_set_status__fromC,"snikket.ChatMessage","set_status__fromC",0x9e1b56ba,"snikket.ChatMessage.set_status__fromC","HaxeCBridge.hx",318,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_672f2a9d33b9a067_297_versions__fromC,"snikket.ChatMessage","versions__fromC",0x6e819f4e,"snikket.ChatMessage.versions__fromC","HaxeCBridge.hx",297,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_b3673a050e0c4d12_229_reply,"snikket.ChatMessage","reply",0xa22950fa,"snikket.ChatMessage.reply","snikket/ChatMessage.hx",229,0x79a8b101)
+HX_LOCAL_STACK_FRAME(_hx_pos_b3673a050e0c4d12_237_getReplyId,"snikket.ChatMessage","getReplyId",0x993253df,"snikket.ChatMessage.getReplyId","snikket/ChatMessage.hx",237,0x79a8b101)
+HX_LOCAL_STACK_FRAME(_hx_pos_b3673a050e0c4d12_243_set_replyToMessage,"snikket.ChatMessage","set_replyToMessage",0x0059f86f,"snikket.ChatMessage.set_replyToMessage","snikket/ChatMessage.hx",243,0x79a8b101)
+HX_LOCAL_STACK_FRAME(_hx_pos_b3673a050e0c4d12_252_set_reactions,"snikket.ChatMessage","set_reactions",0x9ca71a5d,"snikket.ChatMessage.set_reactions","snikket/ChatMessage.hx",252,0x79a8b101)
+HX_LOCAL_STACK_FRAME(_hx_pos_b3673a050e0c4d12_253_set_reactions,"snikket.ChatMessage","set_reactions",0x9ca71a5d,"snikket.ChatMessage.set_reactions","snikket/ChatMessage.hx",253,0x79a8b101)
+HX_LOCAL_STACK_FRAME(_hx_pos_b3673a050e0c4d12_260_inlineHashReferences,"snikket.ChatMessage","inlineHashReferences",0xd9e9761f,"snikket.ChatMessage.inlineHashReferences","snikket/ChatMessage.hx",260,0x79a8b101)
+HX_LOCAL_STACK_FRAME(_hx_pos_b3673a050e0c4d12_258_inlineHashReferences,"snikket.ChatMessage","inlineHashReferences",0xd9e9761f,"snikket.ChatMessage.inlineHashReferences","snikket/ChatMessage.hx",258,0x79a8b101)
+HX_LOCAL_STACK_FRAME(_hx_pos_b3673a050e0c4d12_262_inlineHashReferences,"snikket.ChatMessage","inlineHashReferences",0xd9e9761f,"snikket.ChatMessage.inlineHashReferences","snikket/ChatMessage.hx",262,0x79a8b101)
+HX_LOCAL_STACK_FRAME(_hx_pos_b3673a050e0c4d12_287_html,"snikket.ChatMessage","html",0x3701379b,"snikket.ChatMessage.html","snikket/ChatMessage.hx",287,0x79a8b101)
+HX_LOCAL_STACK_FRAME(_hx_pos_b3673a050e0c4d12_312_html,"snikket.ChatMessage","html",0x3701379b,"snikket.ChatMessage.html","snikket/ChatMessage.hx",312,0x79a8b101)
+HX_LOCAL_STACK_FRAME(_hx_pos_b3673a050e0c4d12_317_html,"snikket.ChatMessage","html",0x3701379b,"snikket.ChatMessage.html","snikket/ChatMessage.hx",317,0x79a8b101)
+HX_LOCAL_STACK_FRAME(_hx_pos_b3673a050e0c4d12_286_html,"snikket.ChatMessage","html",0x3701379b,"snikket.ChatMessage.html","snikket/ChatMessage.hx",286,0x79a8b101)
+HX_LOCAL_STACK_FRAME(_hx_pos_b3673a050e0c4d12_289_html,"snikket.ChatMessage","html",0x3701379b,"snikket.ChatMessage.html","snikket/ChatMessage.hx",289,0x79a8b101)
+HX_LOCAL_STACK_FRAME(_hx_pos_b3673a050e0c4d12_324_chatId,"snikket.ChatMessage","chatId",0xf2f29303,"snikket.ChatMessage.chatId","snikket/ChatMessage.hx",324,0x79a8b101)
+HX_LOCAL_STACK_FRAME(_hx_pos_b3673a050e0c4d12_335_account,"snikket.ChatMessage","account",0x71fad87d,"snikket.ChatMessage.account","snikket/ChatMessage.hx",335,0x79a8b101)
+HX_LOCAL_STACK_FRAME(_hx_pos_b3673a050e0c4d12_342_isIncoming,"snikket.ChatMessage","isIncoming",0x345ab920,"snikket.ChatMessage.isIncoming","snikket/ChatMessage.hx",342,0x79a8b101)
+HX_LOCAL_STACK_FRAME(_hx_pos_b3673a050e0c4d12_349_threadIcon,"snikket.ChatMessage","threadIcon",0xe0122193,"snikket.ChatMessage.threadIcon","snikket/ChatMessage.hx",349,0x79a8b101)
+HX_LOCAL_STACK_FRAME(_hx_pos_b3673a050e0c4d12_356_callStatus,"snikket.ChatMessage","callStatus",0xcfc224a0,"snikket.ChatMessage.callStatus","snikket/ChatMessage.hx",356,0x79a8b101)
+HX_LOCAL_STACK_FRAME(_hx_pos_b3673a050e0c4d12_363_callSid,"snikket.ChatMessage","callSid",0x24f4d0e0,"snikket.ChatMessage.callSid","snikket/ChatMessage.hx",363,0x79a8b101)
+HX_LOCAL_STACK_FRAME(_hx_pos_b3673a050e0c4d12_369_callDuration,"snikket.ChatMessage","callDuration",0x8a710442,"snikket.ChatMessage.callDuration","snikket/ChatMessage.hx",369,0x79a8b101)
+HX_LOCAL_STACK_FRAME(_hx_pos_b3673a050e0c4d12_393_asStanza,"snikket.ChatMessage","asStanza",0x50ece2b7,"snikket.ChatMessage.asStanza","snikket/ChatMessage.hx",393,0x79a8b101)
+HX_LOCAL_STACK_FRAME(_hx_pos_b3673a050e0c4d12_440_asStanza,"snikket.ChatMessage","asStanza",0x50ece2b7,"snikket.ChatMessage.asStanza","snikket/ChatMessage.hx",440,0x79a8b101)
+HX_LOCAL_STACK_FRAME(_hx_pos_b3673a050e0c4d12_218_fromStanza,"snikket.ChatMessage","fromStanza",0xe7d1c92f,"snikket.ChatMessage.fromStanza","snikket/ChatMessage.hx",218,0x79a8b101)
+HX_LOCAL_STACK_FRAME(_hx_pos_b3673a050e0c4d12_66_boot,"snikket.ChatMessage","boot",0x33062662,"snikket.ChatMessage.boot","snikket/ChatMessage.hx",66,0x79a8b101)
+namespace snikket{
+
+void ChatMessage_obj::__construct( ::Dynamic params){
+ HX_GC_STACKFRAME(&_hx_pos_b3673a050e0c4d12_190_new)
+HXLINE( 191) this->localId = ( (::String)(params->__Field(HX_("localId",26,7a,c6,2d),::hx::paccDynamic)) );
+HXLINE( 192) this->serverId = ( (::String)(params->__Field(HX_("serverId",7e,01,b2,e2),::hx::paccDynamic)) );
+HXLINE( 193) this->serverIdBy = ( (::String)(params->__Field(HX_("serverIdBy",f5,16,54,74),::hx::paccDynamic)) );
+HXLINE( 194) ::Dynamic tmp = params->__Field(HX_("type",ba,f2,08,4d),::hx::paccDynamic);
+HXDLIN( 194) int _hx_tmp;
+HXDLIN( 194) if (::hx::IsNotNull( tmp )) {
+HXLINE( 194) _hx_tmp = ( (int)(tmp) );
+ }
+ else {
+HXLINE( 194) _hx_tmp = 0;
+ }
+HXDLIN( 194) this->type = _hx_tmp;
+HXLINE( 195) ::Dynamic tmp1 = params->__Field(HX_("syncPoint",f5,ff,94,98),::hx::paccDynamic);
+HXDLIN( 195) bool _hx_tmp1;
+HXDLIN( 195) if (::hx::IsNotNull( tmp1 )) {
+HXLINE( 195) _hx_tmp1 = ( (bool)(tmp1) );
+ }
+ else {
+HXLINE( 195) _hx_tmp1 = false;
+ }
+HXDLIN( 195) this->syncPoint = _hx_tmp1;
+HXLINE( 196) this->replyId = ( (::String)(params->__Field(HX_("replyId",a5,67,3a,ab),::hx::paccDynamic)) );
+HXLINE( 197) this->timestamp = ( (::String)(params->__Field(HX_("timestamp",d6,d4,ce,a5),::hx::paccDynamic)) );
+HXLINE( 198) this->to = ( ( ::snikket::JID)(params->__Field(HX_("to",7b,65,00,00),::hx::paccDynamic)) );
+HXLINE( 199) this->from = ( ( ::snikket::JID)(params->__Field(HX_("from",6a,a5,c2,43),::hx::paccDynamic)) );
+HXLINE( 200) this->senderId = ( (::String)(params->__Field(HX_("senderId",f0,1e,0e,ec),::hx::paccDynamic)) );
+HXLINE( 201) ::Array< ::Dynamic> tmp2 = ( (::Array< ::Dynamic>)(params->__Field(HX_("recipients",7a,62,59,87),::hx::paccDynamic)) );
+HXDLIN( 201) ::Array< ::Dynamic> _hx_tmp2;
+HXDLIN( 201) if (::hx::IsNotNull( tmp2 )) {
+HXLINE( 201) _hx_tmp2 = tmp2;
+ }
+ else {
+HXLINE( 201) _hx_tmp2 = ::Array_obj< ::Dynamic>::__new(0);
+ }
+HXDLIN( 201) this->recipients = _hx_tmp2;
+HXLINE( 202) ::Array< ::Dynamic> tmp3 = ( (::Array< ::Dynamic>)(params->__Field(HX_("replyTo",45,71,3a,ab),::hx::paccDynamic)) );
+HXDLIN( 202) ::Array< ::Dynamic> _hx_tmp3;
+HXDLIN( 202) if (::hx::IsNotNull( tmp3 )) {
+HXLINE( 202) _hx_tmp3 = tmp3;
+ }
+ else {
+HXLINE( 202) _hx_tmp3 = ::Array_obj< ::Dynamic>::__new(0);
+ }
+HXDLIN( 202) this->replyTo = _hx_tmp3;
+HXLINE( 203) this->replyToMessage = ( ( ::snikket::ChatMessage)(params->__Field(HX_("replyToMessage",02,cf,60,a6),::hx::paccDynamic)) );
+HXLINE( 204) this->threadId = ( (::String)(params->__Field(HX_("threadId",45,81,25,cc),::hx::paccDynamic)) );
+HXLINE( 205) ::Array< ::Dynamic> tmp4 = ( (::Array< ::Dynamic>)(params->__Field(HX_("attachments",30,df,33,e7),::hx::paccDynamic)) );
+HXDLIN( 205) ::Array< ::Dynamic> _hx_tmp4;
+HXDLIN( 205) if (::hx::IsNotNull( tmp4 )) {
+HXLINE( 205) _hx_tmp4 = tmp4;
+ }
+ else {
+HXLINE( 205) _hx_tmp4 = ::Array_obj< ::Dynamic>::__new(0);
+ }
+HXDLIN( 205) this->attachments = _hx_tmp4;
+HXLINE( 206) ::haxe::ds::StringMap tmp5 = ( ( ::haxe::ds::StringMap)(params->__Field(HX_("reactions",aa,cc,95,e7),::hx::paccDynamic)) );
+HXDLIN( 206) ::haxe::ds::StringMap _hx_tmp5;
+HXDLIN( 206) if (::hx::IsNotNull( tmp5 )) {
+HXLINE( 206) _hx_tmp5 = tmp5;
+ }
+ else {
+HXLINE( 206) _hx_tmp5 = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+ }
+HXDLIN( 206) this->reactions = _hx_tmp5;
+HXLINE( 207) this->text = ( (::String)(params->__Field(HX_("text",ad,cc,f9,4c),::hx::paccDynamic)) );
+HXLINE( 208) this->lang = ( (::String)(params->__Field(HX_("lang",ee,05,ad,47),::hx::paccDynamic)) );
+HXLINE( 209) ::Dynamic tmp6 = params->__Field(HX_("direction",3f,62,40,10),::hx::paccDynamic);
+HXDLIN( 209) int _hx_tmp6;
+HXDLIN( 209) if (::hx::IsNotNull( tmp6 )) {
+HXLINE( 209) _hx_tmp6 = ( (int)(tmp6) );
+ }
+ else {
+HXLINE( 209) _hx_tmp6 = 1;
+ }
+HXDLIN( 209) this->direction = _hx_tmp6;
+HXLINE( 210) ::Dynamic tmp7 = params->__Field(HX_("status",32,e7,fb,05),::hx::paccDynamic);
+HXDLIN( 210) int _hx_tmp7;
+HXDLIN( 210) if (::hx::IsNotNull( tmp7 )) {
+HXLINE( 210) _hx_tmp7 = ( (int)(tmp7) );
+ }
+ else {
+HXLINE( 210) _hx_tmp7 = 0;
+ }
+HXDLIN( 210) this->status = _hx_tmp7;
+HXLINE( 211) ::Array< ::Dynamic> tmp8 = ( (::Array< ::Dynamic>)(params->__Field(HX_("versions",5b,4e,b8,d6),::hx::paccDynamic)) );
+HXDLIN( 211) ::Array< ::Dynamic> _hx_tmp8;
+HXDLIN( 211) if (::hx::IsNotNull( tmp8 )) {
+HXLINE( 211) _hx_tmp8 = tmp8;
+ }
+ else {
+HXLINE( 211) _hx_tmp8 = ::Array_obj< ::Dynamic>::__new(0);
+ }
+HXDLIN( 211) this->versions = _hx_tmp8;
+HXLINE( 212) ::Array< ::Dynamic> tmp9 = ( (::Array< ::Dynamic>)(params->__Field(HX_("payloads",25,dd,d1,a1),::hx::paccDynamic)) );
+HXDLIN( 212) ::Array< ::Dynamic> _hx_tmp9;
+HXDLIN( 212) if (::hx::IsNotNull( tmp9 )) {
+HXLINE( 212) _hx_tmp9 = tmp9;
+ }
+ else {
+HXLINE( 212) _hx_tmp9 = ::Array_obj< ::Dynamic>::__new(0);
+ }
+HXDLIN( 212) this->payloads = _hx_tmp9;
+HXLINE( 213) this->stanza = ( ( ::snikket::Stanza)(params->__Field(HX_("stanza",f5,5d,f7,05),::hx::paccDynamic)) );
+ }
+
+Dynamic ChatMessage_obj::__CreateEmpty() { return new ChatMessage_obj; }
+
+void *ChatMessage_obj::_hx_vtable = 0;
+
+Dynamic ChatMessage_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< ChatMessage_obj > _hx_result = new ChatMessage_obj();
+ _hx_result->__construct(inArgs[0]);
+ return _hx_result;
+}
+
+bool ChatMessage_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x36665f12;
+}
+
+::String ChatMessage_obj::localId__fromC(){
+ HX_STACKFRAME(&_hx_pos_672f2a9d33b9a067_307_localId__fromC)
+HXDLIN( 307) return this->localId;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessage_obj,localId__fromC,return )
+
+::String ChatMessage_obj::serverId__fromC(){
+ HX_STACKFRAME(&_hx_pos_672f2a9d33b9a067_307_serverId__fromC)
+HXDLIN( 307) return this->serverId;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessage_obj,serverId__fromC,return )
+
+::String ChatMessage_obj::serverIdBy__fromC(){
+ HX_STACKFRAME(&_hx_pos_672f2a9d33b9a067_307_serverIdBy__fromC)
+HXDLIN( 307) return this->serverIdBy;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessage_obj,serverIdBy__fromC,return )
+
+int ChatMessage_obj::type__fromC(){
+ HX_STACKFRAME(&_hx_pos_672f2a9d33b9a067_307_type__fromC)
+HXDLIN( 307) return this->type;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessage_obj,type__fromC,return )
+
+::String ChatMessage_obj::timestamp__fromC(){
+ HX_STACKFRAME(&_hx_pos_672f2a9d33b9a067_307_timestamp__fromC)
+HXDLIN( 307) return this->timestamp;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessage_obj,timestamp__fromC,return )
+
+::String ChatMessage_obj::senderId__fromC(){
+ HX_STACKFRAME(&_hx_pos_672f2a9d33b9a067_307_senderId__fromC)
+HXDLIN( 307) return this->senderId;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessage_obj,senderId__fromC,return )
+
+ ::snikket::ChatMessage ChatMessage_obj::replyToMessage__fromC(){
+ HX_STACKFRAME(&_hx_pos_672f2a9d33b9a067_271_replyToMessage__fromC)
+HXDLIN( 271) return this->replyToMessage;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessage_obj,replyToMessage__fromC,return )
+
+::String ChatMessage_obj::threadId__fromC(){
+ HX_STACKFRAME(&_hx_pos_672f2a9d33b9a067_307_threadId__fromC)
+HXDLIN( 307) return this->threadId;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessage_obj,threadId__fromC,return )
+
+size_t ChatMessage_obj::attachments__fromC(void*** outPtr){
+ HX_GC_STACKFRAME(&_hx_pos_672f2a9d33b9a067_297_attachments__fromC)
+HXDLIN( 297) ::Array< ::Dynamic> x = this->attachments;
+HXDLIN( 297) if (::hx::IsNotNull( outPtr )) {
+HXDLIN( 297) ::cpp::Pointer< void** > _hx_tmp = ::cpp::Pointer_obj::fromRaw(outPtr);
+HXDLIN( 297) ::Array< ::Dynamic> x1 = x;
+HXDLIN( 297) {
+HXDLIN( 297) int _g = 0;
+HXDLIN( 297) while((_g < x1->length)){
+HXDLIN( 297) ::snikket::ChatAttachment el = x1->__get(_g).StaticCast< ::snikket::ChatAttachment >();
+HXDLIN( 297) _g = (_g + 1);
+HXDLIN( 297) {
+HXDLIN( 297) ::Dynamic haxeObject = el;
+HXDLIN( 297) void* ptr = haxeObject.mPtr;
+HXDLIN( 297) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(ptr);
+HXDLIN( 297) {
+HXDLIN( 297) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 297) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 297) int high = ptrInt64 >> 32;
+HXDLIN( 297) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 297) if (::hx::IsNull( highMap )) {
+HXDLIN( 297) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 297) this1->set(low,highMap);
+ }
+HXDLIN( 297) highMap->set(high,haxeObject);
+ }
+ }
+ }
+ }
+HXDLIN( 297) void** ptr1 = (void**)x1->getBase();
+HXDLIN( 297) ::cpp::Int64 ptrInt641 = reinterpret_cast<int64_t>(ptr1);
+HXDLIN( 297) {
+HXDLIN( 297) ::haxe::ds::IntMap this2 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 297) int low1 = ptrInt641 & 0xffffffff;
+HXDLIN( 297) int high1 = ptrInt641 >> 32;
+HXDLIN( 297) ::haxe::ds::IntMap highMap1 = ( ( ::haxe::ds::IntMap)(this2->get(low1)) );
+HXDLIN( 297) if (::hx::IsNull( highMap1 )) {
+HXDLIN( 297) highMap1 = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 297) this2->set(low1,highMap1);
+ }
+HXDLIN( 297) highMap1->set(high1,x1);
+ }
+HXDLIN( 297) _hx_tmp->set_ref(ptr1);
+ }
+HXDLIN( 297) return ( (size_t)(x->length) );
+ }
+
+
+::String ChatMessage_obj::text__fromC(){
+ HX_STACKFRAME(&_hx_pos_672f2a9d33b9a067_307_text__fromC)
+HXDLIN( 307) return this->text;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessage_obj,text__fromC,return )
+
+::String ChatMessage_obj::lang__fromC(){
+ HX_STACKFRAME(&_hx_pos_672f2a9d33b9a067_307_lang__fromC)
+HXDLIN( 307) return this->lang;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessage_obj,lang__fromC,return )
+
+int ChatMessage_obj::direction__fromC(){
+ HX_STACKFRAME(&_hx_pos_672f2a9d33b9a067_307_direction__fromC)
+HXDLIN( 307) return this->direction;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessage_obj,direction__fromC,return )
+
+int ChatMessage_obj::status__fromC(){
+ HX_STACKFRAME(&_hx_pos_672f2a9d33b9a067_307_status__fromC)
+HXDLIN( 307) return this->status;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessage_obj,status__fromC,return )
+
+void ChatMessage_obj::set_status__fromC(int value){
+ HX_STACKFRAME(&_hx_pos_672f2a9d33b9a067_318_set_status__fromC)
+HXDLIN( 318) this->status = value;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(ChatMessage_obj,set_status__fromC,(void))
+
+size_t ChatMessage_obj::versions__fromC(void*** outPtr){
+ HX_GC_STACKFRAME(&_hx_pos_672f2a9d33b9a067_297_versions__fromC)
+HXDLIN( 297) ::Array< ::Dynamic> x = this->versions;
+HXDLIN( 297) if (::hx::IsNotNull( outPtr )) {
+HXDLIN( 297) ::cpp::Pointer< void** > _hx_tmp = ::cpp::Pointer_obj::fromRaw(outPtr);
+HXDLIN( 297) ::Array< ::Dynamic> x1 = x;
+HXDLIN( 297) {
+HXDLIN( 297) int _g = 0;
+HXDLIN( 297) while((_g < x1->length)){
+HXDLIN( 297) ::snikket::ChatMessage el = x1->__get(_g).StaticCast< ::snikket::ChatMessage >();
+HXDLIN( 297) _g = (_g + 1);
+HXDLIN( 297) {
+HXDLIN( 297) ::Dynamic haxeObject = el;
+HXDLIN( 297) void* ptr = haxeObject.mPtr;
+HXDLIN( 297) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(ptr);
+HXDLIN( 297) {
+HXDLIN( 297) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 297) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 297) int high = ptrInt64 >> 32;
+HXDLIN( 297) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 297) if (::hx::IsNull( highMap )) {
+HXDLIN( 297) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 297) this1->set(low,highMap);
+ }
+HXDLIN( 297) highMap->set(high,haxeObject);
+ }
+ }
+ }
+ }
+HXDLIN( 297) void** ptr1 = (void**)x1->getBase();
+HXDLIN( 297) ::cpp::Int64 ptrInt641 = reinterpret_cast<int64_t>(ptr1);
+HXDLIN( 297) {
+HXDLIN( 297) ::haxe::ds::IntMap this2 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 297) int low1 = ptrInt641 & 0xffffffff;
+HXDLIN( 297) int high1 = ptrInt641 >> 32;
+HXDLIN( 297) ::haxe::ds::IntMap highMap1 = ( ( ::haxe::ds::IntMap)(this2->get(low1)) );
+HXDLIN( 297) if (::hx::IsNull( highMap1 )) {
+HXDLIN( 297) highMap1 = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 297) this2->set(low1,highMap1);
+ }
+HXDLIN( 297) highMap1->set(high1,x1);
+ }
+HXDLIN( 297) _hx_tmp->set_ref(ptr1);
+ }
+HXDLIN( 297) return ( (size_t)(x->length) );
+ }
+
+
+ ::snikket::ChatMessageBuilder ChatMessage_obj::reply(){
+ HX_GC_STACKFRAME(&_hx_pos_b3673a050e0c4d12_229_reply)
+HXLINE( 230) ::snikket::ChatMessageBuilder m = ::snikket::ChatMessageBuilder_obj::__alloc( HX_CTX );
+HXLINE( 231) m->type = this->type;
+HXLINE( 232) ::String tmp = this->threadId;
+HXDLIN( 232) ::String _hx_tmp;
+HXDLIN( 232) if (::hx::IsNotNull( tmp )) {
+HXLINE( 232) _hx_tmp = tmp;
+ }
+ else {
+HXLINE( 232) _hx_tmp = ::snikket::ID_obj::_hx_long();
+ }
+HXDLIN( 232) m->threadId = _hx_tmp;
+HXLINE( 233) m->replyToMessage = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 234) return m;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessage_obj,reply,return )
+
+::String ChatMessage_obj::getReplyId(){
+ HX_STACKFRAME(&_hx_pos_b3673a050e0c4d12_237_getReplyId)
+HXLINE( 238) if (::hx::IsNotNull( this->replyId )) {
+HXLINE( 238) return this->replyId;
+ }
+HXLINE( 239) bool _hx_tmp;
+HXDLIN( 239) if ((this->type != 2)) {
+HXLINE( 239) _hx_tmp = (this->type == 3);
+ }
+ else {
+HXLINE( 239) _hx_tmp = true;
+ }
+HXDLIN( 239) if (_hx_tmp) {
+HXLINE( 239) return this->serverId;
+ }
+ else {
+HXLINE( 239) return this->localId;
+ }
+HXDLIN( 239) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessage_obj,getReplyId,return )
+
+ ::snikket::ChatMessage ChatMessage_obj::set_replyToMessage( ::snikket::ChatMessage m){
+ HX_STACKFRAME(&_hx_pos_b3673a050e0c4d12_243_set_replyToMessage)
+HXLINE( 244) ::snikket::ChatMessage rtm = this->replyToMessage;
+HXLINE( 245) if (::hx::IsNull( rtm )) {
+HXLINE( 245) HX_STACK_DO_THROW(HX_("Cannot hydrate null replyToMessage",f1,d9,4b,bf));
+ }
+HXLINE( 246) bool _hx_tmp;
+HXDLIN( 246) if (::hx::IsNotNull( rtm->serverId )) {
+HXLINE( 246) _hx_tmp = (rtm->serverId != m->serverId);
+ }
+ else {
+HXLINE( 246) _hx_tmp = false;
+ }
+HXDLIN( 246) if (_hx_tmp) {
+HXLINE( 246) HX_STACK_DO_THROW(HX_("Hydrate serverId mismatch",43,6c,05,df));
+ }
+HXLINE( 247) bool _hx_tmp1;
+HXDLIN( 247) if (::hx::IsNotNull( rtm->localId )) {
+HXLINE( 247) _hx_tmp1 = (rtm->localId != m->localId);
+ }
+ else {
+HXLINE( 247) _hx_tmp1 = false;
+ }
+HXDLIN( 247) if (_hx_tmp1) {
+HXLINE( 247) HX_STACK_DO_THROW(HX_("Hydrate localId mismatch",d5,ef,ca,42));
+ }
+HXLINE( 248) return (this->replyToMessage = m);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(ChatMessage_obj,set_replyToMessage,return )
+
+ ::haxe::ds::StringMap ChatMessage_obj::set_reactions( ::haxe::ds::StringMap r){
+ HX_STACKFRAME(&_hx_pos_b3673a050e0c4d12_252_set_reactions)
+HXDLIN( 252) ::snikket::ChatMessage _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 253) bool _hx_tmp;
+HXDLIN( 253) if (::hx::IsNotNull( this->reactions )) {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::ChatMessage,_gthis) HXARGC(0)
+ ::Dynamic _hx_run(){
+ HX_STACKFRAME(&_hx_pos_b3673a050e0c4d12_253_set_reactions)
+HXLINE( 253) return _gthis->reactions->keys();
+ }
+ HX_END_LOCAL_FUNC0(return)
+
+HXLINE( 253) _hx_tmp = !(::Lambda_obj::empty( ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("iterator",ee,49,9a,93), ::Dynamic(new _hx_Closure_0(_gthis))))));
+ }
+ else {
+HXLINE( 253) _hx_tmp = false;
+ }
+HXDLIN( 253) if (_hx_tmp) {
+HXLINE( 253) HX_STACK_DO_THROW(HX_("Reactions already hydrated",4f,72,b8,9d));
+ }
+HXLINE( 254) return (this->reactions = r);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(ChatMessage_obj,set_reactions,return )
+
+::Array< ::Dynamic> ChatMessage_obj::inlineHashReferences(){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ bool _hx_run( ::snikket::Stanza p){
+ HX_STACKFRAME(&_hx_pos_b3673a050e0c4d12_260_inlineHashReferences)
+HXLINE( 260) if ((( (::String)(::Reflect_obj::field(p->attr,HX_("xmlns",dc,31,74,60))) ) == HX_("http://jabber.org/protocol/xhtml-im",c2,5d,b2,ce))) {
+HXLINE( 260) return (p->name == HX_("html",6b,95,16,45));
+ }
+ else {
+HXLINE( 260) return false;
+ }
+HXDLIN( 260) return false;
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_b3673a050e0c4d12_258_inlineHashReferences)
+HXLINE( 259) ::Array< ::Dynamic> result = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 260) ::snikket::Stanza tmp = ( ( ::snikket::Stanza)(::Lambda_obj::find(this->payloads, ::Dynamic(new _hx_Closure_0()))) );
+HXDLIN( 260) ::snikket::Stanza htmlBody;
+HXDLIN( 260) if (::hx::IsNotNull( tmp )) {
+HXLINE( 260) htmlBody = tmp->getChild(HX_("body",a2,7a,1b,41),HX_("http://www.w3.org/1999/xhtml",90,6d,f8,c8));
+ }
+ else {
+HXLINE( 260) htmlBody = null();
+ }
+HXLINE( 261) if (::hx::IsNotNull( htmlBody )) {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_1,::Array< ::Dynamic>,result) HXARGC(1)
+ bool _hx_run( ::snikket::Stanza child){
+ HX_STACKFRAME(&_hx_pos_b3673a050e0c4d12_262_inlineHashReferences)
+HXLINE( 263) if ((child->name == HX_("img",03,0c,50,00))) {
+HXLINE( 264) ::String src = ( (::String)(::Reflect_obj::field(child->attr,HX_("src",e4,a6,57,00))) );
+HXLINE( 265) if (::hx::IsNotNull( src )) {
+HXLINE( 266) ::snikket::Hash hash = ::snikket::Hash_obj::fromUri(src);
+HXLINE( 267) if (::hx::IsNotNull( hash )) {
+HXLINE( 268) ::snikket::Hash x = hash;
+HXLINE( 269) result->push(x);
+ }
+ }
+HXLINE( 272) return true;
+ }
+HXLINE( 274) return false;
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE( 262) htmlBody->traverse( ::Dynamic(new _hx_Closure_1(result)));
+ }
+HXLINE( 278) return result;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessage_obj,inlineHashReferences,return )
+
+::String ChatMessage_obj::html(){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ bool _hx_run( ::snikket::Stanza p){
+ HX_STACKFRAME(&_hx_pos_b3673a050e0c4d12_287_html)
+HXLINE( 287) if ((( (::String)(::Reflect_obj::field(p->attr,HX_("xmlns",dc,31,74,60))) ) == HX_("http://jabber.org/protocol/xhtml-im",c2,5d,b2,ce))) {
+HXLINE( 287) return (p->name == HX_("html",6b,95,16,45));
+ }
+ else {
+HXLINE( 287) return false;
+ }
+HXDLIN( 287) return false;
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_2) HXARGC(2)
+ int _hx_run( ::Dynamic x, ::Dynamic y){
+ HX_STACKFRAME(&_hx_pos_b3673a050e0c4d12_312_html)
+HXLINE( 312) return (( (int)(y->__Field(HX_("start",62,74,0b,84),::hx::paccDynamic)) ) - ( (int)(x->__Field(HX_("start",62,74,0b,84),::hx::paccDynamic)) ));
+ }
+ HX_END_LOCAL_FUNC2(return)
+
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_3) HXARGC(1)
+ bool _hx_run( ::snikket::Stanza p){
+ HX_STACKFRAME(&_hx_pos_b3673a050e0c4d12_317_html)
+HXLINE( 317) if ((( (::String)(::Reflect_obj::field(p->attr,HX_("xmlns",dc,31,74,60))) ) == HX_("urn:xmpp:styling:0",48,d3,aa,fb))) {
+HXLINE( 317) return (p->name == HX_("unstyled",2c,15,1a,18));
+ }
+ else {
+HXLINE( 317) return false;
+ }
+HXDLIN( 317) return false;
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_b3673a050e0c4d12_286_html)
+HXDLIN( 286) ::snikket::ChatMessage _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 287) ::snikket::Stanza tmp = ( ( ::snikket::Stanza)(::Lambda_obj::find(this->payloads, ::Dynamic(new _hx_Closure_0()))) );
+HXDLIN( 287) ::snikket::Stanza htmlBody;
+HXDLIN( 287) if (::hx::IsNotNull( tmp )) {
+HXLINE( 287) htmlBody = tmp->getChild(HX_("body",a2,7a,1b,41),HX_("http://www.w3.org/1999/xhtml",90,6d,f8,c8));
+ }
+ else {
+HXLINE( 287) htmlBody = null();
+ }
+HXLINE( 288) if (::hx::IsNotNull( htmlBody )) {
+HXLINE( 289) ::Array< ::Dynamic> _this = htmlBody->getChildren();
+HXDLIN( 289) ::Array< ::String > result = ::Array_obj< ::String >::__new(_this->length);
+HXDLIN( 289) {
+HXLINE( 289) int _g = 0;
+HXDLIN( 289) int _g1 = _this->length;
+HXDLIN( 289) while((_g < _g1)){
+HXLINE( 289) _g = (_g + 1);
+HXDLIN( 289) int i = (_g - 1);
+HXDLIN( 289) {
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_1) HXARGC(1)
+ bool _hx_run( ::snikket::Stanza child){
+ HX_STACKFRAME(&_hx_pos_b3673a050e0c4d12_289_html)
+HXLINE( 290) if ((child->name == HX_("img",03,0c,50,00))) {
+HXLINE( 291) ::String src = ( (::String)(::Reflect_obj::field(child->attr,HX_("src",e4,a6,57,00))) );
+HXLINE( 292) if (::hx::IsNotNull( src )) {
+HXLINE( 293) ::snikket::Hash hash = ::snikket::Hash_obj::fromUri(src);
+HXLINE( 294) if (::hx::IsNotNull( hash )) {
+HXLINE( 295) ::Dynamic this1 = child->attr;
+HXDLIN( 295) ::String value = hash->toUri();
+HXDLIN( 295) ::Reflect_obj::setField(this1,HX_("src",e4,a6,57,00),value);
+ }
+ }
+HXLINE( 298) return true;
+ }
+HXLINE( 300) return false;
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE( 289) ::String inValue = ::snikket::_Stanza::NodeInterface_obj::serialize(::snikket::_Stanza::NodeInterface_obj::traverse(_hx_array_unsafe_get(_this,i), ::Dynamic(new _hx_Closure_1())));
+HXDLIN( 289) result->__unsafe_set(i,inValue);
+ }
+ }
+ }
+HXDLIN( 289) return result->join(HX_("",00,00,00,00));
+ }
+HXLINE( 304) ::String tmp1 = this->text;
+HXDLIN( 304) ::String codepoints;
+HXDLIN( 304) if (::hx::IsNotNull( tmp1 )) {
+HXLINE( 304) codepoints = tmp1;
+ }
+ else {
+HXLINE( 304) codepoints = HX_("",00,00,00,00);
+ }
+HXDLIN( 304) ::Array< ::String > codepoints1 = ::snikket::StringUtil_obj::codepointArray(codepoints);
+HXLINE( 306) ::Array< ::Dynamic> _g2 = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 306) {
+HXLINE( 306) int _g3 = 0;
+HXDLIN( 306) ::Array< ::Dynamic> _g4 = this->payloads;
+HXDLIN( 306) while((_g3 < _g4->length)){
+HXLINE( 306) ::snikket::Stanza v = _g4->__get(_g3).StaticCast< ::snikket::Stanza >();
+HXDLIN( 306) _g3 = (_g3 + 1);
+HXLINE( 307) bool fallbacks;
+HXDLIN( 307) if ((( (::String)(::Reflect_obj::field(v->attr,HX_("xmlns",dc,31,74,60))) ) == HX_("urn:xmpp:fallback:0",74,aa,56,9b))) {
+HXLINE( 308) bool fallbacks1;
+HXDLIN( 308) bool fallbacks2;
+HXDLIN( 308) bool fallbacks3;
+HXDLIN( 308) if ((( (::String)(::Reflect_obj::field(v->attr,HX_("for",09,c7,4d,00))) ) != HX_("jabber:x:oob",aa,8a,5f,ef))) {
+HXLINE( 308) fallbacks3 = (( (::String)(::Reflect_obj::field(v->attr,HX_("for",09,c7,4d,00))) ) == HX_("urn:xmpp:sims:1",4f,1c,49,62));
+ }
+ else {
+HXLINE( 308) fallbacks3 = true;
+ }
+HXDLIN( 308) if (fallbacks3) {
+HXLINE( 308) fallbacks2 = (_gthis->attachments->length > 0);
+ }
+ else {
+HXLINE( 308) fallbacks2 = false;
+ }
+HXDLIN( 308) if (!(fallbacks2)) {
+HXLINE( 309) if (::hx::IsNotNull( _gthis->replyToMessage )) {
+HXLINE( 308) fallbacks1 = (( (::String)(::Reflect_obj::field(v->attr,HX_("for",09,c7,4d,00))) ) == HX_("urn:xmpp:reply:0",c4,d5,6f,90));
+ }
+ else {
+HXLINE( 308) fallbacks1 = false;
+ }
+ }
+ else {
+HXLINE( 308) fallbacks1 = true;
+ }
+HXDLIN( 308) if (!(fallbacks1)) {
+HXLINE( 307) fallbacks = (( (::String)(::Reflect_obj::field(v->attr,HX_("for",09,c7,4d,00))) ) == HX_("http://jabber.org/protocol/address",c0,fd,09,ed));
+ }
+ else {
+HXLINE( 307) fallbacks = true;
+ }
+ }
+ else {
+HXLINE( 307) fallbacks = false;
+ }
+HXLINE( 306) if (fallbacks) {
+HXLINE( 306) _g2->push(v);
+ }
+ }
+ }
+HXDLIN( 306) ::Array< ::Dynamic> _this1 = _g2;
+HXDLIN( 306) ::Array< ::Dynamic> result1 = ::Array_obj< ::Dynamic>::__new(_this1->length);
+HXDLIN( 306) {
+HXLINE( 306) int _g5 = 0;
+HXDLIN( 306) int _g6 = _this1->length;
+HXDLIN( 306) while((_g5 < _g6)){
+HXLINE( 306) _g5 = (_g5 + 1);
+HXDLIN( 306) int i1 = (_g5 - 1);
+HXDLIN( 306) {
+HXLINE( 306) ::snikket::Stanza inValue1 = ( ( ::snikket::Stanza)(_hx_array_unsafe_get(_this1,i1)) )->getChild(HX_("body",a2,7a,1b,41),null());
+HXDLIN( 306) result1->__unsafe_set(i1,inValue1);
+ }
+ }
+ }
+HXDLIN( 306) ::Array< ::Dynamic> _this2 = result1;
+HXDLIN( 306) ::Array< ::Dynamic> result2 = ::Array_obj< ::Dynamic>::__new(_this2->length);
+HXDLIN( 306) {
+HXLINE( 306) int _g7 = 0;
+HXDLIN( 306) int _g8 = _this2->length;
+HXDLIN( 306) while((_g7 < _g8)){
+HXLINE( 306) _g7 = (_g7 + 1);
+HXDLIN( 306) int i2 = (_g7 - 1);
+HXDLIN( 306) {
+HXLINE( 311) ::snikket::Stanza b = ( ( ::snikket::Stanza)(_hx_array_unsafe_get(_this2,i2)) );
+HXLINE( 306) ::Dynamic inValue2;
+HXLINE( 311) if (::hx::IsNull( b )) {
+HXLINE( 306) inValue2 = null();
+ }
+ else {
+HXLINE( 311) int inValue3;
+HXDLIN( 311) ::String tmp2 = ( (::String)(::Reflect_obj::field(b->attr,HX_("start",62,74,0b,84))) );
+HXDLIN( 311) ::String tmp3;
+HXDLIN( 311) if (::hx::IsNotNull( tmp2 )) {
+HXLINE( 311) tmp3 = tmp2;
+ }
+ else {
+HXLINE( 311) tmp3 = HX_("0",30,00,00,00);
+ }
+HXDLIN( 311) ::Dynamic tmp4 = ::Std_obj::parseInt(tmp3);
+HXDLIN( 311) if (::hx::IsNotNull( tmp4 )) {
+HXLINE( 311) inValue3 = ( (int)(tmp4) );
+ }
+ else {
+HXLINE( 311) inValue3 = 0;
+ }
+HXDLIN( 311) ::String tmp5 = ( (::String)(::Reflect_obj::field(b->attr,HX_("end",db,03,4d,00))) );
+HXDLIN( 311) ::String tmp6;
+HXDLIN( 311) if (::hx::IsNotNull( tmp5 )) {
+HXLINE( 311) tmp6 = tmp5;
+ }
+ else {
+HXLINE( 311) tmp6 = ::Std_obj::string(codepoints1->length);
+ }
+HXDLIN( 311) ::Dynamic tmp7 = ::Std_obj::parseInt(tmp6);
+HXDLIN( 311) int inValue4;
+HXDLIN( 311) if (::hx::IsNotNull( tmp7 )) {
+HXLINE( 311) inValue4 = ( (int)(tmp7) );
+ }
+ else {
+HXLINE( 311) inValue4 = codepoints1->length;
+ }
+HXLINE( 306) inValue2 = ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("start",62,74,0b,84),inValue3)
+ ->setFixed(1,HX_("end",db,03,4d,00),inValue4));
+ }
+HXDLIN( 306) result2->__unsafe_set(i2,inValue2);
+ }
+ }
+ }
+HXDLIN( 306) ::Array< ::Dynamic> _g9 = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 306) {
+HXLINE( 306) int _g10 = 0;
+HXDLIN( 306) ::Array< ::Dynamic> _g11 = result2;
+HXDLIN( 306) while((_g10 < _g11->length)){
+HXLINE( 306) ::Dynamic v1 = _g11->__get(_g10);
+HXDLIN( 306) _g10 = (_g10 + 1);
+HXDLIN( 306) if (::hx::IsNotNull( v1 )) {
+HXLINE( 306) _g9->push(v1);
+ }
+ }
+ }
+HXDLIN( 306) ::Array< ::Dynamic> fallbacks4 = _g9;
+HXLINE( 312) fallbacks4->sort( ::Dynamic(new _hx_Closure_2()));
+HXLINE( 313) {
+HXLINE( 313) int _g12 = 0;
+HXDLIN( 313) while((_g12 < fallbacks4->length)){
+HXLINE( 313) ::Dynamic fallback = fallbacks4->__get(_g12);
+HXDLIN( 313) _g12 = (_g12 + 1);
+HXLINE( 314) codepoints1->removeRange( ::Dynamic(fallback->__Field(HX_("start",62,74,0b,84),::hx::paccDynamic)),(( (int)(fallback->__Field(HX_("end",db,03,4d,00),::hx::paccDynamic)) ) - ( (int)(fallback->__Field(HX_("start",62,74,0b,84),::hx::paccDynamic)) )));
+ }
+ }
+HXLINE( 316) ::String body = codepoints1->join(HX_("",00,00,00,00));
+HXLINE( 317) if (::hx::IsNull( ::Lambda_obj::find(this->payloads, ::Dynamic(new _hx_Closure_3())) )) {
+HXLINE( 317) ::Array< ::String > _g13 = ::Array_obj< ::String >::__new(0);
+HXDLIN( 317) {
+HXLINE( 317) ::Dynamic x = ::snikket::XEP0393_obj::parse(body)->__Field(HX_("iterator",ee,49,9a,93),::hx::paccDynamic)();
+HXDLIN( 317) while(( (bool)(x->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 317) ::snikket::Stanza x1 = ( ( ::snikket::Stanza)(x->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXDLIN( 317) _g13->push(x1->toString());
+ }
+ }
+HXDLIN( 317) return _g13->join(HX_("",00,00,00,00));
+ }
+ else {
+HXLINE( 317) return ::StringTools_obj::htmlEscape(body,null());
+ }
+HXDLIN( 317) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessage_obj,html,return )
+
+::String ChatMessage_obj::chatId(){
+ HX_STACKFRAME(&_hx_pos_b3673a050e0c4d12_324_chatId)
+HXDLIN( 324) if (this->isIncoming()) {
+HXLINE( 325) ::Array< ::Dynamic> _this = this->replyTo;
+HXDLIN( 325) ::Array< ::String > result = ::Array_obj< ::String >::__new(_this->length);
+HXDLIN( 325) {
+HXLINE( 325) int _g = 0;
+HXDLIN( 325) int _g1 = _this->length;
+HXDLIN( 325) while((_g < _g1)){
+HXLINE( 325) _g = (_g + 1);
+HXDLIN( 325) int i = (_g - 1);
+HXDLIN( 325) {
+HXLINE( 325) ::String inValue = ( ( ::snikket::JID)(_hx_array_unsafe_get(_this,i)) )->asBare()->asString();
+HXDLIN( 325) result->__unsafe_set(i,inValue);
+ }
+ }
+ }
+HXDLIN( 325) return result->join(HX_("\n",0a,00,00,00));
+ }
+ else {
+HXLINE( 327) ::Array< ::Dynamic> _this1 = this->recipients;
+HXDLIN( 327) ::Array< ::String > result1 = ::Array_obj< ::String >::__new(_this1->length);
+HXDLIN( 327) {
+HXLINE( 327) int _g2 = 0;
+HXDLIN( 327) int _g3 = _this1->length;
+HXDLIN( 327) while((_g2 < _g3)){
+HXLINE( 327) _g2 = (_g2 + 1);
+HXDLIN( 327) int i1 = (_g2 - 1);
+HXDLIN( 327) {
+HXLINE( 327) ::String inValue1 = ( ( ::snikket::JID)(_hx_array_unsafe_get(_this1,i1)) )->asString();
+HXDLIN( 327) result1->__unsafe_set(i1,inValue1);
+ }
+ }
+ }
+HXDLIN( 327) return result1->join(HX_("\n",0a,00,00,00));
+ }
+HXLINE( 324) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessage_obj,chatId,return )
+
+::String ChatMessage_obj::account(){
+ HX_STACKFRAME(&_hx_pos_b3673a050e0c4d12_335_account)
+HXDLIN( 335) ::String tmp;
+HXDLIN( 335) if (!(this->isIncoming())) {
+HXDLIN( 335) ::snikket::JID tmp1 = this->from;
+HXDLIN( 335) ::snikket::JID tmp2;
+HXDLIN( 335) if (::hx::IsNotNull( tmp1 )) {
+HXDLIN( 335) tmp2 = tmp1->asBare();
+ }
+ else {
+HXDLIN( 335) tmp2 = null();
+ }
+HXDLIN( 335) if (::hx::IsNotNull( tmp2 )) {
+HXDLIN( 335) tmp = tmp2->asString();
+ }
+ else {
+HXDLIN( 335) tmp = null();
+ }
+ }
+ else {
+HXDLIN( 335) ::snikket::JID tmp3 = this->to;
+HXDLIN( 335) ::snikket::JID tmp4;
+HXDLIN( 335) if (::hx::IsNotNull( tmp3 )) {
+HXDLIN( 335) tmp4 = tmp3->asBare();
+ }
+ else {
+HXDLIN( 335) tmp4 = null();
+ }
+HXDLIN( 335) if (::hx::IsNotNull( tmp4 )) {
+HXDLIN( 335) tmp = tmp4->asString();
+ }
+ else {
+HXDLIN( 335) tmp = null();
+ }
+ }
+HXDLIN( 335) if (::hx::IsNotNull( tmp )) {
+HXDLIN( 335) return tmp;
+ }
+ else {
+HXDLIN( 335) HX_STACK_DO_THROW(HX_("from or to is null",7f,19,89,e6));
+ }
+HXDLIN( 335) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessage_obj,account,return )
+
+bool ChatMessage_obj::isIncoming(){
+ HX_STACKFRAME(&_hx_pos_b3673a050e0c4d12_342_isIncoming)
+HXDLIN( 342) return (this->direction == 0);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessage_obj,isIncoming,return )
+
+::String ChatMessage_obj::threadIcon(){
+ HX_STACKFRAME(&_hx_pos_b3673a050e0c4d12_349_threadIcon)
+HXDLIN( 349) if (::hx::IsNull( this->threadId )) {
+HXDLIN( 349) return null();
+ }
+ else {
+HXDLIN( 349) return ::snikket::Identicon_obj::svg(this->threadId);
+ }
+HXDLIN( 349) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessage_obj,threadIcon,return )
+
+::String ChatMessage_obj::callStatus(){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ bool _hx_run( ::snikket::Stanza el){
+ HX_STACKFRAME(&_hx_pos_b3673a050e0c4d12_356_callStatus)
+HXDLIN( 356) return (( (::String)(::Reflect_obj::field(el->attr,HX_("xmlns",dc,31,74,60))) ) == HX_("urn:xmpp:jingle-message:0",fd,20,a5,07));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_b3673a050e0c4d12_356_callStatus)
+HXDLIN( 356) ::snikket::Stanza tmp = ( ( ::snikket::Stanza)(::Lambda_obj::find(this->payloads, ::Dynamic(new _hx_Closure_0()))) );
+HXDLIN( 356) if (::hx::IsNotNull( tmp )) {
+HXDLIN( 356) return tmp->name;
+ }
+ else {
+HXDLIN( 356) return null();
+ }
+HXDLIN( 356) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessage_obj,callStatus,return )
+
+::String ChatMessage_obj::callSid(){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ bool _hx_run( ::snikket::Stanza el){
+ HX_STACKFRAME(&_hx_pos_b3673a050e0c4d12_363_callSid)
+HXDLIN( 363) return (( (::String)(::Reflect_obj::field(el->attr,HX_("xmlns",dc,31,74,60))) ) == HX_("urn:xmpp:jingle-message:0",fd,20,a5,07));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_b3673a050e0c4d12_363_callSid)
+HXDLIN( 363) ::snikket::Stanza tmp = ( ( ::snikket::Stanza)(::Lambda_obj::find(this->payloads, ::Dynamic(new _hx_Closure_0()))) );
+HXDLIN( 363) ::Dynamic tmp1;
+HXDLIN( 363) if (::hx::IsNotNull( tmp )) {
+HXDLIN( 363) tmp1 = tmp->attr;
+ }
+ else {
+HXDLIN( 363) tmp1 = null();
+ }
+HXDLIN( 363) if (::hx::IsNotNull( tmp1 )) {
+HXDLIN( 363) return ( (::String)(::Reflect_obj::field(tmp1,HX_("id",db,5b,00,00))) );
+ }
+ else {
+HXDLIN( 363) return null();
+ }
+HXDLIN( 363) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessage_obj,callSid,return )
+
+::String ChatMessage_obj::callDuration(){
+ HX_STACKFRAME(&_hx_pos_b3673a050e0c4d12_369_callDuration)
+HXLINE( 370) if ((this->versions->length < 2)) {
+HXLINE( 370) return null();
+ }
+HXLINE( 371) ::String startedStr = this->versions->__get((this->versions->length - 1)).StaticCast< ::snikket::ChatMessage >()->timestamp;
+HXLINE( 373) ::String _g = this->callStatus();
+HXDLIN( 373) if (::hx::IsNull( _g )) {
+HXLINE( 388) return null();
+ }
+ else {
+HXLINE( 373) ::String _hx_switch_0 = _g;
+ if ( (_hx_switch_0==HX_("finish",53,40,7f,86)) ){
+HXLINE( 375) ::String endedStr = this->versions->__get(0).StaticCast< ::snikket::ChatMessage >()->timestamp;
+HXLINE( 376) bool _hx_tmp;
+HXDLIN( 376) if (::hx::IsNotNull( startedStr )) {
+HXLINE( 376) _hx_tmp = ::hx::IsNull( endedStr );
+ }
+ else {
+HXLINE( 376) _hx_tmp = true;
+ }
+HXDLIN( 376) if (_hx_tmp) {
+HXLINE( 376) return null();
+ }
+HXLINE( 377) Float started = ::datetime::utils::DateTimeUtils_obj::fromString(startedStr);
+HXLINE( 378) Float ended = ::datetime::utils::DateTimeUtils_obj::fromString(endedStr);
+HXLINE( 379) ::datetime::cores::DateTimeIntervalCore duration = ::datetime::_DateTimeInterval::DateTimeInterval_Impl__obj::create(started,((ended - ((Float)62135596800.0)) + ((Float)62135596800.0)));
+HXLINE( 380) return ::datetime::utils::DateTimeIntervalUtils_obj::strftime(duration,HX_("%I:%S",44,2d,40,7e));
+HXLINE( 374) goto _hx_goto_48;
+ }
+ if ( (_hx_switch_0==HX_("proceed",2e,96,4a,f1)) ){
+HXLINE( 382) if (::hx::IsNull( startedStr )) {
+HXLINE( 382) return null();
+ }
+HXLINE( 383) Float started1 = ::datetime::utils::DateTimeUtils_obj::fromString(startedStr);
+HXLINE( 384) Float ended1 = ( ::__hxcpp_date_now() + ((Float)62135596800.0));
+HXLINE( 385) ::datetime::cores::DateTimeIntervalCore duration1 = ::datetime::_DateTimeInterval::DateTimeInterval_Impl__obj::create(started1,((ended1 - ((Float)62135596800.0)) + ((Float)62135596800.0)));
+HXLINE( 386) return ::datetime::utils::DateTimeIntervalUtils_obj::strftime(duration1,HX_("%I:%S",44,2d,40,7e));
+HXLINE( 381) goto _hx_goto_48;
+ }
+ /* default */{
+HXLINE( 388) return null();
+ }
+ _hx_goto_48:;
+ }
+HXLINE( 373) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessage_obj,callDuration,return )
+
+ ::snikket::Stanza ChatMessage_obj::asStanza(){
+ HX_GC_STACKFRAME(&_hx_pos_b3673a050e0c4d12_393_asStanza)
+HXDLIN( 393) ::snikket::ChatMessage _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 394) if (::hx::IsNotNull( this->stanza )) {
+HXLINE( 394) return this->stanza;
+ }
+HXLINE( 396) ::String body = this->text;
+HXLINE( 397) ::String attrs;
+HXDLIN( 397) if ((this->type == 2)) {
+HXLINE( 397) attrs = HX_("groupchat",97,1d,c8,e5);
+ }
+ else {
+HXLINE( 397) attrs = HX_("chat",d8,5e,bf,41);
+ }
+HXDLIN( 397) ::Dynamic attrs1 = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("type",ba,f2,08,4d),attrs));
+HXLINE( 398) if (::hx::IsNotNull( this->from )) {
+HXLINE( 398) ::String value = this->from->asString();
+HXDLIN( 398) ::Reflect_obj::setField(attrs1,HX_("from",6a,a5,c2,43),value);
+ }
+HXLINE( 399) if (::hx::IsNotNull( this->to )) {
+HXLINE( 399) ::String value1 = this->to->asString();
+HXDLIN( 399) ::Reflect_obj::setField(attrs1,HX_("to",7b,65,00,00),value1);
+ }
+HXLINE( 400) if (::hx::IsNotNull( this->localId )) {
+HXLINE( 400) ::String value2 = this->localId;
+HXDLIN( 400) ::Reflect_obj::setField(attrs1,HX_("id",db,5b,00,00),value2);
+ }
+HXLINE( 401) ::snikket::Stanza stanza = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("message",c7,35,11,9a),attrs1);
+HXLINE( 402) bool _hx_tmp;
+HXDLIN( 402) if ((this->versions->length > 0)) {
+HXLINE( 402) _hx_tmp = ::hx::IsNotNull( this->versions->__get((this->versions->length - 1)).StaticCast< ::snikket::ChatMessage >()->localId );
+ }
+ else {
+HXLINE( 402) _hx_tmp = false;
+ }
+HXDLIN( 402) if (_hx_tmp) {
+HXLINE( 402) stanza->tag(HX_("replace",34,48,28,ab), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("id",db,5b,00,00),this->versions->__get((this->versions->length - 1)).StaticCast< ::snikket::ChatMessage >()->localId)
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:message-correct:0",be,10,1b,b0))))->up();
+ }
+HXLINE( 403) if (::hx::IsNotNull( this->threadId )) {
+HXLINE( 403) stanza->textTag(HX_("thread",ca,7a,b9,8e),this->threadId,null());
+ }
+HXLINE( 404) if ((this->recipients->length > 1)) {
+HXLINE( 405) ::snikket::Stanza addresses = stanza->tag(HX_("addresses",22,9f,12,8c), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("http://jabber.org/protocol/address",c0,fd,09,ed))));
+HXLINE( 406) {
+HXLINE( 406) int _g = 0;
+HXDLIN( 406) ::Array< ::Dynamic> _g1 = this->recipients;
+HXDLIN( 406) while((_g < _g1->length)){
+HXLINE( 406) ::snikket::JID recipient = _g1->__get(_g).StaticCast< ::snikket::JID >();
+HXDLIN( 406) _g = (_g + 1);
+HXLINE( 407) addresses->tag(HX_("address",b4,71,0b,9d), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("delivered",84,e0,1c,b2),HX_("true",4e,a7,03,4d))
+ ->setFixed(1,HX_("jid",c5,ca,50,00),recipient->asString())
+ ->setFixed(2,HX_("type",ba,f2,08,4d),HX_("to",7b,65,00,00))))->up();
+ }
+ }
+HXLINE( 409) addresses->up();
+ }
+ else {
+HXLINE( 410) bool _hx_tmp1;
+HXDLIN( 410) if ((this->recipients->length == 1)) {
+HXLINE( 410) _hx_tmp1 = ::hx::IsNull( this->to );
+ }
+ else {
+HXLINE( 410) _hx_tmp1 = false;
+ }
+HXDLIN( 410) if (_hx_tmp1) {
+HXLINE( 411) ::String value3 = this->recipients->__get(0).StaticCast< ::snikket::JID >()->asString();
+HXDLIN( 411) ::Reflect_obj::setField(attrs1,HX_("to",7b,65,00,00),value3);
+ }
+ }
+HXLINE( 414) ::snikket::ChatMessage replyToM = this->replyToMessage;
+HXLINE( 415) if (::hx::IsNotNull( replyToM )) {
+HXLINE( 416) ::String replyId = replyToM->getReplyId();
+HXLINE( 417) if (::hx::IsNotNull( body )) {
+HXLINE( 418) ::Array< ::String > lines;
+HXDLIN( 418) ::String tmp = replyToM->text;
+HXDLIN( 418) ::Array< ::String > tmp1;
+HXDLIN( 418) if (::hx::IsNotNull( tmp )) {
+HXLINE( 418) tmp1 = tmp.split(HX_("\n",0a,00,00,00));
+ }
+ else {
+HXLINE( 418) tmp1 = null();
+ }
+HXDLIN( 418) if (::hx::IsNotNull( tmp1 )) {
+HXLINE( 418) lines = tmp1;
+ }
+ else {
+HXLINE( 418) lines = ::Array_obj< ::String >::__new(0);
+ }
+HXLINE( 419) ::String quoteText = HX_("",00,00,00,00);
+HXLINE( 420) {
+HXLINE( 420) int _g2 = 0;
+HXDLIN( 420) while((_g2 < lines->length)){
+HXLINE( 420) ::String line = lines->__get(_g2);
+HXDLIN( 420) _g2 = (_g2 + 1);
+HXLINE( 421) if (!( ::EReg_obj::__alloc( HX_CTX ,HX_("^(?:> ?){3,}",7a,64,54,8e),HX_("",00,00,00,00))->match(line))) {
+HXLINE( 422) if ((line.charAt(0) == HX_(">",3e,00,00,00))) {
+HXLINE( 423) quoteText = (quoteText + ((HX_(">",3e,00,00,00) + line) + HX_("\n",0a,00,00,00)));
+ }
+ else {
+HXLINE( 425) quoteText = (quoteText + ((HX_("> ",22,36,00,00) + line) + HX_("\n",0a,00,00,00)));
+ }
+ }
+ }
+ }
+HXLINE( 429) ::String reaction;
+HXDLIN( 429) if (::snikket::EmojiUtil_obj::isEmoji(::StringTools_obj::trim(body))) {
+HXLINE( 429) reaction = ::StringTools_obj::trim(body);
+ }
+ else {
+HXLINE( 429) reaction = null();
+ }
+HXLINE( 430) body = (quoteText + body);
+HXLINE( 431) if (::hx::IsNotNull( replyId )) {
+HXLINE( 432) ::Array< ::String > codepoints = ::snikket::StringUtil_obj::codepointArray(quoteText);
+HXLINE( 433) if (::hx::IsNotNull( reaction )) {
+HXLINE( 434) ::haxe::ds::StringMap addedReactions = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXLINE( 435) stanza->tag(HX_("reactions",aa,cc,95,e7), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("id",db,5b,00,00),replyId)
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:reactions:0",44,fb,42,53))));
+HXLINE( 436) stanza->textTag(HX_("reaction",a9,e7,b4,f6),reaction,null());
+HXLINE( 437) addedReactions->set(reaction,true);
+HXLINE( 439) {
+HXLINE( 439) ::Dynamic map = replyToM->reactions;
+HXDLIN( 439) ::Dynamic _g_map = map;
+HXDLIN( 439) ::Dynamic _g_keys = ::haxe::IMap_obj::keys(map);
+HXDLIN( 439) while(( (bool)(_g_keys->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 439) ::String key = ( (::String)(_g_keys->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXDLIN( 439) ::Array< ::Dynamic> _g_value = ( (::Array< ::Dynamic>)(::haxe::IMap_obj::get(_g_map,key)) );
+HXDLIN( 439) ::String _g_key = key;
+HXDLIN( 439) ::String areaction = _g_key;
+HXDLIN( 439) ::Array< ::Dynamic> reactions = _g_value;
+HXLINE( 440) bool _hx_tmp2;
+HXDLIN( 440) ::Dynamic tmp2 = addedReactions->get(areaction);
+HXDLIN( 440) bool _hx_tmp3;
+HXDLIN( 440) if (::hx::IsNotNull( tmp2 )) {
+HXLINE( 440) _hx_tmp3 = ( (bool)(tmp2) );
+ }
+ else {
+HXLINE( 440) _hx_tmp3 = false;
+ }
+HXDLIN( 440) if (!(_hx_tmp3)) {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::ChatMessage,_gthis) HXARGC(1)
+ bool _hx_run( ::snikket::Reaction r){
+ HX_GC_STACKFRAME(&_hx_pos_b3673a050e0c4d12_440_asStanza)
+HXLINE( 440) return (r->senderId == _gthis->senderId);
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE( 440) _hx_tmp2 = ::hx::IsNotNull( ::Lambda_obj::find(reactions, ::Dynamic(new _hx_Closure_0(_gthis))) );
+ }
+ else {
+HXLINE( 440) _hx_tmp2 = false;
+ }
+HXDLIN( 440) if (_hx_tmp2) {
+HXLINE( 441) addedReactions->set(areaction,true);
+HXLINE( 442) stanza->textTag(HX_("reaction",a9,e7,b4,f6),areaction,null());
+ }
+ }
+ }
+HXLINE( 445) stanza->up();
+HXLINE( 446) stanza->tag(HX_("fallback",22,f0,9d,2a), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("for",09,c7,4d,00),HX_("urn:xmpp:reactions:0",44,fb,42,53))
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:fallback:0",74,aa,56,9b))))->tag(HX_("body",a2,7a,1b,41),null())->up()->up();
+ }
+HXLINE( 449) ::snikket::Stanza _hx_tmp4 = stanza->tag(HX_("fallback",22,f0,9d,2a), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("for",09,c7,4d,00),HX_("urn:xmpp:reply:0",c4,d5,6f,90))
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:fallback:0",74,aa,56,9b))));
+HXDLIN( 449) _hx_tmp4->tag(HX_("body",a2,7a,1b,41), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("start",62,74,0b,84),HX_("0",30,00,00,00))
+ ->setFixed(1,HX_("end",db,03,4d,00),::Std_obj::string(codepoints->length))))->up()->up();
+ }
+ }
+HXLINE( 453) if (::hx::IsNotNull( replyId )) {
+HXLINE( 453) ::snikket::JID tmp3 = replyToM->from;
+HXDLIN( 453) ::String _hx_tmp5;
+HXDLIN( 453) if (::hx::IsNotNull( tmp3 )) {
+HXLINE( 453) _hx_tmp5 = tmp3->asString();
+ }
+ else {
+HXLINE( 453) _hx_tmp5 = null();
+ }
+HXDLIN( 453) stanza->tag(HX_("reply",2a,09,c6,e6), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("id",db,5b,00,00),replyId)
+ ->setFixed(1,HX_("to",7b,65,00,00),_hx_tmp5)
+ ->setFixed(2,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:reply:0",c4,d5,6f,90))))->up();
+ }
+ }
+HXLINE( 456) {
+HXLINE( 456) int _g3 = 0;
+HXDLIN( 456) ::Array< ::Dynamic> _g4 = this->attachments;
+HXDLIN( 456) while((_g3 < _g4->length)){
+HXLINE( 456) ::snikket::ChatAttachment attachment = _g4->__get(_g3).StaticCast< ::snikket::ChatAttachment >();
+HXDLIN( 456) _g3 = (_g3 + 1);
+HXLINE( 457) stanza->tag(HX_("reference",cb,07,c5,5a), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("type",ba,f2,08,4d),HX_("data",2a,56,63,42))
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:reference:0",a5,00,10,5d))))->tag(HX_("media-sharing",33,1c,0a,3d), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:sims:1",4f,1c,49,62))));
+HXLINE( 461) stanza->tag(HX_("file",7c,ce,bb,43), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:jingle:apps:file-transfer:5",9c,81,0d,37))));
+HXLINE( 462) if (::hx::IsNotNull( attachment->name )) {
+HXLINE( 462) stanza->textTag(HX_("name",4b,72,ff,48),attachment->name,null());
+ }
+HXLINE( 463) stanza->textTag(HX_("media-type",03,ce,a4,7d),attachment->mime,null());
+HXLINE( 464) if (::hx::IsNotNull( attachment->size )) {
+HXLINE( 464) stanza->textTag(HX_("size",c1,a0,53,4c),::Std_obj::string(attachment->size),null());
+ }
+HXLINE( 465) {
+HXLINE( 465) int _g5 = 0;
+HXDLIN( 465) ::Array< ::Dynamic> _g6 = attachment->hashes;
+HXDLIN( 465) while((_g5 < _g6->length)){
+HXLINE( 465) ::snikket::Hash hash = _g6->__get(_g5).StaticCast< ::snikket::Hash >();
+HXDLIN( 465) _g5 = (_g5 + 1);
+HXLINE( 466) ::String _hx_tmp6 = ::haxe::crypto::Base64_obj::encode(::haxe::io::Bytes_obj::ofData(hash->hash),null());
+HXDLIN( 466) stanza->textTag(HX_("hash",ce,2f,08,45),_hx_tmp6, ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("algo",d3,ff,6f,40),hash->algorithm)
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:hashes:2",90,ad,87,c7))));
+ }
+ }
+HXLINE( 468) stanza->up();
+HXLINE( 470) stanza->tag(HX_("sources",38,0f,49,b9),null());
+HXLINE( 471) {
+HXLINE( 471) int _g7 = 0;
+HXDLIN( 471) ::Array< ::String > _g8 = attachment->uris;
+HXDLIN( 471) while((_g7 < _g8->length)){
+HXLINE( 471) ::String uri = _g8->__get(_g7);
+HXDLIN( 471) _g7 = (_g7 + 1);
+HXLINE( 472) stanza->tag(HX_("reference",cb,07,c5,5a), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("uri",6c,2b,59,00),uri)
+ ->setFixed(1,HX_("type",ba,f2,08,4d),HX_("data",2a,56,63,42))
+ ->setFixed(2,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:reference:0",a5,00,10,5d))))->up();
+ }
+ }
+HXLINE( 475) stanza->up()->up()->up();
+HXLINE( 477) if ((attachment->uris->length > 0)) {
+HXLINE( 478) stanza->tag(HX_("x",78,00,00,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("jabber:x:oob",aa,8a,5f,ef))))->textTag(HX_("url",6f,2b,59,00),attachment->uris->__get(0),null())->up();
+HXLINE( 479) if (::hx::IsNull( body )) {
+HXLINE( 479) body = HX_("",00,00,00,00);
+ }
+HXLINE( 480) ::Array< ::String > codepoints1 = ::snikket::StringUtil_obj::codepointArray(body);
+HXLINE( 481) int start = codepoints1->length;
+HXLINE( 482) int end = (start + attachment->uris->__get(0).length);
+HXLINE( 483) if ((body != HX_("",00,00,00,00))) {
+HXLINE( 484) body = (body + HX_("\n",0a,00,00,00));
+HXLINE( 485) end = (end + 1);
+ }
+HXLINE( 487) body = (body + attachment->uris->__get(0));
+HXLINE( 488) ::snikket::Stanza _hx_tmp7 = stanza->tag(HX_("fallback",22,f0,9d,2a), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("for",09,c7,4d,00),HX_("jabber:x:oob",aa,8a,5f,ef))
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:fallback:0",74,aa,56,9b))));
+HXLINE( 490) ::String _hx_tmp8 = ::Std_obj::string(start);
+HXLINE( 488) _hx_tmp7->tag(HX_("body",a2,7a,1b,41), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("start",62,74,0b,84),_hx_tmp8)
+ ->setFixed(1,HX_("end",db,03,4d,00),::Std_obj::string(end))))->up()->up();
+ }
+ }
+ }
+HXLINE( 493) if (::hx::IsNotNull( body )) {
+HXLINE( 493) stanza->textTag(HX_("body",a2,7a,1b,41),body,null());
+ }
+HXLINE( 494) {
+HXLINE( 494) int _g9 = 0;
+HXDLIN( 494) ::Array< ::Dynamic> _g10 = this->payloads;
+HXDLIN( 494) while((_g9 < _g10->length)){
+HXLINE( 494) ::snikket::Stanza payload = _g10->__get(_g9).StaticCast< ::snikket::Stanza >();
+HXDLIN( 494) _g9 = (_g9 + 1);
+HXLINE( 495) stanza->addDirectChild(::snikket::Node_obj::Element(payload));
+ }
+ }
+HXLINE( 497) return stanza;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessage_obj,asStanza,return )
+
+ ::snikket::ChatMessage ChatMessage_obj::fromStanza( ::snikket::Stanza stanza, ::snikket::JID localJid, ::Dynamic addContext){
+ HX_STACKFRAME(&_hx_pos_b3673a050e0c4d12_218_fromStanza)
+HXDLIN( 218) ::snikket::MessageStanza _g = ::snikket::Message_obj::fromStanza(stanza,localJid,addContext)->parsed;
+HXDLIN( 218) if ((_g->_hx_getIndex() == 1)) {
+HXLINE( 219) ::snikket::ChatMessage message = _g->_hx_getObject(0).StaticCast< ::snikket::ChatMessage >();
+HXLINE( 220) return message;
+ }
+ else {
+HXLINE( 222) return null();
+ }
+HXLINE( 218) return null();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC3(ChatMessage_obj,fromStanza,return )
+
+
+::hx::ObjectPtr< ChatMessage_obj > ChatMessage_obj::__new( ::Dynamic params) {
+ ::hx::ObjectPtr< ChatMessage_obj > __this = new ChatMessage_obj();
+ __this->__construct(params);
+ return __this;
+}
+
+::hx::ObjectPtr< ChatMessage_obj > ChatMessage_obj::__alloc(::hx::Ctx *_hx_ctx, ::Dynamic params) {
+ ChatMessage_obj *__this = (ChatMessage_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(ChatMessage_obj), true, "snikket.ChatMessage"));
+ *(void **)__this = ChatMessage_obj::_hx_vtable;
+ __this->__construct(params);
+ return __this;
+}
+
+ChatMessage_obj::ChatMessage_obj()
+{
+}
+
+void ChatMessage_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(ChatMessage);
+ HX_MARK_MEMBER_NAME(localId,"localId");
+ HX_MARK_MEMBER_NAME(serverId,"serverId");
+ HX_MARK_MEMBER_NAME(serverIdBy,"serverIdBy");
+ HX_MARK_MEMBER_NAME(type,"type");
+ HX_MARK_MEMBER_NAME(syncPoint,"syncPoint");
+ HX_MARK_MEMBER_NAME(replyId,"replyId");
+ HX_MARK_MEMBER_NAME(timestamp,"timestamp");
+ HX_MARK_MEMBER_NAME(to,"to");
+ HX_MARK_MEMBER_NAME(from,"from");
+ HX_MARK_MEMBER_NAME(recipients,"recipients");
+ HX_MARK_MEMBER_NAME(replyTo,"replyTo");
+ HX_MARK_MEMBER_NAME(senderId,"senderId");
+ HX_MARK_MEMBER_NAME(replyToMessage,"replyToMessage");
+ HX_MARK_MEMBER_NAME(threadId,"threadId");
+ HX_MARK_MEMBER_NAME(attachments,"attachments");
+ HX_MARK_MEMBER_NAME(reactions,"reactions");
+ HX_MARK_MEMBER_NAME(text,"text");
+ HX_MARK_MEMBER_NAME(lang,"lang");
+ HX_MARK_MEMBER_NAME(direction,"direction");
+ HX_MARK_MEMBER_NAME(status,"status");
+ HX_MARK_MEMBER_NAME(versions,"versions");
+ HX_MARK_MEMBER_NAME(payloads,"payloads");
+ HX_MARK_MEMBER_NAME(stanza,"stanza");
+ HX_MARK_END_CLASS();
+}
+
+void ChatMessage_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(localId,"localId");
+ HX_VISIT_MEMBER_NAME(serverId,"serverId");
+ HX_VISIT_MEMBER_NAME(serverIdBy,"serverIdBy");
+ HX_VISIT_MEMBER_NAME(type,"type");
+ HX_VISIT_MEMBER_NAME(syncPoint,"syncPoint");
+ HX_VISIT_MEMBER_NAME(replyId,"replyId");
+ HX_VISIT_MEMBER_NAME(timestamp,"timestamp");
+ HX_VISIT_MEMBER_NAME(to,"to");
+ HX_VISIT_MEMBER_NAME(from,"from");
+ HX_VISIT_MEMBER_NAME(recipients,"recipients");
+ HX_VISIT_MEMBER_NAME(replyTo,"replyTo");
+ HX_VISIT_MEMBER_NAME(senderId,"senderId");
+ HX_VISIT_MEMBER_NAME(replyToMessage,"replyToMessage");
+ HX_VISIT_MEMBER_NAME(threadId,"threadId");
+ HX_VISIT_MEMBER_NAME(attachments,"attachments");
+ HX_VISIT_MEMBER_NAME(reactions,"reactions");
+ HX_VISIT_MEMBER_NAME(text,"text");
+ HX_VISIT_MEMBER_NAME(lang,"lang");
+ HX_VISIT_MEMBER_NAME(direction,"direction");
+ HX_VISIT_MEMBER_NAME(status,"status");
+ HX_VISIT_MEMBER_NAME(versions,"versions");
+ HX_VISIT_MEMBER_NAME(payloads,"payloads");
+ HX_VISIT_MEMBER_NAME(stanza,"stanza");
+}
+
+::hx::Val ChatMessage_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 2:
+ if (HX_FIELD_EQ(inName,"to") ) { return ::hx::Val( to ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"type") ) { return ::hx::Val( type ); }
+ if (HX_FIELD_EQ(inName,"from") ) { return ::hx::Val( from ); }
+ if (HX_FIELD_EQ(inName,"text") ) { return ::hx::Val( text ); }
+ if (HX_FIELD_EQ(inName,"lang") ) { return ::hx::Val( lang ); }
+ if (HX_FIELD_EQ(inName,"html") ) { return ::hx::Val( html_dyn() ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"reply") ) { return ::hx::Val( reply_dyn() ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"status") ) { return ::hx::Val( status ); }
+ if (HX_FIELD_EQ(inName,"stanza") ) { return ::hx::Val( stanza ); }
+ if (HX_FIELD_EQ(inName,"chatId") ) { return ::hx::Val( chatId_dyn() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"localId") ) { return ::hx::Val( localId ); }
+ if (HX_FIELD_EQ(inName,"replyId") ) { return ::hx::Val( replyId ); }
+ if (HX_FIELD_EQ(inName,"replyTo") ) { return ::hx::Val( replyTo ); }
+ if (HX_FIELD_EQ(inName,"account") ) { return ::hx::Val( account_dyn() ); }
+ if (HX_FIELD_EQ(inName,"callSid") ) { return ::hx::Val( callSid_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"serverId") ) { return ::hx::Val( serverId ); }
+ if (HX_FIELD_EQ(inName,"senderId") ) { return ::hx::Val( senderId ); }
+ if (HX_FIELD_EQ(inName,"threadId") ) { return ::hx::Val( threadId ); }
+ if (HX_FIELD_EQ(inName,"versions") ) { return ::hx::Val( versions ); }
+ if (HX_FIELD_EQ(inName,"payloads") ) { return ::hx::Val( payloads ); }
+ if (HX_FIELD_EQ(inName,"asStanza") ) { return ::hx::Val( asStanza_dyn() ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"syncPoint") ) { return ::hx::Val( syncPoint ); }
+ if (HX_FIELD_EQ(inName,"timestamp") ) { return ::hx::Val( timestamp ); }
+ if (HX_FIELD_EQ(inName,"reactions") ) { return ::hx::Val( reactions ); }
+ if (HX_FIELD_EQ(inName,"direction") ) { return ::hx::Val( direction ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"serverIdBy") ) { return ::hx::Val( serverIdBy ); }
+ if (HX_FIELD_EQ(inName,"recipients") ) { return ::hx::Val( recipients ); }
+ if (HX_FIELD_EQ(inName,"getReplyId") ) { return ::hx::Val( getReplyId_dyn() ); }
+ if (HX_FIELD_EQ(inName,"isIncoming") ) { return ::hx::Val( isIncoming_dyn() ); }
+ if (HX_FIELD_EQ(inName,"threadIcon") ) { return ::hx::Val( threadIcon_dyn() ); }
+ if (HX_FIELD_EQ(inName,"callStatus") ) { return ::hx::Val( callStatus_dyn() ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"type__fromC") ) { return ::hx::Val( type__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"attachments") ) { return ::hx::Val( attachments ); }
+ if (HX_FIELD_EQ(inName,"text__fromC") ) { return ::hx::Val( text__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"lang__fromC") ) { return ::hx::Val( lang__fromC_dyn() ); }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"callDuration") ) { return ::hx::Val( callDuration_dyn() ); }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"status__fromC") ) { return ::hx::Val( status__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"set_reactions") ) { return ::hx::Val( set_reactions_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"localId__fromC") ) { return ::hx::Val( localId__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"replyToMessage") ) { return ::hx::Val( replyToMessage ); }
+ break;
+ case 15:
+ if (HX_FIELD_EQ(inName,"serverId__fromC") ) { return ::hx::Val( serverId__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"senderId__fromC") ) { return ::hx::Val( senderId__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"threadId__fromC") ) { return ::hx::Val( threadId__fromC_dyn() ); }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"timestamp__fromC") ) { return ::hx::Val( timestamp__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"direction__fromC") ) { return ::hx::Val( direction__fromC_dyn() ); }
+ break;
+ case 17:
+ if (HX_FIELD_EQ(inName,"serverIdBy__fromC") ) { return ::hx::Val( serverIdBy__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"set_status__fromC") ) { return ::hx::Val( set_status__fromC_dyn() ); }
+ break;
+ case 18:
+ if (HX_FIELD_EQ(inName,"set_replyToMessage") ) { return ::hx::Val( set_replyToMessage_dyn() ); }
+ break;
+ case 20:
+ if (HX_FIELD_EQ(inName,"inlineHashReferences") ) { return ::hx::Val( inlineHashReferences_dyn() ); }
+ break;
+ case 21:
+ if (HX_FIELD_EQ(inName,"replyToMessage__fromC") ) { return ::hx::Val( replyToMessage__fromC_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool ChatMessage_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 10:
+ if (HX_FIELD_EQ(inName,"fromStanza") ) { outValue = fromStanza_dyn(); return true; }
+ }
+ return false;
+}
+
+::hx::Val ChatMessage_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 2:
+ if (HX_FIELD_EQ(inName,"to") ) { to=inValue.Cast< ::snikket::JID >(); return inValue; }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"type") ) { type=inValue.Cast< int >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"from") ) { from=inValue.Cast< ::snikket::JID >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"text") ) { text=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"lang") ) { lang=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"status") ) { status=inValue.Cast< int >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"stanza") ) { stanza=inValue.Cast< ::snikket::Stanza >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"localId") ) { localId=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"replyId") ) { replyId=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"replyTo") ) { replyTo=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"serverId") ) { serverId=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"senderId") ) { senderId=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"threadId") ) { threadId=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"versions") ) { versions=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"payloads") ) { payloads=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"syncPoint") ) { syncPoint=inValue.Cast< bool >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"timestamp") ) { timestamp=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"reactions") ) { reactions=inValue.Cast< ::haxe::ds::StringMap >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"direction") ) { direction=inValue.Cast< int >(); return inValue; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"serverIdBy") ) { serverIdBy=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"recipients") ) { recipients=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"attachments") ) { attachments=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"replyToMessage") ) { replyToMessage=inValue.Cast< ::snikket::ChatMessage >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void ChatMessage_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("localId",26,7a,c6,2d));
+ outFields->push(HX_("serverId",7e,01,b2,e2));
+ outFields->push(HX_("serverIdBy",f5,16,54,74));
+ outFields->push(HX_("type",ba,f2,08,4d));
+ outFields->push(HX_("syncPoint",f5,ff,94,98));
+ outFields->push(HX_("replyId",a5,67,3a,ab));
+ outFields->push(HX_("timestamp",d6,d4,ce,a5));
+ outFields->push(HX_("to",7b,65,00,00));
+ outFields->push(HX_("from",6a,a5,c2,43));
+ outFields->push(HX_("recipients",7a,62,59,87));
+ outFields->push(HX_("replyTo",45,71,3a,ab));
+ outFields->push(HX_("senderId",f0,1e,0e,ec));
+ outFields->push(HX_("replyToMessage",02,cf,60,a6));
+ outFields->push(HX_("threadId",45,81,25,cc));
+ outFields->push(HX_("attachments",30,df,33,e7));
+ outFields->push(HX_("reactions",aa,cc,95,e7));
+ outFields->push(HX_("text",ad,cc,f9,4c));
+ outFields->push(HX_("lang",ee,05,ad,47));
+ outFields->push(HX_("direction",3f,62,40,10));
+ outFields->push(HX_("status",32,e7,fb,05));
+ outFields->push(HX_("versions",5b,4e,b8,d6));
+ outFields->push(HX_("payloads",25,dd,d1,a1));
+ outFields->push(HX_("stanza",f5,5d,f7,05));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo ChatMessage_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(ChatMessage_obj,localId),HX_("localId",26,7a,c6,2d)},
+ {::hx::fsString,(int)offsetof(ChatMessage_obj,serverId),HX_("serverId",7e,01,b2,e2)},
+ {::hx::fsString,(int)offsetof(ChatMessage_obj,serverIdBy),HX_("serverIdBy",f5,16,54,74)},
+ {::hx::fsInt,(int)offsetof(ChatMessage_obj,type),HX_("type",ba,f2,08,4d)},
+ {::hx::fsBool,(int)offsetof(ChatMessage_obj,syncPoint),HX_("syncPoint",f5,ff,94,98)},
+ {::hx::fsString,(int)offsetof(ChatMessage_obj,replyId),HX_("replyId",a5,67,3a,ab)},
+ {::hx::fsString,(int)offsetof(ChatMessage_obj,timestamp),HX_("timestamp",d6,d4,ce,a5)},
+ {::hx::fsObject /* ::snikket::JID */ ,(int)offsetof(ChatMessage_obj,to),HX_("to",7b,65,00,00)},
+ {::hx::fsObject /* ::snikket::JID */ ,(int)offsetof(ChatMessage_obj,from),HX_("from",6a,a5,c2,43)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(ChatMessage_obj,recipients),HX_("recipients",7a,62,59,87)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(ChatMessage_obj,replyTo),HX_("replyTo",45,71,3a,ab)},
+ {::hx::fsString,(int)offsetof(ChatMessage_obj,senderId),HX_("senderId",f0,1e,0e,ec)},
+ {::hx::fsObject /* ::snikket::ChatMessage */ ,(int)offsetof(ChatMessage_obj,replyToMessage),HX_("replyToMessage",02,cf,60,a6)},
+ {::hx::fsString,(int)offsetof(ChatMessage_obj,threadId),HX_("threadId",45,81,25,cc)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(ChatMessage_obj,attachments),HX_("attachments",30,df,33,e7)},
+ {::hx::fsObject /* ::haxe::ds::StringMap */ ,(int)offsetof(ChatMessage_obj,reactions),HX_("reactions",aa,cc,95,e7)},
+ {::hx::fsString,(int)offsetof(ChatMessage_obj,text),HX_("text",ad,cc,f9,4c)},
+ {::hx::fsString,(int)offsetof(ChatMessage_obj,lang),HX_("lang",ee,05,ad,47)},
+ {::hx::fsInt,(int)offsetof(ChatMessage_obj,direction),HX_("direction",3f,62,40,10)},
+ {::hx::fsInt,(int)offsetof(ChatMessage_obj,status),HX_("status",32,e7,fb,05)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(ChatMessage_obj,versions),HX_("versions",5b,4e,b8,d6)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(ChatMessage_obj,payloads),HX_("payloads",25,dd,d1,a1)},
+ {::hx::fsObject /* ::snikket::Stanza */ ,(int)offsetof(ChatMessage_obj,stanza),HX_("stanza",f5,5d,f7,05)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *ChatMessage_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String ChatMessage_obj_sMemberFields[] = {
+ HX_("localId",26,7a,c6,2d),
+ HX_("localId__fromC",13,27,c6,af),
+ HX_("serverId",7e,01,b2,e2),
+ HX_("serverId__fromC",bb,ba,c0,81),
+ HX_("serverIdBy",f5,16,54,74),
+ HX_("serverIdBy__fromC",24,52,2e,02),
+ HX_("type",ba,f2,08,4d),
+ HX_("type__fromC",ff,a8,6c,93),
+ HX_("syncPoint",f5,ff,94,98),
+ HX_("replyId",a5,67,3a,ab),
+ HX_("timestamp",d6,d4,ce,a5),
+ HX_("timestamp__fromC",63,82,8b,d7),
+ HX_("to",7b,65,00,00),
+ HX_("from",6a,a5,c2,43),
+ HX_("recipients",7a,62,59,87),
+ HX_("replyTo",45,71,3a,ab),
+ HX_("senderId",f0,1e,0e,ec),
+ HX_("senderId__fromC",89,0f,49,cb),
+ HX_("replyToMessage",02,cf,60,a6),
+ HX_("replyToMessage__fromC",b7,65,38,93),
+ HX_("threadId",45,81,25,cc),
+ HX_("threadId__fromC",d4,d1,81,79),
+ HX_("attachments",30,df,33,e7),
+ HX_("reactions",aa,cc,95,e7),
+ HX_("text",ad,cc,f9,4c),
+ HX_("text__fromC",6c,43,1b,7f),
+ HX_("lang",ee,05,ad,47),
+ HX_("lang__fromC",4b,24,00,52),
+ HX_("direction",3f,62,40,10),
+ HX_("direction__fromC",1a,64,c6,4b),
+ HX_("status",32,e7,fb,05),
+ HX_("status__fromC",87,b3,25,a1),
+ HX_("set_status__fromC",ea,96,03,cb),
+ HX_("versions",5b,4e,b8,d6),
+ HX_("payloads",25,dd,d1,a1),
+ HX_("stanza",f5,5d,f7,05),
+ HX_("reply",2a,09,c6,e6),
+ HX_("getReplyId",af,ed,9b,fa),
+ HX_("set_replyToMessage",3f,e2,a9,1e),
+ HX_("set_reactions",8d,82,ff,ed),
+ HX_("inlineHashReferences",ef,73,63,1b),
+ HX_("html",6b,95,16,45),
+ HX_("chatId",d3,04,77,b7),
+ HX_("account",ad,fc,59,a1),
+ HX_("isIncoming",f0,52,c4,95),
+ HX_("threadIcon",63,bb,7b,41),
+ HX_("callStatus",70,be,2b,31),
+ HX_("callSid",10,f5,53,54),
+ HX_("callDuration",12,b2,d0,4c),
+ HX_("asStanza",87,68,cd,94),
+ ::String(null()) };
+
+::hx::Class ChatMessage_obj::__mClass;
+
+static ::String ChatMessage_obj_sStaticFields[] = {
+ HX_("fromStanza",ff,62,3b,49),
+ ::String(null())
+};
+
+void ChatMessage_obj::__register()
+{
+ ChatMessage_obj _hx_dummy;
+ ChatMessage_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.ChatMessage",3e,ec,4c,ba);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &ChatMessage_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(ChatMessage_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(ChatMessage_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< ChatMessage_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = ChatMessage_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = ChatMessage_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void ChatMessage_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_b3673a050e0c4d12_66_boot)
+HXDLIN( 66) __mClass->__meta__ = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("fields",79,8e,8e,80), ::Dynamic(::hx::Anon_obj::Create(16)
+ ->setFixed(0,HX_("serverId__fromC",bb,ba,c0,81), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(1,HX_("replyToMessage__fromC",b7,65,38,93), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(2,HX_("type__fromC",ff,a8,6c,93), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(3,HX_("status__fromC",87,b3,25,a1), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(4,HX_("localId__fromC",13,27,c6,af), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(5,HX_("set_status__fromC",ea,96,03,cb), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(6,HX_("senderId__fromC",89,0f,49,cb), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(7,HX_("attachments__fromC",49,d7,f7,d0), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(8,HX_("timestamp__fromC",63,82,8b,d7), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(9,HX_("reactions",aa,cc,95,e7), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(10,HX_("serverIdBy__fromC",24,52,2e,02), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(11,HX_("versions__fromC",7e,73,e8,14), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(12,HX_("direction__fromC",1a,64,c6,4b), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(13,HX_("lang__fromC",4b,24,00,52), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(14,HX_("threadId__fromC",d4,d1,81,79), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(15,HX_("text__fromC",6c,43,1b,7f), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null()))))));
+ }
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/ChatMessageBuilder.cpp b/Sources/c_snikket/src/snikket/ChatMessageBuilder.cpp
new file mode 100644
index 0000000..3fa841a
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/ChatMessageBuilder.cpp
@@ -0,0 +1,1328 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Date
+#include <Date.h>
+#endif
+#ifndef INCLUDED_Lambda
+#include <Lambda.h>
+#endif
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED__HaxeCBridge_Internal
+#include <_HaxeCBridge/Internal.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_crypto_Base64
+#include <haxe/crypto/Base64.h>
+#endif
+#ifndef INCLUDED_haxe_ds_IntMap
+#include <haxe/ds/IntMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_StringMap
+#include <haxe/ds/StringMap.h>
+#endif
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+#ifndef INCLUDED_htmlparser_HtmlAttribute
+#include <htmlparser/HtmlAttribute.h>
+#endif
+#ifndef INCLUDED_htmlparser_HtmlNode
+#include <htmlparser/HtmlNode.h>
+#endif
+#ifndef INCLUDED_htmlparser_HtmlNodeElement
+#include <htmlparser/HtmlNodeElement.h>
+#endif
+#ifndef INCLUDED_htmlparser_HtmlNodeText
+#include <htmlparser/HtmlNodeText.h>
+#endif
+#ifndef INCLUDED_htmlparser_HtmlParser
+#include <htmlparser/HtmlParser.h>
+#endif
+#ifndef INCLUDED_snikket_ChatAttachment
+#include <snikket/ChatAttachment.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessage
+#include <snikket/ChatMessage.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessageBuilder
+#include <snikket/ChatMessageBuilder.h>
+#endif
+#ifndef INCLUDED_snikket_Date
+#include <snikket/Date.h>
+#endif
+#ifndef INCLUDED_snikket_Hash
+#include <snikket/Hash.h>
+#endif
+#ifndef INCLUDED_snikket_JID
+#include <snikket/JID.h>
+#endif
+#ifndef INCLUDED_snikket_Node
+#include <snikket/Node.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket_TextNode
+#include <snikket/TextNode.h>
+#endif
+#ifndef INCLUDED_snikket_XEP0393
+#include <snikket/XEP0393.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket__Util_Util_Fields_
+#include <snikket/_Util/Util_Fields_.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_cb10733abcc4a57a_32_new,"snikket.ChatMessageBuilder","new",0x9b235def,"snikket.ChatMessageBuilder.new","snikket/ChatMessageBuilder.hx",32,0x01453ec0)
+HX_LOCAL_STACK_FRAME(_hx_pos_1cce69560351f400_307_localId__fromC,"snikket.ChatMessageBuilder","localId__fromC",0x22a5f5e4,"snikket.ChatMessageBuilder.localId__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_1cce69560351f400_318_set_localId__fromC,"snikket.ChatMessageBuilder","set_localId__fromC",0xd8ad45a1,"snikket.ChatMessageBuilder.set_localId__fromC","HaxeCBridge.hx",318,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_1cce69560351f400_307_serverId__fromC,"snikket.ChatMessageBuilder","serverId__fromC",0x92b5e2ca,"snikket.ChatMessageBuilder.serverId__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_1cce69560351f400_318_set_serverId__fromC,"snikket.ChatMessageBuilder","set_serverId__fromC",0x2314586d,"snikket.ChatMessageBuilder.set_serverId__fromC","HaxeCBridge.hx",318,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_1cce69560351f400_307_serverIdBy__fromC,"snikket.ChatMessageBuilder","serverIdBy__fromC",0x18c8dbf3,"snikket.ChatMessageBuilder.serverIdBy__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_1cce69560351f400_318_set_serverIdBy__fromC,"snikket.ChatMessageBuilder","set_serverIdBy__fromC",0x55ea4056,"snikket.ChatMessageBuilder.set_serverIdBy__fromC","HaxeCBridge.hx",318,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_1cce69560351f400_307_type__fromC,"snikket.ChatMessageBuilder","type__fromC",0xe0eadd8e,"snikket.ChatMessageBuilder.type__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_1cce69560351f400_318_set_type__fromC,"snikket.ChatMessageBuilder","set_type__fromC",0x610f05b1,"snikket.ChatMessageBuilder.set_type__fromC","HaxeCBridge.hx",318,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_1cce69560351f400_307_timestamp__fromC,"snikket.ChatMessageBuilder","timestamp__fromC",0x9d196774,"snikket.ChatMessageBuilder.timestamp__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_1cce69560351f400_318_set_timestamp__fromC,"snikket.ChatMessageBuilder","set_timestamp__fromC",0x5f61e071,"snikket.ChatMessageBuilder.set_timestamp__fromC","HaxeCBridge.hx",318,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_1cce69560351f400_271_senderId__fromC,"snikket.ChatMessageBuilder","senderId__fromC",0xdc3e3798,"snikket.ChatMessageBuilder.senderId__fromC","HaxeCBridge.hx",271,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_1cce69560351f400_282_set_senderId__fromC,"snikket.ChatMessageBuilder","set_senderId__fromC",0x6c9cad3b,"snikket.ChatMessageBuilder.set_senderId__fromC","HaxeCBridge.hx",282,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_1cce69560351f400_307_replyToMessage__fromC,"snikket.ChatMessageBuilder","replyToMessage__fromC",0x143d8306,"snikket.ChatMessageBuilder.replyToMessage__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_1cce69560351f400_318_set_replyToMessage__fromC,"snikket.ChatMessageBuilder","set_replyToMessage__fromC",0x088c54e9,"snikket.ChatMessageBuilder.set_replyToMessage__fromC","HaxeCBridge.hx",318,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_1cce69560351f400_307_threadId__fromC,"snikket.ChatMessageBuilder","threadId__fromC",0x8a76f9e3,"snikket.ChatMessageBuilder.threadId__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_1cce69560351f400_318_set_threadId__fromC,"snikket.ChatMessageBuilder","set_threadId__fromC",0x1ad56f86,"snikket.ChatMessageBuilder.set_threadId__fromC","HaxeCBridge.hx",318,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_1cce69560351f400_260_attachments__fromC,"snikket.ChatMessageBuilder","attachments__fromC",0x8195e29a,"snikket.ChatMessageBuilder.attachments__fromC","HaxeCBridge.hx",260,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_1cce69560351f400_307_text__fromC,"snikket.ChatMessageBuilder","text__fromC",0xcc9977fb,"snikket.ChatMessageBuilder.text__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_1cce69560351f400_318_set_text__fromC,"snikket.ChatMessageBuilder","set_text__fromC",0x4cbda01e,"snikket.ChatMessageBuilder.set_text__fromC","HaxeCBridge.hx",318,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_1cce69560351f400_307_lang__fromC,"snikket.ChatMessageBuilder","lang__fromC",0x9f7e58da,"snikket.ChatMessageBuilder.lang__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_1cce69560351f400_318_set_lang__fromC,"snikket.ChatMessageBuilder","set_lang__fromC",0x1fa280fd,"snikket.ChatMessageBuilder.set_lang__fromC","HaxeCBridge.hx",318,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_1cce69560351f400_307_direction__fromC,"snikket.ChatMessageBuilder","direction__fromC",0x1154492b,"snikket.ChatMessageBuilder.direction__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_1cce69560351f400_318_set_direction__fromC,"snikket.ChatMessageBuilder","set_direction__fromC",0xd39cc228,"snikket.ChatMessageBuilder.set_direction__fromC","HaxeCBridge.hx",318,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_1cce69560351f400_307_status__fromC,"snikket.ChatMessageBuilder","status__fromC",0xf20569d6,"snikket.ChatMessageBuilder.status__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_1cce69560351f400_318_set_status__fromC,"snikket.ChatMessageBuilder","set_status__fromC",0xe19e20b9,"snikket.ChatMessageBuilder.set_status__fromC","HaxeCBridge.hx",318,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_1cce69560351f400_297_versions__fromC,"snikket.ChatMessageBuilder","versions__fromC",0x25dd9b8d,"snikket.ChatMessageBuilder.versions__fromC","HaxeCBridge.hx",297,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_cb10733abcc4a57a_214_attachSims,"snikket.ChatMessageBuilder","attachSims",0x75605632,"snikket.ChatMessageBuilder.attachSims","snikket/ChatMessageBuilder.hx",214,0x01453ec0)
+HX_LOCAL_STACK_FRAME(_hx_pos_cb10733abcc4a57a_230_addAttachment,"snikket.ChatMessageBuilder","addAttachment",0x989c07b3,"snikket.ChatMessageBuilder.addAttachment","snikket/ChatMessageBuilder.hx",230,0x01453ec0)
+HX_LOCAL_STACK_FRAME(_hx_pos_cb10733abcc4a57a_252_setHtml,"snikket.ChatMessageBuilder","setHtml",0x8f01d73c,"snikket.ChatMessageBuilder.setHtml","snikket/ChatMessageBuilder.hx",252,0x01453ec0)
+HX_LOCAL_STACK_FRAME(_hx_pos_cb10733abcc4a57a_237_setHtml,"snikket.ChatMessageBuilder","setHtml",0x8f01d73c,"snikket.ChatMessageBuilder.setHtml","snikket/ChatMessageBuilder.hx",237,0x01453ec0)
+HX_LOCAL_STACK_FRAME(_hx_pos_cb10733abcc4a57a_258_htmlToNode,"snikket.ChatMessageBuilder","htmlToNode",0xf59eb339,"snikket.ChatMessageBuilder.htmlToNode","snikket/ChatMessageBuilder.hx",258,0x01453ec0)
+HX_LOCAL_STACK_FRAME(_hx_pos_cb10733abcc4a57a_281_chatId,"snikket.ChatMessageBuilder","chatId",0x19a31aa4,"snikket.ChatMessageBuilder.chatId","snikket/ChatMessageBuilder.hx",281,0x01453ec0)
+HX_LOCAL_STACK_FRAME(_hx_pos_cb10733abcc4a57a_292_get_senderId,"snikket.ChatMessageBuilder","get_senderId",0x22179b8a,"snikket.ChatMessageBuilder.get_senderId","snikket/ChatMessageBuilder.hx",292,0x01453ec0)
+HX_LOCAL_STACK_FRAME(_hx_pos_cb10733abcc4a57a_296_isIncoming,"snikket.ChatMessageBuilder","isIncoming",0x3ede2541,"snikket.ChatMessageBuilder.isIncoming","snikket/ChatMessageBuilder.hx",296,0x01453ec0)
+HX_LOCAL_STACK_FRAME(_hx_pos_cb10733abcc4a57a_299_build,"snikket.ChatMessageBuilder","build",0x52e42a7d,"snikket.ChatMessageBuilder.build","snikket/ChatMessageBuilder.hx",299,0x01453ec0)
+HX_LOCAL_STACK_FRAME(_hx_pos_cb10733abcc4a57a_183_makeModerated,"snikket.ChatMessageBuilder","makeModerated",0x6bc3e5c2,"snikket.ChatMessageBuilder.makeModerated","snikket/ChatMessageBuilder.hx",183,0x01453ec0)
+HX_LOCAL_STACK_FRAME(_hx_pos_cb10733abcc4a57a_32_boot,"snikket.ChatMessageBuilder","boot",0x1be7d3c3,"snikket.ChatMessageBuilder.boot","snikket/ChatMessageBuilder.hx",32,0x01453ec0)
+namespace snikket{
+
+void ChatMessageBuilder_obj::__construct(){
+ HX_GC_STACKFRAME(&_hx_pos_cb10733abcc4a57a_32_new)
+HXLINE( 130) this->stanza = null();
+HXLINE( 124) this->payloads = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 121) this->versions = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 116) this->status = 0;
+HXLINE( 111) this->direction = 0;
+HXLINE( 106) this->lang = null();
+HXLINE( 101) this->text = null();
+HXLINE( 96) this->reactions = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXLINE( 90) this->attachments = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 85) this->threadId = null();
+HXLINE( 80) this->replyToMessage = null();
+HXLINE( 75) this->senderId = null();
+HXLINE( 73) this->replyTo = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 71) this->recipients = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 69) this->sender = null();
+HXLINE( 67) this->from = null();
+HXLINE( 65) this->to = null();
+HXLINE( 62) this->timestamp = null();
+HXLINE( 57) this->replyId = null();
+HXLINE( 54) this->syncPoint = false;
+HXLINE( 51) this->type = 0;
+HXLINE( 46) this->serverIdBy = null();
+HXLINE( 41) this->serverId = null();
+HXLINE( 36) this->localId = null();
+ }
+
+Dynamic ChatMessageBuilder_obj::__CreateEmpty() { return new ChatMessageBuilder_obj; }
+
+void *ChatMessageBuilder_obj::_hx_vtable = 0;
+
+Dynamic ChatMessageBuilder_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< ChatMessageBuilder_obj > _hx_result = new ChatMessageBuilder_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool ChatMessageBuilder_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x1d9d1345;
+}
+
+::String ChatMessageBuilder_obj::localId__fromC(){
+ HX_STACKFRAME(&_hx_pos_1cce69560351f400_307_localId__fromC)
+HXDLIN( 307) return this->localId;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessageBuilder_obj,localId__fromC,return )
+
+void ChatMessageBuilder_obj::set_localId__fromC(::String value){
+ HX_STACKFRAME(&_hx_pos_1cce69560351f400_318_set_localId__fromC)
+HXDLIN( 318) this->localId = value;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(ChatMessageBuilder_obj,set_localId__fromC,(void))
+
+::String ChatMessageBuilder_obj::serverId__fromC(){
+ HX_STACKFRAME(&_hx_pos_1cce69560351f400_307_serverId__fromC)
+HXDLIN( 307) return this->serverId;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessageBuilder_obj,serverId__fromC,return )
+
+void ChatMessageBuilder_obj::set_serverId__fromC(::String value){
+ HX_STACKFRAME(&_hx_pos_1cce69560351f400_318_set_serverId__fromC)
+HXDLIN( 318) this->serverId = value;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(ChatMessageBuilder_obj,set_serverId__fromC,(void))
+
+::String ChatMessageBuilder_obj::serverIdBy__fromC(){
+ HX_STACKFRAME(&_hx_pos_1cce69560351f400_307_serverIdBy__fromC)
+HXDLIN( 307) return this->serverIdBy;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessageBuilder_obj,serverIdBy__fromC,return )
+
+void ChatMessageBuilder_obj::set_serverIdBy__fromC(::String value){
+ HX_STACKFRAME(&_hx_pos_1cce69560351f400_318_set_serverIdBy__fromC)
+HXDLIN( 318) this->serverIdBy = value;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(ChatMessageBuilder_obj,set_serverIdBy__fromC,(void))
+
+int ChatMessageBuilder_obj::type__fromC(){
+ HX_STACKFRAME(&_hx_pos_1cce69560351f400_307_type__fromC)
+HXDLIN( 307) return this->type;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessageBuilder_obj,type__fromC,return )
+
+void ChatMessageBuilder_obj::set_type__fromC(int value){
+ HX_STACKFRAME(&_hx_pos_1cce69560351f400_318_set_type__fromC)
+HXDLIN( 318) this->type = value;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(ChatMessageBuilder_obj,set_type__fromC,(void))
+
+::String ChatMessageBuilder_obj::timestamp__fromC(){
+ HX_STACKFRAME(&_hx_pos_1cce69560351f400_307_timestamp__fromC)
+HXDLIN( 307) return this->timestamp;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessageBuilder_obj,timestamp__fromC,return )
+
+void ChatMessageBuilder_obj::set_timestamp__fromC(::String value){
+ HX_STACKFRAME(&_hx_pos_1cce69560351f400_318_set_timestamp__fromC)
+HXDLIN( 318) this->timestamp = value;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(ChatMessageBuilder_obj,set_timestamp__fromC,(void))
+
+::String ChatMessageBuilder_obj::senderId__fromC(){
+ HX_STACKFRAME(&_hx_pos_1cce69560351f400_271_senderId__fromC)
+HXDLIN( 271) return this->get_senderId();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessageBuilder_obj,senderId__fromC,return )
+
+void ChatMessageBuilder_obj::set_senderId__fromC(::String value){
+ HX_STACKFRAME(&_hx_pos_1cce69560351f400_282_set_senderId__fromC)
+HXDLIN( 282) this->senderId = value;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(ChatMessageBuilder_obj,set_senderId__fromC,(void))
+
+ ::snikket::ChatMessage ChatMessageBuilder_obj::replyToMessage__fromC(){
+ HX_STACKFRAME(&_hx_pos_1cce69560351f400_307_replyToMessage__fromC)
+HXDLIN( 307) return this->replyToMessage;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessageBuilder_obj,replyToMessage__fromC,return )
+
+void ChatMessageBuilder_obj::set_replyToMessage__fromC( ::snikket::ChatMessage value){
+ HX_STACKFRAME(&_hx_pos_1cce69560351f400_318_set_replyToMessage__fromC)
+HXDLIN( 318) this->replyToMessage = value;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(ChatMessageBuilder_obj,set_replyToMessage__fromC,(void))
+
+::String ChatMessageBuilder_obj::threadId__fromC(){
+ HX_STACKFRAME(&_hx_pos_1cce69560351f400_307_threadId__fromC)
+HXDLIN( 307) return this->threadId;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessageBuilder_obj,threadId__fromC,return )
+
+void ChatMessageBuilder_obj::set_threadId__fromC(::String value){
+ HX_STACKFRAME(&_hx_pos_1cce69560351f400_318_set_threadId__fromC)
+HXDLIN( 318) this->threadId = value;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(ChatMessageBuilder_obj,set_threadId__fromC,(void))
+
+size_t ChatMessageBuilder_obj::attachments__fromC(void*** outPtr){
+ HX_GC_STACKFRAME(&_hx_pos_1cce69560351f400_260_attachments__fromC)
+HXDLIN( 260) ::Array< ::Dynamic> x = this->attachments;
+HXDLIN( 260) if (::hx::IsNotNull( outPtr )) {
+HXDLIN( 260) ::cpp::Pointer< void** > _hx_tmp = ::cpp::Pointer_obj::fromRaw(outPtr);
+HXDLIN( 260) {
+HXDLIN( 260) int _g = 0;
+HXDLIN( 260) while((_g < x->length)){
+HXDLIN( 260) ::snikket::ChatAttachment el = x->__get(_g).StaticCast< ::snikket::ChatAttachment >();
+HXDLIN( 260) _g = (_g + 1);
+HXDLIN( 260) {
+HXDLIN( 260) ::Dynamic haxeObject = el;
+HXDLIN( 260) void* ptr = haxeObject.mPtr;
+HXDLIN( 260) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(ptr);
+HXDLIN( 260) {
+HXDLIN( 260) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 260) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 260) int high = ptrInt64 >> 32;
+HXDLIN( 260) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 260) if (::hx::IsNull( highMap )) {
+HXDLIN( 260) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 260) this1->set(low,highMap);
+ }
+HXDLIN( 260) highMap->set(high,haxeObject);
+ }
+ }
+ }
+ }
+HXDLIN( 260) void** ptr1 = (void**)x->getBase();
+HXDLIN( 260) ::cpp::Int64 ptrInt641 = reinterpret_cast<int64_t>(ptr1);
+HXDLIN( 260) {
+HXDLIN( 260) ::haxe::ds::IntMap this2 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 260) int low1 = ptrInt641 & 0xffffffff;
+HXDLIN( 260) int high1 = ptrInt641 >> 32;
+HXDLIN( 260) ::haxe::ds::IntMap highMap1 = ( ( ::haxe::ds::IntMap)(this2->get(low1)) );
+HXDLIN( 260) if (::hx::IsNull( highMap1 )) {
+HXDLIN( 260) highMap1 = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 260) this2->set(low1,highMap1);
+ }
+HXDLIN( 260) highMap1->set(high1,x);
+ }
+HXDLIN( 260) _hx_tmp->set_ref(ptr1);
+ }
+HXDLIN( 260) return ( (size_t)(x->length) );
+ }
+
+
+::String ChatMessageBuilder_obj::text__fromC(){
+ HX_STACKFRAME(&_hx_pos_1cce69560351f400_307_text__fromC)
+HXDLIN( 307) return this->text;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessageBuilder_obj,text__fromC,return )
+
+void ChatMessageBuilder_obj::set_text__fromC(::String value){
+ HX_STACKFRAME(&_hx_pos_1cce69560351f400_318_set_text__fromC)
+HXDLIN( 318) this->text = value;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(ChatMessageBuilder_obj,set_text__fromC,(void))
+
+::String ChatMessageBuilder_obj::lang__fromC(){
+ HX_STACKFRAME(&_hx_pos_1cce69560351f400_307_lang__fromC)
+HXDLIN( 307) return this->lang;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessageBuilder_obj,lang__fromC,return )
+
+void ChatMessageBuilder_obj::set_lang__fromC(::String value){
+ HX_STACKFRAME(&_hx_pos_1cce69560351f400_318_set_lang__fromC)
+HXDLIN( 318) this->lang = value;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(ChatMessageBuilder_obj,set_lang__fromC,(void))
+
+int ChatMessageBuilder_obj::direction__fromC(){
+ HX_STACKFRAME(&_hx_pos_1cce69560351f400_307_direction__fromC)
+HXDLIN( 307) return this->direction;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessageBuilder_obj,direction__fromC,return )
+
+void ChatMessageBuilder_obj::set_direction__fromC(int value){
+ HX_STACKFRAME(&_hx_pos_1cce69560351f400_318_set_direction__fromC)
+HXDLIN( 318) this->direction = value;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(ChatMessageBuilder_obj,set_direction__fromC,(void))
+
+int ChatMessageBuilder_obj::status__fromC(){
+ HX_STACKFRAME(&_hx_pos_1cce69560351f400_307_status__fromC)
+HXDLIN( 307) return this->status;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessageBuilder_obj,status__fromC,return )
+
+void ChatMessageBuilder_obj::set_status__fromC(int value){
+ HX_STACKFRAME(&_hx_pos_1cce69560351f400_318_set_status__fromC)
+HXDLIN( 318) this->status = value;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(ChatMessageBuilder_obj,set_status__fromC,(void))
+
+size_t ChatMessageBuilder_obj::versions__fromC(void*** outPtr){
+ HX_GC_STACKFRAME(&_hx_pos_1cce69560351f400_297_versions__fromC)
+HXDLIN( 297) ::Array< ::Dynamic> x = this->versions;
+HXDLIN( 297) if (::hx::IsNotNull( outPtr )) {
+HXDLIN( 297) ::cpp::Pointer< void** > _hx_tmp = ::cpp::Pointer_obj::fromRaw(outPtr);
+HXDLIN( 297) {
+HXDLIN( 297) int _g = 0;
+HXDLIN( 297) while((_g < x->length)){
+HXDLIN( 297) ::snikket::ChatMessage el = x->__get(_g).StaticCast< ::snikket::ChatMessage >();
+HXDLIN( 297) _g = (_g + 1);
+HXDLIN( 297) {
+HXDLIN( 297) ::Dynamic haxeObject = el;
+HXDLIN( 297) void* ptr = haxeObject.mPtr;
+HXDLIN( 297) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(ptr);
+HXDLIN( 297) {
+HXDLIN( 297) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 297) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 297) int high = ptrInt64 >> 32;
+HXDLIN( 297) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 297) if (::hx::IsNull( highMap )) {
+HXDLIN( 297) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 297) this1->set(low,highMap);
+ }
+HXDLIN( 297) highMap->set(high,haxeObject);
+ }
+ }
+ }
+ }
+HXDLIN( 297) void** ptr1 = (void**)x->getBase();
+HXDLIN( 297) ::cpp::Int64 ptrInt641 = reinterpret_cast<int64_t>(ptr1);
+HXDLIN( 297) {
+HXDLIN( 297) ::haxe::ds::IntMap this2 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 297) int low1 = ptrInt641 & 0xffffffff;
+HXDLIN( 297) int high1 = ptrInt641 >> 32;
+HXDLIN( 297) ::haxe::ds::IntMap highMap1 = ( ( ::haxe::ds::IntMap)(this2->get(low1)) );
+HXDLIN( 297) if (::hx::IsNull( highMap1 )) {
+HXDLIN( 297) highMap1 = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 297) this2->set(low1,highMap1);
+ }
+HXDLIN( 297) highMap1->set(high1,x);
+ }
+HXDLIN( 297) _hx_tmp->set_ref(ptr1);
+ }
+HXDLIN( 297) return ( (size_t)(x->length) );
+ }
+
+
+void ChatMessageBuilder_obj::attachSims( ::snikket::Stanza sims){
+ HX_GC_STACKFRAME(&_hx_pos_cb10733abcc4a57a_214_attachSims)
+HXLINE( 215) ::String mime = sims->findText(HX_("{urn:xmpp:jingle:apps:file-transfer:5}/media-type#",f7,02,ad,24));
+HXLINE( 216) if (::hx::IsNull( mime )) {
+HXLINE( 216) mime = sims->findText(HX_("{urn:xmpp:jingle:apps:file-transfer:3}/media-type#",39,5c,52,9f));
+ }
+HXLINE( 217) if (::hx::IsNull( mime )) {
+HXLINE( 217) mime = HX_("application/octet-stream",5d,f8,82,30);
+ }
+HXLINE( 218) ::String name = sims->findText(HX_("{urn:xmpp:jingle:apps:file-transfer:5}/name#",6f,0a,d5,d2));
+HXLINE( 219) if (::hx::IsNull( name )) {
+HXLINE( 219) name = sims->findText(HX_("{urn:xmpp:jingle:apps:file-transfer:3}/name#",31,26,70,60));
+ }
+HXLINE( 220) ::String size = sims->findText(HX_("{urn:xmpp:jingle:apps:file-transfer:5}/size#",39,83,29,b9));
+HXLINE( 221) if (::hx::IsNull( size )) {
+HXLINE( 221) size = sims->findText(HX_("{urn:xmpp:jingle:apps:file-transfer:3}/size#",fb,9e,c4,46));
+ }
+HXLINE( 222) ::Array< ::Dynamic> _this;
+HXDLIN( 222) ::snikket::Stanza tmp;
+HXDLIN( 222) ::snikket::Stanza tmp1 = sims->getChild(HX_("file",7c,ce,bb,43),HX_("urn:xmpp:jingle:apps:file-transfer:5",9c,81,0d,37));
+HXDLIN( 222) if (::hx::IsNotNull( tmp1 )) {
+HXLINE( 222) tmp = tmp1;
+ }
+ else {
+HXLINE( 222) tmp = sims->getChild(HX_("file",7c,ce,bb,43),HX_("urn:xmpp:jingle:apps:file-transfer:3",9a,81,0d,37));
+ }
+HXDLIN( 222) ::Array< ::Dynamic> tmp2;
+HXDLIN( 222) if (::hx::IsNotNull( tmp )) {
+HXLINE( 222) tmp2 = tmp->allTags(HX_("hash",ce,2f,08,45),HX_("urn:xmpp:hashes:2",90,ad,87,c7));
+ }
+ else {
+HXLINE( 222) tmp2 = null();
+ }
+HXDLIN( 222) if (::hx::IsNotNull( tmp2 )) {
+HXLINE( 222) _this = tmp2;
+ }
+ else {
+HXLINE( 222) _this = ::Array_obj< ::Dynamic>::__new(0);
+ }
+HXDLIN( 222) ::Array< ::Dynamic> result = ::Array_obj< ::Dynamic>::__new(_this->length);
+HXDLIN( 222) {
+HXLINE( 222) int _g = 0;
+HXDLIN( 222) int _g1 = _this->length;
+HXDLIN( 222) while((_g < _g1)){
+HXLINE( 222) _g = (_g + 1);
+HXDLIN( 222) int i = (_g - 1);
+HXDLIN( 222) {
+HXLINE( 223) ::snikket::Stanza hash = ( ( ::snikket::Stanza)(_hx_array_unsafe_get(_this,i)) );
+HXDLIN( 223) ::String inValue;
+HXDLIN( 223) ::String tmp3 = ( (::String)(::Reflect_obj::field(hash->attr,HX_("algo",d3,ff,6f,40))) );
+HXDLIN( 223) if (::hx::IsNotNull( tmp3 )) {
+HXLINE( 223) inValue = tmp3;
+ }
+ else {
+HXLINE( 223) inValue = HX_("",00,00,00,00);
+ }
+HXLINE( 222) ::snikket::Hash inValue1 = ::snikket::Hash_obj::__alloc( HX_CTX ,inValue,::haxe::crypto::Base64_obj::decode(hash->getText(),null())->b);
+HXDLIN( 222) result->__unsafe_set(i,inValue1);
+ }
+ }
+ }
+HXDLIN( 222) ::Array< ::Dynamic> hashes = result;
+HXLINE( 224) ::snikket::Stanza sources = sims->getChild(HX_("sources",38,0f,49,b9),null());
+HXLINE( 225) ::Array< ::Dynamic> _this1;
+HXDLIN( 225) ::Array< ::Dynamic> tmp4;
+HXDLIN( 225) if (::hx::IsNotNull( sources )) {
+HXLINE( 225) tmp4 = sources->allTags(HX_("reference",cb,07,c5,5a),HX_("urn:xmpp:reference:0",a5,00,10,5d));
+ }
+ else {
+HXLINE( 225) tmp4 = null();
+ }
+HXDLIN( 225) if (::hx::IsNotNull( tmp4 )) {
+HXLINE( 225) _this1 = tmp4;
+ }
+ else {
+HXLINE( 225) _this1 = ::Array_obj< ::Dynamic>::__new(0);
+ }
+HXDLIN( 225) ::Array< ::String > result1 = ::Array_obj< ::String >::__new(_this1->length);
+HXDLIN( 225) {
+HXLINE( 225) int _g2 = 0;
+HXDLIN( 225) int _g3 = _this1->length;
+HXDLIN( 225) while((_g2 < _g3)){
+HXLINE( 225) _g2 = (_g2 + 1);
+HXDLIN( 225) int i1 = (_g2 - 1);
+HXDLIN( 225) {
+HXLINE( 225) ::String inValue2;
+HXDLIN( 225) ::String tmp5 = ( (::String)(::Reflect_obj::field(( ( ::snikket::Stanza)(_hx_array_unsafe_get(_this1,i1)) )->attr,HX_("uri",6c,2b,59,00))) );
+HXDLIN( 225) if (::hx::IsNotNull( tmp5 )) {
+HXLINE( 225) inValue2 = tmp5;
+ }
+ else {
+HXLINE( 225) inValue2 = HX_("",00,00,00,00);
+ }
+HXDLIN( 225) result1->__unsafe_set(i1,inValue2);
+ }
+ }
+ }
+HXDLIN( 225) ::Array< ::String > _g4 = ::Array_obj< ::String >::__new(0);
+HXDLIN( 225) {
+HXLINE( 225) int _g5 = 0;
+HXDLIN( 225) ::Array< ::String > _g6 = result1;
+HXDLIN( 225) while((_g5 < _g6->length)){
+HXLINE( 225) ::String v = _g6->__get(_g5);
+HXDLIN( 225) _g5 = (_g5 + 1);
+HXDLIN( 225) if ((v != HX_("",00,00,00,00))) {
+HXLINE( 225) _g4->push(v);
+ }
+ }
+ }
+HXDLIN( 225) ::Array< ::String > uris = _g4;
+HXLINE( 226) if ((uris->length > 0)) {
+HXLINE( 226) ::Array< ::Dynamic> _hx_tmp = this->attachments;
+HXDLIN( 226) ::Dynamic _hx_tmp1;
+HXDLIN( 226) if (::hx::IsNull( size )) {
+HXLINE( 226) _hx_tmp1 = null();
+ }
+ else {
+HXLINE( 226) _hx_tmp1 = ::Std_obj::parseInt(size);
+ }
+HXDLIN( 226) _hx_tmp->push( ::snikket::ChatAttachment_obj::__alloc( HX_CTX ,name,mime,_hx_tmp1,uris,hashes));
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(ChatMessageBuilder_obj,attachSims,(void))
+
+void ChatMessageBuilder_obj::addAttachment( ::snikket::ChatAttachment attachment){
+ HX_STACKFRAME(&_hx_pos_cb10733abcc4a57a_230_addAttachment)
+HXDLIN( 230) this->attachments->push(attachment);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(ChatMessageBuilder_obj,addAttachment,(void))
+
+void ChatMessageBuilder_obj::setHtml(::String html){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ bool _hx_run( ::snikket::Stanza p){
+ HX_GC_STACKFRAME(&_hx_pos_cb10733abcc4a57a_252_setHtml)
+HXLINE( 252) if ((( (::String)(::Reflect_obj::field(p->attr,HX_("xmlns",dc,31,74,60))) ) == HX_("http://jabber.org/protocol/xhtml-im",c2,5d,b2,ce))) {
+HXLINE( 252) return (p->name == HX_("html",6b,95,16,45));
+ }
+ else {
+HXLINE( 252) return false;
+ }
+HXDLIN( 252) return false;
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_cb10733abcc4a57a_237_setHtml)
+HXLINE( 238) ::snikket::Stanza htmlEl = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("html",6b,95,16,45), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("http://jabber.org/protocol/xhtml-im",c2,5d,b2,ce))));
+HXLINE( 239) ::snikket::Stanza body = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("body",a2,7a,1b,41), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("http://www.w3.org/1999/xhtml",90,6d,f8,c8))));
+HXLINE( 240) htmlEl->addChild(body);
+HXLINE( 241) ::Array< ::Dynamic> nodes = ::htmlparser::HtmlParser_obj::run(html,true);
+HXLINE( 242) {
+HXLINE( 242) int _g = 0;
+HXDLIN( 242) while((_g < nodes->length)){
+HXLINE( 242) ::htmlparser::HtmlNode node = nodes->__get(_g).StaticCast< ::htmlparser::HtmlNode >();
+HXDLIN( 242) _g = (_g + 1);
+HXLINE( 243) ::htmlparser::HtmlNodeElement el = ( ( ::htmlparser::HtmlNodeElement)(::snikket::_Util::Util_Fields__obj::downcast(node,::hx::ClassOf< ::htmlparser::HtmlNodeElement >())) );
+HXLINE( 244) bool _hx_tmp;
+HXDLIN( 244) if (::hx::IsNotNull( el )) {
+HXLINE( 244) if ((el->name != HX_("html",6b,95,16,45))) {
+HXLINE( 244) _hx_tmp = (el->name == HX_("body",a2,7a,1b,41));
+ }
+ else {
+HXLINE( 244) _hx_tmp = true;
+ }
+ }
+ else {
+HXLINE( 244) _hx_tmp = false;
+ }
+HXDLIN( 244) if (_hx_tmp) {
+HXLINE( 245) int _g1 = 0;
+HXDLIN( 245) ::Array< ::Dynamic> _g2 = el->nodes;
+HXDLIN( 245) while((_g1 < _g2->length)){
+HXLINE( 245) ::htmlparser::HtmlNode inner = _g2->__get(_g1).StaticCast< ::htmlparser::HtmlNode >();
+HXDLIN( 245) _g1 = (_g1 + 1);
+HXLINE( 246) body->addDirectChild(this->htmlToNode(inner));
+ }
+ }
+ else {
+HXLINE( 249) body->addDirectChild(this->htmlToNode(node));
+ }
+ }
+ }
+HXLINE( 252) int htmlIdx = ::Lambda_obj::findIndex(this->payloads, ::Dynamic(new _hx_Closure_0()));
+HXLINE( 253) if ((htmlIdx >= 0)) {
+HXLINE( 253) this->payloads->removeRange(htmlIdx,1);
+ }
+HXLINE( 254) this->payloads->push(htmlEl);
+HXLINE( 255) this->text = ::snikket::XEP0393_obj::render(body);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(ChatMessageBuilder_obj,setHtml,(void))
+
+ ::snikket::Node ChatMessageBuilder_obj::htmlToNode( ::htmlparser::HtmlNode node){
+ HX_GC_STACKFRAME(&_hx_pos_cb10733abcc4a57a_258_htmlToNode)
+HXLINE( 259) ::htmlparser::HtmlNodeText txt = ( ( ::htmlparser::HtmlNodeText)(::snikket::_Util::Util_Fields__obj::downcast(node,::hx::ClassOf< ::htmlparser::HtmlNodeText >())) );
+HXLINE( 260) if (::hx::IsNotNull( txt )) {
+HXLINE( 261) return ::snikket::Node_obj::CData( ::snikket::TextNode_obj::__alloc( HX_CTX ,txt->toText()));
+ }
+HXLINE( 263) ::htmlparser::HtmlNodeElement el = ( ( ::htmlparser::HtmlNodeElement)(::snikket::_Util::Util_Fields__obj::downcast(node,::hx::ClassOf< ::htmlparser::HtmlNodeElement >())) );
+HXLINE( 264) if (::hx::IsNotNull( el )) {
+HXLINE( 265) ::snikket::Stanza s = ::snikket::Stanza_obj::__alloc( HX_CTX ,el->name, ::Dynamic(::hx::Anon_obj::Create(0)));
+HXLINE( 266) {
+HXLINE( 266) int _g = 0;
+HXDLIN( 266) ::Array< ::Dynamic> _g1 = el->attributes;
+HXDLIN( 266) while((_g < _g1->length)){
+HXLINE( 266) ::htmlparser::HtmlAttribute attr = _g1->__get(_g).StaticCast< ::htmlparser::HtmlAttribute >();
+HXDLIN( 266) _g = (_g + 1);
+HXLINE( 267) {
+HXLINE( 267) ::String value = attr->value;
+HXDLIN( 267) ::Reflect_obj::setField(s->attr,attr->name,value);
+ }
+ }
+ }
+HXLINE( 269) {
+HXLINE( 269) int _g2 = 0;
+HXDLIN( 269) ::Array< ::Dynamic> _g3 = el->nodes;
+HXDLIN( 269) while((_g2 < _g3->length)){
+HXLINE( 269) ::htmlparser::HtmlNode child = _g3->__get(_g2).StaticCast< ::htmlparser::HtmlNode >();
+HXDLIN( 269) _g2 = (_g2 + 1);
+HXLINE( 270) s->addDirectChild(this->htmlToNode(child));
+ }
+ }
+HXLINE( 272) return ::snikket::Node_obj::Element(s);
+ }
+HXLINE( 274) HX_STACK_DO_THROW(HX_("node was neither text nor element?",c3,dc,19,83));
+HXDLIN( 274) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(ChatMessageBuilder_obj,htmlToNode,return )
+
+::String ChatMessageBuilder_obj::chatId(){
+ HX_STACKFRAME(&_hx_pos_cb10733abcc4a57a_281_chatId)
+HXDLIN( 281) if (this->isIncoming()) {
+HXLINE( 282) ::Array< ::Dynamic> _this = this->replyTo;
+HXDLIN( 282) ::Array< ::String > result = ::Array_obj< ::String >::__new(_this->length);
+HXDLIN( 282) {
+HXLINE( 282) int _g = 0;
+HXDLIN( 282) int _g1 = _this->length;
+HXDLIN( 282) while((_g < _g1)){
+HXLINE( 282) _g = (_g + 1);
+HXDLIN( 282) int i = (_g - 1);
+HXDLIN( 282) {
+HXLINE( 282) ::String inValue = ( ( ::snikket::JID)(_hx_array_unsafe_get(_this,i)) )->asBare()->asString();
+HXDLIN( 282) result->__unsafe_set(i,inValue);
+ }
+ }
+ }
+HXDLIN( 282) return result->join(HX_("\n",0a,00,00,00));
+ }
+ else {
+HXLINE( 284) ::Array< ::Dynamic> _this1 = this->recipients;
+HXDLIN( 284) ::Array< ::String > result1 = ::Array_obj< ::String >::__new(_this1->length);
+HXDLIN( 284) {
+HXLINE( 284) int _g2 = 0;
+HXDLIN( 284) int _g3 = _this1->length;
+HXDLIN( 284) while((_g2 < _g3)){
+HXLINE( 284) _g2 = (_g2 + 1);
+HXDLIN( 284) int i1 = (_g2 - 1);
+HXDLIN( 284) {
+HXLINE( 284) ::String inValue1 = ( ( ::snikket::JID)(_hx_array_unsafe_get(_this1,i1)) )->asString();
+HXDLIN( 284) result1->__unsafe_set(i1,inValue1);
+ }
+ }
+ }
+HXDLIN( 284) return result1->join(HX_("\n",0a,00,00,00));
+ }
+HXLINE( 281) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessageBuilder_obj,chatId,return )
+
+::String ChatMessageBuilder_obj::get_senderId(){
+ HX_STACKFRAME(&_hx_pos_cb10733abcc4a57a_292_get_senderId)
+HXDLIN( 292) ::String tmp = this->senderId;
+HXDLIN( 292) ::String tmp1;
+HXDLIN( 292) if (::hx::IsNotNull( tmp )) {
+HXDLIN( 292) tmp1 = tmp;
+ }
+ else {
+HXDLIN( 292) ::snikket::JID tmp2 = this->sender;
+HXDLIN( 292) if (::hx::IsNotNull( tmp2 )) {
+HXDLIN( 292) tmp1 = tmp2->asString();
+ }
+ else {
+HXDLIN( 292) tmp1 = null();
+ }
+ }
+HXDLIN( 292) if (::hx::IsNotNull( tmp1 )) {
+HXDLIN( 292) return tmp1;
+ }
+ else {
+HXDLIN( 292) HX_STACK_DO_THROW(HX_("sender is null",12,ab,5a,42));
+ }
+HXDLIN( 292) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessageBuilder_obj,get_senderId,return )
+
+bool ChatMessageBuilder_obj::isIncoming(){
+ HX_STACKFRAME(&_hx_pos_cb10733abcc4a57a_296_isIncoming)
+HXDLIN( 296) return (this->direction == 0);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessageBuilder_obj,isIncoming,return )
+
+ ::snikket::ChatMessage ChatMessageBuilder_obj::build(){
+ HX_GC_STACKFRAME(&_hx_pos_cb10733abcc4a57a_299_build)
+HXLINE( 300) bool _hx_tmp;
+HXDLIN( 300) if (::hx::IsNull( this->serverId )) {
+HXLINE( 300) _hx_tmp = ::hx::IsNull( this->localId );
+ }
+ else {
+HXLINE( 300) _hx_tmp = false;
+ }
+HXDLIN( 300) if (_hx_tmp) {
+HXLINE( 300) HX_STACK_DO_THROW(HX_("Cannot build a ChatMessage with no id",ff,b8,88,e6));
+ }
+HXLINE( 301) ::snikket::JID to = this->to;
+HXLINE( 302) if (::hx::IsNull( to )) {
+HXLINE( 302) HX_STACK_DO_THROW(HX_("Cannot build a ChatMessage with no to",9f,c2,88,e6));
+ }
+HXLINE( 303) ::snikket::JID from = this->from;
+HXLINE( 304) if (::hx::IsNull( from )) {
+HXLINE( 304) HX_STACK_DO_THROW(HX_("Cannot build a ChatMessage with no from",8e,93,f7,22));
+ }
+HXLINE( 305) ::snikket::JID sender;
+HXDLIN( 305) ::snikket::JID tmp = this->sender;
+HXDLIN( 305) if (::hx::IsNotNull( tmp )) {
+HXLINE( 305) sender = tmp;
+ }
+ else {
+HXLINE( 305) sender = from->asBare();
+ }
+HXLINE( 307) ::String _hx_tmp1 = this->localId;
+HXLINE( 308) ::String _hx_tmp2 = this->serverId;
+HXLINE( 309) ::String _hx_tmp3 = this->serverIdBy;
+HXLINE( 310) ::Dynamic _hx_tmp4 = this->type;
+HXLINE( 311) ::Dynamic _hx_tmp5 = this->syncPoint;
+HXLINE( 312) ::String _hx_tmp6 = this->replyId;
+HXLINE( 313) ::String _hx_tmp7;
+HXDLIN( 313) ::String tmp1 = this->timestamp;
+HXDLIN( 313) if (::hx::IsNotNull( tmp1 )) {
+HXLINE( 313) _hx_tmp7 = tmp1;
+ }
+ else {
+HXLINE( 313) _hx_tmp7 = ::snikket::Date_obj::format(::Date_obj::now());
+ }
+HXLINE( 306) return ::snikket::ChatMessage_obj::__alloc( HX_CTX , ::Dynamic(::hx::Anon_obj::Create(23)
+ ->setFixed(0,HX_("recipients",7a,62,59,87),this->recipients)
+ ->setFixed(1,HX_("syncPoint",f5,ff,94,98),_hx_tmp5)
+ ->setFixed(2,HX_("payloads",25,dd,d1,a1),this->payloads)
+ ->setFixed(3,HX_("timestamp",d6,d4,ce,a5),_hx_tmp7)
+ ->setFixed(4,HX_("replyToMessage",02,cf,60,a6),this->replyToMessage)
+ ->setFixed(5,HX_("replyId",a5,67,3a,ab),_hx_tmp6)
+ ->setFixed(6,HX_("replyTo",45,71,3a,ab),this->replyTo)
+ ->setFixed(7,HX_("threadId",45,81,25,cc),this->threadId)
+ ->setFixed(8,HX_("versions",5b,4e,b8,d6),this->versions)
+ ->setFixed(9,HX_("serverId",7e,01,b2,e2),_hx_tmp2)
+ ->setFixed(10,HX_("attachments",30,df,33,e7),this->attachments)
+ ->setFixed(11,HX_("reactions",aa,cc,95,e7),this->reactions)
+ ->setFixed(12,HX_("senderId",f0,1e,0e,ec),this->get_senderId())
+ ->setFixed(13,HX_("to",7b,65,00,00),to)
+ ->setFixed(14,HX_("stanza",f5,5d,f7,05),this->stanza)
+ ->setFixed(15,HX_("status",32,e7,fb,05),this->status)
+ ->setFixed(16,HX_("direction",3f,62,40,10),this->direction)
+ ->setFixed(17,HX_("localId",26,7a,c6,2d),_hx_tmp1)
+ ->setFixed(18,HX_("from",6a,a5,c2,43),from)
+ ->setFixed(19,HX_("lang",ee,05,ad,47),this->lang)
+ ->setFixed(20,HX_("text",ad,cc,f9,4c),this->text)
+ ->setFixed(21,HX_("type",ba,f2,08,4d),_hx_tmp4)
+ ->setFixed(22,HX_("serverIdBy",f5,16,54,74),_hx_tmp3)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ChatMessageBuilder_obj,build,return )
+
+ ::snikket::ChatMessage ChatMessageBuilder_obj::makeModerated( ::snikket::ChatMessage m,::String timestamp,::String moderatorId,::String reason){
+ HX_GC_STACKFRAME(&_hx_pos_cb10733abcc4a57a_183_makeModerated)
+HXLINE( 184) ::snikket::ChatMessageBuilder builder = ::snikket::ChatMessageBuilder_obj::__alloc( HX_CTX );
+HXLINE( 185) builder->localId = m->localId;
+HXLINE( 186) builder->serverId = m->serverId;
+HXLINE( 187) builder->serverIdBy = m->serverIdBy;
+HXLINE( 188) builder->type = m->type;
+HXLINE( 189) builder->syncPoint = m->syncPoint;
+HXLINE( 190) builder->replyId = m->replyId;
+HXLINE( 191) builder->timestamp = m->timestamp;
+HXLINE( 192) builder->to = m->to;
+HXLINE( 193) builder->from = m->from;
+HXLINE( 194) builder->senderId = m->senderId;
+HXLINE( 195) builder->recipients = ::Lambda_obj::array(m->recipients);
+HXLINE( 196) builder->replyTo = ::Lambda_obj::array(m->replyTo);
+HXLINE( 197) builder->replyToMessage = m->replyToMessage;
+HXLINE( 198) builder->threadId = m->threadId;
+HXLINE( 199) builder->reactions = m->reactions;
+HXLINE( 200) builder->direction = m->direction;
+HXLINE( 201) builder->status = m->status;
+HXLINE( 202) ::snikket::ChatMessage cleanedStub = builder->build();
+HXLINE( 203) ::snikket::Stanza payload = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("retracted",a0,7c,77,08), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("stamp",03,70,0b,84),timestamp)
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:message-retract:1",16,5e,d8,d5))));
+HXLINE( 204) if (::hx::IsNotNull( reason )) {
+HXLINE( 204) payload->textTag(HX_("reason",c4,0f,9d,fc),reason,null());
+ }
+HXLINE( 205) payload->tag(HX_("moderated",41,37,3b,22), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("by",d7,55,00,00),moderatorId)
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:message-moderate:1",5c,30,1a,b9))))->up();
+HXLINE( 206) builder->payloads->push(payload);
+HXLINE( 207) builder->timestamp = timestamp;
+HXLINE( 208) builder->versions = ::Array_obj< ::Dynamic>::__new(2)->init(0,builder->build())->init(1,cleanedStub);
+HXLINE( 209) builder->timestamp = m->timestamp;
+HXLINE( 210) return builder->build();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC4(ChatMessageBuilder_obj,makeModerated,return )
+
+
+::hx::ObjectPtr< ChatMessageBuilder_obj > ChatMessageBuilder_obj::__new() {
+ ::hx::ObjectPtr< ChatMessageBuilder_obj > __this = new ChatMessageBuilder_obj();
+ __this->__construct();
+ return __this;
+}
+
+::hx::ObjectPtr< ChatMessageBuilder_obj > ChatMessageBuilder_obj::__alloc(::hx::Ctx *_hx_ctx) {
+ ChatMessageBuilder_obj *__this = (ChatMessageBuilder_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(ChatMessageBuilder_obj), true, "snikket.ChatMessageBuilder"));
+ *(void **)__this = ChatMessageBuilder_obj::_hx_vtable;
+ __this->__construct();
+ return __this;
+}
+
+ChatMessageBuilder_obj::ChatMessageBuilder_obj()
+{
+}
+
+void ChatMessageBuilder_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(ChatMessageBuilder);
+ HX_MARK_MEMBER_NAME(localId,"localId");
+ HX_MARK_MEMBER_NAME(serverId,"serverId");
+ HX_MARK_MEMBER_NAME(serverIdBy,"serverIdBy");
+ HX_MARK_MEMBER_NAME(type,"type");
+ HX_MARK_MEMBER_NAME(syncPoint,"syncPoint");
+ HX_MARK_MEMBER_NAME(replyId,"replyId");
+ HX_MARK_MEMBER_NAME(timestamp,"timestamp");
+ HX_MARK_MEMBER_NAME(to,"to");
+ HX_MARK_MEMBER_NAME(from,"from");
+ HX_MARK_MEMBER_NAME(sender,"sender");
+ HX_MARK_MEMBER_NAME(recipients,"recipients");
+ HX_MARK_MEMBER_NAME(replyTo,"replyTo");
+ HX_MARK_MEMBER_NAME(senderId,"senderId");
+ HX_MARK_MEMBER_NAME(replyToMessage,"replyToMessage");
+ HX_MARK_MEMBER_NAME(threadId,"threadId");
+ HX_MARK_MEMBER_NAME(attachments,"attachments");
+ HX_MARK_MEMBER_NAME(reactions,"reactions");
+ HX_MARK_MEMBER_NAME(text,"text");
+ HX_MARK_MEMBER_NAME(lang,"lang");
+ HX_MARK_MEMBER_NAME(direction,"direction");
+ HX_MARK_MEMBER_NAME(status,"status");
+ HX_MARK_MEMBER_NAME(versions,"versions");
+ HX_MARK_MEMBER_NAME(payloads,"payloads");
+ HX_MARK_MEMBER_NAME(stanza,"stanza");
+ HX_MARK_END_CLASS();
+}
+
+void ChatMessageBuilder_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(localId,"localId");
+ HX_VISIT_MEMBER_NAME(serverId,"serverId");
+ HX_VISIT_MEMBER_NAME(serverIdBy,"serverIdBy");
+ HX_VISIT_MEMBER_NAME(type,"type");
+ HX_VISIT_MEMBER_NAME(syncPoint,"syncPoint");
+ HX_VISIT_MEMBER_NAME(replyId,"replyId");
+ HX_VISIT_MEMBER_NAME(timestamp,"timestamp");
+ HX_VISIT_MEMBER_NAME(to,"to");
+ HX_VISIT_MEMBER_NAME(from,"from");
+ HX_VISIT_MEMBER_NAME(sender,"sender");
+ HX_VISIT_MEMBER_NAME(recipients,"recipients");
+ HX_VISIT_MEMBER_NAME(replyTo,"replyTo");
+ HX_VISIT_MEMBER_NAME(senderId,"senderId");
+ HX_VISIT_MEMBER_NAME(replyToMessage,"replyToMessage");
+ HX_VISIT_MEMBER_NAME(threadId,"threadId");
+ HX_VISIT_MEMBER_NAME(attachments,"attachments");
+ HX_VISIT_MEMBER_NAME(reactions,"reactions");
+ HX_VISIT_MEMBER_NAME(text,"text");
+ HX_VISIT_MEMBER_NAME(lang,"lang");
+ HX_VISIT_MEMBER_NAME(direction,"direction");
+ HX_VISIT_MEMBER_NAME(status,"status");
+ HX_VISIT_MEMBER_NAME(versions,"versions");
+ HX_VISIT_MEMBER_NAME(payloads,"payloads");
+ HX_VISIT_MEMBER_NAME(stanza,"stanza");
+}
+
+::hx::Val ChatMessageBuilder_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 2:
+ if (HX_FIELD_EQ(inName,"to") ) { return ::hx::Val( to ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"type") ) { return ::hx::Val( type ); }
+ if (HX_FIELD_EQ(inName,"from") ) { return ::hx::Val( from ); }
+ if (HX_FIELD_EQ(inName,"text") ) { return ::hx::Val( text ); }
+ if (HX_FIELD_EQ(inName,"lang") ) { return ::hx::Val( lang ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"build") ) { return ::hx::Val( build_dyn() ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"sender") ) { return ::hx::Val( sender ); }
+ if (HX_FIELD_EQ(inName,"status") ) { return ::hx::Val( status ); }
+ if (HX_FIELD_EQ(inName,"stanza") ) { return ::hx::Val( stanza ); }
+ if (HX_FIELD_EQ(inName,"chatId") ) { return ::hx::Val( chatId_dyn() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"localId") ) { return ::hx::Val( localId ); }
+ if (HX_FIELD_EQ(inName,"replyId") ) { return ::hx::Val( replyId ); }
+ if (HX_FIELD_EQ(inName,"replyTo") ) { return ::hx::Val( replyTo ); }
+ if (HX_FIELD_EQ(inName,"setHtml") ) { return ::hx::Val( setHtml_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"serverId") ) { return ::hx::Val( serverId ); }
+ if (HX_FIELD_EQ(inName,"senderId") ) { return ::hx::Val( inCallProp == ::hx::paccAlways ? get_senderId() : senderId ); }
+ if (HX_FIELD_EQ(inName,"threadId") ) { return ::hx::Val( threadId ); }
+ if (HX_FIELD_EQ(inName,"versions") ) { return ::hx::Val( versions ); }
+ if (HX_FIELD_EQ(inName,"payloads") ) { return ::hx::Val( payloads ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"syncPoint") ) { return ::hx::Val( syncPoint ); }
+ if (HX_FIELD_EQ(inName,"timestamp") ) { return ::hx::Val( timestamp ); }
+ if (HX_FIELD_EQ(inName,"reactions") ) { return ::hx::Val( reactions ); }
+ if (HX_FIELD_EQ(inName,"direction") ) { return ::hx::Val( direction ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"serverIdBy") ) { return ::hx::Val( serverIdBy ); }
+ if (HX_FIELD_EQ(inName,"recipients") ) { return ::hx::Val( recipients ); }
+ if (HX_FIELD_EQ(inName,"attachSims") ) { return ::hx::Val( attachSims_dyn() ); }
+ if (HX_FIELD_EQ(inName,"htmlToNode") ) { return ::hx::Val( htmlToNode_dyn() ); }
+ if (HX_FIELD_EQ(inName,"isIncoming") ) { return ::hx::Val( isIncoming_dyn() ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"type__fromC") ) { return ::hx::Val( type__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"attachments") ) { return ::hx::Val( attachments ); }
+ if (HX_FIELD_EQ(inName,"text__fromC") ) { return ::hx::Val( text__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"lang__fromC") ) { return ::hx::Val( lang__fromC_dyn() ); }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"get_senderId") ) { return ::hx::Val( get_senderId_dyn() ); }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"status__fromC") ) { return ::hx::Val( status__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"addAttachment") ) { return ::hx::Val( addAttachment_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"localId__fromC") ) { return ::hx::Val( localId__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"replyToMessage") ) { return ::hx::Val( replyToMessage ); }
+ break;
+ case 15:
+ if (HX_FIELD_EQ(inName,"serverId__fromC") ) { return ::hx::Val( serverId__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"set_type__fromC") ) { return ::hx::Val( set_type__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"senderId__fromC") ) { return ::hx::Val( senderId__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"threadId__fromC") ) { return ::hx::Val( threadId__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"set_text__fromC") ) { return ::hx::Val( set_text__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"set_lang__fromC") ) { return ::hx::Val( set_lang__fromC_dyn() ); }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"timestamp__fromC") ) { return ::hx::Val( timestamp__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"direction__fromC") ) { return ::hx::Val( direction__fromC_dyn() ); }
+ break;
+ case 17:
+ if (HX_FIELD_EQ(inName,"serverIdBy__fromC") ) { return ::hx::Val( serverIdBy__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"set_status__fromC") ) { return ::hx::Val( set_status__fromC_dyn() ); }
+ break;
+ case 18:
+ if (HX_FIELD_EQ(inName,"set_localId__fromC") ) { return ::hx::Val( set_localId__fromC_dyn() ); }
+ break;
+ case 19:
+ if (HX_FIELD_EQ(inName,"set_serverId__fromC") ) { return ::hx::Val( set_serverId__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"set_senderId__fromC") ) { return ::hx::Val( set_senderId__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"set_threadId__fromC") ) { return ::hx::Val( set_threadId__fromC_dyn() ); }
+ break;
+ case 20:
+ if (HX_FIELD_EQ(inName,"set_timestamp__fromC") ) { return ::hx::Val( set_timestamp__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"set_direction__fromC") ) { return ::hx::Val( set_direction__fromC_dyn() ); }
+ break;
+ case 21:
+ if (HX_FIELD_EQ(inName,"set_serverIdBy__fromC") ) { return ::hx::Val( set_serverIdBy__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"replyToMessage__fromC") ) { return ::hx::Val( replyToMessage__fromC_dyn() ); }
+ break;
+ case 25:
+ if (HX_FIELD_EQ(inName,"set_replyToMessage__fromC") ) { return ::hx::Val( set_replyToMessage__fromC_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool ChatMessageBuilder_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 13:
+ if (HX_FIELD_EQ(inName,"makeModerated") ) { outValue = makeModerated_dyn(); return true; }
+ }
+ return false;
+}
+
+::hx::Val ChatMessageBuilder_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 2:
+ if (HX_FIELD_EQ(inName,"to") ) { to=inValue.Cast< ::snikket::JID >(); return inValue; }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"type") ) { type=inValue.Cast< int >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"from") ) { from=inValue.Cast< ::snikket::JID >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"text") ) { text=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"lang") ) { lang=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"sender") ) { sender=inValue.Cast< ::snikket::JID >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"status") ) { status=inValue.Cast< int >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"stanza") ) { stanza=inValue.Cast< ::snikket::Stanza >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"localId") ) { localId=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"replyId") ) { replyId=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"replyTo") ) { replyTo=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"serverId") ) { serverId=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"senderId") ) { senderId=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"threadId") ) { threadId=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"versions") ) { versions=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"payloads") ) { payloads=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"syncPoint") ) { syncPoint=inValue.Cast< bool >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"timestamp") ) { timestamp=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"reactions") ) { reactions=inValue.Cast< ::haxe::ds::StringMap >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"direction") ) { direction=inValue.Cast< int >(); return inValue; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"serverIdBy") ) { serverIdBy=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"recipients") ) { recipients=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"attachments") ) { attachments=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"replyToMessage") ) { replyToMessage=inValue.Cast< ::snikket::ChatMessage >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void ChatMessageBuilder_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("localId",26,7a,c6,2d));
+ outFields->push(HX_("serverId",7e,01,b2,e2));
+ outFields->push(HX_("serverIdBy",f5,16,54,74));
+ outFields->push(HX_("type",ba,f2,08,4d));
+ outFields->push(HX_("syncPoint",f5,ff,94,98));
+ outFields->push(HX_("replyId",a5,67,3a,ab));
+ outFields->push(HX_("timestamp",d6,d4,ce,a5));
+ outFields->push(HX_("to",7b,65,00,00));
+ outFields->push(HX_("from",6a,a5,c2,43));
+ outFields->push(HX_("sender",b5,c7,84,6b));
+ outFields->push(HX_("recipients",7a,62,59,87));
+ outFields->push(HX_("replyTo",45,71,3a,ab));
+ outFields->push(HX_("senderId",f0,1e,0e,ec));
+ outFields->push(HX_("replyToMessage",02,cf,60,a6));
+ outFields->push(HX_("threadId",45,81,25,cc));
+ outFields->push(HX_("attachments",30,df,33,e7));
+ outFields->push(HX_("reactions",aa,cc,95,e7));
+ outFields->push(HX_("text",ad,cc,f9,4c));
+ outFields->push(HX_("lang",ee,05,ad,47));
+ outFields->push(HX_("direction",3f,62,40,10));
+ outFields->push(HX_("status",32,e7,fb,05));
+ outFields->push(HX_("versions",5b,4e,b8,d6));
+ outFields->push(HX_("payloads",25,dd,d1,a1));
+ outFields->push(HX_("stanza",f5,5d,f7,05));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo ChatMessageBuilder_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(ChatMessageBuilder_obj,localId),HX_("localId",26,7a,c6,2d)},
+ {::hx::fsString,(int)offsetof(ChatMessageBuilder_obj,serverId),HX_("serverId",7e,01,b2,e2)},
+ {::hx::fsString,(int)offsetof(ChatMessageBuilder_obj,serverIdBy),HX_("serverIdBy",f5,16,54,74)},
+ {::hx::fsInt,(int)offsetof(ChatMessageBuilder_obj,type),HX_("type",ba,f2,08,4d)},
+ {::hx::fsBool,(int)offsetof(ChatMessageBuilder_obj,syncPoint),HX_("syncPoint",f5,ff,94,98)},
+ {::hx::fsString,(int)offsetof(ChatMessageBuilder_obj,replyId),HX_("replyId",a5,67,3a,ab)},
+ {::hx::fsString,(int)offsetof(ChatMessageBuilder_obj,timestamp),HX_("timestamp",d6,d4,ce,a5)},
+ {::hx::fsObject /* ::snikket::JID */ ,(int)offsetof(ChatMessageBuilder_obj,to),HX_("to",7b,65,00,00)},
+ {::hx::fsObject /* ::snikket::JID */ ,(int)offsetof(ChatMessageBuilder_obj,from),HX_("from",6a,a5,c2,43)},
+ {::hx::fsObject /* ::snikket::JID */ ,(int)offsetof(ChatMessageBuilder_obj,sender),HX_("sender",b5,c7,84,6b)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(ChatMessageBuilder_obj,recipients),HX_("recipients",7a,62,59,87)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(ChatMessageBuilder_obj,replyTo),HX_("replyTo",45,71,3a,ab)},
+ {::hx::fsString,(int)offsetof(ChatMessageBuilder_obj,senderId),HX_("senderId",f0,1e,0e,ec)},
+ {::hx::fsObject /* ::snikket::ChatMessage */ ,(int)offsetof(ChatMessageBuilder_obj,replyToMessage),HX_("replyToMessage",02,cf,60,a6)},
+ {::hx::fsString,(int)offsetof(ChatMessageBuilder_obj,threadId),HX_("threadId",45,81,25,cc)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(ChatMessageBuilder_obj,attachments),HX_("attachments",30,df,33,e7)},
+ {::hx::fsObject /* ::haxe::ds::StringMap */ ,(int)offsetof(ChatMessageBuilder_obj,reactions),HX_("reactions",aa,cc,95,e7)},
+ {::hx::fsString,(int)offsetof(ChatMessageBuilder_obj,text),HX_("text",ad,cc,f9,4c)},
+ {::hx::fsString,(int)offsetof(ChatMessageBuilder_obj,lang),HX_("lang",ee,05,ad,47)},
+ {::hx::fsInt,(int)offsetof(ChatMessageBuilder_obj,direction),HX_("direction",3f,62,40,10)},
+ {::hx::fsInt,(int)offsetof(ChatMessageBuilder_obj,status),HX_("status",32,e7,fb,05)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(ChatMessageBuilder_obj,versions),HX_("versions",5b,4e,b8,d6)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(ChatMessageBuilder_obj,payloads),HX_("payloads",25,dd,d1,a1)},
+ {::hx::fsObject /* ::snikket::Stanza */ ,(int)offsetof(ChatMessageBuilder_obj,stanza),HX_("stanza",f5,5d,f7,05)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *ChatMessageBuilder_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String ChatMessageBuilder_obj_sMemberFields[] = {
+ HX_("localId",26,7a,c6,2d),
+ HX_("localId__fromC",13,27,c6,af),
+ HX_("set_localId__fromC",50,3a,0f,28),
+ HX_("serverId",7e,01,b2,e2),
+ HX_("serverId__fromC",bb,ba,c0,81),
+ HX_("set_serverId__fromC",de,7c,68,49),
+ HX_("serverIdBy",f5,16,54,74),
+ HX_("serverIdBy__fromC",24,52,2e,02),
+ HX_("set_serverIdBy__fromC",07,23,e5,d4),
+ HX_("type",ba,f2,08,4d),
+ HX_("type__fromC",ff,a8,6c,93),
+ HX_("set_type__fromC",a2,dd,19,50),
+ HX_("syncPoint",f5,ff,94,98),
+ HX_("replyId",a5,67,3a,ab),
+ HX_("timestamp",d6,d4,ce,a5),
+ HX_("timestamp__fromC",63,82,8b,d7),
+ HX_("set_timestamp__fromC",e0,9e,ad,c2),
+ HX_("to",7b,65,00,00),
+ HX_("from",6a,a5,c2,43),
+ HX_("sender",b5,c7,84,6b),
+ HX_("recipients",7a,62,59,87),
+ HX_("replyTo",45,71,3a,ab),
+ HX_("senderId",f0,1e,0e,ec),
+ HX_("senderId__fromC",89,0f,49,cb),
+ HX_("set_senderId__fromC",ac,d1,f0,92),
+ HX_("replyToMessage",02,cf,60,a6),
+ HX_("replyToMessage__fromC",b7,65,38,93),
+ HX_("set_replyToMessage__fromC",1a,e4,8c,05),
+ HX_("threadId",45,81,25,cc),
+ HX_("threadId__fromC",d4,d1,81,79),
+ HX_("set_threadId__fromC",f7,93,29,41),
+ HX_("attachments",30,df,33,e7),
+ HX_("reactions",aa,cc,95,e7),
+ HX_("text",ad,cc,f9,4c),
+ HX_("text__fromC",6c,43,1b,7f),
+ HX_("set_text__fromC",0f,78,c8,3b),
+ HX_("lang",ee,05,ad,47),
+ HX_("lang__fromC",4b,24,00,52),
+ HX_("set_lang__fromC",ee,58,ad,0e),
+ HX_("direction",3f,62,40,10),
+ HX_("direction__fromC",1a,64,c6,4b),
+ HX_("set_direction__fromC",97,80,e8,36),
+ HX_("status",32,e7,fb,05),
+ HX_("status__fromC",87,b3,25,a1),
+ HX_("set_status__fromC",ea,96,03,cb),
+ HX_("versions",5b,4e,b8,d6),
+ HX_("payloads",25,dd,d1,a1),
+ HX_("stanza",f5,5d,f7,05),
+ HX_("attachSims",e1,83,46,cc),
+ HX_("addAttachment",64,51,bc,47),
+ HX_("setHtml",2d,d6,9a,0a),
+ HX_("htmlToNode",e8,e0,84,4c),
+ HX_("chatId",d3,04,77,b7),
+ HX_("get_senderId",f9,d2,27,a1),
+ HX_("isIncoming",f0,52,c4,95),
+ HX_("build",2e,db,ea,ba),
+ ::String(null()) };
+
+::hx::Class ChatMessageBuilder_obj::__mClass;
+
+static ::String ChatMessageBuilder_obj_sStaticFields[] = {
+ HX_("makeModerated",73,2f,e4,1a),
+ ::String(null())
+};
+
+void ChatMessageBuilder_obj::__register()
+{
+ ChatMessageBuilder_obj _hx_dummy;
+ ChatMessageBuilder_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.ChatMessageBuilder",7d,3a,ac,ff);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &ChatMessageBuilder_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(ChatMessageBuilder_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(ChatMessageBuilder_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< ChatMessageBuilder_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = ChatMessageBuilder_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = ChatMessageBuilder_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void ChatMessageBuilder_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_cb10733abcc4a57a_32_boot)
+HXDLIN( 32) __mClass->__meta__ = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("fields",79,8e,8e,80), ::Dynamic(::hx::Anon_obj::Create(27)
+ ->setFixed(0,HX_("serverId__fromC",bb,ba,c0,81), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(1,HX_("set_senderId__fromC",ac,d1,f0,92), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(2,HX_("replyToMessage__fromC",b7,65,38,93), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(3,HX_("type__fromC",ff,a8,6c,93), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(4,HX_("status__fromC",87,b3,25,a1), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(5,HX_("localId__fromC",13,27,c6,af), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(6,HX_("set_timestamp__fromC",e0,9e,ad,c2), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(7,HX_("set_status__fromC",ea,96,03,cb), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(8,HX_("senderId__fromC",89,0f,49,cb), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(9,HX_("attachments__fromC",49,d7,f7,d0), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(10,HX_("set_serverIdBy__fromC",07,23,e5,d4), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(11,HX_("timestamp__fromC",63,82,8b,d7), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(12,HX_("reactions",aa,cc,95,e7), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(13,HX_("serverIdBy__fromC",24,52,2e,02), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(14,HX_("set_replyToMessage__fromC",1a,e4,8c,05), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(15,HX_("set_lang__fromC",ee,58,ad,0e), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(16,HX_("versions__fromC",7e,73,e8,14), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(17,HX_("set_localId__fromC",50,3a,0f,28), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(18,HX_("set_direction__fromC",97,80,e8,36), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(19,HX_("set_text__fromC",0f,78,c8,3b), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(20,HX_("set_threadId__fromC",f7,93,29,41), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(21,HX_("set_serverId__fromC",de,7c,68,49), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(22,HX_("direction__fromC",1a,64,c6,4b), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(23,HX_("set_type__fromC",a2,dd,19,50), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(24,HX_("lang__fromC",4b,24,00,52), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(25,HX_("threadId__fromC",d4,d1,81,79), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(26,HX_("text__fromC",6c,43,1b,7f), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null()))))));
+ }
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/Client.cpp b/Sources/c_snikket/src/snikket/Client.cpp
new file mode 100644
index 0000000..d42290f
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/Client.cpp
@@ -0,0 +1,5072 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Date
+#include <Date.h>
+#endif
+#ifndef INCLUDED_Lambda
+#include <Lambda.h>
+#endif
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_StringTools
+#include <StringTools.h>
+#endif
+#ifndef INCLUDED__HaxeCBridge_Internal
+#include <_HaxeCBridge/Internal.h>
+#endif
+#ifndef INCLUDED_haxe_Exception
+#include <haxe/Exception.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_Log
+#include <haxe/Log.h>
+#endif
+#ifndef INCLUDED_haxe_Timer
+#include <haxe/Timer.h>
+#endif
+#ifndef INCLUDED_haxe_crypto_Base64
+#include <haxe/crypto/Base64.h>
+#endif
+#ifndef INCLUDED_haxe_ds_Either
+#include <haxe/ds/Either.h>
+#endif
+#ifndef INCLUDED_haxe_ds_IntMap
+#include <haxe/ds/IntMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_StringMap
+#include <haxe/ds/StringMap.h>
+#endif
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+#ifndef INCLUDED_haxe_io_Input
+#include <haxe/io/Input.h>
+#endif
+#ifndef INCLUDED_sha_Hash
+#include <sha/Hash.h>
+#endif
+#ifndef INCLUDED_sha_SHA256
+#include <sha/SHA256.h>
+#endif
+#ifndef INCLUDED_snikket_AttachmentSource
+#include <snikket/AttachmentSource.h>
+#endif
+#ifndef INCLUDED_snikket_AvailableChat
+#include <snikket/AvailableChat.h>
+#endif
+#ifndef INCLUDED_snikket_Caps
+#include <snikket/Caps.h>
+#endif
+#ifndef INCLUDED_snikket_Channel
+#include <snikket/Channel.h>
+#endif
+#ifndef INCLUDED_snikket_Chat
+#include <snikket/Chat.h>
+#endif
+#ifndef INCLUDED_snikket_ChatAttachment
+#include <snikket/ChatAttachment.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessage
+#include <snikket/ChatMessage.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessageBuilder
+#include <snikket/ChatMessageBuilder.h>
+#endif
+#ifndef INCLUDED_snikket_Client
+#include <snikket/Client.h>
+#endif
+#ifndef INCLUDED_snikket_Date
+#include <snikket/Date.h>
+#endif
+#ifndef INCLUDED_snikket_DirectChat
+#include <snikket/DirectChat.h>
+#endif
+#ifndef INCLUDED_snikket_EventEmitter
+#include <snikket/EventEmitter.h>
+#endif
+#ifndef INCLUDED_snikket_EventHandler
+#include <snikket/EventHandler.h>
+#endif
+#ifndef INCLUDED_snikket_EventResult
+#include <snikket/EventResult.h>
+#endif
+#ifndef INCLUDED_snikket_GenericStream
+#include <snikket/GenericStream.h>
+#endif
+#ifndef INCLUDED_snikket_Hash
+#include <snikket/Hash.h>
+#endif
+#ifndef INCLUDED_snikket_ID
+#include <snikket/ID.h>
+#endif
+#ifndef INCLUDED_snikket_Identity
+#include <snikket/Identity.h>
+#endif
+#ifndef INCLUDED_snikket_IqRequestType
+#include <snikket/IqRequestType.h>
+#endif
+#ifndef INCLUDED_snikket_IqResult
+#include <snikket/IqResult.h>
+#endif
+#ifndef INCLUDED_snikket_JID
+#include <snikket/JID.h>
+#endif
+#ifndef INCLUDED_snikket_Message
+#include <snikket/Message.h>
+#endif
+#ifndef INCLUDED_snikket_MessageStanza
+#include <snikket/MessageStanza.h>
+#endif
+#ifndef INCLUDED_snikket_MessageSync
+#include <snikket/MessageSync.h>
+#endif
+#ifndef INCLUDED_snikket_ModerationAction
+#include <snikket/ModerationAction.h>
+#endif
+#ifndef INCLUDED_snikket_Participant
+#include <snikket/Participant.h>
+#endif
+#ifndef INCLUDED_snikket_Persistence
+#include <snikket/Persistence.h>
+#endif
+#ifndef INCLUDED_snikket_Presence
+#include <snikket/Presence.h>
+#endif
+#ifndef INCLUDED_snikket_PubsubEvent
+#include <snikket/PubsubEvent.h>
+#endif
+#ifndef INCLUDED_snikket_ReactionUpdate
+#include <snikket/ReactionUpdate.h>
+#endif
+#ifndef INCLUDED_snikket_SerializedChat
+#include <snikket/SerializedChat.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket__Util_Util_Fields_
+#include <snikket/_Util/Util_Fields_.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_IncomingProposedSession
+#include <snikket/jingle/IncomingProposedSession.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_InitiatedSession
+#include <snikket/jingle/InitiatedSession.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_MediaStream
+#include <snikket/jingle/MediaStream.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_MediaStreamTrack
+#include <snikket/jingle/MediaStreamTrack.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_Session
+#include <snikket/jingle/Session.h>
+#endif
+#ifndef INCLUDED_snikket_persistence_Dummy
+#include <snikket/persistence/Dummy.h>
+#endif
+#ifndef INCLUDED_snikket_queries_BlocklistGet
+#include <snikket/queries/BlocklistGet.h>
+#endif
+#ifndef INCLUDED_snikket_queries_BoB
+#include <snikket/queries/BoB.h>
+#endif
+#ifndef INCLUDED_snikket_queries_DiscoInfoGet
+#include <snikket/queries/DiscoInfoGet.h>
+#endif
+#ifndef INCLUDED_snikket_queries_DiscoItemsGet
+#include <snikket/queries/DiscoItemsGet.h>
+#endif
+#ifndef INCLUDED_snikket_queries_ExtDiscoGet
+#include <snikket/queries/ExtDiscoGet.h>
+#endif
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+#ifndef INCLUDED_snikket_queries_HttpUploadSlot
+#include <snikket/queries/HttpUploadSlot.h>
+#endif
+#ifndef INCLUDED_snikket_queries_JabberIqGatewayGet
+#include <snikket/queries/JabberIqGatewayGet.h>
+#endif
+#ifndef INCLUDED_snikket_queries_PubsubGet
+#include <snikket/queries/PubsubGet.h>
+#endif
+#ifndef INCLUDED_snikket_queries_Push2Disable
+#include <snikket/queries/Push2Disable.h>
+#endif
+#ifndef INCLUDED_snikket_queries_RosterGet
+#include <snikket/queries/RosterGet.h>
+#endif
+#ifndef INCLUDED_snikket_queries_VcardTempGet
+#include <snikket/queries/VcardTempGet.h>
+#endif
+#ifndef INCLUDED_snikket_streams_XmppStropheStream
+#include <snikket/streams/XmppStropheStream.h>
+#endif
+#ifndef INCLUDED_sys_io_File
+#include <sys/io/File.h>
+#endif
+#ifndef INCLUDED_sys_io_FileInput
+#include <sys/io/FileInput.h>
+#endif
+#ifndef INCLUDED_sys_net_Socket
+#include <sys/net/Socket.h>
+#endif
+#ifndef INCLUDED_sys_ssl_Socket
+#include <sys/ssl/Socket.h>
+#endif
+#ifndef INCLUDED_thenshim_PromiseTools
+#include <thenshim/PromiseTools.h>
+#endif
+#ifndef INCLUDED_thenshim_Thenable
+#include <thenshim/Thenable.h>
+#endif
+#ifndef INCLUDED_thenshim__Promise_Promise_Impl_
+#include <thenshim/_Promise/Promise_Impl_.h>
+#endif
+#ifndef INCLUDED_tink__Url_Url_Impl_
+#include <tink/_Url/Url_Impl_.h>
+#endif
+#ifndef INCLUDED_tink_chunk_ChunkObject
+#include <tink/chunk/ChunkObject.h>
+#endif
+#ifndef INCLUDED_tink_core_LinkObject
+#include <tink/core/LinkObject.h>
+#endif
+#ifndef INCLUDED_tink_core_NamedWith
+#include <tink/core/NamedWith.h>
+#endif
+#ifndef INCLUDED_tink_core_Outcome
+#include <tink/core/Outcome.h>
+#endif
+#ifndef INCLUDED_tink_core_TypedError
+#include <tink/core/TypedError.h>
+#endif
+#ifndef INCLUDED_tink_core__Future_FutureObject
+#include <tink/core/_Future/FutureObject.h>
+#endif
+#ifndef INCLUDED_tink_http_Fetch
+#include <tink/http/Fetch.h>
+#endif
+#ifndef INCLUDED_tink_http_Header
+#include <tink/http/Header.h>
+#endif
+#ifndef INCLUDED_tink_http_HeaderField
+#include <tink/http/HeaderField.h>
+#endif
+#ifndef INCLUDED_tink_http_Message
+#include <tink/http/Message.h>
+#endif
+#ifndef INCLUDED_tink_http_ResponseHeaderBase
+#include <tink/http/ResponseHeaderBase.h>
+#endif
+#ifndef INCLUDED_tink_http__Fetch_FetchResponse_Impl_
+#include <tink/http/_Fetch/FetchResponse_Impl_.h>
+#endif
+#ifndef INCLUDED_tink_http__Header_HeaderValue_Impl_
+#include <tink/http/_Header/HeaderValue_Impl_.h>
+#endif
+#ifndef INCLUDED_tink_io_RealSourceTools
+#include <tink/io/RealSourceTools.h>
+#endif
+#ifndef INCLUDED_tink_io_WorkerObject
+#include <tink/io/WorkerObject.h>
+#endif
+#ifndef INCLUDED_tink_io__Source_Source_Impl_
+#include <tink/io/_Source/Source_Impl_.h>
+#endif
+#ifndef INCLUDED_tink_io__Worker_Worker_Impl_
+#include <tink/io/_Worker/Worker_Impl_.h>
+#endif
+#ifndef INCLUDED_tink_io_std_InputSource
+#include <tink/io/std/InputSource.h>
+#endif
+#ifndef INCLUDED_tink_streams_Conclusion
+#include <tink/streams/Conclusion.h>
+#endif
+#ifndef INCLUDED_tink_streams_Generator
+#include <tink/streams/Generator.h>
+#endif
+#ifndef INCLUDED_tink_streams_Handled
+#include <tink/streams/Handled.h>
+#endif
+#ifndef INCLUDED_tink_streams_StreamBase
+#include <tink/streams/StreamBase.h>
+#endif
+#ifndef INCLUDED_tink_streams_StreamObject
+#include <tink/streams/StreamObject.h>
+#endif
+#ifndef INCLUDED_tink_streams__Stream_Handler_Impl_
+#include <tink/streams/_Stream/Handler_Impl_.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_105_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",105,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_109_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",109,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_116_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",116,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_115_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",115,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_126_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",126,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_121_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",121,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_136_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",136,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_131_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",131,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_166_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",166,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_141_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",141,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_179_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",179,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_190_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",190,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_199_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",199,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_197_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",197,0x180249e1)
+static const ::String _hx_array_data_7c06fe3c_24[] = {
+ HX_("image/png",b5,cc,c1,16),
+};
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_297_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",297,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_310_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",310,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_301_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",301,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_330_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",330,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_332_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",332,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_344_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",344,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_396_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",396,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_399_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",399,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_426_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",426,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_441_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",441,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_464_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",464,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_480_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",480,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_487_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",487,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_501_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",501,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_492_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",492,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_519_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",519,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_527_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",527,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_523_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",523,0x180249e1)
+HX_DEFINE_STACK_FRAME(_hx_pos_ead56881d4bbcaca_51_new,"snikket.Client","new",0x69246d2e,"snikket.Client.new","snikket/Client.hx",51,0x180249e1)
+static const ::String _hx_array_data_7c06fe3c_45[] = {
+ HX_("http://jabber.org/protocol/disco#info",cb,2b,7f,0b),HX_("http://jabber.org/protocol/caps",95,d0,90,e2),HX_("urn:xmpp:avatar:metadata+notify",e0,89,c6,db),HX_("http://jabber.org/protocol/nick+notify",fd,dd,65,10),HX_("urn:xmpp:bookmarks:1+notify",dc,4b,f7,cc),HX_("urn:xmpp:mds:displayed:0+notify",17,ae,91,a8),HX_("urn:xmpp:jingle-message:0",fd,20,a5,07),HX_("urn:xmpp:jingle:1",44,c4,fe,f7),HX_("urn:xmpp:jingle:apps:dtls:0",a8,cb,02,66),HX_("urn:xmpp:jingle:apps:rtp:1",ea,41,fe,5c),HX_("urn:xmpp:jingle:apps:rtp:audio",0f,8b,54,6c),HX_("urn:xmpp:jingle:apps:rtp:video",b4,26,d0,7b),HX_("urn:xmpp:jingle:transports:ice-udp:1",f3,67,4f,53),
+};
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_282_set_sendAvailable__fromC,"snikket.Client","set_sendAvailable__fromC",0xde92a6a7,"snikket.Client.set_sendAvailable__fromC","HaxeCBridge.hx",282,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_586_start,"snikket.Client","start",0x37d760b0,"snikket.Client.start","snikket/Client.hx",586,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_587_start,"snikket.Client","start",0x37d760b0,"snikket.Client.start","snikket/Client.hx",587,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_594_start,"snikket.Client","start",0x37d760b0,"snikket.Client.start","snikket/Client.hx",594,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_574_start,"snikket.Client","start",0x37d760b0,"snikket.Client.start","snikket/Client.hx",574,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_569_start,"snikket.Client","start",0x37d760b0,"snikket.Client.start","snikket/Client.hx",569,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_561_start,"snikket.Client","start",0x37d760b0,"snikket.Client.start","snikket/Client.hx",561,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_558_start,"snikket.Client","start",0x37d760b0,"snikket.Client.start","snikket/Client.hx",558,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_557_start,"snikket.Client","start",0x37d760b0,"snikket.Client.start","snikket/Client.hx",557,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_620_logout,"snikket.Client","logout",0xfb11ce7c,"snikket.Client.logout","snikket/Client.hx",620,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_616_logout,"snikket.Client","logout",0xfb11ce7c,"snikket.Client.logout","snikket/Client.hx",616,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_632_usePassword,"snikket.Client","usePassword",0x35ea4550,"snikket.Client.usePassword","snikket/Client.hx",632,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_641_accountId,"snikket.Client","accountId",0x98c7ad36,"snikket.Client.accountId","snikket/Client.hx",641,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_650_displayName,"snikket.Client","displayName",0xc4012c7b,"snikket.Client.displayName","snikket/Client.hx",650,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_668_setDisplayName,"snikket.Client","setDisplayName",0x10b7671d,"snikket.Client.setDisplayName","snikket/Client.hx",668,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_658_setDisplayName,"snikket.Client","setDisplayName",0x10b7671d,"snikket.Client.setDisplayName","snikket/Client.hx",658,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_672_updateDisplayName,"snikket.Client","updateDisplayName",0x01ffe772,"snikket.Client.updateDisplayName","snikket/Client.hx",672,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_694_onConnected,"snikket.Client","onConnected",0x5848e078,"snikket.Client.onConnected","snikket/Client.hx",694,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_711_onConnected,"snikket.Client","onConnected",0x5848e078,"snikket.Client.onConnected","snikket/Client.hx",711,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_700_onConnected,"snikket.Client","onConnected",0x5848e078,"snikket.Client.onConnected","snikket/Client.hx",700,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_698_onConnected,"snikket.Client","onConnected",0x5848e078,"snikket.Client.onConnected","snikket/Client.hx",698,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_680_onConnected,"snikket.Client","onConnected",0x5848e078,"snikket.Client.onConnected","snikket/Client.hx",680,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_749_prepareAttachment,"snikket.Client","prepareAttachment",0xbeef9598,"snikket.Client.prepareAttachment","snikket/Client.hx",749,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_751_prepareAttachment,"snikket.Client","prepareAttachment",0xbeef9598,"snikket.Client.prepareAttachment","snikket/Client.hx",751,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_754_prepareAttachment,"snikket.Client","prepareAttachment",0xbeef9598,"snikket.Client.prepareAttachment","snikket/Client.hx",754,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_748_prepareAttachment,"snikket.Client","prepareAttachment",0xbeef9598,"snikket.Client.prepareAttachment","snikket/Client.hx",748,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_221_prepareAttachment__fromC,"snikket.Client","prepareAttachment__fromC",0x503d3de1,"snikket.Client.prepareAttachment__fromC","HaxeCBridge.hx",221,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_244_prepareAttachment__fromC,"snikket.Client","prepareAttachment__fromC",0x503d3de1,"snikket.Client.prepareAttachment__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_771_prepareAttachmentFor,"snikket.Client","prepareAttachmentFor",0xe1e97851,"snikket.Client.prepareAttachmentFor","snikket/Client.hx",771,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_776_prepareAttachmentFor,"snikket.Client","prepareAttachmentFor",0xe1e97851,"snikket.Client.prepareAttachmentFor","snikket/Client.hx",776,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_777_prepareAttachmentFor,"snikket.Client","prepareAttachmentFor",0xe1e97851,"snikket.Client.prepareAttachmentFor","snikket/Client.hx",777,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_764_prepareAttachmentFor,"snikket.Client","prepareAttachmentFor",0xe1e97851,"snikket.Client.prepareAttachmentFor","snikket/Client.hx",764,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_796_getChats,"snikket.Client","getChats",0x5488e697,"snikket.Client.getChats","snikket/Client.hx",796,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_242_getChats__fromC,"snikket.Client","getChats__fromC",0x4cad9ac2,"snikket.Client.getChats__fromC","HaxeCBridge.hx",242,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_809_findAvailableChats,"snikket.Client","findAvailableChats",0x877a8d1d,"snikket.Client.findAvailableChats","snikket/Client.hx",809,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_811_findAvailableChats,"snikket.Client","findAvailableChats",0x877a8d1d,"snikket.Client.findAvailableChats","snikket/Client.hx",811,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_808_findAvailableChats,"snikket.Client","findAvailableChats",0x877a8d1d,"snikket.Client.findAvailableChats","snikket/Client.hx",808,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_805_findAvailableChats,"snikket.Client","findAvailableChats",0x877a8d1d,"snikket.Client.findAvailableChats","snikket/Client.hx",805,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_860_findAvailableChats,"snikket.Client","findAvailableChats",0x877a8d1d,"snikket.Client.findAvailableChats","snikket/Client.hx",860,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_221_findAvailableChats__fromC,"snikket.Client","findAvailableChats__fromC",0x704470fc,"snikket.Client.findAvailableChats__fromC","HaxeCBridge.hx",221,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_244_findAvailableChats__fromC,"snikket.Client","findAvailableChats__fromC",0x704470fc,"snikket.Client.findAvailableChats__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_889_startChat,"snikket.Client","startChat",0x6a2603a8,"snikket.Client.startChat","snikket/Client.hx",889,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_923_getChat,"snikket.Client","getChat",0x441c2a5c,"snikket.Client.getChat","snikket/Client.hx",923,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_929_moderateMessage,"snikket.Client","moderateMessage",0xa3213212,"snikket.Client.moderateMessage","snikket/Client.hx",929,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_927_moderateMessage,"snikket.Client","moderateMessage",0xa3213212,"snikket.Client.moderateMessage","snikket/Client.hx",927,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_944_getDirectChat,"snikket.Client","getDirectChat",0x348a6525,"snikket.Client.getDirectChat","snikket/Client.hx",944,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1020_addPasswordNeededListener,"snikket.Client","addPasswordNeededListener",0x82818693,"snikket.Client.addPasswordNeededListener","snikket/Client.hx",1020,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1019_addPasswordNeededListener,"snikket.Client","addPasswordNeededListener",0x82818693,"snikket.Client.addPasswordNeededListener","snikket/Client.hx",1019,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_221_addPasswordNeededListener__fromC,"snikket.Client","addPasswordNeededListener__fromC",0xf03f3246,"snikket.Client.addPasswordNeededListener__fromC","HaxeCBridge.hx",221,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_244_addPasswordNeededListener__fromC,"snikket.Client","addPasswordNeededListener__fromC",0xf03f3246,"snikket.Client.addPasswordNeededListener__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1032_addStatusOnlineListener,"snikket.Client","addStatusOnlineListener",0x143d9788,"snikket.Client.addStatusOnlineListener","snikket/Client.hx",1032,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_221_addStatusOnlineListener__fromC,"snikket.Client","addStatusOnlineListener__fromC",0x326c59f1,"snikket.Client.addStatusOnlineListener__fromC","HaxeCBridge.hx",221,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_244_addStatusOnlineListener__fromC,"snikket.Client","addStatusOnlineListener__fromC",0x326c59f1,"snikket.Client.addStatusOnlineListener__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1044_addStatusOfflineListener,"snikket.Client","addStatusOfflineListener",0xa2febff6,"snikket.Client.addStatusOfflineListener","snikket/Client.hx",1044,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_221_addStatusOfflineListener__fromC,"snikket.Client","addStatusOfflineListener__fromC",0xe34d3b43,"snikket.Client.addStatusOfflineListener__fromC","HaxeCBridge.hx",221,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_244_addStatusOfflineListener__fromC,"snikket.Client","addStatusOfflineListener__fromC",0xe34d3b43,"snikket.Client.addStatusOfflineListener__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1056_addConnectionFailedListener,"snikket.Client","addConnectionFailedListener",0x4e1f941e,"snikket.Client.addConnectionFailedListener","snikket/Client.hx",1056,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_221_addConnectionFailedListener__fromC,"snikket.Client","addConnectionFailedListener__fromC",0x9290bc1b,"snikket.Client.addConnectionFailedListener__fromC","HaxeCBridge.hx",221,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_244_addConnectionFailedListener__fromC,"snikket.Client","addConnectionFailedListener__fromC",0x9290bc1b,"snikket.Client.addConnectionFailedListener__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1081_addChatMessageListener,"snikket.Client","addChatMessageListener",0xff8d07b4,"snikket.Client.addChatMessageListener","snikket/Client.hx",1081,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_221_addChatMessageListener__fromC,"snikket.Client","addChatMessageListener__fromC",0xc5968745,"snikket.Client.addChatMessageListener__fromC","HaxeCBridge.hx",221,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_244_addChatMessageListener__fromC,"snikket.Client","addChatMessageListener__fromC",0xc5968745,"snikket.Client.addChatMessageListener__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1095_addSyncMessageListener,"snikket.Client","addSyncMessageListener",0xf5301791,"snikket.Client.addSyncMessageListener","snikket/Client.hx",1095,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_221_addSyncMessageListener__fromC,"snikket.Client","addSyncMessageListener__fromC",0x6f8fdd08,"snikket.Client.addSyncMessageListener__fromC","HaxeCBridge.hx",221,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_244_addSyncMessageListener__fromC,"snikket.Client","addSyncMessageListener__fromC",0x6f8fdd08,"snikket.Client.addSyncMessageListener__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1104_addChatsUpdatedListener,"snikket.Client","addChatsUpdatedListener",0xed116e03,"snikket.Client.addChatsUpdatedListener","snikket/Client.hx",1104,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_221_addChatsUpdatedListener__fromC,"snikket.Client","addChatsUpdatedListener__fromC",0x109c18d6,"snikket.Client.addChatsUpdatedListener__fromC","HaxeCBridge.hx",221,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_244_addChatsUpdatedListener__fromC,"snikket.Client","addChatsUpdatedListener__fromC",0x109c18d6,"snikket.Client.addChatsUpdatedListener__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1116_addCallRingListener,"snikket.Client","addCallRingListener",0xdc0d9f11,"snikket.Client.addCallRingListener","snikket/Client.hx",1116,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_221_addCallRingListener__fromC,"snikket.Client","addCallRingListener__fromC",0x01ba4588,"snikket.Client.addCallRingListener__fromC","HaxeCBridge.hx",221,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_244_addCallRingListener__fromC,"snikket.Client","addCallRingListener__fromC",0x01ba4588,"snikket.Client.addCallRingListener__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1128_addCallRetractListener,"snikket.Client","addCallRetractListener",0x2db0b2e8,"snikket.Client.addCallRetractListener","snikket/Client.hx",1128,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_221_addCallRetractListener__fromC,"snikket.Client","addCallRetractListener__fromC",0x424d6a91,"snikket.Client.addCallRetractListener__fromC","HaxeCBridge.hx",221,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_244_addCallRetractListener__fromC,"snikket.Client","addCallRetractListener__fromC",0x424d6a91,"snikket.Client.addCallRetractListener__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1140_addCallRingingListener,"snikket.Client","addCallRingingListener",0x568d8519,"snikket.Client.addCallRingingListener","snikket/Client.hx",1140,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_221_addCallRingingListener__fromC,"snikket.Client","addCallRingingListener__fromC",0x8136b080,"snikket.Client.addCallRingingListener__fromC","HaxeCBridge.hx",221,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_244_addCallRingingListener__fromC,"snikket.Client","addCallRingingListener__fromC",0x8136b080,"snikket.Client.addCallRingingListener__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1154_addCallMediaListener,"snikket.Client","addCallMediaListener",0x2dfd660b,"snikket.Client.addCallMediaListener","snikket/Client.hx",1154,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_221_addCallMediaListener__fromC,"snikket.Client","addCallMediaListener__fromC",0x3b32b1ce,"snikket.Client.addCallMediaListener__fromC","HaxeCBridge.hx",221,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_244_addCallMediaListener__fromC,"snikket.Client","addCallMediaListener__fromC",0x3b32b1ce,"snikket.Client.addCallMediaListener__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1167_addCallTrackListener,"snikket.Client","addCallTrackListener",0xa60d6eb2,"snikket.Client.addCallTrackListener","snikket/Client.hx",1167,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_221_addCallTrackListener__fromC,"snikket.Client","addCallTrackListener__fromC",0xc89c1c07,"snikket.Client.addCallTrackListener__fromC","HaxeCBridge.hx",221,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_e44af0c967c6b6e2_244_addCallTrackListener__fromC,"snikket.Client","addCallTrackListener__fromC",0xc89c1c07,"snikket.Client.addCallTrackListener__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1176_setInForeground,"snikket.Client","setInForeground",0x4b9b9598,"snikket.Client.setInForeground","snikket/Client.hx",1176,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1184_setNotInForeground,"snikket.Client","setNotInForeground",0x61bbec2b,"snikket.Client.setNotInForeground","snikket/Client.hx",1184,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1194_fetchMediaByHash,"snikket.Client","fetchMediaByHash",0x227ef9a1,"snikket.Client.fetchMediaByHash","snikket/Client.hx",1194,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1190_fetchMediaByHash,"snikket.Client","fetchMediaByHash",0x227ef9a1,"snikket.Client.fetchMediaByHash","snikket/Client.hx",1190,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1201_fetchMediaByHashOneCounterpart,"snikket.Client","fetchMediaByHashOneCounterpart",0xeea071aa,"snikket.Client.fetchMediaByHashOneCounterpart","snikket/Client.hx",1201,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1207_fetchMediaByHashOneCounterpart,"snikket.Client","fetchMediaByHashOneCounterpart",0xeea071aa,"snikket.Client.fetchMediaByHashOneCounterpart","snikket/Client.hx",1207,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1212_fetchMediaByHashOneCounterpart,"snikket.Client","fetchMediaByHashOneCounterpart",0xeea071aa,"snikket.Client.fetchMediaByHashOneCounterpart","snikket/Client.hx",1212,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1205_fetchMediaByHashOneCounterpart,"snikket.Client","fetchMediaByHashOneCounterpart",0xeea071aa,"snikket.Client.fetchMediaByHashOneCounterpart","snikket/Client.hx",1205,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1216_fetchMediaByHashOneCounterpart,"snikket.Client","fetchMediaByHashOneCounterpart",0xeea071aa,"snikket.Client.fetchMediaByHashOneCounterpart","snikket/Client.hx",1216,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1202_fetchMediaByHashOneCounterpart,"snikket.Client","fetchMediaByHashOneCounterpart",0xeea071aa,"snikket.Client.fetchMediaByHashOneCounterpart","snikket/Client.hx",1202,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1197_fetchMediaByHashOneCounterpart,"snikket.Client","fetchMediaByHashOneCounterpart",0xeea071aa,"snikket.Client.fetchMediaByHashOneCounterpart","snikket/Client.hx",1197,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1221_chatActivity,"snikket.Client","chatActivity",0x128a3a39,"snikket.Client.chatActivity","snikket/Client.hx",1221,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1227_chatActivity,"snikket.Client","chatActivity",0x128a3a39,"snikket.Client.chatActivity","snikket/Client.hx",1227,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1238_sortChats,"snikket.Client","sortChats",0xbd9a9dab,"snikket.Client.sortChats","snikket/Client.hx",1238,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1247_storeMessages,"snikket.Client","storeMessages",0xb2e3dc1b,"snikket.Client.storeMessages","snikket/Client.hx",1247,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1252_sendQuery,"snikket.Client","sendQuery",0x8dcd73ee,"snikket.Client.sendQuery","snikket/Client.hx",1252,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1256_sendStanza,"snikket.Client","sendStanza",0xbca03e4f,"snikket.Client.sendStanza","snikket/Client.hx",1256,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1263_sendPresence,"snikket.Client","sendPresence",0xc1bc7d15,"snikket.Client.sendPresence","snikket/Client.hx",1263,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1264_sendPresence,"snikket.Client","sendPresence",0xc1bc7d15,"snikket.Client.sendPresence","snikket/Client.hx",1264,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1274_getIceServers,"snikket.Client","getIceServers",0xf7e15ac9,"snikket.Client.getIceServers","snikket/Client.hx",1274,0x180249e1)
+static const ::String _hx_array_data_7c06fe3c_182[] = {
+ HX_("stun",3a,f5,5b,4c),HX_("stuns",f9,9d,1a,84),HX_("turn",7d,eb,05,4d),HX_("turns",56,22,28,18),
+};
+static const ::String _hx_array_data_7c06fe3c_183[] = {
+ HX_("turn",7d,eb,05,4d),HX_("turns",56,22,28,18),
+};
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1272_getIceServers,"snikket.Client","getIceServers",0xf7e15ac9,"snikket.Client.getIceServers","snikket/Client.hx",1272,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1303_discoverServices,"snikket.Client","discoverServices",0x672de159,"snikket.Client.discoverServices","snikket/Client.hx",1303,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1306_discoverServices,"snikket.Client","discoverServices",0x672de159,"snikket.Client.discoverServices","snikket/Client.hx",1306,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1300_discoverServices,"snikket.Client","discoverServices",0x672de159,"snikket.Client.discoverServices","snikket/Client.hx",1300,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1315_notifyMessageHandlers,"snikket.Client","notifyMessageHandlers",0x61a351d5,"snikket.Client.notifyMessageHandlers","snikket/Client.hx",1315,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1324_notifySyncMessageHandlers,"snikket.Client","notifySyncMessageHandlers",0xb236243a,"snikket.Client.notifySyncMessageHandlers","snikket/Client.hx",1324,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1335_rosterGet,"snikket.Client","rosterGet",0xae66bf19,"snikket.Client.rosterGet","snikket/Client.hx",1335,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1333_rosterGet,"snikket.Client","rosterGet",0xae66bf19,"snikket.Client.rosterGet","snikket/Client.hx",1333,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1350_startChatWith,"snikket.Client","startChatWith",0x9e0699ce,"snikket.Client.startChatWith","snikket/Client.hx",1350,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1348_startChatWith,"snikket.Client","startChatWith",0x9e0699ce,"snikket.Client.startChatWith","snikket/Client.hx",1348,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1377_serverBlocked,"snikket.Client","serverBlocked",0xd88870b7,"snikket.Client.serverBlocked","snikket/Client.hx",1377,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1386_bookmarksGet,"snikket.Client","bookmarksGet",0x49f73b0b,"snikket.Client.bookmarksGet","snikket/Client.hx",1386,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1393_bookmarksGet,"snikket.Client","bookmarksGet",0x49f73b0b,"snikket.Client.bookmarksGet","snikket/Client.hx",1393,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1400_bookmarksGet,"snikket.Client","bookmarksGet",0x49f73b0b,"snikket.Client.bookmarksGet","snikket/Client.hx",1400,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1412_bookmarksGet,"snikket.Client","bookmarksGet",0x49f73b0b,"snikket.Client.bookmarksGet","snikket/Client.hx",1412,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1420_bookmarksGet,"snikket.Client","bookmarksGet",0x49f73b0b,"snikket.Client.bookmarksGet","snikket/Client.hx",1420,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1429_bookmarksGet,"snikket.Client","bookmarksGet",0x49f73b0b,"snikket.Client.bookmarksGet","snikket/Client.hx",1429,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1383_bookmarksGet,"snikket.Client","bookmarksGet",0x49f73b0b,"snikket.Client.bookmarksGet","snikket/Client.hx",1383,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1444_sync,"snikket.Client","sync",0x9a1851cd,"snikket.Client.sync","snikket/Client.hx",1444,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1448_sync,"snikket.Client","sync",0x9a1851cd,"snikket.Client.sync","snikket/Client.hx",1448,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1452_onMAMJMI,"snikket.Client","onMAMJMI",0xc3bb101e,"snikket.Client.onMAMJMI","snikket/Client.hx",1452,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1475_doSync,"snikket.Client","doSync",0xbb063778,"snikket.Client.doSync","snikket/Client.hx",1475,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1501_doSync,"snikket.Client","doSync",0xbb063778,"snikket.Client.doSync","snikket/Client.hx",1501,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1504_doSync,"snikket.Client","doSync",0xbb063778,"snikket.Client.doSync","snikket/Client.hx",1504,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1529_doSync,"snikket.Client","doSync",0xbb063778,"snikket.Client.doSync","snikket/Client.hx",1529,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1480_doSync,"snikket.Client","doSync",0xbb063778,"snikket.Client.doSync","snikket/Client.hx",1480,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1494_doSync,"snikket.Client","doSync",0xbb063778,"snikket.Client.doSync","snikket/Client.hx",1494,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1490_doSync,"snikket.Client","doSync",0xbb063778,"snikket.Client.doSync","snikket/Client.hx",1490,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1535_doSync,"snikket.Client","doSync",0xbb063778,"snikket.Client.doSync","snikket/Client.hx",1535,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1465_doSync,"snikket.Client","doSync",0xbb063778,"snikket.Client.doSync","snikket/Client.hx",1465,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1547_pingAllChannels,"snikket.Client","pingAllChannels",0x5c74390d,"snikket.Client.pingAllChannels","snikket/Client.hx",1547,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1554_joinAllChannels,"snikket.Client","joinAllChannels",0xde17fa95,"snikket.Client.joinAllChannels","snikket/Client.hx",1554,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1559_joinAllChannels,"snikket.Client","joinAllChannels",0xde17fa95,"snikket.Client.joinAllChannels","snikket/Client.hx",1559,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_1563_joinAllChannels,"snikket.Client","joinAllChannels",0xde17fa95,"snikket.Client.joinAllChannels","snikket/Client.hx",1563,0x180249e1)
+HX_LOCAL_STACK_FRAME(_hx_pos_ead56881d4bbcaca_51_boot,"snikket.Client","boot",0x8ed41ba4,"snikket.Client.boot","snikket/Client.hx",51,0x180249e1)
+namespace snikket{
+
+void Client_obj::__construct(::String address,::Dynamic persistence){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::Client,_gthis) HXARGC(1)
+ ::snikket::EventResult _hx_run( ::Dynamic data){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_105_new)
+HXLINE( 105) return _gthis->trigger(HX_("status/offline",c6,eb,eb,54), ::Dynamic(::hx::Anon_obj::Create(0)));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_1, ::snikket::Client,_gthis,::Dynamic,persistence) HXARGC(1)
+ ::snikket::EventResult _hx_run( ::Dynamic data){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_109_new)
+HXLINE( 110) _gthis->token = ( (::String)(data->__Field(HX_("token",f9,82,2b,14),::hx::paccDynamic)) );
+HXLINE( 111) ::Dynamic persistence1 = persistence;
+HXDLIN( 111) ::String _hx_tmp = _gthis->jid->asBare()->asString();
+HXDLIN( 111) ::String _hx_tmp1;
+HXDLIN( 111) ::String tmp = _gthis->stream->clientId;
+HXDLIN( 111) if (::hx::IsNotNull( tmp )) {
+HXLINE( 111) _hx_tmp1 = tmp;
+ }
+ else {
+HXLINE( 111) _hx_tmp1 = _gthis->jid->resource;
+ }
+HXDLIN( 111) ::String _hx_tmp2 = _gthis->displayName();
+HXDLIN( 111) ::snikket::Persistence_obj::storeLogin(persistence1,_hx_tmp,_hx_tmp1,_hx_tmp2,_gthis->token);
+HXLINE( 112) return ::snikket::EventResult_obj::EventHandled_dyn();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_3, ::snikket::Client,_gthis,::Dynamic,persistence) HXARGC(1)
+ ::snikket::EventResult _hx_run( ::Dynamic data){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_2) HXARGC(1)
+ bool _hx_run( ::snikket::Chat chat){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_116_new)
+HXLINE( 116) if ((chat->uiState != 2)) {
+HXLINE( 116) return chat->syncing();
+ }
+ else {
+HXLINE( 116) return false;
+ }
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_115_new)
+HXLINE( 116) bool anySyncHappening = ::Lambda_obj::exists(_gthis->chats, ::Dynamic(new _hx_Closure_2()));
+HXLINE( 117) ::Dynamic persistence1 = persistence;
+HXDLIN( 117) ::String _hx_tmp = _gthis->accountId();
+HXDLIN( 117) ::Array< unsigned char > _hx_tmp1;
+HXDLIN( 117) if (anySyncHappening) {
+HXLINE( 117) _hx_tmp1 = null();
+ }
+ else {
+HXLINE( 117) _hx_tmp1 = ( (::Array< unsigned char >)(data->__Field(HX_("sm",9a,64,00,00),::hx::paccDynamic)) );
+ }
+HXDLIN( 117) ::snikket::Persistence_obj::storeStreamManagement(persistence1,_hx_tmp,_hx_tmp1);
+HXLINE( 118) return ::snikket::EventResult_obj::EventHandled_dyn();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_5, ::snikket::Client,_gthis,::Dynamic,persistence) HXARGC(1)
+ ::snikket::EventResult _hx_run( ::Dynamic data){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_4, ::snikket::Client,_gthis) HXARGC(1)
+ void _hx_run( ::snikket::ChatMessage m){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_126_new)
+HXLINE( 126) _gthis->notifyMessageHandlers(m,3);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_121_new)
+HXLINE( 122) ::Dynamic persistence1 = persistence;
+HXLINE( 123) ::String _hx_tmp = _gthis->accountId();
+HXLINE( 122) ::snikket::Persistence_obj::updateMessageStatus(persistence1,_hx_tmp, ::Dynamic(data->__Field(HX_("id",db,5b,00,00),::hx::paccDynamic)),1, ::Dynamic(new _hx_Closure_4(_gthis)));
+HXLINE( 128) return ::snikket::EventResult_obj::EventHandled_dyn();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_7, ::snikket::Client,_gthis,::Dynamic,persistence) HXARGC(1)
+ ::snikket::EventResult _hx_run( ::Dynamic data){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_6, ::snikket::Client,_gthis) HXARGC(1)
+ void _hx_run( ::snikket::ChatMessage m){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_136_new)
+HXLINE( 136) _gthis->notifyMessageHandlers(m,3);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_131_new)
+HXLINE( 132) ::Dynamic persistence1 = persistence;
+HXLINE( 133) ::String _hx_tmp = _gthis->accountId();
+HXLINE( 132) ::snikket::Persistence_obj::updateMessageStatus(persistence1,_hx_tmp, ::Dynamic(data->__Field(HX_("id",db,5b,00,00),::hx::paccDynamic)),3, ::Dynamic(new _hx_Closure_6(_gthis)));
+HXLINE( 138) return ::snikket::EventResult_obj::EventHandled_dyn();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_19, ::snikket::Client,_gthis,::Dynamic,persistence) HXARGC(1)
+ ::snikket::EventResult _hx_run( ::Dynamic event){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_8, ::snikket::Client,_gthis) HXARGC(2)
+ ::snikket::ChatMessageBuilder _hx_run( ::snikket::ChatMessageBuilder builder, ::snikket::Stanza stanza){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_166_new)
+HXLINE( 167) ::snikket::Client _gthis1 = _gthis;
+HXDLIN( 167) ::snikket::Chat chat = _gthis1->getChat(builder->chatId());
+HXLINE( 168) bool message;
+HXDLIN( 168) if (::hx::IsNull( chat )) {
+HXLINE( 168) message = (( (::String)(::Reflect_obj::field(stanza->attr,HX_("type",ba,f2,08,4d))) ) != HX_("groupchat",97,1d,c8,e5));
+ }
+ else {
+HXLINE( 168) message = false;
+ }
+HXDLIN( 168) if (message) {
+HXLINE( 168) ::snikket::Client _gthis2 = _gthis;
+HXDLIN( 168) chat = _gthis2->getDirectChat(builder->chatId(),null());
+ }
+HXLINE( 169) if (::hx::IsNull( chat )) {
+HXLINE( 169) return builder;
+ }
+HXLINE( 170) return chat->prepareIncomingMessage(builder,stanza);
+ }
+ HX_END_LOCAL_FUNC2(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_141_new)
+HXLINE( 142) ::snikket::Stanza stanza = ( ( ::snikket::Stanza)(event->__Field(HX_("stanza",f5,5d,f7,05),::hx::paccDynamic)) );
+HXLINE( 144) if (::hx::IsNotNull( stanza->getChild(HX_("result",dd,68,84,08),HX_("urn:xmpp:mam:2",f5,ef,8c,da)) )) {
+HXLINE( 146) return ::snikket::EventResult_obj::EventUnhandled_dyn();
+ }
+HXLINE( 149) ::snikket::JID from;
+HXDLIN( 149) if (::hx::IsNull( ( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) ) )) {
+HXLINE( 149) from = null();
+ }
+ else {
+HXLINE( 149) from = ::snikket::JID_obj::parse(( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) ));
+ }
+HXLINE( 151) bool _hx_tmp;
+HXDLIN( 151) if ((( (::String)(::Reflect_obj::field(stanza->attr,HX_("type",ba,f2,08,4d))) ) == HX_("error",c8,cb,29,73))) {
+HXLINE( 151) _hx_tmp = ::hx::IsNotNull( from );
+ }
+ else {
+HXLINE( 151) _hx_tmp = false;
+ }
+HXDLIN( 151) if (_hx_tmp) {
+HXLINE( 152) ::snikket::Client _gthis1 = _gthis;
+HXDLIN( 152) ::snikket::Chat chat = _gthis1->getChat(from->asBare()->asString());
+HXLINE( 153) ::snikket::Channel channel = ( ( ::snikket::Channel)(::Std_obj::downcast(chat,::hx::ClassOf< ::snikket::Channel >())) );
+HXLINE( 154) if (::hx::IsNotNull( channel )) {
+HXLINE( 154) channel->selfPing(true);
+ }
+ }
+HXLINE( 157) ::snikket::Stanza fwd = null();
+HXLINE( 158) bool _hx_tmp1;
+HXDLIN( 158) if (::hx::IsNotNull( from )) {
+HXLINE( 158) ::String _hx_tmp2 = from->asBare()->asString();
+HXDLIN( 158) _hx_tmp1 = (_hx_tmp2 == _gthis->accountId());
+ }
+ else {
+HXLINE( 158) _hx_tmp1 = false;
+ }
+HXDLIN( 158) if (_hx_tmp1) {
+HXLINE( 159) ::snikket::Stanza carbon = stanza->getChild(HX_("received",21,45,fd,e2),HX_("urn:xmpp:carbons:2",02,86,9e,df));
+HXLINE( 160) if (::hx::IsNull( carbon )) {
+HXLINE( 160) carbon = stanza->getChild(HX_("sent",58,8d,50,4c),HX_("urn:xmpp:carbons:2",02,86,9e,df));
+ }
+HXLINE( 161) if (::hx::IsNotNull( carbon )) {
+HXLINE( 162) ::snikket::Stanza tmp = carbon->getChild(HX_("forwarded",64,f5,9a,17),HX_("urn:xmpp:forward:0",1f,ec,b0,d1));
+HXDLIN( 162) if (::hx::IsNotNull( tmp )) {
+HXLINE( 162) fwd = tmp->getFirstChild();
+ }
+ else {
+HXLINE( 162) fwd = null();
+ }
+ }
+ }
+HXLINE( 166) ::snikket::Message message = ::snikket::Message_obj::fromStanza(stanza,_gthis->jid, ::Dynamic(new _hx_Closure_8(_gthis)));
+HXLINE( 172) {
+HXLINE( 172) ::snikket::MessageStanza _g = message->parsed;
+HXDLIN( 172) switch((int)(_g->_hx_getIndex())){
+ case (int)1: {
+HXLINE( 173) ::snikket::ChatMessage chatMessage = _g->_hx_getObject(0).StaticCast< ::snikket::ChatMessage >();
+HXDLIN( 173) {
+HXLINE( 174) {
+HXLINE( 174) int _g1 = 0;
+HXDLIN( 174) ::Array< ::Dynamic> _g2 = chatMessage->inlineHashReferences();
+HXDLIN( 174) while((_g1 < _g2->length)){
+HXLINE( 174) ::snikket::Hash hash = _g2->__get(_g1).StaticCast< ::snikket::Hash >();
+HXDLIN( 174) _g1 = (_g1 + 1);
+HXLINE( 175) _gthis->fetchMediaByHash(::Array_obj< ::Dynamic>::__new(1)->init(0,hash),::Array_obj< ::Dynamic>::__new(1)->init(0,chatMessage->from));
+ }
+ }
+HXLINE( 177) ::snikket::Client _gthis2 = _gthis;
+HXDLIN( 177) ::snikket::Chat chat1 = _gthis2->getChat(chatMessage->chatId());
+HXLINE( 178) if (::hx::IsNotNull( chat1 )) {
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_9, ::snikket::Client,_gthis, ::snikket::Chat,chat1) HXARGC(1)
+ void _hx_run( ::snikket::ChatMessage chatMessage){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_179_new)
+HXLINE( 180) int updateChat;
+HXDLIN( 180) if ((chatMessage->versions->length > 1)) {
+HXLINE( 180) updateChat = 1;
+ }
+ else {
+HXLINE( 180) updateChat = 0;
+ }
+HXDLIN( 180) _gthis->notifyMessageHandlers(chatMessage,updateChat);
+HXLINE( 181) bool updateChat1;
+HXDLIN( 181) bool updateChat2;
+HXDLIN( 181) if ((chatMessage->versions->length >= 1)) {
+HXLINE( 181) ::String updateChat3 = chat1->lastMessageId();
+HXDLIN( 181) updateChat2 = (updateChat3 == chatMessage->serverId);
+ }
+ else {
+HXLINE( 181) updateChat2 = true;
+ }
+HXDLIN( 181) if (!(updateChat2)) {
+HXLINE( 181) ::String updateChat4 = chat1->lastMessageId();
+HXDLIN( 181) updateChat1 = (updateChat4 == chatMessage->localId);
+ }
+ else {
+HXLINE( 181) updateChat1 = true;
+ }
+HXDLIN( 181) if (updateChat1) {
+HXLINE( 182) chat1->setLastMessage(chatMessage);
+HXLINE( 183) if ((chatMessage->versions->length < 1)) {
+HXLINE( 183) ::snikket::Chat chat = chat1;
+HXDLIN( 183) int updateChat5;
+HXDLIN( 183) if (chatMessage->isIncoming()) {
+HXLINE( 183) updateChat5 = (chat1->unreadCount() + 1);
+ }
+ else {
+HXLINE( 183) updateChat5 = 0;
+ }
+HXDLIN( 183) chat->setUnreadCount(updateChat5);
+ }
+HXLINE( 184) _gthis->chatActivity(chat1,null());
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE( 179) ::Dynamic updateChat = ::Dynamic(new _hx_Closure_9(_gthis,chat1));
+HXLINE( 187) if (::hx::IsNull( chatMessage->serverId )) {
+HXLINE( 188) updateChat(chatMessage);
+ }
+ else {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_10, ::Dynamic,updateChat) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> stored){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_190_new)
+HXLINE( 190) updateChat(stored->__get(0).StaticCast< ::snikket::ChatMessage >());
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE( 190) _gthis->storeMessages(::Array_obj< ::Dynamic>::__new(1)->init(0,chatMessage), ::Dynamic(new _hx_Closure_10(updateChat)));
+ }
+ }
+ }
+ }
+ break;
+ case (int)2: {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_11, ::snikket::Client,_gthis) HXARGC(1)
+ void _hx_run( ::snikket::ChatMessage stored){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_199_new)
+HXLINE( 199) if (::hx::IsNotNull( stored )) {
+HXLINE( 199) _gthis->notifyMessageHandlers(stored,1);
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE( 198) ::snikket::ModerationAction action = _g->_hx_getObject(0).StaticCast< ::snikket::ModerationAction >();
+HXLINE( 199) ::thenshim::_Promise::Promise_Impl__obj::then(_gthis->moderateMessage(action), ::Dynamic(new _hx_Closure_11(_gthis)),null());
+ }
+ break;
+ case (int)3: {
+HXLINE( 193) ::snikket::ReactionUpdate update = _g->_hx_getObject(0).StaticCast< ::snikket::ReactionUpdate >();
+HXDLIN( 193) {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_12, ::snikket::Client,_gthis) HXARGC(1)
+ void _hx_run( ::snikket::ChatMessage stored){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_197_new)
+HXLINE( 197) if (::hx::IsNotNull( stored )) {
+HXLINE( 197) _gthis->notifyMessageHandlers(stored,2);
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE( 194) {
+HXLINE( 194) int _g3 = 0;
+HXDLIN( 194) ::Array< ::Dynamic> _g4 = update->inlineHashReferences();
+HXDLIN( 194) while((_g3 < _g4->length)){
+HXLINE( 194) ::snikket::Hash hash1 = _g4->__get(_g3).StaticCast< ::snikket::Hash >();
+HXDLIN( 194) _g3 = (_g3 + 1);
+HXLINE( 195) _gthis->fetchMediaByHash(::Array_obj< ::Dynamic>::__new(1)->init(0,hash1),::Array_obj< ::Dynamic>::__new(1)->init(0,from));
+ }
+ }
+HXLINE( 197) ::Dynamic persistence1 = persistence;
+HXDLIN( 197) ::snikket::Persistence_obj::storeReaction(persistence1,_gthis->accountId(),update, ::Dynamic(new _hx_Closure_12(_gthis)));
+ }
+ }
+ break;
+ default:{
+ }
+ }
+ }
+HXLINE( 204) ::snikket::Stanza jmiP = stanza->getChild(HX_("propose",fe,fe,e9,f9),HX_("urn:xmpp:jingle-message:0",fd,20,a5,07));
+HXLINE( 205) bool _hx_tmp3;
+HXDLIN( 205) if (::hx::IsNotNull( jmiP )) {
+HXLINE( 205) _hx_tmp3 = ::hx::IsNotNull( ( (::String)(::Reflect_obj::field(jmiP->attr,HX_("id",db,5b,00,00))) ) );
+ }
+ else {
+HXLINE( 205) _hx_tmp3 = false;
+ }
+HXDLIN( 205) if (_hx_tmp3) {
+HXLINE( 206) ::snikket::Client _gthis3 = _gthis;
+HXDLIN( 206) ::snikket::jingle::IncomingProposedSession session = ::snikket::jingle::IncomingProposedSession_obj::__alloc( HX_CTX ,_gthis3,from,( (::String)(::Reflect_obj::field(jmiP->attr,HX_("id",db,5b,00,00))) ));
+HXLINE( 207) ::snikket::Client _gthis4 = _gthis;
+HXDLIN( 207) ::snikket::DirectChat chat2 = _gthis4->getDirectChat(from->asBare()->asString(),null());
+HXLINE( 208) ::Dynamic this1 = chat2->jingleSessions;
+HXDLIN( 208) if (!(( ( ::haxe::ds::StringMap)(this1) )->exists(session->get_sid()))) {
+HXLINE( 209) {
+HXLINE( 209) ::Dynamic this2 = chat2->jingleSessions;
+HXDLIN( 209) ( ( ::haxe::ds::StringMap)(this2) )->set(session->get_sid(),session);
+ }
+HXLINE( 210) _gthis->chatActivity(chat2,null());
+HXLINE( 211) session->ring();
+ }
+ }
+HXLINE( 215) ::snikket::Stanza jmiR = stanza->getChild(HX_("retract",01,e2,b9,fc),HX_("urn:xmpp:jingle-message:0",fd,20,a5,07));
+HXLINE( 216) bool _hx_tmp4;
+HXDLIN( 216) if (::hx::IsNotNull( jmiR )) {
+HXLINE( 216) _hx_tmp4 = ::hx::IsNotNull( ( (::String)(::Reflect_obj::field(jmiR->attr,HX_("id",db,5b,00,00))) ) );
+ }
+ else {
+HXLINE( 216) _hx_tmp4 = false;
+ }
+HXDLIN( 216) if (_hx_tmp4) {
+HXLINE( 217) ::snikket::Client _gthis5 = _gthis;
+HXDLIN( 217) ::snikket::DirectChat chat3 = _gthis5->getDirectChat(from->asBare()->asString(),null());
+HXLINE( 218) ::Dynamic this3 = chat3->jingleSessions;
+HXDLIN( 218) ::Dynamic session1 = ( ( ::haxe::ds::StringMap)(this3) )->get(( (::String)(::Reflect_obj::field(jmiR->attr,HX_("id",db,5b,00,00))) ));
+HXLINE( 219) if (::hx::IsNotNull( session1 )) {
+HXLINE( 220) ::snikket::jingle::Session_obj::retract(session1);
+HXLINE( 221) {
+HXLINE( 221) ::Dynamic this4 = chat3->jingleSessions;
+HXDLIN( 221) ( ( ::haxe::ds::StringMap)(this4) )->remove(::snikket::jingle::Session_obj::get_sid(session1));
+ }
+ }
+ }
+HXLINE( 226) ::snikket::Stanza jmiProFwd;
+HXDLIN( 226) if (::hx::IsNotNull( fwd )) {
+HXLINE( 226) jmiProFwd = fwd->getChild(HX_("proceed",2e,96,4a,f1),HX_("urn:xmpp:jingle-message:0",fd,20,a5,07));
+ }
+ else {
+HXLINE( 226) jmiProFwd = null();
+ }
+HXLINE( 227) bool _hx_tmp5;
+HXDLIN( 227) if (::hx::IsNotNull( jmiProFwd )) {
+HXLINE( 227) _hx_tmp5 = ::hx::IsNotNull( ( (::String)(::Reflect_obj::field(jmiProFwd->attr,HX_("id",db,5b,00,00))) ) );
+ }
+ else {
+HXLINE( 227) _hx_tmp5 = false;
+ }
+HXDLIN( 227) if (_hx_tmp5) {
+HXLINE( 228) ::snikket::Client _gthis6 = _gthis;
+HXDLIN( 228) ::snikket::DirectChat chat4 = _gthis6->getDirectChat(::snikket::JID_obj::parse(( (::String)(::Reflect_obj::field(fwd->attr,HX_("to",7b,65,00,00))) ))->asBare()->asString(),null());
+HXLINE( 229) ::Dynamic this5 = chat4->jingleSessions;
+HXDLIN( 229) ::Dynamic session2 = ( ( ::haxe::ds::StringMap)(this5) )->get(( (::String)(::Reflect_obj::field(jmiProFwd->attr,HX_("id",db,5b,00,00))) ));
+HXLINE( 230) if (::hx::IsNotNull( session2 )) {
+HXLINE( 231) ::snikket::jingle::Session_obj::retract(session2);
+HXLINE( 232) {
+HXLINE( 232) ::Dynamic this6 = chat4->jingleSessions;
+HXDLIN( 232) ( ( ::haxe::ds::StringMap)(this6) )->remove(::snikket::jingle::Session_obj::get_sid(session2));
+ }
+ }
+ }
+HXLINE( 236) ::snikket::Stanza jmiPro = stanza->getChild(HX_("proceed",2e,96,4a,f1),HX_("urn:xmpp:jingle-message:0",fd,20,a5,07));
+HXLINE( 237) bool _hx_tmp6;
+HXDLIN( 237) if (::hx::IsNotNull( jmiPro )) {
+HXLINE( 237) _hx_tmp6 = ::hx::IsNotNull( ( (::String)(::Reflect_obj::field(jmiPro->attr,HX_("id",db,5b,00,00))) ) );
+ }
+ else {
+HXLINE( 237) _hx_tmp6 = false;
+ }
+HXDLIN( 237) if (_hx_tmp6) {
+HXLINE( 238) ::snikket::Client _gthis7 = _gthis;
+HXDLIN( 238) ::snikket::DirectChat chat5 = _gthis7->getDirectChat(from->asBare()->asString(),null());
+HXLINE( 239) ::Dynamic this7 = chat5->jingleSessions;
+HXDLIN( 239) ::Dynamic session3 = ( ( ::haxe::ds::StringMap)(this7) )->get(( (::String)(::Reflect_obj::field(jmiPro->attr,HX_("id",db,5b,00,00))) ));
+HXLINE( 240) if (::hx::IsNotNull( session3 )) {
+HXLINE( 241) try {
+ HX_STACK_CATCHABLE( ::Dynamic, 0);
+HXLINE( 242) ::Dynamic this8 = chat5->jingleSessions;
+HXDLIN( 242) ::String key = ::snikket::jingle::Session_obj::get_sid(session3);
+HXDLIN( 242) ( ( ::haxe::ds::StringMap)(this8) )->set(key,::snikket::jingle::Session_obj::initiate(session3,stanza));
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::Dynamic >() ){
+ HX_STACK_BEGIN_CATCH
+ ::Dynamic _g5 = _hx_e;
+HXLINE( 243) ::haxe::Exception e = ::haxe::Exception_obj::caught(_g5);
+HXLINE( 244) ::haxe::Log_obj::trace(HX_("JMI proceed failed",29,32,fb,3c), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.Client",3c,fe,06,7c))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,e))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("new",60,d0,53,00))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/Client.hx",e1,49,02,18))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),244)));
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+ }
+ }
+HXLINE( 249) ::snikket::Stanza jmiRej = stanza->getChild(HX_("reject",5f,51,85,02),HX_("urn:xmpp:jingle-message:0",fd,20,a5,07));
+HXLINE( 250) bool _hx_tmp7;
+HXDLIN( 250) if (::hx::IsNotNull( jmiRej )) {
+HXLINE( 250) _hx_tmp7 = ::hx::IsNotNull( ( (::String)(::Reflect_obj::field(jmiRej->attr,HX_("id",db,5b,00,00))) ) );
+ }
+ else {
+HXLINE( 250) _hx_tmp7 = false;
+ }
+HXDLIN( 250) if (_hx_tmp7) {
+HXLINE( 251) ::snikket::Client _gthis8 = _gthis;
+HXDLIN( 251) ::snikket::DirectChat chat6 = _gthis8->getDirectChat(from->asBare()->asString(),null());
+HXLINE( 252) ::Dynamic this9 = chat6->jingleSessions;
+HXDLIN( 252) ::Dynamic session4 = ( ( ::haxe::ds::StringMap)(this9) )->get(( (::String)(::Reflect_obj::field(jmiRej->attr,HX_("id",db,5b,00,00))) ));
+HXLINE( 253) if (::hx::IsNotNull( session4 )) {
+HXLINE( 254) ::snikket::jingle::Session_obj::retract(session4);
+HXLINE( 255) {
+HXLINE( 255) ::Dynamic this10 = chat6->jingleSessions;
+HXDLIN( 255) ( ( ::haxe::ds::StringMap)(this10) )->remove(::snikket::jingle::Session_obj::get_sid(session4));
+ }
+ }
+ }
+HXLINE( 259) if ((( (::String)(::Reflect_obj::field(stanza->attr,HX_("type",ba,f2,08,4d))) ) != HX_("error",c8,cb,29,73))) {
+HXLINE( 260) ::snikket::Stanza chatState = stanza->getChild(null(),HX_("http://jabber.org/protocol/chatstates",8e,6d,41,6d));
+HXLINE( 261) ::Dynamic userState;
+HXDLIN( 261) ::String _g6;
+HXDLIN( 261) if (::hx::IsNotNull( chatState )) {
+HXLINE( 261) _g6 = chatState->name;
+ }
+ else {
+HXLINE( 261) _g6 = null();
+ }
+HXDLIN( 261) if (::hx::IsNull( _g6 )) {
+HXLINE( 261) userState = null();
+ }
+ else {
+HXLINE( 261) ::String _hx_switch_0 = _g6;
+ if ( (_hx_switch_0==HX_("active",c6,41,46,16)) ){
+HXLINE( 261) userState = 2;
+HXDLIN( 261) goto _hx_goto_2;
+ }
+ if ( (_hx_switch_0==HX_("composing",cf,0a,a5,12)) ){
+HXLINE( 261) userState = 3;
+HXDLIN( 261) goto _hx_goto_2;
+ }
+ if ( (_hx_switch_0==HX_("gone",5f,94,69,44)) ){
+HXLINE( 261) userState = 0;
+HXDLIN( 261) goto _hx_goto_2;
+ }
+ if ( (_hx_switch_0==HX_("inactive",6b,17,30,6a)) ){
+HXLINE( 261) userState = 1;
+HXDLIN( 261) goto _hx_goto_2;
+ }
+ if ( (_hx_switch_0==HX_("paused",ae,40,84,ef)) ){
+HXLINE( 261) userState = 4;
+HXDLIN( 261) goto _hx_goto_2;
+ }
+ /* default */{
+HXLINE( 261) userState = null();
+ }
+ _hx_goto_2:;
+ }
+HXLINE( 269) if (::hx::IsNotNull( userState )) {
+HXLINE( 270) ::snikket::Client _gthis9 = _gthis;
+HXDLIN( 270) ::snikket::Chat chat7 = _gthis9->getChat(from->asBare()->asString());
+HXLINE( 271) bool _hx_tmp8;
+HXDLIN( 271) if (::hx::IsNotNull( chat7 )) {
+HXLINE( 271) _hx_tmp8 = !(chat7->getParticipantDetails(message->senderId)->isSelf);
+ }
+ else {
+HXLINE( 271) _hx_tmp8 = true;
+ }
+HXDLIN( 271) if (_hx_tmp8) {
+HXLINE( 272) int _g7 = 0;
+HXDLIN( 272) ::Array< ::Dynamic> _g8 = _gthis->chatStateHandlers;
+HXDLIN( 272) while((_g7 < _g8->length)){
+HXLINE( 272) ::Dynamic handler = _g8->__get(_g7);
+HXDLIN( 272) _g7 = (_g7 + 1);
+HXLINE( 273) handler(message->senderId,message->chatId,message->threadId,userState);
+ }
+ }
+ }
+ }
+HXLINE( 279) ::snikket::PubsubEvent pubsubEvent = ::snikket::PubsubEvent_obj::fromStanza(stanza);
+HXLINE( 280) bool _hx_tmp9;
+HXDLIN( 280) bool _hx_tmp10;
+HXDLIN( 280) bool _hx_tmp11;
+HXDLIN( 280) if (::hx::IsNotNull( pubsubEvent )) {
+HXLINE( 280) _hx_tmp11 = ::hx::IsNotNull( pubsubEvent->getFrom() );
+ }
+ else {
+HXLINE( 280) _hx_tmp11 = false;
+ }
+HXDLIN( 280) if (_hx_tmp11) {
+HXLINE( 280) _hx_tmp10 = (pubsubEvent->getNode() == HX_("urn:xmpp:avatar:metadata",d4,65,1a,ee));
+ }
+ else {
+HXLINE( 280) _hx_tmp10 = false;
+ }
+HXDLIN( 280) if (_hx_tmp10) {
+HXLINE( 280) _hx_tmp9 = (pubsubEvent->getItems()->length > 0);
+ }
+ else {
+HXLINE( 280) _hx_tmp9 = false;
+ }
+HXDLIN( 280) if (_hx_tmp9) {
+HXLINE( 281) ::snikket::Stanza item = pubsubEvent->getItems()->__get(0).StaticCast< ::snikket::Stanza >();
+HXLINE( 282) ::String avatarSha1Hex = ( (::String)(::Reflect_obj::field(pubsubEvent->getItems()->__get(0).StaticCast< ::snikket::Stanza >()->attr,HX_("id",db,5b,00,00))) );
+HXLINE( 283) ::snikket::Hash tmp1 = ::snikket::Hash_obj::fromHex(HX_("sha-1",90,a8,1c,7c),avatarSha1Hex);
+HXDLIN( 283) ::Array< unsigned char > avatarSha1;
+HXDLIN( 283) if (::hx::IsNotNull( tmp1 )) {
+HXLINE( 283) avatarSha1 = tmp1->hash;
+ }
+ else {
+HXLINE( 283) avatarSha1 = null();
+ }
+HXLINE( 284) ::snikket::Stanza metadata = item->getChild(HX_("metadata",6f,e7,19,40),HX_("urn:xmpp:avatar:metadata",d4,65,1a,ee));
+HXLINE( 285) ::Array< ::String > mime = ::Array_obj< ::String >::fromData( _hx_array_data_7c06fe3c_24,1);
+HXLINE( 286) if (::hx::IsNotNull( metadata )) {
+HXLINE( 287) ::snikket::Stanza info = metadata->getChild(HX_("info",6e,38,bb,45),null());
+HXLINE( 288) bool _hx_tmp12;
+HXDLIN( 288) if (::hx::IsNotNull( info )) {
+HXLINE( 288) _hx_tmp12 = ::hx::IsNotNull( ( (::String)(::Reflect_obj::field(info->attr,HX_("type",ba,f2,08,4d))) ) );
+ }
+ else {
+HXLINE( 288) _hx_tmp12 = false;
+ }
+HXDLIN( 288) if (_hx_tmp12) {
+HXLINE( 289) mime[0] = ( (::String)(::Reflect_obj::field(info->attr,HX_("type",ba,f2,08,4d))) );
+ }
+ }
+HXLINE( 292) if (::hx::IsNotNull( avatarSha1 )) {
+ HX_BEGIN_LOCAL_FUNC_S6(::hx::LocalFunc,_hx_Closure_15, ::snikket::DirectChat,chat8, ::snikket::Client,_gthis,::Array< ::String >,mime,::String,avatarSha1Hex, ::snikket::PubsubEvent,pubsubEvent,::Dynamic,persistence) HXARGC(1)
+ void _hx_run(bool has){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_297_new)
+HXLINE( 297) if (has) {
+HXLINE( 298) _gthis->trigger(HX_("chats/update",3d,8e,1d,14),::cpp::VirtualArray_obj::__new(1)->init(0,chat8));
+ }
+ else {
+ HX_BEGIN_LOCAL_FUNC_S5(::hx::LocalFunc,_hx_Closure_14, ::snikket::Client,_gthis, ::snikket::DirectChat,chat8,::Array< ::String >,mime,::Dynamic,persistence, ::snikket::queries::PubsubGet,pubsubGet1) HXARGC(0)
+ void _hx_run(){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_13, ::snikket::DirectChat,chat8, ::snikket::Client,_gthis) HXARGC(0)
+ void _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_310_new)
+HXLINE( 310) _gthis->trigger(HX_("chats/update",3d,8e,1d,14),::cpp::VirtualArray_obj::__new(1)->init(0,chat8));
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_301_new)
+HXLINE( 302) ::haxe::Log_obj::trace(HX_("got avatar",6d,d0,89,ec),::hx::SourceInfo(HX_("snikket/Client.hx",e1,49,02,18),302,HX_("snikket.Client",3c,fe,06,7c),HX_("new",60,d0,53,00)));
+HXLINE( 303) ::snikket::Stanza item = pubsubGet1->getResult()->__get(0).StaticCast< ::snikket::Stanza >();
+HXLINE( 304) if (::hx::IsNull( item )) {
+HXLINE( 304) return;
+ }
+HXLINE( 305) ::haxe::Log_obj::trace(HX_("got avatar item",a6,d9,5c,85),::hx::SourceInfo(HX_("snikket/Client.hx",e1,49,02,18),305,HX_("snikket.Client",3c,fe,06,7c),HX_("new",60,d0,53,00)));
+HXLINE( 306) ::snikket::Stanza dataNode = item->getChild(HX_("data",2a,56,63,42),HX_("urn:xmpp:avatar:data",0f,7e,01,4e));
+HXLINE( 307) if (::hx::IsNull( dataNode )) {
+HXLINE( 307) return;
+ }
+HXLINE( 308) ::haxe::Log_obj::trace(HX_("got avatar data, store media",94,6c,6a,1f),::hx::SourceInfo(HX_("snikket/Client.hx",e1,49,02,18),308,HX_("snikket.Client",3c,fe,06,7c),HX_("new",60,d0,53,00)));
+HXLINE( 309) ::Dynamic persistence1 = persistence;
+HXDLIN( 309) ::String mime1 = mime->__get(0);
+HXDLIN( 309) ::snikket::Persistence_obj::storeMedia(persistence1,mime1,::haxe::crypto::Base64_obj::decode(::StringTools_obj::replace(dataNode->getText(),HX_("\n",0a,00,00,00),HX_("",00,00,00,00)),null())->b, ::Dynamic(new _hx_Closure_13(chat8,_gthis)));
+HXLINE( 312) ::haxe::Log_obj::trace(HX_("got avatar data, store media was called",a0,ce,e4,70),::hx::SourceInfo(HX_("snikket/Client.hx",e1,49,02,18),312,HX_("snikket.Client",3c,fe,06,7c),HX_("new",60,d0,53,00)));
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+HXLINE( 300) ::String pubsubGet = pubsubEvent->getFrom();
+HXDLIN( 300) ::snikket::queries::PubsubGet pubsubGet1 = ::snikket::queries::PubsubGet_obj::__alloc( HX_CTX ,pubsubGet,HX_("urn:xmpp:avatar:data",0f,7e,01,4e),avatarSha1Hex);
+HXLINE( 301) pubsubGet1->onFinished( ::Dynamic(new _hx_Closure_14(_gthis,chat8,mime,persistence,pubsubGet1)));
+HXLINE( 314) _gthis->sendQuery(pubsubGet1);
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE( 293) ::snikket::Client _gthis10 = _gthis;
+HXDLIN( 293) ::snikket::DirectChat chat8 = _gthis10->getDirectChat(::snikket::JID_obj::parse(pubsubEvent->getFrom())->asBare()->asString(),false);
+HXLINE( 294) chat8->setAvatarSha1(avatarSha1);
+HXLINE( 295) ::Dynamic persistence2 = persistence;
+HXDLIN( 295) ::String _hx_tmp13 = _gthis->accountId();
+HXDLIN( 295) ::snikket::Persistence_obj::storeChats(persistence2,_hx_tmp13,::Array_obj< ::Dynamic>::__new(1)->init(0,chat8));
+HXLINE( 296) ::snikket::Persistence_obj::hasMedia(persistence,HX_("sha-1",90,a8,1c,7c),avatarSha1, ::Dynamic(new _hx_Closure_15(chat8,_gthis,mime,avatarSha1Hex,pubsubEvent,persistence)));
+ }
+ }
+HXLINE( 320) bool _hx_tmp14;
+HXDLIN( 320) bool _hx_tmp15;
+HXDLIN( 320) bool _hx_tmp16;
+HXDLIN( 320) bool _hx_tmp17;
+HXDLIN( 320) if (::hx::IsNotNull( pubsubEvent )) {
+HXLINE( 320) _hx_tmp17 = ::hx::IsNotNull( pubsubEvent->getFrom() );
+ }
+ else {
+HXLINE( 320) _hx_tmp17 = false;
+ }
+HXDLIN( 320) if (_hx_tmp17) {
+HXLINE( 320) ::String _hx_tmp18 = ::snikket::JID_obj::parse(pubsubEvent->getFrom())->asBare()->asString();
+HXDLIN( 320) _hx_tmp16 = (_hx_tmp18 == _gthis->accountId());
+ }
+ else {
+HXLINE( 320) _hx_tmp16 = false;
+ }
+HXDLIN( 320) if (_hx_tmp16) {
+HXLINE( 320) _hx_tmp15 = (pubsubEvent->getNode() == HX_("http://jabber.org/protocol/nick",17,30,dc,e9));
+ }
+ else {
+HXLINE( 320) _hx_tmp15 = false;
+ }
+HXDLIN( 320) if (_hx_tmp15) {
+HXLINE( 320) _hx_tmp14 = (pubsubEvent->getItems()->length > 0);
+ }
+ else {
+HXLINE( 320) _hx_tmp14 = false;
+ }
+HXDLIN( 320) if (_hx_tmp14) {
+HXLINE( 321) ::snikket::Client _gthis11 = _gthis;
+HXDLIN( 321) _gthis11->updateDisplayName(pubsubEvent->getItems()->__get(0).StaticCast< ::snikket::Stanza >()->getChildText(HX_("nick",a3,7b,05,49),HX_("http://jabber.org/protocol/nick",17,30,dc,e9)));
+ }
+HXLINE( 324) bool _hx_tmp19;
+HXDLIN( 324) bool _hx_tmp20;
+HXDLIN( 324) bool _hx_tmp21;
+HXDLIN( 324) bool _hx_tmp22;
+HXDLIN( 324) if (::hx::IsNotNull( pubsubEvent )) {
+HXLINE( 324) _hx_tmp22 = ::hx::IsNotNull( pubsubEvent->getFrom() );
+ }
+ else {
+HXLINE( 324) _hx_tmp22 = false;
+ }
+HXDLIN( 324) if (_hx_tmp22) {
+HXLINE( 324) ::String _hx_tmp23 = ::snikket::JID_obj::parse(pubsubEvent->getFrom())->asBare()->asString();
+HXDLIN( 324) _hx_tmp21 = (_hx_tmp23 == _gthis->accountId());
+ }
+ else {
+HXLINE( 324) _hx_tmp21 = false;
+ }
+HXDLIN( 324) if (_hx_tmp21) {
+HXLINE( 324) _hx_tmp20 = (pubsubEvent->getNode() == HX_("urn:xmpp:mds:displayed:0",bd,60,cc,fb));
+ }
+ else {
+HXLINE( 324) _hx_tmp20 = false;
+ }
+HXDLIN( 324) if (_hx_tmp20) {
+HXLINE( 324) _hx_tmp19 = (pubsubEvent->getItems()->length > 0);
+ }
+ else {
+HXLINE( 324) _hx_tmp19 = false;
+ }
+HXDLIN( 324) if (_hx_tmp19) {
+HXLINE( 325) int _g9 = 0;
+HXDLIN( 325) ::Array< ::Dynamic> _g10 = pubsubEvent->getItems();
+HXDLIN( 325) while((_g9 < _g10->length)){
+HXLINE( 325) ::snikket::Stanza item1 = _g10->__get(_g9).StaticCast< ::snikket::Stanza >();
+HXDLIN( 325) _g9 = (_g9 + 1);
+HXLINE( 326) if (::hx::IsNotNull( ( (::String)(::Reflect_obj::field(item1->attr,HX_("id",db,5b,00,00))) ) )) {
+HXLINE( 327) ::snikket::Stanza tmp2 = item1->getChild(HX_("displayed",21,17,db,c1),HX_("urn:xmpp:mds:displayed:0",bd,60,cc,fb));
+HXDLIN( 327) ::snikket::Stanza upTo;
+HXDLIN( 327) if (::hx::IsNotNull( tmp2 )) {
+HXLINE( 327) upTo = tmp2->getChild(HX_("stanza-id",73,8a,54,e9),HX_("urn:xmpp:sid:0",a8,4b,37,54));
+ }
+ else {
+HXLINE( 327) upTo = null();
+ }
+HXLINE( 328) ::snikket::Client _gthis12 = _gthis;
+HXDLIN( 328) ::snikket::Chat chat9 = _gthis12->getChat(( (::String)(::Reflect_obj::field(item1->attr,HX_("id",db,5b,00,00))) ));
+HXLINE( 329) if (::hx::IsNull( chat9 )) {
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_16) HXARGC(1)
+ int _hx_run( ::snikket::Caps caps){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_330_new)
+HXLINE( 330) return 2;
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_17, ::snikket::Stanza,upTo) HXARGC(1)
+ void _hx_run( ::snikket::Chat chat){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_330_new)
+HXLINE( 330) ::String _hx_tmp = ( (::String)(::Reflect_obj::field(upTo->attr,HX_("id",db,5b,00,00))) );
+HXDLIN( 330) chat->markReadUpToId(_hx_tmp,( (::String)(::Reflect_obj::field(upTo->attr,HX_("by",d7,55,00,00))) ),null());
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE( 330) ::snikket::Client _gthis13 = _gthis;
+HXDLIN( 330) _gthis13->startChatWith(( (::String)(::Reflect_obj::field(item1->attr,HX_("id",db,5b,00,00))) ), ::Dynamic(new _hx_Closure_16()), ::Dynamic(new _hx_Closure_17(upTo)));
+ }
+ else {
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_18, ::snikket::Client,_gthis,::Dynamic,persistence, ::snikket::Chat,chat9) HXARGC(0)
+ void _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_332_new)
+HXLINE( 333) ::Dynamic persistence1 = persistence;
+HXDLIN( 333) ::String _hx_tmp = _gthis->accountId();
+HXDLIN( 333) ::snikket::Persistence_obj::storeChats(persistence1,_hx_tmp,::Array_obj< ::Dynamic>::__new(1)->init(0,chat9));
+HXLINE( 334) _gthis->trigger(HX_("chats/update",3d,8e,1d,14),::cpp::VirtualArray_obj::__new(1)->init(0,chat9));
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+HXLINE( 332) ::snikket::Chat chat10 = chat9;
+HXDLIN( 332) ::String _hx_tmp24 = ( (::String)(::Reflect_obj::field(upTo->attr,HX_("id",db,5b,00,00))) );
+HXDLIN( 332) chat10->markReadUpToId(_hx_tmp24,( (::String)(::Reflect_obj::field(upTo->attr,HX_("by",d7,55,00,00))) ), ::Dynamic(new _hx_Closure_18(_gthis,persistence,chat9)));
+ }
+ }
+ }
+ }
+HXLINE( 341) return ::snikket::EventResult_obj::EventUnhandled_dyn();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_20, ::snikket::Client,_gthis) HXARGC(1)
+ ::snikket::IqResult _hx_run( ::snikket::Stanza stanza){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_344_new)
+HXLINE( 345) ::snikket::JID from;
+HXDLIN( 345) if (::hx::IsNull( ( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) ) )) {
+HXLINE( 345) from = null();
+ }
+ else {
+HXLINE( 345) from = ::snikket::JID_obj::parse(( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) ));
+ }
+HXLINE( 346) ::snikket::Stanza jingle = stanza->getChild(HX_("jingle",31,27,eb,1f),HX_("urn:xmpp:jingle:1",44,c4,fe,f7));
+HXLINE( 347) ::snikket::Client _gthis1 = _gthis;
+HXDLIN( 347) ::snikket::DirectChat chat = _gthis1->getDirectChat(from->asBare()->asString(),null());
+HXLINE( 348) ::Dynamic this1 = chat->jingleSessions;
+HXDLIN( 348) ::Dynamic session = ( ( ::haxe::ds::StringMap)(this1) )->get(( (::String)(::Reflect_obj::field(jingle->attr,HX_("sid",0e,9f,57,00))) ));
+HXLINE( 350) if ((( (::String)(::Reflect_obj::field(jingle->attr,HX_("action",b6,3b,46,16))) ) == HX_("session-initiate",70,2d,30,f7))) {
+HXLINE( 351) if (::hx::IsNotNull( session )) {
+HXLINE( 352) try {
+ HX_STACK_CATCHABLE( ::Dynamic, 0);
+HXLINE( 353) ::Dynamic this2 = chat->jingleSessions;
+HXDLIN( 353) ::String key = ::snikket::jingle::Session_obj::get_sid(session);
+HXDLIN( 353) ( ( ::haxe::ds::StringMap)(this2) )->set(key,::snikket::jingle::Session_obj::initiate(session,stanza));
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::Dynamic >() ){
+ HX_STACK_BEGIN_CATCH
+ ::Dynamic _g = _hx_e;
+HXLINE( 354) ::haxe::Exception e = ::haxe::Exception_obj::caught(_g);
+HXDLIN( 354) {
+HXLINE( 355) ::haxe::Log_obj::trace(HX_("Bad session-inititate",c5,d7,64,3f), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.Client",3c,fe,06,7c))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,e))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("new",60,d0,53,00))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/Client.hx",e1,49,02,18))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),355)));
+HXLINE( 356) {
+HXLINE( 356) ::Dynamic this3 = chat->jingleSessions;
+HXDLIN( 356) ( ( ::haxe::ds::StringMap)(this3) )->remove(::snikket::jingle::Session_obj::get_sid(session));
+ }
+ }
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+ }
+ else {
+HXLINE( 359) ::snikket::jingle::InitiatedSession newSession = ::snikket::jingle::InitiatedSession_obj::fromSessionInitiate(_gthis,stanza);
+HXLINE( 360) {
+HXLINE( 360) ::Dynamic this4 = chat->jingleSessions;
+HXDLIN( 360) ( ( ::haxe::ds::StringMap)(this4) )->set(newSession->get_sid(),newSession);
+ }
+HXLINE( 361) _gthis->chatActivity(chat,null());
+HXLINE( 362) newSession->ring();
+ }
+ }
+HXLINE( 366) bool _hx_tmp;
+HXDLIN( 366) if (::hx::IsNotNull( session )) {
+HXLINE( 366) _hx_tmp = (( (::String)(::Reflect_obj::field(jingle->attr,HX_("action",b6,3b,46,16))) ) == HX_("session-accept",5f,92,e7,a8));
+ }
+ else {
+HXLINE( 366) _hx_tmp = false;
+ }
+HXDLIN( 366) if (_hx_tmp) {
+HXLINE( 367) try {
+ HX_STACK_CATCHABLE( ::Dynamic, 0);
+HXLINE( 368) ::Dynamic this5 = chat->jingleSessions;
+HXDLIN( 368) ::String key1 = ::snikket::jingle::Session_obj::get_sid(session);
+HXDLIN( 368) ( ( ::haxe::ds::StringMap)(this5) )->set(key1,::snikket::jingle::Session_obj::initiate(session,stanza));
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::Dynamic >() ){
+ HX_STACK_BEGIN_CATCH
+ ::Dynamic _g1 = _hx_e;
+HXLINE( 369) ::haxe::Exception e1 = ::haxe::Exception_obj::caught(_g1);
+HXLINE( 370) ::haxe::Log_obj::trace(HX_("session-accept failed",5e,a5,74,6b), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.Client",3c,fe,06,7c))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,e1))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("new",60,d0,53,00))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/Client.hx",e1,49,02,18))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),370)));
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+ }
+HXLINE( 374) bool _hx_tmp1;
+HXDLIN( 374) if (::hx::IsNotNull( session )) {
+HXLINE( 374) _hx_tmp1 = (( (::String)(::Reflect_obj::field(jingle->attr,HX_("action",b6,3b,46,16))) ) == HX_("session-terminate",6a,23,dc,12));
+ }
+ else {
+HXLINE( 374) _hx_tmp1 = false;
+ }
+HXDLIN( 374) if (_hx_tmp1) {
+HXLINE( 375) ::snikket::jingle::Session_obj::terminate(session);
+HXLINE( 376) {
+HXLINE( 376) ::Dynamic this6 = chat->jingleSessions;
+HXDLIN( 376) ( ( ::haxe::ds::StringMap)(this6) )->remove(( (::String)(::Reflect_obj::field(jingle->attr,HX_("sid",0e,9f,57,00))) ));
+ }
+ }
+HXLINE( 379) bool _hx_tmp2;
+HXDLIN( 379) if (::hx::IsNotNull( session )) {
+HXLINE( 379) _hx_tmp2 = (( (::String)(::Reflect_obj::field(jingle->attr,HX_("action",b6,3b,46,16))) ) == HX_("content-add",cd,a9,a1,10));
+ }
+ else {
+HXLINE( 379) _hx_tmp2 = false;
+ }
+HXDLIN( 379) if (_hx_tmp2) {
+HXLINE( 380) ::snikket::jingle::Session_obj::contentAdd(session,stanza);
+ }
+HXLINE( 383) bool _hx_tmp3;
+HXDLIN( 383) if (::hx::IsNotNull( session )) {
+HXLINE( 383) _hx_tmp3 = (( (::String)(::Reflect_obj::field(jingle->attr,HX_("action",b6,3b,46,16))) ) == HX_("content-accept",dc,ee,cb,f2));
+ }
+ else {
+HXLINE( 383) _hx_tmp3 = false;
+ }
+HXDLIN( 383) if (_hx_tmp3) {
+HXLINE( 384) ::snikket::jingle::Session_obj::contentAccept(session,stanza);
+ }
+HXLINE( 387) bool _hx_tmp4;
+HXDLIN( 387) if (::hx::IsNotNull( session )) {
+HXLINE( 387) _hx_tmp4 = (( (::String)(::Reflect_obj::field(jingle->attr,HX_("action",b6,3b,46,16))) ) == HX_("transport-info",d2,9e,05,1c));
+ }
+ else {
+HXLINE( 387) _hx_tmp4 = false;
+ }
+HXDLIN( 387) if (_hx_tmp4) {
+HXLINE( 388) ::snikket::jingle::Session_obj::transportInfo(session,stanza);
+ }
+HXLINE( 392) return ::snikket::IqResult_obj::IqResult_dyn();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_21, ::snikket::Client,_gthis) HXARGC(1)
+ ::snikket::IqResult _hx_run( ::snikket::Stanza stanza){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_396_new)
+HXLINE( 396) return ::snikket::IqResult_obj::IqResultElement(_gthis->caps->discoReply());
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_22, ::snikket::Client,_gthis,::Dynamic,persistence) HXARGC(1)
+ ::snikket::IqResult _hx_run( ::snikket::Stanza stanza){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_399_new)
+HXLINE( 401) bool _hx_tmp;
+HXDLIN( 401) if (::hx::IsNotNull( ( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) ) )) {
+HXLINE( 402) ::String _hx_tmp1 = ( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) );
+HXLINE( 401) _hx_tmp = (_hx_tmp1 != _gthis->jid->domain);
+ }
+ else {
+HXLINE( 401) _hx_tmp = false;
+ }
+HXLINE( 400) if (_hx_tmp) {
+HXLINE( 404) return ::snikket::IqResult_obj::IqNoResult_dyn();
+ }
+HXLINE( 407) ::snikket::queries::RosterGet roster = ::snikket::queries::RosterGet_obj::__alloc( HX_CTX ,null());
+HXLINE( 408) roster->handleResponse(stanza);
+HXLINE( 409) ::Array< ::Dynamic> items = roster->getResult();
+HXLINE( 410) if ((items->length == 0)) {
+HXLINE( 410) return ::snikket::IqResult_obj::IqNoResult_dyn();
+ }
+HXLINE( 412) ::Array< ::Dynamic> chatsToUpdate = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 413) {
+HXLINE( 413) int _g = 0;
+HXDLIN( 413) while((_g < items->length)){
+HXLINE( 413) ::Dynamic item = items->__get(_g);
+HXDLIN( 413) _g = (_g + 1);
+HXLINE( 414) if (::hx::IsNotEq( item->__Field(HX_("subscription",1d,ff,00,36),::hx::paccDynamic),HX_("remove",44,9c,88,04) )) {
+HXLINE( 415) ::snikket::DirectChat chat = _gthis->getDirectChat(( (::String)(item->__Field(HX_("jid",c5,ca,50,00),::hx::paccDynamic)) ),false);
+HXLINE( 416) chat->updateFromRoster(item);
+HXLINE( 417) chatsToUpdate->push(chat);
+ }
+ }
+ }
+HXLINE( 420) ::Dynamic persistence1 = persistence;
+HXDLIN( 420) ::snikket::Persistence_obj::storeChats(persistence1,_gthis->accountId(),chatsToUpdate);
+HXLINE( 421) _gthis->trigger(HX_("chats/update",3d,8e,1d,14),chatsToUpdate);
+HXLINE( 423) return ::snikket::IqResult_obj::IqResult_dyn();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_23, ::snikket::Client,_gthis) HXARGC(1)
+ ::snikket::IqResult _hx_run( ::snikket::Stanza stanza){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_426_new)
+HXLINE( 428) bool _hx_tmp;
+HXDLIN( 428) if (::hx::IsNotNull( ( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) ) )) {
+HXLINE( 429) ::String _hx_tmp1 = ( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) );
+HXLINE( 428) _hx_tmp = (_hx_tmp1 != _gthis->jid->domain);
+ }
+ else {
+HXLINE( 428) _hx_tmp = false;
+ }
+HXLINE( 427) if (_hx_tmp) {
+HXLINE( 431) return ::snikket::IqResult_obj::IqNoResult_dyn();
+ }
+HXLINE( 434) {
+HXLINE( 434) int _g = 0;
+HXDLIN( 434) ::Array< ::Dynamic> _g1;
+HXDLIN( 434) ::snikket::Stanza tmp = stanza->getChild(HX_("block",4d,75,fc,b4),HX_("urn:xmpp:blocking",d1,a1,46,c3));
+HXDLIN( 434) ::Array< ::Dynamic> tmp1;
+HXDLIN( 434) if (::hx::IsNotNull( tmp )) {
+HXLINE( 434) tmp1 = tmp->allTags(HX_("item",13,c5,bf,45),null());
+ }
+ else {
+HXLINE( 434) tmp1 = null();
+ }
+HXDLIN( 434) if (::hx::IsNotNull( tmp1 )) {
+HXLINE( 434) _g1 = tmp1;
+ }
+ else {
+HXLINE( 434) _g1 = ::Array_obj< ::Dynamic>::__new(0);
+ }
+HXDLIN( 434) while((_g < _g1->length)){
+HXLINE( 434) ::snikket::Stanza item = _g1->__get(_g).StaticCast< ::snikket::Stanza >();
+HXDLIN( 434) _g = (_g + 1);
+HXLINE( 435) if (::hx::IsNotNull( ( (::String)(::Reflect_obj::field(item->attr,HX_("jid",c5,ca,50,00))) ) )) {
+HXLINE( 435) ::snikket::Client _gthis1 = _gthis;
+HXDLIN( 435) _gthis1->serverBlocked(( (::String)(::Reflect_obj::field(item->attr,HX_("jid",c5,ca,50,00))) ));
+ }
+ }
+ }
+HXLINE( 438) return ::snikket::IqResult_obj::IqResult_dyn();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_24, ::snikket::Client,_gthis) HXARGC(1)
+ ::snikket::IqResult _hx_run( ::snikket::Stanza stanza){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_441_new)
+HXLINE( 443) bool _hx_tmp;
+HXDLIN( 443) if (::hx::IsNotNull( ( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) ) )) {
+HXLINE( 444) ::String _hx_tmp1 = ( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) );
+HXLINE( 443) _hx_tmp = (_hx_tmp1 != _gthis->jid->domain);
+ }
+ else {
+HXLINE( 443) _hx_tmp = false;
+ }
+HXLINE( 442) if (_hx_tmp) {
+HXLINE( 446) return ::snikket::IqResult_obj::IqNoResult_dyn();
+ }
+HXLINE( 449) ::snikket::Stanza tmp = stanza->getChild(HX_("unblock",54,6c,8d,b1),HX_("urn:xmpp:blocking",d1,a1,46,c3));
+HXDLIN( 449) ::Array< ::Dynamic> unblocks;
+HXDLIN( 449) if (::hx::IsNotNull( tmp )) {
+HXLINE( 449) unblocks = tmp->allTags(HX_("item",13,c5,bf,45),null());
+ }
+ else {
+HXLINE( 449) unblocks = null();
+ }
+HXLINE( 450) if (::hx::IsNull( unblocks )) {
+HXLINE( 452) int _g = 0;
+HXDLIN( 452) ::Array< ::Dynamic> _g1 = _gthis->chats;
+HXDLIN( 452) while((_g < _g1->length)){
+HXLINE( 452) ::snikket::Chat chat = _g1->__get(_g).StaticCast< ::snikket::Chat >();
+HXDLIN( 452) _g = (_g + 1);
+HXLINE( 453) if (chat->isBlocked) {
+HXLINE( 453) chat->unblock(false);
+ }
+ }
+ }
+ else {
+HXLINE( 456) int _g2 = 0;
+HXDLIN( 456) while((_g2 < unblocks->length)){
+HXLINE( 456) ::snikket::Stanza item = unblocks->__get(_g2).StaticCast< ::snikket::Stanza >();
+HXDLIN( 456) _g2 = (_g2 + 1);
+HXLINE( 457) if (::hx::IsNotNull( ( (::String)(::Reflect_obj::field(item->attr,HX_("jid",c5,ca,50,00))) ) )) {
+HXLINE( 457) ::snikket::Client _gthis1 = _gthis;
+HXDLIN( 457) ::snikket::Chat tmp1 = _gthis1->getChat(( (::String)(::Reflect_obj::field(item->attr,HX_("jid",c5,ca,50,00))) ));
+HXDLIN( 457) if (::hx::IsNotNull( tmp1 )) {
+HXLINE( 457) tmp1->unblock(false);
+ }
+ }
+ }
+ }
+HXLINE( 461) return ::snikket::IqResult_obj::IqResult_dyn();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_32, ::snikket::Client,_gthis,::Dynamic,persistence) HXARGC(1)
+ ::snikket::EventResult _hx_run( ::Dynamic event){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_464_new)
+HXLINE( 465) ::snikket::Stanza stanza = ( ( ::snikket::Stanza)(event->__Field(HX_("stanza",f5,5d,f7,05),::hx::paccDynamic)) );
+HXLINE( 466) ::snikket::Stanza c = stanza->getChild(HX_("c",63,00,00,00),HX_("http://jabber.org/protocol/caps",95,d0,90,e2));
+HXLINE( 467) ::snikket::Stanza mucUser = stanza->getChild(HX_("x",78,00,00,00),HX_("http://jabber.org/protocol/muc#user",87,74,8e,14));
+HXLINE( 468) bool _hx_tmp;
+HXDLIN( 468) if (::hx::IsNotNull( ( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) ) )) {
+HXLINE( 468) _hx_tmp = ::hx::IsNull( ( (::String)(::Reflect_obj::field(stanza->attr,HX_("type",ba,f2,08,4d))) ) );
+ }
+ else {
+HXLINE( 468) _hx_tmp = false;
+ }
+HXDLIN( 468) if (_hx_tmp) {
+HXLINE( 469) ::snikket::JID from = ::snikket::JID_obj::parse(( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) ));
+HXLINE( 470) ::snikket::Client _gthis1 = _gthis;
+HXDLIN( 470) ::snikket::Chat chat = _gthis1->getChat(from->asBare()->asString());
+HXLINE( 471) if (::hx::IsNull( chat )) {
+HXLINE( 472) ::Dynamic _hx_tmp1 = ::haxe::Log_obj::trace;
+HXDLIN( 472) ::String _hx_tmp2 = (HX_("Presence for unknown JID: ",19,ed,d7,3f) + ( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) ));
+HXDLIN( 472) _hx_tmp1(_hx_tmp2,::hx::SourceInfo(HX_("snikket/Client.hx",e1,49,02,18),472,HX_("snikket.Client",3c,fe,06,7c),HX_("new",60,d0,53,00)));
+HXLINE( 473) return ::snikket::EventResult_obj::EventUnhandled_dyn();
+ }
+HXLINE( 475) if (::hx::IsNull( c )) {
+HXLINE( 476) ::snikket::Chat chat1 = chat;
+HXDLIN( 476) ::String _hx_tmp3 = ::snikket::JID_obj::parse(( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) ))->resource;
+HXDLIN( 476) chat1->setPresence(_hx_tmp3, ::snikket::Presence_obj::__alloc( HX_CTX ,null(),mucUser));
+HXLINE( 477) ::Dynamic persistence1 = persistence;
+HXDLIN( 477) ::String _hx_tmp4 = _gthis->accountId();
+HXDLIN( 477) ::snikket::Persistence_obj::storeChats(persistence1,_hx_tmp4,::Array_obj< ::Dynamic>::__new(1)->init(0,chat));
+HXLINE( 478) if (chat->livePresence()) {
+HXLINE( 478) _gthis->trigger(HX_("chats/update",3d,8e,1d,14),::cpp::VirtualArray_obj::__new(1)->init(0,chat));
+ }
+ }
+ else {
+ HX_BEGIN_LOCAL_FUNC_S5(::hx::LocalFunc,_hx_Closure_25, ::snikket::Client,_gthis, ::snikket::Stanza,mucUser,::Dynamic,persistence, ::snikket::Chat,chat, ::snikket::Stanza,stanza) HXARGC(1)
+ ::snikket::Chat _hx_run( ::snikket::Caps caps){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_480_new)
+HXLINE( 481) ::snikket::Chat chat1 = chat;
+HXDLIN( 481) ::String handleCaps = ::snikket::JID_obj::parse(( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) ))->resource;
+HXDLIN( 481) chat1->setPresence(handleCaps, ::snikket::Presence_obj::__alloc( HX_CTX ,caps,mucUser));
+HXLINE( 482) bool handleCaps1;
+HXDLIN( 482) if (::hx::IsNotNull( mucUser )) {
+HXLINE( 482) handleCaps1 = chat->livePresence();
+ }
+ else {
+HXLINE( 482) handleCaps1 = true;
+ }
+HXDLIN( 482) if (handleCaps1) {
+HXLINE( 482) ::Dynamic persistence1 = persistence;
+HXDLIN( 482) ::String handleCaps2 = _gthis->accountId();
+HXDLIN( 482) ::snikket::Persistence_obj::storeChats(persistence1,handleCaps2,::Array_obj< ::Dynamic>::__new(1)->init(0,chat));
+ }
+HXLINE( 483) return chat;
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S5(::hx::LocalFunc,_hx_Closure_28, ::snikket::Client,_gthis,::Dynamic,persistence, ::Dynamic,handleCaps, ::snikket::Stanza,stanza, ::snikket::Stanza,c) HXARGC(1)
+ void _hx_run( ::snikket::Caps caps){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_487_new)
+HXLINE( 487) if (::hx::IsNull( caps )) {
+HXLINE( 488) ::Dynamic this1 = _gthis->pendingCaps;
+HXDLIN( 488) ::Array< ::Dynamic> pending = ( (::Array< ::Dynamic>)(( ( ::haxe::ds::StringMap)(this1) )->get(( (::String)(::Reflect_obj::field(c->attr,HX_("ver",63,e2,59,00))) ))) );
+HXLINE( 489) if (::hx::IsNull( pending )) {
+ HX_BEGIN_LOCAL_FUNC_S4(::hx::LocalFunc,_hx_Closure_27, ::snikket::Client,_gthis,::Dynamic,persistence, ::snikket::queries::DiscoInfoGet,discoGet2, ::snikket::Stanza,c) HXARGC(0)
+ void _hx_run(){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_26, ::haxe::ds::StringMap,chatsToUpdate) HXARGC(0)
+ ::Dynamic _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_501_new)
+HXLINE( 501) return chatsToUpdate->iterator();
+ }
+ HX_END_LOCAL_FUNC0(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_492_new)
+HXLINE( 493) ::haxe::ds::StringMap chatsToUpdate = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXLINE( 494) ::Array< ::Dynamic> handlers;
+HXDLIN( 494) ::Dynamic this1 = _gthis->pendingCaps;
+HXDLIN( 494) ::Array< ::Dynamic> tmp = ( (::Array< ::Dynamic>)(( ( ::haxe::ds::StringMap)(this1) )->get(( (::String)(::Reflect_obj::field(c->attr,HX_("ver",63,e2,59,00))) ))) );
+HXDLIN( 494) if (::hx::IsNotNull( tmp )) {
+HXLINE( 494) handlers = tmp;
+ }
+ else {
+HXLINE( 494) handlers = ::Array_obj< ::Dynamic>::__new(0);
+ }
+HXLINE( 495) {
+HXLINE( 495) ::Dynamic this2 = _gthis->pendingCaps;
+HXDLIN( 495) ( ( ::haxe::ds::StringMap)(this2) )->remove(( (::String)(::Reflect_obj::field(c->attr,HX_("ver",63,e2,59,00))) ));
+ }
+HXLINE( 496) if (::hx::IsNotNull( discoGet2->getResult() )) {
+HXLINE( 496) ::Dynamic persistence1 = persistence;
+HXDLIN( 496) ::snikket::Persistence_obj::storeCaps(persistence1,discoGet2->getResult());
+ }
+HXLINE( 497) {
+HXLINE( 497) int _g = 0;
+HXDLIN( 497) while((_g < handlers->length)){
+HXLINE( 497) ::Dynamic handler = handlers->__get(_g);
+HXDLIN( 497) _g = (_g + 1);
+HXLINE( 498) ::snikket::Chat c1 = ( ( ::snikket::Chat)(handler(discoGet2->getResult())) );
+HXLINE( 499) if (c1->livePresence()) {
+HXLINE( 499) chatsToUpdate->set(c1->chatId,c1);
+ }
+ }
+ }
+HXLINE( 501) ::snikket::Client _gthis1 = _gthis;
+HXDLIN( 501) _gthis1->trigger(HX_("chats/update",3d,8e,1d,14),::Lambda_obj::array( ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("iterator",ee,49,9a,93), ::Dynamic(new _hx_Closure_26(chatsToUpdate))))));
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+HXLINE( 490) {
+HXLINE( 490) ::Dynamic this2 = _gthis->pendingCaps;
+HXDLIN( 490) ::String key = ( (::String)(::Reflect_obj::field(c->attr,HX_("ver",63,e2,59,00))) );
+HXDLIN( 490) ( ( ::haxe::ds::StringMap)(this2) )->set(key,::Array_obj< ::Dynamic>::__new(1)->init(0,handleCaps));
+ }
+HXLINE( 491) ::String discoGet = ( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) );
+HXDLIN( 491) ::String discoGet1 = (( (::String)(::Reflect_obj::field(c->attr,HX_("node",02,0a,0a,49))) ) + HX_("#",23,00,00,00));
+HXDLIN( 491) ::snikket::queries::DiscoInfoGet discoGet2 = ::snikket::queries::DiscoInfoGet_obj::__alloc( HX_CTX ,discoGet,(discoGet1 + ( (::String)(::Reflect_obj::field(c->attr,HX_("ver",63,e2,59,00))) )));
+HXLINE( 492) discoGet2->onFinished( ::Dynamic(new _hx_Closure_27(_gthis,persistence,discoGet2,c)));
+HXLINE( 503) _gthis->sendQuery(discoGet2);
+ }
+ else {
+HXLINE( 505) pending->push(handleCaps);
+ }
+ }
+ else {
+HXLINE( 508) handleCaps(caps);
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE( 480) ::Dynamic handleCaps = ::Dynamic(new _hx_Closure_25(_gthis,mucUser,persistence,chat,stanza));
+HXLINE( 486) ::Dynamic persistence2 = persistence;
+HXDLIN( 486) ::snikket::Persistence_obj::getCaps(persistence2,( (::String)(::Reflect_obj::field(c->attr,HX_("ver",63,e2,59,00))) ), ::Dynamic(new _hx_Closure_28(_gthis,persistence,handleCaps,stanza,c)));
+ }
+HXLINE( 512) if (from->isBare()) {
+HXLINE( 513) ::String avatarSha1Hex = stanza->findText(HX_("{vcard-temp:x:update}x/photo#",f6,a1,33,28));
+HXLINE( 514) if (::hx::IsNotNull( avatarSha1Hex )) {
+ HX_BEGIN_LOCAL_FUNC_S4(::hx::LocalFunc,_hx_Closure_31, ::snikket::Client,_gthis, ::snikket::JID,from,::Dynamic,persistence, ::snikket::Chat,chat) HXARGC(1)
+ void _hx_run(bool has){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_519_new)
+HXLINE( 519) if (has) {
+HXLINE( 520) if (chat->livePresence()) {
+HXLINE( 520) _gthis->trigger(HX_("chats/update",3d,8e,1d,14),::cpp::VirtualArray_obj::__new(1)->init(0,chat));
+ }
+ }
+ else {
+ HX_BEGIN_LOCAL_FUNC_S4(::hx::LocalFunc,_hx_Closure_30, ::snikket::Client,_gthis, ::snikket::queries::VcardTempGet,vcardGet,::Dynamic,persistence, ::snikket::Chat,chat) HXARGC(0)
+ void _hx_run(){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_29, ::snikket::Client,_gthis, ::snikket::Chat,chat) HXARGC(0)
+ void _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_527_new)
+HXLINE( 527) _gthis->trigger(HX_("chats/update",3d,8e,1d,14),::cpp::VirtualArray_obj::__new(1)->init(0,chat));
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_523_new)
+HXLINE( 524) ::Dynamic vcard = vcardGet->getResult();
+HXLINE( 525) if (::hx::IsNull( vcard->__Field(HX_("photo",b2,c8,f3,c1),::hx::paccDynamic) )) {
+HXLINE( 525) return;
+ }
+HXLINE( 526) ::snikket::Persistence_obj::storeMedia(persistence, ::Dynamic( ::Dynamic(vcard->__Field(HX_("photo",b2,c8,f3,c1),::hx::paccDynamic))->__Field(HX_("mime",b4,4d,5c,48),::hx::paccDynamic)),( ( ::haxe::io::Bytes)( ::Dynamic(vcard->__Field(HX_("photo",b2,c8,f3,c1),::hx::paccDynamic))->__Field(HX_("data",2a,56,63,42),::hx::paccDynamic)) )->b, ::Dynamic(new _hx_Closure_29(_gthis,chat)));
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+HXLINE( 522) ::snikket::queries::VcardTempGet vcardGet = ::snikket::queries::VcardTempGet_obj::__alloc( HX_CTX ,from);
+HXLINE( 523) vcardGet->onFinished( ::Dynamic(new _hx_Closure_30(_gthis,vcardGet,persistence,chat)));
+HXLINE( 530) _gthis->sendQuery(vcardGet);
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE( 515) ::snikket::Hash tmp = ::snikket::Hash_obj::fromHex(HX_("sha-1",90,a8,1c,7c),avatarSha1Hex);
+HXDLIN( 515) ::Array< unsigned char > avatarSha1;
+HXDLIN( 515) if (::hx::IsNotNull( tmp )) {
+HXLINE( 515) avatarSha1 = tmp->hash;
+ }
+ else {
+HXLINE( 515) avatarSha1 = null();
+ }
+HXLINE( 516) chat->setAvatarSha1(avatarSha1);
+HXLINE( 517) ::Dynamic persistence3 = persistence;
+HXDLIN( 517) ::String _hx_tmp5 = _gthis->accountId();
+HXDLIN( 517) ::snikket::Persistence_obj::storeChats(persistence3,_hx_tmp5,::Array_obj< ::Dynamic>::__new(1)->init(0,chat));
+HXLINE( 518) ::snikket::Persistence_obj::hasMedia(persistence,HX_("sha-1",90,a8,1c,7c),avatarSha1, ::Dynamic(new _hx_Closure_31(_gthis,from,persistence,chat)));
+ }
+ }
+HXLINE( 535) return ::snikket::EventResult_obj::EventHandled_dyn();
+ }
+HXLINE( 538) bool _hx_tmp6;
+HXDLIN( 538) if (::hx::IsNotNull( ( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) ) )) {
+HXLINE( 538) _hx_tmp6 = (( (::String)(::Reflect_obj::field(stanza->attr,HX_("type",ba,f2,08,4d))) ) == HX_("unavailable",50,e0,29,fd));
+ }
+ else {
+HXLINE( 538) _hx_tmp6 = false;
+ }
+HXDLIN( 538) if (_hx_tmp6) {
+HXLINE( 539) ::snikket::Client _gthis2 = _gthis;
+HXDLIN( 539) ::snikket::Chat chat2 = _gthis2->getChat(::snikket::JID_obj::parse(( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) ))->asBare()->asString());
+HXLINE( 540) if (::hx::IsNull( chat2 )) {
+HXLINE( 541) ::Dynamic _hx_tmp7 = ::haxe::Log_obj::trace;
+HXDLIN( 541) ::String _hx_tmp8 = (HX_("Presence for unknown JID: ",19,ed,d7,3f) + ( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) ));
+HXDLIN( 541) _hx_tmp7(_hx_tmp8,::hx::SourceInfo(HX_("snikket/Client.hx",e1,49,02,18),541,HX_("snikket.Client",3c,fe,06,7c),HX_("new",60,d0,53,00)));
+HXLINE( 542) return ::snikket::EventResult_obj::EventUnhandled_dyn();
+ }
+HXLINE( 545) chat2->removePresence(::snikket::JID_obj::parse(( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) ))->resource);
+HXLINE( 546) ::Dynamic persistence4 = persistence;
+HXDLIN( 546) ::snikket::Persistence_obj::storeChats(persistence4,_gthis->accountId(),::Array_obj< ::Dynamic>::__new(1)->init(0,chat2));
+HXLINE( 547) _gthis->trigger(HX_("chats/update",3d,8e,1d,14),::cpp::VirtualArray_obj::__new(1)->init(0,chat2));
+ }
+HXLINE( 550) return ::snikket::EventResult_obj::EventUnhandled_dyn();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_51_new)
+HXLINE( 88) this->inSync = false;
+HXLINE( 86) this->pendingCaps = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXLINE( 85) this->token = null();
+HXLINE( 84) this->fastMechanism = null();
+HXLINE( 64) this->caps = ::snikket::Caps_obj::__alloc( HX_CTX ,HX_("https://sdk.snikket.org",d0,c9,43,f0),::Array_obj< ::Dynamic>::__new(0),::Array_obj< ::String >::fromData( _hx_array_data_7c06fe3c_45,13));
+HXLINE( 62) this->chats = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 59) this->chatStateHandlers = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 58) this->syncMessageHandlers = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 57) this->chatMessageHandlers = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 55) this->sendAvailable = true;
+HXLINE( 96) ::snikket::Client _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 97) ::sys::ssl::Socket_obj::DEFAULT_VERIFY_CERT = false;
+HXLINE( 98) ::snikket::_Util::Util_Fields__obj::setupTrace();
+HXLINE( 99) super::__construct();
+HXLINE( 100) this->jid = ::snikket::JID_obj::parse(address);
+HXLINE( 101) this->_displayName = this->jid->node;
+HXLINE( 102) this->persistence = persistence;
+HXLINE( 103) this->stream = ::snikket::streams::XmppStropheStream_obj::__alloc( HX_CTX );
+HXLINE( 104) this->stream->on(HX_("status/online",10,05,0e,d2),this->onConnected_dyn());
+HXLINE( 105) this->stream->on(HX_("status/offline",c6,eb,eb,54), ::Dynamic(new _hx_Closure_0(_gthis)));
+HXLINE( 109) this->stream->on(HX_("fast-token",48,5f,c2,26), ::Dynamic(new _hx_Closure_1(_gthis,persistence)));
+HXLINE( 115) this->stream->on(HX_("sm/update",1e,16,63,46), ::Dynamic(new _hx_Closure_3(_gthis,persistence)));
+HXLINE( 121) this->stream->on(HX_("sm/ack",14,b2,12,dd), ::Dynamic(new _hx_Closure_5(_gthis,persistence)));
+HXLINE( 131) this->stream->on(HX_("sm/fail",b3,aa,95,96), ::Dynamic(new _hx_Closure_7(_gthis,persistence)));
+HXLINE( 141) this->stream->on(HX_("message",c7,35,11,9a), ::Dynamic(new _hx_Closure_19(_gthis,persistence)));
+HXLINE( 344) this->stream->onIq(::snikket::IqRequestType_obj::Set_dyn(),HX_("jingle",31,27,eb,1f),HX_("urn:xmpp:jingle:1",44,c4,fe,f7), ::Dynamic(new _hx_Closure_20(_gthis)));
+HXLINE( 395) this->stream->onIq(::snikket::IqRequestType_obj::Get_dyn(),HX_("query",08,8b,ea,5d),HX_("http://jabber.org/protocol/disco#info",cb,2b,7f,0b), ::Dynamic(new _hx_Closure_21(_gthis)));
+HXLINE( 399) this->stream->onIq(::snikket::IqRequestType_obj::Set_dyn(),HX_("query",08,8b,ea,5d),HX_("jabber:iq:roster",47,76,6e,06), ::Dynamic(new _hx_Closure_22(_gthis,persistence)));
+HXLINE( 426) this->stream->onIq(::snikket::IqRequestType_obj::Set_dyn(),HX_("block",4d,75,fc,b4),HX_("urn:xmpp:blocking",d1,a1,46,c3), ::Dynamic(new _hx_Closure_23(_gthis)));
+HXLINE( 441) this->stream->onIq(::snikket::IqRequestType_obj::Set_dyn(),HX_("unblock",54,6c,8d,b1),HX_("urn:xmpp:blocking",d1,a1,46,c3), ::Dynamic(new _hx_Closure_24(_gthis)));
+HXLINE( 464) this->stream->on(HX_("presence",3b,52,d7,66), ::Dynamic(new _hx_Closure_32(_gthis,persistence)));
+ }
+
+Dynamic Client_obj::__CreateEmpty() { return new Client_obj; }
+
+void *Client_obj::_hx_vtable = 0;
+
+Dynamic Client_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Client_obj > _hx_result = new Client_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1]);
+ return _hx_result;
+}
+
+bool Client_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x668a7be8) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x668a7be8;
+ } else {
+ return inClassId==(int)0x6aca71d1;
+ }
+}
+
+void Client_obj::set_sendAvailable__fromC(bool value){
+ HX_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_282_set_sendAvailable__fromC)
+HXDLIN( 282) this->sendAvailable = value;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,set_sendAvailable__fromC,(void))
+
+void Client_obj::start(){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_6, ::snikket::Client,_gthis) HXARGC(4)
+ void _hx_run(::String clientId,::String loadedToken,int fastCount,::String displayName){
+ HX_BEGIN_LOCAL_FUNC_S4(::hx::LocalFunc,_hx_Closure_5, ::snikket::Client,_gthis,int,fastCount,::String,clientId,::String,displayName) HXARGC(1)
+ void _hx_run(::Array< unsigned char > sm){
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_4, ::snikket::Client,_gthis,int,fastCount,::Array< unsigned char >,sm) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> protoChats){
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_3, ::snikket::Client,_gthis,int,fastCount,::Array< unsigned char >,sm) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> details){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_1, ::snikket::Client,_gthis,int,fastCount) HXARGC(1)
+ ::snikket::EventResult _hx_run( ::Dynamic data){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_586_start)
+HXLINE( 587) ::Dynamic tmp = data->__Field(HX_("mechanisms",fa,b0,9e,80),::hx::paccDynamic);
+HXDLIN( 587) ::Dynamic tmp1;
+HXDLIN( 587) if (::hx::IsNotNull( tmp )) {
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ ::Dynamic _hx_run( ::Dynamic mech){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_587_start)
+HXLINE( 587) return ::Dynamic(mech->__Field(HX_("canFast",cc,aa,0d,62),::hx::paccDynamic));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE( 587) tmp1 = tmp->__Field(HX_("find",39,d0,bb,43),::hx::paccDynamic)( ::Dynamic(new _hx_Closure_0()));
+ }
+ else {
+HXLINE( 587) tmp1 = null();
+ }
+HXDLIN( 587) ::String _hx_tmp;
+HXDLIN( 587) if (::hx::IsNotNull( tmp1 )) {
+HXLINE( 587) _hx_tmp = ( (::String)(tmp1->__Field(HX_("name",4b,72,ff,48),::hx::paccDynamic)) );
+ }
+ else {
+HXLINE( 587) _hx_tmp = null();
+ }
+HXDLIN( 587) _gthis->fastMechanism = _hx_tmp;
+HXLINE( 588) bool _hx_tmp1;
+HXDLIN( 588) if (::hx::IsNotNull( _gthis->token )) {
+HXLINE( 588) if (::hx::IsNull( _gthis->fastMechanism )) {
+HXLINE( 588) _hx_tmp1 = ::hx::IsNotNull( data->__Field(HX_("mechanimsms",cb,6a,49,06),::hx::paccDynamic) );
+ }
+ else {
+HXLINE( 588) _hx_tmp1 = false;
+ }
+ }
+ else {
+HXLINE( 588) _hx_tmp1 = true;
+ }
+HXDLIN( 588) if (_hx_tmp1) {
+HXLINE( 589) ::snikket::Client _gthis1 = _gthis;
+HXDLIN( 589) return _gthis1->trigger(HX_("auth/password-needed",80,f0,74,49), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("accountId",e8,81,54,29),_gthis->accountId())));
+ }
+ else {
+HXLINE( 591) return _gthis->stream->trigger(HX_("auth/password",e2,5d,98,00), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("fastCount",93,fc,67,a5),fastCount)
+ ->setFixed(1,HX_("mechanism",59,fd,7e,2e),_gthis->fastMechanism)
+ ->setFixed(2,HX_("password",1b,23,d0,48),_gthis->token)));
+ }
+HXLINE( 588) return null();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_2, ::snikket::Client,_gthis,::Array< unsigned char >,sm) HXARGC(1)
+ ::snikket::EventResult _hx_run( ::Dynamic data){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_594_start)
+HXLINE( 595) if (::hx::IsNotNull( _gthis->token )) {
+HXLINE( 596) _gthis->token = null();
+HXLINE( 597) ::snikket::GenericStream _gthis1 = _gthis->stream;
+HXDLIN( 597) ::String _hx_tmp = _gthis->jid->asString();
+HXDLIN( 597) _gthis1->connect(_hx_tmp,sm);
+ }
+ else {
+HXLINE( 599) ::snikket::GenericStream _gthis2 = _gthis->stream;
+HXDLIN( 599) ::String _hx_tmp1 = _gthis->jid->asString();
+HXDLIN( 599) _gthis2->connect(_hx_tmp1,sm);
+ }
+HXLINE( 601) return ::snikket::EventResult_obj::EventHandled_dyn();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_574_start)
+HXLINE( 575) ::haxe::Log_obj::trace(HX_("got details",ee,d5,cf,a0),::hx::SourceInfo(HX_("snikket/Client.hx",e1,49,02,18),575,HX_("snikket.Client",3c,fe,06,7c),HX_("start",62,74,0b,84)));
+HXLINE( 576) {
+HXLINE( 576) int _g = 0;
+HXDLIN( 576) while((_g < details->length)){
+HXLINE( 576) ::Dynamic detail = details->__get(_g);
+HXDLIN( 576) _g = (_g + 1);
+HXLINE( 577) ::snikket::Chat chat = _gthis->getChat(( (::String)(detail->__Field(HX_("chatId",d3,04,77,b7),::hx::paccDynamic)) ));
+HXLINE( 578) if (::hx::IsNotNull( chat )) {
+HXLINE( 579) chat->setLastMessage(( ( ::snikket::ChatMessage)(detail->__Field(HX_("message",c7,35,11,9a),::hx::paccDynamic)) ));
+HXLINE( 580) chat->setUnreadCount(( (int)(detail->__Field(HX_("unreadCount",20,18,f1,a0),::hx::paccDynamic)) ));
+ }
+ }
+ }
+HXLINE( 583) _gthis->sortChats();
+HXLINE( 584) _gthis->trigger(HX_("chats/update",3d,8e,1d,14),_gthis->chats);
+HXLINE( 586) _gthis->stream->on(HX_("auth/password-needed",80,f0,74,49), ::Dynamic(new _hx_Closure_1(_gthis,fastCount)));
+HXLINE( 594) _gthis->stream->on(HX_("auth/fail",25,45,e9,d1), ::Dynamic(new _hx_Closure_2(_gthis,sm)));
+HXLINE( 603) ::haxe::Log_obj::trace(HX_("go connect",f2,41,71,10),::hx::SourceInfo(HX_("snikket/Client.hx",e1,49,02,18),603,HX_("snikket.Client",3c,fe,06,7c),HX_("start",62,74,0b,84)));
+HXLINE( 604) ::snikket::GenericStream _gthis1 = _gthis->stream;
+HXDLIN( 604) ::String _hx_tmp = _gthis->jid->asString();
+HXDLIN( 604) _gthis1->connect(_hx_tmp,sm);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_569_start)
+HXLINE( 570) ::haxe::Log_obj::trace(HX_("got chats",c7,b4,d9,94),::hx::SourceInfo(HX_("snikket/Client.hx",e1,49,02,18),570,HX_("snikket.Client",3c,fe,06,7c),HX_("start",62,74,0b,84)));
+HXLINE( 571) {
+HXLINE( 571) int _g = 0;
+HXDLIN( 571) while((_g < protoChats->length)){
+HXLINE( 571) ::snikket::SerializedChat protoChat = protoChats->__get(_g).StaticCast< ::snikket::SerializedChat >();
+HXDLIN( 571) _g = (_g + 1);
+HXLINE( 572) ::Array< ::Dynamic> _gthis1 = _gthis->chats;
+HXDLIN( 572) _gthis1->push(protoChat->toChat(_gthis,_gthis->stream,_gthis->persistence));
+ }
+ }
+HXLINE( 574) ::Dynamic _gthis2 = _gthis->persistence;
+HXDLIN( 574) ::String _hx_tmp = _gthis->accountId();
+HXDLIN( 574) ::snikket::Persistence_obj::getChatsUnreadDetails(_gthis2,_hx_tmp,_gthis->chats, ::Dynamic(new _hx_Closure_3(_gthis,fastCount,sm)));
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_561_start)
+HXLINE( 562) ::haxe::Log_obj::trace(HX_("got sm",ee,fa,01,65),::hx::SourceInfo(HX_("snikket/Client.hx",e1,49,02,18),562,HX_("snikket.Client",3c,fe,06,7c),HX_("start",62,74,0b,84)));
+HXLINE( 563) ::String tmp = clientId;
+HXDLIN( 563) ::String _hx_tmp;
+HXDLIN( 563) if (::hx::IsNotNull( tmp )) {
+HXLINE( 563) _hx_tmp = tmp;
+ }
+ else {
+HXLINE( 563) _hx_tmp = ::snikket::ID_obj::_hx_long();
+ }
+HXDLIN( 563) _gthis->stream->clientId = _hx_tmp;
+HXLINE( 564) _gthis->jid = _gthis->jid->withResource(_gthis->stream->clientId);
+HXLINE( 565) bool _hx_tmp1;
+HXDLIN( 565) if (!(_gthis->updateDisplayName(displayName))) {
+HXLINE( 565) _hx_tmp1 = ::hx::IsNull( clientId );
+ }
+ else {
+HXLINE( 565) _hx_tmp1 = false;
+ }
+HXDLIN( 565) if (_hx_tmp1) {
+HXLINE( 566) ::Dynamic _gthis1 = _gthis->persistence;
+HXDLIN( 566) ::String _hx_tmp2 = _gthis->jid->asBare()->asString();
+HXDLIN( 566) ::String _gthis2 = _gthis->stream->clientId;
+HXDLIN( 566) ::snikket::Persistence_obj::storeLogin(_gthis1,_hx_tmp2,_gthis2,_gthis->displayName(),null());
+ }
+HXLINE( 569) ::Dynamic _gthis3 = _gthis->persistence;
+HXDLIN( 569) ::snikket::Persistence_obj::getChats(_gthis3,_gthis->accountId(), ::Dynamic(new _hx_Closure_4(_gthis,fastCount,sm)));
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_558_start)
+HXLINE( 559) ::haxe::Log_obj::trace(HX_("got login",95,ef,19,c8), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.Client",3c,fe,06,7c))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,clientId))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("start",62,74,0b,84))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/Client.hx",e1,49,02,18))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),559)));
+HXLINE( 560) _gthis->token = loadedToken;
+HXLINE( 561) ::Dynamic _gthis1 = _gthis->persistence;
+HXDLIN( 561) ::snikket::Persistence_obj::getStreamManagement(_gthis1,_gthis->accountId(), ::Dynamic(new _hx_Closure_5(_gthis,fastCount,clientId,displayName)));
+ }
+ HX_END_LOCAL_FUNC4((void))
+
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_557_start)
+HXDLIN( 557) ::snikket::Client _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 558) ::Dynamic _hx_tmp = this->persistence;
+HXDLIN( 558) ::snikket::Persistence_obj::getLogin(_hx_tmp,this->accountId(), ::Dynamic(new _hx_Closure_6(_gthis)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Client_obj,start,(void))
+
+void Client_obj::logout(bool completely){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::Client,_gthis) HXARGC(0)
+ void _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_620_logout)
+HXLINE( 620) _gthis->stream->disconnect();
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_616_logout)
+HXDLIN( 616) ::snikket::Client _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 617) ::Dynamic _hx_tmp = this->persistence;
+HXDLIN( 617) ::snikket::Persistence_obj::removeAccount(_hx_tmp,this->accountId(),completely);
+HXLINE( 618) ::snikket::queries::Push2Disable disable = ::snikket::queries::Push2Disable_obj::__alloc( HX_CTX ,this->jid->asBare()->asString());
+HXLINE( 619) disable->onFinished( ::Dynamic(new _hx_Closure_0(_gthis)));
+HXLINE( 622) this->sendQuery(disable);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,logout,(void))
+
+void Client_obj::usePassword(::String password){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_632_usePassword)
+HXDLIN( 632) this->stream->trigger(HX_("auth/password",e2,5d,98,00), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("requestToken",2a,35,fd,af),this->fastMechanism)
+ ->setFixed(1,HX_("password",1b,23,d0,48),password)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,usePassword,(void))
+
+::String Client_obj::accountId(){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_641_accountId)
+HXDLIN( 641) return this->jid->asBare()->asString();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Client_obj,accountId,return )
+
+::String Client_obj::displayName(){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_650_displayName)
+HXDLIN( 650) return this->_displayName;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Client_obj,displayName,return )
+
+void Client_obj::setDisplayName(::String displayName){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ void _hx_run( ::snikket::Stanza response){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_668_setDisplayName)
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_658_setDisplayName)
+HXLINE( 659) bool _hx_tmp;
+HXDLIN( 659) bool _hx_tmp1;
+HXDLIN( 659) if (::hx::IsNotNull( displayName )) {
+HXLINE( 659) _hx_tmp1 = (displayName == HX_("",00,00,00,00));
+ }
+ else {
+HXLINE( 659) _hx_tmp1 = true;
+ }
+HXDLIN( 659) if (!(_hx_tmp1)) {
+HXLINE( 659) _hx_tmp = (displayName == this->displayName());
+ }
+ else {
+HXLINE( 659) _hx_tmp = true;
+ }
+HXDLIN( 659) if (_hx_tmp) {
+HXLINE( 659) return;
+ }
+HXLINE( 661) ::snikket::GenericStream _hx_tmp2 = this->stream;
+HXDLIN( 661) _hx_tmp2->sendIq( ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("iq",e8,5b,00,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("type",ba,f2,08,4d),HX_("set",a2,9b,57,00))))->tag(HX_("pubsub",e3,da,f8,66), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("http://jabber.org/protocol/pubsub",57,94,3c,f2))))->tag(HX_("publish",8f,21,1d,ae), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("node",02,0a,0a,49),HX_("http://jabber.org/protocol/nick",17,30,dc,e9))))->tag(HX_("item",13,c5,bf,45),null())->textTag(HX_("nick",a3,7b,05,49),displayName, ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("http://jabber.org/protocol/nick",17,30,dc,e9))))->up()->up()->up(), ::Dynamic(new _hx_Closure_0()));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,setDisplayName,(void))
+
+bool Client_obj::updateDisplayName(::String fn){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_672_updateDisplayName)
+HXLINE( 673) bool _hx_tmp;
+HXDLIN( 673) bool _hx_tmp1;
+HXDLIN( 673) if (::hx::IsNotNull( fn )) {
+HXLINE( 673) _hx_tmp1 = (fn == HX_("",00,00,00,00));
+ }
+ else {
+HXLINE( 673) _hx_tmp1 = true;
+ }
+HXDLIN( 673) if (!(_hx_tmp1)) {
+HXLINE( 673) _hx_tmp = (fn == this->displayName());
+ }
+ else {
+HXLINE( 673) _hx_tmp = true;
+ }
+HXDLIN( 673) if (_hx_tmp) {
+HXLINE( 673) return false;
+ }
+HXLINE( 674) this->_displayName = fn;
+HXLINE( 675) ::Dynamic _hx_tmp2 = this->persistence;
+HXDLIN( 675) ::String _hx_tmp3 = this->jid->asBare()->asString();
+HXDLIN( 675) ::String tmp = this->stream->clientId;
+HXDLIN( 675) ::String _hx_tmp4;
+HXDLIN( 675) if (::hx::IsNotNull( tmp )) {
+HXLINE( 675) _hx_tmp4 = tmp;
+ }
+ else {
+HXLINE( 675) _hx_tmp4 = this->jid->resource;
+ }
+HXDLIN( 675) ::snikket::Persistence_obj::storeLogin(_hx_tmp2,_hx_tmp3,_hx_tmp4,fn,null());
+HXLINE( 676) this->pingAllChannels(false);
+HXLINE( 677) return true;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,updateDisplayName,return )
+
+ ::snikket::EventResult Client_obj::onConnected( ::Dynamic data){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::Client,_gthis) HXARGC(2)
+ void _hx_run( ::Dynamic service, ::snikket::Caps caps){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_694_onConnected)
+HXLINE( 694) ::Dynamic _gthis1 = _gthis->persistence;
+HXDLIN( 694) ::String _hx_tmp = _gthis->accountId();
+HXDLIN( 694) ::String _hx_tmp1 = ( ( ::snikket::JID)(service->__Field(HX_("jid",c5,ca,50,00),::hx::paccDynamic)) )->asString();
+HXDLIN( 694) ::snikket::Persistence_obj::storeService(_gthis1,_hx_tmp,_hx_tmp1, ::Dynamic(service->__Field(HX_("name",4b,72,ff,48),::hx::paccDynamic)), ::Dynamic(service->__Field(HX_("node",02,0a,0a,49),::hx::paccDynamic)),caps);
+ }
+ HX_END_LOCAL_FUNC2((void))
+
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_3, ::snikket::Client,_gthis) HXARGC(0)
+ void _hx_run(){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_2, ::snikket::Client,_gthis) HXARGC(1)
+ void _hx_run(bool syncFinished){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_1, ::snikket::Client,_gthis) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> details){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_711_onConnected)
+HXLINE( 712) {
+HXLINE( 712) int _g = 0;
+HXDLIN( 712) while((_g < details->length)){
+HXLINE( 712) ::Dynamic detail = details->__get(_g);
+HXDLIN( 712) _g = (_g + 1);
+HXLINE( 713) ::snikket::Chat chat;
+HXDLIN( 713) ::snikket::Chat tmp = _gthis->getChat(( (::String)(detail->__Field(HX_("chatId",d3,04,77,b7),::hx::paccDynamic)) ));
+HXDLIN( 713) if (::hx::IsNotNull( tmp )) {
+HXLINE( 713) chat = tmp;
+ }
+ else {
+HXLINE( 713) chat = _gthis->getDirectChat(( (::String)(detail->__Field(HX_("chatId",d3,04,77,b7),::hx::paccDynamic)) ),false);
+ }
+HXLINE( 714) ::String initialLastId = chat->lastMessageId();
+HXLINE( 715) chat->setLastMessage(( ( ::snikket::ChatMessage)(detail->__Field(HX_("message",c7,35,11,9a),::hx::paccDynamic)) ));
+HXLINE( 716) chat->setUnreadCount(( (int)(detail->__Field(HX_("unreadCount",20,18,f1,a0),::hx::paccDynamic)) ));
+HXLINE( 717) bool _hx_tmp;
+HXDLIN( 717) if (::hx::IsGreater( detail->__Field(HX_("unreadCount",20,18,f1,a0),::hx::paccDynamic),0 )) {
+HXLINE( 717) _hx_tmp = (initialLastId != chat->lastMessageId());
+ }
+ else {
+HXLINE( 717) _hx_tmp = false;
+ }
+HXDLIN( 717) if (_hx_tmp) {
+HXLINE( 718) _gthis->chatActivity(chat,false);
+ }
+ }
+ }
+HXLINE( 721) _gthis->sortChats();
+HXLINE( 722) _gthis->trigger(HX_("chats/update",3d,8e,1d,14),_gthis->chats);
+HXLINE( 724) if (_gthis->sendAvailable) {
+HXLINE( 726) ::snikket::Client _gthis1 = _gthis;
+HXLINE( 727) ::String _hx_tmp1 = ::snikket::ID_obj::_hx_short();
+HXLINE( 726) _gthis1->sendStanza( ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("iq",e8,5b,00,00), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("id",db,5b,00,00),_hx_tmp1)
+ ->setFixed(1,HX_("type",ba,f2,08,4d),HX_("set",a2,9b,57,00))))->tag(HX_("enable",83,ae,87,f8), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:carbons:2",02,86,9e,df))))->up());
+HXLINE( 731) _gthis->sendPresence(null(),null());
+HXLINE( 732) _gthis->joinAllChannels();
+ }
+HXLINE( 734) _gthis->trigger(HX_("status/online",10,05,0e,d2), ::Dynamic(::hx::Anon_obj::Create(0)));
+HXLINE( 735) ::haxe::Log_obj::trace(HX_("SYNC: done",c3,a6,82,dd),::hx::SourceInfo(HX_("snikket/Client.hx",e1,49,02,18),735,HX_("snikket.Client",3c,fe,06,7c),HX_("onConnected",aa,c5,39,c5)));
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_700_onConnected)
+HXLINE( 701) if (!(syncFinished)) {
+HXLINE( 702) ::haxe::Log_obj::trace(HX_("SYNC: failed",3e,4e,5e,fa),::hx::SourceInfo(HX_("snikket/Client.hx",e1,49,02,18),702,HX_("snikket.Client",3c,fe,06,7c),HX_("onConnected",aa,c5,39,c5)));
+HXLINE( 703) _gthis->inSync = false;
+HXLINE( 704) _gthis->stream->disconnect();
+HXLINE( 706) return;
+ }
+HXLINE( 709) ::haxe::Log_obj::trace(HX_("SYNC: details",21,c5,8e,ac),::hx::SourceInfo(HX_("snikket/Client.hx",e1,49,02,18),709,HX_("snikket.Client",3c,fe,06,7c),HX_("onConnected",aa,c5,39,c5)));
+HXLINE( 710) _gthis->inSync = true;
+HXLINE( 711) ::Dynamic _gthis1 = _gthis->persistence;
+HXDLIN( 711) ::String _hx_tmp = _gthis->accountId();
+HXDLIN( 711) ::snikket::Persistence_obj::getChatsUnreadDetails(_gthis1,_hx_tmp,_gthis->chats, ::Dynamic(new _hx_Closure_1(_gthis)));
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_698_onConnected)
+HXLINE( 699) ::haxe::Log_obj::trace(HX_("SYNC: MAM",58,33,e1,36),::hx::SourceInfo(HX_("snikket/Client.hx",e1,49,02,18),699,HX_("snikket.Client",3c,fe,06,7c),HX_("onConnected",aa,c5,39,c5)));
+HXLINE( 700) _gthis->sync( ::Dynamic(new _hx_Closure_2(_gthis)));
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_680_onConnected)
+HXDLIN( 680) ::snikket::Client _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 681) bool _hx_tmp;
+HXDLIN( 681) if (::hx::IsNotNull( data )) {
+HXLINE( 681) _hx_tmp = ::hx::IsNotNull( data->__Field(HX_("jid",c5,ca,50,00),::hx::paccDynamic) );
+ }
+ else {
+HXLINE( 681) _hx_tmp = false;
+ }
+HXDLIN( 681) if (_hx_tmp) {
+HXLINE( 682) this->jid = ::snikket::JID_obj::parse(( (::String)(data->__Field(HX_("jid",c5,ca,50,00),::hx::paccDynamic)) ));
+HXLINE( 683) bool _hx_tmp1;
+HXDLIN( 683) if (::hx::IsNull( this->stream->clientId )) {
+HXLINE( 683) _hx_tmp1 = !(this->jid->isBare());
+ }
+ else {
+HXLINE( 683) _hx_tmp1 = false;
+ }
+HXDLIN( 683) if (_hx_tmp1) {
+HXLINE( 683) ::Dynamic _hx_tmp2 = this->persistence;
+HXDLIN( 683) ::String _hx_tmp3 = this->jid->asBare()->asString();
+HXDLIN( 683) ::String _hx_tmp4 = this->jid->resource;
+HXDLIN( 683) ::snikket::Persistence_obj::storeLogin(_hx_tmp2,_hx_tmp3,_hx_tmp4,this->displayName(),null());
+ }
+ }
+HXLINE( 686) if (( (bool)(data->__Field(HX_("resumed",17,0e,58,6b),::hx::paccDynamic)) )) {
+HXLINE( 687) this->inSync = true;
+HXLINE( 688) this->trigger(HX_("status/online",10,05,0e,d2), ::Dynamic(::hx::Anon_obj::Create(0)));
+HXLINE( 689) return ::snikket::EventResult_obj::EventHandled_dyn();
+ }
+HXLINE( 693) this->discoverServices( ::snikket::JID_obj::__alloc( HX_CTX ,null(),this->jid->domain,null()),null(), ::Dynamic(new _hx_Closure_0(_gthis)));
+HXLINE( 696) this->rosterGet();
+HXLINE( 697) ::haxe::Log_obj::trace(HX_("SYNC: bookmarks",1c,91,b3,0d),::hx::SourceInfo(HX_("snikket/Client.hx",e1,49,02,18),697,HX_("snikket.Client",3c,fe,06,7c),HX_("onConnected",aa,c5,39,c5)));
+HXLINE( 698) this->bookmarksGet( ::Dynamic(new _hx_Closure_3(_gthis)));
+HXLINE( 740) this->trigger(HX_("session-started",0a,96,19,bc), ::Dynamic(::hx::Anon_obj::Create(0)));
+HXLINE( 742) return ::snikket::EventResult_obj::EventHandled_dyn();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,onConnected,return )
+
+void Client_obj::prepareAttachment( ::snikket::AttachmentSource source, ::Dynamic callback){
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_2, ::snikket::Client,_gthis, ::snikket::AttachmentSource,source, ::Dynamic,callback) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> services){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_749_prepareAttachment)
+HXLINE( 750) ::sha::SHA256 sha256 = ::sha::SHA256_obj::__alloc( HX_CTX );
+HXLINE( 751) {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::sha::SHA256,sha256) HXARGC(1)
+ ::tink::streams::Handled _hx_run(::Dynamic chunk){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_751_prepareAttachment)
+HXLINE( 752) ::sha::SHA256 sha2561 = sha256;
+HXDLIN( 752) sha2561->update(::tink::chunk::ChunkObject_obj::toBytes(chunk));
+HXLINE( 753) return ::tink::streams::Handled_obj::Resume_dyn();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S5(::hx::LocalFunc,_hx_Closure_1, ::snikket::AttachmentSource,source, ::snikket::Client,_gthis,::Array< ::Dynamic>,services, ::sha::SHA256,sha256, ::Dynamic,callback) HXARGC(1)
+ void _hx_run( ::tink::streams::Conclusion o){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_754_prepareAttachment)
+HXLINE( 754) if ((o->_hx_getIndex() == 3)) {
+HXLINE( 756) ::snikket::Client _gthis1 = _gthis;
+HXDLIN( 756) ::snikket::AttachmentSource source1 = source;
+HXDLIN( 756) ::Array< ::Dynamic> services1 = services;
+HXDLIN( 756) ::Array< unsigned char > _hx_tmp = sha256->digest()->b;
+HXDLIN( 756) _gthis1->prepareAttachmentFor(source1,services1,::Array_obj< ::Dynamic>::__new(1)->init(0, ::snikket::Hash_obj::__alloc( HX_CTX ,HX_("sha-256",32,dd,04,3b),_hx_tmp)),callback);
+ }
+ else {
+HXLINE( 758) ::haxe::Log_obj::trace(HX_("Error computing attachment hash",07,33,1d,57), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.Client",3c,fe,06,7c))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,o))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("prepareAttachment",4a,6c,4b,52))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/Client.hx",e1,49,02,18))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),758)));
+HXLINE( 759) callback(null());
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE( 751) ::String name = source->name;
+HXDLIN( 751) ::haxe::io::Input input = ::sys::io::File_obj::read(source->path,null());
+HXDLIN( 751) ::Dynamic options = null();
+HXDLIN( 751) if (::hx::IsNull( options )) {
+HXLINE( 751) options = ::Dynamic(::hx::Anon_obj::Create(0));
+ }
+HXDLIN( 751) ::Dynamic this1 = ::tink::io::_Worker::Worker_Impl__obj::ensure( ::Dynamic(options->__Field(HX_("worker",7e,30,9e,c9),::hx::paccDynamic)));
+HXDLIN( 751) ::Dynamic _g = options->__Field(HX_("chunkSize",ce,cd,77,9f),::hx::paccDynamic);
+HXDLIN( 751) int this2;
+HXDLIN( 751) if (::hx::IsNull( _g )) {
+HXLINE( 751) this2 = 65536;
+ }
+ else {
+HXLINE( 751) ::Dynamic v = _g;
+HXDLIN( 751) this2 = ( (int)(v) );
+ }
+HXDLIN( 751) ::Dynamic this3 = ::tink::io::_Source::Source_Impl__obj::chunked( ::tink::io::std::InputSource_obj::__alloc( HX_CTX ,name,input,this1,::haxe::io::Bytes_obj::alloc(this2),0));
+HXDLIN( 751) ::tink::streams::StreamObject_obj::forEach(this3,::tink::streams::_Stream::Handler_Impl__obj::ofSafeSync( ::Dynamic(new _hx_Closure_0(sha256))))->handle( ::Dynamic(new _hx_Closure_1(source,_gthis,services,sha256,callback)));
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_748_prepareAttachment)
+HXDLIN( 748) ::snikket::Client _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 749) ::Dynamic _hx_tmp = this->persistence;
+HXDLIN( 749) ::snikket::Persistence_obj::findServicesWithFeature(_hx_tmp,this->accountId(),HX_("urn:xmpp:http:upload:0",0d,db,46,68), ::Dynamic(new _hx_Closure_2(_gthis,source,callback)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Client_obj,prepareAttachment,(void))
+
+void Client_obj::prepareAttachment__fromC( ::snikket::AttachmentSource source,::cpp::Function< void (void*,void*) > callback,void* callback__context){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0,void*,callback__context,::cpp::Function< void (void* HX_COMMA void*) >,callback) HXARGC(1)
+ void _hx_run( ::snikket::ChatAttachment a0){
+ HX_GC_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_221_prepareAttachment__fromC)
+HXLINE( 221) ::cpp::Function< void (void*,void*) > callback1 = callback;
+HXLINE( 215) ::Dynamic haxeObject = a0;
+HXDLIN( 215) void* ptr = haxeObject.mPtr;
+HXDLIN( 215) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(ptr);
+HXDLIN( 215) {
+HXLINE( 215) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 215) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 215) int high = ptrInt64 >> 32;
+HXDLIN( 215) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 215) if (::hx::IsNull( highMap )) {
+HXLINE( 215) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 215) this1->set(low,highMap);
+ }
+HXDLIN( 215) highMap->set(high,haxeObject);
+ }
+HXLINE( 221) callback1(ptr,callback__context);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_244_prepareAttachment__fromC)
+HXDLIN( 244) this->prepareAttachment(source, ::Dynamic(new _hx_Closure_0(callback__context,callback)));
+ }
+
+
+void Client_obj::prepareAttachmentFor( ::snikket::AttachmentSource source,::Array< ::Dynamic> services,::Array< ::Dynamic> hashes, ::Dynamic callback){
+ HX_BEGIN_LOCAL_FUNC_S6(::hx::LocalFunc,_hx_Closure_2, ::snikket::AttachmentSource,source, ::snikket::Client,_gthis,::Array< ::Dynamic>,hashes,::Array< ::Dynamic>,services, ::snikket::queries::HttpUploadSlot,httpUploadSlot, ::Dynamic,callback) HXARGC(0)
+ void _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_771_prepareAttachmentFor)
+HXLINE( 772) ::Dynamic slot = httpUploadSlot->getResult();
+HXLINE( 773) if (::hx::IsNull( slot )) {
+HXLINE( 774) ::snikket::Client _gthis1 = _gthis;
+HXDLIN( 774) ::snikket::AttachmentSource source1 = source;
+HXDLIN( 774) ::Array< ::Dynamic> _hx_tmp = services->slice(1,null());
+HXDLIN( 774) _gthis1->prepareAttachmentFor(source1,_hx_tmp,hashes,callback);
+ }
+ else {
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ ::Dynamic _hx_run( ::tink::core::TypedError e){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_776_prepareAttachmentFor)
+HXLINE( 776) ::haxe::Log_obj::trace(HX_("WUT",76,4e,42,00), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.Client",3c,fe,06,7c))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,e))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("prepareAttachmentFor",df,5c,bf,82))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/Client.hx",e1,49,02,18))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),776)));
+HXDLIN( 776) HX_STACK_DO_THROW(e);
+HXDLIN( 776) return null();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S6(::hx::LocalFunc,_hx_Closure_1, ::snikket::Client,_gthis, ::Dynamic,slot, ::snikket::AttachmentSource,source,::Array< ::Dynamic>,hashes,::Array< ::Dynamic>,services, ::Dynamic,callback) HXARGC(1)
+ void _hx_run( ::tink::core::Outcome o){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_777_prepareAttachmentFor)
+HXLINE( 777) if ((o->_hx_getIndex() == 0)) {
+HXLINE( 780) ::tink::http::Message _g = ( ( ::tink::http::Message)(o->_hx_getObject(0)) );
+HXLINE( 778) {
+HXLINE( 778) ::tink::http::Message res = _g;
+HXDLIN( 778) if ((( ( ::tink::http::ResponseHeaderBase)(res->header) )->statusCode == 201)) {
+HXLINE( 779) ::Dynamic callback1 = callback;
+HXDLIN( 779) callback1( ::snikket::ChatAttachment_obj::__alloc( HX_CTX ,source->name,source->type,source->size,::Array_obj< ::String >::__new(1)->init(0, ::Dynamic(slot->__Field(HX_("get",96,80,4e,00),::hx::paccDynamic))),hashes));
+ }
+ else {
+HXLINE( 780) ::tink::http::Message res1 = _g;
+HXDLIN( 780) {
+HXLINE( 781) ::haxe::Log_obj::trace(HX_("HTTP upload result",84,16,6f,47), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.Client",3c,fe,06,7c))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,res1->header))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("prepareAttachmentFor",df,5c,bf,82))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/Client.hx",e1,49,02,18))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),781)));
+HXLINE( 782) ::snikket::Client _gthis1 = _gthis;
+HXDLIN( 782) ::snikket::AttachmentSource source1 = source;
+HXDLIN( 782) ::Array< ::Dynamic> _hx_tmp = services->slice(1,null());
+HXDLIN( 782) _gthis1->prepareAttachmentFor(source1,_hx_tmp,hashes,callback);
+ }
+ }
+ }
+ }
+ else {
+HXLINE( 784) ::haxe::Log_obj::trace(HX_("HTTP upload result",84,16,6f,47), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.Client",3c,fe,06,7c))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,o))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("prepareAttachmentFor",df,5c,bf,82))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/Client.hx",e1,49,02,18))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),784)));
+HXLINE( 785) ::snikket::Client _gthis2 = _gthis;
+HXDLIN( 785) ::snikket::AttachmentSource source2 = source;
+HXDLIN( 785) ::Array< ::Dynamic> _hx_tmp1 = services->slice(1,null());
+HXDLIN( 785) _gthis2->prepareAttachmentFor(source2,_hx_tmp1,hashes,callback);
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE( 776) ::Dynamic url = ::tink::_Url::Url_Impl__obj::fromString(( (::String)(slot->__Field(HX_("put",cf,62,55,00),::hx::paccDynamic)) ));
+HXDLIN( 776) ::Array< ::Dynamic> slot1 = ( (::Array< ::Dynamic>)(slot->__Field(HX_("putHeaders",37,9f,1e,a4),::hx::paccDynamic)) );
+HXDLIN( 776) ::String this1 = HX_("Content-Length",fa,f8,b6,65).toLowerCase();
+HXDLIN( 776) ::Array< ::Dynamic> options = slot1->concat(::Array_obj< ::Dynamic>::__new(1)->init(0, ::tink::http::HeaderField_obj::__alloc( HX_CTX ,this1,::tink::http::_Header::HeaderValue_Impl__obj::ofInt(source->size))));
+HXDLIN( 776) ::String name = source->name;
+HXDLIN( 776) ::haxe::io::Input input = ::sys::io::File_obj::read(source->path,null());
+HXDLIN( 776) ::Dynamic options1 = null();
+HXDLIN( 776) if (::hx::IsNull( options1 )) {
+HXLINE( 776) options1 = ::Dynamic(::hx::Anon_obj::Create(0));
+ }
+HXDLIN( 776) ::Dynamic options2 = ::tink::io::_Worker::Worker_Impl__obj::ensure( ::Dynamic(options1->__Field(HX_("worker",7e,30,9e,c9),::hx::paccDynamic)));
+HXDLIN( 776) ::Dynamic _g = options1->__Field(HX_("chunkSize",ce,cd,77,9f),::hx::paccDynamic);
+HXDLIN( 776) int options3;
+HXDLIN( 776) if (::hx::IsNull( _g )) {
+HXLINE( 776) options3 = 65536;
+ }
+ else {
+HXLINE( 776) ::Dynamic v = _g;
+HXDLIN( 776) options3 = ( (int)(v) );
+ }
+HXDLIN( 776) ::tink::http::_Fetch::FetchResponse_Impl__obj::all(::tink::http::Fetch_obj::fetch(url, ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("method",e1,f6,5a,09),HX_("PUT",af,fe,3c,00))
+ ->setFixed(1,HX_("body",a2,7a,1b,41),::tink::io::RealSourceTools_obj::idealize( ::tink::io::std::InputSource_obj::__alloc( HX_CTX ,name,input,options2,::haxe::io::Bytes_obj::alloc(options3),0), ::Dynamic(new _hx_Closure_0())))
+ ->setFixed(2,HX_("headers",46,52,08,63),options))))->handle( ::Dynamic(new _hx_Closure_1(_gthis,slot,source,hashes,services,callback)));
+ }
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_764_prepareAttachmentFor)
+HXDLIN( 764) ::snikket::Client _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 765) if ((services->length < 1)) {
+HXLINE( 766) ::haxe::Log_obj::trace(HX_("No HTTP upload service found",d1,5a,61,46),::hx::SourceInfo(HX_("snikket/Client.hx",e1,49,02,18),766,HX_("snikket.Client",3c,fe,06,7c),HX_("prepareAttachmentFor",df,5c,bf,82)));
+HXLINE( 767) callback(null());
+HXLINE( 768) return;
+ }
+HXLINE( 770) ::snikket::queries::HttpUploadSlot httpUploadSlot = ::snikket::queries::HttpUploadSlot_obj::__alloc( HX_CTX ,( (::String)(services->__get(0)->__Field(HX_("serviceId",70,93,d4,bc),::hx::paccDynamic)) ),source->name,source->size,source->type,hashes);
+HXLINE( 771) httpUploadSlot->onFinished( ::Dynamic(new _hx_Closure_2(source,_gthis,hashes,services,httpUploadSlot,callback)));
+HXLINE( 789) this->sendQuery(httpUploadSlot);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC4(Client_obj,prepareAttachmentFor,(void))
+
+::Array< ::Dynamic> Client_obj::getChats(){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_796_getChats)
+HXDLIN( 796) ::Array< ::Dynamic> _g = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 796) {
+HXDLIN( 796) int _g1 = 0;
+HXDLIN( 796) ::Array< ::Dynamic> _g2 = this->chats;
+HXDLIN( 796) while((_g1 < _g2->length)){
+HXDLIN( 796) ::snikket::Chat v = _g2->__get(_g1).StaticCast< ::snikket::Chat >();
+HXDLIN( 796) _g1 = (_g1 + 1);
+HXDLIN( 796) if ((v->uiState != 2)) {
+HXDLIN( 796) _g->push(v);
+ }
+ }
+ }
+HXDLIN( 796) return _g;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Client_obj,getChats,return )
+
+size_t Client_obj::getChats__fromC(void*** outPtr){
+ HX_GC_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_242_getChats__fromC)
+HXDLIN( 242) ::Array< ::Dynamic> out = this->getChats();
+HXDLIN( 242) if (::hx::IsNotNull( outPtr )) {
+HXDLIN( 242) ::cpp::Pointer< void** > _hx_tmp = ::cpp::Pointer_obj::fromRaw(outPtr);
+HXDLIN( 242) {
+HXDLIN( 242) int _g = 0;
+HXDLIN( 242) while((_g < out->length)){
+HXDLIN( 242) ::snikket::Chat el = out->__get(_g).StaticCast< ::snikket::Chat >();
+HXDLIN( 242) _g = (_g + 1);
+HXDLIN( 242) {
+HXDLIN( 242) ::Dynamic haxeObject = el;
+HXDLIN( 242) void* ptr = haxeObject.mPtr;
+HXDLIN( 242) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(ptr);
+HXDLIN( 242) {
+HXDLIN( 242) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 242) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 242) int high = ptrInt64 >> 32;
+HXDLIN( 242) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 242) if (::hx::IsNull( highMap )) {
+HXDLIN( 242) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 242) this1->set(low,highMap);
+ }
+HXDLIN( 242) highMap->set(high,haxeObject);
+ }
+ }
+ }
+ }
+HXDLIN( 242) void** ptr1 = (void**)out->getBase();
+HXDLIN( 242) ::cpp::Int64 ptrInt641 = reinterpret_cast<int64_t>(ptr1);
+HXDLIN( 242) {
+HXDLIN( 242) ::haxe::ds::IntMap this2 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 242) int low1 = ptrInt641 & 0xffffffff;
+HXDLIN( 242) int high1 = ptrInt641 >> 32;
+HXDLIN( 242) ::haxe::ds::IntMap highMap1 = ( ( ::haxe::ds::IntMap)(this2->get(low1)) );
+HXDLIN( 242) if (::hx::IsNull( highMap1 )) {
+HXDLIN( 242) highMap1 = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 242) this2->set(low1,highMap1);
+ }
+HXDLIN( 242) highMap1->set(high1,out);
+ }
+HXDLIN( 242) _hx_tmp->set_ref(ptr1);
+ }
+HXDLIN( 242) return ( (size_t)(out->length) );
+ }
+
+
+void Client_obj::findAvailableChats(::String q, ::Dynamic callback){
+ HX_BEGIN_LOCAL_FUNC_S5(::hx::LocalFunc,_hx_Closure_2, ::snikket::Client,_gthis,::String,q,::Array< ::Dynamic>,results,::String,query, ::Dynamic,callback) HXARGC(2)
+ void _hx_run( ::Dynamic jid, ::Dynamic __o_prepend){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0,::Array< ::Dynamic>,results,bool,prepend) HXARGC(1)
+ void _hx_run( ::snikket::AvailableChat item){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_809_findAvailableChats)
+HXLINE( 809) if (prepend) {
+HXLINE( 809) results->unshift(item);
+ }
+ else {
+HXLINE( 809) results->push(item);
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_BEGIN_LOCAL_FUNC_S8(::hx::LocalFunc,_hx_Closure_1,::String,q, ::snikket::Client,_gthis,::Array< ::Dynamic>,results, ::Dynamic,add,::String,query, ::snikket::queries::DiscoInfoGet,discoGet, ::Dynamic,callback, ::Dynamic,jid) HXARGC(0)
+ void _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_811_findAvailableChats)
+HXLINE( 812) ::snikket::Caps resultCaps = discoGet->getResult();
+HXLINE( 813) if (::hx::IsNull( resultCaps )) {
+HXLINE( 814) ::snikket::Stanza tmp = discoGet->responseStanza;
+HXDLIN( 814) ::snikket::Stanza tmp1;
+HXDLIN( 814) if (::hx::IsNotNull( tmp )) {
+HXLINE( 814) tmp1 = tmp->getChild(HX_("error",c8,cb,29,73),null());
+ }
+ else {
+HXLINE( 814) tmp1 = null();
+ }
+HXDLIN( 814) ::snikket::Stanza err;
+HXDLIN( 814) if (::hx::IsNotNull( tmp1 )) {
+HXLINE( 814) err = tmp1->getChild(null(),HX_("urn:ietf:params:xml:ns:xmpp-stanzas",27,f2,3d,30));
+ }
+ else {
+HXLINE( 814) err = null();
+ }
+HXLINE( 815) bool checkAndAdd;
+HXDLIN( 815) bool checkAndAdd1;
+HXDLIN( 815) if (::hx::IsNotNull( err )) {
+HXLINE( 815) ::String checkAndAdd2;
+HXDLIN( 815) if (::hx::IsNotNull( err )) {
+HXLINE( 815) checkAndAdd2 = err->name;
+ }
+ else {
+HXLINE( 815) checkAndAdd2 = null();
+ }
+HXDLIN( 815) checkAndAdd1 = (checkAndAdd2 == HX_("service-unavailable",f8,3c,11,1c));
+ }
+ else {
+HXLINE( 815) checkAndAdd1 = true;
+ }
+HXDLIN( 815) if (!(checkAndAdd1)) {
+HXLINE( 815) ::String checkAndAdd3;
+HXDLIN( 815) if (::hx::IsNotNull( err )) {
+HXLINE( 815) checkAndAdd3 = err->name;
+ }
+ else {
+HXLINE( 815) checkAndAdd3 = null();
+ }
+HXDLIN( 815) checkAndAdd = (checkAndAdd3 == HX_("feature-not-implemented",71,20,2e,96));
+ }
+ else {
+HXLINE( 815) checkAndAdd = true;
+ }
+HXDLIN( 815) if (checkAndAdd) {
+HXLINE( 816) ::Dynamic add1 = add;
+HXDLIN( 816) ::String checkAndAdd4 = ( (::String)(jid->__Field(HX_("asString",63,33,06,a0),::hx::paccDynamic)()) );
+HXDLIN( 816) ::String query1 = query;
+HXDLIN( 816) ::String checkAndAdd5 = ( (::String)(jid->__Field(HX_("asString",63,33,06,a0),::hx::paccDynamic)()) );
+HXDLIN( 816) add1( ::snikket::AvailableChat_obj::__alloc( HX_CTX ,checkAndAdd4,query1,checkAndAdd5, ::snikket::Caps_obj::__alloc( HX_CTX ,HX_("",00,00,00,00),::Array_obj< ::Dynamic>::__new(0),::Array_obj< ::String >::__new(0))));
+ }
+ }
+ else {
+HXLINE( 819) ::snikket::Persistence_obj::storeCaps(_gthis->persistence,resultCaps);
+HXLINE( 820) ::snikket::Identity identity = resultCaps->identities->__get(0).StaticCast< ::snikket::Identity >();
+HXLINE( 821) ::String displayName;
+HXDLIN( 821) ::String tmp2;
+HXDLIN( 821) if (::hx::IsNotNull( identity )) {
+HXLINE( 821) tmp2 = identity->name;
+ }
+ else {
+HXLINE( 821) tmp2 = null();
+ }
+HXDLIN( 821) if (::hx::IsNotNull( tmp2 )) {
+HXLINE( 821) displayName = tmp2;
+ }
+ else {
+HXLINE( 821) displayName = query;
+ }
+HXLINE( 822) ::String note = ( (::String)(jid->__Field(HX_("asString",63,33,06,a0),::hx::paccDynamic)()) );
+HXDLIN( 822) ::String note1;
+HXDLIN( 822) if (::hx::IsNull( identity )) {
+HXLINE( 822) note1 = HX_("",00,00,00,00);
+ }
+ else {
+HXLINE( 822) note1 = ((HX_(" (",08,1c,00,00) + identity->type) + HX_(")",29,00,00,00));
+ }
+HXDLIN( 822) ::String note2 = (note + note1);
+HXLINE( 823) ::Dynamic add2 = add;
+HXDLIN( 823) add2( ::snikket::AvailableChat_obj::__alloc( HX_CTX ,( (::String)(jid->__Field(HX_("asString",63,33,06,a0),::hx::paccDynamic)()) ),displayName,note2,resultCaps));
+ }
+HXLINE( 825) callback(q,results);
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ bool prepend = __o_prepend.Default(false);
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_808_findAvailableChats)
+HXLINE( 809) ::Dynamic add = ::Dynamic(new _hx_Closure_0(results,prepend));
+HXLINE( 810) ::snikket::queries::DiscoInfoGet discoGet = ::snikket::queries::DiscoInfoGet_obj::__alloc( HX_CTX ,( (::String)(jid->__Field(HX_("asString",63,33,06,a0),::hx::paccDynamic)()) ),null());
+HXLINE( 811) discoGet->onFinished( ::Dynamic(new _hx_Closure_1(q,_gthis,results,add,query,discoGet,callback,jid)));
+HXLINE( 827) _gthis->sendQuery(discoGet);
+ }
+ HX_END_LOCAL_FUNC2((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_805_findAvailableChats)
+HXDLIN( 805) ::snikket::Client _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 806) ::Array< ::Dynamic> results = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 807) ::String query = ::StringTools_obj::trim(q);
+HXLINE( 808) ::Dynamic checkAndAdd = ::Dynamic(new _hx_Closure_2(_gthis,q,results,query,callback));
+HXLINE( 829) ::snikket::JID jid;
+HXDLIN( 829) if (::StringTools_obj::startsWith(query,HX_("xmpp:",65,3c,77,60))) {
+HXLINE( 829) jid = ::snikket::JID_obj::parse(query.substr(5,null()));
+ }
+ else {
+HXLINE( 829) jid = ::snikket::JID_obj::parse(query);
+ }
+HXLINE( 834) if (jid->isValid()) {
+HXLINE( 835) checkAndAdd(jid,true);
+ }
+HXLINE( 837) {
+HXLINE( 837) int _g = 0;
+HXDLIN( 837) ::Array< ::Dynamic> _g1 = this->chats;
+HXDLIN( 837) while((_g < _g1->length)){
+HXLINE( 837) ::snikket::Chat chat = _g1->__get(_g).StaticCast< ::snikket::Chat >();
+HXDLIN( 837) _g = (_g + 1);
+HXLINE( 838) ::String chat1 = chat->chatId;
+HXDLIN( 838) if ((chat1 != jid->asBare()->asString())) {
+HXLINE( 839) bool _hx_tmp;
+HXDLIN( 839) ::String s = chat->chatId;
+HXDLIN( 839) if ((s.indexOf(query.toLowerCase(),null()) == -1)) {
+HXLINE( 839) ::String s1 = chat->getDisplayName().toLowerCase();
+HXDLIN( 839) _hx_tmp = (s1.indexOf(query.toLowerCase(),null()) != -1);
+ }
+ else {
+HXLINE( 839) _hx_tmp = true;
+ }
+HXDLIN( 839) if (_hx_tmp) {
+HXLINE( 840) ::snikket::Channel channel = ( ( ::snikket::Channel)(::snikket::_Util::Util_Fields__obj::downcast(chat,::hx::ClassOf< ::snikket::Channel >())) );
+HXLINE( 841) ::Array< ::Dynamic> results1 = results;
+HXDLIN( 841) ::String chat2 = chat->chatId;
+HXDLIN( 841) ::String _hx_tmp1 = chat->getDisplayName();
+HXDLIN( 841) ::String chat3 = chat->chatId;
+HXDLIN( 841) ::snikket::Caps _hx_tmp2;
+HXDLIN( 841) bool _hx_tmp3;
+HXDLIN( 841) if (::hx::IsNotNull( channel )) {
+HXLINE( 841) _hx_tmp3 = ::hx::IsNull( channel->disco );
+ }
+ else {
+HXLINE( 841) _hx_tmp3 = true;
+ }
+HXDLIN( 841) if (_hx_tmp3) {
+HXLINE( 841) _hx_tmp2 = ::snikket::Caps_obj::__alloc( HX_CTX ,HX_("",00,00,00,00),::Array_obj< ::Dynamic>::__new(0),::Array_obj< ::String >::__new(0));
+ }
+ else {
+HXLINE( 841) _hx_tmp2 = channel->disco;
+ }
+HXDLIN( 841) results1->push( ::snikket::AvailableChat_obj::__alloc( HX_CTX ,chat2,_hx_tmp1,chat3,_hx_tmp2));
+ }
+ }
+HXLINE( 844) if (chat->isTrusted()) {
+HXLINE( 845) ::haxe::ds::StringMap resources = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXLINE( 846) {
+HXLINE( 846) int _g2 = 0;
+HXDLIN( 846) ::Array< ::String > _g3 = ::snikket::Caps_obj::withIdentity(chat->getCaps(),HX_("gateway",04,40,59,91),null());
+HXDLIN( 846) while((_g2 < _g3->length)){
+HXLINE( 846) ::String resource = _g3->__get(_g2);
+HXDLIN( 846) _g2 = (_g2 + 1);
+HXLINE( 847) resources->set(resource,true);
+ }
+ }
+HXLINE( 849) {
+HXLINE( 849) int _g4 = 0;
+HXDLIN( 849) ::Array< ::String > _g5 = ::snikket::Caps_obj::withFeature(chat->getCaps(),HX_("jabber:iq:gateway",c8,db,57,c1));
+HXDLIN( 849) while((_g4 < _g5->length)){
+HXLINE( 849) ::String resource1 = _g5->__get(_g4);
+HXDLIN( 849) _g4 = (_g4 + 1);
+HXLINE( 850) resources->set(resource1,true);
+ }
+ }
+HXLINE( 852) bool _hx_tmp4;
+HXDLIN( 852) if (!(this->sendAvailable)) {
+HXLINE( 852) _hx_tmp4 = ::snikket::JID_obj::parse(chat->chatId)->isDomain();
+ }
+ else {
+HXLINE( 852) _hx_tmp4 = false;
+ }
+HXDLIN( 852) if (_hx_tmp4) {
+HXLINE( 853) ::String k = null();
+HXDLIN( 853) resources->set(k,true);
+ }
+HXLINE( 855) {
+HXLINE( 855) ::Dynamic resource2 = resources->keys();
+HXDLIN( 855) while(( (bool)(resource2->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+ HX_BEGIN_LOCAL_FUNC_S6(::hx::LocalFunc,_hx_Closure_3, ::snikket::queries::JabberIqGatewayGet,jigGet1,::String,resource3,::String,query, ::snikket::JID,bareJid, ::snikket::Chat,chat, ::Dynamic,checkAndAdd) HXARGC(0)
+ void _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_860_findAvailableChats)
+HXLINE( 860) if (::hx::IsNull( jigGet1->getResult() )) {
+HXLINE( 861) ::snikket::Caps caps = chat->getResourceCaps(resource3);
+HXLINE( 862) bool _hx_tmp;
+HXDLIN( 862) if (bareJid->isDomain()) {
+HXLINE( 862) _hx_tmp = caps->features->contains(HX_("jid\\20escaping",73,c5,d2,4a));
+ }
+ else {
+HXLINE( 862) _hx_tmp = false;
+ }
+HXDLIN( 862) if (_hx_tmp) {
+HXLINE( 863) ::Dynamic checkAndAdd1 = checkAndAdd;
+HXDLIN( 863) checkAndAdd1( ::snikket::JID_obj::__alloc( HX_CTX ,query,bareJid->domain,null()),null());
+ }
+ else {
+HXLINE( 864) if (bareJid->isDomain()) {
+HXLINE( 865) ::Dynamic checkAndAdd2 = checkAndAdd;
+HXDLIN( 865) ::String _hx_tmp1 = ::StringTools_obj::replace(query,HX_("@",40,00,00,00),HX_("%",25,00,00,00));
+HXDLIN( 865) checkAndAdd2( ::snikket::JID_obj::__alloc( HX_CTX ,_hx_tmp1,bareJid->domain,null()),null());
+ }
+ }
+ }
+ else {
+HXLINE( 868) ::haxe::ds::Either _g = jigGet1->getResult();
+HXDLIN( 868) switch((int)(_g->_hx_getIndex())){
+ case (int)0: {
+HXLINE( 869) ::String error = ( (::String)(_g->_hx_getObject(0)) );
+HXDLIN( 869) return;
+ }
+ break;
+ case (int)1: {
+HXLINE( 870) ::String result = ( (::String)(_g->_hx_getObject(0)) );
+HXLINE( 871) ::Dynamic checkAndAdd3 = checkAndAdd;
+HXDLIN( 871) checkAndAdd3(::snikket::JID_obj::parse(result),null());
+ }
+ break;
+ }
+ }
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+HXLINE( 855) ::String resource3 = ( (::String)(resource2->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXLINE( 856) ::snikket::JID bareJid = ::snikket::JID_obj::parse(chat->chatId);
+HXLINE( 857) ::snikket::JID fullJid = ::snikket::JID_obj::__alloc( HX_CTX ,bareJid->node,bareJid->domain,resource3);
+HXLINE( 858) ::String jigGet = fullJid->asString();
+HXDLIN( 858) ::snikket::queries::JabberIqGatewayGet jigGet1 = ::snikket::queries::JabberIqGatewayGet_obj::__alloc( HX_CTX ,jigGet,query);
+HXLINE( 859) jigGet1->onFinished( ::Dynamic(new _hx_Closure_3(jigGet1,resource3,query,bareJid,chat,checkAndAdd)));
+HXLINE( 875) this->sendQuery(jigGet1);
+ }
+ }
+ }
+ }
+ }
+HXLINE( 879) bool _hx_tmp5;
+HXDLIN( 879) if (!(jid->isValid())) {
+HXLINE( 879) _hx_tmp5 = (results->length > 0);
+ }
+ else {
+HXLINE( 879) _hx_tmp5 = false;
+ }
+HXDLIN( 879) if (_hx_tmp5) {
+HXLINE( 880) callback(q,results);
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Client_obj,findAvailableChats,(void))
+
+void Client_obj::findAvailableChats__fromC(::String q,::cpp::Function< void (const char*,void**,size_t,void*) > callback,void* callback__context){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0,void*,callback__context,::cpp::Function< void (const char* HX_COMMA void** HX_COMMA size_t HX_COMMA void*) >,callback) HXARGC(2)
+ void _hx_run(::String a0,::Array< ::Dynamic> a1){
+ HX_GC_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_221_findAvailableChats__fromC)
+HXLINE( 221) ::cpp::Function< void (const char*,void**,size_t,void*) > callback1 = callback;
+HXLINE( 213) const char* cStrPtr = a0.utf8_str();
+HXDLIN( 213) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(cStrPtr);
+HXDLIN( 213) {
+HXLINE( 213) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 213) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 213) int high = ptrInt64 >> 32;
+HXDLIN( 213) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 213) if (::hx::IsNull( highMap )) {
+HXLINE( 213) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 213) this1->set(low,highMap);
+ }
+HXDLIN( 213) highMap->set(high,a0);
+ }
+HXDLIN( 213) const char* _hx_tmp = cStrPtr;
+HXLINE( 211) {
+HXLINE( 211) int _g = 0;
+HXDLIN( 211) while((_g < a1->length)){
+HXLINE( 211) ::snikket::AvailableChat el = a1->__get(_g).StaticCast< ::snikket::AvailableChat >();
+HXDLIN( 211) _g = (_g + 1);
+HXDLIN( 211) {
+HXLINE( 211) ::Dynamic haxeObject = el;
+HXDLIN( 211) void* ptr = haxeObject.mPtr;
+HXDLIN( 211) ::cpp::Int64 ptrInt641 = reinterpret_cast<int64_t>(ptr);
+HXDLIN( 211) {
+HXLINE( 211) ::haxe::ds::IntMap this2 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 211) int low1 = ptrInt641 & 0xffffffff;
+HXDLIN( 211) int high1 = ptrInt641 >> 32;
+HXDLIN( 211) ::haxe::ds::IntMap highMap1 = ( ( ::haxe::ds::IntMap)(this2->get(low1)) );
+HXDLIN( 211) if (::hx::IsNull( highMap1 )) {
+HXLINE( 211) highMap1 = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 211) this2->set(low1,highMap1);
+ }
+HXDLIN( 211) highMap1->set(high1,haxeObject);
+ }
+ }
+ }
+ }
+HXDLIN( 211) void** ptr1 = (void**)a1->getBase();
+HXDLIN( 211) ::cpp::Int64 ptrInt642 = reinterpret_cast<int64_t>(ptr1);
+HXDLIN( 211) {
+HXLINE( 211) ::haxe::ds::IntMap this3 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 211) int low2 = ptrInt642 & 0xffffffff;
+HXDLIN( 211) int high2 = ptrInt642 >> 32;
+HXDLIN( 211) ::haxe::ds::IntMap highMap2 = ( ( ::haxe::ds::IntMap)(this3->get(low2)) );
+HXDLIN( 211) if (::hx::IsNull( highMap2 )) {
+HXLINE( 211) highMap2 = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 211) this3->set(low2,highMap2);
+ }
+HXDLIN( 211) highMap2->set(high2,a1);
+ }
+HXLINE( 221) callback1(_hx_tmp,ptr1,( (size_t)(a1->length) ),callback__context);
+ }
+ HX_END_LOCAL_FUNC2((void))
+
+ HX_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_244_findAvailableChats__fromC)
+HXDLIN( 244) this->findAvailableChats(q, ::Dynamic(new _hx_Closure_0(callback__context,callback)));
+ }
+
+
+ ::snikket::Chat Client_obj::startChat( ::snikket::AvailableChat availableChat){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_889_startChat)
+HXLINE( 890) ::snikket::Chat existingChat = this->getChat(availableChat->chatId);
+HXLINE( 891) if (::hx::IsNotNull( existingChat )) {
+HXLINE( 892) ::snikket::Channel channel = ( ( ::snikket::Channel)(::Std_obj::downcast(existingChat,::hx::ClassOf< ::snikket::Channel >())) );
+HXLINE( 893) bool _hx_tmp;
+HXDLIN( 893) bool _hx_tmp1;
+HXDLIN( 893) if (::hx::IsNull( channel )) {
+HXLINE( 893) _hx_tmp1 = availableChat->isChannel();
+ }
+ else {
+HXLINE( 893) _hx_tmp1 = false;
+ }
+HXDLIN( 893) if (!(_hx_tmp1)) {
+HXLINE( 893) if (::hx::IsNotNull( channel )) {
+HXLINE( 893) _hx_tmp = !(availableChat->isChannel());
+ }
+ else {
+HXLINE( 893) _hx_tmp = false;
+ }
+ }
+ else {
+HXLINE( 893) _hx_tmp = true;
+ }
+HXDLIN( 893) if (_hx_tmp) {
+HXLINE( 894) ::Array< ::Dynamic> _g = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 894) {
+HXLINE( 894) int _g1 = 0;
+HXDLIN( 894) ::Array< ::Dynamic> _g2 = this->chats;
+HXDLIN( 894) while((_g1 < _g2->length)){
+HXLINE( 894) ::snikket::Chat v = _g2->__get(_g1).StaticCast< ::snikket::Chat >();
+HXDLIN( 894) _g1 = (_g1 + 1);
+HXDLIN( 894) if ((v->chatId != availableChat->chatId)) {
+HXLINE( 894) _g->push(v);
+ }
+ }
+ }
+HXDLIN( 894) this->chats = _g;
+ }
+ else {
+HXLINE( 896) if ((existingChat->uiState == 2)) {
+HXLINE( 896) existingChat->uiState = 1;
+ }
+HXLINE( 897) if (::hx::IsNotNull( channel )) {
+HXLINE( 897) channel->selfPing(true);
+ }
+HXLINE( 898) ::Dynamic _hx_tmp2 = this->persistence;
+HXDLIN( 898) ::snikket::Persistence_obj::storeChats(_hx_tmp2,this->accountId(),::Array_obj< ::Dynamic>::__new(1)->init(0,existingChat));
+HXLINE( 899) this->trigger(HX_("chats/update",3d,8e,1d,14),::cpp::VirtualArray_obj::__new(1)->init(0,existingChat));
+HXLINE( 900) return existingChat;
+ }
+ }
+HXLINE( 904) ::snikket::Chat chat;
+HXDLIN( 904) if (availableChat->isChannel()) {
+HXLINE( 905) ::snikket::Channel channel1 = ::snikket::Channel_obj::__alloc( HX_CTX ,::hx::ObjectPtr<OBJ_>(this),this->stream,this->persistence,availableChat->chatId,1,false,null(),null(),null(),availableChat->caps);
+HXLINE( 906) this->chats->unshift(channel1);
+HXLINE( 907) channel1->selfPing(false);
+HXLINE( 904) chat = channel1;
+ }
+ else {
+HXLINE( 904) chat = this->getDirectChat(availableChat->chatId,false);
+ }
+HXLINE( 912) ::Dynamic _hx_tmp3 = this->persistence;
+HXDLIN( 912) ::snikket::Persistence_obj::storeChats(_hx_tmp3,this->accountId(),::Array_obj< ::Dynamic>::__new(1)->init(0,chat));
+HXLINE( 913) this->trigger(HX_("chats/update",3d,8e,1d,14),::cpp::VirtualArray_obj::__new(1)->init(0,chat));
+HXLINE( 914) return chat;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,startChat,return )
+
+ ::snikket::Chat Client_obj::getChat(::String chatId){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0,::String,chatId) HXARGC(1)
+ bool _hx_run( ::snikket::Chat chat){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_923_getChat)
+HXDLIN( 923) return (chat->chatId == chatId);
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_923_getChat)
+HXDLIN( 923) return ( ( ::snikket::Chat)(::Lambda_obj::find(this->chats, ::Dynamic(new _hx_Closure_0(chatId)))) );
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,getChat,return )
+
+::Dynamic Client_obj::moderateMessage( ::snikket::ModerationAction action){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_1, ::snikket::Client,_gthis, ::snikket::ModerationAction,action) HXARGC(2)
+ void _hx_run( ::Dynamic resolve, ::Dynamic reject){
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_0, ::snikket::Client,_gthis, ::snikket::ModerationAction,action, ::Dynamic,resolve) HXARGC(1)
+ void _hx_run( ::snikket::ChatMessage moderateMessage){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_929_moderateMessage)
+HXLINE( 930) if (::hx::IsNull( moderateMessage )) {
+HXLINE( 930) resolve(null());
+HXDLIN( 930) return;
+ }
+HXLINE( 931) {
+HXLINE( 931) int _g = 0;
+HXDLIN( 931) ::Array< ::Dynamic> _g1 = moderateMessage->attachments;
+HXDLIN( 931) while((_g < _g1->length)){
+HXLINE( 931) ::snikket::ChatAttachment attachment = _g1->__get(_g).StaticCast< ::snikket::ChatAttachment >();
+HXDLIN( 931) _g = (_g + 1);
+HXLINE( 932) {
+HXLINE( 932) int _g2 = 0;
+HXDLIN( 932) ::Array< ::Dynamic> _g3 = attachment->hashes;
+HXDLIN( 932) while((_g2 < _g3->length)){
+HXLINE( 932) ::snikket::Hash hash = _g3->__get(_g2).StaticCast< ::snikket::Hash >();
+HXDLIN( 932) _g2 = (_g2 + 1);
+HXLINE( 933) ::snikket::Persistence_obj::removeMedia(_gthis->persistence,hash->algorithm,hash->hash);
+ }
+ }
+ }
+ }
+HXLINE( 936) moderateMessage = ::snikket::ChatMessageBuilder_obj::makeModerated(moderateMessage,action->timestamp,action->moderatorId,action->reason);
+HXLINE( 937) ::Dynamic _gthis1 = _gthis->persistence;
+HXDLIN( 937) ::snikket::Persistence_obj::updateMessage(_gthis1,_gthis->accountId(),moderateMessage);
+HXLINE( 938) resolve(moderateMessage);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_929_moderateMessage)
+HXLINE( 929) ::Dynamic _gthis1 = _gthis->persistence;
+HXDLIN( 929) ::String _hx_tmp = _gthis->accountId();
+HXDLIN( 929) ::snikket::Persistence_obj::getMessage(_gthis1,_hx_tmp,action->chatId,action->moderateServerId,null(), ::Dynamic(new _hx_Closure_0(_gthis,action,resolve)));
+ }
+ HX_END_LOCAL_FUNC2((void))
+
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_927_moderateMessage)
+HXDLIN( 927) ::snikket::Client _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 928) return ::thenshim::_Promise::Promise_Impl__obj::_new( ::Dynamic(new _hx_Closure_1(_gthis,action)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,moderateMessage,return )
+
+ ::snikket::DirectChat Client_obj::getDirectChat(::String chatId,::hx::Null< bool > __o_triggerIfNew){
+ bool triggerIfNew = __o_triggerIfNew.Default(true);
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_944_getDirectChat)
+HXLINE( 945) {
+HXLINE( 945) int _g = 0;
+HXDLIN( 945) ::Array< ::Dynamic> _g1 = this->chats;
+HXDLIN( 945) while((_g < _g1->length)){
+HXLINE( 945) ::snikket::Chat chat = _g1->__get(_g).StaticCast< ::snikket::Chat >();
+HXDLIN( 945) _g = (_g + 1);
+HXLINE( 946) bool _hx_tmp;
+HXDLIN( 946) if (::Std_obj::isOfType(chat,::hx::ClassOf< ::snikket::DirectChat >())) {
+HXLINE( 946) _hx_tmp = (chat->chatId == chatId);
+ }
+ else {
+HXLINE( 946) _hx_tmp = false;
+ }
+HXDLIN( 946) if (_hx_tmp) {
+HXLINE( 947) return ( ( ::snikket::DirectChat)(::Std_obj::downcast(chat,::hx::ClassOf< ::snikket::DirectChat >())) );
+ }
+ }
+ }
+HXLINE( 950) ::snikket::DirectChat chat1 = ::snikket::DirectChat_obj::__alloc( HX_CTX ,::hx::ObjectPtr<OBJ_>(this),this->stream,this->persistence,chatId,null(),null(),null(),null(),null());
+HXLINE( 951) ::Dynamic _hx_tmp1 = this->persistence;
+HXDLIN( 951) ::snikket::Persistence_obj::storeChats(_hx_tmp1,this->accountId(),::Array_obj< ::Dynamic>::__new(1)->init(0,chat1));
+HXLINE( 952) this->chats->unshift(chat1);
+HXLINE( 953) if (triggerIfNew) {
+HXLINE( 953) this->trigger(HX_("chats/update",3d,8e,1d,14),::cpp::VirtualArray_obj::__new(1)->init(0,chat1));
+ }
+HXLINE( 954) return chat1;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Client_obj,getDirectChat,return )
+
+void Client_obj::addPasswordNeededListener( ::Dynamic handler){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0, ::snikket::Client,_gthis, ::Dynamic,handler) HXARGC(1)
+ ::snikket::EventResult _hx_run( ::Dynamic data){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1020_addPasswordNeededListener)
+HXLINE(1021) handler(_gthis);
+HXLINE(1022) return ::snikket::EventResult_obj::EventHandled_dyn();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1019_addPasswordNeededListener)
+HXDLIN(1019) ::snikket::Client _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE(1020) this->on(HX_("auth/password-needed",80,f0,74,49), ::Dynamic(new _hx_Closure_0(_gthis,handler)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,addPasswordNeededListener,(void))
+
+void Client_obj::addPasswordNeededListener__fromC(::cpp::Function< void (void*,void*) > handler,void* handler__context){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0,::cpp::Function< void (void* HX_COMMA void*) >,handler,void*,handler__context) HXARGC(1)
+ void _hx_run( ::snikket::Client a0){
+ HX_GC_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_221_addPasswordNeededListener__fromC)
+HXLINE( 221) ::cpp::Function< void (void*,void*) > handler1 = handler;
+HXLINE( 215) ::Dynamic haxeObject = a0;
+HXDLIN( 215) void* ptr = haxeObject.mPtr;
+HXDLIN( 215) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(ptr);
+HXDLIN( 215) {
+HXLINE( 215) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 215) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 215) int high = ptrInt64 >> 32;
+HXDLIN( 215) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 215) if (::hx::IsNull( highMap )) {
+HXLINE( 215) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 215) this1->set(low,highMap);
+ }
+HXDLIN( 215) highMap->set(high,haxeObject);
+ }
+HXLINE( 221) handler1(ptr,handler__context);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_244_addPasswordNeededListener__fromC)
+HXDLIN( 244) this->addPasswordNeededListener( ::Dynamic(new _hx_Closure_0(handler,handler__context)));
+ }
+
+
+void Client_obj::addStatusOnlineListener( ::Dynamic handler){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::Dynamic,handler) HXARGC(1)
+ ::snikket::EventResult _hx_run( ::Dynamic data){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1032_addStatusOnlineListener)
+HXLINE(1033) handler();
+HXLINE(1034) return ::snikket::EventResult_obj::EventHandled_dyn();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1032_addStatusOnlineListener)
+HXDLIN(1032) this->on(HX_("status/online",10,05,0e,d2), ::Dynamic(new _hx_Closure_0(handler)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,addStatusOnlineListener,(void))
+
+void Client_obj::addStatusOnlineListener__fromC(::cpp::Function< void (void*) > handler,void* handler__context){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0,::cpp::Function< void (void*) >,handler,void*,handler__context) HXARGC(0)
+ void _hx_run(){
+ HX_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_221_addStatusOnlineListener__fromC)
+HXLINE( 221) handler(handler__context);
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_244_addStatusOnlineListener__fromC)
+HXDLIN( 244) this->addStatusOnlineListener( ::Dynamic(new _hx_Closure_0(handler,handler__context)));
+ }
+
+
+void Client_obj::addStatusOfflineListener( ::Dynamic handler){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::Dynamic,handler) HXARGC(1)
+ ::snikket::EventResult _hx_run( ::Dynamic data){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1044_addStatusOfflineListener)
+HXLINE(1045) handler();
+HXLINE(1046) return ::snikket::EventResult_obj::EventHandled_dyn();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1044_addStatusOfflineListener)
+HXDLIN(1044) this->on(HX_("status/offline",c6,eb,eb,54), ::Dynamic(new _hx_Closure_0(handler)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,addStatusOfflineListener,(void))
+
+void Client_obj::addStatusOfflineListener__fromC(::cpp::Function< void (void*) > handler,void* handler__context){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0,::cpp::Function< void (void*) >,handler,void*,handler__context) HXARGC(0)
+ void _hx_run(){
+ HX_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_221_addStatusOfflineListener__fromC)
+HXLINE( 221) handler(handler__context);
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_244_addStatusOfflineListener__fromC)
+HXDLIN( 244) this->addStatusOfflineListener( ::Dynamic(new _hx_Closure_0(handler,handler__context)));
+ }
+
+
+void Client_obj::addConnectionFailedListener( ::Dynamic handler){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::Dynamic,handler) HXARGC(1)
+ ::snikket::EventResult _hx_run( ::Dynamic data){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1056_addConnectionFailedListener)
+HXLINE(1057) handler();
+HXLINE(1058) return ::snikket::EventResult_obj::EventHandled_dyn();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1056_addConnectionFailedListener)
+HXDLIN(1056) this->stream->on(HX_("status/error",eb,19,84,6f), ::Dynamic(new _hx_Closure_0(handler)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,addConnectionFailedListener,(void))
+
+void Client_obj::addConnectionFailedListener__fromC(::cpp::Function< void (void*) > handler,void* handler__context){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0,::cpp::Function< void (void*) >,handler,void*,handler__context) HXARGC(0)
+ void _hx_run(){
+ HX_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_221_addConnectionFailedListener__fromC)
+HXLINE( 221) handler(handler__context);
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_244_addConnectionFailedListener__fromC)
+HXDLIN( 244) this->addConnectionFailedListener( ::Dynamic(new _hx_Closure_0(handler,handler__context)));
+ }
+
+
+void Client_obj::addChatMessageListener( ::Dynamic handler){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::Dynamic,handler) HXARGC(2)
+ void _hx_run( ::snikket::ChatMessage m,int e){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1081_addChatMessageListener)
+HXDLIN(1081) handler(m,e);
+ }
+ HX_END_LOCAL_FUNC2((void))
+
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1081_addChatMessageListener)
+HXDLIN(1081) this->chatMessageHandlers->push( ::Dynamic(new _hx_Closure_0(handler)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,addChatMessageListener,(void))
+
+void Client_obj::addChatMessageListener__fromC(::cpp::Function< void (void*,int,void*) > handler,void* handler__context){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0,::cpp::Function< void (void* HX_COMMA int HX_COMMA void*) >,handler,void*,handler__context) HXARGC(2)
+ void _hx_run( ::snikket::ChatMessage a0,int a1){
+ HX_GC_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_221_addChatMessageListener__fromC)
+HXLINE( 221) ::cpp::Function< void (void*,int,void*) > handler1 = handler;
+HXLINE( 215) ::Dynamic haxeObject = a0;
+HXDLIN( 215) void* ptr = haxeObject.mPtr;
+HXDLIN( 215) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(ptr);
+HXDLIN( 215) {
+HXLINE( 215) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 215) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 215) int high = ptrInt64 >> 32;
+HXDLIN( 215) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 215) if (::hx::IsNull( highMap )) {
+HXLINE( 215) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 215) this1->set(low,highMap);
+ }
+HXDLIN( 215) highMap->set(high,haxeObject);
+ }
+HXLINE( 221) handler1(ptr,a1,handler__context);
+ }
+ HX_END_LOCAL_FUNC2((void))
+
+ HX_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_244_addChatMessageListener__fromC)
+HXDLIN( 244) this->addChatMessageListener( ::Dynamic(new _hx_Closure_0(handler,handler__context)));
+ }
+
+
+void Client_obj::addSyncMessageListener( ::Dynamic handler){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1095_addSyncMessageListener)
+HXDLIN(1095) this->syncMessageHandlers->push(handler);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,addSyncMessageListener,(void))
+
+void Client_obj::addSyncMessageListener__fromC(::cpp::Function< void (void*,void*) > handler,void* handler__context){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0,::cpp::Function< void (void* HX_COMMA void*) >,handler,void*,handler__context) HXARGC(1)
+ void _hx_run( ::snikket::ChatMessage a0){
+ HX_GC_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_221_addSyncMessageListener__fromC)
+HXLINE( 221) ::cpp::Function< void (void*,void*) > handler1 = handler;
+HXLINE( 215) ::Dynamic haxeObject = a0;
+HXDLIN( 215) void* ptr = haxeObject.mPtr;
+HXDLIN( 215) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(ptr);
+HXDLIN( 215) {
+HXLINE( 215) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 215) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 215) int high = ptrInt64 >> 32;
+HXDLIN( 215) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 215) if (::hx::IsNull( highMap )) {
+HXLINE( 215) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 215) this1->set(low,highMap);
+ }
+HXDLIN( 215) highMap->set(high,haxeObject);
+ }
+HXLINE( 221) handler1(ptr,handler__context);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_244_addSyncMessageListener__fromC)
+HXDLIN( 244) this->addSyncMessageListener( ::Dynamic(new _hx_Closure_0(handler,handler__context)));
+ }
+
+
+void Client_obj::addChatsUpdatedListener( ::Dynamic handler){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::Dynamic,handler) HXARGC(1)
+ ::snikket::EventResult _hx_run(::Array< ::Dynamic> data){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1104_addChatsUpdatedListener)
+HXLINE(1105) handler(data);
+HXLINE(1106) return ::snikket::EventResult_obj::EventHandled_dyn();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1104_addChatsUpdatedListener)
+HXDLIN(1104) this->on(HX_("chats/update",3d,8e,1d,14), ::Dynamic(new _hx_Closure_0(handler)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,addChatsUpdatedListener,(void))
+
+void Client_obj::addChatsUpdatedListener__fromC(::cpp::Function< void (void**,size_t,void*) > handler,void* handler__context){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0,::cpp::Function< void (void** HX_COMMA size_t HX_COMMA void*) >,handler,void*,handler__context) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> a0){
+ HX_GC_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_221_addChatsUpdatedListener__fromC)
+HXLINE( 221) ::cpp::Function< void (void**,size_t,void*) > handler1 = handler;
+HXLINE( 211) {
+HXLINE( 211) int _g = 0;
+HXDLIN( 211) while((_g < a0->length)){
+HXLINE( 211) ::snikket::Chat el = a0->__get(_g).StaticCast< ::snikket::Chat >();
+HXDLIN( 211) _g = (_g + 1);
+HXDLIN( 211) {
+HXLINE( 211) ::Dynamic haxeObject = el;
+HXDLIN( 211) void* ptr = haxeObject.mPtr;
+HXDLIN( 211) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(ptr);
+HXDLIN( 211) {
+HXLINE( 211) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 211) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 211) int high = ptrInt64 >> 32;
+HXDLIN( 211) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 211) if (::hx::IsNull( highMap )) {
+HXLINE( 211) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 211) this1->set(low,highMap);
+ }
+HXDLIN( 211) highMap->set(high,haxeObject);
+ }
+ }
+ }
+ }
+HXDLIN( 211) void** ptr1 = (void**)a0->getBase();
+HXDLIN( 211) ::cpp::Int64 ptrInt641 = reinterpret_cast<int64_t>(ptr1);
+HXDLIN( 211) {
+HXLINE( 211) ::haxe::ds::IntMap this2 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 211) int low1 = ptrInt641 & 0xffffffff;
+HXDLIN( 211) int high1 = ptrInt641 >> 32;
+HXDLIN( 211) ::haxe::ds::IntMap highMap1 = ( ( ::haxe::ds::IntMap)(this2->get(low1)) );
+HXDLIN( 211) if (::hx::IsNull( highMap1 )) {
+HXLINE( 211) highMap1 = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 211) this2->set(low1,highMap1);
+ }
+HXDLIN( 211) highMap1->set(high1,a0);
+ }
+HXLINE( 221) handler1(ptr1,( (size_t)(a0->length) ),handler__context);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_244_addChatsUpdatedListener__fromC)
+HXDLIN( 244) this->addChatsUpdatedListener( ::Dynamic(new _hx_Closure_0(handler,handler__context)));
+ }
+
+
+void Client_obj::addCallRingListener( ::Dynamic handler){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::Dynamic,handler) HXARGC(1)
+ ::snikket::EventResult _hx_run( ::Dynamic data){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1116_addCallRingListener)
+HXLINE(1117) handler( ::Dynamic(data->__Field(HX_("session",56,17,98,93),::hx::paccDynamic)), ::Dynamic(data->__Field(HX_("chatId",d3,04,77,b7),::hx::paccDynamic)));
+HXLINE(1118) return ::snikket::EventResult_obj::EventHandled_dyn();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1116_addCallRingListener)
+HXDLIN(1116) this->on(HX_("call/ring",01,8e,91,54), ::Dynamic(new _hx_Closure_0(handler)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,addCallRingListener,(void))
+
+void Client_obj::addCallRingListener__fromC(::cpp::Function< void (void*,const char*,void*) > handler,void* handler__context){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0,::cpp::Function< void (void* HX_COMMA const char* HX_COMMA void*) >,handler,void*,handler__context) HXARGC(2)
+ void _hx_run(::Dynamic a0,::String a1){
+ HX_GC_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_221_addCallRingListener__fromC)
+HXLINE( 221) ::cpp::Function< void (void*,const char*,void*) > handler1 = handler;
+HXLINE( 215) ::Dynamic haxeObject = a0;
+HXDLIN( 215) void* ptr = haxeObject.mPtr;
+HXDLIN( 215) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(ptr);
+HXDLIN( 215) {
+HXLINE( 215) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 215) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 215) int high = ptrInt64 >> 32;
+HXDLIN( 215) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 215) if (::hx::IsNull( highMap )) {
+HXLINE( 215) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 215) this1->set(low,highMap);
+ }
+HXDLIN( 215) highMap->set(high,haxeObject);
+ }
+HXLINE( 213) const char* cStrPtr = a1.utf8_str();
+HXDLIN( 213) ::cpp::Int64 ptrInt641 = reinterpret_cast<int64_t>(cStrPtr);
+HXDLIN( 213) {
+HXLINE( 213) ::haxe::ds::IntMap this2 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 213) int low1 = ptrInt641 & 0xffffffff;
+HXDLIN( 213) int high1 = ptrInt641 >> 32;
+HXDLIN( 213) ::haxe::ds::IntMap highMap1 = ( ( ::haxe::ds::IntMap)(this2->get(low1)) );
+HXDLIN( 213) if (::hx::IsNull( highMap1 )) {
+HXLINE( 213) highMap1 = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 213) this2->set(low1,highMap1);
+ }
+HXDLIN( 213) highMap1->set(high1,a1);
+ }
+HXLINE( 221) handler1(ptr,cStrPtr,handler__context);
+ }
+ HX_END_LOCAL_FUNC2((void))
+
+ HX_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_244_addCallRingListener__fromC)
+HXDLIN( 244) this->addCallRingListener( ::Dynamic(new _hx_Closure_0(handler,handler__context)));
+ }
+
+
+void Client_obj::addCallRetractListener( ::Dynamic handler){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::Dynamic,handler) HXARGC(1)
+ ::snikket::EventResult _hx_run( ::Dynamic data){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1128_addCallRetractListener)
+HXLINE(1129) handler( ::Dynamic(data->__Field(HX_("chatId",d3,04,77,b7),::hx::paccDynamic)));
+HXLINE(1130) return ::snikket::EventResult_obj::EventHandled_dyn();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1128_addCallRetractListener)
+HXDLIN(1128) this->on(HX_("call/retract",50,bc,8d,db), ::Dynamic(new _hx_Closure_0(handler)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,addCallRetractListener,(void))
+
+void Client_obj::addCallRetractListener__fromC(::cpp::Function< void (const char*,void*) > handler,void* handler__context){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0,::cpp::Function< void (const char* HX_COMMA void*) >,handler,void*,handler__context) HXARGC(1)
+ void _hx_run(::String a0){
+ HX_GC_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_221_addCallRetractListener__fromC)
+HXLINE( 221) ::cpp::Function< void (const char*,void*) > handler1 = handler;
+HXLINE( 213) const char* cStrPtr = a0.utf8_str();
+HXDLIN( 213) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(cStrPtr);
+HXDLIN( 213) {
+HXLINE( 213) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 213) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 213) int high = ptrInt64 >> 32;
+HXDLIN( 213) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 213) if (::hx::IsNull( highMap )) {
+HXLINE( 213) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 213) this1->set(low,highMap);
+ }
+HXDLIN( 213) highMap->set(high,a0);
+ }
+HXLINE( 221) handler1(cStrPtr,handler__context);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_244_addCallRetractListener__fromC)
+HXDLIN( 244) this->addCallRetractListener( ::Dynamic(new _hx_Closure_0(handler,handler__context)));
+ }
+
+
+void Client_obj::addCallRingingListener( ::Dynamic handler){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::Dynamic,handler) HXARGC(1)
+ ::snikket::EventResult _hx_run( ::Dynamic data){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1140_addCallRingingListener)
+HXLINE(1141) handler( ::Dynamic(data->__Field(HX_("chatId",d3,04,77,b7),::hx::paccDynamic)));
+HXLINE(1142) return ::snikket::EventResult_obj::EventHandled_dyn();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1140_addCallRingingListener)
+HXDLIN(1140) this->on(HX_("call/ringing",81,75,54,f9), ::Dynamic(new _hx_Closure_0(handler)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,addCallRingingListener,(void))
+
+void Client_obj::addCallRingingListener__fromC(::cpp::Function< void (const char*,void*) > handler,void* handler__context){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0,::cpp::Function< void (const char* HX_COMMA void*) >,handler,void*,handler__context) HXARGC(1)
+ void _hx_run(::String a0){
+ HX_GC_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_221_addCallRingingListener__fromC)
+HXLINE( 221) ::cpp::Function< void (const char*,void*) > handler1 = handler;
+HXLINE( 213) const char* cStrPtr = a0.utf8_str();
+HXDLIN( 213) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(cStrPtr);
+HXDLIN( 213) {
+HXLINE( 213) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 213) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 213) int high = ptrInt64 >> 32;
+HXDLIN( 213) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 213) if (::hx::IsNull( highMap )) {
+HXLINE( 213) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 213) this1->set(low,highMap);
+ }
+HXDLIN( 213) highMap->set(high,a0);
+ }
+HXLINE( 221) handler1(cStrPtr,handler__context);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_244_addCallRingingListener__fromC)
+HXDLIN( 244) this->addCallRingingListener( ::Dynamic(new _hx_Closure_0(handler,handler__context)));
+ }
+
+
+void Client_obj::addCallMediaListener( ::Dynamic handler){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::Dynamic,handler) HXARGC(1)
+ ::snikket::EventResult _hx_run( ::Dynamic data){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1154_addCallMediaListener)
+HXLINE(1155) handler( ::Dynamic(data->__Field(HX_("session",56,17,98,93),::hx::paccDynamic)), ::Dynamic(data->__Field(HX_("audio",d6,78,80,27),::hx::paccDynamic)), ::Dynamic(data->__Field(HX_("video",7b,14,fc,36),::hx::paccDynamic)));
+HXLINE(1156) return ::snikket::EventResult_obj::EventHandled_dyn();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1154_addCallMediaListener)
+HXDLIN(1154) this->on(HX_("call/media",73,5d,1d,c7), ::Dynamic(new _hx_Closure_0(handler)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,addCallMediaListener,(void))
+
+void Client_obj::addCallMediaListener__fromC(::cpp::Function< void (void*,bool,bool,void*) > handler,void* handler__context){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0,::cpp::Function< void (void* HX_COMMA bool HX_COMMA bool HX_COMMA void*) >,handler,void*,handler__context) HXARGC(3)
+ void _hx_run( ::snikket::jingle::InitiatedSession a0,bool a1,bool a2){
+ HX_GC_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_221_addCallMediaListener__fromC)
+HXLINE( 221) ::cpp::Function< void (void*,bool,bool,void*) > handler1 = handler;
+HXLINE( 215) ::Dynamic haxeObject = a0;
+HXDLIN( 215) void* ptr = haxeObject.mPtr;
+HXDLIN( 215) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(ptr);
+HXDLIN( 215) {
+HXLINE( 215) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 215) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 215) int high = ptrInt64 >> 32;
+HXDLIN( 215) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 215) if (::hx::IsNull( highMap )) {
+HXLINE( 215) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 215) this1->set(low,highMap);
+ }
+HXDLIN( 215) highMap->set(high,haxeObject);
+ }
+HXLINE( 221) handler1(ptr,a1,a2,handler__context);
+ }
+ HX_END_LOCAL_FUNC3((void))
+
+ HX_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_244_addCallMediaListener__fromC)
+HXDLIN( 244) this->addCallMediaListener( ::Dynamic(new _hx_Closure_0(handler,handler__context)));
+ }
+
+
+void Client_obj::addCallTrackListener( ::Dynamic handler){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::Dynamic,handler) HXARGC(1)
+ ::snikket::EventResult _hx_run( ::Dynamic data){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1167_addCallTrackListener)
+HXLINE(1168) handler( ::Dynamic(data->__Field(HX_("chatId",d3,04,77,b7),::hx::paccDynamic)), ::Dynamic(data->__Field(HX_("track",8b,8e,1f,16),::hx::paccDynamic)), ::Dynamic(data->__Field(HX_("streams",f3,db,44,f6),::hx::paccDynamic)));
+HXLINE(1169) return ::snikket::EventResult_obj::EventHandled_dyn();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1167_addCallTrackListener)
+HXDLIN(1167) this->on(HX_("call/track",1a,e7,80,d7), ::Dynamic(new _hx_Closure_0(handler)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,addCallTrackListener,(void))
+
+void Client_obj::addCallTrackListener__fromC(::cpp::Function< void (const char*,void*,void**,size_t,void*) > handler,void* handler__context){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0,::cpp::Function< void (const char* HX_COMMA void* HX_COMMA void** HX_COMMA size_t HX_COMMA void*) >,handler,void*,handler__context) HXARGC(3)
+ void _hx_run(::String a0, ::snikket::jingle::MediaStreamTrack a1,::Array< ::Dynamic> a2){
+ HX_GC_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_221_addCallTrackListener__fromC)
+HXLINE( 221) ::cpp::Function< void (const char*,void*,void**,size_t,void*) > handler1 = handler;
+HXLINE( 213) const char* cStrPtr = a0.utf8_str();
+HXDLIN( 213) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(cStrPtr);
+HXDLIN( 213) {
+HXLINE( 213) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 213) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 213) int high = ptrInt64 >> 32;
+HXDLIN( 213) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 213) if (::hx::IsNull( highMap )) {
+HXLINE( 213) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 213) this1->set(low,highMap);
+ }
+HXDLIN( 213) highMap->set(high,a0);
+ }
+HXDLIN( 213) const char* _hx_tmp = cStrPtr;
+HXLINE( 215) ::Dynamic haxeObject = a1;
+HXDLIN( 215) void* ptr = haxeObject.mPtr;
+HXDLIN( 215) ::cpp::Int64 ptrInt641 = reinterpret_cast<int64_t>(ptr);
+HXDLIN( 215) {
+HXLINE( 215) ::haxe::ds::IntMap this2 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 215) int low1 = ptrInt641 & 0xffffffff;
+HXDLIN( 215) int high1 = ptrInt641 >> 32;
+HXDLIN( 215) ::haxe::ds::IntMap highMap1 = ( ( ::haxe::ds::IntMap)(this2->get(low1)) );
+HXDLIN( 215) if (::hx::IsNull( highMap1 )) {
+HXLINE( 215) highMap1 = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 215) this2->set(low1,highMap1);
+ }
+HXDLIN( 215) highMap1->set(high1,haxeObject);
+ }
+HXDLIN( 215) void* _hx_tmp1 = ptr;
+HXLINE( 211) {
+HXLINE( 211) int _g = 0;
+HXDLIN( 211) while((_g < a2->length)){
+HXLINE( 211) ::snikket::jingle::MediaStream el = a2->__get(_g).StaticCast< ::snikket::jingle::MediaStream >();
+HXDLIN( 211) _g = (_g + 1);
+HXDLIN( 211) {
+HXLINE( 211) ::Dynamic haxeObject1 = el;
+HXDLIN( 211) void* ptr1 = haxeObject1.mPtr;
+HXDLIN( 211) ::cpp::Int64 ptrInt642 = reinterpret_cast<int64_t>(ptr1);
+HXDLIN( 211) {
+HXLINE( 211) ::haxe::ds::IntMap this3 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 211) int low2 = ptrInt642 & 0xffffffff;
+HXDLIN( 211) int high2 = ptrInt642 >> 32;
+HXDLIN( 211) ::haxe::ds::IntMap highMap2 = ( ( ::haxe::ds::IntMap)(this3->get(low2)) );
+HXDLIN( 211) if (::hx::IsNull( highMap2 )) {
+HXLINE( 211) highMap2 = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 211) this3->set(low2,highMap2);
+ }
+HXDLIN( 211) highMap2->set(high2,haxeObject1);
+ }
+ }
+ }
+ }
+HXDLIN( 211) void** ptr2 = (void**)a2->getBase();
+HXDLIN( 211) ::cpp::Int64 ptrInt643 = reinterpret_cast<int64_t>(ptr2);
+HXDLIN( 211) {
+HXLINE( 211) ::haxe::ds::IntMap this4 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 211) int low3 = ptrInt643 & 0xffffffff;
+HXDLIN( 211) int high3 = ptrInt643 >> 32;
+HXDLIN( 211) ::haxe::ds::IntMap highMap3 = ( ( ::haxe::ds::IntMap)(this4->get(low3)) );
+HXDLIN( 211) if (::hx::IsNull( highMap3 )) {
+HXLINE( 211) highMap3 = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 211) this4->set(low3,highMap3);
+ }
+HXDLIN( 211) highMap3->set(high3,a2);
+ }
+HXLINE( 221) handler1(_hx_tmp,_hx_tmp1,ptr2,( (size_t)(a2->length) ),handler__context);
+ }
+ HX_END_LOCAL_FUNC3((void))
+
+ HX_STACKFRAME(&_hx_pos_e44af0c967c6b6e2_244_addCallTrackListener__fromC)
+HXDLIN( 244) this->addCallTrackListener( ::Dynamic(new _hx_Closure_0(handler,handler__context)));
+ }
+
+
+void Client_obj::setInForeground(){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1176_setInForeground)
+HXLINE(1177) if (!(this->stream->csi)) {
+HXLINE(1177) return;
+ }
+HXLINE(1178) ::snikket::GenericStream _hx_tmp = this->stream;
+HXDLIN(1178) _hx_tmp->sendStanza( ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("active",c6,41,46,16), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:csi:0",13,f1,6d,24)))));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Client_obj,setInForeground,(void))
+
+void Client_obj::setNotInForeground(){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1184_setNotInForeground)
+HXLINE(1185) if (!(this->stream->csi)) {
+HXLINE(1185) return;
+ }
+HXLINE(1186) ::snikket::GenericStream _hx_tmp = this->stream;
+HXDLIN(1186) _hx_tmp->sendStanza( ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("inactive",6b,17,30,6a), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:csi:0",13,f1,6d,24)))));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Client_obj,setNotInForeground,(void))
+
+::Dynamic Client_obj::fetchMediaByHash(::Array< ::Dynamic> hashes,::Array< ::Dynamic> counterparts){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ ::Dynamic _hx_run( ::Dynamic x){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1194_fetchMediaByHash)
+HXLINE(1194) return x;
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_1, ::snikket::Client,_gthis,::Array< ::Dynamic>,hashes,::Array< ::Dynamic>,counterparts) HXARGC(1)
+ ::Dynamic _hx_run( ::Dynamic _){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1194_fetchMediaByHash)
+HXLINE(1194) ::snikket::Client _gthis1 = _gthis;
+HXDLIN(1194) ::Array< ::Dynamic> hashes1 = hashes;
+HXDLIN(1194) return _gthis1->fetchMediaByHash(hashes1,counterparts->slice(1,null()));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1190_fetchMediaByHash)
+HXDLIN(1190) ::snikket::Client _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE(1193) bool _hx_tmp;
+HXDLIN(1193) if ((hashes->length >= 1)) {
+HXLINE(1193) _hx_tmp = (counterparts->length < 1);
+ }
+ else {
+HXLINE(1193) _hx_tmp = true;
+ }
+HXDLIN(1193) if (_hx_tmp) {
+HXLINE(1193) return ::thenshim::_Promise::Promise_Impl__obj::reject(HX_("no counterparts left",64,15,a4,38));
+ }
+HXLINE(1194) return ::thenshim::_Promise::Promise_Impl__obj::then(this->fetchMediaByHashOneCounterpart(hashes,counterparts->__get(0).StaticCast< ::snikket::JID >()), ::Dynamic(new _hx_Closure_0()), ::Dynamic(new _hx_Closure_1(_gthis,hashes,counterparts)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Client_obj,fetchMediaByHash,return )
+
+::Dynamic Client_obj::fetchMediaByHashOneCounterpart(::Array< ::Dynamic> hashes, ::snikket::JID counterpart){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0, ::snikket::Client,_gthis,::Array< ::Dynamic>,hashes) HXARGC(2)
+ void _hx_run( ::Dynamic resolve, ::Dynamic reject){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1201_fetchMediaByHashOneCounterpart)
+HXLINE(1201) ::snikket::Persistence_obj::hasMedia(_gthis->persistence,hashes->__get(0).StaticCast< ::snikket::Hash >()->algorithm,hashes->__get(0).StaticCast< ::snikket::Hash >()->hash,resolve);
+ }
+ HX_END_LOCAL_FUNC2((void))
+
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_6, ::snikket::JID,counterpart, ::snikket::Client,_gthis,::Array< ::Dynamic>,hashes) HXARGC(1)
+ ::Dynamic _hx_run(bool has){
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_3, ::snikket::JID,counterpart, ::snikket::Client,_gthis,::Array< ::Dynamic>,hashes) HXARGC(2)
+ void _hx_run( ::Dynamic resolve, ::Dynamic reject){
+ HX_BEGIN_LOCAL_FUNC_S4(::hx::LocalFunc,_hx_Closure_2, ::snikket::Client,_gthis, ::Dynamic,resolve, ::Dynamic,reject, ::snikket::queries::BoB,q1) HXARGC(0)
+ void _hx_run(){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1207_fetchMediaByHashOneCounterpart)
+HXLINE(1208) ::Dynamic r = q1->getResult();
+HXLINE(1209) if (::hx::IsNull( r )) {
+HXLINE(1210) reject(HX_("bad or no result from BoB query",ad,e0,04,ee));
+ }
+ else {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_1, ::Dynamic,resolve) HXARGC(0)
+ void _hx_run(){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1212_fetchMediaByHashOneCounterpart)
+HXLINE(1212) resolve(null());
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+HXLINE(1212) ::snikket::Persistence_obj::storeMedia(_gthis->persistence, ::Dynamic(r->__Field(HX_("type",ba,f2,08,4d),::hx::paccDynamic)),( ( ::haxe::io::Bytes)(r->__Field(HX_("bytes",6b,08,98,bd),::hx::paccDynamic)) )->b, ::Dynamic(new _hx_Closure_1(resolve)));
+ }
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1205_fetchMediaByHashOneCounterpart)
+HXLINE(1206) ::String q = counterpart->asString();
+HXDLIN(1206) ::snikket::queries::BoB q1 = ::snikket::queries::BoB_obj::forHash(q,hashes->__get(0).StaticCast< ::snikket::Hash >());
+HXLINE(1207) q1->onFinished( ::Dynamic(new _hx_Closure_2(_gthis,resolve,reject,q1)));
+HXLINE(1215) _gthis->sendQuery(q1);
+ }
+ HX_END_LOCAL_FUNC2((void))
+
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_4) HXARGC(1)
+ ::Dynamic _hx_run( ::Dynamic x){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1216_fetchMediaByHashOneCounterpart)
+HXLINE(1216) return x;
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_5, ::snikket::JID,counterpart, ::snikket::Client,_gthis,::Array< ::Dynamic>,hashes) HXARGC(1)
+ ::Dynamic _hx_run( ::Dynamic _){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1216_fetchMediaByHashOneCounterpart)
+HXLINE(1216) ::snikket::Client _gthis1 = _gthis;
+HXDLIN(1216) ::Array< ::Dynamic> _hx_tmp = hashes->slice(1,null());
+HXDLIN(1216) return _gthis1->fetchMediaByHashOneCounterpart(_hx_tmp,counterpart);
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1202_fetchMediaByHashOneCounterpart)
+HXLINE(1203) if (has) {
+HXLINE(1203) return ::thenshim::_Promise::Promise_Impl__obj::resolve(null());
+ }
+HXLINE(1205) return ::thenshim::_Promise::Promise_Impl__obj::then(::thenshim::_Promise::Promise_Impl__obj::_new( ::Dynamic(new _hx_Closure_3(counterpart,_gthis,hashes))), ::Dynamic(new _hx_Closure_4()), ::Dynamic(new _hx_Closure_5(counterpart,_gthis,hashes)));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1197_fetchMediaByHashOneCounterpart)
+HXDLIN(1197) ::snikket::Client _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE(1198) if ((hashes->length < 1)) {
+HXLINE(1198) return ::thenshim::_Promise::Promise_Impl__obj::reject(HX_("no hashes left",8c,68,e6,69));
+ }
+HXLINE(1200) return ::thenshim::_Promise::Promise_Impl__obj::then(::thenshim::_Promise::Promise_Impl__obj::_new( ::Dynamic(new _hx_Closure_0(_gthis,hashes))), ::Dynamic(new _hx_Closure_6(counterpart,_gthis,hashes)),null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Client_obj,fetchMediaByHashOneCounterpart,return )
+
+void Client_obj::chatActivity( ::snikket::Chat chat,::hx::Null< bool > __o_trigger){
+ bool trigger = __o_trigger.Default(true);
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1221_chatActivity)
+HXLINE(1222) if (chat->isBlocked) {
+HXLINE(1222) return;
+ }
+HXLINE(1223) if ((chat->uiState == 2)) {
+HXLINE(1224) chat->uiState = 1;
+HXLINE(1225) ::Dynamic _hx_tmp = this->persistence;
+HXDLIN(1225) ::snikket::Persistence_obj::storeChats(_hx_tmp,this->accountId(),::Array_obj< ::Dynamic>::__new(1)->init(0,chat));
+ }
+HXLINE(1227) int pinnedCount;
+HXDLIN(1227) if ((chat->uiState == 0)) {
+HXLINE(1227) pinnedCount = 0;
+ }
+ else {
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(2)
+ int _hx_run( ::snikket::Chat item,int result){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1227_chatActivity)
+HXLINE(1227) int pinnedCount;
+HXDLIN(1227) if ((item->uiState == 0)) {
+HXLINE(1227) pinnedCount = 1;
+ }
+ else {
+HXLINE(1227) pinnedCount = 0;
+ }
+HXDLIN(1227) return (result + pinnedCount);
+ }
+ HX_END_LOCAL_FUNC2(return)
+
+HXLINE(1227) pinnedCount = ( (int)(::Lambda_obj::fold(this->chats, ::Dynamic(new _hx_Closure_0()),0)) );
+ }
+HXLINE(1228) int idx = this->chats->indexOf(chat,null());
+HXLINE(1229) if ((idx > pinnedCount)) {
+HXLINE(1230) this->chats->removeRange(idx,1);
+HXLINE(1231) this->chats->insert(pinnedCount,chat);
+ }
+HXLINE(1233) if (trigger) {
+HXLINE(1233) this->trigger(HX_("chats/update",3d,8e,1d,14),::cpp::VirtualArray_obj::__new(1)->init(0,chat));
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Client_obj,chatActivity,(void))
+
+void Client_obj::sortChats(){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(2)
+ int _hx_run( ::snikket::Chat a, ::snikket::Chat b){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1238_sortChats)
+HXLINE(1239) bool _hx_tmp;
+HXDLIN(1239) if ((a->uiState == 0)) {
+HXLINE(1239) _hx_tmp = (b->uiState != 0);
+ }
+ else {
+HXLINE(1239) _hx_tmp = false;
+ }
+HXDLIN(1239) if (_hx_tmp) {
+HXLINE(1239) return -1;
+ }
+HXLINE(1240) bool _hx_tmp1;
+HXDLIN(1240) if ((b->uiState == 0)) {
+HXLINE(1240) _hx_tmp1 = (a->uiState != 0);
+ }
+ else {
+HXLINE(1240) _hx_tmp1 = false;
+ }
+HXDLIN(1240) if (_hx_tmp1) {
+HXLINE(1240) return 1;
+ }
+HXLINE(1241) ::String _hx_tmp2;
+HXDLIN(1241) ::String tmp = a->lastMessageTimestamp();
+HXDLIN(1241) if (::hx::IsNotNull( tmp )) {
+HXLINE(1241) _hx_tmp2 = tmp;
+ }
+ else {
+HXLINE(1241) _hx_tmp2 = HX_("0",30,00,00,00);
+ }
+HXDLIN(1241) ::String tmp1 = b->lastMessageTimestamp();
+HXDLIN(1241) ::String _hx_tmp3;
+HXDLIN(1241) if (::hx::IsNotNull( tmp1 )) {
+HXLINE(1241) _hx_tmp3 = tmp1;
+ }
+ else {
+HXLINE(1241) _hx_tmp3 = HX_("0",30,00,00,00);
+ }
+HXDLIN(1241) return -(::Reflect_obj::compare(_hx_tmp2,_hx_tmp3));
+ }
+ HX_END_LOCAL_FUNC2(return)
+
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1238_sortChats)
+HXDLIN(1238) this->chats->sort( ::Dynamic(new _hx_Closure_0()));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Client_obj,sortChats,(void))
+
+void Client_obj::storeMessages(::Array< ::Dynamic> messages, ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1247_storeMessages)
+HXDLIN(1247) ::Dynamic _hx_tmp = this->persistence;
+HXDLIN(1247) ::String _hx_tmp1 = this->accountId();
+HXDLIN(1247) ::Dynamic tmp = callback;
+HXDLIN(1247) ::Dynamic _hx_tmp2;
+HXDLIN(1247) if (::hx::IsNotNull( tmp )) {
+HXDLIN(1247) _hx_tmp2 = tmp;
+ }
+ else {
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> _){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1247_storeMessages)
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXDLIN(1247) _hx_tmp2 = ::Dynamic(new _hx_Closure_0());
+ }
+HXDLIN(1247) ::snikket::Persistence_obj::storeMessages(_hx_tmp,_hx_tmp1,messages,_hx_tmp2);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Client_obj,storeMessages,(void))
+
+void Client_obj::sendQuery( ::snikket::queries::GenericQuery query){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1252_sendQuery)
+HXDLIN(1252) ::snikket::GenericStream _hx_tmp = this->stream;
+HXDLIN(1252) _hx_tmp->sendIq(query->getQueryStanza(),query->handleResponse_dyn());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,sendQuery,(void))
+
+void Client_obj::sendStanza( ::snikket::Stanza stanza){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1256_sendStanza)
+HXLINE(1257) if (::hx::IsNull( ( (::String)(::Reflect_obj::field(stanza->attr,HX_("id",db,5b,00,00))) ) )) {
+HXLINE(1257) ::Dynamic this1 = stanza->attr;
+HXDLIN(1257) ::String value = ::snikket::ID_obj::_hx_long();
+HXDLIN(1257) ::Reflect_obj::setField(this1,HX_("id",db,5b,00,00),value);
+ }
+HXLINE(1258) this->stream->sendStanza(stanza);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,sendStanza,(void))
+
+void Client_obj::sendPresence(::String to, ::Dynamic augment){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1263_sendPresence)
+HXLINE(1264) ::Dynamic tmp = augment;
+HXDLIN(1264) ::Dynamic _hx_tmp;
+HXDLIN(1264) if (::hx::IsNotNull( tmp )) {
+HXLINE(1264) _hx_tmp = tmp;
+ }
+ else {
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ ::snikket::Stanza _hx_run( ::snikket::Stanza s){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1264_sendPresence)
+HXLINE(1264) return s;
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE(1264) _hx_tmp = ::Dynamic(new _hx_Closure_0());
+ }
+HXLINE(1265) ::snikket::Caps _hx_tmp1 = this->caps;
+HXDLIN(1265) ::Dynamic _hx_tmp2;
+HXDLIN(1265) if (::hx::IsNull( to )) {
+HXLINE(1265) _hx_tmp2 = ::Dynamic(::hx::Anon_obj::Create(0));
+ }
+ else {
+HXLINE(1265) _hx_tmp2 = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("to",7b,65,00,00),to));
+ }
+HXDLIN(1265) ::snikket::Stanza _hx_tmp3 = _hx_tmp1->addC( ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("presence",3b,52,d7,66),_hx_tmp2));
+HXLINE(1266) ::String _hx_tmp4 = this->displayName();
+HXLINE(1263) this->sendStanza(( ( ::snikket::Stanza)(_hx_tmp(_hx_tmp3->textTag(HX_("nick",a3,7b,05,49),_hx_tmp4, ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("http://jabber.org/protocol/nick",17,30,dc,e9)))))) ));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Client_obj,sendPresence,(void))
+
+void Client_obj::getIceServers( ::Dynamic callback){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0, ::snikket::queries::ExtDiscoGet,extDiscoGet, ::Dynamic,callback) HXARGC(0)
+ void _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1274_getIceServers)
+HXLINE(1275) ::haxe::ds::StringMap didUrl = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXLINE(1276) ::Array< ::Dynamic> servers = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE(1277) {
+HXLINE(1277) int _g = 0;
+HXDLIN(1277) ::Array< ::Dynamic> _g1;
+HXDLIN(1277) ::Array< ::Dynamic> tmp = extDiscoGet->getResult();
+HXDLIN(1277) if (::hx::IsNotNull( tmp )) {
+HXLINE(1277) _g1 = tmp;
+ }
+ else {
+HXLINE(1277) _g1 = ::Array_obj< ::Dynamic>::__new(0);
+ }
+HXDLIN(1277) while((_g < _g1->length)){
+HXLINE(1277) ::snikket::Stanza service = _g1->__get(_g).StaticCast< ::snikket::Stanza >();
+HXDLIN(1277) _g = (_g + 1);
+HXLINE(1278) if (!(::Array_obj< ::String >::fromData( _hx_array_data_7c06fe3c_182,4)->contains(( (::String)(::Reflect_obj::field(service->attr,HX_("type",ba,f2,08,4d))) )))) {
+HXLINE(1278) continue;
+ }
+HXLINE(1279) ::String host = ( (::String)(::Reflect_obj::field(service->attr,HX_("host",68,cf,12,45))) );
+HXLINE(1280) bool _hx_tmp;
+HXDLIN(1280) if (::hx::IsNotNull( host )) {
+HXLINE(1280) _hx_tmp = (host == HX_("",00,00,00,00));
+ }
+ else {
+HXLINE(1280) _hx_tmp = true;
+ }
+HXDLIN(1280) if (_hx_tmp) {
+HXLINE(1280) continue;
+ }
+HXLINE(1281) ::Dynamic port = ::Std_obj::parseInt(( (::String)(::Reflect_obj::field(service->attr,HX_("port",81,83,5c,4a))) ));
+HXLINE(1282) bool _hx_tmp1;
+HXDLIN(1282) bool _hx_tmp2;
+HXDLIN(1282) if (::hx::IsNotNull( port )) {
+HXLINE(1282) _hx_tmp2 = ::hx::IsLess( port,1 );
+ }
+ else {
+HXLINE(1282) _hx_tmp2 = true;
+ }
+HXDLIN(1282) if (!(_hx_tmp2)) {
+HXLINE(1282) _hx_tmp1 = ::hx::IsGreater( port,65535 );
+ }
+ else {
+HXLINE(1282) _hx_tmp1 = true;
+ }
+HXDLIN(1282) if (_hx_tmp1) {
+HXLINE(1282) continue;
+ }
+HXLINE(1283) bool isTurn = ::Array_obj< ::String >::fromData( _hx_array_data_7c06fe3c_183,2)->contains(( (::String)(::Reflect_obj::field(service->attr,HX_("type",ba,f2,08,4d))) ));
+HXLINE(1284) ::String url = (( (::String)(::Reflect_obj::field(service->attr,HX_("type",ba,f2,08,4d))) ) + HX_(":",3a,00,00,00));
+HXDLIN(1284) ::String url1;
+HXDLIN(1284) if ((host.indexOf(HX_(":",3a,00,00,00),null()) >= 0)) {
+HXLINE(1284) url1 = ((HX_("[",5b,00,00,00) + host) + HX_("]",5d,00,00,00));
+ }
+ else {
+HXLINE(1284) url1 = host;
+ }
+HXDLIN(1284) ::String url2;
+HXDLIN(1284) if (isTurn) {
+HXLINE(1284) url2 = (HX_("?transport=",73,c9,f2,13) + ( (::String)(::Reflect_obj::field(service->attr,HX_("transport",a9,4f,2f,4c))) ));
+ }
+ else {
+HXLINE(1284) url2 = HX_("",00,00,00,00);
+ }
+HXDLIN(1284) ::String url3 = ((((url + url1) + HX_(":",3a,00,00,00)) + port) + url2);
+HXLINE(1285) if (!(didUrl->exists(url3))) {
+HXLINE(1287) ::String _hx_tmp3 = ( (::String)(::Reflect_obj::field(service->attr,HX_("username",16,86,eb,20))) );
+HXLINE(1286) servers->push( ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("credential",d7,89,b2,20),( (::String)(::Reflect_obj::field(service->attr,HX_("password",1b,23,d0,48))) ))
+ ->setFixed(1,HX_("username",16,86,eb,20),_hx_tmp3)
+ ->setFixed(2,HX_("urls",24,d6,ac,4d),::Array_obj< ::String >::__new(1)->init(0,url3))));
+HXLINE(1291) didUrl->set(url3,true);
+ }
+ }
+ }
+HXLINE(1294) callback(servers);
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1272_getIceServers)
+HXLINE(1273) ::snikket::queries::ExtDiscoGet extDiscoGet = ::snikket::queries::ExtDiscoGet_obj::__alloc( HX_CTX ,this->jid->domain);
+HXLINE(1274) extDiscoGet->onFinished( ::Dynamic(new _hx_Closure_0(extDiscoGet,callback)));
+HXLINE(1296) this->sendQuery(extDiscoGet);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,getIceServers,(void))
+
+void Client_obj::discoverServices( ::snikket::JID target,::String node, ::Dynamic callback){
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_1, ::snikket::Client,_gthis, ::Dynamic,callback, ::snikket::queries::DiscoItemsGet,itemsGet) HXARGC(0)
+ void _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1303_discoverServices)
+HXLINE(1303) int _g = 0;
+HXDLIN(1303) ::Array< ::Dynamic> _g1;
+HXDLIN(1303) ::Array< ::Dynamic> tmp = itemsGet->getResult();
+HXDLIN(1303) if (::hx::IsNotNull( tmp )) {
+HXLINE(1303) _g1 = tmp;
+ }
+ else {
+HXLINE(1303) _g1 = ::Array_obj< ::Dynamic>::__new(0);
+ }
+HXDLIN(1303) while((_g < _g1->length)){
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_0, ::snikket::queries::DiscoInfoGet,infoGet1, ::Dynamic,item, ::Dynamic,callback) HXARGC(0)
+ void _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1306_discoverServices)
+HXLINE(1306) ::Dynamic callback1 = callback;
+HXDLIN(1306) ::Dynamic item1 = item;
+HXDLIN(1306) callback1(item1,infoGet1->getResult());
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+HXLINE(1303) ::Dynamic item = _g1->__get(_g);
+HXDLIN(1303) _g = (_g + 1);
+HXLINE(1304) ::String infoGet = ( ( ::snikket::JID)(item->__Field(HX_("jid",c5,ca,50,00),::hx::paccDynamic)) )->asString();
+HXDLIN(1304) ::snikket::queries::DiscoInfoGet infoGet1 = ::snikket::queries::DiscoInfoGet_obj::__alloc( HX_CTX ,infoGet,( (::String)(item->__Field(HX_("node",02,0a,0a,49),::hx::paccDynamic)) ));
+HXLINE(1305) infoGet1->onFinished( ::Dynamic(new _hx_Closure_0(infoGet1,item,callback)));
+HXLINE(1308) _gthis->sendQuery(infoGet1);
+ }
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1300_discoverServices)
+HXDLIN(1300) ::snikket::Client _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE(1301) ::snikket::queries::DiscoItemsGet itemsGet = ::snikket::queries::DiscoItemsGet_obj::__alloc( HX_CTX ,target->asString(),node);
+HXLINE(1302) itemsGet->onFinished( ::Dynamic(new _hx_Closure_1(_gthis,callback,itemsGet)));
+HXLINE(1311) this->sendQuery(itemsGet);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Client_obj,discoverServices,(void))
+
+void Client_obj::notifyMessageHandlers( ::snikket::ChatMessage message,int event){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1315_notifyMessageHandlers)
+HXLINE(1316) ::snikket::Chat chat = this->getChat(message->chatId());
+HXLINE(1317) bool _hx_tmp;
+HXDLIN(1317) if (::hx::IsNotNull( chat )) {
+HXLINE(1317) _hx_tmp = chat->isBlocked;
+ }
+ else {
+HXLINE(1317) _hx_tmp = false;
+ }
+HXDLIN(1317) if (_hx_tmp) {
+HXLINE(1317) return;
+ }
+HXLINE(1318) {
+HXLINE(1318) int _g = 0;
+HXDLIN(1318) ::Array< ::Dynamic> _g1 = this->chatMessageHandlers;
+HXDLIN(1318) while((_g < _g1->length)){
+HXLINE(1318) ::Dynamic handler = _g1->__get(_g);
+HXDLIN(1318) _g = (_g + 1);
+HXLINE(1319) handler(message,event);
+ }
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Client_obj,notifyMessageHandlers,(void))
+
+void Client_obj::notifySyncMessageHandlers( ::snikket::ChatMessage message){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1324_notifySyncMessageHandlers)
+HXLINE(1325) bool _hx_tmp;
+HXDLIN(1325) if (::hx::IsNotNull( message )) {
+HXLINE(1325) _hx_tmp = (message->versions->length > 1);
+ }
+ else {
+HXLINE(1325) _hx_tmp = true;
+ }
+HXDLIN(1325) if (_hx_tmp) {
+HXLINE(1325) return;
+ }
+HXLINE(1326) ::snikket::Chat chat = this->getChat(message->chatId());
+HXLINE(1327) bool _hx_tmp1;
+HXDLIN(1327) if (::hx::IsNotNull( chat )) {
+HXLINE(1327) _hx_tmp1 = chat->isBlocked;
+ }
+ else {
+HXLINE(1327) _hx_tmp1 = false;
+ }
+HXDLIN(1327) if (_hx_tmp1) {
+HXLINE(1327) return;
+ }
+HXLINE(1328) {
+HXLINE(1328) int _g = 0;
+HXDLIN(1328) ::Array< ::Dynamic> _g1 = this->syncMessageHandlers;
+HXDLIN(1328) while((_g < _g1->length)){
+HXLINE(1328) ::Dynamic handler = _g1->__get(_g);
+HXDLIN(1328) _g = (_g + 1);
+HXLINE(1329) handler(message);
+ }
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,notifySyncMessageHandlers,(void))
+
+void Client_obj::rosterGet(){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0, ::snikket::Client,_gthis, ::snikket::queries::RosterGet,rosterGet) HXARGC(0)
+ void _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1335_rosterGet)
+HXLINE(1336) ::Array< ::Dynamic> chatsToUpdate = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE(1337) {
+HXLINE(1337) int _g = 0;
+HXDLIN(1337) ::Array< ::Dynamic> _g1 = rosterGet->getResult();
+HXDLIN(1337) while((_g < _g1->length)){
+HXLINE(1337) ::Dynamic item = _g1->__get(_g);
+HXDLIN(1337) _g = (_g + 1);
+HXLINE(1338) ::snikket::DirectChat chat = _gthis->getDirectChat(( (::String)(item->__Field(HX_("jid",c5,ca,50,00),::hx::paccDynamic)) ),false);
+HXLINE(1339) chat->updateFromRoster(item);
+HXLINE(1340) chatsToUpdate->push(chat);
+ }
+ }
+HXLINE(1342) ::Dynamic _gthis1 = _gthis->persistence;
+HXDLIN(1342) ::snikket::Persistence_obj::storeChats(_gthis1,_gthis->accountId(),chatsToUpdate);
+HXLINE(1343) _gthis->trigger(HX_("chats/update",3d,8e,1d,14),chatsToUpdate);
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1333_rosterGet)
+HXDLIN(1333) ::snikket::Client _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE(1334) ::snikket::queries::RosterGet rosterGet = ::snikket::queries::RosterGet_obj::__alloc( HX_CTX ,null());
+HXLINE(1335) rosterGet->onFinished( ::Dynamic(new _hx_Closure_0(_gthis,rosterGet)));
+HXLINE(1345) this->sendQuery(rosterGet);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Client_obj,rosterGet,(void))
+
+void Client_obj::startChatWith(::String jid, ::Dynamic handleCaps, ::Dynamic handleChat){
+ HX_BEGIN_LOCAL_FUNC_S5(::hx::LocalFunc,_hx_Closure_0, ::snikket::Client,_gthis, ::Dynamic,handleChat, ::Dynamic,handleCaps, ::snikket::queries::DiscoInfoGet,discoGet,::String,jid) HXARGC(0)
+ void _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1350_startChatWith)
+HXLINE(1351) ::snikket::Caps resultCaps = discoGet->getResult();
+HXLINE(1352) if (::hx::IsNull( resultCaps )) {
+HXLINE(1353) ::snikket::Stanza tmp = discoGet->responseStanza;
+HXDLIN(1353) ::snikket::Stanza tmp1;
+HXDLIN(1353) if (::hx::IsNotNull( tmp )) {
+HXLINE(1353) tmp1 = tmp->getChild(HX_("error",c8,cb,29,73),null());
+ }
+ else {
+HXLINE(1353) tmp1 = null();
+ }
+HXDLIN(1353) ::snikket::Stanza err;
+HXDLIN(1353) if (::hx::IsNotNull( tmp1 )) {
+HXLINE(1353) err = tmp1->getChild(null(),HX_("urn:ietf:params:xml:ns:xmpp-stanzas",27,f2,3d,30));
+ }
+ else {
+HXLINE(1353) err = null();
+ }
+HXLINE(1354) bool _hx_tmp;
+HXDLIN(1354) bool _hx_tmp1;
+HXDLIN(1354) if (::hx::IsNotNull( err )) {
+HXLINE(1354) ::String _hx_tmp2;
+HXDLIN(1354) if (::hx::IsNotNull( err )) {
+HXLINE(1354) _hx_tmp2 = err->name;
+ }
+ else {
+HXLINE(1354) _hx_tmp2 = null();
+ }
+HXDLIN(1354) _hx_tmp1 = (_hx_tmp2 == HX_("service-unavailable",f8,3c,11,1c));
+ }
+ else {
+HXLINE(1354) _hx_tmp1 = true;
+ }
+HXDLIN(1354) if (!(_hx_tmp1)) {
+HXLINE(1354) ::String _hx_tmp3;
+HXDLIN(1354) if (::hx::IsNotNull( err )) {
+HXLINE(1354) _hx_tmp3 = err->name;
+ }
+ else {
+HXLINE(1354) _hx_tmp3 = null();
+ }
+HXDLIN(1354) _hx_tmp = (_hx_tmp3 == HX_("feature-not-implemented",71,20,2e,96));
+ }
+ else {
+HXLINE(1354) _hx_tmp = true;
+ }
+HXDLIN(1354) if (_hx_tmp) {
+HXLINE(1355) ::snikket::DirectChat chat = _gthis->getDirectChat(jid,false);
+HXLINE(1356) handleChat(chat);
+HXLINE(1357) ::Dynamic _gthis1 = _gthis->persistence;
+HXDLIN(1357) ::snikket::Persistence_obj::storeChats(_gthis1,_gthis->accountId(),::Array_obj< ::Dynamic>::__new(1)->init(0,chat));
+ }
+ }
+ else {
+HXLINE(1360) ::snikket::Persistence_obj::storeCaps(_gthis->persistence,resultCaps);
+HXLINE(1361) int uiState = ( (int)(handleCaps(resultCaps)) );
+HXLINE(1362) if (resultCaps->isChannel(jid)) {
+HXLINE(1363) ::snikket::Channel chat1 = ::snikket::Channel_obj::__alloc( HX_CTX ,_gthis,_gthis->stream,_gthis->persistence,jid,uiState,false,null(),null(),null(),resultCaps);
+HXLINE(1364) handleChat(chat1);
+HXLINE(1365) _gthis->chats->unshift(chat1);
+HXLINE(1366) ::Dynamic _gthis2 = _gthis->persistence;
+HXDLIN(1366) ::snikket::Persistence_obj::storeChats(_gthis2,_gthis->accountId(),::Array_obj< ::Dynamic>::__new(1)->init(0,chat1));
+ }
+ else {
+HXLINE(1368) ::snikket::DirectChat chat2 = _gthis->getDirectChat(jid,false);
+HXLINE(1369) handleChat(chat2);
+HXLINE(1370) ::Dynamic _gthis3 = _gthis->persistence;
+HXDLIN(1370) ::snikket::Persistence_obj::storeChats(_gthis3,_gthis->accountId(),::Array_obj< ::Dynamic>::__new(1)->init(0,chat2));
+ }
+ }
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1348_startChatWith)
+HXDLIN(1348) ::snikket::Client _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE(1349) ::snikket::queries::DiscoInfoGet discoGet = ::snikket::queries::DiscoInfoGet_obj::__alloc( HX_CTX ,jid,null());
+HXLINE(1350) discoGet->onFinished( ::Dynamic(new _hx_Closure_0(_gthis,handleChat,handleCaps,discoGet,jid)));
+HXLINE(1374) this->sendQuery(discoGet);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Client_obj,startChatWith,(void))
+
+void Client_obj::serverBlocked(::String blocked){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1377_serverBlocked)
+HXLINE(1378) ::snikket::Chat chat;
+HXDLIN(1378) ::snikket::Chat tmp = this->getChat(blocked);
+HXDLIN(1378) if (::hx::IsNotNull( tmp )) {
+HXLINE(1378) chat = tmp;
+ }
+ else {
+HXLINE(1378) chat = this->getDirectChat(blocked,false);
+ }
+HXLINE(1379) chat->block(null(),false);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,serverBlocked,(void))
+
+void Client_obj::bookmarksGet( ::Dynamic callback){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0, ::snikket::Client,_gthis, ::snikket::queries::BlocklistGet,blockingGet) HXARGC(0)
+ void _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1386_bookmarksGet)
+HXLINE(1386) int _g = 0;
+HXDLIN(1386) ::Array< ::String > _g1 = blockingGet->getResult();
+HXDLIN(1386) while((_g < _g1->length)){
+HXLINE(1386) ::String blocked = _g1->__get(_g);
+HXDLIN(1386) _g = (_g + 1);
+HXLINE(1387) _gthis->serverBlocked(blocked);
+ }
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_3, ::snikket::Client,_gthis, ::snikket::queries::PubsubGet,mdsGet) HXARGC(0)
+ void _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1393_bookmarksGet)
+HXLINE(1394) ::Array< ::Dynamic> chatsToUpdate = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE(1395) {
+HXLINE(1395) int _g = 0;
+HXDLIN(1395) ::Array< ::Dynamic> _g1 = mdsGet->getResult();
+HXDLIN(1395) while((_g < _g1->length)){
+HXLINE(1395) ::snikket::Stanza item = _g1->__get(_g).StaticCast< ::snikket::Stanza >();
+HXDLIN(1395) _g = (_g + 1);
+HXLINE(1396) if (::hx::IsNotNull( ( (::String)(::Reflect_obj::field(item->attr,HX_("id",db,5b,00,00))) ) )) {
+HXLINE(1397) ::snikket::Stanza tmp = item->getChild(HX_("displayed",21,17,db,c1),HX_("urn:xmpp:mds:displayed:0",bd,60,cc,fb));
+HXDLIN(1397) ::snikket::Stanza upTo;
+HXDLIN(1397) if (::hx::IsNotNull( tmp )) {
+HXLINE(1397) upTo = tmp->getChild(HX_("stanza-id",73,8a,54,e9),HX_("urn:xmpp:sid:0",a8,4b,37,54));
+ }
+ else {
+HXLINE(1397) upTo = null();
+ }
+HXLINE(1398) ::snikket::Client _gthis1 = _gthis;
+HXDLIN(1398) ::snikket::Chat chat = _gthis1->getChat(( (::String)(::Reflect_obj::field(item->attr,HX_("id",db,5b,00,00))) ));
+HXLINE(1399) if (::hx::IsNull( chat )) {
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_1) HXARGC(1)
+ int _hx_run( ::snikket::Caps caps){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1400_bookmarksGet)
+HXLINE(1400) return 2;
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_2, ::snikket::Stanza,upTo) HXARGC(1)
+ void _hx_run( ::snikket::Chat chat){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1400_bookmarksGet)
+HXLINE(1400) ::String _hx_tmp = ( (::String)(::Reflect_obj::field(upTo->attr,HX_("id",db,5b,00,00))) );
+HXDLIN(1400) chat->markReadUpToId(_hx_tmp,( (::String)(::Reflect_obj::field(upTo->attr,HX_("by",d7,55,00,00))) ),null());
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE(1400) ::snikket::Client _gthis2 = _gthis;
+HXDLIN(1400) _gthis2->startChatWith(( (::String)(::Reflect_obj::field(item->attr,HX_("id",db,5b,00,00))) ), ::Dynamic(new _hx_Closure_1()), ::Dynamic(new _hx_Closure_2(upTo)));
+ }
+ else {
+HXLINE(1402) ::String _hx_tmp = ( (::String)(::Reflect_obj::field(upTo->attr,HX_("id",db,5b,00,00))) );
+HXDLIN(1402) chat->markReadUpToId(_hx_tmp,( (::String)(::Reflect_obj::field(upTo->attr,HX_("by",d7,55,00,00))) ),null());
+HXLINE(1403) chatsToUpdate->push(chat);
+ }
+ }
+ }
+ }
+HXLINE(1407) ::Dynamic _gthis3 = _gthis->persistence;
+HXDLIN(1407) ::snikket::Persistence_obj::storeChats(_gthis3,_gthis->accountId(),chatsToUpdate);
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_6, ::snikket::Client,_gthis, ::snikket::queries::PubsubGet,pubsubGet, ::Dynamic,callback) HXARGC(0)
+ void _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1412_bookmarksGet)
+HXLINE(1413) ::Array< ::Dynamic> chatsToUpdate = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE(1414) {
+HXLINE(1414) int _g = 0;
+HXDLIN(1414) ::Array< ::Dynamic> _g1 = pubsubGet->getResult();
+HXDLIN(1414) while((_g < _g1->length)){
+HXLINE(1414) ::snikket::Stanza item = _g1->__get(_g).StaticCast< ::snikket::Stanza >();
+HXDLIN(1414) _g = (_g + 1);
+HXLINE(1415) if (::hx::IsNotNull( ( (::String)(::Reflect_obj::field(item->attr,HX_("id",db,5b,00,00))) ) )) {
+HXLINE(1416) ::snikket::Client _gthis1 = _gthis;
+HXDLIN(1416) ::snikket::Chat chat = _gthis1->getChat(( (::String)(::Reflect_obj::field(item->attr,HX_("id",db,5b,00,00))) ));
+HXLINE(1417) if (::hx::IsNull( chat )) {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_4, ::snikket::Stanza,item) HXARGC(1)
+ int _hx_run( ::snikket::Caps caps){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1420_bookmarksGet)
+HXLINE(1421) ::snikket::Identity identity = caps->identities->__get(0).StaticCast< ::snikket::Identity >();
+HXLINE(1422) ::snikket::Stanza conf = item->getChild(HX_("conference",1c,2b,83,41),HX_("urn:xmpp:bookmarks:1",58,3c,53,7d));
+HXLINE(1423) if (::hx::IsNull( ( (::String)(::Reflect_obj::field(conf->attr,HX_("name",4b,72,ff,48))) ) )) {
+HXLINE(1424) ::String value;
+HXDLIN(1424) if (::hx::IsNotNull( identity )) {
+HXLINE(1424) value = identity->name;
+ }
+ else {
+HXLINE(1424) value = null();
+ }
+HXDLIN(1424) ::Reflect_obj::setField(conf->attr,HX_("name",4b,72,ff,48),value);
+ }
+HXLINE(1426) bool _hx_tmp;
+HXDLIN(1426) bool _hx_tmp1;
+HXDLIN(1426) if ((( (::String)(::Reflect_obj::field(conf->attr,HX_("autojoin",d9,f6,b1,3e))) ) != HX_("1",31,00,00,00))) {
+HXLINE(1426) _hx_tmp1 = (( (::String)(::Reflect_obj::field(conf->attr,HX_("autojoin",d9,f6,b1,3e))) ) == HX_("true",4e,a7,03,4d));
+ }
+ else {
+HXLINE(1426) _hx_tmp1 = true;
+ }
+HXDLIN(1426) if (!(_hx_tmp1)) {
+HXLINE(1426) _hx_tmp = !(caps->isChannel(( (::String)(::Reflect_obj::field(item->attr,HX_("id",db,5b,00,00))) )));
+ }
+ else {
+HXLINE(1426) _hx_tmp = true;
+ }
+HXDLIN(1426) if (_hx_tmp) {
+HXLINE(1426) return 1;
+ }
+ else {
+HXLINE(1426) return 2;
+ }
+HXDLIN(1426) return null();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_5, ::snikket::Stanza,item) HXARGC(1)
+ void _hx_run( ::snikket::Chat chat){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1429_bookmarksGet)
+HXLINE(1429) chat->updateFromBookmark(item);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE(1418) ::snikket::Client _gthis2 = _gthis;
+HXDLIN(1418) _gthis2->startChatWith(( (::String)(::Reflect_obj::field(item->attr,HX_("id",db,5b,00,00))) ), ::Dynamic(new _hx_Closure_4(item)), ::Dynamic(new _hx_Closure_5(item)));
+ }
+ else {
+HXLINE(1433) chat->updateFromBookmark(item);
+HXLINE(1434) chatsToUpdate->push(chat);
+ }
+ }
+ }
+ }
+HXLINE(1438) ::Dynamic _gthis3 = _gthis->persistence;
+HXDLIN(1438) ::snikket::Persistence_obj::storeChats(_gthis3,_gthis->accountId(),chatsToUpdate);
+HXLINE(1439) callback();
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1383_bookmarksGet)
+HXDLIN(1383) ::snikket::Client _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE(1384) ::snikket::queries::BlocklistGet blockingGet = ::snikket::queries::BlocklistGet_obj::__alloc( HX_CTX );
+HXLINE(1385) blockingGet->onFinished( ::Dynamic(new _hx_Closure_0(_gthis,blockingGet)));
+HXLINE(1390) this->sendQuery(blockingGet);
+HXLINE(1392) ::snikket::queries::PubsubGet mdsGet = ::snikket::queries::PubsubGet_obj::__alloc( HX_CTX ,null(),HX_("urn:xmpp:mds:displayed:0",bd,60,cc,fb),null());
+HXLINE(1393) mdsGet->onFinished( ::Dynamic(new _hx_Closure_3(_gthis,mdsGet)));
+HXLINE(1409) this->sendQuery(mdsGet);
+HXLINE(1411) ::snikket::queries::PubsubGet pubsubGet = ::snikket::queries::PubsubGet_obj::__alloc( HX_CTX ,null(),HX_("urn:xmpp:bookmarks:1",58,3c,53,7d),null());
+HXLINE(1412) pubsubGet->onFinished( ::Dynamic(new _hx_Closure_6(_gthis,pubsubGet,callback)));
+HXLINE(1441) this->sendQuery(pubsubGet);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,bookmarksGet,(void))
+
+void Client_obj::sync( ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1444_sync)
+HXDLIN(1444) ::snikket::Client _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE(1445) if (::Std_obj::isOfType(this->persistence,::hx::ClassOf< ::snikket::persistence::Dummy >())) {
+HXLINE(1446) callback(true);
+ }
+ else {
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0, ::snikket::Client,_gthis, ::Dynamic,callback) HXARGC(1)
+ void _hx_run(::String lastId){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1448_sync)
+HXLINE(1448) _gthis->doSync(callback,lastId);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE(1448) ::Dynamic _hx_tmp = this->persistence;
+HXDLIN(1448) ::snikket::Persistence_obj::lastId(_hx_tmp,this->accountId(),null(), ::Dynamic(new _hx_Closure_0(_gthis,callback)));
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,sync,(void))
+
+void Client_obj::onMAMJMI(::String sid, ::snikket::Stanza stanza){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1452_onMAMJMI)
+HXLINE(1453) if (::hx::IsNull( ( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) ) )) {
+HXLINE(1453) return;
+ }
+HXLINE(1454) ::snikket::JID from = ::snikket::JID_obj::parse(( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) ));
+HXLINE(1455) ::snikket::DirectChat chat = this->getDirectChat(from->asBare()->asString(),null());
+HXLINE(1456) if (chat->jingleSessions->exists(sid)) {
+HXLINE(1456) return;
+ }
+HXLINE(1457) ::snikket::Stanza jmiP = stanza->getChild(HX_("propose",fe,fe,e9,f9),HX_("urn:xmpp:jingle-message:0",fd,20,a5,07));
+HXLINE(1458) if (::hx::IsNull( jmiP )) {
+HXLINE(1458) return;
+ }
+HXLINE(1459) ::snikket::jingle::IncomingProposedSession session = ::snikket::jingle::IncomingProposedSession_obj::__alloc( HX_CTX ,::hx::ObjectPtr<OBJ_>(this),from,sid);
+HXLINE(1460) {
+HXLINE(1460) ::Dynamic this1 = chat->jingleSessions;
+HXDLIN(1460) ( ( ::haxe::ds::StringMap)(this1) )->set(session->get_sid(),session);
+ }
+HXLINE(1461) this->chatActivity(chat,null());
+HXLINE(1462) session->ring();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Client_obj,onMAMJMI,(void))
+
+void Client_obj::doSync( ::Dynamic callback,::String lastId){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(2)
+ ::snikket::ChatMessageBuilder _hx_run( ::snikket::ChatMessageBuilder builder, ::snikket::Stanza stanza){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1475_doSync)
+HXLINE(1476) builder->syncPoint = true;
+HXLINE(1477) return builder;
+ }
+ HX_END_LOCAL_FUNC2(return)
+
+ HX_BEGIN_LOCAL_FUNC_S4(::hx::LocalFunc,_hx_Closure_8, ::snikket::Client,_gthis, ::haxe::ds::StringMap,chatIds, ::snikket::MessageSync,sync1, ::Dynamic,callback) HXARGC(1)
+ void _hx_run( ::Dynamic messageList){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_5, ::snikket::Client,_gthis,::Array< ::Dynamic>,chatMessages) HXARGC(2)
+ void _hx_run( ::Dynamic resolve, ::Dynamic reject){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1501_doSync)
+HXLINE(1501) ::Dynamic _gthis1 = _gthis->persistence;
+HXDLIN(1501) ::String _hx_tmp = _gthis->accountId();
+HXDLIN(1501) ::snikket::Persistence_obj::storeMessages(_gthis1,_hx_tmp,chatMessages,resolve);
+ }
+ HX_END_LOCAL_FUNC2((void))
+
+ HX_BEGIN_LOCAL_FUNC_S4(::hx::LocalFunc,_hx_Closure_6, ::snikket::Client,_gthis, ::haxe::ds::StringMap,chatIds, ::snikket::MessageSync,sync1, ::Dynamic,callback) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> results){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1504_doSync)
+HXLINE(1505) if ((_gthis->syncMessageHandlers->length > 0)) {
+HXLINE(1506) int _g = 0;
+HXDLIN(1506) while((_g < results->length)){
+HXLINE(1506) ::Array< ::Dynamic> messages = results->__get(_g).StaticCast< ::Array< ::Dynamic> >();
+HXDLIN(1506) _g = (_g + 1);
+HXLINE(1507) if (::hx::IsNotNull( messages )) {
+HXLINE(1508) int _g1 = 0;
+HXDLIN(1508) while((_g1 < messages->length)){
+HXLINE(1508) ::snikket::ChatMessage message = messages->__get(_g1).StaticCast< ::snikket::ChatMessage >();
+HXDLIN(1508) _g1 = (_g1 + 1);
+HXLINE(1509) _gthis->notifySyncMessageHandlers(message);
+ }
+ }
+ }
+ }
+HXLINE(1515) if (sync1->hasMore()) {
+HXLINE(1516) sync1->fetchNext();
+ }
+ else {
+HXLINE(1518) {
+HXLINE(1518) ::Dynamic map = sync1->jmi;
+HXDLIN(1518) ::Dynamic _g_map = map;
+HXDLIN(1518) ::Dynamic _g_keys = ::haxe::IMap_obj::keys(map);
+HXDLIN(1518) while(( (bool)(_g_keys->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE(1518) ::String key = ( (::String)(_g_keys->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXDLIN(1518) ::snikket::Stanza _g_value = ( ( ::snikket::Stanza)(::haxe::IMap_obj::get(_g_map,key)) );
+HXDLIN(1518) ::String _g_key = key;
+HXDLIN(1518) ::String sid = _g_key;
+HXDLIN(1518) ::snikket::Stanza stanza = _g_value;
+HXLINE(1519) _gthis->onMAMJMI(sid,stanza);
+ }
+ }
+HXLINE(1521) {
+HXLINE(1521) ::Dynamic map1 = chatIds;
+HXDLIN(1521) ::Dynamic _g_map1 = map1;
+HXDLIN(1521) ::Dynamic _g_keys1 = ::haxe::IMap_obj::keys(map1);
+HXDLIN(1521) while(( (bool)(_g_keys1->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE(1521) ::String key1 = ( (::String)(_g_keys1->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXDLIN(1521) bool _g_value1 = ( (bool)(::haxe::IMap_obj::get(_g_map1,key1)) );
+HXDLIN(1521) ::String _g_key1 = key1;
+HXDLIN(1521) ::String chatId = _g_key1;
+HXDLIN(1521) bool _ = _g_value1;
+HXDLIN(1521) {
+HXLINE(1523) ::snikket::Chat chat = _gthis->getChat(chatId);
+HXLINE(1524) if (::hx::IsNull( chat )) {
+HXLINE(1524) _gthis->getDirectChat(chatId,null());
+ }
+ }
+ }
+ }
+HXLINE(1526) if (::hx::IsNotNull( callback )) {
+HXLINE(1526) callback(true);
+ }
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_7, ::Dynamic,callback) HXARGC(1)
+ void _hx_run( ::Dynamic e){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1529_doSync)
+HXLINE(1530) ::Dynamic _hx_tmp = ::haxe::Log_obj::trace;
+HXDLIN(1530) ::String _hx_tmp1;
+HXDLIN(1530) if (::hx::IsNull( e )) {
+HXLINE(1530) _hx_tmp1 = HX_("null",87,9e,0e,49);
+ }
+ else {
+HXLINE(1530) _hx_tmp1 = ::Std_obj::string(e);
+ }
+HXDLIN(1530) _hx_tmp(HX_("SYNC: error",67,8e,34,8a), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.Client",3c,fe,06,7c))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,_hx_tmp1))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("doSync",86,5f,63,1c))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/Client.hx",e1,49,02,18))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),1530)));
+HXLINE(1531) callback(false);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1480_doSync)
+HXLINE(1481) ::Array< ::Dynamic> promises = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE(1482) ::Array< ::Dynamic> chatMessages = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE(1483) {
+HXLINE(1483) int _g = 0;
+HXDLIN(1483) ::Array< ::Dynamic> _g1 = ( (::Array< ::Dynamic>)(messageList->__Field(HX_("messages",cc,d8,fd,34),::hx::paccDynamic)) );
+HXDLIN(1483) while((_g < _g1->length)){
+HXLINE(1483) ::snikket::MessageStanza m = _g1->__get(_g).StaticCast< ::snikket::MessageStanza >();
+HXDLIN(1483) _g = (_g + 1);
+HXLINE(1484) switch((int)(m->_hx_getIndex())){
+ case (int)1: {
+HXLINE(1485) ::snikket::ChatMessage message = m->_hx_getObject(0).StaticCast< ::snikket::ChatMessage >();
+HXDLIN(1485) {
+HXLINE(1486) chatMessages->push(message);
+HXLINE(1487) if ((message->type == 0)) {
+HXLINE(1487) ::String k = message->chatId();
+HXDLIN(1487) chatIds->set(k,true);
+ }
+ }
+ }
+ break;
+ case (int)2: {
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_2, ::snikket::Client,_gthis, ::snikket::ModerationAction,action) HXARGC(2)
+ void _hx_run( ::Dynamic resolve, ::Dynamic reject){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_1, ::Dynamic,resolve) HXARGC(1)
+ void _hx_run( ::snikket::ChatMessage _){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1494_doSync)
+HXLINE(1494) resolve(null());
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1494_doSync)
+HXLINE(1494) ::thenshim::_Promise::Promise_Impl__obj::then(_gthis->moderateMessage(action), ::Dynamic(new _hx_Closure_1(resolve)),null());
+ }
+ HX_END_LOCAL_FUNC2((void))
+
+HXLINE(1492) ::snikket::ModerationAction action = m->_hx_getObject(0).StaticCast< ::snikket::ModerationAction >();
+HXLINE(1493) promises->push(::thenshim::_Promise::Promise_Impl__obj::_new( ::Dynamic(new _hx_Closure_2(_gthis,action))));
+ }
+ break;
+ case (int)3: {
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_4, ::snikket::Client,_gthis, ::snikket::ReactionUpdate,update) HXARGC(2)
+ void _hx_run( ::Dynamic resolve, ::Dynamic reject){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_3, ::Dynamic,resolve) HXARGC(1)
+ void _hx_run( ::snikket::ChatMessage _){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1490_doSync)
+HXLINE(1490) resolve(null());
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1490_doSync)
+HXLINE(1490) ::Dynamic _gthis1 = _gthis->persistence;
+HXDLIN(1490) ::String _hx_tmp = _gthis->accountId();
+HXDLIN(1490) ::snikket::Persistence_obj::storeReaction(_gthis1,_hx_tmp,update, ::Dynamic(new _hx_Closure_3(resolve)));
+ }
+ HX_END_LOCAL_FUNC2((void))
+
+HXLINE(1488) ::snikket::ReactionUpdate update = m->_hx_getObject(0).StaticCast< ::snikket::ReactionUpdate >();
+HXLINE(1489) promises->push(::thenshim::_Promise::Promise_Impl__obj::_new( ::Dynamic(new _hx_Closure_4(_gthis,update))));
+ }
+ break;
+ default:{
+ }
+ }
+ }
+ }
+HXLINE(1500) promises->push(::thenshim::_Promise::Promise_Impl__obj::_new( ::Dynamic(new _hx_Closure_5(_gthis,chatMessages))));
+HXLINE(1503) ::haxe::Log_obj::trace(HX_("SYNC: MAM page wait for writes",ad,4c,95,21),::hx::SourceInfo(HX_("snikket/Client.hx",e1,49,02,18),1503,HX_("snikket.Client",3c,fe,06,7c),HX_("doSync",86,5f,63,1c)));
+HXLINE(1504) ::thenshim::_Promise::Promise_Impl__obj::then(::thenshim::PromiseTools_obj::all(promises), ::Dynamic(new _hx_Closure_6(_gthis,chatIds,sync1,callback)), ::Dynamic(new _hx_Closure_7(callback)));
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_9, ::snikket::Client,_gthis,::String,lastId, ::Dynamic,callback) HXARGC(1)
+ void _hx_run( ::snikket::Stanza stanza){
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1535_doSync)
+HXLINE(1535) if (::hx::IsNotNull( lastId )) {
+HXLINE(1537) _gthis->doSync(callback,null());
+ }
+ else {
+HXLINE(1539) ::haxe::Log_obj::trace(HX_("SYNC: error",67,8e,34,8a), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.Client",3c,fe,06,7c))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,stanza))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("doSync",86,5f,63,1c))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/Client.hx",e1,49,02,18))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),1539)));
+HXLINE(1540) if (::hx::IsNotNull( callback )) {
+HXLINE(1540) callback(false);
+ }
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1465_doSync)
+HXDLIN(1465) ::snikket::Client _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE(1466) ::String thirtyDaysAgo = ::snikket::Date_obj::format(::Date_obj::fromTime((::Date_obj::now()->getTime() + ((Float)-2592000000.))));
+HXLINE(1472) ::Dynamic sync;
+HXDLIN(1472) if (::hx::IsNull( lastId )) {
+HXLINE(1472) sync = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("startTime",8f,45,f0,05),thirtyDaysAgo));
+ }
+ else {
+HXLINE(1472) sync = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("page",4f,da,51,4a), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("after",1c,66,a2,1d),lastId))));
+ }
+HXLINE(1469) ::snikket::MessageSync sync1 = ::snikket::MessageSync_obj::__alloc( HX_CTX ,::hx::ObjectPtr<OBJ_>(this),this->stream,sync,null());
+HXLINE(1474) sync1->setNewestPageFirst(false);
+HXLINE(1475) sync1->addContext( ::Dynamic(new _hx_Closure_0()));
+HXLINE(1479) ::haxe::ds::StringMap chatIds = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXLINE(1480) sync1->onMessages( ::Dynamic(new _hx_Closure_8(_gthis,chatIds,sync1,callback)));
+HXLINE(1534) sync1->onError( ::Dynamic(new _hx_Closure_9(_gthis,lastId,callback)));
+HXLINE(1543) sync1->fetchNext();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Client_obj,doSync,(void))
+
+void Client_obj::pingAllChannels(bool refresh){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1547_pingAllChannels)
+HXDLIN(1547) int _g = 0;
+HXDLIN(1547) ::Array< ::Dynamic> _g1 = this->getChats();
+HXDLIN(1547) while((_g < _g1->length)){
+HXDLIN(1547) ::snikket::Chat chat = _g1->__get(_g).StaticCast< ::snikket::Chat >();
+HXDLIN(1547) _g = (_g + 1);
+HXLINE(1548) ::snikket::Channel channel = ( ( ::snikket::Channel)(::Std_obj::downcast(chat,::hx::ClassOf< ::snikket::Channel >())) );
+HXLINE(1549) if (::hx::IsNotNull( channel )) {
+HXLINE(1549) bool _hx_tmp;
+HXDLIN(1549) if (!(refresh)) {
+HXLINE(1549) ::snikket::Caps _hx_tmp1;
+HXDLIN(1549) if (::hx::IsNotNull( channel )) {
+HXLINE(1549) _hx_tmp1 = channel->disco;
+ }
+ else {
+HXLINE(1549) _hx_tmp1 = null();
+ }
+HXDLIN(1549) _hx_tmp = ::hx::IsNull( _hx_tmp1 );
+ }
+ else {
+HXLINE(1549) _hx_tmp = true;
+ }
+HXDLIN(1549) channel->selfPing(_hx_tmp);
+ }
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Client_obj,pingAllChannels,(void))
+
+void Client_obj::joinAllChannels(){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1554_joinAllChannels)
+HXDLIN(1554) int _g = 0;
+HXDLIN(1554) ::Array< ::Dynamic> _g1 = this->getChats();
+HXDLIN(1554) while((_g < _g1->length)){
+HXDLIN(1554) ::snikket::Chat chat = _g1->__get(_g).StaticCast< ::snikket::Chat >();
+HXDLIN(1554) _g = (_g + 1);
+HXLINE(1555) ::snikket::Channel channel = ( ( ::snikket::Channel)(::Std_obj::downcast(chat,::hx::ClassOf< ::snikket::Channel >())) );
+HXLINE(1556) if (::hx::IsNotNull( channel )) {
+HXLINE(1557) if ((channel->disco->identities->length < 1)) {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::Channel,channel) HXARGC(0)
+ void _hx_run(){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1559_joinAllChannels)
+HXLINE(1559) channel->join();
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+HXLINE(1558) channel->refreshDisco( ::Dynamic(new _hx_Closure_0(channel)));
+ }
+ else {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_1, ::snikket::Channel,channel) HXARGC(0)
+ void _hx_run(){
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_1563_joinAllChannels)
+HXLINE(1563) channel->refreshDisco(null());
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+HXLINE(1562) channel->join();
+HXLINE(1563) ::haxe::Timer_obj::delay( ::Dynamic(new _hx_Closure_1(channel)),30000);
+ }
+ }
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Client_obj,joinAllChannels,(void))
+
+
+::hx::ObjectPtr< Client_obj > Client_obj::__new(::String address,::Dynamic persistence) {
+ ::hx::ObjectPtr< Client_obj > __this = new Client_obj();
+ __this->__construct(address,persistence);
+ return __this;
+}
+
+::hx::ObjectPtr< Client_obj > Client_obj::__alloc(::hx::Ctx *_hx_ctx,::String address,::Dynamic persistence) {
+ Client_obj *__this = (Client_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Client_obj), true, "snikket.Client"));
+ *(void **)__this = Client_obj::_hx_vtable;
+ __this->__construct(address,persistence);
+ return __this;
+}
+
+Client_obj::Client_obj()
+{
+}
+
+void Client_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(Client);
+ HX_MARK_MEMBER_NAME(sendAvailable,"sendAvailable");
+ HX_MARK_MEMBER_NAME(stream,"stream");
+ HX_MARK_MEMBER_NAME(chatMessageHandlers,"chatMessageHandlers");
+ HX_MARK_MEMBER_NAME(syncMessageHandlers,"syncMessageHandlers");
+ HX_MARK_MEMBER_NAME(chatStateHandlers,"chatStateHandlers");
+ HX_MARK_MEMBER_NAME(jid,"jid");
+ HX_MARK_MEMBER_NAME(chats,"chats");
+ HX_MARK_MEMBER_NAME(persistence,"persistence");
+ HX_MARK_MEMBER_NAME(caps,"caps");
+ HX_MARK_MEMBER_NAME(_displayName,"_displayName");
+ HX_MARK_MEMBER_NAME(fastMechanism,"fastMechanism");
+ HX_MARK_MEMBER_NAME(token,"token");
+ HX_MARK_MEMBER_NAME(pendingCaps,"pendingCaps");
+ HX_MARK_MEMBER_NAME(inSync,"inSync");
+ ::snikket::EventEmitter_obj::__Mark(HX_MARK_ARG);
+ HX_MARK_END_CLASS();
+}
+
+void Client_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(sendAvailable,"sendAvailable");
+ HX_VISIT_MEMBER_NAME(stream,"stream");
+ HX_VISIT_MEMBER_NAME(chatMessageHandlers,"chatMessageHandlers");
+ HX_VISIT_MEMBER_NAME(syncMessageHandlers,"syncMessageHandlers");
+ HX_VISIT_MEMBER_NAME(chatStateHandlers,"chatStateHandlers");
+ HX_VISIT_MEMBER_NAME(jid,"jid");
+ HX_VISIT_MEMBER_NAME(chats,"chats");
+ HX_VISIT_MEMBER_NAME(persistence,"persistence");
+ HX_VISIT_MEMBER_NAME(caps,"caps");
+ HX_VISIT_MEMBER_NAME(_displayName,"_displayName");
+ HX_VISIT_MEMBER_NAME(fastMechanism,"fastMechanism");
+ HX_VISIT_MEMBER_NAME(token,"token");
+ HX_VISIT_MEMBER_NAME(pendingCaps,"pendingCaps");
+ HX_VISIT_MEMBER_NAME(inSync,"inSync");
+ ::snikket::EventEmitter_obj::__Visit(HX_VISIT_ARG);
+}
+
+::hx::Val Client_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"jid") ) { return ::hx::Val( jid ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"caps") ) { return ::hx::Val( caps ); }
+ if (HX_FIELD_EQ(inName,"sync") ) { return ::hx::Val( sync_dyn() ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"chats") ) { return ::hx::Val( chats ); }
+ if (HX_FIELD_EQ(inName,"token") ) { return ::hx::Val( token ); }
+ if (HX_FIELD_EQ(inName,"start") ) { return ::hx::Val( start_dyn() ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"stream") ) { return ::hx::Val( stream ); }
+ if (HX_FIELD_EQ(inName,"inSync") ) { return ::hx::Val( inSync ); }
+ if (HX_FIELD_EQ(inName,"logout") ) { return ::hx::Val( logout_dyn() ); }
+ if (HX_FIELD_EQ(inName,"doSync") ) { return ::hx::Val( doSync_dyn() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"getChat") ) { return ::hx::Val( getChat_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"getChats") ) { return ::hx::Val( getChats_dyn() ); }
+ if (HX_FIELD_EQ(inName,"onMAMJMI") ) { return ::hx::Val( onMAMJMI_dyn() ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"accountId") ) { return ::hx::Val( accountId_dyn() ); }
+ if (HX_FIELD_EQ(inName,"startChat") ) { return ::hx::Val( startChat_dyn() ); }
+ if (HX_FIELD_EQ(inName,"sortChats") ) { return ::hx::Val( sortChats_dyn() ); }
+ if (HX_FIELD_EQ(inName,"sendQuery") ) { return ::hx::Val( sendQuery_dyn() ); }
+ if (HX_FIELD_EQ(inName,"rosterGet") ) { return ::hx::Val( rosterGet_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"sendStanza") ) { return ::hx::Val( sendStanza_dyn() ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"persistence") ) { return ::hx::Val( persistence ); }
+ if (HX_FIELD_EQ(inName,"pendingCaps") ) { return ::hx::Val( pendingCaps ); }
+ if (HX_FIELD_EQ(inName,"usePassword") ) { return ::hx::Val( usePassword_dyn() ); }
+ if (HX_FIELD_EQ(inName,"displayName") ) { return ::hx::Val( displayName_dyn() ); }
+ if (HX_FIELD_EQ(inName,"onConnected") ) { return ::hx::Val( onConnected_dyn() ); }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"_displayName") ) { return ::hx::Val( _displayName ); }
+ if (HX_FIELD_EQ(inName,"chatActivity") ) { return ::hx::Val( chatActivity_dyn() ); }
+ if (HX_FIELD_EQ(inName,"sendPresence") ) { return ::hx::Val( sendPresence_dyn() ); }
+ if (HX_FIELD_EQ(inName,"bookmarksGet") ) { return ::hx::Val( bookmarksGet_dyn() ); }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"sendAvailable") ) { return ::hx::Val( sendAvailable ); }
+ if (HX_FIELD_EQ(inName,"fastMechanism") ) { return ::hx::Val( fastMechanism ); }
+ if (HX_FIELD_EQ(inName,"getDirectChat") ) { return ::hx::Val( getDirectChat_dyn() ); }
+ if (HX_FIELD_EQ(inName,"storeMessages") ) { return ::hx::Val( storeMessages_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getIceServers") ) { return ::hx::Val( getIceServers_dyn() ); }
+ if (HX_FIELD_EQ(inName,"startChatWith") ) { return ::hx::Val( startChatWith_dyn() ); }
+ if (HX_FIELD_EQ(inName,"serverBlocked") ) { return ::hx::Val( serverBlocked_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"setDisplayName") ) { return ::hx::Val( setDisplayName_dyn() ); }
+ break;
+ case 15:
+ if (HX_FIELD_EQ(inName,"moderateMessage") ) { return ::hx::Val( moderateMessage_dyn() ); }
+ if (HX_FIELD_EQ(inName,"setInForeground") ) { return ::hx::Val( setInForeground_dyn() ); }
+ if (HX_FIELD_EQ(inName,"pingAllChannels") ) { return ::hx::Val( pingAllChannels_dyn() ); }
+ if (HX_FIELD_EQ(inName,"joinAllChannels") ) { return ::hx::Val( joinAllChannels_dyn() ); }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"fetchMediaByHash") ) { return ::hx::Val( fetchMediaByHash_dyn() ); }
+ if (HX_FIELD_EQ(inName,"discoverServices") ) { return ::hx::Val( discoverServices_dyn() ); }
+ break;
+ case 17:
+ if (HX_FIELD_EQ(inName,"chatStateHandlers") ) { return ::hx::Val( chatStateHandlers ); }
+ if (HX_FIELD_EQ(inName,"updateDisplayName") ) { return ::hx::Val( updateDisplayName_dyn() ); }
+ if (HX_FIELD_EQ(inName,"prepareAttachment") ) { return ::hx::Val( prepareAttachment_dyn() ); }
+ break;
+ case 18:
+ if (HX_FIELD_EQ(inName,"findAvailableChats") ) { return ::hx::Val( findAvailableChats_dyn() ); }
+ if (HX_FIELD_EQ(inName,"setNotInForeground") ) { return ::hx::Val( setNotInForeground_dyn() ); }
+ break;
+ case 19:
+ if (HX_FIELD_EQ(inName,"chatMessageHandlers") ) { return ::hx::Val( chatMessageHandlers ); }
+ if (HX_FIELD_EQ(inName,"syncMessageHandlers") ) { return ::hx::Val( syncMessageHandlers ); }
+ if (HX_FIELD_EQ(inName,"addCallRingListener") ) { return ::hx::Val( addCallRingListener_dyn() ); }
+ break;
+ case 20:
+ if (HX_FIELD_EQ(inName,"prepareAttachmentFor") ) { return ::hx::Val( prepareAttachmentFor_dyn() ); }
+ if (HX_FIELD_EQ(inName,"addCallMediaListener") ) { return ::hx::Val( addCallMediaListener_dyn() ); }
+ if (HX_FIELD_EQ(inName,"addCallTrackListener") ) { return ::hx::Val( addCallTrackListener_dyn() ); }
+ break;
+ case 21:
+ if (HX_FIELD_EQ(inName,"notifyMessageHandlers") ) { return ::hx::Val( notifyMessageHandlers_dyn() ); }
+ break;
+ case 22:
+ if (HX_FIELD_EQ(inName,"addChatMessageListener") ) { return ::hx::Val( addChatMessageListener_dyn() ); }
+ if (HX_FIELD_EQ(inName,"addSyncMessageListener") ) { return ::hx::Val( addSyncMessageListener_dyn() ); }
+ if (HX_FIELD_EQ(inName,"addCallRetractListener") ) { return ::hx::Val( addCallRetractListener_dyn() ); }
+ if (HX_FIELD_EQ(inName,"addCallRingingListener") ) { return ::hx::Val( addCallRingingListener_dyn() ); }
+ break;
+ case 23:
+ if (HX_FIELD_EQ(inName,"addStatusOnlineListener") ) { return ::hx::Val( addStatusOnlineListener_dyn() ); }
+ if (HX_FIELD_EQ(inName,"addChatsUpdatedListener") ) { return ::hx::Val( addChatsUpdatedListener_dyn() ); }
+ break;
+ case 24:
+ if (HX_FIELD_EQ(inName,"set_sendAvailable__fromC") ) { return ::hx::Val( set_sendAvailable__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"addStatusOfflineListener") ) { return ::hx::Val( addStatusOfflineListener_dyn() ); }
+ break;
+ case 25:
+ if (HX_FIELD_EQ(inName,"addPasswordNeededListener") ) { return ::hx::Val( addPasswordNeededListener_dyn() ); }
+ if (HX_FIELD_EQ(inName,"notifySyncMessageHandlers") ) { return ::hx::Val( notifySyncMessageHandlers_dyn() ); }
+ break;
+ case 27:
+ if (HX_FIELD_EQ(inName,"addConnectionFailedListener") ) { return ::hx::Val( addConnectionFailedListener_dyn() ); }
+ break;
+ case 30:
+ if (HX_FIELD_EQ(inName,"fetchMediaByHashOneCounterpart") ) { return ::hx::Val( fetchMediaByHashOneCounterpart_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val Client_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"jid") ) { jid=inValue.Cast< ::snikket::JID >(); return inValue; }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"caps") ) { caps=inValue.Cast< ::snikket::Caps >(); return inValue; }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"chats") ) { chats=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"token") ) { token=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"stream") ) { stream=inValue.Cast< ::snikket::GenericStream >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"inSync") ) { inSync=inValue.Cast< bool >(); return inValue; }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"persistence") ) { persistence=inValue.Cast< ::Dynamic >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"pendingCaps") ) { pendingCaps=inValue.Cast< ::haxe::ds::StringMap >(); return inValue; }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"_displayName") ) { _displayName=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"sendAvailable") ) { sendAvailable=inValue.Cast< bool >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"fastMechanism") ) { fastMechanism=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 17:
+ if (HX_FIELD_EQ(inName,"chatStateHandlers") ) { chatStateHandlers=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ break;
+ case 19:
+ if (HX_FIELD_EQ(inName,"chatMessageHandlers") ) { chatMessageHandlers=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"syncMessageHandlers") ) { syncMessageHandlers=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void Client_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("sendAvailable",61,c3,fd,db));
+ outFields->push(HX_("stream",80,14,2d,11));
+ outFields->push(HX_("chatMessageHandlers",58,ce,b5,e3));
+ outFields->push(HX_("syncMessageHandlers",35,de,58,d9));
+ outFields->push(HX_("chatStateHandlers",a2,d6,fb,7f));
+ outFields->push(HX_("jid",c5,ca,50,00));
+ outFields->push(HX_("chats",9b,9e,b3,45));
+ outFields->push(HX_("persistence",5f,17,c4,f6));
+ outFields->push(HX_("caps",21,1c,ba,41));
+ outFields->push(HX_("_displayName",ae,bf,fb,96));
+ outFields->push(HX_("fastMechanism",1d,e7,34,8a));
+ outFields->push(HX_("token",f9,82,2b,14));
+ outFields->push(HX_("pendingCaps",18,58,88,be));
+ outFields->push(HX_("inSync",e0,98,c5,88));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Client_obj_sMemberStorageInfo[] = {
+ {::hx::fsBool,(int)offsetof(Client_obj,sendAvailable),HX_("sendAvailable",61,c3,fd,db)},
+ {::hx::fsObject /* ::snikket::GenericStream */ ,(int)offsetof(Client_obj,stream),HX_("stream",80,14,2d,11)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(Client_obj,chatMessageHandlers),HX_("chatMessageHandlers",58,ce,b5,e3)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(Client_obj,syncMessageHandlers),HX_("syncMessageHandlers",35,de,58,d9)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(Client_obj,chatStateHandlers),HX_("chatStateHandlers",a2,d6,fb,7f)},
+ {::hx::fsObject /* ::snikket::JID */ ,(int)offsetof(Client_obj,jid),HX_("jid",c5,ca,50,00)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(Client_obj,chats),HX_("chats",9b,9e,b3,45)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(Client_obj,persistence),HX_("persistence",5f,17,c4,f6)},
+ {::hx::fsObject /* ::snikket::Caps */ ,(int)offsetof(Client_obj,caps),HX_("caps",21,1c,ba,41)},
+ {::hx::fsString,(int)offsetof(Client_obj,_displayName),HX_("_displayName",ae,bf,fb,96)},
+ {::hx::fsString,(int)offsetof(Client_obj,fastMechanism),HX_("fastMechanism",1d,e7,34,8a)},
+ {::hx::fsString,(int)offsetof(Client_obj,token),HX_("token",f9,82,2b,14)},
+ {::hx::fsObject /* ::haxe::ds::StringMap */ ,(int)offsetof(Client_obj,pendingCaps),HX_("pendingCaps",18,58,88,be)},
+ {::hx::fsBool,(int)offsetof(Client_obj,inSync),HX_("inSync",e0,98,c5,88)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *Client_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Client_obj_sMemberFields[] = {
+ HX_("sendAvailable",61,c3,fd,db),
+ HX_("set_sendAvailable__fromC",35,ea,10,2d),
+ HX_("stream",80,14,2d,11),
+ HX_("chatMessageHandlers",58,ce,b5,e3),
+ HX_("syncMessageHandlers",35,de,58,d9),
+ HX_("chatStateHandlers",a2,d6,fb,7f),
+ HX_("jid",c5,ca,50,00),
+ HX_("chats",9b,9e,b3,45),
+ HX_("persistence",5f,17,c4,f6),
+ HX_("caps",21,1c,ba,41),
+ HX_("_displayName",ae,bf,fb,96),
+ HX_("fastMechanism",1d,e7,34,8a),
+ HX_("token",f9,82,2b,14),
+ HX_("pendingCaps",18,58,88,be),
+ HX_("inSync",e0,98,c5,88),
+ HX_("start",62,74,0b,84),
+ HX_("logout",8a,f6,6e,5c),
+ HX_("usePassword",82,2a,db,a2),
+ HX_("accountId",e8,81,54,29),
+ HX_("displayName",ad,11,f2,30),
+ HX_("setDisplayName",2b,4d,b0,d8),
+ HX_("updateDisplayName",24,be,5b,95),
+ HX_("onConnected",aa,c5,39,c5),
+ HX_("prepareAttachment",4a,6c,4b,52),
+ HX_("prepareAttachmentFor",df,5c,bf,82),
+ HX_("getChats",25,ae,8a,a5),
+ HX_("findAvailableChats",2b,92,7a,e4),
+ HX_("startChat",5a,d8,b2,fa),
+ HX_("getChat",8e,0e,42,14),
+ HX_("moderateMessage",44,98,f1,d4),
+ HX_("getDirectChat",d7,7a,64,6b),
+ HX_("addPasswordNeededListener",45,5f,7e,e2),
+ HX_("addStatusOnlineListener",ba,7f,0a,f9),
+ HX_("addStatusOfflineListener",84,03,7d,f1),
+ HX_("addConnectionFailedListener",50,7d,89,49),
+ HX_("addChatMessageListener",c2,ab,0f,ed),
+ HX_("addSyncMessageListener",9f,bb,b2,e2),
+ HX_("addChatsUpdatedListener",35,56,de,d1),
+ HX_("addCallRingListener",43,06,12,df),
+ HX_("addCallRetractListener",f6,56,33,1b),
+ HX_("addCallRingingListener",27,29,10,44),
+ HX_("addCallMediaListener",99,4a,d3,ce),
+ HX_("addCallTrackListener",40,53,e3,46),
+ HX_("setInForeground",ca,fb,6b,7d),
+ HX_("setNotInForeground",39,f1,bb,be),
+ HX_("fetchMediaByHash",2f,ff,07,87),
+ HX_("fetchMediaByHashOneCounterpart",b8,d3,9a,5e),
+ HX_("chatActivity",c7,e0,61,f8),
+ HX_("sortChats",5d,72,27,4e),
+ HX_("storeMessages",cd,f1,bd,e9),
+ HX_("sendQuery",a0,48,5a,1e),
+ HX_("sendStanza",5d,85,4d,a7),
+ HX_("sendPresence",a3,23,94,a7),
+ HX_("getIceServers",7b,70,bb,2e),
+ HX_("discoverServices",e7,e6,b6,cb),
+ HX_("notifyMessageHandlers",87,69,f5,7b),
+ HX_("notifySyncMessageHandlers",ec,fc,32,12),
+ HX_("rosterGet",cb,93,f3,3e),
+ HX_("startChatWith",80,af,e0,d4),
+ HX_("serverBlocked",69,86,62,0f),
+ HX_("bookmarksGet",99,e1,ce,2f),
+ HX_("sync",5b,ba,5f,4c),
+ HX_("onMAMJMI",ac,d7,bc,14),
+ HX_("doSync",86,5f,63,1c),
+ HX_("pingAllChannels",3f,9f,44,8e),
+ HX_("joinAllChannels",c7,60,e8,0f),
+ ::String(null()) };
+
+::hx::Class Client_obj::__mClass;
+
+void Client_obj::__register()
+{
+ Client_obj _hx_dummy;
+ Client_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.Client",3c,fe,06,7c);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Client_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Client_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Client_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Client_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void Client_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_ead56881d4bbcaca_51_boot)
+HXDLIN( 51) __mClass->__meta__ = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("fields",79,8e,8e,80), ::Dynamic(::hx::Anon_obj::Create(31)
+ ->setFixed(0,HX_("addChatsUpdatedListener__fromC",e4,7a,96,80), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(1,HX_("addSyncMessageListener__fromC",ba,f6,2b,88), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(2,HX_("addCallRingingListener__fromC",32,ca,d2,99), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(3,HX_("prepareAttachment__fromC",6f,81,bb,9e), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(4,HX_("addCallRingListener__fromC",96,08,fb,9e), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(5,HX_("addStatusOnlineListener__fromC",ff,bb,66,a2), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(6,HX_("getChats",25,ae,8a,a5), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(7,HX_("addCallTrackListener__fromC",39,05,06,c4), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(8,HX_("addCallMediaListener",99,4a,d3,ce), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(9,HX_("findAvailableChats__fromC",ae,49,41,d0), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(10,HX_("addChatsUpdatedListener",35,56,de,d1), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(11,HX_("addConnectionFailedListener__fromC",29,3d,00,dc), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(12,HX_("addChatMessageListener__fromC",f7,a0,32,de), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(13,HX_("addCallRingListener",43,06,12,df), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(14,HX_("addPasswordNeededListener",45,5f,7e,e2), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(15,HX_("addSyncMessageListener",9f,bb,b2,e2), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(16,HX_("findAvailableChats",2b,92,7a,e4), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(17,HX_("addChatMessageListener",c2,ab,0f,ed), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(18,HX_("addStatusOfflineListener",84,03,7d,f1), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(19,HX_("addStatusOnlineListener",ba,7f,0a,f9), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(20,HX_("addCallRetractListener",f6,56,33,1b), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(21,HX_("addPasswordNeededListener__fromC",d4,b3,20,1d), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(22,HX_("set_sendAvailable__fromC",35,ea,10,2d), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(23,HX_("addCallMediaListener__fromC",00,9b,9c,36), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(24,HX_("addCallRingingListener",27,29,10,44), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(25,HX_("addCallTrackListener",40,53,e3,46), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(26,HX_("addConnectionFailedListener",50,7d,89,49), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(27,HX_("prepareAttachment",4a,6c,4b,52), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(28,HX_("addCallRetractListener__fromC",43,84,e9,5a), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(29,HX_("addStatusOfflineListener__fromC",75,a5,68,6e), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(30,HX_("getChats__fromC",f4,00,7e,7e), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null()))))));
+ }
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/Color.cpp b/Sources/c_snikket/src/snikket/Color.cpp
new file mode 100644
index 0000000..c99d263
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/Color.cpp
@@ -0,0 +1,135 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_StringTools
+#include <StringTools.h>
+#endif
+#ifndef INCLUDED_haxe_crypto_Sha1
+#include <haxe/crypto/Sha1.h>
+#endif
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+#ifndef INCLUDED_haxe_io_Encoding
+#include <haxe/io/Encoding.h>
+#endif
+#ifndef INCLUDED_hsluv_Hsluv
+#include <hsluv/Hsluv.h>
+#endif
+#ifndef INCLUDED_snikket_Color
+#include <snikket/Color.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_306a55eac438c23f_8_forString,"snikket.Color","forString",0x84e0cbde,"snikket.Color.forString","snikket/Color.hx",8,0x11a5cc6d)
+HX_LOCAL_STACK_FRAME(_hx_pos_306a55eac438c23f_19_defaultPhoto,"snikket.Color","defaultPhoto",0xe24b978d,"snikket.Color.defaultPhoto","snikket/Color.hx",19,0x11a5cc6d)
+namespace snikket{
+
+void Color_obj::__construct() { }
+
+Dynamic Color_obj::__CreateEmpty() { return new Color_obj; }
+
+void *Color_obj::_hx_vtable = 0;
+
+Dynamic Color_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Color_obj > _hx_result = new Color_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool Color_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x204ca266;
+}
+
+::String Color_obj::forString(::String s){
+ HX_GC_STACKFRAME(&_hx_pos_306a55eac438c23f_8_forString)
+HXLINE( 9) ::haxe::io::Bytes hash = ::haxe::crypto::Sha1_obj::make(::haxe::io::Bytes_obj::ofString(s,null()));
+HXLINE( 10) Float hue = ((( (Float)((( (int)(hash->b->__get(0)) ) | (( (int)(hash->b->__get(1)) ) << 8))) ) / ((Float)65536.0)) * ( (Float)(360) ));
+HXLINE( 11) ::hsluv::Hsluv color = ::hsluv::Hsluv_obj::__alloc( HX_CTX );
+HXLINE( 12) color->hsluv_h = hue;
+HXLINE( 13) color->hsluv_s = ( (Float)(100) );
+HXLINE( 14) color->hsluv_l = ( (Float)(50) );
+HXLINE( 15) color->hsluvToHex();
+HXLINE( 16) return color->hex;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Color_obj,forString,return )
+
+::String Color_obj::defaultPhoto(::String input,::String letter){
+ HX_STACKFRAME(&_hx_pos_306a55eac438c23f_19_defaultPhoto)
+HXLINE( 20) ::String hex = ::snikket::Color_obj::forString(input).substr(1,null());
+HXLINE( 21) ::String encodedLetter;
+HXDLIN( 21) try {
+ HX_STACK_CATCHABLE( ::Dynamic, 0);
+HXLINE( 21) encodedLetter = ::StringTools_obj::urlEncode(letter);
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::Dynamic >() ){
+ HX_STACK_BEGIN_CATCH
+ ::Dynamic _g = _hx_e;
+HXLINE( 21) encodedLetter = HX_(" ",20,00,00,00);
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+HXLINE( 26) return (((((((HX_("data:image/svg+xml,<svg%20xmlns=\"http://www.w3.org/2000/svg\"%20version=\"1.1\"%20width=\"15\"%20height=\"15\"%20viewBox=\"0%200%2015%2015\">",89,4c,ea,28) + HX_("<rect%20style=\"fill:%23",82,0d,df,69)) + hex) + HX_(";\"%20width=\"15\"%20height=\"15\"%20x=\"0\"%20y=\"0\"%20/>",3b,1a,d3,d0)) + HX_("<text%20style=\"fill:%23ffffff;font-size:8px;font-family:sans-serif;\"%20text-anchor=\"middle\"%20dominant-baseline=\"central\"%20x=\"50%25\"%20y=\"50%25\">",50,f0,e7,75)) + encodedLetter) + HX_("</text>",9e,15,67,97)) + HX_("</svg>",4d,57,9c,59));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Color_obj,defaultPhoto,return )
+
+
+Color_obj::Color_obj()
+{
+}
+
+bool Color_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 9:
+ if (HX_FIELD_EQ(inName,"forString") ) { outValue = forString_dyn(); return true; }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"defaultPhoto") ) { outValue = defaultPhoto_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *Color_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *Color_obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class Color_obj::__mClass;
+
+static ::String Color_obj_sStaticFields[] = {
+ HX_("forString",ba,d0,62,a3),
+ HX_("defaultPhoto",31,04,4f,77),
+ ::String(null())
+};
+
+void Color_obj::__register()
+{
+ Color_obj _hx_dummy;
+ Color_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.Color",92,c6,8f,a5);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Color_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Color_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< Color_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Color_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Color_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/Config.cpp b/Sources/c_snikket/src/snikket/Config.cpp
new file mode 100644
index 0000000..47c2eba
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/Config.cpp
@@ -0,0 +1,114 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_Config
+#include <snikket/Config.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_436f82850fb5d17e_11_boot,"snikket.Config","boot",0x250dffcd,"snikket.Config.boot","snikket/Config.hx",11,0x1047a1ca)
+namespace snikket{
+
+void Config_obj::__construct() { }
+
+Dynamic Config_obj::__CreateEmpty() { return new Config_obj; }
+
+void *Config_obj::_hx_vtable = 0;
+
+Dynamic Config_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Config_obj > _hx_result = new Config_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool Config_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x240d085f;
+}
+
+bool Config_obj::relativeHashUri;
+
+
+Config_obj::Config_obj()
+{
+}
+
+bool Config_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 15:
+ if (HX_FIELD_EQ(inName,"relativeHashUri") ) { outValue = ( relativeHashUri ); return true; }
+ }
+ return false;
+}
+
+bool Config_obj::__SetStatic(const ::String &inName,Dynamic &ioValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 15:
+ if (HX_FIELD_EQ(inName,"relativeHashUri") ) { relativeHashUri=ioValue.Cast< bool >(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *Config_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo Config_obj_sStaticStorageInfo[] = {
+ {::hx::fsBool,(void *) &Config_obj::relativeHashUri,HX_("relativeHashUri",d2,e4,68,83)},
+ { ::hx::fsUnknown, 0, null()}
+};
+#endif
+
+static void Config_obj_sMarkStatics(HX_MARK_PARAMS) {
+ HX_MARK_MEMBER_NAME(Config_obj::relativeHashUri,"relativeHashUri");
+};
+
+#ifdef HXCPP_VISIT_ALLOCS
+static void Config_obj_sVisitStatics(HX_VISIT_PARAMS) {
+ HX_VISIT_MEMBER_NAME(Config_obj::relativeHashUri,"relativeHashUri");
+};
+
+#endif
+
+::hx::Class Config_obj::__mClass;
+
+static ::String Config_obj_sStaticFields[] = {
+ HX_("relativeHashUri",d2,e4,68,83),
+ ::String(null())
+};
+
+void Config_obj::__register()
+{
+ Config_obj _hx_dummy;
+ Config_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.Config",b3,8a,89,39);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Config_obj::__GetStatic;
+ __mClass->mSetStaticField = &Config_obj::__SetStatic;
+ __mClass->mMarkFunc = Config_obj_sMarkStatics;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Config_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< Config_obj >;
+#ifdef HXCPP_VISIT_ALLOCS
+ __mClass->mVisitFunc = Config_obj_sVisitStatics;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Config_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Config_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void Config_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_436f82850fb5d17e_11_boot)
+HXDLIN( 11) relativeHashUri = false;
+ }
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/CustomEmojiReaction.cpp b/Sources/c_snikket/src/snikket/CustomEmojiReaction.cpp
new file mode 100644
index 0000000..5e2a475
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/CustomEmojiReaction.cpp
@@ -0,0 +1,189 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_CustomEmojiReaction
+#include <snikket/CustomEmojiReaction.h>
+#endif
+#ifndef INCLUDED_snikket_Hash
+#include <snikket/Hash.h>
+#endif
+#ifndef INCLUDED_snikket_Reaction
+#include <snikket/Reaction.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_6c2890a46980c7c5_46_new,"snikket.CustomEmojiReaction","new",0x0196cbbf,"snikket.CustomEmojiReaction.new","snikket/Reaction.hx",46,0x19ff1ac3)
+HX_LOCAL_STACK_FRAME(_hx_pos_2e818d33177b7606_307_uri__fromC,"snikket.CustomEmojiReaction","uri__fromC",0xf2c1890e,"snikket.CustomEmojiReaction.uri__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_6c2890a46980c7c5_52_render,"snikket.CustomEmojiReaction","render",0xe0809557,"snikket.CustomEmojiReaction.render","snikket/Reaction.hx",52,0x19ff1ac3)
+HX_LOCAL_STACK_FRAME(_hx_pos_6c2890a46980c7c5_42_boot,"snikket.CustomEmojiReaction","boot",0x5a747bf3,"snikket.CustomEmojiReaction.boot","snikket/Reaction.hx",42,0x19ff1ac3)
+namespace snikket{
+
+void CustomEmojiReaction_obj::__construct(::String senderId,::String timestamp,::String text,::String uri,::String envelopeId){
+ HX_STACKFRAME(&_hx_pos_6c2890a46980c7c5_46_new)
+HXLINE( 47) super::__construct(senderId,timestamp,text,envelopeId,uri);
+HXLINE( 48) this->uri = uri;
+ }
+
+Dynamic CustomEmojiReaction_obj::__CreateEmpty() { return new CustomEmojiReaction_obj; }
+
+void *CustomEmojiReaction_obj::_hx_vtable = 0;
+
+Dynamic CustomEmojiReaction_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< CustomEmojiReaction_obj > _hx_result = new CustomEmojiReaction_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4]);
+ return _hx_result;
+}
+
+bool CustomEmojiReaction_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x1e93c5e9) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x1e93c5e9;
+ } else {
+ return inClassId==(int)0x7f8e2b4a;
+ }
+}
+
+::String CustomEmojiReaction_obj::uri__fromC(){
+ HX_STACKFRAME(&_hx_pos_2e818d33177b7606_307_uri__fromC)
+HXDLIN( 307) return this->uri;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(CustomEmojiReaction_obj,uri__fromC,return )
+
+ ::Dynamic CustomEmojiReaction_obj::render( ::Dynamic forText, ::Dynamic forImage){
+ HX_STACKFRAME(&_hx_pos_6c2890a46980c7c5_52_render)
+HXLINE( 53) ::snikket::Hash hash = ::snikket::Hash_obj::fromUri(this->uri);
+HXLINE( 54) ::String _hx_tmp = this->text;
+HXDLIN( 54) ::String tmp;
+HXDLIN( 54) if (::hx::IsNotNull( hash )) {
+HXLINE( 54) tmp = hash->toUri();
+ }
+ else {
+HXLINE( 54) tmp = null();
+ }
+HXDLIN( 54) ::String _hx_tmp1;
+HXDLIN( 54) if (::hx::IsNotNull( tmp )) {
+HXLINE( 54) _hx_tmp1 = tmp;
+ }
+ else {
+HXLINE( 54) _hx_tmp1 = this->uri;
+ }
+HXDLIN( 54) return forImage(_hx_tmp,_hx_tmp1);
+ }
+
+
+
+::hx::ObjectPtr< CustomEmojiReaction_obj > CustomEmojiReaction_obj::__new(::String senderId,::String timestamp,::String text,::String uri,::String envelopeId) {
+ ::hx::ObjectPtr< CustomEmojiReaction_obj > __this = new CustomEmojiReaction_obj();
+ __this->__construct(senderId,timestamp,text,uri,envelopeId);
+ return __this;
+}
+
+::hx::ObjectPtr< CustomEmojiReaction_obj > CustomEmojiReaction_obj::__alloc(::hx::Ctx *_hx_ctx,::String senderId,::String timestamp,::String text,::String uri,::String envelopeId) {
+ CustomEmojiReaction_obj *__this = (CustomEmojiReaction_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(CustomEmojiReaction_obj), true, "snikket.CustomEmojiReaction"));
+ *(void **)__this = CustomEmojiReaction_obj::_hx_vtable;
+ __this->__construct(senderId,timestamp,text,uri,envelopeId);
+ return __this;
+}
+
+CustomEmojiReaction_obj::CustomEmojiReaction_obj()
+{
+}
+
+void CustomEmojiReaction_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(CustomEmojiReaction);
+ HX_MARK_MEMBER_NAME(uri,"uri");
+ ::snikket::Reaction_obj::__Mark(HX_MARK_ARG);
+ HX_MARK_END_CLASS();
+}
+
+void CustomEmojiReaction_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(uri,"uri");
+ ::snikket::Reaction_obj::__Visit(HX_VISIT_ARG);
+}
+
+::hx::Val CustomEmojiReaction_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"uri") ) { return ::hx::Val( uri ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"render") ) { return ::hx::Val( render_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"uri__fromC") ) { return ::hx::Val( uri__fromC_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val CustomEmojiReaction_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"uri") ) { uri=inValue.Cast< ::String >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void CustomEmojiReaction_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("uri",6c,2b,59,00));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo CustomEmojiReaction_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(CustomEmojiReaction_obj,uri),HX_("uri",6c,2b,59,00)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *CustomEmojiReaction_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String CustomEmojiReaction_obj_sMemberFields[] = {
+ HX_("uri",6c,2b,59,00),
+ HX_("uri__fromC",8d,ca,26,b8),
+ HX_("render",56,6b,29,05),
+ ::String(null()) };
+
+::hx::Class CustomEmojiReaction_obj::__mClass;
+
+void CustomEmojiReaction_obj::__register()
+{
+ CustomEmojiReaction_obj _hx_dummy;
+ CustomEmojiReaction_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.CustomEmojiReaction",4d,80,c0,e2);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(CustomEmojiReaction_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< CustomEmojiReaction_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = CustomEmojiReaction_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = CustomEmojiReaction_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void CustomEmojiReaction_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_6c2890a46980c7c5_42_boot)
+HXDLIN( 42) __mClass->__meta__ = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("fields",79,8e,8e,80), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("uri__fromC",8d,ca,26,b8), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(1,HX_("render",56,6b,29,05), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null()))))));
+ }
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/Date.cpp b/Sources/c_snikket/src/snikket/Date.cpp
new file mode 100644
index 0000000..f418f22
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/Date.cpp
@@ -0,0 +1,102 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Date
+#include <Date.h>
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_StringTools
+#include <StringTools.h>
+#endif
+#ifndef INCLUDED_snikket_Date
+#include <snikket/Date.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_44405615e75f4942_4_format,"snikket.Date","format",0x561fb3e6,"snikket.Date.format","snikket/Date.hx",4,0x5c2a2e5e)
+namespace snikket{
+
+void Date_obj::__construct() { }
+
+Dynamic Date_obj::__CreateEmpty() { return new Date_obj; }
+
+void *Date_obj::_hx_vtable = 0;
+
+Dynamic Date_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Date_obj > _hx_result = new Date_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool Date_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x030f768b;
+}
+
+::String Date_obj::format( ::Date d){
+ HX_STACKFRAME(&_hx_pos_44405615e75f4942_4_format)
+HXLINE( 5) Float millis = d->getTime();
+HXLINE( 6) int frac = ::Std_obj::_hx_int((millis - (( (Float)(::Std_obj::_hx_int((millis / ( (Float)(1000) )))) ) * ((Float)1000.0))));
+HXLINE( 7) ::String _hx_tmp = (::Std_obj::string(d->getUTCFullYear()) + HX_("-",2d,00,00,00));
+HXDLIN( 7) ::String _hx_tmp1 = ((_hx_tmp + ::StringTools_obj::lpad(::Std_obj::string((d->getUTCMonth() + 1)),HX_("0",30,00,00,00),2)) + HX_("-",2d,00,00,00));
+HXDLIN( 7) ::String _hx_tmp2 = ((_hx_tmp1 + ::StringTools_obj::lpad(::Std_obj::string(d->getUTCDate()),HX_("0",30,00,00,00),2)) + HX_("T",54,00,00,00));
+HXDLIN( 7) ::String _hx_tmp3 = ((_hx_tmp2 + ::StringTools_obj::lpad(::Std_obj::string(d->getUTCHours()),HX_("0",30,00,00,00),2)) + HX_(":",3a,00,00,00));
+HXDLIN( 7) ::String _hx_tmp4 = ((_hx_tmp3 + ::StringTools_obj::lpad(::Std_obj::string(d->getUTCMinutes()),HX_("0",30,00,00,00),2)) + HX_(":",3a,00,00,00));
+HXDLIN( 7) ::String _hx_tmp5 = ((_hx_tmp4 + ::StringTools_obj::lpad(::Std_obj::string(d->getUTCSeconds()),HX_("0",30,00,00,00),2)) + HX_(".",2e,00,00,00));
+HXDLIN( 7) return ((_hx_tmp5 + ::StringTools_obj::lpad(::Std_obj::string(frac),HX_("0",30,00,00,00),3)) + HX_("Z",5a,00,00,00));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Date_obj,format,return )
+
+
+Date_obj::Date_obj()
+{
+}
+
+bool Date_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 6:
+ if (HX_FIELD_EQ(inName,"format") ) { outValue = format_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *Date_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *Date_obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class Date_obj::__mClass;
+
+static ::String Date_obj_sStaticFields[] = {
+ HX_("format",37,8f,8e,fd),
+ ::String(null())
+};
+
+void Date_obj::__register()
+{
+ Date_obj _hx_dummy;
+ Date_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.Date",df,fb,20,4d);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Date_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Date_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< Date_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Date_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Date_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/DirectChat.cpp b/Sources/c_snikket/src/snikket/DirectChat.cpp
new file mode 100644
index 0000000..92922ce
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/DirectChat.cpp
@@ -0,0 +1,889 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Date
+#include <Date.h>
+#endif
+#ifndef INCLUDED_Lambda
+#include <Lambda.h>
+#endif
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_Log
+#include <haxe/Log.h>
+#endif
+#ifndef INCLUDED_haxe_Timer
+#include <haxe/Timer.h>
+#endif
+#ifndef INCLUDED_haxe_ds_StringMap
+#include <haxe/ds/StringMap.h>
+#endif
+#ifndef INCLUDED_snikket_Chat
+#include <snikket/Chat.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessage
+#include <snikket/ChatMessage.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessageBuilder
+#include <snikket/ChatMessageBuilder.h>
+#endif
+#ifndef INCLUDED_snikket_Client
+#include <snikket/Client.h>
+#endif
+#ifndef INCLUDED_snikket_CustomEmojiReaction
+#include <snikket/CustomEmojiReaction.h>
+#endif
+#ifndef INCLUDED_snikket_Date
+#include <snikket/Date.h>
+#endif
+#ifndef INCLUDED_snikket_DirectChat
+#include <snikket/DirectChat.h>
+#endif
+#ifndef INCLUDED_snikket_EventEmitter
+#include <snikket/EventEmitter.h>
+#endif
+#ifndef INCLUDED_snikket_EventResult
+#include <snikket/EventResult.h>
+#endif
+#ifndef INCLUDED_snikket_GenericStream
+#include <snikket/GenericStream.h>
+#endif
+#ifndef INCLUDED_snikket_ID
+#include <snikket/ID.h>
+#endif
+#ifndef INCLUDED_snikket_JID
+#include <snikket/JID.h>
+#endif
+#ifndef INCLUDED_snikket_Message
+#include <snikket/Message.h>
+#endif
+#ifndef INCLUDED_snikket_MessageStanza
+#include <snikket/MessageStanza.h>
+#endif
+#ifndef INCLUDED_snikket_MessageSync
+#include <snikket/MessageSync.h>
+#endif
+#ifndef INCLUDED_snikket_Participant
+#include <snikket/Participant.h>
+#endif
+#ifndef INCLUDED_snikket_Persistence
+#include <snikket/Persistence.h>
+#endif
+#ifndef INCLUDED_snikket_Reaction
+#include <snikket/Reaction.h>
+#endif
+#ifndef INCLUDED_snikket_ReactionUpdate
+#include <snikket/ReactionUpdate.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_af7b91d6026813b6_720_new,"snikket.DirectChat","new",0x757e3104,"snikket.DirectChat.new","snikket/Chat.hx",720,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_af7b91d6026813b6_724_getParticipants,"snikket.DirectChat","getParticipants",0x9f51d1ba,"snikket.DirectChat.getParticipants","snikket/Chat.hx",724,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_af7b91d6026813b6_734_counterparts,"snikket.DirectChat","counterparts",0x2a527b80,"snikket.DirectChat.counterparts","snikket/Chat.hx",734,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_af7b91d6026813b6_738_getParticipantDetails,"snikket.DirectChat","getParticipantDetails",0x79208529,"snikket.DirectChat.getParticipantDetails","snikket/Chat.hx",738,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_af7b91d6026813b6_746_getMessagesBefore,"snikket.DirectChat","getMessagesBefore",0x4909a945,"snikket.DirectChat.getMessagesBefore","snikket/Chat.hx",746,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_af7b91d6026813b6_744_getMessagesBefore,"snikket.DirectChat","getMessagesBefore",0x4909a945,"snikket.DirectChat.getMessagesBefore","snikket/Chat.hx",744,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_af7b91d6026813b6_764_getMessagesAfter,"snikket.DirectChat","getMessagesAfter",0x26744c16,"snikket.DirectChat.getMessagesAfter","snikket/Chat.hx",764,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_af7b91d6026813b6_758_getMessagesAfter,"snikket.DirectChat","getMessagesAfter",0x26744c16,"snikket.DirectChat.getMessagesAfter","snikket/Chat.hx",758,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_af7b91d6026813b6_778_getMessagesAround,"snikket.DirectChat","getMessagesAround",0x64db4d13,"snikket.DirectChat.getMessagesAround","snikket/Chat.hx",778,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_af7b91d6026813b6_777_getMessagesAround,"snikket.DirectChat","getMessagesAround",0x64db4d13,"snikket.DirectChat.getMessagesAround","snikket/Chat.hx",777,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_af7b91d6026813b6_788_prepareIncomingMessage,"snikket.DirectChat","prepareIncomingMessage",0xe7120196,"snikket.DirectChat.prepareIncomingMessage","snikket/Chat.hx",788,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_af7b91d6026813b6_793_prepareOutgoingMessage,"snikket.DirectChat","prepareOutgoingMessage",0x4d3ec6d0,"snikket.DirectChat.prepareOutgoingMessage","snikket/Chat.hx",793,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_af7b91d6026813b6_810_correctMessage,"snikket.DirectChat","correctMessage",0x83971059,"snikket.DirectChat.correctMessage","snikket/Chat.hx",810,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_af7b91d6026813b6_805_correctMessage,"snikket.DirectChat","correctMessage",0x83971059,"snikket.DirectChat.correctMessage","snikket/Chat.hx",805,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_af7b91d6026813b6_826_sendMessage,"snikket.DirectChat","sendMessage",0x7d4f2e03,"snikket.DirectChat.sendMessage","snikket/Chat.hx",826,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_af7b91d6026813b6_834_sendMessage,"snikket.DirectChat","sendMessage",0x7d4f2e03,"snikket.DirectChat.sendMessage","snikket/Chat.hx",834,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_af7b91d6026813b6_850_sendMessage,"snikket.DirectChat","sendMessage",0x7d4f2e03,"snikket.DirectChat.sendMessage","snikket/Chat.hx",850,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_af7b91d6026813b6_886_removeReaction,"snikket.DirectChat","removeReaction",0x4fdefde9,"snikket.DirectChat.removeReaction","snikket/Chat.hx",886,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_af7b91d6026813b6_864_removeReaction,"snikket.DirectChat","removeReaction",0x4fdefde9,"snikket.DirectChat.removeReaction","snikket/Chat.hx",864,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_af7b91d6026813b6_879_removeReaction,"snikket.DirectChat","removeReaction",0x4fdefde9,"snikket.DirectChat.removeReaction","snikket/Chat.hx",879,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_af7b91d6026813b6_898_lastMessageId,"snikket.DirectChat","lastMessageId",0x6bb7a5f0,"snikket.DirectChat.lastMessageId","snikket/Chat.hx",898,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_af7b91d6026813b6_903_markReadUpTo,"snikket.DirectChat","markReadUpTo",0xa06bd335,"snikket.DirectChat.markReadUpTo","snikket/Chat.hx",903,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_af7b91d6026813b6_902_markReadUpTo,"snikket.DirectChat","markReadUpTo",0xa06bd335,"snikket.DirectChat.markReadUpTo","snikket/Chat.hx",902,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_af7b91d6026813b6_934_bookmark,"snikket.DirectChat","bookmark",0x9ab25992,"snikket.DirectChat.bookmark","snikket/Chat.hx",934,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_af7b91d6026813b6_924_bookmark,"snikket.DirectChat","bookmark",0x9ab25992,"snikket.DirectChat.bookmark","snikket/Chat.hx",924,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_af7b91d6026813b6_943_sendChatState,"snikket.DirectChat","sendChatState",0xb2f43755,"snikket.DirectChat.sendChatState","snikket/Chat.hx",943,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_af7b91d6026813b6_960_close,"snikket.DirectChat","close",0x2561e95c,"snikket.DirectChat.close","snikket/Chat.hx",960,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_af7b91d6026813b6_717_boot,"snikket.DirectChat","boot",0x5105b30e,"snikket.DirectChat.boot","snikket/Chat.hx",717,0x18616bf4)
+namespace snikket{
+
+void DirectChat_obj::__construct( ::snikket::Client client, ::snikket::GenericStream stream,::Dynamic persistence,::String chatId,::hx::Null< int > __o_uiState,::hx::Null< bool > __o_isBlocked, ::snikket::Stanza extensions,::String readUpToId,::String readUpToBy){
+ int uiState = __o_uiState.Default(1);
+ bool isBlocked = __o_isBlocked.Default(false);
+ HX_STACKFRAME(&_hx_pos_af7b91d6026813b6_720_new)
+HXDLIN( 720) super::__construct(client,stream,persistence,chatId,uiState,isBlocked,extensions,readUpToId,readUpToBy);
+ }
+
+Dynamic DirectChat_obj::__CreateEmpty() { return new DirectChat_obj; }
+
+void *DirectChat_obj::_hx_vtable = 0;
+
+Dynamic DirectChat_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< DirectChat_obj > _hx_result = new DirectChat_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6],inArgs[7],inArgs[8]);
+ return _hx_result;
+}
+
+bool DirectChat_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x026b7f35) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x026b7f35;
+ } else {
+ return inClassId==(int)0x62c262be;
+ }
+}
+
+::Array< ::String > DirectChat_obj::getParticipants(){
+ HX_STACKFRAME(&_hx_pos_af7b91d6026813b6_724_getParticipants)
+HXLINE( 725) ::Array< ::String > counters = this->counterparts();
+HXLINE( 726) bool _hx_tmp;
+HXDLIN( 726) if ((counters->length < 2)) {
+HXLINE( 726) ::snikket::ChatMessage tmp = this->lastMessage;
+HXDLIN( 726) ::Array< ::Dynamic> tmp1;
+HXDLIN( 726) if (::hx::IsNotNull( tmp )) {
+HXLINE( 726) tmp1 = tmp->recipients;
+ }
+ else {
+HXLINE( 726) tmp1 = null();
+ }
+HXDLIN( 726) ::Dynamic tmp2;
+HXDLIN( 726) if (::hx::IsNotNull( tmp1 )) {
+HXLINE( 726) tmp2 = tmp1->length;
+ }
+ else {
+HXLINE( 726) tmp2 = null();
+ }
+HXDLIN( 726) int _hx_tmp1;
+HXDLIN( 726) if (::hx::IsNotNull( tmp2 )) {
+HXLINE( 726) _hx_tmp1 = ( (int)(tmp2) );
+ }
+ else {
+HXLINE( 726) _hx_tmp1 = 0;
+ }
+HXDLIN( 726) _hx_tmp = (_hx_tmp1 > 1);
+ }
+ else {
+HXLINE( 726) _hx_tmp = false;
+ }
+HXDLIN( 726) if (_hx_tmp) {
+HXLINE( 727) ::Array< ::Dynamic> _this = this->lastMessage->recipients;
+HXDLIN( 727) ::Array< ::String > result = ::Array_obj< ::String >::__new(_this->length);
+HXDLIN( 727) {
+HXLINE( 727) int _g = 0;
+HXDLIN( 727) int _g1 = _this->length;
+HXDLIN( 727) while((_g < _g1)){
+HXLINE( 727) _g = (_g + 1);
+HXDLIN( 727) int i = (_g - 1);
+HXDLIN( 727) {
+HXLINE( 727) ::String inValue = ( ( ::snikket::JID)(_hx_array_unsafe_get(_this,i)) )->asString();
+HXDLIN( 727) result->__unsafe_set(i,inValue);
+ }
+ }
+ }
+HXDLIN( 727) return result->concat(::Array_obj< ::String >::__new(1)->init(0,this->lastMessage->senderId));
+ }
+ else {
+HXLINE( 729) ::Array< ::String > _hx_tmp2 = this->counterparts();
+HXDLIN( 729) return _hx_tmp2->concat(::Array_obj< ::String >::__new(1)->init(0,this->client->accountId()));
+ }
+HXLINE( 726) return null();
+ }
+
+
+::Array< ::String > DirectChat_obj::counterparts(){
+ HX_STACKFRAME(&_hx_pos_af7b91d6026813b6_734_counterparts)
+HXDLIN( 734) return this->chatId.split(HX_("\n",0a,00,00,00));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(DirectChat_obj,counterparts,return )
+
+ ::snikket::Participant DirectChat_obj::getParticipantDetails(::String participantId){
+ HX_GC_STACKFRAME(&_hx_pos_af7b91d6026813b6_738_getParticipantDetails)
+HXLINE( 739) ::snikket::DirectChat chat = this->client->getDirectChat(participantId,null());
+HXLINE( 740) ::String _hx_tmp = chat->getDisplayName();
+HXDLIN( 740) ::String _hx_tmp1 = chat->getPhoto();
+HXDLIN( 740) ::String _hx_tmp2 = chat->getPlaceholder();
+HXDLIN( 740) ::String chat1 = chat->chatId;
+HXDLIN( 740) return ::snikket::Participant_obj::__alloc( HX_CTX ,_hx_tmp,_hx_tmp1,_hx_tmp2,(chat1 == this->client->accountId()));
+ }
+
+
+void DirectChat_obj::getMessagesBefore(::String beforeId,::String beforeTime, ::Dynamic handler){
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_0, ::snikket::DirectChat,_gthis,::String,beforeId, ::Dynamic,handler) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> messages){
+ HX_GC_STACKFRAME(&_hx_pos_af7b91d6026813b6_746_getMessagesBefore)
+HXLINE( 746) if ((messages->length > 0)) {
+HXLINE( 747) handler(messages);
+ }
+ else {
+HXLINE( 749) ::Dynamic filter = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("with",06,76,f8,4e),_gthis->chatId));
+HXLINE( 750) if (::hx::IsNotNull( beforeId )) {
+HXLINE( 750) filter->__SetField(HX_("page",4f,da,51,4a), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("before",7f,54,32,9a),beforeId)),::hx::paccDynamic);
+ }
+HXLINE( 751) ::snikket::MessageSync sync = ::snikket::MessageSync_obj::__alloc( HX_CTX ,_gthis->client,_gthis->stream,filter,null());
+HXLINE( 752) _gthis->fetchFromSync(sync,handler);
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_af7b91d6026813b6_744_getMessagesBefore)
+HXDLIN( 744) ::snikket::DirectChat _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 745) ::Dynamic _hx_tmp = this->persistence;
+HXDLIN( 745) ::String _hx_tmp1 = this->client->accountId();
+HXDLIN( 745) ::snikket::Persistence_obj::getMessagesBefore(_hx_tmp,_hx_tmp1,this->chatId,beforeId,beforeTime, ::Dynamic(new _hx_Closure_0(_gthis,beforeId,handler)));
+ }
+
+
+void DirectChat_obj::getMessagesAfter(::String afterId,::String afterTime, ::Dynamic handler){
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_0, ::snikket::DirectChat,_gthis,::String,afterId, ::Dynamic,handler) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> messages){
+ HX_GC_STACKFRAME(&_hx_pos_af7b91d6026813b6_764_getMessagesAfter)
+HXLINE( 764) if ((messages->length > 0)) {
+HXLINE( 765) handler(messages);
+ }
+ else {
+HXLINE( 767) ::Dynamic filter = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("with",06,76,f8,4e),_gthis->chatId));
+HXLINE( 768) if (::hx::IsNotNull( afterId )) {
+HXLINE( 768) filter->__SetField(HX_("page",4f,da,51,4a), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("after",1c,66,a2,1d),afterId)),::hx::paccDynamic);
+ }
+HXLINE( 769) ::snikket::MessageSync sync = ::snikket::MessageSync_obj::__alloc( HX_CTX ,_gthis->client,_gthis->stream,filter,null());
+HXLINE( 770) _gthis->fetchFromSync(sync,handler);
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_af7b91d6026813b6_758_getMessagesAfter)
+HXDLIN( 758) ::snikket::DirectChat _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 759) bool _hx_tmp;
+HXDLIN( 759) ::String afterId1 = afterId;
+HXDLIN( 759) if ((afterId1 == this->lastMessageId())) {
+HXLINE( 759) _hx_tmp = !(this->syncing());
+ }
+ else {
+HXLINE( 759) _hx_tmp = false;
+ }
+HXDLIN( 759) if (_hx_tmp) {
+HXLINE( 760) handler(::Array_obj< ::Dynamic>::__new(0));
+HXLINE( 761) return;
+ }
+HXLINE( 763) ::Dynamic _hx_tmp1 = this->persistence;
+HXDLIN( 763) ::String _hx_tmp2 = this->client->accountId();
+HXDLIN( 763) ::snikket::Persistence_obj::getMessagesAfter(_hx_tmp1,_hx_tmp2,this->chatId,afterId,afterTime, ::Dynamic(new _hx_Closure_0(_gthis,afterId,handler)));
+ }
+
+
+void DirectChat_obj::getMessagesAround(::String aroundId,::String aroundTime, ::Dynamic handler){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::Dynamic,handler) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> messages){
+ HX_STACKFRAME(&_hx_pos_af7b91d6026813b6_778_getMessagesAround)
+HXLINE( 778) if ((messages->length > 0)) {
+HXLINE( 779) handler(messages);
+ }
+ else {
+HXLINE( 782) handler(::Array_obj< ::Dynamic>::__new(0));
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_af7b91d6026813b6_777_getMessagesAround)
+HXDLIN( 777) ::Dynamic _hx_tmp = this->persistence;
+HXDLIN( 777) ::String _hx_tmp1 = this->client->accountId();
+HXDLIN( 777) ::snikket::Persistence_obj::getMessagesAround(_hx_tmp,_hx_tmp1,this->chatId,aroundId,aroundTime, ::Dynamic(new _hx_Closure_0(handler)));
+ }
+
+
+ ::snikket::ChatMessageBuilder DirectChat_obj::prepareIncomingMessage( ::snikket::ChatMessageBuilder message, ::snikket::Stanza stanza){
+ HX_STACKFRAME(&_hx_pos_af7b91d6026813b6_788_prepareIncomingMessage)
+HXLINE( 789) message->syncPoint = !(this->syncing());
+HXLINE( 790) return message;
+ }
+
+
+ ::snikket::ChatMessageBuilder DirectChat_obj::prepareOutgoingMessage( ::snikket::ChatMessageBuilder message){
+ HX_STACKFRAME(&_hx_pos_af7b91d6026813b6_793_prepareOutgoingMessage)
+HXLINE( 794) ::String tmp = message->timestamp;
+HXDLIN( 794) ::String _hx_tmp;
+HXDLIN( 794) if (::hx::IsNotNull( tmp )) {
+HXLINE( 794) _hx_tmp = tmp;
+ }
+ else {
+HXLINE( 794) _hx_tmp = ::snikket::Date_obj::format(::Date_obj::now());
+ }
+HXDLIN( 794) message->timestamp = _hx_tmp;
+HXLINE( 795) message->direction = 1;
+HXLINE( 796) message->from = this->client->jid;
+HXLINE( 797) message->sender = message->from->asBare();
+HXLINE( 798) message->replyTo = ::Array_obj< ::Dynamic>::__new(1)->init(0,message->sender);
+HXLINE( 799) ::Array< ::String > _this = this->counterparts();
+HXDLIN( 799) ::Array< ::Dynamic> result = ::Array_obj< ::Dynamic>::__new(_this->length);
+HXDLIN( 799) {
+HXLINE( 799) int _g = 0;
+HXDLIN( 799) int _g1 = _this->length;
+HXDLIN( 799) while((_g < _g1)){
+HXLINE( 799) _g = (_g + 1);
+HXDLIN( 799) int i = (_g - 1);
+HXDLIN( 799) {
+HXLINE( 799) ::snikket::JID inValue = ::snikket::JID_obj::parse(( (::String)(_hx_array_unsafe_get(_this,i)) ));
+HXDLIN( 799) result->__unsafe_set(i,inValue);
+ }
+ }
+ }
+HXDLIN( 799) message->recipients = result;
+HXLINE( 800) message->to = message->recipients->__get(0).StaticCast< ::snikket::JID >();
+HXLINE( 801) return message;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(DirectChat_obj,prepareOutgoingMessage,return )
+
+void DirectChat_obj::correctMessage(::String localId, ::snikket::ChatMessageBuilder message){
+ HX_BEGIN_LOCAL_FUNC_S4(::hx::LocalFunc,_hx_Closure_0, ::snikket::DirectChat,_gthis,::Array< ::Dynamic>,message1,::String,localId,::String,toSendId) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> corrected){
+ HX_STACKFRAME(&_hx_pos_af7b91d6026813b6_810_correctMessage)
+HXLINE( 811) ::Array< ::Dynamic> _hx_tmp;
+HXDLIN( 811) ::snikket::ChatMessage tmp = corrected->__get(0).StaticCast< ::snikket::ChatMessage >()->versions->__get((corrected->__get(0).StaticCast< ::snikket::ChatMessage >()->versions->length - 1)).StaticCast< ::snikket::ChatMessage >();
+HXDLIN( 811) ::String _hx_tmp1;
+HXDLIN( 811) if (::hx::IsNotNull( tmp )) {
+HXLINE( 811) _hx_tmp1 = tmp->localId;
+ }
+ else {
+HXLINE( 811) _hx_tmp1 = null();
+ }
+HXDLIN( 811) if ((_hx_tmp1 == localId)) {
+HXLINE( 811) _hx_tmp = corrected->__get(0).StaticCast< ::snikket::ChatMessage >()->versions;
+ }
+ else {
+HXLINE( 811) _hx_tmp = ::Array_obj< ::Dynamic>::__new(1)->init(0,message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->build());
+ }
+HXDLIN( 811) message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->versions = _hx_tmp;
+HXLINE( 812) message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->localId = toSendId;
+HXLINE( 813) {
+HXLINE( 813) int _g = 0;
+HXDLIN( 813) ::Array< ::Dynamic> _g1 = message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->recipients;
+HXDLIN( 813) while((_g < _g1->length)){
+HXLINE( 813) ::snikket::JID recipient = _g1->__get(_g).StaticCast< ::snikket::JID >();
+HXDLIN( 813) _g = (_g + 1);
+HXLINE( 814) message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->to = recipient;
+HXLINE( 815) ::snikket::Client _gthis1 = _gthis->client;
+HXDLIN( 815) _gthis1->sendStanza(message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->build()->asStanza());
+ }
+ }
+HXLINE( 817) ::snikket::ChatMessage tmp1 = _gthis->lastMessage;
+HXDLIN( 817) ::String _hx_tmp2;
+HXDLIN( 817) if (::hx::IsNotNull( tmp1 )) {
+HXLINE( 817) _hx_tmp2 = tmp1->localId;
+ }
+ else {
+HXLINE( 817) _hx_tmp2 = null();
+ }
+HXDLIN( 817) if ((localId == _hx_tmp2)) {
+HXLINE( 818) _gthis->setLastMessage(corrected->__get(0).StaticCast< ::snikket::ChatMessage >());
+HXLINE( 819) _gthis->client->trigger(HX_("chats/update",3d,8e,1d,14),::cpp::VirtualArray_obj::__new(1)->init(0,_gthis));
+ }
+HXLINE( 821) _gthis->client->notifyMessageHandlers(corrected->__get(0).StaticCast< ::snikket::ChatMessage >(),1);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_af7b91d6026813b6_805_correctMessage)
+HXDLIN( 805) ::Array< ::Dynamic> message1 = ::Array_obj< ::Dynamic>::__new(1)->init(0,message);
+HXDLIN( 805) ::snikket::DirectChat _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 806) ::String toSendId = message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->localId;
+HXLINE( 807) message1[0] = this->prepareOutgoingMessage(message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >());
+HXLINE( 808) ::snikket::ChatMessage _hx_tmp = message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->build();
+HXDLIN( 808) message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->versions = ::Array_obj< ::Dynamic>::__new(1)->init(0,_hx_tmp);
+HXLINE( 809) message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->localId = localId;
+HXLINE( 810) ::snikket::Client _hx_tmp1 = this->client;
+HXDLIN( 810) _hx_tmp1->storeMessages(::Array_obj< ::Dynamic>::__new(1)->init(0,message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->build()), ::Dynamic(new _hx_Closure_0(_gthis,message1,localId,toSendId)));
+ }
+
+
+void DirectChat_obj::sendMessage( ::snikket::ChatMessageBuilder message){
+ HX_STACKFRAME(&_hx_pos_af7b91d6026813b6_826_sendMessage)
+HXDLIN( 826) ::Array< ::Dynamic> message1 = ::Array_obj< ::Dynamic>::__new(1)->init(0,message);
+HXDLIN( 826) ::snikket::DirectChat _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 827) if (::hx::IsNotNull( this->typingTimer )) {
+HXLINE( 827) this->typingTimer->stop();
+ }
+HXLINE( 828) this->client->chatActivity(::hx::ObjectPtr<OBJ_>(this),null());
+HXLINE( 829) message1[0] = this->prepareOutgoingMessage(message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >());
+HXLINE( 830) message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->to = message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->recipients->__get(0).StaticCast< ::snikket::JID >();
+HXLINE( 831) ::snikket::Stanza fromStanza = message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->build()->asStanza();
+HXDLIN( 831) ::snikket::MessageStanza fromStanza1 = ::snikket::Message_obj::fromStanza(fromStanza,this->client->jid,null())->parsed;
+HXLINE( 832) switch((int)(fromStanza1->_hx_getIndex())){
+ case (int)1: {
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0, ::snikket::DirectChat,_gthis,::Array< ::Dynamic>,message1) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> stored){
+ HX_STACKFRAME(&_hx_pos_af7b91d6026813b6_834_sendMessage)
+HXLINE( 835) {
+HXLINE( 835) int _g = 0;
+HXDLIN( 835) ::Array< ::Dynamic> _g1 = message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->recipients;
+HXDLIN( 835) while((_g < _g1->length)){
+HXLINE( 835) ::snikket::JID recipient = _g1->__get(_g).StaticCast< ::snikket::JID >();
+HXDLIN( 835) _g = (_g + 1);
+HXLINE( 836) message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->to = recipient;
+HXLINE( 837) ::snikket::Stanza stanza = message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->build()->asStanza();
+HXLINE( 838) if (::hx::IsNotNull( _gthis->isActive )) {
+HXLINE( 839) _gthis->isActive = true;
+HXLINE( 840) _gthis->activeThread = message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->threadId;
+HXLINE( 841) stanza->tag(HX_("active",c6,41,46,16), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("http://jabber.org/protocol/chatstates",8e,6d,41,6d))))->up();
+ }
+HXLINE( 843) _gthis->client->sendStanza(stanza);
+ }
+ }
+HXLINE( 845) ::snikket::DirectChat _gthis1 = _gthis;
+HXDLIN( 845) _gthis1->setLastMessage(message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->build());
+HXLINE( 846) _gthis->client->trigger(HX_("chats/update",3d,8e,1d,14),::cpp::VirtualArray_obj::__new(1)->init(0,_gthis));
+HXLINE( 847) int _hx_tmp;
+HXDLIN( 847) if ((stored->__get(0).StaticCast< ::snikket::ChatMessage >()->versions->length > 1)) {
+HXLINE( 847) _hx_tmp = 1;
+ }
+ else {
+HXLINE( 847) _hx_tmp = 0;
+ }
+HXDLIN( 847) _gthis->client->notifyMessageHandlers(stored->__get(0).StaticCast< ::snikket::ChatMessage >(),_hx_tmp);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE( 833) ::snikket::ChatMessage _g = fromStanza1->_hx_getObject(0).StaticCast< ::snikket::ChatMessage >();
+HXLINE( 834) ::snikket::Client _hx_tmp = this->client;
+HXDLIN( 834) _hx_tmp->storeMessages(::Array_obj< ::Dynamic>::__new(1)->init(0,message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->build()), ::Dynamic(new _hx_Closure_0(_gthis,message1)));
+ }
+ break;
+ case (int)3: {
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_1, ::snikket::DirectChat,_gthis,::Array< ::Dynamic>,message1) HXARGC(1)
+ void _hx_run( ::snikket::ChatMessage stored){
+ HX_STACKFRAME(&_hx_pos_af7b91d6026813b6_850_sendMessage)
+HXLINE( 851) {
+HXLINE( 851) int _g = 0;
+HXDLIN( 851) ::Array< ::Dynamic> _g1 = message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->recipients;
+HXDLIN( 851) while((_g < _g1->length)){
+HXLINE( 851) ::snikket::JID recipient = _g1->__get(_g).StaticCast< ::snikket::JID >();
+HXDLIN( 851) _g = (_g + 1);
+HXLINE( 852) message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->to = recipient;
+HXLINE( 853) ::snikket::Client _gthis1 = _gthis->client;
+HXDLIN( 853) _gthis1->sendStanza(message1->__get(0).StaticCast< ::snikket::ChatMessageBuilder >()->build()->asStanza());
+ }
+ }
+HXLINE( 855) if (::hx::IsNotNull( stored )) {
+HXLINE( 855) _gthis->client->notifyMessageHandlers(stored,2);
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE( 849) ::snikket::ReactionUpdate update = fromStanza1->_hx_getObject(0).StaticCast< ::snikket::ReactionUpdate >();
+HXLINE( 850) ::Dynamic _hx_tmp1 = this->persistence;
+HXDLIN( 850) ::snikket::Persistence_obj::storeReaction(_hx_tmp1,this->client->accountId(),update, ::Dynamic(new _hx_Closure_1(_gthis,message1)));
+ }
+ break;
+ default:{
+HXLINE( 858) ::haxe::Log_obj::trace(HX_("Invalid message",7e,ab,89,95), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.DirectChat",12,9f,50,5b))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,fromStanza1))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("sendMessage",5f,89,1d,24))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/Chat.hx",f4,6b,61,18))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),858)));
+HXLINE( 859) HX_STACK_DO_THROW(HX_("Trying to send invalid message.",dc,74,a0,91));
+ }
+ }
+ }
+
+
+void DirectChat_obj::removeReaction( ::snikket::ChatMessage m, ::snikket::Reaction reaction){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_1, ::snikket::DirectChat,_gthis, ::snikket::ReactionUpdate,update3) HXARGC(1)
+ void _hx_run( ::snikket::ChatMessage stored){
+ HX_GC_STACKFRAME(&_hx_pos_af7b91d6026813b6_886_removeReaction)
+HXLINE( 887) ::snikket::Stanza stanza = update3->asStanza();
+HXLINE( 888) {
+HXLINE( 888) int _g = 0;
+HXDLIN( 888) ::Array< ::String > _g1 = _gthis->counterparts();
+HXDLIN( 888) while((_g < _g1->length)){
+HXLINE( 888) ::String recipient = _g1->__get(_g);
+HXDLIN( 888) _g = (_g + 1);
+HXLINE( 889) ::Reflect_obj::setField(stanza->attr,HX_("to",7b,65,00,00),recipient);
+HXLINE( 890) _gthis->client->sendStanza(stanza);
+ }
+ }
+HXLINE( 892) if (::hx::IsNotNull( stored )) {
+HXLINE( 892) _gthis->client->notifyMessageHandlers(stored,2);
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_af7b91d6026813b6_864_removeReaction)
+HXDLIN( 864) ::snikket::DirectChat _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 865) if (::Std_obj::isOfType(reaction,::hx::ClassOf< ::snikket::CustomEmojiReaction >())) {
+HXLINE( 866) if (::hx::IsNull( reaction->envelopeId )) {
+HXLINE( 866) HX_STACK_DO_THROW(HX_("Cannot remove custom emoji reaction without envelopeId",90,e6,80,fb));
+ }
+HXLINE( 867) ::snikket::ChatMessageBuilder correct = m->reply();
+HXLINE( 868) correct->localId = ::snikket::ID_obj::_hx_long();
+HXLINE( 869) correct->setHtml(HX_("",00,00,00,00));
+HXLINE( 870) correct->text = null();
+HXLINE( 871) this->correctMessage(reaction->envelopeId,correct);
+HXLINE( 872) return;
+ }
+HXLINE( 876) ::Array< ::Dynamic> reactions = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 877) {
+HXLINE( 877) ::Dynamic map = m->reactions;
+HXDLIN( 877) ::Dynamic _g_map = map;
+HXDLIN( 877) ::Dynamic _g_keys = ::haxe::IMap_obj::keys(map);
+HXDLIN( 877) while(( (bool)(_g_keys->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 877) ::String key = ( (::String)(_g_keys->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXDLIN( 877) ::Array< ::Dynamic> _g_value = ( (::Array< ::Dynamic>)(::haxe::IMap_obj::get(_g_map,key)) );
+HXDLIN( 877) ::String _g_key = key;
+HXDLIN( 877) ::String areaction = _g_key;
+HXDLIN( 877) ::Array< ::Dynamic> reacts = _g_value;
+HXLINE( 878) if ((areaction != reaction->key)) {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::DirectChat,_gthis) HXARGC(1)
+ bool _hx_run( ::snikket::Reaction r){
+ HX_STACKFRAME(&_hx_pos_af7b91d6026813b6_879_removeReaction)
+HXLINE( 879) ::String r1 = r->senderId;
+HXDLIN( 879) return (r1 == _gthis->client->accountId());
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE( 879) ::snikket::Reaction react = ( ( ::snikket::Reaction)(::Lambda_obj::find(reacts, ::Dynamic(new _hx_Closure_0(_gthis)))) );
+HXLINE( 880) bool _hx_tmp;
+HXDLIN( 880) if (::hx::IsNotNull( react )) {
+HXLINE( 880) _hx_tmp = !(::Std_obj::isOfType(react,::hx::ClassOf< ::snikket::CustomEmojiReaction >()));
+ }
+ else {
+HXLINE( 880) _hx_tmp = false;
+ }
+HXDLIN( 880) if (_hx_tmp) {
+HXLINE( 881) reactions->push(react);
+ }
+ }
+ }
+ }
+HXLINE( 885) ::String update = ::snikket::ID_obj::_hx_long();
+HXDLIN( 885) ::String m1 = m->localId;
+HXDLIN( 885) ::String update1 = m->chatId();
+HXDLIN( 885) ::String update2 = this->client->accountId();
+HXDLIN( 885) ::snikket::ReactionUpdate update3 = ::snikket::ReactionUpdate_obj::__alloc( HX_CTX ,update,null(),null(),m1,update1,update2,::snikket::Date_obj::format(::Date_obj::now()),reactions,0);
+HXLINE( 886) ::Dynamic _hx_tmp1 = this->persistence;
+HXDLIN( 886) ::String _hx_tmp2 = this->client->accountId();
+HXDLIN( 886) ::snikket::Persistence_obj::storeReaction(_hx_tmp1,_hx_tmp2,update3, ::Dynamic(new _hx_Closure_1(_gthis,update3)));
+ }
+
+
+::String DirectChat_obj::lastMessageId(){
+ HX_STACKFRAME(&_hx_pos_af7b91d6026813b6_898_lastMessageId)
+HXDLIN( 898) ::snikket::ChatMessage tmp = this->lastMessage;
+HXDLIN( 898) ::String tmp1;
+HXDLIN( 898) if (::hx::IsNotNull( tmp )) {
+HXDLIN( 898) tmp1 = tmp->localId;
+ }
+ else {
+HXDLIN( 898) tmp1 = null();
+ }
+HXDLIN( 898) if (::hx::IsNotNull( tmp1 )) {
+HXDLIN( 898) return tmp1;
+ }
+ else {
+HXDLIN( 898) ::snikket::ChatMessage tmp2 = this->lastMessage;
+HXDLIN( 898) if (::hx::IsNotNull( tmp2 )) {
+HXDLIN( 898) return tmp2->serverId;
+ }
+ else {
+HXDLIN( 898) return null();
+ }
+ }
+HXDLIN( 898) return null();
+ }
+
+
+void DirectChat_obj::markReadUpTo( ::snikket::ChatMessage message){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0, ::snikket::DirectChat,_gthis, ::snikket::ChatMessage,message) HXARGC(0)
+ void _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_af7b91d6026813b6_903_markReadUpTo)
+HXLINE( 906) bool _hx_tmp;
+HXDLIN( 906) if (message->isIncoming()) {
+HXLINE( 906) _hx_tmp = ::hx::IsNotNull( message->localId );
+ }
+ else {
+HXLINE( 906) _hx_tmp = false;
+ }
+HXDLIN( 906) if (_hx_tmp) {
+HXLINE( 907) int _g = 0;
+HXDLIN( 907) ::Array< ::String > _g1 = _gthis->counterparts();
+HXDLIN( 907) while((_g < _g1->length)){
+HXLINE( 907) ::String recipient = _g1->__get(_g);
+HXDLIN( 907) _g = (_g + 1);
+HXLINE( 909) ::String stanza = ::snikket::ID_obj::_hx_long();
+HXDLIN( 909) ::snikket::Stanza stanza1 = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("message",c7,35,11,9a), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("id",db,5b,00,00),stanza)
+ ->setFixed(1,HX_("to",7b,65,00,00),recipient)))->tag(HX_("displayed",21,17,db,c1), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("id",db,5b,00,00),message->localId)
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:chat-markers:0",96,b8,66,e7))))->up();
+HXLINE( 911) if (::hx::IsNotNull( message->threadId )) {
+HXLINE( 912) stanza1->textTag(HX_("thread",ca,7a,b9,8e),message->threadId,null());
+ }
+HXLINE( 914) _gthis->client->sendStanza(stanza1);
+ }
+ }
+HXLINE( 918) _gthis->publishMds();
+HXLINE( 919) _gthis->client->trigger(HX_("chats/update",3d,8e,1d,14),::cpp::VirtualArray_obj::__new(1)->init(0,_gthis));
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_STACKFRAME(&_hx_pos_af7b91d6026813b6_902_markReadUpTo)
+HXDLIN( 902) ::snikket::DirectChat _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 903) this->markReadUpToMessage(message, ::Dynamic(new _hx_Closure_0(_gthis,message)));
+ }
+
+
+void DirectChat_obj::bookmark(){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::DirectChat,_gthis) HXARGC(1)
+ void _hx_run( ::snikket::Stanza response){
+ HX_GC_STACKFRAME(&_hx_pos_af7b91d6026813b6_934_bookmark)
+HXLINE( 935) if ((( (::String)(::Reflect_obj::field(response->attr,HX_("type",ba,f2,08,4d))) ) == HX_("error",c8,cb,29,73))) {
+HXLINE( 935) return;
+ }
+HXLINE( 936) ::snikket::GenericStream _gthis1 = _gthis->stream;
+HXDLIN( 936) ::String _gthis2 = _gthis->chatId;
+HXDLIN( 936) _gthis1->sendStanza( ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("presence",3b,52,d7,66), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("id",db,5b,00,00),::snikket::ID_obj::_hx_short())
+ ->setFixed(1,HX_("to",7b,65,00,00),_gthis2)
+ ->setFixed(2,HX_("type",ba,f2,08,4d),HX_("subscribe",4a,0b,18,19)))));
+HXLINE( 937) if (_gthis->isTrusted()) {
+HXLINE( 937) ::snikket::GenericStream _gthis3 = _gthis->stream;
+HXDLIN( 937) ::String _gthis4 = _gthis->chatId;
+HXDLIN( 937) _gthis3->sendStanza( ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("presence",3b,52,d7,66), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("id",db,5b,00,00),::snikket::ID_obj::_hx_short())
+ ->setFixed(1,HX_("to",7b,65,00,00),_gthis4)
+ ->setFixed(2,HX_("type",ba,f2,08,4d),HX_("subscribed",da,d5,f1,db)))));
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_af7b91d6026813b6_924_bookmark)
+HXDLIN( 924) ::snikket::DirectChat _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 925) ::Dynamic attr = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("jid",c5,ca,50,00),this->chatId));
+HXLINE( 926) bool _hx_tmp;
+HXDLIN( 926) bool _hx_tmp1;
+HXDLIN( 926) if (::hx::IsNotNull( this->displayName )) {
+HXLINE( 926) _hx_tmp1 = (this->displayName != HX_("",00,00,00,00));
+ }
+ else {
+HXLINE( 926) _hx_tmp1 = false;
+ }
+HXDLIN( 926) if (_hx_tmp1) {
+HXLINE( 926) _hx_tmp = (this->displayName != this->chatId);
+ }
+ else {
+HXLINE( 926) _hx_tmp = false;
+ }
+HXDLIN( 926) if (_hx_tmp) {
+HXLINE( 927) ::String value = this->displayName;
+HXDLIN( 927) ::Reflect_obj::setField(attr,HX_("name",4b,72,ff,48),value);
+ }
+HXLINE( 929) ::snikket::GenericStream _hx_tmp2 = this->stream;
+HXDLIN( 929) _hx_tmp2->sendIq( ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("iq",e8,5b,00,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("type",ba,f2,08,4d),HX_("set",a2,9b,57,00))))->tag(HX_("query",08,8b,ea,5d), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("jabber:iq:roster",47,76,6e,06))))->tag(HX_("item",13,c5,bf,45),attr)->up()->up(), ::Dynamic(new _hx_Closure_0(_gthis)));
+ }
+
+
+void DirectChat_obj::sendChatState(::String state,::String threadId){
+ HX_GC_STACKFRAME(&_hx_pos_af7b91d6026813b6_943_sendChatState)
+HXDLIN( 943) int _g = 0;
+HXDLIN( 943) ::Array< ::String > _g1 = this->counterparts();
+HXDLIN( 943) while((_g < _g1->length)){
+HXDLIN( 943) ::String recipient = _g1->__get(_g);
+HXDLIN( 943) _g = (_g + 1);
+HXLINE( 945) ::String stanza = ::snikket::ID_obj::_hx_long();
+HXLINE( 947) ::String stanza1 = this->client->jid->asString();
+HXLINE( 944) ::snikket::Stanza stanza2 = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("message",c7,35,11,9a), ::Dynamic(::hx::Anon_obj::Create(4)
+ ->setFixed(0,HX_("id",db,5b,00,00),stanza)
+ ->setFixed(1,HX_("to",7b,65,00,00),recipient)
+ ->setFixed(2,HX_("from",6a,a5,c2,43),stanza1)
+ ->setFixed(3,HX_("type",ba,f2,08,4d),HX_("chat",d8,5e,bf,41))))->tag(state, ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("http://jabber.org/protocol/chatstates",8e,6d,41,6d))))->up();
+HXLINE( 952) if (::hx::IsNotNull( threadId )) {
+HXLINE( 953) stanza2->textTag(HX_("thread",ca,7a,b9,8e),threadId,null());
+ }
+HXLINE( 955) this->stream->sendStanza(stanza2);
+ }
+ }
+
+
+void DirectChat_obj::close(){
+ HX_STACKFRAME(&_hx_pos_af7b91d6026813b6_960_close)
+HXLINE( 961) if (::hx::IsNotNull( this->typingTimer )) {
+HXLINE( 961) this->typingTimer->stop();
+ }
+HXLINE( 963) this->uiState = 2;
+HXLINE( 964) ::Dynamic _hx_tmp = this->persistence;
+HXDLIN( 964) ::snikket::Persistence_obj::storeChats(_hx_tmp,this->client->accountId(),::Array_obj< ::Dynamic>::__new(1)->init(0,::hx::ObjectPtr<OBJ_>(this)));
+HXLINE( 965) if (!(this->isBlocked)) {
+HXLINE( 965) this->sendChatState(HX_("gone",5f,94,69,44),null());
+ }
+HXLINE( 966) this->client->trigger(HX_("chats/update",3d,8e,1d,14),::cpp::VirtualArray_obj::__new(1)->init(0,::hx::ObjectPtr<OBJ_>(this)));
+ }
+
+
+
+::hx::ObjectPtr< DirectChat_obj > DirectChat_obj::__new( ::snikket::Client client, ::snikket::GenericStream stream,::Dynamic persistence,::String chatId,::hx::Null< int > __o_uiState,::hx::Null< bool > __o_isBlocked, ::snikket::Stanza extensions,::String readUpToId,::String readUpToBy) {
+ ::hx::ObjectPtr< DirectChat_obj > __this = new DirectChat_obj();
+ __this->__construct(client,stream,persistence,chatId,__o_uiState,__o_isBlocked,extensions,readUpToId,readUpToBy);
+ return __this;
+}
+
+::hx::ObjectPtr< DirectChat_obj > DirectChat_obj::__alloc(::hx::Ctx *_hx_ctx, ::snikket::Client client, ::snikket::GenericStream stream,::Dynamic persistence,::String chatId,::hx::Null< int > __o_uiState,::hx::Null< bool > __o_isBlocked, ::snikket::Stanza extensions,::String readUpToId,::String readUpToBy) {
+ DirectChat_obj *__this = (DirectChat_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(DirectChat_obj), true, "snikket.DirectChat"));
+ *(void **)__this = DirectChat_obj::_hx_vtable;
+ __this->__construct(client,stream,persistence,chatId,__o_uiState,__o_isBlocked,extensions,readUpToId,readUpToBy);
+ return __this;
+}
+
+DirectChat_obj::DirectChat_obj()
+{
+}
+
+::hx::Val DirectChat_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"close") ) { return ::hx::Val( close_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"bookmark") ) { return ::hx::Val( bookmark_dyn() ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"sendMessage") ) { return ::hx::Val( sendMessage_dyn() ); }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"counterparts") ) { return ::hx::Val( counterparts_dyn() ); }
+ if (HX_FIELD_EQ(inName,"markReadUpTo") ) { return ::hx::Val( markReadUpTo_dyn() ); }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"lastMessageId") ) { return ::hx::Val( lastMessageId_dyn() ); }
+ if (HX_FIELD_EQ(inName,"sendChatState") ) { return ::hx::Val( sendChatState_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"correctMessage") ) { return ::hx::Val( correctMessage_dyn() ); }
+ if (HX_FIELD_EQ(inName,"removeReaction") ) { return ::hx::Val( removeReaction_dyn() ); }
+ break;
+ case 15:
+ if (HX_FIELD_EQ(inName,"getParticipants") ) { return ::hx::Val( getParticipants_dyn() ); }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"getMessagesAfter") ) { return ::hx::Val( getMessagesAfter_dyn() ); }
+ break;
+ case 17:
+ if (HX_FIELD_EQ(inName,"getMessagesBefore") ) { return ::hx::Val( getMessagesBefore_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getMessagesAround") ) { return ::hx::Val( getMessagesAround_dyn() ); }
+ break;
+ case 21:
+ if (HX_FIELD_EQ(inName,"getParticipantDetails") ) { return ::hx::Val( getParticipantDetails_dyn() ); }
+ break;
+ case 22:
+ if (HX_FIELD_EQ(inName,"prepareIncomingMessage") ) { return ::hx::Val( prepareIncomingMessage_dyn() ); }
+ if (HX_FIELD_EQ(inName,"prepareOutgoingMessage") ) { return ::hx::Val( prepareOutgoingMessage_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *DirectChat_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *DirectChat_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String DirectChat_obj_sMemberFields[] = {
+ HX_("getParticipants",16,0b,c7,34),
+ HX_("counterparts",a4,10,14,78),
+ HX_("getParticipantDetails",85,2b,7d,4d),
+ HX_("getMessagesBefore",a1,f1,44,11),
+ HX_("getMessagesAfter",3a,43,91,57),
+ HX_("getMessagesAround",6f,95,16,2d),
+ HX_("prepareIncomingMessage",ba,eb,c6,e3),
+ HX_("prepareOutgoingMessage",f4,b0,f3,49),
+ HX_("correctMessage",7d,36,c3,f4),
+ HX_("sendMessage",5f,89,1d,24),
+ HX_("removeReaction",0d,24,0b,c1),
+ HX_("lastMessageId",4c,90,58,27),
+ HX_("markReadUpTo",59,68,2d,ee),
+ HX_("bookmark",b6,8c,f1,32),
+ HX_("sendChatState",b1,21,95,6e),
+ HX_("close",b8,17,63,48),
+ ::String(null()) };
+
+::hx::Class DirectChat_obj::__mClass;
+
+void DirectChat_obj::__register()
+{
+ DirectChat_obj _hx_dummy;
+ DirectChat_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.DirectChat",12,9f,50,5b);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(DirectChat_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< DirectChat_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = DirectChat_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = DirectChat_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void DirectChat_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_af7b91d6026813b6_717_boot)
+HXDLIN( 717) __mClass->__meta__ = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("fields",79,8e,8e,80), ::Dynamic(::hx::Anon_obj::Create(12)
+ ->setFixed(0,HX_("removeReaction",0d,24,0b,c1), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(1,HX_("markReadUpTo",59,68,2d,ee), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(2,HX_("correctMessage",7d,36,c3,f4), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(3,HX_("getMessagesBefore",a1,f1,44,11), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(4,HX_("sendMessage",5f,89,1d,24), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(5,HX_("lastMessageId",4c,90,58,27), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(6,HX_("getMessagesAround",6f,95,16,2d), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(7,HX_("bookmark",b6,8c,f1,32), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(8,HX_("getParticipants",16,0b,c7,34), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(9,HX_("close",b8,17,63,48), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(10,HX_("getParticipantDetails",85,2b,7d,4d), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(11,HX_("getMessagesAfter",3a,43,91,57), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null()))))));
+ }
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/Emoji.cpp b/Sources/c_snikket/src/snikket/Emoji.cpp
new file mode 100644
index 0000000..6b90304
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/Emoji.cpp
@@ -0,0 +1,93 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_Emoji
+#include <snikket/Emoji.h>
+#endif
+#ifndef INCLUDED_snikket_Symbol
+#include <snikket/Symbol.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_dd1b4f8973e1f9df_136_new,"snikket.Emoji","new",0x21016427,"snikket.Emoji.new","snikket/EmojiUtil.hx",136,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_dd1b4f8973e1f9df_140_isEmoji,"snikket.Emoji","isEmoji",0x038f9683,"snikket.Emoji.isEmoji","snikket/EmojiUtil.hx",140,0x30de6948)
+namespace snikket{
+
+void Emoji_obj::__construct(::Array< int > codepoints){
+ HX_STACKFRAME(&_hx_pos_dd1b4f8973e1f9df_136_new)
+HXDLIN( 136) super::__construct(codepoints);
+ }
+
+Dynamic Emoji_obj::__CreateEmpty() { return new Emoji_obj; }
+
+void *Emoji_obj::_hx_vtable = 0;
+
+Dynamic Emoji_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Emoji_obj > _hx_result = new Emoji_obj();
+ _hx_result->__construct(inArgs[0]);
+ return _hx_result;
+}
+
+bool Emoji_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x45c9a089) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x45c9a089;
+ } else {
+ return inClassId==(int)0x4b1860f5;
+ }
+}
+
+bool Emoji_obj::isEmoji(){
+ HX_STACKFRAME(&_hx_pos_dd1b4f8973e1f9df_140_isEmoji)
+HXDLIN( 140) return true;
+ }
+
+
+
+Emoji_obj::Emoji_obj()
+{
+}
+
+::hx::Val Emoji_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 7:
+ if (HX_FIELD_EQ(inName,"isEmoji") ) { return ::hx::Val( isEmoji_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *Emoji_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *Emoji_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Emoji_obj_sMemberFields[] = {
+ HX_("isEmoji",3c,13,5f,0c),
+ ::String(null()) };
+
+::hx::Class Emoji_obj::__mClass;
+
+void Emoji_obj::__register()
+{
+ Emoji_obj _hx_dummy;
+ Emoji_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.Emoji",b5,c4,0c,cb);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Emoji_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Emoji_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Emoji_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Emoji_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/EmojiUtil.cpp b/Sources/c_snikket/src/snikket/EmojiUtil.cpp
new file mode 100644
index 0000000..f9788f2
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/EmojiUtil.cpp
@@ -0,0 +1,578 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_Builder
+#include <snikket/Builder.h>
+#endif
+#ifndef INCLUDED_snikket_EmojiUtil
+#include <snikket/EmojiUtil.h>
+#endif
+#ifndef INCLUDED_snikket_StringUtil
+#include <snikket/StringUtil.h>
+#endif
+#ifndef INCLUDED_snikket_Symbol
+#include <snikket/Symbol.h>
+#endif
+#ifndef INCLUDED_snikket_UnicodeBlocks
+#include <snikket/UnicodeBlocks.h>
+#endif
+#ifndef INCLUDED_snikket_UnicodeList
+#include <snikket/UnicodeList.h>
+#endif
+#ifndef INCLUDED_snikket_UnicodeRange
+#include <snikket/UnicodeRange.h>
+#endif
+#ifndef INCLUDED_snikket_UnicodeSet
+#include <snikket/UnicodeSet.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_b91bb4f89662e69a_77_parse,"snikket.EmojiUtil","parse",0x8a080bdc,"snikket.EmojiUtil.parse","snikket/EmojiUtil.hx",77,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_b91bb4f89662e69a_100_isEmoji,"snikket.EmojiUtil","isEmoji",0x47668b25,"snikket.EmojiUtil.isEmoji","snikket/EmojiUtil.hx",100,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_b91bb4f89662e69a_105_isOnlyEmoji,"snikket.EmojiUtil","isOnlyEmoji",0x7a0a0999,"snikket.EmojiUtil.isOnlyEmoji","snikket/EmojiUtil.hx",105,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_b91bb4f89662e69a_34_boot,"snikket.EmojiUtil","boot",0x5b47f0a9,"snikket.EmojiUtil.boot","snikket/EmojiUtil.hx",34,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_b91bb4f89662e69a_35_boot,"snikket.EmojiUtil","boot",0x5b47f0a9,"snikket.EmojiUtil.boot","snikket/EmojiUtil.hx",35,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_b91bb4f89662e69a_36_boot,"snikket.EmojiUtil","boot",0x5b47f0a9,"snikket.EmojiUtil.boot","snikket/EmojiUtil.hx",36,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_b91bb4f89662e69a_38_boot,"snikket.EmojiUtil","boot",0x5b47f0a9,"snikket.EmojiUtil.boot","snikket/EmojiUtil.hx",38,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_b91bb4f89662e69a_39_boot,"snikket.EmojiUtil","boot",0x5b47f0a9,"snikket.EmojiUtil.boot","snikket/EmojiUtil.hx",39,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_b91bb4f89662e69a_40_boot,"snikket.EmojiUtil","boot",0x5b47f0a9,"snikket.EmojiUtil.boot","snikket/EmojiUtil.hx",40,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_b91bb4f89662e69a_41_boot,"snikket.EmojiUtil","boot",0x5b47f0a9,"snikket.EmojiUtil.boot","snikket/EmojiUtil.hx",41,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_b91bb4f89662e69a_42_boot,"snikket.EmojiUtil","boot",0x5b47f0a9,"snikket.EmojiUtil.boot","snikket/EmojiUtil.hx",42,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_b91bb4f89662e69a_43_boot,"snikket.EmojiUtil","boot",0x5b47f0a9,"snikket.EmojiUtil.boot","snikket/EmojiUtil.hx",43,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_b91bb4f89662e69a_44_boot,"snikket.EmojiUtil","boot",0x5b47f0a9,"snikket.EmojiUtil.boot","snikket/EmojiUtil.hx",44,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_b91bb4f89662e69a_45_boot,"snikket.EmojiUtil","boot",0x5b47f0a9,"snikket.EmojiUtil.boot","snikket/EmojiUtil.hx",45,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_b91bb4f89662e69a_46_boot,"snikket.EmojiUtil","boot",0x5b47f0a9,"snikket.EmojiUtil.boot","snikket/EmojiUtil.hx",46,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_b91bb4f89662e69a_47_boot,"snikket.EmojiUtil","boot",0x5b47f0a9,"snikket.EmojiUtil.boot","snikket/EmojiUtil.hx",47,0x30de6948)
+static const int _hx_array_data_3acd4757_18[] = {
+ (int)12336,(int)12349,
+};
+HX_LOCAL_STACK_FRAME(_hx_pos_b91bb4f89662e69a_48_boot,"snikket.EmojiUtil","boot",0x5b47f0a9,"snikket.EmojiUtil.boot","snikket/EmojiUtil.hx",48,0x30de6948)
+static const int _hx_array_data_3acd4757_20[] = {
+ (int)8482,(int)8505,
+};
+HX_LOCAL_STACK_FRAME(_hx_pos_b91bb4f89662e69a_50_boot,"snikket.EmojiUtil","boot",0x5b47f0a9,"snikket.EmojiUtil.boot","snikket/EmojiUtil.hx",50,0x30de6948)
+static const int _hx_array_data_3acd4757_22[] = {
+ (int)35,
+};
+static const int _hx_array_data_3acd4757_23[] = {
+ (int)42,
+};
+HX_LOCAL_STACK_FRAME(_hx_pos_b91bb4f89662e69a_52_boot,"snikket.EmojiUtil","boot",0x5b47f0a9,"snikket.EmojiUtil.boot","snikket/EmojiUtil.hx",52,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_b91bb4f89662e69a_58_boot,"snikket.EmojiUtil","boot",0x5b47f0a9,"snikket.EmojiUtil.boot","snikket/EmojiUtil.hx",58,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_b91bb4f89662e69a_71_boot,"snikket.EmojiUtil","boot",0x5b47f0a9,"snikket.EmojiUtil.boot","snikket/EmojiUtil.hx",71,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_b91bb4f89662e69a_72_boot,"snikket.EmojiUtil","boot",0x5b47f0a9,"snikket.EmojiUtil.boot","snikket/EmojiUtil.hx",72,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_b91bb4f89662e69a_73_boot,"snikket.EmojiUtil","boot",0x5b47f0a9,"snikket.EmojiUtil.boot","snikket/EmojiUtil.hx",73,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_b91bb4f89662e69a_74_boot,"snikket.EmojiUtil","boot",0x5b47f0a9,"snikket.EmojiUtil.boot","snikket/EmojiUtil.hx",74,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_b91bb4f89662e69a_75_boot,"snikket.EmojiUtil","boot",0x5b47f0a9,"snikket.EmojiUtil.boot","snikket/EmojiUtil.hx",75,0x30de6948)
+namespace snikket{
+
+void EmojiUtil_obj::__construct() { }
+
+Dynamic EmojiUtil_obj::__CreateEmpty() { return new EmojiUtil_obj; }
+
+void *EmojiUtil_obj::_hx_vtable = 0;
+
+Dynamic EmojiUtil_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< EmojiUtil_obj > _hx_result = new EmojiUtil_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool EmojiUtil_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x636eb1f3;
+}
+
+ ::snikket::UnicodeRange EmojiUtil_obj::MISC_SYMBOLS_AND_PICTOGRAPHS;
+
+ ::snikket::UnicodeRange EmojiUtil_obj::SUPPLEMENTAL_SYMBOLS;
+
+ ::snikket::UnicodeRange EmojiUtil_obj::EMOTICONS;
+
+ ::snikket::UnicodeRange EmojiUtil_obj::MISC_SYMBOLS;
+
+ ::snikket::UnicodeRange EmojiUtil_obj::DINGBATS;
+
+ ::snikket::UnicodeRange EmojiUtil_obj::ENCLOSED_ALPHANUMERIC_SUPPLEMENT;
+
+ ::snikket::UnicodeRange EmojiUtil_obj::ENCLOSED_IDEOGRAPHIC_SUPPLEMENT;
+
+ ::snikket::UnicodeRange EmojiUtil_obj::REGIONAL_INDICATORS;
+
+ ::snikket::UnicodeRange EmojiUtil_obj::GEOMETRIC_SHAPES;
+
+ ::snikket::UnicodeRange EmojiUtil_obj::LATIN_SUPPLEMENT;
+
+ ::snikket::UnicodeRange EmojiUtil_obj::MISC_TECHNICAL;
+
+ ::snikket::UnicodeRange EmojiUtil_obj::TAGS;
+
+ ::snikket::UnicodeList EmojiUtil_obj::CYK_SYMBOLS_AND_PUNCTUATION;
+
+ ::snikket::UnicodeList EmojiUtil_obj::LETTERLIKE_SYMBOLS;
+
+ ::snikket::UnicodeBlocks EmojiUtil_obj::KEYCAP_COMBINEABLE;
+
+ ::snikket::UnicodeBlocks EmojiUtil_obj::SYMBOLIZE;
+
+ ::snikket::UnicodeBlocks EmojiUtil_obj::EMOJIS;
+
+int EmojiUtil_obj::ZWJ;
+
+int EmojiUtil_obj::VARIATION_16;
+
+int EmojiUtil_obj::COMBINING_ENCLOSING_KEYCAP;
+
+int EmojiUtil_obj::BLACK_FLAG;
+
+ ::snikket::UnicodeRange EmojiUtil_obj::FITZPATRICK;
+
+::Array< ::Dynamic> EmojiUtil_obj::parse(::String str){
+ HX_GC_STACKFRAME(&_hx_pos_b91bb4f89662e69a_77_parse)
+HXLINE( 78) ::Array< ::Dynamic> symbols = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 79) ::snikket::Builder builder = ::snikket::Builder_obj::__alloc( HX_CTX );
+HXLINE( 80) bool needsFinalBuild = false;
+HXLINE( 81) ::Array< int > input = ::snikket::StringUtil_obj::rawCodepointArray(str);
+HXLINE( 82) {
+HXLINE( 82) int _g = 0;
+HXDLIN( 82) int _g1 = input->length;
+HXDLIN( 82) while((_g < _g1)){
+HXLINE( 82) _g = (_g + 1);
+HXDLIN( 82) int i = (_g - 1);
+HXLINE( 83) int cp = input->__get(i);
+HXLINE( 84) if (builder->offer(cp)) {
+HXLINE( 85) needsFinalBuild = true;
+ }
+ else {
+HXLINE( 87) symbols->push(builder->build());
+HXLINE( 88) builder = ::snikket::Builder_obj::__alloc( HX_CTX );
+HXLINE( 89) if (builder->offer(cp)) {
+HXLINE( 90) needsFinalBuild = true;
+ }
+ }
+ }
+ }
+HXLINE( 94) if (needsFinalBuild) {
+HXLINE( 95) symbols->push(builder->build());
+ }
+HXLINE( 97) return symbols;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(EmojiUtil_obj,parse,return )
+
+bool EmojiUtil_obj::isEmoji(::String input){
+ HX_STACKFRAME(&_hx_pos_b91bb4f89662e69a_100_isEmoji)
+HXLINE( 101) ::Array< ::Dynamic> symbols = ::snikket::EmojiUtil_obj::parse(input);
+HXLINE( 102) if ((symbols->length == 1)) {
+HXLINE( 102) return symbols->__get(0).StaticCast< ::snikket::Symbol >()->isEmoji();
+ }
+ else {
+HXLINE( 102) return false;
+ }
+HXDLIN( 102) return false;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(EmojiUtil_obj,isEmoji,return )
+
+bool EmojiUtil_obj::isOnlyEmoji(::String input){
+ HX_STACKFRAME(&_hx_pos_b91bb4f89662e69a_105_isOnlyEmoji)
+HXLINE( 106) ::Array< ::Dynamic> symbols = ::snikket::EmojiUtil_obj::parse(input);
+HXLINE( 107) {
+HXLINE( 107) int _g = 0;
+HXDLIN( 107) while((_g < symbols->length)){
+HXLINE( 107) ::snikket::Symbol symbol = symbols->__get(_g).StaticCast< ::snikket::Symbol >();
+HXDLIN( 107) _g = (_g + 1);
+HXLINE( 108) if (!(symbol->isEmoji())) {
+HXLINE( 109) return false;
+ }
+ }
+ }
+HXLINE( 112) return (symbols->length > 0);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(EmojiUtil_obj,isOnlyEmoji,return )
+
+
+EmojiUtil_obj::EmojiUtil_obj()
+{
+}
+
+bool EmojiUtil_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"ZWJ") ) { outValue = ( ZWJ ); return true; }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"TAGS") ) { outValue = ( TAGS ); return true; }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"parse") ) { outValue = parse_dyn(); return true; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"EMOJIS") ) { outValue = ( EMOJIS ); return true; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"isEmoji") ) { outValue = isEmoji_dyn(); return true; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"DINGBATS") ) { outValue = ( DINGBATS ); return true; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"EMOTICONS") ) { outValue = ( EMOTICONS ); return true; }
+ if (HX_FIELD_EQ(inName,"SYMBOLIZE") ) { outValue = ( SYMBOLIZE ); return true; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"BLACK_FLAG") ) { outValue = ( BLACK_FLAG ); return true; }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"FITZPATRICK") ) { outValue = ( FITZPATRICK ); return true; }
+ if (HX_FIELD_EQ(inName,"isOnlyEmoji") ) { outValue = isOnlyEmoji_dyn(); return true; }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"MISC_SYMBOLS") ) { outValue = ( MISC_SYMBOLS ); return true; }
+ if (HX_FIELD_EQ(inName,"VARIATION_16") ) { outValue = ( VARIATION_16 ); return true; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"MISC_TECHNICAL") ) { outValue = ( MISC_TECHNICAL ); return true; }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"GEOMETRIC_SHAPES") ) { outValue = ( GEOMETRIC_SHAPES ); return true; }
+ if (HX_FIELD_EQ(inName,"LATIN_SUPPLEMENT") ) { outValue = ( LATIN_SUPPLEMENT ); return true; }
+ break;
+ case 18:
+ if (HX_FIELD_EQ(inName,"LETTERLIKE_SYMBOLS") ) { outValue = ( LETTERLIKE_SYMBOLS ); return true; }
+ if (HX_FIELD_EQ(inName,"KEYCAP_COMBINEABLE") ) { outValue = ( KEYCAP_COMBINEABLE ); return true; }
+ break;
+ case 19:
+ if (HX_FIELD_EQ(inName,"REGIONAL_INDICATORS") ) { outValue = ( REGIONAL_INDICATORS ); return true; }
+ break;
+ case 20:
+ if (HX_FIELD_EQ(inName,"SUPPLEMENTAL_SYMBOLS") ) { outValue = ( SUPPLEMENTAL_SYMBOLS ); return true; }
+ break;
+ case 26:
+ if (HX_FIELD_EQ(inName,"COMBINING_ENCLOSING_KEYCAP") ) { outValue = ( COMBINING_ENCLOSING_KEYCAP ); return true; }
+ break;
+ case 27:
+ if (HX_FIELD_EQ(inName,"CYK_SYMBOLS_AND_PUNCTUATION") ) { outValue = ( CYK_SYMBOLS_AND_PUNCTUATION ); return true; }
+ break;
+ case 28:
+ if (HX_FIELD_EQ(inName,"MISC_SYMBOLS_AND_PICTOGRAPHS") ) { outValue = ( MISC_SYMBOLS_AND_PICTOGRAPHS ); return true; }
+ break;
+ case 31:
+ if (HX_FIELD_EQ(inName,"ENCLOSED_IDEOGRAPHIC_SUPPLEMENT") ) { outValue = ( ENCLOSED_IDEOGRAPHIC_SUPPLEMENT ); return true; }
+ break;
+ case 32:
+ if (HX_FIELD_EQ(inName,"ENCLOSED_ALPHANUMERIC_SUPPLEMENT") ) { outValue = ( ENCLOSED_ALPHANUMERIC_SUPPLEMENT ); return true; }
+ }
+ return false;
+}
+
+bool EmojiUtil_obj::__SetStatic(const ::String &inName,Dynamic &ioValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"ZWJ") ) { ZWJ=ioValue.Cast< int >(); return true; }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"TAGS") ) { TAGS=ioValue.Cast< ::snikket::UnicodeRange >(); return true; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"EMOJIS") ) { EMOJIS=ioValue.Cast< ::snikket::UnicodeBlocks >(); return true; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"DINGBATS") ) { DINGBATS=ioValue.Cast< ::snikket::UnicodeRange >(); return true; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"EMOTICONS") ) { EMOTICONS=ioValue.Cast< ::snikket::UnicodeRange >(); return true; }
+ if (HX_FIELD_EQ(inName,"SYMBOLIZE") ) { SYMBOLIZE=ioValue.Cast< ::snikket::UnicodeBlocks >(); return true; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"BLACK_FLAG") ) { BLACK_FLAG=ioValue.Cast< int >(); return true; }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"FITZPATRICK") ) { FITZPATRICK=ioValue.Cast< ::snikket::UnicodeRange >(); return true; }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"MISC_SYMBOLS") ) { MISC_SYMBOLS=ioValue.Cast< ::snikket::UnicodeRange >(); return true; }
+ if (HX_FIELD_EQ(inName,"VARIATION_16") ) { VARIATION_16=ioValue.Cast< int >(); return true; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"MISC_TECHNICAL") ) { MISC_TECHNICAL=ioValue.Cast< ::snikket::UnicodeRange >(); return true; }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"GEOMETRIC_SHAPES") ) { GEOMETRIC_SHAPES=ioValue.Cast< ::snikket::UnicodeRange >(); return true; }
+ if (HX_FIELD_EQ(inName,"LATIN_SUPPLEMENT") ) { LATIN_SUPPLEMENT=ioValue.Cast< ::snikket::UnicodeRange >(); return true; }
+ break;
+ case 18:
+ if (HX_FIELD_EQ(inName,"LETTERLIKE_SYMBOLS") ) { LETTERLIKE_SYMBOLS=ioValue.Cast< ::snikket::UnicodeList >(); return true; }
+ if (HX_FIELD_EQ(inName,"KEYCAP_COMBINEABLE") ) { KEYCAP_COMBINEABLE=ioValue.Cast< ::snikket::UnicodeBlocks >(); return true; }
+ break;
+ case 19:
+ if (HX_FIELD_EQ(inName,"REGIONAL_INDICATORS") ) { REGIONAL_INDICATORS=ioValue.Cast< ::snikket::UnicodeRange >(); return true; }
+ break;
+ case 20:
+ if (HX_FIELD_EQ(inName,"SUPPLEMENTAL_SYMBOLS") ) { SUPPLEMENTAL_SYMBOLS=ioValue.Cast< ::snikket::UnicodeRange >(); return true; }
+ break;
+ case 26:
+ if (HX_FIELD_EQ(inName,"COMBINING_ENCLOSING_KEYCAP") ) { COMBINING_ENCLOSING_KEYCAP=ioValue.Cast< int >(); return true; }
+ break;
+ case 27:
+ if (HX_FIELD_EQ(inName,"CYK_SYMBOLS_AND_PUNCTUATION") ) { CYK_SYMBOLS_AND_PUNCTUATION=ioValue.Cast< ::snikket::UnicodeList >(); return true; }
+ break;
+ case 28:
+ if (HX_FIELD_EQ(inName,"MISC_SYMBOLS_AND_PICTOGRAPHS") ) { MISC_SYMBOLS_AND_PICTOGRAPHS=ioValue.Cast< ::snikket::UnicodeRange >(); return true; }
+ break;
+ case 31:
+ if (HX_FIELD_EQ(inName,"ENCLOSED_IDEOGRAPHIC_SUPPLEMENT") ) { ENCLOSED_IDEOGRAPHIC_SUPPLEMENT=ioValue.Cast< ::snikket::UnicodeRange >(); return true; }
+ break;
+ case 32:
+ if (HX_FIELD_EQ(inName,"ENCLOSED_ALPHANUMERIC_SUPPLEMENT") ) { ENCLOSED_ALPHANUMERIC_SUPPLEMENT=ioValue.Cast< ::snikket::UnicodeRange >(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *EmojiUtil_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo EmojiUtil_obj_sStaticStorageInfo[] = {
+ {::hx::fsObject /* ::snikket::UnicodeRange */ ,(void *) &EmojiUtil_obj::MISC_SYMBOLS_AND_PICTOGRAPHS,HX_("MISC_SYMBOLS_AND_PICTOGRAPHS",6b,a7,09,a7)},
+ {::hx::fsObject /* ::snikket::UnicodeRange */ ,(void *) &EmojiUtil_obj::SUPPLEMENTAL_SYMBOLS,HX_("SUPPLEMENTAL_SYMBOLS",e0,a9,11,c1)},
+ {::hx::fsObject /* ::snikket::UnicodeRange */ ,(void *) &EmojiUtil_obj::EMOTICONS,HX_("EMOTICONS",0d,70,1d,af)},
+ {::hx::fsObject /* ::snikket::UnicodeRange */ ,(void *) &EmojiUtil_obj::MISC_SYMBOLS,HX_("MISC_SYMBOLS",68,d2,fb,df)},
+ {::hx::fsObject /* ::snikket::UnicodeRange */ ,(void *) &EmojiUtil_obj::DINGBATS,HX_("DINGBATS",fc,32,20,4a)},
+ {::hx::fsObject /* ::snikket::UnicodeRange */ ,(void *) &EmojiUtil_obj::ENCLOSED_ALPHANUMERIC_SUPPLEMENT,HX_("ENCLOSED_ALPHANUMERIC_SUPPLEMENT",df,fc,6e,99)},
+ {::hx::fsObject /* ::snikket::UnicodeRange */ ,(void *) &EmojiUtil_obj::ENCLOSED_IDEOGRAPHIC_SUPPLEMENT,HX_("ENCLOSED_IDEOGRAPHIC_SUPPLEMENT",7f,1e,4d,ee)},
+ {::hx::fsObject /* ::snikket::UnicodeRange */ ,(void *) &EmojiUtil_obj::REGIONAL_INDICATORS,HX_("REGIONAL_INDICATORS",64,22,b5,9f)},
+ {::hx::fsObject /* ::snikket::UnicodeRange */ ,(void *) &EmojiUtil_obj::GEOMETRIC_SHAPES,HX_("GEOMETRIC_SHAPES",90,7a,2c,6b)},
+ {::hx::fsObject /* ::snikket::UnicodeRange */ ,(void *) &EmojiUtil_obj::LATIN_SUPPLEMENT,HX_("LATIN_SUPPLEMENT",f4,1e,75,27)},
+ {::hx::fsObject /* ::snikket::UnicodeRange */ ,(void *) &EmojiUtil_obj::MISC_TECHNICAL,HX_("MISC_TECHNICAL",2a,1e,43,40)},
+ {::hx::fsObject /* ::snikket::UnicodeRange */ ,(void *) &EmojiUtil_obj::TAGS,HX_("TAGS",d9,7c,b7,37)},
+ {::hx::fsObject /* ::snikket::UnicodeList */ ,(void *) &EmojiUtil_obj::CYK_SYMBOLS_AND_PUNCTUATION,HX_("CYK_SYMBOLS_AND_PUNCTUATION",44,38,ef,f1)},
+ {::hx::fsObject /* ::snikket::UnicodeList */ ,(void *) &EmojiUtil_obj::LETTERLIKE_SYMBOLS,HX_("LETTERLIKE_SYMBOLS",b9,91,eb,11)},
+ {::hx::fsObject /* ::snikket::UnicodeBlocks */ ,(void *) &EmojiUtil_obj::KEYCAP_COMBINEABLE,HX_("KEYCAP_COMBINEABLE",cd,11,de,c0)},
+ {::hx::fsObject /* ::snikket::UnicodeBlocks */ ,(void *) &EmojiUtil_obj::SYMBOLIZE,HX_("SYMBOLIZE",dc,fe,6c,db)},
+ {::hx::fsObject /* ::snikket::UnicodeBlocks */ ,(void *) &EmojiUtil_obj::EMOJIS,HX_("EMOJIS",2d,d2,ea,20)},
+ {::hx::fsInt,(void *) &EmojiUtil_obj::ZWJ,HX_("ZWJ",ed,96,44,00)},
+ {::hx::fsInt,(void *) &EmojiUtil_obj::VARIATION_16,HX_("VARIATION_16",31,67,df,98)},
+ {::hx::fsInt,(void *) &EmojiUtil_obj::COMBINING_ENCLOSING_KEYCAP,HX_("COMBINING_ENCLOSING_KEYCAP",e9,3e,16,c3)},
+ {::hx::fsInt,(void *) &EmojiUtil_obj::BLACK_FLAG,HX_("BLACK_FLAG",8c,21,1f,79)},
+ {::hx::fsObject /* ::snikket::UnicodeRange */ ,(void *) &EmojiUtil_obj::FITZPATRICK,HX_("FITZPATRICK",79,7e,fb,f4)},
+ { ::hx::fsUnknown, 0, null()}
+};
+#endif
+
+static void EmojiUtil_obj_sMarkStatics(HX_MARK_PARAMS) {
+ HX_MARK_MEMBER_NAME(EmojiUtil_obj::MISC_SYMBOLS_AND_PICTOGRAPHS,"MISC_SYMBOLS_AND_PICTOGRAPHS");
+ HX_MARK_MEMBER_NAME(EmojiUtil_obj::SUPPLEMENTAL_SYMBOLS,"SUPPLEMENTAL_SYMBOLS");
+ HX_MARK_MEMBER_NAME(EmojiUtil_obj::EMOTICONS,"EMOTICONS");
+ HX_MARK_MEMBER_NAME(EmojiUtil_obj::MISC_SYMBOLS,"MISC_SYMBOLS");
+ HX_MARK_MEMBER_NAME(EmojiUtil_obj::DINGBATS,"DINGBATS");
+ HX_MARK_MEMBER_NAME(EmojiUtil_obj::ENCLOSED_ALPHANUMERIC_SUPPLEMENT,"ENCLOSED_ALPHANUMERIC_SUPPLEMENT");
+ HX_MARK_MEMBER_NAME(EmojiUtil_obj::ENCLOSED_IDEOGRAPHIC_SUPPLEMENT,"ENCLOSED_IDEOGRAPHIC_SUPPLEMENT");
+ HX_MARK_MEMBER_NAME(EmojiUtil_obj::REGIONAL_INDICATORS,"REGIONAL_INDICATORS");
+ HX_MARK_MEMBER_NAME(EmojiUtil_obj::GEOMETRIC_SHAPES,"GEOMETRIC_SHAPES");
+ HX_MARK_MEMBER_NAME(EmojiUtil_obj::LATIN_SUPPLEMENT,"LATIN_SUPPLEMENT");
+ HX_MARK_MEMBER_NAME(EmojiUtil_obj::MISC_TECHNICAL,"MISC_TECHNICAL");
+ HX_MARK_MEMBER_NAME(EmojiUtil_obj::TAGS,"TAGS");
+ HX_MARK_MEMBER_NAME(EmojiUtil_obj::CYK_SYMBOLS_AND_PUNCTUATION,"CYK_SYMBOLS_AND_PUNCTUATION");
+ HX_MARK_MEMBER_NAME(EmojiUtil_obj::LETTERLIKE_SYMBOLS,"LETTERLIKE_SYMBOLS");
+ HX_MARK_MEMBER_NAME(EmojiUtil_obj::KEYCAP_COMBINEABLE,"KEYCAP_COMBINEABLE");
+ HX_MARK_MEMBER_NAME(EmojiUtil_obj::SYMBOLIZE,"SYMBOLIZE");
+ HX_MARK_MEMBER_NAME(EmojiUtil_obj::EMOJIS,"EMOJIS");
+ HX_MARK_MEMBER_NAME(EmojiUtil_obj::ZWJ,"ZWJ");
+ HX_MARK_MEMBER_NAME(EmojiUtil_obj::VARIATION_16,"VARIATION_16");
+ HX_MARK_MEMBER_NAME(EmojiUtil_obj::COMBINING_ENCLOSING_KEYCAP,"COMBINING_ENCLOSING_KEYCAP");
+ HX_MARK_MEMBER_NAME(EmojiUtil_obj::BLACK_FLAG,"BLACK_FLAG");
+ HX_MARK_MEMBER_NAME(EmojiUtil_obj::FITZPATRICK,"FITZPATRICK");
+};
+
+#ifdef HXCPP_VISIT_ALLOCS
+static void EmojiUtil_obj_sVisitStatics(HX_VISIT_PARAMS) {
+ HX_VISIT_MEMBER_NAME(EmojiUtil_obj::MISC_SYMBOLS_AND_PICTOGRAPHS,"MISC_SYMBOLS_AND_PICTOGRAPHS");
+ HX_VISIT_MEMBER_NAME(EmojiUtil_obj::SUPPLEMENTAL_SYMBOLS,"SUPPLEMENTAL_SYMBOLS");
+ HX_VISIT_MEMBER_NAME(EmojiUtil_obj::EMOTICONS,"EMOTICONS");
+ HX_VISIT_MEMBER_NAME(EmojiUtil_obj::MISC_SYMBOLS,"MISC_SYMBOLS");
+ HX_VISIT_MEMBER_NAME(EmojiUtil_obj::DINGBATS,"DINGBATS");
+ HX_VISIT_MEMBER_NAME(EmojiUtil_obj::ENCLOSED_ALPHANUMERIC_SUPPLEMENT,"ENCLOSED_ALPHANUMERIC_SUPPLEMENT");
+ HX_VISIT_MEMBER_NAME(EmojiUtil_obj::ENCLOSED_IDEOGRAPHIC_SUPPLEMENT,"ENCLOSED_IDEOGRAPHIC_SUPPLEMENT");
+ HX_VISIT_MEMBER_NAME(EmojiUtil_obj::REGIONAL_INDICATORS,"REGIONAL_INDICATORS");
+ HX_VISIT_MEMBER_NAME(EmojiUtil_obj::GEOMETRIC_SHAPES,"GEOMETRIC_SHAPES");
+ HX_VISIT_MEMBER_NAME(EmojiUtil_obj::LATIN_SUPPLEMENT,"LATIN_SUPPLEMENT");
+ HX_VISIT_MEMBER_NAME(EmojiUtil_obj::MISC_TECHNICAL,"MISC_TECHNICAL");
+ HX_VISIT_MEMBER_NAME(EmojiUtil_obj::TAGS,"TAGS");
+ HX_VISIT_MEMBER_NAME(EmojiUtil_obj::CYK_SYMBOLS_AND_PUNCTUATION,"CYK_SYMBOLS_AND_PUNCTUATION");
+ HX_VISIT_MEMBER_NAME(EmojiUtil_obj::LETTERLIKE_SYMBOLS,"LETTERLIKE_SYMBOLS");
+ HX_VISIT_MEMBER_NAME(EmojiUtil_obj::KEYCAP_COMBINEABLE,"KEYCAP_COMBINEABLE");
+ HX_VISIT_MEMBER_NAME(EmojiUtil_obj::SYMBOLIZE,"SYMBOLIZE");
+ HX_VISIT_MEMBER_NAME(EmojiUtil_obj::EMOJIS,"EMOJIS");
+ HX_VISIT_MEMBER_NAME(EmojiUtil_obj::ZWJ,"ZWJ");
+ HX_VISIT_MEMBER_NAME(EmojiUtil_obj::VARIATION_16,"VARIATION_16");
+ HX_VISIT_MEMBER_NAME(EmojiUtil_obj::COMBINING_ENCLOSING_KEYCAP,"COMBINING_ENCLOSING_KEYCAP");
+ HX_VISIT_MEMBER_NAME(EmojiUtil_obj::BLACK_FLAG,"BLACK_FLAG");
+ HX_VISIT_MEMBER_NAME(EmojiUtil_obj::FITZPATRICK,"FITZPATRICK");
+};
+
+#endif
+
+::hx::Class EmojiUtil_obj::__mClass;
+
+static ::String EmojiUtil_obj_sStaticFields[] = {
+ HX_("MISC_SYMBOLS_AND_PICTOGRAPHS",6b,a7,09,a7),
+ HX_("SUPPLEMENTAL_SYMBOLS",e0,a9,11,c1),
+ HX_("EMOTICONS",0d,70,1d,af),
+ HX_("MISC_SYMBOLS",68,d2,fb,df),
+ HX_("DINGBATS",fc,32,20,4a),
+ HX_("ENCLOSED_ALPHANUMERIC_SUPPLEMENT",df,fc,6e,99),
+ HX_("ENCLOSED_IDEOGRAPHIC_SUPPLEMENT",7f,1e,4d,ee),
+ HX_("REGIONAL_INDICATORS",64,22,b5,9f),
+ HX_("GEOMETRIC_SHAPES",90,7a,2c,6b),
+ HX_("LATIN_SUPPLEMENT",f4,1e,75,27),
+ HX_("MISC_TECHNICAL",2a,1e,43,40),
+ HX_("TAGS",d9,7c,b7,37),
+ HX_("CYK_SYMBOLS_AND_PUNCTUATION",44,38,ef,f1),
+ HX_("LETTERLIKE_SYMBOLS",b9,91,eb,11),
+ HX_("KEYCAP_COMBINEABLE",cd,11,de,c0),
+ HX_("SYMBOLIZE",dc,fe,6c,db),
+ HX_("EMOJIS",2d,d2,ea,20),
+ HX_("ZWJ",ed,96,44,00),
+ HX_("VARIATION_16",31,67,df,98),
+ HX_("COMBINING_ENCLOSING_KEYCAP",e9,3e,16,c3),
+ HX_("BLACK_FLAG",8c,21,1f,79),
+ HX_("FITZPATRICK",79,7e,fb,f4),
+ HX_("parse",33,90,55,bd),
+ HX_("isEmoji",3c,13,5f,0c),
+ HX_("isOnlyEmoji",30,e9,1d,d8),
+ ::String(null())
+};
+
+void EmojiUtil_obj::__register()
+{
+ EmojiUtil_obj _hx_dummy;
+ EmojiUtil_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.EmojiUtil",57,47,cd,3a);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &EmojiUtil_obj::__GetStatic;
+ __mClass->mSetStaticField = &EmojiUtil_obj::__SetStatic;
+ __mClass->mMarkFunc = EmojiUtil_obj_sMarkStatics;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(EmojiUtil_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< EmojiUtil_obj >;
+#ifdef HXCPP_VISIT_ALLOCS
+ __mClass->mVisitFunc = EmojiUtil_obj_sVisitStatics;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = EmojiUtil_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = EmojiUtil_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void EmojiUtil_obj::__boot()
+{
+{
+ HX_GC_STACKFRAME(&_hx_pos_b91bb4f89662e69a_34_boot)
+HXDLIN( 34) MISC_SYMBOLS_AND_PICTOGRAPHS = ::snikket::UnicodeRange_obj::__alloc( HX_CTX ,127744,128511);
+ }
+{
+ HX_GC_STACKFRAME(&_hx_pos_b91bb4f89662e69a_35_boot)
+HXDLIN( 35) SUPPLEMENTAL_SYMBOLS = ::snikket::UnicodeRange_obj::__alloc( HX_CTX ,129280,129535);
+ }
+{
+ HX_GC_STACKFRAME(&_hx_pos_b91bb4f89662e69a_36_boot)
+HXDLIN( 36) EMOTICONS = ::snikket::UnicodeRange_obj::__alloc( HX_CTX ,128512,129782);
+ }
+{
+ HX_GC_STACKFRAME(&_hx_pos_b91bb4f89662e69a_38_boot)
+HXDLIN( 38) MISC_SYMBOLS = ::snikket::UnicodeRange_obj::__alloc( HX_CTX ,9728,9983);
+ }
+{
+ HX_GC_STACKFRAME(&_hx_pos_b91bb4f89662e69a_39_boot)
+HXDLIN( 39) DINGBATS = ::snikket::UnicodeRange_obj::__alloc( HX_CTX ,9984,10175);
+ }
+{
+ HX_GC_STACKFRAME(&_hx_pos_b91bb4f89662e69a_40_boot)
+HXDLIN( 40) ENCLOSED_ALPHANUMERIC_SUPPLEMENT = ::snikket::UnicodeRange_obj::__alloc( HX_CTX ,127232,127487);
+ }
+{
+ HX_GC_STACKFRAME(&_hx_pos_b91bb4f89662e69a_41_boot)
+HXDLIN( 41) ENCLOSED_IDEOGRAPHIC_SUPPLEMENT = ::snikket::UnicodeRange_obj::__alloc( HX_CTX ,127488,127743);
+ }
+{
+ HX_GC_STACKFRAME(&_hx_pos_b91bb4f89662e69a_42_boot)
+HXDLIN( 42) REGIONAL_INDICATORS = ::snikket::UnicodeRange_obj::__alloc( HX_CTX ,127462,127487);
+ }
+{
+ HX_GC_STACKFRAME(&_hx_pos_b91bb4f89662e69a_43_boot)
+HXDLIN( 43) GEOMETRIC_SHAPES = ::snikket::UnicodeRange_obj::__alloc( HX_CTX ,9632,9727);
+ }
+{
+ HX_GC_STACKFRAME(&_hx_pos_b91bb4f89662e69a_44_boot)
+HXDLIN( 44) LATIN_SUPPLEMENT = ::snikket::UnicodeRange_obj::__alloc( HX_CTX ,128,255);
+ }
+{
+ HX_GC_STACKFRAME(&_hx_pos_b91bb4f89662e69a_45_boot)
+HXDLIN( 45) MISC_TECHNICAL = ::snikket::UnicodeRange_obj::__alloc( HX_CTX ,8960,9215);
+ }
+{
+ HX_GC_STACKFRAME(&_hx_pos_b91bb4f89662e69a_46_boot)
+HXDLIN( 46) TAGS = ::snikket::UnicodeRange_obj::__alloc( HX_CTX ,917536,917631);
+ }
+{
+ HX_GC_STACKFRAME(&_hx_pos_b91bb4f89662e69a_47_boot)
+HXDLIN( 47) CYK_SYMBOLS_AND_PUNCTUATION = ::snikket::UnicodeList_obj::__alloc( HX_CTX ,::Array_obj< int >::fromData( _hx_array_data_3acd4757_18,2));
+ }
+{
+ HX_GC_STACKFRAME(&_hx_pos_b91bb4f89662e69a_48_boot)
+HXDLIN( 48) LETTERLIKE_SYMBOLS = ::snikket::UnicodeList_obj::__alloc( HX_CTX ,::Array_obj< int >::fromData( _hx_array_data_3acd4757_20,2));
+ }
+{
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(0)
+ ::snikket::UnicodeBlocks _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_b91bb4f89662e69a_50_boot)
+HXDLIN( 50) ::snikket::UnicodeList array = ::snikket::UnicodeList_obj::__alloc( HX_CTX ,::Array_obj< int >::fromData( _hx_array_data_3acd4757_22,1));
+HXDLIN( 50) ::snikket::UnicodeList array1 = ::snikket::UnicodeList_obj::__alloc( HX_CTX ,::Array_obj< int >::fromData( _hx_array_data_3acd4757_23,1));
+HXDLIN( 50) return ::snikket::UnicodeBlocks_obj::__alloc( HX_CTX ,::Array_obj< ::Dynamic>::__new(3)->init(0,array)->init(1,array1)->init(2, ::snikket::UnicodeRange_obj::__alloc( HX_CTX ,48,57)));
+ }
+ HX_END_LOCAL_FUNC0(return)
+
+ HX_STACKFRAME(&_hx_pos_b91bb4f89662e69a_50_boot)
+HXDLIN( 50) KEYCAP_COMBINEABLE = ( ( ::snikket::UnicodeBlocks)( ::Dynamic(new _hx_Closure_0())()) );
+ }
+{
+ HX_GC_STACKFRAME(&_hx_pos_b91bb4f89662e69a_52_boot)
+HXDLIN( 52) SYMBOLIZE = ::snikket::UnicodeBlocks_obj::__alloc( HX_CTX ,::Array_obj< ::Dynamic>::__new(5)->init(0,::snikket::EmojiUtil_obj::GEOMETRIC_SHAPES)->init(1,::snikket::EmojiUtil_obj::LATIN_SUPPLEMENT)->init(2,::snikket::EmojiUtil_obj::CYK_SYMBOLS_AND_PUNCTUATION)->init(3,::snikket::EmojiUtil_obj::LETTERLIKE_SYMBOLS)->init(4,::snikket::EmojiUtil_obj::KEYCAP_COMBINEABLE));
+ }
+{
+ HX_GC_STACKFRAME(&_hx_pos_b91bb4f89662e69a_58_boot)
+HXDLIN( 58) EMOJIS = ::snikket::UnicodeBlocks_obj::__alloc( HX_CTX ,::Array_obj< ::Dynamic>::__new(8)->init(0,::snikket::EmojiUtil_obj::MISC_SYMBOLS_AND_PICTOGRAPHS)->init(1,::snikket::EmojiUtil_obj::SUPPLEMENTAL_SYMBOLS)->init(2,::snikket::EmojiUtil_obj::EMOTICONS)->init(3,::snikket::EmojiUtil_obj::MISC_SYMBOLS)->init(4,::snikket::EmojiUtil_obj::DINGBATS)->init(5,::snikket::EmojiUtil_obj::ENCLOSED_ALPHANUMERIC_SUPPLEMENT)->init(6,::snikket::EmojiUtil_obj::ENCLOSED_IDEOGRAPHIC_SUPPLEMENT)->init(7,::snikket::EmojiUtil_obj::MISC_TECHNICAL));
+ }
+{
+ HX_STACKFRAME(&_hx_pos_b91bb4f89662e69a_71_boot)
+HXDLIN( 71) ZWJ = 8205;
+ }
+{
+ HX_STACKFRAME(&_hx_pos_b91bb4f89662e69a_72_boot)
+HXDLIN( 72) VARIATION_16 = 65039;
+ }
+{
+ HX_STACKFRAME(&_hx_pos_b91bb4f89662e69a_73_boot)
+HXDLIN( 73) COMBINING_ENCLOSING_KEYCAP = 8419;
+ }
+{
+ HX_STACKFRAME(&_hx_pos_b91bb4f89662e69a_74_boot)
+HXDLIN( 74) BLACK_FLAG = 127988;
+ }
+{
+ HX_GC_STACKFRAME(&_hx_pos_b91bb4f89662e69a_75_boot)
+HXDLIN( 75) FITZPATRICK = ::snikket::UnicodeRange_obj::__alloc( HX_CTX ,127995,127999);
+ }
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/EventEmitter.cpp b/Sources/c_snikket/src/snikket/EventEmitter.cpp
new file mode 100644
index 0000000..4051b9c
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/EventEmitter.cpp
@@ -0,0 +1,230 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_Log
+#include <haxe/Log.h>
+#endif
+#ifndef INCLUDED_haxe_ds_StringMap
+#include <haxe/ds/StringMap.h>
+#endif
+#ifndef INCLUDED_snikket_EventEmitter
+#include <snikket/EventEmitter.h>
+#endif
+#ifndef INCLUDED_snikket_EventHandler
+#include <snikket/EventHandler.h>
+#endif
+#ifndef INCLUDED_snikket_EventResult
+#include <snikket/EventResult.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_ccdcd68e4d9a42a4_6_new,"snikket.EventEmitter","new",0xd8c00297,"snikket.EventEmitter.new","snikket/EventEmitter.hx",6,0x365dc5d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_ccdcd68e4d9a42a4_11_on,"snikket.EventEmitter","on",0x6f2da2c8,"snikket.EventEmitter.on","snikket/EventEmitter.hx",11,0x365dc5d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_ccdcd68e4d9a42a4_23_once,"snikket.EventEmitter","once",0xcff23b6a,"snikket.EventEmitter.once","snikket/EventEmitter.hx",23,0x365dc5d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_ccdcd68e4d9a42a4_26_trigger,"snikket.EventEmitter","trigger",0x58566eef,"snikket.EventEmitter.trigger","snikket/EventEmitter.hx",26,0x365dc5d8)
+namespace snikket{
+
+void EventEmitter_obj::__construct(){
+ HX_GC_STACKFRAME(&_hx_pos_ccdcd68e4d9a42a4_6_new)
+HXDLIN( 6) this->eventHandlers = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+ }
+
+Dynamic EventEmitter_obj::__CreateEmpty() { return new EventEmitter_obj; }
+
+void *EventEmitter_obj::_hx_vtable = 0;
+
+Dynamic EventEmitter_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< EventEmitter_obj > _hx_result = new EventEmitter_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool EventEmitter_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x6aca71d1;
+}
+
+ ::snikket::EventHandler EventEmitter_obj::on(::String eventName, ::Dynamic callback){
+ HX_GC_STACKFRAME(&_hx_pos_ccdcd68e4d9a42a4_11_on)
+HXLINE( 12) ::Array< ::Dynamic> handlers = ( (::Array< ::Dynamic>)(this->eventHandlers->get(eventName)) );
+HXLINE( 13) if (::hx::IsNull( handlers )) {
+HXLINE( 14) handlers = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 15) this->eventHandlers->set(eventName,handlers);
+ }
+HXLINE( 17) ::snikket::EventHandler newHandler = ::snikket::EventHandler_obj::__alloc( HX_CTX ,handlers,callback,null());
+HXLINE( 18) handlers->push(newHandler);
+HXLINE( 19) return newHandler;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(EventEmitter_obj,on,return )
+
+ ::snikket::EventHandler EventEmitter_obj::once(::String eventName, ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_ccdcd68e4d9a42a4_23_once)
+HXDLIN( 23) return this->on(eventName,callback)->once();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(EventEmitter_obj,once,return )
+
+ ::snikket::EventResult EventEmitter_obj::trigger(::String eventName, ::Dynamic eventData){
+ HX_STACKFRAME(&_hx_pos_ccdcd68e4d9a42a4_26_trigger)
+HXLINE( 27) ::Array< ::Dynamic> handlers = ( (::Array< ::Dynamic>)(this->eventHandlers->get(eventName)) );
+HXLINE( 28) bool _hx_tmp;
+HXDLIN( 28) if (::hx::IsNotNull( handlers )) {
+HXLINE( 28) _hx_tmp = (handlers->length == 0);
+ }
+ else {
+HXLINE( 28) _hx_tmp = true;
+ }
+HXDLIN( 28) if (_hx_tmp) {
+HXLINE( 29) ::haxe::Log_obj::trace((HX_("no event handlers for ",29,7b,a5,bb) + eventName),::hx::SourceInfo(HX_("snikket/EventEmitter.hx",d8,c5,5d,36),29,HX_("snikket.EventEmitter",25,6b,9f,50),HX_("trigger",38,55,df,25)));
+HXLINE( 30) return ::snikket::EventResult_obj::EventUnhandled_dyn();
+ }
+HXLINE( 32) ::haxe::Log_obj::trace((HX_("firing event: ",93,3a,85,fb) + eventName),::hx::SourceInfo(HX_("snikket/EventEmitter.hx",d8,c5,5d,36),32,HX_("snikket.EventEmitter",25,6b,9f,50),HX_("trigger",38,55,df,25)));
+HXLINE( 33) bool handled = false;
+HXLINE( 34) {
+HXLINE( 34) int _g = 0;
+HXDLIN( 34) while((_g < handlers->length)){
+HXLINE( 34) ::snikket::EventHandler handler = handlers->__get(_g).StaticCast< ::snikket::EventHandler >();
+HXDLIN( 34) _g = (_g + 1);
+HXLINE( 35) ::snikket::EventResult ret = handler->call(eventData);
+HXLINE( 36) switch((int)(ret->_hx_getIndex())){
+ case (int)0: {
+HXLINE( 37) handled = true;
+ }
+ break;
+ case (int)1: {
+HXLINE( 38) continue;
+ }
+ break;
+ case (int)2: {
+HXLINE( 39) return ret;
+ }
+ break;
+ case (int)3: {
+HXLINE( 39) ::Dynamic _g1 = ret->_hx_getObject(0);
+HXDLIN( 39) return ret;
+ }
+ break;
+ }
+ }
+ }
+HXLINE( 42) if (handled) {
+HXLINE( 42) return ::snikket::EventResult_obj::EventHandled_dyn();
+ }
+ else {
+HXLINE( 42) return ::snikket::EventResult_obj::EventUnhandled_dyn();
+ }
+HXDLIN( 42) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(EventEmitter_obj,trigger,return )
+
+
+::hx::ObjectPtr< EventEmitter_obj > EventEmitter_obj::__new() {
+ ::hx::ObjectPtr< EventEmitter_obj > __this = new EventEmitter_obj();
+ __this->__construct();
+ return __this;
+}
+
+::hx::ObjectPtr< EventEmitter_obj > EventEmitter_obj::__alloc(::hx::Ctx *_hx_ctx) {
+ EventEmitter_obj *__this = (EventEmitter_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(EventEmitter_obj), true, "snikket.EventEmitter"));
+ *(void **)__this = EventEmitter_obj::_hx_vtable;
+ __this->__construct();
+ return __this;
+}
+
+EventEmitter_obj::EventEmitter_obj()
+{
+}
+
+void EventEmitter_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(EventEmitter);
+ HX_MARK_MEMBER_NAME(eventHandlers,"eventHandlers");
+ HX_MARK_END_CLASS();
+}
+
+void EventEmitter_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(eventHandlers,"eventHandlers");
+}
+
+::hx::Val EventEmitter_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 2:
+ if (HX_FIELD_EQ(inName,"on") ) { return ::hx::Val( on_dyn() ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"once") ) { return ::hx::Val( once_dyn() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"trigger") ) { return ::hx::Val( trigger_dyn() ); }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"eventHandlers") ) { return ::hx::Val( eventHandlers ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val EventEmitter_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 13:
+ if (HX_FIELD_EQ(inName,"eventHandlers") ) { eventHandlers=inValue.Cast< ::haxe::ds::StringMap >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void EventEmitter_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("eventHandlers",a3,4f,27,8f));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo EventEmitter_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::haxe::ds::StringMap */ ,(int)offsetof(EventEmitter_obj,eventHandlers),HX_("eventHandlers",a3,4f,27,8f)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *EventEmitter_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String EventEmitter_obj_sMemberFields[] = {
+ HX_("eventHandlers",a3,4f,27,8f),
+ HX_("on",1f,61,00,00),
+ HX_("once",81,7d,b2,49),
+ HX_("trigger",38,55,df,25),
+ ::String(null()) };
+
+::hx::Class EventEmitter_obj::__mClass;
+
+void EventEmitter_obj::__register()
+{
+ EventEmitter_obj _hx_dummy;
+ EventEmitter_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.EventEmitter",25,6b,9f,50);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(EventEmitter_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< EventEmitter_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = EventEmitter_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = EventEmitter_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/EventHandler.cpp b/Sources/c_snikket/src/snikket/EventHandler.cpp
new file mode 100644
index 0000000..509e24e
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/EventHandler.cpp
@@ -0,0 +1,186 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_EventHandler
+#include <snikket/EventHandler.h>
+#endif
+#ifndef INCLUDED_snikket_EventResult
+#include <snikket/EventResult.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_2843da3dd1b24550_12_new,"snikket.EventHandler","new",0x96c1daf3,"snikket.EventHandler.new","snikket/EventHandler.hx",12,0xe5b62cfc)
+HX_LOCAL_STACK_FRAME(_hx_pos_2843da3dd1b24550_25_call,"snikket.EventHandler","call",0x4b954eab,"snikket.EventHandler.call","snikket/EventHandler.hx",25,0xe5b62cfc)
+HX_LOCAL_STACK_FRAME(_hx_pos_2843da3dd1b24550_32_once,"snikket.EventHandler","once",0x538db38e,"snikket.EventHandler.once","snikket/EventHandler.hx",32,0xe5b62cfc)
+HX_LOCAL_STACK_FRAME(_hx_pos_2843da3dd1b24550_38_unsubscribe,"snikket.EventHandler","unsubscribe",0xe1e5e764,"snikket.EventHandler.unsubscribe","snikket/EventHandler.hx",38,0xe5b62cfc)
+namespace snikket{
+
+void EventHandler_obj::__construct(::Array< ::Dynamic> handlers, ::Dynamic callback, ::Dynamic onlyOnce){
+ HX_STACKFRAME(&_hx_pos_2843da3dd1b24550_12_new)
+HXLINE( 15) this->onlyOnce = false;
+HXLINE( 14) this->callback = null();
+HXLINE( 13) this->handlers = null();
+HXLINE( 18) this->handlers = handlers;
+HXLINE( 19) this->callback = callback;
+HXLINE( 20) if (::hx::IsNotNull( onlyOnce )) {
+HXLINE( 21) this->onlyOnce = ( (bool)(onlyOnce) );
+ }
+ }
+
+Dynamic EventHandler_obj::__CreateEmpty() { return new EventHandler_obj; }
+
+void *EventHandler_obj::_hx_vtable = 0;
+
+Dynamic EventHandler_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< EventHandler_obj > _hx_result = new EventHandler_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2]);
+ return _hx_result;
+}
+
+bool EventHandler_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x39717849;
+}
+
+ ::snikket::EventResult EventHandler_obj::call( ::Dynamic data){
+ HX_STACKFRAME(&_hx_pos_2843da3dd1b24550_25_call)
+HXLINE( 26) if (this->onlyOnce) {
+HXLINE( 27) this->unsubscribe();
+ }
+HXLINE( 29) return this->callback(data);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(EventHandler_obj,call,return )
+
+ ::snikket::EventHandler EventHandler_obj::once(){
+ HX_STACKFRAME(&_hx_pos_2843da3dd1b24550_32_once)
+HXLINE( 33) this->onlyOnce = true;
+HXLINE( 34) return ::hx::ObjectPtr<OBJ_>(this);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(EventHandler_obj,once,return )
+
+void EventHandler_obj::unsubscribe(){
+ HX_STACKFRAME(&_hx_pos_2843da3dd1b24550_38_unsubscribe)
+HXDLIN( 38) this->handlers->remove(::hx::ObjectPtr<OBJ_>(this));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(EventHandler_obj,unsubscribe,(void))
+
+
+::hx::ObjectPtr< EventHandler_obj > EventHandler_obj::__new(::Array< ::Dynamic> handlers, ::Dynamic callback, ::Dynamic onlyOnce) {
+ ::hx::ObjectPtr< EventHandler_obj > __this = new EventHandler_obj();
+ __this->__construct(handlers,callback,onlyOnce);
+ return __this;
+}
+
+::hx::ObjectPtr< EventHandler_obj > EventHandler_obj::__alloc(::hx::Ctx *_hx_ctx,::Array< ::Dynamic> handlers, ::Dynamic callback, ::Dynamic onlyOnce) {
+ EventHandler_obj *__this = (EventHandler_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(EventHandler_obj), true, "snikket.EventHandler"));
+ *(void **)__this = EventHandler_obj::_hx_vtable;
+ __this->__construct(handlers,callback,onlyOnce);
+ return __this;
+}
+
+EventHandler_obj::EventHandler_obj()
+{
+}
+
+void EventHandler_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(EventHandler);
+ HX_MARK_MEMBER_NAME(handlers,"handlers");
+ HX_MARK_MEMBER_NAME(callback,"callback");
+ HX_MARK_MEMBER_NAME(onlyOnce,"onlyOnce");
+ HX_MARK_END_CLASS();
+}
+
+void EventHandler_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(handlers,"handlers");
+ HX_VISIT_MEMBER_NAME(callback,"callback");
+ HX_VISIT_MEMBER_NAME(onlyOnce,"onlyOnce");
+}
+
+::hx::Val EventHandler_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"call") ) { return ::hx::Val( call_dyn() ); }
+ if (HX_FIELD_EQ(inName,"once") ) { return ::hx::Val( once_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"handlers") ) { return ::hx::Val( handlers ); }
+ if (HX_FIELD_EQ(inName,"callback") ) { return ::hx::Val( callback ); }
+ if (HX_FIELD_EQ(inName,"onlyOnce") ) { return ::hx::Val( onlyOnce ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"unsubscribe") ) { return ::hx::Val( unsubscribe_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val EventHandler_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 8:
+ if (HX_FIELD_EQ(inName,"handlers") ) { handlers=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"callback") ) { callback=inValue.Cast< ::Dynamic >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"onlyOnce") ) { onlyOnce=inValue.Cast< bool >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void EventHandler_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("handlers",69,21,24,d5));
+ outFields->push(HX_("onlyOnce",0d,55,ab,b9));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo EventHandler_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(EventHandler_obj,handlers),HX_("handlers",69,21,24,d5)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(EventHandler_obj,callback),HX_("callback",c5,99,06,7f)},
+ {::hx::fsBool,(int)offsetof(EventHandler_obj,onlyOnce),HX_("onlyOnce",0d,55,ab,b9)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *EventHandler_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String EventHandler_obj_sMemberFields[] = {
+ HX_("handlers",69,21,24,d5),
+ HX_("callback",c5,99,06,7f),
+ HX_("onlyOnce",0d,55,ab,b9),
+ HX_("call",9e,18,ba,41),
+ HX_("once",81,7d,b2,49),
+ HX_("unsubscribe",d1,91,be,9e),
+ ::String(null()) };
+
+::hx::Class EventHandler_obj::__mClass;
+
+void EventHandler_obj::__register()
+{
+ EventHandler_obj _hx_dummy;
+ EventHandler_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.EventHandler",81,e5,7e,d7);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(EventHandler_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< EventHandler_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = EventHandler_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = EventHandler_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/EventResult.cpp b/Sources/c_snikket/src/snikket/EventResult.cpp
new file mode 100644
index 0000000..a9aaeac
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/EventResult.cpp
@@ -0,0 +1,96 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_EventResult
+#include <snikket/EventResult.h>
+#endif
+namespace snikket{
+
+::snikket::EventResult EventResult_obj::EventHandled;
+
+::snikket::EventResult EventResult_obj::EventStop;
+
+::snikket::EventResult EventResult_obj::EventUnhandled;
+
+::snikket::EventResult EventResult_obj::EventValue( ::Dynamic result)
+{
+ return ::hx::CreateEnum< EventResult_obj >(HX_("EventValue",17,8d,c4,a4),3,1)->_hx_init(0,result);
+}
+
+bool EventResult_obj::__GetStatic(const ::String &inName, ::Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ if (inName==HX_("EventHandled",e2,f2,3c,9e)) { outValue = EventResult_obj::EventHandled; return true; }
+ if (inName==HX_("EventStop",1c,d9,3b,9d)) { outValue = EventResult_obj::EventStop; return true; }
+ if (inName==HX_("EventUnhandled",29,8f,f2,f4)) { outValue = EventResult_obj::EventUnhandled; return true; }
+ if (inName==HX_("EventValue",17,8d,c4,a4)) { outValue = EventResult_obj::EventValue_dyn(); return true; }
+ return super::__GetStatic(inName, outValue, inCallProp);
+}
+
+HX_DEFINE_CREATE_ENUM(EventResult_obj)
+
+int EventResult_obj::__FindIndex(::String inName)
+{
+ if (inName==HX_("EventHandled",e2,f2,3c,9e)) return 0;
+ if (inName==HX_("EventStop",1c,d9,3b,9d)) return 2;
+ if (inName==HX_("EventUnhandled",29,8f,f2,f4)) return 1;
+ if (inName==HX_("EventValue",17,8d,c4,a4)) return 3;
+ return super::__FindIndex(inName);
+}
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(EventResult_obj,EventValue,return)
+
+int EventResult_obj::__FindArgCount(::String inName)
+{
+ if (inName==HX_("EventHandled",e2,f2,3c,9e)) return 0;
+ if (inName==HX_("EventStop",1c,d9,3b,9d)) return 0;
+ if (inName==HX_("EventUnhandled",29,8f,f2,f4)) return 0;
+ if (inName==HX_("EventValue",17,8d,c4,a4)) return 1;
+ return super::__FindArgCount(inName);
+}
+
+::hx::Val EventResult_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ if (inName==HX_("EventHandled",e2,f2,3c,9e)) return EventHandled;
+ if (inName==HX_("EventStop",1c,d9,3b,9d)) return EventStop;
+ if (inName==HX_("EventUnhandled",29,8f,f2,f4)) return EventUnhandled;
+ if (inName==HX_("EventValue",17,8d,c4,a4)) return EventValue_dyn();
+ return super::__Field(inName,inCallProp);
+}
+
+static ::String EventResult_obj_sStaticFields[] = {
+ HX_("EventHandled",e2,f2,3c,9e),
+ HX_("EventUnhandled",29,8f,f2,f4),
+ HX_("EventStop",1c,d9,3b,9d),
+ HX_("EventValue",17,8d,c4,a4),
+ ::String(null())
+};
+
+::hx::Class EventResult_obj::__mClass;
+
+Dynamic __Create_EventResult_obj() { return new EventResult_obj; }
+
+void EventResult_obj::__register()
+{
+
+::hx::Static(__mClass) = ::hx::_hx_RegisterClass(HX_("snikket.EventResult",06,97,23,e2), ::hx::TCanCast< EventResult_obj >,EventResult_obj_sStaticFields,0,
+ &__Create_EventResult_obj, &__Create,
+ &super::__SGetClass(), &CreateEventResult_obj, 0
+#ifdef HXCPP_VISIT_ALLOCS
+ , 0
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ , 0
+#endif
+);
+ __mClass->mGetStaticField = &EventResult_obj::__GetStatic;
+}
+
+void EventResult_obj::__boot()
+{
+EventHandled = ::hx::CreateConstEnum< EventResult_obj >(HX_("EventHandled",e2,f2,3c,9e),0);
+EventStop = ::hx::CreateConstEnum< EventResult_obj >(HX_("EventStop",1c,d9,3b,9d),2);
+EventUnhandled = ::hx::CreateConstEnum< EventResult_obj >(HX_("EventUnhandled",29,8f,f2,f4),1);
+}
+
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/GenericStream.cpp b/Sources/c_snikket/src/snikket/GenericStream.cpp
new file mode 100644
index 0000000..b6caf66
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/GenericStream.cpp
@@ -0,0 +1,237 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_haxe_Log
+#include <haxe/Log.h>
+#endif
+#ifndef INCLUDED_snikket_EventEmitter
+#include <snikket/EventEmitter.h>
+#endif
+#ifndef INCLUDED_snikket_EventHandler
+#include <snikket/EventHandler.h>
+#endif
+#ifndef INCLUDED_snikket_EventResult
+#include <snikket/EventResult.h>
+#endif
+#ifndef INCLUDED_snikket_GenericStream
+#include <snikket/GenericStream.h>
+#endif
+#ifndef INCLUDED_snikket_IqRequestType
+#include <snikket/IqRequestType.h>
+#endif
+#ifndef INCLUDED_snikket_IqResult
+#include <snikket/IqResult.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_db1e0e19c8d3bf67_13_new,"snikket.GenericStream","new",0x018d6e18,"snikket.GenericStream.new","snikket/GenericStream.hx",13,0x6e4bae59)
+HX_LOCAL_STACK_FRAME(_hx_pos_db1e0e19c8d3bf67_32_sendIq,"snikket.GenericStream","sendIq",0x740a7498,"snikket.GenericStream.sendIq","snikket/GenericStream.hx",32,0x6e4bae59)
+HX_LOCAL_STACK_FRAME(_hx_pos_db1e0e19c8d3bf67_29_sendIq,"snikket.GenericStream","sendIq",0x740a7498,"snikket.GenericStream.sendIq","snikket/GenericStream.hx",29,0x6e4bae59)
+HX_LOCAL_STACK_FRAME(_hx_pos_db1e0e19c8d3bf67_39_onStanza,"snikket.GenericStream","onStanza",0x6f1bfbbc,"snikket.GenericStream.onStanza","snikket/GenericStream.hx",39,0x6e4bae59)
+namespace snikket{
+
+void GenericStream_obj::__construct(){
+ HX_STACKFRAME(&_hx_pos_db1e0e19c8d3bf67_13_new)
+HXLINE( 15) this->csi = false;
+HXLINE( 14) this->clientId = null();
+HXLINE( 18) super::__construct();
+ }
+
+bool GenericStream_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x6aca71d1) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x6aca71d1;
+ } else {
+ return inClassId==(int)0x785c9e5e;
+ }
+}
+
+HX_DEFINE_DYNAMIC_FUNC2(GenericStream_obj,connect,(void))
+
+HX_DEFINE_DYNAMIC_FUNC0(GenericStream_obj,disconnect,(void))
+
+HX_DEFINE_DYNAMIC_FUNC1(GenericStream_obj,sendStanza,(void))
+
+HX_DEFINE_DYNAMIC_FUNC0(GenericStream_obj,newId,return )
+
+HX_DEFINE_DYNAMIC_FUNC4(GenericStream_obj,onIq,(void))
+
+void GenericStream_obj::sendIq( ::snikket::Stanza stanza, ::Dynamic callback){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::Dynamic,callback) HXARGC(1)
+ ::snikket::EventResult _hx_run( ::Dynamic event){
+ HX_STACKFRAME(&_hx_pos_db1e0e19c8d3bf67_32_sendIq)
+HXLINE( 33) callback( ::Dynamic(event->__Field(HX_("stanza",f5,5d,f7,05),::hx::paccDynamic)));
+HXLINE( 34) return ::snikket::EventResult_obj::EventHandled_dyn();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_db1e0e19c8d3bf67_29_sendIq)
+HXLINE( 30) ::String id = this->newId();
+HXLINE( 31) ::Reflect_obj::setField(stanza->attr,HX_("id",db,5b,00,00),id);
+HXLINE( 32) this->once((HX_("iq-response/",a9,62,d4,cf) + id), ::Dynamic(new _hx_Closure_0(callback)));
+HXLINE( 36) this->sendStanza(stanza);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(GenericStream_obj,sendIq,(void))
+
+void GenericStream_obj::onStanza( ::snikket::Stanza stanza){
+ HX_STACKFRAME(&_hx_pos_db1e0e19c8d3bf67_39_onStanza)
+HXLINE( 40) ::haxe::Log_obj::trace(HX_("stanza received!",f5,75,78,a6),::hx::SourceInfo(HX_("snikket/GenericStream.hx",59,ae,4b,6e),40,HX_("snikket.GenericStream",26,c2,0e,26),HX_("onStanza",74,54,a4,e5)));
+HXLINE( 41) ::String xmlns = ( (::String)(::Reflect_obj::field(stanza->attr,HX_("xmlns",dc,31,74,60))) );
+HXLINE( 42) if ((xmlns == HX_("jabber:client",21,64,c5,e4))) {
+HXLINE( 43) ::String name = stanza->name;
+HXLINE( 44) if ((name == HX_("iq",e8,5b,00,00))) {
+HXLINE( 45) ::String type = ( (::String)(::Reflect_obj::field(stanza->attr,HX_("type",ba,f2,08,4d))) );
+HXLINE( 46) ::haxe::Log_obj::trace((HX_("type: ",e0,c7,36,57) + type),::hx::SourceInfo(HX_("snikket/GenericStream.hx",59,ae,4b,6e),46,HX_("snikket.GenericStream",26,c2,0e,26),HX_("onStanza",74,54,a4,e5)));
+HXLINE( 47) bool _hx_tmp;
+HXDLIN( 47) if ((type != HX_("result",dd,68,84,08))) {
+HXLINE( 47) _hx_tmp = (type == HX_("error",c8,cb,29,73));
+ }
+ else {
+HXLINE( 47) _hx_tmp = true;
+ }
+HXDLIN( 47) if (_hx_tmp) {
+HXLINE( 48) ::String id = ( (::String)(::Reflect_obj::field(stanza->attr,HX_("id",db,5b,00,00))) );
+HXLINE( 49) this->trigger((HX_("iq-response/",a9,62,d4,cf) + id), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("stanza",f5,5d,f7,05),stanza)));
+ }
+ }
+ else {
+HXLINE( 53) bool _hx_tmp1;
+HXDLIN( 53) if ((name != HX_("message",c7,35,11,9a))) {
+HXLINE( 53) _hx_tmp1 = (name == HX_("presence",3b,52,d7,66));
+ }
+ else {
+HXLINE( 53) _hx_tmp1 = true;
+ }
+HXDLIN( 53) if (_hx_tmp1) {
+HXLINE( 54) this->trigger(name, ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("stanza",f5,5d,f7,05),stanza)));
+ }
+ }
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(GenericStream_obj,onStanza,(void))
+
+
+GenericStream_obj::GenericStream_obj()
+{
+}
+
+void GenericStream_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(GenericStream);
+ HX_MARK_MEMBER_NAME(clientId,"clientId");
+ HX_MARK_MEMBER_NAME(csi,"csi");
+ ::snikket::EventEmitter_obj::__Mark(HX_MARK_ARG);
+ HX_MARK_END_CLASS();
+}
+
+void GenericStream_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(clientId,"clientId");
+ HX_VISIT_MEMBER_NAME(csi,"csi");
+ ::snikket::EventEmitter_obj::__Visit(HX_VISIT_ARG);
+}
+
+::hx::Val GenericStream_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"csi") ) { return ::hx::Val( csi ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"onIq") ) { return ::hx::Val( onIq_dyn() ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"newId") ) { return ::hx::Val( newId_dyn() ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"sendIq") ) { return ::hx::Val( sendIq_dyn() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"connect") ) { return ::hx::Val( connect_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"clientId") ) { return ::hx::Val( clientId ); }
+ if (HX_FIELD_EQ(inName,"onStanza") ) { return ::hx::Val( onStanza_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"disconnect") ) { return ::hx::Val( disconnect_dyn() ); }
+ if (HX_FIELD_EQ(inName,"sendStanza") ) { return ::hx::Val( sendStanza_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val GenericStream_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"csi") ) { csi=inValue.Cast< bool >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"clientId") ) { clientId=inValue.Cast< ::String >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void GenericStream_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("clientId",06,73,8f,15));
+ outFields->push(HX_("csi",b9,83,4b,00));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo GenericStream_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(GenericStream_obj,clientId),HX_("clientId",06,73,8f,15)},
+ {::hx::fsBool,(int)offsetof(GenericStream_obj,csi),HX_("csi",b9,83,4b,00)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *GenericStream_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String GenericStream_obj_sMemberFields[] = {
+ HX_("clientId",06,73,8f,15),
+ HX_("csi",b9,83,4b,00),
+ HX_("connect",ea,3b,80,15),
+ HX_("disconnect",5c,64,44,69),
+ HX_("sendStanza",5d,85,4d,a7),
+ HX_("newId",5b,e8,30,99),
+ HX_("onIq",e7,66,b2,49),
+ HX_("sendIq",50,af,84,6b),
+ HX_("onStanza",74,54,a4,e5),
+ ::String(null()) };
+
+::hx::Class GenericStream_obj::__mClass;
+
+void GenericStream_obj::__register()
+{
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.GenericStream",26,c2,0e,26);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(GenericStream_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< GenericStream_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = GenericStream_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = GenericStream_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/Hash.cpp b/Sources/c_snikket/src/snikket/Hash.cpp
new file mode 100644
index 0000000..01f2696
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/Hash.cpp
@@ -0,0 +1,385 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_StringTools
+#include <StringTools.h>
+#endif
+#ifndef INCLUDED_haxe_crypto_Base64
+#include <haxe/crypto/Base64.h>
+#endif
+#ifndef INCLUDED_haxe_crypto_Sha1
+#include <haxe/crypto/Sha1.h>
+#endif
+#ifndef INCLUDED_haxe_crypto_Sha256
+#include <haxe/crypto/Sha256.h>
+#endif
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+#ifndef INCLUDED_snikket_Config
+#include <snikket/Config.h>
+#endif
+#ifndef INCLUDED_snikket_Hash
+#include <snikket/Hash.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_9ae683eb017e4032_28_new,"snikket.Hash","new",0xae73a1f1,"snikket.Hash.new","snikket/Hash.hx",28,0x711518be)
+HX_LOCAL_STACK_FRAME(_hx_pos_7ac9242dabfc377a_307_algorithm__fromC,"snikket.Hash","algorithm__fromC",0x170887b9,"snikket.Hash.algorithm__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_9ae683eb017e4032_68_toUri,"snikket.Hash","toUri",0x66fef482,"snikket.Hash.toUri","snikket/Hash.hx",68,0x711518be)
+HX_LOCAL_STACK_FRAME(_hx_pos_9ae683eb017e4032_77_bobUri,"snikket.Hash","bobUri",0x8e2c4b86,"snikket.Hash.bobUri","snikket/Hash.hx",77,0x711518be)
+HX_LOCAL_STACK_FRAME(_hx_pos_9ae683eb017e4032_82_serializeUri,"snikket.Hash","serializeUri",0x078265bb,"snikket.Hash.serializeUri","snikket/Hash.hx",82,0x711518be)
+HX_LOCAL_STACK_FRAME(_hx_pos_9ae683eb017e4032_86_toHex,"snikket.Hash","toHex",0x66f50bf1,"snikket.Hash.toHex","snikket/Hash.hx",86,0x711518be)
+HX_LOCAL_STACK_FRAME(_hx_pos_9ae683eb017e4032_90_toBase64,"snikket.Hash","toBase64",0xce108639,"snikket.Hash.toBase64","snikket/Hash.hx",90,0x711518be)
+HX_LOCAL_STACK_FRAME(_hx_pos_9ae683eb017e4032_94_toBase64Url,"snikket.Hash","toBase64Url",0x147546b6,"snikket.Hash.toBase64Url","snikket/Hash.hx",94,0x711518be)
+HX_LOCAL_STACK_FRAME(_hx_pos_9ae683eb017e4032_34_fromHex,"snikket.Hash","fromHex",0x3df081a2,"snikket.Hash.fromHex","snikket/Hash.hx",34,0x711518be)
+HX_LOCAL_STACK_FRAME(_hx_pos_9ae683eb017e4032_41_fromUri,"snikket.Hash","fromUri",0x3dfa6a33,"snikket.Hash.fromUri","snikket/Hash.hx",41,0x711518be)
+HX_LOCAL_STACK_FRAME(_hx_pos_9ae683eb017e4032_59_sha1,"snikket.Hash","sha1",0xfa0a55d4,"snikket.Hash.sha1","snikket/Hash.hx",59,0x711518be)
+HX_LOCAL_STACK_FRAME(_hx_pos_9ae683eb017e4032_64_sha256,"snikket.Hash","sha256",0x51ab6376,"snikket.Hash.sha256","snikket/Hash.hx",64,0x711518be)
+HX_LOCAL_STACK_FRAME(_hx_pos_9ae683eb017e4032_22_boot,"snikket.Hash","boot",0xeed31181,"snikket.Hash.boot","snikket/Hash.hx",22,0x711518be)
+namespace snikket{
+
+void Hash_obj::__construct(::String algorithm,::Array< unsigned char > hash){
+ HX_STACKFRAME(&_hx_pos_9ae683eb017e4032_28_new)
+HXLINE( 29) this->algorithm = algorithm;
+HXLINE( 30) this->hash = hash;
+ }
+
+Dynamic Hash_obj::__CreateEmpty() { return new Hash_obj; }
+
+void *Hash_obj::_hx_vtable = 0;
+
+Dynamic Hash_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Hash_obj > _hx_result = new Hash_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1]);
+ return _hx_result;
+}
+
+bool Hash_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x05b4502b;
+}
+
+::String Hash_obj::algorithm__fromC(){
+ HX_STACKFRAME(&_hx_pos_7ac9242dabfc377a_307_algorithm__fromC)
+HXDLIN( 307) return this->algorithm;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Hash_obj,algorithm__fromC,return )
+
+::String Hash_obj::toUri(){
+ HX_STACKFRAME(&_hx_pos_9ae683eb017e4032_68_toUri)
+HXDLIN( 68) if (::snikket::Config_obj::relativeHashUri) {
+HXLINE( 69) ::String _hx_tmp = ((HX_("/.well-known/ni/",e8,1b,93,12) + ::StringTools_obj::urlEncode(this->algorithm)) + HX_("/",2f,00,00,00));
+HXDLIN( 69) return (_hx_tmp + this->toBase64Url());
+ }
+ else {
+HXLINE( 71) return this->serializeUri();
+ }
+HXLINE( 68) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Hash_obj,toUri,return )
+
+::String Hash_obj::bobUri(){
+ HX_STACKFRAME(&_hx_pos_9ae683eb017e4032_77_bobUri)
+HXDLIN( 77) ::String _hx_tmp;
+HXDLIN( 77) if ((this->algorithm == HX_("sha-1",90,a8,1c,7c))) {
+HXDLIN( 77) _hx_tmp = HX_("sha1",85,c8,52,4c);
+ }
+ else {
+HXDLIN( 77) _hx_tmp = ::StringTools_obj::urlEncode(this->algorithm);
+ }
+HXDLIN( 77) return ((((HX_("cid:",7c,23,c0,41) + _hx_tmp) + HX_("+",2b,00,00,00)) + this->toHex()) + HX_("@bob.xmpp.org",04,79,99,e7));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Hash_obj,bobUri,return )
+
+::String Hash_obj::serializeUri(){
+ HX_STACKFRAME(&_hx_pos_9ae683eb017e4032_82_serializeUri)
+HXDLIN( 82) ::String _hx_tmp = ((HX_("ni:///",d0,cc,ce,96) + ::StringTools_obj::urlEncode(this->algorithm)) + HX_(";",3b,00,00,00));
+HXDLIN( 82) return (_hx_tmp + this->toBase64Url());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Hash_obj,serializeUri,return )
+
+::String Hash_obj::toHex(){
+ HX_STACKFRAME(&_hx_pos_9ae683eb017e4032_86_toHex)
+HXDLIN( 86) return ::haxe::io::Bytes_obj::ofData(this->hash)->toHex();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Hash_obj,toHex,return )
+
+::String Hash_obj::toBase64(){
+ HX_STACKFRAME(&_hx_pos_9ae683eb017e4032_90_toBase64)
+HXDLIN( 90) return ::haxe::crypto::Base64_obj::encode(::haxe::io::Bytes_obj::ofData(this->hash),true);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Hash_obj,toBase64,return )
+
+::String Hash_obj::toBase64Url(){
+ HX_STACKFRAME(&_hx_pos_9ae683eb017e4032_94_toBase64Url)
+HXDLIN( 94) return ::haxe::crypto::Base64_obj::urlEncode(::haxe::io::Bytes_obj::ofData(this->hash),null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Hash_obj,toBase64Url,return )
+
+ ::snikket::Hash Hash_obj::fromHex(::String algorithm,::String hash){
+ HX_GC_STACKFRAME(&_hx_pos_9ae683eb017e4032_34_fromHex)
+HXDLIN( 34) try {
+ HX_STACK_CATCHABLE( ::Dynamic, 0);
+HXLINE( 35) return ::snikket::Hash_obj::__alloc( HX_CTX ,algorithm,::haxe::io::Bytes_obj::ofHex(hash)->b);
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::Dynamic >() ){
+ HX_STACK_BEGIN_CATCH
+ ::Dynamic _g = _hx_e;
+HXLINE( 37) return null();
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+HXLINE( 34) return null();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Hash_obj,fromHex,return )
+
+ ::snikket::Hash Hash_obj::fromUri(::String uri){
+ HX_GC_STACKFRAME(&_hx_pos_9ae683eb017e4032_41_fromUri)
+HXLINE( 42) bool _hx_tmp;
+HXDLIN( 42) bool _hx_tmp1;
+HXDLIN( 42) if (::StringTools_obj::startsWith(uri,HX_("cid:",7c,23,c0,41))) {
+HXLINE( 42) _hx_tmp1 = ::StringTools_obj::endsWith(uri,HX_("@bob.xmpp.org",04,79,99,e7));
+ }
+ else {
+HXLINE( 42) _hx_tmp1 = false;
+ }
+HXDLIN( 42) if (_hx_tmp1) {
+HXLINE( 42) _hx_tmp = (uri.indexOf(HX_("+",2b,00,00,00),null()) != -1);
+ }
+ else {
+HXLINE( 42) _hx_tmp = false;
+ }
+HXDLIN( 42) if (_hx_tmp) {
+HXLINE( 43) ::Array< ::String > parts = uri.substr(4,null()).split(HX_("@",40,00,00,00))->__get(0).split(HX_("+",2b,00,00,00));
+HXLINE( 44) ::String algo;
+HXDLIN( 44) if ((parts->__get(0) == HX_("sha1",85,c8,52,4c))) {
+HXLINE( 44) algo = HX_("sha-1",90,a8,1c,7c);
+ }
+ else {
+HXLINE( 44) algo = parts->__get(0);
+ }
+HXLINE( 45) return ::snikket::Hash_obj::fromHex(algo,parts->__get(1));
+ }
+HXLINE( 46) bool _hx_tmp2;
+HXDLIN( 46) if (::StringTools_obj::startsWith(uri,HX_("ni:///",d0,cc,ce,96))) {
+HXLINE( 46) _hx_tmp2 = (uri.indexOf(HX_(";",3b,00,00,00),null()) != -1);
+ }
+ else {
+HXLINE( 46) _hx_tmp2 = false;
+ }
+HXDLIN( 46) if (_hx_tmp2) {
+HXLINE( 47) ::Array< ::String > parts1 = uri.substring(6,null()).split(HX_(";",3b,00,00,00));
+HXLINE( 48) ::String parts2 = parts1->__get(0);
+HXDLIN( 48) return ::snikket::Hash_obj::__alloc( HX_CTX ,parts2,::haxe::crypto::Base64_obj::urlDecode(parts1->__get(1),null())->b);
+ }
+ else {
+HXLINE( 49) if (::StringTools_obj::startsWith(uri,HX_("/.well-known/ni/",e8,1b,93,12))) {
+HXLINE( 50) ::Array< ::String > parts3 = uri.substring(16,null()).split(HX_("/",2f,00,00,00));
+HXLINE( 51) ::String parts4 = parts3->__get(0);
+HXDLIN( 51) return ::snikket::Hash_obj::__alloc( HX_CTX ,parts4,::haxe::crypto::Base64_obj::urlDecode(parts3->__get(1),null())->b);
+ }
+ }
+HXLINE( 54) return null();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Hash_obj,fromUri,return )
+
+ ::snikket::Hash Hash_obj::sha1( ::haxe::io::Bytes bytes){
+ HX_GC_STACKFRAME(&_hx_pos_9ae683eb017e4032_59_sha1)
+HXDLIN( 59) return ::snikket::Hash_obj::__alloc( HX_CTX ,HX_("sha-1",90,a8,1c,7c),::haxe::crypto::Sha1_obj::make(bytes)->b);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Hash_obj,sha1,return )
+
+ ::snikket::Hash Hash_obj::sha256( ::haxe::io::Bytes bytes){
+ HX_GC_STACKFRAME(&_hx_pos_9ae683eb017e4032_64_sha256)
+HXDLIN( 64) return ::snikket::Hash_obj::__alloc( HX_CTX ,HX_("sha-256",32,dd,04,3b),::haxe::crypto::Sha256_obj::make(bytes)->b);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Hash_obj,sha256,return )
+
+
+::hx::ObjectPtr< Hash_obj > Hash_obj::__new(::String algorithm,::Array< unsigned char > hash) {
+ ::hx::ObjectPtr< Hash_obj > __this = new Hash_obj();
+ __this->__construct(algorithm,hash);
+ return __this;
+}
+
+::hx::ObjectPtr< Hash_obj > Hash_obj::__alloc(::hx::Ctx *_hx_ctx,::String algorithm,::Array< unsigned char > hash) {
+ Hash_obj *__this = (Hash_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Hash_obj), true, "snikket.Hash"));
+ *(void **)__this = Hash_obj::_hx_vtable;
+ __this->__construct(algorithm,hash);
+ return __this;
+}
+
+Hash_obj::Hash_obj()
+{
+}
+
+void Hash_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(Hash);
+ HX_MARK_MEMBER_NAME(algorithm,"algorithm");
+ HX_MARK_MEMBER_NAME(hash,"hash");
+ HX_MARK_END_CLASS();
+}
+
+void Hash_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(algorithm,"algorithm");
+ HX_VISIT_MEMBER_NAME(hash,"hash");
+}
+
+::hx::Val Hash_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"hash") ) { return ::hx::Val( hash ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"toUri") ) { return ::hx::Val( toUri_dyn() ); }
+ if (HX_FIELD_EQ(inName,"toHex") ) { return ::hx::Val( toHex_dyn() ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"bobUri") ) { return ::hx::Val( bobUri_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"toBase64") ) { return ::hx::Val( toBase64_dyn() ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"algorithm") ) { return ::hx::Val( algorithm ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"toBase64Url") ) { return ::hx::Val( toBase64Url_dyn() ); }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"serializeUri") ) { return ::hx::Val( serializeUri_dyn() ); }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"algorithm__fromC") ) { return ::hx::Val( algorithm__fromC_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool Hash_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"sha1") ) { outValue = sha1_dyn(); return true; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"sha256") ) { outValue = sha256_dyn(); return true; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"fromHex") ) { outValue = fromHex_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"fromUri") ) { outValue = fromUri_dyn(); return true; }
+ }
+ return false;
+}
+
+::hx::Val Hash_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"hash") ) { hash=inValue.Cast< ::Array< unsigned char > >(); return inValue; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"algorithm") ) { algorithm=inValue.Cast< ::String >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void Hash_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("algorithm",6f,ac,ee,14));
+ outFields->push(HX_("hash",ce,2f,08,45));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Hash_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(Hash_obj,algorithm),HX_("algorithm",6f,ac,ee,14)},
+ {::hx::fsObject /* ::Array< unsigned char > */ ,(int)offsetof(Hash_obj,hash),HX_("hash",ce,2f,08,45)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *Hash_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Hash_obj_sMemberFields[] = {
+ HX_("algorithm",6f,ac,ee,14),
+ HX_("algorithm__fromC",ea,bf,4a,a7),
+ HX_("hash",ce,2f,08,45),
+ HX_("toUri",b1,dc,1a,14),
+ HX_("bobUri",77,8c,7b,59),
+ HX_("serializeUri",6c,71,76,3b),
+ HX_("toHex",20,f4,10,14),
+ HX_("toBase64",6a,a5,66,7c),
+ HX_("toBase64Url",25,fc,df,1d),
+ ::String(null()) };
+
+::hx::Class Hash_obj::__mClass;
+
+static ::String Hash_obj_sStaticFields[] = {
+ HX_("fromHex",91,13,fa,57),
+ HX_("fromUri",22,fc,03,58),
+ HX_("sha1",85,c8,52,4c),
+ HX_("sha256",67,a4,fa,1c),
+ ::String(null())
+};
+
+void Hash_obj::__register()
+{
+ Hash_obj _hx_dummy;
+ Hash_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.Hash",7f,d5,c5,4f);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Hash_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Hash_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Hash_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Hash_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Hash_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Hash_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void Hash_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_9ae683eb017e4032_22_boot)
+HXDLIN( 22) __mClass->__meta__ = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("fields",79,8e,8e,80), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("algorithm__fromC",ea,bf,4a,a7), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null()))))));
+ }
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/ID.cpp b/Sources/c_snikket/src/snikket/ID.cpp
new file mode 100644
index 0000000..2bcffb8
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/ID.cpp
@@ -0,0 +1,128 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_hx_strings_RandomStrings
+#include <hx/strings/RandomStrings.h>
+#endif
+#ifndef INCLUDED_hx_strings_internal__Either2__Either2
+#include <hx/strings/internal/_Either2/_Either2.h>
+#endif
+#ifndef INCLUDED_snikket_ID
+#include <snikket/ID.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_21b2f1b736a5ee9f_7_tiny,"snikket.ID","tiny",0x1693f982,"snikket.ID.tiny","snikket/ID.hx",7,0x63b75f71)
+HX_LOCAL_STACK_FRAME(_hx_pos_21b2f1b736a5ee9f_11_short,"snikket.ID","short",0x16d749ba,"snikket.ID.short","snikket/ID.hx",11,0x63b75f71)
+HX_LOCAL_STACK_FRAME(_hx_pos_21b2f1b736a5ee9f_15_medium,"snikket.ID","medium",0xbde52577,"snikket.ID.medium","snikket/ID.hx",15,0x63b75f71)
+HX_LOCAL_STACK_FRAME(_hx_pos_21b2f1b736a5ee9f_19_long,"snikket.ID","long",0x114ed1fe,"snikket.ID.long","snikket/ID.hx",19,0x63b75f71)
+namespace snikket{
+
+void ID_obj::__construct() { }
+
+Dynamic ID_obj::__CreateEmpty() { return new ID_obj; }
+
+void *ID_obj::_hx_vtable = 0;
+
+Dynamic ID_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< ID_obj > _hx_result = new ID_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool ID_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x5880bad8;
+}
+
+::String ID_obj::tiny(){
+ HX_STACKFRAME(&_hx_pos_21b2f1b736a5ee9f_7_tiny)
+HXDLIN( 7) return ::hx::strings::RandomStrings_obj::random(6,::hx::strings::internal::_Either2::_Either2_obj::b(::hx::strings::RandomStrings_obj::ASCII_ALPHA_NUMERIC));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC0(ID_obj,tiny,return )
+
+::String ID_obj::_hx_short(){
+ HX_STACKFRAME(&_hx_pos_21b2f1b736a5ee9f_11_short)
+HXDLIN( 11) return ::hx::strings::RandomStrings_obj::random(18,::hx::strings::internal::_Either2::_Either2_obj::b(::hx::strings::RandomStrings_obj::ASCII_ALPHA_NUMERIC));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC0(ID_obj,_hx_short,return )
+
+::String ID_obj::medium(){
+ HX_STACKFRAME(&_hx_pos_21b2f1b736a5ee9f_15_medium)
+HXDLIN( 15) return ::hx::strings::RandomStrings_obj::random(32,::hx::strings::internal::_Either2::_Either2_obj::b(::hx::strings::RandomStrings_obj::ASCII_ALPHA_NUMERIC));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC0(ID_obj,medium,return )
+
+::String ID_obj::_hx_long(){
+ HX_STACKFRAME(&_hx_pos_21b2f1b736a5ee9f_19_long)
+HXDLIN( 19) return ::hx::strings::RandomStrings_obj::randomUUIDv4(null());
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC0(ID_obj,_hx_long,return )
+
+
+ID_obj::ID_obj()
+{
+}
+
+bool ID_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"tiny") ) { outValue = tiny_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"long") ) { outValue = _hx_long_dyn(); return true; }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"short") ) { outValue = _hx_short_dyn(); return true; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"medium") ) { outValue = medium_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *ID_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *ID_obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class ID_obj::__mClass;
+
+static ::String ID_obj_sStaticFields[] = {
+ HX_("tiny",00,cd,fc,4c),
+ HX_("short",7c,84,27,7c),
+ HX_("medium",75,54,c8,fe),
+ HX_("long",7c,a5,b7,47),
+ ::String(null())
+};
+
+void ID_obj::__register()
+{
+ ID_obj _hx_dummy;
+ ID_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.ID",2c,83,d0,18);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &ID_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(ID_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< ID_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = ID_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = ID_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/Identicon.cpp b/Sources/c_snikket/src/snikket/Identicon.cpp
new file mode 100644
index 0000000..84d9672
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/Identicon.cpp
@@ -0,0 +1,233 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_crypto_Sha1
+#include <haxe/crypto/Sha1.h>
+#endif
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+#ifndef INCLUDED_haxe_io_BytesInput
+#include <haxe/io/BytesInput.h>
+#endif
+#ifndef INCLUDED_haxe_io_Encoding
+#include <haxe/io/Encoding.h>
+#endif
+#ifndef INCLUDED_haxe_io_Input
+#include <haxe/io/Input.h>
+#endif
+#ifndef INCLUDED_snikket_Color
+#include <snikket/Color.h>
+#endif
+#ifndef INCLUDED_snikket_Identicon
+#include <snikket/Identicon.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_ff119e3d91e7f580_10_svg,"snikket.Identicon","svg",0xe12e620e,"snikket.Identicon.svg","snikket/Identicon.hx",10,0xd7684427)
+namespace snikket{
+
+void Identicon_obj::__construct() { }
+
+Dynamic Identicon_obj::__CreateEmpty() { return new Identicon_obj; }
+
+void *Identicon_obj::_hx_vtable = 0;
+
+Dynamic Identicon_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Identicon_obj > _hx_result = new Identicon_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool Identicon_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x3ab0d0ec;
+}
+
+::String Identicon_obj::svg(::String source){
+ HX_GC_STACKFRAME(&_hx_pos_ff119e3d91e7f580_10_svg)
+HXLINE( 11) ::haxe::io::Bytes sha = ::haxe::crypto::Sha1_obj::make(::haxe::io::Bytes_obj::ofString(source,null()));
+HXLINE( 12) ::haxe::io::BytesInput input = ::haxe::io::BytesInput_obj::__alloc( HX_CTX ,sha,null(),null());
+HXLINE( 13) input->set_bigEndian(true);
+HXLINE( 14) int hash = input->readInt32();
+HXLINE( 15) ::String uri = HX_("data:image/svg+xml,<svg%20xmlns=\"http://www.w3.org/2000/svg\"%20version=\"1.1\"%20width=\"5\"%20height=\"5\"%20viewBox=\"0%200%205%205\">",ab,fb,bd,f4);
+HXLINE( 16) uri = (uri + ((HX_("<style>rect{fill:%23",3d,8c,37,23) + ::snikket::Color_obj::forString(source).substr(1,null())) + HX_(";}</style>",82,58,20,71)));
+HXLINE( 17) int i = 0;
+HXLINE( 18) {
+HXLINE( 19) {
+HXLINE( 19) {
+HXLINE( 20) i = (i + 1);
+HXDLIN( 20) int value = (hash >> (i - 1));
+HXLINE( 21) if ((::hx::Mod(value,2) == 0)) {
+HXLINE( 22) uri = (uri + ((((HX_("<rect%20width=\"1\"%20height=\"1\"%20x=\"",81,8b,c1,f0) + 0) + HX_("\"%20y=\"",5d,64,2d,3b)) + 0) + HX_("\"/>",d1,f5,19,00)));
+HXLINE( 24) uri = (uri + ((((HX_("<rect%20width=\"1\"%20height=\"1\"%20x=\"",81,8b,c1,f0) + 4) + HX_("\"%20y=\"",5d,64,2d,3b)) + 0) + HX_("\"/>",d1,f5,19,00)));
+ }
+ }
+HXLINE( 19) {
+HXLINE( 20) i = (i + 1);
+HXDLIN( 20) int value1 = (hash >> (i - 1));
+HXLINE( 21) if ((::hx::Mod(value1,2) == 0)) {
+HXLINE( 22) uri = (uri + ((((HX_("<rect%20width=\"1\"%20height=\"1\"%20x=\"",81,8b,c1,f0) + 0) + HX_("\"%20y=\"",5d,64,2d,3b)) + 1) + HX_("\"/>",d1,f5,19,00)));
+HXLINE( 24) uri = (uri + ((((HX_("<rect%20width=\"1\"%20height=\"1\"%20x=\"",81,8b,c1,f0) + 4) + HX_("\"%20y=\"",5d,64,2d,3b)) + 1) + HX_("\"/>",d1,f5,19,00)));
+ }
+ }
+HXLINE( 19) {
+HXLINE( 20) i = (i + 1);
+HXDLIN( 20) int value2 = (hash >> (i - 1));
+HXLINE( 21) if ((::hx::Mod(value2,2) == 0)) {
+HXLINE( 22) uri = (uri + ((((HX_("<rect%20width=\"1\"%20height=\"1\"%20x=\"",81,8b,c1,f0) + 0) + HX_("\"%20y=\"",5d,64,2d,3b)) + 2) + HX_("\"/>",d1,f5,19,00)));
+HXLINE( 24) uri = (uri + ((((HX_("<rect%20width=\"1\"%20height=\"1\"%20x=\"",81,8b,c1,f0) + 4) + HX_("\"%20y=\"",5d,64,2d,3b)) + 2) + HX_("\"/>",d1,f5,19,00)));
+ }
+ }
+HXLINE( 19) {
+HXLINE( 20) i = (i + 1);
+HXDLIN( 20) int value3 = (hash >> (i - 1));
+HXLINE( 21) if ((::hx::Mod(value3,2) == 0)) {
+HXLINE( 22) uri = (uri + ((((HX_("<rect%20width=\"1\"%20height=\"1\"%20x=\"",81,8b,c1,f0) + 0) + HX_("\"%20y=\"",5d,64,2d,3b)) + 3) + HX_("\"/>",d1,f5,19,00)));
+HXLINE( 24) uri = (uri + ((((HX_("<rect%20width=\"1\"%20height=\"1\"%20x=\"",81,8b,c1,f0) + 4) + HX_("\"%20y=\"",5d,64,2d,3b)) + 3) + HX_("\"/>",d1,f5,19,00)));
+ }
+ }
+HXLINE( 19) {
+HXLINE( 20) i = (i + 1);
+HXDLIN( 20) int value4 = (hash >> (i - 1));
+HXLINE( 21) if ((::hx::Mod(value4,2) == 0)) {
+HXLINE( 22) uri = (uri + ((((HX_("<rect%20width=\"1\"%20height=\"1\"%20x=\"",81,8b,c1,f0) + 0) + HX_("\"%20y=\"",5d,64,2d,3b)) + 4) + HX_("\"/>",d1,f5,19,00)));
+HXLINE( 24) uri = (uri + ((((HX_("<rect%20width=\"1\"%20height=\"1\"%20x=\"",81,8b,c1,f0) + 4) + HX_("\"%20y=\"",5d,64,2d,3b)) + 4) + HX_("\"/>",d1,f5,19,00)));
+ }
+ }
+ }
+HXLINE( 19) {
+HXLINE( 19) {
+HXLINE( 20) i = (i + 1);
+HXDLIN( 20) int value5 = (hash >> (i - 1));
+HXLINE( 21) if ((::hx::Mod(value5,2) == 0)) {
+HXLINE( 22) uri = (uri + ((((HX_("<rect%20width=\"1\"%20height=\"1\"%20x=\"",81,8b,c1,f0) + 1) + HX_("\"%20y=\"",5d,64,2d,3b)) + 0) + HX_("\"/>",d1,f5,19,00)));
+HXLINE( 24) uri = (uri + ((((HX_("<rect%20width=\"1\"%20height=\"1\"%20x=\"",81,8b,c1,f0) + 3) + HX_("\"%20y=\"",5d,64,2d,3b)) + 0) + HX_("\"/>",d1,f5,19,00)));
+ }
+ }
+HXLINE( 19) {
+HXLINE( 20) i = (i + 1);
+HXDLIN( 20) int value6 = (hash >> (i - 1));
+HXLINE( 21) if ((::hx::Mod(value6,2) == 0)) {
+HXLINE( 22) uri = (uri + ((((HX_("<rect%20width=\"1\"%20height=\"1\"%20x=\"",81,8b,c1,f0) + 1) + HX_("\"%20y=\"",5d,64,2d,3b)) + 1) + HX_("\"/>",d1,f5,19,00)));
+HXLINE( 24) uri = (uri + ((((HX_("<rect%20width=\"1\"%20height=\"1\"%20x=\"",81,8b,c1,f0) + 3) + HX_("\"%20y=\"",5d,64,2d,3b)) + 1) + HX_("\"/>",d1,f5,19,00)));
+ }
+ }
+HXLINE( 19) {
+HXLINE( 20) i = (i + 1);
+HXDLIN( 20) int value7 = (hash >> (i - 1));
+HXLINE( 21) if ((::hx::Mod(value7,2) == 0)) {
+HXLINE( 22) uri = (uri + ((((HX_("<rect%20width=\"1\"%20height=\"1\"%20x=\"",81,8b,c1,f0) + 1) + HX_("\"%20y=\"",5d,64,2d,3b)) + 2) + HX_("\"/>",d1,f5,19,00)));
+HXLINE( 24) uri = (uri + ((((HX_("<rect%20width=\"1\"%20height=\"1\"%20x=\"",81,8b,c1,f0) + 3) + HX_("\"%20y=\"",5d,64,2d,3b)) + 2) + HX_("\"/>",d1,f5,19,00)));
+ }
+ }
+HXLINE( 19) {
+HXLINE( 20) i = (i + 1);
+HXDLIN( 20) int value8 = (hash >> (i - 1));
+HXLINE( 21) if ((::hx::Mod(value8,2) == 0)) {
+HXLINE( 22) uri = (uri + ((((HX_("<rect%20width=\"1\"%20height=\"1\"%20x=\"",81,8b,c1,f0) + 1) + HX_("\"%20y=\"",5d,64,2d,3b)) + 3) + HX_("\"/>",d1,f5,19,00)));
+HXLINE( 24) uri = (uri + ((((HX_("<rect%20width=\"1\"%20height=\"1\"%20x=\"",81,8b,c1,f0) + 3) + HX_("\"%20y=\"",5d,64,2d,3b)) + 3) + HX_("\"/>",d1,f5,19,00)));
+ }
+ }
+HXLINE( 19) {
+HXLINE( 20) i = (i + 1);
+HXDLIN( 20) int value9 = (hash >> (i - 1));
+HXLINE( 21) if ((::hx::Mod(value9,2) == 0)) {
+HXLINE( 22) uri = (uri + ((((HX_("<rect%20width=\"1\"%20height=\"1\"%20x=\"",81,8b,c1,f0) + 1) + HX_("\"%20y=\"",5d,64,2d,3b)) + 4) + HX_("\"/>",d1,f5,19,00)));
+HXLINE( 24) uri = (uri + ((((HX_("<rect%20width=\"1\"%20height=\"1\"%20x=\"",81,8b,c1,f0) + 3) + HX_("\"%20y=\"",5d,64,2d,3b)) + 4) + HX_("\"/>",d1,f5,19,00)));
+ }
+ }
+ }
+HXLINE( 19) {
+HXLINE( 19) {
+HXLINE( 20) i = (i + 1);
+HXDLIN( 20) int value10 = (hash >> (i - 1));
+HXLINE( 21) if ((::hx::Mod(value10,2) == 0)) {
+HXLINE( 22) uri = (uri + ((((HX_("<rect%20width=\"1\"%20height=\"1\"%20x=\"",81,8b,c1,f0) + 2) + HX_("\"%20y=\"",5d,64,2d,3b)) + 0) + HX_("\"/>",d1,f5,19,00)));
+ }
+ }
+HXLINE( 19) {
+HXLINE( 20) i = (i + 1);
+HXDLIN( 20) int value11 = (hash >> (i - 1));
+HXLINE( 21) if ((::hx::Mod(value11,2) == 0)) {
+HXLINE( 22) uri = (uri + ((((HX_("<rect%20width=\"1\"%20height=\"1\"%20x=\"",81,8b,c1,f0) + 2) + HX_("\"%20y=\"",5d,64,2d,3b)) + 1) + HX_("\"/>",d1,f5,19,00)));
+ }
+ }
+HXLINE( 19) {
+HXLINE( 20) i = (i + 1);
+HXDLIN( 20) int value12 = (hash >> (i - 1));
+HXLINE( 21) if ((::hx::Mod(value12,2) == 0)) {
+HXLINE( 22) uri = (uri + ((((HX_("<rect%20width=\"1\"%20height=\"1\"%20x=\"",81,8b,c1,f0) + 2) + HX_("\"%20y=\"",5d,64,2d,3b)) + 2) + HX_("\"/>",d1,f5,19,00)));
+ }
+ }
+HXLINE( 19) {
+HXLINE( 20) i = (i + 1);
+HXDLIN( 20) int value13 = (hash >> (i - 1));
+HXLINE( 21) if ((::hx::Mod(value13,2) == 0)) {
+HXLINE( 22) uri = (uri + ((((HX_("<rect%20width=\"1\"%20height=\"1\"%20x=\"",81,8b,c1,f0) + 2) + HX_("\"%20y=\"",5d,64,2d,3b)) + 3) + HX_("\"/>",d1,f5,19,00)));
+ }
+ }
+HXLINE( 19) {
+HXLINE( 20) i = (i + 1);
+HXDLIN( 20) int value14 = (hash >> (i - 1));
+HXLINE( 21) if ((::hx::Mod(value14,2) == 0)) {
+HXLINE( 22) uri = (uri + ((((HX_("<rect%20width=\"1\"%20height=\"1\"%20x=\"",81,8b,c1,f0) + 2) + HX_("\"%20y=\"",5d,64,2d,3b)) + 4) + HX_("\"/>",d1,f5,19,00)));
+ }
+ }
+ }
+ }
+HXLINE( 29) return (uri + HX_("</svg>",4d,57,9c,59));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Identicon_obj,svg,return )
+
+
+Identicon_obj::Identicon_obj()
+{
+}
+
+bool Identicon_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"svg") ) { outValue = svg_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *Identicon_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *Identicon_obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class Identicon_obj::__mClass;
+
+static ::String Identicon_obj_sStaticFields[] = {
+ HX_("svg",64,aa,57,00),
+ ::String(null())
+};
+
+void Identicon_obj::__register()
+{
+ Identicon_obj _hx_dummy;
+ Identicon_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.Identicon",18,7b,f7,df);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Identicon_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Identicon_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< Identicon_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Identicon_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Identicon_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/Identity.cpp b/Sources/c_snikket/src/snikket/Identity.cpp
new file mode 100644
index 0000000..18f9133
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/Identity.cpp
@@ -0,0 +1,177 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_Identity
+#include <snikket/Identity.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_913c0fa79e603d10_108_new,"snikket.Identity","new",0xf59d9be1,"snikket.Identity.new","snikket/Caps.hx",108,0xee3b624b)
+HX_LOCAL_STACK_FRAME(_hx_pos_913c0fa79e603d10_115_addToDisco,"snikket.Identity","addToDisco",0x16a0927d,"snikket.Identity.addToDisco","snikket/Caps.hx",115,0xee3b624b)
+HX_LOCAL_STACK_FRAME(_hx_pos_913c0fa79e603d10_119_ver,"snikket.Identity","ver",0xf5a3ade4,"snikket.Identity.ver","snikket/Caps.hx",119,0xee3b624b)
+namespace snikket{
+
+void Identity_obj::__construct(::String category,::String type,::String name){
+ HX_STACKFRAME(&_hx_pos_913c0fa79e603d10_108_new)
+HXLINE( 109) this->category = category;
+HXLINE( 110) this->type = type;
+HXLINE( 111) this->name = name;
+ }
+
+Dynamic Identity_obj::__CreateEmpty() { return new Identity_obj; }
+
+void *Identity_obj::_hx_vtable = 0;
+
+Dynamic Identity_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Identity_obj > _hx_result = new Identity_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2]);
+ return _hx_result;
+}
+
+bool Identity_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x7fcd1307;
+}
+
+void Identity_obj::addToDisco( ::snikket::Stanza stanza){
+ HX_STACKFRAME(&_hx_pos_913c0fa79e603d10_115_addToDisco)
+HXDLIN( 115) stanza->tag(HX_("identity",3e,45,2f,b9), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("category",fe,2a,6c,ad),this->category)
+ ->setFixed(1,HX_("name",4b,72,ff,48),this->name)
+ ->setFixed(2,HX_("type",ba,f2,08,4d),this->type)))->up();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Identity_obj,addToDisco,(void))
+
+::String Identity_obj::ver(){
+ HX_STACKFRAME(&_hx_pos_913c0fa79e603d10_119_ver)
+HXDLIN( 119) return ((((this->category + HX_("/",2f,00,00,00)) + this->type) + HX_("//",20,29,00,00)) + this->name);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Identity_obj,ver,return )
+
+
+::hx::ObjectPtr< Identity_obj > Identity_obj::__new(::String category,::String type,::String name) {
+ ::hx::ObjectPtr< Identity_obj > __this = new Identity_obj();
+ __this->__construct(category,type,name);
+ return __this;
+}
+
+::hx::ObjectPtr< Identity_obj > Identity_obj::__alloc(::hx::Ctx *_hx_ctx,::String category,::String type,::String name) {
+ Identity_obj *__this = (Identity_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Identity_obj), true, "snikket.Identity"));
+ *(void **)__this = Identity_obj::_hx_vtable;
+ __this->__construct(category,type,name);
+ return __this;
+}
+
+Identity_obj::Identity_obj()
+{
+}
+
+void Identity_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(Identity);
+ HX_MARK_MEMBER_NAME(category,"category");
+ HX_MARK_MEMBER_NAME(type,"type");
+ HX_MARK_MEMBER_NAME(name,"name");
+ HX_MARK_END_CLASS();
+}
+
+void Identity_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(category,"category");
+ HX_VISIT_MEMBER_NAME(type,"type");
+ HX_VISIT_MEMBER_NAME(name,"name");
+}
+
+::hx::Val Identity_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"ver") ) { return ::hx::Val( ver_dyn() ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"type") ) { return ::hx::Val( type ); }
+ if (HX_FIELD_EQ(inName,"name") ) { return ::hx::Val( name ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"category") ) { return ::hx::Val( category ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"addToDisco") ) { return ::hx::Val( addToDisco_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val Identity_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"type") ) { type=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"name") ) { name=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"category") ) { category=inValue.Cast< ::String >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void Identity_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("category",fe,2a,6c,ad));
+ outFields->push(HX_("type",ba,f2,08,4d));
+ outFields->push(HX_("name",4b,72,ff,48));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Identity_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(Identity_obj,category),HX_("category",fe,2a,6c,ad)},
+ {::hx::fsString,(int)offsetof(Identity_obj,type),HX_("type",ba,f2,08,4d)},
+ {::hx::fsString,(int)offsetof(Identity_obj,name),HX_("name",4b,72,ff,48)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *Identity_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Identity_obj_sMemberFields[] = {
+ HX_("category",fe,2a,6c,ad),
+ HX_("type",ba,f2,08,4d),
+ HX_("name",4b,72,ff,48),
+ HX_("addToDisco",de,7b,df,0d),
+ HX_("ver",63,e2,59,00),
+ ::String(null()) };
+
+::hx::Class Identity_obj::__mClass;
+
+void Identity_obj::__register()
+{
+ Identity_obj _hx_dummy;
+ Identity_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.Identity",6f,17,10,6e);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Identity_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Identity_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Identity_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Identity_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/IqRequestType.cpp b/Sources/c_snikket/src/snikket/IqRequestType.cpp
new file mode 100644
index 0000000..f269382
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/IqRequestType.cpp
@@ -0,0 +1,76 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_IqRequestType
+#include <snikket/IqRequestType.h>
+#endif
+namespace snikket{
+
+::snikket::IqRequestType IqRequestType_obj::Get;
+
+::snikket::IqRequestType IqRequestType_obj::Set;
+
+bool IqRequestType_obj::__GetStatic(const ::String &inName, ::Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ if (inName==HX_("Get",76,38,36,00)) { outValue = IqRequestType_obj::Get; return true; }
+ if (inName==HX_("Set",82,53,3f,00)) { outValue = IqRequestType_obj::Set; return true; }
+ return super::__GetStatic(inName, outValue, inCallProp);
+}
+
+HX_DEFINE_CREATE_ENUM(IqRequestType_obj)
+
+int IqRequestType_obj::__FindIndex(::String inName)
+{
+ if (inName==HX_("Get",76,38,36,00)) return 0;
+ if (inName==HX_("Set",82,53,3f,00)) return 1;
+ return super::__FindIndex(inName);
+}
+
+int IqRequestType_obj::__FindArgCount(::String inName)
+{
+ if (inName==HX_("Get",76,38,36,00)) return 0;
+ if (inName==HX_("Set",82,53,3f,00)) return 0;
+ return super::__FindArgCount(inName);
+}
+
+::hx::Val IqRequestType_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ if (inName==HX_("Get",76,38,36,00)) return Get;
+ if (inName==HX_("Set",82,53,3f,00)) return Set;
+ return super::__Field(inName,inCallProp);
+}
+
+static ::String IqRequestType_obj_sStaticFields[] = {
+ HX_("Get",76,38,36,00),
+ HX_("Set",82,53,3f,00),
+ ::String(null())
+};
+
+::hx::Class IqRequestType_obj::__mClass;
+
+Dynamic __Create_IqRequestType_obj() { return new IqRequestType_obj; }
+
+void IqRequestType_obj::__register()
+{
+
+::hx::Static(__mClass) = ::hx::_hx_RegisterClass(HX_("snikket.IqRequestType",d0,62,72,94), ::hx::TCanCast< IqRequestType_obj >,IqRequestType_obj_sStaticFields,0,
+ &__Create_IqRequestType_obj, &__Create,
+ &super::__SGetClass(), &CreateIqRequestType_obj, 0
+#ifdef HXCPP_VISIT_ALLOCS
+ , 0
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ , 0
+#endif
+);
+ __mClass->mGetStaticField = &IqRequestType_obj::__GetStatic;
+}
+
+void IqRequestType_obj::__boot()
+{
+Get = ::hx::CreateConstEnum< IqRequestType_obj >(HX_("Get",76,38,36,00),0);
+Set = ::hx::CreateConstEnum< IqRequestType_obj >(HX_("Set",82,53,3f,00),1);
+}
+
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/IqResult.cpp b/Sources/c_snikket/src/snikket/IqResult.cpp
new file mode 100644
index 0000000..11df743
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/IqResult.cpp
@@ -0,0 +1,94 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_IqResult
+#include <snikket/IqResult.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+namespace snikket{
+
+::snikket::IqResult IqResult_obj::IqNoResult;
+
+::snikket::IqResult IqResult_obj::IqResult;
+
+::snikket::IqResult IqResult_obj::IqResultElement( ::snikket::Stanza element)
+{
+ return ::hx::CreateEnum< IqResult_obj >(HX_("IqResultElement",37,9e,bd,34),0,1)->_hx_init(0,element);
+}
+
+bool IqResult_obj::__GetStatic(const ::String &inName, ::Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ if (inName==HX_("IqNoResult",26,a8,11,a4)) { outValue = IqResult_obj::IqNoResult; return true; }
+ if (inName==HX_("IqResult",05,d3,74,e7)) { outValue = IqResult_obj::IqResult; return true; }
+ if (inName==HX_("IqResultElement",37,9e,bd,34)) { outValue = IqResult_obj::IqResultElement_dyn(); return true; }
+ return super::__GetStatic(inName, outValue, inCallProp);
+}
+
+HX_DEFINE_CREATE_ENUM(IqResult_obj)
+
+int IqResult_obj::__FindIndex(::String inName)
+{
+ if (inName==HX_("IqNoResult",26,a8,11,a4)) return 2;
+ if (inName==HX_("IqResult",05,d3,74,e7)) return 1;
+ if (inName==HX_("IqResultElement",37,9e,bd,34)) return 0;
+ return super::__FindIndex(inName);
+}
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(IqResult_obj,IqResultElement,return)
+
+int IqResult_obj::__FindArgCount(::String inName)
+{
+ if (inName==HX_("IqNoResult",26,a8,11,a4)) return 0;
+ if (inName==HX_("IqResult",05,d3,74,e7)) return 0;
+ if (inName==HX_("IqResultElement",37,9e,bd,34)) return 1;
+ return super::__FindArgCount(inName);
+}
+
+::hx::Val IqResult_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ if (inName==HX_("IqNoResult",26,a8,11,a4)) return IqNoResult;
+ if (inName==HX_("IqResult",05,d3,74,e7)) return IqResult;
+ if (inName==HX_("IqResultElement",37,9e,bd,34)) return IqResultElement_dyn();
+ return super::__Field(inName,inCallProp);
+}
+
+static ::String IqResult_obj_sStaticFields[] = {
+ HX_("IqResultElement",37,9e,bd,34),
+ HX_("IqResult",05,d3,74,e7),
+ HX_("IqNoResult",26,a8,11,a4),
+ ::String(null())
+};
+
+::hx::Class IqResult_obj::__mClass;
+
+Dynamic __Create_IqResult_obj() { return new IqResult_obj; }
+
+void IqResult_obj::__register()
+{
+
+::hx::Static(__mClass) = ::hx::_hx_RegisterClass(HX_("snikket.IqResult",16,e9,a3,c2), ::hx::TCanCast< IqResult_obj >,IqResult_obj_sStaticFields,0,
+ &__Create_IqResult_obj, &__Create,
+ &super::__SGetClass(), &CreateIqResult_obj, 0
+#ifdef HXCPP_VISIT_ALLOCS
+ , 0
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ , 0
+#endif
+);
+ __mClass->mGetStaticField = &IqResult_obj::__GetStatic;
+}
+
+void IqResult_obj::__boot()
+{
+IqNoResult = ::hx::CreateConstEnum< IqResult_obj >(HX_("IqNoResult",26,a8,11,a4),2);
+IqResult = ::hx::CreateConstEnum< IqResult_obj >(HX_("IqResult",05,d3,74,e7),1);
+}
+
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/JID.cpp b/Sources/c_snikket/src/snikket/JID.cpp
new file mode 100644
index 0000000..4264050
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/JID.cpp
@@ -0,0 +1,328 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_StringTools
+#include <StringTools.h>
+#endif
+#ifndef INCLUDED_snikket_JID
+#include <snikket/JID.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_72d6039c98e7ca24_9_new,"snikket.JID","new",0xbc81d526,"snikket.JID.new","snikket/JID.hx",9,0x327707cb)
+HX_LOCAL_STACK_FRAME(_hx_pos_72d6039c98e7ca24_55_asBare,"snikket.JID","asBare",0xe7e9843e,"snikket.JID.asBare","snikket/JID.hx",55,0x327707cb)
+HX_LOCAL_STACK_FRAME(_hx_pos_72d6039c98e7ca24_59_withResource,"snikket.JID","withResource",0x5ce3376e,"snikket.JID.withResource","snikket/JID.hx",59,0x327707cb)
+HX_LOCAL_STACK_FRAME(_hx_pos_72d6039c98e7ca24_63_isValid,"snikket.JID","isValid",0xd514f878,"snikket.JID.isValid","snikket/JID.hx",63,0x327707cb)
+HX_LOCAL_STACK_FRAME(_hx_pos_72d6039c98e7ca24_67_isDomain,"snikket.JID","isDomain",0x7b173a48,"snikket.JID.isDomain","snikket/JID.hx",67,0x327707cb)
+HX_LOCAL_STACK_FRAME(_hx_pos_72d6039c98e7ca24_71_isBare,"snikket.JID","isBare",0x1ac46736,"snikket.JID.isBare","snikket/JID.hx",71,0x327707cb)
+HX_LOCAL_STACK_FRAME(_hx_pos_72d6039c98e7ca24_75_equals,"snikket.JID","equals",0x7c3fa939,"snikket.JID.equals","snikket/JID.hx",75,0x327707cb)
+HX_LOCAL_STACK_FRAME(_hx_pos_72d6039c98e7ca24_83_asString,"snikket.JID","asString",0x953320dd,"snikket.JID.asString","snikket/JID.hx",83,0x327707cb)
+HX_LOCAL_STACK_FRAME(_hx_pos_72d6039c98e7ca24_41_parse,"snikket.JID","parse",0x64a2d279,"snikket.JID.parse","snikket/JID.hx",41,0x327707cb)
+namespace snikket{
+
+void JID_obj::__construct(::String node,::String domain,::String resource){
+ HX_STACKFRAME(&_hx_pos_72d6039c98e7ca24_9_new)
+HXLINE( 10) ::String _hx_tmp;
+HXDLIN( 10) if (::hx::IsNull( node )) {
+HXLINE( 10) _hx_tmp = null();
+ }
+ else {
+HXLINE( 10) _hx_tmp = ::StringTools_obj::replace(::StringTools_obj::replace(::StringTools_obj::replace(::StringTools_obj::replace(::StringTools_obj::replace(::StringTools_obj::replace(::StringTools_obj::replace(::StringTools_obj::replace(::StringTools_obj::replace(::StringTools_obj::replace(::StringTools_obj::replace(::StringTools_obj::replace(::StringTools_obj::replace(::StringTools_obj::replace(::StringTools_obj::replace(::StringTools_obj::replace(::StringTools_obj::replace(::StringTools_obj::replace(::StringTools_obj::replace(::StringTools_obj::trim(node),HX_("\\5c",ea,fd,45,00),HX_("\\5c5c",f8,fa,30,1c)),HX_("\\20",1a,fb,45,00),HX_("\\5c20",28,f8,30,1c)),HX_("\\22",1c,fb,45,00),HX_("\\5c22",2a,f8,30,1c)),HX_("\\26",20,fb,45,00),HX_("\\5c26",2e,f8,30,1c)),HX_("\\27",21,fb,45,00),HX_("\\5c27",2f,f8,30,1c)),HX_("\\2f",50,fb,45,00),HX_("\\5c2f",5e,f8,30,1c)),HX_("\\3a",2a,fc,45,00),HX_("\\5c3a",38,f9,30,1c)),HX_("\\3c",2c,fc,45,00),HX_("\\5c3c",3a,f9,30,1c)),HX_("\\3e",2e,fc,45,00),HX_("\\5c3e",3c,f9,30,1c)),HX_("\\40",d8,fc,45,00),HX_("\\5c40",e6,f9,30,1c)),HX_(" ",20,00,00,00),HX_("\\20",1a,fb,45,00)),HX_("\"",22,00,00,00),HX_("\\22",1c,fb,45,00)),HX_("&",26,00,00,00),HX_("\\26",20,fb,45,00)),HX_("'",27,00,00,00),HX_("\\27",21,fb,45,00)),HX_("/",2f,00,00,00),HX_("\\2f",50,fb,45,00)),HX_(":",3a,00,00,00),HX_("\\3a",2a,fc,45,00)),HX_("<",3c,00,00,00),HX_("\\3c",2c,fc,45,00)),HX_(">",3e,00,00,00),HX_("\\3e",2e,fc,45,00)),HX_("@",40,00,00,00),HX_("\\40",d8,fc,45,00));
+ }
+HXDLIN( 10) this->node = _hx_tmp;
+HXLINE( 37) this->domain = domain;
+HXLINE( 38) this->resource = resource;
+ }
+
+Dynamic JID_obj::__CreateEmpty() { return new JID_obj; }
+
+void *JID_obj::_hx_vtable = 0;
+
+Dynamic JID_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< JID_obj > _hx_result = new JID_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2]);
+ return _hx_result;
+}
+
+bool JID_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x18238908;
+}
+
+ ::snikket::JID JID_obj::asBare(){
+ HX_GC_STACKFRAME(&_hx_pos_72d6039c98e7ca24_55_asBare)
+HXDLIN( 55) return ::snikket::JID_obj::__alloc( HX_CTX ,this->node,this->domain,null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(JID_obj,asBare,return )
+
+ ::snikket::JID JID_obj::withResource(::String resource){
+ HX_GC_STACKFRAME(&_hx_pos_72d6039c98e7ca24_59_withResource)
+HXDLIN( 59) return ::snikket::JID_obj::__alloc( HX_CTX ,this->node,this->domain,resource);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(JID_obj,withResource,return )
+
+bool JID_obj::isValid(){
+ HX_STACKFRAME(&_hx_pos_72d6039c98e7ca24_63_isValid)
+HXDLIN( 63) return (this->domain.indexOf(HX_(".",2e,00,00,00),null()) >= 0);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(JID_obj,isValid,return )
+
+bool JID_obj::isDomain(){
+ HX_STACKFRAME(&_hx_pos_72d6039c98e7ca24_67_isDomain)
+HXDLIN( 67) return ::hx::IsNull( this->node );
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(JID_obj,isDomain,return )
+
+bool JID_obj::isBare(){
+ HX_STACKFRAME(&_hx_pos_72d6039c98e7ca24_71_isBare)
+HXDLIN( 71) return ::hx::IsNull( this->resource );
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(JID_obj,isBare,return )
+
+bool JID_obj::equals( ::snikket::JID rhs){
+ HX_STACKFRAME(&_hx_pos_72d6039c98e7ca24_75_equals)
+HXLINE( 76) bool _hx_tmp;
+HXDLIN( 76) if ((this->node == rhs->node)) {
+HXLINE( 76) _hx_tmp = (this->domain == rhs->domain);
+ }
+ else {
+HXLINE( 76) _hx_tmp = false;
+ }
+HXLINE( 75) if (_hx_tmp) {
+HXLINE( 78) return (this->resource == rhs->resource);
+ }
+ else {
+HXDLIN( 75) return false;
+ }
+HXDLIN( 75) return false;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(JID_obj,equals,return )
+
+::String JID_obj::asString(){
+ HX_STACKFRAME(&_hx_pos_72d6039c98e7ca24_83_asString)
+HXLINE( 84) ::String _hx_tmp;
+HXDLIN( 84) if (::hx::IsNotNull( this->node )) {
+HXLINE( 84) _hx_tmp = (this->node + HX_("@",40,00,00,00));
+ }
+ else {
+HXLINE( 84) _hx_tmp = HX_("",00,00,00,00);
+ }
+HXLINE( 86) ::String _hx_tmp1;
+HXDLIN( 86) if (::hx::IsNotNull( this->resource )) {
+HXLINE( 86) _hx_tmp1 = (HX_("/",2f,00,00,00) + this->resource);
+ }
+ else {
+HXLINE( 86) _hx_tmp1 = HX_("",00,00,00,00);
+ }
+HXLINE( 83) return ((_hx_tmp + this->domain) + _hx_tmp1);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(JID_obj,asString,return )
+
+ ::snikket::JID JID_obj::parse(::String jid){
+ HX_GC_STACKFRAME(&_hx_pos_72d6039c98e7ca24_41_parse)
+HXLINE( 42) int resourceDelimiter = jid.indexOf(HX_("/",2f,00,00,00),null());
+HXLINE( 43) int nodeDelimiter = jid.indexOf(HX_("@",40,00,00,00),null());
+HXLINE( 44) bool _hx_tmp;
+HXDLIN( 44) if ((resourceDelimiter > 0)) {
+HXLINE( 44) _hx_tmp = (nodeDelimiter >= resourceDelimiter);
+ }
+ else {
+HXLINE( 44) _hx_tmp = false;
+ }
+HXDLIN( 44) if (_hx_tmp) {
+HXLINE( 45) nodeDelimiter = -1;
+ }
+HXLINE( 48) ::String _hx_tmp1;
+HXDLIN( 48) if ((nodeDelimiter > 0)) {
+HXLINE( 48) _hx_tmp1 = jid.substr(0,nodeDelimiter);
+ }
+ else {
+HXLINE( 48) _hx_tmp1 = null();
+ }
+HXLINE( 49) int _hx_tmp2;
+HXDLIN( 49) if ((nodeDelimiter == -1)) {
+HXLINE( 49) _hx_tmp2 = 0;
+ }
+ else {
+HXLINE( 49) _hx_tmp2 = (nodeDelimiter + 1);
+ }
+HXDLIN( 49) ::Dynamic _hx_tmp3;
+HXDLIN( 49) if ((resourceDelimiter == -1)) {
+HXLINE( 49) _hx_tmp3 = (jid.length + 1);
+ }
+ else {
+HXLINE( 49) _hx_tmp3 = resourceDelimiter;
+ }
+HXDLIN( 49) ::String _hx_tmp4 = jid.substring(_hx_tmp2,_hx_tmp3);
+HXLINE( 50) ::String _hx_tmp5;
+HXDLIN( 50) if ((resourceDelimiter == -1)) {
+HXLINE( 50) _hx_tmp5 = null();
+ }
+ else {
+HXLINE( 50) _hx_tmp5 = jid.substring((resourceDelimiter + 1),null());
+ }
+HXLINE( 47) return ::snikket::JID_obj::__alloc( HX_CTX ,_hx_tmp1,_hx_tmp4,_hx_tmp5);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(JID_obj,parse,return )
+
+
+::hx::ObjectPtr< JID_obj > JID_obj::__new(::String node,::String domain,::String resource) {
+ ::hx::ObjectPtr< JID_obj > __this = new JID_obj();
+ __this->__construct(node,domain,resource);
+ return __this;
+}
+
+::hx::ObjectPtr< JID_obj > JID_obj::__alloc(::hx::Ctx *_hx_ctx,::String node,::String domain,::String resource) {
+ JID_obj *__this = (JID_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(JID_obj), true, "snikket.JID"));
+ *(void **)__this = JID_obj::_hx_vtable;
+ __this->__construct(node,domain,resource);
+ return __this;
+}
+
+JID_obj::JID_obj()
+{
+}
+
+void JID_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(JID);
+ HX_MARK_MEMBER_NAME(node,"node");
+ HX_MARK_MEMBER_NAME(domain,"domain");
+ HX_MARK_MEMBER_NAME(resource,"resource");
+ HX_MARK_END_CLASS();
+}
+
+void JID_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(node,"node");
+ HX_VISIT_MEMBER_NAME(domain,"domain");
+ HX_VISIT_MEMBER_NAME(resource,"resource");
+}
+
+::hx::Val JID_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"node") ) { return ::hx::Val( node ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"domain") ) { return ::hx::Val( domain ); }
+ if (HX_FIELD_EQ(inName,"asBare") ) { return ::hx::Val( asBare_dyn() ); }
+ if (HX_FIELD_EQ(inName,"isBare") ) { return ::hx::Val( isBare_dyn() ); }
+ if (HX_FIELD_EQ(inName,"equals") ) { return ::hx::Val( equals_dyn() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"isValid") ) { return ::hx::Val( isValid_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"resource") ) { return ::hx::Val( resource ); }
+ if (HX_FIELD_EQ(inName,"isDomain") ) { return ::hx::Val( isDomain_dyn() ); }
+ if (HX_FIELD_EQ(inName,"asString") ) { return ::hx::Val( asString_dyn() ); }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"withResource") ) { return ::hx::Val( withResource_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool JID_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"parse") ) { outValue = parse_dyn(); return true; }
+ }
+ return false;
+}
+
+::hx::Val JID_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"node") ) { node=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"domain") ) { domain=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"resource") ) { resource=inValue.Cast< ::String >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void JID_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("node",02,0a,0a,49));
+ outFields->push(HX_("domain",44,b1,80,2d));
+ outFields->push(HX_("resource",ce,5c,a0,12));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo JID_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(JID_obj,node),HX_("node",02,0a,0a,49)},
+ {::hx::fsString,(int)offsetof(JID_obj,domain),HX_("domain",44,b1,80,2d)},
+ {::hx::fsString,(int)offsetof(JID_obj,resource),HX_("resource",ce,5c,a0,12)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *JID_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String JID_obj_sMemberFields[] = {
+ HX_("node",02,0a,0a,49),
+ HX_("domain",44,b1,80,2d),
+ HX_("resource",ce,5c,a0,12),
+ HX_("asBare",44,c9,9c,2b),
+ HX_("withResource",f4,04,59,2b),
+ HX_("isValid",b2,18,3e,ce),
+ HX_("isDomain",ce,4c,ea,85),
+ HX_("isBare",3c,ac,77,5e),
+ HX_("equals",3f,ee,f2,bf),
+ HX_("asString",63,33,06,a0),
+ ::String(null()) };
+
+::hx::Class JID_obj::__mClass;
+
+static ::String JID_obj_sStaticFields[] = {
+ HX_("parse",33,90,55,bd),
+ ::String(null())
+};
+
+void JID_obj::__register()
+{
+ JID_obj _hx_dummy;
+ JID_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.JID",34,0a,a3,9d);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &JID_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(JID_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(JID_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< JID_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = JID_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = JID_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/Message.cpp b/Sources/c_snikket/src/snikket/Message.cpp
new file mode 100644
index 0000000..6097aac
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/Message.cpp
@@ -0,0 +1,1139 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Date
+#include <Date.h>
+#endif
+#ifndef INCLUDED_Lambda
+#include <Lambda.h>
+#endif
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_StringTools
+#include <StringTools.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_Log
+#include <haxe/Log.h>
+#endif
+#ifndef INCLUDED_haxe_ds_StringMap
+#include <haxe/ds/StringMap.h>
+#endif
+#ifndef INCLUDED_snikket_ChatAttachment
+#include <snikket/ChatAttachment.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessage
+#include <snikket/ChatMessage.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessageBuilder
+#include <snikket/ChatMessageBuilder.h>
+#endif
+#ifndef INCLUDED_snikket_CustomEmojiReaction
+#include <snikket/CustomEmojiReaction.h>
+#endif
+#ifndef INCLUDED_snikket_Date
+#include <snikket/Date.h>
+#endif
+#ifndef INCLUDED_snikket_EmojiUtil
+#include <snikket/EmojiUtil.h>
+#endif
+#ifndef INCLUDED_snikket_Hash
+#include <snikket/Hash.h>
+#endif
+#ifndef INCLUDED_snikket_ID
+#include <snikket/ID.h>
+#endif
+#ifndef INCLUDED_snikket_JID
+#include <snikket/JID.h>
+#endif
+#ifndef INCLUDED_snikket_Message
+#include <snikket/Message.h>
+#endif
+#ifndef INCLUDED_snikket_MessageStanza
+#include <snikket/MessageStanza.h>
+#endif
+#ifndef INCLUDED_snikket_ModerationAction
+#include <snikket/ModerationAction.h>
+#endif
+#ifndef INCLUDED_snikket_Reaction
+#include <snikket/Reaction.h>
+#endif
+#ifndef INCLUDED_snikket_ReactionUpdate
+#include <snikket/ReactionUpdate.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_a0bea8386b958531_41_new,"snikket.Message","new",0xed1aa8a8,"snikket.Message.new","snikket/Message.hx",41,0x9fc78f09)
+HX_LOCAL_STACK_FRAME(_hx_pos_a0bea8386b958531_151_fromStanza,"snikket.Message","fromStanza",0xc7afa3b7,"snikket.Message.fromStanza","snikket/Message.hx",151,0x9fc78f09)
+HX_LOCAL_STACK_FRAME(_hx_pos_a0bea8386b958531_152_fromStanza,"snikket.Message","fromStanza",0xc7afa3b7,"snikket.Message.fromStanza","snikket/Message.hx",152,0x9fc78f09)
+HX_LOCAL_STACK_FRAME(_hx_pos_a0bea8386b958531_153_fromStanza,"snikket.Message","fromStanza",0xc7afa3b7,"snikket.Message.fromStanza","snikket/Message.hx",153,0x9fc78f09)
+HX_LOCAL_STACK_FRAME(_hx_pos_a0bea8386b958531_154_fromStanza,"snikket.Message","fromStanza",0xc7afa3b7,"snikket.Message.fromStanza","snikket/Message.hx",154,0x9fc78f09)
+HX_LOCAL_STACK_FRAME(_hx_pos_a0bea8386b958531_48_fromStanza,"snikket.Message","fromStanza",0xc7afa3b7,"snikket.Message.fromStanza","snikket/Message.hx",48,0x9fc78f09)
+HX_LOCAL_STACK_FRAME(_hx_pos_a0bea8386b958531_157_fromStanza,"snikket.Message","fromStanza",0xc7afa3b7,"snikket.Message.fromStanza","snikket/Message.hx",157,0x9fc78f09)
+namespace snikket{
+
+void Message_obj::__construct(::String chatId,::String senderId,::String threadId, ::snikket::MessageStanza parsed){
+ HX_STACKFRAME(&_hx_pos_a0bea8386b958531_41_new)
+HXLINE( 42) this->chatId = chatId;
+HXLINE( 43) this->senderId = senderId;
+HXLINE( 44) this->threadId = threadId;
+HXLINE( 45) this->parsed = parsed;
+ }
+
+Dynamic Message_obj::__CreateEmpty() { return new Message_obj; }
+
+void *Message_obj::_hx_vtable = 0;
+
+Dynamic Message_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Message_obj > _hx_result = new Message_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2],inArgs[3]);
+ return _hx_result;
+}
+
+bool Message_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x7c0c6d2e;
+}
+
+ ::snikket::Message Message_obj::fromStanza( ::snikket::Stanza stanza, ::snikket::JID localJid, ::Dynamic addContext){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::haxe::ds::StringMap,recipients) HXARGC(0)
+ ::Dynamic _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_a0bea8386b958531_151_fromStanza)
+HXLINE( 151) return recipients->keys();
+ }
+ HX_END_LOCAL_FUNC0(return)
+
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_1) HXARGC(2)
+ int _hx_run( ::snikket::JID x, ::snikket::JID y){
+ HX_GC_STACKFRAME(&_hx_pos_a0bea8386b958531_152_fromStanza)
+HXLINE( 152) ::String _hx_tmp = x->asString();
+HXDLIN( 152) return ::Reflect_obj::compare(_hx_tmp,y->asString());
+ }
+ HX_END_LOCAL_FUNC2(return)
+
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_2, ::haxe::ds::StringMap,replyTo) HXARGC(0)
+ ::Dynamic _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_a0bea8386b958531_153_fromStanza)
+HXLINE( 153) return replyTo->keys();
+ }
+ HX_END_LOCAL_FUNC0(return)
+
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_3) HXARGC(2)
+ int _hx_run( ::snikket::JID x, ::snikket::JID y){
+ HX_GC_STACKFRAME(&_hx_pos_a0bea8386b958531_154_fromStanza)
+HXLINE( 154) ::String _hx_tmp = x->asString();
+HXDLIN( 154) return ::Reflect_obj::compare(_hx_tmp,y->asString());
+ }
+ HX_END_LOCAL_FUNC2(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_a0bea8386b958531_48_fromStanza)
+HXLINE( 49) ::String fromAttr = ( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) );
+HXLINE( 50) ::String from;
+HXDLIN( 50) if (::hx::IsNull( fromAttr )) {
+HXLINE( 50) from = localJid->domain;
+ }
+ else {
+HXLINE( 50) from = fromAttr;
+ }
+HXLINE( 51) if ((( (::String)(::Reflect_obj::field(stanza->attr,HX_("type",ba,f2,08,4d))) ) == HX_("error",c8,cb,29,73))) {
+HXLINE( 51) return ::snikket::Message_obj::__alloc( HX_CTX ,from,from,null(),::snikket::MessageStanza_obj::ErrorMessageStanza(stanza));
+ }
+HXLINE( 53) ::snikket::ChatMessageBuilder msg = ::snikket::ChatMessageBuilder_obj::__alloc( HX_CTX );
+HXLINE( 54) msg->stanza = stanza;
+HXLINE( 55) msg->timestamp = stanza->findText(HX_("{urn:xmpp:delay}delay@stamp",cb,88,c4,86));
+HXLINE( 56) msg->threadId = stanza->getChildText(HX_("thread",ca,7a,b9,8e),null());
+HXLINE( 57) msg->lang = ( (::String)(::Reflect_obj::field(stanza->attr,HX_("xml:lang",f1,b1,be,5f))) );
+HXLINE( 58) msg->text = stanza->getChildText(HX_("body",a2,7a,1b,41),null());
+HXLINE( 59) bool _hx_tmp;
+HXDLIN( 59) if (::hx::IsNotNull( msg->text )) {
+HXLINE( 59) if (::hx::IsNotNull( msg->lang )) {
+HXLINE( 59) _hx_tmp = (msg->lang == HX_("",00,00,00,00));
+ }
+ else {
+HXLINE( 59) _hx_tmp = true;
+ }
+ }
+ else {
+HXLINE( 59) _hx_tmp = false;
+ }
+HXDLIN( 59) if (_hx_tmp) {
+HXLINE( 60) ::snikket::Stanza tmp = stanza->getChild(HX_("body",a2,7a,1b,41),null());
+HXDLIN( 60) ::String _hx_tmp1;
+HXDLIN( 60) if (::hx::IsNotNull( tmp )) {
+HXLINE( 60) _hx_tmp1 = ( (::String)(::Reflect_obj::field(tmp->attr,HX_("xml:lang",f1,b1,be,5f))) );
+ }
+ else {
+HXLINE( 60) _hx_tmp1 = null();
+ }
+HXDLIN( 60) msg->lang = _hx_tmp1;
+ }
+HXLINE( 62) msg->from = ::snikket::JID_obj::parse(from);
+HXLINE( 63) bool isGroupchat = (( (::String)(::Reflect_obj::field(stanza->attr,HX_("type",ba,f2,08,4d))) ) == HX_("groupchat",97,1d,c8,e5));
+HXLINE( 64) int _hx_tmp2;
+HXDLIN( 64) if (isGroupchat) {
+HXLINE( 64) _hx_tmp2 = 2;
+ }
+ else {
+HXLINE( 64) _hx_tmp2 = 0;
+ }
+HXDLIN( 64) msg->type = _hx_tmp2;
+HXLINE( 65) bool _hx_tmp3;
+HXDLIN( 65) if ((msg->type == 0)) {
+HXLINE( 65) _hx_tmp3 = ::hx::IsNotNull( stanza->getChild(HX_("x",78,00,00,00),HX_("http://jabber.org/protocol/muc#user",87,74,8e,14)) );
+ }
+ else {
+HXLINE( 65) _hx_tmp3 = false;
+ }
+HXDLIN( 65) if (_hx_tmp3) {
+HXLINE( 66) msg->type = 3;
+ }
+HXLINE( 68) ::snikket::JID tmp1;
+HXDLIN( 68) if (isGroupchat) {
+HXLINE( 68) tmp1 = msg->from;
+ }
+ else {
+HXLINE( 68) ::snikket::JID tmp2 = msg->from;
+HXDLIN( 68) if (::hx::IsNotNull( tmp2 )) {
+HXLINE( 68) tmp1 = tmp2->asBare();
+ }
+ else {
+HXLINE( 68) tmp1 = null();
+ }
+ }
+HXDLIN( 68) ::String _hx_tmp4;
+HXDLIN( 68) if (::hx::IsNotNull( tmp1 )) {
+HXLINE( 68) _hx_tmp4 = tmp1->asString();
+ }
+ else {
+HXLINE( 68) _hx_tmp4 = null();
+ }
+HXDLIN( 68) msg->senderId = _hx_tmp4;
+HXLINE( 69) ::snikket::JID localJidBare = localJid->asBare();
+HXLINE( 70) ::String domain = localJid->domain;
+HXLINE( 71) ::String to = ( (::String)(::Reflect_obj::field(stanza->attr,HX_("to",7b,65,00,00))) );
+HXLINE( 72) ::snikket::JID _hx_tmp5;
+HXDLIN( 72) if (::hx::IsNull( to )) {
+HXLINE( 72) _hx_tmp5 = localJid;
+ }
+ else {
+HXLINE( 72) _hx_tmp5 = ::snikket::JID_obj::parse(to);
+ }
+HXDLIN( 72) msg->to = _hx_tmp5;
+HXLINE( 74) bool _hx_tmp6;
+HXDLIN( 74) if (::hx::IsNotNull( msg->from )) {
+HXLINE( 74) _hx_tmp6 = msg->from->equals(localJidBare);
+ }
+ else {
+HXLINE( 74) _hx_tmp6 = false;
+ }
+HXDLIN( 74) if (_hx_tmp6) {
+HXLINE( 75) ::snikket::Stanza carbon = stanza->getChild(HX_("received",21,45,fd,e2),HX_("urn:xmpp:carbons:2",02,86,9e,df));
+HXLINE( 76) if (::hx::IsNull( carbon )) {
+HXLINE( 76) carbon = stanza->getChild(HX_("sent",58,8d,50,4c),HX_("urn:xmpp:carbons:2",02,86,9e,df));
+ }
+HXLINE( 77) if (::hx::IsNotNull( carbon )) {
+HXLINE( 78) ::snikket::Stanza fwd = carbon->getChild(HX_("forwarded",64,f5,9a,17),HX_("urn:xmpp:forward:0",1f,ec,b0,d1));
+HXLINE( 79) if (::hx::IsNotNull( fwd )) {
+HXLINE( 79) return ::snikket::Message_obj::fromStanza(fwd->getFirstChild(),localJid,null());
+ }
+ }
+ }
+HXLINE( 83) ::String localId = ( (::String)(::Reflect_obj::field(stanza->attr,HX_("id",db,5b,00,00))) );
+HXLINE( 84) if (::hx::IsNotNull( localId )) {
+HXLINE( 84) msg->localId = localId;
+ }
+HXLINE( 85) ::snikket::Stanza altServerId = null();
+HXLINE( 86) {
+HXLINE( 86) int _g = 0;
+HXDLIN( 86) ::Array< ::Dynamic> _g1 = stanza->allTags(HX_("stanza-id",73,8a,54,e9),HX_("urn:xmpp:sid:0",a8,4b,37,54));
+HXDLIN( 86) while((_g < _g1->length)){
+HXLINE( 86) ::snikket::Stanza stanzaId = _g1->__get(_g).StaticCast< ::snikket::Stanza >();
+HXDLIN( 86) _g = (_g + 1);
+HXLINE( 87) ::String id = ( (::String)(::Reflect_obj::field(stanzaId->attr,HX_("id",db,5b,00,00))) );
+HXLINE( 88) bool _hx_tmp7;
+HXDLIN( 88) bool _hx_tmp8;
+HXDLIN( 88) if ((( (::String)(::Reflect_obj::field(stanzaId->attr,HX_("by",d7,55,00,00))) ) != domain)) {
+HXLINE( 88) ::String _hx_tmp9 = ( (::String)(::Reflect_obj::field(stanzaId->attr,HX_("by",d7,55,00,00))) );
+HXDLIN( 88) _hx_tmp8 = (_hx_tmp9 == localJidBare->asString());
+ }
+ else {
+HXLINE( 88) _hx_tmp8 = true;
+ }
+HXDLIN( 88) if (_hx_tmp8) {
+HXLINE( 88) _hx_tmp7 = ::hx::IsNotNull( id );
+ }
+ else {
+HXLINE( 88) _hx_tmp7 = false;
+ }
+HXDLIN( 88) if (_hx_tmp7) {
+HXLINE( 89) msg->serverIdBy = localJidBare->asString();
+HXLINE( 90) msg->serverId = id;
+HXLINE( 91) goto _hx_goto_1;
+ }
+HXLINE( 93) altServerId = stanzaId;
+ }
+ _hx_goto_1:;
+ }
+HXLINE( 95) bool _hx_tmp10;
+HXDLIN( 95) bool _hx_tmp11;
+HXDLIN( 95) if (::hx::IsNull( msg->serverId )) {
+HXLINE( 95) _hx_tmp11 = ::hx::IsNotNull( altServerId );
+ }
+ else {
+HXLINE( 95) _hx_tmp11 = false;
+ }
+HXDLIN( 95) if (_hx_tmp11) {
+HXLINE( 95) _hx_tmp10 = (( (::String)(::Reflect_obj::field(stanza->attr,HX_("type",ba,f2,08,4d))) ) != HX_("error",c8,cb,29,73));
+ }
+ else {
+HXLINE( 95) _hx_tmp10 = false;
+ }
+HXDLIN( 95) if (_hx_tmp10) {
+HXLINE( 96) ::String id1 = ( (::String)(::Reflect_obj::field(altServerId->attr,HX_("id",db,5b,00,00))) );
+HXLINE( 97) if (::hx::IsNotNull( id1 )) {
+HXLINE( 98) msg->serverId = id1;
+HXLINE( 99) msg->serverIdBy = ( (::String)(::Reflect_obj::field(altServerId->attr,HX_("by",d7,55,00,00))) );
+ }
+ }
+HXLINE( 102) bool _hx_tmp12;
+HXDLIN( 102) if (::hx::IsNotNull( msg->serverIdBy )) {
+HXLINE( 102) ::String msg1 = msg->serverIdBy;
+HXDLIN( 102) _hx_tmp12 = (msg1 != localJid->asBare()->asString());
+ }
+ else {
+HXLINE( 102) _hx_tmp12 = false;
+ }
+HXDLIN( 102) if (_hx_tmp12) {
+HXLINE( 103) msg->replyId = msg->serverId;
+ }
+ else {
+HXLINE( 104) ::String msg2 = msg->serverIdBy;
+HXDLIN( 104) if ((msg2 == localJid->asBare()->asString())) {
+HXLINE( 105) msg->replyId = msg->localId;
+ }
+ }
+HXLINE( 107) int _hx_tmp13;
+HXDLIN( 107) bool _hx_tmp14;
+HXDLIN( 107) if (::hx::IsNotNull( msg->to )) {
+HXLINE( 107) _hx_tmp14 = msg->to->asBare()->equals(localJidBare);
+ }
+ else {
+HXLINE( 107) _hx_tmp14 = true;
+ }
+HXDLIN( 107) if (_hx_tmp14) {
+HXLINE( 107) _hx_tmp13 = 0;
+ }
+ else {
+HXLINE( 107) _hx_tmp13 = 1;
+ }
+HXDLIN( 107) msg->direction = _hx_tmp13;
+HXLINE( 108) bool _hx_tmp15;
+HXDLIN( 108) if (::hx::IsNotNull( msg->from )) {
+HXLINE( 108) _hx_tmp15 = msg->from->asBare()->equals(localJidBare);
+ }
+ else {
+HXLINE( 108) _hx_tmp15 = false;
+ }
+HXDLIN( 108) if (_hx_tmp15) {
+HXLINE( 108) msg->direction = 1;
+ }
+HXLINE( 109) int _hx_tmp16;
+HXDLIN( 109) if ((msg->direction == 0)) {
+HXLINE( 109) _hx_tmp16 = 2;
+ }
+ else {
+HXLINE( 109) _hx_tmp16 = 1;
+ }
+HXDLIN( 109) msg->status = _hx_tmp16;
+HXLINE( 111) ::haxe::ds::StringMap recipients = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXLINE( 112) ::haxe::ds::StringMap replyTo = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXLINE( 113) if (::hx::IsNotNull( msg->to )) {
+HXLINE( 114) ::String k = msg->to->asBare()->asString();
+HXDLIN( 114) recipients->set(k,true);
+ }
+HXLINE( 116) ::snikket::JID from1 = msg->from;
+HXLINE( 117) bool _hx_tmp17;
+HXDLIN( 117) if ((msg->direction == 0)) {
+HXLINE( 117) _hx_tmp17 = ::hx::IsNotNull( from1 );
+ }
+ else {
+HXLINE( 117) _hx_tmp17 = false;
+ }
+HXDLIN( 117) if (_hx_tmp17) {
+HXLINE( 118) ::String k1;
+HXDLIN( 118) if (isGroupchat) {
+HXLINE( 118) k1 = from1->asBare()->asString();
+ }
+ else {
+HXLINE( 118) k1 = from1->asString();
+ }
+HXDLIN( 118) replyTo->set(k1,true);
+ }
+ else {
+HXLINE( 119) if (::hx::IsNotNull( msg->to )) {
+HXLINE( 120) ::String k2 = msg->to->asString();
+HXDLIN( 120) replyTo->set(k2,true);
+ }
+ }
+HXLINE( 123) ::snikket::Stanza addresses = stanza->getChild(HX_("addresses",22,9f,12,8c),HX_("http://jabber.org/protocol/address",c0,fd,09,ed));
+HXLINE( 124) bool anyExtendedReplyTo = false;
+HXLINE( 125) if (::hx::IsNotNull( addresses )) {
+HXLINE( 126) int _g2 = 0;
+HXDLIN( 126) ::Array< ::Dynamic> _g3 = addresses->allTags(HX_("address",b4,71,0b,9d),null());
+HXDLIN( 126) while((_g2 < _g3->length)){
+HXLINE( 126) ::snikket::Stanza address = _g3->__get(_g2).StaticCast< ::snikket::Stanza >();
+HXDLIN( 126) _g2 = (_g2 + 1);
+HXLINE( 127) ::String jid = ( (::String)(::Reflect_obj::field(address->attr,HX_("jid",c5,ca,50,00))) );
+HXLINE( 128) if ((( (::String)(::Reflect_obj::field(address->attr,HX_("type",ba,f2,08,4d))) ) == HX_("noreply",49,1d,9c,26))) {
+HXLINE( 129) replyTo->clear();
+ }
+ else {
+HXLINE( 130) if (::hx::IsNull( jid )) {
+HXLINE( 131) ::haxe::Log_obj::trace(HX_("No support for addressing to non-jid",ab,6a,51,09), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.Message",b6,74,a7,a8))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,address))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("fromStanza",ff,62,3b,49))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/Message.hx",09,8f,c7,9f))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),131)));
+HXLINE( 132) ::String _hx_tmp18 = msg->chatId();
+HXDLIN( 132) ::String _hx_tmp19 = msg->get_senderId();
+HXDLIN( 132) return ::snikket::Message_obj::__alloc( HX_CTX ,_hx_tmp18,_hx_tmp19,msg->threadId,::snikket::MessageStanza_obj::UnknownMessageStanza(stanza));
+ }
+ else {
+HXLINE( 133) bool _hx_tmp20;
+HXDLIN( 133) if ((( (::String)(::Reflect_obj::field(address->attr,HX_("type",ba,f2,08,4d))) ) != HX_("to",7b,65,00,00))) {
+HXLINE( 133) _hx_tmp20 = (( (::String)(::Reflect_obj::field(address->attr,HX_("type",ba,f2,08,4d))) ) == HX_("cc",a0,56,00,00));
+ }
+ else {
+HXLINE( 133) _hx_tmp20 = true;
+ }
+HXDLIN( 133) if (_hx_tmp20) {
+HXLINE( 134) {
+HXLINE( 134) ::String k3 = ::snikket::JID_obj::parse(jid)->asBare()->asString();
+HXDLIN( 134) recipients->set(k3,true);
+ }
+HXLINE( 135) if (!(anyExtendedReplyTo)) {
+HXLINE( 135) ::String k4 = ::snikket::JID_obj::parse(jid)->asString();
+HXDLIN( 135) replyTo->set(k4,true);
+ }
+ }
+ else {
+HXLINE( 136) bool _hx_tmp21;
+HXDLIN( 136) if ((( (::String)(::Reflect_obj::field(address->attr,HX_("type",ba,f2,08,4d))) ) != HX_("replyto",25,8d,3a,ab))) {
+HXLINE( 136) _hx_tmp21 = (( (::String)(::Reflect_obj::field(address->attr,HX_("type",ba,f2,08,4d))) ) == HX_("replyroom",45,d4,81,d7));
+ }
+ else {
+HXLINE( 136) _hx_tmp21 = true;
+ }
+HXDLIN( 136) if (_hx_tmp21) {
+HXLINE( 137) if (!(anyExtendedReplyTo)) {
+HXLINE( 138) replyTo->clear();
+HXLINE( 139) anyExtendedReplyTo = true;
+ }
+HXLINE( 141) {
+HXLINE( 141) ::String k5 = ::snikket::JID_obj::parse(jid)->asString();
+HXDLIN( 141) replyTo->set(k5,true);
+ }
+ }
+ else {
+HXLINE( 142) if ((( (::String)(::Reflect_obj::field(address->attr,HX_("type",ba,f2,08,4d))) ) == HX_("ofrom",59,09,3d,2d))) {
+HXLINE( 143) ::snikket::JID tmp3 = msg->from;
+HXDLIN( 143) ::String _hx_tmp22;
+HXDLIN( 143) if (::hx::IsNotNull( tmp3 )) {
+HXLINE( 143) _hx_tmp22 = tmp3->domain;
+ }
+ else {
+HXLINE( 143) _hx_tmp22 = null();
+ }
+HXDLIN( 143) if ((::snikket::JID_obj::parse(jid)->domain == _hx_tmp22)) {
+HXLINE( 145) msg->senderId = ::snikket::JID_obj::parse(jid)->asBare()->asString();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+HXLINE( 151) ::Array< ::Dynamic> _g4 = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 151) ::Dynamic inlobj_iterator = ::Dynamic(new _hx_Closure_0(recipients));
+HXDLIN( 151) ::Dynamic x = inlobj_iterator();
+HXDLIN( 151) while(( (bool)(x->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 151) ::String x1 = ( (::String)(x->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXDLIN( 151) _g4->push(::snikket::JID_obj::parse(x1));
+ }
+HXDLIN( 151) msg->recipients = _g4;
+HXLINE( 152) msg->recipients->sort( ::Dynamic(new _hx_Closure_1()));
+HXLINE( 153) ::Array< ::Dynamic> _g5 = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 153) ::Dynamic inlobj_iterator1 = ::Dynamic(new _hx_Closure_2(replyTo));
+HXDLIN( 153) ::Dynamic x2 = inlobj_iterator1();
+HXDLIN( 153) while(( (bool)(x2->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 153) ::String x3 = ( (::String)(x2->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXDLIN( 153) _g5->push(::snikket::JID_obj::parse(x3));
+ }
+HXDLIN( 153) msg->replyTo = _g5;
+HXLINE( 154) msg->replyTo->sort( ::Dynamic(new _hx_Closure_3()));
+HXLINE( 156) ::snikket::JID msgFrom = msg->from;
+HXLINE( 157) bool _hx_tmp23;
+HXDLIN( 157) bool _hx_tmp24;
+HXDLIN( 157) if ((msg->direction == 0)) {
+HXLINE( 157) _hx_tmp24 = ::hx::IsNotNull( msgFrom );
+ }
+ else {
+HXLINE( 157) _hx_tmp24 = false;
+ }
+HXDLIN( 157) if (_hx_tmp24) {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_4, ::snikket::JID,msgFrom) HXARGC(1)
+ bool _hx_run( ::snikket::JID r){
+ HX_GC_STACKFRAME(&_hx_pos_a0bea8386b958531_157_fromStanza)
+HXLINE( 157) ::snikket::JID _hx_tmp = r->asBare();
+HXDLIN( 157) return _hx_tmp->equals(msgFrom->asBare());
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE( 157) _hx_tmp23 = ::hx::IsNull( ::Lambda_obj::find(msg->replyTo, ::Dynamic(new _hx_Closure_4(msgFrom))) );
+ }
+ else {
+HXLINE( 157) _hx_tmp23 = false;
+ }
+HXDLIN( 157) if (_hx_tmp23) {
+HXLINE( 158) ::haxe::Log_obj::trace(HX_("Don't know what chat message without from in replyTo belongs in",f3,47,ba,0d), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.Message",b6,74,a7,a8))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,stanza))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("fromStanza",ff,62,3b,49))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/Message.hx",09,8f,c7,9f))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),158)));
+HXLINE( 159) ::String _hx_tmp25 = msg->chatId();
+HXDLIN( 159) ::String _hx_tmp26 = msg->get_senderId();
+HXDLIN( 159) return ::snikket::Message_obj::__alloc( HX_CTX ,_hx_tmp25,_hx_tmp26,msg->threadId,::snikket::MessageStanza_obj::UnknownMessageStanza(stanza));
+ }
+HXLINE( 162) if (::hx::IsNotNull( addContext )) {
+HXLINE( 162) msg = ( ( ::snikket::ChatMessageBuilder)(addContext(msg,stanza)) );
+ }
+HXLINE( 163) ::String timestamp;
+HXDLIN( 163) ::String tmp4 = msg->timestamp;
+HXDLIN( 163) if (::hx::IsNotNull( tmp4 )) {
+HXLINE( 163) timestamp = tmp4;
+ }
+ else {
+HXLINE( 163) timestamp = ::snikket::Date_obj::format(::Date_obj::now());
+ }
+HXLINE( 164) msg->timestamp = timestamp;
+HXLINE( 166) ::snikket::Stanza reactionsEl = stanza->getChild(HX_("reactions",aa,cc,95,e7),HX_("urn:xmpp:reactions:0",44,fb,42,53));
+HXLINE( 167) if (::hx::IsNotNull( reactionsEl )) {
+HXLINE( 169) ::Array< ::Dynamic> _this = reactionsEl->allTags(HX_("reaction",a9,e7,b4,f6),null());
+HXDLIN( 169) ::Array< ::String > result = ::Array_obj< ::String >::__new(_this->length);
+HXDLIN( 169) {
+HXLINE( 169) int _g6 = 0;
+HXDLIN( 169) int _g7 = _this->length;
+HXDLIN( 169) while((_g6 < _g7)){
+HXLINE( 169) _g6 = (_g6 + 1);
+HXDLIN( 169) int i = (_g6 - 1);
+HXDLIN( 169) {
+HXLINE( 169) ::String inValue = ( ( ::snikket::Stanza)(_hx_array_unsafe_get(_this,i)) )->getText();
+HXDLIN( 169) result->__unsafe_set(i,inValue);
+ }
+ }
+ }
+HXDLIN( 169) ::Array< ::String > reactions = result;
+HXLINE( 170) ::String reactionId = ( (::String)(::Reflect_obj::field(reactionsEl->attr,HX_("id",db,5b,00,00))) );
+HXLINE( 171) if (::hx::IsNotNull( reactionId )) {
+HXLINE( 172) ::String _hx_tmp27 = msg->chatId();
+HXDLIN( 172) ::String _hx_tmp28 = msg->get_senderId();
+HXDLIN( 172) ::String msg3 = msg->threadId;
+HXLINE( 173) ::String _hx_tmp29;
+HXDLIN( 173) ::String tmp5 = ( (::String)(::Reflect_obj::field(stanza->attr,HX_("id",db,5b,00,00))) );
+HXDLIN( 173) if (::hx::IsNotNull( tmp5 )) {
+HXLINE( 173) _hx_tmp29 = tmp5;
+ }
+ else {
+HXLINE( 173) _hx_tmp29 = ::snikket::ID_obj::_hx_long();
+ }
+HXLINE( 174) ::String _hx_tmp30;
+HXDLIN( 174) if (isGroupchat) {
+HXLINE( 174) _hx_tmp30 = reactionId;
+ }
+ else {
+HXLINE( 174) _hx_tmp30 = null();
+ }
+HXLINE( 175) ::String _hx_tmp31;
+HXDLIN( 175) if (isGroupchat) {
+HXLINE( 175) _hx_tmp31 = msg->chatId();
+ }
+ else {
+HXLINE( 175) _hx_tmp31 = null();
+ }
+HXLINE( 176) ::String _hx_tmp32;
+HXDLIN( 176) if (isGroupchat) {
+HXLINE( 176) _hx_tmp32 = null();
+ }
+ else {
+HXLINE( 176) _hx_tmp32 = reactionId;
+ }
+HXLINE( 177) ::String _hx_tmp33 = msg->chatId();
+HXLINE( 178) ::String _hx_tmp34 = msg->get_senderId();
+HXLINE( 180) ::Array< ::Dynamic> result1 = ::Array_obj< ::Dynamic>::__new(reactions->length);
+HXDLIN( 180) {
+HXLINE( 180) int _g8 = 0;
+HXDLIN( 180) int _g9 = reactions->length;
+HXDLIN( 180) while((_g8 < _g9)){
+HXLINE( 180) _g8 = (_g8 + 1);
+HXDLIN( 180) int i1 = (_g8 - 1);
+HXDLIN( 180) {
+HXLINE( 180) ::String text = ( (::String)(_hx_array_unsafe_get(reactions,i1)) );
+HXDLIN( 180) ::snikket::Reaction inValue1 = ::snikket::Reaction_obj::__alloc( HX_CTX ,msg->get_senderId(),timestamp,text,msg->localId,null());
+HXDLIN( 180) result1->__unsafe_set(i1,inValue1);
+ }
+ }
+ }
+HXLINE( 172) return ::snikket::Message_obj::__alloc( HX_CTX ,_hx_tmp27,_hx_tmp28,msg3,::snikket::MessageStanza_obj::ReactionUpdateStanza( ::snikket::ReactionUpdate_obj::__alloc( HX_CTX ,_hx_tmp29,_hx_tmp30,_hx_tmp31,_hx_tmp32,_hx_tmp33,_hx_tmp34,timestamp,result1,0)));
+ }
+ }
+HXLINE( 186) {
+HXLINE( 186) int _g10 = 0;
+HXDLIN( 186) ::Array< ::Dynamic> _g11 = stanza->allTags(HX_("reference",cb,07,c5,5a),HX_("urn:xmpp:reference:0",a5,00,10,5d));
+HXDLIN( 186) while((_g10 < _g11->length)){
+HXLINE( 186) ::snikket::Stanza ref = _g11->__get(_g10).StaticCast< ::snikket::Stanza >();
+HXDLIN( 186) _g10 = (_g10 + 1);
+HXLINE( 187) bool _hx_tmp35;
+HXDLIN( 187) if (::hx::IsNull( ( (::String)(::Reflect_obj::field(ref->attr,HX_("begin",29,ea,55,b0))) ) )) {
+HXLINE( 187) _hx_tmp35 = ::hx::IsNull( ( (::String)(::Reflect_obj::field(ref->attr,HX_("end",db,03,4d,00))) ) );
+ }
+ else {
+HXLINE( 187) _hx_tmp35 = false;
+ }
+HXDLIN( 187) if (_hx_tmp35) {
+HXLINE( 188) ::snikket::Stanza sims = ref->getChild(HX_("media-sharing",33,1c,0a,3d),HX_("urn:xmpp:sims:1",4f,1c,49,62));
+HXLINE( 189) if (::hx::IsNotNull( sims )) {
+HXLINE( 189) msg->attachSims(sims);
+ }
+ }
+ }
+ }
+HXLINE( 193) {
+HXLINE( 193) int _g12 = 0;
+HXDLIN( 193) ::Array< ::Dynamic> _g13 = stanza->allTags(HX_("media-sharing",33,1c,0a,3d),HX_("urn:xmpp:sims:1",4f,1c,49,62));
+HXDLIN( 193) while((_g12 < _g13->length)){
+HXLINE( 193) ::snikket::Stanza sims1 = _g13->__get(_g12).StaticCast< ::snikket::Stanza >();
+HXDLIN( 193) _g12 = (_g12 + 1);
+HXLINE( 194) msg->attachSims(sims1);
+ }
+ }
+HXLINE( 197) ::snikket::Stanza jmi = stanza->getChild(null(),HX_("urn:xmpp:jingle-message:0",fd,20,a5,07));
+HXLINE( 198) if (::hx::IsNotNull( jmi )) {
+HXLINE( 199) msg->type = 1;
+HXLINE( 200) msg->payloads->push(jmi);
+HXLINE( 201) if (::hx::IsNull( msg->text )) {
+HXLINE( 201) msg->text = (HX_("call ",c2,71,1b,41) + jmi->name);
+ }
+HXLINE( 202) if ((jmi->name != HX_("propose",fe,fe,e9,f9))) {
+HXLINE( 203) msg->versions = ::Array_obj< ::Dynamic>::__new(1)->init(0,msg->build());
+ }
+HXLINE( 206) msg->localId = ( (::String)(::Reflect_obj::field(jmi->attr,HX_("id",db,5b,00,00))) );
+ }
+HXLINE( 209) ::snikket::Stanza retract = stanza->getChild(HX_("replace",34,48,28,ab),HX_("urn:xmpp:message-retract:1",16,5e,d8,d5));
+HXLINE( 210) ::snikket::Stanza fasten = stanza->getChild(HX_("apply-to",3a,9e,dd,24),HX_("urn:xmpp:fasten:0",17,f4,ed,3d));
+HXLINE( 211) ::snikket::Stanza moderated;
+HXDLIN( 211) ::snikket::Stanza tmp6;
+HXDLIN( 211) if (::hx::IsNotNull( retract )) {
+HXLINE( 211) tmp6 = retract->getChild(HX_("moderated",41,37,3b,22),HX_("urn:xmpp:message-retract:1",16,5e,d8,d5));
+ }
+ else {
+HXLINE( 211) tmp6 = null();
+ }
+HXDLIN( 211) if (::hx::IsNotNull( tmp6 )) {
+HXLINE( 211) moderated = tmp6;
+ }
+ else {
+HXLINE( 211) if (::hx::IsNotNull( fasten )) {
+HXLINE( 211) moderated = fasten->getChild(HX_("moderated",41,37,3b,22),HX_("urn:xmpp:message-moderate:0",5b,30,1a,b9));
+ }
+ else {
+HXLINE( 211) moderated = null();
+ }
+ }
+HXLINE( 212) ::String moderateServerId;
+HXDLIN( 212) ::Dynamic tmp7;
+HXDLIN( 212) if (::hx::IsNotNull( retract )) {
+HXLINE( 212) tmp7 = retract->attr;
+ }
+ else {
+HXLINE( 212) tmp7 = null();
+ }
+HXDLIN( 212) ::String tmp8;
+HXDLIN( 212) if (::hx::IsNotNull( tmp7 )) {
+HXLINE( 212) tmp8 = ( (::String)(::Reflect_obj::field(tmp7,HX_("id",db,5b,00,00))) );
+ }
+ else {
+HXLINE( 212) tmp8 = null();
+ }
+HXDLIN( 212) if (::hx::IsNotNull( tmp8 )) {
+HXLINE( 212) moderateServerId = tmp8;
+ }
+ else {
+HXLINE( 212) ::Dynamic tmp9;
+HXDLIN( 212) if (::hx::IsNotNull( fasten )) {
+HXLINE( 212) tmp9 = fasten->attr;
+ }
+ else {
+HXLINE( 212) tmp9 = null();
+ }
+HXDLIN( 212) if (::hx::IsNotNull( tmp9 )) {
+HXLINE( 212) moderateServerId = ( (::String)(::Reflect_obj::field(tmp9,HX_("id",db,5b,00,00))) );
+ }
+ else {
+HXLINE( 212) moderateServerId = null();
+ }
+ }
+HXLINE( 213) bool _hx_tmp36;
+HXDLIN( 213) bool _hx_tmp37;
+HXDLIN( 213) bool _hx_tmp38;
+HXDLIN( 213) bool _hx_tmp39;
+HXDLIN( 213) bool _hx_tmp40;
+HXDLIN( 213) if (::hx::IsNotNull( moderated )) {
+HXLINE( 213) _hx_tmp40 = ::hx::IsNotNull( moderateServerId );
+ }
+ else {
+HXLINE( 213) _hx_tmp40 = false;
+ }
+HXDLIN( 213) if (_hx_tmp40) {
+HXLINE( 213) _hx_tmp39 = isGroupchat;
+ }
+ else {
+HXLINE( 213) _hx_tmp39 = false;
+ }
+HXDLIN( 213) if (_hx_tmp39) {
+HXLINE( 213) _hx_tmp38 = ::hx::IsNotNull( msg->from );
+ }
+ else {
+HXLINE( 213) _hx_tmp38 = false;
+ }
+HXDLIN( 213) if (_hx_tmp38) {
+HXLINE( 213) _hx_tmp37 = msg->from->isBare();
+ }
+ else {
+HXLINE( 213) _hx_tmp37 = false;
+ }
+HXDLIN( 213) if (_hx_tmp37) {
+HXLINE( 213) ::String _hx_tmp41 = msg->from->asString();
+HXDLIN( 213) _hx_tmp36 = (_hx_tmp41 == msg->chatId());
+ }
+ else {
+HXLINE( 213) _hx_tmp36 = false;
+ }
+HXDLIN( 213) if (_hx_tmp36) {
+HXLINE( 214) ::String reason;
+HXDLIN( 214) ::String tmp10;
+HXDLIN( 214) if (::hx::IsNotNull( retract )) {
+HXLINE( 214) tmp10 = retract->getChildText(HX_("reason",c4,0f,9d,fc),null());
+ }
+ else {
+HXLINE( 214) tmp10 = null();
+ }
+HXDLIN( 214) if (::hx::IsNotNull( tmp10 )) {
+HXLINE( 214) reason = tmp10;
+ }
+ else {
+HXLINE( 214) if (::hx::IsNotNull( moderated )) {
+HXLINE( 214) reason = moderated->getChildText(HX_("reason",c4,0f,9d,fc),null());
+ }
+ else {
+HXLINE( 214) reason = null();
+ }
+ }
+HXLINE( 215) ::String by = ( (::String)(::Reflect_obj::field(moderated->attr,HX_("by",d7,55,00,00))) );
+HXLINE( 218) ::String _hx_tmp42 = msg->chatId();
+HXLINE( 219) ::String _hx_tmp43 = msg->get_senderId();
+HXLINE( 220) ::String msg4 = msg->threadId;
+HXLINE( 217) return ::snikket::Message_obj::__alloc( HX_CTX ,_hx_tmp42,_hx_tmp43,msg4,::snikket::MessageStanza_obj::ModerateMessageStanza( ::snikket::ModerationAction_obj::__alloc( HX_CTX ,msg->chatId(),moderateServerId,timestamp,by,reason)));
+ }
+HXLINE( 225) ::snikket::Stanza replace = stanza->getChild(HX_("replace",34,48,28,ab),HX_("urn:xmpp:message-correct:0",be,10,1b,b0));
+HXLINE( 226) ::Dynamic tmp11;
+HXDLIN( 226) if (::hx::IsNotNull( replace )) {
+HXLINE( 226) tmp11 = replace->attr;
+ }
+ else {
+HXLINE( 226) tmp11 = null();
+ }
+HXDLIN( 226) ::String replaceId;
+HXDLIN( 226) if (::hx::IsNotNull( tmp11 )) {
+HXLINE( 226) replaceId = ( (::String)(::Reflect_obj::field(tmp11,HX_("id",db,5b,00,00))) );
+ }
+ else {
+HXLINE( 226) replaceId = null();
+ }
+HXLINE( 228) bool _hx_tmp44;
+HXDLIN( 228) bool _hx_tmp45;
+HXDLIN( 228) if (::hx::IsNull( msg->text )) {
+HXLINE( 228) _hx_tmp45 = (msg->attachments->length < 1);
+ }
+ else {
+HXLINE( 228) _hx_tmp45 = false;
+ }
+HXDLIN( 228) if (_hx_tmp45) {
+HXLINE( 228) _hx_tmp44 = ::hx::IsNull( replaceId );
+ }
+ else {
+HXLINE( 228) _hx_tmp44 = false;
+ }
+HXDLIN( 228) if (_hx_tmp44) {
+HXLINE( 228) ::String _hx_tmp46 = msg->chatId();
+HXDLIN( 228) ::String _hx_tmp47 = msg->get_senderId();
+HXDLIN( 228) return ::snikket::Message_obj::__alloc( HX_CTX ,_hx_tmp46,_hx_tmp47,msg->threadId,::snikket::MessageStanza_obj::UnknownMessageStanza(stanza));
+ }
+HXLINE( 230) {
+HXLINE( 230) int _g14 = 0;
+HXDLIN( 230) ::Array< ::Dynamic> _g15 = stanza->allTags(HX_("fallback",22,f0,9d,2a),HX_("urn:xmpp:fallback:0",74,aa,56,9b));
+HXDLIN( 230) while((_g14 < _g15->length)){
+HXLINE( 230) ::snikket::Stanza fallback = _g15->__get(_g14).StaticCast< ::snikket::Stanza >();
+HXDLIN( 230) _g14 = (_g14 + 1);
+HXLINE( 231) msg->payloads->push(fallback);
+ }
+ }
+HXLINE( 234) ::snikket::Stanza unstyled = stanza->getChild(HX_("unstyled",2c,15,1a,18),HX_("urn:xmpp:styling:0",48,d3,aa,fb));
+HXLINE( 235) if (::hx::IsNotNull( unstyled )) {
+HXLINE( 236) msg->payloads->push(unstyled);
+ }
+HXLINE( 239) ::snikket::Stanza html = stanza->getChild(HX_("html",6b,95,16,45),HX_("http://jabber.org/protocol/xhtml-im",c2,5d,b2,ce));
+HXLINE( 240) if (::hx::IsNotNull( html )) {
+HXLINE( 241) msg->payloads->push(html);
+ }
+HXLINE( 244) ::snikket::Stanza reply = stanza->getChild(HX_("reply",2a,09,c6,e6),HX_("urn:xmpp:reply:0",c4,d5,6f,90));
+HXLINE( 245) if (::hx::IsNotNull( reply )) {
+HXLINE( 246) ::String replyToJid = ( (::String)(::Reflect_obj::field(reply->attr,HX_("to",7b,65,00,00))) );
+HXLINE( 247) ::String replyToID = ( (::String)(::Reflect_obj::field(reply->attr,HX_("id",db,5b,00,00))) );
+HXLINE( 249) ::String text1 = msg->text;
+HXLINE( 250) bool _hx_tmp48;
+HXDLIN( 250) if (::hx::IsNotNull( text1 )) {
+HXLINE( 250) _hx_tmp48 = ::snikket::EmojiUtil_obj::isOnlyEmoji(::StringTools_obj::trim(text1));
+ }
+ else {
+HXLINE( 250) _hx_tmp48 = false;
+ }
+HXDLIN( 250) if (_hx_tmp48) {
+HXLINE( 251) ::String _hx_tmp49 = msg->chatId();
+HXDLIN( 251) ::String _hx_tmp50 = msg->get_senderId();
+HXDLIN( 251) ::String msg5 = msg->threadId;
+HXLINE( 252) ::String _hx_tmp51;
+HXDLIN( 252) ::String tmp12 = ( (::String)(::Reflect_obj::field(stanza->attr,HX_("id",db,5b,00,00))) );
+HXDLIN( 252) if (::hx::IsNotNull( tmp12 )) {
+HXLINE( 252) _hx_tmp51 = tmp12;
+ }
+ else {
+HXLINE( 252) _hx_tmp51 = ::snikket::ID_obj::_hx_long();
+ }
+HXLINE( 253) ::String _hx_tmp52;
+HXDLIN( 253) if (isGroupchat) {
+HXLINE( 253) _hx_tmp52 = replyToID;
+ }
+ else {
+HXLINE( 253) _hx_tmp52 = null();
+ }
+HXLINE( 254) ::String _hx_tmp53;
+HXDLIN( 254) if (isGroupchat) {
+HXLINE( 254) _hx_tmp53 = msg->chatId();
+ }
+ else {
+HXLINE( 254) _hx_tmp53 = null();
+ }
+HXLINE( 255) ::String _hx_tmp54;
+HXDLIN( 255) if (isGroupchat) {
+HXLINE( 255) _hx_tmp54 = null();
+ }
+ else {
+HXLINE( 255) _hx_tmp54 = replyToID;
+ }
+HXLINE( 256) ::String _hx_tmp55 = msg->chatId();
+HXLINE( 257) ::String _hx_tmp56 = msg->get_senderId();
+HXLINE( 259) ::String _hx_tmp57 = msg->get_senderId();
+HXDLIN( 259) ::String _hx_tmp58 = ::StringTools_obj::trim(text1);
+HXLINE( 251) return ::snikket::Message_obj::__alloc( HX_CTX ,_hx_tmp49,_hx_tmp50,msg5,::snikket::MessageStanza_obj::ReactionUpdateStanza( ::snikket::ReactionUpdate_obj::__alloc( HX_CTX ,_hx_tmp51,_hx_tmp52,_hx_tmp53,_hx_tmp54,_hx_tmp55,_hx_tmp56,timestamp,::Array_obj< ::Dynamic>::__new(1)->init(0, ::snikket::Reaction_obj::__alloc( HX_CTX ,_hx_tmp57,timestamp,_hx_tmp58,msg->localId,null())),1)));
+ }
+HXLINE( 264) if (::hx::IsNotNull( html )) {
+HXLINE( 265) ::snikket::Stanza body = html->getChild(HX_("body",a2,7a,1b,41),HX_("http://www.w3.org/1999/xhtml",90,6d,f8,c8));
+HXLINE( 266) if (::hx::IsNotNull( body )) {
+HXLINE( 267) ::Array< ::Dynamic> els = body->allTags(null(),null());
+HXLINE( 268) bool _hx_tmp59;
+HXDLIN( 268) if ((els->length == 1)) {
+HXLINE( 268) _hx_tmp59 = (els->__get(0).StaticCast< ::snikket::Stanza >()->name == HX_("img",03,0c,50,00));
+ }
+ else {
+HXLINE( 268) _hx_tmp59 = false;
+ }
+HXDLIN( 268) if (_hx_tmp59) {
+HXLINE( 269) ::String tmp13 = ( (::String)(::Reflect_obj::field(els->__get(0).StaticCast< ::snikket::Stanza >()->attr,HX_("src",e4,a6,57,00))) );
+HXDLIN( 269) ::String hash;
+HXDLIN( 269) if (::hx::IsNotNull( tmp13 )) {
+HXLINE( 269) hash = tmp13;
+ }
+ else {
+HXLINE( 269) hash = HX_("",00,00,00,00);
+ }
+HXDLIN( 269) ::snikket::Hash hash1 = ::snikket::Hash_obj::fromUri(hash);
+HXLINE( 270) if (::hx::IsNotNull( hash1 )) {
+HXLINE( 271) ::String _hx_tmp60 = msg->chatId();
+HXDLIN( 271) ::String _hx_tmp61 = msg->get_senderId();
+HXDLIN( 271) ::String msg6 = msg->threadId;
+HXLINE( 272) ::String _hx_tmp62;
+HXDLIN( 272) ::String tmp14 = ( (::String)(::Reflect_obj::field(stanza->attr,HX_("id",db,5b,00,00))) );
+HXDLIN( 272) if (::hx::IsNotNull( tmp14 )) {
+HXLINE( 272) _hx_tmp62 = tmp14;
+ }
+ else {
+HXLINE( 272) _hx_tmp62 = ::snikket::ID_obj::_hx_long();
+ }
+HXLINE( 273) ::String _hx_tmp63;
+HXDLIN( 273) if (isGroupchat) {
+HXLINE( 273) _hx_tmp63 = replyToID;
+ }
+ else {
+HXLINE( 273) _hx_tmp63 = null();
+ }
+HXLINE( 274) ::String _hx_tmp64;
+HXDLIN( 274) if (isGroupchat) {
+HXLINE( 274) _hx_tmp64 = msg->chatId();
+ }
+ else {
+HXLINE( 274) _hx_tmp64 = null();
+ }
+HXLINE( 275) ::String _hx_tmp65;
+HXDLIN( 275) if (isGroupchat) {
+HXLINE( 275) _hx_tmp65 = null();
+ }
+ else {
+HXLINE( 275) _hx_tmp65 = replyToID;
+ }
+HXLINE( 276) ::String _hx_tmp66 = msg->chatId();
+HXLINE( 277) ::String _hx_tmp67 = msg->get_senderId();
+HXLINE( 279) ::String _hx_tmp68 = msg->get_senderId();
+HXDLIN( 279) ::String _hx_tmp69;
+HXDLIN( 279) ::String tmp15 = ( (::String)(::Reflect_obj::field(els->__get(0).StaticCast< ::snikket::Stanza >()->attr,HX_("alt",29,f9,49,00))) );
+HXDLIN( 279) if (::hx::IsNotNull( tmp15 )) {
+HXLINE( 279) _hx_tmp69 = tmp15;
+ }
+ else {
+HXLINE( 279) _hx_tmp69 = HX_("",00,00,00,00);
+ }
+HXDLIN( 279) ::String _hx_tmp70 = hash1->serializeUri();
+HXLINE( 271) return ::snikket::Message_obj::__alloc( HX_CTX ,_hx_tmp60,_hx_tmp61,msg6,::snikket::MessageStanza_obj::ReactionUpdateStanza( ::snikket::ReactionUpdate_obj::__alloc( HX_CTX ,_hx_tmp62,_hx_tmp63,_hx_tmp64,_hx_tmp65,_hx_tmp66,_hx_tmp67,timestamp,::Array_obj< ::Dynamic>::__new(1)->init(0, ::snikket::CustomEmojiReaction_obj::__alloc( HX_CTX ,_hx_tmp68,timestamp,_hx_tmp69,_hx_tmp70,msg->localId)),1)));
+ }
+ }
+ }
+ }
+HXLINE( 287) if (::hx::IsNotNull( replyToID )) {
+HXLINE( 289) ::snikket::ChatMessageBuilder replyToMessage = ::snikket::ChatMessageBuilder_obj::__alloc( HX_CTX );
+HXLINE( 290) ::snikket::JID _hx_tmp71;
+HXDLIN( 290) if ((replyToJid == msg->get_senderId())) {
+HXLINE( 290) _hx_tmp71 = msg->to;
+ }
+ else {
+HXLINE( 290) _hx_tmp71 = msg->from;
+ }
+HXDLIN( 290) replyToMessage->to = _hx_tmp71;
+HXLINE( 291) ::snikket::JID _hx_tmp72;
+HXDLIN( 291) if (::hx::IsNull( replyToJid )) {
+HXLINE( 291) _hx_tmp72 = null();
+ }
+ else {
+HXLINE( 291) _hx_tmp72 = ::snikket::JID_obj::parse(replyToJid);
+ }
+HXDLIN( 291) replyToMessage->from = _hx_tmp72;
+HXLINE( 292) ::String _hx_tmp73;
+HXDLIN( 292) if (isGroupchat) {
+HXLINE( 292) ::snikket::JID tmp16 = replyToMessage->from;
+HXDLIN( 292) if (::hx::IsNotNull( tmp16 )) {
+HXLINE( 292) _hx_tmp73 = tmp16->asString();
+ }
+ else {
+HXLINE( 292) _hx_tmp73 = null();
+ }
+ }
+ else {
+HXLINE( 292) ::snikket::JID tmp17 = replyToMessage->from;
+HXDLIN( 292) ::snikket::JID tmp18;
+HXDLIN( 292) if (::hx::IsNotNull( tmp17 )) {
+HXLINE( 292) tmp18 = tmp17->asBare();
+ }
+ else {
+HXLINE( 292) tmp18 = null();
+ }
+HXDLIN( 292) if (::hx::IsNotNull( tmp18 )) {
+HXLINE( 292) _hx_tmp73 = tmp18->asString();
+ }
+ else {
+HXLINE( 292) _hx_tmp73 = null();
+ }
+ }
+HXDLIN( 292) replyToMessage->senderId = _hx_tmp73;
+HXLINE( 293) replyToMessage->replyId = replyToID;
+HXLINE( 294) bool _hx_tmp74;
+HXDLIN( 294) if (::hx::IsNotNull( msg->serverIdBy )) {
+HXLINE( 294) ::String msg7 = msg->serverIdBy;
+HXDLIN( 294) _hx_tmp74 = (msg7 != localJid->asBare()->asString());
+ }
+ else {
+HXLINE( 294) _hx_tmp74 = false;
+ }
+HXDLIN( 294) if (_hx_tmp74) {
+HXLINE( 295) replyToMessage->serverId = replyToID;
+ }
+ else {
+HXLINE( 297) replyToMessage->localId = replyToID;
+ }
+HXLINE( 299) msg->replyToMessage = replyToMessage->build();
+ }
+ }
+HXLINE( 303) if (::hx::IsNotNull( replaceId )) {
+HXLINE( 304) if ((msg->versions->length < 1)) {
+HXLINE( 304) msg->versions = ::Array_obj< ::Dynamic>::__new(1)->init(0,msg->build());
+ }
+HXLINE( 305) msg->localId = replaceId;
+ }
+HXLINE( 308) ::String _hx_tmp75 = msg->chatId();
+HXDLIN( 308) ::String _hx_tmp76 = msg->get_senderId();
+HXDLIN( 308) ::String msg8 = msg->threadId;
+HXDLIN( 308) return ::snikket::Message_obj::__alloc( HX_CTX ,_hx_tmp75,_hx_tmp76,msg8,::snikket::MessageStanza_obj::ChatMessageStanza(msg->build()));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC3(Message_obj,fromStanza,return )
+
+
+::hx::ObjectPtr< Message_obj > Message_obj::__new(::String chatId,::String senderId,::String threadId, ::snikket::MessageStanza parsed) {
+ ::hx::ObjectPtr< Message_obj > __this = new Message_obj();
+ __this->__construct(chatId,senderId,threadId,parsed);
+ return __this;
+}
+
+::hx::ObjectPtr< Message_obj > Message_obj::__alloc(::hx::Ctx *_hx_ctx,::String chatId,::String senderId,::String threadId, ::snikket::MessageStanza parsed) {
+ Message_obj *__this = (Message_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Message_obj), true, "snikket.Message"));
+ *(void **)__this = Message_obj::_hx_vtable;
+ __this->__construct(chatId,senderId,threadId,parsed);
+ return __this;
+}
+
+Message_obj::Message_obj()
+{
+}
+
+void Message_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(Message);
+ HX_MARK_MEMBER_NAME(chatId,"chatId");
+ HX_MARK_MEMBER_NAME(senderId,"senderId");
+ HX_MARK_MEMBER_NAME(threadId,"threadId");
+ HX_MARK_MEMBER_NAME(parsed,"parsed");
+ HX_MARK_END_CLASS();
+}
+
+void Message_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(chatId,"chatId");
+ HX_VISIT_MEMBER_NAME(senderId,"senderId");
+ HX_VISIT_MEMBER_NAME(threadId,"threadId");
+ HX_VISIT_MEMBER_NAME(parsed,"parsed");
+}
+
+::hx::Val Message_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 6:
+ if (HX_FIELD_EQ(inName,"chatId") ) { return ::hx::Val( chatId ); }
+ if (HX_FIELD_EQ(inName,"parsed") ) { return ::hx::Val( parsed ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"senderId") ) { return ::hx::Val( senderId ); }
+ if (HX_FIELD_EQ(inName,"threadId") ) { return ::hx::Val( threadId ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool Message_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 10:
+ if (HX_FIELD_EQ(inName,"fromStanza") ) { outValue = fromStanza_dyn(); return true; }
+ }
+ return false;
+}
+
+::hx::Val Message_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 6:
+ if (HX_FIELD_EQ(inName,"chatId") ) { chatId=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"parsed") ) { parsed=inValue.Cast< ::snikket::MessageStanza >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"senderId") ) { senderId=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"threadId") ) { threadId=inValue.Cast< ::String >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void Message_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("chatId",d3,04,77,b7));
+ outFields->push(HX_("senderId",f0,1e,0e,ec));
+ outFields->push(HX_("threadId",45,81,25,cc));
+ outFields->push(HX_("parsed",d1,9c,88,ed));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Message_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(Message_obj,chatId),HX_("chatId",d3,04,77,b7)},
+ {::hx::fsString,(int)offsetof(Message_obj,senderId),HX_("senderId",f0,1e,0e,ec)},
+ {::hx::fsString,(int)offsetof(Message_obj,threadId),HX_("threadId",45,81,25,cc)},
+ {::hx::fsObject /* ::snikket::MessageStanza */ ,(int)offsetof(Message_obj,parsed),HX_("parsed",d1,9c,88,ed)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *Message_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Message_obj_sMemberFields[] = {
+ HX_("chatId",d3,04,77,b7),
+ HX_("senderId",f0,1e,0e,ec),
+ HX_("threadId",45,81,25,cc),
+ HX_("parsed",d1,9c,88,ed),
+ ::String(null()) };
+
+::hx::Class Message_obj::__mClass;
+
+static ::String Message_obj_sStaticFields[] = {
+ HX_("fromStanza",ff,62,3b,49),
+ ::String(null())
+};
+
+void Message_obj::__register()
+{
+ Message_obj _hx_dummy;
+ Message_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.Message",b6,74,a7,a8);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Message_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Message_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Message_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Message_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Message_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Message_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/MessageStanza.cpp b/Sources/c_snikket/src/snikket/MessageStanza.cpp
new file mode 100644
index 0000000..6c18490
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/MessageStanza.cpp
@@ -0,0 +1,135 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_ChatMessage
+#include <snikket/ChatMessage.h>
+#endif
+#ifndef INCLUDED_snikket_MessageStanza
+#include <snikket/MessageStanza.h>
+#endif
+#ifndef INCLUDED_snikket_ModerationAction
+#include <snikket/ModerationAction.h>
+#endif
+#ifndef INCLUDED_snikket_ReactionUpdate
+#include <snikket/ReactionUpdate.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+namespace snikket{
+
+::snikket::MessageStanza MessageStanza_obj::ChatMessageStanza( ::snikket::ChatMessage message)
+{
+ return ::hx::CreateEnum< MessageStanza_obj >(HX_("ChatMessageStanza",04,61,54,9f),1,1)->_hx_init(0,message);
+}
+
+::snikket::MessageStanza MessageStanza_obj::ErrorMessageStanza( ::snikket::Stanza stanza)
+{
+ return ::hx::CreateEnum< MessageStanza_obj >(HX_("ErrorMessageStanza",54,02,51,07),0,1)->_hx_init(0,stanza);
+}
+
+::snikket::MessageStanza MessageStanza_obj::ModerateMessageStanza( ::snikket::ModerationAction action)
+{
+ return ::hx::CreateEnum< MessageStanza_obj >(HX_("ModerateMessageStanza",39,25,06,6f),2,1)->_hx_init(0,action);
+}
+
+::snikket::MessageStanza MessageStanza_obj::ReactionUpdateStanza( ::snikket::ReactionUpdate update)
+{
+ return ::hx::CreateEnum< MessageStanza_obj >(HX_("ReactionUpdateStanza",47,fe,3e,f3),3,1)->_hx_init(0,update);
+}
+
+::snikket::MessageStanza MessageStanza_obj::UnknownMessageStanza( ::snikket::Stanza stanza)
+{
+ return ::hx::CreateEnum< MessageStanza_obj >(HX_("UnknownMessageStanza",52,c1,f7,28),4,1)->_hx_init(0,stanza);
+}
+
+bool MessageStanza_obj::__GetStatic(const ::String &inName, ::Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ if (inName==HX_("ChatMessageStanza",04,61,54,9f)) { outValue = MessageStanza_obj::ChatMessageStanza_dyn(); return true; }
+ if (inName==HX_("ErrorMessageStanza",54,02,51,07)) { outValue = MessageStanza_obj::ErrorMessageStanza_dyn(); return true; }
+ if (inName==HX_("ModerateMessageStanza",39,25,06,6f)) { outValue = MessageStanza_obj::ModerateMessageStanza_dyn(); return true; }
+ if (inName==HX_("ReactionUpdateStanza",47,fe,3e,f3)) { outValue = MessageStanza_obj::ReactionUpdateStanza_dyn(); return true; }
+ if (inName==HX_("UnknownMessageStanza",52,c1,f7,28)) { outValue = MessageStanza_obj::UnknownMessageStanza_dyn(); return true; }
+ return super::__GetStatic(inName, outValue, inCallProp);
+}
+
+HX_DEFINE_CREATE_ENUM(MessageStanza_obj)
+
+int MessageStanza_obj::__FindIndex(::String inName)
+{
+ if (inName==HX_("ChatMessageStanza",04,61,54,9f)) return 1;
+ if (inName==HX_("ErrorMessageStanza",54,02,51,07)) return 0;
+ if (inName==HX_("ModerateMessageStanza",39,25,06,6f)) return 2;
+ if (inName==HX_("ReactionUpdateStanza",47,fe,3e,f3)) return 3;
+ if (inName==HX_("UnknownMessageStanza",52,c1,f7,28)) return 4;
+ return super::__FindIndex(inName);
+}
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(MessageStanza_obj,ChatMessageStanza,return)
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(MessageStanza_obj,ErrorMessageStanza,return)
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(MessageStanza_obj,ModerateMessageStanza,return)
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(MessageStanza_obj,ReactionUpdateStanza,return)
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(MessageStanza_obj,UnknownMessageStanza,return)
+
+int MessageStanza_obj::__FindArgCount(::String inName)
+{
+ if (inName==HX_("ChatMessageStanza",04,61,54,9f)) return 1;
+ if (inName==HX_("ErrorMessageStanza",54,02,51,07)) return 1;
+ if (inName==HX_("ModerateMessageStanza",39,25,06,6f)) return 1;
+ if (inName==HX_("ReactionUpdateStanza",47,fe,3e,f3)) return 1;
+ if (inName==HX_("UnknownMessageStanza",52,c1,f7,28)) return 1;
+ return super::__FindArgCount(inName);
+}
+
+::hx::Val MessageStanza_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ if (inName==HX_("ChatMessageStanza",04,61,54,9f)) return ChatMessageStanza_dyn();
+ if (inName==HX_("ErrorMessageStanza",54,02,51,07)) return ErrorMessageStanza_dyn();
+ if (inName==HX_("ModerateMessageStanza",39,25,06,6f)) return ModerateMessageStanza_dyn();
+ if (inName==HX_("ReactionUpdateStanza",47,fe,3e,f3)) return ReactionUpdateStanza_dyn();
+ if (inName==HX_("UnknownMessageStanza",52,c1,f7,28)) return UnknownMessageStanza_dyn();
+ return super::__Field(inName,inCallProp);
+}
+
+static ::String MessageStanza_obj_sStaticFields[] = {
+ HX_("ErrorMessageStanza",54,02,51,07),
+ HX_("ChatMessageStanza",04,61,54,9f),
+ HX_("ModerateMessageStanza",39,25,06,6f),
+ HX_("ReactionUpdateStanza",47,fe,3e,f3),
+ HX_("UnknownMessageStanza",52,c1,f7,28),
+ ::String(null())
+};
+
+::hx::Class MessageStanza_obj::__mClass;
+
+Dynamic __Create_MessageStanza_obj() { return new MessageStanza_obj; }
+
+void MessageStanza_obj::__register()
+{
+
+::hx::Static(__mClass) = ::hx::_hx_RegisterClass(HX_("snikket.MessageStanza",4b,b3,84,a4), ::hx::TCanCast< MessageStanza_obj >,MessageStanza_obj_sStaticFields,0,
+ &__Create_MessageStanza_obj, &__Create,
+ &super::__SGetClass(), &CreateMessageStanza_obj, 0
+#ifdef HXCPP_VISIT_ALLOCS
+ , 0
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ , 0
+#endif
+);
+ __mClass->mGetStaticField = &MessageStanza_obj::__GetStatic;
+}
+
+void MessageStanza_obj::__boot()
+{
+}
+
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/MessageSync.cpp b/Sources/c_snikket/src/snikket/MessageSync.cpp
new file mode 100644
index 0000000..e51e629
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/MessageSync.cpp
@@ -0,0 +1,514 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_haxe_Exception
+#include <haxe/Exception.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_Log
+#include <haxe/Log.h>
+#endif
+#ifndef INCLUDED_haxe_ds_StringMap
+#include <haxe/ds/StringMap.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessageBuilder
+#include <snikket/ChatMessageBuilder.h>
+#endif
+#ifndef INCLUDED_snikket_Client
+#include <snikket/Client.h>
+#endif
+#ifndef INCLUDED_snikket_EventEmitter
+#include <snikket/EventEmitter.h>
+#endif
+#ifndef INCLUDED_snikket_EventHandler
+#include <snikket/EventHandler.h>
+#endif
+#ifndef INCLUDED_snikket_EventResult
+#include <snikket/EventResult.h>
+#endif
+#ifndef INCLUDED_snikket_GenericStream
+#include <snikket/GenericStream.h>
+#endif
+#ifndef INCLUDED_snikket_JID
+#include <snikket/JID.h>
+#endif
+#ifndef INCLUDED_snikket_Message
+#include <snikket/Message.h>
+#endif
+#ifndef INCLUDED_snikket_MessageStanza
+#include <snikket/MessageStanza.h>
+#endif
+#ifndef INCLUDED_snikket_MessageSync
+#include <snikket/MessageSync.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+#ifndef INCLUDED_snikket_queries_MAMQuery
+#include <snikket/queries/MAMQuery.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_f605d1e3f9d4c7ba_27_new,"snikket.MessageSync","new",0xd084fba3,"snikket.MessageSync.new","snikket/MessageSync.hx",27,0x591328ee)
+HX_DEFINE_STACK_FRAME(_hx_pos_f605d1e3f9d4c7ba_20_new,"snikket.MessageSync","new",0xd084fba3,"snikket.MessageSync.new","snikket/MessageSync.hx",20,0x591328ee)
+HX_LOCAL_STACK_FRAME(_hx_pos_f605d1e3f9d4c7ba_86_fetchNext,"snikket.MessageSync","fetchNext",0xa7aee9d0,"snikket.MessageSync.fetchNext","snikket/MessageSync.hx",86,0x591328ee)
+HX_LOCAL_STACK_FRAME(_hx_pos_f605d1e3f9d4c7ba_64_fetchNext,"snikket.MessageSync","fetchNext",0xa7aee9d0,"snikket.MessageSync.fetchNext","snikket/MessageSync.hx",64,0x591328ee)
+HX_LOCAL_STACK_FRAME(_hx_pos_f605d1e3f9d4c7ba_97_fetchNext,"snikket.MessageSync","fetchNext",0xa7aee9d0,"snikket.MessageSync.fetchNext","snikket/MessageSync.hx",97,0x591328ee)
+HX_LOCAL_STACK_FRAME(_hx_pos_f605d1e3f9d4c7ba_42_fetchNext,"snikket.MessageSync","fetchNext",0xa7aee9d0,"snikket.MessageSync.fetchNext","snikket/MessageSync.hx",42,0x591328ee)
+HX_LOCAL_STACK_FRAME(_hx_pos_f605d1e3f9d4c7ba_119_hasMore,"snikket.MessageSync","hasMore",0x232088d2,"snikket.MessageSync.hasMore","snikket/MessageSync.hx",119,0x591328ee)
+HX_LOCAL_STACK_FRAME(_hx_pos_f605d1e3f9d4c7ba_123_addContext,"snikket.MessageSync","addContext",0xfa4fd4eb,"snikket.MessageSync.addContext","snikket/MessageSync.hx",123,0x591328ee)
+HX_LOCAL_STACK_FRAME(_hx_pos_f605d1e3f9d4c7ba_127_onMessages,"snikket.MessageSync","onMessages",0x8c02c028,"snikket.MessageSync.onMessages","snikket/MessageSync.hx",127,0x591328ee)
+HX_LOCAL_STACK_FRAME(_hx_pos_f605d1e3f9d4c7ba_131_onError,"snikket.MessageSync","onError",0x14e2f2ec,"snikket.MessageSync.onError","snikket/MessageSync.hx",131,0x591328ee)
+HX_LOCAL_STACK_FRAME(_hx_pos_f605d1e3f9d4c7ba_135_setNewestPageFirst,"snikket.MessageSync","setNewestPageFirst",0x54979936,"snikket.MessageSync.setNewestPageFirst","snikket/MessageSync.hx",135,0x591328ee)
+namespace snikket{
+
+void MessageSync_obj::__construct( ::snikket::Client client, ::snikket::GenericStream stream, ::Dynamic filter,::String serviceJID){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(2)
+ ::snikket::ChatMessageBuilder _hx_run( ::snikket::ChatMessageBuilder b, ::snikket::Stanza _){
+ HX_GC_STACKFRAME(&_hx_pos_f605d1e3f9d4c7ba_27_new)
+HXLINE( 27) return b;
+ }
+ HX_END_LOCAL_FUNC2(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_f605d1e3f9d4c7ba_20_new)
+HXLINE( 33) this->jmi = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXLINE( 32) this->newestPageFirst = true;
+HXLINE( 31) this->complete = false;
+HXLINE( 30) this->progress = 0;
+HXLINE( 27) this->contextHandler = ::Dynamic(new _hx_Closure_0());
+HXLINE( 36) this->client = client;
+HXLINE( 37) this->stream = stream;
+HXLINE( 38) this->filter = ::Reflect_obj::copy(filter);
+HXLINE( 39) ::String _hx_tmp;
+HXDLIN( 39) if (::hx::IsNotNull( serviceJID )) {
+HXLINE( 39) _hx_tmp = serviceJID;
+ }
+ else {
+HXLINE( 39) _hx_tmp = client->accountId();
+ }
+HXDLIN( 39) this->serviceJID = _hx_tmp;
+ }
+
+Dynamic MessageSync_obj::__CreateEmpty() { return new MessageSync_obj; }
+
+void *MessageSync_obj::_hx_vtable = 0;
+
+Dynamic MessageSync_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< MessageSync_obj > _hx_result = new MessageSync_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2],inArgs[3]);
+ return _hx_result;
+}
+
+bool MessageSync_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x0c8e50c1;
+}
+
+void MessageSync_obj::fetchNext(){
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_1,::Array< ::Dynamic>,messages, ::snikket::MessageSync,_gthis, ::snikket::queries::MAMQuery,query) HXARGC(1)
+ ::snikket::EventResult _hx_run( ::Dynamic event){
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_0, ::snikket::MessageSync,_gthis,::String,timestamp, ::snikket::Stanza,result) HXARGC(2)
+ ::snikket::ChatMessageBuilder _hx_run( ::snikket::ChatMessageBuilder builder, ::snikket::Stanza stanza){
+ HX_GC_STACKFRAME(&_hx_pos_f605d1e3f9d4c7ba_86_fetchNext)
+HXLINE( 87) builder->serverId = ( (::String)(::Reflect_obj::field(result->attr,HX_("id",db,5b,00,00))) );
+HXLINE( 88) builder->serverIdBy = _gthis->serviceJID;
+HXLINE( 89) bool msg;
+HXDLIN( 89) if (::hx::IsNotNull( timestamp )) {
+HXLINE( 89) msg = ::hx::IsNull( builder->timestamp );
+ }
+ else {
+HXLINE( 89) msg = false;
+ }
+HXDLIN( 89) if (msg) {
+HXLINE( 89) builder->timestamp = timestamp;
+ }
+HXLINE( 90) return ( ( ::snikket::ChatMessageBuilder)(_gthis->contextHandler(builder,stanza)) );
+ }
+ HX_END_LOCAL_FUNC2(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_f605d1e3f9d4c7ba_64_fetchNext)
+HXLINE( 65) _gthis->progress++;
+HXLINE( 66) ::snikket::Stanza message = ( ( ::snikket::Stanza)(event->__Field(HX_("stanza",f5,5d,f7,05),::hx::paccDynamic)) );
+HXLINE( 67) ::String from;
+HXDLIN( 67) if (::Reflect_obj::hasField(message->attr,HX_("from",6a,a5,c2,43))) {
+HXLINE( 67) from = ( (::String)(::Reflect_obj::field(message->attr,HX_("from",6a,a5,c2,43))) );
+ }
+ else {
+HXLINE( 67) from = _gthis->client->accountId();
+ }
+HXLINE( 68) if ((from != _gthis->serviceJID)) {
+HXLINE( 69) return ::snikket::EventResult_obj::EventUnhandled_dyn();
+ }
+HXLINE( 71) ::snikket::Stanza result = message->getChild(HX_("result",dd,68,84,08),query->xmlns);
+HXLINE( 72) bool resultHandler;
+HXDLIN( 72) if (::hx::IsNotNull( result )) {
+HXLINE( 72) ::String resultHandler1 = ( (::String)(::Reflect_obj::field(result->attr,HX_("queryid",e3,b8,e9,95))) );
+HXDLIN( 72) resultHandler = (resultHandler1 != query->queryId);
+ }
+ else {
+HXLINE( 72) resultHandler = true;
+ }
+HXDLIN( 72) if (resultHandler) {
+HXLINE( 73) return ::snikket::EventResult_obj::EventUnhandled_dyn();
+ }
+HXLINE( 75) ::snikket::Stanza originalMessage = result->findChild(HX_("{urn:xmpp:forward:0}forwarded/{jabber:client}message",1e,de,1d,61));
+HXLINE( 76) if (::hx::IsNull( originalMessage )) {
+HXLINE( 77) return ::snikket::EventResult_obj::EventHandled_dyn();
+ }
+HXLINE( 79) ::String timestamp = result->findText(HX_("{urn:xmpp:forward:0}forwarded/{urn:xmpp:delay}delay@stamp",9d,33,43,e7));
+HXLINE( 81) ::Array< ::Dynamic> jmiChildren = originalMessage->allTags(null(),HX_("urn:xmpp:jingle-message:0",fd,20,a5,07));
+HXLINE( 82) if ((jmiChildren->length > 0)) {
+HXLINE( 83) ::Dynamic this1 = _gthis->jmi;
+HXDLIN( 83) ( ( ::haxe::ds::StringMap)(this1) )->set(( (::String)(::Reflect_obj::field(jmiChildren->__get(0).StaticCast< ::snikket::Stanza >()->attr,HX_("id",db,5b,00,00))) ),originalMessage);
+ }
+HXLINE( 86) ::snikket::MessageStanza msg = ::snikket::Message_obj::fromStanza(originalMessage,_gthis->client->jid, ::Dynamic(new _hx_Closure_0(_gthis,timestamp,result)))->parsed;
+HXLINE( 93) messages->push(msg);
+HXLINE( 95) return ::snikket::EventResult_obj::EventHandled_dyn();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S4(::hx::LocalFunc,_hx_Closure_2,::Array< ::Dynamic>,messages, ::snikket::MessageSync,_gthis, ::snikket::EventHandler,resultHandler, ::snikket::queries::MAMQuery,query) HXARGC(0)
+ void _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_f605d1e3f9d4c7ba_97_fetchNext)
+HXLINE( 98) resultHandler->unsubscribe();
+HXLINE( 99) ::Dynamic result = query->getResult();
+HXLINE( 100) if (::hx::IsNull( result )) {
+HXLINE( 101) ::haxe::Log_obj::trace(HX_("Error from MAM, stopping sync",b8,c9,46,be),::hx::SourceInfo(HX_("snikket/MessageSync.hx",ee,28,13,59),101,HX_("snikket.MessageSync",31,ee,97,05),HX_("fetchNext",4d,6a,ad,1f)));
+HXLINE( 102) _gthis->complete = true;
+HXLINE( 103) if (::hx::IsNotNull( _gthis->errorHandler )) {
+HXLINE( 103) _gthis->errorHandler(query->responseStanza);
+ }
+ }
+ else {
+HXLINE( 105) _gthis->complete = ( (bool)(result->__Field(HX_("complete",b9,00,c8,7f),::hx::paccDynamic)) );
+HXLINE( 106) _gthis->lastPage = result->__Field(HX_("page",4f,da,51,4a),::hx::paccDynamic);
+ }
+HXLINE( 108) bool _hx_tmp;
+HXDLIN( 108) if (::hx::IsNull( result )) {
+HXLINE( 108) _hx_tmp = ::hx::IsNull( _gthis->errorHandler );
+ }
+ else {
+HXLINE( 108) _hx_tmp = true;
+ }
+HXDLIN( 108) if (_hx_tmp) {
+HXLINE( 109) _gthis->handler( ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("messages",cc,d8,fd,34),messages)
+ ->setFixed(1,HX_("sync",5b,ba,5f,4c),_gthis)));
+ }
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_f605d1e3f9d4c7ba_42_fetchNext)
+HXDLIN( 42) ::snikket::MessageSync _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 43) if (::hx::IsNull( this->handler )) {
+HXLINE( 44) HX_STACK_DO_THROW( ::haxe::Exception_obj::__alloc( HX_CTX ,HX_("Attempt to fetch messages, but no handler has been set",72,e3,58,24),null(),null()));
+ }
+HXLINE( 46) if (this->complete) {
+HXLINE( 47) HX_STACK_DO_THROW( ::haxe::Exception_obj::__alloc( HX_CTX ,HX_("Attempt to fetch messages, but already complete",f8,43,a7,37),null(),null()));
+ }
+HXLINE( 49) ::Array< ::Dynamic> messages = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 50) if (::hx::IsNull( this->lastPage )) {
+HXLINE( 51) bool _hx_tmp;
+HXDLIN( 51) if ((this->newestPageFirst == true)) {
+HXLINE( 51) if (::hx::IsNotNull( this->filter->__Field(HX_("page",4f,da,51,4a),::hx::paccDynamic) )) {
+HXLINE( 51) if (::hx::IsNull( ::Dynamic(this->filter->__Field(HX_("page",4f,da,51,4a),::hx::paccDynamic))->__Field(HX_("before",7f,54,32,9a),::hx::paccDynamic) )) {
+HXLINE( 51) _hx_tmp = ::hx::IsNull( ::Dynamic(this->filter->__Field(HX_("page",4f,da,51,4a),::hx::paccDynamic))->__Field(HX_("after",1c,66,a2,1d),::hx::paccDynamic) );
+ }
+ else {
+HXLINE( 51) _hx_tmp = false;
+ }
+ }
+ else {
+HXLINE( 51) _hx_tmp = true;
+ }
+ }
+ else {
+HXLINE( 51) _hx_tmp = false;
+ }
+HXDLIN( 51) if (_hx_tmp) {
+HXLINE( 52) if (::hx::IsNull( this->filter->__Field(HX_("page",4f,da,51,4a),::hx::paccDynamic) )) {
+HXLINE( 52) this->filter->__SetField(HX_("page",4f,da,51,4a), ::Dynamic(::hx::Anon_obj::Create(0)),::hx::paccDynamic);
+ }
+HXLINE( 53) ::Dynamic(this->filter->__Field(HX_("page",4f,da,51,4a),::hx::paccDynamic))->__SetField(HX_("before",7f,54,32,9a),HX_("",00,00,00,00),::hx::paccDynamic);
+ }
+ }
+ else {
+HXLINE( 56) if (::hx::IsNull( this->filter->__Field(HX_("page",4f,da,51,4a),::hx::paccDynamic) )) {
+HXLINE( 56) this->filter->__SetField(HX_("page",4f,da,51,4a), ::Dynamic(::hx::Anon_obj::Create(0)),::hx::paccDynamic);
+ }
+HXLINE( 57) if ((this->newestPageFirst == true)) {
+HXLINE( 58) ::Dynamic(this->filter->__Field(HX_("page",4f,da,51,4a),::hx::paccDynamic))->__SetField(HX_("before",7f,54,32,9a),this->lastPage->__Field(HX_("first",30,78,9d,00),::hx::paccDynamic),::hx::paccDynamic);
+ }
+ else {
+HXLINE( 60) ::Dynamic(this->filter->__Field(HX_("page",4f,da,51,4a),::hx::paccDynamic))->__SetField(HX_("after",1c,66,a2,1d),this->lastPage->__Field(HX_("last",56,0a,ad,47),::hx::paccDynamic),::hx::paccDynamic);
+ }
+ }
+HXLINE( 63) ::snikket::queries::MAMQuery query = ::snikket::queries::MAMQuery_obj::__alloc( HX_CTX ,this->filter,this->serviceJID);
+HXLINE( 64) ::snikket::EventHandler resultHandler = this->stream->on(HX_("message",c7,35,11,9a), ::Dynamic(new _hx_Closure_1(messages,_gthis,query)));
+HXLINE( 97) query->onFinished( ::Dynamic(new _hx_Closure_2(messages,_gthis,resultHandler,query)));
+HXLINE( 115) this->client->sendQuery(query);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(MessageSync_obj,fetchNext,(void))
+
+bool MessageSync_obj::hasMore(){
+ HX_STACKFRAME(&_hx_pos_f605d1e3f9d4c7ba_119_hasMore)
+HXDLIN( 119) return !(this->complete);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(MessageSync_obj,hasMore,return )
+
+void MessageSync_obj::addContext( ::Dynamic handler){
+ HX_STACKFRAME(&_hx_pos_f605d1e3f9d4c7ba_123_addContext)
+HXDLIN( 123) this->contextHandler = handler;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(MessageSync_obj,addContext,(void))
+
+void MessageSync_obj::onMessages( ::Dynamic handler){
+ HX_STACKFRAME(&_hx_pos_f605d1e3f9d4c7ba_127_onMessages)
+HXDLIN( 127) this->handler = handler;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(MessageSync_obj,onMessages,(void))
+
+void MessageSync_obj::onError( ::Dynamic handler){
+ HX_STACKFRAME(&_hx_pos_f605d1e3f9d4c7ba_131_onError)
+HXDLIN( 131) this->errorHandler = handler;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(MessageSync_obj,onError,(void))
+
+void MessageSync_obj::setNewestPageFirst(bool newestPageFirst){
+ HX_STACKFRAME(&_hx_pos_f605d1e3f9d4c7ba_135_setNewestPageFirst)
+HXDLIN( 135) this->newestPageFirst = newestPageFirst;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(MessageSync_obj,setNewestPageFirst,(void))
+
+
+::hx::ObjectPtr< MessageSync_obj > MessageSync_obj::__new( ::snikket::Client client, ::snikket::GenericStream stream, ::Dynamic filter,::String serviceJID) {
+ ::hx::ObjectPtr< MessageSync_obj > __this = new MessageSync_obj();
+ __this->__construct(client,stream,filter,serviceJID);
+ return __this;
+}
+
+::hx::ObjectPtr< MessageSync_obj > MessageSync_obj::__alloc(::hx::Ctx *_hx_ctx, ::snikket::Client client, ::snikket::GenericStream stream, ::Dynamic filter,::String serviceJID) {
+ MessageSync_obj *__this = (MessageSync_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(MessageSync_obj), true, "snikket.MessageSync"));
+ *(void **)__this = MessageSync_obj::_hx_vtable;
+ __this->__construct(client,stream,filter,serviceJID);
+ return __this;
+}
+
+MessageSync_obj::MessageSync_obj()
+{
+}
+
+void MessageSync_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(MessageSync);
+ HX_MARK_MEMBER_NAME(client,"client");
+ HX_MARK_MEMBER_NAME(stream,"stream");
+ HX_MARK_MEMBER_NAME(filter,"filter");
+ HX_MARK_MEMBER_NAME(serviceJID,"serviceJID");
+ HX_MARK_MEMBER_NAME(handler,"handler");
+ HX_MARK_MEMBER_NAME(contextHandler,"contextHandler");
+ HX_MARK_MEMBER_NAME(errorHandler,"errorHandler");
+ HX_MARK_MEMBER_NAME(lastPage,"lastPage");
+ HX_MARK_MEMBER_NAME(progress,"progress");
+ HX_MARK_MEMBER_NAME(complete,"complete");
+ HX_MARK_MEMBER_NAME(newestPageFirst,"newestPageFirst");
+ HX_MARK_MEMBER_NAME(jmi,"jmi");
+ HX_MARK_END_CLASS();
+}
+
+void MessageSync_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(client,"client");
+ HX_VISIT_MEMBER_NAME(stream,"stream");
+ HX_VISIT_MEMBER_NAME(filter,"filter");
+ HX_VISIT_MEMBER_NAME(serviceJID,"serviceJID");
+ HX_VISIT_MEMBER_NAME(handler,"handler");
+ HX_VISIT_MEMBER_NAME(contextHandler,"contextHandler");
+ HX_VISIT_MEMBER_NAME(errorHandler,"errorHandler");
+ HX_VISIT_MEMBER_NAME(lastPage,"lastPage");
+ HX_VISIT_MEMBER_NAME(progress,"progress");
+ HX_VISIT_MEMBER_NAME(complete,"complete");
+ HX_VISIT_MEMBER_NAME(newestPageFirst,"newestPageFirst");
+ HX_VISIT_MEMBER_NAME(jmi,"jmi");
+}
+
+::hx::Val MessageSync_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"jmi") ) { return ::hx::Val( jmi ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"client") ) { return ::hx::Val( client ); }
+ if (HX_FIELD_EQ(inName,"stream") ) { return ::hx::Val( stream ); }
+ if (HX_FIELD_EQ(inName,"filter") ) { return ::hx::Val( filter ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"handler") ) { return ::hx::Val( handler ); }
+ if (HX_FIELD_EQ(inName,"hasMore") ) { return ::hx::Val( hasMore_dyn() ); }
+ if (HX_FIELD_EQ(inName,"onError") ) { return ::hx::Val( onError_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"lastPage") ) { return ::hx::Val( lastPage ); }
+ if (HX_FIELD_EQ(inName,"progress") ) { return ::hx::Val( progress ); }
+ if (HX_FIELD_EQ(inName,"complete") ) { return ::hx::Val( complete ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"fetchNext") ) { return ::hx::Val( fetchNext_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"serviceJID") ) { return ::hx::Val( serviceJID ); }
+ if (HX_FIELD_EQ(inName,"addContext") ) { return ::hx::Val( addContext_dyn() ); }
+ if (HX_FIELD_EQ(inName,"onMessages") ) { return ::hx::Val( onMessages_dyn() ); }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"errorHandler") ) { return ::hx::Val( errorHandler ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"contextHandler") ) { return ::hx::Val( contextHandler ); }
+ break;
+ case 15:
+ if (HX_FIELD_EQ(inName,"newestPageFirst") ) { return ::hx::Val( newestPageFirst ); }
+ break;
+ case 18:
+ if (HX_FIELD_EQ(inName,"setNewestPageFirst") ) { return ::hx::Val( setNewestPageFirst_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val MessageSync_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"jmi") ) { jmi=inValue.Cast< ::haxe::ds::StringMap >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"client") ) { client=inValue.Cast< ::snikket::Client >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"stream") ) { stream=inValue.Cast< ::snikket::GenericStream >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"filter") ) { filter=inValue.Cast< ::Dynamic >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"handler") ) { handler=inValue.Cast< ::Dynamic >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"lastPage") ) { lastPage=inValue.Cast< ::Dynamic >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"progress") ) { progress=inValue.Cast< int >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"complete") ) { complete=inValue.Cast< bool >(); return inValue; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"serviceJID") ) { serviceJID=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"errorHandler") ) { errorHandler=inValue.Cast< ::Dynamic >(); return inValue; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"contextHandler") ) { contextHandler=inValue.Cast< ::Dynamic >(); return inValue; }
+ break;
+ case 15:
+ if (HX_FIELD_EQ(inName,"newestPageFirst") ) { newestPageFirst=inValue.Cast< bool >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void MessageSync_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("client",4b,ca,4f,0a));
+ outFields->push(HX_("stream",80,14,2d,11));
+ outFields->push(HX_("filter",b8,1f,35,85));
+ outFields->push(HX_("serviceJID",90,19,2d,7d));
+ outFields->push(HX_("lastPage",c5,f3,9a,dd));
+ outFields->push(HX_("progress",ad,f7,2a,86));
+ outFields->push(HX_("complete",b9,00,c8,7f));
+ outFields->push(HX_("newestPageFirst",9b,ce,b0,7d));
+ outFields->push(HX_("jmi",46,ce,50,00));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo MessageSync_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::snikket::Client */ ,(int)offsetof(MessageSync_obj,client),HX_("client",4b,ca,4f,0a)},
+ {::hx::fsObject /* ::snikket::GenericStream */ ,(int)offsetof(MessageSync_obj,stream),HX_("stream",80,14,2d,11)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(MessageSync_obj,filter),HX_("filter",b8,1f,35,85)},
+ {::hx::fsString,(int)offsetof(MessageSync_obj,serviceJID),HX_("serviceJID",90,19,2d,7d)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(MessageSync_obj,handler),HX_("handler",ca,af,d5,45)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(MessageSync_obj,contextHandler),HX_("contextHandler",9b,6d,14,e9)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(MessageSync_obj,errorHandler),HX_("errorHandler",e2,94,05,f7)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(MessageSync_obj,lastPage),HX_("lastPage",c5,f3,9a,dd)},
+ {::hx::fsInt,(int)offsetof(MessageSync_obj,progress),HX_("progress",ad,f7,2a,86)},
+ {::hx::fsBool,(int)offsetof(MessageSync_obj,complete),HX_("complete",b9,00,c8,7f)},
+ {::hx::fsBool,(int)offsetof(MessageSync_obj,newestPageFirst),HX_("newestPageFirst",9b,ce,b0,7d)},
+ {::hx::fsObject /* ::haxe::ds::StringMap */ ,(int)offsetof(MessageSync_obj,jmi),HX_("jmi",46,ce,50,00)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *MessageSync_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String MessageSync_obj_sMemberFields[] = {
+ HX_("client",4b,ca,4f,0a),
+ HX_("stream",80,14,2d,11),
+ HX_("filter",b8,1f,35,85),
+ HX_("serviceJID",90,19,2d,7d),
+ HX_("handler",ca,af,d5,45),
+ HX_("contextHandler",9b,6d,14,e9),
+ HX_("errorHandler",e2,94,05,f7),
+ HX_("lastPage",c5,f3,9a,dd),
+ HX_("progress",ad,f7,2a,86),
+ HX_("complete",b9,00,c8,7f),
+ HX_("newestPageFirst",9b,ce,b0,7d),
+ HX_("jmi",46,ce,50,00),
+ HX_("fetchNext",4d,6a,ad,1f),
+ HX_("hasMore",0f,00,a5,17),
+ HX_("addContext",ce,c1,01,81),
+ HX_("onMessages",0b,ad,b4,12),
+ HX_("onError",29,6a,67,09),
+ HX_("setNewestPageFirst",19,a1,25,0d),
+ ::String(null()) };
+
+::hx::Class MessageSync_obj::__mClass;
+
+void MessageSync_obj::__register()
+{
+ MessageSync_obj _hx_dummy;
+ MessageSync_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.MessageSync",31,ee,97,05);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(MessageSync_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< MessageSync_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = MessageSync_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = MessageSync_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/ModerationAction.cpp b/Sources/c_snikket/src/snikket/ModerationAction.cpp
new file mode 100644
index 0000000..3e3c85e
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/ModerationAction.cpp
@@ -0,0 +1,153 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_ModerationAction
+#include <snikket/ModerationAction.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_cab007b58fe42bf8_10_new,"snikket.ModerationAction","new",0x79208b9f,"snikket.ModerationAction.new","snikket/ModerationAction.hx",10,0x7a73b150)
+namespace snikket{
+
+void ModerationAction_obj::__construct(::String chatId,::String moderateServerId,::String timestamp,::String moderatorId,::String reason){
+ HX_STACKFRAME(&_hx_pos_cab007b58fe42bf8_10_new)
+HXLINE( 11) this->chatId = chatId;
+HXLINE( 12) this->moderateServerId = moderateServerId;
+HXLINE( 13) this->timestamp = timestamp;
+HXLINE( 14) this->moderatorId = moderatorId;
+HXLINE( 15) this->reason = reason;
+ }
+
+Dynamic ModerationAction_obj::__CreateEmpty() { return new ModerationAction_obj; }
+
+void *ModerationAction_obj::_hx_vtable = 0;
+
+Dynamic ModerationAction_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< ModerationAction_obj > _hx_result = new ModerationAction_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4]);
+ return _hx_result;
+}
+
+bool ModerationAction_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x2ac69cd9;
+}
+
+
+ModerationAction_obj::ModerationAction_obj()
+{
+}
+
+void ModerationAction_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(ModerationAction);
+ HX_MARK_MEMBER_NAME(chatId,"chatId");
+ HX_MARK_MEMBER_NAME(moderateServerId,"moderateServerId");
+ HX_MARK_MEMBER_NAME(timestamp,"timestamp");
+ HX_MARK_MEMBER_NAME(moderatorId,"moderatorId");
+ HX_MARK_MEMBER_NAME(reason,"reason");
+ HX_MARK_END_CLASS();
+}
+
+void ModerationAction_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(chatId,"chatId");
+ HX_VISIT_MEMBER_NAME(moderateServerId,"moderateServerId");
+ HX_VISIT_MEMBER_NAME(timestamp,"timestamp");
+ HX_VISIT_MEMBER_NAME(moderatorId,"moderatorId");
+ HX_VISIT_MEMBER_NAME(reason,"reason");
+}
+
+::hx::Val ModerationAction_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 6:
+ if (HX_FIELD_EQ(inName,"chatId") ) { return ::hx::Val( chatId ); }
+ if (HX_FIELD_EQ(inName,"reason") ) { return ::hx::Val( reason ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"timestamp") ) { return ::hx::Val( timestamp ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"moderatorId") ) { return ::hx::Val( moderatorId ); }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"moderateServerId") ) { return ::hx::Val( moderateServerId ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val ModerationAction_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 6:
+ if (HX_FIELD_EQ(inName,"chatId") ) { chatId=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"reason") ) { reason=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"timestamp") ) { timestamp=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"moderatorId") ) { moderatorId=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"moderateServerId") ) { moderateServerId=inValue.Cast< ::String >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void ModerationAction_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("chatId",d3,04,77,b7));
+ outFields->push(HX_("moderateServerId",61,cc,27,2c));
+ outFields->push(HX_("timestamp",d6,d4,ce,a5));
+ outFields->push(HX_("moderatorId",40,4b,8f,97));
+ outFields->push(HX_("reason",c4,0f,9d,fc));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo ModerationAction_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(ModerationAction_obj,chatId),HX_("chatId",d3,04,77,b7)},
+ {::hx::fsString,(int)offsetof(ModerationAction_obj,moderateServerId),HX_("moderateServerId",61,cc,27,2c)},
+ {::hx::fsString,(int)offsetof(ModerationAction_obj,timestamp),HX_("timestamp",d6,d4,ce,a5)},
+ {::hx::fsString,(int)offsetof(ModerationAction_obj,moderatorId),HX_("moderatorId",40,4b,8f,97)},
+ {::hx::fsString,(int)offsetof(ModerationAction_obj,reason),HX_("reason",c4,0f,9d,fc)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *ModerationAction_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String ModerationAction_obj_sMemberFields[] = {
+ HX_("chatId",d3,04,77,b7),
+ HX_("moderateServerId",61,cc,27,2c),
+ HX_("timestamp",d6,d4,ce,a5),
+ HX_("moderatorId",40,4b,8f,97),
+ HX_("reason",c4,0f,9d,fc),
+ ::String(null()) };
+
+::hx::Class ModerationAction_obj::__mClass;
+
+void ModerationAction_obj::__register()
+{
+ ModerationAction_obj _hx_dummy;
+ ModerationAction_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.ModerationAction",2d,d0,b4,ae);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(ModerationAction_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< ModerationAction_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = ModerationAction_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = ModerationAction_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/Node.cpp b/Sources/c_snikket/src/snikket/Node.cpp
new file mode 100644
index 0000000..f2dda9c
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/Node.cpp
@@ -0,0 +1,93 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_Node
+#include <snikket/Node.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket_TextNode
+#include <snikket/TextNode.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+namespace snikket{
+
+::snikket::Node Node_obj::CData( ::snikket::TextNode textNode)
+{
+ return ::hx::CreateEnum< Node_obj >(HX_("CData",0d,60,15,c1),1,1)->_hx_init(0,textNode);
+}
+
+::snikket::Node Node_obj::Element( ::snikket::Stanza stanza)
+{
+ return ::hx::CreateEnum< Node_obj >(HX_("Element",9c,d6,a5,d3),0,1)->_hx_init(0,stanza);
+}
+
+bool Node_obj::__GetStatic(const ::String &inName, ::Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ if (inName==HX_("CData",0d,60,15,c1)) { outValue = Node_obj::CData_dyn(); return true; }
+ if (inName==HX_("Element",9c,d6,a5,d3)) { outValue = Node_obj::Element_dyn(); return true; }
+ return super::__GetStatic(inName, outValue, inCallProp);
+}
+
+HX_DEFINE_CREATE_ENUM(Node_obj)
+
+int Node_obj::__FindIndex(::String inName)
+{
+ if (inName==HX_("CData",0d,60,15,c1)) return 1;
+ if (inName==HX_("Element",9c,d6,a5,d3)) return 0;
+ return super::__FindIndex(inName);
+}
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Node_obj,CData,return)
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Node_obj,Element,return)
+
+int Node_obj::__FindArgCount(::String inName)
+{
+ if (inName==HX_("CData",0d,60,15,c1)) return 1;
+ if (inName==HX_("Element",9c,d6,a5,d3)) return 1;
+ return super::__FindArgCount(inName);
+}
+
+::hx::Val Node_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ if (inName==HX_("CData",0d,60,15,c1)) return CData_dyn();
+ if (inName==HX_("Element",9c,d6,a5,d3)) return Element_dyn();
+ return super::__Field(inName,inCallProp);
+}
+
+static ::String Node_obj_sStaticFields[] = {
+ HX_("Element",9c,d6,a5,d3),
+ HX_("CData",0d,60,15,c1),
+ ::String(null())
+};
+
+::hx::Class Node_obj::__mClass;
+
+Dynamic __Create_Node_obj() { return new Node_obj; }
+
+void Node_obj::__register()
+{
+
+::hx::Static(__mClass) = ::hx::_hx_RegisterClass(HX_("snikket.Node",b3,af,c7,53), ::hx::TCanCast< Node_obj >,Node_obj_sStaticFields,0,
+ &__Create_Node_obj, &__Create,
+ &super::__SGetClass(), &CreateNode_obj, 0
+#ifdef HXCPP_VISIT_ALLOCS
+ , 0
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ , 0
+#endif
+);
+ __mClass->mGetStaticField = &Node_obj::__GetStatic;
+}
+
+void Node_obj::__boot()
+{
+}
+
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/Notification.cpp b/Sources/c_snikket/src/snikket/Notification.cpp
new file mode 100644
index 0000000..bd3f9eb
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/Notification.cpp
@@ -0,0 +1,288 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_snikket_ChatAttachment
+#include <snikket/ChatAttachment.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessage
+#include <snikket/ChatMessage.h>
+#endif
+#ifndef INCLUDED_snikket_JID
+#include <snikket/JID.h>
+#endif
+#ifndef INCLUDED_snikket_Notification
+#include <snikket/Notification.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_b0a79cae3ba17812_21_new,"snikket.Notification","new",0x26dbd48e,"snikket.Notification.new","snikket/Notification.hx",21,0x3ec09fc1)
+HX_LOCAL_STACK_FRAME(_hx_pos_b0a79cae3ba17812_35_fromChatMessage,"snikket.Notification","fromChatMessage",0xbfab11b3,"snikket.Notification.fromChatMessage","snikket/Notification.hx",35,0x3ec09fc1)
+HX_LOCAL_STACK_FRAME(_hx_pos_b0a79cae3ba17812_59_fromThinStanza,"snikket.Notification","fromThinStanza",0xff0721ca,"snikket.Notification.fromThinStanza","snikket/Notification.hx",59,0x3ec09fc1)
+namespace snikket{
+
+void Notification_obj::__construct(::String title,::String body,::String accountId,::String chatId,::String messageId,int type,::String callStatus,::String callSid,::String imageUri,::String lang,::String timestamp){
+ HX_STACKFRAME(&_hx_pos_b0a79cae3ba17812_21_new)
+HXLINE( 22) this->title = title;
+HXLINE( 23) this->body = body;
+HXLINE( 24) this->accountId = accountId;
+HXLINE( 25) this->chatId = chatId;
+HXLINE( 26) this->messageId = messageId;
+HXLINE( 27) this->type = type;
+HXLINE( 28) this->callStatus = callStatus;
+HXLINE( 29) this->callSid = callSid;
+HXLINE( 30) this->imageUri = imageUri;
+HXLINE( 31) this->lang = lang;
+HXLINE( 32) this->timestamp = timestamp;
+ }
+
+Dynamic Notification_obj::__CreateEmpty() { return new Notification_obj; }
+
+void *Notification_obj::_hx_vtable = 0;
+
+Dynamic Notification_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Notification_obj > _hx_result = new Notification_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6],inArgs[7],inArgs[8],inArgs[9],inArgs[10]);
+ return _hx_result;
+}
+
+bool Notification_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x778a3c48;
+}
+
+ ::snikket::Notification Notification_obj::fromChatMessage( ::snikket::ChatMessage m){
+ HX_GC_STACKFRAME(&_hx_pos_b0a79cae3ba17812_35_fromChatMessage)
+HXLINE( 36) ::String imageUri = null();
+HXLINE( 37) ::snikket::ChatAttachment attachment = m->attachments->__get(0).StaticCast< ::snikket::ChatAttachment >();
+HXLINE( 38) if (::hx::IsNotNull( attachment )) {
+HXLINE( 39) imageUri = attachment->uris->__get(0);
+ }
+HXLINE( 42) ::String _hx_tmp;
+HXDLIN( 42) if ((m->type == 1)) {
+HXLINE( 42) _hx_tmp = HX_("Incoming Call",18,e2,4d,47);
+ }
+ else {
+HXLINE( 42) _hx_tmp = HX_("New Message",c7,69,0e,bd);
+ }
+HXLINE( 43) ::String m1 = m->text;
+HXLINE( 44) ::String _hx_tmp1 = m->account();
+HXLINE( 45) ::String _hx_tmp2 = m->chatId();
+HXLINE( 46) ::String m2 = m->serverId;
+HXLINE( 47) int m3 = m->type;
+HXLINE( 48) ::String _hx_tmp3 = m->callStatus();
+HXLINE( 49) ::String _hx_tmp4 = m->callSid();
+HXLINE( 41) return ::snikket::Notification_obj::__alloc( HX_CTX ,_hx_tmp,m1,_hx_tmp1,_hx_tmp2,m2,m3,_hx_tmp3,_hx_tmp4,imageUri,m->lang,m->timestamp);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Notification_obj,fromChatMessage,return )
+
+ ::snikket::Notification Notification_obj::fromThinStanza( ::snikket::Stanza stanza){
+ HX_GC_STACKFRAME(&_hx_pos_b0a79cae3ba17812_59_fromThinStanza)
+HXLINE( 62) ::String _hx_tmp = ::snikket::JID_obj::parse(( (::String)(::Reflect_obj::field(stanza->attr,HX_("to",7b,65,00,00))) ))->asBare()->asString();
+HXLINE( 63) ::String _hx_tmp1 = ::snikket::JID_obj::parse(( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) ))->asBare()->asString();
+HXLINE( 59) return ::snikket::Notification_obj::__alloc( HX_CTX ,HX_("New Message",c7,69,0e,bd),HX_("",00,00,00,00),_hx_tmp,_hx_tmp1,stanza->getChildText(HX_("stanza-id",73,8a,54,e9),HX_("urn:xmpp:sid:0",a8,4b,37,54)),0,null(),null(),null(),null(),null());
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Notification_obj,fromThinStanza,return )
+
+
+Notification_obj::Notification_obj()
+{
+}
+
+void Notification_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(Notification);
+ HX_MARK_MEMBER_NAME(title,"title");
+ HX_MARK_MEMBER_NAME(body,"body");
+ HX_MARK_MEMBER_NAME(accountId,"accountId");
+ HX_MARK_MEMBER_NAME(chatId,"chatId");
+ HX_MARK_MEMBER_NAME(messageId,"messageId");
+ HX_MARK_MEMBER_NAME(type,"type");
+ HX_MARK_MEMBER_NAME(callStatus,"callStatus");
+ HX_MARK_MEMBER_NAME(callSid,"callSid");
+ HX_MARK_MEMBER_NAME(imageUri,"imageUri");
+ HX_MARK_MEMBER_NAME(lang,"lang");
+ HX_MARK_MEMBER_NAME(timestamp,"timestamp");
+ HX_MARK_END_CLASS();
+}
+
+void Notification_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(title,"title");
+ HX_VISIT_MEMBER_NAME(body,"body");
+ HX_VISIT_MEMBER_NAME(accountId,"accountId");
+ HX_VISIT_MEMBER_NAME(chatId,"chatId");
+ HX_VISIT_MEMBER_NAME(messageId,"messageId");
+ HX_VISIT_MEMBER_NAME(type,"type");
+ HX_VISIT_MEMBER_NAME(callStatus,"callStatus");
+ HX_VISIT_MEMBER_NAME(callSid,"callSid");
+ HX_VISIT_MEMBER_NAME(imageUri,"imageUri");
+ HX_VISIT_MEMBER_NAME(lang,"lang");
+ HX_VISIT_MEMBER_NAME(timestamp,"timestamp");
+}
+
+::hx::Val Notification_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"body") ) { return ::hx::Val( body ); }
+ if (HX_FIELD_EQ(inName,"type") ) { return ::hx::Val( type ); }
+ if (HX_FIELD_EQ(inName,"lang") ) { return ::hx::Val( lang ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"title") ) { return ::hx::Val( title ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"chatId") ) { return ::hx::Val( chatId ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"callSid") ) { return ::hx::Val( callSid ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"imageUri") ) { return ::hx::Val( imageUri ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"accountId") ) { return ::hx::Val( accountId ); }
+ if (HX_FIELD_EQ(inName,"messageId") ) { return ::hx::Val( messageId ); }
+ if (HX_FIELD_EQ(inName,"timestamp") ) { return ::hx::Val( timestamp ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"callStatus") ) { return ::hx::Val( callStatus ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool Notification_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 14:
+ if (HX_FIELD_EQ(inName,"fromThinStanza") ) { outValue = fromThinStanza_dyn(); return true; }
+ break;
+ case 15:
+ if (HX_FIELD_EQ(inName,"fromChatMessage") ) { outValue = fromChatMessage_dyn(); return true; }
+ }
+ return false;
+}
+
+::hx::Val Notification_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"body") ) { body=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"type") ) { type=inValue.Cast< int >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"lang") ) { lang=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"title") ) { title=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"chatId") ) { chatId=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"callSid") ) { callSid=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"imageUri") ) { imageUri=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"accountId") ) { accountId=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"messageId") ) { messageId=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"timestamp") ) { timestamp=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"callStatus") ) { callStatus=inValue.Cast< ::String >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void Notification_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("title",98,15,3b,10));
+ outFields->push(HX_("body",a2,7a,1b,41));
+ outFields->push(HX_("accountId",e8,81,54,29));
+ outFields->push(HX_("chatId",d3,04,77,b7));
+ outFields->push(HX_("messageId",82,b5,1f,29));
+ outFields->push(HX_("type",ba,f2,08,4d));
+ outFields->push(HX_("callStatus",70,be,2b,31));
+ outFields->push(HX_("callSid",10,f5,53,54));
+ outFields->push(HX_("imageUri",d1,8e,3b,84));
+ outFields->push(HX_("lang",ee,05,ad,47));
+ outFields->push(HX_("timestamp",d6,d4,ce,a5));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Notification_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(Notification_obj,title),HX_("title",98,15,3b,10)},
+ {::hx::fsString,(int)offsetof(Notification_obj,body),HX_("body",a2,7a,1b,41)},
+ {::hx::fsString,(int)offsetof(Notification_obj,accountId),HX_("accountId",e8,81,54,29)},
+ {::hx::fsString,(int)offsetof(Notification_obj,chatId),HX_("chatId",d3,04,77,b7)},
+ {::hx::fsString,(int)offsetof(Notification_obj,messageId),HX_("messageId",82,b5,1f,29)},
+ {::hx::fsInt,(int)offsetof(Notification_obj,type),HX_("type",ba,f2,08,4d)},
+ {::hx::fsString,(int)offsetof(Notification_obj,callStatus),HX_("callStatus",70,be,2b,31)},
+ {::hx::fsString,(int)offsetof(Notification_obj,callSid),HX_("callSid",10,f5,53,54)},
+ {::hx::fsString,(int)offsetof(Notification_obj,imageUri),HX_("imageUri",d1,8e,3b,84)},
+ {::hx::fsString,(int)offsetof(Notification_obj,lang),HX_("lang",ee,05,ad,47)},
+ {::hx::fsString,(int)offsetof(Notification_obj,timestamp),HX_("timestamp",d6,d4,ce,a5)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *Notification_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Notification_obj_sMemberFields[] = {
+ HX_("title",98,15,3b,10),
+ HX_("body",a2,7a,1b,41),
+ HX_("accountId",e8,81,54,29),
+ HX_("chatId",d3,04,77,b7),
+ HX_("messageId",82,b5,1f,29),
+ HX_("type",ba,f2,08,4d),
+ HX_("callStatus",70,be,2b,31),
+ HX_("callSid",10,f5,53,54),
+ HX_("imageUri",d1,8e,3b,84),
+ HX_("lang",ee,05,ad,47),
+ HX_("timestamp",d6,d4,ce,a5),
+ ::String(null()) };
+
+::hx::Class Notification_obj::__mClass;
+
+static ::String Notification_obj_sStaticFields[] = {
+ HX_("fromChatMessage",85,80,96,62),
+ HX_("fromThinStanza",38,f3,72,5a),
+ ::String(null())
+};
+
+void Notification_obj::__register()
+{
+ Notification_obj _hx_dummy;
+ Notification_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.Notification",9c,35,5f,5d);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Notification_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Notification_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Notification_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Notification_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Notification_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Notification_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/Other.cpp b/Sources/c_snikket/src/snikket/Other.cpp
new file mode 100644
index 0000000..21b60e5
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/Other.cpp
@@ -0,0 +1,93 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_Other
+#include <snikket/Other.h>
+#endif
+#ifndef INCLUDED_snikket_Symbol
+#include <snikket/Symbol.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_aac171f877c525f9_146_new,"snikket.Other","new",0xfa8cc871,"snikket.Other.new","snikket/EmojiUtil.hx",146,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_aac171f877c525f9_150_isEmoji,"snikket.Other","isEmoji",0xac43e7cd,"snikket.Other.isEmoji","snikket/EmojiUtil.hx",150,0x30de6948)
+namespace snikket{
+
+void Other_obj::__construct(::Array< int > codepoints){
+ HX_STACKFRAME(&_hx_pos_aac171f877c525f9_146_new)
+HXDLIN( 146) super::__construct(codepoints);
+ }
+
+Dynamic Other_obj::__CreateEmpty() { return new Other_obj; }
+
+void *Other_obj::_hx_vtable = 0;
+
+Dynamic Other_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Other_obj > _hx_result = new Other_obj();
+ _hx_result->__construct(inArgs[0]);
+ return _hx_result;
+}
+
+bool Other_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x0c6697d3) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x0c6697d3;
+ } else {
+ return inClassId==(int)0x4b1860f5;
+ }
+}
+
+bool Other_obj::isEmoji(){
+ HX_STACKFRAME(&_hx_pos_aac171f877c525f9_150_isEmoji)
+HXDLIN( 150) return false;
+ }
+
+
+
+Other_obj::Other_obj()
+{
+}
+
+::hx::Val Other_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 7:
+ if (HX_FIELD_EQ(inName,"isEmoji") ) { return ::hx::Val( isEmoji_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *Other_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *Other_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Other_obj_sMemberFields[] = {
+ HX_("isEmoji",3c,13,5f,0c),
+ ::String(null()) };
+
+::hx::Class Other_obj::__mClass;
+
+void Other_obj::__register()
+{
+ Other_obj _hx_dummy;
+ Other_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.Other",ff,bb,a9,91);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Other_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Other_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Other_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Other_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/Participant.cpp b/Sources/c_snikket/src/snikket/Participant.cpp
new file mode 100644
index 0000000..9746774
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/Participant.cpp
@@ -0,0 +1,215 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_Participant
+#include <snikket/Participant.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_33195ab9b813f4c6_20_new,"snikket.Participant","new",0x30d44414,"snikket.Participant.new","snikket/Participant.hx",20,0x8d2a799d)
+HX_LOCAL_STACK_FRAME(_hx_pos_dd664f1e3e572410_307_displayName__fromC,"snikket.Participant","displayName__fromC",0x32bb7538,"snikket.Participant.displayName__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_dd664f1e3e572410_307_photoUri__fromC,"snikket.Participant","photoUri__fromC",0x51355b93,"snikket.Participant.photoUri__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_dd664f1e3e572410_307_placeholderUri__fromC,"snikket.Participant","placeholderUri__fromC",0x436ea094,"snikket.Participant.placeholderUri__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_dd664f1e3e572410_307_isSelf__fromC,"snikket.Participant","isSelf__fromC",0x5a5f9b57,"snikket.Participant.isSelf__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_33195ab9b813f4c6_13_boot,"snikket.Participant","boot",0x81004dfe,"snikket.Participant.boot","snikket/Participant.hx",13,0x8d2a799d)
+namespace snikket{
+
+void Participant_obj::__construct(::String displayName,::String photoUri,::String placeholderUri,bool isSelf){
+ HX_STACKFRAME(&_hx_pos_33195ab9b813f4c6_20_new)
+HXLINE( 21) this->displayName = displayName;
+HXLINE( 22) this->photoUri = photoUri;
+HXLINE( 23) this->placeholderUri = placeholderUri;
+HXLINE( 24) this->isSelf = isSelf;
+ }
+
+Dynamic Participant_obj::__CreateEmpty() { return new Participant_obj; }
+
+void *Participant_obj::_hx_vtable = 0;
+
+Dynamic Participant_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Participant_obj > _hx_result = new Participant_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2],inArgs[3]);
+ return _hx_result;
+}
+
+bool Participant_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x7d555cf6;
+}
+
+::String Participant_obj::displayName__fromC(){
+ HX_STACKFRAME(&_hx_pos_dd664f1e3e572410_307_displayName__fromC)
+HXDLIN( 307) return this->displayName;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Participant_obj,displayName__fromC,return )
+
+::String Participant_obj::photoUri__fromC(){
+ HX_STACKFRAME(&_hx_pos_dd664f1e3e572410_307_photoUri__fromC)
+HXDLIN( 307) return this->photoUri;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Participant_obj,photoUri__fromC,return )
+
+::String Participant_obj::placeholderUri__fromC(){
+ HX_STACKFRAME(&_hx_pos_dd664f1e3e572410_307_placeholderUri__fromC)
+HXDLIN( 307) return this->placeholderUri;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Participant_obj,placeholderUri__fromC,return )
+
+bool Participant_obj::isSelf__fromC(){
+ HX_STACKFRAME(&_hx_pos_dd664f1e3e572410_307_isSelf__fromC)
+HXDLIN( 307) return this->isSelf;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Participant_obj,isSelf__fromC,return )
+
+
+Participant_obj::Participant_obj()
+{
+}
+
+void Participant_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(Participant);
+ HX_MARK_MEMBER_NAME(displayName,"displayName");
+ HX_MARK_MEMBER_NAME(photoUri,"photoUri");
+ HX_MARK_MEMBER_NAME(placeholderUri,"placeholderUri");
+ HX_MARK_MEMBER_NAME(isSelf,"isSelf");
+ HX_MARK_END_CLASS();
+}
+
+void Participant_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(displayName,"displayName");
+ HX_VISIT_MEMBER_NAME(photoUri,"photoUri");
+ HX_VISIT_MEMBER_NAME(placeholderUri,"placeholderUri");
+ HX_VISIT_MEMBER_NAME(isSelf,"isSelf");
+}
+
+::hx::Val Participant_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 6:
+ if (HX_FIELD_EQ(inName,"isSelf") ) { return ::hx::Val( isSelf ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"photoUri") ) { return ::hx::Val( photoUri ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"displayName") ) { return ::hx::Val( displayName ); }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"isSelf__fromC") ) { return ::hx::Val( isSelf__fromC_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"placeholderUri") ) { return ::hx::Val( placeholderUri ); }
+ break;
+ case 15:
+ if (HX_FIELD_EQ(inName,"photoUri__fromC") ) { return ::hx::Val( photoUri__fromC_dyn() ); }
+ break;
+ case 18:
+ if (HX_FIELD_EQ(inName,"displayName__fromC") ) { return ::hx::Val( displayName__fromC_dyn() ); }
+ break;
+ case 21:
+ if (HX_FIELD_EQ(inName,"placeholderUri__fromC") ) { return ::hx::Val( placeholderUri__fromC_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val Participant_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 6:
+ if (HX_FIELD_EQ(inName,"isSelf") ) { isSelf=inValue.Cast< bool >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"photoUri") ) { photoUri=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"displayName") ) { displayName=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"placeholderUri") ) { placeholderUri=inValue.Cast< ::String >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void Participant_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("displayName",ad,11,f2,30));
+ outFields->push(HX_("photoUri",da,15,82,60));
+ outFields->push(HX_("placeholderUri",b9,d9,ba,ae));
+ outFields->push(HX_("isSelf",96,50,b7,69));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Participant_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(Participant_obj,displayName),HX_("displayName",ad,11,f2,30)},
+ {::hx::fsString,(int)offsetof(Participant_obj,photoUri),HX_("photoUri",da,15,82,60)},
+ {::hx::fsString,(int)offsetof(Participant_obj,placeholderUri),HX_("placeholderUri",b9,d9,ba,ae)},
+ {::hx::fsBool,(int)offsetof(Participant_obj,isSelf),HX_("isSelf",96,50,b7,69)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *Participant_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Participant_obj_sMemberFields[] = {
+ HX_("displayName",ad,11,f2,30),
+ HX_("displayName__fromC",6c,9e,e5,22),
+ HX_("photoUri",da,15,82,60),
+ HX_("photoUri__fromC",df,29,fc,dc),
+ HX_("placeholderUri",b9,d9,ba,ae),
+ HX_("placeholderUri__fromC",e0,2f,a3,85),
+ HX_("isSelf",96,50,b7,69),
+ HX_("isSelf__fromC",a3,fe,4d,03),
+ ::String(null()) };
+
+::hx::Class Participant_obj::__mClass;
+
+void Participant_obj::__register()
+{
+ Participant_obj _hx_dummy;
+ Participant_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.Participant",22,ea,3b,01);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Participant_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Participant_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Participant_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Participant_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void Participant_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_33195ab9b813f4c6_13_boot)
+HXDLIN( 13) __mClass->__meta__ = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("fields",79,8e,8e,80), ::Dynamic(::hx::Anon_obj::Create(4)
+ ->setFixed(0,HX_("placeholderUri__fromC",e0,2f,a3,85), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(1,HX_("photoUri__fromC",df,29,fc,dc), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(2,HX_("isSelf__fromC",a3,fe,4d,03), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(3,HX_("displayName__fromC",6c,9e,e5,22), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null()))))));
+ }
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/Persistence.cpp b/Sources/c_snikket/src/snikket/Persistence.cpp
new file mode 100644
index 0000000..96fdd7c
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/Persistence.cpp
@@ -0,0 +1,80 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_Caps
+#include <snikket/Caps.h>
+#endif
+#ifndef INCLUDED_snikket_Chat
+#include <snikket/Chat.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessage
+#include <snikket/ChatMessage.h>
+#endif
+#ifndef INCLUDED_snikket_Persistence
+#include <snikket/Persistence.h>
+#endif
+#ifndef INCLUDED_snikket_ReactionUpdate
+#include <snikket/ReactionUpdate.h>
+#endif
+#ifndef INCLUDED_snikket_SerializedChat
+#include <snikket/SerializedChat.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_6a657925c17c54af_11_boot,"snikket.Persistence","boot",0xeeb1eed2,"snikket.Persistence.boot","snikket/Persistence.hx",11,0xd1747d71)
+namespace snikket{
+
+
+static ::String Persistence_obj_sMemberFields[] = {
+ HX_("lastId",d1,0b,c5,54),
+ HX_("storeChats",fa,4a,32,83),
+ HX_("getChats",25,ae,8a,a5),
+ HX_("getChatsUnreadDetails",ee,d4,5a,85),
+ HX_("storeReaction",aa,00,75,ab),
+ HX_("storeMessages",cd,f1,bd,e9),
+ HX_("updateMessage",be,9a,7f,65),
+ HX_("updateMessageStatus",90,98,ad,0f),
+ HX_("getMessage",d1,bb,72,e9),
+ HX_("getMessagesBefore",a1,f1,44,11),
+ HX_("getMessagesAfter",3a,43,91,57),
+ HX_("getMessagesAround",6f,95,16,2d),
+ HX_("hasMedia",2a,4f,14,92),
+ HX_("storeMedia",43,b1,3a,43),
+ HX_("removeMedia",00,e2,ef,03),
+ HX_("storeCaps",a2,60,d7,9d),
+ HX_("getCaps",d7,cb,3c,14),
+ HX_("storeLogin",c8,85,72,b6),
+ HX_("getLogin",f3,e8,ca,d8),
+ HX_("removeAccount",c9,58,14,7a),
+ HX_("listAccounts",a4,81,e8,f5),
+ HX_("storeStreamManagement",24,1d,b8,8d),
+ HX_("getStreamManagement",d9,03,ec,6c),
+ HX_("storeService",54,de,f6,9d),
+ HX_("findServicesWithFeature",99,4e,bd,4a),
+ ::String(null()) };
+
+::hx::Class Persistence_obj::__mClass;
+
+void Persistence_obj::__register()
+{
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.Persistence",ce,f9,15,7d);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Persistence_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TIsInterface< (int)0x3e9d59e2 >;
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void Persistence_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_6a657925c17c54af_11_boot)
+HXDLIN( 11) __mClass->__meta__ = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("fields",79,8e,8e,80), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("getChatsUnreadDetails",ee,d4,5a,85), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(1,HX_("findServicesWithFeature",99,4e,bd,4a), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null()))))));
+ }
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/Presence.cpp b/Sources/c_snikket/src/snikket/Presence.cpp
new file mode 100644
index 0000000..40f67fc
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/Presence.cpp
@@ -0,0 +1,143 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_Caps
+#include <snikket/Caps.h>
+#endif
+#ifndef INCLUDED_snikket_Presence
+#include <snikket/Presence.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_75a95b95fe90dc08_8_new,"snikket.Presence","new",0x129c6b5e,"snikket.Presence.new","snikket/Presence.hx",8,0x5c3c1771)
+namespace snikket{
+
+void Presence_obj::__construct( ::snikket::Caps caps, ::snikket::Stanza mucUser){
+ HX_STACKFRAME(&_hx_pos_75a95b95fe90dc08_8_new)
+HXLINE( 9) this->caps = caps;
+HXLINE( 10) this->mucUser = mucUser;
+ }
+
+Dynamic Presence_obj::__CreateEmpty() { return new Presence_obj; }
+
+void *Presence_obj::_hx_vtable = 0;
+
+Dynamic Presence_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Presence_obj > _hx_result = new Presence_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1]);
+ return _hx_result;
+}
+
+bool Presence_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x4c576518;
+}
+
+
+::hx::ObjectPtr< Presence_obj > Presence_obj::__new( ::snikket::Caps caps, ::snikket::Stanza mucUser) {
+ ::hx::ObjectPtr< Presence_obj > __this = new Presence_obj();
+ __this->__construct(caps,mucUser);
+ return __this;
+}
+
+::hx::ObjectPtr< Presence_obj > Presence_obj::__alloc(::hx::Ctx *_hx_ctx, ::snikket::Caps caps, ::snikket::Stanza mucUser) {
+ Presence_obj *__this = (Presence_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Presence_obj), true, "snikket.Presence"));
+ *(void **)__this = Presence_obj::_hx_vtable;
+ __this->__construct(caps,mucUser);
+ return __this;
+}
+
+Presence_obj::Presence_obj()
+{
+}
+
+void Presence_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(Presence);
+ HX_MARK_MEMBER_NAME(caps,"caps");
+ HX_MARK_MEMBER_NAME(mucUser,"mucUser");
+ HX_MARK_END_CLASS();
+}
+
+void Presence_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(caps,"caps");
+ HX_VISIT_MEMBER_NAME(mucUser,"mucUser");
+}
+
+::hx::Val Presence_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"caps") ) { return ::hx::Val( caps ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"mucUser") ) { return ::hx::Val( mucUser ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val Presence_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"caps") ) { caps=inValue.Cast< ::snikket::Caps >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"mucUser") ) { mucUser=inValue.Cast< ::snikket::Stanza >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void Presence_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("caps",21,1c,ba,41));
+ outFields->push(HX_("mucUser",e6,f3,96,b5));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Presence_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::snikket::Caps */ ,(int)offsetof(Presence_obj,caps),HX_("caps",21,1c,ba,41)},
+ {::hx::fsObject /* ::snikket::Stanza */ ,(int)offsetof(Presence_obj,mucUser),HX_("mucUser",e6,f3,96,b5)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *Presence_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Presence_obj_sMemberFields[] = {
+ HX_("caps",21,1c,ba,41),
+ HX_("mucUser",e6,f3,96,b5),
+ ::String(null()) };
+
+::hx::Class Presence_obj::__mClass;
+
+void Presence_obj::__register()
+{
+ Presence_obj _hx_dummy;
+ Presence_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.Presence",6c,24,b8,1b);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Presence_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Presence_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Presence_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Presence_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/PubsubEvent.cpp b/Sources/c_snikket/src/snikket/PubsubEvent.cpp
new file mode 100644
index 0000000..a4b59e5
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/PubsubEvent.cpp
@@ -0,0 +1,234 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_snikket_PubsubEvent
+#include <snikket/PubsubEvent.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_6e534b80cea4fb8b_9_new,"snikket.PubsubEvent","new",0x664bd498,"snikket.PubsubEvent.new","snikket/PubsubEvent.hx",9,0x1bc16599)
+HX_LOCAL_STACK_FRAME(_hx_pos_6e534b80cea4fb8b_28_getFrom,"snikket.PubsubEvent","getFrom",0xb0ffd558,"snikket.PubsubEvent.getFrom","snikket/PubsubEvent.hx",28,0x1bc16599)
+HX_LOCAL_STACK_FRAME(_hx_pos_6e534b80cea4fb8b_32_getNode,"snikket.PubsubEvent","getNode",0xb64739f0,"snikket.PubsubEvent.getNode","snikket/PubsubEvent.hx",32,0x1bc16599)
+HX_LOCAL_STACK_FRAME(_hx_pos_6e534b80cea4fb8b_36_getItems,"snikket.PubsubEvent","getItems",0xea596c52,"snikket.PubsubEvent.getItems","snikket/PubsubEvent.hx",36,0x1bc16599)
+HX_LOCAL_STACK_FRAME(_hx_pos_6e534b80cea4fb8b_16_fromStanza,"snikket.PubsubEvent","fromStanza",0x5f14d5c7,"snikket.PubsubEvent.fromStanza","snikket/PubsubEvent.hx",16,0x1bc16599)
+namespace snikket{
+
+void PubsubEvent_obj::__construct(::String from,::String to,::String node,::Array< ::Dynamic> items){
+ HX_STACKFRAME(&_hx_pos_6e534b80cea4fb8b_9_new)
+HXLINE( 10) this->from = from;
+HXLINE( 11) this->to = to;
+HXLINE( 12) this->node = node;
+HXLINE( 13) this->items = items;
+ }
+
+Dynamic PubsubEvent_obj::__CreateEmpty() { return new PubsubEvent_obj; }
+
+void *PubsubEvent_obj::_hx_vtable = 0;
+
+Dynamic PubsubEvent_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< PubsubEvent_obj > _hx_result = new PubsubEvent_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2],inArgs[3]);
+ return _hx_result;
+}
+
+bool PubsubEvent_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x04e7c6de;
+}
+
+::String PubsubEvent_obj::getFrom(){
+ HX_STACKFRAME(&_hx_pos_6e534b80cea4fb8b_28_getFrom)
+HXDLIN( 28) return this->from;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(PubsubEvent_obj,getFrom,return )
+
+::String PubsubEvent_obj::getNode(){
+ HX_STACKFRAME(&_hx_pos_6e534b80cea4fb8b_32_getNode)
+HXDLIN( 32) return this->node;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(PubsubEvent_obj,getNode,return )
+
+::Array< ::Dynamic> PubsubEvent_obj::getItems(){
+ HX_STACKFRAME(&_hx_pos_6e534b80cea4fb8b_36_getItems)
+HXDLIN( 36) return this->items;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(PubsubEvent_obj,getItems,return )
+
+ ::snikket::PubsubEvent PubsubEvent_obj::fromStanza( ::snikket::Stanza stanza){
+ HX_GC_STACKFRAME(&_hx_pos_6e534b80cea4fb8b_16_fromStanza)
+HXLINE( 17) ::snikket::Stanza event = stanza->getChild(HX_("event",1a,c8,c4,75),HX_("http://jabber.org/protocol/pubsub#event",ae,58,f1,45));
+HXLINE( 18) if (::hx::IsNull( event )) {
+HXLINE( 18) return null();
+ }
+HXLINE( 20) ::snikket::Stanza items = event->getChild(HX_("items",00,ac,0c,c2),null());
+HXLINE( 21) if (::hx::IsNull( items )) {
+HXLINE( 21) return null();
+ }
+HXLINE( 24) ::String _hx_tmp = ( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) );
+HXDLIN( 24) ::String _hx_tmp1 = ( (::String)(::Reflect_obj::field(stanza->attr,HX_("to",7b,65,00,00))) );
+HXDLIN( 24) ::String _hx_tmp2 = ( (::String)(::Reflect_obj::field(items->attr,HX_("node",02,0a,0a,49))) );
+HXDLIN( 24) return ::snikket::PubsubEvent_obj::__alloc( HX_CTX ,_hx_tmp,_hx_tmp1,_hx_tmp2,items->allTags(HX_("item",13,c5,bf,45),null()));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(PubsubEvent_obj,fromStanza,return )
+
+
+::hx::ObjectPtr< PubsubEvent_obj > PubsubEvent_obj::__new(::String from,::String to,::String node,::Array< ::Dynamic> items) {
+ ::hx::ObjectPtr< PubsubEvent_obj > __this = new PubsubEvent_obj();
+ __this->__construct(from,to,node,items);
+ return __this;
+}
+
+::hx::ObjectPtr< PubsubEvent_obj > PubsubEvent_obj::__alloc(::hx::Ctx *_hx_ctx,::String from,::String to,::String node,::Array< ::Dynamic> items) {
+ PubsubEvent_obj *__this = (PubsubEvent_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(PubsubEvent_obj), true, "snikket.PubsubEvent"));
+ *(void **)__this = PubsubEvent_obj::_hx_vtable;
+ __this->__construct(from,to,node,items);
+ return __this;
+}
+
+PubsubEvent_obj::PubsubEvent_obj()
+{
+}
+
+void PubsubEvent_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(PubsubEvent);
+ HX_MARK_MEMBER_NAME(from,"from");
+ HX_MARK_MEMBER_NAME(to,"to");
+ HX_MARK_MEMBER_NAME(node,"node");
+ HX_MARK_MEMBER_NAME(items,"items");
+ HX_MARK_END_CLASS();
+}
+
+void PubsubEvent_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(from,"from");
+ HX_VISIT_MEMBER_NAME(to,"to");
+ HX_VISIT_MEMBER_NAME(node,"node");
+ HX_VISIT_MEMBER_NAME(items,"items");
+}
+
+::hx::Val PubsubEvent_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 2:
+ if (HX_FIELD_EQ(inName,"to") ) { return ::hx::Val( to ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"from") ) { return ::hx::Val( from ); }
+ if (HX_FIELD_EQ(inName,"node") ) { return ::hx::Val( node ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"items") ) { return ::hx::Val( items ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"getFrom") ) { return ::hx::Val( getFrom_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getNode") ) { return ::hx::Val( getNode_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"getItems") ) { return ::hx::Val( getItems_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool PubsubEvent_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 10:
+ if (HX_FIELD_EQ(inName,"fromStanza") ) { outValue = fromStanza_dyn(); return true; }
+ }
+ return false;
+}
+
+::hx::Val PubsubEvent_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 2:
+ if (HX_FIELD_EQ(inName,"to") ) { to=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"from") ) { from=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"node") ) { node=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"items") ) { items=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void PubsubEvent_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("from",6a,a5,c2,43));
+ outFields->push(HX_("to",7b,65,00,00));
+ outFields->push(HX_("node",02,0a,0a,49));
+ outFields->push(HX_("items",00,ac,0c,c2));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo PubsubEvent_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(PubsubEvent_obj,from),HX_("from",6a,a5,c2,43)},
+ {::hx::fsString,(int)offsetof(PubsubEvent_obj,to),HX_("to",7b,65,00,00)},
+ {::hx::fsString,(int)offsetof(PubsubEvent_obj,node),HX_("node",02,0a,0a,49)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(PubsubEvent_obj,items),HX_("items",00,ac,0c,c2)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *PubsubEvent_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String PubsubEvent_obj_sMemberFields[] = {
+ HX_("from",6a,a5,c2,43),
+ HX_("to",7b,65,00,00),
+ HX_("node",02,0a,0a,49),
+ HX_("items",00,ac,0c,c2),
+ HX_("getFrom",20,55,45,16),
+ HX_("getNode",b8,b9,8c,1b),
+ HX_("getItems",8a,bb,e3,21),
+ ::String(null()) };
+
+::hx::Class PubsubEvent_obj::__mClass;
+
+static ::String PubsubEvent_obj_sStaticFields[] = {
+ HX_("fromStanza",ff,62,3b,49),
+ ::String(null())
+};
+
+void PubsubEvent_obj::__register()
+{
+ PubsubEvent_obj _hx_dummy;
+ PubsubEvent_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.PubsubEvent",a6,e8,f7,74);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &PubsubEvent_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(PubsubEvent_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(PubsubEvent_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< PubsubEvent_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = PubsubEvent_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = PubsubEvent_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/Reaction.cpp b/Sources/c_snikket/src/snikket/Reaction.cpp
new file mode 100644
index 0000000..71a96ef
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/Reaction.cpp
@@ -0,0 +1,277 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_StringTools
+#include <StringTools.h>
+#endif
+#ifndef INCLUDED_snikket_Reaction
+#include <snikket/Reaction.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_0c571df6f15c506b_23_new,"snikket.Reaction","new",0x5f7c4fcc,"snikket.Reaction.new","snikket/Reaction.hx",23,0x19ff1ac3)
+HX_LOCAL_STACK_FRAME(_hx_pos_c56bcd6450319fb4_307_senderId__fromC,"snikket.Reaction","senderId__fromC",0x31e900f5,"snikket.Reaction.senderId__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_c56bcd6450319fb4_307_timestamp__fromC,"snikket.Reaction","timestamp__fromC",0x3cdecf77,"snikket.Reaction.timestamp__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_c56bcd6450319fb4_307_text__fromC,"snikket.Reaction","text__fromC",0x07330ed8,"snikket.Reaction.text__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_c56bcd6450319fb4_307_key__fromC,"snikket.Reaction","key__fromC",0x8fe06ece,"snikket.Reaction.key__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_c56bcd6450319fb4_307_envelopeId__fromC,"snikket.Reaction","envelopeId__fromC",0x1c2ed93a,"snikket.Reaction.envelopeId__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_0c571df6f15c506b_33_render,"snikket.Reaction","render",0xc87d576a,"snikket.Reaction.render","snikket/Reaction.hx",33,0x19ff1ac3)
+HX_LOCAL_STACK_FRAME(_hx_pos_0c571df6f15c506b_15_boot,"snikket.Reaction","boot",0x25628346,"snikket.Reaction.boot","snikket/Reaction.hx",15,0x19ff1ac3)
+namespace snikket{
+
+void Reaction_obj::__construct(::String senderId,::String timestamp,::String text,::String envelopeId,::String key){
+ HX_STACKFRAME(&_hx_pos_0c571df6f15c506b_23_new)
+HXLINE( 24) this->senderId = senderId;
+HXLINE( 25) this->timestamp = timestamp;
+HXLINE( 26) this->text = ::StringTools_obj::replace(text,HX_W(u"\ufe0f",fb86,00b5),HX_("",00,00,00,00));
+HXLINE( 27) this->envelopeId = envelopeId;
+HXLINE( 28) ::String tmp = key;
+HXDLIN( 28) ::String _hx_tmp;
+HXDLIN( 28) if (::hx::IsNotNull( tmp )) {
+HXLINE( 28) _hx_tmp = tmp;
+ }
+ else {
+HXLINE( 28) _hx_tmp = this->text;
+ }
+HXDLIN( 28) this->key = _hx_tmp;
+ }
+
+Dynamic Reaction_obj::__CreateEmpty() { return new Reaction_obj; }
+
+void *Reaction_obj::_hx_vtable = 0;
+
+Dynamic Reaction_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Reaction_obj > _hx_result = new Reaction_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4]);
+ return _hx_result;
+}
+
+bool Reaction_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x7f8e2b4a;
+}
+
+::String Reaction_obj::senderId__fromC(){
+ HX_STACKFRAME(&_hx_pos_c56bcd6450319fb4_307_senderId__fromC)
+HXDLIN( 307) return this->senderId;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Reaction_obj,senderId__fromC,return )
+
+::String Reaction_obj::timestamp__fromC(){
+ HX_STACKFRAME(&_hx_pos_c56bcd6450319fb4_307_timestamp__fromC)
+HXDLIN( 307) return this->timestamp;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Reaction_obj,timestamp__fromC,return )
+
+::String Reaction_obj::text__fromC(){
+ HX_STACKFRAME(&_hx_pos_c56bcd6450319fb4_307_text__fromC)
+HXDLIN( 307) return this->text;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Reaction_obj,text__fromC,return )
+
+::String Reaction_obj::key__fromC(){
+ HX_STACKFRAME(&_hx_pos_c56bcd6450319fb4_307_key__fromC)
+HXDLIN( 307) return this->key;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Reaction_obj,key__fromC,return )
+
+::String Reaction_obj::envelopeId__fromC(){
+ HX_STACKFRAME(&_hx_pos_c56bcd6450319fb4_307_envelopeId__fromC)
+HXDLIN( 307) return this->envelopeId;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Reaction_obj,envelopeId__fromC,return )
+
+ ::Dynamic Reaction_obj::render( ::Dynamic forText, ::Dynamic forImage){
+ HX_STACKFRAME(&_hx_pos_0c571df6f15c506b_33_render)
+HXDLIN( 33) return forText((this->text + HX_W(u"\ufe0f",fb86,00b5)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Reaction_obj,render,return )
+
+
+::hx::ObjectPtr< Reaction_obj > Reaction_obj::__new(::String senderId,::String timestamp,::String text,::String envelopeId,::String key) {
+ ::hx::ObjectPtr< Reaction_obj > __this = new Reaction_obj();
+ __this->__construct(senderId,timestamp,text,envelopeId,key);
+ return __this;
+}
+
+::hx::ObjectPtr< Reaction_obj > Reaction_obj::__alloc(::hx::Ctx *_hx_ctx,::String senderId,::String timestamp,::String text,::String envelopeId,::String key) {
+ Reaction_obj *__this = (Reaction_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Reaction_obj), true, "snikket.Reaction"));
+ *(void **)__this = Reaction_obj::_hx_vtable;
+ __this->__construct(senderId,timestamp,text,envelopeId,key);
+ return __this;
+}
+
+Reaction_obj::Reaction_obj()
+{
+}
+
+void Reaction_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(Reaction);
+ HX_MARK_MEMBER_NAME(senderId,"senderId");
+ HX_MARK_MEMBER_NAME(timestamp,"timestamp");
+ HX_MARK_MEMBER_NAME(text,"text");
+ HX_MARK_MEMBER_NAME(key,"key");
+ HX_MARK_MEMBER_NAME(envelopeId,"envelopeId");
+ HX_MARK_END_CLASS();
+}
+
+void Reaction_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(senderId,"senderId");
+ HX_VISIT_MEMBER_NAME(timestamp,"timestamp");
+ HX_VISIT_MEMBER_NAME(text,"text");
+ HX_VISIT_MEMBER_NAME(key,"key");
+ HX_VISIT_MEMBER_NAME(envelopeId,"envelopeId");
+}
+
+::hx::Val Reaction_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"key") ) { return ::hx::Val( key ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"text") ) { return ::hx::Val( text ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"render") ) { return ::hx::Val( render_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"senderId") ) { return ::hx::Val( senderId ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"timestamp") ) { return ::hx::Val( timestamp ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"key__fromC") ) { return ::hx::Val( key__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"envelopeId") ) { return ::hx::Val( envelopeId ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"text__fromC") ) { return ::hx::Val( text__fromC_dyn() ); }
+ break;
+ case 15:
+ if (HX_FIELD_EQ(inName,"senderId__fromC") ) { return ::hx::Val( senderId__fromC_dyn() ); }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"timestamp__fromC") ) { return ::hx::Val( timestamp__fromC_dyn() ); }
+ break;
+ case 17:
+ if (HX_FIELD_EQ(inName,"envelopeId__fromC") ) { return ::hx::Val( envelopeId__fromC_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val Reaction_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"key") ) { key=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"text") ) { text=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"senderId") ) { senderId=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"timestamp") ) { timestamp=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"envelopeId") ) { envelopeId=inValue.Cast< ::String >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void Reaction_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("senderId",f0,1e,0e,ec));
+ outFields->push(HX_("timestamp",d6,d4,ce,a5));
+ outFields->push(HX_("text",ad,cc,f9,4c));
+ outFields->push(HX_("key",9f,89,51,00));
+ outFields->push(HX_("envelopeId",0b,03,af,a8));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Reaction_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(Reaction_obj,senderId),HX_("senderId",f0,1e,0e,ec)},
+ {::hx::fsString,(int)offsetof(Reaction_obj,timestamp),HX_("timestamp",d6,d4,ce,a5)},
+ {::hx::fsString,(int)offsetof(Reaction_obj,text),HX_("text",ad,cc,f9,4c)},
+ {::hx::fsString,(int)offsetof(Reaction_obj,key),HX_("key",9f,89,51,00)},
+ {::hx::fsString,(int)offsetof(Reaction_obj,envelopeId),HX_("envelopeId",0b,03,af,a8)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *Reaction_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Reaction_obj_sMemberFields[] = {
+ HX_("senderId",f0,1e,0e,ec),
+ HX_("senderId__fromC",89,0f,49,cb),
+ HX_("timestamp",d6,d4,ce,a5),
+ HX_("timestamp__fromC",63,82,8b,d7),
+ HX_("text",ad,cc,f9,4c),
+ HX_("text__fromC",6c,43,1b,7f),
+ HX_("key",9f,89,51,00),
+ HX_("key__fromC",ba,e8,22,12),
+ HX_("envelopeId",0b,03,af,a8),
+ HX_("envelopeId__fromC",ce,b4,9e,d8),
+ HX_("render",56,6b,29,05),
+ ::String(null()) };
+
+::hx::Class Reaction_obj::__mClass;
+
+void Reaction_obj::__register()
+{
+ Reaction_obj _hx_dummy;
+ Reaction_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.Reaction",da,b9,95,ab);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Reaction_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Reaction_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Reaction_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Reaction_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void Reaction_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_0c571df6f15c506b_15_boot)
+HXDLIN( 15) __mClass->__meta__ = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("fields",79,8e,8e,80), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("senderId__fromC",89,0f,49,cb), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(1,HX_("timestamp__fromC",63,82,8b,d7), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(2,HX_("envelopeId__fromC",ce,b4,9e,d8), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(3,HX_("key__fromC",ba,e8,22,12), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(4,HX_("text__fromC",6c,43,1b,7f), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null()))))));
+ }
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/ReactionUpdate.cpp b/Sources/c_snikket/src/snikket/ReactionUpdate.cpp
new file mode 100644
index 0000000..9a69145
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/ReactionUpdate.cpp
@@ -0,0 +1,413 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Lambda
+#include <Lambda.h>
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_StringMap
+#include <haxe/ds/StringMap.h>
+#endif
+#ifndef INCLUDED_snikket_CustomEmojiReaction
+#include <snikket/CustomEmojiReaction.h>
+#endif
+#ifndef INCLUDED_snikket_Hash
+#include <snikket/Hash.h>
+#endif
+#ifndef INCLUDED_snikket_Reaction
+#include <snikket/Reaction.h>
+#endif
+#ifndef INCLUDED_snikket_ReactionUpdate
+#include <snikket/ReactionUpdate.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket__Util_Util_Fields_
+#include <snikket/_Util/Util_Fields_.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_e489f3454bf66450_25_new,"snikket.ReactionUpdate","new",0x3406b1f5,"snikket.ReactionUpdate.new","snikket/ReactionUpdate.hx",25,0x80d471fa)
+HX_LOCAL_STACK_FRAME(_hx_pos_e489f3454bf66450_39_getReactions,"snikket.ReactionUpdate","getReactions",0x1bad2cff,"snikket.ReactionUpdate.getReactions","snikket/ReactionUpdate.hx",39,0x80d471fa)
+HX_LOCAL_STACK_FRAME(_hx_pos_e489f3454bf66450_67_inlineHashReferences,"snikket.ReactionUpdate","inlineHashReferences",0x288d7aba,"snikket.ReactionUpdate.inlineHashReferences","snikket/ReactionUpdate.hx",67,0x80d471fa)
+HX_LOCAL_STACK_FRAME(_hx_pos_e489f3454bf66450_82_asStanza,"snikket.ReactionUpdate","asStanza",0x9b37aad2,"snikket.ReactionUpdate.asStanza","snikket/ReactionUpdate.hx",82,0x80d471fa)
+namespace snikket{
+
+void ReactionUpdate_obj::__construct(::String updateId,::String serverId,::String serverIdBy,::String localId,::String chatId,::String senderId,::String timestamp,::Array< ::Dynamic> reactions,int kind){
+ HX_STACKFRAME(&_hx_pos_e489f3454bf66450_25_new)
+HXLINE( 26) bool _hx_tmp;
+HXDLIN( 26) if (::hx::IsNull( serverId )) {
+HXLINE( 26) _hx_tmp = ::hx::IsNull( localId );
+ }
+ else {
+HXLINE( 26) _hx_tmp = false;
+ }
+HXDLIN( 26) if (_hx_tmp) {
+HXLINE( 26) HX_STACK_DO_THROW(HX_("ReactionUpdate serverId and localId cannot both be null",6b,73,a4,c0));
+ }
+HXLINE( 27) bool _hx_tmp1;
+HXDLIN( 27) if (::hx::IsNotNull( serverId )) {
+HXLINE( 27) _hx_tmp1 = ::hx::IsNull( serverIdBy );
+ }
+ else {
+HXLINE( 27) _hx_tmp1 = false;
+ }
+HXDLIN( 27) if (_hx_tmp1) {
+HXLINE( 27) HX_STACK_DO_THROW(HX_("serverId requires serverIdBy",c5,30,61,d4));
+ }
+HXLINE( 28) this->updateId = updateId;
+HXLINE( 29) this->serverId = serverId;
+HXLINE( 30) this->serverIdBy = serverIdBy;
+HXLINE( 31) this->localId = localId;
+HXLINE( 32) this->chatId = chatId;
+HXLINE( 33) this->senderId = senderId;
+HXLINE( 34) this->timestamp = timestamp;
+HXLINE( 35) this->reactions = reactions;
+HXLINE( 36) this->kind = kind;
+ }
+
+Dynamic ReactionUpdate_obj::__CreateEmpty() { return new ReactionUpdate_obj; }
+
+void *ReactionUpdate_obj::_hx_vtable = 0;
+
+Dynamic ReactionUpdate_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< ReactionUpdate_obj > _hx_result = new ReactionUpdate_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6],inArgs[7],inArgs[8]);
+ return _hx_result;
+}
+
+bool ReactionUpdate_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x71029d2f;
+}
+
+::Array< ::Dynamic> ReactionUpdate_obj::getReactions(::Array< ::Dynamic> existingReactions){
+ HX_GC_STACKFRAME(&_hx_pos_e489f3454bf66450_39_getReactions)
+HXLINE( 40) if ((this->kind == 1)) {
+HXLINE( 41) ::haxe::ds::StringMap set = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXLINE( 42) ::Array< ::Dynamic> list = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 43) {
+HXLINE( 43) int _g = 0;
+HXDLIN( 43) ::Array< ::Dynamic> _g1;
+HXDLIN( 43) ::Array< ::Dynamic> tmp = existingReactions;
+HXDLIN( 43) if (::hx::IsNotNull( tmp )) {
+HXLINE( 43) _g1 = tmp;
+ }
+ else {
+HXLINE( 43) _g1 = ::Array_obj< ::Dynamic>::__new(0);
+ }
+HXDLIN( 43) while((_g < _g1->length)){
+HXLINE( 43) ::snikket::Reaction r = _g1->__get(_g).StaticCast< ::snikket::Reaction >();
+HXDLIN( 43) _g = (_g + 1);
+HXLINE( 44) if (!(set->exists(r->key))) {
+HXLINE( 44) list->push(r);
+ }
+HXLINE( 45) set->set(r->key,true);
+ }
+ }
+HXLINE( 47) {
+HXLINE( 47) int _g2 = 0;
+HXDLIN( 47) ::Array< ::Dynamic> _g3 = this->reactions;
+HXDLIN( 47) while((_g2 < _g3->length)){
+HXLINE( 47) ::snikket::Reaction r1 = _g3->__get(_g2).StaticCast< ::snikket::Reaction >();
+HXDLIN( 47) _g2 = (_g2 + 1);
+HXLINE( 48) if (!(set->exists(r1->key))) {
+HXLINE( 48) list->push(r1);
+ }
+HXLINE( 49) set->set(r1->key,true);
+ }
+ }
+HXLINE( 51) return list;
+ }
+ else {
+HXLINE( 52) if ((this->kind == 0)) {
+HXLINE( 54) ::Array< ::Dynamic> list1 = ::Lambda_obj::array(this->reactions);
+HXLINE( 55) {
+HXLINE( 55) int _g4 = 0;
+HXDLIN( 55) ::Array< ::Dynamic> _g5;
+HXDLIN( 55) ::Array< ::Dynamic> tmp1 = existingReactions;
+HXDLIN( 55) if (::hx::IsNotNull( tmp1 )) {
+HXLINE( 55) _g5 = tmp1;
+ }
+ else {
+HXLINE( 55) _g5 = ::Array_obj< ::Dynamic>::__new(0);
+ }
+HXDLIN( 55) while((_g4 < _g5->length)){
+HXLINE( 55) ::snikket::Reaction r2 = _g5->__get(_g4).StaticCast< ::snikket::Reaction >();
+HXDLIN( 55) _g4 = (_g4 + 1);
+HXLINE( 56) ::snikket::CustomEmojiReaction custom = ( ( ::snikket::CustomEmojiReaction)(::snikket::_Util::Util_Fields__obj::downcast(r2,::hx::ClassOf< ::snikket::CustomEmojiReaction >())) );
+HXLINE( 57) if (::hx::IsNotNull( custom )) {
+HXLINE( 57) list1->push(custom);
+ }
+ }
+ }
+HXLINE( 59) return list1;
+ }
+ else {
+HXLINE( 60) if ((this->kind == 2)) {
+HXLINE( 61) return this->reactions;
+ }
+ }
+ }
+HXLINE( 63) HX_STACK_DO_THROW(HX_("Unknown kind of reaction update",2d,19,e6,bc));
+HXDLIN( 63) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(ReactionUpdate_obj,getReactions,return )
+
+::Array< ::Dynamic> ReactionUpdate_obj::inlineHashReferences(){
+ HX_STACKFRAME(&_hx_pos_e489f3454bf66450_67_inlineHashReferences)
+HXLINE( 68) ::Array< ::Dynamic> hashes = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 69) {
+HXLINE( 69) int _g = 0;
+HXDLIN( 69) ::Array< ::Dynamic> _g1 = this->reactions;
+HXDLIN( 69) while((_g < _g1->length)){
+HXLINE( 69) ::snikket::Reaction r = _g1->__get(_g).StaticCast< ::snikket::Reaction >();
+HXDLIN( 69) _g = (_g + 1);
+HXLINE( 70) ::snikket::CustomEmojiReaction custom = ( ( ::snikket::CustomEmojiReaction)(::snikket::_Util::Util_Fields__obj::downcast(r,::hx::ClassOf< ::snikket::CustomEmojiReaction >())) );
+HXLINE( 71) if (::hx::IsNotNull( custom )) {
+HXLINE( 72) ::snikket::Hash hash = ::snikket::Hash_obj::fromUri(custom->uri);
+HXLINE( 73) if (::hx::IsNotNull( hash )) {
+HXLINE( 73) hashes->push(hash);
+ }
+ }
+ }
+ }
+HXLINE( 76) return hashes;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ReactionUpdate_obj,inlineHashReferences,return )
+
+ ::snikket::Stanza ReactionUpdate_obj::asStanza(){
+ HX_GC_STACKFRAME(&_hx_pos_e489f3454bf66450_82_asStanza)
+HXLINE( 83) if ((this->kind != 0)) {
+HXLINE( 83) HX_STACK_DO_THROW(HX_("Cannot make a reaction XEP stanza for this kind",d4,3c,65,53));
+ }
+HXLINE( 85) ::String attrs;
+HXDLIN( 85) if (::hx::IsNull( this->serverId )) {
+HXLINE( 85) attrs = HX_("chat",d8,5e,bf,41);
+ }
+ else {
+HXLINE( 85) attrs = HX_("groupchat",97,1d,c8,e5);
+ }
+HXDLIN( 85) ::Dynamic attrs1 = ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("id",db,5b,00,00),this->updateId)
+ ->setFixed(1,HX_("type",ba,f2,08,4d),attrs));
+HXLINE( 86) ::snikket::Stanza stanza = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("message",c7,35,11,9a),attrs1);
+HXLINE( 88) ::String tmp = this->localId;
+HXDLIN( 88) ::String _hx_tmp;
+HXDLIN( 88) if (::hx::IsNotNull( tmp )) {
+HXLINE( 88) _hx_tmp = tmp;
+ }
+ else {
+HXLINE( 88) _hx_tmp = this->serverId;
+ }
+HXDLIN( 88) stanza->tag(HX_("reactions",aa,cc,95,e7), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("id",db,5b,00,00),_hx_tmp)
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:reactions:0",44,fb,42,53))));
+HXLINE( 89) {
+HXLINE( 89) int _g = 0;
+HXDLIN( 89) ::Array< ::Dynamic> _g1 = this->reactions;
+HXDLIN( 89) while((_g < _g1->length)){
+HXLINE( 89) ::snikket::Reaction reaction = _g1->__get(_g).StaticCast< ::snikket::Reaction >();
+HXDLIN( 89) _g = (_g + 1);
+HXLINE( 90) if (!(::Std_obj::isOfType(reaction,::hx::ClassOf< ::snikket::CustomEmojiReaction >()))) {
+HXLINE( 90) stanza->textTag(HX_("reaction",a9,e7,b4,f6),reaction->text,null());
+ }
+ }
+ }
+HXLINE( 92) stanza->up();
+HXLINE( 94) return stanza;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ReactionUpdate_obj,asStanza,return )
+
+
+::hx::ObjectPtr< ReactionUpdate_obj > ReactionUpdate_obj::__new(::String updateId,::String serverId,::String serverIdBy,::String localId,::String chatId,::String senderId,::String timestamp,::Array< ::Dynamic> reactions,int kind) {
+ ::hx::ObjectPtr< ReactionUpdate_obj > __this = new ReactionUpdate_obj();
+ __this->__construct(updateId,serverId,serverIdBy,localId,chatId,senderId,timestamp,reactions,kind);
+ return __this;
+}
+
+::hx::ObjectPtr< ReactionUpdate_obj > ReactionUpdate_obj::__alloc(::hx::Ctx *_hx_ctx,::String updateId,::String serverId,::String serverIdBy,::String localId,::String chatId,::String senderId,::String timestamp,::Array< ::Dynamic> reactions,int kind) {
+ ReactionUpdate_obj *__this = (ReactionUpdate_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(ReactionUpdate_obj), true, "snikket.ReactionUpdate"));
+ *(void **)__this = ReactionUpdate_obj::_hx_vtable;
+ __this->__construct(updateId,serverId,serverIdBy,localId,chatId,senderId,timestamp,reactions,kind);
+ return __this;
+}
+
+ReactionUpdate_obj::ReactionUpdate_obj()
+{
+}
+
+void ReactionUpdate_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(ReactionUpdate);
+ HX_MARK_MEMBER_NAME(updateId,"updateId");
+ HX_MARK_MEMBER_NAME(serverId,"serverId");
+ HX_MARK_MEMBER_NAME(serverIdBy,"serverIdBy");
+ HX_MARK_MEMBER_NAME(localId,"localId");
+ HX_MARK_MEMBER_NAME(chatId,"chatId");
+ HX_MARK_MEMBER_NAME(senderId,"senderId");
+ HX_MARK_MEMBER_NAME(timestamp,"timestamp");
+ HX_MARK_MEMBER_NAME(reactions,"reactions");
+ HX_MARK_MEMBER_NAME(kind,"kind");
+ HX_MARK_END_CLASS();
+}
+
+void ReactionUpdate_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(updateId,"updateId");
+ HX_VISIT_MEMBER_NAME(serverId,"serverId");
+ HX_VISIT_MEMBER_NAME(serverIdBy,"serverIdBy");
+ HX_VISIT_MEMBER_NAME(localId,"localId");
+ HX_VISIT_MEMBER_NAME(chatId,"chatId");
+ HX_VISIT_MEMBER_NAME(senderId,"senderId");
+ HX_VISIT_MEMBER_NAME(timestamp,"timestamp");
+ HX_VISIT_MEMBER_NAME(reactions,"reactions");
+ HX_VISIT_MEMBER_NAME(kind,"kind");
+}
+
+::hx::Val ReactionUpdate_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"kind") ) { return ::hx::Val( kind ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"chatId") ) { return ::hx::Val( chatId ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"localId") ) { return ::hx::Val( localId ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"updateId") ) { return ::hx::Val( updateId ); }
+ if (HX_FIELD_EQ(inName,"serverId") ) { return ::hx::Val( serverId ); }
+ if (HX_FIELD_EQ(inName,"senderId") ) { return ::hx::Val( senderId ); }
+ if (HX_FIELD_EQ(inName,"asStanza") ) { return ::hx::Val( asStanza_dyn() ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"timestamp") ) { return ::hx::Val( timestamp ); }
+ if (HX_FIELD_EQ(inName,"reactions") ) { return ::hx::Val( reactions ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"serverIdBy") ) { return ::hx::Val( serverIdBy ); }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"getReactions") ) { return ::hx::Val( getReactions_dyn() ); }
+ break;
+ case 20:
+ if (HX_FIELD_EQ(inName,"inlineHashReferences") ) { return ::hx::Val( inlineHashReferences_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val ReactionUpdate_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"kind") ) { kind=inValue.Cast< int >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"chatId") ) { chatId=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"localId") ) { localId=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"updateId") ) { updateId=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"serverId") ) { serverId=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"senderId") ) { senderId=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"timestamp") ) { timestamp=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"reactions") ) { reactions=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"serverIdBy") ) { serverIdBy=inValue.Cast< ::String >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void ReactionUpdate_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("updateId",44,1a,fa,77));
+ outFields->push(HX_("serverId",7e,01,b2,e2));
+ outFields->push(HX_("serverIdBy",f5,16,54,74));
+ outFields->push(HX_("localId",26,7a,c6,2d));
+ outFields->push(HX_("chatId",d3,04,77,b7));
+ outFields->push(HX_("senderId",f0,1e,0e,ec));
+ outFields->push(HX_("timestamp",d6,d4,ce,a5));
+ outFields->push(HX_("reactions",aa,cc,95,e7));
+ outFields->push(HX_("kind",54,e1,09,47));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo ReactionUpdate_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(ReactionUpdate_obj,updateId),HX_("updateId",44,1a,fa,77)},
+ {::hx::fsString,(int)offsetof(ReactionUpdate_obj,serverId),HX_("serverId",7e,01,b2,e2)},
+ {::hx::fsString,(int)offsetof(ReactionUpdate_obj,serverIdBy),HX_("serverIdBy",f5,16,54,74)},
+ {::hx::fsString,(int)offsetof(ReactionUpdate_obj,localId),HX_("localId",26,7a,c6,2d)},
+ {::hx::fsString,(int)offsetof(ReactionUpdate_obj,chatId),HX_("chatId",d3,04,77,b7)},
+ {::hx::fsString,(int)offsetof(ReactionUpdate_obj,senderId),HX_("senderId",f0,1e,0e,ec)},
+ {::hx::fsString,(int)offsetof(ReactionUpdate_obj,timestamp),HX_("timestamp",d6,d4,ce,a5)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(ReactionUpdate_obj,reactions),HX_("reactions",aa,cc,95,e7)},
+ {::hx::fsInt,(int)offsetof(ReactionUpdate_obj,kind),HX_("kind",54,e1,09,47)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *ReactionUpdate_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String ReactionUpdate_obj_sMemberFields[] = {
+ HX_("updateId",44,1a,fa,77),
+ HX_("serverId",7e,01,b2,e2),
+ HX_("serverIdBy",f5,16,54,74),
+ HX_("localId",26,7a,c6,2d),
+ HX_("chatId",d3,04,77,b7),
+ HX_("senderId",f0,1e,0e,ec),
+ HX_("timestamp",d6,d4,ce,a5),
+ HX_("reactions",aa,cc,95,e7),
+ HX_("kind",54,e1,09,47),
+ HX_("getReactions",34,69,ec,f6),
+ HX_("inlineHashReferences",ef,73,63,1b),
+ HX_("asStanza",87,68,cd,94),
+ ::String(null()) };
+
+::hx::Class ReactionUpdate_obj::__mClass;
+
+void ReactionUpdate_obj::__register()
+{
+ ReactionUpdate_obj _hx_dummy;
+ ReactionUpdate_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.ReactionUpdate",83,93,07,31);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(ReactionUpdate_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< ReactionUpdate_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = ReactionUpdate_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = ReactionUpdate_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/SerializedChat.cpp b/Sources/c_snikket/src/snikket/SerializedChat.cpp
new file mode 100644
index 0000000..e41d502
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/SerializedChat.cpp
@@ -0,0 +1,424 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Xml
+#include <Xml.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_Log
+#include <haxe/Log.h>
+#endif
+#ifndef INCLUDED_haxe_ds_StringMap
+#include <haxe/ds/StringMap.h>
+#endif
+#ifndef INCLUDED_snikket_Caps
+#include <snikket/Caps.h>
+#endif
+#ifndef INCLUDED_snikket_Channel
+#include <snikket/Channel.h>
+#endif
+#ifndef INCLUDED_snikket_Chat
+#include <snikket/Chat.h>
+#endif
+#ifndef INCLUDED_snikket_Client
+#include <snikket/Client.h>
+#endif
+#ifndef INCLUDED_snikket_DirectChat
+#include <snikket/DirectChat.h>
+#endif
+#ifndef INCLUDED_snikket_EventEmitter
+#include <snikket/EventEmitter.h>
+#endif
+#ifndef INCLUDED_snikket_GenericStream
+#include <snikket/GenericStream.h>
+#endif
+#ifndef INCLUDED_snikket_Identity
+#include <snikket/Identity.h>
+#endif
+#ifndef INCLUDED_snikket_Persistence
+#include <snikket/Persistence.h>
+#endif
+#ifndef INCLUDED_snikket_Presence
+#include <snikket/Presence.h>
+#endif
+#ifndef INCLUDED_snikket_SerializedChat
+#include <snikket/SerializedChat.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_59459d97d9a61381_1572_new,"snikket.SerializedChat","new",0xcbfecbdf,"snikket.SerializedChat.new","snikket/Chat.hx",1572,0x18616bf4)
+HX_LOCAL_STACK_FRAME(_hx_pos_59459d97d9a61381_1590_toChat,"snikket.SerializedChat","toChat",0x0e8ec7d4,"snikket.SerializedChat.toChat","snikket/Chat.hx",1590,0x18616bf4)
+static const ::String _hx_array_data_8cddf06d_3[] = {
+ HX_("http://jabber.org/protocol/muc",07,b2,7f,c6),
+};
+namespace snikket{
+
+void SerializedChat_obj::__construct(::String chatId,bool trusted,::Array< unsigned char > avatarSha1, ::haxe::ds::StringMap presence,::String displayName, ::Dynamic uiState, ::Dynamic isBlocked,::String extensions,::String readUpToId,::String readUpToBy, ::Dynamic notificationsFiltered,bool notifyMention,bool notifyReply, ::snikket::Caps disco,::String klass){
+ HX_STACKFRAME(&_hx_pos_59459d97d9a61381_1572_new)
+HXLINE(1573) this->chatId = chatId;
+HXLINE(1574) this->trusted = trusted;
+HXLINE(1575) this->avatarSha1 = avatarSha1;
+HXLINE(1576) this->presence = presence;
+HXLINE(1577) this->displayName = displayName;
+HXLINE(1578) ::Dynamic tmp = uiState;
+HXDLIN(1578) int _hx_tmp;
+HXDLIN(1578) if (::hx::IsNotNull( tmp )) {
+HXLINE(1578) _hx_tmp = ( (int)(tmp) );
+ }
+ else {
+HXLINE(1578) _hx_tmp = 1;
+ }
+HXDLIN(1578) this->uiState = _hx_tmp;
+HXLINE(1579) ::Dynamic tmp1 = isBlocked;
+HXDLIN(1579) bool _hx_tmp1;
+HXDLIN(1579) if (::hx::IsNotNull( tmp1 )) {
+HXLINE(1579) _hx_tmp1 = ( (bool)(tmp1) );
+ }
+ else {
+HXLINE(1579) _hx_tmp1 = false;
+ }
+HXDLIN(1579) this->isBlocked = _hx_tmp1;
+HXLINE(1580) ::String tmp2 = extensions;
+HXDLIN(1580) ::String _hx_tmp2;
+HXDLIN(1580) if (::hx::IsNotNull( tmp2 )) {
+HXLINE(1580) _hx_tmp2 = tmp2;
+ }
+ else {
+HXLINE(1580) _hx_tmp2 = HX_("<extensions xmlns='urn:app:bookmarks:1' />",84,43,42,a9);
+ }
+HXDLIN(1580) this->extensions = _hx_tmp2;
+HXLINE(1581) this->readUpToId = readUpToId;
+HXLINE(1582) this->readUpToBy = readUpToBy;
+HXLINE(1583) this->notificationsFiltered = notificationsFiltered;
+HXLINE(1584) this->notifyMention = notifyMention;
+HXLINE(1585) this->notifyReply = notifyReply;
+HXLINE(1586) this->disco = disco;
+HXLINE(1587) this->klass = klass;
+ }
+
+Dynamic SerializedChat_obj::__CreateEmpty() { return new SerializedChat_obj; }
+
+void *SerializedChat_obj::_hx_vtable = 0;
+
+Dynamic SerializedChat_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< SerializedChat_obj > _hx_result = new SerializedChat_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6],inArgs[7],inArgs[8],inArgs[9],inArgs[10],inArgs[11],inArgs[12],inArgs[13],inArgs[14]);
+ return _hx_result;
+}
+
+bool SerializedChat_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x3eb0c535;
+}
+
+ ::snikket::Chat SerializedChat_obj::toChat( ::snikket::Client client, ::snikket::GenericStream stream,::Dynamic persistence){
+ HX_GC_STACKFRAME(&_hx_pos_59459d97d9a61381_1590_toChat)
+HXLINE(1591) ::snikket::Stanza extensionsStanza = ::snikket::Stanza_obj::fromXml(::Xml_obj::parse(this->extensions));
+HXLINE(1592) bool filterN;
+HXDLIN(1592) ::Dynamic tmp = this->notificationsFiltered;
+HXDLIN(1592) if (::hx::IsNotNull( tmp )) {
+HXLINE(1592) filterN = ( (bool)(tmp) );
+ }
+ else {
+HXLINE(1592) filterN = false;
+ }
+HXLINE(1593) bool mention = this->notifyMention;
+HXLINE(1595) ::snikket::Chat chat;
+HXDLIN(1595) if ((this->klass == HX_("DirectChat",c1,22,a3,05))) {
+HXLINE(1595) chat = ::snikket::DirectChat_obj::__alloc( HX_CTX ,client,stream,persistence,this->chatId,this->uiState,this->isBlocked,extensionsStanza,this->readUpToId,this->readUpToBy);
+ }
+ else {
+HXLINE(1597) if ((this->klass == HX_("Channel",a3,28,23,9a))) {
+HXLINE(1598) ::snikket::Channel channel = ::snikket::Channel_obj::__alloc( HX_CTX ,client,stream,persistence,this->chatId,this->uiState,this->isBlocked,extensionsStanza,this->readUpToId,this->readUpToBy,null());
+HXLINE(1599) ::snikket::Caps tmp1 = this->disco;
+HXDLIN(1599) ::snikket::Caps chat1;
+HXDLIN(1599) if (::hx::IsNotNull( tmp1 )) {
+HXLINE(1599) chat1 = tmp1;
+ }
+ else {
+HXLINE(1599) chat1 = ::snikket::Caps_obj::__alloc( HX_CTX ,HX_("",00,00,00,00),::Array_obj< ::Dynamic>::__new(0),::Array_obj< ::String >::fromData( _hx_array_data_8cddf06d_3,1));
+ }
+HXDLIN(1599) channel->disco = chat1;
+HXLINE(1600) bool chat2;
+HXDLIN(1600) if (::hx::IsNull( this->notificationsFiltered )) {
+HXLINE(1600) chat2 = !(channel->isPrivate());
+ }
+ else {
+HXLINE(1600) chat2 = false;
+ }
+HXDLIN(1600) if (chat2) {
+HXLINE(1601) filterN = true;
+HXDLIN(1601) mention = filterN;
+ }
+HXLINE(1595) chat = channel;
+ }
+ else {
+HXLINE(1605) HX_STACK_DO_THROW((((HX_("Unknown class of ",0b,cb,7f,f2) + this->chatId) + HX_(": ",a6,32,00,00)) + this->klass));
+ }
+ }
+HXLINE(1607) chat->setNotifications(filterN,mention,this->notifyReply);
+HXLINE(1608) if (::hx::IsNotNull( this->displayName )) {
+HXLINE(1608) chat->displayName = this->displayName;
+ }
+HXLINE(1609) if ((this->chatId == HX_("singpolyma@singpolyma.net",8f,e1,1e,c9))) {
+HXLINE(1609) ::haxe::Log_obj::trace(HX_("AVATAR WOO",b0,c9,52,24), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.SerializedChat",6d,f0,dd,8c))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,this->avatarSha1))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("toChat",f3,c9,78,77))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/Chat.hx",f4,6b,61,18))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),1609)));
+ }
+HXLINE(1610) if (::hx::IsNotNull( this->avatarSha1 )) {
+HXLINE(1610) chat->setAvatarSha1(this->avatarSha1);
+ }
+HXLINE(1611) chat->setTrusted(this->trusted);
+HXLINE(1612) {
+HXLINE(1612) ::Dynamic map = this->presence;
+HXDLIN(1612) ::Dynamic _g_map = map;
+HXDLIN(1612) ::Dynamic _g_keys = ::haxe::IMap_obj::keys(map);
+HXDLIN(1612) while(( (bool)(_g_keys->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE(1612) ::String key = ( (::String)(_g_keys->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXDLIN(1612) ::snikket::Presence _g_value = ( ( ::snikket::Presence)(::haxe::IMap_obj::get(_g_map,key)) );
+HXDLIN(1612) ::String _g_key = key;
+HXDLIN(1612) ::String resource = _g_key;
+HXDLIN(1612) ::snikket::Presence p = _g_value;
+HXLINE(1613) chat->setPresence(resource,p);
+ }
+ }
+HXLINE(1615) return chat;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(SerializedChat_obj,toChat,return )
+
+
+::hx::ObjectPtr< SerializedChat_obj > SerializedChat_obj::__new(::String chatId,bool trusted,::Array< unsigned char > avatarSha1, ::haxe::ds::StringMap presence,::String displayName, ::Dynamic uiState, ::Dynamic isBlocked,::String extensions,::String readUpToId,::String readUpToBy, ::Dynamic notificationsFiltered,bool notifyMention,bool notifyReply, ::snikket::Caps disco,::String klass) {
+ ::hx::ObjectPtr< SerializedChat_obj > __this = new SerializedChat_obj();
+ __this->__construct(chatId,trusted,avatarSha1,presence,displayName,uiState,isBlocked,extensions,readUpToId,readUpToBy,notificationsFiltered,notifyMention,notifyReply,disco,klass);
+ return __this;
+}
+
+::hx::ObjectPtr< SerializedChat_obj > SerializedChat_obj::__alloc(::hx::Ctx *_hx_ctx,::String chatId,bool trusted,::Array< unsigned char > avatarSha1, ::haxe::ds::StringMap presence,::String displayName, ::Dynamic uiState, ::Dynamic isBlocked,::String extensions,::String readUpToId,::String readUpToBy, ::Dynamic notificationsFiltered,bool notifyMention,bool notifyReply, ::snikket::Caps disco,::String klass) {
+ SerializedChat_obj *__this = (SerializedChat_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(SerializedChat_obj), true, "snikket.SerializedChat"));
+ *(void **)__this = SerializedChat_obj::_hx_vtable;
+ __this->__construct(chatId,trusted,avatarSha1,presence,displayName,uiState,isBlocked,extensions,readUpToId,readUpToBy,notificationsFiltered,notifyMention,notifyReply,disco,klass);
+ return __this;
+}
+
+SerializedChat_obj::SerializedChat_obj()
+{
+}
+
+void SerializedChat_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(SerializedChat);
+ HX_MARK_MEMBER_NAME(chatId,"chatId");
+ HX_MARK_MEMBER_NAME(trusted,"trusted");
+ HX_MARK_MEMBER_NAME(avatarSha1,"avatarSha1");
+ HX_MARK_MEMBER_NAME(presence,"presence");
+ HX_MARK_MEMBER_NAME(displayName,"displayName");
+ HX_MARK_MEMBER_NAME(uiState,"uiState");
+ HX_MARK_MEMBER_NAME(isBlocked,"isBlocked");
+ HX_MARK_MEMBER_NAME(extensions,"extensions");
+ HX_MARK_MEMBER_NAME(readUpToId,"readUpToId");
+ HX_MARK_MEMBER_NAME(readUpToBy,"readUpToBy");
+ HX_MARK_MEMBER_NAME(disco,"disco");
+ HX_MARK_MEMBER_NAME(klass,"klass");
+ HX_MARK_MEMBER_NAME(notificationsFiltered,"notificationsFiltered");
+ HX_MARK_MEMBER_NAME(notifyMention,"notifyMention");
+ HX_MARK_MEMBER_NAME(notifyReply,"notifyReply");
+ HX_MARK_END_CLASS();
+}
+
+void SerializedChat_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(chatId,"chatId");
+ HX_VISIT_MEMBER_NAME(trusted,"trusted");
+ HX_VISIT_MEMBER_NAME(avatarSha1,"avatarSha1");
+ HX_VISIT_MEMBER_NAME(presence,"presence");
+ HX_VISIT_MEMBER_NAME(displayName,"displayName");
+ HX_VISIT_MEMBER_NAME(uiState,"uiState");
+ HX_VISIT_MEMBER_NAME(isBlocked,"isBlocked");
+ HX_VISIT_MEMBER_NAME(extensions,"extensions");
+ HX_VISIT_MEMBER_NAME(readUpToId,"readUpToId");
+ HX_VISIT_MEMBER_NAME(readUpToBy,"readUpToBy");
+ HX_VISIT_MEMBER_NAME(disco,"disco");
+ HX_VISIT_MEMBER_NAME(klass,"klass");
+ HX_VISIT_MEMBER_NAME(notificationsFiltered,"notificationsFiltered");
+ HX_VISIT_MEMBER_NAME(notifyMention,"notifyMention");
+ HX_VISIT_MEMBER_NAME(notifyReply,"notifyReply");
+}
+
+::hx::Val SerializedChat_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"disco") ) { return ::hx::Val( disco ); }
+ if (HX_FIELD_EQ(inName,"klass") ) { return ::hx::Val( klass ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"chatId") ) { return ::hx::Val( chatId ); }
+ if (HX_FIELD_EQ(inName,"toChat") ) { return ::hx::Val( toChat_dyn() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"trusted") ) { return ::hx::Val( trusted ); }
+ if (HX_FIELD_EQ(inName,"uiState") ) { return ::hx::Val( uiState ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"presence") ) { return ::hx::Val( presence ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"isBlocked") ) { return ::hx::Val( isBlocked ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"avatarSha1") ) { return ::hx::Val( avatarSha1 ); }
+ if (HX_FIELD_EQ(inName,"extensions") ) { return ::hx::Val( extensions ); }
+ if (HX_FIELD_EQ(inName,"readUpToId") ) { return ::hx::Val( readUpToId ); }
+ if (HX_FIELD_EQ(inName,"readUpToBy") ) { return ::hx::Val( readUpToBy ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"displayName") ) { return ::hx::Val( displayName ); }
+ if (HX_FIELD_EQ(inName,"notifyReply") ) { return ::hx::Val( notifyReply ); }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"notifyMention") ) { return ::hx::Val( notifyMention ); }
+ break;
+ case 21:
+ if (HX_FIELD_EQ(inName,"notificationsFiltered") ) { return ::hx::Val( notificationsFiltered ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val SerializedChat_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"disco") ) { disco=inValue.Cast< ::snikket::Caps >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"klass") ) { klass=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"chatId") ) { chatId=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"trusted") ) { trusted=inValue.Cast< bool >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"uiState") ) { uiState=inValue.Cast< int >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"presence") ) { presence=inValue.Cast< ::haxe::ds::StringMap >(); return inValue; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"isBlocked") ) { isBlocked=inValue.Cast< bool >(); return inValue; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"avatarSha1") ) { avatarSha1=inValue.Cast< ::Array< unsigned char > >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"extensions") ) { extensions=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"readUpToId") ) { readUpToId=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"readUpToBy") ) { readUpToBy=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"displayName") ) { displayName=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"notifyReply") ) { notifyReply=inValue.Cast< bool >(); return inValue; }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"notifyMention") ) { notifyMention=inValue.Cast< bool >(); return inValue; }
+ break;
+ case 21:
+ if (HX_FIELD_EQ(inName,"notificationsFiltered") ) { notificationsFiltered=inValue.Cast< ::Dynamic >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void SerializedChat_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("chatId",d3,04,77,b7));
+ outFields->push(HX_("trusted",f7,b7,a6,16));
+ outFields->push(HX_("avatarSha1",3e,f5,cc,3e));
+ outFields->push(HX_("presence",3b,52,d7,66));
+ outFields->push(HX_("displayName",ad,11,f2,30));
+ outFields->push(HX_("uiState",1d,0f,01,14));
+ outFields->push(HX_("isBlocked",22,f8,fc,48));
+ outFields->push(HX_("extensions",14,7c,70,89));
+ outFields->push(HX_("readUpToId",27,7a,f8,75));
+ outFields->push(HX_("readUpToBy",23,74,f8,75));
+ outFields->push(HX_("disco",7a,03,d1,d9));
+ outFields->push(HX_("klass",40,1c,8d,e3));
+ outFields->push(HX_("notificationsFiltered",5f,11,ed,96));
+ outFields->push(HX_("notifyMention",21,c7,22,5a));
+ outFields->push(HX_("notifyReply",a1,e5,9f,37));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo SerializedChat_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(SerializedChat_obj,chatId),HX_("chatId",d3,04,77,b7)},
+ {::hx::fsBool,(int)offsetof(SerializedChat_obj,trusted),HX_("trusted",f7,b7,a6,16)},
+ {::hx::fsObject /* ::Array< unsigned char > */ ,(int)offsetof(SerializedChat_obj,avatarSha1),HX_("avatarSha1",3e,f5,cc,3e)},
+ {::hx::fsObject /* ::haxe::ds::StringMap */ ,(int)offsetof(SerializedChat_obj,presence),HX_("presence",3b,52,d7,66)},
+ {::hx::fsString,(int)offsetof(SerializedChat_obj,displayName),HX_("displayName",ad,11,f2,30)},
+ {::hx::fsInt,(int)offsetof(SerializedChat_obj,uiState),HX_("uiState",1d,0f,01,14)},
+ {::hx::fsBool,(int)offsetof(SerializedChat_obj,isBlocked),HX_("isBlocked",22,f8,fc,48)},
+ {::hx::fsString,(int)offsetof(SerializedChat_obj,extensions),HX_("extensions",14,7c,70,89)},
+ {::hx::fsString,(int)offsetof(SerializedChat_obj,readUpToId),HX_("readUpToId",27,7a,f8,75)},
+ {::hx::fsString,(int)offsetof(SerializedChat_obj,readUpToBy),HX_("readUpToBy",23,74,f8,75)},
+ {::hx::fsObject /* ::snikket::Caps */ ,(int)offsetof(SerializedChat_obj,disco),HX_("disco",7a,03,d1,d9)},
+ {::hx::fsString,(int)offsetof(SerializedChat_obj,klass),HX_("klass",40,1c,8d,e3)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(SerializedChat_obj,notificationsFiltered),HX_("notificationsFiltered",5f,11,ed,96)},
+ {::hx::fsBool,(int)offsetof(SerializedChat_obj,notifyMention),HX_("notifyMention",21,c7,22,5a)},
+ {::hx::fsBool,(int)offsetof(SerializedChat_obj,notifyReply),HX_("notifyReply",a1,e5,9f,37)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *SerializedChat_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String SerializedChat_obj_sMemberFields[] = {
+ HX_("chatId",d3,04,77,b7),
+ HX_("trusted",f7,b7,a6,16),
+ HX_("avatarSha1",3e,f5,cc,3e),
+ HX_("presence",3b,52,d7,66),
+ HX_("displayName",ad,11,f2,30),
+ HX_("uiState",1d,0f,01,14),
+ HX_("isBlocked",22,f8,fc,48),
+ HX_("extensions",14,7c,70,89),
+ HX_("readUpToId",27,7a,f8,75),
+ HX_("readUpToBy",23,74,f8,75),
+ HX_("disco",7a,03,d1,d9),
+ HX_("klass",40,1c,8d,e3),
+ HX_("notificationsFiltered",5f,11,ed,96),
+ HX_("notifyMention",21,c7,22,5a),
+ HX_("notifyReply",a1,e5,9f,37),
+ HX_("toChat",f3,c9,78,77),
+ ::String(null()) };
+
+::hx::Class SerializedChat_obj::__mClass;
+
+void SerializedChat_obj::__register()
+{
+ SerializedChat_obj _hx_dummy;
+ SerializedChat_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.SerializedChat",6d,f0,dd,8c);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(SerializedChat_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< SerializedChat_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = SerializedChat_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = SerializedChat_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/Stanza.cpp b/Sources/c_snikket/src/snikket/Stanza.cpp
new file mode 100644
index 0000000..91f44cd
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/Stanza.cpp
@@ -0,0 +1,1055 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_EReg
+#include <EReg.h>
+#endif
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_Xml
+#include <Xml.h>
+#endif
+#ifndef INCLUDED__Xml_XmlType_Impl_
+#include <_Xml/XmlType_Impl_.h>
+#endif
+#ifndef INCLUDED_haxe_Exception
+#include <haxe/Exception.h>
+#endif
+#ifndef INCLUDED_haxe_xml_Printer
+#include <haxe/xml/Printer.h>
+#endif
+#ifndef INCLUDED_snikket_Node
+#include <snikket/Node.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket_StanzaError
+#include <snikket/StanzaError.h>
+#endif
+#ifndef INCLUDED_snikket_TextNode
+#include <snikket/TextNode.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_77777da2cc20dfea_54_new,"snikket.Stanza","new",0x8db01dd8,"snikket.Stanza.new","snikket/Stanza.hx",54,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_77777da2cc20dfea_69_serialize,"snikket.Stanza","serialize",0x62161558,"snikket.Stanza.serialize","snikket/Stanza.hx",69,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_77777da2cc20dfea_91_toString,"snikket.Stanza","toString",0x332eb034,"snikket.Stanza.toString","snikket/Stanza.hx",91,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_77777da2cc20dfea_122_tag,"snikket.Stanza","tag",0x8db4a7d2,"snikket.Stanza.tag","snikket/Stanza.hx",122,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_77777da2cc20dfea_130_text,"snikket.Stanza","text",0x70614835,"snikket.Stanza.text","snikket/Stanza.hx",130,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_77777da2cc20dfea_135_textTag,"snikket.Stanza","textTag",0xfce41925,"snikket.Stanza.textTag","snikket/Stanza.hx",135,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_77777da2cc20dfea_140_up,"snikket.Stanza","up",0x792c6fe3,"snikket.Stanza.up","snikket/Stanza.hx",140,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_77777da2cc20dfea_147_reset,"snikket.Stanza","reset",0xbdece547,"snikket.Stanza.reset","snikket/Stanza.hx",147,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_77777da2cc20dfea_153_addChildren,"snikket.Stanza","addChildren",0x68e0d5f8,"snikket.Stanza.addChildren","snikket/Stanza.hx",153,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_77777da2cc20dfea_161_addChildNodes,"snikket.Stanza","addChildNodes",0x4f6445ee,"snikket.Stanza.addChildNodes","snikket/Stanza.hx",161,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_77777da2cc20dfea_168_addChild,"snikket.Stanza","addChild",0xb9d6af43,"snikket.Stanza.addChild","snikket/Stanza.hx",168,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_77777da2cc20dfea_173_addDirectChild,"snikket.Stanza","addDirectChild",0xf89df69a,"snikket.Stanza.addDirectChild","snikket/Stanza.hx",173,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_77777da2cc20dfea_178_clone,"snikket.Stanza","clone",0x1f87aed5,"snikket.Stanza.clone","snikket/Stanza.hx",178,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_77777da2cc20dfea_189_allTags,"snikket.Stanza","allTags",0xb55fe812,"snikket.Stanza.allTags","snikket/Stanza.hx",189,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_77777da2cc20dfea_211_allText,"snikket.Stanza","allText",0xb562ffe6,"snikket.Stanza.allText","snikket/Stanza.hx",211,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_77777da2cc20dfea_222_getFirstChild,"snikket.Stanza","getFirstChild",0x86eb22fa,"snikket.Stanza.getFirstChild","snikket/Stanza.hx",222,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_77777da2cc20dfea_225_getChildren,"snikket.Stanza","getChildren",0x5d78616d,"snikket.Stanza.getChildren","snikket/Stanza.hx",225,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_77777da2cc20dfea_232_getChild,"snikket.Stanza","getChild",0xa05098ae,"snikket.Stanza.getChild","snikket/Stanza.hx",232,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_77777da2cc20dfea_249_getChildText,"snikket.Stanza","getChildText",0x5808807b,"snikket.Stanza.getChildText","snikket/Stanza.hx",249,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_77777da2cc20dfea_258_getText,"snikket.Stanza","getText",0x7d98e5db,"snikket.Stanza.getText","snikket/Stanza.hx",258,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_77777da2cc20dfea_261_find,"snikket.Stanza","find",0x67234bc1,"snikket.Stanza.find","snikket/Stanza.hx",261,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_77777da2cc20dfea_299_findChild,"snikket.Stanza","findChild",0xa1d4921b,"snikket.Stanza.findChild","snikket/Stanza.hx",299,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_77777da2cc20dfea_310_findText,"snikket.Stanza","findText",0x9a4db90e,"snikket.Stanza.findText","snikket/Stanza.hx",310,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_77777da2cc20dfea_321_traverse,"snikket.Stanza","traverse",0x672a5d3a,"snikket.Stanza.traverse","snikket/Stanza.hx",321,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_77777da2cc20dfea_330_getError,"snikket.Stanza","getError",0xcdc0bada,"snikket.Stanza.getError","snikket/Stanza.hx",330,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_77777da2cc20dfea_342_removeChildren,"snikket.Stanza","removeChildren",0x98988b2b,"snikket.Stanza.removeChildren","snikket/Stanza.hx",342,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_77777da2cc20dfea_95_parse,"snikket.Stanza","parse",0x947a2bab,"snikket.Stanza.parse","snikket/Stanza.hx",95,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_77777da2cc20dfea_100_fromXml,"snikket.Stanza","fromXml",0xb622a805,"snikket.Stanza.fromXml","snikket/Stanza.hx",100,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_77777da2cc20dfea_355_parseXmlBool,"snikket.Stanza","parseXmlBool",0x3825ed36,"snikket.Stanza.parseXmlBool","snikket/Stanza.hx",355,0x3976dc77)
+namespace snikket{
+
+void Stanza_obj::__construct(::String name, ::Dynamic attr){
+ HX_STACKFRAME(&_hx_pos_77777da2cc20dfea_54_new)
+HXLINE( 59) this->last_added_stack = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 57) this->children = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 56) this->attr = ::Dynamic(::hx::Anon_obj::Create(0));
+HXLINE( 55) this->name = null();
+HXLINE( 62) this->name = name;
+HXLINE( 63) if (::hx::IsNotNull( attr )) {
+HXLINE( 64) this->attr = attr;
+ }
+HXLINE( 66) this->last_added = ::hx::ObjectPtr<OBJ_>(this);
+ }
+
+Dynamic Stanza_obj::__CreateEmpty() { return new Stanza_obj; }
+
+void *Stanza_obj::_hx_vtable = 0;
+
+Dynamic Stanza_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Stanza_obj > _hx_result = new Stanza_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1]);
+ return _hx_result;
+}
+
+bool Stanza_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x62320f92;
+}
+
+static ::snikket::_Stanza::NodeInterface_obj _hx_snikket_Stanza__hx_snikket__Stanza_NodeInterface= {
+ ( ::String (::hx::Object::*)())&::snikket::Stanza_obj::serialize,
+ ( ::Dynamic (::hx::Object::*)( ::Dynamic))&::snikket::Stanza_obj::traverse_881a854a,
+};
+
+::Dynamic Stanza_obj::traverse_881a854a( ::Dynamic f) {
+ return traverse(f);
+}
+void *Stanza_obj::_hx_getInterface(int inHash) {
+ switch(inHash) {
+ case (int)0xc837e580: return &_hx_snikket_Stanza__hx_snikket__Stanza_NodeInterface;
+ }
+ #ifdef HXCPP_SCRIPTABLE
+ return super::_hx_getInterface(inHash);
+ #else
+ return 0;
+ #endif
+}
+
+::String Stanza_obj::serialize(){
+ HX_STACKFRAME(&_hx_pos_77777da2cc20dfea_69_serialize)
+HXLINE( 70) ::Xml el = ::Xml_obj::createElement(this->name);
+HXLINE( 71) {
+HXLINE( 71) int _g = 0;
+HXDLIN( 71) ::Array< ::String > _g1 = ::Reflect_obj::fields(this->attr);
+HXDLIN( 71) while((_g < _g1->length)){
+HXLINE( 71) ::String attr_k = _g1->__get(_g);
+HXDLIN( 71) _g = (_g + 1);
+HXLINE( 72) el->set(attr_k,( (::String)(::Reflect_obj::field(this->attr,attr_k)) ));
+ }
+ }
+HXLINE( 75) if ((this->children->length == 0)) {
+HXLINE( 76) return ::haxe::xml::Printer_obj::print(el,null());
+ }
+HXLINE( 78) ::String serialized = ::haxe::xml::Printer_obj::print(el,null());
+HXLINE( 79) ::Array< ::String > buffer = ::Array_obj< ::String >::__new(1)->init(0,(serialized.substring(0,(serialized.length - 2)) + HX_(">",3e,00,00,00)));
+HXLINE( 80) {
+HXLINE( 80) int _g2 = 0;
+HXDLIN( 80) ::Array< ::Dynamic> _g3 = this->children;
+HXDLIN( 80) while((_g2 < _g3->length)){
+HXLINE( 80) ::snikket::Node child = _g3->__get(_g2).StaticCast< ::snikket::Node >();
+HXDLIN( 80) _g2 = (_g2 + 1);
+HXLINE( 81) ::String _hx_tmp;
+HXDLIN( 81) switch((int)(child->_hx_getIndex())){
+ case (int)0: {
+HXLINE( 82) ::snikket::Stanza c = child->_hx_getObject(0).StaticCast< ::snikket::Stanza >();
+HXLINE( 81) _hx_tmp = c->serialize();
+ }
+ break;
+ case (int)1: {
+HXLINE( 83) ::snikket::TextNode c1 = child->_hx_getObject(0).StaticCast< ::snikket::TextNode >();
+HXLINE( 81) _hx_tmp = c1->serialize();
+ }
+ break;
+ }
+HXDLIN( 81) buffer->push(_hx_tmp);
+ }
+ }
+HXLINE( 86) buffer->push(((HX_("</",73,34,00,00) + this->name) + HX_(">",3e,00,00,00)));
+HXLINE( 87) return buffer->join(HX_("",00,00,00,00));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Stanza_obj,serialize,return )
+
+::String Stanza_obj::toString(){
+ HX_STACKFRAME(&_hx_pos_77777da2cc20dfea_91_toString)
+HXDLIN( 91) return this->serialize();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Stanza_obj,toString,return )
+
+ ::snikket::Stanza Stanza_obj::tag(::String name, ::Dynamic attr){
+ HX_GC_STACKFRAME(&_hx_pos_77777da2cc20dfea_122_tag)
+HXLINE( 123) ::snikket::Stanza child = ::snikket::Stanza_obj::__alloc( HX_CTX ,name,attr);
+HXLINE( 124) this->last_added->addDirectChild(::snikket::Node_obj::Element(child));
+HXLINE( 125) this->last_added_stack->push(this->last_added);
+HXLINE( 126) this->last_added = child;
+HXLINE( 127) return ::hx::ObjectPtr<OBJ_>(this);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Stanza_obj,tag,return )
+
+ ::snikket::Stanza Stanza_obj::text(::String content){
+ HX_GC_STACKFRAME(&_hx_pos_77777da2cc20dfea_130_text)
+HXLINE( 131) ::snikket::Stanza _hx_tmp = this->last_added;
+HXDLIN( 131) _hx_tmp->addDirectChild(::snikket::Node_obj::CData( ::snikket::TextNode_obj::__alloc( HX_CTX ,content)));
+HXLINE( 132) return ::hx::ObjectPtr<OBJ_>(this);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Stanza_obj,text,return )
+
+ ::snikket::Stanza Stanza_obj::textTag(::String tagName,::String textContent, ::Dynamic attr){
+ HX_GC_STACKFRAME(&_hx_pos_77777da2cc20dfea_135_textTag)
+HXLINE( 136) ::snikket::Stanza _hx_tmp = this->last_added;
+HXDLIN( 136) ::Dynamic tmp = attr;
+HXDLIN( 136) ::Dynamic _hx_tmp1;
+HXDLIN( 136) if (::hx::IsNotNull( tmp )) {
+HXLINE( 136) _hx_tmp1 = tmp;
+ }
+ else {
+HXLINE( 136) _hx_tmp1 = ::Dynamic(::hx::Anon_obj::Create(0));
+ }
+HXDLIN( 136) _hx_tmp->addDirectChild(::snikket::Node_obj::Element( ::snikket::Stanza_obj::__alloc( HX_CTX ,tagName,_hx_tmp1)->text(textContent)));
+HXLINE( 137) return ::hx::ObjectPtr<OBJ_>(this);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Stanza_obj,textTag,return )
+
+ ::snikket::Stanza Stanza_obj::up(){
+ HX_STACKFRAME(&_hx_pos_77777da2cc20dfea_140_up)
+HXLINE( 141) if (::hx::IsInstanceNotEq( this->last_added,::hx::ObjectPtr<OBJ_>(this) )) {
+HXLINE( 142) this->last_added = this->last_added_stack->pop().StaticCast< ::snikket::Stanza >();
+ }
+HXLINE( 144) return ::hx::ObjectPtr<OBJ_>(this);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Stanza_obj,up,return )
+
+ ::snikket::Stanza Stanza_obj::reset(){
+ HX_STACKFRAME(&_hx_pos_77777da2cc20dfea_147_reset)
+HXLINE( 148) this->last_added = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 149) return ::hx::ObjectPtr<OBJ_>(this);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Stanza_obj,reset,return )
+
+ ::snikket::Stanza Stanza_obj::addChildren( ::Dynamic children){
+ HX_STACKFRAME(&_hx_pos_77777da2cc20dfea_153_addChildren)
+HXLINE( 154) {
+HXLINE( 154) ::Dynamic child = children->__Field(HX_("iterator",ee,49,9a,93),::hx::paccDynamic)();
+HXDLIN( 154) while(( (bool)(child->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 154) ::snikket::Stanza child1 = ( ( ::snikket::Stanza)(child->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXLINE( 155) this->addChild(child1);
+ }
+ }
+HXLINE( 157) return ::hx::ObjectPtr<OBJ_>(this);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Stanza_obj,addChildren,return )
+
+ ::snikket::Stanza Stanza_obj::addChildNodes( ::Dynamic children){
+ HX_STACKFRAME(&_hx_pos_77777da2cc20dfea_161_addChildNodes)
+HXLINE( 162) {
+HXLINE( 162) ::Dynamic child = children->__Field(HX_("iterator",ee,49,9a,93),::hx::paccDynamic)();
+HXDLIN( 162) while(( (bool)(child->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 162) ::snikket::Node child1 = child->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)();
+HXLINE( 163) this->addDirectChild(child1);
+ }
+ }
+HXLINE( 165) return ::hx::ObjectPtr<OBJ_>(this);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Stanza_obj,addChildNodes,return )
+
+ ::snikket::Stanza Stanza_obj::addChild( ::snikket::Stanza stanza){
+ HX_STACKFRAME(&_hx_pos_77777da2cc20dfea_168_addChild)
+HXLINE( 169) this->last_added->children->push(::snikket::Node_obj::Element(stanza));
+HXLINE( 170) return ::hx::ObjectPtr<OBJ_>(this);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Stanza_obj,addChild,return )
+
+ ::snikket::Stanza Stanza_obj::addDirectChild( ::snikket::Node child){
+ HX_STACKFRAME(&_hx_pos_77777da2cc20dfea_173_addDirectChild)
+HXLINE( 174) this->children->push(child);
+HXLINE( 175) return ::hx::ObjectPtr<OBJ_>(this);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Stanza_obj,addDirectChild,return )
+
+ ::snikket::Stanza Stanza_obj::clone(){
+ HX_GC_STACKFRAME(&_hx_pos_77777da2cc20dfea_178_clone)
+HXLINE( 179) ::snikket::Stanza clone = ::snikket::Stanza_obj::__alloc( HX_CTX ,this->name,this->attr);
+HXLINE( 180) {
+HXLINE( 180) int _g = 0;
+HXDLIN( 180) ::Array< ::Dynamic> _g1 = this->children;
+HXDLIN( 180) while((_g < _g1->length)){
+HXLINE( 180) ::snikket::Node child = _g1->__get(_g).StaticCast< ::snikket::Node >();
+HXDLIN( 180) _g = (_g + 1);
+HXLINE( 181) ::snikket::Node _hx_tmp;
+HXDLIN( 181) switch((int)(child->_hx_getIndex())){
+ case (int)0: {
+HXLINE( 182) ::snikket::Stanza c = child->_hx_getObject(0).StaticCast< ::snikket::Stanza >();
+HXLINE( 181) _hx_tmp = ::snikket::Node_obj::Element(c->clone());
+ }
+ break;
+ case (int)1: {
+HXLINE( 183) ::snikket::TextNode c1 = child->_hx_getObject(0).StaticCast< ::snikket::TextNode >();
+HXLINE( 181) _hx_tmp = ::snikket::Node_obj::CData(c1->clone());
+ }
+ break;
+ }
+HXDLIN( 181) clone->addDirectChild(_hx_tmp);
+ }
+ }
+HXLINE( 186) return clone;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Stanza_obj,clone,return )
+
+::Array< ::Dynamic> Stanza_obj::allTags(::String name,::String xmlns){
+ HX_STACKFRAME(&_hx_pos_77777da2cc20dfea_189_allTags)
+HXLINE( 190) ::Array< ::Dynamic> _g = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 190) {
+HXLINE( 190) int _g1 = 0;
+HXDLIN( 190) ::Array< ::Dynamic> _g2 = this->children;
+HXDLIN( 190) while((_g1 < _g2->length)){
+HXLINE( 190) ::snikket::Node v = _g2->__get(_g1).StaticCast< ::snikket::Node >();
+HXDLIN( 190) _g1 = (_g1 + 1);
+HXLINE( 191) bool _hx_tmp;
+HXDLIN( 191) if ((v->_hx_getIndex() == 0)) {
+HXLINE( 191) ::snikket::Stanza _g3 = v->_hx_getObject(0).StaticCast< ::snikket::Stanza >();
+HXDLIN( 191) _hx_tmp = true;
+ }
+ else {
+HXLINE( 191) _hx_tmp = false;
+ }
+HXLINE( 190) if (_hx_tmp) {
+HXLINE( 190) _g->push(v);
+ }
+ }
+ }
+HXDLIN( 190) ::Array< ::Dynamic> _this = _g;
+HXDLIN( 190) ::Array< ::Dynamic> result = ::Array_obj< ::Dynamic>::__new(_this->length);
+HXDLIN( 190) {
+HXLINE( 190) int _g4 = 0;
+HXDLIN( 190) int _g5 = _this->length;
+HXDLIN( 190) while((_g4 < _g5)){
+HXLINE( 190) _g4 = (_g4 + 1);
+HXDLIN( 190) int i = (_g4 - 1);
+HXDLIN( 190) {
+HXLINE( 193) ::snikket::Node child = _hx_array_unsafe_get(_this,i);
+HXLINE( 190) ::snikket::Stanza inValue;
+HXLINE( 193) if ((child->_hx_getIndex() == 0)) {
+HXLINE( 194) ::snikket::Stanza c = child->_hx_getObject(0).StaticCast< ::snikket::Stanza >();
+HXLINE( 190) inValue = c;
+ }
+ else {
+HXLINE( 190) inValue = null();
+ }
+HXDLIN( 190) result->__unsafe_set(i,inValue);
+ }
+ }
+ }
+HXDLIN( 190) ::Array< ::Dynamic> tags = result;
+HXLINE( 198) bool _hx_tmp1;
+HXDLIN( 198) if (::hx::IsNull( name )) {
+HXLINE( 198) _hx_tmp1 = ::hx::IsNotNull( xmlns );
+ }
+ else {
+HXLINE( 198) _hx_tmp1 = true;
+ }
+HXDLIN( 198) if (_hx_tmp1) {
+HXLINE( 199) ::String ourXmlns = ( (::String)(::Reflect_obj::field(this->attr,HX_("xmlns",dc,31,74,60))) );
+HXLINE( 200) ::Array< ::Dynamic> _g6 = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 200) {
+HXLINE( 200) int _g7 = 0;
+HXDLIN( 200) ::Array< ::Dynamic> _g8 = tags;
+HXDLIN( 200) while((_g7 < _g8->length)){
+HXLINE( 200) ::snikket::Stanza v1 = _g8->__get(_g7).StaticCast< ::snikket::Stanza >();
+HXDLIN( 200) _g7 = (_g7 + 1);
+HXLINE( 201) ::String childXmlns = ( (::String)(::Reflect_obj::field(v1->attr,HX_("xmlns",dc,31,74,60))) );
+HXLINE( 200) bool tags1;
+HXLINE( 202) bool tags2;
+HXDLIN( 202) if (::hx::IsNotNull( name )) {
+HXLINE( 202) tags2 = (v1->name == name);
+ }
+ else {
+HXLINE( 202) tags2 = true;
+ }
+HXDLIN( 202) if (tags2) {
+HXLINE( 203) bool tags3;
+HXDLIN( 203) if (::hx::IsNull( xmlns )) {
+HXLINE( 203) if ((ourXmlns != childXmlns)) {
+HXLINE( 203) tags3 = ::hx::IsNull( childXmlns );
+ }
+ else {
+HXLINE( 203) tags3 = true;
+ }
+ }
+ else {
+HXLINE( 203) tags3 = false;
+ }
+HXDLIN( 203) if (!(tags3)) {
+HXLINE( 200) tags1 = (childXmlns == xmlns);
+ }
+ else {
+HXLINE( 200) tags1 = true;
+ }
+ }
+ else {
+HXLINE( 200) tags1 = false;
+ }
+HXDLIN( 200) if (tags1) {
+HXLINE( 200) _g6->push(v1);
+ }
+ }
+ }
+HXDLIN( 200) tags = _g6;
+ }
+HXLINE( 207) return tags;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Stanza_obj,allTags,return )
+
+::Array< ::String > Stanza_obj::allText(){
+ HX_STACKFRAME(&_hx_pos_77777da2cc20dfea_211_allText)
+HXDLIN( 211) ::Array< ::Dynamic> _g = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 211) {
+HXDLIN( 211) int _g1 = 0;
+HXDLIN( 211) ::Array< ::Dynamic> _g2 = this->children;
+HXDLIN( 211) while((_g1 < _g2->length)){
+HXDLIN( 211) ::snikket::Node v = _g2->__get(_g1).StaticCast< ::snikket::Node >();
+HXDLIN( 211) _g1 = (_g1 + 1);
+HXLINE( 212) bool _hx_tmp;
+HXDLIN( 212) if ((v->_hx_getIndex() == 1)) {
+HXLINE( 212) ::snikket::TextNode _g3 = v->_hx_getObject(0).StaticCast< ::snikket::TextNode >();
+HXDLIN( 212) _hx_tmp = true;
+ }
+ else {
+HXLINE( 212) _hx_tmp = false;
+ }
+HXLINE( 211) if (_hx_tmp) {
+HXDLIN( 211) _g->push(v);
+ }
+ }
+ }
+HXDLIN( 211) ::Array< ::Dynamic> _this = _g;
+HXDLIN( 211) ::Array< ::String > result = ::Array_obj< ::String >::__new(_this->length);
+HXDLIN( 211) {
+HXDLIN( 211) int _g4 = 0;
+HXDLIN( 211) int _g5 = _this->length;
+HXDLIN( 211) while((_g4 < _g5)){
+HXDLIN( 211) _g4 = (_g4 + 1);
+HXDLIN( 211) int i = (_g4 - 1);
+HXDLIN( 211) {
+HXLINE( 214) ::snikket::Node child = _hx_array_unsafe_get(_this,i);
+HXLINE( 211) ::String inValue;
+HXLINE( 214) if ((child->_hx_getIndex() == 1)) {
+HXLINE( 215) ::snikket::TextNode c = child->_hx_getObject(0).StaticCast< ::snikket::TextNode >();
+HXLINE( 211) inValue = c->content;
+ }
+ else {
+HXDLIN( 211) inValue = null();
+ }
+HXDLIN( 211) result->__unsafe_set(i,inValue);
+ }
+ }
+ }
+HXDLIN( 211) return result;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Stanza_obj,allText,return )
+
+ ::snikket::Stanza Stanza_obj::getFirstChild(){
+ HX_STACKFRAME(&_hx_pos_77777da2cc20dfea_222_getFirstChild)
+HXDLIN( 222) return this->allTags(null(),null())->__get(0).StaticCast< ::snikket::Stanza >();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Stanza_obj,getFirstChild,return )
+
+::Array< ::Dynamic> Stanza_obj::getChildren(){
+ HX_STACKFRAME(&_hx_pos_77777da2cc20dfea_225_getChildren)
+HXDLIN( 225) ::snikket::Stanza _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 226) ::Array< ::Dynamic> _this = this->children;
+HXDLIN( 226) ::Array< ::Dynamic> result = ::Array_obj< ::Dynamic>::__new(_this->length);
+HXDLIN( 226) {
+HXLINE( 226) int _g = 0;
+HXDLIN( 226) int _g1 = _this->length;
+HXDLIN( 226) while((_g < _g1)){
+HXLINE( 226) _g = (_g + 1);
+HXDLIN( 226) int i = (_g - 1);
+HXDLIN( 226) {
+HXLINE( 226) ::snikket::Node child = _hx_array_unsafe_get(_this,i);
+HXDLIN( 226) ::Dynamic inValue;
+HXDLIN( 226) switch((int)(child->_hx_getIndex())){
+ case (int)0: {
+HXLINE( 227) ::snikket::Stanza el = child->_hx_getObject(0).StaticCast< ::snikket::Stanza >();
+HXLINE( 226) inValue = el;
+ }
+ break;
+ case (int)1: {
+HXLINE( 228) ::snikket::TextNode text = child->_hx_getObject(0).StaticCast< ::snikket::TextNode >();
+HXLINE( 226) inValue = text;
+ }
+ break;
+ }
+HXDLIN( 226) result->__unsafe_set(i,inValue);
+ }
+ }
+ }
+HXDLIN( 226) return result;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Stanza_obj,getChildren,return )
+
+ ::snikket::Stanza Stanza_obj::getChild(::String name,::String xmlns){
+ HX_STACKFRAME(&_hx_pos_77777da2cc20dfea_232_getChild)
+HXLINE( 233) ::String ourXmlns = ( (::String)(::Reflect_obj::field(this->attr,HX_("xmlns",dc,31,74,60))) );
+HXLINE( 242) ::Array< ::Dynamic> tags = this->allTags(name,xmlns);
+HXLINE( 243) if ((tags->length == 0)) {
+HXLINE( 244) return null();
+ }
+HXLINE( 246) return tags->__get(0).StaticCast< ::snikket::Stanza >();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Stanza_obj,getChild,return )
+
+::String Stanza_obj::getChildText(::String name,::String xmlns){
+ HX_STACKFRAME(&_hx_pos_77777da2cc20dfea_249_getChildText)
+HXLINE( 250) ::snikket::Stanza child = this->getChild(name,xmlns);
+HXLINE( 251) if (::hx::IsNull( child )) {
+HXLINE( 252) return null();
+ }
+HXLINE( 254) return child->getText();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Stanza_obj,getChildText,return )
+
+::String Stanza_obj::getText(){
+ HX_STACKFRAME(&_hx_pos_77777da2cc20dfea_258_getText)
+HXDLIN( 258) return this->allText()->join(HX_("",00,00,00,00));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Stanza_obj,getText,return )
+
+ ::snikket::Node Stanza_obj::find(::String path){
+ HX_GC_STACKFRAME(&_hx_pos_77777da2cc20dfea_261_find)
+HXLINE( 262) int pos = 0;
+HXLINE( 263) int len = path.length;
+HXLINE( 264) ::snikket::Stanza cursor = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 266) do {
+HXLINE( 267) ::String xmlns = null();
+HXDLIN( 267) ::Dynamic name = null();
+HXDLIN( 267) ::Dynamic text = null();
+HXLINE( 268) ::String _hx_char = path.charAt(pos);
+HXLINE( 269) if ((_hx_char == HX_("@",40,00,00,00))) {
+HXLINE( 270) ::Dynamic this1 = cursor->attr;
+HXDLIN( 270) return ::snikket::Node_obj::CData( ::snikket::TextNode_obj::__alloc( HX_CTX ,( (::String)(::Reflect_obj::field(this1,path.substr((pos + 1),null()))) )));
+ }
+ else {
+HXLINE( 271) if ((_hx_char == HX_("{",7b,00,00,00))) {
+HXLINE( 272) xmlns = path.substring((pos + 1),path.indexOf(HX_("}",7d,00,00,00),(pos + 1)));
+HXLINE( 273) pos = (pos + (xmlns.length + 2));
+ }
+ }
+HXLINE( 275) ::EReg reName = ::EReg_obj::__alloc( HX_CTX ,HX_("([^@/#]*)([/#]?)",cd,f2,19,5a),HX_("",00,00,00,00));
+HXLINE( 276) if (!(reName->matchSub(path,pos,null()))) {
+HXLINE( 277) HX_STACK_DO_THROW( ::haxe::Exception_obj::__alloc( HX_CTX ,(HX_("Invalid path to Stanza.find(): ",c6,3a,06,10) + path),null(),null()));
+ }
+HXLINE( 279) ::String name1 = reName->matched(1);
+HXDLIN( 279) ::String text1 = reName->matched(2);
+HXLINE( 280) int pos1 = ( (int)(reName->matchedPos()->__Field(HX_("pos",94,5d,55,00),::hx::paccDynamic)) );
+HXDLIN( 280) pos = ( (int)((pos1 + reName->matchedPos()->__Field(HX_("len",d5,4b,52,00),::hx::paccDynamic))) );
+HXLINE( 281) if ((name1 == HX_("",00,00,00,00))) {
+HXLINE( 282) name1 = null();
+ }
+HXLINE( 284) if ((pos == len)) {
+HXLINE( 285) if ((text1 == HX_("#",23,00,00,00))) {
+HXLINE( 286) ::String text2 = cursor->getChildText(name1,xmlns);
+HXLINE( 287) if (::hx::IsNull( text2 )) {
+HXLINE( 288) return null();
+ }
+HXLINE( 290) return ::snikket::Node_obj::CData( ::snikket::TextNode_obj::__alloc( HX_CTX ,text2));
+ }
+HXLINE( 292) return ::snikket::Node_obj::Element(cursor->getChild(name1,xmlns));
+ }
+HXLINE( 294) cursor = cursor->getChild(name1,xmlns);
+ } while(::hx::IsNotNull( cursor ));
+;
+HXLINE( 296) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Stanza_obj,find,return )
+
+ ::snikket::Stanza Stanza_obj::findChild(::String path){
+ HX_STACKFRAME(&_hx_pos_77777da2cc20dfea_299_findChild)
+HXLINE( 300) ::snikket::Node result = this->find(path);
+HXLINE( 301) if (::hx::IsNull( result )) {
+HXLINE( 302) return null();
+ }
+HXLINE( 304) if (::hx::IsNull( result )) {
+HXLINE( 306) return null();
+ }
+ else {
+HXLINE( 304) if ((result->_hx_getIndex() == 0)) {
+HXLINE( 305) ::snikket::Stanza stanza = result->_hx_getObject(0).StaticCast< ::snikket::Stanza >();
+HXDLIN( 305) return stanza;
+ }
+ else {
+HXLINE( 306) return null();
+ }
+ }
+HXLINE( 304) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Stanza_obj,findChild,return )
+
+::String Stanza_obj::findText(::String path){
+ HX_STACKFRAME(&_hx_pos_77777da2cc20dfea_310_findText)
+HXLINE( 311) ::snikket::Node result = this->find(path);
+HXLINE( 312) if (::hx::IsNull( result )) {
+HXLINE( 313) return null();
+ }
+HXLINE( 315) if (::hx::IsNull( result )) {
+HXLINE( 317) return null();
+ }
+ else {
+HXLINE( 315) if ((result->_hx_getIndex() == 1)) {
+HXLINE( 316) ::snikket::TextNode textNode = result->_hx_getObject(0).StaticCast< ::snikket::TextNode >();
+HXDLIN( 316) return textNode->content;
+ }
+ else {
+HXLINE( 317) return null();
+ }
+ }
+HXLINE( 315) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Stanza_obj,findText,return )
+
+ ::snikket::Stanza Stanza_obj::traverse( ::Dynamic f){
+ HX_STACKFRAME(&_hx_pos_77777da2cc20dfea_321_traverse)
+HXLINE( 322) if (!(( (bool)(f(::hx::ObjectPtr<OBJ_>(this))) ))) {
+HXLINE( 323) int _g = 0;
+HXDLIN( 323) ::Array< ::Dynamic> _g1 = this->allTags(null(),null());
+HXDLIN( 323) while((_g < _g1->length)){
+HXLINE( 323) ::snikket::Stanza child = _g1->__get(_g).StaticCast< ::snikket::Stanza >();
+HXDLIN( 323) _g = (_g + 1);
+HXLINE( 324) child->traverse(f);
+ }
+ }
+HXLINE( 327) return ::hx::ObjectPtr<OBJ_>(this);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Stanza_obj,traverse,return )
+
+ ::snikket::StanzaError Stanza_obj::getError(){
+ HX_GC_STACKFRAME(&_hx_pos_77777da2cc20dfea_330_getError)
+HXLINE( 331) ::snikket::Stanza errorTag = this->getChild(HX_("error",c8,cb,29,73),null());
+HXLINE( 332) if (::hx::IsNull( errorTag )) {
+HXLINE( 333) return null();
+ }
+HXLINE( 336) ::String _hx_tmp = ( (::String)(::Reflect_obj::field(errorTag->attr,HX_("type",ba,f2,08,4d))) );
+HXLINE( 337) ::snikket::Stanza tmp = errorTag->getChild(null(),HX_("urn:ietf:params:xml:ns:xmpp-stanzas",27,f2,3d,30));
+HXDLIN( 337) ::String _hx_tmp1;
+HXDLIN( 337) if (::hx::IsNotNull( tmp )) {
+HXLINE( 337) _hx_tmp1 = tmp->name;
+ }
+ else {
+HXLINE( 337) _hx_tmp1 = null();
+ }
+HXLINE( 335) return ::snikket::StanzaError_obj::__alloc( HX_CTX ,_hx_tmp,_hx_tmp1,errorTag->getChildText(HX_("text",ad,cc,f9,4c),HX_("urn:ietf:params:xml:ns:xmpp-stanzas",27,f2,3d,30)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Stanza_obj,getError,return )
+
+void Stanza_obj::removeChildren(::String name,::String xmlns_){
+ HX_STACKFRAME(&_hx_pos_77777da2cc20dfea_342_removeChildren)
+HXLINE( 343) ::String xmlns;
+HXDLIN( 343) ::String tmp = xmlns_;
+HXDLIN( 343) if (::hx::IsNotNull( tmp )) {
+HXLINE( 343) xmlns = tmp;
+ }
+ else {
+HXLINE( 343) xmlns = ( (::String)(::Reflect_obj::field(this->attr,HX_("xmlns",dc,31,74,60))) );
+ }
+HXLINE( 344) ::Array< ::Dynamic> _g = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 344) {
+HXLINE( 344) int _g1 = 0;
+HXDLIN( 344) ::Array< ::Dynamic> _g2 = this->children;
+HXDLIN( 344) while((_g1 < _g2->length)){
+HXLINE( 344) ::snikket::Node v = _g2->__get(_g1).StaticCast< ::snikket::Node >();
+HXDLIN( 344) _g1 = (_g1 + 1);
+HXLINE( 345) bool _hx_tmp;
+HXDLIN( 345) if ((v->_hx_getIndex() == 0)) {
+HXLINE( 346) ::snikket::Stanza c = v->_hx_getObject(0).StaticCast< ::snikket::Stanza >();
+HXLINE( 347) bool _hx_tmp1;
+HXDLIN( 347) bool _hx_tmp2;
+HXDLIN( 347) if (::hx::IsNotNull( name )) {
+HXLINE( 347) _hx_tmp2 = (c->name == name);
+ }
+ else {
+HXLINE( 347) _hx_tmp2 = true;
+ }
+HXDLIN( 347) if (_hx_tmp2) {
+HXLINE( 347) ::String tmp1 = ( (::String)(::Reflect_obj::field(c->attr,HX_("xmlns",dc,31,74,60))) );
+HXDLIN( 347) ::String _hx_tmp3;
+HXDLIN( 347) if (::hx::IsNotNull( tmp1 )) {
+HXLINE( 347) _hx_tmp3 = tmp1;
+ }
+ else {
+HXLINE( 347) _hx_tmp3 = xmlns;
+ }
+HXDLIN( 347) _hx_tmp1 = (_hx_tmp3 == xmlns);
+ }
+ else {
+HXLINE( 347) _hx_tmp1 = false;
+ }
+HXLINE( 345) _hx_tmp = !(_hx_tmp1);
+ }
+ else {
+HXLINE( 345) _hx_tmp = true;
+ }
+HXLINE( 344) if (_hx_tmp) {
+HXLINE( 344) _g->push(v);
+ }
+ }
+ }
+HXDLIN( 344) this->children = _g;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Stanza_obj,removeChildren,(void))
+
+ ::snikket::Stanza Stanza_obj::parse(::String s){
+ HX_STACKFRAME(&_hx_pos_77777da2cc20dfea_95_parse)
+HXDLIN( 95) return ::snikket::Stanza_obj::fromXml(::Xml_obj::parse(s));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Stanza_obj,parse,return )
+
+ ::snikket::Stanza Stanza_obj::fromXml( ::Xml el){
+ HX_GC_STACKFRAME(&_hx_pos_77777da2cc20dfea_100_fromXml)
+HXLINE( 101) if ((el->nodeType == 6)) {
+HXLINE( 102) return ::snikket::Stanza_obj::fromXml(el->firstElement());
+ }
+HXLINE( 105) ::Dynamic attrs = ::Dynamic(::hx::Anon_obj::Create(0));
+HXLINE( 106) {
+HXLINE( 106) ::Dynamic a = el->attributes();
+HXDLIN( 106) while(( (bool)(a->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 106) ::String a1 = ( (::String)(a->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXLINE( 107) {
+HXLINE( 107) ::String value = el->get(a1);
+HXDLIN( 107) ::Reflect_obj::setField(attrs,a1,value);
+ }
+ }
+ }
+HXLINE( 109) if ((el->nodeType != ::Xml_obj::Element)) {
+HXLINE( 109) HX_STACK_DO_THROW((HX_("Bad node type, expected Element but found ",d8,90,8b,bb) + ::_Xml::XmlType_Impl__obj::toString(el->nodeType)));
+ }
+HXDLIN( 109) ::snikket::Stanza stanza = ::snikket::Stanza_obj::__alloc( HX_CTX ,el->nodeName,attrs);
+HXLINE( 110) {
+HXLINE( 110) bool _hx_tmp;
+HXDLIN( 110) if ((el->nodeType != ::Xml_obj::Document)) {
+HXLINE( 110) _hx_tmp = (el->nodeType != ::Xml_obj::Element);
+ }
+ else {
+HXLINE( 110) _hx_tmp = false;
+ }
+HXDLIN( 110) if (_hx_tmp) {
+HXLINE( 110) HX_STACK_DO_THROW((HX_("Bad node type, expected Element or Document but found ",a0,d6,ba,79) + ::_Xml::XmlType_Impl__obj::toString(el->nodeType)));
+ }
+HXDLIN( 110) int _g_current = 0;
+HXDLIN( 110) ::Array< ::Dynamic> _g_array = el->children;
+HXDLIN( 110) while((_g_current < _g_array->length)){
+HXLINE( 110) _g_current = (_g_current + 1);
+HXDLIN( 110) ::Xml child = _g_array->__get((_g_current - 1)).StaticCast< ::Xml >();
+HXLINE( 111) if ((child->nodeType == 0)) {
+HXLINE( 112) stanza->addChild(::snikket::Stanza_obj::fromXml(child));
+ }
+ else {
+HXLINE( 113) bool _hx_tmp1;
+HXDLIN( 113) bool _hx_tmp2;
+HXDLIN( 113) if ((child->nodeType != 5)) {
+HXLINE( 113) _hx_tmp2 = (child->nodeType == 4);
+ }
+ else {
+HXLINE( 113) _hx_tmp2 = true;
+ }
+HXDLIN( 113) if (!(_hx_tmp2)) {
+HXLINE( 113) _hx_tmp1 = (child->nodeType == 3);
+ }
+ else {
+HXLINE( 113) _hx_tmp1 = true;
+ }
+HXDLIN( 113) if (!(_hx_tmp1)) {
+HXLINE( 116) bool _hx_tmp3;
+HXDLIN( 116) if ((child->nodeType != ::Xml_obj::Document)) {
+HXLINE( 116) _hx_tmp3 = (child->nodeType == ::Xml_obj::Element);
+ }
+ else {
+HXLINE( 116) _hx_tmp3 = true;
+ }
+HXDLIN( 116) if (_hx_tmp3) {
+HXLINE( 116) HX_STACK_DO_THROW((HX_("Bad node type, unexpected ",be,79,d5,11) + ::_Xml::XmlType_Impl__obj::toString(child->nodeType)));
+ }
+HXDLIN( 116) stanza->text(child->nodeValue);
+ }
+ }
+ }
+ }
+HXLINE( 119) return stanza;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Stanza_obj,fromXml,return )
+
+bool Stanza_obj::parseXmlBool(::String x){
+ HX_STACKFRAME(&_hx_pos_77777da2cc20dfea_355_parseXmlBool)
+HXDLIN( 355) if ((x != HX_("true",4e,a7,03,4d))) {
+HXDLIN( 355) return (x == HX_("1",31,00,00,00));
+ }
+ else {
+HXDLIN( 355) return true;
+ }
+HXDLIN( 355) return false;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Stanza_obj,parseXmlBool,return )
+
+
+::hx::ObjectPtr< Stanza_obj > Stanza_obj::__new(::String name, ::Dynamic attr) {
+ ::hx::ObjectPtr< Stanza_obj > __this = new Stanza_obj();
+ __this->__construct(name,attr);
+ return __this;
+}
+
+::hx::ObjectPtr< Stanza_obj > Stanza_obj::__alloc(::hx::Ctx *_hx_ctx,::String name, ::Dynamic attr) {
+ Stanza_obj *__this = (Stanza_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Stanza_obj), true, "snikket.Stanza"));
+ *(void **)__this = Stanza_obj::_hx_vtable;
+ __this->__construct(name,attr);
+ return __this;
+}
+
+Stanza_obj::Stanza_obj()
+{
+}
+
+void Stanza_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(Stanza);
+ HX_MARK_MEMBER_NAME(name,"name");
+ HX_MARK_MEMBER_NAME(attr,"attr");
+ HX_MARK_MEMBER_NAME(children,"children");
+ HX_MARK_MEMBER_NAME(last_added,"last_added");
+ HX_MARK_MEMBER_NAME(last_added_stack,"last_added_stack");
+ HX_MARK_END_CLASS();
+}
+
+void Stanza_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(name,"name");
+ HX_VISIT_MEMBER_NAME(attr,"attr");
+ HX_VISIT_MEMBER_NAME(children,"children");
+ HX_VISIT_MEMBER_NAME(last_added,"last_added");
+ HX_VISIT_MEMBER_NAME(last_added_stack,"last_added_stack");
+}
+
+::hx::Val Stanza_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 2:
+ if (HX_FIELD_EQ(inName,"up") ) { return ::hx::Val( up_dyn() ); }
+ break;
+ case 3:
+ if (HX_FIELD_EQ(inName,"tag") ) { return ::hx::Val( tag_dyn() ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"name") ) { return ::hx::Val( name ); }
+ if (HX_FIELD_EQ(inName,"attr") ) { return ::hx::Val( attr ); }
+ if (HX_FIELD_EQ(inName,"text") ) { return ::hx::Val( text_dyn() ); }
+ if (HX_FIELD_EQ(inName,"find") ) { return ::hx::Val( find_dyn() ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"reset") ) { return ::hx::Val( reset_dyn() ); }
+ if (HX_FIELD_EQ(inName,"clone") ) { return ::hx::Val( clone_dyn() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"textTag") ) { return ::hx::Val( textTag_dyn() ); }
+ if (HX_FIELD_EQ(inName,"allTags") ) { return ::hx::Val( allTags_dyn() ); }
+ if (HX_FIELD_EQ(inName,"allText") ) { return ::hx::Val( allText_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getText") ) { return ::hx::Val( getText_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"children") ) { return ::hx::Val( children ); }
+ if (HX_FIELD_EQ(inName,"toString") ) { return ::hx::Val( toString_dyn() ); }
+ if (HX_FIELD_EQ(inName,"addChild") ) { return ::hx::Val( addChild_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getChild") ) { return ::hx::Val( getChild_dyn() ); }
+ if (HX_FIELD_EQ(inName,"findText") ) { return ::hx::Val( findText_dyn() ); }
+ if (HX_FIELD_EQ(inName,"traverse") ) { return ::hx::Val( traverse_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getError") ) { return ::hx::Val( getError_dyn() ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"serialize") ) { return ::hx::Val( serialize_dyn() ); }
+ if (HX_FIELD_EQ(inName,"findChild") ) { return ::hx::Val( findChild_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"last_added") ) { return ::hx::Val( last_added ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"addChildren") ) { return ::hx::Val( addChildren_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getChildren") ) { return ::hx::Val( getChildren_dyn() ); }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"getChildText") ) { return ::hx::Val( getChildText_dyn() ); }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"addChildNodes") ) { return ::hx::Val( addChildNodes_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getFirstChild") ) { return ::hx::Val( getFirstChild_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"addDirectChild") ) { return ::hx::Val( addDirectChild_dyn() ); }
+ if (HX_FIELD_EQ(inName,"removeChildren") ) { return ::hx::Val( removeChildren_dyn() ); }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"last_added_stack") ) { return ::hx::Val( last_added_stack ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool Stanza_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"parse") ) { outValue = parse_dyn(); return true; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"fromXml") ) { outValue = fromXml_dyn(); return true; }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"parseXmlBool") ) { outValue = parseXmlBool_dyn(); return true; }
+ }
+ return false;
+}
+
+::hx::Val Stanza_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"name") ) { name=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"attr") ) { attr=inValue.Cast< ::Dynamic >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"children") ) { children=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"last_added") ) { last_added=inValue.Cast< ::snikket::Stanza >(); return inValue; }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"last_added_stack") ) { last_added_stack=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void Stanza_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("name",4b,72,ff,48));
+ outFields->push(HX_("attr",31,1d,76,40));
+ outFields->push(HX_("children",3f,19,6a,70));
+ outFields->push(HX_("last_added",d7,8a,71,ae));
+ outFields->push(HX_("last_added_stack",a0,74,ae,97));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Stanza_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(Stanza_obj,name),HX_("name",4b,72,ff,48)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(Stanza_obj,attr),HX_("attr",31,1d,76,40)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(Stanza_obj,children),HX_("children",3f,19,6a,70)},
+ {::hx::fsObject /* ::snikket::Stanza */ ,(int)offsetof(Stanza_obj,last_added),HX_("last_added",d7,8a,71,ae)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(Stanza_obj,last_added_stack),HX_("last_added_stack",a0,74,ae,97)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *Stanza_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Stanza_obj_sMemberFields[] = {
+ HX_("name",4b,72,ff,48),
+ HX_("attr",31,1d,76,40),
+ HX_("children",3f,19,6a,70),
+ HX_("last_added",d7,8a,71,ae),
+ HX_("last_added_stack",a0,74,ae,97),
+ HX_("serialize",e0,5d,f2,f4),
+ HX_("toString",ac,d0,6e,38),
+ HX_("tag",5a,5a,58,00),
+ HX_("text",ad,cc,f9,4c),
+ HX_("textTag",ad,af,c7,9e),
+ HX_("up",5b,66,00,00),
+ HX_("reset",cf,49,c8,e6),
+ HX_("addChildren",80,50,c6,a1),
+ HX_("addChildNodes",76,72,83,a8),
+ HX_("addChild",bb,cf,16,bf),
+ HX_("addDirectChild",12,c1,c5,9a),
+ HX_("clone",5d,13,63,48),
+ HX_("allTags",9a,7e,43,57),
+ HX_("allText",6e,96,46,57),
+ HX_("getFirstChild",82,4f,0a,e0),
+ HX_("getChildren",f5,db,5d,96),
+ HX_("getChild",26,b9,90,a5),
+ HX_("getChildText",f3,3c,ee,e7),
+ HX_("getText",63,7c,7c,1f),
+ HX_("find",39,d0,bb,43),
+ HX_("findChild",a3,da,b0,34),
+ HX_("findText",86,d9,8d,9f),
+ HX_("traverse",b2,7d,6a,6c),
+ HX_("getError",52,db,00,d3),
+ HX_("removeChildren",a3,55,c0,3a),
+ ::String(null()) };
+
+::hx::Class Stanza_obj::__mClass;
+
+static ::String Stanza_obj_sStaticFields[] = {
+ HX_("parse",33,90,55,bd),
+ HX_("fromXml",8d,3e,06,58),
+ HX_("parseXmlBool",ae,a9,0b,c8),
+ ::String(null())
+};
+
+void Stanza_obj::__register()
+{
+ Stanza_obj _hx_dummy;
+ Stanza_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.Stanza",e6,91,ae,77);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Stanza_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Stanza_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Stanza_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Stanza_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Stanza_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Stanza_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/StanzaError.cpp b/Sources/c_snikket/src/snikket/StanzaError.cpp
new file mode 100644
index 0000000..a2e5d71
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/StanzaError.cpp
@@ -0,0 +1,129 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_StanzaError
+#include <snikket/StanzaError.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_ba7467be1e1fd22b_46_new,"snikket.StanzaError","new",0x0f7cd1f4,"snikket.StanzaError.new","snikket/Stanza.hx",46,0x3976dc77)
+namespace snikket{
+
+void StanzaError_obj::__construct(::String type_,::String condition_,::String text_){
+ HX_STACKFRAME(&_hx_pos_ba7467be1e1fd22b_46_new)
+HXLINE( 47) this->type = type_;
+HXLINE( 48) this->condition = condition_;
+HXLINE( 49) this->text = text_;
+ }
+
+Dynamic StanzaError_obj::__CreateEmpty() { return new StanzaError_obj; }
+
+void *StanzaError_obj::_hx_vtable = 0;
+
+Dynamic StanzaError_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< StanzaError_obj > _hx_result = new StanzaError_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2]);
+ return _hx_result;
+}
+
+bool StanzaError_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x29697ad6;
+}
+
+
+StanzaError_obj::StanzaError_obj()
+{
+}
+
+void StanzaError_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(StanzaError);
+ HX_MARK_MEMBER_NAME(type,"type");
+ HX_MARK_MEMBER_NAME(condition,"condition");
+ HX_MARK_MEMBER_NAME(text,"text");
+ HX_MARK_END_CLASS();
+}
+
+void StanzaError_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(type,"type");
+ HX_VISIT_MEMBER_NAME(condition,"condition");
+ HX_VISIT_MEMBER_NAME(text,"text");
+}
+
+::hx::Val StanzaError_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"type") ) { return ::hx::Val( type ); }
+ if (HX_FIELD_EQ(inName,"text") ) { return ::hx::Val( text ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"condition") ) { return ::hx::Val( condition ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val StanzaError_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"type") ) { type=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"text") ) { text=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"condition") ) { condition=inValue.Cast< ::String >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void StanzaError_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("type",ba,f2,08,4d));
+ outFields->push(HX_("condition",9b,e9,33,fc));
+ outFields->push(HX_("text",ad,cc,f9,4c));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo StanzaError_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(StanzaError_obj,type),HX_("type",ba,f2,08,4d)},
+ {::hx::fsString,(int)offsetof(StanzaError_obj,condition),HX_("condition",9b,e9,33,fc)},
+ {::hx::fsString,(int)offsetof(StanzaError_obj,text),HX_("text",ad,cc,f9,4c)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *StanzaError_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String StanzaError_obj_sMemberFields[] = {
+ HX_("type",ba,f2,08,4d),
+ HX_("condition",9b,e9,33,fc),
+ HX_("text",ad,cc,f9,4c),
+ ::String(null()) };
+
+::hx::Class StanzaError_obj::__mClass;
+
+void StanzaError_obj::__register()
+{
+ StanzaError_obj _hx_dummy;
+ StanzaError_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.StanzaError",02,08,50,ad);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(StanzaError_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< StanzaError_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = StanzaError_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = StanzaError_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/StringUtil.cpp b/Sources/c_snikket/src/snikket/StringUtil.cpp
new file mode 100644
index 0000000..9aeedac
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/StringUtil.cpp
@@ -0,0 +1,146 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_StringUtil
+#include <snikket/StringUtil.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_822834b6e2c15b3f_5_codepointArray,"snikket.StringUtil","codepointArray",0xa6625de0,"snikket.StringUtil.codepointArray","snikket/StringUtil.hx",5,0xe08372b9)
+HX_LOCAL_STACK_FRAME(_hx_pos_822834b6e2c15b3f_27_rawCodepointArray,"snikket.StringUtil","rawCodepointArray",0xf5a4e194,"snikket.StringUtil.rawCodepointArray","snikket/StringUtil.hx",27,0xe08372b9)
+namespace snikket{
+
+void StringUtil_obj::__construct() { }
+
+Dynamic StringUtil_obj::__CreateEmpty() { return new StringUtil_obj; }
+
+void *StringUtil_obj::_hx_vtable = 0;
+
+Dynamic StringUtil_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< StringUtil_obj > _hx_result = new StringUtil_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool StringUtil_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x537b2d90;
+}
+
+::Array< ::String > StringUtil_obj::codepointArray(::String s){
+ HX_STACKFRAME(&_hx_pos_822834b6e2c15b3f_5_codepointArray)
+HXLINE( 6) ::Array< ::String > result = ::Array_obj< ::String >::__new(0);
+HXLINE( 7) int offset = 0;
+HXLINE( 8) while((offset < s.length)){
+HXLINE( 10) int c = s.cca(offset);
+HXDLIN( 10) bool _hx_tmp;
+HXDLIN( 10) if ((c >= 55296)) {
+HXLINE( 10) _hx_tmp = (c <= 56319);
+ }
+ else {
+HXLINE( 10) _hx_tmp = false;
+ }
+HXDLIN( 10) if (_hx_tmp) {
+HXLINE( 10) c = (((c - 55232) << 10) | (s.cca((offset + 1)) & 1023));
+ }
+HXDLIN( 10) int c1 = c;
+HXLINE( 11) if ((c1 >= 65536)) {
+HXLINE( 12) result->push(s.substr(offset,2));
+HXLINE( 13) offset = (offset + 1);
+ }
+ else {
+HXLINE( 15) result->push(s.substr(offset,1));
+ }
+HXLINE( 17) offset = (offset + 1);
+ }
+HXLINE( 23) return result;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(StringUtil_obj,codepointArray,return )
+
+::Array< int > StringUtil_obj::rawCodepointArray(::String s){
+ HX_STACKFRAME(&_hx_pos_822834b6e2c15b3f_27_rawCodepointArray)
+HXLINE( 28) ::Array< int > result = ::Array_obj< int >::__new(0);
+HXLINE( 29) int offset = 0;
+HXLINE( 30) while((offset < s.length)){
+HXLINE( 32) int c = s.cca(offset);
+HXDLIN( 32) bool _hx_tmp;
+HXDLIN( 32) if ((c >= 55296)) {
+HXLINE( 32) _hx_tmp = (c <= 56319);
+ }
+ else {
+HXLINE( 32) _hx_tmp = false;
+ }
+HXDLIN( 32) if (_hx_tmp) {
+HXLINE( 32) c = (((c - 55232) << 10) | (s.cca((offset + 1)) & 1023));
+ }
+HXDLIN( 32) int c1 = c;
+HXLINE( 33) if ((c1 >= 65536)) {
+HXLINE( 34) result->push(c1);
+HXLINE( 35) offset = (offset + 1);
+ }
+ else {
+HXLINE( 37) result->push(c1);
+ }
+HXLINE( 39) offset = (offset + 1);
+ }
+HXLINE( 45) return result;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(StringUtil_obj,rawCodepointArray,return )
+
+
+StringUtil_obj::StringUtil_obj()
+{
+}
+
+bool StringUtil_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 14:
+ if (HX_FIELD_EQ(inName,"codepointArray") ) { outValue = codepointArray_dyn(); return true; }
+ break;
+ case 17:
+ if (HX_FIELD_EQ(inName,"rawCodepointArray") ) { outValue = rawCodepointArray_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *StringUtil_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *StringUtil_obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class StringUtil_obj::__mClass;
+
+static ::String StringUtil_obj_sStaticFields[] = {
+ HX_("codepointArray",96,52,52,13),
+ HX_("rawCodepointArray",9e,42,72,c8),
+ ::String(null())
+};
+
+void StringUtil_obj::__register()
+{
+ StringUtil_obj _hx_dummy;
+ StringUtil_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.StringUtil",e4,69,09,4c);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &StringUtil_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(StringUtil_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< StringUtil_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = StringUtil_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = StringUtil_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/Symbol.cpp b/Sources/c_snikket/src/snikket/Symbol.cpp
new file mode 100644
index 0000000..83134ab
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/Symbol.cpp
@@ -0,0 +1,133 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_StringBuf
+#include <StringBuf.h>
+#endif
+#ifndef INCLUDED_snikket_Symbol
+#include <snikket/Symbol.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_5e979c9c456edc1e_119_new,"snikket.Symbol","new",0x573e5cbb,"snikket.Symbol.new","snikket/EmojiUtil.hx",119,0x30de6948)
+namespace snikket{
+
+void Symbol_obj::__construct(::Array< int > codepoints){
+ HX_GC_STACKFRAME(&_hx_pos_5e979c9c456edc1e_119_new)
+HXLINE( 120) ::StringBuf builder = ::StringBuf_obj::__alloc( HX_CTX );
+HXLINE( 121) {
+HXLINE( 121) int _g = 0;
+HXDLIN( 121) while((_g < codepoints->length)){
+HXLINE( 121) int codepoint = codepoints->__get(_g);
+HXDLIN( 121) _g = (_g + 1);
+HXLINE( 122) if ((codepoint >= 127)) {
+HXLINE( 122) ::String x = ::String::fromCharCode(codepoint);
+HXDLIN( 122) if (::hx::IsNotNull( builder->charBuf )) {
+HXLINE( 122) builder->flush();
+ }
+HXDLIN( 122) if (::hx::IsNull( builder->b )) {
+HXLINE( 122) builder->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x));
+ }
+ else {
+HXLINE( 122) ::Array< ::String > builder1 = builder->b;
+HXDLIN( 122) builder1->push(::Std_obj::string(x));
+ }
+ }
+ else {
+HXLINE( 122) if (::hx::IsNull( builder->charBuf )) {
+HXLINE( 122) builder->charBuf = ::Array_obj< char >::__new();
+ }
+HXDLIN( 122) builder->charBuf->push(codepoint);
+ }
+ }
+ }
+HXLINE( 124) this->value = builder->toString();
+ }
+
+bool Symbol_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x4b1860f5;
+}
+
+HX_DEFINE_DYNAMIC_FUNC0(Symbol_obj,isEmoji,return )
+
+
+Symbol_obj::Symbol_obj()
+{
+}
+
+void Symbol_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(Symbol);
+ HX_MARK_MEMBER_NAME(value,"value");
+ HX_MARK_END_CLASS();
+}
+
+void Symbol_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(value,"value");
+}
+
+::hx::Val Symbol_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"value") ) { return ::hx::Val( value ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"isEmoji") ) { return ::hx::Val( isEmoji_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val Symbol_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"value") ) { value=inValue.Cast< ::String >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void Symbol_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("value",71,7f,b8,31));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Symbol_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(Symbol_obj,value),HX_("value",71,7f,b8,31)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *Symbol_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Symbol_obj_sMemberFields[] = {
+ HX_("value",71,7f,b8,31),
+ HX_("isEmoji",3c,13,5f,0c),
+ ::String(null()) };
+
+::hx::Class Symbol_obj::__mClass;
+
+void Symbol_obj::__register()
+{
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.Symbol",49,e3,94,60);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Symbol_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Symbol_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Symbol_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Symbol_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/TextNode.cpp b/Sources/c_snikket/src/snikket/TextNode.cpp
new file mode 100644
index 0000000..827554b
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/TextNode.cpp
@@ -0,0 +1,190 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket_TextNode
+#include <snikket/TextNode.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket__Util_Util_Fields_
+#include <snikket/_Util/Util_Fields_.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_569d48ca5cc29925_21_new,"snikket.TextNode","new",0x132f9072,"snikket.TextNode.new","snikket/Stanza.hx",21,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_569d48ca5cc29925_29_serialize,"snikket.TextNode","serialize",0x23a07772,"snikket.TextNode.serialize","snikket/Stanza.hx",29,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_569d48ca5cc29925_33_clone,"snikket.TextNode","clone",0x99bc7bef,"snikket.TextNode.clone","snikket/Stanza.hx",33,0x3976dc77)
+HX_LOCAL_STACK_FRAME(_hx_pos_569d48ca5cc29925_37_traverse,"snikket.TextNode","traverse",0xd7633c60,"snikket.TextNode.traverse","snikket/Stanza.hx",37,0x3976dc77)
+namespace snikket{
+
+void TextNode_obj::__construct(::String content){
+ HX_STACKFRAME(&_hx_pos_569d48ca5cc29925_21_new)
+HXLINE( 22) this->content = HX_("",00,00,00,00);
+HXLINE( 25) this->content = content;
+ }
+
+Dynamic TextNode_obj::__CreateEmpty() { return new TextNode_obj; }
+
+void *TextNode_obj::_hx_vtable = 0;
+
+Dynamic TextNode_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< TextNode_obj > _hx_result = new TextNode_obj();
+ _hx_result->__construct(inArgs[0]);
+ return _hx_result;
+}
+
+bool TextNode_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x3185702c;
+}
+
+static ::snikket::_Stanza::NodeInterface_obj _hx_snikket_TextNode__hx_snikket__Stanza_NodeInterface= {
+ ( ::String (::hx::Object::*)())&::snikket::TextNode_obj::serialize,
+ ( ::Dynamic (::hx::Object::*)( ::Dynamic))&::snikket::TextNode_obj::traverse_881a854a,
+};
+
+::Dynamic TextNode_obj::traverse_881a854a( ::Dynamic f) {
+ return traverse(f);
+}
+void *TextNode_obj::_hx_getInterface(int inHash) {
+ switch(inHash) {
+ case (int)0xc837e580: return &_hx_snikket_TextNode__hx_snikket__Stanza_NodeInterface;
+ }
+ #ifdef HXCPP_SCRIPTABLE
+ return super::_hx_getInterface(inHash);
+ #else
+ return 0;
+ #endif
+}
+
+::String TextNode_obj::serialize(){
+ HX_STACKFRAME(&_hx_pos_569d48ca5cc29925_29_serialize)
+HXDLIN( 29) return ::snikket::_Util::Util_Fields__obj::xmlEscape(this->content);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(TextNode_obj,serialize,return )
+
+ ::snikket::TextNode TextNode_obj::clone(){
+ HX_GC_STACKFRAME(&_hx_pos_569d48ca5cc29925_33_clone)
+HXDLIN( 33) return ::snikket::TextNode_obj::__alloc( HX_CTX ,this->content);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(TextNode_obj,clone,return )
+
+ ::snikket::TextNode TextNode_obj::traverse( ::Dynamic f){
+ HX_STACKFRAME(&_hx_pos_569d48ca5cc29925_37_traverse)
+HXDLIN( 37) return ::hx::ObjectPtr<OBJ_>(this);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(TextNode_obj,traverse,return )
+
+
+::hx::ObjectPtr< TextNode_obj > TextNode_obj::__new(::String content) {
+ ::hx::ObjectPtr< TextNode_obj > __this = new TextNode_obj();
+ __this->__construct(content);
+ return __this;
+}
+
+::hx::ObjectPtr< TextNode_obj > TextNode_obj::__alloc(::hx::Ctx *_hx_ctx,::String content) {
+ TextNode_obj *__this = (TextNode_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(TextNode_obj), true, "snikket.TextNode"));
+ *(void **)__this = TextNode_obj::_hx_vtable;
+ __this->__construct(content);
+ return __this;
+}
+
+TextNode_obj::TextNode_obj()
+{
+}
+
+void TextNode_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(TextNode);
+ HX_MARK_MEMBER_NAME(content,"content");
+ HX_MARK_END_CLASS();
+}
+
+void TextNode_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(content,"content");
+}
+
+::hx::Val TextNode_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"clone") ) { return ::hx::Val( clone_dyn() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"content") ) { return ::hx::Val( content ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"traverse") ) { return ::hx::Val( traverse_dyn() ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"serialize") ) { return ::hx::Val( serialize_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val TextNode_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 7:
+ if (HX_FIELD_EQ(inName,"content") ) { content=inValue.Cast< ::String >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void TextNode_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("content",39,8d,77,19));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo TextNode_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(TextNode_obj,content),HX_("content",39,8d,77,19)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *TextNode_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String TextNode_obj_sMemberFields[] = {
+ HX_("content",39,8d,77,19),
+ HX_("serialize",e0,5d,f2,f4),
+ HX_("clone",5d,13,63,48),
+ HX_("traverse",b2,7d,6a,6c),
+ ::String(null()) };
+
+::hx::Class TextNode_obj::__mClass;
+
+void TextNode_obj::__register()
+{
+ TextNode_obj _hx_dummy;
+ TextNode_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.TextNode",80,2f,e6,00);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(TextNode_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< TextNode_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = TextNode_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = TextNode_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/UnicodeBlocks.cpp b/Sources/c_snikket/src/snikket/UnicodeBlocks.cpp
new file mode 100644
index 0000000..96300d7
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/UnicodeBlocks.cpp
@@ -0,0 +1,164 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_UnicodeBlocks
+#include <snikket/UnicodeBlocks.h>
+#endif
+#ifndef INCLUDED_snikket_UnicodeSet
+#include <snikket/UnicodeSet.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_1b68aeb3a5bc5b76_217_new,"snikket.UnicodeBlocks","new",0xbdc765a4,"snikket.UnicodeBlocks.new","snikket/EmojiUtil.hx",217,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_1b68aeb3a5bc5b76_220_contains,"snikket.UnicodeBlocks","contains",0x2b302e5b,"snikket.UnicodeBlocks.contains","snikket/EmojiUtil.hx",220,0x30de6948)
+namespace snikket{
+
+void UnicodeBlocks_obj::__construct(::Array< ::Dynamic> sets){
+ HX_STACKFRAME(&_hx_pos_1b68aeb3a5bc5b76_217_new)
+HXDLIN( 217) this->unicodeSets = sets->copy();
+ }
+
+Dynamic UnicodeBlocks_obj::__CreateEmpty() { return new UnicodeBlocks_obj; }
+
+void *UnicodeBlocks_obj::_hx_vtable = 0;
+
+Dynamic UnicodeBlocks_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< UnicodeBlocks_obj > _hx_result = new UnicodeBlocks_obj();
+ _hx_result->__construct(inArgs[0]);
+ return _hx_result;
+}
+
+bool UnicodeBlocks_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x5ff5d386;
+}
+
+static ::snikket::UnicodeSet_obj _hx_snikket_UnicodeBlocks__hx_snikket_UnicodeSet= {
+ ( bool (::hx::Object::*)(int))&::snikket::UnicodeBlocks_obj::contains,
+};
+
+void *UnicodeBlocks_obj::_hx_getInterface(int inHash) {
+ switch(inHash) {
+ case (int)0x29205162: return &_hx_snikket_UnicodeBlocks__hx_snikket_UnicodeSet;
+ }
+ #ifdef HXCPP_SCRIPTABLE
+ return super::_hx_getInterface(inHash);
+ #else
+ return 0;
+ #endif
+}
+
+bool UnicodeBlocks_obj::contains(int codepoint){
+ HX_STACKFRAME(&_hx_pos_1b68aeb3a5bc5b76_220_contains)
+HXLINE( 221) {
+HXLINE( 221) int _g = 0;
+HXDLIN( 221) ::Array< ::Dynamic> _g1 = this->unicodeSets;
+HXDLIN( 221) while((_g < _g1->length)){
+HXLINE( 221) ::Dynamic unicodeSet = _g1->__get(_g);
+HXDLIN( 221) _g = (_g + 1);
+HXLINE( 222) if (::snikket::UnicodeSet_obj::contains(unicodeSet,codepoint)) {
+HXLINE( 223) return true;
+ }
+ }
+ }
+HXLINE( 226) return false;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(UnicodeBlocks_obj,contains,return )
+
+
+::hx::ObjectPtr< UnicodeBlocks_obj > UnicodeBlocks_obj::__new(::Array< ::Dynamic> sets) {
+ ::hx::ObjectPtr< UnicodeBlocks_obj > __this = new UnicodeBlocks_obj();
+ __this->__construct(sets);
+ return __this;
+}
+
+::hx::ObjectPtr< UnicodeBlocks_obj > UnicodeBlocks_obj::__alloc(::hx::Ctx *_hx_ctx,::Array< ::Dynamic> sets) {
+ UnicodeBlocks_obj *__this = (UnicodeBlocks_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(UnicodeBlocks_obj), true, "snikket.UnicodeBlocks"));
+ *(void **)__this = UnicodeBlocks_obj::_hx_vtable;
+ __this->__construct(sets);
+ return __this;
+}
+
+UnicodeBlocks_obj::UnicodeBlocks_obj()
+{
+}
+
+void UnicodeBlocks_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(UnicodeBlocks);
+ HX_MARK_MEMBER_NAME(unicodeSets,"unicodeSets");
+ HX_MARK_END_CLASS();
+}
+
+void UnicodeBlocks_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(unicodeSets,"unicodeSets");
+}
+
+::hx::Val UnicodeBlocks_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 8:
+ if (HX_FIELD_EQ(inName,"contains") ) { return ::hx::Val( contains_dyn() ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"unicodeSets") ) { return ::hx::Val( unicodeSets ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val UnicodeBlocks_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 11:
+ if (HX_FIELD_EQ(inName,"unicodeSets") ) { unicodeSets=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void UnicodeBlocks_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("unicodeSets",4e,a2,4d,8b));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo UnicodeBlocks_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(UnicodeBlocks_obj,unicodeSets),HX_("unicodeSets",4e,a2,4d,8b)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *UnicodeBlocks_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String UnicodeBlocks_obj_sMemberFields[] = {
+ HX_("unicodeSets",4e,a2,4d,8b),
+ HX_("contains",1f,5a,7b,2c),
+ ::String(null()) };
+
+::hx::Class UnicodeBlocks_obj::__mClass;
+
+void UnicodeBlocks_obj::__register()
+{
+ UnicodeBlocks_obj _hx_dummy;
+ UnicodeBlocks_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.UnicodeBlocks",b2,03,7b,94);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(UnicodeBlocks_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< UnicodeBlocks_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = UnicodeBlocks_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = UnicodeBlocks_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/UnicodeList.cpp b/Sources/c_snikket/src/snikket/UnicodeList.cpp
new file mode 100644
index 0000000..68b1ded
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/UnicodeList.cpp
@@ -0,0 +1,153 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_UnicodeList
+#include <snikket/UnicodeList.h>
+#endif
+#ifndef INCLUDED_snikket_UnicodeSet
+#include <snikket/UnicodeSet.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_264b7c49b2387122_238_new,"snikket.UnicodeList","new",0xe628bc7c,"snikket.UnicodeList.new","snikket/EmojiUtil.hx",238,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_264b7c49b2387122_242_contains,"snikket.UnicodeList","contains",0x114d0883,"snikket.UnicodeList.contains","snikket/EmojiUtil.hx",242,0x30de6948)
+namespace snikket{
+
+void UnicodeList_obj::__construct(::Array< int > codes){
+ HX_STACKFRAME(&_hx_pos_264b7c49b2387122_238_new)
+HXDLIN( 238) this->list = codes->copy();
+ }
+
+Dynamic UnicodeList_obj::__CreateEmpty() { return new UnicodeList_obj; }
+
+void *UnicodeList_obj::_hx_vtable = 0;
+
+Dynamic UnicodeList_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< UnicodeList_obj > _hx_result = new UnicodeList_obj();
+ _hx_result->__construct(inArgs[0]);
+ return _hx_result;
+}
+
+bool UnicodeList_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x002205b6;
+}
+
+static ::snikket::UnicodeSet_obj _hx_snikket_UnicodeList__hx_snikket_UnicodeSet= {
+ ( bool (::hx::Object::*)(int))&::snikket::UnicodeList_obj::contains,
+};
+
+void *UnicodeList_obj::_hx_getInterface(int inHash) {
+ switch(inHash) {
+ case (int)0x29205162: return &_hx_snikket_UnicodeList__hx_snikket_UnicodeSet;
+ }
+ #ifdef HXCPP_SCRIPTABLE
+ return super::_hx_getInterface(inHash);
+ #else
+ return 0;
+ #endif
+}
+
+bool UnicodeList_obj::contains(int codepoint){
+ HX_STACKFRAME(&_hx_pos_264b7c49b2387122_242_contains)
+HXDLIN( 242) return this->list->contains(codepoint);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(UnicodeList_obj,contains,return )
+
+
+::hx::ObjectPtr< UnicodeList_obj > UnicodeList_obj::__new(::Array< int > codes) {
+ ::hx::ObjectPtr< UnicodeList_obj > __this = new UnicodeList_obj();
+ __this->__construct(codes);
+ return __this;
+}
+
+::hx::ObjectPtr< UnicodeList_obj > UnicodeList_obj::__alloc(::hx::Ctx *_hx_ctx,::Array< int > codes) {
+ UnicodeList_obj *__this = (UnicodeList_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(UnicodeList_obj), true, "snikket.UnicodeList"));
+ *(void **)__this = UnicodeList_obj::_hx_vtable;
+ __this->__construct(codes);
+ return __this;
+}
+
+UnicodeList_obj::UnicodeList_obj()
+{
+}
+
+void UnicodeList_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(UnicodeList);
+ HX_MARK_MEMBER_NAME(list,"list");
+ HX_MARK_END_CLASS();
+}
+
+void UnicodeList_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(list,"list");
+}
+
+::hx::Val UnicodeList_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"list") ) { return ::hx::Val( list ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"contains") ) { return ::hx::Val( contains_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val UnicodeList_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"list") ) { list=inValue.Cast< ::Array< int > >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void UnicodeList_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("list",5e,1c,b3,47));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo UnicodeList_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::Array< int > */ ,(int)offsetof(UnicodeList_obj,list),HX_("list",5e,1c,b3,47)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *UnicodeList_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String UnicodeList_obj_sMemberFields[] = {
+ HX_("list",5e,1c,b3,47),
+ HX_("contains",1f,5a,7b,2c),
+ ::String(null()) };
+
+::hx::Class UnicodeList_obj::__mClass;
+
+void UnicodeList_obj::__register()
+{
+ UnicodeList_obj _hx_dummy;
+ UnicodeList_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.UnicodeList",8a,0e,02,0d);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(UnicodeList_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< UnicodeList_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = UnicodeList_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = UnicodeList_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/UnicodeRange.cpp b/Sources/c_snikket/src/snikket/UnicodeRange.cpp
new file mode 100644
index 0000000..f1fbfc1
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/UnicodeRange.cpp
@@ -0,0 +1,153 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_UnicodeRange
+#include <snikket/UnicodeRange.h>
+#endif
+#ifndef INCLUDED_snikket_UnicodeSet
+#include <snikket/UnicodeSet.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_bbac38099343b7ff_250_new,"snikket.UnicodeRange","new",0x23c51783,"snikket.UnicodeRange.new","snikket/EmojiUtil.hx",250,0x30de6948)
+HX_LOCAL_STACK_FRAME(_hx_pos_bbac38099343b7ff_256_contains,"snikket.UnicodeRange","contains",0x4486541c,"snikket.UnicodeRange.contains","snikket/EmojiUtil.hx",256,0x30de6948)
+namespace snikket{
+
+void UnicodeRange_obj::__construct(int lower,int upper){
+ HX_STACKFRAME(&_hx_pos_bbac38099343b7ff_250_new)
+HXLINE( 251) this->lower = lower;
+HXLINE( 252) this->upper = upper;
+ }
+
+Dynamic UnicodeRange_obj::__CreateEmpty() { return new UnicodeRange_obj; }
+
+void *UnicodeRange_obj::_hx_vtable = 0;
+
+Dynamic UnicodeRange_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< UnicodeRange_obj > _hx_result = new UnicodeRange_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1]);
+ return _hx_result;
+}
+
+bool UnicodeRange_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x25d72cd9;
+}
+
+static ::snikket::UnicodeSet_obj _hx_snikket_UnicodeRange__hx_snikket_UnicodeSet= {
+ ( bool (::hx::Object::*)(int))&::snikket::UnicodeRange_obj::contains,
+};
+
+void *UnicodeRange_obj::_hx_getInterface(int inHash) {
+ switch(inHash) {
+ case (int)0x29205162: return &_hx_snikket_UnicodeRange__hx_snikket_UnicodeSet;
+ }
+ #ifdef HXCPP_SCRIPTABLE
+ return super::_hx_getInterface(inHash);
+ #else
+ return 0;
+ #endif
+}
+
+bool UnicodeRange_obj::contains(int codePoint){
+ HX_STACKFRAME(&_hx_pos_bbac38099343b7ff_256_contains)
+HXDLIN( 256) if ((codePoint >= this->lower)) {
+HXDLIN( 256) return (codePoint <= this->upper);
+ }
+ else {
+HXDLIN( 256) return false;
+ }
+HXDLIN( 256) return false;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(UnicodeRange_obj,contains,return )
+
+
+::hx::ObjectPtr< UnicodeRange_obj > UnicodeRange_obj::__new(int lower,int upper) {
+ ::hx::ObjectPtr< UnicodeRange_obj > __this = new UnicodeRange_obj();
+ __this->__construct(lower,upper);
+ return __this;
+}
+
+::hx::ObjectPtr< UnicodeRange_obj > UnicodeRange_obj::__alloc(::hx::Ctx *_hx_ctx,int lower,int upper) {
+ UnicodeRange_obj *__this = (UnicodeRange_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(UnicodeRange_obj), false, "snikket.UnicodeRange"));
+ *(void **)__this = UnicodeRange_obj::_hx_vtable;
+ __this->__construct(lower,upper);
+ return __this;
+}
+
+UnicodeRange_obj::UnicodeRange_obj()
+{
+}
+
+::hx::Val UnicodeRange_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"lower") ) { return ::hx::Val( lower ); }
+ if (HX_FIELD_EQ(inName,"upper") ) { return ::hx::Val( upper ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"contains") ) { return ::hx::Val( contains_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val UnicodeRange_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"lower") ) { lower=inValue.Cast< int >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"upper") ) { upper=inValue.Cast< int >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void UnicodeRange_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("lower",01,fa,ff,78));
+ outFields->push(HX_("upper",62,19,3f,a8));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo UnicodeRange_obj_sMemberStorageInfo[] = {
+ {::hx::fsInt,(int)offsetof(UnicodeRange_obj,lower),HX_("lower",01,fa,ff,78)},
+ {::hx::fsInt,(int)offsetof(UnicodeRange_obj,upper),HX_("upper",62,19,3f,a8)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *UnicodeRange_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String UnicodeRange_obj_sMemberFields[] = {
+ HX_("lower",01,fa,ff,78),
+ HX_("upper",62,19,3f,a8),
+ HX_("contains",1f,5a,7b,2c),
+ ::String(null()) };
+
+::hx::Class UnicodeRange_obj::__mClass;
+
+void UnicodeRange_obj::__register()
+{
+ UnicodeRange_obj _hx_dummy;
+ UnicodeRange_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.UnicodeRange",11,9a,e4,c3);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(UnicodeRange_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< UnicodeRange_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = UnicodeRange_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = UnicodeRange_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/UnicodeSet.cpp b/Sources/c_snikket/src/snikket/UnicodeSet.cpp
new file mode 100644
index 0000000..60002d5
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/UnicodeSet.cpp
@@ -0,0 +1,27 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_UnicodeSet
+#include <snikket/UnicodeSet.h>
+#endif
+
+namespace snikket{
+
+
+static ::String UnicodeSet_obj_sMemberFields[] = {
+ HX_("contains",1f,5a,7b,2c),
+ ::String(null()) };
+
+::hx::Class UnicodeSet_obj::__mClass;
+
+void UnicodeSet_obj::__register()
+{
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.UnicodeSet",f6,12,51,95);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(UnicodeSet_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TIsInterface< (int)0x29205162 >;
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/XEP0393.cpp b/Sources/c_snikket/src/snikket/XEP0393.cpp
new file mode 100644
index 0000000..4980896
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/XEP0393.cpp
@@ -0,0 +1,774 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_EReg
+#include <EReg.h>
+#endif
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_StringBuf
+#include <StringBuf.h>
+#endif
+#ifndef INCLUDED_StringTools
+#include <StringTools.h>
+#endif
+#ifndef INCLUDED__UnicodeString_UnicodeString_Impl_
+#include <_UnicodeString/UnicodeString_Impl_.h>
+#endif
+#ifndef INCLUDED_haxe_Exception
+#include <haxe/Exception.h>
+#endif
+#ifndef INCLUDED_haxe_Log
+#include <haxe/Log.h>
+#endif
+#ifndef INCLUDED_snikket_Autolink
+#include <snikket/Autolink.h>
+#endif
+#ifndef INCLUDED_snikket_Node
+#include <snikket/Node.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket_TextNode
+#include <snikket/TextNode.h>
+#endif
+#ifndef INCLUDED_snikket_XEP0393
+#include <snikket/XEP0393.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_100c160c0c16a433_7_parse,"snikket.XEP0393","parse",0x13882074,"snikket.XEP0393.parse","snikket/XEP0393.hx",7,0xcee3f370)
+HX_LOCAL_STACK_FRAME(_hx_pos_100c160c0c16a433_21_render,"snikket.XEP0393","render",0x1b3513f5,"snikket.XEP0393.render","snikket/XEP0393.hx",21,0xcee3f370)
+static const ::String _hx_array_data_533559ef_4[] = {
+ HX_("\n```\n",b4,74,bf,01),
+};
+static const ::String _hx_array_data_533559ef_5[] = {
+ HX_("*",2a,00,00,00),
+};
+static const ::String _hx_array_data_533559ef_6[] = {
+ HX_("_",5f,00,00,00),
+};
+static const ::String _hx_array_data_533559ef_7[] = {
+ HX_("~",7e,00,00,00),
+};
+static const ::String _hx_array_data_533559ef_8[] = {
+ HX_("`",60,00,00,00),
+};
+static const ::String _hx_array_data_533559ef_9[] = {
+ HX_("*",2a,00,00,00),
+};
+static const ::String _hx_array_data_533559ef_10[] = {
+ HX_("_",5f,00,00,00),
+};
+static const ::String _hx_array_data_533559ef_11[] = {
+ HX_("~",7e,00,00,00),
+};
+static const ::String _hx_array_data_533559ef_12[] = {
+ HX_("`",60,00,00,00),
+};
+static const ::String _hx_array_data_533559ef_13[] = {
+ HX_("\n",0a,00,00,00),
+};
+static const ::String _hx_array_data_533559ef_14[] = {
+ HX_("```\n",aa,a7,bd,3f),
+};
+HX_LOCAL_STACK_FRAME(_hx_pos_100c160c0c16a433_88_renderNode,"snikket.XEP0393","renderNode",0x3bc9e897,"snikket.XEP0393.renderNode","snikket/XEP0393.hx",88,0xcee3f370)
+HX_LOCAL_STACK_FRAME(_hx_pos_100c160c0c16a433_94_parseSpans,"snikket.XEP0393","parseSpans",0x00fdc155,"snikket.XEP0393.parseSpans","snikket/XEP0393.hx",94,0xcee3f370)
+HX_LOCAL_STACK_FRAME(_hx_pos_100c160c0c16a433_140_parseSpan,"snikket.XEP0393","parseSpan",0x4bc5715e,"snikket.XEP0393.parseSpan","snikket/XEP0393.hx",140,0xcee3f370)
+HX_LOCAL_STACK_FRAME(_hx_pos_100c160c0c16a433_160_parseBlock,"snikket.XEP0393","parseBlock",0x3493a039,"snikket.XEP0393.parseBlock","snikket/XEP0393.hx",160,0xcee3f370)
+HX_LOCAL_STACK_FRAME(_hx_pos_100c160c0c16a433_172_parseQuote,"snikket.XEP0393","parseQuote",0xdd894e28,"snikket.XEP0393.parseQuote","snikket/XEP0393.hx",172,0xcee3f370)
+HX_LOCAL_STACK_FRAME(_hx_pos_100c160c0c16a433_199_parsePreformatted,"snikket.XEP0393","parsePreformatted",0xd018390d,"snikket.XEP0393.parsePreformatted","snikket/XEP0393.hx",199,0xcee3f370)
+namespace snikket{
+
+void XEP0393_obj::__construct() { }
+
+Dynamic XEP0393_obj::__CreateEmpty() { return new XEP0393_obj; }
+
+void *XEP0393_obj::_hx_vtable = 0;
+
+Dynamic XEP0393_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< XEP0393_obj > _hx_result = new XEP0393_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool XEP0393_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x794b61b7;
+}
+
+ ::Dynamic XEP0393_obj::parse(::String styled){
+ HX_STACKFRAME(&_hx_pos_100c160c0c16a433_7_parse)
+HXLINE( 8) ::Array< ::Dynamic> blocks = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 9) try {
+ HX_STACK_CATCHABLE( ::Dynamic, 0);
+HXLINE( 10) while((::_UnicodeString::UnicodeString_Impl__obj::get_length(styled) > 0)){
+HXLINE( 11) ::Dynamic result = ::snikket::XEP0393_obj::parseBlock(styled);
+HXLINE( 12) styled = ( (::String)(result->__Field(HX_("rest",14,5b,a7,4b),::hx::paccDynamic)) );
+HXLINE( 13) blocks->push( ::Dynamic(result->__Field(HX_("block",4d,75,fc,b4),::hx::paccDynamic)));
+ }
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::Dynamic >() ){
+ HX_STACK_BEGIN_CATCH
+ ::Dynamic _g = _hx_e;
+HXLINE( 15) ::haxe::Exception e = ::haxe::Exception_obj::caught(_g);
+HXLINE( 16) ::haxe::Log_obj::trace(HX_("WUT",76,4e,42,00), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.XEP0393",ef,59,35,53))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,e))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("parse",33,90,55,bd))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/XEP0393.hx",70,f3,e3,ce))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),16)));
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+HXLINE( 18) return blocks;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(XEP0393_obj,parse,return )
+
+::String XEP0393_obj::render( ::snikket::Stanza xhtml){
+ HX_GC_STACKFRAME(&_hx_pos_100c160c0c16a433_21_render)
+HXLINE( 22) if ((xhtml->name == HX_("br",d0,55,00,00))) {
+HXLINE( 23) return HX_("\n",0a,00,00,00);
+ }
+HXLINE( 26) if ((xhtml->name == HX_("img",03,0c,50,00))) {
+HXLINE( 27) ::String tmp = ( (::String)(::Reflect_obj::field(xhtml->attr,HX_("alt",29,f9,49,00))) );
+HXDLIN( 27) if (::hx::IsNotNull( tmp )) {
+HXLINE( 27) return tmp;
+ }
+ else {
+HXLINE( 27) return HX_("",00,00,00,00);
+ }
+ }
+HXLINE( 30) ::StringBuf s = ::StringBuf_obj::__alloc( HX_CTX );
+HXLINE( 32) if ((xhtml->name == HX_("pre",23,60,55,00))) {
+HXLINE( 33) if (::hx::IsNotNull( s->charBuf )) {
+HXLINE( 33) s->flush();
+ }
+HXDLIN( 33) if (::hx::IsNull( s->b )) {
+HXLINE( 33) s->b = ::Array_obj< ::String >::fromData( _hx_array_data_533559ef_4,1);
+ }
+ else {
+HXLINE( 33) s->b->push(HX_("\n```\n",b4,74,bf,01));
+ }
+ }
+HXLINE( 36) bool _hx_tmp;
+HXDLIN( 36) if ((xhtml->name != HX_("b",62,00,00,00))) {
+HXLINE( 36) _hx_tmp = (xhtml->name == HX_("strong",57,b6,34,11));
+ }
+ else {
+HXLINE( 36) _hx_tmp = true;
+ }
+HXDLIN( 36) if (_hx_tmp) {
+HXLINE( 37) if (::hx::IsNotNull( s->charBuf )) {
+HXLINE( 37) s->flush();
+ }
+HXDLIN( 37) if (::hx::IsNull( s->b )) {
+HXLINE( 37) s->b = ::Array_obj< ::String >::fromData( _hx_array_data_533559ef_5,1);
+ }
+ else {
+HXLINE( 37) s->b->push(HX_("*",2a,00,00,00));
+ }
+ }
+HXLINE( 40) bool _hx_tmp1;
+HXDLIN( 40) if ((xhtml->name != HX_("i",69,00,00,00))) {
+HXLINE( 40) _hx_tmp1 = (xhtml->name == HX_("em",68,58,00,00));
+ }
+ else {
+HXLINE( 40) _hx_tmp1 = true;
+ }
+HXDLIN( 40) if (_hx_tmp1) {
+HXLINE( 41) if (::hx::IsNotNull( s->charBuf )) {
+HXLINE( 41) s->flush();
+ }
+HXDLIN( 41) if (::hx::IsNull( s->b )) {
+HXLINE( 41) s->b = ::Array_obj< ::String >::fromData( _hx_array_data_533559ef_6,1);
+ }
+ else {
+HXLINE( 41) s->b->push(HX_("_",5f,00,00,00));
+ }
+ }
+HXLINE( 44) bool _hx_tmp2;
+HXDLIN( 44) if ((xhtml->name != HX_("s",73,00,00,00))) {
+HXLINE( 44) _hx_tmp2 = (xhtml->name == HX_("del",cb,39,4c,00));
+ }
+ else {
+HXLINE( 44) _hx_tmp2 = true;
+ }
+HXDLIN( 44) if (_hx_tmp2) {
+HXLINE( 45) if (::hx::IsNotNull( s->charBuf )) {
+HXLINE( 45) s->flush();
+ }
+HXDLIN( 45) if (::hx::IsNull( s->b )) {
+HXLINE( 45) s->b = ::Array_obj< ::String >::fromData( _hx_array_data_533559ef_7,1);
+ }
+ else {
+HXLINE( 45) s->b->push(HX_("~",7e,00,00,00));
+ }
+ }
+HXLINE( 48) if ((xhtml->name == HX_("tt",80,65,00,00))) {
+HXLINE( 49) if (::hx::IsNotNull( s->charBuf )) {
+HXLINE( 49) s->flush();
+ }
+HXDLIN( 49) if (::hx::IsNull( s->b )) {
+HXLINE( 49) s->b = ::Array_obj< ::String >::fromData( _hx_array_data_533559ef_8,1);
+ }
+ else {
+HXLINE( 49) s->b->push(HX_("`",60,00,00,00));
+ }
+ }
+HXLINE( 52) {
+HXLINE( 52) int _g = 0;
+HXDLIN( 52) ::Array< ::Dynamic> _g1 = xhtml->children;
+HXDLIN( 52) while((_g < _g1->length)){
+HXLINE( 52) ::snikket::Node child = _g1->__get(_g).StaticCast< ::snikket::Node >();
+HXDLIN( 52) _g = (_g + 1);
+HXLINE( 53) {
+HXLINE( 53) ::String x = ::snikket::XEP0393_obj::renderNode(child);
+HXDLIN( 53) if (::hx::IsNotNull( s->charBuf )) {
+HXLINE( 53) s->flush();
+ }
+HXDLIN( 53) if (::hx::IsNull( s->b )) {
+HXLINE( 53) s->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x));
+ }
+ else {
+HXLINE( 53) ::Array< ::String > s1 = s->b;
+HXDLIN( 53) s1->push(::Std_obj::string(x));
+ }
+ }
+ }
+ }
+HXLINE( 56) bool _hx_tmp3;
+HXDLIN( 56) if ((xhtml->name != HX_("b",62,00,00,00))) {
+HXLINE( 56) _hx_tmp3 = (xhtml->name == HX_("strong",57,b6,34,11));
+ }
+ else {
+HXLINE( 56) _hx_tmp3 = true;
+ }
+HXDLIN( 56) if (_hx_tmp3) {
+HXLINE( 57) if (::hx::IsNotNull( s->charBuf )) {
+HXLINE( 57) s->flush();
+ }
+HXDLIN( 57) if (::hx::IsNull( s->b )) {
+HXLINE( 57) s->b = ::Array_obj< ::String >::fromData( _hx_array_data_533559ef_9,1);
+ }
+ else {
+HXLINE( 57) s->b->push(HX_("*",2a,00,00,00));
+ }
+ }
+HXLINE( 60) bool _hx_tmp4;
+HXDLIN( 60) if ((xhtml->name != HX_("i",69,00,00,00))) {
+HXLINE( 60) _hx_tmp4 = (xhtml->name == HX_("em",68,58,00,00));
+ }
+ else {
+HXLINE( 60) _hx_tmp4 = true;
+ }
+HXDLIN( 60) if (_hx_tmp4) {
+HXLINE( 61) if (::hx::IsNotNull( s->charBuf )) {
+HXLINE( 61) s->flush();
+ }
+HXDLIN( 61) if (::hx::IsNull( s->b )) {
+HXLINE( 61) s->b = ::Array_obj< ::String >::fromData( _hx_array_data_533559ef_10,1);
+ }
+ else {
+HXLINE( 61) s->b->push(HX_("_",5f,00,00,00));
+ }
+ }
+HXLINE( 64) bool _hx_tmp5;
+HXDLIN( 64) if ((xhtml->name != HX_("s",73,00,00,00))) {
+HXLINE( 64) _hx_tmp5 = (xhtml->name == HX_("del",cb,39,4c,00));
+ }
+ else {
+HXLINE( 64) _hx_tmp5 = true;
+ }
+HXDLIN( 64) if (_hx_tmp5) {
+HXLINE( 65) if (::hx::IsNotNull( s->charBuf )) {
+HXLINE( 65) s->flush();
+ }
+HXDLIN( 65) if (::hx::IsNull( s->b )) {
+HXLINE( 65) s->b = ::Array_obj< ::String >::fromData( _hx_array_data_533559ef_11,1);
+ }
+ else {
+HXLINE( 65) s->b->push(HX_("~",7e,00,00,00));
+ }
+ }
+HXLINE( 68) if ((xhtml->name == HX_("tt",80,65,00,00))) {
+HXLINE( 69) if (::hx::IsNotNull( s->charBuf )) {
+HXLINE( 69) s->flush();
+ }
+HXDLIN( 69) if (::hx::IsNull( s->b )) {
+HXLINE( 69) s->b = ::Array_obj< ::String >::fromData( _hx_array_data_533559ef_12,1);
+ }
+ else {
+HXLINE( 69) s->b->push(HX_("`",60,00,00,00));
+ }
+ }
+HXLINE( 72) bool _hx_tmp6;
+HXDLIN( 72) bool _hx_tmp7;
+HXDLIN( 72) bool _hx_tmp8;
+HXDLIN( 72) if ((xhtml->name != HX_("blockquote",cf,56,28,a2))) {
+HXLINE( 72) _hx_tmp8 = (xhtml->name == HX_("p",70,00,00,00));
+ }
+ else {
+HXLINE( 72) _hx_tmp8 = true;
+ }
+HXDLIN( 72) if (!(_hx_tmp8)) {
+HXLINE( 72) _hx_tmp7 = (xhtml->name == HX_("div",51,3d,4c,00));
+ }
+ else {
+HXLINE( 72) _hx_tmp7 = true;
+ }
+HXDLIN( 72) if (!(_hx_tmp7)) {
+HXLINE( 72) _hx_tmp6 = (xhtml->name == HX_("pre",23,60,55,00));
+ }
+ else {
+HXLINE( 72) _hx_tmp6 = true;
+ }
+HXDLIN( 72) if (_hx_tmp6) {
+HXLINE( 73) if (::hx::IsNotNull( s->charBuf )) {
+HXLINE( 73) s->flush();
+ }
+HXDLIN( 73) if (::hx::IsNull( s->b )) {
+HXLINE( 73) s->b = ::Array_obj< ::String >::fromData( _hx_array_data_533559ef_13,1);
+ }
+ else {
+HXLINE( 73) s->b->push(HX_("\n",0a,00,00,00));
+ }
+ }
+HXLINE( 76) if ((xhtml->name == HX_("pre",23,60,55,00))) {
+HXLINE( 77) if (::hx::IsNotNull( s->charBuf )) {
+HXLINE( 77) s->flush();
+ }
+HXDLIN( 77) if (::hx::IsNull( s->b )) {
+HXLINE( 77) s->b = ::Array_obj< ::String >::fromData( _hx_array_data_533559ef_14,1);
+ }
+ else {
+HXLINE( 77) s->b->push(HX_("```\n",aa,a7,bd,3f));
+ }
+ }
+HXLINE( 80) if ((xhtml->name == HX_("blockquote",cf,56,28,a2))) {
+HXLINE( 81) ::EReg _hx_tmp9 = ::EReg_obj::__alloc( HX_CTX ,HX_("^",5e,00,00,00),HX_("gm",26,5a,00,00));
+HXDLIN( 81) return _hx_tmp9->replace(s->toString(),HX_("> ",22,36,00,00));
+ }
+HXLINE( 84) return s->toString();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(XEP0393_obj,render,return )
+
+::String XEP0393_obj::renderNode( ::snikket::Node xhtml){
+ HX_STACKFRAME(&_hx_pos_100c160c0c16a433_88_renderNode)
+HXDLIN( 88) switch((int)(xhtml->_hx_getIndex())){
+ case (int)0: {
+HXLINE( 89) ::snikket::Stanza c = xhtml->_hx_getObject(0).StaticCast< ::snikket::Stanza >();
+HXDLIN( 89) return ::snikket::XEP0393_obj::render(c);
+ }
+ break;
+ case (int)1: {
+HXLINE( 90) ::snikket::TextNode c1 = xhtml->_hx_getObject(0).StaticCast< ::snikket::TextNode >();
+HXDLIN( 90) return c1->content;
+ }
+ break;
+ }
+HXLINE( 88) return null();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(XEP0393_obj,renderNode,return )
+
+ ::Dynamic XEP0393_obj::parseSpans(::String styled){
+ HX_GC_STACKFRAME(&_hx_pos_100c160c0c16a433_94_parseSpans)
+HXLINE( 95) ::Array< ::Dynamic> spans = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 96) int start = 0;
+HXLINE( 97) ::Dynamic nextLink = null();
+HXLINE( 98) while((start < ::_UnicodeString::UnicodeString_Impl__obj::get_length(styled))){
+HXLINE( 99) if (::StringTools_obj::isSpace(styled,(start + 1))) {
+HXLINE( 101) spans->push(::snikket::Node_obj::CData( ::snikket::TextNode_obj::__alloc( HX_CTX ,::_UnicodeString::UnicodeString_Impl__obj::substr(styled,start,2))));
+HXLINE( 102) start = (start + 2);
+ }
+ else {
+HXLINE( 103) bool _hx_tmp;
+HXDLIN( 103) if ((start != 0)) {
+HXLINE( 103) _hx_tmp = !(::StringTools_obj::isSpace(styled,(start - 1)));
+ }
+ else {
+HXLINE( 103) _hx_tmp = false;
+ }
+HXDLIN( 103) if (_hx_tmp) {
+HXLINE( 105) spans->push(::snikket::Node_obj::CData( ::snikket::TextNode_obj::__alloc( HX_CTX ,::_UnicodeString::UnicodeString_Impl__obj::charAt(styled,start))));
+HXLINE( 106) start = (start + 1);
+ }
+ else {
+HXLINE( 107) if ((::_UnicodeString::UnicodeString_Impl__obj::charAt(styled,start) == HX_("*",2a,00,00,00))) {
+HXLINE( 108) ::Dynamic parsed = ::snikket::XEP0393_obj::parseSpan(HX_("strong",57,b6,34,11),HX_("*",2a,00,00,00),styled,start);
+HXLINE( 109) spans->push( ::Dynamic(parsed->__Field(HX_("span",ca,da,58,4c),::hx::paccDynamic)));
+HXLINE( 110) start = ( (int)(parsed->__Field(HX_("end",db,03,4d,00),::hx::paccDynamic)) );
+ }
+ else {
+HXLINE( 111) if ((::_UnicodeString::UnicodeString_Impl__obj::charAt(styled,start) == HX_("_",5f,00,00,00))) {
+HXLINE( 112) ::Dynamic parsed1 = ::snikket::XEP0393_obj::parseSpan(HX_("em",68,58,00,00),HX_("_",5f,00,00,00),styled,start);
+HXLINE( 113) spans->push( ::Dynamic(parsed1->__Field(HX_("span",ca,da,58,4c),::hx::paccDynamic)));
+HXLINE( 114) start = ( (int)(parsed1->__Field(HX_("end",db,03,4d,00),::hx::paccDynamic)) );
+ }
+ else {
+HXLINE( 115) if ((::_UnicodeString::UnicodeString_Impl__obj::charAt(styled,start) == HX_("~",7e,00,00,00))) {
+HXLINE( 116) ::Dynamic parsed2 = ::snikket::XEP0393_obj::parseSpan(HX_("s",73,00,00,00),HX_("~",7e,00,00,00),styled,start);
+HXLINE( 117) spans->push( ::Dynamic(parsed2->__Field(HX_("span",ca,da,58,4c),::hx::paccDynamic)));
+HXLINE( 118) start = ( (int)(parsed2->__Field(HX_("end",db,03,4d,00),::hx::paccDynamic)) );
+ }
+ else {
+HXLINE( 119) if ((::_UnicodeString::UnicodeString_Impl__obj::charAt(styled,start) == HX_("`",60,00,00,00))) {
+HXLINE( 121) ::Dynamic parsed3 = ::snikket::XEP0393_obj::parseSpan(HX_("tt",80,65,00,00),HX_("`",60,00,00,00),styled,start);
+HXLINE( 122) spans->push( ::Dynamic(parsed3->__Field(HX_("span",ca,da,58,4c),::hx::paccDynamic)));
+HXLINE( 123) start = ( (int)(parsed3->__Field(HX_("end",db,03,4d,00),::hx::paccDynamic)) );
+ }
+ else {
+HXLINE( 125) bool _hx_tmp1;
+HXDLIN( 125) if (::hx::IsNotNull( nextLink )) {
+HXLINE( 125) _hx_tmp1 = ::hx::IsGreater( start,nextLink->__Field(HX_("start",62,74,0b,84),::hx::paccDynamic) );
+ }
+ else {
+HXLINE( 125) _hx_tmp1 = true;
+ }
+HXDLIN( 125) if (_hx_tmp1) {
+HXLINE( 126) nextLink = ::snikket::Autolink_obj::one(styled,start);
+ }
+HXLINE( 128) bool _hx_tmp2;
+HXDLIN( 128) bool _hx_tmp3;
+HXDLIN( 128) if (::hx::IsNotNull( nextLink )) {
+HXLINE( 128) _hx_tmp3 = ::hx::IsEq( nextLink->__Field(HX_("start",62,74,0b,84),::hx::paccDynamic),start );
+ }
+ else {
+HXLINE( 128) _hx_tmp3 = false;
+ }
+HXDLIN( 128) if (_hx_tmp3) {
+HXLINE( 128) _hx_tmp2 = ::hx::IsNotNull( nextLink->__Field(HX_("span",ca,da,58,4c),::hx::paccDynamic) );
+ }
+ else {
+HXLINE( 128) _hx_tmp2 = false;
+ }
+HXDLIN( 128) if (_hx_tmp2) {
+HXLINE( 129) spans->push( ::Dynamic(nextLink->__Field(HX_("span",ca,da,58,4c),::hx::paccDynamic)));
+HXLINE( 130) start = ( (int)(nextLink->__Field(HX_("end",db,03,4d,00),::hx::paccDynamic)) );
+ }
+ else {
+HXLINE( 132) spans->push(::snikket::Node_obj::CData( ::snikket::TextNode_obj::__alloc( HX_CTX ,::_UnicodeString::UnicodeString_Impl__obj::charAt(styled,start))));
+HXLINE( 133) start = (start + 1);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+HXLINE( 137) return spans;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(XEP0393_obj,parseSpans,return )
+
+ ::Dynamic XEP0393_obj::parseSpan(::String tagName,::String marker,::String styled,int start){
+ HX_GC_STACKFRAME(&_hx_pos_100c160c0c16a433_140_parseSpan)
+HXLINE( 141) int end = (start + 1);
+HXLINE( 142) while(true){
+HXLINE( 142) bool _hx_tmp;
+HXDLIN( 142) if ((end < styled.length)) {
+HXLINE( 142) _hx_tmp = (styled.charAt(end) != marker);
+ }
+ else {
+HXLINE( 142) _hx_tmp = false;
+ }
+HXDLIN( 142) if (!(_hx_tmp)) {
+HXLINE( 142) goto _hx_goto_18;
+ }
+HXLINE( 143) if (::StringTools_obj::isSpace(styled,end)) {
+HXLINE( 143) end = (end + 1);
+ }
+HXLINE( 144) end = (end + 1);
+ }
+ _hx_goto_18:;
+HXLINE( 146) if ((end == (start + 1))) {
+HXLINE( 148) return ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("end",db,03,4d,00),(end + 1))
+ ->setFixed(1,HX_("span",ca,da,58,4c),::snikket::Node_obj::CData( ::snikket::TextNode_obj::__alloc( HX_CTX ,styled.substr(start,2)))));
+ }
+ else {
+HXLINE( 149) if ((styled.charAt(end) != marker)) {
+HXLINE( 151) return ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("end",db,03,4d,00),end)
+ ->setFixed(1,HX_("span",ca,da,58,4c),::snikket::Node_obj::CData( ::snikket::TextNode_obj::__alloc( HX_CTX ,styled.substr(start,(end - start))))));
+ }
+ else {
+HXLINE( 152) if ((marker == HX_("`",60,00,00,00))) {
+HXLINE( 153) ::snikket::Stanza _hx_tmp1 = ::snikket::Stanza_obj::__alloc( HX_CTX ,tagName,null());
+HXDLIN( 153) return ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("end",db,03,4d,00),(end + 1))
+ ->setFixed(1,HX_("span",ca,da,58,4c),::snikket::Node_obj::Element(_hx_tmp1->text(styled.substr((start + 1),((end - start) - 1))))));
+ }
+ else {
+HXLINE( 155) ::snikket::Stanza _hx_tmp2 = ::snikket::Stanza_obj::__alloc( HX_CTX ,tagName,null());
+HXDLIN( 155) return ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("end",db,03,4d,00),(end + 1))
+ ->setFixed(1,HX_("span",ca,da,58,4c),::snikket::Node_obj::Element(_hx_tmp2->addChildNodes(::snikket::XEP0393_obj::parseSpans(styled.substr((start + 1),((end - start) - 1)))))));
+ }
+ }
+ }
+HXLINE( 146) return null();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC4(XEP0393_obj,parseSpan,return )
+
+ ::Dynamic XEP0393_obj::parseBlock(::String styled){
+ HX_GC_STACKFRAME(&_hx_pos_100c160c0c16a433_160_parseBlock)
+HXDLIN( 160) if ((::_UnicodeString::UnicodeString_Impl__obj::charAt(styled,0) == HX_(">",3e,00,00,00))) {
+HXLINE( 161) return ::snikket::XEP0393_obj::parseQuote(styled);
+ }
+ else {
+HXLINE( 162) if ((::_UnicodeString::UnicodeString_Impl__obj::substr(styled,0,3) == HX_("```",60,2c,49,00))) {
+HXLINE( 163) return ::snikket::XEP0393_obj::parsePreformatted(styled);
+ }
+ else {
+HXLINE( 165) int end = 0;
+HXLINE( 166) while(true){
+HXLINE( 166) bool _hx_tmp;
+HXDLIN( 166) if ((end < ::_UnicodeString::UnicodeString_Impl__obj::get_length(styled))) {
+HXLINE( 166) _hx_tmp = (::_UnicodeString::UnicodeString_Impl__obj::charAt(styled,end) != HX_("\n",0a,00,00,00));
+ }
+ else {
+HXLINE( 166) _hx_tmp = false;
+ }
+HXDLIN( 166) if (!(_hx_tmp)) {
+HXLINE( 166) goto _hx_goto_20;
+ }
+HXDLIN( 166) end = (end + 1);
+ }
+ _hx_goto_20:;
+HXLINE( 167) bool _hx_tmp1;
+HXDLIN( 167) if ((end < ::_UnicodeString::UnicodeString_Impl__obj::get_length(styled))) {
+HXLINE( 167) _hx_tmp1 = (::_UnicodeString::UnicodeString_Impl__obj::charAt(styled,end) == HX_("\n",0a,00,00,00));
+ }
+ else {
+HXLINE( 167) _hx_tmp1 = false;
+ }
+HXDLIN( 167) if (_hx_tmp1) {
+HXLINE( 167) end = (end + 1);
+ }
+HXLINE( 168) ::snikket::Stanza _hx_tmp2 = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("div",51,3d,4c,00),null());
+HXDLIN( 168) ::snikket::Stanza _hx_tmp3 = _hx_tmp2->addChildNodes(::snikket::XEP0393_obj::parseSpans(::_UnicodeString::UnicodeString_Impl__obj::substr(styled,0,end)));
+HXDLIN( 168) return ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("block",4d,75,fc,b4),_hx_tmp3)
+ ->setFixed(1,HX_("rest",14,5b,a7,4b),::_UnicodeString::UnicodeString_Impl__obj::substr(styled,end,null())));
+ }
+ }
+HXLINE( 160) return null();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(XEP0393_obj,parseBlock,return )
+
+ ::Dynamic XEP0393_obj::parseQuote(::String styled){
+ HX_GC_STACKFRAME(&_hx_pos_100c160c0c16a433_172_parseQuote)
+HXLINE( 173) ::Array< ::String > lines = ::Array_obj< ::String >::__new(0);
+HXLINE( 174) ::String line = HX_("",00,00,00,00);
+HXLINE( 175) int end = 1;
+HXLINE( 176) int spaceAfter = 0;
+HXLINE( 177) while((end < ::_UnicodeString::UnicodeString_Impl__obj::get_length(styled))){
+HXLINE( 178) bool _hx_tmp;
+HXDLIN( 178) if ((::_UnicodeString::UnicodeString_Impl__obj::charAt(styled,end) != HX_("\n",0a,00,00,00))) {
+HXLINE( 178) _hx_tmp = ::StringTools_obj::isSpace(styled,end);
+ }
+ else {
+HXLINE( 178) _hx_tmp = false;
+ }
+HXDLIN( 178) if (_hx_tmp) {
+HXLINE( 178) end = (end + 1);
+ }
+HXLINE( 179) while(true){
+HXLINE( 179) bool _hx_tmp1;
+HXDLIN( 179) if ((end < ::_UnicodeString::UnicodeString_Impl__obj::get_length(styled))) {
+HXLINE( 179) _hx_tmp1 = (::_UnicodeString::UnicodeString_Impl__obj::charAt(styled,end) != HX_("\n",0a,00,00,00));
+ }
+ else {
+HXLINE( 179) _hx_tmp1 = false;
+ }
+HXDLIN( 179) if (!(_hx_tmp1)) {
+HXLINE( 179) goto _hx_goto_23;
+ }
+HXLINE( 180) line = (line + ::_UnicodeString::UnicodeString_Impl__obj::charAt(styled,end));
+HXLINE( 181) end = (end + 1);
+ }
+ _hx_goto_23:;
+HXLINE( 183) bool _hx_tmp2;
+HXDLIN( 183) if ((end < ::_UnicodeString::UnicodeString_Impl__obj::get_length(styled))) {
+HXLINE( 183) _hx_tmp2 = (::_UnicodeString::UnicodeString_Impl__obj::charAt(styled,end) == HX_("\n",0a,00,00,00));
+ }
+ else {
+HXLINE( 183) _hx_tmp2 = false;
+ }
+HXDLIN( 183) if (_hx_tmp2) {
+HXLINE( 184) end = (end + 1);
+ }
+HXLINE( 186) lines->push((line + HX_("\n",0a,00,00,00)));
+HXLINE( 187) line = HX_("",00,00,00,00);
+HXLINE( 188) if ((::_UnicodeString::UnicodeString_Impl__obj::charAt(styled,end) == HX_(">",3e,00,00,00))) {
+HXLINE( 189) end = (end + 1);
+ }
+ else {
+HXLINE( 191) goto _hx_goto_22;
+ }
+ }
+ _hx_goto_22:;
+HXLINE( 195) ::snikket::Stanza _hx_tmp3 = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("blockquote",cf,56,28,a2),null());
+HXDLIN( 195) ::snikket::Stanza _hx_tmp4 = _hx_tmp3->addChildren(::snikket::XEP0393_obj::parse(lines->join(HX_("",00,00,00,00))));
+HXDLIN( 195) return ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("block",4d,75,fc,b4),_hx_tmp4)
+ ->setFixed(1,HX_("rest",14,5b,a7,4b),::_UnicodeString::UnicodeString_Impl__obj::substr(styled,end,null())));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(XEP0393_obj,parseQuote,return )
+
+ ::Dynamic XEP0393_obj::parsePreformatted(::String styled){
+ HX_GC_STACKFRAME(&_hx_pos_100c160c0c16a433_199_parsePreformatted)
+HXLINE( 200) ::Array< ::String > lines = ::Array_obj< ::String >::__new(0);
+HXLINE( 201) ::String line = null();
+HXLINE( 202) int end = 0;
+HXLINE( 203) while((end < ::_UnicodeString::UnicodeString_Impl__obj::get_length(styled))){
+HXLINE( 204) while(true){
+HXLINE( 204) bool _hx_tmp;
+HXDLIN( 204) if ((end < ::_UnicodeString::UnicodeString_Impl__obj::get_length(styled))) {
+HXLINE( 204) _hx_tmp = (::_UnicodeString::UnicodeString_Impl__obj::charAt(styled,end) != HX_("\n",0a,00,00,00));
+ }
+ else {
+HXLINE( 204) _hx_tmp = false;
+ }
+HXDLIN( 204) if (!(_hx_tmp)) {
+HXLINE( 204) goto _hx_goto_26;
+ }
+HXLINE( 205) if (::hx::IsNotNull( line )) {
+HXLINE( 205) line = (line + ::_UnicodeString::UnicodeString_Impl__obj::charAt(styled,end));
+ }
+HXLINE( 206) end = (end + 1);
+ }
+ _hx_goto_26:;
+HXLINE( 208) bool _hx_tmp1;
+HXDLIN( 208) if ((end < ::_UnicodeString::UnicodeString_Impl__obj::get_length(styled))) {
+HXLINE( 208) _hx_tmp1 = (::_UnicodeString::UnicodeString_Impl__obj::charAt(styled,end) == HX_("\n",0a,00,00,00));
+ }
+ else {
+HXLINE( 208) _hx_tmp1 = false;
+ }
+HXDLIN( 208) if (_hx_tmp1) {
+HXLINE( 209) end = (end + 1);
+ }
+HXLINE( 211) if (::hx::IsNotNull( line )) {
+HXLINE( 211) lines->push((line + HX_("\n",0a,00,00,00)));
+ }
+HXLINE( 212) line = HX_("",00,00,00,00);
+HXLINE( 213) bool _hx_tmp2;
+HXDLIN( 213) if ((::_UnicodeString::UnicodeString_Impl__obj::substr(styled,end,4) != HX_("```\n",aa,a7,bd,3f))) {
+HXLINE( 213) _hx_tmp2 = (::_UnicodeString::UnicodeString_Impl__obj::substr(styled,end,null()) == HX_("```",60,2c,49,00));
+ }
+ else {
+HXLINE( 213) _hx_tmp2 = true;
+ }
+HXDLIN( 213) if (_hx_tmp2) {
+HXLINE( 214) end = (end + 4);
+HXLINE( 215) goto _hx_goto_25;
+ }
+ }
+ _hx_goto_25:;
+HXLINE( 219) ::snikket::Stanza _hx_tmp3 = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("pre",23,60,55,00),null());
+HXDLIN( 219) ::snikket::Stanza _hx_tmp4 = _hx_tmp3->text(lines->join(HX_("",00,00,00,00)));
+HXDLIN( 219) return ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("block",4d,75,fc,b4),_hx_tmp4)
+ ->setFixed(1,HX_("rest",14,5b,a7,4b),::_UnicodeString::UnicodeString_Impl__obj::substr(styled,end,null())));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(XEP0393_obj,parsePreformatted,return )
+
+
+XEP0393_obj::XEP0393_obj()
+{
+}
+
+bool XEP0393_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"parse") ) { outValue = parse_dyn(); return true; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"render") ) { outValue = render_dyn(); return true; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"parseSpan") ) { outValue = parseSpan_dyn(); return true; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"renderNode") ) { outValue = renderNode_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"parseSpans") ) { outValue = parseSpans_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"parseBlock") ) { outValue = parseBlock_dyn(); return true; }
+ if (HX_FIELD_EQ(inName,"parseQuote") ) { outValue = parseQuote_dyn(); return true; }
+ break;
+ case 17:
+ if (HX_FIELD_EQ(inName,"parsePreformatted") ) { outValue = parsePreformatted_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *XEP0393_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *XEP0393_obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class XEP0393_obj::__mClass;
+
+static ::String XEP0393_obj_sStaticFields[] = {
+ HX_("parse",33,90,55,bd),
+ HX_("render",56,6b,29,05),
+ HX_("renderNode",78,04,14,e6),
+ HX_("parseSpans",36,dd,47,ab),
+ HX_("parseSpan",9d,2c,ff,d3),
+ HX_("parseBlock",1a,bc,dd,de),
+ HX_("parseQuote",09,6a,d3,87),
+ HX_("parsePreformatted",4c,cb,6d,fa),
+ ::String(null())
+};
+
+void XEP0393_obj::__register()
+{
+ XEP0393_obj _hx_dummy;
+ XEP0393_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.XEP0393",ef,59,35,53);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &XEP0393_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(XEP0393_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< XEP0393_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = XEP0393_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = XEP0393_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
diff --git a/Sources/c_snikket/src/snikket/_Push/Push_Fields_.cpp b/Sources/c_snikket/src/snikket/_Push/Push_Fields_.cpp
new file mode 100644
index 0000000..8d8d739
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/_Push/Push_Fields_.cpp
@@ -0,0 +1,145 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessage
+#include <snikket/ChatMessage.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessageBuilder
+#include <snikket/ChatMessageBuilder.h>
+#endif
+#ifndef INCLUDED_snikket_JID
+#include <snikket/JID.h>
+#endif
+#ifndef INCLUDED_snikket_Notification
+#include <snikket/Notification.h>
+#endif
+#ifndef INCLUDED_snikket_Persistence
+#include <snikket/Persistence.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Push_Push_Fields_
+#include <snikket/_Push/Push_Fields_.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_652706ec70509782_12_receive,"snikket._Push.Push_Fields_","receive",0xad903c9c,"snikket._Push.Push_Fields_.receive","snikket/Push.hx",12,0xbce40632)
+namespace snikket{
+namespace _Push{
+
+void Push_Fields__obj::__construct() { }
+
+Dynamic Push_Fields__obj::__CreateEmpty() { return new Push_Fields__obj; }
+
+void *Push_Fields__obj::_hx_vtable = 0;
+
+Dynamic Push_Fields__obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Push_Fields__obj > _hx_result = new Push_Fields__obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool Push_Fields__obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x1c9e72a5;
+}
+
+ ::snikket::Notification Push_Fields__obj::receive(::String data,::Dynamic persistence){
+ HX_STACKFRAME(&_hx_pos_652706ec70509782_12_receive)
+HXLINE( 13) ::snikket::Stanza stanza = ::snikket::Stanza_obj::parse(data);
+HXLINE( 14) if (::hx::IsNull( stanza )) {
+HXLINE( 14) return null();
+ }
+HXLINE( 15) bool _hx_tmp;
+HXDLIN( 15) if ((stanza->name == HX_("envelope",10,df,6c,0c))) {
+HXLINE( 15) _hx_tmp = (( (::String)(::Reflect_obj::field(stanza->attr,HX_("xmlns",dc,31,74,60))) ) == HX_("urn:xmpp:sce:1",30,c6,40,50));
+ }
+ else {
+HXLINE( 15) _hx_tmp = false;
+ }
+HXDLIN( 15) if (_hx_tmp) {
+HXLINE( 16) stanza = stanza->getChild(HX_("content",39,8d,77,19),null())->getFirstChild();
+ }
+HXLINE( 18) bool _hx_tmp1;
+HXDLIN( 18) if ((stanza->name == HX_("forwarded",64,f5,9a,17))) {
+HXLINE( 18) _hx_tmp1 = (( (::String)(::Reflect_obj::field(stanza->attr,HX_("xmlns",dc,31,74,60))) ) == HX_("urn:xmpp:forward:0",1f,ec,b0,d1));
+ }
+ else {
+HXLINE( 18) _hx_tmp1 = false;
+ }
+HXDLIN( 18) if (_hx_tmp1) {
+HXLINE( 19) stanza = stanza->getChild(HX_("message",c7,35,11,9a),HX_("jabber:client",21,64,c5,e4));
+ }
+HXLINE( 21) if (::hx::IsNull( ( (::String)(::Reflect_obj::field(stanza->attr,HX_("to",7b,65,00,00))) ) )) {
+HXLINE( 21) return null();
+ }
+HXLINE( 23) ::snikket::ChatMessage message = ::snikket::ChatMessage_obj::fromStanza(stanza,::snikket::JID_obj::parse(( (::String)(::Reflect_obj::field(stanza->attr,HX_("to",7b,65,00,00))) ))->asBare(),null());
+HXLINE( 24) if (::hx::IsNotNull( message )) {
+HXLINE( 25) return ::snikket::Notification_obj::fromChatMessage(message);
+ }
+ else {
+HXLINE( 27) return ::snikket::Notification_obj::fromThinStanza(stanza);
+ }
+HXLINE( 24) return null();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Push_Fields__obj,receive,return )
+
+
+Push_Fields__obj::Push_Fields__obj()
+{
+}
+
+bool Push_Fields__obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 7:
+ if (HX_FIELD_EQ(inName,"receive") ) { outValue = receive_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *Push_Fields__obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *Push_Fields__obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class Push_Fields__obj::__mClass;
+
+static ::String Push_Fields__obj_sStaticFields[] = {
+ HX_("receive",e3,61,58,2a),
+ ::String(null())
+};
+
+void Push_Fields__obj::__register()
+{
+ Push_Fields__obj _hx_dummy;
+ Push_Fields__obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket._Push.Push_Fields_",27,5a,76,d4);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Push_Fields__obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Push_Fields__obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< Push_Fields__obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Push_Fields__obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Push_Fields__obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace _Push
diff --git a/Sources/c_snikket/src/snikket/_Stanza/NodeInterface.cpp b/Sources/c_snikket/src/snikket/_Stanza/NodeInterface.cpp
new file mode 100644
index 0000000..4cd912a
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/_Stanza/NodeInterface.cpp
@@ -0,0 +1,33 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+
+namespace snikket{
+namespace _Stanza{
+
+
+static ::String NodeInterface_obj_sMemberFields[] = {
+ HX_("serialize",e0,5d,f2,f4),
+ HX_("traverse",b2,7d,6a,6c),
+ ::String(null()) };
+
+::hx::Class NodeInterface_obj::__mClass;
+
+void NodeInterface_obj::__register()
+{
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket._Stanza.NodeInterface",4c,2c,f0,bb);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(NodeInterface_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TIsInterface< (int)0xc837e580 >;
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace _Stanza
diff --git a/Sources/c_snikket/src/snikket/_Util/Util_Fields_.cpp b/Sources/c_snikket/src/snikket/_Util/Util_Fields_.cpp
new file mode 100644
index 0000000..8c09c1d
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/_Util/Util_Fields_.cpp
@@ -0,0 +1,118 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_StringTools
+#include <StringTools.h>
+#endif
+#ifndef INCLUDED_snikket__Util_Util_Fields_
+#include <snikket/_Util/Util_Fields_.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_9fb9d2715b360f7b_3_setupTrace,"snikket._Util.Util_Fields_","setupTrace",0xaf383aaf,"snikket._Util.Util_Fields_.setupTrace","snikket/Util.hx",3,0x6717090a)
+HX_LOCAL_STACK_FRAME(_hx_pos_9fb9d2715b360f7b_21_downcast,"snikket._Util.Util_Fields_","downcast",0x1252e848,"snikket._Util.Util_Fields_.downcast","snikket/Util.hx",21,0x6717090a)
+HX_LOCAL_STACK_FRAME(_hx_pos_9fb9d2715b360f7b_26_xmlEscape,"snikket._Util.Util_Fields_","xmlEscape",0x084fcab1,"snikket._Util.Util_Fields_.xmlEscape","snikket/Util.hx",26,0x6717090a)
+namespace snikket{
+namespace _Util{
+
+void Util_Fields__obj::__construct() { }
+
+Dynamic Util_Fields__obj::__CreateEmpty() { return new Util_Fields__obj; }
+
+void *Util_Fields__obj::_hx_vtable = 0;
+
+Dynamic Util_Fields__obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Util_Fields__obj > _hx_result = new Util_Fields__obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool Util_Fields__obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x1266dcf5;
+}
+
+void Util_Fields__obj::setupTrace(){
+ HX_STACKFRAME(&_hx_pos_9fb9d2715b360f7b_3_setupTrace)
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC0(Util_Fields__obj,setupTrace,(void))
+
+ ::Dynamic Util_Fields__obj::downcast( ::Dynamic value,::hx::Class c){
+ HX_STACKFRAME(&_hx_pos_9fb9d2715b360f7b_21_downcast)
+HXDLIN( 21) return ::Std_obj::downcast(value,c);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(Util_Fields__obj,downcast,return )
+
+::String Util_Fields__obj::xmlEscape(::String s){
+ HX_STACKFRAME(&_hx_pos_9fb9d2715b360f7b_26_xmlEscape)
+HXDLIN( 26) return ::StringTools_obj::replace(::StringTools_obj::replace(::StringTools_obj::replace(s,HX_("&",26,00,00,00),HX_("&",dd,d4,aa,21)),HX_("<",3c,00,00,00),HX_("<",4d,74,70,19)),HX_(">",3e,00,00,00),HX_(">",08,a9,6c,19));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Util_Fields__obj,xmlEscape,return )
+
+
+Util_Fields__obj::Util_Fields__obj()
+{
+}
+
+bool Util_Fields__obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 8:
+ if (HX_FIELD_EQ(inName,"downcast") ) { outValue = downcast_dyn(); return true; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"xmlEscape") ) { outValue = xmlEscape_dyn(); return true; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"setupTrace") ) { outValue = setupTrace_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *Util_Fields__obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *Util_Fields__obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class Util_Fields__obj::__mClass;
+
+static ::String Util_Fields__obj_sStaticFields[] = {
+ HX_("setupTrace",c8,aa,22,f8),
+ HX_("downcast",21,f0,c8,8b),
+ HX_("xmlEscape",b8,a0,20,d6),
+ ::String(null())
+};
+
+void Util_Fields__obj::__register()
+{
+ Util_Fields__obj _hx_dummy;
+ Util_Fields__obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket._Util.Util_Fields_",27,09,a6,65);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Util_Fields__obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Util_Fields__obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< Util_Fields__obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Util_Fields__obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Util_Fields__obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace _Util
diff --git a/Sources/c_snikket/src/snikket/jingle/Attribute.cpp b/Sources/c_snikket/src/snikket/jingle/Attribute.cpp
new file mode 100644
index 0000000..c84f911
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/jingle/Attribute.cpp
@@ -0,0 +1,179 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_jingle_Attribute
+#include <snikket/jingle/Attribute.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_3dd2db7f2124ae96_624_new,"snikket.jingle.Attribute","new",0x05dd0082,"snikket.jingle.Attribute.new","snikket/jingle/SessionDescription.hx",624,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_3dd2db7f2124ae96_639_toSdp,"snikket.jingle.Attribute","toSdp",0x726848a6,"snikket.jingle.Attribute.toSdp","snikket/jingle/SessionDescription.hx",639,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_3dd2db7f2124ae96_629_parse,"snikket.jingle.Attribute","parse",0x1ba48cd5,"snikket.jingle.Attribute.parse","snikket/jingle/SessionDescription.hx",629,0x68af748c)
+namespace snikket{
+namespace jingle{
+
+void Attribute_obj::__construct(::String key,::String value){
+ HX_STACKFRAME(&_hx_pos_3dd2db7f2124ae96_624_new)
+HXLINE( 625) this->key = key;
+HXLINE( 626) this->value = value;
+ }
+
+Dynamic Attribute_obj::__CreateEmpty() { return new Attribute_obj; }
+
+void *Attribute_obj::_hx_vtable = 0;
+
+Dynamic Attribute_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Attribute_obj > _hx_result = new Attribute_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1]);
+ return _hx_result;
+}
+
+bool Attribute_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x0704634e;
+}
+
+::String Attribute_obj::toSdp(){
+ HX_STACKFRAME(&_hx_pos_3dd2db7f2124ae96_639_toSdp)
+HXDLIN( 639) ::String _hx_tmp;
+HXDLIN( 639) bool _hx_tmp1;
+HXDLIN( 639) if (::hx::IsNotNull( this->value )) {
+HXDLIN( 639) _hx_tmp1 = (this->value == HX_("",00,00,00,00));
+ }
+ else {
+HXDLIN( 639) _hx_tmp1 = true;
+ }
+HXDLIN( 639) if (_hx_tmp1) {
+HXDLIN( 639) _hx_tmp = HX_("",00,00,00,00);
+ }
+ else {
+HXDLIN( 639) _hx_tmp = (HX_(":",3a,00,00,00) + this->value);
+ }
+HXDLIN( 639) return (((HX_("a=",bc,54,00,00) + this->key) + _hx_tmp) + HX_("\r\n",5d,0b,00,00));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Attribute_obj,toSdp,return )
+
+ ::snikket::jingle::Attribute Attribute_obj::parse(::String input){
+ HX_GC_STACKFRAME(&_hx_pos_3dd2db7f2124ae96_629_parse)
+HXLINE( 630) int pos = input.indexOf(HX_(":",3a,00,00,00),null());
+HXLINE( 631) if ((pos < 0)) {
+HXLINE( 632) return ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,input,HX_("",00,00,00,00));
+ }
+ else {
+HXLINE( 634) ::String _hx_tmp = input.substr(0,pos);
+HXDLIN( 634) return ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,_hx_tmp,input.substr((pos + 1),null()));
+ }
+HXLINE( 631) return null();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Attribute_obj,parse,return )
+
+
+Attribute_obj::Attribute_obj()
+{
+}
+
+void Attribute_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(Attribute);
+ HX_MARK_MEMBER_NAME(key,"key");
+ HX_MARK_MEMBER_NAME(value,"value");
+ HX_MARK_END_CLASS();
+}
+
+void Attribute_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(key,"key");
+ HX_VISIT_MEMBER_NAME(value,"value");
+}
+
+::hx::Val Attribute_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"key") ) { return ::hx::Val( key ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"value") ) { return ::hx::Val( value ); }
+ if (HX_FIELD_EQ(inName,"toSdp") ) { return ::hx::Val( toSdp_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool Attribute_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"parse") ) { outValue = parse_dyn(); return true; }
+ }
+ return false;
+}
+
+::hx::Val Attribute_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"key") ) { key=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"value") ) { value=inValue.Cast< ::String >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void Attribute_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("key",9f,89,51,00));
+ outFields->push(HX_("value",71,7f,b8,31));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Attribute_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(Attribute_obj,key),HX_("key",9f,89,51,00)},
+ {::hx::fsString,(int)offsetof(Attribute_obj,value),HX_("value",71,7f,b8,31)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *Attribute_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Attribute_obj_sMemberFields[] = {
+ HX_("key",9f,89,51,00),
+ HX_("value",71,7f,b8,31),
+ HX_("toSdp",04,4c,19,14),
+ ::String(null()) };
+
+::hx::Class Attribute_obj::__mClass;
+
+static ::String Attribute_obj_sStaticFields[] = {
+ HX_("parse",33,90,55,bd),
+ ::String(null())
+};
+
+void Attribute_obj::__register()
+{
+ Attribute_obj _hx_dummy;
+ Attribute_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.jingle.Attribute",90,57,f6,ed);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Attribute_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Attribute_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Attribute_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Attribute_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Attribute_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Attribute_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace jingle
diff --git a/Sources/c_snikket/src/snikket/jingle/AudioFormat.cpp b/Sources/c_snikket/src/snikket/jingle/AudioFormat.cpp
new file mode 100644
index 0000000..976e46b
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/jingle/AudioFormat.cpp
@@ -0,0 +1,187 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_jingle_AudioFormat
+#include <snikket/jingle/AudioFormat.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_1f09f7dcf750977c_327_new,"snikket.jingle.AudioFormat","new",0xa853b293,"snikket.jingle.AudioFormat.new","snikket/jingle/PeerConnection.cpp.hx",327,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_8af94bd41e18171d_307_clockRate__fromC,"snikket.jingle.AudioFormat","clockRate__fromC",0x4ad11858,"snikket.jingle.AudioFormat.clockRate__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_8af94bd41e18171d_307_channels__fromC,"snikket.jingle.AudioFormat","channels__fromC",0xbdee92dc,"snikket.jingle.AudioFormat.channels__fromC","HaxeCBridge.hx",307,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_1f09f7dcf750977c_320_boot,"snikket.jingle.AudioFormat","boot",0x99018e9f,"snikket.jingle.AudioFormat.boot","snikket/jingle/PeerConnection.cpp.hx",320,0xf9fab71d)
+namespace snikket{
+namespace jingle{
+
+void AudioFormat_obj::__construct(::String format,unsigned char payloadType,int clockRate,int channels){
+ HX_STACKFRAME(&_hx_pos_1f09f7dcf750977c_327_new)
+HXLINE( 328) this->format = format;
+HXLINE( 329) this->payloadType = payloadType;
+HXLINE( 330) this->clockRate = clockRate;
+HXLINE( 331) this->channels = channels;
+ }
+
+Dynamic AudioFormat_obj::__CreateEmpty() { return new AudioFormat_obj; }
+
+void *AudioFormat_obj::_hx_vtable = 0;
+
+Dynamic AudioFormat_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< AudioFormat_obj > _hx_result = new AudioFormat_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2],inArgs[3]);
+ return _hx_result;
+}
+
+bool AudioFormat_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x22a1d3c3;
+}
+
+int AudioFormat_obj::clockRate__fromC(){
+ HX_STACKFRAME(&_hx_pos_8af94bd41e18171d_307_clockRate__fromC)
+HXDLIN( 307) return this->clockRate;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(AudioFormat_obj,clockRate__fromC,return )
+
+int AudioFormat_obj::channels__fromC(){
+ HX_STACKFRAME(&_hx_pos_8af94bd41e18171d_307_channels__fromC)
+HXDLIN( 307) return this->channels;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(AudioFormat_obj,channels__fromC,return )
+
+
+AudioFormat_obj::AudioFormat_obj()
+{
+}
+
+void AudioFormat_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(AudioFormat);
+ HX_MARK_MEMBER_NAME(format,"format");
+ HX_MARK_MEMBER_NAME(payloadType,"payloadType");
+ HX_MARK_MEMBER_NAME(clockRate,"clockRate");
+ HX_MARK_MEMBER_NAME(channels,"channels");
+ HX_MARK_END_CLASS();
+}
+
+void AudioFormat_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(format,"format");
+ HX_VISIT_MEMBER_NAME(payloadType,"payloadType");
+ HX_VISIT_MEMBER_NAME(clockRate,"clockRate");
+ HX_VISIT_MEMBER_NAME(channels,"channels");
+}
+
+::hx::Val AudioFormat_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 6:
+ if (HX_FIELD_EQ(inName,"format") ) { return ::hx::Val( format ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"channels") ) { return ::hx::Val( channels ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"clockRate") ) { return ::hx::Val( clockRate ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"payloadType") ) { return ::hx::Val( payloadType ); }
+ break;
+ case 15:
+ if (HX_FIELD_EQ(inName,"channels__fromC") ) { return ::hx::Val( channels__fromC_dyn() ); }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"clockRate__fromC") ) { return ::hx::Val( clockRate__fromC_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val AudioFormat_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 6:
+ if (HX_FIELD_EQ(inName,"format") ) { format=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"channels") ) { channels=inValue.Cast< int >(); return inValue; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"clockRate") ) { clockRate=inValue.Cast< int >(); return inValue; }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"payloadType") ) { payloadType=inValue.Cast< unsigned char >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void AudioFormat_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("format",37,8f,8e,fd));
+ outFields->push(HX_("payloadType",68,bd,49,af));
+ outFields->push(HX_("clockRate",ce,87,24,24));
+ outFields->push(HX_("channels",50,aa,ee,6a));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo AudioFormat_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(AudioFormat_obj,format),HX_("format",37,8f,8e,fd)},
+ {::hx::fsUnknown /* unsigned char */ ,(int)offsetof(AudioFormat_obj,payloadType),HX_("payloadType",68,bd,49,af)},
+ {::hx::fsInt,(int)offsetof(AudioFormat_obj,clockRate),HX_("clockRate",ce,87,24,24)},
+ {::hx::fsInt,(int)offsetof(AudioFormat_obj,channels),HX_("channels",50,aa,ee,6a)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *AudioFormat_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String AudioFormat_obj_sMemberFields[] = {
+ HX_("format",37,8f,8e,fd),
+ HX_("payloadType",68,bd,49,af),
+ HX_("clockRate",ce,87,24,24),
+ HX_("clockRate__fromC",6b,9e,0e,7a),
+ HX_("channels",50,aa,ee,6a),
+ HX_("channels__fromC",29,b0,4a,bf),
+ ::String(null()) };
+
+::hx::Class AudioFormat_obj::__mClass;
+
+void AudioFormat_obj::__register()
+{
+ AudioFormat_obj _hx_dummy;
+ AudioFormat_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.jingle.AudioFormat",21,6d,24,fa);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(AudioFormat_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< AudioFormat_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = AudioFormat_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = AudioFormat_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void AudioFormat_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_1f09f7dcf750977c_320_boot)
+HXDLIN( 320) __mClass->__meta__ = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("fields",79,8e,8e,80), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("channels__fromC",29,b0,4a,bf), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(1,HX_("clockRate__fromC",6b,9e,0e,7a), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null()))))));
+ }
+}
+
+} // end namespace snikket
+} // end namespace jingle
diff --git a/Sources/c_snikket/src/snikket/jingle/DTMFSender.cpp b/Sources/c_snikket/src/snikket/jingle/DTMFSender.cpp
new file mode 100644
index 0000000..4bfad87
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/jingle/DTMFSender.cpp
@@ -0,0 +1,365 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Lambda
+#include <Lambda.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_Timer
+#include <haxe/Timer.h>
+#endif
+#ifndef INCLUDED_haxe_ds_StringMap
+#include <haxe/ds/StringMap.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_AudioFormat
+#include <snikket/jingle/AudioFormat.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_DTMFSender
+#include <snikket/jingle/DTMFSender.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_MediaStreamTrack
+#include <snikket/jingle/MediaStreamTrack.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_0ab3c7c717668c52_247_new,"snikket.jingle.DTMFSender","new",0x46c58b5c,"snikket.jingle.DTMFSender.new","snikket/jingle/PeerConnection.cpp.hx",247,0xf9fab71d)
+HX_DEFINE_STACK_FRAME(_hx_pos_0ab3c7c717668c52_245_new,"snikket.jingle.DTMFSender","new",0x46c58b5c,"snikket.jingle.DTMFSender.new","snikket/jingle/PeerConnection.cpp.hx",245,0xf9fab71d)
+HX_DEFINE_STACK_FRAME(_hx_pos_0ab3c7c717668c52_237_new,"snikket.jingle.DTMFSender","new",0x46c58b5c,"snikket.jingle.DTMFSender.new","snikket/jingle/PeerConnection.cpp.hx",237,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_0ab3c7c717668c52_284_insertDTMF,"snikket.jingle.DTMFSender","insertDTMF",0xf6863326,"snikket.jingle.DTMFSender.insertDTMF","snikket/jingle/PeerConnection.cpp.hx",284,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_0ab3c7c717668c52_282_insertDTMF,"snikket.jingle.DTMFSender","insertDTMF",0xf6863326,"snikket.jingle.DTMFSender.insertDTMF","snikket/jingle/PeerConnection.cpp.hx",282,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_0ab3c7c717668c52_300_insertOneTone,"snikket.jingle.DTMFSender","insertOneTone",0x3a20c7bb,"snikket.jingle.DTMFSender.insertOneTone","snikket/jingle/PeerConnection.cpp.hx",300,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_0ab3c7c717668c52_299_insertOneTone,"snikket.jingle.DTMFSender","insertOneTone",0x3a20c7bb,"snikket.jingle.DTMFSender.insertOneTone","snikket/jingle/PeerConnection.cpp.hx",299,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_0ab3c7c717668c52_254_boot,"snikket.jingle.DTMFSender","boot",0x9e2d65b6,"snikket.jingle.DTMFSender.boot","snikket/jingle/PeerConnection.cpp.hx",254,0xf9fab71d)
+namespace snikket{
+namespace jingle{
+
+void DTMFSender_obj::__construct( ::snikket::jingle::MediaStreamTrack track){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_1, ::snikket::jingle::DTMFSender,_gthis) HXARGC(0)
+ void _hx_run(){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::jingle::DTMFSender,_gthis) HXARGC(0)
+ void _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_0ab3c7c717668c52_247_new)
+HXLINE( 248) ::Dynamic tone = _gthis->tones->shift();
+HXLINE( 249) bool _hx_tmp;
+HXDLIN( 249) if (::hx::IsNotNull( tone )) {
+HXLINE( 249) _hx_tmp = ::hx::IsNotEq( tone,255 );
+ }
+ else {
+HXLINE( 249) _hx_tmp = false;
+ }
+HXDLIN( 249) if (_hx_tmp) {
+HXLINE( 249) _gthis->insertOneTone(( (unsigned char)(tone) ));
+ }
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_0ab3c7c717668c52_245_new)
+HXLINE( 246) _gthis->timer = ::haxe::Timer_obj::__alloc( HX_CTX ,570);
+HXLINE( 247) _gthis->timer->run = ::Dynamic(new _hx_Closure_0(_gthis));
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_STACKFRAME(&_hx_pos_0ab3c7c717668c52_237_new)
+HXLINE( 240) this->tones = ::Array_obj< unsigned char >::__new(0);
+HXLINE( 243) ::snikket::jingle::DTMFSender _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 244) this->track = track;
+HXLINE( 245) track->onAudioLoop( ::Dynamic(new _hx_Closure_1(_gthis)));
+ }
+
+Dynamic DTMFSender_obj::__CreateEmpty() { return new DTMFSender_obj; }
+
+void *DTMFSender_obj::_hx_vtable = 0;
+
+Dynamic DTMFSender_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< DTMFSender_obj > _hx_result = new DTMFSender_obj();
+ _hx_result->__construct(inArgs[0]);
+ return _hx_result;
+}
+
+bool DTMFSender_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x0cd227ec;
+}
+
+void DTMFSender_obj::insertDTMF(::String tones){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0, ::snikket::jingle::DTMFSender,_gthis,::String,tones) HXARGC(0)
+ void _hx_run(){
+ HX_STACKFRAME(&_hx_pos_0ab3c7c717668c52_284_insertDTMF)
+HXLINE( 284) int _g = 0;
+HXDLIN( 284) int _g1 = tones.length;
+HXDLIN( 284) while((_g < _g1)){
+HXLINE( 284) _g = (_g + 1);
+HXDLIN( 284) int i = (_g - 1);
+HXLINE( 285) if ((tones.charAt(i) == HX_(",",2c,00,00,00))) {
+HXLINE( 287) _gthis->tones->push(255);
+HXLINE( 288) _gthis->tones->push(255);
+HXLINE( 289) _gthis->tones->push(255);
+HXLINE( 290) _gthis->tones->push(255);
+ }
+ else {
+HXLINE( 292) ::Dynamic tone = ::snikket::jingle::DTMFSender_obj::TONES->get(tones.charAt(i));
+HXLINE( 293) if (::hx::IsNotNull( tone )) {
+HXLINE( 293) _gthis->tones->push(tone);
+ }
+ }
+ }
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_STACKFRAME(&_hx_pos_0ab3c7c717668c52_282_insertDTMF)
+HXDLIN( 282) ::snikket::jingle::DTMFSender _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 283) this->track->onAudioLoop( ::Dynamic(new _hx_Closure_0(_gthis,tones)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(DTMFSender_obj,insertDTMF,(void))
+
+void DTMFSender_obj::insertOneTone(unsigned char tone){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::AudioFormat af){
+ HX_STACKFRAME(&_hx_pos_0ab3c7c717668c52_300_insertOneTone)
+HXLINE( 300) return (af->format == HX_("telephone-event",d1,88,d6,13));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_0ab3c7c717668c52_299_insertOneTone)
+HXLINE( 300) ::snikket::jingle::AudioFormat format = ( ( ::snikket::jingle::AudioFormat)(::Lambda_obj::find(this->track->get_supportedAudioFormats(), ::Dynamic(new _hx_Closure_0()))) );
+HXLINE( 301) ::Array< unsigned char > payload = ::Array_obj< unsigned char >::__new(4)->init(0,tone)->init(1,0)->init(2,0)->init(3,160);
+HXLINE( 302) {
+HXLINE( 302) int _g = 1;
+HXDLIN( 302) while((_g < 25)){
+HXLINE( 302) _g = (_g + 1);
+HXDLIN( 302) int i = (_g - 1);
+HXLINE( 303) int duration = (160 * i);
+HXLINE( 304) payload[2] = ( (unsigned char)(((duration >> 8) & 255)) );
+HXLINE( 305) payload[3] = ( (unsigned char)((duration & 255)) );
+HXLINE( 307) unsigned char _hx_tmp;
+HXDLIN( 307) if ((i == 1)) {
+HXLINE( 307) _hx_tmp = ( (unsigned char)((( (int)(format->payloadType) ) | 128)) );
+ }
+ else {
+HXLINE( 307) _hx_tmp = format->payloadType;
+ }
+HXDLIN( 307) this->track->write(payload,_hx_tmp,format->clockRate);
+ }
+ }
+HXLINE( 309) {
+HXLINE( 309) {
+HXLINE( 310) payload[2] = ( (unsigned char)(15) );
+HXLINE( 311) payload[3] = ( (unsigned char)(160) );
+HXLINE( 312) payload[1] = ( (unsigned char)(128) );
+HXLINE( 313) this->track->write(payload,format->payloadType,format->clockRate);
+ }
+HXLINE( 309) {
+HXLINE( 310) payload[2] = ( (unsigned char)(15) );
+HXLINE( 311) payload[3] = ( (unsigned char)(160) );
+HXLINE( 312) payload[1] = ( (unsigned char)(128) );
+HXLINE( 313) this->track->write(payload,format->payloadType,format->clockRate);
+ }
+HXLINE( 309) {
+HXLINE( 310) payload[2] = ( (unsigned char)(15) );
+HXLINE( 311) payload[3] = ( (unsigned char)(160) );
+HXLINE( 312) payload[1] = ( (unsigned char)(128) );
+HXLINE( 313) this->track->write(payload,format->payloadType,format->clockRate);
+ }
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(DTMFSender_obj,insertOneTone,(void))
+
+ ::haxe::ds::StringMap DTMFSender_obj::TONES;
+
+
+::hx::ObjectPtr< DTMFSender_obj > DTMFSender_obj::__new( ::snikket::jingle::MediaStreamTrack track) {
+ ::hx::ObjectPtr< DTMFSender_obj > __this = new DTMFSender_obj();
+ __this->__construct(track);
+ return __this;
+}
+
+::hx::ObjectPtr< DTMFSender_obj > DTMFSender_obj::__alloc(::hx::Ctx *_hx_ctx, ::snikket::jingle::MediaStreamTrack track) {
+ DTMFSender_obj *__this = (DTMFSender_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(DTMFSender_obj), true, "snikket.jingle.DTMFSender"));
+ *(void **)__this = DTMFSender_obj::_hx_vtable;
+ __this->__construct(track);
+ return __this;
+}
+
+DTMFSender_obj::DTMFSender_obj()
+{
+}
+
+void DTMFSender_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(DTMFSender);
+ HX_MARK_MEMBER_NAME(track,"track");
+ HX_MARK_MEMBER_NAME(timer,"timer");
+ HX_MARK_MEMBER_NAME(tones,"tones");
+ HX_MARK_END_CLASS();
+}
+
+void DTMFSender_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(track,"track");
+ HX_VISIT_MEMBER_NAME(timer,"timer");
+ HX_VISIT_MEMBER_NAME(tones,"tones");
+}
+
+::hx::Val DTMFSender_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"track") ) { return ::hx::Val( track ); }
+ if (HX_FIELD_EQ(inName,"timer") ) { return ::hx::Val( timer ); }
+ if (HX_FIELD_EQ(inName,"tones") ) { return ::hx::Val( tones ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"insertDTMF") ) { return ::hx::Val( insertDTMF_dyn() ); }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"insertOneTone") ) { return ::hx::Val( insertOneTone_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool DTMFSender_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"TONES") ) { outValue = ( TONES ); return true; }
+ }
+ return false;
+}
+
+::hx::Val DTMFSender_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"track") ) { track=inValue.Cast< ::snikket::jingle::MediaStreamTrack >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"timer") ) { timer=inValue.Cast< ::haxe::Timer >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"tones") ) { tones=inValue.Cast< ::Array< unsigned char > >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+bool DTMFSender_obj::__SetStatic(const ::String &inName,Dynamic &ioValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"TONES") ) { TONES=ioValue.Cast< ::haxe::ds::StringMap >(); return true; }
+ }
+ return false;
+}
+
+void DTMFSender_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("track",8b,8e,1f,16));
+ outFields->push(HX_("timer",c5,bf,35,10));
+ outFields->push(HX_("tones",c1,c9,2d,14));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo DTMFSender_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::snikket::jingle::MediaStreamTrack */ ,(int)offsetof(DTMFSender_obj,track),HX_("track",8b,8e,1f,16)},
+ {::hx::fsObject /* ::haxe::Timer */ ,(int)offsetof(DTMFSender_obj,timer),HX_("timer",c5,bf,35,10)},
+ {::hx::fsObject /* ::Array< unsigned char > */ ,(int)offsetof(DTMFSender_obj,tones),HX_("tones",c1,c9,2d,14)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo DTMFSender_obj_sStaticStorageInfo[] = {
+ {::hx::fsObject /* ::haxe::ds::StringMap */ ,(void *) &DTMFSender_obj::TONES,HX_("TONES",a1,01,1c,92)},
+ { ::hx::fsUnknown, 0, null()}
+};
+#endif
+
+static ::String DTMFSender_obj_sMemberFields[] = {
+ HX_("track",8b,8e,1f,16),
+ HX_("timer",c5,bf,35,10),
+ HX_("tones",c1,c9,2d,14),
+ HX_("insertDTMF",a2,56,44,28),
+ HX_("insertOneTone",bf,f9,90,a7),
+ ::String(null()) };
+
+static void DTMFSender_obj_sMarkStatics(HX_MARK_PARAMS) {
+ HX_MARK_MEMBER_NAME(DTMFSender_obj::TONES,"TONES");
+};
+
+#ifdef HXCPP_VISIT_ALLOCS
+static void DTMFSender_obj_sVisitStatics(HX_VISIT_PARAMS) {
+ HX_VISIT_MEMBER_NAME(DTMFSender_obj::TONES,"TONES");
+};
+
+#endif
+
+::hx::Class DTMFSender_obj::__mClass;
+
+static ::String DTMFSender_obj_sStaticFields[] = {
+ HX_("TONES",a1,01,1c,92),
+ ::String(null())
+};
+
+void DTMFSender_obj::__register()
+{
+ DTMFSender_obj _hx_dummy;
+ DTMFSender_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.jingle.DTMFSender",6a,ed,95,39);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &DTMFSender_obj::__GetStatic;
+ __mClass->mSetStaticField = &DTMFSender_obj::__SetStatic;
+ __mClass->mMarkFunc = DTMFSender_obj_sMarkStatics;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(DTMFSender_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(DTMFSender_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< DTMFSender_obj >;
+#ifdef HXCPP_VISIT_ALLOCS
+ __mClass->mVisitFunc = DTMFSender_obj_sVisitStatics;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = DTMFSender_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = DTMFSender_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void DTMFSender_obj::__boot()
+{
+{
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(0)
+ ::haxe::ds::StringMap _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_0ab3c7c717668c52_254_boot)
+HXDLIN( 254) ::haxe::ds::StringMap _g = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXDLIN( 254) _g->set(HX_("0",30,00,00,00),( (unsigned char)(0) ));
+HXDLIN( 254) _g->set(HX_("1",31,00,00,00),( (unsigned char)(1) ));
+HXDLIN( 254) _g->set(HX_("2",32,00,00,00),( (unsigned char)(2) ));
+HXDLIN( 254) _g->set(HX_("3",33,00,00,00),( (unsigned char)(3) ));
+HXDLIN( 254) _g->set(HX_("4",34,00,00,00),( (unsigned char)(4) ));
+HXDLIN( 254) _g->set(HX_("5",35,00,00,00),( (unsigned char)(5) ));
+HXDLIN( 254) _g->set(HX_("6",36,00,00,00),( (unsigned char)(6) ));
+HXDLIN( 254) _g->set(HX_("7",37,00,00,00),( (unsigned char)(7) ));
+HXDLIN( 254) _g->set(HX_("8",38,00,00,00),( (unsigned char)(8) ));
+HXDLIN( 254) _g->set(HX_("9",39,00,00,00),( (unsigned char)(9) ));
+HXDLIN( 254) _g->set(HX_("*",2a,00,00,00),( (unsigned char)(10) ));
+HXDLIN( 254) _g->set(HX_("#",23,00,00,00),( (unsigned char)(11) ));
+HXDLIN( 254) _g->set(HX_("A",41,00,00,00),( (unsigned char)(12) ));
+HXDLIN( 254) _g->set(HX_("B",42,00,00,00),( (unsigned char)(13) ));
+HXDLIN( 254) _g->set(HX_("C",43,00,00,00),( (unsigned char)(14) ));
+HXDLIN( 254) _g->set(HX_("D",44,00,00,00),( (unsigned char)(15) ));
+HXDLIN( 254) _g->set(HX_("a",61,00,00,00),( (unsigned char)(12) ));
+HXDLIN( 254) _g->set(HX_("b",62,00,00,00),( (unsigned char)(13) ));
+HXDLIN( 254) _g->set(HX_("c",63,00,00,00),( (unsigned char)(14) ));
+HXDLIN( 254) _g->set(HX_("d",64,00,00,00),( (unsigned char)(15) ));
+HXDLIN( 254) return _g;
+ }
+ HX_END_LOCAL_FUNC0(return)
+
+ HX_STACKFRAME(&_hx_pos_0ab3c7c717668c52_254_boot)
+HXDLIN( 254) TONES = ( ( ::haxe::ds::StringMap)( ::Dynamic(new _hx_Closure_0())()) );
+ }
+}
+
+} // end namespace snikket
+} // end namespace jingle
diff --git a/Sources/c_snikket/src/snikket/jingle/Group.cpp b/Sources/c_snikket/src/snikket/jingle/Group.cpp
new file mode 100644
index 0000000..244c232
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/jingle/Group.cpp
@@ -0,0 +1,239 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_Group
+#include <snikket/jingle/Group.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_6e388401ddea4c7c_7_new,"snikket.jingle.Group","new",0xb5ca4725,"snikket.jingle.Group.new","snikket/jingle/Group.hx",7,0xb8cb360b)
+HX_LOCAL_STACK_FRAME(_hx_pos_6e388401ddea4c7c_26_toSdp,"snikket.jingle.Group","toSdp",0xed2ebe09,"snikket.jingle.Group.toSdp","snikket/jingle/Group.hx",26,0xb8cb360b)
+HX_LOCAL_STACK_FRAME(_hx_pos_6e388401ddea4c7c_33_toElement,"snikket.jingle.Group","toElement",0x4ca03f06,"snikket.jingle.Group.toElement","snikket/jingle/Group.hx",33,0xb8cb360b)
+HX_LOCAL_STACK_FRAME(_hx_pos_6e388401ddea4c7c_12_parse,"snikket.jingle.Group","parse",0x966b0238,"snikket.jingle.Group.parse","snikket/jingle/Group.hx",12,0xb8cb360b)
+HX_LOCAL_STACK_FRAME(_hx_pos_6e388401ddea4c7c_18_fromElement,"snikket.jingle.Group","fromElement",0x54375637,"snikket.jingle.Group.fromElement","snikket/jingle/Group.hx",18,0xb8cb360b)
+namespace snikket{
+namespace jingle{
+
+void Group_obj::__construct(::String semantics,::Array< ::String > identificationTags){
+ HX_STACKFRAME(&_hx_pos_6e388401ddea4c7c_7_new)
+HXLINE( 8) this->semantics = semantics;
+HXLINE( 9) this->identificationTags = identificationTags;
+ }
+
+Dynamic Group_obj::__CreateEmpty() { return new Group_obj; }
+
+void *Group_obj::_hx_vtable = 0;
+
+Dynamic Group_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Group_obj > _hx_result = new Group_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1]);
+ return _hx_result;
+}
+
+bool Group_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x21f1b1d5;
+}
+
+::String Group_obj::toSdp(){
+ HX_STACKFRAME(&_hx_pos_6e388401ddea4c7c_26_toSdp)
+HXLINE( 27) if ((this->semantics.indexOf(HX_(" ",20,00,00,00),null()) >= 0)) {
+HXLINE( 28) HX_STACK_DO_THROW(HX_("Group semantics cannot contain a space in SDP",b2,1d,5a,9b));
+ }
+HXLINE( 30) ::String _hx_tmp = (this->semantics + HX_(" ",20,00,00,00));
+HXDLIN( 30) return (_hx_tmp + this->identificationTags->join(HX_(" ",20,00,00,00)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Group_obj,toSdp,return )
+
+ ::snikket::Stanza Group_obj::toElement(){
+ HX_GC_STACKFRAME(&_hx_pos_6e388401ddea4c7c_33_toElement)
+HXLINE( 34) ::snikket::Stanza group = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("group",3f,b3,f4,99), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:jingle:apps:grouping:0",14,f9,f4,ed))
+ ->setFixed(1,HX_("semantics",ad,54,ab,73),this->semantics)));
+HXLINE( 35) {
+HXLINE( 35) int _g = 0;
+HXDLIN( 35) ::Array< ::String > _g1 = this->identificationTags;
+HXDLIN( 35) while((_g < _g1->length)){
+HXLINE( 35) ::String tag = _g1->__get(_g);
+HXDLIN( 35) _g = (_g + 1);
+HXLINE( 36) group->tag(HX_("content",39,8d,77,19), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("name",4b,72,ff,48),tag)))->up();
+ }
+ }
+HXLINE( 38) return group;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Group_obj,toElement,return )
+
+ ::snikket::jingle::Group Group_obj::parse(::String input){
+ HX_GC_STACKFRAME(&_hx_pos_6e388401ddea4c7c_12_parse)
+HXLINE( 13) ::Array< ::String > segments = input.split(HX_(" ",20,00,00,00));
+HXLINE( 14) if ((segments->length < 2)) {
+HXLINE( 14) return null();
+ }
+HXLINE( 15) ::String segments1 = segments->__get(0);
+HXDLIN( 15) return ::snikket::jingle::Group_obj::__alloc( HX_CTX ,segments1,segments->slice(1,null()));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Group_obj,parse,return )
+
+ ::snikket::jingle::Group Group_obj::fromElement( ::snikket::Stanza el){
+ HX_GC_STACKFRAME(&_hx_pos_6e388401ddea4c7c_18_fromElement)
+HXLINE( 19) ::Array< ::String > idTags = ::Array_obj< ::String >::__new(0);
+HXLINE( 20) {
+HXLINE( 20) int _g = 0;
+HXDLIN( 20) ::Array< ::Dynamic> _g1 = el->allTags(HX_("content",39,8d,77,19),null());
+HXDLIN( 20) while((_g < _g1->length)){
+HXLINE( 20) ::snikket::Stanza content = _g1->__get(_g).StaticCast< ::snikket::Stanza >();
+HXDLIN( 20) _g = (_g + 1);
+HXLINE( 21) if (::hx::IsNotNull( ( (::String)(::Reflect_obj::field(content->attr,HX_("name",4b,72,ff,48))) ) )) {
+HXLINE( 21) idTags->push(( (::String)(::Reflect_obj::field(content->attr,HX_("name",4b,72,ff,48))) ));
+ }
+ }
+ }
+HXLINE( 23) return ::snikket::jingle::Group_obj::__alloc( HX_CTX ,( (::String)(::Reflect_obj::field(el->attr,HX_("semantics",ad,54,ab,73))) ),idTags);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(Group_obj,fromElement,return )
+
+
+::hx::ObjectPtr< Group_obj > Group_obj::__new(::String semantics,::Array< ::String > identificationTags) {
+ ::hx::ObjectPtr< Group_obj > __this = new Group_obj();
+ __this->__construct(semantics,identificationTags);
+ return __this;
+}
+
+::hx::ObjectPtr< Group_obj > Group_obj::__alloc(::hx::Ctx *_hx_ctx,::String semantics,::Array< ::String > identificationTags) {
+ Group_obj *__this = (Group_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Group_obj), true, "snikket.jingle.Group"));
+ *(void **)__this = Group_obj::_hx_vtable;
+ __this->__construct(semantics,identificationTags);
+ return __this;
+}
+
+Group_obj::Group_obj()
+{
+}
+
+void Group_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(Group);
+ HX_MARK_MEMBER_NAME(semantics,"semantics");
+ HX_MARK_MEMBER_NAME(identificationTags,"identificationTags");
+ HX_MARK_END_CLASS();
+}
+
+void Group_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(semantics,"semantics");
+ HX_VISIT_MEMBER_NAME(identificationTags,"identificationTags");
+}
+
+::hx::Val Group_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"toSdp") ) { return ::hx::Val( toSdp_dyn() ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"semantics") ) { return ::hx::Val( semantics ); }
+ if (HX_FIELD_EQ(inName,"toElement") ) { return ::hx::Val( toElement_dyn() ); }
+ break;
+ case 18:
+ if (HX_FIELD_EQ(inName,"identificationTags") ) { return ::hx::Val( identificationTags ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool Group_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"parse") ) { outValue = parse_dyn(); return true; }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"fromElement") ) { outValue = fromElement_dyn(); return true; }
+ }
+ return false;
+}
+
+::hx::Val Group_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 9:
+ if (HX_FIELD_EQ(inName,"semantics") ) { semantics=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 18:
+ if (HX_FIELD_EQ(inName,"identificationTags") ) { identificationTags=inValue.Cast< ::Array< ::String > >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void Group_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("semantics",ad,54,ab,73));
+ outFields->push(HX_("identificationTags",67,19,46,5f));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Group_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(Group_obj,semantics),HX_("semantics",ad,54,ab,73)},
+ {::hx::fsObject /* ::Array< ::String > */ ,(int)offsetof(Group_obj,identificationTags),HX_("identificationTags",67,19,46,5f)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *Group_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Group_obj_sMemberFields[] = {
+ HX_("semantics",ad,54,ab,73),
+ HX_("identificationTags",67,19,46,5f),
+ HX_("toSdp",04,4c,19,14),
+ HX_("toElement",81,e6,e8,35),
+ ::String(null()) };
+
+::hx::Class Group_obj::__mClass;
+
+static ::String Group_obj_sStaticFields[] = {
+ HX_("parse",33,90,55,bd),
+ HX_("fromElement",72,12,95,9e),
+ ::String(null())
+};
+
+void Group_obj::__register()
+{
+ Group_obj _hx_dummy;
+ Group_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.jingle.Group",b3,d0,ac,e7);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Group_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Group_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Group_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Group_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Group_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Group_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace jingle
diff --git a/Sources/c_snikket/src/snikket/jingle/IceCandidate.cpp b/Sources/c_snikket/src/snikket/jingle/IceCandidate.cpp
new file mode 100644
index 0000000..477334e
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/jingle/IceCandidate.cpp
@@ -0,0 +1,479 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_StringMap
+#include <haxe/ds/StringMap.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_IceCandidate
+#include <snikket/jingle/IceCandidate.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_8555847178bd1d0f_505_new,"snikket.jingle.IceCandidate","new",0x23693b76,"snikket.jingle.IceCandidate.new","snikket/jingle/SessionDescription.hx",505,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_8555847178bd1d0f_575_toElement,"snikket.jingle.IceCandidate","toElement",0x6238c617,"snikket.jingle.IceCandidate.toElement","snikket/jingle/SessionDescription.hx",575,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_8555847178bd1d0f_593_toSdp,"snikket.jingle.IceCandidate","toSdp",0x37b0289a,"snikket.jingle.IceCandidate.toSdp","snikket/jingle/SessionDescription.hx",593,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_8555847178bd1d0f_517_fromElement,"snikket.jingle.IceCandidate","fromElement",0x664c8388,"snikket.jingle.IceCandidate.fromElement","snikket/jingle/SessionDescription.hx",517,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_8555847178bd1d0f_539_fromTransport,"snikket.jingle.IceCandidate","fromTransport",0x795eef75,"snikket.jingle.IceCandidate.fromTransport","snikket/jingle/SessionDescription.hx",539,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_8555847178bd1d0f_542_fromStanza,"snikket.jingle.IceCandidate","fromStanza",0xe2cf26a9,"snikket.jingle.IceCandidate.fromStanza","snikket/jingle/SessionDescription.hx",542,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_8555847178bd1d0f_550_parse,"snikket.jingle.IceCandidate","parse",0xe0ec6cc9,"snikket.jingle.IceCandidate.parse","snikket/jingle/SessionDescription.hx",550,0x68af748c)
+namespace snikket{
+namespace jingle{
+
+void IceCandidate_obj::__construct(::String sdpMid,::String ufrag,::String foundation,::String component,::String transport,::String priority,::String connectionAddress,::String port, ::haxe::ds::StringMap parameters){
+ HX_STACKFRAME(&_hx_pos_8555847178bd1d0f_505_new)
+HXLINE( 506) this->sdpMid = sdpMid;
+HXLINE( 507) this->ufrag = ufrag;
+HXLINE( 508) this->foundation = foundation;
+HXLINE( 509) this->component = component;
+HXLINE( 510) this->transport = transport;
+HXLINE( 511) this->priority = priority;
+HXLINE( 512) this->connectionAddress = connectionAddress;
+HXLINE( 513) this->port = port;
+HXLINE( 514) this->parameters = parameters;
+ }
+
+Dynamic IceCandidate_obj::__CreateEmpty() { return new IceCandidate_obj; }
+
+void *IceCandidate_obj::_hx_vtable = 0;
+
+Dynamic IceCandidate_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< IceCandidate_obj > _hx_result = new IceCandidate_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6],inArgs[7],inArgs[8]);
+ return _hx_result;
+}
+
+bool IceCandidate_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x5f466786;
+}
+
+ ::snikket::Stanza IceCandidate_obj::toElement(){
+ HX_GC_STACKFRAME(&_hx_pos_8555847178bd1d0f_575_toElement)
+HXLINE( 577) ::String attrs;
+HXDLIN( 577) if (::hx::IsNull( this->parameters->get(HX_("tcptype",5b,73,f8,36)) )) {
+HXLINE( 577) attrs = HX_("urn:xmpp:jingle:transports:ice-udp:1",f3,67,4f,53);
+ }
+ else {
+HXLINE( 577) attrs = HX_("urn:xmpp:jingle:transports:ice:0",be,d5,ad,6e);
+ }
+HXLINE( 578) ::String attrs1 = this->foundation;
+HXLINE( 579) ::String attrs2 = this->component;
+HXLINE( 580) ::String attrs3 = this->transport.toLowerCase();
+HXLINE( 581) ::String attrs4 = this->priority;
+HXLINE( 582) ::String attrs5 = this->connectionAddress;
+HXLINE( 583) ::String attrs6 = this->port;
+HXLINE( 584) ::String tmp = this->parameters->get_string(HX_("generation",98,c0,63,4e));
+HXDLIN( 584) ::String attrs7;
+HXDLIN( 584) if (::hx::IsNotNull( tmp )) {
+HXLINE( 584) attrs7 = tmp;
+ }
+ else {
+HXLINE( 584) attrs7 = HX_("0",30,00,00,00);
+ }
+HXLINE( 576) ::Dynamic attrs8 = ::Dynamic(::hx::Anon_obj::Create(8)
+ ->setFixed(0,HX_("priority",64,7b,3e,bb),attrs4)
+ ->setFixed(1,HX_("ip",e7,5b,00,00),attrs5)
+ ->setFixed(2,HX_("protocol",58,56,63,00),attrs3)
+ ->setFixed(3,HX_("component",bd,f0,53,0f),attrs2)
+ ->setFixed(4,HX_("foundation",33,a1,2a,39),attrs1)
+ ->setFixed(5,HX_("port",81,83,5c,4a),attrs6)
+ ->setFixed(6,HX_("generation",98,c0,63,4e),attrs7)
+ ->setFixed(7,HX_("xmlns",dc,31,74,60),attrs));
+HXLINE( 586) if (::hx::IsNotNull( this->parameters->get(HX_("typ",4b,6f,58,00)) )) {
+HXLINE( 586) ::String value = this->parameters->get_string(HX_("typ",4b,6f,58,00));
+HXDLIN( 586) ::Reflect_obj::setField(attrs8,HX_("type",ba,f2,08,4d),value);
+ }
+HXLINE( 587) if (::hx::IsNotNull( this->parameters->get(HX_("raddr",a3,0c,18,e4)) )) {
+HXLINE( 587) ::String value1 = this->parameters->get_string(HX_("raddr",a3,0c,18,e4));
+HXDLIN( 587) ::Reflect_obj::setField(attrs8,HX_("rel-addr",e5,a9,6b,38),value1);
+ }
+HXLINE( 588) if (::hx::IsNotNull( this->parameters->get(HX_("rport",f3,a4,0a,ee)) )) {
+HXLINE( 588) ::String value2 = this->parameters->get_string(HX_("rport",f3,a4,0a,ee));
+HXDLIN( 588) ::Reflect_obj::setField(attrs8,HX_("rel-port",35,42,5e,42),value2);
+ }
+HXLINE( 589) if (::hx::IsNotNull( this->parameters->get(HX_("tcptype",5b,73,f8,36)) )) {
+HXLINE( 589) ::String value3 = this->parameters->get_string(HX_("tcptype",5b,73,f8,36));
+HXDLIN( 589) ::Reflect_obj::setField(attrs8,HX_("tcptype",5b,73,f8,36),value3);
+ }
+HXLINE( 590) return ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("candidate",43,34,d8,d0),attrs8);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(IceCandidate_obj,toElement,return )
+
+::String IceCandidate_obj::toSdp(){
+ HX_STACKFRAME(&_hx_pos_8555847178bd1d0f_593_toSdp)
+HXLINE( 594) ::String result = (((((((((((HX_("candidate:",97,86,55,ec) + this->foundation) + HX_(" ",20,00,00,00)) + this->component) + HX_(" ",20,00,00,00)) + this->transport) + HX_(" ",20,00,00,00)) + this->priority) + HX_(" ",20,00,00,00)) + this->connectionAddress) + HX_(" ",20,00,00,00)) + this->port);
+HXLINE( 602) if (this->parameters->exists(HX_("typ",4b,6f,58,00))) {
+HXLINE( 603) result = (result + (HX_(" typ ",95,82,db,b9) + this->parameters->get(HX_("typ",4b,6f,58,00))));
+ }
+HXLINE( 605) if (this->parameters->exists(HX_("raddr",a3,0c,18,e4))) {
+HXLINE( 606) result = (result + (HX_(" raddr ",3d,da,a1,e3) + this->parameters->get(HX_("raddr",a3,0c,18,e4))));
+ }
+HXLINE( 608) if (this->parameters->exists(HX_("rport",f3,a4,0a,ee))) {
+HXLINE( 609) result = (result + (HX_(" rport ",ed,87,f4,8d) + this->parameters->get(HX_("rport",f3,a4,0a,ee))));
+ }
+HXLINE( 611) {
+HXLINE( 611) ::Dynamic map = this->parameters;
+HXDLIN( 611) ::Dynamic entry_map = map;
+HXDLIN( 611) ::Dynamic entry_keys = ::haxe::IMap_obj::keys(map);
+HXDLIN( 611) while(( (bool)(entry_keys->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 611) ::String key = ( (::String)(entry_keys->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXDLIN( 611) ::String entry_value = ( (::String)(::haxe::IMap_obj::get(entry_map,key)) );
+HXDLIN( 611) ::String entry_key = key;
+HXLINE( 612) bool _hx_tmp;
+HXDLIN( 612) bool _hx_tmp1;
+HXDLIN( 612) if ((entry_key != HX_("typ",4b,6f,58,00))) {
+HXLINE( 612) _hx_tmp1 = (entry_key != HX_("raddr",a3,0c,18,e4));
+ }
+ else {
+HXLINE( 612) _hx_tmp1 = false;
+ }
+HXDLIN( 612) if (_hx_tmp1) {
+HXLINE( 612) _hx_tmp = (entry_key != HX_("rport",f3,a4,0a,ee));
+ }
+ else {
+HXLINE( 612) _hx_tmp = false;
+ }
+HXDLIN( 612) if (_hx_tmp) {
+HXLINE( 613) result = (result + (((HX_(" ",20,00,00,00) + entry_key) + HX_(" ",20,00,00,00)) + entry_value));
+ }
+ }
+ }
+HXLINE( 616) return result;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(IceCandidate_obj,toSdp,return )
+
+ ::snikket::jingle::IceCandidate IceCandidate_obj::fromElement( ::snikket::Stanza candidate,::String sdpMid,::String ufrag){
+ HX_GC_STACKFRAME(&_hx_pos_8555847178bd1d0f_517_fromElement)
+HXLINE( 518) ::haxe::ds::StringMap parameters = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXLINE( 519) if (::hx::IsNotNull( ( (::String)(::Reflect_obj::field(candidate->attr,HX_("type",ba,f2,08,4d))) ) )) {
+HXLINE( 519) parameters->set(HX_("typ",4b,6f,58,00),( (::String)(::Reflect_obj::field(candidate->attr,HX_("type",ba,f2,08,4d))) ));
+ }
+HXLINE( 520) if (::hx::IsNotNull( ( (::String)(::Reflect_obj::field(candidate->attr,HX_("rel-addr",e5,a9,6b,38))) ) )) {
+HXLINE( 520) parameters->set(HX_("raddr",a3,0c,18,e4),( (::String)(::Reflect_obj::field(candidate->attr,HX_("rel-addr",e5,a9,6b,38))) ));
+ }
+HXLINE( 521) if (::hx::IsNotNull( ( (::String)(::Reflect_obj::field(candidate->attr,HX_("rel-port",35,42,5e,42))) ) )) {
+HXLINE( 521) parameters->set(HX_("rport",f3,a4,0a,ee),( (::String)(::Reflect_obj::field(candidate->attr,HX_("rel-port",35,42,5e,42))) ));
+ }
+HXLINE( 522) if (::hx::IsNotNull( ( (::String)(::Reflect_obj::field(candidate->attr,HX_("generation",98,c0,63,4e))) ) )) {
+HXLINE( 522) parameters->set(HX_("generation",98,c0,63,4e),( (::String)(::Reflect_obj::field(candidate->attr,HX_("generation",98,c0,63,4e))) ));
+ }
+HXLINE( 523) if (::hx::IsNotNull( ( (::String)(::Reflect_obj::field(candidate->attr,HX_("tcptype",5b,73,f8,36))) ) )) {
+HXLINE( 523) parameters->set(HX_("tcptype",5b,73,f8,36),( (::String)(::Reflect_obj::field(candidate->attr,HX_("tcptype",5b,73,f8,36))) ));
+ }
+HXLINE( 524) if (::hx::IsNotNull( ufrag )) {
+HXLINE( 524) parameters->set(HX_("ufrag",27,78,a4,a1),ufrag);
+ }
+HXLINE( 528) ::String _hx_tmp = ( (::String)(::Reflect_obj::field(candidate->attr,HX_("foundation",33,a1,2a,39))) );
+HXLINE( 529) ::String _hx_tmp1 = ( (::String)(::Reflect_obj::field(candidate->attr,HX_("component",bd,f0,53,0f))) );
+HXLINE( 530) ::String _hx_tmp2 = ( (::String)(::Reflect_obj::field(candidate->attr,HX_("protocol",58,56,63,00))) ).toLowerCase();
+HXLINE( 531) ::String _hx_tmp3 = ( (::String)(::Reflect_obj::field(candidate->attr,HX_("priority",64,7b,3e,bb))) );
+HXLINE( 532) ::String _hx_tmp4 = ( (::String)(::Reflect_obj::field(candidate->attr,HX_("ip",e7,5b,00,00))) );
+HXLINE( 525) return ::snikket::jingle::IceCandidate_obj::__alloc( HX_CTX ,sdpMid,ufrag,_hx_tmp,_hx_tmp1,_hx_tmp2,_hx_tmp3,_hx_tmp4,( (::String)(::Reflect_obj::field(candidate->attr,HX_("port",81,83,5c,4a))) ),parameters);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC3(IceCandidate_obj,fromElement,return )
+
+::Array< ::Dynamic> IceCandidate_obj::fromTransport( ::snikket::Stanza transport,::String sdpMid){
+ HX_STACKFRAME(&_hx_pos_8555847178bd1d0f_539_fromTransport)
+HXDLIN( 539) ::Array< ::Dynamic> _this = transport->allTags(HX_("candidate",43,34,d8,d0),null());
+HXDLIN( 539) ::Array< ::Dynamic> result = ::Array_obj< ::Dynamic>::__new(_this->length);
+HXDLIN( 539) {
+HXDLIN( 539) int _g = 0;
+HXDLIN( 539) int _g1 = _this->length;
+HXDLIN( 539) while((_g < _g1)){
+HXDLIN( 539) _g = (_g + 1);
+HXDLIN( 539) int i = (_g - 1);
+HXDLIN( 539) {
+HXDLIN( 539) ::snikket::Stanza el = ( ( ::snikket::Stanza)(_hx_array_unsafe_get(_this,i)) );
+HXDLIN( 539) ::snikket::jingle::IceCandidate inValue = ::snikket::jingle::IceCandidate_obj::fromElement(el,sdpMid,( (::String)(::Reflect_obj::field(transport->attr,HX_("ufrag",27,78,a4,a1))) ));
+HXDLIN( 539) result->__unsafe_set(i,inValue);
+ }
+ }
+ }
+HXDLIN( 539) return result;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(IceCandidate_obj,fromTransport,return )
+
+::Array< ::Dynamic> IceCandidate_obj::fromStanza( ::snikket::Stanza iq){
+ HX_STACKFRAME(&_hx_pos_8555847178bd1d0f_542_fromStanza)
+HXLINE( 543) ::snikket::Stanza jingle = iq->getChild(HX_("jingle",31,27,eb,1f),HX_("urn:xmpp:jingle:1",44,c4,fe,f7));
+HXLINE( 544) ::Array< ::Dynamic> _g = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 544) {
+HXLINE( 544) ::Dynamic x = jingle->allTags(HX_("content",39,8d,77,19),null())->__Field(HX_("iterator",ee,49,9a,93),::hx::paccDynamic)();
+HXDLIN( 544) while(( (bool)(x->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 544) ::snikket::Stanza x1 = ( ( ::snikket::Stanza)(x->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXLINE( 545) ::snikket::Stanza transport = x1->getChild(HX_("transport",a9,4f,2f,4c),HX_("urn:xmpp:jingle:transports:ice-udp:1",f3,67,4f,53));
+HXLINE( 544) _g->push(::snikket::jingle::IceCandidate_obj::fromTransport(transport,( (::String)(::Reflect_obj::field(x1->attr,HX_("name",4b,72,ff,48))) )));
+ }
+ }
+HXDLIN( 544) ::Array< ::Dynamic> _g1 = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 544) {
+HXLINE( 544) ::Dynamic e = _g->__Field(HX_("iterator",ee,49,9a,93),::hx::paccDynamic)();
+HXDLIN( 544) while(( (bool)(e->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 544) ::Dynamic e1 = e->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)();
+HXDLIN( 544) {
+HXLINE( 544) ::Dynamic x2 = e1->__Field(HX_("iterator",ee,49,9a,93),::hx::paccDynamic)();
+HXDLIN( 544) while(( (bool)(x2->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 544) ::snikket::jingle::IceCandidate x3 = ( ( ::snikket::jingle::IceCandidate)(x2->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXDLIN( 544) _g1->push(x3);
+ }
+ }
+ }
+ }
+HXDLIN( 544) return _g1;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(IceCandidate_obj,fromStanza,return )
+
+ ::snikket::jingle::IceCandidate IceCandidate_obj::parse(::String input,::String sdpMid,::String ufrag){
+ HX_GC_STACKFRAME(&_hx_pos_8555847178bd1d0f_550_parse)
+HXLINE( 551) if ((input.substr(0,10) == HX_("candidate:",97,86,55,ec))) {
+HXLINE( 552) input = input.substr(11,null());
+ }
+HXLINE( 554) ::Array< ::String > segments = input.split(HX_(" ",20,00,00,00));
+HXLINE( 555) ::Array< ::String > paramSegs = segments->slice(6,null());
+HXLINE( 556) int paramLength = ::Std_obj::_hx_int((( (Float)(paramSegs->length) ) / ( (Float)(2) )));
+HXLINE( 557) ::haxe::ds::StringMap parameters = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXLINE( 558) {
+HXLINE( 558) int _g = 0;
+HXDLIN( 558) int _g1 = paramLength;
+HXDLIN( 558) while((_g < _g1)){
+HXLINE( 558) _g = (_g + 1);
+HXDLIN( 558) int i = (_g - 1);
+HXLINE( 559) parameters->set(paramSegs->__get((i * 2)),paramSegs->__get(((i * 2) + 1)));
+ }
+ }
+HXLINE( 561) if (::hx::IsNotNull( ufrag )) {
+HXLINE( 561) parameters->set(HX_("ufrag",27,78,a4,a1),ufrag);
+ }
+HXLINE( 562) return ::snikket::jingle::IceCandidate_obj::__alloc( HX_CTX ,sdpMid,ufrag,segments->__get(0),segments->__get(1),segments->__get(2),segments->__get(3),segments->__get(4),segments->__get(5),parameters);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC3(IceCandidate_obj,parse,return )
+
+
+::hx::ObjectPtr< IceCandidate_obj > IceCandidate_obj::__new(::String sdpMid,::String ufrag,::String foundation,::String component,::String transport,::String priority,::String connectionAddress,::String port, ::haxe::ds::StringMap parameters) {
+ ::hx::ObjectPtr< IceCandidate_obj > __this = new IceCandidate_obj();
+ __this->__construct(sdpMid,ufrag,foundation,component,transport,priority,connectionAddress,port,parameters);
+ return __this;
+}
+
+::hx::ObjectPtr< IceCandidate_obj > IceCandidate_obj::__alloc(::hx::Ctx *_hx_ctx,::String sdpMid,::String ufrag,::String foundation,::String component,::String transport,::String priority,::String connectionAddress,::String port, ::haxe::ds::StringMap parameters) {
+ IceCandidate_obj *__this = (IceCandidate_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(IceCandidate_obj), true, "snikket.jingle.IceCandidate"));
+ *(void **)__this = IceCandidate_obj::_hx_vtable;
+ __this->__construct(sdpMid,ufrag,foundation,component,transport,priority,connectionAddress,port,parameters);
+ return __this;
+}
+
+IceCandidate_obj::IceCandidate_obj()
+{
+}
+
+void IceCandidate_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(IceCandidate);
+ HX_MARK_MEMBER_NAME(sdpMid,"sdpMid");
+ HX_MARK_MEMBER_NAME(ufrag,"ufrag");
+ HX_MARK_MEMBER_NAME(foundation,"foundation");
+ HX_MARK_MEMBER_NAME(component,"component");
+ HX_MARK_MEMBER_NAME(transport,"transport");
+ HX_MARK_MEMBER_NAME(priority,"priority");
+ HX_MARK_MEMBER_NAME(connectionAddress,"connectionAddress");
+ HX_MARK_MEMBER_NAME(port,"port");
+ HX_MARK_MEMBER_NAME(parameters,"parameters");
+ HX_MARK_END_CLASS();
+}
+
+void IceCandidate_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(sdpMid,"sdpMid");
+ HX_VISIT_MEMBER_NAME(ufrag,"ufrag");
+ HX_VISIT_MEMBER_NAME(foundation,"foundation");
+ HX_VISIT_MEMBER_NAME(component,"component");
+ HX_VISIT_MEMBER_NAME(transport,"transport");
+ HX_VISIT_MEMBER_NAME(priority,"priority");
+ HX_VISIT_MEMBER_NAME(connectionAddress,"connectionAddress");
+ HX_VISIT_MEMBER_NAME(port,"port");
+ HX_VISIT_MEMBER_NAME(parameters,"parameters");
+}
+
+::hx::Val IceCandidate_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"port") ) { return ::hx::Val( port ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"ufrag") ) { return ::hx::Val( ufrag ); }
+ if (HX_FIELD_EQ(inName,"toSdp") ) { return ::hx::Val( toSdp_dyn() ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"sdpMid") ) { return ::hx::Val( sdpMid ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"priority") ) { return ::hx::Val( priority ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"component") ) { return ::hx::Val( component ); }
+ if (HX_FIELD_EQ(inName,"transport") ) { return ::hx::Val( transport ); }
+ if (HX_FIELD_EQ(inName,"toElement") ) { return ::hx::Val( toElement_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"foundation") ) { return ::hx::Val( foundation ); }
+ if (HX_FIELD_EQ(inName,"parameters") ) { return ::hx::Val( parameters ); }
+ break;
+ case 17:
+ if (HX_FIELD_EQ(inName,"connectionAddress") ) { return ::hx::Val( connectionAddress ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool IceCandidate_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"parse") ) { outValue = parse_dyn(); return true; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"fromStanza") ) { outValue = fromStanza_dyn(); return true; }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"fromElement") ) { outValue = fromElement_dyn(); return true; }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"fromTransport") ) { outValue = fromTransport_dyn(); return true; }
+ }
+ return false;
+}
+
+::hx::Val IceCandidate_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"port") ) { port=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"ufrag") ) { ufrag=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"sdpMid") ) { sdpMid=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"priority") ) { priority=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"component") ) { component=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"transport") ) { transport=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"foundation") ) { foundation=inValue.Cast< ::String >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"parameters") ) { parameters=inValue.Cast< ::haxe::ds::StringMap >(); return inValue; }
+ break;
+ case 17:
+ if (HX_FIELD_EQ(inName,"connectionAddress") ) { connectionAddress=inValue.Cast< ::String >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void IceCandidate_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("sdpMid",09,30,5f,d9));
+ outFields->push(HX_("ufrag",27,78,a4,a1));
+ outFields->push(HX_("foundation",33,a1,2a,39));
+ outFields->push(HX_("component",bd,f0,53,0f));
+ outFields->push(HX_("transport",a9,4f,2f,4c));
+ outFields->push(HX_("priority",64,7b,3e,bb));
+ outFields->push(HX_("connectionAddress",36,59,c7,56));
+ outFields->push(HX_("port",81,83,5c,4a));
+ outFields->push(HX_("parameters",aa,be,7e,51));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo IceCandidate_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(IceCandidate_obj,sdpMid),HX_("sdpMid",09,30,5f,d9)},
+ {::hx::fsString,(int)offsetof(IceCandidate_obj,ufrag),HX_("ufrag",27,78,a4,a1)},
+ {::hx::fsString,(int)offsetof(IceCandidate_obj,foundation),HX_("foundation",33,a1,2a,39)},
+ {::hx::fsString,(int)offsetof(IceCandidate_obj,component),HX_("component",bd,f0,53,0f)},
+ {::hx::fsString,(int)offsetof(IceCandidate_obj,transport),HX_("transport",a9,4f,2f,4c)},
+ {::hx::fsString,(int)offsetof(IceCandidate_obj,priority),HX_("priority",64,7b,3e,bb)},
+ {::hx::fsString,(int)offsetof(IceCandidate_obj,connectionAddress),HX_("connectionAddress",36,59,c7,56)},
+ {::hx::fsString,(int)offsetof(IceCandidate_obj,port),HX_("port",81,83,5c,4a)},
+ {::hx::fsObject /* ::haxe::ds::StringMap */ ,(int)offsetof(IceCandidate_obj,parameters),HX_("parameters",aa,be,7e,51)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *IceCandidate_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String IceCandidate_obj_sMemberFields[] = {
+ HX_("sdpMid",09,30,5f,d9),
+ HX_("ufrag",27,78,a4,a1),
+ HX_("foundation",33,a1,2a,39),
+ HX_("component",bd,f0,53,0f),
+ HX_("transport",a9,4f,2f,4c),
+ HX_("priority",64,7b,3e,bb),
+ HX_("connectionAddress",36,59,c7,56),
+ HX_("port",81,83,5c,4a),
+ HX_("parameters",aa,be,7e,51),
+ HX_("toElement",81,e6,e8,35),
+ HX_("toSdp",04,4c,19,14),
+ ::String(null()) };
+
+::hx::Class IceCandidate_obj::__mClass;
+
+static ::String IceCandidate_obj_sStaticFields[] = {
+ HX_("fromElement",72,12,95,9e),
+ HX_("fromTransport",df,8c,18,c0),
+ HX_("fromStanza",ff,62,3b,49),
+ HX_("parse",33,90,55,bd),
+ ::String(null())
+};
+
+void IceCandidate_obj::__register()
+{
+ IceCandidate_obj _hx_dummy;
+ IceCandidate_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.jingle.IceCandidate",84,08,a5,18);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &IceCandidate_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(IceCandidate_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(IceCandidate_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< IceCandidate_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = IceCandidate_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = IceCandidate_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace jingle
diff --git a/Sources/c_snikket/src/snikket/jingle/IncomingProposedSession.cpp b/Sources/c_snikket/src/snikket/jingle/IncomingProposedSession.cpp
new file mode 100644
index 0000000..77588b5
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/jingle/IncomingProposedSession.cpp
@@ -0,0 +1,519 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_Log
+#include <haxe/Log.h>
+#endif
+#ifndef INCLUDED_haxe_ds_StringMap
+#include <haxe/ds/StringMap.h>
+#endif
+#ifndef INCLUDED_snikket_Chat
+#include <snikket/Chat.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessage
+#include <snikket/ChatMessage.h>
+#endif
+#ifndef INCLUDED_snikket_Client
+#include <snikket/Client.h>
+#endif
+#ifndef INCLUDED_snikket_DirectChat
+#include <snikket/DirectChat.h>
+#endif
+#ifndef INCLUDED_snikket_EventEmitter
+#include <snikket/EventEmitter.h>
+#endif
+#ifndef INCLUDED_snikket_EventResult
+#include <snikket/EventResult.h>
+#endif
+#ifndef INCLUDED_snikket_JID
+#include <snikket/JID.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_DTMFSender
+#include <snikket/jingle/DTMFSender.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_IncomingProposedSession
+#include <snikket/jingle/IncomingProposedSession.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_InitiatedSession
+#include <snikket/jingle/InitiatedSession.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_MediaStream
+#include <snikket/jingle/MediaStream.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_MediaStreamTrack
+#include <snikket/jingle/MediaStreamTrack.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_Session
+#include <snikket/jingle/Session.h>
+#endif
+#ifndef INCLUDED_snikket_jingle__Session_Session_Fields_
+#include <snikket/jingle/_Session/Session_Fields_.h>
+#endif
+#ifndef INCLUDED_thenshim_Thenable
+#include <thenshim/Thenable.h>
+#endif
+#ifndef INCLUDED_thenshim__Promise_Promise_Impl_
+#include <thenshim/_Promise/Promise_Impl_.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_070c1caeb07d54b9_60_new,"snikket.jingle.IncomingProposedSession","new",0x8d7afc70,"snikket.jingle.IncomingProposedSession.new","snikket/jingle/Session.hx",60,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_070c1caeb07d54b9_79_ring,"snikket.jingle.IncomingProposedSession","ring",0x40c9c1a0,"snikket.jingle.IncomingProposedSession.ring","snikket/jingle/Session.hx",79,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_070c1caeb07d54b9_73_ring,"snikket.jingle.IncomingProposedSession","ring",0x40c9c1a0,"snikket.jingle.IncomingProposedSession.ring","snikket/jingle/Session.hx",73,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_070c1caeb07d54b9_91_hangup,"snikket.jingle.IncomingProposedSession","hangup",0xbd2f903d,"snikket.jingle.IncomingProposedSession.hangup","snikket/jingle/Session.hx",91,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_070c1caeb07d54b9_84_hangup,"snikket.jingle.IncomingProposedSession","hangup",0xbd2f903d,"snikket.jingle.IncomingProposedSession.hangup","snikket/jingle/Session.hx",84,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_070c1caeb07d54b9_98_retract,"snikket.jingle.IncomingProposedSession","retract",0x81505611,"snikket.jingle.IncomingProposedSession.retract","snikket/jingle/Session.hx",98,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_070c1caeb07d54b9_102_terminate,"snikket.jingle.IncomingProposedSession","terminate",0xabf9ca71,"snikket.jingle.IncomingProposedSession.terminate","snikket/jingle/Session.hx",102,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_070c1caeb07d54b9_106_contentAdd,"snikket.jingle.IncomingProposedSession","contentAdd",0xf85adc58,"snikket.jingle.IncomingProposedSession.contentAdd","snikket/jingle/Session.hx",106,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_070c1caeb07d54b9_110_contentAccept,"snikket.jingle.IncomingProposedSession","contentAccept",0x4d3ea531,"snikket.jingle.IncomingProposedSession.contentAccept","snikket/jingle/Session.hx",110,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_070c1caeb07d54b9_113_transportInfo,"snikket.jingle.IncomingProposedSession","transportInfo",0x230c1cc7,"snikket.jingle.IncomingProposedSession.transportInfo","snikket/jingle/Session.hx",113,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_070c1caeb07d54b9_124_accept,"snikket.jingle.IncomingProposedSession","accept",0x103650f8,"snikket.jingle.IncomingProposedSession.accept","snikket/jingle/Session.hx",124,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_070c1caeb07d54b9_118_accept,"snikket.jingle.IncomingProposedSession","accept",0x103650f8,"snikket.jingle.IncomingProposedSession.accept","snikket/jingle/Session.hx",118,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_070c1caeb07d54b9_134_initiate,"snikket.jingle.IncomingProposedSession","initiate",0xde9e8449,"snikket.jingle.IncomingProposedSession.initiate","snikket/jingle/Session.hx",134,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_070c1caeb07d54b9_144_addMedia,"snikket.jingle.IncomingProposedSession","addMedia",0xfe2844f3,"snikket.jingle.IncomingProposedSession.addMedia","snikket/jingle/Session.hx",144,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_070c1caeb07d54b9_148_callStatus,"snikket.jingle.IncomingProposedSession","callStatus",0xe5a93460,"snikket.jingle.IncomingProposedSession.callStatus","snikket/jingle/Session.hx",148,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_070c1caeb07d54b9_152_videoTracks,"snikket.jingle.IncomingProposedSession","videoTracks",0xf76e7e73,"snikket.jingle.IncomingProposedSession.videoTracks","snikket/jingle/Session.hx",152,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_070c1caeb07d54b9_156_dtmf,"snikket.jingle.IncomingProposedSession","dtmf",0x37911cd9,"snikket.jingle.IncomingProposedSession.dtmf","snikket/jingle/Session.hx",156,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_070c1caeb07d54b9_160_get_sid,"snikket.jingle.IncomingProposedSession","get_sid",0xab62dbb5,"snikket.jingle.IncomingProposedSession.get_sid","snikket/jingle/Session.hx",160,0x6db2dd54)
+namespace snikket{
+namespace jingle{
+
+void IncomingProposedSession_obj::__construct( ::snikket::Client client, ::snikket::JID from,::String sid){
+ HX_STACKFRAME(&_hx_pos_070c1caeb07d54b9_60_new)
+HXLINE( 65) this->accepted = false;
+HXLINE( 68) this->client = client;
+HXLINE( 69) this->from = from;
+HXLINE( 70) this->_sid = sid;
+ }
+
+Dynamic IncomingProposedSession_obj::__CreateEmpty() { return new IncomingProposedSession_obj; }
+
+void *IncomingProposedSession_obj::_hx_vtable = 0;
+
+Dynamic IncomingProposedSession_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< IncomingProposedSession_obj > _hx_result = new IncomingProposedSession_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2]);
+ return _hx_result;
+}
+
+bool IncomingProposedSession_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x409e1620;
+}
+
+static ::snikket::jingle::Session_obj _hx_snikket_jingle_IncomingProposedSession__hx_snikket_jingle_Session= {
+ ( ::String (::hx::Object::*)())&::snikket::jingle::IncomingProposedSession_obj::get_sid,
+ ( ::snikket::jingle::InitiatedSession (::hx::Object::*)( ::snikket::Stanza))&::snikket::jingle::IncomingProposedSession_obj::initiate,
+ ( void (::hx::Object::*)())&::snikket::jingle::IncomingProposedSession_obj::accept,
+ ( void (::hx::Object::*)())&::snikket::jingle::IncomingProposedSession_obj::hangup,
+ ( void (::hx::Object::*)())&::snikket::jingle::IncomingProposedSession_obj::retract,
+ ( void (::hx::Object::*)())&::snikket::jingle::IncomingProposedSession_obj::terminate,
+ ( void (::hx::Object::*)( ::snikket::Stanza))&::snikket::jingle::IncomingProposedSession_obj::contentAdd,
+ ( void (::hx::Object::*)( ::snikket::Stanza))&::snikket::jingle::IncomingProposedSession_obj::contentAccept,
+ ( ::Dynamic (::hx::Object::*)( ::snikket::Stanza))&::snikket::jingle::IncomingProposedSession_obj::transportInfo,
+ ( void (::hx::Object::*)(::Array< ::Dynamic>))&::snikket::jingle::IncomingProposedSession_obj::addMedia,
+ ( ::String (::hx::Object::*)())&::snikket::jingle::IncomingProposedSession_obj::callStatus,
+ ( ::Array< ::Dynamic> (::hx::Object::*)())&::snikket::jingle::IncomingProposedSession_obj::videoTracks,
+ ( ::snikket::jingle::DTMFSender (::hx::Object::*)())&::snikket::jingle::IncomingProposedSession_obj::dtmf,
+};
+
+void *IncomingProposedSession_obj::_hx_getInterface(int inHash) {
+ switch(inHash) {
+ case (int)0x79d60748: return &_hx_snikket_jingle_IncomingProposedSession__hx_snikket_jingle_Session;
+ }
+ #ifdef HXCPP_SCRIPTABLE
+ return super::_hx_getInterface(inHash);
+ #else
+ return 0;
+ #endif
+}
+
+void IncomingProposedSession_obj::ring(){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::jingle::IncomingProposedSession,_gthis) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> stored){
+ HX_GC_STACKFRAME(&_hx_pos_070c1caeb07d54b9_79_ring)
+HXLINE( 79) _gthis->client->notifyMessageHandlers(stored->__get(0).StaticCast< ::snikket::ChatMessage >(),1);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_070c1caeb07d54b9_73_ring)
+HXDLIN( 73) ::snikket::jingle::IncomingProposedSession _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 76) ::snikket::Stanza event = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("ringing",32,9b,80,1a), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("id",db,5b,00,00),this->get_sid())
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:jingle-message:0",fd,20,a5,07))));
+HXLINE( 77) ::snikket::ChatMessage msg = ::snikket::jingle::_Session::Session_Fields__obj::mkCallMessage(this->from,this->client->jid,event);
+HXLINE( 78) this->client->storeMessages(::Array_obj< ::Dynamic>::__new(1)->init(0,msg), ::Dynamic(new _hx_Closure_0(_gthis)));
+HXLINE( 81) ::snikket::Client _hx_tmp = this->client;
+HXDLIN( 81) _hx_tmp->trigger(HX_("call/ring",01,8e,91,54), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("session",56,17,98,93),::hx::ObjectPtr<OBJ_>(this))
+ ->setFixed(1,HX_("chatId",d3,04,77,b7),this->from->asBare()->asString())));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(IncomingProposedSession_obj,ring,(void))
+
+void IncomingProposedSession_obj::hangup(){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::jingle::IncomingProposedSession,_gthis) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> stored){
+ HX_GC_STACKFRAME(&_hx_pos_070c1caeb07d54b9_91_hangup)
+HXLINE( 91) _gthis->client->notifyMessageHandlers(stored->__get(0).StaticCast< ::snikket::ChatMessage >(),1);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_070c1caeb07d54b9_84_hangup)
+HXDLIN( 84) ::snikket::jingle::IncomingProposedSession _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 88) ::snikket::Stanza event = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("reject",5f,51,85,02), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("id",db,5b,00,00),this->get_sid())
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:jingle-message:0",fd,20,a5,07))));
+HXLINE( 89) ::snikket::ChatMessage msg = ::snikket::jingle::_Session::Session_Fields__obj::mkCallMessage(this->from,this->client->jid,event);
+HXLINE( 90) this->client->storeMessages(::Array_obj< ::Dynamic>::__new(1)->init(0,msg), ::Dynamic(new _hx_Closure_0(_gthis)));
+HXLINE( 93) {
+HXLINE( 93) ::snikket::Client this1 = this->client;
+HXDLIN( 93) ::Dynamic this2 = this1->getDirectChat(this->from->asBare()->asString(),false)->jingleSessions;
+HXDLIN( 93) ( ( ::haxe::ds::StringMap)(this2) )->remove(this->get_sid());
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(IncomingProposedSession_obj,hangup,(void))
+
+void IncomingProposedSession_obj::retract(){
+ HX_STACKFRAME(&_hx_pos_070c1caeb07d54b9_98_retract)
+HXDLIN( 98) ::snikket::Client _hx_tmp = this->client;
+HXDLIN( 98) _hx_tmp->trigger(HX_("call/retract",50,bc,8d,db), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("chatId",d3,04,77,b7),this->from->asBare()->asString())));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(IncomingProposedSession_obj,retract,(void))
+
+void IncomingProposedSession_obj::terminate(){
+ HX_STACKFRAME(&_hx_pos_070c1caeb07d54b9_102_terminate)
+HXDLIN( 102) ::Dynamic _hx_tmp = ::haxe::Log_obj::trace;
+HXDLIN( 102) ::String _hx_tmp1 = (HX_("Tried to terminate before session-initiate: ",a9,d4,f3,a4) + this->get_sid());
+HXDLIN( 102) _hx_tmp(_hx_tmp1, ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.jingle.IncomingProposedSession",7e,44,d0,fa))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,::hx::ObjectPtr<OBJ_>(this)))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("terminate",61,32,d2,fd))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/jingle/Session.hx",54,dd,b2,6d))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),102)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(IncomingProposedSession_obj,terminate,(void))
+
+void IncomingProposedSession_obj::contentAdd( ::snikket::Stanza _){
+ HX_STACKFRAME(&_hx_pos_070c1caeb07d54b9_106_contentAdd)
+HXDLIN( 106) ::Dynamic _hx_tmp = ::haxe::Log_obj::trace;
+HXDLIN( 106) ::String _hx_tmp1 = (HX_("Got content-add before session-initiate: ",10,d3,fa,8a) + this->get_sid());
+HXDLIN( 106) _hx_tmp(_hx_tmp1, ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.jingle.IncomingProposedSession",7e,44,d0,fa))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,::hx::ObjectPtr<OBJ_>(this)))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("contentAdd",68,66,dd,43))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/jingle/Session.hx",54,dd,b2,6d))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),106)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(IncomingProposedSession_obj,contentAdd,(void))
+
+void IncomingProposedSession_obj::contentAccept( ::snikket::Stanza _){
+ HX_STACKFRAME(&_hx_pos_070c1caeb07d54b9_110_contentAccept)
+HXDLIN( 110) ::Dynamic _hx_tmp = ::haxe::Log_obj::trace;
+HXDLIN( 110) ::String _hx_tmp1 = (HX_("Got content-accept before session-initiate: ",47,72,87,71) + this->get_sid());
+HXDLIN( 110) _hx_tmp(_hx_tmp1, ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.jingle.IncomingProposedSession",7e,44,d0,fa))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,::hx::ObjectPtr<OBJ_>(this)))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("contentAccept",21,c5,01,e1))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/jingle/Session.hx",54,dd,b2,6d))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),110)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(IncomingProposedSession_obj,contentAccept,(void))
+
+::Dynamic IncomingProposedSession_obj::transportInfo( ::snikket::Stanza _){
+ HX_STACKFRAME(&_hx_pos_070c1caeb07d54b9_113_transportInfo)
+HXLINE( 114) ::Dynamic _hx_tmp = ::haxe::Log_obj::trace;
+HXDLIN( 114) ::String _hx_tmp1 = (HX_("Got transport-info before session-initiate: ",bd,bd,9d,08) + this->get_sid());
+HXDLIN( 114) _hx_tmp(_hx_tmp1, ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.jingle.IncomingProposedSession",7e,44,d0,fa))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,::hx::ObjectPtr<OBJ_>(this)))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("transportInfo",b7,3c,cf,b6))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/jingle/Session.hx",54,dd,b2,6d))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),114)));
+HXLINE( 115) return ::thenshim::_Promise::Promise_Impl__obj::resolve(null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(IncomingProposedSession_obj,transportInfo,return )
+
+void IncomingProposedSession_obj::accept(){
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_0, ::snikket::jingle::IncomingProposedSession,_gthis, ::snikket::Stanza,event, ::snikket::ChatMessage,msg) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> stored){
+ HX_GC_STACKFRAME(&_hx_pos_070c1caeb07d54b9_124_accept)
+HXLINE( 125) _gthis->client->notifyMessageHandlers(stored->__get(0).StaticCast< ::snikket::ChatMessage >(),1);
+HXLINE( 126) ::snikket::Client _gthis1 = _gthis->client;
+HXLINE( 127) ::String _hx_tmp = _gthis->from->asString();
+HXLINE( 126) _gthis1->sendStanza( ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("message",c7,35,11,9a), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("id",db,5b,00,00),msg->versions->__get(0).StaticCast< ::snikket::ChatMessage >()->localId)
+ ->setFixed(1,HX_("to",7b,65,00,00),_hx_tmp)
+ ->setFixed(2,HX_("type",ba,f2,08,4d),HX_("chat",d8,5e,bf,41))))->addChild(event)->tag(HX_("store",e1,13,16,84), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:hints",70,b3,d6,fe)))));
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_070c1caeb07d54b9_118_accept)
+HXDLIN( 118) ::snikket::jingle::IncomingProposedSession _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 119) if (this->accepted) {
+HXLINE( 119) return;
+ }
+HXLINE( 120) this->accepted = true;
+HXLINE( 121) ::snikket::Client _hx_tmp = this->client;
+HXDLIN( 121) _hx_tmp->sendPresence(this->from->asString(),null());
+HXLINE( 122) ::snikket::Stanza event = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("proceed",2e,96,4a,f1), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("id",db,5b,00,00),this->get_sid())
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:jingle-message:0",fd,20,a5,07))));
+HXLINE( 123) ::snikket::ChatMessage msg = ::snikket::jingle::_Session::Session_Fields__obj::mkCallMessage(this->from,this->client->jid,event);
+HXLINE( 124) this->client->storeMessages(::Array_obj< ::Dynamic>::__new(1)->init(0,msg), ::Dynamic(new _hx_Closure_0(_gthis,event,msg)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(IncomingProposedSession_obj,accept,(void))
+
+ ::snikket::jingle::InitiatedSession IncomingProposedSession_obj::initiate( ::snikket::Stanza stanza){
+ HX_STACKFRAME(&_hx_pos_070c1caeb07d54b9_134_initiate)
+HXLINE( 136) ::snikket::jingle::InitiatedSession session = ::snikket::jingle::InitiatedSession_obj::fromSessionInitiate(this->client,stanza);
+HXLINE( 137) ::String _hx_tmp = session->get_sid();
+HXDLIN( 137) if ((_hx_tmp != this->get_sid())) {
+HXLINE( 137) HX_STACK_DO_THROW(HX_("id mismatch",33,05,74,bd));
+ }
+HXLINE( 138) if (!(this->accepted)) {
+HXLINE( 138) HX_STACK_DO_THROW(HX_("trying to initiate unaccepted session",b1,34,34,a4));
+ }
+HXLINE( 139) session->accept();
+HXLINE( 140) return session;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(IncomingProposedSession_obj,initiate,return )
+
+void IncomingProposedSession_obj::addMedia(::Array< ::Dynamic> _){
+ HX_STACKFRAME(&_hx_pos_070c1caeb07d54b9_144_addMedia)
+HXDLIN( 144) HX_STACK_DO_THROW(HX_("Cannot add media before call starts",aa,0a,79,d5));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(IncomingProposedSession_obj,addMedia,(void))
+
+::String IncomingProposedSession_obj::callStatus(){
+ HX_STACKFRAME(&_hx_pos_070c1caeb07d54b9_148_callStatus)
+HXDLIN( 148) return HX_("incoming",e6,40,15,1b);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(IncomingProposedSession_obj,callStatus,return )
+
+::Array< ::Dynamic> IncomingProposedSession_obj::videoTracks(){
+ HX_STACKFRAME(&_hx_pos_070c1caeb07d54b9_152_videoTracks)
+HXDLIN( 152) return ::Array_obj< ::Dynamic>::__new(0);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(IncomingProposedSession_obj,videoTracks,return )
+
+ ::snikket::jingle::DTMFSender IncomingProposedSession_obj::dtmf(){
+ HX_STACKFRAME(&_hx_pos_070c1caeb07d54b9_156_dtmf)
+HXDLIN( 156) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(IncomingProposedSession_obj,dtmf,return )
+
+::String IncomingProposedSession_obj::get_sid(){
+ HX_STACKFRAME(&_hx_pos_070c1caeb07d54b9_160_get_sid)
+HXDLIN( 160) return this->_sid;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(IncomingProposedSession_obj,get_sid,return )
+
+
+::hx::ObjectPtr< IncomingProposedSession_obj > IncomingProposedSession_obj::__new( ::snikket::Client client, ::snikket::JID from,::String sid) {
+ ::hx::ObjectPtr< IncomingProposedSession_obj > __this = new IncomingProposedSession_obj();
+ __this->__construct(client,from,sid);
+ return __this;
+}
+
+::hx::ObjectPtr< IncomingProposedSession_obj > IncomingProposedSession_obj::__alloc(::hx::Ctx *_hx_ctx, ::snikket::Client client, ::snikket::JID from,::String sid) {
+ IncomingProposedSession_obj *__this = (IncomingProposedSession_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(IncomingProposedSession_obj), true, "snikket.jingle.IncomingProposedSession"));
+ *(void **)__this = IncomingProposedSession_obj::_hx_vtable;
+ __this->__construct(client,from,sid);
+ return __this;
+}
+
+IncomingProposedSession_obj::IncomingProposedSession_obj()
+{
+}
+
+void IncomingProposedSession_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(IncomingProposedSession);
+ HX_MARK_MEMBER_NAME(sid,"sid");
+ HX_MARK_MEMBER_NAME(client,"client");
+ HX_MARK_MEMBER_NAME(from,"from");
+ HX_MARK_MEMBER_NAME(_sid,"_sid");
+ HX_MARK_MEMBER_NAME(accepted,"accepted");
+ HX_MARK_END_CLASS();
+}
+
+void IncomingProposedSession_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(sid,"sid");
+ HX_VISIT_MEMBER_NAME(client,"client");
+ HX_VISIT_MEMBER_NAME(from,"from");
+ HX_VISIT_MEMBER_NAME(_sid,"_sid");
+ HX_VISIT_MEMBER_NAME(accepted,"accepted");
+}
+
+::hx::Val IncomingProposedSession_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"sid") ) { return ::hx::Val( inCallProp == ::hx::paccAlways ? get_sid() : sid ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"from") ) { return ::hx::Val( from ); }
+ if (HX_FIELD_EQ(inName,"_sid") ) { return ::hx::Val( _sid ); }
+ if (HX_FIELD_EQ(inName,"ring") ) { return ::hx::Val( ring_dyn() ); }
+ if (HX_FIELD_EQ(inName,"dtmf") ) { return ::hx::Val( dtmf_dyn() ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"client") ) { return ::hx::Val( client ); }
+ if (HX_FIELD_EQ(inName,"hangup") ) { return ::hx::Val( hangup_dyn() ); }
+ if (HX_FIELD_EQ(inName,"accept") ) { return ::hx::Val( accept_dyn() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"retract") ) { return ::hx::Val( retract_dyn() ); }
+ if (HX_FIELD_EQ(inName,"get_sid") ) { return ::hx::Val( get_sid_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"accepted") ) { return ::hx::Val( accepted ); }
+ if (HX_FIELD_EQ(inName,"initiate") ) { return ::hx::Val( initiate_dyn() ); }
+ if (HX_FIELD_EQ(inName,"addMedia") ) { return ::hx::Val( addMedia_dyn() ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"terminate") ) { return ::hx::Val( terminate_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"contentAdd") ) { return ::hx::Val( contentAdd_dyn() ); }
+ if (HX_FIELD_EQ(inName,"callStatus") ) { return ::hx::Val( callStatus_dyn() ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"videoTracks") ) { return ::hx::Val( videoTracks_dyn() ); }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"contentAccept") ) { return ::hx::Val( contentAccept_dyn() ); }
+ if (HX_FIELD_EQ(inName,"transportInfo") ) { return ::hx::Val( transportInfo_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val IncomingProposedSession_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"sid") ) { sid=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"from") ) { from=inValue.Cast< ::snikket::JID >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"_sid") ) { _sid=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"client") ) { client=inValue.Cast< ::snikket::Client >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"accepted") ) { accepted=inValue.Cast< bool >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void IncomingProposedSession_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("sid",0e,9f,57,00));
+ outFields->push(HX_("client",4b,ca,4f,0a));
+ outFields->push(HX_("from",6a,a5,c2,43));
+ outFields->push(HX_("_sid",0f,e4,22,3f));
+ outFields->push(HX_("accepted",67,bd,17,c8));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo IncomingProposedSession_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(IncomingProposedSession_obj,sid),HX_("sid",0e,9f,57,00)},
+ {::hx::fsObject /* ::snikket::Client */ ,(int)offsetof(IncomingProposedSession_obj,client),HX_("client",4b,ca,4f,0a)},
+ {::hx::fsObject /* ::snikket::JID */ ,(int)offsetof(IncomingProposedSession_obj,from),HX_("from",6a,a5,c2,43)},
+ {::hx::fsString,(int)offsetof(IncomingProposedSession_obj,_sid),HX_("_sid",0f,e4,22,3f)},
+ {::hx::fsBool,(int)offsetof(IncomingProposedSession_obj,accepted),HX_("accepted",67,bd,17,c8)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *IncomingProposedSession_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String IncomingProposedSession_obj_sMemberFields[] = {
+ HX_("sid",0e,9f,57,00),
+ HX_("client",4b,ca,4f,0a),
+ HX_("from",6a,a5,c2,43),
+ HX_("_sid",0f,e4,22,3f),
+ HX_("accepted",67,bd,17,c8),
+ HX_("ring",b0,5f,aa,4b),
+ HX_("hangup",4d,d2,ff,b7),
+ HX_("retract",01,e2,b9,fc),
+ HX_("terminate",61,32,d2,fd),
+ HX_("contentAdd",68,66,dd,43),
+ HX_("contentAccept",21,c5,01,e1),
+ HX_("transportInfo",b7,3c,cf,b6),
+ HX_("accept",08,93,06,0b),
+ HX_("initiate",59,6a,8f,5f),
+ HX_("addMedia",03,2b,19,7f),
+ HX_("callStatus",70,be,2b,31),
+ HX_("videoTracks",63,c2,24,be),
+ HX_("dtmf",e9,ba,71,42),
+ HX_("get_sid",a5,67,cc,26),
+ ::String(null()) };
+
+::hx::Class IncomingProposedSession_obj::__mClass;
+
+void IncomingProposedSession_obj::__register()
+{
+ IncomingProposedSession_obj _hx_dummy;
+ IncomingProposedSession_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.jingle.IncomingProposedSession",7e,44,d0,fa);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(IncomingProposedSession_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< IncomingProposedSession_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = IncomingProposedSession_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = IncomingProposedSession_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace jingle
diff --git a/Sources/c_snikket/src/snikket/jingle/InitiatedSession.cpp b/Sources/c_snikket/src/snikket/jingle/InitiatedSession.cpp
new file mode 100644
index 0000000..f726ffc
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/jingle/InitiatedSession.cpp
@@ -0,0 +1,1563 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Lambda
+#include <Lambda.h>
+#endif
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED__HaxeCBridge_Internal
+#include <_HaxeCBridge/Internal.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_Log
+#include <haxe/Log.h>
+#endif
+#ifndef INCLUDED_haxe_Timer
+#include <haxe/Timer.h>
+#endif
+#ifndef INCLUDED_haxe_ds_IntMap
+#include <haxe/ds/IntMap.h>
+#endif
+#ifndef INCLUDED_snikket_Caps
+#include <snikket/Caps.h>
+#endif
+#ifndef INCLUDED_snikket_Chat
+#include <snikket/Chat.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessage
+#include <snikket/ChatMessage.h>
+#endif
+#ifndef INCLUDED_snikket_Client
+#include <snikket/Client.h>
+#endif
+#ifndef INCLUDED_snikket_DirectChat
+#include <snikket/DirectChat.h>
+#endif
+#ifndef INCLUDED_snikket_EventEmitter
+#include <snikket/EventEmitter.h>
+#endif
+#ifndef INCLUDED_snikket_EventResult
+#include <snikket/EventResult.h>
+#endif
+#ifndef INCLUDED_snikket_ID
+#include <snikket/ID.h>
+#endif
+#ifndef INCLUDED_snikket_JID
+#include <snikket/JID.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_Attribute
+#include <snikket/jingle/Attribute.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_DTMFSender
+#include <snikket/jingle/DTMFSender.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_IceCandidate
+#include <snikket/jingle/IceCandidate.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_InitiatedSession
+#include <snikket/jingle/InitiatedSession.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_Media
+#include <snikket/jingle/Media.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_MediaStream
+#include <snikket/jingle/MediaStream.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_MediaStreamTrack
+#include <snikket/jingle/MediaStreamTrack.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_OutgoingSession
+#include <snikket/jingle/OutgoingSession.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_PeerConnection
+#include <snikket/jingle/PeerConnection.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_Session
+#include <snikket/jingle/Session.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_SessionDescription
+#include <snikket/jingle/SessionDescription.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_TransportInfo
+#include <snikket/jingle/TransportInfo.h>
+#endif
+#ifndef INCLUDED_snikket_jingle__Session_Session_Fields_
+#include <snikket/jingle/_Session/Session_Fields_.h>
+#endif
+#ifndef INCLUDED_thenshim_PromiseTools
+#include <thenshim/PromiseTools.h>
+#endif
+#ifndef INCLUDED_thenshim_Thenable
+#include <thenshim/Thenable.h>
+#endif
+#ifndef INCLUDED_thenshim__Promise_Promise_Impl_
+#include <thenshim/_Promise/Promise_Impl_.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_de51993dbb06b02d_278_new,"snikket.jingle.InitiatedSession","new",0x32cfb629,"snikket.jingle.InitiatedSession.new","snikket/jingle/Session.hx",278,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_042a82ddefcd0233_271_sid__fromC,"snikket.jingle.InitiatedSession","sid__fromC",0x9aaf4482,"snikket.jingle.InitiatedSession.sid__fromC","HaxeCBridge.hx",271,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_317_get_sid,"snikket.jingle.InitiatedSession","get_sid",0x312965ee,"snikket.jingle.InitiatedSession.get_sid","snikket/jingle/Session.hx",317,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_322_ring,"snikket.jingle.InitiatedSession","ring",0x459789c7,"snikket.jingle.InitiatedSession.ring","snikket/jingle/Session.hx",322,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_327_retract,"snikket.jingle.InitiatedSession","retract",0x0716e04a,"snikket.jingle.InitiatedSession.retract","snikket/jingle/Session.hx",327,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_333_accept,"snikket.jingle.InitiatedSession","accept",0x3a23b0df,"snikket.jingle.InitiatedSession.accept","snikket/jingle/Session.hx",333,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_334_accept,"snikket.jingle.InitiatedSession","accept",0x3a23b0df,"snikket.jingle.InitiatedSession.accept","snikket/jingle/Session.hx",334,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_330_accept,"snikket.jingle.InitiatedSession","accept",0x3a23b0df,"snikket.jingle.InitiatedSession.accept","snikket/jingle/Session.hx",330,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_338_hangup,"snikket.jingle.InitiatedSession","hangup",0xe71cf024,"snikket.jingle.InitiatedSession.hangup","snikket/jingle/Session.hx",338,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_349_initiate,"snikket.jingle.InitiatedSession","initiate",0x6690ebf0,"snikket.jingle.InitiatedSession.initiate","snikket/jingle/Session.hx",349,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_368_terminate,"snikket.jingle.InitiatedSession","terminate",0x182214ea,"snikket.jingle.InitiatedSession.terminate","snikket/jingle/Session.hx",368,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_355_terminate,"snikket.jingle.InitiatedSession","terminate",0x182214ea,"snikket.jingle.InitiatedSession.terminate","snikket/jingle/Session.hx",355,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_402_contentAdd,"snikket.jingle.InitiatedSession","contentAdd",0x2f73bbbf,"snikket.jingle.InitiatedSession.contentAdd","snikket/jingle/Session.hx",402,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_401_contentAdd,"snikket.jingle.InitiatedSession","contentAdd",0x2f73bbbf,"snikket.jingle.InitiatedSession.contentAdd","snikket/jingle/Session.hx",401,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_395_contentAdd,"snikket.jingle.InitiatedSession","contentAdd",0x2f73bbbf,"snikket.jingle.InitiatedSession.contentAdd","snikket/jingle/Session.hx",395,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_394_contentAdd,"snikket.jingle.InitiatedSession","contentAdd",0x2f73bbbf,"snikket.jingle.InitiatedSession.contentAdd","snikket/jingle/Session.hx",394,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_379_contentAdd,"snikket.jingle.InitiatedSession","contentAdd",0x2f73bbbf,"snikket.jingle.InitiatedSession.contentAdd","snikket/jingle/Session.hx",379,0x6db2dd54)
+static const bool _hx_array_data_22056db7_21[] = {
+ 0,
+};
+static const bool _hx_array_data_22056db7_22[] = {
+ 0,
+};
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_386_contentAdd,"snikket.jingle.InitiatedSession","contentAdd",0x2f73bbbf,"snikket.jingle.InitiatedSession.contentAdd","snikket/jingle/Session.hx",386,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_418_contentAccept,"snikket.jingle.InitiatedSession","contentAccept",0x3fd0202a,"snikket.jingle.InitiatedSession.contentAccept","snikket/jingle/Session.hx",418,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_445_transportInfo,"snikket.jingle.InitiatedSession","transportInfo",0x159d97c0,"snikket.jingle.InitiatedSession.transportInfo","snikket/jingle/Session.hx",445,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_431_transportInfo,"snikket.jingle.InitiatedSession","transportInfo",0x159d97c0,"snikket.jingle.InitiatedSession.transportInfo","snikket/jingle/Session.hx",431,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_448_addMedia,"snikket.jingle.InitiatedSession","addMedia",0x861aac9a,"snikket.jingle.InitiatedSession.addMedia","snikket/jingle/Session.hx",448,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_042a82ddefcd0233_244_addMedia__fromC,"snikket.jingle.InitiatedSession","addMedia__fromC",0x8f17eb1f,"snikket.jingle.InitiatedSession.addMedia__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_462_callStatus,"snikket.jingle.InitiatedSession","callStatus",0x1cc213c7,"snikket.jingle.InitiatedSession.callStatus","snikket/jingle/Session.hx",462,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_465_videoTracks,"snikket.jingle.InitiatedSession","videoTracks",0xf619192c,"snikket.jingle.InitiatedSession.videoTracks","snikket/jingle/Session.hx",465,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_042a82ddefcd0233_242_videoTracks__fromC,"snikket.jingle.InitiatedSession","videoTracks__fromC",0x21c414cd,"snikket.jingle.InitiatedSession.videoTracks__fromC","HaxeCBridge.hx",242,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_474_dtmf,"snikket.jingle.InitiatedSession","dtmf",0x3c5ee500,"snikket.jingle.InitiatedSession.dtmf","snikket/jingle/Session.hx",474,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_472_dtmf,"snikket.jingle.InitiatedSession","dtmf",0x3c5ee500,"snikket.jingle.InitiatedSession.dtmf","snikket/jingle/Session.hx",472,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_489_sendIceCandidate,"snikket.jingle.InitiatedSession","sendIceCandidate",0x8f88e577,"snikket.jingle.InitiatedSession.sendIceCandidate","snikket/jingle/Session.hx",489,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_501_sendIceCandidate,"snikket.jingle.InitiatedSession","sendIceCandidate",0x8f88e577,"snikket.jingle.InitiatedSession.sendIceCandidate","snikket/jingle/Session.hx",501,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_479_sendIceCandidate,"snikket.jingle.InitiatedSession","sendIceCandidate",0x8f88e577,"snikket.jingle.InitiatedSession.sendIceCandidate","snikket/jingle/Session.hx",479,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_502_sendIceCandidate,"snikket.jingle.InitiatedSession","sendIceCandidate",0x8f88e577,"snikket.jingle.InitiatedSession.sendIceCandidate","snikket/jingle/Session.hx",502,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_514_supplyMedia,"snikket.jingle.InitiatedSession","supplyMedia",0xd2bd62fe,"snikket.jingle.InitiatedSession.supplyMedia","snikket/jingle/Session.hx",514,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_522_supplyMedia,"snikket.jingle.InitiatedSession","supplyMedia",0xd2bd62fe,"snikket.jingle.InitiatedSession.supplyMedia","snikket/jingle/Session.hx",522,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_513_supplyMedia,"snikket.jingle.InitiatedSession","supplyMedia",0xd2bd62fe,"snikket.jingle.InitiatedSession.supplyMedia","snikket/jingle/Session.hx",513,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_042a82ddefcd0233_244_supplyMedia__fromC,"snikket.jingle.InitiatedSession","supplyMedia__fromC",0x2f8c893b,"snikket.jingle.InitiatedSession.supplyMedia__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_540_setupPeerConnection,"snikket.jingle.InitiatedSession","setupPeerConnection",0xb3182f86,"snikket.jingle.InitiatedSession.setupPeerConnection","snikket/jingle/Session.hx",540,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_542_setupPeerConnection,"snikket.jingle.InitiatedSession","setupPeerConnection",0xb3182f86,"snikket.jingle.InitiatedSession.setupPeerConnection","snikket/jingle/Session.hx",542,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_544_setupPeerConnection,"snikket.jingle.InitiatedSession","setupPeerConnection",0xb3182f86,"snikket.jingle.InitiatedSession.setupPeerConnection","snikket/jingle/Session.hx",544,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_547_setupPeerConnection,"snikket.jingle.InitiatedSession","setupPeerConnection",0xb3182f86,"snikket.jingle.InitiatedSession.setupPeerConnection","snikket/jingle/Session.hx",547,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_537_setupPeerConnection,"snikket.jingle.InitiatedSession","setupPeerConnection",0xb3182f86,"snikket.jingle.InitiatedSession.setupPeerConnection","snikket/jingle/Session.hx",537,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_532_setupPeerConnection,"snikket.jingle.InitiatedSession","setupPeerConnection",0xb3182f86,"snikket.jingle.InitiatedSession.setupPeerConnection","snikket/jingle/Session.hx",532,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_556_setupLocalDescription,"snikket.jingle.InitiatedSession","setupLocalDescription",0x3c0669f7,"snikket.jingle.InitiatedSession.setupLocalDescription","snikket/jingle/Session.hx",556,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_561_setupLocalDescription,"snikket.jingle.InitiatedSession","setupLocalDescription",0x3c0669f7,"snikket.jingle.InitiatedSession.setupLocalDescription","snikket/jingle/Session.hx",561,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_560_setupLocalDescription,"snikket.jingle.InitiatedSession","setupLocalDescription",0x3c0669f7,"snikket.jingle.InitiatedSession.setupLocalDescription","snikket/jingle/Session.hx",560,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_564_setupLocalDescription,"snikket.jingle.InitiatedSession","setupLocalDescription",0x3c0669f7,"snikket.jingle.InitiatedSession.setupLocalDescription","snikket/jingle/Session.hx",564,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_559_setupLocalDescription,"snikket.jingle.InitiatedSession","setupLocalDescription",0x3c0669f7,"snikket.jingle.InitiatedSession.setupLocalDescription","snikket/jingle/Session.hx",559,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_572_setupLocalDescription,"snikket.jingle.InitiatedSession","setupLocalDescription",0x3c0669f7,"snikket.jingle.InitiatedSession.setupLocalDescription","snikket/jingle/Session.hx",572,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_555_setupLocalDescription,"snikket.jingle.InitiatedSession","setupLocalDescription",0x3c0669f7,"snikket.jingle.InitiatedSession.setupLocalDescription","snikket/jingle/Session.hx",555,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_600_onPeerConnection,"snikket.jingle.InitiatedSession","onPeerConnection",0x7ec12276,"snikket.jingle.InitiatedSession.onPeerConnection","snikket/jingle/Session.hx",600,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_606_onPeerConnection,"snikket.jingle.InitiatedSession","onPeerConnection",0x7ec12276,"snikket.jingle.InitiatedSession.onPeerConnection","snikket/jingle/Session.hx",606,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_607_onPeerConnection,"snikket.jingle.InitiatedSession","onPeerConnection",0x7ec12276,"snikket.jingle.InitiatedSession.onPeerConnection","snikket/jingle/Session.hx",607,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_598_onPeerConnection,"snikket.jingle.InitiatedSession","onPeerConnection",0x7ec12276,"snikket.jingle.InitiatedSession.onPeerConnection","snikket/jingle/Session.hx",598,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_304_fromSessionInitiate,"snikket.jingle.InitiatedSession","fromSessionInitiate",0xe2a3554e,"snikket.jingle.InitiatedSession.fromSessionInitiate","snikket/jingle/Session.hx",304,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_de51993dbb06b02d_278_boot,"snikket.jingle.InitiatedSession","boot",0x3b08ae49,"snikket.jingle.InitiatedSession.boot","snikket/jingle/Session.hx",278,0x6db2dd54)
+namespace snikket{
+namespace jingle{
+
+void InitiatedSession_obj::__construct( ::snikket::Client client, ::snikket::JID counterpart,::String sid, ::snikket::jingle::SessionDescription remoteDescription){
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_278_new)
+HXLINE( 292) this->candidatesDone = null();
+HXLINE( 290) this->afterMedia = null();
+HXLINE( 289) this->accepted = false;
+HXLINE( 288) this->queuedOutboundCandidate = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 287) this->queuedInboundTransportInfo = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 286) this->peerDtlsSetup = HX_("actpass",23,e7,c3,6b);
+HXLINE( 285) this->pc = null();
+HXLINE( 284) this->localDescription = null();
+HXLINE( 283) this->remoteDescription = null();
+HXLINE( 296) this->client = client;
+HXLINE( 297) this->counterpart = counterpart;
+HXLINE( 298) this->_sid = sid;
+HXLINE( 299) this->remoteDescription = remoteDescription;
+HXLINE( 300) this->initiator = ::hx::IsNull( remoteDescription );
+ }
+
+Dynamic InitiatedSession_obj::__CreateEmpty() { return new InitiatedSession_obj; }
+
+void *InitiatedSession_obj::_hx_vtable = 0;
+
+Dynamic InitiatedSession_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< InitiatedSession_obj > _hx_result = new InitiatedSession_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2],inArgs[3]);
+ return _hx_result;
+}
+
+bool InitiatedSession_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x050f75b9;
+}
+
+static ::snikket::jingle::Session_obj _hx_snikket_jingle_InitiatedSession__hx_snikket_jingle_Session= {
+ ( ::String (::hx::Object::*)())&::snikket::jingle::InitiatedSession_obj::get_sid,
+ ( ::snikket::jingle::InitiatedSession (::hx::Object::*)( ::snikket::Stanza))&::snikket::jingle::InitiatedSession_obj::initiate_ef691953,
+ ( void (::hx::Object::*)())&::snikket::jingle::InitiatedSession_obj::accept,
+ ( void (::hx::Object::*)())&::snikket::jingle::InitiatedSession_obj::hangup,
+ ( void (::hx::Object::*)())&::snikket::jingle::InitiatedSession_obj::retract,
+ ( void (::hx::Object::*)())&::snikket::jingle::InitiatedSession_obj::terminate,
+ ( void (::hx::Object::*)( ::snikket::Stanza))&::snikket::jingle::InitiatedSession_obj::contentAdd,
+ ( void (::hx::Object::*)( ::snikket::Stanza))&::snikket::jingle::InitiatedSession_obj::contentAccept,
+ ( ::Dynamic (::hx::Object::*)( ::snikket::Stanza))&::snikket::jingle::InitiatedSession_obj::transportInfo,
+ ( void (::hx::Object::*)(::Array< ::Dynamic>))&::snikket::jingle::InitiatedSession_obj::addMedia,
+ ( ::String (::hx::Object::*)())&::snikket::jingle::InitiatedSession_obj::callStatus,
+ ( ::Array< ::Dynamic> (::hx::Object::*)())&::snikket::jingle::InitiatedSession_obj::videoTracks,
+ ( ::snikket::jingle::DTMFSender (::hx::Object::*)())&::snikket::jingle::InitiatedSession_obj::dtmf,
+};
+
+ ::snikket::jingle::InitiatedSession InitiatedSession_obj::initiate_ef691953( ::snikket::Stanza stanza) {
+ return initiate(stanza);
+}
+void *InitiatedSession_obj::_hx_getInterface(int inHash) {
+ switch(inHash) {
+ case (int)0x79d60748: return &_hx_snikket_jingle_InitiatedSession__hx_snikket_jingle_Session;
+ }
+ #ifdef HXCPP_SCRIPTABLE
+ return super::_hx_getInterface(inHash);
+ #else
+ return 0;
+ #endif
+}
+
+::String InitiatedSession_obj::sid__fromC(){
+ HX_STACKFRAME(&_hx_pos_042a82ddefcd0233_271_sid__fromC)
+HXDLIN( 271) return this->get_sid();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(InitiatedSession_obj,sid__fromC,return )
+
+::String InitiatedSession_obj::get_sid(){
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_317_get_sid)
+HXDLIN( 317) return this->_sid;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(InitiatedSession_obj,get_sid,return )
+
+void InitiatedSession_obj::ring(){
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_322_ring)
+HXDLIN( 322) ::snikket::Client _hx_tmp = this->client;
+HXDLIN( 322) _hx_tmp->trigger(HX_("call/ring",01,8e,91,54), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("session",56,17,98,93),::hx::ObjectPtr<OBJ_>(this))
+ ->setFixed(1,HX_("chatId",d3,04,77,b7),this->counterpart->asBare()->asString())));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(InitiatedSession_obj,ring,(void))
+
+void InitiatedSession_obj::retract(){
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_327_retract)
+HXDLIN( 327) ::Dynamic _hx_tmp = ::haxe::Log_obj::trace;
+HXDLIN( 327) ::String _hx_tmp1 = (HX_("Tried to retract session in wrong state: ",e1,1c,0c,db) + this->get_sid());
+HXDLIN( 327) _hx_tmp(_hx_tmp1, ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.jingle.InitiatedSession",b7,6d,05,22))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,::hx::ObjectPtr<OBJ_>(this)))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("retract",01,e2,b9,fc))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/jingle/Session.hx",54,dd,b2,6d))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),327)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(InitiatedSession_obj,retract,(void))
+
+void InitiatedSession_obj::accept(){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Media m){
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_333_accept)
+HXLINE( 333) return (m->media == HX_("audio",d6,78,80,27));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_1) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Media m){
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_334_accept)
+HXLINE( 334) return (m->media == HX_("video",7b,14,fc,36));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_330_accept)
+HXLINE( 331) bool _hx_tmp;
+HXDLIN( 331) if (!(this->accepted)) {
+HXLINE( 331) _hx_tmp = ::hx::IsNull( this->remoteDescription );
+ }
+ else {
+HXLINE( 331) _hx_tmp = true;
+ }
+HXDLIN( 331) if (_hx_tmp) {
+HXLINE( 331) return;
+ }
+HXLINE( 332) this->accepted = true;
+HXLINE( 333) bool audio = ::hx::IsNotNull( ::Lambda_obj::find(this->remoteDescription->media, ::Dynamic(new _hx_Closure_0())) );
+HXLINE( 334) bool video = ::hx::IsNotNull( ::Lambda_obj::find(this->remoteDescription->media, ::Dynamic(new _hx_Closure_1())) );
+HXLINE( 335) this->client->trigger(HX_("call/media",73,5d,1d,c7), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("session",56,17,98,93),::hx::ObjectPtr<OBJ_>(this))
+ ->setFixed(1,HX_("audio",d6,78,80,27),audio)
+ ->setFixed(2,HX_("video",7b,14,fc,36),video)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(InitiatedSession_obj,accept,(void))
+
+void InitiatedSession_obj::hangup(){
+ HX_GC_STACKFRAME(&_hx_pos_de51993dbb06b02d_338_hangup)
+HXLINE( 339) ::snikket::Client _hx_tmp = this->client;
+HXLINE( 340) ::String _hx_tmp1 = this->counterpart->asString();
+HXDLIN( 340) ::snikket::Stanza _hx_tmp2 = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("iq",e8,5b,00,00), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("id",db,5b,00,00),::snikket::ID_obj::medium())
+ ->setFixed(1,HX_("to",7b,65,00,00),_hx_tmp1)
+ ->setFixed(2,HX_("type",ba,f2,08,4d),HX_("set",a2,9b,57,00))));
+HXLINE( 339) _hx_tmp->sendStanza(_hx_tmp2->tag(HX_("jingle",31,27,eb,1f), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("sid",0e,9f,57,00),this->get_sid())
+ ->setFixed(1,HX_("action",b6,3b,46,16),HX_("session-terminate",6a,23,dc,12))
+ ->setFixed(2,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:jingle:1",44,c4,fe,f7))))->tag(HX_("reason",c4,0f,9d,fc),null())->tag(HX_("success",c3,25,4e,b8),null())->up()->up()->up());
+HXLINE( 345) this->terminate();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(InitiatedSession_obj,hangup,(void))
+
+ ::snikket::jingle::OutgoingSession InitiatedSession_obj::initiate( ::snikket::Stanza stanza){
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_349_initiate)
+HXLINE( 350) ::Dynamic _hx_tmp = ::haxe::Log_obj::trace;
+HXDLIN( 350) ::String _hx_tmp1 = (HX_("Trying to initiate already initiated session: ",84,56,c8,79) + this->get_sid());
+HXDLIN( 350) _hx_tmp(_hx_tmp1,::hx::SourceInfo(HX_("snikket/jingle/Session.hx",54,dd,b2,6d),350,HX_("snikket.jingle.InitiatedSession",b7,6d,05,22),HX_("initiate",59,6a,8f,5f)));
+HXLINE( 351) HX_STACK_DO_THROW(HX_("already initiated",63,a5,36,1a));
+HXDLIN( 351) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(InitiatedSession_obj,initiate,return )
+
+void InitiatedSession_obj::terminate(){
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_0, ::snikket::jingle::InitiatedSession,_gthis, ::snikket::Stanza,event, ::snikket::ChatMessage,msg) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> stored){
+ HX_GC_STACKFRAME(&_hx_pos_de51993dbb06b02d_368_terminate)
+HXLINE( 369) _gthis->client->notifyMessageHandlers(stored->__get(0).StaticCast< ::snikket::ChatMessage >(),1);
+HXLINE( 370) ::snikket::Client _gthis1 = _gthis->client;
+HXLINE( 371) ::String _hx_tmp = _gthis->counterpart->asString();
+HXLINE( 370) _gthis1->sendStanza( ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("message",c7,35,11,9a), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("id",db,5b,00,00),msg->versions->__get(0).StaticCast< ::snikket::ChatMessage >()->localId)
+ ->setFixed(1,HX_("to",7b,65,00,00),_hx_tmp)
+ ->setFixed(2,HX_("type",ba,f2,08,4d),HX_("chat",d8,5e,bf,41))))->addChild(event)->tag(HX_("store",e1,13,16,84), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:hints",70,b3,d6,fe)))));
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_de51993dbb06b02d_355_terminate)
+HXDLIN( 355) ::snikket::jingle::InitiatedSession _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 356) if (::hx::IsNull( this->pc )) {
+HXLINE( 356) return;
+ }
+HXLINE( 357) this->pc->close();
+HXLINE( 358) {
+HXLINE( 358) int _g = 0;
+HXDLIN( 358) ::Array< ::Dynamic> _g1 = this->pc->getTransceivers();
+HXDLIN( 358) while((_g < _g1->length)){
+HXLINE( 358) ::Dynamic tranceiver = _g1->__get(_g);
+HXDLIN( 358) _g = (_g + 1);
+HXLINE( 359) bool _hx_tmp;
+HXDLIN( 359) if (::hx::IsNotNull( tranceiver->__Field(HX_("sender",b5,c7,84,6b),::hx::paccDynamic) )) {
+HXLINE( 359) _hx_tmp = ::hx::IsNotNull( ::Dynamic(tranceiver->__Field(HX_("sender",b5,c7,84,6b),::hx::paccDynamic))->__Field(HX_("track",8b,8e,1f,16),::hx::paccDynamic) );
+ }
+ else {
+HXLINE( 359) _hx_tmp = false;
+ }
+HXDLIN( 359) if (_hx_tmp) {
+HXLINE( 360) ( ( ::snikket::jingle::MediaStreamTrack)( ::Dynamic(tranceiver->__Field(HX_("sender",b5,c7,84,6b),::hx::paccDynamic))->__Field(HX_("track",8b,8e,1f,16),::hx::paccDynamic)) )->stop();
+ }
+ }
+ }
+HXLINE( 363) this->pc = null();
+HXLINE( 364) ::snikket::Client _hx_tmp1 = this->client;
+HXDLIN( 364) _hx_tmp1->trigger(HX_("call/retract",50,bc,8d,db), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("chatId",d3,04,77,b7),this->counterpart->asBare()->asString())));
+HXLINE( 366) ::snikket::Stanza event = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("finish",53,40,7f,86), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("id",db,5b,00,00),this->get_sid())
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:jingle-message:0",fd,20,a5,07))));
+HXLINE( 367) ::snikket::ChatMessage msg = ::snikket::jingle::_Session::Session_Fields__obj::mkCallMessage(this->counterpart,this->client->jid,event);
+HXLINE( 368) this->client->storeMessages(::Array_obj< ::Dynamic>::__new(1)->init(0,msg), ::Dynamic(new _hx_Closure_0(_gthis,event,msg)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(InitiatedSession_obj,terminate,(void))
+
+void InitiatedSession_obj::contentAdd( ::snikket::Stanza stanza){
+ HX_BEGIN_LOCAL_FUNC_S4(::hx::LocalFunc,_hx_Closure_5,::Array< bool >,video, ::snikket::jingle::InitiatedSession,_gthis, ::snikket::jingle::SessionDescription,addThis,::Array< bool >,audio) HXARGC(1)
+ ::snikket::EventResult _hx_run( ::Dynamic _){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_4, ::snikket::jingle::InitiatedSession,_gthis, ::snikket::jingle::SessionDescription,addThis) HXARGC(0)
+ void _hx_run(){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_3, ::snikket::jingle::InitiatedSession,_gthis, ::snikket::jingle::SessionDescription,addThis) HXARGC(1)
+ void _hx_run( ::snikket::jingle::SessionDescription gonnaAccept){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_2, ::snikket::jingle::SessionDescription,addThis) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Media m){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_1, ::snikket::jingle::Media,m) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Media addM){
+ HX_GC_STACKFRAME(&_hx_pos_de51993dbb06b02d_402_contentAdd)
+HXLINE( 402) return (addM->mid == m->mid);
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_de51993dbb06b02d_402_contentAdd)
+HXLINE( 402) ::String _hx_tmp = ( (::String)(::Reflect_obj::field(m->contentElement(false)->attr,HX_("senders",1e,f7,a9,a8))) );
+HXDLIN( 402) return (_hx_tmp != ( (::String)(::Reflect_obj::field(( ( ::snikket::jingle::Media)(::Lambda_obj::find(addThis->media, ::Dynamic(new _hx_Closure_1(m)))) )->contentElement(false)->attr,HX_("senders",1e,f7,a9,a8))) ));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_de51993dbb06b02d_401_contentAdd)
+HXLINE( 401) if (::hx::IsNotNull( ::Lambda_obj::find(gonnaAccept->media, ::Dynamic(new _hx_Closure_2(addThis))) )) {
+HXLINE( 404) ::String modify = _gthis->get_sid();
+HXDLIN( 404) ::snikket::Stanza modify1 = gonnaAccept->toStanza(HX_("content-modify",4e,70,8f,a8),modify,_gthis->initiator);
+HXLINE( 405) {
+HXLINE( 405) ::Dynamic this1 = modify1->attr;
+HXDLIN( 405) ::String value = _gthis->counterpart->asString();
+HXDLIN( 405) ::Reflect_obj::setField(this1,HX_("to",7b,65,00,00),value);
+ }
+HXLINE( 406) {
+HXLINE( 406) ::Dynamic this2 = modify1->attr;
+HXDLIN( 406) ::String value1 = ::snikket::ID_obj::medium();
+HXDLIN( 406) ::Reflect_obj::setField(this2,HX_("id",db,5b,00,00),value1);
+ }
+HXLINE( 407) _gthis->client->sendStanza(modify1);
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_de51993dbb06b02d_395_contentAdd)
+HXLINE( 396) ::snikket::jingle::InitiatedSession _gthis1 = _gthis;
+HXLINE( 398) ::Array< ::Dynamic> _this = addThis->media;
+HXDLIN( 398) ::Array< ::String > result = ::Array_obj< ::String >::__new(_this->length);
+HXDLIN( 398) {
+HXLINE( 398) int _g = 0;
+HXDLIN( 398) int _g1 = _this->length;
+HXDLIN( 398) while((_g < _g1)){
+HXLINE( 398) _g = (_g + 1);
+HXDLIN( 398) int i = (_g - 1);
+HXDLIN( 398) {
+HXLINE( 398) ::String inValue = ( ( ::snikket::jingle::Media)(_hx_array_unsafe_get(_this,i)) )->mid;
+HXDLIN( 398) result->__unsafe_set(i,inValue);
+ }
+ }
+ }
+HXLINE( 396) _gthis1->setupLocalDescription(HX_("content-accept",dc,ee,cb,f2),result,false, ::Dynamic(new _hx_Closure_3(_gthis,addThis)));
+HXLINE( 411) _gthis->afterMedia = null();
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_de51993dbb06b02d_394_contentAdd)
+HXLINE( 395) _gthis->afterMedia = ::Dynamic(new _hx_Closure_4(_gthis,addThis));
+HXLINE( 413) return _gthis->client->trigger(HX_("call/media",73,5d,1d,c7), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("session",56,17,98,93),_gthis)
+ ->setFixed(1,HX_("audio",d6,78,80,27),audio->__get(0))
+ ->setFixed(2,HX_("video",7b,14,fc,36),video->__get(0))));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_de51993dbb06b02d_379_contentAdd)
+HXDLIN( 379) ::snikket::jingle::InitiatedSession _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 380) if (::hx::IsNull( this->remoteDescription )) {
+HXLINE( 380) HX_STACK_DO_THROW(HX_("Got content-add before session-accept",59,44,5e,1c));
+ }
+HXLINE( 382) ::snikket::jingle::SessionDescription addThis = ::snikket::jingle::SessionDescription_obj::fromStanza(stanza,this->initiator,this->remoteDescription);
+HXLINE( 383) ::Array< bool > video = ::Array_obj< bool >::fromData( _hx_array_data_22056db7_21,1);
+HXLINE( 384) ::Array< bool > audio = ::Array_obj< bool >::fromData( _hx_array_data_22056db7_22,1);
+HXLINE( 385) {
+HXLINE( 385) int _g = 0;
+HXDLIN( 385) ::Array< ::Dynamic> _g1 = addThis->media;
+HXDLIN( 385) while((_g < _g1->length)){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Attribute attr){
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_386_contentAdd)
+HXLINE( 386) if ((attr->key != HX_("sendrecv",6e,1e,9c,f4))) {
+HXLINE( 386) return (attr->key == HX_("sendonly",b4,56,a7,f2));
+ }
+ else {
+HXLINE( 386) return true;
+ }
+HXDLIN( 386) return false;
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE( 385) ::snikket::jingle::Media m = _g1->__get(_g).StaticCast< ::snikket::jingle::Media >();
+HXDLIN( 385) _g = (_g + 1);
+HXLINE( 386) if (::Lambda_obj::exists(m->attributes, ::Dynamic(new _hx_Closure_0()))) {
+HXLINE( 387) if ((m->media == HX_("video",7b,14,fc,36))) {
+HXLINE( 387) video[0] = true;
+ }
+HXLINE( 388) if ((m->media == HX_("audio",d6,78,80,27))) {
+HXLINE( 388) audio[0] = true;
+ }
+ }
+HXLINE( 390) ::Array< ::Dynamic> m1 = m->attributes;
+HXDLIN( 390) m1->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("setup",7d,ae,2f,7a),this->peerDtlsSetup));
+ }
+ }
+HXLINE( 392) this->remoteDescription = this->remoteDescription->addContent(addThis);
+HXLINE( 394) ::snikket::jingle::PeerConnection _hx_tmp = this->pc;
+HXDLIN( 394) ::thenshim::_Promise::Promise_Impl__obj::then(_hx_tmp->setRemoteDescription( ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("sdp",bf,9a,57,00),this->remoteDescription->toSdp())
+ ->setFixed(1,HX_("type",ba,f2,08,4d),cpp::Struct(rtc::Description::Type::Offer)))), ::Dynamic(new _hx_Closure_5(video,_gthis,addThis,audio)),null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(InitiatedSession_obj,contentAdd,(void))
+
+void InitiatedSession_obj::contentAccept( ::snikket::Stanza stanza){
+ HX_GC_STACKFRAME(&_hx_pos_de51993dbb06b02d_418_contentAccept)
+HXLINE( 419) if (::hx::IsNull( this->remoteDescription )) {
+HXLINE( 419) HX_STACK_DO_THROW(HX_("Got content-accept before session-accept",10,3c,4f,73));
+ }
+HXLINE( 422) ::snikket::jingle::SessionDescription addThis = ::snikket::jingle::SessionDescription_obj::fromStanza(stanza,!(this->initiator),this->remoteDescription);
+HXLINE( 423) {
+HXLINE( 423) int _g = 0;
+HXDLIN( 423) ::Array< ::Dynamic> _g1 = addThis->media;
+HXDLIN( 423) while((_g < _g1->length)){
+HXLINE( 423) ::snikket::jingle::Media m = _g1->__get(_g).StaticCast< ::snikket::jingle::Media >();
+HXDLIN( 423) _g = (_g + 1);
+HXLINE( 424) ::Array< ::Dynamic> m1 = m->attributes;
+HXDLIN( 424) m1->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("setup",7d,ae,2f,7a),this->peerDtlsSetup));
+ }
+ }
+HXLINE( 426) this->remoteDescription = this->remoteDescription->addContent(addThis);
+HXLINE( 427) ::snikket::jingle::PeerConnection _hx_tmp = this->pc;
+HXDLIN( 427) _hx_tmp->setRemoteDescription( ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("sdp",bf,9a,57,00),this->remoteDescription->toSdp())
+ ->setFixed(1,HX_("type",ba,f2,08,4d),cpp::Struct(rtc::Description::Type::Answer))));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(InitiatedSession_obj,contentAccept,(void))
+
+::Dynamic InitiatedSession_obj::transportInfo( ::snikket::Stanza stanza){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ void _hx_run(::cpp::VirtualArray _){
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_445_transportInfo)
+HXLINE( 445) return;
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_431_transportInfo)
+HXDLIN( 431) ::snikket::jingle::InitiatedSession _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 432) bool _hx_tmp;
+HXDLIN( 432) if (::hx::IsNotNull( this->pc )) {
+HXLINE( 432) _hx_tmp = ::hx::IsNull( this->remoteDescription );
+ }
+ else {
+HXLINE( 432) _hx_tmp = true;
+ }
+HXDLIN( 432) if (_hx_tmp) {
+HXLINE( 433) this->queuedInboundTransportInfo->push(stanza);
+HXLINE( 434) return ::thenshim::_Promise::Promise_Impl__obj::resolve(null());
+ }
+HXLINE( 437) ::Array< ::Dynamic> _this = ::snikket::jingle::IceCandidate_obj::fromStanza(stanza);
+HXDLIN( 437) ::Array< ::Dynamic> result = ::Array_obj< ::Dynamic>::__new(_this->length);
+HXDLIN( 437) {
+HXLINE( 437) int _g = 0;
+HXDLIN( 437) int _g1 = _this->length;
+HXDLIN( 437) while((_g < _g1)){
+HXLINE( 437) _g = (_g + 1);
+HXDLIN( 437) int i = (_g - 1);
+HXDLIN( 437) {
+HXLINE( 437) ::snikket::jingle::IceCandidate candidate = ( ( ::snikket::jingle::IceCandidate)(_hx_array_unsafe_get(_this,i)) );
+HXLINE( 438) int index = _gthis->remoteDescription->identificationTags->indexOf(candidate->sdpMid,null());
+HXLINE( 439) ::snikket::jingle::PeerConnection _gthis1 = _gthis->pc;
+HXLINE( 440) ::String inValue = candidate->toSdp();
+HXLINE( 442) ::Dynamic inValue1;
+HXDLIN( 442) if ((index < 0)) {
+HXLINE( 442) inValue1 = null();
+ }
+ else {
+HXLINE( 442) inValue1 = index;
+ }
+HXLINE( 437) ::Dynamic inValue2 = _gthis1->addIceCandidate( ::Dynamic(::hx::Anon_obj::Create(4)
+ ->setFixed(0,HX_("usernameFragment",06,a8,37,89),candidate->ufrag)
+ ->setFixed(1,HX_("candidate",43,34,d8,d0),inValue)
+ ->setFixed(2,HX_("sdpMid",09,30,5f,d9),candidate->sdpMid)
+ ->setFixed(3,HX_("sdpMLineIndex",f0,ab,d6,e2),inValue1)));
+HXDLIN( 437) result->__unsafe_set(i,inValue2);
+ }
+ }
+ }
+HXDLIN( 437) return ::thenshim::_Promise::Promise_Impl__obj::then(::thenshim::PromiseTools_obj::all(result), ::Dynamic(new _hx_Closure_0()),null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(InitiatedSession_obj,transportInfo,return )
+
+void InitiatedSession_obj::addMedia(::Array< ::Dynamic> streams){
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_448_addMedia)
+HXLINE( 449) if (::hx::IsNull( this->pc )) {
+HXLINE( 449) HX_STACK_DO_THROW(HX_("tried to add media before PeerConnection exists",25,49,19,b2));
+ }
+HXLINE( 451) ::Array< ::Dynamic> _this = this->localDescription->media;
+HXDLIN( 451) ::Array< ::String > result = ::Array_obj< ::String >::__new(_this->length);
+HXDLIN( 451) {
+HXLINE( 451) int _g = 0;
+HXDLIN( 451) int _g1 = _this->length;
+HXDLIN( 451) while((_g < _g1)){
+HXLINE( 451) _g = (_g + 1);
+HXDLIN( 451) int i = (_g - 1);
+HXDLIN( 451) {
+HXLINE( 451) ::String inValue = ( ( ::snikket::jingle::Media)(_hx_array_unsafe_get(_this,i)) )->mid;
+HXDLIN( 451) result->__unsafe_set(i,inValue);
+ }
+ }
+ }
+HXDLIN( 451) ::Array< ::String > oldMids = result;
+HXLINE( 452) {
+HXLINE( 452) int _g2 = 0;
+HXDLIN( 452) while((_g2 < streams->length)){
+HXLINE( 452) ::snikket::jingle::MediaStream stream = streams->__get(_g2).StaticCast< ::snikket::jingle::MediaStream >();
+HXDLIN( 452) _g2 = (_g2 + 1);
+HXLINE( 453) {
+HXLINE( 453) int _g3 = 0;
+HXDLIN( 453) ::Array< ::Dynamic> _g4 = stream->getTracks();
+HXDLIN( 453) while((_g3 < _g4->length)){
+HXLINE( 453) ::snikket::jingle::MediaStreamTrack track = _g4->__get(_g3).StaticCast< ::snikket::jingle::MediaStreamTrack >();
+HXDLIN( 453) _g3 = (_g3 + 1);
+HXLINE( 454) this->pc->addTrack(track,stream);
+ }
+ }
+ }
+ }
+HXLINE( 458) this->setupLocalDescription(HX_("content-add",cd,a9,a1,10),oldMids,true,null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(InitiatedSession_obj,addMedia,(void))
+
+void InitiatedSession_obj::addMedia__fromC(::cpp::Pointer< void* > streams,size_t streams__len){
+ HX_STACKFRAME(&_hx_pos_042a82ddefcd0233_244_addMedia__fromC)
+HXLINE( 224) ::cpp::Pointer< ::snikket::jingle::MediaStream > _this = streams->reinterpret();
+HXDLIN( 224) ::Array< ::Dynamic> result = ::Array_obj< ::Dynamic>::__new();
+HXDLIN( 224) ::cpp::Pointer< ::snikket::jingle::MediaStream > tmp = _this;
+HXDLIN( 224) result->setUnmanagedData(tmp,( (int)(streams__len) ));
+HXLINE( 244) this->addMedia(result->copy());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(InitiatedSession_obj,addMedia__fromC,(void))
+
+::String InitiatedSession_obj::callStatus(){
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_462_callStatus)
+HXDLIN( 462) return HX_("ongoing",3b,aa,04,9b);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(InitiatedSession_obj,callStatus,return )
+
+::Array< ::Dynamic> InitiatedSession_obj::videoTracks(){
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_465_videoTracks)
+HXLINE( 466) if (::hx::IsNull( this->pc )) {
+HXLINE( 466) return ::Array_obj< ::Dynamic>::__new(0);
+ }
+HXLINE( 467) ::Array< ::Dynamic> _g = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 467) {
+HXLINE( 467) int _g1 = 0;
+HXDLIN( 467) ::Array< ::Dynamic> _g2 = this->pc->getTransceivers();
+HXDLIN( 467) while((_g1 < _g2->length)){
+HXLINE( 467) ::Dynamic v = _g2->__get(_g1);
+HXDLIN( 467) _g1 = (_g1 + 1);
+HXLINE( 468) bool _hx_tmp;
+HXDLIN( 468) bool _hx_tmp1;
+HXDLIN( 468) bool _hx_tmp2;
+HXDLIN( 468) if (::hx::IsNotNull( v->__Field(HX_("receiver",2f,45,fd,e2),::hx::paccDynamic) )) {
+HXLINE( 468) _hx_tmp2 = ::hx::IsNotNull( ::Dynamic(v->__Field(HX_("receiver",2f,45,fd,e2),::hx::paccDynamic))->__Field(HX_("track",8b,8e,1f,16),::hx::paccDynamic) );
+ }
+ else {
+HXLINE( 468) _hx_tmp2 = false;
+ }
+HXDLIN( 468) if (_hx_tmp2) {
+HXLINE( 468) _hx_tmp1 = (( ( ::snikket::jingle::MediaStreamTrack)( ::Dynamic(v->__Field(HX_("receiver",2f,45,fd,e2),::hx::paccDynamic))->__Field(HX_("track",8b,8e,1f,16),::hx::paccDynamic)) )->get_kind() == HX_("video",7b,14,fc,36));
+ }
+ else {
+HXLINE( 468) _hx_tmp1 = false;
+ }
+HXDLIN( 468) if (_hx_tmp1) {
+HXLINE( 468) _hx_tmp = !(( ( ::snikket::jingle::MediaStreamTrack)( ::Dynamic(v->__Field(HX_("receiver",2f,45,fd,e2),::hx::paccDynamic))->__Field(HX_("track",8b,8e,1f,16),::hx::paccDynamic)) )->get_muted());
+ }
+ else {
+HXLINE( 468) _hx_tmp = false;
+ }
+HXLINE( 467) if (_hx_tmp) {
+HXLINE( 467) _g->push(v);
+ }
+ }
+ }
+HXDLIN( 467) ::Array< ::Dynamic> _this = _g;
+HXDLIN( 467) ::Array< ::Dynamic> result = ::Array_obj< ::Dynamic>::__new(_this->length);
+HXDLIN( 467) {
+HXLINE( 467) int _g3 = 0;
+HXDLIN( 467) int _g4 = _this->length;
+HXDLIN( 467) while((_g3 < _g4)){
+HXLINE( 467) _g3 = (_g3 + 1);
+HXDLIN( 467) int i = (_g3 - 1);
+HXDLIN( 467) {
+HXLINE( 467) ::snikket::jingle::MediaStreamTrack inValue = ( ( ::snikket::jingle::MediaStreamTrack)( ::Dynamic(_hx_array_unsafe_get(_this,i)->__Field(HX_("receiver",2f,45,fd,e2),::hx::paccDynamic))->__Field(HX_("track",8b,8e,1f,16),::hx::paccDynamic)) );
+HXDLIN( 467) result->__unsafe_set(i,inValue);
+ }
+ }
+ }
+HXDLIN( 467) return result;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(InitiatedSession_obj,videoTracks,return )
+
+size_t InitiatedSession_obj::videoTracks__fromC(void*** outPtr){
+ HX_GC_STACKFRAME(&_hx_pos_042a82ddefcd0233_242_videoTracks__fromC)
+HXDLIN( 242) ::Array< ::Dynamic> out = this->videoTracks();
+HXDLIN( 242) if (::hx::IsNotNull( outPtr )) {
+HXDLIN( 242) ::cpp::Pointer< void** > _hx_tmp = ::cpp::Pointer_obj::fromRaw(outPtr);
+HXDLIN( 242) {
+HXDLIN( 242) int _g = 0;
+HXDLIN( 242) while((_g < out->length)){
+HXDLIN( 242) ::snikket::jingle::MediaStreamTrack el = out->__get(_g).StaticCast< ::snikket::jingle::MediaStreamTrack >();
+HXDLIN( 242) _g = (_g + 1);
+HXDLIN( 242) {
+HXDLIN( 242) ::Dynamic haxeObject = el;
+HXDLIN( 242) void* ptr = haxeObject.mPtr;
+HXDLIN( 242) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(ptr);
+HXDLIN( 242) {
+HXDLIN( 242) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 242) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 242) int high = ptrInt64 >> 32;
+HXDLIN( 242) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 242) if (::hx::IsNull( highMap )) {
+HXDLIN( 242) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 242) this1->set(low,highMap);
+ }
+HXDLIN( 242) highMap->set(high,haxeObject);
+ }
+ }
+ }
+ }
+HXDLIN( 242) void** ptr1 = (void**)out->getBase();
+HXDLIN( 242) ::cpp::Int64 ptrInt641 = reinterpret_cast<int64_t>(ptr1);
+HXDLIN( 242) {
+HXDLIN( 242) ::haxe::ds::IntMap this2 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 242) int low1 = ptrInt641 & 0xffffffff;
+HXDLIN( 242) int high1 = ptrInt641 >> 32;
+HXDLIN( 242) ::haxe::ds::IntMap highMap1 = ( ( ::haxe::ds::IntMap)(this2->get(low1)) );
+HXDLIN( 242) if (::hx::IsNull( highMap1 )) {
+HXDLIN( 242) highMap1 = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 242) this2->set(low1,highMap1);
+ }
+HXDLIN( 242) highMap1->set(high1,out);
+ }
+HXDLIN( 242) _hx_tmp->set_ref(ptr1);
+ }
+HXDLIN( 242) return ( (size_t)(out->length) );
+ }
+
+
+ ::snikket::jingle::DTMFSender InitiatedSession_obj::dtmf(){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ bool _hx_run( ::Dynamic t){
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_474_dtmf)
+HXLINE( 474) bool transceiver;
+HXDLIN( 474) bool transceiver1;
+HXDLIN( 474) if (::hx::IsNotNull( t->__Field(HX_("sender",b5,c7,84,6b),::hx::paccDynamic) )) {
+HXLINE( 474) transceiver1 = ::hx::IsNotNull( ::Dynamic(t->__Field(HX_("sender",b5,c7,84,6b),::hx::paccDynamic))->__Field(HX_("track",8b,8e,1f,16),::hx::paccDynamic) );
+ }
+ else {
+HXLINE( 474) transceiver1 = false;
+ }
+HXDLIN( 474) if (transceiver1) {
+HXLINE( 474) transceiver = (( ( ::snikket::jingle::MediaStreamTrack)( ::Dynamic(t->__Field(HX_("sender",b5,c7,84,6b),::hx::paccDynamic))->__Field(HX_("track",8b,8e,1f,16),::hx::paccDynamic)) )->get_kind() == HX_("audio",d6,78,80,27));
+ }
+ else {
+HXLINE( 474) transceiver = false;
+ }
+HXDLIN( 474) if (transceiver) {
+HXLINE( 474) return !(( ( ::snikket::jingle::MediaStreamTrack)( ::Dynamic(t->__Field(HX_("sender",b5,c7,84,6b),::hx::paccDynamic))->__Field(HX_("track",8b,8e,1f,16),::hx::paccDynamic)) )->get_muted());
+ }
+ else {
+HXLINE( 474) return false;
+ }
+HXDLIN( 474) return false;
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_472_dtmf)
+HXLINE( 473) if (::hx::IsNull( this->pc )) {
+HXLINE( 473) return null();
+ }
+HXLINE( 474) ::Dynamic transceiver = ::Lambda_obj::find(this->pc->getTransceivers(), ::Dynamic(new _hx_Closure_0()));
+HXLINE( 475) if (::hx::IsNull( transceiver )) {
+HXLINE( 475) return null();
+ }
+HXLINE( 476) return ( ( ::snikket::jingle::DTMFSender)( ::Dynamic(transceiver->__Field(HX_("sender",b5,c7,84,6b),::hx::paccDynamic))->__Field(HX_("dtmf",e9,ba,71,42),::hx::paccDynamic)) );
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(InitiatedSession_obj,dtmf,return )
+
+void InitiatedSession_obj::sendIceCandidate( ::Dynamic candidate){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::Dynamic,candidate) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Media media){
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_489_sendIceCandidate)
+HXLINE( 489) return ::hx::IsEq( media->mid,candidate->__Field(HX_("sdpMid",09,30,5f,d9),::hx::paccDynamic) );
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_1) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Attribute attr){
+ HX_GC_STACKFRAME(&_hx_pos_de51993dbb06b02d_501_sendIceCandidate)
+HXLINE( 501) return (attr->key == HX_("ice-pwd",3b,03,2f,e9));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_de51993dbb06b02d_479_sendIceCandidate)
+HXLINE( 480) bool _hx_tmp;
+HXDLIN( 480) if (::hx::IsNotNull( candidate )) {
+HXLINE( 480) _hx_tmp = ::hx::IsEq( candidate->__Field(HX_("candidate",43,34,d8,d0),::hx::paccDynamic),HX_("",00,00,00,00) );
+ }
+ else {
+HXLINE( 480) _hx_tmp = true;
+ }
+HXDLIN( 480) if (_hx_tmp) {
+HXLINE( 481) if (::hx::IsNotNull( this->candidatesDone )) {
+HXLINE( 481) this->candidatesDone();
+ }
+HXLINE( 482) return;
+ }
+HXLINE( 484) if (::hx::IsNotNull( this->candidatesDone )) {
+HXLINE( 484) return;
+ }
+HXLINE( 485) if (::hx::IsNull( this->localDescription )) {
+HXLINE( 486) this->queuedOutboundCandidate->push(candidate);
+HXLINE( 487) return;
+ }
+HXLINE( 489) ::snikket::jingle::Media media = ( ( ::snikket::jingle::Media)(::Lambda_obj::find(this->localDescription->media, ::Dynamic(new _hx_Closure_0(candidate)))) );
+HXLINE( 490) if (::hx::IsNull( media )) {
+HXLINE( 490) HX_STACK_DO_THROW( ::Dynamic((HX_("Unknown media: ",d4,41,45,83) + candidate->__Field(HX_("sdpMid",09,30,5f,d9),::hx::paccDynamic))));
+ }
+HXLINE( 493) ::String media1 = media->mid;
+HXLINE( 494) ::String media2 = media->media;
+HXLINE( 495) ::String media3 = media->connectionData;
+HXLINE( 496) ::String media4 = media->port;
+HXLINE( 497) ::String media5 = media->protocol;
+HXLINE( 499) ::snikket::jingle::Attribute transportInfo = ::snikket::jingle::Attribute_obj::parse(( (::String)(candidate->__Field(HX_("candidate",43,34,d8,d0),::hx::paccDynamic)) ));
+HXLINE( 500) ::snikket::jingle::Attribute transportInfo1 = ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("ice-ufrag",65,c2,31,ab),( (::String)(candidate->__Field(HX_("usernameFragment",06,a8,37,89),::hx::paccDynamic)) ));
+HXLINE( 501) ::snikket::jingle::Attribute tmp = ( ( ::snikket::jingle::Attribute)(::Lambda_obj::find(media->attributes, ::Dynamic(new _hx_Closure_1()))) );
+HXDLIN( 501) ::snikket::jingle::Attribute transportInfo2;
+HXDLIN( 501) if (::hx::IsNotNull( tmp )) {
+HXLINE( 501) transportInfo2 = tmp;
+ }
+ else {
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_2) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Attribute attr){
+ HX_GC_STACKFRAME(&_hx_pos_de51993dbb06b02d_502_sendIceCandidate)
+HXLINE( 502) return (attr->key == HX_("ice-pwd",3b,03,2f,e9));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE( 501) transportInfo2 = ( ( ::snikket::jingle::Attribute)(::Lambda_obj::find(this->localDescription->attributes, ::Dynamic(new _hx_Closure_2()))) );
+ }
+HXLINE( 492) ::snikket::jingle::Media transportInfo3 = ::snikket::jingle::Media_obj::__alloc( HX_CTX ,media1,media2,media3,media4,media5,::Array_obj< ::Dynamic>::__new(3)->init(0,transportInfo)->init(1,transportInfo1)->init(2,transportInfo2),media->formats);
+HXLINE( 506) ::String transportInfo4 = this->get_sid();
+HXLINE( 491) ::snikket::Stanza transportInfo5 = ::snikket::jingle::TransportInfo_obj::__alloc( HX_CTX ,transportInfo3,transportInfo4)->toStanza(this->initiator);
+HXLINE( 508) {
+HXLINE( 508) ::Dynamic this1 = transportInfo5->attr;
+HXDLIN( 508) ::String value = this->counterpart->asString();
+HXDLIN( 508) ::Reflect_obj::setField(this1,HX_("to",7b,65,00,00),value);
+ }
+HXLINE( 509) {
+HXLINE( 509) ::Dynamic this2 = transportInfo5->attr;
+HXDLIN( 509) ::String value1 = ::snikket::ID_obj::medium();
+HXDLIN( 509) ::Reflect_obj::setField(this2,HX_("id",db,5b,00,00),value1);
+ }
+HXLINE( 510) this->client->sendStanza(transportInfo5);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(InitiatedSession_obj,sendIceCandidate,(void))
+
+void InitiatedSession_obj::supplyMedia(::Array< ::Dynamic> streams){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_1, ::snikket::jingle::InitiatedSession,_gthis,::Array< ::Dynamic>,streams) HXARGC(0)
+ void _hx_run(){
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_514_supplyMedia)
+HXLINE( 515) {
+HXLINE( 515) int _g = 0;
+HXDLIN( 515) while((_g < streams->length)){
+HXLINE( 515) ::snikket::jingle::MediaStream stream = streams->__get(_g).StaticCast< ::snikket::jingle::MediaStream >();
+HXDLIN( 515) _g = (_g + 1);
+HXLINE( 516) {
+HXLINE( 516) int _g1 = 0;
+HXDLIN( 516) ::Array< ::Dynamic> _g2 = stream->getTracks();
+HXDLIN( 516) while((_g1 < _g2->length)){
+HXLINE( 516) ::snikket::jingle::MediaStreamTrack track = _g2->__get(_g1).StaticCast< ::snikket::jingle::MediaStreamTrack >();
+HXDLIN( 516) _g1 = (_g1 + 1);
+HXLINE( 517) _gthis->pc->addTrack(track,stream);
+ }
+ }
+ }
+ }
+HXLINE( 521) if (::hx::IsNull( _gthis->afterMedia )) {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::jingle::InitiatedSession,_gthis) HXARGC(1)
+ void _hx_run( ::Dynamic e){
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_522_supplyMedia)
+HXLINE( 523) ::Dynamic _hx_tmp = ::haxe::Log_obj::trace;
+HXDLIN( 523) ::String _hx_tmp1;
+HXDLIN( 523) if (::hx::IsNull( e )) {
+HXLINE( 523) _hx_tmp1 = HX_("null",87,9e,0e,49);
+ }
+ else {
+HXLINE( 523) _hx_tmp1 = ::Std_obj::string(e);
+ }
+HXDLIN( 523) _hx_tmp(HX_("supplyMedia error",9d,f9,a0,33), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.jingle.InitiatedSession",b7,6d,05,22))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,_hx_tmp1))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("supplyMedia",35,0c,c9,9a))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/jingle/Session.hx",54,dd,b2,6d))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),523)));
+HXLINE( 524) _gthis->pc->close();
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE( 522) ::thenshim::PromiseTools_obj::catch_(_gthis->onPeerConnection(), ::Dynamic(new _hx_Closure_0(_gthis)));
+ }
+ else {
+HXLINE( 527) _gthis->afterMedia();
+ }
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_513_supplyMedia)
+HXDLIN( 513) ::snikket::jingle::InitiatedSession _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 514) this->setupPeerConnection( ::Dynamic(new _hx_Closure_1(_gthis,streams)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(InitiatedSession_obj,supplyMedia,(void))
+
+void InitiatedSession_obj::supplyMedia__fromC(::cpp::Pointer< void* > streams,size_t streams__len){
+ HX_STACKFRAME(&_hx_pos_042a82ddefcd0233_244_supplyMedia__fromC)
+HXLINE( 224) ::cpp::Pointer< ::snikket::jingle::MediaStream > _this = streams->reinterpret();
+HXDLIN( 224) ::Array< ::Dynamic> result = ::Array_obj< ::Dynamic>::__new();
+HXDLIN( 224) ::cpp::Pointer< ::snikket::jingle::MediaStream > tmp = _this;
+HXDLIN( 224) result->setUnmanagedData(tmp,( (int)(streams__len) ));
+HXLINE( 244) this->supplyMedia(result->copy());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(InitiatedSession_obj,supplyMedia__fromC,(void))
+
+void InitiatedSession_obj::setupPeerConnection( ::Dynamic callback){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_4, ::snikket::jingle::InitiatedSession,_gthis, ::Dynamic,callback) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> servers){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::jingle::InitiatedSession,_gthis) HXARGC(1)
+ void _hx_run( ::Dynamic event){
+ HX_GC_STACKFRAME(&_hx_pos_de51993dbb06b02d_540_setupPeerConnection)
+HXLINE( 540) ::snikket::Client _gthis1 = _gthis->client;
+HXDLIN( 540) ::String _hx_tmp = _gthis->counterpart->asBare()->asString();
+HXDLIN( 540) _gthis1->trigger(HX_("call/track",1a,e7,80,d7), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("chatId",d3,04,77,b7),_hx_tmp)
+ ->setFixed(1,HX_("streams",f3,db,44,f6), ::Dynamic(event->__Field(HX_("streams",f3,db,44,f6),::hx::paccDynamic)))
+ ->setFixed(2,HX_("track",8b,8e,1f,16), ::Dynamic(event->__Field(HX_("track",8b,8e,1f,16),::hx::paccDynamic)))));
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_1) HXARGC(1)
+ void _hx_run( ::Dynamic event){
+ HX_GC_STACKFRAME(&_hx_pos_de51993dbb06b02d_542_setupPeerConnection)
+HXLINE( 542) ::haxe::Log_obj::trace(HX_("renegotiate",2b,b9,fb,a1), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.jingle.InitiatedSession",b7,6d,05,22))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,event))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("setupPeerConnection",bd,67,52,ae))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/jingle/Session.hx",54,dd,b2,6d))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),542)));
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_2, ::snikket::jingle::InitiatedSession,_gthis) HXARGC(1)
+ void _hx_run( ::Dynamic event){
+ HX_GC_STACKFRAME(&_hx_pos_de51993dbb06b02d_544_setupPeerConnection)
+HXLINE( 544) _gthis->sendIceCandidate(event->__Field(HX_("candidate",43,34,d8,d0),::hx::paccDynamic));
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_3, ::snikket::jingle::InitiatedSession,_gthis) HXARGC(1)
+ void _hx_run( ::Dynamic event){
+ HX_GC_STACKFRAME(&_hx_pos_de51993dbb06b02d_547_setupPeerConnection)
+HXLINE( 547) bool _hx_tmp;
+HXDLIN( 547) if (::hx::IsNotNull( _gthis->pc )) {
+HXLINE( 547) if ((_gthis->pc->get_connectionState() != HX_("closed",ac,a9,51,0e))) {
+HXLINE( 547) _hx_tmp = (_gthis->pc->get_connectionState() == HX_("failed",bd,c5,fe,e7));
+ }
+ else {
+HXLINE( 547) _hx_tmp = true;
+ }
+ }
+ else {
+HXLINE( 547) _hx_tmp = false;
+ }
+HXDLIN( 547) if (_hx_tmp) {
+HXLINE( 548) _gthis->terminate();
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_de51993dbb06b02d_537_setupPeerConnection)
+HXLINE( 538) _gthis->pc = ::snikket::jingle::PeerConnection_obj::__alloc( HX_CTX , ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("iceServers",45,14,49,d2),servers)),null());
+HXLINE( 539) _gthis->pc->addEventListener(HX_("track",8b,8e,1f,16), ::Dynamic(new _hx_Closure_0(_gthis)));
+HXLINE( 542) _gthis->pc->addEventListener(HX_("negotiationneeded",d6,4d,d0,53), ::Dynamic(new _hx_Closure_1()));
+HXLINE( 543) _gthis->pc->addEventListener(HX_("icecandidate",98,ef,c0,7b), ::Dynamic(new _hx_Closure_2(_gthis)));
+HXLINE( 546) _gthis->pc->addEventListener(HX_("connectionstatechange",e3,a2,87,36), ::Dynamic(new _hx_Closure_3(_gthis)));
+HXLINE( 551) callback();
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_532_setupPeerConnection)
+HXDLIN( 532) ::snikket::jingle::InitiatedSession _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 533) if (::hx::IsNotNull( this->pc )) {
+HXLINE( 534) callback();
+HXLINE( 535) return;
+ }
+HXLINE( 537) this->client->getIceServers( ::Dynamic(new _hx_Closure_4(_gthis,callback)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(InitiatedSession_obj,setupPeerConnection,(void))
+
+::Dynamic InitiatedSession_obj::setupLocalDescription(::String type,::Array< ::String > filterMedia, ::Dynamic __o_filterOut, ::Dynamic beforeSend){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_4, ::snikket::jingle::InitiatedSession,_gthis,::String,type) HXARGC(1)
+ ::Dynamic _hx_run( ::Dynamic _){
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_556_setupLocalDescription)
+HXLINE( 557) ::snikket::Client _gthis1 = _gthis->client;
+HXDLIN( 557) ::String caps = _gthis->counterpart->asBare()->asString();
+HXDLIN( 557) ::snikket::Caps caps1 = _gthis1->getDirectChat(caps,null())->getResourceCaps(_gthis->counterpart->resource);
+HXLINE( 558) bool _hx_tmp;
+HXDLIN( 558) bool _hx_tmp1;
+HXDLIN( 558) if ((type != HX_("session-initiate",70,2d,30,f7))) {
+HXLINE( 558) _hx_tmp1 = (type == HX_("session-accept",5f,92,e7,a8));
+ }
+ else {
+HXLINE( 558) _hx_tmp1 = true;
+ }
+HXDLIN( 558) if (_hx_tmp1) {
+HXLINE( 558) _hx_tmp = caps1->features->contains(HX_("urn:ietf:rfc:3264",2b,35,57,2c));
+ }
+ else {
+HXLINE( 558) _hx_tmp = false;
+ }
+HXDLIN( 558) if (_hx_tmp) {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_3, ::snikket::jingle::InitiatedSession,_gthis) HXARGC(2)
+ void _hx_run( ::Dynamic resolve, ::Dynamic reject){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_1, ::snikket::jingle::InitiatedSession,_gthis, ::Dynamic,resolve) HXARGC(0)
+ void _hx_run(){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(0)
+ void _hx_run(){
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_561_setupLocalDescription)
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_560_setupLocalDescription)
+HXLINE( 561) _gthis->candidatesDone = ::Dynamic(new _hx_Closure_0());
+HXLINE( 562) resolve(false);
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_2, ::Dynamic,resolve, ::haxe::Timer,timeout) HXARGC(0)
+ void _hx_run(){
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_564_setupLocalDescription)
+HXLINE( 565) timeout->stop();
+HXLINE( 566) resolve(true);
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_559_setupLocalDescription)
+HXLINE( 560) ::haxe::Timer timeout = ::haxe::Timer_obj::delay( ::Dynamic(new _hx_Closure_1(_gthis,resolve)),3000);
+HXLINE( 564) _gthis->candidatesDone = ::Dynamic(new _hx_Closure_2(resolve,timeout));
+ }
+ HX_END_LOCAL_FUNC2((void))
+
+HXLINE( 559) return ::thenshim::_Promise::Promise_Impl__obj::_new( ::Dynamic(new _hx_Closure_3(_gthis)));
+ }
+ else {
+HXLINE( 570) return null();
+ }
+HXLINE( 558) return null();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S5(::hx::LocalFunc,_hx_Closure_5, ::snikket::jingle::InitiatedSession,_gthis,::String,type, ::Dynamic,beforeSend, ::Dynamic,filterOut,::Array< ::String >,filterMedia) HXARGC(1)
+ void _hx_run(bool _){
+ HX_GC_STACKFRAME(&_hx_pos_de51993dbb06b02d_572_setupLocalDescription)
+HXLINE( 573) _gthis->localDescription = ::snikket::jingle::SessionDescription_obj::parse(( (::String)(_gthis->pc->get_localDescription()->__Field(HX_("sdp",bf,9a,57,00),::hx::paccDynamic)) ));
+HXLINE( 574) ::snikket::jingle::SessionDescription descriptionToSend = _gthis->localDescription;
+HXLINE( 575) if (::hx::IsNotNull( filterMedia )) {
+HXLINE( 577) int descriptionToSend1 = descriptionToSend->version;
+HXLINE( 578) ::String descriptionToSend2 = descriptionToSend->name;
+HXLINE( 579) ::Array< ::Dynamic> _g = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 579) {
+HXLINE( 579) int _g1 = 0;
+HXDLIN( 579) ::Array< ::Dynamic> _g2 = descriptionToSend->media;
+HXDLIN( 579) while((_g1 < _g2->length)){
+HXLINE( 579) ::snikket::jingle::Media v = _g2->__get(_g1).StaticCast< ::snikket::jingle::Media >();
+HXDLIN( 579) _g1 = (_g1 + 1);
+HXDLIN( 579) bool descriptionToSend3;
+HXDLIN( 579) if (( (bool)(filterOut) )) {
+HXLINE( 579) descriptionToSend3 = !(filterMedia->contains(v->mid));
+ }
+ else {
+HXLINE( 579) descriptionToSend3 = filterMedia->contains(v->mid);
+ }
+HXDLIN( 579) if (descriptionToSend3) {
+HXLINE( 579) _g->push(v);
+ }
+ }
+ }
+HXLINE( 576) descriptionToSend = ::snikket::jingle::SessionDescription_obj::__alloc( HX_CTX ,descriptionToSend1,descriptionToSend2,_g,descriptionToSend->attributes,descriptionToSend->identificationTags);
+ }
+HXLINE( 584) if (::hx::IsNotNull( beforeSend )) {
+HXLINE( 584) beforeSend(descriptionToSend);
+ }
+HXLINE( 585) ::String type1 = type;
+HXDLIN( 585) ::String sessionAccept = _gthis->get_sid();
+HXDLIN( 585) ::snikket::Stanza sessionAccept1 = descriptionToSend->toStanza(type1,sessionAccept,_gthis->initiator);
+HXLINE( 586) {
+HXLINE( 586) ::Dynamic this1 = sessionAccept1->attr;
+HXDLIN( 586) ::String value = _gthis->counterpart->asString();
+HXDLIN( 586) ::Reflect_obj::setField(this1,HX_("to",7b,65,00,00),value);
+ }
+HXLINE( 587) {
+HXLINE( 587) ::Dynamic this2 = sessionAccept1->attr;
+HXDLIN( 587) ::String value1 = ::snikket::ID_obj::medium();
+HXDLIN( 587) ::Reflect_obj::setField(this2,HX_("id",db,5b,00,00),value1);
+ }
+HXLINE( 588) _gthis->client->sendStanza(sessionAccept1);
+HXLINE( 590) ::Array< ::Dynamic> outboundCandidate = _gthis->queuedOutboundCandidate->copy();
+HXLINE( 591) _gthis->queuedOutboundCandidate->resize(0);
+HXLINE( 592) {
+HXLINE( 592) int _g3 = 0;
+HXDLIN( 592) while((_g3 < outboundCandidate->length)){
+HXLINE( 592) ::Dynamic candidate = outboundCandidate->__get(_g3);
+HXDLIN( 592) _g3 = (_g3 + 1);
+HXLINE( 593) _gthis->sendIceCandidate(candidate);
+ }
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ ::Dynamic filterOut = __o_filterOut;
+ if (::hx::IsNull(__o_filterOut)) filterOut = false;
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_555_setupLocalDescription)
+HXDLIN( 555) ::snikket::jingle::InitiatedSession _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 556) return ::thenshim::_Promise::Promise_Impl__obj::then(::thenshim::_Promise::Promise_Impl__obj::then(this->pc->setLocalDescription(null()), ::Dynamic(new _hx_Closure_4(_gthis,type)),null()), ::Dynamic(new _hx_Closure_5(_gthis,type,beforeSend,filterOut,filterMedia)),null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC4(InitiatedSession_obj,setupLocalDescription,return )
+
+::Dynamic InitiatedSession_obj::onPeerConnection(){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::jingle::InitiatedSession,_gthis) HXARGC(1)
+ ::Array< ::Dynamic> _hx_run( ::Dynamic _){
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_600_onPeerConnection)
+HXLINE( 601) ::Array< ::Dynamic> inboundTransportInfo = _gthis->queuedInboundTransportInfo->copy();
+HXLINE( 602) _gthis->queuedInboundTransportInfo->resize(0);
+HXLINE( 603) ::Dynamic f = _gthis->transportInfo_dyn();
+HXDLIN( 603) ::Array< ::Dynamic> result = ::Array_obj< ::Dynamic>::__new(inboundTransportInfo->length);
+HXDLIN( 603) {
+HXLINE( 603) int _g = 0;
+HXDLIN( 603) int _g1 = inboundTransportInfo->length;
+HXDLIN( 603) while((_g < _g1)){
+HXLINE( 603) _g = (_g + 1);
+HXDLIN( 603) int i = (_g - 1);
+HXDLIN( 603) {
+HXLINE( 603) ::Dynamic inValue = f(_hx_array_unsafe_get(inboundTransportInfo,i));
+HXDLIN( 603) result->__unsafe_set(i,inValue);
+ }
+ }
+ }
+HXDLIN( 603) return result;
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_1, ::snikket::jingle::InitiatedSession,_gthis) HXARGC(1)
+ ::Dynamic _hx_run(::Array< ::Dynamic> _){
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_606_onPeerConnection)
+HXLINE( 606) return _gthis->setupLocalDescription(HX_("session-accept",5f,92,e7,a8),null(),null(),null());
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_2, ::snikket::jingle::InitiatedSession,_gthis) HXARGC(1)
+ ::String _hx_run( ::Dynamic _){
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_607_onPeerConnection)
+HXLINE( 608) ::String _hx_tmp;
+HXDLIN( 608) if ((_gthis->localDescription->getDtlsSetup() == HX_("active",c6,41,46,16))) {
+HXLINE( 608) _hx_tmp = HX_("passive",a7,47,6a,7d);
+ }
+ else {
+HXLINE( 608) _hx_tmp = HX_("active",c6,41,46,16);
+ }
+HXLINE( 607) return (_gthis->peerDtlsSetup = _hx_tmp);
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_598_onPeerConnection)
+HXDLIN( 598) ::snikket::jingle::InitiatedSession _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 599) ::snikket::jingle::PeerConnection _hx_tmp = this->pc;
+HXDLIN( 599) return ::thenshim::_Promise::Promise_Impl__obj::then(::thenshim::_Promise::Promise_Impl__obj::then(::thenshim::_Promise::Promise_Impl__obj::then(_hx_tmp->setRemoteDescription( ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("sdp",bf,9a,57,00),this->remoteDescription->toSdp())
+ ->setFixed(1,HX_("type",ba,f2,08,4d),cpp::Struct(rtc::Description::Type::Offer)))), ::Dynamic(new _hx_Closure_0(_gthis)),null()), ::Dynamic(new _hx_Closure_1(_gthis)),null()), ::Dynamic(new _hx_Closure_2(_gthis)),null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(InitiatedSession_obj,onPeerConnection,return )
+
+ ::snikket::jingle::InitiatedSession InitiatedSession_obj::fromSessionInitiate( ::snikket::Client client, ::snikket::Stanza stanza){
+ HX_GC_STACKFRAME(&_hx_pos_de51993dbb06b02d_304_fromSessionInitiate)
+HXLINE( 305) ::snikket::Stanza jingle = stanza->getChild(HX_("jingle",31,27,eb,1f),HX_("urn:xmpp:jingle:1",44,c4,fe,f7));
+HXLINE( 308) ::snikket::JID session = ::snikket::JID_obj::parse(( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) ));
+HXLINE( 309) ::String session1 = ( (::String)(::Reflect_obj::field(jingle->attr,HX_("sid",0e,9f,57,00))) );
+HXLINE( 306) ::snikket::jingle::InitiatedSession session2 = ::snikket::jingle::InitiatedSession_obj::__alloc( HX_CTX ,client,session,session1,::snikket::jingle::SessionDescription_obj::fromStanza(stanza,false,null()));
+HXLINE( 312) session2->transportInfo(stanza);
+HXLINE( 313) return session2;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(InitiatedSession_obj,fromSessionInitiate,return )
+
+
+::hx::ObjectPtr< InitiatedSession_obj > InitiatedSession_obj::__new( ::snikket::Client client, ::snikket::JID counterpart,::String sid, ::snikket::jingle::SessionDescription remoteDescription) {
+ ::hx::ObjectPtr< InitiatedSession_obj > __this = new InitiatedSession_obj();
+ __this->__construct(client,counterpart,sid,remoteDescription);
+ return __this;
+}
+
+::hx::ObjectPtr< InitiatedSession_obj > InitiatedSession_obj::__alloc(::hx::Ctx *_hx_ctx, ::snikket::Client client, ::snikket::JID counterpart,::String sid, ::snikket::jingle::SessionDescription remoteDescription) {
+ InitiatedSession_obj *__this = (InitiatedSession_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(InitiatedSession_obj), true, "snikket.jingle.InitiatedSession"));
+ *(void **)__this = InitiatedSession_obj::_hx_vtable;
+ __this->__construct(client,counterpart,sid,remoteDescription);
+ return __this;
+}
+
+InitiatedSession_obj::InitiatedSession_obj()
+{
+}
+
+void InitiatedSession_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(InitiatedSession);
+ HX_MARK_MEMBER_NAME(sid,"sid");
+ HX_MARK_MEMBER_NAME(client,"client");
+ HX_MARK_MEMBER_NAME(counterpart,"counterpart");
+ HX_MARK_MEMBER_NAME(_sid,"_sid");
+ HX_MARK_MEMBER_NAME(remoteDescription,"remoteDescription");
+ HX_MARK_MEMBER_NAME(localDescription,"localDescription");
+ HX_MARK_MEMBER_NAME(pc,"pc");
+ HX_MARK_MEMBER_NAME(peerDtlsSetup,"peerDtlsSetup");
+ HX_MARK_MEMBER_NAME(queuedInboundTransportInfo,"queuedInboundTransportInfo");
+ HX_MARK_MEMBER_NAME(queuedOutboundCandidate,"queuedOutboundCandidate");
+ HX_MARK_MEMBER_NAME(accepted,"accepted");
+ HX_MARK_MEMBER_NAME(afterMedia,"afterMedia");
+ HX_MARK_MEMBER_NAME(initiator,"initiator");
+ HX_MARK_MEMBER_NAME(candidatesDone,"candidatesDone");
+ HX_MARK_END_CLASS();
+}
+
+void InitiatedSession_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(sid,"sid");
+ HX_VISIT_MEMBER_NAME(client,"client");
+ HX_VISIT_MEMBER_NAME(counterpart,"counterpart");
+ HX_VISIT_MEMBER_NAME(_sid,"_sid");
+ HX_VISIT_MEMBER_NAME(remoteDescription,"remoteDescription");
+ HX_VISIT_MEMBER_NAME(localDescription,"localDescription");
+ HX_VISIT_MEMBER_NAME(pc,"pc");
+ HX_VISIT_MEMBER_NAME(peerDtlsSetup,"peerDtlsSetup");
+ HX_VISIT_MEMBER_NAME(queuedInboundTransportInfo,"queuedInboundTransportInfo");
+ HX_VISIT_MEMBER_NAME(queuedOutboundCandidate,"queuedOutboundCandidate");
+ HX_VISIT_MEMBER_NAME(accepted,"accepted");
+ HX_VISIT_MEMBER_NAME(afterMedia,"afterMedia");
+ HX_VISIT_MEMBER_NAME(initiator,"initiator");
+ HX_VISIT_MEMBER_NAME(candidatesDone,"candidatesDone");
+}
+
+::hx::Val InitiatedSession_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 2:
+ if (HX_FIELD_EQ(inName,"pc") ) { return ::hx::Val( pc ); }
+ break;
+ case 3:
+ if (HX_FIELD_EQ(inName,"sid") ) { return ::hx::Val( inCallProp == ::hx::paccAlways ? get_sid() : sid ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"_sid") ) { return ::hx::Val( _sid ); }
+ if (HX_FIELD_EQ(inName,"ring") ) { return ::hx::Val( ring_dyn() ); }
+ if (HX_FIELD_EQ(inName,"dtmf") ) { return ::hx::Val( dtmf_dyn() ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"client") ) { return ::hx::Val( client ); }
+ if (HX_FIELD_EQ(inName,"accept") ) { return ::hx::Val( accept_dyn() ); }
+ if (HX_FIELD_EQ(inName,"hangup") ) { return ::hx::Val( hangup_dyn() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"get_sid") ) { return ::hx::Val( get_sid_dyn() ); }
+ if (HX_FIELD_EQ(inName,"retract") ) { return ::hx::Val( retract_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"accepted") ) { return ::hx::Val( accepted ); }
+ if (HX_FIELD_EQ(inName,"initiate") ) { return ::hx::Val( initiate_dyn() ); }
+ if (HX_FIELD_EQ(inName,"addMedia") ) { return ::hx::Val( addMedia_dyn() ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"initiator") ) { return ::hx::Val( initiator ); }
+ if (HX_FIELD_EQ(inName,"terminate") ) { return ::hx::Val( terminate_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"sid__fromC") ) { return ::hx::Val( sid__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"afterMedia") ) { return ::hx::Val( afterMedia ); }
+ if (HX_FIELD_EQ(inName,"contentAdd") ) { return ::hx::Val( contentAdd_dyn() ); }
+ if (HX_FIELD_EQ(inName,"callStatus") ) { return ::hx::Val( callStatus_dyn() ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"counterpart") ) { return ::hx::Val( counterpart ); }
+ if (HX_FIELD_EQ(inName,"videoTracks") ) { return ::hx::Val( videoTracks_dyn() ); }
+ if (HX_FIELD_EQ(inName,"supplyMedia") ) { return ::hx::Val( supplyMedia_dyn() ); }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"peerDtlsSetup") ) { return ::hx::Val( peerDtlsSetup ); }
+ if (HX_FIELD_EQ(inName,"contentAccept") ) { return ::hx::Val( contentAccept_dyn() ); }
+ if (HX_FIELD_EQ(inName,"transportInfo") ) { return ::hx::Val( transportInfo_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"candidatesDone") ) { return ::hx::Val( candidatesDone ); }
+ break;
+ case 15:
+ if (HX_FIELD_EQ(inName,"addMedia__fromC") ) { return ::hx::Val( addMedia__fromC_dyn() ); }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"localDescription") ) { return ::hx::Val( localDescription ); }
+ if (HX_FIELD_EQ(inName,"sendIceCandidate") ) { return ::hx::Val( sendIceCandidate_dyn() ); }
+ if (HX_FIELD_EQ(inName,"onPeerConnection") ) { return ::hx::Val( onPeerConnection_dyn() ); }
+ break;
+ case 17:
+ if (HX_FIELD_EQ(inName,"remoteDescription") ) { return ::hx::Val( remoteDescription ); }
+ break;
+ case 18:
+ if (HX_FIELD_EQ(inName,"supplyMedia__fromC") ) { return ::hx::Val( supplyMedia__fromC_dyn() ); }
+ break;
+ case 19:
+ if (HX_FIELD_EQ(inName,"setupPeerConnection") ) { return ::hx::Val( setupPeerConnection_dyn() ); }
+ break;
+ case 21:
+ if (HX_FIELD_EQ(inName,"setupLocalDescription") ) { return ::hx::Val( setupLocalDescription_dyn() ); }
+ break;
+ case 23:
+ if (HX_FIELD_EQ(inName,"queuedOutboundCandidate") ) { return ::hx::Val( queuedOutboundCandidate ); }
+ break;
+ case 26:
+ if (HX_FIELD_EQ(inName,"queuedInboundTransportInfo") ) { return ::hx::Val( queuedInboundTransportInfo ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool InitiatedSession_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 19:
+ if (HX_FIELD_EQ(inName,"fromSessionInitiate") ) { outValue = fromSessionInitiate_dyn(); return true; }
+ }
+ return false;
+}
+
+::hx::Val InitiatedSession_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 2:
+ if (HX_FIELD_EQ(inName,"pc") ) { pc=inValue.Cast< ::snikket::jingle::PeerConnection >(); return inValue; }
+ break;
+ case 3:
+ if (HX_FIELD_EQ(inName,"sid") ) { sid=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"_sid") ) { _sid=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"client") ) { client=inValue.Cast< ::snikket::Client >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"accepted") ) { accepted=inValue.Cast< bool >(); return inValue; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"initiator") ) { initiator=inValue.Cast< bool >(); return inValue; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"afterMedia") ) { afterMedia=inValue.Cast< ::Dynamic >(); return inValue; }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"counterpart") ) { counterpart=inValue.Cast< ::snikket::JID >(); return inValue; }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"peerDtlsSetup") ) { peerDtlsSetup=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"candidatesDone") ) { candidatesDone=inValue.Cast< ::Dynamic >(); return inValue; }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"localDescription") ) { localDescription=inValue.Cast< ::snikket::jingle::SessionDescription >(); return inValue; }
+ break;
+ case 17:
+ if (HX_FIELD_EQ(inName,"remoteDescription") ) { remoteDescription=inValue.Cast< ::snikket::jingle::SessionDescription >(); return inValue; }
+ break;
+ case 23:
+ if (HX_FIELD_EQ(inName,"queuedOutboundCandidate") ) { queuedOutboundCandidate=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ break;
+ case 26:
+ if (HX_FIELD_EQ(inName,"queuedInboundTransportInfo") ) { queuedInboundTransportInfo=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void InitiatedSession_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("sid",0e,9f,57,00));
+ outFields->push(HX_("client",4b,ca,4f,0a));
+ outFields->push(HX_("counterpart",ef,c0,14,5a));
+ outFields->push(HX_("_sid",0f,e4,22,3f));
+ outFields->push(HX_("remoteDescription",16,a8,ec,8d));
+ outFields->push(HX_("localDescription",51,49,74,58));
+ outFields->push(HX_("pc",f3,61,00,00));
+ outFields->push(HX_("peerDtlsSetup",e4,2a,18,74));
+ outFields->push(HX_("queuedInboundTransportInfo",11,30,f9,fb));
+ outFields->push(HX_("queuedOutboundCandidate",00,fe,e9,14));
+ outFields->push(HX_("accepted",67,bd,17,c8));
+ outFields->push(HX_("initiator",af,ac,ed,3d));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo InitiatedSession_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(InitiatedSession_obj,sid),HX_("sid",0e,9f,57,00)},
+ {::hx::fsObject /* ::snikket::Client */ ,(int)offsetof(InitiatedSession_obj,client),HX_("client",4b,ca,4f,0a)},
+ {::hx::fsObject /* ::snikket::JID */ ,(int)offsetof(InitiatedSession_obj,counterpart),HX_("counterpart",ef,c0,14,5a)},
+ {::hx::fsString,(int)offsetof(InitiatedSession_obj,_sid),HX_("_sid",0f,e4,22,3f)},
+ {::hx::fsObject /* ::snikket::jingle::SessionDescription */ ,(int)offsetof(InitiatedSession_obj,remoteDescription),HX_("remoteDescription",16,a8,ec,8d)},
+ {::hx::fsObject /* ::snikket::jingle::SessionDescription */ ,(int)offsetof(InitiatedSession_obj,localDescription),HX_("localDescription",51,49,74,58)},
+ {::hx::fsObject /* ::snikket::jingle::PeerConnection */ ,(int)offsetof(InitiatedSession_obj,pc),HX_("pc",f3,61,00,00)},
+ {::hx::fsString,(int)offsetof(InitiatedSession_obj,peerDtlsSetup),HX_("peerDtlsSetup",e4,2a,18,74)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(InitiatedSession_obj,queuedInboundTransportInfo),HX_("queuedInboundTransportInfo",11,30,f9,fb)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(InitiatedSession_obj,queuedOutboundCandidate),HX_("queuedOutboundCandidate",00,fe,e9,14)},
+ {::hx::fsBool,(int)offsetof(InitiatedSession_obj,accepted),HX_("accepted",67,bd,17,c8)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(InitiatedSession_obj,afterMedia),HX_("afterMedia",28,69,d3,68)},
+ {::hx::fsBool,(int)offsetof(InitiatedSession_obj,initiator),HX_("initiator",af,ac,ed,3d)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(InitiatedSession_obj,candidatesDone),HX_("candidatesDone",72,4b,30,dd)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *InitiatedSession_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String InitiatedSession_obj_sMemberFields[] = {
+ HX_("sid",0e,9f,57,00),
+ HX_("sid__fromC",2b,ef,18,af),
+ HX_("client",4b,ca,4f,0a),
+ HX_("counterpart",ef,c0,14,5a),
+ HX_("_sid",0f,e4,22,3f),
+ HX_("remoteDescription",16,a8,ec,8d),
+ HX_("localDescription",51,49,74,58),
+ HX_("pc",f3,61,00,00),
+ HX_("peerDtlsSetup",e4,2a,18,74),
+ HX_("queuedInboundTransportInfo",11,30,f9,fb),
+ HX_("queuedOutboundCandidate",00,fe,e9,14),
+ HX_("accepted",67,bd,17,c8),
+ HX_("afterMedia",28,69,d3,68),
+ HX_("initiator",af,ac,ed,3d),
+ HX_("candidatesDone",72,4b,30,dd),
+ HX_("get_sid",a5,67,cc,26),
+ HX_("ring",b0,5f,aa,4b),
+ HX_("retract",01,e2,b9,fc),
+ HX_("accept",08,93,06,0b),
+ HX_("hangup",4d,d2,ff,b7),
+ HX_("initiate",59,6a,8f,5f),
+ HX_("terminate",61,32,d2,fd),
+ HX_("contentAdd",68,66,dd,43),
+ HX_("contentAccept",21,c5,01,e1),
+ HX_("transportInfo",b7,3c,cf,b6),
+ HX_("addMedia",03,2b,19,7f),
+ HX_("addMedia__fromC",d6,fb,b5,1b),
+ HX_("callStatus",70,be,2b,31),
+ HX_("videoTracks",63,c2,24,be),
+ HX_("dtmf",e9,ba,71,42),
+ HX_("sendIceCandidate",e0,74,39,0d),
+ HX_("supplyMedia",35,0c,c9,9a),
+ HX_("supplyMedia__fromC",e4,84,0e,e6),
+ HX_("setupPeerConnection",bd,67,52,ae),
+ HX_("setupLocalDescription",ee,5d,68,24),
+ HX_("onPeerConnection",df,b1,71,fc),
+ ::String(null()) };
+
+::hx::Class InitiatedSession_obj::__mClass;
+
+static ::String InitiatedSession_obj_sStaticFields[] = {
+ HX_("fromSessionInitiate",85,8d,dd,dd),
+ ::String(null())
+};
+
+void InitiatedSession_obj::__register()
+{
+ InitiatedSession_obj _hx_dummy;
+ InitiatedSession_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.jingle.InitiatedSession",b7,6d,05,22);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &InitiatedSession_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(InitiatedSession_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(InitiatedSession_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< InitiatedSession_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = InitiatedSession_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = InitiatedSession_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void InitiatedSession_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_de51993dbb06b02d_278_boot)
+HXDLIN( 278) __mClass->__meta__ = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("fields",79,8e,8e,80), ::Dynamic(::hx::Anon_obj::Create(7)
+ ->setFixed(0,HX_("supplyMedia",35,0c,c9,9a), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(1,HX_("sid__fromC",2b,ef,18,af), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(2,HX_("videoTracks",63,c2,24,be), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(3,HX_("videoTracks__fromC",76,10,46,d8), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(4,HX_("supplyMedia__fromC",e4,84,0e,e6), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(5,HX_("addMedia__fromC",d6,fb,b5,1b), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(6,HX_("addMedia",03,2b,19,7f), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d))))))));
+ }
+}
+
+} // end namespace snikket
+} // end namespace jingle
diff --git a/Sources/c_snikket/src/snikket/jingle/Media.cpp b/Sources/c_snikket/src/snikket/jingle/Media.cpp
new file mode 100644
index 0000000..984940b
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/jingle/Media.cpp
@@ -0,0 +1,1179 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Lambda
+#include <Lambda.h>
+#endif
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_StringMap
+#include <haxe/ds/StringMap.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_Attribute
+#include <snikket/jingle/Attribute.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_IceCandidate
+#include <snikket/jingle/IceCandidate.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_Media
+#include <snikket/jingle/Media.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_SessionDescription
+#include <snikket/jingle/SessionDescription.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_4daf6b6064f97b22_226_new,"snikket.jingle.Media","new",0x872bcf4a,"snikket.jingle.Media.new","snikket/jingle/SessionDescription.hx",226,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_4daf6b6064f97b22_361_toSdp,"snikket.jingle.Media","toSdp",0x001e596e,"snikket.jingle.Media.toSdp","snikket/jingle/SessionDescription.hx",361,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_4daf6b6064f97b22_369_contentElement,"snikket.jingle.Media","contentElement",0xbe6c47d9,"snikket.jingle.Media.contentElement","snikket/jingle/SessionDescription.hx",369,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_4daf6b6064f97b22_367_contentElement,"snikket.jingle.Media","contentElement",0xbe6c47d9,"snikket.jingle.Media.contentElement","snikket/jingle/SessionDescription.hx",367,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_4daf6b6064f97b22_371_contentElement,"snikket.jingle.Media","contentElement",0xbe6c47d9,"snikket.jingle.Media.contentElement","snikket/jingle/SessionDescription.hx",371,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_4daf6b6064f97b22_373_contentElement,"snikket.jingle.Media","contentElement",0xbe6c47d9,"snikket.jingle.Media.contentElement","snikket/jingle/SessionDescription.hx",373,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_4daf6b6064f97b22_442_toElement,"snikket.jingle.Media","toElement",0x4671f0eb,"snikket.jingle.Media.toElement","snikket/jingle/SessionDescription.hx",442,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_4daf6b6064f97b22_457_toElement,"snikket.jingle.Media","toElement",0x4671f0eb,"snikket.jingle.Media.toElement","snikket/jingle/SessionDescription.hx",457,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_4daf6b6064f97b22_460_toElement,"snikket.jingle.Media","toElement",0x4671f0eb,"snikket.jingle.Media.toElement","snikket/jingle/SessionDescription.hx",460,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_4daf6b6064f97b22_379_toElement,"snikket.jingle.Media","toElement",0x4671f0eb,"snikket.jingle.Media.toElement","snikket/jingle/SessionDescription.hx",379,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_4daf6b6064f97b22_446_toElement,"snikket.jingle.Media","toElement",0x4671f0eb,"snikket.jingle.Media.toElement","snikket/jingle/SessionDescription.hx",446,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_4daf6b6064f97b22_451_toElement,"snikket.jingle.Media","toElement",0x4671f0eb,"snikket.jingle.Media.toElement","snikket/jingle/SessionDescription.hx",451,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_4daf6b6064f97b22_470_getUfragPwd,"snikket.jingle.Media","getUfragPwd",0x9b1eb236,"snikket.jingle.Media.getUfragPwd","snikket/jingle/SessionDescription.hx",470,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_4daf6b6064f97b22_471_getUfragPwd,"snikket.jingle.Media","getUfragPwd",0x9b1eb236,"snikket.jingle.Media.getUfragPwd","snikket/jingle/SessionDescription.hx",471,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_4daf6b6064f97b22_468_getUfragPwd,"snikket.jingle.Media","getUfragPwd",0x9b1eb236,"snikket.jingle.Media.getUfragPwd","snikket/jingle/SessionDescription.hx",468,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_4daf6b6064f97b22_482_toTransportElement,"snikket.jingle.Media","toTransportElement",0x23b23e04,"snikket.jingle.Media.toTransportElement","snikket/jingle/SessionDescription.hx",482,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_4daf6b6064f97b22_483_toTransportElement,"snikket.jingle.Media","toTransportElement",0x23b23e04,"snikket.jingle.Media.toTransportElement","snikket/jingle/SessionDescription.hx",483,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_4daf6b6064f97b22_476_toTransportElement,"snikket.jingle.Media","toTransportElement",0x23b23e04,"snikket.jingle.Media.toTransportElement","snikket/jingle/SessionDescription.hx",476,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_4daf6b6064f97b22_236_fromElement,"snikket.jingle.Media","fromElement",0xab450b5c,"snikket.jingle.Media.fromElement","snikket/jingle/SessionDescription.hx",236,0x68af748c)
+namespace snikket{
+namespace jingle{
+
+void Media_obj::__construct(::String mid,::String media,::String connectionData,::String port,::String protocol,::Array< ::Dynamic> attributes,::Array< int > formats){
+ HX_STACKFRAME(&_hx_pos_4daf6b6064f97b22_226_new)
+HXLINE( 227) this->mid = mid;
+HXLINE( 228) this->media = media;
+HXLINE( 229) this->connectionData = connectionData;
+HXLINE( 230) this->port = port;
+HXLINE( 231) this->protocol = protocol;
+HXLINE( 232) this->attributes = attributes;
+HXLINE( 233) this->formats = formats;
+ }
+
+Dynamic Media_obj::__CreateEmpty() { return new Media_obj; }
+
+void *Media_obj::_hx_vtable = 0;
+
+Dynamic Media_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Media_obj > _hx_result = new Media_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6]);
+ return _hx_result;
+}
+
+bool Media_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x06e5f716;
+}
+
+::String Media_obj::toSdp(){
+ HX_STACKFRAME(&_hx_pos_4daf6b6064f97b22_361_toSdp)
+HXLINE( 362) ::String _hx_tmp = ((((((HX_("m=",30,5f,00,00) + this->media) + HX_(" ",20,00,00,00)) + this->port) + HX_(" ",20,00,00,00)) + this->protocol) + HX_(" ",20,00,00,00));
+HXDLIN( 362) ::String _hx_tmp1 = (((_hx_tmp + this->formats->join(HX_(" ",20,00,00,00))) + HX_("\r\n",5d,0b,00,00)) + HX_("c=",7a,56,00,00));
+HXDLIN( 362) ::String _hx_tmp2 = ((_hx_tmp1 + this->connectionData) + HX_("\r\n",5d,0b,00,00));
+HXLINE( 364) ::Array< ::Dynamic> _this = this->attributes;
+HXDLIN( 364) ::Array< ::String > result = ::Array_obj< ::String >::__new(_this->length);
+HXDLIN( 364) {
+HXLINE( 364) int _g = 0;
+HXDLIN( 364) int _g1 = _this->length;
+HXDLIN( 364) while((_g < _g1)){
+HXLINE( 364) _g = (_g + 1);
+HXDLIN( 364) int i = (_g - 1);
+HXDLIN( 364) {
+HXLINE( 364) ::String inValue = ( ( ::snikket::jingle::Attribute)(_hx_array_unsafe_get(_this,i)) )->toSdp();
+HXDLIN( 364) result->__unsafe_set(i,inValue);
+ }
+ }
+ }
+HXLINE( 361) return (_hx_tmp2 + result->join(HX_("",00,00,00,00)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(Media_obj,toSdp,return )
+
+ ::snikket::Stanza Media_obj::contentElement(bool initiator){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Attribute attr){
+ HX_STACKFRAME(&_hx_pos_4daf6b6064f97b22_369_contentElement)
+HXLINE( 369) return (attr->key == HX_("inactive",6b,17,30,6a));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_4daf6b6064f97b22_367_contentElement)
+HXLINE( 368) ::Dynamic attrs = ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("creator",ac,be,6a,11),HX_("initiator",af,ac,ed,3d))
+ ->setFixed(1,HX_("name",4b,72,ff,48),this->mid)
+ ->setFixed(2,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:jingle:1",44,c4,fe,f7)));
+HXLINE( 369) if (::Lambda_obj::exists(this->attributes, ::Dynamic(new _hx_Closure_0()))) {
+HXLINE( 370) ::Reflect_obj::setField(attrs,HX_("senders",1e,f7,a9,a8),HX_("none",b8,12,0a,49));
+ }
+ else {
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_1) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Attribute attr){
+ HX_STACKFRAME(&_hx_pos_4daf6b6064f97b22_371_contentElement)
+HXLINE( 371) return (attr->key == HX_("sendonly",b4,56,a7,f2));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE( 371) if (::Lambda_obj::exists(this->attributes, ::Dynamic(new _hx_Closure_1()))) {
+HXLINE( 372) ::String value;
+HXDLIN( 372) if (initiator) {
+HXLINE( 372) value = HX_("initiator",af,ac,ed,3d);
+ }
+ else {
+HXLINE( 372) value = HX_("responder",02,a1,00,29);
+ }
+HXDLIN( 372) ::Reflect_obj::setField(attrs,HX_("senders",1e,f7,a9,a8),value);
+ }
+ else {
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_2) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Attribute attr){
+ HX_STACKFRAME(&_hx_pos_4daf6b6064f97b22_373_contentElement)
+HXLINE( 373) return (attr->key == HX_("recvonly",92,5d,be,b0));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE( 373) if (::Lambda_obj::exists(this->attributes, ::Dynamic(new _hx_Closure_2()))) {
+HXLINE( 374) ::String value1;
+HXDLIN( 374) if (initiator) {
+HXLINE( 374) value1 = HX_("responder",02,a1,00,29);
+ }
+ else {
+HXLINE( 374) value1 = HX_("initiator",af,ac,ed,3d);
+ }
+HXDLIN( 374) ::Reflect_obj::setField(attrs,HX_("senders",1e,f7,a9,a8),value1);
+ }
+ }
+ }
+HXLINE( 376) return ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("content",39,8d,77,19),attrs);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Media_obj,contentElement,return )
+
+ ::snikket::Stanza Media_obj::toElement(::Array< ::Dynamic> sessionAttributes,bool initiator){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Attribute attr){
+ HX_GC_STACKFRAME(&_hx_pos_4daf6b6064f97b22_442_toElement)
+HXLINE( 442) return (attr->key == HX_("extmap-allow-mixed",05,91,99,44));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_4) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Attribute attr){
+ HX_GC_STACKFRAME(&_hx_pos_4daf6b6064f97b22_457_toElement)
+HXLINE( 457) return (attr->key == HX_("rtcp-mux",72,08,78,80));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_5) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Attribute attr){
+ HX_GC_STACKFRAME(&_hx_pos_4daf6b6064f97b22_460_toElement)
+HXLINE( 460) return (attr->key == HX_("ice-lite",b0,64,44,1d));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_4daf6b6064f97b22_379_toElement)
+HXLINE( 380) ::snikket::Stanza content = this->contentElement(initiator);
+HXLINE( 381) ::snikket::Stanza description = content->tag(HX_("description",fc,08,1d,5f), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("media",e4,04,bc,05),this->media)
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:jingle:apps:rtp:1",ea,41,fe,5c))));
+HXLINE( 382) ::Array< ::Dynamic> _g = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 382) {
+HXLINE( 382) int _g1 = 0;
+HXDLIN( 382) ::Array< ::Dynamic> _g2 = this->attributes;
+HXDLIN( 382) while((_g1 < _g2->length)){
+HXLINE( 382) ::snikket::jingle::Attribute v = _g2->__get(_g1).StaticCast< ::snikket::jingle::Attribute >();
+HXDLIN( 382) _g1 = (_g1 + 1);
+HXDLIN( 382) if ((v->key == HX_("rtcp-fb",1a,8f,ca,30))) {
+HXLINE( 382) _g->push(v);
+ }
+ }
+ }
+HXDLIN( 382) ::Array< ::Dynamic> _this = _g;
+HXDLIN( 382) ::Array< ::Dynamic> result = ::Array_obj< ::Dynamic>::__new(_this->length);
+HXDLIN( 382) {
+HXLINE( 382) int _g3 = 0;
+HXDLIN( 382) int _g4 = _this->length;
+HXDLIN( 382) while((_g3 < _g4)){
+HXLINE( 382) _g3 = (_g3 + 1);
+HXDLIN( 382) int i = (_g3 - 1);
+HXDLIN( 382) {
+HXLINE( 383) ::Array< ::String > segments = ( ( ::snikket::jingle::Attribute)(_hx_array_unsafe_get(_this,i)) )->value.split(HX_(" ",20,00,00,00));
+HXLINE( 384) ::String segments1 = segments->__get(0);
+HXDLIN( 384) ::snikket::Stanza inValue;
+HXDLIN( 384) if ((segments->__get(1) == HX_("trr-int",16,ba,25,2e))) {
+HXLINE( 384) inValue = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("rtcp-fb-trr-int",a3,02,fa,8c), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("value",71,7f,b8,31),segments->__get(2))
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:jingle:apps:rtp:rtcp-fb:0",09,5f,fc,2a))));
+ }
+ else {
+HXLINE( 387) ::Dynamic fbattrs = ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("type",ba,f2,08,4d),segments->__get(1))
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:jingle:apps:rtp:rtcp-fb:0",09,5f,fc,2a)));
+HXLINE( 388) if ((segments->length >= 3)) {
+HXLINE( 388) ::String value = segments->__get(2);
+HXDLIN( 388) ::Reflect_obj::setField(fbattrs,HX_("subtype",3a,5c,33,30),value);
+ }
+HXLINE( 384) inValue = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("rtcp-fb",1a,8f,ca,30),fbattrs);
+ }
+HXLINE( 382) result->__unsafe_set(i, ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("el",67,58,00,00),inValue)
+ ->setFixed(1,HX_("id",db,5b,00,00),segments1)));
+ }
+ }
+ }
+HXDLIN( 382) ::Array< ::Dynamic> fbs = result;
+HXLINE( 392) ::haxe::ds::StringMap ssrc = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXLINE( 393) ::haxe::ds::StringMap fmtp = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXLINE( 394) {
+HXLINE( 394) int _g5 = 0;
+HXDLIN( 394) ::Array< ::Dynamic> _g6 = this->attributes;
+HXDLIN( 394) while((_g5 < _g6->length)){
+HXLINE( 394) ::snikket::jingle::Attribute attr = _g6->__get(_g5).StaticCast< ::snikket::jingle::Attribute >();
+HXDLIN( 394) _g5 = (_g5 + 1);
+HXLINE( 395) if ((attr->key == HX_("fmtp",83,de,be,43))) {
+HXLINE( 396) int pos = attr->value.indexOf(HX_(" ",20,00,00,00),null());
+HXLINE( 397) if ((pos < 0)) {
+HXLINE( 397) continue;
+ }
+HXLINE( 398) {
+HXLINE( 398) ::String key = attr->value.substr(0,pos);
+HXDLIN( 398) ::Array< ::String > _this1 = attr->value.substr((pos + 1),null()).split(HX_(";",3b,00,00,00));
+HXDLIN( 398) ::Array< ::Dynamic> result1 = ::Array_obj< ::Dynamic>::__new(_this1->length);
+HXDLIN( 398) {
+HXLINE( 398) int _g7 = 0;
+HXDLIN( 398) int _g8 = _this1->length;
+HXDLIN( 398) while((_g7 < _g8)){
+HXLINE( 398) _g7 = (_g7 + 1);
+HXDLIN( 398) int i1 = (_g7 - 1);
+HXDLIN( 398) {
+HXLINE( 398) ::String param = ( (::String)(_hx_array_unsafe_get(_this1,i1)) );
+HXLINE( 399) int eqPos = param.indexOf(HX_("=",3d,00,00,00),null());
+HXLINE( 400) ::String attrs;
+HXDLIN( 400) if ((eqPos > 0)) {
+HXLINE( 400) attrs = param.substr((eqPos + 1),null());
+ }
+ else {
+HXLINE( 400) attrs = param;
+ }
+HXDLIN( 400) ::Dynamic attrs1 = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("value",71,7f,b8,31),attrs));
+HXLINE( 401) if ((eqPos > 0)) {
+HXLINE( 401) ::String value1 = param.substr(0,eqPos);
+HXDLIN( 401) ::Reflect_obj::setField(attrs1,HX_("name",4b,72,ff,48),value1);
+ }
+HXLINE( 398) ::snikket::Stanza inValue1 = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("parameter",a9,35,b0,48),attrs1);
+HXDLIN( 398) result1->__unsafe_set(i1,inValue1);
+ }
+ }
+ }
+HXDLIN( 398) fmtp->set(key,result1);
+ }
+ }
+ else {
+HXLINE( 404) if ((attr->key == HX_("ssrc",51,30,5b,4c))) {
+HXLINE( 405) int pos1 = attr->value.indexOf(HX_(" ",20,00,00,00),null());
+HXLINE( 406) if ((pos1 < 0)) {
+HXLINE( 406) continue;
+ }
+HXLINE( 407) ::String id = attr->value.substr(0,pos1);
+HXLINE( 408) if (::hx::IsNull( ( (::Array< ::Dynamic>)(ssrc->get(id)) ) )) {
+HXLINE( 408) ssrc->set(id,::Array_obj< ::Dynamic>::__new(0));
+ }
+HXLINE( 409) ::String param1 = attr->value.substr((pos1 + 1),null());
+HXLINE( 410) int colonPos = param1.indexOf(HX_(":",3a,00,00,00),null());
+HXLINE( 411) ::String attrs2;
+HXDLIN( 411) if ((colonPos > 0)) {
+HXLINE( 411) attrs2 = param1.substr(0,colonPos);
+ }
+ else {
+HXLINE( 411) attrs2 = param1;
+ }
+HXDLIN( 411) ::Dynamic attrs3 = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("name",4b,72,ff,48),attrs2));
+HXLINE( 412) if ((colonPos > 0)) {
+HXLINE( 412) ::String value2 = param1.substr((colonPos + 1),null());
+HXDLIN( 412) ::Reflect_obj::setField(attrs3,HX_("value",71,7f,b8,31),value2);
+ }
+HXLINE( 413) ::Array< ::Dynamic> _hx_tmp = ( (::Array< ::Dynamic>)(ssrc->get(id)) );
+HXDLIN( 413) _hx_tmp->push( ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("parameter",a9,35,b0,48),attrs3));
+ }
+ else {
+HXLINE( 414) if ((attr->key == HX_("extmap",9b,d8,20,c7))) {
+HXLINE( 415) int pos2 = attr->value.indexOf(HX_(" ",20,00,00,00),null());
+HXLINE( 416) if ((pos2 < 0)) {
+HXLINE( 416) continue;
+ }
+HXLINE( 417) ::String _hx_tmp1 = attr->value.substr(0,pos2);
+HXDLIN( 417) description->tag(HX_("rtp-hdrext",aa,ab,bb,00), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("id",db,5b,00,00),_hx_tmp1)
+ ->setFixed(1,HX_("uri",6c,2b,59,00),attr->value.substr((pos2 + 1),null()))
+ ->setFixed(2,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:jingle:apps:rtp:rtp-hdrext:0",c7,33,ab,6d))))->up();
+ }
+ else {
+HXLINE( 418) if ((attr->key == HX_("ssrc-group",03,b3,2d,49))) {
+HXLINE( 419) ::Array< ::String > segments2 = attr->value.split(HX_(" ",20,00,00,00));
+HXLINE( 420) if ((segments2->length < 2)) {
+HXLINE( 420) continue;
+ }
+HXLINE( 421) ::snikket::Stanza group = description->tag(HX_("ssrc-group",03,b3,2d,49), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:jingle:apps:rtp:ssma:0",51,23,31,6f))
+ ->setFixed(1,HX_("semantics",ad,54,ab,73),segments2->__get(0))));
+HXLINE( 422) {
+HXLINE( 422) int _g9 = 0;
+HXDLIN( 422) ::Array< ::String > _g10 = segments2->slice(1,null());
+HXDLIN( 422) while((_g9 < _g10->length)){
+HXLINE( 422) ::String seg = _g10->__get(_g9);
+HXDLIN( 422) _g9 = (_g9 + 1);
+HXLINE( 423) group->tag(HX_("source",db,b0,31,32), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("ssrc",51,30,5b,4c),seg)))->up();
+ }
+ }
+HXLINE( 425) group->up();
+ }
+ }
+ }
+ }
+ }
+ }
+HXLINE( 428) ::Array< ::Dynamic> _g11 = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 428) {
+HXLINE( 428) int _g12 = 0;
+HXDLIN( 428) ::Array< ::Dynamic> _g13 = fbs;
+HXDLIN( 428) while((_g12 < _g13->length)){
+HXLINE( 428) ::Dynamic v1 = _g13->__get(_g12);
+HXDLIN( 428) _g12 = (_g12 + 1);
+HXDLIN( 428) if (::hx::IsEq( v1->__Field(HX_("id",db,5b,00,00),::hx::paccDynamic),HX_("*",2a,00,00,00) )) {
+HXLINE( 428) _g11->push(v1);
+ }
+ }
+ }
+HXDLIN( 428) ::Array< ::Dynamic> _this2 = _g11;
+HXDLIN( 428) ::Array< ::Dynamic> result2 = ::Array_obj< ::Dynamic>::__new(_this2->length);
+HXDLIN( 428) {
+HXLINE( 428) int _g14 = 0;
+HXDLIN( 428) int _g15 = _this2->length;
+HXDLIN( 428) while((_g14 < _g15)){
+HXLINE( 428) _g14 = (_g14 + 1);
+HXDLIN( 428) int i2 = (_g14 - 1);
+HXDLIN( 428) {
+HXLINE( 428) ::snikket::Stanza inValue2 = ( ( ::snikket::Stanza)(_hx_array_unsafe_get(_this2,i2)->__Field(HX_("el",67,58,00,00),::hx::paccDynamic)) );
+HXDLIN( 428) result2->__unsafe_set(i2,inValue2);
+ }
+ }
+ }
+HXDLIN( 428) description->addChildren(result2);
+HXLINE( 429) ::Array< ::Dynamic> _g16 = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 429) {
+HXLINE( 429) int _g17 = 0;
+HXDLIN( 429) ::Array< ::Dynamic> _g18 = this->attributes;
+HXDLIN( 429) while((_g17 < _g18->length)){
+HXLINE( 429) ::snikket::jingle::Attribute v2 = _g18->__get(_g17).StaticCast< ::snikket::jingle::Attribute >();
+HXDLIN( 429) _g17 = (_g17 + 1);
+HXDLIN( 429) if ((v2->key == HX_("rtpmap",ee,5c,85,a9))) {
+HXLINE( 429) _g16->push(v2);
+ }
+ }
+ }
+HXDLIN( 429) ::Array< ::Dynamic> _this3 = _g16;
+HXDLIN( 429) ::Array< ::Dynamic> result3 = ::Array_obj< ::Dynamic>::__new(_this3->length);
+HXDLIN( 429) {
+HXLINE( 429) int _g19 = 0;
+HXDLIN( 429) int _g20 = _this3->length;
+HXDLIN( 429) while((_g19 < _g20)){
+HXLINE( 429) _g19 = (_g19 + 1);
+HXDLIN( 429) int i3 = (_g19 - 1);
+HXDLIN( 429) {
+HXLINE( 429) ::snikket::jingle::Attribute rtpmap = ( ( ::snikket::jingle::Attribute)(_hx_array_unsafe_get(_this3,i3)) );
+HXLINE( 430) int pos3 = rtpmap->value.indexOf(HX_(" ",20,00,00,00),null());
+HXLINE( 431) if ((pos3 < 0)) {
+HXLINE( 431) HX_STACK_DO_THROW(HX_("invalid rtpmap",f7,b6,a7,cc));
+ }
+HXLINE( 432) ::String id1 = rtpmap->value.substr(0,pos3);
+HXLINE( 433) ::Array< ::String > segments3 = rtpmap->value.substr((pos3 + 1),null()).split(HX_("/",2f,00,00,00));
+HXLINE( 434) ::Dynamic attrs4 = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("id",db,5b,00,00),id1));
+HXLINE( 435) if ((segments3->length > 0)) {
+HXLINE( 435) ::String value3 = segments3->__get(0);
+HXDLIN( 435) ::Reflect_obj::setField(attrs4,HX_("name",4b,72,ff,48),value3);
+ }
+HXLINE( 436) if ((segments3->length > 1)) {
+HXLINE( 436) ::String value4 = segments3->__get(1);
+HXDLIN( 436) ::Reflect_obj::setField(attrs4,HX_("clockrate",ae,5b,4b,39),value4);
+ }
+HXLINE( 437) bool _hx_tmp2;
+HXDLIN( 437) bool _hx_tmp3;
+HXDLIN( 437) if ((segments3->length > 2)) {
+HXLINE( 437) _hx_tmp3 = (segments3->__get(2) != HX_("",00,00,00,00));
+ }
+ else {
+HXLINE( 437) _hx_tmp3 = false;
+ }
+HXDLIN( 437) if (_hx_tmp3) {
+HXLINE( 437) _hx_tmp2 = (segments3->__get(2) != HX_("1",31,00,00,00));
+ }
+ else {
+HXLINE( 437) _hx_tmp2 = false;
+ }
+HXDLIN( 437) if (_hx_tmp2) {
+HXLINE( 437) ::String value5 = segments3->__get(2);
+HXDLIN( 437) ::Reflect_obj::setField(attrs4,HX_("channels",50,aa,ee,6a),value5);
+ }
+HXLINE( 438) ::snikket::Stanza inValue3 = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("payload-type",19,2b,54,39),attrs4);
+HXLINE( 439) ::Array< ::Dynamic> _g21 = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 439) {
+HXLINE( 439) int _g22 = 0;
+HXDLIN( 439) ::Array< ::Dynamic> _g23 = fbs;
+HXDLIN( 439) while((_g22 < _g23->length)){
+HXLINE( 439) ::Dynamic v3 = _g23->__get(_g22);
+HXDLIN( 439) _g22 = (_g22 + 1);
+HXDLIN( 439) if (::hx::IsEq( v3->__Field(HX_("id",db,5b,00,00),::hx::paccDynamic),id1 )) {
+HXLINE( 439) _g21->push(v3);
+ }
+ }
+ }
+HXDLIN( 439) ::Array< ::Dynamic> _this4 = _g21;
+HXDLIN( 439) ::Array< ::Dynamic> result4 = ::Array_obj< ::Dynamic>::__new(_this4->length);
+HXDLIN( 439) {
+HXLINE( 439) int _g24 = 0;
+HXDLIN( 439) int _g25 = _this4->length;
+HXDLIN( 439) while((_g24 < _g25)){
+HXLINE( 439) _g24 = (_g24 + 1);
+HXDLIN( 439) int i4 = (_g24 - 1);
+HXDLIN( 439) {
+HXLINE( 439) ::snikket::Stanza inValue4 = ( ( ::snikket::Stanza)(_hx_array_unsafe_get(_this4,i4)->__Field(HX_("el",67,58,00,00),::hx::paccDynamic)) );
+HXDLIN( 439) result4->__unsafe_set(i4,inValue4);
+ }
+ }
+ }
+HXLINE( 438) ::snikket::Stanza inValue5 = inValue3->addChildren(result4);
+HXLINE( 440) ::Dynamic inValue6;
+HXDLIN( 440) if (::hx::IsNull( ( (::Array< ::Dynamic>)(fmtp->get(id1)) ) )) {
+HXLINE( 440) inValue6 = ::Array_obj< ::Dynamic>::__new(0);
+ }
+ else {
+HXLINE( 440) inValue6 = ( (::Array< ::Dynamic>)(fmtp->get(id1)) );
+ }
+HXLINE( 429) ::snikket::Stanza inValue7 = inValue5->addChildren(inValue6);
+HXDLIN( 429) result3->__unsafe_set(i3,inValue7);
+ }
+ }
+ }
+HXDLIN( 429) description->addChildren(result3);
+HXLINE( 442) bool _hx_tmp4;
+HXDLIN( 442) if (!(::Lambda_obj::exists(this->attributes, ::Dynamic(new _hx_Closure_0())))) {
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_1) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Attribute attr){
+ HX_GC_STACKFRAME(&_hx_pos_4daf6b6064f97b22_442_toElement)
+HXLINE( 442) return (attr->key == HX_("extmap-allow-mixed",05,91,99,44));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE( 442) _hx_tmp4 = ::Lambda_obj::exists(sessionAttributes, ::Dynamic(new _hx_Closure_1()));
+ }
+ else {
+HXLINE( 442) _hx_tmp4 = true;
+ }
+HXDLIN( 442) if (_hx_tmp4) {
+HXLINE( 443) description->tag(HX_("extmap-allow-mixed",05,91,99,44), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:jingle:apps:rtp:rtp-hdrext:0",c7,33,ab,6d))))->up();
+ }
+HXLINE( 445) {
+HXLINE( 445) ::Dynamic map = ssrc;
+HXDLIN( 445) ::Dynamic entry_map = map;
+HXDLIN( 445) ::Dynamic entry_keys = ::haxe::IMap_obj::keys(map);
+HXDLIN( 445) while(( (bool)(entry_keys->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_2) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Attribute attr){
+ HX_GC_STACKFRAME(&_hx_pos_4daf6b6064f97b22_446_toElement)
+HXLINE( 446) return (attr->key == HX_("msid",c1,e0,63,48));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE( 445) ::String key1 = ( (::String)(entry_keys->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXDLIN( 445) ::Array< ::Dynamic> entry_value = ( (::Array< ::Dynamic>)(::haxe::IMap_obj::get(entry_map,key1)) );
+HXDLIN( 445) ::String entry_key = key1;
+HXLINE( 446) ::snikket::jingle::Attribute msid = ( ( ::snikket::jingle::Attribute)(::Lambda_obj::find(this->attributes, ::Dynamic(new _hx_Closure_2()))) );
+HXLINE( 451) bool _hx_tmp5;
+HXDLIN( 451) if (::hx::IsNotNull( msid )) {
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_3) HXARGC(1)
+ bool _hx_run( ::snikket::Stanza param){
+ HX_GC_STACKFRAME(&_hx_pos_4daf6b6064f97b22_451_toElement)
+HXLINE( 451) return (( (::String)(::Reflect_obj::field(param->attr,HX_("name",4b,72,ff,48))) ) == HX_("msid",c1,e0,63,48));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE( 451) _hx_tmp5 = !(::Lambda_obj::exists(entry_value, ::Dynamic(new _hx_Closure_3())));
+ }
+ else {
+HXLINE( 451) _hx_tmp5 = false;
+ }
+HXDLIN( 451) if (_hx_tmp5) {
+HXLINE( 452) entry_value->push( ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("parameter",a9,35,b0,48), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("value",71,7f,b8,31),msid->value)
+ ->setFixed(1,HX_("name",4b,72,ff,48),HX_("msid",c1,e0,63,48)))));
+ }
+HXLINE( 454) description->tag(HX_("source",db,b0,31,32), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("ssrc",51,30,5b,4c),entry_key)
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:jingle:apps:rtp:ssma:0",51,23,31,6f))))->addChildren(entry_value)->up();
+ }
+ }
+HXLINE( 457) if (::Lambda_obj::exists(this->attributes, ::Dynamic(new _hx_Closure_4()))) {
+HXLINE( 458) description->tag(HX_("rtcp-mux",72,08,78,80),null())->up();
+ }
+HXLINE( 460) if (::Lambda_obj::exists(this->attributes, ::Dynamic(new _hx_Closure_5()))) {
+HXLINE( 461) description->tag(HX_("ice-lite",b0,64,44,1d),null())->up();
+ }
+HXLINE( 463) description->up();
+HXLINE( 464) content->addChild(this->toTransportElement(sessionAttributes))->up();
+HXLINE( 465) return content;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Media_obj,toElement,return )
+
+ ::Dynamic Media_obj::getUfragPwd(::Array< ::Dynamic> sessionAttributes){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Attribute attr){
+ HX_STACKFRAME(&_hx_pos_4daf6b6064f97b22_470_getUfragPwd)
+HXLINE( 470) return (attr->key == HX_("ice-ufrag",65,c2,31,ab));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_1) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Attribute attr){
+ HX_STACKFRAME(&_hx_pos_4daf6b6064f97b22_471_getUfragPwd)
+HXLINE( 471) return (attr->key == HX_("ice-pwd",3b,03,2f,e9));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_4daf6b6064f97b22_468_getUfragPwd)
+HXLINE( 469) ::Array< ::Dynamic> tmp = sessionAttributes;
+HXDLIN( 469) ::Array< ::Dynamic> allAttributes;
+HXDLIN( 469) if (::hx::IsNotNull( tmp )) {
+HXLINE( 469) allAttributes = tmp;
+ }
+ else {
+HXLINE( 469) allAttributes = ::Array_obj< ::Dynamic>::__new(0);
+ }
+HXDLIN( 469) ::Array< ::Dynamic> allAttributes1 = this->attributes->concat(allAttributes);
+HXLINE( 470) ::snikket::jingle::Attribute ufrag = ( ( ::snikket::jingle::Attribute)(::Lambda_obj::find(allAttributes1, ::Dynamic(new _hx_Closure_0()))) );
+HXLINE( 471) ::snikket::jingle::Attribute pwd = ( ( ::snikket::jingle::Attribute)(::Lambda_obj::find(allAttributes1, ::Dynamic(new _hx_Closure_1()))) );
+HXLINE( 472) bool _hx_tmp;
+HXDLIN( 472) if (::hx::IsNotNull( ufrag )) {
+HXLINE( 472) _hx_tmp = ::hx::IsNull( pwd );
+ }
+ else {
+HXLINE( 472) _hx_tmp = true;
+ }
+HXDLIN( 472) if (_hx_tmp) {
+HXLINE( 472) HX_STACK_DO_THROW(HX_("transport is missing ufrag or pwd",52,c9,01,1c));
+ }
+HXLINE( 473) return ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("ufrag",27,78,a4,a1),ufrag->value)
+ ->setFixed(1,HX_("pwd",7d,64,55,00),pwd->value));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Media_obj,getUfragPwd,return )
+
+ ::snikket::Stanza Media_obj::toTransportElement(::Array< ::Dynamic> sessionAttributes){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Attribute attr){
+ HX_GC_STACKFRAME(&_hx_pos_4daf6b6064f97b22_482_toTransportElement)
+HXLINE( 482) return (attr->key == HX_("fingerprint",e4,43,63,a3));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_1) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Attribute attr){
+ HX_GC_STACKFRAME(&_hx_pos_4daf6b6064f97b22_483_toTransportElement)
+HXLINE( 483) return (attr->key == HX_("setup",7d,ae,2f,7a));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_4daf6b6064f97b22_476_toTransportElement)
+HXDLIN( 476) ::snikket::jingle::Media _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 477) ::Dynamic transportAttr = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:jingle:transports:ice-udp:1",f3,67,4f,53)));
+HXLINE( 478) ::Dynamic ufragPwd = this->getUfragPwd(sessionAttributes);
+HXLINE( 479) {
+HXLINE( 479) ::String value = ( (::String)(ufragPwd->__Field(HX_("ufrag",27,78,a4,a1),::hx::paccDynamic)) );
+HXDLIN( 479) ::Reflect_obj::setField(transportAttr,HX_("ufrag",27,78,a4,a1),value);
+ }
+HXLINE( 480) {
+HXLINE( 480) ::String value1 = ( (::String)(ufragPwd->__Field(HX_("pwd",7d,64,55,00),::hx::paccDynamic)) );
+HXDLIN( 480) ::Reflect_obj::setField(transportAttr,HX_("pwd",7d,64,55,00),value1);
+ }
+HXLINE( 481) ::snikket::Stanza transport = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("transport",a9,4f,2f,4c),transportAttr);
+HXLINE( 482) ::snikket::jingle::Attribute fingerprint = ( ( ::snikket::jingle::Attribute)(::Lambda_obj::find(this->attributes->concat(sessionAttributes), ::Dynamic(new _hx_Closure_0()))) );
+HXLINE( 483) ::snikket::jingle::Attribute setup = ( ( ::snikket::jingle::Attribute)(::Lambda_obj::find(this->attributes->concat(sessionAttributes), ::Dynamic(new _hx_Closure_1()))) );
+HXLINE( 484) bool _hx_tmp;
+HXDLIN( 484) bool _hx_tmp1;
+HXDLIN( 484) if (::hx::IsNotNull( fingerprint )) {
+HXLINE( 484) _hx_tmp1 = ::hx::IsNotNull( setup );
+ }
+ else {
+HXLINE( 484) _hx_tmp1 = false;
+ }
+HXDLIN( 484) if (_hx_tmp1) {
+HXLINE( 484) _hx_tmp = (fingerprint->value.indexOf(HX_(" ",20,00,00,00),null()) > 0);
+ }
+ else {
+HXLINE( 484) _hx_tmp = false;
+ }
+HXDLIN( 484) if (_hx_tmp) {
+HXLINE( 485) int pos = fingerprint->value.indexOf(HX_(" ",20,00,00,00),null());
+HXLINE( 486) ::String _hx_tmp2 = fingerprint->value.substr((pos + 1),null());
+HXDLIN( 486) ::String _hx_tmp3 = fingerprint->value.substr(0,pos);
+HXDLIN( 486) transport->textTag(HX_("fingerprint",e4,43,63,a3),_hx_tmp2, ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("hash",ce,2f,08,45),_hx_tmp3)
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:jingle:apps:dtls:0",a8,cb,02,66))
+ ->setFixed(2,HX_("setup",7d,ae,2f,7a),setup->value)));
+ }
+HXLINE( 488) ::Array< ::Dynamic> _g = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 488) {
+HXLINE( 488) int _g1 = 0;
+HXDLIN( 488) ::Array< ::Dynamic> _g2 = this->attributes;
+HXDLIN( 488) while((_g1 < _g2->length)){
+HXLINE( 488) ::snikket::jingle::Attribute v = _g2->__get(_g1).StaticCast< ::snikket::jingle::Attribute >();
+HXDLIN( 488) _g1 = (_g1 + 1);
+HXDLIN( 488) if ((v->key == HX_("candidate",43,34,d8,d0))) {
+HXLINE( 488) _g->push(v);
+ }
+ }
+ }
+HXDLIN( 488) ::Array< ::Dynamic> _this = _g;
+HXDLIN( 488) ::Array< ::Dynamic> result = ::Array_obj< ::Dynamic>::__new(_this->length);
+HXDLIN( 488) {
+HXLINE( 488) int _g3 = 0;
+HXDLIN( 488) int _g4 = _this->length;
+HXDLIN( 488) while((_g3 < _g4)){
+HXLINE( 488) _g3 = (_g3 + 1);
+HXDLIN( 488) int i = (_g3 - 1);
+HXDLIN( 488) {
+HXLINE( 488) ::snikket::jingle::Attribute attr = ( ( ::snikket::jingle::Attribute)(_hx_array_unsafe_get(_this,i)) );
+HXDLIN( 488) ::snikket::Stanza inValue = ::snikket::jingle::IceCandidate_obj::parse(attr->value,_gthis->mid,( (::String)(ufragPwd->__Field(HX_("ufrag",27,78,a4,a1),::hx::paccDynamic)) ))->toElement();
+HXDLIN( 488) result->__unsafe_set(i,inValue);
+ }
+ }
+ }
+HXDLIN( 488) transport->addChildren(result);
+HXLINE( 489) transport->up();
+HXLINE( 490) return transport;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Media_obj,toTransportElement,return )
+
+ ::snikket::jingle::Media Media_obj::fromElement( ::snikket::Stanza content,bool initiator,bool hasGroup, ::snikket::jingle::SessionDescription existingDescription){
+ HX_GC_STACKFRAME(&_hx_pos_4daf6b6064f97b22_236_fromElement)
+HXLINE( 237) ::Array< ::Dynamic> mediaAttributes = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 238) ::Array< int > mediaFormats = ::Array_obj< int >::__new(0);
+HXLINE( 239) ::String mid = ( (::String)(::Reflect_obj::field(content->attr,HX_("name",4b,72,ff,48))) );
+HXLINE( 240) ::snikket::Stanza transport = content->getChild(HX_("transport",a9,4f,2f,4c),HX_("urn:xmpp:jingle:transports:ice-udp:1",f3,67,4f,53));
+HXLINE( 241) if (::hx::IsNull( transport )) {
+HXLINE( 241) HX_STACK_DO_THROW(HX_("ice-udp transport is missing",08,38,e1,ee));
+ }
+HXLINE( 243) ::String ufrag = ( (::String)(::Reflect_obj::field(transport->attr,HX_("ufrag",27,78,a4,a1))) );
+HXLINE( 244) ::String pwd = ( (::String)(::Reflect_obj::field(transport->attr,HX_("pwd",7d,64,55,00))) );
+HXLINE( 245) bool _hx_tmp;
+HXDLIN( 245) bool _hx_tmp1;
+HXDLIN( 245) if (::hx::IsNotNull( ufrag )) {
+HXLINE( 245) _hx_tmp1 = ::hx::IsNull( pwd );
+ }
+ else {
+HXLINE( 245) _hx_tmp1 = true;
+ }
+HXDLIN( 245) if (_hx_tmp1) {
+HXLINE( 245) _hx_tmp = ::hx::IsNotNull( existingDescription );
+ }
+ else {
+HXLINE( 245) _hx_tmp = false;
+ }
+HXDLIN( 245) if (_hx_tmp) {
+HXLINE( 246) ::Dynamic ufragPwd = existingDescription->getUfragPwd();
+HXLINE( 247) ufrag = ( (::String)(ufragPwd->__Field(HX_("ufrag",27,78,a4,a1),::hx::paccDynamic)) );
+HXLINE( 248) pwd = ( (::String)(ufragPwd->__Field(HX_("pwd",7d,64,55,00),::hx::paccDynamic)) );
+ }
+HXLINE( 250) if (::hx::IsNull( ufrag )) {
+HXLINE( 250) HX_STACK_DO_THROW(HX_("transport is missing ufrag",8e,23,4a,8e));
+ }
+HXLINE( 251) mediaAttributes->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("ice-ufrag",65,c2,31,ab),ufrag));
+HXLINE( 253) if (::hx::IsNull( pwd )) {
+HXLINE( 253) HX_STACK_DO_THROW(HX_("transport is missing pwd",24,98,c9,c0));
+ }
+HXLINE( 254) mediaAttributes->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("ice-pwd",3b,03,2f,e9),pwd));
+HXLINE( 255) mediaAttributes->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("ice-options",1c,09,21,5f),HX_("trickle",cc,89,3d,23)));
+HXLINE( 257) ::snikket::Stanza fingerprint = transport->getChild(HX_("fingerprint",e4,43,63,a3),HX_("urn:xmpp:jingle:apps:dtls:0",a8,cb,02,66));
+HXLINE( 258) if (::hx::IsNull( fingerprint )) {
+HXLINE( 259) if (::hx::IsNotNull( existingDescription )) {
+HXLINE( 260) mediaAttributes->push(existingDescription->getFingerprint());
+ }
+ }
+ else {
+HXLINE( 263) ::String _hx_tmp2 = (( (::String)(::Reflect_obj::field(fingerprint->attr,HX_("hash",ce,2f,08,45))) ) + HX_(" ",20,00,00,00));
+HXDLIN( 263) mediaAttributes->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("fingerprint",e4,43,63,a3),(_hx_tmp2 + fingerprint->getText())));
+HXLINE( 264) if (::hx::IsNotNull( ( (::String)(::Reflect_obj::field(fingerprint->attr,HX_("setup",7d,ae,2f,7a))) ) )) {
+HXLINE( 265) mediaAttributes->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("setup",7d,ae,2f,7a),( (::String)(::Reflect_obj::field(fingerprint->attr,HX_("setup",7d,ae,2f,7a))) )));
+ }
+ }
+HXLINE( 269) ::snikket::Stanza description = content->getChild(HX_("description",fc,08,1d,5f),HX_("urn:xmpp:jingle:apps:rtp:1",ea,41,fe,5c));
+HXLINE( 270) {
+HXLINE( 270) int _g = 0;
+HXDLIN( 270) ::Array< ::Dynamic> _g1 = description->allTags(HX_("payload-type",19,2b,54,39),null());
+HXDLIN( 270) while((_g < _g1->length)){
+HXLINE( 270) ::snikket::Stanza payloadType = _g1->__get(_g).StaticCast< ::snikket::Stanza >();
+HXDLIN( 270) _g = (_g + 1);
+HXLINE( 271) ::Dynamic id = ::Std_obj::parseInt(( (::String)(::Reflect_obj::field(payloadType->attr,HX_("id",db,5b,00,00))) ));
+HXLINE( 272) if (::hx::IsNull( ( (::String)(::Reflect_obj::field(payloadType->attr,HX_("id",db,5b,00,00))) ) )) {
+HXLINE( 272) HX_STACK_DO_THROW(HX_("payload-type missing or invalid id",c0,c4,e7,d7));
+ }
+HXLINE( 273) mediaFormats->push(id);
+HXLINE( 274) ::Dynamic clockRate = ::Std_obj::parseInt(( (::String)(::Reflect_obj::field(payloadType->attr,HX_("clockrate",ae,5b,4b,39))) ));
+HXLINE( 275) ::Dynamic channels = ::Std_obj::parseInt(( (::String)(::Reflect_obj::field(payloadType->attr,HX_("channels",50,aa,ee,6a))) ));
+HXLINE( 276) ::String _hx_tmp3 = (((id + HX_(" ",20,00,00,00)) + ( (::String)(::Reflect_obj::field(payloadType->attr,HX_("name",4b,72,ff,48))) )) + HX_("/",2f,00,00,00));
+HXDLIN( 276) ::Dynamic _hx_tmp4;
+HXDLIN( 276) if (::hx::IsNull( clockRate )) {
+HXLINE( 276) _hx_tmp4 = 0;
+ }
+ else {
+HXLINE( 276) _hx_tmp4 = clockRate;
+ }
+HXDLIN( 276) ::String _hx_tmp5;
+HXDLIN( 276) bool _hx_tmp6;
+HXDLIN( 276) if (::hx::IsNotNull( channels )) {
+HXLINE( 276) _hx_tmp6 = ::hx::IsEq( channels,1 );
+ }
+ else {
+HXLINE( 276) _hx_tmp6 = true;
+ }
+HXDLIN( 276) if (_hx_tmp6) {
+HXLINE( 276) _hx_tmp5 = HX_("",00,00,00,00);
+ }
+ else {
+HXLINE( 276) _hx_tmp5 = (HX_("/",2f,00,00,00) + channels);
+ }
+HXDLIN( 276) mediaAttributes->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("rtpmap",ee,5c,85,a9),((_hx_tmp3 + _hx_tmp4) + _hx_tmp5)));
+HXLINE( 278) ::Array< ::Dynamic> _this = payloadType->allTags(HX_("parameter",a9,35,b0,48),null());
+HXDLIN( 278) ::Array< ::String > result = ::Array_obj< ::String >::__new(_this->length);
+HXDLIN( 278) {
+HXLINE( 278) int _g2 = 0;
+HXDLIN( 278) int _g3 = _this->length;
+HXDLIN( 278) while((_g2 < _g3)){
+HXLINE( 278) _g2 = (_g2 + 1);
+HXDLIN( 278) int i = (_g2 - 1);
+HXDLIN( 278) {
+HXLINE( 278) ::snikket::Stanza el = ( ( ::snikket::Stanza)(_hx_array_unsafe_get(_this,i)) );
+HXDLIN( 278) ::String inValue;
+HXDLIN( 278) if (::hx::IsNull( ( (::String)(::Reflect_obj::field(el->attr,HX_("name",4b,72,ff,48))) ) )) {
+HXLINE( 278) inValue = HX_("",00,00,00,00);
+ }
+ else {
+HXLINE( 278) inValue = (( (::String)(::Reflect_obj::field(el->attr,HX_("name",4b,72,ff,48))) ) + HX_("=",3d,00,00,00));
+ }
+HXDLIN( 278) ::String inValue1 = (inValue + ( (::String)(::Reflect_obj::field(el->attr,HX_("value",71,7f,b8,31))) ));
+HXDLIN( 278) result->__unsafe_set(i,inValue1);
+ }
+ }
+ }
+HXDLIN( 278) ::Array< ::String > parameters = result;
+HXLINE( 279) if ((parameters->length > 0)) {
+HXLINE( 280) mediaAttributes->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("fmtp",83,de,be,43),((id + HX_(" ",20,00,00,00)) + parameters->join(HX_(";",3b,00,00,00)))));
+ }
+HXLINE( 283) {
+HXLINE( 283) int _g4 = 0;
+HXDLIN( 283) ::Array< ::Dynamic> _g5 = payloadType->allTags(HX_("rtcp-fb",1a,8f,ca,30),HX_("urn:xmpp:jingle:apps:rtp:rtcp-fb:0",09,5f,fc,2a));
+HXDLIN( 283) while((_g4 < _g5->length)){
+HXLINE( 283) ::snikket::Stanza feedbackNegotiation = _g5->__get(_g4).StaticCast< ::snikket::Stanza >();
+HXDLIN( 283) _g4 = (_g4 + 1);
+HXLINE( 284) ::String subtype = ( (::String)(::Reflect_obj::field(feedbackNegotiation->attr,HX_("subtype",3a,5c,33,30))) );
+HXLINE( 285) ::String _hx_tmp7 = ((id + HX_(" ",20,00,00,00)) + ( (::String)(::Reflect_obj::field(feedbackNegotiation->attr,HX_("type",ba,f2,08,4d))) ));
+HXDLIN( 285) ::String _hx_tmp8;
+HXDLIN( 285) bool _hx_tmp9;
+HXDLIN( 285) if (::hx::IsNotNull( subtype )) {
+HXLINE( 285) _hx_tmp9 = (subtype == HX_("",00,00,00,00));
+ }
+ else {
+HXLINE( 285) _hx_tmp9 = true;
+ }
+HXDLIN( 285) if (_hx_tmp9) {
+HXLINE( 285) _hx_tmp8 = HX_("",00,00,00,00);
+ }
+ else {
+HXLINE( 285) _hx_tmp8 = (HX_(" ",20,00,00,00) + subtype);
+ }
+HXDLIN( 285) mediaAttributes->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("rtcp-fb",1a,8f,ca,30),(_hx_tmp7 + _hx_tmp8)));
+ }
+ }
+HXLINE( 288) {
+HXLINE( 288) int _g6 = 0;
+HXDLIN( 288) ::Array< ::Dynamic> _g7 = payloadType->allTags(HX_("rtcp-fb-trr-int",a3,02,fa,8c),HX_("urn:xmpp:jingle:apps:rtp:rtcp-fb:0",09,5f,fc,2a));
+HXDLIN( 288) while((_g6 < _g7->length)){
+HXLINE( 288) ::snikket::Stanza trrInt = _g7->__get(_g6).StaticCast< ::snikket::Stanza >();
+HXDLIN( 288) _g6 = (_g6 + 1);
+HXLINE( 289) mediaAttributes->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("rtcp-fb",1a,8f,ca,30),((id + HX_(" trr-int ",6a,39,0a,91)) + ( (::String)(::Reflect_obj::field(trrInt->attr,HX_("value",71,7f,b8,31))) ))));
+ }
+ }
+ }
+ }
+HXLINE( 293) {
+HXLINE( 293) int _g8 = 0;
+HXDLIN( 293) ::Array< ::Dynamic> _g9 = description->allTags(HX_("rtcp-fb",1a,8f,ca,30),HX_("urn:xmpp:jingle:apps:rtp:rtcp-fb:0",09,5f,fc,2a));
+HXDLIN( 293) while((_g8 < _g9->length)){
+HXLINE( 293) ::snikket::Stanza feedbackNegotiation1 = _g9->__get(_g8).StaticCast< ::snikket::Stanza >();
+HXDLIN( 293) _g8 = (_g8 + 1);
+HXLINE( 294) ::String subtype1 = ( (::String)(::Reflect_obj::field(feedbackNegotiation1->attr,HX_("subtype",3a,5c,33,30))) );
+HXLINE( 295) ::String _hx_tmp10 = (HX_("* ",b6,24,00,00) + ( (::String)(::Reflect_obj::field(feedbackNegotiation1->attr,HX_("type",ba,f2,08,4d))) ));
+HXDLIN( 295) ::String _hx_tmp11;
+HXDLIN( 295) bool _hx_tmp12;
+HXDLIN( 295) if (::hx::IsNotNull( subtype1 )) {
+HXLINE( 295) _hx_tmp12 = (subtype1 == HX_("",00,00,00,00));
+ }
+ else {
+HXLINE( 295) _hx_tmp12 = true;
+ }
+HXDLIN( 295) if (_hx_tmp12) {
+HXLINE( 295) _hx_tmp11 = HX_("",00,00,00,00);
+ }
+ else {
+HXLINE( 295) _hx_tmp11 = (HX_(" ",20,00,00,00) + subtype1);
+ }
+HXDLIN( 295) mediaAttributes->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("rtcp-fb",1a,8f,ca,30),(_hx_tmp10 + _hx_tmp11)));
+ }
+ }
+HXLINE( 298) {
+HXLINE( 298) int _g10 = 0;
+HXDLIN( 298) ::Array< ::Dynamic> _g11 = description->allTags(HX_("rtcp-fb-trr-int",a3,02,fa,8c),HX_("urn:xmpp:jingle:apps:rtp:rtcp-fb:0",09,5f,fc,2a));
+HXDLIN( 298) while((_g10 < _g11->length)){
+HXLINE( 298) ::snikket::Stanza trrInt1 = _g11->__get(_g10).StaticCast< ::snikket::Stanza >();
+HXDLIN( 298) _g10 = (_g10 + 1);
+HXLINE( 299) mediaAttributes->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("rtcp-fb",1a,8f,ca,30),(HX_("* trr-int ",00,e4,41,1d) + ( (::String)(::Reflect_obj::field(trrInt1->attr,HX_("value",71,7f,b8,31))) ))));
+ }
+ }
+HXLINE( 302) {
+HXLINE( 302) int _g12 = 0;
+HXDLIN( 302) ::Array< ::Dynamic> _g13 = description->allTags(HX_("rtp-hdrext",aa,ab,bb,00),HX_("urn:xmpp:jingle:apps:rtp:rtp-hdrext:0",c7,33,ab,6d));
+HXDLIN( 302) while((_g12 < _g13->length)){
+HXLINE( 302) ::snikket::Stanza headerExtension = _g13->__get(_g12).StaticCast< ::snikket::Stanza >();
+HXDLIN( 302) _g12 = (_g12 + 1);
+HXLINE( 303) ::String _hx_tmp13 = (( (::String)(::Reflect_obj::field(headerExtension->attr,HX_("id",db,5b,00,00))) ) + HX_(" ",20,00,00,00));
+HXDLIN( 303) mediaAttributes->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("extmap",9b,d8,20,c7),(_hx_tmp13 + ( (::String)(::Reflect_obj::field(headerExtension->attr,HX_("uri",6c,2b,59,00))) ))));
+ }
+ }
+HXLINE( 306) if (::hx::IsNotNull( description->getChild(HX_("extmap-allow-mixed",05,91,99,44),HX_("urn:xmpp:jingle:apps:rtp:rtp-hdrext:0",c7,33,ab,6d)) )) {
+HXLINE( 307) mediaAttributes->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("extmap-allow-mixed",05,91,99,44),HX_("",00,00,00,00)));
+ }
+HXLINE( 310) {
+HXLINE( 310) int _g14 = 0;
+HXDLIN( 310) ::Array< ::Dynamic> _g15 = description->allTags(HX_("ssrc-group",03,b3,2d,49),HX_("urn:xmpp:jingle:apps:rtp:ssma:0",51,23,31,6f));
+HXDLIN( 310) while((_g14 < _g15->length)){
+HXLINE( 310) ::snikket::Stanza sourceGroup = _g15->__get(_g14).StaticCast< ::snikket::Stanza >();
+HXDLIN( 310) _g14 = (_g14 + 1);
+HXLINE( 311) ::String _hx_tmp14 = (( (::String)(::Reflect_obj::field(sourceGroup->attr,HX_("semantics",ad,54,ab,73))) ) + HX_(" ",20,00,00,00));
+HXDLIN( 311) ::Array< ::Dynamic> _this1 = sourceGroup->allTags(HX_("source",db,b0,31,32),null());
+HXDLIN( 311) ::Array< ::String > result1 = ::Array_obj< ::String >::__new(_this1->length);
+HXDLIN( 311) {
+HXLINE( 311) int _g16 = 0;
+HXDLIN( 311) int _g17 = _this1->length;
+HXDLIN( 311) while((_g16 < _g17)){
+HXLINE( 311) _g16 = (_g16 + 1);
+HXDLIN( 311) int i1 = (_g16 - 1);
+HXDLIN( 311) {
+HXLINE( 311) ::String inValue2 = ( (::String)(::Reflect_obj::field(( ( ::snikket::Stanza)(_hx_array_unsafe_get(_this1,i1)) )->attr,HX_("ssrc",51,30,5b,4c))) );
+HXDLIN( 311) result1->__unsafe_set(i1,inValue2);
+ }
+ }
+ }
+HXDLIN( 311) mediaAttributes->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("ssrc-group",03,b3,2d,49),(_hx_tmp14 + result1->join(HX_(" ",20,00,00,00)))));
+ }
+ }
+HXLINE( 314) {
+HXLINE( 314) int _g18 = 0;
+HXDLIN( 314) ::Array< ::Dynamic> _g19 = description->allTags(HX_("source",db,b0,31,32),HX_("urn:xmpp:jingle:apps:rtp:ssma:0",51,23,31,6f));
+HXDLIN( 314) while((_g18 < _g19->length)){
+HXLINE( 314) ::snikket::Stanza source = _g19->__get(_g18).StaticCast< ::snikket::Stanza >();
+HXDLIN( 314) _g18 = (_g18 + 1);
+HXLINE( 315) {
+HXLINE( 315) int _g20 = 0;
+HXDLIN( 315) ::Array< ::Dynamic> _g21 = source->allTags(HX_("parameter",a9,35,b0,48),null());
+HXDLIN( 315) while((_g20 < _g21->length)){
+HXLINE( 315) ::snikket::Stanza parameter = _g21->__get(_g20).StaticCast< ::snikket::Stanza >();
+HXDLIN( 315) _g20 = (_g20 + 1);
+HXLINE( 316) ::String _hx_tmp15 = (( (::String)(::Reflect_obj::field(source->attr,HX_("ssrc",51,30,5b,4c))) ) + HX_(" ",20,00,00,00));
+HXDLIN( 316) ::String _hx_tmp16 = ((_hx_tmp15 + ( (::String)(::Reflect_obj::field(parameter->attr,HX_("name",4b,72,ff,48))) )) + HX_(":",3a,00,00,00));
+HXDLIN( 316) mediaAttributes->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("ssrc",51,30,5b,4c),(_hx_tmp16 + ( (::String)(::Reflect_obj::field(parameter->attr,HX_("value",71,7f,b8,31))) ))));
+ }
+ }
+ }
+ }
+HXLINE( 320) mediaAttributes->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("mid",88,11,53,00),mid));
+HXLINE( 322) {
+HXLINE( 322) ::String _g22 = ( (::String)(::Reflect_obj::field(content->attr,HX_("senders",1e,f7,a9,a8))) );
+HXDLIN( 322) if (::hx::IsNull( _g22 )) {
+HXLINE( 338) mediaAttributes->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("sendrecv",6e,1e,9c,f4),HX_("",00,00,00,00)));
+ }
+ else {
+HXLINE( 322) ::String _hx_switch_0 = _g22;
+ if ( (_hx_switch_0==HX_("initiator",af,ac,ed,3d)) ){
+HXLINE( 326) if (initiator) {
+HXLINE( 327) mediaAttributes->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("sendonly",b4,56,a7,f2),HX_("",00,00,00,00)));
+ }
+ else {
+HXLINE( 329) mediaAttributes->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("recvonly",92,5d,be,b0),HX_("",00,00,00,00)));
+ }
+HXLINE( 326) goto _hx_goto_45;
+ }
+ if ( (_hx_switch_0==HX_("none",b8,12,0a,49)) ){
+HXLINE( 324) mediaAttributes->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("inactive",6b,17,30,6a),HX_("",00,00,00,00)));
+HXDLIN( 324) goto _hx_goto_45;
+ }
+ if ( (_hx_switch_0==HX_("responder",02,a1,00,29)) ){
+HXLINE( 332) if (initiator) {
+HXLINE( 333) mediaAttributes->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("recvonly",92,5d,be,b0),HX_("",00,00,00,00)));
+ }
+ else {
+HXLINE( 335) mediaAttributes->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("sendonly",b4,56,a7,f2),HX_("",00,00,00,00)));
+ }
+HXLINE( 332) goto _hx_goto_45;
+ }
+ /* default */{
+HXLINE( 338) mediaAttributes->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("sendrecv",6e,1e,9c,f4),HX_("",00,00,00,00)));
+ }
+ _hx_goto_45:;
+ }
+ }
+HXLINE( 340) bool _hx_tmp17;
+HXDLIN( 340) if (!(hasGroup)) {
+HXLINE( 340) _hx_tmp17 = ::hx::IsNotNull( description->getChild(HX_("rtcp-mux",72,08,78,80),null()) );
+ }
+ else {
+HXLINE( 340) _hx_tmp17 = true;
+ }
+HXDLIN( 340) if (_hx_tmp17) {
+HXLINE( 341) mediaAttributes->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("rtcp-mux",72,08,78,80),HX_("",00,00,00,00)));
+ }
+HXLINE( 344) if (::hx::IsNotNull( description->getChild(HX_("ice-lite",b0,64,44,1d),null()) )) {
+HXLINE( 345) mediaAttributes->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("ice-lite",b0,64,44,1d),HX_("",00,00,00,00)));
+ }
+HXLINE( 348) mediaAttributes->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("rtcp",ef,ae,b2,4b),HX_("9 IN IP4 0.0.0.0",0f,95,70,bd)));
+HXLINE( 351) ::String _hx_tmp18;
+HXDLIN( 351) if (::hx::IsNull( description )) {
+HXLINE( 351) _hx_tmp18 = HX_("",00,00,00,00);
+ }
+ else {
+HXLINE( 351) _hx_tmp18 = ( (::String)(::Reflect_obj::field(description->attr,HX_("media",e4,04,bc,05))) );
+ }
+HXLINE( 349) return ::snikket::jingle::Media_obj::__alloc( HX_CTX ,mid,_hx_tmp18,HX_("IN IP4 0.0.0.0",08,75,43,c4),HX_("9",39,00,00,00),HX_("UDP/TLS/RTP/SAVPF",1b,15,d1,42),mediaAttributes,mediaFormats);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC4(Media_obj,fromElement,return )
+
+
+::hx::ObjectPtr< Media_obj > Media_obj::__new(::String mid,::String media,::String connectionData,::String port,::String protocol,::Array< ::Dynamic> attributes,::Array< int > formats) {
+ ::hx::ObjectPtr< Media_obj > __this = new Media_obj();
+ __this->__construct(mid,media,connectionData,port,protocol,attributes,formats);
+ return __this;
+}
+
+::hx::ObjectPtr< Media_obj > Media_obj::__alloc(::hx::Ctx *_hx_ctx,::String mid,::String media,::String connectionData,::String port,::String protocol,::Array< ::Dynamic> attributes,::Array< int > formats) {
+ Media_obj *__this = (Media_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Media_obj), true, "snikket.jingle.Media"));
+ *(void **)__this = Media_obj::_hx_vtable;
+ __this->__construct(mid,media,connectionData,port,protocol,attributes,formats);
+ return __this;
+}
+
+Media_obj::Media_obj()
+{
+}
+
+void Media_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(Media);
+ HX_MARK_MEMBER_NAME(mid,"mid");
+ HX_MARK_MEMBER_NAME(media,"media");
+ HX_MARK_MEMBER_NAME(connectionData,"connectionData");
+ HX_MARK_MEMBER_NAME(port,"port");
+ HX_MARK_MEMBER_NAME(protocol,"protocol");
+ HX_MARK_MEMBER_NAME(attributes,"attributes");
+ HX_MARK_MEMBER_NAME(formats,"formats");
+ HX_MARK_END_CLASS();
+}
+
+void Media_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(mid,"mid");
+ HX_VISIT_MEMBER_NAME(media,"media");
+ HX_VISIT_MEMBER_NAME(connectionData,"connectionData");
+ HX_VISIT_MEMBER_NAME(port,"port");
+ HX_VISIT_MEMBER_NAME(protocol,"protocol");
+ HX_VISIT_MEMBER_NAME(attributes,"attributes");
+ HX_VISIT_MEMBER_NAME(formats,"formats");
+}
+
+::hx::Val Media_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"mid") ) { return ::hx::Val( mid ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"port") ) { return ::hx::Val( port ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"media") ) { return ::hx::Val( media ); }
+ if (HX_FIELD_EQ(inName,"toSdp") ) { return ::hx::Val( toSdp_dyn() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"formats") ) { return ::hx::Val( formats ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"protocol") ) { return ::hx::Val( protocol ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"toElement") ) { return ::hx::Val( toElement_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"attributes") ) { return ::hx::Val( attributes ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"getUfragPwd") ) { return ::hx::Val( getUfragPwd_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"connectionData") ) { return ::hx::Val( connectionData ); }
+ if (HX_FIELD_EQ(inName,"contentElement") ) { return ::hx::Val( contentElement_dyn() ); }
+ break;
+ case 18:
+ if (HX_FIELD_EQ(inName,"toTransportElement") ) { return ::hx::Val( toTransportElement_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool Media_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 11:
+ if (HX_FIELD_EQ(inName,"fromElement") ) { outValue = fromElement_dyn(); return true; }
+ }
+ return false;
+}
+
+::hx::Val Media_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"mid") ) { mid=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"port") ) { port=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"media") ) { media=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"formats") ) { formats=inValue.Cast< ::Array< int > >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"protocol") ) { protocol=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"attributes") ) { attributes=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"connectionData") ) { connectionData=inValue.Cast< ::String >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void Media_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("mid",88,11,53,00));
+ outFields->push(HX_("media",e4,04,bc,05));
+ outFields->push(HX_("connectionData",68,89,24,76));
+ outFields->push(HX_("port",81,83,5c,4a));
+ outFields->push(HX_("protocol",58,56,63,00));
+ outFields->push(HX_("attributes",d7,a8,71,97));
+ outFields->push(HX_("formats",5c,c1,2e,df));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Media_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(Media_obj,mid),HX_("mid",88,11,53,00)},
+ {::hx::fsString,(int)offsetof(Media_obj,media),HX_("media",e4,04,bc,05)},
+ {::hx::fsString,(int)offsetof(Media_obj,connectionData),HX_("connectionData",68,89,24,76)},
+ {::hx::fsString,(int)offsetof(Media_obj,port),HX_("port",81,83,5c,4a)},
+ {::hx::fsString,(int)offsetof(Media_obj,protocol),HX_("protocol",58,56,63,00)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(Media_obj,attributes),HX_("attributes",d7,a8,71,97)},
+ {::hx::fsObject /* ::Array< int > */ ,(int)offsetof(Media_obj,formats),HX_("formats",5c,c1,2e,df)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *Media_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Media_obj_sMemberFields[] = {
+ HX_("mid",88,11,53,00),
+ HX_("media",e4,04,bc,05),
+ HX_("connectionData",68,89,24,76),
+ HX_("port",81,83,5c,4a),
+ HX_("protocol",58,56,63,00),
+ HX_("attributes",d7,a8,71,97),
+ HX_("formats",5c,c1,2e,df),
+ HX_("toSdp",04,4c,19,14),
+ HX_("contentElement",83,52,25,6c),
+ HX_("toElement",81,e6,e8,35),
+ HX_("getUfragPwd",4c,b9,6e,8e),
+ HX_("toTransportElement",ae,e5,d6,85),
+ ::String(null()) };
+
+::hx::Class Media_obj::__mClass;
+
+static ::String Media_obj_sStaticFields[] = {
+ HX_("fromElement",72,12,95,9e),
+ ::String(null())
+};
+
+void Media_obj::__register()
+{
+ Media_obj _hx_dummy;
+ Media_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.jingle.Media",58,22,74,53);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Media_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Media_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Media_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Media_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Media_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Media_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace jingle
diff --git a/Sources/c_snikket/src/snikket/jingle/MediaStream.cpp b/Sources/c_snikket/src/snikket/jingle/MediaStream.cpp
new file mode 100644
index 0000000..b81f97a
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/jingle/MediaStream.cpp
@@ -0,0 +1,266 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_31a7389c9269a947
+#define INCLUDED_31a7389c9269a947
+#include "hx/StdString.h"
+#endif
+#ifndef INCLUDED_0e487a29b6aa8a9b
+#define INCLUDED_0e487a29b6aa8a9b
+#include "rtc/rtc.hpp"
+#endif
+#ifndef INCLUDED__HaxeCBridge_Internal
+#include <_HaxeCBridge/Internal.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_IntMap
+#include <haxe/ds/IntMap.h>
+#endif
+#ifndef INCLUDED_snikket_ID
+#include <snikket/ID.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_MediaStream
+#include <snikket/jingle/MediaStream.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_MediaStreamTrack
+#include <snikket/jingle/MediaStreamTrack.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_73a4884454ac5ac3_626_new,"snikket.jingle.MediaStream","new",0xfb2579ea,"snikket.jingle.MediaStream.new","snikket/jingle/PeerConnection.cpp.hx",626,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_73a4884454ac5ac3_646_addTrack,"snikket.jingle.MediaStream","addTrack",0x3c4636e0,"snikket.jingle.MediaStream.addTrack","snikket/jingle/PeerConnection.cpp.hx",646,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_73a4884454ac5ac3_650_getTracks,"snikket.jingle.MediaStream","getTracks",0x455c21c8,"snikket.jingle.MediaStream.getTracks","snikket/jingle/PeerConnection.cpp.hx",650,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_fa9a1f555469415a_242_getTracks__fromC,"snikket.jingle.MediaStream","getTracks__fromC",0xff2f97b1,"snikket.jingle.MediaStream.getTracks__fromC","HaxeCBridge.hx",242,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_73a4884454ac5ac3_631_makeAudio,"snikket.jingle.MediaStream","makeAudio",0x7ea15d12,"snikket.jingle.MediaStream.makeAudio","snikket/jingle/PeerConnection.cpp.hx",631,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_73a4884454ac5ac3_625_boot,"snikket.jingle.MediaStream","boot",0xbdbe3368,"snikket.jingle.MediaStream.boot","snikket/jingle/PeerConnection.cpp.hx",625,0xf9fab71d)
+namespace snikket{
+namespace jingle{
+
+void MediaStream_obj::__construct(){
+ HX_STACKFRAME(&_hx_pos_73a4884454ac5ac3_626_new)
+HXDLIN( 626) this->tracks = ::Array_obj< ::Dynamic>::__new(0);
+ }
+
+Dynamic MediaStream_obj::__CreateEmpty() { return new MediaStream_obj; }
+
+void *MediaStream_obj::_hx_vtable = 0;
+
+Dynamic MediaStream_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< MediaStream_obj > _hx_result = new MediaStream_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool MediaStream_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x1cdfd2fe;
+}
+
+void MediaStream_obj::addTrack( ::snikket::jingle::MediaStreamTrack track){
+ HX_STACKFRAME(&_hx_pos_73a4884454ac5ac3_646_addTrack)
+HXDLIN( 646) this->tracks->push(track);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(MediaStream_obj,addTrack,(void))
+
+::Array< ::Dynamic> MediaStream_obj::getTracks(){
+ HX_STACKFRAME(&_hx_pos_73a4884454ac5ac3_650_getTracks)
+HXDLIN( 650) return this->tracks;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(MediaStream_obj,getTracks,return )
+
+size_t MediaStream_obj::getTracks__fromC(void*** outPtr){
+ HX_GC_STACKFRAME(&_hx_pos_fa9a1f555469415a_242_getTracks__fromC)
+HXDLIN( 242) ::Array< ::Dynamic> out = this->getTracks();
+HXDLIN( 242) if (::hx::IsNotNull( outPtr )) {
+HXDLIN( 242) ::cpp::Pointer< void** > _hx_tmp = ::cpp::Pointer_obj::fromRaw(outPtr);
+HXDLIN( 242) {
+HXDLIN( 242) int _g = 0;
+HXDLIN( 242) while((_g < out->length)){
+HXDLIN( 242) ::snikket::jingle::MediaStreamTrack el = out->__get(_g).StaticCast< ::snikket::jingle::MediaStreamTrack >();
+HXDLIN( 242) _g = (_g + 1);
+HXDLIN( 242) {
+HXDLIN( 242) ::Dynamic haxeObject = el;
+HXDLIN( 242) void* ptr = haxeObject.mPtr;
+HXDLIN( 242) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(ptr);
+HXDLIN( 242) {
+HXDLIN( 242) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 242) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 242) int high = ptrInt64 >> 32;
+HXDLIN( 242) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 242) if (::hx::IsNull( highMap )) {
+HXDLIN( 242) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 242) this1->set(low,highMap);
+ }
+HXDLIN( 242) highMap->set(high,haxeObject);
+ }
+ }
+ }
+ }
+HXDLIN( 242) void** ptr1 = (void**)out->getBase();
+HXDLIN( 242) ::cpp::Int64 ptrInt641 = reinterpret_cast<int64_t>(ptr1);
+HXDLIN( 242) {
+HXDLIN( 242) ::haxe::ds::IntMap this2 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 242) int low1 = ptrInt641 & 0xffffffff;
+HXDLIN( 242) int high1 = ptrInt641 >> 32;
+HXDLIN( 242) ::haxe::ds::IntMap highMap1 = ( ( ::haxe::ds::IntMap)(this2->get(low1)) );
+HXDLIN( 242) if (::hx::IsNull( highMap1 )) {
+HXDLIN( 242) highMap1 = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 242) this2->set(low1,highMap1);
+ }
+HXDLIN( 242) highMap1->set(high1,out);
+ }
+HXDLIN( 242) _hx_tmp->set_ref(ptr1);
+ }
+HXDLIN( 242) return ( (size_t)(out->length) );
+ }
+
+
+ ::snikket::jingle::MediaStream MediaStream_obj::makeAudio(){
+ HX_GC_STACKFRAME(&_hx_pos_73a4884454ac5ac3_631_makeAudio)
+HXLINE( 632) rtc::Description::Audio audio = rtc::Description::Audio(::hx::StdString(::snikket::ID_obj::tiny()),cpp::Struct(rtc::Description::Direction::SendRecv));
+HXLINE( 633) audio.addOpusCodec(107);
+HXLINE( 634) audio.addPCMUCodec(0);
+HXLINE( 635) audio.addAudioCodec(101,::hx::StdString(HX_("telephone-event/8000",36,ae,10,93)));
+HXLINE( 636) ::snikket::jingle::MediaStreamTrack media = ::snikket::jingle::MediaStreamTrack_obj::__alloc( HX_CTX );
+HXLINE( 637) media->media = std::optional< rtc::Description::Media >(audio);
+HXLINE( 638) ::snikket::jingle::MediaStream stream = ::snikket::jingle::MediaStream_obj::__alloc( HX_CTX );
+HXLINE( 639) stream->addTrack(media);
+HXLINE( 640) return stream;
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC0(MediaStream_obj,makeAudio,return )
+
+
+::hx::ObjectPtr< MediaStream_obj > MediaStream_obj::__new() {
+ ::hx::ObjectPtr< MediaStream_obj > __this = new MediaStream_obj();
+ __this->__construct();
+ return __this;
+}
+
+::hx::ObjectPtr< MediaStream_obj > MediaStream_obj::__alloc(::hx::Ctx *_hx_ctx) {
+ MediaStream_obj *__this = (MediaStream_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(MediaStream_obj), true, "snikket.jingle.MediaStream"));
+ *(void **)__this = MediaStream_obj::_hx_vtable;
+ __this->__construct();
+ return __this;
+}
+
+MediaStream_obj::MediaStream_obj()
+{
+}
+
+void MediaStream_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(MediaStream);
+ HX_MARK_MEMBER_NAME(tracks,"tracks");
+ HX_MARK_END_CLASS();
+}
+
+void MediaStream_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(tracks,"tracks");
+}
+
+::hx::Val MediaStream_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 6:
+ if (HX_FIELD_EQ(inName,"tracks") ) { return ::hx::Val( tracks ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"addTrack") ) { return ::hx::Val( addTrack_dyn() ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"getTracks") ) { return ::hx::Val( getTracks_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool MediaStream_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 9:
+ if (HX_FIELD_EQ(inName,"makeAudio") ) { outValue = makeAudio_dyn(); return true; }
+ }
+ return false;
+}
+
+::hx::Val MediaStream_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 6:
+ if (HX_FIELD_EQ(inName,"tracks") ) { tracks=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void MediaStream_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("tracks",88,2b,7d,45));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo MediaStream_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(MediaStream_obj,tracks),HX_("tracks",88,2b,7d,45)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *MediaStream_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String MediaStream_obj_sMemberFields[] = {
+ HX_("tracks",88,2b,7d,45),
+ HX_("addTrack",aa,b4,7c,8f),
+ HX_("getTracks",be,b4,d3,c1),
+ ::String(null()) };
+
+::hx::Class MediaStream_obj::__mClass;
+
+static ::String MediaStream_obj_sStaticFields[] = {
+ HX_("makeAudio",08,f0,18,fb),
+ ::String(null())
+};
+
+void MediaStream_obj::__register()
+{
+ MediaStream_obj _hx_dummy;
+ MediaStream_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.jingle.MediaStream",f8,fc,5b,cd);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &MediaStream_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(MediaStream_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(MediaStream_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< MediaStream_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = MediaStream_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = MediaStream_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void MediaStream_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_73a4884454ac5ac3_625_boot)
+HXDLIN( 625) __mClass->__meta__ = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("fields",79,8e,8e,80), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("getTracks",be,b4,d3,c1), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(1,HX_("getTracks__fromC",7b,ef,27,cb), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null()))))));
+ }
+}
+
+} // end namespace snikket
+} // end namespace jingle
diff --git a/Sources/c_snikket/src/snikket/jingle/MediaStreamTrack.cpp b/Sources/c_snikket/src/snikket/jingle/MediaStreamTrack.cpp
new file mode 100644
index 0000000..3187a92
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/jingle/MediaStreamTrack.cpp
@@ -0,0 +1,1115 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_f561c66e4c8ac38c
+#define INCLUDED_f561c66e4c8ac38c
+#include "fstream"
+#endif
+#ifndef INCLUDED_31a7389c9269a947
+#define INCLUDED_31a7389c9269a947
+#include "hx/StdString.h"
+#endif
+#ifndef INCLUDED_95f339a1d026d52c
+#define INCLUDED_95f339a1d026d52c
+#include "hxMath.h"
+#endif
+#ifndef INCLUDED_c2bfbc5a172f2993
+#define INCLUDED_c2bfbc5a172f2993
+#include "opus.h"
+#endif
+#ifndef INCLUDED_639eed8ef5b51d52
+#define INCLUDED_639eed8ef5b51d52
+#include "rtc/frameinfo.hpp"
+#endif
+#ifndef INCLUDED_0e487a29b6aa8a9b
+#define INCLUDED_0e487a29b6aa8a9b
+#include "rtc/rtc.hpp"
+#endif
+#ifndef INCLUDED_Lambda
+#include <Lambda.h>
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED__HaxeCBridge_Internal
+#include <_HaxeCBridge/Internal.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_Log
+#include <haxe/Log.h>
+#endif
+#ifndef INCLUDED_haxe_Timer
+#include <haxe/Timer.h>
+#endif
+#ifndef INCLUDED_haxe_ds_IntMap
+#include <haxe/ds/IntMap.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_AudioFormat
+#include <snikket/jingle/AudioFormat.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_MediaStreamTrack
+#include <snikket/jingle/MediaStreamTrack.h>
+#endif
+#ifndef INCLUDED_sys_thread_EventLoop
+#include <sys/thread/EventLoop.h>
+#endif
+#ifndef INCLUDED_sys_thread_Mutex
+#include <sys/thread/Mutex.h>
+#endif
+#ifndef INCLUDED_sys_thread__Thread_HaxeThread
+#include <sys/thread/_Thread/HaxeThread.h>
+#endif
+#ifndef INCLUDED_sys_thread__Thread_Thread_Impl_
+#include <sys/thread/_Thread/Thread_Impl_.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_199cfc803453bfcf_371_new,"snikket.jingle.MediaStreamTrack","new",0x86a854e5,"snikket.jingle.MediaStreamTrack.new","snikket/jingle/PeerConnection.cpp.hx",371,0xf9fab71d)
+HX_DEFINE_STACK_FRAME(_hx_pos_199cfc803453bfcf_375_new,"snikket.jingle.MediaStreamTrack","new",0x86a854e5,"snikket.jingle.MediaStreamTrack.new","snikket/jingle/PeerConnection.cpp.hx",375,0xf9fab71d)
+HX_DEFINE_STACK_FRAME(_hx_pos_199cfc803453bfcf_337_new,"snikket.jingle.MediaStreamTrack","new",0x86a854e5,"snikket.jingle.MediaStreamTrack.new","snikket/jingle/PeerConnection.cpp.hx",337,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_6a2465e57550c9c8_271_id__fromC,"snikket.jingle.MediaStreamTrack","id__fromC",0xf6db4c43,"snikket.jingle.MediaStreamTrack.id__fromC","HaxeCBridge.hx",271,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_6a2465e57550c9c8_271_muted__fromC,"snikket.jingle.MediaStreamTrack","muted__fromC",0x6371b749,"snikket.jingle.MediaStreamTrack.muted__fromC","HaxeCBridge.hx",271,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_6a2465e57550c9c8_271_kind__fromC,"snikket.jingle.MediaStreamTrack","kind__fromC",0x33c2332a,"snikket.jingle.MediaStreamTrack.kind__fromC","HaxeCBridge.hx",271,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_6a2465e57550c9c8_260_supportedAudioFormats__fromC,"snikket.jingle.MediaStreamTrack","supportedAudioFormats__fromC",0xed795960,"snikket.jingle.MediaStreamTrack.supportedAudioFormats__fromC","HaxeCBridge.hx",260,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_199cfc803453bfcf_398_get_media,"snikket.jingle.MediaStreamTrack","get_media",0xf29b9780,"snikket.jingle.MediaStreamTrack.get_media","snikket/jingle/PeerConnection.cpp.hx",398,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_199cfc803453bfcf_406_get_id,"snikket.jingle.MediaStreamTrack","get_id",0x616f4fbf,"snikket.jingle.MediaStreamTrack.get_id","snikket/jingle/PeerConnection.cpp.hx",406,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_199cfc803453bfcf_413_get_kind,"snikket.jingle.MediaStreamTrack","get_kind",0x19089638,"snikket.jingle.MediaStreamTrack.get_kind","snikket/jingle/PeerConnection.cpp.hx",413,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_199cfc803453bfcf_414_get_muted,"snikket.jingle.MediaStreamTrack","get_muted",0xfd3b2207,"snikket.jingle.MediaStreamTrack.get_muted","snikket/jingle/PeerConnection.cpp.hx",414,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_199cfc803453bfcf_416_get_supportedAudioFormats,"snikket.jingle.MediaStreamTrack","get_supportedAudioFormats",0xd0250110,"snikket.jingle.MediaStreamTrack.get_supportedAudioFormats","snikket/jingle/PeerConnection.cpp.hx",416,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_199cfc803453bfcf_434_set_track,"snikket.jingle.MediaStreamTrack","set_track",0xe6500d33,"snikket.jingle.MediaStreamTrack.set_track","snikket/jingle/PeerConnection.cpp.hx",434,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_199cfc803453bfcf_467_addPCMListener,"snikket.jingle.MediaStreamTrack","addPCMListener",0xde4994a8,"snikket.jingle.MediaStreamTrack.addPCMListener","snikket/jingle/PeerConnection.cpp.hx",467,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_6a2465e57550c9c8_221_addPCMListener__fromC,"snikket.jingle.MediaStreamTrack","addPCMListener__fromC",0x90d840d1,"snikket.jingle.MediaStreamTrack.addPCMListener__fromC","HaxeCBridge.hx",221,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_6a2465e57550c9c8_244_addPCMListener__fromC,"snikket.jingle.MediaStreamTrack","addPCMListener__fromC",0x90d840d1,"snikket.jingle.MediaStreamTrack.addPCMListener__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_199cfc803453bfcf_492_onFrame,"snikket.jingle.MediaStreamTrack","onFrame",0x55f2c193,"snikket.jingle.MediaStreamTrack.onFrame","snikket/jingle/PeerConnection.cpp.hx",492,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_199cfc803453bfcf_521_addReadyForPCMListener,"snikket.jingle.MediaStreamTrack","addReadyForPCMListener",0x339e25e2,"snikket.jingle.MediaStreamTrack.addReadyForPCMListener","snikket/jingle/PeerConnection.cpp.hx",521,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_6a2465e57550c9c8_221_addReadyForPCMListener__fromC,"snikket.jingle.MediaStreamTrack","addReadyForPCMListener__fromC",0xd615aad7,"snikket.jingle.MediaStreamTrack.addReadyForPCMListener__fromC","HaxeCBridge.hx",221,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_6a2465e57550c9c8_244_addReadyForPCMListener__fromC,"snikket.jingle.MediaStreamTrack","addReadyForPCMListener__fromC",0xd615aad7,"snikket.jingle.MediaStreamTrack.addReadyForPCMListener__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_199cfc803453bfcf_528_notifyReadyForData,"snikket.jingle.MediaStreamTrack","notifyReadyForData",0x61f3b534,"snikket.jingle.MediaStreamTrack.notifyReadyForData","snikket/jingle/PeerConnection.cpp.hx",528,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_199cfc803453bfcf_532_notifyReadyForData,"snikket.jingle.MediaStreamTrack","notifyReadyForData",0x61f3b534,"snikket.jingle.MediaStreamTrack.notifyReadyForData","snikket/jingle/PeerConnection.cpp.hx",532,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_199cfc803453bfcf_552_writePCM,"snikket.jingle.MediaStreamTrack","writePCM",0x763990d6,"snikket.jingle.MediaStreamTrack.writePCM","snikket/jingle/PeerConnection.cpp.hx",552,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_199cfc803453bfcf_554_writePCM,"snikket.jingle.MediaStreamTrack","writePCM",0x763990d6,"snikket.jingle.MediaStreamTrack.writePCM","snikket/jingle/PeerConnection.cpp.hx",554,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_199cfc803453bfcf_551_writePCM,"snikket.jingle.MediaStreamTrack","writePCM",0x763990d6,"snikket.jingle.MediaStreamTrack.writePCM","snikket/jingle/PeerConnection.cpp.hx",551,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_6a2465e57550c9c8_244_writePCM__fromC,"snikket.jingle.MediaStreamTrack","writePCM__fromC",0x54304663,"snikket.jingle.MediaStreamTrack.writePCM__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_199cfc803453bfcf_591_onAudioLoop,"snikket.jingle.MediaStreamTrack","onAudioLoop",0x959462c0,"snikket.jingle.MediaStreamTrack.onAudioLoop","snikket/jingle/PeerConnection.cpp.hx",591,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_199cfc803453bfcf_595_write,"snikket.jingle.MediaStreamTrack","write",0xf83bdca4,"snikket.jingle.MediaStreamTrack.write","snikket/jingle/PeerConnection.cpp.hx",595,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_199cfc803453bfcf_607_advanceTimestamp,"snikket.jingle.MediaStreamTrack","advanceTimestamp",0xa8dad84f,"snikket.jingle.MediaStreamTrack.advanceTimestamp","snikket/jingle/PeerConnection.cpp.hx",607,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_199cfc803453bfcf_610_stop,"snikket.jingle.MediaStreamTrack","stop",0x4ffb5fdd,"snikket.jingle.MediaStreamTrack.stop","snikket/jingle/PeerConnection.cpp.hx",610,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_199cfc803453bfcf_362_fromTrack,"snikket.jingle.MediaStreamTrack","fromTrack",0x73deaf06,"snikket.jingle.MediaStreamTrack.fromTrack","snikket/jingle/PeerConnection.cpp.hx",362,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_199cfc803453bfcf_473_pcmToUlaw,"snikket.jingle.MediaStreamTrack","pcmToUlaw",0x7deff727,"snikket.jingle.MediaStreamTrack.pcmToUlaw","snikket/jingle/PeerConnection.cpp.hx",473,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_199cfc803453bfcf_337_boot,"snikket.jingle.MediaStreamTrack","boot",0x44baf40d,"snikket.jingle.MediaStreamTrack.boot","snikket/jingle/PeerConnection.cpp.hx",337,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_199cfc803453bfcf_470_boot,"snikket.jingle.MediaStreamTrack","boot",0x44baf40d,"snikket.jingle.MediaStreamTrack.boot","snikket/jingle/PeerConnection.cpp.hx",470,0xf9fab71d)
+static const short _hx_array_data_a980fe73_39[] = {
+ (short)-32124,(short)-31100,(short)-30076,(short)-29052,(short)-28028,(short)-27004,(short)-25980,(short)-24956,(short)-23932,(short)-22908,(short)-21884,(short)-20860,(short)-19836,(short)-18812,(short)-17788,(short)-16764,(short)-15996,(short)-15484,(short)-14972,(short)-14460,(short)-13948,(short)-13436,(short)-12924,(short)-12412,(short)-11900,(short)-11388,(short)-10876,(short)-10364,(short)-9852,(short)-9340,(short)-8828,(short)-8316,(short)-7932,(short)-7676,(short)-7420,(short)-7164,(short)-6908,(short)-6652,(short)-6396,(short)-6140,(short)-5884,(short)-5628,(short)-5372,(short)-5116,(short)-4860,(short)-4604,(short)-4348,(short)-4092,(short)-3900,(short)-3772,(short)-3644,(short)-3516,(short)-3388,(short)-3260,(short)-3132,(short)-3004,(short)-2876,(short)-2748,(short)-2620,(short)-2492,(short)-2364,(short)-2236,(short)-2108,(short)-1980,(short)-1884,(short)-1820,(short)-1756,(short)-1692,(short)-1628,(short)-1564,(short)-1500,(short)-1436,(short)-1372,(short)-1308,(short)-1244,(short)-1180,(short)-1116,(short)-1052,(short)-988,(short)-924,(short)-876,(short)-844,(short)-812,(short)-780,(short)-748,(short)-716,(short)-684,(short)-652,(short)-620,(short)-588,(short)-556,(short)-524,(short)-492,(short)-460,(short)-428,(short)-396,(short)-372,(short)-356,(short)-340,(short)-324,(short)-308,(short)-292,(short)-276,(short)-260,(short)-244,(short)-228,(short)-212,(short)-196,(short)-180,(short)-164,(short)-148,(short)-132,(short)-120,(short)-112,(short)-104,(short)-96,(short)-88,(short)-80,(short)-72,(short)-64,(short)-56,(short)-48,(short)-40,(short)-32,(short)-24,(short)-16,(short)-8,(short)0,(short)32124,(short)31100,(short)30076,(short)29052,(short)28028,(short)27004,(short)25980,(short)24956,(short)23932,(short)22908,(short)21884,(short)20860,(short)19836,(short)18812,(short)17788,(short)16764,(short)15996,(short)15484,(short)14972,(short)14460,(short)13948,(short)13436,(short)12924,(short)12412,(short)11900,(short)11388,(short)10876,(short)10364,(short)9852,(short)9340,(short)8828,(short)8316,(short)7932,(short)7676,(short)7420,(short)7164,(short)6908,(short)6652,(short)6396,(short)6140,(short)5884,(short)5628,(short)5372,(short)5116,(short)4860,(short)4604,(short)4348,(short)4092,(short)3900,(short)3772,(short)3644,(short)3516,(short)3388,(short)3260,(short)3132,(short)3004,(short)2876,(short)2748,(short)2620,(short)2492,(short)2364,(short)2236,(short)2108,(short)1980,(short)1884,(short)1820,(short)1756,(short)1692,(short)1628,(short)1564,(short)1500,(short)1436,(short)1372,(short)1308,(short)1244,(short)1180,(short)1116,(short)1052,(short)988,(short)924,(short)876,(short)844,(short)812,(short)780,(short)748,(short)716,(short)684,(short)652,(short)620,(short)588,(short)556,(short)524,(short)492,(short)460,(short)428,(short)396,(short)372,(short)356,(short)340,(short)324,(short)308,(short)292,(short)276,(short)260,(short)244,(short)228,(short)212,(short)196,(short)180,(short)164,(short)148,(short)132,(short)120,(short)112,(short)104,(short)96,(short)88,(short)80,(short)72,(short)64,(short)56,(short)48,(short)40,(short)32,(short)24,(short)16,(short)8,(short)0,
+};
+HX_LOCAL_STACK_FRAME(_hx_pos_199cfc803453bfcf_471_boot,"snikket.jingle.MediaStreamTrack","boot",0x44baf40d,"snikket.jingle.MediaStreamTrack.boot","snikket/jingle/PeerConnection.cpp.hx",471,0xf9fab71d)
+static const unsigned char _hx_array_data_a980fe73_41[] = {
+ (unsigned char)0,(unsigned char)1,(unsigned char)2,(unsigned char)2,(unsigned char)3,(unsigned char)3,(unsigned char)3,(unsigned char)3,(unsigned char)4,(unsigned char)4,(unsigned char)4,(unsigned char)4,(unsigned char)4,(unsigned char)4,(unsigned char)4,(unsigned char)4,(unsigned char)5,(unsigned char)5,(unsigned char)5,(unsigned char)5,(unsigned char)5,(unsigned char)5,(unsigned char)5,(unsigned char)5,(unsigned char)5,(unsigned char)5,(unsigned char)5,(unsigned char)5,(unsigned char)5,(unsigned char)5,(unsigned char)5,(unsigned char)5,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)6,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,(unsigned char)7,
+};
+namespace snikket{
+namespace jingle{
+
+void MediaStreamTrack_obj::__construct(){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::jingle::MediaStreamTrack,_gthis) HXARGC(0)
+ void _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_199cfc803453bfcf_371_new)
+HXLINE( 371) while(_gthis->alive){
+HXLINE( 371) ::sys::thread::_Thread::Thread_Impl__obj::processEvents();
+HXDLIN( 371) ::sys::thread::_Thread::Thread_Impl__obj::get_events(::sys::thread::_Thread::HaxeThread_obj::current())->wait(null());
+ }
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_1, ::snikket::jingle::MediaStreamTrack,_gthis) HXARGC(0)
+ void _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_199cfc803453bfcf_375_new)
+HXLINE( 376) _gthis->mutex->acquire();
+HXLINE( 377) if (!_gthis->track) {
+HXLINE( 378) _gthis->mutex->release();
+HXLINE( 379) return;
+ }
+HXLINE( 381) bool _hx_tmp;
+HXDLIN( 381) if (_gthis->alive) {
+HXLINE( 381) _hx_tmp = !(_gthis->track->isOpen());
+ }
+ else {
+HXLINE( 381) _hx_tmp = true;
+ }
+HXDLIN( 381) if (_hx_tmp) {
+HXLINE( 382) _gthis->mutex->release();
+HXLINE( 383) return;
+ }
+HXLINE( 385) bool _hx_tmp1;
+HXDLIN( 385) if ((_gthis->audioQ->length > 0)) {
+HXLINE( 385) Float _gthis1 = ( (Float)(_gthis->audioQ->__get((_gthis->audioQ->length - 1))->__Field(HX_("stamp",03,70,0b,84),::hx::paccDynamic)) );
+HXDLIN( 385) _hx_tmp1 = (_gthis1 <= ::__time_stamp());
+ }
+ else {
+HXLINE( 385) _hx_tmp1 = false;
+ }
+HXDLIN( 385) if (_hx_tmp1) {
+HXLINE( 386) ::Dynamic packet = _gthis->audioQ->pop();
+HXLINE( 387) _gthis->write(( (::Array< unsigned char >)(packet->__Field(HX_("payload",8e,bf,35,ed),::hx::paccDynamic)) ),( (unsigned char)(packet->__Field(HX_("payloadType",68,bd,49,af),::hx::paccDynamic)) ),( (int)(packet->__Field(HX_("clockRate",ce,87,24,24),::hx::paccDynamic)) ));
+HXLINE( 388) ::snikket::jingle::MediaStreamTrack _gthis2 = _gthis;
+HXDLIN( 388) _gthis2->advanceTimestamp(::Std_obj::_hx_int((( (Float)(( (::Array< unsigned char >)(packet->__Field(HX_("payload",8e,bf,35,ed),::hx::paccDynamic)) )->length) ) / ( (Float)(packet->__Field(HX_("channels",50,aa,ee,6a),::hx::paccDynamic)) ))));
+ }
+HXLINE( 390) bool _hx_tmp2;
+HXDLIN( 390) if (_gthis->waitForQ) {
+HXLINE( 390) _hx_tmp2 = (_gthis->audioQ->length < (50 + (( (Float)(50) ) * _gthis->bufferSizeInSeconds)));
+ }
+ else {
+HXLINE( 390) _hx_tmp2 = false;
+ }
+HXDLIN( 390) if (_hx_tmp2) {
+HXLINE( 391) _gthis->waitForQ = false;
+HXLINE( 392) _gthis->notifyReadyForData(false);
+ }
+HXLINE( 394) _gthis->mutex->release();
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_199cfc803453bfcf_337_new)
+HXLINE( 353) this->mutex = ::sys::thread::Mutex_obj::__alloc( HX_CTX );
+HXLINE( 352) this->bufferSizeInSeconds = ((Float)0.0);
+HXLINE( 351) this->waitForQ = false;
+HXLINE( 350) this->alive = true;
+HXLINE( 349) this->audioQ = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 343) this->readyForPCMCallback = null();
+HXLINE( 342) this->pcmCallback = null();
+HXLINE( 369) ::snikket::jingle::MediaStreamTrack _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 370) this->eventLoop = ::sys::thread::_Thread::Thread_Impl__obj::get_events(::sys::thread::_Thread::HaxeThread_obj::create( ::Dynamic(new _hx_Closure_0(_gthis)),true));
+HXLINE( 374) this->timer = ::haxe::Timer_obj::__alloc( HX_CTX ,10);
+HXLINE( 375) this->timer->run = ::Dynamic(new _hx_Closure_1(_gthis));
+ }
+
+Dynamic MediaStreamTrack_obj::__CreateEmpty() { return new MediaStreamTrack_obj; }
+
+void *MediaStreamTrack_obj::_hx_vtable = 0;
+
+Dynamic MediaStreamTrack_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< MediaStreamTrack_obj > _hx_result = new MediaStreamTrack_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool MediaStreamTrack_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x047992ad;
+}
+
+::String MediaStreamTrack_obj::id__fromC(){
+ HX_STACKFRAME(&_hx_pos_6a2465e57550c9c8_271_id__fromC)
+HXDLIN( 271) return this->get_id();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(MediaStreamTrack_obj,id__fromC,return )
+
+bool MediaStreamTrack_obj::muted__fromC(){
+ HX_STACKFRAME(&_hx_pos_6a2465e57550c9c8_271_muted__fromC)
+HXDLIN( 271) return this->get_muted();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(MediaStreamTrack_obj,muted__fromC,return )
+
+::String MediaStreamTrack_obj::kind__fromC(){
+ HX_STACKFRAME(&_hx_pos_6a2465e57550c9c8_271_kind__fromC)
+HXDLIN( 271) return this->get_kind();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(MediaStreamTrack_obj,kind__fromC,return )
+
+size_t MediaStreamTrack_obj::supportedAudioFormats__fromC(void*** outPtr){
+ HX_GC_STACKFRAME(&_hx_pos_6a2465e57550c9c8_260_supportedAudioFormats__fromC)
+HXDLIN( 260) ::Array< ::Dynamic> x = this->get_supportedAudioFormats();
+HXDLIN( 260) if (::hx::IsNotNull( outPtr )) {
+HXDLIN( 260) ::cpp::Pointer< void** > _hx_tmp = ::cpp::Pointer_obj::fromRaw(outPtr);
+HXDLIN( 260) {
+HXDLIN( 260) int _g = 0;
+HXDLIN( 260) while((_g < x->length)){
+HXDLIN( 260) ::snikket::jingle::AudioFormat el = x->__get(_g).StaticCast< ::snikket::jingle::AudioFormat >();
+HXDLIN( 260) _g = (_g + 1);
+HXDLIN( 260) {
+HXDLIN( 260) ::Dynamic haxeObject = el;
+HXDLIN( 260) void* ptr = haxeObject.mPtr;
+HXDLIN( 260) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(ptr);
+HXDLIN( 260) {
+HXDLIN( 260) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 260) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 260) int high = ptrInt64 >> 32;
+HXDLIN( 260) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 260) if (::hx::IsNull( highMap )) {
+HXDLIN( 260) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 260) this1->set(low,highMap);
+ }
+HXDLIN( 260) highMap->set(high,haxeObject);
+ }
+ }
+ }
+ }
+HXDLIN( 260) void** ptr1 = (void**)x->getBase();
+HXDLIN( 260) ::cpp::Int64 ptrInt641 = reinterpret_cast<int64_t>(ptr1);
+HXDLIN( 260) {
+HXDLIN( 260) ::haxe::ds::IntMap this2 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 260) int low1 = ptrInt641 & 0xffffffff;
+HXDLIN( 260) int high1 = ptrInt641 >> 32;
+HXDLIN( 260) ::haxe::ds::IntMap highMap1 = ( ( ::haxe::ds::IntMap)(this2->get(low1)) );
+HXDLIN( 260) if (::hx::IsNull( highMap1 )) {
+HXDLIN( 260) highMap1 = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 260) this2->set(low1,highMap1);
+ }
+HXDLIN( 260) highMap1->set(high1,x);
+ }
+HXDLIN( 260) _hx_tmp->set_ref(ptr1);
+ }
+HXDLIN( 260) return ( (size_t)(x->length) );
+ }
+
+
+ std::optional< rtc::Description::Media > MediaStreamTrack_obj::get_media(){
+ HX_STACKFRAME(&_hx_pos_199cfc803453bfcf_398_get_media)
+HXLINE( 399) if (!track) {
+HXLINE( 400) return this->media;
+ }
+HXLINE( 403) rtc::Description::Media d = this->track->description();
+HXLINE( 404) return std::optional< rtc::Description::Media >(d);
+ }
+
+
+::String MediaStreamTrack_obj::get_id(){
+ HX_STACKFRAME(&_hx_pos_199cfc803453bfcf_406_get_id)
+HXLINE( 407) if (!track) {
+HXLINE( 408) std::string this1 = ( ( rtc::Description::Media)(( (cpp::Struct< rtc::Description::Media >)(this->get_media().value()) )) ).mid();
+HXDLIN( 408) return ( ( hx::StdString)(::hx::StdString(this1)) ).toString();
+ }
+HXLINE( 411) std::string this2 = this->track->mid();
+HXDLIN( 411) return ( ( hx::StdString)(::hx::StdString(this2)) ).toString();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(MediaStreamTrack_obj,get_id,return )
+
+::String MediaStreamTrack_obj::get_kind(){
+ HX_STACKFRAME(&_hx_pos_199cfc803453bfcf_413_get_kind)
+HXDLIN( 413) std::string this1 = ( ( rtc::Description::Media)(( (cpp::Struct< rtc::Description::Media >)(this->get_media().value()) )) ).type();
+HXDLIN( 413) return ( ( hx::StdString)(::hx::StdString(this1)) ).toString();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(MediaStreamTrack_obj,get_kind,return )
+
+bool MediaStreamTrack_obj::get_muted(){
+ HX_STACKFRAME(&_hx_pos_199cfc803453bfcf_414_get_muted)
+HXDLIN( 414) return false;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(MediaStreamTrack_obj,get_muted,return )
+
+::Array< ::Dynamic> MediaStreamTrack_obj::get_supportedAudioFormats(){
+ HX_GC_STACKFRAME(&_hx_pos_199cfc803453bfcf_416_get_supportedAudioFormats)
+HXLINE( 417) std::optional< rtc::Description::Media > maybeMedia = this->get_media();
+HXLINE( 418) if (!(maybeMedia.has_value())) {
+HXLINE( 418) return ::Array_obj< ::Dynamic>::__new(0);
+ }
+HXLINE( 419) rtc::Description::Media m = ( ( rtc::Description::Media)(( (cpp::Struct< rtc::Description::Media >)(maybeMedia.value()) )) );
+HXLINE( 420) ::Array< ::Dynamic> codecs = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 421) std::vector< int > payloadTypes = m.payloadTypes();
+HXLINE( 422) {
+HXLINE( 422) int _g = 0;
+HXDLIN( 422) int _g1 = ( (int)(payloadTypes.size()) );
+HXDLIN( 422) while((_g < _g1)){
+HXLINE( 422) _g = (_g + 1);
+HXDLIN( 422) int i = (_g - 1);
+HXLINE( 423) rtc::Description::Media::RtpMap rtp = ::cpp::Pointer_obj::fromRaw(m.rtpMap(( (int)(payloadTypes.at(i)) )))->get_ref();
+HXLINE( 424) std::string this1 = rtp.format;
+HXDLIN( 424) ::String _hx_tmp = ( ( hx::StdString)(::hx::StdString(this1)) ).toString();
+HXDLIN( 424) int _hx_tmp1 = ( (int)(payloadTypes.at(i)) );
+HXDLIN( 424) int rtp1 = rtp.clockRate;
+HXDLIN( 424) int _hx_tmp2;
+HXDLIN( 424) std::string this2 = rtp.encParams;
+HXDLIN( 424) if ((( ( hx::StdString)(::hx::StdString(this2)) ).toString() == HX_("",00,00,00,00))) {
+HXLINE( 424) _hx_tmp2 = 1;
+ }
+ else {
+HXLINE( 424) std::string this3 = rtp.encParams;
+HXDLIN( 424) _hx_tmp2 = ( (int)(::Std_obj::parseInt(( ( hx::StdString)(::hx::StdString(this3)) ).toString())) );
+ }
+HXDLIN( 424) codecs->push( ::snikket::jingle::AudioFormat_obj::__alloc( HX_CTX ,_hx_tmp,( (unsigned char)(_hx_tmp1) ),rtp1,_hx_tmp2));
+HXLINE( 425) std::string this4 = rtp.format;
+HXDLIN( 425) if ((( ( hx::StdString)(::hx::StdString(this4)) ).toString() == HX_("opus",bf,11,b4,49))) {
+HXLINE( 426) std::string this5 = rtp.format;
+HXDLIN( 426) ::String _hx_tmp3 = ( ( hx::StdString)(::hx::StdString(this5)) ).toString();
+HXDLIN( 426) int _hx_tmp4 = ( (int)(payloadTypes.at(i)) );
+HXDLIN( 426) int _hx_tmp5;
+HXDLIN( 426) std::string this6 = rtp.encParams;
+HXDLIN( 426) if ((( ( hx::StdString)(::hx::StdString(this6)) ).toString() == HX_("",00,00,00,00))) {
+HXLINE( 426) _hx_tmp5 = 1;
+ }
+ else {
+HXLINE( 426) std::string this7 = rtp.encParams;
+HXDLIN( 426) _hx_tmp5 = ( (int)(::Std_obj::parseInt(( ( hx::StdString)(::hx::StdString(this7)) ).toString())) );
+ }
+HXDLIN( 426) codecs->push( ::snikket::jingle::AudioFormat_obj::__alloc( HX_CTX ,_hx_tmp3,( (unsigned char)(_hx_tmp4) ),16000,_hx_tmp5));
+HXLINE( 427) std::string this8 = rtp.format;
+HXDLIN( 427) ::String _hx_tmp6 = ( ( hx::StdString)(::hx::StdString(this8)) ).toString();
+HXDLIN( 427) int _hx_tmp7 = ( (int)(payloadTypes.at(i)) );
+HXDLIN( 427) int _hx_tmp8;
+HXDLIN( 427) std::string this9 = rtp.encParams;
+HXDLIN( 427) if ((( ( hx::StdString)(::hx::StdString(this9)) ).toString() == HX_("",00,00,00,00))) {
+HXLINE( 427) _hx_tmp8 = 1;
+ }
+ else {
+HXLINE( 427) std::string this10 = rtp.encParams;
+HXDLIN( 427) _hx_tmp8 = ( (int)(::Std_obj::parseInt(( ( hx::StdString)(::hx::StdString(this10)) ).toString())) );
+ }
+HXDLIN( 427) codecs->push( ::snikket::jingle::AudioFormat_obj::__alloc( HX_CTX ,_hx_tmp6,( (unsigned char)(_hx_tmp7) ),8000,_hx_tmp8));
+ }
+ }
+ }
+HXLINE( 431) return codecs;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(MediaStreamTrack_obj,get_supportedAudioFormats,return )
+
+ std::shared_ptr< rtc::Track > MediaStreamTrack_obj::set_track( std::shared_ptr< rtc::Track > newTrack){
+ HX_STACKFRAME(&_hx_pos_199cfc803453bfcf_434_set_track)
+HXLINE( 435) if (!track) {
+HXLINE( 436) this->track = newTrack;
+HXLINE( 437) if ((this->get_kind() == HX_("audio",d6,78,80,27))) {
+HXLINE( 438) std::shared_ptr< rtc::RtpDepacketizer > depacket = std::make_shared<rtc::RtpDepacketizer>();
+HXLINE( 439) std::shared_ptr< rtc::RtcpReceivingSession > rtcp = std::make_shared<rtc::RtcpReceivingSession>();
+HXLINE( 440) depacket->addToChain(rtcp);
+HXLINE( 441) this->rtpPacketizationConfig = std::make_shared<rtc::RtpPacketizationConfig>(( (unsigned int)(0) ),::hx::StdString(HX_("audio",d6,78,80,27)),( (unsigned char)(0) ),( (unsigned int)(8000) ));
+HXLINE( 447) std::shared_ptr< rtc::RtpPacketizer > packet = std::make_shared<rtc::RtpPacketizer>(this->rtpPacketizationConfig);
+HXLINE( 448) depacket->addToChain(packet);
+HXLINE( 449) this->track->setMediaHandler(depacket);
+HXLINE( 450) this->track->onFrame([this](rtc::binary msg, rtc::FrameInfo frame_info) { this->onFrame(msg, frame_info); });;
+HXLINE( 451) this->track->onOpen([this]() { this->notifyReadyForData(true); });;
+ }
+HXLINE( 453) this->track->onClosed([this]() { int base = 0; hx::SetTopOfStack(&base, true); this->stop(); hx::SetTopOfStack((int*)0, true); });;
+ }
+ else {
+HXLINE( 455) HX_STACK_DO_THROW(HX_("Track already set",e5,d9,99,b9));
+ }
+HXLINE( 458) return this->track;
+ }
+
+
+void MediaStreamTrack_obj::addPCMListener( ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_199cfc803453bfcf_467_addPCMListener)
+HXDLIN( 467) this->pcmCallback = callback;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(MediaStreamTrack_obj,addPCMListener,(void))
+
+void MediaStreamTrack_obj::addPCMListener__fromC(::cpp::Function< void (short*,size_t,int,int,void*) > callback,void* callback__context){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0,void*,callback__context,::cpp::Function< void (short* HX_COMMA size_t HX_COMMA int HX_COMMA int HX_COMMA void*) >,callback) HXARGC(3)
+ void _hx_run(::Array< short > a0,int a1,int a2){
+ HX_GC_STACKFRAME(&_hx_pos_6a2465e57550c9c8_221_addPCMListener__fromC)
+HXLINE( 221) ::cpp::Function< void (short*,size_t,int,int,void*) > callback1 = callback;
+HXLINE( 211) void** ptr = (void**)a0->getBase();
+HXDLIN( 211) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(ptr);
+HXDLIN( 211) {
+HXLINE( 211) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 211) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 211) int high = ptrInt64 >> 32;
+HXDLIN( 211) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 211) if (::hx::IsNull( highMap )) {
+HXLINE( 211) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 211) this1->set(low,highMap);
+ }
+HXDLIN( 211) highMap->set(high,a0);
+ }
+HXLINE( 221) callback1(( (short*)(ptr) ),( (size_t)(a0->length) ),a1,a2,callback__context);
+ }
+ HX_END_LOCAL_FUNC3((void))
+
+ HX_STACKFRAME(&_hx_pos_6a2465e57550c9c8_244_addPCMListener__fromC)
+HXDLIN( 244) this->addPCMListener( ::Dynamic(new _hx_Closure_0(callback__context,callback)));
+ }
+
+
+void MediaStreamTrack_obj::onFrame( std::vector< std::byte > msg, rtc::FrameInfo frameInfo){
+ HX_STACKFRAME(&_hx_pos_199cfc803453bfcf_492_onFrame)
+HXLINE( 493) int base = 0; hx::SetTopOfStack(&base, true);;
+HXLINE( 494) rtc::Description::Media::RtpMap rtp = ::cpp::Pointer_obj::fromRaw(this->track->description().rtpMap(frameInfo.payloadType))->get_ref();
+HXLINE( 495) std::string this1 = rtp.format;
+HXDLIN( 495) ::String format = ( ( hx::StdString)(::hx::StdString(this1)) ).toString();
+HXLINE( 496) ::Dynamic channels;
+HXDLIN( 496) std::string this2 = rtp.encParams;
+HXDLIN( 496) if ((( ( hx::StdString)(::hx::StdString(this2)) ).toString() == HX_("",00,00,00,00))) {
+HXLINE( 496) channels = 1;
+ }
+ else {
+HXLINE( 496) std::string this3 = rtp.encParams;
+HXDLIN( 496) channels = ::Std_obj::parseInt(( ( hx::StdString)(::hx::StdString(this3)) ).toString());
+ }
+HXLINE( 497) if ((format == HX_("PCMU",1b,2c,14,35))) {
+HXLINE( 498) ::Array< short > s16 = ::Array_obj< short >::__new(( (int)(msg.size()) ));
+HXLINE( 499) {
+HXLINE( 499) int _g = 0;
+HXDLIN( 499) int _g1 = ( (int)(msg.size()) );
+HXDLIN( 499) while((_g < _g1)){
+HXLINE( 499) _g = (_g + 1);
+HXDLIN( 499) int i = (_g - 1);
+HXLINE( 500) {
+HXLINE( 500) short val = ::snikket::jingle::MediaStreamTrack_obj::ULAW_DECODE->__get(( (int)(msg.at(i)) ));
+HXDLIN( 500) s16->__unsafe_set(i,val);
+ }
+ }
+ }
+HXLINE( 502) if (::hx::IsNotNull( this->pcmCallback )) {
+HXLINE( 502) this->pcmCallback(s16,rtp.clockRate,channels);
+ }
+ }
+ else {
+HXLINE( 503) if ((format == HX_("opus",bf,11,b4,49))) {
+HXLINE( 504) ::Array< short > s161 = ::Array_obj< short >::__new(5760);
+HXLINE( 505) if (!opus) {
+HXLINE( 505) ::cpp::Pointer< int > tmp = null();
+HXDLIN( 505) this->opus = opus_decoder_create(rtp.clockRate,( (int)(channels) ),tmp);
+ }
+HXLINE( 507) ::cpp::Pointer< unsigned char > tmp1 = ( (::cpp::Pointer< unsigned char >)(msg.data()) );
+HXDLIN( 507) ::cpp::Pointer< short > tmp2 = ( (::cpp::Pointer< short >)(::cpp::Pointer_obj::ofArray(s161)) );
+HXDLIN( 507) cpp::Struct< OpusDecoder* > decoded = this->opus;
+HXDLIN( 507) size_t decoded1 = msg.size();
+HXDLIN( 507) int decoded2 = opus_decode(decoded,tmp1,( (int)(decoded1) ),tmp2,::Std_obj::_hx_int((( (Float)(s161->length) ) / ( (Float)(channels) ))),false);
+HXLINE( 508) s161->resize((decoded2 * ( (int)(channels) )));
+HXLINE( 509) if (::hx::IsNotNull( this->pcmCallback )) {
+HXLINE( 509) this->pcmCallback(s161,rtp.clockRate,channels);
+ }
+ }
+ else {
+HXLINE( 511) ::haxe::Log_obj::trace(HX_("Ignoring audio frame with format",a3,bb,fe,5b), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.jingle.MediaStreamTrack",73,fe,80,a9))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,format))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("onFrame",8e,16,c1,9c))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/jingle/PeerConnection.cpp.hx",1d,b7,fa,f9))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),511)));
+ }
+ }
+HXLINE( 513) hx::SetTopOfStack((int*)0, true);;
+ }
+
+
+void MediaStreamTrack_obj::addReadyForPCMListener( ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_199cfc803453bfcf_521_addReadyForPCMListener)
+HXLINE( 522) this->readyForPCMCallback = callback;
+HXLINE( 523) bool _hx_tmp;
+HXDLIN( 523) if (track) {
+HXLINE( 523) _hx_tmp = this->track->isOpen();
+ }
+ else {
+HXLINE( 523) _hx_tmp = false;
+ }
+HXDLIN( 523) if (_hx_tmp) {
+HXLINE( 524) this->notifyReadyForData(false);
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(MediaStreamTrack_obj,addReadyForPCMListener,(void))
+
+void MediaStreamTrack_obj::addReadyForPCMListener__fromC(::cpp::Function< void (void*) > callback,void* callback__context){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0,void*,callback__context,::cpp::Function< void (void*) >,callback) HXARGC(0)
+ void _hx_run(){
+ HX_STACKFRAME(&_hx_pos_6a2465e57550c9c8_221_addReadyForPCMListener__fromC)
+HXLINE( 221) callback(callback__context);
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_STACKFRAME(&_hx_pos_6a2465e57550c9c8_244_addReadyForPCMListener__fromC)
+HXDLIN( 244) this->addReadyForPCMListener( ::Dynamic(new _hx_Closure_0(callback__context,callback)));
+ }
+
+
+void MediaStreamTrack_obj::notifyReadyForData(bool fromCPP){
+ HX_STACKFRAME(&_hx_pos_199cfc803453bfcf_528_notifyReadyForData)
+HXDLIN( 528) ::snikket::jingle::MediaStreamTrack _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 529) if (fromCPP) { int base = 0; hx::SetTopOfStack(&base, true); };
+HXLINE( 530) if (::hx::IsNotNull( this->readyForPCMCallback )) {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::jingle::MediaStreamTrack,_gthis) HXARGC(0)
+ void _hx_run(){
+ HX_STACKFRAME(&_hx_pos_199cfc803453bfcf_532_notifyReadyForData)
+HXLINE( 532) if ((_gthis->audioQ->length > (50 + (( (Float)(50) ) * _gthis->bufferSizeInSeconds)))) {
+HXLINE( 533) _gthis->mutex->acquire();
+HXLINE( 534) _gthis->waitForQ = true;
+HXLINE( 535) _gthis->mutex->release();
+ }
+ else {
+HXLINE( 537) _gthis->readyForPCMCallback();
+ }
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+HXLINE( 531) this->eventLoop->run( ::Dynamic(new _hx_Closure_0(_gthis)));
+ }
+HXLINE( 541) if (fromCPP) { hx::SetTopOfStack((int*)0, true); };
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(MediaStreamTrack_obj,notifyReadyForData,(void))
+
+void MediaStreamTrack_obj::writePCM(::Array< short > pcm,int clockRate,int channels){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0,int,channels,int,clockRate) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::AudioFormat format){
+ HX_STACKFRAME(&_hx_pos_199cfc803453bfcf_552_writePCM)
+HXLINE( 552) if ((format->clockRate == clockRate)) {
+HXLINE( 552) return (format->channels == channels);
+ }
+ else {
+HXLINE( 552) return false;
+ }
+HXDLIN( 552) return false;
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S5(::hx::LocalFunc,_hx_Closure_1,::Array< short >,pcm, ::snikket::jingle::MediaStreamTrack,_gthis,int,channels,int,clockRate, ::snikket::jingle::AudioFormat,format) HXARGC(0)
+ void _hx_run(){
+ HX_STACKFRAME(&_hx_pos_199cfc803453bfcf_554_writePCM)
+HXLINE( 555) _gthis->mutex->acquire();
+HXLINE( 556) Float stamp;
+HXDLIN( 556) if ((_gthis->audioQ->length < 1)) {
+HXLINE( 557) _gthis->bufferSizeInSeconds = ::Math_obj::max(_gthis->bufferSizeInSeconds,(_gthis->bufferSizeInSeconds + ((Float)0.1)));
+HXLINE( 558) Float stamp1 = ::__time_stamp();
+HXLINE( 556) stamp = (stamp1 + _gthis->bufferSizeInSeconds);
+ }
+ else {
+HXLINE( 556) stamp = ( (Float)((_gthis->audioQ->__get(0)->__Field(HX_("stamp",03,70,0b,84),::hx::paccDynamic) + ((( (Float)(pcm->length) ) / (( (Float)(clockRate) ) / ( (Float)(1000) ))) / ((Float)1000.0)))) );
+ }
+HXLINE( 562) _gthis->mutex->release();
+HXLINE( 563) if ((format->format == HX_("PCMU",1b,2c,14,35))) {
+HXLINE( 564) int channels1 = channels;
+HXDLIN( 564) unsigned char format1 = format->payloadType;
+HXDLIN( 564) int clockRate1 = clockRate;
+HXDLIN( 564) ::Dynamic f = ::snikket::jingle::MediaStreamTrack_obj::pcmToUlaw_dyn();
+HXDLIN( 564) ::Array< unsigned char > result = ::Array_obj< unsigned char >::__new(pcm->length);
+HXDLIN( 564) {
+HXLINE( 564) int _g = 0;
+HXDLIN( 564) int _g1 = pcm->length;
+HXDLIN( 564) while((_g < _g1)){
+HXLINE( 564) _g = (_g + 1);
+HXDLIN( 564) int i = (_g - 1);
+HXDLIN( 564) {
+HXLINE( 564) unsigned char inValue = ( (unsigned char)(f(_hx_array_unsafe_get(pcm,i))) );
+HXDLIN( 564) result->__unsafe_set(i,inValue);
+ }
+ }
+ }
+HXDLIN( 564) ::Dynamic packet = ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("stamp",03,70,0b,84),stamp)
+ ->setFixed(1,HX_("payloadType",68,bd,49,af),format1)
+ ->setFixed(2,HX_("payload",8e,bf,35,ed),result)
+ ->setFixed(3,HX_("clockRate",ce,87,24,24),clockRate1)
+ ->setFixed(4,HX_("channels",50,aa,ee,6a),channels1));
+HXLINE( 565) _gthis->mutex->acquire();
+HXLINE( 566) _gthis->audioQ->unshift(packet);
+HXLINE( 567) _gthis->mutex->release();
+ }
+ else {
+HXLINE( 568) if ((format->format == HX_("opus",bf,11,b4,49))) {
+HXLINE( 569) if (!_gthis->opusEncoder) {
+HXLINE( 570) ::cpp::Pointer< int > tmp = null();
+HXDLIN( 570) int clockRate2 = clockRate;
+HXDLIN( 570) int channels2 = channels;
+HXDLIN( 570) int _hx_tmp = OPUS_APPLICATION_VOIP;
+HXDLIN( 570) _gthis->opusEncoder = opus_encoder_create(clockRate2,channels2,_hx_tmp,tmp);
+HXLINE( 571) opus_encoder_ctl(_gthis->opusEncoder, OPUS_SET_BITRATE(24));
+HXLINE( 572) opus_encoder_ctl(_gthis->opusEncoder, OPUS_SET_PACKET_LOSS_PERC(5));
+HXLINE( 573) opus_encoder_ctl(_gthis->opusEncoder, OPUS_SET_INBAND_FEC(1));
+ }
+HXLINE( 575) ::Array< unsigned char > rawOpus = ::Array_obj< unsigned char >::__new((pcm->length * 2));
+HXLINE( 576) ::cpp::Pointer< short > tmp1 = ( (::cpp::Pointer< short >)(::cpp::Pointer_obj::ofArray(pcm)) );
+HXDLIN( 576) ::cpp::Pointer< unsigned char > tmp2 = ( (::cpp::Pointer< unsigned char >)(::cpp::Pointer_obj::ofArray(rawOpus)) );
+HXDLIN( 576) cpp::Struct< OpusEncoder* > _gthis1 = _gthis->opusEncoder;
+HXDLIN( 576) int encoded = ::Std_obj::_hx_int((( (Float)(pcm->length) ) / ( (Float)(channels) )));
+HXDLIN( 576) int encoded1 = opus_encode(_gthis1,tmp1,encoded,tmp2,rawOpus->length);
+HXLINE( 577) rawOpus->resize(encoded1);
+HXLINE( 578) ::Dynamic packet1 = ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("stamp",03,70,0b,84),stamp)
+ ->setFixed(1,HX_("payloadType",68,bd,49,af),format->payloadType)
+ ->setFixed(2,HX_("payload",8e,bf,35,ed),rawOpus)
+ ->setFixed(3,HX_("clockRate",ce,87,24,24),clockRate)
+ ->setFixed(4,HX_("channels",50,aa,ee,6a),channels));
+HXLINE( 579) _gthis->mutex->acquire();
+HXLINE( 580) _gthis->audioQ->unshift(packet1);
+HXLINE( 581) _gthis->mutex->release();
+ }
+ else {
+HXLINE( 583) ::haxe::Log_obj::trace(HX_("Ignoring audio meant to go out as",e3,e7,4f,55), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.jingle.MediaStreamTrack",73,fe,80,a9))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(3)->init(0,format->format)->init(1,format->clockRate)->init(2,format->channels))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("writePCM",7b,97,f5,23))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/jingle/PeerConnection.cpp.hx",1d,b7,fa,f9))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),583)));
+ }
+ }
+HXLINE( 585) _gthis->notifyReadyForData(false);
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_STACKFRAME(&_hx_pos_199cfc803453bfcf_551_writePCM)
+HXDLIN( 551) ::snikket::jingle::MediaStreamTrack _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 552) ::snikket::jingle::AudioFormat format = ( ( ::snikket::jingle::AudioFormat)(::Lambda_obj::find(this->get_supportedAudioFormats(), ::Dynamic(new _hx_Closure_0(channels,clockRate)))) );
+HXLINE( 553) if (::hx::IsNull( format )) {
+HXLINE( 553) HX_STACK_DO_THROW((((HX_("Unsupported audo format: ",93,2f,48,26) + clockRate) + HX_("/",2f,00,00,00)) + channels));
+ }
+HXLINE( 554) this->eventLoop->run( ::Dynamic(new _hx_Closure_1(pcm,_gthis,channels,clockRate,format)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(MediaStreamTrack_obj,writePCM,(void))
+
+void MediaStreamTrack_obj::writePCM__fromC(::cpp::Pointer< short > pcm,size_t pcm__len,int clockRate,int channels){
+ HX_STACKFRAME(&_hx_pos_6a2465e57550c9c8_244_writePCM__fromC)
+HXLINE( 224) ::cpp::Pointer< short > _this = pcm->reinterpret();
+HXDLIN( 224) ::Array< short > result = ::Array_obj< short >::__new();
+HXDLIN( 224) ::cpp::Pointer< short > tmp = _this;
+HXDLIN( 224) result->setUnmanagedData(tmp,( (int)(pcm__len) ));
+HXLINE( 244) this->writePCM(result->copy(),clockRate,channels);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC4(MediaStreamTrack_obj,writePCM__fromC,(void))
+
+void MediaStreamTrack_obj::onAudioLoop( ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_199cfc803453bfcf_591_onAudioLoop)
+HXDLIN( 591) this->eventLoop->run(callback);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(MediaStreamTrack_obj,onAudioLoop,(void))
+
+void MediaStreamTrack_obj::write(::Array< unsigned char > payload,unsigned char payloadType,int clockRate){
+ HX_STACKFRAME(&_hx_pos_199cfc803453bfcf_595_write)
+HXLINE( 596) bool _hx_tmp;
+HXDLIN( 596) if (!(!track)) {
+HXLINE( 596) _hx_tmp = !(this->track->isOpen());
+ }
+ else {
+HXLINE( 596) _hx_tmp = true;
+ }
+HXDLIN( 596) if (_hx_tmp) {
+HXLINE( 596) return;
+ }
+HXLINE( 598) this->rtpPacketizationConfig->payloadType = payloadType;
+HXLINE( 599) this->rtpPacketizationConfig->clockRate = ( (unsigned int)(clockRate) );
+HXLINE( 600) ::cpp::Pointer< std::byte > tmp = ( (::cpp::Pointer< unsigned char >)(::cpp::Pointer_obj::ofArray(payload)) )->reinterpret();
+HXDLIN( 600) this->track->send(tmp,( (size_t)(payload->length) ));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(MediaStreamTrack_obj,write,(void))
+
+void MediaStreamTrack_obj::advanceTimestamp(int samples){
+ HX_STACKFRAME(&_hx_pos_199cfc803453bfcf_607_advanceTimestamp)
+HXDLIN( 607) this->rtpPacketizationConfig->timestamp = (this->rtpPacketizationConfig->timestamp + samples);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(MediaStreamTrack_obj,advanceTimestamp,(void))
+
+void MediaStreamTrack_obj::stop(){
+ HX_STACKFRAME(&_hx_pos_199cfc803453bfcf_610_stop)
+HXLINE( 611) this->timer->stop();
+HXLINE( 612) this->mutex->acquire();
+HXLINE( 613) this->alive = false;
+HXLINE( 614) if (this->track->isOpen()) {
+HXLINE( 614) this->track->close();
+ }
+HXLINE( 615) if (opus) {
+HXLINE( 616) opus_decoder_destroy(this->opus);
+HXLINE( 617) this->opus = null();
+ }
+HXLINE( 619) this->mutex->release();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(MediaStreamTrack_obj,stop,(void))
+
+ ::snikket::jingle::MediaStreamTrack MediaStreamTrack_obj::fromTrack( std::shared_ptr< rtc::Track > t){
+ HX_GC_STACKFRAME(&_hx_pos_199cfc803453bfcf_362_fromTrack)
+HXLINE( 363) ::snikket::jingle::MediaStreamTrack media = ::snikket::jingle::MediaStreamTrack_obj::__alloc( HX_CTX );
+HXLINE( 364) media->set_track(t);
+HXLINE( 365) return media;
+ }
+
+
+::Array< short > MediaStreamTrack_obj::ULAW_DECODE;
+
+::Array< unsigned char > MediaStreamTrack_obj::ULAW_EXP;
+
+unsigned char MediaStreamTrack_obj::pcmToUlaw(short sample){
+ HX_STACKFRAME(&_hx_pos_199cfc803453bfcf_473_pcmToUlaw)
+HXLINE( 474) int sign;
+HXDLIN( 474) if ((sample < 0)) {
+HXLINE( 475) sample = -(sample);
+HXLINE( 474) sign = 128;
+ }
+ else {
+HXLINE( 474) sign = 0;
+ }
+HXLINE( 482) if ((sample > 32635)) {
+HXLINE( 483) sample = ( (short)(32635) );
+ }
+HXLINE( 486) sample = (sample + 132);
+HXLINE( 487) unsigned char exponent = ::snikket::jingle::MediaStreamTrack_obj::ULAW_EXP->__get(((( (int)(sample) ) >> 8) & 127));
+HXLINE( 488) int mantissa = ((( (int)(sample) ) >> ( (int)((exponent + 3)) )) & 15);
+HXLINE( 489) return ( (unsigned char)(~(((sign | (( (int)(exponent) ) << 4)) | mantissa))) );
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(MediaStreamTrack_obj,pcmToUlaw,return )
+
+
+::hx::ObjectPtr< MediaStreamTrack_obj > MediaStreamTrack_obj::__new() {
+ ::hx::ObjectPtr< MediaStreamTrack_obj > __this = new MediaStreamTrack_obj();
+ __this->__construct();
+ return __this;
+}
+
+::hx::ObjectPtr< MediaStreamTrack_obj > MediaStreamTrack_obj::__alloc(::hx::Ctx *_hx_ctx) {
+ MediaStreamTrack_obj *__this = (MediaStreamTrack_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(MediaStreamTrack_obj), true, "snikket.jingle.MediaStreamTrack"));
+ *(void **)__this = MediaStreamTrack_obj::_hx_vtable;
+ __this->__construct();
+ return __this;
+}
+
+MediaStreamTrack_obj::MediaStreamTrack_obj()
+{
+}
+
+void MediaStreamTrack_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(MediaStreamTrack);
+ HX_MARK_MEMBER_NAME(pcmCallback,"pcmCallback");
+ HX_MARK_MEMBER_NAME(readyForPCMCallback,"readyForPCMCallback");
+ HX_MARK_MEMBER_NAME(opus,"opus");
+ HX_MARK_MEMBER_NAME(opusEncoder,"opusEncoder");
+ HX_MARK_MEMBER_NAME(rtpPacketizationConfig,"rtpPacketizationConfig");
+ HX_MARK_MEMBER_NAME(eventLoop,"eventLoop");
+ HX_MARK_MEMBER_NAME(timer,"timer");
+ HX_MARK_MEMBER_NAME(audioQ,"audioQ");
+ HX_MARK_MEMBER_NAME(alive,"alive");
+ HX_MARK_MEMBER_NAME(waitForQ,"waitForQ");
+ HX_MARK_MEMBER_NAME(bufferSizeInSeconds,"bufferSizeInSeconds");
+ HX_MARK_MEMBER_NAME(mutex,"mutex");
+ HX_MARK_MEMBER_NAME(media,"media");
+ HX_MARK_MEMBER_NAME(track,"track");
+ HX_MARK_END_CLASS();
+}
+
+void MediaStreamTrack_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(pcmCallback,"pcmCallback");
+ HX_VISIT_MEMBER_NAME(readyForPCMCallback,"readyForPCMCallback");
+ HX_VISIT_MEMBER_NAME(opus,"opus");
+ HX_VISIT_MEMBER_NAME(opusEncoder,"opusEncoder");
+ HX_VISIT_MEMBER_NAME(rtpPacketizationConfig,"rtpPacketizationConfig");
+ HX_VISIT_MEMBER_NAME(eventLoop,"eventLoop");
+ HX_VISIT_MEMBER_NAME(timer,"timer");
+ HX_VISIT_MEMBER_NAME(audioQ,"audioQ");
+ HX_VISIT_MEMBER_NAME(alive,"alive");
+ HX_VISIT_MEMBER_NAME(waitForQ,"waitForQ");
+ HX_VISIT_MEMBER_NAME(bufferSizeInSeconds,"bufferSizeInSeconds");
+ HX_VISIT_MEMBER_NAME(mutex,"mutex");
+ HX_VISIT_MEMBER_NAME(media,"media");
+ HX_VISIT_MEMBER_NAME(track,"track");
+}
+
+::hx::Val MediaStreamTrack_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 2:
+ if (HX_FIELD_EQ(inName,"id") ) { if (inCallProp == ::hx::paccAlways) return ::hx::Val( get_id() ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"kind") ) { if (inCallProp == ::hx::paccAlways) return ::hx::Val( get_kind() ); }
+ if (HX_FIELD_EQ(inName,"opus") ) { return ::hx::Val( opus ); }
+ if (HX_FIELD_EQ(inName,"stop") ) { return ::hx::Val( stop_dyn() ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"muted") ) { if (inCallProp == ::hx::paccAlways) return ::hx::Val( get_muted() ); }
+ if (HX_FIELD_EQ(inName,"timer") ) { return ::hx::Val( timer ); }
+ if (HX_FIELD_EQ(inName,"alive") ) { return ::hx::Val( alive ); }
+ if (HX_FIELD_EQ(inName,"mutex") ) { return ::hx::Val( mutex ); }
+ if (HX_FIELD_EQ(inName,"write") ) { return ::hx::Val( write_dyn() ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"audioQ") ) { return ::hx::Val( audioQ ); }
+ if (HX_FIELD_EQ(inName,"get_id") ) { return ::hx::Val( get_id_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"waitForQ") ) { return ::hx::Val( waitForQ ); }
+ if (HX_FIELD_EQ(inName,"get_kind") ) { return ::hx::Val( get_kind_dyn() ); }
+ if (HX_FIELD_EQ(inName,"writePCM") ) { return ::hx::Val( writePCM_dyn() ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"id__fromC") ) { return ::hx::Val( id__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"eventLoop") ) { return ::hx::Val( eventLoop ); }
+ if (HX_FIELD_EQ(inName,"get_muted") ) { return ::hx::Val( get_muted_dyn() ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"kind__fromC") ) { return ::hx::Val( kind__fromC_dyn() ); }
+ if (HX_FIELD_EQ(inName,"pcmCallback") ) { return ::hx::Val( pcmCallback ); }
+ if (HX_FIELD_EQ(inName,"opusEncoder") ) { return ::hx::Val( opusEncoder ); }
+ if (HX_FIELD_EQ(inName,"onAudioLoop") ) { return ::hx::Val( onAudioLoop_dyn() ); }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"muted__fromC") ) { return ::hx::Val( muted__fromC_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"addPCMListener") ) { return ::hx::Val( addPCMListener_dyn() ); }
+ break;
+ case 15:
+ if (HX_FIELD_EQ(inName,"writePCM__fromC") ) { return ::hx::Val( writePCM__fromC_dyn() ); }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"advanceTimestamp") ) { return ::hx::Val( advanceTimestamp_dyn() ); }
+ break;
+ case 18:
+ if (HX_FIELD_EQ(inName,"notifyReadyForData") ) { return ::hx::Val( notifyReadyForData_dyn() ); }
+ break;
+ case 19:
+ if (HX_FIELD_EQ(inName,"readyForPCMCallback") ) { return ::hx::Val( readyForPCMCallback ); }
+ if (HX_FIELD_EQ(inName,"bufferSizeInSeconds") ) { return ::hx::Val( bufferSizeInSeconds ); }
+ break;
+ case 21:
+ if (HX_FIELD_EQ(inName,"supportedAudioFormats") ) { if (inCallProp == ::hx::paccAlways) return ::hx::Val( get_supportedAudioFormats() ); }
+ break;
+ case 22:
+ if (HX_FIELD_EQ(inName,"addReadyForPCMListener") ) { return ::hx::Val( addReadyForPCMListener_dyn() ); }
+ break;
+ case 25:
+ if (HX_FIELD_EQ(inName,"get_supportedAudioFormats") ) { return ::hx::Val( get_supportedAudioFormats_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool MediaStreamTrack_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 8:
+ if (HX_FIELD_EQ(inName,"ULAW_EXP") ) { outValue = ( ULAW_EXP ); return true; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"pcmToUlaw") ) { outValue = pcmToUlaw_dyn(); return true; }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"ULAW_DECODE") ) { outValue = ( ULAW_DECODE ); return true; }
+ }
+ return false;
+}
+
+::hx::Val MediaStreamTrack_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"opus") ) { opus=inValue.Cast< cpp::Struct< OpusDecoder* > >(); return inValue; }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"timer") ) { timer=inValue.Cast< ::haxe::Timer >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"alive") ) { alive=inValue.Cast< bool >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"mutex") ) { mutex=inValue.Cast< ::sys::thread::Mutex >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"audioQ") ) { audioQ=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"waitForQ") ) { waitForQ=inValue.Cast< bool >(); return inValue; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"eventLoop") ) { eventLoop=inValue.Cast< ::sys::thread::EventLoop >(); return inValue; }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"pcmCallback") ) { pcmCallback=inValue.Cast< ::Dynamic >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"opusEncoder") ) { opusEncoder=inValue.Cast< cpp::Struct< OpusEncoder* > >(); return inValue; }
+ break;
+ case 19:
+ if (HX_FIELD_EQ(inName,"readyForPCMCallback") ) { readyForPCMCallback=inValue.Cast< ::Dynamic >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"bufferSizeInSeconds") ) { bufferSizeInSeconds=inValue.Cast< Float >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+bool MediaStreamTrack_obj::__SetStatic(const ::String &inName,Dynamic &ioValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 8:
+ if (HX_FIELD_EQ(inName,"ULAW_EXP") ) { ULAW_EXP=ioValue.Cast< ::Array< unsigned char > >(); return true; }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"ULAW_DECODE") ) { ULAW_DECODE=ioValue.Cast< ::Array< short > >(); return true; }
+ }
+ return false;
+}
+
+void MediaStreamTrack_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("id",db,5b,00,00));
+ outFields->push(HX_("muted",6b,8f,5b,10));
+ outFields->push(HX_("kind",54,e1,09,47));
+ outFields->push(HX_("supportedAudioFormats",74,76,ed,1a));
+ outFields->push(HX_("opus",bf,11,b4,49));
+ outFields->push(HX_("opusEncoder",9d,3d,e4,95));
+ outFields->push(HX_("rtpPacketizationConfig",b0,ac,74,3b));
+ outFields->push(HX_("eventLoop",9e,af,c4,f6));
+ outFields->push(HX_("timer",c5,bf,35,10));
+ outFields->push(HX_("audioQ",bb,42,e9,68));
+ outFields->push(HX_("alive",cd,63,91,21));
+ outFields->push(HX_("waitForQ",3d,c6,a2,4c));
+ outFields->push(HX_("bufferSizeInSeconds",f9,0a,29,18));
+ outFields->push(HX_("mutex",7f,8f,5b,10));
+ outFields->push(HX_("media",e4,04,bc,05));
+ outFields->push(HX_("track",8b,8e,1f,16));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo MediaStreamTrack_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(MediaStreamTrack_obj,pcmCallback),HX_("pcmCallback",ff,52,9d,e7)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(MediaStreamTrack_obj,readyForPCMCallback),HX_("readyForPCMCallback",39,3e,cf,7e)},
+ {::hx::fsUnknown /* cpp::Struct< OpusDecoder* > */ ,(int)offsetof(MediaStreamTrack_obj,opus),HX_("opus",bf,11,b4,49)},
+ {::hx::fsUnknown /* cpp::Struct< OpusEncoder* > */ ,(int)offsetof(MediaStreamTrack_obj,opusEncoder),HX_("opusEncoder",9d,3d,e4,95)},
+ {::hx::fsUnknown /* std::shared_ptr< rtc::RtpPacketizationConfig > */ ,(int)offsetof(MediaStreamTrack_obj,rtpPacketizationConfig),HX_("rtpPacketizationConfig",b0,ac,74,3b)},
+ {::hx::fsObject /* ::sys::thread::EventLoop */ ,(int)offsetof(MediaStreamTrack_obj,eventLoop),HX_("eventLoop",9e,af,c4,f6)},
+ {::hx::fsObject /* ::haxe::Timer */ ,(int)offsetof(MediaStreamTrack_obj,timer),HX_("timer",c5,bf,35,10)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(MediaStreamTrack_obj,audioQ),HX_("audioQ",bb,42,e9,68)},
+ {::hx::fsBool,(int)offsetof(MediaStreamTrack_obj,alive),HX_("alive",cd,63,91,21)},
+ {::hx::fsBool,(int)offsetof(MediaStreamTrack_obj,waitForQ),HX_("waitForQ",3d,c6,a2,4c)},
+ {::hx::fsFloat,(int)offsetof(MediaStreamTrack_obj,bufferSizeInSeconds),HX_("bufferSizeInSeconds",f9,0a,29,18)},
+ {::hx::fsObject /* ::sys::thread::Mutex */ ,(int)offsetof(MediaStreamTrack_obj,mutex),HX_("mutex",7f,8f,5b,10)},
+ {::hx::fsUnknown /* std::optional< rtc::Description::Media > */ ,(int)offsetof(MediaStreamTrack_obj,media),HX_("media",e4,04,bc,05)},
+ {::hx::fsUnknown /* std::shared_ptr< rtc::Track > */ ,(int)offsetof(MediaStreamTrack_obj,track),HX_("track",8b,8e,1f,16)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo MediaStreamTrack_obj_sStaticStorageInfo[] = {
+ {::hx::fsObject /* ::Array< short > */ ,(void *) &MediaStreamTrack_obj::ULAW_DECODE,HX_("ULAW_DECODE",60,bf,4c,65)},
+ {::hx::fsObject /* ::Array< unsigned char > */ ,(void *) &MediaStreamTrack_obj::ULAW_EXP,HX_("ULAW_EXP",0b,ff,2d,aa)},
+ { ::hx::fsUnknown, 0, null()}
+};
+#endif
+
+static ::String MediaStreamTrack_obj_sMemberFields[] = {
+ HX_("id__fromC",fe,15,a5,4d),
+ HX_("muted__fromC",6e,74,c6,07),
+ HX_("kind__fromC",a5,21,de,27),
+ HX_("pcmCallback",ff,52,9d,e7),
+ HX_("readyForPCMCallback",39,3e,cf,7e),
+ HX_("opus",bf,11,b4,49),
+ HX_("opusEncoder",9d,3d,e4,95),
+ HX_("eventLoop",9e,af,c4,f6),
+ HX_("timer",c5,bf,35,10),
+ HX_("audioQ",bb,42,e9,68),
+ HX_("alive",cd,63,91,21),
+ HX_("waitForQ",3d,c6,a2,4c),
+ HX_("bufferSizeInSeconds",f9,0a,29,18),
+ HX_("mutex",7f,8f,5b,10),
+ HX_("get_id",24,f3,2f,a3),
+ HX_("get_kind",dd,9c,c4,c6),
+ HX_("get_muted",c2,eb,04,54),
+ HX_("get_supportedAudioFormats",cb,30,eb,20),
+ HX_("addPCMListener",0d,a5,23,cf),
+ HX_("addReadyForPCMListener",47,a3,46,de),
+ HX_("notifyReadyForData",19,5c,8e,58),
+ HX_("writePCM",7b,97,f5,23),
+ HX_("writePCM__fromC",5e,8e,24,22),
+ HX_("onAudioLoop",3b,51,b0,89),
+ HX_("write",df,6c,59,d0),
+ HX_("advanceTimestamp",f4,8b,a5,10),
+ HX_("stop",02,f0,5b,4c),
+ ::String(null()) };
+
+static void MediaStreamTrack_obj_sMarkStatics(HX_MARK_PARAMS) {
+ HX_MARK_MEMBER_NAME(MediaStreamTrack_obj::ULAW_DECODE,"ULAW_DECODE");
+ HX_MARK_MEMBER_NAME(MediaStreamTrack_obj::ULAW_EXP,"ULAW_EXP");
+};
+
+#ifdef HXCPP_VISIT_ALLOCS
+static void MediaStreamTrack_obj_sVisitStatics(HX_VISIT_PARAMS) {
+ HX_VISIT_MEMBER_NAME(MediaStreamTrack_obj::ULAW_DECODE,"ULAW_DECODE");
+ HX_VISIT_MEMBER_NAME(MediaStreamTrack_obj::ULAW_EXP,"ULAW_EXP");
+};
+
+#endif
+
+::hx::Class MediaStreamTrack_obj::__mClass;
+
+static ::String MediaStreamTrack_obj_sStaticFields[] = {
+ HX_("ULAW_DECODE",60,bf,4c,65),
+ HX_("ULAW_EXP",0b,ff,2d,aa),
+ HX_("pcmToUlaw",e2,c0,b9,d4),
+ ::String(null())
+};
+
+void MediaStreamTrack_obj::__register()
+{
+ MediaStreamTrack_obj _hx_dummy;
+ MediaStreamTrack_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.jingle.MediaStreamTrack",73,fe,80,a9);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &MediaStreamTrack_obj::__GetStatic;
+ __mClass->mSetStaticField = &MediaStreamTrack_obj::__SetStatic;
+ __mClass->mMarkFunc = MediaStreamTrack_obj_sMarkStatics;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(MediaStreamTrack_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(MediaStreamTrack_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< MediaStreamTrack_obj >;
+#ifdef HXCPP_VISIT_ALLOCS
+ __mClass->mVisitFunc = MediaStreamTrack_obj_sVisitStatics;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = MediaStreamTrack_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = MediaStreamTrack_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void MediaStreamTrack_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_199cfc803453bfcf_337_boot)
+HXDLIN( 337) __mClass->__meta__ = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("fields",79,8e,8e,80), ::Dynamic(::hx::Anon_obj::Create(10)
+ ->setFixed(0,HX_("addReadyForPCMListener__fromC",12,d4,0d,83), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(1,HX_("addPCMListener__fromC",0c,37,47,87), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(2,HX_("addPCMListener",0d,a5,23,cf), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(3,HX_("addReadyForPCMListener",47,a3,46,de), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(4,HX_("muted__fromC",6e,74,c6,07), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(5,HX_("writePCM__fromC",5e,8e,24,22), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(6,HX_("writePCM",7b,97,f5,23), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(7,HX_("kind__fromC",a5,21,de,27), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(8,HX_("id__fromC",fe,15,a5,4d), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(9,HX_("supportedAudioFormats__fromC",85,70,15,69), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null()))))));
+ }
+{
+ HX_STACKFRAME(&_hx_pos_199cfc803453bfcf_470_boot)
+HXDLIN( 470) ULAW_DECODE = ::Array_obj< short >::fromData( _hx_array_data_a980fe73_39,256);
+ }
+{
+ HX_STACKFRAME(&_hx_pos_199cfc803453bfcf_471_boot)
+HXDLIN( 471) ULAW_EXP = ::Array_obj< unsigned char >::fromData( _hx_array_data_a980fe73_41,128);
+ }
+}
+
+} // end namespace snikket
+} // end namespace jingle
diff --git a/Sources/c_snikket/src/snikket/jingle/OutgoingProposedSession.cpp b/Sources/c_snikket/src/snikket/jingle/OutgoingProposedSession.cpp
new file mode 100644
index 0000000..7dacaf6
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/jingle/OutgoingProposedSession.cpp
@@ -0,0 +1,563 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_Log
+#include <haxe/Log.h>
+#endif
+#ifndef INCLUDED_haxe_ds_StringMap
+#include <haxe/ds/StringMap.h>
+#endif
+#ifndef INCLUDED_snikket_Chat
+#include <snikket/Chat.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessage
+#include <snikket/ChatMessage.h>
+#endif
+#ifndef INCLUDED_snikket_Client
+#include <snikket/Client.h>
+#endif
+#ifndef INCLUDED_snikket_DirectChat
+#include <snikket/DirectChat.h>
+#endif
+#ifndef INCLUDED_snikket_EventEmitter
+#include <snikket/EventEmitter.h>
+#endif
+#ifndef INCLUDED_snikket_EventResult
+#include <snikket/EventResult.h>
+#endif
+#ifndef INCLUDED_snikket_ID
+#include <snikket/ID.h>
+#endif
+#ifndef INCLUDED_snikket_JID
+#include <snikket/JID.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_DTMFSender
+#include <snikket/jingle/DTMFSender.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_InitiatedSession
+#include <snikket/jingle/InitiatedSession.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_MediaStream
+#include <snikket/jingle/MediaStream.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_MediaStreamTrack
+#include <snikket/jingle/MediaStreamTrack.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_OutgoingProposedSession
+#include <snikket/jingle/OutgoingProposedSession.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_OutgoingSession
+#include <snikket/jingle/OutgoingSession.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_Session
+#include <snikket/jingle/Session.h>
+#endif
+#ifndef INCLUDED_snikket_jingle__Session_Session_Fields_
+#include <snikket/jingle/_Session/Session_Fields_.h>
+#endif
+#ifndef INCLUDED_thenshim_Thenable
+#include <thenshim/Thenable.h>
+#endif
+#ifndef INCLUDED_thenshim__Promise_Promise_Impl_
+#include <thenshim/_Promise/Promise_Impl_.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_3d104e43c930d498_164_new,"snikket.jingle.OutgoingProposedSession","new",0x73d7b0aa,"snikket.jingle.OutgoingProposedSession.new","snikket/jingle/Session.hx",164,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_3d104e43c930d498_189_propose,"snikket.jingle.OutgoingProposedSession","propose",0x4884cc48,"snikket.jingle.OutgoingProposedSession.propose","snikket/jingle/Session.hx",189,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_3d104e43c930d498_178_propose,"snikket.jingle.OutgoingProposedSession","propose",0x4884cc48,"snikket.jingle.OutgoingProposedSession.propose","snikket/jingle/Session.hx",178,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_3d104e43c930d498_206_hangup,"snikket.jingle.OutgoingProposedSession","hangup",0x5911bc43,"snikket.jingle.OutgoingProposedSession.hangup","snikket/jingle/Session.hx",206,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_3d104e43c930d498_203_hangup,"snikket.jingle.OutgoingProposedSession","hangup",0x5911bc43,"snikket.jingle.OutgoingProposedSession.hangup","snikket/jingle/Session.hx",203,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_3d104e43c930d498_219_retract,"snikket.jingle.OutgoingProposedSession","retract",0x4b54af4b,"snikket.jingle.OutgoingProposedSession.retract","snikket/jingle/Session.hx",219,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_3d104e43c930d498_223_terminate,"snikket.jingle.OutgoingProposedSession","terminate",0x42b2662b,"snikket.jingle.OutgoingProposedSession.terminate","snikket/jingle/Session.hx",223,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_3d104e43c930d498_227_contentAdd,"snikket.jingle.OutgoingProposedSession","contentAdd",0x432a835e,"snikket.jingle.OutgoingProposedSession.contentAdd","snikket/jingle/Session.hx",227,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_3d104e43c930d498_231_contentAccept,"snikket.jingle.OutgoingProposedSession","contentAccept",0xd468a5eb,"snikket.jingle.OutgoingProposedSession.contentAccept","snikket/jingle/Session.hx",231,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_3d104e43c930d498_234_transportInfo,"snikket.jingle.OutgoingProposedSession","transportInfo",0xaa361d81,"snikket.jingle.OutgoingProposedSession.transportInfo","snikket/jingle/Session.hx",234,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_3d104e43c930d498_240_accept,"snikket.jingle.OutgoingProposedSession","accept",0xac187cfe,"snikket.jingle.OutgoingProposedSession.accept","snikket/jingle/Session.hx",240,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_3d104e43c930d498_243_initiate,"snikket.jingle.OutgoingProposedSession","initiate",0xd8683dcf,"snikket.jingle.OutgoingProposedSession.initiate","snikket/jingle/Session.hx",243,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_3d104e43c930d498_254_addMedia,"snikket.jingle.OutgoingProposedSession","addMedia",0xf7f1fe79,"snikket.jingle.OutgoingProposedSession.addMedia","snikket/jingle/Session.hx",254,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_3d104e43c930d498_258_callStatus,"snikket.jingle.OutgoingProposedSession","callStatus",0x3078db66,"snikket.jingle.OutgoingProposedSession.callStatus","snikket/jingle/Session.hx",258,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_3d104e43c930d498_262_videoTracks,"snikket.jingle.OutgoingProposedSession","videoTracks",0x2250fcad,"snikket.jingle.OutgoingProposedSession.videoTracks","snikket/jingle/Session.hx",262,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_3d104e43c930d498_266_dtmf,"snikket.jingle.OutgoingProposedSession","dtmf",0xe2521b5f,"snikket.jingle.OutgoingProposedSession.dtmf","snikket/jingle/Session.hx",266,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_3d104e43c930d498_270_get_sid,"snikket.jingle.OutgoingProposedSession","get_sid",0x756734ef,"snikket.jingle.OutgoingProposedSession.get_sid","snikket/jingle/Session.hx",270,0x6db2dd54)
+namespace snikket{
+namespace jingle{
+
+void OutgoingProposedSession_obj::__construct( ::snikket::Client client, ::snikket::JID to){
+ HX_STACKFRAME(&_hx_pos_3d104e43c930d498_164_new)
+HXLINE( 170) this->video = false;
+HXLINE( 169) this->audio = false;
+HXLINE( 173) this->client = client;
+HXLINE( 174) this->to = to;
+HXLINE( 175) this->_sid = ::snikket::ID_obj::_hx_long();
+ }
+
+Dynamic OutgoingProposedSession_obj::__CreateEmpty() { return new OutgoingProposedSession_obj; }
+
+void *OutgoingProposedSession_obj::_hx_vtable = 0;
+
+Dynamic OutgoingProposedSession_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< OutgoingProposedSession_obj > _hx_result = new OutgoingProposedSession_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1]);
+ return _hx_result;
+}
+
+bool OutgoingProposedSession_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x4349a55a;
+}
+
+static ::snikket::jingle::Session_obj _hx_snikket_jingle_OutgoingProposedSession__hx_snikket_jingle_Session= {
+ ( ::String (::hx::Object::*)())&::snikket::jingle::OutgoingProposedSession_obj::get_sid,
+ ( ::snikket::jingle::InitiatedSession (::hx::Object::*)( ::snikket::Stanza))&::snikket::jingle::OutgoingProposedSession_obj::initiate_ef691953,
+ ( void (::hx::Object::*)())&::snikket::jingle::OutgoingProposedSession_obj::accept,
+ ( void (::hx::Object::*)())&::snikket::jingle::OutgoingProposedSession_obj::hangup,
+ ( void (::hx::Object::*)())&::snikket::jingle::OutgoingProposedSession_obj::retract,
+ ( void (::hx::Object::*)())&::snikket::jingle::OutgoingProposedSession_obj::terminate,
+ ( void (::hx::Object::*)( ::snikket::Stanza))&::snikket::jingle::OutgoingProposedSession_obj::contentAdd,
+ ( void (::hx::Object::*)( ::snikket::Stanza))&::snikket::jingle::OutgoingProposedSession_obj::contentAccept,
+ ( ::Dynamic (::hx::Object::*)( ::snikket::Stanza))&::snikket::jingle::OutgoingProposedSession_obj::transportInfo,
+ ( void (::hx::Object::*)(::Array< ::Dynamic>))&::snikket::jingle::OutgoingProposedSession_obj::addMedia,
+ ( ::String (::hx::Object::*)())&::snikket::jingle::OutgoingProposedSession_obj::callStatus,
+ ( ::Array< ::Dynamic> (::hx::Object::*)())&::snikket::jingle::OutgoingProposedSession_obj::videoTracks,
+ ( ::snikket::jingle::DTMFSender (::hx::Object::*)())&::snikket::jingle::OutgoingProposedSession_obj::dtmf,
+};
+
+ ::snikket::jingle::InitiatedSession OutgoingProposedSession_obj::initiate_ef691953( ::snikket::Stanza stanza) {
+ return initiate(stanza);
+}
+void *OutgoingProposedSession_obj::_hx_getInterface(int inHash) {
+ switch(inHash) {
+ case (int)0x79d60748: return &_hx_snikket_jingle_OutgoingProposedSession__hx_snikket_jingle_Session;
+ }
+ #ifdef HXCPP_SCRIPTABLE
+ return super::_hx_getInterface(inHash);
+ #else
+ return 0;
+ #endif
+}
+
+void OutgoingProposedSession_obj::propose(bool audio,bool video){
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_0, ::snikket::jingle::OutgoingProposedSession,_gthis, ::snikket::Stanza,event, ::snikket::ChatMessage,msg) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> stored){
+ HX_GC_STACKFRAME(&_hx_pos_3d104e43c930d498_189_propose)
+HXLINE( 190) ::String stanza = _gthis->to->asString();
+HXDLIN( 190) ::snikket::Stanza stanza1 = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("message",c7,35,11,9a), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("id",db,5b,00,00),msg->localId)
+ ->setFixed(1,HX_("to",7b,65,00,00),stanza)
+ ->setFixed(2,HX_("type",ba,f2,08,4d),HX_("chat",d8,5e,bf,41))))->addChild(event)->tag(HX_("store",e1,13,16,84), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:hints",70,b3,d6,fe))));
+HXLINE( 193) _gthis->client->sendStanza(stanza1);
+HXLINE( 194) _gthis->client->notifyMessageHandlers(stored->__get(0).StaticCast< ::snikket::ChatMessage >(),0);
+HXLINE( 195) ::snikket::Client _gthis1 = _gthis->client;
+HXDLIN( 195) _gthis1->trigger(HX_("call/ringing",81,75,54,f9), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("chatId",d3,04,77,b7),_gthis->to->asBare()->asString())));
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_3d104e43c930d498_178_propose)
+HXDLIN( 178) ::snikket::jingle::OutgoingProposedSession _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 179) this->audio = audio;
+HXLINE( 180) this->video = video;
+HXLINE( 181) ::snikket::Stanza event = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("propose",fe,fe,e9,f9), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("id",db,5b,00,00),this->get_sid())
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:jingle-message:0",fd,20,a5,07))));
+HXLINE( 182) if (audio) {
+HXLINE( 183) event->tag(HX_("description",fc,08,1d,5f), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("media",e4,04,bc,05),HX_("audio",d6,78,80,27))
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:jingle:apps:rtp:1",ea,41,fe,5c))))->up();
+ }
+HXLINE( 185) if (video) {
+HXLINE( 186) event->tag(HX_("description",fc,08,1d,5f), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("media",e4,04,bc,05),HX_("video",7b,14,fc,36))
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:jingle:apps:rtp:1",ea,41,fe,5c))))->up();
+ }
+HXLINE( 188) ::snikket::ChatMessage msg = ::snikket::jingle::_Session::Session_Fields__obj::mkCallMessage(this->to,this->client->jid,event);
+HXLINE( 189) this->client->storeMessages(::Array_obj< ::Dynamic>::__new(1)->init(0,msg), ::Dynamic(new _hx_Closure_0(_gthis,event,msg)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(OutgoingProposedSession_obj,propose,(void))
+
+void OutgoingProposedSession_obj::hangup(){
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_0, ::snikket::jingle::OutgoingProposedSession,_gthis, ::snikket::Stanza,event, ::snikket::ChatMessage,msg) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> stored){
+ HX_GC_STACKFRAME(&_hx_pos_3d104e43c930d498_206_hangup)
+HXLINE( 207) ::snikket::Client _gthis1 = _gthis->client;
+HXLINE( 208) ::String _hx_tmp = _gthis->to->asString();
+HXLINE( 207) _gthis1->sendStanza( ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("message",c7,35,11,9a), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("id",db,5b,00,00),msg->versions->__get(0).StaticCast< ::snikket::ChatMessage >()->localId)
+ ->setFixed(1,HX_("to",7b,65,00,00),_hx_tmp)
+ ->setFixed(2,HX_("type",ba,f2,08,4d),HX_("chat",d8,5e,bf,41))))->addChild(event)->tag(HX_("store",e1,13,16,84), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:hints",70,b3,d6,fe)))));
+HXLINE( 212) _gthis->client->notifyMessageHandlers(stored->__get(0).StaticCast< ::snikket::ChatMessage >(),1);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_3d104e43c930d498_203_hangup)
+HXDLIN( 203) ::snikket::jingle::OutgoingProposedSession _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 204) ::snikket::Stanza event = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("retract",01,e2,b9,fc), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("id",db,5b,00,00),this->get_sid())
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:jingle-message:0",fd,20,a5,07))));
+HXLINE( 205) ::snikket::ChatMessage msg = ::snikket::jingle::_Session::Session_Fields__obj::mkCallMessage(this->to,this->client->jid,event);
+HXLINE( 206) this->client->storeMessages(::Array_obj< ::Dynamic>::__new(1)->init(0,msg), ::Dynamic(new _hx_Closure_0(_gthis,event,msg)));
+HXLINE( 214) {
+HXLINE( 214) ::snikket::Client this1 = this->client;
+HXDLIN( 214) ::Dynamic this2 = this1->getDirectChat(this->to->asBare()->asString(),false)->jingleSessions;
+HXDLIN( 214) ( ( ::haxe::ds::StringMap)(this2) )->remove(this->get_sid());
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(OutgoingProposedSession_obj,hangup,(void))
+
+void OutgoingProposedSession_obj::retract(){
+ HX_STACKFRAME(&_hx_pos_3d104e43c930d498_219_retract)
+HXDLIN( 219) ::snikket::Client _hx_tmp = this->client;
+HXDLIN( 219) _hx_tmp->trigger(HX_("call/retract",50,bc,8d,db), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("chatId",d3,04,77,b7),this->to->asBare()->asString())));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(OutgoingProposedSession_obj,retract,(void))
+
+void OutgoingProposedSession_obj::terminate(){
+ HX_STACKFRAME(&_hx_pos_3d104e43c930d498_223_terminate)
+HXDLIN( 223) ::Dynamic _hx_tmp = ::haxe::Log_obj::trace;
+HXDLIN( 223) ::String _hx_tmp1 = (HX_("Tried to terminate before session-initiate: ",a9,d4,f3,a4) + this->get_sid());
+HXDLIN( 223) _hx_tmp(_hx_tmp1, ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.jingle.OutgoingProposedSession",b8,d3,7b,fd))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,::hx::ObjectPtr<OBJ_>(this)))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("terminate",61,32,d2,fd))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/jingle/Session.hx",54,dd,b2,6d))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),223)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(OutgoingProposedSession_obj,terminate,(void))
+
+void OutgoingProposedSession_obj::contentAdd( ::snikket::Stanza _){
+ HX_STACKFRAME(&_hx_pos_3d104e43c930d498_227_contentAdd)
+HXDLIN( 227) ::Dynamic _hx_tmp = ::haxe::Log_obj::trace;
+HXDLIN( 227) ::String _hx_tmp1 = (HX_("Got content-add before session-initiate: ",10,d3,fa,8a) + this->get_sid());
+HXDLIN( 227) _hx_tmp(_hx_tmp1, ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.jingle.OutgoingProposedSession",b8,d3,7b,fd))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,::hx::ObjectPtr<OBJ_>(this)))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("contentAdd",68,66,dd,43))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/jingle/Session.hx",54,dd,b2,6d))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),227)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(OutgoingProposedSession_obj,contentAdd,(void))
+
+void OutgoingProposedSession_obj::contentAccept( ::snikket::Stanza _){
+ HX_STACKFRAME(&_hx_pos_3d104e43c930d498_231_contentAccept)
+HXDLIN( 231) ::Dynamic _hx_tmp = ::haxe::Log_obj::trace;
+HXDLIN( 231) ::String _hx_tmp1 = (HX_("Got content-accept before session-initiate: ",47,72,87,71) + this->get_sid());
+HXDLIN( 231) _hx_tmp(_hx_tmp1, ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.jingle.OutgoingProposedSession",b8,d3,7b,fd))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,::hx::ObjectPtr<OBJ_>(this)))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("contentAccept",21,c5,01,e1))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/jingle/Session.hx",54,dd,b2,6d))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),231)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(OutgoingProposedSession_obj,contentAccept,(void))
+
+::Dynamic OutgoingProposedSession_obj::transportInfo( ::snikket::Stanza _){
+ HX_STACKFRAME(&_hx_pos_3d104e43c930d498_234_transportInfo)
+HXLINE( 235) ::Dynamic _hx_tmp = ::haxe::Log_obj::trace;
+HXDLIN( 235) ::String _hx_tmp1 = (HX_("Got transport-info before session-initiate: ",bd,bd,9d,08) + this->get_sid());
+HXDLIN( 235) _hx_tmp(_hx_tmp1, ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.jingle.OutgoingProposedSession",b8,d3,7b,fd))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,::hx::ObjectPtr<OBJ_>(this)))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("transportInfo",b7,3c,cf,b6))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/jingle/Session.hx",54,dd,b2,6d))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),235)));
+HXLINE( 236) return ::thenshim::_Promise::Promise_Impl__obj::resolve(null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(OutgoingProposedSession_obj,transportInfo,return )
+
+void OutgoingProposedSession_obj::accept(){
+ HX_STACKFRAME(&_hx_pos_3d104e43c930d498_240_accept)
+HXDLIN( 240) ::Dynamic _hx_tmp = ::haxe::Log_obj::trace;
+HXDLIN( 240) ::String _hx_tmp1 = (HX_("Tried to accept before initiate: ",77,4a,a0,ec) + this->get_sid());
+HXDLIN( 240) _hx_tmp(_hx_tmp1, ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.jingle.OutgoingProposedSession",b8,d3,7b,fd))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,::hx::ObjectPtr<OBJ_>(this)))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("accept",08,93,06,0b))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/jingle/Session.hx",54,dd,b2,6d))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),240)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(OutgoingProposedSession_obj,accept,(void))
+
+ ::snikket::jingle::OutgoingSession OutgoingProposedSession_obj::initiate( ::snikket::Stanza stanza){
+ HX_GC_STACKFRAME(&_hx_pos_3d104e43c930d498_243_initiate)
+HXLINE( 244) ::snikket::Stanza jmi = stanza->getChild(HX_("proceed",2e,96,4a,f1),HX_("urn:xmpp:jingle-message:0",fd,20,a5,07));
+HXLINE( 245) if (::hx::IsNull( jmi )) {
+HXLINE( 245) HX_STACK_DO_THROW((HX_("no jmi: ",4d,b1,bc,b7) + ::Std_obj::string(stanza)));
+ }
+HXLINE( 246) ::String _hx_tmp = ( (::String)(::Reflect_obj::field(jmi->attr,HX_("id",db,5b,00,00))) );
+HXDLIN( 246) if ((_hx_tmp != this->get_sid())) {
+HXLINE( 246) ::String _hx_tmp1 = ((HX_("sid doesn't match: ",3b,d7,99,76) + ( (::String)(::Reflect_obj::field(jmi->attr,HX_("id",db,5b,00,00))) )) + HX_(" vs ",23,c2,80,15));
+HXDLIN( 246) HX_STACK_DO_THROW((_hx_tmp1 + this->get_sid()));
+ }
+HXLINE( 247) ::snikket::Client _hx_tmp2 = this->client;
+HXDLIN( 247) _hx_tmp2->sendPresence(this->to->asString(),null());
+HXLINE( 248) ::snikket::Client session = this->client;
+HXDLIN( 248) ::snikket::JID session1 = ::snikket::JID_obj::parse(( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) ));
+HXDLIN( 248) ::snikket::jingle::OutgoingSession session2 = ::snikket::jingle::OutgoingSession_obj::__alloc( HX_CTX ,session,session1,this->get_sid());
+HXLINE( 249) this->client->trigger(HX_("call/media",73,5d,1d,c7), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("session",56,17,98,93),session2)
+ ->setFixed(1,HX_("audio",d6,78,80,27),this->audio)
+ ->setFixed(2,HX_("video",7b,14,fc,36),this->video)));
+HXLINE( 250) return session2;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(OutgoingProposedSession_obj,initiate,return )
+
+void OutgoingProposedSession_obj::addMedia(::Array< ::Dynamic> _){
+ HX_STACKFRAME(&_hx_pos_3d104e43c930d498_254_addMedia)
+HXDLIN( 254) HX_STACK_DO_THROW(HX_("Cannot add media before call starts",aa,0a,79,d5));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(OutgoingProposedSession_obj,addMedia,(void))
+
+::String OutgoingProposedSession_obj::callStatus(){
+ HX_STACKFRAME(&_hx_pos_3d104e43c930d498_258_callStatus)
+HXDLIN( 258) return HX_("outgoing",6c,18,89,c7);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(OutgoingProposedSession_obj,callStatus,return )
+
+::Array< ::Dynamic> OutgoingProposedSession_obj::videoTracks(){
+ HX_STACKFRAME(&_hx_pos_3d104e43c930d498_262_videoTracks)
+HXDLIN( 262) return ::Array_obj< ::Dynamic>::__new(0);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(OutgoingProposedSession_obj,videoTracks,return )
+
+ ::snikket::jingle::DTMFSender OutgoingProposedSession_obj::dtmf(){
+ HX_STACKFRAME(&_hx_pos_3d104e43c930d498_266_dtmf)
+HXDLIN( 266) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(OutgoingProposedSession_obj,dtmf,return )
+
+::String OutgoingProposedSession_obj::get_sid(){
+ HX_STACKFRAME(&_hx_pos_3d104e43c930d498_270_get_sid)
+HXDLIN( 270) return this->_sid;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(OutgoingProposedSession_obj,get_sid,return )
+
+
+::hx::ObjectPtr< OutgoingProposedSession_obj > OutgoingProposedSession_obj::__new( ::snikket::Client client, ::snikket::JID to) {
+ ::hx::ObjectPtr< OutgoingProposedSession_obj > __this = new OutgoingProposedSession_obj();
+ __this->__construct(client,to);
+ return __this;
+}
+
+::hx::ObjectPtr< OutgoingProposedSession_obj > OutgoingProposedSession_obj::__alloc(::hx::Ctx *_hx_ctx, ::snikket::Client client, ::snikket::JID to) {
+ OutgoingProposedSession_obj *__this = (OutgoingProposedSession_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(OutgoingProposedSession_obj), true, "snikket.jingle.OutgoingProposedSession"));
+ *(void **)__this = OutgoingProposedSession_obj::_hx_vtable;
+ __this->__construct(client,to);
+ return __this;
+}
+
+OutgoingProposedSession_obj::OutgoingProposedSession_obj()
+{
+}
+
+void OutgoingProposedSession_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(OutgoingProposedSession);
+ HX_MARK_MEMBER_NAME(sid,"sid");
+ HX_MARK_MEMBER_NAME(client,"client");
+ HX_MARK_MEMBER_NAME(to,"to");
+ HX_MARK_MEMBER_NAME(_sid,"_sid");
+ HX_MARK_MEMBER_NAME(audio,"audio");
+ HX_MARK_MEMBER_NAME(video,"video");
+ HX_MARK_END_CLASS();
+}
+
+void OutgoingProposedSession_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(sid,"sid");
+ HX_VISIT_MEMBER_NAME(client,"client");
+ HX_VISIT_MEMBER_NAME(to,"to");
+ HX_VISIT_MEMBER_NAME(_sid,"_sid");
+ HX_VISIT_MEMBER_NAME(audio,"audio");
+ HX_VISIT_MEMBER_NAME(video,"video");
+}
+
+::hx::Val OutgoingProposedSession_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 2:
+ if (HX_FIELD_EQ(inName,"to") ) { return ::hx::Val( to ); }
+ break;
+ case 3:
+ if (HX_FIELD_EQ(inName,"sid") ) { return ::hx::Val( inCallProp == ::hx::paccAlways ? get_sid() : sid ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"_sid") ) { return ::hx::Val( _sid ); }
+ if (HX_FIELD_EQ(inName,"dtmf") ) { return ::hx::Val( dtmf_dyn() ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"audio") ) { return ::hx::Val( audio ); }
+ if (HX_FIELD_EQ(inName,"video") ) { return ::hx::Val( video ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"client") ) { return ::hx::Val( client ); }
+ if (HX_FIELD_EQ(inName,"hangup") ) { return ::hx::Val( hangup_dyn() ); }
+ if (HX_FIELD_EQ(inName,"accept") ) { return ::hx::Val( accept_dyn() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"propose") ) { return ::hx::Val( propose_dyn() ); }
+ if (HX_FIELD_EQ(inName,"retract") ) { return ::hx::Val( retract_dyn() ); }
+ if (HX_FIELD_EQ(inName,"get_sid") ) { return ::hx::Val( get_sid_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"initiate") ) { return ::hx::Val( initiate_dyn() ); }
+ if (HX_FIELD_EQ(inName,"addMedia") ) { return ::hx::Val( addMedia_dyn() ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"terminate") ) { return ::hx::Val( terminate_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"contentAdd") ) { return ::hx::Val( contentAdd_dyn() ); }
+ if (HX_FIELD_EQ(inName,"callStatus") ) { return ::hx::Val( callStatus_dyn() ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"videoTracks") ) { return ::hx::Val( videoTracks_dyn() ); }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"contentAccept") ) { return ::hx::Val( contentAccept_dyn() ); }
+ if (HX_FIELD_EQ(inName,"transportInfo") ) { return ::hx::Val( transportInfo_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val OutgoingProposedSession_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 2:
+ if (HX_FIELD_EQ(inName,"to") ) { to=inValue.Cast< ::snikket::JID >(); return inValue; }
+ break;
+ case 3:
+ if (HX_FIELD_EQ(inName,"sid") ) { sid=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"_sid") ) { _sid=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"audio") ) { audio=inValue.Cast< bool >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"video") ) { video=inValue.Cast< bool >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"client") ) { client=inValue.Cast< ::snikket::Client >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void OutgoingProposedSession_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("sid",0e,9f,57,00));
+ outFields->push(HX_("client",4b,ca,4f,0a));
+ outFields->push(HX_("to",7b,65,00,00));
+ outFields->push(HX_("_sid",0f,e4,22,3f));
+ outFields->push(HX_("audio",d6,78,80,27));
+ outFields->push(HX_("video",7b,14,fc,36));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo OutgoingProposedSession_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(OutgoingProposedSession_obj,sid),HX_("sid",0e,9f,57,00)},
+ {::hx::fsObject /* ::snikket::Client */ ,(int)offsetof(OutgoingProposedSession_obj,client),HX_("client",4b,ca,4f,0a)},
+ {::hx::fsObject /* ::snikket::JID */ ,(int)offsetof(OutgoingProposedSession_obj,to),HX_("to",7b,65,00,00)},
+ {::hx::fsString,(int)offsetof(OutgoingProposedSession_obj,_sid),HX_("_sid",0f,e4,22,3f)},
+ {::hx::fsBool,(int)offsetof(OutgoingProposedSession_obj,audio),HX_("audio",d6,78,80,27)},
+ {::hx::fsBool,(int)offsetof(OutgoingProposedSession_obj,video),HX_("video",7b,14,fc,36)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *OutgoingProposedSession_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String OutgoingProposedSession_obj_sMemberFields[] = {
+ HX_("sid",0e,9f,57,00),
+ HX_("client",4b,ca,4f,0a),
+ HX_("to",7b,65,00,00),
+ HX_("_sid",0f,e4,22,3f),
+ HX_("audio",d6,78,80,27),
+ HX_("video",7b,14,fc,36),
+ HX_("propose",fe,fe,e9,f9),
+ HX_("hangup",4d,d2,ff,b7),
+ HX_("retract",01,e2,b9,fc),
+ HX_("terminate",61,32,d2,fd),
+ HX_("contentAdd",68,66,dd,43),
+ HX_("contentAccept",21,c5,01,e1),
+ HX_("transportInfo",b7,3c,cf,b6),
+ HX_("accept",08,93,06,0b),
+ HX_("initiate",59,6a,8f,5f),
+ HX_("addMedia",03,2b,19,7f),
+ HX_("callStatus",70,be,2b,31),
+ HX_("videoTracks",63,c2,24,be),
+ HX_("dtmf",e9,ba,71,42),
+ HX_("get_sid",a5,67,cc,26),
+ ::String(null()) };
+
+::hx::Class OutgoingProposedSession_obj::__mClass;
+
+void OutgoingProposedSession_obj::__register()
+{
+ OutgoingProposedSession_obj _hx_dummy;
+ OutgoingProposedSession_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.jingle.OutgoingProposedSession",b8,d3,7b,fd);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(OutgoingProposedSession_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< OutgoingProposedSession_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = OutgoingProposedSession_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = OutgoingProposedSession_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace jingle
diff --git a/Sources/c_snikket/src/snikket/jingle/OutgoingSession.cpp b/Sources/c_snikket/src/snikket/jingle/OutgoingSession.cpp
new file mode 100644
index 0000000..aa2da4a
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/jingle/OutgoingSession.cpp
@@ -0,0 +1,164 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_Client
+#include <snikket/Client.h>
+#endif
+#ifndef INCLUDED_snikket_EventEmitter
+#include <snikket/EventEmitter.h>
+#endif
+#ifndef INCLUDED_snikket_JID
+#include <snikket/JID.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_InitiatedSession
+#include <snikket/jingle/InitiatedSession.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_OutgoingSession
+#include <snikket/jingle/OutgoingSession.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_PeerConnection
+#include <snikket/jingle/PeerConnection.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_Session
+#include <snikket/jingle/Session.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_SessionDescription
+#include <snikket/jingle/SessionDescription.h>
+#endif
+#ifndef INCLUDED_thenshim_Thenable
+#include <thenshim/Thenable.h>
+#endif
+#ifndef INCLUDED_thenshim__Promise_Promise_Impl_
+#include <thenshim/_Promise/Promise_Impl_.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_4d1e8fd6f72343e8_615_new,"snikket.jingle.OutgoingSession","new",0xd3491ab0,"snikket.jingle.OutgoingSession.new","snikket/jingle/Session.hx",615,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_4d1e8fd6f72343e8_619_onPeerConnection,"snikket.jingle.OutgoingSession","onPeerConnection",0xa4a0358f,"snikket.jingle.OutgoingSession.onPeerConnection","snikket/jingle/Session.hx",619,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_4d1e8fd6f72343e8_626_initiate,"snikket.jingle.OutgoingSession","initiate",0x19babe09,"snikket.jingle.OutgoingSession.initiate","snikket/jingle/Session.hx",626,0x6db2dd54)
+HX_LOCAL_STACK_FRAME(_hx_pos_4d1e8fd6f72343e8_622_initiate,"snikket.jingle.OutgoingSession","initiate",0x19babe09,"snikket.jingle.OutgoingSession.initiate","snikket/jingle/Session.hx",622,0x6db2dd54)
+namespace snikket{
+namespace jingle{
+
+void OutgoingSession_obj::__construct( ::snikket::Client client, ::snikket::JID counterpart,::String sid){
+ HX_STACKFRAME(&_hx_pos_4d1e8fd6f72343e8_615_new)
+HXDLIN( 615) super::__construct(client,counterpart,sid,null());
+ }
+
+Dynamic OutgoingSession_obj::__CreateEmpty() { return new OutgoingSession_obj; }
+
+void *OutgoingSession_obj::_hx_vtable = 0;
+
+Dynamic OutgoingSession_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< OutgoingSession_obj > _hx_result = new OutgoingSession_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2]);
+ return _hx_result;
+}
+
+bool OutgoingSession_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x050f75b9) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x050f75b9;
+ } else {
+ return inClassId==(int)0x43b8b0fc;
+ }
+}
+
+::Dynamic OutgoingSession_obj::onPeerConnection(){
+ HX_STACKFRAME(&_hx_pos_4d1e8fd6f72343e8_619_onPeerConnection)
+HXDLIN( 619) return this->setupLocalDescription(HX_("session-initiate",70,2d,30,f7),null(),null(),null());
+ }
+
+
+ ::snikket::jingle::OutgoingSession OutgoingSession_obj::initiate( ::snikket::Stanza stanza){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0, ::snikket::jingle::OutgoingSession,_gthis, ::snikket::Stanza,stanza) HXARGC(1)
+ ::Dynamic _hx_run( ::Dynamic _){
+ HX_STACKFRAME(&_hx_pos_4d1e8fd6f72343e8_626_initiate)
+HXLINE( 626) return _gthis->transportInfo(stanza);
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_4d1e8fd6f72343e8_622_initiate)
+HXDLIN( 622) ::snikket::jingle::OutgoingSession _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 623) this->remoteDescription = ::snikket::jingle::SessionDescription_obj::fromStanza(stanza,true,null());
+HXLINE( 624) this->peerDtlsSetup = this->remoteDescription->getDtlsSetup();
+HXLINE( 625) ::snikket::jingle::PeerConnection _hx_tmp = this->pc;
+HXDLIN( 625) ::thenshim::_Promise::Promise_Impl__obj::then(_hx_tmp->setRemoteDescription( ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("sdp",bf,9a,57,00),this->remoteDescription->toSdp())
+ ->setFixed(1,HX_("type",ba,f2,08,4d),cpp::Struct(rtc::Description::Type::Answer)))), ::Dynamic(new _hx_Closure_0(_gthis,stanza)),null());
+HXLINE( 627) return ::hx::ObjectPtr<OBJ_>(this);
+ }
+
+
+
+::hx::ObjectPtr< OutgoingSession_obj > OutgoingSession_obj::__new( ::snikket::Client client, ::snikket::JID counterpart,::String sid) {
+ ::hx::ObjectPtr< OutgoingSession_obj > __this = new OutgoingSession_obj();
+ __this->__construct(client,counterpart,sid);
+ return __this;
+}
+
+::hx::ObjectPtr< OutgoingSession_obj > OutgoingSession_obj::__alloc(::hx::Ctx *_hx_ctx, ::snikket::Client client, ::snikket::JID counterpart,::String sid) {
+ OutgoingSession_obj *__this = (OutgoingSession_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(OutgoingSession_obj), true, "snikket.jingle.OutgoingSession"));
+ *(void **)__this = OutgoingSession_obj::_hx_vtable;
+ __this->__construct(client,counterpart,sid);
+ return __this;
+}
+
+OutgoingSession_obj::OutgoingSession_obj()
+{
+}
+
+::hx::Val OutgoingSession_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 8:
+ if (HX_FIELD_EQ(inName,"initiate") ) { return ::hx::Val( initiate_dyn() ); }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"onPeerConnection") ) { return ::hx::Val( onPeerConnection_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *OutgoingSession_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *OutgoingSession_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String OutgoingSession_obj_sMemberFields[] = {
+ HX_("onPeerConnection",df,b1,71,fc),
+ HX_("initiate",59,6a,8f,5f),
+ ::String(null()) };
+
+::hx::Class OutgoingSession_obj::__mClass;
+
+void OutgoingSession_obj::__register()
+{
+ OutgoingSession_obj _hx_dummy;
+ OutgoingSession_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.jingle.OutgoingSession",be,42,22,a3);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(OutgoingSession_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< OutgoingSession_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = OutgoingSession_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = OutgoingSession_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace jingle
diff --git a/Sources/c_snikket/src/snikket/jingle/PeerConnection.cpp b/Sources/c_snikket/src/snikket/jingle/PeerConnection.cpp
new file mode 100644
index 0000000..018c92e
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/jingle/PeerConnection.cpp
@@ -0,0 +1,767 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_31a7389c9269a947
+#define INCLUDED_31a7389c9269a947
+#include "hx/StdString.h"
+#endif
+#ifndef INCLUDED_0e487a29b6aa8a9b
+#define INCLUDED_0e487a29b6aa8a9b
+#include "rtc/rtc.hpp"
+#endif
+#ifndef INCLUDED_Lambda
+#include <Lambda.h>
+#endif
+#ifndef INCLUDED_Sys
+#include <Sys.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_StringMap
+#include <haxe/ds/StringMap.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_DTMFSender
+#include <snikket/jingle/DTMFSender.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_MediaStream
+#include <snikket/jingle/MediaStream.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_MediaStreamTrack
+#include <snikket/jingle/MediaStreamTrack.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_PeerConnection
+#include <snikket/jingle/PeerConnection.h>
+#endif
+#ifndef INCLUDED_sys_thread_EventLoop
+#include <sys/thread/EventLoop.h>
+#endif
+#ifndef INCLUDED_sys_thread__Thread_HaxeThread
+#include <sys/thread/_Thread/HaxeThread.h>
+#endif
+#ifndef INCLUDED_sys_thread__Thread_Thread_Impl_
+#include <sys/thread/_Thread/Thread_Impl_.h>
+#endif
+#ifndef INCLUDED_thenshim_Thenable
+#include <thenshim/Thenable.h>
+#endif
+#ifndef INCLUDED_thenshim__Promise_Promise_Impl_
+#include <thenshim/_Promise/Promise_Impl_.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_8cd3f69017bd5103_768_new,"snikket.jingle.PeerConnection","new",0x0e347f5e,"snikket.jingle.PeerConnection.new","snikket/jingle/PeerConnection.cpp.hx",768,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_8cd3f69017bd5103_816_onLocalDescription,"snikket.jingle.PeerConnection","onLocalDescription",0x9c63d352,"snikket.jingle.PeerConnection.onLocalDescription","snikket/jingle/PeerConnection.cpp.hx",816,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_8cd3f69017bd5103_814_onLocalDescription,"snikket.jingle.PeerConnection","onLocalDescription",0x9c63d352,"snikket.jingle.PeerConnection.onLocalDescription","snikket/jingle/PeerConnection.cpp.hx",814,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_8cd3f69017bd5103_828_onLocalCandidate,"snikket.jingle.PeerConnection","onLocalCandidate",0xfc129d19,"snikket.jingle.PeerConnection.onLocalCandidate","snikket/jingle/PeerConnection.cpp.hx",828,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_8cd3f69017bd5103_825_onLocalCandidate,"snikket.jingle.PeerConnection","onLocalCandidate",0xfc129d19,"snikket.jingle.PeerConnection.onLocalCandidate","snikket/jingle/PeerConnection.cpp.hx",825,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_8cd3f69017bd5103_843_onStateChange,"snikket.jingle.PeerConnection","onStateChange",0xc45a9400,"snikket.jingle.PeerConnection.onStateChange","snikket/jingle/PeerConnection.cpp.hx",843,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_8cd3f69017bd5103_840_onStateChange,"snikket.jingle.PeerConnection","onStateChange",0xc45a9400,"snikket.jingle.PeerConnection.onStateChange","snikket/jingle/PeerConnection.cpp.hx",840,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_8cd3f69017bd5103_851_onGatheringStateChange,"snikket.jingle.PeerConnection","onGatheringStateChange",0x35b9a25b,"snikket.jingle.PeerConnection.onGatheringStateChange","snikket/jingle/PeerConnection.cpp.hx",851,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_8cd3f69017bd5103_856_onGatheringStateChange,"snikket.jingle.PeerConnection","onGatheringStateChange",0x35b9a25b,"snikket.jingle.PeerConnection.onGatheringStateChange","snikket/jingle/PeerConnection.cpp.hx",856,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_8cd3f69017bd5103_868_onTrack,"snikket.jingle.PeerConnection","onTrack",0x22f432ea,"snikket.jingle.PeerConnection.onTrack","snikket/jingle/PeerConnection.cpp.hx",868,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_8cd3f69017bd5103_867_onTrack,"snikket.jingle.PeerConnection","onTrack",0x22f432ea,"snikket.jingle.PeerConnection.onTrack","snikket/jingle/PeerConnection.cpp.hx",867,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_8cd3f69017bd5103_865_onTrack,"snikket.jingle.PeerConnection","onTrack",0x22f432ea,"snikket.jingle.PeerConnection.onTrack","snikket/jingle/PeerConnection.cpp.hx",865,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_8cd3f69017bd5103_885_get_connectionState,"snikket.jingle.PeerConnection","get_connectionState",0x98e8f328,"snikket.jingle.PeerConnection.get_connectionState","snikket/jingle/PeerConnection.cpp.hx",885,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_8cd3f69017bd5103_888_get_localDescription,"snikket.jingle.PeerConnection","get_localDescription",0xf881419c,"snikket.jingle.PeerConnection.get_localDescription","snikket/jingle/PeerConnection.cpp.hx",888,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_8cd3f69017bd5103_898_setLocalDescription,"snikket.jingle.PeerConnection","setLocalDescription",0xc3beb011,"snikket.jingle.PeerConnection.setLocalDescription","snikket/jingle/PeerConnection.cpp.hx",898,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_8cd3f69017bd5103_897_setLocalDescription,"snikket.jingle.PeerConnection","setLocalDescription",0xc3beb011,"snikket.jingle.PeerConnection.setLocalDescription","snikket/jingle/PeerConnection.cpp.hx",897,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_8cd3f69017bd5103_905_setRemoteDescription,"snikket.jingle.PeerConnection","setRemoteDescription",0x03bc2956,"snikket.jingle.PeerConnection.setRemoteDescription","snikket/jingle/PeerConnection.cpp.hx",905,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_8cd3f69017bd5103_911_addIceCandidate,"snikket.jingle.PeerConnection","addIceCandidate",0x0c0d6f37,"snikket.jingle.PeerConnection.addIceCandidate","snikket/jingle/PeerConnection.cpp.hx",911,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_8cd3f69017bd5103_916_addPendingTracks,"snikket.jingle.PeerConnection","addPendingTracks",0xfb3dbaa0,"snikket.jingle.PeerConnection.addPendingTracks","snikket/jingle/PeerConnection.cpp.hx",916,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_8cd3f69017bd5103_925_addTrack,"snikket.jingle.PeerConnection","addTrack",0xdd0aecec,"snikket.jingle.PeerConnection.addTrack","snikket/jingle/PeerConnection.cpp.hx",925,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_8cd3f69017bd5103_933_getTransceivers,"snikket.jingle.PeerConnection","getTransceivers",0x24b14243,"snikket.jingle.PeerConnection.getTransceivers","snikket/jingle/PeerConnection.cpp.hx",933,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_8cd3f69017bd5103_946_close,"snikket.jingle.PeerConnection","close",0x130c0236,"snikket.jingle.PeerConnection.close","snikket/jingle/PeerConnection.cpp.hx",946,0xf9fab71d)
+HX_LOCAL_STACK_FRAME(_hx_pos_8cd3f69017bd5103_949_addEventListener,"snikket.jingle.PeerConnection","addEventListener",0xae27560f,"snikket.jingle.PeerConnection.addEventListener","snikket/jingle/PeerConnection.cpp.hx",949,0xf9fab71d)
+namespace snikket{
+namespace jingle{
+
+void PeerConnection_obj::__construct( ::Dynamic configuration, ::Dynamic constraints){
+ HX_GC_STACKFRAME(&_hx_pos_8cd3f69017bd5103_768_new)
+HXLINE( 782) this->pendingTracks = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 781) this->hasRemote = false;
+HXLINE( 780) this->hasLocal = false;
+HXLINE( 778) this->stateChangeListeners = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 777) this->localCandidateListeners = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 776) this->trackListeners = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 775) this->tracks = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXLINE( 774) this->waitingOnLocal = null();
+HXLINE( 785) if (::hx::IsNotNull( ::Sys_obj::getEnv(HX_("SNIKKET_WEBRTC_DEBUG",e3,43,ef,ce)) )) {
+HXLINE( 786) rtc::InitLogger(rtc::LogLevel::Verbose);;
+ }
+HXLINE( 788) this->mainLoop = ::sys::thread::_Thread::Thread_Impl__obj::get_events(::sys::thread::_Thread::HaxeThread_obj::current());
+HXLINE( 789) rtc::Configuration configRaw;;
+HXLINE( 790) ::cpp::Pointer< rtc::Configuration > config = &configRaw;
+HXLINE( 791) bool _hx_tmp;
+HXDLIN( 791) if (::hx::IsNotNull( configuration )) {
+HXLINE( 791) _hx_tmp = ::hx::IsNotNull( configuration->__Field(HX_("iceServers",45,14,49,d2),::hx::paccDynamic) );
+ }
+ else {
+HXLINE( 791) _hx_tmp = false;
+ }
+HXDLIN( 791) if (_hx_tmp) {
+HXLINE( 792) int _g = 0;
+HXDLIN( 792) ::Array< ::Dynamic> _g1 = ( (::Array< ::Dynamic>)(configuration->__Field(HX_("iceServers",45,14,49,d2),::hx::paccDynamic)) );
+HXDLIN( 792) while((_g < _g1->length)){
+HXLINE( 792) ::Dynamic server = _g1->__get(_g);
+HXDLIN( 792) _g = (_g + 1);
+HXLINE( 793) bool _hx_tmp1;
+HXDLIN( 793) bool _hx_tmp2;
+HXDLIN( 793) if (::hx::IsNotNull( server->__Field(HX_("urls",24,d6,ac,4d),::hx::paccDynamic) )) {
+HXLINE( 793) _hx_tmp2 = (( (::Array< ::String >)(server->__Field(HX_("urls",24,d6,ac,4d),::hx::paccDynamic)) )->length == 1);
+ }
+ else {
+HXLINE( 793) _hx_tmp2 = false;
+ }
+HXDLIN( 793) if (_hx_tmp2) {
+HXLINE( 793) _hx_tmp1 = (( (::String)( ::Dynamic(server->__Field(HX_("urls",24,d6,ac,4d),::hx::paccDynamic))->__GetItem(0)) ).indexOf(HX_("stuns",f9,9d,1a,84),null()) != 0);
+ }
+ else {
+HXLINE( 793) _hx_tmp1 = false;
+ }
+HXDLIN( 793) if (_hx_tmp1) {
+HXLINE( 794) hx::StdString url = ::hx::StdString(( (::String)( ::Dynamic(server->__Field(HX_("urls",24,d6,ac,4d),::hx::paccDynamic))->__GetItem(0)) ));
+HXLINE( 795) rtc::IceServer iceServerRaw(url);;
+HXLINE( 796) ::cpp::Pointer< rtc::IceServer > iceServer = &iceServerRaw;
+HXLINE( 797) if (::hx::IsNotNull( server->__Field(HX_("username",16,86,eb,20),::hx::paccDynamic) )) {
+HXLINE( 797) iceServer->get_ref().username = ::hx::StdString(( (::String)(server->__Field(HX_("username",16,86,eb,20),::hx::paccDynamic)) ));
+ }
+HXLINE( 798) if (::hx::IsNotNull( server->__Field(HX_("credential",d7,89,b2,20),::hx::paccDynamic) )) {
+HXLINE( 798) iceServer->get_ref().password = ::hx::StdString(( (::String)(server->__Field(HX_("credential",d7,89,b2,20),::hx::paccDynamic)) ));
+ }
+HXLINE( 799) ::cpp::Pointer< std::vector< rtc::IceServer > > iceServers = &configRaw.iceServers;
+HXLINE( 800) std::vector< rtc::IceServer > & _hx_tmp3 = iceServers->get_ref();
+HXDLIN( 800) rtc::IceServer & _hx_tmp4 = iceServer->get_ref();
+HXDLIN( 800) _hx_tmp3.push_back(_hx_tmp4);
+ }
+ }
+ }
+HXLINE( 804) this->_pc = std::make_shared<rtc::PeerConnection>(config->get_ref());
+HXLINE( 805) this->pc = ::cpp::Pointer_obj::fromRaw(this->_pc.get());
+HXLINE( 806) rtc::PeerConnection & _hx_tmp5 = this->pc->get_ref();
+HXDLIN( 806) _hx_tmp5.onLocalDescription([this](auto d) { this->onLocalDescription(); });
+HXLINE( 807) rtc::PeerConnection & _hx_tmp6 = this->pc->get_ref();
+HXDLIN( 807) _hx_tmp6.onTrack([this](auto t) { this->onTrack(t); });
+HXLINE( 808) rtc::PeerConnection & _hx_tmp7 = this->pc->get_ref();
+HXDLIN( 808) _hx_tmp7.onLocalCandidate([this](auto c) { this->onLocalCandidate(c); });
+HXLINE( 809) rtc::PeerConnection & _hx_tmp8 = this->pc->get_ref();
+HXDLIN( 809) _hx_tmp8.onStateChange([this](auto s) { this->onStateChange(s); });
+HXLINE( 810) rtc::PeerConnection & _hx_tmp9 = this->pc->get_ref();
+HXDLIN( 810) _hx_tmp9.onGatheringStateChange([this](auto s) { this->onGatheringStateChange(s); });
+ }
+
+Dynamic PeerConnection_obj::__CreateEmpty() { return new PeerConnection_obj; }
+
+void *PeerConnection_obj::_hx_vtable = 0;
+
+Dynamic PeerConnection_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< PeerConnection_obj > _hx_result = new PeerConnection_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1]);
+ return _hx_result;
+}
+
+bool PeerConnection_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x1731230a;
+}
+
+void PeerConnection_obj::onLocalDescription(){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::jingle::PeerConnection,_gthis) HXARGC(0)
+ void _hx_run(){
+ HX_STACKFRAME(&_hx_pos_8cd3f69017bd5103_816_onLocalDescription)
+HXLINE( 817) _gthis->addPendingTracks();
+HXLINE( 818) if (::hx::IsNotNull( _gthis->waitingOnLocal )) {
+HXLINE( 818) _gthis->waitingOnLocal(null());
+ }
+HXLINE( 819) _gthis->waitingOnLocal = null();
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_STACKFRAME(&_hx_pos_8cd3f69017bd5103_814_onLocalDescription)
+HXDLIN( 814) ::snikket::jingle::PeerConnection _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 815) int base = 0; hx::SetTopOfStack(&base, true);;
+HXLINE( 816) this->mainLoop->run( ::Dynamic(new _hx_Closure_0(_gthis)));
+HXLINE( 821) hx::SetTopOfStack((int*)0, true);;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(PeerConnection_obj,onLocalDescription,(void))
+
+void PeerConnection_obj::onLocalCandidate( rtc::Candidate candidate){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0, ::snikket::jingle::PeerConnection,_gthis, rtc::Candidate,candidate) HXARGC(0)
+ void _hx_run(){
+ HX_STACKFRAME(&_hx_pos_8cd3f69017bd5103_828_onLocalCandidate)
+HXLINE( 828) int _g = 0;
+HXDLIN( 828) ::Array< ::Dynamic> _g1 = _gthis->localCandidateListeners;
+HXDLIN( 828) while((_g < _g1->length)){
+HXLINE( 828) ::Dynamic cb = _g1->__get(_g);
+HXDLIN( 828) _g = (_g + 1);
+HXLINE( 830) std::string this1 = candidate.candidate();
+HXDLIN( 830) ::String _hx_tmp = ( ( hx::StdString)(::hx::StdString(this1)) ).toString();
+HXLINE( 831) std::string this2 = candidate.mid();
+HXDLIN( 831) ::String _hx_tmp1 = ( ( hx::StdString)(::hx::StdString(this2)) ).toString();
+HXLINE( 832) std::string this3 = ( ( std::string)(( (cpp::Struct< std::string >)(( ( rtc::Description)(( (cpp::Struct< rtc::Description >)(_gthis->pc->get_ref().localDescription().value()) )) ).iceUfrag().value()) )) );
+HXLINE( 829) cb( ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("candidate",43,34,d8,d0), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("usernameFragment",06,a8,37,89),( ( hx::StdString)(::hx::StdString(this3)) ).toString())
+ ->setFixed(1,HX_("candidate",43,34,d8,d0),_hx_tmp)
+ ->setFixed(2,HX_("sdpMid",09,30,5f,d9),_hx_tmp1)))));
+ }
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_STACKFRAME(&_hx_pos_8cd3f69017bd5103_825_onLocalCandidate)
+HXDLIN( 825) ::snikket::jingle::PeerConnection _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 826) int base = 0; hx::SetTopOfStack(&base, true);;
+HXLINE( 827) this->mainLoop->run( ::Dynamic(new _hx_Closure_0(_gthis,candidate)));
+HXLINE( 836) hx::SetTopOfStack((int*)0, true);;
+ }
+
+
+void PeerConnection_obj::onStateChange(cpp::Struct< rtc::PeerConnection::State > state){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::jingle::PeerConnection,_gthis) HXARGC(0)
+ void _hx_run(){
+ HX_STACKFRAME(&_hx_pos_8cd3f69017bd5103_843_onStateChange)
+HXLINE( 843) int _g = 0;
+HXDLIN( 843) ::Array< ::Dynamic> _g1 = _gthis->stateChangeListeners;
+HXDLIN( 843) while((_g < _g1->length)){
+HXLINE( 843) ::Dynamic cb = _g1->__get(_g);
+HXDLIN( 843) _g = (_g + 1);
+HXLINE( 844) cb(null());
+ }
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_STACKFRAME(&_hx_pos_8cd3f69017bd5103_840_onStateChange)
+HXDLIN( 840) ::snikket::jingle::PeerConnection _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 841) int base = 0; hx::SetTopOfStack(&base, true);;
+HXLINE( 842) this->mainLoop->run( ::Dynamic(new _hx_Closure_0(_gthis)));
+HXLINE( 847) hx::SetTopOfStack((int*)0, true);;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(PeerConnection_obj,onStateChange,(void))
+
+void PeerConnection_obj::onGatheringStateChange(cpp::Struct< rtc::PeerConnection::GatheringState > state){
+ HX_STACKFRAME(&_hx_pos_8cd3f69017bd5103_851_onGatheringStateChange)
+HXDLIN( 851) ::snikket::jingle::PeerConnection _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 852) int base = 0; hx::SetTopOfStack(&base, true);;
+HXLINE( 853) cpp::Struct< rtc::PeerConnection::GatheringState > c = rtc::PeerConnection::GatheringState::Complete;
+HXLINE( 854) if (::hx::IsEq( state,c )) {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::jingle::PeerConnection,_gthis) HXARGC(0)
+ void _hx_run(){
+ HX_STACKFRAME(&_hx_pos_8cd3f69017bd5103_856_onGatheringStateChange)
+HXLINE( 856) int _g = 0;
+HXDLIN( 856) ::Array< ::Dynamic> _g1 = _gthis->localCandidateListeners;
+HXDLIN( 856) while((_g < _g1->length)){
+HXLINE( 856) ::Dynamic cb = _g1->__get(_g);
+HXDLIN( 856) _g = (_g + 1);
+HXLINE( 857) cb( ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("candidate",43,34,d8,d0),null())));
+ }
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+HXLINE( 855) this->mainLoop->run( ::Dynamic(new _hx_Closure_0(_gthis)));
+ }
+HXLINE( 861) hx::SetTopOfStack((int*)0, true);;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(PeerConnection_obj,onGatheringStateChange,(void))
+
+void PeerConnection_obj::onTrack( std::shared_ptr< rtc::Track > track){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_1, ::snikket::jingle::PeerConnection,_gthis, std::shared_ptr< rtc::Track >,track) HXARGC(0)
+ void _hx_run(){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, std::shared_ptr< rtc::Track >,track) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::MediaStreamTrack t){
+ HX_STACKFRAME(&_hx_pos_8cd3f69017bd5103_868_onTrack)
+HXLINE( 868) ::String matchingTrack = t->get_kind();
+HXDLIN( 868) std::string this1 = track->description().type();
+HXDLIN( 868) return (matchingTrack == ( ( hx::StdString)(::hx::StdString(this1)) ).toString());
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_8cd3f69017bd5103_867_onTrack)
+HXLINE( 868) ::snikket::jingle::MediaStreamTrack matchingTrack = ( ( ::snikket::jingle::MediaStreamTrack)(::Lambda_obj::find(_gthis->pendingTracks, ::Dynamic(new _hx_Closure_0(track)))) );
+HXLINE( 869) ::snikket::jingle::MediaStreamTrack media;
+HXDLIN( 869) if (::hx::IsNull( matchingTrack )) {
+HXLINE( 869) media = ::snikket::jingle::MediaStreamTrack_obj::fromTrack(track);
+ }
+ else {
+HXLINE( 872) ::Array< ::Dynamic> _g = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 872) {
+HXLINE( 872) int _g1 = 0;
+HXDLIN( 872) ::Array< ::Dynamic> _g2 = _gthis->pendingTracks;
+HXDLIN( 872) while((_g1 < _g2->length)){
+HXLINE( 872) ::snikket::jingle::MediaStreamTrack v = _g2->__get(_g1).StaticCast< ::snikket::jingle::MediaStreamTrack >();
+HXDLIN( 872) _g1 = (_g1 + 1);
+HXDLIN( 872) ::String media1 = v->get_id();
+HXDLIN( 872) if ((media1 != matchingTrack->get_id())) {
+HXLINE( 872) _g->push(v);
+ }
+ }
+ }
+HXDLIN( 872) _gthis->pendingTracks = _g;
+HXLINE( 873) matchingTrack->set_track(track);
+HXLINE( 869) media = matchingTrack;
+ }
+HXLINE( 876) {
+HXLINE( 876) ::Dynamic this1 = _gthis->tracks;
+HXDLIN( 876) ( ( ::haxe::ds::StringMap)(this1) )->set(media->get_id(),media);
+ }
+HXLINE( 877) {
+HXLINE( 877) int _g3 = 0;
+HXDLIN( 877) ::Array< ::Dynamic> _g4 = _gthis->trackListeners;
+HXDLIN( 877) while((_g3 < _g4->length)){
+HXLINE( 877) ::Dynamic cb = _g4->__get(_g3);
+HXDLIN( 877) _g3 = (_g3 + 1);
+HXLINE( 878) cb( ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("streams",f3,db,44,f6),::cpp::VirtualArray_obj::__new(0))
+ ->setFixed(1,HX_("track",8b,8e,1f,16),media)));
+ }
+ }
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_STACKFRAME(&_hx_pos_8cd3f69017bd5103_865_onTrack)
+HXDLIN( 865) ::snikket::jingle::PeerConnection _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 866) int base = 0; hx::SetTopOfStack(&base, true);;
+HXLINE( 867) this->mainLoop->run( ::Dynamic(new _hx_Closure_1(_gthis,track)));
+HXLINE( 881) hx::SetTopOfStack((int*)0, true);;
+ }
+
+
+::String PeerConnection_obj::get_connectionState(){
+ HX_STACKFRAME(&_hx_pos_8cd3f69017bd5103_885_get_connectionState)
+HXDLIN( 885) rtc::PeerConnection::State _hx_switch_0 = this->pc->get_ref().state();
+ if ( (_hx_switch_0==rtc::PeerConnection::State::Closed) ){
+HXDLIN( 885) return HX_("closed",ac,a9,51,0e);
+HXDLIN( 885) goto _hx_goto_18;
+ }
+ if ( (_hx_switch_0==rtc::PeerConnection::State::Connected) ){
+HXDLIN( 885) return HX_("connected",c9,e2,f6,a2);
+HXDLIN( 885) goto _hx_goto_18;
+ }
+ if ( (_hx_switch_0==rtc::PeerConnection::State::Connecting) ){
+HXDLIN( 885) return HX_("connecting",38,9f,12,f5);
+HXDLIN( 885) goto _hx_goto_18;
+ }
+ if ( (_hx_switch_0==rtc::PeerConnection::State::Disconnected) ){
+HXDLIN( 885) return HX_("disconnected",bb,8b,6b,8e);
+HXDLIN( 885) goto _hx_goto_18;
+ }
+ if ( (_hx_switch_0==rtc::PeerConnection::State::Failed) ){
+HXDLIN( 885) return HX_("failed",bd,c5,fe,e7);
+HXDLIN( 885) goto _hx_goto_18;
+ }
+ if ( (_hx_switch_0==rtc::PeerConnection::State::New) ){
+HXDLIN( 885) return HX_("new",60,d0,53,00);
+HXDLIN( 885) goto _hx_goto_18;
+ }
+ _hx_goto_18:;
+HXDLIN( 885) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(PeerConnection_obj,get_connectionState,return )
+
+ ::Dynamic PeerConnection_obj::get_localDescription(){
+ HX_STACKFRAME(&_hx_pos_8cd3f69017bd5103_888_get_localDescription)
+HXLINE( 889) std::optional< rtc::Description > desc = this->pc->get_ref().localDescription();
+HXLINE( 890) if (desc.has_value()) {
+HXLINE( 891) std::string this1 = ( ( rtc::Description)(( (cpp::Struct< rtc::Description >)(desc.value()) )) ).generateSdp();
+HXDLIN( 891) return ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("sdp",bf,9a,57,00),( ( hx::StdString)(::hx::StdString(this1)) ).toString()));
+ }
+ else {
+HXLINE( 893) return null();
+ }
+HXLINE( 890) return null();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(PeerConnection_obj,get_localDescription,return )
+
+::Dynamic PeerConnection_obj::setLocalDescription(cpp::Struct< rtc::Description::Type > sdpType){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0, ::snikket::jingle::PeerConnection,_gthis,cpp::Struct< rtc::Description::Type >,sdpType) HXARGC(2)
+ void _hx_run( ::Dynamic resolve, ::Dynamic reject){
+ HX_STACKFRAME(&_hx_pos_8cd3f69017bd5103_898_setLocalDescription)
+HXLINE( 899) _gthis->waitingOnLocal = resolve;
+HXLINE( 900) if (!(_gthis->hasRemote)) {
+HXLINE( 900) _gthis->addPendingTracks();
+ }
+HXLINE( 901) rtc::PeerConnection & _hx_tmp = _gthis->pc->get_ref();
+HXDLIN( 901) cpp::Struct< rtc::Description::Type > tmp = sdpType;
+HXDLIN( 901) cpp::Struct< rtc::Description::Type > _hx_tmp1;
+HXDLIN( 901) if (::hx::IsNotNull( tmp )) {
+HXLINE( 901) _hx_tmp1 = tmp;
+ }
+ else {
+HXLINE( 901) _hx_tmp1 = cpp::Struct(rtc::Description::Type::Unspec);
+ }
+HXDLIN( 901) _hx_tmp.setLocalDescription(_hx_tmp1);
+ }
+ HX_END_LOCAL_FUNC2((void))
+
+ HX_STACKFRAME(&_hx_pos_8cd3f69017bd5103_897_setLocalDescription)
+HXDLIN( 897) ::snikket::jingle::PeerConnection _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 898) return ::thenshim::_Promise::Promise_Impl__obj::_new( ::Dynamic(new _hx_Closure_0(_gthis,sdpType)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(PeerConnection_obj,setLocalDescription,return )
+
+::Dynamic PeerConnection_obj::setRemoteDescription( ::Dynamic description){
+ HX_STACKFRAME(&_hx_pos_8cd3f69017bd5103_905_setRemoteDescription)
+HXLINE( 906) rtc::PeerConnection & _hx_tmp = this->pc->get_ref();
+HXDLIN( 906) hx::StdString _hx_tmp1 = ::hx::StdString(( (::String)(description->__Field(HX_("sdp",bf,9a,57,00),::hx::paccDynamic)) ));
+HXDLIN( 906) _hx_tmp.setRemoteDescription( rtc::Description(_hx_tmp1,::hx::TCast< cpp::Struct< rtc::Description::Type > >::cast(description->__Field(HX_("type",ba,f2,08,4d),::hx::paccDynamic))));
+HXLINE( 907) this->hasRemote = true;
+HXLINE( 908) return ::thenshim::_Promise::Promise_Impl__obj::resolve(null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(PeerConnection_obj,setRemoteDescription,return )
+
+::Dynamic PeerConnection_obj::addIceCandidate( ::Dynamic candidate){
+ HX_STACKFRAME(&_hx_pos_8cd3f69017bd5103_911_addIceCandidate)
+HXLINE( 912) rtc::PeerConnection & _hx_tmp = this->pc->get_ref();
+HXDLIN( 912) hx::StdString _hx_tmp1 = ::hx::StdString(( (::String)(candidate->__Field(HX_("candidate",43,34,d8,d0),::hx::paccDynamic)) ));
+HXDLIN( 912) hx::StdString _hx_tmp2 = ::hx::StdString(( (::String)(candidate->__Field(HX_("sdpMid",09,30,5f,d9),::hx::paccDynamic)) ));
+HXDLIN( 912) _hx_tmp.addRemoteCandidate( rtc::Candidate(_hx_tmp1,_hx_tmp2));
+HXLINE( 913) return ::thenshim::_Promise::Promise_Impl__obj::resolve(null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(PeerConnection_obj,addIceCandidate,return )
+
+void PeerConnection_obj::addPendingTracks(){
+ HX_STACKFRAME(&_hx_pos_8cd3f69017bd5103_916_addPendingTracks)
+HXLINE( 917) this->hasLocal = true;
+HXLINE( 918) ::snikket::jingle::MediaStreamTrack track;
+HXLINE( 919) while(true){
+HXLINE( 919) track = this->pendingTracks->shift().StaticCast< ::snikket::jingle::MediaStreamTrack >();
+HXDLIN( 919) if (!(::hx::IsNotNull( track ))) {
+HXLINE( 919) goto _hx_goto_25;
+ }
+HXLINE( 920) this->addTrack(track,null());
+ }
+ _hx_goto_25:;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(PeerConnection_obj,addPendingTracks,(void))
+
+void PeerConnection_obj::addTrack( ::snikket::jingle::MediaStreamTrack track, ::snikket::jingle::MediaStream stream){
+ HX_STACKFRAME(&_hx_pos_8cd3f69017bd5103_925_addTrack)
+HXDLIN( 925) if (this->hasLocal) {
+HXLINE( 926) rtc::PeerConnection & _hx_tmp = this->pc->get_ref();
+HXDLIN( 926) rtc::Description::Media _hx_tmp1 = ( ( rtc::Description::Media)(( (cpp::Struct< rtc::Description::Media >)(track->get_media().value()) )) );
+HXDLIN( 926) track->set_track(_hx_tmp.addTrack(_hx_tmp1));
+HXLINE( 927) {
+HXLINE( 927) ::Dynamic this1 = this->tracks;
+HXDLIN( 927) ( ( ::haxe::ds::StringMap)(this1) )->set(track->get_id(),track);
+ }
+ }
+ else {
+HXLINE( 929) this->pendingTracks->push(track);
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(PeerConnection_obj,addTrack,(void))
+
+::Array< ::Dynamic> PeerConnection_obj::getTransceivers(){
+ HX_GC_STACKFRAME(&_hx_pos_8cd3f69017bd5103_933_getTransceivers)
+HXLINE( 935) ::Array< ::Dynamic> ts = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 936) {
+HXLINE( 936) ::Dynamic map = this->tracks;
+HXDLIN( 936) ::Dynamic _g_map = map;
+HXDLIN( 936) ::Dynamic _g_keys = ::haxe::IMap_obj::keys(map);
+HXDLIN( 936) while(( (bool)(_g_keys->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 936) ::String key = ( (::String)(_g_keys->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXDLIN( 936) ::snikket::jingle::MediaStreamTrack _g_value = ( ( ::snikket::jingle::MediaStreamTrack)(::haxe::IMap_obj::get(_g_map,key)) );
+HXDLIN( 936) ::String _g_key = key;
+HXDLIN( 936) ::String mid = _g_key;
+HXDLIN( 936) ::snikket::jingle::MediaStreamTrack track = _g_value;
+HXLINE( 937) ts->push( ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("receiver",2f,45,fd,e2), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("track",8b,8e,1f,16),track)))
+ ->setFixed(1,HX_("sender",b5,c7,84,6b), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("track",8b,8e,1f,16),track)
+ ->setFixed(1,HX_("dtmf",e9,ba,71,42), ::snikket::jingle::DTMFSender_obj::__alloc( HX_CTX ,track))))));
+ }
+ }
+HXLINE( 942) return ts;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(PeerConnection_obj,getTransceivers,return )
+
+void PeerConnection_obj::close(){
+ HX_STACKFRAME(&_hx_pos_8cd3f69017bd5103_946_close)
+HXDLIN( 946) this->pc->get_ref().close();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(PeerConnection_obj,close,(void))
+
+void PeerConnection_obj::addEventListener(::String event, ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_8cd3f69017bd5103_949_addEventListener)
+HXLINE( 950) if ((event == HX_("track",8b,8e,1f,16))) {
+HXLINE( 950) this->trackListeners->push(callback);
+ }
+HXLINE( 951) if ((event == HX_("icecandidate",98,ef,c0,7b))) {
+HXLINE( 951) this->localCandidateListeners->push(callback);
+ }
+HXLINE( 952) if ((event == HX_("connectionstatechange",e3,a2,87,36))) {
+HXLINE( 952) this->stateChangeListeners->push(callback);
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(PeerConnection_obj,addEventListener,(void))
+
+
+::hx::ObjectPtr< PeerConnection_obj > PeerConnection_obj::__new( ::Dynamic configuration, ::Dynamic constraints) {
+ ::hx::ObjectPtr< PeerConnection_obj > __this = new PeerConnection_obj();
+ __this->__construct(configuration,constraints);
+ return __this;
+}
+
+::hx::ObjectPtr< PeerConnection_obj > PeerConnection_obj::__alloc(::hx::Ctx *_hx_ctx, ::Dynamic configuration, ::Dynamic constraints) {
+ PeerConnection_obj *__this = (PeerConnection_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(PeerConnection_obj), true, "snikket.jingle.PeerConnection"));
+ *(void **)__this = PeerConnection_obj::_hx_vtable;
+ __this->__construct(configuration,constraints);
+ return __this;
+}
+
+PeerConnection_obj::PeerConnection_obj()
+{
+}
+
+void PeerConnection_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(PeerConnection);
+ HX_MARK_MEMBER_NAME(localDescription,"localDescription");
+ HX_MARK_MEMBER_NAME(connectionState,"connectionState");
+ HX_MARK_MEMBER_NAME(_pc,"_pc");
+ HX_MARK_MEMBER_NAME(pc,"pc");
+ HX_MARK_MEMBER_NAME(waitingOnLocal,"waitingOnLocal");
+ HX_MARK_MEMBER_NAME(tracks,"tracks");
+ HX_MARK_MEMBER_NAME(trackListeners,"trackListeners");
+ HX_MARK_MEMBER_NAME(localCandidateListeners,"localCandidateListeners");
+ HX_MARK_MEMBER_NAME(stateChangeListeners,"stateChangeListeners");
+ HX_MARK_MEMBER_NAME(mainLoop,"mainLoop");
+ HX_MARK_MEMBER_NAME(hasLocal,"hasLocal");
+ HX_MARK_MEMBER_NAME(hasRemote,"hasRemote");
+ HX_MARK_MEMBER_NAME(pendingTracks,"pendingTracks");
+ HX_MARK_END_CLASS();
+}
+
+void PeerConnection_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(localDescription,"localDescription");
+ HX_VISIT_MEMBER_NAME(connectionState,"connectionState");
+ HX_VISIT_MEMBER_NAME(_pc,"_pc");
+ HX_VISIT_MEMBER_NAME(pc,"pc");
+ HX_VISIT_MEMBER_NAME(waitingOnLocal,"waitingOnLocal");
+ HX_VISIT_MEMBER_NAME(tracks,"tracks");
+ HX_VISIT_MEMBER_NAME(trackListeners,"trackListeners");
+ HX_VISIT_MEMBER_NAME(localCandidateListeners,"localCandidateListeners");
+ HX_VISIT_MEMBER_NAME(stateChangeListeners,"stateChangeListeners");
+ HX_VISIT_MEMBER_NAME(mainLoop,"mainLoop");
+ HX_VISIT_MEMBER_NAME(hasLocal,"hasLocal");
+ HX_VISIT_MEMBER_NAME(hasRemote,"hasRemote");
+ HX_VISIT_MEMBER_NAME(pendingTracks,"pendingTracks");
+}
+
+::hx::Val PeerConnection_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 2:
+ if (HX_FIELD_EQ(inName,"pc") ) { return ::hx::Val( pc ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"close") ) { return ::hx::Val( close_dyn() ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"tracks") ) { return ::hx::Val( tracks ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"mainLoop") ) { return ::hx::Val( mainLoop ); }
+ if (HX_FIELD_EQ(inName,"hasLocal") ) { return ::hx::Val( hasLocal ); }
+ if (HX_FIELD_EQ(inName,"addTrack") ) { return ::hx::Val( addTrack_dyn() ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"hasRemote") ) { return ::hx::Val( hasRemote ); }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"pendingTracks") ) { return ::hx::Val( pendingTracks ); }
+ if (HX_FIELD_EQ(inName,"onStateChange") ) { return ::hx::Val( onStateChange_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"waitingOnLocal") ) { return ::hx::Val( waitingOnLocal ); }
+ if (HX_FIELD_EQ(inName,"trackListeners") ) { return ::hx::Val( trackListeners ); }
+ break;
+ case 15:
+ if (HX_FIELD_EQ(inName,"connectionState") ) { return ::hx::Val( inCallProp == ::hx::paccAlways ? get_connectionState() : connectionState ); }
+ if (HX_FIELD_EQ(inName,"addIceCandidate") ) { return ::hx::Val( addIceCandidate_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getTransceivers") ) { return ::hx::Val( getTransceivers_dyn() ); }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"localDescription") ) { return ::hx::Val( inCallProp == ::hx::paccAlways ? get_localDescription() : localDescription ); }
+ if (HX_FIELD_EQ(inName,"addPendingTracks") ) { return ::hx::Val( addPendingTracks_dyn() ); }
+ if (HX_FIELD_EQ(inName,"addEventListener") ) { return ::hx::Val( addEventListener_dyn() ); }
+ break;
+ case 18:
+ if (HX_FIELD_EQ(inName,"onLocalDescription") ) { return ::hx::Val( onLocalDescription_dyn() ); }
+ break;
+ case 19:
+ if (HX_FIELD_EQ(inName,"get_connectionState") ) { return ::hx::Val( get_connectionState_dyn() ); }
+ if (HX_FIELD_EQ(inName,"setLocalDescription") ) { return ::hx::Val( setLocalDescription_dyn() ); }
+ break;
+ case 20:
+ if (HX_FIELD_EQ(inName,"stateChangeListeners") ) { return ::hx::Val( stateChangeListeners ); }
+ if (HX_FIELD_EQ(inName,"get_localDescription") ) { return ::hx::Val( get_localDescription_dyn() ); }
+ if (HX_FIELD_EQ(inName,"setRemoteDescription") ) { return ::hx::Val( setRemoteDescription_dyn() ); }
+ break;
+ case 22:
+ if (HX_FIELD_EQ(inName,"onGatheringStateChange") ) { return ::hx::Val( onGatheringStateChange_dyn() ); }
+ break;
+ case 23:
+ if (HX_FIELD_EQ(inName,"localCandidateListeners") ) { return ::hx::Val( localCandidateListeners ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val PeerConnection_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 2:
+ if (HX_FIELD_EQ(inName,"pc") ) { pc=inValue.Cast< ::cpp::Pointer< rtc::PeerConnection > >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"tracks") ) { tracks=inValue.Cast< ::haxe::ds::StringMap >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"mainLoop") ) { mainLoop=inValue.Cast< ::sys::thread::EventLoop >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"hasLocal") ) { hasLocal=inValue.Cast< bool >(); return inValue; }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"hasRemote") ) { hasRemote=inValue.Cast< bool >(); return inValue; }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"pendingTracks") ) { pendingTracks=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"waitingOnLocal") ) { waitingOnLocal=inValue.Cast< ::Dynamic >(); return inValue; }
+ if (HX_FIELD_EQ(inName,"trackListeners") ) { trackListeners=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ break;
+ case 15:
+ if (HX_FIELD_EQ(inName,"connectionState") ) { connectionState=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"localDescription") ) { localDescription=inValue.Cast< ::Dynamic >(); return inValue; }
+ break;
+ case 20:
+ if (HX_FIELD_EQ(inName,"stateChangeListeners") ) { stateChangeListeners=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ break;
+ case 23:
+ if (HX_FIELD_EQ(inName,"localCandidateListeners") ) { localCandidateListeners=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void PeerConnection_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("localDescription",51,49,74,58));
+ outFields->push(HX_("connectionState",13,19,57,99));
+ outFields->push(HX_("_pc",12,78,48,00));
+ outFields->push(HX_("pc",f3,61,00,00));
+ outFields->push(HX_("tracks",88,2b,7d,45));
+ outFields->push(HX_("trackListeners",74,0d,4f,fa));
+ outFields->push(HX_("localCandidateListeners",07,95,30,e7));
+ outFields->push(HX_("stateChangeListeners",de,12,31,3c));
+ outFields->push(HX_("mainLoop",3d,1b,3a,a0));
+ outFields->push(HX_("hasLocal",b1,13,49,05));
+ outFields->push(HX_("hasRemote",80,4d,71,45));
+ outFields->push(HX_("pendingTracks",3f,93,4b,3f));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo PeerConnection_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(PeerConnection_obj,localDescription),HX_("localDescription",51,49,74,58)},
+ {::hx::fsString,(int)offsetof(PeerConnection_obj,connectionState),HX_("connectionState",13,19,57,99)},
+ {::hx::fsUnknown /* std::shared_ptr< rtc::PeerConnection > */ ,(int)offsetof(PeerConnection_obj,_pc),HX_("_pc",12,78,48,00)},
+ {::hx::fsUnknown /* ::cpp::Pointer< rtc::PeerConnection > */ ,(int)offsetof(PeerConnection_obj,pc),HX_("pc",f3,61,00,00)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(PeerConnection_obj,waitingOnLocal),HX_("waitingOnLocal",bf,a1,df,aa)},
+ {::hx::fsObject /* ::haxe::ds::StringMap */ ,(int)offsetof(PeerConnection_obj,tracks),HX_("tracks",88,2b,7d,45)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(PeerConnection_obj,trackListeners),HX_("trackListeners",74,0d,4f,fa)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(PeerConnection_obj,localCandidateListeners),HX_("localCandidateListeners",07,95,30,e7)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(PeerConnection_obj,stateChangeListeners),HX_("stateChangeListeners",de,12,31,3c)},
+ {::hx::fsObject /* ::sys::thread::EventLoop */ ,(int)offsetof(PeerConnection_obj,mainLoop),HX_("mainLoop",3d,1b,3a,a0)},
+ {::hx::fsBool,(int)offsetof(PeerConnection_obj,hasLocal),HX_("hasLocal",b1,13,49,05)},
+ {::hx::fsBool,(int)offsetof(PeerConnection_obj,hasRemote),HX_("hasRemote",80,4d,71,45)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(PeerConnection_obj,pendingTracks),HX_("pendingTracks",3f,93,4b,3f)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *PeerConnection_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String PeerConnection_obj_sMemberFields[] = {
+ HX_("localDescription",51,49,74,58),
+ HX_("connectionState",13,19,57,99),
+ HX_("pc",f3,61,00,00),
+ HX_("waitingOnLocal",bf,a1,df,aa),
+ HX_("tracks",88,2b,7d,45),
+ HX_("trackListeners",74,0d,4f,fa),
+ HX_("localCandidateListeners",07,95,30,e7),
+ HX_("stateChangeListeners",de,12,31,3c),
+ HX_("mainLoop",3d,1b,3a,a0),
+ HX_("hasLocal",b1,13,49,05),
+ HX_("hasRemote",80,4d,71,45),
+ HX_("pendingTracks",3f,93,4b,3f),
+ HX_("onLocalDescription",90,f4,87,b0),
+ HX_("onStateChange",82,fb,e5,94),
+ HX_("onGatheringStateChange",99,3a,da,17),
+ HX_("get_connectionState",2a,e8,61,24),
+ HX_("get_localDescription",5a,ae,de,76),
+ HX_("setLocalDescription",13,a5,37,4f),
+ HX_("setRemoteDescription",14,96,19,82),
+ HX_("addIceCandidate",39,3b,e3,a3),
+ HX_("addPendingTracks",5e,70,7a,3e),
+ HX_("addTrack",aa,b4,7c,8f),
+ HX_("getTransceivers",45,0e,87,bc),
+ HX_("close",b8,17,63,48),
+ HX_("addEventListener",cd,0b,64,f1),
+ ::String(null()) };
+
+::hx::Class PeerConnection_obj::__mClass;
+
+void PeerConnection_obj::__register()
+{
+ PeerConnection_obj _hx_dummy;
+ PeerConnection_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.jingle.PeerConnection",6c,38,b6,bc);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(PeerConnection_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< PeerConnection_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = PeerConnection_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = PeerConnection_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace jingle
diff --git a/Sources/c_snikket/src/snikket/jingle/Session.cpp b/Sources/c_snikket/src/snikket/jingle/Session.cpp
new file mode 100644
index 0000000..04d9654
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/jingle/Session.cpp
@@ -0,0 +1,63 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_DTMFSender
+#include <snikket/jingle/DTMFSender.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_InitiatedSession
+#include <snikket/jingle/InitiatedSession.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_MediaStream
+#include <snikket/jingle/MediaStream.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_MediaStreamTrack
+#include <snikket/jingle/MediaStreamTrack.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_Session
+#include <snikket/jingle/Session.h>
+#endif
+#ifndef INCLUDED_thenshim_Thenable
+#include <thenshim/Thenable.h>
+#endif
+
+namespace snikket{
+namespace jingle{
+
+
+static ::String Session_obj_sMemberFields[] = {
+ HX_("get_sid",a5,67,cc,26),
+ HX_("sid",0e,9f,57,00),
+ HX_("initiate",59,6a,8f,5f),
+ HX_("accept",08,93,06,0b),
+ HX_("hangup",4d,d2,ff,b7),
+ HX_("retract",01,e2,b9,fc),
+ HX_("terminate",61,32,d2,fd),
+ HX_("contentAdd",68,66,dd,43),
+ HX_("contentAccept",21,c5,01,e1),
+ HX_("transportInfo",b7,3c,cf,b6),
+ HX_("addMedia",03,2b,19,7f),
+ HX_("callStatus",70,be,2b,31),
+ HX_("videoTracks",63,c2,24,be),
+ HX_("dtmf",e9,ba,71,42),
+ ::String(null()) };
+
+::hx::Class Session_obj::__mClass;
+
+void Session_obj::__register()
+{
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.jingle.Session",ca,79,a9,d5);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Session_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TIsInterface< (int)0x79d60748 >;
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace jingle
diff --git a/Sources/c_snikket/src/snikket/jingle/SessionDescription.cpp b/Sources/c_snikket/src/snikket/jingle/SessionDescription.cpp
new file mode 100644
index 0000000..f11b7fd
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/jingle/SessionDescription.cpp
@@ -0,0 +1,727 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Lambda
+#include <Lambda.h>
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_Attribute
+#include <snikket/jingle/Attribute.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_Group
+#include <snikket/jingle/Group.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_Media
+#include <snikket/jingle/Media.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_SessionDescription
+#include <snikket/jingle/SessionDescription.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_afe8c32f000731b4_13_new,"snikket.jingle.SessionDescription","new",0x5e69f944,"snikket.jingle.SessionDescription.new","snikket/jingle/SessionDescription.hx",13,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_afe8c32f000731b4_118_getUfragPwd,"snikket.jingle.SessionDescription","getUfragPwd",0x89ee6630,"snikket.jingle.SessionDescription.getUfragPwd","snikket/jingle/SessionDescription.hx",118,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_afe8c32f000731b4_132_getFingerprint,"snikket.jingle.SessionDescription","getFingerprint",0x704a108a,"snikket.jingle.SessionDescription.getFingerprint","snikket/jingle/SessionDescription.hx",132,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_afe8c32f000731b4_131_getFingerprint,"snikket.jingle.SessionDescription","getFingerprint",0x704a108a,"snikket.jingle.SessionDescription.getFingerprint","snikket/jingle/SessionDescription.hx",131,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_afe8c32f000731b4_136_getFingerprint,"snikket.jingle.SessionDescription","getFingerprint",0x704a108a,"snikket.jingle.SessionDescription.getFingerprint","snikket/jingle/SessionDescription.hx",136,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_afe8c32f000731b4_146_getDtlsSetup,"snikket.jingle.SessionDescription","getDtlsSetup",0x082ca80c,"snikket.jingle.SessionDescription.getDtlsSetup","snikket/jingle/SessionDescription.hx",146,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_afe8c32f000731b4_145_getDtlsSetup,"snikket.jingle.SessionDescription","getDtlsSetup",0x082ca80c,"snikket.jingle.SessionDescription.getDtlsSetup","snikket/jingle/SessionDescription.hx",145,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_afe8c32f000731b4_150_getDtlsSetup,"snikket.jingle.SessionDescription","getDtlsSetup",0x082ca80c,"snikket.jingle.SessionDescription.getDtlsSetup","snikket/jingle/SessionDescription.hx",150,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_afe8c32f000731b4_159_addContent,"snikket.jingle.SessionDescription","addContent",0x846e34b4,"snikket.jingle.SessionDescription.addContent","snikket/jingle/SessionDescription.hx",159,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_afe8c32f000731b4_161_addContent,"snikket.jingle.SessionDescription","addContent",0x846e34b4,"snikket.jingle.SessionDescription.addContent","snikket/jingle/SessionDescription.hx",161,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_afe8c32f000731b4_175_toSdp,"snikket.jingle.SessionDescription","toSdp",0xc2b675e8,"snikket.jingle.SessionDescription.toSdp","snikket/jingle/SessionDescription.hx",175,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_afe8c32f000731b4_187_toStanza,"snikket.jingle.SessionDescription","toStanza",0x6f2d226c,"snikket.jingle.SessionDescription.toStanza","snikket/jingle/SessionDescription.hx",187,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_afe8c32f000731b4_184_toStanza,"snikket.jingle.SessionDescription","toStanza",0x6f2d226c,"snikket.jingle.SessionDescription.toStanza","snikket/jingle/SessionDescription.hx",184,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_afe8c32f000731b4_89_parse,"snikket.jingle.SessionDescription","parse",0x6bf2ba17,"snikket.jingle.SessionDescription.parse","snikket/jingle/SessionDescription.hx",89,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_afe8c32f000731b4_21_parse,"snikket.jingle.SessionDescription","parse",0x6bf2ba17,"snikket.jingle.SessionDescription.parse","snikket/jingle/SessionDescription.hx",21,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_afe8c32f000731b4_45_parse,"snikket.jingle.SessionDescription","parse",0x6bf2ba17,"snikket.jingle.SessionDescription.parse","snikket/jingle/SessionDescription.hx",45,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_afe8c32f000731b4_74_parse,"snikket.jingle.SessionDescription","parse",0x6bf2ba17,"snikket.jingle.SessionDescription.parse","snikket/jingle/SessionDescription.hx",74,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_afe8c32f000731b4_99_fromStanza,"snikket.jingle.SessionDescription","fromStanza",0x4ca7de9b,"snikket.jingle.SessionDescription.fromStanza","snikket/jingle/SessionDescription.hx",99,0x68af748c)
+namespace snikket{
+namespace jingle{
+
+void SessionDescription_obj::__construct(int version,::String name,::Array< ::Dynamic> media,::Array< ::Dynamic> attributes,::Array< ::String > identificationTags){
+ HX_STACKFRAME(&_hx_pos_afe8c32f000731b4_13_new)
+HXLINE( 14) this->version = version;
+HXLINE( 15) this->name = name;
+HXLINE( 16) this->media = media;
+HXLINE( 17) this->attributes = attributes;
+HXLINE( 18) this->identificationTags = identificationTags;
+ }
+
+Dynamic SessionDescription_obj::__CreateEmpty() { return new SessionDescription_obj; }
+
+void *SessionDescription_obj::_hx_vtable = 0;
+
+Dynamic SessionDescription_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< SessionDescription_obj > _hx_result = new SessionDescription_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4]);
+ return _hx_result;
+}
+
+bool SessionDescription_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x24aad8f0;
+}
+
+ ::Dynamic SessionDescription_obj::getUfragPwd(){
+ HX_STACKFRAME(&_hx_pos_afe8c32f000731b4_118_getUfragPwd)
+HXLINE( 119) ::Dynamic ufragPwd = null();
+HXLINE( 120) {
+HXLINE( 120) int _g = 0;
+HXDLIN( 120) ::Array< ::Dynamic> _g1 = this->media;
+HXDLIN( 120) while((_g < _g1->length)){
+HXLINE( 120) ::snikket::jingle::Media m = _g1->__get(_g).StaticCast< ::snikket::jingle::Media >();
+HXDLIN( 120) _g = (_g + 1);
+HXLINE( 121) ::Dynamic mUfragPwd = m->getUfragPwd(null());
+HXLINE( 122) bool _hx_tmp;
+HXDLIN( 122) if (::hx::IsNotNull( ufragPwd )) {
+HXLINE( 122) _hx_tmp = ::hx::IsNotEq( mUfragPwd->__Field(HX_("ufrag",27,78,a4,a1),::hx::paccDynamic),ufragPwd->__Field(HX_("ufrag",27,78,a4,a1),::hx::paccDynamic) );
+ }
+ else {
+HXLINE( 122) _hx_tmp = false;
+ }
+HXDLIN( 122) if (_hx_tmp) {
+HXLINE( 122) HX_STACK_DO_THROW(HX_("ufrag not unique",d7,cd,fe,ab));
+ }
+HXLINE( 123) bool _hx_tmp1;
+HXDLIN( 123) if (::hx::IsNotNull( ufragPwd )) {
+HXLINE( 123) _hx_tmp1 = ::hx::IsNotEq( mUfragPwd->__Field(HX_("pwd",7d,64,55,00),::hx::paccDynamic),ufragPwd->__Field(HX_("pwd",7d,64,55,00),::hx::paccDynamic) );
+ }
+ else {
+HXLINE( 123) _hx_tmp1 = false;
+ }
+HXDLIN( 123) if (_hx_tmp1) {
+HXLINE( 123) HX_STACK_DO_THROW(HX_("pwd not unique",41,35,ac,fa));
+ }
+HXLINE( 124) ufragPwd = mUfragPwd;
+ }
+ }
+HXLINE( 127) if (::hx::IsNull( ufragPwd )) {
+HXLINE( 127) HX_STACK_DO_THROW(HX_("no ufrag or pwd found",3a,15,25,03));
+ }
+HXLINE( 128) return ufragPwd;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(SessionDescription_obj,getUfragPwd,return )
+
+ ::snikket::jingle::Attribute SessionDescription_obj::getFingerprint(){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Attribute attr){
+ HX_STACKFRAME(&_hx_pos_afe8c32f000731b4_132_getFingerprint)
+HXLINE( 132) return (attr->key == HX_("fingerprint",e4,43,63,a3));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_afe8c32f000731b4_131_getFingerprint)
+HXLINE( 132) ::snikket::jingle::Attribute fingerprint = ( ( ::snikket::jingle::Attribute)(::Lambda_obj::find(this->attributes, ::Dynamic(new _hx_Closure_0()))) );
+HXLINE( 133) if (::hx::IsNotNull( fingerprint )) {
+HXLINE( 133) return fingerprint;
+ }
+HXLINE( 135) {
+HXLINE( 135) int _g = 0;
+HXDLIN( 135) ::Array< ::Dynamic> _g1 = this->media;
+HXDLIN( 135) while((_g < _g1->length)){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_1) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Attribute attr){
+ HX_STACKFRAME(&_hx_pos_afe8c32f000731b4_136_getFingerprint)
+HXLINE( 136) return (attr->key == HX_("fingerprint",e4,43,63,a3));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE( 135) ::snikket::jingle::Media m = _g1->__get(_g).StaticCast< ::snikket::jingle::Media >();
+HXDLIN( 135) _g = (_g + 1);
+HXLINE( 136) ::snikket::jingle::Attribute mFingerprint = ( ( ::snikket::jingle::Attribute)(::Lambda_obj::find(m->attributes, ::Dynamic(new _hx_Closure_1()))) );
+HXLINE( 137) bool _hx_tmp;
+HXDLIN( 137) bool _hx_tmp1;
+HXDLIN( 137) if (::hx::IsNotNull( fingerprint )) {
+HXLINE( 137) _hx_tmp1 = ::hx::IsNotNull( mFingerprint );
+ }
+ else {
+HXLINE( 137) _hx_tmp1 = false;
+ }
+HXDLIN( 137) if (_hx_tmp1) {
+HXLINE( 137) _hx_tmp = (fingerprint->value != mFingerprint->value);
+ }
+ else {
+HXLINE( 137) _hx_tmp = false;
+ }
+HXDLIN( 137) if (_hx_tmp) {
+HXLINE( 137) HX_STACK_DO_THROW(HX_("fingerprint not unique",3a,d1,41,fd));
+ }
+HXLINE( 138) fingerprint = mFingerprint;
+ }
+ }
+HXLINE( 141) if (::hx::IsNull( fingerprint )) {
+HXLINE( 141) HX_STACK_DO_THROW(HX_("no fingerprint found",67,35,40,43));
+ }
+HXLINE( 142) return fingerprint;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(SessionDescription_obj,getFingerprint,return )
+
+::String SessionDescription_obj::getDtlsSetup(){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Attribute attr){
+ HX_STACKFRAME(&_hx_pos_afe8c32f000731b4_146_getDtlsSetup)
+HXLINE( 146) return (attr->key == HX_("setup",7d,ae,2f,7a));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_afe8c32f000731b4_145_getDtlsSetup)
+HXLINE( 146) ::snikket::jingle::Attribute setup = ( ( ::snikket::jingle::Attribute)(::Lambda_obj::find(this->attributes, ::Dynamic(new _hx_Closure_0()))) );
+HXLINE( 147) if (::hx::IsNotNull( setup )) {
+HXLINE( 147) return setup->value;
+ }
+HXLINE( 149) {
+HXLINE( 149) int _g = 0;
+HXDLIN( 149) ::Array< ::Dynamic> _g1 = this->media;
+HXDLIN( 149) while((_g < _g1->length)){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_1) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Attribute attr){
+ HX_STACKFRAME(&_hx_pos_afe8c32f000731b4_150_getDtlsSetup)
+HXLINE( 150) return (attr->key == HX_("setup",7d,ae,2f,7a));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE( 149) ::snikket::jingle::Media m = _g1->__get(_g).StaticCast< ::snikket::jingle::Media >();
+HXDLIN( 149) _g = (_g + 1);
+HXLINE( 150) ::snikket::jingle::Attribute mSetup = ( ( ::snikket::jingle::Attribute)(::Lambda_obj::find(m->attributes, ::Dynamic(new _hx_Closure_1()))) );
+HXLINE( 151) bool _hx_tmp;
+HXDLIN( 151) bool _hx_tmp1;
+HXDLIN( 151) if (::hx::IsNotNull( setup )) {
+HXLINE( 151) _hx_tmp1 = ::hx::IsNotNull( mSetup );
+ }
+ else {
+HXLINE( 151) _hx_tmp1 = false;
+ }
+HXDLIN( 151) if (_hx_tmp1) {
+HXLINE( 151) _hx_tmp = (setup->value != mSetup->value);
+ }
+ else {
+HXLINE( 151) _hx_tmp = false;
+ }
+HXDLIN( 151) if (_hx_tmp) {
+HXLINE( 151) HX_STACK_DO_THROW(HX_("setup not unique",41,2b,c2,d0));
+ }
+HXLINE( 152) setup = mSetup;
+ }
+ }
+HXLINE( 155) if (::hx::IsNull( setup )) {
+HXLINE( 155) HX_STACK_DO_THROW(HX_("no setup found",00,aa,01,99));
+ }
+HXLINE( 156) return setup->value;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(SessionDescription_obj,getDtlsSetup,return )
+
+ ::snikket::jingle::SessionDescription SessionDescription_obj::addContent( ::snikket::jingle::SessionDescription newDescription){
+ HX_GC_STACKFRAME(&_hx_pos_afe8c32f000731b4_159_addContent)
+HXLINE( 160) {
+HXLINE( 160) int _g = 0;
+HXDLIN( 160) ::Array< ::Dynamic> _g1 = newDescription->media;
+HXDLIN( 160) while((_g < _g1->length)){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::jingle::Media,newM) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Media m){
+ HX_STACKFRAME(&_hx_pos_afe8c32f000731b4_161_addContent)
+HXLINE( 161) return (m->mid == newM->mid);
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE( 160) ::snikket::jingle::Media newM = _g1->__get(_g).StaticCast< ::snikket::jingle::Media >();
+HXDLIN( 160) _g = (_g + 1);
+HXLINE( 161) if (::hx::IsNotNull( ::Lambda_obj::find(this->media, ::Dynamic(new _hx_Closure_0(newM))) )) {
+HXLINE( 162) HX_STACK_DO_THROW(((HX_("Media with id ",a7,bb,c2,d4) + newM->mid) + HX_(" already exists!",1d,5a,ba,6a)));
+ }
+ }
+ }
+HXLINE( 166) int _hx_tmp = this->version;
+HXLINE( 167) ::String _hx_tmp1 = this->name;
+HXLINE( 168) ::Array< ::Dynamic> _hx_tmp2 = this->media->concat(newDescription->media);
+HXLINE( 169) ::Array< ::Dynamic> _g2 = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 169) {
+HXLINE( 169) int _g3 = 0;
+HXDLIN( 169) ::Array< ::Dynamic> _g4 = this->attributes;
+HXDLIN( 169) while((_g3 < _g4->length)){
+HXLINE( 169) ::snikket::jingle::Attribute v = _g4->__get(_g3).StaticCast< ::snikket::jingle::Attribute >();
+HXDLIN( 169) _g3 = (_g3 + 1);
+HXDLIN( 169) if ((v->key != HX_("group",3f,b3,f4,99))) {
+HXLINE( 169) _g2->push(v);
+ }
+ }
+ }
+HXDLIN( 169) ::Array< ::Dynamic> _hx_tmp3 = _g2;
+HXDLIN( 169) ::Array< ::Dynamic> _g5 = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 169) {
+HXLINE( 169) int _g6 = 0;
+HXDLIN( 169) ::Array< ::Dynamic> _g7 = newDescription->attributes;
+HXDLIN( 169) while((_g6 < _g7->length)){
+HXLINE( 169) ::snikket::jingle::Attribute v1 = _g7->__get(_g6).StaticCast< ::snikket::jingle::Attribute >();
+HXDLIN( 169) _g6 = (_g6 + 1);
+HXDLIN( 169) if ((v1->key == HX_("group",3f,b3,f4,99))) {
+HXLINE( 169) _g5->push(v1);
+ }
+ }
+ }
+HXDLIN( 169) ::Array< ::Dynamic> _hx_tmp4 = _hx_tmp3->concat(_g5);
+HXLINE( 165) return ::snikket::jingle::SessionDescription_obj::__alloc( HX_CTX ,_hx_tmp,_hx_tmp1,_hx_tmp2,_hx_tmp4,newDescription->identificationTags);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(SessionDescription_obj,addContent,return )
+
+::String SessionDescription_obj::toSdp(){
+ HX_STACKFRAME(&_hx_pos_afe8c32f000731b4_175_toSdp)
+HXLINE( 176) ::String _hx_tmp = (((((((HX_("v=",07,67,00,00) + this->version) + HX_("\r\n",5d,0b,00,00)) + HX_("o=- 8770656990916039506 2 IN IP4 127.0.0.1\r\n",49,b1,52,5e)) + HX_("s=",6a,64,00,00)) + this->name) + HX_("\r\n",5d,0b,00,00)) + HX_("t=0 0\r\n",b4,f5,05,f4));
+HXLINE( 180) ::Array< ::Dynamic> _this = this->attributes;
+HXDLIN( 180) ::Array< ::String > result = ::Array_obj< ::String >::__new(_this->length);
+HXDLIN( 180) {
+HXLINE( 180) int _g = 0;
+HXDLIN( 180) int _g1 = _this->length;
+HXDLIN( 180) while((_g < _g1)){
+HXLINE( 180) _g = (_g + 1);
+HXDLIN( 180) int i = (_g - 1);
+HXDLIN( 180) {
+HXLINE( 180) ::String inValue = ( ( ::snikket::jingle::Attribute)(_hx_array_unsafe_get(_this,i)) )->toSdp();
+HXDLIN( 180) result->__unsafe_set(i,inValue);
+ }
+ }
+ }
+HXLINE( 176) ::String _hx_tmp1 = (_hx_tmp + result->join(HX_("",00,00,00,00)));
+HXLINE( 181) ::Array< ::Dynamic> _this1 = this->media;
+HXDLIN( 181) ::Array< ::String > result1 = ::Array_obj< ::String >::__new(_this1->length);
+HXDLIN( 181) {
+HXLINE( 181) int _g2 = 0;
+HXDLIN( 181) int _g3 = _this1->length;
+HXDLIN( 181) while((_g2 < _g3)){
+HXLINE( 181) _g2 = (_g2 + 1);
+HXDLIN( 181) int i1 = (_g2 - 1);
+HXDLIN( 181) {
+HXLINE( 181) ::String inValue1 = ( ( ::snikket::jingle::Media)(_hx_array_unsafe_get(_this1,i1)) )->toSdp();
+HXDLIN( 181) result1->__unsafe_set(i1,inValue1);
+ }
+ }
+ }
+HXLINE( 175) return (_hx_tmp1 + result1->join(HX_("",00,00,00,00)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(SessionDescription_obj,toSdp,return )
+
+ ::snikket::Stanza SessionDescription_obj::toStanza(::String action,::String sid,bool initiator){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Attribute attr){
+ HX_GC_STACKFRAME(&_hx_pos_afe8c32f000731b4_187_toStanza)
+HXLINE( 187) return (attr->key == HX_("group",3f,b3,f4,99));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_afe8c32f000731b4_184_toStanza)
+HXLINE( 185) ::snikket::Stanza iq = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("iq",e8,5b,00,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("type",ba,f2,08,4d),HX_("set",a2,9b,57,00))));
+HXLINE( 186) ::snikket::Stanza jingle = iq->tag(HX_("jingle",31,27,eb,1f), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("sid",0e,9f,57,00),sid)
+ ->setFixed(1,HX_("action",b6,3b,46,16),action)
+ ->setFixed(2,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:jingle:1",44,c4,fe,f7))));
+HXLINE( 187) ::snikket::jingle::Attribute group = ( ( ::snikket::jingle::Attribute)(::Lambda_obj::find(this->attributes, ::Dynamic(new _hx_Closure_0()))) );
+HXLINE( 188) if (::hx::IsNotNull( group )) {
+HXLINE( 189) jingle->addChild(::snikket::jingle::Group_obj::parse(group->value)->toElement());
+ }
+HXLINE( 191) {
+HXLINE( 191) int _g = 0;
+HXDLIN( 191) ::Array< ::Dynamic> _g1 = this->media;
+HXDLIN( 191) while((_g < _g1->length)){
+HXLINE( 191) ::snikket::jingle::Media m = _g1->__get(_g).StaticCast< ::snikket::jingle::Media >();
+HXDLIN( 191) _g = (_g + 1);
+HXLINE( 192) jingle->addChild(m->toElement(this->attributes,initiator));
+ }
+ }
+HXLINE( 194) jingle->up();
+HXLINE( 195) return iq;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(SessionDescription_obj,toStanza,return )
+
+ ::snikket::jingle::SessionDescription SessionDescription_obj::parse(::String input){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_2) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Attribute attr){
+ HX_GC_STACKFRAME(&_hx_pos_afe8c32f000731b4_89_parse)
+HXLINE( 89) return (attr->key == HX_("group",3f,b3,f4,99));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_afe8c32f000731b4_21_parse)
+HXLINE( 22) int version = 0;
+HXLINE( 23) ::String name = HX_("-",2d,00,00,00);
+HXLINE( 24) ::Array< ::Dynamic> attributes = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 25) ::Array< ::Dynamic> media = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 26) ::Array< ::Dynamic> currentAttributes = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 27) ::Dynamic currentMedia = null();
+HXLINE( 29) {
+HXLINE( 29) int _g = 0;
+HXDLIN( 29) ::Array< ::String > _g1 = input.split(HX_("\r\n",5d,0b,00,00));
+HXDLIN( 29) while((_g < _g1->length)){
+HXLINE( 29) ::String line = _g1->__get(_g);
+HXDLIN( 29) _g = (_g + 1);
+HXLINE( 30) if ((line.indexOf(HX_("=",3d,00,00,00),null()) != 1)) {
+HXLINE( 31) continue;
+ }
+HXLINE( 33) ::String value = line.substr(2,null());
+HXLINE( 34) ::String _hx_switch_0 = line.charAt(0);
+ if ( (_hx_switch_0==HX_("a",61,00,00,00)) ){
+HXLINE( 40) currentAttributes->push(::snikket::jingle::Attribute_obj::parse(value));
+HXDLIN( 40) goto _hx_goto_23;
+ }
+ if ( (_hx_switch_0==HX_("c",63,00,00,00)) ){
+HXLINE( 69) if (::hx::IsNotNull( currentMedia )) {
+HXLINE( 69) currentMedia->__SetField(HX_("connectionData",68,89,24,76),value,::hx::paccDynamic);
+ }
+HXDLIN( 69) goto _hx_goto_23;
+ }
+ if ( (_hx_switch_0==HX_("m",6d,00,00,00)) ){
+HXLINE( 42) if (::hx::IsNull( currentMedia )) {
+HXLINE( 43) attributes = currentAttributes;
+ }
+ else {
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Attribute attr){
+ HX_STACKFRAME(&_hx_pos_afe8c32f000731b4_45_parse)
+HXLINE( 45) return (attr->key == HX_("mid",88,11,53,00));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE( 45) ::snikket::jingle::Attribute mid = ( ( ::snikket::jingle::Attribute)(::Lambda_obj::find(currentAttributes, ::Dynamic(new _hx_Closure_0()))) );
+HXLINE( 47) ::String _hx_tmp;
+HXDLIN( 47) if (::hx::IsNull( mid )) {
+HXLINE( 47) _hx_tmp = null();
+ }
+ else {
+HXLINE( 47) _hx_tmp = mid->value;
+ }
+HXLINE( 46) media->push( ::snikket::jingle::Media_obj::__alloc( HX_CTX ,_hx_tmp,( (::String)(currentMedia->__Field(HX_("media",e4,04,bc,05),::hx::paccDynamic)) ),( (::String)(currentMedia->__Field(HX_("connectionData",68,89,24,76),::hx::paccDynamic)) ),( (::String)(currentMedia->__Field(HX_("port",81,83,5c,4a),::hx::paccDynamic)) ),( (::String)(currentMedia->__Field(HX_("protocol",58,56,63,00),::hx::paccDynamic)) ),currentAttributes,( (::Array< int >)(currentMedia->__Field(HX_("formats",5c,c1,2e,df),::hx::paccDynamic)) )));
+ }
+HXLINE( 56) currentAttributes = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 57) ::Array< ::String > segments = value.split(HX_(" ",20,00,00,00));
+HXLINE( 58) if ((segments->length >= 3)) {
+HXLINE( 60) ::String segments1 = segments->__get(0);
+HXLINE( 61) ::String segments2 = segments->__get(1);
+HXLINE( 62) ::String segments3 = segments->__get(2);
+HXLINE( 63) ::Array< ::String > _this = segments->slice(3,null());
+HXDLIN( 63) ::Array< ::Dynamic> result = ::Array_obj< ::Dynamic>::__new(_this->length);
+HXDLIN( 63) {
+HXLINE( 63) int _g2 = 0;
+HXDLIN( 63) int _g3 = _this->length;
+HXDLIN( 63) while((_g2 < _g3)){
+HXLINE( 63) _g2 = (_g2 + 1);
+HXDLIN( 63) int i = (_g2 - 1);
+HXDLIN( 63) {
+HXLINE( 63) ::Dynamic inValue = ::Std_obj::parseInt(( (::String)(_hx_array_unsafe_get(_this,i)) ));
+HXDLIN( 63) result->__unsafe_set(i,inValue);
+ }
+ }
+ }
+HXLINE( 59) currentMedia = ::Dynamic(::hx::Anon_obj::Create(4)
+ ->setFixed(0,HX_("formats",5c,c1,2e,df),result)
+ ->setFixed(1,HX_("protocol",58,56,63,00),segments3)
+ ->setFixed(2,HX_("media",e4,04,bc,05),segments1)
+ ->setFixed(3,HX_("port",81,83,5c,4a),segments2));
+ }
+ else {
+HXLINE( 66) currentMedia = ::Dynamic(::hx::Anon_obj::Create(0));
+ }
+HXLINE( 41) goto _hx_goto_23;
+ }
+ if ( (_hx_switch_0==HX_("s",73,00,00,00)) ){
+HXLINE( 38) name = value;
+HXDLIN( 38) goto _hx_goto_23;
+ }
+ if ( (_hx_switch_0==HX_("v",76,00,00,00)) ){
+HXLINE( 36) version = ( (int)(::Std_obj::parseInt(value)) );
+HXDLIN( 36) goto _hx_goto_23;
+ }
+ _hx_goto_23:;
+ }
+ }
+HXLINE( 73) if (::hx::IsNotNull( currentMedia )) {
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_1) HXARGC(1)
+ bool _hx_run( ::snikket::jingle::Attribute attr){
+ HX_GC_STACKFRAME(&_hx_pos_afe8c32f000731b4_74_parse)
+HXLINE( 74) return (attr->key == HX_("mid",88,11,53,00));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE( 74) ::snikket::jingle::Attribute mid1 = ( ( ::snikket::jingle::Attribute)(::Lambda_obj::find(currentAttributes, ::Dynamic(new _hx_Closure_1()))) );
+HXLINE( 76) ::String _hx_tmp1;
+HXDLIN( 76) if (::hx::IsNull( mid1 )) {
+HXLINE( 76) _hx_tmp1 = null();
+ }
+ else {
+HXLINE( 76) _hx_tmp1 = mid1->value;
+ }
+HXLINE( 75) media->push( ::snikket::jingle::Media_obj::__alloc( HX_CTX ,_hx_tmp1,( (::String)(currentMedia->__Field(HX_("media",e4,04,bc,05),::hx::paccDynamic)) ),( (::String)(currentMedia->__Field(HX_("connectionData",68,89,24,76),::hx::paccDynamic)) ),( (::String)(currentMedia->__Field(HX_("port",81,83,5c,4a),::hx::paccDynamic)) ),( (::String)(currentMedia->__Field(HX_("protocol",58,56,63,00),::hx::paccDynamic)) ),currentAttributes,( (::Array< int >)(currentMedia->__Field(HX_("formats",5c,c1,2e,df),::hx::paccDynamic)) )));
+ }
+ else {
+HXLINE( 85) attributes = currentAttributes;
+ }
+HXLINE( 88) ::Array< ::String > tags;
+HXLINE( 89) ::snikket::jingle::Attribute group = ( ( ::snikket::jingle::Attribute)(::Lambda_obj::find(attributes, ::Dynamic(new _hx_Closure_2()))) );
+HXLINE( 90) if (::hx::IsNotNull( group )) {
+HXLINE( 91) tags = ::snikket::jingle::Group_obj::parse(group->value)->identificationTags;
+ }
+ else {
+HXLINE( 93) ::Array< ::String > result1 = ::Array_obj< ::String >::__new(media->length);
+HXDLIN( 93) {
+HXLINE( 93) int _g4 = 0;
+HXDLIN( 93) int _g5 = media->length;
+HXDLIN( 93) while((_g4 < _g5)){
+HXLINE( 93) _g4 = (_g4 + 1);
+HXDLIN( 93) int i1 = (_g4 - 1);
+HXDLIN( 93) {
+HXLINE( 93) ::String inValue1 = ( ( ::snikket::jingle::Media)(_hx_array_unsafe_get(media,i1)) )->mid;
+HXDLIN( 93) result1->__unsafe_set(i1,inValue1);
+ }
+ }
+ }
+HXDLIN( 93) tags = result1;
+ }
+HXLINE( 96) return ::snikket::jingle::SessionDescription_obj::__alloc( HX_CTX ,version,name,media,attributes,tags);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC1(SessionDescription_obj,parse,return )
+
+ ::snikket::jingle::SessionDescription SessionDescription_obj::fromStanza( ::snikket::Stanza iq,bool initiator, ::snikket::jingle::SessionDescription existingDescription){
+ HX_GC_STACKFRAME(&_hx_pos_afe8c32f000731b4_99_fromStanza)
+HXLINE( 100) ::Array< ::Dynamic> attributes = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 101) ::snikket::Stanza jingle = iq->getChild(HX_("jingle",31,27,eb,1f),HX_("urn:xmpp:jingle:1",44,c4,fe,f7));
+HXLINE( 102) ::snikket::Stanza group = jingle->getChild(HX_("group",3f,b3,f4,99),HX_("urn:xmpp:jingle:apps:grouping:0",14,f9,f4,ed));
+HXLINE( 103) ::Array< ::Dynamic> _this = jingle->allTags(HX_("content",39,8d,77,19),null());
+HXDLIN( 103) ::Array< ::Dynamic> result = ::Array_obj< ::Dynamic>::__new(_this->length);
+HXDLIN( 103) {
+HXLINE( 103) int _g = 0;
+HXDLIN( 103) int _g1 = _this->length;
+HXDLIN( 103) while((_g < _g1)){
+HXLINE( 103) _g = (_g + 1);
+HXDLIN( 103) int i = (_g - 1);
+HXDLIN( 103) {
+HXLINE( 103) ::snikket::jingle::Media inValue = ::snikket::jingle::Media_obj::fromElement(( ( ::snikket::Stanza)(_hx_array_unsafe_get(_this,i)) ),initiator,::hx::IsNotNull( group ),existingDescription);
+HXDLIN( 103) result->__unsafe_set(i,inValue);
+ }
+ }
+ }
+HXDLIN( 103) ::Array< ::Dynamic> media = result;
+HXLINE( 105) ::Array< ::String > tags;
+HXLINE( 106) if (::hx::IsNotNull( group )) {
+HXLINE( 107) ::snikket::jingle::Group group1 = ::snikket::jingle::Group_obj::fromElement(group);
+HXLINE( 108) attributes->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("group",3f,b3,f4,99),group1->toSdp()));
+HXLINE( 109) tags = group1->identificationTags;
+ }
+ else {
+HXLINE( 111) ::Array< ::String > result1 = ::Array_obj< ::String >::__new(media->length);
+HXDLIN( 111) {
+HXLINE( 111) int _g2 = 0;
+HXDLIN( 111) int _g3 = media->length;
+HXDLIN( 111) while((_g2 < _g3)){
+HXLINE( 111) _g2 = (_g2 + 1);
+HXDLIN( 111) int i1 = (_g2 - 1);
+HXDLIN( 111) {
+HXLINE( 111) ::String inValue1 = ( ( ::snikket::jingle::Media)(_hx_array_unsafe_get(media,i1)) )->mid;
+HXDLIN( 111) result1->__unsafe_set(i1,inValue1);
+ }
+ }
+ }
+HXDLIN( 111) tags = result1;
+ }
+HXLINE( 113) attributes->push( ::snikket::jingle::Attribute_obj::__alloc( HX_CTX ,HX_("msid-semantic",52,85,27,1a),HX_("WMS my-media-stream",27,86,65,d5)));
+HXLINE( 115) return ::snikket::jingle::SessionDescription_obj::__alloc( HX_CTX ,0,HX_("-",2d,00,00,00),media,attributes,tags);
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC3(SessionDescription_obj,fromStanza,return )
+
+
+::hx::ObjectPtr< SessionDescription_obj > SessionDescription_obj::__new(int version,::String name,::Array< ::Dynamic> media,::Array< ::Dynamic> attributes,::Array< ::String > identificationTags) {
+ ::hx::ObjectPtr< SessionDescription_obj > __this = new SessionDescription_obj();
+ __this->__construct(version,name,media,attributes,identificationTags);
+ return __this;
+}
+
+::hx::ObjectPtr< SessionDescription_obj > SessionDescription_obj::__alloc(::hx::Ctx *_hx_ctx,int version,::String name,::Array< ::Dynamic> media,::Array< ::Dynamic> attributes,::Array< ::String > identificationTags) {
+ SessionDescription_obj *__this = (SessionDescription_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(SessionDescription_obj), true, "snikket.jingle.SessionDescription"));
+ *(void **)__this = SessionDescription_obj::_hx_vtable;
+ __this->__construct(version,name,media,attributes,identificationTags);
+ return __this;
+}
+
+SessionDescription_obj::SessionDescription_obj()
+{
+}
+
+void SessionDescription_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(SessionDescription);
+ HX_MARK_MEMBER_NAME(version,"version");
+ HX_MARK_MEMBER_NAME(name,"name");
+ HX_MARK_MEMBER_NAME(media,"media");
+ HX_MARK_MEMBER_NAME(attributes,"attributes");
+ HX_MARK_MEMBER_NAME(identificationTags,"identificationTags");
+ HX_MARK_END_CLASS();
+}
+
+void SessionDescription_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(version,"version");
+ HX_VISIT_MEMBER_NAME(name,"name");
+ HX_VISIT_MEMBER_NAME(media,"media");
+ HX_VISIT_MEMBER_NAME(attributes,"attributes");
+ HX_VISIT_MEMBER_NAME(identificationTags,"identificationTags");
+}
+
+::hx::Val SessionDescription_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"name") ) { return ::hx::Val( name ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"media") ) { return ::hx::Val( media ); }
+ if (HX_FIELD_EQ(inName,"toSdp") ) { return ::hx::Val( toSdp_dyn() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"version") ) { return ::hx::Val( version ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"toStanza") ) { return ::hx::Val( toStanza_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"attributes") ) { return ::hx::Val( attributes ); }
+ if (HX_FIELD_EQ(inName,"addContent") ) { return ::hx::Val( addContent_dyn() ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"getUfragPwd") ) { return ::hx::Val( getUfragPwd_dyn() ); }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"getDtlsSetup") ) { return ::hx::Val( getDtlsSetup_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"getFingerprint") ) { return ::hx::Val( getFingerprint_dyn() ); }
+ break;
+ case 18:
+ if (HX_FIELD_EQ(inName,"identificationTags") ) { return ::hx::Val( identificationTags ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool SessionDescription_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"parse") ) { outValue = parse_dyn(); return true; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"fromStanza") ) { outValue = fromStanza_dyn(); return true; }
+ }
+ return false;
+}
+
+::hx::Val SessionDescription_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"name") ) { name=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"media") ) { media=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"version") ) { version=inValue.Cast< int >(); return inValue; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"attributes") ) { attributes=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ break;
+ case 18:
+ if (HX_FIELD_EQ(inName,"identificationTags") ) { identificationTags=inValue.Cast< ::Array< ::String > >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void SessionDescription_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("version",18,e7,f1,7c));
+ outFields->push(HX_("name",4b,72,ff,48));
+ outFields->push(HX_("media",e4,04,bc,05));
+ outFields->push(HX_("attributes",d7,a8,71,97));
+ outFields->push(HX_("identificationTags",67,19,46,5f));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo SessionDescription_obj_sMemberStorageInfo[] = {
+ {::hx::fsInt,(int)offsetof(SessionDescription_obj,version),HX_("version",18,e7,f1,7c)},
+ {::hx::fsString,(int)offsetof(SessionDescription_obj,name),HX_("name",4b,72,ff,48)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(SessionDescription_obj,media),HX_("media",e4,04,bc,05)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(SessionDescription_obj,attributes),HX_("attributes",d7,a8,71,97)},
+ {::hx::fsObject /* ::Array< ::String > */ ,(int)offsetof(SessionDescription_obj,identificationTags),HX_("identificationTags",67,19,46,5f)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *SessionDescription_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String SessionDescription_obj_sMemberFields[] = {
+ HX_("version",18,e7,f1,7c),
+ HX_("name",4b,72,ff,48),
+ HX_("media",e4,04,bc,05),
+ HX_("attributes",d7,a8,71,97),
+ HX_("identificationTags",67,19,46,5f),
+ HX_("getUfragPwd",4c,b9,6e,8e),
+ HX_("getFingerprint",ee,96,01,2b),
+ HX_("getDtlsSetup",70,0d,f5,f3),
+ HX_("addContent",18,b9,01,81),
+ HX_("toSdp",04,4c,19,14),
+ HX_("toStanza",d0,05,36,2d),
+ ::String(null()) };
+
+::hx::Class SessionDescription_obj::__mClass;
+
+static ::String SessionDescription_obj_sStaticFields[] = {
+ HX_("parse",33,90,55,bd),
+ HX_("fromStanza",ff,62,3b,49),
+ ::String(null())
+};
+
+void SessionDescription_obj::__register()
+{
+ SessionDescription_obj _hx_dummy;
+ SessionDescription_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.jingle.SessionDescription",52,47,23,48);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &SessionDescription_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(SessionDescription_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(SessionDescription_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< SessionDescription_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = SessionDescription_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = SessionDescription_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace jingle
diff --git a/Sources/c_snikket/src/snikket/jingle/TransportInfo.cpp b/Sources/c_snikket/src/snikket/jingle/TransportInfo.cpp
new file mode 100644
index 0000000..aa4b1f0
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/jingle/TransportInfo.cpp
@@ -0,0 +1,170 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_Attribute
+#include <snikket/jingle/Attribute.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_Media
+#include <snikket/jingle/Media.h>
+#endif
+#ifndef INCLUDED_snikket_jingle_TransportInfo
+#include <snikket/jingle/TransportInfo.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_2f4cd1362b4c5e4a_203_new,"snikket.jingle.TransportInfo","new",0xbd55809d,"snikket.jingle.TransportInfo.new","snikket/jingle/SessionDescription.hx",203,0x68af748c)
+HX_LOCAL_STACK_FRAME(_hx_pos_2f4cd1362b4c5e4a_208_toStanza,"snikket.jingle.TransportInfo","toStanza",0xdfdb5873,"snikket.jingle.TransportInfo.toStanza","snikket/jingle/SessionDescription.hx",208,0x68af748c)
+namespace snikket{
+namespace jingle{
+
+void TransportInfo_obj::__construct( ::snikket::jingle::Media media,::String sid){
+ HX_STACKFRAME(&_hx_pos_2f4cd1362b4c5e4a_203_new)
+HXLINE( 204) this->media = media;
+HXLINE( 205) this->sid = sid;
+ }
+
+Dynamic TransportInfo_obj::__CreateEmpty() { return new TransportInfo_obj; }
+
+void *TransportInfo_obj::_hx_vtable = 0;
+
+Dynamic TransportInfo_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< TransportInfo_obj > _hx_result = new TransportInfo_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1]);
+ return _hx_result;
+}
+
+bool TransportInfo_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x4c85e215;
+}
+
+ ::snikket::Stanza TransportInfo_obj::toStanza(bool initiator){
+ HX_GC_STACKFRAME(&_hx_pos_2f4cd1362b4c5e4a_208_toStanza)
+HXLINE( 209) ::snikket::Stanza iq = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("iq",e8,5b,00,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("type",ba,f2,08,4d),HX_("set",a2,9b,57,00))));
+HXLINE( 210) ::snikket::Stanza jingle = iq->tag(HX_("jingle",31,27,eb,1f), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("sid",0e,9f,57,00),this->sid)
+ ->setFixed(1,HX_("action",b6,3b,46,16),HX_("transport-info",d2,9e,05,1c))
+ ->setFixed(2,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:jingle:1",44,c4,fe,f7))));
+HXLINE( 211) ::snikket::Stanza _hx_tmp = this->media->contentElement(initiator);
+HXDLIN( 211) jingle->addChild(_hx_tmp->addChild(this->media->toTransportElement(::Array_obj< ::Dynamic>::__new(0)))->up());
+HXLINE( 212) jingle->up();
+HXLINE( 213) return iq;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(TransportInfo_obj,toStanza,return )
+
+
+::hx::ObjectPtr< TransportInfo_obj > TransportInfo_obj::__new( ::snikket::jingle::Media media,::String sid) {
+ ::hx::ObjectPtr< TransportInfo_obj > __this = new TransportInfo_obj();
+ __this->__construct(media,sid);
+ return __this;
+}
+
+::hx::ObjectPtr< TransportInfo_obj > TransportInfo_obj::__alloc(::hx::Ctx *_hx_ctx, ::snikket::jingle::Media media,::String sid) {
+ TransportInfo_obj *__this = (TransportInfo_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(TransportInfo_obj), true, "snikket.jingle.TransportInfo"));
+ *(void **)__this = TransportInfo_obj::_hx_vtable;
+ __this->__construct(media,sid);
+ return __this;
+}
+
+TransportInfo_obj::TransportInfo_obj()
+{
+}
+
+void TransportInfo_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(TransportInfo);
+ HX_MARK_MEMBER_NAME(media,"media");
+ HX_MARK_MEMBER_NAME(sid,"sid");
+ HX_MARK_END_CLASS();
+}
+
+void TransportInfo_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(media,"media");
+ HX_VISIT_MEMBER_NAME(sid,"sid");
+}
+
+::hx::Val TransportInfo_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"sid") ) { return ::hx::Val( sid ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"media") ) { return ::hx::Val( media ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"toStanza") ) { return ::hx::Val( toStanza_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val TransportInfo_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"sid") ) { sid=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"media") ) { media=inValue.Cast< ::snikket::jingle::Media >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void TransportInfo_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("media",e4,04,bc,05));
+ outFields->push(HX_("sid",0e,9f,57,00));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo TransportInfo_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::snikket::jingle::Media */ ,(int)offsetof(TransportInfo_obj,media),HX_("media",e4,04,bc,05)},
+ {::hx::fsString,(int)offsetof(TransportInfo_obj,sid),HX_("sid",0e,9f,57,00)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *TransportInfo_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String TransportInfo_obj_sMemberFields[] = {
+ HX_("media",e4,04,bc,05),
+ HX_("sid",0e,9f,57,00),
+ HX_("toStanza",d0,05,36,2d),
+ ::String(null()) };
+
+::hx::Class TransportInfo_obj::__mClass;
+
+void TransportInfo_obj::__register()
+{
+ TransportInfo_obj _hx_dummy;
+ TransportInfo_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.jingle.TransportInfo",2b,ee,cf,6a);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(TransportInfo_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< TransportInfo_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = TransportInfo_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = TransportInfo_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace jingle
diff --git a/Sources/c_snikket/src/snikket/jingle/_Session/Session_Fields_.cpp b/Sources/c_snikket/src/snikket/jingle/_Session/Session_Fields_.cpp
new file mode 100644
index 0000000..9a2e50d
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/jingle/_Session/Session_Fields_.cpp
@@ -0,0 +1,132 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Date
+#include <Date.h>
+#endif
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessage
+#include <snikket/ChatMessage.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessageBuilder
+#include <snikket/ChatMessageBuilder.h>
+#endif
+#ifndef INCLUDED_snikket_Date
+#include <snikket/Date.h>
+#endif
+#ifndef INCLUDED_snikket_ID
+#include <snikket/ID.h>
+#endif
+#ifndef INCLUDED_snikket_JID
+#include <snikket/JID.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_jingle__Session_Session_Fields_
+#include <snikket/jingle/_Session/Session_Fields_.h>
+#endif
+
+HX_LOCAL_STACK_FRAME(_hx_pos_02df9d92159f3aa0_40_mkCallMessage,"snikket.jingle._Session.Session_Fields_","mkCallMessage",0x268ca02f,"snikket.jingle._Session.Session_Fields_.mkCallMessage","snikket/jingle/Session.hx",40,0x6db2dd54)
+namespace snikket{
+namespace jingle{
+namespace _Session{
+
+void Session_Fields__obj::__construct() { }
+
+Dynamic Session_Fields__obj::__CreateEmpty() { return new Session_Fields__obj; }
+
+void *Session_Fields__obj::_hx_vtable = 0;
+
+Dynamic Session_Fields__obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Session_Fields__obj > _hx_result = new Session_Fields__obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool Session_Fields__obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x4b7e6858;
+}
+
+ ::snikket::ChatMessage Session_Fields__obj::mkCallMessage( ::snikket::JID to, ::snikket::JID from, ::snikket::Stanza event){
+ HX_GC_STACKFRAME(&_hx_pos_02df9d92159f3aa0_40_mkCallMessage)
+HXLINE( 41) ::snikket::ChatMessageBuilder m = ::snikket::ChatMessageBuilder_obj::__alloc( HX_CTX );
+HXLINE( 42) m->type = 1;
+HXLINE( 43) m->to = to;
+HXLINE( 44) m->recipients = ::Array_obj< ::Dynamic>::__new(1)->init(0,to->asBare());
+HXLINE( 45) m->from = from;
+HXLINE( 46) m->sender = m->from->asBare();
+HXLINE( 47) m->replyTo = ::Array_obj< ::Dynamic>::__new(1)->init(0,m->sender);
+HXLINE( 48) m->direction = 1;
+HXLINE( 49) m->text = (HX_("call ",c2,71,1b,41) + event->name);
+HXLINE( 50) m->timestamp = ::snikket::Date_obj::format(::Date_obj::now());
+HXLINE( 51) m->payloads->push(event);
+HXLINE( 52) m->localId = ::snikket::ID_obj::_hx_long();
+HXLINE( 53) if ((event->name != HX_("propose",fe,fe,e9,f9))) {
+HXLINE( 54) m->versions = ::Array_obj< ::Dynamic>::__new(1)->init(0,m->build());
+ }
+HXLINE( 56) m->localId = ( (::String)(::Reflect_obj::field(event->attr,HX_("id",db,5b,00,00))) );
+HXLINE( 57) return m->build();
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC3(Session_Fields__obj,mkCallMessage,return )
+
+
+Session_Fields__obj::Session_Fields__obj()
+{
+}
+
+bool Session_Fields__obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 13:
+ if (HX_FIELD_EQ(inName,"mkCallMessage") ) { outValue = mkCallMessage_dyn(); return true; }
+ }
+ return false;
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *Session_Fields__obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *Session_Fields__obj_sStaticStorageInfo = 0;
+#endif
+
+::hx::Class Session_Fields__obj::__mClass;
+
+static ::String Session_Fields__obj_sStaticFields[] = {
+ HX_("mkCallMessage",0b,8e,e8,4a),
+ ::String(null())
+};
+
+void Session_Fields__obj::__register()
+{
+ Session_Fields__obj _hx_dummy;
+ Session_Fields__obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.jingle._Session.Session_Fields_",92,bb,4c,2e);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &Session_Fields__obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(Session_Fields__obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(0 /* sMemberFields */);
+ __mClass->mCanCast = ::hx::TCanCast< Session_Fields__obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Session_Fields__obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Session_Fields__obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace jingle
+} // end namespace _Session
diff --git a/Sources/c_snikket/src/snikket/persistence/Dummy.cpp b/Sources/c_snikket/src/snikket/persistence/Dummy.cpp
new file mode 100644
index 0000000..4bab518
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/persistence/Dummy.cpp
@@ -0,0 +1,512 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_Caps
+#include <snikket/Caps.h>
+#endif
+#ifndef INCLUDED_snikket_Chat
+#include <snikket/Chat.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessage
+#include <snikket/ChatMessage.h>
+#endif
+#ifndef INCLUDED_snikket_Persistence
+#include <snikket/Persistence.h>
+#endif
+#ifndef INCLUDED_snikket_ReactionUpdate
+#include <snikket/ReactionUpdate.h>
+#endif
+#ifndef INCLUDED_snikket_SerializedChat
+#include <snikket/SerializedChat.h>
+#endif
+#ifndef INCLUDED_snikket_persistence_Dummy
+#include <snikket/persistence/Dummy.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_929f3522faf0dc9d_24_new,"snikket.persistence.Dummy","new",0x955fa47a,"snikket.persistence.Dummy.new","snikket/persistence/Dummy.hx",24,0x75c8d7b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_929f3522faf0dc9d_28_lastId,"snikket.persistence.Dummy","lastId",0x6b0543f7,"snikket.persistence.Dummy.lastId","snikket/persistence/Dummy.hx",28,0x75c8d7b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_929f3522faf0dc9d_32_storeChats,"snikket.persistence.Dummy","storeChats",0x0b288e20,"snikket.persistence.Dummy.storeChats","snikket/persistence/Dummy.hx",32,0x75c8d7b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_929f3522faf0dc9d_36_getChats,"snikket.persistence.Dummy","getChats",0xf665bbcb,"snikket.persistence.Dummy.getChats","snikket/persistence/Dummy.hx",36,0x75c8d7b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_929f3522faf0dc9d_41_storeMessages,"snikket.persistence.Dummy","storeMessages",0xa1f1aa67,"snikket.persistence.Dummy.storeMessages","snikket/persistence/Dummy.hx",41,0x75c8d7b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_929f3522faf0dc9d_45_updateMessage,"snikket.persistence.Dummy","updateMessage",0x1db35358,"snikket.persistence.Dummy.updateMessage","snikket/persistence/Dummy.hx",45,0x75c8d7b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_929f3522faf0dc9d_50_getMessage,"snikket.persistence.Dummy","getMessage",0x7168fef7,"snikket.persistence.Dummy.getMessage","snikket/persistence/Dummy.hx",50,0x75c8d7b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_929f3522faf0dc9d_55_getMessagesBefore,"snikket.persistence.Dummy","getMessagesBefore",0xc569ff3b,"snikket.persistence.Dummy.getMessagesBefore","snikket/persistence/Dummy.hx",55,0x75c8d7b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_929f3522faf0dc9d_60_getMessagesAfter,"snikket.persistence.Dummy","getMessagesAfter",0x864b66e0,"snikket.persistence.Dummy.getMessagesAfter","snikket/persistence/Dummy.hx",60,0x75c8d7b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_929f3522faf0dc9d_65_getMessagesAround,"snikket.persistence.Dummy","getMessagesAround",0xe13ba309,"snikket.persistence.Dummy.getMessagesAround","snikket/persistence/Dummy.hx",65,0x75c8d7b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_929f3522faf0dc9d_70_getChatsUnreadDetails,"snikket.persistence.Dummy","getChatsUnreadDetails",0x913fb788,"snikket.persistence.Dummy.getChatsUnreadDetails","snikket/persistence/Dummy.hx",70,0x75c8d7b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_929f3522faf0dc9d_75_storeReaction,"snikket.persistence.Dummy","storeReaction",0x63a8b944,"snikket.persistence.Dummy.storeReaction","snikket/persistence/Dummy.hx",75,0x75c8d7b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_929f3522faf0dc9d_80_updateMessageStatus,"snikket.persistence.Dummy","updateMessageStatus",0xe164c0aa,"snikket.persistence.Dummy.updateMessageStatus","snikket/persistence/Dummy.hx",80,0x75c8d7b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_929f3522faf0dc9d_85_getMediaUri,"snikket.persistence.Dummy","getMediaUri",0x090c45b8,"snikket.persistence.Dummy.getMediaUri","snikket/persistence/Dummy.hx",85,0x75c8d7b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_929f3522faf0dc9d_90_hasMedia,"snikket.persistence.Dummy","hasMedia",0xe2ef5cd0,"snikket.persistence.Dummy.hasMedia","snikket/persistence/Dummy.hx",90,0x75c8d7b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_929f3522faf0dc9d_95_storeMedia,"snikket.persistence.Dummy","storeMedia",0xcb30f469,"snikket.persistence.Dummy.storeMedia","snikket/persistence/Dummy.hx",95,0x75c8d7b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_929f3522faf0dc9d_99_removeMedia,"snikket.persistence.Dummy","removeMedia",0x7374601a,"snikket.persistence.Dummy.removeMedia","snikket/persistence/Dummy.hx",99,0x75c8d7b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_929f3522faf0dc9d_103_storeCaps,"snikket.persistence.Dummy","storeCaps",0x0ca8443c,"snikket.persistence.Dummy.storeCaps","snikket/persistence/Dummy.hx",103,0x75c8d7b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_929f3522faf0dc9d_107_getCaps,"snikket.persistence.Dummy","getCaps",0x762db4f1,"snikket.persistence.Dummy.getCaps","snikket/persistence/Dummy.hx",107,0x75c8d7b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_929f3522faf0dc9d_111_storeLogin,"snikket.persistence.Dummy","storeLogin",0x3e68c8ee,"snikket.persistence.Dummy.storeLogin","snikket/persistence/Dummy.hx",111,0x75c8d7b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_929f3522faf0dc9d_115_getLogin,"snikket.persistence.Dummy","getLogin",0x29a5f699,"snikket.persistence.Dummy.getLogin","snikket/persistence/Dummy.hx",115,0x75c8d7b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_929f3522faf0dc9d_119_removeAccount,"snikket.persistence.Dummy","removeAccount",0x32481163,"snikket.persistence.Dummy.removeAccount","snikket/persistence/Dummy.hx",119,0x75c8d7b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_929f3522faf0dc9d_123_listAccounts,"snikket.persistence.Dummy","listAccounts",0x1a525a4a,"snikket.persistence.Dummy.listAccounts","snikket/persistence/Dummy.hx",123,0x75c8d7b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_929f3522faf0dc9d_127_storeStreamManagement,"snikket.persistence.Dummy","storeStreamManagement",0x999cffbe,"snikket.persistence.Dummy.storeStreamManagement","snikket/persistence/Dummy.hx",127,0x75c8d7b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_929f3522faf0dc9d_131_getStreamManagement,"snikket.persistence.Dummy","getStreamManagement",0x3ea32bf3,"snikket.persistence.Dummy.getStreamManagement","snikket/persistence/Dummy.hx",131,0x75c8d7b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_929f3522faf0dc9d_135_storeService,"snikket.persistence.Dummy","storeService",0xc260b6fa,"snikket.persistence.Dummy.storeService","snikket/persistence/Dummy.hx",135,0x75c8d7b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_929f3522faf0dc9d_139_findServicesWithFeature,"snikket.persistence.Dummy","findServicesWithFeature",0xc3938bb3,"snikket.persistence.Dummy.findServicesWithFeature","snikket/persistence/Dummy.hx",139,0x75c8d7b8)
+HX_LOCAL_STACK_FRAME(_hx_pos_929f3522faf0dc9d_18_boot,"snikket.persistence.Dummy","boot",0x166946d8,"snikket.persistence.Dummy.boot","snikket/persistence/Dummy.hx",18,0x75c8d7b8)
+namespace snikket{
+namespace persistence{
+
+void Dummy_obj::__construct(){
+ HX_STACKFRAME(&_hx_pos_929f3522faf0dc9d_24_new)
+ }
+
+Dynamic Dummy_obj::__CreateEmpty() { return new Dummy_obj; }
+
+void *Dummy_obj::_hx_vtable = 0;
+
+Dynamic Dummy_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Dummy_obj > _hx_result = new Dummy_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool Dummy_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x130a03e2;
+}
+
+static ::snikket::Persistence_obj _hx_snikket_persistence_Dummy__hx_snikket_Persistence= {
+ ( void (::hx::Object::*)(::String,::String, ::Dynamic))&::snikket::persistence::Dummy_obj::lastId,
+ ( void (::hx::Object::*)(::String,::Array< ::Dynamic>))&::snikket::persistence::Dummy_obj::storeChats,
+ ( void (::hx::Object::*)(::String, ::Dynamic))&::snikket::persistence::Dummy_obj::getChats,
+ ( void (::hx::Object::*)(::String,::Array< ::Dynamic>, ::Dynamic))&::snikket::persistence::Dummy_obj::getChatsUnreadDetails,
+ ( void (::hx::Object::*)(::String, ::snikket::ReactionUpdate, ::Dynamic))&::snikket::persistence::Dummy_obj::storeReaction,
+ ( void (::hx::Object::*)(::String,::Array< ::Dynamic>, ::Dynamic))&::snikket::persistence::Dummy_obj::storeMessages,
+ ( void (::hx::Object::*)(::String, ::snikket::ChatMessage))&::snikket::persistence::Dummy_obj::updateMessage,
+ ( void (::hx::Object::*)(::String,::String,int, ::Dynamic))&::snikket::persistence::Dummy_obj::updateMessageStatus,
+ ( void (::hx::Object::*)(::String,::String,::String,::String, ::Dynamic))&::snikket::persistence::Dummy_obj::getMessage,
+ ( void (::hx::Object::*)(::String,::String,::String,::String, ::Dynamic))&::snikket::persistence::Dummy_obj::getMessagesBefore,
+ ( void (::hx::Object::*)(::String,::String,::String,::String, ::Dynamic))&::snikket::persistence::Dummy_obj::getMessagesAfter,
+ ( void (::hx::Object::*)(::String,::String,::String,::String, ::Dynamic))&::snikket::persistence::Dummy_obj::getMessagesAround,
+ ( void (::hx::Object::*)(::String,::Array< unsigned char >, ::Dynamic))&::snikket::persistence::Dummy_obj::hasMedia,
+ ( void (::hx::Object::*)(::String,::Array< unsigned char >, ::Dynamic))&::snikket::persistence::Dummy_obj::storeMedia,
+ ( void (::hx::Object::*)(::String,::Array< unsigned char >))&::snikket::persistence::Dummy_obj::removeMedia,
+ ( void (::hx::Object::*)( ::snikket::Caps))&::snikket::persistence::Dummy_obj::storeCaps,
+ ( void (::hx::Object::*)(::String, ::Dynamic))&::snikket::persistence::Dummy_obj::getCaps,
+ ( void (::hx::Object::*)(::String,::String,::String,::String))&::snikket::persistence::Dummy_obj::storeLogin,
+ ( void (::hx::Object::*)(::String, ::Dynamic))&::snikket::persistence::Dummy_obj::getLogin,
+ ( void (::hx::Object::*)(::String,bool))&::snikket::persistence::Dummy_obj::removeAccount,
+ ( void (::hx::Object::*)( ::Dynamic))&::snikket::persistence::Dummy_obj::listAccounts,
+ ( void (::hx::Object::*)(::String,::Array< unsigned char >))&::snikket::persistence::Dummy_obj::storeStreamManagement,
+ ( void (::hx::Object::*)(::String, ::Dynamic))&::snikket::persistence::Dummy_obj::getStreamManagement,
+ ( void (::hx::Object::*)(::String,::String,::String,::String, ::snikket::Caps))&::snikket::persistence::Dummy_obj::storeService,
+ ( void (::hx::Object::*)(::String,::String, ::Dynamic))&::snikket::persistence::Dummy_obj::findServicesWithFeature,
+};
+
+void *Dummy_obj::_hx_getInterface(int inHash) {
+ switch(inHash) {
+ case (int)0x3e9d59e2: return &_hx_snikket_persistence_Dummy__hx_snikket_Persistence;
+ }
+ #ifdef HXCPP_SCRIPTABLE
+ return super::_hx_getInterface(inHash);
+ #else
+ return 0;
+ #endif
+}
+
+void Dummy_obj::lastId(::String accountId,::String chatId, ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_929f3522faf0dc9d_28_lastId)
+HXDLIN( 28) callback(null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Dummy_obj,lastId,(void))
+
+void Dummy_obj::storeChats(::String accountId,::Array< ::Dynamic> chat){
+ HX_STACKFRAME(&_hx_pos_929f3522faf0dc9d_32_storeChats)
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Dummy_obj,storeChats,(void))
+
+void Dummy_obj::getChats(::String accountId, ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_929f3522faf0dc9d_36_getChats)
+HXDLIN( 36) callback(::Array_obj< ::Dynamic>::__new(0));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Dummy_obj,getChats,(void))
+
+void Dummy_obj::storeMessages(::String accountId,::Array< ::Dynamic> messages, ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_929f3522faf0dc9d_41_storeMessages)
+HXDLIN( 41) callback(messages);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Dummy_obj,storeMessages,(void))
+
+void Dummy_obj::updateMessage(::String accountId, ::snikket::ChatMessage message){
+ HX_STACKFRAME(&_hx_pos_929f3522faf0dc9d_45_updateMessage)
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Dummy_obj,updateMessage,(void))
+
+void Dummy_obj::getMessage(::String accountId,::String chatId,::String serverId,::String localId, ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_929f3522faf0dc9d_50_getMessage)
+HXDLIN( 50) callback(null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC5(Dummy_obj,getMessage,(void))
+
+void Dummy_obj::getMessagesBefore(::String accountId,::String chatId,::String beforeId,::String beforeTime, ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_929f3522faf0dc9d_55_getMessagesBefore)
+HXDLIN( 55) callback(::Array_obj< ::Dynamic>::__new(0));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC5(Dummy_obj,getMessagesBefore,(void))
+
+void Dummy_obj::getMessagesAfter(::String accountId,::String chatId,::String afterId,::String afterTime, ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_929f3522faf0dc9d_60_getMessagesAfter)
+HXDLIN( 60) callback(::Array_obj< ::Dynamic>::__new(0));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC5(Dummy_obj,getMessagesAfter,(void))
+
+void Dummy_obj::getMessagesAround(::String accountId,::String chatId,::String aroundId,::String aroundTime, ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_929f3522faf0dc9d_65_getMessagesAround)
+HXDLIN( 65) callback(::Array_obj< ::Dynamic>::__new(0));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC5(Dummy_obj,getMessagesAround,(void))
+
+void Dummy_obj::getChatsUnreadDetails(::String accountId,::Array< ::Dynamic> chats, ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_929f3522faf0dc9d_70_getChatsUnreadDetails)
+HXDLIN( 70) callback(::Array_obj< ::Dynamic>::__new(0));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Dummy_obj,getChatsUnreadDetails,(void))
+
+void Dummy_obj::storeReaction(::String accountId, ::snikket::ReactionUpdate update, ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_929f3522faf0dc9d_75_storeReaction)
+HXDLIN( 75) callback(null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Dummy_obj,storeReaction,(void))
+
+void Dummy_obj::updateMessageStatus(::String accountId,::String localId,int status, ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_929f3522faf0dc9d_80_updateMessageStatus)
+HXDLIN( 80) callback(null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC4(Dummy_obj,updateMessageStatus,(void))
+
+void Dummy_obj::getMediaUri(::String hashAlgorithm,::Array< unsigned char > hash, ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_929f3522faf0dc9d_85_getMediaUri)
+HXDLIN( 85) callback(null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Dummy_obj,getMediaUri,(void))
+
+void Dummy_obj::hasMedia(::String hashAlgorithm,::Array< unsigned char > hash, ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_929f3522faf0dc9d_90_hasMedia)
+HXDLIN( 90) callback(false);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Dummy_obj,hasMedia,(void))
+
+void Dummy_obj::storeMedia(::String mime,::Array< unsigned char > bd, ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_929f3522faf0dc9d_95_storeMedia)
+HXDLIN( 95) callback();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Dummy_obj,storeMedia,(void))
+
+void Dummy_obj::removeMedia(::String hashAlgorithm,::Array< unsigned char > hash){
+ HX_STACKFRAME(&_hx_pos_929f3522faf0dc9d_99_removeMedia)
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Dummy_obj,removeMedia,(void))
+
+void Dummy_obj::storeCaps( ::snikket::Caps caps){
+ HX_STACKFRAME(&_hx_pos_929f3522faf0dc9d_103_storeCaps)
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Dummy_obj,storeCaps,(void))
+
+void Dummy_obj::getCaps(::String ver, ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_929f3522faf0dc9d_107_getCaps)
+HXDLIN( 107) callback(null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Dummy_obj,getCaps,(void))
+
+void Dummy_obj::storeLogin(::String login,::String clientId,::String displayName,::String token){
+ HX_STACKFRAME(&_hx_pos_929f3522faf0dc9d_111_storeLogin)
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC4(Dummy_obj,storeLogin,(void))
+
+void Dummy_obj::getLogin(::String login, ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_929f3522faf0dc9d_115_getLogin)
+HXDLIN( 115) callback(null(),null(),0,null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Dummy_obj,getLogin,(void))
+
+void Dummy_obj::removeAccount(::String accountId,bool completely){
+ HX_STACKFRAME(&_hx_pos_929f3522faf0dc9d_119_removeAccount)
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Dummy_obj,removeAccount,(void))
+
+void Dummy_obj::listAccounts( ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_929f3522faf0dc9d_123_listAccounts)
+HXDLIN( 123) callback(::Array_obj< ::String >::__new(0));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Dummy_obj,listAccounts,(void))
+
+void Dummy_obj::storeStreamManagement(::String accountId,::Array< unsigned char > sm){
+ HX_STACKFRAME(&_hx_pos_929f3522faf0dc9d_127_storeStreamManagement)
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Dummy_obj,storeStreamManagement,(void))
+
+void Dummy_obj::getStreamManagement(::String accountId, ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_929f3522faf0dc9d_131_getStreamManagement)
+HXDLIN( 131) callback(null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Dummy_obj,getStreamManagement,(void))
+
+void Dummy_obj::storeService(::String accountId,::String serviceId,::String name,::String node, ::snikket::Caps caps){
+ HX_STACKFRAME(&_hx_pos_929f3522faf0dc9d_135_storeService)
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC5(Dummy_obj,storeService,(void))
+
+void Dummy_obj::findServicesWithFeature(::String accountId,::String feature, ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_929f3522faf0dc9d_139_findServicesWithFeature)
+HXDLIN( 139) callback(::Array_obj< ::Dynamic>::__new(0));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Dummy_obj,findServicesWithFeature,(void))
+
+
+::hx::ObjectPtr< Dummy_obj > Dummy_obj::__new() {
+ ::hx::ObjectPtr< Dummy_obj > __this = new Dummy_obj();
+ __this->__construct();
+ return __this;
+}
+
+::hx::ObjectPtr< Dummy_obj > Dummy_obj::__alloc(::hx::Ctx *_hx_ctx) {
+ Dummy_obj *__this = (Dummy_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Dummy_obj), false, "snikket.persistence.Dummy"));
+ *(void **)__this = Dummy_obj::_hx_vtable;
+ __this->__construct();
+ return __this;
+}
+
+Dummy_obj::Dummy_obj()
+{
+}
+
+::hx::Val Dummy_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 6:
+ if (HX_FIELD_EQ(inName,"lastId") ) { return ::hx::Val( lastId_dyn() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"getCaps") ) { return ::hx::Val( getCaps_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"getChats") ) { return ::hx::Val( getChats_dyn() ); }
+ if (HX_FIELD_EQ(inName,"hasMedia") ) { return ::hx::Val( hasMedia_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getLogin") ) { return ::hx::Val( getLogin_dyn() ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"storeCaps") ) { return ::hx::Val( storeCaps_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"storeChats") ) { return ::hx::Val( storeChats_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getMessage") ) { return ::hx::Val( getMessage_dyn() ); }
+ if (HX_FIELD_EQ(inName,"storeMedia") ) { return ::hx::Val( storeMedia_dyn() ); }
+ if (HX_FIELD_EQ(inName,"storeLogin") ) { return ::hx::Val( storeLogin_dyn() ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"getMediaUri") ) { return ::hx::Val( getMediaUri_dyn() ); }
+ if (HX_FIELD_EQ(inName,"removeMedia") ) { return ::hx::Val( removeMedia_dyn() ); }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"listAccounts") ) { return ::hx::Val( listAccounts_dyn() ); }
+ if (HX_FIELD_EQ(inName,"storeService") ) { return ::hx::Val( storeService_dyn() ); }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"storeMessages") ) { return ::hx::Val( storeMessages_dyn() ); }
+ if (HX_FIELD_EQ(inName,"updateMessage") ) { return ::hx::Val( updateMessage_dyn() ); }
+ if (HX_FIELD_EQ(inName,"storeReaction") ) { return ::hx::Val( storeReaction_dyn() ); }
+ if (HX_FIELD_EQ(inName,"removeAccount") ) { return ::hx::Val( removeAccount_dyn() ); }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"getMessagesAfter") ) { return ::hx::Val( getMessagesAfter_dyn() ); }
+ break;
+ case 17:
+ if (HX_FIELD_EQ(inName,"getMessagesBefore") ) { return ::hx::Val( getMessagesBefore_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getMessagesAround") ) { return ::hx::Val( getMessagesAround_dyn() ); }
+ break;
+ case 19:
+ if (HX_FIELD_EQ(inName,"updateMessageStatus") ) { return ::hx::Val( updateMessageStatus_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getStreamManagement") ) { return ::hx::Val( getStreamManagement_dyn() ); }
+ break;
+ case 21:
+ if (HX_FIELD_EQ(inName,"getChatsUnreadDetails") ) { return ::hx::Val( getChatsUnreadDetails_dyn() ); }
+ if (HX_FIELD_EQ(inName,"storeStreamManagement") ) { return ::hx::Val( storeStreamManagement_dyn() ); }
+ break;
+ case 23:
+ if (HX_FIELD_EQ(inName,"findServicesWithFeature") ) { return ::hx::Val( findServicesWithFeature_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo *Dummy_obj_sMemberStorageInfo = 0;
+static ::hx::StaticInfo *Dummy_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Dummy_obj_sMemberFields[] = {
+ HX_("lastId",d1,0b,c5,54),
+ HX_("storeChats",fa,4a,32,83),
+ HX_("getChats",25,ae,8a,a5),
+ HX_("storeMessages",cd,f1,bd,e9),
+ HX_("updateMessage",be,9a,7f,65),
+ HX_("getMessage",d1,bb,72,e9),
+ HX_("getMessagesBefore",a1,f1,44,11),
+ HX_("getMessagesAfter",3a,43,91,57),
+ HX_("getMessagesAround",6f,95,16,2d),
+ HX_("getChatsUnreadDetails",ee,d4,5a,85),
+ HX_("storeReaction",aa,00,75,ab),
+ HX_("updateMessageStatus",90,98,ad,0f),
+ HX_("getMediaUri",9e,c7,87,99),
+ HX_("hasMedia",2a,4f,14,92),
+ HX_("storeMedia",43,b1,3a,43),
+ HX_("removeMedia",00,e2,ef,03),
+ HX_("storeCaps",a2,60,d7,9d),
+ HX_("getCaps",d7,cb,3c,14),
+ HX_("storeLogin",c8,85,72,b6),
+ HX_("getLogin",f3,e8,ca,d8),
+ HX_("removeAccount",c9,58,14,7a),
+ HX_("listAccounts",a4,81,e8,f5),
+ HX_("storeStreamManagement",24,1d,b8,8d),
+ HX_("getStreamManagement",d9,03,ec,6c),
+ HX_("storeService",54,de,f6,9d),
+ HX_("findServicesWithFeature",99,4e,bd,4a),
+ ::String(null()) };
+
+::hx::Class Dummy_obj::__mClass;
+
+void Dummy_obj::__register()
+{
+ Dummy_obj _hx_dummy;
+ Dummy_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.persistence.Dummy",88,9f,69,09);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Dummy_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Dummy_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Dummy_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Dummy_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void Dummy_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_929f3522faf0dc9d_18_boot)
+HXDLIN( 18) __mClass->__meta__ = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("fields",79,8e,8e,80), ::Dynamic(::hx::Anon_obj::Create(26)
+ ->setFixed(0,HX_("storeChats",fa,4a,32,83), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(1,HX_("getChatsUnreadDetails",ee,d4,5a,85), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(2,HX_("storeStreamManagement",24,1d,b8,8d), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(3,HX_("hasMedia",2a,4f,14,92), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(4,HX_("getMediaUri",9e,c7,87,99), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(5,HX_("storeCaps",a2,60,d7,9d), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(6,HX_("storeService",54,de,f6,9d), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(7,HX_("getChats",25,ae,8a,a5), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(8,HX_("storeReaction",aa,00,75,ab), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(9,HX_("storeLogin",c8,85,72,b6), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(10,HX_("getLogin",f3,e8,ca,d8), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(11,HX_("getMessage",d1,bb,72,e9), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(12,HX_("storeMessages",cd,f1,bd,e9), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(13,HX_("listAccounts",a4,81,e8,f5), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(14,HX_("removeMedia",00,e2,ef,03), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(15,HX_("updateMessageStatus",90,98,ad,0f), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(16,HX_("getMessagesBefore",a1,f1,44,11), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(17,HX_("getCaps",d7,cb,3c,14), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(18,HX_("getMessagesAround",6f,95,16,2d), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(19,HX_("storeMedia",43,b1,3a,43), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(20,HX_("findServicesWithFeature",99,4e,bd,4a), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(21,HX_("lastId",d1,0b,c5,54), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(22,HX_("getMessagesAfter",3a,43,91,57), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(23,HX_("updateMessage",be,9a,7f,65), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(24,HX_("getStreamManagement",d9,03,ec,6c), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(25,HX_("removeAccount",c9,58,14,7a), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null()))))));
+ }
+}
+
+} // end namespace snikket
+} // end namespace persistence
diff --git a/Sources/c_snikket/src/snikket/persistence/KeyValueStore.cpp b/Sources/c_snikket/src/snikket/persistence/KeyValueStore.cpp
new file mode 100644
index 0000000..49663cc
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/persistence/KeyValueStore.cpp
@@ -0,0 +1,30 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_persistence_KeyValueStore
+#include <snikket/persistence/KeyValueStore.h>
+#endif
+
+namespace snikket{
+namespace persistence{
+
+
+static ::String KeyValueStore_obj_sMemberFields[] = {
+ HX_("get",96,80,4e,00),
+ HX_("set",a2,9b,57,00),
+ ::String(null()) };
+
+::hx::Class KeyValueStore_obj::__mClass;
+
+void KeyValueStore_obj::__register()
+{
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.persistence.KeyValueStore",8f,c6,2d,80);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(KeyValueStore_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TIsInterface< (int)0x42160a8d >;
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace persistence
diff --git a/Sources/c_snikket/src/snikket/persistence/MediaStore.cpp b/Sources/c_snikket/src/snikket/persistence/MediaStore.cpp
new file mode 100644
index 0000000..5c455b6
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/persistence/MediaStore.cpp
@@ -0,0 +1,35 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_persistence_KeyValueStore
+#include <snikket/persistence/KeyValueStore.h>
+#endif
+#ifndef INCLUDED_snikket_persistence_MediaStore
+#include <snikket/persistence/MediaStore.h>
+#endif
+
+namespace snikket{
+namespace persistence{
+
+
+static ::String MediaStore_obj_sMemberFields[] = {
+ HX_("hasMedia",2a,4f,14,92),
+ HX_("removeMedia",00,e2,ef,03),
+ HX_("storeMedia",43,b1,3a,43),
+ HX_("setKV",cd,89,2f,7a),
+ ::String(null()) };
+
+::hx::Class MediaStore_obj::__mClass;
+
+void MediaStore_obj::__register()
+{
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.persistence.MediaStore",fd,b6,fd,c1);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(MediaStore_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TIsInterface< (int)0x2952283f >;
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace persistence
diff --git a/Sources/c_snikket/src/snikket/persistence/MediaStoreFS.cpp b/Sources/c_snikket/src/snikket/persistence/MediaStoreFS.cpp
new file mode 100644
index 0000000..067178a
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/persistence/MediaStoreFS.cpp
@@ -0,0 +1,429 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED__HaxeCBridge_Internal
+#include <_HaxeCBridge/Internal.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_IntMap
+#include <haxe/ds/IntMap.h>
+#endif
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+#ifndef INCLUDED_snikket_Hash
+#include <snikket/Hash.h>
+#endif
+#ifndef INCLUDED_snikket_persistence_KeyValueStore
+#include <snikket/persistence/KeyValueStore.h>
+#endif
+#ifndef INCLUDED_snikket_persistence_MediaStore
+#include <snikket/persistence/MediaStore.h>
+#endif
+#ifndef INCLUDED_snikket_persistence_MediaStoreFS
+#include <snikket/persistence/MediaStoreFS.h>
+#endif
+#ifndef INCLUDED_sys_FileSystem
+#include <sys/FileSystem.h>
+#endif
+#ifndef INCLUDED_sys_io_File
+#include <sys/io/File.h>
+#endif
+#ifndef INCLUDED_thenshim_PromiseTools
+#include <thenshim/PromiseTools.h>
+#endif
+#ifndef INCLUDED_thenshim_Thenable
+#include <thenshim/Thenable.h>
+#endif
+#ifndef INCLUDED_thenshim__Promise_Promise_Impl_
+#include <thenshim/_Promise/Promise_Impl_.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_563dc7a3a6261986_16_new,"snikket.persistence.MediaStoreFS","new",0x1ed99b7c,"snikket.persistence.MediaStoreFS.new","snikket/persistence/MediaStoreFS.hx",16,0x66ae6c32)
+HX_LOCAL_STACK_FRAME(_hx_pos_563dc7a3a6261986_26_setKV,"snikket.persistence.MediaStoreFS","setKV",0x9e1353e9,"snikket.persistence.MediaStoreFS.setKV","snikket/persistence/MediaStoreFS.hx",26,0x66ae6c32)
+HX_LOCAL_STACK_FRAME(_hx_pos_563dc7a3a6261986_29_getMediaPath,"snikket.persistence.MediaStoreFS","getMediaPath",0x37f9e697,"snikket.persistence.MediaStoreFS.getMediaPath","snikket/persistence/MediaStoreFS.hx",29,0x66ae6c32)
+HX_LOCAL_STACK_FRAME(_hx_pos_563dc7a3a6261986_39_getMediaPath,"snikket.persistence.MediaStoreFS","getMediaPath",0x37f9e697,"snikket.persistence.MediaStoreFS.getMediaPath","snikket/persistence/MediaStoreFS.hx",39,0x66ae6c32)
+HX_LOCAL_STACK_FRAME(_hx_pos_01cf80b813798682_221_getMediaPath__fromC,"snikket.persistence.MediaStoreFS","getMediaPath__fromC",0x295c9ac2,"snikket.persistence.MediaStoreFS.getMediaPath__fromC","HaxeCBridge.hx",221,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_01cf80b813798682_244_getMediaPath__fromC,"snikket.persistence.MediaStoreFS","getMediaPath__fromC",0x295c9ac2,"snikket.persistence.MediaStoreFS.getMediaPath__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_563dc7a3a6261986_53_hasMedia,"snikket.persistence.MediaStoreFS","hasMedia",0x55acbe8e,"snikket.persistence.MediaStoreFS.hasMedia","snikket/persistence/MediaStoreFS.hx",53,0x66ae6c32)
+HX_LOCAL_STACK_FRAME(_hx_pos_563dc7a3a6261986_51_hasMedia,"snikket.persistence.MediaStoreFS","hasMedia",0x55acbe8e,"snikket.persistence.MediaStoreFS.hasMedia","snikket/persistence/MediaStoreFS.hx",51,0x66ae6c32)
+HX_LOCAL_STACK_FRAME(_hx_pos_563dc7a3a6261986_60_removeMedia,"snikket.persistence.MediaStoreFS","removeMedia",0x3020291c,"snikket.persistence.MediaStoreFS.removeMedia","snikket/persistence/MediaStoreFS.hx",60,0x66ae6c32)
+HX_LOCAL_STACK_FRAME(_hx_pos_563dc7a3a6261986_57_removeMedia,"snikket.persistence.MediaStoreFS","removeMedia",0x3020291c,"snikket.persistence.MediaStoreFS.removeMedia","snikket/persistence/MediaStoreFS.hx",57,0x66ae6c32)
+HX_LOCAL_STACK_FRAME(_hx_pos_563dc7a3a6261986_73_storeMedia,"snikket.persistence.MediaStoreFS","storeMedia",0x7158c1a7,"snikket.persistence.MediaStoreFS.storeMedia","snikket/persistence/MediaStoreFS.hx",73,0x66ae6c32)
+HX_LOCAL_STACK_FRAME(_hx_pos_563dc7a3a6261986_65_storeMedia,"snikket.persistence.MediaStoreFS","storeMedia",0x7158c1a7,"snikket.persistence.MediaStoreFS.storeMedia","snikket/persistence/MediaStoreFS.hx",65,0x66ae6c32)
+HX_LOCAL_STACK_FRAME(_hx_pos_563dc7a3a6261986_80_set,"snikket.persistence.MediaStoreFS","set",0x1edd66be,"snikket.persistence.MediaStoreFS.set","snikket/persistence/MediaStoreFS.hx",80,0x66ae6c32)
+HX_LOCAL_STACK_FRAME(_hx_pos_563dc7a3a6261986_76_set,"snikket.persistence.MediaStoreFS","set",0x1edd66be,"snikket.persistence.MediaStoreFS.set","snikket/persistence/MediaStoreFS.hx",76,0x66ae6c32)
+HX_LOCAL_STACK_FRAME(_hx_pos_563dc7a3a6261986_88_get,"snikket.persistence.MediaStoreFS","get",0x1ed44bb2,"snikket.persistence.MediaStoreFS.get","snikket/persistence/MediaStoreFS.hx",88,0x66ae6c32)
+HX_LOCAL_STACK_FRAME(_hx_pos_563dc7a3a6261986_84_get,"snikket.persistence.MediaStoreFS","get",0x1ed44bb2,"snikket.persistence.MediaStoreFS.get","snikket/persistence/MediaStoreFS.hx",84,0x66ae6c32)
+HX_LOCAL_STACK_FRAME(_hx_pos_563dc7a3a6261986_16_boot,"snikket.persistence.MediaStoreFS","boot",0xd7a77196,"snikket.persistence.MediaStoreFS.boot","snikket/persistence/MediaStoreFS.hx",16,0x66ae6c32)
+namespace snikket{
+namespace persistence{
+
+void MediaStoreFS_obj::__construct(::String path){
+ HX_STACKFRAME(&_hx_pos_563dc7a3a6261986_16_new)
+HXLINE( 18) this->kv = null();
+HXLINE( 21) this->blobpath = path;
+ }
+
+Dynamic MediaStoreFS_obj::__CreateEmpty() { return new MediaStoreFS_obj; }
+
+void *MediaStoreFS_obj::_hx_vtable = 0;
+
+Dynamic MediaStoreFS_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< MediaStoreFS_obj > _hx_result = new MediaStoreFS_obj();
+ _hx_result->__construct(inArgs[0]);
+ return _hx_result;
+}
+
+bool MediaStoreFS_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x3993cd38;
+}
+
+static ::snikket::persistence::MediaStore_obj _hx_snikket_persistence_MediaStoreFS__hx_snikket_persistence_MediaStore= {
+ ( void (::hx::Object::*)(::String,::Array< unsigned char >, ::Dynamic))&::snikket::persistence::MediaStoreFS_obj::hasMedia,
+ ( void (::hx::Object::*)(::String,::Array< unsigned char >))&::snikket::persistence::MediaStoreFS_obj::removeMedia,
+ ( void (::hx::Object::*)(::String,::Array< unsigned char >, ::Dynamic))&::snikket::persistence::MediaStoreFS_obj::storeMedia,
+ ( void (::hx::Object::*)(::Dynamic))&::snikket::persistence::MediaStoreFS_obj::setKV,
+};
+
+void *MediaStoreFS_obj::_hx_getInterface(int inHash) {
+ switch(inHash) {
+ case (int)0x2952283f: return &_hx_snikket_persistence_MediaStoreFS__hx_snikket_persistence_MediaStore;
+ }
+ #ifdef HXCPP_SCRIPTABLE
+ return super::_hx_getInterface(inHash);
+ #else
+ return 0;
+ #endif
+}
+
+void MediaStoreFS_obj::setKV(::Dynamic kv){
+ HX_STACKFRAME(&_hx_pos_563dc7a3a6261986_26_setKV)
+HXDLIN( 26) this->kv = kv;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(MediaStoreFS_obj,setKV,(void))
+
+void MediaStoreFS_obj::getMediaPath(::String uri, ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_563dc7a3a6261986_29_getMediaPath)
+HXDLIN( 29) ::snikket::persistence::MediaStoreFS _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 30) ::snikket::Hash hash = ::snikket::Hash_obj::fromUri(uri);
+HXLINE( 31) if ((hash->algorithm == HX_("sha-256",32,dd,04,3b))) {
+HXLINE( 32) ::String path = (this->blobpath + HX_("/f",57,29,00,00));
+HXDLIN( 32) ::String path1 = (path + hash->toHex());
+HXLINE( 33) if (::sys::FileSystem_obj::exists(path1)) {
+HXLINE( 34) ::Dynamic callback1 = callback;
+HXDLIN( 34) callback1(::sys::FileSystem_obj::absolutePath(path1));
+ }
+ else {
+HXLINE( 36) callback(null());
+ }
+ }
+ else {
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0, ::snikket::persistence::MediaStoreFS,_gthis, ::Dynamic,callback) HXARGC(1)
+ void _hx_run(::String sha256uri){
+ HX_STACKFRAME(&_hx_pos_563dc7a3a6261986_39_getMediaPath)
+HXLINE( 40) ::snikket::Hash sha256;
+HXDLIN( 40) if (::hx::IsNull( sha256uri )) {
+HXLINE( 40) sha256 = null();
+ }
+ else {
+HXLINE( 40) sha256 = ::snikket::Hash_obj::fromUri(sha256uri);
+ }
+HXLINE( 41) if (::hx::IsNull( sha256 )) {
+HXLINE( 42) callback(null());
+ }
+ else {
+HXLINE( 44) ::snikket::persistence::MediaStoreFS _gthis1 = _gthis;
+HXDLIN( 44) ::String _hx_tmp = sha256->toUri();
+HXDLIN( 44) _gthis1->getMediaPath(_hx_tmp,callback);
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE( 39) ::thenshim::_Promise::Promise_Impl__obj::then(this->get(hash->serializeUri()), ::Dynamic(new _hx_Closure_0(_gthis,callback)),null());
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(MediaStoreFS_obj,getMediaPath,(void))
+
+void MediaStoreFS_obj::getMediaPath__fromC(::String uri,::cpp::Function< void (const char*,void*) > callback,void* callback__context){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0,void*,callback__context,::cpp::Function< void (const char* HX_COMMA void*) >,callback) HXARGC(1)
+ void _hx_run(::String a0){
+ HX_GC_STACKFRAME(&_hx_pos_01cf80b813798682_221_getMediaPath__fromC)
+HXLINE( 221) ::cpp::Function< void (const char*,void*) > callback1 = callback;
+HXLINE( 213) const char* cStrPtr = a0.utf8_str();
+HXDLIN( 213) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(cStrPtr);
+HXDLIN( 213) {
+HXLINE( 213) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 213) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 213) int high = ptrInt64 >> 32;
+HXDLIN( 213) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 213) if (::hx::IsNull( highMap )) {
+HXLINE( 213) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 213) this1->set(low,highMap);
+ }
+HXDLIN( 213) highMap->set(high,a0);
+ }
+HXLINE( 221) callback1(cStrPtr,callback__context);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_01cf80b813798682_244_getMediaPath__fromC)
+HXDLIN( 244) this->getMediaPath(uri, ::Dynamic(new _hx_Closure_0(callback__context,callback)));
+ }
+
+
+void MediaStoreFS_obj::hasMedia(::String hashAlgorithm,::Array< unsigned char > hash, ::Dynamic callback){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::Dynamic,callback) HXARGC(1)
+ void _hx_run(::String path){
+ HX_GC_STACKFRAME(&_hx_pos_563dc7a3a6261986_53_hasMedia)
+HXLINE( 53) callback(::hx::IsNotNull( path ));
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_563dc7a3a6261986_51_hasMedia)
+HXLINE( 52) ::snikket::Hash hash1 = ::snikket::Hash_obj::__alloc( HX_CTX ,hashAlgorithm,hash);
+HXLINE( 53) this->getMediaPath(hash1->toUri(), ::Dynamic(new _hx_Closure_0(callback)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(MediaStoreFS_obj,hasMedia,(void))
+
+void MediaStoreFS_obj::removeMedia(::String hashAlgorithm,::Array< unsigned char > hash){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ void _hx_run(::String path){
+ HX_GC_STACKFRAME(&_hx_pos_563dc7a3a6261986_60_removeMedia)
+HXLINE( 60) if (::hx::IsNotNull( path )) {
+HXLINE( 60) ::sys::FileSystem_obj::deleteFile(path);
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_563dc7a3a6261986_57_removeMedia)
+HXLINE( 58) ::snikket::Hash hash1 = ::snikket::Hash_obj::__alloc( HX_CTX ,hashAlgorithm,hash);
+HXLINE( 59) this->getMediaPath(hash1->toUri(), ::Dynamic(new _hx_Closure_0()));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(MediaStoreFS_obj,removeMedia,(void))
+
+void MediaStoreFS_obj::storeMedia(::String mime,::Array< unsigned char > bd, ::Dynamic callback){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::Dynamic,callback) HXARGC(1)
+ void _hx_run(::cpp::VirtualArray _){
+ HX_STACKFRAME(&_hx_pos_563dc7a3a6261986_73_storeMedia)
+HXLINE( 73) callback();
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_563dc7a3a6261986_65_storeMedia)
+HXLINE( 66) ::haxe::io::Bytes bytes = ::haxe::io::Bytes_obj::ofData(bd);
+HXLINE( 67) ::snikket::Hash sha1 = ::snikket::Hash_obj::sha1(bytes);
+HXLINE( 68) ::snikket::Hash sha256 = ::snikket::Hash_obj::sha256(bytes);
+HXLINE( 69) ::String _hx_tmp = (this->blobpath + HX_("/f",57,29,00,00));
+HXDLIN( 69) ::sys::io::File_obj::saveBytes((_hx_tmp + sha256->toHex()),bytes);
+HXLINE( 71) ::String _hx_tmp1 = sha1->serializeUri();
+HXDLIN( 71) ::Dynamic _hx_tmp2 = this->set(_hx_tmp1,sha256->serializeUri());
+HXLINE( 70) ::thenshim::_Promise::Promise_Impl__obj::then(::thenshim::PromiseTools_obj::all(::Array_obj< ::Dynamic>::__new(2)->init(0,_hx_tmp2)->init(1,this->set((sha256->serializeUri() + HX_("#contentType",50,39,a7,27)),mime))), ::Dynamic(new _hx_Closure_0(callback)),null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(MediaStoreFS_obj,storeMedia,(void))
+
+::Dynamic MediaStoreFS_obj::set(::String k,::String v){
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_1, ::snikket::persistence::MediaStoreFS,_gthis,::String,k,::String,v) HXARGC(2)
+ void _hx_run( ::Dynamic resolve, ::Dynamic reject){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::Dynamic,resolve) HXARGC(0)
+ void _hx_run(){
+ HX_STACKFRAME(&_hx_pos_563dc7a3a6261986_80_set)
+HXLINE( 80) resolve(null());
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_STACKFRAME(&_hx_pos_563dc7a3a6261986_80_set)
+HXLINE( 80) ::snikket::persistence::KeyValueStore_obj::set(_gthis->kv,k,v, ::Dynamic(new _hx_Closure_0(resolve)));
+ }
+ HX_END_LOCAL_FUNC2((void))
+
+ HX_STACKFRAME(&_hx_pos_563dc7a3a6261986_76_set)
+HXDLIN( 76) ::snikket::persistence::MediaStoreFS _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 77) if (::hx::IsNull( this->kv )) {
+HXLINE( 77) return ::thenshim::_Promise::Promise_Impl__obj::resolve(null());
+ }
+HXLINE( 79) return ::thenshim::_Promise::Promise_Impl__obj::_new( ::Dynamic(new _hx_Closure_1(_gthis,k,v)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(MediaStoreFS_obj,set,return )
+
+::Dynamic MediaStoreFS_obj::get(::String k){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0, ::snikket::persistence::MediaStoreFS,_gthis,::String,k) HXARGC(2)
+ void _hx_run( ::Dynamic resolve, ::Dynamic reject){
+ HX_STACKFRAME(&_hx_pos_563dc7a3a6261986_88_get)
+HXLINE( 88) ::snikket::persistence::KeyValueStore_obj::get(_gthis->kv,k,resolve);
+ }
+ HX_END_LOCAL_FUNC2((void))
+
+ HX_STACKFRAME(&_hx_pos_563dc7a3a6261986_84_get)
+HXDLIN( 84) ::snikket::persistence::MediaStoreFS _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 85) if (::hx::IsNull( this->kv )) {
+HXLINE( 85) return ::thenshim::_Promise::Promise_Impl__obj::resolve(null());
+ }
+HXLINE( 87) return ::thenshim::_Promise::Promise_Impl__obj::_new( ::Dynamic(new _hx_Closure_0(_gthis,k)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(MediaStoreFS_obj,get,return )
+
+
+::hx::ObjectPtr< MediaStoreFS_obj > MediaStoreFS_obj::__new(::String path) {
+ ::hx::ObjectPtr< MediaStoreFS_obj > __this = new MediaStoreFS_obj();
+ __this->__construct(path);
+ return __this;
+}
+
+::hx::ObjectPtr< MediaStoreFS_obj > MediaStoreFS_obj::__alloc(::hx::Ctx *_hx_ctx,::String path) {
+ MediaStoreFS_obj *__this = (MediaStoreFS_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(MediaStoreFS_obj), true, "snikket.persistence.MediaStoreFS"));
+ *(void **)__this = MediaStoreFS_obj::_hx_vtable;
+ __this->__construct(path);
+ return __this;
+}
+
+MediaStoreFS_obj::MediaStoreFS_obj()
+{
+}
+
+void MediaStoreFS_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(MediaStoreFS);
+ HX_MARK_MEMBER_NAME(blobpath,"blobpath");
+ HX_MARK_MEMBER_NAME(kv,"kv");
+ HX_MARK_END_CLASS();
+}
+
+void MediaStoreFS_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(blobpath,"blobpath");
+ HX_VISIT_MEMBER_NAME(kv,"kv");
+}
+
+::hx::Val MediaStoreFS_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 2:
+ if (HX_FIELD_EQ(inName,"kv") ) { return ::hx::Val( kv ); }
+ break;
+ case 3:
+ if (HX_FIELD_EQ(inName,"set") ) { return ::hx::Val( set_dyn() ); }
+ if (HX_FIELD_EQ(inName,"get") ) { return ::hx::Val( get_dyn() ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"setKV") ) { return ::hx::Val( setKV_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"blobpath") ) { return ::hx::Val( blobpath ); }
+ if (HX_FIELD_EQ(inName,"hasMedia") ) { return ::hx::Val( hasMedia_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"storeMedia") ) { return ::hx::Val( storeMedia_dyn() ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"removeMedia") ) { return ::hx::Val( removeMedia_dyn() ); }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"getMediaPath") ) { return ::hx::Val( getMediaPath_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val MediaStoreFS_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 2:
+ if (HX_FIELD_EQ(inName,"kv") ) { kv=inValue.Cast< ::Dynamic >(); return inValue; }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"blobpath") ) { blobpath=inValue.Cast< ::String >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void MediaStoreFS_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("blobpath",82,95,91,89));
+ outFields->push(HX_("kv",ab,5d,00,00));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo MediaStoreFS_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(MediaStoreFS_obj,blobpath),HX_("blobpath",82,95,91,89)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(MediaStoreFS_obj,kv),HX_("kv",ab,5d,00,00)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *MediaStoreFS_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String MediaStoreFS_obj_sMemberFields[] = {
+ HX_("blobpath",82,95,91,89),
+ HX_("kv",ab,5d,00,00),
+ HX_("setKV",cd,89,2f,7a),
+ HX_("getMediaPath",33,f5,eb,b9),
+ HX_("hasMedia",2a,4f,14,92),
+ HX_("removeMedia",00,e2,ef,03),
+ HX_("storeMedia",43,b1,3a,43),
+ HX_("set",a2,9b,57,00),
+ HX_("get",96,80,4e,00),
+ ::String(null()) };
+
+::hx::Class MediaStoreFS_obj::__mClass;
+
+void MediaStoreFS_obj::__register()
+{
+ MediaStoreFS_obj _hx_dummy;
+ MediaStoreFS_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.persistence.MediaStoreFS",8a,6d,17,86);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(MediaStoreFS_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< MediaStoreFS_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = MediaStoreFS_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = MediaStoreFS_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void MediaStoreFS_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_563dc7a3a6261986_16_boot)
+HXDLIN( 16) __mClass->__meta__ = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("fields",79,8e,8e,80), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("hasMedia",2a,4f,14,92), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(1,HX_("getMediaPath",33,f5,eb,b9), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(2,HX_("removeMedia",00,e2,ef,03), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(3,HX_("storeMedia",43,b1,3a,43), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(4,HX_("getMediaPath__fromC",a6,d7,a5,46), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null()))))));
+ }
+}
+
+} // end namespace snikket
+} // end namespace persistence
diff --git a/Sources/c_snikket/src/snikket/persistence/Sqlite.cpp b/Sources/c_snikket/src/snikket/persistence/Sqlite.cpp
new file mode 100644
index 0000000..4591e3a
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/persistence/Sqlite.cpp
@@ -0,0 +1,3231 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Lambda
+#include <Lambda.h>
+#endif
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_StringBuf
+#include <StringBuf.h>
+#endif
+#ifndef INCLUDED_Type
+#include <Type.h>
+#endif
+#ifndef INCLUDED__HaxeCBridge_Internal
+#include <_HaxeCBridge/Internal.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_Log
+#include <haxe/Log.h>
+#endif
+#ifndef INCLUDED_haxe_Timer
+#include <haxe/Timer.h>
+#endif
+#ifndef INCLUDED_haxe_crypto_Base64
+#include <haxe/crypto/Base64.h>
+#endif
+#ifndef INCLUDED_haxe_ds_IntMap
+#include <haxe/ds/IntMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_ObjectMap
+#include <haxe/ds/ObjectMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_StringMap
+#include <haxe/ds/StringMap.h>
+#endif
+#ifndef INCLUDED_haxe_format_JsonParser
+#include <haxe/format/JsonParser.h>
+#endif
+#ifndef INCLUDED_haxe_format_JsonPrinter
+#include <haxe/format/JsonPrinter.h>
+#endif
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+#ifndef INCLUDED_haxe_iterators_ArrayIterator
+#include <haxe/iterators/ArrayIterator.h>
+#endif
+#ifndef INCLUDED_snikket_Caps
+#include <snikket/Caps.h>
+#endif
+#ifndef INCLUDED_snikket_Channel
+#include <snikket/Channel.h>
+#endif
+#ifndef INCLUDED_snikket_Chat
+#include <snikket/Chat.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessage
+#include <snikket/ChatMessage.h>
+#endif
+#ifndef INCLUDED_snikket_ChatMessageBuilder
+#include <snikket/ChatMessageBuilder.h>
+#endif
+#ifndef INCLUDED_snikket_CustomEmojiReaction
+#include <snikket/CustomEmojiReaction.h>
+#endif
+#ifndef INCLUDED_snikket_Hash
+#include <snikket/Hash.h>
+#endif
+#ifndef INCLUDED_snikket_Identity
+#include <snikket/Identity.h>
+#endif
+#ifndef INCLUDED_snikket_JID
+#include <snikket/JID.h>
+#endif
+#ifndef INCLUDED_snikket_Persistence
+#include <snikket/Persistence.h>
+#endif
+#ifndef INCLUDED_snikket_Presence
+#include <snikket/Presence.h>
+#endif
+#ifndef INCLUDED_snikket_Reaction
+#include <snikket/Reaction.h>
+#endif
+#ifndef INCLUDED_snikket_ReactionUpdate
+#include <snikket/ReactionUpdate.h>
+#endif
+#ifndef INCLUDED_snikket_SerializedChat
+#include <snikket/SerializedChat.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_persistence_KeyValueStore
+#include <snikket/persistence/KeyValueStore.h>
+#endif
+#ifndef INCLUDED_snikket_persistence_MediaStore
+#include <snikket/persistence/MediaStore.h>
+#endif
+#ifndef INCLUDED_snikket_persistence_Sqlite
+#include <snikket/persistence/Sqlite.h>
+#endif
+#ifndef INCLUDED_snikket_persistence_SqliteDriver
+#include <snikket/persistence/SqliteDriver.h>
+#endif
+#ifndef INCLUDED_sys_db_ResultSet
+#include <sys/db/ResultSet.h>
+#endif
+#ifndef INCLUDED_thenshim_PromiseTools
+#include <thenshim/PromiseTools.h>
+#endif
+#ifndef INCLUDED_thenshim_Thenable
+#include <thenshim/Thenable.h>
+#endif
+#ifndef INCLUDED_thenshim__Promise_Promise_Impl_
+#include <thenshim/_Promise/Promise_Impl_.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_5b1a6b524efab4db_39_new,"snikket.persistence.Sqlite","new",0xb859925e,"snikket.persistence.Sqlite.new","snikket/persistence/Sqlite.hx",39,0x917a2510)
+static const ::String _hx_array_data_e415cb6c_1[] = {
+ HX_("CREATE TABLE messages (\n\t\t\t\t\taccount_id TEXT NOT NULL,\n\t\t\t\t\tmam_id TEXT NOT NULL,\n\t\t\t\t\tmam_by TEXT NOT NULL,\n\t\t\t\t\tstanza_id TEXT NOT NULL,\n\t\t\t\t\tcorrection_id TEXT NOT NULL,\n\t\t\t\t\tsync_point INTEGER NOT NULL,\n\t\t\t\t\tchat_id TEXT NOT NULL,\n\t\t\t\t\tsender_id TEXT NOT NULL,\n\t\t\t\t\tcreated_at INTEGER NOT NULL,\n\t\t\t\t\tstatus INTEGER NOT NULL,\n\t\t\t\t\tdirection INTEGER NOT NULL,\n\t\t\t\t\ttype INTEGER NOT NULL,\n\t\t\t\t\tstanza TEXT NOT NULL,\n\t\t\t\t\tPRIMARY KEY (account_id, mam_id, mam_by, stanza_id)\n\t\t\t\t) STRICT;",38,62,b7,eb),HX_("CREATE INDEX messages_created_at ON messages (account_id, chat_id, created_at);",f1,c3,db,39),HX_("CREATE INDEX messages_correction_id ON messages (correction_id);",7e,cd,37,3e),HX_("CREATE TABLE chats (\n\t\t\t\t\taccount_id TEXT NOT NULL,\n\t\t\t\t\tchat_id TEXT NOT NULL,\n\t\t\t\t\ttrusted INTEGER NOT NULL,\n\t\t\t\t\tavatar_sha1 BLOB,\n\t\t\t\t\tfn TEXT,\n\t\t\t\t\tui_state INTEGER NOT NULL,\n\t\t\t\t\tblocked INTEGER NOT NULL,\n\t\t\t\t\textensions TEXT,\n\t\t\t\t\tread_up_to_id TEXT,\n\t\t\t\t\tread_up_to_by TEXT,\n\t\t\t\t\tcaps_ver BLOB,\n\t\t\t\t\tpresence BLOB NOT NULL,\n\t\t\t\t\tclass TEXT NOT NULL,\n\t\t\t\t\tPRIMARY KEY (account_id, chat_id)\n\t\t\t\t) STRICT;",a4,aa,ac,05),HX_("CREATE TABLE keyvaluepairs (\n\t\t\t\t\tk TEXT NOT NULL PRIMARY KEY,\n\t\t\t\t\tv TEXT NOT NULL\n\t\t\t\t) STRICT;",fe,ac,6c,f0),HX_("CREATE TABLE caps (\n\t\t\t\t\tsha1 BLOB NOT NULL PRIMARY KEY,\n\t\t\t\t\tcaps BLOB NOT NULL\n\t\t\t\t) STRICT;",59,53,eb,29),HX_("CREATE TABLE services (\n\t\t\t\t\taccount_id TEXT NOT NULL,\n\t\t\t\t\tservice_id TEXT NOT NULL,\n\t\t\t\t\tname TEXT,\n\t\t\t\t\tnode TEXT,\n\t\t\t\t\tcaps BLOB NOT NULL,\n\t\t\t\t\tPRIMARY KEY (account_id, service_id)\n\t\t\t\t) STRICT;",d2,78,ff,3c),HX_("CREATE TABLE accounts (\n\t\t\t\t\taccount_id TEXT NOT NULL,\n\t\t\t\t\tclient_id TEXT NOT NULL,\n\t\t\t\t\tdisplay_name TEXT,\n\t\t\t\t\ttoken TEXT,\n\t\t\t\t\tfast_count INTEGER NOT NULL DEFAULT 0,\n\t\t\t\t\tsm_state BLOB,\n\t\t\t\t\tPRIMARY KEY (account_id)\n\t\t\t\t) STRICT;",b6,62,0e,48),HX_("CREATE TABLE reactions (\n\t\t\t\t\taccount_id TEXT NOT NULL,\n\t\t\t\t\tupdate_id TEXT NOT NULL,\n\t\t\t\t\tmam_id TEXT,\n\t\t\t\t\tmam_by TEXT,\n\t\t\t\t\tstanza_id TEXT,\n\t\t\t\t\tchat_id TEXT NOT NULL,\n\t\t\t\t\tsender_id TEXT NOT NULL,\n\t\t\t\t\tcreated_at INTEGER NOT NULL,\n\t\t\t\t\treactions BLOB NOT NULL,\n\t\t\t\t\tkind INTEGER NOT NULL,\n\t\t\t\t\tPRIMARY KEY (account_id, chat_id, sender_id, update_id)\n\t\t\t\t) STRICT;",49,eb,c8,c2),HX_("PRAGMA user_version = 1;",45,c2,55,a9),
+};
+static const ::String _hx_array_data_e415cb6c_2[] = {
+ HX_("ALTER TABLE chats ADD COLUMN notifications_filtered INTEGER;",e5,d7,a4,6f),HX_("ALTER TABLE chats ADD COLUMN notify_mention INTEGER NOT NULL DEFAULT 0;",52,d4,13,7f),HX_("ALTER TABLE chats ADD COLUMN notify_reply INTEGER NOT NULL DEFAULT 0;",92,b1,9f,14),HX_("PRAGMA user_version = 2;",24,c3,55,a9),
+};
+HX_DEFINE_STACK_FRAME(_hx_pos_5b1a6b524efab4db_123_new,"snikket.persistence.Sqlite","new",0xb859925e,"snikket.persistence.Sqlite.new","snikket/persistence/Sqlite.hx",123,0x917a2510)
+HX_DEFINE_STACK_FRAME(_hx_pos_5b1a6b524efab4db_24_new,"snikket.persistence.Sqlite","new",0xb859925e,"snikket.persistence.Sqlite.new","snikket/persistence/Sqlite.hx",24,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_128_get,"snikket.persistence.Sqlite","get",0xb8544294,"snikket.persistence.Sqlite.get","snikket/persistence/Sqlite.hx",128,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_139_set,"snikket.persistence.Sqlite","set",0xb85d5da0,"snikket.persistence.Sqlite.set","snikket/persistence/Sqlite.hx",139,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_141_set,"snikket.persistence.Sqlite","set",0xb85d5da0,"snikket.persistence.Sqlite.set","snikket/persistence/Sqlite.hx",141,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_145_set,"snikket.persistence.Sqlite","set",0xb85d5da0,"snikket.persistence.Sqlite.set","snikket/persistence/Sqlite.hx",145,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_162_lastId,"snikket.persistence.Sqlite","lastId",0xe7f21c93,"snikket.persistence.Sqlite.lastId","snikket/persistence/Sqlite.hx",162,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_151_lastId,"snikket.persistence.Sqlite","lastId",0xe7f21c93,"snikket.persistence.Sqlite.lastId","snikket/persistence/Sqlite.hx",151,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_179_storeChats,"snikket.persistence.Sqlite","storeChats",0xcde3e4bc,"snikket.persistence.Sqlite.storeChats","snikket/persistence/Sqlite.hx",179,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_178_storeChats,"snikket.persistence.Sqlite","storeChats",0xcde3e4bc,"snikket.persistence.Sqlite.storeChats","snikket/persistence/Sqlite.hx",178,0x917a2510)
+static const ::String _hx_array_data_e415cb6c_23[] = {
+ HX_("INSERT OR REPLACE INTO chats VALUES ",3b,7d,10,d4),
+};
+static const ::String _hx_array_data_e415cb6c_24[] = {
+ HX_(",",2c,00,00,00),
+};
+static const ::String _hx_array_data_e415cb6c_25[] = {
+ HX_("(?,?,?,?,?,?,?,?,?,?,?,jsonb(?),?,?,?,?)",4e,16,2e,3d),
+};
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_169_storeChats,"snikket.persistence.Sqlite","storeChats",0xcde3e4bc,"snikket.persistence.Sqlite.storeChats","snikket/persistence/Sqlite.hx",169,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_241_getChats,"snikket.persistence.Sqlite","getChats",0x2aaef367,"snikket.persistence.Sqlite.getChats","snikket/persistence/Sqlite.hx",241,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_245_getChats,"snikket.persistence.Sqlite","getChats",0x2aaef367,"snikket.persistence.Sqlite.getChats","snikket/persistence/Sqlite.hx",245,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_228_getChats,"snikket.persistence.Sqlite","getChats",0x2aaef367,"snikket.persistence.Sqlite.getChats","snikket/persistence/Sqlite.hx",228,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_233_getChats,"snikket.persistence.Sqlite","getChats",0x2aaef367,"snikket.persistence.Sqlite.getChats","snikket/persistence/Sqlite.hx",233,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_246_getChats,"snikket.persistence.Sqlite","getChats",0x2aaef367,"snikket.persistence.Sqlite.getChats","snikket/persistence/Sqlite.hx",246,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_250_getChats,"snikket.persistence.Sqlite","getChats",0x2aaef367,"snikket.persistence.Sqlite.getChats","snikket/persistence/Sqlite.hx",250,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_224_getChats,"snikket.persistence.Sqlite","getChats",0x2aaef367,"snikket.persistence.Sqlite.getChats","snikket/persistence/Sqlite.hx",224,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_305_storeMessages,"snikket.persistence.Sqlite","storeMessages",0x458d5d4b,"snikket.persistence.Sqlite.storeMessages","snikket/persistence/Sqlite.hx",305,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_320_storeMessages,"snikket.persistence.Sqlite","storeMessages",0x458d5d4b,"snikket.persistence.Sqlite.storeMessages","snikket/persistence/Sqlite.hx",320,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_319_storeMessages,"snikket.persistence.Sqlite","storeMessages",0x458d5d4b,"snikket.persistence.Sqlite.storeMessages","snikket/persistence/Sqlite.hx",319,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_269_storeMessages,"snikket.persistence.Sqlite","storeMessages",0x458d5d4b,"snikket.persistence.Sqlite.storeMessages","snikket/persistence/Sqlite.hx",269,0x917a2510)
+static const ::String _hx_array_data_e415cb6c_51[] = {
+ HX_("DELETE FROM messages WHERE account_id=? AND direction=? AND chat_id IN (",a1,9c,a2,06),
+};
+static const ::String _hx_array_data_e415cb6c_52[] = {
+ HX_(") AND stanza_id IN (",e8,da,d3,eb),
+};
+static const ::String _hx_array_data_e415cb6c_53[] = {
+ HX_(")",29,00,00,00),
+};
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_328_updateMessage,"snikket.persistence.Sqlite","updateMessage",0xc14f063c,"snikket.persistence.Sqlite.updateMessage","snikket/persistence/Sqlite.hx",328,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_342_getMessage,"snikket.persistence.Sqlite","getMessage",0x34245593,"snikket.persistence.Sqlite.getMessage","snikket/persistence/Sqlite.hx",342,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_348_getMessage,"snikket.persistence.Sqlite","getMessage",0x34245593,"snikket.persistence.Sqlite.getMessage","snikket/persistence/Sqlite.hx",348,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_331_getMessage,"snikket.persistence.Sqlite","getMessage",0x34245593,"snikket.persistence.Sqlite.getMessage","snikket/persistence/Sqlite.hx",331,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_45dcb523da764b50_221_getMessage__fromC,"snikket.persistence.Sqlite","getMessage__fromC",0x61244346,"snikket.persistence.Sqlite.getMessage__fromC","HaxeCBridge.hx",221,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_45dcb523da764b50_244_getMessage__fromC,"snikket.persistence.Sqlite","getMessage__fromC",0x61244346,"snikket.persistence.Sqlite.getMessage__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_380_getMessages,"snikket.persistence.Sqlite","getMessages",0x6ba68b80,"snikket.persistence.Sqlite.getMessages","snikket/persistence/Sqlite.hx",380,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_393_getMessages,"snikket.persistence.Sqlite","getMessages",0x6ba68b80,"snikket.persistence.Sqlite.getMessages","snikket/persistence/Sqlite.hx",393,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_355_getMessages,"snikket.persistence.Sqlite","getMessages",0x6ba68b80,"snikket.persistence.Sqlite.getMessages","snikket/persistence/Sqlite.hx",355,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_398_getMessagesBefore,"snikket.persistence.Sqlite","getMessagesBefore",0x6d22f41f,"snikket.persistence.Sqlite.getMessagesBefore","snikket/persistence/Sqlite.hx",398,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_403_getMessagesAfter,"snikket.persistence.Sqlite","getMessagesAfter",0x143f9a7c,"snikket.persistence.Sqlite.getMessagesAfter","snikket/persistence/Sqlite.hx",403,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_419_getMessagesAround,"snikket.persistence.Sqlite","getMessagesAround",0x88f497ed,"snikket.persistence.Sqlite.getMessagesAround","snikket/persistence/Sqlite.hx",419,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_424_getMessagesAround,"snikket.persistence.Sqlite","getMessagesAround",0x88f497ed,"snikket.persistence.Sqlite.getMessagesAround","snikket/persistence/Sqlite.hx",424,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_407_getMessagesAround,"snikket.persistence.Sqlite","getMessagesAround",0x88f497ed,"snikket.persistence.Sqlite.getMessagesAround","snikket/persistence/Sqlite.hx",407,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_409_getMessagesAround,"snikket.persistence.Sqlite","getMessagesAround",0x88f497ed,"snikket.persistence.Sqlite.getMessagesAround","snikket/persistence/Sqlite.hx",409,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_410_getMessagesAround,"snikket.persistence.Sqlite","getMessagesAround",0x88f497ed,"snikket.persistence.Sqlite.getMessagesAround","snikket/persistence/Sqlite.hx",410,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_413_getMessagesAround,"snikket.persistence.Sqlite","getMessagesAround",0x88f497ed,"snikket.persistence.Sqlite.getMessagesAround","snikket/persistence/Sqlite.hx",413,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_471_getChatsUnreadDetails,"snikket.persistence.Sqlite","getChatsUnreadDetails",0x81deee6c,"snikket.persistence.Sqlite.getChatsUnreadDetails","snikket/persistence/Sqlite.hx",471,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_472_getChatsUnreadDetails,"snikket.persistence.Sqlite","getChatsUnreadDetails",0x81deee6c,"snikket.persistence.Sqlite.getChatsUnreadDetails","snikket/persistence/Sqlite.hx",472,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_469_getChatsUnreadDetails,"snikket.persistence.Sqlite","getChatsUnreadDetails",0x81deee6c,"snikket.persistence.Sqlite.getChatsUnreadDetails","snikket/persistence/Sqlite.hx",469,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_429_getChatsUnreadDetails,"snikket.persistence.Sqlite","getChatsUnreadDetails",0x81deee6c,"snikket.persistence.Sqlite.getChatsUnreadDetails","snikket/persistence/Sqlite.hx",429,0x917a2510)
+static const ::String _hx_array_data_e415cb6c_89[] = {
+ HX_("SELECT chat_id, ROWID as row, MAX(created_at) AS created_at FROM messages WHERE account_id=?",d0,69,08,92),
+};
+static const ::String _hx_array_data_e415cb6c_90[] = {
+ HX_(" AND chat_id IN (",14,bd,7b,de),
+};
+static const ::String _hx_array_data_e415cb6c_91[] = {
+ HX_(",",2c,00,00,00),
+};
+static const ::String _hx_array_data_e415cb6c_92[] = {
+ HX_("?",3f,00,00,00),
+};
+static const ::String _hx_array_data_e415cb6c_93[] = {
+ HX_(") AND (mam_id IN (",64,f4,1c,69),
+};
+static const ::String _hx_array_data_e415cb6c_94[] = {
+ HX_(",",2c,00,00,00),
+};
+static const ::String _hx_array_data_e415cb6c_95[] = {
+ HX_("?",3f,00,00,00),
+};
+static const ::String _hx_array_data_e415cb6c_96[] = {
+ HX_(") OR direction=?) GROUP BY chat_id",cc,ab,94,e3),
+};
+static const ::String _hx_array_data_e415cb6c_97[] = {
+ HX_("SELECT chat_id AS chatId, stanza, direction, type, sender_id, mam_id, mam_by, sync_point, CASE WHEN subq.created_at IS NULL THEN COUNT(*) ELSE COUNT(*) - 1 END AS unreadCount, strftime('%FT%H:%M:%fZ', MAX(messages.created_at) / 1000.0, 'unixepoch') AS timestamp FROM messages LEFT JOIN (",04,fc,16,f0),
+};
+static const ::String _hx_array_data_e415cb6c_98[] = {
+ HX_(") subq USING (chat_id) WHERE account_id=? AND (stanza_id IS NULL OR stanza_id='' OR stanza_id=correction_id) AND chat_id IN (",e7,a1,32,e5),
+};
+static const ::String _hx_array_data_e415cb6c_99[] = {
+ HX_(",",2c,00,00,00),
+};
+static const ::String _hx_array_data_e415cb6c_100[] = {
+ HX_("?",3f,00,00,00),
+};
+static const ::String _hx_array_data_e415cb6c_101[] = {
+ HX_(") AND (subq.created_at IS NULL OR messages.created_at > subq.created_at OR (messages.created_at=subq.created_at AND messages.ROWID >= subq.row)) GROUP BY chat_id;",58,6f,52,ea),
+};
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_495_storeReaction,"snikket.persistence.Sqlite","storeReaction",0x07446c28,"snikket.persistence.Sqlite.storeReaction","snikket/persistence/Sqlite.hx",495,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_486_storeReaction,"snikket.persistence.Sqlite","storeReaction",0x07446c28,"snikket.persistence.Sqlite.storeReaction","snikket/persistence/Sqlite.hx",486,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_505_updateMessageStatus,"snikket.persistence.Sqlite","updateMessageStatus",0xa0efb68e,"snikket.persistence.Sqlite.updateMessageStatus","snikket/persistence/Sqlite.hx",505,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_509_updateMessageStatus,"snikket.persistence.Sqlite","updateMessageStatus",0xa0efb68e,"snikket.persistence.Sqlite.updateMessageStatus","snikket/persistence/Sqlite.hx",509,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_510_updateMessageStatus,"snikket.persistence.Sqlite","updateMessageStatus",0xa0efb68e,"snikket.persistence.Sqlite.updateMessageStatus","snikket/persistence/Sqlite.hx",510,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_515_updateMessageStatus,"snikket.persistence.Sqlite","updateMessageStatus",0xa0efb68e,"snikket.persistence.Sqlite.updateMessageStatus","snikket/persistence/Sqlite.hx",515,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_500_updateMessageStatus,"snikket.persistence.Sqlite","updateMessageStatus",0xa0efb68e,"snikket.persistence.Sqlite.updateMessageStatus","snikket/persistence/Sqlite.hx",500,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_523_hasMedia,"snikket.persistence.Sqlite","hasMedia",0x1738946c,"snikket.persistence.Sqlite.hasMedia","snikket/persistence/Sqlite.hx",523,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_528_removeMedia,"snikket.persistence.Sqlite","removeMedia",0x14a4d1fe,"snikket.persistence.Sqlite.removeMedia","snikket/persistence/Sqlite.hx",528,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_533_storeMedia,"snikket.persistence.Sqlite","storeMedia",0x8dec4b05,"snikket.persistence.Sqlite.storeMedia","snikket/persistence/Sqlite.hx",533,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_538_storeCaps,"snikket.persistence.Sqlite","storeCaps",0x986fb520,"snikket.persistence.Sqlite.storeCaps","snikket/persistence/Sqlite.hx",538,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_555_getCaps,"snikket.persistence.Sqlite","getCaps",0x487e64d5,"snikket.persistence.Sqlite.getCaps","snikket/persistence/Sqlite.hx",555,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_558_getCaps,"snikket.persistence.Sqlite","getCaps",0x487e64d5,"snikket.persistence.Sqlite.getCaps","snikket/persistence/Sqlite.hx",558,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_545_getCaps,"snikket.persistence.Sqlite","getCaps",0x487e64d5,"snikket.persistence.Sqlite.getCaps","snikket/persistence/Sqlite.hx",545,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_566_storeLogin,"snikket.persistence.Sqlite","storeLogin",0x01241f8a,"snikket.persistence.Sqlite.storeLogin","snikket/persistence/Sqlite.hx",566,0x917a2510)
+static const ::String _hx_array_data_e415cb6c_120[] = {
+ HX_("INSERT INTO accounts (account_id, client_id, display_name",03,b0,6a,0b),
+};
+static const ::String _hx_array_data_e415cb6c_121[] = {
+ HX_(", token, fast_count",a5,56,e4,ae),
+};
+static const ::String _hx_array_data_e415cb6c_122[] = {
+ HX_(") VALUES (?,?,?",c4,1c,e3,67),
+};
+static const ::String _hx_array_data_e415cb6c_123[] = {
+ HX_(",?",93,26,00,00),
+};
+static const ::String _hx_array_data_e415cb6c_124[] = {
+ HX_(",0",84,26,00,00),
+};
+static const ::String _hx_array_data_e415cb6c_125[] = {
+ HX_(") ON CONFLICT DO UPDATE SET client_id=?",cd,99,0c,96),
+};
+static const ::String _hx_array_data_e415cb6c_126[] = {
+ HX_(", display_name=?",7e,ad,5b,0f),
+};
+static const ::String _hx_array_data_e415cb6c_127[] = {
+ HX_(", token=?",a7,78,19,80),
+};
+static const ::String _hx_array_data_e415cb6c_128[] = {
+ HX_(", fast_count=0",73,a8,4f,82),
+};
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_596_getLogin,"snikket.persistence.Sqlite","getLogin",0x5def2e35,"snikket.persistence.Sqlite.getLogin","snikket/persistence/Sqlite.hx",596,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_606_getLogin,"snikket.persistence.Sqlite","getLogin",0x5def2e35,"snikket.persistence.Sqlite.getLogin","snikket/persistence/Sqlite.hx",606,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_592_getLogin,"snikket.persistence.Sqlite","getLogin",0x5def2e35,"snikket.persistence.Sqlite.getLogin","snikket/persistence/Sqlite.hx",592,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_609_removeAccount,"snikket.persistence.Sqlite","removeAccount",0xd5e3c447,"snikket.persistence.Sqlite.removeAccount","snikket/persistence/Sqlite.hx",609,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_622_listAccounts,"snikket.persistence.Sqlite","listAccounts",0x83858fe6,"snikket.persistence.Sqlite.listAccounts","snikket/persistence/Sqlite.hx",622,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_621_listAccounts,"snikket.persistence.Sqlite","listAccounts",0x83858fe6,"snikket.persistence.Sqlite.listAccounts","snikket/persistence/Sqlite.hx",621,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_45dcb523da764b50_221_listAccounts__fromC,"snikket.persistence.Sqlite","listAccounts__fromC",0x29194953,"snikket.persistence.Sqlite.listAccounts__fromC","HaxeCBridge.hx",221,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_45dcb523da764b50_244_listAccounts__fromC,"snikket.persistence.Sqlite","listAccounts__fromC",0x29194953,"snikket.persistence.Sqlite.listAccounts__fromC","HaxeCBridge.hx",244,0xa18550d8)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_629_storeStreamManagement,"snikket.persistence.Sqlite","storeStreamManagement",0x8a3c36a2,"snikket.persistence.Sqlite.storeStreamManagement","snikket/persistence/Sqlite.hx",629,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_636_storeStreamManagement,"snikket.persistence.Sqlite","storeStreamManagement",0x8a3c36a2,"snikket.persistence.Sqlite.storeStreamManagement","snikket/persistence/Sqlite.hx",636,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_645_getStreamManagement,"snikket.persistence.Sqlite","getStreamManagement",0xfe2e21d7,"snikket.persistence.Sqlite.getStreamManagement","snikket/persistence/Sqlite.hx",645,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_656_storeService,"snikket.persistence.Sqlite","storeService",0x2b93ec96,"snikket.persistence.Sqlite.storeService","snikket/persistence/Sqlite.hx",656,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_671_findServicesWithFeature,"snikket.persistence.Sqlite","findServicesWithFeature",0x83994397,"snikket.persistence.Sqlite.findServicesWithFeature","snikket/persistence/Sqlite.hx",671,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_668_findServicesWithFeature,"snikket.persistence.Sqlite","findServicesWithFeature",0x83994397,"snikket.persistence.Sqlite.findServicesWithFeature","snikket/persistence/Sqlite.hx",668,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_690_hydrateReactions,"snikket.persistence.Sqlite","hydrateReactions",0xe3b51cd9,"snikket.persistence.Sqlite.hydrateReactions","snikket/persistence/Sqlite.hx",690,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_692_hydrateReactions,"snikket.persistence.Sqlite","hydrateReactions",0xe3b51cd9,"snikket.persistence.Sqlite.hydrateReactions","snikket/persistence/Sqlite.hx",692,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_714_fetchReactions,"snikket.persistence.Sqlite","fetchReactions",0x5819e3d2,"snikket.persistence.Sqlite.fetchReactions","snikket/persistence/Sqlite.hx",714,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_699_fetchReactions,"snikket.persistence.Sqlite","fetchReactions",0x5819e3d2,"snikket.persistence.Sqlite.fetchReactions","snikket/persistence/Sqlite.hx",699,0x917a2510)
+static const ::String _hx_array_data_e415cb6c_165[] = {
+ HX_("SELECT kind, chat_id, mam_id, mam_by, stanza_id, sender_id, json(reactions) AS reactions FROM reactions WHERE 1=0",d2,04,de,a3),
+};
+static const ::String _hx_array_data_e415cb6c_166[] = {
+ HX_(" OR (mam_id=? AND mam_by=?)",0f,bb,c5,e5),
+};
+static const ::String _hx_array_data_e415cb6c_167[] = {
+ HX_(" OR stanza_id=?",6a,1d,f2,5b),
+};
+static const ::String _hx_array_data_e415cb6c_168[] = {
+ HX_(" ORDER BY created_at, ROWID",00,65,8d,0e),
+};
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_771_hydrateReplyTo,"snikket.persistence.Sqlite","hydrateReplyTo",0x94f407b4,"snikket.persistence.Sqlite.hydrateReplyTo","snikket/persistence/Sqlite.hx",771,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_773_hydrateReplyTo,"snikket.persistence.Sqlite","hydrateReplyTo",0x94f407b4,"snikket.persistence.Sqlite.hydrateReplyTo","snikket/persistence/Sqlite.hx",773,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_776_hydrateReplyTo,"snikket.persistence.Sqlite","hydrateReplyTo",0x94f407b4,"snikket.persistence.Sqlite.hydrateReplyTo","snikket/persistence/Sqlite.hx",776,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_751_hydrateReplyTo,"snikket.persistence.Sqlite","hydrateReplyTo",0x94f407b4,"snikket.persistence.Sqlite.hydrateReplyTo","snikket/persistence/Sqlite.hx",751,0x917a2510)
+static const ::String _hx_array_data_e415cb6c_175[] = {
+ HX_("SELECT chat_id, stanza_id, stanza, direction, type, strftime('%FT%H:%M:%fZ', created_at / 1000.0, 'unixepoch') AS timestamp, sender_id, mam_id, mam_by, sync_point FROM messages WHERE account_id=? AND (",3c,df,23,3e),
+};
+static const ::String _hx_array_data_e415cb6c_176[] = {
+ HX_(")",29,00,00,00),
+};
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_789_hydrateMessages,"snikket.persistence.Sqlite","hydrateMessages",0xcda7e37d,"snikket.persistence.Sqlite.hydrateMessages","snikket/persistence/Sqlite.hx",789,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_792_hydrateMessages,"snikket.persistence.Sqlite","hydrateMessages",0xcda7e37d,"snikket.persistence.Sqlite.hydrateMessages","snikket/persistence/Sqlite.hx",792,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_821_hydrateMessages,"snikket.persistence.Sqlite","hydrateMessages",0xcda7e37d,"snikket.persistence.Sqlite.hydrateMessages","snikket/persistence/Sqlite.hx",821,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_811_hydrateMessages,"snikket.persistence.Sqlite","hydrateMessages",0xcda7e37d,"snikket.persistence.Sqlite.hydrateMessages","snikket/persistence/Sqlite.hx",811,0x917a2510)
+HX_LOCAL_STACK_FRAME(_hx_pos_5b1a6b524efab4db_24_boot,"snikket.persistence.Sqlite","boot",0x8e1f8074,"snikket.persistence.Sqlite.boot","snikket/persistence/Sqlite.hx",24,0x917a2510)
+namespace snikket{
+namespace persistence{
+
+void Sqlite_obj::__construct(::String dbfile,::Dynamic media){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::persistence::Sqlite,_gthis) HXARGC(1)
+ ::Dynamic _hx_run(::Dynamic iter){
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_39_new)
+HXLINE( 40) int version;
+HXDLIN( 40) ::Dynamic tmp = ::sys::db::ResultSet_obj::next(iter);
+HXDLIN( 40) ::Dynamic tmp1;
+HXDLIN( 40) if (::hx::IsNotNull( tmp )) {
+HXLINE( 40) tmp1 = ::Dynamic(tmp->__Field(HX_("user_version",e4,95,f3,73),::hx::paccDynamic));
+ }
+ else {
+HXLINE( 40) tmp1 = null();
+ }
+HXDLIN( 40) ::Dynamic tmp2 = ::Std_obj::parseInt(( (::String)(tmp1) ));
+HXDLIN( 40) if (::hx::IsNotNull( tmp2 )) {
+HXLINE( 40) version = ( (int)(tmp2) );
+ }
+ else {
+HXLINE( 40) version = 0;
+ }
+HXLINE( 41) if ((version < 1)) {
+HXLINE( 42) return _gthis->db->exec(::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_1,10),null());
+ }
+ else {
+HXLINE( 115) if ((version < 2)) {
+HXLINE( 116) return _gthis->db->exec(::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_2,4),null());
+ }
+ else {
+HXLINE( 121) return ::thenshim::_Promise::Promise_Impl__obj::resolve(null());
+ }
+ }
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_1) HXARGC(1)
+ ::Dynamic _hx_run(::Dynamic _){
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_123_new)
+HXLINE( 123) return null();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_2) HXARGC(1)
+ ::Dynamic _hx_run( ::Dynamic err){
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_123_new)
+HXLINE( 123) ::Dynamic _hx_tmp = ::haxe::Log_obj::trace;
+HXDLIN( 123) ::String _hx_tmp1;
+HXDLIN( 123) if (::hx::IsNull( err )) {
+HXLINE( 123) _hx_tmp1 = HX_("null",87,9e,0e,49);
+ }
+ else {
+HXLINE( 123) _hx_tmp1 = ::Std_obj::string(err);
+ }
+HXDLIN( 123) _hx_tmp(HX_("ERR1",4c,39,da,2d), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.persistence.Sqlite",6c,cb,15,e4))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,_hx_tmp1))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("new",60,d0,53,00))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/persistence/Sqlite.hx",10,25,7a,91))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),123)));
+HXDLIN( 123) return null();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_24_new)
+HXLINE( 627) this->smStoreNext = null();
+HXLINE( 626) this->smStoreInProgress = false;
+HXLINE( 166) this->storeChatTimer = null();
+HXLINE( 165) this->storeChatBuffer = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXLINE( 35) ::snikket::persistence::Sqlite _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 36) this->media = media;
+HXLINE( 37) ::snikket::persistence::MediaStore_obj::setKV(media,::hx::ObjectPtr<OBJ_>(this));
+HXLINE( 38) this->db = ::snikket::persistence::SqliteDriver_obj::__alloc( HX_CTX ,dbfile);
+HXLINE( 39) ::thenshim::_Promise::Promise_Impl__obj::then(::thenshim::_Promise::Promise_Impl__obj::then(this->db->exec(HX_("PRAGMA user_version;",73,bf,dc,ae),null()), ::Dynamic(new _hx_Closure_0(_gthis)),null()), ::Dynamic(new _hx_Closure_1()), ::Dynamic(new _hx_Closure_2()));
+ }
+
+Dynamic Sqlite_obj::__CreateEmpty() { return new Sqlite_obj; }
+
+void *Sqlite_obj::_hx_vtable = 0;
+
+Dynamic Sqlite_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Sqlite_obj > _hx_result = new Sqlite_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1]);
+ return _hx_result;
+}
+
+bool Sqlite_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x1fc6c66e;
+}
+
+static ::snikket::persistence::KeyValueStore_obj _hx_snikket_persistence_Sqlite__hx_snikket_persistence_KeyValueStore= {
+ ( void (::hx::Object::*)(::String, ::Dynamic))&::snikket::persistence::Sqlite_obj::get,
+ ( void (::hx::Object::*)(::String,::String, ::Dynamic))&::snikket::persistence::Sqlite_obj::set,
+};
+
+static ::snikket::Persistence_obj _hx_snikket_persistence_Sqlite__hx_snikket_Persistence= {
+ ( void (::hx::Object::*)(::String,::String, ::Dynamic))&::snikket::persistence::Sqlite_obj::lastId,
+ ( void (::hx::Object::*)(::String,::Array< ::Dynamic>))&::snikket::persistence::Sqlite_obj::storeChats,
+ ( void (::hx::Object::*)(::String, ::Dynamic))&::snikket::persistence::Sqlite_obj::getChats,
+ ( void (::hx::Object::*)(::String,::Array< ::Dynamic>, ::Dynamic))&::snikket::persistence::Sqlite_obj::getChatsUnreadDetails,
+ ( void (::hx::Object::*)(::String, ::snikket::ReactionUpdate, ::Dynamic))&::snikket::persistence::Sqlite_obj::storeReaction,
+ ( void (::hx::Object::*)(::String,::Array< ::Dynamic>, ::Dynamic))&::snikket::persistence::Sqlite_obj::storeMessages,
+ ( void (::hx::Object::*)(::String, ::snikket::ChatMessage))&::snikket::persistence::Sqlite_obj::updateMessage,
+ ( void (::hx::Object::*)(::String,::String,int, ::Dynamic))&::snikket::persistence::Sqlite_obj::updateMessageStatus,
+ ( void (::hx::Object::*)(::String,::String,::String,::String, ::Dynamic))&::snikket::persistence::Sqlite_obj::getMessage,
+ ( void (::hx::Object::*)(::String,::String,::String,::String, ::Dynamic))&::snikket::persistence::Sqlite_obj::getMessagesBefore,
+ ( void (::hx::Object::*)(::String,::String,::String,::String, ::Dynamic))&::snikket::persistence::Sqlite_obj::getMessagesAfter,
+ ( void (::hx::Object::*)(::String,::String,::String,::String, ::Dynamic))&::snikket::persistence::Sqlite_obj::getMessagesAround,
+ ( void (::hx::Object::*)(::String,::Array< unsigned char >, ::Dynamic))&::snikket::persistence::Sqlite_obj::hasMedia,
+ ( void (::hx::Object::*)(::String,::Array< unsigned char >, ::Dynamic))&::snikket::persistence::Sqlite_obj::storeMedia,
+ ( void (::hx::Object::*)(::String,::Array< unsigned char >))&::snikket::persistence::Sqlite_obj::removeMedia,
+ ( void (::hx::Object::*)( ::snikket::Caps))&::snikket::persistence::Sqlite_obj::storeCaps,
+ ( void (::hx::Object::*)(::String, ::Dynamic))&::snikket::persistence::Sqlite_obj::getCaps,
+ ( void (::hx::Object::*)(::String,::String,::String,::String))&::snikket::persistence::Sqlite_obj::storeLogin,
+ ( void (::hx::Object::*)(::String, ::Dynamic))&::snikket::persistence::Sqlite_obj::getLogin,
+ ( void (::hx::Object::*)(::String,bool))&::snikket::persistence::Sqlite_obj::removeAccount,
+ ( void (::hx::Object::*)( ::Dynamic))&::snikket::persistence::Sqlite_obj::listAccounts,
+ ( void (::hx::Object::*)(::String,::Array< unsigned char >))&::snikket::persistence::Sqlite_obj::storeStreamManagement,
+ ( void (::hx::Object::*)(::String, ::Dynamic))&::snikket::persistence::Sqlite_obj::getStreamManagement,
+ ( void (::hx::Object::*)(::String,::String,::String,::String, ::snikket::Caps))&::snikket::persistence::Sqlite_obj::storeService,
+ ( void (::hx::Object::*)(::String,::String, ::Dynamic))&::snikket::persistence::Sqlite_obj::findServicesWithFeature,
+};
+
+void *Sqlite_obj::_hx_getInterface(int inHash) {
+ switch(inHash) {
+ case (int)0x42160a8d: return &_hx_snikket_persistence_Sqlite__hx_snikket_persistence_KeyValueStore;
+ case (int)0x3e9d59e2: return &_hx_snikket_persistence_Sqlite__hx_snikket_Persistence;
+ }
+ #ifdef HXCPP_SCRIPTABLE
+ return super::_hx_getInterface(inHash);
+ #else
+ return 0;
+ #endif
+}
+
+void Sqlite_obj::get(::String k, ::Dynamic callback){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::Dynamic,callback) HXARGC(1)
+ void _hx_run(::Dynamic iter){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_128_get)
+HXLINE( 129) {
+HXLINE( 129) ::Dynamic row = iter;
+HXDLIN( 129) while(::sys::db::ResultSet_obj::hasNext(row)){
+HXLINE( 129) ::Dynamic row1 = ::sys::db::ResultSet_obj::next(row);
+HXLINE( 130) callback( ::Dynamic(row1->__Field(HX_("v",76,00,00,00),::hx::paccDynamic)));
+HXLINE( 131) return;
+ }
+ }
+HXLINE( 133) callback(null());
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_128_get)
+HXDLIN( 128) ::thenshim::_Promise::Promise_Impl__obj::then(this->db->exec(HX_("SELECT v FROM keyvaluepairs WHERE k=? LIMIT 1",5f,f1,14,07),::cpp::VirtualArray_obj::__new(1)->init(0,k)), ::Dynamic(new _hx_Closure_0(callback)),null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Sqlite_obj,get,(void))
+
+void Sqlite_obj::set(::String k,::String v, ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_139_set)
+HXDLIN( 139) if (::hx::IsNull( v )) {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::Dynamic,callback) HXARGC(1)
+ void _hx_run(::Dynamic _){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_141_set)
+HXLINE( 141) callback();
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE( 140) ::thenshim::_Promise::Promise_Impl__obj::then(this->db->exec(HX_("DELETE FROM keyvaluepairs WHERE k=?",1a,ab,19,78),::cpp::VirtualArray_obj::__new(1)->init(0,k)), ::Dynamic(new _hx_Closure_0(callback)),null());
+ }
+ else {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_1, ::Dynamic,callback) HXARGC(1)
+ void _hx_run(::Dynamic _){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_145_set)
+HXLINE( 145) callback();
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE( 144) ::thenshim::_Promise::Promise_Impl__obj::then(this->db->exec(HX_("INSERT OR REPLACE INTO keyvaluepairs VALUES (?,?)",18,81,b5,d3),::cpp::VirtualArray_obj::__new(2)->init(0,k)->init(1,v)), ::Dynamic(new _hx_Closure_1(callback)),null());
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Sqlite_obj,set,(void))
+
+void Sqlite_obj::lastId(::String accountId,::String chatId, ::Dynamic callback){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::Dynamic,callback) HXARGC(1)
+ void _hx_run(::Dynamic iter){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_162_lastId)
+HXLINE( 162) ::Dynamic callback1 = callback;
+HXDLIN( 162) ::Dynamic tmp = ::sys::db::ResultSet_obj::next(iter);
+HXDLIN( 162) ::Dynamic _hx_tmp;
+HXDLIN( 162) if (::hx::IsNotNull( tmp )) {
+HXLINE( 162) _hx_tmp = ::Dynamic(tmp->__Field(HX_("mam_id",01,4d,19,b7),::hx::paccDynamic));
+ }
+ else {
+HXLINE( 162) _hx_tmp = null();
+ }
+HXDLIN( 162) callback1(_hx_tmp);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_1, ::Dynamic,callback) HXARGC(1)
+ void _hx_run( ::Dynamic _){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_162_lastId)
+HXLINE( 162) callback(null());
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_151_lastId)
+HXLINE( 152) ::Array< ::String > params = ::Array_obj< ::String >::__new(1)->init(0,accountId);
+HXLINE( 153) ::String q = HX_("SELECT mam_id FROM messages WHERE mam_id IS NOT NULL AND sync_point AND account_id=?",20,14,35,bc);
+HXLINE( 154) if (::hx::IsNull( chatId )) {
+HXLINE( 155) q = (q + HX_(" AND mam_by=?",48,20,9b,c4));
+HXLINE( 156) params->push(accountId);
+ }
+ else {
+HXLINE( 158) q = (q + HX_(" AND chat_id=?",3b,95,e7,43));
+HXLINE( 159) params->push(chatId);
+ }
+HXLINE( 161) q = (q + HX_(" ORDER BY ROWID DESC LIMIT 1",1f,5d,e2,de));
+HXLINE( 162) ::thenshim::_Promise::Promise_Impl__obj::then(this->db->exec(q,params), ::Dynamic(new _hx_Closure_0(callback)), ::Dynamic(new _hx_Closure_1(callback)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Sqlite_obj,lastId,(void))
+
+void Sqlite_obj::storeChats(::String accountId,::Array< ::Dynamic> chats){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_1, ::snikket::persistence::Sqlite,_gthis,::String,accountId) HXARGC(0)
+ void _hx_run(){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::persistence::Sqlite,_gthis) HXARGC(1)
+ ::Dynamic _hx_run( ::snikket::Chat chat){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_179_storeChats)
+HXLINE( 180) ::Dynamic storePresence = ::Dynamic(::hx::Anon_obj::Create(0));
+HXLINE( 181) {
+HXLINE( 181) ::Dynamic map = chat->presence;
+HXDLIN( 181) ::Dynamic _g_map = map;
+HXDLIN( 181) ::Dynamic _g_keys = ::haxe::IMap_obj::keys(map);
+HXDLIN( 181) while(( (bool)(_g_keys->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 181) ::String key = ( (::String)(_g_keys->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXDLIN( 181) ::snikket::Presence _g_value = ( ( ::snikket::Presence)(::haxe::IMap_obj::get(_g_map,key)) );
+HXDLIN( 181) ::String _g_key = key;
+HXDLIN( 181) ::String resource = _g_key;
+HXDLIN( 181) ::snikket::Presence presence = _g_value;
+HXDLIN( 181) {
+HXLINE( 182) {
+HXLINE( 182) ::Dynamic value = ::Dynamic(::hx::Anon_obj::Create(0));
+HXDLIN( 182) ::String tmp = resource;
+HXDLIN( 182) ::String mapPresence;
+HXDLIN( 182) if (::hx::IsNotNull( tmp )) {
+HXLINE( 182) mapPresence = tmp;
+ }
+ else {
+HXLINE( 182) mapPresence = HX_("",00,00,00,00);
+ }
+HXDLIN( 182) ::Reflect_obj::setField(storePresence,mapPresence,value);
+ }
+HXLINE( 183) if (::hx::IsNotNull( presence->caps )) {
+HXLINE( 184) _gthis->storeCaps(presence->caps);
+HXLINE( 185) ::String tmp1 = resource;
+HXDLIN( 185) ::String mapPresence1;
+HXDLIN( 185) if (::hx::IsNotNull( tmp1 )) {
+HXLINE( 185) mapPresence1 = tmp1;
+ }
+ else {
+HXLINE( 185) mapPresence1 = HX_("",00,00,00,00);
+ }
+HXDLIN( 185) ::Reflect_obj::field(storePresence,mapPresence1)->__SetField(HX_("caps",21,1c,ba,41),presence->caps->ver(),::hx::paccDynamic);
+ }
+HXLINE( 187) if (::hx::IsNotNull( presence->mucUser )) {
+HXLINE( 188) ::String tmp2 = resource;
+HXDLIN( 188) ::String mapPresence2;
+HXDLIN( 188) if (::hx::IsNotNull( tmp2 )) {
+HXLINE( 188) mapPresence2 = tmp2;
+ }
+ else {
+HXLINE( 188) mapPresence2 = HX_("",00,00,00,00);
+ }
+HXDLIN( 188) ::Reflect_obj::field(storePresence,mapPresence2)->__SetField(HX_("mucUser",e6,f3,96,b5),presence->mucUser->toString(),::hx::paccDynamic);
+ }
+ }
+ }
+ }
+HXLINE( 191) return storePresence;
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_178_storeChats)
+HXLINE( 179) ::Dynamic mapPresence = ::Dynamic(new _hx_Closure_0(_gthis));
+HXLINE( 193) ::StringBuf q = ::StringBuf_obj::__alloc( HX_CTX );
+HXLINE( 194) {
+HXLINE( 194) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 194) q->flush();
+ }
+HXDLIN( 194) if (::hx::IsNull( q->b )) {
+HXLINE( 194) q->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_23,1);
+ }
+ else {
+HXLINE( 194) q->b->push(HX_("INSERT OR REPLACE INTO chats VALUES ",3b,7d,10,d4));
+ }
+ }
+HXLINE( 195) bool first = true;
+HXLINE( 196) {
+HXLINE( 196) ::Dynamic _ = _gthis->storeChatBuffer->iterator();
+HXDLIN( 196) while(( (bool)(_->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 196) ::snikket::Chat _1 = ( ( ::snikket::Chat)(_->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXLINE( 197) if (!(first)) {
+HXLINE( 197) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 197) q->flush();
+ }
+HXDLIN( 197) if (::hx::IsNull( q->b )) {
+HXLINE( 197) q->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_24,1);
+ }
+ else {
+HXLINE( 197) q->b->push(HX_(",",2c,00,00,00));
+ }
+ }
+HXLINE( 198) first = false;
+HXLINE( 199) {
+HXLINE( 199) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 199) q->flush();
+ }
+HXDLIN( 199) if (::hx::IsNull( q->b )) {
+HXLINE( 199) q->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_25,1);
+ }
+ else {
+HXLINE( 199) q->b->push(HX_("(?,?,?,?,?,?,?,?,?,?,?,jsonb(?),?,?,?,?)",4e,16,2e,3d));
+ }
+ }
+ }
+ }
+HXLINE( 202) ::snikket::persistence::SqliteDriver _gthis1 = _gthis->db;
+HXLINE( 203) ::String _hx_tmp = q->toString();
+HXLINE( 204) ::Array< ::Dynamic> _g = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 204) {
+HXLINE( 204) ::Dynamic x = _gthis->storeChatBuffer->__Field(HX_("iterator",ee,49,9a,93),::hx::paccDynamic)();
+HXDLIN( 204) while(( (bool)(x->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 204) ::snikket::Chat x1 = ( ( ::snikket::Chat)(x->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXLINE( 205) ::snikket::Channel channel = ( ( ::snikket::Channel)(::Std_obj::downcast(x1,::hx::ClassOf< ::snikket::Channel >())) );
+HXLINE( 206) if (::hx::IsNotNull( channel )) {
+HXLINE( 206) _gthis->storeCaps(channel->disco);
+ }
+HXLINE( 208) ::String accountId1 = accountId;
+HXDLIN( 208) ::String x2 = x1->chatId;
+HXDLIN( 208) bool row = x1->isTrusted();
+HXDLIN( 208) ::Array< unsigned char > x3 = x1->avatarSha1;
+HXLINE( 209) ::String row1 = x1->getDisplayName();
+HXDLIN( 209) int x4 = x1->uiState;
+HXDLIN( 209) bool x5 = x1->isBlocked;
+HXLINE( 210) ::String row2 = x1->extensions->toString();
+HXDLIN( 210) ::String row3 = x1->readUpTo();
+HXDLIN( 210) ::String x6 = x1->readUpToBy;
+HXLINE( 211) ::snikket::Caps tmp;
+HXDLIN( 211) if (::hx::IsNotNull( channel )) {
+HXLINE( 211) tmp = channel->disco;
+ }
+ else {
+HXLINE( 211) tmp = null();
+ }
+HXDLIN( 211) ::Array< unsigned char > row4;
+HXDLIN( 211) if (::hx::IsNotNull( tmp )) {
+HXLINE( 211) row4 = tmp->verRaw()->hash;
+ }
+ else {
+HXLINE( 211) row4 = null();
+ }
+HXDLIN( 211) ::Dynamic replacer = null();
+HXDLIN( 211) ::String space = null();
+HXDLIN( 211) ::String row5 = ::haxe::format::JsonPrinter_obj::print(mapPresence(x1),replacer,space);
+HXLINE( 212) ::String row6 = ( (::String)(::Type_obj::getClassName(::Type_obj::getClass(x1)).split(HX_(".",2e,00,00,00))->pop()) );
+HXLINE( 213) bool row7 = x1->notificationsFiltered();
+HXDLIN( 213) bool row8 = x1->notifyMention();
+HXLINE( 207) ::cpp::VirtualArray row9 = ::cpp::VirtualArray_obj::__new(16)->init(0,accountId1)->init(1,x2)->init(2,row)->init(3,x3)->init(4,row1)->init(5,x4)->init(6,x5)->init(7,row2)->init(8,row3)->init(9,x6)->init(10,row4)->init(11,row5)->init(12,row6)->init(13,row7)->init(14,row8)->init(15,x1->notifyReply());
+HXLINE( 204) _g->push(row9);
+ }
+ }
+HXDLIN( 204) ::cpp::VirtualArray _g1 = ::cpp::VirtualArray_obj::__new(0);
+HXDLIN( 204) {
+HXLINE( 204) ::Dynamic e = _g->__Field(HX_("iterator",ee,49,9a,93),::hx::paccDynamic)();
+HXDLIN( 204) while(( (bool)(e->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 204) ::Dynamic e1 = e->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)();
+HXDLIN( 204) {
+HXLINE( 204) ::Dynamic x7 = e1->__Field(HX_("iterator",ee,49,9a,93),::hx::paccDynamic)();
+HXDLIN( 204) while(( (bool)(x7->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 204) ::Dynamic x8 = x7->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)();
+HXDLIN( 204) _g1->push(x8);
+ }
+ }
+ }
+ }
+HXLINE( 202) _gthis1->exec(_hx_tmp,_g1);
+HXLINE( 218) _gthis->storeChatTimer = null();
+HXLINE( 219) _gthis->storeChatBuffer->clear();
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_169_storeChats)
+HXDLIN( 169) ::snikket::persistence::Sqlite _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 170) if (::hx::IsNotNull( this->storeChatTimer )) {
+HXLINE( 171) this->storeChatTimer->stop();
+ }
+HXLINE( 174) {
+HXLINE( 174) int _g = 0;
+HXDLIN( 174) while((_g < chats->length)){
+HXLINE( 174) ::snikket::Chat chat = chats->__get(_g).StaticCast< ::snikket::Chat >();
+HXDLIN( 174) _g = (_g + 1);
+HXLINE( 175) this->storeChatBuffer->set(((accountId + HX_("\n",0a,00,00,00)) + chat->chatId),chat);
+ }
+ }
+HXLINE( 178) this->storeChatTimer = ::haxe::Timer_obj::delay( ::Dynamic(new _hx_Closure_1(_gthis,accountId)),100);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Sqlite_obj,storeChats,(void))
+
+void Sqlite_obj::getChats(::String accountId, ::Dynamic callback){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_3, ::snikket::persistence::Sqlite,_gthis) HXARGC(1)
+ ::Dynamic _hx_run(::Dynamic result){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_1, ::haxe::ds::ObjectMap,fetchCaps) HXARGC(0)
+ ::Dynamic _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_241_getChats)
+HXLINE( 241) return fetchCaps->keys();
+ }
+ HX_END_LOCAL_FUNC0(return)
+
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_2,::cpp::VirtualArray,chats) HXARGC(1)
+ ::Dynamic _hx_run(::Dynamic capsResult){
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_245_getChats)
+HXLINE( 245) return ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("caps",21,1c,ba,41),capsResult)
+ ->setFixed(1,HX_("chats",9b,9e,b3,45),chats));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_228_getChats)
+HXLINE( 229) ::haxe::ds::ObjectMap fetchCaps = ::haxe::ds::ObjectMap_obj::__alloc( HX_CTX );
+HXLINE( 230) ::cpp::VirtualArray chats = ::cpp::VirtualArray_obj::__new(0);
+HXLINE( 231) {
+HXLINE( 231) ::Dynamic row = result;
+HXDLIN( 231) while(::sys::db::ResultSet_obj::hasNext(row)){
+HXLINE( 231) ::Dynamic row1 = ::sys::db::ResultSet_obj::next(row);
+HXLINE( 232) ::Dynamic capsJson;
+HXDLIN( 232) if (::hx::IsNull( row1->__Field(HX_("caps",21,1c,ba,41),::hx::paccDynamic) )) {
+HXLINE( 232) capsJson = null();
+ }
+ else {
+HXLINE( 232) capsJson = ::haxe::format::JsonParser_obj::__alloc( HX_CTX ,( (::String)(row1->__Field(HX_("caps",21,1c,ba,41),::hx::paccDynamic)) ))->doParse();
+ }
+HXLINE( 233) ::snikket::Caps _hx_tmp;
+HXDLIN( 233) if (::hx::IsNull( capsJson )) {
+HXLINE( 233) _hx_tmp = null();
+ }
+ else {
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ ::snikket::Identity _hx_run( ::Dynamic i){
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_233_getChats)
+HXLINE( 233) return ::snikket::Identity_obj::__alloc( HX_CTX ,( (::String)(i->__Field(HX_("category",fe,2a,6c,ad),::hx::paccDynamic)) ),( (::String)(i->__Field(HX_("type",ba,f2,08,4d),::hx::paccDynamic)) ),( (::String)(i->__Field(HX_("name",4b,72,ff,48),::hx::paccDynamic)) ));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE( 233) ::String capsJson1 = ( (::String)(capsJson->__Field(HX_("node",02,0a,0a,49),::hx::paccDynamic)) );
+HXDLIN( 233) ::Array< ::Dynamic> _hx_tmp1 = ( (::Array< ::Dynamic>)( ::Dynamic(capsJson->__Field(HX_("identities",1c,c5,6d,d7),::hx::paccDynamic))->__Field(HX_("map",9c,0a,53,00),::hx::paccDynamic)( ::Dynamic(new _hx_Closure_0()))) );
+HXDLIN( 233) _hx_tmp = ::snikket::Caps_obj::__alloc( HX_CTX ,capsJson1,_hx_tmp1,( (::Array< ::String >)(capsJson->__Field(HX_("features",fd,6c,d7,12),::hx::paccDynamic)) ));
+ }
+HXDLIN( 233) row1->__SetField(HX_("capsObj",56,b6,8b,a6),_hx_tmp,::hx::paccDynamic);
+HXLINE( 234) ::Dynamic presenceJson = ::haxe::format::JsonParser_obj::__alloc( HX_CTX ,( (::String)(row1->__Field(HX_("presence",3b,52,d7,66),::hx::paccDynamic)) ))->doParse();
+HXLINE( 235) row1->__SetField(HX_("presenceJson",03,fa,cd,23),presenceJson,::hx::paccDynamic);
+HXLINE( 236) {
+HXLINE( 236) ::Dynamic access = presenceJson;
+HXDLIN( 236) ::Dynamic _g_access = access;
+HXDLIN( 236) ::Array< ::String > _g_keys = ::Reflect_obj::fields(access);
+HXDLIN( 236) int _g_index = 0;
+HXDLIN( 236) while((_g_index < _g_keys->length)){
+HXLINE( 236) _g_index = (_g_index + 1);
+HXDLIN( 236) ::String key = _g_keys->__get((_g_index - 1));
+HXDLIN( 236) ::Dynamic _g_value = ::Reflect_obj::field(_g_access,key);
+HXDLIN( 236) ::String _g_key = key;
+HXDLIN( 236) ::String resource = _g_key;
+HXDLIN( 236) ::Dynamic presence = _g_value;
+HXLINE( 237) if (( (bool)(presence->__Field(HX_("caps",21,1c,ba,41),::hx::paccDynamic)) )) {
+HXLINE( 237) ::Array< unsigned char > k = ::haxe::crypto::Base64_obj::decode(( (::String)(presence->__Field(HX_("caps",21,1c,ba,41),::hx::paccDynamic)) ),null())->b;
+HXDLIN( 237) fetchCaps->set(k,true);
+ }
+ }
+ }
+HXLINE( 239) chats->push(row1);
+ }
+ }
+HXLINE( 241) ::Array< ::Dynamic> fetchCapsSha1s = ::Lambda_obj::array( ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("iterator",ee,49,9a,93), ::Dynamic(new _hx_Closure_1(fetchCaps)))));
+HXLINE( 242) ::snikket::persistence::SqliteDriver _gthis1 = _gthis->db;
+HXLINE( 243) ::Array< ::String > result1 = ::Array_obj< ::String >::__new(fetchCapsSha1s->length);
+HXDLIN( 243) {
+HXLINE( 243) int _g = 0;
+HXDLIN( 243) int _g1 = fetchCapsSha1s->length;
+HXDLIN( 243) while((_g < _g1)){
+HXLINE( 243) _g = (_g + 1);
+HXDLIN( 243) int i = (_g - 1);
+HXDLIN( 243) {
+HXLINE( 243) ::Array< unsigned char > _ = ( (::Array< unsigned char >)(_hx_array_unsafe_get(fetchCapsSha1s,i)) );
+HXDLIN( 243) result1->__unsafe_set(i,HX_("?",3f,00,00,00));
+ }
+ }
+ }
+HXLINE( 242) return ::thenshim::_Promise::Promise_Impl__obj::then(_gthis1->exec(((HX_("SELECT sha1, json(caps) AS caps FROM caps WHERE sha1 IN (",5a,e4,9c,e2) + result1->join(HX_(",",2c,00,00,00))) + HX_(")",29,00,00,00)),fetchCapsSha1s), ::Dynamic(new _hx_Closure_2(chats)),null());
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_5, ::Dynamic,callback) HXARGC(1)
+ void _hx_run( ::Dynamic result){
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_246_getChats)
+HXLINE( 247) ::haxe::ds::StringMap capsMap = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXLINE( 248) {
+HXLINE( 248) ::Dynamic row = ::Dynamic(result->__Field(HX_("caps",21,1c,ba,41),::hx::paccDynamic));
+HXDLIN( 248) while(::sys::db::ResultSet_obj::hasNext(row)){
+HXLINE( 248) ::Dynamic row1 = ::sys::db::ResultSet_obj::next(row);
+HXLINE( 249) ::Dynamic json = ::haxe::format::JsonParser_obj::__alloc( HX_CTX ,( (::String)(row1->__Field(HX_("caps",21,1c,ba,41),::hx::paccDynamic)) ))->doParse();
+HXLINE( 250) {
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_4) HXARGC(1)
+ ::snikket::Identity _hx_run( ::Dynamic i){
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_250_getChats)
+HXLINE( 250) return ::snikket::Identity_obj::__alloc( HX_CTX ,( (::String)(i->__Field(HX_("category",fe,2a,6c,ad),::hx::paccDynamic)) ),( (::String)(i->__Field(HX_("type",ba,f2,08,4d),::hx::paccDynamic)) ),( (::String)(i->__Field(HX_("name",4b,72,ff,48),::hx::paccDynamic)) ));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE( 250) ::String k = ::haxe::crypto::Base64_obj::encode(::haxe::io::Bytes_obj::ofData(( (::Array< unsigned char >)(row1->__Field(HX_("sha1",85,c8,52,4c),::hx::paccDynamic)) )),null());
+HXDLIN( 250) ::String json1 = ( (::String)(json->__Field(HX_("node",02,0a,0a,49),::hx::paccDynamic)) );
+HXDLIN( 250) ::Array< ::Dynamic> v = ( (::Array< ::Dynamic>)( ::Dynamic(json->__Field(HX_("identities",1c,c5,6d,d7),::hx::paccDynamic))->__Field(HX_("map",9c,0a,53,00),::hx::paccDynamic)( ::Dynamic(new _hx_Closure_4()))) );
+HXDLIN( 250) ::snikket::Caps v1 = ::snikket::Caps_obj::__alloc( HX_CTX ,json1,v,( (::Array< ::String >)(json->__Field(HX_("features",fd,6c,d7,12),::hx::paccDynamic)) ));
+HXDLIN( 250) capsMap->set(k,v1);
+ }
+ }
+ }
+HXLINE( 252) ::Array< ::Dynamic> chats = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 253) {
+HXLINE( 253) int _g = 0;
+HXDLIN( 253) ::cpp::VirtualArray _g1 = ( (::cpp::VirtualArray)(result->__Field(HX_("chats",9b,9e,b3,45),::hx::paccDynamic)) );
+HXDLIN( 253) while((_g < _g1->get_length())){
+HXLINE( 253) ::Dynamic row2 = _g1->__get(_g);
+HXDLIN( 253) _g = (_g + 1);
+HXLINE( 254) ::haxe::ds::StringMap presenceMap = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXLINE( 255) ::Dynamic presenceJson = ::Dynamic(row2->__Field(HX_("presenceJson",03,fa,cd,23),::hx::paccDynamic));
+HXLINE( 256) {
+HXLINE( 256) ::Dynamic access = presenceJson;
+HXDLIN( 256) ::Dynamic _g_access = access;
+HXDLIN( 256) ::Array< ::String > _g_keys = ::Reflect_obj::fields(access);
+HXDLIN( 256) int _g_index = 0;
+HXDLIN( 256) while((_g_index < _g_keys->length)){
+HXLINE( 256) _g_index = (_g_index + 1);
+HXDLIN( 256) ::String key = _g_keys->__get((_g_index - 1));
+HXDLIN( 256) ::Dynamic _g_value = ::Reflect_obj::field(_g_access,key);
+HXDLIN( 256) ::String _g_key = key;
+HXDLIN( 256) ::String resource = _g_key;
+HXDLIN( 256) ::Dynamic presence = _g_value;
+HXLINE( 257) {
+HXLINE( 258) ::snikket::Caps v2;
+HXDLIN( 258) if (::hx::IsNull( presence->__Field(HX_("caps",21,1c,ba,41),::hx::paccDynamic) )) {
+HXLINE( 258) v2 = null();
+ }
+ else {
+HXLINE( 258) v2 = ( ( ::snikket::Caps)(capsMap->get(( (::String)(presence->__Field(HX_("caps",21,1c,ba,41),::hx::paccDynamic)) ))) );
+ }
+HXLINE( 259) ::snikket::Stanza v3;
+HXDLIN( 259) if (::hx::IsNull( presence->__Field(HX_("mucUser",e6,f3,96,b5),::hx::paccDynamic) )) {
+HXLINE( 259) v3 = null();
+ }
+ else {
+HXLINE( 259) v3 = ::snikket::Stanza_obj::parse(( (::String)(presence->__Field(HX_("mucUser",e6,f3,96,b5),::hx::paccDynamic)) ));
+ }
+HXLINE( 257) ::snikket::Presence v4 = ::snikket::Presence_obj::__alloc( HX_CTX ,v2,v3);
+HXDLIN( 257) presenceMap->set(resource,v4);
+ }
+ }
+ }
+HXLINE( 262) ::Dynamic row3 = ::Dynamic(row2->__Field(HX_("chat_id",22,ea,bd,d0),::hx::paccDynamic));
+HXDLIN( 262) bool _hx_tmp = ::hx::IsNotEq( row2->__Field(HX_("trusted",f7,b7,a6,16),::hx::paccDynamic),0 );
+HXDLIN( 262) ::Dynamic row4 = ::Dynamic(row2->__Field(HX_("avatar_sha1",ab,69,a3,a4),::hx::paccDynamic));
+HXDLIN( 262) ::Dynamic row5 = ::Dynamic(row2->__Field(HX_("fn",48,59,00,00),::hx::paccDynamic));
+HXDLIN( 262) ::Dynamic row6 = ::Dynamic(row2->__Field(HX_("ui_state",a6,9a,4e,b2),::hx::paccDynamic));
+HXDLIN( 262) bool _hx_tmp1 = ::hx::IsNotEq( row2->__Field(HX_("blocked",ec,7a,fe,44),::hx::paccDynamic),0 );
+HXDLIN( 262) ::Dynamic row7 = ::Dynamic(row2->__Field(HX_("extensions",14,7c,70,89),::hx::paccDynamic));
+HXDLIN( 262) ::Dynamic row8 = ::Dynamic(row2->__Field(HX_("read_up_to_id",84,60,ad,9e),::hx::paccDynamic));
+HXDLIN( 262) ::Dynamic row9 = ::Dynamic(row2->__Field(HX_("read_up_to_by",80,5a,ad,9e),::hx::paccDynamic));
+HXDLIN( 262) ::Dynamic _hx_tmp2;
+HXDLIN( 262) if (::hx::IsNull( row2->__Field(HX_("notifications_filtered",4e,91,57,51),::hx::paccDynamic) )) {
+HXLINE( 262) _hx_tmp2 = null();
+ }
+ else {
+HXLINE( 262) _hx_tmp2 = ::hx::IsNotEq( row2->__Field(HX_("notifications_filtered",4e,91,57,51),::hx::paccDynamic),0 );
+ }
+HXDLIN( 262) bool _hx_tmp3 = ::hx::IsNotEq( row2->__Field(HX_("notify_mention",34,44,26,d0),::hx::paccDynamic),0 );
+HXDLIN( 262) bool _hx_tmp4 = ::hx::IsNotEq( row2->__Field(HX_("notify_reply",f4,e7,df,1b),::hx::paccDynamic),0 );
+HXDLIN( 262) ::Dynamic row10 = ::Dynamic(row2->__Field(HX_("capsObj",56,b6,8b,a6),::hx::paccDynamic));
+HXDLIN( 262) chats->push( ::snikket::SerializedChat_obj::__alloc( HX_CTX ,( (::String)(row3) ),_hx_tmp,( (::Array< unsigned char >)(row4) ),presenceMap,( (::String)(row5) ),row6,_hx_tmp1,( (::String)(row7) ),( (::String)(row8) ),( (::String)(row9) ),_hx_tmp2,_hx_tmp3,_hx_tmp4,( ( ::snikket::Caps)(row10) ),( (::String)(::Reflect_obj::field(row2,HX_("class",38,78,58,48))) )));
+ }
+ }
+HXLINE( 264) callback(chats);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_224_getChats)
+HXDLIN( 224) ::snikket::persistence::Sqlite _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 225) ::thenshim::_Promise::Promise_Impl__obj::then(::thenshim::_Promise::Promise_Impl__obj::then(this->db->exec(HX_("SELECT chat_id, trusted, avatar_sha1, fn, ui_state, blocked, extensions, read_up_to_id, read_up_to_by, notifications_filtered, notify_mention, notify_reply, json(caps) AS caps, json(presence) AS presence, class FROM chats LEFT JOIN caps ON chats.caps_ver=caps.sha1 WHERE account_id=?",f9,ff,8c,f1),::cpp::VirtualArray_obj::__new(1)->init(0,accountId)), ::Dynamic(new _hx_Closure_3(_gthis)),null()), ::Dynamic(new _hx_Closure_5(callback)),null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Sqlite_obj,getChats,(void))
+
+void Sqlite_obj::storeMessages(::String accountId,::Array< ::Dynamic> messages, ::Dynamic callback){
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_0,::Array< ::Dynamic>,messages, ::snikket::persistence::Sqlite,_gthis,::String,accountId) HXARGC(1)
+ ::Dynamic _hx_run(::Dynamic _){
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_305_storeMessages)
+HXLINE( 305) ::snikket::persistence::SqliteDriver _gthis1 = _gthis->db;
+HXLINE( 306) ::Array< ::String > result = ::Array_obj< ::String >::__new(messages->length);
+HXDLIN( 306) {
+HXLINE( 306) int _g = 0;
+HXDLIN( 306) int _g1 = messages->length;
+HXDLIN( 306) while((_g < _g1)){
+HXLINE( 306) _g = (_g + 1);
+HXDLIN( 306) int i = (_g - 1);
+HXDLIN( 306) {
+HXLINE( 306) ::snikket::ChatMessage _1 = ( ( ::snikket::ChatMessage)(_hx_array_unsafe_get(messages,i)) );
+HXDLIN( 306) result->__unsafe_set(i,HX_("(?,?,?,?,?,?,?,?,CAST(unixepoch(?, 'subsec') * 1000 AS INTEGER),?,?,?,?)",56,f5,42,e0));
+ }
+ }
+ }
+HXDLIN( 306) ::String _hx_tmp = (HX_("INSERT OR REPLACE INTO messages VALUES ",28,32,a2,bc) + result->join(HX_(",",2c,00,00,00)));
+HXLINE( 307) ::Array< ::Dynamic> _g2 = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 307) {
+HXLINE( 307) int _g_current = 0;
+HXDLIN( 307) ::Array< ::Dynamic> _g_array = messages;
+HXDLIN( 307) while((_g_current < _g_array->length)){
+HXLINE( 307) _g_current = (_g_current + 1);
+HXDLIN( 307) ::snikket::ChatMessage x = _g_array->__get((_g_current - 1)).StaticCast< ::snikket::ChatMessage >();
+HXLINE( 308) ::snikket::ChatMessage correctable = x;
+HXLINE( 309) ::snikket::ChatMessage message;
+HXDLIN( 309) if ((x->versions->length == 1)) {
+HXLINE( 309) message = x->versions->__get(0).StaticCast< ::snikket::ChatMessage >();
+ }
+ else {
+HXLINE( 309) message = x;
+ }
+HXLINE( 311) ::String accountId1 = accountId;
+HXDLIN( 311) ::String _hx_tmp1;
+HXDLIN( 311) ::String tmp = message->serverId;
+HXDLIN( 311) if (::hx::IsNotNull( tmp )) {
+HXLINE( 311) _hx_tmp1 = tmp;
+ }
+ else {
+HXLINE( 311) _hx_tmp1 = HX_("",00,00,00,00);
+ }
+HXDLIN( 311) ::String _hx_tmp2;
+HXDLIN( 311) ::String tmp1 = message->serverIdBy;
+HXDLIN( 311) if (::hx::IsNotNull( tmp1 )) {
+HXLINE( 311) _hx_tmp2 = tmp1;
+ }
+ else {
+HXLINE( 311) _hx_tmp2 = HX_("",00,00,00,00);
+ }
+HXLINE( 312) ::String _hx_tmp3;
+HXDLIN( 312) ::String tmp2 = message->localId;
+HXDLIN( 312) if (::hx::IsNotNull( tmp2 )) {
+HXLINE( 312) _hx_tmp3 = tmp2;
+ }
+ else {
+HXLINE( 312) _hx_tmp3 = HX_("",00,00,00,00);
+ }
+HXDLIN( 312) ::String _hx_tmp4;
+HXDLIN( 312) ::String tmp3 = correctable->localId;
+HXDLIN( 312) if (::hx::IsNotNull( tmp3 )) {
+HXLINE( 312) _hx_tmp4 = tmp3;
+ }
+ else {
+HXLINE( 312) _hx_tmp4 = correctable->serverId;
+ }
+HXDLIN( 312) bool correctable1 = correctable->syncPoint;
+HXLINE( 313) ::String _hx_tmp5 = correctable->chatId();
+HXDLIN( 313) ::String correctable2 = correctable->senderId;
+HXLINE( 314) ::String message1 = message->timestamp;
+HXDLIN( 314) int message2 = message->status;
+HXDLIN( 314) int message3 = message->direction;
+HXDLIN( 314) int message4 = message->type;
+HXLINE( 307) _g2->push(::cpp::VirtualArray_obj::__new(13)->init(0,accountId1)->init(1,_hx_tmp1)->init(2,_hx_tmp2)->init(3,_hx_tmp3)->init(4,_hx_tmp4)->init(5,correctable1)->init(6,_hx_tmp5)->init(7,correctable2)->init(8,message1)->init(9,message2)->init(10,message3)->init(11,message4)->init(12,message->asStanza()->toString()));
+ }
+ }
+HXDLIN( 307) ::cpp::VirtualArray _g3 = ::cpp::VirtualArray_obj::__new(0);
+HXDLIN( 307) {
+HXLINE( 307) ::Dynamic e = _g2->__Field(HX_("iterator",ee,49,9a,93),::hx::paccDynamic)();
+HXDLIN( 307) while(( (bool)(e->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 307) ::Dynamic e1 = e->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)();
+HXDLIN( 307) {
+HXLINE( 307) ::Dynamic x1 = e1->__Field(HX_("iterator",ee,49,9a,93),::hx::paccDynamic)();
+HXDLIN( 307) while(( (bool)(x1->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 307) ::Dynamic x2 = x1->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)();
+HXDLIN( 307) _g3->push(x2);
+ }
+ }
+ }
+ }
+HXLINE( 305) return _gthis1->exec(_hx_tmp,_g3);
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S5(::hx::LocalFunc,_hx_Closure_2,::Array< ::Dynamic>,messages, ::snikket::persistence::Sqlite,_gthis,::Array< ::Dynamic>,replyTos,::String,accountId, ::Dynamic,callback) HXARGC(1)
+ ::Dynamic _hx_run(::Dynamic _){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_1, ::snikket::persistence::Sqlite,_gthis,::String,accountId) HXARGC(1)
+ ::Dynamic _hx_run(::Array< ::Dynamic> ms){
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_320_storeMessages)
+HXLINE( 320) return _gthis->hydrateReactions(accountId,ms);
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_319_storeMessages)
+HXLINE( 320) ::Dynamic _hx_tmp = ::thenshim::_Promise::Promise_Impl__obj::then(_gthis->hydrateReplyTo(accountId,messages,replyTos), ::Dynamic(new _hx_Closure_1(_gthis,accountId)),null());
+HXLINE( 319) return ::thenshim::_Promise::Promise_Impl__obj::then(_hx_tmp,callback,null());
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_269_storeMessages)
+HXDLIN( 269) ::snikket::persistence::Sqlite _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 270) if ((messages->length < 1)) {
+HXLINE( 271) callback(messages);
+HXLINE( 272) return;
+ }
+HXLINE( 275) ::Array< ::String > chatIds = ::Array_obj< ::String >::__new(0);
+HXLINE( 276) ::Array< ::String > localIds = ::Array_obj< ::String >::__new(0);
+HXLINE( 277) ::Array< ::Dynamic> replyTos = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 278) {
+HXLINE( 278) int _g = 0;
+HXDLIN( 278) while((_g < messages->length)){
+HXLINE( 278) ::snikket::ChatMessage message = messages->__get(_g).StaticCast< ::snikket::ChatMessage >();
+HXDLIN( 278) _g = (_g + 1);
+HXLINE( 279) bool _hx_tmp;
+HXDLIN( 279) if (::hx::IsNull( message->serverId )) {
+HXLINE( 279) _hx_tmp = ::hx::IsNull( message->localId );
+ }
+ else {
+HXLINE( 279) _hx_tmp = false;
+ }
+HXDLIN( 279) if (_hx_tmp) {
+HXLINE( 279) HX_STACK_DO_THROW(HX_("Cannot store a message with no id",54,e5,b0,de));
+ }
+HXLINE( 280) bool _hx_tmp1;
+HXDLIN( 280) if (::hx::IsNull( message->serverId )) {
+HXLINE( 280) _hx_tmp1 = message->isIncoming();
+ }
+ else {
+HXLINE( 280) _hx_tmp1 = false;
+ }
+HXDLIN( 280) if (_hx_tmp1) {
+HXLINE( 280) HX_STACK_DO_THROW(HX_("Cannot store an incoming message with no server id",d7,6d,19,fb));
+ }
+HXLINE( 281) bool _hx_tmp2;
+HXDLIN( 281) if (::hx::IsNotNull( message->serverId )) {
+HXLINE( 281) _hx_tmp2 = ::hx::IsNull( message->serverIdBy );
+ }
+ else {
+HXLINE( 281) _hx_tmp2 = false;
+ }
+HXDLIN( 281) if (_hx_tmp2) {
+HXLINE( 281) HX_STACK_DO_THROW(HX_("Cannot store a message with a server id and no by",00,9f,b7,38));
+ }
+HXLINE( 283) bool _hx_tmp3;
+HXDLIN( 283) if (!(message->isIncoming())) {
+HXLINE( 283) _hx_tmp3 = (message->versions->length < 1);
+ }
+ else {
+HXLINE( 283) _hx_tmp3 = false;
+ }
+HXDLIN( 283) if (_hx_tmp3) {
+HXLINE( 286) chatIds->push(message->chatId());
+HXLINE( 287) localIds->push(message->localId);
+ }
+HXLINE( 289) bool _hx_tmp4;
+HXDLIN( 289) if (::hx::IsNotNull( message->replyToMessage )) {
+HXLINE( 289) _hx_tmp4 = ::hx::IsNull( message->replyToMessage->serverIdBy );
+ }
+ else {
+HXLINE( 289) _hx_tmp4 = false;
+ }
+HXDLIN( 289) if (_hx_tmp4) {
+HXLINE( 290) ::Array< ::Dynamic> replyTos1 = replyTos;
+HXDLIN( 290) ::String _hx_tmp5 = message->chatId();
+HXDLIN( 290) replyTos1->push( ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("chatId",d3,04,77,b7),_hx_tmp5)
+ ->setFixed(1,HX_("serverId",7e,01,b2,e2),message->replyToMessage->serverId)
+ ->setFixed(2,HX_("localId",26,7a,c6,2d),message->replyToMessage->localId)));
+ }
+ }
+ }
+HXLINE( 294) ::Dynamic _hx_tmp6;
+HXDLIN( 294) bool _hx_tmp7;
+HXDLIN( 294) if ((chatIds->length > 0)) {
+HXLINE( 294) _hx_tmp7 = (localIds->length > 0);
+ }
+ else {
+HXLINE( 294) _hx_tmp7 = false;
+ }
+HXDLIN( 294) if (_hx_tmp7) {
+HXLINE( 295) ::StringBuf q = ::StringBuf_obj::__alloc( HX_CTX );
+HXLINE( 296) {
+HXLINE( 296) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 296) q->flush();
+ }
+HXDLIN( 296) if (::hx::IsNull( q->b )) {
+HXLINE( 296) q->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_51,1);
+ }
+ else {
+HXLINE( 296) q->b->push(HX_("DELETE FROM messages WHERE account_id=? AND direction=? AND chat_id IN (",a1,9c,a2,06));
+ }
+ }
+HXLINE( 297) {
+HXLINE( 297) ::Array< ::String > result = ::Array_obj< ::String >::__new(chatIds->length);
+HXDLIN( 297) {
+HXLINE( 297) int _g1 = 0;
+HXDLIN( 297) int _g2 = chatIds->length;
+HXDLIN( 297) while((_g1 < _g2)){
+HXLINE( 297) _g1 = (_g1 + 1);
+HXDLIN( 297) int i = (_g1 - 1);
+HXDLIN( 297) {
+HXLINE( 297) ::String _ = ( (::String)(_hx_array_unsafe_get(chatIds,i)) );
+HXDLIN( 297) result->__unsafe_set(i,HX_("?",3f,00,00,00));
+ }
+ }
+ }
+HXDLIN( 297) ::String x = result->join(HX_(",",2c,00,00,00));
+HXDLIN( 297) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 297) q->flush();
+ }
+HXDLIN( 297) if (::hx::IsNull( q->b )) {
+HXLINE( 297) q->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x));
+ }
+ else {
+HXLINE( 297) ::Array< ::String > q1 = q->b;
+HXDLIN( 297) q1->push(::Std_obj::string(x));
+ }
+ }
+HXLINE( 298) {
+HXLINE( 298) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 298) q->flush();
+ }
+HXDLIN( 298) if (::hx::IsNull( q->b )) {
+HXLINE( 298) q->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_52,1);
+ }
+ else {
+HXLINE( 298) q->b->push(HX_(") AND stanza_id IN (",e8,da,d3,eb));
+ }
+ }
+HXLINE( 299) {
+HXLINE( 299) ::Array< ::String > result1 = ::Array_obj< ::String >::__new(localIds->length);
+HXDLIN( 299) {
+HXLINE( 299) int _g3 = 0;
+HXDLIN( 299) int _g4 = localIds->length;
+HXDLIN( 299) while((_g3 < _g4)){
+HXLINE( 299) _g3 = (_g3 + 1);
+HXDLIN( 299) int i1 = (_g3 - 1);
+HXDLIN( 299) {
+HXLINE( 299) ::String _1 = ( (::String)(_hx_array_unsafe_get(localIds,i1)) );
+HXDLIN( 299) result1->__unsafe_set(i1,HX_("?",3f,00,00,00));
+ }
+ }
+ }
+HXDLIN( 299) ::String x1 = result1->join(HX_(",",2c,00,00,00));
+HXDLIN( 299) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 299) q->flush();
+ }
+HXDLIN( 299) if (::hx::IsNull( q->b )) {
+HXLINE( 299) q->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x1));
+ }
+ else {
+HXLINE( 299) ::Array< ::String > q2 = q->b;
+HXDLIN( 299) q2->push(::Std_obj::string(x1));
+ }
+ }
+HXLINE( 300) {
+HXLINE( 300) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 300) q->flush();
+ }
+HXDLIN( 300) if (::hx::IsNull( q->b )) {
+HXLINE( 300) q->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_53,1);
+ }
+ else {
+HXLINE( 300) q->b->push(HX_(")",29,00,00,00));
+ }
+ }
+HXLINE( 301) ::snikket::persistence::SqliteDriver _hx_tmp8 = this->db;
+HXDLIN( 301) ::String _hx_tmp9 = q->toString();
+HXLINE( 294) _hx_tmp6 = _hx_tmp8->exec(_hx_tmp9,::cpp::VirtualArray_obj::__new(2)->init(0,accountId)->init(1,1)->concat(chatIds)->concat(localIds));
+ }
+ else {
+HXLINE( 294) _hx_tmp6 = ::thenshim::_Promise::Promise_Impl__obj::resolve(null());
+ }
+HXDLIN( 294) ::thenshim::_Promise::Promise_Impl__obj::then(::thenshim::_Promise::Promise_Impl__obj::then(_hx_tmp6, ::Dynamic(new _hx_Closure_0(messages,_gthis,accountId)),null()), ::Dynamic(new _hx_Closure_2(messages,_gthis,replyTos,accountId,callback)),null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Sqlite_obj,storeMessages,(void))
+
+void Sqlite_obj::updateMessage(::String accountId, ::snikket::ChatMessage message){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> _){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_328_updateMessage)
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_328_updateMessage)
+HXDLIN( 328) this->storeMessages(accountId,::Array_obj< ::Dynamic>::__new(1)->init(0,message), ::Dynamic(new _hx_Closure_0()));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Sqlite_obj,updateMessage,(void))
+
+void Sqlite_obj::getMessage(::String accountId,::String chatId,::String serverId,::String localId, ::Dynamic callback){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0, ::snikket::persistence::Sqlite,_gthis,::String,accountId) HXARGC(1)
+ ::Array< ::Dynamic> _hx_run(::Dynamic result){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_342_getMessage)
+HXLINE( 342) return _gthis->hydrateMessages(accountId,result);
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S4(::hx::LocalFunc,_hx_Closure_3, ::snikket::persistence::Sqlite,_gthis,::String,chatId,::String,accountId, ::Dynamic,callback) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> messages){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_342_getMessage)
+HXLINE( 343) {
+HXLINE( 343) int _g = 0;
+HXDLIN( 343) while((_g < messages->length)){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_1, ::snikket::persistence::Sqlite,_gthis,::String,accountId) HXARGC(1)
+ ::Dynamic _hx_run(::Array< ::Dynamic> messages){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_348_getMessage)
+HXLINE( 348) return _gthis->hydrateReactions(accountId,messages);
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_2, ::Dynamic,callback) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> hydrated){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_348_getMessage)
+HXLINE( 348) callback(hydrated->__get(0).StaticCast< ::snikket::ChatMessage >());
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE( 343) ::snikket::ChatMessage message = messages->__get(_g).StaticCast< ::snikket::ChatMessage >();
+HXDLIN( 343) _g = (_g + 1);
+HXLINE( 344) ::Dynamic _hx_tmp;
+HXDLIN( 344) if (::hx::IsNotNull( message->replyToMessage )) {
+HXLINE( 344) _hx_tmp = _gthis->hydrateReplyTo(accountId,::Array_obj< ::Dynamic>::__new(1)->init(0,message),::Array_obj< ::Dynamic>::__new(1)->init(0, ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("chatId",d3,04,77,b7),chatId)
+ ->setFixed(1,HX_("serverId",7e,01,b2,e2),message->replyToMessage->serverId)
+ ->setFixed(2,HX_("localId",26,7a,c6,2d),message->replyToMessage->localId))));
+ }
+ else {
+HXLINE( 344) _hx_tmp = ::thenshim::_Promise::Promise_Impl__obj::resolve(::Array_obj< ::Dynamic>::__new(1)->init(0,message));
+ }
+HXDLIN( 344) ::thenshim::_Promise::Promise_Impl__obj::then(::thenshim::_Promise::Promise_Impl__obj::then(_hx_tmp, ::Dynamic(new _hx_Closure_1(_gthis,accountId)),null()), ::Dynamic(new _hx_Closure_2(callback)),null());
+HXLINE( 349) return;
+ }
+ }
+HXLINE( 351) callback(null());
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_331_getMessage)
+HXDLIN( 331) ::snikket::persistence::Sqlite _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 332) ::String q = HX_("SELECT stanza, direction, type, strftime('%FT%H:%M:%fZ', created_at / 1000.0, 'unixepoch') AS timestamp, sender_id, mam_id, mam_by, sync_point FROM messages WHERE account_id=? AND chat_id=?",55,9b,7b,94);
+HXLINE( 333) ::Array< ::String > params = ::Array_obj< ::String >::__new(2)->init(0,accountId)->init(1,chatId);
+HXLINE( 334) if (::hx::IsNotNull( serverId )) {
+HXLINE( 335) q = (q + HX_(" AND mam_id=?",4c,af,2b,c9));
+HXLINE( 336) params->push(serverId);
+ }
+ else {
+HXLINE( 337) if (::hx::IsNotNull( localId )) {
+HXLINE( 338) q = (q + HX_(" AND stanza_id=?",be,a8,32,e3));
+HXLINE( 339) params->push(localId);
+ }
+ }
+HXLINE( 341) q = (q + HX_("LIMIT 1",ec,af,c7,0e));
+HXLINE( 342) ::thenshim::_Promise::Promise_Impl__obj::then(::thenshim::_Promise::Promise_Impl__obj::then(this->db->exec(q,params), ::Dynamic(new _hx_Closure_0(_gthis,accountId)),null()), ::Dynamic(new _hx_Closure_3(_gthis,chatId,accountId,callback)),null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC5(Sqlite_obj,getMessage,(void))
+
+void Sqlite_obj::getMessage__fromC(::String accountId,::String chatId,::String serverId,::String localId,::cpp::Function< void (void*,void*) > callback,void* callback__context){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0,void*,callback__context,::cpp::Function< void (void* HX_COMMA void*) >,callback) HXARGC(1)
+ void _hx_run( ::snikket::ChatMessage a0){
+ HX_GC_STACKFRAME(&_hx_pos_45dcb523da764b50_221_getMessage__fromC)
+HXLINE( 221) ::cpp::Function< void (void*,void*) > callback1 = callback;
+HXLINE( 215) ::Dynamic haxeObject = a0;
+HXDLIN( 215) void* ptr = haxeObject.mPtr;
+HXDLIN( 215) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(ptr);
+HXDLIN( 215) {
+HXLINE( 215) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 215) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 215) int high = ptrInt64 >> 32;
+HXDLIN( 215) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 215) if (::hx::IsNull( highMap )) {
+HXLINE( 215) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXDLIN( 215) this1->set(low,highMap);
+ }
+HXDLIN( 215) highMap->set(high,haxeObject);
+ }
+HXLINE( 221) callback1(ptr,callback__context);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_45dcb523da764b50_244_getMessage__fromC)
+HXDLIN( 244) this->getMessage(accountId,chatId,serverId,localId, ::Dynamic(new _hx_Closure_0(callback__context,callback)));
+ }
+
+
+::Dynamic Sqlite_obj::getMessages(::String accountId,::String chatId,::String time,::String op){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0, ::snikket::persistence::Sqlite,_gthis,::String,accountId) HXARGC(1)
+ ::Array< ::Dynamic> _hx_run(::Dynamic result){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_380_getMessages)
+HXLINE( 380) return _gthis->hydrateMessages(accountId,result);
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_1, ::snikket::persistence::Sqlite,_gthis,::String,op,::String,accountId) HXARGC(1)
+ ::Dynamic _hx_run(::Array< ::Dynamic> iter){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_380_getMessages)
+HXLINE( 381) ::Array< ::Dynamic> arr = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 382) ::Array< ::Dynamic> replyTos = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 383) {
+HXLINE( 383) int _g = 0;
+HXDLIN( 383) while((_g < iter->length)){
+HXLINE( 383) ::snikket::ChatMessage message = iter->__get(_g).StaticCast< ::snikket::ChatMessage >();
+HXDLIN( 383) _g = (_g + 1);
+HXLINE( 384) arr->push(message);
+HXLINE( 385) bool _hx_tmp;
+HXDLIN( 385) if (::hx::IsNotNull( message->replyToMessage )) {
+HXLINE( 385) _hx_tmp = ::hx::IsNull( message->replyToMessage->serverIdBy );
+ }
+ else {
+HXLINE( 385) _hx_tmp = false;
+ }
+HXDLIN( 385) if (_hx_tmp) {
+HXLINE( 386) ::String _hx_tmp1 = message->chatId();
+HXDLIN( 386) replyTos->push( ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("chatId",d3,04,77,b7),_hx_tmp1)
+ ->setFixed(1,HX_("serverId",7e,01,b2,e2),message->replyToMessage->serverId)
+ ->setFixed(2,HX_("localId",26,7a,c6,2d),message->replyToMessage->localId)));
+ }
+ }
+ }
+HXLINE( 389) bool _hx_tmp2;
+HXDLIN( 389) if ((op != HX_("<",3c,00,00,00))) {
+HXLINE( 389) _hx_tmp2 = (op == HX_("<=",81,34,00,00));
+ }
+ else {
+HXLINE( 389) _hx_tmp2 = true;
+ }
+HXDLIN( 389) if (_hx_tmp2) {
+HXLINE( 390) arr->reverse();
+ }
+HXLINE( 392) return _gthis->hydrateReplyTo(accountId,arr,replyTos);
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_2, ::snikket::persistence::Sqlite,_gthis,::String,accountId) HXARGC(1)
+ ::Dynamic _hx_run(::Array< ::Dynamic> messages){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_393_getMessages)
+HXLINE( 393) return _gthis->hydrateReactions(accountId,messages);
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_355_getMessages)
+HXDLIN( 355) ::snikket::persistence::Sqlite _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 356) ::String q = HX_("SELECT\n\t\t\tcorrection_id AS stanza_id,\n\t\t\tversions.stanza,\n\t\t\tjson_group_object(CASE WHEN versions.mam_id IS NULL OR versions.mam_id='' THEN versions.stanza_id ELSE versions.mam_id END, strftime('%FT%H:%M:%fZ', versions.created_at / 1000.0, 'unixepoch')) AS version_times,\n\t\t\tjson_group_object(CASE WHEN versions.mam_id IS NULL OR versions.mam_id='' THEN versions.stanza_id ELSE versions.mam_id END, versions.stanza) AS versions,\n\t\t\tmessages.direction,\n\t\t\tmessages.type,\n\t\t\tstrftime('%FT%H:%M:%fZ', messages.created_at / 1000.0, 'unixepoch') AS timestamp,\n\t\t\tmessages.sender_id,\n\t\t\tmessages.mam_id,\n\t\t\tmessages.mam_by,\n\t\t\tmessages.sync_point,\n\t\t\tMAX(versions.created_at)\n\t\t\tFROM messages INNER JOIN messages versions USING (correction_id) WHERE (messages.stanza_id IS NULL OR messages.stanza_id='' OR messages.stanza_id=correction_id) AND messages.account_id=? AND messages.chat_id=?",fa,a3,84,17);
+HXLINE( 370) ::Array< ::String > params = ::Array_obj< ::String >::__new(2)->init(0,accountId)->init(1,chatId);
+HXLINE( 371) if (::hx::IsNotNull( time )) {
+HXLINE( 372) q = (q + ((HX_(" AND messages.created_at ",3d,a0,ae,bb) + op) + HX_("CAST(unixepoch(?, 'subsec') * 1000 AS INTEGER)",17,de,5d,f8)));
+HXLINE( 373) params->push(time);
+ }
+HXLINE( 375) q = (q + HX_(" GROUP BY correction_id ORDER BY messages.created_at",81,73,dc,54));
+HXLINE( 376) bool _hx_tmp;
+HXDLIN( 376) if ((op != HX_("<",3c,00,00,00))) {
+HXLINE( 376) _hx_tmp = (op == HX_("<=",81,34,00,00));
+ }
+ else {
+HXLINE( 376) _hx_tmp = true;
+ }
+HXDLIN( 376) if (_hx_tmp) {
+HXLINE( 376) q = (q + HX_(" DESC",71,b6,f9,99));
+ }
+HXLINE( 377) q = (q + HX_(", messages.ROWID",a7,cc,85,7b));
+HXLINE( 378) bool _hx_tmp1;
+HXDLIN( 378) if ((op != HX_("<",3c,00,00,00))) {
+HXLINE( 378) _hx_tmp1 = (op == HX_("<=",81,34,00,00));
+ }
+ else {
+HXLINE( 378) _hx_tmp1 = true;
+ }
+HXDLIN( 378) if (_hx_tmp1) {
+HXLINE( 378) q = (q + HX_(" DESC",71,b6,f9,99));
+ }
+HXLINE( 379) q = (q + HX_(" LIMIT 50",60,62,1f,3e));
+HXLINE( 380) return ::thenshim::_Promise::Promise_Impl__obj::then(::thenshim::_Promise::Promise_Impl__obj::then(::thenshim::_Promise::Promise_Impl__obj::then(this->db->exec(q,params), ::Dynamic(new _hx_Closure_0(_gthis,accountId)),null()), ::Dynamic(new _hx_Closure_1(_gthis,op,accountId)),null()), ::Dynamic(new _hx_Closure_2(_gthis,accountId)),null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC4(Sqlite_obj,getMessages,return )
+
+void Sqlite_obj::getMessagesBefore(::String accountId,::String chatId,::String beforeId,::String beforeTime, ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_398_getMessagesBefore)
+HXDLIN( 398) ::thenshim::_Promise::Promise_Impl__obj::then(this->getMessages(accountId,chatId,beforeTime,HX_("<",3c,00,00,00)),callback,null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC5(Sqlite_obj,getMessagesBefore,(void))
+
+void Sqlite_obj::getMessagesAfter(::String accountId,::String chatId,::String afterId,::String afterTime, ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_403_getMessagesAfter)
+HXDLIN( 403) ::thenshim::_Promise::Promise_Impl__obj::then(this->getMessages(accountId,chatId,afterTime,HX_(">",3e,00,00,00)),callback,null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC5(Sqlite_obj,getMessagesAfter,(void))
+
+void Sqlite_obj::getMessagesAround(::String accountId,::String chatId,::String aroundId,::String aroundTime, ::Dynamic callback){
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_4, ::snikket::persistence::Sqlite,_gthis,::String,chatId,::String,accountId) HXARGC(1)
+ ::Dynamic _hx_run(::String aroundTime){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_419_getMessagesAround)
+HXLINE( 420) ::Dynamic _hx_tmp = _gthis->getMessages(accountId,chatId,aroundTime,HX_("<",3c,00,00,00));
+HXLINE( 419) return ::thenshim::PromiseTools_obj::all(::Array_obj< ::Dynamic>::__new(2)->init(0,_hx_tmp)->init(1,_gthis->getMessages(accountId,chatId,aroundTime,HX_(">=",3f,36,00,00))));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_5, ::Dynamic,callback) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> results){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_424_getMessagesAround)
+HXLINE( 424) ::Dynamic callback1 = callback;
+HXDLIN( 424) ::Array< ::Dynamic> _g = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 424) {
+HXLINE( 424) int _g_current = 0;
+HXDLIN( 424) ::Array< ::Dynamic> _g_array = results;
+HXDLIN( 424) while((_g_current < _g_array->length)){
+HXLINE( 424) _g_current = (_g_current + 1);
+HXDLIN( 424) ::Array< ::Dynamic> x = _g_array->__get((_g_current - 1)).StaticCast< ::Array< ::Dynamic> >();
+HXDLIN( 424) _g->push(x);
+ }
+ }
+HXDLIN( 424) ::Array< ::Dynamic> _g1 = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 424) {
+HXLINE( 424) ::Dynamic e = _g->__Field(HX_("iterator",ee,49,9a,93),::hx::paccDynamic)();
+HXDLIN( 424) while(( (bool)(e->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 424) ::Dynamic e1 = e->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)();
+HXDLIN( 424) {
+HXLINE( 424) ::Dynamic x1 = e1->__Field(HX_("iterator",ee,49,9a,93),::hx::paccDynamic)();
+HXDLIN( 424) while(( (bool)(x1->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 424) ::snikket::ChatMessage x2 = ( ( ::snikket::ChatMessage)(x1->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXDLIN( 424) _g1->push(x2);
+ }
+ }
+ }
+ }
+HXDLIN( 424) callback1(_g1);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_407_getMessagesAround)
+HXDLIN( 407) ::snikket::persistence::Sqlite _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 408) ::Dynamic _hx_tmp;
+HXDLIN( 408) if (::hx::IsNull( aroundTime )) {
+ HX_BEGIN_LOCAL_FUNC_S4(::hx::LocalFunc,_hx_Closure_0, ::snikket::persistence::Sqlite,_gthis,::String,chatId,::String,aroundId,::String,accountId) HXARGC(2)
+ void _hx_run( ::Dynamic resolve, ::Dynamic reject){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_409_getMessagesAround)
+HXLINE( 409) _gthis->getMessage(accountId,chatId,aroundId,null(),resolve);
+ }
+ HX_END_LOCAL_FUNC2((void))
+
+ HX_BEGIN_LOCAL_FUNC_S4(::hx::LocalFunc,_hx_Closure_3, ::snikket::persistence::Sqlite,_gthis,::String,chatId,::String,aroundId,::String,accountId) HXARGC(1)
+ ::Dynamic _hx_run( ::snikket::ChatMessage m){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_410_getMessagesAround)
+HXLINE( 410) if (::hx::IsNotNull( m )) {
+HXLINE( 411) return ::thenshim::_Promise::Promise_Impl__obj::resolve(m->timestamp);
+ }
+ else {
+ HX_BEGIN_LOCAL_FUNC_S4(::hx::LocalFunc,_hx_Closure_1, ::snikket::persistence::Sqlite,_gthis,::String,chatId,::String,aroundId,::String,accountId) HXARGC(2)
+ void _hx_run( ::Dynamic resolve, ::Dynamic reject){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_413_getMessagesAround)
+HXLINE( 413) _gthis->getMessage(accountId,chatId,null(),aroundId,resolve);
+ }
+ HX_END_LOCAL_FUNC2((void))
+
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_2) HXARGC(1)
+ ::String _hx_run( ::snikket::ChatMessage m){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_413_getMessagesAround)
+HXLINE( 413) if (::hx::IsNotNull( m )) {
+HXLINE( 413) return m->timestamp;
+ }
+ else {
+HXLINE( 413) return null();
+ }
+HXDLIN( 413) return null();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE( 413) return ::thenshim::_Promise::Promise_Impl__obj::then(::thenshim::_Promise::Promise_Impl__obj::_new( ::Dynamic(new _hx_Closure_1(_gthis,chatId,aroundId,accountId))), ::Dynamic(new _hx_Closure_2()),null());
+ }
+HXLINE( 410) return null();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE( 408) _hx_tmp = ::thenshim::_Promise::Promise_Impl__obj::then(::thenshim::_Promise::Promise_Impl__obj::_new( ::Dynamic(new _hx_Closure_0(_gthis,chatId,aroundId,accountId))), ::Dynamic(new _hx_Closure_3(_gthis,chatId,aroundId,accountId)),null());
+ }
+ else {
+HXLINE( 408) _hx_tmp = ::thenshim::_Promise::Promise_Impl__obj::resolve(aroundTime);
+ }
+HXDLIN( 408) ::thenshim::_Promise::Promise_Impl__obj::then(::thenshim::_Promise::Promise_Impl__obj::then(_hx_tmp, ::Dynamic(new _hx_Closure_4(_gthis,chatId,accountId)),null()), ::Dynamic(new _hx_Closure_5(callback)),null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC5(Sqlite_obj,getMessagesAround,(void))
+
+void Sqlite_obj::getChatsUnreadDetails(::String accountId,::Array< ::Dynamic> chats, ::Dynamic callback){
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_2, ::snikket::persistence::Sqlite,_gthis,::String,accountId, ::Dynamic,callback) HXARGC(1)
+ ::Dynamic _hx_run(::Dynamic result){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0,::Dynamic,result) HXARGC(0)
+ ::Dynamic _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_471_getChatsUnreadDetails)
+HXLINE( 471) return result;
+ }
+ HX_END_LOCAL_FUNC0(return)
+
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_1,::cpp::VirtualArray,rows,::Array< ::Dynamic>,details, ::Dynamic,callback) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> messages){
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_472_getChatsUnreadDetails)
+HXLINE( 473) {
+HXLINE( 473) int _g_current = 0;
+HXDLIN( 473) ::Array< ::Dynamic> _g_array = messages;
+HXDLIN( 473) while((_g_current < _g_array->length)){
+HXLINE( 473) ::snikket::ChatMessage _g_value = _g_array->__get(_g_current).StaticCast< ::snikket::ChatMessage >();
+HXDLIN( 473) _g_current = (_g_current + 1);
+HXDLIN( 473) int _g_key = (_g_current - 1);
+HXDLIN( 473) int i = _g_key;
+HXDLIN( 473) ::snikket::ChatMessage m = _g_value;
+HXLINE( 474) details->push( ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("message",c7,35,11,9a),m)
+ ->setFixed(1,HX_("unreadCount",20,18,f1,a0), ::Dynamic(rows->__get(i)->__Field(HX_("unreadCount",20,18,f1,a0),::hx::paccDynamic)))
+ ->setFixed(2,HX_("chatId",d3,04,77,b7), ::Dynamic(rows->__get(i)->__Field(HX_("chatId",d3,04,77,b7),::hx::paccDynamic)))));
+ }
+ }
+HXLINE( 480) callback(details);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_469_getChatsUnreadDetails)
+HXLINE( 470) ::Array< ::Dynamic> details = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 471) ::cpp::VirtualArray rows = ::Lambda_obj::array( ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("iterator",ee,49,9a,93), ::Dynamic(new _hx_Closure_0(result)))));
+HXLINE( 472) ::snikket::persistence::Sqlite _gthis1 = _gthis;
+HXDLIN( 472) ::String accountId1 = accountId;
+HXDLIN( 472) return ::thenshim::_Promise::Promise_Impl__obj::then(::thenshim::_Promise::Promise_Impl__obj::resolve(_gthis1->hydrateMessages(accountId1, ::haxe::iterators::ArrayIterator_obj::__alloc( HX_CTX ,rows))), ::Dynamic(new _hx_Closure_1(rows,details,callback)),null());
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_429_getChatsUnreadDetails)
+HXDLIN( 429) ::snikket::persistence::Sqlite _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 430) bool _hx_tmp;
+HXDLIN( 430) if (::hx::IsNotNull( chats )) {
+HXLINE( 430) _hx_tmp = (chats->length < 1);
+ }
+ else {
+HXLINE( 430) _hx_tmp = true;
+ }
+HXDLIN( 430) if (_hx_tmp) {
+HXLINE( 431) callback(::Array_obj< ::Dynamic>::__new(0));
+HXLINE( 432) return;
+ }
+HXLINE( 435) ::cpp::VirtualArray params = ::cpp::VirtualArray_obj::__new(1)->init(0,accountId);
+HXLINE( 437) ::StringBuf subq = ::StringBuf_obj::__alloc( HX_CTX );
+HXLINE( 438) {
+HXLINE( 438) if (::hx::IsNotNull( subq->charBuf )) {
+HXLINE( 438) subq->flush();
+ }
+HXDLIN( 438) if (::hx::IsNull( subq->b )) {
+HXLINE( 438) subq->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_89,1);
+ }
+ else {
+HXLINE( 438) subq->b->push(HX_("SELECT chat_id, ROWID as row, MAX(created_at) AS created_at FROM messages WHERE account_id=?",d0,69,08,92));
+ }
+ }
+HXLINE( 439) {
+HXLINE( 439) if (::hx::IsNotNull( subq->charBuf )) {
+HXLINE( 439) subq->flush();
+ }
+HXDLIN( 439) if (::hx::IsNull( subq->b )) {
+HXLINE( 439) subq->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_90,1);
+ }
+ else {
+HXLINE( 439) subq->b->push(HX_(" AND chat_id IN (",14,bd,7b,de));
+ }
+ }
+HXLINE( 440) {
+HXLINE( 440) int _g_current = 0;
+HXDLIN( 440) ::Array< ::Dynamic> _g_array = chats;
+HXDLIN( 440) while((_g_current < _g_array->length)){
+HXLINE( 440) ::snikket::Chat _g_value = _g_array->__get(_g_current).StaticCast< ::snikket::Chat >();
+HXDLIN( 440) _g_current = (_g_current + 1);
+HXDLIN( 440) int _g_key = (_g_current - 1);
+HXDLIN( 440) int i = _g_key;
+HXDLIN( 440) ::snikket::Chat chat = _g_value;
+HXDLIN( 440) {
+HXLINE( 441) if ((i != 0)) {
+HXLINE( 441) if (::hx::IsNotNull( subq->charBuf )) {
+HXLINE( 441) subq->flush();
+ }
+HXDLIN( 441) if (::hx::IsNull( subq->b )) {
+HXLINE( 441) subq->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_91,1);
+ }
+ else {
+HXLINE( 441) subq->b->push(HX_(",",2c,00,00,00));
+ }
+ }
+HXLINE( 442) {
+HXLINE( 442) if (::hx::IsNotNull( subq->charBuf )) {
+HXLINE( 442) subq->flush();
+ }
+HXDLIN( 442) if (::hx::IsNull( subq->b )) {
+HXLINE( 442) subq->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_92,1);
+ }
+ else {
+HXLINE( 442) subq->b->push(HX_("?",3f,00,00,00));
+ }
+ }
+HXLINE( 443) params->push(chat->chatId);
+ }
+ }
+ }
+HXLINE( 445) {
+HXLINE( 445) if (::hx::IsNotNull( subq->charBuf )) {
+HXLINE( 445) subq->flush();
+ }
+HXDLIN( 445) if (::hx::IsNull( subq->b )) {
+HXLINE( 445) subq->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_93,1);
+ }
+ else {
+HXLINE( 445) subq->b->push(HX_(") AND (mam_id IN (",64,f4,1c,69));
+ }
+ }
+HXLINE( 446) bool didOne = false;
+HXLINE( 447) {
+HXLINE( 447) int _g = 0;
+HXDLIN( 447) while((_g < chats->length)){
+HXLINE( 447) ::snikket::Chat chat1 = chats->__get(_g).StaticCast< ::snikket::Chat >();
+HXDLIN( 447) _g = (_g + 1);
+HXLINE( 448) if (::hx::IsNotNull( chat1->readUpTo() )) {
+HXLINE( 449) if (didOne) {
+HXLINE( 449) if (::hx::IsNotNull( subq->charBuf )) {
+HXLINE( 449) subq->flush();
+ }
+HXDLIN( 449) if (::hx::IsNull( subq->b )) {
+HXLINE( 449) subq->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_94,1);
+ }
+ else {
+HXLINE( 449) subq->b->push(HX_(",",2c,00,00,00));
+ }
+ }
+HXLINE( 450) {
+HXLINE( 450) if (::hx::IsNotNull( subq->charBuf )) {
+HXLINE( 450) subq->flush();
+ }
+HXDLIN( 450) if (::hx::IsNull( subq->b )) {
+HXLINE( 450) subq->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_95,1);
+ }
+ else {
+HXLINE( 450) subq->b->push(HX_("?",3f,00,00,00));
+ }
+ }
+HXLINE( 451) params->push(chat1->readUpTo());
+HXLINE( 452) didOne = true;
+ }
+ }
+ }
+HXLINE( 455) {
+HXLINE( 455) if (::hx::IsNotNull( subq->charBuf )) {
+HXLINE( 455) subq->flush();
+ }
+HXDLIN( 455) if (::hx::IsNull( subq->b )) {
+HXLINE( 455) subq->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_96,1);
+ }
+ else {
+HXLINE( 455) subq->b->push(HX_(") OR direction=?) GROUP BY chat_id",cc,ab,94,e3));
+ }
+ }
+HXLINE( 456) params->push(1);
+HXLINE( 458) ::StringBuf q = ::StringBuf_obj::__alloc( HX_CTX );
+HXLINE( 459) {
+HXLINE( 459) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 459) q->flush();
+ }
+HXDLIN( 459) if (::hx::IsNull( q->b )) {
+HXLINE( 459) q->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_97,1);
+ }
+ else {
+HXLINE( 459) q->b->push(HX_("SELECT chat_id AS chatId, stanza, direction, type, sender_id, mam_id, mam_by, sync_point, CASE WHEN subq.created_at IS NULL THEN COUNT(*) ELSE COUNT(*) - 1 END AS unreadCount, strftime('%FT%H:%M:%fZ', MAX(messages.created_at) / 1000.0, 'unixepoch') AS timestamp FROM messages LEFT JOIN (",04,fc,16,f0));
+ }
+ }
+HXLINE( 460) {
+HXLINE( 460) ::String x = subq->toString();
+HXDLIN( 460) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 460) q->flush();
+ }
+HXDLIN( 460) if (::hx::IsNull( q->b )) {
+HXLINE( 460) q->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x));
+ }
+ else {
+HXLINE( 460) ::Array< ::String > q1 = q->b;
+HXDLIN( 460) q1->push(::Std_obj::string(x));
+ }
+ }
+HXLINE( 461) {
+HXLINE( 461) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 461) q->flush();
+ }
+HXDLIN( 461) if (::hx::IsNull( q->b )) {
+HXLINE( 461) q->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_98,1);
+ }
+ else {
+HXLINE( 461) q->b->push(HX_(") subq USING (chat_id) WHERE account_id=? AND (stanza_id IS NULL OR stanza_id='' OR stanza_id=correction_id) AND chat_id IN (",e7,a1,32,e5));
+ }
+ }
+HXLINE( 462) params->push(accountId);
+HXLINE( 463) {
+HXLINE( 463) int _g_current1 = 0;
+HXDLIN( 463) ::Array< ::Dynamic> _g_array1 = chats;
+HXDLIN( 463) while((_g_current1 < _g_array1->length)){
+HXLINE( 463) ::snikket::Chat _g_value1 = _g_array1->__get(_g_current1).StaticCast< ::snikket::Chat >();
+HXDLIN( 463) _g_current1 = (_g_current1 + 1);
+HXDLIN( 463) int _g_key1 = (_g_current1 - 1);
+HXDLIN( 463) int i1 = _g_key1;
+HXDLIN( 463) ::snikket::Chat chat2 = _g_value1;
+HXDLIN( 463) {
+HXLINE( 464) if ((i1 != 0)) {
+HXLINE( 464) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 464) q->flush();
+ }
+HXDLIN( 464) if (::hx::IsNull( q->b )) {
+HXLINE( 464) q->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_99,1);
+ }
+ else {
+HXLINE( 464) q->b->push(HX_(",",2c,00,00,00));
+ }
+ }
+HXLINE( 465) {
+HXLINE( 465) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 465) q->flush();
+ }
+HXDLIN( 465) if (::hx::IsNull( q->b )) {
+HXLINE( 465) q->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_100,1);
+ }
+ else {
+HXLINE( 465) q->b->push(HX_("?",3f,00,00,00));
+ }
+ }
+HXLINE( 466) params->push(chat2->chatId);
+ }
+ }
+ }
+HXLINE( 468) {
+HXLINE( 468) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 468) q->flush();
+ }
+HXDLIN( 468) if (::hx::IsNull( q->b )) {
+HXLINE( 468) q->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_101,1);
+ }
+ else {
+HXLINE( 468) q->b->push(HX_(") AND (subq.created_at IS NULL OR messages.created_at > subq.created_at OR (messages.created_at=subq.created_at AND messages.ROWID >= subq.row)) GROUP BY chat_id;",58,6f,52,ea));
+ }
+ }
+HXLINE( 469) ::snikket::persistence::SqliteDriver _hx_tmp1 = this->db;
+HXDLIN( 469) ::thenshim::_Promise::Promise_Impl__obj::then(_hx_tmp1->exec(q->toString(),params), ::Dynamic(new _hx_Closure_2(_gthis,accountId,callback)),null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Sqlite_obj,getChatsUnreadDetails,(void))
+
+void Sqlite_obj::storeReaction(::String accountId, ::snikket::ReactionUpdate update, ::Dynamic callback){
+ HX_BEGIN_LOCAL_FUNC_S4(::hx::LocalFunc,_hx_Closure_0, ::snikket::persistence::Sqlite,_gthis,::String,accountId, ::snikket::ReactionUpdate,update, ::Dynamic,callback) HXARGC(1)
+ void _hx_run(::Dynamic _){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_495_storeReaction)
+HXLINE( 495) _gthis->getMessage(accountId,update->chatId,update->serverId,update->localId,callback);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_486_storeReaction)
+HXDLIN( 486) ::snikket::persistence::Sqlite _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 487) ::snikket::persistence::SqliteDriver _hx_tmp = this->db;
+HXLINE( 490) ::String accountId1 = accountId;
+HXDLIN( 490) ::String update1 = update->updateId;
+HXDLIN( 490) ::String update2 = update->serverId;
+HXDLIN( 490) ::String update3 = update->serverIdBy;
+HXLINE( 491) ::String update4 = update->localId;
+HXDLIN( 491) ::String update5 = update->chatId;
+HXDLIN( 491) ::String update6 = update->senderId;
+HXDLIN( 491) ::String update7 = update->timestamp;
+HXLINE( 492) ::Dynamic replacer = null();
+HXDLIN( 492) ::String space = null();
+HXDLIN( 492) ::String _hx_tmp1 = ::haxe::format::JsonPrinter_obj::print(update->reactions,replacer,space);
+HXLINE( 487) ::thenshim::_Promise::Promise_Impl__obj::then(_hx_tmp->exec(HX_("INSERT OR REPLACE INTO reactions VALUES (?,?,?,?,?,?,?,CAST(unixepoch(?, 'subsec') * 1000 AS INTEGER),jsonb(?),?)",e2,55,57,48),::cpp::VirtualArray_obj::__new(10)->init(0,accountId1)->init(1,update1)->init(2,update2)->init(3,update3)->init(4,update4)->init(5,update5)->init(6,update6)->init(7,update7)->init(8,_hx_tmp1)->init(9,update->kind)), ::Dynamic(new _hx_Closure_0(_gthis,accountId,update,callback)),null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Sqlite_obj,storeReaction,(void))
+
+void Sqlite_obj::updateMessageStatus(::String accountId,::String localId,int status, ::Dynamic callback){
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_0, ::snikket::persistence::Sqlite,_gthis,::String,localId,::String,accountId) HXARGC(1)
+ ::Dynamic _hx_run(::Dynamic _){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_505_updateMessageStatus)
+HXLINE( 505) return _gthis->db->exec(HX_("SELECT stanza, direction, type, strftime('%FT%H:%M:%fZ', created_at / 1000.0, 'unixepoch') AS timestamp, sender_id, mam_id, mam_by, sync_point FROM messages WHERE account_id=? AND stanza_id=? AND direction=?",b0,23,ee,a5),::cpp::VirtualArray_obj::__new(3)->init(0,accountId)->init(1,localId)->init(2,1));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_1, ::snikket::persistence::Sqlite,_gthis,::String,accountId) HXARGC(1)
+ ::Array< ::Dynamic> _hx_run(::Dynamic result){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_509_updateMessageStatus)
+HXLINE( 509) return _gthis->hydrateMessages(accountId,result);
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_4, ::snikket::persistence::Sqlite,_gthis,::String,accountId, ::Dynamic,callback) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> messages){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_510_updateMessageStatus)
+HXLINE( 510) int _g = 0;
+HXDLIN( 510) while((_g < messages->length)){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_2, ::snikket::persistence::Sqlite,_gthis,::String,accountId) HXARGC(1)
+ ::Dynamic _hx_run(::Array< ::Dynamic> messages){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_515_updateMessageStatus)
+HXLINE( 515) return _gthis->hydrateReactions(accountId,messages);
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_3, ::Dynamic,callback) HXARGC(1)
+ void _hx_run(::Array< ::Dynamic> hydrated){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_515_updateMessageStatus)
+HXLINE( 515) callback(hydrated->__get(0).StaticCast< ::snikket::ChatMessage >());
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE( 510) ::snikket::ChatMessage message = messages->__get(_g).StaticCast< ::snikket::ChatMessage >();
+HXDLIN( 510) _g = (_g + 1);
+HXLINE( 511) ::Dynamic _hx_tmp;
+HXDLIN( 511) if (::hx::IsNotNull( message->replyToMessage )) {
+HXLINE( 512) ::snikket::persistence::Sqlite _gthis1 = _gthis;
+HXDLIN( 512) ::String accountId1 = accountId;
+HXDLIN( 512) ::String _hx_tmp1 = message->chatId();
+HXLINE( 511) _hx_tmp = _gthis1->hydrateReplyTo(accountId1,::Array_obj< ::Dynamic>::__new(1)->init(0,message),::Array_obj< ::Dynamic>::__new(1)->init(0, ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("chatId",d3,04,77,b7),_hx_tmp1)
+ ->setFixed(1,HX_("serverId",7e,01,b2,e2),message->replyToMessage->serverId)
+ ->setFixed(2,HX_("localId",26,7a,c6,2d),message->replyToMessage->localId))));
+ }
+ else {
+HXLINE( 511) _hx_tmp = ::thenshim::_Promise::Promise_Impl__obj::resolve(::Array_obj< ::Dynamic>::__new(1)->init(0,message));
+ }
+HXDLIN( 511) ::thenshim::_Promise::Promise_Impl__obj::then(::thenshim::_Promise::Promise_Impl__obj::then(_hx_tmp, ::Dynamic(new _hx_Closure_2(_gthis,accountId)),null()), ::Dynamic(new _hx_Closure_3(callback)),null());
+HXLINE( 516) return;
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_500_updateMessageStatus)
+HXDLIN( 500) ::snikket::persistence::Sqlite _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 501) ::thenshim::_Promise::Promise_Impl__obj::then(::thenshim::_Promise::Promise_Impl__obj::then(::thenshim::_Promise::Promise_Impl__obj::then(this->db->exec(HX_("UPDATE messages SET status=? WHERE account_id=? AND stanza_id=? AND direction=? AND status <> ?",75,90,3c,fc),::cpp::VirtualArray_obj::__new(5)->init(0,status)->init(1,accountId)->init(2,localId)->init(3,1)->init(4,2)), ::Dynamic(new _hx_Closure_0(_gthis,localId,accountId)),null()), ::Dynamic(new _hx_Closure_1(_gthis,accountId)),null()), ::Dynamic(new _hx_Closure_4(_gthis,accountId,callback)),null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC4(Sqlite_obj,updateMessageStatus,(void))
+
+void Sqlite_obj::hasMedia(::String hashAlgorithm,::Array< unsigned char > hash, ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_523_hasMedia)
+HXDLIN( 523) ::snikket::persistence::MediaStore_obj::hasMedia(this->media,hashAlgorithm,hash,callback);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Sqlite_obj,hasMedia,(void))
+
+void Sqlite_obj::removeMedia(::String hashAlgorithm,::Array< unsigned char > hash){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_528_removeMedia)
+HXDLIN( 528) ::snikket::persistence::MediaStore_obj::removeMedia(this->media,hashAlgorithm,hash);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Sqlite_obj,removeMedia,(void))
+
+void Sqlite_obj::storeMedia(::String mime,::Array< unsigned char > bd, ::Dynamic callback){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_533_storeMedia)
+HXDLIN( 533) ::snikket::persistence::MediaStore_obj::storeMedia(this->media,mime,bd,callback);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Sqlite_obj,storeMedia,(void))
+
+void Sqlite_obj::storeCaps( ::snikket::Caps caps){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_538_storeCaps)
+HXDLIN( 538) ::snikket::persistence::SqliteDriver _hx_tmp = this->db;
+HXLINE( 540) ::Array< unsigned char > _hx_tmp1 = caps->verRaw()->hash;
+HXDLIN( 540) ::Dynamic replacer = null();
+HXDLIN( 540) ::String space = null();
+HXLINE( 538) _hx_tmp->exec(HX_("INSERT OR IGNORE INTO caps VALUES (?,jsonb(?))",c3,4a,86,de),::cpp::VirtualArray_obj::__new(2)->init(0,_hx_tmp1)->init(1,::haxe::format::JsonPrinter_obj::print( ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("identities",1c,c5,6d,d7),caps->identities)
+ ->setFixed(1,HX_("features",fd,6c,d7,12),caps->features)
+ ->setFixed(2,HX_("node",02,0a,0a,49),caps->node)),replacer,space)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Sqlite_obj,storeCaps,(void))
+
+void Sqlite_obj::getCaps(::String ver, ::Dynamic callback){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_1, ::Dynamic,callback) HXARGC(1)
+ void _hx_run(::Dynamic result){
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_555_getCaps)
+HXLINE( 556) {
+HXLINE( 556) ::Dynamic row = result;
+HXDLIN( 556) while(::sys::db::ResultSet_obj::hasNext(row)){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ ::snikket::Identity _hx_run( ::Dynamic i){
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_558_getCaps)
+HXLINE( 558) return ::snikket::Identity_obj::__alloc( HX_CTX ,( (::String)(i->__Field(HX_("category",fe,2a,6c,ad),::hx::paccDynamic)) ),( (::String)(i->__Field(HX_("type",ba,f2,08,4d),::hx::paccDynamic)) ),( (::String)(i->__Field(HX_("name",4b,72,ff,48),::hx::paccDynamic)) ));
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE( 556) ::Dynamic row1 = ::sys::db::ResultSet_obj::next(row);
+HXLINE( 557) ::Dynamic json = ::haxe::format::JsonParser_obj::__alloc( HX_CTX ,( (::String)(row1->__Field(HX_("caps",21,1c,ba,41),::hx::paccDynamic)) ))->doParse();
+HXLINE( 558) ::Dynamic callback1 = callback;
+HXDLIN( 558) ::String json1 = ( (::String)(json->__Field(HX_("node",02,0a,0a,49),::hx::paccDynamic)) );
+HXDLIN( 558) ::Array< ::Dynamic> _hx_tmp = ( (::Array< ::Dynamic>)( ::Dynamic(json->__Field(HX_("identities",1c,c5,6d,d7),::hx::paccDynamic))->__Field(HX_("map",9c,0a,53,00),::hx::paccDynamic)( ::Dynamic(new _hx_Closure_0()))) );
+HXDLIN( 558) callback1( ::snikket::Caps_obj::__alloc( HX_CTX ,json1,_hx_tmp,( (::Array< ::String >)(json->__Field(HX_("features",fd,6c,d7,12),::hx::paccDynamic)) )));
+HXLINE( 559) return;
+ }
+ }
+HXLINE( 561) callback(null());
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_545_getCaps)
+HXLINE( 546) ::Array< unsigned char > verData;
+HXDLIN( 546) try {
+ HX_STACK_CATCHABLE( ::Dynamic, 0);
+HXLINE( 546) verData = ::haxe::crypto::Base64_obj::decode(ver,null())->b;
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::Dynamic >() ){
+ HX_STACK_BEGIN_CATCH
+ ::Dynamic _g = _hx_e;
+HXLINE( 549) callback(null());
+HXLINE( 550) return;
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+HXLINE( 552) ::thenshim::_Promise::Promise_Impl__obj::then(this->db->exec(HX_("SELECT json(caps) AS caps FROM caps WHERE sha1=? LIMIT 1",5a,98,24,09),::cpp::VirtualArray_obj::__new(1)->init(0,verData)), ::Dynamic(new _hx_Closure_1(callback)),null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Sqlite_obj,getCaps,(void))
+
+void Sqlite_obj::storeLogin(::String accountId,::String clientId,::String displayName,::String token){
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_566_storeLogin)
+HXLINE( 567) ::Array< ::String > params = ::Array_obj< ::String >::__new(3)->init(0,accountId)->init(1,clientId)->init(2,displayName);
+HXLINE( 568) ::StringBuf q = ::StringBuf_obj::__alloc( HX_CTX );
+HXLINE( 569) {
+HXLINE( 569) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 569) q->flush();
+ }
+HXDLIN( 569) if (::hx::IsNull( q->b )) {
+HXLINE( 569) q->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_120,1);
+ }
+ else {
+HXLINE( 569) q->b->push(HX_("INSERT INTO accounts (account_id, client_id, display_name",03,b0,6a,0b));
+ }
+ }
+HXLINE( 570) if (::hx::IsNotNull( token )) {
+HXLINE( 571) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 571) q->flush();
+ }
+HXDLIN( 571) if (::hx::IsNull( q->b )) {
+HXLINE( 571) q->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_121,1);
+ }
+ else {
+HXLINE( 571) q->b->push(HX_(", token, fast_count",a5,56,e4,ae));
+ }
+ }
+HXLINE( 573) {
+HXLINE( 573) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 573) q->flush();
+ }
+HXDLIN( 573) if (::hx::IsNull( q->b )) {
+HXLINE( 573) q->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_122,1);
+ }
+ else {
+HXLINE( 573) q->b->push(HX_(") VALUES (?,?,?",c4,1c,e3,67));
+ }
+ }
+HXLINE( 574) if (::hx::IsNotNull( token )) {
+HXLINE( 575) {
+HXLINE( 575) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 575) q->flush();
+ }
+HXDLIN( 575) if (::hx::IsNull( q->b )) {
+HXLINE( 575) q->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_123,1);
+ }
+ else {
+HXLINE( 575) q->b->push(HX_(",?",93,26,00,00));
+ }
+ }
+HXLINE( 576) params->push(token);
+HXLINE( 577) {
+HXLINE( 577) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 577) q->flush();
+ }
+HXDLIN( 577) if (::hx::IsNull( q->b )) {
+HXLINE( 577) q->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_124,1);
+ }
+ else {
+HXLINE( 577) q->b->push(HX_(",0",84,26,00,00));
+ }
+ }
+ }
+HXLINE( 579) {
+HXLINE( 579) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 579) q->flush();
+ }
+HXDLIN( 579) if (::hx::IsNull( q->b )) {
+HXLINE( 579) q->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_125,1);
+ }
+ else {
+HXLINE( 579) q->b->push(HX_(") ON CONFLICT DO UPDATE SET client_id=?",cd,99,0c,96));
+ }
+ }
+HXLINE( 580) params->push(clientId);
+HXLINE( 581) {
+HXLINE( 581) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 581) q->flush();
+ }
+HXDLIN( 581) if (::hx::IsNull( q->b )) {
+HXLINE( 581) q->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_126,1);
+ }
+ else {
+HXLINE( 581) q->b->push(HX_(", display_name=?",7e,ad,5b,0f));
+ }
+ }
+HXLINE( 582) params->push(displayName);
+HXLINE( 583) if (::hx::IsNotNull( token )) {
+HXLINE( 584) {
+HXLINE( 584) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 584) q->flush();
+ }
+HXDLIN( 584) if (::hx::IsNull( q->b )) {
+HXLINE( 584) q->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_127,1);
+ }
+ else {
+HXLINE( 584) q->b->push(HX_(", token=?",a7,78,19,80));
+ }
+ }
+HXLINE( 585) params->push(token);
+HXLINE( 586) {
+HXLINE( 586) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 586) q->flush();
+ }
+HXDLIN( 586) if (::hx::IsNull( q->b )) {
+HXLINE( 586) q->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_128,1);
+ }
+ else {
+HXLINE( 586) q->b->push(HX_(", fast_count=0",73,a8,4f,82));
+ }
+ }
+ }
+HXLINE( 588) ::snikket::persistence::SqliteDriver _hx_tmp = this->db;
+HXDLIN( 588) _hx_tmp->exec(q->toString(),params);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC4(Sqlite_obj,storeLogin,(void))
+
+void Sqlite_obj::getLogin(::String accountId, ::Dynamic callback){
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_0, ::snikket::persistence::Sqlite,_gthis,::String,accountId, ::Dynamic,callback) HXARGC(1)
+ void _hx_run(::Dynamic result){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_596_getLogin)
+HXLINE( 597) {
+HXLINE( 597) ::Dynamic row = result;
+HXDLIN( 597) while(::sys::db::ResultSet_obj::hasNext(row)){
+HXLINE( 597) ::Dynamic row1 = ::sys::db::ResultSet_obj::next(row);
+HXLINE( 598) if (::hx::IsNotNull( row1->__Field(HX_("token",f9,82,2b,14),::hx::paccDynamic) )) {
+HXLINE( 599) _gthis->db->exec(HX_("UPDATE accounts SET fast_count=fast_count+1 WHERE account_id=?",a6,3f,55,2d),::cpp::VirtualArray_obj::__new(1)->init(0,accountId));
+ }
+HXLINE( 601) ::Dynamic tmp = row1->__Field(HX_("fast_count",ac,2b,d2,5a),::hx::paccDynamic);
+HXDLIN( 601) int _hx_tmp;
+HXDLIN( 601) if (::hx::IsNotNull( tmp )) {
+HXLINE( 601) _hx_tmp = ( (int)(tmp) );
+ }
+ else {
+HXLINE( 601) _hx_tmp = 0;
+ }
+HXDLIN( 601) callback( ::Dynamic(row1->__Field(HX_("client_id",8f,e8,05,c8),::hx::paccDynamic)), ::Dynamic(row1->__Field(HX_("token",f9,82,2b,14),::hx::paccDynamic)),_hx_tmp, ::Dynamic(row1->__Field(HX_("display_name",a8,f4,3b,75),::hx::paccDynamic)));
+HXLINE( 602) return;
+ }
+ }
+HXLINE( 605) callback(null(),null(),0,null());
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_1) HXARGC(1)
+ void _hx_run( ::Dynamic err){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_606_getLogin)
+HXLINE( 606) ::Dynamic _hx_tmp = ::haxe::Log_obj::trace;
+HXDLIN( 606) ::String _hx_tmp1;
+HXDLIN( 606) if (::hx::IsNull( err )) {
+HXLINE( 606) _hx_tmp1 = HX_("null",87,9e,0e,49);
+ }
+ else {
+HXLINE( 606) _hx_tmp1 = ::Std_obj::string(err);
+ }
+HXDLIN( 606) _hx_tmp(HX_("ERR",45,a3,34,00), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.persistence.Sqlite",6c,cb,15,e4))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,_hx_tmp1))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("getLogin",f3,e8,ca,d8))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/persistence/Sqlite.hx",10,25,7a,91))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),606)));
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_592_getLogin)
+HXDLIN( 592) ::snikket::persistence::Sqlite _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 593) ::thenshim::_Promise::Promise_Impl__obj::then(this->db->exec(HX_("SELECT client_id, display_name, token, fast_count FROM accounts WHERE account_id=? LIMIT 1",fa,f8,24,9e),::cpp::VirtualArray_obj::__new(1)->init(0,accountId)), ::Dynamic(new _hx_Closure_0(_gthis,accountId,callback)), ::Dynamic(new _hx_Closure_1()));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Sqlite_obj,getLogin,(void))
+
+void Sqlite_obj::removeAccount(::String accountId,bool completely){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_609_removeAccount)
+HXLINE( 610) this->db->exec(HX_("DELETE FROM accounts WHERE account_id=?",a1,e8,94,4e),::cpp::VirtualArray_obj::__new(1)->init(0,accountId));
+HXLINE( 612) if (!(completely)) {
+HXLINE( 612) return;
+ }
+HXLINE( 614) this->db->exec(HX_("DELETE FROM messages WHERE account_id=?",bb,0a,07,c2),::cpp::VirtualArray_obj::__new(1)->init(0,accountId));
+HXLINE( 615) this->db->exec(HX_("DELETE FROM chats WHERE account_id=?",2e,3d,02,57),::cpp::VirtualArray_obj::__new(1)->init(0,accountId));
+HXLINE( 616) this->db->exec(HX_("DELETE FROM services WHERE account_id=?",29,fc,5f,4f),::cpp::VirtualArray_obj::__new(1)->init(0,accountId));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Sqlite_obj,removeAccount,(void))
+
+void Sqlite_obj::listAccounts( ::Dynamic callback){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_1, ::Dynamic,callback) HXARGC(1)
+ void _hx_run(::Dynamic result){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_622_listAccounts)
+HXLINE( 622) ::Dynamic callback1 = callback;
+HXDLIN( 622) ::Array< ::String > _hx_tmp;
+HXDLIN( 622) if (::hx::IsNull( result )) {
+HXLINE( 622) _hx_tmp = ::Array_obj< ::String >::__new(0);
+ }
+ else {
+HXLINE( 622) ::Array< ::String > _g = ::Array_obj< ::String >::__new(0);
+HXDLIN( 622) {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0,::Dynamic,result) HXARGC(0)
+ ::Dynamic _hx_run(){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_622_listAccounts)
+HXLINE( 622) return result;
+ }
+ HX_END_LOCAL_FUNC0(return)
+
+HXLINE( 622) ::Dynamic x = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("iterator",ee,49,9a,93), ::Dynamic(new _hx_Closure_0(result))))->__Field(HX_("iterator",ee,49,9a,93),::hx::paccDynamic)();
+HXDLIN( 622) while(( (bool)(x->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 622) ::Dynamic x1 = x->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)();
+HXDLIN( 622) _g->push( ::Dynamic(x1->__Field(HX_("account_id",6d,df,ad,00),::hx::paccDynamic)));
+ }
+ }
+HXDLIN( 622) _hx_tmp = _g;
+ }
+HXDLIN( 622) callback1(_hx_tmp);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_621_listAccounts)
+HXDLIN( 621) ::thenshim::_Promise::Promise_Impl__obj::then(this->db->exec(HX_("SELECT account_id FROM accounts",4d,82,81,0c),null()), ::Dynamic(new _hx_Closure_1(callback)),null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(Sqlite_obj,listAccounts,(void))
+
+void Sqlite_obj::listAccounts__fromC(::cpp::Function< void (const char**,size_t,void*) > callback,void* callback__context){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0,void*,callback__context,::cpp::Function< void (const char** HX_COMMA size_t HX_COMMA void*) >,callback) HXARGC(1)
+ void _hx_run(::Array< ::String > a0){
+ HX_GC_STACKFRAME(&_hx_pos_45dcb523da764b50_221_listAccounts__fromC)
+HXLINE( 221) ::cpp::Function< void (const char**,size_t,void*) > callback1 = callback;
+HXLINE( 211) ::Array< size_t > arr = ::Array_obj< size_t >::__new(a0->length);
+HXDLIN( 211) {
+HXLINE( 211) int _g_current = 0;
+HXDLIN( 211) ::Array< ::String > _g_array = a0;
+HXDLIN( 211) while((_g_current < _g_array->length)){
+HXLINE( 211) ::String _g_value = _g_array->__get(_g_current);
+HXDLIN( 211) _g_current = (_g_current + 1);
+HXDLIN( 211) int _g_key = (_g_current - 1);
+HXDLIN( 211) int i = _g_key;
+HXDLIN( 211) ::String el = _g_value;
+HXDLIN( 211) {
+HXLINE( 211) const char* cStrPtr = el.utf8_str();
+HXDLIN( 211) ::cpp::Int64 ptrInt64 = reinterpret_cast<int64_t>(cStrPtr);
+HXDLIN( 211) {
+HXLINE( 211) ::haxe::ds::IntMap this1 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 211) int low = ptrInt64 & 0xffffffff;
+HXDLIN( 211) int high = ptrInt64 >> 32;
+HXDLIN( 211) ::haxe::ds::IntMap highMap = ( ( ::haxe::ds::IntMap)(this1->get(low)) );
+HXDLIN( 211) if (::hx::IsNull( highMap )) {
+HXLINE(2083) highMap = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXLINE( 211) this1->set(low,highMap);
+ }
+HXDLIN( 211) highMap->set(high,el);
+ }
+HXDLIN( 211) const char* ptr = cStrPtr;
+HXDLIN( 211) arr[i] = reinterpret_cast<size_t>(ptr);
+ }
+ }
+ }
+HXDLIN( 211) void** ptr1 = (void**)arr->getBase();
+HXDLIN( 211) ::cpp::Int64 ptrInt641 = reinterpret_cast<int64_t>(ptr1);
+HXDLIN( 211) {
+HXLINE( 211) ::haxe::ds::IntMap this2 = ::_HaxeCBridge::Internal_obj::gcRetainMap;
+HXDLIN( 211) int low1 = ptrInt641 & 0xffffffff;
+HXDLIN( 211) int high1 = ptrInt641 >> 32;
+HXDLIN( 211) ::haxe::ds::IntMap highMap1 = ( ( ::haxe::ds::IntMap)(this2->get(low1)) );
+HXDLIN( 211) if (::hx::IsNull( highMap1 )) {
+HXLINE(2083) highMap1 = ::haxe::ds::IntMap_obj::__alloc( HX_CTX );
+HXLINE( 211) this2->set(low1,highMap1);
+ }
+HXDLIN( 211) highMap1->set(high1,arr);
+ }
+HXLINE( 221) callback1(( (const char**)(ptr1) ),( (size_t)(a0->length) ),callback__context);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_45dcb523da764b50_244_listAccounts__fromC)
+HXDLIN( 244) this->listAccounts( ::Dynamic(new _hx_Closure_0(callback__context,callback)));
+ }
+
+
+void Sqlite_obj::storeStreamManagement(::String accountId,::Array< unsigned char > sm){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_629_storeStreamManagement)
+HXDLIN( 629) ::snikket::persistence::Sqlite _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 630) this->smStoreNext = sm;
+HXLINE( 631) if (!(this->smStoreInProgress)) {
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_0, ::snikket::persistence::Sqlite,_gthis,::String,accountId,::Array< unsigned char >,sm) HXARGC(1)
+ void _hx_run(::Dynamic _){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_636_storeStreamManagement)
+HXLINE( 637) _gthis->smStoreInProgress = false;
+HXLINE( 638) if (::hx::IsPointerNotEq( _gthis->smStoreNext,sm )) {
+HXLINE( 638) _gthis->storeStreamManagement(accountId,sm);
+ }
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+HXLINE( 632) this->smStoreInProgress = true;
+HXLINE( 633) ::thenshim::_Promise::Promise_Impl__obj::then(this->db->exec(HX_("UPDATE accounts SET sm_state=? WHERE account_id=?",39,71,68,1b),::cpp::VirtualArray_obj::__new(2)->init(0,sm)->init(1,accountId)), ::Dynamic(new _hx_Closure_0(_gthis,accountId,sm)),null());
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Sqlite_obj,storeStreamManagement,(void))
+
+void Sqlite_obj::getStreamManagement(::String accountId, ::Dynamic callback){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::Dynamic,callback) HXARGC(1)
+ void _hx_run(::Dynamic result){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_645_getStreamManagement)
+HXLINE( 646) {
+HXLINE( 646) ::Dynamic row = result;
+HXDLIN( 646) while(::sys::db::ResultSet_obj::hasNext(row)){
+HXLINE( 646) ::Dynamic row1 = ::sys::db::ResultSet_obj::next(row);
+HXLINE( 647) callback( ::Dynamic(row1->__Field(HX_("sm_state",6c,91,3f,e6),::hx::paccDynamic)));
+HXLINE( 648) return;
+ }
+ }
+HXLINE( 651) callback(null());
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_645_getStreamManagement)
+HXDLIN( 645) ::thenshim::_Promise::Promise_Impl__obj::then(this->db->exec(HX_("SELECT sm_state FROM accounts WHERE account_id=?",94,7f,74,ea),::cpp::VirtualArray_obj::__new(1)->init(0,accountId)), ::Dynamic(new _hx_Closure_0(callback)),null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Sqlite_obj,getStreamManagement,(void))
+
+void Sqlite_obj::storeService(::String accountId,::String serviceId,::String name,::String node, ::snikket::Caps caps){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_656_storeService)
+HXLINE( 657) this->storeCaps(caps);
+HXLINE( 659) ::snikket::persistence::SqliteDriver _hx_tmp = this->db;
+HXDLIN( 659) _hx_tmp->exec(HX_("INSERT OR REPLACE INTO services VALUES (?,?,?,?,?)",2c,3a,d9,f8),::cpp::VirtualArray_obj::__new(5)->init(0,accountId)->init(1,serviceId)->init(2,name)->init(3,node)->init(4,caps->verRaw()->hash));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC5(Sqlite_obj,storeService,(void))
+
+void Sqlite_obj::findServicesWithFeature(::String accountId,::String feature, ::Dynamic callback){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0, ::Dynamic,callback,::String,feature) HXARGC(1)
+ void _hx_run(::Dynamic result){
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_671_findServicesWithFeature)
+HXLINE( 672) ::Array< ::Dynamic> services = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 673) {
+HXLINE( 673) ::Dynamic row = result;
+HXDLIN( 673) while(::sys::db::ResultSet_obj::hasNext(row)){
+HXLINE( 673) ::Dynamic row1 = ::sys::db::ResultSet_obj::next(row);
+HXLINE( 674) ::Dynamic json = ::haxe::format::JsonParser_obj::__alloc( HX_CTX ,( (::String)(row1->__Field(HX_("caps",21,1c,ba,41),::hx::paccDynamic)) ))->doParse();
+HXLINE( 675) ::Array< ::String > features;
+HXDLIN( 675) ::Array< ::String > tmp;
+HXDLIN( 675) if (::hx::IsNotNull( json )) {
+HXLINE( 675) tmp = ( (::Array< ::String >)(json->__Field(HX_("features",fd,6c,d7,12),::hx::paccDynamic)) );
+ }
+ else {
+HXLINE( 675) tmp = null();
+ }
+HXDLIN( 675) if (::hx::IsNotNull( tmp )) {
+HXLINE( 675) features = tmp;
+ }
+ else {
+HXLINE( 675) features = ::Array_obj< ::String >::__new(0);
+ }
+HXLINE( 676) if (features->contains(feature)) {
+HXLINE( 678) ::String row2 = ( (::String)(row1->__Field(HX_("service_id",e5,24,3d,7d),::hx::paccDynamic)) );
+HXLINE( 679) ::String row3 = ( (::String)(row1->__Field(HX_("name",4b,72,ff,48),::hx::paccDynamic)) );
+HXLINE( 680) ::String row4 = ( (::String)(row1->__Field(HX_("node",02,0a,0a,49),::hx::paccDynamic)) );
+HXLINE( 681) ::String json1 = ( (::String)(json->__Field(HX_("node",02,0a,0a,49),::hx::paccDynamic)) );
+HXDLIN( 681) ::Array< ::Dynamic> _this;
+HXDLIN( 681) ::Array< ::Dynamic> tmp1 = ( (::Array< ::Dynamic>)(json->__Field(HX_("identities",1c,c5,6d,d7),::hx::paccDynamic)) );
+HXDLIN( 681) if (::hx::IsNotNull( tmp1 )) {
+HXLINE( 681) _this = tmp1;
+ }
+ else {
+HXLINE( 681) _this = ::Array_obj< ::Dynamic>::__new(0);
+ }
+HXDLIN( 681) ::Array< ::Dynamic> result1 = ::Array_obj< ::Dynamic>::__new(_this->length);
+HXDLIN( 681) {
+HXLINE( 681) int _g = 0;
+HXDLIN( 681) int _g1 = _this->length;
+HXDLIN( 681) while((_g < _g1)){
+HXLINE( 681) _g = (_g + 1);
+HXDLIN( 681) int i = (_g - 1);
+HXDLIN( 681) {
+HXLINE( 681) ::Dynamic i1 = _hx_array_unsafe_get(_this,i);
+HXDLIN( 681) ::snikket::Identity inValue = ::snikket::Identity_obj::__alloc( HX_CTX ,( (::String)(i1->__Field(HX_("category",fe,2a,6c,ad),::hx::paccDynamic)) ),( (::String)(i1->__Field(HX_("type",ba,f2,08,4d),::hx::paccDynamic)) ),( (::String)(i1->__Field(HX_("name",4b,72,ff,48),::hx::paccDynamic)) ));
+HXDLIN( 681) result1->__unsafe_set(i,inValue);
+ }
+ }
+ }
+HXLINE( 677) services->push( ::Dynamic(::hx::Anon_obj::Create(4)
+ ->setFixed(0,HX_("serviceId",70,93,d4,bc),row2)
+ ->setFixed(1,HX_("caps",21,1c,ba,41), ::snikket::Caps_obj::__alloc( HX_CTX ,json1,result1,features))
+ ->setFixed(2,HX_("name",4b,72,ff,48),row3)
+ ->setFixed(3,HX_("node",02,0a,0a,49),row4)));
+ }
+ }
+ }
+HXLINE( 685) callback(services);
+ }
+ HX_END_LOCAL_FUNC1((void))
+
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_668_findServicesWithFeature)
+HXDLIN( 668) ::thenshim::_Promise::Promise_Impl__obj::then(this->db->exec(HX_("SELECT service_id, name, node, json(caps.caps) AS caps FROM services INNER JOIN caps ON services.caps=caps.sha1 WHERE account_id=?",fc,fb,5f,40),::cpp::VirtualArray_obj::__new(1)->init(0,accountId)), ::Dynamic(new _hx_Closure_0(callback,feature)),null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Sqlite_obj,findServicesWithFeature,(void))
+
+::Dynamic Sqlite_obj::hydrateReactions(::String accountId,::Array< ::Dynamic> messages){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_1,::Array< ::Dynamic>,messages) HXARGC(1)
+ ::Array< ::Dynamic> _hx_run( ::haxe::ds::StringMap result){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_690_hydrateReactions)
+HXLINE( 691) {
+HXLINE( 691) ::Dynamic map = result;
+HXDLIN( 691) ::Dynamic _g_map = map;
+HXDLIN( 691) ::Dynamic _g_keys = ::haxe::IMap_obj::keys(map);
+HXDLIN( 691) while(( (bool)(_g_keys->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 691) ::String key = ( (::String)(_g_keys->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXDLIN( 691) ::haxe::ds::StringMap _g_value = ( ( ::haxe::ds::StringMap)(::haxe::IMap_obj::get(_g_map,key)) );
+HXDLIN( 691) ::String _g_key = key;
+HXDLIN( 691) ::String id = _g_key;
+HXDLIN( 691) ::haxe::ds::StringMap reactions = _g_value;
+HXDLIN( 691) {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0,::String,id) HXARGC(1)
+ bool _hx_run( ::snikket::ChatMessage m){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_692_hydrateReactions)
+HXLINE( 692) ::String m1;
+HXDLIN( 692) if (::hx::IsNull( m->serverId )) {
+HXLINE( 692) m1 = m->localId;
+ }
+ else {
+HXLINE( 692) m1 = ((m->serverId + HX_("\n",0a,00,00,00)) + m->serverIdBy);
+ }
+HXDLIN( 692) ::String m2 = ((m1 + HX_("\n",0a,00,00,00)) + m->chatId());
+HXDLIN( 692) return (m2 == id);
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE( 692) ::snikket::ChatMessage m = ( ( ::snikket::ChatMessage)(::Lambda_obj::find(messages, ::Dynamic(new _hx_Closure_0(id)))) );
+HXLINE( 693) if (::hx::IsNotNull( m )) {
+HXLINE( 693) m->set_reactions(reactions);
+ }
+ }
+ }
+ }
+HXLINE( 695) return messages;
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_690_hydrateReactions)
+HXDLIN( 690) ::Array< ::Dynamic> result = ::Array_obj< ::Dynamic>::__new(messages->length);
+HXDLIN( 690) {
+HXDLIN( 690) int _g = 0;
+HXDLIN( 690) int _g1 = messages->length;
+HXDLIN( 690) while((_g < _g1)){
+HXDLIN( 690) _g = (_g + 1);
+HXDLIN( 690) int i = (_g - 1);
+HXDLIN( 690) {
+HXDLIN( 690) ::snikket::ChatMessage m = ( ( ::snikket::ChatMessage)(_hx_array_unsafe_get(messages,i)) );
+HXDLIN( 690) ::String inValue = m->chatId();
+HXDLIN( 690) result->__unsafe_set(i, ::Dynamic(::hx::Anon_obj::Create(4)
+ ->setFixed(0,HX_("chatId",d3,04,77,b7),inValue)
+ ->setFixed(1,HX_("serverId",7e,01,b2,e2),m->serverId)
+ ->setFixed(2,HX_("localId",26,7a,c6,2d),m->localId)
+ ->setFixed(3,HX_("serverIdBy",f5,16,54,74),m->serverIdBy)));
+ }
+ }
+ }
+HXDLIN( 690) return ::thenshim::_Promise::Promise_Impl__obj::then(this->fetchReactions(accountId,result), ::Dynamic(new _hx_Closure_1(messages)),null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Sqlite_obj,hydrateReactions,return )
+
+::Dynamic Sqlite_obj::fetchReactions(::String accountId,::Array< ::Dynamic> ids){
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_0) HXARGC(1)
+ ::haxe::ds::StringMap _hx_run(::Dynamic rows){
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_714_fetchReactions)
+HXLINE( 715) ::haxe::ds::StringMap agg = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXLINE( 716) {
+HXLINE( 716) ::Dynamic row = rows;
+HXDLIN( 716) while(::sys::db::ResultSet_obj::hasNext(row)){
+HXLINE( 716) ::Dynamic row1 = ::sys::db::ResultSet_obj::next(row);
+HXLINE( 717) ::cpp::VirtualArray reactions = ( (::cpp::VirtualArray)( ::haxe::format::JsonParser_obj::__alloc( HX_CTX ,( (::String)(row1->__Field(HX_("reactions",aa,cc,95,e7),::hx::paccDynamic)) ))->doParse()) );
+HXLINE( 718) ::String mapId;
+HXDLIN( 718) bool mapId1;
+HXDLIN( 718) if (::hx::IsNotNull( row1->__Field(HX_("mam_id",01,4d,19,b7),::hx::paccDynamic) )) {
+HXLINE( 718) mapId1 = ::hx::IsEq( row1->__Field(HX_("mam_id",01,4d,19,b7),::hx::paccDynamic),HX_("",00,00,00,00) );
+ }
+ else {
+HXLINE( 718) mapId1 = true;
+ }
+HXDLIN( 718) if (mapId1) {
+HXLINE( 718) mapId = ( (::String)(row1->__Field(HX_("stanza_id",25,7b,7a,e9),::hx::paccDynamic)) );
+ }
+ else {
+HXLINE( 718) mapId = ( (::String)(((row1->__Field(HX_("mam_id",01,4d,19,b7),::hx::paccDynamic) + HX_("\n",0a,00,00,00)) + row1->__Field(HX_("mam_by",fd,46,19,b7),::hx::paccDynamic))) );
+ }
+HXDLIN( 718) ::String mapId2 = ( (::String)(((mapId + HX_("\n",0a,00,00,00)) + row1->__Field(HX_("chat_id",22,ea,bd,d0),::hx::paccDynamic))) );
+HXLINE( 719) if (!(agg->exists(mapId2))) {
+HXLINE( 719) agg->set(mapId2, ::haxe::ds::StringMap_obj::__alloc( HX_CTX ));
+ }
+HXLINE( 720) ::haxe::ds::StringMap map = ( ( ::haxe::ds::StringMap)(agg->get(mapId2)) );
+HXLINE( 721) if (!(map->exists(( (::String)(row1->__Field(HX_("sender_id",65,a9,5d,a0),::hx::paccDynamic)) )))) {
+HXLINE( 721) ::cpp::VirtualArray v = ::cpp::VirtualArray_obj::__new(0);
+HXDLIN( 721) map->set(( (::String)(row1->__Field(HX_("sender_id",65,a9,5d,a0),::hx::paccDynamic)) ),v);
+ }
+HXLINE( 722) if (::hx::IsEq( row1->__Field(HX_("kind",54,e1,09,47),::hx::paccDynamic),1 )) {
+HXLINE( 723) int _g = 0;
+HXDLIN( 723) while((_g < reactions->get_length())){
+HXLINE( 723) ::Dynamic reaction = reactions->__get(_g);
+HXDLIN( 723) _g = (_g + 1);
+HXDLIN( 723) ( (::cpp::VirtualArray)(map->get( ::Dynamic(row1->__Field(HX_("sender_id",65,a9,5d,a0),::hx::paccDynamic)))) )->push(reaction);
+ }
+ }
+ else {
+HXLINE( 724) if (::hx::IsEq( row1->__Field(HX_("kind",54,e1,09,47),::hx::paccDynamic),0 )) {
+HXLINE( 725) ::String k = ( (::String)(row1->__Field(HX_("sender_id",65,a9,5d,a0),::hx::paccDynamic)) );
+HXDLIN( 725) ::cpp::VirtualArray _g1 = ::cpp::VirtualArray_obj::__new(0);
+HXDLIN( 725) {
+HXLINE( 725) int _g2 = 0;
+HXDLIN( 725) ::cpp::VirtualArray _g3 = ( (::cpp::VirtualArray)(map->get( ::Dynamic(row1->__Field(HX_("sender_id",65,a9,5d,a0),::hx::paccDynamic)))) );
+HXDLIN( 725) while((_g2 < _g3->get_length())){
+HXLINE( 725) ::Dynamic v1 = _g3->__get(_g2);
+HXDLIN( 725) _g2 = (_g2 + 1);
+HXDLIN( 725) if (::hx::IsNotNull( v1->__Field(HX_("uri",6c,2b,59,00),::hx::paccDynamic) )) {
+HXLINE( 725) _g1->push(v1);
+ }
+ }
+ }
+HXDLIN( 725) ::cpp::VirtualArray v2 = reactions->concat(_g1);
+HXDLIN( 725) map->set(k,v2);
+ }
+ else {
+HXLINE( 726) if (::hx::IsEq( row1->__Field(HX_("kind",54,e1,09,47),::hx::paccDynamic),2 )) {
+HXLINE( 727) map->set(( (::String)(row1->__Field(HX_("sender_id",65,a9,5d,a0),::hx::paccDynamic)) ),reactions);
+ }
+ }
+ }
+ }
+ }
+HXLINE( 730) ::haxe::ds::StringMap result = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXLINE( 731) {
+HXLINE( 731) ::Dynamic map1 = agg;
+HXDLIN( 731) ::Dynamic _g_map = map1;
+HXDLIN( 731) ::Dynamic _g_keys = ::haxe::IMap_obj::keys(map1);
+HXDLIN( 731) while(( (bool)(_g_keys->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 731) ::String key = ( (::String)(_g_keys->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXDLIN( 731) ::haxe::ds::StringMap _g_value = ( ( ::haxe::ds::StringMap)(::haxe::IMap_obj::get(_g_map,key)) );
+HXDLIN( 731) ::String _g_key = key;
+HXDLIN( 731) ::String id = _g_key;
+HXDLIN( 731) ::haxe::ds::StringMap reactions1 = _g_value;
+HXDLIN( 731) {
+HXLINE( 732) ::haxe::ds::StringMap map2 = ::haxe::ds::StringMap_obj::__alloc( HX_CTX );
+HXLINE( 733) {
+HXLINE( 733) ::Dynamic reactionsBySender = reactions1->iterator();
+HXDLIN( 733) while(( (bool)(reactionsBySender->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+HXLINE( 733) ::cpp::VirtualArray reactionsBySender1 = ( (::cpp::VirtualArray)(reactionsBySender->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)()) );
+HXLINE( 734) {
+HXLINE( 734) int _g4 = 0;
+HXDLIN( 734) while((_g4 < reactionsBySender1->get_length())){
+HXLINE( 734) ::Dynamic reactionD = reactionsBySender1->__get(_g4);
+HXDLIN( 734) _g4 = (_g4 + 1);
+HXLINE( 735) ::snikket::Reaction reaction1;
+HXDLIN( 735) if (::hx::IsNull( reactionD->__Field(HX_("uri",6c,2b,59,00),::hx::paccDynamic) )) {
+HXLINE( 735) reaction1 = ::snikket::Reaction_obj::__alloc( HX_CTX ,( (::String)(reactionD->__Field(HX_("senderId",f0,1e,0e,ec),::hx::paccDynamic)) ),( (::String)(reactionD->__Field(HX_("timestamp",d6,d4,ce,a5),::hx::paccDynamic)) ),( (::String)(reactionD->__Field(HX_("text",ad,cc,f9,4c),::hx::paccDynamic)) ),( (::String)(reactionD->__Field(HX_("envelopeId",0b,03,af,a8),::hx::paccDynamic)) ),( (::String)(reactionD->__Field(HX_("key",9f,89,51,00),::hx::paccDynamic)) ));
+ }
+ else {
+HXLINE( 735) reaction1 = ::snikket::CustomEmojiReaction_obj::__alloc( HX_CTX ,( (::String)(reactionD->__Field(HX_("senderId",f0,1e,0e,ec),::hx::paccDynamic)) ),( (::String)(reactionD->__Field(HX_("timestamp",d6,d4,ce,a5),::hx::paccDynamic)) ),( (::String)(reactionD->__Field(HX_("text",ad,cc,f9,4c),::hx::paccDynamic)) ),( (::String)(reactionD->__Field(HX_("uri",6c,2b,59,00),::hx::paccDynamic)) ),( (::String)(reactionD->__Field(HX_("envelopeId",0b,03,af,a8),::hx::paccDynamic)) ));
+ }
+HXLINE( 741) if (!(map2->exists(reaction1->key))) {
+HXLINE( 741) ::Array< ::Dynamic> v3 = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 741) map2->set(reaction1->key,v3);
+ }
+HXLINE( 742) ( (::Array< ::Dynamic>)(map2->get(reaction1->key)) )->push(reaction1);
+ }
+ }
+ }
+ }
+HXLINE( 745) result->set(id,map2);
+ }
+ }
+ }
+HXLINE( 747) return result;
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_699_fetchReactions)
+HXLINE( 700) ::StringBuf q = ::StringBuf_obj::__alloc( HX_CTX );
+HXLINE( 701) {
+HXLINE( 701) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 701) q->flush();
+ }
+HXDLIN( 701) if (::hx::IsNull( q->b )) {
+HXLINE( 701) q->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_165,1);
+ }
+ else {
+HXLINE( 701) q->b->push(HX_("SELECT kind, chat_id, mam_id, mam_by, stanza_id, sender_id, json(reactions) AS reactions FROM reactions WHERE 1=0",d2,04,de,a3));
+ }
+ }
+HXLINE( 702) ::Array< ::String > params = ::Array_obj< ::String >::__new(0);
+HXLINE( 703) {
+HXLINE( 703) int _g = 0;
+HXDLIN( 703) while((_g < ids->length)){
+HXLINE( 703) ::Dynamic item = ids->__get(_g);
+HXDLIN( 703) _g = (_g + 1);
+HXLINE( 704) if (::hx::IsNotNull( item->__Field(HX_("serverId",7e,01,b2,e2),::hx::paccDynamic) )) {
+HXLINE( 705) {
+HXLINE( 705) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 705) q->flush();
+ }
+HXDLIN( 705) if (::hx::IsNull( q->b )) {
+HXLINE( 705) q->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_166,1);
+ }
+ else {
+HXLINE( 705) q->b->push(HX_(" OR (mam_id=? AND mam_by=?)",0f,bb,c5,e5));
+ }
+ }
+HXLINE( 706) params->push( ::Dynamic(item->__Field(HX_("serverId",7e,01,b2,e2),::hx::paccDynamic)));
+HXLINE( 707) params->push( ::Dynamic(item->__Field(HX_("serverIdBy",f5,16,54,74),::hx::paccDynamic)));
+ }
+ else {
+HXLINE( 709) {
+HXLINE( 709) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 709) q->flush();
+ }
+HXDLIN( 709) if (::hx::IsNull( q->b )) {
+HXLINE( 709) q->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_167,1);
+ }
+ else {
+HXLINE( 709) q->b->push(HX_(" OR stanza_id=?",6a,1d,f2,5b));
+ }
+ }
+HXLINE( 710) params->push( ::Dynamic(item->__Field(HX_("localId",26,7a,c6,2d),::hx::paccDynamic)));
+ }
+ }
+ }
+HXLINE( 713) {
+HXLINE( 713) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 713) q->flush();
+ }
+HXDLIN( 713) if (::hx::IsNull( q->b )) {
+HXLINE( 713) q->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_168,1);
+ }
+ else {
+HXLINE( 713) q->b->push(HX_(" ORDER BY created_at, ROWID",00,65,8d,0e));
+ }
+ }
+HXLINE( 714) ::snikket::persistence::SqliteDriver _hx_tmp = this->db;
+HXDLIN( 714) return ::thenshim::_Promise::Promise_Impl__obj::then(_hx_tmp->exec(q->toString(),params), ::Dynamic(new _hx_Closure_0()),null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Sqlite_obj,fetchReactions,return )
+
+::Dynamic Sqlite_obj::hydrateReplyTo(::String accountId,::Array< ::Dynamic> messages,::Array< ::Dynamic> replyTos){
+ HX_BEGIN_LOCAL_FUNC_S3(::hx::LocalFunc,_hx_Closure_2,::Array< ::Dynamic>,messages, ::snikket::persistence::Sqlite,_gthis,::String,accountId) HXARGC(1)
+ ::Array< ::Dynamic> _hx_run(::Dynamic iter){
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_771_hydrateReplyTo)
+HXLINE( 772) if (::hx::IsNotNull( iter )) {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0,::Dynamic,iter) HXARGC(0)
+ ::Dynamic _hx_run(){
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_773_hydrateReplyTo)
+HXLINE( 773) return iter;
+ }
+ HX_END_LOCAL_FUNC0(return)
+
+HXLINE( 773) ::Array< ::Dynamic> parents = ::Lambda_obj::array( ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("iterator",ee,49,9a,93), ::Dynamic(new _hx_Closure_0(iter)))));
+HXLINE( 774) {
+HXLINE( 774) int _g = 0;
+HXDLIN( 774) while((_g < messages->length)){
+HXLINE( 774) ::snikket::ChatMessage message = messages->__get(_g).StaticCast< ::snikket::ChatMessage >();
+HXDLIN( 774) _g = (_g + 1);
+HXLINE( 775) if (::hx::IsNotNull( message->replyToMessage )) {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_1, ::snikket::ChatMessage,message) HXARGC(1)
+ bool _hx_run( ::Dynamic p){
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_776_hydrateReplyTo)
+HXLINE( 776) bool found;
+HXDLIN( 776) ::String p1 = ( (::String)(p->__Field(HX_("chat_id",22,ea,bd,d0),::hx::paccDynamic)) );
+HXDLIN( 776) if ((p1 == message->chatId())) {
+HXLINE( 776) if (::hx::IsNotNull( message->replyToMessage->serverId )) {
+HXLINE( 776) found = ::hx::IsEq( p->__Field(HX_("mam_id",01,4d,19,b7),::hx::paccDynamic),message->replyToMessage->serverId );
+ }
+ else {
+HXLINE( 776) found = true;
+ }
+ }
+ else {
+HXLINE( 776) found = false;
+ }
+HXDLIN( 776) if (found) {
+HXLINE( 776) if (::hx::IsNotNull( message->replyToMessage->localId )) {
+HXLINE( 776) return ::hx::IsEq( p->__Field(HX_("stanza_id",25,7b,7a,e9),::hx::paccDynamic),message->replyToMessage->localId );
+ }
+ else {
+HXLINE( 776) return true;
+ }
+ }
+ else {
+HXLINE( 776) return false;
+ }
+HXDLIN( 776) return false;
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+HXLINE( 776) ::Dynamic found = ::Lambda_obj::find(parents, ::Dynamic(new _hx_Closure_1(message)));
+HXLINE( 777) if (::hx::IsNotNull( found )) {
+HXLINE( 777) ::snikket::ChatMessage message1 = message;
+HXDLIN( 777) ::snikket::persistence::Sqlite _gthis1 = _gthis;
+HXDLIN( 777) ::String accountId1 = accountId;
+HXDLIN( 777) message1->set_replyToMessage(_gthis1->hydrateMessages(accountId1, ::haxe::iterators::ArrayIterator_obj::__alloc( HX_CTX ,::cpp::VirtualArray_obj::__new(1)->init(0,found)))->__get(0).StaticCast< ::snikket::ChatMessage >());
+ }
+HXLINE( 778) if ((message->localId == HX_("E5A340C0-9732-46BB-AC56-F2822124AA6F",c4,de,e2,7a))) {
+HXLINE( 779) ::haxe::Log_obj::trace(HX_("FOUND",22,3a,85,82), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.persistence.Sqlite",6c,cb,15,e4))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,found))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("hydrateReplyTo",f2,64,45,9b))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/persistence/Sqlite.hx",10,25,7a,91))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),779)));
+HXLINE( 780) if (::hx::IsNotNull( found )) {
+HXLINE( 780) ::haxe::Log_obj::trace(HX_("HYDRATE",73,10,71,a5), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.persistence.Sqlite",6c,cb,15,e4))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(2)->init(0,message->replyToMessage->senderId)->init(1,message->replyToMessage->localId))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("hydrateReplyTo",f2,64,45,9b))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/persistence/Sqlite.hx",10,25,7a,91))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),780)));
+ }
+ }
+ }
+ }
+ }
+ }
+HXLINE( 785) return messages;
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_751_hydrateReplyTo)
+HXDLIN( 751) ::snikket::persistence::Sqlite _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 752) ::Dynamic _hx_tmp;
+HXDLIN( 752) if ((replyTos->length < 1)) {
+HXLINE( 752) _hx_tmp = ::thenshim::_Promise::Promise_Impl__obj::resolve(null());
+ }
+ else {
+HXLINE( 755) ::Array< ::String > params = ::Array_obj< ::String >::__new(1)->init(0,accountId);
+HXLINE( 756) ::StringBuf q = ::StringBuf_obj::__alloc( HX_CTX );
+HXLINE( 757) {
+HXLINE( 757) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 757) q->flush();
+ }
+HXDLIN( 757) if (::hx::IsNull( q->b )) {
+HXLINE( 757) q->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_175,1);
+ }
+ else {
+HXLINE( 757) q->b->push(HX_("SELECT chat_id, stanza_id, stanza, direction, type, strftime('%FT%H:%M:%fZ', created_at / 1000.0, 'unixepoch') AS timestamp, sender_id, mam_id, mam_by, sync_point FROM messages WHERE account_id=? AND (",3c,df,23,3e));
+ }
+ }
+HXLINE( 758) {
+HXLINE( 758) ::Array< ::String > result = ::Array_obj< ::String >::__new(replyTos->length);
+HXDLIN( 758) {
+HXLINE( 758) int _g = 0;
+HXDLIN( 758) int _g1 = replyTos->length;
+HXDLIN( 758) while((_g < _g1)){
+HXLINE( 758) _g = (_g + 1);
+HXDLIN( 758) int i = (_g - 1);
+HXDLIN( 758) {
+HXLINE( 759) ::Dynamic parent = _hx_array_unsafe_get(replyTos,i);
+HXLINE( 758) ::String inValue;
+HXLINE( 759) if (::hx::IsNotNull( parent->__Field(HX_("serverId",7e,01,b2,e2),::hx::paccDynamic) )) {
+HXLINE( 760) params->push( ::Dynamic(parent->__Field(HX_("chatId",d3,04,77,b7),::hx::paccDynamic)));
+HXLINE( 761) params->push( ::Dynamic(parent->__Field(HX_("serverId",7e,01,b2,e2),::hx::paccDynamic)));
+HXLINE( 758) inValue = HX_(" (chat_id=? AND mam_id=?)",59,03,f2,84);
+ }
+ else {
+HXLINE( 764) params->push( ::Dynamic(parent->__Field(HX_("chatId",d3,04,77,b7),::hx::paccDynamic)));
+HXLINE( 765) params->push( ::Dynamic(parent->__Field(HX_("localId",26,7a,c6,2d),::hx::paccDynamic)));
+HXLINE( 758) inValue = HX_(" (chat_id=? AND stanza_id=?)",2f,d3,29,86);
+ }
+HXDLIN( 758) result->__unsafe_set(i,inValue);
+ }
+ }
+ }
+HXDLIN( 758) ::String x = result->join(HX_(" OR ",7d,0d,63,15));
+HXDLIN( 758) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 758) q->flush();
+ }
+HXDLIN( 758) if (::hx::IsNull( q->b )) {
+HXLINE( 758) q->b = ::Array_obj< ::String >::__new(1)->init(0,::Std_obj::string(x));
+ }
+ else {
+HXLINE( 758) ::Array< ::String > q1 = q->b;
+HXDLIN( 758) q1->push(::Std_obj::string(x));
+ }
+ }
+HXLINE( 769) {
+HXLINE( 769) if (::hx::IsNotNull( q->charBuf )) {
+HXLINE( 769) q->flush();
+ }
+HXDLIN( 769) if (::hx::IsNull( q->b )) {
+HXLINE( 769) q->b = ::Array_obj< ::String >::fromData( _hx_array_data_e415cb6c_176,1);
+ }
+ else {
+HXLINE( 769) q->b->push(HX_(")",29,00,00,00));
+ }
+ }
+HXLINE( 770) ::snikket::persistence::SqliteDriver _hx_tmp1 = this->db;
+HXLINE( 752) _hx_tmp = _hx_tmp1->exec(q->toString(),params);
+ }
+HXDLIN( 752) return ::thenshim::_Promise::Promise_Impl__obj::then(_hx_tmp, ::Dynamic(new _hx_Closure_2(messages,_gthis,accountId)),null());
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC3(Sqlite_obj,hydrateReplyTo,return )
+
+::Array< ::Dynamic> Sqlite_obj::hydrateMessages(::String accountId, ::Dynamic rows){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_789_hydrateMessages)
+HXLINE( 791) ::snikket::JID accountJid = ::snikket::JID_obj::parse(accountId);
+HXLINE( 792) ::Array< ::Dynamic> _g = ::Array_obj< ::Dynamic>::__new(0);
+HXDLIN( 792) {
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::Dynamic,rows) HXARGC(0)
+ ::Dynamic _hx_run(){
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_792_hydrateMessages)
+HXLINE( 792) return rows;
+ }
+ HX_END_LOCAL_FUNC0(return)
+
+HXLINE( 792) ::Dynamic inlobj_iterator = ::Dynamic(new _hx_Closure_0(rows));
+HXDLIN( 792) ::Dynamic x = inlobj_iterator();
+HXDLIN( 792) while(( (bool)(x->__Field(HX_("hasNext",6d,a5,46,18),::hx::paccDynamic)()) )){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_3, ::snikket::JID,accountJid, ::Dynamic,row) HXARGC(2)
+ ::snikket::ChatMessageBuilder _hx_run( ::snikket::ChatMessageBuilder builder, ::snikket::Stanza _){
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_792_hydrateMessages)
+HXLINE( 793) builder->syncPoint = ::hx::IsNotEq( row->__Field(HX_("sync_point",2c,6c,7f,80),::hx::paccDynamic),0 );
+HXLINE( 794) builder->timestamp = ( (::String)(row->__Field(HX_("timestamp",d6,d4,ce,a5),::hx::paccDynamic)) );
+HXLINE( 795) builder->type = ( (int)(row->__Field(HX_("type",ba,f2,08,4d),::hx::paccDynamic)) );
+HXLINE( 796) builder->senderId = ( (::String)(row->__Field(HX_("sender_id",65,a9,5d,a0),::hx::paccDynamic)) );
+HXLINE( 797) ::String _hx_tmp;
+HXDLIN( 797) if (::hx::IsEq( row->__Field(HX_("mam_id",01,4d,19,b7),::hx::paccDynamic),HX_("",00,00,00,00) )) {
+HXLINE( 797) _hx_tmp = null();
+ }
+ else {
+HXLINE( 797) _hx_tmp = ( (::String)(row->__Field(HX_("mam_id",01,4d,19,b7),::hx::paccDynamic)) );
+ }
+HXDLIN( 797) builder->serverId = _hx_tmp;
+HXLINE( 798) ::String _hx_tmp1;
+HXDLIN( 798) if (::hx::IsEq( row->__Field(HX_("mam_by",fd,46,19,b7),::hx::paccDynamic),HX_("",00,00,00,00) )) {
+HXLINE( 798) _hx_tmp1 = null();
+ }
+ else {
+HXLINE( 798) _hx_tmp1 = ( (::String)(row->__Field(HX_("mam_by",fd,46,19,b7),::hx::paccDynamic)) );
+ }
+HXDLIN( 798) builder->serverIdBy = _hx_tmp1;
+HXLINE( 799) if (::hx::IsNotEq( builder->direction,row->__Field(HX_("direction",3f,62,40,10),::hx::paccDynamic) )) {
+HXLINE( 800) builder->direction = ( (int)(row->__Field(HX_("direction",3f,62,40,10),::hx::paccDynamic)) );
+HXLINE( 801) ::Array< ::Dynamic> replyTo = builder->replyTo;
+HXLINE( 802) builder->replyTo = builder->recipients;
+HXLINE( 803) builder->recipients = replyTo;
+ }
+HXLINE( 805) bool _hx_tmp2;
+HXDLIN( 805) if (::hx::IsNotNull( row->__Field(HX_("stanza_id",25,7b,7a,e9),::hx::paccDynamic) )) {
+HXLINE( 805) _hx_tmp2 = ::hx::IsNotEq( row->__Field(HX_("stanza_id",25,7b,7a,e9),::hx::paccDynamic),HX_("",00,00,00,00) );
+ }
+ else {
+HXLINE( 805) _hx_tmp2 = false;
+ }
+HXDLIN( 805) if (_hx_tmp2) {
+HXLINE( 805) builder->localId = ( (::String)(row->__Field(HX_("stanza_id",25,7b,7a,e9),::hx::paccDynamic)) );
+ }
+HXLINE( 806) if (::hx::IsNotNull( row->__Field(HX_("versions",5b,4e,b8,d6),::hx::paccDynamic) )) {
+HXLINE( 807) ::Dynamic versionTimes = ::haxe::format::JsonParser_obj::__alloc( HX_CTX ,( (::String)(row->__Field(HX_("version_times",1f,50,f9,17),::hx::paccDynamic)) ))->doParse();
+HXLINE( 808) ::Dynamic versions = ::haxe::format::JsonParser_obj::__alloc( HX_CTX ,( (::String)(row->__Field(HX_("versions",5b,4e,b8,d6),::hx::paccDynamic)) ))->doParse();
+HXLINE( 809) if ((::Reflect_obj::fields(versions)->length > 1)) {
+ HX_BEGIN_LOCAL_FUNC_S0(::hx::LocalFunc,_hx_Closure_2) HXARGC(2)
+ int _hx_run( ::snikket::ChatMessage a, ::snikket::ChatMessage b){
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_821_hydrateMessages)
+HXLINE( 821) return ::Reflect_obj::compare(b->timestamp,a->timestamp);
+ }
+ HX_END_LOCAL_FUNC2(return)
+
+HXLINE( 810) {
+HXLINE( 810) ::Dynamic access = versions;
+HXDLIN( 810) ::Dynamic _g_access = access;
+HXDLIN( 810) ::Array< ::String > _g_keys = ::Reflect_obj::fields(access);
+HXDLIN( 810) int _g_index = 0;
+HXDLIN( 810) while((_g_index < _g_keys->length)){
+HXLINE( 810) _g_index = (_g_index + 1);
+HXDLIN( 810) ::String key = _g_keys->__get((_g_index - 1));
+HXDLIN( 810) ::String _g_value = ( (::String)(::Reflect_obj::field(_g_access,key)) );
+HXDLIN( 810) ::String _g_key = key;
+HXDLIN( 810) ::String versionId = _g_key;
+HXDLIN( 810) ::String version = _g_value;
+HXDLIN( 810) {
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_1, ::Dynamic,versionTimes,::String,versionId) HXARGC(2)
+ ::snikket::ChatMessageBuilder _hx_run( ::snikket::ChatMessageBuilder toPushB, ::snikket::Stanza _){
+ HX_GC_STACKFRAME(&_hx_pos_5b1a6b524efab4db_811_hydrateMessages)
+HXLINE( 812) bool versionM;
+HXDLIN( 812) if (::hx::IsNull( toPushB->serverId )) {
+HXLINE( 812) versionM = (versionId != toPushB->localId);
+ }
+ else {
+HXLINE( 812) versionM = false;
+ }
+HXDLIN( 812) if (versionM) {
+HXLINE( 812) toPushB->serverId = versionId;
+ }
+HXLINE( 813) toPushB->timestamp = ( (::String)(::Reflect_obj::field(versionTimes,versionId)) );
+HXLINE( 814) return toPushB;
+ }
+ HX_END_LOCAL_FUNC2(return)
+
+HXLINE( 811) ::snikket::Stanza versionM = ::snikket::Stanza_obj::parse(version);
+HXDLIN( 811) ::snikket::ChatMessage versionM1 = ::snikket::ChatMessage_obj::fromStanza(versionM,accountJid, ::Dynamic(new _hx_Closure_1(versionTimes,versionId)));
+HXLINE( 816) ::snikket::ChatMessage toPush;
+HXDLIN( 816) bool toPush1;
+HXDLIN( 816) if (::hx::IsNotNull( versionM1 )) {
+HXLINE( 816) toPush1 = (versionM1->versions->length < 1);
+ }
+ else {
+HXLINE( 816) toPush1 = true;
+ }
+HXDLIN( 816) if (toPush1) {
+HXLINE( 816) toPush = versionM1;
+ }
+ else {
+HXLINE( 816) toPush = versionM1->versions->__get(0).StaticCast< ::snikket::ChatMessage >();
+ }
+HXLINE( 817) if (::hx::IsNotNull( toPush )) {
+HXLINE( 818) builder->versions->push(toPush);
+ }
+ }
+ }
+ }
+HXLINE( 821) builder->versions->sort( ::Dynamic(new _hx_Closure_2()));
+ }
+ }
+HXLINE( 824) return builder;
+ }
+ HX_END_LOCAL_FUNC2(return)
+
+HXLINE( 792) ::Dynamic x1 = x->__Field(HX_("next",f3,84,02,49),::hx::paccDynamic)();
+HXDLIN( 792) ::Dynamic row = x1;
+HXDLIN( 792) ::snikket::Stanza _hx_tmp = ::snikket::Stanza_obj::parse(( (::String)(row->__Field(HX_("stanza",f5,5d,f7,05),::hx::paccDynamic)) ));
+HXDLIN( 792) _g->push(::snikket::ChatMessage_obj::fromStanza(_hx_tmp,accountJid, ::Dynamic(new _hx_Closure_3(accountJid,row))));
+ }
+ }
+HXDLIN( 792) return _g;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(Sqlite_obj,hydrateMessages,return )
+
+
+::hx::ObjectPtr< Sqlite_obj > Sqlite_obj::__new(::String dbfile,::Dynamic media) {
+ ::hx::ObjectPtr< Sqlite_obj > __this = new Sqlite_obj();
+ __this->__construct(dbfile,media);
+ return __this;
+}
+
+::hx::ObjectPtr< Sqlite_obj > Sqlite_obj::__alloc(::hx::Ctx *_hx_ctx,::String dbfile,::Dynamic media) {
+ Sqlite_obj *__this = (Sqlite_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Sqlite_obj), true, "snikket.persistence.Sqlite"));
+ *(void **)__this = Sqlite_obj::_hx_vtable;
+ __this->__construct(dbfile,media);
+ return __this;
+}
+
+Sqlite_obj::Sqlite_obj()
+{
+}
+
+void Sqlite_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(Sqlite);
+ HX_MARK_MEMBER_NAME(db,"db");
+ HX_MARK_MEMBER_NAME(media,"media");
+ HX_MARK_MEMBER_NAME(storeChatBuffer,"storeChatBuffer");
+ HX_MARK_MEMBER_NAME(storeChatTimer,"storeChatTimer");
+ HX_MARK_MEMBER_NAME(smStoreInProgress,"smStoreInProgress");
+ HX_MARK_MEMBER_NAME(smStoreNext,"smStoreNext");
+ HX_MARK_END_CLASS();
+}
+
+void Sqlite_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(db,"db");
+ HX_VISIT_MEMBER_NAME(media,"media");
+ HX_VISIT_MEMBER_NAME(storeChatBuffer,"storeChatBuffer");
+ HX_VISIT_MEMBER_NAME(storeChatTimer,"storeChatTimer");
+ HX_VISIT_MEMBER_NAME(smStoreInProgress,"smStoreInProgress");
+ HX_VISIT_MEMBER_NAME(smStoreNext,"smStoreNext");
+}
+
+::hx::Val Sqlite_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 2:
+ if (HX_FIELD_EQ(inName,"db") ) { return ::hx::Val( db ); }
+ break;
+ case 3:
+ if (HX_FIELD_EQ(inName,"get") ) { return ::hx::Val( get_dyn() ); }
+ if (HX_FIELD_EQ(inName,"set") ) { return ::hx::Val( set_dyn() ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"media") ) { return ::hx::Val( media ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"lastId") ) { return ::hx::Val( lastId_dyn() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"getCaps") ) { return ::hx::Val( getCaps_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"getChats") ) { return ::hx::Val( getChats_dyn() ); }
+ if (HX_FIELD_EQ(inName,"hasMedia") ) { return ::hx::Val( hasMedia_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getLogin") ) { return ::hx::Val( getLogin_dyn() ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"storeCaps") ) { return ::hx::Val( storeCaps_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"storeChats") ) { return ::hx::Val( storeChats_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getMessage") ) { return ::hx::Val( getMessage_dyn() ); }
+ if (HX_FIELD_EQ(inName,"storeMedia") ) { return ::hx::Val( storeMedia_dyn() ); }
+ if (HX_FIELD_EQ(inName,"storeLogin") ) { return ::hx::Val( storeLogin_dyn() ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"getMessages") ) { return ::hx::Val( getMessages_dyn() ); }
+ if (HX_FIELD_EQ(inName,"removeMedia") ) { return ::hx::Val( removeMedia_dyn() ); }
+ if (HX_FIELD_EQ(inName,"smStoreNext") ) { return ::hx::Val( smStoreNext ); }
+ break;
+ case 12:
+ if (HX_FIELD_EQ(inName,"listAccounts") ) { return ::hx::Val( listAccounts_dyn() ); }
+ if (HX_FIELD_EQ(inName,"storeService") ) { return ::hx::Val( storeService_dyn() ); }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"storeMessages") ) { return ::hx::Val( storeMessages_dyn() ); }
+ if (HX_FIELD_EQ(inName,"updateMessage") ) { return ::hx::Val( updateMessage_dyn() ); }
+ if (HX_FIELD_EQ(inName,"storeReaction") ) { return ::hx::Val( storeReaction_dyn() ); }
+ if (HX_FIELD_EQ(inName,"removeAccount") ) { return ::hx::Val( removeAccount_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"storeChatTimer") ) { return ::hx::Val( storeChatTimer ); }
+ if (HX_FIELD_EQ(inName,"fetchReactions") ) { return ::hx::Val( fetchReactions_dyn() ); }
+ if (HX_FIELD_EQ(inName,"hydrateReplyTo") ) { return ::hx::Val( hydrateReplyTo_dyn() ); }
+ break;
+ case 15:
+ if (HX_FIELD_EQ(inName,"storeChatBuffer") ) { return ::hx::Val( storeChatBuffer ); }
+ if (HX_FIELD_EQ(inName,"hydrateMessages") ) { return ::hx::Val( hydrateMessages_dyn() ); }
+ break;
+ case 16:
+ if (HX_FIELD_EQ(inName,"getMessagesAfter") ) { return ::hx::Val( getMessagesAfter_dyn() ); }
+ if (HX_FIELD_EQ(inName,"hydrateReactions") ) { return ::hx::Val( hydrateReactions_dyn() ); }
+ break;
+ case 17:
+ if (HX_FIELD_EQ(inName,"getMessagesBefore") ) { return ::hx::Val( getMessagesBefore_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getMessagesAround") ) { return ::hx::Val( getMessagesAround_dyn() ); }
+ if (HX_FIELD_EQ(inName,"smStoreInProgress") ) { return ::hx::Val( smStoreInProgress ); }
+ break;
+ case 19:
+ if (HX_FIELD_EQ(inName,"updateMessageStatus") ) { return ::hx::Val( updateMessageStatus_dyn() ); }
+ if (HX_FIELD_EQ(inName,"getStreamManagement") ) { return ::hx::Val( getStreamManagement_dyn() ); }
+ break;
+ case 21:
+ if (HX_FIELD_EQ(inName,"getChatsUnreadDetails") ) { return ::hx::Val( getChatsUnreadDetails_dyn() ); }
+ if (HX_FIELD_EQ(inName,"storeStreamManagement") ) { return ::hx::Val( storeStreamManagement_dyn() ); }
+ break;
+ case 23:
+ if (HX_FIELD_EQ(inName,"findServicesWithFeature") ) { return ::hx::Val( findServicesWithFeature_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val Sqlite_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 2:
+ if (HX_FIELD_EQ(inName,"db") ) { db=inValue.Cast< ::snikket::persistence::SqliteDriver >(); return inValue; }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"media") ) { media=inValue.Cast< ::Dynamic >(); return inValue; }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"smStoreNext") ) { smStoreNext=inValue.Cast< ::Array< unsigned char > >(); return inValue; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"storeChatTimer") ) { storeChatTimer=inValue.Cast< ::haxe::Timer >(); return inValue; }
+ break;
+ case 15:
+ if (HX_FIELD_EQ(inName,"storeChatBuffer") ) { storeChatBuffer=inValue.Cast< ::haxe::ds::StringMap >(); return inValue; }
+ break;
+ case 17:
+ if (HX_FIELD_EQ(inName,"smStoreInProgress") ) { smStoreInProgress=inValue.Cast< bool >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void Sqlite_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("db",7e,57,00,00));
+ outFields->push(HX_("media",e4,04,bc,05));
+ outFields->push(HX_("storeChatBuffer",39,5d,98,0f));
+ outFields->push(HX_("storeChatTimer",ac,c9,9a,09));
+ outFields->push(HX_("smStoreInProgress",79,f8,70,5d));
+ outFields->push(HX_("smStoreNext",7a,e1,91,0a));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Sqlite_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::snikket::persistence::SqliteDriver */ ,(int)offsetof(Sqlite_obj,db),HX_("db",7e,57,00,00)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(Sqlite_obj,media),HX_("media",e4,04,bc,05)},
+ {::hx::fsObject /* ::haxe::ds::StringMap */ ,(int)offsetof(Sqlite_obj,storeChatBuffer),HX_("storeChatBuffer",39,5d,98,0f)},
+ {::hx::fsObject /* ::haxe::Timer */ ,(int)offsetof(Sqlite_obj,storeChatTimer),HX_("storeChatTimer",ac,c9,9a,09)},
+ {::hx::fsBool,(int)offsetof(Sqlite_obj,smStoreInProgress),HX_("smStoreInProgress",79,f8,70,5d)},
+ {::hx::fsObject /* ::Array< unsigned char > */ ,(int)offsetof(Sqlite_obj,smStoreNext),HX_("smStoreNext",7a,e1,91,0a)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *Sqlite_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Sqlite_obj_sMemberFields[] = {
+ HX_("db",7e,57,00,00),
+ HX_("media",e4,04,bc,05),
+ HX_("get",96,80,4e,00),
+ HX_("set",a2,9b,57,00),
+ HX_("lastId",d1,0b,c5,54),
+ HX_("storeChatBuffer",39,5d,98,0f),
+ HX_("storeChatTimer",ac,c9,9a,09),
+ HX_("storeChats",fa,4a,32,83),
+ HX_("getChats",25,ae,8a,a5),
+ HX_("storeMessages",cd,f1,bd,e9),
+ HX_("updateMessage",be,9a,7f,65),
+ HX_("getMessage",d1,bb,72,e9),
+ HX_("getMessages",82,9b,f1,5a),
+ HX_("getMessagesBefore",a1,f1,44,11),
+ HX_("getMessagesAfter",3a,43,91,57),
+ HX_("getMessagesAround",6f,95,16,2d),
+ HX_("getChatsUnreadDetails",ee,d4,5a,85),
+ HX_("storeReaction",aa,00,75,ab),
+ HX_("updateMessageStatus",90,98,ad,0f),
+ HX_("hasMedia",2a,4f,14,92),
+ HX_("removeMedia",00,e2,ef,03),
+ HX_("storeMedia",43,b1,3a,43),
+ HX_("storeCaps",a2,60,d7,9d),
+ HX_("getCaps",d7,cb,3c,14),
+ HX_("storeLogin",c8,85,72,b6),
+ HX_("getLogin",f3,e8,ca,d8),
+ HX_("removeAccount",c9,58,14,7a),
+ HX_("listAccounts",a4,81,e8,f5),
+ HX_("smStoreInProgress",79,f8,70,5d),
+ HX_("smStoreNext",7a,e1,91,0a),
+ HX_("storeStreamManagement",24,1d,b8,8d),
+ HX_("getStreamManagement",d9,03,ec,6c),
+ HX_("storeService",54,de,f6,9d),
+ HX_("findServicesWithFeature",99,4e,bd,4a),
+ HX_("hydrateReactions",97,c5,06,27),
+ HX_("fetchReactions",10,41,6b,5e),
+ HX_("hydrateReplyTo",f2,64,45,9b),
+ HX_("hydrateMessages",7f,1c,88,4e),
+ ::String(null()) };
+
+::hx::Class Sqlite_obj::__mClass;
+
+void Sqlite_obj::__register()
+{
+ Sqlite_obj _hx_dummy;
+ Sqlite_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.persistence.Sqlite",6c,cb,15,e4);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Sqlite_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Sqlite_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Sqlite_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Sqlite_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+void Sqlite_obj::__boot()
+{
+{
+ HX_STACKFRAME(&_hx_pos_5b1a6b524efab4db_24_boot)
+HXDLIN( 24) __mClass->__meta__ = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("fields",79,8e,8e,80), ::Dynamic(::hx::Anon_obj::Create(28)
+ ->setFixed(0,HX_("storeChats",fa,4a,32,83), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(1,HX_("getChatsUnreadDetails",ee,d4,5a,85), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(2,HX_("storeStreamManagement",24,1d,b8,8d), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(3,HX_("hasMedia",2a,4f,14,92), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(4,HX_("listAccounts__fromC",55,2b,d7,97), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(5,HX_("storeCaps",a2,60,d7,9d), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(6,HX_("storeService",54,de,f6,9d), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(7,HX_("getChats",25,ae,8a,a5), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(8,HX_("storeReaction",aa,00,75,ab), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(9,HX_("storeLogin",c8,85,72,b6), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(10,HX_("getLogin",f3,e8,ca,d8), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(11,HX_("getMessage",d1,bb,72,e9), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(12,HX_("storeMessages",cd,f1,bd,e9), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(13,HX_("listAccounts",a4,81,e8,f5), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),::cpp::VirtualArray_obj::__new(1)->init(0,HX_("wrapped",45,d5,64,0d)))))
+ ->setFixed(14,HX_("get",96,80,4e,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(15,HX_("set",a2,9b,57,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(16,HX_("removeMedia",00,e2,ef,03), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(17,HX_("getMessage__fromC",c8,40,46,05), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.wrapper",8b,ea,27,d4),null())))
+ ->setFixed(18,HX_("updateMessageStatus",90,98,ad,0f), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(19,HX_("getMessagesBefore",a1,f1,44,11), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(20,HX_("getCaps",d7,cb,3c,14), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(21,HX_("getMessagesAround",6f,95,16,2d), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(22,HX_("storeMedia",43,b1,3a,43), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(23,HX_("findServicesWithFeature",99,4e,bd,4a), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(24,HX_("lastId",d1,0b,c5,54), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(25,HX_("getMessagesAfter",3a,43,91,57), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(26,HX_("updateMessage",be,9a,7f,65), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null())))
+ ->setFixed(27,HX_("getStreamManagement",d9,03,ec,6c), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("HaxeCBridge.noemit",dc,2c,99,2f),null()))))));
+ }
+}
+
+} // end namespace snikket
+} // end namespace persistence
diff --git a/Sources/c_snikket/src/snikket/persistence/SqliteDriver.cpp b/Sources/c_snikket/src/snikket/persistence/SqliteDriver.cpp
new file mode 100644
index 0000000..875ead9
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/persistence/SqliteDriver.cpp
@@ -0,0 +1,284 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_EReg
+#include <EReg.h>
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_Type
+#include <Type.h>
+#endif
+#ifndef INCLUDED_ValueType
+#include <ValueType.h>
+#endif
+#ifndef INCLUDED_haxe_Log
+#include <haxe/Log.h>
+#endif
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+#ifndef INCLUDED_snikket_persistence_SqliteDriver
+#include <snikket/persistence/SqliteDriver.h>
+#endif
+#ifndef INCLUDED_sys_db_Connection
+#include <sys/db/Connection.h>
+#endif
+#ifndef INCLUDED_sys_db_ResultSet
+#include <sys/db/ResultSet.h>
+#endif
+#ifndef INCLUDED_sys_db_Sqlite
+#include <sys/db/Sqlite.h>
+#endif
+#ifndef INCLUDED_thenshim_Thenable
+#include <thenshim/Thenable.h>
+#endif
+#ifndef INCLUDED_thenshim__Promise_Promise_Impl_
+#include <thenshim/_Promise/Promise_Impl_.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_5c401225cb14c98d_12_new,"snikket.persistence.SqliteDriver","new",0x358a23a6,"snikket.persistence.SqliteDriver.new","snikket/persistence/SqliteDriver.hx",12,0xaa839748)
+HX_LOCAL_STACK_FRAME(_hx_pos_5c401225cb14c98d_15_exec,"snikket.persistence.SqliteDriver","exec",0x9d707d8b,"snikket.persistence.SqliteDriver.exec","snikket/persistence/SqliteDriver.hx",15,0xaa839748)
+HX_LOCAL_STACK_FRAME(_hx_pos_5c401225cb14c98d_40_prepare,"snikket.persistence.SqliteDriver","prepare",0xd045ffcd,"snikket.persistence.SqliteDriver.prepare","snikket/persistence/SqliteDriver.hx",40,0xaa839748)
+HX_LOCAL_STACK_FRAME(_hx_pos_5c401225cb14c98d_39_prepare,"snikket.persistence.SqliteDriver","prepare",0xd045ffcd,"snikket.persistence.SqliteDriver.prepare","snikket/persistence/SqliteDriver.hx",39,0xaa839748)
+namespace snikket{
+namespace persistence{
+
+void SqliteDriver_obj::__construct(::String dbfile){
+ HX_STACKFRAME(&_hx_pos_5c401225cb14c98d_12_new)
+HXDLIN( 12) this->db = ::sys::db::Sqlite_obj::open(dbfile);
+ }
+
+Dynamic SqliteDriver_obj::__CreateEmpty() { return new SqliteDriver_obj; }
+
+void *SqliteDriver_obj::_hx_vtable = 0;
+
+Dynamic SqliteDriver_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< SqliteDriver_obj > _hx_result = new SqliteDriver_obj();
+ _hx_result->__construct(inArgs[0]);
+ return _hx_result;
+}
+
+bool SqliteDriver_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x0672539a;
+}
+
+::Dynamic SqliteDriver_obj::exec( ::Dynamic sql,::cpp::VirtualArray params){
+ HX_STACKFRAME(&_hx_pos_5c401225cb14c98d_15_exec)
+HXLINE( 16) ::Dynamic result = null();
+HXLINE( 17) ::cpp::VirtualArray qs;
+HXDLIN( 17) if (::Std_obj::isOfType(sql,::hx::ClassOf< ::String >())) {
+HXLINE( 17) qs = ::cpp::VirtualArray_obj::__new(1)->init(0,sql);
+ }
+ else {
+HXLINE( 17) qs = ::hx::TCast< ::cpp::VirtualArray >::cast(sql);
+ }
+HXLINE( 23) {
+HXLINE( 23) int _g = 0;
+HXDLIN( 23) while((_g < qs->get_length())){
+HXLINE( 23) ::Dynamic q = qs->__get(_g);
+HXDLIN( 23) _g = (_g + 1);
+HXLINE( 24) if (::hx::IsNull( result )) {
+HXLINE( 25) ::cpp::VirtualArray tmp = params;
+HXDLIN( 25) ::cpp::VirtualArray prepared;
+HXDLIN( 25) if (::hx::IsNotNull( tmp )) {
+HXLINE( 25) prepared = tmp;
+ }
+ else {
+HXLINE( 25) prepared = ::cpp::VirtualArray_obj::__new(0);
+ }
+HXDLIN( 25) ::String prepared1 = this->prepare(( (::String)(q) ),prepared);
+HXLINE( 26) ::haxe::Log_obj::trace(HX_("SQL",ee,41,3f,00), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.persistence.SqliteDriver",b4,18,c2,cb))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,prepared1))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("exec",91,f3,1d,43))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/persistence/SqliteDriver.hx",48,97,83,aa))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),26)));
+HXLINE( 27) result = ::sys::db::Connection_obj::request(this->db,prepared1);
+HXLINE( 28) ::haxe::Log_obj::trace(HX_("SQLr",c4,6e,1a,37), ::Dynamic(::hx::Anon_obj::Create(5)
+ ->setFixed(0,HX_("className",a3,92,3d,dc),HX_("snikket.persistence.SqliteDriver",b4,18,c2,cb))
+ ->setFixed(1,HX_("customParams",d7,51,18,ed),::cpp::VirtualArray_obj::__new(1)->init(0,result))
+ ->setFixed(2,HX_("methodName",cc,19,0f,12),HX_("exec",91,f3,1d,43))
+ ->setFixed(3,HX_("fileName",e7,5a,43,62),HX_("snikket/persistence/SqliteDriver.hx",48,97,83,aa))
+ ->setFixed(4,HX_("lineNumber",dd,81,22,76),28)));
+ }
+ else {
+HXLINE( 30) ::sys::db::Connection_obj::request(this->db,q);
+ }
+ }
+ }
+HXLINE( 33) return ::thenshim::_Promise::Promise_Impl__obj::resolve(result);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(SqliteDriver_obj,exec,return )
+
+::String SqliteDriver_obj::prepare(::String sql,::cpp::VirtualArray params){
+ HX_BEGIN_LOCAL_FUNC_S2(::hx::LocalFunc,_hx_Closure_0, ::snikket::persistence::SqliteDriver,_gthis,::cpp::VirtualArray,params) HXARGC(1)
+ ::String _hx_run( ::EReg f){
+ HX_GC_STACKFRAME(&_hx_pos_5c401225cb14c98d_40_prepare)
+HXLINE( 41) ::Dynamic p = params->shift();
+HXLINE( 42) ::ValueType _g = ::Type_obj::_hx_typeof(p);
+HXDLIN( 42) switch((int)(_g->_hx_getIndex())){
+ case (int)0: {
+HXLINE( 52) return HX_("NULL",87,66,cf,33);
+ }
+ break;
+ case (int)1: {
+HXLINE( 50) return ::Std_obj::string(p);
+ }
+ break;
+ case (int)2: {
+HXLINE( 48) return ::Std_obj::string(p);
+ }
+ break;
+ case (int)3: {
+HXLINE( 46) if (::hx::IsEq( p,true )) {
+HXLINE( 46) return HX_("1",31,00,00,00);
+ }
+ else {
+HXLINE( 46) return HX_("0",30,00,00,00);
+ }
+ }
+ break;
+ case (int)6: {
+HXLINE( 56) ::hx::Class _hx_switch_0 = _g->_hx_getObject(0).StaticCast< ::hx::Class >();
+ if ( (_hx_switch_0==::hx::ArrayBase::__mClass) ){
+HXLINE( 54) ::haxe::io::Bytes bytes = ::haxe::io::Bytes_obj::ofData(( (::Array< unsigned char >)(p) ));
+HXLINE( 55) return ((HX_("X'",cf,4c,00,00) + bytes->toHex()) + HX_("'",27,00,00,00));
+HXLINE( 53) goto _hx_goto_3;
+ }
+ if ( (_hx_switch_0==::hx::ClassOf< ::String >()) ){
+HXLINE( 44) return ::sys::db::Connection_obj::quote(_gthis->db,p);
+HXDLIN( 44) goto _hx_goto_3;
+ }
+ if ( (_hx_switch_0==::hx::ClassOf< ::haxe::io::Bytes >()) ){
+HXLINE( 57) ::haxe::io::Bytes bytes1 = ( ( ::haxe::io::Bytes)(p) );
+HXLINE( 58) return ((HX_("X'",cf,4c,00,00) + bytes1->toHex()) + HX_("'",27,00,00,00));
+HXLINE( 56) goto _hx_goto_3;
+ }
+ /* default */{
+HXLINE( 60) HX_STACK_DO_THROW((HX_("UKNONWN: ",54,2e,a9,30) + ::Std_obj::string(::Type_obj::_hx_typeof(p))));
+ }
+ _hx_goto_3:;
+ }
+ break;
+ default:{
+HXLINE( 60) HX_STACK_DO_THROW((HX_("UKNONWN: ",54,2e,a9,30) + ::Std_obj::string(::Type_obj::_hx_typeof(p))));
+ }
+ }
+HXLINE( 42) return null();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_GC_STACKFRAME(&_hx_pos_5c401225cb14c98d_39_prepare)
+HXDLIN( 39) ::snikket::persistence::SqliteDriver _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 40) return ::EReg_obj::__alloc( HX_CTX ,HX_("\\?",63,50,00,00),HX_("gm",26,5a,00,00))->map(sql, ::Dynamic(new _hx_Closure_0(_gthis,params)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(SqliteDriver_obj,prepare,return )
+
+
+::hx::ObjectPtr< SqliteDriver_obj > SqliteDriver_obj::__new(::String dbfile) {
+ ::hx::ObjectPtr< SqliteDriver_obj > __this = new SqliteDriver_obj();
+ __this->__construct(dbfile);
+ return __this;
+}
+
+::hx::ObjectPtr< SqliteDriver_obj > SqliteDriver_obj::__alloc(::hx::Ctx *_hx_ctx,::String dbfile) {
+ SqliteDriver_obj *__this = (SqliteDriver_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(SqliteDriver_obj), true, "snikket.persistence.SqliteDriver"));
+ *(void **)__this = SqliteDriver_obj::_hx_vtable;
+ __this->__construct(dbfile);
+ return __this;
+}
+
+SqliteDriver_obj::SqliteDriver_obj()
+{
+}
+
+void SqliteDriver_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(SqliteDriver);
+ HX_MARK_MEMBER_NAME(db,"db");
+ HX_MARK_END_CLASS();
+}
+
+void SqliteDriver_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(db,"db");
+}
+
+::hx::Val SqliteDriver_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 2:
+ if (HX_FIELD_EQ(inName,"db") ) { return ::hx::Val( db ); }
+ break;
+ case 4:
+ if (HX_FIELD_EQ(inName,"exec") ) { return ::hx::Val( exec_dyn() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"prepare") ) { return ::hx::Val( prepare_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val SqliteDriver_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 2:
+ if (HX_FIELD_EQ(inName,"db") ) { db=inValue.Cast< ::Dynamic >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void SqliteDriver_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("db",7e,57,00,00));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo SqliteDriver_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(SqliteDriver_obj,db),HX_("db",7e,57,00,00)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *SqliteDriver_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String SqliteDriver_obj_sMemberFields[] = {
+ HX_("db",7e,57,00,00),
+ HX_("exec",91,f3,1d,43),
+ HX_("prepare",87,91,dd,37),
+ ::String(null()) };
+
+::hx::Class SqliteDriver_obj::__mClass;
+
+void SqliteDriver_obj::__register()
+{
+ SqliteDriver_obj _hx_dummy;
+ SqliteDriver_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.persistence.SqliteDriver",b4,18,c2,cb);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(SqliteDriver_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< SqliteDriver_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = SqliteDriver_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = SqliteDriver_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace persistence
diff --git a/Sources/c_snikket/src/snikket/queries/BlocklistGet.cpp b/Sources/c_snikket/src/snikket/queries/BlocklistGet.cpp
new file mode 100644
index 0000000..8134081
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/queries/BlocklistGet.cpp
@@ -0,0 +1,232 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_snikket_ID
+#include <snikket/ID.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_queries_BlocklistGet
+#include <snikket/queries/BlocklistGet.h>
+#endif
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_244c9ad5c68e0db2_12_new,"snikket.queries.BlocklistGet","new",0x566d57d6,"snikket.queries.BlocklistGet.new","snikket/queries/BlocklistGet.hx",12,0xec59fd98)
+HX_LOCAL_STACK_FRAME(_hx_pos_244c9ad5c68e0db2_26_handleResponse,"snikket.queries.BlocklistGet","handleResponse",0x4f763693,"snikket.queries.BlocklistGet.handleResponse","snikket/queries/BlocklistGet.hx",26,0xec59fd98)
+HX_LOCAL_STACK_FRAME(_hx_pos_244c9ad5c68e0db2_31_getResult,"snikket.queries.BlocklistGet","getResult",0xf0387609,"snikket.queries.BlocklistGet.getResult","snikket/queries/BlocklistGet.hx",31,0xec59fd98)
+namespace snikket{
+namespace queries{
+
+void BlocklistGet_obj::__construct(){
+ HX_GC_STACKFRAME(&_hx_pos_244c9ad5c68e0db2_12_new)
+HXLINE( 14) this->queryId = null();
+HXLINE( 13) this->xmlns = HX_("urn:xmpp:blocking",d1,a1,46,c3);
+HXLINE( 19) super::__construct();
+HXLINE( 21) this->queryId = ::snikket::ID_obj::_hx_short();
+HXLINE( 22) this->queryStanza = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("iq",e8,5b,00,00), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("id",db,5b,00,00),this->queryId)
+ ->setFixed(1,HX_("type",ba,f2,08,4d),HX_("get",96,80,4e,00))))->tag(HX_("blocklist",2b,bc,68,62), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),this->xmlns)))->up();
+ }
+
+Dynamic BlocklistGet_obj::__CreateEmpty() { return new BlocklistGet_obj; }
+
+void *BlocklistGet_obj::_hx_vtable = 0;
+
+Dynamic BlocklistGet_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< BlocklistGet_obj > _hx_result = new BlocklistGet_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool BlocklistGet_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x22eda35a) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x22eda35a;
+ } else {
+ return inClassId==(int)0x60103714;
+ }
+}
+
+void BlocklistGet_obj::handleResponse( ::snikket::Stanza stanza){
+ HX_STACKFRAME(&_hx_pos_244c9ad5c68e0db2_26_handleResponse)
+HXLINE( 27) this->responseStanza = stanza;
+HXLINE( 28) this->finish();
+ }
+
+
+::Array< ::String > BlocklistGet_obj::getResult(){
+ HX_STACKFRAME(&_hx_pos_244c9ad5c68e0db2_31_getResult)
+HXLINE( 32) if (::hx::IsNull( this->responseStanza )) {
+HXLINE( 33) return ::Array_obj< ::String >::__new(0);
+ }
+HXLINE( 35) if (::hx::IsNull( this->result )) {
+HXLINE( 36) ::snikket::Stanza q = this->responseStanza->getChild(HX_("blocklist",2b,bc,68,62),this->xmlns);
+HXLINE( 37) if (::hx::IsNull( q )) {
+HXLINE( 38) return ::Array_obj< ::String >::__new(0);
+ }
+HXLINE( 41) ::Array< ::Dynamic> _this = q->allTags(HX_("item",13,c5,bf,45),null());
+HXDLIN( 41) ::Array< ::String > result = ::Array_obj< ::String >::__new(_this->length);
+HXDLIN( 41) {
+HXLINE( 41) int _g = 0;
+HXDLIN( 41) int _g1 = _this->length;
+HXDLIN( 41) while((_g < _g1)){
+HXLINE( 41) _g = (_g + 1);
+HXDLIN( 41) int i = (_g - 1);
+HXDLIN( 41) {
+HXLINE( 41) ::String inValue = ( (::String)(::Reflect_obj::field(( ( ::snikket::Stanza)(_hx_array_unsafe_get(_this,i)) )->attr,HX_("jid",c5,ca,50,00))) );
+HXDLIN( 41) result->__unsafe_set(i,inValue);
+ }
+ }
+ }
+HXDLIN( 41) this->result = result;
+ }
+HXLINE( 43) return this->result;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(BlocklistGet_obj,getResult,return )
+
+
+::hx::ObjectPtr< BlocklistGet_obj > BlocklistGet_obj::__new() {
+ ::hx::ObjectPtr< BlocklistGet_obj > __this = new BlocklistGet_obj();
+ __this->__construct();
+ return __this;
+}
+
+::hx::ObjectPtr< BlocklistGet_obj > BlocklistGet_obj::__alloc(::hx::Ctx *_hx_ctx) {
+ BlocklistGet_obj *__this = (BlocklistGet_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(BlocklistGet_obj), true, "snikket.queries.BlocklistGet"));
+ *(void **)__this = BlocklistGet_obj::_hx_vtable;
+ __this->__construct();
+ return __this;
+}
+
+BlocklistGet_obj::BlocklistGet_obj()
+{
+}
+
+void BlocklistGet_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(BlocklistGet);
+ HX_MARK_MEMBER_NAME(xmlns,"xmlns");
+ HX_MARK_MEMBER_NAME(queryId,"queryId");
+ HX_MARK_MEMBER_NAME(responseStanza,"responseStanza");
+ HX_MARK_MEMBER_NAME(result,"result");
+ ::snikket::queries::GenericQuery_obj::__Mark(HX_MARK_ARG);
+ HX_MARK_END_CLASS();
+}
+
+void BlocklistGet_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(xmlns,"xmlns");
+ HX_VISIT_MEMBER_NAME(queryId,"queryId");
+ HX_VISIT_MEMBER_NAME(responseStanza,"responseStanza");
+ HX_VISIT_MEMBER_NAME(result,"result");
+ ::snikket::queries::GenericQuery_obj::__Visit(HX_VISIT_ARG);
+}
+
+::hx::Val BlocklistGet_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"xmlns") ) { return ::hx::Val( xmlns ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"result") ) { return ::hx::Val( result ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"queryId") ) { return ::hx::Val( queryId ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"getResult") ) { return ::hx::Val( getResult_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"responseStanza") ) { return ::hx::Val( responseStanza ); }
+ if (HX_FIELD_EQ(inName,"handleResponse") ) { return ::hx::Val( handleResponse_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val BlocklistGet_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"xmlns") ) { xmlns=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"result") ) { result=inValue.Cast< ::Array< ::String > >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"queryId") ) { queryId=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"responseStanza") ) { responseStanza=inValue.Cast< ::snikket::Stanza >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void BlocklistGet_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("xmlns",dc,31,74,60));
+ outFields->push(HX_("queryId",03,9d,e9,95));
+ outFields->push(HX_("responseStanza",56,d7,9f,78));
+ outFields->push(HX_("result",dd,68,84,08));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo BlocklistGet_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(BlocklistGet_obj,xmlns),HX_("xmlns",dc,31,74,60)},
+ {::hx::fsString,(int)offsetof(BlocklistGet_obj,queryId),HX_("queryId",03,9d,e9,95)},
+ {::hx::fsObject /* ::snikket::Stanza */ ,(int)offsetof(BlocklistGet_obj,responseStanza),HX_("responseStanza",56,d7,9f,78)},
+ {::hx::fsObject /* ::Array< ::String > */ ,(int)offsetof(BlocklistGet_obj,result),HX_("result",dd,68,84,08)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *BlocklistGet_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String BlocklistGet_obj_sMemberFields[] = {
+ HX_("xmlns",dc,31,74,60),
+ HX_("queryId",03,9d,e9,95),
+ HX_("responseStanza",56,d7,9f,78),
+ HX_("result",dd,68,84,08),
+ HX_("handleResponse",49,d6,e3,ef),
+ HX_("getResult",13,f2,da,84),
+ ::String(null()) };
+
+::hx::Class BlocklistGet_obj::__mClass;
+
+void BlocklistGet_obj::__register()
+{
+ BlocklistGet_obj _hx_dummy;
+ BlocklistGet_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.queries.BlocklistGet",e4,74,8b,53);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(BlocklistGet_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< BlocklistGet_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = BlocklistGet_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = BlocklistGet_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace queries
diff --git a/Sources/c_snikket/src/snikket/queries/BoB.cpp b/Sources/c_snikket/src/snikket/queries/BoB.cpp
new file mode 100644
index 0000000..9f20d11
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/queries/BoB.cpp
@@ -0,0 +1,297 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_StringTools
+#include <StringTools.h>
+#endif
+#ifndef INCLUDED_haxe_crypto_Base64
+#include <haxe/crypto/Base64.h>
+#endif
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+#ifndef INCLUDED_snikket_Hash
+#include <snikket/Hash.h>
+#endif
+#ifndef INCLUDED_snikket_ID
+#include <snikket/ID.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_queries_BoB
+#include <snikket/queries/BoB.h>
+#endif
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_e19ddf21073603db_7_new,"snikket.queries.BoB","new",0x1ec3bc2e,"snikket.queries.BoB.new","snikket/queries/BoB.hx",7,0x20487984)
+HX_LOCAL_STACK_FRAME(_hx_pos_e19ddf21073603db_30_handleResponse,"snikket.queries.BoB","handleResponse",0xbb80013b,"snikket.queries.BoB.handleResponse","snikket/queries/BoB.hx",30,0x20487984)
+HX_LOCAL_STACK_FRAME(_hx_pos_e19ddf21073603db_35_getResult,"snikket.queries.BoB","getResult",0x4ad2ac61,"snikket.queries.BoB.getResult","snikket/queries/BoB.hx",35,0x20487984)
+HX_LOCAL_STACK_FRAME(_hx_pos_e19ddf21073603db_27_forHash,"snikket.queries.BoB","forHash",0x0f86c645,"snikket.queries.BoB.forHash","snikket/queries/BoB.hx",27,0x20487984)
+namespace snikket{
+namespace queries{
+
+void BoB_obj::__construct(::String to,::String uri){
+ HX_GC_STACKFRAME(&_hx_pos_e19ddf21073603db_7_new)
+HXLINE( 13) this->xmlns = HX_("urn:xmpp:bob",59,b7,fd,c9);
+HXLINE( 18) super::__construct();
+HXLINE( 19) bool _hx_tmp;
+HXDLIN( 19) bool _hx_tmp1;
+HXDLIN( 19) if (::StringTools_obj::startsWith(uri,HX_("cid:",7c,23,c0,41))) {
+HXLINE( 19) _hx_tmp1 = !(::StringTools_obj::endsWith(uri,HX_("@bob.xmpp.org",04,79,99,e7)));
+ }
+ else {
+HXLINE( 19) _hx_tmp1 = true;
+ }
+HXDLIN( 19) if (!(_hx_tmp1)) {
+HXLINE( 19) _hx_tmp = (uri.indexOf(HX_("+",2b,00,00,00),null()) == -1);
+ }
+ else {
+HXLINE( 19) _hx_tmp = true;
+ }
+HXDLIN( 19) if (_hx_tmp) {
+HXLINE( 19) HX_STACK_DO_THROW(HX_("invalid BoB URI",38,fd,eb,ca));
+ }
+HXLINE( 21) this->queryId = ::snikket::ID_obj::_hx_short();
+HXLINE( 22) ::snikket::Stanza _hx_tmp2 = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("iq",e8,5b,00,00), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("id",db,5b,00,00),this->queryId)
+ ->setFixed(1,HX_("to",7b,65,00,00),to)
+ ->setFixed(2,HX_("type",ba,f2,08,4d),HX_("get",96,80,4e,00))));
+HXLINE( 23) ::String _hx_tmp3 = this->xmlns;
+HXLINE( 22) this->queryStanza = _hx_tmp2->tag(HX_("data",2a,56,63,42), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("cid",fe,7a,4b,00),uri.substr(4,null()))
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),_hx_tmp3)))->up();
+ }
+
+Dynamic BoB_obj::__CreateEmpty() { return new BoB_obj; }
+
+void *BoB_obj::_hx_vtable = 0;
+
+Dynamic BoB_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< BoB_obj > _hx_result = new BoB_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1]);
+ return _hx_result;
+}
+
+bool BoB_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x22eda35a) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x22eda35a;
+ } else {
+ return inClassId==(int)0x6fef110c;
+ }
+}
+
+void BoB_obj::handleResponse( ::snikket::Stanza stanza){
+ HX_STACKFRAME(&_hx_pos_e19ddf21073603db_30_handleResponse)
+HXLINE( 31) this->responseStanza = stanza;
+HXLINE( 32) this->finish();
+ }
+
+
+ ::Dynamic BoB_obj::getResult(){
+ HX_STACKFRAME(&_hx_pos_e19ddf21073603db_35_getResult)
+HXLINE( 36) if (::hx::IsNull( this->responseStanza )) {
+HXLINE( 37) return null();
+ }
+HXLINE( 39) if (::hx::IsNull( this->result )) {
+HXLINE( 40) ::snikket::Stanza data = this->responseStanza->getChild(HX_("data",2a,56,63,42),this->xmlns);
+HXLINE( 41) if (::hx::IsNull( data )) {
+HXLINE( 42) return null();
+ }
+HXLINE( 44) ::String maxAge = ( (::String)(::Reflect_obj::field(data->attr,HX_("max-age",56,bb,5f,b3))) );
+HXLINE( 46) ::haxe::io::Bytes _hx_tmp = ::haxe::crypto::Base64_obj::decode(::StringTools_obj::replace(data->getText(),HX_("\n",0a,00,00,00),HX_("",00,00,00,00)),null());
+HXLINE( 47) ::String _hx_tmp1 = ( (::String)(::Reflect_obj::field(data->attr,HX_("type",ba,f2,08,4d))) );
+HXLINE( 48) ::Dynamic _hx_tmp2;
+HXDLIN( 48) if (::hx::IsNull( maxAge )) {
+HXLINE( 48) _hx_tmp2 = null();
+ }
+ else {
+HXLINE( 48) _hx_tmp2 = ::Std_obj::parseInt(maxAge);
+ }
+HXLINE( 45) this->result = ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("bytes",6b,08,98,bd),_hx_tmp)
+ ->setFixed(1,HX_("maxAge",7b,e0,47,be),_hx_tmp2)
+ ->setFixed(2,HX_("type",ba,f2,08,4d),_hx_tmp1));
+ }
+HXLINE( 51) return this->result;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(BoB_obj,getResult,return )
+
+ ::snikket::queries::BoB BoB_obj::forHash(::String to, ::snikket::Hash hash){
+ HX_GC_STACKFRAME(&_hx_pos_e19ddf21073603db_27_forHash)
+HXDLIN( 27) ::String algo;
+HXDLIN( 27) if ((hash->algorithm == HX_("sha-1",90,a8,1c,7c))) {
+HXDLIN( 27) algo = HX_("sha1",85,c8,52,4c);
+ }
+ else {
+HXDLIN( 27) algo = hash->algorithm;
+ }
+HXDLIN( 27) ::String _hx_tmp = ((HX_("cid:",7c,23,c0,41) + ::StringTools_obj::urlEncode(algo)) + HX_("+",2b,00,00,00));
+HXDLIN( 27) return ::snikket::queries::BoB_obj::__alloc( HX_CTX ,to,((_hx_tmp + hash->toHex()) + HX_("@bob.xmpp.org",04,79,99,e7)));
+ }
+
+
+STATIC_HX_DEFINE_DYNAMIC_FUNC2(BoB_obj,forHash,return )
+
+
+::hx::ObjectPtr< BoB_obj > BoB_obj::__new(::String to,::String uri) {
+ ::hx::ObjectPtr< BoB_obj > __this = new BoB_obj();
+ __this->__construct(to,uri);
+ return __this;
+}
+
+::hx::ObjectPtr< BoB_obj > BoB_obj::__alloc(::hx::Ctx *_hx_ctx,::String to,::String uri) {
+ BoB_obj *__this = (BoB_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(BoB_obj), true, "snikket.queries.BoB"));
+ *(void **)__this = BoB_obj::_hx_vtable;
+ __this->__construct(to,uri);
+ return __this;
+}
+
+BoB_obj::BoB_obj()
+{
+}
+
+void BoB_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(BoB);
+ HX_MARK_MEMBER_NAME(xmlns,"xmlns");
+ HX_MARK_MEMBER_NAME(queryId,"queryId");
+ HX_MARK_MEMBER_NAME(responseStanza,"responseStanza");
+ HX_MARK_MEMBER_NAME(result,"result");
+ ::snikket::queries::GenericQuery_obj::__Mark(HX_MARK_ARG);
+ HX_MARK_END_CLASS();
+}
+
+void BoB_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(xmlns,"xmlns");
+ HX_VISIT_MEMBER_NAME(queryId,"queryId");
+ HX_VISIT_MEMBER_NAME(responseStanza,"responseStanza");
+ HX_VISIT_MEMBER_NAME(result,"result");
+ ::snikket::queries::GenericQuery_obj::__Visit(HX_VISIT_ARG);
+}
+
+::hx::Val BoB_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"xmlns") ) { return ::hx::Val( xmlns ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"result") ) { return ::hx::Val( result ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"queryId") ) { return ::hx::Val( queryId ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"getResult") ) { return ::hx::Val( getResult_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"responseStanza") ) { return ::hx::Val( responseStanza ); }
+ if (HX_FIELD_EQ(inName,"handleResponse") ) { return ::hx::Val( handleResponse_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+bool BoB_obj::__GetStatic(const ::String &inName, Dynamic &outValue, ::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 7:
+ if (HX_FIELD_EQ(inName,"forHash") ) { outValue = forHash_dyn(); return true; }
+ }
+ return false;
+}
+
+::hx::Val BoB_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"xmlns") ) { xmlns=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"result") ) { result=inValue.Cast< ::Dynamic >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"queryId") ) { queryId=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"responseStanza") ) { responseStanza=inValue.Cast< ::snikket::Stanza >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void BoB_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("xmlns",dc,31,74,60));
+ outFields->push(HX_("queryId",03,9d,e9,95));
+ outFields->push(HX_("responseStanza",56,d7,9f,78));
+ outFields->push(HX_("result",dd,68,84,08));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo BoB_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(BoB_obj,xmlns),HX_("xmlns",dc,31,74,60)},
+ {::hx::fsString,(int)offsetof(BoB_obj,queryId),HX_("queryId",03,9d,e9,95)},
+ {::hx::fsObject /* ::snikket::Stanza */ ,(int)offsetof(BoB_obj,responseStanza),HX_("responseStanza",56,d7,9f,78)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(BoB_obj,result),HX_("result",dd,68,84,08)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *BoB_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String BoB_obj_sMemberFields[] = {
+ HX_("xmlns",dc,31,74,60),
+ HX_("queryId",03,9d,e9,95),
+ HX_("responseStanza",56,d7,9f,78),
+ HX_("result",dd,68,84,08),
+ HX_("handleResponse",49,d6,e3,ef),
+ HX_("getResult",13,f2,da,84),
+ ::String(null()) };
+
+::hx::Class BoB_obj::__mClass;
+
+static ::String BoB_obj_sStaticFields[] = {
+ HX_("forHash",77,db,b9,c6),
+ ::String(null())
+};
+
+void BoB_obj::__register()
+{
+ BoB_obj _hx_dummy;
+ BoB_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.queries.BoB",3c,cd,12,de);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &BoB_obj::__GetStatic;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(BoB_obj_sStaticFields);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(BoB_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< BoB_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = BoB_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = BoB_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace queries
diff --git a/Sources/c_snikket/src/snikket/queries/DiscoInfoGet.cpp b/Sources/c_snikket/src/snikket/queries/DiscoInfoGet.cpp
new file mode 100644
index 0000000..cc5783f
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/queries/DiscoInfoGet.cpp
@@ -0,0 +1,262 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_snikket_Caps
+#include <snikket/Caps.h>
+#endif
+#ifndef INCLUDED_snikket_ID
+#include <snikket/ID.h>
+#endif
+#ifndef INCLUDED_snikket_Identity
+#include <snikket/Identity.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_queries_DiscoInfoGet
+#include <snikket/queries/DiscoInfoGet.h>
+#endif
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_29f3c43c4db1f2f0_13_new,"snikket.queries.DiscoInfoGet","new",0x865aec99,"snikket.queries.DiscoInfoGet.new","snikket/queries/DiscoInfoGet.hx",13,0x05d27235)
+HX_LOCAL_STACK_FRAME(_hx_pos_29f3c43c4db1f2f0_31_handleResponse,"snikket.queries.DiscoInfoGet","handleResponse",0xbcd9a2b0,"snikket.queries.DiscoInfoGet.handleResponse","snikket/queries/DiscoInfoGet.hx",31,0x05d27235)
+HX_LOCAL_STACK_FRAME(_hx_pos_29f3c43c4db1f2f0_36_getResult,"snikket.queries.DiscoInfoGet","getResult",0x65667f0c,"snikket.queries.DiscoInfoGet.getResult","snikket/queries/DiscoInfoGet.hx",36,0x05d27235)
+namespace snikket{
+namespace queries{
+
+void DiscoInfoGet_obj::__construct(::String to,::String node){
+ HX_GC_STACKFRAME(&_hx_pos_29f3c43c4db1f2f0_13_new)
+HXLINE( 15) this->queryId = null();
+HXLINE( 14) this->xmlns = HX_("http://jabber.org/protocol/disco#info",cb,2b,7f,0b);
+HXLINE( 20) super::__construct();
+HXLINE( 21) ::Dynamic attr = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),this->xmlns));
+HXLINE( 22) if (::hx::IsNotNull( node )) {
+HXLINE( 22) ::Reflect_obj::setField(attr,HX_("node",02,0a,0a,49),node);
+ }
+HXLINE( 24) this->queryId = ::snikket::ID_obj::_hx_short();
+HXLINE( 25) this->queryStanza = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("iq",e8,5b,00,00), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("id",db,5b,00,00),this->queryId)
+ ->setFixed(1,HX_("to",7b,65,00,00),to)
+ ->setFixed(2,HX_("type",ba,f2,08,4d),HX_("get",96,80,4e,00))))->tag(HX_("query",08,8b,ea,5d),attr)->up();
+ }
+
+Dynamic DiscoInfoGet_obj::__CreateEmpty() { return new DiscoInfoGet_obj; }
+
+void *DiscoInfoGet_obj::_hx_vtable = 0;
+
+Dynamic DiscoInfoGet_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< DiscoInfoGet_obj > _hx_result = new DiscoInfoGet_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1]);
+ return _hx_result;
+}
+
+bool DiscoInfoGet_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x17bd6e57) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x17bd6e57;
+ } else {
+ return inClassId==(int)0x22eda35a;
+ }
+}
+
+void DiscoInfoGet_obj::handleResponse( ::snikket::Stanza stanza){
+ HX_STACKFRAME(&_hx_pos_29f3c43c4db1f2f0_31_handleResponse)
+HXLINE( 32) this->responseStanza = stanza;
+HXLINE( 33) this->finish();
+ }
+
+
+ ::snikket::Caps DiscoInfoGet_obj::getResult(){
+ HX_GC_STACKFRAME(&_hx_pos_29f3c43c4db1f2f0_36_getResult)
+HXLINE( 37) if (::hx::IsNull( this->responseStanza )) {
+HXLINE( 38) return null();
+ }
+HXLINE( 40) if (::hx::IsNull( this->result )) {
+HXLINE( 41) ::snikket::Stanza q = this->responseStanza->getChild(HX_("query",08,8b,ea,5d),this->xmlns);
+HXLINE( 42) if (::hx::IsNull( q )) {
+HXLINE( 43) return null();
+ }
+HXLINE( 45) ::Array< ::Dynamic> identities = q->allTags(HX_("identity",3e,45,2f,b9),null());
+HXLINE( 46) ::Array< ::Dynamic> features = q->allTags(HX_("feature",b6,f2,7c,1a),null());
+HXLINE( 48) ::String _hx_tmp = ( (::String)(::Reflect_obj::field(q->attr,HX_("node",02,0a,0a,49))) );
+HXLINE( 49) ::Array< ::Dynamic> result = ::Array_obj< ::Dynamic>::__new(identities->length);
+HXDLIN( 49) {
+HXLINE( 49) int _g = 0;
+HXDLIN( 49) int _g1 = identities->length;
+HXDLIN( 49) while((_g < _g1)){
+HXLINE( 49) _g = (_g + 1);
+HXDLIN( 49) int i = (_g - 1);
+HXDLIN( 49) {
+HXLINE( 49) ::snikket::Stanza identity = ( ( ::snikket::Stanza)(_hx_array_unsafe_get(identities,i)) );
+HXDLIN( 49) ::String inValue = ( (::String)(::Reflect_obj::field(identity->attr,HX_("category",fe,2a,6c,ad))) );
+HXDLIN( 49) ::String inValue1 = ( (::String)(::Reflect_obj::field(identity->attr,HX_("type",ba,f2,08,4d))) );
+HXDLIN( 49) ::snikket::Identity inValue2 = ::snikket::Identity_obj::__alloc( HX_CTX ,inValue,inValue1,( (::String)(::Reflect_obj::field(identity->attr,HX_("name",4b,72,ff,48))) ));
+HXDLIN( 49) result->__unsafe_set(i,inValue2);
+ }
+ }
+ }
+HXDLIN( 49) ::Array< ::Dynamic> _hx_tmp1 = result;
+HXLINE( 50) ::Array< ::String > result1 = ::Array_obj< ::String >::__new(features->length);
+HXDLIN( 50) {
+HXLINE( 50) int _g2 = 0;
+HXDLIN( 50) int _g3 = features->length;
+HXDLIN( 50) while((_g2 < _g3)){
+HXLINE( 50) _g2 = (_g2 + 1);
+HXDLIN( 50) int i1 = (_g2 - 1);
+HXDLIN( 50) {
+HXLINE( 50) ::String inValue3 = ( (::String)(::Reflect_obj::field(( ( ::snikket::Stanza)(_hx_array_unsafe_get(features,i1)) )->attr,HX_("var",e7,de,59,00))) );
+HXDLIN( 50) result1->__unsafe_set(i1,inValue3);
+ }
+ }
+ }
+HXLINE( 47) this->result = ::snikket::Caps_obj::__alloc( HX_CTX ,_hx_tmp,_hx_tmp1,result1);
+ }
+HXLINE( 53) return this->result;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(DiscoInfoGet_obj,getResult,return )
+
+
+::hx::ObjectPtr< DiscoInfoGet_obj > DiscoInfoGet_obj::__new(::String to,::String node) {
+ ::hx::ObjectPtr< DiscoInfoGet_obj > __this = new DiscoInfoGet_obj();
+ __this->__construct(to,node);
+ return __this;
+}
+
+::hx::ObjectPtr< DiscoInfoGet_obj > DiscoInfoGet_obj::__alloc(::hx::Ctx *_hx_ctx,::String to,::String node) {
+ DiscoInfoGet_obj *__this = (DiscoInfoGet_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(DiscoInfoGet_obj), true, "snikket.queries.DiscoInfoGet"));
+ *(void **)__this = DiscoInfoGet_obj::_hx_vtable;
+ __this->__construct(to,node);
+ return __this;
+}
+
+DiscoInfoGet_obj::DiscoInfoGet_obj()
+{
+}
+
+void DiscoInfoGet_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(DiscoInfoGet);
+ HX_MARK_MEMBER_NAME(xmlns,"xmlns");
+ HX_MARK_MEMBER_NAME(queryId,"queryId");
+ HX_MARK_MEMBER_NAME(responseStanza,"responseStanza");
+ HX_MARK_MEMBER_NAME(result,"result");
+ ::snikket::queries::GenericQuery_obj::__Mark(HX_MARK_ARG);
+ HX_MARK_END_CLASS();
+}
+
+void DiscoInfoGet_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(xmlns,"xmlns");
+ HX_VISIT_MEMBER_NAME(queryId,"queryId");
+ HX_VISIT_MEMBER_NAME(responseStanza,"responseStanza");
+ HX_VISIT_MEMBER_NAME(result,"result");
+ ::snikket::queries::GenericQuery_obj::__Visit(HX_VISIT_ARG);
+}
+
+::hx::Val DiscoInfoGet_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"xmlns") ) { return ::hx::Val( xmlns ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"result") ) { return ::hx::Val( result ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"queryId") ) { return ::hx::Val( queryId ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"getResult") ) { return ::hx::Val( getResult_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"responseStanza") ) { return ::hx::Val( responseStanza ); }
+ if (HX_FIELD_EQ(inName,"handleResponse") ) { return ::hx::Val( handleResponse_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val DiscoInfoGet_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"xmlns") ) { xmlns=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"result") ) { result=inValue.Cast< ::snikket::Caps >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"queryId") ) { queryId=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"responseStanza") ) { responseStanza=inValue.Cast< ::snikket::Stanza >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void DiscoInfoGet_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("xmlns",dc,31,74,60));
+ outFields->push(HX_("queryId",03,9d,e9,95));
+ outFields->push(HX_("responseStanza",56,d7,9f,78));
+ outFields->push(HX_("result",dd,68,84,08));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo DiscoInfoGet_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(DiscoInfoGet_obj,xmlns),HX_("xmlns",dc,31,74,60)},
+ {::hx::fsString,(int)offsetof(DiscoInfoGet_obj,queryId),HX_("queryId",03,9d,e9,95)},
+ {::hx::fsObject /* ::snikket::Stanza */ ,(int)offsetof(DiscoInfoGet_obj,responseStanza),HX_("responseStanza",56,d7,9f,78)},
+ {::hx::fsObject /* ::snikket::Caps */ ,(int)offsetof(DiscoInfoGet_obj,result),HX_("result",dd,68,84,08)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *DiscoInfoGet_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String DiscoInfoGet_obj_sMemberFields[] = {
+ HX_("xmlns",dc,31,74,60),
+ HX_("queryId",03,9d,e9,95),
+ HX_("responseStanza",56,d7,9f,78),
+ HX_("result",dd,68,84,08),
+ HX_("handleResponse",49,d6,e3,ef),
+ HX_("getResult",13,f2,da,84),
+ ::String(null()) };
+
+::hx::Class DiscoInfoGet_obj::__mClass;
+
+void DiscoInfoGet_obj::__register()
+{
+ DiscoInfoGet_obj _hx_dummy;
+ DiscoInfoGet_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.queries.DiscoInfoGet",27,ac,38,0b);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(DiscoInfoGet_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< DiscoInfoGet_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = DiscoInfoGet_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = DiscoInfoGet_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace queries
diff --git a/Sources/c_snikket/src/snikket/queries/DiscoItemsGet.cpp b/Sources/c_snikket/src/snikket/queries/DiscoItemsGet.cpp
new file mode 100644
index 0000000..06d0d14
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/queries/DiscoItemsGet.cpp
@@ -0,0 +1,244 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_snikket_ID
+#include <snikket/ID.h>
+#endif
+#ifndef INCLUDED_snikket_JID
+#include <snikket/JID.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_queries_DiscoItemsGet
+#include <snikket/queries/DiscoItemsGet.h>
+#endif
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_6913f37a88479f13_13_new,"snikket.queries.DiscoItemsGet","new",0xc1d054a9,"snikket.queries.DiscoItemsGet.new","snikket/queries/DiscoItemsGet.hx",13,0x00cbbfe9)
+HX_LOCAL_STACK_FRAME(_hx_pos_6913f37a88479f13_30_handleResponse,"snikket.queries.DiscoItemsGet","handleResponse",0x5c0414a0,"snikket.queries.DiscoItemsGet.handleResponse","snikket/queries/DiscoItemsGet.hx",30,0x00cbbfe9)
+HX_LOCAL_STACK_FRAME(_hx_pos_6913f37a88479f13_35_getResult,"snikket.queries.DiscoItemsGet","getResult",0x7831531c,"snikket.queries.DiscoItemsGet.getResult","snikket/queries/DiscoItemsGet.hx",35,0x00cbbfe9)
+namespace snikket{
+namespace queries{
+
+void DiscoItemsGet_obj::__construct(::String to,::String node){
+ HX_GC_STACKFRAME(&_hx_pos_6913f37a88479f13_13_new)
+HXLINE( 15) this->queryId = null();
+HXLINE( 14) this->xmlns = HX_("http://jabber.org/protocol/disco#items",03,aa,bd,07);
+HXLINE( 19) super::__construct();
+HXLINE( 20) ::Dynamic attr = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),this->xmlns));
+HXLINE( 21) if (::hx::IsNotNull( node )) {
+HXLINE( 21) ::Reflect_obj::setField(attr,HX_("node",02,0a,0a,49),node);
+ }
+HXLINE( 23) this->queryId = ::snikket::ID_obj::_hx_short();
+HXLINE( 24) this->queryStanza = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("iq",e8,5b,00,00), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("id",db,5b,00,00),this->queryId)
+ ->setFixed(1,HX_("to",7b,65,00,00),to)
+ ->setFixed(2,HX_("type",ba,f2,08,4d),HX_("get",96,80,4e,00))))->tag(HX_("query",08,8b,ea,5d),attr)->up();
+ }
+
+Dynamic DiscoItemsGet_obj::__CreateEmpty() { return new DiscoItemsGet_obj; }
+
+void *DiscoItemsGet_obj::_hx_vtable = 0;
+
+Dynamic DiscoItemsGet_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< DiscoItemsGet_obj > _hx_result = new DiscoItemsGet_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1]);
+ return _hx_result;
+}
+
+bool DiscoItemsGet_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x22eda35a) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x22eda35a;
+ } else {
+ return inClassId==(int)0x3759f407;
+ }
+}
+
+void DiscoItemsGet_obj::handleResponse( ::snikket::Stanza stanza){
+ HX_STACKFRAME(&_hx_pos_6913f37a88479f13_30_handleResponse)
+HXLINE( 31) this->responseStanza = stanza;
+HXLINE( 32) this->finish();
+ }
+
+
+::Array< ::Dynamic> DiscoItemsGet_obj::getResult(){
+ HX_STACKFRAME(&_hx_pos_6913f37a88479f13_35_getResult)
+HXLINE( 36) if (::hx::IsNull( this->responseStanza )) {
+HXLINE( 37) return null();
+ }
+HXLINE( 39) if (::hx::IsNull( this->result )) {
+HXLINE( 40) ::snikket::Stanza q = this->responseStanza->getChild(HX_("query",08,8b,ea,5d),this->xmlns);
+HXLINE( 41) if (::hx::IsNull( q )) {
+HXLINE( 42) return null();
+ }
+HXLINE( 44) this->result = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 45) {
+HXLINE( 45) int _g = 0;
+HXDLIN( 45) ::Array< ::Dynamic> _g1 = q->allTags(HX_("item",13,c5,bf,45),null());
+HXDLIN( 45) while((_g < _g1->length)){
+HXLINE( 45) ::snikket::Stanza item = _g1->__get(_g).StaticCast< ::snikket::Stanza >();
+HXDLIN( 45) _g = (_g + 1);
+HXLINE( 46) ::String jid = ( (::String)(::Reflect_obj::field(item->attr,HX_("jid",c5,ca,50,00))) );
+HXLINE( 47) if (::hx::IsNotNull( jid )) {
+HXLINE( 48) ::Array< ::Dynamic> _hx_tmp = this->result;
+HXDLIN( 48) ::snikket::JID _hx_tmp1 = ::snikket::JID_obj::parse(jid);
+HXDLIN( 48) ::String _hx_tmp2 = ( (::String)(::Reflect_obj::field(item->attr,HX_("name",4b,72,ff,48))) );
+HXDLIN( 48) _hx_tmp->push( ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("jid",c5,ca,50,00),_hx_tmp1)
+ ->setFixed(1,HX_("name",4b,72,ff,48),_hx_tmp2)
+ ->setFixed(2,HX_("node",02,0a,0a,49),( (::String)(::Reflect_obj::field(item->attr,HX_("node",02,0a,0a,49))) ))));
+ }
+ }
+ }
+ }
+HXLINE( 52) return this->result;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(DiscoItemsGet_obj,getResult,return )
+
+
+::hx::ObjectPtr< DiscoItemsGet_obj > DiscoItemsGet_obj::__new(::String to,::String node) {
+ ::hx::ObjectPtr< DiscoItemsGet_obj > __this = new DiscoItemsGet_obj();
+ __this->__construct(to,node);
+ return __this;
+}
+
+::hx::ObjectPtr< DiscoItemsGet_obj > DiscoItemsGet_obj::__alloc(::hx::Ctx *_hx_ctx,::String to,::String node) {
+ DiscoItemsGet_obj *__this = (DiscoItemsGet_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(DiscoItemsGet_obj), true, "snikket.queries.DiscoItemsGet"));
+ *(void **)__this = DiscoItemsGet_obj::_hx_vtable;
+ __this->__construct(to,node);
+ return __this;
+}
+
+DiscoItemsGet_obj::DiscoItemsGet_obj()
+{
+}
+
+void DiscoItemsGet_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(DiscoItemsGet);
+ HX_MARK_MEMBER_NAME(xmlns,"xmlns");
+ HX_MARK_MEMBER_NAME(queryId,"queryId");
+ HX_MARK_MEMBER_NAME(responseStanza,"responseStanza");
+ HX_MARK_MEMBER_NAME(result,"result");
+ ::snikket::queries::GenericQuery_obj::__Mark(HX_MARK_ARG);
+ HX_MARK_END_CLASS();
+}
+
+void DiscoItemsGet_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(xmlns,"xmlns");
+ HX_VISIT_MEMBER_NAME(queryId,"queryId");
+ HX_VISIT_MEMBER_NAME(responseStanza,"responseStanza");
+ HX_VISIT_MEMBER_NAME(result,"result");
+ ::snikket::queries::GenericQuery_obj::__Visit(HX_VISIT_ARG);
+}
+
+::hx::Val DiscoItemsGet_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"xmlns") ) { return ::hx::Val( xmlns ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"result") ) { return ::hx::Val( result ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"queryId") ) { return ::hx::Val( queryId ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"getResult") ) { return ::hx::Val( getResult_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"responseStanza") ) { return ::hx::Val( responseStanza ); }
+ if (HX_FIELD_EQ(inName,"handleResponse") ) { return ::hx::Val( handleResponse_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val DiscoItemsGet_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"xmlns") ) { xmlns=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"result") ) { result=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"queryId") ) { queryId=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"responseStanza") ) { responseStanza=inValue.Cast< ::snikket::Stanza >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void DiscoItemsGet_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("xmlns",dc,31,74,60));
+ outFields->push(HX_("queryId",03,9d,e9,95));
+ outFields->push(HX_("responseStanza",56,d7,9f,78));
+ outFields->push(HX_("result",dd,68,84,08));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo DiscoItemsGet_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(DiscoItemsGet_obj,xmlns),HX_("xmlns",dc,31,74,60)},
+ {::hx::fsString,(int)offsetof(DiscoItemsGet_obj,queryId),HX_("queryId",03,9d,e9,95)},
+ {::hx::fsObject /* ::snikket::Stanza */ ,(int)offsetof(DiscoItemsGet_obj,responseStanza),HX_("responseStanza",56,d7,9f,78)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(DiscoItemsGet_obj,result),HX_("result",dd,68,84,08)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *DiscoItemsGet_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String DiscoItemsGet_obj_sMemberFields[] = {
+ HX_("xmlns",dc,31,74,60),
+ HX_("queryId",03,9d,e9,95),
+ HX_("responseStanza",56,d7,9f,78),
+ HX_("result",dd,68,84,08),
+ HX_("handleResponse",49,d6,e3,ef),
+ HX_("getResult",13,f2,da,84),
+ ::String(null()) };
+
+::hx::Class DiscoItemsGet_obj::__mClass;
+
+void DiscoItemsGet_obj::__register()
+{
+ DiscoItemsGet_obj _hx_dummy;
+ DiscoItemsGet_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.queries.DiscoItemsGet",37,cc,b4,4f);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(DiscoItemsGet_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< DiscoItemsGet_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = DiscoItemsGet_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = DiscoItemsGet_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace queries
diff --git a/Sources/c_snikket/src/snikket/queries/ExtDiscoGet.cpp b/Sources/c_snikket/src/snikket/queries/ExtDiscoGet.cpp
new file mode 100644
index 0000000..8a2534e
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/queries/ExtDiscoGet.cpp
@@ -0,0 +1,216 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_ID
+#include <snikket/ID.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_queries_ExtDiscoGet
+#include <snikket/queries/ExtDiscoGet.h>
+#endif
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_7c1ec3095a105ee7_13_new,"snikket.queries.ExtDiscoGet","new",0x4ccb6056,"snikket.queries.ExtDiscoGet.new","snikket/queries/ExtDiscoGet.hx",13,0xcd33e45c)
+HX_LOCAL_STACK_FRAME(_hx_pos_7c1ec3095a105ee7_29_handleResponse,"snikket.queries.ExtDiscoGet","handleResponse",0x34fbfe13,"snikket.queries.ExtDiscoGet.handleResponse","snikket/queries/ExtDiscoGet.hx",29,0xcd33e45c)
+HX_LOCAL_STACK_FRAME(_hx_pos_7c1ec3095a105ee7_34_getResult,"snikket.queries.ExtDiscoGet","getResult",0x7787de89,"snikket.queries.ExtDiscoGet.getResult","snikket/queries/ExtDiscoGet.hx",34,0xcd33e45c)
+namespace snikket{
+namespace queries{
+
+void ExtDiscoGet_obj::__construct(::String to){
+ HX_GC_STACKFRAME(&_hx_pos_7c1ec3095a105ee7_13_new)
+HXLINE( 15) this->queryId = null();
+HXLINE( 14) this->xmlns = HX_("urn:xmpp:extdisco:2",4d,7d,5d,75);
+HXLINE( 20) super::__construct();
+HXLINE( 22) this->queryId = ::snikket::ID_obj::_hx_short();
+HXLINE( 23) this->queryStanza = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("iq",e8,5b,00,00), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("id",db,5b,00,00),this->queryId)
+ ->setFixed(1,HX_("to",7b,65,00,00),to)
+ ->setFixed(2,HX_("type",ba,f2,08,4d),HX_("get",96,80,4e,00))))->tag(HX_("services",9e,92,4b,e5), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),this->xmlns)))->up();
+ }
+
+Dynamic ExtDiscoGet_obj::__CreateEmpty() { return new ExtDiscoGet_obj; }
+
+void *ExtDiscoGet_obj::_hx_vtable = 0;
+
+Dynamic ExtDiscoGet_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< ExtDiscoGet_obj > _hx_result = new ExtDiscoGet_obj();
+ _hx_result->__construct(inArgs[0]);
+ return _hx_result;
+}
+
+bool ExtDiscoGet_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x22eda35a) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x22eda35a;
+ } else {
+ return inClassId==(int)0x5f97d134;
+ }
+}
+
+void ExtDiscoGet_obj::handleResponse( ::snikket::Stanza stanza){
+ HX_STACKFRAME(&_hx_pos_7c1ec3095a105ee7_29_handleResponse)
+HXLINE( 30) this->responseStanza = stanza;
+HXLINE( 31) this->finish();
+ }
+
+
+::Array< ::Dynamic> ExtDiscoGet_obj::getResult(){
+ HX_STACKFRAME(&_hx_pos_7c1ec3095a105ee7_34_getResult)
+HXLINE( 35) if (::hx::IsNull( this->responseStanza )) {
+HXLINE( 36) return null();
+ }
+HXLINE( 38) if (::hx::IsNull( this->result )) {
+HXLINE( 39) ::snikket::Stanza q = this->responseStanza->getChild(HX_("services",9e,92,4b,e5),this->xmlns);
+HXLINE( 40) if (::hx::IsNull( q )) {
+HXLINE( 41) return null();
+ }
+HXLINE( 43) this->result = q->allTags(HX_("service",35,1c,2d,02),null());
+ }
+HXLINE( 45) return this->result;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(ExtDiscoGet_obj,getResult,return )
+
+
+::hx::ObjectPtr< ExtDiscoGet_obj > ExtDiscoGet_obj::__new(::String to) {
+ ::hx::ObjectPtr< ExtDiscoGet_obj > __this = new ExtDiscoGet_obj();
+ __this->__construct(to);
+ return __this;
+}
+
+::hx::ObjectPtr< ExtDiscoGet_obj > ExtDiscoGet_obj::__alloc(::hx::Ctx *_hx_ctx,::String to) {
+ ExtDiscoGet_obj *__this = (ExtDiscoGet_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(ExtDiscoGet_obj), true, "snikket.queries.ExtDiscoGet"));
+ *(void **)__this = ExtDiscoGet_obj::_hx_vtable;
+ __this->__construct(to);
+ return __this;
+}
+
+ExtDiscoGet_obj::ExtDiscoGet_obj()
+{
+}
+
+void ExtDiscoGet_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(ExtDiscoGet);
+ HX_MARK_MEMBER_NAME(xmlns,"xmlns");
+ HX_MARK_MEMBER_NAME(queryId,"queryId");
+ HX_MARK_MEMBER_NAME(responseStanza,"responseStanza");
+ HX_MARK_MEMBER_NAME(result,"result");
+ ::snikket::queries::GenericQuery_obj::__Mark(HX_MARK_ARG);
+ HX_MARK_END_CLASS();
+}
+
+void ExtDiscoGet_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(xmlns,"xmlns");
+ HX_VISIT_MEMBER_NAME(queryId,"queryId");
+ HX_VISIT_MEMBER_NAME(responseStanza,"responseStanza");
+ HX_VISIT_MEMBER_NAME(result,"result");
+ ::snikket::queries::GenericQuery_obj::__Visit(HX_VISIT_ARG);
+}
+
+::hx::Val ExtDiscoGet_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"xmlns") ) { return ::hx::Val( xmlns ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"result") ) { return ::hx::Val( result ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"queryId") ) { return ::hx::Val( queryId ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"getResult") ) { return ::hx::Val( getResult_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"responseStanza") ) { return ::hx::Val( responseStanza ); }
+ if (HX_FIELD_EQ(inName,"handleResponse") ) { return ::hx::Val( handleResponse_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val ExtDiscoGet_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"xmlns") ) { xmlns=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"result") ) { result=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"queryId") ) { queryId=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"responseStanza") ) { responseStanza=inValue.Cast< ::snikket::Stanza >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void ExtDiscoGet_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("xmlns",dc,31,74,60));
+ outFields->push(HX_("queryId",03,9d,e9,95));
+ outFields->push(HX_("responseStanza",56,d7,9f,78));
+ outFields->push(HX_("result",dd,68,84,08));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo ExtDiscoGet_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(ExtDiscoGet_obj,xmlns),HX_("xmlns",dc,31,74,60)},
+ {::hx::fsString,(int)offsetof(ExtDiscoGet_obj,queryId),HX_("queryId",03,9d,e9,95)},
+ {::hx::fsObject /* ::snikket::Stanza */ ,(int)offsetof(ExtDiscoGet_obj,responseStanza),HX_("responseStanza",56,d7,9f,78)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(ExtDiscoGet_obj,result),HX_("result",dd,68,84,08)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *ExtDiscoGet_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String ExtDiscoGet_obj_sMemberFields[] = {
+ HX_("xmlns",dc,31,74,60),
+ HX_("queryId",03,9d,e9,95),
+ HX_("responseStanza",56,d7,9f,78),
+ HX_("result",dd,68,84,08),
+ HX_("handleResponse",49,d6,e3,ef),
+ HX_("getResult",13,f2,da,84),
+ ::String(null()) };
+
+::hx::Class ExtDiscoGet_obj::__mClass;
+
+void ExtDiscoGet_obj::__register()
+{
+ ExtDiscoGet_obj _hx_dummy;
+ ExtDiscoGet_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.queries.ExtDiscoGet",64,3d,1b,ff);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(ExtDiscoGet_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< ExtDiscoGet_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = ExtDiscoGet_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = ExtDiscoGet_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace queries
diff --git a/Sources/c_snikket/src/snikket/queries/GenericQuery.cpp b/Sources/c_snikket/src/snikket/queries/GenericQuery.cpp
new file mode 100644
index 0000000..7151e6d
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/queries/GenericQuery.cpp
@@ -0,0 +1,174 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_Exception
+#include <haxe/Exception.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_527e2bb4ad8b3e69_10_new,"snikket.queries.GenericQuery","new",0xe07d5f1c,"snikket.queries.GenericQuery.new","snikket/queries/GenericQuery.hx",10,0x22ed0112)
+HX_LOCAL_STACK_FRAME(_hx_pos_527e2bb4ad8b3e69_12_getQueryStanza,"snikket.queries.GenericQuery","getQueryStanza",0x059458eb,"snikket.queries.GenericQuery.getQueryStanza","snikket/queries/GenericQuery.hx",12,0x22ed0112)
+HX_LOCAL_STACK_FRAME(_hx_pos_527e2bb4ad8b3e69_19_finish,"snikket.queries.GenericQuery","finish",0xbe868f17,"snikket.queries.GenericQuery.finish","snikket/queries/GenericQuery.hx",19,0x22ed0112)
+HX_LOCAL_STACK_FRAME(_hx_pos_527e2bb4ad8b3e69_28_onFinished,"snikket.queries.GenericQuery","onFinished",0xd6156875,"snikket.queries.GenericQuery.onFinished","snikket/queries/GenericQuery.hx",28,0x22ed0112)
+namespace snikket{
+namespace queries{
+
+void GenericQuery_obj::__construct(){
+ HX_STACKFRAME(&_hx_pos_527e2bb4ad8b3e69_10_new)
+HXDLIN( 10) this->isFinished = false;
+ }
+
+bool GenericQuery_obj::_hx_isInstanceOf(int inClassId) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x22eda35a;
+}
+
+ ::snikket::Stanza GenericQuery_obj::getQueryStanza(){
+ HX_GC_STACKFRAME(&_hx_pos_527e2bb4ad8b3e69_12_getQueryStanza)
+HXLINE( 13) if (::hx::IsNull( this->queryStanza )) {
+HXLINE( 14) HX_STACK_DO_THROW( ::haxe::Exception_obj::__alloc( HX_CTX ,HX_("Query has not been initialized",4b,10,b2,f1),null(),null()));
+ }
+HXLINE( 16) return this->queryStanza;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(GenericQuery_obj,getQueryStanza,return )
+
+void GenericQuery_obj::finish(){
+ HX_STACKFRAME(&_hx_pos_527e2bb4ad8b3e69_19_finish)
+HXLINE( 20) this->isFinished = true;
+HXLINE( 21) if (::hx::IsNotNull( this->handleFinished )) {
+HXLINE( 22) this->handleFinished();
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(GenericQuery_obj,finish,(void))
+
+HX_DEFINE_DYNAMIC_FUNC1(GenericQuery_obj,handleResponse,(void))
+
+void GenericQuery_obj::onFinished( ::Dynamic handler){
+ HX_STACKFRAME(&_hx_pos_527e2bb4ad8b3e69_28_onFinished)
+HXLINE( 29) this->handleFinished = handler;
+HXLINE( 30) if (this->isFinished) {
+HXLINE( 31) this->handleFinished();
+ }
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(GenericQuery_obj,onFinished,(void))
+
+
+GenericQuery_obj::GenericQuery_obj()
+{
+}
+
+void GenericQuery_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(GenericQuery);
+ HX_MARK_MEMBER_NAME(queryStanza,"queryStanza");
+ HX_MARK_MEMBER_NAME(handleFinished,"handleFinished");
+ HX_MARK_MEMBER_NAME(isFinished,"isFinished");
+ HX_MARK_END_CLASS();
+}
+
+void GenericQuery_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(queryStanza,"queryStanza");
+ HX_VISIT_MEMBER_NAME(handleFinished,"handleFinished");
+ HX_VISIT_MEMBER_NAME(isFinished,"isFinished");
+}
+
+::hx::Val GenericQuery_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 6:
+ if (HX_FIELD_EQ(inName,"finish") ) { return ::hx::Val( finish_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"isFinished") ) { return ::hx::Val( isFinished ); }
+ if (HX_FIELD_EQ(inName,"onFinished") ) { return ::hx::Val( onFinished_dyn() ); }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"queryStanza") ) { return ::hx::Val( queryStanza ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"handleFinished") ) { return ::hx::Val( handleFinished ); }
+ if (HX_FIELD_EQ(inName,"getQueryStanza") ) { return ::hx::Val( getQueryStanza_dyn() ); }
+ if (HX_FIELD_EQ(inName,"handleResponse") ) { return ::hx::Val( handleResponse_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val GenericQuery_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 10:
+ if (HX_FIELD_EQ(inName,"isFinished") ) { isFinished=inValue.Cast< bool >(); return inValue; }
+ break;
+ case 11:
+ if (HX_FIELD_EQ(inName,"queryStanza") ) { queryStanza=inValue.Cast< ::snikket::Stanza >(); return inValue; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"handleFinished") ) { handleFinished=inValue.Cast< ::Dynamic >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void GenericQuery_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("queryStanza",1d,53,1c,58));
+ outFields->push(HX_("isFinished",7c,a5,bd,0f));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo GenericQuery_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::snikket::Stanza */ ,(int)offsetof(GenericQuery_obj,queryStanza),HX_("queryStanza",1d,53,1c,58)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(GenericQuery_obj,handleFinished),HX_("handleFinished",3a,bb,e5,e2)},
+ {::hx::fsBool,(int)offsetof(GenericQuery_obj,isFinished),HX_("isFinished",7c,a5,bd,0f)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *GenericQuery_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String GenericQuery_obj_sMemberFields[] = {
+ HX_("queryStanza",1d,53,1c,58),
+ HX_("handleFinished",3a,bb,e5,e2),
+ HX_("isFinished",7c,a5,bd,0f),
+ HX_("getQueryStanza",27,a6,ba,df),
+ HX_("finish",53,40,7f,86),
+ HX_("handleResponse",49,d6,e3,ef),
+ HX_("onFinished",b1,67,c5,72),
+ ::String(null()) };
+
+::hx::Class GenericQuery_obj::__mClass;
+
+void GenericQuery_obj::__register()
+{
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.queries.GenericQuery",2a,e1,68,16);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(GenericQuery_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< GenericQuery_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = GenericQuery_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = GenericQuery_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace queries
diff --git a/Sources/c_snikket/src/snikket/queries/HttpUploadSlot.cpp b/Sources/c_snikket/src/snikket/queries/HttpUploadSlot.cpp
new file mode 100644
index 0000000..d2b9dd6
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/queries/HttpUploadSlot.cpp
@@ -0,0 +1,277 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_haxe_crypto_Base64
+#include <haxe/crypto/Base64.h>
+#endif
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+#ifndef INCLUDED_snikket_Hash
+#include <snikket/Hash.h>
+#endif
+#ifndef INCLUDED_snikket_ID
+#include <snikket/ID.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+#ifndef INCLUDED_snikket_queries_HttpUploadSlot
+#include <snikket/queries/HttpUploadSlot.h>
+#endif
+#ifndef INCLUDED_tink_core_NamedWith
+#include <tink/core/NamedWith.h>
+#endif
+#ifndef INCLUDED_tink_http_HeaderField
+#include <tink/http/HeaderField.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_af5fa90d534d8e1e_16_new,"snikket.queries.HttpUploadSlot","new",0x81b5ef32,"snikket.queries.HttpUploadSlot.new","snikket/queries/HttpUploadSlot.hx",16,0xfe0bd13c)
+HX_LOCAL_STACK_FRAME(_hx_pos_af5fa90d534d8e1e_35_handleResponse,"snikket.queries.HttpUploadSlot","handleResponse",0x63a264b7,"snikket.queries.HttpUploadSlot.handleResponse","snikket/queries/HttpUploadSlot.hx",35,0xfe0bd13c)
+HX_LOCAL_STACK_FRAME(_hx_pos_af5fa90d534d8e1e_40_getResult,"snikket.queries.HttpUploadSlot","getResult",0xdc42fa65,"snikket.queries.HttpUploadSlot.getResult","snikket/queries/HttpUploadSlot.hx",40,0xfe0bd13c)
+namespace snikket{
+namespace queries{
+
+void HttpUploadSlot_obj::__construct(::String to,::String filename,int size,::String mime,::Array< ::Dynamic> hashes){
+ HX_GC_STACKFRAME(&_hx_pos_af5fa90d534d8e1e_16_new)
+HXLINE( 18) this->queryId = null();
+HXLINE( 17) this->xmlns = HX_("urn:xmpp:http:upload:0",0d,db,46,68);
+HXLINE( 22) super::__construct();
+HXLINE( 24) this->queryId = ::snikket::ID_obj::_hx_short();
+HXLINE( 25) ::snikket::Stanza _hx_tmp = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("iq",e8,5b,00,00), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("id",db,5b,00,00),this->queryId)
+ ->setFixed(1,HX_("to",7b,65,00,00),to)
+ ->setFixed(2,HX_("type",ba,f2,08,4d),HX_("get",96,80,4e,00))));
+HXLINE( 28) ::String _hx_tmp1 = this->xmlns;
+HXLINE( 25) this->queryStanza = _hx_tmp->tag(HX_("request",4f,df,84,44), ::Dynamic(::hx::Anon_obj::Create(4)
+ ->setFixed(0,HX_("content-type",8e,f1,71,89),mime)
+ ->setFixed(1,HX_("size",c1,a0,53,4c),::Std_obj::string(size))
+ ->setFixed(2,HX_("xmlns",dc,31,74,60),_hx_tmp1)
+ ->setFixed(3,HX_("filename",c7,2e,6a,77),filename)));
+HXLINE( 29) {
+HXLINE( 29) int _g = 0;
+HXDLIN( 29) while((_g < hashes->length)){
+HXLINE( 29) ::snikket::Hash hash = hashes->__get(_g).StaticCast< ::snikket::Hash >();
+HXDLIN( 29) _g = (_g + 1);
+HXLINE( 30) ::snikket::Stanza _hx_tmp2 = this->queryStanza;
+HXDLIN( 30) ::String _hx_tmp3 = ::haxe::crypto::Base64_obj::encode(::haxe::io::Bytes_obj::ofData(hash->hash),null());
+HXDLIN( 30) _hx_tmp2->textTag(HX_("hash",ce,2f,08,45),_hx_tmp3, ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("algo",d3,ff,6f,40),hash->algorithm)
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("urn:xmpp:hashes:2",90,ad,87,c7))));
+ }
+ }
+HXLINE( 32) this->queryStanza->up();
+ }
+
+Dynamic HttpUploadSlot_obj::__CreateEmpty() { return new HttpUploadSlot_obj; }
+
+void *HttpUploadSlot_obj::_hx_vtable = 0;
+
+Dynamic HttpUploadSlot_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< HttpUploadSlot_obj > _hx_result = new HttpUploadSlot_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4]);
+ return _hx_result;
+}
+
+bool HttpUploadSlot_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x1883dc70) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x1883dc70;
+ } else {
+ return inClassId==(int)0x22eda35a;
+ }
+}
+
+void HttpUploadSlot_obj::handleResponse( ::snikket::Stanza stanza){
+ HX_STACKFRAME(&_hx_pos_af5fa90d534d8e1e_35_handleResponse)
+HXLINE( 36) this->responseStanza = stanza;
+HXLINE( 37) this->finish();
+ }
+
+
+ ::Dynamic HttpUploadSlot_obj::getResult(){
+ HX_GC_STACKFRAME(&_hx_pos_af5fa90d534d8e1e_40_getResult)
+HXLINE( 41) if (::hx::IsNull( this->responseStanza )) {
+HXLINE( 42) return null();
+ }
+HXLINE( 44) if (::hx::IsNull( this->result )) {
+HXLINE( 45) ::snikket::Stanza q = this->responseStanza->getChild(HX_("slot",fe,dd,55,4c),this->xmlns);
+HXLINE( 46) if (::hx::IsNull( q )) {
+HXLINE( 47) return null();
+ }
+HXLINE( 49) ::String get = q->findText(HX_("get@url",c5,56,50,12));
+HXLINE( 50) if (::hx::IsNull( get )) {
+HXLINE( 50) return null();
+ }
+HXLINE( 51) ::String put = q->findText(HX_("put@url",7e,49,47,ee));
+HXLINE( 52) if (::hx::IsNull( put )) {
+HXLINE( 52) return null();
+ }
+HXLINE( 53) ::Array< ::Dynamic> headers = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 54) {
+HXLINE( 54) int _g = 0;
+HXDLIN( 54) ::Array< ::Dynamic> _g1 = q->getChild(HX_("put",cf,62,55,00),null())->allTags(HX_("header",8d,09,00,fd),null());
+HXDLIN( 54) while((_g < _g1->length)){
+HXLINE( 54) ::snikket::Stanza header = _g1->__get(_g).StaticCast< ::snikket::Stanza >();
+HXDLIN( 54) _g = (_g + 1);
+HXLINE( 55) ::String this1 = ( (::String)(::Reflect_obj::field(header->attr,HX_("name",4b,72,ff,48))) ).toLowerCase();
+HXDLIN( 55) headers->push( ::tink::http::HeaderField_obj::__alloc( HX_CTX ,this1,header->getText()));
+ }
+ }
+HXLINE( 57) this->result = ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("putHeaders",37,9f,1e,a4),headers)
+ ->setFixed(1,HX_("get",96,80,4e,00),get)
+ ->setFixed(2,HX_("put",cf,62,55,00),put));
+ }
+HXLINE( 59) return this->result;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(HttpUploadSlot_obj,getResult,return )
+
+
+::hx::ObjectPtr< HttpUploadSlot_obj > HttpUploadSlot_obj::__new(::String to,::String filename,int size,::String mime,::Array< ::Dynamic> hashes) {
+ ::hx::ObjectPtr< HttpUploadSlot_obj > __this = new HttpUploadSlot_obj();
+ __this->__construct(to,filename,size,mime,hashes);
+ return __this;
+}
+
+::hx::ObjectPtr< HttpUploadSlot_obj > HttpUploadSlot_obj::__alloc(::hx::Ctx *_hx_ctx,::String to,::String filename,int size,::String mime,::Array< ::Dynamic> hashes) {
+ HttpUploadSlot_obj *__this = (HttpUploadSlot_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(HttpUploadSlot_obj), true, "snikket.queries.HttpUploadSlot"));
+ *(void **)__this = HttpUploadSlot_obj::_hx_vtable;
+ __this->__construct(to,filename,size,mime,hashes);
+ return __this;
+}
+
+HttpUploadSlot_obj::HttpUploadSlot_obj()
+{
+}
+
+void HttpUploadSlot_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(HttpUploadSlot);
+ HX_MARK_MEMBER_NAME(xmlns,"xmlns");
+ HX_MARK_MEMBER_NAME(queryId,"queryId");
+ HX_MARK_MEMBER_NAME(responseStanza,"responseStanza");
+ HX_MARK_MEMBER_NAME(result,"result");
+ ::snikket::queries::GenericQuery_obj::__Mark(HX_MARK_ARG);
+ HX_MARK_END_CLASS();
+}
+
+void HttpUploadSlot_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(xmlns,"xmlns");
+ HX_VISIT_MEMBER_NAME(queryId,"queryId");
+ HX_VISIT_MEMBER_NAME(responseStanza,"responseStanza");
+ HX_VISIT_MEMBER_NAME(result,"result");
+ ::snikket::queries::GenericQuery_obj::__Visit(HX_VISIT_ARG);
+}
+
+::hx::Val HttpUploadSlot_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"xmlns") ) { return ::hx::Val( xmlns ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"result") ) { return ::hx::Val( result ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"queryId") ) { return ::hx::Val( queryId ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"getResult") ) { return ::hx::Val( getResult_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"responseStanza") ) { return ::hx::Val( responseStanza ); }
+ if (HX_FIELD_EQ(inName,"handleResponse") ) { return ::hx::Val( handleResponse_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val HttpUploadSlot_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"xmlns") ) { xmlns=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"result") ) { result=inValue.Cast< ::Dynamic >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"queryId") ) { queryId=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"responseStanza") ) { responseStanza=inValue.Cast< ::snikket::Stanza >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void HttpUploadSlot_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("xmlns",dc,31,74,60));
+ outFields->push(HX_("queryId",03,9d,e9,95));
+ outFields->push(HX_("responseStanza",56,d7,9f,78));
+ outFields->push(HX_("result",dd,68,84,08));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo HttpUploadSlot_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(HttpUploadSlot_obj,xmlns),HX_("xmlns",dc,31,74,60)},
+ {::hx::fsString,(int)offsetof(HttpUploadSlot_obj,queryId),HX_("queryId",03,9d,e9,95)},
+ {::hx::fsObject /* ::snikket::Stanza */ ,(int)offsetof(HttpUploadSlot_obj,responseStanza),HX_("responseStanza",56,d7,9f,78)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(HttpUploadSlot_obj,result),HX_("result",dd,68,84,08)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *HttpUploadSlot_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String HttpUploadSlot_obj_sMemberFields[] = {
+ HX_("xmlns",dc,31,74,60),
+ HX_("queryId",03,9d,e9,95),
+ HX_("responseStanza",56,d7,9f,78),
+ HX_("result",dd,68,84,08),
+ HX_("handleResponse",49,d6,e3,ef),
+ HX_("getResult",13,f2,da,84),
+ ::String(null()) };
+
+::hx::Class HttpUploadSlot_obj::__mClass;
+
+void HttpUploadSlot_obj::__register()
+{
+ HttpUploadSlot_obj _hx_dummy;
+ HttpUploadSlot_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.queries.HttpUploadSlot",40,2e,a6,4f);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(HttpUploadSlot_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< HttpUploadSlot_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = HttpUploadSlot_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = HttpUploadSlot_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace queries
diff --git a/Sources/c_snikket/src/snikket/queries/JabberIqGatewayGet.cpp b/Sources/c_snikket/src/snikket/queries/JabberIqGatewayGet.cpp
new file mode 100644
index 0000000..874e4d5
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/queries/JabberIqGatewayGet.cpp
@@ -0,0 +1,253 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_haxe_ds_Either
+#include <haxe/ds/Either.h>
+#endif
+#ifndef INCLUDED_snikket_ID
+#include <snikket/ID.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+#ifndef INCLUDED_snikket_queries_JabberIqGatewayGet
+#include <snikket/queries/JabberIqGatewayGet.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_41e406eb6fe6de59_14_new,"snikket.queries.JabberIqGatewayGet","new",0x90335e69,"snikket.queries.JabberIqGatewayGet.new","snikket/queries/JabberIqGatewayGet.hx",14,0x2ebaace5)
+HX_LOCAL_STACK_FRAME(_hx_pos_41e406eb6fe6de59_34_handleResponse,"snikket.queries.JabberIqGatewayGet","handleResponse",0xbcede2e0,"snikket.queries.JabberIqGatewayGet.handleResponse","snikket/queries/JabberIqGatewayGet.hx",34,0x2ebaace5)
+HX_LOCAL_STACK_FRAME(_hx_pos_41e406eb6fe6de59_39_getResult,"snikket.queries.JabberIqGatewayGet","getResult",0x241a2cdc,"snikket.queries.JabberIqGatewayGet.getResult","snikket/queries/JabberIqGatewayGet.hx",39,0x2ebaace5)
+namespace snikket{
+namespace queries{
+
+void JabberIqGatewayGet_obj::__construct(::String to,::String prompt){
+ HX_GC_STACKFRAME(&_hx_pos_41e406eb6fe6de59_14_new)
+HXLINE( 16) this->queryId = null();
+HXLINE( 15) this->xmlns = HX_("jabber:iq:gateway",c8,db,57,c1);
+HXLINE( 21) super::__construct();
+HXLINE( 22) this->queryId = ::snikket::ID_obj::_hx_short();
+HXLINE( 25) ::String _hx_tmp;
+HXDLIN( 25) if (::hx::IsNull( prompt )) {
+HXLINE( 25) _hx_tmp = HX_("get",96,80,4e,00);
+ }
+ else {
+HXLINE( 25) _hx_tmp = HX_("set",a2,9b,57,00);
+ }
+HXLINE( 23) this->queryStanza = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("iq",e8,5b,00,00), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("id",db,5b,00,00),this->queryId)
+ ->setFixed(1,HX_("to",7b,65,00,00),to)
+ ->setFixed(2,HX_("type",ba,f2,08,4d),_hx_tmp)));
+HXLINE( 27) ::snikket::Stanza query = this->queryStanza->tag(HX_("query",08,8b,ea,5d), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),this->xmlns)));
+HXLINE( 28) if (::hx::IsNotNull( prompt )) {
+HXLINE( 29) query->textTag(HX_("prompt",a4,51,58,b5),prompt, ::Dynamic(::hx::Anon_obj::Create(0)));
+ }
+HXLINE( 31) query->up();
+ }
+
+Dynamic JabberIqGatewayGet_obj::__CreateEmpty() { return new JabberIqGatewayGet_obj; }
+
+void *JabberIqGatewayGet_obj::_hx_vtable = 0;
+
+Dynamic JabberIqGatewayGet_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< JabberIqGatewayGet_obj > _hx_result = new JabberIqGatewayGet_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1]);
+ return _hx_result;
+}
+
+bool JabberIqGatewayGet_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x22eda35a) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x22eda35a;
+ } else {
+ return inClassId==(int)0x3942ef8b;
+ }
+}
+
+void JabberIqGatewayGet_obj::handleResponse( ::snikket::Stanza stanza){
+ HX_STACKFRAME(&_hx_pos_41e406eb6fe6de59_34_handleResponse)
+HXLINE( 35) this->responseStanza = stanza;
+HXLINE( 36) this->finish();
+ }
+
+
+ ::haxe::ds::Either JabberIqGatewayGet_obj::getResult(){
+ HX_STACKFRAME(&_hx_pos_41e406eb6fe6de59_39_getResult)
+HXLINE( 40) if (::hx::IsNull( this->responseStanza )) {
+HXLINE( 41) return null();
+ }
+HXLINE( 43) if (::hx::IsNull( this->result )) {
+HXLINE( 44) ::snikket::Stanza error = this->responseStanza->getChild(HX_("error",c8,cb,29,73),null());
+HXLINE( 45) if (::hx::IsNull( error )) {
+HXLINE( 46) ::snikket::Stanza q = this->responseStanza->getChild(HX_("query",08,8b,ea,5d),this->xmlns);
+HXLINE( 47) if (::hx::IsNull( q )) {
+HXLINE( 48) return null();
+ }
+HXLINE( 50) ::snikket::Stanza prompt = q->getChild(HX_("prompt",a4,51,58,b5),null());
+HXLINE( 51) if (::hx::IsNull( prompt )) {
+HXLINE( 52) ::snikket::Stanza jid = q->getChild(HX_("jid",c5,ca,50,00),null());
+HXLINE( 53) if (::hx::IsNull( jid )) {
+HXLINE( 53) return null();
+ }
+HXLINE( 54) this->result = ::haxe::ds::Either_obj::Right(jid->getText());
+ }
+ else {
+HXLINE( 56) this->result = ::haxe::ds::Either_obj::Right(prompt->getText());
+ }
+ }
+ else {
+HXLINE( 59) if (::hx::IsNotNull( error->getChild(HX_("service-unavailable",f8,3c,11,1c),HX_("urn:ietf:params:xml:ns:xmpp-stanzas",27,f2,3d,30)) )) {
+HXLINE( 59) return null();
+ }
+HXLINE( 60) if (::hx::IsNotNull( error->getChild(HX_("feature-not-implemented",71,20,2e,96),HX_("urn:ietf:params:xml:ns:xmpp-stanzas",27,f2,3d,30)) )) {
+HXLINE( 60) return null();
+ }
+HXLINE( 61) this->result = ::haxe::ds::Either_obj::Left(error->getText());
+ }
+ }
+HXLINE( 64) return this->result;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(JabberIqGatewayGet_obj,getResult,return )
+
+
+::hx::ObjectPtr< JabberIqGatewayGet_obj > JabberIqGatewayGet_obj::__new(::String to,::String prompt) {
+ ::hx::ObjectPtr< JabberIqGatewayGet_obj > __this = new JabberIqGatewayGet_obj();
+ __this->__construct(to,prompt);
+ return __this;
+}
+
+::hx::ObjectPtr< JabberIqGatewayGet_obj > JabberIqGatewayGet_obj::__alloc(::hx::Ctx *_hx_ctx,::String to,::String prompt) {
+ JabberIqGatewayGet_obj *__this = (JabberIqGatewayGet_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(JabberIqGatewayGet_obj), true, "snikket.queries.JabberIqGatewayGet"));
+ *(void **)__this = JabberIqGatewayGet_obj::_hx_vtable;
+ __this->__construct(to,prompt);
+ return __this;
+}
+
+JabberIqGatewayGet_obj::JabberIqGatewayGet_obj()
+{
+}
+
+void JabberIqGatewayGet_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(JabberIqGatewayGet);
+ HX_MARK_MEMBER_NAME(xmlns,"xmlns");
+ HX_MARK_MEMBER_NAME(queryId,"queryId");
+ HX_MARK_MEMBER_NAME(responseStanza,"responseStanza");
+ HX_MARK_MEMBER_NAME(result,"result");
+ ::snikket::queries::GenericQuery_obj::__Mark(HX_MARK_ARG);
+ HX_MARK_END_CLASS();
+}
+
+void JabberIqGatewayGet_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(xmlns,"xmlns");
+ HX_VISIT_MEMBER_NAME(queryId,"queryId");
+ HX_VISIT_MEMBER_NAME(responseStanza,"responseStanza");
+ HX_VISIT_MEMBER_NAME(result,"result");
+ ::snikket::queries::GenericQuery_obj::__Visit(HX_VISIT_ARG);
+}
+
+::hx::Val JabberIqGatewayGet_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"xmlns") ) { return ::hx::Val( xmlns ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"result") ) { return ::hx::Val( result ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"queryId") ) { return ::hx::Val( queryId ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"getResult") ) { return ::hx::Val( getResult_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"responseStanza") ) { return ::hx::Val( responseStanza ); }
+ if (HX_FIELD_EQ(inName,"handleResponse") ) { return ::hx::Val( handleResponse_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val JabberIqGatewayGet_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"xmlns") ) { xmlns=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"result") ) { result=inValue.Cast< ::haxe::ds::Either >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"queryId") ) { queryId=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"responseStanza") ) { responseStanza=inValue.Cast< ::snikket::Stanza >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void JabberIqGatewayGet_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("xmlns",dc,31,74,60));
+ outFields->push(HX_("queryId",03,9d,e9,95));
+ outFields->push(HX_("responseStanza",56,d7,9f,78));
+ outFields->push(HX_("result",dd,68,84,08));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo JabberIqGatewayGet_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(JabberIqGatewayGet_obj,xmlns),HX_("xmlns",dc,31,74,60)},
+ {::hx::fsString,(int)offsetof(JabberIqGatewayGet_obj,queryId),HX_("queryId",03,9d,e9,95)},
+ {::hx::fsObject /* ::snikket::Stanza */ ,(int)offsetof(JabberIqGatewayGet_obj,responseStanza),HX_("responseStanza",56,d7,9f,78)},
+ {::hx::fsObject /* ::haxe::ds::Either */ ,(int)offsetof(JabberIqGatewayGet_obj,result),HX_("result",dd,68,84,08)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *JabberIqGatewayGet_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String JabberIqGatewayGet_obj_sMemberFields[] = {
+ HX_("xmlns",dc,31,74,60),
+ HX_("queryId",03,9d,e9,95),
+ HX_("responseStanza",56,d7,9f,78),
+ HX_("result",dd,68,84,08),
+ HX_("handleResponse",49,d6,e3,ef),
+ HX_("getResult",13,f2,da,84),
+ ::String(null()) };
+
+::hx::Class JabberIqGatewayGet_obj::__mClass;
+
+void JabberIqGatewayGet_obj::__register()
+{
+ JabberIqGatewayGet_obj _hx_dummy;
+ JabberIqGatewayGet_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.queries.JabberIqGatewayGet",f7,f5,df,31);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(JabberIqGatewayGet_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< JabberIqGatewayGet_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = JabberIqGatewayGet_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = JabberIqGatewayGet_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace queries
diff --git a/Sources/c_snikket/src/snikket/queries/MAMQuery.cpp b/Sources/c_snikket/src/snikket/queries/MAMQuery.cpp
new file mode 100644
index 0000000..d2b5b7a
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/queries/MAMQuery.cpp
@@ -0,0 +1,343 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_Std
+#include <Std.h>
+#endif
+#ifndef INCLUDED_haxe_Exception
+#include <haxe/Exception.h>
+#endif
+#ifndef INCLUDED_snikket_ID
+#include <snikket/ID.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+#ifndef INCLUDED_snikket_queries_MAMQuery
+#include <snikket/queries/MAMQuery.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_ad21fb684642fb0b_31_new,"snikket.queries.MAMQuery","new",0x1ae471da,"snikket.queries.MAMQuery.new","snikket/queries/MAMQuery.hx",31,0x268a1914)
+HX_LOCAL_STACK_FRAME(_hx_pos_ad21fb684642fb0b_37_addStringField,"snikket.queries.MAMQuery","addStringField",0x2a088a4e,"snikket.queries.MAMQuery.addStringField","snikket/queries/MAMQuery.hx",37,0x268a1914)
+HX_LOCAL_STACK_FRAME(_hx_pos_ad21fb684642fb0b_47_addArrayField,"snikket.queries.MAMQuery","addArrayField",0x9f0cf3dc,"snikket.queries.MAMQuery.addArrayField","snikket/queries/MAMQuery.hx",47,0x268a1914)
+HX_LOCAL_STACK_FRAME(_hx_pos_ad21fb684642fb0b_96_handleResponse,"snikket.queries.MAMQuery","handleResponse",0x787f130f,"snikket.queries.MAMQuery.handleResponse","snikket/queries/MAMQuery.hx",96,0x268a1914)
+HX_LOCAL_STACK_FRAME(_hx_pos_ad21fb684642fb0b_101_getResult,"snikket.queries.MAMQuery","getResult",0xbc54eb0d,"snikket.queries.MAMQuery.getResult","snikket/queries/MAMQuery.hx",101,0x268a1914)
+namespace snikket{
+namespace queries{
+
+void MAMQuery_obj::__construct( ::Dynamic params,::String jid){
+ HX_GC_STACKFRAME(&_hx_pos_ad21fb684642fb0b_31_new)
+HXLINE( 33) this->queryId = null();
+HXLINE( 32) this->xmlns = HX_("urn:xmpp:mam:2",f5,ef,8c,da);
+HXLINE( 58) super::__construct();
+HXLINE( 60) this->queryId = ::snikket::ID_obj::_hx_short();
+HXLINE( 61) this->queryStanza = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("iq",e8,5b,00,00), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("to",7b,65,00,00),jid)
+ ->setFixed(1,HX_("type",ba,f2,08,4d),HX_("set",a2,9b,57,00))))->tag(HX_("query",08,8b,ea,5d), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("queryid",e3,b8,e9,95),this->queryId)
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),this->xmlns)))->tag(HX_("x",78,00,00,00), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("type",ba,f2,08,4d),HX_("submit",18,58,06,9a))
+ ->setFixed(1,HX_("xmlns",dc,31,74,60),HX_("jabber:x:data",c2,e1,e9,7c))))->tag(HX_("field",ba,94,93,00), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("var",e7,de,59,00),HX_("FORM_TYPE",d5,96,c9,5a))
+ ->setFixed(1,HX_("type",ba,f2,08,4d),HX_("hidden",6a,ff,95,4c))))->textTag(HX_("value",71,7f,b8,31),this->xmlns,null())->up();
+HXLINE( 69) this->addStringField(HX_("start",62,74,0b,84),( (::String)(params->__Field(HX_("startTime",8f,45,f0,05),::hx::paccDynamic)) ));
+HXLINE( 70) this->addStringField(HX_("end",db,03,4d,00),( (::String)(params->__Field(HX_("endTime",88,85,21,2f),::hx::paccDynamic)) ));
+HXLINE( 71) this->addStringField(HX_("with",06,76,f8,4e),( (::String)(params->__Field(HX_("with",06,76,f8,4e),::hx::paccDynamic)) ));
+HXLINE( 72) this->addStringField(HX_("before-id",29,c6,0e,2b),( (::String)(params->__Field(HX_("beforeId",3a,f2,cf,4a),::hx::paccDynamic)) ));
+HXLINE( 73) this->addStringField(HX_("after-id",ac,d4,05,12),( (::String)(params->__Field(HX_("afterId",17,65,9d,97),::hx::paccDynamic)) ));
+HXLINE( 74) this->addArrayField(HX_("ids",38,04,50,00),( (::Array< ::String >)(params->__Field(HX_("ids",38,04,50,00),::hx::paccDynamic)) ));
+HXLINE( 76) this->queryStanza->up();
+HXLINE( 78) if (::hx::IsNotNull( params->__Field(HX_("page",4f,da,51,4a),::hx::paccDynamic) )) {
+HXLINE( 79) ::Dynamic page = params->__Field(HX_("page",4f,da,51,4a),::hx::paccDynamic);
+HXLINE( 80) this->queryStanza->tag(HX_("set",a2,9b,57,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("http://jabber.org/protocol/rsm",98,7b,83,c6))));
+HXLINE( 81) if (::hx::IsNotNull( page->__Field(HX_("limit",3b,1f,01,75),::hx::paccDynamic) )) {
+HXLINE( 82) ::snikket::Stanza _hx_tmp = this->queryStanza;
+HXDLIN( 82) _hx_tmp->textTag(HX_("max",a4,0a,53,00),::Std_obj::string( ::Dynamic(page->__Field(HX_("limit",3b,1f,01,75),::hx::paccDynamic))),null());
+ }
+HXLINE( 84) bool _hx_tmp1;
+HXDLIN( 84) if (::hx::IsNotNull( page->__Field(HX_("before",7f,54,32,9a),::hx::paccDynamic) )) {
+HXLINE( 84) _hx_tmp1 = ::hx::IsNotNull( page->__Field(HX_("after",1c,66,a2,1d),::hx::paccDynamic) );
+ }
+ else {
+HXLINE( 84) _hx_tmp1 = false;
+ }
+HXDLIN( 84) if (_hx_tmp1) {
+HXLINE( 85) HX_STACK_DO_THROW( ::haxe::Exception_obj::__alloc( HX_CTX ,HX_("It is not allowed to request a page before AND a page after",72,f7,df,75),null(),null()));
+ }
+HXLINE( 87) if (::hx::IsNotNull( page->__Field(HX_("before",7f,54,32,9a),::hx::paccDynamic) )) {
+HXLINE( 88) this->queryStanza->textTag(HX_("before",7f,54,32,9a),( (::String)(page->__Field(HX_("before",7f,54,32,9a),::hx::paccDynamic)) ),null());
+ }
+ else {
+HXLINE( 89) if (::hx::IsNotNull( page->__Field(HX_("after",1c,66,a2,1d),::hx::paccDynamic) )) {
+HXLINE( 90) this->queryStanza->textTag(HX_("after",1c,66,a2,1d),( (::String)(page->__Field(HX_("after",1c,66,a2,1d),::hx::paccDynamic)) ),null());
+ }
+ }
+HXLINE( 92) this->queryStanza->up();
+ }
+ }
+
+Dynamic MAMQuery_obj::__CreateEmpty() { return new MAMQuery_obj; }
+
+void *MAMQuery_obj::_hx_vtable = 0;
+
+Dynamic MAMQuery_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< MAMQuery_obj > _hx_result = new MAMQuery_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1]);
+ return _hx_result;
+}
+
+bool MAMQuery_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x22eda35a) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x22eda35a;
+ } else {
+ return inClassId==(int)0x3d2643e0;
+ }
+}
+
+void MAMQuery_obj::addStringField(::String name,::String value){
+ HX_STACKFRAME(&_hx_pos_ad21fb684642fb0b_37_addStringField)
+HXLINE( 38) if (::hx::IsNull( value )) {
+HXLINE( 39) return;
+ }
+HXLINE( 41) this->queryStanza->tag(HX_("field",ba,94,93,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("var",e7,de,59,00),name)))->textTag(HX_("value",71,7f,b8,31),value,null())->up();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(MAMQuery_obj,addStringField,(void))
+
+void MAMQuery_obj::addArrayField(::String name,::Array< ::String > values){
+ HX_STACKFRAME(&_hx_pos_ad21fb684642fb0b_47_addArrayField)
+HXLINE( 48) if (::hx::IsNull( values )) {
+HXLINE( 49) return;
+ }
+HXLINE( 51) this->queryStanza->tag(HX_("field",ba,94,93,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("var",e7,de,59,00),name)));
+HXLINE( 52) {
+HXLINE( 52) int _g = 0;
+HXDLIN( 52) while((_g < values->length)){
+HXLINE( 52) ::String value = values->__get(_g);
+HXDLIN( 52) _g = (_g + 1);
+HXLINE( 53) this->queryStanza->textTag(HX_("value",71,7f,b8,31),value,null());
+ }
+ }
+HXLINE( 55) this->queryStanza->up();
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC2(MAMQuery_obj,addArrayField,(void))
+
+void MAMQuery_obj::handleResponse( ::snikket::Stanza stanza){
+ HX_STACKFRAME(&_hx_pos_ad21fb684642fb0b_96_handleResponse)
+HXLINE( 97) this->responseStanza = stanza;
+HXLINE( 98) this->finish();
+ }
+
+
+ ::Dynamic MAMQuery_obj::getResult(){
+ HX_STACKFRAME(&_hx_pos_ad21fb684642fb0b_101_getResult)
+HXLINE( 102) if (::hx::IsNull( this->responseStanza )) {
+HXLINE( 103) return null();
+ }
+HXLINE( 105) if (::hx::IsNull( this->result )) {
+HXLINE( 106) ::snikket::Stanza fin = this->responseStanza->getFirstChild();
+HXLINE( 107) bool _hx_tmp;
+HXDLIN( 107) bool _hx_tmp1;
+HXDLIN( 107) if (::hx::IsNotNull( fin )) {
+HXLINE( 107) _hx_tmp1 = (fin->name != HX_("fin",cb,c1,4d,00));
+ }
+ else {
+HXLINE( 107) _hx_tmp1 = true;
+ }
+HXDLIN( 107) if (!(_hx_tmp1)) {
+HXLINE( 107) ::String _hx_tmp2 = ( (::String)(::Reflect_obj::field(fin->attr,HX_("xmlns",dc,31,74,60))) );
+HXDLIN( 107) _hx_tmp = (_hx_tmp2 != this->xmlns);
+ }
+ else {
+HXLINE( 107) _hx_tmp = true;
+ }
+HXDLIN( 107) if (_hx_tmp) {
+HXLINE( 108) return null();
+ }
+HXLINE( 110) ::snikket::Stanza rsmInfo = fin->getChild(HX_("set",a2,9b,57,00),HX_("http://jabber.org/protocol/rsm",98,7b,83,c6));
+HXLINE( 111) ::String count = rsmInfo->getChildText(HX_("count",cf,44,63,4a),null());
+HXLINE( 113) bool _hx_tmp3;
+HXDLIN( 113) if ((( (::String)(::Reflect_obj::field(fin->attr,HX_("complete",b9,00,c8,7f))) ) != HX_("true",4e,a7,03,4d))) {
+HXLINE( 113) _hx_tmp3 = (( (::String)(::Reflect_obj::field(fin->attr,HX_("complete",b9,00,c8,7f))) ) == HX_("1",31,00,00,00));
+ }
+ else {
+HXLINE( 113) _hx_tmp3 = true;
+ }
+HXLINE( 115) ::String _hx_tmp4 = rsmInfo->getChildText(HX_("first",30,78,9d,00),null());
+HXLINE( 116) ::String _hx_tmp5 = rsmInfo->getChildText(HX_("last",56,0a,ad,47),null());
+HXLINE( 117) ::Dynamic _hx_tmp6;
+HXDLIN( 117) if (::hx::IsNull( count )) {
+HXLINE( 117) _hx_tmp6 = null();
+ }
+ else {
+HXLINE( 117) _hx_tmp6 = ::Std_obj::parseInt(count);
+ }
+HXLINE( 112) this->result = ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("page",4f,da,51,4a), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("first",30,78,9d,00),_hx_tmp4)
+ ->setFixed(1,HX_("last",56,0a,ad,47),_hx_tmp5)
+ ->setFixed(2,HX_("count",cf,44,63,4a),_hx_tmp6)))
+ ->setFixed(1,HX_("complete",b9,00,c8,7f),_hx_tmp3));
+ }
+HXLINE( 121) return this->result;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(MAMQuery_obj,getResult,return )
+
+
+::hx::ObjectPtr< MAMQuery_obj > MAMQuery_obj::__new( ::Dynamic params,::String jid) {
+ ::hx::ObjectPtr< MAMQuery_obj > __this = new MAMQuery_obj();
+ __this->__construct(params,jid);
+ return __this;
+}
+
+::hx::ObjectPtr< MAMQuery_obj > MAMQuery_obj::__alloc(::hx::Ctx *_hx_ctx, ::Dynamic params,::String jid) {
+ MAMQuery_obj *__this = (MAMQuery_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(MAMQuery_obj), true, "snikket.queries.MAMQuery"));
+ *(void **)__this = MAMQuery_obj::_hx_vtable;
+ __this->__construct(params,jid);
+ return __this;
+}
+
+MAMQuery_obj::MAMQuery_obj()
+{
+}
+
+void MAMQuery_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(MAMQuery);
+ HX_MARK_MEMBER_NAME(xmlns,"xmlns");
+ HX_MARK_MEMBER_NAME(queryId,"queryId");
+ HX_MARK_MEMBER_NAME(responseStanza,"responseStanza");
+ HX_MARK_MEMBER_NAME(result,"result");
+ ::snikket::queries::GenericQuery_obj::__Mark(HX_MARK_ARG);
+ HX_MARK_END_CLASS();
+}
+
+void MAMQuery_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(xmlns,"xmlns");
+ HX_VISIT_MEMBER_NAME(queryId,"queryId");
+ HX_VISIT_MEMBER_NAME(responseStanza,"responseStanza");
+ HX_VISIT_MEMBER_NAME(result,"result");
+ ::snikket::queries::GenericQuery_obj::__Visit(HX_VISIT_ARG);
+}
+
+::hx::Val MAMQuery_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"xmlns") ) { return ::hx::Val( xmlns ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"result") ) { return ::hx::Val( result ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"queryId") ) { return ::hx::Val( queryId ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"getResult") ) { return ::hx::Val( getResult_dyn() ); }
+ break;
+ case 13:
+ if (HX_FIELD_EQ(inName,"addArrayField") ) { return ::hx::Val( addArrayField_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"responseStanza") ) { return ::hx::Val( responseStanza ); }
+ if (HX_FIELD_EQ(inName,"addStringField") ) { return ::hx::Val( addStringField_dyn() ); }
+ if (HX_FIELD_EQ(inName,"handleResponse") ) { return ::hx::Val( handleResponse_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val MAMQuery_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"xmlns") ) { xmlns=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"result") ) { result=inValue.Cast< ::Dynamic >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"queryId") ) { queryId=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"responseStanza") ) { responseStanza=inValue.Cast< ::snikket::Stanza >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void MAMQuery_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("xmlns",dc,31,74,60));
+ outFields->push(HX_("queryId",03,9d,e9,95));
+ outFields->push(HX_("responseStanza",56,d7,9f,78));
+ outFields->push(HX_("result",dd,68,84,08));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo MAMQuery_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(MAMQuery_obj,xmlns),HX_("xmlns",dc,31,74,60)},
+ {::hx::fsString,(int)offsetof(MAMQuery_obj,queryId),HX_("queryId",03,9d,e9,95)},
+ {::hx::fsObject /* ::snikket::Stanza */ ,(int)offsetof(MAMQuery_obj,responseStanza),HX_("responseStanza",56,d7,9f,78)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(MAMQuery_obj,result),HX_("result",dd,68,84,08)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *MAMQuery_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String MAMQuery_obj_sMemberFields[] = {
+ HX_("xmlns",dc,31,74,60),
+ HX_("queryId",03,9d,e9,95),
+ HX_("responseStanza",56,d7,9f,78),
+ HX_("result",dd,68,84,08),
+ HX_("addStringField",88,4d,6d,a1),
+ HX_("addArrayField",e2,f5,09,65),
+ HX_("handleResponse",49,d6,e3,ef),
+ HX_("getResult",13,f2,da,84),
+ ::String(null()) };
+
+::hx::Class MAMQuery_obj::__mClass;
+
+void MAMQuery_obj::__register()
+{
+ MAMQuery_obj _hx_dummy;
+ MAMQuery_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.queries.MAMQuery",e8,3c,64,5a);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(MAMQuery_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< MAMQuery_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = MAMQuery_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = MAMQuery_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace queries
diff --git a/Sources/c_snikket/src/snikket/queries/PubsubGet.cpp b/Sources/c_snikket/src/snikket/queries/PubsubGet.cpp
new file mode 100644
index 0000000..1476d3b
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/queries/PubsubGet.cpp
@@ -0,0 +1,252 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_snikket_ID
+#include <snikket/ID.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+#ifndef INCLUDED_snikket_queries_PubsubGet
+#include <snikket/queries/PubsubGet.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_ba05e84f77093de1_12_new,"snikket.queries.PubsubGet","new",0x3235da0c,"snikket.queries.PubsubGet.new","snikket/queries/PubsubGet.hx",12,0x4ae00ee6)
+HX_LOCAL_STACK_FRAME(_hx_pos_ba05e84f77093de1_34_handleResponse,"snikket.queries.PubsubGet","handleResponse",0x0cba141d,"snikket.queries.PubsubGet.handleResponse","snikket/queries/PubsubGet.hx",34,0x4ae00ee6)
+HX_LOCAL_STACK_FRAME(_hx_pos_ba05e84f77093de1_39_getResult,"snikket.queries.PubsubGet","getResult",0x7dd584bf,"snikket.queries.PubsubGet.getResult","snikket/queries/PubsubGet.hx",39,0x4ae00ee6)
+namespace snikket{
+namespace queries{
+
+void PubsubGet_obj::__construct(::String to,::String node,::String itemId){
+ HX_GC_STACKFRAME(&_hx_pos_ba05e84f77093de1_12_new)
+HXLINE( 15) this->ver = null();
+HXLINE( 14) this->queryId = null();
+HXLINE( 13) this->xmlns = HX_("http://jabber.org/protocol/pubsub",57,94,3c,f2);
+HXLINE( 19) super::__construct();
+HXLINE( 20) ::Dynamic attr = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("node",02,0a,0a,49),node));
+HXLINE( 21) if (::hx::IsNotNull( this->ver )) {
+HXLINE( 21) ::String value = this->ver;
+HXDLIN( 21) ::Reflect_obj::setField(attr,HX_("ver",63,e2,59,00),value);
+ }
+HXLINE( 23) this->queryId = ::snikket::ID_obj::_hx_short();
+HXLINE( 24) this->queryStanza = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("iq",e8,5b,00,00), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("id",db,5b,00,00),this->queryId)
+ ->setFixed(1,HX_("to",7b,65,00,00),to)
+ ->setFixed(2,HX_("type",ba,f2,08,4d),HX_("get",96,80,4e,00))));
+HXLINE( 25) ::snikket::Stanza items = this->queryStanza->tag(HX_("pubsub",e3,da,f8,66), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),this->xmlns)))->tag(HX_("items",00,ac,0c,c2), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("node",02,0a,0a,49),node)));
+HXLINE( 28) if (::hx::IsNotNull( itemId )) {
+HXLINE( 29) items->tag(HX_("item",13,c5,bf,45), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("id",db,5b,00,00),itemId)))->up();
+ }
+HXLINE( 31) this->queryStanza->up()->up();
+ }
+
+Dynamic PubsubGet_obj::__CreateEmpty() { return new PubsubGet_obj; }
+
+void *PubsubGet_obj::_hx_vtable = 0;
+
+Dynamic PubsubGet_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< PubsubGet_obj > _hx_result = new PubsubGet_obj();
+ _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2]);
+ return _hx_result;
+}
+
+bool PubsubGet_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x1a0e23ea) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x1a0e23ea;
+ } else {
+ return inClassId==(int)0x22eda35a;
+ }
+}
+
+void PubsubGet_obj::handleResponse( ::snikket::Stanza stanza){
+ HX_STACKFRAME(&_hx_pos_ba05e84f77093de1_34_handleResponse)
+HXLINE( 35) this->responseStanza = stanza;
+HXLINE( 36) this->finish();
+ }
+
+
+::Array< ::Dynamic> PubsubGet_obj::getResult(){
+ HX_STACKFRAME(&_hx_pos_ba05e84f77093de1_39_getResult)
+HXLINE( 40) if (::hx::IsNull( this->responseStanza )) {
+HXLINE( 41) return ::Array_obj< ::Dynamic>::__new(0);
+ }
+HXLINE( 43) if (::hx::IsNull( this->result )) {
+HXLINE( 44) ::snikket::Stanza q = this->responseStanza->getChild(HX_("pubsub",e3,da,f8,66),this->xmlns);
+HXLINE( 45) if (::hx::IsNull( q )) {
+HXLINE( 46) return ::Array_obj< ::Dynamic>::__new(0);
+ }
+HXLINE( 48) ::snikket::Stanza items = q->getChild(HX_("items",00,ac,0c,c2),null());
+HXLINE( 49) if (::hx::IsNull( items )) {
+HXLINE( 50) return ::Array_obj< ::Dynamic>::__new(0);
+ }
+HXLINE( 52) if (::hx::IsNull( ( (::String)(::Reflect_obj::field(items->attr,HX_("xmlns",dc,31,74,60))) ) )) {
+HXLINE( 52) ::String value = this->xmlns;
+HXDLIN( 52) ::Reflect_obj::setField(items->attr,HX_("xmlns",dc,31,74,60),value);
+ }
+HXLINE( 54) this->result = items->allTags(HX_("item",13,c5,bf,45),null());
+ }
+HXLINE( 56) return this->result;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(PubsubGet_obj,getResult,return )
+
+
+::hx::ObjectPtr< PubsubGet_obj > PubsubGet_obj::__new(::String to,::String node,::String itemId) {
+ ::hx::ObjectPtr< PubsubGet_obj > __this = new PubsubGet_obj();
+ __this->__construct(to,node,itemId);
+ return __this;
+}
+
+::hx::ObjectPtr< PubsubGet_obj > PubsubGet_obj::__alloc(::hx::Ctx *_hx_ctx,::String to,::String node,::String itemId) {
+ PubsubGet_obj *__this = (PubsubGet_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(PubsubGet_obj), true, "snikket.queries.PubsubGet"));
+ *(void **)__this = PubsubGet_obj::_hx_vtable;
+ __this->__construct(to,node,itemId);
+ return __this;
+}
+
+PubsubGet_obj::PubsubGet_obj()
+{
+}
+
+void PubsubGet_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(PubsubGet);
+ HX_MARK_MEMBER_NAME(xmlns,"xmlns");
+ HX_MARK_MEMBER_NAME(queryId,"queryId");
+ HX_MARK_MEMBER_NAME(ver,"ver");
+ HX_MARK_MEMBER_NAME(responseStanza,"responseStanza");
+ HX_MARK_MEMBER_NAME(result,"result");
+ ::snikket::queries::GenericQuery_obj::__Mark(HX_MARK_ARG);
+ HX_MARK_END_CLASS();
+}
+
+void PubsubGet_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(xmlns,"xmlns");
+ HX_VISIT_MEMBER_NAME(queryId,"queryId");
+ HX_VISIT_MEMBER_NAME(ver,"ver");
+ HX_VISIT_MEMBER_NAME(responseStanza,"responseStanza");
+ HX_VISIT_MEMBER_NAME(result,"result");
+ ::snikket::queries::GenericQuery_obj::__Visit(HX_VISIT_ARG);
+}
+
+::hx::Val PubsubGet_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"ver") ) { return ::hx::Val( ver ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"xmlns") ) { return ::hx::Val( xmlns ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"result") ) { return ::hx::Val( result ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"queryId") ) { return ::hx::Val( queryId ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"getResult") ) { return ::hx::Val( getResult_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"responseStanza") ) { return ::hx::Val( responseStanza ); }
+ if (HX_FIELD_EQ(inName,"handleResponse") ) { return ::hx::Val( handleResponse_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val PubsubGet_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"ver") ) { ver=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"xmlns") ) { xmlns=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"result") ) { result=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"queryId") ) { queryId=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"responseStanza") ) { responseStanza=inValue.Cast< ::snikket::Stanza >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void PubsubGet_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("xmlns",dc,31,74,60));
+ outFields->push(HX_("queryId",03,9d,e9,95));
+ outFields->push(HX_("ver",63,e2,59,00));
+ outFields->push(HX_("responseStanza",56,d7,9f,78));
+ outFields->push(HX_("result",dd,68,84,08));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo PubsubGet_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(PubsubGet_obj,xmlns),HX_("xmlns",dc,31,74,60)},
+ {::hx::fsString,(int)offsetof(PubsubGet_obj,queryId),HX_("queryId",03,9d,e9,95)},
+ {::hx::fsString,(int)offsetof(PubsubGet_obj,ver),HX_("ver",63,e2,59,00)},
+ {::hx::fsObject /* ::snikket::Stanza */ ,(int)offsetof(PubsubGet_obj,responseStanza),HX_("responseStanza",56,d7,9f,78)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(PubsubGet_obj,result),HX_("result",dd,68,84,08)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *PubsubGet_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String PubsubGet_obj_sMemberFields[] = {
+ HX_("xmlns",dc,31,74,60),
+ HX_("queryId",03,9d,e9,95),
+ HX_("ver",63,e2,59,00),
+ HX_("responseStanza",56,d7,9f,78),
+ HX_("result",dd,68,84,08),
+ HX_("handleResponse",49,d6,e3,ef),
+ HX_("getResult",13,f2,da,84),
+ ::String(null()) };
+
+::hx::Class PubsubGet_obj::__mClass;
+
+void PubsubGet_obj::__register()
+{
+ PubsubGet_obj _hx_dummy;
+ PubsubGet_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.queries.PubsubGet",1a,24,ad,d3);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(PubsubGet_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< PubsubGet_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = PubsubGet_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = PubsubGet_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace queries
diff --git a/Sources/c_snikket/src/snikket/queries/Push2Disable.cpp b/Sources/c_snikket/src/snikket/queries/Push2Disable.cpp
new file mode 100644
index 0000000..97e6880
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/queries/Push2Disable.cpp
@@ -0,0 +1,183 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_snikket_ID
+#include <snikket/ID.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+#ifndef INCLUDED_snikket_queries_Push2Disable
+#include <snikket/queries/Push2Disable.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_d483343c88031d78_10_new,"snikket.queries.Push2Disable","new",0x6681acdb,"snikket.queries.Push2Disable.new","snikket/queries/Push2Disable.hx",10,0x4039f033)
+HX_LOCAL_STACK_FRAME(_hx_pos_d483343c88031d78_25_handleResponse,"snikket.queries.Push2Disable","handleResponse",0xa80525ae,"snikket.queries.Push2Disable.handleResponse","snikket/queries/Push2Disable.hx",25,0x4039f033)
+namespace snikket{
+namespace queries{
+
+void Push2Disable_obj::__construct(::String to){
+ HX_GC_STACKFRAME(&_hx_pos_d483343c88031d78_10_new)
+HXLINE( 12) this->queryId = null();
+HXLINE( 11) this->xmlns = HX_("urn:xmpp:push2:0",32,b1,53,5a);
+HXLINE( 16) super::__construct();
+HXLINE( 17) this->queryId = ::snikket::ID_obj::_hx_short();
+HXLINE( 18) this->queryStanza = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("iq",e8,5b,00,00), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("id",db,5b,00,00),this->queryId)
+ ->setFixed(1,HX_("to",7b,65,00,00),to)
+ ->setFixed(2,HX_("type",ba,f2,08,4d),HX_("set",a2,9b,57,00))));
+HXLINE( 22) this->queryStanza->tag(HX_("disable",e8,69,58,b1), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),this->xmlns)));
+ }
+
+Dynamic Push2Disable_obj::__CreateEmpty() { return new Push2Disable_obj; }
+
+void *Push2Disable_obj::_hx_vtable = 0;
+
+Dynamic Push2Disable_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< Push2Disable_obj > _hx_result = new Push2Disable_obj();
+ _hx_result->__construct(inArgs[0]);
+ return _hx_result;
+}
+
+bool Push2Disable_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x22eda35a) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x22eda35a;
+ } else {
+ return inClassId==(int)0x582a6599;
+ }
+}
+
+void Push2Disable_obj::handleResponse( ::snikket::Stanza stanza){
+ HX_STACKFRAME(&_hx_pos_d483343c88031d78_25_handleResponse)
+HXLINE( 26) this->responseStanza = stanza;
+HXLINE( 27) this->finish();
+ }
+
+
+
+::hx::ObjectPtr< Push2Disable_obj > Push2Disable_obj::__new(::String to) {
+ ::hx::ObjectPtr< Push2Disable_obj > __this = new Push2Disable_obj();
+ __this->__construct(to);
+ return __this;
+}
+
+::hx::ObjectPtr< Push2Disable_obj > Push2Disable_obj::__alloc(::hx::Ctx *_hx_ctx,::String to) {
+ Push2Disable_obj *__this = (Push2Disable_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Push2Disable_obj), true, "snikket.queries.Push2Disable"));
+ *(void **)__this = Push2Disable_obj::_hx_vtable;
+ __this->__construct(to);
+ return __this;
+}
+
+Push2Disable_obj::Push2Disable_obj()
+{
+}
+
+void Push2Disable_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(Push2Disable);
+ HX_MARK_MEMBER_NAME(xmlns,"xmlns");
+ HX_MARK_MEMBER_NAME(queryId,"queryId");
+ HX_MARK_MEMBER_NAME(responseStanza,"responseStanza");
+ ::snikket::queries::GenericQuery_obj::__Mark(HX_MARK_ARG);
+ HX_MARK_END_CLASS();
+}
+
+void Push2Disable_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(xmlns,"xmlns");
+ HX_VISIT_MEMBER_NAME(queryId,"queryId");
+ HX_VISIT_MEMBER_NAME(responseStanza,"responseStanza");
+ ::snikket::queries::GenericQuery_obj::__Visit(HX_VISIT_ARG);
+}
+
+::hx::Val Push2Disable_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"xmlns") ) { return ::hx::Val( xmlns ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"queryId") ) { return ::hx::Val( queryId ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"responseStanza") ) { return ::hx::Val( responseStanza ); }
+ if (HX_FIELD_EQ(inName,"handleResponse") ) { return ::hx::Val( handleResponse_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val Push2Disable_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"xmlns") ) { xmlns=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"queryId") ) { queryId=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"responseStanza") ) { responseStanza=inValue.Cast< ::snikket::Stanza >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void Push2Disable_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("xmlns",dc,31,74,60));
+ outFields->push(HX_("queryId",03,9d,e9,95));
+ outFields->push(HX_("responseStanza",56,d7,9f,78));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo Push2Disable_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(Push2Disable_obj,xmlns),HX_("xmlns",dc,31,74,60)},
+ {::hx::fsString,(int)offsetof(Push2Disable_obj,queryId),HX_("queryId",03,9d,e9,95)},
+ {::hx::fsObject /* ::snikket::Stanza */ ,(int)offsetof(Push2Disable_obj,responseStanza),HX_("responseStanza",56,d7,9f,78)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *Push2Disable_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String Push2Disable_obj_sMemberFields[] = {
+ HX_("xmlns",dc,31,74,60),
+ HX_("queryId",03,9d,e9,95),
+ HX_("responseStanza",56,d7,9f,78),
+ HX_("handleResponse",49,d6,e3,ef),
+ ::String(null()) };
+
+::hx::Class Push2Disable_obj::__mClass;
+
+void Push2Disable_obj::__register()
+{
+ Push2Disable_obj _hx_dummy;
+ Push2Disable_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.queries.Push2Disable",69,a3,a5,4b);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(Push2Disable_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< Push2Disable_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = Push2Disable_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = Push2Disable_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace queries
diff --git a/Sources/c_snikket/src/snikket/queries/RosterGet.cpp b/Sources/c_snikket/src/snikket/queries/RosterGet.cpp
new file mode 100644
index 0000000..dba1a32
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/queries/RosterGet.cpp
@@ -0,0 +1,254 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_snikket_ID
+#include <snikket/ID.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+#ifndef INCLUDED_snikket_queries_RosterGet
+#include <snikket/queries/RosterGet.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_3a53c55b98f9d41a_12_new,"snikket.queries.RosterGet","new",0xe65a6c64,"snikket.queries.RosterGet.new","snikket/queries/RosterGet.hx",12,0x673c0f8e)
+HX_LOCAL_STACK_FRAME(_hx_pos_3a53c55b98f9d41a_29_handleResponse,"snikket.queries.RosterGet","handleResponse",0x096870c5,"snikket.queries.RosterGet.handleResponse","snikket/queries/RosterGet.hx",29,0x673c0f8e)
+HX_LOCAL_STACK_FRAME(_hx_pos_3a53c55b98f9d41a_34_getResult,"snikket.queries.RosterGet","getResult",0x6e146917,"snikket.queries.RosterGet.getResult","snikket/queries/RosterGet.hx",34,0x673c0f8e)
+namespace snikket{
+namespace queries{
+
+void RosterGet_obj::__construct(::String ver){
+ HX_GC_STACKFRAME(&_hx_pos_3a53c55b98f9d41a_12_new)
+HXLINE( 15) this->ver = null();
+HXLINE( 14) this->queryId = null();
+HXLINE( 13) this->xmlns = HX_("jabber:iq:roster",47,76,6e,06);
+HXLINE( 19) super::__construct();
+HXLINE( 20) ::Dynamic attr = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),this->xmlns));
+HXLINE( 21) if (::hx::IsNotNull( ver )) {
+HXLINE( 21) ::Reflect_obj::setField(attr,HX_("ver",63,e2,59,00),ver);
+ }
+HXLINE( 23) this->queryId = ::snikket::ID_obj::_hx_short();
+HXLINE( 24) this->queryStanza = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("iq",e8,5b,00,00), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("type",ba,f2,08,4d),HX_("get",96,80,4e,00))))->tag(HX_("query",08,8b,ea,5d),attr)->up();
+ }
+
+Dynamic RosterGet_obj::__CreateEmpty() { return new RosterGet_obj; }
+
+void *RosterGet_obj::_hx_vtable = 0;
+
+Dynamic RosterGet_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< RosterGet_obj > _hx_result = new RosterGet_obj();
+ _hx_result->__construct(inArgs[0]);
+ return _hx_result;
+}
+
+bool RosterGet_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x22eda35a) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x22eda35a;
+ } else {
+ return inClassId==(int)0x6634aa42;
+ }
+}
+
+void RosterGet_obj::handleResponse( ::snikket::Stanza stanza){
+ HX_STACKFRAME(&_hx_pos_3a53c55b98f9d41a_29_handleResponse)
+HXLINE( 30) this->responseStanza = stanza;
+HXLINE( 31) this->finish();
+ }
+
+
+::Array< ::Dynamic> RosterGet_obj::getResult(){
+ HX_STACKFRAME(&_hx_pos_3a53c55b98f9d41a_34_getResult)
+HXLINE( 35) if (::hx::IsNull( this->responseStanza )) {
+HXLINE( 36) return ::Array_obj< ::Dynamic>::__new(0);
+ }
+HXLINE( 38) if (::hx::IsNull( this->result )) {
+HXLINE( 39) ::snikket::Stanza q = this->responseStanza->getChild(HX_("query",08,8b,ea,5d),HX_("jabber:iq:roster",47,76,6e,06));
+HXLINE( 40) if (::hx::IsNull( q )) {
+HXLINE( 41) return ::Array_obj< ::Dynamic>::__new(0);
+ }
+HXLINE( 43) this->ver = ( (::String)(::Reflect_obj::field(q->attr,HX_("ver",63,e2,59,00))) );
+HXLINE( 45) ::Array< ::Dynamic> _this = q->allTags(HX_("item",13,c5,bf,45),null());
+HXDLIN( 45) ::Array< ::Dynamic> result = ::Array_obj< ::Dynamic>::__new(_this->length);
+HXDLIN( 45) {
+HXLINE( 45) int _g = 0;
+HXDLIN( 45) int _g1 = _this->length;
+HXDLIN( 45) while((_g < _g1)){
+HXLINE( 45) _g = (_g + 1);
+HXDLIN( 45) int i = (_g - 1);
+HXDLIN( 45) {
+HXLINE( 45) ::snikket::Stanza item = ( ( ::snikket::Stanza)(_hx_array_unsafe_get(_this,i)) );
+HXLINE( 46) ::String inValue = ( (::String)(::Reflect_obj::field(item->attr,HX_("jid",c5,ca,50,00))) );
+HXLINE( 47) ::String inValue1 = ( (::String)(::Reflect_obj::field(item->attr,HX_("name",4b,72,ff,48))) );
+HXLINE( 45) ::Dynamic inValue2 = ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("fn",48,59,00,00),inValue1)
+ ->setFixed(1,HX_("jid",c5,ca,50,00),inValue)
+ ->setFixed(2,HX_("subscription",1d,ff,00,36),( (::String)(::Reflect_obj::field(item->attr,HX_("subscription",1d,ff,00,36))) )));
+HXDLIN( 45) result->__unsafe_set(i,inValue2);
+ }
+ }
+ }
+HXDLIN( 45) this->result = result;
+ }
+HXLINE( 51) return this->result;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(RosterGet_obj,getResult,return )
+
+
+::hx::ObjectPtr< RosterGet_obj > RosterGet_obj::__new(::String ver) {
+ ::hx::ObjectPtr< RosterGet_obj > __this = new RosterGet_obj();
+ __this->__construct(ver);
+ return __this;
+}
+
+::hx::ObjectPtr< RosterGet_obj > RosterGet_obj::__alloc(::hx::Ctx *_hx_ctx,::String ver) {
+ RosterGet_obj *__this = (RosterGet_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(RosterGet_obj), true, "snikket.queries.RosterGet"));
+ *(void **)__this = RosterGet_obj::_hx_vtable;
+ __this->__construct(ver);
+ return __this;
+}
+
+RosterGet_obj::RosterGet_obj()
+{
+}
+
+void RosterGet_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(RosterGet);
+ HX_MARK_MEMBER_NAME(xmlns,"xmlns");
+ HX_MARK_MEMBER_NAME(queryId,"queryId");
+ HX_MARK_MEMBER_NAME(ver,"ver");
+ HX_MARK_MEMBER_NAME(responseStanza,"responseStanza");
+ HX_MARK_MEMBER_NAME(result,"result");
+ ::snikket::queries::GenericQuery_obj::__Mark(HX_MARK_ARG);
+ HX_MARK_END_CLASS();
+}
+
+void RosterGet_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(xmlns,"xmlns");
+ HX_VISIT_MEMBER_NAME(queryId,"queryId");
+ HX_VISIT_MEMBER_NAME(ver,"ver");
+ HX_VISIT_MEMBER_NAME(responseStanza,"responseStanza");
+ HX_VISIT_MEMBER_NAME(result,"result");
+ ::snikket::queries::GenericQuery_obj::__Visit(HX_VISIT_ARG);
+}
+
+::hx::Val RosterGet_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"ver") ) { return ::hx::Val( ver ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"xmlns") ) { return ::hx::Val( xmlns ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"result") ) { return ::hx::Val( result ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"queryId") ) { return ::hx::Val( queryId ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"getResult") ) { return ::hx::Val( getResult_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"responseStanza") ) { return ::hx::Val( responseStanza ); }
+ if (HX_FIELD_EQ(inName,"handleResponse") ) { return ::hx::Val( handleResponse_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val RosterGet_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 3:
+ if (HX_FIELD_EQ(inName,"ver") ) { ver=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"xmlns") ) { xmlns=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"result") ) { result=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"queryId") ) { queryId=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"responseStanza") ) { responseStanza=inValue.Cast< ::snikket::Stanza >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void RosterGet_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("xmlns",dc,31,74,60));
+ outFields->push(HX_("queryId",03,9d,e9,95));
+ outFields->push(HX_("ver",63,e2,59,00));
+ outFields->push(HX_("responseStanza",56,d7,9f,78));
+ outFields->push(HX_("result",dd,68,84,08));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo RosterGet_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(RosterGet_obj,xmlns),HX_("xmlns",dc,31,74,60)},
+ {::hx::fsString,(int)offsetof(RosterGet_obj,queryId),HX_("queryId",03,9d,e9,95)},
+ {::hx::fsString,(int)offsetof(RosterGet_obj,ver),HX_("ver",63,e2,59,00)},
+ {::hx::fsObject /* ::snikket::Stanza */ ,(int)offsetof(RosterGet_obj,responseStanza),HX_("responseStanza",56,d7,9f,78)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(RosterGet_obj,result),HX_("result",dd,68,84,08)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *RosterGet_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String RosterGet_obj_sMemberFields[] = {
+ HX_("xmlns",dc,31,74,60),
+ HX_("queryId",03,9d,e9,95),
+ HX_("ver",63,e2,59,00),
+ HX_("responseStanza",56,d7,9f,78),
+ HX_("result",dd,68,84,08),
+ HX_("handleResponse",49,d6,e3,ef),
+ HX_("getResult",13,f2,da,84),
+ ::String(null()) };
+
+::hx::Class RosterGet_obj::__mClass;
+
+void RosterGet_obj::__register()
+{
+ RosterGet_obj _hx_dummy;
+ RosterGet_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.queries.RosterGet",72,aa,d3,1f);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(RosterGet_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< RosterGet_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = RosterGet_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = RosterGet_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace queries
diff --git a/Sources/c_snikket/src/snikket/queries/VcardTempGet.cpp b/Sources/c_snikket/src/snikket/queries/VcardTempGet.cpp
new file mode 100644
index 0000000..562419e
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/queries/VcardTempGet.cpp
@@ -0,0 +1,250 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_StringTools
+#include <StringTools.h>
+#endif
+#ifndef INCLUDED_haxe_crypto_Base64
+#include <haxe/crypto/Base64.h>
+#endif
+#ifndef INCLUDED_haxe_io_Bytes
+#include <haxe/io/Bytes.h>
+#endif
+#ifndef INCLUDED_snikket_ID
+#include <snikket/ID.h>
+#endif
+#ifndef INCLUDED_snikket_JID
+#include <snikket/JID.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_queries_GenericQuery
+#include <snikket/queries/GenericQuery.h>
+#endif
+#ifndef INCLUDED_snikket_queries_VcardTempGet
+#include <snikket/queries/VcardTempGet.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_1143cb80f11a3cd2_14_new,"snikket.queries.VcardTempGet","new",0x61729067,"snikket.queries.VcardTempGet.new","snikket/queries/VcardTempGet.hx",14,0xeb40c227)
+HX_LOCAL_STACK_FRAME(_hx_pos_1143cb80f11a3cd2_28_handleResponse,"snikket.queries.VcardTempGet","handleResponse",0x65f915a2,"snikket.queries.VcardTempGet.handleResponse","snikket/queries/VcardTempGet.hx",28,0xeb40c227)
+HX_LOCAL_STACK_FRAME(_hx_pos_1143cb80f11a3cd2_33_getResult,"snikket.queries.VcardTempGet","getResult",0xcc9ff15a,"snikket.queries.VcardTempGet.getResult","snikket/queries/VcardTempGet.hx",33,0xeb40c227)
+namespace snikket{
+namespace queries{
+
+void VcardTempGet_obj::__construct( ::snikket::JID to){
+ HX_GC_STACKFRAME(&_hx_pos_1143cb80f11a3cd2_14_new)
+HXLINE( 16) this->queryId = null();
+HXLINE( 15) this->xmlns = HX_("vcard-temp",bb,ee,0c,98);
+HXLINE( 21) super::__construct();
+HXLINE( 23) this->queryId = ::snikket::ID_obj::_hx_short();
+HXLINE( 24) ::String _hx_tmp = to->asString();
+HXDLIN( 24) this->queryStanza = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("iq",e8,5b,00,00), ::Dynamic(::hx::Anon_obj::Create(3)
+ ->setFixed(0,HX_("id",db,5b,00,00),this->queryId)
+ ->setFixed(1,HX_("to",7b,65,00,00),_hx_tmp)
+ ->setFixed(2,HX_("type",ba,f2,08,4d),HX_("get",96,80,4e,00))));
+HXLINE( 25) this->queryStanza->tag(HX_("vCard",66,bd,db,1d), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),this->xmlns)))->up();
+ }
+
+Dynamic VcardTempGet_obj::__CreateEmpty() { return new VcardTempGet_obj; }
+
+void *VcardTempGet_obj::_hx_vtable = 0;
+
+Dynamic VcardTempGet_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< VcardTempGet_obj > _hx_result = new VcardTempGet_obj();
+ _hx_result->__construct(inArgs[0]);
+ return _hx_result;
+}
+
+bool VcardTempGet_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x22eda35a) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x22eda35a;
+ } else {
+ return inClassId==(int)0x4c679325;
+ }
+}
+
+void VcardTempGet_obj::handleResponse( ::snikket::Stanza stanza){
+ HX_STACKFRAME(&_hx_pos_1143cb80f11a3cd2_28_handleResponse)
+HXLINE( 29) this->responseStanza = stanza;
+HXLINE( 30) this->finish();
+ }
+
+
+ ::Dynamic VcardTempGet_obj::getResult(){
+ HX_STACKFRAME(&_hx_pos_1143cb80f11a3cd2_33_getResult)
+HXLINE( 34) if (::hx::IsNull( this->responseStanza )) {
+HXLINE( 35) return ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("photo",b2,c8,f3,c1),null()));
+ }
+HXLINE( 37) if (::hx::IsNull( this->result )) {
+HXLINE( 38) ::snikket::Stanza vcard = this->responseStanza->getChild(HX_("vCard",66,bd,db,1d),this->xmlns);
+HXLINE( 39) if (::hx::IsNull( vcard )) {
+HXLINE( 40) return ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("photo",b2,c8,f3,c1),null()));
+ }
+HXLINE( 42) ::String photoMime = vcard->findText(HX_("PHOTO/TYPE#",ac,57,1f,70));
+HXLINE( 43) ::String photoBinval = vcard->findText(HX_("PHOTO/BINVAL#",ac,f8,b3,ca));
+HXLINE( 44) bool _hx_tmp;
+HXDLIN( 44) if (::hx::IsNotNull( photoMime )) {
+HXLINE( 44) _hx_tmp = ::hx::IsNotNull( photoBinval );
+ }
+ else {
+HXLINE( 44) _hx_tmp = false;
+ }
+HXDLIN( 44) if (_hx_tmp) {
+HXLINE( 45) this->result = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("photo",b2,c8,f3,c1), ::Dynamic(::hx::Anon_obj::Create(2)
+ ->setFixed(0,HX_("data",2a,56,63,42),::haxe::crypto::Base64_obj::decode(::StringTools_obj::replace(photoBinval,HX_("\n",0a,00,00,00),HX_("",00,00,00,00)),null()))
+ ->setFixed(1,HX_("mime",b4,4d,5c,48),photoMime))));
+ }
+ else {
+HXLINE( 47) this->result = ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("photo",b2,c8,f3,c1),null()));
+ }
+ }
+HXLINE( 50) return this->result;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(VcardTempGet_obj,getResult,return )
+
+
+::hx::ObjectPtr< VcardTempGet_obj > VcardTempGet_obj::__new( ::snikket::JID to) {
+ ::hx::ObjectPtr< VcardTempGet_obj > __this = new VcardTempGet_obj();
+ __this->__construct(to);
+ return __this;
+}
+
+::hx::ObjectPtr< VcardTempGet_obj > VcardTempGet_obj::__alloc(::hx::Ctx *_hx_ctx, ::snikket::JID to) {
+ VcardTempGet_obj *__this = (VcardTempGet_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(VcardTempGet_obj), true, "snikket.queries.VcardTempGet"));
+ *(void **)__this = VcardTempGet_obj::_hx_vtable;
+ __this->__construct(to);
+ return __this;
+}
+
+VcardTempGet_obj::VcardTempGet_obj()
+{
+}
+
+void VcardTempGet_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(VcardTempGet);
+ HX_MARK_MEMBER_NAME(xmlns,"xmlns");
+ HX_MARK_MEMBER_NAME(queryId,"queryId");
+ HX_MARK_MEMBER_NAME(responseStanza,"responseStanza");
+ HX_MARK_MEMBER_NAME(result,"result");
+ ::snikket::queries::GenericQuery_obj::__Mark(HX_MARK_ARG);
+ HX_MARK_END_CLASS();
+}
+
+void VcardTempGet_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(xmlns,"xmlns");
+ HX_VISIT_MEMBER_NAME(queryId,"queryId");
+ HX_VISIT_MEMBER_NAME(responseStanza,"responseStanza");
+ HX_VISIT_MEMBER_NAME(result,"result");
+ ::snikket::queries::GenericQuery_obj::__Visit(HX_VISIT_ARG);
+}
+
+::hx::Val VcardTempGet_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"xmlns") ) { return ::hx::Val( xmlns ); }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"result") ) { return ::hx::Val( result ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"queryId") ) { return ::hx::Val( queryId ); }
+ break;
+ case 9:
+ if (HX_FIELD_EQ(inName,"getResult") ) { return ::hx::Val( getResult_dyn() ); }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"responseStanza") ) { return ::hx::Val( responseStanza ); }
+ if (HX_FIELD_EQ(inName,"handleResponse") ) { return ::hx::Val( handleResponse_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val VcardTempGet_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"xmlns") ) { xmlns=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 6:
+ if (HX_FIELD_EQ(inName,"result") ) { result=inValue.Cast< ::Dynamic >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"queryId") ) { queryId=inValue.Cast< ::String >(); return inValue; }
+ break;
+ case 14:
+ if (HX_FIELD_EQ(inName,"responseStanza") ) { responseStanza=inValue.Cast< ::snikket::Stanza >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void VcardTempGet_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("xmlns",dc,31,74,60));
+ outFields->push(HX_("queryId",03,9d,e9,95));
+ outFields->push(HX_("responseStanza",56,d7,9f,78));
+ outFields->push(HX_("result",dd,68,84,08));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo VcardTempGet_obj_sMemberStorageInfo[] = {
+ {::hx::fsString,(int)offsetof(VcardTempGet_obj,xmlns),HX_("xmlns",dc,31,74,60)},
+ {::hx::fsString,(int)offsetof(VcardTempGet_obj,queryId),HX_("queryId",03,9d,e9,95)},
+ {::hx::fsObject /* ::snikket::Stanza */ ,(int)offsetof(VcardTempGet_obj,responseStanza),HX_("responseStanza",56,d7,9f,78)},
+ {::hx::fsObject /* ::Dynamic */ ,(int)offsetof(VcardTempGet_obj,result),HX_("result",dd,68,84,08)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *VcardTempGet_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String VcardTempGet_obj_sMemberFields[] = {
+ HX_("xmlns",dc,31,74,60),
+ HX_("queryId",03,9d,e9,95),
+ HX_("responseStanza",56,d7,9f,78),
+ HX_("result",dd,68,84,08),
+ HX_("handleResponse",49,d6,e3,ef),
+ HX_("getResult",13,f2,da,84),
+ ::String(null()) };
+
+::hx::Class VcardTempGet_obj::__mClass;
+
+void VcardTempGet_obj::__register()
+{
+ VcardTempGet_obj _hx_dummy;
+ VcardTempGet_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.queries.VcardTempGet",f5,d0,e2,3f);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(VcardTempGet_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< VcardTempGet_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = VcardTempGet_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = VcardTempGet_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace queries
diff --git a/Sources/c_snikket/src/snikket/streams/XmppStropheStream.cpp b/Sources/c_snikket/src/snikket/streams/XmppStropheStream.cpp
new file mode 100644
index 0000000..1b023b3
--- /dev/null
+++ b/Sources/c_snikket/src/snikket/streams/XmppStropheStream.cpp
@@ -0,0 +1,591 @@
+// Generated by Haxe 4.3.3
+#include <hxcpp.h>
+
+#ifndef INCLUDED_5f5af744d9ff5693
+#define INCLUDED_5f5af744d9ff5693
+#include "cpp/Pointer.h"
+#endif
+#ifndef INCLUDED_18a1146676e1af0b
+#define INCLUDED_18a1146676e1af0b
+#include "strophe.h"
+#endif
+#ifndef INCLUDED_Reflect
+#include <Reflect.h>
+#endif
+#ifndef INCLUDED_haxe_IMap
+#include <haxe/IMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_BalancedTree
+#include <haxe/ds/BalancedTree.h>
+#endif
+#ifndef INCLUDED_haxe_ds_EnumValueMap
+#include <haxe/ds/EnumValueMap.h>
+#endif
+#ifndef INCLUDED_haxe_ds_StringMap
+#include <haxe/ds/StringMap.h>
+#endif
+#ifndef INCLUDED_snikket_EventEmitter
+#include <snikket/EventEmitter.h>
+#endif
+#ifndef INCLUDED_snikket_EventHandler
+#include <snikket/EventHandler.h>
+#endif
+#ifndef INCLUDED_snikket_EventResult
+#include <snikket/EventResult.h>
+#endif
+#ifndef INCLUDED_snikket_GenericStream
+#include <snikket/GenericStream.h>
+#endif
+#ifndef INCLUDED_snikket_ID
+#include <snikket/ID.h>
+#endif
+#ifndef INCLUDED_snikket_IqRequestType
+#include <snikket/IqRequestType.h>
+#endif
+#ifndef INCLUDED_snikket_IqResult
+#include <snikket/IqResult.h>
+#endif
+#ifndef INCLUDED_snikket_Node
+#include <snikket/Node.h>
+#endif
+#ifndef INCLUDED_snikket_Stanza
+#include <snikket/Stanza.h>
+#endif
+#ifndef INCLUDED_snikket_TextNode
+#include <snikket/TextNode.h>
+#endif
+#ifndef INCLUDED_snikket__Stanza_NodeInterface
+#include <snikket/_Stanza/NodeInterface.h>
+#endif
+#ifndef INCLUDED_snikket_streams_XmppStropheStream
+#include <snikket/streams/XmppStropheStream.h>
+#endif
+#ifndef INCLUDED_sys_thread_EventLoop
+#include <sys/thread/EventLoop.h>
+#endif
+#ifndef INCLUDED_sys_thread__Thread_HaxeThread
+#include <sys/thread/_Thread/HaxeThread.h>
+#endif
+#ifndef INCLUDED_sys_thread__Thread_Thread_Impl_
+#include <sys/thread/_Thread/Thread_Impl_.h>
+#endif
+
+HX_DEFINE_STACK_FRAME(_hx_pos_c0c1f1a3af656a5a_174_new,"snikket.streams.XmppStropheStream","new",0x50539160,"snikket.streams.XmppStropheStream.new","snikket/streams/XmppStropheStream.hx",174,0x06c67012)
+HX_LOCAL_STACK_FRAME(_hx_pos_c0c1f1a3af656a5a_203_newId,"snikket.streams.XmppStropheStream","newId",0xb962e95b,"snikket.streams.XmppStropheStream.newId","snikket/streams/XmppStropheStream.hx",203,0x06c67012)
+HX_LOCAL_STACK_FRAME(_hx_pos_c0c1f1a3af656a5a_266_onIq,"snikket.streams.XmppStropheStream","onIq",0xf97b85e7,"snikket.streams.XmppStropheStream.onIq","snikket/streams/XmppStropheStream.hx",266,0x06c67012)
+HX_LOCAL_STACK_FRAME(_hx_pos_c0c1f1a3af656a5a_295_connect,"snikket.streams.XmppStropheStream","connect",0x26f47cea,"snikket.streams.XmppStropheStream.connect","snikket/streams/XmppStropheStream.hx",295,0x06c67012)
+HX_LOCAL_STACK_FRAME(_hx_pos_c0c1f1a3af656a5a_293_connect,"snikket.streams.XmppStropheStream","connect",0x26f47cea,"snikket.streams.XmppStropheStream.connect","snikket/streams/XmppStropheStream.hx",293,0x06c67012)
+HX_LOCAL_STACK_FRAME(_hx_pos_c0c1f1a3af656a5a_314_disconnect,"snikket.streams.XmppStropheStream","disconnect",0xaf2ec35c,"snikket.streams.XmppStropheStream.disconnect","snikket/streams/XmppStropheStream.hx",314,0x06c67012)
+HX_LOCAL_STACK_FRAME(_hx_pos_c0c1f1a3af656a5a_318_poll,"snikket.streams.XmppStropheStream","poll",0xfa259d3f,"snikket.streams.XmppStropheStream.poll","snikket/streams/XmppStropheStream.hx",318,0x06c67012)
+HX_LOCAL_STACK_FRAME(_hx_pos_c0c1f1a3af656a5a_317_poll,"snikket.streams.XmppStropheStream","poll",0xfa259d3f,"snikket.streams.XmppStropheStream.poll","snikket/streams/XmppStropheStream.hx",317,0x06c67012)
+HX_LOCAL_STACK_FRAME(_hx_pos_c0c1f1a3af656a5a_354_convertFromStanza,"snikket.streams.XmppStropheStream","convertFromStanza",0x96c3f3d2,"snikket.streams.XmppStropheStream.convertFromStanza","snikket/streams/XmppStropheStream.hx",354,0x06c67012)
+HX_LOCAL_STACK_FRAME(_hx_pos_c0c1f1a3af656a5a_380_sendStanza,"snikket.streams.XmppStropheStream","sendStanza",0xed37e45d,"snikket.streams.XmppStropheStream.sendStanza","snikket/streams/XmppStropheStream.hx",380,0x06c67012)
+HX_LOCAL_STACK_FRAME(_hx_pos_c0c1f1a3af656a5a_387_finalize,"snikket.streams.XmppStropheStream","finalize",0x297ee49e,"snikket.streams.XmppStropheStream.finalize","snikket/streams/XmppStropheStream.hx",387,0x06c67012)
+HX_LOCAL_STACK_FRAME(_hx_pos_c0c1f1a3af656a5a_206_strophe_certfail_handler,"snikket.streams.XmppStropheStream","strophe_certfail_handler",0x0748fefd,"snikket.streams.XmppStropheStream.strophe_certfail_handler","snikket/streams/XmppStropheStream.hx",206,0x06c67012)
+HX_LOCAL_STACK_FRAME(_hx_pos_c0c1f1a3af656a5a_223_strophe_stanza,"snikket.streams.XmppStropheStream","strophe_stanza",0xa2c712e5,"snikket.streams.XmppStropheStream.strophe_stanza","snikket/streams/XmppStropheStream.hx",223,0x06c67012)
+HX_LOCAL_STACK_FRAME(_hx_pos_c0c1f1a3af656a5a_269_strophe_connect,"snikket.streams.XmppStropheStream","strophe_connect",0xae6ed8fa,"snikket.streams.XmppStropheStream.strophe_connect","snikket/streams/XmppStropheStream.hx",269,0x06c67012)
+HX_LOCAL_STACK_FRAME(_hx_pos_c0c1f1a3af656a5a_324_convertToStanza,"snikket.streams.XmppStropheStream","convertToStanza",0x53baabe3,"snikket.streams.XmppStropheStream.convertToStanza","snikket/streams/XmppStropheStream.hx",324,0x06c67012)
+namespace snikket{
+namespace streams{
+
+void XmppStropheStream_obj::__construct(){
+ HX_GC_STACKFRAME(&_hx_pos_c0c1f1a3af656a5a_174_new)
+HXLINE( 179) this->ready = false;
+HXLINE( 178) this->pending = ::Array_obj< ::Dynamic>::__new(0);
+HXLINE( 177) ::haxe::ds::EnumValueMap _g = ::haxe::ds::EnumValueMap_obj::__alloc( HX_CTX );
+HXDLIN( 177) _g->set(::snikket::IqRequestType_obj::Get_dyn(), ::haxe::ds::StringMap_obj::__alloc( HX_CTX ));
+HXDLIN( 177) _g->set(::snikket::IqRequestType_obj::Set_dyn(), ::haxe::ds::StringMap_obj::__alloc( HX_CTX ));
+HXDLIN( 177) this->iqHandlers = _g;
+HXLINE( 182) super::__construct();
+HXLINE( 183) xmpp_initialize();
+HXLINE( 184) xmpp_log_t *logger = NULL;;
+HXLINE( 186) logger = xmpp_get_default_logger(XMPP_LEVEL_DEBUG);;
+HXLINE( 188) this->ctx = xmpp_ctx_new(null(),logger);
+HXLINE( 189) this->conn = xmpp_conn_new(this->ctx);
+HXLINE( 193) ::cpp::Pointer< char > tmp = null();
+HXLINE( 194) ::cpp::Pointer< char > tmp1 = null();
+HXLINE( 195) ::cpp::Pointer< char > tmp2 = null();
+HXLINE( 191) xmpp_conn_t* _hx_tmp = this->conn;
+HXLINE( 192) ::cpp::Function< int ( xmpp_conn_t*, xmpp_stanza_t*,void*) > _hx_tmp1 = ::cpp::Function< int ( xmpp_conn_t*, xmpp_stanza_t*,void*)>(::hx::AnyCast(&::snikket::streams::XmppStropheStream_obj::strophe_stanza ));
+HXLINE( 193) ::cpp::Pointer< char > tmp3 = tmp;
+HXLINE( 194) ::cpp::Pointer< char > tmp4 = tmp1;
+HXLINE( 195) ::cpp::Pointer< char > tmp5 = tmp2;
+HXLINE( 190) xmpp_handler_add(_hx_tmp,_hx_tmp1,tmp3,tmp4,tmp5,(void*)this);
+HXLINE( 198) xmpp_conn_t* _hx_tmp2 = this->conn;
+HXDLIN( 198) xmpp_conn_set_certfail_handler(_hx_tmp2,::cpp::Function< int ( const xmpp_tlscert_t*,const char*)>(::hx::AnyCast(&::snikket::streams::XmppStropheStream_obj::strophe_certfail_handler )));
+HXLINE( 199) _hx_add_finalizable(::hx::ObjectPtr<OBJ_>(this),false);
+ }
+
+Dynamic XmppStropheStream_obj::__CreateEmpty() { return new XmppStropheStream_obj; }
+
+void *XmppStropheStream_obj::_hx_vtable = 0;
+
+Dynamic XmppStropheStream_obj::__Create(::hx::DynamicArray inArgs)
+{
+ ::hx::ObjectPtr< XmppStropheStream_obj > _hx_result = new XmppStropheStream_obj();
+ _hx_result->__construct();
+ return _hx_result;
+}
+
+bool XmppStropheStream_obj::_hx_isInstanceOf(int inClassId) {
+ if (inClassId<=(int)0x785c9e5e) {
+ if (inClassId<=(int)0x6aca71d1) {
+ return inClassId==(int)0x00000001 || inClassId==(int)0x6aca71d1;
+ } else {
+ return inClassId==(int)0x785c9e5e;
+ }
+ } else {
+ return inClassId==(int)0x7e6ea620;
+ }
+}
+
+::String XmppStropheStream_obj::newId(){
+ HX_STACKFRAME(&_hx_pos_c0c1f1a3af656a5a_203_newId)
+HXDLIN( 203) return ::snikket::ID_obj::_hx_long();
+ }
+
+
+void XmppStropheStream_obj::onIq( ::snikket::IqRequestType type,::String tag,::String xmlns, ::Dynamic handler){
+ HX_STACKFRAME(&_hx_pos_c0c1f1a3af656a5a_266_onIq)
+HXDLIN( 266) this->iqHandlers->get(type).StaticCast< ::haxe::ds::StringMap >()->set((((HX_("{",7b,00,00,00) + xmlns) + HX_("}",7d,00,00,00)) + tag),handler);
+ }
+
+
+void XmppStropheStream_obj::connect(::String jid,::Array< unsigned char > sm){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::streams::XmppStropheStream,_gthis) HXARGC(1)
+ ::snikket::EventResult _hx_run( ::Dynamic event){
+ HX_STACKFRAME(&_hx_pos_c0c1f1a3af656a5a_295_connect)
+HXLINE( 296) ::snikket::streams::XmppStropheStream o = _gthis;
+HXLINE( 297) ::String pass = ( (::String)(event->__Field(HX_("password",1b,23,d0,48),::hx::paccDynamic)) );
+HXLINE( 298) ::cpp::Pointer< char > tmp = cpp::Pointer_obj::fromPointer(pass.c_str());
+HXDLIN( 298) xmpp_conn_set_pass(_gthis->conn,tmp);
+HXLINE( 301) ::cpp::Pointer< char > tmp1 = null();
+HXLINE( 300) xmpp_conn_t* _gthis1 = _gthis->conn;
+HXLINE( 303) ::cpp::Function< void ( xmpp_conn_t*, xmpp_conn_event_t,int, xmpp_stream_error_t*,void*) > _hx_tmp = ::cpp::Function< void ( xmpp_conn_t*, xmpp_conn_event_t,int, xmpp_stream_error_t*,void*)>(::hx::AnyCast(&::snikket::streams::XmppStropheStream_obj::strophe_connect ));
+HXLINE( 299) xmpp_connect_client(_gthis1,tmp1,( (unsigned short)(0) ),_hx_tmp,o.GetPtr());
+HXLINE( 307) return ::snikket::EventResult_obj::EventHandled_dyn();
+ }
+ HX_END_LOCAL_FUNC1(return)
+
+ HX_STACKFRAME(&_hx_pos_c0c1f1a3af656a5a_293_connect)
+HXDLIN( 293) ::snikket::streams::XmppStropheStream _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 294) ::cpp::Pointer< char > tmp = cpp::Pointer_obj::fromPointer(jid.c_str());
+HXDLIN( 294) xmpp_conn_set_jid(this->conn,tmp);
+HXLINE( 295) this->on(HX_("auth/password",e2,5d,98,00), ::Dynamic(new _hx_Closure_0(_gthis)));
+HXLINE( 309) this->trigger(HX_("auth/password-needed",80,f0,74,49), ::Dynamic(::hx::Anon_obj::Create(0)));
+HXLINE( 310) this->poll();
+ }
+
+
+void XmppStropheStream_obj::disconnect(){
+ HX_STACKFRAME(&_hx_pos_c0c1f1a3af656a5a_314_disconnect)
+HXDLIN( 314) xmpp_disconnect(this->conn);
+ }
+
+
+void XmppStropheStream_obj::poll(){
+ HX_BEGIN_LOCAL_FUNC_S1(::hx::LocalFunc,_hx_Closure_0, ::snikket::streams::XmppStropheStream,_gthis) HXARGC(0)
+ void _hx_run(){
+ HX_STACKFRAME(&_hx_pos_c0c1f1a3af656a5a_318_poll)
+HXLINE( 319) xmpp_run_once(_gthis->ctx,( (::cpp::UInt64)(1) ));
+HXLINE( 320) _gthis->poll();
+ }
+ HX_END_LOCAL_FUNC0((void))
+
+ HX_STACKFRAME(&_hx_pos_c0c1f1a3af656a5a_317_poll)
+HXDLIN( 317) ::snikket::streams::XmppStropheStream _gthis = ::hx::ObjectPtr<OBJ_>(this);
+HXLINE( 318) ::sys::thread::_Thread::Thread_Impl__obj::get_events(::sys::thread::_Thread::HaxeThread_obj::current())->run( ::Dynamic(new _hx_Closure_0(_gthis)));
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(XmppStropheStream_obj,poll,(void))
+
+ xmpp_stanza_t* XmppStropheStream_obj::convertFromStanza( ::snikket::Stanza el){
+ HX_STACKFRAME(&_hx_pos_c0c1f1a3af656a5a_354_convertFromStanza)
+HXLINE( 355) xmpp_stanza_t* xml = xmpp_stanza_new(this->ctx);
+HXLINE( 356) ::cpp::Pointer< char > tmp = cpp::Pointer_obj::fromPointer(el->name.c_str());
+HXDLIN( 356) xmpp_stanza_set_name(xml,tmp);
+HXLINE( 357) {
+HXLINE( 357) ::Dynamic access = el->attr;
+HXDLIN( 357) ::Dynamic _g_access = access;
+HXDLIN( 357) ::Array< ::String > _g_keys = ::Reflect_obj::fields(access);
+HXDLIN( 357) int _g_index = 0;
+HXDLIN( 357) while((_g_index < _g_keys->length)){
+HXLINE( 357) _g_index = (_g_index + 1);
+HXDLIN( 357) ::String key = _g_keys->__get((_g_index - 1));
+HXDLIN( 357) ::String attr_value = ( (::String)(::Reflect_obj::field(_g_access,key)) );
+HXDLIN( 357) ::String attr_key = key;
+HXLINE( 358) ::String key1 = attr_key;
+HXLINE( 359) ::String value = attr_value;
+HXLINE( 360) if (::hx::IsNotNull( value )) {
+HXLINE( 361) ::cpp::Pointer< char > tmp1 = cpp::Pointer_obj::fromPointer(key1.c_str());
+HXDLIN( 361) ::cpp::Pointer< char > tmp2 = cpp::Pointer_obj::fromPointer(value.c_str());
+HXDLIN( 361) xmpp_stanza_set_attribute(xml,tmp1,tmp2);
+ }
+ }
+ }
+HXLINE( 364) if ((el->children->length > 0)) {
+HXLINE( 365) int _g = 0;
+HXDLIN( 365) ::Array< ::Dynamic> _g1 = el->children;
+HXDLIN( 365) while((_g < _g1->length)){
+HXLINE( 365) ::snikket::Node child = _g1->__get(_g).StaticCast< ::snikket::Node >();
+HXDLIN( 365) _g = (_g + 1);
+HXLINE( 366) switch((int)(child->_hx_getIndex())){
+ case (int)0: {
+HXLINE( 367) ::snikket::Stanza stanza = child->_hx_getObject(0).StaticCast< ::snikket::Stanza >();
+HXLINE( 368) xmpp_stanza_add_child_ex(xml,this->convertFromStanza(stanza),false);
+ }
+ break;
+ case (int)1: {
+HXLINE( 369) ::snikket::TextNode text = child->_hx_getObject(0).StaticCast< ::snikket::TextNode >();
+HXDLIN( 369) {
+HXLINE( 370) xmpp_stanza_t* text_node = xmpp_stanza_new(this->ctx);
+HXLINE( 371) ::cpp::Pointer< char > tmp3 = cpp::Pointer_obj::fromPointer(text->content.c_str());
+HXDLIN( 371) xmpp_stanza_set_text(text_node,tmp3);
+HXLINE( 372) xmpp_stanza_add_child_ex(xml,text_node,false);
+ }
+ }
+ break;
+ }
+ }
+ }
+HXLINE( 376) return xml;
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC1(XmppStropheStream_obj,convertFromStanza,return )
+
+void XmppStropheStream_obj::sendStanza( ::snikket::Stanza stanza){
+ HX_STACKFRAME(&_hx_pos_c0c1f1a3af656a5a_380_sendStanza)
+HXDLIN( 380) if (this->ready) {
+HXLINE( 381) xmpp_conn_t* _hx_tmp = this->conn;
+HXDLIN( 381) xmpp_send(_hx_tmp,this->convertFromStanza(stanza));
+ }
+ else {
+HXLINE( 383) this->pending->push(stanza);
+ }
+ }
+
+
+void XmppStropheStream_obj::finalize(){
+ HX_STACKFRAME(&_hx_pos_c0c1f1a3af656a5a_387_finalize)
+HXLINE( 388) xmpp_stop(this->ctx);
+HXLINE( 389) xmpp_conn_release(this->conn);
+HXLINE( 390) xmpp_ctx_free(this->ctx);
+ }
+
+
+HX_DEFINE_DYNAMIC_FUNC0(XmppStropheStream_obj,finalize,(void))
+
+int XmppStropheStream_obj::strophe_certfail_handler( const xmpp_tlscert_t* cert,const char* err){
+ HX_STACKFRAME(&_hx_pos_c0c1f1a3af656a5a_206_strophe_certfail_handler)
+HXLINE( 207) xmpp_conn_t* conn = xmpp_tlscert_get_conn(cert);
+HXLINE( 208) ::Array< ::String > dnsNames = ::Array_obj< ::String >::__new(0);
+HXLINE( 209) ::cpp::Pointer< char > dnsName = null();
+HXLINE( 210) int dnsNameN = 0;
+HXLINE( 211) while(true){
+HXLINE( 211) dnsNameN = (dnsNameN + 1);
+HXDLIN( 211) dnsName = xmpp_tlscert_get_dnsname(cert,( (size_t)((dnsNameN - 1)) ));
+HXDLIN( 211) if (!(::hx::IsNotNull( dnsName ))) {
+HXLINE( 211) goto _hx_goto_13;
+ }
+HXLINE( 212) dnsNames->push( ::String(dnsName->ptr));
+ }
+ _hx_goto_13:;
+HXLINE( 214) return 1;
+ }
+
+
+int XmppStropheStream_obj::strophe_stanza( xmpp_conn_t* conn, xmpp_stanza_t* sstanza,void* userdata){
+ HX_GC_STACKFRAME(&_hx_pos_c0c1f1a3af656a5a_223_strophe_stanza)
+HXLINE( 224) ::snikket::streams::XmppStropheStream stream = static_cast<hx::Object*>(userdata);
+HXLINE( 225) ::snikket::Stanza stanza = ::snikket::streams::XmppStropheStream_obj::convertToStanza(sstanza,null());
+HXLINE( 227) ::String xmlns = ( (::String)(::Reflect_obj::field(stanza->attr,HX_("xmlns",dc,31,74,60))) );
+HXLINE( 228) if ((xmlns == HX_("jabber:client",21,64,c5,e4))) {
+HXLINE( 229) ::String name = stanza->name;
+HXLINE( 230) if ((name == HX_("iq",e8,5b,00,00))) {
+HXLINE( 231) ::String type = ( (::String)(::Reflect_obj::field(stanza->attr,HX_("type",ba,f2,08,4d))) );
+HXLINE( 232) bool _hx_tmp;
+HXDLIN( 232) if ((type != HX_("result",dd,68,84,08))) {
+HXLINE( 232) _hx_tmp = (type == HX_("error",c8,cb,29,73));
+ }
+ else {
+HXLINE( 232) _hx_tmp = true;
+ }
+HXDLIN( 232) if (_hx_tmp) {
+HXLINE( 233) stream->onStanza(stanza);
+ }
+ else {
+HXLINE( 236) ::snikket::Stanza child = stanza->getFirstChild();
+HXLINE( 237) if (::hx::IsNotNull( child )) {
+HXLINE( 238) ::snikket::IqRequestType this1;
+HXDLIN( 238) if ((type == HX_("get",96,80,4e,00))) {
+HXLINE( 238) this1 = ::snikket::IqRequestType_obj::Get_dyn();
+ }
+ else {
+HXLINE( 238) this1 = ::snikket::IqRequestType_obj::Set_dyn();
+ }
+HXDLIN( 238) ::Dynamic this2 = stream->iqHandlers->get(this1).StaticCast< ::haxe::ds::StringMap >();
+HXDLIN( 238) ::String key = ((HX_("{",7b,00,00,00) + ( (::String)(::Reflect_obj::field(child->attr,HX_("xmlns",dc,31,74,60))) )) + HX_("}",7d,00,00,00));
+HXDLIN( 238) ::Dynamic handler = ( ( ::haxe::ds::StringMap)(this2) )->get((key + child->name));
+HXLINE( 239) if (::hx::IsNotNull( handler )) {
+HXLINE( 240) ::String reply = ( (::String)(::Reflect_obj::field(stanza->attr,HX_("to",7b,65,00,00))) );
+HXDLIN( 240) ::String reply1 = ( (::String)(::Reflect_obj::field(stanza->attr,HX_("from",6a,a5,c2,43))) );
+HXDLIN( 240) ::snikket::Stanza reply2 = ::snikket::Stanza_obj::__alloc( HX_CTX ,HX_("iq",e8,5b,00,00), ::Dynamic(::hx::Anon_obj::Create(4)
+ ->setFixed(0,HX_("id",db,5b,00,00),( (::String)(::Reflect_obj::field(stanza->attr,HX_("id",db,5b,00,00))) ))
+ ->setFixed(1,HX_("to",7b,65,00,00),reply1)
+ ->setFixed(2,HX_("from",6a,a5,c2,43),reply)
+ ->setFixed(3,HX_("type",ba,f2,08,4d),HX_("result",dd,68,84,08))));
+HXLINE( 241) try {
+ HX_STACK_CATCHABLE( ::Dynamic, 0);
+HXLINE( 242) ::snikket::IqResult _g = handler(stanza);
+HXDLIN( 242) switch((int)(_g->_hx_getIndex())){
+ case (int)0: {
+HXLINE( 243) ::snikket::Stanza el = _g->_hx_getObject(0).StaticCast< ::snikket::Stanza >();
+HXDLIN( 243) reply2->addChild(el);
+ }
+ break;
+ case (int)1: {
+ }
+ break;
+ case (int)2: {
+HXLINE( 246) ::Reflect_obj::setField(reply2->attr,HX_("result",dd,68,84,08),HX_("error",c8,cb,29,73));
+HXLINE( 247) reply2->tag(HX_("error",c8,cb,29,73), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("type",ba,f2,08,4d),HX_("cancel",7a,ed,33,b8))))->tag(HX_("service-unavailable",f8,3c,11,1c), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("urn:ietf:params:xml:ns:xmpp-stanzas",27,f2,3d,30))));
+ }
+ break;
+ }
+ } catch( ::Dynamic _hx_e) {
+ if (_hx_e.IsClass< ::Dynamic >() ){
+ HX_STACK_BEGIN_CATCH
+ ::Dynamic _g1 = _hx_e;
+HXLINE( 250) ::Reflect_obj::setField(reply2->attr,HX_("result",dd,68,84,08),HX_("error",c8,cb,29,73));
+HXLINE( 251) reply2->tag(HX_("error",c8,cb,29,73), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("type",ba,f2,08,4d),HX_("cancel",7a,ed,33,b8))))->tag(HX_("internal-server-error",ce,6d,55,6c), ::Dynamic(::hx::Anon_obj::Create(1)
+ ->setFixed(0,HX_("xmlns",dc,31,74,60),HX_("urn:ietf:params:xml:ns:xmpp-stanzas",27,f2,3d,30))));
+ }
+ else {
+ HX_STACK_DO_THROW(_hx_e);
+ }
+ }
+HXLINE( 253) stream->sendStanza(reply2);
+ }
+ }
+ }
+ }
+ else {
+HXLINE( 258) stream->onStanza(stanza);
+ }
+ }
+HXLINE( 262) return 1;
+ }
+
+
+void XmppStropheStream_obj::strophe_connect( xmpp_conn_t* conn, xmpp_conn_event_t event,int error, xmpp_stream_error_t* stream_error,void* userdata){
+ HX_STACKFRAME(&_hx_pos_c0c1f1a3af656a5a_269_strophe_connect)
+HXLINE( 270) ::snikket::streams::XmppStropheStream stream = static_cast<hx::Object*>(userdata);
+HXLINE( 271) if (::hx::IsInstanceEq( event,XMPP_CONN_CONNECT )) {
+HXLINE( 272) stream->ready = true;
+HXLINE( 273) while((stream->pending->length > 0)){
+HXLINE( 274) stream->sendStanza(stream->pending->shift().StaticCast< ::snikket::Stanza >());
+ }
+HXLINE( 276) stream->trigger(HX_("status/online",10,05,0e,d2), ::Dynamic(::hx::Anon_obj::Create(0)));
+ }
+HXLINE( 278) if (::hx::IsInstanceEq( event,XMPP_CONN_DISCONNECT )) {
+HXLINE( 279) if (!(stream->ready)) {
+HXLINE( 281) stream->trigger(HX_("auth/fail",25,45,e9,d1), ::Dynamic(::hx::Anon_obj::Create(0)));
+ }
+ else {
+HXLINE( 283) stream->ready = false;
+HXLINE( 284) stream->trigger(HX_("status/offline",c6,eb,eb,54), ::Dynamic(::hx::Anon_obj::Create(0)));
+ }
+ }
+HXLINE( 287) if (::hx::IsInstanceEq( event,XMPP_CONN_FAIL )) {
+HXLINE( 288) stream->ready = false;
+HXLINE( 289) stream->trigger(HX_("status/offline",c6,eb,eb,54), ::Dynamic(::hx::Anon_obj::Create(0)));
+ }
+ }
+
+
+ ::snikket::Stanza XmppStropheStream_obj::convertToStanza( xmpp_stanza_t* el,void* dummy){
+ HX_GC_STACKFRAME(&_hx_pos_c0c1f1a3af656a5a_324_convertToStanza)
+HXLINE( 325) ::cpp::Pointer< char > name = xmpp_stanza_get_name(el);
+HXLINE( 326) int attrlen = xmpp_stanza_get_attribute_count(el);
+HXLINE( 327) void* attrsraw = ::hx::InternalNew(((attrlen * 2) * sizeof(char*)),false);
+HXLINE( 328) const char** attrsarray = static_cast<const char**>(attrsraw);
+HXLINE( 329) ::cpp::Pointer< const char* > attrsptr = ::cpp::Pointer_obj::fromRaw(attrsarray);
+HXLINE( 330) xmpp_stanza_get_attributes(el,attrsarray,(attrlen * 2));
+HXLINE( 331) ::Dynamic attrs = ::Dynamic(::hx::Anon_obj::Create(0));
+HXLINE( 332) {
+HXLINE( 332) int _g = 0;
+HXDLIN( 332) int _g1 = attrlen;
+HXDLIN( 332) while((_g < _g1)){
+HXLINE( 332) _g = (_g + 1);
+HXDLIN( 332) int i = (_g - 1);
+HXLINE( 333) ::cpp::Pointer< char > key = cpp::Pointer_obj::fromRaw(attrsptr->at((i * 2)));
+HXLINE( 334) ::cpp::Pointer< char > value = cpp::Pointer_obj::fromRaw(attrsptr->at(((i * 2) + 1)));
+HXLINE( 335) {
+HXLINE( 335) ::String key1 = ::String(key->ptr);
+HXDLIN( 335) ::String value1 = ::String(value->ptr);
+HXDLIN( 335) ::Reflect_obj::setField(attrs,key1,value1);
+ }
+ }
+ }
+HXLINE( 337) ::snikket::Stanza stanza = ::snikket::Stanza_obj::__alloc( HX_CTX , ::String(name->ptr),attrs);
+HXLINE( 339) xmpp_stanza_t* child = xmpp_stanza_get_children(el);
+HXLINE( 340) while(::hx::IsNotNull( child )){
+HXLINE( 341) if (xmpp_stanza_is_text(child)) {
+HXLINE( 342) const char* r = xmpp_stanza_get_text_ptr(child);
+HXLINE( 343) ::cpp::Pointer< char > inPtr = cpp::Pointer_obj::fromRaw(xmpp_stanza_get_text_ptr(child));
+HXDLIN( 343) ::String x = ::String(inPtr->ptr);
+HXLINE( 344) stanza->text(x);
+ }
+ else {
+HXLINE( 346) stanza->addChild(::snikket::streams::XmppStropheStream_obj::convertToStanza(child,null()));
+ }
+HXLINE( 348) child = xmpp_stanza_get_next(child);
+ }
+HXLINE( 351) return stanza;
+ }
+
+
+
+::hx::ObjectPtr< XmppStropheStream_obj > XmppStropheStream_obj::__new() {
+ ::hx::ObjectPtr< XmppStropheStream_obj > __this = new XmppStropheStream_obj();
+ __this->__construct();
+ return __this;
+}
+
+::hx::ObjectPtr< XmppStropheStream_obj > XmppStropheStream_obj::__alloc(::hx::Ctx *_hx_ctx) {
+ XmppStropheStream_obj *__this = (XmppStropheStream_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(XmppStropheStream_obj), true, "snikket.streams.XmppStropheStream"));
+ *(void **)__this = XmppStropheStream_obj::_hx_vtable;
+ __this->__construct();
+ return __this;
+}
+
+XmppStropheStream_obj::XmppStropheStream_obj()
+{
+}
+
+void XmppStropheStream_obj::__Mark(HX_MARK_PARAMS)
+{
+ HX_MARK_BEGIN_CLASS(XmppStropheStream);
+ HX_MARK_MEMBER_NAME(iqHandlers,"iqHandlers");
+ HX_MARK_MEMBER_NAME(pending,"pending");
+ HX_MARK_MEMBER_NAME(ready,"ready");
+ ::snikket::GenericStream_obj::__Mark(HX_MARK_ARG);
+ HX_MARK_END_CLASS();
+}
+
+void XmppStropheStream_obj::__Visit(HX_VISIT_PARAMS)
+{
+ HX_VISIT_MEMBER_NAME(iqHandlers,"iqHandlers");
+ HX_VISIT_MEMBER_NAME(pending,"pending");
+ HX_VISIT_MEMBER_NAME(ready,"ready");
+ ::snikket::GenericStream_obj::__Visit(HX_VISIT_ARG);
+}
+
+::hx::Val XmppStropheStream_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 4:
+ if (HX_FIELD_EQ(inName,"onIq") ) { return ::hx::Val( onIq_dyn() ); }
+ if (HX_FIELD_EQ(inName,"poll") ) { return ::hx::Val( poll_dyn() ); }
+ break;
+ case 5:
+ if (HX_FIELD_EQ(inName,"ready") ) { return ::hx::Val( ready ); }
+ if (HX_FIELD_EQ(inName,"newId") ) { return ::hx::Val( newId_dyn() ); }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"pending") ) { return ::hx::Val( pending ); }
+ if (HX_FIELD_EQ(inName,"connect") ) { return ::hx::Val( connect_dyn() ); }
+ break;
+ case 8:
+ if (HX_FIELD_EQ(inName,"finalize") ) { return ::hx::Val( finalize_dyn() ); }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"iqHandlers") ) { return ::hx::Val( iqHandlers ); }
+ if (HX_FIELD_EQ(inName,"disconnect") ) { return ::hx::Val( disconnect_dyn() ); }
+ if (HX_FIELD_EQ(inName,"sendStanza") ) { return ::hx::Val( sendStanza_dyn() ); }
+ break;
+ case 17:
+ if (HX_FIELD_EQ(inName,"convertFromStanza") ) { return ::hx::Val( convertFromStanza_dyn() ); }
+ }
+ return super::__Field(inName,inCallProp);
+}
+
+::hx::Val XmppStropheStream_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
+{
+ switch(inName.length) {
+ case 5:
+ if (HX_FIELD_EQ(inName,"ready") ) { ready=inValue.Cast< bool >(); return inValue; }
+ break;
+ case 7:
+ if (HX_FIELD_EQ(inName,"pending") ) { pending=inValue.Cast< ::Array< ::Dynamic> >(); return inValue; }
+ break;
+ case 10:
+ if (HX_FIELD_EQ(inName,"iqHandlers") ) { iqHandlers=inValue.Cast< ::haxe::ds::EnumValueMap >(); return inValue; }
+ }
+ return super::__SetField(inName,inValue,inCallProp);
+}
+
+void XmppStropheStream_obj::__GetFields(Array< ::String> &outFields)
+{
+ outFields->push(HX_("iqHandlers",71,61,f0,a9));
+ outFields->push(HX_("pending",57,98,ec,2b));
+ outFields->push(HX_("ready",63,a0,ba,e6));
+ super::__GetFields(outFields);
+};
+
+#ifdef HXCPP_SCRIPTABLE
+static ::hx::StorageInfo XmppStropheStream_obj_sMemberStorageInfo[] = {
+ {::hx::fsObject /* ::haxe::ds::EnumValueMap */ ,(int)offsetof(XmppStropheStream_obj,iqHandlers),HX_("iqHandlers",71,61,f0,a9)},
+ {::hx::fsObject /* ::Array< ::Dynamic> */ ,(int)offsetof(XmppStropheStream_obj,pending),HX_("pending",57,98,ec,2b)},
+ {::hx::fsBool,(int)offsetof(XmppStropheStream_obj,ready),HX_("ready",63,a0,ba,e6)},
+ { ::hx::fsUnknown, 0, null()}
+};
+static ::hx::StaticInfo *XmppStropheStream_obj_sStaticStorageInfo = 0;
+#endif
+
+static ::String XmppStropheStream_obj_sMemberFields[] = {
+ HX_("iqHandlers",71,61,f0,a9),
+ HX_("pending",57,98,ec,2b),
+ HX_("ready",63,a0,ba,e6),
+ HX_("newId",5b,e8,30,99),
+ HX_("onIq",e7,66,b2,49),
+ HX_("connect",ea,3b,80,15),
+ HX_("disconnect",5c,64,44,69),
+ HX_("poll",3f,7e,5c,4a),
+ HX_("convertFromStanza",d2,72,14,33),
+ HX_("sendStanza",5d,85,4d,a7),
+ HX_("finalize",9e,45,3a,f5),
+ ::String(null()) };
+
+::hx::Class XmppStropheStream_obj::__mClass;
+
+void XmppStropheStream_obj::__register()
+{
+ XmppStropheStream_obj _hx_dummy;
+ XmppStropheStream_obj::_hx_vtable = *(void **)&_hx_dummy;
+ ::hx::Static(__mClass) = new ::hx::Class_obj();
+ __mClass->mName = HX_("snikket.streams.XmppStropheStream",6e,a1,9f,1c);
+ __mClass->mSuper = &super::__SGetClass();
+ __mClass->mConstructEmpty = &__CreateEmpty;
+ __mClass->mConstructArgs = &__Create;
+ __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
+ __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
+ __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
+ __mClass->mMembers = ::hx::Class_obj::dupFunctions(XmppStropheStream_obj_sMemberFields);
+ __mClass->mCanCast = ::hx::TCanCast< XmppStropheStream_obj >;
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mMemberStorageInfo = XmppStropheStream_obj_sMemberStorageInfo;
+#endif
+#ifdef HXCPP_SCRIPTABLE
+ __mClass->mStaticStorageInfo = XmppStropheStream_obj_sStaticStorageInfo;
+#endif
+ ::hx::_hx_RegisterClass(__mClass->mName, __mClass);
+}
+
+} // end namespace snikket
+} // end namespace streams
diff --git a/Sources/c_snikket/src/sqlite3.c b/Sources/c_snikket/src/sqlite3.c
new file mode 100644
index 0000000..37b534a
--- /dev/null
+++ b/Sources/c_snikket/src/sqlite3.c
@@ -0,0 +1,261454 @@
+/******************************************************************************
+** This file is an amalgamation of many separate C source files from SQLite
+** version 3.49.1. By combining all the individual C code files into this
+** single large file, the entire code can be compiled as a single translation
+** unit. This allows many compilers to do optimizations that would not be
+** possible if the files were compiled separately. Performance improvements
+** of 5% or more are commonly seen when SQLite is compiled as a single
+** translation unit.
+**
+** This file is all you need to compile SQLite. To use SQLite in other
+** programs, you need this file and the "sqlite3.h" header file that defines
+** the programming interface to the SQLite library. (If you do not have
+** the "sqlite3.h" header file at hand, you will find a copy embedded within
+** the text of this file. Search for "Begin file sqlite3.h" to find the start
+** of the embedded sqlite3.h header file.) Additional code files may be needed
+** if you want a wrapper to interface SQLite with your choice of programming
+** language. The code for the "sqlite3" command-line shell is also in a
+** separate file. This file contains only code for the core SQLite library.
+**
+** The content in this amalgamation comes from Fossil check-in
+** 873d4e274b4988d260ba8354a9718324a1c2 with changes in files:
+**
+**
+*/
+#ifndef SQLITE_AMALGAMATION
+#define SQLITE_CORE 1
+#define SQLITE_AMALGAMATION 1
+#ifndef SQLITE_PRIVATE
+# define SQLITE_PRIVATE static
+#endif
+/************** Begin file sqliteInt.h ***************************************/
+/*
+** 2001 September 15
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** Internal interface definitions for SQLite.
+**
+*/
+#ifndef SQLITEINT_H
+#define SQLITEINT_H
+
+/* Special Comments:
+**
+** Some comments have special meaning to the tools that measure test
+** coverage:
+**
+** NO_TEST - The branches on this line are not
+** measured by branch coverage. This is
+** used on lines of code that actually
+** implement parts of coverage testing.
+**
+** OPTIMIZATION-IF-TRUE - This branch is allowed to always be false
+** and the correct answer is still obtained,
+** though perhaps more slowly.
+**
+** OPTIMIZATION-IF-FALSE - This branch is allowed to always be true
+** and the correct answer is still obtained,
+** though perhaps more slowly.
+**
+** PREVENTS-HARMLESS-OVERREAD - This branch prevents a buffer overread
+** that would be harmless and undetectable
+** if it did occur.
+**
+** In all cases, the special comment must be enclosed in the usual
+** slash-asterisk...asterisk-slash comment marks, with no spaces between the
+** asterisks and the comment text.
+*/
+
+/*
+** Make sure the Tcl calling convention macro is defined. This macro is
+** only used by test code and Tcl integration code.
+*/
+#ifndef SQLITE_TCLAPI
+# define SQLITE_TCLAPI
+#endif
+
+/*
+** Include the header file used to customize the compiler options for MSVC.
+** This should be done first so that it can successfully prevent spurious
+** compiler warnings due to subsequent content in this file and other files
+** that are included by this file.
+*/
+/************** Include msvc.h in the middle of sqliteInt.h ******************/
+/************** Begin file msvc.h ********************************************/
+/*
+** 2015 January 12
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+******************************************************************************
+**
+** This file contains code that is specific to MSVC.
+*/
+#ifndef SQLITE_MSVC_H
+#define SQLITE_MSVC_H
+
+#if defined(_MSC_VER)
+#pragma warning(disable : 4054)
+#pragma warning(disable : 4055)
+#pragma warning(disable : 4100)
+#pragma warning(disable : 4127)
+#pragma warning(disable : 4130)
+#pragma warning(disable : 4152)
+#pragma warning(disable : 4189)
+#pragma warning(disable : 4206)
+#pragma warning(disable : 4210)
+#pragma warning(disable : 4232)
+#pragma warning(disable : 4244)
+#pragma warning(disable : 4305)
+#pragma warning(disable : 4306)
+#pragma warning(disable : 4702)
+#pragma warning(disable : 4706)
+#endif /* defined(_MSC_VER) */
+
+#if defined(_MSC_VER) && !defined(_WIN64)
+#undef SQLITE_4_BYTE_ALIGNED_MALLOC
+#define SQLITE_4_BYTE_ALIGNED_MALLOC
+#endif /* defined(_MSC_VER) && !defined(_WIN64) */
+
+#if !defined(HAVE_LOG2) && defined(_MSC_VER) && _MSC_VER<1800
+#define HAVE_LOG2 0
+#endif /* !defined(HAVE_LOG2) && defined(_MSC_VER) && _MSC_VER<1800 */
+
+#endif /* SQLITE_MSVC_H */
+
+/************** End of msvc.h ************************************************/
+/************** Continuing where we left off in sqliteInt.h ******************/
+
+/*
+** Special setup for VxWorks
+*/
+/************** Include vxworks.h in the middle of sqliteInt.h ***************/
+/************** Begin file vxworks.h *****************************************/
+/*
+** 2015-03-02
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+******************************************************************************
+**
+** This file contains code that is specific to Wind River's VxWorks
+*/
+#if defined(__RTP__) || defined(_WRS_KERNEL)
+/* This is VxWorks. Set up things specially for that OS
+*/
+#include <vxWorks.h>
+#include <pthread.h> /* amalgamator: dontcache */
+#define OS_VXWORKS 1
+#define SQLITE_OS_OTHER 0
+#define SQLITE_HOMEGROWN_RECURSIVE_MUTEX 1
+#define SQLITE_OMIT_LOAD_EXTENSION 1
+#define SQLITE_ENABLE_LOCKING_STYLE 0
+#define HAVE_UTIME 1
+#else
+/* This is not VxWorks. */
+#define OS_VXWORKS 0
+#define HAVE_FCHOWN 1
+#define HAVE_READLINK 1
+#define HAVE_LSTAT 1
+#endif /* defined(_WRS_KERNEL) */
+
+/************** End of vxworks.h *********************************************/
+/************** Continuing where we left off in sqliteInt.h ******************/
+
+/*
+** These #defines should enable >2GB file support on POSIX if the
+** underlying operating system supports it. If the OS lacks
+** large file support, or if the OS is windows, these should be no-ops.
+**
+** Ticket #2739: The _LARGEFILE_SOURCE macro must appear before any
+** system #includes. Hence, this block of code must be the very first
+** code in all source files.
+**
+** Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch
+** on the compiler command line. This is necessary if you are compiling
+** on a recent machine (ex: Red Hat 7.2) but you want your code to work
+** on an older machine (ex: Red Hat 6.0). If you compile on Red Hat 7.2
+** without this option, LFS is enable. But LFS does not exist in the kernel
+** in Red Hat 6.0, so the code won't work. Hence, for maximum binary
+** portability you should omit LFS.
+**
+** The previous paragraph was written in 2005. (This paragraph is written
+** on 2008-11-28.) These days, all Linux kernels support large files, so
+** you should probably leave LFS enabled. But some embedded platforms might
+** lack LFS in which case the SQLITE_DISABLE_LFS macro might still be useful.
+**
+** Similar is true for Mac OS X. LFS is only supported on Mac OS X 9 and later.
+*/
+#ifndef SQLITE_DISABLE_LFS
+# define _LARGE_FILE 1
+# ifndef _FILE_OFFSET_BITS
+# define _FILE_OFFSET_BITS 64
+# endif
+# define _LARGEFILE_SOURCE 1
+#endif
+
+/* The GCC_VERSION and MSVC_VERSION macros are used to
+** conditionally include optimizations for each of these compilers. A
+** value of 0 means that compiler is not being used. The
+** SQLITE_DISABLE_INTRINSIC macro means do not use any compiler-specific
+** optimizations, and hence set all compiler macros to 0
+**
+** There was once also a CLANG_VERSION macro. However, we learn that the
+** version numbers in clang are for "marketing" only and are inconsistent
+** and unreliable. Fortunately, all versions of clang also recognize the
+** gcc version numbers and have reasonable settings for gcc version numbers,
+** so the GCC_VERSION macro will be set to a correct non-zero value even
+** when compiling with clang.
+*/
+#if defined(__GNUC__) && !defined(SQLITE_DISABLE_INTRINSIC)
+# define GCC_VERSION (__GNUC__*1000000+__GNUC_MINOR__*1000+__GNUC_PATCHLEVEL__)
+#else
+# define GCC_VERSION 0
+#endif
+#if defined(_MSC_VER) && !defined(SQLITE_DISABLE_INTRINSIC)
+# define MSVC_VERSION _MSC_VER
+#else
+# define MSVC_VERSION 0
+#endif
+
+/*
+** Some C99 functions in "math.h" are only present for MSVC when its version
+** is associated with Visual Studio 2013 or higher.
+*/
+#ifndef SQLITE_HAVE_C99_MATH_FUNCS
+# if MSVC_VERSION==0 || MSVC_VERSION>=1800
+# define SQLITE_HAVE_C99_MATH_FUNCS (1)
+# else
+# define SQLITE_HAVE_C99_MATH_FUNCS (0)
+# endif
+#endif
+
+/* Needed for various definitions... */
+#if defined(__GNUC__) && !defined(_GNU_SOURCE)
+# define _GNU_SOURCE
+#endif
+
+#if defined(__OpenBSD__) && !defined(_BSD_SOURCE)
+# define _BSD_SOURCE
+#endif
+
+/*
+** Macro to disable warnings about missing "break" at the end of a "case".
+*/
+#if defined(__has_attribute)
+# if __has_attribute(fallthrough)
+# define deliberate_fall_through __attribute__((fallthrough));
+# endif
+#endif
+#if !defined(deliberate_fall_through)
+# define deliberate_fall_through
+#endif
+
+/*
+** For MinGW, check to see if we can include the header file containing its
+** version information, among other things. Normally, this internal MinGW
+** header file would [only] be included automatically by other MinGW header
+** files; however, the contained version information is now required by this
+** header file to work around binary compatibility issues (see below) and
+** this is the only known way to reliably obtain it. This entire #if block
+** would be completely unnecessary if there was any other way of detecting
+** MinGW via their preprocessor (e.g. if they customized their GCC to define
+** some MinGW-specific macros). When compiling for MinGW, either the
+** _HAVE_MINGW_H or _HAVE__MINGW_H (note the extra underscore) macro must be
+** defined; otherwise, detection of conditions specific to MinGW will be
+** disabled.
+*/
+#if defined(_HAVE_MINGW_H)
+# include "mingw.h"
+#elif defined(_HAVE__MINGW_H)
+# include "_mingw.h"
+#endif
+
+/*
+** For MinGW version 4.x (and higher), check to see if the _USE_32BIT_TIME_T
+** define is required to maintain binary compatibility with the MSVC runtime
+** library in use (e.g. for Windows XP).
+*/
+#if !defined(_USE_32BIT_TIME_T) && !defined(_USE_64BIT_TIME_T) && \
+ defined(_WIN32) && !defined(_WIN64) && \
+ defined(__MINGW_MAJOR_VERSION) && __MINGW_MAJOR_VERSION >= 4 && \
+ defined(__MSVCRT__)
+# define _USE_32BIT_TIME_T
+#endif
+
+/* Optionally #include a user-defined header, whereby compilation options
+** may be set prior to where they take effect, but after platform setup.
+** If SQLITE_CUSTOM_INCLUDE=? is defined, its value names the #include
+** file.
+*/
+#ifdef SQLITE_CUSTOM_INCLUDE
+# define INC_STRINGIFY_(f) #f
+# define INC_STRINGIFY(f) INC_STRINGIFY_(f)
+# include INC_STRINGIFY(SQLITE_CUSTOM_INCLUDE)
+#endif
+
+/* The public SQLite interface. The _FILE_OFFSET_BITS macro must appear
+** first in QNX. Also, the _USE_32BIT_TIME_T macro must appear first for
+** MinGW.
+*/
+/************** Include sqlite3.h in the middle of sqliteInt.h ***************/
+/************** Begin file sqlite3.h *****************************************/
+/*
+** 2001-09-15
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This header file defines the interface that the SQLite library
+** presents to client programs. If a C-function, structure, datatype,
+** or constant definition does not appear in this file, then it is
+** not a published API of SQLite, is subject to change without
+** notice, and should not be referenced by programs that use SQLite.
+**
+** Some of the definitions that are in this file are marked as
+** "experimental". Experimental interfaces are normally new
+** features recently added to SQLite. We do not anticipate changes
+** to experimental interfaces but reserve the right to make minor changes
+** if experience from use "in the wild" suggest such changes are prudent.
+**
+** The official C-language API documentation for SQLite is derived
+** from comments in this file. This file is the authoritative source
+** on how SQLite interfaces are supposed to operate.
+**
+** The name of this file under configuration management is "sqlite.h.in".
+** The makefile makes some minor changes to this file (such as inserting
+** the version number) and changes its name to "sqlite3.h" as
+** part of the build process.
+*/
+#ifndef SQLITE3_H
+#define SQLITE3_H
+#include <stdarg.h> /* Needed for the definition of va_list */
+
+/*
+** Make sure we can call this stuff from C++.
+*/
+#if 0
+extern "C" {
+#endif
+
+
+/*
+** Facilitate override of interface linkage and calling conventions.
+** Be aware that these macros may not be used within this particular
+** translation of the amalgamation and its associated header file.
+**
+** The SQLITE_EXTERN and SQLITE_API macros are used to instruct the
+** compiler that the target identifier should have external linkage.
+**
+** The SQLITE_CDECL macro is used to set the calling convention for
+** public functions that accept a variable number of arguments.
+**
+** The SQLITE_APICALL macro is used to set the calling convention for
+** public functions that accept a fixed number of arguments.
+**
+** The SQLITE_STDCALL macro is no longer used and is now deprecated.
+**
+** The SQLITE_CALLBACK macro is used to set the calling convention for
+** function pointers.
+**
+** The SQLITE_SYSAPI macro is used to set the calling convention for
+** functions provided by the operating system.
+**
+** Currently, the SQLITE_CDECL, SQLITE_APICALL, SQLITE_CALLBACK, and
+** SQLITE_SYSAPI macros are used only when building for environments
+** that require non-default calling conventions.
+*/
+#ifndef SQLITE_EXTERN
+# define SQLITE_EXTERN extern
+#endif
+#ifndef SQLITE_API
+# define SQLITE_API
+#endif
+#ifndef SQLITE_CDECL
+# define SQLITE_CDECL
+#endif
+#ifndef SQLITE_APICALL
+# define SQLITE_APICALL
+#endif
+#ifndef SQLITE_STDCALL
+# define SQLITE_STDCALL SQLITE_APICALL
+#endif
+#ifndef SQLITE_CALLBACK
+# define SQLITE_CALLBACK
+#endif
+#ifndef SQLITE_SYSAPI
+# define SQLITE_SYSAPI
+#endif
+
+/*
+** These no-op macros are used in front of interfaces to mark those
+** interfaces as either deprecated or experimental. New applications
+** should not use deprecated interfaces - they are supported for backwards
+** compatibility only. Application writers should be aware that
+** experimental interfaces are subject to change in point releases.
+**
+** These macros used to resolve to various kinds of compiler magic that
+** would generate warning messages when they were used. But that
+** compiler magic ended up generating such a flurry of bug reports
+** that we have taken it all out and gone back to using simple
+** noop macros.
+*/
+#define SQLITE_DEPRECATED
+#define SQLITE_EXPERIMENTAL
+
+/*
+** Ensure these symbols were not defined by some previous header file.
+*/
+#ifdef SQLITE_VERSION
+# undef SQLITE_VERSION
+#endif
+#ifdef SQLITE_VERSION_NUMBER
+# undef SQLITE_VERSION_NUMBER
+#endif
+
+/*
+** CAPI3REF: Compile-Time Library Version Numbers
+**
+** ^(The [SQLITE_VERSION] C preprocessor macro in the sqlite3.h header
+** evaluates to a string literal that is the SQLite version in the
+** format "X.Y.Z" where X is the major version number (always 3 for
+** SQLite3) and Y is the minor version number and Z is the release number.)^
+** ^(The [SQLITE_VERSION_NUMBER] C preprocessor macro resolves to an integer
+** with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z are the same
+** numbers used in [SQLITE_VERSION].)^
+** The SQLITE_VERSION_NUMBER for any given release of SQLite will also
+** be larger than the release from which it is derived. Either Y will
+** be held constant and Z will be incremented or else Y will be incremented
+** and Z will be reset to zero.
+**
+** Since [version 3.6.18] ([dateof:3.6.18]),
+** SQLite source code has been stored in the
+** <a href="http://www.fossil-scm.org/">Fossil configuration management
+** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to
+** a string which identifies a particular check-in of SQLite
+** within its configuration management system. ^The SQLITE_SOURCE_ID
+** string contains the date and time of the check-in (UTC) and a SHA1
+** or SHA3-256 hash of the entire source tree. If the source code has
+** been edited in any way since it was last checked in, then the last
+** four hexadecimal digits of the hash may be modified.
+**
+** See also: [sqlite3_libversion()],
+** [sqlite3_libversion_number()], [sqlite3_sourceid()],
+** [sqlite_version()] and [sqlite_source_id()].
+*/
+#define SQLITE_VERSION "3.49.1"
+#define SQLITE_VERSION_NUMBER 3049001
+#define SQLITE_SOURCE_ID "2025-02-18 13:38:58 873d4e274b4988d260ba8354a9718324a1c26187a4ab4c1cc0227c03d0f10e70"
+
+/*
+** CAPI3REF: Run-Time Library Version Numbers
+** KEYWORDS: sqlite3_version sqlite3_sourceid
+**
+** These interfaces provide the same information as the [SQLITE_VERSION],
+** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros
+** but are associated with the library instead of the header file. ^(Cautious
+** programmers might include assert() statements in their application to
+** verify that values returned by these interfaces match the macros in
+** the header, and thus ensure that the application is
+** compiled with matching library and header files.
+**
+** <blockquote><pre>
+** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER );
+** assert( strncmp(sqlite3_sourceid(),SQLITE_SOURCE_ID,80)==0 );
+** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );
+** </pre></blockquote>)^
+**
+** ^The sqlite3_version[] string constant contains the text of [SQLITE_VERSION]
+** macro. ^The sqlite3_libversion() function returns a pointer to the
+** to the sqlite3_version[] string constant. The sqlite3_libversion()
+** function is provided for use in DLLs since DLL users usually do not have
+** direct access to string constants within the DLL. ^The
+** sqlite3_libversion_number() function returns an integer equal to
+** [SQLITE_VERSION_NUMBER]. ^(The sqlite3_sourceid() function returns
+** a pointer to a string constant whose value is the same as the
+** [SQLITE_SOURCE_ID] C preprocessor macro. Except if SQLite is built
+** using an edited copy of [the amalgamation], then the last four characters
+** of the hash might be different from [SQLITE_SOURCE_ID].)^
+**
+** See also: [sqlite_version()] and [sqlite_source_id()].
+*/
+SQLITE_API const char sqlite3_version[] = SQLITE_VERSION;
+SQLITE_API const char *sqlite3_libversion(void);
+SQLITE_API const char *sqlite3_sourceid(void);
+SQLITE_API int sqlite3_libversion_number(void);
+
+/*
+** CAPI3REF: Run-Time Library Compilation Options Diagnostics
+**
+** ^The sqlite3_compileoption_used() function returns 0 or 1
+** indicating whether the specified option was defined at
+** compile time. ^The SQLITE_ prefix may be omitted from the
+** option name passed to sqlite3_compileoption_used().
+**
+** ^The sqlite3_compileoption_get() function allows iterating
+** over the list of options that were defined at compile time by
+** returning the N-th compile time option string. ^If N is out of range,
+** sqlite3_compileoption_get() returns a NULL pointer. ^The SQLITE_
+** prefix is omitted from any strings returned by
+** sqlite3_compileoption_get().
+**
+** ^Support for the diagnostic functions sqlite3_compileoption_used()
+** and sqlite3_compileoption_get() may be omitted by specifying the
+** [SQLITE_OMIT_COMPILEOPTION_DIAGS] option at compile time.
+**
+** See also: SQL functions [sqlite_compileoption_used()] and
+** [sqlite_compileoption_get()] and the [compile_options pragma].
+*/
+#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
+SQLITE_API int sqlite3_compileoption_used(const char *zOptName);
+SQLITE_API const char *sqlite3_compileoption_get(int N);
+#else
+# define sqlite3_compileoption_used(X) 0
+# define sqlite3_compileoption_get(X) ((void*)0)
+#endif
+
+/*
+** CAPI3REF: Test To See If The Library Is Threadsafe
+**
+** ^The sqlite3_threadsafe() function returns zero if and only if
+** SQLite was compiled with mutexing code omitted due to the
+** [SQLITE_THREADSAFE] compile-time option being set to 0.
+**
+** SQLite can be compiled with or without mutexes. When
+** the [SQLITE_THREADSAFE] C preprocessor macro is 1 or 2, mutexes
+** are enabled and SQLite is threadsafe. When the
+** [SQLITE_THREADSAFE] macro is 0,
+** the mutexes are omitted. Without the mutexes, it is not safe
+** to use SQLite concurrently from more than one thread.
+**
+** Enabling mutexes incurs a measurable performance penalty.
+** So if speed is of utmost importance, it makes sense to disable
+** the mutexes. But for maximum safety, mutexes should be enabled.
+** ^The default behavior is for mutexes to be enabled.
+**
+** This interface can be used by an application to make sure that the
+** version of SQLite that it is linking against was compiled with
+** the desired setting of the [SQLITE_THREADSAFE] macro.
+**
+** This interface only reports on the compile-time mutex setting
+** of the [SQLITE_THREADSAFE] flag. If SQLite is compiled with
+** SQLITE_THREADSAFE=1 or =2 then mutexes are enabled by default but
+** can be fully or partially disabled using a call to [sqlite3_config()]
+** with the verbs [SQLITE_CONFIG_SINGLETHREAD], [SQLITE_CONFIG_MULTITHREAD],
+** or [SQLITE_CONFIG_SERIALIZED]. ^(The return value of the
+** sqlite3_threadsafe() function shows only the compile-time setting of
+** thread safety, not any run-time changes to that setting made by
+** sqlite3_config(). In other words, the return value from sqlite3_threadsafe()
+** is unchanged by calls to sqlite3_config().)^
+**
+** See the [threading mode] documentation for additional information.
+*/
+SQLITE_API int sqlite3_threadsafe(void);
+
+/*
+** CAPI3REF: Database Connection Handle
+** KEYWORDS: {database connection} {database connections}
+**
+** Each open SQLite database is represented by a pointer to an instance of
+** the opaque structure named "sqlite3". It is useful to think of an sqlite3
+** pointer as an object. The [sqlite3_open()], [sqlite3_open16()], and
+** [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()]
+** and [sqlite3_close_v2()] are its destructors. There are many other
+** interfaces (such as
+** [sqlite3_prepare_v2()], [sqlite3_create_function()], and
+** [sqlite3_busy_timeout()] to name but three) that are methods on an
+** sqlite3 object.
+*/
+typedef struct sqlite3 sqlite3;
+
+/*
+** CAPI3REF: 64-Bit Integer Types
+** KEYWORDS: sqlite_int64 sqlite_uint64
+**
+** Because there is no cross-platform way to specify 64-bit integer types
+** SQLite includes typedefs for 64-bit signed and unsigned integers.
+**
+** The sqlite3_int64 and sqlite3_uint64 are the preferred type definitions.
+** The sqlite_int64 and sqlite_uint64 types are supported for backwards
+** compatibility only.
+**
+** ^The sqlite3_int64 and sqlite_int64 types can store integer values
+** between -9223372036854775808 and +9223372036854775807 inclusive. ^The
+** sqlite3_uint64 and sqlite_uint64 types can store integer values
+** between 0 and +18446744073709551615 inclusive.
+*/
+#ifdef SQLITE_INT64_TYPE
+ typedef SQLITE_INT64_TYPE sqlite_int64;
+# ifdef SQLITE_UINT64_TYPE
+ typedef SQLITE_UINT64_TYPE sqlite_uint64;
+# else
+ typedef unsigned SQLITE_INT64_TYPE sqlite_uint64;
+# endif
+#elif defined(_MSC_VER) || defined(__BORLANDC__)
+ typedef __int64 sqlite_int64;
+ typedef unsigned __int64 sqlite_uint64;
+#else
+ typedef long long int sqlite_int64;
+ typedef unsigned long long int sqlite_uint64;
+#endif
+typedef sqlite_int64 sqlite3_int64;
+typedef sqlite_uint64 sqlite3_uint64;
+
+/*
+** If compiling for a processor that lacks floating point support,
+** substitute integer for floating-point.
+*/
+#ifdef SQLITE_OMIT_FLOATING_POINT
+# define double sqlite3_int64
+#endif
+
+/*
+** CAPI3REF: Closing A Database Connection
+** DESTRUCTOR: sqlite3
+**
+** ^The sqlite3_close() and sqlite3_close_v2() routines are destructors
+** for the [sqlite3] object.
+** ^Calls to sqlite3_close() and sqlite3_close_v2() return [SQLITE_OK] if
+** the [sqlite3] object is successfully destroyed and all associated
+** resources are deallocated.
+**
+** Ideally, applications should [sqlite3_finalize | finalize] all
+** [prepared statements], [sqlite3_blob_close | close] all [BLOB handles], and
+** [sqlite3_backup_finish | finish] all [sqlite3_backup] objects associated
+** with the [sqlite3] object prior to attempting to close the object.
+** ^If the database connection is associated with unfinalized prepared
+** statements, BLOB handlers, and/or unfinished sqlite3_backup objects then
+** sqlite3_close() will leave the database connection open and return
+** [SQLITE_BUSY]. ^If sqlite3_close_v2() is called with unfinalized prepared
+** statements, unclosed BLOB handlers, and/or unfinished sqlite3_backups,
+** it returns [SQLITE_OK] regardless, but instead of deallocating the database
+** connection immediately, it marks the database connection as an unusable
+** "zombie" and makes arrangements to automatically deallocate the database
+** connection after all prepared statements are finalized, all BLOB handles
+** are closed, and all backups have finished. The sqlite3_close_v2() interface
+** is intended for use with host languages that are garbage collected, and
+** where the order in which destructors are called is arbitrary.
+**
+** ^If an [sqlite3] object is destroyed while a transaction is open,
+** the transaction is automatically rolled back.
+**
+** The C parameter to [sqlite3_close(C)] and [sqlite3_close_v2(C)]
+** must be either a NULL
+** pointer or an [sqlite3] object pointer obtained
+** from [sqlite3_open()], [sqlite3_open16()], or
+** [sqlite3_open_v2()], and not previously closed.
+** ^Calling sqlite3_close() or sqlite3_close_v2() with a NULL pointer
+** argument is a harmless no-op.
+*/
+SQLITE_API int sqlite3_close(sqlite3*);
+SQLITE_API int sqlite3_close_v2(sqlite3*);
+
+/*
+** The type for a callback function.
+** This is legacy and deprecated. It is included for historical
+** compatibility and is not documented.
+*/
+typedef int (*sqlite3_callback)(void*,int,char**, char**);
+
+/*
+** CAPI3REF: One-Step Query Execution Interface
+** METHOD: sqlite3
+**
+** The sqlite3_exec() interface is a convenience wrapper around
+** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()],
+** that allows an application to run multiple statements of SQL
+** without having to use a lot of C code.
+**
+** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded,
+** semicolon-separate SQL statements passed into its 2nd argument,
+** in the context of the [database connection] passed in as its 1st
+** argument. ^If the callback function of the 3rd argument to
+** sqlite3_exec() is not NULL, then it is invoked for each result row
+** coming out of the evaluated SQL statements. ^The 4th argument to
+** sqlite3_exec() is relayed through to the 1st argument of each
+** callback invocation. ^If the callback pointer to sqlite3_exec()
+** is NULL, then no callback is ever invoked and result rows are
+** ignored.
+**
+** ^If an error occurs while evaluating the SQL statements passed into
+** sqlite3_exec(), then execution of the current statement stops and
+** subsequent statements are skipped. ^If the 5th parameter to sqlite3_exec()
+** is not NULL then any error message is written into memory obtained
+** from [sqlite3_malloc()] and passed back through the 5th parameter.
+** To avoid memory leaks, the application should invoke [sqlite3_free()]
+** on error message strings returned through the 5th parameter of
+** sqlite3_exec() after the error message string is no longer needed.
+** ^If the 5th parameter to sqlite3_exec() is not NULL and no errors
+** occur, then sqlite3_exec() sets the pointer in its 5th parameter to
+** NULL before returning.
+**
+** ^If an sqlite3_exec() callback returns non-zero, the sqlite3_exec()
+** routine returns SQLITE_ABORT without invoking the callback again and
+** without running any subsequent SQL statements.
+**
+** ^The 2nd argument to the sqlite3_exec() callback function is the
+** number of columns in the result. ^The 3rd argument to the sqlite3_exec()
+** callback is an array of pointers to strings obtained as if from
+** [sqlite3_column_text()], one for each column. ^If an element of a
+** result row is NULL then the corresponding string pointer for the
+** sqlite3_exec() callback is a NULL pointer. ^The 4th argument to the
+** sqlite3_exec() callback is an array of pointers to strings where each
+** entry represents the name of corresponding result column as obtained
+** from [sqlite3_column_name()].
+**
+** ^If the 2nd parameter to sqlite3_exec() is a NULL pointer, a pointer
+** to an empty string, or a pointer that contains only whitespace and/or
+** SQL comments, then no SQL statements are evaluated and the database
+** is not changed.
+**
+** Restrictions:
+**
+** <ul>
+** <li> The application must ensure that the 1st parameter to sqlite3_exec()
+** is a valid and open [database connection].
+** <li> The application must not close the [database connection] specified by
+** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running.
+** <li> The application must not modify the SQL statement text passed into
+** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running.
+** <li> The application must not dereference the arrays or string pointers
+** passed as the 3rd and 4th callback parameters after it returns.
+** </ul>
+*/
+SQLITE_API int sqlite3_exec(
+ sqlite3*, /* An open database */
+ const char *sql, /* SQL to be evaluated */
+ int (*callback)(void*,int,char**,char**), /* Callback function */
+ void *, /* 1st argument to callback */
+ char **errmsg /* Error msg written here */
+);
+
+/*
+** CAPI3REF: Result Codes
+** KEYWORDS: {result code definitions}
+**
+** Many SQLite functions return an integer result code from the set shown
+** here in order to indicate success or failure.
+**
+** New error codes may be added in future versions of SQLite.
+**
+** See also: [extended result code definitions]
+*/
+#define SQLITE_OK 0 /* Successful result */
+/* beginning-of-error-codes */
+#define SQLITE_ERROR 1 /* Generic error */
+#define SQLITE_INTERNAL 2 /* Internal logic error in SQLite */
+#define SQLITE_PERM 3 /* Access permission denied */
+#define SQLITE_ABORT 4 /* Callback routine requested an abort */
+#define SQLITE_BUSY 5 /* The database file is locked */
+#define SQLITE_LOCKED 6 /* A table in the database is locked */
+#define SQLITE_NOMEM 7 /* A malloc() failed */
+#define SQLITE_READONLY 8 /* Attempt to write a readonly database */
+#define SQLITE_INTERRUPT 9 /* Operation terminated by sqlite3_interrupt()*/
+#define SQLITE_IOERR 10 /* Some kind of disk I/O error occurred */
+#define SQLITE_CORRUPT 11 /* The database disk image is malformed */
+#define SQLITE_NOTFOUND 12 /* Unknown opcode in sqlite3_file_control() */
+#define SQLITE_FULL 13 /* Insertion failed because database is full */
+#define SQLITE_CANTOPEN 14 /* Unable to open the database file */
+#define SQLITE_PROTOCOL 15 /* Database lock protocol error */
+#define SQLITE_EMPTY 16 /* Internal use only */
+#define SQLITE_SCHEMA 17 /* The database schema changed */
+#define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */
+#define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */
+#define SQLITE_MISMATCH 20 /* Data type mismatch */
+#define SQLITE_MISUSE 21 /* Library used incorrectly */
+#define SQLITE_NOLFS 22 /* Uses OS features not supported on host */
+#define SQLITE_AUTH 23 /* Authorization denied */
+#define SQLITE_FORMAT 24 /* Not used */
+#define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */
+#define SQLITE_NOTADB 26 /* File opened that is not a database file */
+#define SQLITE_NOTICE 27 /* Notifications from sqlite3_log() */
+#define SQLITE_WARNING 28 /* Warnings from sqlite3_log() */
+#define SQLITE_ROW 100 /* sqlite3_step() has another row ready */
+#define SQLITE_DONE 101 /* sqlite3_step() has finished executing */
+/* end-of-error-codes */
+
+/*
+** CAPI3REF: Extended Result Codes
+** KEYWORDS: {extended result code definitions}
+**
+** In its default configuration, SQLite API routines return one of 30 integer
+** [result codes]. However, experience has shown that many of
+** these result codes are too coarse-grained. They do not provide as
+** much information about problems as programmers might like. In an effort to
+** address this, newer versions of SQLite (version 3.3.8 [dateof:3.3.8]
+** and later) include
+** support for additional result codes that provide more detailed information
+** about errors. These [extended result codes] are enabled or disabled
+** on a per database connection basis using the
+** [sqlite3_extended_result_codes()] API. Or, the extended code for
+** the most recent error can be obtained using
+** [sqlite3_extended_errcode()].
+*/
+#define SQLITE_ERROR_MISSING_COLLSEQ (SQLITE_ERROR | (1<<8))
+#define SQLITE_ERROR_RETRY (SQLITE_ERROR | (2<<8))
+#define SQLITE_ERROR_SNAPSHOT (SQLITE_ERROR | (3<<8))
+#define SQLITE_IOERR_READ (SQLITE_IOERR | (1<<8))
+#define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<8))
+#define SQLITE_IOERR_WRITE (SQLITE_IOERR | (3<<8))
+#define SQLITE_IOERR_FSYNC (SQLITE_IOERR | (4<<8))
+#define SQLITE_IOERR_DIR_FSYNC (SQLITE_IOERR | (5<<8))
+#define SQLITE_IOERR_TRUNCATE (SQLITE_IOERR | (6<<8))
+#define SQLITE_IOERR_FSTAT (SQLITE_IOERR | (7<<8))
+#define SQLITE_IOERR_UNLOCK (SQLITE_IOERR | (8<<8))
+#define SQLITE_IOERR_RDLOCK (SQLITE_IOERR | (9<<8))
+#define SQLITE_IOERR_DELETE (SQLITE_IOERR | (10<<8))
+#define SQLITE_IOERR_BLOCKED (SQLITE_IOERR | (11<<8))
+#define SQLITE_IOERR_NOMEM (SQLITE_IOERR | (12<<8))
+#define SQLITE_IOERR_ACCESS (SQLITE_IOERR | (13<<8))
+#define SQLITE_IOERR_CHECKRESERVEDLOCK (SQLITE_IOERR | (14<<8))
+#define SQLITE_IOERR_LOCK (SQLITE_IOERR | (15<<8))
+#define SQLITE_IOERR_CLOSE (SQLITE_IOERR | (16<<8))
+#define SQLITE_IOERR_DIR_CLOSE (SQLITE_IOERR | (17<<8))
+#define SQLITE_IOERR_SHMOPEN (SQLITE_IOERR | (18<<8))
+#define SQLITE_IOERR_SHMSIZE (SQLITE_IOERR | (19<<8))
+#define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20<<8))
+#define SQLITE_IOERR_SHMMAP (SQLITE_IOERR | (21<<8))
+#define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8))
+#define SQLITE_IOERR_DELETE_NOENT (SQLITE_IOERR | (23<<8))
+#define SQLITE_IOERR_MMAP (SQLITE_IOERR | (24<<8))
+#define SQLITE_IOERR_GETTEMPPATH (SQLITE_IOERR | (25<<8))
+#define SQLITE_IOERR_CONVPATH (SQLITE_IOERR | (26<<8))
+#define SQLITE_IOERR_VNODE (SQLITE_IOERR | (27<<8))
+#define SQLITE_IOERR_AUTH (SQLITE_IOERR | (28<<8))
+#define SQLITE_IOERR_BEGIN_ATOMIC (SQLITE_IOERR | (29<<8))
+#define SQLITE_IOERR_COMMIT_ATOMIC (SQLITE_IOERR | (30<<8))
+#define SQLITE_IOERR_ROLLBACK_ATOMIC (SQLITE_IOERR | (31<<8))
+#define SQLITE_IOERR_DATA (SQLITE_IOERR | (32<<8))
+#define SQLITE_IOERR_CORRUPTFS (SQLITE_IOERR | (33<<8))
+#define SQLITE_IOERR_IN_PAGE (SQLITE_IOERR | (34<<8))
+#define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8))
+#define SQLITE_LOCKED_VTAB (SQLITE_LOCKED | (2<<8))
+#define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8))
+#define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8))
+#define SQLITE_BUSY_TIMEOUT (SQLITE_BUSY | (3<<8))
+#define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8))
+#define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8))
+#define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3<<8))
+#define SQLITE_CANTOPEN_CONVPATH (SQLITE_CANTOPEN | (4<<8))
+#define SQLITE_CANTOPEN_DIRTYWAL (SQLITE_CANTOPEN | (5<<8)) /* Not Used */
+#define SQLITE_CANTOPEN_SYMLINK (SQLITE_CANTOPEN | (6<<8))
+#define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8))
+#define SQLITE_CORRUPT_SEQUENCE (SQLITE_CORRUPT | (2<<8))
+#define SQLITE_CORRUPT_INDEX (SQLITE_CORRUPT | (3<<8))
+#define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8))
+#define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8))
+#define SQLITE_READONLY_ROLLBACK (SQLITE_READONLY | (3<<8))
+#define SQLITE_READONLY_DBMOVED (SQLITE_READONLY | (4<<8))
+#define SQLITE_READONLY_CANTINIT (SQLITE_READONLY | (5<<8))
+#define SQLITE_READONLY_DIRECTORY (SQLITE_READONLY | (6<<8))
+#define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2<<8))
+#define SQLITE_CONSTRAINT_CHECK (SQLITE_CONSTRAINT | (1<<8))
+#define SQLITE_CONSTRAINT_COMMITHOOK (SQLITE_CONSTRAINT | (2<<8))
+#define SQLITE_CONSTRAINT_FOREIGNKEY (SQLITE_CONSTRAINT | (3<<8))
+#define SQLITE_CONSTRAINT_FUNCTION (SQLITE_CONSTRAINT | (4<<8))
+#define SQLITE_CONSTRAINT_NOTNULL (SQLITE_CONSTRAINT | (5<<8))
+#define SQLITE_CONSTRAINT_PRIMARYKEY (SQLITE_CONSTRAINT | (6<<8))
+#define SQLITE_CONSTRAINT_TRIGGER (SQLITE_CONSTRAINT | (7<<8))
+#define SQLITE_CONSTRAINT_UNIQUE (SQLITE_CONSTRAINT | (8<<8))
+#define SQLITE_CONSTRAINT_VTAB (SQLITE_CONSTRAINT | (9<<8))
+#define SQLITE_CONSTRAINT_ROWID (SQLITE_CONSTRAINT |(10<<8))
+#define SQLITE_CONSTRAINT_PINNED (SQLITE_CONSTRAINT |(11<<8))
+#define SQLITE_CONSTRAINT_DATATYPE (SQLITE_CONSTRAINT |(12<<8))
+#define SQLITE_NOTICE_RECOVER_WAL (SQLITE_NOTICE | (1<<8))
+#define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8))
+#define SQLITE_NOTICE_RBU (SQLITE_NOTICE | (3<<8))
+#define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8))
+#define SQLITE_AUTH_USER (SQLITE_AUTH | (1<<8))
+#define SQLITE_OK_LOAD_PERMANENTLY (SQLITE_OK | (1<<8))
+#define SQLITE_OK_SYMLINK (SQLITE_OK | (2<<8)) /* internal use only */
+
+/*
+** CAPI3REF: Flags For File Open Operations
+**
+** These bit values are intended for use in the
+** 3rd parameter to the [sqlite3_open_v2()] interface and
+** in the 4th parameter to the [sqlite3_vfs.xOpen] method.
+**
+** Only those flags marked as "Ok for sqlite3_open_v2()" may be
+** used as the third argument to the [sqlite3_open_v2()] interface.
+** The other flags have historically been ignored by sqlite3_open_v2(),
+** though future versions of SQLite might change so that an error is
+** raised if any of the disallowed bits are passed into sqlite3_open_v2().
+** Applications should not depend on the historical behavior.
+**
+** Note in particular that passing the SQLITE_OPEN_EXCLUSIVE flag into
+** [sqlite3_open_v2()] does *not* cause the underlying database file
+** to be opened using O_EXCL. Passing SQLITE_OPEN_EXCLUSIVE into
+** [sqlite3_open_v2()] has historically be a no-op and might become an
+** error in future versions of SQLite.
+*/
+#define SQLITE_OPEN_READONLY 0x00000001 /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_READWRITE 0x00000002 /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_CREATE 0x00000004 /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_DELETEONCLOSE 0x00000008 /* VFS only */
+#define SQLITE_OPEN_EXCLUSIVE 0x00000010 /* VFS only */
+#define SQLITE_OPEN_AUTOPROXY 0x00000020 /* VFS only */
+#define SQLITE_OPEN_URI 0x00000040 /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_MEMORY 0x00000080 /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_MAIN_DB 0x00000100 /* VFS only */
+#define SQLITE_OPEN_TEMP_DB 0x00000200 /* VFS only */
+#define SQLITE_OPEN_TRANSIENT_DB 0x00000400 /* VFS only */
+#define SQLITE_OPEN_MAIN_JOURNAL 0x00000800 /* VFS only */
+#define SQLITE_OPEN_TEMP_JOURNAL 0x00001000 /* VFS only */
+#define SQLITE_OPEN_SUBJOURNAL 0x00002000 /* VFS only */
+#define SQLITE_OPEN_SUPER_JOURNAL 0x00004000 /* VFS only */
+#define SQLITE_OPEN_NOMUTEX 0x00008000 /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_FULLMUTEX 0x00010000 /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_SHAREDCACHE 0x00020000 /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_PRIVATECACHE 0x00040000 /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_WAL 0x00080000 /* VFS only */
+#define SQLITE_OPEN_NOFOLLOW 0x01000000 /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_EXRESCODE 0x02000000 /* Extended result codes */
+
+/* Reserved: 0x00F00000 */
+/* Legacy compatibility: */
+#define SQLITE_OPEN_MASTER_JOURNAL 0x00004000 /* VFS only */
+
+
+/*
+** CAPI3REF: Device Characteristics
+**
+** The xDeviceCharacteristics method of the [sqlite3_io_methods]
+** object returns an integer which is a vector of these
+** bit values expressing I/O characteristics of the mass storage
+** device that holds the file that the [sqlite3_io_methods]
+** refers to.
+**
+** The SQLITE_IOCAP_ATOMIC property means that all writes of
+** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values
+** mean that writes of blocks that are nnn bytes in size and
+** are aligned to an address which is an integer multiple of
+** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means
+** that when data is appended to a file, the data is appended
+** first then the size of the file is extended, never the other
+** way around. The SQLITE_IOCAP_SEQUENTIAL property means that
+** information is written to disk in the same order as calls
+** to xWrite(). The SQLITE_IOCAP_POWERSAFE_OVERWRITE property means that
+** after reboot following a crash or power loss, the only bytes in a
+** file that were written at the application level might have changed
+** and that adjacent bytes, even bytes within the same sector are
+** guaranteed to be unchanged. The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN
+** flag indicates that a file cannot be deleted when open. The
+** SQLITE_IOCAP_IMMUTABLE flag indicates that the file is on
+** read-only media and cannot be changed even by processes with
+** elevated privileges.
+**
+** The SQLITE_IOCAP_BATCH_ATOMIC property means that the underlying
+** filesystem supports doing multiple write operations atomically when those
+** write operations are bracketed by [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] and
+** [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE].
+**
+** The SQLITE_IOCAP_SUBPAGE_READ property means that it is ok to read
+** from the database file in amounts that are not a multiple of the
+** page size and that do not begin at a page boundary. Without this
+** property, SQLite is careful to only do full-page reads and write
+** on aligned pages, with the one exception that it will do a sub-page
+** read of the first page to access the database header.
+*/
+#define SQLITE_IOCAP_ATOMIC 0x00000001
+#define SQLITE_IOCAP_ATOMIC512 0x00000002
+#define SQLITE_IOCAP_ATOMIC1K 0x00000004
+#define SQLITE_IOCAP_ATOMIC2K 0x00000008
+#define SQLITE_IOCAP_ATOMIC4K 0x00000010
+#define SQLITE_IOCAP_ATOMIC8K 0x00000020
+#define SQLITE_IOCAP_ATOMIC16K 0x00000040
+#define SQLITE_IOCAP_ATOMIC32K 0x00000080
+#define SQLITE_IOCAP_ATOMIC64K 0x00000100
+#define SQLITE_IOCAP_SAFE_APPEND 0x00000200
+#define SQLITE_IOCAP_SEQUENTIAL 0x00000400
+#define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800
+#define SQLITE_IOCAP_POWERSAFE_OVERWRITE 0x00001000
+#define SQLITE_IOCAP_IMMUTABLE 0x00002000
+#define SQLITE_IOCAP_BATCH_ATOMIC 0x00004000
+#define SQLITE_IOCAP_SUBPAGE_READ 0x00008000
+
+/*
+** CAPI3REF: File Locking Levels
+**
+** SQLite uses one of these integer values as the second
+** argument to calls it makes to the xLock() and xUnlock() methods
+** of an [sqlite3_io_methods] object. These values are ordered from
+** lest restrictive to most restrictive.
+**
+** The argument to xLock() is always SHARED or higher. The argument to
+** xUnlock is either SHARED or NONE.
+*/
+#define SQLITE_LOCK_NONE 0 /* xUnlock() only */
+#define SQLITE_LOCK_SHARED 1 /* xLock() or xUnlock() */
+#define SQLITE_LOCK_RESERVED 2 /* xLock() only */
+#define SQLITE_LOCK_PENDING 3 /* xLock() only */
+#define SQLITE_LOCK_EXCLUSIVE 4 /* xLock() only */
+
+/*
+** CAPI3REF: Synchronization Type Flags
+**
+** When SQLite invokes the xSync() method of an
+** [sqlite3_io_methods] object it uses a combination of
+** these integer values as the second argument.
+**
+** When the SQLITE_SYNC_DATAONLY flag is used, it means that the
+** sync operation only needs to flush data to mass storage. Inode
+** information need not be flushed. If the lower four bits of the flag
+** equal SQLITE_SYNC_NORMAL, that means to use normal fsync() semantics.
+** If the lower four bits equal SQLITE_SYNC_FULL, that means
+** to use Mac OS X style fullsync instead of fsync().
+**
+** Do not confuse the SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags
+** with the [PRAGMA synchronous]=NORMAL and [PRAGMA synchronous]=FULL
+** settings. The [synchronous pragma] determines when calls to the
+** xSync VFS method occur and applies uniformly across all platforms.
+** The SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags determine how
+** energetic or rigorous or forceful the sync operations are and
+** only make a difference on Mac OSX for the default SQLite code.
+** (Third-party VFS implementations might also make the distinction
+** between SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL, but among the
+** operating systems natively supported by SQLite, only Mac OSX
+** cares about the difference.)
+*/
+#define SQLITE_SYNC_NORMAL 0x00002
+#define SQLITE_SYNC_FULL 0x00003
+#define SQLITE_SYNC_DATAONLY 0x00010
+
+/*
+** CAPI3REF: OS Interface Open File Handle
+**
+** An [sqlite3_file] object represents an open file in the
+** [sqlite3_vfs | OS interface layer]. Individual OS interface
+** implementations will
+** want to subclass this object by appending additional fields
+** for their own use. The pMethods entry is a pointer to an
+** [sqlite3_io_methods] object that defines methods for performing
+** I/O operations on the open file.
+*/
+typedef struct sqlite3_file sqlite3_file;
+struct sqlite3_file {
+ const struct sqlite3_io_methods *pMethods; /* Methods for an open file */
+};
+
+/*
+** CAPI3REF: OS Interface File Virtual Methods Object
+**
+** Every file opened by the [sqlite3_vfs.xOpen] method populates an
+** [sqlite3_file] object (or, more commonly, a subclass of the
+** [sqlite3_file] object) with a pointer to an instance of this object.
+** This object defines the methods used to perform various operations
+** against the open file represented by the [sqlite3_file] object.
+**
+** If the [sqlite3_vfs.xOpen] method sets the sqlite3_file.pMethods element
+** to a non-NULL pointer, then the sqlite3_io_methods.xClose method
+** may be invoked even if the [sqlite3_vfs.xOpen] reported that it failed. The
+** only way to prevent a call to xClose following a failed [sqlite3_vfs.xOpen]
+** is for the [sqlite3_vfs.xOpen] to set the sqlite3_file.pMethods element
+** to NULL.
+**
+** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or
+** [SQLITE_SYNC_FULL]. The first choice is the normal fsync().
+** The second choice is a Mac OS X style fullsync. The [SQLITE_SYNC_DATAONLY]
+** flag may be ORed in to indicate that only the data of the file
+** and not its inode needs to be synced.
+**
+** The integer values to xLock() and xUnlock() are one of
+** <ul>
+** <li> [SQLITE_LOCK_NONE],
+** <li> [SQLITE_LOCK_SHARED],
+** <li> [SQLITE_LOCK_RESERVED],
+** <li> [SQLITE_LOCK_PENDING], or
+** <li> [SQLITE_LOCK_EXCLUSIVE].
+** </ul>
+** xLock() upgrades the database file lock. In other words, xLock() moves the
+** database file lock in the direction NONE toward EXCLUSIVE. The argument to
+** xLock() is always one of SHARED, RESERVED, PENDING, or EXCLUSIVE, never
+** SQLITE_LOCK_NONE. If the database file lock is already at or above the
+** requested lock, then the call to xLock() is a no-op.
+** xUnlock() downgrades the database file lock to either SHARED or NONE.
+** If the lock is already at or below the requested lock state, then the call
+** to xUnlock() is a no-op.
+** The xCheckReservedLock() method checks whether any database connection,
+** either in this process or in some other process, is holding a RESERVED,
+** PENDING, or EXCLUSIVE lock on the file. It returns, via its output
+** pointer parameter, true if such a lock exists and false otherwise.
+**
+** The xFileControl() method is a generic interface that allows custom
+** VFS implementations to directly control an open file using the
+** [sqlite3_file_control()] interface. The second "op" argument is an
+** integer opcode. The third argument is a generic pointer intended to
+** point to a structure that may contain arguments or space in which to
+** write return values. Potential uses for xFileControl() might be
+** functions to enable blocking locks with timeouts, to change the
+** locking strategy (for example to use dot-file locks), to inquire
+** about the status of a lock, or to break stale locks. The SQLite
+** core reserves all opcodes less than 100 for its own use.
+** A [file control opcodes | list of opcodes] less than 100 is available.
+** Applications that define a custom xFileControl method should use opcodes
+** greater than 100 to avoid conflicts. VFS implementations should
+** return [SQLITE_NOTFOUND] for file control opcodes that they do not
+** recognize.
+**
+** The xSectorSize() method returns the sector size of the
+** device that underlies the file. The sector size is the
+** minimum write that can be performed without disturbing
+** other bytes in the file. The xDeviceCharacteristics()
+** method returns a bit vector describing behaviors of the
+** underlying device:
+**
+** <ul>
+** <li> [SQLITE_IOCAP_ATOMIC]
+** <li> [SQLITE_IOCAP_ATOMIC512]
+** <li> [SQLITE_IOCAP_ATOMIC1K]
+** <li> [SQLITE_IOCAP_ATOMIC2K]
+** <li> [SQLITE_IOCAP_ATOMIC4K]
+** <li> [SQLITE_IOCAP_ATOMIC8K]
+** <li> [SQLITE_IOCAP_ATOMIC16K]
+** <li> [SQLITE_IOCAP_ATOMIC32K]
+** <li> [SQLITE_IOCAP_ATOMIC64K]
+** <li> [SQLITE_IOCAP_SAFE_APPEND]
+** <li> [SQLITE_IOCAP_SEQUENTIAL]
+** <li> [SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN]
+** <li> [SQLITE_IOCAP_POWERSAFE_OVERWRITE]
+** <li> [SQLITE_IOCAP_IMMUTABLE]
+** <li> [SQLITE_IOCAP_BATCH_ATOMIC]
+** <li> [SQLITE_IOCAP_SUBPAGE_READ]
+** </ul>
+**
+** The SQLITE_IOCAP_ATOMIC property means that all writes of
+** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values
+** mean that writes of blocks that are nnn bytes in size and
+** are aligned to an address which is an integer multiple of
+** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means
+** that when data is appended to a file, the data is appended
+** first then the size of the file is extended, never the other
+** way around. The SQLITE_IOCAP_SEQUENTIAL property means that
+** information is written to disk in the same order as calls
+** to xWrite().
+**
+** If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill
+** in the unread portions of the buffer with zeros. A VFS that
+** fails to zero-fill short reads might seem to work. However,
+** failure to zero-fill short reads will eventually lead to
+** database corruption.
+*/
+typedef struct sqlite3_io_methods sqlite3_io_methods;
+struct sqlite3_io_methods {
+ int iVersion;
+ int (*xClose)(sqlite3_file*);
+ int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst);
+ int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst);
+ int (*xTruncate)(sqlite3_file*, sqlite3_int64 size);
+ int (*xSync)(sqlite3_file*, int flags);
+ int (*xFileSize)(sqlite3_file*, sqlite3_int64 *pSize);
+ int (*xLock)(sqlite3_file*, int);
+ int (*xUnlock)(sqlite3_file*, int);
+ int (*xCheckReservedLock)(sqlite3_file*, int *pResOut);
+ int (*xFileControl)(sqlite3_file*, int op, void *pArg);
+ int (*xSectorSize)(sqlite3_file*);
+ int (*xDeviceCharacteristics)(sqlite3_file*);
+ /* Methods above are valid for version 1 */
+ int (*xShmMap)(sqlite3_file*, int iPg, int pgsz, int, void volatile**);
+ int (*xShmLock)(sqlite3_file*, int offset, int n, int flags);
+ void (*xShmBarrier)(sqlite3_file*);
+ int (*xShmUnmap)(sqlite3_file*, int deleteFlag);
+ /* Methods above are valid for version 2 */
+ int (*xFetch)(sqlite3_file*, sqlite3_int64 iOfst, int iAmt, void **pp);
+ int (*xUnfetch)(sqlite3_file*, sqlite3_int64 iOfst, void *p);
+ /* Methods above are valid for version 3 */
+ /* Additional methods may be added in future releases */
+};
+
+/*
+** CAPI3REF: Standard File Control Opcodes
+** KEYWORDS: {file control opcodes} {file control opcode}
+**
+** These integer constants are opcodes for the xFileControl method
+** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()]
+** interface.
+**
+** <ul>
+** <li>[[SQLITE_FCNTL_LOCKSTATE]]
+** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging. This
+** opcode causes the xFileControl method to write the current state of
+** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],
+** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE])
+** into an integer that the pArg argument points to.
+** This capability is only available if SQLite is compiled with [SQLITE_DEBUG].
+**
+** <li>[[SQLITE_FCNTL_SIZE_HINT]]
+** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS
+** layer a hint of how large the database file will grow to be during the
+** current transaction. This hint is not guaranteed to be accurate but it
+** is often close. The underlying VFS might choose to preallocate database
+** file space based on this hint in order to help writes to the database
+** file run faster.
+**
+** <li>[[SQLITE_FCNTL_SIZE_LIMIT]]
+** The [SQLITE_FCNTL_SIZE_LIMIT] opcode is used by in-memory VFS that
+** implements [sqlite3_deserialize()] to set an upper bound on the size
+** of the in-memory database. The argument is a pointer to a [sqlite3_int64].
+** If the integer pointed to is negative, then it is filled in with the
+** current limit. Otherwise the limit is set to the larger of the value
+** of the integer pointed to and the current database size. The integer
+** pointed to is set to the new limit.
+**
+** <li>[[SQLITE_FCNTL_CHUNK_SIZE]]
+** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS
+** extends and truncates the database file in chunks of a size specified
+** by the user. The fourth argument to [sqlite3_file_control()] should
+** point to an integer (type int) containing the new chunk-size to use
+** for the nominated database. Allocating database file space in large
+** chunks (say 1MB at a time), may reduce file-system fragmentation and
+** improve performance on some systems.
+**
+** <li>[[SQLITE_FCNTL_FILE_POINTER]]
+** The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer
+** to the [sqlite3_file] object associated with a particular database
+** connection. See also [SQLITE_FCNTL_JOURNAL_POINTER].
+**
+** <li>[[SQLITE_FCNTL_JOURNAL_POINTER]]
+** The [SQLITE_FCNTL_JOURNAL_POINTER] opcode is used to obtain a pointer
+** to the [sqlite3_file] object associated with the journal file (either
+** the [rollback journal] or the [write-ahead log]) for a particular database
+** connection. See also [SQLITE_FCNTL_FILE_POINTER].
+**
+** <li>[[SQLITE_FCNTL_SYNC_OMITTED]]
+** No longer in use.
+**
+** <li>[[SQLITE_FCNTL_SYNC]]
+** The [SQLITE_FCNTL_SYNC] opcode is generated internally by SQLite and
+** sent to the VFS immediately before the xSync method is invoked on a
+** database file descriptor. Or, if the xSync method is not invoked
+** because the user has configured SQLite with
+** [PRAGMA synchronous | PRAGMA synchronous=OFF] it is invoked in place
+** of the xSync method. In most cases, the pointer argument passed with
+** this file-control is NULL. However, if the database file is being synced
+** as part of a multi-database commit, the argument points to a nul-terminated
+** string containing the transactions super-journal file name. VFSes that
+** do not need this signal should silently ignore this opcode. Applications
+** should not call [sqlite3_file_control()] with this opcode as doing so may
+** disrupt the operation of the specialized VFSes that do require it.
+**
+** <li>[[SQLITE_FCNTL_COMMIT_PHASETWO]]
+** The [SQLITE_FCNTL_COMMIT_PHASETWO] opcode is generated internally by SQLite
+** and sent to the VFS after a transaction has been committed immediately
+** but before the database is unlocked. VFSes that do not need this signal
+** should silently ignore this opcode. Applications should not call
+** [sqlite3_file_control()] with this opcode as doing so may disrupt the
+** operation of the specialized VFSes that do require it.
+**
+** <li>[[SQLITE_FCNTL_WIN32_AV_RETRY]]
+** ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic
+** retry counts and intervals for certain disk I/O operations for the
+** windows [VFS] in order to provide robustness in the presence of
+** anti-virus programs. By default, the windows VFS will retry file read,
+** file write, and file delete operations up to 10 times, with a delay
+** of 25 milliseconds before the first retry and with the delay increasing
+** by an additional 25 milliseconds with each subsequent retry. This
+** opcode allows these two values (10 retries and 25 milliseconds of delay)
+** to be adjusted. The values are changed for all database connections
+** within the same process. The argument is a pointer to an array of two
+** integers where the first integer is the new retry count and the second
+** integer is the delay. If either integer is negative, then the setting
+** is not changed but instead the prior value of that setting is written
+** into the array entry, allowing the current retry settings to be
+** interrogated. The zDbName parameter is ignored.
+**
+** <li>[[SQLITE_FCNTL_PERSIST_WAL]]
+** ^The [SQLITE_FCNTL_PERSIST_WAL] opcode is used to set or query the
+** persistent [WAL | Write Ahead Log] setting. By default, the auxiliary
+** write ahead log ([WAL file]) and shared memory
+** files used for transaction control
+** are automatically deleted when the latest connection to the database
+** closes. Setting persistent WAL mode causes those files to persist after
+** close. Persisting the files is useful when other processes that do not
+** have write permission on the directory containing the database file want
+** to read the database file, as the WAL and shared memory files must exist
+** in order for the database to be readable. The fourth parameter to
+** [sqlite3_file_control()] for this opcode should be a pointer to an integer.
+** That integer is 0 to disable persistent WAL mode or 1 to enable persistent
+** WAL mode. If the integer is -1, then it is overwritten with the current
+** WAL persistence setting.
+**
+** <li>[[SQLITE_FCNTL_POWERSAFE_OVERWRITE]]
+** ^The [SQLITE_FCNTL_POWERSAFE_OVERWRITE] opcode is used to set or query the
+** persistent "powersafe-overwrite" or "PSOW" setting. The PSOW setting
+** determines the [SQLITE_IOCAP_POWERSAFE_OVERWRITE] bit of the
+** xDeviceCharacteristics methods. The fourth parameter to
+** [sqlite3_file_control()] for this opcode should be a pointer to an integer.
+** That integer is 0 to disable zero-damage mode or 1 to enable zero-damage
+** mode. If the integer is -1, then it is overwritten with the current
+** zero-damage mode setting.
+**
+** <li>[[SQLITE_FCNTL_OVERWRITE]]
+** ^The [SQLITE_FCNTL_OVERWRITE] opcode is invoked by SQLite after opening
+** a write transaction to indicate that, unless it is rolled back for some
+** reason, the entire database file will be overwritten by the current
+** transaction. This is used by VACUUM operations.
+**
+** <li>[[SQLITE_FCNTL_VFSNAME]]
+** ^The [SQLITE_FCNTL_VFSNAME] opcode can be used to obtain the names of
+** all [VFSes] in the VFS stack. The names are of all VFS shims and the
+** final bottom-level VFS are written into memory obtained from
+** [sqlite3_malloc()] and the result is stored in the char* variable
+** that the fourth parameter of [sqlite3_file_control()] points to.
+** The caller is responsible for freeing the memory when done. As with
+** all file-control actions, there is no guarantee that this will actually
+** do anything. Callers should initialize the char* variable to a NULL
+** pointer in case this file-control is not implemented. This file-control
+** is intended for diagnostic use only.
+**
+** <li>[[SQLITE_FCNTL_VFS_POINTER]]
+** ^The [SQLITE_FCNTL_VFS_POINTER] opcode finds a pointer to the top-level
+** [VFSes] currently in use. ^(The argument X in
+** sqlite3_file_control(db,SQLITE_FCNTL_VFS_POINTER,X) must be
+** of type "[sqlite3_vfs] **". This opcodes will set *X
+** to a pointer to the top-level VFS.)^
+** ^When there are multiple VFS shims in the stack, this opcode finds the
+** upper-most shim only.
+**
+** <li>[[SQLITE_FCNTL_PRAGMA]]
+** ^Whenever a [PRAGMA] statement is parsed, an [SQLITE_FCNTL_PRAGMA]
+** file control is sent to the open [sqlite3_file] object corresponding
+** to the database file to which the pragma statement refers. ^The argument
+** to the [SQLITE_FCNTL_PRAGMA] file control is an array of
+** pointers to strings (char**) in which the second element of the array
+** is the name of the pragma and the third element is the argument to the
+** pragma or NULL if the pragma has no argument. ^The handler for an
+** [SQLITE_FCNTL_PRAGMA] file control can optionally make the first element
+** of the char** argument point to a string obtained from [sqlite3_mprintf()]
+** or the equivalent and that string will become the result of the pragma or
+** the error message if the pragma fails. ^If the
+** [SQLITE_FCNTL_PRAGMA] file control returns [SQLITE_NOTFOUND], then normal
+** [PRAGMA] processing continues. ^If the [SQLITE_FCNTL_PRAGMA]
+** file control returns [SQLITE_OK], then the parser assumes that the
+** VFS has handled the PRAGMA itself and the parser generates a no-op
+** prepared statement if result string is NULL, or that returns a copy
+** of the result string if the string is non-NULL.
+** ^If the [SQLITE_FCNTL_PRAGMA] file control returns
+** any result code other than [SQLITE_OK] or [SQLITE_NOTFOUND], that means
+** that the VFS encountered an error while handling the [PRAGMA] and the
+** compilation of the PRAGMA fails with an error. ^The [SQLITE_FCNTL_PRAGMA]
+** file control occurs at the beginning of pragma statement analysis and so
+** it is able to override built-in [PRAGMA] statements.
+**
+** <li>[[SQLITE_FCNTL_BUSYHANDLER]]
+** ^The [SQLITE_FCNTL_BUSYHANDLER]
+** file-control may be invoked by SQLite on the database file handle
+** shortly after it is opened in order to provide a custom VFS with access
+** to the connection's busy-handler callback. The argument is of type (void**)
+** - an array of two (void *) values. The first (void *) actually points
+** to a function of type (int (*)(void *)). In order to invoke the connection's
+** busy-handler, this function should be invoked with the second (void *) in
+** the array as the only argument. If it returns non-zero, then the operation
+** should be retried. If it returns zero, the custom VFS should abandon the
+** current operation.
+**
+** <li>[[SQLITE_FCNTL_TEMPFILENAME]]
+** ^Applications can invoke the [SQLITE_FCNTL_TEMPFILENAME] file-control
+** to have SQLite generate a
+** temporary filename using the same algorithm that is followed to generate
+** temporary filenames for TEMP tables and other internal uses. The
+** argument should be a char** which will be filled with the filename
+** written into memory obtained from [sqlite3_malloc()]. The caller should
+** invoke [sqlite3_free()] on the result to avoid a memory leak.
+**
+** <li>[[SQLITE_FCNTL_MMAP_SIZE]]
+** The [SQLITE_FCNTL_MMAP_SIZE] file control is used to query or set the
+** maximum number of bytes that will be used for memory-mapped I/O.
+** The argument is a pointer to a value of type sqlite3_int64 that
+** is an advisory maximum number of bytes in the file to memory map. The
+** pointer is overwritten with the old value. The limit is not changed if
+** the value originally pointed to is negative, and so the current limit
+** can be queried by passing in a pointer to a negative number. This
+** file-control is used internally to implement [PRAGMA mmap_size].
+**
+** <li>[[SQLITE_FCNTL_TRACE]]
+** The [SQLITE_FCNTL_TRACE] file control provides advisory information
+** to the VFS about what the higher layers of the SQLite stack are doing.
+** This file control is used by some VFS activity tracing [shims].
+** The argument is a zero-terminated string. Higher layers in the
+** SQLite stack may generate instances of this file control if
+** the [SQLITE_USE_FCNTL_TRACE] compile-time option is enabled.
+**
+** <li>[[SQLITE_FCNTL_HAS_MOVED]]
+** The [SQLITE_FCNTL_HAS_MOVED] file control interprets its argument as a
+** pointer to an integer and it writes a boolean into that integer depending
+** on whether or not the file has been renamed, moved, or deleted since it
+** was first opened.
+**
+** <li>[[SQLITE_FCNTL_WIN32_GET_HANDLE]]
+** The [SQLITE_FCNTL_WIN32_GET_HANDLE] opcode can be used to obtain the
+** underlying native file handle associated with a file handle. This file
+** control interprets its argument as a pointer to a native file handle and
+** writes the resulting value there.
+**
+** <li>[[SQLITE_FCNTL_WIN32_SET_HANDLE]]
+** The [SQLITE_FCNTL_WIN32_SET_HANDLE] opcode is used for debugging. This
+** opcode causes the xFileControl method to swap the file handle with the one
+** pointed to by the pArg argument. This capability is used during testing
+** and only needs to be supported when SQLITE_TEST is defined.
+**
+** <li>[[SQLITE_FCNTL_NULL_IO]]
+** The [SQLITE_FCNTL_NULL_IO] opcode sets the low-level file descriptor
+** or file handle for the [sqlite3_file] object such that it will no longer
+** read or write to the database file.
+**
+** <li>[[SQLITE_FCNTL_WAL_BLOCK]]
+** The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might
+** be advantageous to block on the next WAL lock if the lock is not immediately
+** available. The WAL subsystem issues this signal during rare
+** circumstances in order to fix a problem with priority inversion.
+** Applications should <em>not</em> use this file-control.
+**
+** <li>[[SQLITE_FCNTL_ZIPVFS]]
+** The [SQLITE_FCNTL_ZIPVFS] opcode is implemented by zipvfs only. All other
+** VFS should return SQLITE_NOTFOUND for this opcode.
+**
+** <li>[[SQLITE_FCNTL_RBU]]
+** The [SQLITE_FCNTL_RBU] opcode is implemented by the special VFS used by
+** the RBU extension only. All other VFS should return SQLITE_NOTFOUND for
+** this opcode.
+**
+** <li>[[SQLITE_FCNTL_BEGIN_ATOMIC_WRITE]]
+** If the [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] opcode returns SQLITE_OK, then
+** the file descriptor is placed in "batch write mode", which
+** means all subsequent write operations will be deferred and done
+** atomically at the next [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]. Systems
+** that do not support batch atomic writes will return SQLITE_NOTFOUND.
+** ^Following a successful SQLITE_FCNTL_BEGIN_ATOMIC_WRITE and prior to
+** the closing [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] or
+** [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE], SQLite will make
+** no VFS interface calls on the same [sqlite3_file] file descriptor
+** except for calls to the xWrite method and the xFileControl method
+** with [SQLITE_FCNTL_SIZE_HINT].
+**
+** <li>[[SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]]
+** The [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] opcode causes all write
+** operations since the previous successful call to
+** [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be performed atomically.
+** This file control returns [SQLITE_OK] if and only if the writes were
+** all performed successfully and have been committed to persistent storage.
+** ^Regardless of whether or not it is successful, this file control takes
+** the file descriptor out of batch write mode so that all subsequent
+** write operations are independent.
+** ^SQLite will never invoke SQLITE_FCNTL_COMMIT_ATOMIC_WRITE without
+** a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE].
+**
+** <li>[[SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE]]
+** The [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE] opcode causes all write
+** operations since the previous successful call to
+** [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be rolled back.
+** ^This file control takes the file descriptor out of batch write mode
+** so that all subsequent write operations are independent.
+** ^SQLite will never invoke SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE without
+** a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE].
+**
+** <li>[[SQLITE_FCNTL_LOCK_TIMEOUT]]
+** The [SQLITE_FCNTL_LOCK_TIMEOUT] opcode is used to configure a VFS
+** to block for up to M milliseconds before failing when attempting to
+** obtain a file lock using the xLock or xShmLock methods of the VFS.
+** The parameter is a pointer to a 32-bit signed integer that contains
+** the value that M is to be set to. Before returning, the 32-bit signed
+** integer is overwritten with the previous value of M.
+**
+** <li>[[SQLITE_FCNTL_DATA_VERSION]]
+** The [SQLITE_FCNTL_DATA_VERSION] opcode is used to detect changes to
+** a database file. The argument is a pointer to a 32-bit unsigned integer.
+** The "data version" for the pager is written into the pointer. The
+** "data version" changes whenever any change occurs to the corresponding
+** database file, either through SQL statements on the same database
+** connection or through transactions committed by separate database
+** connections possibly in other processes. The [sqlite3_total_changes()]
+** interface can be used to find if any database on the connection has changed,
+** but that interface responds to changes on TEMP as well as MAIN and does
+** not provide a mechanism to detect changes to MAIN only. Also, the
+** [sqlite3_total_changes()] interface responds to internal changes only and
+** omits changes made by other database connections. The
+** [PRAGMA data_version] command provides a mechanism to detect changes to
+** a single attached database that occur due to other database connections,
+** but omits changes implemented by the database connection on which it is
+** called. This file control is the only mechanism to detect changes that
+** happen either internally or externally and that are associated with
+** a particular attached database.
+**
+** <li>[[SQLITE_FCNTL_CKPT_START]]
+** The [SQLITE_FCNTL_CKPT_START] opcode is invoked from within a checkpoint
+** in wal mode before the client starts to copy pages from the wal
+** file to the database file.
+**
+** <li>[[SQLITE_FCNTL_CKPT_DONE]]
+** The [SQLITE_FCNTL_CKPT_DONE] opcode is invoked from within a checkpoint
+** in wal mode after the client has finished copying pages from the wal
+** file to the database file, but before the *-shm file is updated to
+** record the fact that the pages have been checkpointed.
+**
+** <li>[[SQLITE_FCNTL_EXTERNAL_READER]]
+** The EXPERIMENTAL [SQLITE_FCNTL_EXTERNAL_READER] opcode is used to detect
+** whether or not there is a database client in another process with a wal-mode
+** transaction open on the database or not. It is only available on unix.The
+** (void*) argument passed with this file-control should be a pointer to a
+** value of type (int). The integer value is set to 1 if the database is a wal
+** mode database and there exists at least one client in another process that
+** currently has an SQL transaction open on the database. It is set to 0 if
+** the database is not a wal-mode db, or if there is no such connection in any
+** other process. This opcode cannot be used to detect transactions opened
+** by clients within the current process, only within other processes.
+**
+** <li>[[SQLITE_FCNTL_CKSM_FILE]]
+** The [SQLITE_FCNTL_CKSM_FILE] opcode is for use internally by the
+** [checksum VFS shim] only.
+**
+** <li>[[SQLITE_FCNTL_RESET_CACHE]]
+** If there is currently no transaction open on the database, and the
+** database is not a temp db, then the [SQLITE_FCNTL_RESET_CACHE] file-control
+** purges the contents of the in-memory page cache. If there is an open
+** transaction, or if the db is a temp-db, this opcode is a no-op, not an error.
+** </ul>
+*/
+#define SQLITE_FCNTL_LOCKSTATE 1
+#define SQLITE_FCNTL_GET_LOCKPROXYFILE 2
+#define SQLITE_FCNTL_SET_LOCKPROXYFILE 3
+#define SQLITE_FCNTL_LAST_ERRNO 4
+#define SQLITE_FCNTL_SIZE_HINT 5
+#define SQLITE_FCNTL_CHUNK_SIZE 6
+#define SQLITE_FCNTL_FILE_POINTER 7
+#define SQLITE_FCNTL_SYNC_OMITTED 8
+#define SQLITE_FCNTL_WIN32_AV_RETRY 9
+#define SQLITE_FCNTL_PERSIST_WAL 10
+#define SQLITE_FCNTL_OVERWRITE 11
+#define SQLITE_FCNTL_VFSNAME 12
+#define SQLITE_FCNTL_POWERSAFE_OVERWRITE 13
+#define SQLITE_FCNTL_PRAGMA 14
+#define SQLITE_FCNTL_BUSYHANDLER 15
+#define SQLITE_FCNTL_TEMPFILENAME 16
+#define SQLITE_FCNTL_MMAP_SIZE 18
+#define SQLITE_FCNTL_TRACE 19
+#define SQLITE_FCNTL_HAS_MOVED 20
+#define SQLITE_FCNTL_SYNC 21
+#define SQLITE_FCNTL_COMMIT_PHASETWO 22
+#define SQLITE_FCNTL_WIN32_SET_HANDLE 23
+#define SQLITE_FCNTL_WAL_BLOCK 24
+#define SQLITE_FCNTL_ZIPVFS 25
+#define SQLITE_FCNTL_RBU 26
+#define SQLITE_FCNTL_VFS_POINTER 27
+#define SQLITE_FCNTL_JOURNAL_POINTER 28
+#define SQLITE_FCNTL_WIN32_GET_HANDLE 29
+#define SQLITE_FCNTL_PDB 30
+#define SQLITE_FCNTL_BEGIN_ATOMIC_WRITE 31
+#define SQLITE_FCNTL_COMMIT_ATOMIC_WRITE 32
+#define SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE 33
+#define SQLITE_FCNTL_LOCK_TIMEOUT 34
+#define SQLITE_FCNTL_DATA_VERSION 35
+#define SQLITE_FCNTL_SIZE_LIMIT 36
+#define SQLITE_FCNTL_CKPT_DONE 37
+#define SQLITE_FCNTL_RESERVE_BYTES 38
+#define SQLITE_FCNTL_CKPT_START 39
+#define SQLITE_FCNTL_EXTERNAL_READER 40
+#define SQLITE_FCNTL_CKSM_FILE 41
+#define SQLITE_FCNTL_RESET_CACHE 42
+#define SQLITE_FCNTL_NULL_IO 43
+
+/* deprecated names */
+#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
+#define SQLITE_SET_LOCKPROXYFILE SQLITE_FCNTL_SET_LOCKPROXYFILE
+#define SQLITE_LAST_ERRNO SQLITE_FCNTL_LAST_ERRNO
+
+
+/*
+** CAPI3REF: Mutex Handle
+**
+** The mutex module within SQLite defines [sqlite3_mutex] to be an
+** abstract type for a mutex object. The SQLite core never looks
+** at the internal representation of an [sqlite3_mutex]. It only
+** deals with pointers to the [sqlite3_mutex] object.
+**
+** Mutexes are created using [sqlite3_mutex_alloc()].
+*/
+typedef struct sqlite3_mutex sqlite3_mutex;
+
+/*
+** CAPI3REF: Loadable Extension Thunk
+**
+** A pointer to the opaque sqlite3_api_routines structure is passed as
+** the third parameter to entry points of [loadable extensions]. This
+** structure must be typedefed in order to work around compiler warnings
+** on some platforms.
+*/
+typedef struct sqlite3_api_routines sqlite3_api_routines;
+
+/*
+** CAPI3REF: File Name
+**
+** Type [sqlite3_filename] is used by SQLite to pass filenames to the
+** xOpen method of a [VFS]. It may be cast to (const char*) and treated
+** as a normal, nul-terminated, UTF-8 buffer containing the filename, but
+** may also be passed to special APIs such as:
+**
+** <ul>
+** <li> sqlite3_filename_database()
+** <li> sqlite3_filename_journal()
+** <li> sqlite3_filename_wal()
+** <li> sqlite3_uri_parameter()
+** <li> sqlite3_uri_boolean()
+** <li> sqlite3_uri_int64()
+** <li> sqlite3_uri_key()
+** </ul>
+*/
+typedef const char *sqlite3_filename;
+
+/*
+** CAPI3REF: OS Interface Object
+**
+** An instance of the sqlite3_vfs object defines the interface between
+** the SQLite core and the underlying operating system. The "vfs"
+** in the name of the object stands for "virtual file system". See
+** the [VFS | VFS documentation] for further information.
+**
+** The VFS interface is sometimes extended by adding new methods onto
+** the end. Each time such an extension occurs, the iVersion field
+** is incremented. The iVersion value started out as 1 in
+** SQLite [version 3.5.0] on [dateof:3.5.0], then increased to 2
+** with SQLite [version 3.7.0] on [dateof:3.7.0], and then increased
+** to 3 with SQLite [version 3.7.6] on [dateof:3.7.6]. Additional fields
+** may be appended to the sqlite3_vfs object and the iVersion value
+** may increase again in future versions of SQLite.
+** Note that due to an oversight, the structure
+** of the sqlite3_vfs object changed in the transition from
+** SQLite [version 3.5.9] to [version 3.6.0] on [dateof:3.6.0]
+** and yet the iVersion field was not increased.
+**
+** The szOsFile field is the size of the subclassed [sqlite3_file]
+** structure used by this VFS. mxPathname is the maximum length of
+** a pathname in this VFS.
+**
+** Registered sqlite3_vfs objects are kept on a linked list formed by
+** the pNext pointer. The [sqlite3_vfs_register()]
+** and [sqlite3_vfs_unregister()] interfaces manage this list
+** in a thread-safe way. The [sqlite3_vfs_find()] interface
+** searches the list. Neither the application code nor the VFS
+** implementation should use the pNext pointer.
+**
+** The pNext field is the only field in the sqlite3_vfs
+** structure that SQLite will ever modify. SQLite will only access
+** or modify this field while holding a particular static mutex.
+** The application should never modify anything within the sqlite3_vfs
+** object once the object has been registered.
+**
+** The zName field holds the name of the VFS module. The name must
+** be unique across all VFS modules.
+**
+** [[sqlite3_vfs.xOpen]]
+** ^SQLite guarantees that the zFilename parameter to xOpen
+** is either a NULL pointer or string obtained
+** from xFullPathname() with an optional suffix added.
+** ^If a suffix is added to the zFilename parameter, it will
+** consist of a single "-" character followed by no more than
+** 11 alphanumeric and/or "-" characters.
+** ^SQLite further guarantees that
+** the string will be valid and unchanged until xClose() is
+** called. Because of the previous sentence,
+** the [sqlite3_file] can safely store a pointer to the
+** filename if it needs to remember the filename for some reason.
+** If the zFilename parameter to xOpen is a NULL pointer then xOpen
+** must invent its own temporary name for the file. ^Whenever the
+** xFilename parameter is NULL it will also be the case that the
+** flags parameter will include [SQLITE_OPEN_DELETEONCLOSE].
+**
+** The flags argument to xOpen() includes all bits set in
+** the flags argument to [sqlite3_open_v2()]. Or if [sqlite3_open()]
+** or [sqlite3_open16()] is used, then flags includes at least
+** [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE].
+** If xOpen() opens a file read-only then it sets *pOutFlags to
+** include [SQLITE_OPEN_READONLY]. Other bits in *pOutFlags may be set.
+**
+** ^(SQLite will also add one of the following flags to the xOpen()
+** call, depending on the object being opened:
+**
+** <ul>
+** <li> [SQLITE_OPEN_MAIN_DB]
+** <li> [SQLITE_OPEN_MAIN_JOURNAL]
+** <li> [SQLITE_OPEN_TEMP_DB]
+** <li> [SQLITE_OPEN_TEMP_JOURNAL]
+** <li> [SQLITE_OPEN_TRANSIENT_DB]
+** <li> [SQLITE_OPEN_SUBJOURNAL]
+** <li> [SQLITE_OPEN_SUPER_JOURNAL]
+** <li> [SQLITE_OPEN_WAL]
+** </ul>)^
+**
+** The file I/O implementation can use the object type flags to
+** change the way it deals with files. For example, an application
+** that does not care about crash recovery or rollback might make
+** the open of a journal file a no-op. Writes to this journal would
+** also be no-ops, and any attempt to read the journal would return
+** SQLITE_IOERR. Or the implementation might recognize that a database
+** file will be doing page-aligned sector reads and writes in a random
+** order and set up its I/O subsystem accordingly.
+**
+** SQLite might also add one of the following flags to the xOpen method:
+**
+** <ul>
+** <li> [SQLITE_OPEN_DELETEONCLOSE]
+** <li> [SQLITE_OPEN_EXCLUSIVE]
+** </ul>
+**
+** The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be
+** deleted when it is closed. ^The [SQLITE_OPEN_DELETEONCLOSE]
+** will be set for TEMP databases and their journals, transient
+** databases, and subjournals.
+**
+** ^The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction
+** with the [SQLITE_OPEN_CREATE] flag, which are both directly
+** analogous to the O_EXCL and O_CREAT flags of the POSIX open()
+** API. The SQLITE_OPEN_EXCLUSIVE flag, when paired with the
+** SQLITE_OPEN_CREATE, is used to indicate that file should always
+** be created, and that it is an error if it already exists.
+** It is <i>not</i> used to indicate the file should be opened
+** for exclusive access.
+**
+** ^At least szOsFile bytes of memory are allocated by SQLite
+** to hold the [sqlite3_file] structure passed as the third
+** argument to xOpen. The xOpen method does not have to
+** allocate the structure; it should just fill it in. Note that
+** the xOpen method must set the sqlite3_file.pMethods to either
+** a valid [sqlite3_io_methods] object or to NULL. xOpen must do
+** this even if the open fails. SQLite expects that the sqlite3_file.pMethods
+** element will be valid after xOpen returns regardless of the success
+** or failure of the xOpen call.
+**
+** [[sqlite3_vfs.xAccess]]
+** ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS]
+** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to
+** test whether a file is readable and writable, or [SQLITE_ACCESS_READ]
+** to test whether a file is at least readable. The SQLITE_ACCESS_READ
+** flag is never actually used and is not implemented in the built-in
+** VFSes of SQLite. The file is named by the second argument and can be a
+** directory. The xAccess method returns [SQLITE_OK] on success or some
+** non-zero error code if there is an I/O error or if the name of
+** the file given in the second argument is illegal. If SQLITE_OK
+** is returned, then non-zero or zero is written into *pResOut to indicate
+** whether or not the file is accessible.
+**
+** ^SQLite will always allocate at least mxPathname+1 bytes for the
+** output buffer xFullPathname. The exact size of the output buffer
+** is also passed as a parameter to both methods. If the output buffer
+** is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is
+** handled as a fatal error by SQLite, vfs implementations should endeavor
+** to prevent this by setting mxPathname to a sufficiently large value.
+**
+** The xRandomness(), xSleep(), xCurrentTime(), and xCurrentTimeInt64()
+** interfaces are not strictly a part of the filesystem, but they are
+** included in the VFS structure for completeness.
+** The xRandomness() function attempts to return nBytes bytes
+** of good-quality randomness into zOut. The return value is
+** the actual number of bytes of randomness obtained.
+** The xSleep() method causes the calling thread to sleep for at
+** least the number of microseconds given. ^The xCurrentTime()
+** method returns a Julian Day Number for the current date and time as
+** a floating point value.
+** ^The xCurrentTimeInt64() method returns, as an integer, the Julian
+** Day Number multiplied by 86400000 (the number of milliseconds in
+** a 24-hour day).
+** ^SQLite will use the xCurrentTimeInt64() method to get the current
+** date and time if that method is available (if iVersion is 2 or
+** greater and the function pointer is not NULL) and will fall back
+** to xCurrentTime() if xCurrentTimeInt64() is unavailable.
+**
+** ^The xSetSystemCall(), xGetSystemCall(), and xNestSystemCall() interfaces
+** are not used by the SQLite core. These optional interfaces are provided
+** by some VFSes to facilitate testing of the VFS code. By overriding
+** system calls with functions under its control, a test program can
+** simulate faults and error conditions that would otherwise be difficult
+** or impossible to induce. The set of system calls that can be overridden
+** varies from one VFS to another, and from one version of the same VFS to the
+** next. Applications that use these interfaces must be prepared for any
+** or all of these interfaces to be NULL or for their behavior to change
+** from one release to the next. Applications must not attempt to access
+** any of these methods if the iVersion of the VFS is less than 3.
+*/
+typedef struct sqlite3_vfs sqlite3_vfs;
+typedef void (*sqlite3_syscall_ptr)(void);
+struct sqlite3_vfs {
+ int iVersion; /* Structure version number (currently 3) */
+ int szOsFile; /* Size of subclassed sqlite3_file */
+ int mxPathname; /* Maximum file pathname length */
+ sqlite3_vfs *pNext; /* Next registered VFS */
+ const char *zName; /* Name of this virtual file system */
+ void *pAppData; /* Pointer to application-specific data */
+ int (*xOpen)(sqlite3_vfs*, sqlite3_filename zName, sqlite3_file*,
+ int flags, int *pOutFlags);
+ int (*xDelete)(sqlite3_vfs*, const char *zName, int syncDir);
+ int (*xAccess)(sqlite3_vfs*, const char *zName, int flags, int *pResOut);
+ int (*xFullPathname)(sqlite3_vfs*, const char *zName, int nOut, char *zOut);
+ void *(*xDlOpen)(sqlite3_vfs*, const char *zFilename);
+ void (*xDlError)(sqlite3_vfs*, int nByte, char *zErrMsg);
+ void (*(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol))(void);
+ void (*xDlClose)(sqlite3_vfs*, void*);
+ int (*xRandomness)(sqlite3_vfs*, int nByte, char *zOut);
+ int (*xSleep)(sqlite3_vfs*, int microseconds);
+ int (*xCurrentTime)(sqlite3_vfs*, double*);
+ int (*xGetLastError)(sqlite3_vfs*, int, char *);
+ /*
+ ** The methods above are in version 1 of the sqlite_vfs object
+ ** definition. Those that follow are added in version 2 or later
+ */
+ int (*xCurrentTimeInt64)(sqlite3_vfs*, sqlite3_int64*);
+ /*
+ ** The methods above are in versions 1 and 2 of the sqlite_vfs object.
+ ** Those below are for version 3 and greater.
+ */
+ int (*xSetSystemCall)(sqlite3_vfs*, const char *zName, sqlite3_syscall_ptr);
+ sqlite3_syscall_ptr (*xGetSystemCall)(sqlite3_vfs*, const char *zName);
+ const char *(*xNextSystemCall)(sqlite3_vfs*, const char *zName);
+ /*
+ ** The methods above are in versions 1 through 3 of the sqlite_vfs object.
+ ** New fields may be appended in future versions. The iVersion
+ ** value will increment whenever this happens.
+ */
+};
+
+/*
+** CAPI3REF: Flags for the xAccess VFS method
+**
+** These integer constants can be used as the third parameter to
+** the xAccess method of an [sqlite3_vfs] object. They determine
+** what kind of permissions the xAccess method is looking for.
+** With SQLITE_ACCESS_EXISTS, the xAccess method
+** simply checks whether the file exists.
+** With SQLITE_ACCESS_READWRITE, the xAccess method
+** checks whether the named directory is both readable and writable
+** (in other words, if files can be added, removed, and renamed within
+** the directory).
+** The SQLITE_ACCESS_READWRITE constant is currently used only by the
+** [temp_store_directory pragma], though this could change in a future
+** release of SQLite.
+** With SQLITE_ACCESS_READ, the xAccess method
+** checks whether the file is readable. The SQLITE_ACCESS_READ constant is
+** currently unused, though it might be used in a future release of
+** SQLite.
+*/
+#define SQLITE_ACCESS_EXISTS 0
+#define SQLITE_ACCESS_READWRITE 1 /* Used by PRAGMA temp_store_directory */
+#define SQLITE_ACCESS_READ 2 /* Unused */
+
+/*
+** CAPI3REF: Flags for the xShmLock VFS method
+**
+** These integer constants define the various locking operations
+** allowed by the xShmLock method of [sqlite3_io_methods]. The
+** following are the only legal combinations of flags to the
+** xShmLock method:
+**
+** <ul>
+** <li> SQLITE_SHM_LOCK | SQLITE_SHM_SHARED
+** <li> SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE
+** <li> SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED
+** <li> SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE
+** </ul>
+**
+** When unlocking, the same SHARED or EXCLUSIVE flag must be supplied as
+** was given on the corresponding lock.
+**
+** The xShmLock method can transition between unlocked and SHARED or
+** between unlocked and EXCLUSIVE. It cannot transition between SHARED
+** and EXCLUSIVE.
+*/
+#define SQLITE_SHM_UNLOCK 1
+#define SQLITE_SHM_LOCK 2
+#define SQLITE_SHM_SHARED 4
+#define SQLITE_SHM_EXCLUSIVE 8
+
+/*
+** CAPI3REF: Maximum xShmLock index
+**
+** The xShmLock method on [sqlite3_io_methods] may use values
+** between 0 and this upper bound as its "offset" argument.
+** The SQLite core will never attempt to acquire or release a
+** lock outside of this range
+*/
+#define SQLITE_SHM_NLOCK 8
+
+
+/*
+** CAPI3REF: Initialize The SQLite Library
+**
+** ^The sqlite3_initialize() routine initializes the
+** SQLite library. ^The sqlite3_shutdown() routine
+** deallocates any resources that were allocated by sqlite3_initialize().
+** These routines are designed to aid in process initialization and
+** shutdown on embedded systems. Workstation applications using
+** SQLite normally do not need to invoke either of these routines.
+**
+** A call to sqlite3_initialize() is an "effective" call if it is
+** the first time sqlite3_initialize() is invoked during the lifetime of
+** the process, or if it is the first time sqlite3_initialize() is invoked
+** following a call to sqlite3_shutdown(). ^(Only an effective call
+** of sqlite3_initialize() does any initialization. All other calls
+** are harmless no-ops.)^
+**
+** A call to sqlite3_shutdown() is an "effective" call if it is the first
+** call to sqlite3_shutdown() since the last sqlite3_initialize(). ^(Only
+** an effective call to sqlite3_shutdown() does any deinitialization.
+** All other valid calls to sqlite3_shutdown() are harmless no-ops.)^
+**
+** The sqlite3_initialize() interface is threadsafe, but sqlite3_shutdown()
+** is not. The sqlite3_shutdown() interface must only be called from a
+** single thread. All open [database connections] must be closed and all
+** other SQLite resources must be deallocated prior to invoking
+** sqlite3_shutdown().
+**
+** Among other things, ^sqlite3_initialize() will invoke
+** sqlite3_os_init(). Similarly, ^sqlite3_shutdown()
+** will invoke sqlite3_os_end().
+**
+** ^The sqlite3_initialize() routine returns [SQLITE_OK] on success.
+** ^If for some reason, sqlite3_initialize() is unable to initialize
+** the library (perhaps it is unable to allocate a needed resource such
+** as a mutex) it returns an [error code] other than [SQLITE_OK].
+**
+** ^The sqlite3_initialize() routine is called internally by many other
+** SQLite interfaces so that an application usually does not need to
+** invoke sqlite3_initialize() directly. For example, [sqlite3_open()]
+** calls sqlite3_initialize() so the SQLite library will be automatically
+** initialized when [sqlite3_open()] is called if it has not be initialized
+** already. ^However, if SQLite is compiled with the [SQLITE_OMIT_AUTOINIT]
+** compile-time option, then the automatic calls to sqlite3_initialize()
+** are omitted and the application must call sqlite3_initialize() directly
+** prior to using any other SQLite interface. For maximum portability,
+** it is recommended that applications always invoke sqlite3_initialize()
+** directly prior to using any other SQLite interface. Future releases
+** of SQLite may require this. In other words, the behavior exhibited
+** when SQLite is compiled with [SQLITE_OMIT_AUTOINIT] might become the
+** default behavior in some future release of SQLite.
+**
+** The sqlite3_os_init() routine does operating-system specific
+** initialization of the SQLite library. The sqlite3_os_end()
+** routine undoes the effect of sqlite3_os_init(). Typical tasks
+** performed by these routines include allocation or deallocation
+** of static resources, initialization of global variables,
+** setting up a default [sqlite3_vfs] module, or setting up
+** a default configuration using [sqlite3_config()].
+**
+** The application should never invoke either sqlite3_os_init()
+** or sqlite3_os_end() directly. The application should only invoke
+** sqlite3_initialize() and sqlite3_shutdown(). The sqlite3_os_init()
+** interface is called automatically by sqlite3_initialize() and
+** sqlite3_os_end() is called by sqlite3_shutdown(). Appropriate
+** implementations for sqlite3_os_init() and sqlite3_os_end()
+** are built into SQLite when it is compiled for Unix, Windows, or OS/2.
+** When [custom builds | built for other platforms]
+** (using the [SQLITE_OS_OTHER=1] compile-time
+** option) the application must supply a suitable implementation for
+** sqlite3_os_init() and sqlite3_os_end(). An application-supplied
+** implementation of sqlite3_os_init() or sqlite3_os_end()
+** must return [SQLITE_OK] on success and some other [error code] upon
+** failure.
+*/
+SQLITE_API int sqlite3_initialize(void);
+SQLITE_API int sqlite3_shutdown(void);
+SQLITE_API int sqlite3_os_init(void);
+SQLITE_API int sqlite3_os_end(void);
+
+/*
+** CAPI3REF: Configuring The SQLite Library
+**
+** The sqlite3_config() interface is used to make global configuration
+** changes to SQLite in order to tune SQLite to the specific needs of
+** the application. The default configuration is recommended for most
+** applications and so this routine is usually not necessary. It is
+** provided to support rare applications with unusual needs.
+**
+** <b>The sqlite3_config() interface is not threadsafe. The application
+** must ensure that no other SQLite interfaces are invoked by other
+** threads while sqlite3_config() is running.</b>
+**
+** The first argument to sqlite3_config() is an integer
+** [configuration option] that determines
+** what property of SQLite is to be configured. Subsequent arguments
+** vary depending on the [configuration option]
+** in the first argument.
+**
+** For most configuration options, the sqlite3_config() interface
+** may only be invoked prior to library initialization using
+** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
+** The exceptional configuration options that may be invoked at any time
+** are called "anytime configuration options".
+** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
+** [sqlite3_shutdown()] with a first argument that is not an anytime
+** configuration option, then the sqlite3_config() call will return SQLITE_MISUSE.
+** Note, however, that ^sqlite3_config() can be called as part of the
+** implementation of an application-defined [sqlite3_os_init()].
+**
+** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
+** ^If the option is unknown or SQLite is unable to set the option
+** then this routine returns a non-zero [error code].
+*/
+SQLITE_API int sqlite3_config(int, ...);
+
+/*
+** CAPI3REF: Configure database connections
+** METHOD: sqlite3
+**
+** The sqlite3_db_config() interface is used to make configuration
+** changes to a [database connection]. The interface is similar to
+** [sqlite3_config()] except that the changes apply to a single
+** [database connection] (specified in the first argument).
+**
+** The second argument to sqlite3_db_config(D,V,...) is the
+** [SQLITE_DBCONFIG_LOOKASIDE | configuration verb] - an integer code
+** that indicates what aspect of the [database connection] is being configured.
+** Subsequent arguments vary depending on the configuration verb.
+**
+** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if
+** the call is considered successful.
+*/
+SQLITE_API int sqlite3_db_config(sqlite3*, int op, ...);
+
+/*
+** CAPI3REF: Memory Allocation Routines
+**
+** An instance of this object defines the interface between SQLite
+** and low-level memory allocation routines.
+**
+** This object is used in only one place in the SQLite interface.
+** A pointer to an instance of this object is the argument to
+** [sqlite3_config()] when the configuration option is
+** [SQLITE_CONFIG_MALLOC] or [SQLITE_CONFIG_GETMALLOC].
+** By creating an instance of this object
+** and passing it to [sqlite3_config]([SQLITE_CONFIG_MALLOC])
+** during configuration, an application can specify an alternative
+** memory allocation subsystem for SQLite to use for all of its
+** dynamic memory needs.
+**
+** Note that SQLite comes with several [built-in memory allocators]
+** that are perfectly adequate for the overwhelming majority of applications
+** and that this object is only useful to a tiny minority of applications
+** with specialized memory allocation requirements. This object is
+** also used during testing of SQLite in order to specify an alternative
+** memory allocator that simulates memory out-of-memory conditions in
+** order to verify that SQLite recovers gracefully from such
+** conditions.
+**
+** The xMalloc, xRealloc, and xFree methods must work like the
+** malloc(), realloc() and free() functions from the standard C library.
+** ^SQLite guarantees that the second argument to
+** xRealloc is always a value returned by a prior call to xRoundup.
+**
+** xSize should return the allocated size of a memory allocation
+** previously obtained from xMalloc or xRealloc. The allocated size
+** is always at least as big as the requested size but may be larger.
+**
+** The xRoundup method returns what would be the allocated size of
+** a memory allocation given a particular requested size. Most memory
+** allocators round up memory allocations at least to the next multiple
+** of 8. Some allocators round up to a larger multiple or to a power of 2.
+** Every memory allocation request coming in through [sqlite3_malloc()]
+** or [sqlite3_realloc()] first calls xRoundup. If xRoundup returns 0,
+** that causes the corresponding memory allocation to fail.
+**
+** The xInit method initializes the memory allocator. For example,
+** it might allocate any required mutexes or initialize internal data
+** structures. The xShutdown method is invoked (indirectly) by
+** [sqlite3_shutdown()] and should deallocate any resources acquired
+** by xInit. The pAppData pointer is used as the only parameter to
+** xInit and xShutdown.
+**
+** SQLite holds the [SQLITE_MUTEX_STATIC_MAIN] mutex when it invokes
+** the xInit method, so the xInit method need not be threadsafe. The
+** xShutdown method is only called from [sqlite3_shutdown()] so it does
+** not need to be threadsafe either. For all other methods, SQLite
+** holds the [SQLITE_MUTEX_STATIC_MEM] mutex as long as the
+** [SQLITE_CONFIG_MEMSTATUS] configuration option is turned on (which
+** it is by default) and so the methods are automatically serialized.
+** However, if [SQLITE_CONFIG_MEMSTATUS] is disabled, then the other
+** methods must be threadsafe or else make their own arrangements for
+** serialization.
+**
+** SQLite will never invoke xInit() more than once without an intervening
+** call to xShutdown().
+*/
+typedef struct sqlite3_mem_methods sqlite3_mem_methods;
+struct sqlite3_mem_methods {
+ void *(*xMalloc)(int); /* Memory allocation function */
+ void (*xFree)(void*); /* Free a prior allocation */
+ void *(*xRealloc)(void*,int); /* Resize an allocation */
+ int (*xSize)(void*); /* Return the size of an allocation */
+ int (*xRoundup)(int); /* Round up request size to allocation size */
+ int (*xInit)(void*); /* Initialize the memory allocator */
+ void (*xShutdown)(void*); /* Deinitialize the memory allocator */
+ void *pAppData; /* Argument to xInit() and xShutdown() */
+};
+
+/*
+** CAPI3REF: Configuration Options
+** KEYWORDS: {configuration option}
+**
+** These constants are the available integer configuration options that
+** can be passed as the first argument to the [sqlite3_config()] interface.
+**
+** Most of the configuration options for sqlite3_config()
+** will only work if invoked prior to [sqlite3_initialize()] or after
+** [sqlite3_shutdown()]. The few exceptions to this rule are called
+** "anytime configuration options".
+** ^Calling [sqlite3_config()] with a first argument that is not an
+** anytime configuration option in between calls to [sqlite3_initialize()] and
+** [sqlite3_shutdown()] is a no-op that returns SQLITE_MISUSE.
+**
+** The set of anytime configuration options can change (by insertions
+** and/or deletions) from one release of SQLite to the next.
+** As of SQLite version 3.42.0, the complete set of anytime configuration
+** options is:
+** <ul>
+** <li> SQLITE_CONFIG_LOG
+** <li> SQLITE_CONFIG_PCACHE_HDRSZ
+** </ul>
+**
+** New configuration options may be added in future releases of SQLite.
+** Existing configuration options might be discontinued. Applications
+** should check the return code from [sqlite3_config()] to make sure that
+** the call worked. The [sqlite3_config()] interface will return a
+** non-zero [error code] if a discontinued or unsupported configuration option
+** is invoked.
+**
+** <dl>
+** [[SQLITE_CONFIG_SINGLETHREAD]] <dt>SQLITE_CONFIG_SINGLETHREAD</dt>
+** <dd>There are no arguments to this option. ^This option sets the
+** [threading mode] to Single-thread. In other words, it disables
+** all mutexing and puts SQLite into a mode where it can only be used
+** by a single thread. ^If SQLite is compiled with
+** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
+** it is not possible to change the [threading mode] from its default
+** value of Single-thread and so [sqlite3_config()] will return
+** [SQLITE_ERROR] if called with the SQLITE_CONFIG_SINGLETHREAD
+** configuration option.</dd>
+**
+** [[SQLITE_CONFIG_MULTITHREAD]] <dt>SQLITE_CONFIG_MULTITHREAD</dt>
+** <dd>There are no arguments to this option. ^This option sets the
+** [threading mode] to Multi-thread. In other words, it disables
+** mutexing on [database connection] and [prepared statement] objects.
+** The application is responsible for serializing access to
+** [database connections] and [prepared statements]. But other mutexes
+** are enabled so that SQLite will be safe to use in a multi-threaded
+** environment as long as no two threads attempt to use the same
+** [database connection] at the same time. ^If SQLite is compiled with
+** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
+** it is not possible to set the Multi-thread [threading mode] and
+** [sqlite3_config()] will return [SQLITE_ERROR] if called with the
+** SQLITE_CONFIG_MULTITHREAD configuration option.</dd>
+**
+** [[SQLITE_CONFIG_SERIALIZED]] <dt>SQLITE_CONFIG_SERIALIZED</dt>
+** <dd>There are no arguments to this option. ^This option sets the
+** [threading mode] to Serialized. In other words, this option enables
+** all mutexes including the recursive
+** mutexes on [database connection] and [prepared statement] objects.
+** In this mode (which is the default when SQLite is compiled with
+** [SQLITE_THREADSAFE=1]) the SQLite library will itself serialize access
+** to [database connections] and [prepared statements] so that the
+** application is free to use the same [database connection] or the
+** same [prepared statement] in different threads at the same time.
+** ^If SQLite is compiled with
+** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
+** it is not possible to set the Serialized [threading mode] and
+** [sqlite3_config()] will return [SQLITE_ERROR] if called with the
+** SQLITE_CONFIG_SERIALIZED configuration option.</dd>
+**
+** [[SQLITE_CONFIG_MALLOC]] <dt>SQLITE_CONFIG_MALLOC</dt>
+** <dd> ^(The SQLITE_CONFIG_MALLOC option takes a single argument which is
+** a pointer to an instance of the [sqlite3_mem_methods] structure.
+** The argument specifies
+** alternative low-level memory allocation routines to be used in place of
+** the memory allocation routines built into SQLite.)^ ^SQLite makes
+** its own private copy of the content of the [sqlite3_mem_methods] structure
+** before the [sqlite3_config()] call returns.</dd>
+**
+** [[SQLITE_CONFIG_GETMALLOC]] <dt>SQLITE_CONFIG_GETMALLOC</dt>
+** <dd> ^(The SQLITE_CONFIG_GETMALLOC option takes a single argument which
+** is a pointer to an instance of the [sqlite3_mem_methods] structure.
+** The [sqlite3_mem_methods]
+** structure is filled with the currently defined memory allocation routines.)^
+** This option can be used to overload the default memory allocation
+** routines with a wrapper that simulations memory allocation failure or
+** tracks memory usage, for example. </dd>
+**
+** [[SQLITE_CONFIG_SMALL_MALLOC]] <dt>SQLITE_CONFIG_SMALL_MALLOC</dt>
+** <dd> ^The SQLITE_CONFIG_SMALL_MALLOC option takes single argument of
+** type int, interpreted as a boolean, which if true provides a hint to
+** SQLite that it should avoid large memory allocations if possible.
+** SQLite will run faster if it is free to make large memory allocations,
+** but some application might prefer to run slower in exchange for
+** guarantees about memory fragmentation that are possible if large
+** allocations are avoided. This hint is normally off.
+** </dd>
+**
+** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt>
+** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int,
+** interpreted as a boolean, which enables or disables the collection of
+** memory allocation statistics. ^(When memory allocation statistics are
+** disabled, the following SQLite interfaces become non-operational:
+** <ul>
+** <li> [sqlite3_hard_heap_limit64()]
+** <li> [sqlite3_memory_used()]
+** <li> [sqlite3_memory_highwater()]
+** <li> [sqlite3_soft_heap_limit64()]
+** <li> [sqlite3_status64()]
+** </ul>)^
+** ^Memory allocation statistics are enabled by default unless SQLite is
+** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory
+** allocation statistics are disabled by default.
+** </dd>
+**
+** [[SQLITE_CONFIG_SCRATCH]] <dt>SQLITE_CONFIG_SCRATCH</dt>
+** <dd> The SQLITE_CONFIG_SCRATCH option is no longer used.
+** </dd>
+**
+** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt>
+** <dd> ^The SQLITE_CONFIG_PAGECACHE option specifies a memory pool
+** that SQLite can use for the database page cache with the default page
+** cache implementation.
+** This configuration option is a no-op if an application-defined page
+** cache implementation is loaded using the [SQLITE_CONFIG_PCACHE2].
+** ^There are three arguments to SQLITE_CONFIG_PAGECACHE: A pointer to
+** 8-byte aligned memory (pMem), the size of each page cache line (sz),
+** and the number of cache lines (N).
+** The sz argument should be the size of the largest database page
+** (a power of two between 512 and 65536) plus some extra bytes for each
+** page header. ^The number of extra bytes needed by the page header
+** can be determined using [SQLITE_CONFIG_PCACHE_HDRSZ].
+** ^It is harmless, apart from the wasted memory,
+** for the sz parameter to be larger than necessary. The pMem
+** argument must be either a NULL pointer or a pointer to an 8-byte
+** aligned block of memory of at least sz*N bytes, otherwise
+** subsequent behavior is undefined.
+** ^When pMem is not NULL, SQLite will strive to use the memory provided
+** to satisfy page cache needs, falling back to [sqlite3_malloc()] if
+** a page cache line is larger than sz bytes or if all of the pMem buffer
+** is exhausted.
+** ^If pMem is NULL and N is non-zero, then each database connection
+** does an initial bulk allocation for page cache memory
+** from [sqlite3_malloc()] sufficient for N cache lines if N is positive or
+** of -1024*N bytes if N is negative, . ^If additional
+** page cache memory is needed beyond what is provided by the initial
+** allocation, then SQLite goes to [sqlite3_malloc()] separately for each
+** additional cache line. </dd>
+**
+** [[SQLITE_CONFIG_HEAP]] <dt>SQLITE_CONFIG_HEAP</dt>
+** <dd> ^The SQLITE_CONFIG_HEAP option specifies a static memory buffer
+** that SQLite will use for all of its dynamic memory allocation needs
+** beyond those provided for by [SQLITE_CONFIG_PAGECACHE].
+** ^The SQLITE_CONFIG_HEAP option is only available if SQLite is compiled
+** with either [SQLITE_ENABLE_MEMSYS3] or [SQLITE_ENABLE_MEMSYS5] and returns
+** [SQLITE_ERROR] if invoked otherwise.
+** ^There are three arguments to SQLITE_CONFIG_HEAP:
+** An 8-byte aligned pointer to the memory,
+** the number of bytes in the memory buffer, and the minimum allocation size.
+** ^If the first pointer (the memory pointer) is NULL, then SQLite reverts
+** to using its default memory allocator (the system malloc() implementation),
+** undoing any prior invocation of [SQLITE_CONFIG_MALLOC]. ^If the
+** memory pointer is not NULL then the alternative memory
+** allocator is engaged to handle all of SQLites memory allocation needs.
+** The first pointer (the memory pointer) must be aligned to an 8-byte
+** boundary or subsequent behavior of SQLite will be undefined.
+** The minimum allocation size is capped at 2**12. Reasonable values
+** for the minimum allocation size are 2**5 through 2**8.</dd>
+**
+** [[SQLITE_CONFIG_MUTEX]] <dt>SQLITE_CONFIG_MUTEX</dt>
+** <dd> ^(The SQLITE_CONFIG_MUTEX option takes a single argument which is a
+** pointer to an instance of the [sqlite3_mutex_methods] structure.
+** The argument specifies alternative low-level mutex routines to be used
+** in place the mutex routines built into SQLite.)^ ^SQLite makes a copy of
+** the content of the [sqlite3_mutex_methods] structure before the call to
+** [sqlite3_config()] returns. ^If SQLite is compiled with
+** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
+** the entire mutexing subsystem is omitted from the build and hence calls to
+** [sqlite3_config()] with the SQLITE_CONFIG_MUTEX configuration option will
+** return [SQLITE_ERROR].</dd>
+**
+** [[SQLITE_CONFIG_GETMUTEX]] <dt>SQLITE_CONFIG_GETMUTEX</dt>
+** <dd> ^(The SQLITE_CONFIG_GETMUTEX option takes a single argument which
+** is a pointer to an instance of the [sqlite3_mutex_methods] structure. The
+** [sqlite3_mutex_methods]
+** structure is filled with the currently defined mutex routines.)^
+** This option can be used to overload the default mutex allocation
+** routines with a wrapper used to track mutex usage for performance
+** profiling or testing, for example. ^If SQLite is compiled with
+** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
+** the entire mutexing subsystem is omitted from the build and hence calls to
+** [sqlite3_config()] with the SQLITE_CONFIG_GETMUTEX configuration option will
+** return [SQLITE_ERROR].</dd>
+**
+** [[SQLITE_CONFIG_LOOKASIDE]] <dt>SQLITE_CONFIG_LOOKASIDE</dt>
+** <dd> ^(The SQLITE_CONFIG_LOOKASIDE option takes two arguments that determine
+** the default size of lookaside memory on each [database connection].
+** The first argument is the
+** size of each lookaside buffer slot and the second is the number of
+** slots allocated to each database connection.)^ ^(SQLITE_CONFIG_LOOKASIDE
+** sets the <i>default</i> lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE]
+** option to [sqlite3_db_config()] can be used to change the lookaside
+** configuration on individual connections.)^ </dd>
+**
+** [[SQLITE_CONFIG_PCACHE2]] <dt>SQLITE_CONFIG_PCACHE2</dt>
+** <dd> ^(The SQLITE_CONFIG_PCACHE2 option takes a single argument which is
+** a pointer to an [sqlite3_pcache_methods2] object. This object specifies
+** the interface to a custom page cache implementation.)^
+** ^SQLite makes a copy of the [sqlite3_pcache_methods2] object.</dd>
+**
+** [[SQLITE_CONFIG_GETPCACHE2]] <dt>SQLITE_CONFIG_GETPCACHE2</dt>
+** <dd> ^(The SQLITE_CONFIG_GETPCACHE2 option takes a single argument which
+** is a pointer to an [sqlite3_pcache_methods2] object. SQLite copies of
+** the current page cache implementation into that object.)^ </dd>
+**
+** [[SQLITE_CONFIG_LOG]] <dt>SQLITE_CONFIG_LOG</dt>
+** <dd> The SQLITE_CONFIG_LOG option is used to configure the SQLite
+** global [error log].
+** (^The SQLITE_CONFIG_LOG option takes two arguments: a pointer to a
+** function with a call signature of void(*)(void*,int,const char*),
+** and a pointer to void. ^If the function pointer is not NULL, it is
+** invoked by [sqlite3_log()] to process each logging event. ^If the
+** function pointer is NULL, the [sqlite3_log()] interface becomes a no-op.
+** ^The void pointer that is the second argument to SQLITE_CONFIG_LOG is
+** passed through as the first parameter to the application-defined logger
+** function whenever that function is invoked. ^The second parameter to
+** the logger function is a copy of the first parameter to the corresponding
+** [sqlite3_log()] call and is intended to be a [result code] or an
+** [extended result code]. ^The third parameter passed to the logger is
+** log message after formatting via [sqlite3_snprintf()].
+** The SQLite logging interface is not reentrant; the logger function
+** supplied by the application must not invoke any SQLite interface.
+** In a multi-threaded application, the application-defined logger
+** function must be threadsafe. </dd>
+**
+** [[SQLITE_CONFIG_URI]] <dt>SQLITE_CONFIG_URI
+** <dd>^(The SQLITE_CONFIG_URI option takes a single argument of type int.
+** If non-zero, then URI handling is globally enabled. If the parameter is zero,
+** then URI handling is globally disabled.)^ ^If URI handling is globally
+** enabled, all filenames passed to [sqlite3_open()], [sqlite3_open_v2()],
+** [sqlite3_open16()] or
+** specified as part of [ATTACH] commands are interpreted as URIs, regardless
+** of whether or not the [SQLITE_OPEN_URI] flag is set when the database
+** connection is opened. ^If it is globally disabled, filenames are
+** only interpreted as URIs if the SQLITE_OPEN_URI flag is set when the
+** database connection is opened. ^(By default, URI handling is globally
+** disabled. The default value may be changed by compiling with the
+** [SQLITE_USE_URI] symbol defined.)^
+**
+** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]] <dt>SQLITE_CONFIG_COVERING_INDEX_SCAN
+** <dd>^The SQLITE_CONFIG_COVERING_INDEX_SCAN option takes a single integer
+** argument which is interpreted as a boolean in order to enable or disable
+** the use of covering indices for full table scans in the query optimizer.
+** ^The default setting is determined
+** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is "on"
+** if that compile-time option is omitted.
+** The ability to disable the use of covering indices for full table scans
+** is because some incorrectly coded legacy applications might malfunction
+** when the optimization is enabled. Providing the ability to
+** disable the optimization allows the older, buggy application code to work
+** without change even with newer versions of SQLite.
+**
+** [[SQLITE_CONFIG_PCACHE]] [[SQLITE_CONFIG_GETPCACHE]]
+** <dt>SQLITE_CONFIG_PCACHE and SQLITE_CONFIG_GETPCACHE
+** <dd> These options are obsolete and should not be used by new code.
+** They are retained for backwards compatibility but are now no-ops.
+** </dd>
+**
+** [[SQLITE_CONFIG_SQLLOG]]
+** <dt>SQLITE_CONFIG_SQLLOG
+** <dd>This option is only available if sqlite is compiled with the
+** [SQLITE_ENABLE_SQLLOG] pre-processor macro defined. The first argument should
+** be a pointer to a function of type void(*)(void*,sqlite3*,const char*, int).
+** The second should be of type (void*). The callback is invoked by the library
+** in three separate circumstances, identified by the value passed as the
+** fourth parameter. If the fourth parameter is 0, then the database connection
+** passed as the second argument has just been opened. The third argument
+** points to a buffer containing the name of the main database file. If the
+** fourth parameter is 1, then the SQL statement that the third parameter
+** points to has just been executed. Or, if the fourth parameter is 2, then
+** the connection being passed as the second parameter is being closed. The
+** third parameter is passed NULL In this case. An example of using this
+** configuration option can be seen in the "test_sqllog.c" source file in
+** the canonical SQLite source tree.</dd>
+**
+** [[SQLITE_CONFIG_MMAP_SIZE]]
+** <dt>SQLITE_CONFIG_MMAP_SIZE
+** <dd>^SQLITE_CONFIG_MMAP_SIZE takes two 64-bit integer (sqlite3_int64) values
+** that are the default mmap size limit (the default setting for
+** [PRAGMA mmap_size]) and the maximum allowed mmap size limit.
+** ^The default setting can be overridden by each database connection using
+** either the [PRAGMA mmap_size] command, or by using the
+** [SQLITE_FCNTL_MMAP_SIZE] file control. ^(The maximum allowed mmap size
+** will be silently truncated if necessary so that it does not exceed the
+** compile-time maximum mmap size set by the
+** [SQLITE_MAX_MMAP_SIZE] compile-time option.)^
+** ^If either argument to this option is negative, then that argument is
+** changed to its compile-time default.
+**
+** [[SQLITE_CONFIG_WIN32_HEAPSIZE]]
+** <dt>SQLITE_CONFIG_WIN32_HEAPSIZE
+** <dd>^The SQLITE_CONFIG_WIN32_HEAPSIZE option is only available if SQLite is
+** compiled for Windows with the [SQLITE_WIN32_MALLOC] pre-processor macro
+** defined. ^SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit unsigned integer value
+** that specifies the maximum size of the created heap.
+**
+** [[SQLITE_CONFIG_PCACHE_HDRSZ]]
+** <dt>SQLITE_CONFIG_PCACHE_HDRSZ
+** <dd>^The SQLITE_CONFIG_PCACHE_HDRSZ option takes a single parameter which
+** is a pointer to an integer and writes into that integer the number of extra
+** bytes per page required for each page in [SQLITE_CONFIG_PAGECACHE].
+** The amount of extra space required can change depending on the compiler,
+** target platform, and SQLite version.
+**
+** [[SQLITE_CONFIG_PMASZ]]
+** <dt>SQLITE_CONFIG_PMASZ
+** <dd>^The SQLITE_CONFIG_PMASZ option takes a single parameter which
+** is an unsigned integer and sets the "Minimum PMA Size" for the multithreaded
+** sorter to that integer. The default minimum PMA Size is set by the
+** [SQLITE_SORTER_PMASZ] compile-time option. New threads are launched
+** to help with sort operations when multithreaded sorting
+** is enabled (using the [PRAGMA threads] command) and the amount of content
+** to be sorted exceeds the page size times the minimum of the
+** [PRAGMA cache_size] setting and this value.
+**
+** [[SQLITE_CONFIG_STMTJRNL_SPILL]]
+** <dt>SQLITE_CONFIG_STMTJRNL_SPILL
+** <dd>^The SQLITE_CONFIG_STMTJRNL_SPILL option takes a single parameter which
+** becomes the [statement journal] spill-to-disk threshold.
+** [Statement journals] are held in memory until their size (in bytes)
+** exceeds this threshold, at which point they are written to disk.
+** Or if the threshold is -1, statement journals are always held
+** exclusively in memory.
+** Since many statement journals never become large, setting the spill
+** threshold to a value such as 64KiB can greatly reduce the amount of
+** I/O required to support statement rollback.
+** The default value for this setting is controlled by the
+** [SQLITE_STMTJRNL_SPILL] compile-time option.
+**
+** [[SQLITE_CONFIG_SORTERREF_SIZE]]
+** <dt>SQLITE_CONFIG_SORTERREF_SIZE
+** <dd>The SQLITE_CONFIG_SORTERREF_SIZE option accepts a single parameter
+** of type (int) - the new value of the sorter-reference size threshold.
+** Usually, when SQLite uses an external sort to order records according
+** to an ORDER BY clause, all fields required by the caller are present in the
+** sorted records. However, if SQLite determines based on the declared type
+** of a table column that its values are likely to be very large - larger
+** than the configured sorter-reference size threshold - then a reference
+** is stored in each sorted record and the required column values loaded
+** from the database as records are returned in sorted order. The default
+** value for this option is to never use this optimization. Specifying a
+** negative value for this option restores the default behavior.
+** This option is only available if SQLite is compiled with the
+** [SQLITE_ENABLE_SORTER_REFERENCES] compile-time option.
+**
+** [[SQLITE_CONFIG_MEMDB_MAXSIZE]]
+** <dt>SQLITE_CONFIG_MEMDB_MAXSIZE
+** <dd>The SQLITE_CONFIG_MEMDB_MAXSIZE option accepts a single parameter
+** [sqlite3_int64] parameter which is the default maximum size for an in-memory
+** database created using [sqlite3_deserialize()]. This default maximum
+** size can be adjusted up or down for individual databases using the
+** [SQLITE_FCNTL_SIZE_LIMIT] [sqlite3_file_control|file-control]. If this
+** configuration setting is never used, then the default maximum is determined
+** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that
+** compile-time option is not set, then the default maximum is 1073741824.
+**
+** [[SQLITE_CONFIG_ROWID_IN_VIEW]]
+** <dt>SQLITE_CONFIG_ROWID_IN_VIEW
+** <dd>The SQLITE_CONFIG_ROWID_IN_VIEW option enables or disables the ability
+** for VIEWs to have a ROWID. The capability can only be enabled if SQLite is
+** compiled with -DSQLITE_ALLOW_ROWID_IN_VIEW, in which case the capability
+** defaults to on. This configuration option queries the current setting or
+** changes the setting to off or on. The argument is a pointer to an integer.
+** If that integer initially holds a value of 1, then the ability for VIEWs to
+** have ROWIDs is activated. If the integer initially holds zero, then the
+** ability is deactivated. Any other initial value for the integer leaves the
+** setting unchanged. After changes, if any, the integer is written with
+** a 1 or 0, if the ability for VIEWs to have ROWIDs is on or off. If SQLite
+** is compiled without -DSQLITE_ALLOW_ROWID_IN_VIEW (which is the usual and
+** recommended case) then the integer is always filled with zero, regardless
+** if its initial value.
+** </dl>
+*/
+#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
+#define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
+#define SQLITE_CONFIG_SERIALIZED 3 /* nil */
+#define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */
+#define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */
+#define SQLITE_CONFIG_SCRATCH 6 /* No longer used */
+#define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */
+#define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */
+#define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */
+#define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */
+#define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */
+/* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */
+#define SQLITE_CONFIG_LOOKASIDE 13 /* int int */
+#define SQLITE_CONFIG_PCACHE 14 /* no-op */
+#define SQLITE_CONFIG_GETPCACHE 15 /* no-op */
+#define SQLITE_CONFIG_LOG 16 /* xFunc, void* */
+#define SQLITE_CONFIG_URI 17 /* int */
+#define SQLITE_CONFIG_PCACHE2 18 /* sqlite3_pcache_methods2* */
+#define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */
+#define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */
+#define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
+#define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */
+#define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
+#define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
+#define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */
+#define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */
+#define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
+#define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */
+#define SQLITE_CONFIG_MEMDB_MAXSIZE 29 /* sqlite3_int64 */
+#define SQLITE_CONFIG_ROWID_IN_VIEW 30 /* int* */
+
+/*
+** CAPI3REF: Database Connection Configuration Options
+**
+** These constants are the available integer configuration options that
+** can be passed as the second parameter to the [sqlite3_db_config()] interface.
+**
+** The [sqlite3_db_config()] interface is a var-args functions. It takes a
+** variable number of parameters, though always at least two. The number of
+** parameters passed into sqlite3_db_config() depends on which of these
+** constants is given as the second parameter. This documentation page
+** refers to parameters beyond the second as "arguments". Thus, when this
+** page says "the N-th argument" it means "the N-th parameter past the
+** configuration option" or "the (N+2)-th parameter to sqlite3_db_config()".
+**
+** New configuration options may be added in future releases of SQLite.
+** Existing configuration options might be discontinued. Applications
+** should check the return code from [sqlite3_db_config()] to make sure that
+** the call worked. ^The [sqlite3_db_config()] interface will return a
+** non-zero [error code] if a discontinued or unsupported configuration option
+** is invoked.
+**
+** <dl>
+** [[SQLITE_DBCONFIG_LOOKASIDE]]
+** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt>
+** <dd> The SQLITE_DBCONFIG_LOOKASIDE option is used to adjust the
+** configuration of the lookaside memory allocator within a database
+** connection.
+** The arguments to the SQLITE_DBCONFIG_LOOKASIDE option are <i>not</i>
+** in the [DBCONFIG arguments|usual format].
+** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two,
+** so that a call to [sqlite3_db_config()] that uses SQLITE_DBCONFIG_LOOKASIDE
+** should have a total of five parameters.
+** ^The first argument (the third parameter to [sqlite3_db_config()] is a
+** pointer to a memory buffer to use for lookaside memory.
+** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb
+** may be NULL in which case SQLite will allocate the
+** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the
+** size of each lookaside buffer slot. ^The third argument is the number of
+** slots. The size of the buffer in the first argument must be greater than
+** or equal to the product of the second and third arguments. The buffer
+** must be aligned to an 8-byte boundary. ^If the second argument to
+** SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally
+** rounded down to the next smaller multiple of 8. ^(The lookaside memory
+** configuration for a database connection can only be changed when that
+** connection is not currently using lookaside memory, or in other words
+** when the "current value" returned by
+** [sqlite3_db_status](D,[SQLITE_DBSTATUS_LOOKASIDE_USED],...) is zero.
+** Any attempt to change the lookaside memory configuration when lookaside
+** memory is in use leaves the configuration unchanged and returns
+** [SQLITE_BUSY].)^</dd>
+**
+** [[SQLITE_DBCONFIG_ENABLE_FKEY]]
+** <dt>SQLITE_DBCONFIG_ENABLE_FKEY</dt>
+** <dd> ^This option is used to enable or disable the enforcement of
+** [foreign key constraints]. This is the same setting that is
+** enabled or disabled by the [PRAGMA foreign_keys] statement.
+** The first argument is an integer which is 0 to disable FK enforcement,
+** positive to enable FK enforcement or negative to leave FK enforcement
+** unchanged. The second parameter is a pointer to an integer into which
+** is written 0 or 1 to indicate whether FK enforcement is off or on
+** following this call. The second parameter may be a NULL pointer, in
+** which case the FK enforcement setting is not reported back. </dd>
+**
+** [[SQLITE_DBCONFIG_ENABLE_TRIGGER]]
+** <dt>SQLITE_DBCONFIG_ENABLE_TRIGGER</dt>
+** <dd> ^This option is used to enable or disable [CREATE TRIGGER | triggers].
+** There should be two additional arguments.
+** The first argument is an integer which is 0 to disable triggers,
+** positive to enable triggers or negative to leave the setting unchanged.
+** The second parameter is a pointer to an integer into which
+** is written 0 or 1 to indicate whether triggers are disabled or enabled
+** following this call. The second parameter may be a NULL pointer, in
+** which case the trigger setting is not reported back.
+**
+** <p>Originally this option disabled all triggers. ^(However, since
+** SQLite version 3.35.0, TEMP triggers are still allowed even if
+** this option is off. So, in other words, this option now only disables
+** triggers in the main database schema or in the schemas of [ATTACH]-ed
+** databases.)^ </dd>
+**
+** [[SQLITE_DBCONFIG_ENABLE_VIEW]]
+** <dt>SQLITE_DBCONFIG_ENABLE_VIEW</dt>
+** <dd> ^This option is used to enable or disable [CREATE VIEW | views].
+** There must be two additional arguments.
+** The first argument is an integer which is 0 to disable views,
+** positive to enable views or negative to leave the setting unchanged.
+** The second parameter is a pointer to an integer into which
+** is written 0 or 1 to indicate whether views are disabled or enabled
+** following this call. The second parameter may be a NULL pointer, in
+** which case the view setting is not reported back.
+**
+** <p>Originally this option disabled all views. ^(However, since
+** SQLite version 3.35.0, TEMP views are still allowed even if
+** this option is off. So, in other words, this option now only disables
+** views in the main database schema or in the schemas of ATTACH-ed
+** databases.)^ </dd>
+**
+** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]]
+** <dt>SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER</dt>
+** <dd> ^This option is used to enable or disable the
+** [fts3_tokenizer()] function which is part of the
+** [FTS3] full-text search engine extension.
+** There must be two additional arguments.
+** The first argument is an integer which is 0 to disable fts3_tokenizer() or
+** positive to enable fts3_tokenizer() or negative to leave the setting
+** unchanged.
+** The second parameter is a pointer to an integer into which
+** is written 0 or 1 to indicate whether fts3_tokenizer is disabled or enabled
+** following this call. The second parameter may be a NULL pointer, in
+** which case the new setting is not reported back. </dd>
+**
+** [[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION]]
+** <dt>SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION</dt>
+** <dd> ^This option is used to enable or disable the [sqlite3_load_extension()]
+** interface independently of the [load_extension()] SQL function.
+** The [sqlite3_enable_load_extension()] API enables or disables both the
+** C-API [sqlite3_load_extension()] and the SQL function [load_extension()].
+** There must be two additional arguments.
+** When the first argument to this interface is 1, then only the C-API is
+** enabled and the SQL function remains disabled. If the first argument to
+** this interface is 0, then both the C-API and the SQL function are disabled.
+** If the first argument is -1, then no changes are made to state of either the
+** C-API or the SQL function.
+** The second parameter is a pointer to an integer into which
+** is written 0 or 1 to indicate whether [sqlite3_load_extension()] interface
+** is disabled or enabled following this call. The second parameter may
+** be a NULL pointer, in which case the new setting is not reported back.
+** </dd>
+**
+** [[SQLITE_DBCONFIG_MAINDBNAME]] <dt>SQLITE_DBCONFIG_MAINDBNAME</dt>
+** <dd> ^This option is used to change the name of the "main" database
+** schema. This option does not follow the
+** [DBCONFIG arguments|usual SQLITE_DBCONFIG argument format].
+** This option takes exactly one additional argument so that the
+** [sqlite3_db_config()] call has a total of three parameters. The
+** extra argument must be a pointer to a constant UTF8 string which
+** will become the new schema name in place of "main". ^SQLite does
+** not make a copy of the new main schema name string, so the application
+** must ensure that the argument passed into SQLITE_DBCONFIG MAINDBNAME
+** is unchanged until after the database connection closes.
+** </dd>
+**
+** [[SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE]]
+** <dt>SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE</dt>
+** <dd> Usually, when a database in [WAL mode] is closed or detached from a
+** database handle, SQLite checks if if there are other connections to the
+** same database, and if there are no other database connection (if the
+** connection being closed is the last open connection to the database),
+** then SQLite performs a [checkpoint] before closing the connection and
+** deletes the WAL file. The SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE option can
+** be used to override that behavior. The first argument passed to this
+** operation (the third parameter to [sqlite3_db_config()]) is an integer
+** which is positive to disable checkpoints-on-close, or zero (the default)
+** to enable them, and negative to leave the setting unchanged.
+** The second argument (the fourth parameter) is a pointer to an integer
+** into which is written 0 or 1 to indicate whether checkpoints-on-close
+** have been disabled - 0 if they are not disabled, 1 if they are.
+** </dd>
+**
+** [[SQLITE_DBCONFIG_ENABLE_QPSG]] <dt>SQLITE_DBCONFIG_ENABLE_QPSG</dt>
+** <dd>^(The SQLITE_DBCONFIG_ENABLE_QPSG option activates or deactivates
+** the [query planner stability guarantee] (QPSG). When the QPSG is active,
+** a single SQL query statement will always use the same algorithm regardless
+** of values of [bound parameters].)^ The QPSG disables some query optimizations
+** that look at the values of bound parameters, which can make some queries
+** slower. But the QPSG has the advantage of more predictable behavior. With
+** the QPSG active, SQLite will always use the same query plan in the field as
+** was used during testing in the lab.
+** The first argument to this setting is an integer which is 0 to disable
+** the QPSG, positive to enable QPSG, or negative to leave the setting
+** unchanged. The second parameter is a pointer to an integer into which
+** is written 0 or 1 to indicate whether the QPSG is disabled or enabled
+** following this call.
+** </dd>
+**
+** [[SQLITE_DBCONFIG_TRIGGER_EQP]] <dt>SQLITE_DBCONFIG_TRIGGER_EQP</dt>
+** <dd> By default, the output of EXPLAIN QUERY PLAN commands does not
+** include output for any operations performed by trigger programs. This
+** option is used to set or clear (the default) a flag that governs this
+** behavior. The first parameter passed to this operation is an integer -
+** positive to enable output for trigger programs, or zero to disable it,
+** or negative to leave the setting unchanged.
+** The second parameter is a pointer to an integer into which is written
+** 0 or 1 to indicate whether output-for-triggers has been disabled - 0 if
+** it is not disabled, 1 if it is.
+** </dd>
+**
+** [[SQLITE_DBCONFIG_RESET_DATABASE]] <dt>SQLITE_DBCONFIG_RESET_DATABASE</dt>
+** <dd> Set the SQLITE_DBCONFIG_RESET_DATABASE flag and then run
+** [VACUUM] in order to reset a database back to an empty database
+** with no schema and no content. The following process works even for
+** a badly corrupted database file:
+** <ol>
+** <li> If the database connection is newly opened, make sure it has read the
+** database schema by preparing then discarding some query against the
+** database, or calling sqlite3_table_column_metadata(), ignoring any
+** errors. This step is only necessary if the application desires to keep
+** the database in WAL mode after the reset if it was in WAL mode before
+** the reset.
+** <li> sqlite3_db_config(db, SQLITE_DBCONFIG_RESET_DATABASE, 1, 0);
+** <li> [sqlite3_exec](db, "[VACUUM]", 0, 0, 0);
+** <li> sqlite3_db_config(db, SQLITE_DBCONFIG_RESET_DATABASE, 0, 0);
+** </ol>
+** Because resetting a database is destructive and irreversible, the
+** process requires the use of this obscure API and multiple steps to
+** help ensure that it does not happen by accident. Because this
+** feature must be capable of resetting corrupt databases, and
+** shutting down virtual tables may require access to that corrupt
+** storage, the library must abandon any installed virtual tables
+** without calling their xDestroy() methods.
+**
+** [[SQLITE_DBCONFIG_DEFENSIVE]] <dt>SQLITE_DBCONFIG_DEFENSIVE</dt>
+** <dd>The SQLITE_DBCONFIG_DEFENSIVE option activates or deactivates the
+** "defensive" flag for a database connection. When the defensive
+** flag is enabled, language features that allow ordinary SQL to
+** deliberately corrupt the database file are disabled. The disabled
+** features include but are not limited to the following:
+** <ul>
+** <li> The [PRAGMA writable_schema=ON] statement.
+** <li> The [PRAGMA journal_mode=OFF] statement.
+** <li> The [PRAGMA schema_version=N] statement.
+** <li> Writes to the [sqlite_dbpage] virtual table.
+** <li> Direct writes to [shadow tables].
+** </ul>
+** </dd>
+**
+** [[SQLITE_DBCONFIG_WRITABLE_SCHEMA]] <dt>SQLITE_DBCONFIG_WRITABLE_SCHEMA</dt>
+** <dd>The SQLITE_DBCONFIG_WRITABLE_SCHEMA option activates or deactivates the
+** "writable_schema" flag. This has the same effect and is logically equivalent
+** to setting [PRAGMA writable_schema=ON] or [PRAGMA writable_schema=OFF].
+** The first argument to this setting is an integer which is 0 to disable
+** the writable_schema, positive to enable writable_schema, or negative to
+** leave the setting unchanged. The second parameter is a pointer to an
+** integer into which is written 0 or 1 to indicate whether the writable_schema
+** is enabled or disabled following this call.
+** </dd>
+**
+** [[SQLITE_DBCONFIG_LEGACY_ALTER_TABLE]]
+** <dt>SQLITE_DBCONFIG_LEGACY_ALTER_TABLE</dt>
+** <dd>The SQLITE_DBCONFIG_LEGACY_ALTER_TABLE option activates or deactivates
+** the legacy behavior of the [ALTER TABLE RENAME] command such it
+** behaves as it did prior to [version 3.24.0] (2018-06-04). See the
+** "Compatibility Notice" on the [ALTER TABLE RENAME documentation] for
+** additional information. This feature can also be turned on and off
+** using the [PRAGMA legacy_alter_table] statement.
+** </dd>
+**
+** [[SQLITE_DBCONFIG_DQS_DML]]
+** <dt>SQLITE_DBCONFIG_DQS_DML</dt>
+** <dd>The SQLITE_DBCONFIG_DQS_DML option activates or deactivates
+** the legacy [double-quoted string literal] misfeature for DML statements
+** only, that is DELETE, INSERT, SELECT, and UPDATE statements. The
+** default value of this setting is determined by the [-DSQLITE_DQS]
+** compile-time option.
+** </dd>
+**
+** [[SQLITE_DBCONFIG_DQS_DDL]]
+** <dt>SQLITE_DBCONFIG_DQS_DDL</dt>
+** <dd>The SQLITE_DBCONFIG_DQS option activates or deactivates
+** the legacy [double-quoted string literal] misfeature for DDL statements,
+** such as CREATE TABLE and CREATE INDEX. The
+** default value of this setting is determined by the [-DSQLITE_DQS]
+** compile-time option.
+** </dd>
+**
+** [[SQLITE_DBCONFIG_TRUSTED_SCHEMA]]
+** <dt>SQLITE_DBCONFIG_TRUSTED_SCHEMA</dt>
+** <dd>The SQLITE_DBCONFIG_TRUSTED_SCHEMA option tells SQLite to
+** assume that database schemas are untainted by malicious content.
+** When the SQLITE_DBCONFIG_TRUSTED_SCHEMA option is disabled, SQLite
+** takes additional defensive steps to protect the application from harm
+** including:
+** <ul>
+** <li> Prohibit the use of SQL functions inside triggers, views,
+** CHECK constraints, DEFAULT clauses, expression indexes,
+** partial indexes, or generated columns
+** unless those functions are tagged with [SQLITE_INNOCUOUS].
+** <li> Prohibit the use of virtual tables inside of triggers or views
+** unless those virtual tables are tagged with [SQLITE_VTAB_INNOCUOUS].
+** </ul>
+** This setting defaults to "on" for legacy compatibility, however
+** all applications are advised to turn it off if possible. This setting
+** can also be controlled using the [PRAGMA trusted_schema] statement.
+** </dd>
+**
+** [[SQLITE_DBCONFIG_LEGACY_FILE_FORMAT]]
+** <dt>SQLITE_DBCONFIG_LEGACY_FILE_FORMAT</dt>
+** <dd>The SQLITE_DBCONFIG_LEGACY_FILE_FORMAT option activates or deactivates
+** the legacy file format flag. When activated, this flag causes all newly
+** created database file to have a schema format version number (the 4-byte
+** integer found at offset 44 into the database header) of 1. This in turn
+** means that the resulting database file will be readable and writable by
+** any SQLite version back to 3.0.0 ([dateof:3.0.0]). Without this setting,
+** newly created databases are generally not understandable by SQLite versions
+** prior to 3.3.0 ([dateof:3.3.0]). As these words are written, there
+** is now scarcely any need to generate database files that are compatible
+** all the way back to version 3.0.0, and so this setting is of little
+** practical use, but is provided so that SQLite can continue to claim the
+** ability to generate new database files that are compatible with version
+** 3.0.0.
+** <p>Note that when the SQLITE_DBCONFIG_LEGACY_FILE_FORMAT setting is on,
+** the [VACUUM] command will fail with an obscure error when attempting to
+** process a table with generated columns and a descending index. This is
+** not considered a bug since SQLite versions 3.3.0 and earlier do not support
+** either generated columns or descending indexes.
+** </dd>
+**
+** [[SQLITE_DBCONFIG_STMT_SCANSTATUS]]
+** <dt>SQLITE_DBCONFIG_STMT_SCANSTATUS</dt>
+** <dd>The SQLITE_DBCONFIG_STMT_SCANSTATUS option is only useful in
+** SQLITE_ENABLE_STMT_SCANSTATUS builds. In this case, it sets or clears
+** a flag that enables collection of the sqlite3_stmt_scanstatus_v2()
+** statistics. For statistics to be collected, the flag must be set on
+** the database handle both when the SQL statement is prepared and when it
+** is stepped. The flag is set (collection of statistics is enabled)
+** by default. <p>This option takes two arguments: an integer and a pointer to
+** an integer.. The first argument is 1, 0, or -1 to enable, disable, or
+** leave unchanged the statement scanstatus option. If the second argument
+** is not NULL, then the value of the statement scanstatus setting after
+** processing the first argument is written into the integer that the second
+** argument points to.
+** </dd>
+**
+** [[SQLITE_DBCONFIG_REVERSE_SCANORDER]]
+** <dt>SQLITE_DBCONFIG_REVERSE_SCANORDER</dt>
+** <dd>The SQLITE_DBCONFIG_REVERSE_SCANORDER option changes the default order
+** in which tables and indexes are scanned so that the scans start at the end
+** and work toward the beginning rather than starting at the beginning and
+** working toward the end. Setting SQLITE_DBCONFIG_REVERSE_SCANORDER is the
+** same as setting [PRAGMA reverse_unordered_selects]. <p>This option takes
+** two arguments which are an integer and a pointer to an integer. The first
+** argument is 1, 0, or -1 to enable, disable, or leave unchanged the
+** reverse scan order flag, respectively. If the second argument is not NULL,
+** then 0 or 1 is written into the integer that the second argument points to
+** depending on if the reverse scan order flag is set after processing the
+** first argument.
+** </dd>
+**
+** [[SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE]]
+** <dt>SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE</dt>
+** <dd>The SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE option enables or disables
+** the ability of the [ATTACH DATABASE] SQL command to create a new database
+** file if the database filed named in the ATTACH command does not already
+** exist. This ability of ATTACH to create a new database is enabled by
+** default. Applications can disable or reenable the ability for ATTACH to
+** create new database files using this DBCONFIG option.<p>
+** This option takes two arguments which are an integer and a pointer
+** to an integer. The first argument is 1, 0, or -1 to enable, disable, or
+** leave unchanged the attach-create flag, respectively. If the second
+** argument is not NULL, then 0 or 1 is written into the integer that the
+** second argument points to depending on if the attach-create flag is set
+** after processing the first argument.
+** </dd>
+**
+** [[SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE]]
+** <dt>SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE</dt>
+** <dd>The SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE option enables or disables the
+** ability of the [ATTACH DATABASE] SQL command to open a database for writing.
+** This capability is enabled by default. Applications can disable or
+** reenable this capability using the current DBCONFIG option. If the
+** the this capability is disabled, the [ATTACH] command will still work,
+** but the database will be opened read-only. If this option is disabled,
+** then the ability to create a new database using [ATTACH] is also disabled,
+** regardless of the value of the [SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE]
+** option.<p>
+** This option takes two arguments which are an integer and a pointer
+** to an integer. The first argument is 1, 0, or -1 to enable, disable, or
+** leave unchanged the ability to ATTACH another database for writing,
+** respectively. If the second argument is not NULL, then 0 or 1 is written
+** into the integer to which the second argument points, depending on whether
+** the ability to ATTACH a read/write database is enabled or disabled
+** after processing the first argument.
+** </dd>
+**
+** [[SQLITE_DBCONFIG_ENABLE_COMMENTS]]
+** <dt>SQLITE_DBCONFIG_ENABLE_COMMENTS</dt>
+** <dd>The SQLITE_DBCONFIG_ENABLE_COMMENTS option enables or disables the
+** ability to include comments in SQL text. Comments are enabled by default.
+** An application can disable or reenable comments in SQL text using this
+** DBCONFIG option.<p>
+** This option takes two arguments which are an integer and a pointer
+** to an integer. The first argument is 1, 0, or -1 to enable, disable, or
+** leave unchanged the ability to use comments in SQL text,
+** respectively. If the second argument is not NULL, then 0 or 1 is written
+** into the integer that the second argument points to depending on if
+** comments are allowed in SQL text after processing the first argument.
+** </dd>
+**
+** </dl>
+**
+** [[DBCONFIG arguments]] <h3>Arguments To SQLITE_DBCONFIG Options</h3>
+**
+** <p>Most of the SQLITE_DBCONFIG options take two arguments, so that the
+** overall call to [sqlite3_db_config()] has a total of four parameters.
+** The first argument (the third parameter to sqlite3_db_config()) is a integer.
+** The second argument is a pointer to an integer. If the first argument is 1,
+** then the option becomes enabled. If the first integer argument is 0, then the
+** option is disabled. If the first argument is -1, then the option setting
+** is unchanged. The second argument, the pointer to an integer, may be NULL.
+** If the second argument is not NULL, then a value of 0 or 1 is written into
+** the integer to which the second argument points, depending on whether the
+** setting is disabled or enabled after applying any changes specified by
+** the first argument.
+**
+** <p>While most SQLITE_DBCONFIG options use the argument format
+** described in the previous paragraph, the [SQLITE_DBCONFIG_MAINDBNAME]
+** and [SQLITE_DBCONFIG_LOOKASIDE] options are different. See the
+** documentation of those exceptional options for details.
+*/
+#define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
+#define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
+#define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */
+#define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */
+#define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */
+#define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */
+#define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006 /* int int* */
+#define SQLITE_DBCONFIG_ENABLE_QPSG 1007 /* int int* */
+#define SQLITE_DBCONFIG_TRIGGER_EQP 1008 /* int int* */
+#define SQLITE_DBCONFIG_RESET_DATABASE 1009 /* int int* */
+#define SQLITE_DBCONFIG_DEFENSIVE 1010 /* int int* */
+#define SQLITE_DBCONFIG_WRITABLE_SCHEMA 1011 /* int int* */
+#define SQLITE_DBCONFIG_LEGACY_ALTER_TABLE 1012 /* int int* */
+#define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */
+#define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */
+#define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */
+#define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016 /* int int* */
+#define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 /* int int* */
+#define SQLITE_DBCONFIG_STMT_SCANSTATUS 1018 /* int int* */
+#define SQLITE_DBCONFIG_REVERSE_SCANORDER 1019 /* int int* */
+#define SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE 1020 /* int int* */
+#define SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE 1021 /* int int* */
+#define SQLITE_DBCONFIG_ENABLE_COMMENTS 1022 /* int int* */
+#define SQLITE_DBCONFIG_MAX 1022 /* Largest DBCONFIG */
+
+/*
+** CAPI3REF: Enable Or Disable Extended Result Codes
+** METHOD: sqlite3
+**
+** ^The sqlite3_extended_result_codes() routine enables or disables the
+** [extended result codes] feature of SQLite. ^The extended result
+** codes are disabled by default for historical compatibility.
+*/
+SQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff);
+
+/*
+** CAPI3REF: Last Insert Rowid
+** METHOD: sqlite3
+**
+** ^Each entry in most SQLite tables (except for [WITHOUT ROWID] tables)
+** has a unique 64-bit signed
+** integer key called the [ROWID | "rowid"]. ^The rowid is always available
+** as an undeclared column named ROWID, OID, or _ROWID_ as long as those
+** names are not also used by explicitly declared columns. ^If
+** the table has a column of type [INTEGER PRIMARY KEY] then that column
+** is another alias for the rowid.
+**
+** ^The sqlite3_last_insert_rowid(D) interface usually returns the [rowid] of
+** the most recent successful [INSERT] into a rowid table or [virtual table]
+** on database connection D. ^Inserts into [WITHOUT ROWID] tables are not
+** recorded. ^If no successful [INSERT]s into rowid tables have ever occurred
+** on the database connection D, then sqlite3_last_insert_rowid(D) returns
+** zero.
+**
+** As well as being set automatically as rows are inserted into database
+** tables, the value returned by this function may be set explicitly by
+** [sqlite3_set_last_insert_rowid()]
+**
+** Some virtual table implementations may INSERT rows into rowid tables as
+** part of committing a transaction (e.g. to flush data accumulated in memory
+** to disk). In this case subsequent calls to this function return the rowid
+** associated with these internal INSERT operations, which leads to
+** unintuitive results. Virtual table implementations that do write to rowid
+** tables in this way can avoid this problem by restoring the original
+** rowid value using [sqlite3_set_last_insert_rowid()] before returning
+** control to the user.
+**
+** ^(If an [INSERT] occurs within a trigger then this routine will
+** return the [rowid] of the inserted row as long as the trigger is
+** running. Once the trigger program ends, the value returned
+** by this routine reverts to what it was before the trigger was fired.)^
+**
+** ^An [INSERT] that fails due to a constraint violation is not a
+** successful [INSERT] and does not change the value returned by this
+** routine. ^Thus INSERT OR FAIL, INSERT OR IGNORE, INSERT OR ROLLBACK,
+** and INSERT OR ABORT make no changes to the return value of this
+** routine when their insertion fails. ^(When INSERT OR REPLACE
+** encounters a constraint violation, it does not fail. The
+** INSERT continues to completion after deleting rows that caused
+** the constraint problem so INSERT OR REPLACE will always change
+** the return value of this interface.)^
+**
+** ^For the purposes of this routine, an [INSERT] is considered to
+** be successful even if it is subsequently rolled back.
+**
+** This function is accessible to SQL statements via the
+** [last_insert_rowid() SQL function].
+**
+** If a separate thread performs a new [INSERT] on the same
+** database connection while the [sqlite3_last_insert_rowid()]
+** function is running and thus changes the last insert [rowid],
+** then the value returned by [sqlite3_last_insert_rowid()] is
+** unpredictable and might not equal either the old or the new
+** last insert [rowid].
+*/
+SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);
+
+/*
+** CAPI3REF: Set the Last Insert Rowid value.
+** METHOD: sqlite3
+**
+** The sqlite3_set_last_insert_rowid(D, R) method allows the application to
+** set the value returned by calling sqlite3_last_insert_rowid(D) to R
+** without inserting a row into the database.
+*/
+SQLITE_API void sqlite3_set_last_insert_rowid(sqlite3*,sqlite3_int64);
+
+/*
+** CAPI3REF: Count The Number Of Rows Modified
+** METHOD: sqlite3
+**
+** ^These functions return the number of rows modified, inserted or
+** deleted by the most recently completed INSERT, UPDATE or DELETE
+** statement on the database connection specified by the only parameter.
+** The two functions are identical except for the type of the return value
+** and that if the number of rows modified by the most recent INSERT, UPDATE,
+** or DELETE is greater than the maximum value supported by type "int", then
+** the return value of sqlite3_changes() is undefined. ^Executing any other
+** type of SQL statement does not modify the value returned by these functions.
+** For the purposes of this interface, a CREATE TABLE AS SELECT statement
+** does not count as an INSERT, UPDATE or DELETE statement and hence the rows
+** added to the new table by the CREATE TABLE AS SELECT statement are not
+** counted.
+**
+** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are
+** considered - auxiliary changes caused by [CREATE TRIGGER | triggers],
+** [foreign key actions] or [REPLACE] constraint resolution are not counted.
+**
+** Changes to a view that are intercepted by
+** [INSTEAD OF trigger | INSTEAD OF triggers] are not counted. ^The value
+** returned by sqlite3_changes() immediately after an INSERT, UPDATE or
+** DELETE statement run on a view is always zero. Only changes made to real
+** tables are counted.
+**
+** Things are more complicated if the sqlite3_changes() function is
+** executed while a trigger program is running. This may happen if the
+** program uses the [changes() SQL function], or if some other callback
+** function invokes sqlite3_changes() directly. Essentially:
+**
+** <ul>
+** <li> ^(Before entering a trigger program the value returned by
+** sqlite3_changes() function is saved. After the trigger program
+** has finished, the original value is restored.)^
+**
+** <li> ^(Within a trigger program each INSERT, UPDATE and DELETE
+** statement sets the value returned by sqlite3_changes()
+** upon completion as normal. Of course, this value will not include
+** any changes performed by sub-triggers, as the sqlite3_changes()
+** value will be saved and restored after each sub-trigger has run.)^
+** </ul>
+**
+** ^This means that if the changes() SQL function (or similar) is used
+** by the first INSERT, UPDATE or DELETE statement within a trigger, it
+** returns the value as set when the calling statement began executing.
+** ^If it is used by the second or subsequent such statement within a trigger
+** program, the value returned reflects the number of rows modified by the
+** previous INSERT, UPDATE or DELETE statement within the same trigger.
+**
+** If a separate thread makes changes on the same database connection
+** while [sqlite3_changes()] is running then the value returned
+** is unpredictable and not meaningful.
+**
+** See also:
+** <ul>
+** <li> the [sqlite3_total_changes()] interface
+** <li> the [count_changes pragma]
+** <li> the [changes() SQL function]
+** <li> the [data_version pragma]
+** </ul>
+*/
+SQLITE_API int sqlite3_changes(sqlite3*);
+SQLITE_API sqlite3_int64 sqlite3_changes64(sqlite3*);
+
+/*
+** CAPI3REF: Total Number Of Rows Modified
+** METHOD: sqlite3
+**
+** ^These functions return the total number of rows inserted, modified or
+** deleted by all [INSERT], [UPDATE] or [DELETE] statements completed
+** since the database connection was opened, including those executed as
+** part of trigger programs. The two functions are identical except for the
+** type of the return value and that if the number of rows modified by the
+** connection exceeds the maximum value supported by type "int", then
+** the return value of sqlite3_total_changes() is undefined. ^Executing
+** any other type of SQL statement does not affect the value returned by
+** sqlite3_total_changes().
+**
+** ^Changes made as part of [foreign key actions] are included in the
+** count, but those made as part of REPLACE constraint resolution are
+** not. ^Changes to a view that are intercepted by INSTEAD OF triggers
+** are not counted.
+**
+** The [sqlite3_total_changes(D)] interface only reports the number
+** of rows that changed due to SQL statement run against database
+** connection D. Any changes by other database connections are ignored.
+** To detect changes against a database file from other database
+** connections use the [PRAGMA data_version] command or the
+** [SQLITE_FCNTL_DATA_VERSION] [file control].
+**
+** If a separate thread makes changes on the same database connection
+** while [sqlite3_total_changes()] is running then the value
+** returned is unpredictable and not meaningful.
+**
+** See also:
+** <ul>
+** <li> the [sqlite3_changes()] interface
+** <li> the [count_changes pragma]
+** <li> the [changes() SQL function]
+** <li> the [data_version pragma]
+** <li> the [SQLITE_FCNTL_DATA_VERSION] [file control]
+** </ul>
+*/
+SQLITE_API int sqlite3_total_changes(sqlite3*);
+SQLITE_API sqlite3_int64 sqlite3_total_changes64(sqlite3*);
+
+/*
+** CAPI3REF: Interrupt A Long-Running Query
+** METHOD: sqlite3
+**
+** ^This function causes any pending database operation to abort and
+** return at its earliest opportunity. This routine is typically
+** called in response to a user action such as pressing "Cancel"
+** or Ctrl-C where the user wants a long query operation to halt
+** immediately.
+**
+** ^It is safe to call this routine from a thread different from the
+** thread that is currently running the database operation. But it
+** is not safe to call this routine with a [database connection] that
+** is closed or might close before sqlite3_interrupt() returns.
+**
+** ^If an SQL operation is very nearly finished at the time when
+** sqlite3_interrupt() is called, then it might not have an opportunity
+** to be interrupted and might continue to completion.
+**
+** ^An SQL operation that is interrupted will return [SQLITE_INTERRUPT].
+** ^If the interrupted SQL operation is an INSERT, UPDATE, or DELETE
+** that is inside an explicit transaction, then the entire transaction
+** will be rolled back automatically.
+**
+** ^The sqlite3_interrupt(D) call is in effect until all currently running
+** SQL statements on [database connection] D complete. ^Any new SQL statements
+** that are started after the sqlite3_interrupt() call and before the
+** running statement count reaches zero are interrupted as if they had been
+** running prior to the sqlite3_interrupt() call. ^New SQL statements
+** that are started after the running statement count reaches zero are
+** not effected by the sqlite3_interrupt().
+** ^A call to sqlite3_interrupt(D) that occurs when there are no running
+** SQL statements is a no-op and has no effect on SQL statements
+** that are started after the sqlite3_interrupt() call returns.
+**
+** ^The [sqlite3_is_interrupted(D)] interface can be used to determine whether
+** or not an interrupt is currently in effect for [database connection] D.
+** It returns 1 if an interrupt is currently in effect, or 0 otherwise.
+*/
+SQLITE_API void sqlite3_interrupt(sqlite3*);
+SQLITE_API int sqlite3_is_interrupted(sqlite3*);
+
+/*
+** CAPI3REF: Determine If An SQL Statement Is Complete
+**
+** These routines are useful during command-line input to determine if the
+** currently entered text seems to form a complete SQL statement or
+** if additional input is needed before sending the text into
+** SQLite for parsing. ^These routines return 1 if the input string
+** appears to be a complete SQL statement. ^A statement is judged to be
+** complete if it ends with a semicolon token and is not a prefix of a
+** well-formed CREATE TRIGGER statement. ^Semicolons that are embedded within
+** string literals or quoted identifier names or comments are not
+** independent tokens (they are part of the token in which they are
+** embedded) and thus do not count as a statement terminator. ^Whitespace
+** and comments that follow the final semicolon are ignored.
+**
+** ^These routines return 0 if the statement is incomplete. ^If a
+** memory allocation fails, then SQLITE_NOMEM is returned.
+**
+** ^These routines do not parse the SQL statements thus
+** will not detect syntactically incorrect SQL.
+**
+** ^(If SQLite has not been initialized using [sqlite3_initialize()] prior
+** to invoking sqlite3_complete16() then sqlite3_initialize() is invoked
+** automatically by sqlite3_complete16(). If that initialization fails,
+** then the return value from sqlite3_complete16() will be non-zero
+** regardless of whether or not the input SQL is complete.)^
+**
+** The input to [sqlite3_complete()] must be a zero-terminated
+** UTF-8 string.
+**
+** The input to [sqlite3_complete16()] must be a zero-terminated
+** UTF-16 string in native byte order.
+*/
+SQLITE_API int sqlite3_complete(const char *sql);
+SQLITE_API int sqlite3_complete16(const void *sql);
+
+/*
+** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
+** KEYWORDS: {busy-handler callback} {busy handler}
+** METHOD: sqlite3
+**
+** ^The sqlite3_busy_handler(D,X,P) routine sets a callback function X
+** that might be invoked with argument P whenever
+** an attempt is made to access a database table associated with
+** [database connection] D when another thread
+** or process has the table locked.
+** The sqlite3_busy_handler() interface is used to implement
+** [sqlite3_busy_timeout()] and [PRAGMA busy_timeout].
+**
+** ^If the busy callback is NULL, then [SQLITE_BUSY]
+** is returned immediately upon encountering the lock. ^If the busy callback
+** is not NULL, then the callback might be invoked with two arguments.
+**
+** ^The first argument to the busy handler is a copy of the void* pointer which
+** is the third argument to sqlite3_busy_handler(). ^The second argument to
+** the busy handler callback is the number of times that the busy handler has
+** been invoked previously for the same locking event. ^If the
+** busy callback returns 0, then no additional attempts are made to
+** access the database and [SQLITE_BUSY] is returned
+** to the application.
+** ^If the callback returns non-zero, then another attempt
+** is made to access the database and the cycle repeats.
+**
+** The presence of a busy handler does not guarantee that it will be invoked
+** when there is lock contention. ^If SQLite determines that invoking the busy
+** handler could result in a deadlock, it will go ahead and return [SQLITE_BUSY]
+** to the application instead of invoking the
+** busy handler.
+** Consider a scenario where one process is holding a read lock that
+** it is trying to promote to a reserved lock and
+** a second process is holding a reserved lock that it is trying
+** to promote to an exclusive lock. The first process cannot proceed
+** because it is blocked by the second and the second process cannot
+** proceed because it is blocked by the first. If both processes
+** invoke the busy handlers, neither will make any progress. Therefore,
+** SQLite returns [SQLITE_BUSY] for the first process, hoping that this
+** will induce the first process to release its read lock and allow
+** the second process to proceed.
+**
+** ^The default busy callback is NULL.
+**
+** ^(There can only be a single busy handler defined for each
+** [database connection]. Setting a new busy handler clears any
+** previously set handler.)^ ^Note that calling [sqlite3_busy_timeout()]
+** or evaluating [PRAGMA busy_timeout=N] will change the
+** busy handler and thus clear any previously set busy handler.
+**
+** The busy callback should not take any actions which modify the
+** database connection that invoked the busy handler. In other words,
+** the busy handler is not reentrant. Any such actions
+** result in undefined behavior.
+**
+** A busy handler must not close the database connection
+** or [prepared statement] that invoked the busy handler.
+*/
+SQLITE_API int sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*);
+
+/*
+** CAPI3REF: Set A Busy Timeout
+** METHOD: sqlite3
+**
+** ^This routine sets a [sqlite3_busy_handler | busy handler] that sleeps
+** for a specified amount of time when a table is locked. ^The handler
+** will sleep multiple times until at least "ms" milliseconds of sleeping
+** have accumulated. ^After at least "ms" milliseconds of sleeping,
+** the handler returns 0 which causes [sqlite3_step()] to return
+** [SQLITE_BUSY].
+**
+** ^Calling this routine with an argument less than or equal to zero
+** turns off all busy handlers.
+**
+** ^(There can only be a single busy handler for a particular
+** [database connection] at any given moment. If another busy handler
+** was defined (using [sqlite3_busy_handler()]) prior to calling
+** this routine, that other busy handler is cleared.)^
+**
+** See also: [PRAGMA busy_timeout]
+*/
+SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
+
+/*
+** CAPI3REF: Convenience Routines For Running Queries
+** METHOD: sqlite3
+**
+** This is a legacy interface that is preserved for backwards compatibility.
+** Use of this interface is not recommended.
+**
+** Definition: A <b>result table</b> is memory data structure created by the
+** [sqlite3_get_table()] interface. A result table records the
+** complete query results from one or more queries.
+**
+** The table conceptually has a number of rows and columns. But
+** these numbers are not part of the result table itself. These
+** numbers are obtained separately. Let N be the number of rows
+** and M be the number of columns.
+**
+** A result table is an array of pointers to zero-terminated UTF-8 strings.
+** There are (N+1)*M elements in the array. The first M pointers point
+** to zero-terminated strings that contain the names of the columns.
+** The remaining entries all point to query results. NULL values result
+** in NULL pointers. All other values are in their UTF-8 zero-terminated
+** string representation as returned by [sqlite3_column_text()].
+**
+** A result table might consist of one or more memory allocations.
+** It is not safe to pass a result table directly to [sqlite3_free()].
+** A result table should be deallocated using [sqlite3_free_table()].
+**
+** ^(As an example of the result table format, suppose a query result
+** is as follows:
+**
+** <blockquote><pre>
+** Name | Age
+** -----------------------
+** Alice | 43
+** Bob | 28
+** Cindy | 21
+** </pre></blockquote>
+**
+** There are two columns (M==2) and three rows (N==3). Thus the
+** result table has 8 entries. Suppose the result table is stored
+** in an array named azResult. Then azResult holds this content:
+**
+** <blockquote><pre>
+** azResult[0] = "Name";
+** azResult[1] = "Age";
+** azResult[2] = "Alice";
+** azResult[3] = "43";
+** azResult[4] = "Bob";
+** azResult[5] = "28";
+** azResult[6] = "Cindy";
+** azResult[7] = "21";
+** </pre></blockquote>)^
+**
+** ^The sqlite3_get_table() function evaluates one or more
+** semicolon-separated SQL statements in the zero-terminated UTF-8
+** string of its 2nd parameter and returns a result table to the
+** pointer given in its 3rd parameter.
+**
+** After the application has finished with the result from sqlite3_get_table(),
+** it must pass the result table pointer to sqlite3_free_table() in order to
+** release the memory that was malloced. Because of the way the
+** [sqlite3_malloc()] happens within sqlite3_get_table(), the calling
+** function must not try to call [sqlite3_free()] directly. Only
+** [sqlite3_free_table()] is able to release the memory properly and safely.
+**
+** The sqlite3_get_table() interface is implemented as a wrapper around
+** [sqlite3_exec()]. The sqlite3_get_table() routine does not have access
+** to any internal data structures of SQLite. It uses only the public
+** interface defined here. As a consequence, errors that occur in the
+** wrapper layer outside of the internal [sqlite3_exec()] call are not
+** reflected in subsequent calls to [sqlite3_errcode()] or
+** [sqlite3_errmsg()].
+*/
+SQLITE_API int sqlite3_get_table(
+ sqlite3 *db, /* An open database */
+ const char *zSql, /* SQL to be evaluated */
+ char ***pazResult, /* Results of the query */
+ int *pnRow, /* Number of result rows written here */
+ int *pnColumn, /* Number of result columns written here */
+ char **pzErrmsg /* Error msg written here */
+);
+SQLITE_API void sqlite3_free_table(char **result);
+
+/*
+** CAPI3REF: Formatted String Printing Functions
+**
+** These routines are work-alikes of the "printf()" family of functions
+** from the standard C library.
+** These routines understand most of the common formatting options from
+** the standard library printf()
+** plus some additional non-standard formats ([%q], [%Q], [%w], and [%z]).
+** See the [built-in printf()] documentation for details.
+**
+** ^The sqlite3_mprintf() and sqlite3_vmprintf() routines write their
+** results into memory obtained from [sqlite3_malloc64()].
+** The strings returned by these two routines should be
+** released by [sqlite3_free()]. ^Both routines return a
+** NULL pointer if [sqlite3_malloc64()] is unable to allocate enough
+** memory to hold the resulting string.
+**
+** ^(The sqlite3_snprintf() routine is similar to "snprintf()" from
+** the standard C library. The result is written into the
+** buffer supplied as the second parameter whose size is given by
+** the first parameter. Note that the order of the
+** first two parameters is reversed from snprintf().)^ This is an
+** historical accident that cannot be fixed without breaking
+** backwards compatibility. ^(Note also that sqlite3_snprintf()
+** returns a pointer to its buffer instead of the number of
+** characters actually written into the buffer.)^ We admit that
+** the number of characters written would be a more useful return
+** value but we cannot change the implementation of sqlite3_snprintf()
+** now without breaking compatibility.
+**
+** ^As long as the buffer size is greater than zero, sqlite3_snprintf()
+** guarantees that the buffer is always zero-terminated. ^The first
+** parameter "n" is the total size of the buffer, including space for
+** the zero terminator. So the longest string that can be completely
+** written will be n-1 characters.
+**
+** ^The sqlite3_vsnprintf() routine is a varargs version of sqlite3_snprintf().
+**
+** See also: [built-in printf()], [printf() SQL function]
+*/
+SQLITE_API char *sqlite3_mprintf(const char*,...);
+SQLITE_API char *sqlite3_vmprintf(const char*, va_list);
+SQLITE_API char *sqlite3_snprintf(int,char*,const char*, ...);
+SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);
+
+/*
+** CAPI3REF: Memory Allocation Subsystem
+**
+** The SQLite core uses these three routines for all of its own
+** internal memory allocation needs. "Core" in the previous sentence
+** does not include operating-system specific [VFS] implementation. The
+** Windows VFS uses native malloc() and free() for some operations.
+**
+** ^The sqlite3_malloc() routine returns a pointer to a block
+** of memory at least N bytes in length, where N is the parameter.
+** ^If sqlite3_malloc() is unable to obtain sufficient free
+** memory, it returns a NULL pointer. ^If the parameter N to
+** sqlite3_malloc() is zero or negative then sqlite3_malloc() returns
+** a NULL pointer.
+**
+** ^The sqlite3_malloc64(N) routine works just like
+** sqlite3_malloc(N) except that N is an unsigned 64-bit integer instead
+** of a signed 32-bit integer.
+**
+** ^Calling sqlite3_free() with a pointer previously returned
+** by sqlite3_malloc() or sqlite3_realloc() releases that memory so
+** that it might be reused. ^The sqlite3_free() routine is
+** a no-op if is called with a NULL pointer. Passing a NULL pointer
+** to sqlite3_free() is harmless. After being freed, memory
+** should neither be read nor written. Even reading previously freed
+** memory might result in a segmentation fault or other severe error.
+** Memory corruption, a segmentation fault, or other severe error
+** might result if sqlite3_free() is called with a non-NULL pointer that
+** was not obtained from sqlite3_malloc() or sqlite3_realloc().
+**
+** ^The sqlite3_realloc(X,N) interface attempts to resize a
+** prior memory allocation X to be at least N bytes.
+** ^If the X parameter to sqlite3_realloc(X,N)
+** is a NULL pointer then its behavior is identical to calling
+** sqlite3_malloc(N).
+** ^If the N parameter to sqlite3_realloc(X,N) is zero or
+** negative then the behavior is exactly the same as calling
+** sqlite3_free(X).
+** ^sqlite3_realloc(X,N) returns a pointer to a memory allocation
+** of at least N bytes in size or NULL if insufficient memory is available.
+** ^If M is the size of the prior allocation, then min(N,M) bytes
+** of the prior allocation are copied into the beginning of buffer returned
+** by sqlite3_realloc(X,N) and the prior allocation is freed.
+** ^If sqlite3_realloc(X,N) returns NULL and N is positive, then the
+** prior allocation is not freed.
+**
+** ^The sqlite3_realloc64(X,N) interfaces works the same as
+** sqlite3_realloc(X,N) except that N is a 64-bit unsigned integer instead
+** of a 32-bit signed integer.
+**
+** ^If X is a memory allocation previously obtained from sqlite3_malloc(),
+** sqlite3_malloc64(), sqlite3_realloc(), or sqlite3_realloc64(), then
+** sqlite3_msize(X) returns the size of that memory allocation in bytes.
+** ^The value returned by sqlite3_msize(X) might be larger than the number
+** of bytes requested when X was allocated. ^If X is a NULL pointer then
+** sqlite3_msize(X) returns zero. If X points to something that is not
+** the beginning of memory allocation, or if it points to a formerly
+** valid memory allocation that has now been freed, then the behavior
+** of sqlite3_msize(X) is undefined and possibly harmful.
+**
+** ^The memory returned by sqlite3_malloc(), sqlite3_realloc(),
+** sqlite3_malloc64(), and sqlite3_realloc64()
+** is always aligned to at least an 8 byte boundary, or to a
+** 4 byte boundary if the [SQLITE_4_BYTE_ALIGNED_MALLOC] compile-time
+** option is used.
+**
+** The pointer arguments to [sqlite3_free()] and [sqlite3_realloc()]
+** must be either NULL or else pointers obtained from a prior
+** invocation of [sqlite3_malloc()] or [sqlite3_realloc()] that have
+** not yet been released.
+**
+** The application must not read or write any part of
+** a block of memory after it has been released using
+** [sqlite3_free()] or [sqlite3_realloc()].
+*/
+SQLITE_API void *sqlite3_malloc(int);
+SQLITE_API void *sqlite3_malloc64(sqlite3_uint64);
+SQLITE_API void *sqlite3_realloc(void*, int);
+SQLITE_API void *sqlite3_realloc64(void*, sqlite3_uint64);
+SQLITE_API void sqlite3_free(void*);
+SQLITE_API sqlite3_uint64 sqlite3_msize(void*);
+
+/*
+** CAPI3REF: Memory Allocator Statistics
+**
+** SQLite provides these two interfaces for reporting on the status
+** of the [sqlite3_malloc()], [sqlite3_free()], and [sqlite3_realloc()]
+** routines, which form the built-in memory allocation subsystem.
+**
+** ^The [sqlite3_memory_used()] routine returns the number of bytes
+** of memory currently outstanding (malloced but not freed).
+** ^The [sqlite3_memory_highwater()] routine returns the maximum
+** value of [sqlite3_memory_used()] since the high-water mark
+** was last reset. ^The values returned by [sqlite3_memory_used()] and
+** [sqlite3_memory_highwater()] include any overhead
+** added by SQLite in its implementation of [sqlite3_malloc()],
+** but not overhead added by the any underlying system library
+** routines that [sqlite3_malloc()] may call.
+**
+** ^The memory high-water mark is reset to the current value of
+** [sqlite3_memory_used()] if and only if the parameter to
+** [sqlite3_memory_highwater()] is true. ^The value returned
+** by [sqlite3_memory_highwater(1)] is the high-water mark
+** prior to the reset.
+*/
+SQLITE_API sqlite3_int64 sqlite3_memory_used(void);
+SQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag);
+
+/*
+** CAPI3REF: Pseudo-Random Number Generator
+**
+** SQLite contains a high-quality pseudo-random number generator (PRNG) used to
+** select random [ROWID | ROWIDs] when inserting new records into a table that
+** already uses the largest possible [ROWID]. The PRNG is also used for
+** the built-in random() and randomblob() SQL functions. This interface allows
+** applications to access the same PRNG for other purposes.
+**
+** ^A call to this routine stores N bytes of randomness into buffer P.
+** ^The P parameter can be a NULL pointer.
+**
+** ^If this routine has not been previously called or if the previous
+** call had N less than one or a NULL pointer for P, then the PRNG is
+** seeded using randomness obtained from the xRandomness method of
+** the default [sqlite3_vfs] object.
+** ^If the previous call to this routine had an N of 1 or more and a
+** non-NULL P then the pseudo-randomness is generated
+** internally and without recourse to the [sqlite3_vfs] xRandomness
+** method.
+*/
+SQLITE_API void sqlite3_randomness(int N, void *P);
+
+/*
+** CAPI3REF: Compile-Time Authorization Callbacks
+** METHOD: sqlite3
+** KEYWORDS: {authorizer callback}
+**
+** ^This routine registers an authorizer callback with a particular
+** [database connection], supplied in the first argument.
+** ^The authorizer callback is invoked as SQL statements are being compiled
+** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()],
+** [sqlite3_prepare_v3()], [sqlite3_prepare16()], [sqlite3_prepare16_v2()],
+** and [sqlite3_prepare16_v3()]. ^At various
+** points during the compilation process, as logic is being created
+** to perform various actions, the authorizer callback is invoked to
+** see if those actions are allowed. ^The authorizer callback should
+** return [SQLITE_OK] to allow the action, [SQLITE_IGNORE] to disallow the
+** specific action but allow the SQL statement to continue to be
+** compiled, or [SQLITE_DENY] to cause the entire SQL statement to be
+** rejected with an error. ^If the authorizer callback returns
+** any value other than [SQLITE_IGNORE], [SQLITE_OK], or [SQLITE_DENY]
+** then the [sqlite3_prepare_v2()] or equivalent call that triggered
+** the authorizer will fail with an error message.
+**
+** When the callback returns [SQLITE_OK], that means the operation
+** requested is ok. ^When the callback returns [SQLITE_DENY], the
+** [sqlite3_prepare_v2()] or equivalent call that triggered the
+** authorizer will fail with an error message explaining that
+** access is denied.
+**
+** ^The first parameter to the authorizer callback is a copy of the third
+** parameter to the sqlite3_set_authorizer() interface. ^The second parameter
+** to the callback is an integer [SQLITE_COPY | action code] that specifies
+** the particular action to be authorized. ^The third through sixth parameters
+** to the callback are either NULL pointers or zero-terminated strings
+** that contain additional details about the action to be authorized.
+** Applications must always be prepared to encounter a NULL pointer in any
+** of the third through the sixth parameters of the authorization callback.
+**
+** ^If the action code is [SQLITE_READ]
+** and the callback returns [SQLITE_IGNORE] then the
+** [prepared statement] statement is constructed to substitute
+** a NULL value in place of the table column that would have
+** been read if [SQLITE_OK] had been returned. The [SQLITE_IGNORE]
+** return can be used to deny an untrusted user access to individual
+** columns of a table.
+** ^When a table is referenced by a [SELECT] but no column values are
+** extracted from that table (for example in a query like
+** "SELECT count(*) FROM tab") then the [SQLITE_READ] authorizer callback
+** is invoked once for that table with a column name that is an empty string.
+** ^If the action code is [SQLITE_DELETE] and the callback returns
+** [SQLITE_IGNORE] then the [DELETE] operation proceeds but the
+** [truncate optimization] is disabled and all rows are deleted individually.
+**
+** An authorizer is used when [sqlite3_prepare | preparing]
+** SQL statements from an untrusted source, to ensure that the SQL statements
+** do not try to access data they are not allowed to see, or that they do not
+** try to execute malicious statements that damage the database. For
+** example, an application may allow a user to enter arbitrary
+** SQL queries for evaluation by a database. But the application does
+** not want the user to be able to make arbitrary changes to the
+** database. An authorizer could then be put in place while the
+** user-entered SQL is being [sqlite3_prepare | prepared] that
+** disallows everything except [SELECT] statements.
+**
+** Applications that need to process SQL from untrusted sources
+** might also consider lowering resource limits using [sqlite3_limit()]
+** and limiting database size using the [max_page_count] [PRAGMA]
+** in addition to using an authorizer.
+**
+** ^(Only a single authorizer can be in place on a database connection
+** at a time. Each call to sqlite3_set_authorizer overrides the
+** previous call.)^ ^Disable the authorizer by installing a NULL callback.
+** The authorizer is disabled by default.
+**
+** The authorizer callback must not do anything that will modify
+** the database connection that invoked the authorizer callback.
+** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
+** database connections for the meaning of "modify" in this paragraph.
+**
+** ^When [sqlite3_prepare_v2()] is used to prepare a statement, the
+** statement might be re-prepared during [sqlite3_step()] due to a
+** schema change. Hence, the application should ensure that the
+** correct authorizer callback remains in place during the [sqlite3_step()].
+**
+** ^Note that the authorizer callback is invoked only during
+** [sqlite3_prepare()] or its variants. Authorization is not
+** performed during statement evaluation in [sqlite3_step()], unless
+** as stated in the previous paragraph, sqlite3_step() invokes
+** sqlite3_prepare_v2() to reprepare a statement after a schema change.
+*/
+SQLITE_API int sqlite3_set_authorizer(
+ sqlite3*,
+ int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
+ void *pUserData
+);
+
+/*
+** CAPI3REF: Authorizer Return Codes
+**
+** The [sqlite3_set_authorizer | authorizer callback function] must
+** return either [SQLITE_OK] or one of these two constants in order
+** to signal SQLite whether or not the action is permitted. See the
+** [sqlite3_set_authorizer | authorizer documentation] for additional
+** information.
+**
+** Note that SQLITE_IGNORE is also used as a [conflict resolution mode]
+** returned from the [sqlite3_vtab_on_conflict()] interface.
+*/
+#define SQLITE_DENY 1 /* Abort the SQL statement with an error */
+#define SQLITE_IGNORE 2 /* Don't allow access, but don't generate an error */
+
+/*
+** CAPI3REF: Authorizer Action Codes
+**
+** The [sqlite3_set_authorizer()] interface registers a callback function
+** that is invoked to authorize certain SQL statement actions. The
+** second parameter to the callback is an integer code that specifies
+** what action is being authorized. These are the integer action codes that
+** the authorizer callback may be passed.
+**
+** These action code values signify what kind of operation is to be
+** authorized. The 3rd and 4th parameters to the authorization
+** callback function will be parameters or NULL depending on which of these
+** codes is used as the second parameter. ^(The 5th parameter to the
+** authorizer callback is the name of the database ("main", "temp",
+** etc.) if applicable.)^ ^The 6th parameter to the authorizer callback
+** is the name of the inner-most trigger or view that is responsible for
+** the access attempt or NULL if this access attempt is directly from
+** top-level SQL code.
+*/
+/******************************************* 3rd ************ 4th ***********/
+#define SQLITE_CREATE_INDEX 1 /* Index Name Table Name */
+#define SQLITE_CREATE_TABLE 2 /* Table Name NULL */
+#define SQLITE_CREATE_TEMP_INDEX 3 /* Index Name Table Name */
+#define SQLITE_CREATE_TEMP_TABLE 4 /* Table Name NULL */
+#define SQLITE_CREATE_TEMP_TRIGGER 5 /* Trigger Name Table Name */
+#define SQLITE_CREATE_TEMP_VIEW 6 /* View Name NULL */
+#define SQLITE_CREATE_TRIGGER 7 /* Trigger Name Table Name */
+#define SQLITE_CREATE_VIEW 8 /* View Name NULL */
+#define SQLITE_DELETE 9 /* Table Name NULL */
+#define SQLITE_DROP_INDEX 10 /* Index Name Table Name */
+#define SQLITE_DROP_TABLE 11 /* Table Name NULL */
+#define SQLITE_DROP_TEMP_INDEX 12 /* Index Name Table Name */
+#define SQLITE_DROP_TEMP_TABLE 13 /* Table Name NULL */
+#define SQLITE_DROP_TEMP_TRIGGER 14 /* Trigger Name Table Name */
+#define SQLITE_DROP_TEMP_VIEW 15 /* View Name NULL */
+#define SQLITE_DROP_TRIGGER 16 /* Trigger Name Table Name */
+#define SQLITE_DROP_VIEW 17 /* View Name NULL */
+#define SQLITE_INSERT 18 /* Table Name NULL */
+#define SQLITE_PRAGMA 19 /* Pragma Name 1st arg or NULL */
+#define SQLITE_READ 20 /* Table Name Column Name */
+#define SQLITE_SELECT 21 /* NULL NULL */
+#define SQLITE_TRANSACTION 22 /* Operation NULL */
+#define SQLITE_UPDATE 23 /* Table Name Column Name */
+#define SQLITE_ATTACH 24 /* Filename NULL */
+#define SQLITE_DETACH 25 /* Database Name NULL */
+#define SQLITE_ALTER_TABLE 26 /* Database Name Table Name */
+#define SQLITE_REINDEX 27 /* Index Name NULL */
+#define SQLITE_ANALYZE 28 /* Table Name NULL */
+#define SQLITE_CREATE_VTABLE 29 /* Table Name Module Name */
+#define SQLITE_DROP_VTABLE 30 /* Table Name Module Name */
+#define SQLITE_FUNCTION 31 /* NULL Function Name */
+#define SQLITE_SAVEPOINT 32 /* Operation Savepoint Name */
+#define SQLITE_COPY 0 /* No longer used */
+#define SQLITE_RECURSIVE 33 /* NULL NULL */
+
+/*
+** CAPI3REF: Deprecated Tracing And Profiling Functions
+** DEPRECATED
+**
+** These routines are deprecated. Use the [sqlite3_trace_v2()] interface
+** instead of the routines described here.
+**
+** These routines register callback functions that can be used for
+** tracing and profiling the execution of SQL statements.
+**
+** ^The callback function registered by sqlite3_trace() is invoked at
+** various times when an SQL statement is being run by [sqlite3_step()].
+** ^The sqlite3_trace() callback is invoked with a UTF-8 rendering of the
+** SQL statement text as the statement first begins executing.
+** ^(Additional sqlite3_trace() callbacks might occur
+** as each triggered subprogram is entered. The callbacks for triggers
+** contain a UTF-8 SQL comment that identifies the trigger.)^
+**
+** The [SQLITE_TRACE_SIZE_LIMIT] compile-time option can be used to limit
+** the length of [bound parameter] expansion in the output of sqlite3_trace().
+**
+** ^The callback function registered by sqlite3_profile() is invoked
+** as each SQL statement finishes. ^The profile callback contains
+** the original statement text and an estimate of wall-clock time
+** of how long that statement took to run. ^The profile callback
+** time is in units of nanoseconds, however the current implementation
+** is only capable of millisecond resolution so the six least significant
+** digits in the time are meaningless. Future versions of SQLite
+** might provide greater resolution on the profiler callback. Invoking
+** either [sqlite3_trace()] or [sqlite3_trace_v2()] will cancel the
+** profile callback.
+*/
+SQLITE_API SQLITE_DEPRECATED void *sqlite3_trace(sqlite3*,
+ void(*xTrace)(void*,const char*), void*);
+SQLITE_API SQLITE_DEPRECATED void *sqlite3_profile(sqlite3*,
+ void(*xProfile)(void*,const char*,sqlite3_uint64), void*);
+
+/*
+** CAPI3REF: SQL Trace Event Codes
+** KEYWORDS: SQLITE_TRACE
+**
+** These constants identify classes of events that can be monitored
+** using the [sqlite3_trace_v2()] tracing logic. The M argument
+** to [sqlite3_trace_v2(D,M,X,P)] is an OR-ed combination of one or more of
+** the following constants. ^The first argument to the trace callback
+** is one of the following constants.
+**
+** New tracing constants may be added in future releases.
+**
+** ^A trace callback has four arguments: xCallback(T,C,P,X).
+** ^The T argument is one of the integer type codes above.
+** ^The C argument is a copy of the context pointer passed in as the
+** fourth argument to [sqlite3_trace_v2()].
+** The P and X arguments are pointers whose meanings depend on T.
+**
+** <dl>
+** [[SQLITE_TRACE_STMT]] <dt>SQLITE_TRACE_STMT</dt>
+** <dd>^An SQLITE_TRACE_STMT callback is invoked when a prepared statement
+** first begins running and possibly at other times during the
+** execution of the prepared statement, such as at the start of each
+** trigger subprogram. ^The P argument is a pointer to the
+** [prepared statement]. ^The X argument is a pointer to a string which
+** is the unexpanded SQL text of the prepared statement or an SQL comment
+** that indicates the invocation of a trigger. ^The callback can compute
+** the same text that would have been returned by the legacy [sqlite3_trace()]
+** interface by using the X argument when X begins with "--" and invoking
+** [sqlite3_expanded_sql(P)] otherwise.
+**
+** [[SQLITE_TRACE_PROFILE]] <dt>SQLITE_TRACE_PROFILE</dt>
+** <dd>^An SQLITE_TRACE_PROFILE callback provides approximately the same
+** information as is provided by the [sqlite3_profile()] callback.
+** ^The P argument is a pointer to the [prepared statement] and the
+** X argument points to a 64-bit integer which is approximately
+** the number of nanoseconds that the prepared statement took to run.
+** ^The SQLITE_TRACE_PROFILE callback is invoked when the statement finishes.
+**
+** [[SQLITE_TRACE_ROW]] <dt>SQLITE_TRACE_ROW</dt>
+** <dd>^An SQLITE_TRACE_ROW callback is invoked whenever a prepared
+** statement generates a single row of result.
+** ^The P argument is a pointer to the [prepared statement] and the
+** X argument is unused.
+**
+** [[SQLITE_TRACE_CLOSE]] <dt>SQLITE_TRACE_CLOSE</dt>
+** <dd>^An SQLITE_TRACE_CLOSE callback is invoked when a database
+** connection closes.
+** ^The P argument is a pointer to the [database connection] object
+** and the X argument is unused.
+** </dl>
+*/
+#define SQLITE_TRACE_STMT 0x01
+#define SQLITE_TRACE_PROFILE 0x02
+#define SQLITE_TRACE_ROW 0x04
+#define SQLITE_TRACE_CLOSE 0x08
+
+/*
+** CAPI3REF: SQL Trace Hook
+** METHOD: sqlite3
+**
+** ^The sqlite3_trace_v2(D,M,X,P) interface registers a trace callback
+** function X against [database connection] D, using property mask M
+** and context pointer P. ^If the X callback is
+** NULL or if the M mask is zero, then tracing is disabled. The
+** M argument should be the bitwise OR-ed combination of
+** zero or more [SQLITE_TRACE] constants.
+**
+** ^Each call to either sqlite3_trace(D,X,P) or sqlite3_trace_v2(D,M,X,P)
+** overrides (cancels) all prior calls to sqlite3_trace(D,X,P) or
+** sqlite3_trace_v2(D,M,X,P) for the [database connection] D. Each
+** database connection may have at most one trace callback.
+**
+** ^The X callback is invoked whenever any of the events identified by
+** mask M occur. ^The integer return value from the callback is currently
+** ignored, though this may change in future releases. Callback
+** implementations should return zero to ensure future compatibility.
+**
+** ^A trace callback is invoked with four arguments: callback(T,C,P,X).
+** ^The T argument is one of the [SQLITE_TRACE]
+** constants to indicate why the callback was invoked.
+** ^The C argument is a copy of the context pointer.
+** The P and X arguments are pointers whose meanings depend on T.
+**
+** The sqlite3_trace_v2() interface is intended to replace the legacy
+** interfaces [sqlite3_trace()] and [sqlite3_profile()], both of which
+** are deprecated.
+*/
+SQLITE_API int sqlite3_trace_v2(
+ sqlite3*,
+ unsigned uMask,
+ int(*xCallback)(unsigned,void*,void*,void*),
+ void *pCtx
+);
+
+/*
+** CAPI3REF: Query Progress Callbacks
+** METHOD: sqlite3
+**
+** ^The sqlite3_progress_handler(D,N,X,P) interface causes the callback
+** function X to be invoked periodically during long running calls to
+** [sqlite3_step()] and [sqlite3_prepare()] and similar for
+** database connection D. An example use for this
+** interface is to keep a GUI updated during a large query.
+**
+** ^The parameter P is passed through as the only parameter to the
+** callback function X. ^The parameter N is the approximate number of
+** [virtual machine instructions] that are evaluated between successive
+** invocations of the callback X. ^If N is less than one then the progress
+** handler is disabled.
+**
+** ^Only a single progress handler may be defined at one time per
+** [database connection]; setting a new progress handler cancels the
+** old one. ^Setting parameter X to NULL disables the progress handler.
+** ^The progress handler is also disabled by setting N to a value less
+** than 1.
+**
+** ^If the progress callback returns non-zero, the operation is
+** interrupted. This feature can be used to implement a
+** "Cancel" button on a GUI progress dialog box.
+**
+** The progress handler callback must not do anything that will modify
+** the database connection that invoked the progress handler.
+** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
+** database connections for the meaning of "modify" in this paragraph.
+**
+** The progress handler callback would originally only be invoked from the
+** bytecode engine. It still might be invoked during [sqlite3_prepare()]
+** and similar because those routines might force a reparse of the schema
+** which involves running the bytecode engine. However, beginning with
+** SQLite version 3.41.0, the progress handler callback might also be
+** invoked directly from [sqlite3_prepare()] while analyzing and generating
+** code for complex queries.
+*/
+SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
+
+/*
+** CAPI3REF: Opening A New Database Connection
+** CONSTRUCTOR: sqlite3
+**
+** ^These routines open an SQLite database file as specified by the
+** filename argument. ^The filename argument is interpreted as UTF-8 for
+** sqlite3_open() and sqlite3_open_v2() and as UTF-16 in the native byte
+** order for sqlite3_open16(). ^(A [database connection] handle is usually
+** returned in *ppDb, even if an error occurs. The only exception is that
+** if SQLite is unable to allocate memory to hold the [sqlite3] object,
+** a NULL will be written into *ppDb instead of a pointer to the [sqlite3]
+** object.)^ ^(If the database is opened (and/or created) successfully, then
+** [SQLITE_OK] is returned. Otherwise an [error code] is returned.)^ ^The
+** [sqlite3_errmsg()] or [sqlite3_errmsg16()] routines can be used to obtain
+** an English language description of the error following a failure of any
+** of the sqlite3_open() routines.
+**
+** ^The default encoding will be UTF-8 for databases created using
+** sqlite3_open() or sqlite3_open_v2(). ^The default encoding for databases
+** created using sqlite3_open16() will be UTF-16 in the native byte order.
+**
+** Whether or not an error occurs when it is opened, resources
+** associated with the [database connection] handle should be released by
+** passing it to [sqlite3_close()] when it is no longer required.
+**
+** The sqlite3_open_v2() interface works like sqlite3_open()
+** except that it accepts two additional parameters for additional control
+** over the new database connection. ^(The flags parameter to
+** sqlite3_open_v2() must include, at a minimum, one of the following
+** three flag combinations:)^
+**
+** <dl>
+** ^(<dt>[SQLITE_OPEN_READONLY]</dt>
+** <dd>The database is opened in read-only mode. If the database does
+** not already exist, an error is returned.</dd>)^
+**
+** ^(<dt>[SQLITE_OPEN_READWRITE]</dt>
+** <dd>The database is opened for reading and writing if possible, or
+** reading only if the file is write protected by the operating
+** system. In either case the database must already exist, otherwise
+** an error is returned. For historical reasons, if opening in
+** read-write mode fails due to OS-level permissions, an attempt is
+** made to open it in read-only mode. [sqlite3_db_readonly()] can be
+** used to determine whether the database is actually
+** read-write.</dd>)^
+**
+** ^(<dt>[SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]</dt>
+** <dd>The database is opened for reading and writing, and is created if
+** it does not already exist. This is the behavior that is always used for
+** sqlite3_open() and sqlite3_open16().</dd>)^
+** </dl>
+**
+** In addition to the required flags, the following optional flags are
+** also supported:
+**
+** <dl>
+** ^(<dt>[SQLITE_OPEN_URI]</dt>
+** <dd>The filename can be interpreted as a URI if this flag is set.</dd>)^
+**
+** ^(<dt>[SQLITE_OPEN_MEMORY]</dt>
+** <dd>The database will be opened as an in-memory database. The database
+** is named by the "filename" argument for the purposes of cache-sharing,
+** if shared cache mode is enabled, but the "filename" is otherwise ignored.
+** </dd>)^
+**
+** ^(<dt>[SQLITE_OPEN_NOMUTEX]</dt>
+** <dd>The new database connection will use the "multi-thread"
+** [threading mode].)^ This means that separate threads are allowed
+** to use SQLite at the same time, as long as each thread is using
+** a different [database connection].
+**
+** ^(<dt>[SQLITE_OPEN_FULLMUTEX]</dt>
+** <dd>The new database connection will use the "serialized"
+** [threading mode].)^ This means the multiple threads can safely
+** attempt to use the same database connection at the same time.
+** (Mutexes will block any actual concurrency, but in this mode
+** there is no harm in trying.)
+**
+** ^(<dt>[SQLITE_OPEN_SHAREDCACHE]</dt>
+** <dd>The database is opened [shared cache] enabled, overriding
+** the default shared cache setting provided by
+** [sqlite3_enable_shared_cache()].)^
+** The [use of shared cache mode is discouraged] and hence shared cache
+** capabilities may be omitted from many builds of SQLite. In such cases,
+** this option is a no-op.
+**
+** ^(<dt>[SQLITE_OPEN_PRIVATECACHE]</dt>
+** <dd>The database is opened [shared cache] disabled, overriding
+** the default shared cache setting provided by
+** [sqlite3_enable_shared_cache()].)^
+**
+** [[OPEN_EXRESCODE]] ^(<dt>[SQLITE_OPEN_EXRESCODE]</dt>
+** <dd>The database connection comes up in "extended result code mode".
+** In other words, the database behaves as if
+** [sqlite3_extended_result_codes(db,1)] were called on the database
+** connection as soon as the connection is created. In addition to setting
+** the extended result code mode, this flag also causes [sqlite3_open_v2()]
+** to return an extended result code.</dd>
+**
+** [[OPEN_NOFOLLOW]] ^(<dt>[SQLITE_OPEN_NOFOLLOW]</dt>
+** <dd>The database filename is not allowed to contain a symbolic link</dd>
+** </dl>)^
+**
+** If the 3rd parameter to sqlite3_open_v2() is not one of the
+** required combinations shown above optionally combined with other
+** [SQLITE_OPEN_READONLY | SQLITE_OPEN_* bits]
+** then the behavior is undefined. Historic versions of SQLite
+** have silently ignored surplus bits in the flags parameter to
+** sqlite3_open_v2(), however that behavior might not be carried through
+** into future versions of SQLite and so applications should not rely
+** upon it. Note in particular that the SQLITE_OPEN_EXCLUSIVE flag is a no-op
+** for sqlite3_open_v2(). The SQLITE_OPEN_EXCLUSIVE does *not* cause
+** the open to fail if the database already exists. The SQLITE_OPEN_EXCLUSIVE
+** flag is intended for use by the [sqlite3_vfs|VFS interface] only, and not
+** by sqlite3_open_v2().
+**
+** ^The fourth parameter to sqlite3_open_v2() is the name of the
+** [sqlite3_vfs] object that defines the operating system interface that
+** the new database connection should use. ^If the fourth parameter is
+** a NULL pointer then the default [sqlite3_vfs] object is used.
+**
+** ^If the filename is ":memory:", then a private, temporary in-memory database
+** is created for the connection. ^This in-memory database will vanish when
+** the database connection is closed. Future versions of SQLite might
+** make use of additional special filenames that begin with the ":" character.
+** It is recommended that when a database filename actually does begin with
+** a ":" character you should prefix the filename with a pathname such as
+** "./" to avoid ambiguity.
+**
+** ^If the filename is an empty string, then a private, temporary
+** on-disk database will be created. ^This private database will be
+** automatically deleted as soon as the database connection is closed.
+**
+** [[URI filenames in sqlite3_open()]] <h3>URI Filenames</h3>
+**
+** ^If [URI filename] interpretation is enabled, and the filename argument
+** begins with "file:", then the filename is interpreted as a URI. ^URI
+** filename interpretation is enabled if the [SQLITE_OPEN_URI] flag is
+** set in the third argument to sqlite3_open_v2(), or if it has
+** been enabled globally using the [SQLITE_CONFIG_URI] option with the
+** [sqlite3_config()] method or by the [SQLITE_USE_URI] compile-time option.
+** URI filename interpretation is turned off
+** by default, but future releases of SQLite might enable URI filename
+** interpretation by default. See "[URI filenames]" for additional
+** information.
+**
+** URI filenames are parsed according to RFC 3986. ^If the URI contains an
+** authority, then it must be either an empty string or the string
+** "localhost". ^If the authority is not an empty string or "localhost", an
+** error is returned to the caller. ^The fragment component of a URI, if
+** present, is ignored.
+**
+** ^SQLite uses the path component of the URI as the name of the disk file
+** which contains the database. ^If the path begins with a '/' character,
+** then it is interpreted as an absolute path. ^If the path does not begin
+** with a '/' (meaning that the authority section is omitted from the URI)
+** then the path is interpreted as a relative path.
+** ^(On windows, the first component of an absolute path
+** is a drive specification (e.g. "C:").)^
+**
+** [[core URI query parameters]]
+** The query component of a URI may contain parameters that are interpreted
+** either by SQLite itself, or by a [VFS | custom VFS implementation].
+** SQLite and its built-in [VFSes] interpret the
+** following query parameters:
+**
+** <ul>
+** <li> <b>vfs</b>: ^The "vfs" parameter may be used to specify the name of
+** a VFS object that provides the operating system interface that should
+** be used to access the database file on disk. ^If this option is set to
+** an empty string the default VFS object is used. ^Specifying an unknown
+** VFS is an error. ^If sqlite3_open_v2() is used and the vfs option is
+** present, then the VFS specified by the option takes precedence over
+** the value passed as the fourth parameter to sqlite3_open_v2().
+**
+** <li> <b>mode</b>: ^(The mode parameter may be set to either "ro", "rw",
+** "rwc", or "memory". Attempting to set it to any other value is
+** an error)^.
+** ^If "ro" is specified, then the database is opened for read-only
+** access, just as if the [SQLITE_OPEN_READONLY] flag had been set in the
+** third argument to sqlite3_open_v2(). ^If the mode option is set to
+** "rw", then the database is opened for read-write (but not create)
+** access, as if SQLITE_OPEN_READWRITE (but not SQLITE_OPEN_CREATE) had
+** been set. ^Value "rwc" is equivalent to setting both
+** SQLITE_OPEN_READWRITE and SQLITE_OPEN_CREATE. ^If the mode option is
+** set to "memory" then a pure [in-memory database] that never reads
+** or writes from disk is used. ^It is an error to specify a value for
+** the mode parameter that is less restrictive than that specified by
+** the flags passed in the third parameter to sqlite3_open_v2().
+**
+** <li> <b>cache</b>: ^The cache parameter may be set to either "shared" or
+** "private". ^Setting it to "shared" is equivalent to setting the
+** SQLITE_OPEN_SHAREDCACHE bit in the flags argument passed to
+** sqlite3_open_v2(). ^Setting the cache parameter to "private" is
+** equivalent to setting the SQLITE_OPEN_PRIVATECACHE bit.
+** ^If sqlite3_open_v2() is used and the "cache" parameter is present in
+** a URI filename, its value overrides any behavior requested by setting
+** SQLITE_OPEN_PRIVATECACHE or SQLITE_OPEN_SHAREDCACHE flag.
+**
+** <li> <b>psow</b>: ^The psow parameter indicates whether or not the
+** [powersafe overwrite] property does or does not apply to the
+** storage media on which the database file resides.
+**
+** <li> <b>nolock</b>: ^The nolock parameter is a boolean query parameter
+** which if set disables file locking in rollback journal modes. This
+** is useful for accessing a database on a filesystem that does not
+** support locking. Caution: Database corruption might result if two
+** or more processes write to the same database and any one of those
+** processes uses nolock=1.
+**
+** <li> <b>immutable</b>: ^The immutable parameter is a boolean query
+** parameter that indicates that the database file is stored on
+** read-only media. ^When immutable is set, SQLite assumes that the
+** database file cannot be changed, even by a process with higher
+** privilege, and so the database is opened read-only and all locking
+** and change detection is disabled. Caution: Setting the immutable
+** property on a database file that does in fact change can result
+** in incorrect query results and/or [SQLITE_CORRUPT] errors.
+** See also: [SQLITE_IOCAP_IMMUTABLE].
+**
+** </ul>
+**
+** ^Specifying an unknown parameter in the query component of a URI is not an
+** error. Future versions of SQLite might understand additional query
+** parameters. See "[query parameters with special meaning to SQLite]" for
+** additional information.
+**
+** [[URI filename examples]] <h3>URI filename examples</h3>
+**
+** <table border="1" align=center cellpadding=5>
+** <tr><th> URI filenames <th> Results
+** <tr><td> file:data.db <td>
+** Open the file "data.db" in the current directory.
+** <tr><td> file:/home/fred/data.db<br>
+** file:///home/fred/data.db <br>
+** file://localhost/home/fred/data.db <br> <td>
+** Open the database file "/home/fred/data.db".
+** <tr><td> file://darkstar/home/fred/data.db <td>
+** An error. "darkstar" is not a recognized authority.
+** <tr><td style="white-space:nowrap">
+** file:///C:/Documents%20and%20Settings/fred/Desktop/data.db
+** <td> Windows only: Open the file "data.db" on fred's desktop on drive
+** C:. Note that the %20 escaping in this example is not strictly
+** necessary - space characters can be used literally
+** in URI filenames.
+** <tr><td> file:data.db?mode=ro&cache=private <td>
+** Open file "data.db" in the current directory for read-only access.
+** Regardless of whether or not shared-cache mode is enabled by
+** default, use a private cache.
+** <tr><td> file:/home/fred/data.db?vfs=unix-dotfile <td>
+** Open file "/home/fred/data.db". Use the special VFS "unix-dotfile"
+** that uses dot-files in place of posix advisory locking.
+** <tr><td> file:data.db?mode=readonly <td>
+** An error. "readonly" is not a valid option for the "mode" parameter.
+** Use "ro" instead: "file:data.db?mode=ro".
+** </table>
+**
+** ^URI hexadecimal escape sequences (%HH) are supported within the path and
+** query components of a URI. A hexadecimal escape sequence consists of a
+** percent sign - "%" - followed by exactly two hexadecimal digits
+** specifying an octet value. ^Before the path or query components of a
+** URI filename are interpreted, they are encoded using UTF-8 and all
+** hexadecimal escape sequences replaced by a single byte containing the
+** corresponding octet. If this process generates an invalid UTF-8 encoding,
+** the results are undefined.
+**
+** <b>Note to Windows users:</b> The encoding used for the filename argument
+** of sqlite3_open() and sqlite3_open_v2() must be UTF-8, not whatever
+** codepage is currently defined. Filenames containing international
+** characters must be converted to UTF-8 prior to passing them into
+** sqlite3_open() or sqlite3_open_v2().
+**
+** <b>Note to Windows Runtime users:</b> The temporary directory must be set
+** prior to calling sqlite3_open() or sqlite3_open_v2(). Otherwise, various
+** features that require the use of temporary files may fail.
+**
+** See also: [sqlite3_temp_directory]
+*/
+SQLITE_API int sqlite3_open(
+ const char *filename, /* Database filename (UTF-8) */
+ sqlite3 **ppDb /* OUT: SQLite db handle */
+);
+SQLITE_API int sqlite3_open16(
+ const void *filename, /* Database filename (UTF-16) */
+ sqlite3 **ppDb /* OUT: SQLite db handle */
+);
+SQLITE_API int sqlite3_open_v2(
+ const char *filename, /* Database filename (UTF-8) */
+ sqlite3 **ppDb, /* OUT: SQLite db handle */
+ int flags, /* Flags */
+ const char *zVfs /* Name of VFS module to use */
+);
+
+/*
+** CAPI3REF: Obtain Values For URI Parameters
+**
+** These are utility routines, useful to [VFS|custom VFS implementations],
+** that check if a database file was a URI that contained a specific query
+** parameter, and if so obtains the value of that query parameter.
+**
+** The first parameter to these interfaces (hereafter referred to
+** as F) must be one of:
+** <ul>
+** <li> A database filename pointer created by the SQLite core and
+** passed into the xOpen() method of a VFS implementation, or
+** <li> A filename obtained from [sqlite3_db_filename()], or
+** <li> A new filename constructed using [sqlite3_create_filename()].
+** </ul>
+** If the F parameter is not one of the above, then the behavior is
+** undefined and probably undesirable. Older versions of SQLite were
+** more tolerant of invalid F parameters than newer versions.
+**
+** If F is a suitable filename (as described in the previous paragraph)
+** and if P is the name of the query parameter, then
+** sqlite3_uri_parameter(F,P) returns the value of the P
+** parameter if it exists or a NULL pointer if P does not appear as a
+** query parameter on F. If P is a query parameter of F and it
+** has no explicit value, then sqlite3_uri_parameter(F,P) returns
+** a pointer to an empty string.
+**
+** The sqlite3_uri_boolean(F,P,B) routine assumes that P is a boolean
+** parameter and returns true (1) or false (0) according to the value
+** of P. The sqlite3_uri_boolean(F,P,B) routine returns true (1) if the
+** value of query parameter P is one of "yes", "true", or "on" in any
+** case or if the value begins with a non-zero number. The
+** sqlite3_uri_boolean(F,P,B) routines returns false (0) if the value of
+** query parameter P is one of "no", "false", or "off" in any case or
+** if the value begins with a numeric zero. If P is not a query
+** parameter on F or if the value of P does not match any of the
+** above, then sqlite3_uri_boolean(F,P,B) returns (B!=0).
+**
+** The sqlite3_uri_int64(F,P,D) routine converts the value of P into a
+** 64-bit signed integer and returns that integer, or D if P does not
+** exist. If the value of P is something other than an integer, then
+** zero is returned.
+**
+** The sqlite3_uri_key(F,N) returns a pointer to the name (not
+** the value) of the N-th query parameter for filename F, or a NULL
+** pointer if N is less than zero or greater than the number of query
+** parameters minus 1. The N value is zero-based so N should be 0 to obtain
+** the name of the first query parameter, 1 for the second parameter, and
+** so forth.
+**
+** If F is a NULL pointer, then sqlite3_uri_parameter(F,P) returns NULL and
+** sqlite3_uri_boolean(F,P,B) returns B. If F is not a NULL pointer and
+** is not a database file pathname pointer that the SQLite core passed
+** into the xOpen VFS method, then the behavior of this routine is undefined
+** and probably undesirable.
+**
+** Beginning with SQLite [version 3.31.0] ([dateof:3.31.0]) the input F
+** parameter can also be the name of a rollback journal file or WAL file
+** in addition to the main database file. Prior to version 3.31.0, these
+** routines would only work if F was the name of the main database file.
+** When the F parameter is the name of the rollback journal or WAL file,
+** it has access to all the same query parameters as were found on the
+** main database file.
+**
+** See the [URI filename] documentation for additional information.
+*/
+SQLITE_API const char *sqlite3_uri_parameter(sqlite3_filename z, const char *zParam);
+SQLITE_API int sqlite3_uri_boolean(sqlite3_filename z, const char *zParam, int bDefault);
+SQLITE_API sqlite3_int64 sqlite3_uri_int64(sqlite3_filename, const char*, sqlite3_int64);
+SQLITE_API const char *sqlite3_uri_key(sqlite3_filename z, int N);
+
+/*
+** CAPI3REF: Translate filenames
+**
+** These routines are available to [VFS|custom VFS implementations] for
+** translating filenames between the main database file, the journal file,
+** and the WAL file.
+**
+** If F is the name of an sqlite database file, journal file, or WAL file
+** passed by the SQLite core into the VFS, then sqlite3_filename_database(F)
+** returns the name of the corresponding database file.
+**
+** If F is the name of an sqlite database file, journal file, or WAL file
+** passed by the SQLite core into the VFS, or if F is a database filename
+** obtained from [sqlite3_db_filename()], then sqlite3_filename_journal(F)
+** returns the name of the corresponding rollback journal file.
+**
+** If F is the name of an sqlite database file, journal file, or WAL file
+** that was passed by the SQLite core into the VFS, or if F is a database
+** filename obtained from [sqlite3_db_filename()], then
+** sqlite3_filename_wal(F) returns the name of the corresponding
+** WAL file.
+**
+** In all of the above, if F is not the name of a database, journal or WAL
+** filename passed into the VFS from the SQLite core and F is not the
+** return value from [sqlite3_db_filename()], then the result is
+** undefined and is likely a memory access violation.
+*/
+SQLITE_API const char *sqlite3_filename_database(sqlite3_filename);
+SQLITE_API const char *sqlite3_filename_journal(sqlite3_filename);
+SQLITE_API const char *sqlite3_filename_wal(sqlite3_filename);
+
+/*
+** CAPI3REF: Database File Corresponding To A Journal
+**
+** ^If X is the name of a rollback or WAL-mode journal file that is
+** passed into the xOpen method of [sqlite3_vfs], then
+** sqlite3_database_file_object(X) returns a pointer to the [sqlite3_file]
+** object that represents the main database file.
+**
+** This routine is intended for use in custom [VFS] implementations
+** only. It is not a general-purpose interface.
+** The argument sqlite3_file_object(X) must be a filename pointer that
+** has been passed into [sqlite3_vfs].xOpen method where the
+** flags parameter to xOpen contains one of the bits
+** [SQLITE_OPEN_MAIN_JOURNAL] or [SQLITE_OPEN_WAL]. Any other use
+** of this routine results in undefined and probably undesirable
+** behavior.
+*/
+SQLITE_API sqlite3_file *sqlite3_database_file_object(const char*);
+
+/*
+** CAPI3REF: Create and Destroy VFS Filenames
+**
+** These interfaces are provided for use by [VFS shim] implementations and
+** are not useful outside of that context.
+**
+** The sqlite3_create_filename(D,J,W,N,P) allocates memory to hold a version of
+** database filename D with corresponding journal file J and WAL file W and
+** with N URI parameters key/values pairs in the array P. The result from
+** sqlite3_create_filename(D,J,W,N,P) is a pointer to a database filename that
+** is safe to pass to routines like:
+** <ul>
+** <li> [sqlite3_uri_parameter()],
+** <li> [sqlite3_uri_boolean()],
+** <li> [sqlite3_uri_int64()],
+** <li> [sqlite3_uri_key()],
+** <li> [sqlite3_filename_database()],
+** <li> [sqlite3_filename_journal()], or
+** <li> [sqlite3_filename_wal()].
+** </ul>
+** If a memory allocation error occurs, sqlite3_create_filename() might
+** return a NULL pointer. The memory obtained from sqlite3_create_filename(X)
+** must be released by a corresponding call to sqlite3_free_filename(Y).
+**
+** The P parameter in sqlite3_create_filename(D,J,W,N,P) should be an array
+** of 2*N pointers to strings. Each pair of pointers in this array corresponds
+** to a key and value for a query parameter. The P parameter may be a NULL
+** pointer if N is zero. None of the 2*N pointers in the P array may be
+** NULL pointers and key pointers should not be empty strings.
+** None of the D, J, or W parameters to sqlite3_create_filename(D,J,W,N,P) may
+** be NULL pointers, though they can be empty strings.
+**
+** The sqlite3_free_filename(Y) routine releases a memory allocation
+** previously obtained from sqlite3_create_filename(). Invoking
+** sqlite3_free_filename(Y) where Y is a NULL pointer is a harmless no-op.
+**
+** If the Y parameter to sqlite3_free_filename(Y) is anything other
+** than a NULL pointer or a pointer previously acquired from
+** sqlite3_create_filename(), then bad things such as heap
+** corruption or segfaults may occur. The value Y should not be
+** used again after sqlite3_free_filename(Y) has been called. This means
+** that if the [sqlite3_vfs.xOpen()] method of a VFS has been called using Y,
+** then the corresponding [sqlite3_module.xClose() method should also be
+** invoked prior to calling sqlite3_free_filename(Y).
+*/
+SQLITE_API sqlite3_filename sqlite3_create_filename(
+ const char *zDatabase,
+ const char *zJournal,
+ const char *zWal,
+ int nParam,
+ const char **azParam
+);
+SQLITE_API void sqlite3_free_filename(sqlite3_filename);
+
+/*
+** CAPI3REF: Error Codes And Messages
+** METHOD: sqlite3
+**
+** ^If the most recent sqlite3_* API call associated with
+** [database connection] D failed, then the sqlite3_errcode(D) interface
+** returns the numeric [result code] or [extended result code] for that
+** API call.
+** ^The sqlite3_extended_errcode()
+** interface is the same except that it always returns the
+** [extended result code] even when extended result codes are
+** disabled.
+**
+** The values returned by sqlite3_errcode() and/or
+** sqlite3_extended_errcode() might change with each API call.
+** Except, there are some interfaces that are guaranteed to never
+** change the value of the error code. The error-code preserving
+** interfaces include the following:
+**
+** <ul>
+** <li> sqlite3_errcode()
+** <li> sqlite3_extended_errcode()
+** <li> sqlite3_errmsg()
+** <li> sqlite3_errmsg16()
+** <li> sqlite3_error_offset()
+** </ul>
+**
+** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
+** text that describes the error, as either UTF-8 or UTF-16 respectively,
+** or NULL if no error message is available.
+** (See how SQLite handles [invalid UTF] for exceptions to this rule.)
+** ^(Memory to hold the error message string is managed internally.
+** The application does not need to worry about freeing the result.
+** However, the error string might be overwritten or deallocated by
+** subsequent calls to other SQLite interface functions.)^
+**
+** ^The sqlite3_errstr(E) interface returns the English-language text
+** that describes the [result code] E, as UTF-8, or NULL if E is not an
+** result code for which a text error message is available.
+** ^(Memory to hold the error message string is managed internally
+** and must not be freed by the application)^.
+**
+** ^If the most recent error references a specific token in the input
+** SQL, the sqlite3_error_offset() interface returns the byte offset
+** of the start of that token. ^The byte offset returned by
+** sqlite3_error_offset() assumes that the input SQL is UTF8.
+** ^If the most recent error does not reference a specific token in the input
+** SQL, then the sqlite3_error_offset() function returns -1.
+**
+** When the serialized [threading mode] is in use, it might be the
+** case that a second error occurs on a separate thread in between
+** the time of the first error and the call to these interfaces.
+** When that happens, the second error will be reported since these
+** interfaces always report the most recent result. To avoid
+** this, each thread can obtain exclusive use of the [database connection] D
+** by invoking [sqlite3_mutex_enter]([sqlite3_db_mutex](D)) before beginning
+** to use D and invoking [sqlite3_mutex_leave]([sqlite3_db_mutex](D)) after
+** all calls to the interfaces listed here are completed.
+**
+** If an interface fails with SQLITE_MISUSE, that means the interface
+** was invoked incorrectly by the application. In that case, the
+** error code and message may or may not be set.
+*/
+SQLITE_API int sqlite3_errcode(sqlite3 *db);
+SQLITE_API int sqlite3_extended_errcode(sqlite3 *db);
+SQLITE_API const char *sqlite3_errmsg(sqlite3*);
+SQLITE_API const void *sqlite3_errmsg16(sqlite3*);
+SQLITE_API const char *sqlite3_errstr(int);
+SQLITE_API int sqlite3_error_offset(sqlite3 *db);
+
+/*
+** CAPI3REF: Prepared Statement Object
+** KEYWORDS: {prepared statement} {prepared statements}
+**
+** An instance of this object represents a single SQL statement that
+** has been compiled into binary form and is ready to be evaluated.
+**
+** Think of each SQL statement as a separate computer program. The
+** original SQL text is source code. A prepared statement object
+** is the compiled object code. All SQL must be converted into a
+** prepared statement before it can be run.
+**
+** The life-cycle of a prepared statement object usually goes like this:
+**
+** <ol>
+** <li> Create the prepared statement object using [sqlite3_prepare_v2()].
+** <li> Bind values to [parameters] using the sqlite3_bind_*()
+** interfaces.
+** <li> Run the SQL by calling [sqlite3_step()] one or more times.
+** <li> Reset the prepared statement using [sqlite3_reset()] then go back
+** to step 2. Do this zero or more times.
+** <li> Destroy the object using [sqlite3_finalize()].
+** </ol>
+*/
+typedef struct sqlite3_stmt sqlite3_stmt;
+
+/*
+** CAPI3REF: Run-time Limits
+** METHOD: sqlite3
+**
+** ^(This interface allows the size of various constructs to be limited
+** on a connection by connection basis. The first parameter is the
+** [database connection] whose limit is to be set or queried. The
+** second parameter is one of the [limit categories] that define a
+** class of constructs to be size limited. The third parameter is the
+** new limit for that construct.)^
+**
+** ^If the new limit is a negative number, the limit is unchanged.
+** ^(For each limit category SQLITE_LIMIT_<i>NAME</i> there is a
+** [limits | hard upper bound]
+** set at compile-time by a C preprocessor macro called
+** [limits | SQLITE_MAX_<i>NAME</i>].
+** (The "_LIMIT_" in the name is changed to "_MAX_".))^
+** ^Attempts to increase a limit above its hard upper bound are
+** silently truncated to the hard upper bound.
+**
+** ^Regardless of whether or not the limit was changed, the
+** [sqlite3_limit()] interface returns the prior value of the limit.
+** ^Hence, to find the current value of a limit without changing it,
+** simply invoke this interface with the third parameter set to -1.
+**
+** Run-time limits are intended for use in applications that manage
+** both their own internal database and also databases that are controlled
+** by untrusted external sources. An example application might be a
+** web browser that has its own databases for storing history and
+** separate databases controlled by JavaScript applications downloaded
+** off the Internet. The internal databases can be given the
+** large, default limits. Databases managed by external sources can
+** be given much smaller limits designed to prevent a denial of service
+** attack. Developers might also want to use the [sqlite3_set_authorizer()]
+** interface to further control untrusted SQL. The size of the database
+** created by an untrusted script can be contained using the
+** [max_page_count] [PRAGMA].
+**
+** New run-time limit categories may be added in future releases.
+*/
+SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
+
+/*
+** CAPI3REF: Run-Time Limit Categories
+** KEYWORDS: {limit category} {*limit categories}
+**
+** These constants define various performance limits
+** that can be lowered at run-time using [sqlite3_limit()].
+** The synopsis of the meanings of the various limits is shown below.
+** Additional information is available at [limits | Limits in SQLite].
+**
+** <dl>
+** [[SQLITE_LIMIT_LENGTH]] ^(<dt>SQLITE_LIMIT_LENGTH</dt>
+** <dd>The maximum size of any string or BLOB or table row, in bytes.<dd>)^
+**
+** [[SQLITE_LIMIT_SQL_LENGTH]] ^(<dt>SQLITE_LIMIT_SQL_LENGTH</dt>
+** <dd>The maximum length of an SQL statement, in bytes.</dd>)^
+**
+** [[SQLITE_LIMIT_COLUMN]] ^(<dt>SQLITE_LIMIT_COLUMN</dt>
+** <dd>The maximum number of columns in a table definition or in the
+** result set of a [SELECT] or the maximum number of columns in an index
+** or in an ORDER BY or GROUP BY clause.</dd>)^
+**
+** [[SQLITE_LIMIT_EXPR_DEPTH]] ^(<dt>SQLITE_LIMIT_EXPR_DEPTH</dt>
+** <dd>The maximum depth of the parse tree on any expression.</dd>)^
+**
+** [[SQLITE_LIMIT_COMPOUND_SELECT]] ^(<dt>SQLITE_LIMIT_COMPOUND_SELECT</dt>
+** <dd>The maximum number of terms in a compound SELECT statement.</dd>)^
+**
+** [[SQLITE_LIMIT_VDBE_OP]] ^(<dt>SQLITE_LIMIT_VDBE_OP</dt>
+** <dd>The maximum number of instructions in a virtual machine program
+** used to implement an SQL statement. If [sqlite3_prepare_v2()] or
+** the equivalent tries to allocate space for more than this many opcodes
+** in a single prepared statement, an SQLITE_NOMEM error is returned.</dd>)^
+**
+** [[SQLITE_LIMIT_FUNCTION_ARG]] ^(<dt>SQLITE_LIMIT_FUNCTION_ARG</dt>
+** <dd>The maximum number of arguments on a function.</dd>)^
+**
+** [[SQLITE_LIMIT_ATTACHED]] ^(<dt>SQLITE_LIMIT_ATTACHED</dt>
+** <dd>The maximum number of [ATTACH | attached databases].)^</dd>
+**
+** [[SQLITE_LIMIT_LIKE_PATTERN_LENGTH]]
+** ^(<dt>SQLITE_LIMIT_LIKE_PATTERN_LENGTH</dt>
+** <dd>The maximum length of the pattern argument to the [LIKE] or
+** [GLOB] operators.</dd>)^
+**
+** [[SQLITE_LIMIT_VARIABLE_NUMBER]]
+** ^(<dt>SQLITE_LIMIT_VARIABLE_NUMBER</dt>
+** <dd>The maximum index number of any [parameter] in an SQL statement.)^
+**
+** [[SQLITE_LIMIT_TRIGGER_DEPTH]] ^(<dt>SQLITE_LIMIT_TRIGGER_DEPTH</dt>
+** <dd>The maximum depth of recursion for triggers.</dd>)^
+**
+** [[SQLITE_LIMIT_WORKER_THREADS]] ^(<dt>SQLITE_LIMIT_WORKER_THREADS</dt>
+** <dd>The maximum number of auxiliary worker threads that a single
+** [prepared statement] may start.</dd>)^
+** </dl>
+*/
+#define SQLITE_LIMIT_LENGTH 0
+#define SQLITE_LIMIT_SQL_LENGTH 1
+#define SQLITE_LIMIT_COLUMN 2
+#define SQLITE_LIMIT_EXPR_DEPTH 3
+#define SQLITE_LIMIT_COMPOUND_SELECT 4
+#define SQLITE_LIMIT_VDBE_OP 5
+#define SQLITE_LIMIT_FUNCTION_ARG 6
+#define SQLITE_LIMIT_ATTACHED 7
+#define SQLITE_LIMIT_LIKE_PATTERN_LENGTH 8
+#define SQLITE_LIMIT_VARIABLE_NUMBER 9
+#define SQLITE_LIMIT_TRIGGER_DEPTH 10
+#define SQLITE_LIMIT_WORKER_THREADS 11
+
+/*
+** CAPI3REF: Prepare Flags
+**
+** These constants define various flags that can be passed into
+** "prepFlags" parameter of the [sqlite3_prepare_v3()] and
+** [sqlite3_prepare16_v3()] interfaces.
+**
+** New flags may be added in future releases of SQLite.
+**
+** <dl>
+** [[SQLITE_PREPARE_PERSISTENT]] ^(<dt>SQLITE_PREPARE_PERSISTENT</dt>
+** <dd>The SQLITE_PREPARE_PERSISTENT flag is a hint to the query planner
+** that the prepared statement will be retained for a long time and
+** probably reused many times.)^ ^Without this flag, [sqlite3_prepare_v3()]
+** and [sqlite3_prepare16_v3()] assume that the prepared statement will
+** be used just once or at most a few times and then destroyed using
+** [sqlite3_finalize()] relatively soon. The current implementation acts
+** on this hint by avoiding the use of [lookaside memory] so as not to
+** deplete the limited store of lookaside memory. Future versions of
+** SQLite may act on this hint differently.
+**
+** [[SQLITE_PREPARE_NORMALIZE]] <dt>SQLITE_PREPARE_NORMALIZE</dt>
+** <dd>The SQLITE_PREPARE_NORMALIZE flag is a no-op. This flag used
+** to be required for any prepared statement that wanted to use the
+** [sqlite3_normalized_sql()] interface. However, the
+** [sqlite3_normalized_sql()] interface is now available to all
+** prepared statements, regardless of whether or not they use this
+** flag.
+**
+** [[SQLITE_PREPARE_NO_VTAB]] <dt>SQLITE_PREPARE_NO_VTAB</dt>
+** <dd>The SQLITE_PREPARE_NO_VTAB flag causes the SQL compiler
+** to return an error (error code SQLITE_ERROR) if the statement uses
+** any virtual tables.
+**
+** [[SQLITE_PREPARE_DONT_LOG]] <dt>SQLITE_PREPARE_DONT_LOG</dt>
+** <dd>The SQLITE_PREPARE_DONT_LOG flag prevents SQL compiler
+** errors from being sent to the error log defined by
+** [SQLITE_CONFIG_LOG]. This can be used, for example, to do test
+** compiles to see if some SQL syntax is well-formed, without generating
+** messages on the global error log when it is not. If the test compile
+** fails, the sqlite3_prepare_v3() call returns the same error indications
+** with or without this flag; it just omits the call to [sqlite3_log()] that
+** logs the error.
+** </dl>
+*/
+#define SQLITE_PREPARE_PERSISTENT 0x01
+#define SQLITE_PREPARE_NORMALIZE 0x02
+#define SQLITE_PREPARE_NO_VTAB 0x04
+#define SQLITE_PREPARE_DONT_LOG 0x10
+
+/*
+** CAPI3REF: Compiling An SQL Statement
+** KEYWORDS: {SQL statement compiler}
+** METHOD: sqlite3
+** CONSTRUCTOR: sqlite3_stmt
+**
+** To execute an SQL statement, it must first be compiled into a byte-code
+** program using one of these routines. Or, in other words, these routines
+** are constructors for the [prepared statement] object.
+**
+** The preferred routine to use is [sqlite3_prepare_v2()]. The
+** [sqlite3_prepare()] interface is legacy and should be avoided.
+** [sqlite3_prepare_v3()] has an extra "prepFlags" option that is used
+** for special purposes.
+**
+** The use of the UTF-8 interfaces is preferred, as SQLite currently
+** does all parsing using UTF-8. The UTF-16 interfaces are provided
+** as a convenience. The UTF-16 interfaces work by converting the
+** input text into UTF-8, then invoking the corresponding UTF-8 interface.
+**
+** The first argument, "db", is a [database connection] obtained from a
+** prior successful call to [sqlite3_open()], [sqlite3_open_v2()] or
+** [sqlite3_open16()]. The database connection must not have been closed.
+**
+** The second argument, "zSql", is the statement to be compiled, encoded
+** as either UTF-8 or UTF-16. The sqlite3_prepare(), sqlite3_prepare_v2(),
+** and sqlite3_prepare_v3()
+** interfaces use UTF-8, and sqlite3_prepare16(), sqlite3_prepare16_v2(),
+** and sqlite3_prepare16_v3() use UTF-16.
+**
+** ^If the nByte argument is negative, then zSql is read up to the
+** first zero terminator. ^If nByte is positive, then it is the maximum
+** number of bytes read from zSql. When nByte is positive, zSql is read
+** up to the first zero terminator or until the nByte bytes have been read,
+** whichever comes first. ^If nByte is zero, then no prepared
+** statement is generated.
+** If the caller knows that the supplied string is nul-terminated, then
+** there is a small performance advantage to passing an nByte parameter that
+** is the number of bytes in the input string <i>including</i>
+** the nul-terminator.
+** Note that nByte measure the length of the input in bytes, not
+** characters, even for the UTF-16 interfaces.
+**
+** ^If pzTail is not NULL then *pzTail is made to point to the first byte
+** past the end of the first SQL statement in zSql. These routines only
+** compile the first statement in zSql, so *pzTail is left pointing to
+** what remains uncompiled.
+**
+** ^*ppStmt is left pointing to a compiled [prepared statement] that can be
+** executed using [sqlite3_step()]. ^If there is an error, *ppStmt is set
+** to NULL. ^If the input text contains no SQL (if the input is an empty
+** string or a comment) then *ppStmt is set to NULL.
+** The calling procedure is responsible for deleting the compiled
+** SQL statement using [sqlite3_finalize()] after it has finished with it.
+** ppStmt may not be NULL.
+**
+** ^On success, the sqlite3_prepare() family of routines return [SQLITE_OK];
+** otherwise an [error code] is returned.
+**
+** The sqlite3_prepare_v2(), sqlite3_prepare_v3(), sqlite3_prepare16_v2(),
+** and sqlite3_prepare16_v3() interfaces are recommended for all new programs.
+** The older interfaces (sqlite3_prepare() and sqlite3_prepare16())
+** are retained for backwards compatibility, but their use is discouraged.
+** ^In the "vX" interfaces, the prepared statement
+** that is returned (the [sqlite3_stmt] object) contains a copy of the
+** original SQL text. This causes the [sqlite3_step()] interface to
+** behave differently in three ways:
+**
+** <ol>
+** <li>
+** ^If the database schema changes, instead of returning [SQLITE_SCHEMA] as it
+** always used to do, [sqlite3_step()] will automatically recompile the SQL
+** statement and try to run it again. As many as [SQLITE_MAX_SCHEMA_RETRY]
+** retries will occur before sqlite3_step() gives up and returns an error.
+** </li>
+**
+** <li>
+** ^When an error occurs, [sqlite3_step()] will return one of the detailed
+** [error codes] or [extended error codes]. ^The legacy behavior was that
+** [sqlite3_step()] would only return a generic [SQLITE_ERROR] result code
+** and the application would have to make a second call to [sqlite3_reset()]
+** in order to find the underlying cause of the problem. With the "v2" prepare
+** interfaces, the underlying reason for the error is returned immediately.
+** </li>
+**
+** <li>
+** ^If the specific value bound to a [parameter | host parameter] in the
+** WHERE clause might influence the choice of query plan for a statement,
+** then the statement will be automatically recompiled, as if there had been
+** a schema change, on the first [sqlite3_step()] call following any change
+** to the [sqlite3_bind_text | bindings] of that [parameter].
+** ^The specific value of a WHERE-clause [parameter] might influence the
+** choice of query plan if the parameter is the left-hand side of a [LIKE]
+** or [GLOB] operator or if the parameter is compared to an indexed column
+** and the [SQLITE_ENABLE_STAT4] compile-time option is enabled.
+** </li>
+** </ol>
+**
+** <p>^sqlite3_prepare_v3() differs from sqlite3_prepare_v2() only in having
+** the extra prepFlags parameter, which is a bit array consisting of zero or
+** more of the [SQLITE_PREPARE_PERSISTENT|SQLITE_PREPARE_*] flags. ^The
+** sqlite3_prepare_v2() interface works exactly the same as
+** sqlite3_prepare_v3() with a zero prepFlags parameter.
+*/
+SQLITE_API int sqlite3_prepare(
+ sqlite3 *db, /* Database handle */
+ const char *zSql, /* SQL statement, UTF-8 encoded */
+ int nByte, /* Maximum length of zSql in bytes. */
+ sqlite3_stmt **ppStmt, /* OUT: Statement handle */
+ const char **pzTail /* OUT: Pointer to unused portion of zSql */
+);
+SQLITE_API int sqlite3_prepare_v2(
+ sqlite3 *db, /* Database handle */
+ const char *zSql, /* SQL statement, UTF-8 encoded */
+ int nByte, /* Maximum length of zSql in bytes. */
+ sqlite3_stmt **ppStmt, /* OUT: Statement handle */
+ const char **pzTail /* OUT: Pointer to unused portion of zSql */
+);
+SQLITE_API int sqlite3_prepare_v3(
+ sqlite3 *db, /* Database handle */
+ const char *zSql, /* SQL statement, UTF-8 encoded */
+ int nByte, /* Maximum length of zSql in bytes. */
+ unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_ flags */
+ sqlite3_stmt **ppStmt, /* OUT: Statement handle */
+ const char **pzTail /* OUT: Pointer to unused portion of zSql */
+);
+SQLITE_API int sqlite3_prepare16(
+ sqlite3 *db, /* Database handle */
+ const void *zSql, /* SQL statement, UTF-16 encoded */
+ int nByte, /* Maximum length of zSql in bytes. */
+ sqlite3_stmt **ppStmt, /* OUT: Statement handle */
+ const void **pzTail /* OUT: Pointer to unused portion of zSql */
+);
+SQLITE_API int sqlite3_prepare16_v2(
+ sqlite3 *db, /* Database handle */
+ const void *zSql, /* SQL statement, UTF-16 encoded */
+ int nByte, /* Maximum length of zSql in bytes. */
+ sqlite3_stmt **ppStmt, /* OUT: Statement handle */
+ const void **pzTail /* OUT: Pointer to unused portion of zSql */
+);
+SQLITE_API int sqlite3_prepare16_v3(
+ sqlite3 *db, /* Database handle */
+ const void *zSql, /* SQL statement, UTF-16 encoded */
+ int nByte, /* Maximum length of zSql in bytes. */
+ unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_ flags */
+ sqlite3_stmt **ppStmt, /* OUT: Statement handle */
+ const void **pzTail /* OUT: Pointer to unused portion of zSql */
+);
+
+/*
+** CAPI3REF: Retrieving Statement SQL
+** METHOD: sqlite3_stmt
+**
+** ^The sqlite3_sql(P) interface returns a pointer to a copy of the UTF-8
+** SQL text used to create [prepared statement] P if P was
+** created by [sqlite3_prepare_v2()], [sqlite3_prepare_v3()],
+** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()].
+** ^The sqlite3_expanded_sql(P) interface returns a pointer to a UTF-8
+** string containing the SQL text of prepared statement P with
+** [bound parameters] expanded.
+** ^The sqlite3_normalized_sql(P) interface returns a pointer to a UTF-8
+** string containing the normalized SQL text of prepared statement P. The
+** semantics used to normalize a SQL statement are unspecified and subject
+** to change. At a minimum, literal values will be replaced with suitable
+** placeholders.
+**
+** ^(For example, if a prepared statement is created using the SQL
+** text "SELECT $abc,:xyz" and if parameter $abc is bound to integer 2345
+** and parameter :xyz is unbound, then sqlite3_sql() will return
+** the original string, "SELECT $abc,:xyz" but sqlite3_expanded_sql()
+** will return "SELECT 2345,NULL".)^
+**
+** ^The sqlite3_expanded_sql() interface returns NULL if insufficient memory
+** is available to hold the result, or if the result would exceed the
+** the maximum string length determined by the [SQLITE_LIMIT_LENGTH].
+**
+** ^The [SQLITE_TRACE_SIZE_LIMIT] compile-time option limits the size of
+** bound parameter expansions. ^The [SQLITE_OMIT_TRACE] compile-time
+** option causes sqlite3_expanded_sql() to always return NULL.
+**
+** ^The strings returned by sqlite3_sql(P) and sqlite3_normalized_sql(P)
+** are managed by SQLite and are automatically freed when the prepared
+** statement is finalized.
+** ^The string returned by sqlite3_expanded_sql(P), on the other hand,
+** is obtained from [sqlite3_malloc()] and must be freed by the application
+** by passing it to [sqlite3_free()].
+**
+** ^The sqlite3_normalized_sql() interface is only available if
+** the [SQLITE_ENABLE_NORMALIZE] compile-time option is defined.
+*/
+SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt);
+SQLITE_API char *sqlite3_expanded_sql(sqlite3_stmt *pStmt);
+#ifdef SQLITE_ENABLE_NORMALIZE
+SQLITE_API const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt);
+#endif
+
+/*
+** CAPI3REF: Determine If An SQL Statement Writes The Database
+** METHOD: sqlite3_stmt
+**
+** ^The sqlite3_stmt_readonly(X) interface returns true (non-zero) if
+** and only if the [prepared statement] X makes no direct changes to
+** the content of the database file.
+**
+** Note that [application-defined SQL functions] or
+** [virtual tables] might change the database indirectly as a side effect.
+** ^(For example, if an application defines a function "eval()" that
+** calls [sqlite3_exec()], then the following SQL statement would
+** change the database file through side-effects:
+**
+** <blockquote><pre>
+** SELECT eval('DELETE FROM t1') FROM t2;
+** </pre></blockquote>
+**
+** But because the [SELECT] statement does not change the database file
+** directly, sqlite3_stmt_readonly() would still return true.)^
+**
+** ^Transaction control statements such as [BEGIN], [COMMIT], [ROLLBACK],
+** [SAVEPOINT], and [RELEASE] cause sqlite3_stmt_readonly() to return true,
+** since the statements themselves do not actually modify the database but
+** rather they control the timing of when other statements modify the
+** database. ^The [ATTACH] and [DETACH] statements also cause
+** sqlite3_stmt_readonly() to return true since, while those statements
+** change the configuration of a database connection, they do not make
+** changes to the content of the database files on disk.
+** ^The sqlite3_stmt_readonly() interface returns true for [BEGIN] since
+** [BEGIN] merely sets internal flags, but the [BEGIN|BEGIN IMMEDIATE] and
+** [BEGIN|BEGIN EXCLUSIVE] commands do touch the database and so
+** sqlite3_stmt_readonly() returns false for those commands.
+**
+** ^This routine returns false if there is any possibility that the
+** statement might change the database file. ^A false return does
+** not guarantee that the statement will change the database file.
+** ^For example, an UPDATE statement might have a WHERE clause that
+** makes it a no-op, but the sqlite3_stmt_readonly() result would still
+** be false. ^Similarly, a CREATE TABLE IF NOT EXISTS statement is a
+** read-only no-op if the table already exists, but
+** sqlite3_stmt_readonly() still returns false for such a statement.
+**
+** ^If prepared statement X is an [EXPLAIN] or [EXPLAIN QUERY PLAN]
+** statement, then sqlite3_stmt_readonly(X) returns the same value as
+** if the EXPLAIN or EXPLAIN QUERY PLAN prefix were omitted.
+*/
+SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
+
+/*
+** CAPI3REF: Query The EXPLAIN Setting For A Prepared Statement
+** METHOD: sqlite3_stmt
+**
+** ^The sqlite3_stmt_isexplain(S) interface returns 1 if the
+** prepared statement S is an EXPLAIN statement, or 2 if the
+** statement S is an EXPLAIN QUERY PLAN.
+** ^The sqlite3_stmt_isexplain(S) interface returns 0 if S is
+** an ordinary statement or a NULL pointer.
+*/
+SQLITE_API int sqlite3_stmt_isexplain(sqlite3_stmt *pStmt);
+
+/*
+** CAPI3REF: Change The EXPLAIN Setting For A Prepared Statement
+** METHOD: sqlite3_stmt
+**
+** The sqlite3_stmt_explain(S,E) interface changes the EXPLAIN
+** setting for [prepared statement] S. If E is zero, then S becomes
+** a normal prepared statement. If E is 1, then S behaves as if
+** its SQL text began with "[EXPLAIN]". If E is 2, then S behaves as if
+** its SQL text began with "[EXPLAIN QUERY PLAN]".
+**
+** Calling sqlite3_stmt_explain(S,E) might cause S to be reprepared.
+** SQLite tries to avoid a reprepare, but a reprepare might be necessary
+** on the first transition into EXPLAIN or EXPLAIN QUERY PLAN mode.
+**
+** Because of the potential need to reprepare, a call to
+** sqlite3_stmt_explain(S,E) will fail with SQLITE_ERROR if S cannot be
+** reprepared because it was created using [sqlite3_prepare()] instead of
+** the newer [sqlite3_prepare_v2()] or [sqlite3_prepare_v3()] interfaces and
+** hence has no saved SQL text with which to reprepare.
+**
+** Changing the explain setting for a prepared statement does not change
+** the original SQL text for the statement. Hence, if the SQL text originally
+** began with EXPLAIN or EXPLAIN QUERY PLAN, but sqlite3_stmt_explain(S,0)
+** is called to convert the statement into an ordinary statement, the EXPLAIN
+** or EXPLAIN QUERY PLAN keywords will still appear in the sqlite3_sql(S)
+** output, even though the statement now acts like a normal SQL statement.
+**
+** This routine returns SQLITE_OK if the explain mode is successfully
+** changed, or an error code if the explain mode could not be changed.
+** The explain mode cannot be changed while a statement is active.
+** Hence, it is good practice to call [sqlite3_reset(S)]
+** immediately prior to calling sqlite3_stmt_explain(S,E).
+*/
+SQLITE_API int sqlite3_stmt_explain(sqlite3_stmt *pStmt, int eMode);
+
+/*
+** CAPI3REF: Determine If A Prepared Statement Has Been Reset
+** METHOD: sqlite3_stmt
+**
+** ^The sqlite3_stmt_busy(S) interface returns true (non-zero) if the
+** [prepared statement] S has been stepped at least once using
+** [sqlite3_step(S)] but has neither run to completion (returned
+** [SQLITE_DONE] from [sqlite3_step(S)]) nor
+** been reset using [sqlite3_reset(S)]. ^The sqlite3_stmt_busy(S)
+** interface returns false if S is a NULL pointer. If S is not a
+** NULL pointer and is not a pointer to a valid [prepared statement]
+** object, then the behavior is undefined and probably undesirable.
+**
+** This interface can be used in combination [sqlite3_next_stmt()]
+** to locate all prepared statements associated with a database
+** connection that are in need of being reset. This can be used,
+** for example, in diagnostic routines to search for prepared
+** statements that are holding a transaction open.
+*/
+SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*);
+
+/*
+** CAPI3REF: Dynamically Typed Value Object
+** KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value}
+**
+** SQLite uses the sqlite3_value object to represent all values
+** that can be stored in a database table. SQLite uses dynamic typing
+** for the values it stores. ^Values stored in sqlite3_value objects
+** can be integers, floating point values, strings, BLOBs, or NULL.
+**
+** An sqlite3_value object may be either "protected" or "unprotected".
+** Some interfaces require a protected sqlite3_value. Other interfaces
+** will accept either a protected or an unprotected sqlite3_value.
+** Every interface that accepts sqlite3_value arguments specifies
+** whether or not it requires a protected sqlite3_value. The
+** [sqlite3_value_dup()] interface can be used to construct a new
+** protected sqlite3_value from an unprotected sqlite3_value.
+**
+** The terms "protected" and "unprotected" refer to whether or not
+** a mutex is held. An internal mutex is held for a protected
+** sqlite3_value object but no mutex is held for an unprotected
+** sqlite3_value object. If SQLite is compiled to be single-threaded
+** (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0)
+** or if SQLite is run in one of reduced mutex modes
+** [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD]
+** then there is no distinction between protected and unprotected
+** sqlite3_value objects and they can be used interchangeably. However,
+** for maximum code portability it is recommended that applications
+** still make the distinction between protected and unprotected
+** sqlite3_value objects even when not strictly required.
+**
+** ^The sqlite3_value objects that are passed as parameters into the
+** implementation of [application-defined SQL functions] are protected.
+** ^The sqlite3_value objects returned by [sqlite3_vtab_rhs_value()]
+** are protected.
+** ^The sqlite3_value object returned by
+** [sqlite3_column_value()] is unprotected.
+** Unprotected sqlite3_value objects may only be used as arguments
+** to [sqlite3_result_value()], [sqlite3_bind_value()], and
+** [sqlite3_value_dup()].
+** The [sqlite3_value_blob | sqlite3_value_type()] family of
+** interfaces require protected sqlite3_value objects.
+*/
+typedef struct sqlite3_value sqlite3_value;
+
+/*
+** CAPI3REF: SQL Function Context Object
+**
+** The context in which an SQL function executes is stored in an
+** sqlite3_context object. ^A pointer to an sqlite3_context object
+** is always first parameter to [application-defined SQL functions].
+** The application-defined SQL function implementation will pass this
+** pointer through into calls to [sqlite3_result_int | sqlite3_result()],
+** [sqlite3_aggregate_context()], [sqlite3_user_data()],
+** [sqlite3_context_db_handle()], [sqlite3_get_auxdata()],
+** and/or [sqlite3_set_auxdata()].
+*/
+typedef struct sqlite3_context sqlite3_context;
+
+/*
+** CAPI3REF: Binding Values To Prepared Statements
+** KEYWORDS: {host parameter} {host parameters} {host parameter name}
+** KEYWORDS: {SQL parameter} {SQL parameters} {parameter binding}
+** METHOD: sqlite3_stmt
+**
+** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants,
+** literals may be replaced by a [parameter] that matches one of following
+** templates:
+**
+** <ul>
+** <li> ?
+** <li> ?NNN
+** <li> :VVV
+** <li> @VVV
+** <li> $VVV
+** </ul>
+**
+** In the templates above, NNN represents an integer literal,
+** and VVV represents an alphanumeric identifier.)^ ^The values of these
+** parameters (also called "host parameter names" or "SQL parameters")
+** can be set using the sqlite3_bind_*() routines defined here.
+**
+** ^The first argument to the sqlite3_bind_*() routines is always
+** a pointer to the [sqlite3_stmt] object returned from
+** [sqlite3_prepare_v2()] or its variants.
+**
+** ^The second argument is the index of the SQL parameter to be set.
+** ^The leftmost SQL parameter has an index of 1. ^When the same named
+** SQL parameter is used more than once, second and subsequent
+** occurrences have the same index as the first occurrence.
+** ^The index for named parameters can be looked up using the
+** [sqlite3_bind_parameter_index()] API if desired. ^The index
+** for "?NNN" parameters is the value of NNN.
+** ^The NNN value must be between 1 and the [sqlite3_limit()]
+** parameter [SQLITE_LIMIT_VARIABLE_NUMBER] (default value: 32766).
+**
+** ^The third argument is the value to bind to the parameter.
+** ^If the third parameter to sqlite3_bind_text() or sqlite3_bind_text16()
+** or sqlite3_bind_blob() is a NULL pointer then the fourth parameter
+** is ignored and the end result is the same as sqlite3_bind_null().
+** ^If the third parameter to sqlite3_bind_text() is not NULL, then
+** it should be a pointer to well-formed UTF8 text.
+** ^If the third parameter to sqlite3_bind_text16() is not NULL, then
+** it should be a pointer to well-formed UTF16 text.
+** ^If the third parameter to sqlite3_bind_text64() is not NULL, then
+** it should be a pointer to a well-formed unicode string that is
+** either UTF8 if the sixth parameter is SQLITE_UTF8, or UTF16
+** otherwise.
+**
+** [[byte-order determination rules]] ^The byte-order of
+** UTF16 input text is determined by the byte-order mark (BOM, U+FEFF)
+** found in first character, which is removed, or in the absence of a BOM
+** the byte order is the native byte order of the host
+** machine for sqlite3_bind_text16() or the byte order specified in
+** the 6th parameter for sqlite3_bind_text64().)^
+** ^If UTF16 input text contains invalid unicode
+** characters, then SQLite might change those invalid characters
+** into the unicode replacement character: U+FFFD.
+**
+** ^(In those routines that have a fourth argument, its value is the
+** number of bytes in the parameter. To be clear: the value is the
+** number of <u>bytes</u> in the value, not the number of characters.)^
+** ^If the fourth parameter to sqlite3_bind_text() or sqlite3_bind_text16()
+** is negative, then the length of the string is
+** the number of bytes up to the first zero terminator.
+** If the fourth parameter to sqlite3_bind_blob() is negative, then
+** the behavior is undefined.
+** If a non-negative fourth parameter is provided to sqlite3_bind_text()
+** or sqlite3_bind_text16() or sqlite3_bind_text64() then
+** that parameter must be the byte offset
+** where the NUL terminator would occur assuming the string were NUL
+** terminated. If any NUL characters occurs at byte offsets less than
+** the value of the fourth parameter then the resulting string value will
+** contain embedded NULs. The result of expressions involving strings
+** with embedded NULs is undefined.
+**
+** ^The fifth argument to the BLOB and string binding interfaces controls
+** or indicates the lifetime of the object referenced by the third parameter.
+** These three options exist:
+** ^ (1) A destructor to dispose of the BLOB or string after SQLite has finished
+** with it may be passed. ^It is called to dispose of the BLOB or string even
+** if the call to the bind API fails, except the destructor is not called if
+** the third parameter is a NULL pointer or the fourth parameter is negative.
+** ^ (2) The special constant, [SQLITE_STATIC], may be passed to indicate that
+** the application remains responsible for disposing of the object. ^In this
+** case, the object and the provided pointer to it must remain valid until
+** either the prepared statement is finalized or the same SQL parameter is
+** bound to something else, whichever occurs sooner.
+** ^ (3) The constant, [SQLITE_TRANSIENT], may be passed to indicate that the
+** object is to be copied prior to the return from sqlite3_bind_*(). ^The
+** object and pointer to it must remain valid until then. ^SQLite will then
+** manage the lifetime of its private copy.
+**
+** ^The sixth argument to sqlite3_bind_text64() must be one of
+** [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE]
+** to specify the encoding of the text in the third parameter. If
+** the sixth argument to sqlite3_bind_text64() is not one of the
+** allowed values shown above, or if the text encoding is different
+** from the encoding specified by the sixth parameter, then the behavior
+** is undefined.
+**
+** ^The sqlite3_bind_zeroblob() routine binds a BLOB of length N that
+** is filled with zeroes. ^A zeroblob uses a fixed amount of memory
+** (just an integer to hold its size) while it is being processed.
+** Zeroblobs are intended to serve as placeholders for BLOBs whose
+** content is later written using
+** [sqlite3_blob_open | incremental BLOB I/O] routines.
+** ^A negative value for the zeroblob results in a zero-length BLOB.
+**
+** ^The sqlite3_bind_pointer(S,I,P,T,D) routine causes the I-th parameter in
+** [prepared statement] S to have an SQL value of NULL, but to also be
+** associated with the pointer P of type T. ^D is either a NULL pointer or
+** a pointer to a destructor function for P. ^SQLite will invoke the
+** destructor D with a single argument of P when it is finished using
+** P. The T parameter should be a static string, preferably a string
+** literal. The sqlite3_bind_pointer() routine is part of the
+** [pointer passing interface] added for SQLite 3.20.0.
+**
+** ^If any of the sqlite3_bind_*() routines are called with a NULL pointer
+** for the [prepared statement] or with a prepared statement for which
+** [sqlite3_step()] has been called more recently than [sqlite3_reset()],
+** then the call will return [SQLITE_MISUSE]. If any sqlite3_bind_()
+** routine is passed a [prepared statement] that has been finalized, the
+** result is undefined and probably harmful.
+**
+** ^Bindings are not cleared by the [sqlite3_reset()] routine.
+** ^Unbound parameters are interpreted as NULL.
+**
+** ^The sqlite3_bind_* routines return [SQLITE_OK] on success or an
+** [error code] if anything goes wrong.
+** ^[SQLITE_TOOBIG] might be returned if the size of a string or BLOB
+** exceeds limits imposed by [sqlite3_limit]([SQLITE_LIMIT_LENGTH]) or
+** [SQLITE_MAX_LENGTH].
+** ^[SQLITE_RANGE] is returned if the parameter
+** index is out of range. ^[SQLITE_NOMEM] is returned if malloc() fails.
+**
+** See also: [sqlite3_bind_parameter_count()],
+** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()].
+*/
+SQLITE_API int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
+SQLITE_API int sqlite3_bind_blob64(sqlite3_stmt*, int, const void*, sqlite3_uint64,
+ void(*)(void*));
+SQLITE_API int sqlite3_bind_double(sqlite3_stmt*, int, double);
+SQLITE_API int sqlite3_bind_int(sqlite3_stmt*, int, int);
+SQLITE_API int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
+SQLITE_API int sqlite3_bind_null(sqlite3_stmt*, int);
+SQLITE_API int sqlite3_bind_text(sqlite3_stmt*,int,const char*,int,void(*)(void*));
+SQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));
+SQLITE_API int sqlite3_bind_text64(sqlite3_stmt*, int, const char*, sqlite3_uint64,
+ void(*)(void*), unsigned char encoding);
+SQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
+SQLITE_API int sqlite3_bind_pointer(sqlite3_stmt*, int, void*, const char*,void(*)(void*));
+SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
+SQLITE_API int sqlite3_bind_zeroblob64(sqlite3_stmt*, int, sqlite3_uint64);
+
+/*
+** CAPI3REF: Number Of SQL Parameters
+** METHOD: sqlite3_stmt
+**
+** ^This routine can be used to find the number of [SQL parameters]
+** in a [prepared statement]. SQL parameters are tokens of the
+** form "?", "?NNN", ":AAA", "$AAA", or "@AAA" that serve as
+** placeholders for values that are [sqlite3_bind_blob | bound]
+** to the parameters at a later time.
+**
+** ^(This routine actually returns the index of the largest (rightmost)
+** parameter. For all forms except ?NNN, this will correspond to the
+** number of unique parameters. If parameters of the ?NNN form are used,
+** there may be gaps in the list.)^
+**
+** See also: [sqlite3_bind_blob|sqlite3_bind()],
+** [sqlite3_bind_parameter_name()], and
+** [sqlite3_bind_parameter_index()].
+*/
+SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*);
+
+/*
+** CAPI3REF: Name Of A Host Parameter
+** METHOD: sqlite3_stmt
+**
+** ^The sqlite3_bind_parameter_name(P,N) interface returns
+** the name of the N-th [SQL parameter] in the [prepared statement] P.
+** ^(SQL parameters of the form "?NNN" or ":AAA" or "@AAA" or "$AAA"
+** have a name which is the string "?NNN" or ":AAA" or "@AAA" or "$AAA"
+** respectively.
+** In other words, the initial ":" or "$" or "@" or "?"
+** is included as part of the name.)^
+** ^Parameters of the form "?" without a following integer have no name
+** and are referred to as "nameless" or "anonymous parameters".
+**
+** ^The first host parameter has an index of 1, not 0.
+**
+** ^If the value N is out of range or if the N-th parameter is
+** nameless, then NULL is returned. ^The returned string is
+** always in UTF-8 encoding even if the named parameter was
+** originally specified as UTF-16 in [sqlite3_prepare16()],
+** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()].
+**
+** See also: [sqlite3_bind_blob|sqlite3_bind()],
+** [sqlite3_bind_parameter_count()], and
+** [sqlite3_bind_parameter_index()].
+*/
+SQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int);
+
+/*
+** CAPI3REF: Index Of A Parameter With A Given Name
+** METHOD: sqlite3_stmt
+**
+** ^Return the index of an SQL parameter given its name. ^The
+** index value returned is suitable for use as the second
+** parameter to [sqlite3_bind_blob|sqlite3_bind()]. ^A zero
+** is returned if no matching parameter is found. ^The parameter
+** name must be given in UTF-8 even if the original statement
+** was prepared from UTF-16 text using [sqlite3_prepare16_v2()] or
+** [sqlite3_prepare16_v3()].
+**
+** See also: [sqlite3_bind_blob|sqlite3_bind()],
+** [sqlite3_bind_parameter_count()], and
+** [sqlite3_bind_parameter_name()].
+*/
+SQLITE_API int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);
+
+/*
+** CAPI3REF: Reset All Bindings On A Prepared Statement
+** METHOD: sqlite3_stmt
+**
+** ^Contrary to the intuition of many, [sqlite3_reset()] does not reset
+** the [sqlite3_bind_blob | bindings] on a [prepared statement].
+** ^Use this routine to reset all host parameters to NULL.
+*/
+SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt*);
+
+/*
+** CAPI3REF: Number Of Columns In A Result Set
+** METHOD: sqlite3_stmt
+**
+** ^Return the number of columns in the result set returned by the
+** [prepared statement]. ^If this routine returns 0, that means the
+** [prepared statement] returns no data (for example an [UPDATE]).
+** ^However, just because this routine returns a positive number does not
+** mean that one or more rows of data will be returned. ^A SELECT statement
+** will always have a positive sqlite3_column_count() but depending on the
+** WHERE clause constraints and the table content, it might return no rows.
+**
+** See also: [sqlite3_data_count()]
+*/
+SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt);
+
+/*
+** CAPI3REF: Column Names In A Result Set
+** METHOD: sqlite3_stmt
+**
+** ^These routines return the name assigned to a particular column
+** in the result set of a [SELECT] statement. ^The sqlite3_column_name()
+** interface returns a pointer to a zero-terminated UTF-8 string
+** and sqlite3_column_name16() returns a pointer to a zero-terminated
+** UTF-16 string. ^The first parameter is the [prepared statement]
+** that implements the [SELECT] statement. ^The second parameter is the
+** column number. ^The leftmost column is number 0.
+**
+** ^The returned string pointer is valid until either the [prepared statement]
+** is destroyed by [sqlite3_finalize()] or until the statement is automatically
+** reprepared by the first call to [sqlite3_step()] for a particular run
+** or until the next call to
+** sqlite3_column_name() or sqlite3_column_name16() on the same column.
+**
+** ^If sqlite3_malloc() fails during the processing of either routine
+** (for example during a conversion from UTF-8 to UTF-16) then a
+** NULL pointer is returned.
+**
+** ^The name of a result column is the value of the "AS" clause for
+** that column, if there is an AS clause. If there is no AS clause
+** then the name of the column is unspecified and may change from
+** one release of SQLite to the next.
+*/
+SQLITE_API const char *sqlite3_column_name(sqlite3_stmt*, int N);
+SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N);
+
+/*
+** CAPI3REF: Source Of Data In A Query Result
+** METHOD: sqlite3_stmt
+**
+** ^These routines provide a means to determine the database, table, and
+** table column that is the origin of a particular result column in
+** [SELECT] statement.
+** ^The name of the database or table or column can be returned as
+** either a UTF-8 or UTF-16 string. ^The _database_ routines return
+** the database name, the _table_ routines return the table name, and
+** the origin_ routines return the column name.
+** ^The returned string is valid until the [prepared statement] is destroyed
+** using [sqlite3_finalize()] or until the statement is automatically
+** reprepared by the first call to [sqlite3_step()] for a particular run
+** or until the same information is requested
+** again in a different encoding.
+**
+** ^The names returned are the original un-aliased names of the
+** database, table, and column.
+**
+** ^The first argument to these interfaces is a [prepared statement].
+** ^These functions return information about the Nth result column returned by
+** the statement, where N is the second function argument.
+** ^The left-most column is column 0 for these routines.
+**
+** ^If the Nth column returned by the statement is an expression or
+** subquery and is not a column value, then all of these functions return
+** NULL. ^These routines might also return NULL if a memory allocation error
+** occurs. ^Otherwise, they return the name of the attached database, table,
+** or column that query result column was extracted from.
+**
+** ^As with all other SQLite APIs, those whose names end with "16" return
+** UTF-16 encoded strings and the other functions return UTF-8.
+**
+** ^These APIs are only available if the library was compiled with the
+** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol.
+**
+** If two or more threads call one or more
+** [sqlite3_column_database_name | column metadata interfaces]
+** for the same [prepared statement] and result column
+** at the same time then the results are undefined.
+*/
+SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt*,int);
+SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt*,int);
+SQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt*,int);
+SQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt*,int);
+SQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt*,int);
+SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt*,int);
+
+/*
+** CAPI3REF: Declared Datatype Of A Query Result
+** METHOD: sqlite3_stmt
+**
+** ^(The first parameter is a [prepared statement].
+** If this statement is a [SELECT] statement and the Nth column of the
+** returned result set of that [SELECT] is a table column (not an
+** expression or subquery) then the declared type of the table
+** column is returned.)^ ^If the Nth column of the result set is an
+** expression or subquery, then a NULL pointer is returned.
+** ^The returned string is always UTF-8 encoded.
+**
+** ^(For example, given the database schema:
+**
+** CREATE TABLE t1(c1 VARIANT);
+**
+** and the following statement to be compiled:
+**
+** SELECT c1 + 1, c1 FROM t1;
+**
+** this routine would return the string "VARIANT" for the second result
+** column (i==1), and a NULL pointer for the first result column (i==0).)^
+**
+** ^SQLite uses dynamic run-time typing. ^So just because a column
+** is declared to contain a particular type does not mean that the
+** data stored in that column is of the declared type. SQLite is
+** strongly typed, but the typing is dynamic not static. ^Type
+** is associated with individual values, not with the containers
+** used to hold those values.
+*/
+SQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt*,int);
+SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
+
+/*
+** CAPI3REF: Evaluate An SQL Statement
+** METHOD: sqlite3_stmt
+**
+** After a [prepared statement] has been prepared using any of
+** [sqlite3_prepare_v2()], [sqlite3_prepare_v3()], [sqlite3_prepare16_v2()],
+** or [sqlite3_prepare16_v3()] or one of the legacy
+** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function
+** must be called one or more times to evaluate the statement.
+**
+** The details of the behavior of the sqlite3_step() interface depend
+** on whether the statement was prepared using the newer "vX" interfaces
+** [sqlite3_prepare_v3()], [sqlite3_prepare_v2()], [sqlite3_prepare16_v3()],
+** [sqlite3_prepare16_v2()] or the older legacy
+** interfaces [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the
+** new "vX" interface is recommended for new applications but the legacy
+** interface will continue to be supported.
+**
+** ^In the legacy interface, the return value will be either [SQLITE_BUSY],
+** [SQLITE_DONE], [SQLITE_ROW], [SQLITE_ERROR], or [SQLITE_MISUSE].
+** ^With the "v2" interface, any of the other [result codes] or
+** [extended result codes] might be returned as well.
+**
+** ^[SQLITE_BUSY] means that the database engine was unable to acquire the
+** database locks it needs to do its job. ^If the statement is a [COMMIT]
+** or occurs outside of an explicit transaction, then you can retry the
+** statement. If the statement is not a [COMMIT] and occurs within an
+** explicit transaction then you should rollback the transaction before
+** continuing.
+**
+** ^[SQLITE_DONE] means that the statement has finished executing
+** successfully. sqlite3_step() should not be called again on this virtual
+** machine without first calling [sqlite3_reset()] to reset the virtual
+** machine back to its initial state.
+**
+** ^If the SQL statement being executed returns any data, then [SQLITE_ROW]
+** is returned each time a new row of data is ready for processing by the
+** caller. The values may be accessed using the [column access functions].
+** sqlite3_step() is called again to retrieve the next row of data.
+**
+** ^[SQLITE_ERROR] means that a run-time error (such as a constraint
+** violation) has occurred. sqlite3_step() should not be called again on
+** the VM. More information may be found by calling [sqlite3_errmsg()].
+** ^With the legacy interface, a more specific error code (for example,
+** [SQLITE_INTERRUPT], [SQLITE_SCHEMA], [SQLITE_CORRUPT], and so forth)
+** can be obtained by calling [sqlite3_reset()] on the
+** [prepared statement]. ^In the "v2" interface,
+** the more specific error code is returned directly by sqlite3_step().
+**
+** [SQLITE_MISUSE] means that the this routine was called inappropriately.
+** Perhaps it was called on a [prepared statement] that has
+** already been [sqlite3_finalize | finalized] or on one that had
+** previously returned [SQLITE_ERROR] or [SQLITE_DONE]. Or it could
+** be the case that the same database connection is being used by two or
+** more threads at the same moment in time.
+**
+** For all versions of SQLite up to and including 3.6.23.1, a call to
+** [sqlite3_reset()] was required after sqlite3_step() returned anything
+** other than [SQLITE_ROW] before any subsequent invocation of
+** sqlite3_step(). Failure to reset the prepared statement using
+** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
+** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1],
+** sqlite3_step() began
+** calling [sqlite3_reset()] automatically in this circumstance rather
+** than returning [SQLITE_MISUSE]. This is not considered a compatibility
+** break because any application that ever receives an SQLITE_MISUSE error
+** is broken by definition. The [SQLITE_OMIT_AUTORESET] compile-time option
+** can be used to restore the legacy behavior.
+**
+** <b>Goofy Interface Alert:</b> In the legacy interface, the sqlite3_step()
+** API always returns a generic error code, [SQLITE_ERROR], following any
+** error other than [SQLITE_BUSY] and [SQLITE_MISUSE]. You must call
+** [sqlite3_reset()] or [sqlite3_finalize()] in order to find one of the
+** specific [error codes] that better describes the error.
+** We admit that this is a goofy design. The problem has been fixed
+** with the "v2" interface. If you prepare all of your SQL statements
+** using [sqlite3_prepare_v3()] or [sqlite3_prepare_v2()]
+** or [sqlite3_prepare16_v2()] or [sqlite3_prepare16_v3()] instead
+** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces,
+** then the more specific [error codes] are returned directly
+** by sqlite3_step(). The use of the "vX" interfaces is recommended.
+*/
+SQLITE_API int sqlite3_step(sqlite3_stmt*);
+
+/*
+** CAPI3REF: Number of columns in a result set
+** METHOD: sqlite3_stmt
+**
+** ^The sqlite3_data_count(P) interface returns the number of columns in the
+** current row of the result set of [prepared statement] P.
+** ^If prepared statement P does not have results ready to return
+** (via calls to the [sqlite3_column_int | sqlite3_column()] family of
+** interfaces) then sqlite3_data_count(P) returns 0.
+** ^The sqlite3_data_count(P) routine also returns 0 if P is a NULL pointer.
+** ^The sqlite3_data_count(P) routine returns 0 if the previous call to
+** [sqlite3_step](P) returned [SQLITE_DONE]. ^The sqlite3_data_count(P)
+** will return non-zero if previous call to [sqlite3_step](P) returned
+** [SQLITE_ROW], except in the case of the [PRAGMA incremental_vacuum]
+** where it always returns zero since each step of that multi-step
+** pragma returns 0 columns of data.
+**
+** See also: [sqlite3_column_count()]
+*/
+SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
+
+/*
+** CAPI3REF: Fundamental Datatypes
+** KEYWORDS: SQLITE_TEXT
+**
+** ^(Every value in SQLite has one of five fundamental datatypes:
+**
+** <ul>
+** <li> 64-bit signed integer
+** <li> 64-bit IEEE floating point number
+** <li> string
+** <li> BLOB
+** <li> NULL
+** </ul>)^
+**
+** These constants are codes for each of those types.
+**
+** Note that the SQLITE_TEXT constant was also used in SQLite version 2
+** for a completely different meaning. Software that links against both
+** SQLite version 2 and SQLite version 3 should use SQLITE3_TEXT, not
+** SQLITE_TEXT.
+*/
+#define SQLITE_INTEGER 1
+#define SQLITE_FLOAT 2
+#define SQLITE_BLOB 4
+#define SQLITE_NULL 5
+#ifdef SQLITE_TEXT
+# undef SQLITE_TEXT
+#else
+# define SQLITE_TEXT 3
+#endif
+#define SQLITE3_TEXT 3
+
+/*
+** CAPI3REF: Result Values From A Query
+** KEYWORDS: {column access functions}
+** METHOD: sqlite3_stmt
+**
+** <b>Summary:</b>
+** <blockquote><table border=0 cellpadding=0 cellspacing=0>
+** <tr><td><b>sqlite3_column_blob</b><td>→<td>BLOB result
+** <tr><td><b>sqlite3_column_double</b><td>→<td>REAL result
+** <tr><td><b>sqlite3_column_int</b><td>→<td>32-bit INTEGER result
+** <tr><td><b>sqlite3_column_int64</b><td>→<td>64-bit INTEGER result
+** <tr><td><b>sqlite3_column_text</b><td>→<td>UTF-8 TEXT result
+** <tr><td><b>sqlite3_column_text16</b><td>→<td>UTF-16 TEXT result
+** <tr><td><b>sqlite3_column_value</b><td>→<td>The result as an
+** [sqlite3_value|unprotected sqlite3_value] object.
+** <tr><td> <td> <td>
+** <tr><td><b>sqlite3_column_bytes</b><td>→<td>Size of a BLOB
+** or a UTF-8 TEXT result in bytes
+** <tr><td><b>sqlite3_column_bytes16 </b>
+** <td>→ <td>Size of UTF-16
+** TEXT in bytes
+** <tr><td><b>sqlite3_column_type</b><td>→<td>Default
+** datatype of the result
+** </table></blockquote>
+**
+** <b>Details:</b>
+**
+** ^These routines return information about a single column of the current
+** result row of a query. ^In every case the first argument is a pointer
+** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*]
+** that was returned from [sqlite3_prepare_v2()] or one of its variants)
+** and the second argument is the index of the column for which information
+** should be returned. ^The leftmost column of the result set has the index 0.
+** ^The number of columns in the result can be determined using
+** [sqlite3_column_count()].
+**
+** If the SQL statement does not currently point to a valid row, or if the
+** column index is out of range, the result is undefined.
+** These routines may only be called when the most recent call to
+** [sqlite3_step()] has returned [SQLITE_ROW] and neither
+** [sqlite3_reset()] nor [sqlite3_finalize()] have been called subsequently.
+** If any of these routines are called after [sqlite3_reset()] or
+** [sqlite3_finalize()] or after [sqlite3_step()] has returned
+** something other than [SQLITE_ROW], the results are undefined.
+** If [sqlite3_step()] or [sqlite3_reset()] or [sqlite3_finalize()]
+** are called from a different thread while any of these routines
+** are pending, then the results are undefined.
+**
+** The first six interfaces (_blob, _double, _int, _int64, _text, and _text16)
+** each return the value of a result column in a specific data format. If
+** the result column is not initially in the requested format (for example,
+** if the query returns an integer but the sqlite3_column_text() interface
+** is used to extract the value) then an automatic type conversion is performed.
+**
+** ^The sqlite3_column_type() routine returns the
+** [SQLITE_INTEGER | datatype code] for the initial data type
+** of the result column. ^The returned value is one of [SQLITE_INTEGER],
+** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].
+** The return value of sqlite3_column_type() can be used to decide which
+** of the first six interface should be used to extract the column value.
+** The value returned by sqlite3_column_type() is only meaningful if no
+** automatic type conversions have occurred for the value in question.
+** After a type conversion, the result of calling sqlite3_column_type()
+** is undefined, though harmless. Future
+** versions of SQLite may change the behavior of sqlite3_column_type()
+** following a type conversion.
+**
+** If the result is a BLOB or a TEXT string, then the sqlite3_column_bytes()
+** or sqlite3_column_bytes16() interfaces can be used to determine the size
+** of that BLOB or string.
+**
+** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes()
+** routine returns the number of bytes in that BLOB or string.
+** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts
+** the string to UTF-8 and then returns the number of bytes.
+** ^If the result is a numeric value then sqlite3_column_bytes() uses
+** [sqlite3_snprintf()] to convert that value to a UTF-8 string and returns
+** the number of bytes in that string.
+** ^If the result is NULL, then sqlite3_column_bytes() returns zero.
+**
+** ^If the result is a BLOB or UTF-16 string then the sqlite3_column_bytes16()
+** routine returns the number of bytes in that BLOB or string.
+** ^If the result is a UTF-8 string, then sqlite3_column_bytes16() converts
+** the string to UTF-16 and then returns the number of bytes.
+** ^If the result is a numeric value then sqlite3_column_bytes16() uses
+** [sqlite3_snprintf()] to convert that value to a UTF-16 string and returns
+** the number of bytes in that string.
+** ^If the result is NULL, then sqlite3_column_bytes16() returns zero.
+**
+** ^The values returned by [sqlite3_column_bytes()] and
+** [sqlite3_column_bytes16()] do not include the zero terminators at the end
+** of the string. ^For clarity: the values returned by
+** [sqlite3_column_bytes()] and [sqlite3_column_bytes16()] are the number of
+** bytes in the string, not the number of characters.
+**
+** ^Strings returned by sqlite3_column_text() and sqlite3_column_text16(),
+** even empty strings, are always zero-terminated. ^The return
+** value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer.
+**
+** ^Strings returned by sqlite3_column_text16() always have the endianness
+** which is native to the platform, regardless of the text encoding set
+** for the database.
+**
+** <b>Warning:</b> ^The object returned by [sqlite3_column_value()] is an
+** [unprotected sqlite3_value] object. In a multithreaded environment,
+** an unprotected sqlite3_value object may only be used safely with
+** [sqlite3_bind_value()] and [sqlite3_result_value()].
+** If the [unprotected sqlite3_value] object returned by
+** [sqlite3_column_value()] is used in any other way, including calls
+** to routines like [sqlite3_value_int()], [sqlite3_value_text()],
+** or [sqlite3_value_bytes()], the behavior is not threadsafe.
+** Hence, the sqlite3_column_value() interface
+** is normally only useful within the implementation of
+** [application-defined SQL functions] or [virtual tables], not within
+** top-level application code.
+**
+** These routines may attempt to convert the datatype of the result.
+** ^For example, if the internal representation is FLOAT and a text result
+** is requested, [sqlite3_snprintf()] is used internally to perform the
+** conversion automatically. ^(The following table details the conversions
+** that are applied:
+**
+** <blockquote>
+** <table border="1">
+** <tr><th> Internal<br>Type <th> Requested<br>Type <th> Conversion
+**
+** <tr><td> NULL <td> INTEGER <td> Result is 0
+** <tr><td> NULL <td> FLOAT <td> Result is 0.0
+** <tr><td> NULL <td> TEXT <td> Result is a NULL pointer
+** <tr><td> NULL <td> BLOB <td> Result is a NULL pointer
+** <tr><td> INTEGER <td> FLOAT <td> Convert from integer to float
+** <tr><td> INTEGER <td> TEXT <td> ASCII rendering of the integer
+** <tr><td> INTEGER <td> BLOB <td> Same as INTEGER->TEXT
+** <tr><td> FLOAT <td> INTEGER <td> [CAST] to INTEGER
+** <tr><td> FLOAT <td> TEXT <td> ASCII rendering of the float
+** <tr><td> FLOAT <td> BLOB <td> [CAST] to BLOB
+** <tr><td> TEXT <td> INTEGER <td> [CAST] to INTEGER
+** <tr><td> TEXT <td> FLOAT <td> [CAST] to REAL
+** <tr><td> TEXT <td> BLOB <td> No change
+** <tr><td> BLOB <td> INTEGER <td> [CAST] to INTEGER
+** <tr><td> BLOB <td> FLOAT <td> [CAST] to REAL
+** <tr><td> BLOB <td> TEXT <td> [CAST] to TEXT, ensure zero terminator
+** </table>
+** </blockquote>)^
+**
+** Note that when type conversions occur, pointers returned by prior
+** calls to sqlite3_column_blob(), sqlite3_column_text(), and/or
+** sqlite3_column_text16() may be invalidated.
+** Type conversions and pointer invalidations might occur
+** in the following cases:
+**
+** <ul>
+** <li> The initial content is a BLOB and sqlite3_column_text() or
+** sqlite3_column_text16() is called. A zero-terminator might
+** need to be added to the string.</li>
+** <li> The initial content is UTF-8 text and sqlite3_column_bytes16() or
+** sqlite3_column_text16() is called. The content must be converted
+** to UTF-16.</li>
+** <li> The initial content is UTF-16 text and sqlite3_column_bytes() or
+** sqlite3_column_text() is called. The content must be converted
+** to UTF-8.</li>
+** </ul>
+**
+** ^Conversions between UTF-16be and UTF-16le are always done in place and do
+** not invalidate a prior pointer, though of course the content of the buffer
+** that the prior pointer references will have been modified. Other kinds
+** of conversion are done in place when it is possible, but sometimes they
+** are not possible and in those cases prior pointers are invalidated.
+**
+** The safest policy is to invoke these routines
+** in one of the following ways:
+**
+** <ul>
+** <li>sqlite3_column_text() followed by sqlite3_column_bytes()</li>
+** <li>sqlite3_column_blob() followed by sqlite3_column_bytes()</li>
+** <li>sqlite3_column_text16() followed by sqlite3_column_bytes16()</li>
+** </ul>
+**
+** In other words, you should call sqlite3_column_text(),
+** sqlite3_column_blob(), or sqlite3_column_text16() first to force the result
+** into the desired format, then invoke sqlite3_column_bytes() or
+** sqlite3_column_bytes16() to find the size of the result. Do not mix calls
+** to sqlite3_column_text() or sqlite3_column_blob() with calls to
+** sqlite3_column_bytes16(), and do not mix calls to sqlite3_column_text16()
+** with calls to sqlite3_column_bytes().
+**
+** ^The pointers returned are valid until a type conversion occurs as
+** described above, or until [sqlite3_step()] or [sqlite3_reset()] or
+** [sqlite3_finalize()] is called. ^The memory space used to hold strings
+** and BLOBs is freed automatically. Do not pass the pointers returned
+** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into
+** [sqlite3_free()].
+**
+** As long as the input parameters are correct, these routines will only
+** fail if an out-of-memory error occurs during a format conversion.
+** Only the following subset of interfaces are subject to out-of-memory
+** errors:
+**
+** <ul>
+** <li> sqlite3_column_blob()
+** <li> sqlite3_column_text()
+** <li> sqlite3_column_text16()
+** <li> sqlite3_column_bytes()
+** <li> sqlite3_column_bytes16()
+** </ul>
+**
+** If an out-of-memory error occurs, then the return value from these
+** routines is the same as if the column had contained an SQL NULL value.
+** Valid SQL NULL returns can be distinguished from out-of-memory errors
+** by invoking the [sqlite3_errcode()] immediately after the suspect
+** return value is obtained and before any
+** other SQLite interface is called on the same [database connection].
+*/
+SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);
+SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol);
+SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol);
+SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);
+SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);
+SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);
+SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);
+SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
+SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
+SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
+
+/*
+** CAPI3REF: Destroy A Prepared Statement Object
+** DESTRUCTOR: sqlite3_stmt
+**
+** ^The sqlite3_finalize() function is called to delete a [prepared statement].
+** ^If the most recent evaluation of the statement encountered no errors
+** or if the statement is never been evaluated, then sqlite3_finalize() returns
+** SQLITE_OK. ^If the most recent evaluation of statement S failed, then
+** sqlite3_finalize(S) returns the appropriate [error code] or
+** [extended error code].
+**
+** ^The sqlite3_finalize(S) routine can be called at any point during
+** the life cycle of [prepared statement] S:
+** before statement S is ever evaluated, after
+** one or more calls to [sqlite3_reset()], or after any call
+** to [sqlite3_step()] regardless of whether or not the statement has
+** completed execution.
+**
+** ^Invoking sqlite3_finalize() on a NULL pointer is a harmless no-op.
+**
+** The application must finalize every [prepared statement] in order to avoid
+** resource leaks. It is a grievous error for the application to try to use
+** a prepared statement after it has been finalized. Any use of a prepared
+** statement after it has been finalized can result in undefined and
+** undesirable behavior such as segfaults and heap corruption.
+*/
+SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt);
+
+/*
+** CAPI3REF: Reset A Prepared Statement Object
+** METHOD: sqlite3_stmt
+**
+** The sqlite3_reset() function is called to reset a [prepared statement]
+** object back to its initial state, ready to be re-executed.
+** ^Any SQL statement variables that had values bound to them using
+** the [sqlite3_bind_blob | sqlite3_bind_*() API] retain their values.
+** Use [sqlite3_clear_bindings()] to reset the bindings.
+**
+** ^The [sqlite3_reset(S)] interface resets the [prepared statement] S
+** back to the beginning of its program.
+**
+** ^The return code from [sqlite3_reset(S)] indicates whether or not
+** the previous evaluation of prepared statement S completed successfully.
+** ^If [sqlite3_step(S)] has never before been called on S or if
+** [sqlite3_step(S)] has not been called since the previous call
+** to [sqlite3_reset(S)], then [sqlite3_reset(S)] will return
+** [SQLITE_OK].
+**
+** ^If the most recent call to [sqlite3_step(S)] for the
+** [prepared statement] S indicated an error, then
+** [sqlite3_reset(S)] returns an appropriate [error code].
+** ^The [sqlite3_reset(S)] interface might also return an [error code]
+** if there were no prior errors but the process of resetting
+** the prepared statement caused a new error. ^For example, if an
+** [INSERT] statement with a [RETURNING] clause is only stepped one time,
+** that one call to [sqlite3_step(S)] might return SQLITE_ROW but
+** the overall statement might still fail and the [sqlite3_reset(S)] call
+** might return SQLITE_BUSY if locking constraints prevent the
+** database change from committing. Therefore, it is important that
+** applications check the return code from [sqlite3_reset(S)] even if
+** no prior call to [sqlite3_step(S)] indicated a problem.
+**
+** ^The [sqlite3_reset(S)] interface does not change the values
+** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S.
+*/
+SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
+
+
+/*
+** CAPI3REF: Create Or Redefine SQL Functions
+** KEYWORDS: {function creation routines}
+** METHOD: sqlite3
+**
+** ^These functions (collectively known as "function creation routines")
+** are used to add SQL functions or aggregates or to redefine the behavior
+** of existing SQL functions or aggregates. The only differences between
+** the three "sqlite3_create_function*" routines are the text encoding
+** expected for the second parameter (the name of the function being
+** created) and the presence or absence of a destructor callback for
+** the application data pointer. Function sqlite3_create_window_function()
+** is similar, but allows the user to supply the extra callback functions
+** needed by [aggregate window functions].
+**
+** ^The first parameter is the [database connection] to which the SQL
+** function is to be added. ^If an application uses more than one database
+** connection then application-defined SQL functions must be added
+** to each database connection separately.
+**
+** ^The second parameter is the name of the SQL function to be created or
+** redefined. ^The length of the name is limited to 255 bytes in a UTF-8
+** representation, exclusive of the zero-terminator. ^Note that the name
+** length limit is in UTF-8 bytes, not characters nor UTF-16 bytes.
+** ^Any attempt to create a function with a longer name
+** will result in [SQLITE_MISUSE] being returned.
+**
+** ^The third parameter (nArg)
+** is the number of arguments that the SQL function or
+** aggregate takes. ^If this parameter is -1, then the SQL function or
+** aggregate may take any number of arguments between 0 and the limit
+** set by [sqlite3_limit]([SQLITE_LIMIT_FUNCTION_ARG]). If the third
+** parameter is less than -1 or greater than 127 then the behavior is
+** undefined.
+**
+** ^The fourth parameter, eTextRep, specifies what
+** [SQLITE_UTF8 | text encoding] this SQL function prefers for
+** its parameters. The application should set this parameter to
+** [SQLITE_UTF16LE] if the function implementation invokes
+** [sqlite3_value_text16le()] on an input, or [SQLITE_UTF16BE] if the
+** implementation invokes [sqlite3_value_text16be()] on an input, or
+** [SQLITE_UTF16] if [sqlite3_value_text16()] is used, or [SQLITE_UTF8]
+** otherwise. ^The same SQL function may be registered multiple times using
+** different preferred text encodings, with different implementations for
+** each encoding.
+** ^When multiple implementations of the same function are available, SQLite
+** will pick the one that involves the least amount of data conversion.
+**
+** ^The fourth parameter may optionally be ORed with [SQLITE_DETERMINISTIC]
+** to signal that the function will always return the same result given
+** the same inputs within a single SQL statement. Most SQL functions are
+** deterministic. The built-in [random()] SQL function is an example of a
+** function that is not deterministic. The SQLite query planner is able to
+** perform additional optimizations on deterministic functions, so use
+** of the [SQLITE_DETERMINISTIC] flag is recommended where possible.
+**
+** ^The fourth parameter may also optionally include the [SQLITE_DIRECTONLY]
+** flag, which if present prevents the function from being invoked from
+** within VIEWs, TRIGGERs, CHECK constraints, generated column expressions,
+** index expressions, or the WHERE clause of partial indexes.
+**
+** For best security, the [SQLITE_DIRECTONLY] flag is recommended for
+** all application-defined SQL functions that do not need to be
+** used inside of triggers, view, CHECK constraints, or other elements of
+** the database schema. This flags is especially recommended for SQL
+** functions that have side effects or reveal internal application state.
+** Without this flag, an attacker might be able to modify the schema of
+** a database file to include invocations of the function with parameters
+** chosen by the attacker, which the application will then execute when
+** the database file is opened and read.
+**
+** ^(The fifth parameter is an arbitrary pointer. The implementation of the
+** function can gain access to this pointer using [sqlite3_user_data()].)^
+**
+** ^The sixth, seventh and eighth parameters passed to the three
+** "sqlite3_create_function*" functions, xFunc, xStep and xFinal, are
+** pointers to C-language functions that implement the SQL function or
+** aggregate. ^A scalar SQL function requires an implementation of the xFunc
+** callback only; NULL pointers must be passed as the xStep and xFinal
+** parameters. ^An aggregate SQL function requires an implementation of xStep
+** and xFinal and NULL pointer must be passed for xFunc. ^To delete an existing
+** SQL function or aggregate, pass NULL pointers for all three function
+** callbacks.
+**
+** ^The sixth, seventh, eighth and ninth parameters (xStep, xFinal, xValue
+** and xInverse) passed to sqlite3_create_window_function are pointers to
+** C-language callbacks that implement the new function. xStep and xFinal
+** must both be non-NULL. xValue and xInverse may either both be NULL, in
+** which case a regular aggregate function is created, or must both be
+** non-NULL, in which case the new function may be used as either an aggregate
+** or aggregate window function. More details regarding the implementation
+** of aggregate window functions are
+** [user-defined window functions|available here].
+**
+** ^(If the final parameter to sqlite3_create_function_v2() or
+** sqlite3_create_window_function() is not NULL, then it is destructor for
+** the application data pointer. The destructor is invoked when the function
+** is deleted, either by being overloaded or when the database connection
+** closes.)^ ^The destructor is also invoked if the call to
+** sqlite3_create_function_v2() fails. ^When the destructor callback is
+** invoked, it is passed a single argument which is a copy of the application
+** data pointer which was the fifth parameter to sqlite3_create_function_v2().
+**
+** ^It is permitted to register multiple implementations of the same
+** functions with the same name but with either differing numbers of
+** arguments or differing preferred text encodings. ^SQLite will use
+** the implementation that most closely matches the way in which the
+** SQL function is used. ^A function implementation with a non-negative
+** nArg parameter is a better match than a function implementation with
+** a negative nArg. ^A function where the preferred text encoding
+** matches the database encoding is a better
+** match than a function where the encoding is different.
+** ^A function where the encoding difference is between UTF16le and UTF16be
+** is a closer match than a function where the encoding difference is
+** between UTF8 and UTF16.
+**
+** ^Built-in functions may be overloaded by new application-defined functions.
+**
+** ^An application-defined function is permitted to call other
+** SQLite interfaces. However, such calls must not
+** close the database connection nor finalize or reset the prepared
+** statement in which the function is running.
+*/
+SQLITE_API int sqlite3_create_function(
+ sqlite3 *db,
+ const char *zFunctionName,
+ int nArg,
+ int eTextRep,
+ void *pApp,
+ void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
+ void (*xStep)(sqlite3_context*,int,sqlite3_value**),
+ void (*xFinal)(sqlite3_context*)
+);
+SQLITE_API int sqlite3_create_function16(
+ sqlite3 *db,
+ const void *zFunctionName,
+ int nArg,
+ int eTextRep,
+ void *pApp,
+ void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
+ void (*xStep)(sqlite3_context*,int,sqlite3_value**),
+ void (*xFinal)(sqlite3_context*)
+);
+SQLITE_API int sqlite3_create_function_v2(
+ sqlite3 *db,
+ const char *zFunctionName,
+ int nArg,
+ int eTextRep,
+ void *pApp,
+ void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
+ void (*xStep)(sqlite3_context*,int,sqlite3_value**),
+ void (*xFinal)(sqlite3_context*),
+ void(*xDestroy)(void*)
+);
+SQLITE_API int sqlite3_create_window_function(
+ sqlite3 *db,
+ const char *zFunctionName,
+ int nArg,
+ int eTextRep,
+ void *pApp,
+ void (*xStep)(sqlite3_context*,int,sqlite3_value**),
+ void (*xFinal)(sqlite3_context*),
+ void (*xValue)(sqlite3_context*),
+ void (*xInverse)(sqlite3_context*,int,sqlite3_value**),
+ void(*xDestroy)(void*)
+);
+
+/*
+** CAPI3REF: Text Encodings
+**
+** These constant define integer codes that represent the various
+** text encodings supported by SQLite.
+*/
+#define SQLITE_UTF8 1 /* IMP: R-37514-35566 */
+#define SQLITE_UTF16LE 2 /* IMP: R-03371-37637 */
+#define SQLITE_UTF16BE 3 /* IMP: R-51971-34154 */
+#define SQLITE_UTF16 4 /* Use native byte order */
+#define SQLITE_ANY 5 /* Deprecated */
+#define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */
+
+/*
+** CAPI3REF: Function Flags
+**
+** These constants may be ORed together with the
+** [SQLITE_UTF8 | preferred text encoding] as the fourth argument
+** to [sqlite3_create_function()], [sqlite3_create_function16()], or
+** [sqlite3_create_function_v2()].
+**
+** <dl>
+** [[SQLITE_DETERMINISTIC]] <dt>SQLITE_DETERMINISTIC</dt><dd>
+** The SQLITE_DETERMINISTIC flag means that the new function always gives
+** the same output when the input parameters are the same.
+** The [abs|abs() function] is deterministic, for example, but
+** [randomblob|randomblob()] is not. Functions must
+** be deterministic in order to be used in certain contexts such as
+** with the WHERE clause of [partial indexes] or in [generated columns].
+** SQLite might also optimize deterministic functions by factoring them
+** out of inner loops.
+** </dd>
+**
+** [[SQLITE_DIRECTONLY]] <dt>SQLITE_DIRECTONLY</dt><dd>
+** The SQLITE_DIRECTONLY flag means that the function may only be invoked
+** from top-level SQL, and cannot be used in VIEWs or TRIGGERs nor in
+** schema structures such as [CHECK constraints], [DEFAULT clauses],
+** [expression indexes], [partial indexes], or [generated columns].
+** <p>
+** The SQLITE_DIRECTONLY flag is recommended for any
+** [application-defined SQL function]
+** that has side-effects or that could potentially leak sensitive information.
+** This will prevent attacks in which an application is tricked
+** into using a database file that has had its schema surreptitiously
+** modified to invoke the application-defined function in ways that are
+** harmful.
+** <p>
+** Some people say it is good practice to set SQLITE_DIRECTONLY on all
+** [application-defined SQL functions], regardless of whether or not they
+** are security sensitive, as doing so prevents those functions from being used
+** inside of the database schema, and thus ensures that the database
+** can be inspected and modified using generic tools (such as the [CLI])
+** that do not have access to the application-defined functions.
+** </dd>
+**
+** [[SQLITE_INNOCUOUS]] <dt>SQLITE_INNOCUOUS</dt><dd>
+** The SQLITE_INNOCUOUS flag means that the function is unlikely
+** to cause problems even if misused. An innocuous function should have
+** no side effects and should not depend on any values other than its
+** input parameters. The [abs|abs() function] is an example of an
+** innocuous function.
+** The [load_extension() SQL function] is not innocuous because of its
+** side effects.
+** <p> SQLITE_INNOCUOUS is similar to SQLITE_DETERMINISTIC, but is not
+** exactly the same. The [random|random() function] is an example of a
+** function that is innocuous but not deterministic.
+** <p>Some heightened security settings
+** ([SQLITE_DBCONFIG_TRUSTED_SCHEMA] and [PRAGMA trusted_schema=OFF])
+** disable the use of SQL functions inside views and triggers and in
+** schema structures such as [CHECK constraints], [DEFAULT clauses],
+** [expression indexes], [partial indexes], and [generated columns] unless
+** the function is tagged with SQLITE_INNOCUOUS. Most built-in functions
+** are innocuous. Developers are advised to avoid using the
+** SQLITE_INNOCUOUS flag for application-defined functions unless the
+** function has been carefully audited and found to be free of potentially
+** security-adverse side-effects and information-leaks.
+** </dd>
+**
+** [[SQLITE_SUBTYPE]] <dt>SQLITE_SUBTYPE</dt><dd>
+** The SQLITE_SUBTYPE flag indicates to SQLite that a function might call
+** [sqlite3_value_subtype()] to inspect the sub-types of its arguments.
+** This flag instructs SQLite to omit some corner-case optimizations that
+** might disrupt the operation of the [sqlite3_value_subtype()] function,
+** causing it to return zero rather than the correct subtype().
+** All SQL functions that invoke [sqlite3_value_subtype()] should have this
+** property. If the SQLITE_SUBTYPE property is omitted, then the return
+** value from [sqlite3_value_subtype()] might sometimes be zero even though
+** a non-zero subtype was specified by the function argument expression.
+**
+** [[SQLITE_RESULT_SUBTYPE]] <dt>SQLITE_RESULT_SUBTYPE</dt><dd>
+** The SQLITE_RESULT_SUBTYPE flag indicates to SQLite that a function might call
+** [sqlite3_result_subtype()] to cause a sub-type to be associated with its
+** result.
+** Every function that invokes [sqlite3_result_subtype()] should have this
+** property. If it does not, then the call to [sqlite3_result_subtype()]
+** might become a no-op if the function is used as term in an
+** [expression index]. On the other hand, SQL functions that never invoke
+** [sqlite3_result_subtype()] should avoid setting this property, as the
+** purpose of this property is to disable certain optimizations that are
+** incompatible with subtypes.
+**
+** [[SQLITE_SELFORDER1]] <dt>SQLITE_SELFORDER1</dt><dd>
+** The SQLITE_SELFORDER1 flag indicates that the function is an aggregate
+** that internally orders the values provided to the first argument. The
+** ordered-set aggregate SQL notation with a single ORDER BY term can be
+** used to invoke this function. If the ordered-set aggregate notation is
+** used on a function that lacks this flag, then an error is raised. Note
+** that the ordered-set aggregate syntax is only available if SQLite is
+** built using the -DSQLITE_ENABLE_ORDERED_SET_AGGREGATES compile-time option.
+** </dd>
+** </dl>
+*/
+#define SQLITE_DETERMINISTIC 0x000000800
+#define SQLITE_DIRECTONLY 0x000080000
+#define SQLITE_SUBTYPE 0x000100000
+#define SQLITE_INNOCUOUS 0x000200000
+#define SQLITE_RESULT_SUBTYPE 0x001000000
+#define SQLITE_SELFORDER1 0x002000000
+
+/*
+** CAPI3REF: Deprecated Functions
+** DEPRECATED
+**
+** These functions are [deprecated]. In order to maintain
+** backwards compatibility with older code, these functions continue
+** to be supported. However, new applications should avoid
+** the use of these functions. To encourage programmers to avoid
+** these functions, we will not explain what they do.
+*/
+#ifndef SQLITE_OMIT_DEPRECATED
+SQLITE_API SQLITE_DEPRECATED int sqlite3_aggregate_count(sqlite3_context*);
+SQLITE_API SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*);
+SQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);
+SQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void);
+SQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void);
+SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),
+ void*,sqlite3_int64);
+#endif
+
+/*
+** CAPI3REF: Obtaining SQL Values
+** METHOD: sqlite3_value
+**
+** <b>Summary:</b>
+** <blockquote><table border=0 cellpadding=0 cellspacing=0>
+** <tr><td><b>sqlite3_value_blob</b><td>→<td>BLOB value
+** <tr><td><b>sqlite3_value_double</b><td>→<td>REAL value
+** <tr><td><b>sqlite3_value_int</b><td>→<td>32-bit INTEGER value
+** <tr><td><b>sqlite3_value_int64</b><td>→<td>64-bit INTEGER value
+** <tr><td><b>sqlite3_value_pointer</b><td>→<td>Pointer value
+** <tr><td><b>sqlite3_value_text</b><td>→<td>UTF-8 TEXT value
+** <tr><td><b>sqlite3_value_text16</b><td>→<td>UTF-16 TEXT value in
+** the native byteorder
+** <tr><td><b>sqlite3_value_text16be</b><td>→<td>UTF-16be TEXT value
+** <tr><td><b>sqlite3_value_text16le</b><td>→<td>UTF-16le TEXT value
+** <tr><td> <td> <td>
+** <tr><td><b>sqlite3_value_bytes</b><td>→<td>Size of a BLOB
+** or a UTF-8 TEXT in bytes
+** <tr><td><b>sqlite3_value_bytes16 </b>
+** <td>→ <td>Size of UTF-16
+** TEXT in bytes
+** <tr><td><b>sqlite3_value_type</b><td>→<td>Default
+** datatype of the value
+** <tr><td><b>sqlite3_value_numeric_type </b>
+** <td>→ <td>Best numeric datatype of the value
+** <tr><td><b>sqlite3_value_nochange </b>
+** <td>→ <td>True if the column is unchanged in an UPDATE
+** against a virtual table.
+** <tr><td><b>sqlite3_value_frombind </b>
+** <td>→ <td>True if value originated from a [bound parameter]
+** </table></blockquote>
+**
+** <b>Details:</b>
+**
+** These routines extract type, size, and content information from
+** [protected sqlite3_value] objects. Protected sqlite3_value objects
+** are used to pass parameter information into the functions that
+** implement [application-defined SQL functions] and [virtual tables].
+**
+** These routines work only with [protected sqlite3_value] objects.
+** Any attempt to use these routines on an [unprotected sqlite3_value]
+** is not threadsafe.
+**
+** ^These routines work just like the corresponding [column access functions]
+** except that these routines take a single [protected sqlite3_value] object
+** pointer instead of a [sqlite3_stmt*] pointer and an integer column number.
+**
+** ^The sqlite3_value_text16() interface extracts a UTF-16 string
+** in the native byte-order of the host machine. ^The
+** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces
+** extract UTF-16 strings as big-endian and little-endian respectively.
+**
+** ^If [sqlite3_value] object V was initialized
+** using [sqlite3_bind_pointer(S,I,P,X,D)] or [sqlite3_result_pointer(C,P,X,D)]
+** and if X and Y are strings that compare equal according to strcmp(X,Y),
+** then sqlite3_value_pointer(V,Y) will return the pointer P. ^Otherwise,
+** sqlite3_value_pointer(V,Y) returns a NULL. The sqlite3_bind_pointer()
+** routine is part of the [pointer passing interface] added for SQLite 3.20.0.
+**
+** ^(The sqlite3_value_type(V) interface returns the
+** [SQLITE_INTEGER | datatype code] for the initial datatype of the
+** [sqlite3_value] object V. The returned value is one of [SQLITE_INTEGER],
+** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].)^
+** Other interfaces might change the datatype for an sqlite3_value object.
+** For example, if the datatype is initially SQLITE_INTEGER and
+** sqlite3_value_text(V) is called to extract a text value for that
+** integer, then subsequent calls to sqlite3_value_type(V) might return
+** SQLITE_TEXT. Whether or not a persistent internal datatype conversion
+** occurs is undefined and may change from one release of SQLite to the next.
+**
+** ^(The sqlite3_value_numeric_type() interface attempts to apply
+** numeric affinity to the value. This means that an attempt is
+** made to convert the value to an integer or floating point. If
+** such a conversion is possible without loss of information (in other
+** words, if the value is a string that looks like a number)
+** then the conversion is performed. Otherwise no conversion occurs.
+** The [SQLITE_INTEGER | datatype] after conversion is returned.)^
+**
+** ^Within the [xUpdate] method of a [virtual table], the
+** sqlite3_value_nochange(X) interface returns true if and only if
+** the column corresponding to X is unchanged by the UPDATE operation
+** that the xUpdate method call was invoked to implement and if
+** and the prior [xColumn] method call that was invoked to extracted
+** the value for that column returned without setting a result (probably
+** because it queried [sqlite3_vtab_nochange()] and found that the column
+** was unchanging). ^Within an [xUpdate] method, any value for which
+** sqlite3_value_nochange(X) is true will in all other respects appear
+** to be a NULL value. If sqlite3_value_nochange(X) is invoked anywhere other
+** than within an [xUpdate] method call for an UPDATE statement, then
+** the return value is arbitrary and meaningless.
+**
+** ^The sqlite3_value_frombind(X) interface returns non-zero if the
+** value X originated from one of the [sqlite3_bind_int|sqlite3_bind()]
+** interfaces. ^If X comes from an SQL literal value, or a table column,
+** or an expression, then sqlite3_value_frombind(X) returns zero.
+**
+** Please pay particular attention to the fact that the pointer returned
+** from [sqlite3_value_blob()], [sqlite3_value_text()], or
+** [sqlite3_value_text16()] can be invalidated by a subsequent call to
+** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite3_value_text()],
+** or [sqlite3_value_text16()].
+**
+** These routines must be called from the same thread as
+** the SQL function that supplied the [sqlite3_value*] parameters.
+**
+** As long as the input parameter is correct, these routines can only
+** fail if an out-of-memory error occurs during a format conversion.
+** Only the following subset of interfaces are subject to out-of-memory
+** errors:
+**
+** <ul>
+** <li> sqlite3_value_blob()
+** <li> sqlite3_value_text()
+** <li> sqlite3_value_text16()
+** <li> sqlite3_value_text16le()
+** <li> sqlite3_value_text16be()
+** <li> sqlite3_value_bytes()
+** <li> sqlite3_value_bytes16()
+** </ul>
+**
+** If an out-of-memory error occurs, then the return value from these
+** routines is the same as if the column had contained an SQL NULL value.
+** Valid SQL NULL returns can be distinguished from out-of-memory errors
+** by invoking the [sqlite3_errcode()] immediately after the suspect
+** return value is obtained and before any
+** other SQLite interface is called on the same [database connection].
+*/
+SQLITE_API const void *sqlite3_value_blob(sqlite3_value*);
+SQLITE_API double sqlite3_value_double(sqlite3_value*);
+SQLITE_API int sqlite3_value_int(sqlite3_value*);
+SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*);
+SQLITE_API void *sqlite3_value_pointer(sqlite3_value*, const char*);
+SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*);
+SQLITE_API const void *sqlite3_value_text16(sqlite3_value*);
+SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*);
+SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*);
+SQLITE_API int sqlite3_value_bytes(sqlite3_value*);
+SQLITE_API int sqlite3_value_bytes16(sqlite3_value*);
+SQLITE_API int sqlite3_value_type(sqlite3_value*);
+SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
+SQLITE_API int sqlite3_value_nochange(sqlite3_value*);
+SQLITE_API int sqlite3_value_frombind(sqlite3_value*);
+
+/*
+** CAPI3REF: Report the internal text encoding state of an sqlite3_value object
+** METHOD: sqlite3_value
+**
+** ^(The sqlite3_value_encoding(X) interface returns one of [SQLITE_UTF8],
+** [SQLITE_UTF16BE], or [SQLITE_UTF16LE] according to the current text encoding
+** of the value X, assuming that X has type TEXT.)^ If sqlite3_value_type(X)
+** returns something other than SQLITE_TEXT, then the return value from
+** sqlite3_value_encoding(X) is meaningless. ^Calls to
+** [sqlite3_value_text(X)], [sqlite3_value_text16(X)], [sqlite3_value_text16be(X)],
+** [sqlite3_value_text16le(X)], [sqlite3_value_bytes(X)], or
+** [sqlite3_value_bytes16(X)] might change the encoding of the value X and
+** thus change the return from subsequent calls to sqlite3_value_encoding(X).
+**
+** This routine is intended for used by applications that test and validate
+** the SQLite implementation. This routine is inquiring about the opaque
+** internal state of an [sqlite3_value] object. Ordinary applications should
+** not need to know what the internal state of an sqlite3_value object is and
+** hence should not need to use this interface.
+*/
+SQLITE_API int sqlite3_value_encoding(sqlite3_value*);
+
+/*
+** CAPI3REF: Finding The Subtype Of SQL Values
+** METHOD: sqlite3_value
+**
+** The sqlite3_value_subtype(V) function returns the subtype for
+** an [application-defined SQL function] argument V. The subtype
+** information can be used to pass a limited amount of context from
+** one SQL function to another. Use the [sqlite3_result_subtype()]
+** routine to set the subtype for the return value of an SQL function.
+**
+** Every [application-defined SQL function] that invokes this interface
+** should include the [SQLITE_SUBTYPE] property in the text
+** encoding argument when the function is [sqlite3_create_function|registered].
+** If the [SQLITE_SUBTYPE] property is omitted, then sqlite3_value_subtype()
+** might return zero instead of the upstream subtype in some corner cases.
+*/
+SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*);
+
+/*
+** CAPI3REF: Copy And Free SQL Values
+** METHOD: sqlite3_value
+**
+** ^The sqlite3_value_dup(V) interface makes a copy of the [sqlite3_value]
+** object D and returns a pointer to that copy. ^The [sqlite3_value] returned
+** is a [protected sqlite3_value] object even if the input is not.
+** ^The sqlite3_value_dup(V) interface returns NULL if V is NULL or if a
+** memory allocation fails. ^If V is a [pointer value], then the result
+** of sqlite3_value_dup(V) is a NULL value.
+**
+** ^The sqlite3_value_free(V) interface frees an [sqlite3_value] object
+** previously obtained from [sqlite3_value_dup()]. ^If V is a NULL pointer
+** then sqlite3_value_free(V) is a harmless no-op.
+*/
+SQLITE_API sqlite3_value *sqlite3_value_dup(const sqlite3_value*);
+SQLITE_API void sqlite3_value_free(sqlite3_value*);
+
+/*
+** CAPI3REF: Obtain Aggregate Function Context
+** METHOD: sqlite3_context
+**
+** Implementations of aggregate SQL functions use this
+** routine to allocate memory for storing their state.
+**
+** ^The first time the sqlite3_aggregate_context(C,N) routine is called
+** for a particular aggregate function, SQLite allocates
+** N bytes of memory, zeroes out that memory, and returns a pointer
+** to the new memory. ^On second and subsequent calls to
+** sqlite3_aggregate_context() for the same aggregate function instance,
+** the same buffer is returned. Sqlite3_aggregate_context() is normally
+** called once for each invocation of the xStep callback and then one
+** last time when the xFinal callback is invoked. ^(When no rows match
+** an aggregate query, the xStep() callback of the aggregate function
+** implementation is never called and xFinal() is called exactly once.
+** In those cases, sqlite3_aggregate_context() might be called for the
+** first time from within xFinal().)^
+**
+** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer
+** when first called if N is less than or equal to zero or if a memory
+** allocation error occurs.
+**
+** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is
+** determined by the N parameter on first successful call. Changing the
+** value of N in any subsequent call to sqlite3_aggregate_context() within
+** the same aggregate function instance will not resize the memory
+** allocation.)^ Within the xFinal callback, it is customary to set
+** N=0 in calls to sqlite3_aggregate_context(C,N) so that no
+** pointless memory allocations occur.
+**
+** ^SQLite automatically frees the memory allocated by
+** sqlite3_aggregate_context() when the aggregate query concludes.
+**
+** The first parameter must be a copy of the
+** [sqlite3_context | SQL function context] that is the first parameter
+** to the xStep or xFinal callback routine that implements the aggregate
+** function.
+**
+** This routine must be called from the same thread in which
+** the aggregate SQL function is running.
+*/
+SQLITE_API void *sqlite3_aggregate_context(sqlite3_context*, int nBytes);
+
+/*
+** CAPI3REF: User Data For Functions
+** METHOD: sqlite3_context
+**
+** ^The sqlite3_user_data() interface returns a copy of
+** the pointer that was the pUserData parameter (the 5th parameter)
+** of the [sqlite3_create_function()]
+** and [sqlite3_create_function16()] routines that originally
+** registered the application defined function.
+**
+** This routine must be called from the same thread in which
+** the application-defined function is running.
+*/
+SQLITE_API void *sqlite3_user_data(sqlite3_context*);
+
+/*
+** CAPI3REF: Database Connection For Functions
+** METHOD: sqlite3_context
+**
+** ^The sqlite3_context_db_handle() interface returns a copy of
+** the pointer to the [database connection] (the 1st parameter)
+** of the [sqlite3_create_function()]
+** and [sqlite3_create_function16()] routines that originally
+** registered the application defined function.
+*/
+SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
+
+/*
+** CAPI3REF: Function Auxiliary Data
+** METHOD: sqlite3_context
+**
+** These functions may be used by (non-aggregate) SQL functions to
+** associate auxiliary data with argument values. If the same argument
+** value is passed to multiple invocations of the same SQL function during
+** query execution, under some circumstances the associated auxiliary data
+** might be preserved. An example of where this might be useful is in a
+** regular-expression matching function. The compiled version of the regular
+** expression can be stored as auxiliary data associated with the pattern string.
+** Then as long as the pattern string remains the same,
+** the compiled regular expression can be reused on multiple
+** invocations of the same function.
+**
+** ^The sqlite3_get_auxdata(C,N) interface returns a pointer to the auxiliary data
+** associated by the sqlite3_set_auxdata(C,N,P,X) function with the Nth argument
+** value to the application-defined function. ^N is zero for the left-most
+** function argument. ^If there is no auxiliary data
+** associated with the function argument, the sqlite3_get_auxdata(C,N) interface
+** returns a NULL pointer.
+**
+** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as auxiliary data for the
+** N-th argument of the application-defined function. ^Subsequent
+** calls to sqlite3_get_auxdata(C,N) return P from the most recent
+** sqlite3_set_auxdata(C,N,P,X) call if the auxiliary data is still valid or
+** NULL if the auxiliary data has been discarded.
+** ^After each call to sqlite3_set_auxdata(C,N,P,X) where X is not NULL,
+** SQLite will invoke the destructor function X with parameter P exactly
+** once, when the auxiliary data is discarded.
+** SQLite is free to discard the auxiliary data at any time, including: <ul>
+** <li> ^(when the corresponding function parameter changes)^, or
+** <li> ^(when [sqlite3_reset()] or [sqlite3_finalize()] is called for the
+** SQL statement)^, or
+** <li> ^(when sqlite3_set_auxdata() is invoked again on the same
+** parameter)^, or
+** <li> ^(during the original sqlite3_set_auxdata() call when a memory
+** allocation error occurs.)^
+** <li> ^(during the original sqlite3_set_auxdata() call if the function
+** is evaluated during query planning instead of during query execution,
+** as sometimes happens with [SQLITE_ENABLE_STAT4].)^ </ul>
+**
+** Note the last two bullets in particular. The destructor X in
+** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the
+** sqlite3_set_auxdata() interface even returns. Hence sqlite3_set_auxdata()
+** should be called near the end of the function implementation and the
+** function implementation should not make any use of P after
+** sqlite3_set_auxdata() has been called. Furthermore, a call to
+** sqlite3_get_auxdata() that occurs immediately after a corresponding call
+** to sqlite3_set_auxdata() might still return NULL if an out-of-memory
+** condition occurred during the sqlite3_set_auxdata() call or if the
+** function is being evaluated during query planning rather than during
+** query execution.
+**
+** ^(In practice, auxiliary data is preserved between function calls for
+** function parameters that are compile-time constants, including literal
+** values and [parameters] and expressions composed from the same.)^
+**
+** The value of the N parameter to these interfaces should be non-negative.
+** Future enhancements may make use of negative N values to define new
+** kinds of function caching behavior.
+**
+** These routines must be called from the same thread in which
+** the SQL function is running.
+**
+** See also: [sqlite3_get_clientdata()] and [sqlite3_set_clientdata()].
+*/
+SQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N);
+SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*));
+
+/*
+** CAPI3REF: Database Connection Client Data
+** METHOD: sqlite3
+**
+** These functions are used to associate one or more named pointers
+** with a [database connection].
+** A call to sqlite3_set_clientdata(D,N,P,X) causes the pointer P
+** to be attached to [database connection] D using name N. Subsequent
+** calls to sqlite3_get_clientdata(D,N) will return a copy of pointer P
+** or a NULL pointer if there were no prior calls to
+** sqlite3_set_clientdata() with the same values of D and N.
+** Names are compared using strcmp() and are thus case sensitive.
+**
+** If P and X are both non-NULL, then the destructor X is invoked with
+** argument P on the first of the following occurrences:
+** <ul>
+** <li> An out-of-memory error occurs during the call to
+** sqlite3_set_clientdata() which attempts to register pointer P.
+** <li> A subsequent call to sqlite3_set_clientdata(D,N,P,X) is made
+** with the same D and N parameters.
+** <li> The database connection closes. SQLite does not make any guarantees
+** about the order in which destructors are called, only that all
+** destructors will be called exactly once at some point during the
+** database connection closing process.
+** </ul>
+**
+** SQLite does not do anything with client data other than invoke
+** destructors on the client data at the appropriate time. The intended
+** use for client data is to provide a mechanism for wrapper libraries
+** to store additional information about an SQLite database connection.
+**
+** There is no limit (other than available memory) on the number of different
+** client data pointers (with different names) that can be attached to a
+** single database connection. However, the implementation is optimized
+** for the case of having only one or two different client data names.
+** Applications and wrapper libraries are discouraged from using more than
+** one client data name each.
+**
+** There is no way to enumerate the client data pointers
+** associated with a database connection. The N parameter can be thought
+** of as a secret key such that only code that knows the secret key is able
+** to access the associated data.
+**
+** Security Warning: These interfaces should not be exposed in scripting
+** languages or in other circumstances where it might be possible for an
+** an attacker to invoke them. Any agent that can invoke these interfaces
+** can probably also take control of the process.
+**
+** Database connection client data is only available for SQLite
+** version 3.44.0 ([dateof:3.44.0]) and later.
+**
+** See also: [sqlite3_set_auxdata()] and [sqlite3_get_auxdata()].
+*/
+SQLITE_API void *sqlite3_get_clientdata(sqlite3*,const char*);
+SQLITE_API int sqlite3_set_clientdata(sqlite3*, const char*, void*, void(*)(void*));
+
+/*
+** CAPI3REF: Constants Defining Special Destructor Behavior
+**
+** These are special values for the destructor that is passed in as the
+** final argument to routines like [sqlite3_result_blob()]. ^If the destructor
+** argument is SQLITE_STATIC, it means that the content pointer is constant
+** and will never change. It does not need to be destroyed. ^The
+** SQLITE_TRANSIENT value means that the content will likely change in
+** the near future and that SQLite should make its own private copy of
+** the content before returning.
+**
+** The typedef is necessary to work around problems in certain
+** C++ compilers.
+*/
+typedef void (*sqlite3_destructor_type)(void*);
+#define SQLITE_STATIC ((sqlite3_destructor_type)0)
+#define SQLITE_TRANSIENT ((sqlite3_destructor_type)-1)
+
+/*
+** CAPI3REF: Setting The Result Of An SQL Function
+** METHOD: sqlite3_context
+**
+** These routines are used by the xFunc or xFinal callbacks that
+** implement SQL functions and aggregates. See
+** [sqlite3_create_function()] and [sqlite3_create_function16()]
+** for additional information.
+**
+** These functions work very much like the [parameter binding] family of
+** functions used to bind values to host parameters in prepared statements.
+** Refer to the [SQL parameter] documentation for additional information.
+**
+** ^The sqlite3_result_blob() interface sets the result from
+** an application-defined function to be the BLOB whose content is pointed
+** to by the second parameter and which is N bytes long where N is the
+** third parameter.
+**
+** ^The sqlite3_result_zeroblob(C,N) and sqlite3_result_zeroblob64(C,N)
+** interfaces set the result of the application-defined function to be
+** a BLOB containing all zero bytes and N bytes in size.
+**
+** ^The sqlite3_result_double() interface sets the result from
+** an application-defined function to be a floating point value specified
+** by its 2nd argument.
+**
+** ^The sqlite3_result_error() and sqlite3_result_error16() functions
+** cause the implemented SQL function to throw an exception.
+** ^SQLite uses the string pointed to by the
+** 2nd parameter of sqlite3_result_error() or sqlite3_result_error16()
+** as the text of an error message. ^SQLite interprets the error
+** message string from sqlite3_result_error() as UTF-8. ^SQLite
+** interprets the string from sqlite3_result_error16() as UTF-16 using
+** the same [byte-order determination rules] as [sqlite3_bind_text16()].
+** ^If the third parameter to sqlite3_result_error()
+** or sqlite3_result_error16() is negative then SQLite takes as the error
+** message all text up through the first zero character.
+** ^If the third parameter to sqlite3_result_error() or
+** sqlite3_result_error16() is non-negative then SQLite takes that many
+** bytes (not characters) from the 2nd parameter as the error message.
+** ^The sqlite3_result_error() and sqlite3_result_error16()
+** routines make a private copy of the error message text before
+** they return. Hence, the calling function can deallocate or
+** modify the text after they return without harm.
+** ^The sqlite3_result_error_code() function changes the error code
+** returned by SQLite as a result of an error in a function. ^By default,
+** the error code is SQLITE_ERROR. ^A subsequent call to sqlite3_result_error()
+** or sqlite3_result_error16() resets the error code to SQLITE_ERROR.
+**
+** ^The sqlite3_result_error_toobig() interface causes SQLite to throw an
+** error indicating that a string or BLOB is too long to represent.
+**
+** ^The sqlite3_result_error_nomem() interface causes SQLite to throw an
+** error indicating that a memory allocation failed.
+**
+** ^The sqlite3_result_int() interface sets the return value
+** of the application-defined function to be the 32-bit signed integer
+** value given in the 2nd argument.
+** ^The sqlite3_result_int64() interface sets the return value
+** of the application-defined function to be the 64-bit signed integer
+** value given in the 2nd argument.
+**
+** ^The sqlite3_result_null() interface sets the return value
+** of the application-defined function to be NULL.
+**
+** ^The sqlite3_result_text(), sqlite3_result_text16(),
+** sqlite3_result_text16le(), and sqlite3_result_text16be() interfaces
+** set the return value of the application-defined function to be
+** a text string which is represented as UTF-8, UTF-16 native byte order,
+** UTF-16 little endian, or UTF-16 big endian, respectively.
+** ^The sqlite3_result_text64() interface sets the return value of an
+** application-defined function to be a text string in an encoding
+** specified by the fifth (and last) parameter, which must be one
+** of [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE].
+** ^SQLite takes the text result from the application from
+** the 2nd parameter of the sqlite3_result_text* interfaces.
+** ^If the 3rd parameter to any of the sqlite3_result_text* interfaces
+** other than sqlite3_result_text64() is negative, then SQLite computes
+** the string length itself by searching the 2nd parameter for the first
+** zero character.
+** ^If the 3rd parameter to the sqlite3_result_text* interfaces
+** is non-negative, then as many bytes (not characters) of the text
+** pointed to by the 2nd parameter are taken as the application-defined
+** function result. If the 3rd parameter is non-negative, then it
+** must be the byte offset into the string where the NUL terminator would
+** appear if the string where NUL terminated. If any NUL characters occur
+** in the string at a byte offset that is less than the value of the 3rd
+** parameter, then the resulting string will contain embedded NULs and the
+** result of expressions operating on strings with embedded NULs is undefined.
+** ^If the 4th parameter to the sqlite3_result_text* interfaces
+** or sqlite3_result_blob is a non-NULL pointer, then SQLite calls that
+** function as the destructor on the text or BLOB result when it has
+** finished using that result.
+** ^If the 4th parameter to the sqlite3_result_text* interfaces or to
+** sqlite3_result_blob is the special constant SQLITE_STATIC, then SQLite
+** assumes that the text or BLOB result is in constant space and does not
+** copy the content of the parameter nor call a destructor on the content
+** when it has finished using that result.
+** ^If the 4th parameter to the sqlite3_result_text* interfaces
+** or sqlite3_result_blob is the special constant SQLITE_TRANSIENT
+** then SQLite makes a copy of the result into space obtained
+** from [sqlite3_malloc()] before it returns.
+**
+** ^For the sqlite3_result_text16(), sqlite3_result_text16le(), and
+** sqlite3_result_text16be() routines, and for sqlite3_result_text64()
+** when the encoding is not UTF8, if the input UTF16 begins with a
+** byte-order mark (BOM, U+FEFF) then the BOM is removed from the
+** string and the rest of the string is interpreted according to the
+** byte-order specified by the BOM. ^The byte-order specified by
+** the BOM at the beginning of the text overrides the byte-order
+** specified by the interface procedure. ^So, for example, if
+** sqlite3_result_text16le() is invoked with text that begins
+** with bytes 0xfe, 0xff (a big-endian byte-order mark) then the
+** first two bytes of input are skipped and the remaining input
+** is interpreted as UTF16BE text.
+**
+** ^For UTF16 input text to the sqlite3_result_text16(),
+** sqlite3_result_text16be(), sqlite3_result_text16le(), and
+** sqlite3_result_text64() routines, if the text contains invalid
+** UTF16 characters, the invalid characters might be converted
+** into the unicode replacement character, U+FFFD.
+**
+** ^The sqlite3_result_value() interface sets the result of
+** the application-defined function to be a copy of the
+** [unprotected sqlite3_value] object specified by the 2nd parameter. ^The
+** sqlite3_result_value() interface makes a copy of the [sqlite3_value]
+** so that the [sqlite3_value] specified in the parameter may change or
+** be deallocated after sqlite3_result_value() returns without harm.
+** ^A [protected sqlite3_value] object may always be used where an
+** [unprotected sqlite3_value] object is required, so either
+** kind of [sqlite3_value] object can be used with this interface.
+**
+** ^The sqlite3_result_pointer(C,P,T,D) interface sets the result to an
+** SQL NULL value, just like [sqlite3_result_null(C)], except that it
+** also associates the host-language pointer P or type T with that
+** NULL value such that the pointer can be retrieved within an
+** [application-defined SQL function] using [sqlite3_value_pointer()].
+** ^If the D parameter is not NULL, then it is a pointer to a destructor
+** for the P parameter. ^SQLite invokes D with P as its only argument
+** when SQLite is finished with P. The T parameter should be a static
+** string and preferably a string literal. The sqlite3_result_pointer()
+** routine is part of the [pointer passing interface] added for SQLite 3.20.0.
+**
+** If these routines are called from within the different thread
+** than the one containing the application-defined function that received
+** the [sqlite3_context] pointer, the results are undefined.
+*/
+SQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
+SQLITE_API void sqlite3_result_blob64(sqlite3_context*,const void*,
+ sqlite3_uint64,void(*)(void*));
+SQLITE_API void sqlite3_result_double(sqlite3_context*, double);
+SQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int);
+SQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int);
+SQLITE_API void sqlite3_result_error_toobig(sqlite3_context*);
+SQLITE_API void sqlite3_result_error_nomem(sqlite3_context*);
+SQLITE_API void sqlite3_result_error_code(sqlite3_context*, int);
+SQLITE_API void sqlite3_result_int(sqlite3_context*, int);
+SQLITE_API void sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
+SQLITE_API void sqlite3_result_null(sqlite3_context*);
+SQLITE_API void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));
+SQLITE_API void sqlite3_result_text64(sqlite3_context*, const char*,sqlite3_uint64,
+ void(*)(void*), unsigned char encoding);
+SQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
+SQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
+SQLITE_API void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));
+SQLITE_API void sqlite3_result_value(sqlite3_context*, sqlite3_value*);
+SQLITE_API void sqlite3_result_pointer(sqlite3_context*, void*,const char*,void(*)(void*));
+SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n);
+SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n);
+
+
+/*
+** CAPI3REF: Setting The Subtype Of An SQL Function
+** METHOD: sqlite3_context
+**
+** The sqlite3_result_subtype(C,T) function causes the subtype of
+** the result from the [application-defined SQL function] with
+** [sqlite3_context] C to be the value T. Only the lower 8 bits
+** of the subtype T are preserved in current versions of SQLite;
+** higher order bits are discarded.
+** The number of subtype bytes preserved by SQLite might increase
+** in future releases of SQLite.
+**
+** Every [application-defined SQL function] that invokes this interface
+** should include the [SQLITE_RESULT_SUBTYPE] property in its
+** text encoding argument when the SQL function is
+** [sqlite3_create_function|registered]. If the [SQLITE_RESULT_SUBTYPE]
+** property is omitted from the function that invokes sqlite3_result_subtype(),
+** then in some cases the sqlite3_result_subtype() might fail to set
+** the result subtype.
+**
+** If SQLite is compiled with -DSQLITE_STRICT_SUBTYPE=1, then any
+** SQL function that invokes the sqlite3_result_subtype() interface
+** and that does not have the SQLITE_RESULT_SUBTYPE property will raise
+** an error. Future versions of SQLite might enable -DSQLITE_STRICT_SUBTYPE=1
+** by default.
+*/
+SQLITE_API void sqlite3_result_subtype(sqlite3_context*,unsigned int);
+
+/*
+** CAPI3REF: Define New Collating Sequences
+** METHOD: sqlite3
+**
+** ^These functions add, remove, or modify a [collation] associated
+** with the [database connection] specified as the first argument.
+**
+** ^The name of the collation is a UTF-8 string
+** for sqlite3_create_collation() and sqlite3_create_collation_v2()
+** and a UTF-16 string in native byte order for sqlite3_create_collation16().
+** ^Collation names that compare equal according to [sqlite3_strnicmp()] are
+** considered to be the same name.
+**
+** ^(The third argument (eTextRep) must be one of the constants:
+** <ul>
+** <li> [SQLITE_UTF8],
+** <li> [SQLITE_UTF16LE],
+** <li> [SQLITE_UTF16BE],
+** <li> [SQLITE_UTF16], or
+** <li> [SQLITE_UTF16_ALIGNED].
+** </ul>)^
+** ^The eTextRep argument determines the encoding of strings passed
+** to the collating function callback, xCompare.
+** ^The [SQLITE_UTF16] and [SQLITE_UTF16_ALIGNED] values for eTextRep
+** force strings to be UTF16 with native byte order.
+** ^The [SQLITE_UTF16_ALIGNED] value for eTextRep forces strings to begin
+** on an even byte address.
+**
+** ^The fourth argument, pArg, is an application data pointer that is passed
+** through as the first argument to the collating function callback.
+**
+** ^The fifth argument, xCompare, is a pointer to the collating function.
+** ^Multiple collating functions can be registered using the same name but
+** with different eTextRep parameters and SQLite will use whichever
+** function requires the least amount of data transformation.
+** ^If the xCompare argument is NULL then the collating function is
+** deleted. ^When all collating functions having the same name are deleted,
+** that collation is no longer usable.
+**
+** ^The collating function callback is invoked with a copy of the pArg
+** application data pointer and with two strings in the encoding specified
+** by the eTextRep argument. The two integer parameters to the collating
+** function callback are the length of the two strings, in bytes. The collating
+** function must return an integer that is negative, zero, or positive
+** if the first string is less than, equal to, or greater than the second,
+** respectively. A collating function must always return the same answer
+** given the same inputs. If two or more collating functions are registered
+** to the same collation name (using different eTextRep values) then all
+** must give an equivalent answer when invoked with equivalent strings.
+** The collating function must obey the following properties for all
+** strings A, B, and C:
+**
+** <ol>
+** <li> If A==B then B==A.
+** <li> If A==B and B==C then A==C.
+** <li> If A<B THEN B>A.
+** <li> If A<B and B<C then A<C.
+** </ol>
+**
+** If a collating function fails any of the above constraints and that
+** collating function is registered and used, then the behavior of SQLite
+** is undefined.
+**
+** ^The sqlite3_create_collation_v2() works like sqlite3_create_collation()
+** with the addition that the xDestroy callback is invoked on pArg when
+** the collating function is deleted.
+** ^Collating functions are deleted when they are overridden by later
+** calls to the collation creation functions or when the
+** [database connection] is closed using [sqlite3_close()].
+**
+** ^The xDestroy callback is <u>not</u> called if the
+** sqlite3_create_collation_v2() function fails. Applications that invoke
+** sqlite3_create_collation_v2() with a non-NULL xDestroy argument should
+** check the return code and dispose of the application data pointer
+** themselves rather than expecting SQLite to deal with it for them.
+** This is different from every other SQLite interface. The inconsistency
+** is unfortunate but cannot be changed without breaking backwards
+** compatibility.
+**
+** See also: [sqlite3_collation_needed()] and [sqlite3_collation_needed16()].
+*/
+SQLITE_API int sqlite3_create_collation(
+ sqlite3*,
+ const char *zName,
+ int eTextRep,
+ void *pArg,
+ int(*xCompare)(void*,int,const void*,int,const void*)
+);
+SQLITE_API int sqlite3_create_collation_v2(
+ sqlite3*,
+ const char *zName,
+ int eTextRep,
+ void *pArg,
+ int(*xCompare)(void*,int,const void*,int,const void*),
+ void(*xDestroy)(void*)
+);
+SQLITE_API int sqlite3_create_collation16(
+ sqlite3*,
+ const void *zName,
+ int eTextRep,
+ void *pArg,
+ int(*xCompare)(void*,int,const void*,int,const void*)
+);
+
+/*
+** CAPI3REF: Collation Needed Callbacks
+** METHOD: sqlite3
+**
+** ^To avoid having to register all collation sequences before a database
+** can be used, a single callback function may be registered with the
+** [database connection] to be invoked whenever an undefined collation
+** sequence is required.
+**
+** ^If the function is registered using the sqlite3_collation_needed() API,
+** then it is passed the names of undefined collation sequences as strings
+** encoded in UTF-8. ^If sqlite3_collation_needed16() is used,
+** the names are passed as UTF-16 in machine native byte order.
+** ^A call to either function replaces the existing collation-needed callback.
+**
+** ^(When the callback is invoked, the first argument passed is a copy
+** of the second argument to sqlite3_collation_needed() or
+** sqlite3_collation_needed16(). The second argument is the database
+** connection. The third argument is one of [SQLITE_UTF8], [SQLITE_UTF16BE],
+** or [SQLITE_UTF16LE], indicating the most desirable form of the collation
+** sequence function required. The fourth parameter is the name of the
+** required collation sequence.)^
+**
+** The callback function should register the desired collation using
+** [sqlite3_create_collation()], [sqlite3_create_collation16()], or
+** [sqlite3_create_collation_v2()].
+*/
+SQLITE_API int sqlite3_collation_needed(
+ sqlite3*,
+ void*,
+ void(*)(void*,sqlite3*,int eTextRep,const char*)
+);
+SQLITE_API int sqlite3_collation_needed16(
+ sqlite3*,
+ void*,
+ void(*)(void*,sqlite3*,int eTextRep,const void*)
+);
+
+#ifdef SQLITE_ENABLE_CEROD
+/*
+** Specify the activation key for a CEROD database. Unless
+** activated, none of the CEROD routines will work.
+*/
+SQLITE_API void sqlite3_activate_cerod(
+ const char *zPassPhrase /* Activation phrase */
+);
+#endif
+
+/*
+** CAPI3REF: Suspend Execution For A Short Time
+**
+** The sqlite3_sleep() function causes the current thread to suspend execution
+** for at least a number of milliseconds specified in its parameter.
+**
+** If the operating system does not support sleep requests with
+** millisecond time resolution, then the time will be rounded up to
+** the nearest second. The number of milliseconds of sleep actually
+** requested from the operating system is returned.
+**
+** ^SQLite implements this interface by calling the xSleep()
+** method of the default [sqlite3_vfs] object. If the xSleep() method
+** of the default VFS is not implemented correctly, or not implemented at
+** all, then the behavior of sqlite3_sleep() may deviate from the description
+** in the previous paragraphs.
+**
+** If a negative argument is passed to sqlite3_sleep() the results vary by
+** VFS and operating system. Some system treat a negative argument as an
+** instruction to sleep forever. Others understand it to mean do not sleep
+** at all. ^In SQLite version 3.42.0 and later, a negative
+** argument passed into sqlite3_sleep() is changed to zero before it is relayed
+** down into the xSleep method of the VFS.
+*/
+SQLITE_API int sqlite3_sleep(int);
+
+/*
+** CAPI3REF: Name Of The Folder Holding Temporary Files
+**
+** ^(If this global variable is made to point to a string which is
+** the name of a folder (a.k.a. directory), then all temporary files
+** created by SQLite when using a built-in [sqlite3_vfs | VFS]
+** will be placed in that directory.)^ ^If this variable
+** is a NULL pointer, then SQLite performs a search for an appropriate
+** temporary file directory.
+**
+** Applications are strongly discouraged from using this global variable.
+** It is required to set a temporary folder on Windows Runtime (WinRT).
+** But for all other platforms, it is highly recommended that applications
+** neither read nor write this variable. This global variable is a relic
+** that exists for backwards compatibility of legacy applications and should
+** be avoided in new projects.
+**
+** It is not safe to read or modify this variable in more than one
+** thread at a time. It is not safe to read or modify this variable
+** if a [database connection] is being used at the same time in a separate
+** thread.
+** It is intended that this variable be set once
+** as part of process initialization and before any SQLite interface
+** routines have been called and that this variable remain unchanged
+** thereafter.
+**
+** ^The [temp_store_directory pragma] may modify this variable and cause
+** it to point to memory obtained from [sqlite3_malloc]. ^Furthermore,
+** the [temp_store_directory pragma] always assumes that any string
+** that this variable points to is held in memory obtained from
+** [sqlite3_malloc] and the pragma may attempt to free that memory
+** using [sqlite3_free].
+** Hence, if this variable is modified directly, either it should be
+** made NULL or made to point to memory obtained from [sqlite3_malloc]
+** or else the use of the [temp_store_directory pragma] should be avoided.
+** Except when requested by the [temp_store_directory pragma], SQLite
+** does not free the memory that sqlite3_temp_directory points to. If
+** the application wants that memory to be freed, it must do
+** so itself, taking care to only do so after all [database connection]
+** objects have been destroyed.
+**
+** <b>Note to Windows Runtime users:</b> The temporary directory must be set
+** prior to calling [sqlite3_open] or [sqlite3_open_v2]. Otherwise, various
+** features that require the use of temporary files may fail. Here is an
+** example of how to do this using C++ with the Windows Runtime:
+**
+** <blockquote><pre>
+** LPCWSTR zPath = Windows::Storage::ApplicationData::Current->
+** TemporaryFolder->Path->Data();
+** char zPathBuf[MAX_PATH + 1];
+** memset(zPathBuf, 0, sizeof(zPathBuf));
+** WideCharToMultiByte(CP_UTF8, 0, zPath, -1, zPathBuf, sizeof(zPathBuf),
+** NULL, NULL);
+** sqlite3_temp_directory = sqlite3_mprintf("%s", zPathBuf);
+** </pre></blockquote>
+*/
+SQLITE_API char *sqlite3_temp_directory;
+
+/*
+** CAPI3REF: Name Of The Folder Holding Database Files
+**
+** ^(If this global variable is made to point to a string which is
+** the name of a folder (a.k.a. directory), then all database files
+** specified with a relative pathname and created or accessed by
+** SQLite when using a built-in windows [sqlite3_vfs | VFS] will be assumed
+** to be relative to that directory.)^ ^If this variable is a NULL
+** pointer, then SQLite assumes that all database files specified
+** with a relative pathname are relative to the current directory
+** for the process. Only the windows VFS makes use of this global
+** variable; it is ignored by the unix VFS.
+**
+** Changing the value of this variable while a database connection is
+** open can result in a corrupt database.
+**
+** It is not safe to read or modify this variable in more than one
+** thread at a time. It is not safe to read or modify this variable
+** if a [database connection] is being used at the same time in a separate
+** thread.
+** It is intended that this variable be set once
+** as part of process initialization and before any SQLite interface
+** routines have been called and that this variable remain unchanged
+** thereafter.
+**
+** ^The [data_store_directory pragma] may modify this variable and cause
+** it to point to memory obtained from [sqlite3_malloc]. ^Furthermore,
+** the [data_store_directory pragma] always assumes that any string
+** that this variable points to is held in memory obtained from
+** [sqlite3_malloc] and the pragma may attempt to free that memory
+** using [sqlite3_free].
+** Hence, if this variable is modified directly, either it should be
+** made NULL or made to point to memory obtained from [sqlite3_malloc]
+** or else the use of the [data_store_directory pragma] should be avoided.
+*/
+SQLITE_API char *sqlite3_data_directory;
+
+/*
+** CAPI3REF: Win32 Specific Interface
+**
+** These interfaces are available only on Windows. The
+** [sqlite3_win32_set_directory] interface is used to set the value associated
+** with the [sqlite3_temp_directory] or [sqlite3_data_directory] variable, to
+** zValue, depending on the value of the type parameter. The zValue parameter
+** should be NULL to cause the previous value to be freed via [sqlite3_free];
+** a non-NULL value will be copied into memory obtained from [sqlite3_malloc]
+** prior to being used. The [sqlite3_win32_set_directory] interface returns
+** [SQLITE_OK] to indicate success, [SQLITE_ERROR] if the type is unsupported,
+** or [SQLITE_NOMEM] if memory could not be allocated. The value of the
+** [sqlite3_data_directory] variable is intended to act as a replacement for
+** the current directory on the sub-platforms of Win32 where that concept is
+** not present, e.g. WinRT and UWP. The [sqlite3_win32_set_directory8] and
+** [sqlite3_win32_set_directory16] interfaces behave exactly the same as the
+** sqlite3_win32_set_directory interface except the string parameter must be
+** UTF-8 or UTF-16, respectively.
+*/
+SQLITE_API int sqlite3_win32_set_directory(
+ unsigned long type, /* Identifier for directory being set or reset */
+ void *zValue /* New value for directory being set or reset */
+);
+SQLITE_API int sqlite3_win32_set_directory8(unsigned long type, const char *zValue);
+SQLITE_API int sqlite3_win32_set_directory16(unsigned long type, const void *zValue);
+
+/*
+** CAPI3REF: Win32 Directory Types
+**
+** These macros are only available on Windows. They define the allowed values
+** for the type argument to the [sqlite3_win32_set_directory] interface.
+*/
+#define SQLITE_WIN32_DATA_DIRECTORY_TYPE 1
+#define SQLITE_WIN32_TEMP_DIRECTORY_TYPE 2
+
+/*
+** CAPI3REF: Test For Auto-Commit Mode
+** KEYWORDS: {autocommit mode}
+** METHOD: sqlite3
+**
+** ^The sqlite3_get_autocommit() interface returns non-zero or
+** zero if the given database connection is or is not in autocommit mode,
+** respectively. ^Autocommit mode is on by default.
+** ^Autocommit mode is disabled by a [BEGIN] statement.
+** ^Autocommit mode is re-enabled by a [COMMIT] or [ROLLBACK].
+**
+** If certain kinds of errors occur on a statement within a multi-statement
+** transaction (errors including [SQLITE_FULL], [SQLITE_IOERR],
+** [SQLITE_NOMEM], [SQLITE_BUSY], and [SQLITE_INTERRUPT]) then the
+** transaction might be rolled back automatically. The only way to
+** find out whether SQLite automatically rolled back the transaction after
+** an error is to use this function.
+**
+** If another thread changes the autocommit status of the database
+** connection while this routine is running, then the return value
+** is undefined.
+*/
+SQLITE_API int sqlite3_get_autocommit(sqlite3*);
+
+/*
+** CAPI3REF: Find The Database Handle Of A Prepared Statement
+** METHOD: sqlite3_stmt
+**
+** ^The sqlite3_db_handle interface returns the [database connection] handle
+** to which a [prepared statement] belongs. ^The [database connection]
+** returned by sqlite3_db_handle is the same [database connection]
+** that was the first argument
+** to the [sqlite3_prepare_v2()] call (or its variants) that was used to
+** create the statement in the first place.
+*/
+SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
+
+/*
+** CAPI3REF: Return The Schema Name For A Database Connection
+** METHOD: sqlite3
+**
+** ^The sqlite3_db_name(D,N) interface returns a pointer to the schema name
+** for the N-th database on database connection D, or a NULL pointer of N is
+** out of range. An N value of 0 means the main database file. An N of 1 is
+** the "temp" schema. Larger values of N correspond to various ATTACH-ed
+** databases.
+**
+** Space to hold the string that is returned by sqlite3_db_name() is managed
+** by SQLite itself. The string might be deallocated by any operation that
+** changes the schema, including [ATTACH] or [DETACH] or calls to
+** [sqlite3_serialize()] or [sqlite3_deserialize()], even operations that
+** occur on a different thread. Applications that need to
+** remember the string long-term should make their own copy. Applications that
+** are accessing the same database connection simultaneously on multiple
+** threads should mutex-protect calls to this API and should make their own
+** private copy of the result prior to releasing the mutex.
+*/
+SQLITE_API const char *sqlite3_db_name(sqlite3 *db, int N);
+
+/*
+** CAPI3REF: Return The Filename For A Database Connection
+** METHOD: sqlite3
+**
+** ^The sqlite3_db_filename(D,N) interface returns a pointer to the filename
+** associated with database N of connection D.
+** ^If there is no attached database N on the database
+** connection D, or if database N is a temporary or in-memory database, then
+** this function will return either a NULL pointer or an empty string.
+**
+** ^The string value returned by this routine is owned and managed by
+** the database connection. ^The value will be valid until the database N
+** is [DETACH]-ed or until the database connection closes.
+**
+** ^The filename returned by this function is the output of the
+** xFullPathname method of the [VFS]. ^In other words, the filename
+** will be an absolute pathname, even if the filename used
+** to open the database originally was a URI or relative pathname.
+**
+** If the filename pointer returned by this routine is not NULL, then it
+** can be used as the filename input parameter to these routines:
+** <ul>
+** <li> [sqlite3_uri_parameter()]
+** <li> [sqlite3_uri_boolean()]
+** <li> [sqlite3_uri_int64()]
+** <li> [sqlite3_filename_database()]
+** <li> [sqlite3_filename_journal()]
+** <li> [sqlite3_filename_wal()]
+** </ul>
+*/
+SQLITE_API sqlite3_filename sqlite3_db_filename(sqlite3 *db, const char *zDbName);
+
+/*
+** CAPI3REF: Determine if a database is read-only
+** METHOD: sqlite3
+**
+** ^The sqlite3_db_readonly(D,N) interface returns 1 if the database N
+** of connection D is read-only, 0 if it is read/write, or -1 if N is not
+** the name of a database on connection D.
+*/
+SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName);
+
+/*
+** CAPI3REF: Determine the transaction state of a database
+** METHOD: sqlite3
+**
+** ^The sqlite3_txn_state(D,S) interface returns the current
+** [transaction state] of schema S in database connection D. ^If S is NULL,
+** then the highest transaction state of any schema on database connection D
+** is returned. Transaction states are (in order of lowest to highest):
+** <ol>
+** <li value="0"> SQLITE_TXN_NONE
+** <li value="1"> SQLITE_TXN_READ
+** <li value="2"> SQLITE_TXN_WRITE
+** </ol>
+** ^If the S argument to sqlite3_txn_state(D,S) is not the name of
+** a valid schema, then -1 is returned.
+*/
+SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema);
+
+/*
+** CAPI3REF: Allowed return values from sqlite3_txn_state()
+** KEYWORDS: {transaction state}
+**
+** These constants define the current transaction state of a database file.
+** ^The [sqlite3_txn_state(D,S)] interface returns one of these
+** constants in order to describe the transaction state of schema S
+** in [database connection] D.
+**
+** <dl>
+** [[SQLITE_TXN_NONE]] <dt>SQLITE_TXN_NONE</dt>
+** <dd>The SQLITE_TXN_NONE state means that no transaction is currently
+** pending.</dd>
+**
+** [[SQLITE_TXN_READ]] <dt>SQLITE_TXN_READ</dt>
+** <dd>The SQLITE_TXN_READ state means that the database is currently
+** in a read transaction. Content has been read from the database file
+** but nothing in the database file has changed. The transaction state
+** will advanced to SQLITE_TXN_WRITE if any changes occur and there are
+** no other conflicting concurrent write transactions. The transaction
+** state will revert to SQLITE_TXN_NONE following a [ROLLBACK] or
+** [COMMIT].</dd>
+**
+** [[SQLITE_TXN_WRITE]] <dt>SQLITE_TXN_WRITE</dt>
+** <dd>The SQLITE_TXN_WRITE state means that the database is currently
+** in a write transaction. Content has been written to the database file
+** but has not yet committed. The transaction state will change to
+** to SQLITE_TXN_NONE at the next [ROLLBACK] or [COMMIT].</dd>
+*/
+#define SQLITE_TXN_NONE 0
+#define SQLITE_TXN_READ 1
+#define SQLITE_TXN_WRITE 2
+
+/*
+** CAPI3REF: Find the next prepared statement
+** METHOD: sqlite3
+**
+** ^This interface returns a pointer to the next [prepared statement] after
+** pStmt associated with the [database connection] pDb. ^If pStmt is NULL
+** then this interface returns a pointer to the first prepared statement
+** associated with the database connection pDb. ^If no prepared statement
+** satisfies the conditions of this routine, it returns NULL.
+**
+** The [database connection] pointer D in a call to
+** [sqlite3_next_stmt(D,S)] must refer to an open database
+** connection and in particular must not be a NULL pointer.
+*/
+SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);
+
+/*
+** CAPI3REF: Commit And Rollback Notification Callbacks
+** METHOD: sqlite3
+**
+** ^The sqlite3_commit_hook() interface registers a callback
+** function to be invoked whenever a transaction is [COMMIT | committed].
+** ^Any callback set by a previous call to sqlite3_commit_hook()
+** for the same database connection is overridden.
+** ^The sqlite3_rollback_hook() interface registers a callback
+** function to be invoked whenever a transaction is [ROLLBACK | rolled back].
+** ^Any callback set by a previous call to sqlite3_rollback_hook()
+** for the same database connection is overridden.
+** ^The pArg argument is passed through to the callback.
+** ^If the callback on a commit hook function returns non-zero,
+** then the commit is converted into a rollback.
+**
+** ^The sqlite3_commit_hook(D,C,P) and sqlite3_rollback_hook(D,C,P) functions
+** return the P argument from the previous call of the same function
+** on the same [database connection] D, or NULL for
+** the first call for each function on D.
+**
+** The commit and rollback hook callbacks are not reentrant.
+** The callback implementation must not do anything that will modify
+** the database connection that invoked the callback. Any actions
+** to modify the database connection must be deferred until after the
+** completion of the [sqlite3_step()] call that triggered the commit
+** or rollback hook in the first place.
+** Note that running any other SQL statements, including SELECT statements,
+** or merely calling [sqlite3_prepare_v2()] and [sqlite3_step()] will modify
+** the database connections for the meaning of "modify" in this paragraph.
+**
+** ^Registering a NULL function disables the callback.
+**
+** ^When the commit hook callback routine returns zero, the [COMMIT]
+** operation is allowed to continue normally. ^If the commit hook
+** returns non-zero, then the [COMMIT] is converted into a [ROLLBACK].
+** ^The rollback hook is invoked on a rollback that results from a commit
+** hook returning non-zero, just as it would be with any other rollback.
+**
+** ^For the purposes of this API, a transaction is said to have been
+** rolled back if an explicit "ROLLBACK" statement is executed, or
+** an error or constraint causes an implicit rollback to occur.
+** ^The rollback callback is not invoked if a transaction is
+** automatically rolled back because the database connection is closed.
+**
+** See also the [sqlite3_update_hook()] interface.
+*/
+SQLITE_API void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
+SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
+
+/*
+** CAPI3REF: Autovacuum Compaction Amount Callback
+** METHOD: sqlite3
+**
+** ^The sqlite3_autovacuum_pages(D,C,P,X) interface registers a callback
+** function C that is invoked prior to each autovacuum of the database
+** file. ^The callback is passed a copy of the generic data pointer (P),
+** the schema-name of the attached database that is being autovacuumed,
+** the size of the database file in pages, the number of free pages,
+** and the number of bytes per page, respectively. The callback should
+** return the number of free pages that should be removed by the
+** autovacuum. ^If the callback returns zero, then no autovacuum happens.
+** ^If the value returned is greater than or equal to the number of
+** free pages, then a complete autovacuum happens.
+**
+** <p>^If there are multiple ATTACH-ed database files that are being
+** modified as part of a transaction commit, then the autovacuum pages
+** callback is invoked separately for each file.
+**
+** <p><b>The callback is not reentrant.</b> The callback function should
+** not attempt to invoke any other SQLite interface. If it does, bad
+** things may happen, including segmentation faults and corrupt database
+** files. The callback function should be a simple function that
+** does some arithmetic on its input parameters and returns a result.
+**
+** ^The X parameter to sqlite3_autovacuum_pages(D,C,P,X) is an optional
+** destructor for the P parameter. ^If X is not NULL, then X(P) is
+** invoked whenever the database connection closes or when the callback
+** is overwritten by another invocation of sqlite3_autovacuum_pages().
+**
+** <p>^There is only one autovacuum pages callback per database connection.
+** ^Each call to the sqlite3_autovacuum_pages() interface overrides all
+** previous invocations for that database connection. ^If the callback
+** argument (C) to sqlite3_autovacuum_pages(D,C,P,X) is a NULL pointer,
+** then the autovacuum steps callback is canceled. The return value
+** from sqlite3_autovacuum_pages() is normally SQLITE_OK, but might
+** be some other error code if something goes wrong. The current
+** implementation will only return SQLITE_OK or SQLITE_MISUSE, but other
+** return codes might be added in future releases.
+**
+** <p>If no autovacuum pages callback is specified (the usual case) or
+** a NULL pointer is provided for the callback,
+** then the default behavior is to vacuum all free pages. So, in other
+** words, the default behavior is the same as if the callback function
+** were something like this:
+**
+** <blockquote><pre>
+** unsigned int demonstration_autovac_pages_callback(
+** void *pClientData,
+** const char *zSchema,
+** unsigned int nDbPage,
+** unsigned int nFreePage,
+** unsigned int nBytePerPage
+** ){
+** return nFreePage;
+** }
+** </pre></blockquote>
+*/
+SQLITE_API int sqlite3_autovacuum_pages(
+ sqlite3 *db,
+ unsigned int(*)(void*,const char*,unsigned int,unsigned int,unsigned int),
+ void*,
+ void(*)(void*)
+);
+
+
+/*
+** CAPI3REF: Data Change Notification Callbacks
+** METHOD: sqlite3
+**
+** ^The sqlite3_update_hook() interface registers a callback function
+** with the [database connection] identified by the first argument
+** to be invoked whenever a row is updated, inserted or deleted in
+** a [rowid table].
+** ^Any callback set by a previous call to this function
+** for the same database connection is overridden.
+**
+** ^The second argument is a pointer to the function to invoke when a
+** row is updated, inserted or deleted in a rowid table.
+** ^The first argument to the callback is a copy of the third argument
+** to sqlite3_update_hook().
+** ^The second callback argument is one of [SQLITE_INSERT], [SQLITE_DELETE],
+** or [SQLITE_UPDATE], depending on the operation that caused the callback
+** to be invoked.
+** ^The third and fourth arguments to the callback contain pointers to the
+** database and table name containing the affected row.
+** ^The final callback parameter is the [rowid] of the row.
+** ^In the case of an update, this is the [rowid] after the update takes place.
+**
+** ^(The update hook is not invoked when internal system tables are
+** modified (i.e. sqlite_sequence).)^
+** ^The update hook is not invoked when [WITHOUT ROWID] tables are modified.
+**
+** ^In the current implementation, the update hook
+** is not invoked when conflicting rows are deleted because of an
+** [ON CONFLICT | ON CONFLICT REPLACE] clause. ^Nor is the update hook
+** invoked when rows are deleted using the [truncate optimization].
+** The exceptions defined in this paragraph might change in a future
+** release of SQLite.
+**
+** Whether the update hook is invoked before or after the
+** corresponding change is currently unspecified and may differ
+** depending on the type of change. Do not rely on the order of the
+** hook call with regards to the final result of the operation which
+** triggers the hook.
+**
+** The update hook implementation must not do anything that will modify
+** the database connection that invoked the update hook. Any actions
+** to modify the database connection must be deferred until after the
+** completion of the [sqlite3_step()] call that triggered the update hook.
+** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
+** database connections for the meaning of "modify" in this paragraph.
+**
+** ^The sqlite3_update_hook(D,C,P) function
+** returns the P argument from the previous call
+** on the same [database connection] D, or NULL for
+** the first call on D.
+**
+** See also the [sqlite3_commit_hook()], [sqlite3_rollback_hook()],
+** and [sqlite3_preupdate_hook()] interfaces.
+*/
+SQLITE_API void *sqlite3_update_hook(
+ sqlite3*,
+ void(*)(void *,int ,char const *,char const *,sqlite3_int64),
+ void*
+);
+
+/*
+** CAPI3REF: Enable Or Disable Shared Pager Cache
+**
+** ^(This routine enables or disables the sharing of the database cache
+** and schema data structures between [database connection | connections]
+** to the same database. Sharing is enabled if the argument is true
+** and disabled if the argument is false.)^
+**
+** This interface is omitted if SQLite is compiled with
+** [-DSQLITE_OMIT_SHARED_CACHE]. The [-DSQLITE_OMIT_SHARED_CACHE]
+** compile-time option is recommended because the
+** [use of shared cache mode is discouraged].
+**
+** ^Cache sharing is enabled and disabled for an entire process.
+** This is a change as of SQLite [version 3.5.0] ([dateof:3.5.0]).
+** In prior versions of SQLite,
+** sharing was enabled or disabled for each thread separately.
+**
+** ^(The cache sharing mode set by this interface effects all subsequent
+** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()].
+** Existing database connections continue to use the sharing mode
+** that was in effect at the time they were opened.)^
+**
+** ^(This routine returns [SQLITE_OK] if shared cache was enabled or disabled
+** successfully. An [error code] is returned otherwise.)^
+**
+** ^Shared cache is disabled by default. It is recommended that it stay
+** that way. In other words, do not use this routine. This interface
+** continues to be provided for historical compatibility, but its use is
+** discouraged. Any use of shared cache is discouraged. If shared cache
+** must be used, it is recommended that shared cache only be enabled for
+** individual database connections using the [sqlite3_open_v2()] interface
+** with the [SQLITE_OPEN_SHAREDCACHE] flag.
+**
+** Note: This method is disabled on MacOS X 10.7 and iOS version 5.0
+** and will always return SQLITE_MISUSE. On those systems,
+** shared cache mode should be enabled per-database connection via
+** [sqlite3_open_v2()] with [SQLITE_OPEN_SHAREDCACHE].
+**
+** This interface is threadsafe on processors where writing a
+** 32-bit integer is atomic.
+**
+** See Also: [SQLite Shared-Cache Mode]
+*/
+SQLITE_API int sqlite3_enable_shared_cache(int);
+
+/*
+** CAPI3REF: Attempt To Free Heap Memory
+**
+** ^The sqlite3_release_memory() interface attempts to free N bytes
+** of heap memory by deallocating non-essential memory allocations
+** held by the database library. Memory used to cache database
+** pages to improve performance is an example of non-essential memory.
+** ^sqlite3_release_memory() returns the number of bytes actually freed,
+** which might be more or less than the amount requested.
+** ^The sqlite3_release_memory() routine is a no-op returning zero
+** if SQLite is not compiled with [SQLITE_ENABLE_MEMORY_MANAGEMENT].
+**
+** See also: [sqlite3_db_release_memory()]
+*/
+SQLITE_API int sqlite3_release_memory(int);
+
+/*
+** CAPI3REF: Free Memory Used By A Database Connection
+** METHOD: sqlite3
+**
+** ^The sqlite3_db_release_memory(D) interface attempts to free as much heap
+** memory as possible from database connection D. Unlike the
+** [sqlite3_release_memory()] interface, this interface is in effect even
+** when the [SQLITE_ENABLE_MEMORY_MANAGEMENT] compile-time option is
+** omitted.
+**
+** See also: [sqlite3_release_memory()]
+*/
+SQLITE_API int sqlite3_db_release_memory(sqlite3*);
+
+/*
+** CAPI3REF: Impose A Limit On Heap Size
+**
+** These interfaces impose limits on the amount of heap memory that will be
+** by all database connections within a single process.
+**
+** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the
+** soft limit on the amount of heap memory that may be allocated by SQLite.
+** ^SQLite strives to keep heap memory utilization below the soft heap
+** limit by reducing the number of pages held in the page cache
+** as heap memory usages approaches the limit.
+** ^The soft heap limit is "soft" because even though SQLite strives to stay
+** below the limit, it will exceed the limit rather than generate
+** an [SQLITE_NOMEM] error. In other words, the soft heap limit
+** is advisory only.
+**
+** ^The sqlite3_hard_heap_limit64(N) interface sets a hard upper bound of
+** N bytes on the amount of memory that will be allocated. ^The
+** sqlite3_hard_heap_limit64(N) interface is similar to
+** sqlite3_soft_heap_limit64(N) except that memory allocations will fail
+** when the hard heap limit is reached.
+**
+** ^The return value from both sqlite3_soft_heap_limit64() and
+** sqlite3_hard_heap_limit64() is the size of
+** the heap limit prior to the call, or negative in the case of an
+** error. ^If the argument N is negative
+** then no change is made to the heap limit. Hence, the current
+** size of heap limits can be determined by invoking
+** sqlite3_soft_heap_limit64(-1) or sqlite3_hard_heap_limit(-1).
+**
+** ^Setting the heap limits to zero disables the heap limiter mechanism.
+**
+** ^The soft heap limit may not be greater than the hard heap limit.
+** ^If the hard heap limit is enabled and if sqlite3_soft_heap_limit(N)
+** is invoked with a value of N that is greater than the hard heap limit,
+** the soft heap limit is set to the value of the hard heap limit.
+** ^The soft heap limit is automatically enabled whenever the hard heap
+** limit is enabled. ^When sqlite3_hard_heap_limit64(N) is invoked and
+** the soft heap limit is outside the range of 1..N, then the soft heap
+** limit is set to N. ^Invoking sqlite3_soft_heap_limit64(0) when the
+** hard heap limit is enabled makes the soft heap limit equal to the
+** hard heap limit.
+**
+** The memory allocation limits can also be adjusted using
+** [PRAGMA soft_heap_limit] and [PRAGMA hard_heap_limit].
+**
+** ^(The heap limits are not enforced in the current implementation
+** if one or more of following conditions are true:
+**
+** <ul>
+** <li> The limit value is set to zero.
+** <li> Memory accounting is disabled using a combination of the
+** [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],...) start-time option and
+** the [SQLITE_DEFAULT_MEMSTATUS] compile-time option.
+** <li> An alternative page cache implementation is specified using
+** [sqlite3_config]([SQLITE_CONFIG_PCACHE2],...).
+** <li> The page cache allocates from its own memory pool supplied
+** by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than
+** from the heap.
+** </ul>)^
+**
+** The circumstances under which SQLite will enforce the heap limits may
+** changes in future releases of SQLite.
+*/
+SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N);
+SQLITE_API sqlite3_int64 sqlite3_hard_heap_limit64(sqlite3_int64 N);
+
+/*
+** CAPI3REF: Deprecated Soft Heap Limit Interface
+** DEPRECATED
+**
+** This is a deprecated version of the [sqlite3_soft_heap_limit64()]
+** interface. This routine is provided for historical compatibility
+** only. All new applications should use the
+** [sqlite3_soft_heap_limit64()] interface rather than this one.
+*/
+SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N);
+
+
+/*
+** CAPI3REF: Extract Metadata About A Column Of A Table
+** METHOD: sqlite3
+**
+** ^(The sqlite3_table_column_metadata(X,D,T,C,....) routine returns
+** information about column C of table T in database D
+** on [database connection] X.)^ ^The sqlite3_table_column_metadata()
+** interface returns SQLITE_OK and fills in the non-NULL pointers in
+** the final five arguments with appropriate values if the specified
+** column exists. ^The sqlite3_table_column_metadata() interface returns
+** SQLITE_ERROR if the specified column does not exist.
+** ^If the column-name parameter to sqlite3_table_column_metadata() is a
+** NULL pointer, then this routine simply checks for the existence of the
+** table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it
+** does not. If the table name parameter T in a call to
+** sqlite3_table_column_metadata(X,D,T,C,...) is NULL then the result is
+** undefined behavior.
+**
+** ^The column is identified by the second, third and fourth parameters to
+** this function. ^(The second parameter is either the name of the database
+** (i.e. "main", "temp", or an attached database) containing the specified
+** table or NULL.)^ ^If it is NULL, then all attached databases are searched
+** for the table using the same algorithm used by the database engine to
+** resolve unqualified table references.
+**
+** ^The third and fourth parameters to this function are the table and column
+** name of the desired column, respectively.
+**
+** ^Metadata is returned by writing to the memory locations passed as the 5th
+** and subsequent parameters to this function. ^Any of these arguments may be
+** NULL, in which case the corresponding element of metadata is omitted.
+**
+** ^(<blockquote>
+** <table border="1">
+** <tr><th> Parameter <th> Output<br>Type <th> Description
+**
+** <tr><td> 5th <td> const char* <td> Data type
+** <tr><td> 6th <td> const char* <td> Name of default collation sequence
+** <tr><td> 7th <td> int <td> True if column has a NOT NULL constraint
+** <tr><td> 8th <td> int <td> True if column is part of the PRIMARY KEY
+** <tr><td> 9th <td> int <td> True if column is [AUTOINCREMENT]
+** </table>
+** </blockquote>)^
+**
+** ^The memory pointed to by the character pointers returned for the
+** declaration type and collation sequence is valid until the next
+** call to any SQLite API function.
+**
+** ^If the specified table is actually a view, an [error code] is returned.
+**
+** ^If the specified column is "rowid", "oid" or "_rowid_" and the table
+** is not a [WITHOUT ROWID] table and an
+** [INTEGER PRIMARY KEY] column has been explicitly declared, then the output
+** parameters are set for the explicitly declared column. ^(If there is no
+** [INTEGER PRIMARY KEY] column, then the outputs
+** for the [rowid] are set as follows:
+**
+** <pre>
+** data type: "INTEGER"
+** collation sequence: "BINARY"
+** not null: 0
+** primary key: 1
+** auto increment: 0
+** </pre>)^
+**
+** ^This function causes all database schemas to be read from disk and
+** parsed, if that has not already been done, and returns an error if
+** any errors are encountered while loading the schema.
+*/
+SQLITE_API int sqlite3_table_column_metadata(
+ sqlite3 *db, /* Connection handle */
+ const char *zDbName, /* Database name or NULL */
+ const char *zTableName, /* Table name */
+ const char *zColumnName, /* Column name */
+ char const **pzDataType, /* OUTPUT: Declared data type */
+ char const **pzCollSeq, /* OUTPUT: Collation sequence name */
+ int *pNotNull, /* OUTPUT: True if NOT NULL constraint exists */
+ int *pPrimaryKey, /* OUTPUT: True if column part of PK */
+ int *pAutoinc /* OUTPUT: True if column is auto-increment */
+);
+
+/*
+** CAPI3REF: Load An Extension
+** METHOD: sqlite3
+**
+** ^This interface loads an SQLite extension library from the named file.
+**
+** ^The sqlite3_load_extension() interface attempts to load an
+** [SQLite extension] library contained in the file zFile. If
+** the file cannot be loaded directly, attempts are made to load
+** with various operating-system specific extensions added.
+** So for example, if "samplelib" cannot be loaded, then names like
+** "samplelib.so" or "samplelib.dylib" or "samplelib.dll" might
+** be tried also.
+**
+** ^The entry point is zProc.
+** ^(zProc may be 0, in which case SQLite will try to come up with an
+** entry point name on its own. It first tries "sqlite3_extension_init".
+** If that does not work, it constructs a name "sqlite3_X_init" where the
+** X is consists of the lower-case equivalent of all ASCII alphabetic
+** characters in the filename from the last "/" to the first following
+** "." and omitting any initial "lib".)^
+** ^The sqlite3_load_extension() interface returns
+** [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong.
+** ^If an error occurs and pzErrMsg is not 0, then the
+** [sqlite3_load_extension()] interface shall attempt to
+** fill *pzErrMsg with error message text stored in memory
+** obtained from [sqlite3_malloc()]. The calling function
+** should free this memory by calling [sqlite3_free()].
+**
+** ^Extension loading must be enabled using
+** [sqlite3_enable_load_extension()] or
+** [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],1,NULL)
+** prior to calling this API,
+** otherwise an error will be returned.
+**
+** <b>Security warning:</b> It is recommended that the
+** [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method be used to enable only this
+** interface. The use of the [sqlite3_enable_load_extension()] interface
+** should be avoided. This will keep the SQL function [load_extension()]
+** disabled and prevent SQL injections from giving attackers
+** access to extension loading capabilities.
+**
+** See also the [load_extension() SQL function].
+*/
+SQLITE_API int sqlite3_load_extension(
+ sqlite3 *db, /* Load the extension into this database connection */
+ const char *zFile, /* Name of the shared library containing extension */
+ const char *zProc, /* Entry point. Derived from zFile if 0 */
+ char **pzErrMsg /* Put error message here if not 0 */
+);
+
+/*
+** CAPI3REF: Enable Or Disable Extension Loading
+** METHOD: sqlite3
+**
+** ^So as not to open security holes in older applications that are
+** unprepared to deal with [extension loading], and as a means of disabling
+** [extension loading] while evaluating user-entered SQL, the following API
+** is provided to turn the [sqlite3_load_extension()] mechanism on and off.
+**
+** ^Extension loading is off by default.
+** ^Call the sqlite3_enable_load_extension() routine with onoff==1
+** to turn extension loading on and call it with onoff==0 to turn
+** it back off again.
+**
+** ^This interface enables or disables both the C-API
+** [sqlite3_load_extension()] and the SQL function [load_extension()].
+** ^(Use [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],..)
+** to enable or disable only the C-API.)^
+**
+** <b>Security warning:</b> It is recommended that extension loading
+** be enabled using the [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method
+** rather than this interface, so the [load_extension()] SQL function
+** remains disabled. This will prevent SQL injections from giving attackers
+** access to extension loading capabilities.
+*/
+SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
+
+/*
+** CAPI3REF: Automatically Load Statically Linked Extensions
+**
+** ^This interface causes the xEntryPoint() function to be invoked for
+** each new [database connection] that is created. The idea here is that
+** xEntryPoint() is the entry point for a statically linked [SQLite extension]
+** that is to be automatically loaded into all new database connections.
+**
+** ^(Even though the function prototype shows that xEntryPoint() takes
+** no arguments and returns void, SQLite invokes xEntryPoint() with three
+** arguments and expects an integer result as if the signature of the
+** entry point where as follows:
+**
+** <blockquote><pre>
+** int xEntryPoint(
+** sqlite3 *db,
+** const char **pzErrMsg,
+** const struct sqlite3_api_routines *pThunk
+** );
+** </pre></blockquote>)^
+**
+** If the xEntryPoint routine encounters an error, it should make *pzErrMsg
+** point to an appropriate error message (obtained from [sqlite3_mprintf()])
+** and return an appropriate [error code]. ^SQLite ensures that *pzErrMsg
+** is NULL before calling the xEntryPoint(). ^SQLite will invoke
+** [sqlite3_free()] on *pzErrMsg after xEntryPoint() returns. ^If any
+** xEntryPoint() returns an error, the [sqlite3_open()], [sqlite3_open16()],
+** or [sqlite3_open_v2()] call that provoked the xEntryPoint() will fail.
+**
+** ^Calling sqlite3_auto_extension(X) with an entry point X that is already
+** on the list of automatic extensions is a harmless no-op. ^No entry point
+** will be called more than once for each database connection that is opened.
+**
+** See also: [sqlite3_reset_auto_extension()]
+** and [sqlite3_cancel_auto_extension()]
+*/
+SQLITE_API int sqlite3_auto_extension(void(*xEntryPoint)(void));
+
+/*
+** CAPI3REF: Cancel Automatic Extension Loading
+**
+** ^The [sqlite3_cancel_auto_extension(X)] interface unregisters the
+** initialization routine X that was registered using a prior call to
+** [sqlite3_auto_extension(X)]. ^The [sqlite3_cancel_auto_extension(X)]
+** routine returns 1 if initialization routine X was successfully
+** unregistered and it returns 0 if X was not on the list of initialization
+** routines.
+*/
+SQLITE_API int sqlite3_cancel_auto_extension(void(*xEntryPoint)(void));
+
+/*
+** CAPI3REF: Reset Automatic Extension Loading
+**
+** ^This interface disables all automatic extensions previously
+** registered using [sqlite3_auto_extension()].
+*/
+SQLITE_API void sqlite3_reset_auto_extension(void);
+
+/*
+** Structures used by the virtual table interface
+*/
+typedef struct sqlite3_vtab sqlite3_vtab;
+typedef struct sqlite3_index_info sqlite3_index_info;
+typedef struct sqlite3_vtab_cursor sqlite3_vtab_cursor;
+typedef struct sqlite3_module sqlite3_module;
+
+/*
+** CAPI3REF: Virtual Table Object
+** KEYWORDS: sqlite3_module {virtual table module}
+**
+** This structure, sometimes called a "virtual table module",
+** defines the implementation of a [virtual table].
+** This structure consists mostly of methods for the module.
+**
+** ^A virtual table module is created by filling in a persistent
+** instance of this structure and passing a pointer to that instance
+** to [sqlite3_create_module()] or [sqlite3_create_module_v2()].
+** ^The registration remains valid until it is replaced by a different
+** module or until the [database connection] closes. The content
+** of this structure must not change while it is registered with
+** any database connection.
+*/
+struct sqlite3_module {
+ int iVersion;
+ int (*xCreate)(sqlite3*, void *pAux,
+ int argc, const char *const*argv,
+ sqlite3_vtab **ppVTab, char**);
+ int (*xConnect)(sqlite3*, void *pAux,
+ int argc, const char *const*argv,
+ sqlite3_vtab **ppVTab, char**);
+ int (*xBestIndex)(sqlite3_vtab *pVTab, sqlite3_index_info*);
+ int (*xDisconnect)(sqlite3_vtab *pVTab);
+ int (*xDestroy)(sqlite3_vtab *pVTab);
+ int (*xOpen)(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor);
+ int (*xClose)(sqlite3_vtab_cursor*);
+ int (*xFilter)(sqlite3_vtab_cursor*, int idxNum, const char *idxStr,
+ int argc, sqlite3_value **argv);
+ int (*xNext)(sqlite3_vtab_cursor*);
+ int (*xEof)(sqlite3_vtab_cursor*);
+ int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int);
+ int (*xRowid)(sqlite3_vtab_cursor*, sqlite3_int64 *pRowid);
+ int (*xUpdate)(sqlite3_vtab *, int, sqlite3_value **, sqlite3_int64 *);
+ int (*xBegin)(sqlite3_vtab *pVTab);
+ int (*xSync)(sqlite3_vtab *pVTab);
+ int (*xCommit)(sqlite3_vtab *pVTab);
+ int (*xRollback)(sqlite3_vtab *pVTab);
+ int (*xFindFunction)(sqlite3_vtab *pVtab, int nArg, const char *zName,
+ void (**pxFunc)(sqlite3_context*,int,sqlite3_value**),
+ void **ppArg);
+ int (*xRename)(sqlite3_vtab *pVtab, const char *zNew);
+ /* The methods above are in version 1 of the sqlite_module object. Those
+ ** below are for version 2 and greater. */
+ int (*xSavepoint)(sqlite3_vtab *pVTab, int);
+ int (*xRelease)(sqlite3_vtab *pVTab, int);
+ int (*xRollbackTo)(sqlite3_vtab *pVTab, int);
+ /* The methods above are in versions 1 and 2 of the sqlite_module object.
+ ** Those below are for version 3 and greater. */
+ int (*xShadowName)(const char*);
+ /* The methods above are in versions 1 through 3 of the sqlite_module object.
+ ** Those below are for version 4 and greater. */
+ int (*xIntegrity)(sqlite3_vtab *pVTab, const char *zSchema,
+ const char *zTabName, int mFlags, char **pzErr);
+};
+
+/*
+** CAPI3REF: Virtual Table Indexing Information
+** KEYWORDS: sqlite3_index_info
+**
+** The sqlite3_index_info structure and its substructures is used as part
+** of the [virtual table] interface to
+** pass information into and receive the reply from the [xBestIndex]
+** method of a [virtual table module]. The fields under **Inputs** are the
+** inputs to xBestIndex and are read-only. xBestIndex inserts its
+** results into the **Outputs** fields.
+**
+** ^(The aConstraint[] array records WHERE clause constraints of the form:
+**
+** <blockquote>column OP expr</blockquote>
+**
+** where OP is =, <, <=, >, or >=.)^ ^(The particular operator is
+** stored in aConstraint[].op using one of the
+** [SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_ values].)^
+** ^(The index of the column is stored in
+** aConstraint[].iColumn.)^ ^(aConstraint[].usable is TRUE if the
+** expr on the right-hand side can be evaluated (and thus the constraint
+** is usable) and false if it cannot.)^
+**
+** ^The optimizer automatically inverts terms of the form "expr OP column"
+** and makes other simplifications to the WHERE clause in an attempt to
+** get as many WHERE clause terms into the form shown above as possible.
+** ^The aConstraint[] array only reports WHERE clause terms that are
+** relevant to the particular virtual table being queried.
+**
+** ^Information about the ORDER BY clause is stored in aOrderBy[].
+** ^Each term of aOrderBy records a column of the ORDER BY clause.
+**
+** The colUsed field indicates which columns of the virtual table may be
+** required by the current scan. Virtual table columns are numbered from
+** zero in the order in which they appear within the CREATE TABLE statement
+** passed to sqlite3_declare_vtab(). For the first 63 columns (columns 0-62),
+** the corresponding bit is set within the colUsed mask if the column may be
+** required by SQLite. If the table has at least 64 columns and any column
+** to the right of the first 63 is required, then bit 63 of colUsed is also
+** set. In other words, column iCol may be required if the expression
+** (colUsed & ((sqlite3_uint64)1 << (iCol>=63 ? 63 : iCol))) evaluates to
+** non-zero.
+**
+** The [xBestIndex] method must fill aConstraintUsage[] with information
+** about what parameters to pass to xFilter. ^If argvIndex>0 then
+** the right-hand side of the corresponding aConstraint[] is evaluated
+** and becomes the argvIndex-th entry in argv. ^(If aConstraintUsage[].omit
+** is true, then the constraint is assumed to be fully handled by the
+** virtual table and might not be checked again by the byte code.)^ ^(The
+** aConstraintUsage[].omit flag is an optimization hint. When the omit flag
+** is left in its default setting of false, the constraint will always be
+** checked separately in byte code. If the omit flag is change to true, then
+** the constraint may or may not be checked in byte code. In other words,
+** when the omit flag is true there is no guarantee that the constraint will
+** not be checked again using byte code.)^
+**
+** ^The idxNum and idxStr values are recorded and passed into the
+** [xFilter] method.
+** ^[sqlite3_free()] is used to free idxStr if and only if
+** needToFreeIdxStr is true.
+**
+** ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in
+** the correct order to satisfy the ORDER BY clause so that no separate
+** sorting step is required.
+**
+** ^The estimatedCost value is an estimate of the cost of a particular
+** strategy. A cost of N indicates that the cost of the strategy is similar
+** to a linear scan of an SQLite table with N rows. A cost of log(N)
+** indicates that the expense of the operation is similar to that of a
+** binary search on a unique indexed field of an SQLite table with N rows.
+**
+** ^The estimatedRows value is an estimate of the number of rows that
+** will be returned by the strategy.
+**
+** The xBestIndex method may optionally populate the idxFlags field with a
+** mask of SQLITE_INDEX_SCAN_* flags. One such flag is
+** [SQLITE_INDEX_SCAN_HEX], which if set causes the [EXPLAIN QUERY PLAN]
+** output to show the idxNum has hex instead of as decimal. Another flag is
+** SQLITE_INDEX_SCAN_UNIQUE, which if set indicates that the query plan will
+** return at most one row.
+**
+** Additionally, if xBestIndex sets the SQLITE_INDEX_SCAN_UNIQUE flag, then
+** SQLite also assumes that if a call to the xUpdate() method is made as
+** part of the same statement to delete or update a virtual table row and the
+** implementation returns SQLITE_CONSTRAINT, then there is no need to rollback
+** any database changes. In other words, if the xUpdate() returns
+** SQLITE_CONSTRAINT, the database contents must be exactly as they were
+** before xUpdate was called. By contrast, if SQLITE_INDEX_SCAN_UNIQUE is not
+** set and xUpdate returns SQLITE_CONSTRAINT, any database changes made by
+** the xUpdate method are automatically rolled back by SQLite.
+**
+** IMPORTANT: The estimatedRows field was added to the sqlite3_index_info
+** structure for SQLite [version 3.8.2] ([dateof:3.8.2]).
+** If a virtual table extension is
+** used with an SQLite version earlier than 3.8.2, the results of attempting
+** to read or write the estimatedRows field are undefined (but are likely
+** to include crashing the application). The estimatedRows field should
+** therefore only be used if [sqlite3_libversion_number()] returns a
+** value greater than or equal to 3008002. Similarly, the idxFlags field
+** was added for [version 3.9.0] ([dateof:3.9.0]).
+** It may therefore only be used if
+** sqlite3_libversion_number() returns a value greater than or equal to
+** 3009000.
+*/
+struct sqlite3_index_info {
+ /* Inputs */
+ int nConstraint; /* Number of entries in aConstraint */
+ struct sqlite3_index_constraint {
+ int iColumn; /* Column constrained. -1 for ROWID */
+ unsigned char op; /* Constraint operator */
+ unsigned char usable; /* True if this constraint is usable */
+ int iTermOffset; /* Used internally - xBestIndex should ignore */
+ } *aConstraint; /* Table of WHERE clause constraints */
+ int nOrderBy; /* Number of terms in the ORDER BY clause */
+ struct sqlite3_index_orderby {
+ int iColumn; /* Column number */
+ unsigned char desc; /* True for DESC. False for ASC. */
+ } *aOrderBy; /* The ORDER BY clause */
+ /* Outputs */
+ struct sqlite3_index_constraint_usage {
+ int argvIndex; /* if >0, constraint is part of argv to xFilter */
+ unsigned char omit; /* Do not code a test for this constraint */
+ } *aConstraintUsage;
+ int idxNum; /* Number used to identify the index */
+ char *idxStr; /* String, possibly obtained from sqlite3_malloc */
+ int needToFreeIdxStr; /* Free idxStr using sqlite3_free() if true */
+ int orderByConsumed; /* True if output is already ordered */
+ double estimatedCost; /* Estimated cost of using this index */
+ /* Fields below are only available in SQLite 3.8.2 and later */
+ sqlite3_int64 estimatedRows; /* Estimated number of rows returned */
+ /* Fields below are only available in SQLite 3.9.0 and later */
+ int idxFlags; /* Mask of SQLITE_INDEX_SCAN_* flags */
+ /* Fields below are only available in SQLite 3.10.0 and later */
+ sqlite3_uint64 colUsed; /* Input: Mask of columns used by statement */
+};
+
+/*
+** CAPI3REF: Virtual Table Scan Flags
+**
+** Virtual table implementations are allowed to set the
+** [sqlite3_index_info].idxFlags field to some combination of
+** these bits.
+*/
+#define SQLITE_INDEX_SCAN_UNIQUE 0x00000001 /* Scan visits at most 1 row */
+#define SQLITE_INDEX_SCAN_HEX 0x00000002 /* Display idxNum as hex */
+ /* in EXPLAIN QUERY PLAN */
+
+/*
+** CAPI3REF: Virtual Table Constraint Operator Codes
+**
+** These macros define the allowed values for the
+** [sqlite3_index_info].aConstraint[].op field. Each value represents
+** an operator that is part of a constraint term in the WHERE clause of
+** a query that uses a [virtual table].
+**
+** ^The left-hand operand of the operator is given by the corresponding
+** aConstraint[].iColumn field. ^An iColumn of -1 indicates the left-hand
+** operand is the rowid.
+** The SQLITE_INDEX_CONSTRAINT_LIMIT and SQLITE_INDEX_CONSTRAINT_OFFSET
+** operators have no left-hand operand, and so for those operators the
+** corresponding aConstraint[].iColumn is meaningless and should not be
+** used.
+**
+** All operator values from SQLITE_INDEX_CONSTRAINT_FUNCTION through
+** value 255 are reserved to represent functions that are overloaded
+** by the [xFindFunction|xFindFunction method] of the virtual table
+** implementation.
+**
+** The right-hand operands for each constraint might be accessible using
+** the [sqlite3_vtab_rhs_value()] interface. Usually the right-hand
+** operand is only available if it appears as a single constant literal
+** in the input SQL. If the right-hand operand is another column or an
+** expression (even a constant expression) or a parameter, then the
+** sqlite3_vtab_rhs_value() probably will not be able to extract it.
+** ^The SQLITE_INDEX_CONSTRAINT_ISNULL and
+** SQLITE_INDEX_CONSTRAINT_ISNOTNULL operators have no right-hand operand
+** and hence calls to sqlite3_vtab_rhs_value() for those operators will
+** always return SQLITE_NOTFOUND.
+**
+** The collating sequence to be used for comparison can be found using
+** the [sqlite3_vtab_collation()] interface. For most real-world virtual
+** tables, the collating sequence of constraints does not matter (for example
+** because the constraints are numeric) and so the sqlite3_vtab_collation()
+** interface is not commonly needed.
+*/
+#define SQLITE_INDEX_CONSTRAINT_EQ 2
+#define SQLITE_INDEX_CONSTRAINT_GT 4
+#define SQLITE_INDEX_CONSTRAINT_LE 8
+#define SQLITE_INDEX_CONSTRAINT_LT 16
+#define SQLITE_INDEX_CONSTRAINT_GE 32
+#define SQLITE_INDEX_CONSTRAINT_MATCH 64
+#define SQLITE_INDEX_CONSTRAINT_LIKE 65
+#define SQLITE_INDEX_CONSTRAINT_GLOB 66
+#define SQLITE_INDEX_CONSTRAINT_REGEXP 67
+#define SQLITE_INDEX_CONSTRAINT_NE 68
+#define SQLITE_INDEX_CONSTRAINT_ISNOT 69
+#define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70
+#define SQLITE_INDEX_CONSTRAINT_ISNULL 71
+#define SQLITE_INDEX_CONSTRAINT_IS 72
+#define SQLITE_INDEX_CONSTRAINT_LIMIT 73
+#define SQLITE_INDEX_CONSTRAINT_OFFSET 74
+#define SQLITE_INDEX_CONSTRAINT_FUNCTION 150
+
+/*
+** CAPI3REF: Register A Virtual Table Implementation
+** METHOD: sqlite3
+**
+** ^These routines are used to register a new [virtual table module] name.
+** ^Module names must be registered before
+** creating a new [virtual table] using the module and before using a
+** preexisting [virtual table] for the module.
+**
+** ^The module name is registered on the [database connection] specified
+** by the first parameter. ^The name of the module is given by the
+** second parameter. ^The third parameter is a pointer to
+** the implementation of the [virtual table module]. ^The fourth
+** parameter is an arbitrary client data pointer that is passed through
+** into the [xCreate] and [xConnect] methods of the virtual table module
+** when a new virtual table is be being created or reinitialized.
+**
+** ^The sqlite3_create_module_v2() interface has a fifth parameter which
+** is a pointer to a destructor for the pClientData. ^SQLite will
+** invoke the destructor function (if it is not NULL) when SQLite
+** no longer needs the pClientData pointer. ^The destructor will also
+** be invoked if the call to sqlite3_create_module_v2() fails.
+** ^The sqlite3_create_module()
+** interface is equivalent to sqlite3_create_module_v2() with a NULL
+** destructor.
+**
+** ^If the third parameter (the pointer to the sqlite3_module object) is
+** NULL then no new module is created and any existing modules with the
+** same name are dropped.
+**
+** See also: [sqlite3_drop_modules()]
+*/
+SQLITE_API int sqlite3_create_module(
+ sqlite3 *db, /* SQLite connection to register module with */
+ const char *zName, /* Name of the module */
+ const sqlite3_module *p, /* Methods for the module */
+ void *pClientData /* Client data for xCreate/xConnect */
+);
+SQLITE_API int sqlite3_create_module_v2(
+ sqlite3 *db, /* SQLite connection to register module with */
+ const char *zName, /* Name of the module */
+ const sqlite3_module *p, /* Methods for the module */
+ void *pClientData, /* Client data for xCreate/xConnect */
+ void(*xDestroy)(void*) /* Module destructor function */
+);
+
+/*
+** CAPI3REF: Remove Unnecessary Virtual Table Implementations
+** METHOD: sqlite3
+**
+** ^The sqlite3_drop_modules(D,L) interface removes all virtual
+** table modules from database connection D except those named on list L.
+** The L parameter must be either NULL or a pointer to an array of pointers
+** to strings where the array is terminated by a single NULL pointer.
+** ^If the L parameter is NULL, then all virtual table modules are removed.
+**
+** See also: [sqlite3_create_module()]
+*/
+SQLITE_API int sqlite3_drop_modules(
+ sqlite3 *db, /* Remove modules from this connection */
+ const char **azKeep /* Except, do not remove the ones named here */
+);
+
+/*
+** CAPI3REF: Virtual Table Instance Object
+** KEYWORDS: sqlite3_vtab
+**
+** Every [virtual table module] implementation uses a subclass
+** of this object to describe a particular instance
+** of the [virtual table]. Each subclass will
+** be tailored to the specific needs of the module implementation.
+** The purpose of this superclass is to define certain fields that are
+** common to all module implementations.
+**
+** ^Virtual tables methods can set an error message by assigning a
+** string obtained from [sqlite3_mprintf()] to zErrMsg. The method should
+** take care that any prior string is freed by a call to [sqlite3_free()]
+** prior to assigning a new string to zErrMsg. ^After the error message
+** is delivered up to the client application, the string will be automatically
+** freed by sqlite3_free() and the zErrMsg field will be zeroed.
+*/
+struct sqlite3_vtab {
+ const sqlite3_module *pModule; /* The module for this virtual table */
+ int nRef; /* Number of open cursors */
+ char *zErrMsg; /* Error message from sqlite3_mprintf() */
+ /* Virtual table implementations will typically add additional fields */
+};
+
+/*
+** CAPI3REF: Virtual Table Cursor Object
+** KEYWORDS: sqlite3_vtab_cursor {virtual table cursor}
+**
+** Every [virtual table module] implementation uses a subclass of the
+** following structure to describe cursors that point into the
+** [virtual table] and are used
+** to loop through the virtual table. Cursors are created using the
+** [sqlite3_module.xOpen | xOpen] method of the module and are destroyed
+** by the [sqlite3_module.xClose | xClose] method. Cursors are used
+** by the [xFilter], [xNext], [xEof], [xColumn], and [xRowid] methods
+** of the module. Each module implementation will define
+** the content of a cursor structure to suit its own needs.
+**
+** This superclass exists in order to define fields of the cursor that
+** are common to all implementations.
+*/
+struct sqlite3_vtab_cursor {
+ sqlite3_vtab *pVtab; /* Virtual table of this cursor */
+ /* Virtual table implementations will typically add additional fields */
+};
+
+/*
+** CAPI3REF: Declare The Schema Of A Virtual Table
+**
+** ^The [xCreate] and [xConnect] methods of a
+** [virtual table module] call this interface
+** to declare the format (the names and datatypes of the columns) of
+** the virtual tables they implement.
+*/
+SQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zSQL);
+
+/*
+** CAPI3REF: Overload A Function For A Virtual Table
+** METHOD: sqlite3
+**
+** ^(Virtual tables can provide alternative implementations of functions
+** using the [xFindFunction] method of the [virtual table module].
+** But global versions of those functions
+** must exist in order to be overloaded.)^
+**
+** ^(This API makes sure a global version of a function with a particular
+** name and number of parameters exists. If no such function exists
+** before this API is called, a new function is created.)^ ^The implementation
+** of the new function always causes an exception to be thrown. So
+** the new function is not good for anything by itself. Its only
+** purpose is to be a placeholder function that can be overloaded
+** by a [virtual table].
+*/
+SQLITE_API int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg);
+
+/*
+** CAPI3REF: A Handle To An Open BLOB
+** KEYWORDS: {BLOB handle} {BLOB handles}
+**
+** An instance of this object represents an open BLOB on which
+** [sqlite3_blob_open | incremental BLOB I/O] can be performed.
+** ^Objects of this type are created by [sqlite3_blob_open()]
+** and destroyed by [sqlite3_blob_close()].
+** ^The [sqlite3_blob_read()] and [sqlite3_blob_write()] interfaces
+** can be used to read or write small subsections of the BLOB.
+** ^The [sqlite3_blob_bytes()] interface returns the size of the BLOB in bytes.
+*/
+typedef struct sqlite3_blob sqlite3_blob;
+
+/*
+** CAPI3REF: Open A BLOB For Incremental I/O
+** METHOD: sqlite3
+** CONSTRUCTOR: sqlite3_blob
+**
+** ^(This interfaces opens a [BLOB handle | handle] to the BLOB located
+** in row iRow, column zColumn, table zTable in database zDb;
+** in other words, the same BLOB that would be selected by:
+**
+** <pre>
+** SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
+** </pre>)^
+**
+** ^(Parameter zDb is not the filename that contains the database, but
+** rather the symbolic name of the database. For attached databases, this is
+** the name that appears after the AS keyword in the [ATTACH] statement.
+** For the main database file, the database name is "main". For TEMP
+** tables, the database name is "temp".)^
+**
+** ^If the flags parameter is non-zero, then the BLOB is opened for read
+** and write access. ^If the flags parameter is zero, the BLOB is opened for
+** read-only access.
+**
+** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is stored
+** in *ppBlob. Otherwise an [error code] is returned and, unless the error
+** code is SQLITE_MISUSE, *ppBlob is set to NULL.)^ ^This means that, provided
+** the API is not misused, it is always safe to call [sqlite3_blob_close()]
+** on *ppBlob after this function it returns.
+**
+** This function fails with SQLITE_ERROR if any of the following are true:
+** <ul>
+** <li> ^(Database zDb does not exist)^,
+** <li> ^(Table zTable does not exist within database zDb)^,
+** <li> ^(Table zTable is a WITHOUT ROWID table)^,
+** <li> ^(Column zColumn does not exist)^,
+** <li> ^(Row iRow is not present in the table)^,
+** <li> ^(The specified column of row iRow contains a value that is not
+** a TEXT or BLOB value)^,
+** <li> ^(Column zColumn is part of an index, PRIMARY KEY or UNIQUE
+** constraint and the blob is being opened for read/write access)^,
+** <li> ^([foreign key constraints | Foreign key constraints] are enabled,
+** column zColumn is part of a [child key] definition and the blob is
+** being opened for read/write access)^.
+** </ul>
+**
+** ^Unless it returns SQLITE_MISUSE, this function sets the
+** [database connection] error code and message accessible via
+** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions.
+**
+** A BLOB referenced by sqlite3_blob_open() may be read using the
+** [sqlite3_blob_read()] interface and modified by using
+** [sqlite3_blob_write()]. The [BLOB handle] can be moved to a
+** different row of the same table using the [sqlite3_blob_reopen()]
+** interface. However, the column, table, or database of a [BLOB handle]
+** cannot be changed after the [BLOB handle] is opened.
+**
+** ^(If the row that a BLOB handle points to is modified by an
+** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects
+** then the BLOB handle is marked as "expired".
+** This is true if any column of the row is changed, even a column
+** other than the one the BLOB handle is open on.)^
+** ^Calls to [sqlite3_blob_read()] and [sqlite3_blob_write()] for
+** an expired BLOB handle fail with a return code of [SQLITE_ABORT].
+** ^(Changes written into a BLOB prior to the BLOB expiring are not
+** rolled back by the expiration of the BLOB. Such changes will eventually
+** commit if the transaction continues to completion.)^
+**
+** ^Use the [sqlite3_blob_bytes()] interface to determine the size of
+** the opened blob. ^The size of a blob may not be changed by this
+** interface. Use the [UPDATE] SQL command to change the size of a
+** blob.
+**
+** ^The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces
+** and the built-in [zeroblob] SQL function may be used to create a
+** zero-filled blob to read or write using the incremental-blob interface.
+**
+** To avoid a resource leak, every open [BLOB handle] should eventually
+** be released by a call to [sqlite3_blob_close()].
+**
+** See also: [sqlite3_blob_close()],
+** [sqlite3_blob_reopen()], [sqlite3_blob_read()],
+** [sqlite3_blob_bytes()], [sqlite3_blob_write()].
+*/
+SQLITE_API int sqlite3_blob_open(
+ sqlite3*,
+ const char *zDb,
+ const char *zTable,
+ const char *zColumn,
+ sqlite3_int64 iRow,
+ int flags,
+ sqlite3_blob **ppBlob
+);
+
+/*
+** CAPI3REF: Move a BLOB Handle to a New Row
+** METHOD: sqlite3_blob
+**
+** ^This function is used to move an existing [BLOB handle] so that it points
+** to a different row of the same database table. ^The new row is identified
+** by the rowid value passed as the second argument. Only the row can be
+** changed. ^The database, table and column on which the blob handle is open
+** remain the same. Moving an existing [BLOB handle] to a new row is
+** faster than closing the existing handle and opening a new one.
+**
+** ^(The new row must meet the same criteria as for [sqlite3_blob_open()] -
+** it must exist and there must be either a blob or text value stored in
+** the nominated column.)^ ^If the new row is not present in the table, or if
+** it does not contain a blob or text value, or if another error occurs, an
+** SQLite error code is returned and the blob handle is considered aborted.
+** ^All subsequent calls to [sqlite3_blob_read()], [sqlite3_blob_write()] or
+** [sqlite3_blob_reopen()] on an aborted blob handle immediately return
+** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle
+** always returns zero.
+**
+** ^This function sets the database handle error code and message.
+*/
+SQLITE_API int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);
+
+/*
+** CAPI3REF: Close A BLOB Handle
+** DESTRUCTOR: sqlite3_blob
+**
+** ^This function closes an open [BLOB handle]. ^(The BLOB handle is closed
+** unconditionally. Even if this routine returns an error code, the
+** handle is still closed.)^
+**
+** ^If the blob handle being closed was opened for read-write access, and if
+** the database is in auto-commit mode and there are no other open read-write
+** blob handles or active write statements, the current transaction is
+** committed. ^If an error occurs while committing the transaction, an error
+** code is returned and the transaction rolled back.
+**
+** Calling this function with an argument that is not a NULL pointer or an
+** open blob handle results in undefined behavior. ^Calling this routine
+** with a null pointer (such as would be returned by a failed call to
+** [sqlite3_blob_open()]) is a harmless no-op. ^Otherwise, if this function
+** is passed a valid open blob handle, the values returned by the
+** sqlite3_errcode() and sqlite3_errmsg() functions are set before returning.
+*/
+SQLITE_API int sqlite3_blob_close(sqlite3_blob *);
+
+/*
+** CAPI3REF: Return The Size Of An Open BLOB
+** METHOD: sqlite3_blob
+**
+** ^Returns the size in bytes of the BLOB accessible via the
+** successfully opened [BLOB handle] in its only argument. ^The
+** incremental blob I/O routines can only read or overwriting existing
+** blob content; they cannot change the size of a blob.
+**
+** This routine only works on a [BLOB handle] which has been created
+** by a prior successful call to [sqlite3_blob_open()] and which has not
+** been closed by [sqlite3_blob_close()]. Passing any other pointer in
+** to this routine results in undefined and probably undesirable behavior.
+*/
+SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *);
+
+/*
+** CAPI3REF: Read Data From A BLOB Incrementally
+** METHOD: sqlite3_blob
+**
+** ^(This function is used to read data from an open [BLOB handle] into a
+** caller-supplied buffer. N bytes of data are copied into buffer Z
+** from the open BLOB, starting at offset iOffset.)^
+**
+** ^If offset iOffset is less than N bytes from the end of the BLOB,
+** [SQLITE_ERROR] is returned and no data is read. ^If N or iOffset is
+** less than zero, [SQLITE_ERROR] is returned and no data is read.
+** ^The size of the blob (and hence the maximum value of N+iOffset)
+** can be determined using the [sqlite3_blob_bytes()] interface.
+**
+** ^An attempt to read from an expired [BLOB handle] fails with an
+** error code of [SQLITE_ABORT].
+**
+** ^(On success, sqlite3_blob_read() returns SQLITE_OK.
+** Otherwise, an [error code] or an [extended error code] is returned.)^
+**
+** This routine only works on a [BLOB handle] which has been created
+** by a prior successful call to [sqlite3_blob_open()] and which has not
+** been closed by [sqlite3_blob_close()]. Passing any other pointer in
+** to this routine results in undefined and probably undesirable behavior.
+**
+** See also: [sqlite3_blob_write()].
+*/
+SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
+
+/*
+** CAPI3REF: Write Data Into A BLOB Incrementally
+** METHOD: sqlite3_blob
+**
+** ^(This function is used to write data into an open [BLOB handle] from a
+** caller-supplied buffer. N bytes of data are copied from the buffer Z
+** into the open BLOB, starting at offset iOffset.)^
+**
+** ^(On success, sqlite3_blob_write() returns SQLITE_OK.
+** Otherwise, an [error code] or an [extended error code] is returned.)^
+** ^Unless SQLITE_MISUSE is returned, this function sets the
+** [database connection] error code and message accessible via
+** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions.
+**
+** ^If the [BLOB handle] passed as the first argument was not opened for
+** writing (the flags parameter to [sqlite3_blob_open()] was zero),
+** this function returns [SQLITE_READONLY].
+**
+** This function may only modify the contents of the BLOB; it is
+** not possible to increase the size of a BLOB using this API.
+** ^If offset iOffset is less than N bytes from the end of the BLOB,
+** [SQLITE_ERROR] is returned and no data is written. The size of the
+** BLOB (and hence the maximum value of N+iOffset) can be determined
+** using the [sqlite3_blob_bytes()] interface. ^If N or iOffset are less
+** than zero [SQLITE_ERROR] is returned and no data is written.
+**
+** ^An attempt to write to an expired [BLOB handle] fails with an
+** error code of [SQLITE_ABORT]. ^Writes to the BLOB that occurred
+** before the [BLOB handle] expired are not rolled back by the
+** expiration of the handle, though of course those changes might
+** have been overwritten by the statement that expired the BLOB handle
+** or by other independent statements.
+**
+** This routine only works on a [BLOB handle] which has been created
+** by a prior successful call to [sqlite3_blob_open()] and which has not
+** been closed by [sqlite3_blob_close()]. Passing any other pointer in
+** to this routine results in undefined and probably undesirable behavior.
+**
+** See also: [sqlite3_blob_read()].
+*/
+SQLITE_API int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);
+
+/*
+** CAPI3REF: Virtual File System Objects
+**
+** A virtual filesystem (VFS) is an [sqlite3_vfs] object
+** that SQLite uses to interact
+** with the underlying operating system. Most SQLite builds come with a
+** single default VFS that is appropriate for the host computer.
+** New VFSes can be registered and existing VFSes can be unregistered.
+** The following interfaces are provided.
+**
+** ^The sqlite3_vfs_find() interface returns a pointer to a VFS given its name.
+** ^Names are case sensitive.
+** ^Names are zero-terminated UTF-8 strings.
+** ^If there is no match, a NULL pointer is returned.
+** ^If zVfsName is NULL then the default VFS is returned.
+**
+** ^New VFSes are registered with sqlite3_vfs_register().
+** ^Each new VFS becomes the default VFS if the makeDflt flag is set.
+** ^The same VFS can be registered multiple times without injury.
+** ^To make an existing VFS into the default VFS, register it again
+** with the makeDflt flag set. If two different VFSes with the
+** same name are registered, the behavior is undefined. If a
+** VFS is registered with a name that is NULL or an empty string,
+** then the behavior is undefined.
+**
+** ^Unregister a VFS with the sqlite3_vfs_unregister() interface.
+** ^(If the default VFS is unregistered, another VFS is chosen as
+** the default. The choice for the new VFS is arbitrary.)^
+*/
+SQLITE_API sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName);
+SQLITE_API int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt);
+SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
+
+/*
+** CAPI3REF: Mutexes
+**
+** The SQLite core uses these routines for thread
+** synchronization. Though they are intended for internal
+** use by SQLite, code that links against SQLite is
+** permitted to use any of these routines.
+**
+** The SQLite source code contains multiple implementations
+** of these mutex routines. An appropriate implementation
+** is selected automatically at compile-time. The following
+** implementations are available in the SQLite core:
+**
+** <ul>
+** <li> SQLITE_MUTEX_PTHREADS
+** <li> SQLITE_MUTEX_W32
+** <li> SQLITE_MUTEX_NOOP
+** </ul>
+**
+** The SQLITE_MUTEX_NOOP implementation is a set of routines
+** that does no real locking and is appropriate for use in
+** a single-threaded application. The SQLITE_MUTEX_PTHREADS and
+** SQLITE_MUTEX_W32 implementations are appropriate for use on Unix
+** and Windows.
+**
+** If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor
+** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex
+** implementation is included with the library. In this case the
+** application must supply a custom mutex implementation using the
+** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function
+** before calling sqlite3_initialize() or any other public sqlite3_
+** function that calls sqlite3_initialize().
+**
+** ^The sqlite3_mutex_alloc() routine allocates a new
+** mutex and returns a pointer to it. ^The sqlite3_mutex_alloc()
+** routine returns NULL if it is unable to allocate the requested
+** mutex. The argument to sqlite3_mutex_alloc() must one of these
+** integer constants:
+**
+** <ul>
+** <li> SQLITE_MUTEX_FAST
+** <li> SQLITE_MUTEX_RECURSIVE
+** <li> SQLITE_MUTEX_STATIC_MAIN
+** <li> SQLITE_MUTEX_STATIC_MEM
+** <li> SQLITE_MUTEX_STATIC_OPEN
+** <li> SQLITE_MUTEX_STATIC_PRNG
+** <li> SQLITE_MUTEX_STATIC_LRU
+** <li> SQLITE_MUTEX_STATIC_PMEM
+** <li> SQLITE_MUTEX_STATIC_APP1
+** <li> SQLITE_MUTEX_STATIC_APP2
+** <li> SQLITE_MUTEX_STATIC_APP3
+** <li> SQLITE_MUTEX_STATIC_VFS1
+** <li> SQLITE_MUTEX_STATIC_VFS2
+** <li> SQLITE_MUTEX_STATIC_VFS3
+** </ul>
+**
+** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE)
+** cause sqlite3_mutex_alloc() to create
+** a new mutex. ^The new mutex is recursive when SQLITE_MUTEX_RECURSIVE
+** is used but not necessarily so when SQLITE_MUTEX_FAST is used.
+** The mutex implementation does not need to make a distinction
+** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does
+** not want to. SQLite will only request a recursive mutex in
+** cases where it really needs one. If a faster non-recursive mutex
+** implementation is available on the host platform, the mutex subsystem
+** might return such a mutex in response to SQLITE_MUTEX_FAST.
+**
+** ^The other allowed parameters to sqlite3_mutex_alloc() (anything other
+** than SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return
+** a pointer to a static preexisting mutex. ^Nine static mutexes are
+** used by the current version of SQLite. Future versions of SQLite
+** may add additional static mutexes. Static mutexes are for internal
+** use by SQLite only. Applications that use SQLite mutexes should
+** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or
+** SQLITE_MUTEX_RECURSIVE.
+**
+** ^Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST
+** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()
+** returns a different mutex on every call. ^For the static
+** mutex types, the same mutex is returned on every call that has
+** the same type number.
+**
+** ^The sqlite3_mutex_free() routine deallocates a previously
+** allocated dynamic mutex. Attempting to deallocate a static
+** mutex results in undefined behavior.
+**
+** ^The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt
+** to enter a mutex. ^If another thread is already within the mutex,
+** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return
+** SQLITE_BUSY. ^The sqlite3_mutex_try() interface returns [SQLITE_OK]
+** upon successful entry. ^(Mutexes created using
+** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread.
+** In such cases, the
+** mutex must be exited an equal number of times before another thread
+** can enter.)^ If the same thread tries to enter any mutex other
+** than an SQLITE_MUTEX_RECURSIVE more than once, the behavior is undefined.
+**
+** ^(Some systems (for example, Windows 95) do not support the operation
+** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try()
+** will always return SQLITE_BUSY. In most cases the SQLite core only uses
+** sqlite3_mutex_try() as an optimization, so this is acceptable
+** behavior. The exceptions are unix builds that set the
+** SQLITE_ENABLE_SETLK_TIMEOUT build option. In that case a working
+** sqlite3_mutex_try() is required.)^
+**
+** ^The sqlite3_mutex_leave() routine exits a mutex that was
+** previously entered by the same thread. The behavior
+** is undefined if the mutex is not currently entered by the
+** calling thread or is not currently allocated.
+**
+** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(),
+** sqlite3_mutex_leave(), or sqlite3_mutex_free() is a NULL pointer,
+** then any of the four routines behaves as a no-op.
+**
+** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].
+*/
+SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int);
+SQLITE_API void sqlite3_mutex_free(sqlite3_mutex*);
+SQLITE_API void sqlite3_mutex_enter(sqlite3_mutex*);
+SQLITE_API int sqlite3_mutex_try(sqlite3_mutex*);
+SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*);
+
+/*
+** CAPI3REF: Mutex Methods Object
+**
+** An instance of this structure defines the low-level routines
+** used to allocate and use mutexes.
+**
+** Usually, the default mutex implementations provided by SQLite are
+** sufficient, however the application has the option of substituting a custom
+** implementation for specialized deployments or systems for which SQLite
+** does not provide a suitable implementation. In this case, the application
+** creates and populates an instance of this structure to pass
+** to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option.
+** Additionally, an instance of this structure can be used as an
+** output variable when querying the system for the current mutex
+** implementation, using the [SQLITE_CONFIG_GETMUTEX] option.
+**
+** ^The xMutexInit method defined by this structure is invoked as
+** part of system initialization by the sqlite3_initialize() function.
+** ^The xMutexInit routine is called by SQLite exactly once for each
+** effective call to [sqlite3_initialize()].
+**
+** ^The xMutexEnd method defined by this structure is invoked as
+** part of system shutdown by the sqlite3_shutdown() function. The
+** implementation of this method is expected to release all outstanding
+** resources obtained by the mutex methods implementation, especially
+** those obtained by the xMutexInit method. ^The xMutexEnd()
+** interface is invoked exactly once for each call to [sqlite3_shutdown()].
+**
+** ^(The remaining seven methods defined by this structure (xMutexAlloc,
+** xMutexFree, xMutexEnter, xMutexTry, xMutexLeave, xMutexHeld and
+** xMutexNotheld) implement the following interfaces (respectively):
+**
+** <ul>
+** <li> [sqlite3_mutex_alloc()] </li>
+** <li> [sqlite3_mutex_free()] </li>
+** <li> [sqlite3_mutex_enter()] </li>
+** <li> [sqlite3_mutex_try()] </li>
+** <li> [sqlite3_mutex_leave()] </li>
+** <li> [sqlite3_mutex_held()] </li>
+** <li> [sqlite3_mutex_notheld()] </li>
+** </ul>)^
+**
+** The only difference is that the public sqlite3_XXX functions enumerated
+** above silently ignore any invocations that pass a NULL pointer instead
+** of a valid mutex handle. The implementations of the methods defined
+** by this structure are not required to handle this case. The results
+** of passing a NULL pointer instead of a valid mutex handle are undefined
+** (i.e. it is acceptable to provide an implementation that segfaults if
+** it is passed a NULL pointer).
+**
+** The xMutexInit() method must be threadsafe. It must be harmless to
+** invoke xMutexInit() multiple times within the same process and without
+** intervening calls to xMutexEnd(). Second and subsequent calls to
+** xMutexInit() must be no-ops.
+**
+** xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()]
+** and its associates). Similarly, xMutexAlloc() must not use SQLite memory
+** allocation for a static mutex. ^However xMutexAlloc() may use SQLite
+** memory allocation for a fast or recursive mutex.
+**
+** ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is
+** called, but only if the prior call to xMutexInit returned SQLITE_OK.
+** If xMutexInit fails in any way, it is expected to clean up after itself
+** prior to returning.
+*/
+typedef struct sqlite3_mutex_methods sqlite3_mutex_methods;
+struct sqlite3_mutex_methods {
+ int (*xMutexInit)(void);
+ int (*xMutexEnd)(void);
+ sqlite3_mutex *(*xMutexAlloc)(int);
+ void (*xMutexFree)(sqlite3_mutex *);
+ void (*xMutexEnter)(sqlite3_mutex *);
+ int (*xMutexTry)(sqlite3_mutex *);
+ void (*xMutexLeave)(sqlite3_mutex *);
+ int (*xMutexHeld)(sqlite3_mutex *);
+ int (*xMutexNotheld)(sqlite3_mutex *);
+};
+
+/*
+** CAPI3REF: Mutex Verification Routines
+**
+** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines
+** are intended for use inside assert() statements. The SQLite core
+** never uses these routines except inside an assert() and applications
+** are advised to follow the lead of the core. The SQLite core only
+** provides implementations for these routines when it is compiled
+** with the SQLITE_DEBUG flag. External mutex implementations
+** are only required to provide these routines if SQLITE_DEBUG is
+** defined and if NDEBUG is not defined.
+**
+** These routines should return true if the mutex in their argument
+** is held or not held, respectively, by the calling thread.
+**
+** The implementation is not required to provide versions of these
+** routines that actually work. If the implementation does not provide working
+** versions of these routines, it should at least provide stubs that always
+** return true so that one does not get spurious assertion failures.
+**
+** If the argument to sqlite3_mutex_held() is a NULL pointer then
+** the routine should return 1. This seems counter-intuitive since
+** clearly the mutex cannot be held if it does not exist. But
+** the reason the mutex does not exist is because the build is not
+** using mutexes. And we do not want the assert() containing the
+** call to sqlite3_mutex_held() to fail, so a non-zero return is
+** the appropriate thing to do. The sqlite3_mutex_notheld()
+** interface should also return 1 when given a NULL pointer.
+*/
+#ifndef NDEBUG
+SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*);
+SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
+#endif
+
+/*
+** CAPI3REF: Mutex Types
+**
+** The [sqlite3_mutex_alloc()] interface takes a single argument
+** which is one of these integer constants.
+**
+** The set of static mutexes may change from one SQLite release to the
+** next. Applications that override the built-in mutex logic must be
+** prepared to accommodate additional static mutexes.
+*/
+#define SQLITE_MUTEX_FAST 0
+#define SQLITE_MUTEX_RECURSIVE 1
+#define SQLITE_MUTEX_STATIC_MAIN 2
+#define SQLITE_MUTEX_STATIC_MEM 3 /* sqlite3_malloc() */
+#define SQLITE_MUTEX_STATIC_MEM2 4 /* NOT USED */
+#define SQLITE_MUTEX_STATIC_OPEN 4 /* sqlite3BtreeOpen() */
+#define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_randomness() */
+#define SQLITE_MUTEX_STATIC_LRU 6 /* lru page list */
+#define SQLITE_MUTEX_STATIC_LRU2 7 /* NOT USED */
+#define SQLITE_MUTEX_STATIC_PMEM 7 /* sqlite3PageMalloc() */
+#define SQLITE_MUTEX_STATIC_APP1 8 /* For use by application */
+#define SQLITE_MUTEX_STATIC_APP2 9 /* For use by application */
+#define SQLITE_MUTEX_STATIC_APP3 10 /* For use by application */
+#define SQLITE_MUTEX_STATIC_VFS1 11 /* For use by built-in VFS */
+#define SQLITE_MUTEX_STATIC_VFS2 12 /* For use by extension VFS */
+#define SQLITE_MUTEX_STATIC_VFS3 13 /* For use by application VFS */
+
+/* Legacy compatibility: */
+#define SQLITE_MUTEX_STATIC_MASTER 2
+
+
+/*
+** CAPI3REF: Retrieve the mutex for a database connection
+** METHOD: sqlite3
+**
+** ^This interface returns a pointer the [sqlite3_mutex] object that
+** serializes access to the [database connection] given in the argument
+** when the [threading mode] is Serialized.
+** ^If the [threading mode] is Single-thread or Multi-thread then this
+** routine returns a NULL pointer.
+*/
+SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
+
+/*
+** CAPI3REF: Low-Level Control Of Database Files
+** METHOD: sqlite3
+** KEYWORDS: {file control}
+**
+** ^The [sqlite3_file_control()] interface makes a direct call to the
+** xFileControl method for the [sqlite3_io_methods] object associated
+** with a particular database identified by the second argument. ^The
+** name of the database is "main" for the main database or "temp" for the
+** TEMP database, or the name that appears after the AS keyword for
+** databases that are added using the [ATTACH] SQL command.
+** ^A NULL pointer can be used in place of "main" to refer to the
+** main database file.
+** ^The third and fourth parameters to this routine
+** are passed directly through to the second and third parameters of
+** the xFileControl method. ^The return value of the xFileControl
+** method becomes the return value of this routine.
+**
+** A few opcodes for [sqlite3_file_control()] are handled directly
+** by the SQLite core and never invoke the
+** sqlite3_io_methods.xFileControl method.
+** ^The [SQLITE_FCNTL_FILE_POINTER] value for the op parameter causes
+** a pointer to the underlying [sqlite3_file] object to be written into
+** the space pointed to by the 4th parameter. The
+** [SQLITE_FCNTL_JOURNAL_POINTER] works similarly except that it returns
+** the [sqlite3_file] object associated with the journal file instead of
+** the main database. The [SQLITE_FCNTL_VFS_POINTER] opcode returns
+** a pointer to the underlying [sqlite3_vfs] object for the file.
+** The [SQLITE_FCNTL_DATA_VERSION] returns the data version counter
+** from the pager.
+**
+** ^If the second parameter (zDbName) does not match the name of any
+** open database file, then SQLITE_ERROR is returned. ^This error
+** code is not remembered and will not be recalled by [sqlite3_errcode()]
+** or [sqlite3_errmsg()]. The underlying xFileControl method might
+** also return SQLITE_ERROR. There is no way to distinguish between
+** an incorrect zDbName and an SQLITE_ERROR return from the underlying
+** xFileControl method.
+**
+** See also: [file control opcodes]
+*/
+SQLITE_API int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*);
+
+/*
+** CAPI3REF: Testing Interface
+**
+** ^The sqlite3_test_control() interface is used to read out internal
+** state of SQLite and to inject faults into SQLite for testing
+** purposes. ^The first parameter is an operation code that determines
+** the number, meaning, and operation of all subsequent parameters.
+**
+** This interface is not for use by applications. It exists solely
+** for verifying the correct operation of the SQLite library. Depending
+** on how the SQLite library is compiled, this interface might not exist.
+**
+** The details of the operation codes, their meanings, the parameters
+** they take, and what they do are all subject to change without notice.
+** Unlike most of the SQLite API, this function is not guaranteed to
+** operate consistently from one release to the next.
+*/
+SQLITE_API int sqlite3_test_control(int op, ...);
+
+/*
+** CAPI3REF: Testing Interface Operation Codes
+**
+** These constants are the valid operation code parameters used
+** as the first argument to [sqlite3_test_control()].
+**
+** These parameters and their meanings are subject to change
+** without notice. These values are for testing purposes only.
+** Applications should not use any of these parameters or the
+** [sqlite3_test_control()] interface.
+*/
+#define SQLITE_TESTCTRL_FIRST 5
+#define SQLITE_TESTCTRL_PRNG_SAVE 5
+#define SQLITE_TESTCTRL_PRNG_RESTORE 6
+#define SQLITE_TESTCTRL_PRNG_RESET 7 /* NOT USED */
+#define SQLITE_TESTCTRL_FK_NO_ACTION 7
+#define SQLITE_TESTCTRL_BITVEC_TEST 8
+#define SQLITE_TESTCTRL_FAULT_INSTALL 9
+#define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10
+#define SQLITE_TESTCTRL_PENDING_BYTE 11
+#define SQLITE_TESTCTRL_ASSERT 12
+#define SQLITE_TESTCTRL_ALWAYS 13
+#define SQLITE_TESTCTRL_RESERVE 14 /* NOT USED */
+#define SQLITE_TESTCTRL_JSON_SELFCHECK 14
+#define SQLITE_TESTCTRL_OPTIMIZATIONS 15
+#define SQLITE_TESTCTRL_ISKEYWORD 16 /* NOT USED */
+#define SQLITE_TESTCTRL_GETOPT 16
+#define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */
+#define SQLITE_TESTCTRL_INTERNAL_FUNCTIONS 17
+#define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
+#define SQLITE_TESTCTRL_EXPLAIN_STMT 19 /* NOT USED */
+#define SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD 19
+#define SQLITE_TESTCTRL_NEVER_CORRUPT 20
+#define SQLITE_TESTCTRL_VDBE_COVERAGE 21
+#define SQLITE_TESTCTRL_BYTEORDER 22
+#define SQLITE_TESTCTRL_ISINIT 23
+#define SQLITE_TESTCTRL_SORTER_MMAP 24
+#define SQLITE_TESTCTRL_IMPOSTER 25
+#define SQLITE_TESTCTRL_PARSER_COVERAGE 26
+#define SQLITE_TESTCTRL_RESULT_INTREAL 27
+#define SQLITE_TESTCTRL_PRNG_SEED 28
+#define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29
+#define SQLITE_TESTCTRL_SEEK_COUNT 30
+#define SQLITE_TESTCTRL_TRACEFLAGS 31
+#define SQLITE_TESTCTRL_TUNE 32
+#define SQLITE_TESTCTRL_LOGEST 33
+#define SQLITE_TESTCTRL_USELONGDOUBLE 34 /* NOT USED */
+#define SQLITE_TESTCTRL_LAST 34 /* Largest TESTCTRL */
+
+/*
+** CAPI3REF: SQL Keyword Checking
+**
+** These routines provide access to the set of SQL language keywords
+** recognized by SQLite. Applications can uses these routines to determine
+** whether or not a specific identifier needs to be escaped (for example,
+** by enclosing in double-quotes) so as not to confuse the parser.
+**
+** The sqlite3_keyword_count() interface returns the number of distinct
+** keywords understood by SQLite.
+**
+** The sqlite3_keyword_name(N,Z,L) interface finds the 0-based N-th keyword and
+** makes *Z point to that keyword expressed as UTF8 and writes the number
+** of bytes in the keyword into *L. The string that *Z points to is not
+** zero-terminated. The sqlite3_keyword_name(N,Z,L) routine returns
+** SQLITE_OK if N is within bounds and SQLITE_ERROR if not. If either Z
+** or L are NULL or invalid pointers then calls to
+** sqlite3_keyword_name(N,Z,L) result in undefined behavior.
+**
+** The sqlite3_keyword_check(Z,L) interface checks to see whether or not
+** the L-byte UTF8 identifier that Z points to is a keyword, returning non-zero
+** if it is and zero if not.
+**
+** The parser used by SQLite is forgiving. It is often possible to use
+** a keyword as an identifier as long as such use does not result in a
+** parsing ambiguity. For example, the statement
+** "CREATE TABLE BEGIN(REPLACE,PRAGMA,END);" is accepted by SQLite, and
+** creates a new table named "BEGIN" with three columns named
+** "REPLACE", "PRAGMA", and "END". Nevertheless, best practice is to avoid
+** using keywords as identifiers. Common techniques used to avoid keyword
+** name collisions include:
+** <ul>
+** <li> Put all identifier names inside double-quotes. This is the official
+** SQL way to escape identifier names.
+** <li> Put identifier names inside [...]. This is not standard SQL,
+** but it is what SQL Server does and so lots of programmers use this
+** technique.
+** <li> Begin every identifier with the letter "Z" as no SQL keywords start
+** with "Z".
+** <li> Include a digit somewhere in every identifier name.
+** </ul>
+**
+** Note that the number of keywords understood by SQLite can depend on
+** compile-time options. For example, "VACUUM" is not a keyword if
+** SQLite is compiled with the [-DSQLITE_OMIT_VACUUM] option. Also,
+** new keywords may be added to future releases of SQLite.
+*/
+SQLITE_API int sqlite3_keyword_count(void);
+SQLITE_API int sqlite3_keyword_name(int,const char**,int*);
+SQLITE_API int sqlite3_keyword_check(const char*,int);
+
+/*
+** CAPI3REF: Dynamic String Object
+** KEYWORDS: {dynamic string}
+**
+** An instance of the sqlite3_str object contains a dynamically-sized
+** string under construction.
+**
+** The lifecycle of an sqlite3_str object is as follows:
+** <ol>
+** <li> ^The sqlite3_str object is created using [sqlite3_str_new()].
+** <li> ^Text is appended to the sqlite3_str object using various
+** methods, such as [sqlite3_str_appendf()].
+** <li> ^The sqlite3_str object is destroyed and the string it created
+** is returned using the [sqlite3_str_finish()] interface.
+** </ol>
+*/
+typedef struct sqlite3_str sqlite3_str;
+
+/*
+** CAPI3REF: Create A New Dynamic String Object
+** CONSTRUCTOR: sqlite3_str
+**
+** ^The [sqlite3_str_new(D)] interface allocates and initializes
+** a new [sqlite3_str] object. To avoid memory leaks, the object returned by
+** [sqlite3_str_new()] must be freed by a subsequent call to
+** [sqlite3_str_finish(X)].
+**
+** ^The [sqlite3_str_new(D)] interface always returns a pointer to a
+** valid [sqlite3_str] object, though in the event of an out-of-memory
+** error the returned object might be a special singleton that will
+** silently reject new text, always return SQLITE_NOMEM from
+** [sqlite3_str_errcode()], always return 0 for
+** [sqlite3_str_length()], and always return NULL from
+** [sqlite3_str_finish(X)]. It is always safe to use the value
+** returned by [sqlite3_str_new(D)] as the sqlite3_str parameter
+** to any of the other [sqlite3_str] methods.
+**
+** The D parameter to [sqlite3_str_new(D)] may be NULL. If the
+** D parameter in [sqlite3_str_new(D)] is not NULL, then the maximum
+** length of the string contained in the [sqlite3_str] object will be
+** the value set for [sqlite3_limit](D,[SQLITE_LIMIT_LENGTH]) instead
+** of [SQLITE_MAX_LENGTH].
+*/
+SQLITE_API sqlite3_str *sqlite3_str_new(sqlite3*);
+
+/*
+** CAPI3REF: Finalize A Dynamic String
+** DESTRUCTOR: sqlite3_str
+**
+** ^The [sqlite3_str_finish(X)] interface destroys the sqlite3_str object X
+** and returns a pointer to a memory buffer obtained from [sqlite3_malloc64()]
+** that contains the constructed string. The calling application should
+** pass the returned value to [sqlite3_free()] to avoid a memory leak.
+** ^The [sqlite3_str_finish(X)] interface may return a NULL pointer if any
+** errors were encountered during construction of the string. ^The
+** [sqlite3_str_finish(X)] interface will also return a NULL pointer if the
+** string in [sqlite3_str] object X is zero bytes long.
+*/
+SQLITE_API char *sqlite3_str_finish(sqlite3_str*);
+
+/*
+** CAPI3REF: Add Content To A Dynamic String
+** METHOD: sqlite3_str
+**
+** These interfaces add content to an sqlite3_str object previously obtained
+** from [sqlite3_str_new()].
+**
+** ^The [sqlite3_str_appendf(X,F,...)] and
+** [sqlite3_str_vappendf(X,F,V)] interfaces uses the [built-in printf]
+** functionality of SQLite to append formatted text onto the end of
+** [sqlite3_str] object X.
+**
+** ^The [sqlite3_str_append(X,S,N)] method appends exactly N bytes from string S
+** onto the end of the [sqlite3_str] object X. N must be non-negative.
+** S must contain at least N non-zero bytes of content. To append a
+** zero-terminated string in its entirety, use the [sqlite3_str_appendall()]
+** method instead.
+**
+** ^The [sqlite3_str_appendall(X,S)] method appends the complete content of
+** zero-terminated string S onto the end of [sqlite3_str] object X.
+**
+** ^The [sqlite3_str_appendchar(X,N,C)] method appends N copies of the
+** single-byte character C onto the end of [sqlite3_str] object X.
+** ^This method can be used, for example, to add whitespace indentation.
+**
+** ^The [sqlite3_str_reset(X)] method resets the string under construction
+** inside [sqlite3_str] object X back to zero bytes in length.
+**
+** These methods do not return a result code. ^If an error occurs, that fact
+** is recorded in the [sqlite3_str] object and can be recovered by a
+** subsequent call to [sqlite3_str_errcode(X)].
+*/
+SQLITE_API void sqlite3_str_appendf(sqlite3_str*, const char *zFormat, ...);
+SQLITE_API void sqlite3_str_vappendf(sqlite3_str*, const char *zFormat, va_list);
+SQLITE_API void sqlite3_str_append(sqlite3_str*, const char *zIn, int N);
+SQLITE_API void sqlite3_str_appendall(sqlite3_str*, const char *zIn);
+SQLITE_API void sqlite3_str_appendchar(sqlite3_str*, int N, char C);
+SQLITE_API void sqlite3_str_reset(sqlite3_str*);
+
+/*
+** CAPI3REF: Status Of A Dynamic String
+** METHOD: sqlite3_str
+**
+** These interfaces return the current status of an [sqlite3_str] object.
+**
+** ^If any prior errors have occurred while constructing the dynamic string
+** in sqlite3_str X, then the [sqlite3_str_errcode(X)] method will return
+** an appropriate error code. ^The [sqlite3_str_errcode(X)] method returns
+** [SQLITE_NOMEM] following any out-of-memory error, or
+** [SQLITE_TOOBIG] if the size of the dynamic string exceeds
+** [SQLITE_MAX_LENGTH], or [SQLITE_OK] if there have been no errors.
+**
+** ^The [sqlite3_str_length(X)] method returns the current length, in bytes,
+** of the dynamic string under construction in [sqlite3_str] object X.
+** ^The length returned by [sqlite3_str_length(X)] does not include the
+** zero-termination byte.
+**
+** ^The [sqlite3_str_value(X)] method returns a pointer to the current
+** content of the dynamic string under construction in X. The value
+** returned by [sqlite3_str_value(X)] is managed by the sqlite3_str object X
+** and might be freed or altered by any subsequent method on the same
+** [sqlite3_str] object. Applications must not used the pointer returned
+** [sqlite3_str_value(X)] after any subsequent method call on the same
+** object. ^Applications may change the content of the string returned
+** by [sqlite3_str_value(X)] as long as they do not write into any bytes
+** outside the range of 0 to [sqlite3_str_length(X)] and do not read or
+** write any byte after any subsequent sqlite3_str method call.
+*/
+SQLITE_API int sqlite3_str_errcode(sqlite3_str*);
+SQLITE_API int sqlite3_str_length(sqlite3_str*);
+SQLITE_API char *sqlite3_str_value(sqlite3_str*);
+
+/*
+** CAPI3REF: SQLite Runtime Status
+**
+** ^These interfaces are used to retrieve runtime status information
+** about the performance of SQLite, and optionally to reset various
+** highwater marks. ^The first argument is an integer code for
+** the specific parameter to measure. ^(Recognized integer codes
+** are of the form [status parameters | SQLITE_STATUS_...].)^
+** ^The current value of the parameter is returned into *pCurrent.
+** ^The highest recorded value is returned in *pHighwater. ^If the
+** resetFlag is true, then the highest record value is reset after
+** *pHighwater is written. ^(Some parameters do not record the highest
+** value. For those parameters
+** nothing is written into *pHighwater and the resetFlag is ignored.)^
+** ^(Other parameters record only the highwater mark and not the current
+** value. For these latter parameters nothing is written into *pCurrent.)^
+**
+** ^The sqlite3_status() and sqlite3_status64() routines return
+** SQLITE_OK on success and a non-zero [error code] on failure.
+**
+** If either the current value or the highwater mark is too large to
+** be represented by a 32-bit integer, then the values returned by
+** sqlite3_status() are undefined.
+**
+** See also: [sqlite3_db_status()]
+*/
+SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag);
+SQLITE_API int sqlite3_status64(
+ int op,
+ sqlite3_int64 *pCurrent,
+ sqlite3_int64 *pHighwater,
+ int resetFlag
+);
+
+
+/*
+** CAPI3REF: Status Parameters
+** KEYWORDS: {status parameters}
+**
+** These integer constants designate various run-time status parameters
+** that can be returned by [sqlite3_status()].
+**
+** <dl>
+** [[SQLITE_STATUS_MEMORY_USED]] ^(<dt>SQLITE_STATUS_MEMORY_USED</dt>
+** <dd>This parameter is the current amount of memory checked out
+** using [sqlite3_malloc()], either directly or indirectly. The
+** figure includes calls made to [sqlite3_malloc()] by the application
+** and internal memory usage by the SQLite library. Auxiliary page-cache
+** memory controlled by [SQLITE_CONFIG_PAGECACHE] is not included in
+** this parameter. The amount returned is the sum of the allocation
+** sizes as reported by the xSize method in [sqlite3_mem_methods].</dd>)^
+**
+** [[SQLITE_STATUS_MALLOC_SIZE]] ^(<dt>SQLITE_STATUS_MALLOC_SIZE</dt>
+** <dd>This parameter records the largest memory allocation request
+** handed to [sqlite3_malloc()] or [sqlite3_realloc()] (or their
+** internal equivalents). Only the value returned in the
+** *pHighwater parameter to [sqlite3_status()] is of interest.
+** The value written into the *pCurrent parameter is undefined.</dd>)^
+**
+** [[SQLITE_STATUS_MALLOC_COUNT]] ^(<dt>SQLITE_STATUS_MALLOC_COUNT</dt>
+** <dd>This parameter records the number of separate memory allocations
+** currently checked out.</dd>)^
+**
+** [[SQLITE_STATUS_PAGECACHE_USED]] ^(<dt>SQLITE_STATUS_PAGECACHE_USED</dt>
+** <dd>This parameter returns the number of pages used out of the
+** [pagecache memory allocator] that was configured using
+** [SQLITE_CONFIG_PAGECACHE]. The
+** value returned is in pages, not in bytes.</dd>)^
+**
+** [[SQLITE_STATUS_PAGECACHE_OVERFLOW]]
+** ^(<dt>SQLITE_STATUS_PAGECACHE_OVERFLOW</dt>
+** <dd>This parameter returns the number of bytes of page cache
+** allocation which could not be satisfied by the [SQLITE_CONFIG_PAGECACHE]
+** buffer and where forced to overflow to [sqlite3_malloc()]. The
+** returned value includes allocations that overflowed because they
+** where too large (they were larger than the "sz" parameter to
+** [SQLITE_CONFIG_PAGECACHE]) and allocations that overflowed because
+** no space was left in the page cache.</dd>)^
+**
+** [[SQLITE_STATUS_PAGECACHE_SIZE]] ^(<dt>SQLITE_STATUS_PAGECACHE_SIZE</dt>
+** <dd>This parameter records the largest memory allocation request
+** handed to the [pagecache memory allocator]. Only the value returned in the
+** *pHighwater parameter to [sqlite3_status()] is of interest.
+** The value written into the *pCurrent parameter is undefined.</dd>)^
+**
+** [[SQLITE_STATUS_SCRATCH_USED]] <dt>SQLITE_STATUS_SCRATCH_USED</dt>
+** <dd>No longer used.</dd>
+**
+** [[SQLITE_STATUS_SCRATCH_OVERFLOW]] ^(<dt>SQLITE_STATUS_SCRATCH_OVERFLOW</dt>
+** <dd>No longer used.</dd>
+**
+** [[SQLITE_STATUS_SCRATCH_SIZE]] <dt>SQLITE_STATUS_SCRATCH_SIZE</dt>
+** <dd>No longer used.</dd>
+**
+** [[SQLITE_STATUS_PARSER_STACK]] ^(<dt>SQLITE_STATUS_PARSER_STACK</dt>
+** <dd>The *pHighwater parameter records the deepest parser stack.
+** The *pCurrent value is undefined. The *pHighwater value is only
+** meaningful if SQLite is compiled with [YYTRACKMAXSTACKDEPTH].</dd>)^
+** </dl>
+**
+** New status parameters may be added from time to time.
+*/
+#define SQLITE_STATUS_MEMORY_USED 0
+#define SQLITE_STATUS_PAGECACHE_USED 1
+#define SQLITE_STATUS_PAGECACHE_OVERFLOW 2
+#define SQLITE_STATUS_SCRATCH_USED 3 /* NOT USED */
+#define SQLITE_STATUS_SCRATCH_OVERFLOW 4 /* NOT USED */
+#define SQLITE_STATUS_MALLOC_SIZE 5
+#define SQLITE_STATUS_PARSER_STACK 6
+#define SQLITE_STATUS_PAGECACHE_SIZE 7
+#define SQLITE_STATUS_SCRATCH_SIZE 8 /* NOT USED */
+#define SQLITE_STATUS_MALLOC_COUNT 9
+
+/*
+** CAPI3REF: Database Connection Status
+** METHOD: sqlite3
+**
+** ^This interface is used to retrieve runtime status information
+** about a single [database connection]. ^The first argument is the
+** database connection object to be interrogated. ^The second argument
+** is an integer constant, taken from the set of
+** [SQLITE_DBSTATUS options], that
+** determines the parameter to interrogate. The set of
+** [SQLITE_DBSTATUS options] is likely
+** to grow in future releases of SQLite.
+**
+** ^The current value of the requested parameter is written into *pCur
+** and the highest instantaneous value is written into *pHiwtr. ^If
+** the resetFlg is true, then the highest instantaneous value is
+** reset back down to the current value.
+**
+** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a
+** non-zero [error code] on failure.
+**
+** See also: [sqlite3_status()] and [sqlite3_stmt_status()].
+*/
+SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
+
+/*
+** CAPI3REF: Status Parameters for database connections
+** KEYWORDS: {SQLITE_DBSTATUS options}
+**
+** These constants are the available integer "verbs" that can be passed as
+** the second argument to the [sqlite3_db_status()] interface.
+**
+** New verbs may be added in future releases of SQLite. Existing verbs
+** might be discontinued. Applications should check the return code from
+** [sqlite3_db_status()] to make sure that the call worked.
+** The [sqlite3_db_status()] interface will return a non-zero error code
+** if a discontinued or unsupported verb is invoked.
+**
+** <dl>
+** [[SQLITE_DBSTATUS_LOOKASIDE_USED]] ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_USED</dt>
+** <dd>This parameter returns the number of lookaside memory slots currently
+** checked out.</dd>)^
+**
+** [[SQLITE_DBSTATUS_LOOKASIDE_HIT]] ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_HIT</dt>
+** <dd>This parameter returns the number of malloc attempts that were
+** satisfied using lookaside memory. Only the high-water value is meaningful;
+** the current value is always zero.)^
+**
+** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE]]
+** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE</dt>
+** <dd>This parameter returns the number malloc attempts that might have
+** been satisfied using lookaside memory but failed due to the amount of
+** memory requested being larger than the lookaside slot size.
+** Only the high-water value is meaningful;
+** the current value is always zero.)^
+**
+** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL]]
+** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL</dt>
+** <dd>This parameter returns the number malloc attempts that might have
+** been satisfied using lookaside memory but failed due to all lookaside
+** memory already being in use.
+** Only the high-water value is meaningful;
+** the current value is always zero.)^
+**
+** [[SQLITE_DBSTATUS_CACHE_USED]] ^(<dt>SQLITE_DBSTATUS_CACHE_USED</dt>
+** <dd>This parameter returns the approximate number of bytes of heap
+** memory used by all pager caches associated with the database connection.)^
+** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0.
+**
+** [[SQLITE_DBSTATUS_CACHE_USED_SHARED]]
+** ^(<dt>SQLITE_DBSTATUS_CACHE_USED_SHARED</dt>
+** <dd>This parameter is similar to DBSTATUS_CACHE_USED, except that if a
+** pager cache is shared between two or more connections the bytes of heap
+** memory used by that pager cache is divided evenly between the attached
+** connections.)^ In other words, if none of the pager caches associated
+** with the database connection are shared, this request returns the same
+** value as DBSTATUS_CACHE_USED. Or, if one or more or the pager caches are
+** shared, the value returned by this call will be smaller than that returned
+** by DBSTATUS_CACHE_USED. ^The highwater mark associated with
+** SQLITE_DBSTATUS_CACHE_USED_SHARED is always 0.
+**
+** [[SQLITE_DBSTATUS_SCHEMA_USED]] ^(<dt>SQLITE_DBSTATUS_SCHEMA_USED</dt>
+** <dd>This parameter returns the approximate number of bytes of heap
+** memory used to store the schema for all databases associated
+** with the connection - main, temp, and any [ATTACH]-ed databases.)^
+** ^The full amount of memory used by the schemas is reported, even if the
+** schema memory is shared with other database connections due to
+** [shared cache mode] being enabled.
+** ^The highwater mark associated with SQLITE_DBSTATUS_SCHEMA_USED is always 0.
+**
+** [[SQLITE_DBSTATUS_STMT_USED]] ^(<dt>SQLITE_DBSTATUS_STMT_USED</dt>
+** <dd>This parameter returns the approximate number of bytes of heap
+** and lookaside memory used by all prepared statements associated with
+** the database connection.)^
+** ^The highwater mark associated with SQLITE_DBSTATUS_STMT_USED is always 0.
+** </dd>
+**
+** [[SQLITE_DBSTATUS_CACHE_HIT]] ^(<dt>SQLITE_DBSTATUS_CACHE_HIT</dt>
+** <dd>This parameter returns the number of pager cache hits that have
+** occurred.)^ ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_HIT
+** is always 0.
+** </dd>
+**
+** [[SQLITE_DBSTATUS_CACHE_MISS]] ^(<dt>SQLITE_DBSTATUS_CACHE_MISS</dt>
+** <dd>This parameter returns the number of pager cache misses that have
+** occurred.)^ ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_MISS
+** is always 0.
+** </dd>
+**
+** [[SQLITE_DBSTATUS_CACHE_WRITE]] ^(<dt>SQLITE_DBSTATUS_CACHE_WRITE</dt>
+** <dd>This parameter returns the number of dirty cache entries that have
+** been written to disk. Specifically, the number of pages written to the
+** wal file in wal mode databases, or the number of pages written to the
+** database file in rollback mode databases. Any pages written as part of
+** transaction rollback or database recovery operations are not included.
+** If an IO or other error occurs while writing a page to disk, the effect
+** on subsequent SQLITE_DBSTATUS_CACHE_WRITE requests is undefined.)^ ^The
+** highwater mark associated with SQLITE_DBSTATUS_CACHE_WRITE is always 0.
+** </dd>
+**
+** [[SQLITE_DBSTATUS_CACHE_SPILL]] ^(<dt>SQLITE_DBSTATUS_CACHE_SPILL</dt>
+** <dd>This parameter returns the number of dirty cache entries that have
+** been written to disk in the middle of a transaction due to the page
+** cache overflowing. Transactions are more efficient if they are written
+** to disk all at once. When pages spill mid-transaction, that introduces
+** additional overhead. This parameter can be used help identify
+** inefficiencies that can be resolved by increasing the cache size.
+** </dd>
+**
+** [[SQLITE_DBSTATUS_DEFERRED_FKS]] ^(<dt>SQLITE_DBSTATUS_DEFERRED_FKS</dt>
+** <dd>This parameter returns zero for the current value if and only if
+** all foreign key constraints (deferred or immediate) have been
+** resolved.)^ ^The highwater mark is always 0.
+** </dd>
+** </dl>
+*/
+#define SQLITE_DBSTATUS_LOOKASIDE_USED 0
+#define SQLITE_DBSTATUS_CACHE_USED 1
+#define SQLITE_DBSTATUS_SCHEMA_USED 2
+#define SQLITE_DBSTATUS_STMT_USED 3
+#define SQLITE_DBSTATUS_LOOKASIDE_HIT 4
+#define SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE 5
+#define SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL 6
+#define SQLITE_DBSTATUS_CACHE_HIT 7
+#define SQLITE_DBSTATUS_CACHE_MISS 8
+#define SQLITE_DBSTATUS_CACHE_WRITE 9
+#define SQLITE_DBSTATUS_DEFERRED_FKS 10
+#define SQLITE_DBSTATUS_CACHE_USED_SHARED 11
+#define SQLITE_DBSTATUS_CACHE_SPILL 12
+#define SQLITE_DBSTATUS_MAX 12 /* Largest defined DBSTATUS */
+
+
+/*
+** CAPI3REF: Prepared Statement Status
+** METHOD: sqlite3_stmt
+**
+** ^(Each prepared statement maintains various
+** [SQLITE_STMTSTATUS counters] that measure the number
+** of times it has performed specific operations.)^ These counters can
+** be used to monitor the performance characteristics of the prepared
+** statements. For example, if the number of table steps greatly exceeds
+** the number of table searches or result rows, that would tend to indicate
+** that the prepared statement is using a full table scan rather than
+** an index.
+**
+** ^(This interface is used to retrieve and reset counter values from
+** a [prepared statement]. The first argument is the prepared statement
+** object to be interrogated. The second argument
+** is an integer code for a specific [SQLITE_STMTSTATUS counter]
+** to be interrogated.)^
+** ^The current value of the requested counter is returned.
+** ^If the resetFlg is true, then the counter is reset to zero after this
+** interface call returns.
+**
+** See also: [sqlite3_status()] and [sqlite3_db_status()].
+*/
+SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
+
+/*
+** CAPI3REF: Status Parameters for prepared statements
+** KEYWORDS: {SQLITE_STMTSTATUS counter} {SQLITE_STMTSTATUS counters}
+**
+** These preprocessor macros define integer codes that name counter
+** values associated with the [sqlite3_stmt_status()] interface.
+** The meanings of the various counters are as follows:
+**
+** <dl>
+** [[SQLITE_STMTSTATUS_FULLSCAN_STEP]] <dt>SQLITE_STMTSTATUS_FULLSCAN_STEP</dt>
+** <dd>^This is the number of times that SQLite has stepped forward in
+** a table as part of a full table scan. Large numbers for this counter
+** may indicate opportunities for performance improvement through
+** careful use of indices.</dd>
+**
+** [[SQLITE_STMTSTATUS_SORT]] <dt>SQLITE_STMTSTATUS_SORT</dt>
+** <dd>^This is the number of sort operations that have occurred.
+** A non-zero value in this counter may indicate an opportunity to
+** improvement performance through careful use of indices.</dd>
+**
+** [[SQLITE_STMTSTATUS_AUTOINDEX]] <dt>SQLITE_STMTSTATUS_AUTOINDEX</dt>
+** <dd>^This is the number of rows inserted into transient indices that
+** were created automatically in order to help joins run faster.
+** A non-zero value in this counter may indicate an opportunity to
+** improvement performance by adding permanent indices that do not
+** need to be reinitialized each time the statement is run.</dd>
+**
+** [[SQLITE_STMTSTATUS_VM_STEP]] <dt>SQLITE_STMTSTATUS_VM_STEP</dt>
+** <dd>^This is the number of virtual machine operations executed
+** by the prepared statement if that number is less than or equal
+** to 2147483647. The number of virtual machine operations can be
+** used as a proxy for the total work done by the prepared statement.
+** If the number of virtual machine operations exceeds 2147483647
+** then the value returned by this statement status code is undefined.
+**
+** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt>
+** <dd>^This is the number of times that the prepare statement has been
+** automatically regenerated due to schema changes or changes to
+** [bound parameters] that might affect the query plan.
+**
+** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt>
+** <dd>^This is the number of times that the prepared statement has
+** been run. A single "run" for the purposes of this counter is one
+** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
+** The counter is incremented on the first [sqlite3_step()] call of each
+** cycle.
+**
+** [[SQLITE_STMTSTATUS_FILTER_MISS]]
+** [[SQLITE_STMTSTATUS_FILTER HIT]]
+** <dt>SQLITE_STMTSTATUS_FILTER_HIT<br>
+** SQLITE_STMTSTATUS_FILTER_MISS</dt>
+** <dd>^SQLITE_STMTSTATUS_FILTER_HIT is the number of times that a join
+** step was bypassed because a Bloom filter returned not-found. The
+** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of
+** times that the Bloom filter returned a find, and thus the join step
+** had to be processed as normal.
+**
+** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt>
+** <dd>^This is the approximate number of bytes of heap memory
+** used to store the prepared statement. ^This value is not actually
+** a counter, and so the resetFlg parameter to sqlite3_stmt_status()
+** is ignored when the opcode is SQLITE_STMTSTATUS_MEMUSED.
+** </dd>
+** </dl>
+*/
+#define SQLITE_STMTSTATUS_FULLSCAN_STEP 1
+#define SQLITE_STMTSTATUS_SORT 2
+#define SQLITE_STMTSTATUS_AUTOINDEX 3
+#define SQLITE_STMTSTATUS_VM_STEP 4
+#define SQLITE_STMTSTATUS_REPREPARE 5
+#define SQLITE_STMTSTATUS_RUN 6
+#define SQLITE_STMTSTATUS_FILTER_MISS 7
+#define SQLITE_STMTSTATUS_FILTER_HIT 8
+#define SQLITE_STMTSTATUS_MEMUSED 99
+
+/*
+** CAPI3REF: Custom Page Cache Object
+**
+** The sqlite3_pcache type is opaque. It is implemented by
+** the pluggable module. The SQLite core has no knowledge of
+** its size or internal structure and never deals with the
+** sqlite3_pcache object except by holding and passing pointers
+** to the object.
+**
+** See [sqlite3_pcache_methods2] for additional information.
+*/
+typedef struct sqlite3_pcache sqlite3_pcache;
+
+/*
+** CAPI3REF: Custom Page Cache Object
+**
+** The sqlite3_pcache_page object represents a single page in the
+** page cache. The page cache will allocate instances of this
+** object. Various methods of the page cache use pointers to instances
+** of this object as parameters or as their return value.
+**
+** See [sqlite3_pcache_methods2] for additional information.
+*/
+typedef struct sqlite3_pcache_page sqlite3_pcache_page;
+struct sqlite3_pcache_page {
+ void *pBuf; /* The content of the page */
+ void *pExtra; /* Extra information associated with the page */
+};
+
+/*
+** CAPI3REF: Application Defined Page Cache.
+** KEYWORDS: {page cache}
+**
+** ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE2], ...) interface can
+** register an alternative page cache implementation by passing in an
+** instance of the sqlite3_pcache_methods2 structure.)^
+** In many applications, most of the heap memory allocated by
+** SQLite is used for the page cache.
+** By implementing a
+** custom page cache using this API, an application can better control
+** the amount of memory consumed by SQLite, the way in which
+** that memory is allocated and released, and the policies used to
+** determine exactly which parts of a database file are cached and for
+** how long.
+**
+** The alternative page cache mechanism is an
+** extreme measure that is only needed by the most demanding applications.
+** The built-in page cache is recommended for most uses.
+**
+** ^(The contents of the sqlite3_pcache_methods2 structure are copied to an
+** internal buffer by SQLite within the call to [sqlite3_config]. Hence
+** the application may discard the parameter after the call to
+** [sqlite3_config()] returns.)^
+**
+** [[the xInit() page cache method]]
+** ^(The xInit() method is called once for each effective
+** call to [sqlite3_initialize()])^
+** (usually only once during the lifetime of the process). ^(The xInit()
+** method is passed a copy of the sqlite3_pcache_methods2.pArg value.)^
+** The intent of the xInit() method is to set up global data structures
+** required by the custom page cache implementation.
+** ^(If the xInit() method is NULL, then the
+** built-in default page cache is used instead of the application defined
+** page cache.)^
+**
+** [[the xShutdown() page cache method]]
+** ^The xShutdown() method is called by [sqlite3_shutdown()].
+** It can be used to clean up
+** any outstanding resources before process shutdown, if required.
+** ^The xShutdown() method may be NULL.
+**
+** ^SQLite automatically serializes calls to the xInit method,
+** so the xInit method need not be threadsafe. ^The
+** xShutdown method is only called from [sqlite3_shutdown()] so it does
+** not need to be threadsafe either. All other methods must be threadsafe
+** in multithreaded applications.
+**
+** ^SQLite will never invoke xInit() more than once without an intervening
+** call to xShutdown().
+**
+** [[the xCreate() page cache methods]]
+** ^SQLite invokes the xCreate() method to construct a new cache instance.
+** SQLite will typically create one cache instance for each open database file,
+** though this is not guaranteed. ^The
+** first parameter, szPage, is the size in bytes of the pages that must
+** be allocated by the cache. ^szPage will always a power of two. ^The
+** second parameter szExtra is a number of bytes of extra storage
+** associated with each page cache entry. ^The szExtra parameter will
+** a number less than 250. SQLite will use the
+** extra szExtra bytes on each page to store metadata about the underlying
+** database page on disk. The value passed into szExtra depends
+** on the SQLite version, the target platform, and how SQLite was compiled.
+** ^The third argument to xCreate(), bPurgeable, is true if the cache being
+** created will be used to cache database pages of a file stored on disk, or
+** false if it is used for an in-memory database. The cache implementation
+** does not have to do anything special based with the value of bPurgeable;
+** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will
+** never invoke xUnpin() except to deliberately delete a page.
+** ^In other words, calls to xUnpin() on a cache with bPurgeable set to
+** false will always have the "discard" flag set to true.
+** ^Hence, a cache created with bPurgeable false will
+** never contain any unpinned pages.
+**
+** [[the xCachesize() page cache method]]
+** ^(The xCachesize() method may be called at any time by SQLite to set the
+** suggested maximum cache-size (number of pages stored by) the cache
+** instance passed as the first argument. This is the value configured using
+** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable
+** parameter, the implementation is not required to do anything with this
+** value; it is advisory only.
+**
+** [[the xPagecount() page cache methods]]
+** The xPagecount() method must return the number of pages currently
+** stored in the cache, both pinned and unpinned.
+**
+** [[the xFetch() page cache methods]]
+** The xFetch() method locates a page in the cache and returns a pointer to
+** an sqlite3_pcache_page object associated with that page, or a NULL pointer.
+** The pBuf element of the returned sqlite3_pcache_page object will be a
+** pointer to a buffer of szPage bytes used to store the content of a
+** single database page. The pExtra element of sqlite3_pcache_page will be
+** a pointer to the szExtra bytes of extra storage that SQLite has requested
+** for each entry in the page cache.
+**
+** The page to be fetched is determined by the key. ^The minimum key value
+** is 1. After it has been retrieved using xFetch, the page is considered
+** to be "pinned".
+**
+** If the requested page is already in the page cache, then the page cache
+** implementation must return a pointer to the page buffer with its content
+** intact. If the requested page is not already in the cache, then the
+** cache implementation should use the value of the createFlag
+** parameter to help it determined what action to take:
+**
+** <table border=1 width=85% align=center>
+** <tr><th> createFlag <th> Behavior when page is not already in cache
+** <tr><td> 0 <td> Do not allocate a new page. Return NULL.
+** <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.
+** Otherwise return NULL.
+** <tr><td> 2 <td> Make every effort to allocate a new page. Only return
+** NULL if allocating a new page is effectively impossible.
+** </table>
+**
+** ^(SQLite will normally invoke xFetch() with a createFlag of 0 or 1. SQLite
+** will only use a createFlag of 2 after a prior call with a createFlag of 1
+** failed.)^ In between the xFetch() calls, SQLite may
+** attempt to unpin one or more cache pages by spilling the content of
+** pinned pages to disk and synching the operating system disk cache.
+**
+** [[the xUnpin() page cache method]]
+** ^xUnpin() is called by SQLite with a pointer to a currently pinned page
+** as its second argument. If the third parameter, discard, is non-zero,
+** then the page must be evicted from the cache.
+** ^If the discard parameter is
+** zero, then the page may be discarded or retained at the discretion of
+** page cache implementation. ^The page cache implementation
+** may choose to evict unpinned pages at any time.
+**
+** The cache must not perform any reference counting. A single
+** call to xUnpin() unpins the page regardless of the number of prior calls
+** to xFetch().
+**
+** [[the xRekey() page cache methods]]
+** The xRekey() method is used to change the key value associated with the
+** page passed as the second argument. If the cache
+** previously contains an entry associated with newKey, it must be
+** discarded. ^Any prior cache entry associated with newKey is guaranteed not
+** to be pinned.
+**
+** When SQLite calls the xTruncate() method, the cache must discard all
+** existing cache entries with page numbers (keys) greater than or equal
+** to the value of the iLimit parameter passed to xTruncate(). If any
+** of these pages are pinned, they are implicitly unpinned, meaning that
+** they can be safely discarded.
+**
+** [[the xDestroy() page cache method]]
+** ^The xDestroy() method is used to delete a cache allocated by xCreate().
+** All resources associated with the specified cache should be freed. ^After
+** calling the xDestroy() method, SQLite considers the [sqlite3_pcache*]
+** handle invalid, and will not use it with any other sqlite3_pcache_methods2
+** functions.
+**
+** [[the xShrink() page cache method]]
+** ^SQLite invokes the xShrink() method when it wants the page cache to
+** free up as much of heap memory as possible. The page cache implementation
+** is not obligated to free any memory, but well-behaved implementations should
+** do their best.
+*/
+typedef struct sqlite3_pcache_methods2 sqlite3_pcache_methods2;
+struct sqlite3_pcache_methods2 {
+ int iVersion;
+ void *pArg;
+ int (*xInit)(void*);
+ void (*xShutdown)(void*);
+ sqlite3_pcache *(*xCreate)(int szPage, int szExtra, int bPurgeable);
+ void (*xCachesize)(sqlite3_pcache*, int nCachesize);
+ int (*xPagecount)(sqlite3_pcache*);
+ sqlite3_pcache_page *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag);
+ void (*xUnpin)(sqlite3_pcache*, sqlite3_pcache_page*, int discard);
+ void (*xRekey)(sqlite3_pcache*, sqlite3_pcache_page*,
+ unsigned oldKey, unsigned newKey);
+ void (*xTruncate)(sqlite3_pcache*, unsigned iLimit);
+ void (*xDestroy)(sqlite3_pcache*);
+ void (*xShrink)(sqlite3_pcache*);
+};
+
+/*
+** This is the obsolete pcache_methods object that has now been replaced
+** by sqlite3_pcache_methods2. This object is not used by SQLite. It is
+** retained in the header file for backwards compatibility only.
+*/
+typedef struct sqlite3_pcache_methods sqlite3_pcache_methods;
+struct sqlite3_pcache_methods {
+ void *pArg;
+ int (*xInit)(void*);
+ void (*xShutdown)(void*);
+ sqlite3_pcache *(*xCreate)(int szPage, int bPurgeable);
+ void (*xCachesize)(sqlite3_pcache*, int nCachesize);
+ int (*xPagecount)(sqlite3_pcache*);
+ void *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag);
+ void (*xUnpin)(sqlite3_pcache*, void*, int discard);
+ void (*xRekey)(sqlite3_pcache*, void*, unsigned oldKey, unsigned newKey);
+ void (*xTruncate)(sqlite3_pcache*, unsigned iLimit);
+ void (*xDestroy)(sqlite3_pcache*);
+};
+
+
+/*
+** CAPI3REF: Online Backup Object
+**
+** The sqlite3_backup object records state information about an ongoing
+** online backup operation. ^The sqlite3_backup object is created by
+** a call to [sqlite3_backup_init()] and is destroyed by a call to
+** [sqlite3_backup_finish()].
+**
+** See Also: [Using the SQLite Online Backup API]
+*/
+typedef struct sqlite3_backup sqlite3_backup;
+
+/*
+** CAPI3REF: Online Backup API.
+**
+** The backup API copies the content of one database into another.
+** It is useful either for creating backups of databases or
+** for copying in-memory databases to or from persistent files.
+**
+** See Also: [Using the SQLite Online Backup API]
+**
+** ^SQLite holds a write transaction open on the destination database file
+** for the duration of the backup operation.
+** ^The source database is read-locked only while it is being read;
+** it is not locked continuously for the entire backup operation.
+** ^Thus, the backup may be performed on a live source database without
+** preventing other database connections from
+** reading or writing to the source database while the backup is underway.
+**
+** ^(To perform a backup operation:
+** <ol>
+** <li><b>sqlite3_backup_init()</b> is called once to initialize the
+** backup,
+** <li><b>sqlite3_backup_step()</b> is called one or more times to transfer
+** the data between the two databases, and finally
+** <li><b>sqlite3_backup_finish()</b> is called to release all resources
+** associated with the backup operation.
+** </ol>)^
+** There should be exactly one call to sqlite3_backup_finish() for each
+** successful call to sqlite3_backup_init().
+**
+** [[sqlite3_backup_init()]] <b>sqlite3_backup_init()</b>
+**
+** ^The D and N arguments to sqlite3_backup_init(D,N,S,M) are the
+** [database connection] associated with the destination database
+** and the database name, respectively.
+** ^The database name is "main" for the main database, "temp" for the
+** temporary database, or the name specified after the AS keyword in
+** an [ATTACH] statement for an attached database.
+** ^The S and M arguments passed to
+** sqlite3_backup_init(D,N,S,M) identify the [database connection]
+** and database name of the source database, respectively.
+** ^The source and destination [database connections] (parameters S and D)
+** must be different or else sqlite3_backup_init(D,N,S,M) will fail with
+** an error.
+**
+** ^A call to sqlite3_backup_init() will fail, returning NULL, if
+** there is already a read or read-write transaction open on the
+** destination database.
+**
+** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is
+** returned and an error code and error message are stored in the
+** destination [database connection] D.
+** ^The error code and message for the failed call to sqlite3_backup_init()
+** can be retrieved using the [sqlite3_errcode()], [sqlite3_errmsg()], and/or
+** [sqlite3_errmsg16()] functions.
+** ^A successful call to sqlite3_backup_init() returns a pointer to an
+** [sqlite3_backup] object.
+** ^The [sqlite3_backup] object may be used with the sqlite3_backup_step() and
+** sqlite3_backup_finish() functions to perform the specified backup
+** operation.
+**
+** [[sqlite3_backup_step()]] <b>sqlite3_backup_step()</b>
+**
+** ^Function sqlite3_backup_step(B,N) will copy up to N pages between
+** the source and destination databases specified by [sqlite3_backup] object B.
+** ^If N is negative, all remaining source pages are copied.
+** ^If sqlite3_backup_step(B,N) successfully copies N pages and there
+** are still more pages to be copied, then the function returns [SQLITE_OK].
+** ^If sqlite3_backup_step(B,N) successfully finishes copying all pages
+** from source to destination, then it returns [SQLITE_DONE].
+** ^If an error occurs while running sqlite3_backup_step(B,N),
+** then an [error code] is returned. ^As well as [SQLITE_OK] and
+** [SQLITE_DONE], a call to sqlite3_backup_step() may return [SQLITE_READONLY],
+** [SQLITE_NOMEM], [SQLITE_BUSY], [SQLITE_LOCKED], or an
+** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX] extended error code.
+**
+** ^(The sqlite3_backup_step() might return [SQLITE_READONLY] if
+** <ol>
+** <li> the destination database was opened read-only, or
+** <li> the destination database is using write-ahead-log journaling
+** and the destination and source page sizes differ, or
+** <li> the destination database is an in-memory database and the
+** destination and source page sizes differ.
+** </ol>)^
+**
+** ^If sqlite3_backup_step() cannot obtain a required file-system lock, then
+** the [sqlite3_busy_handler | busy-handler function]
+** is invoked (if one is specified). ^If the
+** busy-handler returns non-zero before the lock is available, then
+** [SQLITE_BUSY] is returned to the caller. ^In this case the call to
+** sqlite3_backup_step() can be retried later. ^If the source
+** [database connection]
+** is being used to write to the source database when sqlite3_backup_step()
+** is called, then [SQLITE_LOCKED] is returned immediately. ^Again, in this
+** case the call to sqlite3_backup_step() can be retried later on. ^(If
+** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX], [SQLITE_NOMEM], or
+** [SQLITE_READONLY] is returned, then
+** there is no point in retrying the call to sqlite3_backup_step(). These
+** errors are considered fatal.)^ The application must accept
+** that the backup operation has failed and pass the backup operation handle
+** to the sqlite3_backup_finish() to release associated resources.
+**
+** ^The first call to sqlite3_backup_step() obtains an exclusive lock
+** on the destination file. ^The exclusive lock is not released until either
+** sqlite3_backup_finish() is called or the backup operation is complete
+** and sqlite3_backup_step() returns [SQLITE_DONE]. ^Every call to
+** sqlite3_backup_step() obtains a [shared lock] on the source database that
+** lasts for the duration of the sqlite3_backup_step() call.
+** ^Because the source database is not locked between calls to
+** sqlite3_backup_step(), the source database may be modified mid-way
+** through the backup process. ^If the source database is modified by an
+** external process or via a database connection other than the one being
+** used by the backup operation, then the backup will be automatically
+** restarted by the next call to sqlite3_backup_step(). ^If the source
+** database is modified by the using the same database connection as is used
+** by the backup operation, then the backup database is automatically
+** updated at the same time.
+**
+** [[sqlite3_backup_finish()]] <b>sqlite3_backup_finish()</b>
+**
+** When sqlite3_backup_step() has returned [SQLITE_DONE], or when the
+** application wishes to abandon the backup operation, the application
+** should destroy the [sqlite3_backup] by passing it to sqlite3_backup_finish().
+** ^The sqlite3_backup_finish() interfaces releases all
+** resources associated with the [sqlite3_backup] object.
+** ^If sqlite3_backup_step() has not yet returned [SQLITE_DONE], then any
+** active write-transaction on the destination database is rolled back.
+** The [sqlite3_backup] object is invalid
+** and may not be used following a call to sqlite3_backup_finish().
+**
+** ^The value returned by sqlite3_backup_finish is [SQLITE_OK] if no
+** sqlite3_backup_step() errors occurred, regardless or whether or not
+** sqlite3_backup_step() completed.
+** ^If an out-of-memory condition or IO error occurred during any prior
+** sqlite3_backup_step() call on the same [sqlite3_backup] object, then
+** sqlite3_backup_finish() returns the corresponding [error code].
+**
+** ^A return of [SQLITE_BUSY] or [SQLITE_LOCKED] from sqlite3_backup_step()
+** is not a permanent error and does not affect the return value of
+** sqlite3_backup_finish().
+**
+** [[sqlite3_backup_remaining()]] [[sqlite3_backup_pagecount()]]
+** <b>sqlite3_backup_remaining() and sqlite3_backup_pagecount()</b>
+**
+** ^The sqlite3_backup_remaining() routine returns the number of pages still
+** to be backed up at the conclusion of the most recent sqlite3_backup_step().
+** ^The sqlite3_backup_pagecount() routine returns the total number of pages
+** in the source database at the conclusion of the most recent
+** sqlite3_backup_step().
+** ^(The values returned by these functions are only updated by
+** sqlite3_backup_step(). If the source database is modified in a way that
+** changes the size of the source database or the number of pages remaining,
+** those changes are not reflected in the output of sqlite3_backup_pagecount()
+** and sqlite3_backup_remaining() until after the next
+** sqlite3_backup_step().)^
+**
+** <b>Concurrent Usage of Database Handles</b>
+**
+** ^The source [database connection] may be used by the application for other
+** purposes while a backup operation is underway or being initialized.
+** ^If SQLite is compiled and configured to support threadsafe database
+** connections, then the source database connection may be used concurrently
+** from within other threads.
+**
+** However, the application must guarantee that the destination
+** [database connection] is not passed to any other API (by any thread) after
+** sqlite3_backup_init() is called and before the corresponding call to
+** sqlite3_backup_finish(). SQLite does not currently check to see
+** if the application incorrectly accesses the destination [database connection]
+** and so no error code is reported, but the operations may malfunction
+** nevertheless. Use of the destination database connection while a
+** backup is in progress might also cause a mutex deadlock.
+**
+** If running in [shared cache mode], the application must
+** guarantee that the shared cache used by the destination database
+** is not accessed while the backup is running. In practice this means
+** that the application must guarantee that the disk file being
+** backed up to is not accessed by any connection within the process,
+** not just the specific connection that was passed to sqlite3_backup_init().
+**
+** The [sqlite3_backup] object itself is partially threadsafe. Multiple
+** threads may safely make multiple concurrent calls to sqlite3_backup_step().
+** However, the sqlite3_backup_remaining() and sqlite3_backup_pagecount()
+** APIs are not strictly speaking threadsafe. If they are invoked at the
+** same time as another thread is invoking sqlite3_backup_step() it is
+** possible that they return invalid values.
+**
+** <b>Alternatives To Using The Backup API</b>
+**
+** Other techniques for safely creating a consistent backup of an SQLite
+** database include:
+**
+** <ul>
+** <li> The [VACUUM INTO] command.
+** <li> The [sqlite3_rsync] utility program.
+** </ul>
+*/
+SQLITE_API sqlite3_backup *sqlite3_backup_init(
+ sqlite3 *pDest, /* Destination database handle */
+ const char *zDestName, /* Destination database name */
+ sqlite3 *pSource, /* Source database handle */
+ const char *zSourceName /* Source database name */
+);
+SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage);
+SQLITE_API int sqlite3_backup_finish(sqlite3_backup *p);
+SQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p);
+SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
+
+/*
+** CAPI3REF: Unlock Notification
+** METHOD: sqlite3
+**
+** ^When running in shared-cache mode, a database operation may fail with
+** an [SQLITE_LOCKED] error if the required locks on the shared-cache or
+** individual tables within the shared-cache cannot be obtained. See
+** [SQLite Shared-Cache Mode] for a description of shared-cache locking.
+** ^This API may be used to register a callback that SQLite will invoke
+** when the connection currently holding the required lock relinquishes it.
+** ^This API is only available if the library was compiled with the
+** [SQLITE_ENABLE_UNLOCK_NOTIFY] C-preprocessor symbol defined.
+**
+** See Also: [Using the SQLite Unlock Notification Feature].
+**
+** ^Shared-cache locks are released when a database connection concludes
+** its current transaction, either by committing it or rolling it back.
+**
+** ^When a connection (known as the blocked connection) fails to obtain a
+** shared-cache lock and SQLITE_LOCKED is returned to the caller, the
+** identity of the database connection (the blocking connection) that
+** has locked the required resource is stored internally. ^After an
+** application receives an SQLITE_LOCKED error, it may call the
+** sqlite3_unlock_notify() method with the blocked connection handle as
+** the first argument to register for a callback that will be invoked
+** when the blocking connections current transaction is concluded. ^The
+** callback is invoked from within the [sqlite3_step] or [sqlite3_close]
+** call that concludes the blocking connection's transaction.
+**
+** ^(If sqlite3_unlock_notify() is called in a multi-threaded application,
+** there is a chance that the blocking connection will have already
+** concluded its transaction by the time sqlite3_unlock_notify() is invoked.
+** If this happens, then the specified callback is invoked immediately,
+** from within the call to sqlite3_unlock_notify().)^
+**
+** ^If the blocked connection is attempting to obtain a write-lock on a
+** shared-cache table, and more than one other connection currently holds
+** a read-lock on the same table, then SQLite arbitrarily selects one of
+** the other connections to use as the blocking connection.
+**
+** ^(There may be at most one unlock-notify callback registered by a
+** blocked connection. If sqlite3_unlock_notify() is called when the
+** blocked connection already has a registered unlock-notify callback,
+** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is
+** called with a NULL pointer as its second argument, then any existing
+** unlock-notify callback is canceled. ^The blocked connections
+** unlock-notify callback may also be canceled by closing the blocked
+** connection using [sqlite3_close()].
+**
+** The unlock-notify callback is not reentrant. If an application invokes
+** any sqlite3_xxx API functions from within an unlock-notify callback, a
+** crash or deadlock may be the result.
+**
+** ^Unless deadlock is detected (see below), sqlite3_unlock_notify() always
+** returns SQLITE_OK.
+**
+** <b>Callback Invocation Details</b>
+**
+** When an unlock-notify callback is registered, the application provides a
+** single void* pointer that is passed to the callback when it is invoked.
+** However, the signature of the callback function allows SQLite to pass
+** it an array of void* context pointers. The first argument passed to
+** an unlock-notify callback is a pointer to an array of void* pointers,
+** and the second is the number of entries in the array.
+**
+** When a blocking connection's transaction is concluded, there may be
+** more than one blocked connection that has registered for an unlock-notify
+** callback. ^If two or more such blocked connections have specified the
+** same callback function, then instead of invoking the callback function
+** multiple times, it is invoked once with the set of void* context pointers
+** specified by the blocked connections bundled together into an array.
+** This gives the application an opportunity to prioritize any actions
+** related to the set of unblocked database connections.
+**
+** <b>Deadlock Detection</b>
+**
+** Assuming that after registering for an unlock-notify callback a
+** database waits for the callback to be issued before taking any further
+** action (a reasonable assumption), then using this API may cause the
+** application to deadlock. For example, if connection X is waiting for
+** connection Y's transaction to be concluded, and similarly connection
+** Y is waiting on connection X's transaction, then neither connection
+** will proceed and the system may remain deadlocked indefinitely.
+**
+** To avoid this scenario, the sqlite3_unlock_notify() performs deadlock
+** detection. ^If a given call to sqlite3_unlock_notify() would put the
+** system in a deadlocked state, then SQLITE_LOCKED is returned and no
+** unlock-notify callback is registered. The system is said to be in
+** a deadlocked state if connection A has registered for an unlock-notify
+** callback on the conclusion of connection B's transaction, and connection
+** B has itself registered for an unlock-notify callback when connection
+** A's transaction is concluded. ^Indirect deadlock is also detected, so
+** the system is also considered to be deadlocked if connection B has
+** registered for an unlock-notify callback on the conclusion of connection
+** C's transaction, where connection C is waiting on connection A. ^Any
+** number of levels of indirection are allowed.
+**
+** <b>The "DROP TABLE" Exception</b>
+**
+** When a call to [sqlite3_step()] returns SQLITE_LOCKED, it is almost
+** always appropriate to call sqlite3_unlock_notify(). There is however,
+** one exception. When executing a "DROP TABLE" or "DROP INDEX" statement,
+** SQLite checks if there are any currently executing SELECT statements
+** that belong to the same connection. If there are, SQLITE_LOCKED is
+** returned. In this case there is no "blocking connection", so invoking
+** sqlite3_unlock_notify() results in the unlock-notify callback being
+** invoked immediately. If the application then re-attempts the "DROP TABLE"
+** or "DROP INDEX" query, an infinite loop might be the result.
+**
+** One way around this problem is to check the extended error code returned
+** by an sqlite3_step() call. ^(If there is a blocking connection, then the
+** extended error code is set to SQLITE_LOCKED_SHAREDCACHE. Otherwise, in
+** the special "DROP TABLE/INDEX" case, the extended error code is just
+** SQLITE_LOCKED.)^
+*/
+SQLITE_API int sqlite3_unlock_notify(
+ sqlite3 *pBlocked, /* Waiting connection */
+ void (*xNotify)(void **apArg, int nArg), /* Callback function to invoke */
+ void *pNotifyArg /* Argument to pass to xNotify */
+);
+
+
+/*
+** CAPI3REF: String Comparison
+**
+** ^The [sqlite3_stricmp()] and [sqlite3_strnicmp()] APIs allow applications
+** and extensions to compare the contents of two buffers containing UTF-8
+** strings in a case-independent fashion, using the same definition of "case
+** independence" that SQLite uses internally when comparing identifiers.
+*/
+SQLITE_API int sqlite3_stricmp(const char *, const char *);
+SQLITE_API int sqlite3_strnicmp(const char *, const char *, int);
+
+/*
+** CAPI3REF: String Globbing
+*
+** ^The [sqlite3_strglob(P,X)] interface returns zero if and only if
+** string X matches the [GLOB] pattern P.
+** ^The definition of [GLOB] pattern matching used in
+** [sqlite3_strglob(P,X)] is the same as for the "X GLOB P" operator in the
+** SQL dialect understood by SQLite. ^The [sqlite3_strglob(P,X)] function
+** is case sensitive.
+**
+** Note that this routine returns zero on a match and non-zero if the strings
+** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
+**
+** See also: [sqlite3_strlike()].
+*/
+SQLITE_API int sqlite3_strglob(const char *zGlob, const char *zStr);
+
+/*
+** CAPI3REF: String LIKE Matching
+*
+** ^The [sqlite3_strlike(P,X,E)] interface returns zero if and only if
+** string X matches the [LIKE] pattern P with escape character E.
+** ^The definition of [LIKE] pattern matching used in
+** [sqlite3_strlike(P,X,E)] is the same as for the "X LIKE P ESCAPE E"
+** operator in the SQL dialect understood by SQLite. ^For "X LIKE P" without
+** the ESCAPE clause, set the E parameter of [sqlite3_strlike(P,X,E)] to 0.
+** ^As with the LIKE operator, the [sqlite3_strlike(P,X,E)] function is case
+** insensitive - equivalent upper and lower case ASCII characters match
+** one another.
+**
+** ^The [sqlite3_strlike(P,X,E)] function matches Unicode characters, though
+** only ASCII characters are case folded.
+**
+** Note that this routine returns zero on a match and non-zero if the strings
+** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
+**
+** See also: [sqlite3_strglob()].
+*/
+SQLITE_API int sqlite3_strlike(const char *zGlob, const char *zStr, unsigned int cEsc);
+
+/*
+** CAPI3REF: Error Logging Interface
+**
+** ^The [sqlite3_log()] interface writes a message into the [error log]
+** established by the [SQLITE_CONFIG_LOG] option to [sqlite3_config()].
+** ^If logging is enabled, the zFormat string and subsequent arguments are
+** used with [sqlite3_snprintf()] to generate the final output string.
+**
+** The sqlite3_log() interface is intended for use by extensions such as
+** virtual tables, collating functions, and SQL functions. While there is
+** nothing to prevent an application from calling sqlite3_log(), doing so
+** is considered bad form.
+**
+** The zFormat string must not be NULL.
+**
+** To avoid deadlocks and other threading problems, the sqlite3_log() routine
+** will not use dynamically allocated memory. The log message is stored in
+** a fixed-length buffer on the stack. If the log message is longer than
+** a few hundred characters, it will be truncated to the length of the
+** buffer.
+*/
+SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
+
+/*
+** CAPI3REF: Write-Ahead Log Commit Hook
+** METHOD: sqlite3
+**
+** ^The [sqlite3_wal_hook()] function is used to register a callback that
+** is invoked each time data is committed to a database in wal mode.
+**
+** ^(The callback is invoked by SQLite after the commit has taken place and
+** the associated write-lock on the database released)^, so the implementation
+** may read, write or [checkpoint] the database as required.
+**
+** ^The first parameter passed to the callback function when it is invoked
+** is a copy of the third parameter passed to sqlite3_wal_hook() when
+** registering the callback. ^The second is a copy of the database handle.
+** ^The third parameter is the name of the database that was written to -
+** either "main" or the name of an [ATTACH]-ed database. ^The fourth parameter
+** is the number of pages currently in the write-ahead log file,
+** including those that were just committed.
+**
+** The callback function should normally return [SQLITE_OK]. ^If an error
+** code is returned, that error will propagate back up through the
+** SQLite code base to cause the statement that provoked the callback
+** to report an error, though the commit will have still occurred. If the
+** callback returns [SQLITE_ROW] or [SQLITE_DONE], or if it returns a value
+** that does not correspond to any valid SQLite error code, the results
+** are undefined.
+**
+** A single database handle may have at most a single write-ahead log callback
+** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any
+** previously registered write-ahead log callback. ^The return value is
+** a copy of the third parameter from the previous call, if any, or 0.
+** ^Note that the [sqlite3_wal_autocheckpoint()] interface and the
+** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will
+** overwrite any prior [sqlite3_wal_hook()] settings.
+*/
+SQLITE_API void *sqlite3_wal_hook(
+ sqlite3*,
+ int(*)(void *,sqlite3*,const char*,int),
+ void*
+);
+
+/*
+** CAPI3REF: Configure an auto-checkpoint
+** METHOD: sqlite3
+**
+** ^The [sqlite3_wal_autocheckpoint(D,N)] is a wrapper around
+** [sqlite3_wal_hook()] that causes any database on [database connection] D
+** to automatically [checkpoint]
+** after committing a transaction if there are N or
+** more frames in the [write-ahead log] file. ^Passing zero or
+** a negative value as the nFrame parameter disables automatic
+** checkpoints entirely.
+**
+** ^The callback registered by this function replaces any existing callback
+** registered using [sqlite3_wal_hook()]. ^Likewise, registering a callback
+** using [sqlite3_wal_hook()] disables the automatic checkpoint mechanism
+** configured by this function.
+**
+** ^The [wal_autocheckpoint pragma] can be used to invoke this interface
+** from SQL.
+**
+** ^Checkpoints initiated by this mechanism are
+** [sqlite3_wal_checkpoint_v2|PASSIVE].
+**
+** ^Every new [database connection] defaults to having the auto-checkpoint
+** enabled with a threshold of 1000 or [SQLITE_DEFAULT_WAL_AUTOCHECKPOINT]
+** pages. The use of this interface
+** is only necessary if the default setting is found to be suboptimal
+** for a particular application.
+*/
+SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
+
+/*
+** CAPI3REF: Checkpoint a database
+** METHOD: sqlite3
+**
+** ^(The sqlite3_wal_checkpoint(D,X) is equivalent to
+** [sqlite3_wal_checkpoint_v2](D,X,[SQLITE_CHECKPOINT_PASSIVE],0,0).)^
+**
+** In brief, sqlite3_wal_checkpoint(D,X) causes the content in the
+** [write-ahead log] for database X on [database connection] D to be
+** transferred into the database file and for the write-ahead log to
+** be reset. See the [checkpointing] documentation for addition
+** information.
+**
+** This interface used to be the only way to cause a checkpoint to
+** occur. But then the newer and more powerful [sqlite3_wal_checkpoint_v2()]
+** interface was added. This interface is retained for backwards
+** compatibility and as a convenience for applications that need to manually
+** start a callback but which do not need the full power (and corresponding
+** complication) of [sqlite3_wal_checkpoint_v2()].
+*/
+SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
+
+/*
+** CAPI3REF: Checkpoint a database
+** METHOD: sqlite3
+**
+** ^(The sqlite3_wal_checkpoint_v2(D,X,M,L,C) interface runs a checkpoint
+** operation on database X of [database connection] D in mode M. Status
+** information is written back into integers pointed to by L and C.)^
+** ^(The M parameter must be a valid [checkpoint mode]:)^
+**
+** <dl>
+** <dt>SQLITE_CHECKPOINT_PASSIVE<dd>
+** ^Checkpoint as many frames as possible without waiting for any database
+** readers or writers to finish, then sync the database file if all frames
+** in the log were checkpointed. ^The [busy-handler callback]
+** is never invoked in the SQLITE_CHECKPOINT_PASSIVE mode.
+** ^On the other hand, passive mode might leave the checkpoint unfinished
+** if there are concurrent readers or writers.
+**
+** <dt>SQLITE_CHECKPOINT_FULL<dd>
+** ^This mode blocks (it invokes the
+** [sqlite3_busy_handler|busy-handler callback]) until there is no
+** database writer and all readers are reading from the most recent database
+** snapshot. ^It then checkpoints all frames in the log file and syncs the
+** database file. ^This mode blocks new database writers while it is pending,
+** but new database readers are allowed to continue unimpeded.
+**
+** <dt>SQLITE_CHECKPOINT_RESTART<dd>
+** ^This mode works the same way as SQLITE_CHECKPOINT_FULL with the addition
+** that after checkpointing the log file it blocks (calls the
+** [busy-handler callback])
+** until all readers are reading from the database file only. ^This ensures
+** that the next writer will restart the log file from the beginning.
+** ^Like SQLITE_CHECKPOINT_FULL, this mode blocks new
+** database writer attempts while it is pending, but does not impede readers.
+**
+** <dt>SQLITE_CHECKPOINT_TRUNCATE<dd>
+** ^This mode works the same way as SQLITE_CHECKPOINT_RESTART with the
+** addition that it also truncates the log file to zero bytes just prior
+** to a successful return.
+** </dl>
+**
+** ^If pnLog is not NULL, then *pnLog is set to the total number of frames in
+** the log file or to -1 if the checkpoint could not run because
+** of an error or because the database is not in [WAL mode]. ^If pnCkpt is not
+** NULL,then *pnCkpt is set to the total number of checkpointed frames in the
+** log file (including any that were already checkpointed before the function
+** was called) or to -1 if the checkpoint could not run due to an error or
+** because the database is not in WAL mode. ^Note that upon successful
+** completion of an SQLITE_CHECKPOINT_TRUNCATE, the log file will have been
+** truncated to zero bytes and so both *pnLog and *pnCkpt will be set to zero.
+**
+** ^All calls obtain an exclusive "checkpoint" lock on the database file. ^If
+** any other process is running a checkpoint operation at the same time, the
+** lock cannot be obtained and SQLITE_BUSY is returned. ^Even if there is a
+** busy-handler configured, it will not be invoked in this case.
+**
+** ^The SQLITE_CHECKPOINT_FULL, RESTART and TRUNCATE modes also obtain the
+** exclusive "writer" lock on the database file. ^If the writer lock cannot be
+** obtained immediately, and a busy-handler is configured, it is invoked and
+** the writer lock retried until either the busy-handler returns 0 or the lock
+** is successfully obtained. ^The busy-handler is also invoked while waiting for
+** database readers as described above. ^If the busy-handler returns 0 before
+** the writer lock is obtained or while waiting for database readers, the
+** checkpoint operation proceeds from that point in the same way as
+** SQLITE_CHECKPOINT_PASSIVE - checkpointing as many frames as possible
+** without blocking any further. ^SQLITE_BUSY is returned in this case.
+**
+** ^If parameter zDb is NULL or points to a zero length string, then the
+** specified operation is attempted on all WAL databases [attached] to
+** [database connection] db. In this case the
+** values written to output parameters *pnLog and *pnCkpt are undefined. ^If
+** an SQLITE_BUSY error is encountered when processing one or more of the
+** attached WAL databases, the operation is still attempted on any remaining
+** attached databases and SQLITE_BUSY is returned at the end. ^If any other
+** error occurs while processing an attached database, processing is abandoned
+** and the error code is returned to the caller immediately. ^If no error
+** (SQLITE_BUSY or otherwise) is encountered while processing the attached
+** databases, SQLITE_OK is returned.
+**
+** ^If database zDb is the name of an attached database that is not in WAL
+** mode, SQLITE_OK is returned and both *pnLog and *pnCkpt set to -1. ^If
+** zDb is not NULL (or a zero length string) and is not the name of any
+** attached database, SQLITE_ERROR is returned to the caller.
+**
+** ^Unless it returns SQLITE_MISUSE,
+** the sqlite3_wal_checkpoint_v2() interface
+** sets the error information that is queried by
+** [sqlite3_errcode()] and [sqlite3_errmsg()].
+**
+** ^The [PRAGMA wal_checkpoint] command can be used to invoke this interface
+** from SQL.
+*/
+SQLITE_API int sqlite3_wal_checkpoint_v2(
+ sqlite3 *db, /* Database handle */
+ const char *zDb, /* Name of attached database (or NULL) */
+ int eMode, /* SQLITE_CHECKPOINT_* value */
+ int *pnLog, /* OUT: Size of WAL log in frames */
+ int *pnCkpt /* OUT: Total number of frames checkpointed */
+);
+
+/*
+** CAPI3REF: Checkpoint Mode Values
+** KEYWORDS: {checkpoint mode}
+**
+** These constants define all valid values for the "checkpoint mode" passed
+** as the third parameter to the [sqlite3_wal_checkpoint_v2()] interface.
+** See the [sqlite3_wal_checkpoint_v2()] documentation for details on the
+** meaning of each of these checkpoint modes.
+*/
+#define SQLITE_CHECKPOINT_PASSIVE 0 /* Do as much as possible w/o blocking */
+#define SQLITE_CHECKPOINT_FULL 1 /* Wait for writers, then checkpoint */
+#define SQLITE_CHECKPOINT_RESTART 2 /* Like FULL but wait for readers */
+#define SQLITE_CHECKPOINT_TRUNCATE 3 /* Like RESTART but also truncate WAL */
+
+/*
+** CAPI3REF: Virtual Table Interface Configuration
+**
+** This function may be called by either the [xConnect] or [xCreate] method
+** of a [virtual table] implementation to configure
+** various facets of the virtual table interface.
+**
+** If this interface is invoked outside the context of an xConnect or
+** xCreate virtual table method then the behavior is undefined.
+**
+** In the call sqlite3_vtab_config(D,C,...) the D parameter is the
+** [database connection] in which the virtual table is being created and
+** which is passed in as the first argument to the [xConnect] or [xCreate]
+** method that is invoking sqlite3_vtab_config(). The C parameter is one
+** of the [virtual table configuration options]. The presence and meaning
+** of parameters after C depend on which [virtual table configuration option]
+** is used.
+*/
+SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
+
+/*
+** CAPI3REF: Virtual Table Configuration Options
+** KEYWORDS: {virtual table configuration options}
+** KEYWORDS: {virtual table configuration option}
+**
+** These macros define the various options to the
+** [sqlite3_vtab_config()] interface that [virtual table] implementations
+** can use to customize and optimize their behavior.
+**
+** <dl>
+** [[SQLITE_VTAB_CONSTRAINT_SUPPORT]]
+** <dt>SQLITE_VTAB_CONSTRAINT_SUPPORT</dt>
+** <dd>Calls of the form
+** [sqlite3_vtab_config](db,SQLITE_VTAB_CONSTRAINT_SUPPORT,X) are supported,
+** where X is an integer. If X is zero, then the [virtual table] whose
+** [xCreate] or [xConnect] method invoked [sqlite3_vtab_config()] does not
+** support constraints. In this configuration (which is the default) if
+** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire
+** statement is rolled back as if [ON CONFLICT | OR ABORT] had been
+** specified as part of the users SQL statement, regardless of the actual
+** ON CONFLICT mode specified.
+**
+** If X is non-zero, then the virtual table implementation guarantees
+** that if [xUpdate] returns [SQLITE_CONSTRAINT], it will do so before
+** any modifications to internal or persistent data structures have been made.
+** If the [ON CONFLICT] mode is ABORT, FAIL, IGNORE or ROLLBACK, SQLite
+** is able to roll back a statement or database transaction, and abandon
+** or continue processing the current SQL statement as appropriate.
+** If the ON CONFLICT mode is REPLACE and the [xUpdate] method returns
+** [SQLITE_CONSTRAINT], SQLite handles this as if the ON CONFLICT mode
+** had been ABORT.
+**
+** Virtual table implementations that are required to handle OR REPLACE
+** must do so within the [xUpdate] method. If a call to the
+** [sqlite3_vtab_on_conflict()] function indicates that the current ON
+** CONFLICT policy is REPLACE, the virtual table implementation should
+** silently replace the appropriate rows within the xUpdate callback and
+** return SQLITE_OK. Or, if this is not possible, it may return
+** SQLITE_CONSTRAINT, in which case SQLite falls back to OR ABORT
+** constraint handling.
+** </dd>
+**
+** [[SQLITE_VTAB_DIRECTONLY]]<dt>SQLITE_VTAB_DIRECTONLY</dt>
+** <dd>Calls of the form
+** [sqlite3_vtab_config](db,SQLITE_VTAB_DIRECTONLY) from within the
+** the [xConnect] or [xCreate] methods of a [virtual table] implementation
+** prohibits that virtual table from being used from within triggers and
+** views.
+** </dd>
+**
+** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt>
+** <dd>Calls of the form
+** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the
+** the [xConnect] or [xCreate] methods of a [virtual table] implementation
+** identify that virtual table as being safe to use from within triggers
+** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the
+** virtual table can do no serious harm even if it is controlled by a
+** malicious hacker. Developers should avoid setting the SQLITE_VTAB_INNOCUOUS
+** flag unless absolutely necessary.
+** </dd>
+**
+** [[SQLITE_VTAB_USES_ALL_SCHEMAS]]<dt>SQLITE_VTAB_USES_ALL_SCHEMAS</dt>
+** <dd>Calls of the form
+** [sqlite3_vtab_config](db,SQLITE_VTAB_USES_ALL_SCHEMA) from within the
+** the [xConnect] or [xCreate] methods of a [virtual table] implementation
+** instruct the query planner to begin at least a read transaction on
+** all schemas ("main", "temp", and any ATTACH-ed databases) whenever the
+** virtual table is used.
+** </dd>
+** </dl>
+*/
+#define SQLITE_VTAB_CONSTRAINT_SUPPORT 1
+#define SQLITE_VTAB_INNOCUOUS 2
+#define SQLITE_VTAB_DIRECTONLY 3
+#define SQLITE_VTAB_USES_ALL_SCHEMAS 4
+
+/*
+** CAPI3REF: Determine The Virtual Table Conflict Policy
+**
+** This function may only be called from within a call to the [xUpdate] method
+** of a [virtual table] implementation for an INSERT or UPDATE operation. ^The
+** value returned is one of [SQLITE_ROLLBACK], [SQLITE_IGNORE], [SQLITE_FAIL],
+** [SQLITE_ABORT], or [SQLITE_REPLACE], according to the [ON CONFLICT] mode
+** of the SQL statement that triggered the call to the [xUpdate] method of the
+** [virtual table].
+*/
+SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *);
+
+/*
+** CAPI3REF: Determine If Virtual Table Column Access Is For UPDATE
+**
+** If the sqlite3_vtab_nochange(X) routine is called within the [xColumn]
+** method of a [virtual table], then it might return true if the
+** column is being fetched as part of an UPDATE operation during which the
+** column value will not change. The virtual table implementation can use
+** this hint as permission to substitute a return value that is less
+** expensive to compute and that the corresponding
+** [xUpdate] method understands as a "no-change" value.
+**
+** If the [xColumn] method calls sqlite3_vtab_nochange() and finds that
+** the column is not changed by the UPDATE statement, then the xColumn
+** method can optionally return without setting a result, without calling
+** any of the [sqlite3_result_int|sqlite3_result_xxxxx() interfaces].
+** In that case, [sqlite3_value_nochange(X)] will return true for the
+** same column in the [xUpdate] method.
+**
+** The sqlite3_vtab_nochange() routine is an optimization. Virtual table
+** implementations should continue to give a correct answer even if the
+** sqlite3_vtab_nochange() interface were to always return false. In the
+** current implementation, the sqlite3_vtab_nochange() interface does always
+** returns false for the enhanced [UPDATE FROM] statement.
+*/
+SQLITE_API int sqlite3_vtab_nochange(sqlite3_context*);
+
+/*
+** CAPI3REF: Determine The Collation For a Virtual Table Constraint
+** METHOD: sqlite3_index_info
+**
+** This function may only be called from within a call to the [xBestIndex]
+** method of a [virtual table]. This function returns a pointer to a string
+** that is the name of the appropriate collation sequence to use for text
+** comparisons on the constraint identified by its arguments.
+**
+** The first argument must be the pointer to the [sqlite3_index_info] object
+** that is the first parameter to the xBestIndex() method. The second argument
+** must be an index into the aConstraint[] array belonging to the
+** sqlite3_index_info structure passed to xBestIndex.
+**
+** Important:
+** The first parameter must be the same pointer that is passed into the
+** xBestMethod() method. The first parameter may not be a pointer to a
+** different [sqlite3_index_info] object, even an exact copy.
+**
+** The return value is computed as follows:
+**
+** <ol>
+** <li><p> If the constraint comes from a WHERE clause expression that contains
+** a [COLLATE operator], then the name of the collation specified by
+** that COLLATE operator is returned.
+** <li><p> If there is no COLLATE operator, but the column that is the subject
+** of the constraint specifies an alternative collating sequence via
+** a [COLLATE clause] on the column definition within the CREATE TABLE
+** statement that was passed into [sqlite3_declare_vtab()], then the
+** name of that alternative collating sequence is returned.
+** <li><p> Otherwise, "BINARY" is returned.
+** </ol>
+*/
+SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
+
+/*
+** CAPI3REF: Determine if a virtual table query is DISTINCT
+** METHOD: sqlite3_index_info
+**
+** This API may only be used from within an [xBestIndex|xBestIndex method]
+** of a [virtual table] implementation. The result of calling this
+** interface from outside of xBestIndex() is undefined and probably harmful.
+**
+** ^The sqlite3_vtab_distinct() interface returns an integer between 0 and
+** 3. The integer returned by sqlite3_vtab_distinct()
+** gives the virtual table additional information about how the query
+** planner wants the output to be ordered. As long as the virtual table
+** can meet the ordering requirements of the query planner, it may set
+** the "orderByConsumed" flag.
+**
+** <ol><li value="0"><p>
+** ^If the sqlite3_vtab_distinct() interface returns 0, that means
+** that the query planner needs the virtual table to return all rows in the
+** sort order defined by the "nOrderBy" and "aOrderBy" fields of the
+** [sqlite3_index_info] object. This is the default expectation. If the
+** virtual table outputs all rows in sorted order, then it is always safe for
+** the xBestIndex method to set the "orderByConsumed" flag, regardless of
+** the return value from sqlite3_vtab_distinct().
+** <li value="1"><p>
+** ^(If the sqlite3_vtab_distinct() interface returns 1, that means
+** that the query planner does not need the rows to be returned in sorted order
+** as long as all rows with the same values in all columns identified by the
+** "aOrderBy" field are adjacent.)^ This mode is used when the query planner
+** is doing a GROUP BY.
+** <li value="2"><p>
+** ^(If the sqlite3_vtab_distinct() interface returns 2, that means
+** that the query planner does not need the rows returned in any particular
+** order, as long as rows with the same values in all columns identified
+** by "aOrderBy" are adjacent.)^ ^(Furthermore, when two or more rows
+** contain the same values for all columns identified by "colUsed", all but
+** one such row may optionally be omitted from the result.)^
+** The virtual table is not required to omit rows that are duplicates
+** over the "colUsed" columns, but if the virtual table can do that without
+** too much extra effort, it could potentially help the query to run faster.
+** This mode is used for a DISTINCT query.
+** <li value="3"><p>
+** ^(If the sqlite3_vtab_distinct() interface returns 3, that means the
+** virtual table must return rows in the order defined by "aOrderBy" as
+** if the sqlite3_vtab_distinct() interface had returned 0. However if
+** two or more rows in the result have the same values for all columns
+** identified by "colUsed", then all but one such row may optionally be
+** omitted.)^ Like when the return value is 2, the virtual table
+** is not required to omit rows that are duplicates over the "colUsed"
+** columns, but if the virtual table can do that without
+** too much extra effort, it could potentially help the query to run faster.
+** This mode is used for queries
+** that have both DISTINCT and ORDER BY clauses.
+** </ol>
+**
+** <p>The following table summarizes the conditions under which the
+** virtual table is allowed to set the "orderByConsumed" flag based on
+** the value returned by sqlite3_vtab_distinct(). This table is a
+** restatement of the previous four paragraphs:
+**
+** <table border=1 cellspacing=0 cellpadding=10 width="90%">
+** <tr>
+** <td valign="top">sqlite3_vtab_distinct() return value
+** <td valign="top">Rows are returned in aOrderBy order
+** <td valign="top">Rows with the same value in all aOrderBy columns are adjacent
+** <td valign="top">Duplicates over all colUsed columns may be omitted
+** <tr><td>0<td>yes<td>yes<td>no
+** <tr><td>1<td>no<td>yes<td>no
+** <tr><td>2<td>no<td>yes<td>yes
+** <tr><td>3<td>yes<td>yes<td>yes
+** </table>
+**
+** ^For the purposes of comparing virtual table output values to see if the
+** values are same value for sorting purposes, two NULL values are considered
+** to be the same. In other words, the comparison operator is "IS"
+** (or "IS NOT DISTINCT FROM") and not "==".
+**
+** If a virtual table implementation is unable to meet the requirements
+** specified above, then it must not set the "orderByConsumed" flag in the
+** [sqlite3_index_info] object or an incorrect answer may result.
+**
+** ^A virtual table implementation is always free to return rows in any order
+** it wants, as long as the "orderByConsumed" flag is not set. ^When the
+** the "orderByConsumed" flag is unset, the query planner will add extra
+** [bytecode] to ensure that the final results returned by the SQL query are
+** ordered correctly. The use of the "orderByConsumed" flag and the
+** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful
+** use of the sqlite3_vtab_distinct() interface and the "orderByConsumed"
+** flag might help queries against a virtual table to run faster. Being
+** overly aggressive and setting the "orderByConsumed" flag when it is not
+** valid to do so, on the other hand, might cause SQLite to return incorrect
+** results.
+*/
+SQLITE_API int sqlite3_vtab_distinct(sqlite3_index_info*);
+
+/*
+** CAPI3REF: Identify and handle IN constraints in xBestIndex
+**
+** This interface may only be used from within an
+** [xBestIndex|xBestIndex() method] of a [virtual table] implementation.
+** The result of invoking this interface from any other context is
+** undefined and probably harmful.
+**
+** ^(A constraint on a virtual table of the form
+** "[IN operator|column IN (...)]" is
+** communicated to the xBestIndex method as a
+** [SQLITE_INDEX_CONSTRAINT_EQ] constraint.)^ If xBestIndex wants to use
+** this constraint, it must set the corresponding
+** aConstraintUsage[].argvIndex to a positive integer. ^(Then, under
+** the usual mode of handling IN operators, SQLite generates [bytecode]
+** that invokes the [xFilter|xFilter() method] once for each value
+** on the right-hand side of the IN operator.)^ Thus the virtual table
+** only sees a single value from the right-hand side of the IN operator
+** at a time.
+**
+** In some cases, however, it would be advantageous for the virtual
+** table to see all values on the right-hand of the IN operator all at
+** once. The sqlite3_vtab_in() interfaces facilitates this in two ways:
+**
+** <ol>
+** <li><p>
+** ^A call to sqlite3_vtab_in(P,N,-1) will return true (non-zero)
+** if and only if the [sqlite3_index_info|P->aConstraint][N] constraint
+** is an [IN operator] that can be processed all at once. ^In other words,
+** sqlite3_vtab_in() with -1 in the third argument is a mechanism
+** by which the virtual table can ask SQLite if all-at-once processing
+** of the IN operator is even possible.
+**
+** <li><p>
+** ^A call to sqlite3_vtab_in(P,N,F) with F==1 or F==0 indicates
+** to SQLite that the virtual table does or does not want to process
+** the IN operator all-at-once, respectively. ^Thus when the third
+** parameter (F) is non-negative, this interface is the mechanism by
+** which the virtual table tells SQLite how it wants to process the
+** IN operator.
+** </ol>
+**
+** ^The sqlite3_vtab_in(P,N,F) interface can be invoked multiple times
+** within the same xBestIndex method call. ^For any given P,N pair,
+** the return value from sqlite3_vtab_in(P,N,F) will always be the same
+** within the same xBestIndex call. ^If the interface returns true
+** (non-zero), that means that the constraint is an IN operator
+** that can be processed all-at-once. ^If the constraint is not an IN
+** operator or cannot be processed all-at-once, then the interface returns
+** false.
+**
+** ^(All-at-once processing of the IN operator is selected if both of the
+** following conditions are met:
+**
+** <ol>
+** <li><p> The P->aConstraintUsage[N].argvIndex value is set to a positive
+** integer. This is how the virtual table tells SQLite that it wants to
+** use the N-th constraint.
+**
+** <li><p> The last call to sqlite3_vtab_in(P,N,F) for which F was
+** non-negative had F>=1.
+** </ol>)^
+**
+** ^If either or both of the conditions above are false, then SQLite uses
+** the traditional one-at-a-time processing strategy for the IN constraint.
+** ^If both conditions are true, then the argvIndex-th parameter to the
+** xFilter method will be an [sqlite3_value] that appears to be NULL,
+** but which can be passed to [sqlite3_vtab_in_first()] and
+** [sqlite3_vtab_in_next()] to find all values on the right-hand side
+** of the IN constraint.
+*/
+SQLITE_API int sqlite3_vtab_in(sqlite3_index_info*, int iCons, int bHandle);
+
+/*
+** CAPI3REF: Find all elements on the right-hand side of an IN constraint.
+**
+** These interfaces are only useful from within the
+** [xFilter|xFilter() method] of a [virtual table] implementation.
+** The result of invoking these interfaces from any other context
+** is undefined and probably harmful.
+**
+** The X parameter in a call to sqlite3_vtab_in_first(X,P) or
+** sqlite3_vtab_in_next(X,P) should be one of the parameters to the
+** xFilter method which invokes these routines, and specifically
+** a parameter that was previously selected for all-at-once IN constraint
+** processing use the [sqlite3_vtab_in()] interface in the
+** [xBestIndex|xBestIndex method]. ^(If the X parameter is not
+** an xFilter argument that was selected for all-at-once IN constraint
+** processing, then these routines return [SQLITE_ERROR].)^
+**
+** ^(Use these routines to access all values on the right-hand side
+** of the IN constraint using code like the following:
+**
+** <blockquote><pre>
+** for(rc=sqlite3_vtab_in_first(pList, &pVal);
+** rc==SQLITE_OK && pVal;
+** rc=sqlite3_vtab_in_next(pList, &pVal)
+** ){
+** // do something with pVal
+** }
+** if( rc!=SQLITE_OK ){
+** // an error has occurred
+** }
+** </pre></blockquote>)^
+**
+** ^On success, the sqlite3_vtab_in_first(X,P) and sqlite3_vtab_in_next(X,P)
+** routines return SQLITE_OK and set *P to point to the first or next value
+** on the RHS of the IN constraint. ^If there are no more values on the
+** right hand side of the IN constraint, then *P is set to NULL and these
+** routines return [SQLITE_DONE]. ^The return value might be
+** some other value, such as SQLITE_NOMEM, in the event of a malfunction.
+**
+** The *ppOut values returned by these routines are only valid until the
+** next call to either of these routines or until the end of the xFilter
+** method from which these routines were called. If the virtual table
+** implementation needs to retain the *ppOut values for longer, it must make
+** copies. The *ppOut values are [protected sqlite3_value|protected].
+*/
+SQLITE_API int sqlite3_vtab_in_first(sqlite3_value *pVal, sqlite3_value **ppOut);
+SQLITE_API int sqlite3_vtab_in_next(sqlite3_value *pVal, sqlite3_value **ppOut);
+
+/*
+** CAPI3REF: Constraint values in xBestIndex()
+** METHOD: sqlite3_index_info
+**
+** This API may only be used from within the [xBestIndex|xBestIndex method]
+** of a [virtual table] implementation. The result of calling this interface
+** from outside of an xBestIndex method are undefined and probably harmful.
+**
+** ^When the sqlite3_vtab_rhs_value(P,J,V) interface is invoked from within
+** the [xBestIndex] method of a [virtual table] implementation, with P being
+** a copy of the [sqlite3_index_info] object pointer passed into xBestIndex and
+** J being a 0-based index into P->aConstraint[], then this routine
+** attempts to set *V to the value of the right-hand operand of
+** that constraint if the right-hand operand is known. ^If the
+** right-hand operand is not known, then *V is set to a NULL pointer.
+** ^The sqlite3_vtab_rhs_value(P,J,V) interface returns SQLITE_OK if
+** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V)
+** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th
+** constraint is not available. ^The sqlite3_vtab_rhs_value() interface
+** can return an result code other than SQLITE_OK or SQLITE_NOTFOUND if
+** something goes wrong.
+**
+** The sqlite3_vtab_rhs_value() interface is usually only successful if
+** the right-hand operand of a constraint is a literal value in the original
+** SQL statement. If the right-hand operand is an expression or a reference
+** to some other column or a [host parameter], then sqlite3_vtab_rhs_value()
+** will probably return [SQLITE_NOTFOUND].
+**
+** ^(Some constraints, such as [SQLITE_INDEX_CONSTRAINT_ISNULL] and
+** [SQLITE_INDEX_CONSTRAINT_ISNOTNULL], have no right-hand operand. For such
+** constraints, sqlite3_vtab_rhs_value() always returns SQLITE_NOTFOUND.)^
+**
+** ^The [sqlite3_value] object returned in *V is a protected sqlite3_value
+** and remains valid for the duration of the xBestIndex method call.
+** ^When xBestIndex returns, the sqlite3_value object returned by
+** sqlite3_vtab_rhs_value() is automatically deallocated.
+**
+** The "_rhs_" in the name of this routine is an abbreviation for
+** "Right-Hand Side".
+*/
+SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **ppVal);
+
+/*
+** CAPI3REF: Conflict resolution modes
+** KEYWORDS: {conflict resolution mode}
+**
+** These constants are returned by [sqlite3_vtab_on_conflict()] to
+** inform a [virtual table] implementation what the [ON CONFLICT] mode
+** is for the SQL statement being evaluated.
+**
+** Note that the [SQLITE_IGNORE] constant is also used as a potential
+** return value from the [sqlite3_set_authorizer()] callback and that
+** [SQLITE_ABORT] is also a [result code].
+*/
+#define SQLITE_ROLLBACK 1
+/* #define SQLITE_IGNORE 2 // Also used by sqlite3_authorizer() callback */
+#define SQLITE_FAIL 3
+/* #define SQLITE_ABORT 4 // Also an error code */
+#define SQLITE_REPLACE 5
+
+/*
+** CAPI3REF: Prepared Statement Scan Status Opcodes
+** KEYWORDS: {scanstatus options}
+**
+** The following constants can be used for the T parameter to the
+** [sqlite3_stmt_scanstatus(S,X,T,V)] interface. Each constant designates a
+** different metric for sqlite3_stmt_scanstatus() to return.
+**
+** When the value returned to V is a string, space to hold that string is
+** managed by the prepared statement S and will be automatically freed when
+** S is finalized.
+**
+** Not all values are available for all query elements. When a value is
+** not available, the output variable is set to -1 if the value is numeric,
+** or to NULL if it is a string (SQLITE_SCANSTAT_NAME).
+**
+** <dl>
+** [[SQLITE_SCANSTAT_NLOOP]] <dt>SQLITE_SCANSTAT_NLOOP</dt>
+** <dd>^The [sqlite3_int64] variable pointed to by the V parameter will be
+** set to the total number of times that the X-th loop has run.</dd>
+**
+** [[SQLITE_SCANSTAT_NVISIT]] <dt>SQLITE_SCANSTAT_NVISIT</dt>
+** <dd>^The [sqlite3_int64] variable pointed to by the V parameter will be set
+** to the total number of rows examined by all iterations of the X-th loop.</dd>
+**
+** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
+** <dd>^The "double" variable pointed to by the V parameter will be set to the
+** query planner's estimate for the average number of rows output from each
+** iteration of the X-th loop. If the query planner's estimates was accurate,
+** then this value will approximate the quotient NVISIT/NLOOP and the
+** product of this value for all prior loops with the same SELECTID will
+** be the NLOOP value for the current loop.
+**
+** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt>
+** <dd>^The "const char *" variable pointed to by the V parameter will be set
+** to a zero-terminated UTF-8 string containing the name of the index or table
+** used for the X-th loop.
+**
+** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt>
+** <dd>^The "const char *" variable pointed to by the V parameter will be set
+** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN]
+** description for the X-th loop.
+**
+** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECTID</dt>
+** <dd>^The "int" variable pointed to by the V parameter will be set to the
+** id for the X-th query plan element. The id value is unique within the
+** statement. The select-id is the same value as is output in the first
+** column of an [EXPLAIN QUERY PLAN] query.
+**
+** [[SQLITE_SCANSTAT_PARENTID]] <dt>SQLITE_SCANSTAT_PARENTID</dt>
+** <dd>The "int" variable pointed to by the V parameter will be set to the
+** the id of the parent of the current query element, if applicable, or
+** to zero if the query element has no parent. This is the same value as
+** returned in the second column of an [EXPLAIN QUERY PLAN] query.
+**
+** [[SQLITE_SCANSTAT_NCYCLE]] <dt>SQLITE_SCANSTAT_NCYCLE</dt>
+** <dd>The sqlite3_int64 output value is set to the number of cycles,
+** according to the processor time-stamp counter, that elapsed while the
+** query element was being processed. This value is not available for
+** all query elements - if it is unavailable the output variable is
+** set to -1.
+** </dl>
+*/
+#define SQLITE_SCANSTAT_NLOOP 0
+#define SQLITE_SCANSTAT_NVISIT 1
+#define SQLITE_SCANSTAT_EST 2
+#define SQLITE_SCANSTAT_NAME 3
+#define SQLITE_SCANSTAT_EXPLAIN 4
+#define SQLITE_SCANSTAT_SELECTID 5
+#define SQLITE_SCANSTAT_PARENTID 6
+#define SQLITE_SCANSTAT_NCYCLE 7
+
+/*
+** CAPI3REF: Prepared Statement Scan Status
+** METHOD: sqlite3_stmt
+**
+** These interfaces return information about the predicted and measured
+** performance for pStmt. Advanced applications can use this
+** interface to compare the predicted and the measured performance and
+** issue warnings and/or rerun [ANALYZE] if discrepancies are found.
+**
+** Since this interface is expected to be rarely used, it is only
+** available if SQLite is compiled using the [SQLITE_ENABLE_STMT_SCANSTATUS]
+** compile-time option.
+**
+** The "iScanStatusOp" parameter determines which status information to return.
+** The "iScanStatusOp" must be one of the [scanstatus options] or the behavior
+** of this interface is undefined. ^The requested measurement is written into
+** a variable pointed to by the "pOut" parameter.
+**
+** The "flags" parameter must be passed a mask of flags. At present only
+** one flag is defined - SQLITE_SCANSTAT_COMPLEX. If SQLITE_SCANSTAT_COMPLEX
+** is specified, then status information is available for all elements
+** of a query plan that are reported by "EXPLAIN QUERY PLAN" output. If
+** SQLITE_SCANSTAT_COMPLEX is not specified, then only query plan elements
+** that correspond to query loops (the "SCAN..." and "SEARCH..." elements of
+** the EXPLAIN QUERY PLAN output) are available. Invoking API
+** sqlite3_stmt_scanstatus() is equivalent to calling
+** sqlite3_stmt_scanstatus_v2() with a zeroed flags parameter.
+**
+** Parameter "idx" identifies the specific query element to retrieve statistics
+** for. Query elements are numbered starting from zero. A value of -1 may be
+** to query for statistics regarding the entire query. ^If idx is out of range
+** - less than -1 or greater than or equal to the total number of query
+** elements used to implement the statement - a non-zero value is returned and
+** the variable that pOut points to is unchanged.
+**
+** See also: [sqlite3_stmt_scanstatus_reset()]
+*/
+SQLITE_API int sqlite3_stmt_scanstatus(
+ sqlite3_stmt *pStmt, /* Prepared statement for which info desired */
+ int idx, /* Index of loop to report on */
+ int iScanStatusOp, /* Information desired. SQLITE_SCANSTAT_* */
+ void *pOut /* Result written here */
+);
+SQLITE_API int sqlite3_stmt_scanstatus_v2(
+ sqlite3_stmt *pStmt, /* Prepared statement for which info desired */
+ int idx, /* Index of loop to report on */
+ int iScanStatusOp, /* Information desired. SQLITE_SCANSTAT_* */
+ int flags, /* Mask of flags defined below */
+ void *pOut /* Result written here */
+);
+
+/*
+** CAPI3REF: Prepared Statement Scan Status
+** KEYWORDS: {scan status flags}
+*/
+#define SQLITE_SCANSTAT_COMPLEX 0x0001
+
+/*
+** CAPI3REF: Zero Scan-Status Counters
+** METHOD: sqlite3_stmt
+**
+** ^Zero all [sqlite3_stmt_scanstatus()] related event counters.
+**
+** This API is only available if the library is built with pre-processor
+** symbol [SQLITE_ENABLE_STMT_SCANSTATUS] defined.
+*/
+SQLITE_API void sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);
+
+/*
+** CAPI3REF: Flush caches to disk mid-transaction
+** METHOD: sqlite3
+**
+** ^If a write-transaction is open on [database connection] D when the
+** [sqlite3_db_cacheflush(D)] interface invoked, any dirty
+** pages in the pager-cache that are not currently in use are written out
+** to disk. A dirty page may be in use if a database cursor created by an
+** active SQL statement is reading from it, or if it is page 1 of a database
+** file (page 1 is always "in use"). ^The [sqlite3_db_cacheflush(D)]
+** interface flushes caches for all schemas - "main", "temp", and
+** any [attached] databases.
+**
+** ^If this function needs to obtain extra database locks before dirty pages
+** can be flushed to disk, it does so. ^If those locks cannot be obtained
+** immediately and there is a busy-handler callback configured, it is invoked
+** in the usual manner. ^If the required lock still cannot be obtained, then
+** the database is skipped and an attempt made to flush any dirty pages
+** belonging to the next (if any) database. ^If any databases are skipped
+** because locks cannot be obtained, but no other error occurs, this
+** function returns SQLITE_BUSY.
+**
+** ^If any other error occurs while flushing dirty pages to disk (for
+** example an IO error or out-of-memory condition), then processing is
+** abandoned and an SQLite [error code] is returned to the caller immediately.
+**
+** ^Otherwise, if no error occurs, [sqlite3_db_cacheflush()] returns SQLITE_OK.
+**
+** ^This function does not set the database handle error code or message
+** returned by the [sqlite3_errcode()] and [sqlite3_errmsg()] functions.
+*/
+SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
+
+/*
+** CAPI3REF: The pre-update hook.
+** METHOD: sqlite3
+**
+** ^These interfaces are only available if SQLite is compiled using the
+** [SQLITE_ENABLE_PREUPDATE_HOOK] compile-time option.
+**
+** ^The [sqlite3_preupdate_hook()] interface registers a callback function
+** that is invoked prior to each [INSERT], [UPDATE], and [DELETE] operation
+** on a database table.
+** ^At most one preupdate hook may be registered at a time on a single
+** [database connection]; each call to [sqlite3_preupdate_hook()] overrides
+** the previous setting.
+** ^The preupdate hook is disabled by invoking [sqlite3_preupdate_hook()]
+** with a NULL pointer as the second parameter.
+** ^The third parameter to [sqlite3_preupdate_hook()] is passed through as
+** the first parameter to callbacks.
+**
+** ^The preupdate hook only fires for changes to real database tables; the
+** preupdate hook is not invoked for changes to [virtual tables] or to
+** system tables like sqlite_sequence or sqlite_stat1.
+**
+** ^The second parameter to the preupdate callback is a pointer to
+** the [database connection] that registered the preupdate hook.
+** ^The third parameter to the preupdate callback is one of the constants
+** [SQLITE_INSERT], [SQLITE_DELETE], or [SQLITE_UPDATE] to identify the
+** kind of update operation that is about to occur.
+** ^(The fourth parameter to the preupdate callback is the name of the
+** database within the database connection that is being modified. This
+** will be "main" for the main database or "temp" for TEMP tables or
+** the name given after the AS keyword in the [ATTACH] statement for attached
+** databases.)^
+** ^The fifth parameter to the preupdate callback is the name of the
+** table that is being modified.
+**
+** For an UPDATE or DELETE operation on a [rowid table], the sixth
+** parameter passed to the preupdate callback is the initial [rowid] of the
+** row being modified or deleted. For an INSERT operation on a rowid table,
+** or any operation on a WITHOUT ROWID table, the value of the sixth
+** parameter is undefined. For an INSERT or UPDATE on a rowid table the
+** seventh parameter is the final rowid value of the row being inserted
+** or updated. The value of the seventh parameter passed to the callback
+** function is not defined for operations on WITHOUT ROWID tables, or for
+** DELETE operations on rowid tables.
+**
+** ^The sqlite3_preupdate_hook(D,C,P) function returns the P argument from
+** the previous call on the same [database connection] D, or NULL for
+** the first call on D.
+**
+** The [sqlite3_preupdate_old()], [sqlite3_preupdate_new()],
+** [sqlite3_preupdate_count()], and [sqlite3_preupdate_depth()] interfaces
+** provide additional information about a preupdate event. These routines
+** may only be called from within a preupdate callback. Invoking any of
+** these routines from outside of a preupdate callback or with a
+** [database connection] pointer that is different from the one supplied
+** to the preupdate callback results in undefined and probably undesirable
+** behavior.
+**
+** ^The [sqlite3_preupdate_count(D)] interface returns the number of columns
+** in the row that is being inserted, updated, or deleted.
+**
+** ^The [sqlite3_preupdate_old(D,N,P)] interface writes into P a pointer to
+** a [protected sqlite3_value] that contains the value of the Nth column of
+** the table row before it is updated. The N parameter must be between 0
+** and one less than the number of columns or the behavior will be
+** undefined. This must only be used within SQLITE_UPDATE and SQLITE_DELETE
+** preupdate callbacks; if it is used by an SQLITE_INSERT callback then the
+** behavior is undefined. The [sqlite3_value] that P points to
+** will be destroyed when the preupdate callback returns.
+**
+** ^The [sqlite3_preupdate_new(D,N,P)] interface writes into P a pointer to
+** a [protected sqlite3_value] that contains the value of the Nth column of
+** the table row after it is updated. The N parameter must be between 0
+** and one less than the number of columns or the behavior will be
+** undefined. This must only be used within SQLITE_INSERT and SQLITE_UPDATE
+** preupdate callbacks; if it is used by an SQLITE_DELETE callback then the
+** behavior is undefined. The [sqlite3_value] that P points to
+** will be destroyed when the preupdate callback returns.
+**
+** ^The [sqlite3_preupdate_depth(D)] interface returns 0 if the preupdate
+** callback was invoked as a result of a direct insert, update, or delete
+** operation; or 1 for inserts, updates, or deletes invoked by top-level
+** triggers; or 2 for changes resulting from triggers called by top-level
+** triggers; and so forth.
+**
+** When the [sqlite3_blob_write()] API is used to update a blob column,
+** the pre-update hook is invoked with SQLITE_DELETE. This is because the
+** in this case the new values are not available. In this case, when a
+** callback made with op==SQLITE_DELETE is actually a write using the
+** sqlite3_blob_write() API, the [sqlite3_preupdate_blobwrite()] returns
+** the index of the column being written. In other cases, where the
+** pre-update hook is being invoked for some other reason, including a
+** regular DELETE, sqlite3_preupdate_blobwrite() returns -1.
+**
+** See also: [sqlite3_update_hook()]
+*/
+#if defined(SQLITE_ENABLE_PREUPDATE_HOOK)
+SQLITE_API void *sqlite3_preupdate_hook(
+ sqlite3 *db,
+ void(*xPreUpdate)(
+ void *pCtx, /* Copy of third arg to preupdate_hook() */
+ sqlite3 *db, /* Database handle */
+ int op, /* SQLITE_UPDATE, DELETE or INSERT */
+ char const *zDb, /* Database name */
+ char const *zName, /* Table name */
+ sqlite3_int64 iKey1, /* Rowid of row about to be deleted/updated */
+ sqlite3_int64 iKey2 /* New rowid value (for a rowid UPDATE) */
+ ),
+ void*
+);
+SQLITE_API int sqlite3_preupdate_old(sqlite3 *, int, sqlite3_value **);
+SQLITE_API int sqlite3_preupdate_count(sqlite3 *);
+SQLITE_API int sqlite3_preupdate_depth(sqlite3 *);
+SQLITE_API int sqlite3_preupdate_new(sqlite3 *, int, sqlite3_value **);
+SQLITE_API int sqlite3_preupdate_blobwrite(sqlite3 *);
+#endif
+
+/*
+** CAPI3REF: Low-level system error code
+** METHOD: sqlite3
+**
+** ^Attempt to return the underlying operating system error code or error
+** number that caused the most recent I/O error or failure to open a file.
+** The return value is OS-dependent. For example, on unix systems, after
+** [sqlite3_open_v2()] returns [SQLITE_CANTOPEN], this interface could be
+** called to get back the underlying "errno" that caused the problem, such
+** as ENOSPC, EAUTH, EISDIR, and so forth.
+*/
+SQLITE_API int sqlite3_system_errno(sqlite3*);
+
+/*
+** CAPI3REF: Database Snapshot
+** KEYWORDS: {snapshot} {sqlite3_snapshot}
+**
+** An instance of the snapshot object records the state of a [WAL mode]
+** database for some specific point in history.
+**
+** In [WAL mode], multiple [database connections] that are open on the
+** same database file can each be reading a different historical version
+** of the database file. When a [database connection] begins a read
+** transaction, that connection sees an unchanging copy of the database
+** as it existed for the point in time when the transaction first started.
+** Subsequent changes to the database from other connections are not seen
+** by the reader until a new read transaction is started.
+**
+** The sqlite3_snapshot object records state information about an historical
+** version of the database file so that it is possible to later open a new read
+** transaction that sees that historical version of the database rather than
+** the most recent version.
+*/
+typedef struct sqlite3_snapshot {
+ unsigned char hidden[48];
+} sqlite3_snapshot;
+
+/*
+** CAPI3REF: Record A Database Snapshot
+** CONSTRUCTOR: sqlite3_snapshot
+**
+** ^The [sqlite3_snapshot_get(D,S,P)] interface attempts to make a
+** new [sqlite3_snapshot] object that records the current state of
+** schema S in database connection D. ^On success, the
+** [sqlite3_snapshot_get(D,S,P)] interface writes a pointer to the newly
+** created [sqlite3_snapshot] object into *P and returns SQLITE_OK.
+** If there is not already a read-transaction open on schema S when
+** this function is called, one is opened automatically.
+**
+** If a read-transaction is opened by this function, then it is guaranteed
+** that the returned snapshot object may not be invalidated by a database
+** writer or checkpointer until after the read-transaction is closed. This
+** is not guaranteed if a read-transaction is already open when this
+** function is called. In that case, any subsequent write or checkpoint
+** operation on the database may invalidate the returned snapshot handle,
+** even while the read-transaction remains open.
+**
+** The following must be true for this function to succeed. If any of
+** the following statements are false when sqlite3_snapshot_get() is
+** called, SQLITE_ERROR is returned. The final value of *P is undefined
+** in this case.
+**
+** <ul>
+** <li> The database handle must not be in [autocommit mode].
+**
+** <li> Schema S of [database connection] D must be a [WAL mode] database.
+**
+** <li> There must not be a write transaction open on schema S of database
+** connection D.
+**
+** <li> One or more transactions must have been written to the current wal
+** file since it was created on disk (by any connection). This means
+** that a snapshot cannot be taken on a wal mode database with no wal
+** file immediately after it is first opened. At least one transaction
+** must be written to it first.
+** </ul>
+**
+** This function may also return SQLITE_NOMEM. If it is called with the
+** database handle in autocommit mode but fails for some other reason,
+** whether or not a read transaction is opened on schema S is undefined.
+**
+** The [sqlite3_snapshot] object returned from a successful call to
+** [sqlite3_snapshot_get()] must be freed using [sqlite3_snapshot_free()]
+** to avoid a memory leak.
+**
+** The [sqlite3_snapshot_get()] interface is only available when the
+** [SQLITE_ENABLE_SNAPSHOT] compile-time option is used.
+*/
+SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_get(
+ sqlite3 *db,
+ const char *zSchema,
+ sqlite3_snapshot **ppSnapshot
+);
+
+/*
+** CAPI3REF: Start a read transaction on an historical snapshot
+** METHOD: sqlite3_snapshot
+**
+** ^The [sqlite3_snapshot_open(D,S,P)] interface either starts a new read
+** transaction or upgrades an existing one for schema S of
+** [database connection] D such that the read transaction refers to
+** historical [snapshot] P, rather than the most recent change to the
+** database. ^The [sqlite3_snapshot_open()] interface returns SQLITE_OK
+** on success or an appropriate [error code] if it fails.
+**
+** ^In order to succeed, the database connection must not be in
+** [autocommit mode] when [sqlite3_snapshot_open(D,S,P)] is called. If there
+** is already a read transaction open on schema S, then the database handle
+** must have no active statements (SELECT statements that have been passed
+** to sqlite3_step() but not sqlite3_reset() or sqlite3_finalize()).
+** SQLITE_ERROR is returned if either of these conditions is violated, or
+** if schema S does not exist, or if the snapshot object is invalid.
+**
+** ^A call to sqlite3_snapshot_open() will fail to open if the specified
+** snapshot has been overwritten by a [checkpoint]. In this case
+** SQLITE_ERROR_SNAPSHOT is returned.
+**
+** If there is already a read transaction open when this function is
+** invoked, then the same read transaction remains open (on the same
+** database snapshot) if SQLITE_ERROR, SQLITE_BUSY or SQLITE_ERROR_SNAPSHOT
+** is returned. If another error code - for example SQLITE_PROTOCOL or an
+** SQLITE_IOERR error code - is returned, then the final state of the
+** read transaction is undefined. If SQLITE_OK is returned, then the
+** read transaction is now open on database snapshot P.
+**
+** ^(A call to [sqlite3_snapshot_open(D,S,P)] will fail if the
+** database connection D does not know that the database file for
+** schema S is in [WAL mode]. A database connection might not know
+** that the database file is in [WAL mode] if there has been no prior
+** I/O on that database connection, or if the database entered [WAL mode]
+** after the most recent I/O on the database connection.)^
+** (Hint: Run "[PRAGMA application_id]" against a newly opened
+** database connection in order to make it ready to use snapshots.)
+**
+** The [sqlite3_snapshot_open()] interface is only available when the
+** [SQLITE_ENABLE_SNAPSHOT] compile-time option is used.
+*/
+SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_open(
+ sqlite3 *db,
+ const char *zSchema,
+ sqlite3_snapshot *pSnapshot
+);
+
+/*
+** CAPI3REF: Destroy a snapshot
+** DESTRUCTOR: sqlite3_snapshot
+**
+** ^The [sqlite3_snapshot_free(P)] interface destroys [sqlite3_snapshot] P.
+** The application must eventually free every [sqlite3_snapshot] object
+** using this routine to avoid a memory leak.
+**
+** The [sqlite3_snapshot_free()] interface is only available when the
+** [SQLITE_ENABLE_SNAPSHOT] compile-time option is used.
+*/
+SQLITE_API SQLITE_EXPERIMENTAL void sqlite3_snapshot_free(sqlite3_snapshot*);
+
+/*
+** CAPI3REF: Compare the ages of two snapshot handles.
+** METHOD: sqlite3_snapshot
+**
+** The sqlite3_snapshot_cmp(P1, P2) interface is used to compare the ages
+** of two valid snapshot handles.
+**
+** If the two snapshot handles are not associated with the same database
+** file, the result of the comparison is undefined.
+**
+** Additionally, the result of the comparison is only valid if both of the
+** snapshot handles were obtained by calling sqlite3_snapshot_get() since the
+** last time the wal file was deleted. The wal file is deleted when the
+** database is changed back to rollback mode or when the number of database
+** clients drops to zero. If either snapshot handle was obtained before the
+** wal file was last deleted, the value returned by this function
+** is undefined.
+**
+** Otherwise, this API returns a negative value if P1 refers to an older
+** snapshot than P2, zero if the two handles refer to the same database
+** snapshot, and a positive value if P1 is a newer snapshot than P2.
+**
+** This interface is only available if SQLite is compiled with the
+** [SQLITE_ENABLE_SNAPSHOT] option.
+*/
+SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_cmp(
+ sqlite3_snapshot *p1,
+ sqlite3_snapshot *p2
+);
+
+/*
+** CAPI3REF: Recover snapshots from a wal file
+** METHOD: sqlite3_snapshot
+**
+** If a [WAL file] remains on disk after all database connections close
+** (either through the use of the [SQLITE_FCNTL_PERSIST_WAL] [file control]
+** or because the last process to have the database opened exited without
+** calling [sqlite3_close()]) and a new connection is subsequently opened
+** on that database and [WAL file], the [sqlite3_snapshot_open()] interface
+** will only be able to open the last transaction added to the WAL file
+** even though the WAL file contains other valid transactions.
+**
+** This function attempts to scan the WAL file associated with database zDb
+** of database handle db and make all valid snapshots available to
+** sqlite3_snapshot_open(). It is an error if there is already a read
+** transaction open on the database, or if the database is not a WAL mode
+** database.
+**
+** SQLITE_OK is returned if successful, or an SQLite error code otherwise.
+**
+** This interface is only available if SQLite is compiled with the
+** [SQLITE_ENABLE_SNAPSHOT] option.
+*/
+SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const char *zDb);
+
+/*
+** CAPI3REF: Serialize a database
+**
+** The sqlite3_serialize(D,S,P,F) interface returns a pointer to
+** memory that is a serialization of the S database on
+** [database connection] D. If S is a NULL pointer, the main database is used.
+** If P is not a NULL pointer, then the size of the database in bytes
+** is written into *P.
+**
+** For an ordinary on-disk database file, the serialization is just a
+** copy of the disk file. For an in-memory database or a "TEMP" database,
+** the serialization is the same sequence of bytes which would be written
+** to disk if that database where backed up to disk.
+**
+** The usual case is that sqlite3_serialize() copies the serialization of
+** the database into memory obtained from [sqlite3_malloc64()] and returns
+** a pointer to that memory. The caller is responsible for freeing the
+** returned value to avoid a memory leak. However, if the F argument
+** contains the SQLITE_SERIALIZE_NOCOPY bit, then no memory allocations
+** are made, and the sqlite3_serialize() function will return a pointer
+** to the contiguous memory representation of the database that SQLite
+** is currently using for that database, or NULL if the no such contiguous
+** memory representation of the database exists. A contiguous memory
+** representation of the database will usually only exist if there has
+** been a prior call to [sqlite3_deserialize(D,S,...)] with the same
+** values of D and S.
+** The size of the database is written into *P even if the
+** SQLITE_SERIALIZE_NOCOPY bit is set but no contiguous copy
+** of the database exists.
+**
+** After the call, if the SQLITE_SERIALIZE_NOCOPY bit had been set,
+** the returned buffer content will remain accessible and unchanged
+** until either the next write operation on the connection or when
+** the connection is closed, and applications must not modify the
+** buffer. If the bit had been clear, the returned buffer will not
+** be accessed by SQLite after the call.
+**
+** A call to sqlite3_serialize(D,S,P,F) might return NULL even if the
+** SQLITE_SERIALIZE_NOCOPY bit is omitted from argument F if a memory
+** allocation error occurs.
+**
+** This interface is omitted if SQLite is compiled with the
+** [SQLITE_OMIT_DESERIALIZE] option.
+*/
+SQLITE_API unsigned char *sqlite3_serialize(
+ sqlite3 *db, /* The database connection */
+ const char *zSchema, /* Which DB to serialize. ex: "main", "temp", ... */
+ sqlite3_int64 *piSize, /* Write size of the DB here, if not NULL */
+ unsigned int mFlags /* Zero or more SQLITE_SERIALIZE_* flags */
+);
+
+/*
+** CAPI3REF: Flags for sqlite3_serialize
+**
+** Zero or more of the following constants can be OR-ed together for
+** the F argument to [sqlite3_serialize(D,S,P,F)].
+**
+** SQLITE_SERIALIZE_NOCOPY means that [sqlite3_serialize()] will return
+** a pointer to contiguous in-memory database that it is currently using,
+** without making a copy of the database. If SQLite is not currently using
+** a contiguous in-memory database, then this option causes
+** [sqlite3_serialize()] to return a NULL pointer. SQLite will only be
+** using a contiguous in-memory database if it has been initialized by a
+** prior call to [sqlite3_deserialize()].
+*/
+#define SQLITE_SERIALIZE_NOCOPY 0x001 /* Do no memory allocations */
+
+/*
+** CAPI3REF: Deserialize a database
+**
+** The sqlite3_deserialize(D,S,P,N,M,F) interface causes the
+** [database connection] D to disconnect from database S and then
+** reopen S as an in-memory database based on the serialization contained
+** in P. The serialized database P is N bytes in size. M is the size of
+** the buffer P, which might be larger than N. If M is larger than N, and
+** the SQLITE_DESERIALIZE_READONLY bit is not set in F, then SQLite is
+** permitted to add content to the in-memory database as long as the total
+** size does not exceed M bytes.
+**
+** If the SQLITE_DESERIALIZE_FREEONCLOSE bit is set in F, then SQLite will
+** invoke sqlite3_free() on the serialization buffer when the database
+** connection closes. If the SQLITE_DESERIALIZE_RESIZEABLE bit is set, then
+** SQLite will try to increase the buffer size using sqlite3_realloc64()
+** if writes on the database cause it to grow larger than M bytes.
+**
+** Applications must not modify the buffer P or invalidate it before
+** the database connection D is closed.
+**
+** The sqlite3_deserialize() interface will fail with SQLITE_BUSY if the
+** database is currently in a read transaction or is involved in a backup
+** operation.
+**
+** It is not possible to deserialized into the TEMP database. If the
+** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the
+** function returns SQLITE_ERROR.
+**
+** The deserialized database should not be in [WAL mode]. If the database
+** is in WAL mode, then any attempt to use the database file will result
+** in an [SQLITE_CANTOPEN] error. The application can set the
+** [file format version numbers] (bytes 18 and 19) of the input database P
+** to 0x01 prior to invoking sqlite3_deserialize(D,S,P,N,M,F) to force the
+** database file into rollback mode and work around this limitation.
+**
+** If sqlite3_deserialize(D,S,P,N,M,F) fails for any reason and if the
+** SQLITE_DESERIALIZE_FREEONCLOSE bit is set in argument F, then
+** [sqlite3_free()] is invoked on argument P prior to returning.
+**
+** This interface is omitted if SQLite is compiled with the
+** [SQLITE_OMIT_DESERIALIZE] option.
+*/
+SQLITE_API int sqlite3_deserialize(
+ sqlite3 *db, /* The database connection */
+ const char *zSchema, /* Which DB to reopen with the deserialization */
+ unsigned char *pData, /* The serialized database content */
+ sqlite3_int64 szDb, /* Number bytes in the deserialization */
+ sqlite3_int64 szBuf, /* Total size of buffer pData[] */
+ unsigned mFlags /* Zero or more SQLITE_DESERIALIZE_* flags */
+);
+
+/*
+** CAPI3REF: Flags for sqlite3_deserialize()
+**
+** The following are allowed values for 6th argument (the F argument) to
+** the [sqlite3_deserialize(D,S,P,N,M,F)] interface.
+**
+** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization
+** in the P argument is held in memory obtained from [sqlite3_malloc64()]
+** and that SQLite should take ownership of this memory and automatically
+** free it when it has finished using it. Without this flag, the caller
+** is responsible for freeing any dynamically allocated memory.
+**
+** The SQLITE_DESERIALIZE_RESIZEABLE flag means that SQLite is allowed to
+** grow the size of the database using calls to [sqlite3_realloc64()]. This
+** flag should only be used if SQLITE_DESERIALIZE_FREEONCLOSE is also used.
+** Without this flag, the deserialized database cannot increase in size beyond
+** the number of bytes specified by the M parameter.
+**
+** The SQLITE_DESERIALIZE_READONLY flag means that the deserialized database
+** should be treated as read-only.
+*/
+#define SQLITE_DESERIALIZE_FREEONCLOSE 1 /* Call sqlite3_free() on close */
+#define SQLITE_DESERIALIZE_RESIZEABLE 2 /* Resize using sqlite3_realloc64() */
+#define SQLITE_DESERIALIZE_READONLY 4 /* Database is read-only */
+
+/*
+** Undo the hack that converts floating point types to integer for
+** builds on processors without floating point support.
+*/
+#ifdef SQLITE_OMIT_FLOATING_POINT
+# undef double
+#endif
+
+#if defined(__wasi__)
+# undef SQLITE_WASI
+# define SQLITE_WASI 1
+# ifndef SQLITE_OMIT_LOAD_EXTENSION
+# define SQLITE_OMIT_LOAD_EXTENSION
+# endif
+# ifndef SQLITE_THREADSAFE
+# define SQLITE_THREADSAFE 0
+# endif
+#endif
+
+#if 0
+} /* End of the 'extern "C"' block */
+#endif
+/* #endif for SQLITE3_H will be added by mksqlite3.tcl */
+
+/******** Begin file sqlite3rtree.h *********/
+/*
+** 2010 August 30
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+*/
+
+#ifndef _SQLITE3RTREE_H_
+#define _SQLITE3RTREE_H_
+
+
+#if 0
+extern "C" {
+#endif
+
+typedef struct sqlite3_rtree_geometry sqlite3_rtree_geometry;
+typedef struct sqlite3_rtree_query_info sqlite3_rtree_query_info;
+
+/* The double-precision datatype used by RTree depends on the
+** SQLITE_RTREE_INT_ONLY compile-time option.
+*/
+#ifdef SQLITE_RTREE_INT_ONLY
+ typedef sqlite3_int64 sqlite3_rtree_dbl;
+#else
+ typedef double sqlite3_rtree_dbl;
+#endif
+
+/*
+** Register a geometry callback named zGeom that can be used as part of an
+** R-Tree geometry query as follows:
+**
+** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zGeom(... params ...)
+*/
+SQLITE_API int sqlite3_rtree_geometry_callback(
+ sqlite3 *db,
+ const char *zGeom,
+ int (*xGeom)(sqlite3_rtree_geometry*, int, sqlite3_rtree_dbl*,int*),
+ void *pContext
+);
+
+
+/*
+** A pointer to a structure of the following type is passed as the first
+** argument to callbacks registered using rtree_geometry_callback().
+*/
+struct sqlite3_rtree_geometry {
+ void *pContext; /* Copy of pContext passed to s_r_g_c() */
+ int nParam; /* Size of array aParam[] */
+ sqlite3_rtree_dbl *aParam; /* Parameters passed to SQL geom function */
+ void *pUser; /* Callback implementation user data */
+ void (*xDelUser)(void *); /* Called by SQLite to clean up pUser */
+};
+
+/*
+** Register a 2nd-generation geometry callback named zScore that can be
+** used as part of an R-Tree geometry query as follows:
+**
+** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zQueryFunc(... params ...)
+*/
+SQLITE_API int sqlite3_rtree_query_callback(
+ sqlite3 *db,
+ const char *zQueryFunc,
+ int (*xQueryFunc)(sqlite3_rtree_query_info*),
+ void *pContext,
+ void (*xDestructor)(void*)
+);
+
+
+/*
+** A pointer to a structure of the following type is passed as the
+** argument to scored geometry callback registered using
+** sqlite3_rtree_query_callback().
+**
+** Note that the first 5 fields of this structure are identical to
+** sqlite3_rtree_geometry. This structure is a subclass of
+** sqlite3_rtree_geometry.
+*/
+struct sqlite3_rtree_query_info {
+ void *pContext; /* pContext from when function registered */
+ int nParam; /* Number of function parameters */
+ sqlite3_rtree_dbl *aParam; /* value of function parameters */
+ void *pUser; /* callback can use this, if desired */
+ void (*xDelUser)(void*); /* function to free pUser */
+ sqlite3_rtree_dbl *aCoord; /* Coordinates of node or entry to check */
+ unsigned int *anQueue; /* Number of pending entries in the queue */
+ int nCoord; /* Number of coordinates */
+ int iLevel; /* Level of current node or entry */
+ int mxLevel; /* The largest iLevel value in the tree */
+ sqlite3_int64 iRowid; /* Rowid for current entry */
+ sqlite3_rtree_dbl rParentScore; /* Score of parent node */
+ int eParentWithin; /* Visibility of parent node */
+ int eWithin; /* OUT: Visibility */
+ sqlite3_rtree_dbl rScore; /* OUT: Write the score here */
+ /* The following fields are only available in 3.8.11 and later */
+ sqlite3_value **apSqlParam; /* Original SQL values of parameters */
+};
+
+/*
+** Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin.
+*/
+#define NOT_WITHIN 0 /* Object completely outside of query region */
+#define PARTLY_WITHIN 1 /* Object partially overlaps query region */
+#define FULLY_WITHIN 2 /* Object fully contained within query region */
+
+
+#if 0
+} /* end of the 'extern "C"' block */
+#endif
+
+#endif /* ifndef _SQLITE3RTREE_H_ */
+
+/******** End of sqlite3rtree.h *********/
+/******** Begin file sqlite3session.h *********/
+
+#if !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION)
+#define __SQLITESESSION_H_ 1
+
+/*
+** Make sure we can call this stuff from C++.
+*/
+#if 0
+extern "C" {
+#endif
+
+
+/*
+** CAPI3REF: Session Object Handle
+**
+** An instance of this object is a [session] that can be used to
+** record changes to a database.
+*/
+typedef struct sqlite3_session sqlite3_session;
+
+/*
+** CAPI3REF: Changeset Iterator Handle
+**
+** An instance of this object acts as a cursor for iterating
+** over the elements of a [changeset] or [patchset].
+*/
+typedef struct sqlite3_changeset_iter sqlite3_changeset_iter;
+
+/*
+** CAPI3REF: Create A New Session Object
+** CONSTRUCTOR: sqlite3_session
+**
+** Create a new session object attached to database handle db. If successful,
+** a pointer to the new object is written to *ppSession and SQLITE_OK is
+** returned. If an error occurs, *ppSession is set to NULL and an SQLite
+** error code (e.g. SQLITE_NOMEM) is returned.
+**
+** It is possible to create multiple session objects attached to a single
+** database handle.
+**
+** Session objects created using this function should be deleted using the
+** [sqlite3session_delete()] function before the database handle that they
+** are attached to is itself closed. If the database handle is closed before
+** the session object is deleted, then the results of calling any session
+** module function, including [sqlite3session_delete()] on the session object
+** are undefined.
+**
+** Because the session module uses the [sqlite3_preupdate_hook()] API, it
+** is not possible for an application to register a pre-update hook on a
+** database handle that has one or more session objects attached. Nor is
+** it possible to create a session object attached to a database handle for
+** which a pre-update hook is already defined. The results of attempting
+** either of these things are undefined.
+**
+** The session object will be used to create changesets for tables in
+** database zDb, where zDb is either "main", or "temp", or the name of an
+** attached database. It is not an error if database zDb is not attached
+** to the database when the session object is created.
+*/
+SQLITE_API int sqlite3session_create(
+ sqlite3 *db, /* Database handle */
+ const char *zDb, /* Name of db (e.g. "main") */
+ sqlite3_session **ppSession /* OUT: New session object */
+);
+
+/*
+** CAPI3REF: Delete A Session Object
+** DESTRUCTOR: sqlite3_session
+**
+** Delete a session object previously allocated using
+** [sqlite3session_create()]. Once a session object has been deleted, the
+** results of attempting to use pSession with any other session module
+** function are undefined.
+**
+** Session objects must be deleted before the database handle to which they
+** are attached is closed. Refer to the documentation for
+** [sqlite3session_create()] for details.
+*/
+SQLITE_API void sqlite3session_delete(sqlite3_session *pSession);
+
+/*
+** CAPI3REF: Configure a Session Object
+** METHOD: sqlite3_session
+**
+** This method is used to configure a session object after it has been
+** created. At present the only valid values for the second parameter are
+** [SQLITE_SESSION_OBJCONFIG_SIZE] and [SQLITE_SESSION_OBJCONFIG_ROWID].
+**
+*/
+SQLITE_API int sqlite3session_object_config(sqlite3_session*, int op, void *pArg);
+
+/*
+** CAPI3REF: Options for sqlite3session_object_config
+**
+** The following values may passed as the the 2nd parameter to
+** sqlite3session_object_config().
+**
+** <dt>SQLITE_SESSION_OBJCONFIG_SIZE <dd>
+** This option is used to set, clear or query the flag that enables
+** the [sqlite3session_changeset_size()] API. Because it imposes some
+** computational overhead, this API is disabled by default. Argument
+** pArg must point to a value of type (int). If the value is initially
+** 0, then the sqlite3session_changeset_size() API is disabled. If it
+** is greater than 0, then the same API is enabled. Or, if the initial
+** value is less than zero, no change is made. In all cases the (int)
+** variable is set to 1 if the sqlite3session_changeset_size() API is
+** enabled following the current call, or 0 otherwise.
+**
+** It is an error (SQLITE_MISUSE) to attempt to modify this setting after
+** the first table has been attached to the session object.
+**
+** <dt>SQLITE_SESSION_OBJCONFIG_ROWID <dd>
+** This option is used to set, clear or query the flag that enables
+** collection of data for tables with no explicit PRIMARY KEY.
+**
+** Normally, tables with no explicit PRIMARY KEY are simply ignored
+** by the sessions module. However, if this flag is set, it behaves
+** as if such tables have a column "_rowid_ INTEGER PRIMARY KEY" inserted
+** as their leftmost columns.
+**
+** It is an error (SQLITE_MISUSE) to attempt to modify this setting after
+** the first table has been attached to the session object.
+*/
+#define SQLITE_SESSION_OBJCONFIG_SIZE 1
+#define SQLITE_SESSION_OBJCONFIG_ROWID 2
+
+/*
+** CAPI3REF: Enable Or Disable A Session Object
+** METHOD: sqlite3_session
+**
+** Enable or disable the recording of changes by a session object. When
+** enabled, a session object records changes made to the database. When
+** disabled - it does not. A newly created session object is enabled.
+** Refer to the documentation for [sqlite3session_changeset()] for further
+** details regarding how enabling and disabling a session object affects
+** the eventual changesets.
+**
+** Passing zero to this function disables the session. Passing a value
+** greater than zero enables it. Passing a value less than zero is a
+** no-op, and may be used to query the current state of the session.
+**
+** The return value indicates the final state of the session object: 0 if
+** the session is disabled, or 1 if it is enabled.
+*/
+SQLITE_API int sqlite3session_enable(sqlite3_session *pSession, int bEnable);
+
+/*
+** CAPI3REF: Set Or Clear the Indirect Change Flag
+** METHOD: sqlite3_session
+**
+** Each change recorded by a session object is marked as either direct or
+** indirect. A change is marked as indirect if either:
+**
+** <ul>
+** <li> The session object "indirect" flag is set when the change is
+** made, or
+** <li> The change is made by an SQL trigger or foreign key action
+** instead of directly as a result of a users SQL statement.
+** </ul>
+**
+** If a single row is affected by more than one operation within a session,
+** then the change is considered indirect if all operations meet the criteria
+** for an indirect change above, or direct otherwise.
+**
+** This function is used to set, clear or query the session object indirect
+** flag. If the second argument passed to this function is zero, then the
+** indirect flag is cleared. If it is greater than zero, the indirect flag
+** is set. Passing a value less than zero does not modify the current value
+** of the indirect flag, and may be used to query the current state of the
+** indirect flag for the specified session object.
+**
+** The return value indicates the final state of the indirect flag: 0 if
+** it is clear, or 1 if it is set.
+*/
+SQLITE_API int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect);
+
+/*
+** CAPI3REF: Attach A Table To A Session Object
+** METHOD: sqlite3_session
+**
+** If argument zTab is not NULL, then it is the name of a table to attach
+** to the session object passed as the first argument. All subsequent changes
+** made to the table while the session object is enabled will be recorded. See
+** documentation for [sqlite3session_changeset()] for further details.
+**
+** Or, if argument zTab is NULL, then changes are recorded for all tables
+** in the database. If additional tables are added to the database (by
+** executing "CREATE TABLE" statements) after this call is made, changes for
+** the new tables are also recorded.
+**
+** Changes can only be recorded for tables that have a PRIMARY KEY explicitly
+** defined as part of their CREATE TABLE statement. It does not matter if the
+** PRIMARY KEY is an "INTEGER PRIMARY KEY" (rowid alias) or not. The PRIMARY
+** KEY may consist of a single column, or may be a composite key.
+**
+** It is not an error if the named table does not exist in the database. Nor
+** is it an error if the named table does not have a PRIMARY KEY. However,
+** no changes will be recorded in either of these scenarios.
+**
+** Changes are not recorded for individual rows that have NULL values stored
+** in one or more of their PRIMARY KEY columns.
+**
+** SQLITE_OK is returned if the call completes without error. Or, if an error
+** occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned.
+**
+** <h3>Special sqlite_stat1 Handling</h3>
+**
+** As of SQLite version 3.22.0, the "sqlite_stat1" table is an exception to
+** some of the rules above. In SQLite, the schema of sqlite_stat1 is:
+** <pre>
+** CREATE TABLE sqlite_stat1(tbl,idx,stat)
+** </pre>
+**
+** Even though sqlite_stat1 does not have a PRIMARY KEY, changes are
+** recorded for it as if the PRIMARY KEY is (tbl,idx). Additionally, changes
+** are recorded for rows for which (idx IS NULL) is true. However, for such
+** rows a zero-length blob (SQL value X'') is stored in the changeset or
+** patchset instead of a NULL value. This allows such changesets to be
+** manipulated by legacy implementations of sqlite3changeset_invert(),
+** concat() and similar.
+**
+** The sqlite3changeset_apply() function automatically converts the
+** zero-length blob back to a NULL value when updating the sqlite_stat1
+** table. However, if the application calls sqlite3changeset_new(),
+** sqlite3changeset_old() or sqlite3changeset_conflict on a changeset
+** iterator directly (including on a changeset iterator passed to a
+** conflict-handler callback) then the X'' value is returned. The application
+** must translate X'' to NULL itself if required.
+**
+** Legacy (older than 3.22.0) versions of the sessions module cannot capture
+** changes made to the sqlite_stat1 table. Legacy versions of the
+** sqlite3changeset_apply() function silently ignore any modifications to the
+** sqlite_stat1 table that are part of a changeset or patchset.
+*/
+SQLITE_API int sqlite3session_attach(
+ sqlite3_session *pSession, /* Session object */
+ const char *zTab /* Table name */
+);
+
+/*
+** CAPI3REF: Set a table filter on a Session Object.
+** METHOD: sqlite3_session
+**
+** The second argument (xFilter) is the "filter callback". For changes to rows
+** in tables that are not attached to the Session object, the filter is called
+** to determine whether changes to the table's rows should be tracked or not.
+** If xFilter returns 0, changes are not tracked. Note that once a table is
+** attached, xFilter will not be called again.
+*/
+SQLITE_API void sqlite3session_table_filter(
+ sqlite3_session *pSession, /* Session object */
+ int(*xFilter)(
+ void *pCtx, /* Copy of third arg to _filter_table() */
+ const char *zTab /* Table name */
+ ),
+ void *pCtx /* First argument passed to xFilter */
+);
+
+/*
+** CAPI3REF: Generate A Changeset From A Session Object
+** METHOD: sqlite3_session
+**
+** Obtain a changeset containing changes to the tables attached to the
+** session object passed as the first argument. If successful,
+** set *ppChangeset to point to a buffer containing the changeset
+** and *pnChangeset to the size of the changeset in bytes before returning
+** SQLITE_OK. If an error occurs, set both *ppChangeset and *pnChangeset to
+** zero and return an SQLite error code.
+**
+** A changeset consists of zero or more INSERT, UPDATE and/or DELETE changes,
+** each representing a change to a single row of an attached table. An INSERT
+** change contains the values of each field of a new database row. A DELETE
+** contains the original values of each field of a deleted database row. An
+** UPDATE change contains the original values of each field of an updated
+** database row along with the updated values for each updated non-primary-key
+** column. It is not possible for an UPDATE change to represent a change that
+** modifies the values of primary key columns. If such a change is made, it
+** is represented in a changeset as a DELETE followed by an INSERT.
+**
+** Changes are not recorded for rows that have NULL values stored in one or
+** more of their PRIMARY KEY columns. If such a row is inserted or deleted,
+** no corresponding change is present in the changesets returned by this
+** function. If an existing row with one or more NULL values stored in
+** PRIMARY KEY columns is updated so that all PRIMARY KEY columns are non-NULL,
+** only an INSERT is appears in the changeset. Similarly, if an existing row
+** with non-NULL PRIMARY KEY values is updated so that one or more of its
+** PRIMARY KEY columns are set to NULL, the resulting changeset contains a
+** DELETE change only.
+**
+** The contents of a changeset may be traversed using an iterator created
+** using the [sqlite3changeset_start()] API. A changeset may be applied to
+** a database with a compatible schema using the [sqlite3changeset_apply()]
+** API.
+**
+** Within a changeset generated by this function, all changes related to a
+** single table are grouped together. In other words, when iterating through
+** a changeset or when applying a changeset to a database, all changes related
+** to a single table are processed before moving on to the next table. Tables
+** are sorted in the same order in which they were attached (or auto-attached)
+** to the sqlite3_session object. The order in which the changes related to
+** a single table are stored is undefined.
+**
+** Following a successful call to this function, it is the responsibility of
+** the caller to eventually free the buffer that *ppChangeset points to using
+** [sqlite3_free()].
+**
+** <h3>Changeset Generation</h3>
+**
+** Once a table has been attached to a session object, the session object
+** records the primary key values of all new rows inserted into the table.
+** It also records the original primary key and other column values of any
+** deleted or updated rows. For each unique primary key value, data is only
+** recorded once - the first time a row with said primary key is inserted,
+** updated or deleted in the lifetime of the session.
+**
+** There is one exception to the previous paragraph: when a row is inserted,
+** updated or deleted, if one or more of its primary key columns contain a
+** NULL value, no record of the change is made.
+**
+** The session object therefore accumulates two types of records - those
+** that consist of primary key values only (created when the user inserts
+** a new record) and those that consist of the primary key values and the
+** original values of other table columns (created when the users deletes
+** or updates a record).
+**
+** When this function is called, the requested changeset is created using
+** both the accumulated records and the current contents of the database
+** file. Specifically:
+**
+** <ul>
+** <li> For each record generated by an insert, the database is queried
+** for a row with a matching primary key. If one is found, an INSERT
+** change is added to the changeset. If no such row is found, no change
+** is added to the changeset.
+**
+** <li> For each record generated by an update or delete, the database is
+** queried for a row with a matching primary key. If such a row is
+** found and one or more of the non-primary key fields have been
+** modified from their original values, an UPDATE change is added to
+** the changeset. Or, if no such row is found in the table, a DELETE
+** change is added to the changeset. If there is a row with a matching
+** primary key in the database, but all fields contain their original
+** values, no change is added to the changeset.
+** </ul>
+**
+** This means, amongst other things, that if a row is inserted and then later
+** deleted while a session object is active, neither the insert nor the delete
+** will be present in the changeset. Or if a row is deleted and then later a
+** row with the same primary key values inserted while a session object is
+** active, the resulting changeset will contain an UPDATE change instead of
+** a DELETE and an INSERT.
+**
+** When a session object is disabled (see the [sqlite3session_enable()] API),
+** it does not accumulate records when rows are inserted, updated or deleted.
+** This may appear to have some counter-intuitive effects if a single row
+** is written to more than once during a session. For example, if a row
+** is inserted while a session object is enabled, then later deleted while
+** the same session object is disabled, no INSERT record will appear in the
+** changeset, even though the delete took place while the session was disabled.
+** Or, if one field of a row is updated while a session is disabled, and
+** another field of the same row is updated while the session is enabled, the
+** resulting changeset will contain an UPDATE change that updates both fields.
+*/
+SQLITE_API int sqlite3session_changeset(
+ sqlite3_session *pSession, /* Session object */
+ int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */
+ void **ppChangeset /* OUT: Buffer containing changeset */
+);
+
+/*
+** CAPI3REF: Return An Upper-limit For The Size Of The Changeset
+** METHOD: sqlite3_session
+**
+** By default, this function always returns 0. For it to return
+** a useful result, the sqlite3_session object must have been configured
+** to enable this API using sqlite3session_object_config() with the
+** SQLITE_SESSION_OBJCONFIG_SIZE verb.
+**
+** When enabled, this function returns an upper limit, in bytes, for the size
+** of the changeset that might be produced if sqlite3session_changeset() were
+** called. The final changeset size might be equal to or smaller than the
+** size in bytes returned by this function.
+*/
+SQLITE_API sqlite3_int64 sqlite3session_changeset_size(sqlite3_session *pSession);
+
+/*
+** CAPI3REF: Load The Difference Between Tables Into A Session
+** METHOD: sqlite3_session
+**
+** If it is not already attached to the session object passed as the first
+** argument, this function attaches table zTbl in the same manner as the
+** [sqlite3session_attach()] function. If zTbl does not exist, or if it
+** does not have a primary key, this function is a no-op (but does not return
+** an error).
+**
+** Argument zFromDb must be the name of a database ("main", "temp" etc.)
+** attached to the same database handle as the session object that contains
+** a table compatible with the table attached to the session by this function.
+** A table is considered compatible if it:
+**
+** <ul>
+** <li> Has the same name,
+** <li> Has the same set of columns declared in the same order, and
+** <li> Has the same PRIMARY KEY definition.
+** </ul>
+**
+** If the tables are not compatible, SQLITE_SCHEMA is returned. If the tables
+** are compatible but do not have any PRIMARY KEY columns, it is not an error
+** but no changes are added to the session object. As with other session
+** APIs, tables without PRIMARY KEYs are simply ignored.
+**
+** This function adds a set of changes to the session object that could be
+** used to update the table in database zFrom (call this the "from-table")
+** so that its content is the same as the table attached to the session
+** object (call this the "to-table"). Specifically:
+**
+** <ul>
+** <li> For each row (primary key) that exists in the to-table but not in
+** the from-table, an INSERT record is added to the session object.
+**
+** <li> For each row (primary key) that exists in the to-table but not in
+** the from-table, a DELETE record is added to the session object.
+**
+** <li> For each row (primary key) that exists in both tables, but features
+** different non-PK values in each, an UPDATE record is added to the
+** session.
+** </ul>
+**
+** To clarify, if this function is called and then a changeset constructed
+** using [sqlite3session_changeset()], then after applying that changeset to
+** database zFrom the contents of the two compatible tables would be
+** identical.
+**
+** It an error if database zFrom does not exist or does not contain the
+** required compatible table.
+**
+** If the operation is successful, SQLITE_OK is returned. Otherwise, an SQLite
+** error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg
+** may be set to point to a buffer containing an English language error
+** message. It is the responsibility of the caller to free this buffer using
+** sqlite3_free().
+*/
+SQLITE_API int sqlite3session_diff(
+ sqlite3_session *pSession,
+ const char *zFromDb,
+ const char *zTbl,
+ char **pzErrMsg
+);
+
+
+/*
+** CAPI3REF: Generate A Patchset From A Session Object
+** METHOD: sqlite3_session
+**
+** The differences between a patchset and a changeset are that:
+**
+** <ul>
+** <li> DELETE records consist of the primary key fields only. The
+** original values of other fields are omitted.
+** <li> The original values of any modified fields are omitted from
+** UPDATE records.
+** </ul>
+**
+** A patchset blob may be used with up to date versions of all
+** sqlite3changeset_xxx API functions except for sqlite3changeset_invert(),
+** which returns SQLITE_CORRUPT if it is passed a patchset. Similarly,
+** attempting to use a patchset blob with old versions of the
+** sqlite3changeset_xxx APIs also provokes an SQLITE_CORRUPT error.
+**
+** Because the non-primary key "old.*" fields are omitted, no
+** SQLITE_CHANGESET_DATA conflicts can be detected or reported if a patchset
+** is passed to the sqlite3changeset_apply() API. Other conflict types work
+** in the same way as for changesets.
+**
+** Changes within a patchset are ordered in the same way as for changesets
+** generated by the sqlite3session_changeset() function (i.e. all changes for
+** a single table are grouped together, tables appear in the order in which
+** they were attached to the session object).
+*/
+SQLITE_API int sqlite3session_patchset(
+ sqlite3_session *pSession, /* Session object */
+ int *pnPatchset, /* OUT: Size of buffer at *ppPatchset */
+ void **ppPatchset /* OUT: Buffer containing patchset */
+);
+
+/*
+** CAPI3REF: Test if a changeset has recorded any changes.
+**
+** Return non-zero if no changes to attached tables have been recorded by
+** the session object passed as the first argument. Otherwise, if one or
+** more changes have been recorded, return zero.
+**
+** Even if this function returns zero, it is possible that calling
+** [sqlite3session_changeset()] on the session handle may still return a
+** changeset that contains no changes. This can happen when a row in
+** an attached table is modified and then later on the original values
+** are restored. However, if this function returns non-zero, then it is
+** guaranteed that a call to sqlite3session_changeset() will return a
+** changeset containing zero changes.
+*/
+SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession);
+
+/*
+** CAPI3REF: Query for the amount of heap memory used by a session object.
+**
+** This API returns the total amount of heap memory in bytes currently
+** used by the session object passed as the only argument.
+*/
+SQLITE_API sqlite3_int64 sqlite3session_memory_used(sqlite3_session *pSession);
+
+/*
+** CAPI3REF: Create An Iterator To Traverse A Changeset
+** CONSTRUCTOR: sqlite3_changeset_iter
+**
+** Create an iterator used to iterate through the contents of a changeset.
+** If successful, *pp is set to point to the iterator handle and SQLITE_OK
+** is returned. Otherwise, if an error occurs, *pp is set to zero and an
+** SQLite error code is returned.
+**
+** The following functions can be used to advance and query a changeset
+** iterator created by this function:
+**
+** <ul>
+** <li> [sqlite3changeset_next()]
+** <li> [sqlite3changeset_op()]
+** <li> [sqlite3changeset_new()]
+** <li> [sqlite3changeset_old()]
+** </ul>
+**
+** It is the responsibility of the caller to eventually destroy the iterator
+** by passing it to [sqlite3changeset_finalize()]. The buffer containing the
+** changeset (pChangeset) must remain valid until after the iterator is
+** destroyed.
+**
+** Assuming the changeset blob was created by one of the
+** [sqlite3session_changeset()], [sqlite3changeset_concat()] or
+** [sqlite3changeset_invert()] functions, all changes within the changeset
+** that apply to a single table are grouped together. This means that when
+** an application iterates through a changeset using an iterator created by
+** this function, all changes that relate to a single table are visited
+** consecutively. There is no chance that the iterator will visit a change
+** the applies to table X, then one for table Y, and then later on visit
+** another change for table X.
+**
+** The behavior of sqlite3changeset_start_v2() and its streaming equivalent
+** may be modified by passing a combination of
+** [SQLITE_CHANGESETSTART_INVERT | supported flags] as the 4th parameter.
+**
+** Note that the sqlite3changeset_start_v2() API is still <b>experimental</b>
+** and therefore subject to change.
+*/
+SQLITE_API int sqlite3changeset_start(
+ sqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */
+ int nChangeset, /* Size of changeset blob in bytes */
+ void *pChangeset /* Pointer to blob containing changeset */
+);
+SQLITE_API int sqlite3changeset_start_v2(
+ sqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */
+ int nChangeset, /* Size of changeset blob in bytes */
+ void *pChangeset, /* Pointer to blob containing changeset */
+ int flags /* SESSION_CHANGESETSTART_* flags */
+);
+
+/*
+** CAPI3REF: Flags for sqlite3changeset_start_v2
+**
+** The following flags may passed via the 4th parameter to
+** [sqlite3changeset_start_v2] and [sqlite3changeset_start_v2_strm]:
+**
+** <dt>SQLITE_CHANGESETAPPLY_INVERT <dd>
+** Invert the changeset while iterating through it. This is equivalent to
+** inverting a changeset using sqlite3changeset_invert() before applying it.
+** It is an error to specify this flag with a patchset.
+*/
+#define SQLITE_CHANGESETSTART_INVERT 0x0002
+
+
+/*
+** CAPI3REF: Advance A Changeset Iterator
+** METHOD: sqlite3_changeset_iter
+**
+** This function may only be used with iterators created by the function
+** [sqlite3changeset_start()]. If it is called on an iterator passed to
+** a conflict-handler callback by [sqlite3changeset_apply()], SQLITE_MISUSE
+** is returned and the call has no effect.
+**
+** Immediately after an iterator is created by sqlite3changeset_start(), it
+** does not point to any change in the changeset. Assuming the changeset
+** is not empty, the first call to this function advances the iterator to
+** point to the first change in the changeset. Each subsequent call advances
+** the iterator to point to the next change in the changeset (if any). If
+** no error occurs and the iterator points to a valid change after a call
+** to sqlite3changeset_next() has advanced it, SQLITE_ROW is returned.
+** Otherwise, if all changes in the changeset have already been visited,
+** SQLITE_DONE is returned.
+**
+** If an error occurs, an SQLite error code is returned. Possible error
+** codes include SQLITE_CORRUPT (if the changeset buffer is corrupt) or
+** SQLITE_NOMEM.
+*/
+SQLITE_API int sqlite3changeset_next(sqlite3_changeset_iter *pIter);
+
+/*
+** CAPI3REF: Obtain The Current Operation From A Changeset Iterator
+** METHOD: sqlite3_changeset_iter
+**
+** The pIter argument passed to this function may either be an iterator
+** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator
+** created by [sqlite3changeset_start()]. In the latter case, the most recent
+** call to [sqlite3changeset_next()] must have returned [SQLITE_ROW]. If this
+** is not the case, this function returns [SQLITE_MISUSE].
+**
+** Arguments pOp, pnCol and pzTab may not be NULL. Upon return, three
+** outputs are set through these pointers:
+**
+** *pOp is set to one of [SQLITE_INSERT], [SQLITE_DELETE] or [SQLITE_UPDATE],
+** depending on the type of change that the iterator currently points to;
+**
+** *pnCol is set to the number of columns in the table affected by the change; and
+**
+** *pzTab is set to point to a nul-terminated utf-8 encoded string containing
+** the name of the table affected by the current change. The buffer remains
+** valid until either sqlite3changeset_next() is called on the iterator
+** or until the conflict-handler function returns.
+**
+** If pbIndirect is not NULL, then *pbIndirect is set to true (1) if the change
+** is an indirect change, or false (0) otherwise. See the documentation for
+** [sqlite3session_indirect()] for a description of direct and indirect
+** changes.
+**
+** If no error occurs, SQLITE_OK is returned. If an error does occur, an
+** SQLite error code is returned. The values of the output variables may not
+** be trusted in this case.
+*/
+SQLITE_API int sqlite3changeset_op(
+ sqlite3_changeset_iter *pIter, /* Iterator object */
+ const char **pzTab, /* OUT: Pointer to table name */
+ int *pnCol, /* OUT: Number of columns in table */
+ int *pOp, /* OUT: SQLITE_INSERT, DELETE or UPDATE */
+ int *pbIndirect /* OUT: True for an 'indirect' change */
+);
+
+/*
+** CAPI3REF: Obtain The Primary Key Definition Of A Table
+** METHOD: sqlite3_changeset_iter
+**
+** For each modified table, a changeset includes the following:
+**
+** <ul>
+** <li> The number of columns in the table, and
+** <li> Which of those columns make up the tables PRIMARY KEY.
+** </ul>
+**
+** This function is used to find which columns comprise the PRIMARY KEY of
+** the table modified by the change that iterator pIter currently points to.
+** If successful, *pabPK is set to point to an array of nCol entries, where
+** nCol is the number of columns in the table. Elements of *pabPK are set to
+** 0x01 if the corresponding column is part of the tables primary key, or
+** 0x00 if it is not.
+**
+** If argument pnCol is not NULL, then *pnCol is set to the number of columns
+** in the table.
+**
+** If this function is called when the iterator does not point to a valid
+** entry, SQLITE_MISUSE is returned and the output variables zeroed. Otherwise,
+** SQLITE_OK is returned and the output variables populated as described
+** above.
+*/
+SQLITE_API int sqlite3changeset_pk(
+ sqlite3_changeset_iter *pIter, /* Iterator object */
+ unsigned char **pabPK, /* OUT: Array of boolean - true for PK cols */
+ int *pnCol /* OUT: Number of entries in output array */
+);
+
+/*
+** CAPI3REF: Obtain old.* Values From A Changeset Iterator
+** METHOD: sqlite3_changeset_iter
+**
+** The pIter argument passed to this function may either be an iterator
+** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator
+** created by [sqlite3changeset_start()]. In the latter case, the most recent
+** call to [sqlite3changeset_next()] must have returned SQLITE_ROW.
+** Furthermore, it may only be called if the type of change that the iterator
+** currently points to is either [SQLITE_DELETE] or [SQLITE_UPDATE]. Otherwise,
+** this function returns [SQLITE_MISUSE] and sets *ppValue to NULL.
+**
+** Argument iVal must be greater than or equal to 0, and less than the number
+** of columns in the table affected by the current change. Otherwise,
+** [SQLITE_RANGE] is returned and *ppValue is set to NULL.
+**
+** If successful, this function sets *ppValue to point to a protected
+** sqlite3_value object containing the iVal'th value from the vector of
+** original row values stored as part of the UPDATE or DELETE change and
+** returns SQLITE_OK. The name of the function comes from the fact that this
+** is similar to the "old.*" columns available to update or delete triggers.
+**
+** If some other error occurs (e.g. an OOM condition), an SQLite error code
+** is returned and *ppValue is set to NULL.
+*/
+SQLITE_API int sqlite3changeset_old(
+ sqlite3_changeset_iter *pIter, /* Changeset iterator */
+ int iVal, /* Column number */
+ sqlite3_value **ppValue /* OUT: Old value (or NULL pointer) */
+);
+
+/*
+** CAPI3REF: Obtain new.* Values From A Changeset Iterator
+** METHOD: sqlite3_changeset_iter
+**
+** The pIter argument passed to this function may either be an iterator
+** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator
+** created by [sqlite3changeset_start()]. In the latter case, the most recent
+** call to [sqlite3changeset_next()] must have returned SQLITE_ROW.
+** Furthermore, it may only be called if the type of change that the iterator
+** currently points to is either [SQLITE_UPDATE] or [SQLITE_INSERT]. Otherwise,
+** this function returns [SQLITE_MISUSE] and sets *ppValue to NULL.
+**
+** Argument iVal must be greater than or equal to 0, and less than the number
+** of columns in the table affected by the current change. Otherwise,
+** [SQLITE_RANGE] is returned and *ppValue is set to NULL.
+**
+** If successful, this function sets *ppValue to point to a protected
+** sqlite3_value object containing the iVal'th value from the vector of
+** new row values stored as part of the UPDATE or INSERT change and
+** returns SQLITE_OK. If the change is an UPDATE and does not include
+** a new value for the requested column, *ppValue is set to NULL and
+** SQLITE_OK returned. The name of the function comes from the fact that
+** this is similar to the "new.*" columns available to update or delete
+** triggers.
+**
+** If some other error occurs (e.g. an OOM condition), an SQLite error code
+** is returned and *ppValue is set to NULL.
+*/
+SQLITE_API int sqlite3changeset_new(
+ sqlite3_changeset_iter *pIter, /* Changeset iterator */
+ int iVal, /* Column number */
+ sqlite3_value **ppValue /* OUT: New value (or NULL pointer) */
+);
+
+/*
+** CAPI3REF: Obtain Conflicting Row Values From A Changeset Iterator
+** METHOD: sqlite3_changeset_iter
+**
+** This function should only be used with iterator objects passed to a
+** conflict-handler callback by [sqlite3changeset_apply()] with either
+** [SQLITE_CHANGESET_DATA] or [SQLITE_CHANGESET_CONFLICT]. If this function
+** is called on any other iterator, [SQLITE_MISUSE] is returned and *ppValue
+** is set to NULL.
+**
+** Argument iVal must be greater than or equal to 0, and less than the number
+** of columns in the table affected by the current change. Otherwise,
+** [SQLITE_RANGE] is returned and *ppValue is set to NULL.
+**
+** If successful, this function sets *ppValue to point to a protected
+** sqlite3_value object containing the iVal'th value from the
+** "conflicting row" associated with the current conflict-handler callback
+** and returns SQLITE_OK.
+**
+** If some other error occurs (e.g. an OOM condition), an SQLite error code
+** is returned and *ppValue is set to NULL.
+*/
+SQLITE_API int sqlite3changeset_conflict(
+ sqlite3_changeset_iter *pIter, /* Changeset iterator */
+ int iVal, /* Column number */
+ sqlite3_value **ppValue /* OUT: Value from conflicting row */
+);
+
+/*
+** CAPI3REF: Determine The Number Of Foreign Key Constraint Violations
+** METHOD: sqlite3_changeset_iter
+**
+** This function may only be called with an iterator passed to an
+** SQLITE_CHANGESET_FOREIGN_KEY conflict handler callback. In this case
+** it sets the output variable to the total number of known foreign key
+** violations in the destination database and returns SQLITE_OK.
+**
+** In all other cases this function returns SQLITE_MISUSE.
+*/
+SQLITE_API int sqlite3changeset_fk_conflicts(
+ sqlite3_changeset_iter *pIter, /* Changeset iterator */
+ int *pnOut /* OUT: Number of FK violations */
+);
+
+
+/*
+** CAPI3REF: Finalize A Changeset Iterator
+** METHOD: sqlite3_changeset_iter
+**
+** This function is used to finalize an iterator allocated with
+** [sqlite3changeset_start()].
+**
+** This function should only be called on iterators created using the
+** [sqlite3changeset_start()] function. If an application calls this
+** function with an iterator passed to a conflict-handler by
+** [sqlite3changeset_apply()], [SQLITE_MISUSE] is immediately returned and the
+** call has no effect.
+**
+** If an error was encountered within a call to an sqlite3changeset_xxx()
+** function (for example an [SQLITE_CORRUPT] in [sqlite3changeset_next()] or an
+** [SQLITE_NOMEM] in [sqlite3changeset_new()]) then an error code corresponding
+** to that error is returned by this function. Otherwise, SQLITE_OK is
+** returned. This is to allow the following pattern (pseudo-code):
+**
+** <pre>
+** sqlite3changeset_start();
+** while( SQLITE_ROW==sqlite3changeset_next() ){
+** // Do something with change.
+** }
+** rc = sqlite3changeset_finalize();
+** if( rc!=SQLITE_OK ){
+** // An error has occurred
+** }
+** </pre>
+*/
+SQLITE_API int sqlite3changeset_finalize(sqlite3_changeset_iter *pIter);
+
+/*
+** CAPI3REF: Invert A Changeset
+**
+** This function is used to "invert" a changeset object. Applying an inverted
+** changeset to a database reverses the effects of applying the uninverted
+** changeset. Specifically:
+**
+** <ul>
+** <li> Each DELETE change is changed to an INSERT, and
+** <li> Each INSERT change is changed to a DELETE, and
+** <li> For each UPDATE change, the old.* and new.* values are exchanged.
+** </ul>
+**
+** This function does not change the order in which changes appear within
+** the changeset. It merely reverses the sense of each individual change.
+**
+** If successful, a pointer to a buffer containing the inverted changeset
+** is stored in *ppOut, the size of the same buffer is stored in *pnOut, and
+** SQLITE_OK is returned. If an error occurs, both *pnOut and *ppOut are
+** zeroed and an SQLite error code returned.
+**
+** It is the responsibility of the caller to eventually call sqlite3_free()
+** on the *ppOut pointer to free the buffer allocation following a successful
+** call to this function.
+**
+** WARNING/TODO: This function currently assumes that the input is a valid
+** changeset. If it is not, the results are undefined.
+*/
+SQLITE_API int sqlite3changeset_invert(
+ int nIn, const void *pIn, /* Input changeset */
+ int *pnOut, void **ppOut /* OUT: Inverse of input */
+);
+
+/*
+** CAPI3REF: Concatenate Two Changeset Objects
+**
+** This function is used to concatenate two changesets, A and B, into a
+** single changeset. The result is a changeset equivalent to applying
+** changeset A followed by changeset B.
+**
+** This function combines the two input changesets using an
+** sqlite3_changegroup object. Calling it produces similar results as the
+** following code fragment:
+**
+** <pre>
+** sqlite3_changegroup *pGrp;
+** rc = sqlite3_changegroup_new(&pGrp);
+** if( rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nA, pA);
+** if( rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nB, pB);
+** if( rc==SQLITE_OK ){
+** rc = sqlite3changegroup_output(pGrp, pnOut, ppOut);
+** }else{
+** *ppOut = 0;
+** *pnOut = 0;
+** }
+** </pre>
+**
+** Refer to the sqlite3_changegroup documentation below for details.
+*/
+SQLITE_API int sqlite3changeset_concat(
+ int nA, /* Number of bytes in buffer pA */
+ void *pA, /* Pointer to buffer containing changeset A */
+ int nB, /* Number of bytes in buffer pB */
+ void *pB, /* Pointer to buffer containing changeset B */
+ int *pnOut, /* OUT: Number of bytes in output changeset */
+ void **ppOut /* OUT: Buffer containing output changeset */
+);
+
+
+/*
+** CAPI3REF: Upgrade the Schema of a Changeset/Patchset
+*/
+SQLITE_API int sqlite3changeset_upgrade(
+ sqlite3 *db,
+ const char *zDb,
+ int nIn, const void *pIn, /* Input changeset */
+ int *pnOut, void **ppOut /* OUT: Inverse of input */
+);
+
+
+
+/*
+** CAPI3REF: Changegroup Handle
+**
+** A changegroup is an object used to combine two or more
+** [changesets] or [patchsets]
+*/
+typedef struct sqlite3_changegroup sqlite3_changegroup;
+
+/*
+** CAPI3REF: Create A New Changegroup Object
+** CONSTRUCTOR: sqlite3_changegroup
+**
+** An sqlite3_changegroup object is used to combine two or more changesets
+** (or patchsets) into a single changeset (or patchset). A single changegroup
+** object may combine changesets or patchsets, but not both. The output is
+** always in the same format as the input.
+**
+** If successful, this function returns SQLITE_OK and populates (*pp) with
+** a pointer to a new sqlite3_changegroup object before returning. The caller
+** should eventually free the returned object using a call to
+** sqlite3changegroup_delete(). If an error occurs, an SQLite error code
+** (i.e. SQLITE_NOMEM) is returned and *pp is set to NULL.
+**
+** The usual usage pattern for an sqlite3_changegroup object is as follows:
+**
+** <ul>
+** <li> It is created using a call to sqlite3changegroup_new().
+**
+** <li> Zero or more changesets (or patchsets) are added to the object
+** by calling sqlite3changegroup_add().
+**
+** <li> The result of combining all input changesets together is obtained
+** by the application via a call to sqlite3changegroup_output().
+**
+** <li> The object is deleted using a call to sqlite3changegroup_delete().
+** </ul>
+**
+** Any number of calls to add() and output() may be made between the calls to
+** new() and delete(), and in any order.
+**
+** As well as the regular sqlite3changegroup_add() and
+** sqlite3changegroup_output() functions, also available are the streaming
+** versions sqlite3changegroup_add_strm() and sqlite3changegroup_output_strm().
+*/
+SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp);
+
+/*
+** CAPI3REF: Add a Schema to a Changegroup
+** METHOD: sqlite3_changegroup_schema
+**
+** This method may be used to optionally enforce the rule that the changesets
+** added to the changegroup handle must match the schema of database zDb
+** ("main", "temp", or the name of an attached database). If
+** sqlite3changegroup_add() is called to add a changeset that is not compatible
+** with the configured schema, SQLITE_SCHEMA is returned and the changegroup
+** object is left in an undefined state.
+**
+** A changeset schema is considered compatible with the database schema in
+** the same way as for sqlite3changeset_apply(). Specifically, for each
+** table in the changeset, there exists a database table with:
+**
+** <ul>
+** <li> The name identified by the changeset, and
+** <li> at least as many columns as recorded in the changeset, and
+** <li> the primary key columns in the same position as recorded in
+** the changeset.
+** </ul>
+**
+** The output of the changegroup object always has the same schema as the
+** database nominated using this function. In cases where changesets passed
+** to sqlite3changegroup_add() have fewer columns than the corresponding table
+** in the database schema, these are filled in using the default column
+** values from the database schema. This makes it possible to combined
+** changesets that have different numbers of columns for a single table
+** within a changegroup, provided that they are otherwise compatible.
+*/
+SQLITE_API int sqlite3changegroup_schema(sqlite3_changegroup*, sqlite3*, const char *zDb);
+
+/*
+** CAPI3REF: Add A Changeset To A Changegroup
+** METHOD: sqlite3_changegroup
+**
+** Add all changes within the changeset (or patchset) in buffer pData (size
+** nData bytes) to the changegroup.
+**
+** If the buffer contains a patchset, then all prior calls to this function
+** on the same changegroup object must also have specified patchsets. Or, if
+** the buffer contains a changeset, so must have the earlier calls to this
+** function. Otherwise, SQLITE_ERROR is returned and no changes are added
+** to the changegroup.
+**
+** Rows within the changeset and changegroup are identified by the values in
+** their PRIMARY KEY columns. A change in the changeset is considered to
+** apply to the same row as a change already present in the changegroup if
+** the two rows have the same primary key.
+**
+** Changes to rows that do not already appear in the changegroup are
+** simply copied into it. Or, if both the new changeset and the changegroup
+** contain changes that apply to a single row, the final contents of the
+** changegroup depends on the type of each change, as follows:
+**
+** <table border=1 style="margin-left:8ex;margin-right:8ex">
+** <tr><th style="white-space:pre">Existing Change </th>
+** <th style="white-space:pre">New Change </th>
+** <th>Output Change
+** <tr><td>INSERT <td>INSERT <td>
+** The new change is ignored. This case does not occur if the new
+** changeset was recorded immediately after the changesets already
+** added to the changegroup.
+** <tr><td>INSERT <td>UPDATE <td>
+** The INSERT change remains in the changegroup. The values in the
+** INSERT change are modified as if the row was inserted by the
+** existing change and then updated according to the new change.
+** <tr><td>INSERT <td>DELETE <td>
+** The existing INSERT is removed from the changegroup. The DELETE is
+** not added.
+** <tr><td>UPDATE <td>INSERT <td>
+** The new change is ignored. This case does not occur if the new
+** changeset was recorded immediately after the changesets already
+** added to the changegroup.
+** <tr><td>UPDATE <td>UPDATE <td>
+** The existing UPDATE remains within the changegroup. It is amended
+** so that the accompanying values are as if the row was updated once
+** by the existing change and then again by the new change.
+** <tr><td>UPDATE <td>DELETE <td>
+** The existing UPDATE is replaced by the new DELETE within the
+** changegroup.
+** <tr><td>DELETE <td>INSERT <td>
+** If one or more of the column values in the row inserted by the
+** new change differ from those in the row deleted by the existing
+** change, the existing DELETE is replaced by an UPDATE within the
+** changegroup. Otherwise, if the inserted row is exactly the same
+** as the deleted row, the existing DELETE is simply discarded.
+** <tr><td>DELETE <td>UPDATE <td>
+** The new change is ignored. This case does not occur if the new
+** changeset was recorded immediately after the changesets already
+** added to the changegroup.
+** <tr><td>DELETE <td>DELETE <td>
+** The new change is ignored. This case does not occur if the new
+** changeset was recorded immediately after the changesets already
+** added to the changegroup.
+** </table>
+**
+** If the new changeset contains changes to a table that is already present
+** in the changegroup, then the number of columns and the position of the
+** primary key columns for the table must be consistent. If this is not the
+** case, this function fails with SQLITE_SCHEMA. Except, if the changegroup
+** object has been configured with a database schema using the
+** sqlite3changegroup_schema() API, then it is possible to combine changesets
+** with different numbers of columns for a single table, provided that
+** they are otherwise compatible.
+**
+** If the input changeset appears to be corrupt and the corruption is
+** detected, SQLITE_CORRUPT is returned. Or, if an out-of-memory condition
+** occurs during processing, this function returns SQLITE_NOMEM.
+**
+** In all cases, if an error occurs the state of the final contents of the
+** changegroup is undefined. If no error occurs, SQLITE_OK is returned.
+*/
+SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData);
+
+/*
+** CAPI3REF: Add A Single Change To A Changegroup
+** METHOD: sqlite3_changegroup
+**
+** This function adds the single change currently indicated by the iterator
+** passed as the second argument to the changegroup object. The rules for
+** adding the change are just as described for [sqlite3changegroup_add()].
+**
+** If the change is successfully added to the changegroup, SQLITE_OK is
+** returned. Otherwise, an SQLite error code is returned.
+**
+** The iterator must point to a valid entry when this function is called.
+** If it does not, SQLITE_ERROR is returned and no change is added to the
+** changegroup. Additionally, the iterator must not have been opened with
+** the SQLITE_CHANGESETAPPLY_INVERT flag. In this case SQLITE_ERROR is also
+** returned.
+*/
+SQLITE_API int sqlite3changegroup_add_change(
+ sqlite3_changegroup*,
+ sqlite3_changeset_iter*
+);
+
+
+
+/*
+** CAPI3REF: Obtain A Composite Changeset From A Changegroup
+** METHOD: sqlite3_changegroup
+**
+** Obtain a buffer containing a changeset (or patchset) representing the
+** current contents of the changegroup. If the inputs to the changegroup
+** were themselves changesets, the output is a changeset. Or, if the
+** inputs were patchsets, the output is also a patchset.
+**
+** As with the output of the sqlite3session_changeset() and
+** sqlite3session_patchset() functions, all changes related to a single
+** table are grouped together in the output of this function. Tables appear
+** in the same order as for the very first changeset added to the changegroup.
+** If the second or subsequent changesets added to the changegroup contain
+** changes for tables that do not appear in the first changeset, they are
+** appended onto the end of the output changeset, again in the order in
+** which they are first encountered.
+**
+** If an error occurs, an SQLite error code is returned and the output
+** variables (*pnData) and (*ppData) are set to 0. Otherwise, SQLITE_OK
+** is returned and the output variables are set to the size of and a
+** pointer to the output buffer, respectively. In this case it is the
+** responsibility of the caller to eventually free the buffer using a
+** call to sqlite3_free().
+*/
+SQLITE_API int sqlite3changegroup_output(
+ sqlite3_changegroup*,
+ int *pnData, /* OUT: Size of output buffer in bytes */
+ void **ppData /* OUT: Pointer to output buffer */
+);
+
+/*
+** CAPI3REF: Delete A Changegroup Object
+** DESTRUCTOR: sqlite3_changegroup
+*/
+SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup*);
+
+/*
+** CAPI3REF: Apply A Changeset To A Database
+**
+** Apply a changeset or patchset to a database. These functions attempt to
+** update the "main" database attached to handle db with the changes found in
+** the changeset passed via the second and third arguments.
+**
+** The fourth argument (xFilter) passed to these functions is the "filter
+** callback". If it is not NULL, then for each table affected by at least one
+** change in the changeset, the filter callback is invoked with
+** the table name as the second argument, and a copy of the context pointer
+** passed as the sixth argument as the first. If the "filter callback"
+** returns zero, then no attempt is made to apply any changes to the table.
+** Otherwise, if the return value is non-zero or the xFilter argument to
+** is NULL, all changes related to the table are attempted.
+**
+** For each table that is not excluded by the filter callback, this function
+** tests that the target database contains a compatible table. A table is
+** considered compatible if all of the following are true:
+**
+** <ul>
+** <li> The table has the same name as the name recorded in the
+** changeset, and
+** <li> The table has at least as many columns as recorded in the
+** changeset, and
+** <li> The table has primary key columns in the same position as
+** recorded in the changeset.
+** </ul>
+**
+** If there is no compatible table, it is not an error, but none of the
+** changes associated with the table are applied. A warning message is issued
+** via the sqlite3_log() mechanism with the error code SQLITE_SCHEMA. At most
+** one such warning is issued for each table in the changeset.
+**
+** For each change for which there is a compatible table, an attempt is made
+** to modify the table contents according to the UPDATE, INSERT or DELETE
+** change. If a change cannot be applied cleanly, the conflict handler
+** function passed as the fifth argument to sqlite3changeset_apply() may be
+** invoked. A description of exactly when the conflict handler is invoked for
+** each type of change is below.
+**
+** Unlike the xFilter argument, xConflict may not be passed NULL. The results
+** of passing anything other than a valid function pointer as the xConflict
+** argument are undefined.
+**
+** Each time the conflict handler function is invoked, it must return one
+** of [SQLITE_CHANGESET_OMIT], [SQLITE_CHANGESET_ABORT] or
+** [SQLITE_CHANGESET_REPLACE]. SQLITE_CHANGESET_REPLACE may only be returned
+** if the second argument passed to the conflict handler is either
+** SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If the conflict-handler
+** returns an illegal value, any changes already made are rolled back and
+** the call to sqlite3changeset_apply() returns SQLITE_MISUSE. Different
+** actions are taken by sqlite3changeset_apply() depending on the value
+** returned by each invocation of the conflict-handler function. Refer to
+** the documentation for the three
+** [SQLITE_CHANGESET_OMIT|available return values] for details.
+**
+** <dl>
+** <dt>DELETE Changes<dd>
+** For each DELETE change, the function checks if the target database
+** contains a row with the same primary key value (or values) as the
+** original row values stored in the changeset. If it does, and the values
+** stored in all non-primary key columns also match the values stored in
+** the changeset the row is deleted from the target database.
+**
+** If a row with matching primary key values is found, but one or more of
+** the non-primary key fields contains a value different from the original
+** row value stored in the changeset, the conflict-handler function is
+** invoked with [SQLITE_CHANGESET_DATA] as the second argument. If the
+** database table has more columns than are recorded in the changeset,
+** only the values of those non-primary key fields are compared against
+** the current database contents - any trailing database table columns
+** are ignored.
+**
+** If no row with matching primary key values is found in the database,
+** the conflict-handler function is invoked with [SQLITE_CHANGESET_NOTFOUND]
+** passed as the second argument.
+**
+** If the DELETE operation is attempted, but SQLite returns SQLITE_CONSTRAINT
+** (which can only happen if a foreign key constraint is violated), the
+** conflict-handler function is invoked with [SQLITE_CHANGESET_CONSTRAINT]
+** passed as the second argument. This includes the case where the DELETE
+** operation is attempted because an earlier call to the conflict handler
+** function returned [SQLITE_CHANGESET_REPLACE].
+**
+** <dt>INSERT Changes<dd>
+** For each INSERT change, an attempt is made to insert the new row into
+** the database. If the changeset row contains fewer fields than the
+** database table, the trailing fields are populated with their default
+** values.
+**
+** If the attempt to insert the row fails because the database already
+** contains a row with the same primary key values, the conflict handler
+** function is invoked with the second argument set to
+** [SQLITE_CHANGESET_CONFLICT].
+**
+** If the attempt to insert the row fails because of some other constraint
+** violation (e.g. NOT NULL or UNIQUE), the conflict handler function is
+** invoked with the second argument set to [SQLITE_CHANGESET_CONSTRAINT].
+** This includes the case where the INSERT operation is re-attempted because
+** an earlier call to the conflict handler function returned
+** [SQLITE_CHANGESET_REPLACE].
+**
+** <dt>UPDATE Changes<dd>
+** For each UPDATE change, the function checks if the target database
+** contains a row with the same primary key value (or values) as the
+** original row values stored in the changeset. If it does, and the values
+** stored in all modified non-primary key columns also match the values
+** stored in the changeset the row is updated within the target database.
+**
+** If a row with matching primary key values is found, but one or more of
+** the modified non-primary key fields contains a value different from an
+** original row value stored in the changeset, the conflict-handler function
+** is invoked with [SQLITE_CHANGESET_DATA] as the second argument. Since
+** UPDATE changes only contain values for non-primary key fields that are
+** to be modified, only those fields need to match the original values to
+** avoid the SQLITE_CHANGESET_DATA conflict-handler callback.
+**
+** If no row with matching primary key values is found in the database,
+** the conflict-handler function is invoked with [SQLITE_CHANGESET_NOTFOUND]
+** passed as the second argument.
+**
+** If the UPDATE operation is attempted, but SQLite returns
+** SQLITE_CONSTRAINT, the conflict-handler function is invoked with
+** [SQLITE_CHANGESET_CONSTRAINT] passed as the second argument.
+** This includes the case where the UPDATE operation is attempted after
+** an earlier call to the conflict handler function returned
+** [SQLITE_CHANGESET_REPLACE].
+** </dl>
+**
+** It is safe to execute SQL statements, including those that write to the
+** table that the callback related to, from within the xConflict callback.
+** This can be used to further customize the application's conflict
+** resolution strategy.
+**
+** All changes made by these functions are enclosed in a savepoint transaction.
+** If any other error (aside from a constraint failure when attempting to
+** write to the target database) occurs, then the savepoint transaction is
+** rolled back, restoring the target database to its original state, and an
+** SQLite error code returned.
+**
+** If the output parameters (ppRebase) and (pnRebase) are non-NULL and
+** the input is a changeset (not a patchset), then sqlite3changeset_apply_v2()
+** may set (*ppRebase) to point to a "rebase" that may be used with the
+** sqlite3_rebaser APIs buffer before returning. In this case (*pnRebase)
+** is set to the size of the buffer in bytes. It is the responsibility of the
+** caller to eventually free any such buffer using sqlite3_free(). The buffer
+** is only allocated and populated if one or more conflicts were encountered
+** while applying the patchset. See comments surrounding the sqlite3_rebaser
+** APIs for further details.
+**
+** The behavior of sqlite3changeset_apply_v2() and its streaming equivalent
+** may be modified by passing a combination of
+** [SQLITE_CHANGESETAPPLY_NOSAVEPOINT | supported flags] as the 9th parameter.
+**
+** Note that the sqlite3changeset_apply_v2() API is still <b>experimental</b>
+** and therefore subject to change.
+*/
+SQLITE_API int sqlite3changeset_apply(
+ sqlite3 *db, /* Apply change to "main" db of this handle */
+ int nChangeset, /* Size of changeset in bytes */
+ void *pChangeset, /* Changeset blob */
+ int(*xFilter)(
+ void *pCtx, /* Copy of sixth arg to _apply() */
+ const char *zTab /* Table name */
+ ),
+ int(*xConflict)(
+ void *pCtx, /* Copy of sixth arg to _apply() */
+ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */
+ sqlite3_changeset_iter *p /* Handle describing change and conflict */
+ ),
+ void *pCtx /* First argument passed to xConflict */
+);
+SQLITE_API int sqlite3changeset_apply_v2(
+ sqlite3 *db, /* Apply change to "main" db of this handle */
+ int nChangeset, /* Size of changeset in bytes */
+ void *pChangeset, /* Changeset blob */
+ int(*xFilter)(
+ void *pCtx, /* Copy of sixth arg to _apply() */
+ const char *zTab /* Table name */
+ ),
+ int(*xConflict)(
+ void *pCtx, /* Copy of sixth arg to _apply() */
+ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */
+ sqlite3_changeset_iter *p /* Handle describing change and conflict */
+ ),
+ void *pCtx, /* First argument passed to xConflict */
+ void **ppRebase, int *pnRebase, /* OUT: Rebase data */
+ int flags /* SESSION_CHANGESETAPPLY_* flags */
+);
+
+/*
+** CAPI3REF: Flags for sqlite3changeset_apply_v2
+**
+** The following flags may passed via the 9th parameter to
+** [sqlite3changeset_apply_v2] and [sqlite3changeset_apply_v2_strm]:
+**
+** <dl>
+** <dt>SQLITE_CHANGESETAPPLY_NOSAVEPOINT <dd>
+** Usually, the sessions module encloses all operations performed by
+** a single call to apply_v2() or apply_v2_strm() in a [SAVEPOINT]. The
+** SAVEPOINT is committed if the changeset or patchset is successfully
+** applied, or rolled back if an error occurs. Specifying this flag
+** causes the sessions module to omit this savepoint. In this case, if the
+** caller has an open transaction or savepoint when apply_v2() is called,
+** it may revert the partially applied changeset by rolling it back.
+**
+** <dt>SQLITE_CHANGESETAPPLY_INVERT <dd>
+** Invert the changeset before applying it. This is equivalent to inverting
+** a changeset using sqlite3changeset_invert() before applying it. It is
+** an error to specify this flag with a patchset.
+**
+** <dt>SQLITE_CHANGESETAPPLY_IGNORENOOP <dd>
+** Do not invoke the conflict handler callback for any changes that
+** would not actually modify the database even if they were applied.
+** Specifically, this means that the conflict handler is not invoked
+** for:
+** <ul>
+** <li>a delete change if the row being deleted cannot be found,
+** <li>an update change if the modified fields are already set to
+** their new values in the conflicting row, or
+** <li>an insert change if all fields of the conflicting row match
+** the row being inserted.
+** </ul>
+**
+** <dt>SQLITE_CHANGESETAPPLY_FKNOACTION <dd>
+** If this flag it set, then all foreign key constraints in the target
+** database behave as if they were declared with "ON UPDATE NO ACTION ON
+** DELETE NO ACTION", even if they are actually CASCADE, RESTRICT, SET NULL
+** or SET DEFAULT.
+*/
+#define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001
+#define SQLITE_CHANGESETAPPLY_INVERT 0x0002
+#define SQLITE_CHANGESETAPPLY_IGNORENOOP 0x0004
+#define SQLITE_CHANGESETAPPLY_FKNOACTION 0x0008
+
+/*
+** CAPI3REF: Constants Passed To The Conflict Handler
+**
+** Values that may be passed as the second argument to a conflict-handler.
+**
+** <dl>
+** <dt>SQLITE_CHANGESET_DATA<dd>
+** The conflict handler is invoked with CHANGESET_DATA as the second argument
+** when processing a DELETE or UPDATE change if a row with the required
+** PRIMARY KEY fields is present in the database, but one or more other
+** (non primary-key) fields modified by the update do not contain the
+** expected "before" values.
+**
+** The conflicting row, in this case, is the database row with the matching
+** primary key.
+**
+** <dt>SQLITE_CHANGESET_NOTFOUND<dd>
+** The conflict handler is invoked with CHANGESET_NOTFOUND as the second
+** argument when processing a DELETE or UPDATE change if a row with the
+** required PRIMARY KEY fields is not present in the database.
+**
+** There is no conflicting row in this case. The results of invoking the
+** sqlite3changeset_conflict() API are undefined.
+**
+** <dt>SQLITE_CHANGESET_CONFLICT<dd>
+** CHANGESET_CONFLICT is passed as the second argument to the conflict
+** handler while processing an INSERT change if the operation would result
+** in duplicate primary key values.
+**
+** The conflicting row in this case is the database row with the matching
+** primary key.
+**
+** <dt>SQLITE_CHANGESET_FOREIGN_KEY<dd>
+** If foreign key handling is enabled, and applying a changeset leaves the
+** database in a state containing foreign key violations, the conflict
+** handler is invoked with CHANGESET_FOREIGN_KEY as the second argument
+** exactly once before the changeset is committed. If the conflict handler
+** returns CHANGESET_OMIT, the changes, including those that caused the
+** foreign key constraint violation, are committed. Or, if it returns
+** CHANGESET_ABORT, the changeset is rolled back.
+**
+** No current or conflicting row information is provided. The only function
+** it is possible to call on the supplied sqlite3_changeset_iter handle
+** is sqlite3changeset_fk_conflicts().
+**
+** <dt>SQLITE_CHANGESET_CONSTRAINT<dd>
+** If any other constraint violation occurs while applying a change (i.e.
+** a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is
+** invoked with CHANGESET_CONSTRAINT as the second argument.
+**
+** There is no conflicting row in this case. The results of invoking the
+** sqlite3changeset_conflict() API are undefined.
+**
+** </dl>
+*/
+#define SQLITE_CHANGESET_DATA 1
+#define SQLITE_CHANGESET_NOTFOUND 2
+#define SQLITE_CHANGESET_CONFLICT 3
+#define SQLITE_CHANGESET_CONSTRAINT 4
+#define SQLITE_CHANGESET_FOREIGN_KEY 5
+
+/*
+** CAPI3REF: Constants Returned By The Conflict Handler
+**
+** A conflict handler callback must return one of the following three values.
+**
+** <dl>
+** <dt>SQLITE_CHANGESET_OMIT<dd>
+** If a conflict handler returns this value no special action is taken. The
+** change that caused the conflict is not applied. The session module
+** continues to the next change in the changeset.
+**
+** <dt>SQLITE_CHANGESET_REPLACE<dd>
+** This value may only be returned if the second argument to the conflict
+** handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this
+** is not the case, any changes applied so far are rolled back and the
+** call to sqlite3changeset_apply() returns SQLITE_MISUSE.
+**
+** If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict
+** handler, then the conflicting row is either updated or deleted, depending
+** on the type of change.
+**
+** If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_CONFLICT conflict
+** handler, then the conflicting row is removed from the database and a
+** second attempt to apply the change is made. If this second attempt fails,
+** the original row is restored to the database before continuing.
+**
+** <dt>SQLITE_CHANGESET_ABORT<dd>
+** If this value is returned, any changes applied so far are rolled back
+** and the call to sqlite3changeset_apply() returns SQLITE_ABORT.
+** </dl>
+*/
+#define SQLITE_CHANGESET_OMIT 0
+#define SQLITE_CHANGESET_REPLACE 1
+#define SQLITE_CHANGESET_ABORT 2
+
+/*
+** CAPI3REF: Rebasing changesets
+** EXPERIMENTAL
+**
+** Suppose there is a site hosting a database in state S0. And that
+** modifications are made that move that database to state S1 and a
+** changeset recorded (the "local" changeset). Then, a changeset based
+** on S0 is received from another site (the "remote" changeset) and
+** applied to the database. The database is then in state
+** (S1+"remote"), where the exact state depends on any conflict
+** resolution decisions (OMIT or REPLACE) made while applying "remote".
+** Rebasing a changeset is to update it to take those conflict
+** resolution decisions into account, so that the same conflicts
+** do not have to be resolved elsewhere in the network.
+**
+** For example, if both the local and remote changesets contain an
+** INSERT of the same key on "CREATE TABLE t1(a PRIMARY KEY, b)":
+**
+** local: INSERT INTO t1 VALUES(1, 'v1');
+** remote: INSERT INTO t1 VALUES(1, 'v2');
+**
+** and the conflict resolution is REPLACE, then the INSERT change is
+** removed from the local changeset (it was overridden). Or, if the
+** conflict resolution was "OMIT", then the local changeset is modified
+** to instead contain:
+**
+** UPDATE t1 SET b = 'v2' WHERE a=1;
+**
+** Changes within the local changeset are rebased as follows:
+**
+** <dl>
+** <dt>Local INSERT<dd>
+** This may only conflict with a remote INSERT. If the conflict
+** resolution was OMIT, then add an UPDATE change to the rebased
+** changeset. Or, if the conflict resolution was REPLACE, add
+** nothing to the rebased changeset.
+**
+** <dt>Local DELETE<dd>
+** This may conflict with a remote UPDATE or DELETE. In both cases the
+** only possible resolution is OMIT. If the remote operation was a
+** DELETE, then add no change to the rebased changeset. If the remote
+** operation was an UPDATE, then the old.* fields of change are updated
+** to reflect the new.* values in the UPDATE.
+**
+** <dt>Local UPDATE<dd>
+** This may conflict with a remote UPDATE or DELETE. If it conflicts
+** with a DELETE, and the conflict resolution was OMIT, then the update
+** is changed into an INSERT. Any undefined values in the new.* record
+** from the update change are filled in using the old.* values from
+** the conflicting DELETE. Or, if the conflict resolution was REPLACE,
+** the UPDATE change is simply omitted from the rebased changeset.
+**
+** If conflict is with a remote UPDATE and the resolution is OMIT, then
+** the old.* values are rebased using the new.* values in the remote
+** change. Or, if the resolution is REPLACE, then the change is copied
+** into the rebased changeset with updates to columns also updated by
+** the conflicting remote UPDATE removed. If this means no columns would
+** be updated, the change is omitted.
+** </dl>
+**
+** A local change may be rebased against multiple remote changes
+** simultaneously. If a single key is modified by multiple remote
+** changesets, they are combined as follows before the local changeset
+** is rebased:
+**
+** <ul>
+** <li> If there has been one or more REPLACE resolutions on a
+** key, it is rebased according to a REPLACE.
+**
+** <li> If there have been no REPLACE resolutions on a key, then
+** the local changeset is rebased according to the most recent
+** of the OMIT resolutions.
+** </ul>
+**
+** Note that conflict resolutions from multiple remote changesets are
+** combined on a per-field basis, not per-row. This means that in the
+** case of multiple remote UPDATE operations, some fields of a single
+** local change may be rebased for REPLACE while others are rebased for
+** OMIT.
+**
+** In order to rebase a local changeset, the remote changeset must first
+** be applied to the local database using sqlite3changeset_apply_v2() and
+** the buffer of rebase information captured. Then:
+**
+** <ol>
+** <li> An sqlite3_rebaser object is created by calling
+** sqlite3rebaser_create().
+** <li> The new object is configured with the rebase buffer obtained from
+** sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure().
+** If the local changeset is to be rebased against multiple remote
+** changesets, then sqlite3rebaser_configure() should be called
+** multiple times, in the same order that the multiple
+** sqlite3changeset_apply_v2() calls were made.
+** <li> Each local changeset is rebased by calling sqlite3rebaser_rebase().
+** <li> The sqlite3_rebaser object is deleted by calling
+** sqlite3rebaser_delete().
+** </ol>
+*/
+typedef struct sqlite3_rebaser sqlite3_rebaser;
+
+/*
+** CAPI3REF: Create a changeset rebaser object.
+** EXPERIMENTAL
+**
+** Allocate a new changeset rebaser object. If successful, set (*ppNew) to
+** point to the new object and return SQLITE_OK. Otherwise, if an error
+** occurs, return an SQLite error code (e.g. SQLITE_NOMEM) and set (*ppNew)
+** to NULL.
+*/
+SQLITE_API int sqlite3rebaser_create(sqlite3_rebaser **ppNew);
+
+/*
+** CAPI3REF: Configure a changeset rebaser object.
+** EXPERIMENTAL
+**
+** Configure the changeset rebaser object to rebase changesets according
+** to the conflict resolutions described by buffer pRebase (size nRebase
+** bytes), which must have been obtained from a previous call to
+** sqlite3changeset_apply_v2().
+*/
+SQLITE_API int sqlite3rebaser_configure(
+ sqlite3_rebaser*,
+ int nRebase, const void *pRebase
+);
+
+/*
+** CAPI3REF: Rebase a changeset
+** EXPERIMENTAL
+**
+** Argument pIn must point to a buffer containing a changeset nIn bytes
+** in size. This function allocates and populates a buffer with a copy
+** of the changeset rebased according to the configuration of the
+** rebaser object passed as the first argument. If successful, (*ppOut)
+** is set to point to the new buffer containing the rebased changeset and
+** (*pnOut) to its size in bytes and SQLITE_OK returned. It is the
+** responsibility of the caller to eventually free the new buffer using
+** sqlite3_free(). Otherwise, if an error occurs, (*ppOut) and (*pnOut)
+** are set to zero and an SQLite error code returned.
+*/
+SQLITE_API int sqlite3rebaser_rebase(
+ sqlite3_rebaser*,
+ int nIn, const void *pIn,
+ int *pnOut, void **ppOut
+);
+
+/*
+** CAPI3REF: Delete a changeset rebaser object.
+** EXPERIMENTAL
+**
+** Delete the changeset rebaser object and all associated resources. There
+** should be one call to this function for each successful invocation
+** of sqlite3rebaser_create().
+*/
+SQLITE_API void sqlite3rebaser_delete(sqlite3_rebaser *p);
+
+/*
+** CAPI3REF: Streaming Versions of API functions.
+**
+** The six streaming API xxx_strm() functions serve similar purposes to the
+** corresponding non-streaming API functions:
+**
+** <table border=1 style="margin-left:8ex;margin-right:8ex">
+** <tr><th>Streaming function<th>Non-streaming equivalent</th>
+** <tr><td>sqlite3changeset_apply_strm<td>[sqlite3changeset_apply]
+** <tr><td>sqlite3changeset_apply_strm_v2<td>[sqlite3changeset_apply_v2]
+** <tr><td>sqlite3changeset_concat_strm<td>[sqlite3changeset_concat]
+** <tr><td>sqlite3changeset_invert_strm<td>[sqlite3changeset_invert]
+** <tr><td>sqlite3changeset_start_strm<td>[sqlite3changeset_start]
+** <tr><td>sqlite3session_changeset_strm<td>[sqlite3session_changeset]
+** <tr><td>sqlite3session_patchset_strm<td>[sqlite3session_patchset]
+** </table>
+**
+** Non-streaming functions that accept changesets (or patchsets) as input
+** require that the entire changeset be stored in a single buffer in memory.
+** Similarly, those that return a changeset or patchset do so by returning
+** a pointer to a single large buffer allocated using sqlite3_malloc().
+** Normally this is convenient. However, if an application running in a
+** low-memory environment is required to handle very large changesets, the
+** large contiguous memory allocations required can become onerous.
+**
+** In order to avoid this problem, instead of a single large buffer, input
+** is passed to a streaming API functions by way of a callback function that
+** the sessions module invokes to incrementally request input data as it is
+** required. In all cases, a pair of API function parameters such as
+**
+** <pre>
+** int nChangeset,
+** void *pChangeset,
+** </pre>
+**
+** Is replaced by:
+**
+** <pre>
+** int (*xInput)(void *pIn, void *pData, int *pnData),
+** void *pIn,
+** </pre>
+**
+** Each time the xInput callback is invoked by the sessions module, the first
+** argument passed is a copy of the supplied pIn context pointer. The second
+** argument, pData, points to a buffer (*pnData) bytes in size. Assuming no
+** error occurs the xInput method should copy up to (*pnData) bytes of data
+** into the buffer and set (*pnData) to the actual number of bytes copied
+** before returning SQLITE_OK. If the input is completely exhausted, (*pnData)
+** should be set to zero to indicate this. Or, if an error occurs, an SQLite
+** error code should be returned. In all cases, if an xInput callback returns
+** an error, all processing is abandoned and the streaming API function
+** returns a copy of the error code to the caller.
+**
+** In the case of sqlite3changeset_start_strm(), the xInput callback may be
+** invoked by the sessions module at any point during the lifetime of the
+** iterator. If such an xInput callback returns an error, the iterator enters
+** an error state, whereby all subsequent calls to iterator functions
+** immediately fail with the same error code as returned by xInput.
+**
+** Similarly, streaming API functions that return changesets (or patchsets)
+** return them in chunks by way of a callback function instead of via a
+** pointer to a single large buffer. In this case, a pair of parameters such
+** as:
+**
+** <pre>
+** int *pnChangeset,
+** void **ppChangeset,
+** </pre>
+**
+** Is replaced by:
+**
+** <pre>
+** int (*xOutput)(void *pOut, const void *pData, int nData),
+** void *pOut
+** </pre>
+**
+** The xOutput callback is invoked zero or more times to return data to
+** the application. The first parameter passed to each call is a copy of the
+** pOut pointer supplied by the application. The second parameter, pData,
+** points to a buffer nData bytes in size containing the chunk of output
+** data being returned. If the xOutput callback successfully processes the
+** supplied data, it should return SQLITE_OK to indicate success. Otherwise,
+** it should return some other SQLite error code. In this case processing
+** is immediately abandoned and the streaming API function returns a copy
+** of the xOutput error code to the application.
+**
+** The sessions module never invokes an xOutput callback with the third
+** parameter set to a value less than or equal to zero. Other than this,
+** no guarantees are made as to the size of the chunks of data returned.
+*/
+SQLITE_API int sqlite3changeset_apply_strm(
+ sqlite3 *db, /* Apply change to "main" db of this handle */
+ int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */
+ void *pIn, /* First arg for xInput */
+ int(*xFilter)(
+ void *pCtx, /* Copy of sixth arg to _apply() */
+ const char *zTab /* Table name */
+ ),
+ int(*xConflict)(
+ void *pCtx, /* Copy of sixth arg to _apply() */
+ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */
+ sqlite3_changeset_iter *p /* Handle describing change and conflict */
+ ),
+ void *pCtx /* First argument passed to xConflict */
+);
+SQLITE_API int sqlite3changeset_apply_v2_strm(
+ sqlite3 *db, /* Apply change to "main" db of this handle */
+ int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */
+ void *pIn, /* First arg for xInput */
+ int(*xFilter)(
+ void *pCtx, /* Copy of sixth arg to _apply() */
+ const char *zTab /* Table name */
+ ),
+ int(*xConflict)(
+ void *pCtx, /* Copy of sixth arg to _apply() */
+ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */
+ sqlite3_changeset_iter *p /* Handle describing change and conflict */
+ ),
+ void *pCtx, /* First argument passed to xConflict */
+ void **ppRebase, int *pnRebase,
+ int flags
+);
+SQLITE_API int sqlite3changeset_concat_strm(
+ int (*xInputA)(void *pIn, void *pData, int *pnData),
+ void *pInA,
+ int (*xInputB)(void *pIn, void *pData, int *pnData),
+ void *pInB,
+ int (*xOutput)(void *pOut, const void *pData, int nData),
+ void *pOut
+);
+SQLITE_API int sqlite3changeset_invert_strm(
+ int (*xInput)(void *pIn, void *pData, int *pnData),
+ void *pIn,
+ int (*xOutput)(void *pOut, const void *pData, int nData),
+ void *pOut
+);
+SQLITE_API int sqlite3changeset_start_strm(
+ sqlite3_changeset_iter **pp,
+ int (*xInput)(void *pIn, void *pData, int *pnData),
+ void *pIn
+);
+SQLITE_API int sqlite3changeset_start_v2_strm(
+ sqlite3_changeset_iter **pp,
+ int (*xInput)(void *pIn, void *pData, int *pnData),
+ void *pIn,
+ int flags
+);
+SQLITE_API int sqlite3session_changeset_strm(
+ sqlite3_session *pSession,
+ int (*xOutput)(void *pOut, const void *pData, int nData),
+ void *pOut
+);
+SQLITE_API int sqlite3session_patchset_strm(
+ sqlite3_session *pSession,
+ int (*xOutput)(void *pOut, const void *pData, int nData),
+ void *pOut
+);
+SQLITE_API int sqlite3changegroup_add_strm(sqlite3_changegroup*,
+ int (*xInput)(void *pIn, void *pData, int *pnData),
+ void *pIn
+);
+SQLITE_API int sqlite3changegroup_output_strm(sqlite3_changegroup*,
+ int (*xOutput)(void *pOut, const void *pData, int nData),
+ void *pOut
+);
+SQLITE_API int sqlite3rebaser_rebase_strm(
+ sqlite3_rebaser *pRebaser,
+ int (*xInput)(void *pIn, void *pData, int *pnData),
+ void *pIn,
+ int (*xOutput)(void *pOut, const void *pData, int nData),
+ void *pOut
+);
+
+/*
+** CAPI3REF: Configure global parameters
+**
+** The sqlite3session_config() interface is used to make global configuration
+** changes to the sessions module in order to tune it to the specific needs
+** of the application.
+**
+** The sqlite3session_config() interface is not threadsafe. If it is invoked
+** while any other thread is inside any other sessions method then the
+** results are undefined. Furthermore, if it is invoked after any sessions
+** related objects have been created, the results are also undefined.
+**
+** The first argument to the sqlite3session_config() function must be one
+** of the SQLITE_SESSION_CONFIG_XXX constants defined below. The
+** interpretation of the (void*) value passed as the second parameter and
+** the effect of calling this function depends on the value of the first
+** parameter.
+**
+** <dl>
+** <dt>SQLITE_SESSION_CONFIG_STRMSIZE<dd>
+** By default, the sessions module streaming interfaces attempt to input
+** and output data in approximately 1 KiB chunks. This operand may be used
+** to set and query the value of this configuration setting. The pointer
+** passed as the second argument must point to a value of type (int).
+** If this value is greater than 0, it is used as the new streaming data
+** chunk size for both input and output. Before returning, the (int) value
+** pointed to by pArg is set to the final value of the streaming interface
+** chunk size.
+** </dl>
+**
+** This function returns SQLITE_OK if successful, or an SQLite error code
+** otherwise.
+*/
+SQLITE_API int sqlite3session_config(int op, void *pArg);
+
+/*
+** CAPI3REF: Values for sqlite3session_config().
+*/
+#define SQLITE_SESSION_CONFIG_STRMSIZE 1
+
+/*
+** Make sure we can call this stuff from C++.
+*/
+#if 0
+}
+#endif
+
+#endif /* !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION) */
+
+/******** End of sqlite3session.h *********/
+/******** Begin file fts5.h *********/
+/*
+** 2014 May 31
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+******************************************************************************
+**
+** Interfaces to extend FTS5. Using the interfaces defined in this file,
+** FTS5 may be extended with:
+**
+** * custom tokenizers, and
+** * custom auxiliary functions.
+*/
+
+
+#ifndef _FTS5_H
+#define _FTS5_H
+
+
+#if 0
+extern "C" {
+#endif
+
+/*************************************************************************
+** CUSTOM AUXILIARY FUNCTIONS
+**
+** Virtual table implementations may overload SQL functions by implementing
+** the sqlite3_module.xFindFunction() method.
+*/
+
+typedef struct Fts5ExtensionApi Fts5ExtensionApi;
+typedef struct Fts5Context Fts5Context;
+typedef struct Fts5PhraseIter Fts5PhraseIter;
+
+typedef void (*fts5_extension_function)(
+ const Fts5ExtensionApi *pApi, /* API offered by current FTS version */
+ Fts5Context *pFts, /* First arg to pass to pApi functions */
+ sqlite3_context *pCtx, /* Context for returning result/error */
+ int nVal, /* Number of values in apVal[] array */
+ sqlite3_value **apVal /* Array of trailing arguments */
+);
+
+struct Fts5PhraseIter {
+ const unsigned char *a;
+ const unsigned char *b;
+};
+
+/*
+** EXTENSION API FUNCTIONS
+**
+** xUserData(pFts):
+** Return a copy of the pUserData pointer passed to the xCreateFunction()
+** API when the extension function was registered.
+**
+** xColumnTotalSize(pFts, iCol, pnToken):
+** If parameter iCol is less than zero, set output variable *pnToken
+** to the total number of tokens in the FTS5 table. Or, if iCol is
+** non-negative but less than the number of columns in the table, return
+** the total number of tokens in column iCol, considering all rows in
+** the FTS5 table.
+**
+** If parameter iCol is greater than or equal to the number of columns
+** in the table, SQLITE_RANGE is returned. Or, if an error occurs (e.g.
+** an OOM condition or IO error), an appropriate SQLite error code is
+** returned.
+**
+** xColumnCount(pFts):
+** Return the number of columns in the table.
+**
+** xColumnSize(pFts, iCol, pnToken):
+** If parameter iCol is less than zero, set output variable *pnToken
+** to the total number of tokens in the current row. Or, if iCol is
+** non-negative but less than the number of columns in the table, set
+** *pnToken to the number of tokens in column iCol of the current row.
+**
+** If parameter iCol is greater than or equal to the number of columns
+** in the table, SQLITE_RANGE is returned. Or, if an error occurs (e.g.
+** an OOM condition or IO error), an appropriate SQLite error code is
+** returned.
+**
+** This function may be quite inefficient if used with an FTS5 table
+** created with the "columnsize=0" option.
+**
+** xColumnText:
+** If parameter iCol is less than zero, or greater than or equal to the
+** number of columns in the table, SQLITE_RANGE is returned.
+**
+** Otherwise, this function attempts to retrieve the text of column iCol of
+** the current document. If successful, (*pz) is set to point to a buffer
+** containing the text in utf-8 encoding, (*pn) is set to the size in bytes
+** (not characters) of the buffer and SQLITE_OK is returned. Otherwise,
+** if an error occurs, an SQLite error code is returned and the final values
+** of (*pz) and (*pn) are undefined.
+**
+** xPhraseCount:
+** Returns the number of phrases in the current query expression.
+**
+** xPhraseSize:
+** If parameter iCol is less than zero, or greater than or equal to the
+** number of phrases in the current query, as returned by xPhraseCount,
+** 0 is returned. Otherwise, this function returns the number of tokens in
+** phrase iPhrase of the query. Phrases are numbered starting from zero.
+**
+** xInstCount:
+** Set *pnInst to the total number of occurrences of all phrases within
+** the query within the current row. Return SQLITE_OK if successful, or
+** an error code (i.e. SQLITE_NOMEM) if an error occurs.
+**
+** This API can be quite slow if used with an FTS5 table created with the
+** "detail=none" or "detail=column" option. If the FTS5 table is created
+** with either "detail=none" or "detail=column" and "content=" option
+** (i.e. if it is a contentless table), then this API always returns 0.
+**
+** xInst:
+** Query for the details of phrase match iIdx within the current row.
+** Phrase matches are numbered starting from zero, so the iIdx argument
+** should be greater than or equal to zero and smaller than the value
+** output by xInstCount(). If iIdx is less than zero or greater than
+** or equal to the value returned by xInstCount(), SQLITE_RANGE is returned.
+**
+** Otherwise, output parameter *piPhrase is set to the phrase number, *piCol
+** to the column in which it occurs and *piOff the token offset of the
+** first token of the phrase. SQLITE_OK is returned if successful, or an
+** error code (i.e. SQLITE_NOMEM) if an error occurs.
+**
+** This API can be quite slow if used with an FTS5 table created with the
+** "detail=none" or "detail=column" option.
+**
+** xRowid:
+** Returns the rowid of the current row.
+**
+** xTokenize:
+** Tokenize text using the tokenizer belonging to the FTS5 table.
+**
+** xQueryPhrase(pFts5, iPhrase, pUserData, xCallback):
+** This API function is used to query the FTS table for phrase iPhrase
+** of the current query. Specifically, a query equivalent to:
+**
+** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
+**
+** with $p set to a phrase equivalent to the phrase iPhrase of the
+** current query is executed. Any column filter that applies to
+** phrase iPhrase of the current query is included in $p. For each
+** row visited, the callback function passed as the fourth argument
+** is invoked. The context and API objects passed to the callback
+** function may be used to access the properties of each matched row.
+** Invoking Api.xUserData() returns a copy of the pointer passed as
+** the third argument to pUserData.
+**
+** If parameter iPhrase is less than zero, or greater than or equal to
+** the number of phrases in the query, as returned by xPhraseCount(),
+** this function returns SQLITE_RANGE.
+**
+** If the callback function returns any value other than SQLITE_OK, the
+** query is abandoned and the xQueryPhrase function returns immediately.
+** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK.
+** Otherwise, the error code is propagated upwards.
+**
+** If the query runs to completion without incident, SQLITE_OK is returned.
+** Or, if some error occurs before the query completes or is aborted by
+** the callback, an SQLite error code is returned.
+**
+**
+** xSetAuxdata(pFts5, pAux, xDelete)
+**
+** Save the pointer passed as the second argument as the extension function's
+** "auxiliary data". The pointer may then be retrieved by the current or any
+** future invocation of the same fts5 extension function made as part of
+** the same MATCH query using the xGetAuxdata() API.
+**
+** Each extension function is allocated a single auxiliary data slot for
+** each FTS query (MATCH expression). If the extension function is invoked
+** more than once for a single FTS query, then all invocations share a
+** single auxiliary data context.
+**
+** If there is already an auxiliary data pointer when this function is
+** invoked, then it is replaced by the new pointer. If an xDelete callback
+** was specified along with the original pointer, it is invoked at this
+** point.
+**
+** The xDelete callback, if one is specified, is also invoked on the
+** auxiliary data pointer after the FTS5 query has finished.
+**
+** If an error (e.g. an OOM condition) occurs within this function,
+** the auxiliary data is set to NULL and an error code returned. If the
+** xDelete parameter was not NULL, it is invoked on the auxiliary data
+** pointer before returning.
+**
+**
+** xGetAuxdata(pFts5, bClear)
+**
+** Returns the current auxiliary data pointer for the fts5 extension
+** function. See the xSetAuxdata() method for details.
+**
+** If the bClear argument is non-zero, then the auxiliary data is cleared
+** (set to NULL) before this function returns. In this case the xDelete,
+** if any, is not invoked.
+**
+**
+** xRowCount(pFts5, pnRow)
+**
+** This function is used to retrieve the total number of rows in the table.
+** In other words, the same value that would be returned by:
+**
+** SELECT count(*) FROM ftstable;
+**
+** xPhraseFirst()
+** This function is used, along with type Fts5PhraseIter and the xPhraseNext
+** method, to iterate through all instances of a single query phrase within
+** the current row. This is the same information as is accessible via the
+** xInstCount/xInst APIs. While the xInstCount/xInst APIs are more convenient
+** to use, this API may be faster under some circumstances. To iterate
+** through instances of phrase iPhrase, use the following code:
+**
+** Fts5PhraseIter iter;
+** int iCol, iOff;
+** for(pApi->xPhraseFirst(pFts, iPhrase, &iter, &iCol, &iOff);
+** iCol>=0;
+** pApi->xPhraseNext(pFts, &iter, &iCol, &iOff)
+** ){
+** // An instance of phrase iPhrase at offset iOff of column iCol
+** }
+**
+** The Fts5PhraseIter structure is defined above. Applications should not
+** modify this structure directly - it should only be used as shown above
+** with the xPhraseFirst() and xPhraseNext() API methods (and by
+** xPhraseFirstColumn() and xPhraseNextColumn() as illustrated below).
+**
+** This API can be quite slow if used with an FTS5 table created with the
+** "detail=none" or "detail=column" option. If the FTS5 table is created
+** with either "detail=none" or "detail=column" and "content=" option
+** (i.e. if it is a contentless table), then this API always iterates
+** through an empty set (all calls to xPhraseFirst() set iCol to -1).
+**
+** In all cases, matches are visited in (column ASC, offset ASC) order.
+** i.e. all those in column 0, sorted by offset, followed by those in
+** column 1, etc.
+**
+** xPhraseNext()
+** See xPhraseFirst above.
+**
+** xPhraseFirstColumn()
+** This function and xPhraseNextColumn() are similar to the xPhraseFirst()
+** and xPhraseNext() APIs described above. The difference is that instead
+** of iterating through all instances of a phrase in the current row, these
+** APIs are used to iterate through the set of columns in the current row
+** that contain one or more instances of a specified phrase. For example:
+**
+** Fts5PhraseIter iter;
+** int iCol;
+** for(pApi->xPhraseFirstColumn(pFts, iPhrase, &iter, &iCol);
+** iCol>=0;
+** pApi->xPhraseNextColumn(pFts, &iter, &iCol)
+** ){
+** // Column iCol contains at least one instance of phrase iPhrase
+** }
+**
+** This API can be quite slow if used with an FTS5 table created with the
+** "detail=none" option. If the FTS5 table is created with either
+** "detail=none" "content=" option (i.e. if it is a contentless table),
+** then this API always iterates through an empty set (all calls to
+** xPhraseFirstColumn() set iCol to -1).
+**
+** The information accessed using this API and its companion
+** xPhraseFirstColumn() may also be obtained using xPhraseFirst/xPhraseNext
+** (or xInst/xInstCount). The chief advantage of this API is that it is
+** significantly more efficient than those alternatives when used with
+** "detail=column" tables.
+**
+** xPhraseNextColumn()
+** See xPhraseFirstColumn above.
+**
+** xQueryToken(pFts5, iPhrase, iToken, ppToken, pnToken)
+** This is used to access token iToken of phrase iPhrase of the current
+** query. Before returning, output parameter *ppToken is set to point
+** to a buffer containing the requested token, and *pnToken to the
+** size of this buffer in bytes.
+**
+** If iPhrase or iToken are less than zero, or if iPhrase is greater than
+** or equal to the number of phrases in the query as reported by
+** xPhraseCount(), or if iToken is equal to or greater than the number of
+** tokens in the phrase, SQLITE_RANGE is returned and *ppToken and *pnToken
+ are both zeroed.
+**
+** The output text is not a copy of the query text that specified the
+** token. It is the output of the tokenizer module. For tokendata=1
+** tables, this includes any embedded 0x00 and trailing data.
+**
+** xInstToken(pFts5, iIdx, iToken, ppToken, pnToken)
+** This is used to access token iToken of phrase hit iIdx within the
+** current row. If iIdx is less than zero or greater than or equal to the
+** value returned by xInstCount(), SQLITE_RANGE is returned. Otherwise,
+** output variable (*ppToken) is set to point to a buffer containing the
+** matching document token, and (*pnToken) to the size of that buffer in
+** bytes.
+**
+** The output text is not a copy of the document text that was tokenized.
+** It is the output of the tokenizer module. For tokendata=1 tables, this
+** includes any embedded 0x00 and trailing data.
+**
+** This API may be slow in some cases if the token identified by parameters
+** iIdx and iToken matched a prefix token in the query. In most cases, the
+** first call to this API for each prefix token in the query is forced
+** to scan the portion of the full-text index that matches the prefix
+** token to collect the extra data required by this API. If the prefix
+** token matches a large number of token instances in the document set,
+** this may be a performance problem.
+**
+** If the user knows in advance that a query may use this API for a
+** prefix token, FTS5 may be configured to collect all required data as part
+** of the initial querying of the full-text index, avoiding the second scan
+** entirely. This also causes prefix queries that do not use this API to
+** run more slowly and use more memory. FTS5 may be configured in this way
+** either on a per-table basis using the [FTS5 insttoken | 'insttoken']
+** option, or on a per-query basis using the
+** [fts5_insttoken | fts5_insttoken()] user function.
+**
+** This API can be quite slow if used with an FTS5 table created with the
+** "detail=none" or "detail=column" option.
+**
+** xColumnLocale(pFts5, iIdx, pzLocale, pnLocale)
+** If parameter iCol is less than zero, or greater than or equal to the
+** number of columns in the table, SQLITE_RANGE is returned.
+**
+** Otherwise, this function attempts to retrieve the locale associated
+** with column iCol of the current row. Usually, there is no associated
+** locale, and output parameters (*pzLocale) and (*pnLocale) are set
+** to NULL and 0, respectively. However, if the fts5_locale() function
+** was used to associate a locale with the value when it was inserted
+** into the fts5 table, then (*pzLocale) is set to point to a nul-terminated
+** buffer containing the name of the locale in utf-8 encoding. (*pnLocale)
+** is set to the size in bytes of the buffer, not including the
+** nul-terminator.
+**
+** If successful, SQLITE_OK is returned. Or, if an error occurs, an
+** SQLite error code is returned. The final value of the output parameters
+** is undefined in this case.
+**
+** xTokenize_v2:
+** Tokenize text using the tokenizer belonging to the FTS5 table. This
+** API is the same as the xTokenize() API, except that it allows a tokenizer
+** locale to be specified.
+*/
+struct Fts5ExtensionApi {
+ int iVersion; /* Currently always set to 4 */
+
+ void *(*xUserData)(Fts5Context*);
+
+ int (*xColumnCount)(Fts5Context*);
+ int (*xRowCount)(Fts5Context*, sqlite3_int64 *pnRow);
+ int (*xColumnTotalSize)(Fts5Context*, int iCol, sqlite3_int64 *pnToken);
+
+ int (*xTokenize)(Fts5Context*,
+ const char *pText, int nText, /* Text to tokenize */
+ void *pCtx, /* Context passed to xToken() */
+ int (*xToken)(void*, int, const char*, int, int, int) /* Callback */
+ );
+
+ int (*xPhraseCount)(Fts5Context*);
+ int (*xPhraseSize)(Fts5Context*, int iPhrase);
+
+ int (*xInstCount)(Fts5Context*, int *pnInst);
+ int (*xInst)(Fts5Context*, int iIdx, int *piPhrase, int *piCol, int *piOff);
+
+ sqlite3_int64 (*xRowid)(Fts5Context*);
+ int (*xColumnText)(Fts5Context*, int iCol, const char **pz, int *pn);
+ int (*xColumnSize)(Fts5Context*, int iCol, int *pnToken);
+
+ int (*xQueryPhrase)(Fts5Context*, int iPhrase, void *pUserData,
+ int(*)(const Fts5ExtensionApi*,Fts5Context*,void*)
+ );
+ int (*xSetAuxdata)(Fts5Context*, void *pAux, void(*xDelete)(void*));
+ void *(*xGetAuxdata)(Fts5Context*, int bClear);
+
+ int (*xPhraseFirst)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*, int*);
+ void (*xPhraseNext)(Fts5Context*, Fts5PhraseIter*, int *piCol, int *piOff);
+
+ int (*xPhraseFirstColumn)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*);
+ void (*xPhraseNextColumn)(Fts5Context*, Fts5PhraseIter*, int *piCol);
+
+ /* Below this point are iVersion>=3 only */
+ int (*xQueryToken)(Fts5Context*,
+ int iPhrase, int iToken,
+ const char **ppToken, int *pnToken
+ );
+ int (*xInstToken)(Fts5Context*, int iIdx, int iToken, const char**, int*);
+
+ /* Below this point are iVersion>=4 only */
+ int (*xColumnLocale)(Fts5Context*, int iCol, const char **pz, int *pn);
+ int (*xTokenize_v2)(Fts5Context*,
+ const char *pText, int nText, /* Text to tokenize */
+ const char *pLocale, int nLocale, /* Locale to pass to tokenizer */
+ void *pCtx, /* Context passed to xToken() */
+ int (*xToken)(void*, int, const char*, int, int, int) /* Callback */
+ );
+};
+
+/*
+** CUSTOM AUXILIARY FUNCTIONS
+*************************************************************************/
+
+/*************************************************************************
+** CUSTOM TOKENIZERS
+**
+** Applications may also register custom tokenizer types. A tokenizer
+** is registered by providing fts5 with a populated instance of the
+** following structure. All structure methods must be defined, setting
+** any member of the fts5_tokenizer struct to NULL leads to undefined
+** behaviour. The structure methods are expected to function as follows:
+**
+** xCreate:
+** This function is used to allocate and initialize a tokenizer instance.
+** A tokenizer instance is required to actually tokenize text.
+**
+** The first argument passed to this function is a copy of the (void*)
+** pointer provided by the application when the fts5_tokenizer_v2 object
+** was registered with FTS5 (the third argument to xCreateTokenizer()).
+** The second and third arguments are an array of nul-terminated strings
+** containing the tokenizer arguments, if any, specified following the
+** tokenizer name as part of the CREATE VIRTUAL TABLE statement used
+** to create the FTS5 table.
+**
+** The final argument is an output variable. If successful, (*ppOut)
+** should be set to point to the new tokenizer handle and SQLITE_OK
+** returned. If an error occurs, some value other than SQLITE_OK should
+** be returned. In this case, fts5 assumes that the final value of *ppOut
+** is undefined.
+**
+** xDelete:
+** This function is invoked to delete a tokenizer handle previously
+** allocated using xCreate(). Fts5 guarantees that this function will
+** be invoked exactly once for each successful call to xCreate().
+**
+** xTokenize:
+** This function is expected to tokenize the nText byte string indicated
+** by argument pText. pText may or may not be nul-terminated. The first
+** argument passed to this function is a pointer to an Fts5Tokenizer object
+** returned by an earlier call to xCreate().
+**
+** The third argument indicates the reason that FTS5 is requesting
+** tokenization of the supplied text. This is always one of the following
+** four values:
+**
+** <ul><li> <b>FTS5_TOKENIZE_DOCUMENT</b> - A document is being inserted into
+** or removed from the FTS table. The tokenizer is being invoked to
+** determine the set of tokens to add to (or delete from) the
+** FTS index.
+**
+** <li> <b>FTS5_TOKENIZE_QUERY</b> - A MATCH query is being executed
+** against the FTS index. The tokenizer is being called to tokenize
+** a bareword or quoted string specified as part of the query.
+**
+** <li> <b>(FTS5_TOKENIZE_QUERY | FTS5_TOKENIZE_PREFIX)</b> - Same as
+** FTS5_TOKENIZE_QUERY, except that the bareword or quoted string is
+** followed by a "*" character, indicating that the last token
+** returned by the tokenizer will be treated as a token prefix.
+**
+** <li> <b>FTS5_TOKENIZE_AUX</b> - The tokenizer is being invoked to
+** satisfy an fts5_api.xTokenize() request made by an auxiliary
+** function. Or an fts5_api.xColumnSize() request made by the same
+** on a columnsize=0 database.
+** </ul>
+**
+** The sixth and seventh arguments passed to xTokenize() - pLocale and
+** nLocale - are a pointer to a buffer containing the locale to use for
+** tokenization (e.g. "en_US") and its size in bytes, respectively. The
+** pLocale buffer is not nul-terminated. pLocale may be passed NULL (in
+** which case nLocale is always 0) to indicate that the tokenizer should
+** use its default locale.
+**
+** For each token in the input string, the supplied callback xToken() must
+** be invoked. The first argument to it should be a copy of the pointer
+** passed as the second argument to xTokenize(). The third and fourth
+** arguments are a pointer to a buffer containing the token text, and the
+** size of the token in bytes. The 4th and 5th arguments are the byte offsets
+** of the first byte of and first byte immediately following the text from
+** which the token is derived within the input.
+**
+** The second argument passed to the xToken() callback ("tflags") should
+** normally be set to 0. The exception is if the tokenizer supports
+** synonyms. In this case see the discussion below for details.
+**
+** FTS5 assumes the xToken() callback is invoked for each token in the
+** order that they occur within the input text.
+**
+** If an xToken() callback returns any value other than SQLITE_OK, then
+** the tokenization should be abandoned and the xTokenize() method should
+** immediately return a copy of the xToken() return value. Or, if the
+** input buffer is exhausted, xTokenize() should return SQLITE_OK. Finally,
+** if an error occurs with the xTokenize() implementation itself, it
+** may abandon the tokenization and return any error code other than
+** SQLITE_OK or SQLITE_DONE.
+**
+** If the tokenizer is registered using an fts5_tokenizer_v2 object,
+** then the xTokenize() method has two additional arguments - pLocale
+** and nLocale. These specify the locale that the tokenizer should use
+** for the current request. If pLocale and nLocale are both 0, then the
+** tokenizer should use its default locale. Otherwise, pLocale points to
+** an nLocale byte buffer containing the name of the locale to use as utf-8
+** text. pLocale is not nul-terminated.
+**
+** FTS5_TOKENIZER
+**
+** There is also an fts5_tokenizer object. This is an older, deprecated,
+** version of fts5_tokenizer_v2. It is similar except that:
+**
+** <ul>
+** <li> There is no "iVersion" field, and
+** <li> The xTokenize() method does not take a locale argument.
+** </ul>
+**
+** Legacy fts5_tokenizer tokenizers must be registered using the
+** legacy xCreateTokenizer() function, instead of xCreateTokenizer_v2().
+**
+** Tokenizer implementations registered using either API may be retrieved
+** using both xFindTokenizer() and xFindTokenizer_v2().
+**
+** SYNONYM SUPPORT
+**
+** Custom tokenizers may also support synonyms. Consider a case in which a
+** user wishes to query for a phrase such as "first place". Using the
+** built-in tokenizers, the FTS5 query 'first + place' will match instances
+** of "first place" within the document set, but not alternative forms
+** such as "1st place". In some applications, it would be better to match
+** all instances of "first place" or "1st place" regardless of which form
+** the user specified in the MATCH query text.
+**
+** There are several ways to approach this in FTS5:
+**
+** <ol><li> By mapping all synonyms to a single token. In this case, using
+** the above example, this means that the tokenizer returns the
+** same token for inputs "first" and "1st". Say that token is in
+** fact "first", so that when the user inserts the document "I won
+** 1st place" entries are added to the index for tokens "i", "won",
+** "first" and "place". If the user then queries for '1st + place',
+** the tokenizer substitutes "first" for "1st" and the query works
+** as expected.
+**
+** <li> By querying the index for all synonyms of each query term
+** separately. In this case, when tokenizing query text, the
+** tokenizer may provide multiple synonyms for a single term
+** within the document. FTS5 then queries the index for each
+** synonym individually. For example, faced with the query:
+**
+** <codeblock>
+** ... MATCH 'first place'</codeblock>
+**
+** the tokenizer offers both "1st" and "first" as synonyms for the
+** first token in the MATCH query and FTS5 effectively runs a query
+** similar to:
+**
+** <codeblock>
+** ... MATCH '(first OR 1st) place'</codeblock>
+**
+** except that, for the purposes of auxiliary functions, the query
+** still appears to contain just two phrases - "(first OR 1st)"
+** being treated as a single phrase.
+**
+** <li> By adding multiple synonyms for a single term to the FTS index.
+** Using this method, when tokenizing document text, the tokenizer
+** provides multiple synonyms for each token. So that when a
+** document such as "I won first place" is tokenized, entries are
+** added to the FTS index for "i", "won", "first", "1st" and
+** "place".
+**
+** This way, even if the tokenizer does not provide synonyms
+** when tokenizing query text (it should not - to do so would be
+** inefficient), it doesn't matter if the user queries for
+** 'first + place' or '1st + place', as there are entries in the
+** FTS index corresponding to both forms of the first token.
+** </ol>
+**
+** Whether it is parsing document or query text, any call to xToken that
+** specifies a <i>tflags</i> argument with the FTS5_TOKEN_COLOCATED bit
+** is considered to supply a synonym for the previous token. For example,
+** when parsing the document "I won first place", a tokenizer that supports
+** synonyms would call xToken() 5 times, as follows:
+**
+** <codeblock>
+** xToken(pCtx, 0, "i", 1, 0, 1);
+** xToken(pCtx, 0, "won", 3, 2, 5);
+** xToken(pCtx, 0, "first", 5, 6, 11);
+** xToken(pCtx, FTS5_TOKEN_COLOCATED, "1st", 3, 6, 11);
+** xToken(pCtx, 0, "place", 5, 12, 17);
+**</codeblock>
+**
+** It is an error to specify the FTS5_TOKEN_COLOCATED flag the first time
+** xToken() is called. Multiple synonyms may be specified for a single token
+** by making multiple calls to xToken(FTS5_TOKEN_COLOCATED) in sequence.
+** There is no limit to the number of synonyms that may be provided for a
+** single token.
+**
+** In many cases, method (1) above is the best approach. It does not add
+** extra data to the FTS index or require FTS5 to query for multiple terms,
+** so it is efficient in terms of disk space and query speed. However, it
+** does not support prefix queries very well. If, as suggested above, the
+** token "first" is substituted for "1st" by the tokenizer, then the query:
+**
+** <codeblock>
+** ... MATCH '1s*'</codeblock>
+**
+** will not match documents that contain the token "1st" (as the tokenizer
+** will probably not map "1s" to any prefix of "first").
+**
+** For full prefix support, method (3) may be preferred. In this case,
+** because the index contains entries for both "first" and "1st", prefix
+** queries such as 'fi*' or '1s*' will match correctly. However, because
+** extra entries are added to the FTS index, this method uses more space
+** within the database.
+**
+** Method (2) offers a midpoint between (1) and (3). Using this method,
+** a query such as '1s*' will match documents that contain the literal
+** token "1st", but not "first" (assuming the tokenizer is not able to
+** provide synonyms for prefixes). However, a non-prefix query like '1st'
+** will match against "1st" and "first". This method does not require
+** extra disk space, as no extra entries are added to the FTS index.
+** On the other hand, it may require more CPU cycles to run MATCH queries,
+** as separate queries of the FTS index are required for each synonym.
+**
+** When using methods (2) or (3), it is important that the tokenizer only
+** provide synonyms when tokenizing document text (method (3)) or query
+** text (method (2)), not both. Doing so will not cause any errors, but is
+** inefficient.
+*/
+typedef struct Fts5Tokenizer Fts5Tokenizer;
+typedef struct fts5_tokenizer_v2 fts5_tokenizer_v2;
+struct fts5_tokenizer_v2 {
+ int iVersion; /* Currently always 2 */
+
+ int (*xCreate)(void*, const char **azArg, int nArg, Fts5Tokenizer **ppOut);
+ void (*xDelete)(Fts5Tokenizer*);
+ int (*xTokenize)(Fts5Tokenizer*,
+ void *pCtx,
+ int flags, /* Mask of FTS5_TOKENIZE_* flags */
+ const char *pText, int nText,
+ const char *pLocale, int nLocale,
+ int (*xToken)(
+ void *pCtx, /* Copy of 2nd argument to xTokenize() */
+ int tflags, /* Mask of FTS5_TOKEN_* flags */
+ const char *pToken, /* Pointer to buffer containing token */
+ int nToken, /* Size of token in bytes */
+ int iStart, /* Byte offset of token within input text */
+ int iEnd /* Byte offset of end of token within input text */
+ )
+ );
+};
+
+/*
+** New code should use the fts5_tokenizer_v2 type to define tokenizer
+** implementations. The following type is included for legacy applications
+** that still use it.
+*/
+typedef struct fts5_tokenizer fts5_tokenizer;
+struct fts5_tokenizer {
+ int (*xCreate)(void*, const char **azArg, int nArg, Fts5Tokenizer **ppOut);
+ void (*xDelete)(Fts5Tokenizer*);
+ int (*xTokenize)(Fts5Tokenizer*,
+ void *pCtx,
+ int flags, /* Mask of FTS5_TOKENIZE_* flags */
+ const char *pText, int nText,
+ int (*xToken)(
+ void *pCtx, /* Copy of 2nd argument to xTokenize() */
+ int tflags, /* Mask of FTS5_TOKEN_* flags */
+ const char *pToken, /* Pointer to buffer containing token */
+ int nToken, /* Size of token in bytes */
+ int iStart, /* Byte offset of token within input text */
+ int iEnd /* Byte offset of end of token within input text */
+ )
+ );
+};
+
+
+/* Flags that may be passed as the third argument to xTokenize() */
+#define FTS5_TOKENIZE_QUERY 0x0001
+#define FTS5_TOKENIZE_PREFIX 0x0002
+#define FTS5_TOKENIZE_DOCUMENT 0x0004
+#define FTS5_TOKENIZE_AUX 0x0008
+
+/* Flags that may be passed by the tokenizer implementation back to FTS5
+** as the third argument to the supplied xToken callback. */
+#define FTS5_TOKEN_COLOCATED 0x0001 /* Same position as prev. token */
+
+/*
+** END OF CUSTOM TOKENIZERS
+*************************************************************************/
+
+/*************************************************************************
+** FTS5 EXTENSION REGISTRATION API
+*/
+typedef struct fts5_api fts5_api;
+struct fts5_api {
+ int iVersion; /* Currently always set to 3 */
+
+ /* Create a new tokenizer */
+ int (*xCreateTokenizer)(
+ fts5_api *pApi,
+ const char *zName,
+ void *pUserData,
+ fts5_tokenizer *pTokenizer,
+ void (*xDestroy)(void*)
+ );
+
+ /* Find an existing tokenizer */
+ int (*xFindTokenizer)(
+ fts5_api *pApi,
+ const char *zName,
+ void **ppUserData,
+ fts5_tokenizer *pTokenizer
+ );
+
+ /* Create a new auxiliary function */
+ int (*xCreateFunction)(
+ fts5_api *pApi,
+ const char *zName,
+ void *pUserData,
+ fts5_extension_function xFunction,
+ void (*xDestroy)(void*)
+ );
+
+ /* APIs below this point are only available if iVersion>=3 */
+
+ /* Create a new tokenizer */
+ int (*xCreateTokenizer_v2)(
+ fts5_api *pApi,
+ const char *zName,
+ void *pUserData,
+ fts5_tokenizer_v2 *pTokenizer,
+ void (*xDestroy)(void*)
+ );
+
+ /* Find an existing tokenizer */
+ int (*xFindTokenizer_v2)(
+ fts5_api *pApi,
+ const char *zName,
+ void **ppUserData,
+ fts5_tokenizer_v2 **ppTokenizer
+ );
+};
+
+/*
+** END OF REGISTRATION API
+*************************************************************************/
+
+#if 0
+} /* end of the 'extern "C"' block */
+#endif
+
+#endif /* _FTS5_H */
+
+/******** End of fts5.h *********/
+#endif /* SQLITE3_H */
+
+/************** End of sqlite3.h *********************************************/
+/************** Continuing where we left off in sqliteInt.h ******************/
+
+/*
+** Reuse the STATIC_LRU for mutex access to sqlite3_temp_directory.
+*/
+#define SQLITE_MUTEX_STATIC_TEMPDIR SQLITE_MUTEX_STATIC_VFS1
+
+/*
+** Include the configuration header output by 'configure' if we're using the
+** autoconf-based build
+*/
+#if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H)
+#include "sqlite_cfg.h"
+#define SQLITECONFIG_H 1
+#endif
+
+/************** Include sqliteLimit.h in the middle of sqliteInt.h ***********/
+/************** Begin file sqliteLimit.h *************************************/
+/*
+** 2007 May 7
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+**
+** This file defines various limits of what SQLite can process.
+*/
+
+/*
+** The maximum length of a TEXT or BLOB in bytes. This also
+** limits the size of a row in a table or index.
+**
+** The hard limit is the ability of a 32-bit signed integer
+** to count the size: 2^31-1 or 2147483647.
+*/
+#ifndef SQLITE_MAX_LENGTH
+# define SQLITE_MAX_LENGTH 1000000000
+#endif
+#define SQLITE_MIN_LENGTH 30 /* Minimum value for the length limit */
+
+/*
+** This is the maximum number of
+**
+** * Columns in a table
+** * Columns in an index
+** * Columns in a view
+** * Terms in the SET clause of an UPDATE statement
+** * Terms in the result set of a SELECT statement
+** * Terms in the GROUP BY or ORDER BY clauses of a SELECT statement.
+** * Terms in the VALUES clause of an INSERT statement
+**
+** The hard upper limit here is 32676. Most database people will
+** tell you that in a well-normalized database, you usually should
+** not have more than a dozen or so columns in any table. And if
+** that is the case, there is no point in having more than a few
+** dozen values in any of the other situations described above.
+*/
+#ifndef SQLITE_MAX_COLUMN
+# define SQLITE_MAX_COLUMN 2000
+#endif
+
+/*
+** The maximum length of a single SQL statement in bytes.
+**
+** It used to be the case that setting this value to zero would
+** turn the limit off. That is no longer true. It is not possible
+** to turn this limit off.
+*/
+#ifndef SQLITE_MAX_SQL_LENGTH
+# define SQLITE_MAX_SQL_LENGTH 1000000000
+#endif
+
+/*
+** The maximum depth of an expression tree. This is limited to
+** some extent by SQLITE_MAX_SQL_LENGTH. But sometime you might
+** want to place more severe limits on the complexity of an
+** expression. A value of 0 means that there is no limit.
+*/
+#ifndef SQLITE_MAX_EXPR_DEPTH
+# define SQLITE_MAX_EXPR_DEPTH 1000
+#endif
+
+/*
+** The maximum number of terms in a compound SELECT statement.
+** The code generator for compound SELECT statements does one
+** level of recursion for each term. A stack overflow can result
+** if the number of terms is too large. In practice, most SQL
+** never has more than 3 or 4 terms. Use a value of 0 to disable
+** any limit on the number of terms in a compound SELECT.
+*/
+#ifndef SQLITE_MAX_COMPOUND_SELECT
+# define SQLITE_MAX_COMPOUND_SELECT 500
+#endif
+
+/*
+** The maximum number of opcodes in a VDBE program.
+** Not currently enforced.
+*/
+#ifndef SQLITE_MAX_VDBE_OP
+# define SQLITE_MAX_VDBE_OP 250000000
+#endif
+
+/*
+** The maximum number of arguments to an SQL function.
+**
+** This value has a hard upper limit of 32767 due to storage
+** constraints (it needs to fit inside a i16). We keep it
+** lower than that to prevent abuse.
+*/
+#ifndef SQLITE_MAX_FUNCTION_ARG
+# define SQLITE_MAX_FUNCTION_ARG 1000
+#endif
+
+/*
+** The suggested maximum number of in-memory pages to use for
+** the main database table and for temporary tables.
+**
+** IMPLEMENTATION-OF: R-30185-15359 The default suggested cache size is -2000,
+** which means the cache size is limited to 2048000 bytes of memory.
+** IMPLEMENTATION-OF: R-48205-43578 The default suggested cache size can be
+** altered using the SQLITE_DEFAULT_CACHE_SIZE compile-time options.
+*/
+#ifndef SQLITE_DEFAULT_CACHE_SIZE
+# define SQLITE_DEFAULT_CACHE_SIZE -2000
+#endif
+
+/*
+** The default number of frames to accumulate in the log file before
+** checkpointing the database in WAL mode.
+*/
+#ifndef SQLITE_DEFAULT_WAL_AUTOCHECKPOINT
+# define SQLITE_DEFAULT_WAL_AUTOCHECKPOINT 1000
+#endif
+
+/*
+** The maximum number of attached databases. This must be between 0
+** and 125. The upper bound of 125 is because the attached databases are
+** counted using a signed 8-bit integer which has a maximum value of 127
+** and we have to allow 2 extra counts for the "main" and "temp" databases.
+*/
+#ifndef SQLITE_MAX_ATTACHED
+# define SQLITE_MAX_ATTACHED 10
+#endif
+
+
+/*
+** The maximum value of a ?nnn wildcard that the parser will accept.
+** If the value exceeds 32767 then extra space is required for the Expr
+** structure. But otherwise, we believe that the number can be as large
+** as a signed 32-bit integer can hold.
+*/
+#ifndef SQLITE_MAX_VARIABLE_NUMBER
+# define SQLITE_MAX_VARIABLE_NUMBER 32766
+#endif
+
+/* Maximum page size. The upper bound on this value is 65536. This a limit
+** imposed by the use of 16-bit offsets within each page.
+**
+** Earlier versions of SQLite allowed the user to change this value at
+** compile time. This is no longer permitted, on the grounds that it creates
+** a library that is technically incompatible with an SQLite library
+** compiled with a different limit. If a process operating on a database
+** with a page-size of 65536 bytes crashes, then an instance of SQLite
+** compiled with the default page-size limit will not be able to rollback
+** the aborted transaction. This could lead to database corruption.
+*/
+#ifdef SQLITE_MAX_PAGE_SIZE
+# undef SQLITE_MAX_PAGE_SIZE
+#endif
+#define SQLITE_MAX_PAGE_SIZE 65536
+
+
+/*
+** The default size of a database page.
+*/
+#ifndef SQLITE_DEFAULT_PAGE_SIZE
+# define SQLITE_DEFAULT_PAGE_SIZE 4096
+#endif
+#if SQLITE_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE
+# undef SQLITE_DEFAULT_PAGE_SIZE
+# define SQLITE_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE
+#endif
+
+/*
+** Ordinarily, if no value is explicitly provided, SQLite creates databases
+** with page size SQLITE_DEFAULT_PAGE_SIZE. However, based on certain
+** device characteristics (sector-size and atomic write() support),
+** SQLite may choose a larger value. This constant is the maximum value
+** SQLite will choose on its own.
+*/
+#ifndef SQLITE_MAX_DEFAULT_PAGE_SIZE
+# define SQLITE_MAX_DEFAULT_PAGE_SIZE 8192
+#endif
+#if SQLITE_MAX_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE
+# undef SQLITE_MAX_DEFAULT_PAGE_SIZE
+# define SQLITE_MAX_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE
+#endif
+
+
+/*
+** Maximum number of pages in one database file.
+**
+** This is really just the default value for the max_page_count pragma.
+** This value can be lowered (or raised) at run-time using that the
+** max_page_count macro.
+*/
+#ifndef SQLITE_MAX_PAGE_COUNT
+# define SQLITE_MAX_PAGE_COUNT 0xfffffffe /* 4294967294 */
+#endif
+
+/*
+** Maximum length (in bytes) of the pattern in a LIKE or GLOB
+** operator.
+*/
+#ifndef SQLITE_MAX_LIKE_PATTERN_LENGTH
+# define SQLITE_MAX_LIKE_PATTERN_LENGTH 50000
+#endif
+
+/*
+** Maximum depth of recursion for triggers.
+**
+** A value of 1 means that a trigger program will not be able to itself
+** fire any triggers. A value of 0 means that no trigger programs at all
+** may be executed.
+*/
+#ifndef SQLITE_MAX_TRIGGER_DEPTH
+# define SQLITE_MAX_TRIGGER_DEPTH 1000
+#endif
+
+/************** End of sqliteLimit.h *****************************************/
+/************** Continuing where we left off in sqliteInt.h ******************/
+
+/* Disable nuisance warnings on Borland compilers */
+#if defined(__BORLANDC__)
+#pragma warn -rch /* unreachable code */
+#pragma warn -ccc /* Condition is always true or false */
+#pragma warn -aus /* Assigned value is never used */
+#pragma warn -csu /* Comparing signed and unsigned */
+#pragma warn -spa /* Suspicious pointer arithmetic */
+#endif
+
+/*
+** A few places in the code require atomic load/store of aligned
+** integer values.
+*/
+#ifndef __has_extension
+# define __has_extension(x) 0 /* compatibility with non-clang compilers */
+#endif
+#if GCC_VERSION>=4007000 || __has_extension(c_atomic)
+# define SQLITE_ATOMIC_INTRINSICS 1
+# define AtomicLoad(PTR) __atomic_load_n((PTR),__ATOMIC_RELAXED)
+# define AtomicStore(PTR,VAL) __atomic_store_n((PTR),(VAL),__ATOMIC_RELAXED)
+#else
+# define SQLITE_ATOMIC_INTRINSICS 0
+# define AtomicLoad(PTR) (*(PTR))
+# define AtomicStore(PTR,VAL) (*(PTR) = (VAL))
+#endif
+
+/*
+** Include standard header files as necessary
+*/
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
+
+/*
+** The following macros are used to cast pointers to integers and
+** integers to pointers. The way you do this varies from one compiler
+** to the next, so we have developed the following set of #if statements
+** to generate appropriate macros for a wide range of compilers.
+**
+** The correct "ANSI" way to do this is to use the intptr_t type.
+** Unfortunately, that typedef is not available on all compilers, or
+** if it is available, it requires an #include of specific headers
+** that vary from one machine to the next.
+**
+** Ticket #3860: The llvm-gcc-4.2 compiler from Apple chokes on
+** the ((void*)&((char*)0)[X]) construct. But MSVC chokes on ((void*)(X)).
+** So we have to define the macros in different ways depending on the
+** compiler.
+*/
+#if defined(HAVE_STDINT_H) /* Use this case if we have ANSI headers */
+# define SQLITE_INT_TO_PTR(X) ((void*)(intptr_t)(X))
+# define SQLITE_PTR_TO_INT(X) ((int)(intptr_t)(X))
+#elif defined(__PTRDIFF_TYPE__) /* This case should work for GCC */
+# define SQLITE_INT_TO_PTR(X) ((void*)(__PTRDIFF_TYPE__)(X))
+# define SQLITE_PTR_TO_INT(X) ((int)(__PTRDIFF_TYPE__)(X))
+#elif !defined(__GNUC__) /* Works for compilers other than LLVM */
+# define SQLITE_INT_TO_PTR(X) ((void*)&((char*)0)[X])
+# define SQLITE_PTR_TO_INT(X) ((int)(((char*)X)-(char*)0))
+#else /* Generates a warning - but it always works */
+# define SQLITE_INT_TO_PTR(X) ((void*)(X))
+# define SQLITE_PTR_TO_INT(X) ((int)(X))
+#endif
+
+/*
+** Macros to hint to the compiler that a function should or should not be
+** inlined.
+*/
+#if defined(__GNUC__)
+# define SQLITE_NOINLINE __attribute__((noinline))
+# define SQLITE_INLINE __attribute__((always_inline)) inline
+#elif defined(_MSC_VER) && _MSC_VER>=1310
+# define SQLITE_NOINLINE __declspec(noinline)
+# define SQLITE_INLINE __forceinline
+#else
+# define SQLITE_NOINLINE
+# define SQLITE_INLINE
+#endif
+#if defined(SQLITE_COVERAGE_TEST) || defined(__STRICT_ANSI__)
+# undef SQLITE_INLINE
+# define SQLITE_INLINE
+#endif
+
+/*
+** Make sure that the compiler intrinsics we desire are enabled when
+** compiling with an appropriate version of MSVC unless prevented by
+** the SQLITE_DISABLE_INTRINSIC define.
+*/
+#if !defined(SQLITE_DISABLE_INTRINSIC)
+# if defined(_MSC_VER) && _MSC_VER>=1400
+# if !defined(_WIN32_WCE)
+# include <intrin.h>
+# pragma intrinsic(_byteswap_ushort)
+# pragma intrinsic(_byteswap_ulong)
+# pragma intrinsic(_byteswap_uint64)
+# pragma intrinsic(_ReadWriteBarrier)
+# else
+# include <cmnintrin.h>
+# endif
+# endif
+#endif
+
+/*
+** Enable SQLITE_USE_SEH by default on MSVC builds. Only omit
+** SEH support if the -DSQLITE_OMIT_SEH option is given.
+*/
+#if defined(_MSC_VER) && !defined(SQLITE_OMIT_SEH)
+# define SQLITE_USE_SEH 1
+#else
+# undef SQLITE_USE_SEH
+#endif
+
+/*
+** Enable SQLITE_DIRECT_OVERFLOW_READ, unless the build explicitly
+** disables it using -DSQLITE_DIRECT_OVERFLOW_READ=0
+*/
+#if defined(SQLITE_DIRECT_OVERFLOW_READ) && SQLITE_DIRECT_OVERFLOW_READ+1==1
+ /* Disable if -DSQLITE_DIRECT_OVERFLOW_READ=0 */
+# undef SQLITE_DIRECT_OVERFLOW_READ
+#else
+ /* In all other cases, enable */
+# define SQLITE_DIRECT_OVERFLOW_READ 1
+#endif
+
+
+/*
+** The SQLITE_THREADSAFE macro must be defined as 0, 1, or 2.
+** 0 means mutexes are permanently disable and the library is never
+** threadsafe. 1 means the library is serialized which is the highest
+** level of threadsafety. 2 means the library is multithreaded - multiple
+** threads can use SQLite as long as no two threads try to use the same
+** database connection at the same time.
+**
+** Older versions of SQLite used an optional THREADSAFE macro.
+** We support that for legacy.
+**
+** To ensure that the correct value of "THREADSAFE" is reported when querying
+** for compile-time options at runtime (e.g. "PRAGMA compile_options"), this
+** logic is partially replicated in ctime.c. If it is updated here, it should
+** also be updated there.
+*/
+#if !defined(SQLITE_THREADSAFE)
+# if defined(THREADSAFE)
+# define SQLITE_THREADSAFE THREADSAFE
+# else
+# define SQLITE_THREADSAFE 1 /* IMP: R-07272-22309 */
+# endif
+#endif
+
+/*
+** Powersafe overwrite is on by default. But can be turned off using
+** the -DSQLITE_POWERSAFE_OVERWRITE=0 command-line option.
+*/
+#ifndef SQLITE_POWERSAFE_OVERWRITE
+# define SQLITE_POWERSAFE_OVERWRITE 1
+#endif
+
+/*
+** EVIDENCE-OF: R-25715-37072 Memory allocation statistics are enabled by
+** default unless SQLite is compiled with SQLITE_DEFAULT_MEMSTATUS=0 in
+** which case memory allocation statistics are disabled by default.
+*/
+#if !defined(SQLITE_DEFAULT_MEMSTATUS)
+# define SQLITE_DEFAULT_MEMSTATUS 1
+#endif
+
+/*
+** Exactly one of the following macros must be defined in order to
+** specify which memory allocation subsystem to use.
+**
+** SQLITE_SYSTEM_MALLOC // Use normal system malloc()
+** SQLITE_WIN32_MALLOC // Use Win32 native heap API
+** SQLITE_ZERO_MALLOC // Use a stub allocator that always fails
+** SQLITE_MEMDEBUG // Debugging version of system malloc()
+**
+** On Windows, if the SQLITE_WIN32_MALLOC_VALIDATE macro is defined and the
+** assert() macro is enabled, each call into the Win32 native heap subsystem
+** will cause HeapValidate to be called. If heap validation should fail, an
+** assertion will be triggered.
+**
+** If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as
+** the default.
+*/
+#if defined(SQLITE_SYSTEM_MALLOC) \
+ + defined(SQLITE_WIN32_MALLOC) \
+ + defined(SQLITE_ZERO_MALLOC) \
+ + defined(SQLITE_MEMDEBUG)>1
+# error "Two or more of the following compile-time configuration options\
+ are defined but at most one is allowed:\
+ SQLITE_SYSTEM_MALLOC, SQLITE_WIN32_MALLOC, SQLITE_MEMDEBUG,\
+ SQLITE_ZERO_MALLOC"
+#endif
+#if defined(SQLITE_SYSTEM_MALLOC) \
+ + defined(SQLITE_WIN32_MALLOC) \
+ + defined(SQLITE_ZERO_MALLOC) \
+ + defined(SQLITE_MEMDEBUG)==0
+# define SQLITE_SYSTEM_MALLOC 1
+#endif
+
+/*
+** If SQLITE_MALLOC_SOFT_LIMIT is not zero, then try to keep the
+** sizes of memory allocations below this value where possible.
+*/
+#if !defined(SQLITE_MALLOC_SOFT_LIMIT)
+# define SQLITE_MALLOC_SOFT_LIMIT 1024
+#endif
+
+/*
+** We need to define _XOPEN_SOURCE as follows in order to enable
+** recursive mutexes on most Unix systems and fchmod() on OpenBSD.
+** But _XOPEN_SOURCE define causes problems for Mac OS X, so omit
+** it.
+*/
+#if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__)
+# define _XOPEN_SOURCE 600
+#endif
+
+/*
+** NDEBUG and SQLITE_DEBUG are opposites. It should always be true that
+** defined(NDEBUG)==!defined(SQLITE_DEBUG). If this is not currently true,
+** make it true by defining or undefining NDEBUG.
+**
+** Setting NDEBUG makes the code smaller and faster by disabling the
+** assert() statements in the code. So we want the default action
+** to be for NDEBUG to be set and NDEBUG to be undefined only if SQLITE_DEBUG
+** is set. Thus NDEBUG becomes an opt-in rather than an opt-out
+** feature.
+*/
+#if !defined(NDEBUG) && !defined(SQLITE_DEBUG)
+# define NDEBUG 1
+#endif
+#if defined(NDEBUG) && defined(SQLITE_DEBUG)
+# undef NDEBUG
+#endif
+
+/*
+** Enable SQLITE_ENABLE_EXPLAIN_COMMENTS if SQLITE_DEBUG is turned on.
+*/
+#if !defined(SQLITE_ENABLE_EXPLAIN_COMMENTS) && defined(SQLITE_DEBUG)
+# define SQLITE_ENABLE_EXPLAIN_COMMENTS 1
+#endif
+
+/*
+** The testcase() macro is used to aid in coverage testing. When
+** doing coverage testing, the condition inside the argument to
+** testcase() must be evaluated both true and false in order to
+** get full branch coverage. The testcase() macro is inserted
+** to help ensure adequate test coverage in places where simple
+** condition/decision coverage is inadequate. For example, testcase()
+** can be used to make sure boundary values are tested. For
+** bitmask tests, testcase() can be used to make sure each bit
+** is significant and used at least once. On switch statements
+** where multiple cases go to the same block of code, testcase()
+** can insure that all cases are evaluated.
+*/
+#if defined(SQLITE_COVERAGE_TEST) || defined(SQLITE_DEBUG)
+# ifndef SQLITE_AMALGAMATION
+ extern unsigned int sqlite3CoverageCounter;
+# endif
+# define testcase(X) if( X ){ sqlite3CoverageCounter += (unsigned)__LINE__; }
+#else
+# define testcase(X)
+#endif
+
+/*
+** The TESTONLY macro is used to enclose variable declarations or
+** other bits of code that are needed to support the arguments
+** within testcase() and assert() macros.
+*/
+#if !defined(NDEBUG) || defined(SQLITE_COVERAGE_TEST)
+# define TESTONLY(X) X
+#else
+# define TESTONLY(X)
+#endif
+
+/*
+** Sometimes we need a small amount of code such as a variable initialization
+** to setup for a later assert() statement. We do not want this code to
+** appear when assert() is disabled. The following macro is therefore
+** used to contain that setup code. The "VVA" acronym stands for
+** "Verification, Validation, and Accreditation". In other words, the
+** code within VVA_ONLY() will only run during verification processes.
+*/
+#ifndef NDEBUG
+# define VVA_ONLY(X) X
+#else
+# define VVA_ONLY(X)
+#endif
+
+/*
+** Disable ALWAYS() and NEVER() (make them pass-throughs) for coverage
+** and mutation testing
+*/
+#if defined(SQLITE_COVERAGE_TEST) || defined(SQLITE_MUTATION_TEST)
+# define SQLITE_OMIT_AUXILIARY_SAFETY_CHECKS 1
+#endif
+
+/*
+** The ALWAYS and NEVER macros surround boolean expressions which
+** are intended to always be true or false, respectively. Such
+** expressions could be omitted from the code completely. But they
+** are included in a few cases in order to enhance the resilience
+** of SQLite to unexpected behavior - to make the code "self-healing"
+** or "ductile" rather than being "brittle" and crashing at the first
+** hint of unplanned behavior.
+**
+** In other words, ALWAYS and NEVER are added for defensive code.
+**
+** When doing coverage testing ALWAYS and NEVER are hard-coded to
+** be true and false so that the unreachable code they specify will
+** not be counted as untested code.
+*/
+#if defined(SQLITE_OMIT_AUXILIARY_SAFETY_CHECKS)
+# define ALWAYS(X) (1)
+# define NEVER(X) (0)
+#elif !defined(NDEBUG)
+# define ALWAYS(X) ((X)?1:(assert(0),0))
+# define NEVER(X) ((X)?(assert(0),1):0)
+#else
+# define ALWAYS(X) (X)
+# define NEVER(X) (X)
+#endif
+
+/*
+** Some conditionals are optimizations only. In other words, if the
+** conditionals are replaced with a constant 1 (true) or 0 (false) then
+** the correct answer is still obtained, though perhaps not as quickly.
+**
+** The following macros mark these optimizations conditionals.
+*/
+#if defined(SQLITE_MUTATION_TEST)
+# define OK_IF_ALWAYS_TRUE(X) (1)
+# define OK_IF_ALWAYS_FALSE(X) (0)
+#else
+# define OK_IF_ALWAYS_TRUE(X) (X)
+# define OK_IF_ALWAYS_FALSE(X) (X)
+#endif
+
+/*
+** Some malloc failures are only possible if SQLITE_TEST_REALLOC_STRESS is
+** defined. We need to defend against those failures when testing with
+** SQLITE_TEST_REALLOC_STRESS, but we don't want the unreachable branches
+** during a normal build. The following macro can be used to disable tests
+** that are always false except when SQLITE_TEST_REALLOC_STRESS is set.
+*/
+#if defined(SQLITE_TEST_REALLOC_STRESS)
+# define ONLY_IF_REALLOC_STRESS(X) (X)
+#elif !defined(NDEBUG)
+# define ONLY_IF_REALLOC_STRESS(X) ((X)?(assert(0),1):0)
+#else
+# define ONLY_IF_REALLOC_STRESS(X) (0)
+#endif
+
+/*
+** Declarations used for tracing the operating system interfaces.
+*/
+#if defined(SQLITE_FORCE_OS_TRACE) || defined(SQLITE_TEST) || \
+ (defined(SQLITE_DEBUG) && SQLITE_OS_WIN)
+ extern int sqlite3OSTrace;
+# define OSTRACE(X) if( sqlite3OSTrace ) sqlite3DebugPrintf X
+# define SQLITE_HAVE_OS_TRACE
+#else
+# define OSTRACE(X)
+# undef SQLITE_HAVE_OS_TRACE
+#endif
+
+/*
+** Is the sqlite3ErrName() function needed in the build? Currently,
+** it is needed by "mutex_w32.c" (when debugging), "os_win.c" (when
+** OSTRACE is enabled), and by several "test*.c" files (which are
+** compiled using SQLITE_TEST).
+*/
+#if defined(SQLITE_HAVE_OS_TRACE) || defined(SQLITE_TEST) || \
+ (defined(SQLITE_DEBUG) && SQLITE_OS_WIN)
+# define SQLITE_NEED_ERR_NAME
+#else
+# undef SQLITE_NEED_ERR_NAME
+#endif
+
+/*
+** SQLITE_ENABLE_EXPLAIN_COMMENTS is incompatible with SQLITE_OMIT_EXPLAIN
+*/
+#ifdef SQLITE_OMIT_EXPLAIN
+# undef SQLITE_ENABLE_EXPLAIN_COMMENTS
+#endif
+
+/*
+** SQLITE_OMIT_VIRTUALTABLE implies SQLITE_OMIT_ALTERTABLE
+*/
+#if defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_ALTERTABLE)
+# define SQLITE_OMIT_ALTERTABLE
+#endif
+
+#define SQLITE_DIGIT_SEPARATOR '_'
+
+/*
+** Return true (non-zero) if the input is an integer that is too large
+** to fit in 32-bits. This macro is used inside of various testcase()
+** macros to verify that we have tested SQLite for large-file support.
+*/
+#define IS_BIG_INT(X) (((X)&~(i64)0xffffffff)!=0)
+
+/*
+** The macro unlikely() is a hint that surrounds a boolean
+** expression that is usually false. Macro likely() surrounds
+** a boolean expression that is usually true. These hints could,
+** in theory, be used by the compiler to generate better code, but
+** currently they are just comments for human readers.
+*/
+#define likely(X) (X)
+#define unlikely(X) (X)
+
+/************** Include hash.h in the middle of sqliteInt.h ******************/
+/************** Begin file hash.h ********************************************/
+/*
+** 2001 September 22
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This is the header file for the generic hash-table implementation
+** used in SQLite.
+*/
+#ifndef SQLITE_HASH_H
+#define SQLITE_HASH_H
+
+/* Forward declarations of structures. */
+typedef struct Hash Hash;
+typedef struct HashElem HashElem;
+
+/* A complete hash table is an instance of the following structure.
+** The internals of this structure are intended to be opaque -- client
+** code should not attempt to access or modify the fields of this structure
+** directly. Change this structure only by using the routines below.
+** However, some of the "procedures" and "functions" for modifying and
+** accessing this structure are really macros, so we can't really make
+** this structure opaque.
+**
+** All elements of the hash table are on a single doubly-linked list.
+** Hash.first points to the head of this list.
+**
+** There are Hash.htsize buckets. Each bucket points to a spot in
+** the global doubly-linked list. The contents of the bucket are the
+** element pointed to plus the next _ht.count-1 elements in the list.
+**
+** Hash.htsize and Hash.ht may be zero. In that case lookup is done
+** by a linear search of the global list. For small tables, the
+** Hash.ht table is never allocated because if there are few elements
+** in the table, it is faster to do a linear search than to manage
+** the hash table.
+*/
+struct Hash {
+ unsigned int htsize; /* Number of buckets in the hash table */
+ unsigned int count; /* Number of entries in this table */
+ HashElem *first; /* The first element of the array */
+ struct _ht { /* the hash table */
+ unsigned int count; /* Number of entries with this hash */
+ HashElem *chain; /* Pointer to first entry with this hash */
+ } *ht;
+};
+
+/* Each element in the hash table is an instance of the following
+** structure. All elements are stored on a single doubly-linked list.
+**
+** Again, this structure is intended to be opaque, but it can't really
+** be opaque because it is used by macros.
+*/
+struct HashElem {
+ HashElem *next, *prev; /* Next and previous elements in the table */
+ void *data; /* Data associated with this element */
+ const char *pKey; /* Key associated with this element */
+};
+
+/*
+** Access routines. To delete, insert a NULL pointer.
+*/
+SQLITE_PRIVATE void sqlite3HashInit(Hash*);
+SQLITE_PRIVATE void *sqlite3HashInsert(Hash*, const char *pKey, void *pData);
+SQLITE_PRIVATE void *sqlite3HashFind(const Hash*, const char *pKey);
+SQLITE_PRIVATE void sqlite3HashClear(Hash*);
+
+/*
+** Macros for looping over all elements of a hash table. The idiom is
+** like this:
+**
+** Hash h;
+** HashElem *p;
+** ...
+** for(p=sqliteHashFirst(&h); p; p=sqliteHashNext(p)){
+** SomeStructure *pData = sqliteHashData(p);
+** // do something with pData
+** }
+*/
+#define sqliteHashFirst(H) ((H)->first)
+#define sqliteHashNext(E) ((E)->next)
+#define sqliteHashData(E) ((E)->data)
+/* #define sqliteHashKey(E) ((E)->pKey) // NOT USED */
+/* #define sqliteHashKeysize(E) ((E)->nKey) // NOT USED */
+
+/*
+** Number of entries in a hash table
+*/
+#define sqliteHashCount(H) ((H)->count)
+
+#endif /* SQLITE_HASH_H */
+
+/************** End of hash.h ************************************************/
+/************** Continuing where we left off in sqliteInt.h ******************/
+/************** Include parse.h in the middle of sqliteInt.h *****************/
+/************** Begin file parse.h *******************************************/
+#define TK_SEMI 1
+#define TK_EXPLAIN 2
+#define TK_QUERY 3
+#define TK_PLAN 4
+#define TK_BEGIN 5
+#define TK_TRANSACTION 6
+#define TK_DEFERRED 7
+#define TK_IMMEDIATE 8
+#define TK_EXCLUSIVE 9
+#define TK_COMMIT 10
+#define TK_END 11
+#define TK_ROLLBACK 12
+#define TK_SAVEPOINT 13
+#define TK_RELEASE 14
+#define TK_TO 15
+#define TK_TABLE 16
+#define TK_CREATE 17
+#define TK_IF 18
+#define TK_NOT 19
+#define TK_EXISTS 20
+#define TK_TEMP 21
+#define TK_LP 22
+#define TK_RP 23
+#define TK_AS 24
+#define TK_COMMA 25
+#define TK_WITHOUT 26
+#define TK_ABORT 27
+#define TK_ACTION 28
+#define TK_AFTER 29
+#define TK_ANALYZE 30
+#define TK_ASC 31
+#define TK_ATTACH 32
+#define TK_BEFORE 33
+#define TK_BY 34
+#define TK_CASCADE 35
+#define TK_CAST 36
+#define TK_CONFLICT 37
+#define TK_DATABASE 38
+#define TK_DESC 39
+#define TK_DETACH 40
+#define TK_EACH 41
+#define TK_FAIL 42
+#define TK_OR 43
+#define TK_AND 44
+#define TK_IS 45
+#define TK_ISNOT 46
+#define TK_MATCH 47
+#define TK_LIKE_KW 48
+#define TK_BETWEEN 49
+#define TK_IN 50
+#define TK_ISNULL 51
+#define TK_NOTNULL 52
+#define TK_NE 53
+#define TK_EQ 54
+#define TK_GT 55
+#define TK_LE 56
+#define TK_LT 57
+#define TK_GE 58
+#define TK_ESCAPE 59
+#define TK_ID 60
+#define TK_COLUMNKW 61
+#define TK_DO 62
+#define TK_FOR 63
+#define TK_IGNORE 64
+#define TK_INITIALLY 65
+#define TK_INSTEAD 66
+#define TK_NO 67
+#define TK_KEY 68
+#define TK_OF 69
+#define TK_OFFSET 70
+#define TK_PRAGMA 71
+#define TK_RAISE 72
+#define TK_RECURSIVE 73
+#define TK_REPLACE 74
+#define TK_RESTRICT 75
+#define TK_ROW 76
+#define TK_ROWS 77
+#define TK_TRIGGER 78
+#define TK_VACUUM 79
+#define TK_VIEW 80
+#define TK_VIRTUAL 81
+#define TK_WITH 82
+#define TK_NULLS 83
+#define TK_FIRST 84
+#define TK_LAST 85
+#define TK_CURRENT 86
+#define TK_FOLLOWING 87
+#define TK_PARTITION 88
+#define TK_PRECEDING 89
+#define TK_RANGE 90
+#define TK_UNBOUNDED 91
+#define TK_EXCLUDE 92
+#define TK_GROUPS 93
+#define TK_OTHERS 94
+#define TK_TIES 95
+#define TK_GENERATED 96
+#define TK_ALWAYS 97
+#define TK_MATERIALIZED 98
+#define TK_REINDEX 99
+#define TK_RENAME 100
+#define TK_CTIME_KW 101
+#define TK_ANY 102
+#define TK_BITAND 103
+#define TK_BITOR 104
+#define TK_LSHIFT 105
+#define TK_RSHIFT 106
+#define TK_PLUS 107
+#define TK_MINUS 108
+#define TK_STAR 109
+#define TK_SLASH 110
+#define TK_REM 111
+#define TK_CONCAT 112
+#define TK_PTR 113
+#define TK_COLLATE 114
+#define TK_BITNOT 115
+#define TK_ON 116
+#define TK_INDEXED 117
+#define TK_STRING 118
+#define TK_JOIN_KW 119
+#define TK_CONSTRAINT 120
+#define TK_DEFAULT 121
+#define TK_NULL 122
+#define TK_PRIMARY 123
+#define TK_UNIQUE 124
+#define TK_CHECK 125
+#define TK_REFERENCES 126
+#define TK_AUTOINCR 127
+#define TK_INSERT 128
+#define TK_DELETE 129
+#define TK_UPDATE 130
+#define TK_SET 131
+#define TK_DEFERRABLE 132
+#define TK_FOREIGN 133
+#define TK_DROP 134
+#define TK_UNION 135
+#define TK_ALL 136
+#define TK_EXCEPT 137
+#define TK_INTERSECT 138
+#define TK_SELECT 139
+#define TK_VALUES 140
+#define TK_DISTINCT 141
+#define TK_DOT 142
+#define TK_FROM 143
+#define TK_JOIN 144
+#define TK_USING 145
+#define TK_ORDER 146
+#define TK_GROUP 147
+#define TK_HAVING 148
+#define TK_LIMIT 149
+#define TK_WHERE 150
+#define TK_RETURNING 151
+#define TK_INTO 152
+#define TK_NOTHING 153
+#define TK_FLOAT 154
+#define TK_BLOB 155
+#define TK_INTEGER 156
+#define TK_VARIABLE 157
+#define TK_CASE 158
+#define TK_WHEN 159
+#define TK_THEN 160
+#define TK_ELSE 161
+#define TK_INDEX 162
+#define TK_ALTER 163
+#define TK_ADD 164
+#define TK_WINDOW 165
+#define TK_OVER 166
+#define TK_FILTER 167
+#define TK_COLUMN 168
+#define TK_AGG_FUNCTION 169
+#define TK_AGG_COLUMN 170
+#define TK_TRUEFALSE 171
+#define TK_FUNCTION 172
+#define TK_UPLUS 173
+#define TK_UMINUS 174
+#define TK_TRUTH 175
+#define TK_REGISTER 176
+#define TK_VECTOR 177
+#define TK_SELECT_COLUMN 178
+#define TK_IF_NULL_ROW 179
+#define TK_ASTERISK 180
+#define TK_SPAN 181
+#define TK_ERROR 182
+#define TK_QNUMBER 183
+#define TK_SPACE 184
+#define TK_COMMENT 185
+#define TK_ILLEGAL 186
+
+/************** End of parse.h ***********************************************/
+/************** Continuing where we left off in sqliteInt.h ******************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <stddef.h>
+#include <ctype.h>
+
+/*
+** Use a macro to replace memcpy() if compiled with SQLITE_INLINE_MEMCPY.
+** This allows better measurements of where memcpy() is used when running
+** cachegrind. But this macro version of memcpy() is very slow so it
+** should not be used in production. This is a performance measurement
+** hack only.
+*/
+#ifdef SQLITE_INLINE_MEMCPY
+# define memcpy(D,S,N) {char*xxd=(char*)(D);const char*xxs=(const char*)(S);\
+ int xxn=(N);while(xxn-->0)*(xxd++)=*(xxs++);}
+#endif
+
+/*
+** If compiling for a processor that lacks floating point support,
+** substitute integer for floating-point
+*/
+#ifdef SQLITE_OMIT_FLOATING_POINT
+# define double sqlite_int64
+# define float sqlite_int64
+# define fabs(X) ((X)<0?-(X):(X))
+# define sqlite3IsOverflow(X) 0
+# ifndef SQLITE_BIG_DBL
+# define SQLITE_BIG_DBL (((sqlite3_int64)1)<<50)
+# endif
+# define SQLITE_OMIT_DATETIME_FUNCS 1
+# define SQLITE_OMIT_TRACE 1
+# undef SQLITE_MIXED_ENDIAN_64BIT_FLOAT
+# undef SQLITE_HAVE_ISNAN
+#endif
+#ifndef SQLITE_BIG_DBL
+# define SQLITE_BIG_DBL (1e99)
+#endif
+
+/*
+** OMIT_TEMPDB is set to 1 if SQLITE_OMIT_TEMPDB is defined, or 0
+** afterward. Having this macro allows us to cause the C compiler
+** to omit code used by TEMP tables without messy #ifndef statements.
+*/
+#ifdef SQLITE_OMIT_TEMPDB
+#define OMIT_TEMPDB 1
+#else
+#define OMIT_TEMPDB 0
+#endif
+
+/*
+** The "file format" number is an integer that is incremented whenever
+** the VDBE-level file format changes. The following macros define the
+** the default file format for new databases and the maximum file format
+** that the library can read.
+*/
+#define SQLITE_MAX_FILE_FORMAT 4
+#ifndef SQLITE_DEFAULT_FILE_FORMAT
+# define SQLITE_DEFAULT_FILE_FORMAT 4
+#endif
+
+/*
+** Determine whether triggers are recursive by default. This can be
+** changed at run-time using a pragma.
+*/
+#ifndef SQLITE_DEFAULT_RECURSIVE_TRIGGERS
+# define SQLITE_DEFAULT_RECURSIVE_TRIGGERS 0
+#endif
+
+/*
+** Provide a default value for SQLITE_TEMP_STORE in case it is not specified
+** on the command-line
+*/
+#ifndef SQLITE_TEMP_STORE
+# define SQLITE_TEMP_STORE 1
+#endif
+
+/*
+** If no value has been provided for SQLITE_MAX_WORKER_THREADS, or if
+** SQLITE_TEMP_STORE is set to 3 (never use temporary files), set it
+** to zero.
+*/
+#if SQLITE_TEMP_STORE==3 || SQLITE_THREADSAFE==0
+# undef SQLITE_MAX_WORKER_THREADS
+# define SQLITE_MAX_WORKER_THREADS 0
+#endif
+#ifndef SQLITE_MAX_WORKER_THREADS
+# define SQLITE_MAX_WORKER_THREADS 8
+#endif
+#ifndef SQLITE_DEFAULT_WORKER_THREADS
+# define SQLITE_DEFAULT_WORKER_THREADS 0
+#endif
+#if SQLITE_DEFAULT_WORKER_THREADS>SQLITE_MAX_WORKER_THREADS
+# undef SQLITE_MAX_WORKER_THREADS
+# define SQLITE_MAX_WORKER_THREADS SQLITE_DEFAULT_WORKER_THREADS
+#endif
+
+/*
+** The default initial allocation for the pagecache when using separate
+** pagecaches for each database connection. A positive number is the
+** number of pages. A negative number N translations means that a buffer
+** of -1024*N bytes is allocated and used for as many pages as it will hold.
+**
+** The default value of "20" was chosen to minimize the run-time of the
+** speedtest1 test program with options: --shrink-memory --reprepare
+*/
+#ifndef SQLITE_DEFAULT_PCACHE_INITSZ
+# define SQLITE_DEFAULT_PCACHE_INITSZ 20
+#endif
+
+/*
+** Default value for the SQLITE_CONFIG_SORTERREF_SIZE option.
+*/
+#ifndef SQLITE_DEFAULT_SORTERREF_SIZE
+# define SQLITE_DEFAULT_SORTERREF_SIZE 0x7fffffff
+#endif
+
+/*
+** The compile-time options SQLITE_MMAP_READWRITE and
+** SQLITE_ENABLE_BATCH_ATOMIC_WRITE are not compatible with one another.
+** You must choose one or the other (or neither) but not both.
+*/
+#if defined(SQLITE_MMAP_READWRITE) && defined(SQLITE_ENABLE_BATCH_ATOMIC_WRITE)
+#error Cannot use both SQLITE_MMAP_READWRITE and SQLITE_ENABLE_BATCH_ATOMIC_WRITE
+#endif
+
+/*
+** GCC does not define the offsetof() macro so we'll have to do it
+** ourselves.
+*/
+#ifndef offsetof
+#define offsetof(STRUCTURE,FIELD) ((int)((char*)&((STRUCTURE*)0)->FIELD))
+#endif
+
+/*
+** Macros to compute minimum and maximum of two numbers.
+*/
+#ifndef MIN
+# define MIN(A,B) ((A)<(B)?(A):(B))
+#endif
+#ifndef MAX
+# define MAX(A,B) ((A)>(B)?(A):(B))
+#endif
+
+/*
+** Swap two objects of type TYPE.
+*/
+#define SWAP(TYPE,A,B) {TYPE t=A; A=B; B=t;}
+
+/*
+** Check to see if this machine uses EBCDIC. (Yes, believe it or
+** not, there are still machines out there that use EBCDIC.)
+*/
+#if 'A' == '\301'
+# define SQLITE_EBCDIC 1
+#else
+# define SQLITE_ASCII 1
+#endif
+
+/*
+** Integers of known sizes. These typedefs might change for architectures
+** where the sizes very. Preprocessor macros are available so that the
+** types can be conveniently redefined at compile-type. Like this:
+**
+** cc '-DUINTPTR_TYPE=long long int' ...
+*/
+#ifndef UINT32_TYPE
+# ifdef HAVE_UINT32_T
+# define UINT32_TYPE uint32_t
+# else
+# define UINT32_TYPE unsigned int
+# endif
+#endif
+#ifndef UINT16_TYPE
+# ifdef HAVE_UINT16_T
+# define UINT16_TYPE uint16_t
+# else
+# define UINT16_TYPE unsigned short int
+# endif
+#endif
+#ifndef INT16_TYPE
+# ifdef HAVE_INT16_T
+# define INT16_TYPE int16_t
+# else
+# define INT16_TYPE short int
+# endif
+#endif
+#ifndef UINT8_TYPE
+# ifdef HAVE_UINT8_T
+# define UINT8_TYPE uint8_t
+# else
+# define UINT8_TYPE unsigned char
+# endif
+#endif
+#ifndef INT8_TYPE
+# ifdef HAVE_INT8_T
+# define INT8_TYPE int8_t
+# else
+# define INT8_TYPE signed char
+# endif
+#endif
+typedef sqlite_int64 i64; /* 8-byte signed integer */
+typedef sqlite_uint64 u64; /* 8-byte unsigned integer */
+typedef UINT32_TYPE u32; /* 4-byte unsigned integer */
+typedef UINT16_TYPE u16; /* 2-byte unsigned integer */
+typedef INT16_TYPE i16; /* 2-byte signed integer */
+typedef UINT8_TYPE u8; /* 1-byte unsigned integer */
+typedef INT8_TYPE i8; /* 1-byte signed integer */
+
+/*
+** SQLITE_MAX_U32 is a u64 constant that is the maximum u64 value
+** that can be stored in a u32 without loss of data. The value
+** is 0x00000000ffffffff. But because of quirks of some compilers, we
+** have to specify the value in the less intuitive manner shown:
+*/
+#define SQLITE_MAX_U32 ((((u64)1)<<32)-1)
+
+/*
+** The datatype used to store estimates of the number of rows in a
+** table or index.
+*/
+typedef u64 tRowcnt;
+
+/*
+** Estimated quantities used for query planning are stored as 16-bit
+** logarithms. For quantity X, the value stored is 10*log2(X). This
+** gives a possible range of values of approximately 1.0e986 to 1e-986.
+** But the allowed values are "grainy". Not every value is representable.
+** For example, quantities 16 and 17 are both represented by a LogEst
+** of 40. However, since LogEst quantities are suppose to be estimates,
+** not exact values, this imprecision is not a problem.
+**
+** "LogEst" is short for "Logarithmic Estimate".
+**
+** Examples:
+** 1 -> 0 20 -> 43 10000 -> 132
+** 2 -> 10 25 -> 46 25000 -> 146
+** 3 -> 16 100 -> 66 1000000 -> 199
+** 4 -> 20 1000 -> 99 1048576 -> 200
+** 10 -> 33 1024 -> 100 4294967296 -> 320
+**
+** The LogEst can be negative to indicate fractional values.
+** Examples:
+**
+** 0.5 -> -10 0.1 -> -33 0.0625 -> -40
+*/
+typedef INT16_TYPE LogEst;
+#define LOGEST_MIN (-32768)
+#define LOGEST_MAX (32767)
+
+/*
+** Set the SQLITE_PTRSIZE macro to the number of bytes in a pointer
+*/
+#ifndef SQLITE_PTRSIZE
+# if defined(__SIZEOF_POINTER__)
+# define SQLITE_PTRSIZE __SIZEOF_POINTER__
+# elif defined(i386) || defined(__i386__) || defined(_M_IX86) || \
+ defined(_M_ARM) || defined(__arm__) || defined(__x86) || \
+ (defined(__APPLE__) && defined(__ppc__)) || \
+ (defined(__TOS_AIX__) && !defined(__64BIT__))
+# define SQLITE_PTRSIZE 4
+# else
+# define SQLITE_PTRSIZE 8
+# endif
+#endif
+
+/* The uptr type is an unsigned integer large enough to hold a pointer
+*/
+#if defined(HAVE_STDINT_H)
+ typedef uintptr_t uptr;
+#elif SQLITE_PTRSIZE==4
+ typedef u32 uptr;
+#else
+ typedef u64 uptr;
+#endif
+
+/*
+** The SQLITE_WITHIN(P,S,E) macro checks to see if pointer P points to
+** something between S (inclusive) and E (exclusive).
+**
+** In other words, S is a buffer and E is a pointer to the first byte after
+** the end of buffer S. This macro returns true if P points to something
+** contained within the buffer S.
+*/
+#define SQLITE_WITHIN(P,S,E) (((uptr)(P)>=(uptr)(S))&&((uptr)(P)<(uptr)(E)))
+
+/*
+** P is one byte past the end of a large buffer. Return true if a span of bytes
+** between S..E crosses the end of that buffer. In other words, return true
+** if the sub-buffer S..E-1 overflows the buffer whose last byte is P-1.
+**
+** S is the start of the span. E is one byte past the end of end of span.
+**
+** P
+** |-----------------| FALSE
+** |-------|
+** S E
+**
+** P
+** |-----------------|
+** |-------| TRUE
+** S E
+**
+** P
+** |-----------------|
+** |-------| FALSE
+** S E
+*/
+#define SQLITE_OVERFLOW(P,S,E) (((uptr)(S)<(uptr)(P))&&((uptr)(E)>(uptr)(P)))
+
+/*
+** Macros to determine whether the machine is big or little endian,
+** and whether or not that determination is run-time or compile-time.
+**
+** For best performance, an attempt is made to guess at the byte-order
+** using C-preprocessor macros. If that is unsuccessful, or if
+** -DSQLITE_BYTEORDER=0 is set, then byte-order is determined
+** at run-time.
+**
+** If you are building SQLite on some obscure platform for which the
+** following ifdef magic does not work, you can always include either:
+**
+** -DSQLITE_BYTEORDER=1234
+**
+** or
+**
+** -DSQLITE_BYTEORDER=4321
+**
+** to cause the build to work for little-endian or big-endian processors,
+** respectively.
+*/
+#ifndef SQLITE_BYTEORDER /* Replicate changes at tag-20230904a */
+# if defined(__BYTE_ORDER__) && __BYTE_ORDER__==__ORDER_BIG_ENDIAN__
+# define SQLITE_BYTEORDER 4321
+# elif defined(__BYTE_ORDER__) && __BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__
+# define SQLITE_BYTEORDER 1234
+# elif defined(__BIG_ENDIAN__) && __BIG_ENDIAN__==1
+# define SQLITE_BYTEORDER 4321
+# elif defined(i386) || defined(__i386__) || defined(_M_IX86) || \
+ defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
+ defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
+# define SQLITE_BYTEORDER 1234
+# elif defined(sparc) || defined(__ARMEB__) || defined(__AARCH64EB__)
+# define SQLITE_BYTEORDER 4321
+# else
+# define SQLITE_BYTEORDER 0
+# endif
+#endif
+#if SQLITE_BYTEORDER==4321
+# define SQLITE_BIGENDIAN 1
+# define SQLITE_LITTLEENDIAN 0
+# define SQLITE_UTF16NATIVE SQLITE_UTF16BE
+#elif SQLITE_BYTEORDER==1234
+# define SQLITE_BIGENDIAN 0
+# define SQLITE_LITTLEENDIAN 1
+# define SQLITE_UTF16NATIVE SQLITE_UTF16LE
+#else
+# ifdef SQLITE_AMALGAMATION
+ const int sqlite3one = 1;
+# else
+ extern const int sqlite3one;
+# endif
+# define SQLITE_BIGENDIAN (*(char *)(&sqlite3one)==0)
+# define SQLITE_LITTLEENDIAN (*(char *)(&sqlite3one)==1)
+# define SQLITE_UTF16NATIVE (SQLITE_BIGENDIAN?SQLITE_UTF16BE:SQLITE_UTF16LE)
+#endif
+
+/*
+** Constants for the largest and smallest possible 64-bit signed integers.
+** These macros are designed to work correctly on both 32-bit and 64-bit
+** compilers.
+*/
+#define LARGEST_INT64 (0xffffffff|(((i64)0x7fffffff)<<32))
+#define LARGEST_UINT64 (0xffffffff|(((u64)0xffffffff)<<32))
+#define SMALLEST_INT64 (((i64)-1) - LARGEST_INT64)
+
+/*
+** Round up a number to the next larger multiple of 8. This is used
+** to force 8-byte alignment on 64-bit architectures.
+**
+** ROUND8() always does the rounding, for any argument.
+**
+** ROUND8P() assumes that the argument is already an integer number of
+** pointers in size, and so it is a no-op on systems where the pointer
+** size is 8.
+*/
+#define ROUND8(x) (((x)+7)&~7)
+#if SQLITE_PTRSIZE==8
+# define ROUND8P(x) (x)
+#else
+# define ROUND8P(x) (((x)+7)&~7)
+#endif
+
+/*
+** Round down to the nearest multiple of 8
+*/
+#define ROUNDDOWN8(x) ((x)&~7)
+
+/*
+** Assert that the pointer X is aligned to an 8-byte boundary. This
+** macro is used only within assert() to verify that the code gets
+** all alignment restrictions correct.
+**
+** Except, if SQLITE_4_BYTE_ALIGNED_MALLOC is defined, then the
+** underlying malloc() implementation might return us 4-byte aligned
+** pointers. In that case, only verify 4-byte alignment.
+*/
+#ifdef SQLITE_4_BYTE_ALIGNED_MALLOC
+# define EIGHT_BYTE_ALIGNMENT(X) ((((uptr)(X) - (uptr)0)&3)==0)
+#else
+# define EIGHT_BYTE_ALIGNMENT(X) ((((uptr)(X) - (uptr)0)&7)==0)
+#endif
+
+/*
+** Disable MMAP on platforms where it is known to not work
+*/
+#if defined(__OpenBSD__) || defined(__QNXNTO__)
+# undef SQLITE_MAX_MMAP_SIZE
+# define SQLITE_MAX_MMAP_SIZE 0
+#endif
+
+/*
+** Default maximum size of memory used by memory-mapped I/O in the VFS
+*/
+#ifdef __APPLE__
+# include <TargetConditionals.h>
+#endif
+#ifndef SQLITE_MAX_MMAP_SIZE
+# if defined(__linux__) \
+ || defined(_WIN32) \
+ || (defined(__APPLE__) && defined(__MACH__)) \
+ || defined(__sun) \
+ || defined(__FreeBSD__) \
+ || defined(__DragonFly__)
+# define SQLITE_MAX_MMAP_SIZE 0x7fff0000 /* 2147418112 */
+# else
+# define SQLITE_MAX_MMAP_SIZE 0
+# endif
+#endif
+
+/*
+** The default MMAP_SIZE is zero on all platforms. Or, even if a larger
+** default MMAP_SIZE is specified at compile-time, make sure that it does
+** not exceed the maximum mmap size.
+*/
+#ifndef SQLITE_DEFAULT_MMAP_SIZE
+# define SQLITE_DEFAULT_MMAP_SIZE 0
+#endif
+#if SQLITE_DEFAULT_MMAP_SIZE>SQLITE_MAX_MMAP_SIZE
+# undef SQLITE_DEFAULT_MMAP_SIZE
+# define SQLITE_DEFAULT_MMAP_SIZE SQLITE_MAX_MMAP_SIZE
+#endif
+
+/*
+** TREETRACE_ENABLED will be either 1 or 0 depending on whether or not
+** the Abstract Syntax Tree tracing logic is turned on.
+*/
+#if !defined(SQLITE_AMALGAMATION)
+SQLITE_PRIVATE u32 sqlite3TreeTrace;
+#endif
+#if defined(SQLITE_DEBUG) \
+ && (defined(SQLITE_TEST) || defined(SQLITE_ENABLE_SELECTTRACE) \
+ || defined(SQLITE_ENABLE_TREETRACE))
+# define TREETRACE_ENABLED 1
+# define TREETRACE(K,P,S,X) \
+ if(sqlite3TreeTrace&(K)) \
+ sqlite3DebugPrintf("%u/%d/%p: ",(S)->selId,(P)->addrExplain,(S)),\
+ sqlite3DebugPrintf X
+#else
+# define TREETRACE(K,P,S,X)
+# define TREETRACE_ENABLED 0
+#endif
+
+/* TREETRACE flag meanings:
+**
+** 0x00000001 Beginning and end of SELECT processing
+** 0x00000002 WHERE clause processing
+** 0x00000004 Query flattener
+** 0x00000008 Result-set wildcard expansion
+** 0x00000010 Query name resolution
+** 0x00000020 Aggregate analysis
+** 0x00000040 Window functions
+** 0x00000080 Generated column names
+** 0x00000100 Move HAVING terms into WHERE
+** 0x00000200 Count-of-view optimization
+** 0x00000400 Compound SELECT processing
+** 0x00000800 Drop superfluous ORDER BY
+** 0x00001000 LEFT JOIN simplifies to JOIN
+** 0x00002000 Constant propagation
+** 0x00004000 Push-down optimization
+** 0x00008000 After all FROM-clause analysis
+** 0x00010000 Beginning of DELETE/INSERT/UPDATE processing
+** 0x00020000 Transform DISTINCT into GROUP BY
+** 0x00040000 SELECT tree dump after all code has been generated
+** 0x00080000 NOT NULL strength reduction
+*/
+
+/*
+** Macros for "wheretrace"
+*/
+SQLITE_PRIVATE u32 sqlite3WhereTrace;
+#if defined(SQLITE_DEBUG) \
+ && (defined(SQLITE_TEST) || defined(SQLITE_ENABLE_WHERETRACE))
+# define WHERETRACE(K,X) if(sqlite3WhereTrace&(K)) sqlite3DebugPrintf X
+# define WHERETRACE_ENABLED 1
+#else
+# define WHERETRACE(K,X)
+#endif
+
+/*
+** Bits for the sqlite3WhereTrace mask:
+**
+** (---any--) Top-level block structure
+** 0x-------F High-level debug messages
+** 0x----FFF- More detail
+** 0xFFFF---- Low-level debug messages
+**
+** 0x00000001 Code generation
+** 0x00000002 Solver (Use 0x40000 for less detail)
+** 0x00000004 Solver costs
+** 0x00000008 WhereLoop inserts
+**
+** 0x00000010 Display sqlite3_index_info xBestIndex calls
+** 0x00000020 Range an equality scan metrics
+** 0x00000040 IN operator decisions
+** 0x00000080 WhereLoop cost adjustments
+** 0x00000100
+** 0x00000200 Covering index decisions
+** 0x00000400 OR optimization
+** 0x00000800 Index scanner
+** 0x00001000 More details associated with code generation
+** 0x00002000
+** 0x00004000 Show all WHERE terms at key points
+** 0x00008000 Show the full SELECT statement at key places
+**
+** 0x00010000 Show more detail when printing WHERE terms
+** 0x00020000 Show WHERE terms returned from whereScanNext()
+** 0x00040000 Solver overview messages
+** 0x00080000 Star-query heuristic
+*/
+
+
+/*
+** An instance of the following structure is used to store the busy-handler
+** callback for a given sqlite handle.
+**
+** The sqlite.busyHandler member of the sqlite struct contains the busy
+** callback for the database handle. Each pager opened via the sqlite
+** handle is passed a pointer to sqlite.busyHandler. The busy-handler
+** callback is currently invoked only from within pager.c.
+*/
+typedef struct BusyHandler BusyHandler;
+struct BusyHandler {
+ int (*xBusyHandler)(void *,int); /* The busy callback */
+ void *pBusyArg; /* First arg to busy callback */
+ int nBusy; /* Incremented with each busy call */
+};
+
+/*
+** Name of table that holds the database schema.
+**
+** The PREFERRED names are used wherever possible. But LEGACY is also
+** used for backwards compatibility.
+**
+** 1. Queries can use either the PREFERRED or the LEGACY names
+** 2. The sqlite3_set_authorizer() callback uses the LEGACY name
+** 3. The PRAGMA table_list statement uses the PREFERRED name
+**
+** The LEGACY names are stored in the internal symbol hash table
+** in support of (2). Names are translated using sqlite3PreferredTableName()
+** for (3). The sqlite3FindTable() function takes care of translating
+** names for (1).
+**
+** Note that "sqlite_temp_schema" can also be called "temp.sqlite_schema".
+*/
+#define LEGACY_SCHEMA_TABLE "sqlite_master"
+#define LEGACY_TEMP_SCHEMA_TABLE "sqlite_temp_master"
+#define PREFERRED_SCHEMA_TABLE "sqlite_schema"
+#define PREFERRED_TEMP_SCHEMA_TABLE "sqlite_temp_schema"
+
+
+/*
+** The root-page of the schema table.
+*/
+#define SCHEMA_ROOT 1
+
+/*
+** The name of the schema table. The name is different for TEMP.
+*/
+#define SCHEMA_TABLE(x) \
+ ((!OMIT_TEMPDB)&&(x==1)?LEGACY_TEMP_SCHEMA_TABLE:LEGACY_SCHEMA_TABLE)
+
+/*
+** A convenience macro that returns the number of elements in
+** an array.
+*/
+#define ArraySize(X) ((int)(sizeof(X)/sizeof(X[0])))
+
+/*
+** Determine if the argument is a power of two
+*/
+#define IsPowerOfTwo(X) (((X)&((X)-1))==0)
+
+/*
+** The following value as a destructor means to use sqlite3DbFree().
+** The sqlite3DbFree() routine requires two parameters instead of the
+** one parameter that destructors normally want. So we have to introduce
+** this magic value that the code knows to handle differently. Any
+** pointer will work here as long as it is distinct from SQLITE_STATIC
+** and SQLITE_TRANSIENT.
+*/
+#define SQLITE_DYNAMIC ((sqlite3_destructor_type)sqlite3OomClear)
+
+/*
+** When SQLITE_OMIT_WSD is defined, it means that the target platform does
+** not support Writable Static Data (WSD) such as global and static variables.
+** All variables must either be on the stack or dynamically allocated from
+** the heap. When WSD is unsupported, the variable declarations scattered
+** throughout the SQLite code must become constants instead. The SQLITE_WSD
+** macro is used for this purpose. And instead of referencing the variable
+** directly, we use its constant as a key to lookup the run-time allocated
+** buffer that holds real variable. The constant is also the initializer
+** for the run-time allocated buffer.
+**
+** In the usual case where WSD is supported, the SQLITE_WSD and GLOBAL
+** macros become no-ops and have zero performance impact.
+*/
+#ifdef SQLITE_OMIT_WSD
+ #define SQLITE_WSD const
+ #define GLOBAL(t,v) (*(t*)sqlite3_wsd_find((void*)&(v), sizeof(v)))
+ #define sqlite3GlobalConfig GLOBAL(struct Sqlite3Config, sqlite3Config)
+SQLITE_API int sqlite3_wsd_init(int N, int J);
+SQLITE_API void *sqlite3_wsd_find(void *K, int L);
+#else
+ #define SQLITE_WSD
+ #define GLOBAL(t,v) v
+ #define sqlite3GlobalConfig sqlite3Config
+#endif
+
+/*
+** The following macros are used to suppress compiler warnings and to
+** make it clear to human readers when a function parameter is deliberately
+** left unused within the body of a function. This usually happens when
+** a function is called via a function pointer. For example the
+** implementation of an SQL aggregate step callback may not use the
+** parameter indicating the number of arguments passed to the aggregate,
+** if it knows that this is enforced elsewhere.
+**
+** When a function parameter is not used at all within the body of a function,
+** it is generally named "NotUsed" or "NotUsed2" to make things even clearer.
+** However, these macros may also be used to suppress warnings related to
+** parameters that may or may not be used depending on compilation options.
+** For example those parameters only used in assert() statements. In these
+** cases the parameters are named as per the usual conventions.
+*/
+#define UNUSED_PARAMETER(x) (void)(x)
+#define UNUSED_PARAMETER2(x,y) UNUSED_PARAMETER(x),UNUSED_PARAMETER(y)
+
+/*
+** Forward references to structures
+*/
+typedef struct AggInfo AggInfo;
+typedef struct AuthContext AuthContext;
+typedef struct AutoincInfo AutoincInfo;
+typedef struct Bitvec Bitvec;
+typedef struct CollSeq CollSeq;
+typedef struct Column Column;
+typedef struct Cte Cte;
+typedef struct CteUse CteUse;
+typedef struct Db Db;
+typedef struct DbClientData DbClientData;
+typedef struct DbFixer DbFixer;
+typedef struct Schema Schema;
+typedef struct Expr Expr;
+typedef struct ExprList ExprList;
+typedef struct FKey FKey;
+typedef struct FpDecode FpDecode;
+typedef struct FuncDestructor FuncDestructor;
+typedef struct FuncDef FuncDef;
+typedef struct FuncDefHash FuncDefHash;
+typedef struct IdList IdList;
+typedef struct Index Index;
+typedef struct IndexedExpr IndexedExpr;
+typedef struct IndexSample IndexSample;
+typedef struct KeyClass KeyClass;
+typedef struct KeyInfo KeyInfo;
+typedef struct Lookaside Lookaside;
+typedef struct LookasideSlot LookasideSlot;
+typedef struct Module Module;
+typedef struct NameContext NameContext;
+typedef struct OnOrUsing OnOrUsing;
+typedef struct Parse Parse;
+typedef struct ParseCleanup ParseCleanup;
+typedef struct PreUpdate PreUpdate;
+typedef struct PrintfArguments PrintfArguments;
+typedef struct RCStr RCStr;
+typedef struct RenameToken RenameToken;
+typedef struct Returning Returning;
+typedef struct RowSet RowSet;
+typedef struct Savepoint Savepoint;
+typedef struct Select Select;
+typedef struct SQLiteThread SQLiteThread;
+typedef struct SelectDest SelectDest;
+typedef struct Subquery Subquery;
+typedef struct SrcItem SrcItem;
+typedef struct SrcList SrcList;
+typedef struct sqlite3_str StrAccum; /* Internal alias for sqlite3_str */
+typedef struct Table Table;
+typedef struct TableLock TableLock;
+typedef struct Token Token;
+typedef struct TreeView TreeView;
+typedef struct Trigger Trigger;
+typedef struct TriggerPrg TriggerPrg;
+typedef struct TriggerStep TriggerStep;
+typedef struct UnpackedRecord UnpackedRecord;
+typedef struct Upsert Upsert;
+typedef struct VTable VTable;
+typedef struct VtabCtx VtabCtx;
+typedef struct Walker Walker;
+typedef struct WhereInfo WhereInfo;
+typedef struct Window Window;
+typedef struct With With;
+
+
+/*
+** The bitmask datatype defined below is used for various optimizations.
+**
+** Changing this from a 64-bit to a 32-bit type limits the number of
+** tables in a join to 32 instead of 64. But it also reduces the size
+** of the library by 738 bytes on ix86.
+*/
+#ifdef SQLITE_BITMASK_TYPE
+ typedef SQLITE_BITMASK_TYPE Bitmask;
+#else
+ typedef u64 Bitmask;
+#endif
+
+/*
+** The number of bits in a Bitmask. "BMS" means "BitMask Size".
+*/
+#define BMS ((int)(sizeof(Bitmask)*8))
+
+/*
+** A bit in a Bitmask
+*/
+#define MASKBIT(n) (((Bitmask)1)<<(n))
+#define MASKBIT64(n) (((u64)1)<<(n))
+#define MASKBIT32(n) (((unsigned int)1)<<(n))
+#define SMASKBIT32(n) ((n)<=31?((unsigned int)1)<<(n):0)
+#define ALLBITS ((Bitmask)-1)
+#define TOPBIT (((Bitmask)1)<<(BMS-1))
+
+/* A VList object records a mapping between parameters/variables/wildcards
+** in the SQL statement (such as $abc, @pqr, or :xyz) and the integer
+** variable number associated with that parameter. See the format description
+** on the sqlite3VListAdd() routine for more information. A VList is really
+** just an array of integers.
+*/
+typedef int VList;
+
+/*
+** Defer sourcing vdbe.h and btree.h until after the "u8" and
+** "BusyHandler" typedefs. vdbe.h also requires a few of the opaque
+** pointer types (i.e. FuncDef) defined above.
+*/
+/************** Include os.h in the middle of sqliteInt.h ********************/
+/************** Begin file os.h **********************************************/
+/*
+** 2001 September 16
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+******************************************************************************
+**
+** This header file (together with is companion C source-code file
+** "os.c") attempt to abstract the underlying operating system so that
+** the SQLite library will work on both POSIX and windows systems.
+**
+** This header file is #include-ed by sqliteInt.h and thus ends up
+** being included by every source file.
+*/
+#ifndef _SQLITE_OS_H_
+#define _SQLITE_OS_H_
+
+/*
+** Attempt to automatically detect the operating system and setup the
+** necessary pre-processor macros for it.
+*/
+/************** Include os_setup.h in the middle of os.h *********************/
+/************** Begin file os_setup.h ****************************************/
+/*
+** 2013 November 25
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+******************************************************************************
+**
+** This file contains pre-processor directives related to operating system
+** detection and/or setup.
+*/
+#ifndef SQLITE_OS_SETUP_H
+#define SQLITE_OS_SETUP_H
+
+/*
+** Figure out if we are dealing with Unix, Windows, or some other operating
+** system.
+**
+** After the following block of preprocess macros, all of
+**
+** SQLITE_OS_KV
+** SQLITE_OS_OTHER
+** SQLITE_OS_UNIX
+** SQLITE_OS_WIN
+**
+** will defined to either 1 or 0. One of them will be 1. The others will be 0.
+** If none of the macros are initially defined, then select either
+** SQLITE_OS_UNIX or SQLITE_OS_WIN depending on the target platform.
+**
+** If SQLITE_OS_OTHER=1 is specified at compile-time, then the application
+** must provide its own VFS implementation together with sqlite3_os_init()
+** and sqlite3_os_end() routines.
+*/
+#if !defined(SQLITE_OS_KV) && !defined(SQLITE_OS_OTHER) && \
+ !defined(SQLITE_OS_UNIX) && !defined(SQLITE_OS_WIN)
+# if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || \
+ defined(__MINGW32__) || defined(__BORLANDC__)
+# define SQLITE_OS_WIN 1
+# define SQLITE_OS_UNIX 0
+# else
+# define SQLITE_OS_WIN 0
+# define SQLITE_OS_UNIX 1
+# endif
+#endif
+#if SQLITE_OS_OTHER+1>1
+# undef SQLITE_OS_KV
+# define SQLITE_OS_KV 0
+# undef SQLITE_OS_UNIX
+# define SQLITE_OS_UNIX 0
+# undef SQLITE_OS_WIN
+# define SQLITE_OS_WIN 0
+#endif
+#if SQLITE_OS_KV+1>1
+# undef SQLITE_OS_OTHER
+# define SQLITE_OS_OTHER 0
+# undef SQLITE_OS_UNIX
+# define SQLITE_OS_UNIX 0
+# undef SQLITE_OS_WIN
+# define SQLITE_OS_WIN 0
+# define SQLITE_OMIT_LOAD_EXTENSION 1
+# define SQLITE_OMIT_WAL 1
+# define SQLITE_OMIT_DEPRECATED 1
+# undef SQLITE_TEMP_STORE
+# define SQLITE_TEMP_STORE 3 /* Always use memory for temporary storage */
+# define SQLITE_DQS 0
+# define SQLITE_OMIT_SHARED_CACHE 1
+# define SQLITE_OMIT_AUTOINIT 1
+#endif
+#if SQLITE_OS_UNIX+1>1
+# undef SQLITE_OS_KV
+# define SQLITE_OS_KV 0
+# undef SQLITE_OS_OTHER
+# define SQLITE_OS_OTHER 0
+# undef SQLITE_OS_WIN
+# define SQLITE_OS_WIN 0
+#endif
+#if SQLITE_OS_WIN+1>1
+# undef SQLITE_OS_KV
+# define SQLITE_OS_KV 0
+# undef SQLITE_OS_OTHER
+# define SQLITE_OS_OTHER 0
+# undef SQLITE_OS_UNIX
+# define SQLITE_OS_UNIX 0
+#endif
+
+
+#endif /* SQLITE_OS_SETUP_H */
+
+/************** End of os_setup.h ********************************************/
+/************** Continuing where we left off in os.h *************************/
+
+/* If the SET_FULLSYNC macro is not defined above, then make it
+** a no-op
+*/
+#ifndef SET_FULLSYNC
+# define SET_FULLSYNC(x,y)
+#endif
+
+/* Maximum pathname length. Note: FILENAME_MAX defined by stdio.h
+*/
+#ifndef SQLITE_MAX_PATHLEN
+# define SQLITE_MAX_PATHLEN FILENAME_MAX
+#endif
+
+/* Maximum number of symlinks that will be resolved while trying to
+** expand a filename in xFullPathname() in the VFS.
+*/
+#ifndef SQLITE_MAX_SYMLINK
+# define SQLITE_MAX_SYMLINK 200
+#endif
+
+/*
+** The default size of a disk sector
+*/
+#ifndef SQLITE_DEFAULT_SECTOR_SIZE
+# define SQLITE_DEFAULT_SECTOR_SIZE 4096
+#endif
+
+/*
+** Temporary files are named starting with this prefix followed by 16 random
+** alphanumeric characters, and no file extension. They are stored in the
+** OS's standard temporary file directory, and are deleted prior to exit.
+** If sqlite is being embedded in another program, you may wish to change the
+** prefix to reflect your program's name, so that if your program exits
+** prematurely, old temporary files can be easily identified. This can be done
+** using -DSQLITE_TEMP_FILE_PREFIX=myprefix_ on the compiler command line.
+**
+** 2006-10-31: The default prefix used to be "sqlite_". But then
+** Mcafee started using SQLite in their anti-virus product and it
+** started putting files with the "sqlite" name in the c:/temp folder.
+** This annoyed many windows users. Those users would then do a
+** Google search for "sqlite", find the telephone numbers of the
+** developers and call to wake them up at night and complain.
+** For this reason, the default name prefix is changed to be "sqlite"
+** spelled backwards. So the temp files are still identified, but
+** anybody smart enough to figure out the code is also likely smart
+** enough to know that calling the developer will not help get rid
+** of the file.
+*/
+#ifndef SQLITE_TEMP_FILE_PREFIX
+# define SQLITE_TEMP_FILE_PREFIX "etilqs_"
+#endif
+
+/*
+** The following values may be passed as the second argument to
+** sqlite3OsLock(). The various locks exhibit the following semantics:
+**
+** SHARED: Any number of processes may hold a SHARED lock simultaneously.
+** RESERVED: A single process may hold a RESERVED lock on a file at
+** any time. Other processes may hold and obtain new SHARED locks.
+** PENDING: A single process may hold a PENDING lock on a file at
+** any one time. Existing SHARED locks may persist, but no new
+** SHARED locks may be obtained by other processes.
+** EXCLUSIVE: An EXCLUSIVE lock precludes all other locks.
+**
+** PENDING_LOCK may not be passed directly to sqlite3OsLock(). Instead, a
+** process that requests an EXCLUSIVE lock may actually obtain a PENDING
+** lock. This can be upgraded to an EXCLUSIVE lock by a subsequent call to
+** sqlite3OsLock().
+*/
+#define NO_LOCK 0
+#define SHARED_LOCK 1
+#define RESERVED_LOCK 2
+#define PENDING_LOCK 3
+#define EXCLUSIVE_LOCK 4
+
+/*
+** File Locking Notes: (Mostly about windows but also some info for Unix)
+**
+** We cannot use LockFileEx() or UnlockFileEx() on Win95/98/ME because
+** those functions are not available. So we use only LockFile() and
+** UnlockFile().
+**
+** LockFile() prevents not just writing but also reading by other processes.
+** A SHARED_LOCK is obtained by locking a single randomly-chosen
+** byte out of a specific range of bytes. The lock byte is obtained at
+** random so two separate readers can probably access the file at the
+** same time, unless they are unlucky and choose the same lock byte.
+** An EXCLUSIVE_LOCK is obtained by locking all bytes in the range.
+** There can only be one writer. A RESERVED_LOCK is obtained by locking
+** a single byte of the file that is designated as the reserved lock byte.
+** A PENDING_LOCK is obtained by locking a designated byte different from
+** the RESERVED_LOCK byte.
+**
+** On WinNT/2K/XP systems, LockFileEx() and UnlockFileEx() are available,
+** which means we can use reader/writer locks. When reader/writer locks
+** are used, the lock is placed on the same range of bytes that is used
+** for probabilistic locking in Win95/98/ME. Hence, the locking scheme
+** will support two or more Win95 readers or two or more WinNT readers.
+** But a single Win95 reader will lock out all WinNT readers and a single
+** WinNT reader will lock out all other Win95 readers.
+**
+** The following #defines specify the range of bytes used for locking.
+** SHARED_SIZE is the number of bytes available in the pool from which
+** a random byte is selected for a shared lock. The pool of bytes for
+** shared locks begins at SHARED_FIRST.
+**
+** The same locking strategy and
+** byte ranges are used for Unix. This leaves open the possibility of having
+** clients on win95, winNT, and unix all talking to the same shared file
+** and all locking correctly. To do so would require that samba (or whatever
+** tool is being used for file sharing) implements locks correctly between
+** windows and unix. I'm guessing that isn't likely to happen, but by
+** using the same locking range we are at least open to the possibility.
+**
+** Locking in windows is manditory. For this reason, we cannot store
+** actual data in the bytes used for locking. The pager never allocates
+** the pages involved in locking therefore. SHARED_SIZE is selected so
+** that all locks will fit on a single page even at the minimum page size.
+** PENDING_BYTE defines the beginning of the locks. By default PENDING_BYTE
+** is set high so that we don't have to allocate an unused page except
+** for very large databases. But one should test the page skipping logic
+** by setting PENDING_BYTE low and running the entire regression suite.
+**
+** Changing the value of PENDING_BYTE results in a subtly incompatible
+** file format. Depending on how it is changed, you might not notice
+** the incompatibility right away, even running a full regression test.
+** The default location of PENDING_BYTE is the first byte past the
+** 1GB boundary.
+**
+*/
+#ifdef SQLITE_OMIT_WSD
+# define PENDING_BYTE (0x40000000)
+#else
+# define PENDING_BYTE sqlite3PendingByte
+#endif
+#define RESERVED_BYTE (PENDING_BYTE+1)
+#define SHARED_FIRST (PENDING_BYTE+2)
+#define SHARED_SIZE 510
+
+/*
+** Wrapper around OS specific sqlite3_os_init() function.
+*/
+SQLITE_PRIVATE int sqlite3OsInit(void);
+
+/*
+** Functions for accessing sqlite3_file methods
+*/
+SQLITE_PRIVATE void sqlite3OsClose(sqlite3_file*);
+SQLITE_PRIVATE int sqlite3OsRead(sqlite3_file*, void*, int amt, i64 offset);
+SQLITE_PRIVATE int sqlite3OsWrite(sqlite3_file*, const void*, int amt, i64 offset);
+SQLITE_PRIVATE int sqlite3OsTruncate(sqlite3_file*, i64 size);
+SQLITE_PRIVATE int sqlite3OsSync(sqlite3_file*, int);
+SQLITE_PRIVATE int sqlite3OsFileSize(sqlite3_file*, i64 *pSize);
+SQLITE_PRIVATE int sqlite3OsLock(sqlite3_file*, int);
+SQLITE_PRIVATE int sqlite3OsUnlock(sqlite3_file*, int);
+SQLITE_PRIVATE int sqlite3OsCheckReservedLock(sqlite3_file *id, int *pResOut);
+SQLITE_PRIVATE int sqlite3OsFileControl(sqlite3_file*,int,void*);
+SQLITE_PRIVATE void sqlite3OsFileControlHint(sqlite3_file*,int,void*);
+#define SQLITE_FCNTL_DB_UNCHANGED 0xca093fa0
+SQLITE_PRIVATE int sqlite3OsSectorSize(sqlite3_file *id);
+SQLITE_PRIVATE int sqlite3OsDeviceCharacteristics(sqlite3_file *id);
+#ifndef SQLITE_OMIT_WAL
+SQLITE_PRIVATE int sqlite3OsShmMap(sqlite3_file *,int,int,int,void volatile **);
+SQLITE_PRIVATE int sqlite3OsShmLock(sqlite3_file *id, int, int, int);
+SQLITE_PRIVATE void sqlite3OsShmBarrier(sqlite3_file *id);
+SQLITE_PRIVATE int sqlite3OsShmUnmap(sqlite3_file *id, int);
+#endif /* SQLITE_OMIT_WAL */
+SQLITE_PRIVATE int sqlite3OsFetch(sqlite3_file *id, i64, int, void **);
+SQLITE_PRIVATE int sqlite3OsUnfetch(sqlite3_file *, i64, void *);
+
+
+/*
+** Functions for accessing sqlite3_vfs methods
+*/
+SQLITE_PRIVATE int sqlite3OsOpen(sqlite3_vfs *, const char *, sqlite3_file*, int, int *);
+SQLITE_PRIVATE int sqlite3OsDelete(sqlite3_vfs *, const char *, int);
+SQLITE_PRIVATE int sqlite3OsAccess(sqlite3_vfs *, const char *, int, int *pResOut);
+SQLITE_PRIVATE int sqlite3OsFullPathname(sqlite3_vfs *, const char *, int, char *);
+#ifndef SQLITE_OMIT_LOAD_EXTENSION
+SQLITE_PRIVATE void *sqlite3OsDlOpen(sqlite3_vfs *, const char *);
+SQLITE_PRIVATE void sqlite3OsDlError(sqlite3_vfs *, int, char *);
+SQLITE_PRIVATE void (*sqlite3OsDlSym(sqlite3_vfs *, void *, const char *))(void);
+SQLITE_PRIVATE void sqlite3OsDlClose(sqlite3_vfs *, void *);
+#endif /* SQLITE_OMIT_LOAD_EXTENSION */
+SQLITE_PRIVATE int sqlite3OsRandomness(sqlite3_vfs *, int, char *);
+SQLITE_PRIVATE int sqlite3OsSleep(sqlite3_vfs *, int);
+SQLITE_PRIVATE int sqlite3OsGetLastError(sqlite3_vfs*);
+SQLITE_PRIVATE int sqlite3OsCurrentTimeInt64(sqlite3_vfs *, sqlite3_int64*);
+
+/*
+** Convenience functions for opening and closing files using
+** sqlite3_malloc() to obtain space for the file-handle structure.
+*/
+SQLITE_PRIVATE int sqlite3OsOpenMalloc(sqlite3_vfs *, const char *, sqlite3_file **, int,int*);
+SQLITE_PRIVATE void sqlite3OsCloseFree(sqlite3_file *);
+
+#endif /* _SQLITE_OS_H_ */
+
+/************** End of os.h **************************************************/
+/************** Continuing where we left off in sqliteInt.h ******************/
+/************** Include pager.h in the middle of sqliteInt.h *****************/
+/************** Begin file pager.h *******************************************/
+/*
+** 2001 September 15
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This header file defines the interface that the sqlite page cache
+** subsystem. The page cache subsystem reads and writes a file a page
+** at a time and provides a journal for rollback.
+*/
+
+#ifndef SQLITE_PAGER_H
+#define SQLITE_PAGER_H
+
+/*
+** Default maximum size for persistent journal files. A negative
+** value means no limit. This value may be overridden using the
+** sqlite3PagerJournalSizeLimit() API. See also "PRAGMA journal_size_limit".
+*/
+#ifndef SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT
+ #define SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT -1
+#endif
+
+/*
+** The type used to represent a page number. The first page in a file
+** is called page 1. 0 is used to represent "not a page".
+*/
+typedef u32 Pgno;
+
+/*
+** Each open file is managed by a separate instance of the "Pager" structure.
+*/
+typedef struct Pager Pager;
+
+/*
+** Handle type for pages.
+*/
+typedef struct PgHdr DbPage;
+
+/*
+** Page number PAGER_SJ_PGNO is never used in an SQLite database (it is
+** reserved for working around a windows/posix incompatibility). It is
+** used in the journal to signify that the remainder of the journal file
+** is devoted to storing a super-journal name - there are no more pages to
+** roll back. See comments for function writeSuperJournal() in pager.c
+** for details.
+*/
+#define PAGER_SJ_PGNO_COMPUTED(x) ((Pgno)((PENDING_BYTE/((x)->pageSize))+1))
+#define PAGER_SJ_PGNO(x) ((x)->lckPgno)
+
+/*
+** Allowed values for the flags parameter to sqlite3PagerOpen().
+**
+** NOTE: These values must match the corresponding BTREE_ values in btree.h.
+*/
+#define PAGER_OMIT_JOURNAL 0x0001 /* Do not use a rollback journal */
+#define PAGER_MEMORY 0x0002 /* In-memory database */
+
+/*
+** Valid values for the second argument to sqlite3PagerLockingMode().
+*/
+#define PAGER_LOCKINGMODE_QUERY -1
+#define PAGER_LOCKINGMODE_NORMAL 0
+#define PAGER_LOCKINGMODE_EXCLUSIVE 1
+
+/*
+** Numeric constants that encode the journalmode.
+**
+** The numeric values encoded here (other than PAGER_JOURNALMODE_QUERY)
+** are exposed in the API via the "PRAGMA journal_mode" command and
+** therefore cannot be changed without a compatibility break.
+*/
+#define PAGER_JOURNALMODE_QUERY (-1) /* Query the value of journalmode */
+#define PAGER_JOURNALMODE_DELETE 0 /* Commit by deleting journal file */
+#define PAGER_JOURNALMODE_PERSIST 1 /* Commit by zeroing journal header */
+#define PAGER_JOURNALMODE_OFF 2 /* Journal omitted. */
+#define PAGER_JOURNALMODE_TRUNCATE 3 /* Commit by truncating journal */
+#define PAGER_JOURNALMODE_MEMORY 4 /* In-memory journal file */
+#define PAGER_JOURNALMODE_WAL 5 /* Use write-ahead logging */
+
+#define isWalMode(x) ((x)==PAGER_JOURNALMODE_WAL)
+
+/*
+** The argument to this macro is a file descriptor (type sqlite3_file*).
+** Return 0 if it is not open, or non-zero (but not 1) if it is.
+**
+** This is so that expressions can be written as:
+**
+** if( isOpen(pPager->jfd) ){ ...
+**
+** instead of
+**
+** if( pPager->jfd->pMethods ){ ...
+*/
+#define isOpen(pFd) ((pFd)->pMethods!=0)
+
+/*
+** Flags that make up the mask passed to sqlite3PagerGet().
+*/
+#define PAGER_GET_NOCONTENT 0x01 /* Do not load data from disk */
+#define PAGER_GET_READONLY 0x02 /* Read-only page is acceptable */
+
+/*
+** Flags for sqlite3PagerSetFlags()
+**
+** Value constraints (enforced via assert()):
+** PAGER_FULLFSYNC == SQLITE_FullFSync
+** PAGER_CKPT_FULLFSYNC == SQLITE_CkptFullFSync
+** PAGER_CACHE_SPILL == SQLITE_CacheSpill
+*/
+#define PAGER_SYNCHRONOUS_OFF 0x01 /* PRAGMA synchronous=OFF */
+#define PAGER_SYNCHRONOUS_NORMAL 0x02 /* PRAGMA synchronous=NORMAL */
+#define PAGER_SYNCHRONOUS_FULL 0x03 /* PRAGMA synchronous=FULL */
+#define PAGER_SYNCHRONOUS_EXTRA 0x04 /* PRAGMA synchronous=EXTRA */
+#define PAGER_SYNCHRONOUS_MASK 0x07 /* Mask for four values above */
+#define PAGER_FULLFSYNC 0x08 /* PRAGMA fullfsync=ON */
+#define PAGER_CKPT_FULLFSYNC 0x10 /* PRAGMA checkpoint_fullfsync=ON */
+#define PAGER_CACHESPILL 0x20 /* PRAGMA cache_spill=ON */
+#define PAGER_FLAGS_MASK 0x38 /* All above except SYNCHRONOUS */
+
+/*
+** The remainder of this file contains the declarations of the functions
+** that make up the Pager sub-system API. See source code comments for
+** a detailed description of each routine.
+*/
+
+/* Open and close a Pager connection. */
+SQLITE_PRIVATE int sqlite3PagerOpen(
+ sqlite3_vfs*,
+ Pager **ppPager,
+ const char*,
+ int,
+ int,
+ int,
+ void(*)(DbPage*)
+);
+SQLITE_PRIVATE int sqlite3PagerClose(Pager *pPager, sqlite3*);
+SQLITE_PRIVATE int sqlite3PagerReadFileheader(Pager*, int, unsigned char*);
+
+/* Functions used to configure a Pager object. */
+SQLITE_PRIVATE void sqlite3PagerSetBusyHandler(Pager*, int(*)(void *), void *);
+SQLITE_PRIVATE int sqlite3PagerSetPagesize(Pager*, u32*, int);
+SQLITE_PRIVATE Pgno sqlite3PagerMaxPageCount(Pager*, Pgno);
+SQLITE_PRIVATE void sqlite3PagerSetCachesize(Pager*, int);
+SQLITE_PRIVATE int sqlite3PagerSetSpillsize(Pager*, int);
+SQLITE_PRIVATE void sqlite3PagerSetMmapLimit(Pager *, sqlite3_int64);
+SQLITE_PRIVATE void sqlite3PagerShrink(Pager*);
+SQLITE_PRIVATE void sqlite3PagerSetFlags(Pager*,unsigned);
+SQLITE_PRIVATE int sqlite3PagerLockingMode(Pager *, int);
+SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *, int);
+SQLITE_PRIVATE int sqlite3PagerGetJournalMode(Pager*);
+SQLITE_PRIVATE int sqlite3PagerOkToChangeJournalMode(Pager*);
+SQLITE_PRIVATE i64 sqlite3PagerJournalSizeLimit(Pager *, i64);
+SQLITE_PRIVATE sqlite3_backup **sqlite3PagerBackupPtr(Pager*);
+SQLITE_PRIVATE int sqlite3PagerFlush(Pager*);
+
+/* Functions used to obtain and release page references. */
+SQLITE_PRIVATE int sqlite3PagerGet(Pager *pPager, Pgno pgno, DbPage **ppPage, int clrFlag);
+SQLITE_PRIVATE DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno);
+SQLITE_PRIVATE void sqlite3PagerRef(DbPage*);
+SQLITE_PRIVATE void sqlite3PagerUnref(DbPage*);
+SQLITE_PRIVATE void sqlite3PagerUnrefNotNull(DbPage*);
+SQLITE_PRIVATE void sqlite3PagerUnrefPageOne(DbPage*);
+
+/* Operations on page references. */
+SQLITE_PRIVATE int sqlite3PagerWrite(DbPage*);
+SQLITE_PRIVATE void sqlite3PagerDontWrite(DbPage*);
+SQLITE_PRIVATE int sqlite3PagerMovepage(Pager*,DbPage*,Pgno,int);
+SQLITE_PRIVATE int sqlite3PagerPageRefcount(DbPage*);
+SQLITE_PRIVATE void *sqlite3PagerGetData(DbPage *);
+SQLITE_PRIVATE void *sqlite3PagerGetExtra(DbPage *);
+
+/* Functions used to manage pager transactions and savepoints. */
+SQLITE_PRIVATE void sqlite3PagerPagecount(Pager*, int*);
+SQLITE_PRIVATE int sqlite3PagerBegin(Pager*, int exFlag, int);
+SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne(Pager*,const char *zSuper, int);
+SQLITE_PRIVATE int sqlite3PagerExclusiveLock(Pager*);
+SQLITE_PRIVATE int sqlite3PagerSync(Pager *pPager, const char *zSuper);
+SQLITE_PRIVATE int sqlite3PagerCommitPhaseTwo(Pager*);
+SQLITE_PRIVATE int sqlite3PagerRollback(Pager*);
+SQLITE_PRIVATE int sqlite3PagerOpenSavepoint(Pager *pPager, int n);
+SQLITE_PRIVATE int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint);
+SQLITE_PRIVATE int sqlite3PagerSharedLock(Pager *pPager);
+
+#ifndef SQLITE_OMIT_WAL
+SQLITE_PRIVATE int sqlite3PagerCheckpoint(Pager *pPager, sqlite3*, int, int*, int*);
+SQLITE_PRIVATE int sqlite3PagerWalSupported(Pager *pPager);
+SQLITE_PRIVATE int sqlite3PagerWalCallback(Pager *pPager);
+SQLITE_PRIVATE int sqlite3PagerOpenWal(Pager *pPager, int *pisOpen);
+SQLITE_PRIVATE int sqlite3PagerCloseWal(Pager *pPager, sqlite3*);
+# ifdef SQLITE_ENABLE_SNAPSHOT
+SQLITE_PRIVATE int sqlite3PagerSnapshotGet(Pager*, sqlite3_snapshot **ppSnapshot);
+SQLITE_PRIVATE int sqlite3PagerSnapshotOpen(Pager*, sqlite3_snapshot *pSnapshot);
+SQLITE_PRIVATE int sqlite3PagerSnapshotRecover(Pager *pPager);
+SQLITE_PRIVATE int sqlite3PagerSnapshotCheck(Pager *pPager, sqlite3_snapshot *pSnapshot);
+SQLITE_PRIVATE void sqlite3PagerSnapshotUnlock(Pager *pPager);
+# endif
+#endif
+
+#if !defined(SQLITE_OMIT_WAL) && defined(SQLITE_ENABLE_SETLK_TIMEOUT)
+SQLITE_PRIVATE int sqlite3PagerWalWriteLock(Pager*, int);
+SQLITE_PRIVATE void sqlite3PagerWalDb(Pager*, sqlite3*);
+#else
+# define sqlite3PagerWalWriteLock(y,z) SQLITE_OK
+# define sqlite3PagerWalDb(x,y)
+#endif
+
+#ifdef SQLITE_DIRECT_OVERFLOW_READ
+SQLITE_PRIVATE int sqlite3PagerDirectReadOk(Pager *pPager, Pgno pgno);
+#endif
+
+#ifdef SQLITE_ENABLE_ZIPVFS
+SQLITE_PRIVATE int sqlite3PagerWalFramesize(Pager *pPager);
+#endif
+
+/* Functions used to query pager state and configuration. */
+SQLITE_PRIVATE u8 sqlite3PagerIsreadonly(Pager*);
+SQLITE_PRIVATE u32 sqlite3PagerDataVersion(Pager*);
+#ifdef SQLITE_DEBUG
+SQLITE_PRIVATE int sqlite3PagerRefcount(Pager*);
+#endif
+SQLITE_PRIVATE int sqlite3PagerMemUsed(Pager*);
+SQLITE_PRIVATE const char *sqlite3PagerFilename(const Pager*, int);
+SQLITE_PRIVATE sqlite3_vfs *sqlite3PagerVfs(Pager*);
+SQLITE_PRIVATE sqlite3_file *sqlite3PagerFile(Pager*);
+SQLITE_PRIVATE sqlite3_file *sqlite3PagerJrnlFile(Pager*);
+SQLITE_PRIVATE const char *sqlite3PagerJournalname(Pager*);
+SQLITE_PRIVATE void *sqlite3PagerTempSpace(Pager*);
+SQLITE_PRIVATE int sqlite3PagerIsMemdb(Pager*);
+SQLITE_PRIVATE void sqlite3PagerCacheStat(Pager *, int, int, u64*);
+SQLITE_PRIVATE void sqlite3PagerClearCache(Pager*);
+SQLITE_PRIVATE int sqlite3SectorSize(sqlite3_file *);
+
+/* Functions used to truncate the database file. */
+SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager*,Pgno);
+
+SQLITE_PRIVATE void sqlite3PagerRekey(DbPage*, Pgno, u16);
+
+/* Functions to support testing and debugging. */
+#if !defined(NDEBUG) || defined(SQLITE_TEST)
+SQLITE_PRIVATE Pgno sqlite3PagerPagenumber(DbPage*);
+SQLITE_PRIVATE int sqlite3PagerIswriteable(DbPage*);
+#endif
+#ifdef SQLITE_TEST
+SQLITE_PRIVATE int *sqlite3PagerStats(Pager*);
+SQLITE_PRIVATE void sqlite3PagerRefdump(Pager*);
+ void disable_simulated_io_errors(void);
+ void enable_simulated_io_errors(void);
+#else
+# define disable_simulated_io_errors()
+# define enable_simulated_io_errors()
+#endif
+
+#if defined(SQLITE_USE_SEH) && !defined(SQLITE_OMIT_WAL)
+SQLITE_PRIVATE int sqlite3PagerWalSystemErrno(Pager*);
+#endif
+
+#endif /* SQLITE_PAGER_H */
+
+/************** End of pager.h ***********************************************/
+/************** Continuing where we left off in sqliteInt.h ******************/
+/************** Include btree.h in the middle of sqliteInt.h *****************/
+/************** Begin file btree.h *******************************************/
+/*
+** 2001 September 15
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This header file defines the interface that the sqlite B-Tree file
+** subsystem. See comments in the source code for a detailed description
+** of what each interface routine does.
+*/
+#ifndef SQLITE_BTREE_H
+#define SQLITE_BTREE_H
+
+/* TODO: This definition is just included so other modules compile. It
+** needs to be revisited.
+*/
+#define SQLITE_N_BTREE_META 16
+
+/*
+** If defined as non-zero, auto-vacuum is enabled by default. Otherwise
+** it must be turned on for each database using "PRAGMA auto_vacuum = 1".
+*/
+#ifndef SQLITE_DEFAULT_AUTOVACUUM
+ #define SQLITE_DEFAULT_AUTOVACUUM 0
+#endif
+
+#define BTREE_AUTOVACUUM_NONE 0 /* Do not do auto-vacuum */
+#define BTREE_AUTOVACUUM_FULL 1 /* Do full auto-vacuum */
+#define BTREE_AUTOVACUUM_INCR 2 /* Incremental vacuum */
+
+/*
+** Forward declarations of structure
+*/
+typedef struct Btree Btree;
+typedef struct BtCursor BtCursor;
+typedef struct BtShared BtShared;
+typedef struct BtreePayload BtreePayload;
+
+
+SQLITE_PRIVATE int sqlite3BtreeOpen(
+ sqlite3_vfs *pVfs, /* VFS to use with this b-tree */
+ const char *zFilename, /* Name of database file to open */
+ sqlite3 *db, /* Associated database connection */
+ Btree **ppBtree, /* Return open Btree* here */
+ int flags, /* Flags */
+ int vfsFlags /* Flags passed through to VFS open */
+);
+
+/* The flags parameter to sqlite3BtreeOpen can be the bitwise or of the
+** following values.
+**
+** NOTE: These values must match the corresponding PAGER_ values in
+** pager.h.
+*/
+#define BTREE_OMIT_JOURNAL 1 /* Do not create or use a rollback journal */
+#define BTREE_MEMORY 2 /* This is an in-memory DB */
+#define BTREE_SINGLE 4 /* The file contains at most 1 b-tree */
+#define BTREE_UNORDERED 8 /* Use of a hash implementation is OK */
+
+SQLITE_PRIVATE int sqlite3BtreeClose(Btree*);
+SQLITE_PRIVATE int sqlite3BtreeSetCacheSize(Btree*,int);
+SQLITE_PRIVATE int sqlite3BtreeSetSpillSize(Btree*,int);
+#if SQLITE_MAX_MMAP_SIZE>0
+SQLITE_PRIVATE int sqlite3BtreeSetMmapLimit(Btree*,sqlite3_int64);
+#endif
+SQLITE_PRIVATE int sqlite3BtreeSetPagerFlags(Btree*,unsigned);
+SQLITE_PRIVATE int sqlite3BtreeSetPageSize(Btree *p, int nPagesize, int nReserve, int eFix);
+SQLITE_PRIVATE int sqlite3BtreeGetPageSize(Btree*);
+SQLITE_PRIVATE Pgno sqlite3BtreeMaxPageCount(Btree*,Pgno);
+SQLITE_PRIVATE Pgno sqlite3BtreeLastPage(Btree*);
+SQLITE_PRIVATE int sqlite3BtreeSecureDelete(Btree*,int);
+SQLITE_PRIVATE int sqlite3BtreeGetRequestedReserve(Btree*);
+SQLITE_PRIVATE int sqlite3BtreeGetReserveNoMutex(Btree *p);
+SQLITE_PRIVATE int sqlite3BtreeSetAutoVacuum(Btree *, int);
+SQLITE_PRIVATE int sqlite3BtreeGetAutoVacuum(Btree *);
+SQLITE_PRIVATE int sqlite3BtreeBeginTrans(Btree*,int,int*);
+SQLITE_PRIVATE int sqlite3BtreeCommitPhaseOne(Btree*, const char*);
+SQLITE_PRIVATE int sqlite3BtreeCommitPhaseTwo(Btree*, int);
+SQLITE_PRIVATE int sqlite3BtreeCommit(Btree*);
+SQLITE_PRIVATE int sqlite3BtreeRollback(Btree*,int,int);
+SQLITE_PRIVATE int sqlite3BtreeBeginStmt(Btree*,int);
+SQLITE_PRIVATE int sqlite3BtreeCreateTable(Btree*, Pgno*, int flags);
+SQLITE_PRIVATE int sqlite3BtreeTxnState(Btree*);
+SQLITE_PRIVATE int sqlite3BtreeIsInBackup(Btree*);
+
+SQLITE_PRIVATE void *sqlite3BtreeSchema(Btree *, int, void(*)(void *));
+SQLITE_PRIVATE int sqlite3BtreeSchemaLocked(Btree *pBtree);
+#ifndef SQLITE_OMIT_SHARED_CACHE
+SQLITE_PRIVATE int sqlite3BtreeLockTable(Btree *pBtree, int iTab, u8 isWriteLock);
+#endif
+
+/* Savepoints are named, nestable SQL transactions mostly implemented */
+/* in vdbe.c and pager.c See https://sqlite.org/lang_savepoint.html */
+SQLITE_PRIVATE int sqlite3BtreeSavepoint(Btree *, int, int);
+
+/* "Checkpoint" only refers to WAL. See https://sqlite.org/wal.html#ckpt */
+#ifndef SQLITE_OMIT_WAL
+SQLITE_PRIVATE int sqlite3BtreeCheckpoint(Btree*, int, int *, int *);
+#endif
+
+SQLITE_PRIVATE const char *sqlite3BtreeGetFilename(Btree *);
+SQLITE_PRIVATE const char *sqlite3BtreeGetJournalname(Btree *);
+SQLITE_PRIVATE int sqlite3BtreeCopyFile(Btree *, Btree *);
+
+SQLITE_PRIVATE int sqlite3BtreeIncrVacuum(Btree *);
+
+/* The flags parameter to sqlite3BtreeCreateTable can be the bitwise OR
+** of the flags shown below.
+**
+** Every SQLite table must have either BTREE_INTKEY or BTREE_BLOBKEY set.
+** With BTREE_INTKEY, the table key is a 64-bit integer and arbitrary data
+** is stored in the leaves. (BTREE_INTKEY is used for SQL tables.) With
+** BTREE_BLOBKEY, the key is an arbitrary BLOB and no content is stored
+** anywhere - the key is the content. (BTREE_BLOBKEY is used for SQL
+** indices.)
+*/
+#define BTREE_INTKEY 1 /* Table has only 64-bit signed integer keys */
+#define BTREE_BLOBKEY 2 /* Table has keys only - no data */
+
+SQLITE_PRIVATE int sqlite3BtreeDropTable(Btree*, int, int*);
+SQLITE_PRIVATE int sqlite3BtreeClearTable(Btree*, int, i64*);
+SQLITE_PRIVATE int sqlite3BtreeClearTableOfCursor(BtCursor*);
+SQLITE_PRIVATE int sqlite3BtreeTripAllCursors(Btree*, int, int);
+
+SQLITE_PRIVATE void sqlite3BtreeGetMeta(Btree *pBtree, int idx, u32 *pValue);
+SQLITE_PRIVATE int sqlite3BtreeUpdateMeta(Btree*, int idx, u32 value);
+
+SQLITE_PRIVATE int sqlite3BtreeNewDb(Btree *p);
+
+/*
+** The second parameter to sqlite3BtreeGetMeta or sqlite3BtreeUpdateMeta
+** should be one of the following values. The integer values are assigned
+** to constants so that the offset of the corresponding field in an
+** SQLite database header may be found using the following formula:
+**
+** offset = 36 + (idx * 4)
+**
+** For example, the free-page-count field is located at byte offset 36 of
+** the database file header. The incr-vacuum-flag field is located at
+** byte offset 64 (== 36+4*7).
+**
+** The BTREE_DATA_VERSION value is not really a value stored in the header.
+** It is a read-only number computed by the pager. But we merge it with
+** the header value access routines since its access pattern is the same.
+** Call it a "virtual meta value".
+*/
+#define BTREE_FREE_PAGE_COUNT 0
+#define BTREE_SCHEMA_VERSION 1
+#define BTREE_FILE_FORMAT 2
+#define BTREE_DEFAULT_CACHE_SIZE 3
+#define BTREE_LARGEST_ROOT_PAGE 4
+#define BTREE_TEXT_ENCODING 5
+#define BTREE_USER_VERSION 6
+#define BTREE_INCR_VACUUM 7
+#define BTREE_APPLICATION_ID 8
+#define BTREE_DATA_VERSION 15 /* A virtual meta-value */
+
+/*
+** Kinds of hints that can be passed into the sqlite3BtreeCursorHint()
+** interface.
+**
+** BTREE_HINT_RANGE (arguments: Expr*, Mem*)
+**
+** The first argument is an Expr* (which is guaranteed to be constant for
+** the lifetime of the cursor) that defines constraints on which rows
+** might be fetched with this cursor. The Expr* tree may contain
+** TK_REGISTER nodes that refer to values stored in the array of registers
+** passed as the second parameter. In other words, if Expr.op==TK_REGISTER
+** then the value of the node is the value in Mem[pExpr.iTable]. Any
+** TK_COLUMN node in the expression tree refers to the Expr.iColumn-th
+** column of the b-tree of the cursor. The Expr tree will not contain
+** any function calls nor subqueries nor references to b-trees other than
+** the cursor being hinted.
+**
+** The design of the _RANGE hint is aid b-tree implementations that try
+** to prefetch content from remote machines - to provide those
+** implementations with limits on what needs to be prefetched and thereby
+** reduce network bandwidth.
+**
+** Note that BTREE_HINT_FLAGS with BTREE_BULKLOAD is the only hint used by
+** standard SQLite. The other hints are provided for extensions that use
+** the SQLite parser and code generator but substitute their own storage
+** engine.
+*/
+#define BTREE_HINT_RANGE 0 /* Range constraints on queries */
+
+/*
+** Values that may be OR'd together to form the argument to the
+** BTREE_HINT_FLAGS hint for sqlite3BtreeCursorHint():
+**
+** The BTREE_BULKLOAD flag is set on index cursors when the index is going
+** to be filled with content that is already in sorted order.
+**
+** The BTREE_SEEK_EQ flag is set on cursors that will get OP_SeekGE or
+** OP_SeekLE opcodes for a range search, but where the range of entries
+** selected will all have the same key. In other words, the cursor will
+** be used only for equality key searches.
+**
+*/
+#define BTREE_BULKLOAD 0x00000001 /* Used to full index in sorted order */
+#define BTREE_SEEK_EQ 0x00000002 /* EQ seeks only - no range seeks */
+
+/*
+** Flags passed as the third argument to sqlite3BtreeCursor().
+**
+** For read-only cursors the wrFlag argument is always zero. For read-write
+** cursors it may be set to either (BTREE_WRCSR|BTREE_FORDELETE) or just
+** (BTREE_WRCSR). If the BTREE_FORDELETE bit is set, then the cursor will
+** only be used by SQLite for the following:
+**
+** * to seek to and then delete specific entries, and/or
+**
+** * to read values that will be used to create keys that other
+** BTREE_FORDELETE cursors will seek to and delete.
+**
+** The BTREE_FORDELETE flag is an optimization hint. It is not used by
+** by this, the native b-tree engine of SQLite, but it is available to
+** alternative storage engines that might be substituted in place of this
+** b-tree system. For alternative storage engines in which a delete of
+** the main table row automatically deletes corresponding index rows,
+** the FORDELETE flag hint allows those alternative storage engines to
+** skip a lot of work. Namely: FORDELETE cursors may treat all SEEK
+** and DELETE operations as no-ops, and any READ operation against a
+** FORDELETE cursor may return a null row: 0x01 0x00.
+*/
+#define BTREE_WRCSR 0x00000004 /* read-write cursor */
+#define BTREE_FORDELETE 0x00000008 /* Cursor is for seek/delete only */
+
+SQLITE_PRIVATE int sqlite3BtreeCursor(
+ Btree*, /* BTree containing table to open */
+ Pgno iTable, /* Index of root page */
+ int wrFlag, /* 1 for writing. 0 for read-only */
+ struct KeyInfo*, /* First argument to compare function */
+ BtCursor *pCursor /* Space to write cursor structure */
+);
+SQLITE_PRIVATE BtCursor *sqlite3BtreeFakeValidCursor(void);
+SQLITE_PRIVATE int sqlite3BtreeCursorSize(void);
+#ifdef SQLITE_DEBUG
+SQLITE_PRIVATE int sqlite3BtreeClosesWithCursor(Btree*,BtCursor*);
+#endif
+SQLITE_PRIVATE void sqlite3BtreeCursorZero(BtCursor*);
+SQLITE_PRIVATE void sqlite3BtreeCursorHintFlags(BtCursor*, unsigned);
+#ifdef SQLITE_ENABLE_CURSOR_HINTS
+SQLITE_PRIVATE void sqlite3BtreeCursorHint(BtCursor*, int, ...);
+#endif
+
+SQLITE_PRIVATE int sqlite3BtreeCloseCursor(BtCursor*);
+SQLITE_PRIVATE int sqlite3BtreeTableMoveto(
+ BtCursor*,
+ i64 intKey,
+ int bias,
+ int *pRes
+);
+SQLITE_PRIVATE int sqlite3BtreeIndexMoveto(
+ BtCursor*,
+ UnpackedRecord *pUnKey,
+ int *pRes
+);
+SQLITE_PRIVATE int sqlite3BtreeCursorHasMoved(BtCursor*);
+SQLITE_PRIVATE int sqlite3BtreeCursorRestore(BtCursor*, int*);
+SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor*, u8 flags);
+
+/* Allowed flags for sqlite3BtreeDelete() and sqlite3BtreeInsert() */
+#define BTREE_SAVEPOSITION 0x02 /* Leave cursor pointing at NEXT or PREV */
+#define BTREE_AUXDELETE 0x04 /* not the primary delete operation */
+#define BTREE_APPEND 0x08 /* Insert is likely an append */
+#define BTREE_PREFORMAT 0x80 /* Inserted data is a preformated cell */
+
+/* An instance of the BtreePayload object describes the content of a single
+** entry in either an index or table btree.
+**
+** Index btrees (used for indexes and also WITHOUT ROWID tables) contain
+** an arbitrary key and no data. These btrees have pKey,nKey set to the
+** key and the pData,nData,nZero fields are uninitialized. The aMem,nMem
+** fields give an array of Mem objects that are a decomposition of the key.
+** The nMem field might be zero, indicating that no decomposition is available.
+**
+** Table btrees (used for rowid tables) contain an integer rowid used as
+** the key and passed in the nKey field. The pKey field is zero.
+** pData,nData hold the content of the new entry. nZero extra zero bytes
+** are appended to the end of the content when constructing the entry.
+** The aMem,nMem fields are uninitialized for table btrees.
+**
+** Field usage summary:
+**
+** Table BTrees Index Btrees
+**
+** pKey always NULL encoded key
+** nKey the ROWID length of pKey
+** pData data not used
+** aMem not used decomposed key value
+** nMem not used entries in aMem
+** nData length of pData not used
+** nZero extra zeros after pData not used
+**
+** This object is used to pass information into sqlite3BtreeInsert(). The
+** same information used to be passed as five separate parameters. But placing
+** the information into this object helps to keep the interface more
+** organized and understandable, and it also helps the resulting code to
+** run a little faster by using fewer registers for parameter passing.
+*/
+struct BtreePayload {
+ const void *pKey; /* Key content for indexes. NULL for tables */
+ sqlite3_int64 nKey; /* Size of pKey for indexes. PRIMARY KEY for tabs */
+ const void *pData; /* Data for tables. */
+ sqlite3_value *aMem; /* First of nMem value in the unpacked pKey */
+ u16 nMem; /* Number of aMem[] value. Might be zero */
+ int nData; /* Size of pData. 0 if none. */
+ int nZero; /* Extra zero data appended after pData,nData */
+};
+
+SQLITE_PRIVATE int sqlite3BtreeInsert(BtCursor*, const BtreePayload *pPayload,
+ int flags, int seekResult);
+SQLITE_PRIVATE int sqlite3BtreeFirst(BtCursor*, int *pRes);
+SQLITE_PRIVATE int sqlite3BtreeLast(BtCursor*, int *pRes);
+SQLITE_PRIVATE int sqlite3BtreeNext(BtCursor*, int flags);
+SQLITE_PRIVATE int sqlite3BtreeEof(BtCursor*);
+SQLITE_PRIVATE int sqlite3BtreePrevious(BtCursor*, int flags);
+SQLITE_PRIVATE i64 sqlite3BtreeIntegerKey(BtCursor*);
+SQLITE_PRIVATE void sqlite3BtreeCursorPin(BtCursor*);
+SQLITE_PRIVATE void sqlite3BtreeCursorUnpin(BtCursor*);
+SQLITE_PRIVATE i64 sqlite3BtreeOffset(BtCursor*);
+SQLITE_PRIVATE int sqlite3BtreePayload(BtCursor*, u32 offset, u32 amt, void*);
+SQLITE_PRIVATE const void *sqlite3BtreePayloadFetch(BtCursor*, u32 *pAmt);
+SQLITE_PRIVATE u32 sqlite3BtreePayloadSize(BtCursor*);
+SQLITE_PRIVATE sqlite3_int64 sqlite3BtreeMaxRecordSize(BtCursor*);
+
+SQLITE_PRIVATE int sqlite3BtreeIntegrityCheck(
+ sqlite3 *db, /* Database connection that is running the check */
+ Btree *p, /* The btree to be checked */
+ Pgno *aRoot, /* An array of root pages numbers for individual trees */
+ sqlite3_value *aCnt, /* OUT: entry counts for each btree in aRoot[] */
+ int nRoot, /* Number of entries in aRoot[] */
+ int mxErr, /* Stop reporting errors after this many */
+ int *pnErr, /* OUT: Write number of errors seen to this variable */
+ char **pzOut /* OUT: Write the error message string here */
+);
+SQLITE_PRIVATE struct Pager *sqlite3BtreePager(Btree*);
+SQLITE_PRIVATE i64 sqlite3BtreeRowCountEst(BtCursor*);
+
+#ifndef SQLITE_OMIT_INCRBLOB
+SQLITE_PRIVATE int sqlite3BtreePayloadChecked(BtCursor*, u32 offset, u32 amt, void*);
+SQLITE_PRIVATE int sqlite3BtreePutData(BtCursor*, u32 offset, u32 amt, void*);
+SQLITE_PRIVATE void sqlite3BtreeIncrblobCursor(BtCursor *);
+#endif
+SQLITE_PRIVATE void sqlite3BtreeClearCursor(BtCursor *);
+SQLITE_PRIVATE int sqlite3BtreeSetVersion(Btree *pBt, int iVersion);
+SQLITE_PRIVATE int sqlite3BtreeCursorHasHint(BtCursor*, unsigned int mask);
+SQLITE_PRIVATE int sqlite3BtreeIsReadonly(Btree *pBt);
+SQLITE_PRIVATE int sqlite3HeaderSizeBtree(void);
+
+#ifdef SQLITE_DEBUG
+SQLITE_PRIVATE sqlite3_uint64 sqlite3BtreeSeekCount(Btree*);
+#else
+# define sqlite3BtreeSeekCount(X) 0
+#endif
+
+#ifndef NDEBUG
+SQLITE_PRIVATE int sqlite3BtreeCursorIsValid(BtCursor*);
+#endif
+SQLITE_PRIVATE int sqlite3BtreeCursorIsValidNN(BtCursor*);
+
+SQLITE_PRIVATE int sqlite3BtreeCount(sqlite3*, BtCursor*, i64*);
+
+#ifdef SQLITE_TEST
+SQLITE_PRIVATE int sqlite3BtreeCursorInfo(BtCursor*, int*, int);
+SQLITE_PRIVATE void sqlite3BtreeCursorList(Btree*);
+#endif
+
+#ifndef SQLITE_OMIT_WAL
+SQLITE_PRIVATE int sqlite3BtreeCheckpoint(Btree*, int, int *, int *);
+#endif
+
+SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor*, BtCursor*, i64);
+
+SQLITE_PRIVATE void sqlite3BtreeClearCache(Btree*);
+
+/*
+** If we are not using shared cache, then there is no need to
+** use mutexes to access the BtShared structures. So make the
+** Enter and Leave procedures no-ops.
+*/
+#ifndef SQLITE_OMIT_SHARED_CACHE
+SQLITE_PRIVATE void sqlite3BtreeEnter(Btree*);
+SQLITE_PRIVATE void sqlite3BtreeEnterAll(sqlite3*);
+SQLITE_PRIVATE int sqlite3BtreeSharable(Btree*);
+SQLITE_PRIVATE void sqlite3BtreeEnterCursor(BtCursor*);
+SQLITE_PRIVATE int sqlite3BtreeConnectionCount(Btree*);
+#else
+# define sqlite3BtreeEnter(X)
+# define sqlite3BtreeEnterAll(X)
+# define sqlite3BtreeSharable(X) 0
+# define sqlite3BtreeEnterCursor(X)
+# define sqlite3BtreeConnectionCount(X) 1
+#endif
+
+#if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE
+SQLITE_PRIVATE void sqlite3BtreeLeave(Btree*);
+SQLITE_PRIVATE void sqlite3BtreeLeaveCursor(BtCursor*);
+SQLITE_PRIVATE void sqlite3BtreeLeaveAll(sqlite3*);
+#ifndef NDEBUG
+ /* These routines are used inside assert() statements only. */
+SQLITE_PRIVATE int sqlite3BtreeHoldsMutex(Btree*);
+SQLITE_PRIVATE int sqlite3BtreeHoldsAllMutexes(sqlite3*);
+SQLITE_PRIVATE int sqlite3SchemaMutexHeld(sqlite3*,int,Schema*);
+#endif
+#else
+
+# define sqlite3BtreeLeave(X)
+# define sqlite3BtreeLeaveCursor(X)
+# define sqlite3BtreeLeaveAll(X)
+
+# define sqlite3BtreeHoldsMutex(X) 1
+# define sqlite3BtreeHoldsAllMutexes(X) 1
+# define sqlite3SchemaMutexHeld(X,Y,Z) 1
+#endif
+
+
+#endif /* SQLITE_BTREE_H */
+
+/************** End of btree.h ***********************************************/
+/************** Continuing where we left off in sqliteInt.h ******************/
+/************** Include vdbe.h in the middle of sqliteInt.h ******************/
+/************** Begin file vdbe.h ********************************************/
+/*
+** 2001 September 15
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** Header file for the Virtual DataBase Engine (VDBE)
+**
+** This header defines the interface to the virtual database engine
+** or VDBE. The VDBE implements an abstract machine that runs a
+** simple program to access and modify the underlying database.
+*/
+#ifndef SQLITE_VDBE_H
+#define SQLITE_VDBE_H
+/* #include <stdio.h> */
+
+/*
+** A single VDBE is an opaque structure named "Vdbe". Only routines
+** in the source file sqliteVdbe.c are allowed to see the insides
+** of this structure.
+*/
+typedef struct Vdbe Vdbe;
+
+/*
+** The names of the following types declared in vdbeInt.h are required
+** for the VdbeOp definition.
+*/
+typedef struct sqlite3_value Mem;
+typedef struct SubProgram SubProgram;
+typedef struct SubrtnSig SubrtnSig;
+
+/*
+** A signature for a reusable subroutine that materializes the RHS of
+** an IN operator.
+*/
+struct SubrtnSig {
+ int selId; /* SELECT-id for the SELECT statement on the RHS */
+ u8 bComplete; /* True if fully coded and available for reusable */
+ char *zAff; /* Affinity of the overall IN expression */
+ int iTable; /* Ephemeral table generated by the subroutine */
+ int iAddr; /* Subroutine entry address */
+ int regReturn; /* Register used to hold return address */
+};
+
+/*
+** A single instruction of the virtual machine has an opcode
+** and as many as three operands. The instruction is recorded
+** as an instance of the following structure:
+*/
+struct VdbeOp {
+ u8 opcode; /* What operation to perform */
+ signed char p4type; /* One of the P4_xxx constants for p4 */
+ u16 p5; /* Fifth parameter is an unsigned 16-bit integer */
+ int p1; /* First operand */
+ int p2; /* Second parameter (often the jump destination) */
+ int p3; /* The third parameter */
+ union p4union { /* fourth parameter */
+ int i; /* Integer value if p4type==P4_INT32 */
+ void *p; /* Generic pointer */
+ char *z; /* Pointer to data for string (char array) types */
+ i64 *pI64; /* Used when p4type is P4_INT64 */
+ double *pReal; /* Used when p4type is P4_REAL */
+ FuncDef *pFunc; /* Used when p4type is P4_FUNCDEF */
+ sqlite3_context *pCtx; /* Used when p4type is P4_FUNCCTX */
+ CollSeq *pColl; /* Used when p4type is P4_COLLSEQ */
+ Mem *pMem; /* Used when p4type is P4_MEM */
+ VTable *pVtab; /* Used when p4type is P4_VTAB */
+ KeyInfo *pKeyInfo; /* Used when p4type is P4_KEYINFO */
+ u32 *ai; /* Used when p4type is P4_INTARRAY */
+ SubProgram *pProgram; /* Used when p4type is P4_SUBPROGRAM */
+ Table *pTab; /* Used when p4type is P4_TABLE */
+ SubrtnSig *pSubrtnSig; /* Used when p4type is P4_SUBRTNSIG */
+#ifdef SQLITE_ENABLE_CURSOR_HINTS
+ Expr *pExpr; /* Used when p4type is P4_EXPR */
+#endif
+ } p4;
+#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
+ char *zComment; /* Comment to improve readability */
+#endif
+#ifdef SQLITE_VDBE_COVERAGE
+ u32 iSrcLine; /* Source-code line that generated this opcode
+ ** with flags in the upper 8 bits */
+#endif
+#if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || defined(VDBE_PROFILE)
+ u64 nExec;
+ u64 nCycle;
+#endif
+};
+typedef struct VdbeOp VdbeOp;
+
+
+/*
+** A sub-routine used to implement a trigger program.
+*/
+struct SubProgram {
+ VdbeOp *aOp; /* Array of opcodes for sub-program */
+ int nOp; /* Elements in aOp[] */
+ int nMem; /* Number of memory cells required */
+ int nCsr; /* Number of cursors required */
+ u8 *aOnce; /* Array of OP_Once flags */
+ void *token; /* id that may be used to recursive triggers */
+ SubProgram *pNext; /* Next sub-program already visited */
+};
+
+/*
+** A smaller version of VdbeOp used for the VdbeAddOpList() function because
+** it takes up less space.
+*/
+struct VdbeOpList {
+ u8 opcode; /* What operation to perform */
+ signed char p1; /* First operand */
+ signed char p2; /* Second parameter (often the jump destination) */
+ signed char p3; /* Third parameter */
+};
+typedef struct VdbeOpList VdbeOpList;
+
+/*
+** Allowed values of VdbeOp.p4type
+*/
+#define P4_NOTUSED 0 /* The P4 parameter is not used */
+#define P4_TRANSIENT 0 /* P4 is a pointer to a transient string */
+#define P4_STATIC (-1) /* Pointer to a static string */
+#define P4_COLLSEQ (-2) /* P4 is a pointer to a CollSeq structure */
+#define P4_INT32 (-3) /* P4 is a 32-bit signed integer */
+#define P4_SUBPROGRAM (-4) /* P4 is a pointer to a SubProgram structure */
+#define P4_TABLE (-5) /* P4 is a pointer to a Table structure */
+/* Above do not own any resources. Must free those below */
+#define P4_FREE_IF_LE (-6)
+#define P4_DYNAMIC (-6) /* Pointer to memory from sqliteMalloc() */
+#define P4_FUNCDEF (-7) /* P4 is a pointer to a FuncDef structure */
+#define P4_KEYINFO (-8) /* P4 is a pointer to a KeyInfo structure */
+#define P4_EXPR (-9) /* P4 is a pointer to an Expr tree */
+#define P4_MEM (-10) /* P4 is a pointer to a Mem* structure */
+#define P4_VTAB (-11) /* P4 is a pointer to an sqlite3_vtab structure */
+#define P4_REAL (-12) /* P4 is a 64-bit floating point value */
+#define P4_INT64 (-13) /* P4 is a 64-bit signed integer */
+#define P4_INTARRAY (-14) /* P4 is a vector of 32-bit integers */
+#define P4_FUNCCTX (-15) /* P4 is a pointer to an sqlite3_context object */
+#define P4_TABLEREF (-16) /* Like P4_TABLE, but reference counted */
+#define P4_SUBRTNSIG (-17) /* P4 is a SubrtnSig pointer */
+
+/* Error message codes for OP_Halt */
+#define P5_ConstraintNotNull 1
+#define P5_ConstraintUnique 2
+#define P5_ConstraintCheck 3
+#define P5_ConstraintFK 4
+
+/*
+** The Vdbe.aColName array contains 5n Mem structures, where n is the
+** number of columns of data returned by the statement.
+*/
+#define COLNAME_NAME 0
+#define COLNAME_DECLTYPE 1
+#define COLNAME_DATABASE 2
+#define COLNAME_TABLE 3
+#define COLNAME_COLUMN 4
+#ifdef SQLITE_ENABLE_COLUMN_METADATA
+# define COLNAME_N 5 /* Number of COLNAME_xxx symbols */
+#else
+# ifdef SQLITE_OMIT_DECLTYPE
+# define COLNAME_N 1 /* Store only the name */
+# else
+# define COLNAME_N 2 /* Store the name and decltype */
+# endif
+#endif
+
+/*
+** The following macro converts a label returned by sqlite3VdbeMakeLabel()
+** into an index into the Parse.aLabel[] array that contains the resolved
+** address of that label.
+*/
+#define ADDR(X) (~(X))
+
+/*
+** The makefile scans the vdbe.c source file and creates the "opcodes.h"
+** header file that defines a number for each opcode used by the VDBE.
+*/
+/************** Include opcodes.h in the middle of vdbe.h ********************/
+/************** Begin file opcodes.h *****************************************/
+/* Automatically generated. Do not edit */
+/* See the tool/mkopcodeh.tcl script for details */
+#define OP_Savepoint 0
+#define OP_AutoCommit 1
+#define OP_Transaction 2
+#define OP_Checkpoint 3
+#define OP_JournalMode 4
+#define OP_Vacuum 5
+#define OP_VFilter 6 /* jump, synopsis: iplan=r[P3] zplan='P4' */
+#define OP_VUpdate 7 /* synopsis: data=r[P3@P2] */
+#define OP_Init 8 /* jump0, synopsis: Start at P2 */
+#define OP_Goto 9 /* jump */
+#define OP_Gosub 10 /* jump */
+#define OP_InitCoroutine 11 /* jump0 */
+#define OP_Yield 12 /* jump0 */
+#define OP_MustBeInt 13 /* jump0 */
+#define OP_Jump 14 /* jump */
+#define OP_Once 15 /* jump */
+#define OP_If 16 /* jump */
+#define OP_IfNot 17 /* jump */
+#define OP_IsType 18 /* jump, synopsis: if typeof(P1.P3) in P5 goto P2 */
+#define OP_Not 19 /* same as TK_NOT, synopsis: r[P2]= !r[P1] */
+#define OP_IfNullRow 20 /* jump, synopsis: if P1.nullRow then r[P3]=NULL, goto P2 */
+#define OP_SeekLT 21 /* jump0, synopsis: key=r[P3@P4] */
+#define OP_SeekLE 22 /* jump0, synopsis: key=r[P3@P4] */
+#define OP_SeekGE 23 /* jump0, synopsis: key=r[P3@P4] */
+#define OP_SeekGT 24 /* jump0, synopsis: key=r[P3@P4] */
+#define OP_IfNotOpen 25 /* jump, synopsis: if( !csr[P1] ) goto P2 */
+#define OP_IfNoHope 26 /* jump, synopsis: key=r[P3@P4] */
+#define OP_NoConflict 27 /* jump, synopsis: key=r[P3@P4] */
+#define OP_NotFound 28 /* jump, synopsis: key=r[P3@P4] */
+#define OP_Found 29 /* jump, synopsis: key=r[P3@P4] */
+#define OP_SeekRowid 30 /* jump0, synopsis: intkey=r[P3] */
+#define OP_NotExists 31 /* jump, synopsis: intkey=r[P3] */
+#define OP_Last 32 /* jump0 */
+#define OP_IfSizeBetween 33 /* jump */
+#define OP_SorterSort 34 /* jump */
+#define OP_Sort 35 /* jump */
+#define OP_Rewind 36 /* jump0 */
+#define OP_SorterNext 37 /* jump */
+#define OP_Prev 38 /* jump */
+#define OP_Next 39 /* jump */
+#define OP_IdxLE 40 /* jump, synopsis: key=r[P3@P4] */
+#define OP_IdxGT 41 /* jump, synopsis: key=r[P3@P4] */
+#define OP_IdxLT 42 /* jump, synopsis: key=r[P3@P4] */
+#define OP_Or 43 /* same as TK_OR, synopsis: r[P3]=(r[P1] || r[P2]) */
+#define OP_And 44 /* same as TK_AND, synopsis: r[P3]=(r[P1] && r[P2]) */
+#define OP_IdxGE 45 /* jump, synopsis: key=r[P3@P4] */
+#define OP_RowSetRead 46 /* jump, synopsis: r[P3]=rowset(P1) */
+#define OP_RowSetTest 47 /* jump, synopsis: if r[P3] in rowset(P1) goto P2 */
+#define OP_Program 48 /* jump0 */
+#define OP_FkIfZero 49 /* jump, synopsis: if fkctr[P1]==0 goto P2 */
+#define OP_IfPos 50 /* jump, synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */
+#define OP_IsNull 51 /* jump, same as TK_ISNULL, synopsis: if r[P1]==NULL goto P2 */
+#define OP_NotNull 52 /* jump, same as TK_NOTNULL, synopsis: if r[P1]!=NULL goto P2 */
+#define OP_Ne 53 /* jump, same as TK_NE, synopsis: IF r[P3]!=r[P1] */
+#define OP_Eq 54 /* jump, same as TK_EQ, synopsis: IF r[P3]==r[P1] */
+#define OP_Gt 55 /* jump, same as TK_GT, synopsis: IF r[P3]>r[P1] */
+#define OP_Le 56 /* jump, same as TK_LE, synopsis: IF r[P3]<=r[P1] */
+#define OP_Lt 57 /* jump, same as TK_LT, synopsis: IF r[P3]<r[P1] */
+#define OP_Ge 58 /* jump, same as TK_GE, synopsis: IF r[P3]>=r[P1] */
+#define OP_ElseEq 59 /* jump, same as TK_ESCAPE */
+#define OP_IfNotZero 60 /* jump, synopsis: if r[P1]!=0 then r[P1]--, goto P2 */
+#define OP_DecrJumpZero 61 /* jump, synopsis: if (--r[P1])==0 goto P2 */
+#define OP_IncrVacuum 62 /* jump */
+#define OP_VNext 63 /* jump */
+#define OP_Filter 64 /* jump, synopsis: if key(P3@P4) not in filter(P1) goto P2 */
+#define OP_PureFunc 65 /* synopsis: r[P3]=func(r[P2@NP]) */
+#define OP_Function 66 /* synopsis: r[P3]=func(r[P2@NP]) */
+#define OP_Return 67
+#define OP_EndCoroutine 68
+#define OP_HaltIfNull 69 /* synopsis: if r[P3]=null halt */
+#define OP_Halt 70
+#define OP_Integer 71 /* synopsis: r[P2]=P1 */
+#define OP_Int64 72 /* synopsis: r[P2]=P4 */
+#define OP_String 73 /* synopsis: r[P2]='P4' (len=P1) */
+#define OP_BeginSubrtn 74 /* synopsis: r[P2]=NULL */
+#define OP_Null 75 /* synopsis: r[P2..P3]=NULL */
+#define OP_SoftNull 76 /* synopsis: r[P1]=NULL */
+#define OP_Blob 77 /* synopsis: r[P2]=P4 (len=P1) */
+#define OP_Variable 78 /* synopsis: r[P2]=parameter(P1) */
+#define OP_Move 79 /* synopsis: r[P2@P3]=r[P1@P3] */
+#define OP_Copy 80 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */
+#define OP_SCopy 81 /* synopsis: r[P2]=r[P1] */
+#define OP_IntCopy 82 /* synopsis: r[P2]=r[P1] */
+#define OP_FkCheck 83
+#define OP_ResultRow 84 /* synopsis: output=r[P1@P2] */
+#define OP_CollSeq 85
+#define OP_AddImm 86 /* synopsis: r[P1]=r[P1]+P2 */
+#define OP_RealAffinity 87
+#define OP_Cast 88 /* synopsis: affinity(r[P1]) */
+#define OP_Permutation 89
+#define OP_Compare 90 /* synopsis: r[P1@P3] <-> r[P2@P3] */
+#define OP_IsTrue 91 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */
+#define OP_ZeroOrNull 92 /* synopsis: r[P2] = 0 OR NULL */
+#define OP_Offset 93 /* synopsis: r[P3] = sqlite_offset(P1) */
+#define OP_Column 94 /* synopsis: r[P3]=PX cursor P1 column P2 */
+#define OP_TypeCheck 95 /* synopsis: typecheck(r[P1@P2]) */
+#define OP_Affinity 96 /* synopsis: affinity(r[P1@P2]) */
+#define OP_MakeRecord 97 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
+#define OP_Count 98 /* synopsis: r[P2]=count() */
+#define OP_ReadCookie 99
+#define OP_SetCookie 100
+#define OP_ReopenIdx 101 /* synopsis: root=P2 iDb=P3 */
+#define OP_OpenRead 102 /* synopsis: root=P2 iDb=P3 */
+#define OP_BitAnd 103 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */
+#define OP_BitOr 104 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */
+#define OP_ShiftLeft 105 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */
+#define OP_ShiftRight 106 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */
+#define OP_Add 107 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */
+#define OP_Subtract 108 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */
+#define OP_Multiply 109 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */
+#define OP_Divide 110 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
+#define OP_Remainder 111 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
+#define OP_Concat 112 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
+#define OP_OpenWrite 113 /* synopsis: root=P2 iDb=P3 */
+#define OP_OpenDup 114
+#define OP_BitNot 115 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */
+#define OP_OpenAutoindex 116 /* synopsis: nColumn=P2 */
+#define OP_OpenEphemeral 117 /* synopsis: nColumn=P2 */
+#define OP_String8 118 /* same as TK_STRING, synopsis: r[P2]='P4' */
+#define OP_SorterOpen 119
+#define OP_SequenceTest 120 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
+#define OP_OpenPseudo 121 /* synopsis: P3 columns in r[P2] */
+#define OP_Close 122
+#define OP_ColumnsUsed 123
+#define OP_SeekScan 124 /* synopsis: Scan-ahead up to P1 rows */
+#define OP_SeekHit 125 /* synopsis: set P2<=seekHit<=P3 */
+#define OP_Sequence 126 /* synopsis: r[P2]=cursor[P1].ctr++ */
+#define OP_NewRowid 127 /* synopsis: r[P2]=rowid */
+#define OP_Insert 128 /* synopsis: intkey=r[P3] data=r[P2] */
+#define OP_RowCell 129
+#define OP_Delete 130
+#define OP_ResetCount 131
+#define OP_SorterCompare 132 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
+#define OP_SorterData 133 /* synopsis: r[P2]=data */
+#define OP_RowData 134 /* synopsis: r[P2]=data */
+#define OP_Rowid 135 /* synopsis: r[P2]=PX rowid of P1 */
+#define OP_NullRow 136
+#define OP_SeekEnd 137
+#define OP_IdxInsert 138 /* synopsis: key=r[P2] */
+#define OP_SorterInsert 139 /* synopsis: key=r[P2] */
+#define OP_IdxDelete 140 /* synopsis: key=r[P2@P3] */
+#define OP_DeferredSeek 141 /* synopsis: Move P3 to P1.rowid if needed */
+#define OP_IdxRowid 142 /* synopsis: r[P2]=rowid */
+#define OP_FinishSeek 143
+#define OP_Destroy 144
+#define OP_Clear 145
+#define OP_ResetSorter 146
+#define OP_CreateBtree 147 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
+#define OP_SqlExec 148
+#define OP_ParseSchema 149
+#define OP_LoadAnalysis 150
+#define OP_DropTable 151
+#define OP_DropIndex 152
+#define OP_DropTrigger 153
+#define OP_Real 154 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
+#define OP_IntegrityCk 155
+#define OP_RowSetAdd 156 /* synopsis: rowset(P1)=r[P2] */
+#define OP_Param 157
+#define OP_FkCounter 158 /* synopsis: fkctr[P1]+=P2 */
+#define OP_MemMax 159 /* synopsis: r[P1]=max(r[P1],r[P2]) */
+#define OP_OffsetLimit 160 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
+#define OP_AggInverse 161 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
+#define OP_AggStep 162 /* synopsis: accum=r[P3] step(r[P2@P5]) */
+#define OP_AggStep1 163 /* synopsis: accum=r[P3] step(r[P2@P5]) */
+#define OP_AggValue 164 /* synopsis: r[P3]=value N=P2 */
+#define OP_AggFinal 165 /* synopsis: accum=r[P1] N=P2 */
+#define OP_Expire 166
+#define OP_CursorLock 167
+#define OP_CursorUnlock 168
+#define OP_TableLock 169 /* synopsis: iDb=P1 root=P2 write=P3 */
+#define OP_VBegin 170
+#define OP_VCreate 171
+#define OP_VDestroy 172
+#define OP_VOpen 173
+#define OP_VCheck 174
+#define OP_VInitIn 175 /* synopsis: r[P2]=ValueList(P1,P3) */
+#define OP_VColumn 176 /* synopsis: r[P3]=vcolumn(P2) */
+#define OP_VRename 177
+#define OP_Pagecount 178
+#define OP_MaxPgcnt 179
+#define OP_ClrSubtype 180 /* synopsis: r[P1].subtype = 0 */
+#define OP_GetSubtype 181 /* synopsis: r[P2] = r[P1].subtype */
+#define OP_SetSubtype 182 /* synopsis: r[P2].subtype = r[P1] */
+#define OP_FilterAdd 183 /* synopsis: filter(P1) += key(P3@P4) */
+#define OP_Trace 184
+#define OP_CursorHint 185
+#define OP_ReleaseReg 186 /* synopsis: release r[P1@P2] mask P3 */
+#define OP_Noop 187
+#define OP_Explain 188
+#define OP_Abortable 189
+
+/* Properties such as "out2" or "jump" that are specified in
+** comments following the "case" for each opcode in the vdbe.c
+** are encoded into bitvectors as follows:
+*/
+#define OPFLG_JUMP 0x01 /* jump: P2 holds jmp target */
+#define OPFLG_IN1 0x02 /* in1: P1 is an input */
+#define OPFLG_IN2 0x04 /* in2: P2 is an input */
+#define OPFLG_IN3 0x08 /* in3: P3 is an input */
+#define OPFLG_OUT2 0x10 /* out2: P2 is an output */
+#define OPFLG_OUT3 0x20 /* out3: P3 is an output */
+#define OPFLG_NCYCLE 0x40 /* ncycle:Cycles count against P1 */
+#define OPFLG_JUMP0 0x80 /* jump0: P2 might be zero */
+#define OPFLG_INITIALIZER {\
+/* 0 */ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x41, 0x00,\
+/* 8 */ 0x81, 0x01, 0x01, 0x81, 0x83, 0x83, 0x01, 0x01,\
+/* 16 */ 0x03, 0x03, 0x01, 0x12, 0x01, 0xc9, 0xc9, 0xc9,\
+/* 24 */ 0xc9, 0x01, 0x49, 0x49, 0x49, 0x49, 0xc9, 0x49,\
+/* 32 */ 0xc1, 0x01, 0x41, 0x41, 0xc1, 0x01, 0x41, 0x41,\
+/* 40 */ 0x41, 0x41, 0x41, 0x26, 0x26, 0x41, 0x23, 0x0b,\
+/* 48 */ 0x81, 0x01, 0x03, 0x03, 0x03, 0x0b, 0x0b, 0x0b,\
+/* 56 */ 0x0b, 0x0b, 0x0b, 0x01, 0x03, 0x03, 0x01, 0x41,\
+/* 64 */ 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x00, 0x10,\
+/* 72 */ 0x10, 0x10, 0x00, 0x10, 0x00, 0x10, 0x10, 0x00,\
+/* 80 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x02, 0x02,\
+/* 88 */ 0x02, 0x00, 0x00, 0x12, 0x1e, 0x20, 0x40, 0x00,\
+/* 96 */ 0x00, 0x00, 0x10, 0x10, 0x00, 0x40, 0x40, 0x26,\
+/* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,\
+/* 112 */ 0x26, 0x00, 0x40, 0x12, 0x40, 0x40, 0x10, 0x00,\
+/* 120 */ 0x00, 0x00, 0x40, 0x00, 0x40, 0x40, 0x10, 0x10,\
+/* 128 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x50,\
+/* 136 */ 0x00, 0x40, 0x04, 0x04, 0x00, 0x40, 0x50, 0x40,\
+/* 144 */ 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,\
+/* 152 */ 0x00, 0x00, 0x10, 0x00, 0x06, 0x10, 0x00, 0x04,\
+/* 160 */ 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
+/* 168 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x10, 0x50,\
+/* 176 */ 0x40, 0x00, 0x10, 0x10, 0x02, 0x12, 0x12, 0x00,\
+/* 184 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,}
+
+/* The resolve3P2Values() routine is able to run faster if it knows
+** the value of the largest JUMP opcode. The smaller the maximum
+** JUMP opcode the better, so the mkopcodeh.tcl script that
+** generated this include file strives to group all JUMP opcodes
+** together near the beginning of the list.
+*/
+#define SQLITE_MX_JUMP_OPCODE 64 /* Maximum JUMP opcode */
+
+/************** End of opcodes.h *********************************************/
+/************** Continuing where we left off in vdbe.h ***********************/
+
+/*
+** Additional non-public SQLITE_PREPARE_* flags
+*/
+#define SQLITE_PREPARE_SAVESQL 0x80 /* Preserve SQL text */
+#define SQLITE_PREPARE_MASK 0x1f /* Mask of public flags */
+
+/*
+** Prototypes for the VDBE interface. See comments on the implementation
+** for a description of what each of these routines does.
+*/
+SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(Parse*);
+SQLITE_PRIVATE Parse *sqlite3VdbeParser(Vdbe*);
+SQLITE_PRIVATE int sqlite3VdbeAddOp0(Vdbe*,int);
+SQLITE_PRIVATE int sqlite3VdbeAddOp1(Vdbe*,int,int);
+SQLITE_PRIVATE int sqlite3VdbeAddOp2(Vdbe*,int,int,int);
+SQLITE_PRIVATE int sqlite3VdbeGoto(Vdbe*,int);
+SQLITE_PRIVATE int sqlite3VdbeLoadString(Vdbe*,int,const char*);
+SQLITE_PRIVATE void sqlite3VdbeMultiLoad(Vdbe*,int,const char*,...);
+SQLITE_PRIVATE int sqlite3VdbeAddOp3(Vdbe*,int,int,int,int);
+SQLITE_PRIVATE int sqlite3VdbeAddOp4(Vdbe*,int,int,int,int,const char *zP4,int);
+SQLITE_PRIVATE int sqlite3VdbeAddOp4Dup8(Vdbe*,int,int,int,int,const u8*,int);
+SQLITE_PRIVATE int sqlite3VdbeAddOp4Int(Vdbe*,int,int,int,int,int);
+SQLITE_PRIVATE int sqlite3VdbeAddFunctionCall(Parse*,int,int,int,int,const FuncDef*,int);
+SQLITE_PRIVATE void sqlite3VdbeEndCoroutine(Vdbe*,int);
+#if defined(SQLITE_DEBUG) && !defined(SQLITE_TEST_REALLOC_STRESS)
+SQLITE_PRIVATE void sqlite3VdbeVerifyNoMallocRequired(Vdbe *p, int N);
+SQLITE_PRIVATE void sqlite3VdbeVerifyNoResultRow(Vdbe *p);
+#else
+# define sqlite3VdbeVerifyNoMallocRequired(A,B)
+# define sqlite3VdbeVerifyNoResultRow(A)
+#endif
+#if defined(SQLITE_DEBUG)
+SQLITE_PRIVATE void sqlite3VdbeVerifyAbortable(Vdbe *p, int);
+SQLITE_PRIVATE void sqlite3VdbeNoJumpsOutsideSubrtn(Vdbe*,int,int,int);
+#else
+# define sqlite3VdbeVerifyAbortable(A,B)
+# define sqlite3VdbeNoJumpsOutsideSubrtn(A,B,C,D)
+#endif
+SQLITE_PRIVATE VdbeOp *sqlite3VdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp,int iLineno);
+#ifndef SQLITE_OMIT_EXPLAIN
+SQLITE_PRIVATE int sqlite3VdbeExplain(Parse*,u8,const char*,...);
+SQLITE_PRIVATE void sqlite3VdbeExplainPop(Parse*);
+SQLITE_PRIVATE int sqlite3VdbeExplainParent(Parse*);
+# define ExplainQueryPlan(P) sqlite3VdbeExplain P
+# ifdef SQLITE_ENABLE_STMT_SCANSTATUS
+# define ExplainQueryPlan2(V,P) (V = sqlite3VdbeExplain P)
+# else
+# define ExplainQueryPlan2(V,P) ExplainQueryPlan(P)
+# endif
+# define ExplainQueryPlanPop(P) sqlite3VdbeExplainPop(P)
+# define ExplainQueryPlanParent(P) sqlite3VdbeExplainParent(P)
+#else
+# define ExplainQueryPlan(P)
+# define ExplainQueryPlan2(V,P)
+# define ExplainQueryPlanPop(P)
+# define ExplainQueryPlanParent(P) 0
+# define sqlite3ExplainBreakpoint(A,B) /*no-op*/
+#endif
+#if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_EXPLAIN)
+SQLITE_PRIVATE void sqlite3ExplainBreakpoint(const char*,const char*);
+#else
+# define sqlite3ExplainBreakpoint(A,B) /*no-op*/
+#endif
+SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe*, int, char*, u16);
+SQLITE_PRIVATE void sqlite3VdbeChangeOpcode(Vdbe*, int addr, u8);
+SQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe*, int addr, int P1);
+SQLITE_PRIVATE void sqlite3VdbeChangeP2(Vdbe*, int addr, int P2);
+SQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe*, int addr, int P3);
+SQLITE_PRIVATE void sqlite3VdbeChangeP5(Vdbe*, u16 P5);
+SQLITE_PRIVATE void sqlite3VdbeTypeofColumn(Vdbe*, int);
+SQLITE_PRIVATE void sqlite3VdbeJumpHere(Vdbe*, int addr);
+SQLITE_PRIVATE void sqlite3VdbeJumpHereOrPopInst(Vdbe*, int addr);
+SQLITE_PRIVATE int sqlite3VdbeChangeToNoop(Vdbe*, int addr);
+SQLITE_PRIVATE int sqlite3VdbeDeletePriorOpcode(Vdbe*, u8 op);
+#ifdef SQLITE_DEBUG
+SQLITE_PRIVATE void sqlite3VdbeReleaseRegisters(Parse*,int addr, int n, u32 mask, int);
+#else
+# define sqlite3VdbeReleaseRegisters(P,A,N,M,F)
+#endif
+SQLITE_PRIVATE void sqlite3VdbeChangeP4(Vdbe*, int addr, const char *zP4, int N);
+SQLITE_PRIVATE void sqlite3VdbeAppendP4(Vdbe*, void *pP4, int p4type);
+SQLITE_PRIVATE void sqlite3VdbeSetP4KeyInfo(Parse*, Index*);
+SQLITE_PRIVATE void sqlite3VdbeUsesBtree(Vdbe*, int);
+SQLITE_PRIVATE VdbeOp *sqlite3VdbeGetOp(Vdbe*, int);
+SQLITE_PRIVATE VdbeOp *sqlite3VdbeGetLastOp(Vdbe*);
+SQLITE_PRIVATE int sqlite3VdbeMakeLabel(Parse*);
+SQLITE_PRIVATE void sqlite3VdbeRunOnlyOnce(Vdbe*);
+SQLITE_PRIVATE void sqlite3VdbeReusable(Vdbe*);
+SQLITE_PRIVATE void sqlite3VdbeDelete(Vdbe*);
+SQLITE_PRIVATE void sqlite3VdbeMakeReady(Vdbe*,Parse*);
+SQLITE_PRIVATE int sqlite3VdbeFinalize(Vdbe*);
+SQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe*, int);
+SQLITE_PRIVATE int sqlite3VdbeCurrentAddr(Vdbe*);
+#ifdef SQLITE_DEBUG
+SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *, int);
+#endif
+SQLITE_PRIVATE void sqlite3VdbeResetStepResult(Vdbe*);
+SQLITE_PRIVATE void sqlite3VdbeRewind(Vdbe*);
+SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe*);
+SQLITE_PRIVATE void sqlite3VdbeSetNumCols(Vdbe*,int);
+SQLITE_PRIVATE int sqlite3VdbeSetColName(Vdbe*, int, int, const char *, void(*)(void*));
+SQLITE_PRIVATE void sqlite3VdbeCountChanges(Vdbe*);
+SQLITE_PRIVATE sqlite3 *sqlite3VdbeDb(Vdbe*);
+SQLITE_PRIVATE u8 sqlite3VdbePrepareFlags(Vdbe*);
+SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe*, const char *z, int n, u8);
+#ifdef SQLITE_ENABLE_NORMALIZE
+SQLITE_PRIVATE void sqlite3VdbeAddDblquoteStr(sqlite3*,Vdbe*,const char*);
+SQLITE_PRIVATE int sqlite3VdbeUsesDoubleQuotedString(Vdbe*,const char*);
+#endif
+SQLITE_PRIVATE void sqlite3VdbeSwap(Vdbe*,Vdbe*);
+SQLITE_PRIVATE VdbeOp *sqlite3VdbeTakeOpArray(Vdbe*, int*, int*);
+SQLITE_PRIVATE sqlite3_value *sqlite3VdbeGetBoundValue(Vdbe*, int, u8);
+SQLITE_PRIVATE void sqlite3VdbeSetVarmask(Vdbe*, int);
+#ifndef SQLITE_OMIT_TRACE
+SQLITE_PRIVATE char *sqlite3VdbeExpandSql(Vdbe*, const char*);
+#endif
+SQLITE_PRIVATE int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*);
+SQLITE_PRIVATE int sqlite3BlobCompare(const Mem*, const Mem*);
+
+SQLITE_PRIVATE void sqlite3VdbeRecordUnpack(KeyInfo*,int,const void*,UnpackedRecord*);
+SQLITE_PRIVATE int sqlite3VdbeRecordCompare(int,const void*,UnpackedRecord*);
+SQLITE_PRIVATE int sqlite3VdbeRecordCompareWithSkip(int, const void *, UnpackedRecord *, int);
+SQLITE_PRIVATE UnpackedRecord *sqlite3VdbeAllocUnpackedRecord(KeyInfo*);
+
+typedef int (*RecordCompare)(int,const void*,UnpackedRecord*);
+SQLITE_PRIVATE RecordCompare sqlite3VdbeFindCompare(UnpackedRecord*);
+
+SQLITE_PRIVATE void sqlite3VdbeLinkSubProgram(Vdbe *, SubProgram *);
+SQLITE_PRIVATE int sqlite3VdbeHasSubProgram(Vdbe*);
+
+SQLITE_PRIVATE void sqlite3MemSetArrayInt64(sqlite3_value *aMem, int iIdx, i64 val);
+
+SQLITE_PRIVATE int sqlite3NotPureFunc(sqlite3_context*);
+#ifdef SQLITE_ENABLE_BYTECODE_VTAB
+SQLITE_PRIVATE int sqlite3VdbeBytecodeVtabInit(sqlite3*);
+#endif
+
+/* Use SQLITE_ENABLE_COMMENTS to enable generation of extra comments on
+** each VDBE opcode.
+**
+** Use the SQLITE_ENABLE_MODULE_COMMENTS macro to see some extra no-op
+** comments in VDBE programs that show key decision points in the code
+** generator.
+*/
+#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
+SQLITE_PRIVATE void sqlite3VdbeComment(Vdbe*, const char*, ...);
+# define VdbeComment(X) sqlite3VdbeComment X
+SQLITE_PRIVATE void sqlite3VdbeNoopComment(Vdbe*, const char*, ...);
+# define VdbeNoopComment(X) sqlite3VdbeNoopComment X
+# ifdef SQLITE_ENABLE_MODULE_COMMENTS
+# define VdbeModuleComment(X) sqlite3VdbeNoopComment X
+# else
+# define VdbeModuleComment(X)
+# endif
+#else
+# define VdbeComment(X)
+# define VdbeNoopComment(X)
+# define VdbeModuleComment(X)
+#endif
+
+/*
+** The VdbeCoverage macros are used to set a coverage testing point
+** for VDBE branch instructions. The coverage testing points are line
+** numbers in the sqlite3.c source file. VDBE branch coverage testing
+** only works with an amalgamation build. That's ok since a VDBE branch
+** coverage build designed for testing the test suite only. No application
+** should ever ship with VDBE branch coverage measuring turned on.
+**
+** VdbeCoverage(v) // Mark the previously coded instruction
+** // as a branch
+**
+** VdbeCoverageIf(v, conditional) // Mark previous if conditional true
+**
+** VdbeCoverageAlwaysTaken(v) // Previous branch is always taken
+**
+** VdbeCoverageNeverTaken(v) // Previous branch is never taken
+**
+** VdbeCoverageNeverNull(v) // Previous three-way branch is only
+** // taken on the first two ways. The
+** // NULL option is not possible
+**
+** VdbeCoverageEqNe(v) // Previous OP_Jump is only interested
+** // in distinguishing equal and not-equal.
+**
+** Every VDBE branch operation must be tagged with one of the macros above.
+** If not, then when "make test" is run with -DSQLITE_VDBE_COVERAGE and
+** -DSQLITE_DEBUG then an ALWAYS() will fail in the vdbeTakeBranch()
+** routine in vdbe.c, alerting the developer to the missed tag.
+**
+** During testing, the test application will invoke
+** sqlite3_test_control(SQLITE_TESTCTRL_VDBE_COVERAGE,...) to set a callback
+** routine that is invoked as each bytecode branch is taken. The callback
+** contains the sqlite3.c source line number of the VdbeCoverage macro and
+** flags to indicate whether or not the branch was taken. The test application
+** is responsible for keeping track of this and reporting byte-code branches
+** that are never taken.
+**
+** See the VdbeBranchTaken() macro and vdbeTakeBranch() function in the
+** vdbe.c source file for additional information.
+*/
+#ifdef SQLITE_VDBE_COVERAGE
+SQLITE_PRIVATE void sqlite3VdbeSetLineNumber(Vdbe*,int);
+# define VdbeCoverage(v) sqlite3VdbeSetLineNumber(v,__LINE__)
+# define VdbeCoverageIf(v,x) if(x)sqlite3VdbeSetLineNumber(v,__LINE__)
+# define VdbeCoverageAlwaysTaken(v) \
+ sqlite3VdbeSetLineNumber(v,__LINE__|0x5000000);
+# define VdbeCoverageNeverTaken(v) \
+ sqlite3VdbeSetLineNumber(v,__LINE__|0x6000000);
+# define VdbeCoverageNeverNull(v) \
+ sqlite3VdbeSetLineNumber(v,__LINE__|0x4000000);
+# define VdbeCoverageNeverNullIf(v,x) \
+ if(x)sqlite3VdbeSetLineNumber(v,__LINE__|0x4000000);
+# define VdbeCoverageEqNe(v) \
+ sqlite3VdbeSetLineNumber(v,__LINE__|0x8000000);
+# define VDBE_OFFSET_LINENO(x) (__LINE__+x)
+#else
+# define VdbeCoverage(v)
+# define VdbeCoverageIf(v,x)
+# define VdbeCoverageAlwaysTaken(v)
+# define VdbeCoverageNeverTaken(v)
+# define VdbeCoverageNeverNull(v)
+# define VdbeCoverageNeverNullIf(v,x)
+# define VdbeCoverageEqNe(v)
+# define VDBE_OFFSET_LINENO(x) 0
+#endif
+
+#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
+SQLITE_PRIVATE void sqlite3VdbeScanStatus(Vdbe*, int, int, int, LogEst, const char*);
+SQLITE_PRIVATE void sqlite3VdbeScanStatusRange(Vdbe*, int, int, int);
+SQLITE_PRIVATE void sqlite3VdbeScanStatusCounters(Vdbe*, int, int, int);
+#else
+# define sqlite3VdbeScanStatus(a,b,c,d,e,f)
+# define sqlite3VdbeScanStatusRange(a,b,c,d)
+# define sqlite3VdbeScanStatusCounters(a,b,c,d)
+#endif
+
+#if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)
+SQLITE_PRIVATE void sqlite3VdbePrintOp(FILE*, int, VdbeOp*);
+#endif
+
+#if defined(SQLITE_ENABLE_CURSOR_HINTS) && defined(SQLITE_DEBUG)
+SQLITE_PRIVATE int sqlite3CursorRangeHintExprCheck(Walker *pWalker, Expr *pExpr);
+#endif
+
+#endif /* SQLITE_VDBE_H */
+
+/************** End of vdbe.h ************************************************/
+/************** Continuing where we left off in sqliteInt.h ******************/
+/************** Include pcache.h in the middle of sqliteInt.h ****************/
+/************** Begin file pcache.h ******************************************/
+/*
+** 2008 August 05
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This header file defines the interface that the sqlite page cache
+** subsystem.
+*/
+
+#ifndef _PCACHE_H_
+
+typedef struct PgHdr PgHdr;
+typedef struct PCache PCache;
+
+/*
+** Every page in the cache is controlled by an instance of the following
+** structure.
+*/
+struct PgHdr {
+ sqlite3_pcache_page *pPage; /* Pcache object page handle */
+ void *pData; /* Page data */
+ void *pExtra; /* Extra content */
+ PCache *pCache; /* PRIVATE: Cache that owns this page */
+ PgHdr *pDirty; /* Transient list of dirty sorted by pgno */
+ Pager *pPager; /* The pager this page is part of */
+ Pgno pgno; /* Page number for this page */
+#ifdef SQLITE_CHECK_PAGES
+ u32 pageHash; /* Hash of page content */
+#endif
+ u16 flags; /* PGHDR flags defined below */
+
+ /**********************************************************************
+ ** Elements above, except pCache, are public. All that follow are
+ ** private to pcache.c and should not be accessed by other modules.
+ ** pCache is grouped with the public elements for efficiency.
+ */
+ i64 nRef; /* Number of users of this page */
+ PgHdr *pDirtyNext; /* Next element in list of dirty pages */
+ PgHdr *pDirtyPrev; /* Previous element in list of dirty pages */
+ /* NB: pDirtyNext and pDirtyPrev are undefined if the
+ ** PgHdr object is not dirty */
+};
+
+/* Bit values for PgHdr.flags */
+#define PGHDR_CLEAN 0x001 /* Page not on the PCache.pDirty list */
+#define PGHDR_DIRTY 0x002 /* Page is on the PCache.pDirty list */
+#define PGHDR_WRITEABLE 0x004 /* Journaled and ready to modify */
+#define PGHDR_NEED_SYNC 0x008 /* Fsync the rollback journal before
+ ** writing this page to the database */
+#define PGHDR_DONT_WRITE 0x010 /* Do not write content to disk */
+#define PGHDR_MMAP 0x020 /* This is an mmap page object */
+
+#define PGHDR_WAL_APPEND 0x040 /* Appended to wal file */
+
+/* Initialize and shutdown the page cache subsystem */
+SQLITE_PRIVATE int sqlite3PcacheInitialize(void);
+SQLITE_PRIVATE void sqlite3PcacheShutdown(void);
+
+/* Page cache buffer management:
+** These routines implement SQLITE_CONFIG_PAGECACHE.
+*/
+SQLITE_PRIVATE void sqlite3PCacheBufferSetup(void *, int sz, int n);
+
+/* Create a new pager cache.
+** Under memory stress, invoke xStress to try to make pages clean.
+** Only clean and unpinned pages can be reclaimed.
+*/
+SQLITE_PRIVATE int sqlite3PcacheOpen(
+ int szPage, /* Size of every page */
+ int szExtra, /* Extra space associated with each page */
+ int bPurgeable, /* True if pages are on backing store */
+ int (*xStress)(void*, PgHdr*), /* Call to try to make pages clean */
+ void *pStress, /* Argument to xStress */
+ PCache *pToInit /* Preallocated space for the PCache */
+);
+
+/* Modify the page-size after the cache has been created. */
+SQLITE_PRIVATE int sqlite3PcacheSetPageSize(PCache *, int);
+
+/* Return the size in bytes of a PCache object. Used to preallocate
+** storage space.
+*/
+SQLITE_PRIVATE int sqlite3PcacheSize(void);
+
+/* One release per successful fetch. Page is pinned until released.
+** Reference counted.
+*/
+SQLITE_PRIVATE sqlite3_pcache_page *sqlite3PcacheFetch(PCache*, Pgno, int createFlag);
+SQLITE_PRIVATE int sqlite3PcacheFetchStress(PCache*, Pgno, sqlite3_pcache_page**);
+SQLITE_PRIVATE PgHdr *sqlite3PcacheFetchFinish(PCache*, Pgno, sqlite3_pcache_page *pPage);
+SQLITE_PRIVATE void sqlite3PcacheRelease(PgHdr*);
+
+SQLITE_PRIVATE void sqlite3PcacheDrop(PgHdr*); /* Remove page from cache */
+SQLITE_PRIVATE void sqlite3PcacheMakeDirty(PgHdr*); /* Make sure page is marked dirty */
+SQLITE_PRIVATE void sqlite3PcacheMakeClean(PgHdr*); /* Mark a single page as clean */
+SQLITE_PRIVATE void sqlite3PcacheCleanAll(PCache*); /* Mark all dirty list pages as clean */
+SQLITE_PRIVATE void sqlite3PcacheClearWritable(PCache*);
+
+/* Change a page number. Used by incr-vacuum. */
+SQLITE_PRIVATE void sqlite3PcacheMove(PgHdr*, Pgno);
+
+/* Remove all pages with pgno>x. Reset the cache if x==0 */
+SQLITE_PRIVATE void sqlite3PcacheTruncate(PCache*, Pgno x);
+
+/* Get a list of all dirty pages in the cache, sorted by page number */
+SQLITE_PRIVATE PgHdr *sqlite3PcacheDirtyList(PCache*);
+
+/* Reset and close the cache object */
+SQLITE_PRIVATE void sqlite3PcacheClose(PCache*);
+
+/* Clear flags from pages of the page cache */
+SQLITE_PRIVATE void sqlite3PcacheClearSyncFlags(PCache *);
+
+/* Discard the contents of the cache */
+SQLITE_PRIVATE void sqlite3PcacheClear(PCache*);
+
+/* Return the total number of outstanding page references */
+SQLITE_PRIVATE i64 sqlite3PcacheRefCount(PCache*);
+
+/* Increment the reference count of an existing page */
+SQLITE_PRIVATE void sqlite3PcacheRef(PgHdr*);
+
+SQLITE_PRIVATE i64 sqlite3PcachePageRefcount(PgHdr*);
+
+/* Return the total number of pages stored in the cache */
+SQLITE_PRIVATE int sqlite3PcachePagecount(PCache*);
+
+#if defined(SQLITE_CHECK_PAGES) || defined(SQLITE_DEBUG)
+/* Iterate through all dirty pages currently stored in the cache. This
+** interface is only available if SQLITE_CHECK_PAGES is defined when the
+** library is built.
+*/
+SQLITE_PRIVATE void sqlite3PcacheIterateDirty(PCache *pCache, void (*xIter)(PgHdr *));
+#endif
+
+#if defined(SQLITE_DEBUG)
+/* Check invariants on a PgHdr object */
+SQLITE_PRIVATE int sqlite3PcachePageSanity(PgHdr*);
+#endif
+
+/* Set and get the suggested cache-size for the specified pager-cache.
+**
+** If no global maximum is configured, then the system attempts to limit
+** the total number of pages cached by purgeable pager-caches to the sum
+** of the suggested cache-sizes.
+*/
+SQLITE_PRIVATE void sqlite3PcacheSetCachesize(PCache *, int);
+#ifdef SQLITE_TEST
+SQLITE_PRIVATE int sqlite3PcacheGetCachesize(PCache *);
+#endif
+
+/* Set or get the suggested spill-size for the specified pager-cache.
+**
+** The spill-size is the minimum number of pages in cache before the cache
+** will attempt to spill dirty pages by calling xStress.
+*/
+SQLITE_PRIVATE int sqlite3PcacheSetSpillsize(PCache *, int);
+
+/* Free up as much memory as possible from the page cache */
+SQLITE_PRIVATE void sqlite3PcacheShrink(PCache*);
+
+#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
+/* Try to return memory used by the pcache module to the main memory heap */
+SQLITE_PRIVATE int sqlite3PcacheReleaseMemory(int);
+#endif
+
+#ifdef SQLITE_TEST
+SQLITE_PRIVATE void sqlite3PcacheStats(int*,int*,int*,int*);
+#endif
+
+SQLITE_PRIVATE void sqlite3PCacheSetDefault(void);
+
+/* Return the header size */
+SQLITE_PRIVATE int sqlite3HeaderSizePcache(void);
+SQLITE_PRIVATE int sqlite3HeaderSizePcache1(void);
+
+/* Number of dirty pages as a percentage of the configured cache size */
+SQLITE_PRIVATE int sqlite3PCachePercentDirty(PCache*);
+
+#ifdef SQLITE_DIRECT_OVERFLOW_READ
+SQLITE_PRIVATE int sqlite3PCacheIsDirty(PCache *pCache);
+#endif
+
+#endif /* _PCACHE_H_ */
+
+/************** End of pcache.h **********************************************/
+/************** Continuing where we left off in sqliteInt.h ******************/
+/************** Include mutex.h in the middle of sqliteInt.h *****************/
+/************** Begin file mutex.h *******************************************/
+/*
+** 2007 August 28
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+**
+** This file contains the common header for all mutex implementations.
+** The sqliteInt.h header #includes this file so that it is available
+** to all source files. We break it out in an effort to keep the code
+** better organized.
+**
+** NOTE: source files should *not* #include this header file directly.
+** Source files should #include the sqliteInt.h file and let that file
+** include this one indirectly.
+*/
+
+
+/*
+** Figure out what version of the code to use. The choices are
+**
+** SQLITE_MUTEX_OMIT No mutex logic. Not even stubs. The
+** mutexes implementation cannot be overridden
+** at start-time.
+**
+** SQLITE_MUTEX_NOOP For single-threaded applications. No
+** mutual exclusion is provided. But this
+** implementation can be overridden at
+** start-time.
+**
+** SQLITE_MUTEX_PTHREADS For multi-threaded applications on Unix.
+**
+** SQLITE_MUTEX_W32 For multi-threaded applications on Win32.
+*/
+#if !SQLITE_THREADSAFE
+# define SQLITE_MUTEX_OMIT
+#endif
+#if SQLITE_THREADSAFE && !defined(SQLITE_MUTEX_NOOP)
+# if SQLITE_OS_UNIX
+# define SQLITE_MUTEX_PTHREADS
+# elif SQLITE_OS_WIN
+# define SQLITE_MUTEX_W32
+# else
+# define SQLITE_MUTEX_NOOP
+# endif
+#endif
+
+#ifdef SQLITE_MUTEX_OMIT
+/*
+** If this is a no-op implementation, implement everything as macros.
+*/
+#define sqlite3_mutex_alloc(X) ((sqlite3_mutex*)8)
+#define sqlite3_mutex_free(X)
+#define sqlite3_mutex_enter(X)
+#define sqlite3_mutex_try(X) SQLITE_OK
+#define sqlite3_mutex_leave(X)
+#define sqlite3_mutex_held(X) ((void)(X),1)
+#define sqlite3_mutex_notheld(X) ((void)(X),1)
+#define sqlite3MutexAlloc(X) ((sqlite3_mutex*)8)
+#define sqlite3MutexInit() SQLITE_OK
+#define sqlite3MutexEnd()
+#define MUTEX_LOGIC(X)
+#else
+#define MUTEX_LOGIC(X) X
+SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*);
+#endif /* defined(SQLITE_MUTEX_OMIT) */
+
+/************** End of mutex.h ***********************************************/
+/************** Continuing where we left off in sqliteInt.h ******************/
+
+/* The SQLITE_EXTRA_DURABLE compile-time option used to set the default
+** synchronous setting to EXTRA. It is no longer supported.
+*/
+#ifdef SQLITE_EXTRA_DURABLE
+# warning Use SQLITE_DEFAULT_SYNCHRONOUS=3 instead of SQLITE_EXTRA_DURABLE
+# define SQLITE_DEFAULT_SYNCHRONOUS 3
+#endif
+
+/*
+** Default synchronous levels.
+**
+** Note that (for historical reasons) the PAGER_SYNCHRONOUS_* macros differ
+** from the SQLITE_DEFAULT_SYNCHRONOUS value by 1.
+**
+** PAGER_SYNCHRONOUS DEFAULT_SYNCHRONOUS
+** OFF 1 0
+** NORMAL 2 1
+** FULL 3 2
+** EXTRA 4 3
+**
+** The "PRAGMA synchronous" statement also uses the zero-based numbers.
+** In other words, the zero-based numbers are used for all external interfaces
+** and the one-based values are used internally.
+*/
+#ifndef SQLITE_DEFAULT_SYNCHRONOUS
+# define SQLITE_DEFAULT_SYNCHRONOUS 2
+#endif
+#ifndef SQLITE_DEFAULT_WAL_SYNCHRONOUS
+# define SQLITE_DEFAULT_WAL_SYNCHRONOUS SQLITE_DEFAULT_SYNCHRONOUS
+#endif
+
+/*
+** Each database file to be accessed by the system is an instance
+** of the following structure. There are normally two of these structures
+** in the sqlite.aDb[] array. aDb[0] is the main database file and
+** aDb[1] is the database file used to hold temporary tables. Additional
+** databases may be attached.
+*/
+struct Db {
+ char *zDbSName; /* Name of this database. (schema name, not filename) */
+ Btree *pBt; /* The B*Tree structure for this database file */
+ u8 safety_level; /* How aggressive at syncing data to disk */
+ u8 bSyncSet; /* True if "PRAGMA synchronous=N" has been run */
+ Schema *pSchema; /* Pointer to database schema (possibly shared) */
+};
+
+/*
+** An instance of the following structure stores a database schema.
+**
+** Most Schema objects are associated with a Btree. The exception is
+** the Schema for the TEMP database (sqlite3.aDb[1]) which is free-standing.
+** In shared cache mode, a single Schema object can be shared by multiple
+** Btrees that refer to the same underlying BtShared object.
+**
+** Schema objects are automatically deallocated when the last Btree that
+** references them is destroyed. The TEMP Schema is manually freed by
+** sqlite3_close().
+*
+** A thread must be holding a mutex on the corresponding Btree in order
+** to access Schema content. This implies that the thread must also be
+** holding a mutex on the sqlite3 connection pointer that owns the Btree.
+** For a TEMP Schema, only the connection mutex is required.
+*/
+struct Schema {
+ int schema_cookie; /* Database schema version number for this file */
+ int iGeneration; /* Generation counter. Incremented with each change */
+ Hash tblHash; /* All tables indexed by name */
+ Hash idxHash; /* All (named) indices indexed by name */
+ Hash trigHash; /* All triggers indexed by name */
+ Hash fkeyHash; /* All foreign keys by referenced table name */
+ Table *pSeqTab; /* The sqlite_sequence table used by AUTOINCREMENT */
+ u8 file_format; /* Schema format version for this file */
+ u8 enc; /* Text encoding used by this database */
+ u16 schemaFlags; /* Flags associated with this schema */
+ int cache_size; /* Number of pages to use in the cache */
+};
+
+/*
+** These macros can be used to test, set, or clear bits in the
+** Db.pSchema->flags field.
+*/
+#define DbHasProperty(D,I,P) (((D)->aDb[I].pSchema->schemaFlags&(P))==(P))
+#define DbHasAnyProperty(D,I,P) (((D)->aDb[I].pSchema->schemaFlags&(P))!=0)
+#define DbSetProperty(D,I,P) (D)->aDb[I].pSchema->schemaFlags|=(P)
+#define DbClearProperty(D,I,P) (D)->aDb[I].pSchema->schemaFlags&=~(P)
+
+/*
+** Allowed values for the DB.pSchema->flags field.
+**
+** The DB_SchemaLoaded flag is set after the database schema has been
+** read into internal hash tables.
+**
+** DB_UnresetViews means that one or more views have column names that
+** have been filled out. If the schema changes, these column names might
+** changes and so the view will need to be reset.
+*/
+#define DB_SchemaLoaded 0x0001 /* The schema has been loaded */
+#define DB_UnresetViews 0x0002 /* Some views have defined column names */
+#define DB_ResetWanted 0x0008 /* Reset the schema when nSchemaLock==0 */
+
+/*
+** The number of different kinds of things that can be limited
+** using the sqlite3_limit() interface.
+*/
+#define SQLITE_N_LIMIT (SQLITE_LIMIT_WORKER_THREADS+1)
+
+/*
+** Lookaside malloc is a set of fixed-size buffers that can be used
+** to satisfy small transient memory allocation requests for objects
+** associated with a particular database connection. The use of
+** lookaside malloc provides a significant performance enhancement
+** (approx 10%) by avoiding numerous malloc/free requests while parsing
+** SQL statements.
+**
+** The Lookaside structure holds configuration information about the
+** lookaside malloc subsystem. Each available memory allocation in
+** the lookaside subsystem is stored on a linked list of LookasideSlot
+** objects.
+**
+** Lookaside allocations are only allowed for objects that are associated
+** with a particular database connection. Hence, schema information cannot
+** be stored in lookaside because in shared cache mode the schema information
+** is shared by multiple database connections. Therefore, while parsing
+** schema information, the Lookaside.bEnabled flag is cleared so that
+** lookaside allocations are not used to construct the schema objects.
+**
+** New lookaside allocations are only allowed if bDisable==0. When
+** bDisable is greater than zero, sz is set to zero which effectively
+** disables lookaside without adding a new test for the bDisable flag
+** in a performance-critical path. sz should be set by to szTrue whenever
+** bDisable changes back to zero.
+**
+** Lookaside buffers are initially held on the pInit list. As they are
+** used and freed, they are added back to the pFree list. New allocations
+** come off of pFree first, then pInit as a fallback. This dual-list
+** allows use to compute a high-water mark - the maximum number of allocations
+** outstanding at any point in the past - by subtracting the number of
+** allocations on the pInit list from the total number of allocations.
+**
+** Enhancement on 2019-12-12: Two-size-lookaside
+** The default lookaside configuration is 100 slots of 1200 bytes each.
+** The larger slot sizes are important for performance, but they waste
+** a lot of space, as most lookaside allocations are less than 128 bytes.
+** The two-size-lookaside enhancement breaks up the lookaside allocation
+** into two pools: One of 128-byte slots and the other of the default size
+** (1200-byte) slots. Allocations are filled from the small-pool first,
+** failing over to the full-size pool if that does not work. Thus more
+** lookaside slots are available while also using less memory.
+** This enhancement can be omitted by compiling with
+** SQLITE_OMIT_TWOSIZE_LOOKASIDE.
+*/
+struct Lookaside {
+ u32 bDisable; /* Only operate the lookaside when zero */
+ u16 sz; /* Size of each buffer in bytes */
+ u16 szTrue; /* True value of sz, even if disabled */
+ u8 bMalloced; /* True if pStart obtained from sqlite3_malloc() */
+ u32 nSlot; /* Number of lookaside slots allocated */
+ u32 anStat[3]; /* 0: hits. 1: size misses. 2: full misses */
+ LookasideSlot *pInit; /* List of buffers not previously used */
+ LookasideSlot *pFree; /* List of available buffers */
+#ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE
+ LookasideSlot *pSmallInit; /* List of small buffers not previously used */
+ LookasideSlot *pSmallFree; /* List of available small buffers */
+ void *pMiddle; /* First byte past end of full-size buffers and
+ ** the first byte of LOOKASIDE_SMALL buffers */
+#endif /* SQLITE_OMIT_TWOSIZE_LOOKASIDE */
+ void *pStart; /* First byte of available memory space */
+ void *pEnd; /* First byte past end of available space */
+ void *pTrueEnd; /* True value of pEnd, when db->pnBytesFreed!=0 */
+};
+struct LookasideSlot {
+ LookasideSlot *pNext; /* Next buffer in the list of free buffers */
+};
+
+#define DisableLookaside db->lookaside.bDisable++;db->lookaside.sz=0
+#define EnableLookaside db->lookaside.bDisable--;\
+ db->lookaside.sz=db->lookaside.bDisable?0:db->lookaside.szTrue
+
+/* Size of the smaller allocations in two-size lookaside */
+#ifdef SQLITE_OMIT_TWOSIZE_LOOKASIDE
+# define LOOKASIDE_SMALL 0
+#else
+# define LOOKASIDE_SMALL 128
+#endif
+
+/*
+** A hash table for built-in function definitions. (Application-defined
+** functions use a regular table table from hash.h.)
+**
+** Hash each FuncDef structure into one of the FuncDefHash.a[] slots.
+** Collisions are on the FuncDef.u.pHash chain. Use the SQLITE_FUNC_HASH()
+** macro to compute a hash on the function name.
+*/
+#define SQLITE_FUNC_HASH_SZ 23
+struct FuncDefHash {
+ FuncDef *a[SQLITE_FUNC_HASH_SZ]; /* Hash table for functions */
+};
+#define SQLITE_FUNC_HASH(C,L) (((C)+(L))%SQLITE_FUNC_HASH_SZ)
+
+/*
+** typedef for the authorization callback function.
+*/
+typedef int (*sqlite3_xauth)(void*,int,const char*,const char*,const char*,
+ const char*);
+
+#ifndef SQLITE_OMIT_DEPRECATED
+/* This is an extra SQLITE_TRACE macro that indicates "legacy" tracing
+** in the style of sqlite3_trace()
+*/
+#define SQLITE_TRACE_LEGACY 0x40 /* Use the legacy xTrace */
+#define SQLITE_TRACE_XPROFILE 0x80 /* Use the legacy xProfile */
+#else
+#define SQLITE_TRACE_LEGACY 0
+#define SQLITE_TRACE_XPROFILE 0
+#endif /* SQLITE_OMIT_DEPRECATED */
+#define SQLITE_TRACE_NONLEGACY_MASK 0x0f /* Normal flags */
+
+/*
+** Maximum number of sqlite3.aDb[] entries. This is the number of attached
+** databases plus 2 for "main" and "temp".
+*/
+#define SQLITE_MAX_DB (SQLITE_MAX_ATTACHED+2)
+
+/*
+** Each database connection is an instance of the following structure.
+*/
+struct sqlite3 {
+ sqlite3_vfs *pVfs; /* OS Interface */
+ struct Vdbe *pVdbe; /* List of active virtual machines */
+ CollSeq *pDfltColl; /* BINARY collseq for the database encoding */
+ sqlite3_mutex *mutex; /* Connection mutex */
+ Db *aDb; /* All backends */
+ int nDb; /* Number of backends currently in use */
+ u32 mDbFlags; /* flags recording internal state */
+ u64 flags; /* flags settable by pragmas. See below */
+ i64 lastRowid; /* ROWID of most recent insert (see above) */
+ i64 szMmap; /* Default mmap_size setting */
+ u32 nSchemaLock; /* Do not reset the schema when non-zero */
+ unsigned int openFlags; /* Flags passed to sqlite3_vfs.xOpen() */
+ int errCode; /* Most recent error code (SQLITE_*) */
+ int errByteOffset; /* Byte offset of error in SQL statement */
+ int errMask; /* & result codes with this before returning */
+ int iSysErrno; /* Errno value from last system error */
+ u32 dbOptFlags; /* Flags to enable/disable optimizations */
+ u8 enc; /* Text encoding */
+ u8 autoCommit; /* The auto-commit flag. */
+ u8 temp_store; /* 1: file 2: memory 0: default */
+ u8 mallocFailed; /* True if we have seen a malloc failure */
+ u8 bBenignMalloc; /* Do not require OOMs if true */
+ u8 dfltLockMode; /* Default locking-mode for attached dbs */
+ signed char nextAutovac; /* Autovac setting after VACUUM if >=0 */
+ u8 suppressErr; /* Do not issue error messages if true */
+ u8 vtabOnConflict; /* Value to return for s3_vtab_on_conflict() */
+ u8 isTransactionSavepoint; /* True if the outermost savepoint is a TS */
+ u8 mTrace; /* zero or more SQLITE_TRACE flags */
+ u8 noSharedCache; /* True if no shared-cache backends */
+ u8 nSqlExec; /* Number of pending OP_SqlExec opcodes */
+ u8 eOpenState; /* Current condition of the connection */
+ int nextPagesize; /* Pagesize after VACUUM if >0 */
+ i64 nChange; /* Value returned by sqlite3_changes() */
+ i64 nTotalChange; /* Value returned by sqlite3_total_changes() */
+ int aLimit[SQLITE_N_LIMIT]; /* Limits */
+ int nMaxSorterMmap; /* Maximum size of regions mapped by sorter */
+ struct sqlite3InitInfo { /* Information used during initialization */
+ Pgno newTnum; /* Rootpage of table being initialized */
+ u8 iDb; /* Which db file is being initialized */
+ u8 busy; /* TRUE if currently initializing */
+ unsigned orphanTrigger : 1; /* Last statement is orphaned TEMP trigger */
+ unsigned imposterTable : 1; /* Building an imposter table */
+ unsigned reopenMemdb : 1; /* ATTACH is really a reopen using MemDB */
+ const char **azInit; /* "type", "name", and "tbl_name" columns */
+ } init;
+ int nVdbeActive; /* Number of VDBEs currently running */
+ int nVdbeRead; /* Number of active VDBEs that read or write */
+ int nVdbeWrite; /* Number of active VDBEs that read and write */
+ int nVdbeExec; /* Number of nested calls to VdbeExec() */
+ int nVDestroy; /* Number of active OP_VDestroy operations */
+ int nExtension; /* Number of loaded extensions */
+ void **aExtension; /* Array of shared library handles */
+ union {
+ void (*xLegacy)(void*,const char*); /* mTrace==SQLITE_TRACE_LEGACY */
+ int (*xV2)(u32,void*,void*,void*); /* All other mTrace values */
+ } trace;
+ void *pTraceArg; /* Argument to the trace function */
+#ifndef SQLITE_OMIT_DEPRECATED
+ void (*xProfile)(void*,const char*,u64); /* Profiling function */
+ void *pProfileArg; /* Argument to profile function */
+#endif
+ void *pCommitArg; /* Argument to xCommitCallback() */
+ int (*xCommitCallback)(void*); /* Invoked at every commit. */
+ void *pRollbackArg; /* Argument to xRollbackCallback() */
+ void (*xRollbackCallback)(void*); /* Invoked at every commit. */
+ void *pUpdateArg;
+ void (*xUpdateCallback)(void*,int, const char*,const char*,sqlite_int64);
+ void *pAutovacPagesArg; /* Client argument to autovac_pages */
+ void (*xAutovacDestr)(void*); /* Destructor for pAutovacPAgesArg */
+ unsigned int (*xAutovacPages)(void*,const char*,u32,u32,u32);
+ Parse *pParse; /* Current parse */
+#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
+ void *pPreUpdateArg; /* First argument to xPreUpdateCallback */
+ void (*xPreUpdateCallback)( /* Registered using sqlite3_preupdate_hook() */
+ void*,sqlite3*,int,char const*,char const*,sqlite3_int64,sqlite3_int64
+ );
+ PreUpdate *pPreUpdate; /* Context for active pre-update callback */
+#endif /* SQLITE_ENABLE_PREUPDATE_HOOK */
+#ifndef SQLITE_OMIT_WAL
+ int (*xWalCallback)(void *, sqlite3 *, const char *, int);
+ void *pWalArg;
+#endif
+ void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*);
+ void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*);
+ void *pCollNeededArg;
+ sqlite3_value *pErr; /* Most recent error message */
+ union {
+ volatile int isInterrupted; /* True if sqlite3_interrupt has been called */
+ double notUsed1; /* Spacer */
+ } u1;
+ Lookaside lookaside; /* Lookaside malloc configuration */
+#ifndef SQLITE_OMIT_AUTHORIZATION
+ sqlite3_xauth xAuth; /* Access authorization function */
+ void *pAuthArg; /* 1st argument to the access auth function */
+#endif
+#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
+ int (*xProgress)(void *); /* The progress callback */
+ void *pProgressArg; /* Argument to the progress callback */
+ unsigned nProgressOps; /* Number of opcodes for progress callback */
+#endif
+#ifndef SQLITE_OMIT_VIRTUALTABLE
+ int nVTrans; /* Allocated size of aVTrans */
+ Hash aModule; /* populated by sqlite3_create_module() */
+ VtabCtx *pVtabCtx; /* Context for active vtab connect/create */
+ VTable **aVTrans; /* Virtual tables with open transactions */
+ VTable *pDisconnect; /* Disconnect these in next sqlite3_prepare() */
+#endif
+ Hash aFunc; /* Hash table of connection functions */
+ Hash aCollSeq; /* All collating sequences */
+ BusyHandler busyHandler; /* Busy callback */
+ Db aDbStatic[2]; /* Static space for the 2 default backends */
+ Savepoint *pSavepoint; /* List of active savepoints */
+ int nAnalysisLimit; /* Number of index rows to ANALYZE */
+ int busyTimeout; /* Busy handler timeout, in msec */
+ int nSavepoint; /* Number of non-transaction savepoints */
+ int nStatement; /* Number of nested statement-transactions */
+ i64 nDeferredCons; /* Net deferred constraints this transaction. */
+ i64 nDeferredImmCons; /* Net deferred immediate constraints */
+ int *pnBytesFreed; /* If not NULL, increment this in DbFree() */
+ DbClientData *pDbData; /* sqlite3_set_clientdata() content */
+#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY
+ /* The following variables are all protected by the STATIC_MAIN
+ ** mutex, not by sqlite3.mutex. They are used by code in notify.c.
+ **
+ ** When X.pUnlockConnection==Y, that means that X is waiting for Y to
+ ** unlock so that it can proceed.
+ **
+ ** When X.pBlockingConnection==Y, that means that something that X tried
+ ** tried to do recently failed with an SQLITE_LOCKED error due to locks
+ ** held by Y.
+ */
+ sqlite3 *pBlockingConnection; /* Connection that caused SQLITE_LOCKED */
+ sqlite3 *pUnlockConnection; /* Connection to watch for unlock */
+ void *pUnlockArg; /* Argument to xUnlockNotify */
+ void (*xUnlockNotify)(void **, int); /* Unlock notify callback */
+ sqlite3 *pNextBlocked; /* Next in list of all blocked connections */
+#endif
+};
+
+/*
+** A macro to discover the encoding of a database.
+*/
+#define SCHEMA_ENC(db) ((db)->aDb[0].pSchema->enc)
+#define ENC(db) ((db)->enc)
+
+/*
+** A u64 constant where the lower 32 bits are all zeros. Only the
+** upper 32 bits are included in the argument. Necessary because some
+** C-compilers still do not accept LL integer literals.
+*/
+#define HI(X) ((u64)(X)<<32)
+
+/*
+** Possible values for the sqlite3.flags.
+**
+** Value constraints (enforced via assert()):
+** SQLITE_FullFSync == PAGER_FULLFSYNC
+** SQLITE_CkptFullFSync == PAGER_CKPT_FULLFSYNC
+** SQLITE_CacheSpill == PAGER_CACHE_SPILL
+*/
+#define SQLITE_WriteSchema 0x00000001 /* OK to update SQLITE_SCHEMA */
+#define SQLITE_LegacyFileFmt 0x00000002 /* Create new databases in format 1 */
+#define SQLITE_FullColNames 0x00000004 /* Show full column names on SELECT */
+#define SQLITE_FullFSync 0x00000008 /* Use full fsync on the backend */
+#define SQLITE_CkptFullFSync 0x00000010 /* Use full fsync for checkpoint */
+#define SQLITE_CacheSpill 0x00000020 /* OK to spill pager cache */
+#define SQLITE_ShortColNames 0x00000040 /* Show short columns names */
+#define SQLITE_TrustedSchema 0x00000080 /* Allow unsafe functions and
+ ** vtabs in the schema definition */
+#define SQLITE_NullCallback 0x00000100 /* Invoke the callback once if the */
+ /* result set is empty */
+#define SQLITE_IgnoreChecks 0x00000200 /* Do not enforce check constraints */
+#define SQLITE_StmtScanStatus 0x00000400 /* Enable stmt_scanstats() counters */
+#define SQLITE_NoCkptOnClose 0x00000800 /* No checkpoint on close()/DETACH */
+#define SQLITE_ReverseOrder 0x00001000 /* Reverse unordered SELECTs */
+#define SQLITE_RecTriggers 0x00002000 /* Enable recursive triggers */
+#define SQLITE_ForeignKeys 0x00004000 /* Enforce foreign key constraints */
+#define SQLITE_AutoIndex 0x00008000 /* Enable automatic indexes */
+#define SQLITE_LoadExtension 0x00010000 /* Enable load_extension */
+#define SQLITE_LoadExtFunc 0x00020000 /* Enable load_extension() SQL func */
+#define SQLITE_EnableTrigger 0x00040000 /* True to enable triggers */
+#define SQLITE_DeferFKs 0x00080000 /* Defer all FK constraints */
+#define SQLITE_QueryOnly 0x00100000 /* Disable database changes */
+#define SQLITE_CellSizeCk 0x00200000 /* Check btree cell sizes on load */
+#define SQLITE_Fts3Tokenizer 0x00400000 /* Enable fts3_tokenizer(2) */
+#define SQLITE_EnableQPSG 0x00800000 /* Query Planner Stability Guarantee*/
+#define SQLITE_TriggerEQP 0x01000000 /* Show trigger EXPLAIN QUERY PLAN */
+#define SQLITE_ResetDatabase 0x02000000 /* Reset the database */
+#define SQLITE_LegacyAlter 0x04000000 /* Legacy ALTER TABLE behaviour */
+#define SQLITE_NoSchemaError 0x08000000 /* Do not report schema parse errors*/
+#define SQLITE_Defensive 0x10000000 /* Input SQL is likely hostile */
+#define SQLITE_DqsDDL 0x20000000 /* dbl-quoted strings allowed in DDL*/
+#define SQLITE_DqsDML 0x40000000 /* dbl-quoted strings allowed in DML*/
+#define SQLITE_EnableView 0x80000000 /* Enable the use of views */
+#define SQLITE_CountRows HI(0x00001) /* Count rows changed by INSERT, */
+ /* DELETE, or UPDATE and return */
+ /* the count using a callback. */
+#define SQLITE_CorruptRdOnly HI(0x00002) /* Prohibit writes due to error */
+#define SQLITE_ReadUncommit HI(0x00004) /* READ UNCOMMITTED in shared-cache */
+#define SQLITE_FkNoAction HI(0x00008) /* Treat all FK as NO ACTION */
+#define SQLITE_AttachCreate HI(0x00010) /* ATTACH allowed to create new dbs */
+#define SQLITE_AttachWrite HI(0x00020) /* ATTACH allowed to open for write */
+#define SQLITE_Comments HI(0x00040) /* Enable SQL comments */
+
+/* Flags used only if debugging */
+#ifdef SQLITE_DEBUG
+#define SQLITE_SqlTrace HI(0x0100000) /* Debug print SQL as it executes */
+#define SQLITE_VdbeListing HI(0x0200000) /* Debug listings of VDBE progs */
+#define SQLITE_VdbeTrace HI(0x0400000) /* True to trace VDBE execution */
+#define SQLITE_VdbeAddopTrace HI(0x0800000) /* Trace sqlite3VdbeAddOp() calls */
+#define SQLITE_VdbeEQP HI(0x1000000) /* Debug EXPLAIN QUERY PLAN */
+#define SQLITE_ParserTrace HI(0x2000000) /* PRAGMA parser_trace=ON */
+#endif
+
+/*
+** Allowed values for sqlite3.mDbFlags
+*/
+#define DBFLAG_SchemaChange 0x0001 /* Uncommitted Hash table changes */
+#define DBFLAG_PreferBuiltin 0x0002 /* Preference to built-in funcs */
+#define DBFLAG_Vacuum 0x0004 /* Currently in a VACUUM */
+#define DBFLAG_VacuumInto 0x0008 /* Currently running VACUUM INTO */
+#define DBFLAG_SchemaKnownOk 0x0010 /* Schema is known to be valid */
+#define DBFLAG_InternalFunc 0x0020 /* Allow use of internal functions */
+#define DBFLAG_EncodingFixed 0x0040 /* No longer possible to change enc. */
+
+/*
+** Bits of the sqlite3.dbOptFlags field that are used by the
+** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface to
+** selectively disable various optimizations.
+*/
+#define SQLITE_QueryFlattener 0x00000001 /* Query flattening */
+#define SQLITE_WindowFunc 0x00000002 /* Use xInverse for window functions */
+#define SQLITE_GroupByOrder 0x00000004 /* GROUPBY cover of ORDERBY */
+#define SQLITE_FactorOutConst 0x00000008 /* Constant factoring */
+#define SQLITE_DistinctOpt 0x00000010 /* DISTINCT using indexes */
+#define SQLITE_CoverIdxScan 0x00000020 /* Covering index scans */
+#define SQLITE_OrderByIdxJoin 0x00000040 /* ORDER BY of joins via index */
+#define SQLITE_Transitive 0x00000080 /* Transitive constraints */
+#define SQLITE_OmitNoopJoin 0x00000100 /* Omit unused tables in joins */
+#define SQLITE_CountOfView 0x00000200 /* The count-of-view optimization */
+#define SQLITE_CursorHints 0x00000400 /* Add OP_CursorHint opcodes */
+#define SQLITE_Stat4 0x00000800 /* Use STAT4 data */
+ /* TH3 expects this value ^^^^^^^^^^ to be 0x0000800. Don't change it */
+#define SQLITE_PushDown 0x00001000 /* WHERE-clause push-down opt */
+#define SQLITE_SimplifyJoin 0x00002000 /* Convert LEFT JOIN to JOIN */
+#define SQLITE_SkipScan 0x00004000 /* Skip-scans */
+#define SQLITE_PropagateConst 0x00008000 /* The constant propagation opt */
+#define SQLITE_MinMaxOpt 0x00010000 /* The min/max optimization */
+#define SQLITE_SeekScan 0x00020000 /* The OP_SeekScan optimization */
+#define SQLITE_OmitOrderBy 0x00040000 /* Omit pointless ORDER BY */
+ /* TH3 expects this value ^^^^^^^^^^ to be 0x40000. Coordinate any change */
+#define SQLITE_BloomFilter 0x00080000 /* Use a Bloom filter on searches */
+#define SQLITE_BloomPulldown 0x00100000 /* Run Bloom filters early */
+#define SQLITE_BalancedMerge 0x00200000 /* Balance multi-way merges */
+#define SQLITE_ReleaseReg 0x00400000 /* Use OP_ReleaseReg for testing */
+#define SQLITE_FlttnUnionAll 0x00800000 /* Disable the UNION ALL flattener */
+ /* TH3 expects this value ^^^^^^^^^^ See flatten04.test */
+#define SQLITE_IndexedExpr 0x01000000 /* Pull exprs from index when able */
+#define SQLITE_Coroutines 0x02000000 /* Co-routines for subqueries */
+#define SQLITE_NullUnusedCols 0x04000000 /* NULL unused columns in subqueries */
+#define SQLITE_OnePass 0x08000000 /* Single-pass DELETE and UPDATE */
+#define SQLITE_OrderBySubq 0x10000000 /* ORDER BY in subquery helps outer */
+#define SQLITE_StarQuery 0x20000000 /* Heurists for star queries */
+#define SQLITE_AllOpts 0xffffffff /* All optimizations */
+
+/*
+** Macros for testing whether or not optimizations are enabled or disabled.
+*/
+#define OptimizationDisabled(db, mask) (((db)->dbOptFlags&(mask))!=0)
+#define OptimizationEnabled(db, mask) (((db)->dbOptFlags&(mask))==0)
+
+/*
+** Return true if it OK to factor constant expressions into the initialization
+** code. The argument is a Parse object for the code generator.
+*/
+#define ConstFactorOk(P) ((P)->okConstFactor)
+
+/* Possible values for the sqlite3.eOpenState field.
+** The numbers are randomly selected such that a minimum of three bits must
+** change to convert any number to another or to zero
+*/
+#define SQLITE_STATE_OPEN 0x76 /* Database is open */
+#define SQLITE_STATE_CLOSED 0xce /* Database is closed */
+#define SQLITE_STATE_SICK 0xba /* Error and awaiting close */
+#define SQLITE_STATE_BUSY 0x6d /* Database currently in use */
+#define SQLITE_STATE_ERROR 0xd5 /* An SQLITE_MISUSE error occurred */
+#define SQLITE_STATE_ZOMBIE 0xa7 /* Close with last statement close */
+
+/*
+** Each SQL function is defined by an instance of the following
+** structure. For global built-in functions (ex: substr(), max(), count())
+** a pointer to this structure is held in the sqlite3BuiltinFunctions object.
+** For per-connection application-defined functions, a pointer to this
+** structure is held in the db->aHash hash table.
+**
+** The u.pHash field is used by the global built-ins. The u.pDestructor
+** field is used by per-connection app-def functions.
+*/
+struct FuncDef {
+ i16 nArg; /* Number of arguments. -1 means unlimited */
+ u32 funcFlags; /* Some combination of SQLITE_FUNC_* */
+ void *pUserData; /* User data parameter */
+ FuncDef *pNext; /* Next function with same name */
+ void (*xSFunc)(sqlite3_context*,int,sqlite3_value**); /* func or agg-step */
+ void (*xFinalize)(sqlite3_context*); /* Agg finalizer */
+ void (*xValue)(sqlite3_context*); /* Current agg value */
+ void (*xInverse)(sqlite3_context*,int,sqlite3_value**); /* inverse agg-step */
+ const char *zName; /* SQL name of the function. */
+ union {
+ FuncDef *pHash; /* Next with a different name but the same hash */
+ FuncDestructor *pDestructor; /* Reference counted destructor function */
+ } u; /* pHash if SQLITE_FUNC_BUILTIN, pDestructor otherwise */
+};
+
+/*
+** This structure encapsulates a user-function destructor callback (as
+** configured using create_function_v2()) and a reference counter. When
+** create_function_v2() is called to create a function with a destructor,
+** a single object of this type is allocated. FuncDestructor.nRef is set to
+** the number of FuncDef objects created (either 1 or 3, depending on whether
+** or not the specified encoding is SQLITE_ANY). The FuncDef.pDestructor
+** member of each of the new FuncDef objects is set to point to the allocated
+** FuncDestructor.
+**
+** Thereafter, when one of the FuncDef objects is deleted, the reference
+** count on this object is decremented. When it reaches 0, the destructor
+** is invoked and the FuncDestructor structure freed.
+*/
+struct FuncDestructor {
+ int nRef;
+ void (*xDestroy)(void *);
+ void *pUserData;
+};
+
+/*
+** Possible values for FuncDef.flags. Note that the _LENGTH and _TYPEOF
+** values must correspond to OPFLAG_LENGTHARG and OPFLAG_TYPEOFARG. And
+** SQLITE_FUNC_CONSTANT must be the same as SQLITE_DETERMINISTIC. There
+** are assert() statements in the code to verify this.
+**
+** Value constraints (enforced via assert()):
+** SQLITE_FUNC_MINMAX == NC_MinMaxAgg == SF_MinMaxAgg
+** SQLITE_FUNC_ANYORDER == NC_OrderAgg == SF_OrderByReqd
+** SQLITE_FUNC_LENGTH == OPFLAG_LENGTHARG
+** SQLITE_FUNC_TYPEOF == OPFLAG_TYPEOFARG
+** SQLITE_FUNC_BYTELEN == OPFLAG_BYTELENARG
+** SQLITE_FUNC_CONSTANT == SQLITE_DETERMINISTIC from the API
+** SQLITE_FUNC_DIRECT == SQLITE_DIRECTONLY from the API
+** SQLITE_FUNC_UNSAFE == SQLITE_INNOCUOUS -- opposite meanings!!!
+** SQLITE_FUNC_ENCMASK depends on SQLITE_UTF* macros in the API
+**
+** Note that even though SQLITE_FUNC_UNSAFE and SQLITE_INNOCUOUS have the
+** same bit value, their meanings are inverted. SQLITE_FUNC_UNSAFE is
+** used internally and if set means that the function has side effects.
+** SQLITE_INNOCUOUS is used by application code and means "not unsafe".
+** See multiple instances of tag-20230109-1.
+*/
+#define SQLITE_FUNC_ENCMASK 0x0003 /* SQLITE_UTF8, SQLITE_UTF16BE or UTF16LE */
+#define SQLITE_FUNC_LIKE 0x0004 /* Candidate for the LIKE optimization */
+#define SQLITE_FUNC_CASE 0x0008 /* Case-sensitive LIKE-type function */
+#define SQLITE_FUNC_EPHEM 0x0010 /* Ephemeral. Delete with VDBE */
+#define SQLITE_FUNC_NEEDCOLL 0x0020 /* sqlite3GetFuncCollSeq() might be called*/
+#define SQLITE_FUNC_LENGTH 0x0040 /* Built-in length() function */
+#define SQLITE_FUNC_TYPEOF 0x0080 /* Built-in typeof() function */
+#define SQLITE_FUNC_BYTELEN 0x00c0 /* Built-in octet_length() function */
+#define SQLITE_FUNC_COUNT 0x0100 /* Built-in count(*) aggregate */
+/* 0x0200 -- available for reuse */
+#define SQLITE_FUNC_UNLIKELY 0x0400 /* Built-in unlikely() function */
+#define SQLITE_FUNC_CONSTANT 0x0800 /* Constant inputs give a constant output */
+#define SQLITE_FUNC_MINMAX 0x1000 /* True for min() and max() aggregates */
+#define SQLITE_FUNC_SLOCHNG 0x2000 /* "Slow Change". Value constant during a
+ ** single query - might change over time */
+#define SQLITE_FUNC_TEST 0x4000 /* Built-in testing functions */
+#define SQLITE_FUNC_RUNONLY 0x8000 /* Cannot be used by valueFromFunction */
+#define SQLITE_FUNC_WINDOW 0x00010000 /* Built-in window-only function */
+#define SQLITE_FUNC_INTERNAL 0x00040000 /* For use by NestedParse() only */
+#define SQLITE_FUNC_DIRECT 0x00080000 /* Not for use in TRIGGERs or VIEWs */
+/* SQLITE_SUBTYPE 0x00100000 // Consumer of subtypes */
+#define SQLITE_FUNC_UNSAFE 0x00200000 /* Function has side effects */
+#define SQLITE_FUNC_INLINE 0x00400000 /* Functions implemented in-line */
+#define SQLITE_FUNC_BUILTIN 0x00800000 /* This is a built-in function */
+/* SQLITE_RESULT_SUBTYPE 0x01000000 // Generator of subtypes */
+#define SQLITE_FUNC_ANYORDER 0x08000000 /* count/min/max aggregate */
+
+/* Identifier numbers for each in-line function */
+#define INLINEFUNC_coalesce 0
+#define INLINEFUNC_implies_nonnull_row 1
+#define INLINEFUNC_expr_implies_expr 2
+#define INLINEFUNC_expr_compare 3
+#define INLINEFUNC_affinity 4
+#define INLINEFUNC_iif 5
+#define INLINEFUNC_sqlite_offset 6
+#define INLINEFUNC_unlikely 99 /* Default case */
+
+/*
+** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are
+** used to create the initializers for the FuncDef structures.
+**
+** FUNCTION(zName, nArg, iArg, bNC, xFunc)
+** Used to create a scalar function definition of a function zName
+** implemented by C function xFunc that accepts nArg arguments. The
+** value passed as iArg is cast to a (void*) and made available
+** as the user-data (sqlite3_user_data()) for the function. If
+** argument bNC is true, then the SQLITE_FUNC_NEEDCOLL flag is set.
+**
+** VFUNCTION(zName, nArg, iArg, bNC, xFunc)
+** Like FUNCTION except it omits the SQLITE_FUNC_CONSTANT flag.
+**
+** SFUNCTION(zName, nArg, iArg, bNC, xFunc)
+** Like FUNCTION except it omits the SQLITE_FUNC_CONSTANT flag and
+** adds the SQLITE_DIRECTONLY flag.
+**
+** INLINE_FUNC(zName, nArg, iFuncId, mFlags)
+** zName is the name of a function that is implemented by in-line
+** byte code rather than by the usual callbacks. The iFuncId
+** parameter determines the function id. The mFlags parameter is
+** optional SQLITE_FUNC_ flags for this function.
+**
+** TEST_FUNC(zName, nArg, iFuncId, mFlags)
+** zName is the name of a test-only function implemented by in-line
+** byte code rather than by the usual callbacks. The iFuncId
+** parameter determines the function id. The mFlags parameter is
+** optional SQLITE_FUNC_ flags for this function.
+**
+** DFUNCTION(zName, nArg, iArg, bNC, xFunc)
+** Like FUNCTION except it omits the SQLITE_FUNC_CONSTANT flag and
+** adds the SQLITE_FUNC_SLOCHNG flag. Used for date & time functions
+** and functions like sqlite_version() that can change, but not during
+** a single query. The iArg is ignored. The user-data is always set
+** to a NULL pointer. The bNC parameter is not used.
+**
+** MFUNCTION(zName, nArg, xPtr, xFunc)
+** For math-library functions. xPtr is an arbitrary pointer.
+**
+** PURE_DATE(zName, nArg, iArg, bNC, xFunc)
+** Used for "pure" date/time functions, this macro is like DFUNCTION
+** except that it does set the SQLITE_FUNC_CONSTANT flags. iArg is
+** ignored and the user-data for these functions is set to an
+** arbitrary non-NULL pointer. The bNC parameter is not used.
+**
+** AGGREGATE(zName, nArg, iArg, bNC, xStep, xFinal)
+** Used to create an aggregate function definition implemented by
+** the C functions xStep and xFinal. The first four parameters
+** are interpreted in the same way as the first 4 parameters to
+** FUNCTION().
+**
+** WAGGREGATE(zName, nArg, iArg, xStep, xFinal, xValue, xInverse)
+** Used to create an aggregate function definition implemented by
+** the C functions xStep and xFinal. The first four parameters
+** are interpreted in the same way as the first 4 parameters to
+** FUNCTION().
+**
+** LIKEFUNC(zName, nArg, pArg, flags)
+** Used to create a scalar function definition of a function zName
+** that accepts nArg arguments and is implemented by a call to C
+** function likeFunc. Argument pArg is cast to a (void *) and made
+** available as the function user-data (sqlite3_user_data()). The
+** FuncDef.flags variable is set to the value passed as the flags
+** parameter.
+*/
+#define FUNCTION(zName, nArg, iArg, bNC, xFunc) \
+ {nArg, SQLITE_FUNC_BUILTIN|\
+ SQLITE_FUNC_CONSTANT|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \
+ SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
+#define VFUNCTION(zName, nArg, iArg, bNC, xFunc) \
+ {nArg, SQLITE_FUNC_BUILTIN|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \
+ SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
+#define SFUNCTION(zName, nArg, iArg, bNC, xFunc) \
+ {nArg, SQLITE_FUNC_BUILTIN|SQLITE_UTF8|SQLITE_DIRECTONLY|SQLITE_FUNC_UNSAFE, \
+ SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
+#define MFUNCTION(zName, nArg, xPtr, xFunc) \
+ {nArg, SQLITE_FUNC_BUILTIN|SQLITE_FUNC_CONSTANT|SQLITE_UTF8, \
+ xPtr, 0, xFunc, 0, 0, 0, #zName, {0} }
+#define JFUNCTION(zName, nArg, bUseCache, bWS, bRS, bJsonB, iArg, xFunc) \
+ {nArg, SQLITE_FUNC_BUILTIN|SQLITE_DETERMINISTIC|SQLITE_FUNC_CONSTANT|\
+ SQLITE_UTF8|((bUseCache)*SQLITE_FUNC_RUNONLY)|\
+ ((bRS)*SQLITE_SUBTYPE)|((bWS)*SQLITE_RESULT_SUBTYPE), \
+ SQLITE_INT_TO_PTR(iArg|((bJsonB)*JSON_BLOB)),0,xFunc,0, 0, 0, #zName, {0} }
+#define INLINE_FUNC(zName, nArg, iArg, mFlags) \
+ {nArg, SQLITE_FUNC_BUILTIN|\
+ SQLITE_UTF8|SQLITE_FUNC_INLINE|SQLITE_FUNC_CONSTANT|(mFlags), \
+ SQLITE_INT_TO_PTR(iArg), 0, noopFunc, 0, 0, 0, #zName, {0} }
+#define TEST_FUNC(zName, nArg, iArg, mFlags) \
+ {nArg, SQLITE_FUNC_BUILTIN|\
+ SQLITE_UTF8|SQLITE_FUNC_INTERNAL|SQLITE_FUNC_TEST| \
+ SQLITE_FUNC_INLINE|SQLITE_FUNC_CONSTANT|(mFlags), \
+ SQLITE_INT_TO_PTR(iArg), 0, noopFunc, 0, 0, 0, #zName, {0} }
+#define DFUNCTION(zName, nArg, iArg, bNC, xFunc) \
+ {nArg, SQLITE_FUNC_BUILTIN|SQLITE_FUNC_SLOCHNG|SQLITE_UTF8, \
+ 0, 0, xFunc, 0, 0, 0, #zName, {0} }
+#define PURE_DATE(zName, nArg, iArg, bNC, xFunc) \
+ {nArg, SQLITE_FUNC_BUILTIN|\
+ SQLITE_FUNC_SLOCHNG|SQLITE_UTF8|SQLITE_FUNC_CONSTANT, \
+ (void*)&sqlite3Config, 0, xFunc, 0, 0, 0, #zName, {0} }
+#define FUNCTION2(zName, nArg, iArg, bNC, xFunc, extraFlags) \
+ {nArg, SQLITE_FUNC_BUILTIN|\
+ SQLITE_FUNC_CONSTANT|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL)|extraFlags,\
+ SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
+#define STR_FUNCTION(zName, nArg, pArg, bNC, xFunc) \
+ {nArg, SQLITE_FUNC_BUILTIN|\
+ SQLITE_FUNC_SLOCHNG|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \
+ pArg, 0, xFunc, 0, 0, 0, #zName, }
+#define LIKEFUNC(zName, nArg, arg, flags) \
+ {nArg, SQLITE_FUNC_BUILTIN|SQLITE_FUNC_CONSTANT|SQLITE_UTF8|flags, \
+ (void *)arg, 0, likeFunc, 0, 0, 0, #zName, {0} }
+#define WAGGREGATE(zName, nArg, arg, nc, xStep, xFinal, xValue, xInverse, f) \
+ {nArg, SQLITE_FUNC_BUILTIN|SQLITE_UTF8|(nc*SQLITE_FUNC_NEEDCOLL)|f, \
+ SQLITE_INT_TO_PTR(arg), 0, xStep,xFinal,xValue,xInverse,#zName, {0}}
+#define INTERNAL_FUNCTION(zName, nArg, xFunc) \
+ {nArg, SQLITE_FUNC_BUILTIN|\
+ SQLITE_FUNC_INTERNAL|SQLITE_UTF8|SQLITE_FUNC_CONSTANT, \
+ 0, 0, xFunc, 0, 0, 0, #zName, {0} }
+
+
+/*
+** All current savepoints are stored in a linked list starting at
+** sqlite3.pSavepoint. The first element in the list is the most recently
+** opened savepoint. Savepoints are added to the list by the vdbe
+** OP_Savepoint instruction.
+*/
+struct Savepoint {
+ char *zName; /* Savepoint name (nul-terminated) */
+ i64 nDeferredCons; /* Number of deferred fk violations */
+ i64 nDeferredImmCons; /* Number of deferred imm fk. */
+ Savepoint *pNext; /* Parent savepoint (if any) */
+};
+
+/*
+** The following are used as the second parameter to sqlite3Savepoint(),
+** and as the P1 argument to the OP_Savepoint instruction.
+*/
+#define SAVEPOINT_BEGIN 0
+#define SAVEPOINT_RELEASE 1
+#define SAVEPOINT_ROLLBACK 2
+
+
+/*
+** Each SQLite module (virtual table definition) is defined by an
+** instance of the following structure, stored in the sqlite3.aModule
+** hash table.
+*/
+struct Module {
+ const sqlite3_module *pModule; /* Callback pointers */
+ const char *zName; /* Name passed to create_module() */
+ int nRefModule; /* Number of pointers to this object */
+ void *pAux; /* pAux passed to create_module() */
+ void (*xDestroy)(void *); /* Module destructor function */
+ Table *pEpoTab; /* Eponymous table for this module */
+};
+
+/*
+** Information about each column of an SQL table is held in an instance
+** of the Column structure, in the Table.aCol[] array.
+**
+** Definitions:
+**
+** "table column index" This is the index of the column in the
+** Table.aCol[] array, and also the index of
+** the column in the original CREATE TABLE stmt.
+**
+** "storage column index" This is the index of the column in the
+** record BLOB generated by the OP_MakeRecord
+** opcode. The storage column index is less than
+** or equal to the table column index. It is
+** equal if and only if there are no VIRTUAL
+** columns to the left.
+**
+** Notes on zCnName:
+** The zCnName field stores the name of the column, the datatype of the
+** column, and the collating sequence for the column, in that order, all in
+** a single allocation. Each string is 0x00 terminated. The datatype
+** is only included if the COLFLAG_HASTYPE bit of colFlags is set and the
+** collating sequence name is only included if the COLFLAG_HASCOLL bit is
+** set.
+*/
+struct Column {
+ char *zCnName; /* Name of this column */
+ unsigned notNull :4; /* An OE_ code for handling a NOT NULL constraint */
+ unsigned eCType :4; /* One of the standard types */
+ char affinity; /* One of the SQLITE_AFF_... values */
+ u8 szEst; /* Est size of value in this column. sizeof(INT)==1 */
+ u8 hName; /* Column name hash for faster lookup */
+ u16 iDflt; /* 1-based index of DEFAULT. 0 means "none" */
+ u16 colFlags; /* Boolean properties. See COLFLAG_ defines below */
+};
+
+/* Allowed values for Column.eCType.
+**
+** Values must match entries in the global constant arrays
+** sqlite3StdTypeLen[] and sqlite3StdType[]. Each value is one more
+** than the offset into these arrays for the corresponding name.
+** Adjust the SQLITE_N_STDTYPE value if adding or removing entries.
+*/
+#define COLTYPE_CUSTOM 0 /* Type appended to zName */
+#define COLTYPE_ANY 1
+#define COLTYPE_BLOB 2
+#define COLTYPE_INT 3
+#define COLTYPE_INTEGER 4
+#define COLTYPE_REAL 5
+#define COLTYPE_TEXT 6
+#define SQLITE_N_STDTYPE 6 /* Number of standard types */
+
+/* Allowed values for Column.colFlags.
+**
+** Constraints:
+** TF_HasVirtual == COLFLAG_VIRTUAL
+** TF_HasStored == COLFLAG_STORED
+** TF_HasHidden == COLFLAG_HIDDEN
+*/
+#define COLFLAG_PRIMKEY 0x0001 /* Column is part of the primary key */
+#define COLFLAG_HIDDEN 0x0002 /* A hidden column in a virtual table */
+#define COLFLAG_HASTYPE 0x0004 /* Type name follows column name */
+#define COLFLAG_UNIQUE 0x0008 /* Column def contains "UNIQUE" or "PK" */
+#define COLFLAG_SORTERREF 0x0010 /* Use sorter-refs with this column */
+#define COLFLAG_VIRTUAL 0x0020 /* GENERATED ALWAYS AS ... VIRTUAL */
+#define COLFLAG_STORED 0x0040 /* GENERATED ALWAYS AS ... STORED */
+#define COLFLAG_NOTAVAIL 0x0080 /* STORED column not yet calculated */
+#define COLFLAG_BUSY 0x0100 /* Blocks recursion on GENERATED columns */
+#define COLFLAG_HASCOLL 0x0200 /* Has collating sequence name in zCnName */
+#define COLFLAG_NOEXPAND 0x0400 /* Omit this column when expanding "*" */
+#define COLFLAG_GENERATED 0x0060 /* Combo: _STORED, _VIRTUAL */
+#define COLFLAG_NOINSERT 0x0062 /* Combo: _HIDDEN, _STORED, _VIRTUAL */
+
+/*
+** A "Collating Sequence" is defined by an instance of the following
+** structure. Conceptually, a collating sequence consists of a name and
+** a comparison routine that defines the order of that sequence.
+**
+** If CollSeq.xCmp is NULL, it means that the
+** collating sequence is undefined. Indices built on an undefined
+** collating sequence may not be read or written.
+*/
+struct CollSeq {
+ char *zName; /* Name of the collating sequence, UTF-8 encoded */
+ u8 enc; /* Text encoding handled by xCmp() */
+ void *pUser; /* First argument to xCmp() */
+ int (*xCmp)(void*,int, const void*, int, const void*);
+ void (*xDel)(void*); /* Destructor for pUser */
+};
+
+/*
+** A sort order can be either ASC or DESC.
+*/
+#define SQLITE_SO_ASC 0 /* Sort in ascending order */
+#define SQLITE_SO_DESC 1 /* Sort in ascending order */
+#define SQLITE_SO_UNDEFINED -1 /* No sort order specified */
+
+/*
+** Column affinity types.
+**
+** These used to have mnemonic name like 'i' for SQLITE_AFF_INTEGER and
+** 't' for SQLITE_AFF_TEXT. But we can save a little space and improve
+** the speed a little by numbering the values consecutively.
+**
+** But rather than start with 0 or 1, we begin with 'A'. That way,
+** when multiple affinity types are concatenated into a string and
+** used as the P4 operand, they will be more readable.
+**
+** Note also that the numeric types are grouped together so that testing
+** for a numeric type is a single comparison. And the BLOB type is first.
+*/
+#define SQLITE_AFF_NONE 0x40 /* '@' */
+#define SQLITE_AFF_BLOB 0x41 /* 'A' */
+#define SQLITE_AFF_TEXT 0x42 /* 'B' */
+#define SQLITE_AFF_NUMERIC 0x43 /* 'C' */
+#define SQLITE_AFF_INTEGER 0x44 /* 'D' */
+#define SQLITE_AFF_REAL 0x45 /* 'E' */
+#define SQLITE_AFF_FLEXNUM 0x46 /* 'F' */
+
+#define sqlite3IsNumericAffinity(X) ((X)>=SQLITE_AFF_NUMERIC)
+
+/*
+** The SQLITE_AFF_MASK values masks off the significant bits of an
+** affinity value.
+*/
+#define SQLITE_AFF_MASK 0x47
+
+/*
+** Additional bit values that can be ORed with an affinity without
+** changing the affinity.
+**
+** The SQLITE_NOTNULL flag is a combination of NULLEQ and JUMPIFNULL.
+** It causes an assert() to fire if either operand to a comparison
+** operator is NULL. It is added to certain comparison operators to
+** prove that the operands are always NOT NULL.
+*/
+#define SQLITE_JUMPIFNULL 0x10 /* jumps if either operand is NULL */
+#define SQLITE_NULLEQ 0x80 /* NULL=NULL */
+#define SQLITE_NOTNULL 0x90 /* Assert that operands are never NULL */
+
+/*
+** An object of this type is created for each virtual table present in
+** the database schema.
+**
+** If the database schema is shared, then there is one instance of this
+** structure for each database connection (sqlite3*) that uses the shared
+** schema. This is because each database connection requires its own unique
+** instance of the sqlite3_vtab* handle used to access the virtual table
+** implementation. sqlite3_vtab* handles can not be shared between
+** database connections, even when the rest of the in-memory database
+** schema is shared, as the implementation often stores the database
+** connection handle passed to it via the xConnect() or xCreate() method
+** during initialization internally. This database connection handle may
+** then be used by the virtual table implementation to access real tables
+** within the database. So that they appear as part of the callers
+** transaction, these accesses need to be made via the same database
+** connection as that used to execute SQL operations on the virtual table.
+**
+** All VTable objects that correspond to a single table in a shared
+** database schema are initially stored in a linked-list pointed to by
+** the Table.pVTable member variable of the corresponding Table object.
+** When an sqlite3_prepare() operation is required to access the virtual
+** table, it searches the list for the VTable that corresponds to the
+** database connection doing the preparing so as to use the correct
+** sqlite3_vtab* handle in the compiled query.
+**
+** When an in-memory Table object is deleted (for example when the
+** schema is being reloaded for some reason), the VTable objects are not
+** deleted and the sqlite3_vtab* handles are not xDisconnect()ed
+** immediately. Instead, they are moved from the Table.pVTable list to
+** another linked list headed by the sqlite3.pDisconnect member of the
+** corresponding sqlite3 structure. They are then deleted/xDisconnected
+** next time a statement is prepared using said sqlite3*. This is done
+** to avoid deadlock issues involving multiple sqlite3.mutex mutexes.
+** Refer to comments above function sqlite3VtabUnlockList() for an
+** explanation as to why it is safe to add an entry to an sqlite3.pDisconnect
+** list without holding the corresponding sqlite3.mutex mutex.
+**
+** The memory for objects of this type is always allocated by
+** sqlite3DbMalloc(), using the connection handle stored in VTable.db as
+** the first argument.
+*/
+struct VTable {
+ sqlite3 *db; /* Database connection associated with this table */
+ Module *pMod; /* Pointer to module implementation */
+ sqlite3_vtab *pVtab; /* Pointer to vtab instance */
+ int nRef; /* Number of pointers to this structure */
+ u8 bConstraint; /* True if constraints are supported */
+ u8 bAllSchemas; /* True if might use any attached schema */
+ u8 eVtabRisk; /* Riskiness of allowing hacker access */
+ int iSavepoint; /* Depth of the SAVEPOINT stack */
+ VTable *pNext; /* Next in linked list (see above) */
+};
+
+/* Allowed values for VTable.eVtabRisk
+*/
+#define SQLITE_VTABRISK_Low 0
+#define SQLITE_VTABRISK_Normal 1
+#define SQLITE_VTABRISK_High 2
+
+/*
+** The schema for each SQL table, virtual table, and view is represented
+** in memory by an instance of the following structure.
+*/
+struct Table {
+ char *zName; /* Name of the table or view */
+ Column *aCol; /* Information about each column */
+ Index *pIndex; /* List of SQL indexes on this table. */
+ char *zColAff; /* String defining the affinity of each column */
+ ExprList *pCheck; /* All CHECK constraints */
+ /* ... also used as column name list in a VIEW */
+ Pgno tnum; /* Root BTree page for this table */
+ u32 nTabRef; /* Number of pointers to this Table */
+ u32 tabFlags; /* Mask of TF_* values */
+ i16 iPKey; /* If not negative, use aCol[iPKey] as the rowid */
+ i16 nCol; /* Number of columns in this table */
+ i16 nNVCol; /* Number of columns that are not VIRTUAL */
+ LogEst nRowLogEst; /* Estimated rows in table - from sqlite_stat1 table */
+ LogEst szTabRow; /* Estimated size of each table row in bytes */
+#ifdef SQLITE_ENABLE_COSTMULT
+ LogEst costMult; /* Cost multiplier for using this table */
+#endif
+ u8 keyConf; /* What to do in case of uniqueness conflict on iPKey */
+ u8 eTabType; /* 0: normal, 1: virtual, 2: view */
+ union {
+ struct { /* Used by ordinary tables: */
+ int addColOffset; /* Offset in CREATE TABLE stmt to add a new column */
+ FKey *pFKey; /* Linked list of all foreign keys in this table */
+ ExprList *pDfltList; /* DEFAULT clauses on various columns.
+ ** Or the AS clause for generated columns. */
+ } tab;
+ struct { /* Used by views: */
+ Select *pSelect; /* View definition */
+ } view;
+ struct { /* Used by virtual tables only: */
+ int nArg; /* Number of arguments to the module */
+ char **azArg; /* 0: module 1: schema 2: vtab name 3...: args */
+ VTable *p; /* List of VTable objects. */
+ } vtab;
+ } u;
+ Trigger *pTrigger; /* List of triggers on this object */
+ Schema *pSchema; /* Schema that contains this table */
+};
+
+/*
+** Allowed values for Table.tabFlags.
+**
+** TF_OOOHidden applies to tables or view that have hidden columns that are
+** followed by non-hidden columns. Example: "CREATE VIRTUAL TABLE x USING
+** vtab1(a HIDDEN, b);". Since "b" is a non-hidden column but "a" is hidden,
+** the TF_OOOHidden attribute would apply in this case. Such tables require
+** special handling during INSERT processing. The "OOO" means "Out Of Order".
+**
+** Constraints:
+**
+** TF_HasVirtual == COLFLAG_VIRTUAL
+** TF_HasStored == COLFLAG_STORED
+** TF_HasHidden == COLFLAG_HIDDEN
+*/
+#define TF_Readonly 0x00000001 /* Read-only system table */
+#define TF_HasHidden 0x00000002 /* Has one or more hidden columns */
+#define TF_HasPrimaryKey 0x00000004 /* Table has a primary key */
+#define TF_Autoincrement 0x00000008 /* Integer primary key is autoincrement */
+#define TF_HasStat1 0x00000010 /* nRowLogEst set from sqlite_stat1 */
+#define TF_HasVirtual 0x00000020 /* Has one or more VIRTUAL columns */
+#define TF_HasStored 0x00000040 /* Has one or more STORED columns */
+#define TF_HasGenerated 0x00000060 /* Combo: HasVirtual + HasStored */
+#define TF_WithoutRowid 0x00000080 /* No rowid. PRIMARY KEY is the key */
+#define TF_MaybeReanalyze 0x00000100 /* Maybe run ANALYZE on this table */
+#define TF_NoVisibleRowid 0x00000200 /* No user-visible "rowid" column */
+#define TF_OOOHidden 0x00000400 /* Out-of-Order hidden columns */
+#define TF_HasNotNull 0x00000800 /* Contains NOT NULL constraints */
+#define TF_Shadow 0x00001000 /* True for a shadow table */
+#define TF_HasStat4 0x00002000 /* STAT4 info available for this table */
+#define TF_Ephemeral 0x00004000 /* An ephemeral table */
+#define TF_Eponymous 0x00008000 /* An eponymous virtual table */
+#define TF_Strict 0x00010000 /* STRICT mode */
+
+/*
+** Allowed values for Table.eTabType
+*/
+#define TABTYP_NORM 0 /* Ordinary table */
+#define TABTYP_VTAB 1 /* Virtual table */
+#define TABTYP_VIEW 2 /* A view */
+
+#define IsView(X) ((X)->eTabType==TABTYP_VIEW)
+#define IsOrdinaryTable(X) ((X)->eTabType==TABTYP_NORM)
+
+/*
+** Test to see whether or not a table is a virtual table. This is
+** done as a macro so that it will be optimized out when virtual
+** table support is omitted from the build.
+*/
+#ifndef SQLITE_OMIT_VIRTUALTABLE
+# define IsVirtual(X) ((X)->eTabType==TABTYP_VTAB)
+# define ExprIsVtab(X) \
+ ((X)->op==TK_COLUMN && (X)->y.pTab->eTabType==TABTYP_VTAB)
+#else
+# define IsVirtual(X) 0
+# define ExprIsVtab(X) 0
+#endif
+
+/*
+** Macros to determine if a column is hidden. IsOrdinaryHiddenColumn()
+** only works for non-virtual tables (ordinary tables and views) and is
+** always false unless SQLITE_ENABLE_HIDDEN_COLUMNS is defined. The
+** IsHiddenColumn() macro is general purpose.
+*/
+#if defined(SQLITE_ENABLE_HIDDEN_COLUMNS)
+# define IsHiddenColumn(X) (((X)->colFlags & COLFLAG_HIDDEN)!=0)
+# define IsOrdinaryHiddenColumn(X) (((X)->colFlags & COLFLAG_HIDDEN)!=0)
+#elif !defined(SQLITE_OMIT_VIRTUALTABLE)
+# define IsHiddenColumn(X) (((X)->colFlags & COLFLAG_HIDDEN)!=0)
+# define IsOrdinaryHiddenColumn(X) 0
+#else
+# define IsHiddenColumn(X) 0
+# define IsOrdinaryHiddenColumn(X) 0
+#endif
+
+
+/* Does the table have a rowid */
+#define HasRowid(X) (((X)->tabFlags & TF_WithoutRowid)==0)
+#define VisibleRowid(X) (((X)->tabFlags & TF_NoVisibleRowid)==0)
+
+/* Macro is true if the SQLITE_ALLOW_ROWID_IN_VIEW (mis-)feature is
+** available. By default, this macro is false
+*/
+#ifndef SQLITE_ALLOW_ROWID_IN_VIEW
+# define ViewCanHaveRowid 0
+#else
+# define ViewCanHaveRowid (sqlite3Config.mNoVisibleRowid==0)
+#endif
+
+/*
+** Each foreign key constraint is an instance of the following structure.
+**
+** A foreign key is associated with two tables. The "from" table is
+** the table that contains the REFERENCES clause that creates the foreign
+** key. The "to" table is the table that is named in the REFERENCES clause.
+** Consider this example:
+**
+** CREATE TABLE ex1(
+** a INTEGER PRIMARY KEY,
+** b INTEGER CONSTRAINT fk1 REFERENCES ex2(x)
+** );
+**
+** For foreign key "fk1", the from-table is "ex1" and the to-table is "ex2".
+** Equivalent names:
+**
+** from-table == child-table
+** to-table == parent-table
+**
+** Each REFERENCES clause generates an instance of the following structure
+** which is attached to the from-table. The to-table need not exist when
+** the from-table is created. The existence of the to-table is not checked.
+**
+** The list of all parents for child Table X is held at X.pFKey.
+**
+** A list of all children for a table named Z (which might not even exist)
+** is held in Schema.fkeyHash with a hash key of Z.
+*/
+struct FKey {
+ Table *pFrom; /* Table containing the REFERENCES clause (aka: Child) */
+ FKey *pNextFrom; /* Next FKey with the same in pFrom. Next parent of pFrom */
+ char *zTo; /* Name of table that the key points to (aka: Parent) */
+ FKey *pNextTo; /* Next with the same zTo. Next child of zTo. */
+ FKey *pPrevTo; /* Previous with the same zTo */
+ int nCol; /* Number of columns in this key */
+ /* EV: R-30323-21917 */
+ u8 isDeferred; /* True if constraint checking is deferred till COMMIT */
+ u8 aAction[2]; /* ON DELETE and ON UPDATE actions, respectively */
+ Trigger *apTrigger[2];/* Triggers for aAction[] actions */
+ struct sColMap { /* Mapping of columns in pFrom to columns in zTo */
+ int iFrom; /* Index of column in pFrom */
+ char *zCol; /* Name of column in zTo. If NULL use PRIMARY KEY */
+ } aCol[1]; /* One entry for each of nCol columns */
+};
+
+/*
+** SQLite supports many different ways to resolve a constraint
+** error. ROLLBACK processing means that a constraint violation
+** causes the operation in process to fail and for the current transaction
+** to be rolled back. ABORT processing means the operation in process
+** fails and any prior changes from that one operation are backed out,
+** but the transaction is not rolled back. FAIL processing means that
+** the operation in progress stops and returns an error code. But prior
+** changes due to the same operation are not backed out and no rollback
+** occurs. IGNORE means that the particular row that caused the constraint
+** error is not inserted or updated. Processing continues and no error
+** is returned. REPLACE means that preexisting database rows that caused
+** a UNIQUE constraint violation are removed so that the new insert or
+** update can proceed. Processing continues and no error is reported.
+** UPDATE applies to insert operations only and means that the insert
+** is omitted and the DO UPDATE clause of an upsert is run instead.
+**
+** RESTRICT, SETNULL, SETDFLT, and CASCADE actions apply only to foreign keys.
+** RESTRICT is the same as ABORT for IMMEDIATE foreign keys and the
+** same as ROLLBACK for DEFERRED keys. SETNULL means that the foreign
+** key is set to NULL. SETDFLT means that the foreign key is set
+** to its default value. CASCADE means that a DELETE or UPDATE of the
+** referenced table row is propagated into the row that holds the
+** foreign key.
+**
+** The OE_Default value is a place holder that means to use whatever
+** conflict resolution algorithm is required from context.
+**
+** The following symbolic values are used to record which type
+** of conflict resolution action to take.
+*/
+#define OE_None 0 /* There is no constraint to check */
+#define OE_Rollback 1 /* Fail the operation and rollback the transaction */
+#define OE_Abort 2 /* Back out changes but do no rollback transaction */
+#define OE_Fail 3 /* Stop the operation but leave all prior changes */
+#define OE_Ignore 4 /* Ignore the error. Do not do the INSERT or UPDATE */
+#define OE_Replace 5 /* Delete existing record, then do INSERT or UPDATE */
+#define OE_Update 6 /* Process as a DO UPDATE in an upsert */
+#define OE_Restrict 7 /* OE_Abort for IMMEDIATE, OE_Rollback for DEFERRED */
+#define OE_SetNull 8 /* Set the foreign key value to NULL */
+#define OE_SetDflt 9 /* Set the foreign key value to its default */
+#define OE_Cascade 10 /* Cascade the changes */
+#define OE_Default 11 /* Do whatever the default action is */
+
+
+/*
+** An instance of the following structure is passed as the first
+** argument to sqlite3VdbeKeyCompare and is used to control the
+** comparison of the two index keys.
+**
+** Note that aSortOrder[] and aColl[] have nField+1 slots. There
+** are nField slots for the columns of an index then one extra slot
+** for the rowid at the end.
+*/
+struct KeyInfo {
+ u32 nRef; /* Number of references to this KeyInfo object */
+ u8 enc; /* Text encoding - one of the SQLITE_UTF* values */
+ u16 nKeyField; /* Number of key columns in the index */
+ u16 nAllField; /* Total columns, including key plus others */
+ sqlite3 *db; /* The database connection */
+ u8 *aSortFlags; /* Sort order for each column. */
+ CollSeq *aColl[1]; /* Collating sequence for each term of the key */
+};
+
+/*
+** Allowed bit values for entries in the KeyInfo.aSortFlags[] array.
+*/
+#define KEYINFO_ORDER_DESC 0x01 /* DESC sort order */
+#define KEYINFO_ORDER_BIGNULL 0x02 /* NULL is larger than any other value */
+
+/*
+** This object holds a record which has been parsed out into individual
+** fields, for the purposes of doing a comparison.
+**
+** A record is an object that contains one or more fields of data.
+** Records are used to store the content of a table row and to store
+** the key of an index. A blob encoding of a record is created by
+** the OP_MakeRecord opcode of the VDBE and is disassembled by the
+** OP_Column opcode.
+**
+** An instance of this object serves as a "key" for doing a search on
+** an index b+tree. The goal of the search is to find the entry that
+** is closed to the key described by this object. This object might hold
+** just a prefix of the key. The number of fields is given by
+** pKeyInfo->nField.
+**
+** The r1 and r2 fields are the values to return if this key is less than
+** or greater than a key in the btree, respectively. These are normally
+** -1 and +1 respectively, but might be inverted to +1 and -1 if the b-tree
+** is in DESC order.
+**
+** The key comparison functions actually return default_rc when they find
+** an equals comparison. default_rc can be -1, 0, or +1. If there are
+** multiple entries in the b-tree with the same key (when only looking
+** at the first pKeyInfo->nFields,) then default_rc can be set to -1 to
+** cause the search to find the last match, or +1 to cause the search to
+** find the first match.
+**
+** The key comparison functions will set eqSeen to true if they ever
+** get and equal results when comparing this structure to a b-tree record.
+** When default_rc!=0, the search might end up on the record immediately
+** before the first match or immediately after the last match. The
+** eqSeen field will indicate whether or not an exact match exists in the
+** b-tree.
+*/
+struct UnpackedRecord {
+ KeyInfo *pKeyInfo; /* Collation and sort-order information */
+ Mem *aMem; /* Values */
+ union {
+ char *z; /* Cache of aMem[0].z for vdbeRecordCompareString() */
+ i64 i; /* Cache of aMem[0].u.i for vdbeRecordCompareInt() */
+ } u;
+ int n; /* Cache of aMem[0].n used by vdbeRecordCompareString() */
+ u16 nField; /* Number of entries in apMem[] */
+ i8 default_rc; /* Comparison result if keys are equal */
+ u8 errCode; /* Error detected by xRecordCompare (CORRUPT or NOMEM) */
+ i8 r1; /* Value to return if (lhs < rhs) */
+ i8 r2; /* Value to return if (lhs > rhs) */
+ u8 eqSeen; /* True if an equality comparison has been seen */
+};
+
+
+/*
+** Each SQL index is represented in memory by an
+** instance of the following structure.
+**
+** The columns of the table that are to be indexed are described
+** by the aiColumn[] field of this structure. For example, suppose
+** we have the following table and index:
+**
+** CREATE TABLE Ex1(c1 int, c2 int, c3 text);
+** CREATE INDEX Ex2 ON Ex1(c3,c1);
+**
+** In the Table structure describing Ex1, nCol==3 because there are
+** three columns in the table. In the Index structure describing
+** Ex2, nColumn==2 since 2 of the 3 columns of Ex1 are indexed.
+** The value of aiColumn is {2, 0}. aiColumn[0]==2 because the
+** first column to be indexed (c3) has an index of 2 in Ex1.aCol[].
+** The second column to be indexed (c1) has an index of 0 in
+** Ex1.aCol[], hence Ex2.aiColumn[1]==0.
+**
+** The Index.onError field determines whether or not the indexed columns
+** must be unique and what to do if they are not. When Index.onError=OE_None,
+** it means this is not a unique index. Otherwise it is a unique index
+** and the value of Index.onError indicates which conflict resolution
+** algorithm to employ when an attempt is made to insert a non-unique
+** element.
+**
+** The colNotIdxed bitmask is used in combination with SrcItem.colUsed
+** for a fast test to see if an index can serve as a covering index.
+** colNotIdxed has a 1 bit for every column of the original table that
+** is *not* available in the index. Thus the expression
+** "colUsed & colNotIdxed" will be non-zero if the index is not a
+** covering index. The most significant bit of of colNotIdxed will always
+** be true (note-20221022-a). If a column beyond the 63rd column of the
+** table is used, the "colUsed & colNotIdxed" test will always be non-zero
+** and we have to assume either that the index is not covering, or use
+** an alternative (slower) algorithm to determine whether or not
+** the index is covering.
+**
+** While parsing a CREATE TABLE or CREATE INDEX statement in order to
+** generate VDBE code (as opposed to parsing one read from an sqlite_schema
+** table as part of parsing an existing database schema), transient instances
+** of this structure may be created. In this case the Index.tnum variable is
+** used to store the address of a VDBE instruction, not a database page
+** number (it cannot - the database page is not allocated until the VDBE
+** program is executed). See convertToWithoutRowidTable() for details.
+*/
+struct Index {
+ char *zName; /* Name of this index */
+ i16 *aiColumn; /* Which columns are used by this index. 1st is 0 */
+ LogEst *aiRowLogEst; /* From ANALYZE: Est. rows selected by each column */
+ Table *pTable; /* The SQL table being indexed */
+ char *zColAff; /* String defining the affinity of each column */
+ Index *pNext; /* The next index associated with the same table */
+ Schema *pSchema; /* Schema containing this index */
+ u8 *aSortOrder; /* for each column: True==DESC, False==ASC */
+ const char **azColl; /* Array of collation sequence names for index */
+ Expr *pPartIdxWhere; /* WHERE clause for partial indices */
+ ExprList *aColExpr; /* Column expressions */
+ Pgno tnum; /* DB Page containing root of this index */
+ LogEst szIdxRow; /* Estimated average row size in bytes */
+ u16 nKeyCol; /* Number of columns forming the key */
+ u16 nColumn; /* Number of columns stored in the index */
+ u8 onError; /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */
+ unsigned idxType:2; /* 0:Normal 1:UNIQUE, 2:PRIMARY KEY, 3:IPK */
+ unsigned bUnordered:1; /* Use this index for == or IN queries only */
+ unsigned uniqNotNull:1; /* True if UNIQUE and NOT NULL for all columns */
+ unsigned isResized:1; /* True if resizeIndexObject() has been called */
+ unsigned isCovering:1; /* True if this is a covering index */
+ unsigned noSkipScan:1; /* Do not try to use skip-scan if true */
+ unsigned hasStat1:1; /* aiRowLogEst values come from sqlite_stat1 */
+ unsigned bLowQual:1; /* sqlite_stat1 says this is a low-quality index */
+ unsigned bNoQuery:1; /* Do not use this index to optimize queries */
+ unsigned bAscKeyBug:1; /* True if the bba7b69f9849b5bf bug applies */
+ unsigned bHasVCol:1; /* Index references one or more VIRTUAL columns */
+ unsigned bHasExpr:1; /* Index contains an expression, either a literal
+ ** expression, or a reference to a VIRTUAL column */
+#ifdef SQLITE_ENABLE_STAT4
+ int nSample; /* Number of elements in aSample[] */
+ int mxSample; /* Number of slots allocated to aSample[] */
+ int nSampleCol; /* Size of IndexSample.anEq[] and so on */
+ tRowcnt *aAvgEq; /* Average nEq values for keys not in aSample */
+ IndexSample *aSample; /* Samples of the left-most key */
+ tRowcnt *aiRowEst; /* Non-logarithmic stat1 data for this index */
+ tRowcnt nRowEst0; /* Non-logarithmic number of rows in the index */
+#endif
+ Bitmask colNotIdxed; /* Unindexed columns in pTab */
+};
+
+/*
+** Allowed values for Index.idxType
+*/
+#define SQLITE_IDXTYPE_APPDEF 0 /* Created using CREATE INDEX */
+#define SQLITE_IDXTYPE_UNIQUE 1 /* Implements a UNIQUE constraint */
+#define SQLITE_IDXTYPE_PRIMARYKEY 2 /* Is the PRIMARY KEY for the table */
+#define SQLITE_IDXTYPE_IPK 3 /* INTEGER PRIMARY KEY index */
+
+/* Return true if index X is a PRIMARY KEY index */
+#define IsPrimaryKeyIndex(X) ((X)->idxType==SQLITE_IDXTYPE_PRIMARYKEY)
+
+/* Return true if index X is a UNIQUE index */
+#define IsUniqueIndex(X) ((X)->onError!=OE_None)
+
+/* The Index.aiColumn[] values are normally positive integer. But
+** there are some negative values that have special meaning:
+*/
+#define XN_ROWID (-1) /* Indexed column is the rowid */
+#define XN_EXPR (-2) /* Indexed column is an expression */
+
+/*
+** Each sample stored in the sqlite_stat4 table is represented in memory
+** using a structure of this type. See documentation at the top of the
+** analyze.c source file for additional information.
+*/
+struct IndexSample {
+ void *p; /* Pointer to sampled record */
+ int n; /* Size of record in bytes */
+ tRowcnt *anEq; /* Est. number of rows where the key equals this sample */
+ tRowcnt *anLt; /* Est. number of rows where key is less than this sample */
+ tRowcnt *anDLt; /* Est. number of distinct keys less than this sample */
+};
+
+/*
+** Possible values to use within the flags argument to sqlite3GetToken().
+*/
+#define SQLITE_TOKEN_QUOTED 0x1 /* Token is a quoted identifier. */
+#define SQLITE_TOKEN_KEYWORD 0x2 /* Token is a keyword. */
+
+/*
+** Each token coming out of the lexer is an instance of
+** this structure. Tokens are also used as part of an expression.
+**
+** The memory that "z" points to is owned by other objects. Take care
+** that the owner of the "z" string does not deallocate the string before
+** the Token goes out of scope! Very often, the "z" points to some place
+** in the middle of the Parse.zSql text. But it might also point to a
+** static string.
+*/
+struct Token {
+ const char *z; /* Text of the token. Not NULL-terminated! */
+ unsigned int n; /* Number of characters in this token */
+};
+
+/*
+** An instance of this structure contains information needed to generate
+** code for a SELECT that contains aggregate functions.
+**
+** If Expr.op==TK_AGG_COLUMN or TK_AGG_FUNCTION then Expr.pAggInfo is a
+** pointer to this structure. The Expr.iAgg field is the index in
+** AggInfo.aCol[] or AggInfo.aFunc[] of information needed to generate
+** code for that node.
+**
+** AggInfo.pGroupBy and AggInfo.aFunc.pExpr point to fields within the
+** original Select structure that describes the SELECT statement. These
+** fields do not need to be freed when deallocating the AggInfo structure.
+*/
+struct AggInfo {
+ u8 directMode; /* Direct rendering mode means take data directly
+ ** from source tables rather than from accumulators */
+ u8 useSortingIdx; /* In direct mode, reference the sorting index rather
+ ** than the source table */
+ u16 nSortingColumn; /* Number of columns in the sorting index */
+ int sortingIdx; /* Cursor number of the sorting index */
+ int sortingIdxPTab; /* Cursor number of pseudo-table */
+ int iFirstReg; /* First register in range for aCol[] and aFunc[] */
+ ExprList *pGroupBy; /* The group by clause */
+ struct AggInfo_col { /* For each column used in source tables */
+ Table *pTab; /* Source table */
+ Expr *pCExpr; /* The original expression */
+ int iTable; /* Cursor number of the source table */
+ i16 iColumn; /* Column number within the source table */
+ i16 iSorterColumn; /* Column number in the sorting index */
+ } *aCol;
+ int nColumn; /* Number of used entries in aCol[] */
+ int nAccumulator; /* Number of columns that show through to the output.
+ ** Additional columns are used only as parameters to
+ ** aggregate functions */
+ struct AggInfo_func { /* For each aggregate function */
+ Expr *pFExpr; /* Expression encoding the function */
+ FuncDef *pFunc; /* The aggregate function implementation */
+ int iDistinct; /* Ephemeral table used to enforce DISTINCT */
+ int iDistAddr; /* Address of OP_OpenEphemeral */
+ int iOBTab; /* Ephemeral table to implement ORDER BY */
+ u8 bOBPayload; /* iOBTab has payload columns separate from key */
+ u8 bOBUnique; /* Enforce uniqueness on iOBTab keys */
+ u8 bUseSubtype; /* Transfer subtype info through sorter */
+ } *aFunc;
+ int nFunc; /* Number of entries in aFunc[] */
+ u32 selId; /* Select to which this AggInfo belongs */
+#ifdef SQLITE_DEBUG
+ Select *pSelect; /* SELECT statement that this AggInfo supports */
+#endif
+};
+
+/*
+** Macros to compute aCol[] and aFunc[] register numbers.
+**
+** These macros should not be used prior to the call to
+** assignAggregateRegisters() that computes the value of pAggInfo->iFirstReg.
+** The assert()s that are part of this macro verify that constraint.
+*/
+#ifndef NDEBUG
+#define AggInfoColumnReg(A,I) (assert((A)->iFirstReg),(A)->iFirstReg+(I))
+#define AggInfoFuncReg(A,I) \
+ (assert((A)->iFirstReg),(A)->iFirstReg+(A)->nColumn+(I))
+#else
+#define AggInfoColumnReg(A,I) ((A)->iFirstReg+(I))
+#define AggInfoFuncReg(A,I) \
+ ((A)->iFirstReg+(A)->nColumn+(I))
+#endif
+
+/*
+** The datatype ynVar is a signed integer, either 16-bit or 32-bit.
+** Usually it is 16-bits. But if SQLITE_MAX_VARIABLE_NUMBER is greater
+** than 32767 we have to make it 32-bit. 16-bit is preferred because
+** it uses less memory in the Expr object, which is a big memory user
+** in systems with lots of prepared statements. And few applications
+** need more than about 10 or 20 variables. But some extreme users want
+** to have prepared statements with over 32766 variables, and for them
+** the option is available (at compile-time).
+*/
+#if SQLITE_MAX_VARIABLE_NUMBER<32767
+typedef i16 ynVar;
+#else
+typedef int ynVar;
+#endif
+
+/*
+** Each node of an expression in the parse tree is an instance
+** of this structure.
+**
+** Expr.op is the opcode. The integer parser token codes are reused
+** as opcodes here. For example, the parser defines TK_GE to be an integer
+** code representing the ">=" operator. This same integer code is reused
+** to represent the greater-than-or-equal-to operator in the expression
+** tree.
+**
+** If the expression is an SQL literal (TK_INTEGER, TK_FLOAT, TK_BLOB,
+** or TK_STRING), then Expr.u.zToken contains the text of the SQL literal. If
+** the expression is a variable (TK_VARIABLE), then Expr.u.zToken contains the
+** variable name. Finally, if the expression is an SQL function (TK_FUNCTION),
+** then Expr.u.zToken contains the name of the function.
+**
+** Expr.pRight and Expr.pLeft are the left and right subexpressions of a
+** binary operator. Either or both may be NULL.
+**
+** Expr.x.pList is a list of arguments if the expression is an SQL function,
+** a CASE expression or an IN expression of the form "<lhs> IN (<y>, <z>...)".
+** Expr.x.pSelect is used if the expression is a sub-select or an expression of
+** the form "<lhs> IN (SELECT ...)". If the EP_xIsSelect bit is set in the
+** Expr.flags mask, then Expr.x.pSelect is valid. Otherwise, Expr.x.pList is
+** valid.
+**
+** An expression of the form ID or ID.ID refers to a column in a table.
+** For such expressions, Expr.op is set to TK_COLUMN and Expr.iTable is
+** the integer cursor number of a VDBE cursor pointing to that table and
+** Expr.iColumn is the column number for the specific column. If the
+** expression is used as a result in an aggregate SELECT, then the
+** value is also stored in the Expr.iAgg column in the aggregate so that
+** it can be accessed after all aggregates are computed.
+**
+** If the expression is an unbound variable marker (a question mark
+** character '?' in the original SQL) then the Expr.iTable holds the index
+** number for that variable.
+**
+** If the expression is a subquery then Expr.iColumn holds an integer
+** register number containing the result of the subquery. If the
+** subquery gives a constant result, then iTable is -1. If the subquery
+** gives a different answer at different times during statement processing
+** then iTable is the address of a subroutine that computes the subquery.
+**
+** If the Expr is of type OP_Column, and the table it is selecting from
+** is a disk table or the "old.*" pseudo-table, then pTab points to the
+** corresponding table definition.
+**
+** ALLOCATION NOTES:
+**
+** Expr objects can use a lot of memory space in database schema. To
+** help reduce memory requirements, sometimes an Expr object will be
+** truncated. And to reduce the number of memory allocations, sometimes
+** two or more Expr objects will be stored in a single memory allocation,
+** together with Expr.u.zToken strings.
+**
+** If the EP_Reduced and EP_TokenOnly flags are set when
+** an Expr object is truncated. When EP_Reduced is set, then all
+** the child Expr objects in the Expr.pLeft and Expr.pRight subtrees
+** are contained within the same memory allocation. Note, however, that
+** the subtrees in Expr.x.pList or Expr.x.pSelect are always separately
+** allocated, regardless of whether or not EP_Reduced is set.
+*/
+struct Expr {
+ u8 op; /* Operation performed by this node */
+ char affExpr; /* affinity, or RAISE type */
+ u8 op2; /* TK_REGISTER/TK_TRUTH: original value of Expr.op
+ ** TK_COLUMN: the value of p5 for OP_Column
+ ** TK_AGG_FUNCTION: nesting depth
+ ** TK_FUNCTION: NC_SelfRef flag if needs OP_PureFunc */
+#ifdef SQLITE_DEBUG
+ u8 vvaFlags; /* Verification flags. */
+#endif
+ u32 flags; /* Various flags. EP_* See below */
+ union {
+ char *zToken; /* Token value. Zero terminated and dequoted */
+ int iValue; /* Non-negative integer value if EP_IntValue */
+ } u;
+
+ /* If the EP_TokenOnly flag is set in the Expr.flags mask, then no
+ ** space is allocated for the fields below this point. An attempt to
+ ** access them will result in a segfault or malfunction.
+ *********************************************************************/
+
+ Expr *pLeft; /* Left subnode */
+ Expr *pRight; /* Right subnode */
+ union {
+ ExprList *pList; /* op = IN, EXISTS, SELECT, CASE, FUNCTION, BETWEEN */
+ Select *pSelect; /* EP_xIsSelect and op = IN, EXISTS, SELECT */
+ } x;
+
+ /* If the EP_Reduced flag is set in the Expr.flags mask, then no
+ ** space is allocated for the fields below this point. An attempt to
+ ** access them will result in a segfault or malfunction.
+ *********************************************************************/
+
+#if SQLITE_MAX_EXPR_DEPTH>0
+ int nHeight; /* Height of the tree headed by this node */
+#endif
+ int iTable; /* TK_COLUMN: cursor number of table holding column
+ ** TK_REGISTER: register number
+ ** TK_TRIGGER: 1 -> new, 0 -> old
+ ** EP_Unlikely: 134217728 times likelihood
+ ** TK_IN: ephemeral table holding RHS
+ ** TK_SELECT_COLUMN: Number of columns on the LHS
+ ** TK_SELECT: 1st register of result vector */
+ ynVar iColumn; /* TK_COLUMN: column index. -1 for rowid.
+ ** TK_VARIABLE: variable number (always >= 1).
+ ** TK_SELECT_COLUMN: column of the result vector */
+ i16 iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */
+ union {
+ int iJoin; /* If EP_OuterON or EP_InnerON, the right table */
+ int iOfst; /* else: start of token from start of statement */
+ } w;
+ AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */
+ union {
+ Table *pTab; /* TK_COLUMN: Table containing column. Can be NULL
+ ** for a column of an index on an expression */
+ Window *pWin; /* EP_WinFunc: Window/Filter defn for a function */
+ struct { /* TK_IN, TK_SELECT, and TK_EXISTS */
+ int iAddr; /* Subroutine entry address */
+ int regReturn; /* Register used to hold return address */
+ } sub;
+ } y;
+};
+
+/* The following are the meanings of bits in the Expr.flags field.
+** Value restrictions:
+**
+** EP_Agg == NC_HasAgg == SF_HasAgg
+** EP_Win == NC_HasWin
+*/
+#define EP_OuterON 0x000001 /* Originates in ON/USING clause of outer join */
+#define EP_InnerON 0x000002 /* Originates in ON/USING of an inner join */
+#define EP_Distinct 0x000004 /* Aggregate function with DISTINCT keyword */
+#define EP_HasFunc 0x000008 /* Contains one or more functions of any kind */
+#define EP_Agg 0x000010 /* Contains one or more aggregate functions */
+#define EP_FixedCol 0x000020 /* TK_Column with a known fixed value */
+#define EP_VarSelect 0x000040 /* pSelect is correlated, not constant */
+#define EP_DblQuoted 0x000080 /* token.z was originally in "..." */
+#define EP_InfixFunc 0x000100 /* True for an infix function: LIKE, GLOB, etc */
+#define EP_Collate 0x000200 /* Tree contains a TK_COLLATE operator */
+#define EP_Commuted 0x000400 /* Comparison operator has been commuted */
+#define EP_IntValue 0x000800 /* Integer value contained in u.iValue */
+#define EP_xIsSelect 0x001000 /* x.pSelect is valid (otherwise x.pList is) */
+#define EP_Skip 0x002000 /* Operator does not contribute to affinity */
+#define EP_Reduced 0x004000 /* Expr struct EXPR_REDUCEDSIZE bytes only */
+#define EP_Win 0x008000 /* Contains window functions */
+#define EP_TokenOnly 0x010000 /* Expr struct EXPR_TOKENONLYSIZE bytes only */
+#define EP_FullSize 0x020000 /* Expr structure must remain full sized */
+#define EP_IfNullRow 0x040000 /* The TK_IF_NULL_ROW opcode */
+#define EP_Unlikely 0x080000 /* unlikely() or likelihood() function */
+#define EP_ConstFunc 0x100000 /* A SQLITE_FUNC_CONSTANT or _SLOCHNG function */
+#define EP_CanBeNull 0x200000 /* Can be null despite NOT NULL constraint */
+#define EP_Subquery 0x400000 /* Tree contains a TK_SELECT operator */
+#define EP_Leaf 0x800000 /* Expr.pLeft, .pRight, .u.pSelect all NULL */
+#define EP_WinFunc 0x1000000 /* TK_FUNCTION with Expr.y.pWin set */
+#define EP_Subrtn 0x2000000 /* Uses Expr.y.sub. TK_IN, _SELECT, or _EXISTS */
+#define EP_Quoted 0x4000000 /* TK_ID was originally quoted */
+#define EP_Static 0x8000000 /* Held in memory not obtained from malloc() */
+#define EP_IsTrue 0x10000000 /* Always has boolean value of TRUE */
+#define EP_IsFalse 0x20000000 /* Always has boolean value of FALSE */
+#define EP_FromDDL 0x40000000 /* Originates from sqlite_schema */
+#define EP_SubtArg 0x80000000 /* Is argument to SQLITE_SUBTYPE function */
+
+/* The EP_Propagate mask is a set of properties that automatically propagate
+** upwards into parent nodes.
+*/
+#define EP_Propagate (EP_Collate|EP_Subquery|EP_HasFunc)
+
+/* Macros can be used to test, set, or clear bits in the
+** Expr.flags field.
+*/
+#define ExprHasProperty(E,P) (((E)->flags&(P))!=0)
+#define ExprHasAllProperty(E,P) (((E)->flags&(P))==(P))
+#define ExprSetProperty(E,P) (E)->flags|=(P)
+#define ExprClearProperty(E,P) (E)->flags&=~(P)
+#define ExprAlwaysTrue(E) (((E)->flags&(EP_OuterON|EP_IsTrue))==EP_IsTrue)
+#define ExprAlwaysFalse(E) (((E)->flags&(EP_OuterON|EP_IsFalse))==EP_IsFalse)
+#define ExprIsFullSize(E) (((E)->flags&(EP_Reduced|EP_TokenOnly))==0)
+
+/* Macros used to ensure that the correct members of unions are accessed
+** in Expr.
+*/
+#define ExprUseUToken(E) (((E)->flags&EP_IntValue)==0)
+#define ExprUseUValue(E) (((E)->flags&EP_IntValue)!=0)
+#define ExprUseWOfst(E) (((E)->flags&(EP_InnerON|EP_OuterON))==0)
+#define ExprUseWJoin(E) (((E)->flags&(EP_InnerON|EP_OuterON))!=0)
+#define ExprUseXList(E) (((E)->flags&EP_xIsSelect)==0)
+#define ExprUseXSelect(E) (((E)->flags&EP_xIsSelect)!=0)
+#define ExprUseYTab(E) (((E)->flags&(EP_WinFunc|EP_Subrtn))==0)
+#define ExprUseYWin(E) (((E)->flags&EP_WinFunc)!=0)
+#define ExprUseYSub(E) (((E)->flags&EP_Subrtn)!=0)
+
+/* Flags for use with Expr.vvaFlags
+*/
+#define EP_NoReduce 0x01 /* Cannot EXPRDUP_REDUCE this Expr */
+#define EP_Immutable 0x02 /* Do not change this Expr node */
+
+/* The ExprSetVVAProperty() macro is used for Verification, Validation,
+** and Accreditation only. It works like ExprSetProperty() during VVA
+** processes but is a no-op for delivery.
+*/
+#ifdef SQLITE_DEBUG
+# define ExprSetVVAProperty(E,P) (E)->vvaFlags|=(P)
+# define ExprHasVVAProperty(E,P) (((E)->vvaFlags&(P))!=0)
+# define ExprClearVVAProperties(E) (E)->vvaFlags = 0
+#else
+# define ExprSetVVAProperty(E,P)
+# define ExprHasVVAProperty(E,P) 0
+# define ExprClearVVAProperties(E)
+#endif
+
+/*
+** Macros to determine the number of bytes required by a normal Expr
+** struct, an Expr struct with the EP_Reduced flag set in Expr.flags
+** and an Expr struct with the EP_TokenOnly flag set.
+*/
+#define EXPR_FULLSIZE sizeof(Expr) /* Full size */
+#define EXPR_REDUCEDSIZE offsetof(Expr,iTable) /* Common features */
+#define EXPR_TOKENONLYSIZE offsetof(Expr,pLeft) /* Fewer features */
+
+/*
+** Flags passed to the sqlite3ExprDup() function. See the header comment
+** above sqlite3ExprDup() for details.
+*/
+#define EXPRDUP_REDUCE 0x0001 /* Used reduced-size Expr nodes */
+
+/*
+** True if the expression passed as an argument was a function with
+** an OVER() clause (a window function).
+*/
+#ifdef SQLITE_OMIT_WINDOWFUNC
+# define IsWindowFunc(p) 0
+#else
+# define IsWindowFunc(p) ( \
+ ExprHasProperty((p), EP_WinFunc) && p->y.pWin->eFrmType!=TK_FILTER \
+ )
+#endif
+
+/*
+** A list of expressions. Each expression may optionally have a
+** name. An expr/name combination can be used in several ways, such
+** as the list of "expr AS ID" fields following a "SELECT" or in the
+** list of "ID = expr" items in an UPDATE. A list of expressions can
+** also be used as the argument to a function, in which case the a.zName
+** field is not used.
+**
+** In order to try to keep memory usage down, the Expr.a.zEName field
+** is used for multiple purposes:
+**
+** eEName Usage
+** ---------- -------------------------
+** ENAME_NAME (1) the AS of result set column
+** (2) COLUMN= of an UPDATE
+**
+** ENAME_TAB DB.TABLE.NAME used to resolve names
+** of subqueries
+**
+** ENAME_SPAN Text of the original result set
+** expression.
+*/
+struct ExprList {
+ int nExpr; /* Number of expressions on the list */
+ int nAlloc; /* Number of a[] slots allocated */
+ struct ExprList_item { /* For each expression in the list */
+ Expr *pExpr; /* The parse tree for this expression */
+ char *zEName; /* Token associated with this expression */
+ struct {
+ u8 sortFlags; /* Mask of KEYINFO_ORDER_* flags */
+ unsigned eEName :2; /* Meaning of zEName */
+ unsigned done :1; /* Indicates when processing is finished */
+ unsigned reusable :1; /* Constant expression is reusable */
+ unsigned bSorterRef :1; /* Defer evaluation until after sorting */
+ unsigned bNulls :1; /* True if explicit "NULLS FIRST/LAST" */
+ unsigned bUsed :1; /* This column used in a SF_NestedFrom subquery */
+ unsigned bUsingTerm:1; /* Term from the USING clause of a NestedFrom */
+ unsigned bNoExpand: 1; /* Term is an auxiliary in NestedFrom and should
+ ** not be expanded by "*" in parent queries */
+ } fg;
+ union {
+ struct { /* Used by any ExprList other than Parse.pConsExpr */
+ u16 iOrderByCol; /* For ORDER BY, column number in result set */
+ u16 iAlias; /* Index into Parse.aAlias[] for zName */
+ } x;
+ int iConstExprReg; /* Register in which Expr value is cached. Used only
+ ** by Parse.pConstExpr */
+ } u;
+ } a[1]; /* One slot for each expression in the list */
+};
+
+/*
+** Allowed values for Expr.a.eEName
+*/
+#define ENAME_NAME 0 /* The AS clause of a result set */
+#define ENAME_SPAN 1 /* Complete text of the result set expression */
+#define ENAME_TAB 2 /* "DB.TABLE.NAME" for the result set */
+#define ENAME_ROWID 3 /* "DB.TABLE._rowid_" for * expansion of rowid */
+
+/*
+** An instance of this structure can hold a simple list of identifiers,
+** such as the list "a,b,c" in the following statements:
+**
+** INSERT INTO t(a,b,c) VALUES ...;
+** CREATE INDEX idx ON t(a,b,c);
+** CREATE TRIGGER trig BEFORE UPDATE ON t(a,b,c) ...;
+**
+** The IdList.a.idx field is used when the IdList represents the list of
+** column names after a table name in an INSERT statement. In the statement
+**
+** INSERT INTO t(a,b,c) ...
+**
+** If "a" is the k-th column of table "t", then IdList.a[0].idx==k.
+*/
+struct IdList {
+ int nId; /* Number of identifiers on the list */
+ struct IdList_item {
+ char *zName; /* Name of the identifier */
+ } a[1];
+};
+
+/*
+** Allowed values for IdList.eType, which determines which value of the a.u4
+** is valid.
+*/
+#define EU4_NONE 0 /* Does not use IdList.a.u4 */
+#define EU4_IDX 1 /* Uses IdList.a.u4.idx */
+#define EU4_EXPR 2 /* Uses IdList.a.u4.pExpr -- NOT CURRENTLY USED */
+
+/*
+** Details of the implementation of a subquery.
+*/
+struct Subquery {
+ Select *pSelect; /* A SELECT statement used in place of a table name */
+ int addrFillSub; /* Address of subroutine to initialize a subquery */
+ int regReturn; /* Register holding return address of addrFillSub */
+ int regResult; /* Registers holding results of a co-routine */
+};
+
+/*
+** The SrcItem object represents a single term in the FROM clause of a query.
+** The SrcList object is mostly an array of SrcItems.
+**
+** The jointype starts out showing the join type between the current table
+** and the next table on the list. The parser builds the list this way.
+** But sqlite3SrcListShiftJoinType() later shifts the jointypes so that each
+** jointype expresses the join between the table and the previous table.
+**
+** In the colUsed field, the high-order bit (bit 63) is set if the table
+** contains more than 63 columns and the 64-th or later column is used.
+**
+** Aggressive use of "union" helps keep the size of the object small. This
+** has been shown to boost performance, in addition to saving memory.
+** Access to union elements is gated by the following rules which should
+** always be checked, either by an if-statement or by an assert().
+**
+** Field Only access if this is true
+** --------------- -----------------------------------
+** u1.zIndexedBy fg.isIndexedBy
+** u1.pFuncArg fg.isTabFunc
+** u1.nRow !fg.isTabFunc && !fg.isIndexedBy
+**
+** u2.pIBIndex fg.isIndexedBy
+** u2.pCteUse fg.isCte
+**
+** u3.pOn !fg.isUsing
+** u3.pUsing fg.isUsing
+**
+** u4.zDatabase !fg.fixedSchema && !fg.isSubquery
+** u4.pSchema fg.fixedSchema
+** u4.pSubq fg.isSubquery
+**
+** See also the sqlite3SrcListDelete() routine for assert() statements that
+** check invariants on the fields of this object, especially the flags
+** inside the fg struct.
+*/
+struct SrcItem {
+ char *zName; /* Name of the table */
+ char *zAlias; /* The "B" part of a "A AS B" phrase. zName is the "A" */
+ Table *pSTab; /* Table object for zName. Mnemonic: Srcitem-TABle */
+ struct {
+ u8 jointype; /* Type of join between this table and the previous */
+ unsigned notIndexed :1; /* True if there is a NOT INDEXED clause */
+ unsigned isIndexedBy :1; /* True if there is an INDEXED BY clause */
+ unsigned isSubquery :1; /* True if this term is a subquery */
+ unsigned isTabFunc :1; /* True if table-valued-function syntax */
+ unsigned isCorrelated :1; /* True if sub-query is correlated */
+ unsigned isMaterialized:1; /* This is a materialized view */
+ unsigned viaCoroutine :1; /* Implemented as a co-routine */
+ unsigned isRecursive :1; /* True for recursive reference in WITH */
+ unsigned fromDDL :1; /* Comes from sqlite_schema */
+ unsigned isCte :1; /* This is a CTE */
+ unsigned notCte :1; /* This item may not match a CTE */
+ unsigned isUsing :1; /* u3.pUsing is valid */
+ unsigned isOn :1; /* u3.pOn was once valid and non-NULL */
+ unsigned isSynthUsing :1; /* u3.pUsing is synthesized from NATURAL */
+ unsigned isNestedFrom :1; /* pSelect is a SF_NestedFrom subquery */
+ unsigned rowidUsed :1; /* The ROWID of this table is referenced */
+ unsigned fixedSchema :1; /* Uses u4.pSchema, not u4.zDatabase */
+ unsigned hadSchema :1; /* Had u4.zDatabase before u4.pSchema */
+ } fg;
+ int iCursor; /* The VDBE cursor number used to access this table */
+ Bitmask colUsed; /* Bit N set if column N used. Details above for N>62 */
+ union {
+ char *zIndexedBy; /* Identifier from "INDEXED BY <zIndex>" clause */
+ ExprList *pFuncArg; /* Arguments to table-valued-function */
+ u32 nRow; /* Number of rows in a VALUES clause */
+ } u1;
+ union {
+ Index *pIBIndex; /* Index structure corresponding to u1.zIndexedBy */
+ CteUse *pCteUse; /* CTE Usage info when fg.isCte is true */
+ } u2;
+ union {
+ Expr *pOn; /* fg.isUsing==0 => The ON clause of a join */
+ IdList *pUsing; /* fg.isUsing==1 => The USING clause of a join */
+ } u3;
+ union {
+ Schema *pSchema; /* Schema to which this item is fixed */
+ char *zDatabase; /* Name of database holding this table */
+ Subquery *pSubq; /* Description of a subquery */
+ } u4;
+};
+
+/*
+** The OnOrUsing object represents either an ON clause or a USING clause.
+** It can never be both at the same time, but it can be neither.
+*/
+struct OnOrUsing {
+ Expr *pOn; /* The ON clause of a join */
+ IdList *pUsing; /* The USING clause of a join */
+};
+
+/*
+** This object represents one or more tables that are the source of
+** content for an SQL statement. For example, a single SrcList object
+** is used to hold the FROM clause of a SELECT statement. SrcList also
+** represents the target tables for DELETE, INSERT, and UPDATE statements.
+**
+*/
+struct SrcList {
+ int nSrc; /* Number of tables or subqueries in the FROM clause */
+ u32 nAlloc; /* Number of entries allocated in a[] below */
+ SrcItem a[1]; /* One entry for each identifier on the list */
+};
+
+/*
+** Permitted values of the SrcList.a.jointype field
+*/
+#define JT_INNER 0x01 /* Any kind of inner or cross join */
+#define JT_CROSS 0x02 /* Explicit use of the CROSS keyword */
+#define JT_NATURAL 0x04 /* True for a "natural" join */
+#define JT_LEFT 0x08 /* Left outer join */
+#define JT_RIGHT 0x10 /* Right outer join */
+#define JT_OUTER 0x20 /* The "OUTER" keyword is present */
+#define JT_LTORJ 0x40 /* One of the LEFT operands of a RIGHT JOIN
+ ** Mnemonic: Left Table Of Right Join */
+#define JT_ERROR 0x80 /* unknown or unsupported join type */
+
+/*
+** Flags appropriate for the wctrlFlags parameter of sqlite3WhereBegin()
+** and the WhereInfo.wctrlFlags member.
+**
+** Value constraints (enforced via assert()):
+** WHERE_USE_LIMIT == SF_FixedLimit
+*/
+#define WHERE_ORDERBY_NORMAL 0x0000 /* No-op */
+#define WHERE_ORDERBY_MIN 0x0001 /* ORDER BY processing for min() func */
+#define WHERE_ORDERBY_MAX 0x0002 /* ORDER BY processing for max() func */
+#define WHERE_ONEPASS_DESIRED 0x0004 /* Want to do one-pass UPDATE/DELETE */
+#define WHERE_ONEPASS_MULTIROW 0x0008 /* ONEPASS is ok with multiple rows */
+#define WHERE_DUPLICATES_OK 0x0010 /* Ok to return a row more than once */
+#define WHERE_OR_SUBCLAUSE 0x0020 /* Processing a sub-WHERE as part of
+ ** the OR optimization */
+#define WHERE_GROUPBY 0x0040 /* pOrderBy is really a GROUP BY */
+#define WHERE_DISTINCTBY 0x0080 /* pOrderby is really a DISTINCT clause */
+#define WHERE_WANT_DISTINCT 0x0100 /* All output needs to be distinct */
+#define WHERE_SORTBYGROUP 0x0200 /* Support sqlite3WhereIsSorted() */
+#define WHERE_AGG_DISTINCT 0x0400 /* Query is "SELECT agg(DISTINCT ...)" */
+#define WHERE_ORDERBY_LIMIT 0x0800 /* ORDERBY+LIMIT on the inner loop */
+#define WHERE_RIGHT_JOIN 0x1000 /* Processing a RIGHT JOIN */
+#define WHERE_KEEP_ALL_JOINS 0x2000 /* Do not do the omit-noop-join opt */
+#define WHERE_USE_LIMIT 0x4000 /* Use the LIMIT in cost estimates */
+ /* 0x8000 not currently used */
+
+/* Allowed return values from sqlite3WhereIsDistinct()
+*/
+#define WHERE_DISTINCT_NOOP 0 /* DISTINCT keyword not used */
+#define WHERE_DISTINCT_UNIQUE 1 /* No duplicates */
+#define WHERE_DISTINCT_ORDERED 2 /* All duplicates are adjacent */
+#define WHERE_DISTINCT_UNORDERED 3 /* Duplicates are scattered */
+
+/*
+** A NameContext defines a context in which to resolve table and column
+** names. The context consists of a list of tables (the pSrcList) field and
+** a list of named expression (pEList). The named expression list may
+** be NULL. The pSrc corresponds to the FROM clause of a SELECT or
+** to the table being operated on by INSERT, UPDATE, or DELETE. The
+** pEList corresponds to the result set of a SELECT and is NULL for
+** other statements.
+**
+** NameContexts can be nested. When resolving names, the inner-most
+** context is searched first. If no match is found, the next outer
+** context is checked. If there is still no match, the next context
+** is checked. This process continues until either a match is found
+** or all contexts are check. When a match is found, the nRef member of
+** the context containing the match is incremented.
+**
+** Each subquery gets a new NameContext. The pNext field points to the
+** NameContext in the parent query. Thus the process of scanning the
+** NameContext list corresponds to searching through successively outer
+** subqueries looking for a match.
+*/
+struct NameContext {
+ Parse *pParse; /* The parser */
+ SrcList *pSrcList; /* One or more tables used to resolve names */
+ union {
+ ExprList *pEList; /* Optional list of result-set columns */
+ AggInfo *pAggInfo; /* Information about aggregates at this level */
+ Upsert *pUpsert; /* ON CONFLICT clause information from an upsert */
+ int iBaseReg; /* For TK_REGISTER when parsing RETURNING */
+ } uNC;
+ NameContext *pNext; /* Next outer name context. NULL for outermost */
+ int nRef; /* Number of names resolved by this context */
+ int nNcErr; /* Number of errors encountered while resolving names */
+ int ncFlags; /* Zero or more NC_* flags defined below */
+ u32 nNestedSelect; /* Number of nested selects using this NC */
+ Select *pWinSelect; /* SELECT statement for any window functions */
+};
+
+/*
+** Allowed values for the NameContext, ncFlags field.
+**
+** Value constraints (all checked via assert()):
+** NC_HasAgg == SF_HasAgg == EP_Agg
+** NC_MinMaxAgg == SF_MinMaxAgg == SQLITE_FUNC_MINMAX
+** NC_OrderAgg == SF_OrderByReqd == SQLITE_FUNC_ANYORDER
+** NC_HasWin == EP_Win
+**
+*/
+#define NC_AllowAgg 0x000001 /* Aggregate functions are allowed here */
+#define NC_PartIdx 0x000002 /* True if resolving a partial index WHERE */
+#define NC_IsCheck 0x000004 /* True if resolving a CHECK constraint */
+#define NC_GenCol 0x000008 /* True for a GENERATED ALWAYS AS clause */
+#define NC_HasAgg 0x000010 /* One or more aggregate functions seen */
+#define NC_IdxExpr 0x000020 /* True if resolving columns of CREATE INDEX */
+#define NC_SelfRef 0x00002e /* Combo: PartIdx, isCheck, GenCol, and IdxExpr */
+#define NC_Subquery 0x000040 /* A subquery has been seen */
+#define NC_UEList 0x000080 /* True if uNC.pEList is used */
+#define NC_UAggInfo 0x000100 /* True if uNC.pAggInfo is used */
+#define NC_UUpsert 0x000200 /* True if uNC.pUpsert is used */
+#define NC_UBaseReg 0x000400 /* True if uNC.iBaseReg is used */
+#define NC_MinMaxAgg 0x001000 /* min/max aggregates seen. See note above */
+/* 0x002000 // available for reuse */
+#define NC_AllowWin 0x004000 /* Window functions are allowed here */
+#define NC_HasWin 0x008000 /* One or more window functions seen */
+#define NC_IsDDL 0x010000 /* Resolving names in a CREATE statement */
+#define NC_InAggFunc 0x020000 /* True if analyzing arguments to an agg func */
+#define NC_FromDDL 0x040000 /* SQL text comes from sqlite_schema */
+#define NC_NoSelect 0x080000 /* Do not descend into sub-selects */
+#define NC_Where 0x100000 /* Processing WHERE clause of a SELECT */
+#define NC_OrderAgg 0x8000000 /* Has an aggregate other than count/min/max */
+
+/*
+** An instance of the following object describes a single ON CONFLICT
+** clause in an upsert.
+**
+** The pUpsertTarget field is only set if the ON CONFLICT clause includes
+** conflict-target clause. (In "ON CONFLICT(a,b)" the "(a,b)" is the
+** conflict-target clause.) The pUpsertTargetWhere is the optional
+** WHERE clause used to identify partial unique indexes.
+**
+** pUpsertSet is the list of column=expr terms of the UPDATE statement.
+** The pUpsertSet field is NULL for a ON CONFLICT DO NOTHING. The
+** pUpsertWhere is the WHERE clause for the UPDATE and is NULL if the
+** WHERE clause is omitted.
+*/
+struct Upsert {
+ ExprList *pUpsertTarget; /* Optional description of conflict target */
+ Expr *pUpsertTargetWhere; /* WHERE clause for partial index targets */
+ ExprList *pUpsertSet; /* The SET clause from an ON CONFLICT UPDATE */
+ Expr *pUpsertWhere; /* WHERE clause for the ON CONFLICT UPDATE */
+ Upsert *pNextUpsert; /* Next ON CONFLICT clause in the list */
+ u8 isDoUpdate; /* True for DO UPDATE. False for DO NOTHING */
+ u8 isDup; /* True if 2nd or later with same pUpsertIdx */
+ /* Above this point is the parse tree for the ON CONFLICT clauses.
+ ** The next group of fields stores intermediate data. */
+ void *pToFree; /* Free memory when deleting the Upsert object */
+ /* All fields above are owned by the Upsert object and must be freed
+ ** when the Upsert is destroyed. The fields below are used to transfer
+ ** information from the INSERT processing down into the UPDATE processing
+ ** while generating code. The fields below are owned by the INSERT
+ ** statement and will be freed by INSERT processing. */
+ Index *pUpsertIdx; /* UNIQUE constraint specified by pUpsertTarget */
+ SrcList *pUpsertSrc; /* Table to be updated */
+ int regData; /* First register holding array of VALUES */
+ int iDataCur; /* Index of the data cursor */
+ int iIdxCur; /* Index of the first index cursor */
+};
+
+/*
+** An instance of the following structure contains all information
+** needed to generate code for a single SELECT statement.
+**
+** See the header comment on the computeLimitRegisters() routine for a
+** detailed description of the meaning of the iLimit and iOffset fields.
+**
+** addrOpenEphm[] entries contain the address of OP_OpenEphemeral opcodes.
+** These addresses must be stored so that we can go back and fill in
+** the P4_KEYINFO and P2 parameters later. Neither the KeyInfo nor
+** the number of columns in P2 can be computed at the same time
+** as the OP_OpenEphm instruction is coded because not
+** enough information about the compound query is known at that point.
+** The KeyInfo for addrOpenTran[0] and [1] contains collating sequences
+** for the result set. The KeyInfo for addrOpenEphm[2] contains collating
+** sequences for the ORDER BY clause.
+*/
+struct Select {
+ u8 op; /* One of: TK_UNION TK_ALL TK_INTERSECT TK_EXCEPT */
+ LogEst nSelectRow; /* Estimated number of result rows */
+ u32 selFlags; /* Various SF_* values */
+ int iLimit, iOffset; /* Memory registers holding LIMIT & OFFSET counters */
+ u32 selId; /* Unique identifier number for this SELECT */
+ int addrOpenEphm[2]; /* OP_OpenEphem opcodes related to this select */
+ ExprList *pEList; /* The fields of the result */
+ SrcList *pSrc; /* The FROM clause */
+ Expr *pWhere; /* The WHERE clause */
+ ExprList *pGroupBy; /* The GROUP BY clause */
+ Expr *pHaving; /* The HAVING clause */
+ ExprList *pOrderBy; /* The ORDER BY clause */
+ Select *pPrior; /* Prior select in a compound select statement */
+ Select *pNext; /* Next select to the left in a compound */
+ Expr *pLimit; /* LIMIT expression. NULL means not used. */
+ With *pWith; /* WITH clause attached to this select. Or NULL. */
+#ifndef SQLITE_OMIT_WINDOWFUNC
+ Window *pWin; /* List of window functions */
+ Window *pWinDefn; /* List of named window definitions */
+#endif
+};
+
+/*
+** Allowed values for Select.selFlags. The "SF" prefix stands for
+** "Select Flag".
+**
+** Value constraints (all checked via assert())
+** SF_HasAgg == NC_HasAgg
+** SF_MinMaxAgg == NC_MinMaxAgg == SQLITE_FUNC_MINMAX
+** SF_OrderByReqd == NC_OrderAgg == SQLITE_FUNC_ANYORDER
+** SF_FixedLimit == WHERE_USE_LIMIT
+*/
+#define SF_Distinct 0x0000001 /* Output should be DISTINCT */
+#define SF_All 0x0000002 /* Includes the ALL keyword */
+#define SF_Resolved 0x0000004 /* Identifiers have been resolved */
+#define SF_Aggregate 0x0000008 /* Contains agg functions or a GROUP BY */
+#define SF_HasAgg 0x0000010 /* Contains aggregate functions */
+#define SF_UsesEphemeral 0x0000020 /* Uses the OpenEphemeral opcode */
+#define SF_Expanded 0x0000040 /* sqlite3SelectExpand() called on this */
+#define SF_HasTypeInfo 0x0000080 /* FROM subqueries have Table metadata */
+#define SF_Compound 0x0000100 /* Part of a compound query */
+#define SF_Values 0x0000200 /* Synthesized from VALUES clause */
+#define SF_MultiValue 0x0000400 /* Single VALUES term with multiple rows */
+#define SF_NestedFrom 0x0000800 /* Part of a parenthesized FROM clause */
+#define SF_MinMaxAgg 0x0001000 /* Aggregate containing min() or max() */
+#define SF_Recursive 0x0002000 /* The recursive part of a recursive CTE */
+#define SF_FixedLimit 0x0004000 /* nSelectRow set by a constant LIMIT */
+#define SF_MaybeConvert 0x0008000 /* Need convertCompoundSelectToSubquery() */
+#define SF_Converted 0x0010000 /* By convertCompoundSelectToSubquery() */
+#define SF_IncludeHidden 0x0020000 /* Include hidden columns in output */
+#define SF_ComplexResult 0x0040000 /* Result contains subquery or function */
+#define SF_WhereBegin 0x0080000 /* Really a WhereBegin() call. Debug Only */
+#define SF_WinRewrite 0x0100000 /* Window function rewrite accomplished */
+#define SF_View 0x0200000 /* SELECT statement is a view */
+#define SF_NoopOrderBy 0x0400000 /* ORDER BY is ignored for this query */
+#define SF_UFSrcCheck 0x0800000 /* Check pSrc as required by UPDATE...FROM */
+#define SF_PushDown 0x1000000 /* Modified by WHERE-clause push-down opt */
+#define SF_MultiPart 0x2000000 /* Has multiple incompatible PARTITIONs */
+#define SF_CopyCte 0x4000000 /* SELECT statement is a copy of a CTE */
+#define SF_OrderByReqd 0x8000000 /* The ORDER BY clause may not be omitted */
+#define SF_UpdateFrom 0x10000000 /* Query originates with UPDATE FROM */
+#define SF_Correlated 0x20000000 /* True if references the outer context */
+
+/* True if SrcItem X is a subquery that has SF_NestedFrom */
+#define IsNestedFrom(X) \
+ ((X)->fg.isSubquery && \
+ ((X)->u4.pSubq->pSelect->selFlags&SF_NestedFrom)!=0)
+
+/*
+** The results of a SELECT can be distributed in several ways, as defined
+** by one of the following macros. The "SRT" prefix means "SELECT Result
+** Type".
+**
+** SRT_Union Store results as a key in a temporary index
+** identified by pDest->iSDParm.
+**
+** SRT_Except Remove results from the temporary index pDest->iSDParm.
+**
+** SRT_Exists Store a 1 in memory cell pDest->iSDParm if the result
+** set is not empty.
+**
+** SRT_Discard Throw the results away. This is used by SELECT
+** statements within triggers whose only purpose is
+** the side-effects of functions.
+**
+** SRT_Output Generate a row of output (using the OP_ResultRow
+** opcode) for each row in the result set.
+**
+** SRT_Mem Only valid if the result is a single column.
+** Store the first column of the first result row
+** in register pDest->iSDParm then abandon the rest
+** of the query. This destination implies "LIMIT 1".
+**
+** SRT_Set The result must be a single column. Store each
+** row of result as the key in table pDest->iSDParm.
+** Apply the affinity pDest->affSdst before storing
+** results. if pDest->iSDParm2 is positive, then it is
+** a register holding a Bloom filter for the IN operator
+** that should be populated in addition to the
+** pDest->iSDParm table. This SRT is used to
+** implement "IN (SELECT ...)".
+**
+** SRT_EphemTab Create an temporary table pDest->iSDParm and store
+** the result there. The cursor is left open after
+** returning. This is like SRT_Table except that
+** this destination uses OP_OpenEphemeral to create
+** the table first.
+**
+** SRT_Coroutine Generate a co-routine that returns a new row of
+** results each time it is invoked. The entry point
+** of the co-routine is stored in register pDest->iSDParm
+** and the result row is stored in pDest->nDest registers
+** starting with pDest->iSdst.
+**
+** SRT_Table Store results in temporary table pDest->iSDParm.
+** SRT_Fifo This is like SRT_EphemTab except that the table
+** is assumed to already be open. SRT_Fifo has
+** the additional property of being able to ignore
+** the ORDER BY clause.
+**
+** SRT_DistFifo Store results in a temporary table pDest->iSDParm.
+** But also use temporary table pDest->iSDParm+1 as
+** a record of all prior results and ignore any duplicate
+** rows. Name means: "Distinct Fifo".
+**
+** SRT_Queue Store results in priority queue pDest->iSDParm (really
+** an index). Append a sequence number so that all entries
+** are distinct.
+**
+** SRT_DistQueue Store results in priority queue pDest->iSDParm only if
+** the same record has never been stored before. The
+** index at pDest->iSDParm+1 hold all prior stores.
+**
+** SRT_Upfrom Store results in the temporary table already opened by
+** pDest->iSDParm. If (pDest->iSDParm<0), then the temp
+** table is an intkey table - in this case the first
+** column returned by the SELECT is used as the integer
+** key. If (pDest->iSDParm>0), then the table is an index
+** table. (pDest->iSDParm) is the number of key columns in
+** each index record in this case.
+*/
+#define SRT_Union 1 /* Store result as keys in an index */
+#define SRT_Except 2 /* Remove result from a UNION index */
+#define SRT_Exists 3 /* Store 1 if the result is not empty */
+#define SRT_Discard 4 /* Do not save the results anywhere */
+#define SRT_DistFifo 5 /* Like SRT_Fifo, but unique results only */
+#define SRT_DistQueue 6 /* Like SRT_Queue, but unique results only */
+
+/* The DISTINCT clause is ignored for all of the above. Not that
+** IgnorableDistinct() implies IgnorableOrderby() */
+#define IgnorableDistinct(X) ((X->eDest)<=SRT_DistQueue)
+
+#define SRT_Queue 7 /* Store result in an queue */
+#define SRT_Fifo 8 /* Store result as data with an automatic rowid */
+
+/* The ORDER BY clause is ignored for all of the above */
+#define IgnorableOrderby(X) ((X->eDest)<=SRT_Fifo)
+
+#define SRT_Output 9 /* Output each row of result */
+#define SRT_Mem 10 /* Store result in a memory cell */
+#define SRT_Set 11 /* Store results as keys in an index */
+#define SRT_EphemTab 12 /* Create transient tab and store like SRT_Table */
+#define SRT_Coroutine 13 /* Generate a single row of result */
+#define SRT_Table 14 /* Store result as data with an automatic rowid */
+#define SRT_Upfrom 15 /* Store result as data with rowid */
+
+/*
+** An instance of this object describes where to put of the results of
+** a SELECT statement.
+*/
+struct SelectDest {
+ u8 eDest; /* How to dispose of the results. One of SRT_* above. */
+ int iSDParm; /* A parameter used by the eDest disposal method */
+ int iSDParm2; /* A second parameter for the eDest disposal method */
+ int iSdst; /* Base register where results are written */
+ int nSdst; /* Number of registers allocated */
+ char *zAffSdst; /* Affinity used for SRT_Set */
+ ExprList *pOrderBy; /* Key columns for SRT_Queue and SRT_DistQueue */
+};
+
+/*
+** During code generation of statements that do inserts into AUTOINCREMENT
+** tables, the following information is attached to the Table.u.autoInc.p
+** pointer of each autoincrement table to record some side information that
+** the code generator needs. We have to keep per-table autoincrement
+** information in case inserts are done within triggers. Triggers do not
+** normally coordinate their activities, but we do need to coordinate the
+** loading and saving of autoincrement information.
+*/
+struct AutoincInfo {
+ AutoincInfo *pNext; /* Next info block in a list of them all */
+ Table *pTab; /* Table this info block refers to */
+ int iDb; /* Index in sqlite3.aDb[] of database holding pTab */
+ int regCtr; /* Memory register holding the rowid counter */
+};
+
+/*
+** At least one instance of the following structure is created for each
+** trigger that may be fired while parsing an INSERT, UPDATE or DELETE
+** statement. All such objects are stored in the linked list headed at
+** Parse.pTriggerPrg and deleted once statement compilation has been
+** completed.
+**
+** A Vdbe sub-program that implements the body and WHEN clause of trigger
+** TriggerPrg.pTrigger, assuming a default ON CONFLICT clause of
+** TriggerPrg.orconf, is stored in the TriggerPrg.pProgram variable.
+** The Parse.pTriggerPrg list never contains two entries with the same
+** values for both pTrigger and orconf.
+**
+** The TriggerPrg.aColmask[0] variable is set to a mask of old.* columns
+** accessed (or set to 0 for triggers fired as a result of INSERT
+** statements). Similarly, the TriggerPrg.aColmask[1] variable is set to
+** a mask of new.* columns used by the program.
+*/
+struct TriggerPrg {
+ Trigger *pTrigger; /* Trigger this program was coded from */
+ TriggerPrg *pNext; /* Next entry in Parse.pTriggerPrg list */
+ SubProgram *pProgram; /* Program implementing pTrigger/orconf */
+ int orconf; /* Default ON CONFLICT policy */
+ u32 aColmask[2]; /* Masks of old.*, new.* columns accessed */
+};
+
+/*
+** The yDbMask datatype for the bitmask of all attached databases.
+*/
+#if SQLITE_MAX_ATTACHED>30
+ typedef unsigned char yDbMask[(SQLITE_MAX_ATTACHED+9)/8];
+# define DbMaskTest(M,I) (((M)[(I)/8]&(1<<((I)&7)))!=0)
+# define DbMaskZero(M) memset((M),0,sizeof(M))
+# define DbMaskSet(M,I) (M)[(I)/8]|=(1<<((I)&7))
+# define DbMaskAllZero(M) sqlite3DbMaskAllZero(M)
+# define DbMaskNonZero(M) (sqlite3DbMaskAllZero(M)==0)
+#else
+ typedef unsigned int yDbMask;
+# define DbMaskTest(M,I) (((M)&(((yDbMask)1)<<(I)))!=0)
+# define DbMaskZero(M) ((M)=0)
+# define DbMaskSet(M,I) ((M)|=(((yDbMask)1)<<(I)))
+# define DbMaskAllZero(M) ((M)==0)
+# define DbMaskNonZero(M) ((M)!=0)
+#endif
+
+/*
+** For each index X that has as one of its arguments either an expression
+** or the name of a virtual generated column, and if X is in scope such that
+** the value of the expression can simply be read from the index, then
+** there is an instance of this object on the Parse.pIdxExpr list.
+**
+** During code generation, while generating code to evaluate expressions,
+** this list is consulted and if a matching expression is found, the value
+** is read from the index rather than being recomputed.
+*/
+struct IndexedExpr {
+ Expr *pExpr; /* The expression contained in the index */
+ int iDataCur; /* The data cursor associated with the index */
+ int iIdxCur; /* The index cursor */
+ int iIdxCol; /* The index column that contains value of pExpr */
+ u8 bMaybeNullRow; /* True if we need an OP_IfNullRow check */
+ u8 aff; /* Affinity of the pExpr expression */
+ IndexedExpr *pIENext; /* Next in a list of all indexed expressions */
+#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
+ const char *zIdxName; /* Name of index, used only for bytecode comments */
+#endif
+};
+
+/*
+** An instance of the ParseCleanup object specifies an operation that
+** should be performed after parsing to deallocation resources obtained
+** during the parse and which are no longer needed.
+*/
+struct ParseCleanup {
+ ParseCleanup *pNext; /* Next cleanup task */
+ void *pPtr; /* Pointer to object to deallocate */
+ void (*xCleanup)(sqlite3*,void*); /* Deallocation routine */
+};
+
+/*
+** An SQL parser context. A copy of this structure is passed through
+** the parser and down into all the parser action routine in order to
+** carry around information that is global to the entire parse.
+**
+** The structure is divided into two parts. When the parser and code
+** generate call themselves recursively, the first part of the structure
+** is constant but the second part is reset at the beginning and end of
+** each recursion.
+**
+** The nTableLock and aTableLock variables are only used if the shared-cache
+** feature is enabled (if sqlite3Tsd()->useSharedData is true). They are
+** used to store the set of table-locks required by the statement being
+** compiled. Function sqlite3TableLock() is used to add entries to the
+** list.
+*/
+struct Parse {
+ sqlite3 *db; /* The main database structure */
+ char *zErrMsg; /* An error message */
+ Vdbe *pVdbe; /* An engine for executing database bytecode */
+ int rc; /* Return code from execution */
+ u8 colNamesSet; /* TRUE after OP_ColumnName has been issued to pVdbe */
+ u8 checkSchema; /* Causes schema cookie check after an error */
+ u8 nested; /* Number of nested calls to the parser/code generator */
+ u8 nTempReg; /* Number of temporary registers in aTempReg[] */
+ u8 isMultiWrite; /* True if statement may modify/insert multiple rows */
+ u8 mayAbort; /* True if statement may throw an ABORT exception */
+ u8 hasCompound; /* Need to invoke convertCompoundSelectToSubquery() */
+ u8 okConstFactor; /* OK to factor out constants */
+ u8 disableLookaside; /* Number of times lookaside has been disabled */
+ u8 prepFlags; /* SQLITE_PREPARE_* flags */
+ u8 withinRJSubrtn; /* Nesting level for RIGHT JOIN body subroutines */
+ u8 bHasWith; /* True if statement contains WITH */
+ u8 mSubrtnSig; /* mini Bloom filter on available SubrtnSig.selId */
+#if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)
+ u8 earlyCleanup; /* OOM inside sqlite3ParserAddCleanup() */
+#endif
+#ifdef SQLITE_DEBUG
+ u8 ifNotExists; /* Might be true if IF NOT EXISTS. Assert()s only */
+#endif
+ int nRangeReg; /* Size of the temporary register block */
+ int iRangeReg; /* First register in temporary register block */
+ int nErr; /* Number of errors seen */
+ int nTab; /* Number of previously allocated VDBE cursors */
+ int nMem; /* Number of memory cells used so far */
+ int szOpAlloc; /* Bytes of memory space allocated for Vdbe.aOp[] */
+ int iSelfTab; /* Table associated with an index on expr, or negative
+ ** of the base register during check-constraint eval */
+ int nLabel; /* The *negative* of the number of labels used */
+ int nLabelAlloc; /* Number of slots in aLabel */
+ int *aLabel; /* Space to hold the labels */
+ ExprList *pConstExpr;/* Constant expressions */
+ IndexedExpr *pIdxEpr;/* List of expressions used by active indexes */
+ IndexedExpr *pIdxPartExpr; /* Exprs constrained by index WHERE clauses */
+ Token constraintName;/* Name of the constraint currently being parsed */
+ yDbMask writeMask; /* Start a write transaction on these databases */
+ yDbMask cookieMask; /* Bitmask of schema verified databases */
+ int regRowid; /* Register holding rowid of CREATE TABLE entry */
+ int regRoot; /* Register holding root page number for new objects */
+ int nMaxArg; /* Max args passed to user function by sub-program */
+ int nSelect; /* Number of SELECT stmts. Counter for Select.selId */
+#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
+ u32 nProgressSteps; /* xProgress steps taken during sqlite3_prepare() */
+#endif
+#ifndef SQLITE_OMIT_SHARED_CACHE
+ int nTableLock; /* Number of locks in aTableLock */
+ TableLock *aTableLock; /* Required table locks for shared-cache mode */
+#endif
+ AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */
+ Parse *pToplevel; /* Parse structure for main program (or NULL) */
+ Table *pTriggerTab; /* Table triggers are being coded for */
+ TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */
+ ParseCleanup *pCleanup; /* List of cleanup operations to run after parse */
+ union {
+ int addrCrTab; /* Address of OP_CreateBtree on CREATE TABLE */
+ Returning *pReturning; /* The RETURNING clause */
+ } u1;
+ u32 oldmask; /* Mask of old.* columns referenced */
+ u32 newmask; /* Mask of new.* columns referenced */
+ LogEst nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */
+ u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */
+ u8 bReturning; /* Coding a RETURNING trigger */
+ u8 eOrconf; /* Default ON CONFLICT policy for trigger steps */
+ u8 disableTriggers; /* True to disable triggers */
+
+ /**************************************************************************
+ ** Fields above must be initialized to zero. The fields that follow,
+ ** down to the beginning of the recursive section, do not need to be
+ ** initialized as they will be set before being used. The boundary is
+ ** determined by offsetof(Parse,aTempReg).
+ **************************************************************************/
+
+ int aTempReg[8]; /* Holding area for temporary registers */
+ Parse *pOuterParse; /* Outer Parse object when nested */
+ Token sNameToken; /* Token with unqualified schema object name */
+
+ /************************************************************************
+ ** Above is constant between recursions. Below is reset before and after
+ ** each recursion. The boundary between these two regions is determined
+ ** using offsetof(Parse,sLastToken) so the sLastToken field must be the
+ ** first field in the recursive region.
+ ************************************************************************/
+
+ Token sLastToken; /* The last token parsed */
+ ynVar nVar; /* Number of '?' variables seen in the SQL so far */
+ u8 iPkSortOrder; /* ASC or DESC for INTEGER PRIMARY KEY */
+ u8 explain; /* True if the EXPLAIN flag is found on the query */
+ u8 eParseMode; /* PARSE_MODE_XXX constant */
+#ifndef SQLITE_OMIT_VIRTUALTABLE
+ int nVtabLock; /* Number of virtual tables to lock */
+#endif
+ int nHeight; /* Expression tree height of current sub-select */
+ int addrExplain; /* Address of current OP_Explain opcode */
+ VList *pVList; /* Mapping between variable names and numbers */
+ Vdbe *pReprepare; /* VM being reprepared (sqlite3Reprepare()) */
+ const char *zTail; /* All SQL text past the last semicolon parsed */
+ Table *pNewTable; /* A table being constructed by CREATE TABLE */
+ Index *pNewIndex; /* An index being constructed by CREATE INDEX.
+ ** Also used to hold redundant UNIQUE constraints
+ ** during a RENAME COLUMN */
+ Trigger *pNewTrigger; /* Trigger under construct by a CREATE TRIGGER */
+ const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */
+#ifndef SQLITE_OMIT_VIRTUALTABLE
+ Token sArg; /* Complete text of a module argument */
+ Table **apVtabLock; /* Pointer to virtual tables needing locking */
+#endif
+ With *pWith; /* Current WITH clause, or NULL */
+#ifndef SQLITE_OMIT_ALTERTABLE
+ RenameToken *pRename; /* Tokens subject to renaming by ALTER TABLE */
+#endif
+};
+
+/* Allowed values for Parse.eParseMode
+*/
+#define PARSE_MODE_NORMAL 0
+#define PARSE_MODE_DECLARE_VTAB 1
+#define PARSE_MODE_RENAME 2
+#define PARSE_MODE_UNMAP 3
+
+/*
+** Sizes and pointers of various parts of the Parse object.
+*/
+#define PARSE_HDR(X) (((char*)(X))+offsetof(Parse,zErrMsg))
+#define PARSE_HDR_SZ (offsetof(Parse,aTempReg)-offsetof(Parse,zErrMsg)) /* Recursive part w/o aColCache*/
+#define PARSE_RECURSE_SZ offsetof(Parse,sLastToken) /* Recursive part */
+#define PARSE_TAIL_SZ (sizeof(Parse)-PARSE_RECURSE_SZ) /* Non-recursive part */
+#define PARSE_TAIL(X) (((char*)(X))+PARSE_RECURSE_SZ) /* Pointer to tail */
+
+/*
+** Return true if currently inside an sqlite3_declare_vtab() call.
+*/
+#ifdef SQLITE_OMIT_VIRTUALTABLE
+ #define IN_DECLARE_VTAB 0
+#else
+ #define IN_DECLARE_VTAB (pParse->eParseMode==PARSE_MODE_DECLARE_VTAB)
+#endif
+
+#if defined(SQLITE_OMIT_ALTERTABLE)
+ #define IN_RENAME_OBJECT 0
+#else
+ #define IN_RENAME_OBJECT (pParse->eParseMode>=PARSE_MODE_RENAME)
+#endif
+
+#if defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_OMIT_ALTERTABLE)
+ #define IN_SPECIAL_PARSE 0
+#else
+ #define IN_SPECIAL_PARSE (pParse->eParseMode!=PARSE_MODE_NORMAL)
+#endif
+
+/*
+** An instance of the following structure can be declared on a stack and used
+** to save the Parse.zAuthContext value so that it can be restored later.
+*/
+struct AuthContext {
+ const char *zAuthContext; /* Put saved Parse.zAuthContext here */
+ Parse *pParse; /* The Parse structure */
+};
+
+/*
+** Bitfield flags for P5 value in various opcodes.
+**
+** Value constraints (enforced via assert()):
+** OPFLAG_LENGTHARG == SQLITE_FUNC_LENGTH
+** OPFLAG_TYPEOFARG == SQLITE_FUNC_TYPEOF
+** OPFLAG_BULKCSR == BTREE_BULKLOAD
+** OPFLAG_SEEKEQ == BTREE_SEEK_EQ
+** OPFLAG_FORDELETE == BTREE_FORDELETE
+** OPFLAG_SAVEPOSITION == BTREE_SAVEPOSITION
+** OPFLAG_AUXDELETE == BTREE_AUXDELETE
+*/
+#define OPFLAG_NCHANGE 0x01 /* OP_Insert: Set to update db->nChange */
+ /* Also used in P2 (not P5) of OP_Delete */
+#define OPFLAG_NOCHNG 0x01 /* OP_VColumn nochange for UPDATE */
+#define OPFLAG_EPHEM 0x01 /* OP_Column: Ephemeral output is ok */
+#define OPFLAG_LASTROWID 0x20 /* Set to update db->lastRowid */
+#define OPFLAG_ISUPDATE 0x04 /* This OP_Insert is an sql UPDATE */
+#define OPFLAG_APPEND 0x08 /* This is likely to be an append */
+#define OPFLAG_USESEEKRESULT 0x10 /* Try to avoid a seek in BtreeInsert() */
+#define OPFLAG_ISNOOP 0x40 /* OP_Delete does pre-update-hook only */
+#define OPFLAG_LENGTHARG 0x40 /* OP_Column only used for length() */
+#define OPFLAG_TYPEOFARG 0x80 /* OP_Column only used for typeof() */
+#define OPFLAG_BYTELENARG 0xc0 /* OP_Column only for octet_length() */
+#define OPFLAG_BULKCSR 0x01 /* OP_Open** used to open bulk cursor */
+#define OPFLAG_SEEKEQ 0x02 /* OP_Open** cursor uses EQ seek only */
+#define OPFLAG_FORDELETE 0x08 /* OP_Open should use BTREE_FORDELETE */
+#define OPFLAG_P2ISREG 0x10 /* P2 to OP_Open** is a register number */
+#define OPFLAG_PERMUTE 0x01 /* OP_Compare: use the permutation */
+#define OPFLAG_SAVEPOSITION 0x02 /* OP_Delete/Insert: save cursor pos */
+#define OPFLAG_AUXDELETE 0x04 /* OP_Delete: index in a DELETE op */
+#define OPFLAG_NOCHNG_MAGIC 0x6d /* OP_MakeRecord: serialtype 10 is ok */
+#define OPFLAG_PREFORMAT 0x80 /* OP_Insert uses preformatted cell */
+
+/*
+** Each trigger present in the database schema is stored as an instance of
+** struct Trigger.
+**
+** Pointers to instances of struct Trigger are stored in two ways.
+** 1. In the "trigHash" hash table (part of the sqlite3* that represents the
+** database). This allows Trigger structures to be retrieved by name.
+** 2. All triggers associated with a single table form a linked list, using the
+** pNext member of struct Trigger. A pointer to the first element of the
+** linked list is stored as the "pTrigger" member of the associated
+** struct Table.
+**
+** The "step_list" member points to the first element of a linked list
+** containing the SQL statements specified as the trigger program.
+*/
+struct Trigger {
+ char *zName; /* The name of the trigger */
+ char *table; /* The table or view to which the trigger applies */
+ u8 op; /* One of TK_DELETE, TK_UPDATE, TK_INSERT */
+ u8 tr_tm; /* One of TRIGGER_BEFORE, TRIGGER_AFTER */
+ u8 bReturning; /* This trigger implements a RETURNING clause */
+ Expr *pWhen; /* The WHEN clause of the expression (may be NULL) */
+ IdList *pColumns; /* If this is an UPDATE OF <column-list> trigger,
+ the <column-list> is stored here */
+ Schema *pSchema; /* Schema containing the trigger */
+ Schema *pTabSchema; /* Schema containing the table */
+ TriggerStep *step_list; /* Link list of trigger program steps */
+ Trigger *pNext; /* Next trigger associated with the table */
+};
+
+/*
+** A trigger is either a BEFORE or an AFTER trigger. The following constants
+** determine which.
+**
+** If there are multiple triggers, you might of some BEFORE and some AFTER.
+** In that cases, the constants below can be ORed together.
+*/
+#define TRIGGER_BEFORE 1
+#define TRIGGER_AFTER 2
+
+/*
+** An instance of struct TriggerStep is used to store a single SQL statement
+** that is a part of a trigger-program.
+**
+** Instances of struct TriggerStep are stored in a singly linked list (linked
+** using the "pNext" member) referenced by the "step_list" member of the
+** associated struct Trigger instance. The first element of the linked list is
+** the first step of the trigger-program.
+**
+** The "op" member indicates whether this is a "DELETE", "INSERT", "UPDATE" or
+** "SELECT" statement. The meanings of the other members is determined by the
+** value of "op" as follows:
+**
+** (op == TK_INSERT)
+** orconf -> stores the ON CONFLICT algorithm
+** pSelect -> The content to be inserted - either a SELECT statement or
+** a VALUES clause.
+** zTarget -> Dequoted name of the table to insert into.
+** pIdList -> If this is an INSERT INTO ... (<column-names>) VALUES ...
+** statement, then this stores the column-names to be
+** inserted into.
+** pUpsert -> The ON CONFLICT clauses for an Upsert
+**
+** (op == TK_DELETE)
+** zTarget -> Dequoted name of the table to delete from.
+** pWhere -> The WHERE clause of the DELETE statement if one is specified.
+** Otherwise NULL.
+**
+** (op == TK_UPDATE)
+** zTarget -> Dequoted name of the table to update.
+** pWhere -> The WHERE clause of the UPDATE statement if one is specified.
+** Otherwise NULL.
+** pExprList -> A list of the columns to update and the expressions to update
+** them to. See sqlite3Update() documentation of "pChanges"
+** argument.
+**
+** (op == TK_SELECT)
+** pSelect -> The SELECT statement
+**
+** (op == TK_RETURNING)
+** pExprList -> The list of expressions that follow the RETURNING keyword.
+**
+*/
+struct TriggerStep {
+ u8 op; /* One of TK_DELETE, TK_UPDATE, TK_INSERT, TK_SELECT,
+ ** or TK_RETURNING */
+ u8 orconf; /* OE_Rollback etc. */
+ Trigger *pTrig; /* The trigger that this step is a part of */
+ Select *pSelect; /* SELECT statement or RHS of INSERT INTO SELECT ... */
+ char *zTarget; /* Target table for DELETE, UPDATE, INSERT */
+ SrcList *pFrom; /* FROM clause for UPDATE statement (if any) */
+ Expr *pWhere; /* The WHERE clause for DELETE or UPDATE steps */
+ ExprList *pExprList; /* SET clause for UPDATE, or RETURNING clause */
+ IdList *pIdList; /* Column names for INSERT */
+ Upsert *pUpsert; /* Upsert clauses on an INSERT */
+ char *zSpan; /* Original SQL text of this command */
+ TriggerStep *pNext; /* Next in the link-list */
+ TriggerStep *pLast; /* Last element in link-list. Valid for 1st elem only */
+};
+
+/*
+** Information about a RETURNING clause
+*/
+struct Returning {
+ Parse *pParse; /* The parse that includes the RETURNING clause */
+ ExprList *pReturnEL; /* List of expressions to return */
+ Trigger retTrig; /* The transient trigger that implements RETURNING */
+ TriggerStep retTStep; /* The trigger step */
+ int iRetCur; /* Transient table holding RETURNING results */
+ int nRetCol; /* Number of in pReturnEL after expansion */
+ int iRetReg; /* Register array for holding a row of RETURNING */
+ char zName[40]; /* Name of trigger: "sqlite_returning_%p" */
+};
+
+/*
+** An object used to accumulate the text of a string where we
+** do not necessarily know how big the string will be in the end.
+*/
+struct sqlite3_str {
+ sqlite3 *db; /* Optional database for lookaside. Can be NULL */
+ char *zText; /* The string collected so far */
+ u32 nAlloc; /* Amount of space allocated in zText */
+ u32 mxAlloc; /* Maximum allowed allocation. 0 for no malloc usage */
+ u32 nChar; /* Length of the string so far */
+ u8 accError; /* SQLITE_NOMEM or SQLITE_TOOBIG */
+ u8 printfFlags; /* SQLITE_PRINTF flags below */
+};
+#define SQLITE_PRINTF_INTERNAL 0x01 /* Internal-use-only converters allowed */
+#define SQLITE_PRINTF_SQLFUNC 0x02 /* SQL function arguments to VXPrintf */
+#define SQLITE_PRINTF_MALLOCED 0x04 /* True if zText is allocated space */
+
+#define isMalloced(X) (((X)->printfFlags & SQLITE_PRINTF_MALLOCED)!=0)
+
+/*
+** The following object is the header for an "RCStr" or "reference-counted
+** string". An RCStr is passed around and used like any other char*
+** that has been dynamically allocated. The important interface
+** differences:
+**
+** 1. RCStr strings are reference counted. They are deallocated
+** when the reference count reaches zero.
+**
+** 2. Use sqlite3RCStrUnref() to free an RCStr string rather than
+** sqlite3_free()
+**
+** 3. Make a (read-only) copy of a read-only RCStr string using
+** sqlite3RCStrRef().
+**
+** "String" is in the name, but an RCStr object can also be used to hold
+** binary data.
+*/
+struct RCStr {
+ u64 nRCRef; /* Number of references */
+ /* Total structure size should be a multiple of 8 bytes for alignment */
+};
+
+/*
+** A pointer to this structure is used to communicate information
+** from sqlite3Init and OP_ParseSchema into the sqlite3InitCallback.
+*/
+typedef struct {
+ sqlite3 *db; /* The database being initialized */
+ char **pzErrMsg; /* Error message stored here */
+ int iDb; /* 0 for main database. 1 for TEMP, 2.. for ATTACHed */
+ int rc; /* Result code stored here */
+ u32 mInitFlags; /* Flags controlling error messages */
+ u32 nInitRow; /* Number of rows processed */
+ Pgno mxPage; /* Maximum page number. 0 for no limit. */
+} InitData;
+
+/*
+** Allowed values for mInitFlags
+*/
+#define INITFLAG_AlterMask 0x0003 /* Types of ALTER */
+#define INITFLAG_AlterRename 0x0001 /* Reparse after a RENAME */
+#define INITFLAG_AlterDrop 0x0002 /* Reparse after a DROP COLUMN */
+#define INITFLAG_AlterAdd 0x0003 /* Reparse after an ADD COLUMN */
+
+/* Tuning parameters are set using SQLITE_TESTCTRL_TUNE and are controlled
+** on debug-builds of the CLI using ".testctrl tune ID VALUE". Tuning
+** parameters are for temporary use during development, to help find
+** optimal values for parameters in the query planner. The should not
+** be used on trunk check-ins. They are a temporary mechanism available
+** for transient development builds only.
+**
+** Tuning parameters are numbered starting with 1.
+*/
+#define SQLITE_NTUNE 6 /* Should be zero for all trunk check-ins */
+#ifdef SQLITE_DEBUG
+# define Tuning(X) (sqlite3Config.aTune[(X)-1])
+#else
+# define Tuning(X) 0
+#endif
+
+/*
+** Structure containing global configuration data for the SQLite library.
+**
+** This structure also contains some state information.
+*/
+struct Sqlite3Config {
+ int bMemstat; /* True to enable memory status */
+ u8 bCoreMutex; /* True to enable core mutexing */
+ u8 bFullMutex; /* True to enable full mutexing */
+ u8 bOpenUri; /* True to interpret filenames as URIs */
+ u8 bUseCis; /* Use covering indices for full-scans */
+ u8 bSmallMalloc; /* Avoid large memory allocations if true */
+ u8 bExtraSchemaChecks; /* Verify type,name,tbl_name in schema */
+#ifdef SQLITE_DEBUG
+ u8 bJsonSelfcheck; /* Double-check JSON parsing */
+#endif
+ int mxStrlen; /* Maximum string length */
+ int neverCorrupt; /* Database is always well-formed */
+ int szLookaside; /* Default lookaside buffer size */
+ int nLookaside; /* Default lookaside buffer count */
+ int nStmtSpill; /* Stmt-journal spill-to-disk threshold */
+ sqlite3_mem_methods m; /* Low-level memory allocation interface */
+ sqlite3_mutex_methods mutex; /* Low-level mutex interface */
+ sqlite3_pcache_methods2 pcache2; /* Low-level page-cache interface */
+ void *pHeap; /* Heap storage space */
+ int nHeap; /* Size of pHeap[] */
+ int mnReq, mxReq; /* Min and max heap requests sizes */
+ sqlite3_int64 szMmap; /* mmap() space per open file */
+ sqlite3_int64 mxMmap; /* Maximum value for szMmap */
+ void *pPage; /* Page cache memory */
+ int szPage; /* Size of each page in pPage[] */
+ int nPage; /* Number of pages in pPage[] */
+ int mxParserStack; /* maximum depth of the parser stack */
+ int sharedCacheEnabled; /* true if shared-cache mode enabled */
+ u32 szPma; /* Maximum Sorter PMA size */
+ /* The above might be initialized to non-zero. The following need to always
+ ** initially be zero, however. */
+ int isInit; /* True after initialization has finished */
+ int inProgress; /* True while initialization in progress */
+ int isMutexInit; /* True after mutexes are initialized */
+ int isMallocInit; /* True after malloc is initialized */
+ int isPCacheInit; /* True after malloc is initialized */
+ int nRefInitMutex; /* Number of users of pInitMutex */
+ sqlite3_mutex *pInitMutex; /* Mutex used by sqlite3_initialize() */
+ void (*xLog)(void*,int,const char*); /* Function for logging */
+ void *pLogArg; /* First argument to xLog() */
+#ifdef SQLITE_ENABLE_SQLLOG
+ void(*xSqllog)(void*,sqlite3*,const char*, int);
+ void *pSqllogArg;
+#endif
+#ifdef SQLITE_VDBE_COVERAGE
+ /* The following callback (if not NULL) is invoked on every VDBE branch
+ ** operation. Set the callback using SQLITE_TESTCTRL_VDBE_COVERAGE.
+ */
+ void (*xVdbeBranch)(void*,unsigned iSrcLine,u8 eThis,u8 eMx); /* Callback */
+ void *pVdbeBranchArg; /* 1st argument */
+#endif
+#ifndef SQLITE_OMIT_DESERIALIZE
+ sqlite3_int64 mxMemdbSize; /* Default max memdb size */
+#endif
+#ifndef SQLITE_UNTESTABLE
+ int (*xTestCallback)(int); /* Invoked by sqlite3FaultSim() */
+#endif
+#ifdef SQLITE_ALLOW_ROWID_IN_VIEW
+ u32 mNoVisibleRowid; /* TF_NoVisibleRowid if the ROWID_IN_VIEW
+ ** feature is disabled. 0 if rowids can
+ ** occur in views. */
+#endif
+ int bLocaltimeFault; /* True to fail localtime() calls */
+ int (*xAltLocaltime)(const void*,void*); /* Alternative localtime() routine */
+ int iOnceResetThreshold; /* When to reset OP_Once counters */
+ u32 szSorterRef; /* Min size in bytes to use sorter-refs */
+ unsigned int iPrngSeed; /* Alternative fixed seed for the PRNG */
+ /* vvvv--- must be last ---vvv */
+#ifdef SQLITE_DEBUG
+ sqlite3_int64 aTune[SQLITE_NTUNE]; /* Tuning parameters */
+#endif
+};
+
+/*
+** This macro is used inside of assert() statements to indicate that
+** the assert is only valid on a well-formed database. Instead of:
+**
+** assert( X );
+**
+** One writes:
+**
+** assert( X || CORRUPT_DB );
+**
+** CORRUPT_DB is true during normal operation. CORRUPT_DB does not indicate
+** that the database is definitely corrupt, only that it might be corrupt.
+** For most test cases, CORRUPT_DB is set to false using a special
+** sqlite3_test_control(). This enables assert() statements to prove
+** things that are always true for well-formed databases.
+*/
+#define CORRUPT_DB (sqlite3Config.neverCorrupt==0)
+
+/*
+** Context pointer passed down through the tree-walk.
+*/
+struct Walker {
+ Parse *pParse; /* Parser context. */
+ int (*xExprCallback)(Walker*, Expr*); /* Callback for expressions */
+ int (*xSelectCallback)(Walker*,Select*); /* Callback for SELECTs */
+ void (*xSelectCallback2)(Walker*,Select*);/* Second callback for SELECTs */
+ int walkerDepth; /* Number of subqueries */
+ u16 eCode; /* A small processing code */
+ u16 mWFlags; /* Use-dependent flags */
+ union { /* Extra data for callback */
+ NameContext *pNC; /* Naming context */
+ int n; /* A counter */
+ int iCur; /* A cursor number */
+ SrcList *pSrcList; /* FROM clause */
+ struct CCurHint *pCCurHint; /* Used by codeCursorHint() */
+ struct RefSrcList *pRefSrcList; /* sqlite3ReferencesSrcList() */
+ int *aiCol; /* array of column indexes */
+ struct IdxCover *pIdxCover; /* Check for index coverage */
+ ExprList *pGroupBy; /* GROUP BY clause */
+ Select *pSelect; /* HAVING to WHERE clause ctx */
+ struct WindowRewrite *pRewrite; /* Window rewrite context */
+ struct WhereConst *pConst; /* WHERE clause constants */
+ struct RenameCtx *pRename; /* RENAME COLUMN context */
+ struct Table *pTab; /* Table of generated column */
+ struct CoveringIndexCheck *pCovIdxCk; /* Check for covering index */
+ SrcItem *pSrcItem; /* A single FROM clause item */
+ DbFixer *pFix; /* See sqlite3FixSelect() */
+ Mem *aMem; /* See sqlite3BtreeCursorHint() */
+ } u;
+};
+
+/*
+** The following structure contains information used by the sqliteFix...
+** routines as they walk the parse tree to make database references
+** explicit.
+*/
+struct DbFixer {
+ Parse *pParse; /* The parsing context. Error messages written here */
+ Walker w; /* Walker object */
+ Schema *pSchema; /* Fix items to this schema */
+ u8 bTemp; /* True for TEMP schema entries */
+ const char *zDb; /* Make sure all objects are contained in this database */
+ const char *zType; /* Type of the container - used for error messages */
+ const Token *pName; /* Name of the container - used for error messages */
+};
+
+/* Forward declarations */
+SQLITE_PRIVATE int sqlite3WalkExpr(Walker*, Expr*);
+SQLITE_PRIVATE int sqlite3WalkExprNN(Walker*, Expr*);
+SQLITE_PRIVATE int sqlite3WalkExprList(Walker*, ExprList*);
+SQLITE_PRIVATE int sqlite3WalkSelect(Walker*, Select*);
+SQLITE_PRIVATE int sqlite3WalkSelectExpr(Walker*, Select*);
+SQLITE_PRIVATE int sqlite3WalkSelectFrom(Walker*, Select*);
+SQLITE_PRIVATE int sqlite3ExprWalkNoop(Walker*, Expr*);
+SQLITE_PRIVATE int sqlite3SelectWalkNoop(Walker*, Select*);
+SQLITE_PRIVATE int sqlite3SelectWalkFail(Walker*, Select*);
+SQLITE_PRIVATE int sqlite3WalkerDepthIncrease(Walker*,Select*);
+SQLITE_PRIVATE void sqlite3WalkerDepthDecrease(Walker*,Select*);
+SQLITE_PRIVATE void sqlite3WalkWinDefnDummyCallback(Walker*,Select*);
+
+#ifdef SQLITE_DEBUG
+SQLITE_PRIVATE void sqlite3SelectWalkAssert2(Walker*, Select*);
+#endif
+
+#ifndef SQLITE_OMIT_CTE
+SQLITE_PRIVATE void sqlite3SelectPopWith(Walker*, Select*);
+#else
+# define sqlite3SelectPopWith 0
+#endif
+
+/*
+** Return code from the parse-tree walking primitives and their
+** callbacks.
+*/
+#define WRC_Continue 0 /* Continue down into children */
+#define WRC_Prune 1 /* Omit children but continue walking siblings */
+#define WRC_Abort 2 /* Abandon the tree walk */
+
+/*
+** A single common table expression
+*/
+struct Cte {
+ char *zName; /* Name of this CTE */
+ ExprList *pCols; /* List of explicit column names, or NULL */
+ Select *pSelect; /* The definition of this CTE */
+ const char *zCteErr; /* Error message for circular references */
+ CteUse *pUse; /* Usage information for this CTE */
+ u8 eM10d; /* The MATERIALIZED flag */
+};
+
+/*
+** Allowed values for the materialized flag (eM10d):
+*/
+#define M10d_Yes 0 /* AS MATERIALIZED */
+#define M10d_Any 1 /* Not specified. Query planner's choice */
+#define M10d_No 2 /* AS NOT MATERIALIZED */
+
+/*
+** An instance of the With object represents a WITH clause containing
+** one or more CTEs (common table expressions).
+*/
+struct With {
+ int nCte; /* Number of CTEs in the WITH clause */
+ int bView; /* Belongs to the outermost Select of a view */
+ With *pOuter; /* Containing WITH clause, or NULL */
+ Cte a[1]; /* For each CTE in the WITH clause.... */
+};
+
+/*
+** The Cte object is not guaranteed to persist for the entire duration
+** of code generation. (The query flattener or other parser tree
+** edits might delete it.) The following object records information
+** about each Common Table Expression that must be preserved for the
+** duration of the parse.
+**
+** The CteUse objects are freed using sqlite3ParserAddCleanup() rather
+** than sqlite3SelectDelete(), which is what enables them to persist
+** until the end of code generation.
+*/
+struct CteUse {
+ int nUse; /* Number of users of this CTE */
+ int addrM9e; /* Start of subroutine to compute materialization */
+ int regRtn; /* Return address register for addrM9e subroutine */
+ int iCur; /* Ephemeral table holding the materialization */
+ LogEst nRowEst; /* Estimated number of rows in the table */
+ u8 eM10d; /* The MATERIALIZED flag */
+};
+
+
+/* Client data associated with sqlite3_set_clientdata() and
+** sqlite3_get_clientdata().
+*/
+struct DbClientData {
+ DbClientData *pNext; /* Next in a linked list */
+ void *pData; /* The data */
+ void (*xDestructor)(void*); /* Destructor. Might be NULL */
+ char zName[1]; /* Name of this client data. MUST BE LAST */
+};
+
+#ifdef SQLITE_DEBUG
+/*
+** An instance of the TreeView object is used for printing the content of
+** data structures on sqlite3DebugPrintf() using a tree-like view.
+*/
+struct TreeView {
+ int iLevel; /* Which level of the tree we are on */
+ u8 bLine[100]; /* Draw vertical in column i if bLine[i] is true */
+};
+#endif /* SQLITE_DEBUG */
+
+/*
+** This object is used in various ways, most (but not all) related to window
+** functions.
+**
+** (1) A single instance of this structure is attached to the
+** the Expr.y.pWin field for each window function in an expression tree.
+** This object holds the information contained in the OVER clause,
+** plus additional fields used during code generation.
+**
+** (2) All window functions in a single SELECT form a linked-list
+** attached to Select.pWin. The Window.pFunc and Window.pExpr
+** fields point back to the expression that is the window function.
+**
+** (3) The terms of the WINDOW clause of a SELECT are instances of this
+** object on a linked list attached to Select.pWinDefn.
+**
+** (4) For an aggregate function with a FILTER clause, an instance
+** of this object is stored in Expr.y.pWin with eFrmType set to
+** TK_FILTER. In this case the only field used is Window.pFilter.
+**
+** The uses (1) and (2) are really the same Window object that just happens
+** to be accessible in two different ways. Use case (3) are separate objects.
+*/
+struct Window {
+ char *zName; /* Name of window (may be NULL) */
+ char *zBase; /* Name of base window for chaining (may be NULL) */
+ ExprList *pPartition; /* PARTITION BY clause */
+ ExprList *pOrderBy; /* ORDER BY clause */
+ u8 eFrmType; /* TK_RANGE, TK_GROUPS, TK_ROWS, or 0 */
+ u8 eStart; /* UNBOUNDED, CURRENT, PRECEDING or FOLLOWING */
+ u8 eEnd; /* UNBOUNDED, CURRENT, PRECEDING or FOLLOWING */
+ u8 bImplicitFrame; /* True if frame was implicitly specified */
+ u8 eExclude; /* TK_NO, TK_CURRENT, TK_TIES, TK_GROUP, or 0 */
+ Expr *pStart; /* Expression for "<expr> PRECEDING" */
+ Expr *pEnd; /* Expression for "<expr> FOLLOWING" */
+ Window **ppThis; /* Pointer to this object in Select.pWin list */
+ Window *pNextWin; /* Next window function belonging to this SELECT */
+ Expr *pFilter; /* The FILTER expression */
+ FuncDef *pWFunc; /* The function */
+ int iEphCsr; /* Partition buffer or Peer buffer */
+ int regAccum; /* Accumulator */
+ int regResult; /* Interim result */
+ int csrApp; /* Function cursor (used by min/max) */
+ int regApp; /* Function register (also used by min/max) */
+ int regPart; /* Array of registers for PARTITION BY values */
+ Expr *pOwner; /* Expression object this window is attached to */
+ int nBufferCol; /* Number of columns in buffer table */
+ int iArgCol; /* Offset of first argument for this function */
+ int regOne; /* Register containing constant value 1 */
+ int regStartRowid;
+ int regEndRowid;
+ u8 bExprArgs; /* Defer evaluation of window function arguments
+ ** due to the SQLITE_SUBTYPE flag */
+};
+
+SQLITE_PRIVATE Select *sqlite3MultiValues(Parse *pParse, Select *pLeft, ExprList *pRow);
+SQLITE_PRIVATE void sqlite3MultiValuesEnd(Parse *pParse, Select *pVal);
+
+#ifndef SQLITE_OMIT_WINDOWFUNC
+SQLITE_PRIVATE void sqlite3WindowDelete(sqlite3*, Window*);
+SQLITE_PRIVATE void sqlite3WindowUnlinkFromSelect(Window*);
+SQLITE_PRIVATE void sqlite3WindowListDelete(sqlite3 *db, Window *p);
+SQLITE_PRIVATE Window *sqlite3WindowAlloc(Parse*, int, int, Expr*, int , Expr*, u8);
+SQLITE_PRIVATE void sqlite3WindowAttach(Parse*, Expr*, Window*);
+SQLITE_PRIVATE void sqlite3WindowLink(Select *pSel, Window *pWin);
+SQLITE_PRIVATE int sqlite3WindowCompare(const Parse*, const Window*, const Window*, int);
+SQLITE_PRIVATE void sqlite3WindowCodeInit(Parse*, Select*);
+SQLITE_PRIVATE void sqlite3WindowCodeStep(Parse*, Select*, WhereInfo*, int, int);
+SQLITE_PRIVATE int sqlite3WindowRewrite(Parse*, Select*);
+SQLITE_PRIVATE void sqlite3WindowUpdate(Parse*, Window*, Window*, FuncDef*);
+SQLITE_PRIVATE Window *sqlite3WindowDup(sqlite3 *db, Expr *pOwner, Window *p);
+SQLITE_PRIVATE Window *sqlite3WindowListDup(sqlite3 *db, Window *p);
+SQLITE_PRIVATE void sqlite3WindowFunctions(void);
+SQLITE_PRIVATE void sqlite3WindowChain(Parse*, Window*, Window*);
+SQLITE_PRIVATE Window *sqlite3WindowAssemble(Parse*, Window*, ExprList*, ExprList*, Token*);
+#else
+# define sqlite3WindowDelete(a,b)
+# define sqlite3WindowFunctions()
+# define sqlite3WindowAttach(a,b,c)
+#endif
+
+/*
+** Assuming zIn points to the first byte of a UTF-8 character,
+** advance zIn to point to the first byte of the next UTF-8 character.
+*/
+#define SQLITE_SKIP_UTF8(zIn) { \
+ if( (*(zIn++))>=0xc0 ){ \
+ while( (*zIn & 0xc0)==0x80 ){ zIn++; } \
+ } \
+}
+
+/*
+** The SQLITE_*_BKPT macros are substitutes for the error codes with
+** the same name but without the _BKPT suffix. These macros invoke
+** routines that report the line-number on which the error originated
+** using sqlite3_log(). The routines also provide a convenient place
+** to set a debugger breakpoint.
+*/
+SQLITE_PRIVATE int sqlite3ReportError(int iErr, int lineno, const char *zType);
+SQLITE_PRIVATE int sqlite3CorruptError(int);
+SQLITE_PRIVATE int sqlite3MisuseError(int);
+SQLITE_PRIVATE int sqlite3CantopenError(int);
+#define SQLITE_CORRUPT_BKPT sqlite3CorruptError(__LINE__)
+#define SQLITE_MISUSE_BKPT sqlite3MisuseError(__LINE__)
+#define SQLITE_CANTOPEN_BKPT sqlite3CantopenError(__LINE__)
+#ifdef SQLITE_DEBUG
+SQLITE_PRIVATE int sqlite3NomemError(int);
+SQLITE_PRIVATE int sqlite3IoerrnomemError(int);
+# define SQLITE_NOMEM_BKPT sqlite3NomemError(__LINE__)
+# define SQLITE_IOERR_NOMEM_BKPT sqlite3IoerrnomemError(__LINE__)
+#else
+# define SQLITE_NOMEM_BKPT SQLITE_NOMEM
+# define SQLITE_IOERR_NOMEM_BKPT SQLITE_IOERR_NOMEM
+#endif
+#if defined(SQLITE_DEBUG) || defined(SQLITE_ENABLE_CORRUPT_PGNO)
+SQLITE_PRIVATE int sqlite3CorruptPgnoError(int,Pgno);
+# define SQLITE_CORRUPT_PGNO(P) sqlite3CorruptPgnoError(__LINE__,(P))
+#else
+# define SQLITE_CORRUPT_PGNO(P) sqlite3CorruptError(__LINE__)
+#endif
+
+/*
+** FTS3 and FTS4 both require virtual table support
+*/
+#if defined(SQLITE_OMIT_VIRTUALTABLE)
+# undef SQLITE_ENABLE_FTS3
+# undef SQLITE_ENABLE_FTS4
+#endif
+
+/*
+** FTS4 is really an extension for FTS3. It is enabled using the
+** SQLITE_ENABLE_FTS3 macro. But to avoid confusion we also call
+** the SQLITE_ENABLE_FTS4 macro to serve as an alias for SQLITE_ENABLE_FTS3.
+*/
+#if defined(SQLITE_ENABLE_FTS4) && !defined(SQLITE_ENABLE_FTS3)
+# define SQLITE_ENABLE_FTS3 1
+#endif
+
+/*
+** The following macros mimic the standard library functions toupper(),
+** isspace(), isalnum(), isdigit() and isxdigit(), respectively. The
+** sqlite versions only work for ASCII characters, regardless of locale.
+*/
+#ifdef SQLITE_ASCII
+# define sqlite3Toupper(x) ((x)&~(sqlite3CtypeMap[(unsigned char)(x)]&0x20))
+# define sqlite3Isspace(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x01)
+# define sqlite3Isalnum(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x06)
+# define sqlite3Isalpha(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x02)
+# define sqlite3Isdigit(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x04)
+# define sqlite3Isxdigit(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x08)
+# define sqlite3Tolower(x) (sqlite3UpperToLower[(unsigned char)(x)])
+# define sqlite3Isquote(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x80)
+# define sqlite3JsonId1(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x42)
+# define sqlite3JsonId2(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x46)
+#else
+# define sqlite3Toupper(x) toupper((unsigned char)(x))
+# define sqlite3Isspace(x) isspace((unsigned char)(x))
+# define sqlite3Isalnum(x) isalnum((unsigned char)(x))
+# define sqlite3Isalpha(x) isalpha((unsigned char)(x))
+# define sqlite3Isdigit(x) isdigit((unsigned char)(x))
+# define sqlite3Isxdigit(x) isxdigit((unsigned char)(x))
+# define sqlite3Tolower(x) tolower((unsigned char)(x))
+# define sqlite3Isquote(x) ((x)=='"'||(x)=='\''||(x)=='['||(x)=='`')
+# define sqlite3JsonId1(x) (sqlite3IsIdChar(x)&&(x)<'0')
+# define sqlite3JsonId2(x) sqlite3IsIdChar(x)
+#endif
+SQLITE_PRIVATE int sqlite3IsIdChar(u8);
+
+/*
+** Internal function prototypes
+*/
+SQLITE_PRIVATE int sqlite3StrICmp(const char*,const char*);
+SQLITE_PRIVATE int sqlite3Strlen30(const char*);
+#define sqlite3Strlen30NN(C) (strlen(C)&0x3fffffff)
+SQLITE_PRIVATE char *sqlite3ColumnType(Column*,char*);
+#define sqlite3StrNICmp sqlite3_strnicmp
+
+SQLITE_PRIVATE int sqlite3MallocInit(void);
+SQLITE_PRIVATE void sqlite3MallocEnd(void);
+SQLITE_PRIVATE void *sqlite3Malloc(u64);
+SQLITE_PRIVATE void *sqlite3MallocZero(u64);
+SQLITE_PRIVATE void *sqlite3DbMallocZero(sqlite3*, u64);
+SQLITE_PRIVATE void *sqlite3DbMallocRaw(sqlite3*, u64);
+SQLITE_PRIVATE void *sqlite3DbMallocRawNN(sqlite3*, u64);
+SQLITE_PRIVATE char *sqlite3DbStrDup(sqlite3*,const char*);
+SQLITE_PRIVATE char *sqlite3DbStrNDup(sqlite3*,const char*, u64);
+SQLITE_PRIVATE char *sqlite3DbSpanDup(sqlite3*,const char*,const char*);
+SQLITE_PRIVATE void *sqlite3Realloc(void*, u64);
+SQLITE_PRIVATE void *sqlite3DbReallocOrFree(sqlite3 *, void *, u64);
+SQLITE_PRIVATE void *sqlite3DbRealloc(sqlite3 *, void *, u64);
+SQLITE_PRIVATE void sqlite3DbFree(sqlite3*, void*);
+SQLITE_PRIVATE void sqlite3DbFreeNN(sqlite3*, void*);
+SQLITE_PRIVATE void sqlite3DbNNFreeNN(sqlite3*, void*);
+SQLITE_PRIVATE int sqlite3MallocSize(const void*);
+SQLITE_PRIVATE int sqlite3DbMallocSize(sqlite3*, const void*);
+SQLITE_PRIVATE void *sqlite3PageMalloc(int);
+SQLITE_PRIVATE void sqlite3PageFree(void*);
+SQLITE_PRIVATE void sqlite3MemSetDefault(void);
+#ifndef SQLITE_UNTESTABLE
+SQLITE_PRIVATE void sqlite3BenignMallocHooks(void (*)(void), void (*)(void));
+#endif
+SQLITE_PRIVATE int sqlite3HeapNearlyFull(void);
+
+/*
+** On systems with ample stack space and that support alloca(), make
+** use of alloca() to obtain space for large automatic objects. By default,
+** obtain space from malloc().
+**
+** The alloca() routine never returns NULL. This will cause code paths
+** that deal with sqlite3StackAlloc() failures to be unreachable.
+*/
+#ifdef SQLITE_USE_ALLOCA
+# define sqlite3StackAllocRaw(D,N) alloca(N)
+# define sqlite3StackAllocRawNN(D,N) alloca(N)
+# define sqlite3StackFree(D,P)
+# define sqlite3StackFreeNN(D,P)
+#else
+# define sqlite3StackAllocRaw(D,N) sqlite3DbMallocRaw(D,N)
+# define sqlite3StackAllocRawNN(D,N) sqlite3DbMallocRawNN(D,N)
+# define sqlite3StackFree(D,P) sqlite3DbFree(D,P)
+# define sqlite3StackFreeNN(D,P) sqlite3DbFreeNN(D,P)
+#endif
+
+/* Do not allow both MEMSYS5 and MEMSYS3 to be defined together. If they
+** are, disable MEMSYS3
+*/
+#ifdef SQLITE_ENABLE_MEMSYS5
+SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys5(void);
+#undef SQLITE_ENABLE_MEMSYS3
+#endif
+#ifdef SQLITE_ENABLE_MEMSYS3
+SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys3(void);
+#endif
+
+
+#ifndef SQLITE_MUTEX_OMIT
+SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void);
+SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3NoopMutex(void);
+SQLITE_PRIVATE sqlite3_mutex *sqlite3MutexAlloc(int);
+SQLITE_PRIVATE int sqlite3MutexInit(void);
+SQLITE_PRIVATE int sqlite3MutexEnd(void);
+#endif
+#if !defined(SQLITE_MUTEX_OMIT) && !defined(SQLITE_MUTEX_NOOP)
+SQLITE_PRIVATE void sqlite3MemoryBarrier(void);
+#else
+# define sqlite3MemoryBarrier()
+#endif
+
+SQLITE_PRIVATE sqlite3_int64 sqlite3StatusValue(int);
+SQLITE_PRIVATE void sqlite3StatusUp(int, int);
+SQLITE_PRIVATE void sqlite3StatusDown(int, int);
+SQLITE_PRIVATE void sqlite3StatusHighwater(int, int);
+SQLITE_PRIVATE int sqlite3LookasideUsed(sqlite3*,int*);
+
+/* Access to mutexes used by sqlite3_status() */
+SQLITE_PRIVATE sqlite3_mutex *sqlite3Pcache1Mutex(void);
+SQLITE_PRIVATE sqlite3_mutex *sqlite3MallocMutex(void);
+
+#if defined(SQLITE_ENABLE_MULTITHREADED_CHECKS) && !defined(SQLITE_MUTEX_OMIT)
+SQLITE_PRIVATE void sqlite3MutexWarnOnContention(sqlite3_mutex*);
+#else
+# define sqlite3MutexWarnOnContention(x)
+#endif
+
+#ifndef SQLITE_OMIT_FLOATING_POINT
+# define EXP754 (((u64)0x7ff)<<52)
+# define MAN754 ((((u64)1)<<52)-1)
+# define IsNaN(X) (((X)&EXP754)==EXP754 && ((X)&MAN754)!=0)
+# define IsOvfl(X) (((X)&EXP754)==EXP754)
+SQLITE_PRIVATE int sqlite3IsNaN(double);
+SQLITE_PRIVATE int sqlite3IsOverflow(double);
+#else
+# define IsNaN(X) 0
+# define sqlite3IsNaN(X) 0
+# define sqlite3IsOVerflow(X) 0
+#endif
+
+/*
+** An instance of the following structure holds information about SQL
+** functions arguments that are the parameters to the printf() function.
+*/
+struct PrintfArguments {
+ int nArg; /* Total number of arguments */
+ int nUsed; /* Number of arguments used so far */
+ sqlite3_value **apArg; /* The argument values */
+};
+
+/*
+** An instance of this object receives the decoding of a floating point
+** value into an approximate decimal representation.
+*/
+struct FpDecode {
+ char sign; /* '+' or '-' */
+ char isSpecial; /* 1: Infinity 2: NaN */
+ int n; /* Significant digits in the decode */
+ int iDP; /* Location of the decimal point */
+ char *z; /* Start of significant digits */
+ char zBuf[24]; /* Storage for significant digits */
+};
+
+SQLITE_PRIVATE void sqlite3FpDecode(FpDecode*,double,int,int);
+SQLITE_PRIVATE char *sqlite3MPrintf(sqlite3*,const char*, ...);
+SQLITE_PRIVATE char *sqlite3VMPrintf(sqlite3*,const char*, va_list);
+#if defined(SQLITE_DEBUG) || defined(SQLITE_HAVE_OS_TRACE)
+SQLITE_PRIVATE void sqlite3DebugPrintf(const char*, ...);
+#endif
+#if defined(SQLITE_TEST)
+SQLITE_PRIVATE void *sqlite3TestTextToPtr(const char*);
+#endif
+
+#if defined(SQLITE_DEBUG)
+SQLITE_PRIVATE void sqlite3TreeViewLine(TreeView*, const char *zFormat, ...);
+SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView*, const Expr*, u8);
+SQLITE_PRIVATE void sqlite3TreeViewBareExprList(TreeView*, const ExprList*, const char*);
+SQLITE_PRIVATE void sqlite3TreeViewExprList(TreeView*, const ExprList*, u8, const char*);
+SQLITE_PRIVATE void sqlite3TreeViewBareIdList(TreeView*, const IdList*, const char*);
+SQLITE_PRIVATE void sqlite3TreeViewIdList(TreeView*, const IdList*, u8, const char*);
+SQLITE_PRIVATE void sqlite3TreeViewColumnList(TreeView*, const Column*, int, u8);
+SQLITE_PRIVATE void sqlite3TreeViewSrcList(TreeView*, const SrcList*);
+SQLITE_PRIVATE void sqlite3TreeViewSelect(TreeView*, const Select*, u8);
+SQLITE_PRIVATE void sqlite3TreeViewWith(TreeView*, const With*, u8);
+SQLITE_PRIVATE void sqlite3TreeViewUpsert(TreeView*, const Upsert*, u8);
+#if TREETRACE_ENABLED
+SQLITE_PRIVATE void sqlite3TreeViewDelete(const With*, const SrcList*, const Expr*,
+ const ExprList*,const Expr*, const Trigger*);
+SQLITE_PRIVATE void sqlite3TreeViewInsert(const With*, const SrcList*,
+ const IdList*, const Select*, const ExprList*,
+ int, const Upsert*, const Trigger*);
+SQLITE_PRIVATE void sqlite3TreeViewUpdate(const With*, const SrcList*, const ExprList*,
+ const Expr*, int, const ExprList*, const Expr*,
+ const Upsert*, const Trigger*);
+#endif
+#ifndef SQLITE_OMIT_TRIGGER
+SQLITE_PRIVATE void sqlite3TreeViewTriggerStep(TreeView*, const TriggerStep*, u8, u8);
+SQLITE_PRIVATE void sqlite3TreeViewTrigger(TreeView*, const Trigger*, u8, u8);
+#endif
+#ifndef SQLITE_OMIT_WINDOWFUNC
+SQLITE_PRIVATE void sqlite3TreeViewWindow(TreeView*, const Window*, u8);
+SQLITE_PRIVATE void sqlite3TreeViewWinFunc(TreeView*, const Window*, u8);
+#endif
+SQLITE_PRIVATE void sqlite3ShowExpr(const Expr*);
+SQLITE_PRIVATE void sqlite3ShowExprList(const ExprList*);
+SQLITE_PRIVATE void sqlite3ShowIdList(const IdList*);
+SQLITE_PRIVATE void sqlite3ShowSrcList(const SrcList*);
+SQLITE_PRIVATE void sqlite3ShowSelect(const Select*);
+SQLITE_PRIVATE void sqlite3ShowWith(const With*);
+SQLITE_PRIVATE void sqlite3ShowUpsert(const Upsert*);
+#ifndef SQLITE_OMIT_TRIGGER
+SQLITE_PRIVATE void sqlite3ShowTriggerStep(const TriggerStep*);
+SQLITE_PRIVATE void sqlite3ShowTriggerStepList(const TriggerStep*);
+SQLITE_PRIVATE void sqlite3ShowTrigger(const Trigger*);
+SQLITE_PRIVATE void sqlite3ShowTriggerList(const Trigger*);
+#endif
+#ifndef SQLITE_OMIT_WINDOWFUNC
+SQLITE_PRIVATE void sqlite3ShowWindow(const Window*);
+SQLITE_PRIVATE void sqlite3ShowWinFunc(const Window*);
+#endif
+#endif
+
+SQLITE_PRIVATE void sqlite3SetString(char **, sqlite3*, const char*);
+SQLITE_PRIVATE void sqlite3ProgressCheck(Parse*);
+SQLITE_PRIVATE void sqlite3ErrorMsg(Parse*, const char*, ...);
+SQLITE_PRIVATE int sqlite3ErrorToParser(sqlite3*,int);
+SQLITE_PRIVATE void sqlite3Dequote(char*);
+SQLITE_PRIVATE void sqlite3DequoteExpr(Expr*);
+SQLITE_PRIVATE void sqlite3DequoteToken(Token*);
+SQLITE_PRIVATE void sqlite3DequoteNumber(Parse*, Expr*);
+SQLITE_PRIVATE void sqlite3TokenInit(Token*,char*);
+SQLITE_PRIVATE int sqlite3KeywordCode(const unsigned char*, int);
+SQLITE_PRIVATE int sqlite3RunParser(Parse*, const char*);
+SQLITE_PRIVATE void sqlite3FinishCoding(Parse*);
+SQLITE_PRIVATE int sqlite3GetTempReg(Parse*);
+SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse*,int);
+SQLITE_PRIVATE int sqlite3GetTempRange(Parse*,int);
+SQLITE_PRIVATE void sqlite3ReleaseTempRange(Parse*,int,int);
+SQLITE_PRIVATE void sqlite3ClearTempRegCache(Parse*);
+SQLITE_PRIVATE void sqlite3TouchRegister(Parse*,int);
+#if defined(SQLITE_ENABLE_STAT4) || defined(SQLITE_DEBUG)
+SQLITE_PRIVATE int sqlite3FirstAvailableRegister(Parse*,int);
+#endif
+#ifdef SQLITE_DEBUG
+SQLITE_PRIVATE int sqlite3NoTempsInRange(Parse*,int,int);
+#endif
+SQLITE_PRIVATE Expr *sqlite3ExprAlloc(sqlite3*,int,const Token*,int);
+SQLITE_PRIVATE Expr *sqlite3Expr(sqlite3*,int,const char*);
+SQLITE_PRIVATE void sqlite3ExprAttachSubtrees(sqlite3*,Expr*,Expr*,Expr*);
+SQLITE_PRIVATE Expr *sqlite3PExpr(Parse*, int, Expr*, Expr*);
+SQLITE_PRIVATE void sqlite3PExprAddSelect(Parse*, Expr*, Select*);
+SQLITE_PRIVATE Expr *sqlite3ExprAnd(Parse*,Expr*, Expr*);
+SQLITE_PRIVATE Expr *sqlite3ExprSimplifiedAndOr(Expr*);
+SQLITE_PRIVATE Expr *sqlite3ExprFunction(Parse*,ExprList*, const Token*, int);
+SQLITE_PRIVATE void sqlite3ExprAddFunctionOrderBy(Parse*,Expr*,ExprList*);
+SQLITE_PRIVATE void sqlite3ExprOrderByAggregateError(Parse*,Expr*);
+SQLITE_PRIVATE void sqlite3ExprFunctionUsable(Parse*,const Expr*,const FuncDef*);
+SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse*, Expr*, u32);
+SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3*, Expr*);
+SQLITE_PRIVATE void sqlite3ExprDeleteGeneric(sqlite3*,void*);
+SQLITE_PRIVATE int sqlite3ExprDeferredDelete(Parse*, Expr*);
+SQLITE_PRIVATE void sqlite3ExprUnmapAndDelete(Parse*, Expr*);
+SQLITE_PRIVATE ExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*);
+SQLITE_PRIVATE ExprList *sqlite3ExprListAppendVector(Parse*,ExprList*,IdList*,Expr*);
+SQLITE_PRIVATE Select *sqlite3ExprListToValues(Parse*, int, ExprList*);
+SQLITE_PRIVATE void sqlite3ExprListSetSortOrder(ExprList*,int,int);
+SQLITE_PRIVATE void sqlite3ExprListSetName(Parse*,ExprList*,const Token*,int);
+SQLITE_PRIVATE void sqlite3ExprListSetSpan(Parse*,ExprList*,const char*,const char*);
+SQLITE_PRIVATE void sqlite3ExprListDelete(sqlite3*, ExprList*);
+SQLITE_PRIVATE void sqlite3ExprListDeleteGeneric(sqlite3*,void*);
+SQLITE_PRIVATE u32 sqlite3ExprListFlags(const ExprList*);
+SQLITE_PRIVATE int sqlite3IndexHasDuplicateRootPage(Index*);
+SQLITE_PRIVATE int sqlite3Init(sqlite3*, char**);
+SQLITE_PRIVATE int sqlite3InitCallback(void*, int, char**, char**);
+SQLITE_PRIVATE int sqlite3InitOne(sqlite3*, int, char**, u32);
+SQLITE_PRIVATE void sqlite3Pragma(Parse*,Token*,Token*,Token*,int);
+#ifndef SQLITE_OMIT_VIRTUALTABLE
+SQLITE_PRIVATE Module *sqlite3PragmaVtabRegister(sqlite3*,const char *zName);
+#endif
+SQLITE_PRIVATE void sqlite3ResetAllSchemasOfConnection(sqlite3*);
+SQLITE_PRIVATE void sqlite3ResetOneSchema(sqlite3*,int);
+SQLITE_PRIVATE void sqlite3CollapseDatabaseArray(sqlite3*);
+SQLITE_PRIVATE void sqlite3CommitInternalChanges(sqlite3*);
+SQLITE_PRIVATE void sqlite3ColumnSetExpr(Parse*,Table*,Column*,Expr*);
+SQLITE_PRIVATE Expr *sqlite3ColumnExpr(Table*,Column*);
+SQLITE_PRIVATE void sqlite3ColumnSetColl(sqlite3*,Column*,const char*zColl);
+SQLITE_PRIVATE const char *sqlite3ColumnColl(Column*);
+SQLITE_PRIVATE void sqlite3DeleteColumnNames(sqlite3*,Table*);
+SQLITE_PRIVATE void sqlite3GenerateColumnNames(Parse *pParse, Select *pSelect);
+SQLITE_PRIVATE int sqlite3ColumnsFromExprList(Parse*,ExprList*,i16*,Column**);
+SQLITE_PRIVATE void sqlite3SubqueryColumnTypes(Parse*,Table*,Select*,char);
+SQLITE_PRIVATE Table *sqlite3ResultSetOfSelect(Parse*,Select*,char);
+SQLITE_PRIVATE void sqlite3OpenSchemaTable(Parse *, int);
+SQLITE_PRIVATE Index *sqlite3PrimaryKeyIndex(Table*);
+SQLITE_PRIVATE i16 sqlite3TableColumnToIndex(Index*, i16);
+#ifdef SQLITE_OMIT_GENERATED_COLUMNS
+# define sqlite3TableColumnToStorage(T,X) (X) /* No-op pass-through */
+# define sqlite3StorageColumnToTable(T,X) (X) /* No-op pass-through */
+#else
+SQLITE_PRIVATE i16 sqlite3TableColumnToStorage(Table*, i16);
+SQLITE_PRIVATE i16 sqlite3StorageColumnToTable(Table*, i16);
+#endif
+SQLITE_PRIVATE void sqlite3StartTable(Parse*,Token*,Token*,int,int,int,int);
+#if SQLITE_ENABLE_HIDDEN_COLUMNS
+SQLITE_PRIVATE void sqlite3ColumnPropertiesFromName(Table*, Column*);
+#else
+# define sqlite3ColumnPropertiesFromName(T,C) /* no-op */
+#endif
+SQLITE_PRIVATE void sqlite3AddColumn(Parse*,Token,Token);
+SQLITE_PRIVATE void sqlite3AddNotNull(Parse*, int);
+SQLITE_PRIVATE void sqlite3AddPrimaryKey(Parse*, ExprList*, int, int, int);
+SQLITE_PRIVATE void sqlite3AddCheckConstraint(Parse*, Expr*, const char*, const char*);
+SQLITE_PRIVATE void sqlite3AddDefaultValue(Parse*,Expr*,const char*,const char*);
+SQLITE_PRIVATE void sqlite3AddCollateType(Parse*, Token*);
+SQLITE_PRIVATE void sqlite3AddGenerated(Parse*,Expr*,Token*);
+SQLITE_PRIVATE void sqlite3EndTable(Parse*,Token*,Token*,u32,Select*);
+SQLITE_PRIVATE void sqlite3AddReturning(Parse*,ExprList*);
+SQLITE_PRIVATE int sqlite3ParseUri(const char*,const char*,unsigned int*,
+ sqlite3_vfs**,char**,char **);
+#define sqlite3CodecQueryParameters(A,B,C) 0
+SQLITE_PRIVATE Btree *sqlite3DbNameToBtree(sqlite3*,const char*);
+
+#ifdef SQLITE_UNTESTABLE
+# define sqlite3FaultSim(X) SQLITE_OK
+#else
+SQLITE_PRIVATE int sqlite3FaultSim(int);
+#endif
+
+SQLITE_PRIVATE Bitvec *sqlite3BitvecCreate(u32);
+SQLITE_PRIVATE int sqlite3BitvecTest(Bitvec*, u32);
+SQLITE_PRIVATE int sqlite3BitvecTestNotNull(Bitvec*, u32);
+SQLITE_PRIVATE int sqlite3BitvecSet(Bitvec*, u32);
+SQLITE_PRIVATE void sqlite3BitvecClear(Bitvec*, u32, void*);
+SQLITE_PRIVATE void sqlite3BitvecDestroy(Bitvec*);
+SQLITE_PRIVATE u32 sqlite3BitvecSize(Bitvec*);
+#ifndef SQLITE_UNTESTABLE
+SQLITE_PRIVATE int sqlite3BitvecBuiltinTest(int,int*);
+#endif
+
+SQLITE_PRIVATE RowSet *sqlite3RowSetInit(sqlite3*);
+SQLITE_PRIVATE void sqlite3RowSetDelete(void*);
+SQLITE_PRIVATE void sqlite3RowSetClear(void*);
+SQLITE_PRIVATE void sqlite3RowSetInsert(RowSet*, i64);
+SQLITE_PRIVATE int sqlite3RowSetTest(RowSet*, int iBatch, i64);
+SQLITE_PRIVATE int sqlite3RowSetNext(RowSet*, i64*);
+
+SQLITE_PRIVATE void sqlite3CreateView(Parse*,Token*,Token*,Token*,ExprList*,Select*,int,int);
+
+#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE)
+SQLITE_PRIVATE int sqlite3ViewGetColumnNames(Parse*,Table*);
+#else
+# define sqlite3ViewGetColumnNames(A,B) 0
+#endif
+
+#if SQLITE_MAX_ATTACHED>30
+SQLITE_PRIVATE int sqlite3DbMaskAllZero(yDbMask);
+#endif
+SQLITE_PRIVATE void sqlite3DropTable(Parse*, SrcList*, int, int);
+SQLITE_PRIVATE void sqlite3CodeDropTable(Parse*, Table*, int, int);
+SQLITE_PRIVATE void sqlite3DeleteTable(sqlite3*, Table*);
+SQLITE_PRIVATE void sqlite3DeleteTableGeneric(sqlite3*, void*);
+SQLITE_PRIVATE void sqlite3FreeIndex(sqlite3*, Index*);
+#ifndef SQLITE_OMIT_AUTOINCREMENT
+SQLITE_PRIVATE void sqlite3AutoincrementBegin(Parse *pParse);
+SQLITE_PRIVATE void sqlite3AutoincrementEnd(Parse *pParse);
+#else
+# define sqlite3AutoincrementBegin(X)
+# define sqlite3AutoincrementEnd(X)
+#endif
+SQLITE_PRIVATE void sqlite3Insert(Parse*, SrcList*, Select*, IdList*, int, Upsert*);
+#ifndef SQLITE_OMIT_GENERATED_COLUMNS
+SQLITE_PRIVATE void sqlite3ComputeGeneratedColumns(Parse*, int, Table*);
+#endif
+SQLITE_PRIVATE void *sqlite3ArrayAllocate(sqlite3*,void*,int,int*,int*);
+SQLITE_PRIVATE IdList *sqlite3IdListAppend(Parse*, IdList*, Token*);
+SQLITE_PRIVATE int sqlite3IdListIndex(IdList*,const char*);
+SQLITE_PRIVATE SrcList *sqlite3SrcListEnlarge(Parse*, SrcList*, int, int);
+SQLITE_PRIVATE SrcList *sqlite3SrcListAppendList(Parse *pParse, SrcList *p1, SrcList *p2);
+SQLITE_PRIVATE SrcList *sqlite3SrcListAppend(Parse*, SrcList*, Token*, Token*);
+SQLITE_PRIVATE void sqlite3SubqueryDelete(sqlite3*,Subquery*);
+SQLITE_PRIVATE Select *sqlite3SubqueryDetach(sqlite3*,SrcItem*);
+SQLITE_PRIVATE int sqlite3SrcItemAttachSubquery(Parse*, SrcItem*, Select*, int);
+SQLITE_PRIVATE SrcList *sqlite3SrcListAppendFromTerm(Parse*, SrcList*, Token*, Token*,
+ Token*, Select*, OnOrUsing*);
+SQLITE_PRIVATE void sqlite3SrcListIndexedBy(Parse *, SrcList *, Token *);
+SQLITE_PRIVATE void sqlite3SrcListFuncArgs(Parse*, SrcList*, ExprList*);
+SQLITE_PRIVATE int sqlite3IndexedByLookup(Parse *, SrcItem *);
+SQLITE_PRIVATE void sqlite3SrcListShiftJoinType(Parse*,SrcList*);
+SQLITE_PRIVATE void sqlite3SrcListAssignCursors(Parse*, SrcList*);
+SQLITE_PRIVATE void sqlite3IdListDelete(sqlite3*, IdList*);
+SQLITE_PRIVATE void sqlite3ClearOnOrUsing(sqlite3*, OnOrUsing*);
+SQLITE_PRIVATE void sqlite3SrcListDelete(sqlite3*, SrcList*);
+SQLITE_PRIVATE Index *sqlite3AllocateIndexObject(sqlite3*,i16,int,char**);
+SQLITE_PRIVATE void sqlite3CreateIndex(Parse*,Token*,Token*,SrcList*,ExprList*,int,Token*,
+ Expr*, int, int, u8);
+SQLITE_PRIVATE void sqlite3DropIndex(Parse*, SrcList*, int);
+SQLITE_PRIVATE int sqlite3Select(Parse*, Select*, SelectDest*);
+SQLITE_PRIVATE Select *sqlite3SelectNew(Parse*,ExprList*,SrcList*,Expr*,ExprList*,
+ Expr*,ExprList*,u32,Expr*);
+SQLITE_PRIVATE void sqlite3SelectDelete(sqlite3*, Select*);
+SQLITE_PRIVATE void sqlite3SelectDeleteGeneric(sqlite3*,void*);
+SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse*, SrcList*);
+SQLITE_PRIVATE int sqlite3IsReadOnly(Parse*, Table*, Trigger*);
+SQLITE_PRIVATE void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int);
+#if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
+SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse*,SrcList*,Expr*,ExprList*,Expr*,char*);
+#endif
+SQLITE_PRIVATE void sqlite3CodeChangeCount(Vdbe*,int,const char*);
+SQLITE_PRIVATE void sqlite3DeleteFrom(Parse*, SrcList*, Expr*, ExprList*, Expr*);
+SQLITE_PRIVATE void sqlite3Update(Parse*, SrcList*, ExprList*,Expr*,int,ExprList*,Expr*,
+ Upsert*);
+SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(Parse*,SrcList*,Expr*,ExprList*,
+ ExprList*,Select*,u16,int);
+SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo*);
+SQLITE_PRIVATE LogEst sqlite3WhereOutputRowCount(WhereInfo*);
+SQLITE_PRIVATE int sqlite3WhereIsDistinct(WhereInfo*);
+SQLITE_PRIVATE int sqlite3WhereIsOrdered(WhereInfo*);
+SQLITE_PRIVATE int sqlite3WhereOrderByLimitOptLabel(WhereInfo*);
+SQLITE_PRIVATE void sqlite3WhereMinMaxOptEarlyOut(Vdbe*,WhereInfo*);
+SQLITE_PRIVATE int sqlite3WhereIsSorted(WhereInfo*);
+SQLITE_PRIVATE int sqlite3WhereContinueLabel(WhereInfo*);
+SQLITE_PRIVATE int sqlite3WhereBreakLabel(WhereInfo*);
+SQLITE_PRIVATE int sqlite3WhereOkOnePass(WhereInfo*, int*);
+#define ONEPASS_OFF 0 /* Use of ONEPASS not allowed */
+#define ONEPASS_SINGLE 1 /* ONEPASS valid for a single row update */
+#define ONEPASS_MULTI 2 /* ONEPASS is valid for multiple rows */
+SQLITE_PRIVATE int sqlite3WhereUsesDeferredSeek(WhereInfo*);
+SQLITE_PRIVATE void sqlite3ExprCodeLoadIndexColumn(Parse*, Index*, int, int, int);
+SQLITE_PRIVATE int sqlite3ExprCodeGetColumn(Parse*, Table*, int, int, int, u8);
+SQLITE_PRIVATE void sqlite3ExprCodeGetColumnOfTable(Vdbe*, Table*, int, int, int);
+SQLITE_PRIVATE void sqlite3ExprCodeMove(Parse*, int, int, int);
+SQLITE_PRIVATE void sqlite3ExprToRegister(Expr *pExpr, int iReg);
+SQLITE_PRIVATE void sqlite3ExprCode(Parse*, Expr*, int);
+#ifndef SQLITE_OMIT_GENERATED_COLUMNS
+SQLITE_PRIVATE void sqlite3ExprCodeGeneratedColumn(Parse*, Table*, Column*, int);
+#endif
+SQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse*, Expr*, int);
+SQLITE_PRIVATE void sqlite3ExprCodeFactorable(Parse*, Expr*, int);
+SQLITE_PRIVATE int sqlite3ExprCodeRunJustOnce(Parse*, Expr*, int);
+SQLITE_PRIVATE int sqlite3ExprCodeTemp(Parse*, Expr*, int*);
+SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse*, Expr*, int);
+SQLITE_PRIVATE int sqlite3ExprCodeExprList(Parse*, ExprList*, int, int, u8);
+#define SQLITE_ECEL_DUP 0x01 /* Deep, not shallow copies */
+#define SQLITE_ECEL_FACTOR 0x02 /* Factor out constant terms */
+#define SQLITE_ECEL_REF 0x04 /* Use ExprList.u.x.iOrderByCol */
+#define SQLITE_ECEL_OMITREF 0x08 /* Omit if ExprList.u.x.iOrderByCol */
+SQLITE_PRIVATE void sqlite3ExprIfTrue(Parse*, Expr*, int, int);
+SQLITE_PRIVATE void sqlite3ExprIfFalse(Parse*, Expr*, int, int);
+SQLITE_PRIVATE void sqlite3ExprIfFalseDup(Parse*, Expr*, int, int);
+SQLITE_PRIVATE Table *sqlite3FindTable(sqlite3*,const char*, const char*);
+#define LOCATE_VIEW 0x01
+#define LOCATE_NOERR 0x02
+SQLITE_PRIVATE Table *sqlite3LocateTable(Parse*,u32 flags,const char*, const char*);
+SQLITE_PRIVATE const char *sqlite3PreferredTableName(const char*);
+SQLITE_PRIVATE Table *sqlite3LocateTableItem(Parse*,u32 flags,SrcItem *);
+SQLITE_PRIVATE Index *sqlite3FindIndex(sqlite3*,const char*, const char*);
+SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTable(sqlite3*,int,const char*);
+SQLITE_PRIVATE void sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*);
+SQLITE_PRIVATE void sqlite3Vacuum(Parse*,Token*,Expr*);
+SQLITE_PRIVATE int sqlite3RunVacuum(char**, sqlite3*, int, sqlite3_value*);
+SQLITE_PRIVATE char *sqlite3NameFromToken(sqlite3*, const Token*);
+SQLITE_PRIVATE int sqlite3ExprCompare(const Parse*,const Expr*,const Expr*, int);
+SQLITE_PRIVATE int sqlite3ExprCompareSkip(Expr*,Expr*,int);
+SQLITE_PRIVATE int sqlite3ExprListCompare(const ExprList*,const ExprList*, int);
+SQLITE_PRIVATE int sqlite3ExprImpliesExpr(const Parse*,const Expr*,const Expr*, int);
+SQLITE_PRIVATE int sqlite3ExprImpliesNonNullRow(Expr*,int,int);
+SQLITE_PRIVATE void sqlite3AggInfoPersistWalkerInit(Walker*,Parse*);
+SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext*, Expr*);
+SQLITE_PRIVATE void sqlite3ExprAnalyzeAggList(NameContext*,ExprList*);
+SQLITE_PRIVATE int sqlite3ExprCoveredByIndex(Expr*, int iCur, Index *pIdx);
+SQLITE_PRIVATE int sqlite3ReferencesSrcList(Parse*, Expr*, SrcList*);
+SQLITE_PRIVATE Vdbe *sqlite3GetVdbe(Parse*);
+#ifndef SQLITE_UNTESTABLE
+SQLITE_PRIVATE void sqlite3PrngSaveState(void);
+SQLITE_PRIVATE void sqlite3PrngRestoreState(void);
+#endif
+SQLITE_PRIVATE void sqlite3RollbackAll(sqlite3*,int);
+SQLITE_PRIVATE void sqlite3CodeVerifySchema(Parse*, int);
+SQLITE_PRIVATE void sqlite3CodeVerifyNamedSchema(Parse*, const char *zDb);
+SQLITE_PRIVATE void sqlite3BeginTransaction(Parse*, int);
+SQLITE_PRIVATE void sqlite3EndTransaction(Parse*,int);
+SQLITE_PRIVATE void sqlite3Savepoint(Parse*, int, Token*);
+SQLITE_PRIVATE void sqlite3CloseSavepoints(sqlite3 *);
+SQLITE_PRIVATE void sqlite3LeaveMutexAndCloseZombie(sqlite3*);
+SQLITE_PRIVATE u32 sqlite3IsTrueOrFalse(const char*);
+SQLITE_PRIVATE int sqlite3ExprIdToTrueFalse(Expr*);
+SQLITE_PRIVATE int sqlite3ExprTruthValue(const Expr*);
+SQLITE_PRIVATE int sqlite3ExprIsConstant(Parse*,Expr*);
+SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr*, u8);
+SQLITE_PRIVATE int sqlite3ExprIsConstantOrGroupBy(Parse*, Expr*, ExprList*);
+SQLITE_PRIVATE int sqlite3ExprIsSingleTableConstraint(Expr*,const SrcList*,int,int);
+#ifdef SQLITE_ENABLE_CURSOR_HINTS
+SQLITE_PRIVATE int sqlite3ExprContainsSubquery(Expr*);
+#endif
+SQLITE_PRIVATE int sqlite3ExprIsInteger(const Expr*, int*, Parse*);
+SQLITE_PRIVATE int sqlite3ExprCanBeNull(const Expr*);
+SQLITE_PRIVATE int sqlite3ExprNeedsNoAffinityChange(const Expr*, char);
+SQLITE_PRIVATE int sqlite3IsRowid(const char*);
+SQLITE_PRIVATE const char *sqlite3RowidAlias(Table *pTab);
+SQLITE_PRIVATE void sqlite3GenerateRowDelete(
+ Parse*,Table*,Trigger*,int,int,int,i16,u8,u8,u8,int);
+SQLITE_PRIVATE void sqlite3GenerateRowIndexDelete(Parse*, Table*, int, int, int*, int);
+SQLITE_PRIVATE int sqlite3GenerateIndexKey(Parse*, Index*, int, int, int, int*,Index*,int);
+SQLITE_PRIVATE void sqlite3ResolvePartIdxLabel(Parse*,int);
+SQLITE_PRIVATE int sqlite3ExprReferencesUpdatedColumn(Expr*,int*,int);
+SQLITE_PRIVATE void sqlite3GenerateConstraintChecks(Parse*,Table*,int*,int,int,int,int,
+ u8,u8,int,int*,int*,Upsert*);
+#ifdef SQLITE_ENABLE_NULL_TRIM
+SQLITE_PRIVATE void sqlite3SetMakeRecordP5(Vdbe*,Table*);
+#else
+# define sqlite3SetMakeRecordP5(A,B)
+#endif
+SQLITE_PRIVATE void sqlite3CompleteInsertion(Parse*,Table*,int,int,int,int*,int,int,int);
+SQLITE_PRIVATE int sqlite3OpenTableAndIndices(Parse*, Table*, int, u8, int, u8*, int*, int*);
+SQLITE_PRIVATE void sqlite3BeginWriteOperation(Parse*, int, int);
+SQLITE_PRIVATE void sqlite3MultiWrite(Parse*);
+SQLITE_PRIVATE void sqlite3MayAbort(Parse*);
+SQLITE_PRIVATE void sqlite3HaltConstraint(Parse*, int, int, char*, i8, u8);
+SQLITE_PRIVATE void sqlite3UniqueConstraint(Parse*, int, Index*);
+SQLITE_PRIVATE void sqlite3RowidConstraint(Parse*, int, Table*);
+SQLITE_PRIVATE Expr *sqlite3ExprDup(sqlite3*,const Expr*,int);
+SQLITE_PRIVATE ExprList *sqlite3ExprListDup(sqlite3*,const ExprList*,int);
+SQLITE_PRIVATE SrcList *sqlite3SrcListDup(sqlite3*,const SrcList*,int);
+SQLITE_PRIVATE IdList *sqlite3IdListDup(sqlite3*,const IdList*);
+SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3*,const Select*,int);
+SQLITE_PRIVATE FuncDef *sqlite3FunctionSearch(int,const char*);
+SQLITE_PRIVATE void sqlite3InsertBuiltinFuncs(FuncDef*,int);
+SQLITE_PRIVATE FuncDef *sqlite3FindFunction(sqlite3*,const char*,int,u8,u8);
+SQLITE_PRIVATE void sqlite3QuoteValue(StrAccum*,sqlite3_value*);
+SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void);
+SQLITE_PRIVATE void sqlite3RegisterDateTimeFunctions(void);
+SQLITE_PRIVATE void sqlite3RegisterJsonFunctions(void);
+SQLITE_PRIVATE void sqlite3RegisterPerConnectionBuiltinFunctions(sqlite3*);
+#if !defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_JSON)
+SQLITE_PRIVATE int sqlite3JsonTableFunctions(sqlite3*);
+#endif
+SQLITE_PRIVATE int sqlite3SafetyCheckOk(sqlite3*);
+SQLITE_PRIVATE int sqlite3SafetyCheckSickOrOk(sqlite3*);
+SQLITE_PRIVATE void sqlite3ChangeCookie(Parse*, int);
+SQLITE_PRIVATE With *sqlite3WithDup(sqlite3 *db, With *p);
+
+#if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER)
+SQLITE_PRIVATE void sqlite3MaterializeView(Parse*, Table*, Expr*, ExprList*,Expr*,int);
+#endif
+
+#ifndef SQLITE_OMIT_TRIGGER
+SQLITE_PRIVATE void sqlite3BeginTrigger(Parse*, Token*,Token*,int,int,IdList*,SrcList*,
+ Expr*,int, int);
+SQLITE_PRIVATE void sqlite3FinishTrigger(Parse*, TriggerStep*, Token*);
+SQLITE_PRIVATE void sqlite3DropTrigger(Parse*, SrcList*, int);
+SQLITE_PRIVATE void sqlite3DropTriggerPtr(Parse*, Trigger*);
+SQLITE_PRIVATE Trigger *sqlite3TriggersExist(Parse *, Table*, int, ExprList*, int *pMask);
+SQLITE_PRIVATE Trigger *sqlite3TriggerList(Parse *, Table *);
+SQLITE_PRIVATE void sqlite3CodeRowTrigger(Parse*, Trigger *, int, ExprList*, int, Table *,
+ int, int, int);
+SQLITE_PRIVATE void sqlite3CodeRowTriggerDirect(Parse *, Trigger *, Table *, int, int, int);
+ void sqliteViewTriggers(Parse*, Table*, Expr*, int, ExprList*);
+SQLITE_PRIVATE void sqlite3DeleteTriggerStep(sqlite3*, TriggerStep*);
+SQLITE_PRIVATE TriggerStep *sqlite3TriggerSelectStep(sqlite3*,Select*,
+ const char*,const char*);
+SQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep(Parse*,Token*, IdList*,
+ Select*,u8,Upsert*,
+ const char*,const char*);
+SQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep(Parse*,Token*,SrcList*,ExprList*,
+ Expr*, u8, const char*,const char*);
+SQLITE_PRIVATE TriggerStep *sqlite3TriggerDeleteStep(Parse*,Token*, Expr*,
+ const char*,const char*);
+SQLITE_PRIVATE void sqlite3DeleteTrigger(sqlite3*, Trigger*);
+SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTrigger(sqlite3*,int,const char*);
+SQLITE_PRIVATE u32 sqlite3TriggerColmask(Parse*,Trigger*,ExprList*,int,int,Table*,int);
+SQLITE_PRIVATE SrcList *sqlite3TriggerStepSrc(Parse*, TriggerStep*);
+# define sqlite3ParseToplevel(p) ((p)->pToplevel ? (p)->pToplevel : (p))
+# define sqlite3IsToplevel(p) ((p)->pToplevel==0)
+#else
+# define sqlite3TriggersExist(B,C,D,E,F) 0
+# define sqlite3DeleteTrigger(A,B)
+# define sqlite3DropTriggerPtr(A,B)
+# define sqlite3UnlinkAndDeleteTrigger(A,B,C)
+# define sqlite3CodeRowTrigger(A,B,C,D,E,F,G,H,I)
+# define sqlite3CodeRowTriggerDirect(A,B,C,D,E,F)
+# define sqlite3TriggerList(X, Y) 0
+# define sqlite3ParseToplevel(p) p
+# define sqlite3IsToplevel(p) 1
+# define sqlite3TriggerColmask(A,B,C,D,E,F,G) 0
+# define sqlite3TriggerStepSrc(A,B) 0
+#endif
+
+SQLITE_PRIVATE int sqlite3JoinType(Parse*, Token*, Token*, Token*);
+SQLITE_PRIVATE int sqlite3ColumnIndex(Table *pTab, const char *zCol);
+SQLITE_PRIVATE void sqlite3SrcItemColumnUsed(SrcItem*,int);
+SQLITE_PRIVATE void sqlite3SetJoinExpr(Expr*,int,u32);
+SQLITE_PRIVATE void sqlite3CreateForeignKey(Parse*, ExprList*, Token*, ExprList*, int);
+SQLITE_PRIVATE void sqlite3DeferForeignKey(Parse*, int);
+#ifndef SQLITE_OMIT_AUTHORIZATION
+SQLITE_PRIVATE void sqlite3AuthRead(Parse*,Expr*,Schema*,SrcList*);
+SQLITE_PRIVATE int sqlite3AuthCheck(Parse*,int, const char*, const char*, const char*);
+SQLITE_PRIVATE void sqlite3AuthContextPush(Parse*, AuthContext*, const char*);
+SQLITE_PRIVATE void sqlite3AuthContextPop(AuthContext*);
+SQLITE_PRIVATE int sqlite3AuthReadCol(Parse*, const char *, const char *, int);
+#else
+# define sqlite3AuthRead(a,b,c,d)
+# define sqlite3AuthCheck(a,b,c,d,e) SQLITE_OK
+# define sqlite3AuthContextPush(a,b,c)
+# define sqlite3AuthContextPop(a) ((void)(a))
+#endif
+SQLITE_PRIVATE int sqlite3DbIsNamed(sqlite3 *db, int iDb, const char *zName);
+SQLITE_PRIVATE void sqlite3Attach(Parse*, Expr*, Expr*, Expr*);
+SQLITE_PRIVATE void sqlite3Detach(Parse*, Expr*);
+SQLITE_PRIVATE void sqlite3FixInit(DbFixer*, Parse*, int, const char*, const Token*);
+SQLITE_PRIVATE int sqlite3FixSrcList(DbFixer*, SrcList*);
+SQLITE_PRIVATE int sqlite3FixSelect(DbFixer*, Select*);
+SQLITE_PRIVATE int sqlite3FixExpr(DbFixer*, Expr*);
+SQLITE_PRIVATE int sqlite3FixTriggerStep(DbFixer*, TriggerStep*);
+
+SQLITE_PRIVATE int sqlite3RealSameAsInt(double,sqlite3_int64);
+SQLITE_PRIVATE i64 sqlite3RealToI64(double);
+SQLITE_PRIVATE int sqlite3Int64ToText(i64,char*);
+SQLITE_PRIVATE int sqlite3AtoF(const char *z, double*, int, u8);
+SQLITE_PRIVATE int sqlite3GetInt32(const char *, int*);
+SQLITE_PRIVATE int sqlite3GetUInt32(const char*, u32*);
+SQLITE_PRIVATE int sqlite3Atoi(const char*);
+#ifndef SQLITE_OMIT_UTF16
+SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *pData, int nByte, int nChar);
+#endif
+SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *pData, int nByte);
+SQLITE_PRIVATE u32 sqlite3Utf8Read(const u8**);
+SQLITE_PRIVATE int sqlite3Utf8ReadLimited(const u8*, int, u32*);
+SQLITE_PRIVATE LogEst sqlite3LogEst(u64);
+SQLITE_PRIVATE LogEst sqlite3LogEstAdd(LogEst,LogEst);
+SQLITE_PRIVATE LogEst sqlite3LogEstFromDouble(double);
+SQLITE_PRIVATE u64 sqlite3LogEstToInt(LogEst);
+SQLITE_PRIVATE VList *sqlite3VListAdd(sqlite3*,VList*,const char*,int,int);
+SQLITE_PRIVATE const char *sqlite3VListNumToName(VList*,int);
+SQLITE_PRIVATE int sqlite3VListNameToNum(VList*,const char*,int);
+
+/*
+** Routines to read and write variable-length integers. These used to
+** be defined locally, but now we use the varint routines in the util.c
+** file.
+*/
+SQLITE_PRIVATE int sqlite3PutVarint(unsigned char*, u64);
+SQLITE_PRIVATE u8 sqlite3GetVarint(const unsigned char *, u64 *);
+SQLITE_PRIVATE u8 sqlite3GetVarint32(const unsigned char *, u32 *);
+SQLITE_PRIVATE int sqlite3VarintLen(u64 v);
+
+/*
+** The common case is for a varint to be a single byte. They following
+** macros handle the common case without a procedure call, but then call
+** the procedure for larger varints.
+*/
+#define getVarint32(A,B) \
+ (u8)((*(A)<(u8)0x80)?((B)=(u32)*(A)),1:sqlite3GetVarint32((A),(u32 *)&(B)))
+#define getVarint32NR(A,B) \
+ B=(u32)*(A);if(B>=0x80)sqlite3GetVarint32((A),(u32*)&(B))
+#define putVarint32(A,B) \
+ (u8)(((u32)(B)<(u32)0x80)?(*(A)=(unsigned char)(B)),1:\
+ sqlite3PutVarint((A),(B)))
+#define getVarint sqlite3GetVarint
+#define putVarint sqlite3PutVarint
+
+
+SQLITE_PRIVATE const char *sqlite3IndexAffinityStr(sqlite3*, Index*);
+SQLITE_PRIVATE char *sqlite3TableAffinityStr(sqlite3*,const Table*);
+SQLITE_PRIVATE void sqlite3TableAffinity(Vdbe*, Table*, int);
+SQLITE_PRIVATE char sqlite3CompareAffinity(const Expr *pExpr, char aff2);
+SQLITE_PRIVATE int sqlite3IndexAffinityOk(const Expr *pExpr, char idx_affinity);
+SQLITE_PRIVATE char sqlite3TableColumnAffinity(const Table*,int);
+SQLITE_PRIVATE char sqlite3ExprAffinity(const Expr *pExpr);
+SQLITE_PRIVATE int sqlite3ExprDataType(const Expr *pExpr);
+SQLITE_PRIVATE int sqlite3Atoi64(const char*, i64*, int, u8);
+SQLITE_PRIVATE int sqlite3DecOrHexToI64(const char*, i64*);
+SQLITE_PRIVATE void sqlite3ErrorWithMsg(sqlite3*, int, const char*,...);
+SQLITE_PRIVATE void sqlite3Error(sqlite3*,int);
+SQLITE_PRIVATE void sqlite3ErrorClear(sqlite3*);
+SQLITE_PRIVATE void sqlite3SystemError(sqlite3*,int);
+#if !defined(SQLITE_OMIT_BLOB_LITERAL)
+SQLITE_PRIVATE void *sqlite3HexToBlob(sqlite3*, const char *z, int n);
+#endif
+SQLITE_PRIVATE u8 sqlite3HexToInt(int h);
+SQLITE_PRIVATE int sqlite3TwoPartName(Parse *, Token *, Token *, Token **);
+
+#if defined(SQLITE_NEED_ERR_NAME)
+SQLITE_PRIVATE const char *sqlite3ErrName(int);
+#endif
+
+#ifndef SQLITE_OMIT_DESERIALIZE
+SQLITE_PRIVATE int sqlite3MemdbInit(void);
+SQLITE_PRIVATE int sqlite3IsMemdb(const sqlite3_vfs*);
+#else
+# define sqlite3IsMemdb(X) 0
+#endif
+
+SQLITE_PRIVATE const char *sqlite3ErrStr(int);
+SQLITE_PRIVATE int sqlite3ReadSchema(Parse *pParse);
+SQLITE_PRIVATE CollSeq *sqlite3FindCollSeq(sqlite3*,u8 enc, const char*,int);
+SQLITE_PRIVATE int sqlite3IsBinary(const CollSeq*);
+SQLITE_PRIVATE CollSeq *sqlite3LocateCollSeq(Parse *pParse, const char*zName);
+SQLITE_PRIVATE void sqlite3SetTextEncoding(sqlite3 *db, u8);
+SQLITE_PRIVATE CollSeq *sqlite3ExprCollSeq(Parse *pParse, const Expr *pExpr);
+SQLITE_PRIVATE CollSeq *sqlite3ExprNNCollSeq(Parse *pParse, const Expr *pExpr);
+SQLITE_PRIVATE int sqlite3ExprCollSeqMatch(Parse*,const Expr*,const Expr*);
+SQLITE_PRIVATE Expr *sqlite3ExprAddCollateToken(const Parse *pParse, Expr*, const Token*, int);
+SQLITE_PRIVATE Expr *sqlite3ExprAddCollateString(const Parse*,Expr*,const char*);
+SQLITE_PRIVATE Expr *sqlite3ExprSkipCollate(Expr*);
+SQLITE_PRIVATE Expr *sqlite3ExprSkipCollateAndLikely(Expr*);
+SQLITE_PRIVATE int sqlite3CheckCollSeq(Parse *, CollSeq *);
+SQLITE_PRIVATE int sqlite3WritableSchema(sqlite3*);
+SQLITE_PRIVATE int sqlite3CheckObjectName(Parse*, const char*,const char*,const char*);
+SQLITE_PRIVATE void sqlite3VdbeSetChanges(sqlite3 *, i64);
+SQLITE_PRIVATE int sqlite3AddInt64(i64*,i64);
+SQLITE_PRIVATE int sqlite3SubInt64(i64*,i64);
+SQLITE_PRIVATE int sqlite3MulInt64(i64*,i64);
+SQLITE_PRIVATE int sqlite3AbsInt32(int);
+#ifdef SQLITE_ENABLE_8_3_NAMES
+SQLITE_PRIVATE void sqlite3FileSuffix3(const char*, char*);
+#else
+# define sqlite3FileSuffix3(X,Y)
+#endif
+SQLITE_PRIVATE u8 sqlite3GetBoolean(const char *z,u8);
+
+SQLITE_PRIVATE const void *sqlite3ValueText(sqlite3_value*, u8);
+SQLITE_PRIVATE int sqlite3ValueIsOfClass(const sqlite3_value*, void(*)(void*));
+SQLITE_PRIVATE int sqlite3ValueBytes(sqlite3_value*, u8);
+SQLITE_PRIVATE void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8,
+ void(*)(void*));
+SQLITE_PRIVATE void sqlite3ValueSetNull(sqlite3_value*);
+SQLITE_PRIVATE void sqlite3ValueFree(sqlite3_value*);
+#ifndef SQLITE_UNTESTABLE
+SQLITE_PRIVATE void sqlite3ResultIntReal(sqlite3_context*);
+#endif
+SQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *);
+#ifndef SQLITE_OMIT_UTF16
+SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *, const void*, int, u8);
+#endif
+SQLITE_PRIVATE int sqlite3ValueFromExpr(sqlite3 *, const Expr *, u8, u8, sqlite3_value **);
+SQLITE_PRIVATE void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8);
+#ifndef SQLITE_AMALGAMATION
+SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[];
+SQLITE_PRIVATE const char sqlite3StrBINARY[];
+SQLITE_PRIVATE const unsigned char sqlite3StdTypeLen[];
+SQLITE_PRIVATE const char sqlite3StdTypeAffinity[];
+SQLITE_PRIVATE const char *sqlite3StdType[];
+SQLITE_PRIVATE const unsigned char sqlite3UpperToLower[];
+SQLITE_PRIVATE const unsigned char *sqlite3aLTb;
+SQLITE_PRIVATE const unsigned char *sqlite3aEQb;
+SQLITE_PRIVATE const unsigned char *sqlite3aGTb;
+SQLITE_PRIVATE const unsigned char sqlite3CtypeMap[];
+SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config;
+SQLITE_PRIVATE FuncDefHash sqlite3BuiltinFunctions;
+#ifndef SQLITE_OMIT_WSD
+SQLITE_PRIVATE int sqlite3PendingByte;
+#endif
+#endif /* SQLITE_AMALGAMATION */
+#ifdef VDBE_PROFILE
+SQLITE_PRIVATE sqlite3_uint64 sqlite3NProfileCnt;
+#endif
+SQLITE_PRIVATE void sqlite3RootPageMoved(sqlite3*, int, Pgno, Pgno);
+SQLITE_PRIVATE void sqlite3Reindex(Parse*, Token*, Token*);
+SQLITE_PRIVATE void sqlite3AlterFunctions(void);
+SQLITE_PRIVATE void sqlite3AlterRenameTable(Parse*, SrcList*, Token*);
+SQLITE_PRIVATE void sqlite3AlterRenameColumn(Parse*, SrcList*, Token*, Token*);
+SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *, int *);
+SQLITE_PRIVATE void sqlite3NestedParse(Parse*, const char*, ...);
+SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*, int);
+SQLITE_PRIVATE void sqlite3CodeRhsOfIN(Parse*, Expr*, int);
+SQLITE_PRIVATE int sqlite3CodeSubselect(Parse*, Expr*);
+SQLITE_PRIVATE void sqlite3SelectPrep(Parse*, Select*, NameContext*);
+SQLITE_PRIVATE int sqlite3ExpandSubquery(Parse*, SrcItem*);
+SQLITE_PRIVATE void sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p);
+SQLITE_PRIVATE int sqlite3MatchEName(
+ const struct ExprList_item*,
+ const char*,
+ const char*,
+ const char*,
+ int*
+);
+SQLITE_PRIVATE Bitmask sqlite3ExprColUsed(Expr*);
+SQLITE_PRIVATE u8 sqlite3StrIHash(const char*);
+SQLITE_PRIVATE int sqlite3ResolveExprNames(NameContext*, Expr*);
+SQLITE_PRIVATE int sqlite3ResolveExprListNames(NameContext*, ExprList*);
+SQLITE_PRIVATE void sqlite3ResolveSelectNames(Parse*, Select*, NameContext*);
+SQLITE_PRIVATE int sqlite3ResolveSelfReference(Parse*,Table*,int,Expr*,ExprList*);
+SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*);
+SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *, Table *, int, int);
+SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *, Token *);
+SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *, SrcList *);
+SQLITE_PRIVATE void sqlite3AlterDropColumn(Parse*, SrcList*, const Token*);
+SQLITE_PRIVATE const void *sqlite3RenameTokenMap(Parse*, const void*, const Token*);
+SQLITE_PRIVATE void sqlite3RenameTokenRemap(Parse*, const void *pTo, const void *pFrom);
+SQLITE_PRIVATE void sqlite3RenameExprUnmap(Parse*, Expr*);
+SQLITE_PRIVATE void sqlite3RenameExprlistUnmap(Parse*, ExprList*);
+SQLITE_PRIVATE CollSeq *sqlite3GetCollSeq(Parse*, u8, CollSeq *, const char*);
+SQLITE_PRIVATE char sqlite3AffinityType(const char*, Column*);
+SQLITE_PRIVATE void sqlite3Analyze(Parse*, Token*, Token*);
+SQLITE_PRIVATE int sqlite3InvokeBusyHandler(BusyHandler*);
+SQLITE_PRIVATE int sqlite3FindDb(sqlite3*, Token*);
+SQLITE_PRIVATE int sqlite3FindDbName(sqlite3 *, const char *);
+SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3*,int iDB);
+SQLITE_PRIVATE void sqlite3DeleteIndexSamples(sqlite3*,Index*);
+SQLITE_PRIVATE void sqlite3DefaultRowEst(Index*);
+SQLITE_PRIVATE void sqlite3RegisterLikeFunctions(sqlite3*, int);
+SQLITE_PRIVATE int sqlite3IsLikeFunction(sqlite3*,Expr*,int*,char*);
+SQLITE_PRIVATE void sqlite3SchemaClear(void *);
+SQLITE_PRIVATE Schema *sqlite3SchemaGet(sqlite3 *, Btree *);
+SQLITE_PRIVATE int sqlite3SchemaToIndex(sqlite3 *db, Schema *);
+SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoAlloc(sqlite3*,int,int);
+SQLITE_PRIVATE void sqlite3KeyInfoUnref(KeyInfo*);
+SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoRef(KeyInfo*);
+SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoOfIndex(Parse*, Index*);
+SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoFromExprList(Parse*, ExprList*, int, int);
+SQLITE_PRIVATE const char *sqlite3SelectOpName(int);
+SQLITE_PRIVATE int sqlite3HasExplicitNulls(Parse*, ExprList*);
+
+#ifdef SQLITE_DEBUG
+SQLITE_PRIVATE int sqlite3KeyInfoIsWriteable(KeyInfo*);
+#endif
+SQLITE_PRIVATE int sqlite3CreateFunc(sqlite3 *, const char *, int, int, void *,
+ void (*)(sqlite3_context*,int,sqlite3_value **),
+ void (*)(sqlite3_context*,int,sqlite3_value **),
+ void (*)(sqlite3_context*),
+ void (*)(sqlite3_context*),
+ void (*)(sqlite3_context*,int,sqlite3_value **),
+ FuncDestructor *pDestructor
+);
+SQLITE_PRIVATE void sqlite3NoopDestructor(void*);
+SQLITE_PRIVATE void *sqlite3OomFault(sqlite3*);
+SQLITE_PRIVATE void sqlite3OomClear(sqlite3*);
+SQLITE_PRIVATE int sqlite3ApiExit(sqlite3 *db, int);
+SQLITE_PRIVATE int sqlite3OpenTempDatabase(Parse *);
+
+SQLITE_PRIVATE char *sqlite3RCStrRef(char*);
+SQLITE_PRIVATE void sqlite3RCStrUnref(void*);
+SQLITE_PRIVATE char *sqlite3RCStrNew(u64);
+SQLITE_PRIVATE char *sqlite3RCStrResize(char*,u64);
+
+SQLITE_PRIVATE void sqlite3StrAccumInit(StrAccum*, sqlite3*, char*, int, int);
+SQLITE_PRIVATE int sqlite3StrAccumEnlarge(StrAccum*, i64);
+SQLITE_PRIVATE char *sqlite3StrAccumFinish(StrAccum*);
+SQLITE_PRIVATE void sqlite3StrAccumSetError(StrAccum*, u8);
+SQLITE_PRIVATE void sqlite3ResultStrAccum(sqlite3_context*,StrAccum*);
+SQLITE_PRIVATE void sqlite3SelectDestInit(SelectDest*,int,int);
+SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *, SrcList *, int, int);
+SQLITE_PRIVATE void sqlite3RecordErrorByteOffset(sqlite3*,const char*);
+SQLITE_PRIVATE void sqlite3RecordErrorOffsetOfExpr(sqlite3*,const Expr*);
+
+SQLITE_PRIVATE void sqlite3BackupRestart(sqlite3_backup *);
+SQLITE_PRIVATE void sqlite3BackupUpdate(sqlite3_backup *, Pgno, const u8 *);
+
+#ifndef SQLITE_OMIT_SUBQUERY
+SQLITE_PRIVATE int sqlite3ExprCheckIN(Parse*, Expr*);
+#else
+# define sqlite3ExprCheckIN(x,y) SQLITE_OK
+#endif
+
+#ifdef SQLITE_ENABLE_STAT4
+SQLITE_PRIVATE int sqlite3Stat4ProbeSetValue(
+ Parse*,Index*,UnpackedRecord**,Expr*,int,int,int*);
+SQLITE_PRIVATE int sqlite3Stat4ValueFromExpr(Parse*, Expr*, u8, sqlite3_value**);
+SQLITE_PRIVATE void sqlite3Stat4ProbeFree(UnpackedRecord*);
+SQLITE_PRIVATE int sqlite3Stat4Column(sqlite3*, const void*, int, int, sqlite3_value**);
+SQLITE_PRIVATE char sqlite3IndexColumnAffinity(sqlite3*, Index*, int);
+#endif
+
+/*
+** The interface to the LEMON-generated parser
+*/
+#ifndef SQLITE_AMALGAMATION
+SQLITE_PRIVATE void *sqlite3ParserAlloc(void*(*)(u64), Parse*);
+SQLITE_PRIVATE void sqlite3ParserFree(void*, void(*)(void*));
+#endif
+SQLITE_PRIVATE void sqlite3Parser(void*, int, Token);
+SQLITE_PRIVATE int sqlite3ParserFallback(int);
+#ifdef YYTRACKMAXSTACKDEPTH
+SQLITE_PRIVATE int sqlite3ParserStackPeak(void*);
+#endif
+
+SQLITE_PRIVATE void sqlite3AutoLoadExtensions(sqlite3*);
+#ifndef SQLITE_OMIT_LOAD_EXTENSION
+SQLITE_PRIVATE void sqlite3CloseExtensions(sqlite3*);
+#else
+# define sqlite3CloseExtensions(X)
+#endif
+
+#ifndef SQLITE_OMIT_SHARED_CACHE
+SQLITE_PRIVATE void sqlite3TableLock(Parse *, int, Pgno, u8, const char *);
+#else
+ #define sqlite3TableLock(v,w,x,y,z)
+#endif
+
+#ifdef SQLITE_TEST
+SQLITE_PRIVATE int sqlite3Utf8To8(unsigned char*);
+#endif
+
+#ifdef SQLITE_OMIT_VIRTUALTABLE
+# define sqlite3VtabClear(D,T)
+# define sqlite3VtabSync(X,Y) SQLITE_OK
+# define sqlite3VtabRollback(X)
+# define sqlite3VtabCommit(X)
+# define sqlite3VtabInSync(db) 0
+# define sqlite3VtabLock(X)
+# define sqlite3VtabUnlock(X)
+# define sqlite3VtabModuleUnref(D,X)
+# define sqlite3VtabUnlockList(X)
+# define sqlite3VtabSavepoint(X, Y, Z) SQLITE_OK
+# define sqlite3GetVTable(X,Y) ((VTable*)0)
+#else
+SQLITE_PRIVATE void sqlite3VtabClear(sqlite3 *db, Table*);
+SQLITE_PRIVATE void sqlite3VtabDisconnect(sqlite3 *db, Table *p);
+SQLITE_PRIVATE int sqlite3VtabSync(sqlite3 *db, Vdbe*);
+SQLITE_PRIVATE int sqlite3VtabRollback(sqlite3 *db);
+SQLITE_PRIVATE int sqlite3VtabCommit(sqlite3 *db);
+SQLITE_PRIVATE void sqlite3VtabLock(VTable *);
+SQLITE_PRIVATE void sqlite3VtabUnlock(VTable *);
+SQLITE_PRIVATE void sqlite3VtabModuleUnref(sqlite3*,Module*);
+SQLITE_PRIVATE void sqlite3VtabUnlockList(sqlite3*);
+SQLITE_PRIVATE int sqlite3VtabSavepoint(sqlite3 *, int, int);
+SQLITE_PRIVATE void sqlite3VtabImportErrmsg(Vdbe*, sqlite3_vtab*);
+SQLITE_PRIVATE VTable *sqlite3GetVTable(sqlite3*, Table*);
+SQLITE_PRIVATE Module *sqlite3VtabCreateModule(
+ sqlite3*,
+ const char*,
+ const sqlite3_module*,
+ void*,
+ void(*)(void*)
+ );
+# define sqlite3VtabInSync(db) ((db)->nVTrans>0 && (db)->aVTrans==0)
+#endif
+SQLITE_PRIVATE int sqlite3ReadOnlyShadowTables(sqlite3 *db);
+#ifndef SQLITE_OMIT_VIRTUALTABLE
+SQLITE_PRIVATE int sqlite3ShadowTableName(sqlite3 *db, const char *zName);
+SQLITE_PRIVATE int sqlite3IsShadowTableOf(sqlite3*,Table*,const char*);
+SQLITE_PRIVATE void sqlite3MarkAllShadowTablesOf(sqlite3*, Table*);
+#else
+# define sqlite3ShadowTableName(A,B) 0
+# define sqlite3IsShadowTableOf(A,B,C) 0
+# define sqlite3MarkAllShadowTablesOf(A,B)
+#endif
+SQLITE_PRIVATE int sqlite3VtabEponymousTableInit(Parse*,Module*);
+SQLITE_PRIVATE void sqlite3VtabEponymousTableClear(sqlite3*,Module*);
+SQLITE_PRIVATE void sqlite3VtabMakeWritable(Parse*,Table*);
+SQLITE_PRIVATE void sqlite3VtabBeginParse(Parse*, Token*, Token*, Token*, int);
+SQLITE_PRIVATE void sqlite3VtabFinishParse(Parse*, Token*);
+SQLITE_PRIVATE void sqlite3VtabArgInit(Parse*);
+SQLITE_PRIVATE void sqlite3VtabArgExtend(Parse*, Token*);
+SQLITE_PRIVATE int sqlite3VtabCallCreate(sqlite3*, int, const char *, char **);
+SQLITE_PRIVATE int sqlite3VtabCallConnect(Parse*, Table*);
+SQLITE_PRIVATE int sqlite3VtabCallDestroy(sqlite3*, int, const char *);
+SQLITE_PRIVATE int sqlite3VtabBegin(sqlite3 *, VTable *);
+
+SQLITE_PRIVATE FuncDef *sqlite3VtabOverloadFunction(sqlite3 *,FuncDef*, int nArg, Expr*);
+SQLITE_PRIVATE void sqlite3VtabUsesAllSchemas(Parse*);
+SQLITE_PRIVATE sqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context*);
+SQLITE_PRIVATE int sqlite3VdbeParameterIndex(Vdbe*, const char*, int);
+SQLITE_PRIVATE int sqlite3TransferBindings(sqlite3_stmt *, sqlite3_stmt *);
+SQLITE_PRIVATE void sqlite3ParseObjectInit(Parse*,sqlite3*);
+SQLITE_PRIVATE void sqlite3ParseObjectReset(Parse*);
+SQLITE_PRIVATE void *sqlite3ParserAddCleanup(Parse*,void(*)(sqlite3*,void*),void*);
+#ifdef SQLITE_ENABLE_NORMALIZE
+SQLITE_PRIVATE char *sqlite3Normalize(Vdbe*, const char*);
+#endif
+SQLITE_PRIVATE int sqlite3Reprepare(Vdbe*);
+SQLITE_PRIVATE void sqlite3ExprListCheckLength(Parse*, ExprList*, const char*);
+SQLITE_PRIVATE CollSeq *sqlite3ExprCompareCollSeq(Parse*,const Expr*);
+SQLITE_PRIVATE CollSeq *sqlite3BinaryCompareCollSeq(Parse *, const Expr*, const Expr*);
+SQLITE_PRIVATE int sqlite3TempInMemory(const sqlite3*);
+SQLITE_PRIVATE const char *sqlite3JournalModename(int);
+#ifndef SQLITE_OMIT_WAL
+SQLITE_PRIVATE int sqlite3Checkpoint(sqlite3*, int, int, int*, int*);
+SQLITE_PRIVATE int sqlite3WalDefaultHook(void*,sqlite3*,const char*,int);
+#endif
+#ifndef SQLITE_OMIT_CTE
+SQLITE_PRIVATE Cte *sqlite3CteNew(Parse*,Token*,ExprList*,Select*,u8);
+SQLITE_PRIVATE void sqlite3CteDelete(sqlite3*,Cte*);
+SQLITE_PRIVATE With *sqlite3WithAdd(Parse*,With*,Cte*);
+SQLITE_PRIVATE void sqlite3WithDelete(sqlite3*,With*);
+SQLITE_PRIVATE void sqlite3WithDeleteGeneric(sqlite3*,void*);
+SQLITE_PRIVATE With *sqlite3WithPush(Parse*, With*, u8);
+#else
+# define sqlite3CteNew(P,T,E,S) ((void*)0)
+# define sqlite3CteDelete(D,C)
+# define sqlite3CteWithAdd(P,W,C) ((void*)0)
+# define sqlite3WithDelete(x,y)
+# define sqlite3WithPush(x,y,z) ((void*)0)
+#endif
+#ifndef SQLITE_OMIT_UPSERT
+SQLITE_PRIVATE Upsert *sqlite3UpsertNew(sqlite3*,ExprList*,Expr*,ExprList*,Expr*,Upsert*);
+SQLITE_PRIVATE void sqlite3UpsertDelete(sqlite3*,Upsert*);
+SQLITE_PRIVATE Upsert *sqlite3UpsertDup(sqlite3*,Upsert*);
+SQLITE_PRIVATE int sqlite3UpsertAnalyzeTarget(Parse*,SrcList*,Upsert*,Upsert*);
+SQLITE_PRIVATE void sqlite3UpsertDoUpdate(Parse*,Upsert*,Table*,Index*,int);
+SQLITE_PRIVATE Upsert *sqlite3UpsertOfIndex(Upsert*,Index*);
+SQLITE_PRIVATE int sqlite3UpsertNextIsIPK(Upsert*);
+#else
+#define sqlite3UpsertNew(u,v,w,x,y,z) ((Upsert*)0)
+#define sqlite3UpsertDelete(x,y)
+#define sqlite3UpsertDup(x,y) ((Upsert*)0)
+#define sqlite3UpsertOfIndex(x,y) ((Upsert*)0)
+#define sqlite3UpsertNextIsIPK(x) 0
+#endif
+
+
+/* Declarations for functions in fkey.c. All of these are replaced by
+** no-op macros if OMIT_FOREIGN_KEY is defined. In this case no foreign
+** key functionality is available. If OMIT_TRIGGER is defined but
+** OMIT_FOREIGN_KEY is not, only some of the functions are no-oped. In
+** this case foreign keys are parsed, but no other functionality is
+** provided (enforcement of FK constraints requires the triggers sub-system).
+*/
+#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
+SQLITE_PRIVATE void sqlite3FkCheck(Parse*, Table*, int, int, int*, int);
+SQLITE_PRIVATE void sqlite3FkDropTable(Parse*, SrcList *, Table*);
+SQLITE_PRIVATE void sqlite3FkActions(Parse*, Table*, ExprList*, int, int*, int);
+SQLITE_PRIVATE int sqlite3FkRequired(Parse*, Table*, int*, int);
+SQLITE_PRIVATE u32 sqlite3FkOldmask(Parse*, Table*);
+SQLITE_PRIVATE FKey *sqlite3FkReferences(Table *);
+SQLITE_PRIVATE void sqlite3FkClearTriggerCache(sqlite3*,int);
+#else
+ #define sqlite3FkActions(a,b,c,d,e,f)
+ #define sqlite3FkCheck(a,b,c,d,e,f)
+ #define sqlite3FkDropTable(a,b,c)
+ #define sqlite3FkOldmask(a,b) 0
+ #define sqlite3FkRequired(a,b,c,d) 0
+ #define sqlite3FkReferences(a) 0
+ #define sqlite3FkClearTriggerCache(a,b)
+#endif
+#ifndef SQLITE_OMIT_FOREIGN_KEY
+SQLITE_PRIVATE void sqlite3FkDelete(sqlite3 *, Table*);
+SQLITE_PRIVATE int sqlite3FkLocateIndex(Parse*,Table*,FKey*,Index**,int**);
+#else
+ #define sqlite3FkDelete(a,b)
+ #define sqlite3FkLocateIndex(a,b,c,d,e)
+#endif
+
+
+/*
+** Available fault injectors. Should be numbered beginning with 0.
+*/
+#define SQLITE_FAULTINJECTOR_MALLOC 0
+#define SQLITE_FAULTINJECTOR_COUNT 1
+
+/*
+** The interface to the code in fault.c used for identifying "benign"
+** malloc failures. This is only present if SQLITE_UNTESTABLE
+** is not defined.
+*/
+#ifndef SQLITE_UNTESTABLE
+SQLITE_PRIVATE void sqlite3BeginBenignMalloc(void);
+SQLITE_PRIVATE void sqlite3EndBenignMalloc(void);
+#else
+ #define sqlite3BeginBenignMalloc()
+ #define sqlite3EndBenignMalloc()
+#endif
+
+/*
+** Allowed return values from sqlite3FindInIndex()
+*/
+#define IN_INDEX_ROWID 1 /* Search the rowid of the table */
+#define IN_INDEX_EPH 2 /* Search an ephemeral b-tree */
+#define IN_INDEX_INDEX_ASC 3 /* Existing index ASCENDING */
+#define IN_INDEX_INDEX_DESC 4 /* Existing index DESCENDING */
+#define IN_INDEX_NOOP 5 /* No table available. Use comparisons */
+/*
+** Allowed flags for the 3rd parameter to sqlite3FindInIndex().
+*/
+#define IN_INDEX_NOOP_OK 0x0001 /* OK to return IN_INDEX_NOOP */
+#define IN_INDEX_MEMBERSHIP 0x0002 /* IN operator used for membership test */
+#define IN_INDEX_LOOP 0x0004 /* IN operator used as a loop */
+SQLITE_PRIVATE int sqlite3FindInIndex(Parse *, Expr *, u32, int*, int*, int*);
+
+SQLITE_PRIVATE int sqlite3JournalOpen(sqlite3_vfs *, const char *, sqlite3_file *, int, int);
+SQLITE_PRIVATE int sqlite3JournalSize(sqlite3_vfs *);
+#if defined(SQLITE_ENABLE_ATOMIC_WRITE) \
+ || defined(SQLITE_ENABLE_BATCH_ATOMIC_WRITE)
+SQLITE_PRIVATE int sqlite3JournalCreate(sqlite3_file *);
+#endif
+
+SQLITE_PRIVATE int sqlite3JournalIsInMemory(sqlite3_file *p);
+SQLITE_PRIVATE void sqlite3MemJournalOpen(sqlite3_file *);
+
+SQLITE_PRIVATE void sqlite3ExprSetHeightAndFlags(Parse *pParse, Expr *p);
+#if SQLITE_MAX_EXPR_DEPTH>0
+SQLITE_PRIVATE int sqlite3SelectExprHeight(const Select *);
+SQLITE_PRIVATE int sqlite3ExprCheckHeight(Parse*, int);
+#else
+ #define sqlite3SelectExprHeight(x) 0
+ #define sqlite3ExprCheckHeight(x,y)
+#endif
+SQLITE_PRIVATE void sqlite3ExprSetErrorOffset(Expr*,int);
+
+SQLITE_PRIVATE u32 sqlite3Get4byte(const u8*);
+SQLITE_PRIVATE void sqlite3Put4byte(u8*, u32);
+
+#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY
+SQLITE_PRIVATE void sqlite3ConnectionBlocked(sqlite3 *, sqlite3 *);
+SQLITE_PRIVATE void sqlite3ConnectionUnlocked(sqlite3 *db);
+SQLITE_PRIVATE void sqlite3ConnectionClosed(sqlite3 *db);
+#else
+ #define sqlite3ConnectionBlocked(x,y)
+ #define sqlite3ConnectionUnlocked(x)
+ #define sqlite3ConnectionClosed(x)
+#endif
+
+#ifdef SQLITE_DEBUG
+SQLITE_PRIVATE void sqlite3ParserTrace(FILE*, char *);
+#endif
+#if defined(YYCOVERAGE)
+SQLITE_PRIVATE int sqlite3ParserCoverage(FILE*);
+#endif
+
+/*
+** If the SQLITE_ENABLE IOTRACE exists then the global variable
+** sqlite3IoTrace is a pointer to a printf-like routine used to
+** print I/O tracing messages.
+*/
+#ifdef SQLITE_ENABLE_IOTRACE
+# define IOTRACE(A) if( sqlite3IoTrace ){ sqlite3IoTrace A; }
+SQLITE_PRIVATE void sqlite3VdbeIOTraceSql(Vdbe*);
+SQLITE_API SQLITE_EXTERN void (SQLITE_CDECL *sqlite3IoTrace)(const char*,...);
+#else
+# define IOTRACE(A)
+# define sqlite3VdbeIOTraceSql(X)
+#endif
+
+/*
+** These routines are available for the mem2.c debugging memory allocator
+** only. They are used to verify that different "types" of memory
+** allocations are properly tracked by the system.
+**
+** sqlite3MemdebugSetType() sets the "type" of an allocation to one of
+** the MEMTYPE_* macros defined below. The type must be a bitmask with
+** a single bit set.
+**
+** sqlite3MemdebugHasType() returns true if any of the bits in its second
+** argument match the type set by the previous sqlite3MemdebugSetType().
+** sqlite3MemdebugHasType() is intended for use inside assert() statements.
+**
+** sqlite3MemdebugNoType() returns true if none of the bits in its second
+** argument match the type set by the previous sqlite3MemdebugSetType().
+**
+** Perhaps the most important point is the difference between MEMTYPE_HEAP
+** and MEMTYPE_LOOKASIDE. If an allocation is MEMTYPE_LOOKASIDE, that means
+** it might have been allocated by lookaside, except the allocation was
+** too large or lookaside was already full. It is important to verify
+** that allocations that might have been satisfied by lookaside are not
+** passed back to non-lookaside free() routines. Asserts such as the
+** example above are placed on the non-lookaside free() routines to verify
+** this constraint.
+**
+** All of this is no-op for a production build. It only comes into
+** play when the SQLITE_MEMDEBUG compile-time option is used.
+*/
+#ifdef SQLITE_MEMDEBUG
+SQLITE_PRIVATE void sqlite3MemdebugSetType(void*,u8);
+SQLITE_PRIVATE int sqlite3MemdebugHasType(const void*,u8);
+SQLITE_PRIVATE int sqlite3MemdebugNoType(const void*,u8);
+#else
+# define sqlite3MemdebugSetType(X,Y) /* no-op */
+# define sqlite3MemdebugHasType(X,Y) 1
+# define sqlite3MemdebugNoType(X,Y) 1
+#endif
+#define MEMTYPE_HEAP 0x01 /* General heap allocations */
+#define MEMTYPE_LOOKASIDE 0x02 /* Heap that might have been lookaside */
+#define MEMTYPE_PCACHE 0x04 /* Page cache allocations */
+
+/*
+** Threading interface
+*/
+#if SQLITE_MAX_WORKER_THREADS>0
+SQLITE_PRIVATE int sqlite3ThreadCreate(SQLiteThread**,void*(*)(void*),void*);
+SQLITE_PRIVATE int sqlite3ThreadJoin(SQLiteThread*, void**);
+#endif
+
+#if defined(SQLITE_ENABLE_DBPAGE_VTAB) || defined(SQLITE_TEST)
+SQLITE_PRIVATE int sqlite3DbpageRegister(sqlite3*);
+#endif
+#if defined(SQLITE_ENABLE_DBSTAT_VTAB) || defined(SQLITE_TEST)
+SQLITE_PRIVATE int sqlite3DbstatRegister(sqlite3*);
+#endif
+
+SQLITE_PRIVATE int sqlite3ExprVectorSize(const Expr *pExpr);
+SQLITE_PRIVATE int sqlite3ExprIsVector(const Expr *pExpr);
+SQLITE_PRIVATE Expr *sqlite3VectorFieldSubexpr(Expr*, int);
+SQLITE_PRIVATE Expr *sqlite3ExprForVectorField(Parse*,Expr*,int,int);
+SQLITE_PRIVATE void sqlite3VectorErrorMsg(Parse*, Expr*);
+
+#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
+SQLITE_PRIVATE const char **sqlite3CompileOptions(int *pnOpt);
+#endif
+
+#if SQLITE_OS_UNIX && defined(SQLITE_OS_KV_OPTIONAL)
+SQLITE_PRIVATE int sqlite3KvvfsInit(void);
+#endif
+
+#if defined(VDBE_PROFILE) \
+ || defined(SQLITE_PERFORMANCE_TRACE) \
+ || defined(SQLITE_ENABLE_STMT_SCANSTATUS)
+SQLITE_PRIVATE sqlite3_uint64 sqlite3Hwtime(void);
+#endif
+
+#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
+# define IS_STMT_SCANSTATUS(db) (db->flags & SQLITE_StmtScanStatus)
+#else
+# define IS_STMT_SCANSTATUS(db) 0
+#endif
+
+#endif /* SQLITEINT_H */
+
+/************** End of sqliteInt.h *******************************************/
+/************** Begin file os_common.h ***************************************/
+/*
+** 2004 May 22
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+******************************************************************************
+**
+** This file contains macros and a little bit of code that is common to
+** all of the platform-specific files (os_*.c) and is #included into those
+** files.
+**
+** This file should be #included by the os_*.c files only. It is not a
+** general purpose header file.
+*/
+#ifndef _OS_COMMON_H_
+#define _OS_COMMON_H_
+
+/*
+** At least two bugs have slipped in because we changed the MEMORY_DEBUG
+** macro to SQLITE_DEBUG and some older makefiles have not yet made the
+** switch. The following code should catch this problem at compile-time.
+*/
+#ifdef MEMORY_DEBUG
+# error "The MEMORY_DEBUG macro is obsolete. Use SQLITE_DEBUG instead."
+#endif
+
+/*
+** Macros for performance tracing. Normally turned off. Only works
+** on i486 hardware.
+*/
+#ifdef SQLITE_PERFORMANCE_TRACE
+
+static sqlite_uint64 g_start;
+static sqlite_uint64 g_elapsed;
+#define TIMER_START g_start=sqlite3Hwtime()
+#define TIMER_END g_elapsed=sqlite3Hwtime()-g_start
+#define TIMER_ELAPSED g_elapsed
+#else
+#define TIMER_START
+#define TIMER_END
+#define TIMER_ELAPSED ((sqlite_uint64)0)
+#endif
+
+/*
+** If we compile with the SQLITE_TEST macro set, then the following block
+** of code will give us the ability to simulate a disk I/O error. This
+** is used for testing the I/O recovery logic.
+*/
+#if defined(SQLITE_TEST)
+SQLITE_API extern int sqlite3_io_error_hit;
+SQLITE_API extern int sqlite3_io_error_hardhit;
+SQLITE_API extern int sqlite3_io_error_pending;
+SQLITE_API extern int sqlite3_io_error_persist;
+SQLITE_API extern int sqlite3_io_error_benign;
+SQLITE_API extern int sqlite3_diskfull_pending;
+SQLITE_API extern int sqlite3_diskfull;
+#define SimulateIOErrorBenign(X) sqlite3_io_error_benign=(X)
+#define SimulateIOError(CODE) \
+ if( (sqlite3_io_error_persist && sqlite3_io_error_hit) \
+ || sqlite3_io_error_pending-- == 1 ) \
+ { local_ioerr(); CODE; }
+static void local_ioerr(){
+ IOTRACE(("IOERR\n"));
+ sqlite3_io_error_hit++;
+ if( !sqlite3_io_error_benign ) sqlite3_io_error_hardhit++;
+}
+#define SimulateDiskfullError(CODE) \
+ if( sqlite3_diskfull_pending ){ \
+ if( sqlite3_diskfull_pending == 1 ){ \
+ local_ioerr(); \
+ sqlite3_diskfull = 1; \
+ sqlite3_io_error_hit = 1; \
+ CODE; \
+ }else{ \
+ sqlite3_diskfull_pending--; \
+ } \
+ }
+#else
+#define SimulateIOErrorBenign(X)
+#define SimulateIOError(A)
+#define SimulateDiskfullError(A)
+#endif /* defined(SQLITE_TEST) */
+
+/*
+** When testing, keep a count of the number of open files.
+*/
+#if defined(SQLITE_TEST)
+SQLITE_API extern int sqlite3_open_file_count;
+#define OpenCounter(X) sqlite3_open_file_count+=(X)
+#else
+#define OpenCounter(X)
+#endif /* defined(SQLITE_TEST) */
+
+#endif /* !defined(_OS_COMMON_H_) */
+
+/************** End of os_common.h *******************************************/
+/************** Begin file ctime.c *******************************************/
+/* DO NOT EDIT!
+** This file is automatically generated by the script in the canonical
+** SQLite source tree at tool/mkctimec.tcl.
+**
+** To modify this header, edit any of the various lists in that script
+** which specify categories of generated conditionals in this file.
+*/
+
+/*
+** 2010 February 23
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+**
+** This file implements routines used to report what compile-time options
+** SQLite was built with.
+*/
+#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS /* IMP: R-16824-07538 */
+
+/*
+** Include the configuration header output by 'configure' if we're using the
+** autoconf-based build
+*/
+#if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H)
+/* #include "sqlite_cfg.h" */
+#define SQLITECONFIG_H 1
+#endif
+
+/* These macros are provided to "stringify" the value of the define
+** for those options in which the value is meaningful. */
+#define CTIMEOPT_VAL_(opt) #opt
+#define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt)
+
+/* Like CTIMEOPT_VAL, but especially for SQLITE_DEFAULT_LOOKASIDE. This
+** option requires a separate macro because legal values contain a single
+** comma. e.g. (-DSQLITE_DEFAULT_LOOKASIDE="100,100") */
+#define CTIMEOPT_VAL2_(opt1,opt2) #opt1 "," #opt2
+#define CTIMEOPT_VAL2(opt) CTIMEOPT_VAL2_(opt)
+/* #include "sqliteInt.h" */
+
+/*
+** An array of names of all compile-time options. This array should
+** be sorted A-Z.
+**
+** This array looks large, but in a typical installation actually uses
+** only a handful of compile-time options, so most times this array is usually
+** rather short and uses little memory space.
+*/
+static const char * const sqlite3azCompileOpt[] = {
+
+#ifdef SQLITE_32BIT_ROWID
+ "32BIT_ROWID",
+#endif
+#ifdef SQLITE_4_BYTE_ALIGNED_MALLOC
+ "4_BYTE_ALIGNED_MALLOC",
+#endif
+#ifdef SQLITE_ALLOW_COVERING_INDEX_SCAN
+# if SQLITE_ALLOW_COVERING_INDEX_SCAN != 1
+ "ALLOW_COVERING_INDEX_SCAN=" CTIMEOPT_VAL(SQLITE_ALLOW_COVERING_INDEX_SCAN),
+# endif
+#endif
+#ifdef SQLITE_ALLOW_ROWID_IN_VIEW
+ "ALLOW_ROWID_IN_VIEW",
+#endif
+#ifdef SQLITE_ALLOW_URI_AUTHORITY
+ "ALLOW_URI_AUTHORITY",
+#endif
+#ifdef SQLITE_ATOMIC_INTRINSICS
+ "ATOMIC_INTRINSICS=" CTIMEOPT_VAL(SQLITE_ATOMIC_INTRINSICS),
+#endif
+#ifdef SQLITE_BITMASK_TYPE
+ "BITMASK_TYPE=" CTIMEOPT_VAL(SQLITE_BITMASK_TYPE),
+#endif
+#ifdef SQLITE_BUG_COMPATIBLE_20160819
+ "BUG_COMPATIBLE_20160819",
+#endif
+#ifdef SQLITE_CASE_SENSITIVE_LIKE
+ "CASE_SENSITIVE_LIKE",
+#endif
+#ifdef SQLITE_CHECK_PAGES
+ "CHECK_PAGES",
+#endif
+#if defined(__clang__) && defined(__clang_major__)
+ "COMPILER=clang-" CTIMEOPT_VAL(__clang_major__) "."
+ CTIMEOPT_VAL(__clang_minor__) "."
+ CTIMEOPT_VAL(__clang_patchlevel__),
+#elif defined(_MSC_VER)
+ "COMPILER=msvc-" CTIMEOPT_VAL(_MSC_VER),
+#elif defined(__GNUC__) && defined(__VERSION__)
+ "COMPILER=gcc-" __VERSION__,
+#endif
+#ifdef SQLITE_COVERAGE_TEST
+ "COVERAGE_TEST",
+#endif
+#ifdef SQLITE_DEBUG
+ "DEBUG",
+#endif
+#ifdef SQLITE_DEFAULT_AUTOMATIC_INDEX
+ "DEFAULT_AUTOMATIC_INDEX",
+#endif
+#ifdef SQLITE_DEFAULT_AUTOVACUUM
+ "DEFAULT_AUTOVACUUM",
+#endif
+#ifdef SQLITE_DEFAULT_CACHE_SIZE
+ "DEFAULT_CACHE_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_CACHE_SIZE),
+#endif
+#ifdef SQLITE_DEFAULT_CKPTFULLFSYNC
+ "DEFAULT_CKPTFULLFSYNC",
+#endif
+#ifdef SQLITE_DEFAULT_FILE_FORMAT
+ "DEFAULT_FILE_FORMAT=" CTIMEOPT_VAL(SQLITE_DEFAULT_FILE_FORMAT),
+#endif
+#ifdef SQLITE_DEFAULT_FILE_PERMISSIONS
+ "DEFAULT_FILE_PERMISSIONS=" CTIMEOPT_VAL(SQLITE_DEFAULT_FILE_PERMISSIONS),
+#endif
+#ifdef SQLITE_DEFAULT_FOREIGN_KEYS
+ "DEFAULT_FOREIGN_KEYS",
+#endif
+#ifdef SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT
+ "DEFAULT_JOURNAL_SIZE_LIMIT=" CTIMEOPT_VAL(SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT),
+#endif
+#ifdef SQLITE_DEFAULT_LOCKING_MODE
+ "DEFAULT_LOCKING_MODE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE),
+#endif
+#ifdef SQLITE_DEFAULT_LOOKASIDE
+ "DEFAULT_LOOKASIDE=" CTIMEOPT_VAL2(SQLITE_DEFAULT_LOOKASIDE),
+#endif
+#ifdef SQLITE_DEFAULT_MEMSTATUS
+# if SQLITE_DEFAULT_MEMSTATUS != 1
+ "DEFAULT_MEMSTATUS=" CTIMEOPT_VAL(SQLITE_DEFAULT_MEMSTATUS),
+# endif
+#endif
+#ifdef SQLITE_DEFAULT_MMAP_SIZE
+ "DEFAULT_MMAP_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_MMAP_SIZE),
+#endif
+#ifdef SQLITE_DEFAULT_PAGE_SIZE
+ "DEFAULT_PAGE_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_PAGE_SIZE),
+#endif
+#ifdef SQLITE_DEFAULT_PCACHE_INITSZ
+ "DEFAULT_PCACHE_INITSZ=" CTIMEOPT_VAL(SQLITE_DEFAULT_PCACHE_INITSZ),
+#endif
+#ifdef SQLITE_DEFAULT_PROXYDIR_PERMISSIONS
+ "DEFAULT_PROXYDIR_PERMISSIONS=" CTIMEOPT_VAL(SQLITE_DEFAULT_PROXYDIR_PERMISSIONS),
+#endif
+#ifdef SQLITE_DEFAULT_RECURSIVE_TRIGGERS
+ "DEFAULT_RECURSIVE_TRIGGERS",
+#endif
+#ifdef SQLITE_DEFAULT_ROWEST
+ "DEFAULT_ROWEST=" CTIMEOPT_VAL(SQLITE_DEFAULT_ROWEST),
+#endif
+#ifdef SQLITE_DEFAULT_SECTOR_SIZE
+ "DEFAULT_SECTOR_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_SECTOR_SIZE),
+#endif
+#ifdef SQLITE_DEFAULT_SYNCHRONOUS
+ "DEFAULT_SYNCHRONOUS=" CTIMEOPT_VAL(SQLITE_DEFAULT_SYNCHRONOUS),
+#endif
+#ifdef SQLITE_DEFAULT_WAL_AUTOCHECKPOINT
+ "DEFAULT_WAL_AUTOCHECKPOINT=" CTIMEOPT_VAL(SQLITE_DEFAULT_WAL_AUTOCHECKPOINT),
+#endif
+#ifdef SQLITE_DEFAULT_WAL_SYNCHRONOUS
+ "DEFAULT_WAL_SYNCHRONOUS=" CTIMEOPT_VAL(SQLITE_DEFAULT_WAL_SYNCHRONOUS),
+#endif
+#ifdef SQLITE_DEFAULT_WORKER_THREADS
+ "DEFAULT_WORKER_THREADS=" CTIMEOPT_VAL(SQLITE_DEFAULT_WORKER_THREADS),
+#endif
+#ifdef SQLITE_DIRECT_OVERFLOW_READ
+ "DIRECT_OVERFLOW_READ",
+#endif
+#ifdef SQLITE_DISABLE_DIRSYNC
+ "DISABLE_DIRSYNC",
+#endif
+#ifdef SQLITE_DISABLE_FTS3_UNICODE
+ "DISABLE_FTS3_UNICODE",
+#endif
+#ifdef SQLITE_DISABLE_FTS4_DEFERRED
+ "DISABLE_FTS4_DEFERRED",
+#endif
+#ifdef SQLITE_DISABLE_INTRINSIC
+ "DISABLE_INTRINSIC",
+#endif
+#ifdef SQLITE_DISABLE_LFS
+ "DISABLE_LFS",
+#endif
+#ifdef SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS
+ "DISABLE_PAGECACHE_OVERFLOW_STATS",
+#endif
+#ifdef SQLITE_DISABLE_SKIPAHEAD_DISTINCT
+ "DISABLE_SKIPAHEAD_DISTINCT",
+#endif
+#ifdef SQLITE_DQS
+ "DQS=" CTIMEOPT_VAL(SQLITE_DQS),
+#endif
+#ifdef SQLITE_ENABLE_8_3_NAMES
+ "ENABLE_8_3_NAMES=" CTIMEOPT_VAL(SQLITE_ENABLE_8_3_NAMES),
+#endif
+#ifdef SQLITE_ENABLE_API_ARMOR
+ "ENABLE_API_ARMOR",
+#endif
+#ifdef SQLITE_ENABLE_ATOMIC_WRITE
+ "ENABLE_ATOMIC_WRITE",
+#endif
+#ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE
+ "ENABLE_BATCH_ATOMIC_WRITE",
+#endif
+#ifdef SQLITE_ENABLE_BYTECODE_VTAB
+ "ENABLE_BYTECODE_VTAB",
+#endif
+#ifdef SQLITE_ENABLE_CEROD
+ "ENABLE_CEROD=" CTIMEOPT_VAL(SQLITE_ENABLE_CEROD),
+#endif
+#ifdef SQLITE_ENABLE_COLUMN_METADATA
+ "ENABLE_COLUMN_METADATA",
+#endif
+#ifdef SQLITE_ENABLE_COLUMN_USED_MASK
+ "ENABLE_COLUMN_USED_MASK",
+#endif
+#ifdef SQLITE_ENABLE_COSTMULT
+ "ENABLE_COSTMULT",
+#endif
+#ifdef SQLITE_ENABLE_CURSOR_HINTS
+ "ENABLE_CURSOR_HINTS",
+#endif
+#ifdef SQLITE_ENABLE_DBPAGE_VTAB
+ "ENABLE_DBPAGE_VTAB",
+#endif
+#ifdef SQLITE_ENABLE_DBSTAT_VTAB
+ "ENABLE_DBSTAT_VTAB",
+#endif
+#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT
+ "ENABLE_EXPENSIVE_ASSERT",
+#endif
+#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
+ "ENABLE_EXPLAIN_COMMENTS",
+#endif
+#ifdef SQLITE_ENABLE_FTS3
+ "ENABLE_FTS3",
+#endif
+#ifdef SQLITE_ENABLE_FTS3_PARENTHESIS
+ "ENABLE_FTS3_PARENTHESIS",
+#endif
+#ifdef SQLITE_ENABLE_FTS3_TOKENIZER
+ "ENABLE_FTS3_TOKENIZER",
+#endif
+#ifdef SQLITE_ENABLE_FTS4
+ "ENABLE_FTS4",
+#endif
+#ifdef SQLITE_ENABLE_FTS5
+ "ENABLE_FTS5",
+#endif
+#ifdef SQLITE_ENABLE_GEOPOLY
+ "ENABLE_GEOPOLY",
+#endif
+#ifdef SQLITE_ENABLE_HIDDEN_COLUMNS
+ "ENABLE_HIDDEN_COLUMNS",
+#endif
+#ifdef SQLITE_ENABLE_ICU
+ "ENABLE_ICU",
+#endif
+#ifdef SQLITE_ENABLE_IOTRACE
+ "ENABLE_IOTRACE",
+#endif
+#ifdef SQLITE_ENABLE_LOAD_EXTENSION
+ "ENABLE_LOAD_EXTENSION",
+#endif
+#ifdef SQLITE_ENABLE_LOCKING_STYLE
+ "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE),
+#endif
+#ifdef SQLITE_ENABLE_MATH_FUNCTIONS
+ "ENABLE_MATH_FUNCTIONS",
+#endif
+#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
+ "ENABLE_MEMORY_MANAGEMENT",
+#endif
+#ifdef SQLITE_ENABLE_MEMSYS3
+ "ENABLE_MEMSYS3",
+#endif
+#ifdef SQLITE_ENABLE_MEMSYS5
+ "ENABLE_MEMSYS5",
+#endif
+#ifdef SQLITE_ENABLE_MULTIPLEX
+ "ENABLE_MULTIPLEX",
+#endif
+#ifdef SQLITE_ENABLE_NORMALIZE
+ "ENABLE_NORMALIZE",
+#endif
+#ifdef SQLITE_ENABLE_NULL_TRIM
+ "ENABLE_NULL_TRIM",
+#endif
+#ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC
+ "ENABLE_OFFSET_SQL_FUNC",
+#endif
+#ifdef SQLITE_ENABLE_ORDERED_SET_AGGREGATES
+ "ENABLE_ORDERED_SET_AGGREGATES",
+#endif
+#ifdef SQLITE_ENABLE_OVERSIZE_CELL_CHECK
+ "ENABLE_OVERSIZE_CELL_CHECK",
+#endif
+#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
+ "ENABLE_PREUPDATE_HOOK",
+#endif
+#ifdef SQLITE_ENABLE_QPSG
+ "ENABLE_QPSG",
+#endif
+#ifdef SQLITE_ENABLE_RBU
+ "ENABLE_RBU",
+#endif
+#ifdef SQLITE_ENABLE_RTREE
+ "ENABLE_RTREE",
+#endif
+#ifdef SQLITE_ENABLE_SESSION
+ "ENABLE_SESSION",
+#endif
+#ifdef SQLITE_ENABLE_SNAPSHOT
+ "ENABLE_SNAPSHOT",
+#endif
+#ifdef SQLITE_ENABLE_SORTER_REFERENCES
+ "ENABLE_SORTER_REFERENCES",
+#endif
+#ifdef SQLITE_ENABLE_SQLLOG
+ "ENABLE_SQLLOG",
+#endif
+#ifdef SQLITE_ENABLE_STAT4
+ "ENABLE_STAT4",
+#endif
+#ifdef SQLITE_ENABLE_STMTVTAB
+ "ENABLE_STMTVTAB",
+#endif
+#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
+ "ENABLE_STMT_SCANSTATUS",
+#endif
+#ifdef SQLITE_ENABLE_TREETRACE
+ "ENABLE_TREETRACE",
+#endif
+#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
+ "ENABLE_UNKNOWN_SQL_FUNCTION",
+#endif
+#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY
+ "ENABLE_UNLOCK_NOTIFY",
+#endif
+#ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT
+ "ENABLE_UPDATE_DELETE_LIMIT",
+#endif
+#ifdef SQLITE_ENABLE_URI_00_ERROR
+ "ENABLE_URI_00_ERROR",
+#endif
+#ifdef SQLITE_ENABLE_VFSTRACE
+ "ENABLE_VFSTRACE",
+#endif
+#ifdef SQLITE_ENABLE_WHERETRACE
+ "ENABLE_WHERETRACE",
+#endif
+#ifdef SQLITE_ENABLE_ZIPVFS
+ "ENABLE_ZIPVFS",
+#endif
+#ifdef SQLITE_EXPLAIN_ESTIMATED_ROWS
+ "EXPLAIN_ESTIMATED_ROWS",
+#endif
+#ifdef SQLITE_EXTRA_AUTOEXT
+ "EXTRA_AUTOEXT=" CTIMEOPT_VAL(SQLITE_EXTRA_AUTOEXT),
+#endif
+#ifdef SQLITE_EXTRA_IFNULLROW
+ "EXTRA_IFNULLROW",
+#endif
+#ifdef SQLITE_EXTRA_INIT
+ "EXTRA_INIT=" CTIMEOPT_VAL(SQLITE_EXTRA_INIT),
+#endif
+#ifdef SQLITE_EXTRA_SHUTDOWN
+ "EXTRA_SHUTDOWN=" CTIMEOPT_VAL(SQLITE_EXTRA_SHUTDOWN),
+#endif
+#ifdef SQLITE_FTS3_MAX_EXPR_DEPTH
+ "FTS3_MAX_EXPR_DEPTH=" CTIMEOPT_VAL(SQLITE_FTS3_MAX_EXPR_DEPTH),
+#endif
+#ifdef SQLITE_FTS5_ENABLE_TEST_MI
+ "FTS5_ENABLE_TEST_MI",
+#endif
+#ifdef SQLITE_FTS5_NO_WITHOUT_ROWID
+ "FTS5_NO_WITHOUT_ROWID",
+#endif
+#if HAVE_ISNAN || SQLITE_HAVE_ISNAN
+ "HAVE_ISNAN",
+#endif
+#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX
+# if SQLITE_HOMEGROWN_RECURSIVE_MUTEX != 1
+ "HOMEGROWN_RECURSIVE_MUTEX=" CTIMEOPT_VAL(SQLITE_HOMEGROWN_RECURSIVE_MUTEX),
+# endif
+#endif
+#ifdef SQLITE_IGNORE_AFP_LOCK_ERRORS
+ "IGNORE_AFP_LOCK_ERRORS",
+#endif
+#ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS
+ "IGNORE_FLOCK_LOCK_ERRORS",
+#endif
+#ifdef SQLITE_INLINE_MEMCPY
+ "INLINE_MEMCPY",
+#endif
+#ifdef SQLITE_INT64_TYPE
+ "INT64_TYPE",
+#endif
+#ifdef SQLITE_INTEGRITY_CHECK_ERROR_MAX
+ "INTEGRITY_CHECK_ERROR_MAX=" CTIMEOPT_VAL(SQLITE_INTEGRITY_CHECK_ERROR_MAX),
+#endif
+#ifdef SQLITE_LEGACY_JSON_VALID
+ "LEGACY_JSON_VALID",
+#endif
+#ifdef SQLITE_LIKE_DOESNT_MATCH_BLOBS
+ "LIKE_DOESNT_MATCH_BLOBS",
+#endif
+#ifdef SQLITE_LOCK_TRACE
+ "LOCK_TRACE",
+#endif
+#ifdef SQLITE_LOG_CACHE_SPILL
+ "LOG_CACHE_SPILL",
+#endif
+#ifdef SQLITE_MALLOC_SOFT_LIMIT
+ "MALLOC_SOFT_LIMIT=" CTIMEOPT_VAL(SQLITE_MALLOC_SOFT_LIMIT),
+#endif
+#ifdef SQLITE_MAX_ATTACHED
+ "MAX_ATTACHED=" CTIMEOPT_VAL(SQLITE_MAX_ATTACHED),
+#endif
+#ifdef SQLITE_MAX_COLUMN
+ "MAX_COLUMN=" CTIMEOPT_VAL(SQLITE_MAX_COLUMN),
+#endif
+#ifdef SQLITE_MAX_COMPOUND_SELECT
+ "MAX_COMPOUND_SELECT=" CTIMEOPT_VAL(SQLITE_MAX_COMPOUND_SELECT),
+#endif
+#ifdef SQLITE_MAX_DEFAULT_PAGE_SIZE
+ "MAX_DEFAULT_PAGE_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_DEFAULT_PAGE_SIZE),
+#endif
+#ifdef SQLITE_MAX_EXPR_DEPTH
+ "MAX_EXPR_DEPTH=" CTIMEOPT_VAL(SQLITE_MAX_EXPR_DEPTH),
+#endif
+#ifdef SQLITE_MAX_FUNCTION_ARG
+ "MAX_FUNCTION_ARG=" CTIMEOPT_VAL(SQLITE_MAX_FUNCTION_ARG),
+#endif
+#ifdef SQLITE_MAX_LENGTH
+ "MAX_LENGTH=" CTIMEOPT_VAL(SQLITE_MAX_LENGTH),
+#endif
+#ifdef SQLITE_MAX_LIKE_PATTERN_LENGTH
+ "MAX_LIKE_PATTERN_LENGTH=" CTIMEOPT_VAL(SQLITE_MAX_LIKE_PATTERN_LENGTH),
+#endif
+#ifdef SQLITE_MAX_MEMORY
+ "MAX_MEMORY=" CTIMEOPT_VAL(SQLITE_MAX_MEMORY),
+#endif
+#ifdef SQLITE_MAX_MMAP_SIZE
+ "MAX_MMAP_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_MMAP_SIZE),
+#endif
+#ifdef SQLITE_MAX_MMAP_SIZE_
+ "MAX_MMAP_SIZE_=" CTIMEOPT_VAL(SQLITE_MAX_MMAP_SIZE_),
+#endif
+#ifdef SQLITE_MAX_PAGE_COUNT
+ "MAX_PAGE_COUNT=" CTIMEOPT_VAL(SQLITE_MAX_PAGE_COUNT),
+#endif
+#ifdef SQLITE_MAX_PAGE_SIZE
+ "MAX_PAGE_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_PAGE_SIZE),
+#endif
+#ifdef SQLITE_MAX_SCHEMA_RETRY
+ "MAX_SCHEMA_RETRY=" CTIMEOPT_VAL(SQLITE_MAX_SCHEMA_RETRY),
+#endif
+#ifdef SQLITE_MAX_SQL_LENGTH
+ "MAX_SQL_LENGTH=" CTIMEOPT_VAL(SQLITE_MAX_SQL_LENGTH),
+#endif
+#ifdef SQLITE_MAX_TRIGGER_DEPTH
+ "MAX_TRIGGER_DEPTH=" CTIMEOPT_VAL(SQLITE_MAX_TRIGGER_DEPTH),
+#endif
+#ifdef SQLITE_MAX_VARIABLE_NUMBER
+ "MAX_VARIABLE_NUMBER=" CTIMEOPT_VAL(SQLITE_MAX_VARIABLE_NUMBER),
+#endif
+#ifdef SQLITE_MAX_VDBE_OP
+ "MAX_VDBE_OP=" CTIMEOPT_VAL(SQLITE_MAX_VDBE_OP),
+#endif
+#ifdef SQLITE_MAX_WORKER_THREADS
+ "MAX_WORKER_THREADS=" CTIMEOPT_VAL(SQLITE_MAX_WORKER_THREADS),
+#endif
+#ifdef SQLITE_MEMDEBUG
+ "MEMDEBUG",
+#endif
+#ifdef SQLITE_MIXED_ENDIAN_64BIT_FLOAT
+ "MIXED_ENDIAN_64BIT_FLOAT",
+#endif
+#ifdef SQLITE_MMAP_READWRITE
+ "MMAP_READWRITE",
+#endif
+#ifdef SQLITE_MUTEX_NOOP
+ "MUTEX_NOOP",
+#endif
+#ifdef SQLITE_MUTEX_OMIT
+ "MUTEX_OMIT",
+#endif
+#ifdef SQLITE_MUTEX_PTHREADS
+ "MUTEX_PTHREADS",
+#endif
+#ifdef SQLITE_MUTEX_W32
+ "MUTEX_W32",
+#endif
+#ifdef SQLITE_NEED_ERR_NAME
+ "NEED_ERR_NAME",
+#endif
+#ifdef SQLITE_NO_SYNC
+ "NO_SYNC",
+#endif
+#ifdef SQLITE_OMIT_ALTERTABLE
+ "OMIT_ALTERTABLE",
+#endif
+#ifdef SQLITE_OMIT_ANALYZE
+ "OMIT_ANALYZE",
+#endif
+#ifdef SQLITE_OMIT_ATTACH
+ "OMIT_ATTACH",
+#endif
+#ifdef SQLITE_OMIT_AUTHORIZATION
+ "OMIT_AUTHORIZATION",
+#endif
+#ifdef SQLITE_OMIT_AUTOINCREMENT
+ "OMIT_AUTOINCREMENT",
+#endif
+#ifdef SQLITE_OMIT_AUTOINIT
+ "OMIT_AUTOINIT",
+#endif
+#ifdef SQLITE_OMIT_AUTOMATIC_INDEX
+ "OMIT_AUTOMATIC_INDEX",
+#endif
+#ifdef SQLITE_OMIT_AUTORESET
+ "OMIT_AUTORESET",
+#endif
+#ifdef SQLITE_OMIT_AUTOVACUUM
+ "OMIT_AUTOVACUUM",
+#endif
+#ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION
+ "OMIT_BETWEEN_OPTIMIZATION",
+#endif
+#ifdef SQLITE_OMIT_BLOB_LITERAL
+ "OMIT_BLOB_LITERAL",
+#endif
+#ifdef SQLITE_OMIT_CAST
+ "OMIT_CAST",
+#endif
+#ifdef SQLITE_OMIT_CHECK
+ "OMIT_CHECK",
+#endif
+#ifdef SQLITE_OMIT_COMPLETE
+ "OMIT_COMPLETE",
+#endif
+#ifdef SQLITE_OMIT_COMPOUND_SELECT
+ "OMIT_COMPOUND_SELECT",
+#endif
+#ifdef SQLITE_OMIT_CONFLICT_CLAUSE
+ "OMIT_CONFLICT_CLAUSE",
+#endif
+#ifdef SQLITE_OMIT_CTE
+ "OMIT_CTE",
+#endif
+#if defined(SQLITE_OMIT_DATETIME_FUNCS) || defined(SQLITE_OMIT_FLOATING_POINT)
+ "OMIT_DATETIME_FUNCS",
+#endif
+#ifdef SQLITE_OMIT_DECLTYPE
+ "OMIT_DECLTYPE",
+#endif
+#ifdef SQLITE_OMIT_DEPRECATED
+ "OMIT_DEPRECATED",
+#endif
+#ifdef SQLITE_OMIT_DESERIALIZE
+ "OMIT_DESERIALIZE",
+#endif
+#ifdef SQLITE_OMIT_DISKIO
+ "OMIT_DISKIO",
+#endif
+#ifdef SQLITE_OMIT_EXPLAIN
+ "OMIT_EXPLAIN",
+#endif
+#ifdef SQLITE_OMIT_FLAG_PRAGMAS
+ "OMIT_FLAG_PRAGMAS",
+#endif
+#ifdef SQLITE_OMIT_FLOATING_POINT
+ "OMIT_FLOATING_POINT",
+#endif
+#ifdef SQLITE_OMIT_FOREIGN_KEY
+ "OMIT_FOREIGN_KEY",
+#endif
+#ifdef SQLITE_OMIT_GET_TABLE
+ "OMIT_GET_TABLE",
+#endif
+#ifdef SQLITE_OMIT_HEX_INTEGER
+ "OMIT_HEX_INTEGER",
+#endif
+#ifdef SQLITE_OMIT_INCRBLOB
+ "OMIT_INCRBLOB",
+#endif
+#ifdef SQLITE_OMIT_INTEGRITY_CHECK
+ "OMIT_INTEGRITY_CHECK",
+#endif
+#ifdef SQLITE_OMIT_INTROSPECTION_PRAGMAS
+ "OMIT_INTROSPECTION_PRAGMAS",
+#endif
+#ifdef SQLITE_OMIT_JSON
+ "OMIT_JSON",
+#endif
+#ifdef SQLITE_OMIT_LIKE_OPTIMIZATION
+ "OMIT_LIKE_OPTIMIZATION",
+#endif
+#ifdef SQLITE_OMIT_LOAD_EXTENSION
+ "OMIT_LOAD_EXTENSION",
+#endif
+#ifdef SQLITE_OMIT_LOCALTIME
+ "OMIT_LOCALTIME",
+#endif
+#ifdef SQLITE_OMIT_LOOKASIDE
+ "OMIT_LOOKASIDE",
+#endif
+#ifdef SQLITE_OMIT_MEMORYDB
+ "OMIT_MEMORYDB",
+#endif
+#ifdef SQLITE_OMIT_OR_OPTIMIZATION
+ "OMIT_OR_OPTIMIZATION",
+#endif
+#ifdef SQLITE_OMIT_PAGER_PRAGMAS
+ "OMIT_PAGER_PRAGMAS",
+#endif
+#ifdef SQLITE_OMIT_PARSER_TRACE
+ "OMIT_PARSER_TRACE",
+#endif
+#ifdef SQLITE_OMIT_POPEN
+ "OMIT_POPEN",
+#endif
+#ifdef SQLITE_OMIT_PRAGMA
+ "OMIT_PRAGMA",
+#endif
+#ifdef SQLITE_OMIT_PROGRESS_CALLBACK
+ "OMIT_PROGRESS_CALLBACK",
+#endif
+#ifdef SQLITE_OMIT_QUICKBALANCE
+ "OMIT_QUICKBALANCE",
+#endif
+#ifdef SQLITE_OMIT_REINDEX
+ "OMIT_REINDEX",
+#endif
+#ifdef SQLITE_OMIT_SCHEMA_PRAGMAS
+ "OMIT_SCHEMA_PRAGMAS",
+#endif
+#ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
+ "OMIT_SCHEMA_VERSION_PRAGMAS",
+#endif
+#ifdef SQLITE_OMIT_SEH
+ "OMIT_SEH",
+#endif
+#ifdef SQLITE_OMIT_SHARED_CACHE
+ "OMIT_SHARED_CACHE",
+#endif
+#ifdef SQLITE_OMIT_SHUTDOWN_DIRECTORIES
+ "OMIT_SHUTDOWN_DIRECTORIES",
+#endif
+#ifdef SQLITE_OMIT_SUBQUERY
+ "OMIT_SUBQUERY",
+#endif
+#ifdef SQLITE_OMIT_TCL_VARIABLE
+ "OMIT_TCL_VARIABLE",
+#endif
+#ifdef SQLITE_OMIT_TEMPDB
+ "OMIT_TEMPDB",
+#endif
+#ifdef SQLITE_OMIT_TEST_CONTROL
+ "OMIT_TEST_CONTROL",
+#endif
+#ifdef SQLITE_OMIT_TRACE
+# if SQLITE_OMIT_TRACE != 1
+ "OMIT_TRACE=" CTIMEOPT_VAL(SQLITE_OMIT_TRACE),
+# endif
+#endif
+#ifdef SQLITE_OMIT_TRIGGER
+ "OMIT_TRIGGER",
+#endif
+#ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION
+ "OMIT_TRUNCATE_OPTIMIZATION",
+#endif
+#ifdef SQLITE_OMIT_UTF16
+ "OMIT_UTF16",
+#endif
+#ifdef SQLITE_OMIT_VACUUM
+ "OMIT_VACUUM",
+#endif
+#ifdef SQLITE_OMIT_VIEW
+ "OMIT_VIEW",
+#endif
+#ifdef SQLITE_OMIT_VIRTUALTABLE
+ "OMIT_VIRTUALTABLE",
+#endif
+#ifdef SQLITE_OMIT_WAL
+ "OMIT_WAL",
+#endif
+#ifdef SQLITE_OMIT_WSD
+ "OMIT_WSD",
+#endif
+#ifdef SQLITE_OMIT_XFER_OPT
+ "OMIT_XFER_OPT",
+#endif
+#ifdef SQLITE_PERFORMANCE_TRACE
+ "PERFORMANCE_TRACE",
+#endif
+#ifdef SQLITE_POWERSAFE_OVERWRITE
+# if SQLITE_POWERSAFE_OVERWRITE != 1
+ "POWERSAFE_OVERWRITE=" CTIMEOPT_VAL(SQLITE_POWERSAFE_OVERWRITE),
+# endif
+#endif
+#ifdef SQLITE_PREFER_PROXY_LOCKING
+ "PREFER_PROXY_LOCKING",
+#endif
+#ifdef SQLITE_PROXY_DEBUG
+ "PROXY_DEBUG",
+#endif
+#ifdef SQLITE_REVERSE_UNORDERED_SELECTS
+ "REVERSE_UNORDERED_SELECTS",
+#endif
+#ifdef SQLITE_RTREE_INT_ONLY
+ "RTREE_INT_ONLY",
+#endif
+#ifdef SQLITE_SECURE_DELETE
+ "SECURE_DELETE",
+#endif
+#ifdef SQLITE_SMALL_STACK
+ "SMALL_STACK",
+#endif
+#ifdef SQLITE_SORTER_PMASZ
+ "SORTER_PMASZ=" CTIMEOPT_VAL(SQLITE_SORTER_PMASZ),
+#endif
+#ifdef SQLITE_SOUNDEX
+ "SOUNDEX",
+#endif
+#ifdef SQLITE_STAT4_SAMPLES
+ "STAT4_SAMPLES=" CTIMEOPT_VAL(SQLITE_STAT4_SAMPLES),
+#endif
+#ifdef SQLITE_STMTJRNL_SPILL
+ "STMTJRNL_SPILL=" CTIMEOPT_VAL(SQLITE_STMTJRNL_SPILL),
+#endif
+#ifdef SQLITE_SUBSTR_COMPATIBILITY
+ "SUBSTR_COMPATIBILITY",
+#endif
+#if (!defined(SQLITE_WIN32_MALLOC) \
+ && !defined(SQLITE_ZERO_MALLOC) \
+ && !defined(SQLITE_MEMDEBUG) \
+ ) || defined(SQLITE_SYSTEM_MALLOC)
+ "SYSTEM_MALLOC",
+#endif
+#ifdef SQLITE_TCL
+ "TCL",
+#endif
+#ifdef SQLITE_TEMP_STORE
+ "TEMP_STORE=" CTIMEOPT_VAL(SQLITE_TEMP_STORE),
+#endif
+#ifdef SQLITE_TEST
+ "TEST",
+#endif
+#if defined(SQLITE_THREADSAFE)
+ "THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE),
+#elif defined(THREADSAFE)
+ "THREADSAFE=" CTIMEOPT_VAL(THREADSAFE),
+#else
+ "THREADSAFE=1",
+#endif
+#ifdef SQLITE_UNLINK_AFTER_CLOSE
+ "UNLINK_AFTER_CLOSE",
+#endif
+#ifdef SQLITE_UNTESTABLE
+ "UNTESTABLE",
+#endif
+#ifdef SQLITE_USE_ALLOCA
+ "USE_ALLOCA",
+#endif
+#ifdef SQLITE_USE_FCNTL_TRACE
+ "USE_FCNTL_TRACE",
+#endif
+#ifdef SQLITE_USE_URI
+ "USE_URI",
+#endif
+#ifdef SQLITE_VDBE_COVERAGE
+ "VDBE_COVERAGE",
+#endif
+#ifdef SQLITE_WIN32_MALLOC
+ "WIN32_MALLOC",
+#endif
+#ifdef SQLITE_ZERO_MALLOC
+ "ZERO_MALLOC",
+#endif
+
+} ;
+
+SQLITE_PRIVATE const char **sqlite3CompileOptions(int *pnOpt){
+ *pnOpt = sizeof(sqlite3azCompileOpt) / sizeof(sqlite3azCompileOpt[0]);
+ return (const char**)sqlite3azCompileOpt;
+}
+
+#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
+
+/************** End of ctime.c ***********************************************/
+/************** Begin file global.c ******************************************/
+/*
+** 2008 June 13
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+**
+** This file contains definitions of global variables and constants.
+*/
+/* #include "sqliteInt.h" */
+
+/* An array to map all upper-case characters into their corresponding
+** lower-case character.
+**
+** SQLite only considers US-ASCII (or EBCDIC) characters. We do not
+** handle case conversions for the UTF character set since the tables
+** involved are nearly as big or bigger than SQLite itself.
+*/
+SQLITE_PRIVATE const unsigned char sqlite3UpperToLower[] = {
+#ifdef SQLITE_ASCII
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 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, 97, 98, 99,100,101,102,103,
+ 104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,
+ 122, 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103,104,105,106,107,
+ 108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,
+ 126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
+ 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,
+ 162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,
+ 180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,
+ 198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,
+ 216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,
+ 234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,
+ 252,253,254,255,
+#endif
+#ifdef SQLITE_EBCDIC
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, /* 0x */
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, /* 1x */
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, /* 2x */
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, /* 3x */
+ 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, /* 4x */
+ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, /* 5x */
+ 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111, /* 6x */
+ 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, /* 7x */
+ 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, /* 8x */
+ 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, /* 9x */
+ 160,161,162,163,164,165,166,167,168,169,170,171,140,141,142,175, /* Ax */
+ 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, /* Bx */
+ 192,129,130,131,132,133,134,135,136,137,202,203,204,205,206,207, /* Cx */
+ 208,145,146,147,148,149,150,151,152,153,218,219,220,221,222,223, /* Dx */
+ 224,225,162,163,164,165,166,167,168,169,234,235,236,237,238,239, /* Ex */
+ 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255, /* Fx */
+#endif
+/* All of the upper-to-lower conversion data is above. The following
+** 18 integers are completely unrelated. They are appended to the
+** sqlite3UpperToLower[] array to avoid UBSAN warnings. Here's what is
+** going on:
+**
+** The SQL comparison operators (<>, =, >, <=, <, and >=) are implemented
+** by invoking sqlite3MemCompare(A,B) which compares values A and B and
+** returns negative, zero, or positive if A is less then, equal to, or
+** greater than B, respectively. Then the true false results is found by
+** consulting sqlite3aLTb[opcode], sqlite3aEQb[opcode], or
+** sqlite3aGTb[opcode] depending on whether the result of compare(A,B)
+** is negative, zero, or positive, where opcode is the specific opcode.
+** The only works because the comparison opcodes are consecutive and in
+** this order: NE EQ GT LE LT GE. Various assert()s throughout the code
+** ensure that is the case.
+**
+** These elements must be appended to another array. Otherwise the
+** index (here shown as [256-OP_Ne]) would be out-of-bounds and thus
+** be undefined behavior. That's goofy, but the C-standards people thought
+** it was a good idea, so here we are.
+*/
+/* NE EQ GT LE LT GE */
+ 1, 0, 0, 1, 1, 0, /* aLTb[]: Use when compare(A,B) less than zero */
+ 0, 1, 0, 1, 0, 1, /* aEQb[]: Use when compare(A,B) equals zero */
+ 1, 0, 1, 0, 0, 1 /* aGTb[]: Use when compare(A,B) greater than zero*/
+};
+SQLITE_PRIVATE const unsigned char *sqlite3aLTb = &sqlite3UpperToLower[256-OP_Ne];
+SQLITE_PRIVATE const unsigned char *sqlite3aEQb = &sqlite3UpperToLower[256+6-OP_Ne];
+SQLITE_PRIVATE const unsigned char *sqlite3aGTb = &sqlite3UpperToLower[256+12-OP_Ne];
+
+/*
+** The following 256 byte lookup table is used to support SQLites built-in
+** equivalents to the following standard library functions:
+**
+** isspace() 0x01
+** isalpha() 0x02
+** isdigit() 0x04
+** isalnum() 0x06
+** isxdigit() 0x08
+** toupper() 0x20
+** SQLite identifier character 0x40 $, _, or non-ascii
+** Quote character 0x80
+**
+** Bit 0x20 is set if the mapped character requires translation to upper
+** case. i.e. if the character is a lower-case ASCII character.
+** If x is a lower-case ASCII character, then its upper-case equivalent
+** is (x - 0x20). Therefore toupper() can be implemented as:
+**
+** (x & ~(map[x]&0x20))
+**
+** The equivalent of tolower() is implemented using the sqlite3UpperToLower[]
+** array. tolower() is used more often than toupper() by SQLite.
+**
+** Bit 0x40 is set if the character is non-alphanumeric and can be used in an
+** SQLite identifier. Identifiers are alphanumerics, "_", "$", and any
+** non-ASCII UTF character. Hence the test for whether or not a character is
+** part of an identifier is 0x46.
+*/
+SQLITE_PRIVATE const unsigned char sqlite3CtypeMap[256] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00..07 ........ */
+ 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, /* 08..0f ........ */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 10..17 ........ */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 18..1f ........ */
+ 0x01, 0x00, 0x80, 0x00, 0x40, 0x00, 0x00, 0x80, /* 20..27 !"#$%&' */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 28..2f ()*+,-./ */
+ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, /* 30..37 01234567 */
+ 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 38..3f 89:;<=>? */
+
+ 0x00, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x02, /* 40..47 @ABCDEFG */
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, /* 48..4f HIJKLMNO */
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, /* 50..57 PQRSTUVW */
+ 0x02, 0x02, 0x02, 0x80, 0x00, 0x00, 0x00, 0x40, /* 58..5f XYZ[\]^_ */
+ 0x80, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x22, /* 60..67 `abcdefg */
+ 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, /* 68..6f hijklmno */
+ 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, /* 70..77 pqrstuvw */
+ 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, /* 78..7f xyz{|}~. */
+
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* 80..87 ........ */
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* 88..8f ........ */
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* 90..97 ........ */
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* 98..9f ........ */
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* a0..a7 ........ */
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* a8..af ........ */
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* b0..b7 ........ */
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* b8..bf ........ */
+
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* c0..c7 ........ */
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* c8..cf ........ */
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* d0..d7 ........ */
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* d8..df ........ */
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* e0..e7 ........ */
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* e8..ef ........ */
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* f0..f7 ........ */
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 /* f8..ff ........ */
+};
+
+/* EVIDENCE-OF: R-02982-34736 In order to maintain full backwards
+** compatibility for legacy applications, the URI filename capability is
+** disabled by default.
+**
+** EVIDENCE-OF: R-38799-08373 URI filenames can be enabled or disabled
+** using the SQLITE_USE_URI=1 or SQLITE_USE_URI=0 compile-time options.
+**
+** EVIDENCE-OF: R-43642-56306 By default, URI handling is globally
+** disabled. The default value may be changed by compiling with the
+** SQLITE_USE_URI symbol defined.
+*/
+#ifndef SQLITE_USE_URI
+# define SQLITE_USE_URI 0
+#endif
+
+/* EVIDENCE-OF: R-38720-18127 The default setting is determined by the
+** SQLITE_ALLOW_COVERING_INDEX_SCAN compile-time option, or is "on" if
+** that compile-time option is omitted.
+*/
+#if !defined(SQLITE_ALLOW_COVERING_INDEX_SCAN)
+# define SQLITE_ALLOW_COVERING_INDEX_SCAN 1
+#else
+# if !SQLITE_ALLOW_COVERING_INDEX_SCAN
+# error "Compile-time disabling of covering index scan using the\
+ -DSQLITE_ALLOW_COVERING_INDEX_SCAN=0 option is deprecated.\
+ Contact SQLite developers if this is a problem for you, and\
+ delete this #error macro to continue with your build."
+# endif
+#endif
+
+/* The minimum PMA size is set to this value multiplied by the database
+** page size in bytes.
+*/
+#ifndef SQLITE_SORTER_PMASZ
+# define SQLITE_SORTER_PMASZ 250
+#endif
+
+/* Statement journals spill to disk when their size exceeds the following
+** threshold (in bytes). 0 means that statement journals are created and
+** written to disk immediately (the default behavior for SQLite versions
+** before 3.12.0). -1 means always keep the entire statement journal in
+** memory. (The statement journal is also always held entirely in memory
+** if journal_mode=MEMORY or if temp_store=MEMORY, regardless of this
+** setting.)
+*/
+#ifndef SQLITE_STMTJRNL_SPILL
+# define SQLITE_STMTJRNL_SPILL (64*1024)
+#endif
+
+/*
+** The default lookaside-configuration, the format "SZ,N". SZ is the
+** number of bytes in each lookaside slot (should be a multiple of 8)
+** and N is the number of slots. The lookaside-configuration can be
+** changed as start-time using sqlite3_config(SQLITE_CONFIG_LOOKASIDE)
+** or at run-time for an individual database connection using
+** sqlite3_db_config(db, SQLITE_DBCONFIG_LOOKASIDE);
+**
+** With the two-size-lookaside enhancement, less lookaside is required.
+** The default configuration of 1200,40 actually provides 30 1200-byte slots
+** and 93 128-byte slots, which is more lookaside than is available
+** using the older 1200,100 configuration without two-size-lookaside.
+*/
+#ifndef SQLITE_DEFAULT_LOOKASIDE
+# ifdef SQLITE_OMIT_TWOSIZE_LOOKASIDE
+# define SQLITE_DEFAULT_LOOKASIDE 1200,100 /* 120KB of memory */
+# else
+# define SQLITE_DEFAULT_LOOKASIDE 1200,40 /* 48KB of memory */
+# endif
+#endif
+
+
+/* The default maximum size of an in-memory database created using
+** sqlite3_deserialize()
+*/
+#ifndef SQLITE_MEMDB_DEFAULT_MAXSIZE
+# define SQLITE_MEMDB_DEFAULT_MAXSIZE 1073741824
+#endif
+
+/*
+** The following singleton contains the global configuration for
+** the SQLite library.
+*/
+SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config = {
+ SQLITE_DEFAULT_MEMSTATUS, /* bMemstat */
+ 1, /* bCoreMutex */
+ SQLITE_THREADSAFE==1, /* bFullMutex */
+ SQLITE_USE_URI, /* bOpenUri */
+ SQLITE_ALLOW_COVERING_INDEX_SCAN, /* bUseCis */
+ 0, /* bSmallMalloc */
+ 1, /* bExtraSchemaChecks */
+#ifdef SQLITE_DEBUG
+ 0, /* bJsonSelfcheck */
+#endif
+ 0x7ffffffe, /* mxStrlen */
+ 0, /* neverCorrupt */
+ SQLITE_DEFAULT_LOOKASIDE, /* szLookaside, nLookaside */
+ SQLITE_STMTJRNL_SPILL, /* nStmtSpill */
+ {0,0,0,0,0,0,0,0}, /* m */
+ {0,0,0,0,0,0,0,0,0}, /* mutex */
+ {0,0,0,0,0,0,0,0,0,0,0,0,0},/* pcache2 */
+ (void*)0, /* pHeap */
+ 0, /* nHeap */
+ 0, 0, /* mnHeap, mxHeap */
+ SQLITE_DEFAULT_MMAP_SIZE, /* szMmap */
+ SQLITE_MAX_MMAP_SIZE, /* mxMmap */
+ (void*)0, /* pPage */
+ 0, /* szPage */
+ SQLITE_DEFAULT_PCACHE_INITSZ, /* nPage */
+ 0, /* mxParserStack */
+ 0, /* sharedCacheEnabled */
+ SQLITE_SORTER_PMASZ, /* szPma */
+ /* All the rest should always be initialized to zero */
+ 0, /* isInit */
+ 0, /* inProgress */
+ 0, /* isMutexInit */
+ 0, /* isMallocInit */
+ 0, /* isPCacheInit */
+ 0, /* nRefInitMutex */
+ 0, /* pInitMutex */
+ 0, /* xLog */
+ 0, /* pLogArg */
+#ifdef SQLITE_ENABLE_SQLLOG
+ 0, /* xSqllog */
+ 0, /* pSqllogArg */
+#endif
+#ifdef SQLITE_VDBE_COVERAGE
+ 0, /* xVdbeBranch */
+ 0, /* pVbeBranchArg */
+#endif
+#ifndef SQLITE_OMIT_DESERIALIZE
+ SQLITE_MEMDB_DEFAULT_MAXSIZE, /* mxMemdbSize */
+#endif
+#ifndef SQLITE_UNTESTABLE
+ 0, /* xTestCallback */
+#endif
+#ifdef SQLITE_ALLOW_ROWID_IN_VIEW
+ 0, /* mNoVisibleRowid. 0 == allow rowid-in-view */
+#endif
+ 0, /* bLocaltimeFault */
+ 0, /* xAltLocaltime */
+ 0x7ffffffe, /* iOnceResetThreshold */
+ SQLITE_DEFAULT_SORTERREF_SIZE, /* szSorterRef */
+ 0, /* iPrngSeed */
+#ifdef SQLITE_DEBUG
+ {0,0,0,0,0,0}, /* aTune */
+#endif
+};
+
+/*
+** Hash table for global functions - functions common to all
+** database connections. After initialization, this table is
+** read-only.
+*/
+SQLITE_PRIVATE FuncDefHash sqlite3BuiltinFunctions;
+
+#if defined(SQLITE_COVERAGE_TEST) || defined(SQLITE_DEBUG)
+/*
+** Counter used for coverage testing. Does not come into play for
+** release builds.
+**
+** Access to this global variable is not mutex protected. This might
+** result in TSAN warnings. But as the variable does not exist in
+** release builds, that should not be a concern.
+*/
+SQLITE_PRIVATE unsigned int sqlite3CoverageCounter;
+#endif /* SQLITE_COVERAGE_TEST || SQLITE_DEBUG */
+
+#ifdef VDBE_PROFILE
+/*
+** The following performance counter can be used in place of
+** sqlite3Hwtime() for profiling. This is a no-op on standard builds.
+*/
+SQLITE_PRIVATE sqlite3_uint64 sqlite3NProfileCnt = 0;
+#endif
+
+/*
+** The value of the "pending" byte must be 0x40000000 (1 byte past the
+** 1-gibabyte boundary) in a compatible database. SQLite never uses
+** the database page that contains the pending byte. It never attempts
+** to read or write that page. The pending byte page is set aside
+** for use by the VFS layers as space for managing file locks.
+**
+** During testing, it is often desirable to move the pending byte to
+** a different position in the file. This allows code that has to
+** deal with the pending byte to run on files that are much smaller
+** than 1 GiB. The sqlite3_test_control() interface can be used to
+** move the pending byte.
+**
+** IMPORTANT: Changing the pending byte to any value other than
+** 0x40000000 results in an incompatible database file format!
+** Changing the pending byte during operation will result in undefined
+** and incorrect behavior.
+*/
+#ifndef SQLITE_OMIT_WSD
+SQLITE_PRIVATE int sqlite3PendingByte = 0x40000000;
+#endif
+
+/*
+** Tracing flags set by SQLITE_TESTCTRL_TRACEFLAGS.
+*/
+SQLITE_PRIVATE u32 sqlite3TreeTrace = 0;
+SQLITE_PRIVATE u32 sqlite3WhereTrace = 0;
+
+/* #include "opcodes.h" */
+/*
+** Properties of opcodes. The OPFLG_INITIALIZER macro is
+** created by mkopcodeh.awk during compilation. Data is obtained
+** from the comments following the "case OP_xxxx:" statements in
+** the vdbe.c file.
+*/
+SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[] = OPFLG_INITIALIZER;
+
+/*
+** Name of the default collating sequence
+*/
+SQLITE_PRIVATE const char sqlite3StrBINARY[] = "BINARY";
+
+/*
+** Standard typenames. These names must match the COLTYPE_* definitions.
+** Adjust the SQLITE_N_STDTYPE value if adding or removing entries.
+**
+** sqlite3StdType[] The actual names of the datatypes.
+**
+** sqlite3StdTypeLen[] The length (in bytes) of each entry
+** in sqlite3StdType[].
+**
+** sqlite3StdTypeAffinity[] The affinity associated with each entry
+** in sqlite3StdType[].
+*/
+SQLITE_PRIVATE const unsigned char sqlite3StdTypeLen[] = { 3, 4, 3, 7, 4, 4 };
+SQLITE_PRIVATE const char sqlite3StdTypeAffinity[] = {
+ SQLITE_AFF_NUMERIC,
+ SQLITE_AFF_BLOB,
+ SQLITE_AFF_INTEGER,
+ SQLITE_AFF_INTEGER,
+ SQLITE_AFF_REAL,
+ SQLITE_AFF_TEXT
+};
+SQLITE_PRIVATE const char *sqlite3StdType[] = {
+ "ANY",
+ "BLOB",
+ "INT",
+ "INTEGER",
+ "REAL",
+ "TEXT"
+};
+
+/************** End of global.c **********************************************/
+/************** Begin file status.c ******************************************/
+/*
+** 2008 June 18
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+**
+** This module implements the sqlite3_status() interface and related
+** functionality.
+*/
+/* #include "sqliteInt.h" */
+/************** Include vdbeInt.h in the middle of status.c ******************/
+/************** Begin file vdbeInt.h *****************************************/
+/*
+** 2003 September 6
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This is the header file for information that is private to the
+** VDBE. This information used to all be at the top of the single
+** source code file "vdbe.c". When that file became too big (over
+** 6000 lines long) it was split up into several smaller files and
+** this header information was factored out.
+*/
+#ifndef SQLITE_VDBEINT_H
+#define SQLITE_VDBEINT_H
+
+/*
+** The maximum number of times that a statement will try to reparse
+** itself before giving up and returning SQLITE_SCHEMA.
+*/
+#ifndef SQLITE_MAX_SCHEMA_RETRY
+# define SQLITE_MAX_SCHEMA_RETRY 50
+#endif
+
+/*
+** VDBE_DISPLAY_P4 is true or false depending on whether or not the
+** "explain" P4 display logic is enabled.
+*/
+#if !defined(SQLITE_OMIT_EXPLAIN) || !defined(NDEBUG) \
+ || defined(VDBE_PROFILE) || defined(SQLITE_DEBUG) \
+ || defined(SQLITE_ENABLE_BYTECODE_VTAB)
+# define VDBE_DISPLAY_P4 1
+#else
+# define VDBE_DISPLAY_P4 0
+#endif
+
+/*
+** SQL is translated into a sequence of instructions to be
+** executed by a virtual machine. Each instruction is an instance
+** of the following structure.
+*/
+typedef struct VdbeOp Op;
+
+/*
+** Boolean values
+*/
+typedef unsigned Bool;
+
+/* Opaque type used by code in vdbesort.c */
+typedef struct VdbeSorter VdbeSorter;
+
+/* Elements of the linked list at Vdbe.pAuxData */
+typedef struct AuxData AuxData;
+
+/* A cache of large TEXT or BLOB values in a VdbeCursor */
+typedef struct VdbeTxtBlbCache VdbeTxtBlbCache;
+
+/* Types of VDBE cursors */
+#define CURTYPE_BTREE 0
+#define CURTYPE_SORTER 1
+#define CURTYPE_VTAB 2
+#define CURTYPE_PSEUDO 3
+
+/*
+** A VdbeCursor is an superclass (a wrapper) for various cursor objects:
+**
+** * A b-tree cursor
+** - In the main database or in an ephemeral database
+** - On either an index or a table
+** * A sorter
+** * A virtual table
+** * A one-row "pseudotable" stored in a single register
+*/
+typedef struct VdbeCursor VdbeCursor;
+struct VdbeCursor {
+ u8 eCurType; /* One of the CURTYPE_* values above */
+ i8 iDb; /* Index of cursor database in db->aDb[] */
+ u8 nullRow; /* True if pointing to a row with no data */
+ u8 deferredMoveto; /* A call to sqlite3BtreeMoveto() is needed */
+ u8 isTable; /* True for rowid tables. False for indexes */
+#ifdef SQLITE_DEBUG
+ u8 seekOp; /* Most recent seek operation on this cursor */
+ u8 wrFlag; /* The wrFlag argument to sqlite3BtreeCursor() */
+#endif
+ Bool isEphemeral:1; /* True for an ephemeral table */
+ Bool useRandomRowid:1; /* Generate new record numbers semi-randomly */
+ Bool isOrdered:1; /* True if the table is not BTREE_UNORDERED */
+ Bool noReuse:1; /* OpenEphemeral may not reuse this cursor */
+ Bool colCache:1; /* pCache pointer is initialized and non-NULL */
+ u16 seekHit; /* See the OP_SeekHit and OP_IfNoHope opcodes */
+ union { /* pBtx for isEphermeral. pAltMap otherwise */
+ Btree *pBtx; /* Separate file holding temporary table */
+ u32 *aAltMap; /* Mapping from table to index column numbers */
+ } ub;
+ i64 seqCount; /* Sequence counter */
+
+ /* Cached OP_Column parse information is only valid if cacheStatus matches
+ ** Vdbe.cacheCtr. Vdbe.cacheCtr will never take on the value of
+ ** CACHE_STALE (0) and so setting cacheStatus=CACHE_STALE guarantees that
+ ** the cache is out of date. */
+ u32 cacheStatus; /* Cache is valid if this matches Vdbe.cacheCtr */
+ int seekResult; /* Result of previous sqlite3BtreeMoveto() or 0
+ ** if there have been no prior seeks on the cursor. */
+ /* seekResult does not distinguish between "no seeks have ever occurred
+ ** on this cursor" and "the most recent seek was an exact match".
+ ** For CURTYPE_PSEUDO, seekResult is the register holding the record */
+
+ /* When a new VdbeCursor is allocated, only the fields above are zeroed.
+ ** The fields that follow are uninitialized, and must be individually
+ ** initialized prior to first use. */
+ VdbeCursor *pAltCursor; /* Associated index cursor from which to read */
+ union {
+ BtCursor *pCursor; /* CURTYPE_BTREE or _PSEUDO. Btree cursor */
+ sqlite3_vtab_cursor *pVCur; /* CURTYPE_VTAB. Vtab cursor */
+ VdbeSorter *pSorter; /* CURTYPE_SORTER. Sorter object */
+ } uc;
+ KeyInfo *pKeyInfo; /* Info about index keys needed by index cursors */
+ u32 iHdrOffset; /* Offset to next unparsed byte of the header */
+ Pgno pgnoRoot; /* Root page of the open btree cursor */
+ i16 nField; /* Number of fields in the header */
+ u16 nHdrParsed; /* Number of header fields parsed so far */
+ i64 movetoTarget; /* Argument to the deferred sqlite3BtreeMoveto() */
+ u32 *aOffset; /* Pointer to aType[nField] */
+ const u8 *aRow; /* Data for the current row, if all on one page */
+ u32 payloadSize; /* Total number of bytes in the record */
+ u32 szRow; /* Byte available in aRow */
+#ifdef SQLITE_ENABLE_COLUMN_USED_MASK
+ u64 maskUsed; /* Mask of columns used by this cursor */
+#endif
+ VdbeTxtBlbCache *pCache; /* Cache of large TEXT or BLOB values */
+
+ /* 2*nField extra array elements allocated for aType[], beyond the one
+ ** static element declared in the structure. nField total array slots for
+ ** aType[] and nField+1 array slots for aOffset[] */
+ u32 aType[1]; /* Type values record decode. MUST BE LAST */
+};
+
+/* Return true if P is a null-only cursor
+*/
+#define IsNullCursor(P) \
+ ((P)->eCurType==CURTYPE_PSEUDO && (P)->nullRow && (P)->seekResult==0)
+
+/*
+** A value for VdbeCursor.cacheStatus that means the cache is always invalid.
+*/
+#define CACHE_STALE 0
+
+/*
+** Large TEXT or BLOB values can be slow to load, so we want to avoid
+** loading them more than once. For that reason, large TEXT and BLOB values
+** can be stored in a cache defined by this object, and attached to the
+** VdbeCursor using the pCache field.
+*/
+struct VdbeTxtBlbCache {
+ char *pCValue; /* A RCStr buffer to hold the value */
+ i64 iOffset; /* File offset of the row being cached */
+ int iCol; /* Column for which the cache is valid */
+ u32 cacheStatus; /* Vdbe.cacheCtr value */
+ u32 colCacheCtr; /* Column cache counter */
+};
+
+/*
+** When a sub-program is executed (OP_Program), a structure of this type
+** is allocated to store the current value of the program counter, as
+** well as the current memory cell array and various other frame specific
+** values stored in the Vdbe struct. When the sub-program is finished,
+** these values are copied back to the Vdbe from the VdbeFrame structure,
+** restoring the state of the VM to as it was before the sub-program
+** began executing.
+**
+** The memory for a VdbeFrame object is allocated and managed by a memory
+** cell in the parent (calling) frame. When the memory cell is deleted or
+** overwritten, the VdbeFrame object is not freed immediately. Instead, it
+** is linked into the Vdbe.pDelFrame list. The contents of the Vdbe.pDelFrame
+** list is deleted when the VM is reset in VdbeHalt(). The reason for doing
+** this instead of deleting the VdbeFrame immediately is to avoid recursive
+** calls to sqlite3VdbeMemRelease() when the memory cells belonging to the
+** child frame are released.
+**
+** The currently executing frame is stored in Vdbe.pFrame. Vdbe.pFrame is
+** set to NULL if the currently executing frame is the main program.
+*/
+typedef struct VdbeFrame VdbeFrame;
+struct VdbeFrame {
+ Vdbe *v; /* VM this frame belongs to */
+ VdbeFrame *pParent; /* Parent of this frame, or NULL if parent is main */
+ Op *aOp; /* Program instructions for parent frame */
+ Mem *aMem; /* Array of memory cells for parent frame */
+ VdbeCursor **apCsr; /* Array of Vdbe cursors for parent frame */
+ u8 *aOnce; /* Bitmask used by OP_Once */
+ void *token; /* Copy of SubProgram.token */
+ i64 lastRowid; /* Last insert rowid (sqlite3.lastRowid) */
+ AuxData *pAuxData; /* Linked list of auxdata allocations */
+#if SQLITE_DEBUG
+ u32 iFrameMagic; /* magic number for sanity checking */
+#endif
+ int nCursor; /* Number of entries in apCsr */
+ int pc; /* Program Counter in parent (calling) frame */
+ int nOp; /* Size of aOp array */
+ int nMem; /* Number of entries in aMem */
+ int nChildMem; /* Number of memory cells for child frame */
+ int nChildCsr; /* Number of cursors for child frame */
+ i64 nChange; /* Statement changes (Vdbe.nChange) */
+ i64 nDbChange; /* Value of db->nChange */
+};
+
+/* Magic number for sanity checking on VdbeFrame objects */
+#define SQLITE_FRAME_MAGIC 0x879fb71e
+
+/*
+** Return a pointer to the array of registers allocated for use
+** by a VdbeFrame.
+*/
+#define VdbeFrameMem(p) ((Mem *)&((u8 *)p)[ROUND8(sizeof(VdbeFrame))])
+
+/*
+** Internally, the vdbe manipulates nearly all SQL values as Mem
+** structures. Each Mem struct may cache multiple representations (string,
+** integer etc.) of the same value.
+*/
+struct sqlite3_value {
+ union MemValue {
+ double r; /* Real value used when MEM_Real is set in flags */
+ i64 i; /* Integer value used when MEM_Int is set in flags */
+ int nZero; /* Extra zero bytes when MEM_Zero and MEM_Blob set */
+ const char *zPType; /* Pointer type when MEM_Term|MEM_Subtype|MEM_Null */
+ FuncDef *pDef; /* Used only when flags==MEM_Agg */
+ } u;
+ char *z; /* String or BLOB value */
+ int n; /* Number of characters in string value, excluding '\0' */
+ u16 flags; /* Some combination of MEM_Null, MEM_Str, MEM_Dyn, etc. */
+ u8 enc; /* SQLITE_UTF8, SQLITE_UTF16BE, SQLITE_UTF16LE */
+ u8 eSubtype; /* Subtype for this value */
+ /* ShallowCopy only needs to copy the information above */
+ sqlite3 *db; /* The associated database connection */
+ int szMalloc; /* Size of the zMalloc allocation */
+ u32 uTemp; /* Transient storage for serial_type in OP_MakeRecord */
+ char *zMalloc; /* Space to hold MEM_Str or MEM_Blob if szMalloc>0 */
+ void (*xDel)(void*);/* Destructor for Mem.z - only valid if MEM_Dyn */
+#ifdef SQLITE_DEBUG
+ Mem *pScopyFrom; /* This Mem is a shallow copy of pScopyFrom */
+ u16 mScopyFlags; /* flags value immediately after the shallow copy */
+ u8 bScopy; /* The pScopyFrom of some other Mem *might* point here */
+#endif
+};
+
+/*
+** Size of struct Mem not including the Mem.zMalloc member or anything that
+** follows.
+*/
+#define MEMCELLSIZE offsetof(Mem,db)
+
+/* One or more of the following flags are set to indicate the
+** representations of the value stored in the Mem struct.
+**
+** * MEM_Null An SQL NULL value
+**
+** * MEM_Null|MEM_Zero An SQL NULL with the virtual table
+** UPDATE no-change flag set
+**
+** * MEM_Null|MEM_Term| An SQL NULL, but also contains a
+** MEM_Subtype pointer accessible using
+** sqlite3_value_pointer().
+**
+** * MEM_Null|MEM_Cleared Special SQL NULL that compares non-equal
+** to other NULLs even using the IS operator.
+**
+** * MEM_Str A string, stored in Mem.z with
+** length Mem.n. Zero-terminated if
+** MEM_Term is set. This flag is
+** incompatible with MEM_Blob and
+** MEM_Null, but can appear with MEM_Int,
+** MEM_Real, and MEM_IntReal.
+**
+** * MEM_Blob A blob, stored in Mem.z length Mem.n.
+** Incompatible with MEM_Str, MEM_Null,
+** MEM_Int, MEM_Real, and MEM_IntReal.
+**
+** * MEM_Blob|MEM_Zero A blob in Mem.z of length Mem.n plus
+** MEM.u.i extra 0x00 bytes at the end.
+**
+** * MEM_Int Integer stored in Mem.u.i.
+**
+** * MEM_Real Real stored in Mem.u.r.
+**
+** * MEM_IntReal Real stored as an integer in Mem.u.i.
+**
+** If the MEM_Null flag is set, then the value is an SQL NULL value.
+** For a pointer type created using sqlite3_bind_pointer() or
+** sqlite3_result_pointer() the MEM_Term and MEM_Subtype flags are also set.
+**
+** If the MEM_Str flag is set then Mem.z points at a string representation.
+** Usually this is encoded in the same unicode encoding as the main
+** database (see below for exceptions). If the MEM_Term flag is also
+** set, then the string is nul terminated. The MEM_Int and MEM_Real
+** flags may coexist with the MEM_Str flag.
+*/
+#define MEM_Undefined 0x0000 /* Value is undefined */
+#define MEM_Null 0x0001 /* Value is NULL (or a pointer) */
+#define MEM_Str 0x0002 /* Value is a string */
+#define MEM_Int 0x0004 /* Value is an integer */
+#define MEM_Real 0x0008 /* Value is a real number */
+#define MEM_Blob 0x0010 /* Value is a BLOB */
+#define MEM_IntReal 0x0020 /* MEM_Int that stringifies like MEM_Real */
+#define MEM_AffMask 0x003f /* Mask of affinity bits */
+
+/* Extra bits that modify the meanings of the core datatypes above
+*/
+#define MEM_FromBind 0x0040 /* Value originates from sqlite3_bind() */
+ /* 0x0080 // Available */
+#define MEM_Cleared 0x0100 /* NULL set by OP_Null, not from data */
+#define MEM_Term 0x0200 /* String in Mem.z is zero terminated */
+#define MEM_Zero 0x0400 /* Mem.i contains count of 0s appended to blob */
+#define MEM_Subtype 0x0800 /* Mem.eSubtype is valid */
+#define MEM_TypeMask 0x0dbf /* Mask of type bits */
+
+/* Bits that determine the storage for Mem.z for a string or blob or
+** aggregate accumulator.
+*/
+#define MEM_Dyn 0x1000 /* Need to call Mem.xDel() on Mem.z */
+#define MEM_Static 0x2000 /* Mem.z points to a static string */
+#define MEM_Ephem 0x4000 /* Mem.z points to an ephemeral string */
+#define MEM_Agg 0x8000 /* Mem.z points to an agg function context */
+
+/* Return TRUE if Mem X contains dynamically allocated content - anything
+** that needs to be deallocated to avoid a leak.
+*/
+#define VdbeMemDynamic(X) \
+ (((X)->flags&(MEM_Agg|MEM_Dyn))!=0)
+
+/*
+** Clear any existing type flags from a Mem and replace them with f
+*/
+#define MemSetTypeFlag(p, f) \
+ ((p)->flags = ((p)->flags&~(MEM_TypeMask|MEM_Zero))|f)
+
+/*
+** True if Mem X is a NULL-nochng type.
+*/
+#define MemNullNochng(X) \
+ (((X)->flags&MEM_TypeMask)==(MEM_Null|MEM_Zero) \
+ && (X)->n==0 && (X)->u.nZero==0)
+
+/*
+** Return true if a memory cell has been initialized and is valid.
+** is for use inside assert() statements only.
+**
+** A Memory cell is initialized if at least one of the
+** MEM_Null, MEM_Str, MEM_Int, MEM_Real, MEM_Blob, or MEM_IntReal bits
+** is set. It is "undefined" if all those bits are zero.
+*/
+#ifdef SQLITE_DEBUG
+#define memIsValid(M) ((M)->flags & MEM_AffMask)!=0
+#endif
+
+/*
+** Each auxiliary data pointer stored by a user defined function
+** implementation calling sqlite3_set_auxdata() is stored in an instance
+** of this structure. All such structures associated with a single VM
+** are stored in a linked list headed at Vdbe.pAuxData. All are destroyed
+** when the VM is halted (if not before).
+*/
+struct AuxData {
+ int iAuxOp; /* Instruction number of OP_Function opcode */
+ int iAuxArg; /* Index of function argument. */
+ void *pAux; /* Aux data pointer */
+ void (*xDeleteAux)(void*); /* Destructor for the aux data */
+ AuxData *pNextAux; /* Next element in list */
+};
+
+/*
+** The "context" argument for an installable function. A pointer to an
+** instance of this structure is the first argument to the routines used
+** implement the SQL functions.
+**
+** There is a typedef for this structure in sqlite.h. So all routines,
+** even the public interface to SQLite, can use a pointer to this structure.
+** But this file is the only place where the internal details of this
+** structure are known.
+**
+** This structure is defined inside of vdbeInt.h because it uses substructures
+** (Mem) which are only defined there.
+*/
+struct sqlite3_context {
+ Mem *pOut; /* The return value is stored here */
+ FuncDef *pFunc; /* Pointer to function information */
+ Mem *pMem; /* Memory cell used to store aggregate context */
+ Vdbe *pVdbe; /* The VM that owns this context */
+ int iOp; /* Instruction number of OP_Function */
+ int isError; /* Error code returned by the function. */
+ u8 enc; /* Encoding to use for results */
+ u8 skipFlag; /* Skip accumulator loading if true */
+ u16 argc; /* Number of arguments */
+ sqlite3_value *argv[1]; /* Argument set */
+};
+
+/* A bitfield type for use inside of structures. Always follow with :N where
+** N is the number of bits.
+*/
+typedef unsigned bft; /* Bit Field Type */
+
+/* The ScanStatus object holds a single value for the
+** sqlite3_stmt_scanstatus() interface.
+**
+** aAddrRange[]:
+** This array is used by ScanStatus elements associated with EQP
+** notes that make an SQLITE_SCANSTAT_NCYCLE value available. It is
+** an array of up to 3 ranges of VM addresses for which the Vdbe.anCycle[]
+** values should be summed to calculate the NCYCLE value. Each pair of
+** integer addresses is a start and end address (both inclusive) for a range
+** instructions. A start value of 0 indicates an empty range.
+*/
+typedef struct ScanStatus ScanStatus;
+struct ScanStatus {
+ int addrExplain; /* OP_Explain for loop */
+ int aAddrRange[6];
+ int addrLoop; /* Address of "loops" counter */
+ int addrVisit; /* Address of "rows visited" counter */
+ int iSelectID; /* The "Select-ID" for this loop */
+ LogEst nEst; /* Estimated output rows per loop */
+ char *zName; /* Name of table or index */
+};
+
+/* The DblquoteStr object holds the text of a double-quoted
+** string for a prepared statement. A linked list of these objects
+** is constructed during statement parsing and is held on Vdbe.pDblStr.
+** When computing a normalized SQL statement for an SQL statement, that
+** list is consulted for each double-quoted identifier to see if the
+** identifier should really be a string literal.
+*/
+typedef struct DblquoteStr DblquoteStr;
+struct DblquoteStr {
+ DblquoteStr *pNextStr; /* Next string literal in the list */
+ char z[8]; /* Dequoted value for the string */
+};
+
+/*
+** An instance of the virtual machine. This structure contains the complete
+** state of the virtual machine.
+**
+** The "sqlite3_stmt" structure pointer that is returned by sqlite3_prepare()
+** is really a pointer to an instance of this structure.
+*/
+struct Vdbe {
+ sqlite3 *db; /* The database connection that owns this statement */
+ Vdbe **ppVPrev,*pVNext; /* Linked list of VDBEs with the same Vdbe.db */
+ Parse *pParse; /* Parsing context used to create this Vdbe */
+ ynVar nVar; /* Number of entries in aVar[] */
+ int nMem; /* Number of memory locations currently allocated */
+ int nCursor; /* Number of slots in apCsr[] */
+ u32 cacheCtr; /* VdbeCursor row cache generation counter */
+ int pc; /* The program counter */
+ int rc; /* Value to return */
+ i64 nChange; /* Number of db changes made since last reset */
+ int iStatement; /* Statement number (or 0 if has no opened stmt) */
+ i64 iCurrentTime; /* Value of julianday('now') for this statement */
+ i64 nFkConstraint; /* Number of imm. FK constraints this VM */
+ i64 nStmtDefCons; /* Number of def. constraints when stmt started */
+ i64 nStmtDefImmCons; /* Number of def. imm constraints when stmt started */
+ Mem *aMem; /* The memory locations */
+ Mem **apArg; /* Arguments to currently executing user function */
+ VdbeCursor **apCsr; /* One element of this array for each open cursor */
+ Mem *aVar; /* Values for the OP_Variable opcode. */
+
+ /* When allocating a new Vdbe object, all of the fields below should be
+ ** initialized to zero or NULL */
+
+ Op *aOp; /* Space to hold the virtual machine's program */
+ int nOp; /* Number of instructions in the program */
+ int nOpAlloc; /* Slots allocated for aOp[] */
+ Mem *aColName; /* Column names to return */
+ Mem *pResultRow; /* Current output row */
+ char *zErrMsg; /* Error message written here */
+ VList *pVList; /* Name of variables */
+#ifndef SQLITE_OMIT_TRACE
+ i64 startTime; /* Time when query started - used for profiling */
+#endif
+#ifdef SQLITE_DEBUG
+ int rcApp; /* errcode set by sqlite3_result_error_code() */
+ u32 nWrite; /* Number of write operations that have occurred */
+#endif
+ u16 nResColumn; /* Number of columns in one row of the result set */
+ u16 nResAlloc; /* Column slots allocated to aColName[] */
+ u8 errorAction; /* Recovery action to do in case of an error */
+ u8 minWriteFileFormat; /* Minimum file format for writable database files */
+ u8 prepFlags; /* SQLITE_PREPARE_* flags */
+ u8 eVdbeState; /* On of the VDBE_*_STATE values */
+ bft expired:2; /* 1: recompile VM immediately 2: when convenient */
+ bft explain:2; /* 0: normal, 1: EXPLAIN, 2: EXPLAIN QUERY PLAN */
+ bft changeCntOn:1; /* True to update the change-counter */
+ bft usesStmtJournal:1; /* True if uses a statement journal */
+ bft readOnly:1; /* True for statements that do not write */
+ bft bIsReader:1; /* True for statements that read */
+ bft haveEqpOps:1; /* Bytecode supports EXPLAIN QUERY PLAN */
+ yDbMask btreeMask; /* Bitmask of db->aDb[] entries referenced */
+ yDbMask lockMask; /* Subset of btreeMask that requires a lock */
+ u32 aCounter[9]; /* Counters used by sqlite3_stmt_status() */
+ char *zSql; /* Text of the SQL statement that generated this */
+#ifdef SQLITE_ENABLE_NORMALIZE
+ char *zNormSql; /* Normalization of the associated SQL statement */
+ DblquoteStr *pDblStr; /* List of double-quoted string literals */
+#endif
+ void *pFree; /* Free this when deleting the vdbe */
+ VdbeFrame *pFrame; /* Parent frame */
+ VdbeFrame *pDelFrame; /* List of frame objects to free on VM reset */
+ int nFrame; /* Number of frames in pFrame list */
+ u32 expmask; /* Binding to these vars invalidates VM */
+ SubProgram *pProgram; /* Linked list of all sub-programs used by VM */
+ AuxData *pAuxData; /* Linked list of auxdata allocations */
+#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
+ int nScan; /* Entries in aScan[] */
+ ScanStatus *aScan; /* Scan definitions for sqlite3_stmt_scanstatus() */
+#endif
+};
+
+/*
+** The following are allowed values for Vdbe.eVdbeState
+*/
+#define VDBE_INIT_STATE 0 /* Prepared statement under construction */
+#define VDBE_READY_STATE 1 /* Ready to run but not yet started */
+#define VDBE_RUN_STATE 2 /* Run in progress */
+#define VDBE_HALT_STATE 3 /* Finished. Need reset() or finalize() */
+
+/*
+** Structure used to store the context required by the
+** sqlite3_preupdate_*() API functions.
+*/
+struct PreUpdate {
+ Vdbe *v;
+ VdbeCursor *pCsr; /* Cursor to read old values from */
+ int op; /* One of SQLITE_INSERT, UPDATE, DELETE */
+ u8 *aRecord; /* old.* database record */
+ KeyInfo keyinfo;
+ UnpackedRecord *pUnpacked; /* Unpacked version of aRecord[] */
+ UnpackedRecord *pNewUnpacked; /* Unpacked version of new.* record */
+ int iNewReg; /* Register for new.* values */
+ int iBlobWrite; /* Value returned by preupdate_blobwrite() */
+ i64 iKey1; /* First key value passed to hook */
+ i64 iKey2; /* Second key value passed to hook */
+ Mem oldipk; /* Memory cell holding "old" IPK value */
+ Mem *aNew; /* Array of new.* values */
+ Table *pTab; /* Schema object being updated */
+ Index *pPk; /* PK index if pTab is WITHOUT ROWID */
+ sqlite3_value **apDflt; /* Array of default values, if required */
+};
+
+/*
+** An instance of this object is used to pass an vector of values into
+** OP_VFilter, the xFilter method of a virtual table. The vector is the
+** set of values on the right-hand side of an IN constraint.
+**
+** The value as passed into xFilter is an sqlite3_value with a "pointer"
+** type, such as is generated by sqlite3_result_pointer() and read by
+** sqlite3_value_pointer. Such values have MEM_Term|MEM_Subtype|MEM_Null
+** and a subtype of 'p'. The sqlite3_vtab_in_first() and _next() interfaces
+** know how to use this object to step through all the values in the
+** right operand of the IN constraint.
+*/
+typedef struct ValueList ValueList;
+struct ValueList {
+ BtCursor *pCsr; /* An ephemeral table holding all values */
+ sqlite3_value *pOut; /* Register to hold each decoded output value */
+};
+
+/* Size of content associated with serial types that fit into a
+** single-byte varint.
+*/
+#ifndef SQLITE_AMALGAMATION
+SQLITE_PRIVATE const u8 sqlite3SmallTypeSizes[];
+#endif
+
+/*
+** Function prototypes
+*/
+SQLITE_PRIVATE void sqlite3VdbeError(Vdbe*, const char *, ...);
+SQLITE_PRIVATE void sqlite3VdbeFreeCursor(Vdbe *, VdbeCursor*);
+SQLITE_PRIVATE void sqlite3VdbeFreeCursorNN(Vdbe*,VdbeCursor*);
+void sqliteVdbePopStack(Vdbe*,int);
+SQLITE_PRIVATE int SQLITE_NOINLINE sqlite3VdbeHandleMovedCursor(VdbeCursor *p);
+SQLITE_PRIVATE int SQLITE_NOINLINE sqlite3VdbeFinishMoveto(VdbeCursor*);
+SQLITE_PRIVATE int sqlite3VdbeCursorRestore(VdbeCursor*);
+SQLITE_PRIVATE u32 sqlite3VdbeSerialTypeLen(u32);
+SQLITE_PRIVATE u8 sqlite3VdbeOneByteSerialTypeLen(u8);
+#ifdef SQLITE_MIXED_ENDIAN_64BIT_FLOAT
+SQLITE_PRIVATE u64 sqlite3FloatSwap(u64 in);
+# define swapMixedEndianFloat(X) X = sqlite3FloatSwap(X)
+#else
+# define swapMixedEndianFloat(X)
+#endif
+SQLITE_PRIVATE void sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*);
+SQLITE_PRIVATE void sqlite3VdbeDeleteAuxData(sqlite3*, AuxData**, int, int);
+
+int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *);
+SQLITE_PRIVATE int sqlite3VdbeIdxKeyCompare(sqlite3*,VdbeCursor*,UnpackedRecord*,int*);
+SQLITE_PRIVATE int sqlite3VdbeIdxRowid(sqlite3*, BtCursor*, i64*);
+SQLITE_PRIVATE int sqlite3VdbeExec(Vdbe*);
+#if !defined(SQLITE_OMIT_EXPLAIN) || defined(SQLITE_ENABLE_BYTECODE_VTAB)
+SQLITE_PRIVATE int sqlite3VdbeNextOpcode(Vdbe*,Mem*,int,int*,int*,Op**);
+SQLITE_PRIVATE char *sqlite3VdbeDisplayP4(sqlite3*,Op*);
+#endif
+#if defined(SQLITE_ENABLE_EXPLAIN_COMMENTS)
+SQLITE_PRIVATE char *sqlite3VdbeDisplayComment(sqlite3*,const Op*,const char*);
+#endif
+#if !defined(SQLITE_OMIT_EXPLAIN)
+SQLITE_PRIVATE int sqlite3VdbeList(Vdbe*);
+#endif
+SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe*);
+SQLITE_PRIVATE int sqlite3VdbeChangeEncoding(Mem *, int);
+SQLITE_PRIVATE int sqlite3VdbeMemTooBig(Mem*);
+SQLITE_PRIVATE int sqlite3VdbeMemCopy(Mem*, const Mem*);
+SQLITE_PRIVATE void sqlite3VdbeMemShallowCopy(Mem*, const Mem*, int);
+SQLITE_PRIVATE void sqlite3VdbeMemMove(Mem*, Mem*);
+SQLITE_PRIVATE int sqlite3VdbeMemNulTerminate(Mem*);
+SQLITE_PRIVATE int sqlite3VdbeMemSetStr(Mem*, const char*, i64, u8, void(*)(void*));
+SQLITE_PRIVATE void sqlite3VdbeMemSetInt64(Mem*, i64);
+#ifdef SQLITE_OMIT_FLOATING_POINT
+# define sqlite3VdbeMemSetDouble sqlite3VdbeMemSetInt64
+#else
+SQLITE_PRIVATE void sqlite3VdbeMemSetDouble(Mem*, double);
+#endif
+SQLITE_PRIVATE void sqlite3VdbeMemSetPointer(Mem*, void*, const char*, void(*)(void*));
+SQLITE_PRIVATE void sqlite3VdbeMemInit(Mem*,sqlite3*,u16);
+SQLITE_PRIVATE void sqlite3VdbeMemSetNull(Mem*);
+#ifndef SQLITE_OMIT_INCRBLOB
+SQLITE_PRIVATE void sqlite3VdbeMemSetZeroBlob(Mem*,int);
+#else
+SQLITE_PRIVATE int sqlite3VdbeMemSetZeroBlob(Mem*,int);
+#endif
+#ifdef SQLITE_DEBUG
+SQLITE_PRIVATE int sqlite3VdbeMemIsRowSet(const Mem*);
+#endif
+SQLITE_PRIVATE int sqlite3VdbeMemSetRowSet(Mem*);
+SQLITE_PRIVATE void sqlite3VdbeMemZeroTerminateIfAble(Mem*);
+SQLITE_PRIVATE int sqlite3VdbeMemMakeWriteable(Mem*);
+SQLITE_PRIVATE int sqlite3VdbeMemStringify(Mem*, u8, u8);
+SQLITE_PRIVATE int sqlite3IntFloatCompare(i64,double);
+SQLITE_PRIVATE i64 sqlite3VdbeIntValue(const Mem*);
+SQLITE_PRIVATE int sqlite3VdbeMemIntegerify(Mem*);
+SQLITE_PRIVATE double sqlite3VdbeRealValue(Mem*);
+SQLITE_PRIVATE int sqlite3VdbeBooleanValue(Mem*, int ifNull);
+SQLITE_PRIVATE void sqlite3VdbeIntegerAffinity(Mem*);
+SQLITE_PRIVATE int sqlite3VdbeMemRealify(Mem*);
+SQLITE_PRIVATE int sqlite3VdbeMemNumerify(Mem*);
+SQLITE_PRIVATE int sqlite3VdbeMemCast(Mem*,u8,u8);
+SQLITE_PRIVATE int sqlite3VdbeMemFromBtree(BtCursor*,u32,u32,Mem*);
+SQLITE_PRIVATE int sqlite3VdbeMemFromBtreeZeroOffset(BtCursor*,u32,Mem*);
+SQLITE_PRIVATE void sqlite3VdbeMemRelease(Mem *p);
+SQLITE_PRIVATE void sqlite3VdbeMemReleaseMalloc(Mem*p);
+SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem*, FuncDef*);
+#ifndef SQLITE_OMIT_WINDOWFUNC
+SQLITE_PRIVATE int sqlite3VdbeMemAggValue(Mem*, Mem*, FuncDef*);
+#endif
+#if !defined(SQLITE_OMIT_EXPLAIN) || defined(SQLITE_ENABLE_BYTECODE_VTAB)
+SQLITE_PRIVATE const char *sqlite3OpcodeName(int);
+#endif
+SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve);
+SQLITE_PRIVATE int sqlite3VdbeMemClearAndResize(Mem *pMem, int n);
+SQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *, int);
+#ifdef SQLITE_DEBUG
+SQLITE_PRIVATE int sqlite3VdbeFrameIsValid(VdbeFrame*);
+#endif
+SQLITE_PRIVATE void sqlite3VdbeFrameMemDel(void*); /* Destructor on Mem */
+SQLITE_PRIVATE void sqlite3VdbeFrameDelete(VdbeFrame*); /* Actually deletes the Frame */
+SQLITE_PRIVATE int sqlite3VdbeFrameRestore(VdbeFrame *);
+#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
+SQLITE_PRIVATE void sqlite3VdbePreUpdateHook(
+ Vdbe*,VdbeCursor*,int,const char*,Table*,i64,int,int);
+#endif
+SQLITE_PRIVATE int sqlite3VdbeTransferError(Vdbe *p);
+
+SQLITE_PRIVATE int sqlite3VdbeSorterInit(sqlite3 *, int, VdbeCursor *);
+SQLITE_PRIVATE void sqlite3VdbeSorterReset(sqlite3 *, VdbeSorter *);
+SQLITE_PRIVATE void sqlite3VdbeSorterClose(sqlite3 *, VdbeCursor *);
+SQLITE_PRIVATE int sqlite3VdbeSorterRowkey(const VdbeCursor *, Mem *);
+SQLITE_PRIVATE int sqlite3VdbeSorterNext(sqlite3 *, const VdbeCursor *);
+SQLITE_PRIVATE int sqlite3VdbeSorterRewind(const VdbeCursor *, int *);
+SQLITE_PRIVATE int sqlite3VdbeSorterWrite(const VdbeCursor *, Mem *);
+SQLITE_PRIVATE int sqlite3VdbeSorterCompare(const VdbeCursor *, Mem *, int, int *);
+
+SQLITE_PRIVATE void sqlite3VdbeValueListFree(void*);
+
+#ifdef SQLITE_DEBUG
+SQLITE_PRIVATE void sqlite3VdbeIncrWriteCounter(Vdbe*, VdbeCursor*);
+SQLITE_PRIVATE void sqlite3VdbeAssertAbortable(Vdbe*);
+#else
+# define sqlite3VdbeIncrWriteCounter(V,C)
+# define sqlite3VdbeAssertAbortable(V)
+#endif
+
+#if !defined(SQLITE_OMIT_SHARED_CACHE)
+SQLITE_PRIVATE void sqlite3VdbeEnter(Vdbe*);
+#else
+# define sqlite3VdbeEnter(X)
+#endif
+
+#if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE>0
+SQLITE_PRIVATE void sqlite3VdbeLeave(Vdbe*);
+#else
+# define sqlite3VdbeLeave(X)
+#endif
+
+#ifdef SQLITE_DEBUG
+SQLITE_PRIVATE void sqlite3VdbeMemAboutToChange(Vdbe*,Mem*);
+SQLITE_PRIVATE int sqlite3VdbeCheckMemInvariants(Mem*);
+#endif
+
+#ifndef SQLITE_OMIT_FOREIGN_KEY
+SQLITE_PRIVATE int sqlite3VdbeCheckFk(Vdbe *, int);
+#else
+# define sqlite3VdbeCheckFk(p,i) 0
+#endif
+
+#ifdef SQLITE_DEBUG
+SQLITE_PRIVATE void sqlite3VdbePrintSql(Vdbe*);
+SQLITE_PRIVATE void sqlite3VdbeMemPrettyPrint(Mem *pMem, StrAccum *pStr);
+#endif
+#ifndef SQLITE_OMIT_UTF16
+SQLITE_PRIVATE int sqlite3VdbeMemTranslate(Mem*, u8);
+SQLITE_PRIVATE int sqlite3VdbeMemHandleBom(Mem *pMem);
+#endif
+
+#ifndef SQLITE_OMIT_INCRBLOB
+SQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *);
+ #define ExpandBlob(P) (((P)->flags&MEM_Zero)?sqlite3VdbeMemExpandBlob(P):0)
+#else
+ #define sqlite3VdbeMemExpandBlob(x) SQLITE_OK
+ #define ExpandBlob(P) SQLITE_OK
+#endif
+
+#endif /* !defined(SQLITE_VDBEINT_H) */
+
+/************** End of vdbeInt.h *********************************************/
+/************** Continuing where we left off in status.c *********************/
+
+/*
+** Variables in which to record status information.
+*/
+#if SQLITE_PTRSIZE>4
+typedef sqlite3_int64 sqlite3StatValueType;
+#else
+typedef u32 sqlite3StatValueType;
+#endif
+typedef struct sqlite3StatType sqlite3StatType;
+static SQLITE_WSD struct sqlite3StatType {
+ sqlite3StatValueType nowValue[10]; /* Current value */
+ sqlite3StatValueType mxValue[10]; /* Maximum value */
+} sqlite3Stat = { {0,}, {0,} };
+
+/*
+** Elements of sqlite3Stat[] are protected by either the memory allocator
+** mutex, or by the pcache1 mutex. The following array determines which.
+*/
+static const char statMutex[] = {
+ 0, /* SQLITE_STATUS_MEMORY_USED */
+ 1, /* SQLITE_STATUS_PAGECACHE_USED */
+ 1, /* SQLITE_STATUS_PAGECACHE_OVERFLOW */
+ 0, /* SQLITE_STATUS_SCRATCH_USED */
+ 0, /* SQLITE_STATUS_SCRATCH_OVERFLOW */
+ 0, /* SQLITE_STATUS_MALLOC_SIZE */
+ 0, /* SQLITE_STATUS_PARSER_STACK */
+ 1, /* SQLITE_STATUS_PAGECACHE_SIZE */
+ 0, /* SQLITE_STATUS_SCRATCH_SIZE */
+ 0, /* SQLITE_STATUS_MALLOC_COUNT */
+};
+
+
+/* The "wsdStat" macro will resolve to the status information
+** state vector. If writable static data is unsupported on the target,
+** we have to locate the state vector at run-time. In the more common
+** case where writable static data is supported, wsdStat can refer directly
+** to the "sqlite3Stat" state vector declared above.
+*/
+#ifdef SQLITE_OMIT_WSD
+# define wsdStatInit sqlite3StatType *x = &GLOBAL(sqlite3StatType,sqlite3Stat)
+# define wsdStat x[0]
+#else
+# define wsdStatInit
+# define wsdStat sqlite3Stat
+#endif
+
+/*
+** Return the current value of a status parameter. The caller must
+** be holding the appropriate mutex.
+*/
+SQLITE_PRIVATE sqlite3_int64 sqlite3StatusValue(int op){
+ wsdStatInit;
+ assert( op>=0 && op<ArraySize(wsdStat.nowValue) );
+ assert( op>=0 && op<ArraySize(statMutex) );
+ assert( sqlite3_mutex_held(statMutex[op] ? sqlite3Pcache1Mutex()
+ : sqlite3MallocMutex()) );
+ return wsdStat.nowValue[op];
+}
+
+/*
+** Add N to the value of a status record. The caller must hold the
+** appropriate mutex. (Locking is checked by assert()).
+**
+** The StatusUp() routine can accept positive or negative values for N.
+** The value of N is added to the current status value and the high-water
+** mark is adjusted if necessary.
+**
+** The StatusDown() routine lowers the current value by N. The highwater
+** mark is unchanged. N must be non-negative for StatusDown().
+*/
+SQLITE_PRIVATE void sqlite3StatusUp(int op, int N){
+ wsdStatInit;
+ assert( op>=0 && op<ArraySize(wsdStat.nowValue) );
+ assert( op>=0 && op<ArraySize(statMutex) );
+ assert( sqlite3_mutex_held(statMutex[op] ? sqlite3Pcache1Mutex()
+ : sqlite3MallocMutex()) );
+ wsdStat.nowValue[op] += N;
+ if( wsdStat.nowValue[op]>wsdStat.mxValue[op] ){
+ wsdStat.mxValue[op] = wsdStat.nowValue[op];
+ }
+}
+SQLITE_PRIVATE void sqlite3StatusDown(int op, int N){
+ wsdStatInit;
+ assert( N>=0 );
+ assert( op>=0 && op<ArraySize(statMutex) );
+ assert( sqlite3_mutex_held(statMutex[op] ? sqlite3Pcache1Mutex()
+ : sqlite3MallocMutex()) );
+ assert( op>=0 && op<ArraySize(wsdStat.nowValue) );
+ wsdStat.nowValue[op] -= N;
+}
+
+/*
+** Adjust the highwater mark if necessary.
+** The caller must hold the appropriate mutex.
+*/
+SQLITE_PRIVATE void sqlite3StatusHighwater(int op, int X){
+ sqlite3StatValueType newValue;
+ wsdStatInit;
+ assert( X>=0 );
+ newValue = (sqlite3StatValueType)X;
+ assert( op>=0 && op<ArraySize(wsdStat.nowValue) );
+ assert( op>=0 && op<ArraySize(statMutex) );
+ assert( sqlite3_mutex_held(statMutex[op] ? sqlite3Pcache1Mutex()
+ : sqlite3MallocMutex()) );
+ assert( op==SQLITE_STATUS_MALLOC_SIZE
+ || op==SQLITE_STATUS_PAGECACHE_SIZE
+ || op==SQLITE_STATUS_PARSER_STACK );
+ if( newValue>wsdStat.mxValue[op] ){
+ wsdStat.mxValue[op] = newValue;
+ }
+}
+
+/*
+** Query status information.
+*/
+SQLITE_API int sqlite3_status64(
+ int op,
+ sqlite3_int64 *pCurrent,
+ sqlite3_int64 *pHighwater,
+ int resetFlag
+){
+ sqlite3_mutex *pMutex;
+ wsdStatInit;
+ if( op<0 || op>=ArraySize(wsdStat.nowValue) ){
+ return SQLITE_MISUSE_BKPT;
+ }
+#ifdef SQLITE_ENABLE_API_ARMOR
+ if( pCurrent==0 || pHighwater==0 ) return SQLITE_MISUSE_BKPT;
+#endif
+ pMutex = statMutex[op] ? sqlite3Pcache1Mutex() : sqlite3MallocMutex();
+ sqlite3_mutex_enter(pMutex);
+ *pCurrent = wsdStat.nowValue[op];
+ *pHighwater = wsdStat.mxValue[op];
+ if( resetFlag ){
+ wsdStat.mxValue[op] = wsdStat.nowValue[op];
+ }
+ sqlite3_mutex_leave(pMutex);
+ (void)pMutex; /* Prevent warning when SQLITE_THREADSAFE=0 */
+ return SQLITE_OK;
+}
+SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag){
+ sqlite3_int64 iCur = 0, iHwtr = 0;
+ int rc;
+#ifdef SQLITE_ENABLE_API_ARMOR
+ if( pCurrent==0 || pHighwater==0 ) return SQLITE_MISUSE_BKPT;
+#endif
+ rc = sqlite3_status64(op, &iCur, &iHwtr, resetFlag);
+ if( rc==0 ){
+ *pCurrent = (int)iCur;
+ *pHighwater = (int)iHwtr;
+ }
+ return rc;
+}
+
+/*
+** Return the number of LookasideSlot elements on the linked list
+*/
+static u32 countLookasideSlots(LookasideSlot *p){
+ u32 cnt = 0;
+ while( p ){
+ p = p->pNext;
+ cnt++;
+ }
+ return cnt;
+}
+
+/*
+** Count the number of slots of lookaside memory that are outstanding
+*/
+SQLITE_PRIVATE int sqlite3LookasideUsed(sqlite3 *db, int *pHighwater){
+ u32 nInit = countLookasideSlots(db->lookaside.pInit);
+ u32 nFree = countLookasideSlots(db->lookaside.pFree);
+#ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE
+ nInit += countLookasideSlots(db->lookaside.pSmallInit);
+ nFree += countLookasideSlots(db->lookaside.pSmallFree);
+#endif /* SQLITE_OMIT_TWOSIZE_LOOKASIDE */
+ if( pHighwater ) *pHighwater = db->lookaside.nSlot - nInit;
+ return db->lookaside.nSlot - (nInit+nFree);
+}
+
+/*
+** Query status information for a single database connection
+*/
+SQLITE_API int sqlite3_db_status(
+ sqlite3 *db, /* The database connection whose status is desired */
+ int op, /* Status verb */
+ int *pCurrent, /* Write current value here */
+ int *pHighwater, /* Write high-water mark here */
+ int resetFlag /* Reset high-water mark if true */
+){
+ int rc = SQLITE_OK; /* Return code */
+#ifdef SQLITE_ENABLE_API_ARMOR
+ if( !sqlite3SafetyCheckOk(db) || pCurrent==0|| pHighwater==0 ){
+ return SQLITE_MISUSE_BKPT;
+ }
+#endif
+ sqlite3_mutex_enter(db->mutex);
+ switch( op ){
+ case SQLITE_DBSTATUS_LOOKASIDE_USED: {
+ *pCurrent = sqlite3LookasideUsed(db, pHighwater);
+ if( resetFlag ){
+ LookasideSlot *p = db->lookaside.pFree;
+ if( p ){
+ while( p->pNext ) p = p->pNext;
+ p->pNext = db->lookaside.pInit;
+ db->lookaside.pInit = db->lookaside.pFree;
+ db->lookaside.pFree = 0;
+ }
+#ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE
+ p = db->lookaside.pSmallFree;
+ if( p ){
+ while( p->pNext ) p = p->pNext;
+ p->pNext = db->lookaside.pSmallInit;
+ db->lookaside.pSmallInit = db->lookaside.pSmallFree;
+ db->lookaside.pSmallFree = 0;
+ }
+#endif
+ }
+ break;
+ }
+
+ case SQLITE_DBSTATUS_LOOKASIDE_HIT:
+ case SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE:
+ case SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL: {
+ testcase( op==SQLITE_DBSTATUS_LOOKASIDE_HIT );
+ testcase( op==SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE );
+ testcase( op==SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL );
+ assert( (op-SQLITE_DBSTATUS_LOOKASIDE_HIT)>=0 );
+ assert( (op-SQLITE_DBSTATUS_LOOKASIDE_HIT)<3 );
+ *pCurrent = 0;
+ *pHighwater = db->lookaside.anStat[op - SQLITE_DBSTATUS_LOOKASIDE_HIT];
+ if( resetFlag ){
+ db->lookaside.anStat[op - SQLITE_DBSTATUS_LOOKASIDE_HIT] = 0;
+ }
+ break;
+ }
+
+ /*
+ ** Return an approximation for the amount of memory currently used
+ ** by all pagers associated with the given database connection. The
+ ** highwater mark is meaningless and is returned as zero.
+ */
+ case SQLITE_DBSTATUS_CACHE_USED_SHARED:
+ case SQLITE_DBSTATUS_CACHE_USED: {
+ int totalUsed = 0;
+ int i;
+ sqlite3BtreeEnterAll(db);
+ for(i=0; i<db->nDb; i++){
+ Btree *pBt = db->aDb[i].pBt;
+ if( pBt ){
+ Pager *pPager = sqlite3BtreePager(pBt);
+ int nByte = sqlite3PagerMemUsed(pPager);
+ if( op==SQLITE_DBSTATUS_CACHE_USED_SHARED ){
+ nByte = nByte / sqlite3BtreeConnectionCount(pBt);
+ }
+ totalUsed += nByte;
+ }
+ }
+ sqlite3BtreeLeaveAll(db);
+ *pCurrent = totalUsed;
+ *pHighwater = 0;
+ break;
+ }
+
+ /*
+ ** *pCurrent gets an accurate estimate of the amount of memory used
+ ** to store the schema for all databases (main, temp, and any ATTACHed
+ ** databases. *pHighwater is set to zero.
+ */
+ case SQLITE_DBSTATUS_SCHEMA_USED: {
+ int i; /* Used to iterate through schemas */
+ int nByte = 0; /* Used to accumulate return value */
+
+ sqlite3BtreeEnterAll(db);
+ db->pnBytesFreed = &nByte;
+ assert( db->lookaside.pEnd==db->lookaside.pTrueEnd );
+ db->lookaside.pEnd = db->lookaside.pStart;
+ for(i=0; i<db->nDb; i++){
+ Schema *pSchema = db->aDb[i].pSchema;
+ if( ALWAYS(pSchema!=0) ){
+ HashElem *p;
+
+ nByte += sqlite3GlobalConfig.m.xRoundup(sizeof(HashElem)) * (
+ pSchema->tblHash.count
+ + pSchema->trigHash.count
+ + pSchema->idxHash.count
+ + pSchema->fkeyHash.count
+ );
+ nByte += sqlite3_msize(pSchema->tblHash.ht);
+ nByte += sqlite3_msize(pSchema->trigHash.ht);
+ nByte += sqlite3_msize(pSchema->idxHash.ht);
+ nByte += sqlite3_msize(pSchema->fkeyHash.ht);
+
+ for(p=sqliteHashFirst(&pSchema->trigHash); p; p=sqliteHashNext(p)){
+ sqlite3DeleteTrigger(db, (Trigger*)sqliteHashData(p));
+ }
+ for(p=sqliteHashFirst(&pSchema->tblHash); p; p=sqliteHashNext(p)){
+ sqlite3DeleteTable(db, (Table *)sqliteHashData(p));
+ }
+ }
+ }
+ db->pnBytesFreed = 0;
+ db->lookaside.pEnd = db->lookaside.pTrueEnd;
+ sqlite3BtreeLeaveAll(db);
+
+ *pHighwater = 0;
+ *pCurrent = nByte;
+ break;
+ }
+
+ /*
+ ** *pCurrent gets an accurate estimate of the amount of memory used
+ ** to store all prepared statements.
+ ** *pHighwater is set to zero.
+ */
+ case SQLITE_DBSTATUS_STMT_USED: {
+ struct Vdbe *pVdbe; /* Used to iterate through VMs */
+ int nByte = 0; /* Used to accumulate return value */
+
+ db->pnBytesFreed = &nByte;
+ assert( db->lookaside.pEnd==db->lookaside.pTrueEnd );
+ db->lookaside.pEnd = db->lookaside.pStart;
+ for(pVdbe=db->pVdbe; pVdbe; pVdbe=pVdbe->pVNext){
+ sqlite3VdbeDelete(pVdbe);
+ }
+ db->lookaside.pEnd = db->lookaside.pTrueEnd;
+ db->pnBytesFreed = 0;
+
+ *pHighwater = 0; /* IMP: R-64479-57858 */
+ *pCurrent = nByte;
+
+ break;
+ }
+
+ /*
+ ** Set *pCurrent to the total cache hits or misses encountered by all
+ ** pagers the database handle is connected to. *pHighwater is always set
+ ** to zero.
+ */
+ case SQLITE_DBSTATUS_CACHE_SPILL:
+ op = SQLITE_DBSTATUS_CACHE_WRITE+1;
+ /* no break */ deliberate_fall_through
+ case SQLITE_DBSTATUS_CACHE_HIT:
+ case SQLITE_DBSTATUS_CACHE_MISS:
+ case SQLITE_DBSTATUS_CACHE_WRITE:{
+ int i;
+ u64 nRet = 0;
+ assert( SQLITE_DBSTATUS_CACHE_MISS==SQLITE_DBSTATUS_CACHE_HIT+1 );
+ assert( SQLITE_DBSTATUS_CACHE_WRITE==SQLITE_DBSTATUS_CACHE_HIT+2 );
+
+ for(i=0; i<db->nDb; i++){
+ if( db->aDb[i].pBt ){
+ Pager *pPager = sqlite3BtreePager(db->aDb[i].pBt);
+ sqlite3PagerCacheStat(pPager, op, resetFlag, &nRet);
+ }
+ }
+ *pHighwater = 0; /* IMP: R-42420-56072 */
+ /* IMP: R-54100-20147 */
+ /* IMP: R-29431-39229 */
+ *pCurrent = (int)nRet & 0x7fffffff;
+ break;
+ }
+
+ /* Set *pCurrent to non-zero if there are unresolved deferred foreign
+ ** key constraints. Set *pCurrent to zero if all foreign key constraints
+ ** have been satisfied. The *pHighwater is always set to zero.
+ */
+ case SQLITE_DBSTATUS_DEFERRED_FKS: {
+ *pHighwater = 0; /* IMP: R-11967-56545 */
+ *pCurrent = db->nDeferredImmCons>0 || db->nDeferredCons>0;
+ break;
+ }
+
+ default: {
+ rc = SQLITE_ERROR;
+ }
+ }
+ sqlite3_mutex_leave(db->mutex);
+ return rc;
+}
+
+/************** End of status.c **********************************************/
+/************** Begin file date.c ********************************************/
+/*
+** 2003 October 31
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This file contains the C functions that implement date and time
+** functions for SQLite.
+**
+** There is only one exported symbol in this file - the function
+** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
+** All other code has file scope.
+**
+** SQLite processes all times and dates as julian day numbers. The
+** dates and times are stored as the number of days since noon
+** in Greenwich on November 24, 4714 B.C. according to the Gregorian
+** calendar system.
+**
+** 1970-01-01 00:00:00 is JD 2440587.5
+** 2000-01-01 00:00:00 is JD 2451544.5
+**
+** This implementation requires years to be expressed as a 4-digit number
+** which means that only dates between 0000-01-01 and 9999-12-31 can
+** be represented, even though julian day numbers allow a much wider
+** range of dates.
+**
+** The Gregorian calendar system is used for all dates and times,
+** even those that predate the Gregorian calendar. Historians usually
+** use the julian calendar for dates prior to 1582-10-15 and for some
+** dates afterwards, depending on locale. Beware of this difference.
+**
+** The conversion algorithms are implemented based on descriptions
+** in the following text:
+**
+** Jean Meeus
+** Astronomical Algorithms, 2nd Edition, 1998
+** ISBN 0-943396-61-1
+** Willmann-Bell, Inc
+** Richmond, Virginia (USA)
+*/
+/* #include "sqliteInt.h" */
+/* #include <stdlib.h> */
+/* #include <assert.h> */
+#include <time.h>
+
+#ifndef SQLITE_OMIT_DATETIME_FUNCS
+
+/*
+** The MSVC CRT on Windows CE may not have a localtime() function.
+** So declare a substitute. The substitute function itself is
+** defined in "os_win.c".
+*/
+#if !defined(SQLITE_OMIT_LOCALTIME) && defined(_WIN32_WCE) && \
+ (!defined(SQLITE_MSVC_LOCALTIME_API) || !SQLITE_MSVC_LOCALTIME_API)
+struct tm *__cdecl localtime(const time_t *);
+#endif
+
+/*
+** A structure for holding a single date and time.
+*/
+typedef struct DateTime DateTime;
+struct DateTime {
+ sqlite3_int64 iJD; /* The julian day number times 86400000 */
+ int Y, M, D; /* Year, month, and day */
+ int h, m; /* Hour and minutes */
+ int tz; /* Timezone offset in minutes */
+ double s; /* Seconds */
+ char validJD; /* True (1) if iJD is valid */
+ char validYMD; /* True (1) if Y,M,D are valid */
+ char validHMS; /* True (1) if h,m,s are valid */
+ char nFloor; /* Days to implement "floor" */
+ unsigned rawS : 1; /* Raw numeric value stored in s */
+ unsigned isError : 1; /* An overflow has occurred */
+ unsigned useSubsec : 1; /* Display subsecond precision */
+ unsigned isUtc : 1; /* Time is known to be UTC */
+ unsigned isLocal : 1; /* Time is known to be localtime */
+};
+
+
+/*
+** Convert zDate into one or more integers according to the conversion
+** specifier zFormat.
+**
+** zFormat[] contains 4 characters for each integer converted, except for
+** the last integer which is specified by three characters. The meaning
+** of a four-character format specifiers ABCD is:
+**
+** A: number of digits to convert. Always "2" or "4".
+** B: minimum value. Always "0" or "1".
+** C: maximum value, decoded as:
+** a: 12
+** b: 14
+** c: 24
+** d: 31
+** e: 59
+** f: 9999
+** D: the separator character, or \000 to indicate this is the
+** last number to convert.
+**
+** Example: To translate an ISO-8601 date YYYY-MM-DD, the format would
+** be "40f-21a-20c". The "40f-" indicates the 4-digit year followed by "-".
+** The "21a-" indicates the 2-digit month followed by "-". The "20c" indicates
+** the 2-digit day which is the last integer in the set.
+**
+** The function returns the number of successful conversions.
+*/
+static int getDigits(const char *zDate, const char *zFormat, ...){
+ /* The aMx[] array translates the 3rd character of each format
+ ** spec into a max size: a b c d e f */
+ static const u16 aMx[] = { 12, 14, 24, 31, 59, 14712 };
+ va_list ap;
+ int cnt = 0;
+ char nextC;
+ va_start(ap, zFormat);
+ do{
+ char N = zFormat[0] - '0';
+ char min = zFormat[1] - '0';
+ int val = 0;
+ u16 max;
+
+ assert( zFormat[2]>='a' && zFormat[2]<='f' );
+ max = aMx[zFormat[2] - 'a'];
+ nextC = zFormat[3];
+ val = 0;
+ while( N-- ){
+ if( !sqlite3Isdigit(*zDate) ){
+ goto end_getDigits;
+ }
+ val = val*10 + *zDate - '0';
+ zDate++;
+ }
+ if( val<(int)min || val>(int)max || (nextC!=0 && nextC!=*zDate) ){
+ goto end_getDigits;
+ }
+ *va_arg(ap,int*) = val;
+ zDate++;
+ cnt++;
+ zFormat += 4;
+ }while( nextC );
+end_getDigits:
+ va_end(ap);
+ return cnt;
+}
+
+/*
+** Parse a timezone extension on the end of a date-time.
+** The extension is of the form:
+**
+** (+/-)HH:MM
+**
+** Or the "zulu" notation:
+**
+** Z
+**
+** If the parse is successful, write the number of minutes
+** of change in p->tz and return 0. If a parser error occurs,
+** return non-zero.
+**
+** A missing specifier is not considered an error.
+*/
+static int parseTimezone(const char *zDate, DateTime *p){
+ int sgn = 0;
+ int nHr, nMn;
+ int c;
+ while( sqlite3Isspace(*zDate) ){ zDate++; }
+ p->tz = 0;
+ c = *zDate;
+ if( c=='-' ){
+ sgn = -1;
+ }else if( c=='+' ){
+ sgn = +1;
+ }else if( c=='Z' || c=='z' ){
+ zDate++;
+ p->isLocal = 0;
+ p->isUtc = 1;
+ goto zulu_time;
+ }else{
+ return c!=0;
+ }
+ zDate++;
+ if( getDigits(zDate, "20b:20e", &nHr, &nMn)!=2 ){
+ return 1;
+ }
+ zDate += 5;
+ p->tz = sgn*(nMn + nHr*60);
+zulu_time:
+ while( sqlite3Isspace(*zDate) ){ zDate++; }
+ return *zDate!=0;
+}
+
+/*
+** Parse times of the form HH:MM or HH:MM:SS or HH:MM:SS.FFFF.
+** The HH, MM, and SS must each be exactly 2 digits. The
+** fractional seconds FFFF can be one or more digits.
+**
+** Return 1 if there is a parsing error and 0 on success.
+*/
+static int parseHhMmSs(const char *zDate, DateTime *p){
+ int h, m, s;
+ double ms = 0.0;
+ if( getDigits(zDate, "20c:20e", &h, &m)!=2 ){
+ return 1;
+ }
+ zDate += 5;
+ if( *zDate==':' ){
+ zDate++;
+ if( getDigits(zDate, "20e", &s)!=1 ){
+ return 1;
+ }
+ zDate += 2;
+ if( *zDate=='.' && sqlite3Isdigit(zDate[1]) ){
+ double rScale = 1.0;
+ zDate++;
+ while( sqlite3Isdigit(*zDate) ){
+ ms = ms*10.0 + *zDate - '0';
+ rScale *= 10.0;
+ zDate++;
+ }
+ ms /= rScale;
+ /* Truncate to avoid problems with sub-milliseconds
+ ** rounding. https://sqlite.org/forum/forumpost/766a2c9231 */
+ if( ms>0.999 ) ms = 0.999;
+ }
+ }else{
+ s = 0;
+ }
+ p->validJD = 0;
+ p->rawS = 0;
+ p->validHMS = 1;
+ p->h = h;
+ p->m = m;
+ p->s = s + ms;
+ if( parseTimezone(zDate, p) ) return 1;
+ return 0;
+}
+
+/*
+** Put the DateTime object into its error state.
+*/
+static void datetimeError(DateTime *p){
+ memset(p, 0, sizeof(*p));
+ p->isError = 1;
+}
+
+/*
+** Convert from YYYY-MM-DD HH:MM:SS to julian day. We always assume
+** that the YYYY-MM-DD is according to the Gregorian calendar.
+**
+** Reference: Meeus page 61
+*/
+static void computeJD(DateTime *p){
+ int Y, M, D, A, B, X1, X2;
+
+ if( p->validJD ) return;
+ if( p->validYMD ){
+ Y = p->Y;
+ M = p->M;
+ D = p->D;
+ }else{
+ Y = 2000; /* If no YMD specified, assume 2000-Jan-01 */
+ M = 1;
+ D = 1;
+ }
+ if( Y<-4713 || Y>9999 || p->rawS ){
+ datetimeError(p);
+ return;
+ }
+ if( M<=2 ){
+ Y--;
+ M += 12;
+ }
+ A = (Y+4800)/100;
+ B = 38 - A + (A/4);
+ X1 = 36525*(Y+4716)/100;
+ X2 = 306001*(M+1)/10000;
+ p->iJD = (sqlite3_int64)((X1 + X2 + D + B - 1524.5 ) * 86400000);
+ p->validJD = 1;
+ if( p->validHMS ){
+ p->iJD += p->h*3600000 + p->m*60000 + (sqlite3_int64)(p->s*1000 + 0.5);
+ if( p->tz ){
+ p->iJD -= p->tz*60000;
+ p->validYMD = 0;
+ p->validHMS = 0;
+ p->tz = 0;
+ p->isUtc = 1;
+ p->isLocal = 0;
+ }
+ }
+}
+
+/*
+** Given the YYYY-MM-DD information current in p, determine if there
+** is day-of-month overflow and set nFloor to the number of days that
+** would need to be subtracted from the date in order to bring the
+** date back to the end of the month.
+*/
+static void computeFloor(DateTime *p){
+ assert( p->validYMD || p->isError );
+ assert( p->D>=0 && p->D<=31 );
+ assert( p->M>=0 && p->M<=12 );
+ if( p->D<=28 ){
+ p->nFloor = 0;
+ }else if( (1<<p->M) & 0x15aa ){
+ p->nFloor = 0;
+ }else if( p->M!=2 ){
+ p->nFloor = (p->D==31);
+ }else if( p->Y%4!=0 || (p->Y%100==0 && p->Y%400!=0) ){
+ p->nFloor = p->D - 28;
+ }else{
+ p->nFloor = p->D - 29;
+ }
+}
+
+/*
+** Parse dates of the form
+**
+** YYYY-MM-DD HH:MM:SS.FFF
+** YYYY-MM-DD HH:MM:SS
+** YYYY-MM-DD HH:MM
+** YYYY-MM-DD
+**
+** Write the result into the DateTime structure and return 0
+** on success and 1 if the input string is not a well-formed
+** date.
+*/
+static int parseYyyyMmDd(const char *zDate, DateTime *p){
+ int Y, M, D, neg;
+
+ if( zDate[0]=='-' ){
+ zDate++;
+ neg = 1;
+ }else{
+ neg = 0;
+ }
+ if( getDigits(zDate, "40f-21a-21d", &Y, &M, &D)!=3 ){
+ return 1;
+ }
+ zDate += 10;
+ while( sqlite3Isspace(*zDate) || 'T'==*(u8*)zDate ){ zDate++; }
+ if( parseHhMmSs(zDate, p)==0 ){
+ /* We got the time */
+ }else if( *zDate==0 ){
+ p->validHMS = 0;
+ }else{
+ return 1;
+ }
+ p->validJD = 0;
+ p->validYMD = 1;
+ p->Y = neg ? -Y : Y;
+ p->M = M;
+ p->D = D;
+ computeFloor(p);
+ if( p->tz ){
+ computeJD(p);
+ }
+ return 0;
+}
+
+
+static void clearYMD_HMS_TZ(DateTime *p); /* Forward declaration */
+
+/*
+** Set the time to the current time reported by the VFS.
+**
+** Return the number of errors.
+*/
+static int setDateTimeToCurrent(sqlite3_context *context, DateTime *p){
+ p->iJD = sqlite3StmtCurrentTime(context);
+ if( p->iJD>0 ){
+ p->validJD = 1;
+ p->isUtc = 1;
+ p->isLocal = 0;
+ clearYMD_HMS_TZ(p);
+ return 0;
+ }else{
+ return 1;
+ }
+}
+
+/*
+** Input "r" is a numeric quantity which might be a julian day number,
+** or the number of seconds since 1970. If the value if r is within
+** range of a julian day number, install it as such and set validJD.
+** If the value is a valid unix timestamp, put it in p->s and set p->rawS.
+*/
+static void setRawDateNumber(DateTime *p, double r){
+ p->s = r;
+ p->rawS = 1;
+ if( r>=0.0 && r<5373484.5 ){
+ p->iJD = (sqlite3_int64)(r*86400000.0 + 0.5);
+ p->validJD = 1;
+ }
+}
+
+/*
+** Attempt to parse the given string into a julian day number. Return
+** the number of errors.
+**
+** The following are acceptable forms for the input string:
+**
+** YYYY-MM-DD HH:MM:SS.FFF +/-HH:MM
+** DDDD.DD
+** now
+**
+** In the first form, the +/-HH:MM is always optional. The fractional
+** seconds extension (the ".FFF") is optional. The seconds portion
+** (":SS.FFF") is option. The year and date can be omitted as long
+** as there is a time string. The time string can be omitted as long
+** as there is a year and date.
+*/
+static int parseDateOrTime(
+ sqlite3_context *context,
+ const char *zDate,
+ DateTime *p
+){
+ double r;
+ if( parseYyyyMmDd(zDate,p)==0 ){
+ return 0;
+ }else if( parseHhMmSs(zDate, p)==0 ){
+ return 0;
+ }else if( sqlite3StrICmp(zDate,"now")==0 && sqlite3NotPureFunc(context) ){
+ return setDateTimeToCurrent(context, p);
+ }else if( sqlite3AtoF(zDate, &r, sqlite3Strlen30(zDate), SQLITE_UTF8)>0 ){
+ setRawDateNumber(p, r);
+ return 0;
+ }else if( (sqlite3StrICmp(zDate,"subsec")==0
+ || sqlite3StrICmp(zDate,"subsecond")==0)
+ && sqlite3NotPureFunc(context) ){
+ p->useSubsec = 1;
+ return setDateTimeToCurrent(context, p);
+ }
+ return 1;
+}
+
+/* The julian day number for 9999-12-31 23:59:59.999 is 5373484.4999999.
+** Multiplying this by 86400000 gives 464269060799999 as the maximum value
+** for DateTime.iJD.
+**
+** But some older compilers (ex: gcc 4.2.1 on older Macs) cannot deal with
+** such a large integer literal, so we have to encode it.
+*/
+#define INT_464269060799999 ((((i64)0x1a640)<<32)|0x1072fdff)
+
+/*
+** Return TRUE if the given julian day number is within range.
+**
+** The input is the JulianDay times 86400000.
+*/
+static int validJulianDay(sqlite3_int64 iJD){
+ return iJD>=0 && iJD<=INT_464269060799999;
+}
+
+/*
+** Compute the Year, Month, and Day from the julian day number.
+*/
+static void computeYMD(DateTime *p){
+ int Z, alpha, A, B, C, D, E, X1;
+ if( p->validYMD ) return;
+ if( !p->validJD ){
+ p->Y = 2000;
+ p->M = 1;
+ p->D = 1;
+ }else if( !validJulianDay(p->iJD) ){
+ datetimeError(p);
+ return;
+ }else{
+ Z = (int)((p->iJD + 43200000)/86400000);
+ alpha = (int)((Z + 32044.75)/36524.25) - 52;
+ A = Z + 1 + alpha - ((alpha+100)/4) + 25;
+ B = A + 1524;
+ C = (int)((B - 122.1)/365.25);
+ D = (36525*(C&32767))/100;
+ E = (int)((B-D)/30.6001);
+ X1 = (int)(30.6001*E);
+ p->D = B - D - X1;
+ p->M = E<14 ? E-1 : E-13;
+ p->Y = p->M>2 ? C - 4716 : C - 4715;
+ }
+ p->validYMD = 1;
+}
+
+/*
+** Compute the Hour, Minute, and Seconds from the julian day number.
+*/
+static void computeHMS(DateTime *p){
+ int day_ms, day_min; /* milliseconds, minutes into the day */
+ if( p->validHMS ) return;
+ computeJD(p);
+ day_ms = (int)((p->iJD + 43200000) % 86400000);
+ p->s = (day_ms % 60000)/1000.0;
+ day_min = day_ms/60000;
+ p->m = day_min % 60;
+ p->h = day_min / 60;
+ p->rawS = 0;
+ p->validHMS = 1;
+}
+
+/*
+** Compute both YMD and HMS
+*/
+static void computeYMD_HMS(DateTime *p){
+ computeYMD(p);
+ computeHMS(p);
+}
+
+/*
+** Clear the YMD and HMS and the TZ
+*/
+static void clearYMD_HMS_TZ(DateTime *p){
+ p->validYMD = 0;
+ p->validHMS = 0;
+ p->tz = 0;
+}
+
+#ifndef SQLITE_OMIT_LOCALTIME
+/*
+** On recent Windows platforms, the localtime_s() function is available
+** as part of the "Secure CRT". It is essentially equivalent to
+** localtime_r() available under most POSIX platforms, except that the
+** order of the parameters is reversed.
+**
+** See http://msdn.microsoft.com/en-us/library/a442x3ye(VS.80).aspx.
+**
+** If the user has not indicated to use localtime_r() or localtime_s()
+** already, check for an MSVC build environment that provides
+** localtime_s().
+*/
+#if !HAVE_LOCALTIME_R && !HAVE_LOCALTIME_S \
+ && defined(_MSC_VER) && defined(_CRT_INSECURE_DEPRECATE)
+#undef HAVE_LOCALTIME_S
+#define HAVE_LOCALTIME_S 1
+#endif
+
+/*
+** The following routine implements the rough equivalent of localtime_r()
+** using whatever operating-system specific localtime facility that
+** is available. This routine returns 0 on success and
+** non-zero on any kind of error.
+**
+** If the sqlite3GlobalConfig.bLocaltimeFault variable is non-zero then this
+** routine will always fail. If bLocaltimeFault is nonzero and
+** sqlite3GlobalConfig.xAltLocaltime is not NULL, then xAltLocaltime() is
+** invoked in place of the OS-defined localtime() function.
+**
+** EVIDENCE-OF: R-62172-00036 In this implementation, the standard C
+** library function localtime_r() is used to assist in the calculation of
+** local time.
+*/
+static int osLocaltime(time_t *t, struct tm *pTm){
+ int rc;
+#if !HAVE_LOCALTIME_R && !HAVE_LOCALTIME_S
+ struct tm *pX;
+#if SQLITE_THREADSAFE>0
+ sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MAIN);
+#endif
+ sqlite3_mutex_enter(mutex);
+ pX = localtime(t);
+#ifndef SQLITE_UNTESTABLE
+ if( sqlite3GlobalConfig.bLocaltimeFault ){
+ if( sqlite3GlobalConfig.xAltLocaltime!=0
+ && 0==sqlite3GlobalConfig.xAltLocaltime((const void*)t,(void*)pTm)
+ ){
+ pX = pTm;
+ }else{
+ pX = 0;
+ }
+ }
+#endif
+ if( pX ) *pTm = *pX;
+#if SQLITE_THREADSAFE>0
+ sqlite3_mutex_leave(mutex);
+#endif
+ rc = pX==0;
+#else
+#ifndef SQLITE_UNTESTABLE
+ if( sqlite3GlobalConfig.bLocaltimeFault ){
+ if( sqlite3GlobalConfig.xAltLocaltime!=0 ){
+ return sqlite3GlobalConfig.xAltLocaltime((const void*)t,(void*)pTm);
+ }else{
+ return 1;
+ }
+ }
+#endif
+#if HAVE_LOCALTIME_R
+ rc = localtime_r(t, pTm)==0;
+#else
+ rc = localtime_s(pTm, t);
+#endif /* HAVE_LOCALTIME_R */
+#endif /* HAVE_LOCALTIME_R || HAVE_LOCALTIME_S */
+ return rc;
+}
+#endif /* SQLITE_OMIT_LOCALTIME */
+
+
+#ifndef SQLITE_OMIT_LOCALTIME
+/*
+** Assuming the input DateTime is UTC, move it to its localtime equivalent.
+*/
+static int toLocaltime(
+ DateTime *p, /* Date at which to calculate offset */
+ sqlite3_context *pCtx /* Write error here if one occurs */
+){
+ time_t t;
+ struct tm sLocal;
+ int iYearDiff;
+
+ /* Initialize the contents of sLocal to avoid a compiler warning. */
+ memset(&sLocal, 0, sizeof(sLocal));
+
+ computeJD(p);
+ if( p->iJD<2108667600*(i64)100000 /* 1970-01-01 */
+ || p->iJD>2130141456*(i64)100000 /* 2038-01-18 */
+ ){
+ /* EVIDENCE-OF: R-55269-29598 The localtime_r() C function normally only
+ ** works for years between 1970 and 2037. For dates outside this range,
+ ** SQLite attempts to map the year into an equivalent year within this
+ ** range, do the calculation, then map the year back.
+ */
+ DateTime x = *p;
+ computeYMD_HMS(&x);
+ iYearDiff = (2000 + x.Y%4) - x.Y;
+ x.Y += iYearDiff;
+ x.validJD = 0;
+ computeJD(&x);
+ t = (time_t)(x.iJD/1000 - 21086676*(i64)10000);
+ }else{
+ iYearDiff = 0;
+ t = (time_t)(p->iJD/1000 - 21086676*(i64)10000);
+ }
+ if( osLocaltime(&t, &sLocal) ){
+ sqlite3_result_error(pCtx, "local time unavailable", -1);
+ return SQLITE_ERROR;
+ }
+ p->Y = sLocal.tm_year + 1900 - iYearDiff;
+ p->M = sLocal.tm_mon + 1;
+ p->D = sLocal.tm_mday;
+ p->h = sLocal.tm_hour;
+ p->m = sLocal.tm_min;
+ p->s = sLocal.tm_sec + (p->iJD%1000)*0.001;
+ p->validYMD = 1;
+ p->validHMS = 1;
+ p->validJD = 0;
+ p->rawS = 0;
+ p->tz = 0;
+ p->isError = 0;
+ return SQLITE_OK;
+}
+#endif /* SQLITE_OMIT_LOCALTIME */
+
+/*
+** The following table defines various date transformations of the form
+**
+** 'NNN days'
+**
+** Where NNN is an arbitrary floating-point number and "days" can be one
+** of several units of time.
+*/
+static const struct {
+ u8 nName; /* Length of the name */
+ char zName[7]; /* Name of the transformation */
+ float rLimit; /* Maximum NNN value for this transform */
+ float rXform; /* Constant used for this transform */
+} aXformType[] = {
+ /* 0 */ { 6, "second", 4.6427e+14, 1.0 },
+ /* 1 */ { 6, "minute", 7.7379e+12, 60.0 },
+ /* 2 */ { 4, "hour", 1.2897e+11, 3600.0 },
+ /* 3 */ { 3, "day", 5373485.0, 86400.0 },
+ /* 4 */ { 5, "month", 176546.0, 2592000.0 },
+ /* 5 */ { 4, "year", 14713.0, 31536000.0 },
+};
+
+/*
+** If the DateTime p is raw number, try to figure out if it is
+** a julian day number of a unix timestamp. Set the p value
+** appropriately.
+*/
+static void autoAdjustDate(DateTime *p){
+ if( !p->rawS || p->validJD ){
+ p->rawS = 0;
+ }else if( p->s>=-21086676*(i64)10000 /* -4713-11-24 12:00:00 */
+ && p->s<=(25340230*(i64)10000)+799 /* 9999-12-31 23:59:59 */
+ ){
+ double r = p->s*1000.0 + 210866760000000.0;
+ clearYMD_HMS_TZ(p);
+ p->iJD = (sqlite3_int64)(r + 0.5);
+ p->validJD = 1;
+ p->rawS = 0;
+ }
+}
+
+/*
+** Process a modifier to a date-time stamp. The modifiers are
+** as follows:
+**
+** NNN days
+** NNN hours
+** NNN minutes
+** NNN.NNNN seconds
+** NNN months
+** NNN years
+** +/-YYYY-MM-DD HH:MM:SS.SSS
+** ceiling
+** floor
+** start of month
+** start of year
+** start of week
+** start of day
+** weekday N
+** unixepoch
+** auto
+** localtime
+** utc
+** subsec
+** subsecond
+**
+** Return 0 on success and 1 if there is any kind of error. If the error
+** is in a system call (i.e. localtime()), then an error message is written
+** to context pCtx. If the error is an unrecognized modifier, no error is
+** written to pCtx.
+*/
+static int parseModifier(
+ sqlite3_context *pCtx, /* Function context */
+ const char *z, /* The text of the modifier */
+ int n, /* Length of zMod in bytes */
+ DateTime *p, /* The date/time value to be modified */
+ int idx /* Parameter index of the modifier */
+){
+ int rc = 1;
+ double r;
+ switch(sqlite3UpperToLower[(u8)z[0]] ){
+ case 'a': {
+ /*
+ ** auto
+ **
+ ** If rawS is available, then interpret as a julian day number, or
+ ** a unix timestamp, depending on its magnitude.
+ */
+ if( sqlite3_stricmp(z, "auto")==0 ){
+ if( idx>1 ) return 1; /* IMP: R-33611-57934 */
+ autoAdjustDate(p);
+ rc = 0;
+ }
+ break;
+ }
+ case 'c': {
+ /*
+ ** ceiling
+ **
+ ** Resolve day-of-month overflow by rolling forward into the next
+ ** month. As this is the default action, this modifier is really
+ ** a no-op that is only included for symmetry. See "floor".
+ */
+ if( sqlite3_stricmp(z, "ceiling")==0 ){
+ computeJD(p);
+ clearYMD_HMS_TZ(p);
+ rc = 0;
+ p->nFloor = 0;
+ }
+ break;
+ }
+ case 'f': {
+ /*
+ ** floor
+ **
+ ** Resolve day-of-month overflow by rolling back to the end of the
+ ** previous month.
+ */
+ if( sqlite3_stricmp(z, "floor")==0 ){
+ computeJD(p);
+ p->iJD -= p->nFloor*86400000;
+ clearYMD_HMS_TZ(p);
+ rc = 0;
+ }
+ break;
+ }
+ case 'j': {
+ /*
+ ** julianday
+ **
+ ** Always interpret the prior number as a julian-day value. If this
+ ** is not the first modifier, or if the prior argument is not a numeric
+ ** value in the allowed range of julian day numbers understood by
+ ** SQLite (0..5373484.5) then the result will be NULL.
+ */
+ if( sqlite3_stricmp(z, "julianday")==0 ){
+ if( idx>1 ) return 1; /* IMP: R-31176-64601 */
+ if( p->validJD && p->rawS ){
+ rc = 0;
+ p->rawS = 0;
+ }
+ }
+ break;
+ }
+#ifndef SQLITE_OMIT_LOCALTIME
+ case 'l': {
+ /* localtime
+ **
+ ** Assuming the current time value is UTC (a.k.a. GMT), shift it to
+ ** show local time.
+ */
+ if( sqlite3_stricmp(z, "localtime")==0 && sqlite3NotPureFunc(pCtx) ){
+ rc = p->isLocal ? SQLITE_OK : toLocaltime(p, pCtx);
+ p->isUtc = 0;
+ p->isLocal = 1;
+ }
+ break;
+ }
+#endif
+ case 'u': {
+ /*
+ ** unixepoch
+ **
+ ** Treat the current value of p->s as the number of
+ ** seconds since 1970. Convert to a real julian day number.
+ */
+ if( sqlite3_stricmp(z, "unixepoch")==0 && p->rawS ){
+ if( idx>1 ) return 1; /* IMP: R-49255-55373 */
+ r = p->s*1000.0 + 210866760000000.0;
+ if( r>=0.0 && r<464269060800000.0 ){
+ clearYMD_HMS_TZ(p);
+ p->iJD = (sqlite3_int64)(r + 0.5);
+ p->validJD = 1;
+ p->rawS = 0;
+ rc = 0;
+ }
+ }
+#ifndef SQLITE_OMIT_LOCALTIME
+ else if( sqlite3_stricmp(z, "utc")==0 && sqlite3NotPureFunc(pCtx) ){
+ if( p->isUtc==0 ){
+ i64 iOrigJD; /* Original localtime */
+ i64 iGuess; /* Guess at the corresponding utc time */
+ int cnt = 0; /* Safety to prevent infinite loop */
+ i64 iErr; /* Guess is off by this much */
+
+ computeJD(p);
+ iGuess = iOrigJD = p->iJD;
+ iErr = 0;
+ do{
+ DateTime new;
+ memset(&new, 0, sizeof(new));
+ iGuess -= iErr;
+ new.iJD = iGuess;
+ new.validJD = 1;
+ rc = toLocaltime(&new, pCtx);
+ if( rc ) return rc;
+ computeJD(&new);
+ iErr = new.iJD - iOrigJD;
+ }while( iErr && cnt++<3 );
+ memset(p, 0, sizeof(*p));
+ p->iJD = iGuess;
+ p->validJD = 1;
+ p->isUtc = 1;
+ p->isLocal = 0;
+ }
+ rc = SQLITE_OK;
+ }
+#endif
+ break;
+ }
+ case 'w': {
+ /*
+ ** weekday N
+ **
+ ** Move the date to the same time on the next occurrence of
+ ** weekday N where 0==Sunday, 1==Monday, and so forth. If the
+ ** date is already on the appropriate weekday, this is a no-op.
+ */
+ if( sqlite3_strnicmp(z, "weekday ", 8)==0
+ && sqlite3AtoF(&z[8], &r, sqlite3Strlen30(&z[8]), SQLITE_UTF8)>0
+ && r>=0.0 && r<7.0 && (n=(int)r)==r ){
+ sqlite3_int64 Z;
+ computeYMD_HMS(p);
+ p->tz = 0;
+ p->validJD = 0;
+ computeJD(p);
+ Z = ((p->iJD + 129600000)/86400000) % 7;
+ if( Z>n ) Z -= 7;
+ p->iJD += (n - Z)*86400000;
+ clearYMD_HMS_TZ(p);
+ rc = 0;
+ }
+ break;
+ }
+ case 's': {
+ /*
+ ** start of TTTTT
+ **
+ ** Move the date backwards to the beginning of the current day,
+ ** or month or year.
+ **
+ ** subsecond
+ ** subsec
+ **
+ ** Show subsecond precision in the output of datetime() and
+ ** unixepoch() and strftime('%s').
+ */
+ if( sqlite3_strnicmp(z, "start of ", 9)!=0 ){
+ if( sqlite3_stricmp(z, "subsec")==0
+ || sqlite3_stricmp(z, "subsecond")==0
+ ){
+ p->useSubsec = 1;
+ rc = 0;
+ }
+ break;
+ }
+ if( !p->validJD && !p->validYMD && !p->validHMS ) break;
+ z += 9;
+ computeYMD(p);
+ p->validHMS = 1;
+ p->h = p->m = 0;
+ p->s = 0.0;
+ p->rawS = 0;
+ p->tz = 0;
+ p->validJD = 0;
+ if( sqlite3_stricmp(z,"month")==0 ){
+ p->D = 1;
+ rc = 0;
+ }else if( sqlite3_stricmp(z,"year")==0 ){
+ p->M = 1;
+ p->D = 1;
+ rc = 0;
+ }else if( sqlite3_stricmp(z,"day")==0 ){
+ rc = 0;
+ }
+ break;
+ }
+ case '+':
+ case '-':
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9': {
+ double rRounder;
+ int i;
+ int Y,M,D,h,m,x;
+ const char *z2 = z;
+ char z0 = z[0];
+ for(n=1; z[n]; n++){
+ if( z[n]==':' ) break;
+ if( sqlite3Isspace(z[n]) ) break;
+ if( z[n]=='-' ){
+ if( n==5 && getDigits(&z[1], "40f", &Y)==1 ) break;
+ if( n==6 && getDigits(&z[1], "50f", &Y)==1 ) break;
+ }
+ }
+ if( sqlite3AtoF(z, &r, n, SQLITE_UTF8)<=0 ){
+ assert( rc==1 );
+ break;
+ }
+ if( z[n]=='-' ){
+ /* A modifier of the form (+|-)YYYY-MM-DD adds or subtracts the
+ ** specified number of years, months, and days. MM is limited to
+ ** the range 0-11 and DD is limited to 0-30.
+ */
+ if( z0!='+' && z0!='-' ) break; /* Must start with +/- */
+ if( n==5 ){
+ if( getDigits(&z[1], "40f-20a-20d", &Y, &M, &D)!=3 ) break;
+ }else{
+ assert( n==6 );
+ if( getDigits(&z[1], "50f-20a-20d", &Y, &M, &D)!=3 ) break;
+ z++;
+ }
+ if( M>=12 ) break; /* M range 0..11 */
+ if( D>=31 ) break; /* D range 0..30 */
+ computeYMD_HMS(p);
+ p->validJD = 0;
+ if( z0=='-' ){
+ p->Y -= Y;
+ p->M -= M;
+ D = -D;
+ }else{
+ p->Y += Y;
+ p->M += M;
+ }
+ x = p->M>0 ? (p->M-1)/12 : (p->M-12)/12;
+ p->Y += x;
+ p->M -= x*12;
+ computeFloor(p);
+ computeJD(p);
+ p->validHMS = 0;
+ p->validYMD = 0;
+ p->iJD += (i64)D*86400000;
+ if( z[11]==0 ){
+ rc = 0;
+ break;
+ }
+ if( sqlite3Isspace(z[11])
+ && getDigits(&z[12], "20c:20e", &h, &m)==2
+ ){
+ z2 = &z[12];
+ n = 2;
+ }else{
+ break;
+ }
+ }
+ if( z2[n]==':' ){
+ /* A modifier of the form (+|-)HH:MM:SS.FFF adds (or subtracts) the
+ ** specified number of hours, minutes, seconds, and fractional seconds
+ ** to the time. The ".FFF" may be omitted. The ":SS.FFF" may be
+ ** omitted.
+ */
+
+ DateTime tx;
+ sqlite3_int64 day;
+ if( !sqlite3Isdigit(*z2) ) z2++;
+ memset(&tx, 0, sizeof(tx));
+ if( parseHhMmSs(z2, &tx) ) break;
+ computeJD(&tx);
+ tx.iJD -= 43200000;
+ day = tx.iJD/86400000;
+ tx.iJD -= day*86400000;
+ if( z0=='-' ) tx.iJD = -tx.iJD;
+ computeJD(p);
+ clearYMD_HMS_TZ(p);
+ p->iJD += tx.iJD;
+ rc = 0;
+ break;
+ }
+
+ /* If control reaches this point, it means the transformation is
+ ** one of the forms like "+NNN days". */
+ z += n;
+ while( sqlite3Isspace(*z) ) z++;
+ n = sqlite3Strlen30(z);
+ if( n<3 || n>10 ) break;
+ if( sqlite3UpperToLower[(u8)z[n-1]]=='s' ) n--;
+ computeJD(p);
+ assert( rc==1 );
+ rRounder = r<0 ? -0.5 : +0.5;
+ p->nFloor = 0;
+ for(i=0; i<ArraySize(aXformType); i++){
+ if( aXformType[i].nName==n
+ && sqlite3_strnicmp(aXformType[i].zName, z, n)==0
+ && r>-aXformType[i].rLimit && r<aXformType[i].rLimit
+ ){
+ switch( i ){
+ case 4: { /* Special processing to add months */
+ assert( strcmp(aXformType[4].zName,"month")==0 );
+ computeYMD_HMS(p);
+ p->M += (int)r;
+ x = p->M>0 ? (p->M-1)/12 : (p->M-12)/12;
+ p->Y += x;
+ p->M -= x*12;
+ computeFloor(p);
+ p->validJD = 0;
+ r -= (int)r;
+ break;
+ }
+ case 5: { /* Special processing to add years */
+ int y = (int)r;
+ assert( strcmp(aXformType[5].zName,"year")==0 );
+ computeYMD_HMS(p);
+ assert( p->M>=0 && p->M<=12 );
+ p->Y += y;
+ computeFloor(p);
+ p->validJD = 0;
+ r -= (int)r;
+ break;
+ }
+ }
+ computeJD(p);
+ p->iJD += (sqlite3_int64)(r*1000.0*aXformType[i].rXform + rRounder);
+ rc = 0;
+ break;
+ }
+ }
+ clearYMD_HMS_TZ(p);
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return rc;
+}
+
+/*
+** Process time function arguments. argv[0] is a date-time stamp.
+** argv[1] and following are modifiers. Parse them all and write
+** the resulting time into the DateTime structure p. Return 0
+** on success and 1 if there are any errors.
+**
+** If there are zero parameters (if even argv[0] is undefined)
+** then assume a default value of "now" for argv[0].
+*/
+static int isDate(
+ sqlite3_context *context,
+ int argc,
+ sqlite3_value **argv,
+ DateTime *p
+){
+ int i, n;
+ const unsigned char *z;
+ int eType;
+ memset(p, 0, sizeof(*p));
+ if( argc==0 ){
+ if( !sqlite3NotPureFunc(context) ) return 1;
+ return setDateTimeToCurrent(context, p);
+ }
+ if( (eType = sqlite3_value_type(argv[0]))==SQLITE_FLOAT
+ || eType==SQLITE_INTEGER ){
+ setRawDateNumber(p, sqlite3_value_double(argv[0]));
+ }else{
+ z = sqlite3_value_text(argv[0]);
+ if( !z || parseDateOrTime(context, (char*)z, p) ){
+ return 1;
+ }
+ }
+ for(i=1; i<argc; i++){
+ z = sqlite3_value_text(argv[i]);
+ n = sqlite3_value_bytes(argv[i]);
+ if( z==0 || parseModifier(context, (char*)z, n, p, i) ) return 1;
+ }
+ computeJD(p);
+ if( p->isError || !validJulianDay(p->iJD) ) return 1;
+ if( argc==1 && p->validYMD && p->D>28 ){
+ /* Make sure a YYYY-MM-DD is normalized.
+ ** Example: 2023-02-31 -> 2023-03-03 */
+ assert( p->validJD );
+ p->validYMD = 0;
+ }
+ return 0;
+}
+
+
+/*
+** The following routines implement the various date and time functions
+** of SQLite.
+*/
+
+/*
+** julianday( TIMESTRING, MOD, MOD, ...)
+**
+** Return the julian day number of the date specified in the arguments
+*/
+static void juliandayFunc(
+ sqlite3_context *context,
+ int argc,
+ sqlite3_value **argv
+){
+ DateTime x;
+ if( isDate(context, argc, argv, &x)==0 ){
+ computeJD(&x);
+ sqlite3_result_double(context, x.iJD/86400000.0);
+ }
+}
+
+/*
+** unixepoch( TIMESTRING, MOD, MOD, ...)
+**
+** Return the number of seconds (including fractional seconds) since
+** the unix epoch of 1970-01-01 00:00:00 GMT.
+*/
+static void unixepochFunc(
+ sqlite3_context *context,
+ int argc,
+ sqlite3_value **argv
+){
+ DateTime x;
+ if( isDate(context, argc, argv, &x)==0 ){
+ computeJD(&x);
+ if( x.useSubsec ){
+ sqlite3_result_double(context, (x.iJD - 21086676*(i64)10000000)/1000.0);
+ }else{
+ sqlite3_result_int64(context, x.iJD/1000 - 21086676*(i64)10000);
+ }
+ }
+}
+
+/*
+** datetime( TIMESTRING, MOD, MOD, ...)
+**
+** Return YYYY-MM-DD HH:MM:SS
+*/
+static void datetimeFunc(
+ sqlite3_context *context,
+ int argc,
+ sqlite3_value **argv
+){
+ DateTime x;
+ if( isDate(context, argc, argv, &x)==0 ){
+ int Y, s, n;
+ char zBuf[32];
+ computeYMD_HMS(&x);
+ Y = x.Y;
+ if( Y<0 ) Y = -Y;
+ zBuf[1] = '0' + (Y/1000)%10;
+ zBuf[2] = '0' + (Y/100)%10;
+ zBuf[3] = '0' + (Y/10)%10;
+ zBuf[4] = '0' + (Y)%10;
+ zBuf[5] = '-';
+ zBuf[6] = '0' + (x.M/10)%10;
+ zBuf[7] = '0' + (x.M)%10;
+ zBuf[8] = '-';
+ zBuf[9] = '0' + (x.D/10)%10;
+ zBuf[10] = '0' + (x.D)%10;
+ zBuf[11] = ' ';
+ zBuf[12] = '0' + (x.h/10)%10;
+ zBuf[13] = '0' + (x.h)%10;
+ zBuf[14] = ':';
+ zBuf[15] = '0' + (x.m/10)%10;
+ zBuf[16] = '0' + (x.m)%10;
+ zBuf[17] = ':';
+ if( x.useSubsec ){
+ s = (int)(1000.0*x.s + 0.5);
+ zBuf[18] = '0' + (s/10000)%10;
+ zBuf[19] = '0' + (s/1000)%10;
+ zBuf[20] = '.';
+ zBuf[21] = '0' + (s/100)%10;
+ zBuf[22] = '0' + (s/10)%10;
+ zBuf[23] = '0' + (s)%10;
+ zBuf[24] = 0;
+ n = 24;
+ }else{
+ s = (int)x.s;
+ zBuf[18] = '0' + (s/10)%10;
+ zBuf[19] = '0' + (s)%10;
+ zBuf[20] = 0;
+ n = 20;
+ }
+ if( x.Y<0 ){
+ zBuf[0] = '-';
+ sqlite3_result_text(context, zBuf, n, SQLITE_TRANSIENT);
+ }else{
+ sqlite3_result_text(context, &zBuf[1], n-1, SQLITE_TRANSIENT);
+ }
+ }
+}
+
+/*
+** time( TIMESTRING, MOD, MOD, ...)
+**
+** Return HH:MM:SS
+*/
+static void timeFunc(
+ sqlite3_context *context,
+ int argc,
+ sqlite3_value **argv
+){
+ DateTime x;
+ if( isDate(context, argc, argv, &x)==0 ){
+ int s, n;
+ char zBuf[16];
+ computeHMS(&x);
+ zBuf[0] = '0' + (x.h/10)%10;
+ zBuf[1] = '0' + (x.h)%10;
+ zBuf[2] = ':';
+ zBuf[3] = '0' + (x.m/10)%10;
+ zBuf[4] = '0' + (x.m)%10;
+ zBuf[5] = ':';
+ if( x.useSubsec ){
+ s = (int)(1000.0*x.s + 0.5);
+ zBuf[6] = '0' + (s/10000)%10;
+ zBuf[7] = '0' + (s/1000)%10;
+ zBuf[8] = '.';
+ zBuf[9] = '0' + (s/100)%10;
+ zBuf[10] = '0' + (s/10)%10;
+ zBuf[11] = '0' + (s)%10;
+ zBuf[12] = 0;
+ n = 12;
+ }else{
+ s = (int)x.s;
+ zBuf[6] = '0' + (s/10)%10;
+ zBuf[7] = '0' + (s)%10;
+ zBuf[8] = 0;
+ n = 8;
+ }
+ sqlite3_result_text(context, zBuf, n, SQLITE_TRANSIENT);
+ }
+}
+
+/*
+** date( TIMESTRING, MOD, MOD, ...)
+**
+** Return YYYY-MM-DD
+*/
+static void dateFunc(
+ sqlite3_context *context,
+ int argc,
+ sqlite3_value **argv
+){
+ DateTime x;
+ if( isDate(context, argc, argv, &x)==0 ){
+ int Y;
+ char zBuf[16];
+ computeYMD(&x);
+ Y = x.Y;
+ if( Y<0 ) Y = -Y;
+ zBuf[1] = '0' + (Y/1000)%10;
+ zBuf[2] = '0' + (Y/100)%10;
+ zBuf[3] = '0' + (Y/10)%10;
+ zBuf[4] = '0' + (Y)%10;
+ zBuf[5] = '-';
+ zBuf[6] = '0' + (x.M/10)%10;
+ zBuf[7] = '0' + (x.M)%10;
+ zBuf[8] = '-';
+ zBuf[9] = '0' + (x.D/10)%10;
+ zBuf[10] = '0' + (x.D)%10;
+ zBuf[11] = 0;
+ if( x.Y<0 ){
+ zBuf[0] = '-';
+ sqlite3_result_text(context, zBuf, 11, SQLITE_TRANSIENT);
+ }else{
+ sqlite3_result_text(context, &zBuf[1], 10, SQLITE_TRANSIENT);
+ }
+ }
+}
+
+/*
+** Compute the number of days after the most recent January 1.
+**
+** In other words, compute the zero-based day number for the
+** current year:
+**
+** Jan01 = 0, Jan02 = 1, ..., Jan31 = 30, Feb01 = 31, ...
+** Dec31 = 364 or 365.
+*/
+static int daysAfterJan01(DateTime *pDate){
+ DateTime jan01 = *pDate;
+ assert( jan01.validYMD );
+ assert( jan01.validHMS );
+ assert( pDate->validJD );
+ jan01.validJD = 0;
+ jan01.M = 1;
+ jan01.D = 1;
+ computeJD(&jan01);
+ return (int)((pDate->iJD-jan01.iJD+43200000)/86400000);
+}
+
+/*
+** Return the number of days after the most recent Monday.
+**
+** In other words, return the day of the week according
+** to this code:
+**
+** 0=Monday, 1=Tuesday, 2=Wednesday, ..., 6=Sunday.
+*/
+static int daysAfterMonday(DateTime *pDate){
+ assert( pDate->validJD );
+ return (int)((pDate->iJD+43200000)/86400000) % 7;
+}
+
+/*
+** Return the number of days after the most recent Sunday.
+**
+** In other words, return the day of the week according
+** to this code:
+**
+** 0=Sunday, 1=Monday, 2=Tues, ..., 6=Saturday
+*/
+static int daysAfterSunday(DateTime *pDate){
+ assert( pDate->validJD );
+ return (int)((pDate->iJD+129600000)/86400000) % 7;
+}
+
+/*
+** strftime( FORMAT, TIMESTRING, MOD, MOD, ...)
+**
+** Return a string described by FORMAT. Conversions as follows:
+**
+** %d day of month 01-31
+** %e day of month 1-31
+** %f ** fractional seconds SS.SSS
+** %F ISO date. YYYY-MM-DD
+** %G ISO year corresponding to %V 0000-9999.
+** %g 2-digit ISO year corresponding to %V 00-99
+** %H hour 00-24
+** %k hour 0-24 (leading zero converted to space)
+** %I hour 01-12
+** %j day of year 001-366
+** %J ** julian day number
+** %l hour 1-12 (leading zero converted to space)
+** %m month 01-12
+** %M minute 00-59
+** %p "am" or "pm"
+** %P "AM" or "PM"
+** %R time as HH:MM
+** %s seconds since 1970-01-01
+** %S seconds 00-59
+** %T time as HH:MM:SS
+** %u day of week 1-7 Monday==1, Sunday==7
+** %w day of week 0-6 Sunday==0, Monday==1
+** %U week of year 00-53 (First Sunday is start of week 01)
+** %V week of year 01-53 (First week containing Thursday is week 01)
+** %W week of year 00-53 (First Monday is start of week 01)
+** %Y year 0000-9999
+** %% %
+*/
+static void strftimeFunc(
+ sqlite3_context *context,
+ int argc,
+ sqlite3_value **argv
+){
+ DateTime x;
+ size_t i,j;
+ sqlite3 *db;
+ const char *zFmt;
+ sqlite3_str sRes;
+
+
+ if( argc==0 ) return;
+ zFmt = (const char*)sqlite3_value_text(argv[0]);
+ if( zFmt==0 || isDate(context, argc-1, argv+1, &x) ) return;
+ db = sqlite3_context_db_handle(context);
+ sqlite3StrAccumInit(&sRes, 0, 0, 0, db->aLimit[SQLITE_LIMIT_LENGTH]);
+
+ computeJD(&x);
+ computeYMD_HMS(&x);
+ for(i=j=0; zFmt[i]; i++){
+ char cf;
+ if( zFmt[i]!='%' ) continue;
+ if( j<i ) sqlite3_str_append(&sRes, zFmt+j, (int)(i-j));
+ i++;
+ j = i + 1;
+ cf = zFmt[i];
+ switch( cf ){
+ case 'd': /* Fall thru */
+ case 'e': {
+ sqlite3_str_appendf(&sRes, cf=='d' ? "%02d" : "%2d", x.D);
+ break;
+ }
+ case 'f': { /* Fractional seconds. (Non-standard) */
+ double s = x.s;
+ if( NEVER(s>59.999) ) s = 59.999;
+ sqlite3_str_appendf(&sRes, "%06.3f", s);
+ break;
+ }
+ case 'F': {
+ sqlite3_str_appendf(&sRes, "%04d-%02d-%02d", x.Y, x.M, x.D);
+ break;
+ }
+ case 'G': /* Fall thru */
+ case 'g': {
+ DateTime y = x;
+ assert( y.validJD );
+ /* Move y so that it is the Thursday in the same week as x */
+ y.iJD += (3 - daysAfterMonday(&x))*86400000;
+ y.validYMD = 0;
+ computeYMD(&y);
+ if( cf=='g' ){
+ sqlite3_str_appendf(&sRes, "%02d", y.Y%100);
+ }else{
+ sqlite3_str_appendf(&sRes, "%04d", y.Y);
+ }
+ break;
+ }
+ case 'H':
+ case 'k': {
+ sqlite3_str_appendf(&sRes, cf=='H' ? "%02d" : "%2d", x.h);
+ break;
+ }
+ case 'I': /* Fall thru */
+ case 'l': {
+ int h = x.h;
+ if( h>12 ) h -= 12;
+ if( h==0 ) h = 12;
+ sqlite3_str_appendf(&sRes, cf=='I' ? "%02d" : "%2d", h);
+ break;
+ }
+ case 'j': { /* Day of year. Jan01==1, Jan02==2, and so forth */
+ sqlite3_str_appendf(&sRes,"%03d",daysAfterJan01(&x)+1);
+ break;
+ }
+ case 'J': { /* Julian day number. (Non-standard) */
+ sqlite3_str_appendf(&sRes,"%.16g",x.iJD/86400000.0);
+ break;
+ }
+ case 'm': {
+ sqlite3_str_appendf(&sRes,"%02d",x.M);
+ break;
+ }
+ case 'M': {
+ sqlite3_str_appendf(&sRes,"%02d",x.m);
+ break;
+ }
+ case 'p': /* Fall thru */
+ case 'P': {
+ if( x.h>=12 ){
+ sqlite3_str_append(&sRes, cf=='p' ? "PM" : "pm", 2);
+ }else{
+ sqlite3_str_append(&sRes, cf=='p' ? "AM" : "am", 2);
+ }
+ break;
+ }
+ case 'R': {
+ sqlite3_str_appendf(&sRes, "%02d:%02d", x.h, x.m);
+ break;
+ }
+ case 's': {
+ if( x.useSubsec ){
+ sqlite3_str_appendf(&sRes,"%.3f",
+ (x.iJD - 21086676*(i64)10000000)/1000.0);
+ }else{
+ i64 iS = (i64)(x.iJD/1000 - 21086676*(i64)10000);
+ sqlite3_str_appendf(&sRes,"%lld",iS);
+ }
+ break;
+ }
+ case 'S': {
+ sqlite3_str_appendf(&sRes,"%02d",(int)x.s);
+ break;
+ }
+ case 'T': {
+ sqlite3_str_appendf(&sRes,"%02d:%02d:%02d", x.h, x.m, (int)x.s);
+ break;
+ }
+ case 'u': /* Day of week. 1 to 7. Monday==1, Sunday==7 */
+ case 'w': { /* Day of week. 0 to 6. Sunday==0, Monday==1 */
+ char c = (char)daysAfterSunday(&x) + '0';
+ if( c=='0' && cf=='u' ) c = '7';
+ sqlite3_str_appendchar(&sRes, 1, c);
+ break;
+ }
+ case 'U': { /* Week num. 00-53. First Sun of the year is week 01 */
+ sqlite3_str_appendf(&sRes,"%02d",
+ (daysAfterJan01(&x)-daysAfterSunday(&x)+7)/7);
+ break;
+ }
+ case 'V': { /* Week num. 01-53. First week with a Thur is week 01 */
+ DateTime y = x;
+ /* Adjust y so that is the Thursday in the same week as x */
+ assert( y.validJD );
+ y.iJD += (3 - daysAfterMonday(&x))*86400000;
+ y.validYMD = 0;
+ computeYMD(&y);
+ sqlite3_str_appendf(&sRes,"%02d", daysAfterJan01(&y)/7+1);
+ break;
+ }
+ case 'W': { /* Week num. 00-53. First Mon of the year is week 01 */
+ sqlite3_str_appendf(&sRes,"%02d",
+ (daysAfterJan01(&x)-daysAfterMonday(&x)+7)/7);
+ break;
+ }
+ case 'Y': {
+ sqlite3_str_appendf(&sRes,"%04d",x.Y);
+ break;
+ }
+ case '%': {
+ sqlite3_str_appendchar(&sRes, 1, '%');
+ break;
+ }
+ default: {
+ sqlite3_str_reset(&sRes);
+ return;
+ }
+ }
+ }
+ if( j<i ) sqlite3_str_append(&sRes, zFmt+j, (int)(i-j));
+ sqlite3ResultStrAccum(context, &sRes);
+}
+
+/*
+** current_time()
+**
+** This function returns the same value as time('now').
+*/
+static void ctimeFunc(
+ sqlite3_context *context,
+ int NotUsed,
+ sqlite3_value **NotUsed2
+){
+ UNUSED_PARAMETER2(NotUsed, NotUsed2);
+ timeFunc(context, 0, 0);
+}
+
+/*
+** current_date()
+**
+** This function returns the same value as date('now').
+*/
+static void cdateFunc(
+ sqlite3_context *context,
+ int NotUsed,
+ sqlite3_value **NotUsed2
+){
+ UNUSED_PARAMETER2(NotUsed, NotUsed2);
+ dateFunc(context, 0, 0);
+}
+
+/*
+** timediff(DATE1, DATE2)
+**
+** Return the amount of time that must be added to DATE2 in order to
+** convert it into DATE2. The time difference format is:
+**
+** +YYYY-MM-DD HH:MM:SS.SSS
+**
+** The initial "+" becomes "-" if DATE1 occurs before DATE2. For
+** date/time values A and B, the following invariant should hold:
+**
+** datetime(A) == (datetime(B, timediff(A,B))
+**
+** Both DATE arguments must be either a julian day number, or an
+** ISO-8601 string. The unix timestamps are not supported by this
+** routine.
+*/
+static void timediffFunc(
+ sqlite3_context *context,
+ int NotUsed1,
+ sqlite3_value **argv
+){
+ char sign;
+ int Y, M;
+ DateTime d1, d2;
+ sqlite3_str sRes;
+ UNUSED_PARAMETER(NotUsed1);
+ if( isDate(context, 1, &argv[0], &d1) ) return;
+ if( isDate(context, 1, &argv[1], &d2) ) return;
+ computeYMD_HMS(&d1);
+ computeYMD_HMS(&d2);
+ if( d1.iJD>=d2.iJD ){
+ sign = '+';
+ Y = d1.Y - d2.Y;
+ if( Y ){
+ d2.Y = d1.Y;
+ d2.validJD = 0;
+ computeJD(&d2);
+ }
+ M = d1.M - d2.M;
+ if( M<0 ){
+ Y--;
+ M += 12;
+ }
+ if( M!=0 ){
+ d2.M = d1.M;
+ d2.validJD = 0;
+ computeJD(&d2);
+ }
+ while( d1.iJD<d2.iJD ){
+ M--;
+ if( M<0 ){
+ M = 11;
+ Y--;
+ }
+ d2.M--;
+ if( d2.M<1 ){
+ d2.M = 12;
+ d2.Y--;
+ }
+ d2.validJD = 0;
+ computeJD(&d2);
+ }
+ d1.iJD -= d2.iJD;
+ d1.iJD += (u64)1486995408 * (u64)100000;
+ }else /* d1<d2 */{
+ sign = '-';
+ Y = d2.Y - d1.Y;
+ if( Y ){
+ d2.Y = d1.Y;
+ d2.validJD = 0;
+ computeJD(&d2);
+ }
+ M = d2.M - d1.M;
+ if( M<0 ){
+ Y--;
+ M += 12;
+ }
+ if( M!=0 ){
+ d2.M = d1.M;
+ d2.validJD = 0;
+ computeJD(&d2);
+ }
+ while( d1.iJD>d2.iJD ){
+ M--;
+ if( M<0 ){
+ M = 11;
+ Y--;
+ }
+ d2.M++;
+ if( d2.M>12 ){
+ d2.M = 1;
+ d2.Y++;
+ }
+ d2.validJD = 0;
+ computeJD(&d2);
+ }
+ d1.iJD = d2.iJD - d1.iJD;
+ d1.iJD += (u64)1486995408 * (u64)100000;
+ }
+ clearYMD_HMS_TZ(&d1);
+ computeYMD_HMS(&d1);
+ sqlite3StrAccumInit(&sRes, 0, 0, 0, 100);
+ sqlite3_str_appendf(&sRes, "%c%04d-%02d-%02d %02d:%02d:%06.3f",
+ sign, Y, M, d1.D-1, d1.h, d1.m, d1.s);
+ sqlite3ResultStrAccum(context, &sRes);
+}
+
+
+/*
+** current_timestamp()
+**
+** This function returns the same value as datetime('now').
+*/
+static void ctimestampFunc(
+ sqlite3_context *context,
+ int NotUsed,
+ sqlite3_value **NotUsed2
+){
+ UNUSED_PARAMETER2(NotUsed, NotUsed2);
+ datetimeFunc(context, 0, 0);
+}
+#endif /* !defined(SQLITE_OMIT_DATETIME_FUNCS) */
+
+#ifdef SQLITE_OMIT_DATETIME_FUNCS
+/*
+** If the library is compiled to omit the full-scale date and time
+** handling (to get a smaller binary), the following minimal version
+** of the functions current_time(), current_date() and current_timestamp()
+** are included instead. This is to support column declarations that
+** include "DEFAULT CURRENT_TIME" etc.
+**
+** This function uses the C-library functions time(), gmtime()
+** and strftime(). The format string to pass to strftime() is supplied
+** as the user-data for the function.
+*/
+static void currentTimeFunc(
+ sqlite3_context *context,
+ int argc,
+ sqlite3_value **argv
+){
+ time_t t;
+ char *zFormat = (char *)sqlite3_user_data(context);
+ sqlite3_int64 iT;
+ struct tm *pTm;
+ struct tm sNow;
+ char zBuf[20];
+
+ UNUSED_PARAMETER(argc);
+ UNUSED_PARAMETER(argv);
+
+ iT = sqlite3StmtCurrentTime(context);
+ if( iT<=0 ) return;
+ t = iT/1000 - 10000*(sqlite3_int64)21086676;
+#if HAVE_GMTIME_R
+ pTm = gmtime_r(&t, &sNow);
+#else
+ sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MAIN));
+ pTm = gmtime(&t);
+ if( pTm ) memcpy(&sNow, pTm, sizeof(sNow));
+ sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MAIN));
+#endif
+ if( pTm ){
+ strftime(zBuf, 20, zFormat, &sNow);
+ sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);
+ }
+}
+#endif
+
+#if !defined(SQLITE_OMIT_DATETIME_FUNCS) && defined(SQLITE_DEBUG)
+/*
+** datedebug(...)
+**
+** This routine returns JSON that describes the internal DateTime object.
+** Used for debugging and testing only. Subject to change.
+*/
+static void datedebugFunc(
+ sqlite3_context *context,
+ int argc,
+ sqlite3_value **argv
+){
+ DateTime x;
+ if( isDate(context, argc, argv, &x)==0 ){
+ char *zJson;
+ zJson = sqlite3_mprintf(
+ "{iJD:%lld,Y:%d,M:%d,D:%d,h:%d,m:%d,tz:%d,"
+ "s:%.3f,validJD:%d,validYMS:%d,validHMS:%d,"
+ "nFloor:%d,rawS:%d,isError:%d,useSubsec:%d,"
+ "isUtc:%d,isLocal:%d}",
+ x.iJD, x.Y, x.M, x.D, x.h, x.m, x.tz,
+ x.s, x.validJD, x.validYMD, x.validHMS,
+ x.nFloor, x.rawS, x.isError, x.useSubsec,
+ x.isUtc, x.isLocal);
+ sqlite3_result_text(context, zJson, -1, sqlite3_free);
+ }
+}
+#endif /* !SQLITE_OMIT_DATETIME_FUNCS && SQLITE_DEBUG */
+
+
+/*
+** This function registered all of the above C functions as SQL
+** functions. This should be the only routine in this file with
+** external linkage.
+*/
+SQLITE_PRIVATE void sqlite3RegisterDateTimeFunctions(void){
+ static FuncDef aDateTimeFuncs[] = {
+#ifndef SQLITE_OMIT_DATETIME_FUNCS
+ PURE_DATE(julianday, -1, 0, 0, juliandayFunc ),
+ PURE_DATE(unixepoch, -1, 0, 0, unixepochFunc ),
+ PURE_DATE(date, -1, 0, 0, dateFunc ),
+ PURE_DATE(time, -1, 0, 0, timeFunc ),
+ PURE_DATE(datetime, -1, 0, 0, datetimeFunc ),
+ PURE_DATE(strftime, -1, 0, 0, strftimeFunc ),
+ PURE_DATE(timediff, 2, 0, 0, timediffFunc ),
+#ifdef SQLITE_DEBUG
+ PURE_DATE(datedebug, -1, 0, 0, datedebugFunc ),
+#endif
+ DFUNCTION(current_time, 0, 0, 0, ctimeFunc ),
+ DFUNCTION(current_timestamp, 0, 0, 0, ctimestampFunc),
+ DFUNCTION(current_date, 0, 0, 0, cdateFunc ),
+#else
+ STR_FUNCTION(current_time, 0, "%H:%M:%S", 0, currentTimeFunc),
+ STR_FUNCTION(current_date, 0, "%Y-%m-%d", 0, currentTimeFunc),
+ STR_FUNCTION(current_timestamp, 0, "%Y-%m-%d %H:%M:%S", 0, currentTimeFunc),
+#endif
+ };
+ sqlite3InsertBuiltinFuncs(aDateTimeFuncs, ArraySize(aDateTimeFuncs));
+}
+
+/************** End of date.c ************************************************/
+/************** Begin file os.c **********************************************/
+/*
+** 2005 November 29
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+******************************************************************************
+**
+** This file contains OS interface code that is common to all
+** architectures.
+*/
+/* #include "sqliteInt.h" */
+
+/*
+** If we compile with the SQLITE_TEST macro set, then the following block
+** of code will give us the ability to simulate a disk I/O error. This
+** is used for testing the I/O recovery logic.
+*/
+#if defined(SQLITE_TEST)
+SQLITE_API int sqlite3_io_error_hit = 0; /* Total number of I/O Errors */
+SQLITE_API int sqlite3_io_error_hardhit = 0; /* Number of non-benign errors */
+SQLITE_API int sqlite3_io_error_pending = 0; /* Count down to first I/O error */
+SQLITE_API int sqlite3_io_error_persist = 0; /* True if I/O errors persist */
+SQLITE_API int sqlite3_io_error_benign = 0; /* True if errors are benign */
+SQLITE_API int sqlite3_diskfull_pending = 0;
+SQLITE_API int sqlite3_diskfull = 0;
+#endif /* defined(SQLITE_TEST) */
+
+/*
+** When testing, also keep a count of the number of open files.
+*/
+#if defined(SQLITE_TEST)
+SQLITE_API int sqlite3_open_file_count = 0;
+#endif /* defined(SQLITE_TEST) */
+
+/*
+** The default SQLite sqlite3_vfs implementations do not allocate
+** memory (actually, os_unix.c allocates a small amount of memory
+** from within OsOpen()), but some third-party implementations may.
+** So we test the effects of a malloc() failing and the sqlite3OsXXX()
+** function returning SQLITE_IOERR_NOMEM using the DO_OS_MALLOC_TEST macro.
+**
+** The following functions are instrumented for malloc() failure
+** testing:
+**
+** sqlite3OsRead()
+** sqlite3OsWrite()
+** sqlite3OsSync()
+** sqlite3OsFileSize()
+** sqlite3OsLock()
+** sqlite3OsCheckReservedLock()
+** sqlite3OsFileControl()
+** sqlite3OsShmMap()
+** sqlite3OsOpen()
+** sqlite3OsDelete()
+** sqlite3OsAccess()
+** sqlite3OsFullPathname()
+**
+*/
+#if defined(SQLITE_TEST)
+SQLITE_API int sqlite3_memdebug_vfs_oom_test = 1;
+ #define DO_OS_MALLOC_TEST(x) \
+ if (sqlite3_memdebug_vfs_oom_test && (!x || !sqlite3JournalIsInMemory(x))) { \
+ void *pTstAlloc = sqlite3Malloc(10); \
+ if (!pTstAlloc) return SQLITE_IOERR_NOMEM_BKPT; \
+ sqlite3_free(pTstAlloc); \
+ }
+#else
+ #define DO_OS_MALLOC_TEST(x)
+#endif
+
+/*
+** The following routines are convenience wrappers around methods
+** of the sqlite3_file object. This is mostly just syntactic sugar. All
+** of this would be completely automatic if SQLite were coded using
+** C++ instead of plain old C.
+*/
+SQLITE_PRIVATE void sqlite3OsClose(sqlite3_file *pId){
+ if( pId->pMethods ){
+ pId->pMethods->xClose(pId);
+ pId->pMethods = 0;
+ }
+}
+SQLITE_PRIVATE int sqlite3OsRead(sqlite3_file *id, void *pBuf, int amt, i64 offset){
+ DO_OS_MALLOC_TEST(id);
+ return id->pMethods->xRead(id, pBuf, amt, offset);
+}
+SQLITE_PRIVATE int sqlite3OsWrite(sqlite3_file *id, const void *pBuf, int amt, i64 offset){
+ DO_OS_MALLOC_TEST(id);
+ return id->pMethods->xWrite(id, pBuf, amt, offset);
+}
+SQLITE_PRIVATE int sqlite3OsTruncate(sqlite3_file *id, i64 size){
+ return id->pMethods->xTruncate(id, size);
+}
+SQLITE_PRIVATE int sqlite3OsSync(sqlite3_file *id, int flags){
+ DO_OS_MALLOC_TEST(id);
+ return flags ? id->pMethods->xSync(id, flags) : SQLITE_OK;
+}
+SQLITE_PRIVATE int sqlite3OsFileSize(sqlite3_file *id, i64 *pSize){
+ DO_OS_MALLOC_TEST(id);
+ return id->pMethods->xFileSize(id, pSize);
+}
+SQLITE_PRIVATE int sqlite3OsLock(sqlite3_file *id, int lockType){
+ DO_OS_MALLOC_TEST(id);
+ assert( lockType>=SQLITE_LOCK_SHARED && lockType<=SQLITE_LOCK_EXCLUSIVE );
+ return id->pMethods->xLock(id, lockType);
+}
+SQLITE_PRIVATE int sqlite3OsUnlock(sqlite3_file *id, int lockType){
+ assert( lockType==SQLITE_LOCK_NONE || lockType==SQLITE_LOCK_SHARED );
+ return id->pMethods->xUnlock(id, lockType);
+}
+SQLITE_PRIVATE int sqlite3OsCheckReservedLock(sqlite3_file *id, int *pResOut){
+ DO_OS_MALLOC_TEST(id);
+ return id->pMethods->xCheckReservedLock(id, pResOut);
+}
+
+/*
+** Use sqlite3OsFileControl() when we are doing something that might fail
+** and we need to know about the failures. Use sqlite3OsFileControlHint()
+** when simply tossing information over the wall to the VFS and we do not
+** really care if the VFS receives and understands the information since it
+** is only a hint and can be safely ignored. The sqlite3OsFileControlHint()
+** routine has no return value since the return value would be meaningless.
+*/
+SQLITE_PRIVATE int sqlite3OsFileControl(sqlite3_file *id, int op, void *pArg){
+ if( id->pMethods==0 ) return SQLITE_NOTFOUND;
+#ifdef SQLITE_TEST
+ if( op!=SQLITE_FCNTL_COMMIT_PHASETWO
+ && op!=SQLITE_FCNTL_LOCK_TIMEOUT
+ && op!=SQLITE_FCNTL_CKPT_DONE
+ && op!=SQLITE_FCNTL_CKPT_START
+ ){
+ /* Faults are not injected into COMMIT_PHASETWO because, assuming SQLite
+ ** is using a regular VFS, it is called after the corresponding
+ ** transaction has been committed. Injecting a fault at this point
+ ** confuses the test scripts - the COMMIT command returns SQLITE_NOMEM
+ ** but the transaction is committed anyway.
+ **
+ ** The core must call OsFileControl() though, not OsFileControlHint(),
+ ** as if a custom VFS (e.g. zipvfs) returns an error here, it probably
+ ** means the commit really has failed and an error should be returned
+ ** to the user.
+ **
+ ** The CKPT_DONE and CKPT_START file-controls are write-only signals
+ ** to the cksumvfs. Their return code is meaningless and is ignored
+ ** by the SQLite core, so there is no point in simulating OOMs for them.
+ */
+ DO_OS_MALLOC_TEST(id);
+ }
+#endif
+ return id->pMethods->xFileControl(id, op, pArg);
+}
+SQLITE_PRIVATE void sqlite3OsFileControlHint(sqlite3_file *id, int op, void *pArg){
+ if( id->pMethods ) (void)id->pMethods->xFileControl(id, op, pArg);
+}
+
+SQLITE_PRIVATE int sqlite3OsSectorSize(sqlite3_file *id){
+ int (*xSectorSize)(sqlite3_file*) = id->pMethods->xSectorSize;
+ return (xSectorSize ? xSectorSize(id) : SQLITE_DEFAULT_SECTOR_SIZE);
+}
+SQLITE_PRIVATE int sqlite3OsDeviceCharacteristics(sqlite3_file *id){
+ if( NEVER(id->pMethods==0) ) return 0;
+ return id->pMethods->xDeviceCharacteristics(id);
+}
+#ifndef SQLITE_OMIT_WAL
+SQLITE_PRIVATE int sqlite3OsShmLock(sqlite3_file *id, int offset, int n, int flags){
+ return id->pMethods->xShmLock(id, offset, n, flags);
+}
+SQLITE_PRIVATE void sqlite3OsShmBarrier(sqlite3_file *id){
+ id->pMethods->xShmBarrier(id);
+}
+SQLITE_PRIVATE int sqlite3OsShmUnmap(sqlite3_file *id, int deleteFlag){
+ return id->pMethods->xShmUnmap(id, deleteFlag);
+}
+SQLITE_PRIVATE int sqlite3OsShmMap(
+ sqlite3_file *id, /* Database file handle */
+ int iPage,
+ int pgsz,
+ int bExtend, /* True to extend file if necessary */
+ void volatile **pp /* OUT: Pointer to mapping */
+){
+ DO_OS_MALLOC_TEST(id);
+ return id->pMethods->xShmMap(id, iPage, pgsz, bExtend, pp);
+}
+#endif /* SQLITE_OMIT_WAL */
+
+#if SQLITE_MAX_MMAP_SIZE>0
+/* The real implementation of xFetch and xUnfetch */
+SQLITE_PRIVATE int sqlite3OsFetch(sqlite3_file *id, i64 iOff, int iAmt, void **pp){
+ DO_OS_MALLOC_TEST(id);
+ return id->pMethods->xFetch(id, iOff, iAmt, pp);
+}
+SQLITE_PRIVATE int sqlite3OsUnfetch(sqlite3_file *id, i64 iOff, void *p){
+ return id->pMethods->xUnfetch(id, iOff, p);
+}
+#else
+/* No-op stubs to use when memory-mapped I/O is disabled */
+SQLITE_PRIVATE int sqlite3OsFetch(sqlite3_file *id, i64 iOff, int iAmt, void **pp){
+ *pp = 0;
+ return SQLITE_OK;
+}
+SQLITE_PRIVATE int sqlite3OsUnfetch(sqlite3_file *id, i64 iOff, void *p){
+ return SQLITE_OK;
+}
+#endif
+
+/*
+** The next group of routines are convenience wrappers around the
+** VFS methods.
+*/
+SQLITE_PRIVATE int sqlite3OsOpen(
+ sqlite3_vfs *pVfs,
+ const char *zPath,
+ sqlite3_file *pFile,
+ int flags,
+ int *pFlagsOut
+){
+ int rc;
+ DO_OS_MALLOC_TEST(0);
+ /* 0x87f7f is a mask of SQLITE_OPEN_ flags that are valid to be passed
+ ** down into the VFS layer. Some SQLITE_OPEN_ flags (for example,
+ ** SQLITE_OPEN_FULLMUTEX or SQLITE_OPEN_SHAREDCACHE) are blocked before
+ ** reaching the VFS. */
+ assert( zPath || (flags & SQLITE_OPEN_EXCLUSIVE) );
+ rc = pVfs->xOpen(pVfs, zPath, pFile, flags & 0x1087f7f, pFlagsOut);
+ assert( rc==SQLITE_OK || pFile->pMethods==0 );
+ return rc;
+}
+SQLITE_PRIVATE int sqlite3OsDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){
+ DO_OS_MALLOC_TEST(0);
+ assert( dirSync==0 || dirSync==1 );
+ return pVfs->xDelete!=0 ? pVfs->xDelete(pVfs, zPath, dirSync) : SQLITE_OK;
+}
+SQLITE_PRIVATE int sqlite3OsAccess(
+ sqlite3_vfs *pVfs,
+ const char *zPath,
+ int flags,
+ int *pResOut
+){
+ DO_OS_MALLOC_TEST(0);
+ return pVfs->xAccess(pVfs, zPath, flags, pResOut);
+}
+SQLITE_PRIVATE int sqlite3OsFullPathname(
+ sqlite3_vfs *pVfs,
+ const char *zPath,
+ int nPathOut,
+ char *zPathOut
+){
+ DO_OS_MALLOC_TEST(0);
+ zPathOut[0] = 0;
+ return pVfs->xFullPathname(pVfs, zPath, nPathOut, zPathOut);
+}
+#ifndef SQLITE_OMIT_LOAD_EXTENSION
+SQLITE_PRIVATE void *sqlite3OsDlOpen(sqlite3_vfs *pVfs, const char *zPath){
+ assert( zPath!=0 );
+ assert( strlen(zPath)<=SQLITE_MAX_PATHLEN ); /* tag-20210611-1 */
+ return pVfs->xDlOpen(pVfs, zPath);
+}
+SQLITE_PRIVATE void sqlite3OsDlError(sqlite3_vfs *pVfs, int nByte, char *zBufOut){
+ pVfs->xDlError(pVfs, nByte, zBufOut);
+}
+SQLITE_PRIVATE void (*sqlite3OsDlSym(sqlite3_vfs *pVfs, void *pHdle, const char *zSym))(void){
+ return pVfs->xDlSym(pVfs, pHdle, zSym);
+}
+SQLITE_PRIVATE void sqlite3OsDlClose(sqlite3_vfs *pVfs, void *pHandle){
+ pVfs->xDlClose(pVfs, pHandle);
+}
+#endif /* SQLITE_OMIT_LOAD_EXTENSION */
+SQLITE_PRIVATE int sqlite3OsRandomness(sqlite3_vfs *pVfs, int nByte, char *zBufOut){
+ if( sqlite3Config.iPrngSeed ){
+ memset(zBufOut, 0, nByte);
+ if( ALWAYS(nByte>(signed)sizeof(unsigned)) ) nByte = sizeof(unsigned int);
+ memcpy(zBufOut, &sqlite3Config.iPrngSeed, nByte);
+ return SQLITE_OK;
+ }else{
+ return pVfs->xRandomness(pVfs, nByte, zBufOut);
+ }
+
+}
+SQLITE_PRIVATE int sqlite3OsSleep(sqlite3_vfs *pVfs, int nMicro){
+ return pVfs->xSleep(pVfs, nMicro);
+}
+SQLITE_PRIVATE int sqlite3OsGetLastError(sqlite3_vfs *pVfs){
+ return pVfs->xGetLastError ? pVfs->xGetLastError(pVfs, 0, 0) : 0;
+}
+SQLITE_PRIVATE int sqlite3OsCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *pTimeOut){
+ int rc;
+ /* IMPLEMENTATION-OF: R-49045-42493 SQLite will use the xCurrentTimeInt64()
+ ** method to get the current date and time if that method is available
+ ** (if iVersion is 2 or greater and the function pointer is not NULL) and
+ ** will fall back to xCurrentTime() if xCurrentTimeInt64() is
+ ** unavailable.
+ */
+ if( pVfs->iVersion>=2 && pVfs->xCurrentTimeInt64 ){
+ rc = pVfs->xCurrentTimeInt64(pVfs, pTimeOut);
+ }else{
+ double r;
+ rc = pVfs->xCurrentTime(pVfs, &r);
+ *pTimeOut = (sqlite3_int64)(r*86400000.0);
+ }
+ return rc;
+}
+
+SQLITE_PRIVATE int sqlite3OsOpenMalloc(
+ sqlite3_vfs *pVfs,
+ const char *zFile,
+ sqlite3_file **ppFile,
+ int flags,
+ int *pOutFlags
+){
+ int rc;
+ sqlite3_file *pFile;
+ pFile = (sqlite3_file *)sqlite3MallocZero(pVfs->szOsFile);
+ if( pFile ){
+ rc = sqlite3OsOpen(pVfs, zFile, pFile, flags, pOutFlags);
+ if( rc!=SQLITE_OK ){
+ sqlite3_free(pFile);
+ *ppFile = 0;
+ }else{
+ *ppFile = pFile;
+ }
+ }else{
+ *ppFile = 0;
+ rc = SQLITE_NOMEM_BKPT;
+ }
+ assert( *ppFile!=0 || rc!=SQLITE_OK );
+ return rc;
+}
+SQLITE_PRIVATE void sqlite3OsCloseFree(sqlite3_file *pFile){
+ assert( pFile );
+ sqlite3OsClose(pFile);
+ sqlite3_free(pFile);
+}
+
+/*
+** This function is a wrapper around the OS specific implementation of
+** sqlite3_os_init(). The purpose of the wrapper is to provide the
+** ability to simulate a malloc failure, so that the handling of an
+** error in sqlite3_os_init() by the upper layers can be tested.
+*/
+SQLITE_PRIVATE int sqlite3OsInit(void){
+ void *p = sqlite3_malloc(10);
+ if( p==0 ) return SQLITE_NOMEM_BKPT;
+ sqlite3_free(p);
+ return sqlite3_os_init();
+}
+
+/*
+** The list of all registered VFS implementations.
+*/
+static sqlite3_vfs * SQLITE_WSD vfsList = 0;
+#define vfsList GLOBAL(sqlite3_vfs *, vfsList)
+
+/*
+** Locate a VFS by name. If no name is given, simply return the
+** first VFS on the list.
+*/
+SQLITE_API sqlite3_vfs *sqlite3_vfs_find(const char *zVfs){
+ sqlite3_vfs *pVfs = 0;
+#if SQLITE_THREADSAFE
+ sqlite3_mutex *mutex;
+#endif
+#ifndef SQLITE_OMIT_AUTOINIT
+ int rc = sqlite3_initialize();
+ if( rc ) return 0;
+#endif
+#if SQLITE_THREADSAFE
+ mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MAIN);
+#endif
+ sqlite3_mutex_enter(mutex);
+ for(pVfs = vfsList; pVfs; pVfs=pVfs->pNext){
+ if( zVfs==0 ) break;
+ if( strcmp(zVfs, pVfs->zName)==0 ) break;
+ }
+ sqlite3_mutex_leave(mutex);
+ return pVfs;
+}
+
+/*
+** Unlink a VFS from the linked list
+*/
+static void vfsUnlink(sqlite3_vfs *pVfs){
+ assert( sqlite3_mutex_held(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MAIN)) );
+ if( pVfs==0 ){
+ /* No-op */
+ }else if( vfsList==pVfs ){
+ vfsList = pVfs->pNext;
+ }else if( vfsList ){
+ sqlite3_vfs *p = vfsList;
+ while( p->pNext && p->pNext!=pVfs ){
+ p = p->pNext;
+ }
+ if( p->pNext==pVfs ){
+ p->pNext = pVfs->pNext;
+ }
+ }
+}
+
+/*
+** Register a VFS with the system. It is harmless to register the same
+** VFS multiple times. The new VFS becomes the default if makeDflt is
+** true.
+*/
+SQLITE_API int sqlite3_vfs_register(sqlite3_vfs *pVfs, int makeDflt){
+ MUTEX_LOGIC(sqlite3_mutex *mutex;)
+#ifndef SQLITE_OMIT_AUTOINIT
+ int rc = sqlite3_initialize();
+ if( rc ) return rc;
+#endif
+#ifdef SQLITE_ENABLE_API_ARMOR
+ if( pVfs==0 ) return SQLITE_MISUSE_BKPT;
+#endif
+
+ MUTEX_LOGIC( mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MAIN); )
+ sqlite3_mutex_enter(mutex);
+ vfsUnlink(pVfs);
+ if( makeDflt || vfsList==0 ){
+ pVfs->pNext = vfsList;
+ vfsList = pVfs;
+ }else{
+ pVfs->pNext = vfsList->pNext;
+ vfsList->pNext = pVfs;
+ }
+ assert(vfsList);
+ sqlite3_mutex_leave(mutex);
+ return SQLITE_OK;
+}
+
+/*
+** Unregister a VFS so that it is no longer accessible.
+*/
+SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs *pVfs){
+ MUTEX_LOGIC(sqlite3_mutex *mutex;)
+#ifndef SQLITE_OMIT_AUTOINIT
+ int rc = sqlite3_initialize();
+ if( rc ) return rc;
+#endif
+ MUTEX_LOGIC( mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MAIN); )
+ sqlite3_mutex_enter(mutex);
+ vfsUnlink(pVfs);
+ sqlite3_mutex_leave(mutex);
+ return SQLITE_OK;
+}
+
+/************** End of os.c **************************************************/
+/************** Begin file fault.c *******************************************/
+/*
+** 2008 Jan 22
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+**
+** This file contains code to support the concept of "benign"
+** malloc failures (when the xMalloc() or xRealloc() method of the
+** sqlite3_mem_methods structure fails to allocate a block of memory
+** and returns 0).
+**
+** Most malloc failures are non-benign. After they occur, SQLite
+** abandons the current operation and returns an error code (usually
+** SQLITE_NOMEM) to the user. However, sometimes a fault is not necessarily
+** fatal. For example, if a malloc fails while resizing a hash table, this
+** is completely recoverable simply by not carrying out the resize. The
+** hash table will continue to function normally. So a malloc failure
+** during a hash table resize is a benign fault.
+*/
+
+/* #include "sqliteInt.h" */
+
+#ifndef SQLITE_UNTESTABLE
+
+/*
+** Global variables.
+*/
+typedef struct BenignMallocHooks BenignMallocHooks;
+static SQLITE_WSD struct BenignMallocHooks {
+ void (*xBenignBegin)(void);
+ void (*xBenignEnd)(void);
+} sqlite3Hooks = { 0, 0 };
+
+/* The "wsdHooks" macro will resolve to the appropriate BenignMallocHooks
+** structure. If writable static data is unsupported on the target,
+** we have to locate the state vector at run-time. In the more common
+** case where writable static data is supported, wsdHooks can refer directly
+** to the "sqlite3Hooks" state vector declared above.
+*/
+#ifdef SQLITE_OMIT_WSD
+# define wsdHooksInit \
+ BenignMallocHooks *x = &GLOBAL(BenignMallocHooks,sqlite3Hooks)
+# define wsdHooks x[0]
+#else
+# define wsdHooksInit
+# define wsdHooks sqlite3Hooks
+#endif
+
+
+/*
+** Register hooks to call when sqlite3BeginBenignMalloc() and
+** sqlite3EndBenignMalloc() are called, respectively.
+*/
+SQLITE_PRIVATE void sqlite3BenignMallocHooks(
+ void (*xBenignBegin)(void),
+ void (*xBenignEnd)(void)
+){
+ wsdHooksInit;
+ wsdHooks.xBenignBegin = xBenignBegin;
+ wsdHooks.xBenignEnd = xBenignEnd;
+}
+
+/*
+** This (sqlite3EndBenignMalloc()) is called by SQLite code to indicate that
+** subsequent malloc failures are benign. A call to sqlite3EndBenignMalloc()
+** indicates that subsequent malloc failures are non-benign.
+*/
+SQLITE_PRIVATE void sqlite3BeginBenignMalloc(void){
+ wsdHooksInit;
+ if( wsdHooks.xBenignBegin ){
+ wsdHooks.xBenignBegin();
+ }
+}
+SQLITE_PRIVATE void sqlite3EndBenignMalloc(void){
+ wsdHooksInit;
+ if( wsdHooks.xBenignEnd ){
+ wsdHooks.xBenignEnd();
+ }
+}
+
+#endif /* #ifndef SQLITE_UNTESTABLE */
+
+/************** End of fault.c ***********************************************/
+/************** Begin file mem0.c ********************************************/
+/*
+** 2008 October 28
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+**
+** This file contains a no-op memory allocation drivers for use when
+** SQLITE_ZERO_MALLOC is defined. The allocation drivers implemented
+** here always fail. SQLite will not operate with these drivers. These
+** are merely placeholders. Real drivers must be substituted using
+** sqlite3_config() before SQLite will operate.
+*/
+/* #include "sqliteInt.h" */
+
+/*
+** This version of the memory allocator is the default. It is
+** used when no other memory allocator is specified using compile-time
+** macros.
+*/
+#ifdef SQLITE_ZERO_MALLOC
+
+/*
+** No-op versions of all memory allocation routines
+*/
+static void *sqlite3MemMalloc(int nByte){ return 0; }
+static void sqlite3MemFree(void *pPrior){ return; }
+static void *sqlite3MemRealloc(void *pPrior, int nByte){ return 0; }
+static int sqlite3MemSize(void *pPrior){ return 0; }
+static int sqlite3MemRoundup(int n){ return n; }
+static int sqlite3MemInit(void *NotUsed){ return SQLITE_OK; }
+static void sqlite3MemShutdown(void *NotUsed){ return; }
+
+/*
+** This routine is the only routine in this file with external linkage.
+**
+** Populate the low-level memory allocation function pointers in
+** sqlite3GlobalConfig.m with pointers to the routines in this file.
+*/
+SQLITE_PRIVATE void sqlite3MemSetDefault(void){
+ static const sqlite3_mem_methods defaultMethods = {
+ sqlite3MemMalloc,
+ sqlite3MemFree,
+ sqlite3MemRealloc,
+ sqlite3MemSize,
+ sqlite3MemRoundup,
+ sqlite3MemInit,
+ sqlite3MemShutdown,
+ 0
+ };
+ sqlite3_config(SQLITE_CONFIG_MALLOC, &defaultMethods);
+}
+
+#endif /* SQLITE_ZERO_MALLOC */
+
+/************** End of mem0.c ************************************************/
+/************** Begin file mem1.c ********************************************/
+/*
+** 2007 August 14
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+**
+** This file contains low-level memory allocation drivers for when
+** SQLite will use the standard C-library malloc/realloc/free interface
+** to obtain the memory it needs.
+**
+** This file contains implementations of the low-level memory allocation
+** routines specified in the sqlite3_mem_methods object. The content of
+** this file is only used if SQLITE_SYSTEM_MALLOC is defined. The
+** SQLITE_SYSTEM_MALLOC macro is defined automatically if neither the
+** SQLITE_MEMDEBUG nor the SQLITE_WIN32_MALLOC macros are defined. The
+** default configuration is to use memory allocation routines in this
+** file.
+**
+** C-preprocessor macro summary:
+**
+** HAVE_MALLOC_USABLE_SIZE The configure script sets this symbol if
+** the malloc_usable_size() interface exists
+** on the target platform. Or, this symbol
+** can be set manually, if desired.
+** If an equivalent interface exists by
+** a different name, using a separate -D
+** option to rename it.
+**
+** SQLITE_WITHOUT_ZONEMALLOC Some older macs lack support for the zone
+** memory allocator. Set this symbol to enable
+** building on older macs.
+**
+** SQLITE_WITHOUT_MSIZE Set this symbol to disable the use of
+** _msize() on windows systems. This might
+** be necessary when compiling for Delphi,
+** for example.
+*/
+/* #include "sqliteInt.h" */
+
+/*
+** This version of the memory allocator is the default. It is
+** used when no other memory allocator is specified using compile-time
+** macros.
+*/
+#ifdef SQLITE_SYSTEM_MALLOC
+#if defined(__APPLE__) && !defined(SQLITE_WITHOUT_ZONEMALLOC)
+
+/*
+** Use the zone allocator available on apple products unless the
+** SQLITE_WITHOUT_ZONEMALLOC symbol is defined.
+*/
+#include <sys/sysctl.h>
+#include <malloc/malloc.h>
+#ifdef SQLITE_MIGHT_BE_SINGLE_CORE
+#include <libkern/OSAtomic.h>
+#endif /* SQLITE_MIGHT_BE_SINGLE_CORE */
+static malloc_zone_t* _sqliteZone_;
+#define SQLITE_MALLOC(x) malloc_zone_malloc(_sqliteZone_, (x))
+#define SQLITE_FREE(x) malloc_zone_free(_sqliteZone_, (x));
+#define SQLITE_REALLOC(x,y) malloc_zone_realloc(_sqliteZone_, (x), (y))
+#define SQLITE_MALLOCSIZE(x) \
+ (_sqliteZone_ ? _sqliteZone_->size(_sqliteZone_,x) : malloc_size(x))
+
+#else /* if not __APPLE__ */
+
+/*
+** Use standard C library malloc and free on non-Apple systems.
+** Also used by Apple systems if SQLITE_WITHOUT_ZONEMALLOC is defined.
+*/
+#define SQLITE_MALLOC(x) malloc(x)
+#define SQLITE_FREE(x) free(x)
+#define SQLITE_REALLOC(x,y) realloc((x),(y))
+
+/*
+** The malloc.h header file is needed for malloc_usable_size() function
+** on some systems (e.g. Linux).
+*/
+#if HAVE_MALLOC_H && HAVE_MALLOC_USABLE_SIZE
+# define SQLITE_USE_MALLOC_H 1
+# define SQLITE_USE_MALLOC_USABLE_SIZE 1
+/*
+** The MSVCRT has malloc_usable_size(), but it is called _msize(). The
+** use of _msize() is automatic, but can be disabled by compiling with
+** -DSQLITE_WITHOUT_MSIZE. Using the _msize() function also requires
+** the malloc.h header file.
+*/
+#elif defined(_MSC_VER) && !defined(SQLITE_WITHOUT_MSIZE)
+# define SQLITE_USE_MALLOC_H
+# define SQLITE_USE_MSIZE
+#endif
+
+/*
+** Include the malloc.h header file, if necessary. Also set define macro
+** SQLITE_MALLOCSIZE to the appropriate function name, which is _msize()
+** for MSVC and malloc_usable_size() for most other systems (e.g. Linux).
+** The memory size function can always be overridden manually by defining
+** the macro SQLITE_MALLOCSIZE to the desired function name.
+*/
+#if defined(SQLITE_USE_MALLOC_H)
+# include <malloc.h>
+# if defined(SQLITE_USE_MALLOC_USABLE_SIZE)
+# if !defined(SQLITE_MALLOCSIZE)
+# define SQLITE_MALLOCSIZE(x) malloc_usable_size(x)
+# endif
+# elif defined(SQLITE_USE_MSIZE)
+# if !defined(SQLITE_MALLOCSIZE)
+# define SQLITE_MALLOCSIZE _msize
+# endif
+# endif
+#endif /* defined(SQLITE_USE_MALLOC_H) */
+
+#endif /* __APPLE__ or not __APPLE__ */
+
+/*
+** Like malloc(), but remember the size of the allocation
+** so that we can find it later using sqlite3MemSize().
+**
+** For this low-level routine, we are guaranteed that nByte>0 because
+** cases of nByte<=0 will be intercepted and dealt with by higher level
+** routines.
+*/
+static void *sqlite3MemMalloc(int nByte){
+#ifdef SQLITE_MALLOCSIZE
+ void *p;
+ testcase( ROUND8(nByte)==nByte );
+ p = SQLITE_MALLOC( nByte );
+ if( p==0 ){
+ testcase( sqlite3GlobalConfig.xLog!=0 );
+ sqlite3_log(SQLITE_NOMEM, "failed to allocate %u bytes of memory", nByte);
+ }
+ return p;
+#else
+ sqlite3_int64 *p;
+ assert( nByte>0 );
+ testcase( ROUND8(nByte)!=nByte );
+ p = SQLITE_MALLOC( nByte+8 );
+ if( p ){
+ p[0] = nByte;
+ p++;
+ }else{
+ testcase( sqlite3GlobalConfig.xLog!=0 );
+ sqlite3_log(SQLITE_NOMEM, "failed to allocate %u bytes of memory", nByte);
+ }
+ return (void *)p;
+#endif
+}
+
+/*
+** Like free() but works for allocations obtained from sqlite3MemMalloc()
+** or sqlite3MemRealloc().
+**
+** For this low-level routine, we already know that pPrior!=0 since
+** cases where pPrior==0 will have been intercepted and dealt with
+** by higher-level routines.
+*/
+static void sqlite3MemFree(void *pPrior){
+#ifdef SQLITE_MALLOCSIZE
+ SQLITE_FREE(pPrior);
+#else
+ sqlite3_int64 *p = (sqlite3_int64*)pPrior;
+ assert( pPrior!=0 );
+ p--;
+ SQLITE_FREE(p);
+#endif
+}
+
+/*
+** Report the allocated size of a prior return from xMalloc()
+** or xRealloc().
+*/
+static int sqlite3MemSize(void *pPrior){
+#ifdef SQLITE_MALLOCSIZE
+ assert( pPrior!=0 );
+ return (int)SQLITE_MALLOCSIZE(pPrior);
+#else
+ sqlite3_int64 *p;
+ assert( pPrior!=0 );
+ p = (sqlite3_int64*)pPrior;
+ p--;
+ return (int)p[0];
+#endif
+}
+
+/*
+** Like realloc(). Resize an allocation previously obtained from
+** sqlite3MemMalloc().
+**
+** For this low-level interface, we know that pPrior!=0. Cases where
+** pPrior==0 while have been intercepted by higher-level routine and
+** redirected to xMalloc. Similarly, we know that nByte>0 because
+** cases where nByte<=0 will have been intercepted by higher-level
+** routines and redirected to xFree.
+*/
+static void *sqlite3MemRealloc(void *pPrior, int nByte){
+#ifdef SQLITE_MALLOCSIZE
+ void *p = SQLITE_REALLOC(pPrior, nByte);
+ if( p==0 ){
+ testcase( sqlite3GlobalConfig.xLog!=0 );
+ sqlite3_log(SQLITE_NOMEM,
+ "failed memory resize %u to %u bytes",
+ SQLITE_MALLOCSIZE(pPrior), nByte);
+ }
+ return p;
+#else
+ sqlite3_int64 *p = (sqlite3_int64*)pPrior;
+ assert( pPrior!=0 && nByte>0 );
+ assert( nByte==ROUND8(nByte) ); /* EV: R-46199-30249 */
+ p--;
+ p = SQLITE_REALLOC(p, nByte+8 );
+ if( p ){
+ p[0] = nByte;
+ p++;
+ }else{
+ testcase( sqlite3GlobalConfig.xLog!=0 );
+ sqlite3_log(SQLITE_NOMEM,
+ "failed memory resize %u to %u bytes",
+ sqlite3MemSize(pPrior), nByte);
+ }
+ return (void*)p;
+#endif
+}
+
+/*
+** Round up a request size to the next valid allocation size.
+*/
+static int sqlite3MemRoundup(int n){
+ return ROUND8(n);
+}
+
+/*
+** Initialize this module.
+*/
+static int sqlite3MemInit(void *NotUsed){
+#if defined(__APPLE__) && !defined(SQLITE_WITHOUT_ZONEMALLOC)
+ int cpuCount;
+ size_t len;
+ if( _sqliteZone_ ){
+ return SQLITE_OK;
+ }
+ len = sizeof(cpuCount);
+ /* One usually wants to use hw.activecpu for MT decisions, but not here */
+ sysctlbyname("hw.ncpu", &cpuCount, &len, NULL, 0);
+ if( cpuCount>1 ){
+ /* defer MT decisions to system malloc */
+ _sqliteZone_ = malloc_default_zone();
+ }else{
+ /* only 1 core, use our own zone to contention over global locks,
+ ** e.g. we have our own dedicated locks */
+ _sqliteZone_ = malloc_create_zone(4096, 0);
+ malloc_set_zone_name(_sqliteZone_, "Sqlite_Heap");
+ }
+#endif /* defined(__APPLE__) && !defined(SQLITE_WITHOUT_ZONEMALLOC) */
+ UNUSED_PARAMETER(NotUsed);
+ return SQLITE_OK;
+}
+
+/*
+** Deinitialize this module.
+*/
+static void sqlite3MemShutdown(void *NotUsed){
+ UNUSED_PARAMETER(NotUsed);
+ return;
+}
+
+/*
+** This routine is the only routine in this file with external linkage.
+**
+** Populate the low-level memory allocation function pointers in
+** sqlite3GlobalConfig.m with pointers to the routines in this file.
+*/
+SQLITE_PRIVATE void sqlite3MemSetDefault(void){
+ static const sqlite3_mem_methods defaultMethods = {
+ sqlite3MemMalloc,
+ sqlite3MemFree,
+ sqlite3MemRealloc,
+ sqlite3MemSize,
+ sqlite3MemRoundup,
+ sqlite3MemInit,
+ sqlite3MemShutdown,
+ 0
+ };
+ sqlite3_config(SQLITE_CONFIG_MALLOC, &defaultMethods);
+}
+
+#endif /* SQLITE_SYSTEM_MALLOC */
+
+/************** End of mem1.c ************************************************/
+/************** Begin file mem2.c ********************************************/
+/*
+** 2007 August 15
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+**
+** This file contains low-level memory allocation drivers for when
+** SQLite will use the standard C-library malloc/realloc/free interface
+** to obtain the memory it needs while adding lots of additional debugging
+** information to each allocation in order to help detect and fix memory
+** leaks and memory usage errors.
+**
+** This file contains implementations of the low-level memory allocation
+** routines specified in the sqlite3_mem_methods object.
+*/
+/* #include "sqliteInt.h" */
+
+/*
+** This version of the memory allocator is used only if the
+** SQLITE_MEMDEBUG macro is defined
+*/
+#ifdef SQLITE_MEMDEBUG
+
+/*
+** The backtrace functionality is only available with GLIBC
+*/
+#ifdef __GLIBC__
+ extern int backtrace(void**,int);
+ extern void backtrace_symbols_fd(void*const*,int,int);
+#else
+# define backtrace(A,B) 1
+# define backtrace_symbols_fd(A,B,C)
+#endif
+/* #include <stdio.h> */
+
+/*
+** Each memory allocation looks like this:
+**
+** ------------------------------------------------------------------------
+** | Title | backtrace pointers | MemBlockHdr | allocation | EndGuard |
+** ------------------------------------------------------------------------
+**
+** The application code sees only a pointer to the allocation. We have
+** to back up from the allocation pointer to find the MemBlockHdr. The
+** MemBlockHdr tells us the size of the allocation and the number of
+** backtrace pointers. There is also a guard word at the end of the
+** MemBlockHdr.
+*/
+struct MemBlockHdr {
+ i64 iSize; /* Size of this allocation */
+ struct MemBlockHdr *pNext, *pPrev; /* Linked list of all unfreed memory */
+ char nBacktrace; /* Number of backtraces on this alloc */
+ char nBacktraceSlots; /* Available backtrace slots */
+ u8 nTitle; /* Bytes of title; includes '\0' */
+ u8 eType; /* Allocation type code */
+ int iForeGuard; /* Guard word for sanity */
+};
+
+/*
+** Guard words
+*/
+#define FOREGUARD 0x80F5E153
+#define REARGUARD 0xE4676B53
+
+/*
+** Number of malloc size increments to track.
+*/
+#define NCSIZE 1000
+
+/*
+** All of the static variables used by this module are collected
+** into a single structure named "mem". This is to keep the
+** static variables organized and to reduce namespace pollution
+** when this module is combined with other in the amalgamation.
+*/
+static struct {
+
+ /*
+ ** Mutex to control access to the memory allocation subsystem.
+ */
+ sqlite3_mutex *mutex;
+
+ /*
+ ** Head and tail of a linked list of all outstanding allocations
+ */
+ struct MemBlockHdr *pFirst;
+ struct MemBlockHdr *pLast;
+
+ /*
+ ** The number of levels of backtrace to save in new allocations.
+ */
+ int nBacktrace;
+ void (*xBacktrace)(int, int, void **);
+
+ /*
+ ** Title text to insert in front of each block
+ */
+ int nTitle; /* Bytes of zTitle to save. Includes '\0' and padding */
+ char zTitle[100]; /* The title text */
+
+ /*
+ ** sqlite3MallocDisallow() increments the following counter.
+ ** sqlite3MallocAllow() decrements it.
+ */
+ int disallow; /* Do not allow memory allocation */
+
+ /*
+ ** Gather statistics on the sizes of memory allocations.
+ ** nAlloc[i] is the number of allocation attempts of i*8
+ ** bytes. i==NCSIZE is the number of allocation attempts for
+ ** sizes more than NCSIZE*8 bytes.
+ */
+ int nAlloc[NCSIZE]; /* Total number of allocations */
+ int nCurrent[NCSIZE]; /* Current number of allocations */
+ int mxCurrent[NCSIZE]; /* Highwater mark for nCurrent */
+
+} mem;
+
+
+/*
+** Adjust memory usage statistics
+*/
+static void adjustStats(int iSize, int increment){
+ int i = ROUND8(iSize)/8;
+ if( i>NCSIZE-1 ){
+ i = NCSIZE - 1;
+ }
+ if( increment>0 ){
+ mem.nAlloc[i]++;
+ mem.nCurrent[i]++;
+ if( mem.nCurrent[i]>mem.mxCurrent[i] ){
+ mem.mxCurrent[i] = mem.nCurrent[i];
+ }
+ }else{
+ mem.nCurrent[i]--;
+ assert( mem.nCurrent[i]>=0 );
+ }
+}
+
+/*
+** Given an allocation, find the MemBlockHdr for that allocation.
+**
+** This routine checks the guards at either end of the allocation and
+** if they are incorrect it asserts.
+*/
+static struct MemBlockHdr *sqlite3MemsysGetHeader(const void *pAllocation){
+ struct MemBlockHdr *p;
+ int *pInt;
+ u8 *pU8;
+ int nReserve;
+
+ p = (struct MemBlockHdr*)pAllocation;
+ p--;
+ assert( p->iForeGuard==(int)FOREGUARD );
+ nReserve = ROUND8(p->iSize);
+ pInt = (int*)pAllocation;
+ pU8 = (u8*)pAllocation;
+ assert( pInt[nReserve/sizeof(int)]==(int)REARGUARD );
+ /* This checks any of the "extra" bytes allocated due
+ ** to rounding up to an 8 byte boundary to ensure
+ ** they haven't been overwritten.
+ */
+ while( nReserve-- > p->iSize ) assert( pU8[nReserve]==0x65 );
+ return p;
+}
+
+/*
+** Return the number of bytes currently allocated at address p.
+*/
+static int sqlite3MemSize(void *p){
+ struct MemBlockHdr *pHdr;
+ if( !p ){
+ return 0;
+ }
+ pHdr = sqlite3MemsysGetHeader(p);
+ return (int)pHdr->iSize;
+}
+
+/*
+** Initialize the memory allocation subsystem.
+*/
+static int sqlite3MemInit(void *NotUsed){
+ UNUSED_PARAMETER(NotUsed);
+ assert( (sizeof(struct MemBlockHdr)&7) == 0 );
+ if( !sqlite3GlobalConfig.bMemstat ){
+ /* If memory status is enabled, then the malloc.c wrapper will already
+ ** hold the STATIC_MEM mutex when the routines here are invoked. */
+ mem.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);
+ }
+ return SQLITE_OK;
+}
+
+/*
+** Deinitialize the memory allocation subsystem.
+*/
+static void sqlite3MemShutdown(void *NotUsed){
+ UNUSED_PARAMETER(NotUsed);
+ mem.mutex = 0;
+}
+
+/*
+** Round up a request size to the next valid allocation size.
+*/
+static int sqlite3MemRoundup(int n){
+ return ROUND8(n);
+}
+
+/*
+** Fill a buffer with pseudo-random bytes. This is used to preset
+** the content of a new memory allocation to unpredictable values and
+** to clear the content of a freed allocation to unpredictable values.
+*/
+static void randomFill(char *pBuf, int nByte){
+ unsigned int x, y, r;
+ x = SQLITE_PTR_TO_INT(pBuf);
+ y = nByte | 1;
+ while( nByte >= 4 ){
+ x = (x>>1) ^ (-(int)(x&1) & 0xd0000001);
+ y = y*1103515245 + 12345;
+ r = x ^ y;
+ *(int*)pBuf = r;
+ pBuf += 4;
+ nByte -= 4;
+ }
+ while( nByte-- > 0 ){
+ x = (x>>1) ^ (-(int)(x&1) & 0xd0000001);
+ y = y*1103515245 + 12345;
+ r = x ^ y;
+ *(pBuf++) = r & 0xff;
+ }
+}
+
+/*
+** Allocate nByte bytes of memory.
+*/
+static void *sqlite3MemMalloc(int nByte){
+ struct MemBlockHdr *pHdr;
+ void **pBt;
+ char *z;
+ int *pInt;
+ void *p = 0;
+ int totalSize;
+ int nReserve;
+ sqlite3_mutex_enter(mem.mutex);
+ assert( mem.disallow==0 );
+ nReserve = ROUND8(nByte);
+ totalSize = nReserve + sizeof(*pHdr) + sizeof(int) +
+ mem.nBacktrace*sizeof(void*) + mem.nTitle;
+ p = malloc(totalSize);
+ if( p ){
+ z = p;
+ pBt = (void**)&z[mem.nTitle];
+ pHdr = (struct MemBlockHdr*)&pBt[mem.nBacktrace];
+ pHdr->pNext = 0;
+ pHdr->pPrev = mem.pLast;
+ if( mem.pLast ){
+ mem.pLast->pNext = pHdr;
+ }else{
+ mem.pFirst = pHdr;
+ }
+ mem.pLast = pHdr;
+ pHdr->iForeGuard = FOREGUARD;
+ pHdr->eType = MEMTYPE_HEAP;
+ pHdr->nBacktraceSlots = mem.nBacktrace;
+ pHdr->nTitle = mem.nTitle;
+ if( mem.nBacktrace ){
+ void *aAddr[40];
+ pHdr->nBacktrace = backtrace(aAddr, mem.nBacktrace+1)-1;
+ memcpy(pBt, &aAddr[1], pHdr->nBacktrace*sizeof(void*));
+ assert(pBt[0]);
+ if( mem.xBacktrace ){
+ mem.xBacktrace(nByte, pHdr->nBacktrace-1, &aAddr[1]);
+ }
+ }else{
+ pHdr->nBacktrace = 0;
+ }
+ if( mem.nTitle ){
+ memcpy(z, mem.zTitle, mem.nTitle);
+ }
+ pHdr->iSize = nByte;
+ adjustStats(nByte, +1);
+ pInt = (int*)&pHdr[1];
+ pInt[nReserve/sizeof(int)] = REARGUARD;
+ randomFill((char*)pInt, nByte);
+ memset(((char*)pInt)+nByte, 0x65, nReserve-nByte);
+ p = (void*)pInt;
+ }
+ sqlite3_mutex_leave(mem.mutex);
+ return p;
+}
+
+/*
+** Free memory.
+*/
+static void sqlite3MemFree(void *pPrior){
+ struct MemBlockHdr *pHdr;
+ void **pBt;
+ char *z;
+ assert( sqlite3GlobalConfig.bMemstat || sqlite3GlobalConfig.bCoreMutex==0
+ || mem.mutex!=0 );
+ pHdr = sqlite3MemsysGetHeader(pPrior);
+ pBt = (void**)pHdr;
+ pBt -= pHdr->nBacktraceSlots;
+ sqlite3_mutex_enter(mem.mutex);
+ if( pHdr->pPrev ){
+ assert( pHdr->pPrev->pNext==pHdr );
+ pHdr->pPrev->pNext = pHdr->pNext;
+ }else{
+ assert( mem.pFirst==pHdr );
+ mem.pFirst = pHdr->pNext;
+ }
+ if( pHdr->pNext ){
+ assert( pHdr->pNext->pPrev==pHdr );
+ pHdr->pNext->pPrev = pHdr->pPrev;
+ }else{
+ assert( mem.pLast==pHdr );
+ mem.pLast = pHdr->pPrev;
+ }
+ z = (char*)pBt;
+ z -= pHdr->nTitle;
+ adjustStats((int)pHdr->iSize, -1);
+ randomFill(z, sizeof(void*)*pHdr->nBacktraceSlots + sizeof(*pHdr) +
+ (int)pHdr->iSize + sizeof(int) + pHdr->nTitle);
+ free(z);
+ sqlite3_mutex_leave(mem.mutex);
+}
+
+/*
+** Change the size of an existing memory allocation.
+**
+** For this debugging implementation, we *always* make a copy of the
+** allocation into a new place in memory. In this way, if the
+** higher level code is using pointer to the old allocation, it is
+** much more likely to break and we are much more liking to find
+** the error.
+*/
+static void *sqlite3MemRealloc(void *pPrior, int nByte){
+ struct MemBlockHdr *pOldHdr;
+ void *pNew;
+ assert( mem.disallow==0 );
+ assert( (nByte & 7)==0 ); /* EV: R-46199-30249 */
+ pOldHdr = sqlite3MemsysGetHeader(pPrior);
+ pNew = sqlite3MemMalloc(nByte);
+ if( pNew ){
+ memcpy(pNew, pPrior, (int)(nByte<pOldHdr->iSize ? nByte : pOldHdr->iSize));
+ if( nByte>pOldHdr->iSize ){
+ randomFill(&((char*)pNew)[pOldHdr->iSize], nByte - (int)pOldHdr->iSize);
+ }
+ sqlite3MemFree(pPrior);
+ }
+ return pNew;
+}
+
+/*
+** Populate the low-level memory allocation function pointers in
+** sqlite3GlobalConfig.m with pointers to the routines in this file.
+*/
+SQLITE_PRIVATE void sqlite3MemSetDefault(void){
+ static const sqlite3_mem_methods defaultMethods = {
+ sqlite3MemMalloc,
+ sqlite3MemFree,
+ sqlite3MemRealloc,
+ sqlite3MemSize,
+ sqlite3MemRoundup,
+ sqlite3MemInit,
+ sqlite3MemShutdown,
+ 0
+ };
+ sqlite3_config(SQLITE_CONFIG_MALLOC, &defaultMethods);
+}
+
+/*
+** Set the "type" of an allocation.
+*/
+SQLITE_PRIVATE void sqlite3MemdebugSetType(void *p, u8 eType){
+ if( p && sqlite3GlobalConfig.m.xFree==sqlite3MemFree ){
+ struct MemBlockHdr *pHdr;
+ pHdr = sqlite3MemsysGetHeader(p);
+ assert( pHdr->iForeGuard==FOREGUARD );
+ pHdr->eType = eType;
+ }
+}
+
+/*
+** Return TRUE if the mask of type in eType matches the type of the
+** allocation p. Also return true if p==NULL.
+**
+** This routine is designed for use within an assert() statement, to
+** verify the type of an allocation. For example:
+**
+** assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) );
+*/
+SQLITE_PRIVATE int sqlite3MemdebugHasType(const void *p, u8 eType){
+ int rc = 1;
+ if( p && sqlite3GlobalConfig.m.xFree==sqlite3MemFree ){
+ struct MemBlockHdr *pHdr;
+ pHdr = sqlite3MemsysGetHeader(p);
+ assert( pHdr->iForeGuard==FOREGUARD ); /* Allocation is valid */
+ if( (pHdr->eType&eType)==0 ){
+ rc = 0;
+ }
+ }
+ return rc;
+}
+
+/*
+** Return TRUE if the mask of type in eType matches no bits of the type of the
+** allocation p. Also return true if p==NULL.
+**
+** This routine is designed for use within an assert() statement, to
+** verify the type of an allocation. For example:
+**
+** assert( sqlite3MemdebugNoType(p, MEMTYPE_LOOKASIDE) );
+*/
+SQLITE_PRIVATE int sqlite3MemdebugNoType(const void *p, u8 eType){
+ int rc = 1;
+ if( p && sqlite3GlobalConfig.m.xFree==sqlite3MemFree ){
+ struct MemBlockHdr *pHdr;
+ pHdr = sqlite3MemsysGetHeader(p);
+ assert( pHdr->iForeGuard==FOREGUARD ); /* Allocation is valid */
+ if( (pHdr->eType&eType)!=0 ){
+ rc = 0;
+ }
+ }
+ return rc;
+}
+
+/*
+** Set the number of backtrace levels kept for each allocation.
+** A value of zero turns off backtracing. The number is always rounded
+** up to a multiple of 2.
+*/
+SQLITE_PRIVATE void sqlite3MemdebugBacktrace(int depth){
+ if( depth<0 ){ depth = 0; }
+ if( depth>20 ){ depth = 20; }
+ depth = (depth+1)&0xfe;
+ mem.nBacktrace = depth;
+}
+
+SQLITE_PRIVATE void sqlite3MemdebugBacktraceCallback(void (*xBacktrace)(int, int, void **)){
+ mem.xBacktrace = xBacktrace;
+}
+
+/*
+** Set the title string for subsequent allocations.
+*/
+SQLITE_PRIVATE void sqlite3MemdebugSettitle(const char *zTitle){
+ unsigned int n = sqlite3Strlen30(zTitle) + 1;
+ sqlite3_mutex_enter(mem.mutex);
+ if( n>=sizeof(mem.zTitle) ) n = sizeof(mem.zTitle)-1;
+ memcpy(mem.zTitle, zTitle, n);
+ mem.zTitle[n] = 0;
+ mem.nTitle = ROUND8(n);
+ sqlite3_mutex_leave(mem.mutex);
+}
+
+SQLITE_PRIVATE void sqlite3MemdebugSync(){
+ struct MemBlockHdr *pHdr;
+ for(pHdr=mem.pFirst; pHdr; pHdr=pHdr->pNext){
+ void **pBt = (void**)pHdr;
+ pBt -= pHdr->nBacktraceSlots;
+ mem.xBacktrace((int)pHdr->iSize, pHdr->nBacktrace-1, &pBt[1]);
+ }
+}
+
+/*
+** Open the file indicated and write a log of all unfreed memory
+** allocations into that log.
+*/
+SQLITE_PRIVATE void sqlite3MemdebugDump(const char *zFilename){
+ FILE *out;
+ struct MemBlockHdr *pHdr;
+ void **pBt;
+ int i;
+ out = fopen(zFilename, "w");
+ if( out==0 ){
+ fprintf(stderr, "** Unable to output memory debug output log: %s **\n",
+ zFilename);
+ return;
+ }
+ for(pHdr=mem.pFirst; pHdr; pHdr=pHdr->pNext){
+ char *z = (char*)pHdr;
+ z -= pHdr->nBacktraceSlots*sizeof(void*) + pHdr->nTitle;
+ fprintf(out, "**** %lld bytes at %p from %s ****\n",
+ pHdr->iSize, &pHdr[1], pHdr->nTitle ? z : "???");
+ if( pHdr->nBacktrace ){
+ fflush(out);
+ pBt = (void**)pHdr;
+ pBt -= pHdr->nBacktraceSlots;
+ backtrace_symbols_fd(pBt, pHdr->nBacktrace, fileno(out));
+ fprintf(out, "\n");
+ }
+ }
+ fprintf(out, "COUNTS:\n");
+ for(i=0; i<NCSIZE-1; i++){
+ if( mem.nAlloc[i] ){
+ fprintf(out, " %5d: %10d %10d %10d\n",
+ i*8, mem.nAlloc[i], mem.nCurrent[i], mem.mxCurrent[i]);
+ }
+ }
+ if( mem.nAlloc[NCSIZE-1] ){
+ fprintf(out, " %5d: %10d %10d %10d\n",
+ NCSIZE*8-8, mem.nAlloc[NCSIZE-1],
+ mem.nCurrent[NCSIZE-1], mem.mxCurrent[NCSIZE-1]);
+ }
+ fclose(out);
+}
+
+/*
+** Return the number of times sqlite3MemMalloc() has been called.
+*/
+SQLITE_PRIVATE int sqlite3MemdebugMallocCount(){
+ int i;
+ int nTotal = 0;
+ for(i=0; i<NCSIZE; i++){
+ nTotal += mem.nAlloc[i];
+ }
+ return nTotal;
+}
+
+
+#endif /* SQLITE_MEMDEBUG */
+
+/************** End of mem2.c ************************************************/
+/************** Begin file mem3.c ********************************************/
+/*
+** 2007 October 14
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This file contains the C functions that implement a memory
+** allocation subsystem for use by SQLite.
+**
+** This version of the memory allocation subsystem omits all
+** use of malloc(). The SQLite user supplies a block of memory
+** before calling sqlite3_initialize() from which allocations
+** are made and returned by the xMalloc() and xRealloc()
+** implementations. Once sqlite3_initialize() has been called,
+** the amount of memory available to SQLite is fixed and cannot
+** be changed.
+**
+** This version of the memory allocation subsystem is included
+** in the build only if SQLITE_ENABLE_MEMSYS3 is defined.
+*/
+/* #include "sqliteInt.h" */
+
+/*
+** This version of the memory allocator is only built into the library
+** SQLITE_ENABLE_MEMSYS3 is defined. Defining this symbol does not
+** mean that the library will use a memory-pool by default, just that
+** it is available. The mempool allocator is activated by calling
+** sqlite3_config().
+*/
+#ifdef SQLITE_ENABLE_MEMSYS3
+
+/*
+** Maximum size (in Mem3Blocks) of a "small" chunk.
+*/
+#define MX_SMALL 10
+
+
+/*
+** Number of freelist hash slots
+*/
+#define N_HASH 61
+
+/*
+** A memory allocation (also called a "chunk") consists of two or
+** more blocks where each block is 8 bytes. The first 8 bytes are
+** a header that is not returned to the user.
+**
+** A chunk is two or more blocks that is either checked out or
+** free. The first block has format u.hdr. u.hdr.size4x is 4 times the
+** size of the allocation in blocks if the allocation is free.
+** The u.hdr.size4x&1 bit is true if the chunk is checked out and
+** false if the chunk is on the freelist. The u.hdr.size4x&2 bit
+** is true if the previous chunk is checked out and false if the
+** previous chunk is free. The u.hdr.prevSize field is the size of
+** the previous chunk in blocks if the previous chunk is on the
+** freelist. If the previous chunk is checked out, then
+** u.hdr.prevSize can be part of the data for that chunk and should
+** not be read or written.
+**
+** We often identify a chunk by its index in mem3.aPool[]. When
+** this is done, the chunk index refers to the second block of
+** the chunk. In this way, the first chunk has an index of 1.
+** A chunk index of 0 means "no such chunk" and is the equivalent
+** of a NULL pointer.
+**
+** The second block of free chunks is of the form u.list. The
+** two fields form a double-linked list of chunks of related sizes.
+** Pointers to the head of the list are stored in mem3.aiSmall[]
+** for smaller chunks and mem3.aiHash[] for larger chunks.
+**
+** The second block of a chunk is user data if the chunk is checked
+** out. If a chunk is checked out, the user data may extend into
+** the u.hdr.prevSize value of the following chunk.
+*/
+typedef struct Mem3Block Mem3Block;
+struct Mem3Block {
+ union {
+ struct {
+ u32 prevSize; /* Size of previous chunk in Mem3Block elements */
+ u32 size4x; /* 4x the size of current chunk in Mem3Block elements */
+ } hdr;
+ struct {
+ u32 next; /* Index in mem3.aPool[] of next free chunk */
+ u32 prev; /* Index in mem3.aPool[] of previous free chunk */
+ } list;
+ } u;
+};
+
+/*
+** All of the static variables used by this module are collected
+** into a single structure named "mem3". This is to keep the
+** static variables organized and to reduce namespace pollution
+** when this module is combined with other in the amalgamation.
+*/
+static SQLITE_WSD struct Mem3Global {
+ /*
+ ** Memory available for allocation. nPool is the size of the array
+ ** (in Mem3Blocks) pointed to by aPool less 2.
+ */
+ u32 nPool;
+ Mem3Block *aPool;
+
+ /*
+ ** True if we are evaluating an out-of-memory callback.
+ */
+ int alarmBusy;
+
+ /*
+ ** Mutex to control access to the memory allocation subsystem.
+ */
+ sqlite3_mutex *mutex;
+
+ /*
+ ** The minimum amount of free space that we have seen.
+ */
+ u32 mnKeyBlk;
+
+ /*
+ ** iKeyBlk is the index of the key chunk. Most new allocations
+ ** occur off of this chunk. szKeyBlk is the size (in Mem3Blocks)
+ ** of the current key chunk. iKeyBlk is 0 if there is no key chunk.
+ ** The key chunk is not in either the aiHash[] or aiSmall[].
+ */
+ u32 iKeyBlk;
+ u32 szKeyBlk;
+
+ /*
+ ** Array of lists of free blocks according to the block size
+ ** for smaller chunks, or a hash on the block size for larger
+ ** chunks.
+ */
+ u32 aiSmall[MX_SMALL-1]; /* For sizes 2 through MX_SMALL, inclusive */
+ u32 aiHash[N_HASH]; /* For sizes MX_SMALL+1 and larger */
+} mem3 = { 97535575 };
+
+#define mem3 GLOBAL(struct Mem3Global, mem3)
+
+/*
+** Unlink the chunk at mem3.aPool[i] from list it is currently
+** on. *pRoot is the list that i is a member of.
+*/
+static void memsys3UnlinkFromList(u32 i, u32 *pRoot){
+ u32 next = mem3.aPool[i].u.list.next;
+ u32 prev = mem3.aPool[i].u.list.prev;
+ assert( sqlite3_mutex_held(mem3.mutex) );
+ if( prev==0 ){
+ *pRoot = next;
+ }else{
+ mem3.aPool[prev].u.list.next = next;
+ }
+ if( next ){
+ mem3.aPool[next].u.list.prev = prev;
+ }
+ mem3.aPool[i].u.list.next = 0;
+ mem3.aPool[i].u.list.prev = 0;
+}
+
+/*
+** Unlink the chunk at index i from
+** whatever list is currently a member of.
+*/
+static void memsys3Unlink(u32 i){
+ u32 size, hash;
+ assert( sqlite3_mutex_held(mem3.mutex) );
+ assert( (mem3.aPool[i-1].u.hdr.size4x & 1)==0 );
+ assert( i>=1 );
+ size = mem3.aPool[i-1].u.hdr.size4x/4;
+ assert( size==mem3.aPool[i+size-1].u.hdr.prevSize );
+ assert( size>=2 );
+ if( size <= MX_SMALL ){
+ memsys3UnlinkFromList(i, &mem3.aiSmall[size-2]);
+ }else{
+ hash = size % N_HASH;
+ memsys3UnlinkFromList(i, &mem3.aiHash[hash]);
+ }
+}
+
+/*
+** Link the chunk at mem3.aPool[i] so that is on the list rooted
+** at *pRoot.
+*/
+static void memsys3LinkIntoList(u32 i, u32 *pRoot){
+ assert( sqlite3_mutex_held(mem3.mutex) );
+ mem3.aPool[i].u.list.next = *pRoot;
+ mem3.aPool[i].u.list.prev = 0;
+ if( *pRoot ){
+ mem3.aPool[*pRoot].u.list.prev = i;
+ }
+ *pRoot = i;
+}
+
+/*
+** Link the chunk at index i into either the appropriate
+** small chunk list, or into the large chunk hash table.
+*/
+static void memsys3Link(u32 i){
+ u32 size, hash;
+ assert( sqlite3_mutex_held(mem3.mutex) );
+ assert( i>=1 );
+ assert( (mem3.aPool[i-1].u.hdr.size4x & 1)==0 );
+ size = mem3.aPool[i-1].u.hdr.size4x/4;
+ assert( size==mem3.aPool[i+size-1].u.hdr.prevSize );
+ assert( size>=2 );
+ if( size <= MX_SMALL ){
+ memsys3LinkIntoList(i, &mem3.aiSmall[size-2]);
+ }else{
+ hash = size % N_HASH;
+ memsys3LinkIntoList(i, &mem3.aiHash[hash]);
+ }
+}
+
+/*
+** If the STATIC_MEM mutex is not already held, obtain it now. The mutex
+** will already be held (obtained by code in malloc.c) if
+** sqlite3GlobalConfig.bMemStat is true.
+*/
+static void memsys3Enter(void){
+ if( sqlite3GlobalConfig.bMemstat==0 && mem3.mutex==0 ){
+ mem3.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);
+ }
+ sqlite3_mutex_enter(mem3.mutex);
+}
+static void memsys3Leave(void){
+ sqlite3_mutex_leave(mem3.mutex);
+}
+
+/*
+** Called when we are unable to satisfy an allocation of nBytes.
+*/
+static void memsys3OutOfMemory(int nByte){
+ if( !mem3.alarmBusy ){
+ mem3.alarmBusy = 1;
+ assert( sqlite3_mutex_held(mem3.mutex) );
+ sqlite3_mutex_leave(mem3.mutex);
+ sqlite3_release_memory(nByte);
+ sqlite3_mutex_enter(mem3.mutex);
+ mem3.alarmBusy = 0;
+ }
+}
+
+
+/*
+** Chunk i is a free chunk that has been unlinked. Adjust its
+** size parameters for check-out and return a pointer to the
+** user portion of the chunk.
+*/
+static void *memsys3Checkout(u32 i, u32 nBlock){
+ u32 x;
+ assert( sqlite3_mutex_held(mem3.mutex) );
+ assert( i>=1 );
+ assert( mem3.aPool[i-1].u.hdr.size4x/4==nBlock );
+ assert( mem3.aPool[i+nBlock-1].u.hdr.prevSize==nBlock );
+ x = mem3.aPool[i-1].u.hdr.size4x;
+ mem3.aPool[i-1].u.hdr.size4x = nBlock*4 | 1 | (x&2);
+ mem3.aPool[i+nBlock-1].u.hdr.prevSize = nBlock;
+ mem3.aPool[i+nBlock-1].u.hdr.size4x |= 2;
+ return &mem3.aPool[i];
+}
+
+/*
+** Carve a piece off of the end of the mem3.iKeyBlk free chunk.
+** Return a pointer to the new allocation. Or, if the key chunk
+** is not large enough, return 0.
+*/
+static void *memsys3FromKeyBlk(u32 nBlock){
+ assert( sqlite3_mutex_held(mem3.mutex) );
+ assert( mem3.szKeyBlk>=nBlock );
+ if( nBlock>=mem3.szKeyBlk-1 ){
+ /* Use the entire key chunk */
+ void *p = memsys3Checkout(mem3.iKeyBlk, mem3.szKeyBlk);
+ mem3.iKeyBlk = 0;
+ mem3.szKeyBlk = 0;
+ mem3.mnKeyBlk = 0;
+ return p;
+ }else{
+ /* Split the key block. Return the tail. */
+ u32 newi, x;
+ newi = mem3.iKeyBlk + mem3.szKeyBlk - nBlock;
+ assert( newi > mem3.iKeyBlk+1 );
+ mem3.aPool[mem3.iKeyBlk+mem3.szKeyBlk-1].u.hdr.prevSize = nBlock;
+ mem3.aPool[mem3.iKeyBlk+mem3.szKeyBlk-1].u.hdr.size4x |= 2;
+ mem3.aPool[newi-1].u.hdr.size4x = nBlock*4 + 1;
+ mem3.szKeyBlk -= nBlock;
+ mem3.aPool[newi-1].u.hdr.prevSize = mem3.szKeyBlk;
+ x = mem3.aPool[mem3.iKeyBlk-1].u.hdr.size4x & 2;
+ mem3.aPool[mem3.iKeyBlk-1].u.hdr.size4x = mem3.szKeyBlk*4 | x;
+ if( mem3.szKeyBlk < mem3.mnKeyBlk ){
+ mem3.mnKeyBlk = mem3.szKeyBlk;
+ }
+ return (void*)&mem3.aPool[newi];
+ }
+}
+
+/*
+** *pRoot is the head of a list of free chunks of the same size
+** or same size hash. In other words, *pRoot is an entry in either
+** mem3.aiSmall[] or mem3.aiHash[].
+**
+** This routine examines all entries on the given list and tries
+** to coalesce each entries with adjacent free chunks.
+**
+** If it sees a chunk that is larger than mem3.iKeyBlk, it replaces
+** the current mem3.iKeyBlk with the new larger chunk. In order for
+** this mem3.iKeyBlk replacement to work, the key chunk must be
+** linked into the hash tables. That is not the normal state of
+** affairs, of course. The calling routine must link the key
+** chunk before invoking this routine, then must unlink the (possibly
+** changed) key chunk once this routine has finished.
+*/
+static void memsys3Merge(u32 *pRoot){
+ u32 iNext, prev, size, i, x;
+
+ assert( sqlite3_mutex_held(mem3.mutex) );
+ for(i=*pRoot; i>0; i=iNext){
+ iNext = mem3.aPool[i].u.list.next;
+ size = mem3.aPool[i-1].u.hdr.size4x;
+ assert( (size&1)==0 );
+ if( (size&2)==0 ){
+ memsys3UnlinkFromList(i, pRoot);
+ assert( i > mem3.aPool[i-1].u.hdr.prevSize );
+ prev = i - mem3.aPool[i-1].u.hdr.prevSize;
+ if( prev==iNext ){
+ iNext = mem3.aPool[prev].u.list.next;
+ }
+ memsys3Unlink(prev);
+ size = i + size/4 - prev;
+ x = mem3.aPool[prev-1].u.hdr.size4x & 2;
+ mem3.aPool[prev-1].u.hdr.size4x = size*4 | x;
+ mem3.aPool[prev+size-1].u.hdr.prevSize = size;
+ memsys3Link(prev);
+ i = prev;
+ }else{
+ size /= 4;
+ }
+ if( size>mem3.szKeyBlk ){
+ mem3.iKeyBlk = i;
+ mem3.szKeyBlk = size;
+ }
+ }
+}
+
+/*
+** Return a block of memory of at least nBytes in size.
+** Return NULL if unable.
+**
+** This function assumes that the necessary mutexes, if any, are
+** already held by the caller. Hence "Unsafe".
+*/
+static void *memsys3MallocUnsafe(int nByte){
+ u32 i;
+ u32 nBlock;
+ u32 toFree;
+
+ assert( sqlite3_mutex_held(mem3.mutex) );
+ assert( sizeof(Mem3Block)==8 );
+ if( nByte<=12 ){
+ nBlock = 2;
+ }else{
+ nBlock = (nByte + 11)/8;
+ }
+ assert( nBlock>=2 );
+
+ /* STEP 1:
+ ** Look for an entry of the correct size in either the small
+ ** chunk table or in the large chunk hash table. This is
+ ** successful most of the time (about 9 times out of 10).
+ */
+ if( nBlock <= MX_SMALL ){
+ i = mem3.aiSmall[nBlock-2];
+ if( i>0 ){
+ memsys3UnlinkFromList(i, &mem3.aiSmall[nBlock-2]);
+ return memsys3Checkout(i, nBlock);
+ }
+ }else{
+ int hash = nBlock % N_HASH;
+ for(i=mem3.aiHash[hash]; i>0; i=mem3.aPool[i].u.list.next){
+ if( mem3.aPool[i-1].u.hdr.size4x/4==nBlock ){
+ memsys3UnlinkFromList(i, &mem3.aiHash[hash]);
+ return memsys3Checkout(i, nBlock);
+ }
+ }
+ }
+
+ /* STEP 2:
+ ** Try to satisfy the allocation by carving a piece off of the end
+ ** of the key chunk. This step usually works if step 1 fails.
+ */
+ if( mem3.szKeyBlk>=nBlock ){
+ return memsys3FromKeyBlk(nBlock);
+ }
+
+
+ /* STEP 3:
+ ** Loop through the entire memory pool. Coalesce adjacent free
+ ** chunks. Recompute the key chunk as the largest free chunk.
+ ** Then try again to satisfy the allocation by carving a piece off
+ ** of the end of the key chunk. This step happens very
+ ** rarely (we hope!)
+ */
+ for(toFree=nBlock*16; toFree<(mem3.nPool*16); toFree *= 2){
+ memsys3OutOfMemory(toFree);
+ if( mem3.iKeyBlk ){
+ memsys3Link(mem3.iKeyBlk);
+ mem3.iKeyBlk = 0;
+ mem3.szKeyBlk = 0;
+ }
+ for(i=0; i<N_HASH; i++){
+ memsys3Merge(&mem3.aiHash[i]);
+ }
+ for(i=0; i<MX_SMALL-1; i++){
+ memsys3Merge(&mem3.aiSmall[i]);
+ }
+ if( mem3.szKeyBlk ){
+ memsys3Unlink(mem3.iKeyBlk);
+ if( mem3.szKeyBlk>=nBlock ){
+ return memsys3FromKeyBlk(nBlock);
+ }
+ }
+ }
+
+ /* If none of the above worked, then we fail. */
+ return 0;
+}
+
+/*
+** Free an outstanding memory allocation.
+**
+** This function assumes that the necessary mutexes, if any, are
+** already held by the caller. Hence "Unsafe".
+*/
+static void memsys3FreeUnsafe(void *pOld){
+ Mem3Block *p = (Mem3Block*)pOld;
+ int i;
+ u32 size, x;
+ assert( sqlite3_mutex_held(mem3.mutex) );
+ assert( p>mem3.aPool && p<&mem3.aPool[mem3.nPool] );
+ i = p - mem3.aPool;
+ assert( (mem3.aPool[i-1].u.hdr.size4x&1)==1 );
+ size = mem3.aPool[i-1].u.hdr.size4x/4;
+ assert( i+size<=mem3.nPool+1 );
+ mem3.aPool[i-1].u.hdr.size4x &= ~1;
+ mem3.aPool[i+size-1].u.hdr.prevSize = size;
+ mem3.aPool[i+size-1].u.hdr.size4x &= ~2;
+ memsys3Link(i);
+
+ /* Try to expand the key using the newly freed chunk */
+ if( mem3.iKeyBlk ){
+ while( (mem3.aPool[mem3.iKeyBlk-1].u.hdr.size4x&2)==0 ){
+ size = mem3.aPool[mem3.iKeyBlk-1].u.hdr.prevSize;
+ mem3.iKeyBlk -= size;
+ mem3.szKeyBlk += size;
+ memsys3Unlink(mem3.iKeyBlk);
+ x = mem3.aPool[mem3.iKeyBlk-1].u.hdr.size4x & 2;
+ mem3.aPool[mem3.iKeyBlk-1].u.hdr.size4x = mem3.szKeyBlk*4 | x;
+ mem3.aPool[mem3.iKeyBlk+mem3.szKeyBlk-1].u.hdr.prevSize = mem3.szKeyBlk;
+ }
+ x = mem3.aPool[mem3.iKeyBlk-1].u.hdr.size4x & 2;
+ while( (mem3.aPool[mem3.iKeyBlk+mem3.szKeyBlk-1].u.hdr.size4x&1)==0 ){
+ memsys3Unlink(mem3.iKeyBlk+mem3.szKeyBlk);
+ mem3.szKeyBlk += mem3.aPool[mem3.iKeyBlk+mem3.szKeyBlk-1].u.hdr.size4x/4;
+ mem3.aPool[mem3.iKeyBlk-1].u.hdr.size4x = mem3.szKeyBlk*4 | x;
+ mem3.aPool[mem3.iKeyBlk+mem3.szKeyBlk-1].u.hdr.prevSize = mem3.szKeyBlk;
+ }
+ }
+}
+
+/*
+** Return the size of an outstanding allocation, in bytes. The
+** size returned omits the 8-byte header overhead. This only
+** works for chunks that are currently checked out.
+*/
+static int memsys3Size(void *p){
+ Mem3Block *pBlock;
+ assert( p!=0 );
+ pBlock = (Mem3Block*)p;
+ assert( (pBlock[-1].u.hdr.size4x&1)!=0 );
+ return (pBlock[-1].u.hdr.size4x&~3)*2 - 4;
+}
+
+/*
+** Round up a request size to the next valid allocation size.
+*/
+static int memsys3Roundup(int n){
+ if( n<=12 ){
+ return 12;
+ }else{
+ return ((n+11)&~7) - 4;
+ }
+}
+
+/*
+** Allocate nBytes of memory.
+*/
+static void *memsys3Malloc(int nBytes){
+ sqlite3_int64 *p;
+ assert( nBytes>0 ); /* malloc.c filters out 0 byte requests */
+ memsys3Enter();
+ p = memsys3MallocUnsafe(nBytes);
+ memsys3Leave();
+ return (void*)p;
+}
+
+/*
+** Free memory.
+*/
+static void memsys3Free(void *pPrior){
+ assert( pPrior );
+ memsys3Enter();
+ memsys3FreeUnsafe(pPrior);
+ memsys3Leave();
+}
+
+/*
+** Change the size of an existing memory allocation
+*/
+static void *memsys3Realloc(void *pPrior, int nBytes){
+ int nOld;
+ void *p;
+ if( pPrior==0 ){
+ return sqlite3_malloc(nBytes);
+ }
+ if( nBytes<=0 ){
+ sqlite3_free(pPrior);
+ return 0;
+ }
+ nOld = memsys3Size(pPrior);
+ if( nBytes<=nOld && nBytes>=nOld-128 ){
+ return pPrior;
+ }
+ memsys3Enter();
+ p = memsys3MallocUnsafe(nBytes);
+ if( p ){
+ if( nOld<nBytes ){
+ memcpy(p, pPrior, nOld);
+ }else{
+ memcpy(p, pPrior, nBytes);
+ }
+ memsys3FreeUnsafe(pPrior);
+ }
+ memsys3Leave();
+ return p;
+}
+
+/*
+** Initialize this module.
+*/
+static int memsys3Init(void *NotUsed){
+ UNUSED_PARAMETER(NotUsed);
+ if( !sqlite3GlobalConfig.pHeap ){
+ return SQLITE_ERROR;
+ }
+
+ /* Store a pointer to the memory block in global structure mem3. */
+ assert( sizeof(Mem3Block)==8 );
+ mem3.aPool = (Mem3Block *)sqlite3GlobalConfig.pHeap;
+ mem3.nPool = (sqlite3GlobalConfig.nHeap / sizeof(Mem3Block)) - 2;
+
+ /* Initialize the key block. */
+ mem3.szKeyBlk = mem3.nPool;
+ mem3.mnKeyBlk = mem3.szKeyBlk;
+ mem3.iKeyBlk = 1;
+ mem3.aPool[0].u.hdr.size4x = (mem3.szKeyBlk<<2) + 2;
+ mem3.aPool[mem3.nPool].u.hdr.prevSize = mem3.nPool;
+ mem3.aPool[mem3.nPool].u.hdr.size4x = 1;
+
+ return SQLITE_OK;
+}
+
+/*
+** Deinitialize this module.
+*/
+static void memsys3Shutdown(void *NotUsed){
+ UNUSED_PARAMETER(NotUsed);
+ mem3.mutex = 0;
+ return;
+}
+
+
+
+/*
+** Open the file indicated and write a log of all unfreed memory
+** allocations into that log.
+*/
+SQLITE_PRIVATE void sqlite3Memsys3Dump(const char *zFilename){
+#ifdef SQLITE_DEBUG
+ FILE *out;
+ u32 i, j;
+ u32 size;
+ if( zFilename==0 || zFilename[0]==0 ){
+ out = stdout;
+ }else{
+ out = fopen(zFilename, "w");
+ if( out==0 ){
+ fprintf(stderr, "** Unable to output memory debug output log: %s **\n",
+ zFilename);
+ return;
+ }
+ }
+ memsys3Enter();
+ fprintf(out, "CHUNKS:\n");
+ for(i=1; i<=mem3.nPool; i+=size/4){
+ size = mem3.aPool[i-1].u.hdr.size4x;
+ if( size/4<=1 ){
+ fprintf(out, "%p size error\n", &mem3.aPool[i]);
+ assert( 0 );
+ break;
+ }
+ if( (size&1)==0 && mem3.aPool[i+size/4-1].u.hdr.prevSize!=size/4 ){
+ fprintf(out, "%p tail size does not match\n", &mem3.aPool[i]);
+ assert( 0 );
+ break;
+ }
+ if( ((mem3.aPool[i+size/4-1].u.hdr.size4x&2)>>1)!=(size&1) ){
+ fprintf(out, "%p tail checkout bit is incorrect\n", &mem3.aPool[i]);
+ assert( 0 );
+ break;
+ }
+ if( size&1 ){
+ fprintf(out, "%p %6d bytes checked out\n", &mem3.aPool[i], (size/4)*8-8);
+ }else{
+ fprintf(out, "%p %6d bytes free%s\n", &mem3.aPool[i], (size/4)*8-8,
+ i==mem3.iKeyBlk ? " **key**" : "");
+ }
+ }
+ for(i=0; i<MX_SMALL-1; i++){
+ if( mem3.aiSmall[i]==0 ) continue;
+ fprintf(out, "small(%2d):", i);
+ for(j = mem3.aiSmall[i]; j>0; j=mem3.aPool[j].u.list.next){
+ fprintf(out, " %p(%d)", &mem3.aPool[j],
+ (mem3.aPool[j-1].u.hdr.size4x/4)*8-8);
+ }
+ fprintf(out, "\n");
+ }
+ for(i=0; i<N_HASH; i++){
+ if( mem3.aiHash[i]==0 ) continue;
+ fprintf(out, "hash(%2d):", i);
+ for(j = mem3.aiHash[i]; j>0; j=mem3.aPool[j].u.list.next){
+ fprintf(out, " %p(%d)", &mem3.aPool[j],
+ (mem3.aPool[j-1].u.hdr.size4x/4)*8-8);
+ }
+ fprintf(out, "\n");
+ }
+ fprintf(out, "key=%d\n", mem3.iKeyBlk);
+ fprintf(out, "nowUsed=%d\n", mem3.nPool*8 - mem3.szKeyBlk*8);
+ fprintf(out, "mxUsed=%d\n", mem3.nPool*8 - mem3.mnKeyBlk*8);
+ sqlite3_mutex_leave(mem3.mutex);
+ if( out==stdout ){
+ fflush(stdout);
+ }else{
+ fclose(out);
+ }
+#else
+ UNUSED_PARAMETER(zFilename);
+#endif
+}
+
+/*
+** This routine is the only routine in this file with external
+** linkage.
+**
+** Populate the low-level memory allocation function pointers in
+** sqlite3GlobalConfig.m with pointers to the routines in this file. The
+** arguments specify the block of memory to manage.
+**
+** This routine is only called by sqlite3_config(), and therefore
+** is not required to be threadsafe (it is not).
+*/
+SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys3(void){
+ static const sqlite3_mem_methods mempoolMethods = {
+ memsys3Malloc,
+ memsys3Free,
+ memsys3Realloc,
+ memsys3Size,
+ memsys3Roundup,
+ memsys3Init,
+ memsys3Shutdown,
+ 0
+ };
+ return &mempoolMethods;
+}
+
+#endif /* SQLITE_ENABLE_MEMSYS3 */
+
+/************** End of mem3.c ************************************************/
+/************** Begin file mem5.c ********************************************/
+/*
+** 2007 October 14
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This file contains the C functions that implement a memory
+** allocation subsystem for use by SQLite.
+**
+** This version of the memory allocation subsystem omits all
+** use of malloc(). The application gives SQLite a block of memory
+** before calling sqlite3_initialize() from which allocations
+** are made and returned by the xMalloc() and xRealloc()
+** implementations. Once sqlite3_initialize() has been called,
+** the amount of memory available to SQLite is fixed and cannot
+** be changed.
+**
+** This version of the memory allocation subsystem is included
+** in the build only if SQLITE_ENABLE_MEMSYS5 is defined.
+**
+** This memory allocator uses the following algorithm:
+**
+** 1. All memory allocation sizes are rounded up to a power of 2.
+**
+** 2. If two adjacent free blocks are the halves of a larger block,
+** then the two blocks are coalesced into the single larger block.
+**
+** 3. New memory is allocated from the first available free block.
+**
+** This algorithm is described in: J. M. Robson. "Bounds for Some Functions
+** Concerning Dynamic Storage Allocation". Journal of the Association for
+** Computing Machinery, Volume 21, Number 8, July 1974, pages 491-499.
+**
+** Let n be the size of the largest allocation divided by the minimum
+** allocation size (after rounding all sizes up to a power of 2.) Let M
+** be the maximum amount of memory ever outstanding at one time. Let
+** N be the total amount of memory available for allocation. Robson
+** proved that this memory allocator will never breakdown due to
+** fragmentation as long as the following constraint holds:
+**
+** N >= M*(1 + log2(n)/2) - n + 1
+**
+** The sqlite3_status() logic tracks the maximum values of n and M so
+** that an application can, at any time, verify this constraint.
+*/
+/* #include "sqliteInt.h" */
+
+/*
+** This version of the memory allocator is used only when
+** SQLITE_ENABLE_MEMSYS5 is defined.
+*/
+#ifdef SQLITE_ENABLE_MEMSYS5
+
+/*
+** A minimum allocation is an instance of the following structure.
+** Larger allocations are an array of these structures where the
+** size of the array is a power of 2.
+**
+** The size of this object must be a power of two. That fact is
+** verified in memsys5Init().
+*/
+typedef struct Mem5Link Mem5Link;
+struct Mem5Link {
+ int next; /* Index of next free chunk */
+ int prev; /* Index of previous free chunk */
+};
+
+/*
+** Maximum size of any allocation is ((1<<LOGMAX)*mem5.szAtom). Since
+** mem5.szAtom is always at least 8 and 32-bit integers are used,
+** it is not actually possible to reach this limit.
+*/
+#define LOGMAX 30
+
+/*
+** Masks used for mem5.aCtrl[] elements.
+*/
+#define CTRL_LOGSIZE 0x1f /* Log2 Size of this block */
+#define CTRL_FREE 0x20 /* True if not checked out */
+
+/*
+** All of the static variables used by this module are collected
+** into a single structure named "mem5". This is to keep the
+** static variables organized and to reduce namespace pollution
+** when this module is combined with other in the amalgamation.
+*/
+static SQLITE_WSD struct Mem5Global {
+ /*
+ ** Memory available for allocation
+ */
+ int szAtom; /* Smallest possible allocation in bytes */
+ int nBlock; /* Number of szAtom sized blocks in zPool */
+ u8 *zPool; /* Memory available to be allocated */
+
+ /*
+ ** Mutex to control access to the memory allocation subsystem.
+ */
+ sqlite3_mutex *mutex;
+
+#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
+ /*
+ ** Performance statistics
+ */
+ u64 nAlloc; /* Total number of calls to malloc */
+ u64 totalAlloc; /* Total of all malloc calls - includes internal frag */
+ u64 totalExcess; /* Total internal fragmentation */
+ u32 currentOut; /* Current checkout, including internal fragmentation */
+ u32 currentCount; /* Current number of distinct checkouts */
+ u32 maxOut; /* Maximum instantaneous currentOut */
+ u32 maxCount; /* Maximum instantaneous currentCount */
+ u32 maxRequest; /* Largest allocation (exclusive of internal frag) */
+#endif
+
+ /*
+ ** Lists of free blocks. aiFreelist[0] is a list of free blocks of
+ ** size mem5.szAtom. aiFreelist[1] holds blocks of size szAtom*2.
+ ** aiFreelist[2] holds free blocks of size szAtom*4. And so forth.
+ */
+ int aiFreelist[LOGMAX+1];
+
+ /*
+ ** Space for tracking which blocks are checked out and the size
+ ** of each block. One byte per block.
+ */
+ u8 *aCtrl;
+
+} mem5;
+
+/*
+** Access the static variable through a macro for SQLITE_OMIT_WSD.
+*/
+#define mem5 GLOBAL(struct Mem5Global, mem5)
+
+/*
+** Assuming mem5.zPool is divided up into an array of Mem5Link
+** structures, return a pointer to the idx-th such link.
+*/
+#define MEM5LINK(idx) ((Mem5Link *)(&mem5.zPool[(idx)*mem5.szAtom]))
+
+/*
+** Unlink the chunk at mem5.aPool[i] from list it is currently
+** on. It should be found on mem5.aiFreelist[iLogsize].
+*/
+static void memsys5Unlink(int i, int iLogsize){
+ int next, prev;
+ assert( i>=0 && i<mem5.nBlock );
+ assert( iLogsize>=0 && iLogsize<=LOGMAX );
+ assert( (mem5.aCtrl[i] & CTRL_LOGSIZE)==iLogsize );
+
+ next = MEM5LINK(i)->next;
+ prev = MEM5LINK(i)->prev;
+ if( prev<0 ){
+ mem5.aiFreelist[iLogsize] = next;
+ }else{
+ MEM5LINK(prev)->next = next;
+ }
+ if( next>=0 ){
+ MEM5LINK(next)->prev = prev;
+ }
+}
+
+/*
+** Link the chunk at mem5.aPool[i] so that is on the iLogsize
+** free list.
+*/
+static void memsys5Link(int i, int iLogsize){
+ int x;
+ assert( sqlite3_mutex_held(mem5.mutex) );
+ assert( i>=0 && i<mem5.nBlock );
+ assert( iLogsize>=0 && iLogsize<=LOGMAX );
+ assert( (mem5.aCtrl[i] & CTRL_LOGSIZE)==iLogsize );
+
+ x = MEM5LINK(i)->next = mem5.aiFreelist[iLogsize];
+ MEM5LINK(i)->prev = -1;
+ if( x>=0 ){
+ assert( x<mem5.nBlock );
+ MEM5LINK(x)->prev = i;
+ }
+ mem5.aiFreelist[iLogsize] = i;
+}
+
+/*
+** Obtain or release the mutex needed to access global data structures.
+*/
+static void memsys5Enter(void){
+ sqlite3_mutex_enter(mem5.mutex);
+}
+static void memsys5Leave(void){
+ sqlite3_mutex_leave(mem5.mutex);
+}
+
+/*
+** Return the size of an outstanding allocation, in bytes.
+** This only works for chunks that are currently checked out.
+*/
+static int memsys5Size(void *p){
+ int iSize, i;
+ assert( p!=0 );
+ i = (int)(((u8 *)p-mem5.zPool)/mem5.szAtom);
+ assert( i>=0 && i<mem5.nBlock );
+ iSize = mem5.szAtom * (1 << (mem5.aCtrl[i]&CTRL_LOGSIZE));
+ return iSize;
+}
+
+/*
+** Return a block of memory of at least nBytes in size.
+** Return NULL if unable. Return NULL if nBytes==0.
+**
+** The caller guarantees that nByte is positive.
+**
+** The caller has obtained a mutex prior to invoking this
+** routine so there is never any chance that two or more
+** threads can be in this routine at the same time.
+*/
+static void *memsys5MallocUnsafe(int nByte){
+ int i; /* Index of a mem5.aPool[] slot */
+ int iBin; /* Index into mem5.aiFreelist[] */
+ int iFullSz; /* Size of allocation rounded up to power of 2 */
+ int iLogsize; /* Log2 of iFullSz/POW2_MIN */
+
+ /* nByte must be a positive */
+ assert( nByte>0 );
+
+ /* No more than 1GiB per allocation */
+ if( nByte > 0x40000000 ) return 0;
+
+#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
+ /* Keep track of the maximum allocation request. Even unfulfilled
+ ** requests are counted */
+ if( (u32)nByte>mem5.maxRequest ){
+ mem5.maxRequest = nByte;
+ }
+#endif
+
+
+ /* Round nByte up to the next valid power of two */
+ for(iFullSz=mem5.szAtom,iLogsize=0; iFullSz<nByte; iFullSz*=2,iLogsize++){}
+
+ /* Make sure mem5.aiFreelist[iLogsize] contains at least one free
+ ** block. If not, then split a block of the next larger power of
+ ** two in order to create a new free block of size iLogsize.
+ */
+ for(iBin=iLogsize; iBin<=LOGMAX && mem5.aiFreelist[iBin]<0; iBin++){}
+ if( iBin>LOGMAX ){
+ testcase( sqlite3GlobalConfig.xLog!=0 );
+ sqlite3_log(SQLITE_NOMEM, "failed to allocate %u bytes", nByte);
+ return 0;
+ }
+ i = mem5.aiFreelist[iBin];
+ memsys5Unlink(i, iBin);
+ while( iBin>iLogsize ){
+ int newSize;
+
+ iBin--;
+ newSize = 1 << iBin;
+ mem5.aCtrl[i+newSize] = CTRL_FREE | iBin;
+ memsys5Link(i+newSize, iBin);
+ }
+ mem5.aCtrl[i] = iLogsize;
+
+#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
+ /* Update allocator performance statistics. */
+ mem5.nAlloc++;
+ mem5.totalAlloc += iFullSz;
+ mem5.totalExcess += iFullSz - nByte;
+ mem5.currentCount++;
+ mem5.currentOut += iFullSz;
+ if( mem5.maxCount<mem5.currentCount ) mem5.maxCount = mem5.currentCount;
+ if( mem5.maxOut<mem5.currentOut ) mem5.maxOut = mem5.currentOut;
+#endif
+
+#ifdef SQLITE_DEBUG
+ /* Make sure the allocated memory does not assume that it is set to zero
+ ** or retains a value from a previous allocation */
+ memset(&mem5.zPool[i*mem5.szAtom], 0xAA, iFullSz);
+#endif
+
+ /* Return a pointer to the allocated memory. */
+ return (void*)&mem5.zPool[i*mem5.szAtom];
+}
+
+/*
+** Free an outstanding memory allocation.
+*/
+static void memsys5FreeUnsafe(void *pOld){
+ u32 size, iLogsize;
+ int iBlock;
+
+ /* Set iBlock to the index of the block pointed to by pOld in
+ ** the array of mem5.szAtom byte blocks pointed to by mem5.zPool.
+ */
+ iBlock = (int)(((u8 *)pOld-mem5.zPool)/mem5.szAtom);
+
+ /* Check that the pointer pOld points to a valid, non-free block. */
+ assert( iBlock>=0 && iBlock<mem5.nBlock );
+ assert( ((u8 *)pOld-mem5.zPool)%mem5.szAtom==0 );
+ assert( (mem5.aCtrl[iBlock] & CTRL_FREE)==0 );
+
+ iLogsize = mem5.aCtrl[iBlock] & CTRL_LOGSIZE;
+ size = 1<<iLogsize;
+ assert( iBlock+size-1<(u32)mem5.nBlock );
+
+ mem5.aCtrl[iBlock] |= CTRL_FREE;
+ mem5.aCtrl[iBlock+size-1] |= CTRL_FREE;
+
+#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
+ assert( mem5.currentCount>0 );
+ assert( mem5.currentOut>=(size*mem5.szAtom) );
+ mem5.currentCount--;
+ mem5.currentOut -= size*mem5.szAtom;
+ assert( mem5.currentOut>0 || mem5.currentCount==0 );
+ assert( mem5.currentCount>0 || mem5.currentOut==0 );
+#endif
+
+ mem5.aCtrl[iBlock] = CTRL_FREE | iLogsize;
+ while( ALWAYS(iLogsize<LOGMAX) ){
+ int iBuddy;
+ if( (iBlock>>iLogsize) & 1 ){
+ iBuddy = iBlock - size;
+ assert( iBuddy>=0 );
+ }else{
+ iBuddy = iBlock + size;
+ if( iBuddy>=mem5.nBlock ) break;
+ }
+ if( mem5.aCtrl[iBuddy]!=(CTRL_FREE | iLogsize) ) break;
+ memsys5Unlink(iBuddy, iLogsize);
+ iLogsize++;
+ if( iBuddy<iBlock ){
+ mem5.aCtrl[iBuddy] = CTRL_FREE | iLogsize;
+ mem5.aCtrl[iBlock] = 0;
+ iBlock = iBuddy;
+ }else{
+ mem5.aCtrl[iBlock] = CTRL_FREE | iLogsize;
+ mem5.aCtrl[iBuddy] = 0;
+ }
+ size *= 2;
+ }
+
+#ifdef SQLITE_DEBUG
+ /* Overwrite freed memory with the 0x55 bit pattern to verify that it is
+ ** not used after being freed */
+ memset(&mem5.zPool[iBlock*mem5.szAtom], 0x55, size);
+#endif
+
+ memsys5Link(iBlock, iLogsize);
+}
+
+/*
+** Allocate nBytes of memory.
+*/
+static void *memsys5Malloc(int nBytes){
+ sqlite3_int64 *p = 0;
+ if( nBytes>0 ){
+ memsys5Enter();
+ p = memsys5MallocUnsafe(nBytes);
+ memsys5Leave();
+ }
+ return (void*)p;
+}
+
+/*
+** Free memory.
+**
+** The outer layer memory allocator prevents this routine from
+** being called with pPrior==0.
+*/
+static void memsys5Free(void *pPrior){
+ assert( pPrior!=0 );
+ memsys5Enter();
+ memsys5FreeUnsafe(pPrior);
+ memsys5Leave();
+}
+
+/*
+** Change the size of an existing memory allocation.
+**
+** The outer layer memory allocator prevents this routine from
+** being called with pPrior==0.
+**
+** nBytes is always a value obtained from a prior call to
+** memsys5Round(). Hence nBytes is always a non-negative power
+** of two. If nBytes==0 that means that an oversize allocation
+** (an allocation larger than 0x40000000) was requested and this
+** routine should return 0 without freeing pPrior.
+*/
+static void *memsys5Realloc(void *pPrior, int nBytes){
+ int nOld;
+ void *p;
+ assert( pPrior!=0 );
+ assert( (nBytes&(nBytes-1))==0 ); /* EV: R-46199-30249 */
+ assert( nBytes>=0 );
+ if( nBytes==0 ){
+ return 0;
+ }
+ nOld = memsys5Size(pPrior);
+ if( nBytes<=nOld ){
+ return pPrior;
+ }
+ p = memsys5Malloc(nBytes);
+ if( p ){
+ memcpy(p, pPrior, nOld);
+ memsys5Free(pPrior);
+ }
+ return p;
+}
+
+/*
+** Round up a request size to the next valid allocation size. If
+** the allocation is too large to be handled by this allocation system,
+** return 0.
+**
+** All allocations must be a power of two and must be expressed by a
+** 32-bit signed integer. Hence the largest allocation is 0x40000000
+** or 1073741824 bytes.
+*/
+static int memsys5Roundup(int n){
+ int iFullSz;
+ if( n<=mem5.szAtom*2 ){
+ if( n<=mem5.szAtom ) return mem5.szAtom;
+ return mem5.szAtom*2;
+ }
+ if( n>0x10000000 ){
+ if( n>0x40000000 ) return 0;
+ if( n>0x20000000 ) return 0x40000000;
+ return 0x20000000;
+ }
+ for(iFullSz=mem5.szAtom*8; iFullSz<n; iFullSz *= 4);
+ if( (iFullSz/2)>=(i64)n ) return iFullSz/2;
+ return iFullSz;
+}
+
+/*
+** Return the ceiling of the logarithm base 2 of iValue.
+**
+** Examples: memsys5Log(1) -> 0
+** memsys5Log(2) -> 1
+** memsys5Log(4) -> 2
+** memsys5Log(5) -> 3
+** memsys5Log(8) -> 3
+** memsys5Log(9) -> 4
+*/
+static int memsys5Log(int iValue){
+ int iLog;
+ for(iLog=0; (iLog<(int)((sizeof(int)*8)-1)) && (1<<iLog)<iValue; iLog++);
+ return iLog;
+}
+
+/*
+** Initialize the memory allocator.
+**
+** This routine is not threadsafe. The caller must be holding a mutex
+** to prevent multiple threads from entering at the same time.
+*/
+static int memsys5Init(void *NotUsed){
+ int ii; /* Loop counter */
+ int nByte; /* Number of bytes of memory available to this allocator */
+ u8 *zByte; /* Memory usable by this allocator */
+ int nMinLog; /* Log base 2 of minimum allocation size in bytes */
+ int iOffset; /* An offset into mem5.aCtrl[] */
+
+ UNUSED_PARAMETER(NotUsed);
+
+ /* For the purposes of this routine, disable the mutex */
+ mem5.mutex = 0;
+
+ /* The size of a Mem5Link object must be a power of two. Verify that
+ ** this is case.
+ */
+ assert( (sizeof(Mem5Link)&(sizeof(Mem5Link)-1))==0 );
+
+ nByte = sqlite3GlobalConfig.nHeap;
+ zByte = (u8*)sqlite3GlobalConfig.pHeap;
+ assert( zByte!=0 ); /* sqlite3_config() does not allow otherwise */
+
+ /* boundaries on sqlite3GlobalConfig.mnReq are enforced in sqlite3_config() */
+ nMinLog = memsys5Log(sqlite3GlobalConfig.mnReq);
+ mem5.szAtom = (1<<nMinLog);
+ while( (int)sizeof(Mem5Link)>mem5.szAtom ){
+ mem5.szAtom = mem5.szAtom << 1;
+ }
+
+ mem5.nBlock = (nByte / (mem5.szAtom+sizeof(u8)));
+ mem5.zPool = zByte;
+ mem5.aCtrl = (u8 *)&mem5.zPool[mem5.nBlock*mem5.szAtom];
+
+ for(ii=0; ii<=LOGMAX; ii++){
+ mem5.aiFreelist[ii] = -1;
+ }
+
+ iOffset = 0;
+ for(ii=LOGMAX; ii>=0; ii--){
+ int nAlloc = (1<<ii);
+ if( (iOffset+nAlloc)<=mem5.nBlock ){
+ mem5.aCtrl[iOffset] = ii | CTRL_FREE;
+ memsys5Link(iOffset, ii);
+ iOffset += nAlloc;
+ }
+ assert((iOffset+nAlloc)>mem5.nBlock);
+ }
+
+ /* If a mutex is required for normal operation, allocate one */
+ if( sqlite3GlobalConfig.bMemstat==0 ){
+ mem5.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);
+ }
+
+ return SQLITE_OK;
+}
+
+/*
+** Deinitialize this module.
+*/
+static void memsys5Shutdown(void *NotUsed){
+ UNUSED_PARAMETER(NotUsed);
+ mem5.mutex = 0;
+ return;
+}
+
+#ifdef SQLITE_TEST
+/*
+** Open the file indicated and write a log of all unfreed memory
+** allocations into that log.
+*/
+SQLITE_PRIVATE void sqlite3Memsys5Dump(const char *zFilename){
+ FILE *out;
+ int i, j, n;
+ int nMinLog;
+
+ if( zFilename==0 || zFilename[0]==0 ){
+ out = stdout;
+ }else{
+ out = fopen(zFilename, "w");
+ if( out==0 ){
+ fprintf(stderr, "** Unable to output memory debug output log: %s **\n",
+ zFilename);
+ return;
+ }
+ }
+ memsys5Enter();
+ nMinLog = memsys5Log(mem5.szAtom);
+ for(i=0; i<=LOGMAX && i+nMinLog<32; i++){
+ for(n=0, j=mem5.aiFreelist[i]; j>=0; j = MEM5LINK(j)->next, n++){}
+ fprintf(out, "freelist items of size %d: %d\n", mem5.szAtom << i, n);
+ }
+ fprintf(out, "mem5.nAlloc = %llu\n", mem5.nAlloc);
+ fprintf(out, "mem5.totalAlloc = %llu\n", mem5.totalAlloc);
+ fprintf(out, "mem5.totalExcess = %llu\n", mem5.totalExcess);
+ fprintf(out, "mem5.currentOut = %u\n", mem5.currentOut);
+ fprintf(out, "mem5.currentCount = %u\n", mem5.currentCount);
+ fprintf(out, "mem5.maxOut = %u\n", mem5.maxOut);
+ fprintf(out, "mem5.maxCount = %u\n", mem5.maxCount);
+ fprintf(out, "mem5.maxRequest = %u\n", mem5.maxRequest);
+ memsys5Leave();
+ if( out==stdout ){
+ fflush(stdout);
+ }else{
+ fclose(out);
+ }
+}
+#endif
+
+/*
+** This routine is the only routine in this file with external
+** linkage. It returns a pointer to a static sqlite3_mem_methods
+** struct populated with the memsys5 methods.
+*/
+SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys5(void){
+ static const sqlite3_mem_methods memsys5Methods = {
+ memsys5Malloc,
+ memsys5Free,
+ memsys5Realloc,
+ memsys5Size,
+ memsys5Roundup,
+ memsys5Init,
+ memsys5Shutdown,
+ 0
+ };
+ return &memsys5Methods;
+}
+
+#endif /* SQLITE_ENABLE_MEMSYS5 */
+
+/************** End of mem5.c ************************************************/
+/************** Begin file mutex.c *******************************************/
+/*
+** 2007 August 14
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This file contains the C functions that implement mutexes.
+**
+** This file contains code that is common across all mutex implementations.
+*/
+/* #include "sqliteInt.h" */
+
+#if defined(SQLITE_DEBUG) && !defined(SQLITE_MUTEX_OMIT)
+/*
+** For debugging purposes, record when the mutex subsystem is initialized
+** and uninitialized so that we can assert() if there is an attempt to
+** allocate a mutex while the system is uninitialized.
+*/
+static SQLITE_WSD int mutexIsInit = 0;
+#endif /* SQLITE_DEBUG && !defined(SQLITE_MUTEX_OMIT) */
+
+
+#ifndef SQLITE_MUTEX_OMIT
+
+#ifdef SQLITE_ENABLE_MULTITHREADED_CHECKS
+/*
+** This block (enclosed by SQLITE_ENABLE_MULTITHREADED_CHECKS) contains
+** the implementation of a wrapper around the system default mutex
+** implementation (sqlite3DefaultMutex()).
+**
+** Most calls are passed directly through to the underlying default
+** mutex implementation. Except, if a mutex is configured by calling
+** sqlite3MutexWarnOnContention() on it, then if contention is ever
+** encountered within xMutexEnter() a warning is emitted via sqlite3_log().
+**
+** This type of mutex is used as the database handle mutex when testing
+** apps that usually use SQLITE_CONFIG_MULTITHREAD mode.
+*/
+
+/*
+** Type for all mutexes used when SQLITE_ENABLE_MULTITHREADED_CHECKS
+** is defined. Variable CheckMutex.mutex is a pointer to the real mutex
+** allocated by the system mutex implementation. Variable iType is usually set
+** to the type of mutex requested - SQLITE_MUTEX_RECURSIVE, SQLITE_MUTEX_FAST
+** or one of the static mutex identifiers. Or, if this is a recursive mutex
+** that has been configured using sqlite3MutexWarnOnContention(), it is
+** set to SQLITE_MUTEX_WARNONCONTENTION.
+*/
+typedef struct CheckMutex CheckMutex;
+struct CheckMutex {
+ int iType;
+ sqlite3_mutex *mutex;
+};
+
+#define SQLITE_MUTEX_WARNONCONTENTION (-1)
+
+/*
+** Pointer to real mutex methods object used by the CheckMutex
+** implementation. Set by checkMutexInit().
+*/
+static SQLITE_WSD const sqlite3_mutex_methods *pGlobalMutexMethods;
+
+#ifdef SQLITE_DEBUG
+static int checkMutexHeld(sqlite3_mutex *p){
+ return pGlobalMutexMethods->xMutexHeld(((CheckMutex*)p)->mutex);
+}
+static int checkMutexNotheld(sqlite3_mutex *p){
+ return pGlobalMutexMethods->xMutexNotheld(((CheckMutex*)p)->mutex);
+}
+#endif
+
+/*
+** Initialize and deinitialize the mutex subsystem.
+*/
+static int checkMutexInit(void){
+ pGlobalMutexMethods = sqlite3DefaultMutex();
+ return SQLITE_OK;
+}
+static int checkMutexEnd(void){
+ pGlobalMutexMethods = 0;
+ return SQLITE_OK;
+}
+
+/*
+** Allocate a mutex.
+*/
+static sqlite3_mutex *checkMutexAlloc(int iType){
+ static CheckMutex staticMutexes[] = {
+ {2, 0}, {3, 0}, {4, 0}, {5, 0},
+ {6, 0}, {7, 0}, {8, 0}, {9, 0},
+ {10, 0}, {11, 0}, {12, 0}, {13, 0}
+ };
+ CheckMutex *p = 0;
+
+ assert( SQLITE_MUTEX_RECURSIVE==1 && SQLITE_MUTEX_FAST==0 );
+ if( iType<2 ){
+ p = sqlite3MallocZero(sizeof(CheckMutex));
+ if( p==0 ) return 0;
+ p->iType = iType;
+ }else{
+#ifdef SQLITE_ENABLE_API_ARMOR
+ if( iType-2>=ArraySize(staticMutexes) ){
+ (void)SQLITE_MISUSE_BKPT;
+ return 0;
+ }
+#endif
+ p = &staticMutexes[iType-2];
+ }
+
+ if( p->mutex==0 ){
+ p->mutex = pGlobalMutexMethods->xMutexAlloc(iType);
+ if( p->mutex==0 ){
+ if( iType<2 ){
+ sqlite3_free(p);
+ }
+ p = 0;
+ }
+ }
+
+ return (sqlite3_mutex*)p;
+}
+
+/*
+** Free a mutex.
+*/
+static void checkMutexFree(sqlite3_mutex *p){
+ assert( SQLITE_MUTEX_RECURSIVE<2 );
+ assert( SQLITE_MUTEX_FAST<2 );
+ assert( SQLITE_MUTEX_WARNONCONTENTION<2 );
+
+#ifdef SQLITE_ENABLE_API_ARMOR
+ if( ((CheckMutex*)p)->iType<2 )
+#endif
+ {
+ CheckMutex *pCheck = (CheckMutex*)p;
+ pGlobalMutexMethods->xMutexFree(pCheck->mutex);
+ sqlite3_free(pCheck);
+ }
+#ifdef SQLITE_ENABLE_API_ARMOR
+ else{
+ (void)SQLITE_MISUSE_BKPT;
+ }
+#endif
+}
+
+/*
+** Enter the mutex.
+*/
+static void checkMutexEnter(sqlite3_mutex *p){
+ CheckMutex *pCheck = (CheckMutex*)p;
+ if( pCheck->iType==SQLITE_MUTEX_WARNONCONTENTION ){
+ if( SQLITE_OK==pGlobalMutexMethods->xMutexTry(pCheck->mutex) ){
+ return;
+ }
+ sqlite3_log(SQLITE_MISUSE,
+ "illegal multi-threaded access to database connection"
+ );
+ }
+ pGlobalMutexMethods->xMutexEnter(pCheck->mutex);
+}
+
+/*
+** Enter the mutex (do not block).
+*/
+static int checkMutexTry(sqlite3_mutex *p){
+ CheckMutex *pCheck = (CheckMutex*)p;
+ return pGlobalMutexMethods->xMutexTry(pCheck->mutex);
+}
+
+/*
+** Leave the mutex.
+*/
+static void checkMutexLeave(sqlite3_mutex *p){
+ CheckMutex *pCheck = (CheckMutex*)p;
+ pGlobalMutexMethods->xMutexLeave(pCheck->mutex);
+}
+
+sqlite3_mutex_methods const *multiThreadedCheckMutex(void){
+ static const sqlite3_mutex_methods sMutex = {
+ checkMutexInit,
+ checkMutexEnd,
+ checkMutexAlloc,
+ checkMutexFree,
+ checkMutexEnter,
+ checkMutexTry,
+ checkMutexLeave,
+#ifdef SQLITE_DEBUG
+ checkMutexHeld,
+ checkMutexNotheld
+#else
+ 0,
+ 0
+#endif
+ };
+ return &sMutex;
+}
+
+/*
+** Mark the SQLITE_MUTEX_RECURSIVE mutex passed as the only argument as
+** one on which there should be no contention.
+*/
+SQLITE_PRIVATE void sqlite3MutexWarnOnContention(sqlite3_mutex *p){
+ if( sqlite3GlobalConfig.mutex.xMutexAlloc==checkMutexAlloc ){
+ CheckMutex *pCheck = (CheckMutex*)p;
+ assert( pCheck->iType==SQLITE_MUTEX_RECURSIVE );
+ pCheck->iType = SQLITE_MUTEX_WARNONCONTENTION;
+ }
+}
+#endif /* ifdef SQLITE_ENABLE_MULTITHREADED_CHECKS */
+
+/*
+** Initialize the mutex system.
+*/
+SQLITE_PRIVATE int sqlite3MutexInit(void){
+ int rc = SQLITE_OK;
+ if( !sqlite3GlobalConfig.mutex.xMutexAlloc ){
+ /* If the xMutexAlloc method has not been set, then the user did not
+ ** install a mutex implementation via sqlite3_config() prior to
+ ** sqlite3_initialize() being called. This block copies pointers to
+ ** the default implementation into the sqlite3GlobalConfig structure.
+ */
+ sqlite3_mutex_methods const *pFrom;
+ sqlite3_mutex_methods *pTo = &sqlite3GlobalConfig.mutex;
+
+ if( sqlite3GlobalConfig.bCoreMutex ){
+#ifdef SQLITE_ENABLE_MULTITHREADED_CHECKS
+ pFrom = multiThreadedCheckMutex();
+#else
+ pFrom = sqlite3DefaultMutex();
+#endif
+ }else{
+ pFrom = sqlite3NoopMutex();
+ }
+ pTo->xMutexInit = pFrom->xMutexInit;
+ pTo->xMutexEnd = pFrom->xMutexEnd;
+ pTo->xMutexFree = pFrom->xMutexFree;
+ pTo->xMutexEnter = pFrom->xMutexEnter;
+ pTo->xMutexTry = pFrom->xMutexTry;
+ pTo->xMutexLeave = pFrom->xMutexLeave;
+ pTo->xMutexHeld = pFrom->xMutexHeld;
+ pTo->xMutexNotheld = pFrom->xMutexNotheld;
+ sqlite3MemoryBarrier();
+ pTo->xMutexAlloc = pFrom->xMutexAlloc;
+ }
+ assert( sqlite3GlobalConfig.mutex.xMutexInit );
+ rc = sqlite3GlobalConfig.mutex.xMutexInit();
+
+#ifdef SQLITE_DEBUG
+ GLOBAL(int, mutexIsInit) = 1;
+#endif
+
+ sqlite3MemoryBarrier();
+ return rc;
+}
+
+/*
+** Shutdown the mutex system. This call frees resources allocated by
+** sqlite3MutexInit().
+*/
+SQLITE_PRIVATE int sqlite3MutexEnd(void){
+ int rc = SQLITE_OK;
+ if( sqlite3GlobalConfig.mutex.xMutexEnd ){
+ rc = sqlite3GlobalConfig.mutex.xMutexEnd();
+ }
+
+#ifdef SQLITE_DEBUG
+ GLOBAL(int, mutexIsInit) = 0;
+#endif
+
+ return rc;
+}
+
+/*
+** Retrieve a pointer to a static mutex or allocate a new dynamic one.
+*/
+SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int id){
+#ifndef SQLITE_OMIT_AUTOINIT
+ if( id<=SQLITE_MUTEX_RECURSIVE && sqlite3_initialize() ) return 0;
+ if( id>SQLITE_MUTEX_RECURSIVE && sqlite3MutexInit() ) return 0;
+#endif
+ assert( sqlite3GlobalConfig.mutex.xMutexAlloc );
+ return sqlite3GlobalConfig.mutex.xMutexAlloc(id);
+}
+
+SQLITE_PRIVATE sqlite3_mutex *sqlite3MutexAlloc(int id){
+ if( !sqlite3GlobalConfig.bCoreMutex ){
+ return 0;
+ }
+ assert( GLOBAL(int, mutexIsInit) );
+ assert( sqlite3GlobalConfig.mutex.xMutexAlloc );
+ return sqlite3GlobalConfig.mutex.xMutexAlloc(id);
+}
+
+/*
+** Free a dynamic mutex.
+*/
+SQLITE_API void sqlite3_mutex_free(sqlite3_mutex *p){
+ if( p ){
+ assert( sqlite3GlobalConfig.mutex.xMutexFree );
+ sqlite3GlobalConfig.mutex.xMutexFree(p);
+ }
+}
+
+/*
+** Obtain the mutex p. If some other thread already has the mutex, block
+** until it can be obtained.
+*/
+SQLITE_API void sqlite3_mutex_enter(sqlite3_mutex *p){
+ if( p ){
+ assert( sqlite3GlobalConfig.mutex.xMutexEnter );
+ sqlite3GlobalConfig.mutex.xMutexEnter(p);
+ }
+}
+
+/*
+** Obtain the mutex p. If successful, return SQLITE_OK. Otherwise, if another
+** thread holds the mutex and it cannot be obtained, return SQLITE_BUSY.
+*/
+SQLITE_API int sqlite3_mutex_try(sqlite3_mutex *p){
+ int rc = SQLITE_OK;
+ if( p ){
+ assert( sqlite3GlobalConfig.mutex.xMutexTry );
+ return sqlite3GlobalConfig.mutex.xMutexTry(p);
+ }
+ return rc;
+}
+
+/*
+** The sqlite3_mutex_leave() routine exits a mutex that was previously
+** entered by the same thread. The behavior is undefined if the mutex
+** is not currently entered. If a NULL pointer is passed as an argument
+** this function is a no-op.
+*/
+SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex *p){
+ if( p ){
+ assert( sqlite3GlobalConfig.mutex.xMutexLeave );
+ sqlite3GlobalConfig.mutex.xMutexLeave(p);
+ }
+}
+
+#ifndef NDEBUG
+/*
+** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are
+** intended for use inside assert() statements.
+**
+** Because these routines raise false-positive alerts in TSAN, disable
+** them (make them always return 1) when compiling with TSAN.
+*/
+SQLITE_API int sqlite3_mutex_held(sqlite3_mutex *p){
+# if defined(__has_feature)
+# if __has_feature(thread_sanitizer)
+ p = 0;
+# endif
+# endif
+ assert( p==0 || sqlite3GlobalConfig.mutex.xMutexHeld );
+ return p==0 || sqlite3GlobalConfig.mutex.xMutexHeld(p);
+}
+SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex *p){
+# if defined(__has_feature)
+# if __has_feature(thread_sanitizer)
+ p = 0;
+# endif
+# endif
+ assert( p==0 || sqlite3GlobalConfig.mutex.xMutexNotheld );
+ return p==0 || sqlite3GlobalConfig.mutex.xMutexNotheld(p);
+}
+#endif /* NDEBUG */
+
+#endif /* !defined(SQLITE_MUTEX_OMIT) */
+
+/************** End of mutex.c ***********************************************/
+/************** Begin file mutex_noop.c **************************************/
+/*
+** 2008 October 07
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This file contains the C functions that implement mutexes.
+**
+** This implementation in this file does not provide any mutual
+** exclusion and is thus suitable for use only in applications
+** that use SQLite in a single thread. The routines defined
+** here are place-holders. Applications can substitute working
+** mutex routines at start-time using the
+**
+** sqlite3_config(SQLITE_CONFIG_MUTEX,...)
+**
+** interface.
+**
+** If compiled with SQLITE_DEBUG, then additional logic is inserted
+** that does error checking on mutexes to make sure they are being
+** called correctly.
+*/
+/* #include "sqliteInt.h" */
+
+#ifndef SQLITE_MUTEX_OMIT
+
+#ifndef SQLITE_DEBUG
+/*
+** Stub routines for all mutex methods.
+**
+** This routines provide no mutual exclusion or error checking.
+*/
+static int noopMutexInit(void){ return SQLITE_OK; }
+static int noopMutexEnd(void){ return SQLITE_OK; }
+static sqlite3_mutex *noopMutexAlloc(int id){
+ UNUSED_PARAMETER(id);
+ return (sqlite3_mutex*)8;
+}
+static void noopMutexFree(sqlite3_mutex *p){ UNUSED_PARAMETER(p); return; }
+static void noopMutexEnter(sqlite3_mutex *p){ UNUSED_PARAMETER(p); return; }
+static int noopMutexTry(sqlite3_mutex *p){
+ UNUSED_PARAMETER(p);
+ return SQLITE_OK;
+}
+static void noopMutexLeave(sqlite3_mutex *p){ UNUSED_PARAMETER(p); return; }
+
+SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3NoopMutex(void){
+ static const sqlite3_mutex_methods sMutex = {
+ noopMutexInit,
+ noopMutexEnd,
+ noopMutexAlloc,
+ noopMutexFree,
+ noopMutexEnter,
+ noopMutexTry,
+ noopMutexLeave,
+
+ 0,
+ 0,
+ };
+
+ return &sMutex;
+}
+#endif /* !SQLITE_DEBUG */
+
+#ifdef SQLITE_DEBUG
+/*
+** In this implementation, error checking is provided for testing
+** and debugging purposes. The mutexes still do not provide any
+** mutual exclusion.
+*/
+
+/*
+** The mutex object
+*/
+typedef struct sqlite3_debug_mutex {
+ int id; /* The mutex type */
+ int cnt; /* Number of entries without a matching leave */
+} sqlite3_debug_mutex;
+
+/*
+** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are
+** intended for use inside assert() statements.
+*/
+static int debugMutexHeld(sqlite3_mutex *pX){
+ sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX;
+ return p==0 || p->cnt>0;
+}
+static int debugMutexNotheld(sqlite3_mutex *pX){
+ sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX;
+ return p==0 || p->cnt==0;
+}
+
+/*
+** Initialize and deinitialize the mutex subsystem.
+*/
+static int debugMutexInit(void){ return SQLITE_OK; }
+static int debugMutexEnd(void){ return SQLITE_OK; }
+
+/*
+** The sqlite3_mutex_alloc() routine allocates a new
+** mutex and returns a pointer to it. If it returns NULL
+** that means that a mutex could not be allocated.
+*/
+static sqlite3_mutex *debugMutexAlloc(int id){
+ static sqlite3_debug_mutex aStatic[SQLITE_MUTEX_STATIC_VFS3 - 1];
+ sqlite3_debug_mutex *pNew = 0;
+ switch( id ){
+ case SQLITE_MUTEX_FAST:
+ case SQLITE_MUTEX_RECURSIVE: {
+ pNew = sqlite3Malloc(sizeof(*pNew));
+ if( pNew ){
+ pNew->id = id;
+ pNew->cnt = 0;
+ }
+ break;
+ }
+ default: {
+#ifdef SQLITE_ENABLE_API_ARMOR
+ if( id-2<0 || id-2>=ArraySize(aStatic) ){
+ (void)SQLITE_MISUSE_BKPT;
+ return 0;
+ }
+#endif
+ pNew = &aStatic[id-2];
+ pNew->id = id;
+ break;
+ }
+ }
+ return (sqlite3_mutex*)pNew;
+}
+
+/*
+** This routine deallocates a previously allocated mutex.
+*/
+static void debugMutexFree(sqlite3_mutex *pX){
+ sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX;
+ assert( p->cnt==0 );
+ if( p->id==SQLITE_MUTEX_RECURSIVE || p->id==SQLITE_MUTEX_FAST ){
+ sqlite3_free(p);
+ }else{
+#ifdef SQLITE_ENABLE_API_ARMOR
+ (void)SQLITE_MISUSE_BKPT;
+#endif
+ }
+}
+
+/*
+** The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt
+** to enter a mutex. If another thread is already within the mutex,
+** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return
+** SQLITE_BUSY. The sqlite3_mutex_try() interface returns SQLITE_OK
+** upon successful entry. Mutexes created using SQLITE_MUTEX_RECURSIVE can
+** be entered multiple times by the same thread. In such cases the,
+** mutex must be exited an equal number of times before another thread
+** can enter. If the same thread tries to enter any other kind of mutex
+** more than once, the behavior is undefined.
+*/
+static void debugMutexEnter(sqlite3_mutex *pX){
+ sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX;
+ assert( p->id==SQLITE_MUTEX_RECURSIVE || debugMutexNotheld(pX) );
+ p->cnt++;
+}
+static int debugMutexTry(sqlite3_mutex *pX){
+ sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX;
+ assert( p->id==SQLITE_MUTEX_RECURSIVE || debugMutexNotheld(pX) );
+ p->cnt++;
+ return SQLITE_OK;
+}
+
+/*
+** The sqlite3_mutex_leave() routine exits a mutex that was
+** previously entered by the same thread. The behavior
+** is undefined if the mutex is not currently entered or
+** is not currently allocated. SQLite will never do either.
+*/
+static void debugMutexLeave(sqlite3_mutex *pX){
+ sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX;
+ assert( debugMutexHeld(pX) );
+ p->cnt--;
+ assert( p->id==SQLITE_MUTEX_RECURSIVE || debugMutexNotheld(pX) );
+}
+
+SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3NoopMutex(void){
+ static const sqlite3_mutex_methods sMutex = {
+ debugMutexInit,
+ debugMutexEnd,
+ debugMutexAlloc,
+ debugMutexFree,
+ debugMutexEnter,
+ debugMutexTry,
+ debugMutexLeave,
+
+ debugMutexHeld,
+ debugMutexNotheld
+ };
+
+ return &sMutex;
+}
+#endif /* SQLITE_DEBUG */
+
+/*
+** If compiled with SQLITE_MUTEX_NOOP, then the no-op mutex implementation
+** is used regardless of the run-time threadsafety setting.
+*/
+#ifdef SQLITE_MUTEX_NOOP
+SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){
+ return sqlite3NoopMutex();
+}
+#endif /* defined(SQLITE_MUTEX_NOOP) */
+#endif /* !defined(SQLITE_MUTEX_OMIT) */
+
+/************** End of mutex_noop.c ******************************************/
+/************** Begin file mutex_unix.c **************************************/
+/*
+** 2007 August 28
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This file contains the C functions that implement mutexes for pthreads
+*/
+/* #include "sqliteInt.h" */
+
+/*
+** The code in this file is only used if we are compiling threadsafe
+** under unix with pthreads.
+**
+** Note that this implementation requires a version of pthreads that
+** supports recursive mutexes.
+*/
+#ifdef SQLITE_MUTEX_PTHREADS
+
+#include <pthread.h>
+
+/*
+** The sqlite3_mutex.id, sqlite3_mutex.nRef, and sqlite3_mutex.owner fields
+** are necessary under two conditions: (1) Debug builds and (2) using
+** home-grown mutexes. Encapsulate these conditions into a single #define.
+*/
+#if defined(SQLITE_DEBUG) || defined(SQLITE_HOMEGROWN_RECURSIVE_MUTEX)
+# define SQLITE_MUTEX_NREF 1
+#else
+# define SQLITE_MUTEX_NREF 0
+#endif
+
+/*
+** Each recursive mutex is an instance of the following structure.
+*/
+struct sqlite3_mutex {
+ pthread_mutex_t mutex; /* Mutex controlling the lock */
+#if SQLITE_MUTEX_NREF || defined(SQLITE_ENABLE_API_ARMOR)
+ int id; /* Mutex type */
+#endif
+#if SQLITE_MUTEX_NREF
+ volatile int nRef; /* Number of entrances */
+ volatile pthread_t owner; /* Thread that is within this mutex */
+ int trace; /* True to trace changes */
+#endif
+};
+#if SQLITE_MUTEX_NREF
+# define SQLITE3_MUTEX_INITIALIZER(id) \
+ {PTHREAD_MUTEX_INITIALIZER,id,0,(pthread_t)0,0}
+#elif defined(SQLITE_ENABLE_API_ARMOR)
+# define SQLITE3_MUTEX_INITIALIZER(id) { PTHREAD_MUTEX_INITIALIZER, id }
+#else
+#define SQLITE3_MUTEX_INITIALIZER(id) { PTHREAD_MUTEX_INITIALIZER }
+#endif
+
+/*
+** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are
+** intended for use only inside assert() statements. On some platforms,
+** there might be race conditions that can cause these routines to
+** deliver incorrect results. In particular, if pthread_equal() is
+** not an atomic operation, then these routines might delivery
+** incorrect results. On most platforms, pthread_equal() is a
+** comparison of two integers and is therefore atomic. But we are
+** told that HPUX is not such a platform. If so, then these routines
+** will not always work correctly on HPUX.
+**
+** On those platforms where pthread_equal() is not atomic, SQLite
+** should be compiled without -DSQLITE_DEBUG and with -DNDEBUG to
+** make sure no assert() statements are evaluated and hence these
+** routines are never called.
+*/
+#if !defined(NDEBUG) || defined(SQLITE_DEBUG)
+static int pthreadMutexHeld(sqlite3_mutex *p){
+ return (p->nRef!=0 && pthread_equal(p->owner, pthread_self()));
+}
+static int pthreadMutexNotheld(sqlite3_mutex *p){
+ return p->nRef==0 || pthread_equal(p->owner, pthread_self())==0;
+}
+#endif
+
+/*
+** Try to provide a memory barrier operation, needed for initialization
+** and also for the implementation of xShmBarrier in the VFS in cases
+** where SQLite is compiled without mutexes.
+*/
+SQLITE_PRIVATE void sqlite3MemoryBarrier(void){
+#if defined(SQLITE_MEMORY_BARRIER)
+ SQLITE_MEMORY_BARRIER;
+#elif defined(__GNUC__) && GCC_VERSION>=4001000
+ __sync_synchronize();
+#endif
+}
+
+/*
+** Initialize and deinitialize the mutex subsystem.
+*/
+static int pthreadMutexInit(void){ return SQLITE_OK; }
+static int pthreadMutexEnd(void){ return SQLITE_OK; }
+
+/*
+** The sqlite3_mutex_alloc() routine allocates a new
+** mutex and returns a pointer to it. If it returns NULL
+** that means that a mutex could not be allocated. SQLite
+** will unwind its stack and return an error. The argument
+** to sqlite3_mutex_alloc() is one of these integer constants:
+**
+** <ul>
+** <li> SQLITE_MUTEX_FAST
+** <li> SQLITE_MUTEX_RECURSIVE
+** <li> SQLITE_MUTEX_STATIC_MAIN
+** <li> SQLITE_MUTEX_STATIC_MEM
+** <li> SQLITE_MUTEX_STATIC_OPEN
+** <li> SQLITE_MUTEX_STATIC_PRNG
+** <li> SQLITE_MUTEX_STATIC_LRU
+** <li> SQLITE_MUTEX_STATIC_PMEM
+** <li> SQLITE_MUTEX_STATIC_APP1
+** <li> SQLITE_MUTEX_STATIC_APP2
+** <li> SQLITE_MUTEX_STATIC_APP3
+** <li> SQLITE_MUTEX_STATIC_VFS1
+** <li> SQLITE_MUTEX_STATIC_VFS2
+** <li> SQLITE_MUTEX_STATIC_VFS3
+** </ul>
+**
+** The first two constants cause sqlite3_mutex_alloc() to create
+** a new mutex. The new mutex is recursive when SQLITE_MUTEX_RECURSIVE
+** is used but not necessarily so when SQLITE_MUTEX_FAST is used.
+** The mutex implementation does not need to make a distinction
+** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does
+** not want to. But SQLite will only request a recursive mutex in
+** cases where it really needs one. If a faster non-recursive mutex
+** implementation is available on the host platform, the mutex subsystem
+** might return such a mutex in response to SQLITE_MUTEX_FAST.
+**
+** The other allowed parameters to sqlite3_mutex_alloc() each return
+** a pointer to a static preexisting mutex. Six static mutexes are
+** used by the current version of SQLite. Future versions of SQLite
+** may add additional static mutexes. Static mutexes are for internal
+** use by SQLite only. Applications that use SQLite mutexes should
+** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or
+** SQLITE_MUTEX_RECURSIVE.
+**
+** Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST
+** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()
+** returns a different mutex on every call. But for the static
+** mutex types, the same mutex is returned on every call that has
+** the same type number.
+*/
+static sqlite3_mutex *pthreadMutexAlloc(int iType){
+ static sqlite3_mutex staticMutexes[] = {
+ SQLITE3_MUTEX_INITIALIZER(2),
+ SQLITE3_MUTEX_INITIALIZER(3),
+ SQLITE3_MUTEX_INITIALIZER(4),
+ SQLITE3_MUTEX_INITIALIZER(5),
+ SQLITE3_MUTEX_INITIALIZER(6),
+ SQLITE3_MUTEX_INITIALIZER(7),
+ SQLITE3_MUTEX_INITIALIZER(8),
+ SQLITE3_MUTEX_INITIALIZER(9),
+ SQLITE3_MUTEX_INITIALIZER(10),
+ SQLITE3_MUTEX_INITIALIZER(11),
+ SQLITE3_MUTEX_INITIALIZER(12),
+ SQLITE3_MUTEX_INITIALIZER(13)
+ };
+ sqlite3_mutex *p;
+ switch( iType ){
+ case SQLITE_MUTEX_RECURSIVE: {
+ p = sqlite3MallocZero( sizeof(*p) );
+ if( p ){
+#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX
+ /* If recursive mutexes are not available, we will have to
+ ** build our own. See below. */
+ pthread_mutex_init(&p->mutex, 0);
+#else
+ /* Use a recursive mutex if it is available */
+ pthread_mutexattr_t recursiveAttr;
+ pthread_mutexattr_init(&recursiveAttr);
+ pthread_mutexattr_settype(&recursiveAttr, PTHREAD_MUTEX_RECURSIVE);
+ pthread_mutex_init(&p->mutex, &recursiveAttr);
+ pthread_mutexattr_destroy(&recursiveAttr);
+#endif
+#if SQLITE_MUTEX_NREF || defined(SQLITE_ENABLE_API_ARMOR)
+ p->id = SQLITE_MUTEX_RECURSIVE;
+#endif
+ }
+ break;
+ }
+ case SQLITE_MUTEX_FAST: {
+ p = sqlite3MallocZero( sizeof(*p) );
+ if( p ){
+ pthread_mutex_init(&p->mutex, 0);
+#if SQLITE_MUTEX_NREF || defined(SQLITE_ENABLE_API_ARMOR)
+ p->id = SQLITE_MUTEX_FAST;
+#endif
+ }
+ break;
+ }
+ default: {
+#ifdef SQLITE_ENABLE_API_ARMOR
+ if( iType-2<0 || iType-2>=ArraySize(staticMutexes) ){
+ (void)SQLITE_MISUSE_BKPT;
+ return 0;
+ }
+#endif
+ p = &staticMutexes[iType-2];
+ break;
+ }
+ }
+#if SQLITE_MUTEX_NREF || defined(SQLITE_ENABLE_API_ARMOR)
+ assert( p==0 || p->id==iType );
+#endif
+ return p;
+}
+
+
+/*
+** This routine deallocates a previously
+** allocated mutex. SQLite is careful to deallocate every
+** mutex that it allocates.
+*/
+static void pthreadMutexFree(sqlite3_mutex *p){
+ assert( p->nRef==0 );
+#ifdef SQLITE_ENABLE_API_ARMOR
+ if( p->id==SQLITE_MUTEX_FAST || p->id==SQLITE_MUTEX_RECURSIVE )
+#endif
+ {
+ pthread_mutex_destroy(&p->mutex);
+ sqlite3_free(p);
+ }
+#ifdef SQLITE_ENABLE_API_ARMOR
+ else{
+ (void)SQLITE_MISUSE_BKPT;
+ }
+#endif
+}
+
+/*
+** The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt
+** to enter a mutex. If another thread is already within the mutex,
+** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return
+** SQLITE_BUSY. The sqlite3_mutex_try() interface returns SQLITE_OK
+** upon successful entry. Mutexes created using SQLITE_MUTEX_RECURSIVE can
+** be entered multiple times by the same thread. In such cases the,
+** mutex must be exited an equal number of times before another thread
+** can enter. If the same thread tries to enter any other kind of mutex
+** more than once, the behavior is undefined.
+*/
+static void pthreadMutexEnter(sqlite3_mutex *p){
+ assert( p->id==SQLITE_MUTEX_RECURSIVE || pthreadMutexNotheld(p) );
+
+#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX
+ /* If recursive mutexes are not available, then we have to grow
+ ** our own. This implementation assumes that pthread_equal()
+ ** is atomic - that it cannot be deceived into thinking self
+ ** and p->owner are equal if p->owner changes between two values
+ ** that are not equal to self while the comparison is taking place.
+ ** This implementation also assumes a coherent cache - that
+ ** separate processes cannot read different values from the same
+ ** address at the same time. If either of these two conditions
+ ** are not met, then the mutexes will fail and problems will result.
+ */
+ {
+ pthread_t self = pthread_self();
+ if( p->nRef>0 && pthread_equal(p->owner, self) ){
+ p->nRef++;
+ }else{
+ pthread_mutex_lock(&p->mutex);
+ assert( p->nRef==0 );
+ p->owner = self;
+ p->nRef = 1;
+ }
+ }
+#else
+ /* Use the built-in recursive mutexes if they are available.
+ */
+ pthread_mutex_lock(&p->mutex);
+#if SQLITE_MUTEX_NREF
+ assert( p->nRef>0 || p->owner==0 );
+ p->owner = pthread_self();
+ p->nRef++;
+#endif
+#endif
+
+#ifdef SQLITE_DEBUG
+ if( p->trace ){
+ printf("enter mutex %p (%d) with nRef=%d\n", p, p->trace, p->nRef);
+ }
+#endif
+}
+static int pthreadMutexTry(sqlite3_mutex *p){
+ int rc;
+ assert( p->id==SQLITE_MUTEX_RECURSIVE || pthreadMutexNotheld(p) );
+
+#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX
+ /* If recursive mutexes are not available, then we have to grow
+ ** our own. This implementation assumes that pthread_equal()
+ ** is atomic - that it cannot be deceived into thinking self
+ ** and p->owner are equal if p->owner changes between two values
+ ** that are not equal to self while the comparison is taking place.
+ ** This implementation also assumes a coherent cache - that
+ ** separate processes cannot read different values from the same
+ ** address at the same time. If either of these two conditions
+ ** are not met, then the mutexes will fail and problems will result.
+ */
+ {
+ pthread_t self = pthread_self();
+ if( p->nRef>0 && pthread_equal(p->owner, self) ){
+ p->nRef++;
+ rc = SQLITE_OK;
+ }else if( pthread_mutex_trylock(&p->mutex)==0 ){
+ assert( p->nRef==0 );
+ p->owner = self;
+ p->nRef = 1;
+ rc = SQLITE_OK;
+ }else{
+ rc = SQLITE_BUSY;
+ }
+ }
+#else
+ /* Use the built-in recursive mutexes if they are available.
+ */
+ if( pthread_mutex_trylock(&p->mutex)==0 ){
+#if SQLITE_MUTEX_NREF
+ p->owner = pthread_self();
+ p->nRef++;
+#endif
+ rc = SQLITE_OK;
+ }else{
+ rc = SQLITE_BUSY;
+ }
+#endif
+
+#ifdef SQLITE_DEBUG
+ if( rc==SQLITE_OK && p->trace ){
+ printf("enter mutex %p (%d) with nRef=%d\n", p, p->trace, p->nRef);
+ }
+#endif
+ return rc;
+}
+
+/*
+** The sqlite3_mutex_leave() routine exits a mutex that was
+** previously entered by the same thread. The behavior
+** is undefined if the mutex is not currently entered or
+** is not currently allocated. SQLite will never do either.
+*/
+static void pthreadMutexLeave(sqlite3_mutex *p){
+ assert( pthreadMutexHeld(p) );
+#if SQLITE_MUTEX_NREF
+ p->nRef--;
+ if( p->nRef==0 ) p->owner = 0;
+#endif
+ assert( p->nRef==0 || p->id==SQLITE_MUTEX_RECURSIVE );
+
+#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX
+ if( p->nRef==0 ){
+ pthread_mutex_unlock(&p->mutex);
+ }
+#else
+ pthread_mutex_unlock(&p->mutex);
+#endif
+
+#ifdef SQLITE_DEBUG
+ if( p->trace ){
+ printf("leave mutex %p (%d) with nRef=%d\n", p, p->trace, p->nRef);
+ }
+#endif
+}
+
+SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){
+ static const sqlite3_mutex_methods sMutex = {
+ pthreadMutexInit,
+ pthreadMutexEnd,
+ pthreadMutexAlloc,
+ pthreadMutexFree,
+ pthreadMutexEnter,
+ pthreadMutexTry,
+ pthreadMutexLeave,
+#ifdef SQLITE_DEBUG
+ pthreadMutexHeld,
+ pthreadMutexNotheld
+#else
+ 0,
+ 0
+#endif
+ };
+
+ return &sMutex;
+}
+
+#endif /* SQLITE_MUTEX_PTHREADS */
+
+/************** End of mutex_unix.c ******************************************/
+/************** Begin file mutex_w32.c ***************************************/
+/*
+** 2007 August 14
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This file contains the C functions that implement mutexes for Win32.
+*/
+/* #include "sqliteInt.h" */
+
+#if SQLITE_OS_WIN
+/*
+** Include code that is common to all os_*.c files
+*/
+/* #include "os_common.h" */
+
+/*
+** Include the header file for the Windows VFS.
+*/
+/************** Include os_win.h in the middle of mutex_w32.c ****************/
+/************** Begin file os_win.h ******************************************/
+/*
+** 2013 November 25
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+******************************************************************************
+**
+** This file contains code that is specific to Windows.
+*/
+#ifndef SQLITE_OS_WIN_H
+#define SQLITE_OS_WIN_H
+
+/*
+** Include the primary Windows SDK header file.
+*/
+#include "windows.h"
+
+#ifdef __CYGWIN__
+# include <sys/cygwin.h>
+# include <errno.h> /* amalgamator: dontcache */
+#endif
+
+/*
+** Determine if we are dealing with Windows NT.
+**
+** We ought to be able to determine if we are compiling for Windows 9x or
+** Windows NT using the _WIN32_WINNT macro as follows:
+**
+** #if defined(_WIN32_WINNT)
+** # define SQLITE_OS_WINNT 1
+** #else
+** # define SQLITE_OS_WINNT 0
+** #endif
+**
+** However, Visual Studio 2005 does not set _WIN32_WINNT by default, as
+** it ought to, so the above test does not work. We'll just assume that
+** everything is Windows NT unless the programmer explicitly says otherwise
+** by setting SQLITE_OS_WINNT to 0.
+*/
+#if SQLITE_OS_WIN && !defined(SQLITE_OS_WINNT)
+# define SQLITE_OS_WINNT 1
+#endif
+
+/*
+** Determine if we are dealing with Windows CE - which has a much reduced
+** API.
+*/
+#if defined(_WIN32_WCE)
+# define SQLITE_OS_WINCE 1
+#else
+# define SQLITE_OS_WINCE 0
+#endif
+
+/*
+** Determine if we are dealing with WinRT, which provides only a subset of
+** the full Win32 API.
+*/
+#if !defined(SQLITE_OS_WINRT)
+# define SQLITE_OS_WINRT 0
+#endif
+
+/*
+** For WinCE, some API function parameters do not appear to be declared as
+** volatile.
+*/
+#if SQLITE_OS_WINCE
+# define SQLITE_WIN32_VOLATILE
+#else
+# define SQLITE_WIN32_VOLATILE volatile
+#endif
+
+/*
+** For some Windows sub-platforms, the _beginthreadex() / _endthreadex()
+** functions are not available (e.g. those not using MSVC, Cygwin, etc).
+*/
+#if SQLITE_OS_WIN && !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && \
+ SQLITE_THREADSAFE>0 && !defined(__CYGWIN__)
+# define SQLITE_OS_WIN_THREADS 1
+#else
+# define SQLITE_OS_WIN_THREADS 0
+#endif
+
+#endif /* SQLITE_OS_WIN_H */
+
+/************** End of os_win.h **********************************************/
+/************** Continuing where we left off in mutex_w32.c ******************/
+#endif
+
+/*
+** The code in this file is only used if we are compiling multithreaded
+** on a Win32 system.
+*/
+#ifdef SQLITE_MUTEX_W32
+
+/*
+** Each recursive mutex is an instance of the following structure.
+*/
+struct sqlite3_mutex {
+ CRITICAL_SECTION mutex; /* Mutex controlling the lock */
+ int id; /* Mutex type */
+#ifdef SQLITE_DEBUG
+ volatile int nRef; /* Number of entrances */
+ volatile DWORD owner; /* Thread holding this mutex */
+ volatile LONG trace; /* True to trace changes */
+#endif
+};
+
+/*
+** These are the initializer values used when declaring a "static" mutex
+** on Win32. It should be noted that all mutexes require initialization
+** on the Win32 platform.
+*/
+#define SQLITE_W32_MUTEX_INITIALIZER { 0 }
+
+#ifdef SQLITE_DEBUG
+#define SQLITE3_MUTEX_INITIALIZER(id) { SQLITE_W32_MUTEX_INITIALIZER, id, \
+ 0L, (DWORD)0, 0 }
+#else
+#define SQLITE3_MUTEX_INITIALIZER(id) { SQLITE_W32_MUTEX_INITIALIZER, id }
+#endif
+
+#ifdef SQLITE_DEBUG
+/*
+** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are
+** intended for use only inside assert() statements.
+*/
+static int winMutexHeld(sqlite3_mutex *p){
+ return p->nRef!=0 && p->owner==GetCurrentThreadId();
+}
+
+static int winMutexNotheld2(sqlite3_mutex *p, DWORD tid){
+ return p->nRef==0 || p->owner!=tid;
+}
+
+static int winMutexNotheld(sqlite3_mutex *p){
+ DWORD tid = GetCurrentThreadId();
+ return winMutexNotheld2(p, tid);
+}
+#endif
+
+/*
+** Try to provide a memory barrier operation, needed for initialization
+** and also for the xShmBarrier method of the VFS in cases when SQLite is
+** compiled without mutexes (SQLITE_THREADSAFE=0).
+*/
+SQLITE_PRIVATE void sqlite3MemoryBarrier(void){
+#if defined(SQLITE_MEMORY_BARRIER)
+ SQLITE_MEMORY_BARRIER;
+#elif defined(__GNUC__)
+ __sync_synchronize();
+#elif MSVC_VERSION>=1400
+ _ReadWriteBarrier();
+#elif defined(MemoryBarrier)
+ MemoryBarrier();
+#endif
+}
+
+/*
+** Initialize and deinitialize the mutex subsystem.
+*/
+static sqlite3_mutex winMutex_staticMutexes[] = {
+ SQLITE3_MUTEX_INITIALIZER(2),
+ SQLITE3_MUTEX_INITIALIZER(3),
+ SQLITE3_MUTEX_INITIALIZER(4),
+ SQLITE3_MUTEX_INITIALIZER(5),
+ SQLITE3_MUTEX_INITIALIZER(6),
+ SQLITE3_MUTEX_INITIALIZER(7),
+ SQLITE3_MUTEX_INITIALIZER(8),
+ SQLITE3_MUTEX_INITIALIZER(9),
+ SQLITE3_MUTEX_INITIALIZER(10),
+ SQLITE3_MUTEX_INITIALIZER(11),
+ SQLITE3_MUTEX_INITIALIZER(12),
+ SQLITE3_MUTEX_INITIALIZER(13)
+};
+
+static int winMutex_isInit = 0;
+static int winMutex_isNt = -1; /* <0 means "need to query" */
+
+/* As the winMutexInit() and winMutexEnd() functions are called as part
+** of the sqlite3_initialize() and sqlite3_shutdown() processing, the
+** "interlocked" magic used here is probably not strictly necessary.
+*/
+static LONG SQLITE_WIN32_VOLATILE winMutex_lock = 0;
+
+SQLITE_API int sqlite3_win32_is_nt(void); /* os_win.c */
+SQLITE_API void sqlite3_win32_sleep(DWORD milliseconds); /* os_win.c */
+
+static int winMutexInit(void){
+ /* The first to increment to 1 does actual initialization */
+ if( InterlockedCompareExchange(&winMutex_lock, 1, 0)==0 ){
+ int i;
+ for(i=0; i<ArraySize(winMutex_staticMutexes); i++){
+#if SQLITE_OS_WINRT
+ InitializeCriticalSectionEx(&winMutex_staticMutexes[i].mutex, 0, 0);
+#else
+ InitializeCriticalSection(&winMutex_staticMutexes[i].mutex);
+#endif
+ }
+ winMutex_isInit = 1;
+ }else{
+ /* Another thread is (in the process of) initializing the static
+ ** mutexes */
+ while( !winMutex_isInit ){
+ sqlite3_win32_sleep(1);
+ }
+ }
+ return SQLITE_OK;
+}
+
+static int winMutexEnd(void){
+ /* The first to decrement to 0 does actual shutdown
+ ** (which should be the last to shutdown.) */
+ if( InterlockedCompareExchange(&winMutex_lock, 0, 1)==1 ){
+ if( winMutex_isInit==1 ){
+ int i;
+ for(i=0; i<ArraySize(winMutex_staticMutexes); i++){
+ DeleteCriticalSection(&winMutex_staticMutexes[i].mutex);
+ }
+ winMutex_isInit = 0;
+ }
+ }
+ return SQLITE_OK;
+}
+
+/*
+** The sqlite3_mutex_alloc() routine allocates a new
+** mutex and returns a pointer to it. If it returns NULL
+** that means that a mutex could not be allocated. SQLite
+** will unwind its stack and return an error. The argument
+** to sqlite3_mutex_alloc() is one of these integer constants:
+**
+** <ul>
+** <li> SQLITE_MUTEX_FAST
+** <li> SQLITE_MUTEX_RECURSIVE
+** <li> SQLITE_MUTEX_STATIC_MAIN
+** <li> SQLITE_MUTEX_STATIC_MEM
+** <li> SQLITE_MUTEX_STATIC_OPEN
+** <li> SQLITE_MUTEX_STATIC_PRNG
+** <li> SQLITE_MUTEX_STATIC_LRU
+** <li> SQLITE_MUTEX_STATIC_PMEM
+** <li> SQLITE_MUTEX_STATIC_APP1
+** <li> SQLITE_MUTEX_STATIC_APP2
+** <li> SQLITE_MUTEX_STATIC_APP3
+** <li> SQLITE_MUTEX_STATIC_VFS1
+** <li> SQLITE_MUTEX_STATIC_VFS2
+** <li> SQLITE_MUTEX_STATIC_VFS3
+** </ul>
+**
+** The first two constants cause sqlite3_mutex_alloc() to create
+** a new mutex. The new mutex is recursive when SQLITE_MUTEX_RECURSIVE
+** is used but not necessarily so when SQLITE_MUTEX_FAST is used.
+** The mutex implementation does not need to make a distinction
+** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does
+** not want to. But SQLite will only request a recursive mutex in
+** cases where it really needs one. If a faster non-recursive mutex
+** implementation is available on the host platform, the mutex subsystem
+** might return such a mutex in response to SQLITE_MUTEX_FAST.
+**
+** The other allowed parameters to sqlite3_mutex_alloc() each return
+** a pointer to a static preexisting mutex. Six static mutexes are
+** used by the current version of SQLite. Future versions of SQLite
+** may add additional static mutexes. Static mutexes are for internal
+** use by SQLite only. Applications that use SQLite mutexes should
+** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or
+** SQLITE_MUTEX_RECURSIVE.
+**
+** Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST
+** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()
+** returns a different mutex on every call. But for the static
+** mutex types, the same mutex is returned on every call that has
+** the same type number.
+*/
+static sqlite3_mutex *winMutexAlloc(int iType){
+ sqlite3_mutex *p;
+
+ switch( iType ){
+ case SQLITE_MUTEX_FAST:
+ case SQLITE_MUTEX_RECURSIVE: {
+ p = sqlite3MallocZero( sizeof(*p) );
+ if( p ){
+ p->id = iType;
+#ifdef SQLITE_DEBUG
+#ifdef SQLITE_WIN32_MUTEX_TRACE_DYNAMIC
+ p->trace = 1;
+#endif
+#endif
+#if SQLITE_OS_WINRT
+ InitializeCriticalSectionEx(&p->mutex, 0, 0);
+#else
+ InitializeCriticalSection(&p->mutex);
+#endif
+ }
+ break;
+ }
+ default: {
+#ifdef SQLITE_ENABLE_API_ARMOR
+ if( iType-2<0 || iType-2>=ArraySize(winMutex_staticMutexes) ){
+ (void)SQLITE_MISUSE_BKPT;
+ return 0;
+ }
+#endif
+ p = &winMutex_staticMutexes[iType-2];
+#ifdef SQLITE_DEBUG
+#ifdef SQLITE_WIN32_MUTEX_TRACE_STATIC
+ InterlockedCompareExchange(&p->trace, 1, 0);
+#endif
+#endif
+ break;
+ }
+ }
+ assert( p==0 || p->id==iType );
+ return p;
+}
+
+
+/*
+** This routine deallocates a previously
+** allocated mutex. SQLite is careful to deallocate every
+** mutex that it allocates.
+*/
+static void winMutexFree(sqlite3_mutex *p){
+ assert( p );
+ assert( p->nRef==0 && p->owner==0 );
+ if( p->id==SQLITE_MUTEX_FAST || p->id==SQLITE_MUTEX_RECURSIVE ){
+ DeleteCriticalSection(&p->mutex);
+ sqlite3_free(p);
+ }else{
+#ifdef SQLITE_ENABLE_API_ARMOR
+ (void)SQLITE_MISUSE_BKPT;
+#endif
+ }
+}
+
+/*
+** The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt
+** to enter a mutex. If another thread is already within the mutex,
+** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return
+** SQLITE_BUSY. The sqlite3_mutex_try() interface returns SQLITE_OK
+** upon successful entry. Mutexes created using SQLITE_MUTEX_RECURSIVE can
+** be entered multiple times by the same thread. In such cases the,
+** mutex must be exited an equal number of times before another thread
+** can enter. If the same thread tries to enter any other kind of mutex
+** more than once, the behavior is undefined.
+*/
+static void winMutexEnter(sqlite3_mutex *p){
+#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
+ DWORD tid = GetCurrentThreadId();
+#endif
+#ifdef SQLITE_DEBUG
+ assert( p );
+ assert( p->id==SQLITE_MUTEX_RECURSIVE || winMutexNotheld2(p, tid) );
+#else
+ assert( p );
+#endif
+ assert( winMutex_isInit==1 );
+ EnterCriticalSection(&p->mutex);
+#ifdef SQLITE_DEBUG
+ assert( p->nRef>0 || p->owner==0 );
+ p->owner = tid;
+ p->nRef++;
+ if( p->trace ){
+ OSTRACE(("ENTER-MUTEX tid=%lu, mutex(%d)=%p (%d), nRef=%d\n",
+ tid, p->id, p, p->trace, p->nRef));
+ }
+#endif
+}
+
+static int winMutexTry(sqlite3_mutex *p){
+#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
+ DWORD tid = GetCurrentThreadId();
+#endif
+ int rc = SQLITE_BUSY;
+ assert( p );
+ assert( p->id==SQLITE_MUTEX_RECURSIVE || winMutexNotheld2(p, tid) );
+ /*
+ ** The sqlite3_mutex_try() routine is very rarely used, and when it
+ ** is used it is merely an optimization. So it is OK for it to always
+ ** fail.
+ **
+ ** The TryEnterCriticalSection() interface is only available on WinNT.
+ ** And some windows compilers complain if you try to use it without
+ ** first doing some #defines that prevent SQLite from building on Win98.
+ ** For that reason, we will omit this optimization for now. See
+ ** ticket #2685.
+ */
+#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0400
+ assert( winMutex_isInit==1 );
+ assert( winMutex_isNt>=-1 && winMutex_isNt<=1 );
+ if( winMutex_isNt<0 ){
+ winMutex_isNt = sqlite3_win32_is_nt();
+ }
+ assert( winMutex_isNt==0 || winMutex_isNt==1 );
+ if( winMutex_isNt && TryEnterCriticalSection(&p->mutex) ){
+#ifdef SQLITE_DEBUG
+ p->owner = tid;
+ p->nRef++;
+#endif
+ rc = SQLITE_OK;
+ }
+#else
+ UNUSED_PARAMETER(p);
+#endif
+#ifdef SQLITE_DEBUG
+ if( p->trace ){
+ OSTRACE(("TRY-MUTEX tid=%lu, mutex(%d)=%p (%d), owner=%lu, nRef=%d, rc=%s\n",
+ tid, p->id, p, p->trace, p->owner, p->nRef, sqlite3ErrName(rc)));
+ }
+#endif
+ return rc;
+}
+
+/*
+** The sqlite3_mutex_leave() routine exits a mutex that was
+** previously entered by the same thread. The behavior
+** is undefined if the mutex is not currently entered or
+** is not currently allocated. SQLite will never do either.
+*/
+static void winMutexLeave(sqlite3_mutex *p){
+#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
+ DWORD tid = GetCurrentThreadId();
+#endif
+ assert( p );
+#ifdef SQLITE_DEBUG
+ assert( p->nRef>0 );
+ assert( p->owner==tid );
+ p->nRef--;
+ if( p->nRef==0 ) p->owner = 0;
+ assert( p->nRef==0 || p->id==SQLITE_MUTEX_RECURSIVE );
+#endif
+ assert( winMutex_isInit==1 );
+ LeaveCriticalSection(&p->mutex);
+#ifdef SQLITE_DEBUG
+ if( p->trace ){
+ OSTRACE(("LEAVE-MUTEX tid=%lu, mutex(%d)=%p (%d), nRef=%d\n",
+ tid, p->id, p, p->trace, p->nRef));
+ }
+#endif
+}
+
+SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){
+ static const sqlite3_mutex_methods sMutex = {
+ winMutexInit,
+ winMutexEnd,
+ winMutexAlloc,
+ winMutexFree,
+ winMutexEnter,
+ winMutexTry,
+ winMutexLeave,
+#ifdef SQLITE_DEBUG
+ winMutexHeld,
+ winMutexNotheld
+#else
+ 0,
+ 0
+#endif
+ };
+ return &sMutex;
+}
+
+#endif /* SQLITE_MUTEX_W32 */
+
+/************** End of mutex_w32.c *******************************************/
+/************** Begin file malloc.c ******************************************/
+/*
+** 2001 September 15
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+**
+** Memory allocation functions used throughout sqlite.
+*/
+/* #include "sqliteInt.h" */
+/* #include <stdarg.h> */
+
+/*
+** Attempt to release up to n bytes of non-essential memory currently
+** held by SQLite. An example of non-essential memory is memory used to
+** cache database pages that are not currently in use.
+*/
+SQLITE_API int sqlite3_release_memory(int n){
+#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
+ return sqlite3PcacheReleaseMemory(n);
+#else
+ /* IMPLEMENTATION-OF: R-34391-24921 The sqlite3_release_memory() routine
+ ** is a no-op returning zero if SQLite is not compiled with
+ ** SQLITE_ENABLE_MEMORY_MANAGEMENT. */
+ UNUSED_PARAMETER(n);
+ return 0;
+#endif
+}
+
+/*
+** Default value of the hard heap limit. 0 means "no limit".
+*/
+#ifndef SQLITE_MAX_MEMORY
+# define SQLITE_MAX_MEMORY 0
+#endif
+
+/*
+** State information local to the memory allocation subsystem.
+*/
+static SQLITE_WSD struct Mem0Global {
+ sqlite3_mutex *mutex; /* Mutex to serialize access */
+ sqlite3_int64 alarmThreshold; /* The soft heap limit */
+ sqlite3_int64 hardLimit; /* The hard upper bound on memory */
+
+ /*
+ ** True if heap is nearly "full" where "full" is defined by the
+ ** sqlite3_soft_heap_limit() setting.
+ */
+ int nearlyFull;
+} mem0 = { 0, SQLITE_MAX_MEMORY, SQLITE_MAX_MEMORY, 0 };
+
+#define mem0 GLOBAL(struct Mem0Global, mem0)
+
+/*
+** Return the memory allocator mutex. sqlite3_status() needs it.
+*/
+SQLITE_PRIVATE sqlite3_mutex *sqlite3MallocMutex(void){
+ return mem0.mutex;
+}
+
+#ifndef SQLITE_OMIT_DEPRECATED
+/*
+** Deprecated external interface. It used to set an alarm callback
+** that was invoked when memory usage grew too large. Now it is a
+** no-op.
+*/
+SQLITE_API int sqlite3_memory_alarm(
+ void(*xCallback)(void *pArg, sqlite3_int64 used,int N),
+ void *pArg,
+ sqlite3_int64 iThreshold
+){
+ (void)xCallback;
+ (void)pArg;
+ (void)iThreshold;
+ return SQLITE_OK;
+}
+#endif
+
+/*
+** Set the soft heap-size limit for the library. An argument of
+** zero disables the limit. A negative argument is a no-op used to
+** obtain the return value.
+**
+** The return value is the value of the heap limit just before this
+** interface was called.
+**
+** If the hard heap limit is enabled, then the soft heap limit cannot
+** be disabled nor raised above the hard heap limit.
+*/
+SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 n){
+ sqlite3_int64 priorLimit;
+ sqlite3_int64 excess;
+ sqlite3_int64 nUsed;
+#ifndef SQLITE_OMIT_AUTOINIT
+ int rc = sqlite3_initialize();
+ if( rc ) return -1;
+#endif
+ sqlite3_mutex_enter(mem0.mutex);
+ priorLimit = mem0.alarmThreshold;
+ if( n<0 ){
+ sqlite3_mutex_leave(mem0.mutex);
+ return priorLimit;
+ }
+ if( mem0.hardLimit>0 && (n>mem0.hardLimit || n==0) ){
+ n = mem0.hardLimit;
+ }
+ mem0.alarmThreshold = n;
+ nUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED);
+ AtomicStore(&mem0.nearlyFull, n>0 && n<=nUsed);
+ sqlite3_mutex_leave(mem0.mutex);
+ excess = sqlite3_memory_used() - n;
+ if( excess>0 ) sqlite3_release_memory((int)(excess & 0x7fffffff));
+ return priorLimit;
+}
+SQLITE_API void sqlite3_soft_heap_limit(int n){
+ if( n<0 ) n = 0;
+ sqlite3_soft_heap_limit64(n);
+}
+
+/*
+** Set the hard heap-size limit for the library. An argument of zero
+** disables the hard heap limit. A negative argument is a no-op used
+** to obtain the return value without affecting the hard heap limit.
+**
+** The return value is the value of the hard heap limit just prior to
+** calling this interface.
+**
+** Setting the hard heap limit will also activate the soft heap limit
+** and constrain the soft heap limit to be no more than the hard heap
+** limit.
+*/
+SQLITE_API sqlite3_int64 sqlite3_hard_heap_limit64(sqlite3_int64 n){
+ sqlite3_int64 priorLimit;
+#ifndef SQLITE_OMIT_AUTOINIT
+ int rc = sqlite3_initialize();
+ if( rc ) return -1;
+#endif
+ sqlite3_mutex_enter(mem0.mutex);
+ priorLimit = mem0.hardLimit;
+ if( n>=0 ){
+ mem0.hardLimit = n;
+ if( n<mem0.alarmThreshold || mem0.alarmThreshold==0 ){
+ mem0.alarmThreshold = n;
+ }
+ }
+ sqlite3_mutex_leave(mem0.mutex);
+ return priorLimit;
+}
+
+
+/*
+** Initialize the memory allocation subsystem.
+*/
+SQLITE_PRIVATE int sqlite3MallocInit(void){
+ int rc;
+ if( sqlite3GlobalConfig.m.xMalloc==0 ){
+ sqlite3MemSetDefault();
+ }
+ mem0.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);
+ if( sqlite3GlobalConfig.pPage==0 || sqlite3GlobalConfig.szPage<512
+ || sqlite3GlobalConfig.nPage<=0 ){
+ sqlite3GlobalConfig.pPage = 0;
+ sqlite3GlobalConfig.szPage = 0;
+ }
+ rc = sqlite3GlobalConfig.m.xInit(sqlite3GlobalConfig.m.pAppData);
+ if( rc!=SQLITE_OK ) memset(&mem0, 0, sizeof(mem0));
+ return rc;
+}
+
+/*
+** Return true if the heap is currently under memory pressure - in other
+** words if the amount of heap used is close to the limit set by
+** sqlite3_soft_heap_limit().
+*/
+SQLITE_PRIVATE int sqlite3HeapNearlyFull(void){
+ return AtomicLoad(&mem0.nearlyFull);
+}
+
+/*
+** Deinitialize the memory allocation subsystem.
+*/
+SQLITE_PRIVATE void sqlite3MallocEnd(void){
+ if( sqlite3GlobalConfig.m.xShutdown ){
+ sqlite3GlobalConfig.m.xShutdown(sqlite3GlobalConfig.m.pAppData);
+ }
+ memset(&mem0, 0, sizeof(mem0));
+}
+
+/*
+** Return the amount of memory currently checked out.
+*/
+SQLITE_API sqlite3_int64 sqlite3_memory_used(void){
+ sqlite3_int64 res, mx;
+ sqlite3_status64(SQLITE_STATUS_MEMORY_USED, &res, &mx, 0);
+ return res;
+}
+
+/*
+** Return the maximum amount of memory that has ever been
+** checked out since either the beginning of this process
+** or since the most recent reset.
+*/
+SQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag){
+ sqlite3_int64 res, mx;
+ sqlite3_status64(SQLITE_STATUS_MEMORY_USED, &res, &mx, resetFlag);
+ return mx;
+}
+
+/*
+** Trigger the alarm
+*/
+static void sqlite3MallocAlarm(int nByte){
+ if( mem0.alarmThreshold<=0 ) return;
+ sqlite3_mutex_leave(mem0.mutex);
+ sqlite3_release_memory(nByte);
+ sqlite3_mutex_enter(mem0.mutex);
+}
+
+#ifdef SQLITE_DEBUG
+/*
+** This routine is called whenever an out-of-memory condition is seen,
+** It's only purpose to to serve as a breakpoint for gdb or similar
+** code debuggers when working on out-of-memory conditions, for example
+** caused by PRAGMA hard_heap_limit=N.
+*/
+static SQLITE_NOINLINE void test_oom_breakpoint(u64 n){
+ static u64 nOomFault = 0;
+ nOomFault += n;
+ /* The assert() is never reached in a human lifetime. It is here mostly
+ ** to prevent code optimizers from optimizing out this function. */
+ assert( (nOomFault>>32) < 0xffffffff );
+}
+#else
+# define test_oom_breakpoint(X) /* No-op for production builds */
+#endif
+
+/*
+** Do a memory allocation with statistics and alarms. Assume the
+** lock is already held.
+*/
+static void mallocWithAlarm(int n, void **pp){
+ void *p;
+ int nFull;
+ assert( sqlite3_mutex_held(mem0.mutex) );
+ assert( n>0 );
+
+ /* In Firefox (circa 2017-02-08), xRoundup() is remapped to an internal
+ ** implementation of malloc_good_size(), which must be called in debug
+ ** mode and specifically when the DMD "Dark Matter Detector" is enabled
+ ** or else a crash results. Hence, do not attempt to optimize out the
+ ** following xRoundup() call. */
+ nFull = sqlite3GlobalConfig.m.xRoundup(n);
+
+ sqlite3StatusHighwater(SQLITE_STATUS_MALLOC_SIZE, n);
+ if( mem0.alarmThreshold>0 ){
+ sqlite3_int64 nUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED);
+ if( nUsed >= mem0.alarmThreshold - nFull ){
+ AtomicStore(&mem0.nearlyFull, 1);
+ sqlite3MallocAlarm(nFull);
+ if( mem0.hardLimit ){
+ nUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED);
+ if( nUsed >= mem0.hardLimit - nFull ){
+ test_oom_breakpoint(1);
+ *pp = 0;
+ return;
+ }
+ }
+ }else{
+ AtomicStore(&mem0.nearlyFull, 0);
+ }
+ }
+ p = sqlite3GlobalConfig.m.xMalloc(nFull);
+#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
+ if( p==0 && mem0.alarmThreshold>0 ){
+ sqlite3MallocAlarm(nFull);
+ p = sqlite3GlobalConfig.m.xMalloc(nFull);
+ }
+#endif
+ if( p ){
+ nFull = sqlite3MallocSize(p);
+ sqlite3StatusUp(SQLITE_STATUS_MEMORY_USED, nFull);
+ sqlite3StatusUp(SQLITE_STATUS_MALLOC_COUNT, 1);
+ }
+ *pp = p;
+}
+
+/*
+** Maximum size of any single memory allocation.
+**
+** This is not a limit on the total amount of memory used. This is
+** a limit on the size parameter to sqlite3_malloc() and sqlite3_realloc().
+**
+** The upper bound is slightly less than 2GiB: 0x7ffffeff == 2,147,483,391
+** This provides a 256-byte safety margin for defense against 32-bit
+** signed integer overflow bugs when computing memory allocation sizes.
+** Paranoid applications might want to reduce the maximum allocation size
+** further for an even larger safety margin. 0x3fffffff or 0x0fffffff
+** or even smaller would be reasonable upper bounds on the size of a memory
+** allocations for most applications.
+*/
+#ifndef SQLITE_MAX_ALLOCATION_SIZE
+# define SQLITE_MAX_ALLOCATION_SIZE 2147483391
+#endif
+#if SQLITE_MAX_ALLOCATION_SIZE>2147483391
+# error Maximum size for SQLITE_MAX_ALLOCATION_SIZE is 2147483391
+#endif
+
+/*
+** Allocate memory. This routine is like sqlite3_malloc() except that it
+** assumes the memory subsystem has already been initialized.
+*/
+SQLITE_PRIVATE void *sqlite3Malloc(u64 n){
+ void *p;
+ if( n==0 || n>SQLITE_MAX_ALLOCATION_SIZE ){
+ p = 0;
+ }else if( sqlite3GlobalConfig.bMemstat ){
+ sqlite3_mutex_enter(mem0.mutex);
+ mallocWithAlarm((int)n, &p);
+ sqlite3_mutex_leave(mem0.mutex);
+ }else{
+ p = sqlite3GlobalConfig.m.xMalloc((int)n);
+ }
+ assert( EIGHT_BYTE_ALIGNMENT(p) ); /* IMP: R-11148-40995 */
+ return p;
+}
+
+/*
+** This version of the memory allocation is for use by the application.
+** First make sure the memory subsystem is initialized, then do the
+** allocation.
+*/
+SQLITE_API void *sqlite3_malloc(int n){
+#ifndef SQLITE_OMIT_AUTOINIT
+ if( sqlite3_initialize() ) return 0;
+#endif
+ return n<=0 ? 0 : sqlite3Malloc(n);
+}
+SQLITE_API void *sqlite3_malloc64(sqlite3_uint64 n){
+#ifndef SQLITE_OMIT_AUTOINIT
+ if( sqlite3_initialize() ) return 0;
+#endif
+ return sqlite3Malloc(n);
+}
+
+/*
+** TRUE if p is a lookaside memory allocation from db
+*/
+#ifndef SQLITE_OMIT_LOOKASIDE
+static int isLookaside(sqlite3 *db, const void *p){
+ return SQLITE_WITHIN(p, db->lookaside.pStart, db->lookaside.pTrueEnd);
+}
+#else
+#define isLookaside(A,B) 0
+#endif
+
+/*
+** Return the size of a memory allocation previously obtained from
+** sqlite3Malloc() or sqlite3_malloc().
+*/
+SQLITE_PRIVATE int sqlite3MallocSize(const void *p){
+ assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) );
+ return sqlite3GlobalConfig.m.xSize((void*)p);
+}
+static int lookasideMallocSize(sqlite3 *db, const void *p){
+#ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE
+ return p<db->lookaside.pMiddle ? db->lookaside.szTrue : LOOKASIDE_SMALL;
+#else
+ return db->lookaside.szTrue;
+#endif
+}
+SQLITE_PRIVATE int sqlite3DbMallocSize(sqlite3 *db, const void *p){
+ assert( p!=0 );
+#ifdef SQLITE_DEBUG
+ if( db==0 ){
+ assert( sqlite3MemdebugNoType(p, (u8)~MEMTYPE_HEAP) );
+ assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) );
+ }else if( !isLookaside(db,p) ){
+ assert( sqlite3MemdebugHasType(p, (MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) );
+ assert( sqlite3MemdebugNoType(p, (u8)~(MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) );
+ }
+#endif
+ if( db ){
+ if( ((uptr)p)<(uptr)(db->lookaside.pTrueEnd) ){
+#ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE
+ if( ((uptr)p)>=(uptr)(db->lookaside.pMiddle) ){
+ assert( sqlite3_mutex_held(db->mutex) );
+ return LOOKASIDE_SMALL;
+ }
+#endif
+ if( ((uptr)p)>=(uptr)(db->lookaside.pStart) ){
+ assert( sqlite3_mutex_held(db->mutex) );
+ return db->lookaside.szTrue;
+ }
+ }
+ }
+ return sqlite3GlobalConfig.m.xSize((void*)p);
+}
+SQLITE_API sqlite3_uint64 sqlite3_msize(void *p){
+ assert( sqlite3MemdebugNoType(p, (u8)~MEMTYPE_HEAP) );
+ assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) );
+ return p ? sqlite3GlobalConfig.m.xSize(p) : 0;
+}
+
+/*
+** Free memory previously obtained from sqlite3Malloc().
+*/
+SQLITE_API void sqlite3_free(void *p){
+ if( p==0 ) return; /* IMP: R-49053-54554 */
+ assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) );
+ assert( sqlite3MemdebugNoType(p, (u8)~MEMTYPE_HEAP) );
+ if( sqlite3GlobalConfig.bMemstat ){
+ sqlite3_mutex_enter(mem0.mutex);
+ sqlite3StatusDown(SQLITE_STATUS_MEMORY_USED, sqlite3MallocSize(p));
+ sqlite3StatusDown(SQLITE_STATUS_MALLOC_COUNT, 1);
+ sqlite3GlobalConfig.m.xFree(p);
+ sqlite3_mutex_leave(mem0.mutex);
+ }else{
+ sqlite3GlobalConfig.m.xFree(p);
+ }
+}
+
+/*
+** Add the size of memory allocation "p" to the count in
+** *db->pnBytesFreed.
+*/
+static SQLITE_NOINLINE void measureAllocationSize(sqlite3 *db, void *p){
+ *db->pnBytesFreed += sqlite3DbMallocSize(db,p);
+}
+
+/*
+** Free memory that might be associated with a particular database
+** connection. Calling sqlite3DbFree(D,X) for X==0 is a harmless no-op.
+** The sqlite3DbFreeNN(D,X) version requires that X be non-NULL.
+*/
+SQLITE_PRIVATE void sqlite3DbFreeNN(sqlite3 *db, void *p){
+ assert( db==0 || sqlite3_mutex_held(db->mutex) );
+ assert( p!=0 );
+ if( db ){
+ if( ((uptr)p)<(uptr)(db->lookaside.pEnd) ){
+#ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE
+ if( ((uptr)p)>=(uptr)(db->lookaside.pMiddle) ){
+ LookasideSlot *pBuf = (LookasideSlot*)p;
+ assert( db->pnBytesFreed==0 );
+#ifdef SQLITE_DEBUG
+ memset(p, 0xaa, LOOKASIDE_SMALL); /* Trash freed content */
+#endif
+ pBuf->pNext = db->lookaside.pSmallFree;
+ db->lookaside.pSmallFree = pBuf;
+ return;
+ }
+#endif /* SQLITE_OMIT_TWOSIZE_LOOKASIDE */
+ if( ((uptr)p)>=(uptr)(db->lookaside.pStart) ){
+ LookasideSlot *pBuf = (LookasideSlot*)p;
+ assert( db->pnBytesFreed==0 );
+#ifdef SQLITE_DEBUG
+ memset(p, 0xaa, db->lookaside.szTrue); /* Trash freed content */
+#endif
+ pBuf->pNext = db->lookaside.pFree;
+ db->lookaside.pFree = pBuf;
+ return;
+ }
+ }
+ if( db->pnBytesFreed ){
+ measureAllocationSize(db, p);
+ return;
+ }
+ }
+ assert( sqlite3MemdebugHasType(p, (MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) );
+ assert( sqlite3MemdebugNoType(p, (u8)~(MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) );
+ assert( db!=0 || sqlite3MemdebugNoType(p, MEMTYPE_LOOKASIDE) );
+ sqlite3MemdebugSetType(p, MEMTYPE_HEAP);
+ sqlite3_free(p);
+}
+SQLITE_PRIVATE void sqlite3DbNNFreeNN(sqlite3 *db, void *p){
+ assert( db!=0 );
+ assert( sqlite3_mutex_held(db->mutex) );
+ assert( p!=0 );
+ if( ((uptr)p)<(uptr)(db->lookaside.pEnd) ){
+#ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE
+ if( ((uptr)p)>=(uptr)(db->lookaside.pMiddle) ){
+ LookasideSlot *pBuf = (LookasideSlot*)p;
+ assert( db->pnBytesFreed==0 );
+#ifdef SQLITE_DEBUG
+ memset(p, 0xaa, LOOKASIDE_SMALL); /* Trash freed content */
+#endif
+ pBuf->pNext = db->lookaside.pSmallFree;
+ db->lookaside.pSmallFree = pBuf;
+ return;
+ }
+#endif /* SQLITE_OMIT_TWOSIZE_LOOKASIDE */
+ if( ((uptr)p)>=(uptr)(db->lookaside.pStart) ){
+ LookasideSlot *pBuf = (LookasideSlot*)p;
+ assert( db->pnBytesFreed==0 );
+#ifdef SQLITE_DEBUG
+ memset(p, 0xaa, db->lookaside.szTrue); /* Trash freed content */
+#endif
+ pBuf->pNext = db->lookaside.pFree;
+ db->lookaside.pFree = pBuf;
+ return;
+ }
+ }
+ if( db->pnBytesFreed ){
+ measureAllocationSize(db, p);
+ return;
+ }
+ assert( sqlite3MemdebugHasType(p, (MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) );
+ assert( sqlite3MemdebugNoType(p, (u8)~(MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) );
+ sqlite3MemdebugSetType(p, MEMTYPE_HEAP);
+ sqlite3_free(p);
+}
+SQLITE_PRIVATE void sqlite3DbFree(sqlite3 *db, void *p){
+ assert( db==0 || sqlite3_mutex_held(db->mutex) );
+ if( p ) sqlite3DbFreeNN(db, p);
+}
+
+/*
+** Change the size of an existing memory allocation
+*/
+SQLITE_PRIVATE void *sqlite3Realloc(void *pOld, u64 nBytes){
+ int nOld, nNew, nDiff;
+ void *pNew;
+ assert( sqlite3MemdebugHasType(pOld, MEMTYPE_HEAP) );
+ assert( sqlite3MemdebugNoType(pOld, (u8)~MEMTYPE_HEAP) );
+ if( pOld==0 ){
+ return sqlite3Malloc(nBytes); /* IMP: R-04300-56712 */
+ }
+ if( nBytes==0 ){
+ sqlite3_free(pOld); /* IMP: R-26507-47431 */
+ return 0;
+ }
+ if( nBytes>=0x7fffff00 ){
+ /* The 0x7ffff00 limit term is explained in comments on sqlite3Malloc() */
+ return 0;
+ }
+ nOld = sqlite3MallocSize(pOld);
+ /* IMPLEMENTATION-OF: R-46199-30249 SQLite guarantees that the second
+ ** argument to xRealloc is always a value returned by a prior call to
+ ** xRoundup. */
+ nNew = sqlite3GlobalConfig.m.xRoundup((int)nBytes);
+ if( nOld==nNew ){
+ pNew = pOld;
+ }else if( sqlite3GlobalConfig.bMemstat ){
+ sqlite3_int64 nUsed;
+ sqlite3_mutex_enter(mem0.mutex);
+ sqlite3StatusHighwater(SQLITE_STATUS_MALLOC_SIZE, (int)nBytes);
+ nDiff = nNew - nOld;
+ if( nDiff>0 && (nUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED)) >=
+ mem0.alarmThreshold-nDiff ){
+ sqlite3MallocAlarm(nDiff);
+ if( mem0.hardLimit>0 && nUsed >= mem0.hardLimit - nDiff ){
+ sqlite3_mutex_leave(mem0.mutex);
+ test_oom_breakpoint(1);
+ return 0;
+ }
+ }
+ pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew);
+#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
+ if( pNew==0 && mem0.alarmThreshold>0 ){
+ sqlite3MallocAlarm((int)nBytes);
+ pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew);
+ }
+#endif
+ if( pNew ){
+ nNew = sqlite3MallocSize(pNew);
+ sqlite3StatusUp(SQLITE_STATUS_MEMORY_USED, nNew-nOld);
+ }
+ sqlite3_mutex_leave(mem0.mutex);
+ }else{
+ pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew);
+ }
+ assert( EIGHT_BYTE_ALIGNMENT(pNew) ); /* IMP: R-11148-40995 */
+ return pNew;
+}
+
+/*
+** The public interface to sqlite3Realloc. Make sure that the memory
+** subsystem is initialized prior to invoking sqliteRealloc.
+*/
+SQLITE_API void *sqlite3_realloc(void *pOld, int n){
+#ifndef SQLITE_OMIT_AUTOINIT
+ if( sqlite3_initialize() ) return 0;
+#endif
+ if( n<0 ) n = 0; /* IMP: R-26507-47431 */
+ return sqlite3Realloc(pOld, n);
+}
+SQLITE_API void *sqlite3_realloc64(void *pOld, sqlite3_uint64 n){
+#ifndef SQLITE_OMIT_AUTOINIT
+ if( sqlite3_initialize() ) return 0;
+#endif
+ return sqlite3Realloc(pOld, n);
+}
+
+
+/*
+** Allocate and zero memory.
+*/
+SQLITE_PRIVATE void *sqlite3MallocZero(u64 n){
+ void *p = sqlite3Malloc(n);
+ if( p ){
+ memset(p, 0, (size_t)n);
+ }
+ return p;
+}
+
+/*
+** Allocate and zero memory. If the allocation fails, make
+** the mallocFailed flag in the connection pointer.
+*/
+SQLITE_PRIVATE void *sqlite3DbMallocZero(sqlite3 *db, u64 n){
+ void *p;
+ testcase( db==0 );
+ p = sqlite3DbMallocRaw(db, n);
+ if( p ) memset(p, 0, (size_t)n);
+ return p;
+}
+
+
+/* Finish the work of sqlite3DbMallocRawNN for the unusual and
+** slower case when the allocation cannot be fulfilled using lookaside.
+*/
+static SQLITE_NOINLINE void *dbMallocRawFinish(sqlite3 *db, u64 n){
+ void *p;
+ assert( db!=0 );
+ p = sqlite3Malloc(n);
+ if( !p ) sqlite3OomFault(db);
+ sqlite3MemdebugSetType(p,
+ (db->lookaside.bDisable==0) ? MEMTYPE_LOOKASIDE : MEMTYPE_HEAP);
+ return p;
+}
+
+/*
+** Allocate memory, either lookaside (if possible) or heap.
+** If the allocation fails, set the mallocFailed flag in
+** the connection pointer.
+**
+** If db!=0 and db->mallocFailed is true (indicating a prior malloc
+** failure on the same database connection) then always return 0.
+** Hence for a particular database connection, once malloc starts
+** failing, it fails consistently until mallocFailed is reset.
+** This is an important assumption. There are many places in the
+** code that do things like this:
+**
+** int *a = (int*)sqlite3DbMallocRaw(db, 100);
+** int *b = (int*)sqlite3DbMallocRaw(db, 200);
+** if( b ) a[10] = 9;
+**
+** In other words, if a subsequent malloc (ex: "b") worked, it is assumed
+** that all prior mallocs (ex: "a") worked too.
+**
+** The sqlite3MallocRawNN() variant guarantees that the "db" parameter is
+** not a NULL pointer.
+*/
+SQLITE_PRIVATE void *sqlite3DbMallocRaw(sqlite3 *db, u64 n){
+ void *p;
+ if( db ) return sqlite3DbMallocRawNN(db, n);
+ p = sqlite3Malloc(n);
+ sqlite3MemdebugSetType(p, MEMTYPE_HEAP);
+ return p;
+}
+SQLITE_PRIVATE void *sqlite3DbMallocRawNN(sqlite3 *db, u64 n){
+#ifndef SQLITE_OMIT_LOOKASIDE
+ LookasideSlot *pBuf;
+ assert( db!=0 );
+ assert( sqlite3_mutex_held(db->mutex) );
+ assert( db->pnBytesFreed==0 );
+ if( n>db->lookaside.sz ){
+ if( !db->lookaside.bDisable ){
+ db->lookaside.anStat[1]++;
+ }else if( db->mallocFailed ){
+ return 0;
+ }
+ return dbMallocRawFinish(db, n);
+ }
+#ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE
+ if( n<=LOOKASIDE_SMALL ){
+ if( (pBuf = db->lookaside.pSmallFree)!=0 ){
+ db->lookaside.pSmallFree = pBuf->pNext;
+ db->lookaside.anStat[0]++;
+ return (void*)pBuf;
+ }else if( (pBuf = db->lookaside.pSmallInit)!=0 ){
+ db->lookaside.pSmallInit = pBuf->pNext;
+ db->lookaside.anStat[0]++;
+ return (void*)pBuf;
+ }
+ }
+#endif
+ if( (pBuf = db->lookaside.pFree)!=0 ){
+ db->lookaside.pFree = pBuf->pNext;
+ db->lookaside.anStat[0]++;
+ return (void*)pBuf;
+ }else if( (pBuf = db->lookaside.pInit)!=0 ){
+ db->lookaside.pInit = pBuf->pNext;
+ db->lookaside.anStat[0]++;
+ return (void*)pBuf;
+ }else{
+ db->lookaside.anStat[2]++;
+ }
+#else
+ assert( db!=0 );
+ assert( sqlite3_mutex_held(db->mutex) );
+ assert( db->pnBytesFreed==0 );
+ if( db->mallocFailed ){
+ return 0;
+ }
+#endif
+ return dbMallocRawFinish(db, n);
+}
+
+/* Forward declaration */
+static SQLITE_NOINLINE void *dbReallocFinish(sqlite3 *db, void *p, u64 n);
+
+/*
+** Resize the block of memory pointed to by p to n bytes. If the
+** resize fails, set the mallocFailed flag in the connection object.
+*/
+SQLITE_PRIVATE void *sqlite3DbRealloc(sqlite3 *db, void *p, u64 n){
+ assert( db!=0 );
+ if( p==0 ) return sqlite3DbMallocRawNN(db, n);
+ assert( sqlite3_mutex_held(db->mutex) );
+ if( ((uptr)p)<(uptr)db->lookaside.pEnd ){
+#ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE
+ if( ((uptr)p)>=(uptr)db->lookaside.pMiddle ){
+ if( n<=LOOKASIDE_SMALL ) return p;
+ }else
+#endif
+ if( ((uptr)p)>=(uptr)db->lookaside.pStart ){
+ if( n<=db->lookaside.szTrue ) return p;
+ }
+ }
+ return dbReallocFinish(db, p, n);
+}
+static SQLITE_NOINLINE void *dbReallocFinish(sqlite3 *db, void *p, u64 n){
+ void *pNew = 0;
+ assert( db!=0 );
+ assert( p!=0 );
+ if( db->mallocFailed==0 ){
+ if( isLookaside(db, p) ){
+ pNew = sqlite3DbMallocRawNN(db, n);
+ if( pNew ){
+ memcpy(pNew, p, lookasideMallocSize(db, p));
+ sqlite3DbFree(db, p);
+ }
+ }else{
+ assert( sqlite3MemdebugHasType(p, (MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) );
+ assert( sqlite3MemdebugNoType(p, (u8)~(MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) );
+ sqlite3MemdebugSetType(p, MEMTYPE_HEAP);
+ pNew = sqlite3Realloc(p, n);
+ if( !pNew ){
+ sqlite3OomFault(db);
+ }
+ sqlite3MemdebugSetType(pNew,
+ (db->lookaside.bDisable==0 ? MEMTYPE_LOOKASIDE : MEMTYPE_HEAP));
+ }
+ }
+ return pNew;
+}
+
+/*
+** Attempt to reallocate p. If the reallocation fails, then free p
+** and set the mallocFailed flag in the database connection.
+*/
+SQLITE_PRIVATE void *sqlite3DbReallocOrFree(sqlite3 *db, void *p, u64 n){
+ void *pNew;
+ pNew = sqlite3DbRealloc(db, p, n);
+ if( !pNew ){
+ sqlite3DbFree(db, p);
+ }
+ return pNew;
+}
+
+/*
+** Make a copy of a string in memory obtained from sqliteMalloc(). These
+** functions call sqlite3MallocRaw() directly instead of sqliteMalloc(). This
+** is because when memory debugging is turned on, these two functions are
+** called via macros that record the current file and line number in the
+** ThreadData structure.
+*/
+SQLITE_PRIVATE char *sqlite3DbStrDup(sqlite3 *db, const char *z){
+ char *zNew;
+ size_t n;
+ if( z==0 ){
+ return 0;
+ }
+ n = strlen(z) + 1;
+ zNew = sqlite3DbMallocRaw(db, n);
+ if( zNew ){
+ memcpy(zNew, z, n);
+ }
+ return zNew;
+}
+SQLITE_PRIVATE char *sqlite3DbStrNDup(sqlite3 *db, const char *z, u64 n){
+ char *zNew;
+ assert( db!=0 );
+ assert( z!=0 || n==0 );
+ assert( (n&0x7fffffff)==n );
+ zNew = z ? sqlite3DbMallocRawNN(db, n+1) : 0;
+ if( zNew ){
+ memcpy(zNew, z, (size_t)n);
+ zNew[n] = 0;
+ }
+ return zNew;
+}
+
+/*
+** The text between zStart and zEnd represents a phrase within a larger
+** SQL statement. Make a copy of this phrase in space obtained form
+** sqlite3DbMalloc(). Omit leading and trailing whitespace.
+*/
+SQLITE_PRIVATE char *sqlite3DbSpanDup(sqlite3 *db, const char *zStart, const char *zEnd){
+ int n;
+#ifdef SQLITE_DEBUG
+ /* Because of the way the parser works, the span is guaranteed to contain
+ ** at least one non-space character */
+ for(n=0; sqlite3Isspace(zStart[n]); n++){ assert( &zStart[n]<zEnd ); }
+#endif
+ while( sqlite3Isspace(zStart[0]) ) zStart++;
+ n = (int)(zEnd - zStart);
+ while( sqlite3Isspace(zStart[n-1]) ) n--;
+ return sqlite3DbStrNDup(db, zStart, n);
+}
+
+/*
+** Free any prior content in *pz and replace it with a copy of zNew.
+*/
+SQLITE_PRIVATE void sqlite3SetString(char **pz, sqlite3 *db, const char *zNew){
+ char *z = sqlite3DbStrDup(db, zNew);
+ sqlite3DbFree(db, *pz);
+ *pz = z;
+}
+
+/*
+** Call this routine to record the fact that an OOM (out-of-memory) error
+** has happened. This routine will set db->mallocFailed, and also
+** temporarily disable the lookaside memory allocator and interrupt
+** any running VDBEs.
+**
+** Always return a NULL pointer so that this routine can be invoked using
+**
+** return sqlite3OomFault(db);
+**
+** and thereby avoid unnecessary stack frame allocations for the overwhelmingly
+** common case where no OOM occurs.
+*/
+SQLITE_PRIVATE void *sqlite3OomFault(sqlite3 *db){
+ if( db->mallocFailed==0 && db->bBenignMalloc==0 ){
+ db->mallocFailed = 1;
+ if( db->nVdbeExec>0 ){
+ AtomicStore(&db->u1.isInterrupted, 1);
+ }
+ DisableLookaside;
+ if( db->pParse ){
+ Parse *pParse;
+ sqlite3ErrorMsg(db->pParse, "out of memory");
+ db->pParse->rc = SQLITE_NOMEM_BKPT;
+ for(pParse=db->pParse->pOuterParse; pParse; pParse = pParse->pOuterParse){
+ pParse->nErr++;
+ pParse->rc = SQLITE_NOMEM;
+ }
+ }
+ }
+ return 0;
+}
+
+/*
+** This routine reactivates the memory allocator and clears the
+** db->mallocFailed flag as necessary.
+**
+** The memory allocator is not restarted if there are running
+** VDBEs.
+*/
+SQLITE_PRIVATE void sqlite3OomClear(sqlite3 *db){
+ if( db->mallocFailed && db->nVdbeExec==0 ){
+ db->mallocFailed = 0;
+ AtomicStore(&db->u1.isInterrupted, 0);
+ assert( db->lookaside.bDisable>0 );
+ EnableLookaside;
+ }
+}
+
+/*
+** Take actions at the end of an API call to deal with error codes.
+*/
+static SQLITE_NOINLINE int apiHandleError(sqlite3 *db, int rc){
+ if( db->mallocFailed || rc==SQLITE_IOERR_NOMEM ){
+ sqlite3OomClear(db);
+ sqlite3Error(db, SQLITE_NOMEM);
+ return SQLITE_NOMEM_BKPT;
+ }
+ return rc & db->errMask;
+}
+
+/*
+** This function must be called before exiting any API function (i.e.
+** returning control to the user) that has called sqlite3_malloc or
+** sqlite3_realloc.
+**
+** The returned value is normally a copy of the second argument to this
+** function. However, if a malloc() failure has occurred since the previous
+** invocation SQLITE_NOMEM is returned instead.
+**
+** If an OOM as occurred, then the connection error-code (the value
+** returned by sqlite3_errcode()) is set to SQLITE_NOMEM.
+*/
+SQLITE_PRIVATE int sqlite3ApiExit(sqlite3* db, int rc){
+ /* If the db handle must hold the connection handle mutex here.
+ ** Otherwise the read (and possible write) of db->mallocFailed
+ ** is unsafe, as is the call to sqlite3Error().
+ */
+ assert( db!=0 );
+ assert( sqlite3_mutex_held(db->mutex) );
+ if( db->mallocFailed || rc ){
+ return apiHandleError(db, rc);
+ }
+ return 0;
+}
+
+/************** End of malloc.c **********************************************/
+/************** Begin file printf.c ******************************************/
+/*
+** The "printf" code that follows dates from the 1980's. It is in
+** the public domain.
+**
+**************************************************************************
+**
+** This file contains code for a set of "printf"-like routines. These
+** routines format strings much like the printf() from the standard C
+** library, though the implementation here has enhancements to support
+** SQLite.
+*/
+/* #include "sqliteInt.h" */
+
+/*
+** Conversion types fall into various categories as defined by the
+** following enumeration.
+*/
+#define etRADIX 0 /* non-decimal integer types. %x %o */
+#define etFLOAT 1 /* Floating point. %f */
+#define etEXP 2 /* Exponentional notation. %e and %E */
+#define etGENERIC 3 /* Floating or exponential, depending on exponent. %g */
+#define etSIZE 4 /* Return number of characters processed so far. %n */
+#define etSTRING 5 /* Strings. %s */
+#define etDYNSTRING 6 /* Dynamically allocated strings. %z */
+#define etPERCENT 7 /* Percent symbol. %% */
+#define etCHARX 8 /* Characters. %c */
+/* The rest are extensions, not normally found in printf() */
+#define etSQLESCAPE 9 /* Strings with '\'' doubled. %q */
+#define etSQLESCAPE2 10 /* Strings with '\'' doubled and enclosed in '',
+ NULL pointers replaced by SQL NULL. %Q */
+#define etTOKEN 11 /* a pointer to a Token structure */
+#define etSRCITEM 12 /* a pointer to a SrcItem */
+#define etPOINTER 13 /* The %p conversion */
+#define etSQLESCAPE3 14 /* %w -> Strings with '\"' doubled */
+#define etORDINAL 15 /* %r -> 1st, 2nd, 3rd, 4th, etc. English only */
+#define etDECIMAL 16 /* %d or %u, but not %x, %o */
+
+#define etINVALID 17 /* Any unrecognized conversion type */
+
+
+/*
+** An "etByte" is an 8-bit unsigned value.
+*/
+typedef unsigned char etByte;
+
+/*
+** Each builtin conversion character (ex: the 'd' in "%d") is described
+** by an instance of the following structure
+*/
+typedef struct et_info { /* Information about each format field */
+ char fmttype; /* The format field code letter */
+ etByte base; /* The base for radix conversion */
+ etByte flags; /* One or more of FLAG_ constants below */
+ etByte type; /* Conversion paradigm */
+ etByte charset; /* Offset into aDigits[] of the digits string */
+ etByte prefix; /* Offset into aPrefix[] of the prefix string */
+} et_info;
+
+/*
+** Allowed values for et_info.flags
+*/
+#define FLAG_SIGNED 1 /* True if the value to convert is signed */
+#define FLAG_STRING 4 /* Allow infinite precision */
+
+
+/*
+** The following table is searched linearly, so it is good to put the
+** most frequently used conversion types first.
+*/
+static const char aDigits[] = "0123456789ABCDEF0123456789abcdef";
+static const char aPrefix[] = "-x0\000X0";
+static const et_info fmtinfo[] = {
+ { 'd', 10, 1, etDECIMAL, 0, 0 },
+ { 's', 0, 4, etSTRING, 0, 0 },
+ { 'g', 0, 1, etGENERIC, 30, 0 },
+ { 'z', 0, 4, etDYNSTRING, 0, 0 },
+ { 'q', 0, 4, etSQLESCAPE, 0, 0 },
+ { 'Q', 0, 4, etSQLESCAPE2, 0, 0 },
+ { 'w', 0, 4, etSQLESCAPE3, 0, 0 },
+ { 'c', 0, 0, etCHARX, 0, 0 },
+ { 'o', 8, 0, etRADIX, 0, 2 },
+ { 'u', 10, 0, etDECIMAL, 0, 0 },
+ { 'x', 16, 0, etRADIX, 16, 1 },
+ { 'X', 16, 0, etRADIX, 0, 4 },
+#ifndef SQLITE_OMIT_FLOATING_POINT
+ { 'f', 0, 1, etFLOAT, 0, 0 },
+ { 'e', 0, 1, etEXP, 30, 0 },
+ { 'E', 0, 1, etEXP, 14, 0 },
+ { 'G', 0, 1, etGENERIC, 14, 0 },
+#endif
+ { 'i', 10, 1, etDECIMAL, 0, 0 },
+ { 'n', 0, 0, etSIZE, 0, 0 },
+ { '%', 0, 0, etPERCENT, 0, 0 },
+ { 'p', 16, 0, etPOINTER, 0, 1 },
+
+ /* All the rest are undocumented and are for internal use only */
+ { 'T', 0, 0, etTOKEN, 0, 0 },
+ { 'S', 0, 0, etSRCITEM, 0, 0 },
+ { 'r', 10, 1, etORDINAL, 0, 0 },
+};
+
+/* Notes:
+**
+** %S Takes a pointer to SrcItem. Shows name or database.name
+** %!S Like %S but prefer the zName over the zAlias
+*/
+
+/*
+** Set the StrAccum object to an error mode.
+*/
+SQLITE_PRIVATE void sqlite3StrAccumSetError(StrAccum *p, u8 eError){
+ assert( eError==SQLITE_NOMEM || eError==SQLITE_TOOBIG );
+ p->accError = eError;
+ if( p->mxAlloc ) sqlite3_str_reset(p);
+ if( eError==SQLITE_TOOBIG ) sqlite3ErrorToParser(p->db, eError);
+}
+
+/*
+** Extra argument values from a PrintfArguments object
+*/
+static sqlite3_int64 getIntArg(PrintfArguments *p){
+ if( p->nArg<=p->nUsed ) return 0;
+ return sqlite3_value_int64(p->apArg[p->nUsed++]);
+}
+static double getDoubleArg(PrintfArguments *p){
+ if( p->nArg<=p->nUsed ) return 0.0;
+ return sqlite3_value_double(p->apArg[p->nUsed++]);
+}
+static char *getTextArg(PrintfArguments *p){
+ if( p->nArg<=p->nUsed ) return 0;
+ return (char*)sqlite3_value_text(p->apArg[p->nUsed++]);
+}
+
+/*
+** Allocate memory for a temporary buffer needed for printf rendering.
+**
+** If the requested size of the temp buffer is larger than the size
+** of the output buffer in pAccum, then cause an SQLITE_TOOBIG error.
+** Do the size check before the memory allocation to prevent rogue
+** SQL from requesting large allocations using the precision or width
+** field of the printf() function.
+*/
+static char *printfTempBuf(sqlite3_str *pAccum, sqlite3_int64 n){
+ char *z;
+ if( pAccum->accError ) return 0;
+ if( n>pAccum->nAlloc && n>pAccum->mxAlloc ){
+ sqlite3StrAccumSetError(pAccum, SQLITE_TOOBIG);
+ return 0;
+ }
+ z = sqlite3DbMallocRaw(pAccum->db, n);
+ if( z==0 ){
+ sqlite3StrAccumSetError(pAccum, SQLITE_NOMEM);
+ }
+ return z;
+}
+
+/*
+** On machines with a small stack size, you can redefine the
+** SQLITE_PRINT_BUF_SIZE to be something smaller, if desired.
+*/
+#ifndef SQLITE_PRINT_BUF_SIZE
+# define SQLITE_PRINT_BUF_SIZE 70
+#endif
+#define etBUFSIZE SQLITE_PRINT_BUF_SIZE /* Size of the output buffer */
+
+/*
+** Hard limit on the precision of floating-point conversions.
+*/
+#ifndef SQLITE_PRINTF_PRECISION_LIMIT
+# define SQLITE_FP_PRECISION_LIMIT 100000000
+#endif
+
+/*
+** Render a string given by "fmt" into the StrAccum object.
+*/
+SQLITE_API void sqlite3_str_vappendf(
+ sqlite3_str *pAccum, /* Accumulate results here */
+ const char *fmt, /* Format string */
+ va_list ap /* arguments */
+){
+ int c; /* Next character in the format string */
+ char *bufpt; /* Pointer to the conversion buffer */
+ int precision; /* Precision of the current field */
+ int length; /* Length of the field */
+ int idx; /* A general purpose loop counter */
+ int width; /* Width of the current field */
+ etByte flag_leftjustify; /* True if "-" flag is present */
+ etByte flag_prefix; /* '+' or ' ' or 0 for prefix */
+ etByte flag_alternateform; /* True if "#" flag is present */
+ etByte flag_altform2; /* True if "!" flag is present */
+ etByte flag_zeropad; /* True if field width constant starts with zero */
+ etByte flag_long; /* 1 for the "l" flag, 2 for "ll", 0 by default */
+ etByte done; /* Loop termination flag */
+ etByte cThousand; /* Thousands separator for %d and %u */
+ etByte xtype = etINVALID; /* Conversion paradigm */
+ u8 bArgList; /* True for SQLITE_PRINTF_SQLFUNC */
+ char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */
+ sqlite_uint64 longvalue; /* Value for integer types */
+ double realvalue; /* Value for real types */
+ const et_info *infop; /* Pointer to the appropriate info structure */
+ char *zOut; /* Rendering buffer */
+ int nOut; /* Size of the rendering buffer */
+ char *zExtra = 0; /* Malloced memory used by some conversion */
+ int exp, e2; /* exponent of real numbers */
+ etByte flag_dp; /* True if decimal point should be shown */
+ etByte flag_rtz; /* True if trailing zeros should be removed */
+
+ PrintfArguments *pArgList = 0; /* Arguments for SQLITE_PRINTF_SQLFUNC */
+ char buf[etBUFSIZE]; /* Conversion buffer */
+
+ /* pAccum never starts out with an empty buffer that was obtained from
+ ** malloc(). This precondition is required by the mprintf("%z...")
+ ** optimization. */
+ assert( pAccum->nChar>0 || (pAccum->printfFlags&SQLITE_PRINTF_MALLOCED)==0 );
+
+ bufpt = 0;
+ if( (pAccum->printfFlags & SQLITE_PRINTF_SQLFUNC)!=0 ){
+ pArgList = va_arg(ap, PrintfArguments*);
+ bArgList = 1;
+ }else{
+ bArgList = 0;
+ }
+ for(; (c=(*fmt))!=0; ++fmt){
+ if( c!='%' ){
+ bufpt = (char *)fmt;
+#if HAVE_STRCHRNUL
+ fmt = strchrnul(fmt, '%');
+#else
+ do{ fmt++; }while( *fmt && *fmt != '%' );
+#endif
+ sqlite3_str_append(pAccum, bufpt, (int)(fmt - bufpt));
+ if( *fmt==0 ) break;
+ }
+ if( (c=(*++fmt))==0 ){
+ sqlite3_str_append(pAccum, "%", 1);
+ break;
+ }
+ /* Find out what flags are present */
+ flag_leftjustify = flag_prefix = cThousand =
+ flag_alternateform = flag_altform2 = flag_zeropad = 0;
+ done = 0;
+ width = 0;
+ flag_long = 0;
+ precision = -1;
+ do{
+ switch( c ){
+ case '-': flag_leftjustify = 1; break;
+ case '+': flag_prefix = '+'; break;
+ case ' ': flag_prefix = ' '; break;
+ case '#': flag_alternateform = 1; break;
+ case '!': flag_altform2 = 1; break;
+ case '0': flag_zeropad = 1; break;
+ case ',': cThousand = ','; break;
+ default: done = 1; break;
+ case 'l': {
+ flag_long = 1;
+ c = *++fmt;
+ if( c=='l' ){
+ c = *++fmt;
+ flag_long = 2;
+ }
+ done = 1;
+ break;
+ }
+ case '1': case '2': case '3': case '4': case '5':
+ case '6': case '7': case '8': case '9': {
+ unsigned wx = c - '0';
+ while( (c = *++fmt)>='0' && c<='9' ){
+ wx = wx*10 + c - '0';
+ }
+ testcase( wx>0x7fffffff );
+ width = wx & 0x7fffffff;
+#ifdef SQLITE_PRINTF_PRECISION_LIMIT
+ if( width>SQLITE_PRINTF_PRECISION_LIMIT ){
+ width = SQLITE_PRINTF_PRECISION_LIMIT;
+ }
+#endif
+ if( c!='.' && c!='l' ){
+ done = 1;
+ }else{
+ fmt--;
+ }
+ break;
+ }
+ case '*': {
+ if( bArgList ){
+ width = (int)getIntArg(pArgList);
+ }else{
+ width = va_arg(ap,int);
+ }
+ if( width<0 ){
+ flag_leftjustify = 1;
+ width = width >= -2147483647 ? -width : 0;
+ }
+#ifdef SQLITE_PRINTF_PRECISION_LIMIT
+ if( width>SQLITE_PRINTF_PRECISION_LIMIT ){
+ width = SQLITE_PRINTF_PRECISION_LIMIT;
+ }
+#endif
+ if( (c = fmt[1])!='.' && c!='l' ){
+ c = *++fmt;
+ done = 1;
+ }
+ break;
+ }
+ case '.': {
+ c = *++fmt;
+ if( c=='*' ){
+ if( bArgList ){
+ precision = (int)getIntArg(pArgList);
+ }else{
+ precision = va_arg(ap,int);
+ }
+ if( precision<0 ){
+ precision = precision >= -2147483647 ? -precision : -1;
+ }
+ c = *++fmt;
+ }else{
+ unsigned px = 0;
+ while( c>='0' && c<='9' ){
+ px = px*10 + c - '0';
+ c = *++fmt;
+ }
+ testcase( px>0x7fffffff );
+ precision = px & 0x7fffffff;
+ }
+#ifdef SQLITE_PRINTF_PRECISION_LIMIT
+ if( precision>SQLITE_PRINTF_PRECISION_LIMIT ){
+ precision = SQLITE_PRINTF_PRECISION_LIMIT;
+ }
+#endif
+ if( c=='l' ){
+ --fmt;
+ }else{
+ done = 1;
+ }
+ break;
+ }
+ }
+ }while( !done && (c=(*++fmt))!=0 );
+
+ /* Fetch the info entry for the field */
+ infop = &fmtinfo[0];
+ xtype = etINVALID;
+ for(idx=0; idx<ArraySize(fmtinfo); idx++){
+ if( c==fmtinfo[idx].fmttype ){
+ infop = &fmtinfo[idx];
+ xtype = infop->type;
+ break;
+ }
+ }
+
+ /*
+ ** At this point, variables are initialized as follows:
+ **
+ ** flag_alternateform TRUE if a '#' is present.
+ ** flag_altform2 TRUE if a '!' is present.
+ ** flag_prefix '+' or ' ' or zero
+ ** flag_leftjustify TRUE if a '-' is present or if the
+ ** field width was negative.
+ ** flag_zeropad TRUE if the width began with 0.
+ ** flag_long 1 for "l", 2 for "ll"
+ ** width The specified field width. This is
+ ** always non-negative. Zero is the default.
+ ** precision The specified precision. The default
+ ** is -1.
+ ** xtype The class of the conversion.
+ ** infop Pointer to the appropriate info struct.
+ */
+ assert( width>=0 );
+ assert( precision>=(-1) );
+ switch( xtype ){
+ case etPOINTER:
+ flag_long = sizeof(char*)==sizeof(i64) ? 2 :
+ sizeof(char*)==sizeof(long int) ? 1 : 0;
+ /* no break */ deliberate_fall_through
+ case etORDINAL:
+ case etRADIX:
+ cThousand = 0;
+ /* no break */ deliberate_fall_through
+ case etDECIMAL:
+ if( infop->flags & FLAG_SIGNED ){
+ i64 v;
+ if( bArgList ){
+ v = getIntArg(pArgList);
+ }else if( flag_long ){
+ if( flag_long==2 ){
+ v = va_arg(ap,i64) ;
+ }else{
+ v = va_arg(ap,long int);
+ }
+ }else{
+ v = va_arg(ap,int);
+ }
+ if( v<0 ){
+ testcase( v==SMALLEST_INT64 );
+ testcase( v==(-1) );
+ longvalue = ~v;
+ longvalue++;
+ prefix = '-';
+ }else{
+ longvalue = v;
+ prefix = flag_prefix;
+ }
+ }else{
+ if( bArgList ){
+ longvalue = (u64)getIntArg(pArgList);
+ }else if( flag_long ){
+ if( flag_long==2 ){
+ longvalue = va_arg(ap,u64);
+ }else{
+ longvalue = va_arg(ap,unsigned long int);
+ }
+ }else{
+ longvalue = va_arg(ap,unsigned int);
+ }
+ prefix = 0;
+ }
+ if( longvalue==0 ) flag_alternateform = 0;
+ if( flag_zeropad && precision<width-(prefix!=0) ){
+ precision = width-(prefix!=0);
+ }
+ if( precision<etBUFSIZE-10-etBUFSIZE/3 ){
+ nOut = etBUFSIZE;
+ zOut = buf;
+ }else{
+ u64 n;
+ n = (u64)precision + 10;
+ if( cThousand ) n += precision/3;
+ zOut = zExtra = printfTempBuf(pAccum, n);
+ if( zOut==0 ) return;
+ nOut = (int)n;
+ }
+ bufpt = &zOut[nOut-1];
+ if( xtype==etORDINAL ){
+ static const char zOrd[] = "thstndrd";
+ int x = (int)(longvalue % 10);
+ if( x>=4 || (longvalue/10)%10==1 ){
+ x = 0;
+ }
+ *(--bufpt) = zOrd[x*2+1];
+ *(--bufpt) = zOrd[x*2];
+ }
+ {
+ const char *cset = &aDigits[infop->charset];
+ u8 base = infop->base;
+ do{ /* Convert to ascii */
+ *(--bufpt) = cset[longvalue%base];
+ longvalue = longvalue/base;
+ }while( longvalue>0 );
+ }
+ length = (int)(&zOut[nOut-1]-bufpt);
+ while( precision>length ){
+ *(--bufpt) = '0'; /* Zero pad */
+ length++;
+ }
+ if( cThousand ){
+ int nn = (length - 1)/3; /* Number of "," to insert */
+ int ix = (length - 1)%3 + 1;
+ bufpt -= nn;
+ for(idx=0; nn>0; idx++){
+ bufpt[idx] = bufpt[idx+nn];
+ ix--;
+ if( ix==0 ){
+ bufpt[++idx] = cThousand;
+ nn--;
+ ix = 3;
+ }
+ }
+ }
+ if( prefix ) *(--bufpt) = prefix; /* Add sign */
+ if( flag_alternateform && infop->prefix ){ /* Add "0" or "0x" */
+ const char *pre;
+ char x;
+ pre = &aPrefix[infop->prefix];
+ for(; (x=(*pre))!=0; pre++) *(--bufpt) = x;
+ }
+ length = (int)(&zOut[nOut-1]-bufpt);
+ break;
+ case etFLOAT:
+ case etEXP:
+ case etGENERIC: {
+ FpDecode s;
+ int iRound;
+ int j;
+
+ if( bArgList ){
+ realvalue = getDoubleArg(pArgList);
+ }else{
+ realvalue = va_arg(ap,double);
+ }
+ if( precision<0 ) precision = 6; /* Set default precision */
+#ifdef SQLITE_FP_PRECISION_LIMIT
+ if( precision>SQLITE_FP_PRECISION_LIMIT ){
+ precision = SQLITE_FP_PRECISION_LIMIT;
+ }
+#endif
+ if( xtype==etFLOAT ){
+ iRound = -precision;
+ }else if( xtype==etGENERIC ){
+ if( precision==0 ) precision = 1;
+ iRound = precision;
+ }else{
+ iRound = precision+1;
+ }
+ sqlite3FpDecode(&s, realvalue, iRound, flag_altform2 ? 26 : 16);
+ if( s.isSpecial ){
+ if( s.isSpecial==2 ){
+ bufpt = flag_zeropad ? "null" : "NaN";
+ length = sqlite3Strlen30(bufpt);
+ break;
+ }else if( flag_zeropad ){
+ s.z[0] = '9';
+ s.iDP = 1000;
+ s.n = 1;
+ }else{
+ memcpy(buf, "-Inf", 5);
+ bufpt = buf;
+ if( s.sign=='-' ){
+ /* no-op */
+ }else if( flag_prefix ){
+ buf[0] = flag_prefix;
+ }else{
+ bufpt++;
+ }
+ length = sqlite3Strlen30(bufpt);
+ break;
+ }
+ }
+ if( s.sign=='-' ){
+ prefix = '-';
+ }else{
+ prefix = flag_prefix;
+ }
+
+ exp = s.iDP-1;
+
+ /*
+ ** If the field type is etGENERIC, then convert to either etEXP
+ ** or etFLOAT, as appropriate.
+ */
+ if( xtype==etGENERIC ){
+ assert( precision>0 );
+ precision--;
+ flag_rtz = !flag_alternateform;
+ if( exp<-4 || exp>precision ){
+ xtype = etEXP;
+ }else{
+ precision = precision - exp;
+ xtype = etFLOAT;
+ }
+ }else{
+ flag_rtz = flag_altform2;
+ }
+ if( xtype==etEXP ){
+ e2 = 0;
+ }else{
+ e2 = s.iDP - 1;
+ }
+ bufpt = buf;
+ {
+ i64 szBufNeeded; /* Size of a temporary buffer needed */
+ szBufNeeded = MAX(e2,0)+(i64)precision+(i64)width+15;
+ if( cThousand && e2>0 ) szBufNeeded += (e2+2)/3;
+ if( szBufNeeded > etBUFSIZE ){
+ bufpt = zExtra = printfTempBuf(pAccum, szBufNeeded);
+ if( bufpt==0 ) return;
+ }
+ }
+ zOut = bufpt;
+ flag_dp = (precision>0 ?1:0) | flag_alternateform | flag_altform2;
+ /* The sign in front of the number */
+ if( prefix ){
+ *(bufpt++) = prefix;
+ }
+ /* Digits prior to the decimal point */
+ j = 0;
+ if( e2<0 ){
+ *(bufpt++) = '0';
+ }else{
+ for(; e2>=0; e2--){
+ *(bufpt++) = j<s.n ? s.z[j++] : '0';
+ if( cThousand && (e2%3)==0 && e2>1 ) *(bufpt++) = ',';
+ }
+ }
+ /* The decimal point */
+ if( flag_dp ){
+ *(bufpt++) = '.';
+ }
+ /* "0" digits after the decimal point but before the first
+ ** significant digit of the number */
+ for(e2++; e2<0 && precision>0; precision--, e2++){
+ *(bufpt++) = '0';
+ }
+ /* Significant digits after the decimal point */
+ while( (precision--)>0 ){
+ *(bufpt++) = j<s.n ? s.z[j++] : '0';
+ }
+ /* Remove trailing zeros and the "." if no digits follow the "." */
+ if( flag_rtz && flag_dp ){
+ while( bufpt[-1]=='0' ) *(--bufpt) = 0;
+ assert( bufpt>zOut );
+ if( bufpt[-1]=='.' ){
+ if( flag_altform2 ){
+ *(bufpt++) = '0';
+ }else{
+ *(--bufpt) = 0;
+ }
+ }
+ }
+ /* Add the "eNNN" suffix */
+ if( xtype==etEXP ){
+ exp = s.iDP - 1;
+ *(bufpt++) = aDigits[infop->charset];
+ if( exp<0 ){
+ *(bufpt++) = '-'; exp = -exp;
+ }else{
+ *(bufpt++) = '+';
+ }
+ if( exp>=100 ){
+ *(bufpt++) = (char)((exp/100)+'0'); /* 100's digit */
+ exp %= 100;
+ }
+ *(bufpt++) = (char)(exp/10+'0'); /* 10's digit */
+ *(bufpt++) = (char)(exp%10+'0'); /* 1's digit */
+ }
+ *bufpt = 0;
+
+ /* The converted number is in buf[] and zero terminated. Output it.
+ ** Note that the number is in the usual order, not reversed as with
+ ** integer conversions. */
+ length = (int)(bufpt-zOut);
+ bufpt = zOut;
+
+ /* Special case: Add leading zeros if the flag_zeropad flag is
+ ** set and we are not left justified */
+ if( flag_zeropad && !flag_leftjustify && length < width){
+ int i;
+ int nPad = width - length;
+ for(i=width; i>=nPad; i--){
+ bufpt[i] = bufpt[i-nPad];
+ }
+ i = prefix!=0;
+ while( nPad-- ) bufpt[i++] = '0';
+ length = width;
+ }
+ break;
+ }
+ case etSIZE:
+ if( !bArgList ){
+ *(va_arg(ap,int*)) = pAccum->nChar;
+ }
+ length = width = 0;
+ break;
+ case etPERCENT:
+ buf[0] = '%';
+ bufpt = buf;
+ length = 1;
+ break;
+ case etCHARX:
+ if( bArgList ){
+ bufpt = getTextArg(pArgList);
+ length = 1;
+ if( bufpt ){
+ buf[0] = c = *(bufpt++);
+ if( (c&0xc0)==0xc0 ){
+ while( length<4 && (bufpt[0]&0xc0)==0x80 ){
+ buf[length++] = *(bufpt++);
+ }
+ }
+ }else{
+ buf[0] = 0;
+ }
+ }else{
+ unsigned int ch = va_arg(ap,unsigned int);
+ if( ch<0x00080 ){
+ buf[0] = ch & 0xff;
+ length = 1;
+ }else if( ch<0x00800 ){
+ buf[0] = 0xc0 + (u8)((ch>>6)&0x1f);
+ buf[1] = 0x80 + (u8)(ch & 0x3f);
+ length = 2;
+ }else if( ch<0x10000 ){
+ buf[0] = 0xe0 + (u8)((ch>>12)&0x0f);
+ buf[1] = 0x80 + (u8)((ch>>6) & 0x3f);
+ buf[2] = 0x80 + (u8)(ch & 0x3f);
+ length = 3;
+ }else{
+ buf[0] = 0xf0 + (u8)((ch>>18) & 0x07);
+ buf[1] = 0x80 + (u8)((ch>>12) & 0x3f);
+ buf[2] = 0x80 + (u8)((ch>>6) & 0x3f);
+ buf[3] = 0x80 + (u8)(ch & 0x3f);
+ length = 4;
+ }
+ }
+ if( precision>1 ){
+ i64 nPrior = 1;
+ width -= precision-1;
+ if( width>1 && !flag_leftjustify ){
+ sqlite3_str_appendchar(pAccum, width-1, ' ');
+ width = 0;
+ }
+ sqlite3_str_append(pAccum, buf, length);
+ precision--;
+ while( precision > 1 ){
+ i64 nCopyBytes;
+ if( nPrior > precision-1 ) nPrior = precision - 1;
+ nCopyBytes = length*nPrior;
+ if( nCopyBytes + pAccum->nChar >= pAccum->nAlloc ){
+ sqlite3StrAccumEnlarge(pAccum, nCopyBytes);
+ }
+ if( pAccum->accError ) break;
+ sqlite3_str_append(pAccum,
+ &pAccum->zText[pAccum->nChar-nCopyBytes], nCopyBytes);
+ precision -= nPrior;
+ nPrior *= 2;
+ }
+ }
+ bufpt = buf;
+ flag_altform2 = 1;
+ goto adjust_width_for_utf8;
+ case etSTRING:
+ case etDYNSTRING:
+ if( bArgList ){
+ bufpt = getTextArg(pArgList);
+ xtype = etSTRING;
+ }else{
+ bufpt = va_arg(ap,char*);
+ }
+ if( bufpt==0 ){
+ bufpt = "";
+ }else if( xtype==etDYNSTRING ){
+ if( pAccum->nChar==0
+ && pAccum->mxAlloc
+ && width==0
+ && precision<0
+ && pAccum->accError==0
+ ){
+ /* Special optimization for sqlite3_mprintf("%z..."):
+ ** Extend an existing memory allocation rather than creating
+ ** a new one. */
+ assert( (pAccum->printfFlags&SQLITE_PRINTF_MALLOCED)==0 );
+ pAccum->zText = bufpt;
+ pAccum->nAlloc = sqlite3DbMallocSize(pAccum->db, bufpt);
+ pAccum->nChar = 0x7fffffff & (int)strlen(bufpt);
+ pAccum->printfFlags |= SQLITE_PRINTF_MALLOCED;
+ length = 0;
+ break;
+ }
+ zExtra = bufpt;
+ }
+ if( precision>=0 ){
+ if( flag_altform2 ){
+ /* Set length to the number of bytes needed in order to display
+ ** precision characters */
+ unsigned char *z = (unsigned char*)bufpt;
+ while( precision-- > 0 && z[0] ){
+ SQLITE_SKIP_UTF8(z);
+ }
+ length = (int)(z - (unsigned char*)bufpt);
+ }else{
+ for(length=0; length<precision && bufpt[length]; length++){}
+ }
+ }else{
+ length = 0x7fffffff & (int)strlen(bufpt);
+ }
+ adjust_width_for_utf8:
+ if( flag_altform2 && width>0 ){
+ /* Adjust width to account for extra bytes in UTF-8 characters */
+ int ii = length - 1;
+ while( ii>=0 ) if( (bufpt[ii--] & 0xc0)==0x80 ) width++;
+ }
+ break;
+ case etSQLESCAPE: /* %q: Escape ' characters */
+ case etSQLESCAPE2: /* %Q: Escape ' and enclose in '...' */
+ case etSQLESCAPE3: { /* %w: Escape " characters */
+ i64 i, j, k, n;
+ int needQuote, isnull;
+ char ch;
+ char q = ((xtype==etSQLESCAPE3)?'"':'\''); /* Quote character */
+ char *escarg;
+
+ if( bArgList ){
+ escarg = getTextArg(pArgList);
+ }else{
+ escarg = va_arg(ap,char*);
+ }
+ isnull = escarg==0;
+ if( isnull ) escarg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)");
+ /* For %q, %Q, and %w, the precision is the number of bytes (or
+ ** characters if the ! flags is present) to use from the input.
+ ** Because of the extra quoting characters inserted, the number
+ ** of output characters may be larger than the precision.
+ */
+ k = precision;
+ for(i=n=0; k!=0 && (ch=escarg[i])!=0; i++, k--){
+ if( ch==q ) n++;
+ if( flag_altform2 && (ch&0xc0)==0xc0 ){
+ while( (escarg[i+1]&0xc0)==0x80 ){ i++; }
+ }
+ }
+ needQuote = !isnull && xtype==etSQLESCAPE2;
+ n += i + 3;
+ if( n>etBUFSIZE ){
+ bufpt = zExtra = printfTempBuf(pAccum, n);
+ if( bufpt==0 ) return;
+ }else{
+ bufpt = buf;
+ }
+ j = 0;
+ if( needQuote ) bufpt[j++] = q;
+ k = i;
+ for(i=0; i<k; i++){
+ bufpt[j++] = ch = escarg[i];
+ if( ch==q ) bufpt[j++] = ch;
+ }
+ if( needQuote ) bufpt[j++] = q;
+ bufpt[j] = 0;
+ length = j;
+ goto adjust_width_for_utf8;
+ }
+ case etTOKEN: {
+ if( (pAccum->printfFlags & SQLITE_PRINTF_INTERNAL)==0 ) return;
+ if( flag_alternateform ){
+ /* %#T means an Expr pointer that uses Expr.u.zToken */
+ Expr *pExpr = va_arg(ap,Expr*);
+ if( ALWAYS(pExpr) && ALWAYS(!ExprHasProperty(pExpr,EP_IntValue)) ){
+ sqlite3_str_appendall(pAccum, (const char*)pExpr->u.zToken);
+ sqlite3RecordErrorOffsetOfExpr(pAccum->db, pExpr);
+ }
+ }else{
+ /* %T means a Token pointer */
+ Token *pToken = va_arg(ap, Token*);
+ assert( bArgList==0 );
+ if( pToken && pToken->n ){
+ sqlite3_str_append(pAccum, (const char*)pToken->z, pToken->n);
+ sqlite3RecordErrorByteOffset(pAccum->db, pToken->z);
+ }
+ }
+ length = width = 0;
+ break;
+ }
+ case etSRCITEM: {
+ SrcItem *pItem;
+ if( (pAccum->printfFlags & SQLITE_PRINTF_INTERNAL)==0 ) return;
+ pItem = va_arg(ap, SrcItem*);
+ assert( bArgList==0 );
+ if( pItem->zAlias && !flag_altform2 ){
+ sqlite3_str_appendall(pAccum, pItem->zAlias);
+ }else if( pItem->zName ){
+ if( pItem->fg.fixedSchema==0
+ && pItem->fg.isSubquery==0
+ && pItem->u4.zDatabase!=0
+ ){
+ sqlite3_str_appendall(pAccum, pItem->u4.zDatabase);
+ sqlite3_str_append(pAccum, ".", 1);
+ }
+ sqlite3_str_appendall(pAccum, pItem->zName);
+ }else if( pItem->zAlias ){
+ sqlite3_str_appendall(pAccum, pItem->zAlias);
+ }else if( ALWAYS(pItem->fg.isSubquery) ){/* Because of tag-20240424-1 */
+ Select *pSel = pItem->u4.pSubq->pSelect;
+ assert( pSel!=0 );
+ if( pSel->selFlags & SF_NestedFrom ){
+ sqlite3_str_appendf(pAccum, "(join-%u)", pSel->selId);
+ }else if( pSel->selFlags & SF_MultiValue ){
+ assert( !pItem->fg.isTabFunc && !pItem->fg.isIndexedBy );
+ sqlite3_str_appendf(pAccum, "%u-ROW VALUES CLAUSE",
+ pItem->u1.nRow);
+ }else{
+ sqlite3_str_appendf(pAccum, "(subquery-%u)", pSel->selId);
+ }
+ }
+ length = width = 0;
+ break;
+ }
+ default: {
+ assert( xtype==etINVALID );
+ return;
+ }
+ }/* End switch over the format type */
+ /*
+ ** The text of the conversion is pointed to by "bufpt" and is
+ ** "length" characters long. The field width is "width". Do
+ ** the output. Both length and width are in bytes, not characters,
+ ** at this point. If the "!" flag was present on string conversions
+ ** indicating that width and precision should be expressed in characters,
+ ** then the values have been translated prior to reaching this point.
+ */
+ width -= length;
+ if( width>0 ){
+ if( !flag_leftjustify ) sqlite3_str_appendchar(pAccum, width, ' ');
+ sqlite3_str_append(pAccum, bufpt, length);
+ if( flag_leftjustify ) sqlite3_str_appendchar(pAccum, width, ' ');
+ }else{
+ sqlite3_str_append(pAccum, bufpt, length);
+ }
+
+ if( zExtra ){
+ sqlite3DbFree(pAccum->db, zExtra);
+ zExtra = 0;
+ }
+ }/* End for loop over the format string */
+} /* End of function */
+
+
+/*
+** The z string points to the first character of a token that is
+** associated with an error. If db does not already have an error
+** byte offset recorded, try to compute the error byte offset for
+** z and set the error byte offset in db.
+*/
+SQLITE_PRIVATE void sqlite3RecordErrorByteOffset(sqlite3 *db, const char *z){
+ const Parse *pParse;
+ const char *zText;
+ const char *zEnd;
+ assert( z!=0 );
+ if( NEVER(db==0) ) return;
+ if( db->errByteOffset!=(-2) ) return;
+ pParse = db->pParse;
+ if( NEVER(pParse==0) ) return;
+ zText =pParse->zTail;
+ if( NEVER(zText==0) ) return;
+ zEnd = &zText[strlen(zText)];
+ if( SQLITE_WITHIN(z,zText,zEnd) ){
+ db->errByteOffset = (int)(z-zText);
+ }
+}
+
+/*
+** If pExpr has a byte offset for the start of a token, record that as
+** as the error offset.
+*/
+SQLITE_PRIVATE void sqlite3RecordErrorOffsetOfExpr(sqlite3 *db, const Expr *pExpr){
+ while( pExpr
+ && (ExprHasProperty(pExpr,EP_OuterON|EP_InnerON) || pExpr->w.iOfst<=0)
+ ){
+ pExpr = pExpr->pLeft;
+ }
+ if( pExpr==0 ) return;
+ if( ExprHasProperty(pExpr, EP_FromDDL) ) return;
+ db->errByteOffset = pExpr->w.iOfst;
+}
+
+/*
+** Enlarge the memory allocation on a StrAccum object so that it is
+** able to accept at least N more bytes of text.
+**
+** Return the number of bytes of text that StrAccum is able to accept
+** after the attempted enlargement. The value returned might be zero.
+*/
+SQLITE_PRIVATE int sqlite3StrAccumEnlarge(StrAccum *p, i64 N){
+ char *zNew;
+ assert( p->nChar+N >= p->nAlloc ); /* Only called if really needed */
+ if( p->accError ){
+ testcase(p->accError==SQLITE_TOOBIG);
+ testcase(p->accError==SQLITE_NOMEM);
+ return 0;
+ }
+ if( p->mxAlloc==0 ){
+ sqlite3StrAccumSetError(p, SQLITE_TOOBIG);
+ return p->nAlloc - p->nChar - 1;
+ }else{
+ char *zOld = isMalloced(p) ? p->zText : 0;
+ i64 szNew = p->nChar + N + 1;
+ if( szNew+p->nChar<=p->mxAlloc ){
+ /* Force exponential buffer size growth as long as it does not overflow,
+ ** to avoid having to call this routine too often */
+ szNew += p->nChar;
+ }
+ if( szNew > p->mxAlloc ){
+ sqlite3_str_reset(p);
+ sqlite3StrAccumSetError(p, SQLITE_TOOBIG);
+ return 0;
+ }else{
+ p->nAlloc = (int)szNew;
+ }
+ if( p->db ){
+ zNew = sqlite3DbRealloc(p->db, zOld, p->nAlloc);
+ }else{
+ zNew = sqlite3Realloc(zOld, p->nAlloc);
+ }
+ if( zNew ){
+ assert( p->zText!=0 || p->nChar==0 );
+ if( !isMalloced(p) && p->nChar>0 ) memcpy(zNew, p->zText, p->nChar);
+ p->zText = zNew;
+ p->nAlloc = sqlite3DbMallocSize(p->db, zNew);
+ p->printfFlags |= SQLITE_PRINTF_MALLOCED;
+ }else{
+ sqlite3_str_reset(p);
+ sqlite3StrAccumSetError(p, SQLITE_NOMEM);
+ return 0;
+ }
+ }
+ assert( N>=0 && N<=0x7fffffff );
+ return (int)N;
+}
+
+/*
+** Append N copies of character c to the given string buffer.
+*/
+SQLITE_API void sqlite3_str_appendchar(sqlite3_str *p, int N, char c){
+ testcase( p->nChar + (i64)N > 0x7fffffff );
+ if( p->nChar+(i64)N >= p->nAlloc && (N = sqlite3StrAccumEnlarge(p, N))<=0 ){
+ return;
+ }
+ while( (N--)>0 ) p->zText[p->nChar++] = c;
+}
+
+/*
+** The StrAccum "p" is not large enough to accept N new bytes of z[].
+** So enlarge if first, then do the append.
+**
+** This is a helper routine to sqlite3_str_append() that does special-case
+** work (enlarging the buffer) using tail recursion, so that the
+** sqlite3_str_append() routine can use fast calling semantics.
+*/
+static void SQLITE_NOINLINE enlargeAndAppend(StrAccum *p, const char *z, int N){
+ N = sqlite3StrAccumEnlarge(p, N);
+ if( N>0 ){
+ memcpy(&p->zText[p->nChar], z, N);
+ p->nChar += N;
+ }
+}
+
+/*
+** Append N bytes of text from z to the StrAccum object. Increase the
+** size of the memory allocation for StrAccum if necessary.
+*/
+SQLITE_API void sqlite3_str_append(sqlite3_str *p, const char *z, int N){
+ assert( z!=0 || N==0 );
+ assert( p->zText!=0 || p->nChar==0 || p->accError );
+ assert( N>=0 );
+ assert( p->accError==0 || p->nAlloc==0 || p->mxAlloc==0 );
+ if( p->nChar+N >= p->nAlloc ){
+ enlargeAndAppend(p,z,N);
+ }else if( N ){
+ assert( p->zText );
+ p->nChar += N;
+ memcpy(&p->zText[p->nChar-N], z, N);
+ }
+}
+
+/*
+** Append the complete text of zero-terminated string z[] to the p string.
+*/
+SQLITE_API void sqlite3_str_appendall(sqlite3_str *p, const char *z){
+ sqlite3_str_append(p, z, sqlite3Strlen30(z));
+}
+
+
+/*
+** Finish off a string by making sure it is zero-terminated.
+** Return a pointer to the resulting string. Return a NULL
+** pointer if any kind of error was encountered.
+*/
+static SQLITE_NOINLINE char *strAccumFinishRealloc(StrAccum *p){
+ char *zText;
+ assert( p->mxAlloc>0 && !isMalloced(p) );
+ zText = sqlite3DbMallocRaw(p->db, p->nChar+1 );
+ if( zText ){
+ memcpy(zText, p->zText, p->nChar+1);
+ p->printfFlags |= SQLITE_PRINTF_MALLOCED;
+ }else{
+ sqlite3StrAccumSetError(p, SQLITE_NOMEM);
+ }
+ p->zText = zText;
+ return zText;
+}
+SQLITE_PRIVATE char *sqlite3StrAccumFinish(StrAccum *p){
+ if( p->zText ){
+ p->zText[p->nChar] = 0;
+ if( p->mxAlloc>0 && !isMalloced(p) ){
+ return strAccumFinishRealloc(p);
+ }
+ }
+ return p->zText;
+}
+
+/*
+** Use the content of the StrAccum passed as the second argument
+** as the result of an SQL function.
+*/
+SQLITE_PRIVATE void sqlite3ResultStrAccum(sqlite3_context *pCtx, StrAccum *p){
+ if( p->accError ){
+ sqlite3_result_error_code(pCtx, p->accError);
+ sqlite3_str_reset(p);
+ }else if( isMalloced(p) ){
+ sqlite3_result_text(pCtx, p->zText, p->nChar, SQLITE_DYNAMIC);
+ }else{
+ sqlite3_result_text(pCtx, "", 0, SQLITE_STATIC);
+ sqlite3_str_reset(p);
+ }
+}
+
+/*
+** This singleton is an sqlite3_str object that is returned if
+** sqlite3_malloc() fails to provide space for a real one. This
+** sqlite3_str object accepts no new text and always returns
+** an SQLITE_NOMEM error.
+*/
+static sqlite3_str sqlite3OomStr = {
+ 0, 0, 0, 0, 0, SQLITE_NOMEM, 0
+};
+
+/* Finalize a string created using sqlite3_str_new().
+*/
+SQLITE_API char *sqlite3_str_finish(sqlite3_str *p){
+ char *z;
+ if( p!=0 && p!=&sqlite3OomStr ){
+ z = sqlite3StrAccumFinish(p);
+ sqlite3_free(p);
+ }else{
+ z = 0;
+ }
+ return z;
+}
+
+/* Return any error code associated with p */
+SQLITE_API int sqlite3_str_errcode(sqlite3_str *p){
+ return p ? p->accError : SQLITE_NOMEM;
+}
+
+/* Return the current length of p in bytes */
+SQLITE_API int sqlite3_str_length(sqlite3_str *p){
+ return p ? p->nChar : 0;
+}
+
+/* Return the current value for p */
+SQLITE_API char *sqlite3_str_value(sqlite3_str *p){
+ if( p==0 || p->nChar==0 ) return 0;
+ p->zText[p->nChar] = 0;
+ return p->zText;
+}
+
+/*
+** Reset an StrAccum string. Reclaim all malloced memory.
+*/
+SQLITE_API void sqlite3_str_reset(StrAccum *p){
+ if( isMalloced(p) ){
+ sqlite3DbFree(p->db, p->zText);
+ p->printfFlags &= ~SQLITE_PRINTF_MALLOCED;
+ }
+ p->nAlloc = 0;
+ p->nChar = 0;
+ p->zText = 0;
+}
+
+/*
+** Initialize a string accumulator.
+**
+** p: The accumulator to be initialized.
+** db: Pointer to a database connection. May be NULL. Lookaside
+** memory is used if not NULL. db->mallocFailed is set appropriately
+** when not NULL.
+** zBase: An initial buffer. May be NULL in which case the initial buffer
+** is malloced.
+** n: Size of zBase in bytes. If total space requirements never exceed
+** n then no memory allocations ever occur.
+** mx: Maximum number of bytes to accumulate. If mx==0 then no memory
+** allocations will ever occur.
+*/
+SQLITE_PRIVATE void sqlite3StrAccumInit(StrAccum *p, sqlite3 *db, char *zBase, int n, int mx){
+ p->zText = zBase;
+ p->db = db;
+ p->nAlloc = n;
+ p->mxAlloc = mx;
+ p->nChar = 0;
+ p->accError = 0;
+ p->printfFlags = 0;
+}
+
+/* Allocate and initialize a new dynamic string object */
+SQLITE_API sqlite3_str *sqlite3_str_new(sqlite3 *db){
+ sqlite3_str *p = sqlite3_malloc64(sizeof(*p));
+ if( p ){
+ sqlite3StrAccumInit(p, 0, 0, 0,
+ db ? db->aLimit[SQLITE_LIMIT_LENGTH] : SQLITE_MAX_LENGTH);
+ }else{
+ p = &sqlite3OomStr;
+ }
+ return p;
+}
+
+/*
+** Print into memory obtained from sqliteMalloc(). Use the internal
+** %-conversion extensions.
+*/
+SQLITE_PRIVATE char *sqlite3VMPrintf(sqlite3 *db, const char *zFormat, va_list ap){
+ char *z;
+ char zBase[SQLITE_PRINT_BUF_SIZE];
+ StrAccum acc;
+ assert( db!=0 );
+ sqlite3StrAccumInit(&acc, db, zBase, sizeof(zBase),
+ db->aLimit[SQLITE_LIMIT_LENGTH]);
+ acc.printfFlags = SQLITE_PRINTF_INTERNAL;
+ sqlite3_str_vappendf(&acc, zFormat, ap);
+ z = sqlite3StrAccumFinish(&acc);
+ if( acc.accError==SQLITE_NOMEM ){
+ sqlite3OomFault(db);
+ }
+ return z;
+}
+
+/*
+** Print into memory obtained from sqliteMalloc(). Use the internal
+** %-conversion extensions.
+*/
+SQLITE_PRIVATE char *sqlite3MPrintf(sqlite3 *db, const char *zFormat, ...){
+ va_list ap;
+ char *z;
+ va_start(ap, zFormat);
+ z = sqlite3VMPrintf(db, zFormat, ap);
+ va_end(ap);
+ return z;
+}
+
+/*
+** Print into memory obtained from sqlite3_malloc(). Omit the internal
+** %-conversion extensions.
+*/
+SQLITE_API char *sqlite3_vmprintf(const char *zFormat, va_list ap){
+ char *z;
+ char zBase[SQLITE_PRINT_BUF_SIZE];
+ StrAccum acc;
+
+#ifdef SQLITE_ENABLE_API_ARMOR
+ if( zFormat==0 ){
+ (void)SQLITE_MISUSE_BKPT;
+ return 0;
+ }
+#endif
+#ifndef SQLITE_OMIT_AUTOINIT
+ if( sqlite3_initialize() ) return 0;
+#endif
+ sqlite3StrAccumInit(&acc, 0, zBase, sizeof(zBase), SQLITE_MAX_LENGTH);
+ sqlite3_str_vappendf(&acc, zFormat, ap);
+ z = sqlite3StrAccumFinish(&acc);
+ return z;
+}
+
+/*
+** Print into memory obtained from sqlite3_malloc()(). Omit the internal
+** %-conversion extensions.
+*/
+SQLITE_API char *sqlite3_mprintf(const char *zFormat, ...){
+ va_list ap;
+ char *z;
+#ifndef SQLITE_OMIT_AUTOINIT
+ if( sqlite3_initialize() ) return 0;
+#endif
+ va_start(ap, zFormat);
+ z = sqlite3_vmprintf(zFormat, ap);
+ va_end(ap);
+ return z;
+}
+
+/*
+** sqlite3_snprintf() works like snprintf() except that it ignores the
+** current locale settings. This is important for SQLite because we
+** are not able to use a "," as the decimal point in place of "." as
+** specified by some locales.
+**
+** Oops: The first two arguments of sqlite3_snprintf() are backwards
+** from the snprintf() standard. Unfortunately, it is too late to change
+** this without breaking compatibility, so we just have to live with the
+** mistake.
+**
+** sqlite3_vsnprintf() is the varargs version.
+*/
+SQLITE_API char *sqlite3_vsnprintf(int n, char *zBuf, const char *zFormat, va_list ap){
+ StrAccum acc;
+ if( n<=0 ) return zBuf;
+#ifdef SQLITE_ENABLE_API_ARMOR
+ if( zBuf==0 || zFormat==0 ) {
+ (void)SQLITE_MISUSE_BKPT;
+ if( zBuf ) zBuf[0] = 0;
+ return zBuf;
+ }
+#endif
+ sqlite3StrAccumInit(&acc, 0, zBuf, n, 0);
+ sqlite3_str_vappendf(&acc, zFormat, ap);
+ zBuf[acc.nChar] = 0;
+ return zBuf;
+}
+SQLITE_API char *sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){
+ StrAccum acc;
+ va_list ap;
+ if( n<=0 ) return zBuf;
+#ifdef SQLITE_ENABLE_API_ARMOR
+ if( zBuf==0 || zFormat==0 ) {
+ (void)SQLITE_MISUSE_BKPT;
+ if( zBuf ) zBuf[0] = 0;
+ return zBuf;
+ }
+#endif
+ sqlite3StrAccumInit(&acc, 0, zBuf, n, 0);
+ va_start(ap,zFormat);
+ sqlite3_str_vappendf(&acc, zFormat, ap);
+ va_end(ap);
+ zBuf[acc.nChar] = 0;
+ return zBuf;
+}
+
+/*
+** This is the routine that actually formats the sqlite3_log() message.
+** We house it in a separate routine from sqlite3_log() to avoid using
+** stack space on small-stack systems when logging is disabled.
+**
+** sqlite3_log() must render into a static buffer. It cannot dynamically
+** allocate memory because it might be called while the memory allocator
+** mutex is held.
+**
+** sqlite3_str_vappendf() might ask for *temporary* memory allocations for
+** certain format characters (%q) or for very large precisions or widths.
+** Care must be taken that any sqlite3_log() calls that occur while the
+** memory mutex is held do not use these mechanisms.
+*/
+static void renderLogMsg(int iErrCode, const char *zFormat, va_list ap){
+ StrAccum acc; /* String accumulator */
+ char zMsg[SQLITE_PRINT_BUF_SIZE*3]; /* Complete log message */
+
+ sqlite3StrAccumInit(&acc, 0, zMsg, sizeof(zMsg), 0);
+ sqlite3_str_vappendf(&acc, zFormat, ap);
+ sqlite3GlobalConfig.xLog(sqlite3GlobalConfig.pLogArg, iErrCode,
+ sqlite3StrAccumFinish(&acc));
+}
+
+/*
+** Format and write a message to the log if logging is enabled.
+*/
+SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...){
+ va_list ap; /* Vararg list */
+ if( sqlite3GlobalConfig.xLog ){
+ va_start(ap, zFormat);
+ renderLogMsg(iErrCode, zFormat, ap);
+ va_end(ap);
+ }
+}
+
+#if defined(SQLITE_DEBUG) || defined(SQLITE_HAVE_OS_TRACE)
+/*
+** A version of printf() that understands %lld. Used for debugging.
+** The printf() built into some versions of windows does not understand %lld
+** and segfaults if you give it a long long int.
+*/
+SQLITE_PRIVATE void sqlite3DebugPrintf(const char *zFormat, ...){
+ va_list ap;
+ StrAccum acc;
+ char zBuf[SQLITE_PRINT_BUF_SIZE*10];
+ sqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0);
+ va_start(ap,zFormat);
+ sqlite3_str_vappendf(&acc, zFormat, ap);
+ va_end(ap);
+ sqlite3StrAccumFinish(&acc);
+#ifdef SQLITE_OS_TRACE_PROC
+ {
+ extern void SQLITE_OS_TRACE_PROC(const char *zBuf, int nBuf);
+ SQLITE_OS_TRACE_PROC(zBuf, sizeof(zBuf));
+ }
+#else
+ fprintf(stdout,"%s", zBuf);
+ fflush(stdout);
+#endif
+}
+#endif
+
+
+/*
+** variable-argument wrapper around sqlite3_str_vappendf(). The bFlags argument
+** can contain the bit SQLITE_PRINTF_INTERNAL enable internal formats.
+*/
+SQLITE_API void sqlite3_str_appendf(StrAccum *p, const char *zFormat, ...){
+ va_list ap;
+ va_start(ap,zFormat);
+ sqlite3_str_vappendf(p, zFormat, ap);
+ va_end(ap);
+}
+
+
+/*****************************************************************************
+** Reference counted string/blob storage
+*****************************************************************************/
+
+/*
+** Increase the reference count of the string by one.
+**
+** The input parameter is returned.
+*/
+SQLITE_PRIVATE char *sqlite3RCStrRef(char *z){
+ RCStr *p = (RCStr*)z;
+ assert( p!=0 );
+ p--;
+ p->nRCRef++;
+ return z;
+}
+
+/*
+** Decrease the reference count by one. Free the string when the
+** reference count reaches zero.
+*/
+SQLITE_PRIVATE void sqlite3RCStrUnref(void *z){
+ RCStr *p = (RCStr*)z;
+ assert( p!=0 );
+ p--;
+ assert( p->nRCRef>0 );
+ if( p->nRCRef>=2 ){
+ p->nRCRef--;
+ }else{
+ sqlite3_free(p);
+ }
+}
+
+/*
+** Create a new string that is capable of holding N bytes of text, not counting
+** the zero byte at the end. The string is uninitialized.
+**
+** The reference count is initially 1. Call sqlite3RCStrUnref() to free the
+** newly allocated string.
+**
+** This routine returns 0 on an OOM.
+*/
+SQLITE_PRIVATE char *sqlite3RCStrNew(u64 N){
+ RCStr *p = sqlite3_malloc64( N + sizeof(*p) + 1 );
+ if( p==0 ) return 0;
+ p->nRCRef = 1;
+ return (char*)&p[1];
+}
+
+/*
+** Change the size of the string so that it is able to hold N bytes.
+** The string might be reallocated, so return the new allocation.
+*/
+SQLITE_PRIVATE char *sqlite3RCStrResize(char *z, u64 N){
+ RCStr *p = (RCStr*)z;
+ RCStr *pNew;
+ assert( p!=0 );
+ p--;
+ assert( p->nRCRef==1 );
+ pNew = sqlite3_realloc64(p, N+sizeof(RCStr)+1);
+ if( pNew==0 ){
+ sqlite3_free(p);
+ return 0;
+ }else{
+ return (char*)&pNew[1];
+ }
+}
+
+/************** End of printf.c **********************************************/
+/************** Begin file treeview.c ****************************************/
+/*
+** 2015-06-08
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+**
+** This file contains C code to implement the TreeView debugging routines.
+** These routines print a parse tree to standard output for debugging and
+** analysis.
+**
+** The interfaces in this file is only available when compiling
+** with SQLITE_DEBUG.
+*/
+/* #include "sqliteInt.h" */
+#ifdef SQLITE_DEBUG
+
+/*
+** Add a new subitem to the tree. The moreToFollow flag indicates that this
+** is not the last item in the tree.
+*/
+static void sqlite3TreeViewPush(TreeView **pp, u8 moreToFollow){
+ TreeView *p = *pp;
+ if( p==0 ){
+ *pp = p = sqlite3_malloc64( sizeof(*p) );
+ if( p==0 ) return;
+ memset(p, 0, sizeof(*p));
+ }else{
+ p->iLevel++;
+ }
+ assert( moreToFollow==0 || moreToFollow==1 );
+ if( p->iLevel<(int)sizeof(p->bLine) ) p->bLine[p->iLevel] = moreToFollow;
+}
+
+/*
+** Finished with one layer of the tree
+*/
+static void sqlite3TreeViewPop(TreeView **pp){
+ TreeView *p = *pp;
+ if( p==0 ) return;
+ p->iLevel--;
+ if( p->iLevel<0 ){
+ sqlite3_free(p);
+ *pp = 0;
+ }
+}
+
+/*
+** Generate a single line of output for the tree, with a prefix that contains
+** all the appropriate tree lines
+*/
+SQLITE_PRIVATE void sqlite3TreeViewLine(TreeView *p, const char *zFormat, ...){
+ va_list ap;
+ int i;
+ StrAccum acc;
+ char zBuf[1000];
+ sqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0);
+ if( p ){
+ for(i=0; i<p->iLevel && i<(int)sizeof(p->bLine)-1; i++){
+ sqlite3_str_append(&acc, p->bLine[i] ? "| " : " ", 4);
+ }
+ sqlite3_str_append(&acc, p->bLine[i] ? "|-- " : "'-- ", 4);
+ }
+ if( zFormat!=0 ){
+ va_start(ap, zFormat);
+ sqlite3_str_vappendf(&acc, zFormat, ap);
+ va_end(ap);
+ assert( acc.nChar>0 || acc.accError );
+ sqlite3_str_append(&acc, "\n", 1);
+ }
+ sqlite3StrAccumFinish(&acc);
+ fprintf(stdout,"%s", zBuf);
+ fflush(stdout);
+}
+
+/*
+** Shorthand for starting a new tree item that consists of a single label
+*/
+static void sqlite3TreeViewItem(TreeView *p, const char *zLabel,u8 moreFollows){
+ sqlite3TreeViewPush(&p, moreFollows);
+ sqlite3TreeViewLine(p, "%s", zLabel);
+}
+
+/*
+** Show a list of Column objects in tree format.
+*/
+SQLITE_PRIVATE void sqlite3TreeViewColumnList(
+ TreeView *pView,
+ const Column *aCol,
+ int nCol,
+ u8 moreToFollow
+){
+ int i;
+ sqlite3TreeViewPush(&pView, moreToFollow);
+ sqlite3TreeViewLine(pView, "COLUMNS");
+ for(i=0; i<nCol; i++){
+ u16 flg = aCol[i].colFlags;
+ int colMoreToFollow = i<(nCol - 1);
+ sqlite3TreeViewPush(&pView, colMoreToFollow);
+ sqlite3TreeViewLine(pView, 0);
+ printf(" %s", aCol[i].zCnName);
+ switch( aCol[i].eCType ){
+ case COLTYPE_ANY: printf(" ANY"); break;
+ case COLTYPE_BLOB: printf(" BLOB"); break;
+ case COLTYPE_INT: printf(" INT"); break;
+ case COLTYPE_INTEGER: printf(" INTEGER"); break;
+ case COLTYPE_REAL: printf(" REAL"); break;
+ case COLTYPE_TEXT: printf(" TEXT"); break;
+ case COLTYPE_CUSTOM: {
+ if( flg & COLFLAG_HASTYPE ){
+ const char *z = aCol[i].zCnName;
+ z += strlen(z)+1;
+ printf(" X-%s", z);
+ break;
+ }
+ }
+ }
+ if( flg & COLFLAG_PRIMKEY ) printf(" PRIMARY KEY");
+ if( flg & COLFLAG_HIDDEN ) printf(" HIDDEN");
+#ifdef COLFLAG_NOEXPAND
+ if( flg & COLFLAG_NOEXPAND ) printf(" NO-EXPAND");
+#endif
+ if( flg ) printf(" flags=%04x", flg);
+ printf("\n");
+ fflush(stdout);
+ sqlite3TreeViewPop(&pView);
+ }
+ sqlite3TreeViewPop(&pView);
+}
+
+/*
+** Generate a human-readable description of a WITH clause.
+*/
+SQLITE_PRIVATE void sqlite3TreeViewWith(TreeView *pView, const With *pWith, u8 moreToFollow){
+ int i;
+ if( pWith==0 ) return;
+ if( pWith->nCte==0 ) return;
+ if( pWith->pOuter ){
+ sqlite3TreeViewLine(pView, "WITH (0x%p, pOuter=0x%p)",pWith,pWith->pOuter);
+ }else{
+ sqlite3TreeViewLine(pView, "WITH (0x%p)", pWith);
+ }
+ if( pWith->nCte>0 ){
+ sqlite3TreeViewPush(&pView, moreToFollow);
+ for(i=0; i<pWith->nCte; i++){
+ StrAccum x;
+ char zLine[1000];
+ const struct Cte *pCte = &pWith->a[i];
+ sqlite3StrAccumInit(&x, 0, zLine, sizeof(zLine), 0);
+ sqlite3_str_appendf(&x, "%s", pCte->zName);
+ if( pCte->pCols && pCte->pCols->nExpr>0 ){
+ char cSep = '(';
+ int j;
+ for(j=0; j<pCte->pCols->nExpr; j++){
+ sqlite3_str_appendf(&x, "%c%s", cSep, pCte->pCols->a[j].zEName);
+ cSep = ',';
+ }
+ sqlite3_str_appendf(&x, ")");
+ }
+ if( pCte->eM10d!=M10d_Any ){
+ sqlite3_str_appendf(&x, " %sMATERIALIZED",
+ pCte->eM10d==M10d_No ? "NOT " : "");
+ }
+ if( pCte->pUse ){
+ sqlite3_str_appendf(&x, " (pUse=0x%p, nUse=%d)", pCte->pUse,
+ pCte->pUse->nUse);
+ }
+ sqlite3StrAccumFinish(&x);
+ sqlite3TreeViewItem(pView, zLine, i<pWith->nCte-1);
+ sqlite3TreeViewSelect(pView, pCte->pSelect, 0);
+ sqlite3TreeViewPop(&pView);
+ }
+ sqlite3TreeViewPop(&pView);
+ }
+}
+
+/*
+** Generate a human-readable description of a SrcList object.
+*/
+SQLITE_PRIVATE void sqlite3TreeViewSrcList(TreeView *pView, const SrcList *pSrc){
+ int i;
+ if( pSrc==0 ) return;
+ for(i=0; i<pSrc->nSrc; i++){
+ const SrcItem *pItem = &pSrc->a[i];
+ StrAccum x;
+ int n = 0;
+ char zLine[1000];
+ sqlite3StrAccumInit(&x, 0, zLine, sizeof(zLine), 0);
+ x.printfFlags |= SQLITE_PRINTF_INTERNAL;
+ sqlite3_str_appendf(&x, "{%d:*} %!S", pItem->iCursor, pItem);
+ if( pItem->pSTab ){
+ sqlite3_str_appendf(&x, " tab=%Q nCol=%d ptr=%p used=%llx%s",
+ pItem->pSTab->zName, pItem->pSTab->nCol, pItem->pSTab,
+ pItem->colUsed,
+ pItem->fg.rowidUsed ? "+rowid" : "");
+ }
+ if( (pItem->fg.jointype & (JT_LEFT|JT_RIGHT))==(JT_LEFT|JT_RIGHT) ){
+ sqlite3_str_appendf(&x, " FULL-OUTER-JOIN");
+ }else if( pItem->fg.jointype & JT_LEFT ){
+ sqlite3_str_appendf(&x, " LEFT-JOIN");
+ }else if( pItem->fg.jointype & JT_RIGHT ){
+ sqlite3_str_appendf(&x, " RIGHT-JOIN");
+ }else if( pItem->fg.jointype & JT_CROSS ){
+ sqlite3_str_appendf(&x, " CROSS-JOIN");
+ }
+ if( pItem->fg.jointype & JT_LTORJ ){
+ sqlite3_str_appendf(&x, " LTORJ");
+ }
+ if( pItem->fg.fromDDL ){
+ sqlite3_str_appendf(&x, " DDL");
+ }
+ if( pItem->fg.isCte ){
+ static const char *aMat[] = {",MAT", "", ",NO-MAT"};
+ sqlite3_str_appendf(&x, " CteUse=%d%s",
+ pItem->u2.pCteUse->nUse,
+ aMat[pItem->u2.pCteUse->eM10d]);
+ }
+ if( pItem->fg.isOn || (pItem->fg.isUsing==0 && pItem->u3.pOn!=0) ){
+ sqlite3_str_appendf(&x, " isOn");
+ }
+ if( pItem->fg.isTabFunc ) sqlite3_str_appendf(&x, " isTabFunc");
+ if( pItem->fg.isCorrelated ) sqlite3_str_appendf(&x, " isCorrelated");
+ if( pItem->fg.isMaterialized ) sqlite3_str_appendf(&x, " isMaterialized");
+ if( pItem->fg.viaCoroutine ) sqlite3_str_appendf(&x, " viaCoroutine");
+ if( pItem->fg.notCte ) sqlite3_str_appendf(&x, " notCte");
+ if( pItem->fg.isNestedFrom ) sqlite3_str_appendf(&x, " isNestedFrom");
+ if( pItem->fg.fixedSchema ) sqlite3_str_appendf(&x, " fixedSchema");
+ if( pItem->fg.hadSchema ) sqlite3_str_appendf(&x, " hadSchema");
+ if( pItem->fg.isSubquery ) sqlite3_str_appendf(&x, " isSubquery");
+
+ sqlite3StrAccumFinish(&x);
+ sqlite3TreeViewItem(pView, zLine, i<pSrc->nSrc-1);
+ n = 0;
+ if( pItem->fg.isSubquery ) n++;
+ if( pItem->fg.isTabFunc ) n++;
+ if( pItem->fg.isUsing ) n++;
+ if( pItem->fg.isUsing ){
+ sqlite3TreeViewIdList(pView, pItem->u3.pUsing, (--n)>0, "USING");
+ }
+ if( pItem->fg.isSubquery ){
+ assert( n==1 );
+ if( pItem->pSTab ){
+ Table *pTab = pItem->pSTab;
+ sqlite3TreeViewColumnList(pView, pTab->aCol, pTab->nCol, 1);
+ }
+ assert( (int)pItem->fg.isNestedFrom == IsNestedFrom(pItem) );
+ sqlite3TreeViewSelect(pView, pItem->u4.pSubq->pSelect, 0);
+ }
+ if( pItem->fg.isTabFunc ){
+ sqlite3TreeViewExprList(pView, pItem->u1.pFuncArg, 0, "func-args:");
+ }
+ sqlite3TreeViewPop(&pView);
+ }
+}
+
+/*
+** Generate a human-readable description of a Select object.
+*/
+SQLITE_PRIVATE void sqlite3TreeViewSelect(TreeView *pView, const Select *p, u8 moreToFollow){
+ int n = 0;
+ int cnt = 0;
+ if( p==0 ){
+ sqlite3TreeViewLine(pView, "nil-SELECT");
+ return;
+ }
+ sqlite3TreeViewPush(&pView, moreToFollow);
+ if( p->pWith ){
+ sqlite3TreeViewWith(pView, p->pWith, 1);
+ cnt = 1;
+ sqlite3TreeViewPush(&pView, 1);
+ }
+ do{
+ if( p->selFlags & SF_WhereBegin ){
+ sqlite3TreeViewLine(pView, "sqlite3WhereBegin()");
+ }else{
+ sqlite3TreeViewLine(pView,
+ "SELECT%s%s (%u/%p) selFlags=0x%x nSelectRow=%d",
+ ((p->selFlags & SF_Distinct) ? " DISTINCT" : ""),
+ ((p->selFlags & SF_Aggregate) ? " agg_flag" : ""),
+ p->selId, p, p->selFlags,
+ (int)p->nSelectRow
+ );
+ }
+ if( cnt++ ) sqlite3TreeViewPop(&pView);
+ if( p->pPrior ){
+ n = 1000;
+ }else{
+ n = 0;
+ if( p->pSrc && p->pSrc->nSrc && p->pSrc->nAlloc ) n++;
+ if( p->pWhere ) n++;
+ if( p->pGroupBy ) n++;
+ if( p->pHaving ) n++;
+ if( p->pOrderBy ) n++;
+ if( p->pLimit ) n++;
+#ifndef SQLITE_OMIT_WINDOWFUNC
+ if( p->pWin ) n++;
+ if( p->pWinDefn ) n++;
+#endif
+ }
+ if( p->pEList ){
+ sqlite3TreeViewExprList(pView, p->pEList, n>0, "result-set");
+ }
+ n--;
+#ifndef SQLITE_OMIT_WINDOWFUNC
+ if( p->pWin ){
+ Window *pX;
+ sqlite3TreeViewPush(&pView, (n--)>0);
+ sqlite3TreeViewLine(pView, "window-functions");
+ for(pX=p->pWin; pX; pX=pX->pNextWin){
+ sqlite3TreeViewWinFunc(pView, pX, pX->pNextWin!=0);
+ }
+ sqlite3TreeViewPop(&pView);
+ }
+#endif
+ if( p->pSrc && p->pSrc->nSrc && p->pSrc->nAlloc ){
+ sqlite3TreeViewPush(&pView, (n--)>0);
+ sqlite3TreeViewLine(pView, "FROM");
+ sqlite3TreeViewSrcList(pView, p->pSrc);
+ sqlite3TreeViewPop(&pView);
+ }
+ if( p->pWhere ){
+ sqlite3TreeViewItem(pView, "WHERE", (n--)>0);
+ sqlite3TreeViewExpr(pView, p->pWhere, 0);
+ sqlite3TreeViewPop(&pView);
+ }
+ if( p->pGroupBy ){
+ sqlite3TreeViewExprList(pView, p->pGroupBy, (n--)>0, "GROUPBY");
+ }
+ if( p->pHaving ){
+ sqlite3TreeViewItem(pView, "HAVING", (n--)>0);
+ sqlite3TreeViewExpr(pView, p->pHaving, 0);
+ sqlite3TreeViewPop(&pView);
+ }
+#ifndef SQLITE_OMIT_WINDOWFUNC
+ if( p->pWinDefn ){
+ Window *pX;
+ sqlite3TreeViewItem(pView, "WINDOW", (n--)>0);
+ for(pX=p->pWinDefn; pX; pX=pX->pNextWin){
+ sqlite3TreeViewWindow(pView, pX, pX->pNextWin!=0);
+ }
+ sqlite3TreeViewPop(&pView);
+ }
+#endif
+ if( p->pOrderBy ){
+ sqlite3TreeViewExprList(pView, p->pOrderBy, (n--)>0, "ORDERBY");
+ }
+ if( p->pLimit ){
+ sqlite3TreeViewItem(pView, "LIMIT", (n--)>0);
+ sqlite3TreeViewExpr(pView, p->pLimit->pLeft, p->pLimit->pRight!=0);
+ if( p->pLimit->pRight ){
+ sqlite3TreeViewItem(pView, "OFFSET", 0);
+ sqlite3TreeViewExpr(pView, p->pLimit->pRight, 0);
+ sqlite3TreeViewPop(&pView);
+ }
+ sqlite3TreeViewPop(&pView);
+ }
+ if( p->pPrior ){
+ const char *zOp = "UNION";
+ switch( p->op ){
+ case TK_ALL: zOp = "UNION ALL"; break;
+ case TK_INTERSECT: zOp = "INTERSECT"; break;
+ case TK_EXCEPT: zOp = "EXCEPT"; break;
+ }
+ sqlite3TreeViewItem(pView, zOp, 1);
+ }
+ p = p->pPrior;
+ }while( p!=0 );
+ sqlite3TreeViewPop(&pView);
+}
+
+#ifndef SQLITE_OMIT_WINDOWFUNC
+/*
+** Generate a description of starting or stopping bounds
+*/
+SQLITE_PRIVATE void sqlite3TreeViewBound(
+ TreeView *pView, /* View context */
+ u8 eBound, /* UNBOUNDED, CURRENT, PRECEDING, FOLLOWING */
+ Expr *pExpr, /* Value for PRECEDING or FOLLOWING */
+ u8 moreToFollow /* True if more to follow */
+){
+ switch( eBound ){
+ case TK_UNBOUNDED: {
+ sqlite3TreeViewItem(pView, "UNBOUNDED", moreToFollow);
+ sqlite3TreeViewPop(&pView);
+ break;
+ }
+ case TK_CURRENT: {
+ sqlite3TreeViewItem(pView, "CURRENT", moreToFollow);
+ sqlite3TreeViewPop(&pView);
+ break;
+ }
+ case TK_PRECEDING: {
+ sqlite3TreeViewItem(pView, "PRECEDING", moreToFollow);
+ sqlite3TreeViewExpr(pView, pExpr, 0);
+ sqlite3TreeViewPop(&pView);
+ break;
+ }
+ case TK_FOLLOWING: {
+ sqlite3TreeViewItem(pView, "FOLLOWING", moreToFollow);
+ sqlite3TreeViewExpr(pView, pExpr, 0);
+ sqlite3TreeViewPop(&pView);
+ break;
+ }
+ }
+}
+#endif /* SQLITE_OMIT_WINDOWFUNC */
+
+#ifndef SQLITE_OMIT_WINDOWFUNC
+/*
+** Generate a human-readable explanation for a Window object
+*/
+SQLITE_PRIVATE void sqlite3TreeViewWindow(TreeView *pView, const Window *pWin, u8 more){
+ int nElement = 0;
+ if( pWin==0 ) return;
+ if( pWin->pFilter ){
+ sqlite3TreeViewItem(pView, "FILTER", 1);
+ sqlite3TreeViewExpr(pView, pWin->pFilter, 0);
+ sqlite3TreeViewPop(&pView);
+ if( pWin->eFrmType==TK_FILTER ) return;
+ }
+ sqlite3TreeViewPush(&pView, more);
+ if( pWin->zName ){
+ sqlite3TreeViewLine(pView, "OVER %s (%p)", pWin->zName, pWin);
+ }else{
+ sqlite3TreeViewLine(pView, "OVER (%p)", pWin);
+ }
+ if( pWin->zBase ) nElement++;
+ if( pWin->pOrderBy ) nElement++;
+ if( pWin->eFrmType!=0 && pWin->eFrmType!=TK_FILTER ) nElement++;
+ if( pWin->eExclude ) nElement++;
+ if( pWin->zBase ){
+ sqlite3TreeViewPush(&pView, (--nElement)>0);
+ sqlite3TreeViewLine(pView, "window: %s", pWin->zBase);
+ sqlite3TreeViewPop(&pView);
+ }
+ if( pWin->pPartition ){
+ sqlite3TreeViewExprList(pView, pWin->pPartition, nElement>0,"PARTITION-BY");
+ }
+ if( pWin->pOrderBy ){
+ sqlite3TreeViewExprList(pView, pWin->pOrderBy, (--nElement)>0, "ORDER-BY");
+ }
+ if( pWin->eFrmType!=0 && pWin->eFrmType!=TK_FILTER ){
+ char zBuf[30];
+ const char *zFrmType = "ROWS";
+ if( pWin->eFrmType==TK_RANGE ) zFrmType = "RANGE";
+ if( pWin->eFrmType==TK_GROUPS ) zFrmType = "GROUPS";
+ sqlite3_snprintf(sizeof(zBuf),zBuf,"%s%s",zFrmType,
+ pWin->bImplicitFrame ? " (implied)" : "");
+ sqlite3TreeViewItem(pView, zBuf, (--nElement)>0);
+ sqlite3TreeViewBound(pView, pWin->eStart, pWin->pStart, 1);
+ sqlite3TreeViewBound(pView, pWin->eEnd, pWin->pEnd, 0);
+ sqlite3TreeViewPop(&pView);
+ }
+ if( pWin->eExclude ){
+ char zBuf[30];
+ const char *zExclude;
+ switch( pWin->eExclude ){
+ case TK_NO: zExclude = "NO OTHERS"; break;
+ case TK_CURRENT: zExclude = "CURRENT ROW"; break;
+ case TK_GROUP: zExclude = "GROUP"; break;
+ case TK_TIES: zExclude = "TIES"; break;
+ default:
+ sqlite3_snprintf(sizeof(zBuf),zBuf,"invalid(%d)", pWin->eExclude);
+ zExclude = zBuf;
+ break;
+ }
+ sqlite3TreeViewPush(&pView, 0);
+ sqlite3TreeViewLine(pView, "EXCLUDE %s", zExclude);
+ sqlite3TreeViewPop(&pView);
+ }
+ sqlite3TreeViewPop(&pView);
+}
+#endif /* SQLITE_OMIT_WINDOWFUNC */
+
+#ifndef SQLITE_OMIT_WINDOWFUNC
+/*
+** Generate a human-readable explanation for a Window Function object
+*/
+SQLITE_PRIVATE void sqlite3TreeViewWinFunc(TreeView *pView, const Window *pWin, u8 more){
+ if( pWin==0 ) return;
+ sqlite3TreeViewPush(&pView, more);
+ sqlite3TreeViewLine(pView, "WINFUNC %s(%d)",
+ pWin->pWFunc->zName, pWin->pWFunc->nArg);
+ sqlite3TreeViewWindow(pView, pWin, 0);
+ sqlite3TreeViewPop(&pView);
+}
+#endif /* SQLITE_OMIT_WINDOWFUNC */
+
+/*
+** Generate a human-readable explanation of an expression tree.
+*/
+SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 moreToFollow){
+ const char *zBinOp = 0; /* Binary operator */
+ const char *zUniOp = 0; /* Unary operator */
+ char zFlgs[200];
+ sqlite3TreeViewPush(&pView, moreToFollow);
+ if( pExpr==0 ){
+ sqlite3TreeViewLine(pView, "nil");
+ sqlite3TreeViewPop(&pView);
+ return;
+ }
+ if( pExpr->flags || pExpr->affExpr || pExpr->vvaFlags || pExpr->pAggInfo ){
+ StrAccum x;
+ sqlite3StrAccumInit(&x, 0, zFlgs, sizeof(zFlgs), 0);
+ sqlite3_str_appendf(&x, " fg.af=%x.%c",
+ pExpr->flags, pExpr->affExpr ? pExpr->affExpr : 'n');
+ if( ExprHasProperty(pExpr, EP_OuterON) ){
+ sqlite3_str_appendf(&x, " outer.iJoin=%d", pExpr->w.iJoin);
+ }
+ if( ExprHasProperty(pExpr, EP_InnerON) ){
+ sqlite3_str_appendf(&x, " inner.iJoin=%d", pExpr->w.iJoin);
+ }
+ if( ExprHasProperty(pExpr, EP_FromDDL) ){
+ sqlite3_str_appendf(&x, " DDL");
+ }
+ if( ExprHasVVAProperty(pExpr, EP_Immutable) ){
+ sqlite3_str_appendf(&x, " IMMUTABLE");
+ }
+ if( pExpr->pAggInfo!=0 ){
+ sqlite3_str_appendf(&x, " agg-column[%d]", pExpr->iAgg);
+ }
+ sqlite3StrAccumFinish(&x);
+ }else{
+ zFlgs[0] = 0;
+ }
+ switch( pExpr->op ){
+ case TK_AGG_COLUMN: {
+ sqlite3TreeViewLine(pView, "AGG{%d:%d}%s",
+ pExpr->iTable, pExpr->iColumn, zFlgs);
+ break;
+ }
+ case TK_COLUMN: {
+ if( pExpr->iTable<0 ){
+ /* This only happens when coding check constraints */
+ char zOp2[16];
+ if( pExpr->op2 ){
+ sqlite3_snprintf(sizeof(zOp2),zOp2," op2=0x%02x",pExpr->op2);
+ }else{
+ zOp2[0] = 0;
+ }
+ sqlite3TreeViewLine(pView, "COLUMN(%d)%s%s",
+ pExpr->iColumn, zFlgs, zOp2);
+ }else{
+ assert( ExprUseYTab(pExpr) );
+ sqlite3TreeViewLine(pView, "{%d:%d} pTab=%p%s",
+ pExpr->iTable, pExpr->iColumn,
+ pExpr->y.pTab, zFlgs);
+ }
+ if( ExprHasProperty(pExpr, EP_FixedCol) ){
+ sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);
+ }
+ break;
+ }
+ case TK_INTEGER: {
+ if( pExpr->flags & EP_IntValue ){
+ sqlite3TreeViewLine(pView, "%d", pExpr->u.iValue);
+ }else{
+ sqlite3TreeViewLine(pView, "%s", pExpr->u.zToken);
+ }
+ break;
+ }
+#ifndef SQLITE_OMIT_FLOATING_POINT
+ case TK_FLOAT: {
+ assert( !ExprHasProperty(pExpr, EP_IntValue) );
+ sqlite3TreeViewLine(pView,"%s", pExpr->u.zToken);
+ break;
+ }
+#endif
+ case TK_STRING: {
+ assert( !ExprHasProperty(pExpr, EP_IntValue) );
+ sqlite3TreeViewLine(pView,"%Q", pExpr->u.zToken);
+ break;
+ }
+ case TK_NULL: {
+ sqlite3TreeViewLine(pView,"NULL");
+ break;
+ }
+ case TK_TRUEFALSE: {
+ sqlite3TreeViewLine(pView,"%s%s",
+ sqlite3ExprTruthValue(pExpr) ? "TRUE" : "FALSE", zFlgs);
+ break;
+ }
+#ifndef SQLITE_OMIT_BLOB_LITERAL
+ case TK_BLOB: {
+ assert( !ExprHasProperty(pExpr, EP_IntValue) );
+ sqlite3TreeViewLine(pView,"%s", pExpr->u.zToken);
+ break;
+ }
+#endif
+ case TK_VARIABLE: {
+ assert( !ExprHasProperty(pExpr, EP_IntValue) );
+ sqlite3TreeViewLine(pView,"VARIABLE(%s,%d)",
+ pExpr->u.zToken, pExpr->iColumn);
+ break;
+ }
+ case TK_REGISTER: {
+ sqlite3TreeViewLine(pView,"REGISTER(%d)", pExpr->iTable);
+ break;
+ }
+ case TK_ID: {
+ assert( !ExprHasProperty(pExpr, EP_IntValue) );
+ sqlite3TreeViewLine(pView,"ID \"%w\"", pExpr->u.zToken);
+ break;
+ }
+#ifndef SQLITE_OMIT_CAST
+ case TK_CAST: {
+ /* Expressions of the form: CAST(pLeft AS token) */
+ assert( !ExprHasProperty(pExpr, EP_IntValue) );
+ sqlite3TreeViewLine(pView,"CAST %Q", pExpr->u.zToken);
+ sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);
+ break;
+ }
+#endif /* SQLITE_OMIT_CAST */
+ case TK_LT: zBinOp = "LT"; break;
+ case TK_LE: zBinOp = "LE"; break;
+ case TK_GT: zBinOp = "GT"; break;
+ case TK_GE: zBinOp = "GE"; break;
+ case TK_NE: zBinOp = "NE"; break;
+ case TK_EQ: zBinOp = "EQ"; break;
+ case TK_IS: zBinOp = "IS"; break;
+ case TK_ISNOT: zBinOp = "ISNOT"; break;
+ case TK_AND: zBinOp = "AND"; break;
+ case TK_OR: zBinOp = "OR"; break;
+ case TK_PLUS: zBinOp = "ADD"; break;
+ case TK_STAR: zBinOp = "MUL"; break;
+ case TK_MINUS: zBinOp = "SUB"; break;
+ case TK_REM: zBinOp = "REM"; break;
+ case TK_BITAND: zBinOp = "BITAND"; break;
+ case TK_BITOR: zBinOp = "BITOR"; break;
+ case TK_SLASH: zBinOp = "DIV"; break;
+ case TK_LSHIFT: zBinOp = "LSHIFT"; break;
+ case TK_RSHIFT: zBinOp = "RSHIFT"; break;
+ case TK_CONCAT: zBinOp = "CONCAT"; break;
+ case TK_DOT: zBinOp = "DOT"; break;
+ case TK_LIMIT: zBinOp = "LIMIT"; break;
+
+ case TK_UMINUS: zUniOp = "UMINUS"; break;
+ case TK_UPLUS: zUniOp = "UPLUS"; break;
+ case TK_BITNOT: zUniOp = "BITNOT"; break;
+ case TK_NOT: zUniOp = "NOT"; break;
+ case TK_ISNULL: zUniOp = "ISNULL"; break;
+ case TK_NOTNULL: zUniOp = "NOTNULL"; break;
+
+ case TK_TRUTH: {
+ int x;
+ const char *azOp[] = {
+ "IS-FALSE", "IS-TRUE", "IS-NOT-FALSE", "IS-NOT-TRUE"
+ };
+ assert( pExpr->op2==TK_IS || pExpr->op2==TK_ISNOT );
+ assert( pExpr->pRight );
+ assert( sqlite3ExprSkipCollateAndLikely(pExpr->pRight)->op
+ == TK_TRUEFALSE );
+ x = (pExpr->op2==TK_ISNOT)*2 + sqlite3ExprTruthValue(pExpr->pRight);
+ zUniOp = azOp[x];
+ break;
+ }
+
+ case TK_SPAN: {
+ assert( !ExprHasProperty(pExpr, EP_IntValue) );
+ sqlite3TreeViewLine(pView, "SPAN %Q", pExpr->u.zToken);
+ sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);
+ break;
+ }
+
+ case TK_COLLATE: {
+ /* COLLATE operators without the EP_Collate flag are intended to
+ ** emulate collation associated with a table column. These show
+ ** up in the treeview output as "SOFT-COLLATE". Explicit COLLATE
+ ** operators that appear in the original SQL always have the
+ ** EP_Collate bit set and appear in treeview output as just "COLLATE" */
+ assert( !ExprHasProperty(pExpr, EP_IntValue) );
+ sqlite3TreeViewLine(pView, "%sCOLLATE %Q%s",
+ !ExprHasProperty(pExpr, EP_Collate) ? "SOFT-" : "",
+ pExpr->u.zToken, zFlgs);
+ sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);
+ break;
+ }
+
+ case TK_AGG_FUNCTION:
+ case TK_FUNCTION: {
+ ExprList *pFarg; /* List of function arguments */
+ Window *pWin;
+ if( ExprHasProperty(pExpr, EP_TokenOnly) ){
+ pFarg = 0;
+ pWin = 0;
+ }else{
+ assert( ExprUseXList(pExpr) );
+ pFarg = pExpr->x.pList;
+#ifndef SQLITE_OMIT_WINDOWFUNC
+ pWin = IsWindowFunc(pExpr) ? pExpr->y.pWin : 0;
+#else
+ pWin = 0;
+#endif
+ }
+ assert( !ExprHasProperty(pExpr, EP_IntValue) );
+ if( pExpr->op==TK_AGG_FUNCTION ){
+ sqlite3TreeViewLine(pView, "AGG_FUNCTION%d %Q%s agg=%d[%d]/%p",
+ pExpr->op2, pExpr->u.zToken, zFlgs,
+ pExpr->pAggInfo ? pExpr->pAggInfo->selId : 0,
+ pExpr->iAgg, pExpr->pAggInfo);
+ }else if( pExpr->op2!=0 ){
+ const char *zOp2;
+ char zBuf[8];
+ sqlite3_snprintf(sizeof(zBuf),zBuf,"0x%02x",pExpr->op2);
+ zOp2 = zBuf;
+ if( pExpr->op2==NC_IsCheck ) zOp2 = "NC_IsCheck";
+ if( pExpr->op2==NC_IdxExpr ) zOp2 = "NC_IdxExpr";
+ if( pExpr->op2==NC_PartIdx ) zOp2 = "NC_PartIdx";
+ if( pExpr->op2==NC_GenCol ) zOp2 = "NC_GenCol";
+ sqlite3TreeViewLine(pView, "FUNCTION %Q%s op2=%s",
+ pExpr->u.zToken, zFlgs, zOp2);
+ }else{
+ sqlite3TreeViewLine(pView, "FUNCTION %Q%s", pExpr->u.zToken, zFlgs);
+ }
+ if( pFarg ){
+ sqlite3TreeViewExprList(pView, pFarg, pWin!=0 || pExpr->pLeft, 0);
+ if( pExpr->pLeft ){
+ Expr *pOB = pExpr->pLeft;
+ assert( pOB->op==TK_ORDER );
+ assert( ExprUseXList(pOB) );
+ sqlite3TreeViewExprList(pView, pOB->x.pList, pWin!=0, "ORDERBY");
+ }
+ }
+#ifndef SQLITE_OMIT_WINDOWFUNC
+ if( pWin ){
+ sqlite3TreeViewWindow(pView, pWin, 0);
+ }
+#endif
+ break;
+ }
+ case TK_ORDER: {
+ sqlite3TreeViewExprList(pView, pExpr->x.pList, 0, "ORDERBY");
+ break;
+ }
+#ifndef SQLITE_OMIT_SUBQUERY
+ case TK_EXISTS: {
+ assert( ExprUseXSelect(pExpr) );
+ sqlite3TreeViewLine(pView, "EXISTS-expr flags=0x%x", pExpr->flags);
+ sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0);
+ break;
+ }
+ case TK_SELECT: {
+ assert( ExprUseXSelect(pExpr) );
+ sqlite3TreeViewLine(pView, "subquery-expr flags=0x%x", pExpr->flags);
+ sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0);
+ break;
+ }
+ case TK_IN: {
+ sqlite3_str *pStr = sqlite3_str_new(0);
+ char *z;
+ sqlite3_str_appendf(pStr, "IN flags=0x%x", pExpr->flags);
+ if( pExpr->iTable ) sqlite3_str_appendf(pStr, " iTable=%d",pExpr->iTable);
+ if( ExprHasProperty(pExpr, EP_Subrtn) ){
+ sqlite3_str_appendf(pStr, " subrtn(%d,%d)",
+ pExpr->y.sub.regReturn, pExpr->y.sub.iAddr);
+ }
+ z = sqlite3_str_finish(pStr);
+ sqlite3TreeViewLine(pView, z);
+ sqlite3_free(z);
+ sqlite3TreeViewExpr(pView, pExpr->pLeft, 1);
+ if( ExprUseXSelect(pExpr) ){
+ sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0);
+ }else{
+ sqlite3TreeViewExprList(pView, pExpr->x.pList, 0, 0);
+ }
+ break;
+ }
+#endif /* SQLITE_OMIT_SUBQUERY */
+
+ /*
+ ** x BETWEEN y AND z
+ **
+ ** This is equivalent to
+ **
+ ** x>=y AND x<=z
+ **
+ ** X is stored in pExpr->pLeft.
+ ** Y is stored in pExpr->pList->a[0].pExpr.
+ ** Z is stored in pExpr->pList->a[1].pExpr.
+ */
+ case TK_BETWEEN: {
+ const Expr *pX, *pY, *pZ;
+ pX = pExpr->pLeft;
+ assert( ExprUseXList(pExpr) );
+ assert( pExpr->x.pList->nExpr==2 );
+ pY = pExpr->x.pList->a[0].pExpr;
+ pZ = pExpr->x.pList->a[1].pExpr;
+ sqlite3TreeViewLine(pView, "BETWEEN%s", zFlgs);
+ sqlite3TreeViewExpr(pView, pX, 1);
+ sqlite3TreeViewExpr(pView, pY, 1);
+ sqlite3TreeViewExpr(pView, pZ, 0);
+ break;
+ }
+ case TK_TRIGGER: {
+ /* If the opcode is TK_TRIGGER, then the expression is a reference
+ ** to a column in the new.* or old.* pseudo-tables available to
+ ** trigger programs. In this case Expr.iTable is set to 1 for the
+ ** new.* pseudo-table, or 0 for the old.* pseudo-table. Expr.iColumn
+ ** is set to the column of the pseudo-table to read, or to -1 to
+ ** read the rowid field.
+ */
+ sqlite3TreeViewLine(pView, "%s(%d)",
+ pExpr->iTable ? "NEW" : "OLD", pExpr->iColumn);
+ break;
+ }
+ case TK_CASE: {
+ sqlite3TreeViewLine(pView, "CASE");
+ sqlite3TreeViewExpr(pView, pExpr->pLeft, 1);
+ assert( ExprUseXList(pExpr) );
+ sqlite3TreeViewExprList(pView, pExpr->x.pList, 0, 0);
+ break;
+ }
+#ifndef SQLITE_OMIT_TRIGGER
+ case TK_RAISE: {
+ const char *zType = "unk";
+ switch( pExpr->affExpr ){
+ case OE_Rollback: zType = "rollback"; break;
+ case OE_Abort: zType = "abort"; break;
+ case OE_Fail: zType = "fail"; break;
+ case OE_Ignore: zType = "ignore"; break;
+ }
+ assert( !ExprHasProperty(pExpr, EP_IntValue) );
+ sqlite3TreeViewLine(pView, "RAISE %s", zType);
+ sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);
+ break;
+ }
+#endif
+ case TK_MATCH: {
+ sqlite3TreeViewLine(pView, "MATCH {%d:%d}%s",
+ pExpr->iTable, pExpr->iColumn, zFlgs);
+ sqlite3TreeViewExpr(pView, pExpr->pRight, 0);
+ break;
+ }
+ case TK_VECTOR: {
+ char *z = sqlite3_mprintf("VECTOR%s",zFlgs);
+ assert( ExprUseXList(pExpr) );
+ sqlite3TreeViewBareExprList(pView, pExpr->x.pList, z);
+ sqlite3_free(z);
+ break;
+ }
+ case TK_SELECT_COLUMN: {
+ sqlite3TreeViewLine(pView, "SELECT-COLUMN %d of [0..%d]%s",
+ pExpr->iColumn, pExpr->iTable-1,
+ pExpr->pRight==pExpr->pLeft ? " (SELECT-owner)" : "");
+ assert( ExprUseXSelect(pExpr->pLeft) );
+ sqlite3TreeViewSelect(pView, pExpr->pLeft->x.pSelect, 0);
+ break;
+ }
+ case TK_IF_NULL_ROW: {
+ sqlite3TreeViewLine(pView, "IF-NULL-ROW %d", pExpr->iTable);
+ sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);
+ break;
+ }
+ case TK_ERROR: {
+ Expr tmp;
+ sqlite3TreeViewLine(pView, "ERROR");
+ tmp = *pExpr;
+ tmp.op = pExpr->op2;
+ sqlite3TreeViewExpr(pView, &tmp, 0);
+ break;
+ }
+ case TK_ROW: {
+ if( pExpr->iColumn<=0 ){
+ sqlite3TreeViewLine(pView, "First FROM table rowid");
+ }else{
+ sqlite3TreeViewLine(pView, "First FROM table column %d",
+ pExpr->iColumn-1);
+ }
+ break;
+ }
+ default: {
+ sqlite3TreeViewLine(pView, "op=%d", pExpr->op);
+ break;
+ }
+ }
+ if( zBinOp ){
+ sqlite3TreeViewLine(pView, "%s%s", zBinOp, zFlgs);
+ sqlite3TreeViewExpr(pView, pExpr->pLeft, 1);
+ sqlite3TreeViewExpr(pView, pExpr->pRight, 0);
+ }else if( zUniOp ){
+ sqlite3TreeViewLine(pView, "%s%s", zUniOp, zFlgs);
+ sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);
+ }
+ sqlite3TreeViewPop(&pView);
+}
+
+
+/*
+** Generate a human-readable explanation of an expression list.
+*/
+SQLITE_PRIVATE void sqlite3TreeViewBareExprList(
+ TreeView *pView,
+ const ExprList *pList,
+ const char *zLabel
+){
+ if( zLabel==0 || zLabel[0]==0 ) zLabel = "LIST";
+ if( pList==0 ){
+ sqlite3TreeViewLine(pView, "%s (empty)", zLabel);
+ }else{
+ int i;
+ sqlite3TreeViewLine(pView, "%s", zLabel);
+ for(i=0; i<pList->nExpr; i++){
+ int j = pList->a[i].u.x.iOrderByCol;
+ u8 sortFlags = pList->a[i].fg.sortFlags;
+ char *zName = pList->a[i].zEName;
+ int moreToFollow = i<pList->nExpr - 1;
+ if( j || zName || sortFlags ){
+ sqlite3TreeViewPush(&pView, moreToFollow);
+ moreToFollow = 0;
+ sqlite3TreeViewLine(pView, 0);
+ if( zName ){
+ switch( pList->a[i].fg.eEName ){
+ default:
+ fprintf(stdout, "AS %s ", zName);
+ break;
+ case ENAME_TAB:
+ fprintf(stdout, "TABLE-ALIAS-NAME(\"%s\") ", zName);
+ if( pList->a[i].fg.bUsed ) fprintf(stdout, "(used) ");
+ if( pList->a[i].fg.bUsingTerm ) fprintf(stdout, "(USING-term) ");
+ if( pList->a[i].fg.bNoExpand ) fprintf(stdout, "(NoExpand) ");
+ break;
+ case ENAME_SPAN:
+ fprintf(stdout, "SPAN(\"%s\") ", zName);
+ break;
+ }
+ }
+ if( j ){
+ fprintf(stdout, "iOrderByCol=%d ", j);
+ }
+ if( sortFlags & KEYINFO_ORDER_DESC ){
+ fprintf(stdout, "DESC ");
+ }else if( sortFlags & KEYINFO_ORDER_BIGNULL ){
+ fprintf(stdout, "NULLS-LAST");
+ }
+ fprintf(stdout, "\n");
+ fflush(stdout);
+ }
+ sqlite3TreeViewExpr(pView, pList->a[i].pExpr, moreToFollow);
+ if( j || zName || sortFlags ){
+ sqlite3TreeViewPop(&pView);
+ }
+ }
+ }
+}
+SQLITE_PRIVATE void sqlite3TreeViewExprList(
+ TreeView *pView,
+ const ExprList *pList,
+ u8 moreToFollow,
+ const char *zLabel
+){
+ sqlite3TreeViewPush(&pView, moreToFollow);
+ sqlite3TreeViewBareExprList(pView, pList, zLabel);
+ sqlite3TreeViewPop(&pView);
+}
+
+/*
+** Generate a human-readable explanation of an id-list.
+*/
+SQLITE_PRIVATE void sqlite3TreeViewBareIdList(
+ TreeView *pView,
+ const IdList *pList,
+ const char *zLabel
+){
+ if( zLabel==0 || zLabel[0]==0 ) zLabel = "LIST";
+ if( pList==0 ){
+ sqlite3TreeViewLine(pView, "%s (empty)", zLabel);
+ }else{
+ int i;
+ sqlite3TreeViewLine(pView, "%s", zLabel);
+ for(i=0; i<pList->nId; i++){
+ char *zName = pList->a[i].zName;
+ int moreToFollow = i<pList->nId - 1;
+ if( zName==0 ) zName = "(null)";
+ sqlite3TreeViewPush(&pView, moreToFollow);
+ sqlite3TreeViewLine(pView, 0);
+ fprintf(stdout, "%s\n", zName);
+ sqlite3TreeViewPop(&pView);
+ }
+ }
+}
+SQLITE_PRIVATE void sqlite3TreeViewIdList(
+ TreeView *pView,
+ const IdList *pList,
+ u8 moreToFollow,
+ const char *zLabel
+){
+ sqlite3TreeViewPush(&pView, moreToFollow);
+ sqlite3TreeViewBareIdList(pView, pList, zLabel);
+ sqlite3TreeViewPop(&pView);
+}
+
+/*
+** Generate a human-readable explanation of a list of Upsert objects
+*/
+SQLITE_PRIVATE void sqlite3TreeViewUpsert(
+ TreeView *pView,
+ const Upsert *pUpsert,
+ u8 moreToFollow
+){
+ if( pUpsert==0 ) return;
+ sqlite3TreeViewPush(&pView, moreToFollow);
+ while( pUpsert ){
+ int n;
+ sqlite3TreeViewPush(&pView, pUpsert->pNextUpsert!=0 || moreToFollow);
+ sqlite3TreeViewLine(pView, "ON CONFLICT DO %s",
+ pUpsert->isDoUpdate ? "UPDATE" : "NOTHING");
+ n = (pUpsert->pUpsertSet!=0) + (pUpsert->pUpsertWhere!=0);
+ sqlite3TreeViewExprList(pView, pUpsert->pUpsertTarget, (n--)>0, "TARGET");
+ sqlite3TreeViewExprList(pView, pUpsert->pUpsertSet, (n--)>0, "SET");
+ if( pUpsert->pUpsertWhere ){
+ sqlite3TreeViewItem(pView, "WHERE", (n--)>0);
+ sqlite3TreeViewExpr(pView, pUpsert->pUpsertWhere, 0);
+ sqlite3TreeViewPop(&pView);
+ }
+ sqlite3TreeViewPop(&pView);
+ pUpsert = pUpsert->pNextUpsert;
+ }
+ sqlite3TreeViewPop(&pView);
+}
+
+#if TREETRACE_ENABLED
+/*
+** Generate a human-readable diagram of the data structure that go
+** into generating an DELETE statement.
+*/
+SQLITE_PRIVATE void sqlite3TreeViewDelete(
+ const With *pWith,
+ const SrcList *pTabList,
+ const Expr *pWhere,
+ const ExprList *pOrderBy,
+ const Expr *pLimit,
+ const Trigger *pTrigger
+){
+ int n = 0;
+ TreeView *pView = 0;
+ sqlite3TreeViewPush(&pView, 0);
+ sqlite3TreeViewLine(pView, "DELETE");
+ if( pWith ) n++;
+ if( pTabList ) n++;
+ if( pWhere ) n++;
+ if( pOrderBy ) n++;
+ if( pLimit ) n++;
+ if( pTrigger ) n++;
+ if( pWith ){
+ sqlite3TreeViewPush(&pView, (--n)>0);
+ sqlite3TreeViewWith(pView, pWith, 0);
+ sqlite3TreeViewPop(&pView);
+ }
+ if( pTabList ){
+ sqlite3TreeViewPush(&pView, (--n)>0);
+ sqlite3TreeViewLine(pView, "FROM");
+ sqlite3TreeViewSrcList(pView, pTabList);
+ sqlite3TreeViewPop(&pView);
+ }
+ if( pWhere ){
+ sqlite3TreeViewPush(&pView, (--n)>0);
+ sqlite3TreeViewLine(pView, "WHERE");
+ sqlite3TreeViewExpr(pView, pWhere, 0);
+ sqlite3TreeViewPop(&pView);
+ }
+ if( pOrderBy ){
+ sqlite3TreeViewExprList(pView, pOrderBy, (--n)>0, "ORDER-BY");
+ }
+ if( pLimit ){
+ sqlite3TreeViewPush(&pView, (--n)>0);
+ sqlite3TreeViewLine(pView, "LIMIT");
+ sqlite3TreeViewExpr(pView, pLimit, 0);
+ sqlite3TreeViewPop(&pView);
+ }
+ if( pTrigger ){
+ sqlite3TreeViewTrigger(pView, pTrigger, (--n)>0, 1);
+ }
+ sqlite3TreeViewPop(&pView);
+}
+#endif /* TREETRACE_ENABLED */
+
+#if TREETRACE_ENABLED
+/*
+** Generate a human-readable diagram of the data structure that go
+** into generating an INSERT statement.
+*/
+SQLITE_PRIVATE void sqlite3TreeViewInsert(
+ const With *pWith,
+ const SrcList *pTabList,
+ const IdList *pColumnList,
+ const Select *pSelect,
+ const ExprList *pExprList,
+ int onError,
+ const Upsert *pUpsert,
+ const Trigger *pTrigger
+){
+ TreeView *pView = 0;
+ int n = 0;
+ const char *zLabel = "INSERT";
+ switch( onError ){
+ case OE_Replace: zLabel = "REPLACE"; break;
+ case OE_Ignore: zLabel = "INSERT OR IGNORE"; break;
+ case OE_Rollback: zLabel = "INSERT OR ROLLBACK"; break;
+ case OE_Abort: zLabel = "INSERT OR ABORT"; break;
+ case OE_Fail: zLabel = "INSERT OR FAIL"; break;
+ }
+ sqlite3TreeViewPush(&pView, 0);
+ sqlite3TreeViewLine(pView, zLabel);
+ if( pWith ) n++;
+ if( pTabList ) n++;
+ if( pColumnList ) n++;
+ if( pSelect ) n++;
+ if( pExprList ) n++;
+ if( pUpsert ) n++;
+ if( pTrigger ) n++;
+ if( pWith ){
+ sqlite3TreeViewPush(&pView, (--n)>0);
+ sqlite3TreeViewWith(pView, pWith, 0);
+ sqlite3TreeViewPop(&pView);
+ }
+ if( pTabList ){
+ sqlite3TreeViewPush(&pView, (--n)>0);
+ sqlite3TreeViewLine(pView, "INTO");
+ sqlite3TreeViewSrcList(pView, pTabList);
+ sqlite3TreeViewPop(&pView);
+ }
+ if( pColumnList ){
+ sqlite3TreeViewIdList(pView, pColumnList, (--n)>0, "COLUMNS");
+ }
+ if( pSelect ){
+ sqlite3TreeViewPush(&pView, (--n)>0);
+ sqlite3TreeViewLine(pView, "DATA-SOURCE");
+ sqlite3TreeViewSelect(pView, pSelect, 0);
+ sqlite3TreeViewPop(&pView);
+ }
+ if( pExprList ){
+ sqlite3TreeViewExprList(pView, pExprList, (--n)>0, "VALUES");
+ }
+ if( pUpsert ){
+ sqlite3TreeViewPush(&pView, (--n)>0);
+ sqlite3TreeViewLine(pView, "UPSERT");
+ sqlite3TreeViewUpsert(pView, pUpsert, 0);
+ sqlite3TreeViewPop(&pView);
+ }
+ if( pTrigger ){
+ sqlite3TreeViewTrigger(pView, pTrigger, (--n)>0, 1);
+ }
+ sqlite3TreeViewPop(&pView);
+}
+#endif /* TREETRACE_ENABLED */
+
+#if TREETRACE_ENABLED
+/*
+** Generate a human-readable diagram of the data structure that go
+** into generating an UPDATE statement.
+*/
+SQLITE_PRIVATE void sqlite3TreeViewUpdate(
+ const With *pWith,
+ const SrcList *pTabList,
+ const ExprList *pChanges,
+ const Expr *pWhere,
+ int onError,
+ const ExprList *pOrderBy,
+ const Expr *pLimit,
+ const Upsert *pUpsert,
+ const Trigger *pTrigger
+){
+ int n = 0;
+ TreeView *pView = 0;
+ const char *zLabel = "UPDATE";
+ switch( onError ){
+ case OE_Replace: zLabel = "UPDATE OR REPLACE"; break;
+ case OE_Ignore: zLabel = "UPDATE OR IGNORE"; break;
+ case OE_Rollback: zLabel = "UPDATE OR ROLLBACK"; break;
+ case OE_Abort: zLabel = "UPDATE OR ABORT"; break;
+ case OE_Fail: zLabel = "UPDATE OR FAIL"; break;
+ }
+ sqlite3TreeViewPush(&pView, 0);
+ sqlite3TreeViewLine(pView, zLabel);
+ if( pWith ) n++;
+ if( pTabList ) n++;
+ if( pChanges ) n++;
+ if( pWhere ) n++;
+ if( pOrderBy ) n++;
+ if( pLimit ) n++;
+ if( pUpsert ) n++;
+ if( pTrigger ) n++;
+ if( pWith ){
+ sqlite3TreeViewPush(&pView, (--n)>0);
+ sqlite3TreeViewWith(pView, pWith, 0);
+ sqlite3TreeViewPop(&pView);
+ }
+ if( pTabList ){
+ sqlite3TreeViewPush(&pView, (--n)>0);
+ sqlite3TreeViewLine(pView, "FROM");
+ sqlite3TreeViewSrcList(pView, pTabList);
+ sqlite3TreeViewPop(&pView);
+ }
+ if( pChanges ){
+ sqlite3TreeViewExprList(pView, pChanges, (--n)>0, "SET");
+ }
+ if( pWhere ){
+ sqlite3TreeViewPush(&pView, (--n)>0);
+ sqlite3TreeViewLine(pView, "WHERE");
+ sqlite3TreeViewExpr(pView, pWhere, 0);
+ sqlite3TreeViewPop(&pView);
+ }
+ if( pOrderBy ){
+ sqlite3TreeViewExprList(pView, pOrderBy, (--n)>0, "ORDER-BY");
+ }
+ if( pLimit ){
+ sqlite3TreeViewPush(&pView, (--n)>0);
+ sqlite3TreeViewLine(pView, "LIMIT");
+ sqlite3TreeViewExpr(pView, pLimit, 0);
+ sqlite3TreeViewPop(&pView);
+ }
+ if( pUpsert ){
+ sqlite3TreeViewPush(&pView, (--n)>0);
+ sqlite3TreeViewLine(pView, "UPSERT");
+ sqlite3TreeViewUpsert(pView, pUpsert, 0);
+ sqlite3TreeViewPop(&pView);
+ }
+ if( pTrigger ){
+ sqlite3TreeViewTrigger(pView, pTrigger, (--n)>0, 1);
+ }
+ sqlite3TreeViewPop(&pView);
+}
+#endif /* TREETRACE_ENABLED */
+
+#ifndef SQLITE_OMIT_TRIGGER
+/*
+** Show a human-readable graph of a TriggerStep
+*/
+SQLITE_PRIVATE void sqlite3TreeViewTriggerStep(
+ TreeView *pView,
+ const TriggerStep *pStep,
+ u8 moreToFollow,
+ u8 showFullList
+){
+ int cnt = 0;
+ if( pStep==0 ) return;
+ sqlite3TreeViewPush(&pView,
+ moreToFollow || (showFullList && pStep->pNext!=0));
+ do{
+ if( cnt++ && pStep->pNext==0 ){
+ sqlite3TreeViewPop(&pView);
+ sqlite3TreeViewPush(&pView, 0);
+ }
+ sqlite3TreeViewLine(pView, "%s", pStep->zSpan ? pStep->zSpan : "RETURNING");
+ }while( showFullList && (pStep = pStep->pNext)!=0 );
+ sqlite3TreeViewPop(&pView);
+}
+
+/*
+** Show a human-readable graph of a Trigger
+*/
+SQLITE_PRIVATE void sqlite3TreeViewTrigger(
+ TreeView *pView,
+ const Trigger *pTrigger,
+ u8 moreToFollow,
+ u8 showFullList
+){
+ int cnt = 0;
+ if( pTrigger==0 ) return;
+ sqlite3TreeViewPush(&pView,
+ moreToFollow || (showFullList && pTrigger->pNext!=0));
+ do{
+ if( cnt++ && pTrigger->pNext==0 ){
+ sqlite3TreeViewPop(&pView);
+ sqlite3TreeViewPush(&pView, 0);
+ }
+ sqlite3TreeViewLine(pView, "TRIGGER %s", pTrigger->zName);
+ sqlite3TreeViewPush(&pView, 0);
+ sqlite3TreeViewTriggerStep(pView, pTrigger->step_list, 0, 1);
+ sqlite3TreeViewPop(&pView);
+ }while( showFullList && (pTrigger = pTrigger->pNext)!=0 );
+ sqlite3TreeViewPop(&pView);
+}
+#endif /* SQLITE_OMIT_TRIGGER */
+
+
+/*
+** These simplified versions of the tree-view routines omit unnecessary
+** parameters. These variants are intended to be used from a symbolic
+** debugger, such as "gdb", during interactive debugging sessions.
+**
+** This routines are given external linkage so that they will always be
+** accessible to the debugging, and to avoid warnings about unused
+** functions. But these routines only exist in debugging builds, so they
+** do not contaminate the interface.
+**
+** See Also:
+**
+** sqlite3ShowWhereTerm() in where.c
+*/
+SQLITE_PRIVATE void sqlite3ShowExpr(const Expr *p){ sqlite3TreeViewExpr(0,p,0); }
+SQLITE_PRIVATE void sqlite3ShowExprList(const ExprList *p){ sqlite3TreeViewExprList(0,p,0,0);}
+SQLITE_PRIVATE void sqlite3ShowIdList(const IdList *p){ sqlite3TreeViewIdList(0,p,0,0); }
+SQLITE_PRIVATE void sqlite3ShowSrcList(const SrcList *p){ sqlite3TreeViewSrcList(0,p); }
+SQLITE_PRIVATE void sqlite3ShowSelect(const Select *p){ sqlite3TreeViewSelect(0,p,0); }
+SQLITE_PRIVATE void sqlite3ShowWith(const With *p){ sqlite3TreeViewWith(0,p,0); }
+SQLITE_PRIVATE void sqlite3ShowUpsert(const Upsert *p){ sqlite3TreeViewUpsert(0,p,0); }
+#ifndef SQLITE_OMIT_TRIGGER
+SQLITE_PRIVATE void sqlite3ShowTriggerStep(const TriggerStep *p){
+ sqlite3TreeViewTriggerStep(0,p,0,0);
+}
+SQLITE_PRIVATE void sqlite3ShowTriggerStepList(const TriggerStep *p){
+ sqlite3TreeViewTriggerStep(0,p,0,1);
+}
+SQLITE_PRIVATE void sqlite3ShowTrigger(const Trigger *p){ sqlite3TreeViewTrigger(0,p,0,0); }
+SQLITE_PRIVATE void sqlite3ShowTriggerList(const Trigger *p){ sqlite3TreeViewTrigger(0,p,0,1);}
+#endif
+#ifndef SQLITE_OMIT_WINDOWFUNC
+SQLITE_PRIVATE void sqlite3ShowWindow(const Window *p){ sqlite3TreeViewWindow(0,p,0); }
+SQLITE_PRIVATE void sqlite3ShowWinFunc(const Window *p){ sqlite3TreeViewWinFunc(0,p,0); }
+#endif
+
+#endif /* SQLITE_DEBUG */
+
+/************** End of treeview.c ********************************************/
+/************** Begin file random.c ******************************************/
+/*
+** 2001 September 15
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This file contains code to implement a pseudo-random number
+** generator (PRNG) for SQLite.
+**
+** Random numbers are used by some of the database backends in order
+** to generate random integer keys for tables or random filenames.
+*/
+/* #include "sqliteInt.h" */
+
+
+/* All threads share a single random number generator.
+** This structure is the current state of the generator.
+*/
+static SQLITE_WSD struct sqlite3PrngType {
+ u32 s[16]; /* 64 bytes of chacha20 state */
+ u8 out[64]; /* Output bytes */
+ u8 n; /* Output bytes remaining */
+} sqlite3Prng;
+
+
+/* The RFC-7539 ChaCha20 block function
+*/
+#define ROTL(a,b) (((a) << (b)) | ((a) >> (32 - (b))))
+#define QR(a, b, c, d) ( \
+ a += b, d ^= a, d = ROTL(d,16), \
+ c += d, b ^= c, b = ROTL(b,12), \
+ a += b, d ^= a, d = ROTL(d, 8), \
+ c += d, b ^= c, b = ROTL(b, 7))
+static void chacha_block(u32 *out, const u32 *in){
+ int i;
+ u32 x[16];
+ memcpy(x, in, 64);
+ for(i=0; i<10; i++){
+ QR(x[0], x[4], x[ 8], x[12]);
+ QR(x[1], x[5], x[ 9], x[13]);
+ QR(x[2], x[6], x[10], x[14]);
+ QR(x[3], x[7], x[11], x[15]);
+ QR(x[0], x[5], x[10], x[15]);
+ QR(x[1], x[6], x[11], x[12]);
+ QR(x[2], x[7], x[ 8], x[13]);
+ QR(x[3], x[4], x[ 9], x[14]);
+ }
+ for(i=0; i<16; i++) out[i] = x[i]+in[i];
+}
+
+/*
+** Return N random bytes.
+*/
+SQLITE_API void sqlite3_randomness(int N, void *pBuf){
+ unsigned char *zBuf = pBuf;
+
+ /* The "wsdPrng" macro will resolve to the pseudo-random number generator
+ ** state vector. If writable static data is unsupported on the target,
+ ** we have to locate the state vector at run-time. In the more common
+ ** case where writable static data is supported, wsdPrng can refer directly
+ ** to the "sqlite3Prng" state vector declared above.
+ */
+#ifdef SQLITE_OMIT_WSD
+ struct sqlite3PrngType *p = &GLOBAL(struct sqlite3PrngType, sqlite3Prng);
+# define wsdPrng p[0]
+#else
+# define wsdPrng sqlite3Prng
+#endif
+
+#if SQLITE_THREADSAFE
+ sqlite3_mutex *mutex;
+#endif
+
+#ifndef SQLITE_OMIT_AUTOINIT
+ if( sqlite3_initialize() ) return;
+#endif
+
+#if SQLITE_THREADSAFE
+ mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_PRNG);
+#endif
+
+ sqlite3_mutex_enter(mutex);
+ if( N<=0 || pBuf==0 ){
+ wsdPrng.s[0] = 0;
+ sqlite3_mutex_leave(mutex);
+ return;
+ }
+
+ /* Initialize the state of the random number generator once,
+ ** the first time this routine is called.
+ */
+ if( wsdPrng.s[0]==0 ){
+ sqlite3_vfs *pVfs = sqlite3_vfs_find(0);
+ static const u32 chacha20_init[] = {
+ 0x61707865, 0x3320646e, 0x79622d32, 0x6b206574
+ };
+ memcpy(&wsdPrng.s[0], chacha20_init, 16);
+ if( NEVER(pVfs==0) ){
+ memset(&wsdPrng.s[4], 0, 44);
+ }else{
+ sqlite3OsRandomness(pVfs, 44, (char*)&wsdPrng.s[4]);
+ }
+ wsdPrng.s[15] = wsdPrng.s[12];
+ wsdPrng.s[12] = 0;
+ wsdPrng.n = 0;
+ }
+
+ assert( N>0 );
+ while( 1 /* exit by break */ ){
+ if( N<=wsdPrng.n ){
+ memcpy(zBuf, &wsdPrng.out[wsdPrng.n-N], N);
+ wsdPrng.n -= N;
+ break;
+ }
+ if( wsdPrng.n>0 ){
+ memcpy(zBuf, wsdPrng.out, wsdPrng.n);
+ N -= wsdPrng.n;
+ zBuf += wsdPrng.n;
+ }
+ wsdPrng.s[12]++;
+ chacha_block((u32*)wsdPrng.out, wsdPrng.s);
+ wsdPrng.n = 64;
+ }
+ sqlite3_mutex_leave(mutex);
+}
+
+#ifndef SQLITE_UNTESTABLE
+/*
+** For testing purposes, we sometimes want to preserve the state of
+** PRNG and restore the PRNG to its saved state at a later time, or
+** to reset the PRNG to its initial state. These routines accomplish
+** those tasks.
+**
+** The sqlite3_test_control() interface calls these routines to
+** control the PRNG.
+*/
+static SQLITE_WSD struct sqlite3PrngType sqlite3SavedPrng;
+SQLITE_PRIVATE void sqlite3PrngSaveState(void){
+ memcpy(
+ &GLOBAL(struct sqlite3PrngType, sqlite3SavedPrng),
+ &GLOBAL(struct sqlite3PrngType, sqlite3Prng),
+ sizeof(sqlite3Prng)
+ );
+}
+SQLITE_PRIVATE void sqlite3PrngRestoreState(void){
+ memcpy(
+ &GLOBAL(struct sqlite3PrngType, sqlite3Prng),
+ &GLOBAL(struct sqlite3PrngType, sqlite3SavedPrng),
+ sizeof(sqlite3Prng)
+ );
+}
+#endif /* SQLITE_UNTESTABLE */
+
+/************** End of random.c **********************************************/
+/************** Begin file threads.c *****************************************/
+/*
+** 2012 July 21
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+******************************************************************************
+**
+** This file presents a simple cross-platform threading interface for
+** use internally by SQLite.
+**
+** A "thread" can be created using sqlite3ThreadCreate(). This thread
+** runs independently of its creator until it is joined using
+** sqlite3ThreadJoin(), at which point it terminates.
+**
+** Threads do not have to be real. It could be that the work of the
+** "thread" is done by the main thread at either the sqlite3ThreadCreate()
+** or sqlite3ThreadJoin() call. This is, in fact, what happens in
+** single threaded systems. Nothing in SQLite requires multiple threads.
+** This interface exists so that applications that want to take advantage
+** of multiple cores can do so, while also allowing applications to stay
+** single-threaded if desired.
+*/
+/* #include "sqliteInt.h" */
+#if SQLITE_OS_WIN
+/* # include "os_win.h" */
+#endif
+
+#if SQLITE_MAX_WORKER_THREADS>0
+
+/********************************* Unix Pthreads ****************************/
+#if SQLITE_OS_UNIX && defined(SQLITE_MUTEX_PTHREADS) && SQLITE_THREADSAFE>0
+
+#define SQLITE_THREADS_IMPLEMENTED 1 /* Prevent the single-thread code below */
+/* #include <pthread.h> */
+
+/* A running thread */
+struct SQLiteThread {
+ pthread_t tid; /* Thread ID */
+ int done; /* Set to true when thread finishes */
+ void *pOut; /* Result returned by the thread */
+ void *(*xTask)(void*); /* The thread routine */
+ void *pIn; /* Argument to the thread */
+};
+
+/* Create a new thread */
+SQLITE_PRIVATE int sqlite3ThreadCreate(
+ SQLiteThread **ppThread, /* OUT: Write the thread object here */
+ void *(*xTask)(void*), /* Routine to run in a separate thread */
+ void *pIn /* Argument passed into xTask() */
+){
+ SQLiteThread *p;
+ int rc;
+
+ assert( ppThread!=0 );
+ assert( xTask!=0 );
+ /* This routine is never used in single-threaded mode */
+ assert( sqlite3GlobalConfig.bCoreMutex!=0 );
+
+ *ppThread = 0;
+ p = sqlite3Malloc(sizeof(*p));
+ if( p==0 ) return SQLITE_NOMEM_BKPT;
+ memset(p, 0, sizeof(*p));
+ p->xTask = xTask;
+ p->pIn = pIn;
+ /* If the SQLITE_TESTCTRL_FAULT_INSTALL callback is registered to a
+ ** function that returns SQLITE_ERROR when passed the argument 200, that
+ ** forces worker threads to run sequentially and deterministically
+ ** for testing purposes. */
+ if( sqlite3FaultSim(200) ){
+ rc = 1;
+ }else{
+ rc = pthread_create(&p->tid, 0, xTask, pIn);
+ }
+ if( rc ){
+ p->done = 1;
+ p->pOut = xTask(pIn);
+ }
+ *ppThread = p;
+ return SQLITE_OK;
+}
+
+/* Get the results of the thread */
+SQLITE_PRIVATE int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){
+ int rc;
+
+ assert( ppOut!=0 );
+ if( NEVER(p==0) ) return SQLITE_NOMEM_BKPT;
+ if( p->done ){
+ *ppOut = p->pOut;
+ rc = SQLITE_OK;
+ }else{
+ rc = pthread_join(p->tid, ppOut) ? SQLITE_ERROR : SQLITE_OK;
+ }
+ sqlite3_free(p);
+ return rc;
+}
+
+#endif /* SQLITE_OS_UNIX && defined(SQLITE_MUTEX_PTHREADS) */
+/******************************** End Unix Pthreads *************************/
+
+
+/********************************* Win32 Threads ****************************/
+#if SQLITE_OS_WIN_THREADS
+
+#define SQLITE_THREADS_IMPLEMENTED 1 /* Prevent the single-thread code below */
+#include <process.h>
+
+/* A running thread */
+struct SQLiteThread {
+ void *tid; /* The thread handle */
+ unsigned id; /* The thread identifier */
+ void *(*xTask)(void*); /* The routine to run as a thread */
+ void *pIn; /* Argument to xTask */
+ void *pResult; /* Result of xTask */
+};
+
+/* Thread procedure Win32 compatibility shim */
+static unsigned __stdcall sqlite3ThreadProc(
+ void *pArg /* IN: Pointer to the SQLiteThread structure */
+){
+ SQLiteThread *p = (SQLiteThread *)pArg;
+
+ assert( p!=0 );
+#if 0
+ /*
+ ** This assert appears to trigger spuriously on certain
+ ** versions of Windows, possibly due to _beginthreadex()
+ ** and/or CreateThread() not fully setting their thread
+ ** ID parameter before starting the thread.
+ */
+ assert( p->id==GetCurrentThreadId() );
+#endif
+ assert( p->xTask!=0 );
+ p->pResult = p->xTask(p->pIn);
+
+ _endthreadex(0);
+ return 0; /* NOT REACHED */
+}
+
+/* Create a new thread */
+SQLITE_PRIVATE int sqlite3ThreadCreate(
+ SQLiteThread **ppThread, /* OUT: Write the thread object here */
+ void *(*xTask)(void*), /* Routine to run in a separate thread */
+ void *pIn /* Argument passed into xTask() */
+){
+ SQLiteThread *p;
+
+ assert( ppThread!=0 );
+ assert( xTask!=0 );
+ *ppThread = 0;
+ p = sqlite3Malloc(sizeof(*p));
+ if( p==0 ) return SQLITE_NOMEM_BKPT;
+ /* If the SQLITE_TESTCTRL_FAULT_INSTALL callback is registered to a
+ ** function that returns SQLITE_ERROR when passed the argument 200, that
+ ** forces worker threads to run sequentially and deterministically
+ ** (via the sqlite3FaultSim() term of the conditional) for testing
+ ** purposes. */
+ if( sqlite3GlobalConfig.bCoreMutex==0 || sqlite3FaultSim(200) ){
+ memset(p, 0, sizeof(*p));
+ }else{
+ p->xTask = xTask;
+ p->pIn = pIn;
+ p->tid = (void*)_beginthreadex(0, 0, sqlite3ThreadProc, p, 0, &p->id);
+ if( p->tid==0 ){
+ memset(p, 0, sizeof(*p));
+ }
+ }
+ if( p->xTask==0 ){
+ p->id = GetCurrentThreadId();
+ p->pResult = xTask(pIn);
+ }
+ *ppThread = p;
+ return SQLITE_OK;
+}
+
+SQLITE_PRIVATE DWORD sqlite3Win32Wait(HANDLE hObject); /* os_win.c */
+
+/* Get the results of the thread */
+SQLITE_PRIVATE int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){
+ DWORD rc;
+ BOOL bRc;
+
+ assert( ppOut!=0 );
+ if( NEVER(p==0) ) return SQLITE_NOMEM_BKPT;
+ if( p->xTask==0 ){
+ /* assert( p->id==GetCurrentThreadId() ); */
+ rc = WAIT_OBJECT_0;
+ assert( p->tid==0 );
+ }else{
+ assert( p->id!=0 && p->id!=GetCurrentThreadId() );
+ rc = sqlite3Win32Wait((HANDLE)p->tid);
+ assert( rc!=WAIT_IO_COMPLETION );
+ bRc = CloseHandle((HANDLE)p->tid);
+ assert( bRc );
+ }
+ if( rc==WAIT_OBJECT_0 ) *ppOut = p->pResult;
+ sqlite3_free(p);
+ return (rc==WAIT_OBJECT_0) ? SQLITE_OK : SQLITE_ERROR;
+}
+
+#endif /* SQLITE_OS_WIN_THREADS */
+/******************************** End Win32 Threads *************************/
+
+
+/********************************* Single-Threaded **************************/
+#ifndef SQLITE_THREADS_IMPLEMENTED
+/*
+** This implementation does not actually create a new thread. It does the
+** work of the thread in the main thread, when either the thread is created
+** or when it is joined
+*/
+
+/* A running thread */
+struct SQLiteThread {
+ void *(*xTask)(void*); /* The routine to run as a thread */
+ void *pIn; /* Argument to xTask */
+ void *pResult; /* Result of xTask */
+};
+
+/* Create a new thread */
+SQLITE_PRIVATE int sqlite3ThreadCreate(
+ SQLiteThread **ppThread, /* OUT: Write the thread object here */
+ void *(*xTask)(void*), /* Routine to run in a separate thread */
+ void *pIn /* Argument passed into xTask() */
+){
+ SQLiteThread *p;
+
+ assert( ppThread!=0 );
+ assert( xTask!=0 );
+ *ppThread = 0;
+ p = sqlite3Malloc(sizeof(*p));
+ if( p==0 ) return SQLITE_NOMEM_BKPT;
+ if( (SQLITE_PTR_TO_INT(p)/17)&1 ){
+ p->xTask = xTask;
+ p->pIn = pIn;
+ }else{
+ p->xTask = 0;
+ p->pResult = xTask(pIn);
+ }
+ *ppThread = p;
+ return SQLITE_OK;
+}
+
+/* Get the results of the thread */
+SQLITE_PRIVATE int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){
+
+ assert( ppOut!=0 );
+ if( NEVER(p==0) ) return SQLITE_NOMEM_BKPT;
+ if( p->xTask ){
+ *ppOut = p->xTask(p->pIn);
+ }else{
+ *ppOut = p->pResult;
+ }
+ sqlite3_free(p);
+
+#if defined(SQLITE_TEST)
+ {
+ void *pTstAlloc = sqlite3Malloc(10);
+ if (!pTstAlloc) return SQLITE_NOMEM_BKPT;
+ sqlite3_free(pTstAlloc);
+ }
+#endif
+
+ return SQLITE_OK;
+}
+
+#endif /* !defined(SQLITE_THREADS_IMPLEMENTED) */
+/****************************** End Single-Threaded *************************/
+#endif /* SQLITE_MAX_WORKER_THREADS>0 */
+
+/************** End of threads.c *********************************************/
+/************** Begin file utf.c *********************************************/
+/*
+** 2004 April 13
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This file contains routines used to translate between UTF-8,
+** UTF-16, UTF-16BE, and UTF-16LE.
+**
+** Notes on UTF-8:
+**
+** Byte-0 Byte-1 Byte-2 Byte-3 Value
+** 0xxxxxxx 00000000 00000000 0xxxxxxx
+** 110yyyyy 10xxxxxx 00000000 00000yyy yyxxxxxx
+** 1110zzzz 10yyyyyy 10xxxxxx 00000000 zzzzyyyy yyxxxxxx
+** 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx 000uuuuu zzzzyyyy yyxxxxxx
+**
+**
+** Notes on UTF-16: (with wwww+1==uuuuu)
+**
+** Word-0 Word-1 Value
+** 110110ww wwzzzzyy 110111yy yyxxxxxx 000uuuuu zzzzyyyy yyxxxxxx
+** zzzzyyyy yyxxxxxx 00000000 zzzzyyyy yyxxxxxx
+**
+**
+** BOM or Byte Order Mark:
+** 0xff 0xfe little-endian utf-16 follows
+** 0xfe 0xff big-endian utf-16 follows
+**
+*/
+/* #include "sqliteInt.h" */
+/* #include <assert.h> */
+/* #include "vdbeInt.h" */
+
+#if !defined(SQLITE_AMALGAMATION) && SQLITE_BYTEORDER==0
+/*
+** The following constant value is used by the SQLITE_BIGENDIAN and
+** SQLITE_LITTLEENDIAN macros.
+*/
+SQLITE_PRIVATE const int sqlite3one = 1;
+#endif /* SQLITE_AMALGAMATION && SQLITE_BYTEORDER==0 */
+
+/*
+** This lookup table is used to help decode the first byte of
+** a multi-byte UTF8 character.
+*/
+static const unsigned char sqlite3Utf8Trans1[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x00, 0x01, 0x02, 0x03, 0x00, 0x01, 0x00, 0x00,
+};
+
+
+#define WRITE_UTF8(zOut, c) { \
+ if( c<0x00080 ){ \
+ *zOut++ = (u8)(c&0xFF); \
+ } \
+ else if( c<0x00800 ){ \
+ *zOut++ = 0xC0 + (u8)((c>>6)&0x1F); \
+ *zOut++ = 0x80 + (u8)(c & 0x3F); \
+ } \
+ else if( c<0x10000 ){ \
+ *zOut++ = 0xE0 + (u8)((c>>12)&0x0F); \
+ *zOut++ = 0x80 + (u8)((c>>6) & 0x3F); \
+ *zOut++ = 0x80 + (u8)(c & 0x3F); \
+ }else{ \
+ *zOut++ = 0xF0 + (u8)((c>>18) & 0x07); \
+ *zOut++ = 0x80 + (u8)((c>>12) & 0x3F); \
+ *zOut++ = 0x80 + (u8)((c>>6) & 0x3F); \
+ *zOut++ = 0x80 + (u8)(c & 0x3F); \
+ } \
+}
+
+#define WRITE_UTF16LE(zOut, c) { \
+ if( c<=0xFFFF ){ \
+ *zOut++ = (u8)(c&0x00FF); \
+ *zOut++ = (u8)((c>>8)&0x00FF); \
+ }else{ \
+ *zOut++ = (u8)(((c>>10)&0x003F) + (((c-0x10000)>>10)&0x00C0)); \
+ *zOut++ = (u8)(0x00D8 + (((c-0x10000)>>18)&0x03)); \
+ *zOut++ = (u8)(c&0x00FF); \
+ *zOut++ = (u8)(0x00DC + ((c>>8)&0x03)); \
+ } \
+}
+
+#define WRITE_UTF16BE(zOut, c) { \
+ if( c<=0xFFFF ){ \
+ *zOut++ = (u8)((c>>8)&0x00FF); \
+ *zOut++ = (u8)(c&0x00FF); \
+ }else{ \
+ *zOut++ = (u8)(0x00D8 + (((c-0x10000)>>18)&0x03)); \
+ *zOut++ = (u8)(((c>>10)&0x003F) + (((c-0x10000)>>10)&0x00C0)); \
+ *zOut++ = (u8)(0x00DC + ((c>>8)&0x03)); \
+ *zOut++ = (u8)(c&0x00FF); \
+ } \
+}
+
+/*
+** Translate a single UTF-8 character. Return the unicode value.
+**
+** During translation, assume that the byte that zTerm points
+** is a 0x00.
+**
+** Write a pointer to the next unread byte back into *pzNext.
+**
+** Notes On Invalid UTF-8:
+**
+** * This routine never allows a 7-bit character (0x00 through 0x7f) to
+** be encoded as a multi-byte character. Any multi-byte character that
+** attempts to encode a value between 0x00 and 0x7f is rendered as 0xfffd.
+**
+** * This routine never allows a UTF16 surrogate value to be encoded.
+** If a multi-byte character attempts to encode a value between
+** 0xd800 and 0xe000 then it is rendered as 0xfffd.
+**
+** * Bytes in the range of 0x80 through 0xbf which occur as the first
+** byte of a character are interpreted as single-byte characters
+** and rendered as themselves even though they are technically
+** invalid characters.
+**
+** * This routine accepts over-length UTF8 encodings
+** for unicode values 0x80 and greater. It does not change over-length
+** encodings to 0xfffd as some systems recommend.
+*/
+#define READ_UTF8(zIn, zTerm, c) \
+ c = *(zIn++); \
+ if( c>=0xc0 ){ \
+ c = sqlite3Utf8Trans1[c-0xc0]; \
+ while( zIn<zTerm && (*zIn & 0xc0)==0x80 ){ \
+ c = (c<<6) + (0x3f & *(zIn++)); \
+ } \
+ if( c<0x80 \
+ || (c&0xFFFFF800)==0xD800 \
+ || (c&0xFFFFFFFE)==0xFFFE ){ c = 0xFFFD; } \
+ }
+SQLITE_PRIVATE u32 sqlite3Utf8Read(
+ const unsigned char **pz /* Pointer to string from which to read char */
+){
+ unsigned int c;
+
+ /* Same as READ_UTF8() above but without the zTerm parameter.
+ ** For this routine, we assume the UTF8 string is always zero-terminated.
+ */
+ c = *((*pz)++);
+ if( c>=0xc0 ){
+ c = sqlite3Utf8Trans1[c-0xc0];
+ while( (*(*pz) & 0xc0)==0x80 ){
+ c = (c<<6) + (0x3f & *((*pz)++));
+ }
+ if( c<0x80
+ || (c&0xFFFFF800)==0xD800
+ || (c&0xFFFFFFFE)==0xFFFE ){ c = 0xFFFD; }
+ }
+ return c;
+}
+
+/*
+** Read a single UTF8 character out of buffer z[], but reading no
+** more than n characters from the buffer. z[] is not zero-terminated.
+**
+** Return the number of bytes used to construct the character.
+**
+** Invalid UTF8 might generate a strange result. No effort is made
+** to detect invalid UTF8.
+**
+** At most 4 bytes will be read out of z[]. The return value will always
+** be between 1 and 4.
+*/
+SQLITE_PRIVATE int sqlite3Utf8ReadLimited(
+ const u8 *z,
+ int n,
+ u32 *piOut
+){
+ u32 c;
+ int i = 1;
+ assert( n>0 );
+ c = z[0];
+ if( c>=0xc0 ){
+ c = sqlite3Utf8Trans1[c-0xc0];
+ if( n>4 ) n = 4;
+ while( i<n && (z[i] & 0xc0)==0x80 ){
+ c = (c<<6) + (0x3f & z[i]);
+ i++;
+ }
+ }
+ *piOut = c;
+ return i;
+}
+
+
+/*
+** If the TRANSLATE_TRACE macro is defined, the value of each Mem is
+** printed on stderr on the way into and out of sqlite3VdbeMemTranslate().
+*/
+/* #define TRANSLATE_TRACE 1 */
+
+#ifndef SQLITE_OMIT_UTF16
+/*
+** This routine transforms the internal text encoding used by pMem to
+** desiredEnc. It is an error if the string is already of the desired
+** encoding, or if *pMem does not contain a string value.
+*/
+SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3VdbeMemTranslate(Mem *pMem, u8 desiredEnc){
+ sqlite3_int64 len; /* Maximum length of output string in bytes */
+ unsigned char *zOut; /* Output buffer */
+ unsigned char *zIn; /* Input iterator */
+ unsigned char *zTerm; /* End of input */
+ unsigned char *z; /* Output iterator */
+ unsigned int c;
+
+ assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
+ assert( pMem->flags&MEM_Str );
+ assert( pMem->enc!=desiredEnc );
+ assert( pMem->enc!=0 );
+ assert( pMem->n>=0 );
+
+#if defined(TRANSLATE_TRACE) && defined(SQLITE_DEBUG)
+ {
+ StrAccum acc;
+ char zBuf[1000];
+ sqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0);
+ sqlite3VdbeMemPrettyPrint(pMem, &acc);
+ fprintf(stderr, "INPUT: %s\n", sqlite3StrAccumFinish(&acc));
+ }
+#endif
+
+ /* If the translation is between UTF-16 little and big endian, then
+ ** all that is required is to swap the byte order. This case is handled
+ ** differently from the others.
+ */
+ if( pMem->enc!=SQLITE_UTF8 && desiredEnc!=SQLITE_UTF8 ){
+ u8 temp;
+ int rc;
+ rc = sqlite3VdbeMemMakeWriteable(pMem);
+ if( rc!=SQLITE_OK ){
+ assert( rc==SQLITE_NOMEM );
+ return SQLITE_NOMEM_BKPT;
+ }
+ zIn = (u8*)pMem->z;
+ zTerm = &zIn[pMem->n&~1];
+ while( zIn<zTerm ){
+ temp = *zIn;
+ *zIn = *(zIn+1);
+ zIn++;
+ *zIn++ = temp;
+ }
+ pMem->enc = desiredEnc;
+ goto translate_out;
+ }
+
+ /* Set len to the maximum number of bytes required in the output buffer. */
+ if( desiredEnc==SQLITE_UTF8 ){
+ /* When converting from UTF-16, the maximum growth results from
+ ** translating a 2-byte character to a 4-byte UTF-8 character.
+ ** A single byte is required for the output string
+ ** nul-terminator.
+ */
+ pMem->n &= ~1;
+ len = 2 * (sqlite3_int64)pMem->n + 1;
+ }else{
+ /* When converting from UTF-8 to UTF-16 the maximum growth is caused
+ ** when a 1-byte UTF-8 character is translated into a 2-byte UTF-16
+ ** character. Two bytes are required in the output buffer for the
+ ** nul-terminator.
+ */
+ len = 2 * (sqlite3_int64)pMem->n + 2;
+ }
+
+ /* Set zIn to point at the start of the input buffer and zTerm to point 1
+ ** byte past the end.
+ **
+ ** Variable zOut is set to point at the output buffer, space obtained
+ ** from sqlite3_malloc().
+ */
+ zIn = (u8*)pMem->z;
+ zTerm = &zIn[pMem->n];
+ zOut = sqlite3DbMallocRaw(pMem->db, len);
+ if( !zOut ){
+ return SQLITE_NOMEM_BKPT;
+ }
+ z = zOut;
+
+ if( pMem->enc==SQLITE_UTF8 ){
+ if( desiredEnc==SQLITE_UTF16LE ){
+ /* UTF-8 -> UTF-16 Little-endian */
+ while( zIn<zTerm ){
+ READ_UTF8(zIn, zTerm, c);
+ WRITE_UTF16LE(z, c);
+ }
+ }else{
+ assert( desiredEnc==SQLITE_UTF16BE );
+ /* UTF-8 -> UTF-16 Big-endian */
+ while( zIn<zTerm ){
+ READ_UTF8(zIn, zTerm, c);
+ WRITE_UTF16BE(z, c);
+ }
+ }
+ pMem->n = (int)(z - zOut);
+ *z++ = 0;
+ }else{
+ assert( desiredEnc==SQLITE_UTF8 );
+ if( pMem->enc==SQLITE_UTF16LE ){
+ /* UTF-16 Little-endian -> UTF-8 */
+ while( zIn<zTerm ){
+ c = *(zIn++);
+ c += (*(zIn++))<<8;
+ if( c>=0xd800 && c<0xe000 ){
+#ifdef SQLITE_REPLACE_INVALID_UTF
+ if( c>=0xdc00 || zIn>=zTerm ){
+ c = 0xfffd;
+ }else{
+ int c2 = *(zIn++);
+ c2 += (*(zIn++))<<8;
+ if( c2<0xdc00 || c2>=0xe000 ){
+ zIn -= 2;
+ c = 0xfffd;
+ }else{
+ c = ((c&0x3ff)<<10) + (c2&0x3ff) + 0x10000;
+ }
+ }
+#else
+ if( zIn<zTerm ){
+ int c2 = (*zIn++);
+ c2 += ((*zIn++)<<8);
+ c = (c2&0x03FF) + ((c&0x003F)<<10) + (((c&0x03C0)+0x0040)<<10);
+ }
+#endif
+ }
+ WRITE_UTF8(z, c);
+ }
+ }else{
+ /* UTF-16 Big-endian -> UTF-8 */
+ while( zIn<zTerm ){
+ c = (*(zIn++))<<8;
+ c += *(zIn++);
+ if( c>=0xd800 && c<0xe000 ){
+#ifdef SQLITE_REPLACE_INVALID_UTF
+ if( c>=0xdc00 || zIn>=zTerm ){
+ c = 0xfffd;
+ }else{
+ int c2 = (*(zIn++))<<8;
+ c2 += *(zIn++);
+ if( c2<0xdc00 || c2>=0xe000 ){
+ zIn -= 2;
+ c = 0xfffd;
+ }else{
+ c = ((c&0x3ff)<<10) + (c2&0x3ff) + 0x10000;
+ }
+ }
+#else
+ if( zIn<zTerm ){
+ int c2 = ((*zIn++)<<8);
+ c2 += (*zIn++);
+ c = (c2&0x03FF) + ((c&0x003F)<<10) + (((c&0x03C0)+0x0040)<<10);
+ }
+#endif
+ }
+ WRITE_UTF8(z, c);
+ }
+ }
+ pMem->n = (int)(z - zOut);
+ }
+ *z = 0;
+ assert( (pMem->n+(desiredEnc==SQLITE_UTF8?1:2))<=len );
+
+ c = MEM_Str|MEM_Term|(pMem->flags&(MEM_AffMask|MEM_Subtype));
+ sqlite3VdbeMemRelease(pMem);
+ pMem->flags = c;
+ pMem->enc = desiredEnc;
+ pMem->z = (char*)zOut;
+ pMem->zMalloc = pMem->z;
+ pMem->szMalloc = sqlite3DbMallocSize(pMem->db, pMem->z);
+
+translate_out:
+#if defined(TRANSLATE_TRACE) && defined(SQLITE_DEBUG)
+ {
+ StrAccum acc;
+ char zBuf[1000];
+ sqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0);
+ sqlite3VdbeMemPrettyPrint(pMem, &acc);
+ fprintf(stderr, "OUTPUT: %s\n", sqlite3StrAccumFinish(&acc));
+ }
+#endif
+ return SQLITE_OK;
+}
+#endif /* SQLITE_OMIT_UTF16 */
+
+#ifndef SQLITE_OMIT_UTF16
+/*
+** This routine checks for a byte-order mark at the beginning of the
+** UTF-16 string stored in *pMem. If one is present, it is removed and
+** the encoding of the Mem adjusted. This routine does not do any
+** byte-swapping, it just sets Mem.enc appropriately.
+**
+** The allocation (static, dynamic etc.) and encoding of the Mem may be
+** changed by this function.
+*/
+SQLITE_PRIVATE int sqlite3VdbeMemHandleBom(Mem *pMem){
+ int rc = SQLITE_OK;
+ u8 bom = 0;
+
+ assert( pMem->n>=0 );
+ if( pMem->n>1 ){
+ u8 b1 = *(u8 *)pMem->z;
+ u8 b2 = *(((u8 *)pMem->z) + 1);
+ if( b1==0xFE && b2==0xFF ){
+ bom = SQLITE_UTF16BE;
+ }
+ if( b1==0xFF && b2==0xFE ){
+ bom = SQLITE_UTF16LE;
+ }
+ }
+
+ if( bom ){
+ rc = sqlite3VdbeMemMakeWriteable(pMem);
+ if( rc==SQLITE_OK ){
+ pMem->n -= 2;
+ memmove(pMem->z, &pMem->z[2], pMem->n);
+ pMem->z[pMem->n] = '\0';
+ pMem->z[pMem->n+1] = '\0';
+ pMem->flags |= MEM_Term;
+ pMem->enc = bom;
+ }
+ }
+ return rc;
+}
+#endif /* SQLITE_OMIT_UTF16 */
+
+/*
+** pZ is a UTF-8 encoded unicode string. If nByte is less than zero,
+** return the number of unicode characters in pZ up to (but not including)
+** the first 0x00 byte. If nByte is not less than zero, return the
+** number of unicode characters in the first nByte of pZ (or up to
+** the first 0x00, whichever comes first).
+*/
+SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *zIn, int nByte){
+ int r = 0;
+ const u8 *z = (const u8*)zIn;
+ const u8 *zTerm;
+ if( nByte>=0 ){
+ zTerm = &z[nByte];
+ }else{
+ zTerm = (const u8*)(-1);
+ }
+ assert( z<=zTerm );
+ while( *z!=0 && z<zTerm ){
+ SQLITE_SKIP_UTF8(z);
+ r++;
+ }
+ return r;
+}
+
+/* This test function is not currently used by the automated test-suite.
+** Hence it is only available in debug builds.
+*/
+#if defined(SQLITE_TEST) && defined(SQLITE_DEBUG)
+/*
+** Translate UTF-8 to UTF-8.
+**
+** This has the effect of making sure that the string is well-formed
+** UTF-8. Miscoded characters are removed.
+**
+** The translation is done in-place and aborted if the output
+** overruns the input.
+*/
+SQLITE_PRIVATE int sqlite3Utf8To8(unsigned char *zIn){
+ unsigned char *zOut = zIn;
+ unsigned char *zStart = zIn;
+ u32 c;
+
+ while( zIn[0] && zOut<=zIn ){
+ c = sqlite3Utf8Read((const u8**)&zIn);
+ if( c!=0xfffd ){
+ WRITE_UTF8(zOut, c);
+ }
+ }
+ *zOut = 0;
+ return (int)(zOut - zStart);
+}
+#endif
+
+#ifndef SQLITE_OMIT_UTF16
+/*
+** Convert a UTF-16 string in the native encoding into a UTF-8 string.
+** Memory to hold the UTF-8 string is obtained from sqlite3_malloc and must
+** be freed by the calling function.
+**
+** NULL is returned if there is an allocation error.
+*/
+SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *db, const void *z, int nByte, u8 enc){
+ Mem m;
+ memset(&m, 0, sizeof(m));
+ m.db = db;
+ sqlite3VdbeMemSetStr(&m, z, nByte, enc, SQLITE_STATIC);
+ sqlite3VdbeChangeEncoding(&m, SQLITE_UTF8);
+ if( db->mallocFailed ){
+ sqlite3VdbeMemRelease(&m);
+ m.z = 0;
+ }
+ assert( (m.flags & MEM_Term)!=0 || db->mallocFailed );
+ assert( (m.flags & MEM_Str)!=0 || db->mallocFailed );
+ assert( m.z || db->mallocFailed );
+ return m.z;
+}
+
+/*
+** zIn is a UTF-16 encoded unicode string at least nByte bytes long.
+** Return the number of bytes in the first nChar unicode characters
+** in pZ. nChar must be non-negative. Surrogate pairs count as a single
+** character.
+*/
+SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *zIn, int nByte, int nChar){
+ int c;
+ unsigned char const *z = zIn;
+ unsigned char const *zEnd = &z[nByte-1];
+ int n = 0;
+
+ if( SQLITE_UTF16NATIVE==SQLITE_UTF16LE ) z++;
+ while( n<nChar && ALWAYS(z<=zEnd) ){
+ c = z[0];
+ z += 2;
+ if( c>=0xd8 && c<0xdc && z<=zEnd && z[0]>=0xdc && z[0]<0xe0 ) z += 2;
+ n++;
+ }
+ return (int)(z-(unsigned char const *)zIn)
+ - (SQLITE_UTF16NATIVE==SQLITE_UTF16LE);
+}
+
+#if defined(SQLITE_TEST)
+/*
+** This routine is called from the TCL test function "translate_selftest".
+** It checks that the primitives for serializing and deserializing
+** characters in each encoding are inverses of each other.
+*/
+SQLITE_PRIVATE void sqlite3UtfSelfTest(void){
+ unsigned int i, t;
+ unsigned char zBuf[20];
+ unsigned char *z;
+ int n;
+ unsigned int c;
+
+ for(i=0; i<0x00110000; i++){
+ z = zBuf;
+ WRITE_UTF8(z, i);
+ n = (int)(z-zBuf);
+ assert( n>0 && n<=4 );
+ z[0] = 0;
+ z = zBuf;
+ c = sqlite3Utf8Read((const u8**)&z);
+ t = i;
+ if( i>=0xD800 && i<=0xDFFF ) t = 0xFFFD;
+ if( (i&0xFFFFFFFE)==0xFFFE ) t = 0xFFFD;
+ assert( c==t );
+ assert( (z-zBuf)==n );
+ }
+}
+#endif /* SQLITE_TEST */
+#endif /* SQLITE_OMIT_UTF16 */
+
+/************** End of utf.c *************************************************/
+/************** Begin file util.c ********************************************/
+/*
+** 2001 September 15
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** Utility functions used throughout sqlite.
+**
+** This file contains functions for allocating memory, comparing
+** strings, and stuff like that.
+**
+*/
+/* #include "sqliteInt.h" */
+/* #include <stdarg.h> */
+#ifndef SQLITE_OMIT_FLOATING_POINT
+#include <math.h>
+#endif
+
+/*
+** Calls to sqlite3FaultSim() are used to simulate a failure during testing,
+** or to bypass normal error detection during testing in order to let
+** execute proceed further downstream.
+**
+** In deployment, sqlite3FaultSim() *always* return SQLITE_OK (0). The
+** sqlite3FaultSim() function only returns non-zero during testing.
+**
+** During testing, if the test harness has set a fault-sim callback using
+** a call to sqlite3_test_control(SQLITE_TESTCTRL_FAULT_INSTALL), then
+** each call to sqlite3FaultSim() is relayed to that application-supplied
+** callback and the integer return value form the application-supplied
+** callback is returned by sqlite3FaultSim().
+**
+** The integer argument to sqlite3FaultSim() is a code to identify which
+** sqlite3FaultSim() instance is being invoked. Each call to sqlite3FaultSim()
+** should have a unique code. To prevent legacy testing applications from
+** breaking, the codes should not be changed or reused.
+*/
+#ifndef SQLITE_UNTESTABLE
+SQLITE_PRIVATE int sqlite3FaultSim(int iTest){
+ int (*xCallback)(int) = sqlite3GlobalConfig.xTestCallback;
+ return xCallback ? xCallback(iTest) : SQLITE_OK;
+}
+#endif
+
+#ifndef SQLITE_OMIT_FLOATING_POINT
+/*
+** Return true if the floating point value is Not a Number (NaN).
+**
+** Use the math library isnan() function if compiled with SQLITE_HAVE_ISNAN.
+** Otherwise, we have our own implementation that works on most systems.
+*/
+SQLITE_PRIVATE int sqlite3IsNaN(double x){
+ int rc; /* The value return */
+#if !SQLITE_HAVE_ISNAN && !HAVE_ISNAN
+ u64 y;
+ memcpy(&y,&x,sizeof(y));
+ rc = IsNaN(y);
+#else
+ rc = isnan(x);
+#endif /* HAVE_ISNAN */
+ testcase( rc );
+ return rc;
+}
+#endif /* SQLITE_OMIT_FLOATING_POINT */
+
+#ifndef SQLITE_OMIT_FLOATING_POINT
+/*
+** Return true if the floating point value is NaN or +Inf or -Inf.
+*/
+SQLITE_PRIVATE int sqlite3IsOverflow(double x){
+ int rc; /* The value return */
+ u64 y;
+ memcpy(&y,&x,sizeof(y));
+ rc = IsOvfl(y);
+ return rc;
+}
+#endif /* SQLITE_OMIT_FLOATING_POINT */
+
+/*
+** Compute a string length that is limited to what can be stored in
+** lower 30 bits of a 32-bit signed integer.
+**
+** The value returned will never be negative. Nor will it ever be greater
+** than the actual length of the string. For very long strings (greater
+** than 1GiB) the value returned might be less than the true string length.
+*/
+SQLITE_PRIVATE int sqlite3Strlen30(const char *z){
+ if( z==0 ) return 0;
+ return 0x3fffffff & (int)strlen(z);
+}
+
+/*
+** Return the declared type of a column. Or return zDflt if the column
+** has no declared type.
+**
+** The column type is an extra string stored after the zero-terminator on
+** the column name if and only if the COLFLAG_HASTYPE flag is set.
+*/
+SQLITE_PRIVATE char *sqlite3ColumnType(Column *pCol, char *zDflt){
+ if( pCol->colFlags & COLFLAG_HASTYPE ){
+ return pCol->zCnName + strlen(pCol->zCnName) + 1;
+ }else if( pCol->eCType ){
+ assert( pCol->eCType<=SQLITE_N_STDTYPE );
+ return (char*)sqlite3StdType[pCol->eCType-1];
+ }else{
+ return zDflt;
+ }
+}
+
+/*
+** Helper function for sqlite3Error() - called rarely. Broken out into
+** a separate routine to avoid unnecessary register saves on entry to
+** sqlite3Error().
+*/
+static SQLITE_NOINLINE void sqlite3ErrorFinish(sqlite3 *db, int err_code){
+ if( db->pErr ) sqlite3ValueSetNull(db->pErr);
+ sqlite3SystemError(db, err_code);
+}
+
+/*
+** Set the current error code to err_code and clear any prior error message.
+** Also set iSysErrno (by calling sqlite3System) if the err_code indicates
+** that would be appropriate.
+*/
+SQLITE_PRIVATE void sqlite3Error(sqlite3 *db, int err_code){
+ assert( db!=0 );
+ db->errCode = err_code;
+ if( err_code || db->pErr ){
+ sqlite3ErrorFinish(db, err_code);
+ }else{
+ db->errByteOffset = -1;
+ }
+}
+
+/*
+** The equivalent of sqlite3Error(db, SQLITE_OK). Clear the error state
+** and error message.
+*/
+SQLITE_PRIVATE void sqlite3ErrorClear(sqlite3 *db){
+ assert( db!=0 );
+ db->errCode = SQLITE_OK;
+ db->errByteOffset = -1;
+ if( db->pErr ) sqlite3ValueSetNull(db->pErr);
+}
+
+/*
+** Load the sqlite3.iSysErrno field if that is an appropriate thing
+** to do based on the SQLite error code in rc.
+*/
+SQLITE_PRIVATE void sqlite3SystemError(sqlite3 *db, int rc){
+ if( rc==SQLITE_IOERR_NOMEM ) return;
+#if defined(SQLITE_USE_SEH) && !defined(SQLITE_OMIT_WAL)
+ if( rc==SQLITE_IOERR_IN_PAGE ){
+ int ii;
+ int iErr;
+ sqlite3BtreeEnterAll(db);
+ for(ii=0; ii<db->nDb; ii++){
+ if( db->aDb[ii].pBt ){
+ iErr = sqlite3PagerWalSystemErrno(sqlite3BtreePager(db->aDb[ii].pBt));
+ if( iErr ){
+ db->iSysErrno = iErr;
+ }
+ }
+ }
+ sqlite3BtreeLeaveAll(db);
+ return;
+ }
+#endif
+ rc &= 0xff;
+ if( rc==SQLITE_CANTOPEN || rc==SQLITE_IOERR ){
+ db->iSysErrno = sqlite3OsGetLastError(db->pVfs);
+ }
+}
+
+/*
+** Set the most recent error code and error string for the sqlite
+** handle "db". The error code is set to "err_code".
+**
+** If it is not NULL, string zFormat specifies the format of the
+** error string. zFormat and any string tokens that follow it are
+** assumed to be encoded in UTF-8.
+**
+** To clear the most recent error for sqlite handle "db", sqlite3Error
+** should be called with err_code set to SQLITE_OK and zFormat set
+** to NULL.
+*/
+SQLITE_PRIVATE void sqlite3ErrorWithMsg(sqlite3 *db, int err_code, const char *zFormat, ...){
+ assert( db!=0 );
+ db->errCode = err_code;
+ sqlite3SystemError(db, err_code);
+ if( zFormat==0 ){
+ sqlite3Error(db, err_code);
+ }else if( db->pErr || (db->pErr = sqlite3ValueNew(db))!=0 ){
+ char *z;
+ va_list ap;
+ va_start(ap, zFormat);
+ z = sqlite3VMPrintf(db, zFormat, ap);
+ va_end(ap);
+ sqlite3ValueSetStr(db->pErr, -1, z, SQLITE_UTF8, SQLITE_DYNAMIC);
+ }
+}
+
+/*
+** Check for interrupts and invoke progress callback.
+*/
+SQLITE_PRIVATE void sqlite3ProgressCheck(Parse *p){
+ sqlite3 *db = p->db;
+ if( AtomicLoad(&db->u1.isInterrupted) ){
+ p->nErr++;
+ p->rc = SQLITE_INTERRUPT;
+ }
+#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
+ if( db->xProgress ){
+ if( p->rc==SQLITE_INTERRUPT ){
+ p->nProgressSteps = 0;
+ }else if( (++p->nProgressSteps)>=db->nProgressOps ){
+ if( db->xProgress(db->pProgressArg) ){
+ p->nErr++;
+ p->rc = SQLITE_INTERRUPT;
+ }
+ p->nProgressSteps = 0;
+ }
+ }
+#endif
+}
+
+/*
+** Add an error message to pParse->zErrMsg and increment pParse->nErr.
+**
+** This function should be used to report any error that occurs while
+** compiling an SQL statement (i.e. within sqlite3_prepare()). The
+** last thing the sqlite3_prepare() function does is copy the error
+** stored by this function into the database handle using sqlite3Error().
+** Functions sqlite3Error() or sqlite3ErrorWithMsg() should be used
+** during statement execution (sqlite3_step() etc.).
+*/
+SQLITE_PRIVATE void sqlite3ErrorMsg(Parse *pParse, const char *zFormat, ...){
+ char *zMsg;
+ va_list ap;
+ sqlite3 *db = pParse->db;
+ assert( db!=0 );
+ assert( db->pParse==pParse || db->pParse->pToplevel==pParse );
+ db->errByteOffset = -2;
+ va_start(ap, zFormat);
+ zMsg = sqlite3VMPrintf(db, zFormat, ap);
+ va_end(ap);
+ if( db->errByteOffset<-1 ) db->errByteOffset = -1;
+ if( db->suppressErr ){
+ sqlite3DbFree(db, zMsg);
+ if( db->mallocFailed ){
+ pParse->nErr++;
+ pParse->rc = SQLITE_NOMEM;
+ }
+ }else{
+ pParse->nErr++;
+ sqlite3DbFree(db, pParse->zErrMsg);
+ pParse->zErrMsg = zMsg;
+ pParse->rc = SQLITE_ERROR;
+ pParse->pWith = 0;
+ }
+}
+
+/*
+** If database connection db is currently parsing SQL, then transfer
+** error code errCode to that parser if the parser has not already
+** encountered some other kind of error.
+*/
+SQLITE_PRIVATE int sqlite3ErrorToParser(sqlite3 *db, int errCode){
+ Parse *pParse;
+ if( db==0 || (pParse = db->pParse)==0 ) return errCode;
+ pParse->rc = errCode;
+ pParse->nErr++;
+ return errCode;
+}
+
+/*
+** Convert an SQL-style quoted string into a normal string by removing
+** the quote characters. The conversion is done in-place. If the
+** input does not begin with a quote character, then this routine
+** is a no-op.
+**
+** The input string must be zero-terminated. A new zero-terminator
+** is added to the dequoted string.
+**
+** The return value is -1 if no dequoting occurs or the length of the
+** dequoted string, exclusive of the zero terminator, if dequoting does
+** occur.
+**
+** 2002-02-14: This routine is extended to remove MS-Access style
+** brackets from around identifiers. For example: "[a-b-c]" becomes
+** "a-b-c".
+*/
+SQLITE_PRIVATE void sqlite3Dequote(char *z){
+ char quote;
+ int i, j;
+ if( z==0 ) return;
+ quote = z[0];
+ if( !sqlite3Isquote(quote) ) return;
+ if( quote=='[' ) quote = ']';
+ for(i=1, j=0;; i++){
+ assert( z[i] );
+ if( z[i]==quote ){
+ if( z[i+1]==quote ){
+ z[j++] = quote;
+ i++;
+ }else{
+ break;
+ }
+ }else{
+ z[j++] = z[i];
+ }
+ }
+ z[j] = 0;
+}
+SQLITE_PRIVATE void sqlite3DequoteExpr(Expr *p){
+ assert( !ExprHasProperty(p, EP_IntValue) );
+ assert( sqlite3Isquote(p->u.zToken[0]) );
+ p->flags |= p->u.zToken[0]=='"' ? EP_Quoted|EP_DblQuoted : EP_Quoted;
+ sqlite3Dequote(p->u.zToken);
+}
+
+/*
+** Expression p is a QNUMBER (quoted number). Dequote the value in p->u.zToken
+** and set the type to INTEGER or FLOAT. "Quoted" integers or floats are those
+** that contain '_' characters that must be removed before further processing.
+*/
+SQLITE_PRIVATE void sqlite3DequoteNumber(Parse *pParse, Expr *p){
+ assert( p!=0 || pParse->db->mallocFailed );
+ if( p ){
+ const char *pIn = p->u.zToken;
+ char *pOut = p->u.zToken;
+ int bHex = (pIn[0]=='0' && (pIn[1]=='x' || pIn[1]=='X'));
+ int iValue;
+ assert( p->op==TK_QNUMBER );
+ p->op = TK_INTEGER;
+ do {
+ if( *pIn!=SQLITE_DIGIT_SEPARATOR ){
+ *pOut++ = *pIn;
+ if( *pIn=='e' || *pIn=='E' || *pIn=='.' ) p->op = TK_FLOAT;
+ }else{
+ if( (bHex==0 && (!sqlite3Isdigit(pIn[-1]) || !sqlite3Isdigit(pIn[1])))
+ || (bHex==1 && (!sqlite3Isxdigit(pIn[-1]) || !sqlite3Isxdigit(pIn[1])))
+ ){
+ sqlite3ErrorMsg(pParse, "unrecognized token: \"%s\"", p->u.zToken);
+ }
+ }
+ }while( *pIn++ );
+ if( bHex ) p->op = TK_INTEGER;
+
+ /* tag-20240227-a: If after dequoting, the number is an integer that
+ ** fits in 32 bits, then it must be converted into EP_IntValue. Other
+ ** parts of the code expect this. See also tag-20240227-b. */
+ if( p->op==TK_INTEGER && sqlite3GetInt32(p->u.zToken, &iValue) ){
+ p->u.iValue = iValue;
+ p->flags |= EP_IntValue;
+ }
+ }
+}
+
+/*
+** If the input token p is quoted, try to adjust the token to remove
+** the quotes. This is not always possible:
+**
+** "abc" -> abc
+** "ab""cd" -> (not possible because of the interior "")
+**
+** Remove the quotes if possible. This is a optimization. The overall
+** system should still return the correct answer even if this routine
+** is always a no-op.
+*/
+SQLITE_PRIVATE void sqlite3DequoteToken(Token *p){
+ unsigned int i;
+ if( p->n<2 ) return;
+ if( !sqlite3Isquote(p->z[0]) ) return;
+ for(i=1; i<p->n-1; i++){
+ if( sqlite3Isquote(p->z[i]) ) return;
+ }
+ p->n -= 2;
+ p->z++;
+}
+
+/*
+** Generate a Token object from a string
+*/
+SQLITE_PRIVATE void sqlite3TokenInit(Token *p, char *z){
+ p->z = z;
+ p->n = sqlite3Strlen30(z);
+}
+
+/* Convenient short-hand */
+#define UpperToLower sqlite3UpperToLower
+
+/*
+** Some systems have stricmp(). Others have strcasecmp(). Because
+** there is no consistency, we will define our own.
+**
+** IMPLEMENTATION-OF: R-30243-02494 The sqlite3_stricmp() and
+** sqlite3_strnicmp() APIs allow applications and extensions to compare
+** the contents of two buffers containing UTF-8 strings in a
+** case-independent fashion, using the same definition of "case
+** independence" that SQLite uses internally when comparing identifiers.
+*/
+SQLITE_API int sqlite3_stricmp(const char *zLeft, const char *zRight){
+ if( zLeft==0 ){
+ return zRight ? -1 : 0;
+ }else if( zRight==0 ){
+ return 1;
+ }
+ return sqlite3StrICmp(zLeft, zRight);
+}
+SQLITE_PRIVATE int sqlite3StrICmp(const char *zLeft, const char *zRight){
+ unsigned char *a, *b;
+ int c, x;
+ a = (unsigned char *)zLeft;
+ b = (unsigned char *)zRight;
+ for(;;){
+ c = *a;
+ x = *b;
+ if( c==x ){
+ if( c==0 ) break;
+ }else{
+ c = (int)UpperToLower[c] - (int)UpperToLower[x];
+ if( c ) break;
+ }
+ a++;
+ b++;
+ }
+ return c;
+}
+SQLITE_API int sqlite3_strnicmp(const char *zLeft, const char *zRight, int N){
+ register unsigned char *a, *b;
+ if( zLeft==0 ){
+ return zRight ? -1 : 0;
+ }else if( zRight==0 ){
+ return 1;
+ }
+ a = (unsigned char *)zLeft;
+ b = (unsigned char *)zRight;
+ while( N-- > 0 && *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; }
+ return N<0 ? 0 : UpperToLower[*a] - UpperToLower[*b];
+}
+
+/*
+** Compute an 8-bit hash on a string that is insensitive to case differences
+*/
+SQLITE_PRIVATE u8 sqlite3StrIHash(const char *z){
+ u8 h = 0;
+ if( z==0 ) return 0;
+ while( z[0] ){
+ h += UpperToLower[(unsigned char)z[0]];
+ z++;
+ }
+ return h;
+}
+
+/* Double-Double multiplication. (x[0],x[1]) *= (y,yy)
+**
+** Reference:
+** T. J. Dekker, "A Floating-Point Technique for Extending the
+** Available Precision". 1971-07-26.
+*/
+static void dekkerMul2(volatile double *x, double y, double yy){
+ /*
+ ** The "volatile" keywords on parameter x[] and on local variables
+ ** below are needed force intermediate results to be truncated to
+ ** binary64 rather than be carried around in an extended-precision
+ ** format. The truncation is necessary for the Dekker algorithm to
+ ** work. Intel x86 floating point might omit the truncation without
+ ** the use of volatile.
+ */
+ volatile double tx, ty, p, q, c, cc;
+ double hx, hy;
+ u64 m;
+ memcpy(&m, (void*)&x[0], 8);
+ m &= 0xfffffffffc000000LL;
+ memcpy(&hx, &m, 8);
+ tx = x[0] - hx;
+ memcpy(&m, &y, 8);
+ m &= 0xfffffffffc000000LL;
+ memcpy(&hy, &m, 8);
+ ty = y - hy;
+ p = hx*hy;
+ q = hx*ty + tx*hy;
+ c = p+q;
+ cc = p - c + q + tx*ty;
+ cc = x[0]*yy + x[1]*y + cc;
+ x[0] = c + cc;
+ x[1] = c - x[0];
+ x[1] += cc;
+}
+
+/*
+** The string z[] is an text representation of a real number.
+** Convert this string to a double and write it into *pResult.
+**
+** The string z[] is length bytes in length (bytes, not characters) and
+** uses the encoding enc. The string is not necessarily zero-terminated.
+**
+** Return TRUE if the result is a valid real number (or integer) and FALSE
+** if the string is empty or contains extraneous text. More specifically
+** return
+** 1 => The input string is a pure integer
+** 2 or more => The input has a decimal point or eNNN clause
+** 0 or less => The input string is not a valid number
+** -1 => Not a valid number, but has a valid prefix which
+** includes a decimal point and/or an eNNN clause
+**
+** Valid numbers are in one of these formats:
+**
+** [+-]digits[E[+-]digits]
+** [+-]digits.[digits][E[+-]digits]
+** [+-].digits[E[+-]digits]
+**
+** Leading and trailing whitespace is ignored for the purpose of determining
+** validity.
+**
+** If some prefix of the input string is a valid number, this routine
+** returns FALSE but it still converts the prefix and writes the result
+** into *pResult.
+*/
+#if defined(_MSC_VER)
+#pragma warning(disable : 4756)
+#endif
+SQLITE_PRIVATE int sqlite3AtoF(const char *z, double *pResult, int length, u8 enc){
+#ifndef SQLITE_OMIT_FLOATING_POINT
+ int incr;
+ const char *zEnd;
+ /* sign * significand * (10 ^ (esign * exponent)) */
+ int sign = 1; /* sign of significand */
+ u64 s = 0; /* significand */
+ int d = 0; /* adjust exponent for shifting decimal point */
+ int esign = 1; /* sign of exponent */
+ int e = 0; /* exponent */
+ int eValid = 1; /* True exponent is either not used or is well-formed */
+ int nDigit = 0; /* Number of digits processed */
+ int eType = 1; /* 1: pure integer, 2+: fractional -1 or less: bad UTF16 */
+ u64 s2; /* round-tripped significand */
+ double rr[2];
+
+ assert( enc==SQLITE_UTF8 || enc==SQLITE_UTF16LE || enc==SQLITE_UTF16BE );
+ *pResult = 0.0; /* Default return value, in case of an error */
+ if( length==0 ) return 0;
+
+ if( enc==SQLITE_UTF8 ){
+ incr = 1;
+ zEnd = z + length;
+ }else{
+ int i;
+ incr = 2;
+ length &= ~1;
+ assert( SQLITE_UTF16LE==2 && SQLITE_UTF16BE==3 );
+ testcase( enc==SQLITE_UTF16LE );
+ testcase( enc==SQLITE_UTF16BE );
+ for(i=3-enc; i<length && z[i]==0; i+=2){}
+ if( i<length ) eType = -100;
+ zEnd = &z[i^1];
+ z += (enc&1);
+ }
+
+ /* skip leading spaces */
+ while( z<zEnd && sqlite3Isspace(*z) ) z+=incr;
+ if( z>=zEnd ) return 0;
+
+ /* get sign of significand */
+ if( *z=='-' ){
+ sign = -1;
+ z+=incr;
+ }else if( *z=='+' ){
+ z+=incr;
+ }
+
+ /* copy max significant digits to significand */
+ while( z<zEnd && sqlite3Isdigit(*z) ){
+ s = s*10 + (*z - '0');
+ z+=incr; nDigit++;
+ if( s>=((LARGEST_UINT64-9)/10) ){
+ /* skip non-significant significand digits
+ ** (increase exponent by d to shift decimal left) */
+ while( z<zEnd && sqlite3Isdigit(*z) ){ z+=incr; d++; }
+ }
+ }
+ if( z>=zEnd ) goto do_atof_calc;
+
+ /* if decimal point is present */
+ if( *z=='.' ){
+ z+=incr;
+ eType++;
+ /* copy digits from after decimal to significand
+ ** (decrease exponent by d to shift decimal right) */
+ while( z<zEnd && sqlite3Isdigit(*z) ){
+ if( s<((LARGEST_UINT64-9)/10) ){
+ s = s*10 + (*z - '0');
+ d--;
+ nDigit++;
+ }
+ z+=incr;
+ }
+ }
+ if( z>=zEnd ) goto do_atof_calc;
+
+ /* if exponent is present */
+ if( *z=='e' || *z=='E' ){
+ z+=incr;
+ eValid = 0;
+ eType++;
+
+ /* This branch is needed to avoid a (harmless) buffer overread. The
+ ** special comment alerts the mutation tester that the correct answer
+ ** is obtained even if the branch is omitted */
+ if( z>=zEnd ) goto do_atof_calc; /*PREVENTS-HARMLESS-OVERREAD*/
+
+ /* get sign of exponent */
+ if( *z=='-' ){
+ esign = -1;
+ z+=incr;
+ }else if( *z=='+' ){
+ z+=incr;
+ }
+ /* copy digits to exponent */
+ while( z<zEnd && sqlite3Isdigit(*z) ){
+ e = e<10000 ? (e*10 + (*z - '0')) : 10000;
+ z+=incr;
+ eValid = 1;
+ }
+ }
+
+ /* skip trailing spaces */
+ while( z<zEnd && sqlite3Isspace(*z) ) z+=incr;
+
+do_atof_calc:
+ /* Zero is a special case */
+ if( s==0 ){
+ *pResult = sign<0 ? -0.0 : +0.0;
+ goto atof_return;
+ }
+
+ /* adjust exponent by d, and update sign */
+ e = (e*esign) + d;
+
+ /* Try to adjust the exponent to make it smaller */
+ while( e>0 && s<((LARGEST_UINT64-0x7ff)/10) ){
+ s *= 10;
+ e--;
+ }
+ while( e<0 && (s%10)==0 ){
+ s /= 10;
+ e++;
+ }
+
+ rr[0] = (double)s;
+ assert( sizeof(s2)==sizeof(rr[0]) );
+#ifdef SQLITE_DEBUG
+ rr[1] = 18446744073709549568.0;
+ memcpy(&s2, &rr[1], sizeof(s2));
+ assert( s2==0x43efffffffffffffLL );
+#endif
+ /* Largest double that can be safely converted to u64
+ ** vvvvvvvvvvvvvvvvvvvvvv */
+ if( rr[0]<=18446744073709549568.0 ){
+ s2 = (u64)rr[0];
+ rr[1] = s>=s2 ? (double)(s - s2) : -(double)(s2 - s);
+ }else{
+ rr[1] = 0.0;
+ }
+ assert( rr[1]<=1.0e-10*rr[0] ); /* Equal only when rr[0]==0.0 */
+
+ if( e>0 ){
+ while( e>=100 ){
+ e -= 100;
+ dekkerMul2(rr, 1.0e+100, -1.5902891109759918046e+83);
+ }
+ while( e>=10 ){
+ e -= 10;
+ dekkerMul2(rr, 1.0e+10, 0.0);
+ }
+ while( e>=1 ){
+ e -= 1;
+ dekkerMul2(rr, 1.0e+01, 0.0);
+ }
+ }else{
+ while( e<=-100 ){
+ e += 100;
+ dekkerMul2(rr, 1.0e-100, -1.99918998026028836196e-117);
+ }
+ while( e<=-10 ){
+ e += 10;
+ dekkerMul2(rr, 1.0e-10, -3.6432197315497741579e-27);
+ }
+ while( e<=-1 ){
+ e += 1;
+ dekkerMul2(rr, 1.0e-01, -5.5511151231257827021e-18);
+ }
+ }
+ *pResult = rr[0]+rr[1];
+ if( sqlite3IsNaN(*pResult) ) *pResult = 1e300*1e300;
+ if( sign<0 ) *pResult = -*pResult;
+ assert( !sqlite3IsNaN(*pResult) );
+
+atof_return:
+ /* return true if number and no extra non-whitespace characters after */
+ if( z==zEnd && nDigit>0 && eValid && eType>0 ){
+ return eType;
+ }else if( eType>=2 && (eType==3 || eValid) && nDigit>0 ){
+ return -1;
+ }else{
+ return 0;
+ }
+#else
+ return !sqlite3Atoi64(z, pResult, length, enc);
+#endif /* SQLITE_OMIT_FLOATING_POINT */
+}
+#if defined(_MSC_VER)
+#pragma warning(default : 4756)
+#endif
+
+/*
+** Render an signed 64-bit integer as text. Store the result in zOut[] and
+** return the length of the string that was stored, in bytes. The value
+** returned does not include the zero terminator at the end of the output
+** string.
+**
+** The caller must ensure that zOut[] is at least 21 bytes in size.
+*/
+SQLITE_PRIVATE int sqlite3Int64ToText(i64 v, char *zOut){
+ int i;
+ u64 x;
+ char zTemp[22];
+ if( v<0 ){
+ x = (v==SMALLEST_INT64) ? ((u64)1)<<63 : (u64)-v;
+ }else{
+ x = v;
+ }
+ i = sizeof(zTemp)-2;
+ zTemp[sizeof(zTemp)-1] = 0;
+ while( 1 /*exit-by-break*/ ){
+ zTemp[i] = (x%10) + '0';
+ x = x/10;
+ if( x==0 ) break;
+ i--;
+ };
+ if( v<0 ) zTemp[--i] = '-';
+ memcpy(zOut, &zTemp[i], sizeof(zTemp)-i);
+ return sizeof(zTemp)-1-i;
+}
+
+/*
+** Compare the 19-character string zNum against the text representation
+** value 2^63: 9223372036854775808. Return negative, zero, or positive
+** if zNum is less than, equal to, or greater than the string.
+** Note that zNum must contain exactly 19 characters.
+**
+** Unlike memcmp() this routine is guaranteed to return the difference
+** in the values of the last digit if the only difference is in the
+** last digit. So, for example,
+**
+** compare2pow63("9223372036854775800", 1)
+**
+** will return -8.
+*/
+static int compare2pow63(const char *zNum, int incr){
+ int c = 0;
+ int i;
+ /* 012345678901234567 */
+ const char *pow63 = "922337203685477580";
+ for(i=0; c==0 && i<18; i++){
+ c = (zNum[i*incr]-pow63[i])*10;
+ }
+ if( c==0 ){
+ c = zNum[18*incr] - '8';
+ testcase( c==(-1) );
+ testcase( c==0 );
+ testcase( c==(+1) );
+ }
+ return c;
+}
+
+/*
+** Convert zNum to a 64-bit signed integer. zNum must be decimal. This
+** routine does *not* accept hexadecimal notation.
+**
+** Returns:
+**
+** -1 Not even a prefix of the input text looks like an integer
+** 0 Successful transformation. Fits in a 64-bit signed integer.
+** 1 Excess non-space text after the integer value
+** 2 Integer too large for a 64-bit signed integer or is malformed
+** 3 Special case of 9223372036854775808
+**
+** length is the number of bytes in the string (bytes, not characters).
+** The string is not necessarily zero-terminated. The encoding is
+** given by enc.
+*/
+SQLITE_PRIVATE int sqlite3Atoi64(const char *zNum, i64 *pNum, int length, u8 enc){
+ int incr;
+ u64 u = 0;
+ int neg = 0; /* assume positive */
+ int i;
+ int c = 0;
+ int nonNum = 0; /* True if input contains UTF16 with high byte non-zero */
+ int rc; /* Baseline return code */
+ const char *zStart;
+ const char *zEnd = zNum + length;
+ assert( enc==SQLITE_UTF8 || enc==SQLITE_UTF16LE || enc==SQLITE_UTF16BE );
+ if( enc==SQLITE_UTF8 ){
+ incr = 1;
+ }else{
+ incr = 2;
+ length &= ~1;
+ assert( SQLITE_UTF16LE==2 && SQLITE_UTF16BE==3 );
+ for(i=3-enc; i<length && zNum[i]==0; i+=2){}
+ nonNum = i<length;
+ zEnd = &zNum[i^1];
+ zNum += (enc&1);
+ }
+ while( zNum<zEnd && sqlite3Isspace(*zNum) ) zNum+=incr;
+ if( zNum<zEnd ){
+ if( *zNum=='-' ){
+ neg = 1;
+ zNum+=incr;
+ }else if( *zNum=='+' ){
+ zNum+=incr;
+ }
+ }
+ zStart = zNum;
+ while( zNum<zEnd && zNum[0]=='0' ){ zNum+=incr; } /* Skip leading zeros. */
+ for(i=0; &zNum[i]<zEnd && (c=zNum[i])>='0' && c<='9'; i+=incr){
+ u = u*10 + c - '0';
+ }
+ testcase( i==18*incr );
+ testcase( i==19*incr );
+ testcase( i==20*incr );
+ if( u>LARGEST_INT64 ){
+ /* This test and assignment is needed only to suppress UB warnings
+ ** from clang and -fsanitize=undefined. This test and assignment make
+ ** the code a little larger and slower, and no harm comes from omitting
+ ** them, but we must appease the undefined-behavior pharisees. */
+ *pNum = neg ? SMALLEST_INT64 : LARGEST_INT64;
+ }else if( neg ){
+ *pNum = -(i64)u;
+ }else{
+ *pNum = (i64)u;
+ }
+ rc = 0;
+ if( i==0 && zStart==zNum ){ /* No digits */
+ rc = -1;
+ }else if( nonNum ){ /* UTF16 with high-order bytes non-zero */
+ rc = 1;
+ }else if( &zNum[i]<zEnd ){ /* Extra bytes at the end */
+ int jj = i;
+ do{
+ if( !sqlite3Isspace(zNum[jj]) ){
+ rc = 1; /* Extra non-space text after the integer */
+ break;
+ }
+ jj += incr;
+ }while( &zNum[jj]<zEnd );
+ }
+ if( i<19*incr ){
+ /* Less than 19 digits, so we know that it fits in 64 bits */
+ assert( u<=LARGEST_INT64 );
+ return rc;
+ }else{
+ /* zNum is a 19-digit numbers. Compare it against 9223372036854775808. */
+ c = i>19*incr ? 1 : compare2pow63(zNum, incr);
+ if( c<0 ){
+ /* zNum is less than 9223372036854775808 so it fits */
+ assert( u<=LARGEST_INT64 );
+ return rc;
+ }else{
+ *pNum = neg ? SMALLEST_INT64 : LARGEST_INT64;
+ if( c>0 ){
+ /* zNum is greater than 9223372036854775808 so it overflows */
+ return 2;
+ }else{
+ /* zNum is exactly 9223372036854775808. Fits if negative. The
+ ** special case 2 overflow if positive */
+ assert( u-1==LARGEST_INT64 );
+ return neg ? rc : 3;
+ }
+ }
+ }
+}
+
+/*
+** Transform a UTF-8 integer literal, in either decimal or hexadecimal,
+** into a 64-bit signed integer. This routine accepts hexadecimal literals,
+** whereas sqlite3Atoi64() does not.
+**
+** Returns:
+**
+** 0 Successful transformation. Fits in a 64-bit signed integer.
+** 1 Excess text after the integer value
+** 2 Integer too large for a 64-bit signed integer or is malformed
+** 3 Special case of 9223372036854775808
+*/
+SQLITE_PRIVATE int sqlite3DecOrHexToI64(const char *z, i64 *pOut){
+#ifndef SQLITE_OMIT_HEX_INTEGER
+ if( z[0]=='0'
+ && (z[1]=='x' || z[1]=='X')
+ ){
+ u64 u = 0;
+ int i, k;
+ for(i=2; z[i]=='0'; i++){}
+ for(k=i; sqlite3Isxdigit(z[k]); k++){
+ u = u*16 + sqlite3HexToInt(z[k]);
+ }
+ memcpy(pOut, &u, 8);
+ if( k-i>16 ) return 2;
+ if( z[k]!=0 ) return 1;
+ return 0;
+ }else
+#endif /* SQLITE_OMIT_HEX_INTEGER */
+ {
+ int n = (int)(0x3fffffff&strspn(z,"+- \n\t0123456789"));
+ if( z[n] ) n++;
+ return sqlite3Atoi64(z, pOut, n, SQLITE_UTF8);
+ }
+}
+
+/*
+** If zNum represents an integer that will fit in 32-bits, then set
+** *pValue to that integer and return true. Otherwise return false.
+**
+** This routine accepts both decimal and hexadecimal notation for integers.
+**
+** Any non-numeric characters that following zNum are ignored.
+** This is different from sqlite3Atoi64() which requires the
+** input number to be zero-terminated.
+*/
+SQLITE_PRIVATE int sqlite3GetInt32(const char *zNum, int *pValue){
+ sqlite_int64 v = 0;
+ int i, c;
+ int neg = 0;
+ if( zNum[0]=='-' ){
+ neg = 1;
+ zNum++;
+ }else if( zNum[0]=='+' ){
+ zNum++;
+ }
+#ifndef SQLITE_OMIT_HEX_INTEGER
+ else if( zNum[0]=='0'
+ && (zNum[1]=='x' || zNum[1]=='X')
+ && sqlite3Isxdigit(zNum[2])
+ ){
+ u32 u = 0;
+ zNum += 2;
+ while( zNum[0]=='0' ) zNum++;
+ for(i=0; i<8 && sqlite3Isxdigit(zNum[i]); i++){
+ u = u*16 + sqlite3HexToInt(zNum[i]);
+ }
+ if( (u&0x80000000)==0 && sqlite3Isxdigit(zNum[i])==0 ){
+ memcpy(pValue, &u, 4);
+ return 1;
+ }else{
+ return 0;
+ }
+ }
+#endif
+ if( !sqlite3Isdigit(zNum[0]) ) return 0;
+ while( zNum[0]=='0' ) zNum++;
+ for(i=0; i<11 && (c = zNum[i] - '0')>=0 && c<=9; i++){
+ v = v*10 + c;
+ }
+
+ /* The longest decimal representation of a 32 bit integer is 10 digits:
+ **
+ ** 1234567890
+ ** 2^31 -> 2147483648
+ */
+ testcase( i==10 );
+ if( i>10 ){
+ return 0;
+ }
+ testcase( v-neg==2147483647 );
+ if( v-neg>2147483647 ){
+ return 0;
+ }
+ if( neg ){
+ v = -v;
+ }
+ *pValue = (int)v;
+ return 1;
+}
+
+/*
+** Return a 32-bit integer value extracted from a string. If the
+** string is not an integer, just return 0.
+*/
+SQLITE_PRIVATE int sqlite3Atoi(const char *z){
+ int x = 0;
+ sqlite3GetInt32(z, &x);
+ return x;
+}
+
+/*
+** Decode a floating-point value into an approximate decimal
+** representation.
+**
+** If iRound<=0 then round to -iRound significant digits to the
+** the left of the decimal point, or to a maximum of mxRound total
+** significant digits.
+**
+** If iRound>0 round to min(iRound,mxRound) significant digits total.
+**
+** mxRound must be positive.
+**
+** The significant digits of the decimal representation are
+** stored in p->z[] which is a often (but not always) a pointer
+** into the middle of p->zBuf[]. There are p->n significant digits.
+** The p->z[] array is *not* zero-terminated.
+*/
+SQLITE_PRIVATE void sqlite3FpDecode(FpDecode *p, double r, int iRound, int mxRound){
+ int i;
+ u64 v;
+ int e, exp = 0;
+ double rr[2];
+
+ p->isSpecial = 0;
+ p->z = p->zBuf;
+ assert( mxRound>0 );
+
+ /* Convert negative numbers to positive. Deal with Infinity, 0.0, and
+ ** NaN. */
+ if( r<0.0 ){
+ p->sign = '-';
+ r = -r;
+ }else if( r==0.0 ){
+ p->sign = '+';
+ p->n = 1;
+ p->iDP = 1;
+ p->z = "0";
+ return;
+ }else{
+ p->sign = '+';
+ }
+ memcpy(&v,&r,8);
+ e = v>>52;
+ if( (e&0x7ff)==0x7ff ){
+ p->isSpecial = 1 + (v!=0x7ff0000000000000LL);
+ p->n = 0;
+ p->iDP = 0;
+ return;
+ }
+
+ /* Multiply r by powers of ten until it lands somewhere in between
+ ** 1.0e+19 and 1.0e+17.
+ **
+ ** Use Dekker-style double-double computation to increase the
+ ** precision.
+ **
+ ** The error terms on constants like 1.0e+100 computed using the
+ ** decimal extension, for example as follows:
+ **
+ ** SELECT decimal_exp(decimal_sub('1.0e+100',decimal(1.0e+100)));
+ */
+ rr[0] = r;
+ rr[1] = 0.0;
+ if( rr[0]>9.223372036854774784e+18 ){
+ while( rr[0]>9.223372036854774784e+118 ){
+ exp += 100;
+ dekkerMul2(rr, 1.0e-100, -1.99918998026028836196e-117);
+ }
+ while( rr[0]>9.223372036854774784e+28 ){
+ exp += 10;
+ dekkerMul2(rr, 1.0e-10, -3.6432197315497741579e-27);
+ }
+ while( rr[0]>9.223372036854774784e+18 ){
+ exp += 1;
+ dekkerMul2(rr, 1.0e-01, -5.5511151231257827021e-18);
+ }
+ }else{
+ while( rr[0]<9.223372036854774784e-83 ){
+ exp -= 100;
+ dekkerMul2(rr, 1.0e+100, -1.5902891109759918046e+83);
+ }
+ while( rr[0]<9.223372036854774784e+07 ){
+ exp -= 10;
+ dekkerMul2(rr, 1.0e+10, 0.0);
+ }
+ while( rr[0]<9.22337203685477478e+17 ){
+ exp -= 1;
+ dekkerMul2(rr, 1.0e+01, 0.0);
+ }
+ }
+ v = rr[1]<0.0 ? (u64)rr[0]-(u64)(-rr[1]) : (u64)rr[0]+(u64)rr[1];
+
+ /* Extract significant digits. */
+ i = sizeof(p->zBuf)-1;
+ assert( v>0 );
+ while( v ){ p->zBuf[i--] = (v%10) + '0'; v /= 10; }
+ assert( i>=0 && i<sizeof(p->zBuf)-1 );
+ p->n = sizeof(p->zBuf) - 1 - i;
+ assert( p->n>0 );
+ assert( p->n<sizeof(p->zBuf) );
+ p->iDP = p->n + exp;
+ if( iRound<=0 ){
+ iRound = p->iDP - iRound;
+ if( iRound==0 && p->zBuf[i+1]>='5' ){
+ iRound = 1;
+ p->zBuf[i--] = '0';
+ p->n++;
+ p->iDP++;
+ }
+ }
+ if( iRound>0 && (iRound<p->n || p->n>mxRound) ){
+ char *z = &p->zBuf[i+1];
+ if( iRound>mxRound ) iRound = mxRound;
+ p->n = iRound;
+ if( z[iRound]>='5' ){
+ int j = iRound-1;
+ while( 1 /*exit-by-break*/ ){
+ z[j]++;
+ if( z[j]<='9' ) break;
+ z[j] = '0';
+ if( j==0 ){
+ p->z[i--] = '1';
+ p->n++;
+ p->iDP++;
+ break;
+ }else{
+ j--;
+ }
+ }
+ }
+ }
+ p->z = &p->zBuf[i+1];
+ assert( i+p->n < sizeof(p->zBuf) );
+ while( ALWAYS(p->n>0) && p->z[p->n-1]=='0' ){ p->n--; }
+}
+
+/*
+** Try to convert z into an unsigned 32-bit integer. Return true on
+** success and false if there is an error.
+**
+** Only decimal notation is accepted.
+*/
+SQLITE_PRIVATE int sqlite3GetUInt32(const char *z, u32 *pI){
+ u64 v = 0;
+ int i;
+ for(i=0; sqlite3Isdigit(z[i]); i++){
+ v = v*10 + z[i] - '0';
+ if( v>4294967296LL ){ *pI = 0; return 0; }
+ }
+ if( i==0 || z[i]!=0 ){ *pI = 0; return 0; }
+ *pI = (u32)v;
+ return 1;
+}
+
+/*
+** The variable-length integer encoding is as follows:
+**
+** KEY:
+** A = 0xxxxxxx 7 bits of data and one flag bit
+** B = 1xxxxxxx 7 bits of data and one flag bit
+** C = xxxxxxxx 8 bits of data
+**
+** 7 bits - A
+** 14 bits - BA
+** 21 bits - BBA
+** 28 bits - BBBA
+** 35 bits - BBBBA
+** 42 bits - BBBBBA
+** 49 bits - BBBBBBA
+** 56 bits - BBBBBBBA
+** 64 bits - BBBBBBBBC
+*/
+
+/*
+** Write a 64-bit variable-length integer to memory starting at p[0].
+** The length of data write will be between 1 and 9 bytes. The number
+** of bytes written is returned.
+**
+** A variable-length integer consists of the lower 7 bits of each byte
+** for all bytes that have the 8th bit set and one byte with the 8th
+** bit clear. Except, if we get to the 9th byte, it stores the full
+** 8 bits and is the last byte.
+*/
+static int SQLITE_NOINLINE putVarint64(unsigned char *p, u64 v){
+ int i, j, n;
+ u8 buf[10];
+ if( v & (((u64)0xff000000)<<32) ){
+ p[8] = (u8)v;
+ v >>= 8;
+ for(i=7; i>=0; i--){
+ p[i] = (u8)((v & 0x7f) | 0x80);
+ v >>= 7;
+ }
+ return 9;
+ }
+ n = 0;
+ do{
+ buf[n++] = (u8)((v & 0x7f) | 0x80);
+ v >>= 7;
+ }while( v!=0 );
+ buf[0] &= 0x7f;
+ assert( n<=9 );
+ for(i=0, j=n-1; j>=0; j--, i++){
+ p[i] = buf[j];
+ }
+ return n;
+}
+SQLITE_PRIVATE int sqlite3PutVarint(unsigned char *p, u64 v){
+ if( v<=0x7f ){
+ p[0] = v&0x7f;
+ return 1;
+ }
+ if( v<=0x3fff ){
+ p[0] = ((v>>7)&0x7f)|0x80;
+ p[1] = v&0x7f;
+ return 2;
+ }
+ return putVarint64(p,v);
+}
+
+/*
+** Bitmasks used by sqlite3GetVarint(). These precomputed constants
+** are defined here rather than simply putting the constant expressions
+** inline in order to work around bugs in the RVT compiler.
+**
+** SLOT_2_0 A mask for (0x7f<<14) | 0x7f
+**
+** SLOT_4_2_0 A mask for (0x7f<<28) | SLOT_2_0
+*/
+#define SLOT_2_0 0x001fc07f
+#define SLOT_4_2_0 0xf01fc07f
+
+
+/*
+** Read a 64-bit variable-length integer from memory starting at p[0].
+** Return the number of bytes read. The value is stored in *v.
+*/
+SQLITE_PRIVATE u8 sqlite3GetVarint(const unsigned char *p, u64 *v){
+ u32 a,b,s;
+
+ if( ((signed char*)p)[0]>=0 ){
+ *v = *p;
+ return 1;
+ }
+ if( ((signed char*)p)[1]>=0 ){
+ *v = ((u32)(p[0]&0x7f)<<7) | p[1];
+ return 2;
+ }
+
+ /* Verify that constants are precomputed correctly */
+ assert( SLOT_2_0 == ((0x7f<<14) | (0x7f)) );
+ assert( SLOT_4_2_0 == ((0xfU<<28) | (0x7f<<14) | (0x7f)) );
+
+ a = ((u32)p[0])<<14;
+ b = p[1];
+ p += 2;
+ a |= *p;
+ /* a: p0<<14 | p2 (unmasked) */
+ if (!(a&0x80))
+ {
+ a &= SLOT_2_0;
+ b &= 0x7f;
+ b = b<<7;
+ a |= b;
+ *v = a;
+ return 3;
+ }
+
+ /* CSE1 from below */
+ a &= SLOT_2_0;
+ p++;
+ b = b<<14;
+ b |= *p;
+ /* b: p1<<14 | p3 (unmasked) */
+ if (!(b&0x80))
+ {
+ b &= SLOT_2_0;
+ /* moved CSE1 up */
+ /* a &= (0x7f<<14)|(0x7f); */
+ a = a<<7;
+ a |= b;
+ *v = a;
+ return 4;
+ }
+
+ /* a: p0<<14 | p2 (masked) */
+ /* b: p1<<14 | p3 (unmasked) */
+ /* 1:save off p0<<21 | p1<<14 | p2<<7 | p3 (masked) */
+ /* moved CSE1 up */
+ /* a &= (0x7f<<14)|(0x7f); */
+ b &= SLOT_2_0;
+ s = a;
+ /* s: p0<<14 | p2 (masked) */
+
+ p++;
+ a = a<<14;
+ a |= *p;
+ /* a: p0<<28 | p2<<14 | p4 (unmasked) */
+ if (!(a&0x80))
+ {
+ /* we can skip these cause they were (effectively) done above
+ ** while calculating s */
+ /* a &= (0x7f<<28)|(0x7f<<14)|(0x7f); */
+ /* b &= (0x7f<<14)|(0x7f); */
+ b = b<<7;
+ a |= b;
+ s = s>>18;
+ *v = ((u64)s)<<32 | a;
+ return 5;
+ }
+
+ /* 2:save off p0<<21 | p1<<14 | p2<<7 | p3 (masked) */
+ s = s<<7;
+ s |= b;
+ /* s: p0<<21 | p1<<14 | p2<<7 | p3 (masked) */
+
+ p++;
+ b = b<<14;
+ b |= *p;
+ /* b: p1<<28 | p3<<14 | p5 (unmasked) */
+ if (!(b&0x80))
+ {
+ /* we can skip this cause it was (effectively) done above in calc'ing s */
+ /* b &= (0x7f<<28)|(0x7f<<14)|(0x7f); */
+ a &= SLOT_2_0;
+ a = a<<7;
+ a |= b;
+ s = s>>18;
+ *v = ((u64)s)<<32 | a;
+ return 6;
+ }
+
+ p++;
+ a = a<<14;
+ a |= *p;
+ /* a: p2<<28 | p4<<14 | p6 (unmasked) */
+ if (!(a&0x80))
+ {
+ a &= SLOT_4_2_0;
+ b &= SLOT_2_0;
+ b = b<<7;
+ a |= b;
+ s = s>>11;
+ *v = ((u64)s)<<32 | a;
+ return 7;
+ }
+
+ /* CSE2 from below */
+ a &= SLOT_2_0;
+ p++;
+ b = b<<14;
+ b |= *p;
+ /* b: p3<<28 | p5<<14 | p7 (unmasked) */
+ if (!(b&0x80))
+ {
+ b &= SLOT_4_2_0;
+ /* moved CSE2 up */
+ /* a &= (0x7f<<14)|(0x7f); */
+ a = a<<7;
+ a |= b;
+ s = s>>4;
+ *v = ((u64)s)<<32 | a;
+ return 8;
+ }
+
+ p++;
+ a = a<<15;
+ a |= *p;
+ /* a: p4<<29 | p6<<15 | p8 (unmasked) */
+
+ /* moved CSE2 up */
+ /* a &= (0x7f<<29)|(0x7f<<15)|(0xff); */
+ b &= SLOT_2_0;
+ b = b<<8;
+ a |= b;
+
+ s = s<<4;
+ b = p[-4];
+ b &= 0x7f;
+ b = b>>3;
+ s |= b;
+
+ *v = ((u64)s)<<32 | a;
+
+ return 9;
+}
+
+/*
+** Read a 32-bit variable-length integer from memory starting at p[0].
+** Return the number of bytes read. The value is stored in *v.
+**
+** If the varint stored in p[0] is larger than can fit in a 32-bit unsigned
+** integer, then set *v to 0xffffffff.
+**
+** A MACRO version, getVarint32, is provided which inlines the
+** single-byte case. All code should use the MACRO version as
+** this function assumes the single-byte case has already been handled.
+*/
+SQLITE_PRIVATE u8 sqlite3GetVarint32(const unsigned char *p, u32 *v){
+ u64 v64;
+ u8 n;
+
+ /* Assume that the single-byte case has already been handled by
+ ** the getVarint32() macro */
+ assert( (p[0] & 0x80)!=0 );
+
+ if( (p[1] & 0x80)==0 ){
+ /* This is the two-byte case */
+ *v = ((p[0]&0x7f)<<7) | p[1];
+ return 2;
+ }
+ if( (p[2] & 0x80)==0 ){
+ /* This is the three-byte case */
+ *v = ((p[0]&0x7f)<<14) | ((p[1]&0x7f)<<7) | p[2];
+ return 3;
+ }
+ /* four or more bytes */
+ n = sqlite3GetVarint(p, &v64);
+ assert( n>3 && n<=9 );
+ if( (v64 & SQLITE_MAX_U32)!=v64 ){
+ *v = 0xffffffff;
+ }else{
+ *v = (u32)v64;
+ }
+ return n;
+}
+
+/*
+** Return the number of bytes that will be needed to store the given
+** 64-bit integer.
+*/
+SQLITE_PRIVATE int sqlite3VarintLen(u64 v){
+ int i;
+ for(i=1; (v >>= 7)!=0; i++){ assert( i<10 ); }
+ return i;
+}
+
+
+/*
+** Read or write a four-byte big-endian integer value.
+*/
+SQLITE_PRIVATE u32 sqlite3Get4byte(const u8 *p){
+#if SQLITE_BYTEORDER==4321
+ u32 x;
+ memcpy(&x,p,4);
+ return x;
+#elif SQLITE_BYTEORDER==1234 && GCC_VERSION>=4003000
+ u32 x;
+ memcpy(&x,p,4);
+ return __builtin_bswap32(x);
+#elif SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
+ u32 x;
+ memcpy(&x,p,4);
+ return _byteswap_ulong(x);
+#else
+ testcase( p[0]&0x80 );
+ return ((unsigned)p[0]<<24) | (p[1]<<16) | (p[2]<<8) | p[3];
+#endif
+}
+SQLITE_PRIVATE void sqlite3Put4byte(unsigned char *p, u32 v){
+#if SQLITE_BYTEORDER==4321
+ memcpy(p,&v,4);
+#elif SQLITE_BYTEORDER==1234 && GCC_VERSION>=4003000
+ u32 x = __builtin_bswap32(v);
+ memcpy(p,&x,4);
+#elif SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
+ u32 x = _byteswap_ulong(v);
+ memcpy(p,&x,4);
+#else
+ p[0] = (u8)(v>>24);
+ p[1] = (u8)(v>>16);
+ p[2] = (u8)(v>>8);
+ p[3] = (u8)v;
+#endif
+}
+
+
+
+/*
+** Translate a single byte of Hex into an integer.
+** This routine only works if h really is a valid hexadecimal
+** character: 0..9a..fA..F
+*/
+SQLITE_PRIVATE u8 sqlite3HexToInt(int h){
+ assert( (h>='0' && h<='9') || (h>='a' && h<='f') || (h>='A' && h<='F') );
+#ifdef SQLITE_ASCII
+ h += 9*(1&(h>>6));
+#endif
+#ifdef SQLITE_EBCDIC
+ h += 9*(1&~(h>>4));
+#endif
+ return (u8)(h & 0xf);
+}
+
+#if !defined(SQLITE_OMIT_BLOB_LITERAL)
+/*
+** Convert a BLOB literal of the form "x'hhhhhh'" into its binary
+** value. Return a pointer to its binary value. Space to hold the
+** binary value has been obtained from malloc and must be freed by
+** the calling routine.
+*/
+SQLITE_PRIVATE void *sqlite3HexToBlob(sqlite3 *db, const char *z, int n){
+ char *zBlob;
+ int i;
+
+ zBlob = (char *)sqlite3DbMallocRawNN(db, n/2 + 1);
+ n--;
+ if( zBlob ){
+ for(i=0; i<n; i+=2){
+ zBlob[i/2] = (sqlite3HexToInt(z[i])<<4) | sqlite3HexToInt(z[i+1]);
+ }
+ zBlob[i/2] = 0;
+ }
+ return zBlob;
+}
+#endif /* !SQLITE_OMIT_BLOB_LITERAL */
+
+/*
+** Log an error that is an API call on a connection pointer that should
+** not have been used. The "type" of connection pointer is given as the
+** argument. The zType is a word like "NULL" or "closed" or "invalid".
+*/
+static void logBadConnection(const char *zType){
+ sqlite3_log(SQLITE_MISUSE,
+ "API call with %s database connection pointer",
+ zType
+ );
+}
+
+/*
+** Check to make sure we have a valid db pointer. This test is not
+** foolproof but it does provide some measure of protection against
+** misuse of the interface such as passing in db pointers that are
+** NULL or which have been previously closed. If this routine returns
+** 1 it means that the db pointer is valid and 0 if it should not be
+** dereferenced for any reason. The calling function should invoke
+** SQLITE_MISUSE immediately.
+**
+** sqlite3SafetyCheckOk() requires that the db pointer be valid for
+** use. sqlite3SafetyCheckSickOrOk() allows a db pointer that failed to
+** open properly and is not fit for general use but which can be
+** used as an argument to sqlite3_errmsg() or sqlite3_close().
+*/
+SQLITE_PRIVATE int sqlite3SafetyCheckOk(sqlite3 *db){
+ u8 eOpenState;
+ if( db==0 ){
+ logBadConnection("NULL");
+ return 0;
+ }
+ eOpenState = db->eOpenState;
+ if( eOpenState!=SQLITE_STATE_OPEN ){
+ if( sqlite3SafetyCheckSickOrOk(db) ){
+ testcase( sqlite3GlobalConfig.xLog!=0 );
+ logBadConnection("unopened");
+ }
+ return 0;
+ }else{
+ return 1;
+ }
+}
+SQLITE_PRIVATE int sqlite3SafetyCheckSickOrOk(sqlite3 *db){
+ u8 eOpenState;
+ eOpenState = db->eOpenState;
+ if( eOpenState!=SQLITE_STATE_SICK &&
+ eOpenState!=SQLITE_STATE_OPEN &&
+ eOpenState!=SQLITE_STATE_BUSY ){
+ testcase( sqlite3GlobalConfig.xLog!=0 );
+ logBadConnection("invalid");
+ return 0;
+ }else{
+ return 1;
+ }
+}
+
+/*
+** Attempt to add, subtract, or multiply the 64-bit signed value iB against
+** the other 64-bit signed integer at *pA and store the result in *pA.
+** Return 0 on success. Or if the operation would have resulted in an
+** overflow, leave *pA unchanged and return 1.
+*/
+SQLITE_PRIVATE int sqlite3AddInt64(i64 *pA, i64 iB){
+#if GCC_VERSION>=5004000 && !defined(__INTEL_COMPILER)
+ return __builtin_add_overflow(*pA, iB, pA);
+#else
+ i64 iA = *pA;
+ testcase( iA==0 ); testcase( iA==1 );
+ testcase( iB==-1 ); testcase( iB==0 );
+ if( iB>=0 ){
+ testcase( iA>0 && LARGEST_INT64 - iA == iB );
+ testcase( iA>0 && LARGEST_INT64 - iA == iB - 1 );
+ if( iA>0 && LARGEST_INT64 - iA < iB ) return 1;
+ }else{
+ testcase( iA<0 && -(iA + LARGEST_INT64) == iB + 1 );
+ testcase( iA<0 && -(iA + LARGEST_INT64) == iB + 2 );
+ if( iA<0 && -(iA + LARGEST_INT64) > iB + 1 ) return 1;
+ }
+ *pA += iB;
+ return 0;
+#endif
+}
+SQLITE_PRIVATE int sqlite3SubInt64(i64 *pA, i64 iB){
+#if GCC_VERSION>=5004000 && !defined(__INTEL_COMPILER)
+ return __builtin_sub_overflow(*pA, iB, pA);
+#else
+ testcase( iB==SMALLEST_INT64+1 );
+ if( iB==SMALLEST_INT64 ){
+ testcase( (*pA)==(-1) ); testcase( (*pA)==0 );
+ if( (*pA)>=0 ) return 1;
+ *pA -= iB;
+ return 0;
+ }else{
+ return sqlite3AddInt64(pA, -iB);
+ }
+#endif
+}
+SQLITE_PRIVATE int sqlite3MulInt64(i64 *pA, i64 iB){
+#if GCC_VERSION>=5004000 && !defined(__INTEL_COMPILER)
+ return __builtin_mul_overflow(*pA, iB, pA);
+#else
+ i64 iA = *pA;
+ if( iB>0 ){
+ if( iA>LARGEST_INT64/iB ) return 1;
+ if( iA<SMALLEST_INT64/iB ) return 1;
+ }else if( iB<0 ){
+ if( iA>0 ){
+ if( iB<SMALLEST_INT64/iA ) return 1;
+ }else if( iA<0 ){
+ if( iB==SMALLEST_INT64 ) return 1;
+ if( iA==SMALLEST_INT64 ) return 1;
+ if( -iA>LARGEST_INT64/-iB ) return 1;
+ }
+ }
+ *pA = iA*iB;
+ return 0;
+#endif
+}
+
+/*
+** Compute the absolute value of a 32-bit signed integer, of possible. Or
+** if the integer has a value of -2147483648, return +2147483647
+*/
+SQLITE_PRIVATE int sqlite3AbsInt32(int x){
+ if( x>=0 ) return x;
+ if( x==(int)0x80000000 ) return 0x7fffffff;
+ return -x;
+}
+
+#ifdef SQLITE_ENABLE_8_3_NAMES
+/*
+** If SQLITE_ENABLE_8_3_NAMES is set at compile-time and if the database
+** filename in zBaseFilename is a URI with the "8_3_names=1" parameter and
+** if filename in z[] has a suffix (a.k.a. "extension") that is longer than
+** three characters, then shorten the suffix on z[] to be the last three
+** characters of the original suffix.
+**
+** If SQLITE_ENABLE_8_3_NAMES is set to 2 at compile-time, then always
+** do the suffix shortening regardless of URI parameter.
+**
+** Examples:
+**
+** test.db-journal => test.nal
+** test.db-wal => test.wal
+** test.db-shm => test.shm
+** test.db-mj7f3319fa => test.9fa
+*/
+SQLITE_PRIVATE void sqlite3FileSuffix3(const char *zBaseFilename, char *z){
+#if SQLITE_ENABLE_8_3_NAMES<2
+ if( sqlite3_uri_boolean(zBaseFilename, "8_3_names", 0) )
+#endif
+ {
+ int i, sz;
+ sz = sqlite3Strlen30(z);
+ for(i=sz-1; i>0 && z[i]!='/' && z[i]!='.'; i--){}
+ if( z[i]=='.' && ALWAYS(sz>i+4) ) memmove(&z[i+1], &z[sz-3], 4);
+ }
+}
+#endif
+
+/*
+** Find (an approximate) sum of two LogEst values. This computation is
+** not a simple "+" operator because LogEst is stored as a logarithmic
+** value.
+**
+*/
+SQLITE_PRIVATE LogEst sqlite3LogEstAdd(LogEst a, LogEst b){
+ static const unsigned char x[] = {
+ 10, 10, /* 0,1 */
+ 9, 9, /* 2,3 */
+ 8, 8, /* 4,5 */
+ 7, 7, 7, /* 6,7,8 */
+ 6, 6, 6, /* 9,10,11 */
+ 5, 5, 5, /* 12-14 */
+ 4, 4, 4, 4, /* 15-18 */
+ 3, 3, 3, 3, 3, 3, /* 19-24 */
+ 2, 2, 2, 2, 2, 2, 2, /* 25-31 */
+ };
+ if( a>=b ){
+ if( a>b+49 ) return a;
+ if( a>b+31 ) return a+1;
+ return a+x[a-b];
+ }else{
+ if( b>a+49 ) return b;
+ if( b>a+31 ) return b+1;
+ return b+x[b-a];
+ }
+}
+
+/*
+** Convert an integer into a LogEst. In other words, compute an
+** approximation for 10*log2(x).
+*/
+SQLITE_PRIVATE LogEst sqlite3LogEst(u64 x){
+ static LogEst a[] = { 0, 2, 3, 5, 6, 7, 8, 9 };
+ LogEst y = 40;
+ if( x<8 ){
+ if( x<2 ) return 0;
+ while( x<8 ){ y -= 10; x <<= 1; }
+ }else{
+#if GCC_VERSION>=5004000
+ int i = 60 - __builtin_clzll(x);
+ y += i*10;
+ x >>= i;
+#else
+ while( x>255 ){ y += 40; x >>= 4; } /*OPTIMIZATION-IF-TRUE*/
+ while( x>15 ){ y += 10; x >>= 1; }
+#endif
+ }
+ return a[x&7] + y - 10;
+}
+
+/*
+** Convert a double into a LogEst
+** In other words, compute an approximation for 10*log2(x).
+*/
+SQLITE_PRIVATE LogEst sqlite3LogEstFromDouble(double x){
+ u64 a;
+ LogEst e;
+ assert( sizeof(x)==8 && sizeof(a)==8 );
+ if( x<=1 ) return 0;
+ if( x<=2000000000 ) return sqlite3LogEst((u64)x);
+ memcpy(&a, &x, 8);
+ e = (a>>52) - 1022;
+ return e*10;
+}
+
+/*
+** Convert a LogEst into an integer.
+*/
+SQLITE_PRIVATE u64 sqlite3LogEstToInt(LogEst x){
+ u64 n;
+ n = x%10;
+ x /= 10;
+ if( n>=5 ) n -= 2;
+ else if( n>=1 ) n -= 1;
+ if( x>60 ) return (u64)LARGEST_INT64;
+ return x>=3 ? (n+8)<<(x-3) : (n+8)>>(3-x);
+}
+
+/*
+** Add a new name/number pair to a VList. This might require that the
+** VList object be reallocated, so return the new VList. If an OOM
+** error occurs, the original VList returned and the
+** db->mallocFailed flag is set.
+**
+** A VList is really just an array of integers. To destroy a VList,
+** simply pass it to sqlite3DbFree().
+**
+** The first integer is the number of integers allocated for the whole
+** VList. The second integer is the number of integers actually used.
+** Each name/number pair is encoded by subsequent groups of 3 or more
+** integers.
+**
+** Each name/number pair starts with two integers which are the numeric
+** value for the pair and the size of the name/number pair, respectively.
+** The text name overlays one or more following integers. The text name
+** is always zero-terminated.
+**
+** Conceptually:
+**
+** struct VList {
+** int nAlloc; // Number of allocated slots
+** int nUsed; // Number of used slots
+** struct VListEntry {
+** int iValue; // Value for this entry
+** int nSlot; // Slots used by this entry
+** // ... variable name goes here
+** } a[0];
+** }
+**
+** During code generation, pointers to the variable names within the
+** VList are taken. When that happens, nAlloc is set to zero as an
+** indication that the VList may never again be enlarged, since the
+** accompanying realloc() would invalidate the pointers.
+*/
+SQLITE_PRIVATE VList *sqlite3VListAdd(
+ sqlite3 *db, /* The database connection used for malloc() */
+ VList *pIn, /* The input VList. Might be NULL */
+ const char *zName, /* Name of symbol to add */
+ int nName, /* Bytes of text in zName */
+ int iVal /* Value to associate with zName */
+){
+ int nInt; /* number of sizeof(int) objects needed for zName */
+ char *z; /* Pointer to where zName will be stored */
+ int i; /* Index in pIn[] where zName is stored */
+
+ nInt = nName/4 + 3;
+ assert( pIn==0 || pIn[0]>=3 ); /* Verify ok to add new elements */
+ if( pIn==0 || pIn[1]+nInt > pIn[0] ){
+ /* Enlarge the allocation */
+ sqlite3_int64 nAlloc = (pIn ? 2*(sqlite3_int64)pIn[0] : 10) + nInt;
+ VList *pOut = sqlite3DbRealloc(db, pIn, nAlloc*sizeof(int));
+ if( pOut==0 ) return pIn;
+ if( pIn==0 ) pOut[1] = 2;
+ pIn = pOut;
+ pIn[0] = nAlloc;
+ }
+ i = pIn[1];
+ pIn[i] = iVal;
+ pIn[i+1] = nInt;
+ z = (char*)&pIn[i+2];
+ pIn[1] = i+nInt;
+ assert( pIn[1]<=pIn[0] );
+ memcpy(z, zName, nName);
+ z[nName] = 0;
+ return pIn;
+}
+
+/*
+** Return a pointer to the name of a variable in the given VList that
+** has the value iVal. Or return a NULL if there is no such variable in
+** the list
+*/
+SQLITE_PRIVATE const char *sqlite3VListNumToName(VList *pIn, int iVal){
+ int i, mx;
+ if( pIn==0 ) return 0;
+ mx = pIn[1];
+ i = 2;
+ do{
+ if( pIn[i]==iVal ) return (char*)&pIn[i+2];
+ i += pIn[i+1];
+ }while( i<mx );
+ return 0;
+}
+
+/*
+** Return the number of the variable named zName, if it is in VList.
+** or return 0 if there is no such variable.
+*/
+SQLITE_PRIVATE int sqlite3VListNameToNum(VList *pIn, const char *zName, int nName){
+ int i, mx;
+ if( pIn==0 ) return 0;
+ mx = pIn[1];
+ i = 2;
+ do{
+ const char *z = (const char*)&pIn[i+2];
+ if( strncmp(z,zName,nName)==0 && z[nName]==0 ) return pIn[i];
+ i += pIn[i+1];
+ }while( i<mx );
+ return 0;
+}
+
+/************** End of util.c ************************************************/
+/************** Begin file hash.c ********************************************/
+/*
+** 2001 September 22
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This is the implementation of generic hash-tables
+** used in SQLite.
+*/
+/* #include "sqliteInt.h" */
+/* #include <assert.h> */
+
+/* Turn bulk memory into a hash table object by initializing the
+** fields of the Hash structure.
+**
+** "pNew" is a pointer to the hash table that is to be initialized.
+*/
+SQLITE_PRIVATE void sqlite3HashInit(Hash *pNew){
+ assert( pNew!=0 );
+ pNew->first = 0;
+ pNew->count = 0;
+ pNew->htsize = 0;
+ pNew->ht = 0;
+}
+
+/* Remove all entries from a hash table. Reclaim all memory.
+** Call this routine to delete a hash table or to reset a hash table
+** to the empty state.
+*/
+SQLITE_PRIVATE void sqlite3HashClear(Hash *pH){
+ HashElem *elem; /* For looping over all elements of the table */
+
+ assert( pH!=0 );
+ elem = pH->first;
+ pH->first = 0;
+ sqlite3_free(pH->ht);
+ pH->ht = 0;
+ pH->htsize = 0;
+ while( elem ){
+ HashElem *next_elem = elem->next;
+ sqlite3_free(elem);
+ elem = next_elem;
+ }
+ pH->count = 0;
+}
+
+/*
+** The hashing function.
+*/
+static unsigned int strHash(const char *z){
+ unsigned int h = 0;
+ unsigned char c;
+ while( (c = (unsigned char)*z++)!=0 ){ /*OPTIMIZATION-IF-TRUE*/
+ /* Knuth multiplicative hashing. (Sorting & Searching, p. 510).
+ ** 0x9e3779b1 is 2654435761 which is the closest prime number to
+ ** (2**32)*golden_ratio, where golden_ratio = (sqrt(5) - 1)/2. */
+ h += sqlite3UpperToLower[c];
+ h *= 0x9e3779b1;
+ }
+ return h;
+}
+
+
+/* Link pNew element into the hash table pH. If pEntry!=0 then also
+** insert pNew into the pEntry hash bucket.
+*/
+static void insertElement(
+ Hash *pH, /* The complete hash table */
+ struct _ht *pEntry, /* The entry into which pNew is inserted */
+ HashElem *pNew /* The element to be inserted */
+){
+ HashElem *pHead; /* First element already in pEntry */
+ if( pEntry ){
+ pHead = pEntry->count ? pEntry->chain : 0;
+ pEntry->count++;
+ pEntry->chain = pNew;
+ }else{
+ pHead = 0;
+ }
+ if( pHead ){
+ pNew->next = pHead;
+ pNew->prev = pHead->prev;
+ if( pHead->prev ){ pHead->prev->next = pNew; }
+ else { pH->first = pNew; }
+ pHead->prev = pNew;
+ }else{
+ pNew->next = pH->first;
+ if( pH->first ){ pH->first->prev = pNew; }
+ pNew->prev = 0;
+ pH->first = pNew;
+ }
+}
+
+
+/* Resize the hash table so that it contains "new_size" buckets.
+**
+** The hash table might fail to resize if sqlite3_malloc() fails or
+** if the new size is the same as the prior size.
+** Return TRUE if the resize occurs and false if not.
+*/
+static int rehash(Hash *pH, unsigned int new_size){
+ struct _ht *new_ht; /* The new hash table */
+ HashElem *elem, *next_elem; /* For looping over existing elements */
+
+#if SQLITE_MALLOC_SOFT_LIMIT>0
+ if( new_size*sizeof(struct _ht)>SQLITE_MALLOC_SOFT_LIMIT ){
+ new_size = SQLITE_MALLOC_SOFT_LIMIT/sizeof(struct _ht);
+ }
+ if( new_size==pH->htsize ) return 0;
+#endif
+
+ /* The inability to allocates space for a larger hash table is
+ ** a performance hit but it is not a fatal error. So mark the
+ ** allocation as a benign. Use sqlite3Malloc()/memset(0) instead of
+ ** sqlite3MallocZero() to make the allocation, as sqlite3MallocZero()
+ ** only zeroes the requested number of bytes whereas this module will
+ ** use the actual amount of space allocated for the hash table (which
+ ** may be larger than the requested amount).
+ */
+ sqlite3BeginBenignMalloc();
+ new_ht = (struct _ht *)sqlite3Malloc( new_size*sizeof(struct _ht) );
+ sqlite3EndBenignMalloc();
+
+ if( new_ht==0 ) return 0;
+ sqlite3_free(pH->ht);
+ pH->ht = new_ht;
+ pH->htsize = new_size = sqlite3MallocSize(new_ht)/sizeof(struct _ht);
+ memset(new_ht, 0, new_size*sizeof(struct _ht));
+ for(elem=pH->first, pH->first=0; elem; elem = next_elem){
+ unsigned int h = strHash(elem->pKey) % new_size;
+ next_elem = elem->next;
+ insertElement(pH, &new_ht[h], elem);
+ }
+ return 1;
+}
+
+/* This function (for internal use only) locates an element in an
+** hash table that matches the given key. If no element is found,
+** a pointer to a static null element with HashElem.data==0 is returned.
+** If pH is not NULL, then the hash for this key is written to *pH.
+*/
+static HashElem *findElementWithHash(
+ const Hash *pH, /* The pH to be searched */
+ const char *pKey, /* The key we are searching for */
+ unsigned int *pHash /* Write the hash value here */
+){
+ HashElem *elem; /* Used to loop thru the element list */
+ unsigned int count; /* Number of elements left to test */
+ unsigned int h; /* The computed hash */
+ static HashElem nullElement = { 0, 0, 0, 0 };
+
+ if( pH->ht ){ /*OPTIMIZATION-IF-TRUE*/
+ struct _ht *pEntry;
+ h = strHash(pKey) % pH->htsize;
+ pEntry = &pH->ht[h];
+ elem = pEntry->chain;
+ count = pEntry->count;
+ }else{
+ h = 0;
+ elem = pH->first;
+ count = pH->count;
+ }
+ if( pHash ) *pHash = h;
+ while( count ){
+ assert( elem!=0 );
+ if( sqlite3StrICmp(elem->pKey,pKey)==0 ){
+ return elem;
+ }
+ elem = elem->next;
+ count--;
+ }
+ return &nullElement;
+}
+
+/* Remove a single entry from the hash table given a pointer to that
+** element and a hash on the element's key.
+*/
+static void removeElementGivenHash(
+ Hash *pH, /* The pH containing "elem" */
+ HashElem* elem, /* The element to be removed from the pH */
+ unsigned int h /* Hash value for the element */
+){
+ struct _ht *pEntry;
+ if( elem->prev ){
+ elem->prev->next = elem->next;
+ }else{
+ pH->first = elem->next;
+ }
+ if( elem->next ){
+ elem->next->prev = elem->prev;
+ }
+ if( pH->ht ){
+ pEntry = &pH->ht[h];
+ if( pEntry->chain==elem ){
+ pEntry->chain = elem->next;
+ }
+ assert( pEntry->count>0 );
+ pEntry->count--;
+ }
+ sqlite3_free( elem );
+ pH->count--;
+ if( pH->count==0 ){
+ assert( pH->first==0 );
+ assert( pH->count==0 );
+ sqlite3HashClear(pH);
+ }
+}
+
+/* Attempt to locate an element of the hash table pH with a key
+** that matches pKey. Return the data for this element if it is
+** found, or NULL if there is no match.
+*/
+SQLITE_PRIVATE void *sqlite3HashFind(const Hash *pH, const char *pKey){
+ assert( pH!=0 );
+ assert( pKey!=0 );
+ return findElementWithHash(pH, pKey, 0)->data;
+}
+
+/* Insert an element into the hash table pH. The key is pKey
+** and the data is "data".
+**
+** If no element exists with a matching key, then a new
+** element is created and NULL is returned.
+**
+** If another element already exists with the same key, then the
+** new data replaces the old data and the old data is returned.
+** The key is not copied in this instance. If a malloc fails, then
+** the new data is returned and the hash table is unchanged.
+**
+** If the "data" parameter to this function is NULL, then the
+** element corresponding to "key" is removed from the hash table.
+*/
+SQLITE_PRIVATE void *sqlite3HashInsert(Hash *pH, const char *pKey, void *data){
+ unsigned int h; /* the hash of the key modulo hash table size */
+ HashElem *elem; /* Used to loop thru the element list */
+ HashElem *new_elem; /* New element added to the pH */
+
+ assert( pH!=0 );
+ assert( pKey!=0 );
+ elem = findElementWithHash(pH,pKey,&h);
+ if( elem->data ){
+ void *old_data = elem->data;
+ if( data==0 ){
+ removeElementGivenHash(pH,elem,h);
+ }else{
+ elem->data = data;
+ elem->pKey = pKey;
+ }
+ return old_data;
+ }
+ if( data==0 ) return 0;
+ new_elem = (HashElem*)sqlite3Malloc( sizeof(HashElem) );
+ if( new_elem==0 ) return data;
+ new_elem->pKey = pKey;
+ new_elem->data = data;
+ pH->count++;
+ if( pH->count>=10 && pH->count > 2*pH->htsize ){
+ if( rehash(pH, pH->count*2) ){
+ assert( pH->htsize>0 );
+ h = strHash(pKey) % pH->htsize;
+ }
+ }
+ insertElement(pH, pH->ht ? &pH->ht[h] : 0, new_elem);
+ return 0;
+}
+
+/************** End of hash.c ************************************************/
+/************** Begin file opcodes.c *****************************************/
+/* Automatically generated. Do not edit */
+/* See the tool/mkopcodec.tcl script for details. */
+#if !defined(SQLITE_OMIT_EXPLAIN) \
+ || defined(VDBE_PROFILE) \
+ || defined(SQLITE_DEBUG)
+#if defined(SQLITE_ENABLE_EXPLAIN_COMMENTS) || defined(SQLITE_DEBUG)
+# define OpHelp(X) "\0" X
+#else
+# define OpHelp(X)
+#endif
+SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){
+ static const char *const azName[] = {
+ /* 0 */ "Savepoint" OpHelp(""),
+ /* 1 */ "AutoCommit" OpHelp(""),
+ /* 2 */ "Transaction" OpHelp(""),
+ /* 3 */ "Checkpoint" OpHelp(""),
+ /* 4 */ "JournalMode" OpHelp(""),
+ /* 5 */ "Vacuum" OpHelp(""),
+ /* 6 */ "VFilter" OpHelp("iplan=r[P3] zplan='P4'"),
+ /* 7 */ "VUpdate" OpHelp("data=r[P3@P2]"),
+ /* 8 */ "Init" OpHelp("Start at P2"),
+ /* 9 */ "Goto" OpHelp(""),
+ /* 10 */ "Gosub" OpHelp(""),
+ /* 11 */ "InitCoroutine" OpHelp(""),
+ /* 12 */ "Yield" OpHelp(""),
+ /* 13 */ "MustBeInt" OpHelp(""),
+ /* 14 */ "Jump" OpHelp(""),
+ /* 15 */ "Once" OpHelp(""),
+ /* 16 */ "If" OpHelp(""),
+ /* 17 */ "IfNot" OpHelp(""),
+ /* 18 */ "IsType" OpHelp("if typeof(P1.P3) in P5 goto P2"),
+ /* 19 */ "Not" OpHelp("r[P2]= !r[P1]"),
+ /* 20 */ "IfNullRow" OpHelp("if P1.nullRow then r[P3]=NULL, goto P2"),
+ /* 21 */ "SeekLT" OpHelp("key=r[P3@P4]"),
+ /* 22 */ "SeekLE" OpHelp("key=r[P3@P4]"),
+ /* 23 */ "SeekGE" OpHelp("key=r[P3@P4]"),
+ /* 24 */ "SeekGT" OpHelp("key=r[P3@P4]"),
+ /* 25 */ "IfNotOpen" OpHelp("if( !csr[P1] ) goto P2"),
+ /* 26 */ "IfNoHope" OpHelp("key=r[P3@P4]"),
+ /* 27 */ "NoConflict" OpHelp("key=r[P3@P4]"),
+ /* 28 */ "NotFound" OpHelp("key=r[P3@P4]"),
+ /* 29 */ "Found" OpHelp("key=r[P3@P4]"),
+ /* 30 */ "SeekRowid" OpHelp("intkey=r[P3]"),
+ /* 31 */ "NotExists" OpHelp("intkey=r[P3]"),
+ /* 32 */ "Last" OpHelp(""),
+ /* 33 */ "IfSizeBetween" OpHelp(""),
+ /* 34 */ "SorterSort" OpHelp(""),
+ /* 35 */ "Sort" OpHelp(""),
+ /* 36 */ "Rewind" OpHelp(""),
+ /* 37 */ "SorterNext" OpHelp(""),
+ /* 38 */ "Prev" OpHelp(""),
+ /* 39 */ "Next" OpHelp(""),
+ /* 40 */ "IdxLE" OpHelp("key=r[P3@P4]"),
+ /* 41 */ "IdxGT" OpHelp("key=r[P3@P4]"),
+ /* 42 */ "IdxLT" OpHelp("key=r[P3@P4]"),
+ /* 43 */ "Or" OpHelp("r[P3]=(r[P1] || r[P2])"),
+ /* 44 */ "And" OpHelp("r[P3]=(r[P1] && r[P2])"),
+ /* 45 */ "IdxGE" OpHelp("key=r[P3@P4]"),
+ /* 46 */ "RowSetRead" OpHelp("r[P3]=rowset(P1)"),
+ /* 47 */ "RowSetTest" OpHelp("if r[P3] in rowset(P1) goto P2"),
+ /* 48 */ "Program" OpHelp(""),
+ /* 49 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"),
+ /* 50 */ "IfPos" OpHelp("if r[P1]>0 then r[P1]-=P3, goto P2"),
+ /* 51 */ "IsNull" OpHelp("if r[P1]==NULL goto P2"),
+ /* 52 */ "NotNull" OpHelp("if r[P1]!=NULL goto P2"),
+ /* 53 */ "Ne" OpHelp("IF r[P3]!=r[P1]"),
+ /* 54 */ "Eq" OpHelp("IF r[P3]==r[P1]"),
+ /* 55 */ "Gt" OpHelp("IF r[P3]>r[P1]"),
+ /* 56 */ "Le" OpHelp("IF r[P3]<=r[P1]"),
+ /* 57 */ "Lt" OpHelp("IF r[P3]<r[P1]"),
+ /* 58 */ "Ge" OpHelp("IF r[P3]>=r[P1]"),
+ /* 59 */ "ElseEq" OpHelp(""),
+ /* 60 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]--, goto P2"),
+ /* 61 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"),
+ /* 62 */ "IncrVacuum" OpHelp(""),
+ /* 63 */ "VNext" OpHelp(""),
+ /* 64 */ "Filter" OpHelp("if key(P3@P4) not in filter(P1) goto P2"),
+ /* 65 */ "PureFunc" OpHelp("r[P3]=func(r[P2@NP])"),
+ /* 66 */ "Function" OpHelp("r[P3]=func(r[P2@NP])"),
+ /* 67 */ "Return" OpHelp(""),
+ /* 68 */ "EndCoroutine" OpHelp(""),
+ /* 69 */ "HaltIfNull" OpHelp("if r[P3]=null halt"),
+ /* 70 */ "Halt" OpHelp(""),
+ /* 71 */ "Integer" OpHelp("r[P2]=P1"),
+ /* 72 */ "Int64" OpHelp("r[P2]=P4"),
+ /* 73 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
+ /* 74 */ "BeginSubrtn" OpHelp("r[P2]=NULL"),
+ /* 75 */ "Null" OpHelp("r[P2..P3]=NULL"),
+ /* 76 */ "SoftNull" OpHelp("r[P1]=NULL"),
+ /* 77 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"),
+ /* 78 */ "Variable" OpHelp("r[P2]=parameter(P1)"),
+ /* 79 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"),
+ /* 80 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"),
+ /* 81 */ "SCopy" OpHelp("r[P2]=r[P1]"),
+ /* 82 */ "IntCopy" OpHelp("r[P2]=r[P1]"),
+ /* 83 */ "FkCheck" OpHelp(""),
+ /* 84 */ "ResultRow" OpHelp("output=r[P1@P2]"),
+ /* 85 */ "CollSeq" OpHelp(""),
+ /* 86 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
+ /* 87 */ "RealAffinity" OpHelp(""),
+ /* 88 */ "Cast" OpHelp("affinity(r[P1])"),
+ /* 89 */ "Permutation" OpHelp(""),
+ /* 90 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"),
+ /* 91 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"),
+ /* 92 */ "ZeroOrNull" OpHelp("r[P2] = 0 OR NULL"),
+ /* 93 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"),
+ /* 94 */ "Column" OpHelp("r[P3]=PX cursor P1 column P2"),
+ /* 95 */ "TypeCheck" OpHelp("typecheck(r[P1@P2])"),
+ /* 96 */ "Affinity" OpHelp("affinity(r[P1@P2])"),
+ /* 97 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"),
+ /* 98 */ "Count" OpHelp("r[P2]=count()"),
+ /* 99 */ "ReadCookie" OpHelp(""),
+ /* 100 */ "SetCookie" OpHelp(""),
+ /* 101 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"),
+ /* 102 */ "OpenRead" OpHelp("root=P2 iDb=P3"),
+ /* 103 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"),
+ /* 104 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"),
+ /* 105 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"),
+ /* 106 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"),
+ /* 107 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"),
+ /* 108 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"),
+ /* 109 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"),
+ /* 110 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
+ /* 111 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
+ /* 112 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
+ /* 113 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
+ /* 114 */ "OpenDup" OpHelp(""),
+ /* 115 */ "BitNot" OpHelp("r[P2]= ~r[P1]"),
+ /* 116 */ "OpenAutoindex" OpHelp("nColumn=P2"),
+ /* 117 */ "OpenEphemeral" OpHelp("nColumn=P2"),
+ /* 118 */ "String8" OpHelp("r[P2]='P4'"),
+ /* 119 */ "SorterOpen" OpHelp(""),
+ /* 120 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
+ /* 121 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
+ /* 122 */ "Close" OpHelp(""),
+ /* 123 */ "ColumnsUsed" OpHelp(""),
+ /* 124 */ "SeekScan" OpHelp("Scan-ahead up to P1 rows"),
+ /* 125 */ "SeekHit" OpHelp("set P2<=seekHit<=P3"),
+ /* 126 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
+ /* 127 */ "NewRowid" OpHelp("r[P2]=rowid"),
+ /* 128 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
+ /* 129 */ "RowCell" OpHelp(""),
+ /* 130 */ "Delete" OpHelp(""),
+ /* 131 */ "ResetCount" OpHelp(""),
+ /* 132 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
+ /* 133 */ "SorterData" OpHelp("r[P2]=data"),
+ /* 134 */ "RowData" OpHelp("r[P2]=data"),
+ /* 135 */ "Rowid" OpHelp("r[P2]=PX rowid of P1"),
+ /* 136 */ "NullRow" OpHelp(""),
+ /* 137 */ "SeekEnd" OpHelp(""),
+ /* 138 */ "IdxInsert" OpHelp("key=r[P2]"),
+ /* 139 */ "SorterInsert" OpHelp("key=r[P2]"),
+ /* 140 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
+ /* 141 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
+ /* 142 */ "IdxRowid" OpHelp("r[P2]=rowid"),
+ /* 143 */ "FinishSeek" OpHelp(""),
+ /* 144 */ "Destroy" OpHelp(""),
+ /* 145 */ "Clear" OpHelp(""),
+ /* 146 */ "ResetSorter" OpHelp(""),
+ /* 147 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
+ /* 148 */ "SqlExec" OpHelp(""),
+ /* 149 */ "ParseSchema" OpHelp(""),
+ /* 150 */ "LoadAnalysis" OpHelp(""),
+ /* 151 */ "DropTable" OpHelp(""),
+ /* 152 */ "DropIndex" OpHelp(""),
+ /* 153 */ "DropTrigger" OpHelp(""),
+ /* 154 */ "Real" OpHelp("r[P2]=P4"),
+ /* 155 */ "IntegrityCk" OpHelp(""),
+ /* 156 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
+ /* 157 */ "Param" OpHelp(""),
+ /* 158 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
+ /* 159 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
+ /* 160 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
+ /* 161 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"),
+ /* 162 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
+ /* 163 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"),
+ /* 164 */ "AggValue" OpHelp("r[P3]=value N=P2"),
+ /* 165 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
+ /* 166 */ "Expire" OpHelp(""),
+ /* 167 */ "CursorLock" OpHelp(""),
+ /* 168 */ "CursorUnlock" OpHelp(""),
+ /* 169 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
+ /* 170 */ "VBegin" OpHelp(""),
+ /* 171 */ "VCreate" OpHelp(""),
+ /* 172 */ "VDestroy" OpHelp(""),
+ /* 173 */ "VOpen" OpHelp(""),
+ /* 174 */ "VCheck" OpHelp(""),
+ /* 175 */ "VInitIn" OpHelp("r[P2]=ValueList(P1,P3)"),
+ /* 176 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
+ /* 177 */ "VRename" OpHelp(""),
+ /* 178 */ "Pagecount" OpHelp(""),
+ /* 179 */ "MaxPgcnt" OpHelp(""),
+ /* 180 */ "ClrSubtype" OpHelp("r[P1].subtype = 0"),
+ /* 181 */ "GetSubtype" OpHelp("r[P2] = r[P1].subtype"),
+ /* 182 */ "SetSubtype" OpHelp("r[P2].subtype = r[P1]"),
+ /* 183 */ "FilterAdd" OpHelp("filter(P1) += key(P3@P4)"),
+ /* 184 */ "Trace" OpHelp(""),
+ /* 185 */ "CursorHint" OpHelp(""),
+ /* 186 */ "ReleaseReg" OpHelp("release r[P1@P2] mask P3"),
+ /* 187 */ "Noop" OpHelp(""),
+ /* 188 */ "Explain" OpHelp(""),
+ /* 189 */ "Abortable" OpHelp(""),
+ };
+ return azName[i];
+}
+#endif
+
+/************** End of opcodes.c *********************************************/
+/************** Begin file os_kv.c *******************************************/
+/*
+** 2022-09-06
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+******************************************************************************
+**
+** This file contains an experimental VFS layer that operates on a
+** Key/Value storage engine where both keys and values must be pure
+** text.
+*/
+/* #include <sqliteInt.h> */
+#if SQLITE_OS_KV || (SQLITE_OS_UNIX && defined(SQLITE_OS_KV_OPTIONAL))
+
+/*****************************************************************************
+** Debugging logic
+*/
+
+/* SQLITE_KV_TRACE() is used for tracing calls to kvstorage routines. */
+#if 0
+#define SQLITE_KV_TRACE(X) printf X
+#else
+#define SQLITE_KV_TRACE(X)
+#endif
+
+/* SQLITE_KV_LOG() is used for tracing calls to the VFS interface */
+#if 0
+#define SQLITE_KV_LOG(X) printf X
+#else
+#define SQLITE_KV_LOG(X)
+#endif
+
+
+/*
+** Forward declaration of objects used by this VFS implementation
+*/
+typedef struct KVVfsFile KVVfsFile;
+
+/* A single open file. There are only two files represented by this
+** VFS - the database and the rollback journal.
+*/
+struct KVVfsFile {
+ sqlite3_file base; /* IO methods */
+ const char *zClass; /* Storage class */
+ int isJournal; /* True if this is a journal file */
+ unsigned int nJrnl; /* Space allocated for aJrnl[] */
+ char *aJrnl; /* Journal content */
+ int szPage; /* Last known page size */
+ sqlite3_int64 szDb; /* Database file size. -1 means unknown */
+ char *aData; /* Buffer to hold page data */
+};
+#define SQLITE_KVOS_SZ 133073
+
+/*
+** Methods for KVVfsFile
+*/
+static int kvvfsClose(sqlite3_file*);
+static int kvvfsReadDb(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst);
+static int kvvfsReadJrnl(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst);
+static int kvvfsWriteDb(sqlite3_file*,const void*,int iAmt, sqlite3_int64);
+static int kvvfsWriteJrnl(sqlite3_file*,const void*,int iAmt, sqlite3_int64);
+static int kvvfsTruncateDb(sqlite3_file*, sqlite3_int64 size);
+static int kvvfsTruncateJrnl(sqlite3_file*, sqlite3_int64 size);
+static int kvvfsSyncDb(sqlite3_file*, int flags);
+static int kvvfsSyncJrnl(sqlite3_file*, int flags);
+static int kvvfsFileSizeDb(sqlite3_file*, sqlite3_int64 *pSize);
+static int kvvfsFileSizeJrnl(sqlite3_file*, sqlite3_int64 *pSize);
+static int kvvfsLock(sqlite3_file*, int);
+static int kvvfsUnlock(sqlite3_file*, int);
+static int kvvfsCheckReservedLock(sqlite3_file*, int *pResOut);
+static int kvvfsFileControlDb(sqlite3_file*, int op, void *pArg);
+static int kvvfsFileControlJrnl(sqlite3_file*, int op, void *pArg);
+static int kvvfsSectorSize(sqlite3_file*);
+static int kvvfsDeviceCharacteristics(sqlite3_file*);
+
+/*
+** Methods for sqlite3_vfs
+*/
+static int kvvfsOpen(sqlite3_vfs*, const char *, sqlite3_file*, int , int *);
+static int kvvfsDelete(sqlite3_vfs*, const char *zName, int syncDir);
+static int kvvfsAccess(sqlite3_vfs*, const char *zName, int flags, int *);
+static int kvvfsFullPathname(sqlite3_vfs*, const char *zName, int, char *zOut);
+static void *kvvfsDlOpen(sqlite3_vfs*, const char *zFilename);
+static int kvvfsRandomness(sqlite3_vfs*, int nByte, char *zOut);
+static int kvvfsSleep(sqlite3_vfs*, int microseconds);
+static int kvvfsCurrentTime(sqlite3_vfs*, double*);
+static int kvvfsCurrentTimeInt64(sqlite3_vfs*, sqlite3_int64*);
+
+static sqlite3_vfs sqlite3OsKvvfsObject = {
+ 1, /* iVersion */
+ sizeof(KVVfsFile), /* szOsFile */
+ 1024, /* mxPathname */
+ 0, /* pNext */
+ "kvvfs", /* zName */
+ 0, /* pAppData */
+ kvvfsOpen, /* xOpen */
+ kvvfsDelete, /* xDelete */
+ kvvfsAccess, /* xAccess */
+ kvvfsFullPathname, /* xFullPathname */
+ kvvfsDlOpen, /* xDlOpen */
+ 0, /* xDlError */
+ 0, /* xDlSym */
+ 0, /* xDlClose */
+ kvvfsRandomness, /* xRandomness */
+ kvvfsSleep, /* xSleep */
+ kvvfsCurrentTime, /* xCurrentTime */
+ 0, /* xGetLastError */
+ kvvfsCurrentTimeInt64 /* xCurrentTimeInt64 */
+};
+
+/* Methods for sqlite3_file objects referencing a database file
+*/
+static sqlite3_io_methods kvvfs_db_io_methods = {
+ 1, /* iVersion */
+ kvvfsClose, /* xClose */
+ kvvfsReadDb, /* xRead */
+ kvvfsWriteDb, /* xWrite */
+ kvvfsTruncateDb, /* xTruncate */
+ kvvfsSyncDb, /* xSync */
+ kvvfsFileSizeDb, /* xFileSize */
+ kvvfsLock, /* xLock */
+ kvvfsUnlock, /* xUnlock */
+ kvvfsCheckReservedLock, /* xCheckReservedLock */
+ kvvfsFileControlDb, /* xFileControl */
+ kvvfsSectorSize, /* xSectorSize */
+ kvvfsDeviceCharacteristics, /* xDeviceCharacteristics */
+ 0, /* xShmMap */
+ 0, /* xShmLock */
+ 0, /* xShmBarrier */
+ 0, /* xShmUnmap */
+ 0, /* xFetch */
+ 0 /* xUnfetch */
+};
+
+/* Methods for sqlite3_file objects referencing a rollback journal
+*/
+static sqlite3_io_methods kvvfs_jrnl_io_methods = {
+ 1, /* iVersion */
+ kvvfsClose, /* xClose */
+ kvvfsReadJrnl, /* xRead */
+ kvvfsWriteJrnl, /* xWrite */
+ kvvfsTruncateJrnl, /* xTruncate */
+ kvvfsSyncJrnl, /* xSync */
+ kvvfsFileSizeJrnl, /* xFileSize */
+ kvvfsLock, /* xLock */
+ kvvfsUnlock, /* xUnlock */
+ kvvfsCheckReservedLock, /* xCheckReservedLock */
+ kvvfsFileControlJrnl, /* xFileControl */
+ kvvfsSectorSize, /* xSectorSize */
+ kvvfsDeviceCharacteristics, /* xDeviceCharacteristics */
+ 0, /* xShmMap */
+ 0, /* xShmLock */
+ 0, /* xShmBarrier */
+ 0, /* xShmUnmap */
+ 0, /* xFetch */
+ 0 /* xUnfetch */
+};
+
+/****** Storage subsystem **************************************************/
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+/* Forward declarations for the low-level storage engine
+*/
+static int kvstorageWrite(const char*, const char *zKey, const char *zData);
+static int kvstorageDelete(const char*, const char *zKey);
+static int kvstorageRead(const char*, const char *zKey, char *zBuf, int nBuf);
+#define KVSTORAGE_KEY_SZ 32
+
+/* Expand the key name with an appropriate prefix and put the result
+** zKeyOut[]. The zKeyOut[] buffer is assumed to hold at least
+** KVSTORAGE_KEY_SZ bytes.
+*/
+static void kvstorageMakeKey(
+ const char *zClass,
+ const char *zKeyIn,
+ char *zKeyOut
+){
+ sqlite3_snprintf(KVSTORAGE_KEY_SZ, zKeyOut, "kvvfs-%s-%s", zClass, zKeyIn);
+}
+
+/* Write content into a key. zClass is the particular namespace of the
+** underlying key/value store to use - either "local" or "session".
+**
+** Both zKey and zData are zero-terminated pure text strings.
+**
+** Return the number of errors.
+*/
+static int kvstorageWrite(
+ const char *zClass,
+ const char *zKey,
+ const char *zData
+){
+ FILE *fd;
+ char zXKey[KVSTORAGE_KEY_SZ];
+ kvstorageMakeKey(zClass, zKey, zXKey);
+ fd = fopen(zXKey, "wb");
+ if( fd ){
+ SQLITE_KV_TRACE(("KVVFS-WRITE %-15s (%d) %.50s%s\n", zXKey,
+ (int)strlen(zData), zData,
+ strlen(zData)>50 ? "..." : ""));
+ fputs(zData, fd);
+ fclose(fd);
+ return 0;
+ }else{
+ return 1;
+ }
+}
+
+/* Delete a key (with its corresponding data) from the key/value
+** namespace given by zClass. If the key does not previously exist,
+** this routine is a no-op.
+*/
+static int kvstorageDelete(const char *zClass, const char *zKey){
+ char zXKey[KVSTORAGE_KEY_SZ];
+ kvstorageMakeKey(zClass, zKey, zXKey);
+ unlink(zXKey);
+ SQLITE_KV_TRACE(("KVVFS-DELETE %-15s\n", zXKey));
+ return 0;
+}
+
+/* Read the value associated with a zKey from the key/value namespace given
+** by zClass and put the text data associated with that key in the first
+** nBuf bytes of zBuf[]. The value might be truncated if zBuf is not large
+** enough to hold it all. The value put into zBuf must always be zero
+** terminated, even if it gets truncated because nBuf is not large enough.
+**
+** Return the total number of bytes in the data, without truncation, and
+** not counting the final zero terminator. Return -1 if the key does
+** not exist.
+**
+** If nBuf<=0 then this routine simply returns the size of the data without
+** actually reading it.
+*/
+static int kvstorageRead(
+ const char *zClass,
+ const char *zKey,
+ char *zBuf,
+ int nBuf
+){
+ FILE *fd;
+ struct stat buf;
+ char zXKey[KVSTORAGE_KEY_SZ];
+ kvstorageMakeKey(zClass, zKey, zXKey);
+ if( access(zXKey, R_OK)!=0
+ || stat(zXKey, &buf)!=0
+ || !S_ISREG(buf.st_mode)
+ ){
+ SQLITE_KV_TRACE(("KVVFS-READ %-15s (-1)\n", zXKey));
+ return -1;
+ }
+ if( nBuf<=0 ){
+ return (int)buf.st_size;
+ }else if( nBuf==1 ){
+ zBuf[0] = 0;
+ SQLITE_KV_TRACE(("KVVFS-READ %-15s (%d)\n", zXKey,
+ (int)buf.st_size));
+ return (int)buf.st_size;
+ }
+ if( nBuf > buf.st_size + 1 ){
+ nBuf = buf.st_size + 1;
+ }
+ fd = fopen(zXKey, "rb");
+ if( fd==0 ){
+ SQLITE_KV_TRACE(("KVVFS-READ %-15s (-1)\n", zXKey));
+ return -1;
+ }else{
+ sqlite3_int64 n = fread(zBuf, 1, nBuf-1, fd);
+ fclose(fd);
+ zBuf[n] = 0;
+ SQLITE_KV_TRACE(("KVVFS-READ %-15s (%lld) %.50s%s\n", zXKey,
+ n, zBuf, n>50 ? "..." : ""));
+ return (int)n;
+ }
+}
+
+/*
+** An internal level of indirection which enables us to replace the
+** kvvfs i/o methods with JavaScript implementations in WASM builds.
+** Maintenance reminder: if this struct changes in any way, the JSON
+** rendering of its structure must be updated in
+** sqlite3_wasm_enum_json(). There are no binary compatibility
+** concerns, so it does not need an iVersion member. This file is
+** necessarily always compiled together with sqlite3_wasm_enum_json(),
+** and JS code dynamically creates the mapping of members based on
+** that JSON description.
+*/
+typedef struct sqlite3_kvvfs_methods sqlite3_kvvfs_methods;
+struct sqlite3_kvvfs_methods {
+ int (*xRead)(const char *zClass, const char *zKey, char *zBuf, int nBuf);
+ int (*xWrite)(const char *zClass, const char *zKey, const char *zData);
+ int (*xDelete)(const char *zClass, const char *zKey);
+ const int nKeySize;
+};
+
+/*
+** This object holds the kvvfs I/O methods which may be swapped out
+** for JavaScript-side implementations in WASM builds. In such builds
+** it cannot be const, but in native builds it should be so that
+** the compiler can hopefully optimize this level of indirection out.
+** That said, kvvfs is intended primarily for use in WASM builds.
+**
+** Note that this is not explicitly flagged as static because the
+** amalgamation build will tag it with SQLITE_PRIVATE.
+*/
+#ifndef SQLITE_WASM
+const
+#endif
+SQLITE_PRIVATE sqlite3_kvvfs_methods sqlite3KvvfsMethods = {
+kvstorageRead,
+kvstorageWrite,
+kvstorageDelete,
+KVSTORAGE_KEY_SZ
+};
+
+/****** Utility subroutines ************************************************/
+
+/*
+** Encode binary into the text encoded used to persist on disk.
+** The output text is stored in aOut[], which must be at least
+** nData+1 bytes in length.
+**
+** Return the actual length of the encoded text, not counting the
+** zero terminator at the end.
+**
+** Encoding format
+** ---------------
+**
+** * Non-zero bytes are encoded as upper-case hexadecimal
+**
+** * A sequence of one or more zero-bytes that are not at the
+** beginning of the buffer are encoded as a little-endian
+** base-26 number using a..z. "a" means 0. "b" means 1,
+** "z" means 25. "ab" means 26. "ac" means 52. And so forth.
+**
+** * Because there is no overlap between the encoding characters
+** of hexadecimal and base-26 numbers, it is always clear where
+** one stops and the next begins.
+*/
+static int kvvfsEncode(const char *aData, int nData, char *aOut){
+ int i, j;
+ const unsigned char *a = (const unsigned char*)aData;
+ for(i=j=0; i<nData; i++){
+ unsigned char c = a[i];
+ if( c!=0 ){
+ aOut[j++] = "0123456789ABCDEF"[c>>4];
+ aOut[j++] = "0123456789ABCDEF"[c&0xf];
+ }else{
+ /* A sequence of 1 or more zeros is stored as a little-endian
+ ** base-26 number using a..z as the digits. So one zero is "b".
+ ** Two zeros is "c". 25 zeros is "z", 26 zeros is "ab", 27 is "bb",
+ ** and so forth.
+ */
+ int k;
+ for(k=1; i+k<nData && a[i+k]==0; k++){}
+ i += k-1;
+ while( k>0 ){
+ aOut[j++] = 'a'+(k%26);
+ k /= 26;
+ }
+ }
+ }
+ aOut[j] = 0;
+ return j;
+}
+
+static const signed char kvvfsHexValue[256] = {
+ -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,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1,
+ -1, 10, 11, 12, 13, 14, 15, -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, -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
+};
+
+/*
+** Decode the text encoding back to binary. The binary content is
+** written into pOut, which must be at least nOut bytes in length.
+**
+** The return value is the number of bytes actually written into aOut[].
+*/
+static int kvvfsDecode(const char *a, char *aOut, int nOut){
+ int i, j;
+ int c;
+ const unsigned char *aIn = (const unsigned char*)a;
+ i = 0;
+ j = 0;
+ while( 1 ){
+ c = kvvfsHexValue[aIn[i]];
+ if( c<0 ){
+ int n = 0;
+ int mult = 1;
+ c = aIn[i];
+ if( c==0 ) break;
+ while( c>='a' && c<='z' ){
+ n += (c - 'a')*mult;
+ mult *= 26;
+ c = aIn[++i];
+ }
+ if( j+n>nOut ) return -1;
+ memset(&aOut[j], 0, n);
+ j += n;
+ if( c==0 || mult==1 ) break; /* progress stalled if mult==1 */
+ }else{
+ aOut[j] = c<<4;
+ c = kvvfsHexValue[aIn[++i]];
+ if( c<0 ) break;
+ aOut[j++] += c;
+ i++;
+ }
+ }
+ return j;
+}
+
+/*
+** Decode a complete journal file. Allocate space in pFile->aJrnl
+** and store the decoding there. Or leave pFile->aJrnl set to NULL
+** if an error is encountered.
+**
+** The first few characters of the text encoding will be a little-endian
+** base-26 number (digits a..z) that is the total number of bytes
+** in the decoded journal file image. This base-26 number is followed
+** by a single space, then the encoding of the journal. The space
+** separator is required to act as a terminator for the base-26 number.
+*/
+static void kvvfsDecodeJournal(
+ KVVfsFile *pFile, /* Store decoding in pFile->aJrnl */
+ const char *zTxt, /* Text encoding. Zero-terminated */
+ int nTxt /* Bytes in zTxt, excluding zero terminator */
+){
+ unsigned int n = 0;
+ int c, i, mult;
+ i = 0;
+ mult = 1;
+ while( (c = zTxt[i++])>='a' && c<='z' ){
+ n += (zTxt[i] - 'a')*mult;
+ mult *= 26;
+ }
+ sqlite3_free(pFile->aJrnl);
+ pFile->aJrnl = sqlite3_malloc64( n );
+ if( pFile->aJrnl==0 ){
+ pFile->nJrnl = 0;
+ return;
+ }
+ pFile->nJrnl = n;
+ n = kvvfsDecode(zTxt+i, pFile->aJrnl, pFile->nJrnl);
+ if( n<pFile->nJrnl ){
+ sqlite3_free(pFile->aJrnl);
+ pFile->aJrnl = 0;
+ pFile->nJrnl = 0;
+ }
+}
+
+/*
+** Read or write the "sz" element, containing the database file size.
+*/
+static sqlite3_int64 kvvfsReadFileSize(KVVfsFile *pFile){
+ char zData[50];
+ zData[0] = 0;
+ sqlite3KvvfsMethods.xRead(pFile->zClass, "sz", zData, sizeof(zData)-1);
+ return strtoll(zData, 0, 0);
+}
+static int kvvfsWriteFileSize(KVVfsFile *pFile, sqlite3_int64 sz){
+ char zData[50];
+ sqlite3_snprintf(sizeof(zData), zData, "%lld", sz);
+ return sqlite3KvvfsMethods.xWrite(pFile->zClass, "sz", zData);
+}
+
+/****** sqlite3_io_methods methods ******************************************/
+
+/*
+** Close an kvvfs-file.
+*/
+static int kvvfsClose(sqlite3_file *pProtoFile){
+ KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
+
+ SQLITE_KV_LOG(("xClose %s %s\n", pFile->zClass,
+ pFile->isJournal ? "journal" : "db"));
+ sqlite3_free(pFile->aJrnl);
+ sqlite3_free(pFile->aData);
+ return SQLITE_OK;
+}
+
+/*
+** Read from the -journal file.
+*/
+static int kvvfsReadJrnl(
+ sqlite3_file *pProtoFile,
+ void *zBuf,
+ int iAmt,
+ sqlite_int64 iOfst
+){
+ KVVfsFile *pFile = (KVVfsFile*)pProtoFile;
+ assert( pFile->isJournal );
+ SQLITE_KV_LOG(("xRead('%s-journal',%d,%lld)\n", pFile->zClass, iAmt, iOfst));
+ if( pFile->aJrnl==0 ){
+ int szTxt = kvstorageRead(pFile->zClass, "jrnl", 0, 0);
+ char *aTxt;
+ if( szTxt<=4 ){
+ return SQLITE_IOERR;
+ }
+ aTxt = sqlite3_malloc64( szTxt+1 );
+ if( aTxt==0 ) return SQLITE_NOMEM;
+ kvstorageRead(pFile->zClass, "jrnl", aTxt, szTxt+1);
+ kvvfsDecodeJournal(pFile, aTxt, szTxt);
+ sqlite3_free(aTxt);
+ if( pFile->aJrnl==0 ) return SQLITE_IOERR;
+ }
+ if( iOfst+iAmt>pFile->nJrnl ){
+ return SQLITE_IOERR_SHORT_READ;
+ }
+ memcpy(zBuf, pFile->aJrnl+iOfst, iAmt);
+ return SQLITE_OK;
+}
+
+/*
+** Read from the database file.
+*/
+static int kvvfsReadDb(
+ sqlite3_file *pProtoFile,
+ void *zBuf,
+ int iAmt,
+ sqlite_int64 iOfst
+){
+ KVVfsFile *pFile = (KVVfsFile*)pProtoFile;
+ unsigned int pgno;
+ int got, n;
+ char zKey[30];
+ char *aData = pFile->aData;
+ assert( iOfst>=0 );
+ assert( iAmt>=0 );
+ SQLITE_KV_LOG(("xRead('%s-db',%d,%lld)\n", pFile->zClass, iAmt, iOfst));
+ if( iOfst+iAmt>=512 ){
+ if( (iOfst % iAmt)!=0 ){
+ return SQLITE_IOERR_READ;
+ }
+ if( (iAmt & (iAmt-1))!=0 || iAmt<512 || iAmt>65536 ){
+ return SQLITE_IOERR_READ;
+ }
+ pFile->szPage = iAmt;
+ pgno = 1 + iOfst/iAmt;
+ }else{
+ pgno = 1;
+ }
+ sqlite3_snprintf(sizeof(zKey), zKey, "%u", pgno);
+ got = sqlite3KvvfsMethods.xRead(pFile->zClass, zKey,
+ aData, SQLITE_KVOS_SZ-1);
+ if( got<0 ){
+ n = 0;
+ }else{
+ aData[got] = 0;
+ if( iOfst+iAmt<512 ){
+ int k = iOfst+iAmt;
+ aData[k*2] = 0;
+ n = kvvfsDecode(aData, &aData[2000], SQLITE_KVOS_SZ-2000);
+ if( n>=iOfst+iAmt ){
+ memcpy(zBuf, &aData[2000+iOfst], iAmt);
+ n = iAmt;
+ }else{
+ n = 0;
+ }
+ }else{
+ n = kvvfsDecode(aData, zBuf, iAmt);
+ }
+ }
+ if( n<iAmt ){
+ memset(zBuf+n, 0, iAmt-n);
+ return SQLITE_IOERR_SHORT_READ;
+ }
+ return SQLITE_OK;
+}
+
+
+/*
+** Write into the -journal file.
+*/
+static int kvvfsWriteJrnl(
+ sqlite3_file *pProtoFile,
+ const void *zBuf,
+ int iAmt,
+ sqlite_int64 iOfst
+){
+ KVVfsFile *pFile = (KVVfsFile*)pProtoFile;
+ sqlite3_int64 iEnd = iOfst+iAmt;
+ SQLITE_KV_LOG(("xWrite('%s-journal',%d,%lld)\n", pFile->zClass, iAmt, iOfst));
+ if( iEnd>=0x10000000 ) return SQLITE_FULL;
+ if( pFile->aJrnl==0 || pFile->nJrnl<iEnd ){
+ char *aNew = sqlite3_realloc(pFile->aJrnl, iEnd);
+ if( aNew==0 ){
+ return SQLITE_IOERR_NOMEM;
+ }
+ pFile->aJrnl = aNew;
+ if( pFile->nJrnl<iOfst ){
+ memset(pFile->aJrnl+pFile->nJrnl, 0, iOfst-pFile->nJrnl);
+ }
+ pFile->nJrnl = iEnd;
+ }
+ memcpy(pFile->aJrnl+iOfst, zBuf, iAmt);
+ return SQLITE_OK;
+}
+
+/*
+** Write into the database file.
+*/
+static int kvvfsWriteDb(
+ sqlite3_file *pProtoFile,
+ const void *zBuf,
+ int iAmt,
+ sqlite_int64 iOfst
+){
+ KVVfsFile *pFile = (KVVfsFile*)pProtoFile;
+ unsigned int pgno;
+ char zKey[30];
+ char *aData = pFile->aData;
+ SQLITE_KV_LOG(("xWrite('%s-db',%d,%lld)\n", pFile->zClass, iAmt, iOfst));
+ assert( iAmt>=512 && iAmt<=65536 );
+ assert( (iAmt & (iAmt-1))==0 );
+ assert( pFile->szPage<0 || pFile->szPage==iAmt );
+ pFile->szPage = iAmt;
+ pgno = 1 + iOfst/iAmt;
+ sqlite3_snprintf(sizeof(zKey), zKey, "%u", pgno);
+ kvvfsEncode(zBuf, iAmt, aData);
+ if( sqlite3KvvfsMethods.xWrite(pFile->zClass, zKey, aData) ){
+ return SQLITE_IOERR;
+ }
+ if( iOfst+iAmt > pFile->szDb ){
+ pFile->szDb = iOfst + iAmt;
+ }
+ return SQLITE_OK;
+}
+
+/*
+** Truncate an kvvfs-file.
+*/
+static int kvvfsTruncateJrnl(sqlite3_file *pProtoFile, sqlite_int64 size){
+ KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
+ SQLITE_KV_LOG(("xTruncate('%s-journal',%lld)\n", pFile->zClass, size));
+ assert( size==0 );
+ sqlite3KvvfsMethods.xDelete(pFile->zClass, "jrnl");
+ sqlite3_free(pFile->aJrnl);
+ pFile->aJrnl = 0;
+ pFile->nJrnl = 0;
+ return SQLITE_OK;
+}
+static int kvvfsTruncateDb(sqlite3_file *pProtoFile, sqlite_int64 size){
+ KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
+ if( pFile->szDb>size
+ && pFile->szPage>0
+ && (size % pFile->szPage)==0
+ ){
+ char zKey[50];
+ unsigned int pgno, pgnoMax;
+ SQLITE_KV_LOG(("xTruncate('%s-db',%lld)\n", pFile->zClass, size));
+ pgno = 1 + size/pFile->szPage;
+ pgnoMax = 2 + pFile->szDb/pFile->szPage;
+ while( pgno<=pgnoMax ){
+ sqlite3_snprintf(sizeof(zKey), zKey, "%u", pgno);
+ sqlite3KvvfsMethods.xDelete(pFile->zClass, zKey);
+ pgno++;
+ }
+ pFile->szDb = size;
+ return kvvfsWriteFileSize(pFile, size) ? SQLITE_IOERR : SQLITE_OK;
+ }
+ return SQLITE_IOERR;
+}
+
+/*
+** Sync an kvvfs-file.
+*/
+static int kvvfsSyncJrnl(sqlite3_file *pProtoFile, int flags){
+ int i, n;
+ KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
+ char *zOut;
+ SQLITE_KV_LOG(("xSync('%s-journal')\n", pFile->zClass));
+ if( pFile->nJrnl<=0 ){
+ return kvvfsTruncateJrnl(pProtoFile, 0);
+ }
+ zOut = sqlite3_malloc64( pFile->nJrnl*2 + 50 );
+ if( zOut==0 ){
+ return SQLITE_IOERR_NOMEM;
+ }
+ n = pFile->nJrnl;
+ i = 0;
+ do{
+ zOut[i++] = 'a' + (n%26);
+ n /= 26;
+ }while( n>0 );
+ zOut[i++] = ' ';
+ kvvfsEncode(pFile->aJrnl, pFile->nJrnl, &zOut[i]);
+ i = sqlite3KvvfsMethods.xWrite(pFile->zClass, "jrnl", zOut);
+ sqlite3_free(zOut);
+ return i ? SQLITE_IOERR : SQLITE_OK;
+}
+static int kvvfsSyncDb(sqlite3_file *pProtoFile, int flags){
+ return SQLITE_OK;
+}
+
+/*
+** Return the current file-size of an kvvfs-file.
+*/
+static int kvvfsFileSizeJrnl(sqlite3_file *pProtoFile, sqlite_int64 *pSize){
+ KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
+ SQLITE_KV_LOG(("xFileSize('%s-journal')\n", pFile->zClass));
+ *pSize = pFile->nJrnl;
+ return SQLITE_OK;
+}
+static int kvvfsFileSizeDb(sqlite3_file *pProtoFile, sqlite_int64 *pSize){
+ KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
+ SQLITE_KV_LOG(("xFileSize('%s-db')\n", pFile->zClass));
+ if( pFile->szDb>=0 ){
+ *pSize = pFile->szDb;
+ }else{
+ *pSize = kvvfsReadFileSize(pFile);
+ }
+ return SQLITE_OK;
+}
+
+/*
+** Lock an kvvfs-file.
+*/
+static int kvvfsLock(sqlite3_file *pProtoFile, int eLock){
+ KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
+ assert( !pFile->isJournal );
+ SQLITE_KV_LOG(("xLock(%s,%d)\n", pFile->zClass, eLock));
+
+ if( eLock!=SQLITE_LOCK_NONE ){
+ pFile->szDb = kvvfsReadFileSize(pFile);
+ }
+ return SQLITE_OK;
+}
+
+/*
+** Unlock an kvvfs-file.
+*/
+static int kvvfsUnlock(sqlite3_file *pProtoFile, int eLock){
+ KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
+ assert( !pFile->isJournal );
+ SQLITE_KV_LOG(("xUnlock(%s,%d)\n", pFile->zClass, eLock));
+ if( eLock==SQLITE_LOCK_NONE ){
+ pFile->szDb = -1;
+ }
+ return SQLITE_OK;
+}
+
+/*
+** Check if another file-handle holds a RESERVED lock on an kvvfs-file.
+*/
+static int kvvfsCheckReservedLock(sqlite3_file *pProtoFile, int *pResOut){
+ SQLITE_KV_LOG(("xCheckReservedLock\n"));
+ *pResOut = 0;
+ return SQLITE_OK;
+}
+
+/*
+** File control method. For custom operations on an kvvfs-file.
+*/
+static int kvvfsFileControlJrnl(sqlite3_file *pProtoFile, int op, void *pArg){
+ SQLITE_KV_LOG(("xFileControl(%d) on journal\n", op));
+ return SQLITE_NOTFOUND;
+}
+static int kvvfsFileControlDb(sqlite3_file *pProtoFile, int op, void *pArg){
+ SQLITE_KV_LOG(("xFileControl(%d) on database\n", op));
+ if( op==SQLITE_FCNTL_SYNC ){
+ KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
+ int rc = SQLITE_OK;
+ SQLITE_KV_LOG(("xSync('%s-db')\n", pFile->zClass));
+ if( pFile->szDb>0 && 0!=kvvfsWriteFileSize(pFile, pFile->szDb) ){
+ rc = SQLITE_IOERR;
+ }
+ return rc;
+ }
+ return SQLITE_NOTFOUND;
+}
+
+/*
+** Return the sector-size in bytes for an kvvfs-file.
+*/
+static int kvvfsSectorSize(sqlite3_file *pFile){
+ return 512;
+}
+
+/*
+** Return the device characteristic flags supported by an kvvfs-file.
+*/
+static int kvvfsDeviceCharacteristics(sqlite3_file *pProtoFile){
+ return 0;
+}
+
+/****** sqlite3_vfs methods *************************************************/
+
+/*
+** Open an kvvfs file handle.
+*/
+static int kvvfsOpen(
+ sqlite3_vfs *pProtoVfs,
+ const char *zName,
+ sqlite3_file *pProtoFile,
+ int flags,
+ int *pOutFlags
+){
+ KVVfsFile *pFile = (KVVfsFile*)pProtoFile;
+ if( zName==0 ) zName = "";
+ SQLITE_KV_LOG(("xOpen(\"%s\")\n", zName));
+ if( strcmp(zName, "local")==0
+ || strcmp(zName, "session")==0
+ ){
+ pFile->isJournal = 0;
+ pFile->base.pMethods = &kvvfs_db_io_methods;
+ }else
+ if( strcmp(zName, "local-journal")==0
+ || strcmp(zName, "session-journal")==0
+ ){
+ pFile->isJournal = 1;
+ pFile->base.pMethods = &kvvfs_jrnl_io_methods;
+ }else{
+ return SQLITE_CANTOPEN;
+ }
+ if( zName[0]=='s' ){
+ pFile->zClass = "session";
+ }else{
+ pFile->zClass = "local";
+ }
+ pFile->aData = sqlite3_malloc64(SQLITE_KVOS_SZ);
+ if( pFile->aData==0 ){
+ return SQLITE_NOMEM;
+ }
+ pFile->aJrnl = 0;
+ pFile->nJrnl = 0;
+ pFile->szPage = -1;
+ pFile->szDb = -1;
+ return SQLITE_OK;
+}
+
+/*
+** Delete the file located at zPath. If the dirSync argument is true,
+** ensure the file-system modifications are synced to disk before
+** returning.
+*/
+static int kvvfsDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){
+ if( strcmp(zPath, "local-journal")==0 ){
+ sqlite3KvvfsMethods.xDelete("local", "jrnl");
+ }else
+ if( strcmp(zPath, "session-journal")==0 ){
+ sqlite3KvvfsMethods.xDelete("session", "jrnl");
+ }
+ return SQLITE_OK;
+}
+
+/*
+** Test for access permissions. Return true if the requested permission
+** is available, or false otherwise.
+*/
+static int kvvfsAccess(
+ sqlite3_vfs *pProtoVfs,
+ const char *zPath,
+ int flags,
+ int *pResOut
+){
+ SQLITE_KV_LOG(("xAccess(\"%s\")\n", zPath));
+ if( strcmp(zPath, "local-journal")==0 ){
+ *pResOut = sqlite3KvvfsMethods.xRead("local", "jrnl", 0, 0)>0;
+ }else
+ if( strcmp(zPath, "session-journal")==0 ){
+ *pResOut = sqlite3KvvfsMethods.xRead("session", "jrnl", 0, 0)>0;
+ }else
+ if( strcmp(zPath, "local")==0 ){
+ *pResOut = sqlite3KvvfsMethods.xRead("local", "sz", 0, 0)>0;
+ }else
+ if( strcmp(zPath, "session")==0 ){
+ *pResOut = sqlite3KvvfsMethods.xRead("session", "sz", 0, 0)>0;
+ }else
+ {
+ *pResOut = 0;
+ }
+ SQLITE_KV_LOG(("xAccess returns %d\n",*pResOut));
+ return SQLITE_OK;
+}
+
+/*
+** Populate buffer zOut with the full canonical pathname corresponding
+** to the pathname in zPath. zOut is guaranteed to point to a buffer
+** of at least (INST_MAX_PATHNAME+1) bytes.
+*/
+static int kvvfsFullPathname(
+ sqlite3_vfs *pVfs,
+ const char *zPath,
+ int nOut,
+ char *zOut
+){
+ size_t nPath;
+#ifdef SQLITE_OS_KV_ALWAYS_LOCAL
+ zPath = "local";
+#endif
+ nPath = strlen(zPath);
+ SQLITE_KV_LOG(("xFullPathname(\"%s\")\n", zPath));
+ if( nOut<nPath+1 ) nPath = nOut - 1;
+ memcpy(zOut, zPath, nPath);
+ zOut[nPath] = 0;
+ return SQLITE_OK;
+}
+
+/*
+** Open the dynamic library located at zPath and return a handle.
+*/
+static void *kvvfsDlOpen(sqlite3_vfs *pVfs, const char *zPath){
+ return 0;
+}
+
+/*
+** Populate the buffer pointed to by zBufOut with nByte bytes of
+** random data.
+*/
+static int kvvfsRandomness(sqlite3_vfs *pVfs, int nByte, char *zBufOut){
+ memset(zBufOut, 0, nByte);
+ return nByte;
+}
+
+/*
+** Sleep for nMicro microseconds. Return the number of microseconds
+** actually slept.
+*/
+static int kvvfsSleep(sqlite3_vfs *pVfs, int nMicro){
+ return SQLITE_OK;
+}
+
+/*
+** Return the current time as a Julian Day number in *pTimeOut.
+*/
+static int kvvfsCurrentTime(sqlite3_vfs *pVfs, double *pTimeOut){
+ sqlite3_int64 i = 0;
+ int rc;
+ rc = kvvfsCurrentTimeInt64(0, &i);
+ *pTimeOut = i/86400000.0;
+ return rc;
+}
+#include <sys/time.h>
+static int kvvfsCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *pTimeOut){
+ static const sqlite3_int64 unixEpoch = 24405875*(sqlite3_int64)8640000;
+ struct timeval sNow;
+ (void)gettimeofday(&sNow, 0); /* Cannot fail given valid arguments */
+ *pTimeOut = unixEpoch + 1000*(sqlite3_int64)sNow.tv_sec + sNow.tv_usec/1000;
+ return SQLITE_OK;
+}
+#endif /* SQLITE_OS_KV || SQLITE_OS_UNIX */
+
+#if SQLITE_OS_KV
+/*
+** This routine is called initialize the KV-vfs as the default VFS.
+*/
+SQLITE_API int sqlite3_os_init(void){
+ return sqlite3_vfs_register(&sqlite3OsKvvfsObject, 1);
+}
+SQLITE_API int sqlite3_os_end(void){
+ return SQLITE_OK;
+}
+#endif /* SQLITE_OS_KV */
+
+#if SQLITE_OS_UNIX && defined(SQLITE_OS_KV_OPTIONAL)
+SQLITE_PRIVATE int sqlite3KvvfsInit(void){
+ return sqlite3_vfs_register(&sqlite3OsKvvfsObject, 0);
+}
+#endif
+
+/************** End of os_kv.c ***********************************************/
+/************** Begin file os_unix.c *****************************************/
+/*
+** 2004 May 22
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+******************************************************************************
+**
+** This file contains the VFS implementation for unix-like operating systems
+** include Linux, MacOSX, *BSD, QNX, VxWorks, AIX, HPUX, and others.
+**
+** There are actually several different VFS implementations in this file.
+** The differences are in the way that file locking is done. The default
+** implementation uses Posix Advisory Locks. Alternative implementations
+** use flock(), dot-files, various proprietary locking schemas, or simply
+** skip locking all together.
+**
+** This source file is organized into divisions where the logic for various
+** subfunctions is contained within the appropriate division. PLEASE
+** KEEP THE STRUCTURE OF THIS FILE INTACT. New code should be placed
+** in the correct division and should be clearly labelled.
+**
+** The layout of divisions is as follows:
+**
+** * General-purpose declarations and utility functions.
+** * Unique file ID logic used by VxWorks.
+** * Various locking primitive implementations (all except proxy locking):
+** + for Posix Advisory Locks
+** + for no-op locks
+** + for dot-file locks
+** + for flock() locking
+** + for named semaphore locks (VxWorks only)
+** + for AFP filesystem locks (MacOSX only)
+** * sqlite3_file methods not associated with locking.
+** * Definitions of sqlite3_io_methods objects for all locking
+** methods plus "finder" functions for each locking method.
+** * sqlite3_vfs method implementations.
+** * Locking primitives for the proxy uber-locking-method. (MacOSX only)
+** * Definitions of sqlite3_vfs objects for all locking methods
+** plus implementations of sqlite3_os_init() and sqlite3_os_end().
+*/
+/* #include "sqliteInt.h" */
+#if SQLITE_OS_UNIX /* This file is used on unix only */
+
+/*
+** There are various methods for file locking used for concurrency
+** control:
+**
+** 1. POSIX locking (the default),
+** 2. No locking,
+** 3. Dot-file locking,
+** 4. flock() locking,
+** 5. AFP locking (OSX only),
+** 6. Named POSIX semaphores (VXWorks only),
+** 7. proxy locking. (OSX only)
+**
+** Styles 4, 5, and 7 are only available of SQLITE_ENABLE_LOCKING_STYLE
+** is defined to 1. The SQLITE_ENABLE_LOCKING_STYLE also enables automatic
+** selection of the appropriate locking style based on the filesystem
+** where the database is located.
+*/
+#if !defined(SQLITE_ENABLE_LOCKING_STYLE)
+# if defined(__APPLE__)
+# define SQLITE_ENABLE_LOCKING_STYLE 1
+# else
+# define SQLITE_ENABLE_LOCKING_STYLE 0
+# endif
+#endif
+
+/* Use pread() and pwrite() if they are available */
+#if defined(__APPLE__) || defined(__linux__)
+# define HAVE_PREAD 1
+# define HAVE_PWRITE 1
+#endif
+#if defined(HAVE_PREAD64) && defined(HAVE_PWRITE64)
+# undef USE_PREAD
+# define USE_PREAD64 1
+#elif defined(HAVE_PREAD) && defined(HAVE_PWRITE)
+# undef USE_PREAD64
+# define USE_PREAD 1
+#endif
+
+/*
+** standard include files.
+*/
+#include <sys/types.h> /* amalgamator: keep */
+#include <sys/stat.h> /* amalgamator: keep */
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <unistd.h> /* amalgamator: keep */
+/* #include <time.h> */
+#include <sys/time.h> /* amalgamator: keep */
+#include <errno.h>
+#if (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0) \
+ && !defined(SQLITE_WASI)
+# include <sys/mman.h>
+#endif
+
+#if SQLITE_ENABLE_LOCKING_STYLE
+/* # include <sys/ioctl.h> */
+# include <sys/file.h>
+# include <sys/param.h>
+#endif /* SQLITE_ENABLE_LOCKING_STYLE */
+
+/*
+** Try to determine if gethostuuid() is available based on standard
+** macros. This might sometimes compute the wrong value for some
+** obscure platforms. For those cases, simply compile with one of
+** the following:
+**
+** -DHAVE_GETHOSTUUID=0
+** -DHAVE_GETHOSTUUID=1
+**
+** None if this matters except when building on Apple products with
+** -DSQLITE_ENABLE_LOCKING_STYLE.
+*/
+#ifndef HAVE_GETHOSTUUID
+# define HAVE_GETHOSTUUID 0
+# if defined(__APPLE__) && ((__MAC_OS_X_VERSION_MIN_REQUIRED > 1050) || \
+ (__IPHONE_OS_VERSION_MIN_REQUIRED > 2000))
+# if (!defined(TARGET_OS_EMBEDDED) || (TARGET_OS_EMBEDDED==0)) \
+ && (!defined(TARGET_IPHONE_SIMULATOR) || (TARGET_IPHONE_SIMULATOR==0))\
+ && (!defined(TARGET_OS_MACCATALYST) || (TARGET_OS_MACCATALYST==0))
+# undef HAVE_GETHOSTUUID
+# define HAVE_GETHOSTUUID 1
+# else
+# warning "gethostuuid() is disabled."
+# endif
+# endif
+#endif
+
+
+#if OS_VXWORKS
+/* # include <sys/ioctl.h> */
+# include <semaphore.h>
+# include <limits.h>
+#endif /* OS_VXWORKS */
+
+#if defined(__APPLE__) || SQLITE_ENABLE_LOCKING_STYLE
+# include <sys/mount.h>
+#endif
+
+#ifdef HAVE_UTIME
+# include <utime.h>
+#endif
+
+/*
+** Allowed values of unixFile.fsFlags
+*/
+#define SQLITE_FSFLAGS_IS_MSDOS 0x1
+
+/*
+** If we are to be thread-safe, include the pthreads header.
+*/
+#if SQLITE_THREADSAFE
+/* # include <pthread.h> */
+#endif
+
+/*
+** Default permissions when creating a new file
+*/
+#ifndef SQLITE_DEFAULT_FILE_PERMISSIONS
+# define SQLITE_DEFAULT_FILE_PERMISSIONS 0644
+#endif
+
+/*
+** Default permissions when creating auto proxy dir
+*/
+#ifndef SQLITE_DEFAULT_PROXYDIR_PERMISSIONS
+# define SQLITE_DEFAULT_PROXYDIR_PERMISSIONS 0755
+#endif
+
+/*
+** Maximum supported path-length.
+*/
+#define MAX_PATHNAME 512
+
+/*
+** Maximum supported symbolic links
+*/
+#define SQLITE_MAX_SYMLINKS 100
+
+/*
+** Remove and stub certain info for WASI (WebAssembly System
+** Interface) builds.
+*/
+#ifdef SQLITE_WASI
+# undef HAVE_FCHMOD
+# undef HAVE_FCHOWN
+# undef HAVE_MREMAP
+# define HAVE_MREMAP 0
+# ifndef SQLITE_DEFAULT_UNIX_VFS
+# define SQLITE_DEFAULT_UNIX_VFS "unix-dotfile"
+ /* ^^^ should SQLITE_DEFAULT_UNIX_VFS be "unix-none"? */
+# endif
+# ifndef F_RDLCK
+# define F_RDLCK 0
+# define F_WRLCK 1
+# define F_UNLCK 2
+# if __LONG_MAX == 0x7fffffffL
+# define F_GETLK 12
+# define F_SETLK 13
+# define F_SETLKW 14
+# else
+# define F_GETLK 5
+# define F_SETLK 6
+# define F_SETLKW 7
+# endif
+# endif
+#else /* !SQLITE_WASI */
+# ifndef HAVE_FCHMOD
+# define HAVE_FCHMOD 1
+# endif
+#endif /* SQLITE_WASI */
+
+#ifdef SQLITE_WASI
+# define osGetpid(X) (pid_t)1
+#else
+/* Always cast the getpid() return type for compatibility with
+** kernel modules in VxWorks. */
+# define osGetpid(X) (pid_t)getpid()
+#endif
+
+/*
+** Only set the lastErrno if the error code is a real error and not
+** a normal expected return code of SQLITE_BUSY or SQLITE_OK
+*/
+#define IS_LOCK_ERROR(x) ((x != SQLITE_OK) && (x != SQLITE_BUSY))
+
+/* Forward references */
+typedef struct unixShm unixShm; /* Connection shared memory */
+typedef struct unixShmNode unixShmNode; /* Shared memory instance */
+typedef struct unixInodeInfo unixInodeInfo; /* An i-node */
+typedef struct UnixUnusedFd UnixUnusedFd; /* An unused file descriptor */
+
+/*
+** Sometimes, after a file handle is closed by SQLite, the file descriptor
+** cannot be closed immediately. In these cases, instances of the following
+** structure are used to store the file descriptor while waiting for an
+** opportunity to either close or reuse it.
+*/
+struct UnixUnusedFd {
+ int fd; /* File descriptor to close */
+ int flags; /* Flags this file descriptor was opened with */
+ UnixUnusedFd *pNext; /* Next unused file descriptor on same file */
+};
+
+/*
+** The unixFile structure is subclass of sqlite3_file specific to the unix
+** VFS implementations.
+*/
+typedef struct unixFile unixFile;
+struct unixFile {
+ sqlite3_io_methods const *pMethod; /* Always the first entry */
+ sqlite3_vfs *pVfs; /* The VFS that created this unixFile */
+ unixInodeInfo *pInode; /* Info about locks on this inode */
+ int h; /* The file descriptor */
+ unsigned char eFileLock; /* The type of lock held on this fd */
+ unsigned short int ctrlFlags; /* Behavioral bits. UNIXFILE_* flags */
+ int lastErrno; /* The unix errno from last I/O error */
+ void *lockingContext; /* Locking style specific state */
+ UnixUnusedFd *pPreallocatedUnused; /* Pre-allocated UnixUnusedFd */
+ const char *zPath; /* Name of the file */
+ unixShm *pShm; /* Shared memory segment information */
+ int szChunk; /* Configured by FCNTL_CHUNK_SIZE */
+#if SQLITE_MAX_MMAP_SIZE>0
+ int nFetchOut; /* Number of outstanding xFetch refs */
+ sqlite3_int64 mmapSize; /* Usable size of mapping at pMapRegion */
+ sqlite3_int64 mmapSizeActual; /* Actual size of mapping at pMapRegion */
+ sqlite3_int64 mmapSizeMax; /* Configured FCNTL_MMAP_SIZE value */
+ void *pMapRegion; /* Memory mapped region */
+#endif
+ int sectorSize; /* Device sector size */
+ int deviceCharacteristics; /* Precomputed device characteristics */
+#if SQLITE_ENABLE_LOCKING_STYLE
+ int openFlags; /* The flags specified at open() */
+#endif
+#if SQLITE_ENABLE_LOCKING_STYLE || defined(__APPLE__)
+ unsigned fsFlags; /* cached details from statfs() */
+#endif
+#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
+ unsigned iBusyTimeout; /* Wait this many millisec on locks */
+#endif
+#if OS_VXWORKS
+ struct vxworksFileId *pId; /* Unique file ID */
+#endif
+#ifdef SQLITE_DEBUG
+ /* The next group of variables are used to track whether or not the
+ ** transaction counter in bytes 24-27 of database files are updated
+ ** whenever any part of the database changes. An assertion fault will
+ ** occur if a file is updated without also updating the transaction
+ ** counter. This test is made to avoid new problems similar to the
+ ** one described by ticket #3584.
+ */
+ unsigned char transCntrChng; /* True if the transaction counter changed */
+ unsigned char dbUpdate; /* True if any part of database file changed */
+ unsigned char inNormalWrite; /* True if in a normal write operation */
+
+#endif
+
+#ifdef SQLITE_TEST
+ /* In test mode, increase the size of this structure a bit so that
+ ** it is larger than the struct CrashFile defined in test6.c.
+ */
+ char aPadding[32];
+#endif
+};
+
+/* This variable holds the process id (pid) from when the xRandomness()
+** method was called. If xOpen() is called from a different process id,
+** indicating that a fork() has occurred, the PRNG will be reset.
+*/
+static pid_t randomnessPid = 0;
+
+/*
+** Allowed values for the unixFile.ctrlFlags bitmask:
+*/
+#define UNIXFILE_EXCL 0x01 /* Connections from one process only */
+#define UNIXFILE_RDONLY 0x02 /* Connection is read only */
+#define UNIXFILE_PERSIST_WAL 0x04 /* Persistent WAL mode */
+#if !defined(SQLITE_DISABLE_DIRSYNC) && !defined(_AIX)
+# define UNIXFILE_DIRSYNC 0x08 /* Directory sync needed */
+#else
+# define UNIXFILE_DIRSYNC 0x00
+#endif
+#define UNIXFILE_PSOW 0x10 /* SQLITE_IOCAP_POWERSAFE_OVERWRITE */
+#define UNIXFILE_DELETE 0x20 /* Delete on close */
+#define UNIXFILE_URI 0x40 /* Filename might have query parameters */
+#define UNIXFILE_NOLOCK 0x80 /* Do no file locking */
+
+/*
+** Include code that is common to all os_*.c files
+*/
+/* #include "os_common.h" */
+
+/*
+** Define various macros that are missing from some systems.
+*/
+#ifndef O_LARGEFILE
+# define O_LARGEFILE 0
+#endif
+#ifdef SQLITE_DISABLE_LFS
+# undef O_LARGEFILE
+# define O_LARGEFILE 0
+#endif
+#ifndef O_NOFOLLOW
+# define O_NOFOLLOW 0
+#endif
+#ifndef O_BINARY
+# define O_BINARY 0
+#endif
+
+/*
+** The threadid macro resolves to the thread-id or to 0. Used for
+** testing and debugging only.
+*/
+#if SQLITE_THREADSAFE
+#define threadid pthread_self()
+#else
+#define threadid 0
+#endif
+
+/*
+** HAVE_MREMAP defaults to true on Linux and false everywhere else.
+*/
+#if !defined(HAVE_MREMAP)
+# if defined(__linux__) && defined(_GNU_SOURCE)
+# define HAVE_MREMAP 1
+# else
+# define HAVE_MREMAP 0
+# endif
+#endif
+
+/*
+** Explicitly call the 64-bit version of lseek() on Android. Otherwise, lseek()
+** is the 32-bit version, even if _FILE_OFFSET_BITS=64 is defined.
+*/
+#ifdef __ANDROID__
+# define lseek lseek64
+#endif
+
+#ifdef __linux__
+/*
+** Linux-specific IOCTL magic numbers used for controlling F2FS
+*/
+#define F2FS_IOCTL_MAGIC 0xf5
+#define F2FS_IOC_START_ATOMIC_WRITE _IO(F2FS_IOCTL_MAGIC, 1)
+#define F2FS_IOC_COMMIT_ATOMIC_WRITE _IO(F2FS_IOCTL_MAGIC, 2)
+#define F2FS_IOC_START_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 3)
+#define F2FS_IOC_ABORT_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 5)
+#define F2FS_IOC_GET_FEATURES _IOR(F2FS_IOCTL_MAGIC, 12, u32)
+#define F2FS_FEATURE_ATOMIC_WRITE 0x0004
+#endif /* __linux__ */
+
+
+/*
+** Different Unix systems declare open() in different ways. Same use
+** open(const char*,int,mode_t). Others use open(const char*,int,...).
+** The difference is important when using a pointer to the function.
+**
+** The safest way to deal with the problem is to always use this wrapper
+** which always has the same well-defined interface.
+*/
+static int posixOpen(const char *zFile, int flags, int mode){
+ return open(zFile, flags, mode);
+}
+
+/* Forward reference */
+static int openDirectory(const char*, int*);
+static int unixGetpagesize(void);
+
+/*
+** Many system calls are accessed through pointer-to-functions so that
+** they may be overridden at runtime to facilitate fault injection during
+** testing and sandboxing. The following array holds the names and pointers
+** to all overrideable system calls.
+*/
+static struct unix_syscall {
+ const char *zName; /* Name of the system call */
+ sqlite3_syscall_ptr pCurrent; /* Current value of the system call */
+ sqlite3_syscall_ptr pDefault; /* Default value */
+} aSyscall[] = {
+ { "open", (sqlite3_syscall_ptr)posixOpen, 0 },
+#define osOpen ((int(*)(const char*,int,int))aSyscall[0].pCurrent)
+
+ { "close", (sqlite3_syscall_ptr)close, 0 },
+#define osClose ((int(*)(int))aSyscall[1].pCurrent)
+
+ { "access", (sqlite3_syscall_ptr)access, 0 },
+#define osAccess ((int(*)(const char*,int))aSyscall[2].pCurrent)
+
+ { "getcwd", (sqlite3_syscall_ptr)getcwd, 0 },
+#define osGetcwd ((char*(*)(char*,size_t))aSyscall[3].pCurrent)
+
+ { "stat", (sqlite3_syscall_ptr)stat, 0 },
+#define osStat ((int(*)(const char*,struct stat*))aSyscall[4].pCurrent)
+
+/*
+** The DJGPP compiler environment looks mostly like Unix, but it
+** lacks the fcntl() system call. So redefine fcntl() to be something
+** that always succeeds. This means that locking does not occur under
+** DJGPP. But it is DOS - what did you expect?
+*/
+#ifdef __DJGPP__
+ { "fstat", 0, 0 },
+#define osFstat(a,b,c) 0
+#else
+ { "fstat", (sqlite3_syscall_ptr)fstat, 0 },
+#define osFstat ((int(*)(int,struct stat*))aSyscall[5].pCurrent)
+#endif
+
+ { "ftruncate", (sqlite3_syscall_ptr)ftruncate, 0 },
+#define osFtruncate ((int(*)(int,off_t))aSyscall[6].pCurrent)
+
+ { "fcntl", (sqlite3_syscall_ptr)fcntl, 0 },
+#define osFcntl ((int(*)(int,int,...))aSyscall[7].pCurrent)
+
+ { "read", (sqlite3_syscall_ptr)read, 0 },
+#define osRead ((ssize_t(*)(int,void*,size_t))aSyscall[8].pCurrent)
+
+#if defined(USE_PREAD) || SQLITE_ENABLE_LOCKING_STYLE
+ { "pread", (sqlite3_syscall_ptr)pread, 0 },
+#else
+ { "pread", (sqlite3_syscall_ptr)0, 0 },
+#endif
+#define osPread ((ssize_t(*)(int,void*,size_t,off_t))aSyscall[9].pCurrent)
+
+#if defined(USE_PREAD64)
+ { "pread64", (sqlite3_syscall_ptr)pread64, 0 },
+#else
+ { "pread64", (sqlite3_syscall_ptr)0, 0 },
+#endif
+#define osPread64 ((ssize_t(*)(int,void*,size_t,off64_t))aSyscall[10].pCurrent)
+
+ { "write", (sqlite3_syscall_ptr)write, 0 },
+#define osWrite ((ssize_t(*)(int,const void*,size_t))aSyscall[11].pCurrent)
+
+#if defined(USE_PREAD) || SQLITE_ENABLE_LOCKING_STYLE
+ { "pwrite", (sqlite3_syscall_ptr)pwrite, 0 },
+#else
+ { "pwrite", (sqlite3_syscall_ptr)0, 0 },
+#endif
+#define osPwrite ((ssize_t(*)(int,const void*,size_t,off_t))\
+ aSyscall[12].pCurrent)
+
+#if defined(USE_PREAD64)
+ { "pwrite64", (sqlite3_syscall_ptr)pwrite64, 0 },
+#else
+ { "pwrite64", (sqlite3_syscall_ptr)0, 0 },
+#endif
+#define osPwrite64 ((ssize_t(*)(int,const void*,size_t,off64_t))\
+ aSyscall[13].pCurrent)
+
+#if defined(HAVE_FCHMOD)
+ { "fchmod", (sqlite3_syscall_ptr)fchmod, 0 },
+#else
+ { "fchmod", (sqlite3_syscall_ptr)0, 0 },
+#endif
+#define osFchmod ((int(*)(int,mode_t))aSyscall[14].pCurrent)
+
+#if defined(HAVE_POSIX_FALLOCATE) && HAVE_POSIX_FALLOCATE
+ { "fallocate", (sqlite3_syscall_ptr)posix_fallocate, 0 },
+#else
+ { "fallocate", (sqlite3_syscall_ptr)0, 0 },
+#endif
+#define osFallocate ((int(*)(int,off_t,off_t))aSyscall[15].pCurrent)
+
+ { "unlink", (sqlite3_syscall_ptr)unlink, 0 },
+#define osUnlink ((int(*)(const char*))aSyscall[16].pCurrent)
+
+ { "openDirectory", (sqlite3_syscall_ptr)openDirectory, 0 },
+#define osOpenDirectory ((int(*)(const char*,int*))aSyscall[17].pCurrent)
+
+ { "mkdir", (sqlite3_syscall_ptr)mkdir, 0 },
+#define osMkdir ((int(*)(const char*,mode_t))aSyscall[18].pCurrent)
+
+ { "rmdir", (sqlite3_syscall_ptr)rmdir, 0 },
+#define osRmdir ((int(*)(const char*))aSyscall[19].pCurrent)
+
+#if defined(HAVE_FCHOWN)
+ { "fchown", (sqlite3_syscall_ptr)fchown, 0 },
+#else
+ { "fchown", (sqlite3_syscall_ptr)0, 0 },
+#endif
+#define osFchown ((int(*)(int,uid_t,gid_t))aSyscall[20].pCurrent)
+
+#if defined(HAVE_FCHOWN)
+ { "geteuid", (sqlite3_syscall_ptr)geteuid, 0 },
+#else
+ { "geteuid", (sqlite3_syscall_ptr)0, 0 },
+#endif
+#define osGeteuid ((uid_t(*)(void))aSyscall[21].pCurrent)
+
+#if (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0) \
+ && !defined(SQLITE_WASI)
+ { "mmap", (sqlite3_syscall_ptr)mmap, 0 },
+#else
+ { "mmap", (sqlite3_syscall_ptr)0, 0 },
+#endif
+#define osMmap ((void*(*)(void*,size_t,int,int,int,off_t))aSyscall[22].pCurrent)
+
+#if (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0) \
+ && !defined(SQLITE_WASI)
+ { "munmap", (sqlite3_syscall_ptr)munmap, 0 },
+#else
+ { "munmap", (sqlite3_syscall_ptr)0, 0 },
+#endif
+#define osMunmap ((int(*)(void*,size_t))aSyscall[23].pCurrent)
+
+#if HAVE_MREMAP && (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0)
+ { "mremap", (sqlite3_syscall_ptr)mremap, 0 },
+#else
+ { "mremap", (sqlite3_syscall_ptr)0, 0 },
+#endif
+#define osMremap ((void*(*)(void*,size_t,size_t,int,...))aSyscall[24].pCurrent)
+
+#if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0
+ { "getpagesize", (sqlite3_syscall_ptr)unixGetpagesize, 0 },
+#else
+ { "getpagesize", (sqlite3_syscall_ptr)0, 0 },
+#endif
+#define osGetpagesize ((int(*)(void))aSyscall[25].pCurrent)
+
+#if defined(HAVE_READLINK)
+ { "readlink", (sqlite3_syscall_ptr)readlink, 0 },
+#else
+ { "readlink", (sqlite3_syscall_ptr)0, 0 },
+#endif
+#define osReadlink ((ssize_t(*)(const char*,char*,size_t))aSyscall[26].pCurrent)
+
+#if defined(HAVE_LSTAT)
+ { "lstat", (sqlite3_syscall_ptr)lstat, 0 },
+#else
+ { "lstat", (sqlite3_syscall_ptr)0, 0 },
+#endif
+#define osLstat ((int(*)(const char*,struct stat*))aSyscall[27].pCurrent)
+
+#if defined(__linux__) && defined(SQLITE_ENABLE_BATCH_ATOMIC_WRITE)
+# ifdef __ANDROID__
+ { "ioctl", (sqlite3_syscall_ptr)(int(*)(int, int, ...))ioctl, 0 },
+#define osIoctl ((int(*)(int,int,...))aSyscall[28].pCurrent)
+# else
+ { "ioctl", (sqlite3_syscall_ptr)ioctl, 0 },
+#define osIoctl ((int(*)(int,unsigned long,...))aSyscall[28].pCurrent)
+# endif
+#else
+ { "ioctl", (sqlite3_syscall_ptr)0, 0 },
+#endif
+
+}; /* End of the overrideable system calls */
+
+
+/*
+** On some systems, calls to fchown() will trigger a message in a security
+** log if they come from non-root processes. So avoid calling fchown() if
+** we are not running as root.
+*/
+static int robustFchown(int fd, uid_t uid, gid_t gid){
+#if defined(HAVE_FCHOWN)
+ return osGeteuid() ? 0 : osFchown(fd,uid,gid);
+#else
+ return 0;
+#endif
+}
+
+/*
+** This is the xSetSystemCall() method of sqlite3_vfs for all of the
+** "unix" VFSes. Return SQLITE_OK upon successfully updating the
+** system call pointer, or SQLITE_NOTFOUND if there is no configurable
+** system call named zName.
+*/
+static int unixSetSystemCall(
+ sqlite3_vfs *pNotUsed, /* The VFS pointer. Not used */
+ const char *zName, /* Name of system call to override */
+ sqlite3_syscall_ptr pNewFunc /* Pointer to new system call value */
+){
+ unsigned int i;
+ int rc = SQLITE_NOTFOUND;
+
+ UNUSED_PARAMETER(pNotUsed);
+ if( zName==0 ){
+ /* If no zName is given, restore all system calls to their default
+ ** settings and return NULL
+ */
+ rc = SQLITE_OK;
+ for(i=0; i<sizeof(aSyscall)/sizeof(aSyscall[0]); i++){
+ if( aSyscall[i].pDefault ){
+ aSyscall[i].pCurrent = aSyscall[i].pDefault;
+ }
+ }
+ }else{
+ /* If zName is specified, operate on only the one system call
+ ** specified.
+ */
+ for(i=0; i<sizeof(aSyscall)/sizeof(aSyscall[0]); i++){
+ if( strcmp(zName, aSyscall[i].zName)==0 ){
+ if( aSyscall[i].pDefault==0 ){
+ aSyscall[i].pDefault = aSyscall[i].pCurrent;
+ }
+ rc = SQLITE_OK;
+ if( pNewFunc==0 ) pNewFunc = aSyscall[i].pDefault;
+ aSyscall[i].pCurrent = pNewFunc;
+ break;
+ }
+ }
+ }
+ return rc;
+}
+
+/*
+** Return the value of a system call. Return NULL if zName is not a
+** recognized system call name. NULL is also returned if the system call
+** is currently undefined.
+*/
+static sqlite3_syscall_ptr unixGetSystemCall(
+ sqlite3_vfs *pNotUsed,
+ const char *zName
+){
+ unsigned int i;
+
+ UNUSED_PARAMETER(pNotUsed);
+ for(i=0; i<sizeof(aSyscall)/sizeof(aSyscall[0]); i++){
+ if( strcmp(zName, aSyscall[i].zName)==0 ) return aSyscall[i].pCurrent;
+ }
+ return 0;
+}
+
+/*
+** Return the name of the first system call after zName. If zName==NULL
+** then return the name of the first system call. Return NULL if zName
+** is the last system call or if zName is not the name of a valid
+** system call.
+*/
+static const char *unixNextSystemCall(sqlite3_vfs *p, const char *zName){
+ int i = -1;
+
+ UNUSED_PARAMETER(p);
+ if( zName ){
+ for(i=0; i<ArraySize(aSyscall)-1; i++){
+ if( strcmp(zName, aSyscall[i].zName)==0 ) break;
+ }
+ }
+ for(i++; i<ArraySize(aSyscall); i++){
+ if( aSyscall[i].pCurrent!=0 ) return aSyscall[i].zName;
+ }
+ return 0;
+}
+
+/*
+** Do not accept any file descriptor less than this value, in order to avoid
+** opening database file using file descriptors that are commonly used for
+** standard input, output, and error.
+*/
+#ifndef SQLITE_MINIMUM_FILE_DESCRIPTOR
+# define SQLITE_MINIMUM_FILE_DESCRIPTOR 3
+#endif
+
+/*
+** Invoke open(). Do so multiple times, until it either succeeds or
+** fails for some reason other than EINTR.
+**
+** If the file creation mode "m" is 0 then set it to the default for
+** SQLite. The default is SQLITE_DEFAULT_FILE_PERMISSIONS (normally
+** 0644) as modified by the system umask. If m is not 0, then
+** make the file creation mode be exactly m ignoring the umask.
+**
+** The m parameter will be non-zero only when creating -wal, -journal,
+** and -shm files. We want those files to have *exactly* the same
+** permissions as their original database, unadulterated by the umask.
+** In that way, if a database file is -rw-rw-rw or -rw-rw-r-, and a
+** transaction crashes and leaves behind hot journals, then any
+** process that is able to write to the database will also be able to
+** recover the hot journals.
+*/
+static int robust_open(const char *z, int f, mode_t m){
+ int fd;
+ mode_t m2 = m ? m : SQLITE_DEFAULT_FILE_PERMISSIONS;
+ while(1){
+#if defined(O_CLOEXEC)
+ fd = osOpen(z,f|O_CLOEXEC,m2);
+#else
+ fd = osOpen(z,f,m2);
+#endif
+ if( fd<0 ){
+ if( errno==EINTR ) continue;
+ break;
+ }
+ if( fd>=SQLITE_MINIMUM_FILE_DESCRIPTOR ) break;
+ if( (f & (O_EXCL|O_CREAT))==(O_EXCL|O_CREAT) ){
+ (void)osUnlink(z);
+ }
+ osClose(fd);
+ sqlite3_log(SQLITE_WARNING,
+ "attempt to open \"%s\" as file descriptor %d", z, fd);
+ fd = -1;
+ if( osOpen("/dev/null", O_RDONLY, m)<0 ) break;
+ }
+ if( fd>=0 ){
+ if( m!=0 ){
+ struct stat statbuf;
+ if( osFstat(fd, &statbuf)==0
+ && statbuf.st_size==0
+ && (statbuf.st_mode&0777)!=m
+ ){
+ osFchmod(fd, m);
+ }
+ }
+#if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0)
+ osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
+#endif
+ }
+ return fd;
+}
+
+/*
+** Helper functions to obtain and relinquish the global mutex. The
+** global mutex is used to protect the unixInodeInfo and
+** vxworksFileId objects used by this file, all of which may be
+** shared by multiple threads.
+**
+** Function unixMutexHeld() is used to assert() that the global mutex
+** is held when required. This function is only used as part of assert()
+** statements. e.g.
+**
+** unixEnterMutex()
+** assert( unixMutexHeld() );
+** unixEnterLeave()
+**
+** To prevent deadlock, the global unixBigLock must must be acquired
+** before the unixInodeInfo.pLockMutex mutex, if both are held. It is
+** OK to get the pLockMutex without holding unixBigLock first, but if
+** that happens, the unixBigLock mutex must not be acquired until after
+** pLockMutex is released.
+**
+** OK: enter(unixBigLock), enter(pLockInfo)
+** OK: enter(unixBigLock)
+** OK: enter(pLockInfo)
+** ERROR: enter(pLockInfo), enter(unixBigLock)
+*/
+static sqlite3_mutex *unixBigLock = 0;
+static void unixEnterMutex(void){
+ assert( sqlite3_mutex_notheld(unixBigLock) ); /* Not a recursive mutex */
+ sqlite3_mutex_enter(unixBigLock);
+}
+static void unixLeaveMutex(void){
+ assert( sqlite3_mutex_held(unixBigLock) );
+ sqlite3_mutex_leave(unixBigLock);
+}
+#ifdef SQLITE_DEBUG
+static int unixMutexHeld(void) {
+ return sqlite3_mutex_held(unixBigLock);
+}
+#endif
+
+
+#ifdef SQLITE_HAVE_OS_TRACE
+/*
+** Helper function for printing out trace information from debugging
+** binaries. This returns the string representation of the supplied
+** integer lock-type.
+*/
+static const char *azFileLock(int eFileLock){
+ switch( eFileLock ){
+ case NO_LOCK: return "NONE";
+ case SHARED_LOCK: return "SHARED";
+ case RESERVED_LOCK: return "RESERVED";
+ case PENDING_LOCK: return "PENDING";
+ case EXCLUSIVE_LOCK: return "EXCLUSIVE";
+ }
+ return "ERROR";
+}
+#endif
+
+#ifdef SQLITE_LOCK_TRACE
+/*
+** Print out information about all locking operations.
+**
+** This routine is used for troubleshooting locks on multithreaded
+** platforms. Enable by compiling with the -DSQLITE_LOCK_TRACE
+** command-line option on the compiler. This code is normally
+** turned off.
+*/
+static int lockTrace(int fd, int op, struct flock *p){
+ char *zOpName, *zType;
+ int s;
+ int savedErrno;
+ if( op==F_GETLK ){
+ zOpName = "GETLK";
+ }else if( op==F_SETLK ){
+ zOpName = "SETLK";
+ }else{
+ s = osFcntl(fd, op, p);
+ sqlite3DebugPrintf("fcntl unknown %d %d %d\n", fd, op, s);
+ return s;
+ }
+ if( p->l_type==F_RDLCK ){
+ zType = "RDLCK";
+ }else if( p->l_type==F_WRLCK ){
+ zType = "WRLCK";
+ }else if( p->l_type==F_UNLCK ){
+ zType = "UNLCK";
+ }else{
+ assert( 0 );
+ }
+ assert( p->l_whence==SEEK_SET );
+ s = osFcntl(fd, op, p);
+ savedErrno = errno;
+ sqlite3DebugPrintf("fcntl %d %d %s %s %d %d %d %d\n",
+ threadid, fd, zOpName, zType, (int)p->l_start, (int)p->l_len,
+ (int)p->l_pid, s);
+ if( s==(-1) && op==F_SETLK && (p->l_type==F_RDLCK || p->l_type==F_WRLCK) ){
+ struct flock l2;
+ l2 = *p;
+ osFcntl(fd, F_GETLK, &l2);
+ if( l2.l_type==F_RDLCK ){
+ zType = "RDLCK";
+ }else if( l2.l_type==F_WRLCK ){
+ zType = "WRLCK";
+ }else if( l2.l_type==F_UNLCK ){
+ zType = "UNLCK";
+ }else{
+ assert( 0 );
+ }
+ sqlite3DebugPrintf("fcntl-failure-reason: %s %d %d %d\n",
+ zType, (int)l2.l_start, (int)l2.l_len, (int)l2.l_pid);
+ }
+ errno = savedErrno;
+ return s;
+}
+#undef osFcntl
+#define osFcntl lockTrace
+#endif /* SQLITE_LOCK_TRACE */
+
+/*
+** Retry ftruncate() calls that fail due to EINTR
+**
+** All calls to ftruncate() within this file should be made through
+** this wrapper. On the Android platform, bypassing the logic below
+** could lead to a corrupt database.
+*/
+static int robust_ftruncate(int h, sqlite3_int64 sz){
+ int rc;
+#ifdef __ANDROID__
+ /* On Android, ftruncate() always uses 32-bit offsets, even if
+ ** _FILE_OFFSET_BITS=64 is defined. This means it is unsafe to attempt to
+ ** truncate a file to any size larger than 2GiB. Silently ignore any
+ ** such attempts. */
+ if( sz>(sqlite3_int64)0x7FFFFFFF ){
+ rc = SQLITE_OK;
+ }else
+#endif
+ do{ rc = osFtruncate(h,sz); }while( rc<0 && errno==EINTR );
+ return rc;
+}
+
+/*
+** This routine translates a standard POSIX errno code into something
+** useful to the clients of the sqlite3 functions. Specifically, it is
+** intended to translate a variety of "try again" errors into SQLITE_BUSY
+** and a variety of "please close the file descriptor NOW" errors into
+** SQLITE_IOERR
+**
+** Errors during initialization of locks, or file system support for locks,
+** should handle ENOLCK, ENOTSUP, EOPNOTSUPP separately.
+*/
+static int sqliteErrorFromPosixError(int posixError, int sqliteIOErr) {
+ assert( (sqliteIOErr == SQLITE_IOERR_LOCK) ||
+ (sqliteIOErr == SQLITE_IOERR_UNLOCK) ||
+ (sqliteIOErr == SQLITE_IOERR_RDLOCK) ||
+ (sqliteIOErr == SQLITE_IOERR_CHECKRESERVEDLOCK) );
+ switch (posixError) {
+ case EACCES:
+ case EAGAIN:
+ case ETIMEDOUT:
+ case EBUSY:
+ case EINTR:
+ case ENOLCK:
+ /* random NFS retry error, unless during file system support
+ * introspection, in which it actually means what it says */
+ return SQLITE_BUSY;
+
+ case EPERM:
+ return SQLITE_PERM;
+
+ default:
+ return sqliteIOErr;
+ }
+}
+
+
+/******************************************************************************
+****************** Begin Unique File ID Utility Used By VxWorks ***************
+**
+** On most versions of unix, we can get a unique ID for a file by concatenating
+** the device number and the inode number. But this does not work on VxWorks.
+** On VxWorks, a unique file id must be based on the canonical filename.
+**
+** A pointer to an instance of the following structure can be used as a
+** unique file ID in VxWorks. Each instance of this structure contains
+** a copy of the canonical filename. There is also a reference count.
+** The structure is reclaimed when the number of pointers to it drops to
+** zero.
+**
+** There are never very many files open at one time and lookups are not
+** a performance-critical path, so it is sufficient to put these
+** structures on a linked list.
+*/
+struct vxworksFileId {
+ struct vxworksFileId *pNext; /* Next in a list of them all */
+ int nRef; /* Number of references to this one */
+ int nName; /* Length of the zCanonicalName[] string */
+ char *zCanonicalName; /* Canonical filename */
+};
+
+#if OS_VXWORKS
+/*
+** All unique filenames are held on a linked list headed by this
+** variable:
+*/
+static struct vxworksFileId *vxworksFileList = 0;
+
+/*
+** Simplify a filename into its canonical form
+** by making the following changes:
+**
+** * removing any trailing and duplicate /
+** * convert /./ into just /
+** * convert /A/../ where A is any simple name into just /
+**
+** Changes are made in-place. Return the new name length.
+**
+** The original filename is in z[0..n-1]. Return the number of
+** characters in the simplified name.
+*/
+static int vxworksSimplifyName(char *z, int n){
+ int i, j;
+ while( n>1 && z[n-1]=='/' ){ n--; }
+ for(i=j=0; i<n; i++){
+ if( z[i]=='/' ){
+ if( z[i+1]=='/' ) continue;
+ if( z[i+1]=='.' && i+2<n && z[i+2]=='/' ){
+ i += 1;
+ continue;
+ }
+ if( z[i+1]=='.' && i+3<n && z[i+2]=='.' && z[i+3]=='/' ){
+ while( j>0 && z[j-1]!='/' ){ j--; }
+ if( j>0 ){ j--; }
+ i += 2;
+ continue;
+ }
+ }
+ z[j++] = z[i];
+ }
+ z[j] = 0;
+ return j;
+}
+
+/*
+** Find a unique file ID for the given absolute pathname. Return
+** a pointer to the vxworksFileId object. This pointer is the unique
+** file ID.
+**
+** The nRef field of the vxworksFileId object is incremented before
+** the object is returned. A new vxworksFileId object is created
+** and added to the global list if necessary.
+**
+** If a memory allocation error occurs, return NULL.
+*/
+static struct vxworksFileId *vxworksFindFileId(const char *zAbsoluteName){
+ struct vxworksFileId *pNew; /* search key and new file ID */
+ struct vxworksFileId *pCandidate; /* For looping over existing file IDs */
+ int n; /* Length of zAbsoluteName string */
+
+ assert( zAbsoluteName[0]=='/' );
+ n = (int)strlen(zAbsoluteName);
+ pNew = sqlite3_malloc64( sizeof(*pNew) + (n+1) );
+ if( pNew==0 ) return 0;
+ pNew->zCanonicalName = (char*)&pNew[1];
+ memcpy(pNew->zCanonicalName, zAbsoluteName, n+1);
+ n = vxworksSimplifyName(pNew->zCanonicalName, n);
+
+ /* Search for an existing entry that matching the canonical name.
+ ** If found, increment the reference count and return a pointer to
+ ** the existing file ID.
+ */
+ unixEnterMutex();
+ for(pCandidate=vxworksFileList; pCandidate; pCandidate=pCandidate->pNext){
+ if( pCandidate->nName==n
+ && memcmp(pCandidate->zCanonicalName, pNew->zCanonicalName, n)==0
+ ){
+ sqlite3_free(pNew);
+ pCandidate->nRef++;
+ unixLeaveMutex();
+ return pCandidate;
+ }
+ }
+
+ /* No match was found. We will make a new file ID */
+ pNew->nRef = 1;
+ pNew->nName = n;
+ pNew->pNext = vxworksFileList;
+ vxworksFileList = pNew;
+ unixLeaveMutex();
+ return pNew;
+}
+
+/*
+** Decrement the reference count on a vxworksFileId object. Free
+** the object when the reference count reaches zero.
+*/
+static void vxworksReleaseFileId(struct vxworksFileId *pId){
+ unixEnterMutex();
+ assert( pId->nRef>0 );
+ pId->nRef--;
+ if( pId->nRef==0 ){
+ struct vxworksFileId **pp;
+ for(pp=&vxworksFileList; *pp && *pp!=pId; pp = &((*pp)->pNext)){}
+ assert( *pp==pId );
+ *pp = pId->pNext;
+ sqlite3_free(pId);
+ }
+ unixLeaveMutex();
+}
+#endif /* OS_VXWORKS */
+/*************** End of Unique File ID Utility Used By VxWorks ****************
+******************************************************************************/
+
+
+/******************************************************************************
+*************************** Posix Advisory Locking ****************************
+**
+** POSIX advisory locks are broken by design. ANSI STD 1003.1 (1996)
+** section 6.5.2.2 lines 483 through 490 specify that when a process
+** sets or clears a lock, that operation overrides any prior locks set
+** by the same process. It does not explicitly say so, but this implies
+** that it overrides locks set by the same process using a different
+** file descriptor. Consider this test case:
+**
+** int fd1 = open("./file1", O_RDWR|O_CREAT, 0644);
+** int fd2 = open("./file2", O_RDWR|O_CREAT, 0644);
+**
+** Suppose ./file1 and ./file2 are really the same file (because
+** one is a hard or symbolic link to the other) then if you set
+** an exclusive lock on fd1, then try to get an exclusive lock
+** on fd2, it works. I would have expected the second lock to
+** fail since there was already a lock on the file due to fd1.
+** But not so. Since both locks came from the same process, the
+** second overrides the first, even though they were on different
+** file descriptors opened on different file names.
+**
+** This means that we cannot use POSIX locks to synchronize file access
+** among competing threads of the same process. POSIX locks will work fine
+** to synchronize access for threads in separate processes, but not
+** threads within the same process.
+**
+** To work around the problem, SQLite has to manage file locks internally
+** on its own. Whenever a new database is opened, we have to find the
+** specific inode of the database file (the inode is determined by the
+** st_dev and st_ino fields of the stat structure that fstat() fills in)
+** and check for locks already existing on that inode. When locks are
+** created or removed, we have to look at our own internal record of the
+** locks to see if another thread has previously set a lock on that same
+** inode.
+**
+** (Aside: The use of inode numbers as unique IDs does not work on VxWorks.
+** For VxWorks, we have to use the alternative unique ID system based on
+** canonical filename and implemented in the previous division.)
+**
+** The sqlite3_file structure for POSIX is no longer just an integer file
+** descriptor. It is now a structure that holds the integer file
+** descriptor and a pointer to a structure that describes the internal
+** locks on the corresponding inode. There is one locking structure
+** per inode, so if the same inode is opened twice, both unixFile structures
+** point to the same locking structure. The locking structure keeps
+** a reference count (so we will know when to delete it) and a "cnt"
+** field that tells us its internal lock status. cnt==0 means the
+** file is unlocked. cnt==-1 means the file has an exclusive lock.
+** cnt>0 means there are cnt shared locks on the file.
+**
+** Any attempt to lock or unlock a file first checks the locking
+** structure. The fcntl() system call is only invoked to set a
+** POSIX lock if the internal lock structure transitions between
+** a locked and an unlocked state.
+**
+** But wait: there are yet more problems with POSIX advisory locks.
+**
+** If you close a file descriptor that points to a file that has locks,
+** all locks on that file that are owned by the current process are
+** released. To work around this problem, each unixInodeInfo object
+** maintains a count of the number of pending locks on the inode.
+** When an attempt is made to close an unixFile, if there are
+** other unixFile open on the same inode that are holding locks, the call
+** to close() the file descriptor is deferred until all of the locks clear.
+** The unixInodeInfo structure keeps a list of file descriptors that need to
+** be closed and that list is walked (and cleared) when the last lock
+** clears.
+**
+** Yet another problem: LinuxThreads do not play well with posix locks.
+**
+** Many older versions of linux use the LinuxThreads library which is
+** not posix compliant. Under LinuxThreads, a lock created by thread
+** A cannot be modified or overridden by a different thread B.
+** Only thread A can modify the lock. Locking behavior is correct
+** if the application uses the newer Native Posix Thread Library (NPTL)
+** on linux - with NPTL a lock created by thread A can override locks
+** in thread B. But there is no way to know at compile-time which
+** threading library is being used. So there is no way to know at
+** compile-time whether or not thread A can override locks on thread B.
+** One has to do a run-time check to discover the behavior of the
+** current process.
+**
+** SQLite used to support LinuxThreads. But support for LinuxThreads
+** was dropped beginning with version 3.7.0. SQLite will still work with
+** LinuxThreads provided that (1) there is no more than one connection
+** per database file in the same process and (2) database connections
+** do not move across threads.
+*/
+
+/*
+** An instance of the following structure serves as the key used
+** to locate a particular unixInodeInfo object.
+*/
+struct unixFileId {
+ dev_t dev; /* Device number */
+#if OS_VXWORKS
+ struct vxworksFileId *pId; /* Unique file ID for vxworks. */
+#else
+ /* We are told that some versions of Android contain a bug that
+ ** sizes ino_t at only 32-bits instead of 64-bits. (See
+ ** https://android-review.googlesource.com/#/c/115351/3/dist/sqlite3.c)
+ ** To work around this, always allocate 64-bits for the inode number.
+ ** On small machines that only have 32-bit inodes, this wastes 4 bytes,
+ ** but that should not be a big deal. */
+ /* WAS: ino_t ino; */
+ u64 ino; /* Inode number */
+#endif
+};
+
+/*
+** An instance of the following structure is allocated for each open
+** inode.
+**
+** A single inode can have multiple file descriptors, so each unixFile
+** structure contains a pointer to an instance of this object and this
+** object keeps a count of the number of unixFile pointing to it.
+**
+** Mutex rules:
+**
+** (1) Only the pLockMutex mutex must be held in order to read or write
+** any of the locking fields:
+** nShared, nLock, eFileLock, bProcessLock, pUnused
+**
+** (2) When nRef>0, then the following fields are unchanging and can
+** be read (but not written) without holding any mutex:
+** fileId, pLockMutex
+**
+** (3) With the exceptions above, all the fields may only be read
+** or written while holding the global unixBigLock mutex.
+**
+** Deadlock prevention: The global unixBigLock mutex may not
+** be acquired while holding the pLockMutex mutex. If both unixBigLock
+** and pLockMutex are needed, then unixBigLock must be acquired first.
+*/
+struct unixInodeInfo {
+ struct unixFileId fileId; /* The lookup key */
+ sqlite3_mutex *pLockMutex; /* Hold this mutex for... */
+ int nShared; /* Number of SHARED locks held */
+ int nLock; /* Number of outstanding file locks */
+ unsigned char eFileLock; /* One of SHARED_LOCK, RESERVED_LOCK etc. */
+ unsigned char bProcessLock; /* An exclusive process lock is held */
+ UnixUnusedFd *pUnused; /* Unused file descriptors to close */
+ int nRef; /* Number of pointers to this structure */
+ unixShmNode *pShmNode; /* Shared memory associated with this inode */
+ unixInodeInfo *pNext; /* List of all unixInodeInfo objects */
+ unixInodeInfo *pPrev; /* .... doubly linked */
+#if SQLITE_ENABLE_LOCKING_STYLE
+ unsigned long long sharedByte; /* for AFP simulated shared lock */
+#endif
+#if OS_VXWORKS
+ sem_t *pSem; /* Named POSIX semaphore */
+ char aSemName[MAX_PATHNAME+2]; /* Name of that semaphore */
+#endif
+};
+
+/*
+** A lists of all unixInodeInfo objects.
+**
+** Must hold unixBigLock in order to read or write this variable.
+*/
+static unixInodeInfo *inodeList = 0; /* All unixInodeInfo objects */
+
+#ifdef SQLITE_DEBUG
+/*
+** True if the inode mutex (on the unixFile.pFileMutex field) is held, or not.
+** This routine is used only within assert() to help verify correct mutex
+** usage.
+*/
+int unixFileMutexHeld(unixFile *pFile){
+ assert( pFile->pInode );
+ return sqlite3_mutex_held(pFile->pInode->pLockMutex);
+}
+int unixFileMutexNotheld(unixFile *pFile){
+ assert( pFile->pInode );
+ return sqlite3_mutex_notheld(pFile->pInode->pLockMutex);
+}
+#endif
+
+/*
+**
+** This function - unixLogErrorAtLine(), is only ever called via the macro
+** unixLogError().
+**
+** It is invoked after an error occurs in an OS function and errno has been
+** set. It logs a message using sqlite3_log() containing the current value of
+** errno and, if possible, the human-readable equivalent from strerror() or
+** strerror_r().
+**
+** The first argument passed to the macro should be the error code that
+** will be returned to SQLite (e.g. SQLITE_IOERR_DELETE, SQLITE_CANTOPEN).
+** The two subsequent arguments should be the name of the OS function that
+** failed (e.g. "unlink", "open") and the associated file-system path,
+** if any.
+*/
+#define unixLogError(a,b,c) unixLogErrorAtLine(a,b,c,__LINE__)
+static int unixLogErrorAtLine(
+ int errcode, /* SQLite error code */
+ const char *zFunc, /* Name of OS function that failed */
+ const char *zPath, /* File path associated with error */
+ int iLine /* Source line number where error occurred */
+){
+ char *zErr; /* Message from strerror() or equivalent */
+ int iErrno = errno; /* Saved syscall error number */
+
+ /* If this is not a threadsafe build (SQLITE_THREADSAFE==0), then use
+ ** the strerror() function to obtain the human-readable error message
+ ** equivalent to errno. Otherwise, use strerror_r().
+ */
+#if SQLITE_THREADSAFE && defined(HAVE_STRERROR_R)
+ char aErr[80];
+ memset(aErr, 0, sizeof(aErr));
+ zErr = aErr;
+
+ /* If STRERROR_R_CHAR_P (set by autoconf scripts) or __USE_GNU is defined,
+ ** assume that the system provides the GNU version of strerror_r() that
+ ** returns a pointer to a buffer containing the error message. That pointer
+ ** may point to aErr[], or it may point to some static storage somewhere.
+ ** Otherwise, assume that the system provides the POSIX version of
+ ** strerror_r(), which always writes an error message into aErr[].
+ **
+ ** If the code incorrectly assumes that it is the POSIX version that is
+ ** available, the error message will often be an empty string. Not a
+ ** huge problem. Incorrectly concluding that the GNU version is available
+ ** could lead to a segfault though.
+ **
+ ** Forum post 3f13857fa4062301 reports that the Android SDK may use
+ ** int-type return, depending on its version.
+ */
+#if (defined(STRERROR_R_CHAR_P) || defined(__USE_GNU)) \
+ && !defined(ANDROID) && !defined(__ANDROID__)
+ zErr =
+# endif
+ strerror_r(iErrno, aErr, sizeof(aErr)-1);
+
+#elif SQLITE_THREADSAFE
+ /* This is a threadsafe build, but strerror_r() is not available. */
+ zErr = "";
+#else
+ /* Non-threadsafe build, use strerror(). */
+ zErr = strerror(iErrno);
+#endif
+
+ if( zPath==0 ) zPath = "";
+ sqlite3_log(errcode,
+ "os_unix.c:%d: (%d) %s(%s) - %s",
+ iLine, iErrno, zFunc, zPath, zErr
+ );
+
+ return errcode;
+}
+
+/*
+** Close a file descriptor.
+**
+** We assume that close() almost always works, since it is only in a
+** very sick application or on a very sick platform that it might fail.
+** If it does fail, simply leak the file descriptor, but do log the
+** error.
+**
+** Note that it is not safe to retry close() after EINTR since the
+** file descriptor might have already been reused by another thread.
+** So we don't even try to recover from an EINTR. Just log the error
+** and move on.
+*/
+static void robust_close(unixFile *pFile, int h, int lineno){
+ if( osClose(h) ){
+ unixLogErrorAtLine(SQLITE_IOERR_CLOSE, "close",
+ pFile ? pFile->zPath : 0, lineno);
+ }
+}
+
+/*
+** Set the pFile->lastErrno. Do this in a subroutine as that provides
+** a convenient place to set a breakpoint.
+*/
+static void storeLastErrno(unixFile *pFile, int error){
+ pFile->lastErrno = error;
+}
+
+/*
+** Close all file descriptors accumulated in the unixInodeInfo->pUnused list.
+*/
+static void closePendingFds(unixFile *pFile){
+ unixInodeInfo *pInode = pFile->pInode;
+ UnixUnusedFd *p;
+ UnixUnusedFd *pNext;
+ assert( unixFileMutexHeld(pFile) );
+ for(p=pInode->pUnused; p; p=pNext){
+ pNext = p->pNext;
+ robust_close(pFile, p->fd, __LINE__);
+ sqlite3_free(p);
+ }
+ pInode->pUnused = 0;
+}
+
+/*
+** Release a unixInodeInfo structure previously allocated by findInodeInfo().
+**
+** The global mutex must be held when this routine is called, but the mutex
+** on the inode being deleted must NOT be held.
+*/
+static void releaseInodeInfo(unixFile *pFile){
+ unixInodeInfo *pInode = pFile->pInode;
+ assert( unixMutexHeld() );
+ assert( unixFileMutexNotheld(pFile) );
+ if( ALWAYS(pInode) ){
+ pInode->nRef--;
+ if( pInode->nRef==0 ){
+ assert( pInode->pShmNode==0 );
+ sqlite3_mutex_enter(pInode->pLockMutex);
+ closePendingFds(pFile);
+ sqlite3_mutex_leave(pInode->pLockMutex);
+ if( pInode->pPrev ){
+ assert( pInode->pPrev->pNext==pInode );
+ pInode->pPrev->pNext = pInode->pNext;
+ }else{
+ assert( inodeList==pInode );
+ inodeList = pInode->pNext;
+ }
+ if( pInode->pNext ){
+ assert( pInode->pNext->pPrev==pInode );
+ pInode->pNext->pPrev = pInode->pPrev;
+ }
+ sqlite3_mutex_free(pInode->pLockMutex);
+ sqlite3_free(pInode);
+ }
+ }
+}
+
+/*
+** Given a file descriptor, locate the unixInodeInfo object that
+** describes that file descriptor. Create a new one if necessary. The
+** return value might be uninitialized if an error occurs.
+**
+** The global mutex must held when calling this routine.
+**
+** Return an appropriate error code.
+*/
+static int findInodeInfo(
+ unixFile *pFile, /* Unix file with file desc used in the key */
+ unixInodeInfo **ppInode /* Return the unixInodeInfo object here */
+){
+ int rc; /* System call return code */
+ int fd; /* The file descriptor for pFile */
+ struct unixFileId fileId; /* Lookup key for the unixInodeInfo */
+ struct stat statbuf; /* Low-level file information */
+ unixInodeInfo *pInode = 0; /* Candidate unixInodeInfo object */
+
+ assert( unixMutexHeld() );
+
+ /* Get low-level information about the file that we can used to
+ ** create a unique name for the file.
+ */
+ fd = pFile->h;
+ rc = osFstat(fd, &statbuf);
+ if( rc!=0 ){
+ storeLastErrno(pFile, errno);
+#if defined(EOVERFLOW) && defined(SQLITE_DISABLE_LFS)
+ if( pFile->lastErrno==EOVERFLOW ) return SQLITE_NOLFS;
+#endif
+ return SQLITE_IOERR;
+ }
+
+#ifdef __APPLE__
+ /* On OS X on an msdos filesystem, the inode number is reported
+ ** incorrectly for zero-size files. See ticket #3260. To work
+ ** around this problem (we consider it a bug in OS X, not SQLite)
+ ** we always increase the file size to 1 by writing a single byte
+ ** prior to accessing the inode number. The one byte written is
+ ** an ASCII 'S' character which also happens to be the first byte
+ ** in the header of every SQLite database. In this way, if there
+ ** is a race condition such that another thread has already populated
+ ** the first page of the database, no damage is done.
+ */
+ if( statbuf.st_size==0 && (pFile->fsFlags & SQLITE_FSFLAGS_IS_MSDOS)!=0 ){
+ do{ rc = osWrite(fd, "S", 1); }while( rc<0 && errno==EINTR );
+ if( rc!=1 ){
+ storeLastErrno(pFile, errno);
+ return SQLITE_IOERR;
+ }
+ rc = osFstat(fd, &statbuf);
+ if( rc!=0 ){
+ storeLastErrno(pFile, errno);
+ return SQLITE_IOERR;
+ }
+ }
+#endif
+
+ memset(&fileId, 0, sizeof(fileId));
+ fileId.dev = statbuf.st_dev;
+#if OS_VXWORKS
+ fileId.pId = pFile->pId;
+#else
+ fileId.ino = (u64)statbuf.st_ino;
+#endif
+ assert( unixMutexHeld() );
+ pInode = inodeList;
+ while( pInode && memcmp(&fileId, &pInode->fileId, sizeof(fileId)) ){
+ pInode = pInode->pNext;
+ }
+ if( pInode==0 ){
+ pInode = sqlite3_malloc64( sizeof(*pInode) );
+ if( pInode==0 ){
+ return SQLITE_NOMEM_BKPT;
+ }
+ memset(pInode, 0, sizeof(*pInode));
+ memcpy(&pInode->fileId, &fileId, sizeof(fileId));
+ if( sqlite3GlobalConfig.bCoreMutex ){
+ pInode->pLockMutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST);
+ if( pInode->pLockMutex==0 ){
+ sqlite3_free(pInode);
+ return SQLITE_NOMEM_BKPT;
+ }
+ }
+ pInode->nRef = 1;
+ assert( unixMutexHeld() );
+ pInode->pNext = inodeList;
+ pInode->pPrev = 0;
+ if( inodeList ) inodeList->pPrev = pInode;
+ inodeList = pInode;
+ }else{
+ pInode->nRef++;
+ }
+ *ppInode = pInode;
+ return SQLITE_OK;
+}
+
+/*
+** Return TRUE if pFile has been renamed or unlinked since it was first opened.
+*/
+static int fileHasMoved(unixFile *pFile){
+#if OS_VXWORKS
+ return pFile->pInode!=0 && pFile->pId!=pFile->pInode->fileId.pId;
+#else
+ struct stat buf;
+ return pFile->pInode!=0 &&
+ (osStat(pFile->zPath, &buf)!=0
+ || (u64)buf.st_ino!=pFile->pInode->fileId.ino);
+#endif
+}
+
+
+/*
+** Check a unixFile that is a database. Verify the following:
+**
+** (1) There is exactly one hard link on the file
+** (2) The file is not a symbolic link
+** (3) The file has not been renamed or unlinked
+**
+** Issue sqlite3_log(SQLITE_WARNING,...) messages if anything is not right.
+*/
+static void verifyDbFile(unixFile *pFile){
+ struct stat buf;
+ int rc;
+
+ /* These verifications occurs for the main database only */
+ if( pFile->ctrlFlags & UNIXFILE_NOLOCK ) return;
+
+ rc = osFstat(pFile->h, &buf);
+ if( rc!=0 ){
+ sqlite3_log(SQLITE_WARNING, "cannot fstat db file %s", pFile->zPath);
+ return;
+ }
+ if( buf.st_nlink==0 ){
+ sqlite3_log(SQLITE_WARNING, "file unlinked while open: %s", pFile->zPath);
+ return;
+ }
+ if( buf.st_nlink>1 ){
+ sqlite3_log(SQLITE_WARNING, "multiple links to file: %s", pFile->zPath);
+ return;
+ }
+ if( fileHasMoved(pFile) ){
+ sqlite3_log(SQLITE_WARNING, "file renamed while open: %s", pFile->zPath);
+ return;
+ }
+}
+
+
+/*
+** This routine checks if there is a RESERVED lock held on the specified
+** file by this or any other process. If such a lock is held, set *pResOut
+** to a non-zero value otherwise *pResOut is set to zero. The return value
+** is set to SQLITE_OK unless an I/O error occurs during lock checking.
+*/
+static int unixCheckReservedLock(sqlite3_file *id, int *pResOut){
+ int rc = SQLITE_OK;
+ int reserved = 0;
+ unixFile *pFile = (unixFile*)id;
+
+ SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; );
+
+ assert( pFile );
+ assert( pFile->eFileLock<=SHARED_LOCK );
+ sqlite3_mutex_enter(pFile->pInode->pLockMutex);
+
+ /* Check if a thread in this process holds such a lock */
+ if( pFile->pInode->eFileLock>SHARED_LOCK ){
+ reserved = 1;
+ }
+
+ /* Otherwise see if some other process holds it.
+ */
+#ifndef __DJGPP__
+ if( !reserved && !pFile->pInode->bProcessLock ){
+ struct flock lock;
+ lock.l_whence = SEEK_SET;
+ lock.l_start = RESERVED_BYTE;
+ lock.l_len = 1;
+ lock.l_type = F_WRLCK;
+ if( osFcntl(pFile->h, F_GETLK, &lock) ){
+ rc = SQLITE_IOERR_CHECKRESERVEDLOCK;
+ storeLastErrno(pFile, errno);
+ } else if( lock.l_type!=F_UNLCK ){
+ reserved = 1;
+ }
+ }
+#endif
+
+ sqlite3_mutex_leave(pFile->pInode->pLockMutex);
+ OSTRACE(("TEST WR-LOCK %d %d %d (unix)\n", pFile->h, rc, reserved));
+
+ *pResOut = reserved;
+ return rc;
+}
+
+/* Forward declaration*/
+static int unixSleep(sqlite3_vfs*,int);
+
+/*
+** Set a posix-advisory-lock.
+**
+** There are two versions of this routine. If compiled with
+** SQLITE_ENABLE_SETLK_TIMEOUT then the routine has an extra parameter
+** which is a pointer to a unixFile. If the unixFile->iBusyTimeout
+** value is set, then it is the number of milliseconds to wait before
+** failing the lock. The iBusyTimeout value is always reset back to
+** zero on each call.
+**
+** If SQLITE_ENABLE_SETLK_TIMEOUT is not defined, then do a non-blocking
+** attempt to set the lock.
+*/
+#ifndef SQLITE_ENABLE_SETLK_TIMEOUT
+# define osSetPosixAdvisoryLock(h,x,t) osFcntl(h,F_SETLK,x)
+#else
+static int osSetPosixAdvisoryLock(
+ int h, /* The file descriptor on which to take the lock */
+ struct flock *pLock, /* The description of the lock */
+ unixFile *pFile /* Structure holding timeout value */
+){
+ int tm = pFile->iBusyTimeout;
+ int rc = osFcntl(h,F_SETLK,pLock);
+ while( rc<0 && tm>0 ){
+ /* On systems that support some kind of blocking file lock with a timeout,
+ ** make appropriate changes here to invoke that blocking file lock. On
+ ** generic posix, however, there is no such API. So we simply try the
+ ** lock once every millisecond until either the timeout expires, or until
+ ** the lock is obtained. */
+ unixSleep(0,1000);
+ rc = osFcntl(h,F_SETLK,pLock);
+ tm--;
+ }
+ return rc;
+}
+#endif /* SQLITE_ENABLE_SETLK_TIMEOUT */
+
+
+/*
+** Attempt to set a system-lock on the file pFile. The lock is
+** described by pLock.
+**
+** If the pFile was opened read/write from unix-excl, then the only lock
+** ever obtained is an exclusive lock, and it is obtained exactly once
+** the first time any lock is attempted. All subsequent system locking
+** operations become no-ops. Locking operations still happen internally,
+** in order to coordinate access between separate database connections
+** within this process, but all of that is handled in memory and the
+** operating system does not participate.
+**
+** This function is a pass-through to fcntl(F_SETLK) if pFile is using
+** any VFS other than "unix-excl" or if pFile is opened on "unix-excl"
+** and is read-only.
+**
+** Zero is returned if the call completes successfully, or -1 if a call
+** to fcntl() fails. In this case, errno is set appropriately (by fcntl()).
+*/
+static int unixFileLock(unixFile *pFile, struct flock *pLock){
+ int rc;
+ unixInodeInfo *pInode = pFile->pInode;
+ assert( pInode!=0 );
+ assert( sqlite3_mutex_held(pInode->pLockMutex) );
+ if( (pFile->ctrlFlags & (UNIXFILE_EXCL|UNIXFILE_RDONLY))==UNIXFILE_EXCL ){
+ if( pInode->bProcessLock==0 ){
+ struct flock lock;
+ /* assert( pInode->nLock==0 ); <-- Not true if unix-excl READONLY used */
+ lock.l_whence = SEEK_SET;
+ lock.l_start = SHARED_FIRST;
+ lock.l_len = SHARED_SIZE;
+ lock.l_type = F_WRLCK;
+ rc = osSetPosixAdvisoryLock(pFile->h, &lock, pFile);
+ if( rc<0 ) return rc;
+ pInode->bProcessLock = 1;
+ pInode->nLock++;
+ }else{
+ rc = 0;
+ }
+ }else{
+ rc = osSetPosixAdvisoryLock(pFile->h, pLock, pFile);
+ }
+ return rc;
+}
+
+/*
+** Lock the file with the lock specified by parameter eFileLock - one
+** of the following:
+**
+** (1) SHARED_LOCK
+** (2) RESERVED_LOCK
+** (3) PENDING_LOCK
+** (4) EXCLUSIVE_LOCK
+**
+** Sometimes when requesting one lock state, additional lock states
+** are inserted in between. The locking might fail on one of the later
+** transitions leaving the lock state different from what it started but
+** still short of its goal. The following chart shows the allowed
+** transitions and the inserted intermediate states:
+**
+** UNLOCKED -> SHARED
+** SHARED -> RESERVED
+** SHARED -> EXCLUSIVE
+** RESERVED -> (PENDING) -> EXCLUSIVE
+** PENDING -> EXCLUSIVE
+**
+** This routine will only increase a lock. Use the sqlite3OsUnlock()
+** routine to lower a locking level.
+*/
+static int unixLock(sqlite3_file *id, int eFileLock){
+ /* The following describes the implementation of the various locks and
+ ** lock transitions in terms of the POSIX advisory shared and exclusive
+ ** lock primitives (called read-locks and write-locks below, to avoid
+ ** confusion with SQLite lock names). The algorithms are complicated
+ ** slightly in order to be compatible with Windows95 systems simultaneously
+ ** accessing the same database file, in case that is ever required.
+ **
+ ** Symbols defined in os.h identify the 'pending byte' and the 'reserved
+ ** byte', each single bytes at well known offsets, and the 'shared byte
+ ** range', a range of 510 bytes at a well known offset.
+ **
+ ** To obtain a SHARED lock, a read-lock is obtained on the 'pending
+ ** byte'. If this is successful, 'shared byte range' is read-locked
+ ** and the lock on the 'pending byte' released. (Legacy note: When
+ ** SQLite was first developed, Windows95 systems were still very common,
+ ** and Windows95 lacks a shared-lock capability. So on Windows95, a
+ ** single randomly selected by from the 'shared byte range' is locked.
+ ** Windows95 is now pretty much extinct, but this work-around for the
+ ** lack of shared-locks on Windows95 lives on, for backwards
+ ** compatibility.)
+ **
+ ** A process may only obtain a RESERVED lock after it has a SHARED lock.
+ ** A RESERVED lock is implemented by grabbing a write-lock on the
+ ** 'reserved byte'.
+ **
+ ** An EXCLUSIVE lock may only be requested after either a SHARED or
+ ** RESERVED lock is held. An EXCLUSIVE lock is implemented by obtaining
+ ** a write-lock on the entire 'shared byte range'. Since all other locks
+ ** require a read-lock on one of the bytes within this range, this ensures
+ ** that no other locks are held on the database.
+ **
+ ** If a process that holds a RESERVED lock requests an EXCLUSIVE, then
+ ** a PENDING lock is obtained first. A PENDING lock is implemented by
+ ** obtaining a write-lock on the 'pending byte'. This ensures that no new
+ ** SHARED locks can be obtained, but existing SHARED locks are allowed to
+ ** persist. If the call to this function fails to obtain the EXCLUSIVE
+ ** lock in this case, it holds the PENDING lock instead. The client may
+ ** then re-attempt the EXCLUSIVE lock later on, after existing SHARED
+ ** locks have cleared.
+ */
+ int rc = SQLITE_OK;
+ unixFile *pFile = (unixFile*)id;
+ unixInodeInfo *pInode;
+ struct flock lock;
+ int tErrno = 0;
+
+ assert( pFile );
+ OSTRACE(("LOCK %d %s was %s(%s,%d) pid=%d (unix)\n", pFile->h,
+ azFileLock(eFileLock), azFileLock(pFile->eFileLock),
+ azFileLock(pFile->pInode->eFileLock), pFile->pInode->nShared,
+ osGetpid(0)));
+
+ /* If there is already a lock of this type or more restrictive on the
+ ** unixFile, do nothing. Don't use the end_lock: exit path, as
+ ** unixEnterMutex() hasn't been called yet.
+ */
+ if( pFile->eFileLock>=eFileLock ){
+ OSTRACE(("LOCK %d %s ok (already held) (unix)\n", pFile->h,
+ azFileLock(eFileLock)));
+ return SQLITE_OK;
+ }
+
+ /* Make sure the locking sequence is correct.
+ ** (1) We never move from unlocked to anything higher than shared lock.
+ ** (2) SQLite never explicitly requests a pending lock.
+ ** (3) A shared lock is always held when a reserve lock is requested.
+ */
+ assert( pFile->eFileLock!=NO_LOCK || eFileLock==SHARED_LOCK );
+ assert( eFileLock!=PENDING_LOCK );
+ assert( eFileLock!=RESERVED_LOCK || pFile->eFileLock==SHARED_LOCK );
+
+ /* This mutex is needed because pFile->pInode is shared across threads
+ */
+ pInode = pFile->pInode;
+ sqlite3_mutex_enter(pInode->pLockMutex);
+
+ /* If some thread using this PID has a lock via a different unixFile*
+ ** handle that precludes the requested lock, return BUSY.
+ */
+ if( (pFile->eFileLock!=pInode->eFileLock &&
+ (pInode->eFileLock>=PENDING_LOCK || eFileLock>SHARED_LOCK))
+ ){
+ rc = SQLITE_BUSY;
+ goto end_lock;
+ }
+
+ /* If a SHARED lock is requested, and some thread using this PID already
+ ** has a SHARED or RESERVED lock, then increment reference counts and
+ ** return SQLITE_OK.
+ */
+ if( eFileLock==SHARED_LOCK &&
+ (pInode->eFileLock==SHARED_LOCK || pInode->eFileLock==RESERVED_LOCK) ){
+ assert( eFileLock==SHARED_LOCK );
+ assert( pFile->eFileLock==0 );
+ assert( pInode->nShared>0 );
+ pFile->eFileLock = SHARED_LOCK;
+ pInode->nShared++;
+ pInode->nLock++;
+ goto end_lock;
+ }
+
+
+ /* A PENDING lock is needed before acquiring a SHARED lock and before
+ ** acquiring an EXCLUSIVE lock. For the SHARED lock, the PENDING will
+ ** be released.
+ */
+ lock.l_len = 1L;
+ lock.l_whence = SEEK_SET;
+ if( eFileLock==SHARED_LOCK
+ || (eFileLock==EXCLUSIVE_LOCK && pFile->eFileLock==RESERVED_LOCK)
+ ){
+ lock.l_type = (eFileLock==SHARED_LOCK?F_RDLCK:F_WRLCK);
+ lock.l_start = PENDING_BYTE;
+ if( unixFileLock(pFile, &lock) ){
+ tErrno = errno;
+ rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK);
+ if( rc!=SQLITE_BUSY ){
+ storeLastErrno(pFile, tErrno);
+ }
+ goto end_lock;
+ }else if( eFileLock==EXCLUSIVE_LOCK ){
+ pFile->eFileLock = PENDING_LOCK;
+ pInode->eFileLock = PENDING_LOCK;
+ }
+ }
+
+
+ /* If control gets to this point, then actually go ahead and make
+ ** operating system calls for the specified lock.
+ */
+ if( eFileLock==SHARED_LOCK ){
+ assert( pInode->nShared==0 );
+ assert( pInode->eFileLock==0 );
+ assert( rc==SQLITE_OK );
+
+ /* Now get the read-lock */
+ lock.l_start = SHARED_FIRST;
+ lock.l_len = SHARED_SIZE;
+ if( unixFileLock(pFile, &lock) ){
+ tErrno = errno;
+ rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK);
+ }
+
+ /* Drop the temporary PENDING lock */
+ lock.l_start = PENDING_BYTE;
+ lock.l_len = 1L;
+ lock.l_type = F_UNLCK;
+ if( unixFileLock(pFile, &lock) && rc==SQLITE_OK ){
+ /* This could happen with a network mount */
+ tErrno = errno;
+ rc = SQLITE_IOERR_UNLOCK;
+ }
+
+ if( rc ){
+ if( rc!=SQLITE_BUSY ){
+ storeLastErrno(pFile, tErrno);
+ }
+ goto end_lock;
+ }else{
+ pFile->eFileLock = SHARED_LOCK;
+ pInode->nLock++;
+ pInode->nShared = 1;
+ }
+ }else if( eFileLock==EXCLUSIVE_LOCK && pInode->nShared>1 ){
+ /* We are trying for an exclusive lock but another thread in this
+ ** same process is still holding a shared lock. */
+ rc = SQLITE_BUSY;
+ }else{
+ /* The request was for a RESERVED or EXCLUSIVE lock. It is
+ ** assumed that there is a SHARED or greater lock on the file
+ ** already.
+ */
+ assert( 0!=pFile->eFileLock );
+ lock.l_type = F_WRLCK;
+
+ assert( eFileLock==RESERVED_LOCK || eFileLock==EXCLUSIVE_LOCK );
+ if( eFileLock==RESERVED_LOCK ){
+ lock.l_start = RESERVED_BYTE;
+ lock.l_len = 1L;
+ }else{
+ lock.l_start = SHARED_FIRST;
+ lock.l_len = SHARED_SIZE;
+ }
+
+ if( unixFileLock(pFile, &lock) ){
+ tErrno = errno;
+ rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK);
+ if( rc!=SQLITE_BUSY ){
+ storeLastErrno(pFile, tErrno);
+ }
+ }
+ }
+
+
+#ifdef SQLITE_DEBUG
+ /* Set up the transaction-counter change checking flags when
+ ** transitioning from a SHARED to a RESERVED lock. The change
+ ** from SHARED to RESERVED marks the beginning of a normal
+ ** write operation (not a hot journal rollback).
+ */
+ if( rc==SQLITE_OK
+ && pFile->eFileLock<=SHARED_LOCK
+ && eFileLock==RESERVED_LOCK
+ ){
+ pFile->transCntrChng = 0;
+ pFile->dbUpdate = 0;
+ pFile->inNormalWrite = 1;
+ }
+#endif
+
+ if( rc==SQLITE_OK ){
+ pFile->eFileLock = eFileLock;
+ pInode->eFileLock = eFileLock;
+ }
+
+end_lock:
+ sqlite3_mutex_leave(pInode->pLockMutex);
+ OSTRACE(("LOCK %d %s %s (unix)\n", pFile->h, azFileLock(eFileLock),
+ rc==SQLITE_OK ? "ok" : "failed"));
+ return rc;
+}
+
+/*
+** Add the file descriptor used by file handle pFile to the corresponding
+** pUnused list.
+*/
+static void setPendingFd(unixFile *pFile){
+ unixInodeInfo *pInode = pFile->pInode;
+ UnixUnusedFd *p = pFile->pPreallocatedUnused;
+ assert( unixFileMutexHeld(pFile) );
+ p->pNext = pInode->pUnused;
+ pInode->pUnused = p;
+ pFile->h = -1;
+ pFile->pPreallocatedUnused = 0;
+}
+
+/*
+** Lower the locking level on file descriptor pFile to eFileLock. eFileLock
+** must be either NO_LOCK or SHARED_LOCK.
+**
+** If the locking level of the file descriptor is already at or below
+** the requested locking level, this routine is a no-op.
+**
+** If handleNFSUnlock is true, then on downgrading an EXCLUSIVE_LOCK to SHARED
+** the byte range is divided into 2 parts and the first part is unlocked then
+** set to a read lock, then the other part is simply unlocked. This works
+** around a bug in BSD NFS lockd (also seen on MacOSX 10.3+) that fails to
+** remove the write lock on a region when a read lock is set.
+*/
+static int posixUnlock(sqlite3_file *id, int eFileLock, int handleNFSUnlock){
+ unixFile *pFile = (unixFile*)id;
+ unixInodeInfo *pInode;
+ struct flock lock;
+ int rc = SQLITE_OK;
+
+ assert( pFile );
+ OSTRACE(("UNLOCK %d %d was %d(%d,%d) pid=%d (unix)\n", pFile->h, eFileLock,
+ pFile->eFileLock, pFile->pInode->eFileLock, pFile->pInode->nShared,
+ osGetpid(0)));
+
+ assert( eFileLock<=SHARED_LOCK );
+ if( pFile->eFileLock<=eFileLock ){
+ return SQLITE_OK;
+ }
+ pInode = pFile->pInode;
+ sqlite3_mutex_enter(pInode->pLockMutex);
+ assert( pInode->nShared!=0 );
+ if( pFile->eFileLock>SHARED_LOCK ){
+ assert( pInode->eFileLock==pFile->eFileLock );
+
+#ifdef SQLITE_DEBUG
+ /* When reducing a lock such that other processes can start
+ ** reading the database file again, make sure that the
+ ** transaction counter was updated if any part of the database
+ ** file changed. If the transaction counter is not updated,
+ ** other connections to the same file might not realize that
+ ** the file has changed and hence might not know to flush their
+ ** cache. The use of a stale cache can lead to database corruption.
+ */
+ pFile->inNormalWrite = 0;
+#endif
+
+ /* downgrading to a shared lock on NFS involves clearing the write lock
+ ** before establishing the readlock - to avoid a race condition we downgrade
+ ** the lock in 2 blocks, so that part of the range will be covered by a
+ ** write lock until the rest is covered by a read lock:
+ ** 1: [WWWWW]
+ ** 2: [....W]
+ ** 3: [RRRRW]
+ ** 4: [RRRR.]
+ */
+ if( eFileLock==SHARED_LOCK ){
+#if !defined(__APPLE__) || !SQLITE_ENABLE_LOCKING_STYLE
+ (void)handleNFSUnlock;
+ assert( handleNFSUnlock==0 );
+#endif
+#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE
+ if( handleNFSUnlock ){
+ int tErrno; /* Error code from system call errors */
+ off_t divSize = SHARED_SIZE - 1;
+
+ lock.l_type = F_UNLCK;
+ lock.l_whence = SEEK_SET;
+ lock.l_start = SHARED_FIRST;
+ lock.l_len = divSize;
+ if( unixFileLock(pFile, &lock)==(-1) ){
+ tErrno = errno;
+ rc = SQLITE_IOERR_UNLOCK;
+ storeLastErrno(pFile, tErrno);
+ goto end_unlock;
+ }
+ lock.l_type = F_RDLCK;
+ lock.l_whence = SEEK_SET;
+ lock.l_start = SHARED_FIRST;
+ lock.l_len = divSize;
+ if( unixFileLock(pFile, &lock)==(-1) ){
+ tErrno = errno;
+ rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_RDLOCK);
+ if( IS_LOCK_ERROR(rc) ){
+ storeLastErrno(pFile, tErrno);
+ }
+ goto end_unlock;
+ }
+ lock.l_type = F_UNLCK;
+ lock.l_whence = SEEK_SET;
+ lock.l_start = SHARED_FIRST+divSize;
+ lock.l_len = SHARED_SIZE-divSize;
+ if( unixFileLock(pFile, &lock)==(-1) ){
+ tErrno = errno;
+ rc = SQLITE_IOERR_UNLOCK;
+ storeLastErrno(pFile, tErrno);
+ goto end_unlock;
+ }
+ }else
+#endif /* defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE */
+ {
+ lock.l_type = F_RDLCK;
+ lock.l_whence = SEEK_SET;
+ lock.l_start = SHARED_FIRST;
+ lock.l_len = SHARED_SIZE;
+ if( unixFileLock(pFile, &lock) ){
+ /* In theory, the call to unixFileLock() cannot fail because another
+ ** process is holding an incompatible lock. If it does, this
+ ** indicates that the other process is not following the locking
+ ** protocol. If this happens, return SQLITE_IOERR_RDLOCK. Returning
+ ** SQLITE_BUSY would confuse the upper layer (in practice it causes
+ ** an assert to fail). */
+ rc = SQLITE_IOERR_RDLOCK;
+ storeLastErrno(pFile, errno);
+ goto end_unlock;
+ }
+ }
+ }
+ lock.l_type = F_UNLCK;
+ lock.l_whence = SEEK_SET;
+ lock.l_start = PENDING_BYTE;
+ lock.l_len = 2L; assert( PENDING_BYTE+1==RESERVED_BYTE );
+ if( unixFileLock(pFile, &lock)==0 ){
+ pInode->eFileLock = SHARED_LOCK;
+ }else{
+ rc = SQLITE_IOERR_UNLOCK;
+ storeLastErrno(pFile, errno);
+ goto end_unlock;
+ }
+ }
+ if( eFileLock==NO_LOCK ){
+ /* Decrement the shared lock counter. Release the lock using an
+ ** OS call only when all threads in this same process have released
+ ** the lock.
+ */
+ pInode->nShared--;
+ if( pInode->nShared==0 ){
+ lock.l_type = F_UNLCK;
+ lock.l_whence = SEEK_SET;
+ lock.l_start = lock.l_len = 0L;
+ if( unixFileLock(pFile, &lock)==0 ){
+ pInode->eFileLock = NO_LOCK;
+ }else{
+ rc = SQLITE_IOERR_UNLOCK;
+ storeLastErrno(pFile, errno);
+ pInode->eFileLock = NO_LOCK;
+ pFile->eFileLock = NO_LOCK;
+ }
+ }
+
+ /* Decrement the count of locks against this same file. When the
+ ** count reaches zero, close any other file descriptors whose close
+ ** was deferred because of outstanding locks.
+ */
+ pInode->nLock--;
+ assert( pInode->nLock>=0 );
+ if( pInode->nLock==0 ) closePendingFds(pFile);
+ }
+
+end_unlock:
+ sqlite3_mutex_leave(pInode->pLockMutex);
+ if( rc==SQLITE_OK ){
+ pFile->eFileLock = eFileLock;
+ }
+ return rc;
+}
+
+/*
+** Lower the locking level on file descriptor pFile to eFileLock. eFileLock
+** must be either NO_LOCK or SHARED_LOCK.
+**
+** If the locking level of the file descriptor is already at or below
+** the requested locking level, this routine is a no-op.
+*/
+static int unixUnlock(sqlite3_file *id, int eFileLock){
+#if SQLITE_MAX_MMAP_SIZE>0
+ assert( eFileLock==SHARED_LOCK || ((unixFile *)id)->nFetchOut==0 );
+#endif
+ return posixUnlock(id, eFileLock, 0);
+}
+
+#if SQLITE_MAX_MMAP_SIZE>0
+static int unixMapfile(unixFile *pFd, i64 nByte);
+static void unixUnmapfile(unixFile *pFd);
+#endif
+
+/*
+** This function performs the parts of the "close file" operation
+** common to all locking schemes. It closes the directory and file
+** handles, if they are valid, and sets all fields of the unixFile
+** structure to 0.
+**
+** It is *not* necessary to hold the mutex when this routine is called,
+** even on VxWorks. A mutex will be acquired on VxWorks by the
+** vxworksReleaseFileId() routine.
+*/
+static int closeUnixFile(sqlite3_file *id){
+ unixFile *pFile = (unixFile*)id;
+#if SQLITE_MAX_MMAP_SIZE>0
+ unixUnmapfile(pFile);
+#endif
+ if( pFile->h>=0 ){
+ robust_close(pFile, pFile->h, __LINE__);
+ pFile->h = -1;
+ }
+#if OS_VXWORKS
+ if( pFile->pId ){
+ if( pFile->ctrlFlags & UNIXFILE_DELETE ){
+ osUnlink(pFile->pId->zCanonicalName);
+ }
+ vxworksReleaseFileId(pFile->pId);
+ pFile->pId = 0;
+ }
+#endif
+#ifdef SQLITE_UNLINK_AFTER_CLOSE
+ if( pFile->ctrlFlags & UNIXFILE_DELETE ){
+ osUnlink(pFile->zPath);
+ sqlite3_free(*(char**)&pFile->zPath);
+ pFile->zPath = 0;
+ }
+#endif
+ OSTRACE(("CLOSE %-3d\n", pFile->h));
+ OpenCounter(-1);
+ sqlite3_free(pFile->pPreallocatedUnused);
+ memset(pFile, 0, sizeof(unixFile));
+ return SQLITE_OK;
+}
+
+/*
+** Close a file.
+*/
+static int unixClose(sqlite3_file *id){
+ int rc = SQLITE_OK;
+ unixFile *pFile = (unixFile *)id;
+ unixInodeInfo *pInode = pFile->pInode;
+
+ assert( pInode!=0 );
+ verifyDbFile(pFile);
+ unixUnlock(id, NO_LOCK);
+ assert( unixFileMutexNotheld(pFile) );
+ unixEnterMutex();
+
+ /* unixFile.pInode is always valid here. Otherwise, a different close
+ ** routine (e.g. nolockClose()) would be called instead.
+ */
+ assert( pFile->pInode->nLock>0 || pFile->pInode->bProcessLock==0 );
+ sqlite3_mutex_enter(pInode->pLockMutex);
+ if( pInode->nLock ){
+ /* If there are outstanding locks, do not actually close the file just
+ ** yet because that would clear those locks. Instead, add the file
+ ** descriptor to pInode->pUnused list. It will be automatically closed
+ ** when the last lock is cleared.
+ */
+ setPendingFd(pFile);
+ }
+ sqlite3_mutex_leave(pInode->pLockMutex);
+ releaseInodeInfo(pFile);
+ assert( pFile->pShm==0 );
+ rc = closeUnixFile(id);
+ unixLeaveMutex();
+ return rc;
+}
+
+/************** End of the posix advisory lock implementation *****************
+******************************************************************************/
+
+/******************************************************************************
+****************************** No-op Locking **********************************
+**
+** Of the various locking implementations available, this is by far the
+** simplest: locking is ignored. No attempt is made to lock the database
+** file for reading or writing.
+**
+** This locking mode is appropriate for use on read-only databases
+** (ex: databases that are burned into CD-ROM, for example.) It can
+** also be used if the application employs some external mechanism to
+** prevent simultaneous access of the same database by two or more
+** database connections. But there is a serious risk of database
+** corruption if this locking mode is used in situations where multiple
+** database connections are accessing the same database file at the same
+** time and one or more of those connections are writing.
+*/
+
+static int nolockCheckReservedLock(sqlite3_file *NotUsed, int *pResOut){
+ UNUSED_PARAMETER(NotUsed);
+ *pResOut = 0;
+ return SQLITE_OK;
+}
+static int nolockLock(sqlite3_file *NotUsed, int NotUsed2){
+ UNUSED_PARAMETER2(NotUsed, NotUsed2);
+ return SQLITE_OK;
+}
+static int nolockUnlock(sqlite3_file *NotUsed, int NotUsed2){
+ UNUSED_PARAMETER2(NotUsed, NotUsed2);
+ return SQLITE_OK;
+}
+
+/*
+** Close the file.
+*/
+static int nolockClose(sqlite3_file *id) {
+ return closeUnixFile(id);
+}
+
+/******************* End of the no-op lock implementation *********************
+******************************************************************************/
+
+/******************************************************************************
+************************* Begin dot-file Locking ******************************
+**
+** The dotfile locking implementation uses the existence of separate lock
+** files (really a directory) to control access to the database. This works
+** on just about every filesystem imaginable. But there are serious downsides:
+**
+** (1) There is zero concurrency. A single reader blocks all other
+** connections from reading or writing the database.
+**
+** (2) An application crash or power loss can leave stale lock files
+** sitting around that need to be cleared manually.
+**
+** Nevertheless, a dotlock is an appropriate locking mode for use if no
+** other locking strategy is available.
+**
+** Dotfile locking works by creating a subdirectory in the same directory as
+** the database and with the same name but with a ".lock" extension added.
+** The existence of a lock directory implies an EXCLUSIVE lock. All other
+** lock types (SHARED, RESERVED, PENDING) are mapped into EXCLUSIVE.
+*/
+
+/*
+** The file suffix added to the data base filename in order to create the
+** lock directory.
+*/
+#define DOTLOCK_SUFFIX ".lock"
+
+/*
+** This routine checks if there is a RESERVED lock held on the specified
+** file by this or any other process. If the caller holds a SHARED
+** or greater lock when it is called, then it is assumed that no other
+** client may hold RESERVED. Or, if the caller holds no lock, then it
+** is assumed another client holds RESERVED if the lock-file exists.
+*/
+static int dotlockCheckReservedLock(sqlite3_file *id, int *pResOut) {
+ unixFile *pFile = (unixFile*)id;
+ SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; );
+
+ if( pFile->eFileLock>=SHARED_LOCK ){
+ *pResOut = 0;
+ }else{
+ *pResOut = osAccess((const char*)pFile->lockingContext, 0)==0;
+ }
+ OSTRACE(("TEST WR-LOCK %d %d %d (dotlock)\n", pFile->h, 0, *pResOut));
+ return SQLITE_OK;
+}
+
+/*
+** Lock the file with the lock specified by parameter eFileLock - one
+** of the following:
+**
+** (1) SHARED_LOCK
+** (2) RESERVED_LOCK
+** (3) PENDING_LOCK
+** (4) EXCLUSIVE_LOCK
+**
+** Sometimes when requesting one lock state, additional lock states
+** are inserted in between. The locking might fail on one of the later
+** transitions leaving the lock state different from what it started but
+** still short of its goal. The following chart shows the allowed
+** transitions and the inserted intermediate states:
+**
+** UNLOCKED -> SHARED
+** SHARED -> RESERVED
+** SHARED -> (PENDING) -> EXCLUSIVE
+** RESERVED -> (PENDING) -> EXCLUSIVE
+** PENDING -> EXCLUSIVE
+**
+** This routine will only increase a lock. Use the sqlite3OsUnlock()
+** routine to lower a locking level.
+**
+** With dotfile locking, we really only support state (4): EXCLUSIVE.
+** But we track the other locking levels internally.
+*/
+static int dotlockLock(sqlite3_file *id, int eFileLock) {
+ unixFile *pFile = (unixFile*)id;
+ char *zLockFile = (char *)pFile->lockingContext;
+ int rc = SQLITE_OK;
+
+
+ /* If we have any lock, then the lock file already exists. All we have
+ ** to do is adjust our internal record of the lock level.
+ */
+ if( pFile->eFileLock > NO_LOCK ){
+ pFile->eFileLock = eFileLock;
+ /* Always update the timestamp on the old file */
+#ifdef HAVE_UTIME
+ utime(zLockFile, NULL);
+#else
+ utimes(zLockFile, NULL);
+#endif
+ return SQLITE_OK;
+ }
+
+ /* grab an exclusive lock */
+ rc = osMkdir(zLockFile, 0777);
+ if( rc<0 ){
+ /* failed to open/create the lock directory */
+ int tErrno = errno;
+ if( EEXIST == tErrno ){
+ rc = SQLITE_BUSY;
+ } else {
+ rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK);
+ if( rc!=SQLITE_BUSY ){
+ storeLastErrno(pFile, tErrno);
+ }
+ }
+ return rc;
+ }
+
+ /* got it, set the type and return ok */
+ pFile->eFileLock = eFileLock;
+ return rc;
+}
+
+/*
+** Lower the locking level on file descriptor pFile to eFileLock. eFileLock
+** must be either NO_LOCK or SHARED_LOCK.
+**
+** If the locking level of the file descriptor is already at or below
+** the requested locking level, this routine is a no-op.
+**
+** When the locking level reaches NO_LOCK, delete the lock file.
+*/
+static int dotlockUnlock(sqlite3_file *id, int eFileLock) {
+ unixFile *pFile = (unixFile*)id;
+ char *zLockFile = (char *)pFile->lockingContext;
+ int rc;
+
+ assert( pFile );
+ OSTRACE(("UNLOCK %d %d was %d pid=%d (dotlock)\n", pFile->h, eFileLock,
+ pFile->eFileLock, osGetpid(0)));
+ assert( eFileLock<=SHARED_LOCK );
+
+ /* no-op if possible */
+ if( pFile->eFileLock==eFileLock ){
+ return SQLITE_OK;
+ }
+
+ /* To downgrade to shared, simply update our internal notion of the
+ ** lock state. No need to mess with the file on disk.
+ */
+ if( eFileLock==SHARED_LOCK ){
+ pFile->eFileLock = SHARED_LOCK;
+ return SQLITE_OK;
+ }
+
+ /* To fully unlock the database, delete the lock file */
+ assert( eFileLock==NO_LOCK );
+ rc = osRmdir(zLockFile);
+ if( rc<0 ){
+ int tErrno = errno;
+ if( tErrno==ENOENT ){
+ rc = SQLITE_OK;
+ }else{
+ rc = SQLITE_IOERR_UNLOCK;
+ storeLastErrno(pFile, tErrno);
+ }
+ return rc;
+ }
+ pFile->eFileLock = NO_LOCK;
+ return SQLITE_OK;
+}
+
+/*
+** Close a file. Make sure the lock has been released before closing.
+*/
+static int dotlockClose(sqlite3_file *id) {
+ unixFile *pFile = (unixFile*)id;
+ assert( id!=0 );
+ dotlockUnlock(id, NO_LOCK);
+ sqlite3_free(pFile->lockingContext);
+ return closeUnixFile(id);
+}
+/****************** End of the dot-file lock implementation *******************
+******************************************************************************/
+
+/******************************************************************************
+************************** Begin flock Locking ********************************
+**
+** Use the flock() system call to do file locking.
+**
+** flock() locking is like dot-file locking in that the various
+** fine-grain locking levels supported by SQLite are collapsed into
+** a single exclusive lock. In other words, SHARED, RESERVED, and
+** PENDING locks are the same thing as an EXCLUSIVE lock. SQLite
+** still works when you do this, but concurrency is reduced since
+** only a single process can be reading the database at a time.
+**
+** Omit this section if SQLITE_ENABLE_LOCKING_STYLE is turned off
+*/
+#if SQLITE_ENABLE_LOCKING_STYLE
+
+/*
+** Retry flock() calls that fail with EINTR
+*/
+#ifdef EINTR
+static int robust_flock(int fd, int op){
+ int rc;
+ do{ rc = flock(fd,op); }while( rc<0 && errno==EINTR );
+ return rc;
+}
+#else
+# define robust_flock(a,b) flock(a,b)
+#endif
+
+
+/*
+** This routine checks if there is a RESERVED lock held on the specified
+** file by this or any other process. If such a lock is held, set *pResOut
+** to a non-zero value otherwise *pResOut is set to zero. The return value
+** is set to SQLITE_OK unless an I/O error occurs during lock checking.
+*/
+static int flockCheckReservedLock(sqlite3_file *id, int *pResOut){
+#ifdef SQLITE_DEBUG
+ unixFile *pFile = (unixFile*)id;
+#else
+ UNUSED_PARAMETER(id);
+#endif
+
+ SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; );
+
+ assert( pFile );
+ assert( pFile->eFileLock<=SHARED_LOCK );
+
+ /* The flock VFS only ever takes exclusive locks (see function flockLock).
+ ** Therefore, if this connection is holding any lock at all, no other
+ ** connection may be holding a RESERVED lock. So set *pResOut to 0
+ ** in this case.
+ **
+ ** Or, this connection may be holding no lock. In that case, set *pResOut to
+ ** 0 as well. The caller will then attempt to take an EXCLUSIVE lock on the
+ ** db in order to roll the hot journal back. If there is another connection
+ ** holding a lock, that attempt will fail and an SQLITE_BUSY returned to
+ ** the user. With other VFS, we try to avoid this, in order to allow a reader
+ ** to proceed while a writer is preparing its transaction. But that won't
+ ** work with the flock VFS - as it always takes EXCLUSIVE locks - so it is
+ ** not a problem in this case. */
+ *pResOut = 0;
+
+ return SQLITE_OK;
+}
+
+/*
+** Lock the file with the lock specified by parameter eFileLock - one
+** of the following:
+**
+** (1) SHARED_LOCK
+** (2) RESERVED_LOCK
+** (3) PENDING_LOCK
+** (4) EXCLUSIVE_LOCK
+**
+** Sometimes when requesting one lock state, additional lock states
+** are inserted in between. The locking might fail on one of the later
+** transitions leaving the lock state different from what it started but
+** still short of its goal. The following chart shows the allowed
+** transitions and the inserted intermediate states:
+**
+** UNLOCKED -> SHARED
+** SHARED -> RESERVED
+** SHARED -> (PENDING) -> EXCLUSIVE
+** RESERVED -> (PENDING) -> EXCLUSIVE
+** PENDING -> EXCLUSIVE
+**
+** flock() only really support EXCLUSIVE locks. We track intermediate
+** lock states in the sqlite3_file structure, but all locks SHARED or
+** above are really EXCLUSIVE locks and exclude all other processes from
+** access the file.
+**
+** This routine will only increase a lock. Use the sqlite3OsUnlock()
+** routine to lower a locking level.
+*/
+static int flockLock(sqlite3_file *id, int eFileLock) {
+ int rc = SQLITE_OK;
+ unixFile *pFile = (unixFile*)id;
+
+ assert( pFile );
+
+ /* if we already have a lock, it is exclusive.
+ ** Just adjust level and punt on outta here. */
+ if (pFile->eFileLock > NO_LOCK) {
+ pFile->eFileLock = eFileLock;
+ return SQLITE_OK;
+ }
+
+ /* grab an exclusive lock */
+
+ if (robust_flock(pFile->h, LOCK_EX | LOCK_NB)) {
+ int tErrno = errno;
+ /* didn't get, must be busy */
+ rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK);
+ if( IS_LOCK_ERROR(rc) ){
+ storeLastErrno(pFile, tErrno);
+ }
+ } else {
+ /* got it, set the type and return ok */
+ pFile->eFileLock = eFileLock;
+ }
+ OSTRACE(("LOCK %d %s %s (flock)\n", pFile->h, azFileLock(eFileLock),
+ rc==SQLITE_OK ? "ok" : "failed"));
+#ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS
+ if( (rc & 0xff) == SQLITE_IOERR ){
+ rc = SQLITE_BUSY;
+ }
+#endif /* SQLITE_IGNORE_FLOCK_LOCK_ERRORS */
+ return rc;
+}
+
+
+/*
+** Lower the locking level on file descriptor pFile to eFileLock. eFileLock
+** must be either NO_LOCK or SHARED_LOCK.
+**
+** If the locking level of the file descriptor is already at or below
+** the requested locking level, this routine is a no-op.
+*/
+static int flockUnlock(sqlite3_file *id, int eFileLock) {
+ unixFile *pFile = (unixFile*)id;
+
+ assert( pFile );
+ OSTRACE(("UNLOCK %d %d was %d pid=%d (flock)\n", pFile->h, eFileLock,
+ pFile->eFileLock, osGetpid(0)));
+ assert( eFileLock<=SHARED_LOCK );
+
+ /* no-op if possible */
+ if( pFile->eFileLock==eFileLock ){
+ return SQLITE_OK;
+ }
+
+ /* shared can just be set because we always have an exclusive */
+ if (eFileLock==SHARED_LOCK) {
+ pFile->eFileLock = eFileLock;
+ return SQLITE_OK;
+ }
+
+ /* no, really, unlock. */
+ if( robust_flock(pFile->h, LOCK_UN) ){
+#ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS
+ return SQLITE_OK;
+#endif /* SQLITE_IGNORE_FLOCK_LOCK_ERRORS */
+ return SQLITE_IOERR_UNLOCK;
+ }else{
+ pFile->eFileLock = NO_LOCK;
+ return SQLITE_OK;
+ }
+}
+
+/*
+** Close a file.
+*/
+static int flockClose(sqlite3_file *id) {
+ assert( id!=0 );
+ flockUnlock(id, NO_LOCK);
+ return closeUnixFile(id);
+}
+
+#endif /* SQLITE_ENABLE_LOCKING_STYLE && !OS_VXWORK */
+
+/******************* End of the flock lock implementation *********************
+******************************************************************************/
+
+/******************************************************************************
+************************ Begin Named Semaphore Locking ************************
+**
+** Named semaphore locking is only supported on VxWorks.
+**
+** Semaphore locking is like dot-lock and flock in that it really only
+** supports EXCLUSIVE locking. Only a single process can read or write
+** the database file at a time. This reduces potential concurrency, but
+** makes the lock implementation much easier.
+*/
+#if OS_VXWORKS
+
+/*
+** This routine checks if there is a RESERVED lock held on the specified
+** file by this or any other process. If such a lock is held, set *pResOut
+** to a non-zero value otherwise *pResOut is set to zero. The return value
+** is set to SQLITE_OK unless an I/O error occurs during lock checking.
+*/
+static int semXCheckReservedLock(sqlite3_file *id, int *pResOut) {
+ int rc = SQLITE_OK;
+ int reserved = 0;
+ unixFile *pFile = (unixFile*)id;
+
+ SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; );
+
+ assert( pFile );
+
+ /* Check if a thread in this process holds such a lock */
+ if( pFile->eFileLock>SHARED_LOCK ){
+ reserved = 1;
+ }
+
+ /* Otherwise see if some other process holds it. */
+ if( !reserved ){
+ sem_t *pSem = pFile->pInode->pSem;
+
+ if( sem_trywait(pSem)==-1 ){
+ int tErrno = errno;
+ if( EAGAIN != tErrno ){
+ rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_CHECKRESERVEDLOCK);
+ storeLastErrno(pFile, tErrno);
+ } else {
+ /* someone else has the lock when we are in NO_LOCK */
+ reserved = (pFile->eFileLock < SHARED_LOCK);
+ }
+ }else{
+ /* we could have it if we want it */
+ sem_post(pSem);
+ }
+ }
+ OSTRACE(("TEST WR-LOCK %d %d %d (sem)\n", pFile->h, rc, reserved));
+
+ *pResOut = reserved;
+ return rc;
+}
+
+/*
+** Lock the file with the lock specified by parameter eFileLock - one
+** of the following:
+**
+** (1) SHARED_LOCK
+** (2) RESERVED_LOCK
+** (3) PENDING_LOCK
+** (4) EXCLUSIVE_LOCK
+**
+** Sometimes when requesting one lock state, additional lock states
+** are inserted in between. The locking might fail on one of the later
+** transitions leaving the lock state different from what it started but
+** still short of its goal. The following chart shows the allowed
+** transitions and the inserted intermediate states:
+**
+** UNLOCKED -> SHARED
+** SHARED -> RESERVED
+** SHARED -> (PENDING) -> EXCLUSIVE
+** RESERVED -> (PENDING) -> EXCLUSIVE
+** PENDING -> EXCLUSIVE
+**
+** Semaphore locks only really support EXCLUSIVE locks. We track intermediate
+** lock states in the sqlite3_file structure, but all locks SHARED or
+** above are really EXCLUSIVE locks and exclude all other processes from
+** access the file.
+**
+** This routine will only increase a lock. Use the sqlite3OsUnlock()
+** routine to lower a locking level.
+*/
+static int semXLock(sqlite3_file *id, int eFileLock) {
+ unixFile *pFile = (unixFile*)id;
+ sem_t *pSem = pFile->pInode->pSem;
+ int rc = SQLITE_OK;
+
+ /* if we already have a lock, it is exclusive.
+ ** Just adjust level and punt on outta here. */
+ if (pFile->eFileLock > NO_LOCK) {
+ pFile->eFileLock = eFileLock;
+ rc = SQLITE_OK;
+ goto sem_end_lock;
+ }
+
+ /* lock semaphore now but bail out when already locked. */
+ if( sem_trywait(pSem)==-1 ){
+ rc = SQLITE_BUSY;
+ goto sem_end_lock;
+ }
+
+ /* got it, set the type and return ok */
+ pFile->eFileLock = eFileLock;
+
+ sem_end_lock:
+ return rc;
+}
+
+/*
+** Lower the locking level on file descriptor pFile to eFileLock. eFileLock
+** must be either NO_LOCK or SHARED_LOCK.
+**
+** If the locking level of the file descriptor is already at or below
+** the requested locking level, this routine is a no-op.
+*/
+static int semXUnlock(sqlite3_file *id, int eFileLock) {
+ unixFile *pFile = (unixFile*)id;
+ sem_t *pSem = pFile->pInode->pSem;
+
+ assert( pFile );
+ assert( pSem );
+ OSTRACE(("UNLOCK %d %d was %d pid=%d (sem)\n", pFile->h, eFileLock,
+ pFile->eFileLock, osGetpid(0)));
+ assert( eFileLock<=SHARED_LOCK );
+
+ /* no-op if possible */
+ if( pFile->eFileLock==eFileLock ){
+ return SQLITE_OK;
+ }
+
+ /* shared can just be set because we always have an exclusive */
+ if (eFileLock==SHARED_LOCK) {
+ pFile->eFileLock = eFileLock;
+ return SQLITE_OK;
+ }
+
+ /* no, really unlock. */
+ if ( sem_post(pSem)==-1 ) {
+ int rc, tErrno = errno;
+ rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_UNLOCK);
+ if( IS_LOCK_ERROR(rc) ){
+ storeLastErrno(pFile, tErrno);
+ }
+ return rc;
+ }
+ pFile->eFileLock = NO_LOCK;
+ return SQLITE_OK;
+}
+
+/*
+ ** Close a file.
+ */
+static int semXClose(sqlite3_file *id) {
+ if( id ){
+ unixFile *pFile = (unixFile*)id;
+ semXUnlock(id, NO_LOCK);
+ assert( pFile );
+ assert( unixFileMutexNotheld(pFile) );
+ unixEnterMutex();
+ releaseInodeInfo(pFile);
+ unixLeaveMutex();
+ closeUnixFile(id);
+ }
+ return SQLITE_OK;
+}
+
+#endif /* OS_VXWORKS */
+/*
+** Named semaphore locking is only available on VxWorks.
+**
+*************** End of the named semaphore lock implementation ****************
+******************************************************************************/
+
+
+/******************************************************************************
+*************************** Begin AFP Locking *********************************
+**
+** AFP is the Apple Filing Protocol. AFP is a network filesystem found
+** on Apple Macintosh computers - both OS9 and OSX.
+**
+** Third-party implementations of AFP are available. But this code here
+** only works on OSX.
+*/
+
+#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE
+/*
+** The afpLockingContext structure contains all afp lock specific state
+*/
+typedef struct afpLockingContext afpLockingContext;
+struct afpLockingContext {
+ int reserved;
+ const char *dbPath; /* Name of the open file */
+};
+
+struct ByteRangeLockPB2
+{
+ unsigned long long offset; /* offset to first byte to lock */
+ unsigned long long length; /* nbr of bytes to lock */
+ unsigned long long retRangeStart; /* nbr of 1st byte locked if successful */
+ unsigned char unLockFlag; /* 1 = unlock, 0 = lock */
+ unsigned char startEndFlag; /* 1=rel to end of fork, 0=rel to start */
+ int fd; /* file desc to assoc this lock with */
+};
+
+#define afpfsByteRangeLock2FSCTL _IOWR('z', 23, struct ByteRangeLockPB2)
+
+/*
+** This is a utility for setting or clearing a bit-range lock on an
+** AFP filesystem.
+**
+** Return SQLITE_OK on success, SQLITE_BUSY on failure.
+*/
+static int afpSetLock(
+ const char *path, /* Name of the file to be locked or unlocked */
+ unixFile *pFile, /* Open file descriptor on path */
+ unsigned long long offset, /* First byte to be locked */
+ unsigned long long length, /* Number of bytes to lock */
+ int setLockFlag /* True to set lock. False to clear lock */
+){
+ struct ByteRangeLockPB2 pb;
+ int err;
+
+ pb.unLockFlag = setLockFlag ? 0 : 1;
+ pb.startEndFlag = 0;
+ pb.offset = offset;
+ pb.length = length;
+ pb.fd = pFile->h;
+
+ OSTRACE(("AFPSETLOCK [%s] for %d%s in range %llx:%llx\n",
+ (setLockFlag?"ON":"OFF"), pFile->h, (pb.fd==-1?"[testval-1]":""),
+ offset, length));
+ err = fsctl(path, afpfsByteRangeLock2FSCTL, &pb, 0);
+ if ( err==-1 ) {
+ int rc;
+ int tErrno = errno;
+ OSTRACE(("AFPSETLOCK failed to fsctl() '%s' %d %s\n",
+ path, tErrno, strerror(tErrno)));
+#ifdef SQLITE_IGNORE_AFP_LOCK_ERRORS
+ rc = SQLITE_BUSY;
+#else
+ rc = sqliteErrorFromPosixError(tErrno,
+ setLockFlag ? SQLITE_IOERR_LOCK : SQLITE_IOERR_UNLOCK);
+#endif /* SQLITE_IGNORE_AFP_LOCK_ERRORS */
+ if( IS_LOCK_ERROR(rc) ){
+ storeLastErrno(pFile, tErrno);
+ }
+ return rc;
+ } else {
+ return SQLITE_OK;
+ }
+}
+
+/*
+** This routine checks if there is a RESERVED lock held on the specified
+** file by this or any other process. If such a lock is held, set *pResOut
+** to a non-zero value otherwise *pResOut is set to zero. The return value
+** is set to SQLITE_OK unless an I/O error occurs during lock checking.
+*/
+static int afpCheckReservedLock(sqlite3_file *id, int *pResOut){
+ int rc = SQLITE_OK;
+ int reserved = 0;
+ unixFile *pFile = (unixFile*)id;
+ afpLockingContext *context;
+
+ SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; );
+
+ assert( pFile );
+ context = (afpLockingContext *) pFile->lockingContext;
+ if( context->reserved ){
+ *pResOut = 1;
+ return SQLITE_OK;
+ }
+ sqlite3_mutex_enter(pFile->pInode->pLockMutex);
+ /* Check if a thread in this process holds such a lock */
+ if( pFile->pInode->eFileLock>SHARED_LOCK ){
+ reserved = 1;
+ }
+
+ /* Otherwise see if some other process holds it.
+ */
+ if( !reserved ){
+ /* lock the RESERVED byte */
+ int lrc = afpSetLock(context->dbPath, pFile, RESERVED_BYTE, 1,1);
+ if( SQLITE_OK==lrc ){
+ /* if we succeeded in taking the reserved lock, unlock it to restore
+ ** the original state */
+ lrc = afpSetLock(context->dbPath, pFile, RESERVED_BYTE, 1, 0);
+ } else {
+ /* if we failed to get the lock then someone else must have it */
+ reserved = 1;
+ }
+ if( IS_LOCK_ERROR(lrc) ){
+ rc=lrc;
+ }
+ }
+
+ sqlite3_mutex_leave(pFile->pInode->pLockMutex);
+ OSTRACE(("TEST WR-LOCK %d %d %d (afp)\n", pFile->h, rc, reserved));
+
+ *pResOut = reserved;
+ return rc;
+}
+
+/*
+** Lock the file with the lock specified by parameter eFileLock - one
+** of the following:
+**
+** (1) SHARED_LOCK
+** (2) RESERVED_LOCK
+** (3) PENDING_LOCK
+** (4) EXCLUSIVE_LOCK
+**
+** Sometimes when requesting one lock state, additional lock states
+** are inserted in between. The locking might fail on one of the later
+** transitions leaving the lock state different from what it started but
+** still short of its goal. The following chart shows the allowed
+** transitions and the inserted intermediate states:
+**
+** UNLOCKED -> SHARED
+** SHARED -> RESERVED
+** SHARED -> (PENDING) -> EXCLUSIVE
+** RESERVED -> (PENDING) -> EXCLUSIVE
+** PENDING -> EXCLUSIVE
+**
+** This routine will only increase a lock. Use the sqlite3OsUnlock()
+** routine to lower a locking level.
+*/
+static int afpLock(sqlite3_file *id, int eFileLock){
+ int rc = SQLITE_OK;
+ unixFile *pFile = (unixFile*)id;
+ unixInodeInfo *pInode = pFile->pInode;
+ afpLockingContext *context = (afpLockingContext *) pFile->lockingContext;
+
+ assert( pFile );
+ OSTRACE(("LOCK %d %s was %s(%s,%d) pid=%d (afp)\n", pFile->h,
+ azFileLock(eFileLock), azFileLock(pFile->eFileLock),
+ azFileLock(pInode->eFileLock), pInode->nShared , osGetpid(0)));
+
+ /* If there is already a lock of this type or more restrictive on the
+ ** unixFile, do nothing. Don't use the afp_end_lock: exit path, as
+ ** unixEnterMutex() hasn't been called yet.
+ */
+ if( pFile->eFileLock>=eFileLock ){
+ OSTRACE(("LOCK %d %s ok (already held) (afp)\n", pFile->h,
+ azFileLock(eFileLock)));
+ return SQLITE_OK;
+ }
+
+ /* Make sure the locking sequence is correct
+ ** (1) We never move from unlocked to anything higher than shared lock.
+ ** (2) SQLite never explicitly requests a pending lock.
+ ** (3) A shared lock is always held when a reserve lock is requested.
+ */
+ assert( pFile->eFileLock!=NO_LOCK || eFileLock==SHARED_LOCK );
+ assert( eFileLock!=PENDING_LOCK );
+ assert( eFileLock!=RESERVED_LOCK || pFile->eFileLock==SHARED_LOCK );
+
+ /* This mutex is needed because pFile->pInode is shared across threads
+ */
+ pInode = pFile->pInode;
+ sqlite3_mutex_enter(pInode->pLockMutex);
+
+ /* If some thread using this PID has a lock via a different unixFile*
+ ** handle that precludes the requested lock, return BUSY.
+ */
+ if( (pFile->eFileLock!=pInode->eFileLock &&
+ (pInode->eFileLock>=PENDING_LOCK || eFileLock>SHARED_LOCK))
+ ){
+ rc = SQLITE_BUSY;
+ goto afp_end_lock;
+ }
+
+ /* If a SHARED lock is requested, and some thread using this PID already
+ ** has a SHARED or RESERVED lock, then increment reference counts and
+ ** return SQLITE_OK.
+ */
+ if( eFileLock==SHARED_LOCK &&
+ (pInode->eFileLock==SHARED_LOCK || pInode->eFileLock==RESERVED_LOCK) ){
+ assert( eFileLock==SHARED_LOCK );
+ assert( pFile->eFileLock==0 );
+ assert( pInode->nShared>0 );
+ pFile->eFileLock = SHARED_LOCK;
+ pInode->nShared++;
+ pInode->nLock++;
+ goto afp_end_lock;
+ }
+
+ /* A PENDING lock is needed before acquiring a SHARED lock and before
+ ** acquiring an EXCLUSIVE lock. For the SHARED lock, the PENDING will
+ ** be released.
+ */
+ if( eFileLock==SHARED_LOCK
+ || (eFileLock==EXCLUSIVE_LOCK && pFile->eFileLock<PENDING_LOCK)
+ ){
+ int failed;
+ failed = afpSetLock(context->dbPath, pFile, PENDING_BYTE, 1, 1);
+ if (failed) {
+ rc = failed;
+ goto afp_end_lock;
+ }
+ }
+
+ /* If control gets to this point, then actually go ahead and make
+ ** operating system calls for the specified lock.
+ */
+ if( eFileLock==SHARED_LOCK ){
+ int lrc1, lrc2, lrc1Errno = 0;
+ long lk, mask;
+
+ assert( pInode->nShared==0 );
+ assert( pInode->eFileLock==0 );
+
+ mask = (sizeof(long)==8) ? LARGEST_INT64 : 0x7fffffff;
+ /* Now get the read-lock SHARED_LOCK */
+ /* note that the quality of the randomness doesn't matter that much */
+ lk = random();
+ pInode->sharedByte = (lk & mask)%(SHARED_SIZE - 1);
+ lrc1 = afpSetLock(context->dbPath, pFile,
+ SHARED_FIRST+pInode->sharedByte, 1, 1);
+ if( IS_LOCK_ERROR(lrc1) ){
+ lrc1Errno = pFile->lastErrno;
+ }
+ /* Drop the temporary PENDING lock */
+ lrc2 = afpSetLock(context->dbPath, pFile, PENDING_BYTE, 1, 0);
+
+ if( IS_LOCK_ERROR(lrc1) ) {
+ storeLastErrno(pFile, lrc1Errno);
+ rc = lrc1;
+ goto afp_end_lock;
+ } else if( IS_LOCK_ERROR(lrc2) ){
+ rc = lrc2;
+ goto afp_end_lock;
+ } else if( lrc1 != SQLITE_OK ) {
+ rc = lrc1;
+ } else {
+ pFile->eFileLock = SHARED_LOCK;
+ pInode->nLock++;
+ pInode->nShared = 1;
+ }
+ }else if( eFileLock==EXCLUSIVE_LOCK && pInode->nShared>1 ){
+ /* We are trying for an exclusive lock but another thread in this
+ ** same process is still holding a shared lock. */
+ rc = SQLITE_BUSY;
+ }else{
+ /* The request was for a RESERVED or EXCLUSIVE lock. It is
+ ** assumed that there is a SHARED or greater lock on the file
+ ** already.
+ */
+ int failed = 0;
+ assert( 0!=pFile->eFileLock );
+ if (eFileLock >= RESERVED_LOCK && pFile->eFileLock < RESERVED_LOCK) {
+ /* Acquire a RESERVED lock */
+ failed = afpSetLock(context->dbPath, pFile, RESERVED_BYTE, 1,1);
+ if( !failed ){
+ context->reserved = 1;
+ }
+ }
+ if (!failed && eFileLock == EXCLUSIVE_LOCK) {
+ /* Acquire an EXCLUSIVE lock */
+
+ /* Remove the shared lock before trying the range. we'll need to
+ ** reestablish the shared lock if we can't get the afpUnlock
+ */
+ if( !(failed = afpSetLock(context->dbPath, pFile, SHARED_FIRST +
+ pInode->sharedByte, 1, 0)) ){
+ int failed2 = SQLITE_OK;
+ /* now attempt to get the exclusive lock range */
+ failed = afpSetLock(context->dbPath, pFile, SHARED_FIRST,
+ SHARED_SIZE, 1);
+ if( failed && (failed2 = afpSetLock(context->dbPath, pFile,
+ SHARED_FIRST + pInode->sharedByte, 1, 1)) ){
+ /* Can't reestablish the shared lock. Sqlite can't deal, this is
+ ** a critical I/O error
+ */
+ rc = ((failed & 0xff) == SQLITE_IOERR) ? failed2 :
+ SQLITE_IOERR_LOCK;
+ goto afp_end_lock;
+ }
+ }else{
+ rc = failed;
+ }
+ }
+ if( failed ){
+ rc = failed;
+ }
+ }
+
+ if( rc==SQLITE_OK ){
+ pFile->eFileLock = eFileLock;
+ pInode->eFileLock = eFileLock;
+ }else if( eFileLock==EXCLUSIVE_LOCK ){
+ pFile->eFileLock = PENDING_LOCK;
+ pInode->eFileLock = PENDING_LOCK;
+ }
+
+afp_end_lock:
+ sqlite3_mutex_leave(pInode->pLockMutex);
+ OSTRACE(("LOCK %d %s %s (afp)\n", pFile->h, azFileLock(eFileLock),
+ rc==SQLITE_OK ? "ok" : "failed"));
+ return rc;
+}
+
+/*
+** Lower the locking level on file descriptor pFile to eFileLock. eFileLock
+** must be either NO_LOCK or SHARED_LOCK.
+**
+** If the locking level of the file descriptor is already at or below
+** the requested locking level, this routine is a no-op.
+*/
+static int afpUnlock(sqlite3_file *id, int eFileLock) {
+ int rc = SQLITE_OK;
+ unixFile *pFile = (unixFile*)id;
+ unixInodeInfo *pInode;
+ afpLockingContext *context = (afpLockingContext *) pFile->lockingContext;
+ int skipShared = 0;
+
+ assert( pFile );
+ OSTRACE(("UNLOCK %d %d was %d(%d,%d) pid=%d (afp)\n", pFile->h, eFileLock,
+ pFile->eFileLock, pFile->pInode->eFileLock, pFile->pInode->nShared,
+ osGetpid(0)));
+
+ assert( eFileLock<=SHARED_LOCK );
+ if( pFile->eFileLock<=eFileLock ){
+ return SQLITE_OK;
+ }
+ pInode = pFile->pInode;
+ sqlite3_mutex_enter(pInode->pLockMutex);
+ assert( pInode->nShared!=0 );
+ if( pFile->eFileLock>SHARED_LOCK ){
+ assert( pInode->eFileLock==pFile->eFileLock );
+
+#ifdef SQLITE_DEBUG
+ /* When reducing a lock such that other processes can start
+ ** reading the database file again, make sure that the
+ ** transaction counter was updated if any part of the database
+ ** file changed. If the transaction counter is not updated,
+ ** other connections to the same file might not realize that
+ ** the file has changed and hence might not know to flush their
+ ** cache. The use of a stale cache can lead to database corruption.
+ */
+ assert( pFile->inNormalWrite==0
+ || pFile->dbUpdate==0
+ || pFile->transCntrChng==1 );
+ pFile->inNormalWrite = 0;
+#endif
+
+ if( pFile->eFileLock==EXCLUSIVE_LOCK ){
+ rc = afpSetLock(context->dbPath, pFile, SHARED_FIRST, SHARED_SIZE, 0);
+ if( rc==SQLITE_OK && (eFileLock==SHARED_LOCK || pInode->nShared>1) ){
+ /* only re-establish the shared lock if necessary */
+ int sharedLockByte = SHARED_FIRST+pInode->sharedByte;
+ rc = afpSetLock(context->dbPath, pFile, sharedLockByte, 1, 1);
+ } else {
+ skipShared = 1;
+ }
+ }
+ if( rc==SQLITE_OK && pFile->eFileLock>=PENDING_LOCK ){
+ rc = afpSetLock(context->dbPath, pFile, PENDING_BYTE, 1, 0);
+ }
+ if( rc==SQLITE_OK && pFile->eFileLock>=RESERVED_LOCK && context->reserved ){
+ rc = afpSetLock(context->dbPath, pFile, RESERVED_BYTE, 1, 0);
+ if( !rc ){
+ context->reserved = 0;
+ }
+ }
+ if( rc==SQLITE_OK && (eFileLock==SHARED_LOCK || pInode->nShared>1)){
+ pInode->eFileLock = SHARED_LOCK;
+ }
+ }
+ if( rc==SQLITE_OK && eFileLock==NO_LOCK ){
+
+ /* Decrement the shared lock counter. Release the lock using an
+ ** OS call only when all threads in this same process have released
+ ** the lock.
+ */
+ unsigned long long sharedLockByte = SHARED_FIRST+pInode->sharedByte;
+ pInode->nShared--;
+ if( pInode->nShared==0 ){
+ if( !skipShared ){
+ rc = afpSetLock(context->dbPath, pFile, sharedLockByte, 1, 0);
+ }
+ if( !rc ){
+ pInode->eFileLock = NO_LOCK;
+ pFile->eFileLock = NO_LOCK;
+ }
+ }
+ if( rc==SQLITE_OK ){
+ pInode->nLock--;
+ assert( pInode->nLock>=0 );
+ if( pInode->nLock==0 ) closePendingFds(pFile);
+ }
+ }
+
+ sqlite3_mutex_leave(pInode->pLockMutex);
+ if( rc==SQLITE_OK ){
+ pFile->eFileLock = eFileLock;
+ }
+ return rc;
+}
+
+/*
+** Close a file & cleanup AFP specific locking context
+*/
+static int afpClose(sqlite3_file *id) {
+ int rc = SQLITE_OK;
+ unixFile *pFile = (unixFile*)id;
+ assert( id!=0 );
+ afpUnlock(id, NO_LOCK);
+ assert( unixFileMutexNotheld(pFile) );
+ unixEnterMutex();
+ if( pFile->pInode ){
+ unixInodeInfo *pInode = pFile->pInode;
+ sqlite3_mutex_enter(pInode->pLockMutex);
+ if( pInode->nLock ){
+ /* If there are outstanding locks, do not actually close the file just
+ ** yet because that would clear those locks. Instead, add the file
+ ** descriptor to pInode->aPending. It will be automatically closed when
+ ** the last lock is cleared.
+ */
+ setPendingFd(pFile);
+ }
+ sqlite3_mutex_leave(pInode->pLockMutex);
+ }
+ releaseInodeInfo(pFile);
+ sqlite3_free(pFile->lockingContext);
+ rc = closeUnixFile(id);
+ unixLeaveMutex();
+ return rc;
+}
+
+#endif /* defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE */
+/*
+** The code above is the AFP lock implementation. The code is specific
+** to MacOSX and does not work on other unix platforms. No alternative
+** is available. If you don't compile for a mac, then the "unix-afp"
+** VFS is not available.
+**
+********************* End of the AFP lock implementation **********************
+******************************************************************************/
+
+/******************************************************************************
+*************************** Begin NFS Locking ********************************/
+
+#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE
+/*
+ ** Lower the locking level on file descriptor pFile to eFileLock. eFileLock
+ ** must be either NO_LOCK or SHARED_LOCK.
+ **
+ ** If the locking level of the file descriptor is already at or below
+ ** the requested locking level, this routine is a no-op.
+ */
+static int nfsUnlock(sqlite3_file *id, int eFileLock){
+ return posixUnlock(id, eFileLock, 1);
+}
+
+#endif /* defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE */
+/*
+** The code above is the NFS lock implementation. The code is specific
+** to MacOSX and does not work on other unix platforms. No alternative
+** is available.
+**
+********************* End of the NFS lock implementation **********************
+******************************************************************************/
+
+/******************************************************************************
+**************** Non-locking sqlite3_file methods *****************************
+**
+** The next division contains implementations for all methods of the
+** sqlite3_file object other than the locking methods. The locking
+** methods were defined in divisions above (one locking method per
+** division). Those methods that are common to all locking modes
+** are gather together into this division.
+*/
+
+/*
+** Seek to the offset passed as the second argument, then read cnt
+** bytes into pBuf. Return the number of bytes actually read.
+**
+** To avoid stomping the errno value on a failed read the lastErrno value
+** is set before returning.
+*/
+static int seekAndRead(unixFile *id, sqlite3_int64 offset, void *pBuf, int cnt){
+ int got;
+ int prior = 0;
+#if (!defined(USE_PREAD) && !defined(USE_PREAD64))
+ i64 newOffset;
+#endif
+ TIMER_START;
+ assert( cnt==(cnt&0x1ffff) );
+ assert( id->h>2 );
+ do{
+#if defined(USE_PREAD)
+ got = osPread(id->h, pBuf, cnt, offset);
+ SimulateIOError( got = -1 );
+#elif defined(USE_PREAD64)
+ got = osPread64(id->h, pBuf, cnt, offset);
+ SimulateIOError( got = -1 );
+#else
+ newOffset = lseek(id->h, offset, SEEK_SET);
+ SimulateIOError( newOffset = -1 );
+ if( newOffset<0 ){
+ storeLastErrno((unixFile*)id, errno);
+ return -1;
+ }
+ got = osRead(id->h, pBuf, cnt);
+#endif
+ if( got==cnt ) break;
+ if( got<0 ){
+ if( errno==EINTR ){ got = 1; continue; }
+ prior = 0;
+ storeLastErrno((unixFile*)id, errno);
+ break;
+ }else if( got>0 ){
+ cnt -= got;
+ offset += got;
+ prior += got;
+ pBuf = (void*)(got + (char*)pBuf);
+ }
+ }while( got>0 );
+ TIMER_END;
+ OSTRACE(("READ %-3d %5d %7lld %llu\n",
+ id->h, got+prior, offset-prior, TIMER_ELAPSED));
+ return got+prior;
+}
+
+/*
+** Read data from a file into a buffer. Return SQLITE_OK if all
+** bytes were read successfully and SQLITE_IOERR if anything goes
+** wrong.
+*/
+static int unixRead(
+ sqlite3_file *id,
+ void *pBuf,
+ int amt,
+ sqlite3_int64 offset
+){
+ unixFile *pFile = (unixFile *)id;
+ int got;
+ assert( id );
+ assert( offset>=0 );
+ assert( amt>0 );
+
+ /* If this is a database file (not a journal, super-journal or temp
+ ** file), the bytes in the locking range should never be read or written. */
+#if 0
+ assert( pFile->pPreallocatedUnused==0
+ || offset>=PENDING_BYTE+512
+ || offset+amt<=PENDING_BYTE
+ );
+#endif
+
+#if SQLITE_MAX_MMAP_SIZE>0
+ /* Deal with as much of this read request as possible by transferring
+ ** data from the memory mapping using memcpy(). */
+ if( offset<pFile->mmapSize ){
+ if( offset+amt <= pFile->mmapSize ){
+ memcpy(pBuf, &((u8 *)(pFile->pMapRegion))[offset], amt);
+ return SQLITE_OK;
+ }else{
+ int nCopy = pFile->mmapSize - offset;
+ memcpy(pBuf, &((u8 *)(pFile->pMapRegion))[offset], nCopy);
+ pBuf = &((u8 *)pBuf)[nCopy];
+ amt -= nCopy;
+ offset += nCopy;
+ }
+ }
+#endif
+
+ got = seekAndRead(pFile, offset, pBuf, amt);
+ if( got==amt ){
+ return SQLITE_OK;
+ }else if( got<0 ){
+ /* pFile->lastErrno has been set by seekAndRead().
+ ** Usually we return SQLITE_IOERR_READ here, though for some
+ ** kinds of errors we return SQLITE_IOERR_CORRUPTFS. The
+ ** SQLITE_IOERR_CORRUPTFS will be converted into SQLITE_CORRUPT
+ ** prior to returning to the application by the sqlite3ApiExit()
+ ** routine.
+ */
+ switch( pFile->lastErrno ){
+ case ERANGE:
+ case EIO:
+#ifdef ENXIO
+ case ENXIO:
+#endif
+#ifdef EDEVERR
+ case EDEVERR:
+#endif
+ return SQLITE_IOERR_CORRUPTFS;
+ }
+ return SQLITE_IOERR_READ;
+ }else{
+ storeLastErrno(pFile, 0); /* not a system error */
+ /* Unread parts of the buffer must be zero-filled */
+ memset(&((char*)pBuf)[got], 0, amt-got);
+ return SQLITE_IOERR_SHORT_READ;
+ }
+}
+
+/*
+** Attempt to seek the file-descriptor passed as the first argument to
+** absolute offset iOff, then attempt to write nBuf bytes of data from
+** pBuf to it. If an error occurs, return -1 and set *piErrno. Otherwise,
+** return the actual number of bytes written (which may be less than
+** nBuf).
+*/
+static int seekAndWriteFd(
+ int fd, /* File descriptor to write to */
+ i64 iOff, /* File offset to begin writing at */
+ const void *pBuf, /* Copy data from this buffer to the file */
+ int nBuf, /* Size of buffer pBuf in bytes */
+ int *piErrno /* OUT: Error number if error occurs */
+){
+ int rc = 0; /* Value returned by system call */
+
+ assert( nBuf==(nBuf&0x1ffff) );
+ assert( fd>2 );
+ assert( piErrno!=0 );
+ nBuf &= 0x1ffff;
+ TIMER_START;
+
+#if defined(USE_PREAD)
+ do{ rc = (int)osPwrite(fd, pBuf, nBuf, iOff); }while( rc<0 && errno==EINTR );
+#elif defined(USE_PREAD64)
+ do{ rc = (int)osPwrite64(fd, pBuf, nBuf, iOff);}while( rc<0 && errno==EINTR);
+#else
+ do{
+ i64 iSeek = lseek(fd, iOff, SEEK_SET);
+ SimulateIOError( iSeek = -1 );
+ if( iSeek<0 ){
+ rc = -1;
+ break;
+ }
+ rc = osWrite(fd, pBuf, nBuf);
+ }while( rc<0 && errno==EINTR );
+#endif
+
+ TIMER_END;
+ OSTRACE(("WRITE %-3d %5d %7lld %llu\n", fd, rc, iOff, TIMER_ELAPSED));
+
+ if( rc<0 ) *piErrno = errno;
+ return rc;
+}
+
+
+/*
+** Seek to the offset in id->offset then read cnt bytes into pBuf.
+** Return the number of bytes actually read. Update the offset.
+**
+** To avoid stomping the errno value on a failed write the lastErrno value
+** is set before returning.
+*/
+static int seekAndWrite(unixFile *id, i64 offset, const void *pBuf, int cnt){
+ return seekAndWriteFd(id->h, offset, pBuf, cnt, &id->lastErrno);
+}
+
+
+/*
+** Write data from a buffer into a file. Return SQLITE_OK on success
+** or some other error code on failure.
+*/
+static int unixWrite(
+ sqlite3_file *id,
+ const void *pBuf,
+ int amt,
+ sqlite3_int64 offset
+){
+ unixFile *pFile = (unixFile*)id;
+ int wrote = 0;
+ assert( id );
+ assert( amt>0 );
+
+ /* If this is a database file (not a journal, super-journal or temp
+ ** file), the bytes in the locking range should never be read or written. */
+#if 0
+ assert( pFile->pPreallocatedUnused==0
+ || offset>=PENDING_BYTE+512
+ || offset+amt<=PENDING_BYTE
+ );
+#endif
+
+#ifdef SQLITE_DEBUG
+ /* If we are doing a normal write to a database file (as opposed to
+ ** doing a hot-journal rollback or a write to some file other than a
+ ** normal database file) then record the fact that the database
+ ** has changed. If the transaction counter is modified, record that
+ ** fact too.
+ */
+ if( pFile->inNormalWrite ){
+ pFile->dbUpdate = 1; /* The database has been modified */
+ if( offset<=24 && offset+amt>=27 ){
+ int rc;
+ char oldCntr[4];
+ SimulateIOErrorBenign(1);
+ rc = seekAndRead(pFile, 24, oldCntr, 4);
+ SimulateIOErrorBenign(0);
+ if( rc!=4 || memcmp(oldCntr, &((char*)pBuf)[24-offset], 4)!=0 ){
+ pFile->transCntrChng = 1; /* The transaction counter has changed */
+ }
+ }
+ }
+#endif
+
+#if defined(SQLITE_MMAP_READWRITE) && SQLITE_MAX_MMAP_SIZE>0
+ /* Deal with as much of this write request as possible by transferring
+ ** data from the memory mapping using memcpy(). */
+ if( offset<pFile->mmapSize ){
+ if( offset+amt <= pFile->mmapSize ){
+ memcpy(&((u8 *)(pFile->pMapRegion))[offset], pBuf, amt);
+ return SQLITE_OK;
+ }else{
+ int nCopy = pFile->mmapSize - offset;
+ memcpy(&((u8 *)(pFile->pMapRegion))[offset], pBuf, nCopy);
+ pBuf = &((u8 *)pBuf)[nCopy];
+ amt -= nCopy;
+ offset += nCopy;
+ }
+ }
+#endif
+
+ while( (wrote = seekAndWrite(pFile, offset, pBuf, amt))<amt && wrote>0 ){
+ amt -= wrote;
+ offset += wrote;
+ pBuf = &((char*)pBuf)[wrote];
+ }
+ SimulateIOError(( wrote=(-1), amt=1 ));
+ SimulateDiskfullError(( wrote=0, amt=1 ));
+
+ if( amt>wrote ){
+ if( wrote<0 && pFile->lastErrno!=ENOSPC ){
+ /* lastErrno set by seekAndWrite */
+ return SQLITE_IOERR_WRITE;
+ }else{
+ storeLastErrno(pFile, 0); /* not a system error */
+ return SQLITE_FULL;
+ }
+ }
+
+ return SQLITE_OK;
+}
+
+#ifdef SQLITE_TEST
+/*
+** Count the number of fullsyncs and normal syncs. This is used to test
+** that syncs and fullsyncs are occurring at the right times.
+*/
+SQLITE_API int sqlite3_sync_count = 0;
+SQLITE_API int sqlite3_fullsync_count = 0;
+#endif
+
+/*
+** We do not trust systems to provide a working fdatasync(). Some do.
+** Others do no. To be safe, we will stick with the (slightly slower)
+** fsync(). If you know that your system does support fdatasync() correctly,
+** then simply compile with -Dfdatasync=fdatasync or -DHAVE_FDATASYNC
+*/
+#if !defined(fdatasync) && !HAVE_FDATASYNC
+# define fdatasync fsync
+#endif
+
+/*
+** Define HAVE_FULLFSYNC to 0 or 1 depending on whether or not
+** the F_FULLFSYNC macro is defined. F_FULLFSYNC is currently
+** only available on Mac OS X. But that could change.
+*/
+#ifdef F_FULLFSYNC
+# define HAVE_FULLFSYNC 1
+#else
+# define HAVE_FULLFSYNC 0
+#endif
+
+
+/*
+** The fsync() system call does not work as advertised on many
+** unix systems. The following procedure is an attempt to make
+** it work better.
+**
+** The SQLITE_NO_SYNC macro disables all fsync()s. This is useful
+** for testing when we want to run through the test suite quickly.
+** You are strongly advised *not* to deploy with SQLITE_NO_SYNC
+** enabled, however, since with SQLITE_NO_SYNC enabled, an OS crash
+** or power failure will likely corrupt the database file.
+**
+** SQLite sets the dataOnly flag if the size of the file is unchanged.
+** The idea behind dataOnly is that it should only write the file content
+** to disk, not the inode. We only set dataOnly if the file size is
+** unchanged since the file size is part of the inode. However,
+** Ted Ts'o tells us that fdatasync() will also write the inode if the
+** file size has changed. The only real difference between fdatasync()
+** and fsync(), Ted tells us, is that fdatasync() will not flush the
+** inode if the mtime or owner or other inode attributes have changed.
+** We only care about the file size, not the other file attributes, so
+** as far as SQLite is concerned, an fdatasync() is always adequate.
+** So, we always use fdatasync() if it is available, regardless of
+** the value of the dataOnly flag.
+*/
+static int full_fsync(int fd, int fullSync, int dataOnly){
+ int rc;
+
+ /* The following "ifdef/elif/else/" block has the same structure as
+ ** the one below. It is replicated here solely to avoid cluttering
+ ** up the real code with the UNUSED_PARAMETER() macros.
+ */
+#ifdef SQLITE_NO_SYNC
+ UNUSED_PARAMETER(fd);
+ UNUSED_PARAMETER(fullSync);
+ UNUSED_PARAMETER(dataOnly);
+#elif HAVE_FULLFSYNC
+ UNUSED_PARAMETER(dataOnly);
+#else
+ UNUSED_PARAMETER(fullSync);
+ UNUSED_PARAMETER(dataOnly);
+#endif
+
+ /* Record the number of times that we do a normal fsync() and
+ ** FULLSYNC. This is used during testing to verify that this procedure
+ ** gets called with the correct arguments.
+ */
+#ifdef SQLITE_TEST
+ if( fullSync ) sqlite3_fullsync_count++;
+ sqlite3_sync_count++;
+#endif
+
+ /* If we compiled with the SQLITE_NO_SYNC flag, then syncing is a
+ ** no-op. But go ahead and call fstat() to validate the file
+ ** descriptor as we need a method to provoke a failure during
+ ** coverage testing.
+ */
+#ifdef SQLITE_NO_SYNC
+ {
+ struct stat buf;
+ rc = osFstat(fd, &buf);
+ }
+#elif HAVE_FULLFSYNC
+ if( fullSync ){
+ rc = osFcntl(fd, F_FULLFSYNC, 0);
+ }else{
+ rc = 1;
+ }
+ /* If the FULLFSYNC failed, fall back to attempting an fsync().
+ ** It shouldn't be possible for fullfsync to fail on the local
+ ** file system (on OSX), so failure indicates that FULLFSYNC
+ ** isn't supported for this file system. So, attempt an fsync
+ ** and (for now) ignore the overhead of a superfluous fcntl call.
+ ** It'd be better to detect fullfsync support once and avoid
+ ** the fcntl call every time sync is called.
+ */
+ if( rc ) rc = fsync(fd);
+
+#elif defined(__APPLE__)
+ /* fdatasync() on HFS+ doesn't yet flush the file size if it changed correctly
+ ** so currently we default to the macro that redefines fdatasync to fsync
+ */
+ rc = fsync(fd);
+#else
+ rc = fdatasync(fd);
+#if OS_VXWORKS
+ if( rc==-1 && errno==ENOTSUP ){
+ rc = fsync(fd);
+ }
+#endif /* OS_VXWORKS */
+#endif /* ifdef SQLITE_NO_SYNC elif HAVE_FULLFSYNC */
+
+ if( OS_VXWORKS && rc!= -1 ){
+ rc = 0;
+ }
+ return rc;
+}
+
+/*
+** Open a file descriptor to the directory containing file zFilename.
+** If successful, *pFd is set to the opened file descriptor and
+** SQLITE_OK is returned. If an error occurs, either SQLITE_NOMEM
+** or SQLITE_CANTOPEN is returned and *pFd is set to an undefined
+** value.
+**
+** The directory file descriptor is used for only one thing - to
+** fsync() a directory to make sure file creation and deletion events
+** are flushed to disk. Such fsyncs are not needed on newer
+** journaling filesystems, but are required on older filesystems.
+**
+** This routine can be overridden using the xSetSysCall interface.
+** The ability to override this routine was added in support of the
+** chromium sandbox. Opening a directory is a security risk (we are
+** told) so making it overrideable allows the chromium sandbox to
+** replace this routine with a harmless no-op. To make this routine
+** a no-op, replace it with a stub that returns SQLITE_OK but leaves
+** *pFd set to a negative number.
+**
+** If SQLITE_OK is returned, the caller is responsible for closing
+** the file descriptor *pFd using close().
+*/
+static int openDirectory(const char *zFilename, int *pFd){
+ int ii;
+ int fd = -1;
+ char zDirname[MAX_PATHNAME+1];
+
+ sqlite3_snprintf(MAX_PATHNAME, zDirname, "%s", zFilename);
+ for(ii=(int)strlen(zDirname); ii>0 && zDirname[ii]!='/'; ii--);
+ if( ii>0 ){
+ zDirname[ii] = '\0';
+ }else{
+ if( zDirname[0]!='/' ) zDirname[0] = '.';
+ zDirname[1] = 0;
+ }
+ fd = robust_open(zDirname, O_RDONLY|O_BINARY, 0);
+ if( fd>=0 ){
+ OSTRACE(("OPENDIR %-3d %s\n", fd, zDirname));
+ }
+ *pFd = fd;
+ if( fd>=0 ) return SQLITE_OK;
+ return unixLogError(SQLITE_CANTOPEN_BKPT, "openDirectory", zDirname);
+}
+
+/*
+** Make sure all writes to a particular file are committed to disk.
+**
+** If dataOnly==0 then both the file itself and its metadata (file
+** size, access time, etc) are synced. If dataOnly!=0 then only the
+** file data is synced.
+**
+** Under Unix, also make sure that the directory entry for the file
+** has been created by fsync-ing the directory that contains the file.
+** If we do not do this and we encounter a power failure, the directory
+** entry for the journal might not exist after we reboot. The next
+** SQLite to access the file will not know that the journal exists (because
+** the directory entry for the journal was never created) and the transaction
+** will not roll back - possibly leading to database corruption.
+*/
+static int unixSync(sqlite3_file *id, int flags){
+ int rc;
+ unixFile *pFile = (unixFile*)id;
+
+ int isDataOnly = (flags&SQLITE_SYNC_DATAONLY);
+ int isFullsync = (flags&0x0F)==SQLITE_SYNC_FULL;
+
+ /* Check that one of SQLITE_SYNC_NORMAL or FULL was passed */
+ assert((flags&0x0F)==SQLITE_SYNC_NORMAL
+ || (flags&0x0F)==SQLITE_SYNC_FULL
+ );
+
+ /* Unix cannot, but some systems may return SQLITE_FULL from here. This
+ ** line is to test that doing so does not cause any problems.
+ */
+ SimulateDiskfullError( return SQLITE_FULL );
+
+ assert( pFile );
+ OSTRACE(("SYNC %-3d\n", pFile->h));
+ rc = full_fsync(pFile->h, isFullsync, isDataOnly);
+ SimulateIOError( rc=1 );
+ if( rc ){
+ storeLastErrno(pFile, errno);
+ return unixLogError(SQLITE_IOERR_FSYNC, "full_fsync", pFile->zPath);
+ }
+
+ /* Also fsync the directory containing the file if the DIRSYNC flag
+ ** is set. This is a one-time occurrence. Many systems (examples: AIX)
+ ** are unable to fsync a directory, so ignore errors on the fsync.
+ */
+ if( pFile->ctrlFlags & UNIXFILE_DIRSYNC ){
+ int dirfd;
+ OSTRACE(("DIRSYNC %s (have_fullfsync=%d fullsync=%d)\n", pFile->zPath,
+ HAVE_FULLFSYNC, isFullsync));
+ rc = osOpenDirectory(pFile->zPath, &dirfd);
+ if( rc==SQLITE_OK ){
+ full_fsync(dirfd, 0, 0);
+ robust_close(pFile, dirfd, __LINE__);
+ }else{
+ assert( rc==SQLITE_CANTOPEN );
+ rc = SQLITE_OK;
+ }
+ pFile->ctrlFlags &= ~UNIXFILE_DIRSYNC;
+ }
+ return rc;
+}
+
+/*
+** Truncate an open file to a specified size
+*/
+static int unixTruncate(sqlite3_file *id, i64 nByte){
+ unixFile *pFile = (unixFile *)id;
+ int rc;
+ assert( pFile );
+ SimulateIOError( return SQLITE_IOERR_TRUNCATE );
+
+ /* If the user has configured a chunk-size for this file, truncate the
+ ** file so that it consists of an integer number of chunks (i.e. the
+ ** actual file size after the operation may be larger than the requested
+ ** size).
+ */
+ if( pFile->szChunk>0 ){
+ nByte = ((nByte + pFile->szChunk - 1)/pFile->szChunk) * pFile->szChunk;
+ }
+
+ rc = robust_ftruncate(pFile->h, nByte);
+ if( rc ){
+ storeLastErrno(pFile, errno);
+ return unixLogError(SQLITE_IOERR_TRUNCATE, "ftruncate", pFile->zPath);
+ }else{
+#ifdef SQLITE_DEBUG
+ /* If we are doing a normal write to a database file (as opposed to
+ ** doing a hot-journal rollback or a write to some file other than a
+ ** normal database file) and we truncate the file to zero length,
+ ** that effectively updates the change counter. This might happen
+ ** when restoring a database using the backup API from a zero-length
+ ** source.
+ */
+ if( pFile->inNormalWrite && nByte==0 ){
+ pFile->transCntrChng = 1;
+ }
+#endif
+
+#if SQLITE_MAX_MMAP_SIZE>0
+ /* If the file was just truncated to a size smaller than the currently
+ ** mapped region, reduce the effective mapping size as well. SQLite will
+ ** use read() and write() to access data beyond this point from now on.
+ */
+ if( nByte<pFile->mmapSize ){
+ pFile->mmapSize = nByte;
+ }
+#endif
+
+ return SQLITE_OK;
+ }
+}
+
+/*
+** Determine the current size of a file in bytes
+*/
+static int unixFileSize(sqlite3_file *id, i64 *pSize){
+ int rc;
+ struct stat buf;
+ assert( id );
+ rc = osFstat(((unixFile*)id)->h, &buf);
+ SimulateIOError( rc=1 );
+ if( rc!=0 ){
+ storeLastErrno((unixFile*)id, errno);
+ return SQLITE_IOERR_FSTAT;
+ }
+ *pSize = buf.st_size;
+
+ /* When opening a zero-size database, the findInodeInfo() procedure
+ ** writes a single byte into that file in order to work around a bug
+ ** in the OS-X msdos filesystem. In order to avoid problems with upper
+ ** layers, we need to report this file size as zero even though it is
+ ** really 1. Ticket #3260.
+ */
+ if( *pSize==1 ) *pSize = 0;
+
+
+ return SQLITE_OK;
+}
+
+#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)
+/*
+** Handler for proxy-locking file-control verbs. Defined below in the
+** proxying locking division.
+*/
+static int proxyFileControl(sqlite3_file*,int,void*);
+#endif
+
+/*
+** This function is called to handle the SQLITE_FCNTL_SIZE_HINT
+** file-control operation. Enlarge the database to nBytes in size
+** (rounded up to the next chunk-size). If the database is already
+** nBytes or larger, this routine is a no-op.
+*/
+static int fcntlSizeHint(unixFile *pFile, i64 nByte){
+ if( pFile->szChunk>0 ){
+ i64 nSize; /* Required file size */
+ struct stat buf; /* Used to hold return values of fstat() */
+
+ if( osFstat(pFile->h, &buf) ){
+ return SQLITE_IOERR_FSTAT;
+ }
+
+ nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;
+ if( nSize>(i64)buf.st_size ){
+
+#if defined(HAVE_POSIX_FALLOCATE) && HAVE_POSIX_FALLOCATE
+ /* The code below is handling the return value of osFallocate()
+ ** correctly. posix_fallocate() is defined to "returns zero on success,
+ ** or an error number on failure". See the manpage for details. */
+ int err;
+ do{
+ err = osFallocate(pFile->h, buf.st_size, nSize-buf.st_size);
+ }while( err==EINTR );
+ if( err && err!=EINVAL ) return SQLITE_IOERR_WRITE;
+#else
+ /* If the OS does not have posix_fallocate(), fake it. Write a
+ ** single byte to the last byte in each block that falls entirely
+ ** within the extended region. Then, if required, a single byte
+ ** at offset (nSize-1), to set the size of the file correctly.
+ ** This is a similar technique to that used by glibc on systems
+ ** that do not have a real fallocate() call.
+ */
+ int nBlk = buf.st_blksize; /* File-system block size */
+ int nWrite = 0; /* Number of bytes written by seekAndWrite */
+ i64 iWrite; /* Next offset to write to */
+
+ iWrite = (buf.st_size/nBlk)*nBlk + nBlk - 1;
+ assert( iWrite>=buf.st_size );
+ assert( ((iWrite+1)%nBlk)==0 );
+ for(/*no-op*/; iWrite<nSize+nBlk-1; iWrite+=nBlk ){
+ if( iWrite>=nSize ) iWrite = nSize - 1;
+ nWrite = seekAndWrite(pFile, iWrite, "", 1);
+ if( nWrite!=1 ) return SQLITE_IOERR_WRITE;
+ }
+#endif
+ }
+ }
+
+#if SQLITE_MAX_MMAP_SIZE>0
+ if( pFile->mmapSizeMax>0 && nByte>pFile->mmapSize ){
+ int rc;
+ if( pFile->szChunk<=0 ){
+ if( robust_ftruncate(pFile->h, nByte) ){
+ storeLastErrno(pFile, errno);
+ return unixLogError(SQLITE_IOERR_TRUNCATE, "ftruncate", pFile->zPath);
+ }
+ }
+
+ rc = unixMapfile(pFile, nByte);
+ return rc;
+ }
+#endif
+
+ return SQLITE_OK;
+}
+
+/*
+** If *pArg is initially negative then this is a query. Set *pArg to
+** 1 or 0 depending on whether or not bit mask of pFile->ctrlFlags is set.
+**
+** If *pArg is 0 or 1, then clear or set the mask bit of pFile->ctrlFlags.
+*/
+static void unixModeBit(unixFile *pFile, unsigned char mask, int *pArg){
+ if( *pArg<0 ){
+ *pArg = (pFile->ctrlFlags & mask)!=0;
+ }else if( (*pArg)==0 ){
+ pFile->ctrlFlags &= ~mask;
+ }else{
+ pFile->ctrlFlags |= mask;
+ }
+}
+
+/* Forward declaration */
+static int unixGetTempname(int nBuf, char *zBuf);
+#if !defined(SQLITE_WASI) && !defined(SQLITE_OMIT_WAL)
+ static int unixFcntlExternalReader(unixFile*, int*);
+#endif
+
+/*
+** Information and control of an open file handle.
+*/
+static int unixFileControl(sqlite3_file *id, int op, void *pArg){
+ unixFile *pFile = (unixFile*)id;
+ switch( op ){
+#if defined(__linux__) && defined(SQLITE_ENABLE_BATCH_ATOMIC_WRITE)
+ case SQLITE_FCNTL_BEGIN_ATOMIC_WRITE: {
+ int rc = osIoctl(pFile->h, F2FS_IOC_START_ATOMIC_WRITE);
+ return rc ? SQLITE_IOERR_BEGIN_ATOMIC : SQLITE_OK;
+ }
+ case SQLITE_FCNTL_COMMIT_ATOMIC_WRITE: {
+ int rc = osIoctl(pFile->h, F2FS_IOC_COMMIT_ATOMIC_WRITE);
+ return rc ? SQLITE_IOERR_COMMIT_ATOMIC : SQLITE_OK;
+ }
+ case SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE: {
+ int rc = osIoctl(pFile->h, F2FS_IOC_ABORT_VOLATILE_WRITE);
+ return rc ? SQLITE_IOERR_ROLLBACK_ATOMIC : SQLITE_OK;
+ }
+#endif /* __linux__ && SQLITE_ENABLE_BATCH_ATOMIC_WRITE */
+
+ case SQLITE_FCNTL_NULL_IO: {
+ osClose(pFile->h);
+ pFile->h = -1;
+ return SQLITE_OK;
+ }
+ case SQLITE_FCNTL_LOCKSTATE: {
+ *(int*)pArg = pFile->eFileLock;
+ return SQLITE_OK;
+ }
+ case SQLITE_FCNTL_LAST_ERRNO: {
+ *(int*)pArg = pFile->lastErrno;
+ return SQLITE_OK;
+ }
+ case SQLITE_FCNTL_CHUNK_SIZE: {
+ pFile->szChunk = *(int *)pArg;
+ return SQLITE_OK;
+ }
+ case SQLITE_FCNTL_SIZE_HINT: {
+ int rc;
+ SimulateIOErrorBenign(1);
+ rc = fcntlSizeHint(pFile, *(i64 *)pArg);
+ SimulateIOErrorBenign(0);
+ return rc;
+ }
+ case SQLITE_FCNTL_PERSIST_WAL: {
+ unixModeBit(pFile, UNIXFILE_PERSIST_WAL, (int*)pArg);
+ return SQLITE_OK;
+ }
+ case SQLITE_FCNTL_POWERSAFE_OVERWRITE: {
+ unixModeBit(pFile, UNIXFILE_PSOW, (int*)pArg);
+ return SQLITE_OK;
+ }
+ case SQLITE_FCNTL_VFSNAME: {
+ *(char**)pArg = sqlite3_mprintf("%s", pFile->pVfs->zName);
+ return SQLITE_OK;
+ }
+ case SQLITE_FCNTL_TEMPFILENAME: {
+ char *zTFile = sqlite3_malloc64( pFile->pVfs->mxPathname );
+ if( zTFile ){
+ unixGetTempname(pFile->pVfs->mxPathname, zTFile);
+ *(char**)pArg = zTFile;
+ }
+ return SQLITE_OK;
+ }
+ case SQLITE_FCNTL_HAS_MOVED: {
+ *(int*)pArg = fileHasMoved(pFile);
+ return SQLITE_OK;
+ }
+#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
+ case SQLITE_FCNTL_LOCK_TIMEOUT: {
+ int iOld = pFile->iBusyTimeout;
+#if SQLITE_ENABLE_SETLK_TIMEOUT==1
+ pFile->iBusyTimeout = *(int*)pArg;
+#elif SQLITE_ENABLE_SETLK_TIMEOUT==2
+ pFile->iBusyTimeout = !!(*(int*)pArg);
+#else
+# error "SQLITE_ENABLE_SETLK_TIMEOUT must be set to 1 or 2"
+#endif
+ *(int*)pArg = iOld;
+ return SQLITE_OK;
+ }
+#endif
+#if SQLITE_MAX_MMAP_SIZE>0
+ case SQLITE_FCNTL_MMAP_SIZE: {
+ i64 newLimit = *(i64*)pArg;
+ int rc = SQLITE_OK;
+ if( newLimit>sqlite3GlobalConfig.mxMmap ){
+ newLimit = sqlite3GlobalConfig.mxMmap;
+ }
+
+ /* The value of newLimit may be eventually cast to (size_t) and passed
+ ** to mmap(). Restrict its value to 2GB if (size_t) is not at least a
+ ** 64-bit type. */
+ if( newLimit>0 && sizeof(size_t)<8 ){
+ newLimit = (newLimit & 0x7FFFFFFF);
+ }
+
+ *(i64*)pArg = pFile->mmapSizeMax;
+ if( newLimit>=0 && newLimit!=pFile->mmapSizeMax && pFile->nFetchOut==0 ){
+ pFile->mmapSizeMax = newLimit;
+ if( pFile->mmapSize>0 ){
+ unixUnmapfile(pFile);
+ rc = unixMapfile(pFile, -1);
+ }
+ }
+ return rc;
+ }
+#endif
+#ifdef SQLITE_DEBUG
+ /* The pager calls this method to signal that it has done
+ ** a rollback and that the database is therefore unchanged and
+ ** it hence it is OK for the transaction change counter to be
+ ** unchanged.
+ */
+ case SQLITE_FCNTL_DB_UNCHANGED: {
+ ((unixFile*)id)->dbUpdate = 0;
+ return SQLITE_OK;
+ }
+#endif
+#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)
+ case SQLITE_FCNTL_SET_LOCKPROXYFILE:
+ case SQLITE_FCNTL_GET_LOCKPROXYFILE: {
+ return proxyFileControl(id,op,pArg);
+ }
+#endif /* SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__) */
+
+ case SQLITE_FCNTL_EXTERNAL_READER: {
+#if !defined(SQLITE_WASI) && !defined(SQLITE_OMIT_WAL)
+ return unixFcntlExternalReader((unixFile*)id, (int*)pArg);
+#else
+ *(int*)pArg = 0;
+ return SQLITE_OK;
+#endif
+ }
+ }
+ return SQLITE_NOTFOUND;
+}
+
+/*
+** If pFd->sectorSize is non-zero when this function is called, it is a
+** no-op. Otherwise, the values of pFd->sectorSize and
+** pFd->deviceCharacteristics are set according to the file-system
+** characteristics.
+**
+** There are two versions of this function. One for QNX and one for all
+** other systems.
+*/
+#ifndef __QNXNTO__
+static void setDeviceCharacteristics(unixFile *pFd){
+ assert( pFd->deviceCharacteristics==0 || pFd->sectorSize!=0 );
+ if( pFd->sectorSize==0 ){
+#if defined(__linux__) && defined(SQLITE_ENABLE_BATCH_ATOMIC_WRITE)
+ int res;
+ u32 f = 0;
+
+ /* Check for support for F2FS atomic batch writes. */
+ res = osIoctl(pFd->h, F2FS_IOC_GET_FEATURES, &f);
+ if( res==0 && (f & F2FS_FEATURE_ATOMIC_WRITE) ){
+ pFd->deviceCharacteristics = SQLITE_IOCAP_BATCH_ATOMIC;
+ }
+#endif /* __linux__ && SQLITE_ENABLE_BATCH_ATOMIC_WRITE */
+
+ /* Set the POWERSAFE_OVERWRITE flag if requested. */
+ if( pFd->ctrlFlags & UNIXFILE_PSOW ){
+ pFd->deviceCharacteristics |= SQLITE_IOCAP_POWERSAFE_OVERWRITE;
+ }
+ pFd->deviceCharacteristics |= SQLITE_IOCAP_SUBPAGE_READ;
+
+ pFd->sectorSize = SQLITE_DEFAULT_SECTOR_SIZE;
+ }
+}
+#else
+#include <sys/dcmd_blk.h>
+#include <sys/statvfs.h>
+static void setDeviceCharacteristics(unixFile *pFile){
+ if( pFile->sectorSize == 0 ){
+ struct statvfs fsInfo;
+
+ /* Set defaults for non-supported filesystems */
+ pFile->sectorSize = SQLITE_DEFAULT_SECTOR_SIZE;
+ pFile->deviceCharacteristics = 0;
+ if( fstatvfs(pFile->h, &fsInfo) == -1 ) {
+ return;
+ }
+
+ if( !strcmp(fsInfo.f_basetype, "tmp") ) {
+ pFile->sectorSize = fsInfo.f_bsize;
+ pFile->deviceCharacteristics =
+ SQLITE_IOCAP_ATOMIC4K | /* All ram filesystem writes are atomic */
+ SQLITE_IOCAP_SAFE_APPEND | /* growing the file does not occur until
+ ** the write succeeds */
+ SQLITE_IOCAP_SEQUENTIAL | /* The ram filesystem has no write behind
+ ** so it is ordered */
+ 0;
+ }else if( strstr(fsInfo.f_basetype, "etfs") ){
+ pFile->sectorSize = fsInfo.f_bsize;
+ pFile->deviceCharacteristics =
+ /* etfs cluster size writes are atomic */
+ (pFile->sectorSize / 512 * SQLITE_IOCAP_ATOMIC512) |
+ SQLITE_IOCAP_SAFE_APPEND | /* growing the file does not occur until
+ ** the write succeeds */
+ SQLITE_IOCAP_SEQUENTIAL | /* The ram filesystem has no write behind
+ ** so it is ordered */
+ 0;
+ }else if( !strcmp(fsInfo.f_basetype, "qnx6") ){
+ pFile->sectorSize = fsInfo.f_bsize;
+ pFile->deviceCharacteristics =
+ SQLITE_IOCAP_ATOMIC | /* All filesystem writes are atomic */
+ SQLITE_IOCAP_SAFE_APPEND | /* growing the file does not occur until
+ ** the write succeeds */
+ SQLITE_IOCAP_SEQUENTIAL | /* The ram filesystem has no write behind
+ ** so it is ordered */
+ 0;
+ }else if( !strcmp(fsInfo.f_basetype, "qnx4") ){
+ pFile->sectorSize = fsInfo.f_bsize;
+ pFile->deviceCharacteristics =
+ /* full bitset of atomics from max sector size and smaller */
+ (((pFile->sectorSize / 512 * SQLITE_IOCAP_ATOMIC512) << 1) - 2) |
+ SQLITE_IOCAP_SEQUENTIAL | /* The ram filesystem has no write behind
+ ** so it is ordered */
+ 0;
+ }else if( strstr(fsInfo.f_basetype, "dos") ){
+ pFile->sectorSize = fsInfo.f_bsize;
+ pFile->deviceCharacteristics =
+ /* full bitset of atomics from max sector size and smaller */
+ (((pFile->sectorSize / 512 * SQLITE_IOCAP_ATOMIC512) << 1) - 2) |
+ SQLITE_IOCAP_SEQUENTIAL | /* The ram filesystem has no write behind
+ ** so it is ordered */
+ 0;
+ }else{
+ pFile->deviceCharacteristics =
+ SQLITE_IOCAP_ATOMIC512 | /* blocks are atomic */
+ SQLITE_IOCAP_SAFE_APPEND | /* growing the file does not occur until
+ ** the write succeeds */
+ 0;
+ }
+ }
+ /* Last chance verification. If the sector size isn't a multiple of 512
+ ** then it isn't valid.*/
+ if( pFile->sectorSize % 512 != 0 ){
+ pFile->deviceCharacteristics = 0;
+ pFile->sectorSize = SQLITE_DEFAULT_SECTOR_SIZE;
+ }
+}
+#endif
+
+/*
+** Return the sector size in bytes of the underlying block device for
+** the specified file. This is almost always 512 bytes, but may be
+** larger for some devices.
+**
+** SQLite code assumes this function cannot fail. It also assumes that
+** if two files are created in the same file-system directory (i.e.
+** a database and its journal file) that the sector size will be the
+** same for both.
+*/
+static int unixSectorSize(sqlite3_file *id){
+ unixFile *pFd = (unixFile*)id;
+ setDeviceCharacteristics(pFd);
+ return pFd->sectorSize;
+}
+
+/*
+** Return the device characteristics for the file.
+**
+** This VFS is set up to return SQLITE_IOCAP_POWERSAFE_OVERWRITE by default.
+** However, that choice is controversial since technically the underlying
+** file system does not always provide powersafe overwrites. (In other
+** words, after a power-loss event, parts of the file that were never
+** written might end up being altered.) However, non-PSOW behavior is very,
+** very rare. And asserting PSOW makes a large reduction in the amount
+** of required I/O for journaling, since a lot of padding is eliminated.
+** Hence, while POWERSAFE_OVERWRITE is on by default, there is a file-control
+** available to turn it off and URI query parameter available to turn it off.
+*/
+static int unixDeviceCharacteristics(sqlite3_file *id){
+ unixFile *pFd = (unixFile*)id;
+ setDeviceCharacteristics(pFd);
+ return pFd->deviceCharacteristics;
+}
+
+#if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0
+
+/*
+** Return the system page size.
+**
+** This function should not be called directly by other code in this file.
+** Instead, it should be called via macro osGetpagesize().
+*/
+static int unixGetpagesize(void){
+#if OS_VXWORKS
+ return 1024;
+#elif defined(_BSD_SOURCE)
+ return getpagesize();
+#else
+ return (int)sysconf(_SC_PAGESIZE);
+#endif
+}
+
+#endif /* !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0 */
+
+#if !defined(SQLITE_WASI) && !defined(SQLITE_OMIT_WAL)
+
+/*
+** Object used to represent an shared memory buffer.
+**
+** When multiple threads all reference the same wal-index, each thread
+** has its own unixShm object, but they all point to a single instance
+** of this unixShmNode object. In other words, each wal-index is opened
+** only once per process.
+**
+** Each unixShmNode object is connected to a single unixInodeInfo object.
+** We could coalesce this object into unixInodeInfo, but that would mean
+** every open file that does not use shared memory (in other words, most
+** open files) would have to carry around this extra information. So
+** the unixInodeInfo object contains a pointer to this unixShmNode object
+** and the unixShmNode object is created only when needed.
+**
+** unixMutexHeld() must be true when creating or destroying
+** this object or while reading or writing the following fields:
+**
+** nRef
+**
+** The following fields are read-only after the object is created:
+**
+** hShm
+** zFilename
+**
+** Either unixShmNode.pShmMutex must be held or unixShmNode.nRef==0 and
+** unixMutexHeld() is true when reading or writing any other field
+** in this structure.
+**
+** aLock[SQLITE_SHM_NLOCK]:
+** This array records the various locks held by clients on each of the
+** SQLITE_SHM_NLOCK slots. If the aLock[] entry is set to 0, then no
+** locks are held by the process on this slot. If it is set to -1, then
+** some client holds an EXCLUSIVE lock on the locking slot. If the aLock[]
+** value is set to a positive value, then it is the number of shared
+** locks currently held on the slot.
+**
+** aMutex[SQLITE_SHM_NLOCK]:
+** Normally, when SQLITE_ENABLE_SETLK_TIMEOUT is not defined, mutex
+** pShmMutex is used to protect the aLock[] array and the right to
+** call fcntl() on unixShmNode.hShm to obtain or release locks.
+**
+** If SQLITE_ENABLE_SETLK_TIMEOUT is defined though, we use an array
+** of mutexes - one for each locking slot. To read or write locking
+** slot aLock[iSlot], the caller must hold the corresponding mutex
+** aMutex[iSlot]. Similarly, to call fcntl() to obtain or release a
+** lock corresponding to slot iSlot, mutex aMutex[iSlot] must be held.
+*/
+struct unixShmNode {
+ unixInodeInfo *pInode; /* unixInodeInfo that owns this SHM node */
+ sqlite3_mutex *pShmMutex; /* Mutex to access this object */
+ char *zFilename; /* Name of the mmapped file */
+ int hShm; /* Open file descriptor */
+ int szRegion; /* Size of shared-memory regions */
+ u16 nRegion; /* Size of array apRegion */
+ u8 isReadonly; /* True if read-only */
+ u8 isUnlocked; /* True if no DMS lock held */
+ char **apRegion; /* Array of mapped shared-memory regions */
+ int nRef; /* Number of unixShm objects pointing to this */
+ unixShm *pFirst; /* All unixShm objects pointing to this */
+#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
+ sqlite3_mutex *aMutex[SQLITE_SHM_NLOCK];
+#endif
+ int aLock[SQLITE_SHM_NLOCK]; /* # shared locks on slot, -1==excl lock */
+#ifdef SQLITE_DEBUG
+ u8 nextShmId; /* Next available unixShm.id value */
+#endif
+};
+
+/*
+** Structure used internally by this VFS to record the state of an
+** open shared memory connection.
+**
+** The following fields are initialized when this object is created and
+** are read-only thereafter:
+**
+** unixShm.pShmNode
+** unixShm.id
+**
+** All other fields are read/write. The unixShm.pShmNode->pShmMutex must
+** be held while accessing any read/write fields.
+*/
+struct unixShm {
+ unixShmNode *pShmNode; /* The underlying unixShmNode object */
+ unixShm *pNext; /* Next unixShm with the same unixShmNode */
+ u8 hasMutex; /* True if holding the unixShmNode->pShmMutex */
+ u8 id; /* Id of this connection within its unixShmNode */
+ u16 sharedMask; /* Mask of shared locks held */
+ u16 exclMask; /* Mask of exclusive locks held */
+};
+
+/*
+** Constants used for locking
+*/
+#define UNIX_SHM_BASE ((22+SQLITE_SHM_NLOCK)*4) /* first lock byte */
+#define UNIX_SHM_DMS (UNIX_SHM_BASE+SQLITE_SHM_NLOCK) /* deadman switch */
+
+/*
+** Use F_GETLK to check whether or not there are any readers with open
+** wal-mode transactions in other processes on database file pFile. If
+** no error occurs, return SQLITE_OK and set (*piOut) to 1 if there are
+** such transactions, or 0 otherwise. If an error occurs, return an
+** SQLite error code. The final value of *piOut is undefined in this
+** case.
+*/
+static int unixFcntlExternalReader(unixFile *pFile, int *piOut){
+ int rc = SQLITE_OK;
+ *piOut = 0;
+ if( pFile->pShm){
+ unixShmNode *pShmNode = pFile->pShm->pShmNode;
+ struct flock f;
+
+ memset(&f, 0, sizeof(f));
+ f.l_type = F_WRLCK;
+ f.l_whence = SEEK_SET;
+ f.l_start = UNIX_SHM_BASE + 3;
+ f.l_len = SQLITE_SHM_NLOCK - 3;
+
+ sqlite3_mutex_enter(pShmNode->pShmMutex);
+ if( osFcntl(pShmNode->hShm, F_GETLK, &f)<0 ){
+ rc = SQLITE_IOERR_LOCK;
+ }else{
+ *piOut = (f.l_type!=F_UNLCK);
+ }
+ sqlite3_mutex_leave(pShmNode->pShmMutex);
+ }
+
+ return rc;
+}
+
+
+/*
+** Apply posix advisory locks for all bytes from ofst through ofst+n-1.
+**
+** Locks block if the mask is exactly UNIX_SHM_C and are non-blocking
+** otherwise.
+*/
+static int unixShmSystemLock(
+ unixFile *pFile, /* Open connection to the WAL file */
+ int lockType, /* F_UNLCK, F_RDLCK, or F_WRLCK */
+ int ofst, /* First byte of the locking range */
+ int n /* Number of bytes to lock */
+){
+ unixShmNode *pShmNode; /* Apply locks to this open shared-memory segment */
+ struct flock f; /* The posix advisory locking structure */
+ int rc = SQLITE_OK; /* Result code form fcntl() */
+
+ pShmNode = pFile->pInode->pShmNode;
+
+ /* Assert that the parameters are within expected range and that the
+ ** correct mutex or mutexes are held. */
+ assert( pShmNode->nRef>=0 );
+ assert( (ofst==UNIX_SHM_DMS && n==1)
+ || (ofst>=UNIX_SHM_BASE && ofst+n<=(UNIX_SHM_BASE+SQLITE_SHM_NLOCK))
+ );
+ if( ofst==UNIX_SHM_DMS ){
+ assert( pShmNode->nRef>0 || unixMutexHeld() );
+ assert( pShmNode->nRef==0 || sqlite3_mutex_held(pShmNode->pShmMutex) );
+ }else{
+#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
+ int ii;
+ for(ii=ofst-UNIX_SHM_BASE; ii<ofst-UNIX_SHM_BASE+n; ii++){
+ assert( sqlite3_mutex_held(pShmNode->aMutex[ii]) );
+ }
+#else
+ assert( sqlite3_mutex_held(pShmNode->pShmMutex) );
+ assert( pShmNode->nRef>0 );
+#endif
+ }
+
+ /* Shared locks never span more than one byte */
+ assert( n==1 || lockType!=F_RDLCK );
+
+ /* Locks are within range */
+ assert( n>=1 && n<=SQLITE_SHM_NLOCK );
+ assert( ofst>=UNIX_SHM_BASE && ofst<=(UNIX_SHM_DMS+SQLITE_SHM_NLOCK) );
+
+ if( pShmNode->hShm>=0 ){
+ int res;
+ /* Initialize the locking parameters */
+ f.l_type = lockType;
+ f.l_whence = SEEK_SET;
+ f.l_start = ofst;
+ f.l_len = n;
+ res = osSetPosixAdvisoryLock(pShmNode->hShm, &f, pFile);
+ if( res==-1 ){
+#if defined(SQLITE_ENABLE_SETLK_TIMEOUT) && SQLITE_ENABLE_SETLK_TIMEOUT==1
+ rc = (pFile->iBusyTimeout ? SQLITE_BUSY_TIMEOUT : SQLITE_BUSY);
+#else
+ rc = SQLITE_BUSY;
+#endif
+ }
+ }
+
+ /* Do debug tracing */
+#ifdef SQLITE_DEBUG
+ OSTRACE(("SHM-LOCK "));
+ if( rc==SQLITE_OK ){
+ if( lockType==F_UNLCK ){
+ OSTRACE(("unlock %d..%d ok\n", ofst, ofst+n-1));
+ }else if( lockType==F_RDLCK ){
+ OSTRACE(("read-lock %d..%d ok\n", ofst, ofst+n-1));
+ }else{
+ assert( lockType==F_WRLCK );
+ OSTRACE(("write-lock %d..%d ok\n", ofst, ofst+n-1));
+ }
+ }else{
+ if( lockType==F_UNLCK ){
+ OSTRACE(("unlock %d..%d failed\n", ofst, ofst+n-1));
+ }else if( lockType==F_RDLCK ){
+ OSTRACE(("read-lock %d..%d failed\n", ofst, ofst+n-1));
+ }else{
+ assert( lockType==F_WRLCK );
+ OSTRACE(("write-lock %d..%d failed\n", ofst, ofst+n-1));
+ }
+ }
+#endif
+
+ return rc;
+}
+
+/*
+** Return the minimum number of 32KB shm regions that should be mapped at
+** a time, assuming that each mapping must be an integer multiple of the
+** current system page-size.
+**
+** Usually, this is 1. The exception seems to be systems that are configured
+** to use 64KB pages - in this case each mapping must cover at least two
+** shm regions.
+*/
+static int unixShmRegionPerMap(void){
+ int shmsz = 32*1024; /* SHM region size */
+ int pgsz = osGetpagesize(); /* System page size */
+ assert( ((pgsz-1)&pgsz)==0 ); /* Page size must be a power of 2 */
+ if( pgsz<shmsz ) return 1;
+ return pgsz/shmsz;
+}
+
+/*
+** Purge the unixShmNodeList list of all entries with unixShmNode.nRef==0.
+**
+** This is not a VFS shared-memory method; it is a utility function called
+** by VFS shared-memory methods.
+*/
+static void unixShmPurge(unixFile *pFd){
+ unixShmNode *p = pFd->pInode->pShmNode;
+ assert( unixMutexHeld() );
+ if( p && ALWAYS(p->nRef==0) ){
+ int nShmPerMap = unixShmRegionPerMap();
+ int i;
+ assert( p->pInode==pFd->pInode );
+ sqlite3_mutex_free(p->pShmMutex);
+#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
+ for(i=0; i<SQLITE_SHM_NLOCK; i++){
+ sqlite3_mutex_free(p->aMutex[i]);
+ }
+#endif
+ for(i=0; i<p->nRegion; i+=nShmPerMap){
+ if( p->hShm>=0 ){
+ osMunmap(p->apRegion[i], p->szRegion);
+ }else{
+ sqlite3_free(p->apRegion[i]);
+ }
+ }
+ sqlite3_free(p->apRegion);
+ if( p->hShm>=0 ){
+ robust_close(pFd, p->hShm, __LINE__);
+ p->hShm = -1;
+ }
+ p->pInode->pShmNode = 0;
+ sqlite3_free(p);
+ }
+}
+
+/*
+** The DMS lock has not yet been taken on shm file pShmNode. Attempt to
+** take it now. Return SQLITE_OK if successful, or an SQLite error
+** code otherwise.
+**
+** If the DMS cannot be locked because this is a readonly_shm=1
+** connection and no other process already holds a lock, return
+** SQLITE_READONLY_CANTINIT and set pShmNode->isUnlocked=1.
+*/
+static int unixLockSharedMemory(unixFile *pDbFd, unixShmNode *pShmNode){
+ struct flock lock;
+ int rc = SQLITE_OK;
+
+ /* Use F_GETLK to determine the locks other processes are holding
+ ** on the DMS byte. If it indicates that another process is holding
+ ** a SHARED lock, then this process may also take a SHARED lock
+ ** and proceed with opening the *-shm file.
+ **
+ ** Or, if no other process is holding any lock, then this process
+ ** is the first to open it. In this case take an EXCLUSIVE lock on the
+ ** DMS byte and truncate the *-shm file to zero bytes in size. Then
+ ** downgrade to a SHARED lock on the DMS byte.
+ **
+ ** If another process is holding an EXCLUSIVE lock on the DMS byte,
+ ** return SQLITE_BUSY to the caller (it will try again). An earlier
+ ** version of this code attempted the SHARED lock at this point. But
+ ** this introduced a subtle race condition: if the process holding
+ ** EXCLUSIVE failed just before truncating the *-shm file, then this
+ ** process might open and use the *-shm file without truncating it.
+ ** And if the *-shm file has been corrupted by a power failure or
+ ** system crash, the database itself may also become corrupt. */
+ lock.l_whence = SEEK_SET;
+ lock.l_start = UNIX_SHM_DMS;
+ lock.l_len = 1;
+ lock.l_type = F_WRLCK;
+ if( osFcntl(pShmNode->hShm, F_GETLK, &lock)!=0 ) {
+ rc = SQLITE_IOERR_LOCK;
+ }else if( lock.l_type==F_UNLCK ){
+ if( pShmNode->isReadonly ){
+ pShmNode->isUnlocked = 1;
+ rc = SQLITE_READONLY_CANTINIT;
+ }else{
+#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
+ /* Do not use a blocking lock here. If the lock cannot be obtained
+ ** immediately, it means some other connection is truncating the
+ ** *-shm file. And after it has done so, it will not release its
+ ** lock, but only downgrade it to a shared lock. So no point in
+ ** blocking here. The call below to obtain the shared DMS lock may
+ ** use a blocking lock. */
+ int iSaveTimeout = pDbFd->iBusyTimeout;
+ pDbFd->iBusyTimeout = 0;
+#endif
+ rc = unixShmSystemLock(pDbFd, F_WRLCK, UNIX_SHM_DMS, 1);
+#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
+ pDbFd->iBusyTimeout = iSaveTimeout;
+#endif
+ /* The first connection to attach must truncate the -shm file. We
+ ** truncate to 3 bytes (an arbitrary small number, less than the
+ ** -shm header size) rather than 0 as a system debugging aid, to
+ ** help detect if a -shm file truncation is legitimate or is the work
+ ** or a rogue process. */
+ if( rc==SQLITE_OK && robust_ftruncate(pShmNode->hShm, 3) ){
+ rc = unixLogError(SQLITE_IOERR_SHMOPEN,"ftruncate",pShmNode->zFilename);
+ }
+ }
+ }else if( lock.l_type==F_WRLCK ){
+ rc = SQLITE_BUSY;
+ }
+
+ if( rc==SQLITE_OK ){
+ assert( lock.l_type==F_UNLCK || lock.l_type==F_RDLCK );
+ rc = unixShmSystemLock(pDbFd, F_RDLCK, UNIX_SHM_DMS, 1);
+ }
+ return rc;
+}
+
+/*
+** Open a shared-memory area associated with open database file pDbFd.
+** This particular implementation uses mmapped files.
+**
+** The file used to implement shared-memory is in the same directory
+** as the open database file and has the same name as the open database
+** file with the "-shm" suffix added. For example, if the database file
+** is "/home/user1/config.db" then the file that is created and mmapped
+** for shared memory will be called "/home/user1/config.db-shm".
+**
+** Another approach to is to use files in /dev/shm or /dev/tmp or an
+** some other tmpfs mount. But if a file in a different directory
+** from the database file is used, then differing access permissions
+** or a chroot() might cause two different processes on the same
+** database to end up using different files for shared memory -
+** meaning that their memory would not really be shared - resulting
+** in database corruption. Nevertheless, this tmpfs file usage
+** can be enabled at compile-time using -DSQLITE_SHM_DIRECTORY="/dev/shm"
+** or the equivalent. The use of the SQLITE_SHM_DIRECTORY compile-time
+** option results in an incompatible build of SQLite; builds of SQLite
+** that with differing SQLITE_SHM_DIRECTORY settings attempt to use the
+** same database file at the same time, database corruption will likely
+** result. The SQLITE_SHM_DIRECTORY compile-time option is considered
+** "unsupported" and may go away in a future SQLite release.
+**
+** When opening a new shared-memory file, if no other instances of that
+** file are currently open, in this process or in other processes, then
+** the file must be truncated to zero length or have its header cleared.
+**
+** If the original database file (pDbFd) is using the "unix-excl" VFS
+** that means that an exclusive lock is held on the database file and
+** that no other processes are able to read or write the database. In
+** that case, we do not really need shared memory. No shared memory
+** file is created. The shared memory will be simulated with heap memory.
+*/
+static int unixOpenSharedMemory(unixFile *pDbFd){
+ struct unixShm *p = 0; /* The connection to be opened */
+ struct unixShmNode *pShmNode; /* The underlying mmapped file */
+ int rc = SQLITE_OK; /* Result code */
+ unixInodeInfo *pInode; /* The inode of fd */
+ char *zShm; /* Name of the file used for SHM */
+ int nShmFilename; /* Size of the SHM filename in bytes */
+
+ /* Allocate space for the new unixShm object. */
+ p = sqlite3_malloc64( sizeof(*p) );
+ if( p==0 ) return SQLITE_NOMEM_BKPT;
+ memset(p, 0, sizeof(*p));
+ assert( pDbFd->pShm==0 );
+
+ /* Check to see if a unixShmNode object already exists. Reuse an existing
+ ** one if present. Create a new one if necessary.
+ */
+ assert( unixFileMutexNotheld(pDbFd) );
+ unixEnterMutex();
+ pInode = pDbFd->pInode;
+ pShmNode = pInode->pShmNode;
+ if( pShmNode==0 ){
+ struct stat sStat; /* fstat() info for database file */
+#ifndef SQLITE_SHM_DIRECTORY
+ const char *zBasePath = pDbFd->zPath;
+#endif
+
+ /* Call fstat() to figure out the permissions on the database file. If
+ ** a new *-shm file is created, an attempt will be made to create it
+ ** with the same permissions.
+ */
+ if( osFstat(pDbFd->h, &sStat) ){
+ rc = SQLITE_IOERR_FSTAT;
+ goto shm_open_err;
+ }
+
+#ifdef SQLITE_SHM_DIRECTORY
+ nShmFilename = sizeof(SQLITE_SHM_DIRECTORY) + 31;
+#else
+ nShmFilename = 6 + (int)strlen(zBasePath);
+#endif
+ pShmNode = sqlite3_malloc64( sizeof(*pShmNode) + nShmFilename );
+ if( pShmNode==0 ){
+ rc = SQLITE_NOMEM_BKPT;
+ goto shm_open_err;
+ }
+ memset(pShmNode, 0, sizeof(*pShmNode)+nShmFilename);
+ zShm = pShmNode->zFilename = (char*)&pShmNode[1];
+#ifdef SQLITE_SHM_DIRECTORY
+ sqlite3_snprintf(nShmFilename, zShm,
+ SQLITE_SHM_DIRECTORY "/sqlite-shm-%x-%x",
+ (u32)sStat.st_ino, (u32)sStat.st_dev);
+#else
+ sqlite3_snprintf(nShmFilename, zShm, "%s-shm", zBasePath);
+ sqlite3FileSuffix3(pDbFd->zPath, zShm);
+#endif
+ pShmNode->hShm = -1;
+ pDbFd->pInode->pShmNode = pShmNode;
+ pShmNode->pInode = pDbFd->pInode;
+ if( sqlite3GlobalConfig.bCoreMutex ){
+ pShmNode->pShmMutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST);
+ if( pShmNode->pShmMutex==0 ){
+ rc = SQLITE_NOMEM_BKPT;
+ goto shm_open_err;
+ }
+#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
+ {
+ int ii;
+ for(ii=0; ii<SQLITE_SHM_NLOCK; ii++){
+ pShmNode->aMutex[ii] = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST);
+ if( pShmNode->aMutex[ii]==0 ){
+ rc = SQLITE_NOMEM_BKPT;
+ goto shm_open_err;
+ }
+ }
+ }
+#endif
+ }
+
+ if( pInode->bProcessLock==0 ){
+ if( 0==sqlite3_uri_boolean(pDbFd->zPath, "readonly_shm", 0) ){
+ pShmNode->hShm = robust_open(zShm, O_RDWR|O_CREAT|O_NOFOLLOW,
+ (sStat.st_mode&0777));
+ }
+ if( pShmNode->hShm<0 ){
+ pShmNode->hShm = robust_open(zShm, O_RDONLY|O_NOFOLLOW,
+ (sStat.st_mode&0777));
+ if( pShmNode->hShm<0 ){
+ rc = unixLogError(SQLITE_CANTOPEN_BKPT, "open", zShm);
+ goto shm_open_err;
+ }
+ pShmNode->isReadonly = 1;
+ }
+
+ /* If this process is running as root, make sure that the SHM file
+ ** is owned by the same user that owns the original database. Otherwise,
+ ** the original owner will not be able to connect.
+ */
+ robustFchown(pShmNode->hShm, sStat.st_uid, sStat.st_gid);
+
+ rc = unixLockSharedMemory(pDbFd, pShmNode);
+ if( rc!=SQLITE_OK && rc!=SQLITE_READONLY_CANTINIT ) goto shm_open_err;
+ }
+ }
+
+ /* Make the new connection a child of the unixShmNode */
+ p->pShmNode = pShmNode;
+#ifdef SQLITE_DEBUG
+ p->id = pShmNode->nextShmId++;
+#endif
+ pShmNode->nRef++;
+ pDbFd->pShm = p;
+ unixLeaveMutex();
+
+ /* The reference count on pShmNode has already been incremented under
+ ** the cover of the unixEnterMutex() mutex and the pointer from the
+ ** new (struct unixShm) object to the pShmNode has been set. All that is
+ ** left to do is to link the new object into the linked list starting
+ ** at pShmNode->pFirst. This must be done while holding the
+ ** pShmNode->pShmMutex.
+ */
+ sqlite3_mutex_enter(pShmNode->pShmMutex);
+ p->pNext = pShmNode->pFirst;
+ pShmNode->pFirst = p;
+ sqlite3_mutex_leave(pShmNode->pShmMutex);
+ return rc;
+
+ /* Jump here on any error */
+shm_open_err:
+ unixShmPurge(pDbFd); /* This call frees pShmNode if required */
+ sqlite3_free(p);
+ unixLeaveMutex();
+ return rc;
+}
+
+/*
+** This function is called to obtain a pointer to region iRegion of the
+** shared-memory associated with the database file fd. Shared-memory regions
+** are numbered starting from zero. Each shared-memory region is szRegion
+** bytes in size.
+**
+** If an error occurs, an error code is returned and *pp is set to NULL.
+**
+** Otherwise, if the bExtend parameter is 0 and the requested shared-memory
+** region has not been allocated (by any client, including one running in a
+** separate process), then *pp is set to NULL and SQLITE_OK returned. If
+** bExtend is non-zero and the requested shared-memory region has not yet
+** been allocated, it is allocated by this function.
+**
+** If the shared-memory region has already been allocated or is allocated by
+** this call as described above, then it is mapped into this processes
+** address space (if it is not already), *pp is set to point to the mapped
+** memory and SQLITE_OK returned.
+*/
+static int unixShmMap(
+ sqlite3_file *fd, /* Handle open on database file */
+ int iRegion, /* Region to retrieve */
+ int szRegion, /* Size of regions */
+ int bExtend, /* True to extend file if necessary */
+ void volatile **pp /* OUT: Mapped memory */
+){
+ unixFile *pDbFd = (unixFile*)fd;
+ unixShm *p;
+ unixShmNode *pShmNode;
+ int rc = SQLITE_OK;
+ int nShmPerMap = unixShmRegionPerMap();
+ int nReqRegion;
+
+ /* If the shared-memory file has not yet been opened, open it now. */
+ if( pDbFd->pShm==0 ){
+ rc = unixOpenSharedMemory(pDbFd);
+ if( rc!=SQLITE_OK ) return rc;
+ }
+
+ p = pDbFd->pShm;
+ pShmNode = p->pShmNode;
+ sqlite3_mutex_enter(pShmNode->pShmMutex);
+ if( pShmNode->isUnlocked ){
+ rc = unixLockSharedMemory(pDbFd, pShmNode);
+ if( rc!=SQLITE_OK ) goto shmpage_out;
+ pShmNode->isUnlocked = 0;
+ }
+ assert( szRegion==pShmNode->szRegion || pShmNode->nRegion==0 );
+ assert( pShmNode->pInode==pDbFd->pInode );
+ assert( pShmNode->hShm>=0 || pDbFd->pInode->bProcessLock==1 );
+ assert( pShmNode->hShm<0 || pDbFd->pInode->bProcessLock==0 );
+
+ /* Minimum number of regions required to be mapped. */
+ nReqRegion = ((iRegion+nShmPerMap) / nShmPerMap) * nShmPerMap;
+
+ if( pShmNode->nRegion<nReqRegion ){
+ char **apNew; /* New apRegion[] array */
+ int nByte = nReqRegion*szRegion; /* Minimum required file size */
+ struct stat sStat; /* Used by fstat() */
+
+ pShmNode->szRegion = szRegion;
+
+ if( pShmNode->hShm>=0 ){
+ /* The requested region is not mapped into this processes address space.
+ ** Check to see if it has been allocated (i.e. if the wal-index file is
+ ** large enough to contain the requested region).
+ */
+ if( osFstat(pShmNode->hShm, &sStat) ){
+ rc = SQLITE_IOERR_SHMSIZE;
+ goto shmpage_out;
+ }
+
+ if( sStat.st_size<nByte ){
+ /* The requested memory region does not exist. If bExtend is set to
+ ** false, exit early. *pp will be set to NULL and SQLITE_OK returned.
+ */
+ if( !bExtend ){
+ goto shmpage_out;
+ }
+
+ /* Alternatively, if bExtend is true, extend the file. Do this by
+ ** writing a single byte to the end of each (OS) page being
+ ** allocated or extended. Technically, we need only write to the
+ ** last page in order to extend the file. But writing to all new
+ ** pages forces the OS to allocate them immediately, which reduces
+ ** the chances of SIGBUS while accessing the mapped region later on.
+ */
+ else{
+ static const int pgsz = 4096;
+ int iPg;
+
+ /* Write to the last byte of each newly allocated or extended page */
+ assert( (nByte % pgsz)==0 );
+ for(iPg=(sStat.st_size/pgsz); iPg<(nByte/pgsz); iPg++){
+ int x = 0;
+ if( seekAndWriteFd(pShmNode->hShm, iPg*pgsz + pgsz-1,"",1,&x)!=1 ){
+ const char *zFile = pShmNode->zFilename;
+ rc = unixLogError(SQLITE_IOERR_SHMSIZE, "write", zFile);
+ goto shmpage_out;
+ }
+ }
+ }
+ }
+ }
+
+ /* Map the requested memory region into this processes address space. */
+ apNew = (char **)sqlite3_realloc(
+ pShmNode->apRegion, nReqRegion*sizeof(char *)
+ );
+ if( !apNew ){
+ rc = SQLITE_IOERR_NOMEM_BKPT;
+ goto shmpage_out;
+ }
+ pShmNode->apRegion = apNew;
+ while( pShmNode->nRegion<nReqRegion ){
+ int nMap = szRegion*nShmPerMap;
+ int i;
+ void *pMem;
+ if( pShmNode->hShm>=0 ){
+ pMem = osMmap(0, nMap,
+ pShmNode->isReadonly ? PROT_READ : PROT_READ|PROT_WRITE,
+ MAP_SHARED, pShmNode->hShm, szRegion*(i64)pShmNode->nRegion
+ );
+ if( pMem==MAP_FAILED ){
+ rc = unixLogError(SQLITE_IOERR_SHMMAP, "mmap", pShmNode->zFilename);
+ goto shmpage_out;
+ }
+ }else{
+ pMem = sqlite3_malloc64(nMap);
+ if( pMem==0 ){
+ rc = SQLITE_NOMEM_BKPT;
+ goto shmpage_out;
+ }
+ memset(pMem, 0, nMap);
+ }
+
+ for(i=0; i<nShmPerMap; i++){
+ pShmNode->apRegion[pShmNode->nRegion+i] = &((char*)pMem)[szRegion*i];
+ }
+ pShmNode->nRegion += nShmPerMap;
+ }
+ }
+
+shmpage_out:
+ if( pShmNode->nRegion>iRegion ){
+ *pp = pShmNode->apRegion[iRegion];
+ }else{
+ *pp = 0;
+ }
+ if( pShmNode->isReadonly && rc==SQLITE_OK ) rc = SQLITE_READONLY;
+ sqlite3_mutex_leave(pShmNode->pShmMutex);
+ return rc;
+}
+
+/*
+** Check that the pShmNode->aLock[] array comports with the locking bitmasks
+** held by each client. Return true if it does, or false otherwise. This
+** is to be used in an assert(). e.g.
+**
+** assert( assertLockingArrayOk(pShmNode) );
+*/
+#ifdef SQLITE_DEBUG
+static int assertLockingArrayOk(unixShmNode *pShmNode){
+#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
+ return 1;
+#else
+ unixShm *pX;
+ int aLock[SQLITE_SHM_NLOCK];
+
+ memset(aLock, 0, sizeof(aLock));
+ for(pX=pShmNode->pFirst; pX; pX=pX->pNext){
+ int i;
+ for(i=0; i<SQLITE_SHM_NLOCK; i++){
+ if( pX->exclMask & (1<<i) ){
+ assert( aLock[i]==0 );
+ aLock[i] = -1;
+ }else if( pX->sharedMask & (1<<i) ){
+ assert( aLock[i]>=0 );
+ aLock[i]++;
+ }
+ }
+ }
+
+ assert( 0==memcmp(pShmNode->aLock, aLock, sizeof(aLock)) );
+ return (memcmp(pShmNode->aLock, aLock, sizeof(aLock))==0);
+#endif
+}
+#endif
+
+/*
+** Change the lock state for a shared-memory segment.
+**
+** Note that the relationship between SHARED and EXCLUSIVE locks is a little
+** different here than in posix. In xShmLock(), one can go from unlocked
+** to shared and back or from unlocked to exclusive and back. But one may
+** not go from shared to exclusive or from exclusive to shared.
+*/
+static int unixShmLock(
+ sqlite3_file *fd, /* Database file holding the shared memory */
+ int ofst, /* First lock to acquire or release */
+ int n, /* Number of locks to acquire or release */
+ int flags /* What to do with the lock */
+){
+ unixFile *pDbFd = (unixFile*)fd; /* Connection holding shared memory */
+ unixShm *p; /* The shared memory being locked */
+ unixShmNode *pShmNode; /* The underlying file iNode */
+ int rc = SQLITE_OK; /* Result code */
+ u16 mask = (1<<(ofst+n)) - (1<<ofst); /* Mask of locks to take or release */
+ int *aLock;
+
+ p = pDbFd->pShm;
+ if( p==0 ) return SQLITE_IOERR_SHMLOCK;
+ pShmNode = p->pShmNode;
+ if( NEVER(pShmNode==0) ) return SQLITE_IOERR_SHMLOCK;
+ aLock = pShmNode->aLock;
+
+ assert( pShmNode==pDbFd->pInode->pShmNode );
+ assert( pShmNode->pInode==pDbFd->pInode );
+ assert( ofst>=0 && ofst+n<=SQLITE_SHM_NLOCK );
+ assert( n>=1 );
+ assert( flags==(SQLITE_SHM_LOCK | SQLITE_SHM_SHARED)
+ || flags==(SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE)
+ || flags==(SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED)
+ || flags==(SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE) );
+ assert( n==1 || (flags & SQLITE_SHM_EXCLUSIVE)!=0 );
+ assert( pShmNode->hShm>=0 || pDbFd->pInode->bProcessLock==1 );
+ assert( pShmNode->hShm<0 || pDbFd->pInode->bProcessLock==0 );
+
+ /* Check that, if this to be a blocking lock, no locks that occur later
+ ** in the following list than the lock being obtained are already held:
+ **
+ ** 1. Checkpointer lock (ofst==1).
+ ** 2. Write lock (ofst==0).
+ ** 3. Read locks (ofst>=3 && ofst<SQLITE_SHM_NLOCK).
+ **
+ ** In other words, if this is a blocking lock, none of the locks that
+ ** occur later in the above list than the lock being obtained may be
+ ** held.
+ **
+ ** It is not permitted to block on the RECOVER lock.
+ */
+#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
+ {
+ u16 lockMask = (p->exclMask|p->sharedMask);
+ assert( (flags & SQLITE_SHM_UNLOCK) || pDbFd->iBusyTimeout==0 || (
+ (ofst!=2) /* not RECOVER */
+ && (ofst!=1 || lockMask==0 || lockMask==2)
+ && (ofst!=0 || lockMask<3)
+ && (ofst<3 || lockMask<(1<<ofst))
+ ));
+ }
+#endif
+
+ /* Check if there is any work to do. There are three cases:
+ **
+ ** a) An unlock operation where there are locks to unlock,
+ ** b) An shared lock where the requested lock is not already held
+ ** c) An exclusive lock where the requested lock is not already held
+ **
+ ** The SQLite core never requests an exclusive lock that it already holds.
+ ** This is assert()ed below.
+ */
+ assert( flags!=(SQLITE_SHM_EXCLUSIVE|SQLITE_SHM_LOCK)
+ || 0==(p->exclMask & mask)
+ );
+ if( ((flags & SQLITE_SHM_UNLOCK) && ((p->exclMask|p->sharedMask) & mask))
+ || (flags==(SQLITE_SHM_SHARED|SQLITE_SHM_LOCK) && 0==(p->sharedMask & mask))
+ || (flags==(SQLITE_SHM_EXCLUSIVE|SQLITE_SHM_LOCK))
+ ){
+
+ /* Take the required mutexes. In SETLK_TIMEOUT mode (blocking locks), if
+ ** this is an attempt on an exclusive lock use sqlite3_mutex_try(). If any
+ ** other thread is holding this mutex, then it is either holding or about
+ ** to hold a lock exclusive to the one being requested, and we may
+ ** therefore return SQLITE_BUSY to the caller.
+ **
+ ** Doing this prevents some deadlock scenarios. For example, thread 1 may
+ ** be a checkpointer blocked waiting on the WRITER lock. And thread 2
+ ** may be a normal SQL client upgrading to a write transaction. In this
+ ** case thread 2 does a non-blocking request for the WRITER lock. But -
+ ** if it were to use sqlite3_mutex_enter() then it would effectively
+ ** become a (doomed) blocking request, as thread 2 would block until thread
+ ** 1 obtained WRITER and released the mutex. Since thread 2 already holds
+ ** a lock on a read-locking slot at this point, this breaks the
+ ** anti-deadlock rules (see above). */
+#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
+ int iMutex;
+ for(iMutex=ofst; iMutex<ofst+n; iMutex++){
+ if( flags==(SQLITE_SHM_LOCK|SQLITE_SHM_EXCLUSIVE) ){
+ rc = sqlite3_mutex_try(pShmNode->aMutex[iMutex]);
+ if( rc!=SQLITE_OK ) goto leave_shmnode_mutexes;
+ }else{
+ sqlite3_mutex_enter(pShmNode->aMutex[iMutex]);
+ }
+ }
+#else
+ sqlite3_mutex_enter(pShmNode->pShmMutex);
+#endif
+
+ if( ALWAYS(rc==SQLITE_OK) ){
+ if( flags & SQLITE_SHM_UNLOCK ){
+ /* Case (a) - unlock. */
+ int bUnlock = 1;
+ assert( (p->exclMask & p->sharedMask)==0 );
+ assert( !(flags & SQLITE_SHM_EXCLUSIVE) || (p->exclMask & mask)==mask );
+ assert( !(flags & SQLITE_SHM_SHARED) || (p->sharedMask & mask)==mask );
+
+ /* If this is a SHARED lock being unlocked, it is possible that other
+ ** clients within this process are holding the same SHARED lock. In
+ ** this case, set bUnlock to 0 so that the posix lock is not removed
+ ** from the file-descriptor below. */
+ if( flags & SQLITE_SHM_SHARED ){
+ assert( n==1 );
+ assert( aLock[ofst]>=1 );
+ if( aLock[ofst]>1 ){
+ bUnlock = 0;
+ aLock[ofst]--;
+ p->sharedMask &= ~mask;
+ }
+ }
+
+ if( bUnlock ){
+ rc = unixShmSystemLock(pDbFd, F_UNLCK, ofst+UNIX_SHM_BASE, n);
+ if( rc==SQLITE_OK ){
+ memset(&aLock[ofst], 0, sizeof(int)*n);
+ p->sharedMask &= ~mask;
+ p->exclMask &= ~mask;
+ }
+ }
+ }else if( flags & SQLITE_SHM_SHARED ){
+ /* Case (b) - a shared lock. */
+
+ if( aLock[ofst]<0 ){
+ /* An exclusive lock is held by some other connection. BUSY. */
+ rc = SQLITE_BUSY;
+ }else if( aLock[ofst]==0 ){
+ rc = unixShmSystemLock(pDbFd, F_RDLCK, ofst+UNIX_SHM_BASE, n);
+ }
+
+ /* Get the local shared locks */
+ if( rc==SQLITE_OK ){
+ p->sharedMask |= mask;
+ aLock[ofst]++;
+ }
+ }else{
+ /* Case (c) - an exclusive lock. */
+ int ii;
+
+ assert( flags==(SQLITE_SHM_LOCK|SQLITE_SHM_EXCLUSIVE) );
+ assert( (p->sharedMask & mask)==0 );
+ assert( (p->exclMask & mask)==0 );
+
+ /* Make sure no sibling connections hold locks that will block this
+ ** lock. If any do, return SQLITE_BUSY right away. */
+ for(ii=ofst; ii<ofst+n; ii++){
+ if( aLock[ii] ){
+ rc = SQLITE_BUSY;
+ break;
+ }
+ }
+
+ /* Get the exclusive locks at the system level. Then if successful
+ ** also update the in-memory values. */
+ if( rc==SQLITE_OK ){
+ rc = unixShmSystemLock(pDbFd, F_WRLCK, ofst+UNIX_SHM_BASE, n);
+ if( rc==SQLITE_OK ){
+ p->exclMask |= mask;
+ for(ii=ofst; ii<ofst+n; ii++){
+ aLock[ii] = -1;
+ }
+ }
+ }
+ }
+ assert( assertLockingArrayOk(pShmNode) );
+ }
+
+ /* Drop the mutexes acquired above. */
+#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
+ leave_shmnode_mutexes:
+ for(iMutex--; iMutex>=ofst; iMutex--){
+ sqlite3_mutex_leave(pShmNode->aMutex[iMutex]);
+ }
+#else
+ sqlite3_mutex_leave(pShmNode->pShmMutex);
+#endif
+ }
+
+ OSTRACE(("SHM-LOCK shmid-%d, pid-%d got %03x,%03x\n",
+ p->id, osGetpid(0), p->sharedMask, p->exclMask));
+ return rc;
+}
+
+/*
+** Implement a memory barrier or memory fence on shared memory.
+**
+** All loads and stores begun before the barrier must complete before
+** any load or store begun after the barrier.
+*/
+static void unixShmBarrier(
+ sqlite3_file *fd /* Database file holding the shared memory */
+){
+ UNUSED_PARAMETER(fd);
+ sqlite3MemoryBarrier(); /* compiler-defined memory barrier */
+ assert( fd->pMethods->xLock==nolockLock
+ || unixFileMutexNotheld((unixFile*)fd)
+ );
+ unixEnterMutex(); /* Also mutex, for redundancy */
+ unixLeaveMutex();
+}
+
+/*
+** Close a connection to shared-memory. Delete the underlying
+** storage if deleteFlag is true.
+**
+** If there is no shared memory associated with the connection then this
+** routine is a harmless no-op.
+*/
+static int unixShmUnmap(
+ sqlite3_file *fd, /* The underlying database file */
+ int deleteFlag /* Delete shared-memory if true */
+){
+ unixShm *p; /* The connection to be closed */
+ unixShmNode *pShmNode; /* The underlying shared-memory file */
+ unixShm **pp; /* For looping over sibling connections */
+ unixFile *pDbFd; /* The underlying database file */
+
+ pDbFd = (unixFile*)fd;
+ p = pDbFd->pShm;
+ if( p==0 ) return SQLITE_OK;
+ pShmNode = p->pShmNode;
+
+ assert( pShmNode==pDbFd->pInode->pShmNode );
+ assert( pShmNode->pInode==pDbFd->pInode );
+
+ /* Remove connection p from the set of connections associated
+ ** with pShmNode */
+ sqlite3_mutex_enter(pShmNode->pShmMutex);
+ for(pp=&pShmNode->pFirst; (*pp)!=p; pp = &(*pp)->pNext){}
+ *pp = p->pNext;
+
+ /* Free the connection p */
+ sqlite3_free(p);
+ pDbFd->pShm = 0;
+ sqlite3_mutex_leave(pShmNode->pShmMutex);
+
+ /* If pShmNode->nRef has reached 0, then close the underlying
+ ** shared-memory file, too */
+ assert( unixFileMutexNotheld(pDbFd) );
+ unixEnterMutex();
+ assert( pShmNode->nRef>0 );
+ pShmNode->nRef--;
+ if( pShmNode->nRef==0 ){
+ if( deleteFlag && pShmNode->hShm>=0 ){
+ osUnlink(pShmNode->zFilename);
+ }
+ unixShmPurge(pDbFd);
+ }
+ unixLeaveMutex();
+
+ return SQLITE_OK;
+}
+
+
+#else
+# define unixShmMap 0
+# define unixShmLock 0
+# define unixShmBarrier 0
+# define unixShmUnmap 0
+#endif /* #ifndef SQLITE_OMIT_WAL */
+
+#if SQLITE_MAX_MMAP_SIZE>0
+/*
+** If it is currently memory mapped, unmap file pFd.
+*/
+static void unixUnmapfile(unixFile *pFd){
+ assert( pFd->nFetchOut==0 );
+ if( pFd->pMapRegion ){
+ osMunmap(pFd->pMapRegion, pFd->mmapSizeActual);
+ pFd->pMapRegion = 0;
+ pFd->mmapSize = 0;
+ pFd->mmapSizeActual = 0;
+ }
+}
+
+/*
+** Attempt to set the size of the memory mapping maintained by file
+** descriptor pFd to nNew bytes. Any existing mapping is discarded.
+**
+** If successful, this function sets the following variables:
+**
+** unixFile.pMapRegion
+** unixFile.mmapSize
+** unixFile.mmapSizeActual
+**
+** If unsuccessful, an error message is logged via sqlite3_log() and
+** the three variables above are zeroed. In this case SQLite should
+** continue accessing the database using the xRead() and xWrite()
+** methods.
+*/
+static void unixRemapfile(
+ unixFile *pFd, /* File descriptor object */
+ i64 nNew /* Required mapping size */
+){
+ const char *zErr = "mmap";
+ int h = pFd->h; /* File descriptor open on db file */
+ u8 *pOrig = (u8 *)pFd->pMapRegion; /* Pointer to current file mapping */
+ i64 nOrig = pFd->mmapSizeActual; /* Size of pOrig region in bytes */
+ u8 *pNew = 0; /* Location of new mapping */
+ int flags = PROT_READ; /* Flags to pass to mmap() */
+
+ assert( pFd->nFetchOut==0 );
+ assert( nNew>pFd->mmapSize );
+ assert( nNew<=pFd->mmapSizeMax );
+ assert( nNew>0 );
+ assert( pFd->mmapSizeActual>=pFd->mmapSize );
+ assert( MAP_FAILED!=0 );
+
+#ifdef SQLITE_MMAP_READWRITE
+ if( (pFd->ctrlFlags & UNIXFILE_RDONLY)==0 ) flags |= PROT_WRITE;
+#endif
+
+ if( pOrig ){
+#if HAVE_MREMAP
+ i64 nReuse = pFd->mmapSize;
+#else
+ const int szSyspage = osGetpagesize();
+ i64 nReuse = (pFd->mmapSize & ~(szSyspage-1));
+#endif
+ u8 *pReq = &pOrig[nReuse];
+
+ /* Unmap any pages of the existing mapping that cannot be reused. */
+ if( nReuse!=nOrig ){
+ osMunmap(pReq, nOrig-nReuse);
+ }
+
+#if HAVE_MREMAP
+ pNew = osMremap(pOrig, nReuse, nNew, MREMAP_MAYMOVE);
+ zErr = "mremap";
+#else
+ pNew = osMmap(pReq, nNew-nReuse, flags, MAP_SHARED, h, nReuse);
+ if( pNew!=MAP_FAILED ){
+ if( pNew!=pReq ){
+ osMunmap(pNew, nNew - nReuse);
+ pNew = 0;
+ }else{
+ pNew = pOrig;
+ }
+ }
+#endif
+
+ /* The attempt to extend the existing mapping failed. Free it. */
+ if( pNew==MAP_FAILED || pNew==0 ){
+ osMunmap(pOrig, nReuse);
+ }
+ }
+
+ /* If pNew is still NULL, try to create an entirely new mapping. */
+ if( pNew==0 ){
+ pNew = osMmap(0, nNew, flags, MAP_SHARED, h, 0);
+ }
+
+ if( pNew==MAP_FAILED ){
+ pNew = 0;
+ nNew = 0;
+ unixLogError(SQLITE_OK, zErr, pFd->zPath);
+
+ /* If the mmap() above failed, assume that all subsequent mmap() calls
+ ** will probably fail too. Fall back to using xRead/xWrite exclusively
+ ** in this case. */
+ pFd->mmapSizeMax = 0;
+ }
+ pFd->pMapRegion = (void *)pNew;
+ pFd->mmapSize = pFd->mmapSizeActual = nNew;
+}
+
+/*
+** Memory map or remap the file opened by file-descriptor pFd (if the file
+** is already mapped, the existing mapping is replaced by the new). Or, if
+** there already exists a mapping for this file, and there are still
+** outstanding xFetch() references to it, this function is a no-op.
+**
+** If parameter nByte is non-negative, then it is the requested size of
+** the mapping to create. Otherwise, if nByte is less than zero, then the
+** requested size is the size of the file on disk. The actual size of the
+** created mapping is either the requested size or the value configured
+** using SQLITE_FCNTL_MMAP_LIMIT, whichever is smaller.
+**
+** SQLITE_OK is returned if no error occurs (even if the mapping is not
+** recreated as a result of outstanding references) or an SQLite error
+** code otherwise.
+*/
+static int unixMapfile(unixFile *pFd, i64 nMap){
+ assert( nMap>=0 || pFd->nFetchOut==0 );
+ assert( nMap>0 || (pFd->mmapSize==0 && pFd->pMapRegion==0) );
+ if( pFd->nFetchOut>0 ) return SQLITE_OK;
+
+ if( nMap<0 ){
+ struct stat statbuf; /* Low-level file information */
+ if( osFstat(pFd->h, &statbuf) ){
+ return SQLITE_IOERR_FSTAT;
+ }
+ nMap = statbuf.st_size;
+ }
+ if( nMap>pFd->mmapSizeMax ){
+ nMap = pFd->mmapSizeMax;
+ }
+
+ assert( nMap>0 || (pFd->mmapSize==0 && pFd->pMapRegion==0) );
+ if( nMap!=pFd->mmapSize ){
+ unixRemapfile(pFd, nMap);
+ }
+
+ return SQLITE_OK;
+}
+#endif /* SQLITE_MAX_MMAP_SIZE>0 */
+
+/*
+** If possible, return a pointer to a mapping of file fd starting at offset
+** iOff. The mapping must be valid for at least nAmt bytes.
+**
+** If such a pointer can be obtained, store it in *pp and return SQLITE_OK.
+** Or, if one cannot but no error occurs, set *pp to 0 and return SQLITE_OK.
+** Finally, if an error does occur, return an SQLite error code. The final
+** value of *pp is undefined in this case.
+**
+** If this function does return a pointer, the caller must eventually
+** release the reference by calling unixUnfetch().
+*/
+static int unixFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){
+#if SQLITE_MAX_MMAP_SIZE>0
+ unixFile *pFd = (unixFile *)fd; /* The underlying database file */
+#endif
+ *pp = 0;
+
+#if SQLITE_MAX_MMAP_SIZE>0
+ if( pFd->mmapSizeMax>0 ){
+ /* Ensure that there is always at least a 256 byte buffer of addressable
+ ** memory following the returned page. If the database is corrupt,
+ ** SQLite may overread the page slightly (in practice only a few bytes,
+ ** but 256 is safe, round, number). */
+ const int nEofBuffer = 256;
+ if( pFd->pMapRegion==0 ){
+ int rc = unixMapfile(pFd, -1);
+ if( rc!=SQLITE_OK ) return rc;
+ }
+ if( pFd->mmapSize >= (iOff+nAmt+nEofBuffer) ){
+ *pp = &((u8 *)pFd->pMapRegion)[iOff];
+ pFd->nFetchOut++;
+ }
+ }
+#endif
+ return SQLITE_OK;
+}
+
+/*
+** If the third argument is non-NULL, then this function releases a
+** reference obtained by an earlier call to unixFetch(). The second
+** argument passed to this function must be the same as the corresponding
+** argument that was passed to the unixFetch() invocation.
+**
+** Or, if the third argument is NULL, then this function is being called
+** to inform the VFS layer that, according to POSIX, any existing mapping
+** may now be invalid and should be unmapped.
+*/
+static int unixUnfetch(sqlite3_file *fd, i64 iOff, void *p){
+#if SQLITE_MAX_MMAP_SIZE>0
+ unixFile *pFd = (unixFile *)fd; /* The underlying database file */
+ UNUSED_PARAMETER(iOff);
+
+ /* If p==0 (unmap the entire file) then there must be no outstanding
+ ** xFetch references. Or, if p!=0 (meaning it is an xFetch reference),
+ ** then there must be at least one outstanding. */
+ assert( (p==0)==(pFd->nFetchOut==0) );
+
+ /* If p!=0, it must match the iOff value. */
+ assert( p==0 || p==&((u8 *)pFd->pMapRegion)[iOff] );
+
+ if( p ){
+ pFd->nFetchOut--;
+ }else{
+ unixUnmapfile(pFd);
+ }
+
+ assert( pFd->nFetchOut>=0 );
+#else
+ UNUSED_PARAMETER(fd);
+ UNUSED_PARAMETER(p);
+ UNUSED_PARAMETER(iOff);
+#endif
+ return SQLITE_OK;
+}
+
+/*
+** Here ends the implementation of all sqlite3_file methods.
+**
+********************** End sqlite3_file Methods *******************************
+******************************************************************************/
+
+/*
+** This division contains definitions of sqlite3_io_methods objects that
+** implement various file locking strategies. It also contains definitions
+** of "finder" functions. A finder-function is used to locate the appropriate
+** sqlite3_io_methods object for a particular database file. The pAppData
+** field of the sqlite3_vfs VFS objects are initialized to be pointers to
+** the correct finder-function for that VFS.
+**
+** Most finder functions return a pointer to a fixed sqlite3_io_methods
+** object. The only interesting finder-function is autolockIoFinder, which
+** looks at the filesystem type and tries to guess the best locking
+** strategy from that.
+**
+** For finder-function F, two objects are created:
+**
+** (1) The real finder-function named "FImpt()".
+**
+** (2) A constant pointer to this function named just "F".
+**
+**
+** A pointer to the F pointer is used as the pAppData value for VFS
+** objects. We have to do this instead of letting pAppData point
+** directly at the finder-function since C90 rules prevent a void*
+** from be cast into a function pointer.
+**
+**
+** Each instance of this macro generates two objects:
+**
+** * A constant sqlite3_io_methods object call METHOD that has locking
+** methods CLOSE, LOCK, UNLOCK, CKRESLOCK.
+**
+** * An I/O method finder function called FINDER that returns a pointer
+** to the METHOD object in the previous bullet.
+*/
+#define IOMETHODS(FINDER,METHOD,VERSION,CLOSE,LOCK,UNLOCK,CKLOCK,SHMMAP) \
+static const sqlite3_io_methods METHOD = { \
+ VERSION, /* iVersion */ \
+ CLOSE, /* xClose */ \
+ unixRead, /* xRead */ \
+ unixWrite, /* xWrite */ \
+ unixTruncate, /* xTruncate */ \
+ unixSync, /* xSync */ \
+ unixFileSize, /* xFileSize */ \
+ LOCK, /* xLock */ \
+ UNLOCK, /* xUnlock */ \
+ CKLOCK, /* xCheckReservedLock */ \
+ unixFileControl, /* xFileControl */ \
+ unixSectorSize, /* xSectorSize */ \
+ unixDeviceCharacteristics, /* xDeviceCapabilities */ \
+ SHMMAP, /* xShmMap */ \
+ unixShmLock, /* xShmLock */ \
+ unixShmBarrier, /* xShmBarrier */ \
+ unixShmUnmap, /* xShmUnmap */ \
+ unixFetch, /* xFetch */ \
+ unixUnfetch, /* xUnfetch */ \
+}; \
+static const sqlite3_io_methods *FINDER##Impl(const char *z, unixFile *p){ \
+ UNUSED_PARAMETER(z); UNUSED_PARAMETER(p); \
+ return &METHOD; \
+} \
+static const sqlite3_io_methods *(*const FINDER)(const char*,unixFile *p) \
+ = FINDER##Impl;
+
+/*
+** Here are all of the sqlite3_io_methods objects for each of the
+** locking strategies. Functions that return pointers to these methods
+** are also created.
+*/
+IOMETHODS(
+ posixIoFinder, /* Finder function name */
+ posixIoMethods, /* sqlite3_io_methods object name */
+ 3, /* shared memory and mmap are enabled */
+ unixClose, /* xClose method */
+ unixLock, /* xLock method */
+ unixUnlock, /* xUnlock method */
+ unixCheckReservedLock, /* xCheckReservedLock method */
+ unixShmMap /* xShmMap method */
+)
+IOMETHODS(
+ nolockIoFinder, /* Finder function name */
+ nolockIoMethods, /* sqlite3_io_methods object name */
+ 3, /* shared memory and mmap are enabled */
+ nolockClose, /* xClose method */
+ nolockLock, /* xLock method */
+ nolockUnlock, /* xUnlock method */
+ nolockCheckReservedLock, /* xCheckReservedLock method */
+ 0 /* xShmMap method */
+)
+IOMETHODS(
+ dotlockIoFinder, /* Finder function name */
+ dotlockIoMethods, /* sqlite3_io_methods object name */
+ 1, /* shared memory is disabled */
+ dotlockClose, /* xClose method */
+ dotlockLock, /* xLock method */
+ dotlockUnlock, /* xUnlock method */
+ dotlockCheckReservedLock, /* xCheckReservedLock method */
+ 0 /* xShmMap method */
+)
+
+#if SQLITE_ENABLE_LOCKING_STYLE
+IOMETHODS(
+ flockIoFinder, /* Finder function name */
+ flockIoMethods, /* sqlite3_io_methods object name */
+ 1, /* shared memory is disabled */
+ flockClose, /* xClose method */
+ flockLock, /* xLock method */
+ flockUnlock, /* xUnlock method */
+ flockCheckReservedLock, /* xCheckReservedLock method */
+ 0 /* xShmMap method */
+)
+#endif
+
+#if OS_VXWORKS
+IOMETHODS(
+ semIoFinder, /* Finder function name */
+ semIoMethods, /* sqlite3_io_methods object name */
+ 1, /* shared memory is disabled */
+ semXClose, /* xClose method */
+ semXLock, /* xLock method */
+ semXUnlock, /* xUnlock method */
+ semXCheckReservedLock, /* xCheckReservedLock method */
+ 0 /* xShmMap method */
+)
+#endif
+
+#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE
+IOMETHODS(
+ afpIoFinder, /* Finder function name */
+ afpIoMethods, /* sqlite3_io_methods object name */
+ 1, /* shared memory is disabled */
+ afpClose, /* xClose method */
+ afpLock, /* xLock method */
+ afpUnlock, /* xUnlock method */
+ afpCheckReservedLock, /* xCheckReservedLock method */
+ 0 /* xShmMap method */
+)
+#endif
+
+/*
+** The proxy locking method is a "super-method" in the sense that it
+** opens secondary file descriptors for the conch and lock files and
+** it uses proxy, dot-file, AFP, and flock() locking methods on those
+** secondary files. For this reason, the division that implements
+** proxy locking is located much further down in the file. But we need
+** to go ahead and define the sqlite3_io_methods and finder function
+** for proxy locking here. So we forward declare the I/O methods.
+*/
+#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE
+static int proxyClose(sqlite3_file*);
+static int proxyLock(sqlite3_file*, int);
+static int proxyUnlock(sqlite3_file*, int);
+static int proxyCheckReservedLock(sqlite3_file*, int*);
+IOMETHODS(
+ proxyIoFinder, /* Finder function name */
+ proxyIoMethods, /* sqlite3_io_methods object name */
+ 1, /* shared memory is disabled */
+ proxyClose, /* xClose method */
+ proxyLock, /* xLock method */
+ proxyUnlock, /* xUnlock method */
+ proxyCheckReservedLock, /* xCheckReservedLock method */
+ 0 /* xShmMap method */
+)
+#endif
+
+/* nfs lockd on OSX 10.3+ doesn't clear write locks when a read lock is set */
+#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE
+IOMETHODS(
+ nfsIoFinder, /* Finder function name */
+ nfsIoMethods, /* sqlite3_io_methods object name */
+ 1, /* shared memory is disabled */
+ unixClose, /* xClose method */
+ unixLock, /* xLock method */
+ nfsUnlock, /* xUnlock method */
+ unixCheckReservedLock, /* xCheckReservedLock method */
+ 0 /* xShmMap method */
+)
+#endif
+
+#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE
+/*
+** This "finder" function attempts to determine the best locking strategy
+** for the database file "filePath". It then returns the sqlite3_io_methods
+** object that implements that strategy.
+**
+** This is for MacOSX only.
+*/
+static const sqlite3_io_methods *autolockIoFinderImpl(
+ const char *filePath, /* name of the database file */
+ unixFile *pNew /* open file object for the database file */
+){
+ static const struct Mapping {
+ const char *zFilesystem; /* Filesystem type name */
+ const sqlite3_io_methods *pMethods; /* Appropriate locking method */
+ } aMap[] = {
+ { "hfs", &posixIoMethods },
+ { "ufs", &posixIoMethods },
+ { "afpfs", &afpIoMethods },
+ { "smbfs", &afpIoMethods },
+ { "webdav", &nolockIoMethods },
+ { 0, 0 }
+ };
+ int i;
+ struct statfs fsInfo;
+ struct flock lockInfo;
+
+ if( !filePath ){
+ /* If filePath==NULL that means we are dealing with a transient file
+ ** that does not need to be locked. */
+ return &nolockIoMethods;
+ }
+ if( statfs(filePath, &fsInfo) != -1 ){
+ if( fsInfo.f_flags & MNT_RDONLY ){
+ return &nolockIoMethods;
+ }
+ for(i=0; aMap[i].zFilesystem; i++){
+ if( strcmp(fsInfo.f_fstypename, aMap[i].zFilesystem)==0 ){
+ return aMap[i].pMethods;
+ }
+ }
+ }
+
+ /* Default case. Handles, amongst others, "nfs".
+ ** Test byte-range lock using fcntl(). If the call succeeds,
+ ** assume that the file-system supports POSIX style locks.
+ */
+ lockInfo.l_len = 1;
+ lockInfo.l_start = 0;
+ lockInfo.l_whence = SEEK_SET;
+ lockInfo.l_type = F_RDLCK;
+ if( osFcntl(pNew->h, F_GETLK, &lockInfo)!=-1 ) {
+ if( strcmp(fsInfo.f_fstypename, "nfs")==0 ){
+ return &nfsIoMethods;
+ } else {
+ return &posixIoMethods;
+ }
+ }else{
+ return &dotlockIoMethods;
+ }
+}
+static const sqlite3_io_methods
+ *(*const autolockIoFinder)(const char*,unixFile*) = autolockIoFinderImpl;
+
+#endif /* defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE */
+
+#if OS_VXWORKS
+/*
+** This "finder" function for VxWorks checks to see if posix advisory
+** locking works. If it does, then that is what is used. If it does not
+** work, then fallback to named semaphore locking.
+*/
+static const sqlite3_io_methods *vxworksIoFinderImpl(
+ const char *filePath, /* name of the database file */
+ unixFile *pNew /* the open file object */
+){
+ struct flock lockInfo;
+
+ if( !filePath ){
+ /* If filePath==NULL that means we are dealing with a transient file
+ ** that does not need to be locked. */
+ return &nolockIoMethods;
+ }
+
+ /* Test if fcntl() is supported and use POSIX style locks.
+ ** Otherwise fall back to the named semaphore method.
+ */
+ lockInfo.l_len = 1;
+ lockInfo.l_start = 0;
+ lockInfo.l_whence = SEEK_SET;
+ lockInfo.l_type = F_RDLCK;
+ if( osFcntl(pNew->h, F_GETLK, &lockInfo)!=-1 ) {
+ return &posixIoMethods;
+ }else{
+ return &semIoMethods;
+ }
+}
+static const sqlite3_io_methods
+ *(*const vxworksIoFinder)(const char*,unixFile*) = vxworksIoFinderImpl;
+
+#endif /* OS_VXWORKS */
+
+/*
+** An abstract type for a pointer to an IO method finder function:
+*/
+typedef const sqlite3_io_methods *(*finder_type)(const char*,unixFile*);
+
+
+/****************************************************************************
+**************************** sqlite3_vfs methods ****************************
+**
+** This division contains the implementation of methods on the
+** sqlite3_vfs object.
+*/
+
+/*
+** Initialize the contents of the unixFile structure pointed to by pId.
+*/
+static int fillInUnixFile(
+ sqlite3_vfs *pVfs, /* Pointer to vfs object */
+ int h, /* Open file descriptor of file being opened */
+ sqlite3_file *pId, /* Write to the unixFile structure here */
+ const char *zFilename, /* Name of the file being opened */
+ int ctrlFlags /* Zero or more UNIXFILE_* values */
+){
+ const sqlite3_io_methods *pLockingStyle;
+ unixFile *pNew = (unixFile *)pId;
+ int rc = SQLITE_OK;
+
+ assert( pNew->pInode==NULL );
+
+ /* No locking occurs in temporary files */
+ assert( zFilename!=0 || (ctrlFlags & UNIXFILE_NOLOCK)!=0 );
+
+ OSTRACE(("OPEN %-3d %s\n", h, zFilename));
+ pNew->h = h;
+ pNew->pVfs = pVfs;
+ pNew->zPath = zFilename;
+ pNew->ctrlFlags = (u8)ctrlFlags;
+#if SQLITE_MAX_MMAP_SIZE>0
+ pNew->mmapSizeMax = sqlite3GlobalConfig.szMmap;
+#endif
+ if( sqlite3_uri_boolean(((ctrlFlags & UNIXFILE_URI) ? zFilename : 0),
+ "psow", SQLITE_POWERSAFE_OVERWRITE) ){
+ pNew->ctrlFlags |= UNIXFILE_PSOW;
+ }
+ if( strcmp(pVfs->zName,"unix-excl")==0 ){
+ pNew->ctrlFlags |= UNIXFILE_EXCL;
+ }
+
+#if OS_VXWORKS
+ pNew->pId = vxworksFindFileId(zFilename);
+ if( pNew->pId==0 ){
+ ctrlFlags |= UNIXFILE_NOLOCK;
+ rc = SQLITE_NOMEM_BKPT;
+ }
+#endif
+
+ if( ctrlFlags & UNIXFILE_NOLOCK ){
+ pLockingStyle = &nolockIoMethods;
+ }else{
+ pLockingStyle = (**(finder_type*)pVfs->pAppData)(zFilename, pNew);
+#if SQLITE_ENABLE_LOCKING_STYLE
+ /* Cache zFilename in the locking context (AFP and dotlock override) for
+ ** proxyLock activation is possible (remote proxy is based on db name)
+ ** zFilename remains valid until file is closed, to support */
+ pNew->lockingContext = (void*)zFilename;
+#endif
+ }
+
+ if( pLockingStyle == &posixIoMethods
+#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE
+ || pLockingStyle == &nfsIoMethods
+#endif
+ ){
+ unixEnterMutex();
+ rc = findInodeInfo(pNew, &pNew->pInode);
+ if( rc!=SQLITE_OK ){
+ /* If an error occurred in findInodeInfo(), close the file descriptor
+ ** immediately, before releasing the mutex. findInodeInfo() may fail
+ ** in two scenarios:
+ **
+ ** (a) A call to fstat() failed.
+ ** (b) A malloc failed.
+ **
+ ** Scenario (b) may only occur if the process is holding no other
+ ** file descriptors open on the same file. If there were other file
+ ** descriptors on this file, then no malloc would be required by
+ ** findInodeInfo(). If this is the case, it is quite safe to close
+ ** handle h - as it is guaranteed that no posix locks will be released
+ ** by doing so.
+ **
+ ** If scenario (a) caused the error then things are not so safe. The
+ ** implicit assumption here is that if fstat() fails, things are in
+ ** such bad shape that dropping a lock or two doesn't matter much.
+ */
+ robust_close(pNew, h, __LINE__);
+ h = -1;
+ }
+ unixLeaveMutex();
+ }
+
+#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)
+ else if( pLockingStyle == &afpIoMethods ){
+ /* AFP locking uses the file path so it needs to be included in
+ ** the afpLockingContext.
+ */
+ afpLockingContext *pCtx;
+ pNew->lockingContext = pCtx = sqlite3_malloc64( sizeof(*pCtx) );
+ if( pCtx==0 ){
+ rc = SQLITE_NOMEM_BKPT;
+ }else{
+ /* NB: zFilename exists and remains valid until the file is closed
+ ** according to requirement F11141. So we do not need to make a
+ ** copy of the filename. */
+ pCtx->dbPath = zFilename;
+ pCtx->reserved = 0;
+ srandomdev();
+ unixEnterMutex();
+ rc = findInodeInfo(pNew, &pNew->pInode);
+ if( rc!=SQLITE_OK ){
+ sqlite3_free(pNew->lockingContext);
+ robust_close(pNew, h, __LINE__);
+ h = -1;
+ }
+ unixLeaveMutex();
+ }
+ }
+#endif
+
+ else if( pLockingStyle == &dotlockIoMethods ){
+ /* Dotfile locking uses the file path so it needs to be included in
+ ** the dotlockLockingContext
+ */
+ char *zLockFile;
+ int nFilename;
+ assert( zFilename!=0 );
+ nFilename = (int)strlen(zFilename) + 6;
+ zLockFile = (char *)sqlite3_malloc64(nFilename);
+ if( zLockFile==0 ){
+ rc = SQLITE_NOMEM_BKPT;
+ }else{
+ sqlite3_snprintf(nFilename, zLockFile, "%s" DOTLOCK_SUFFIX, zFilename);
+ }
+ pNew->lockingContext = zLockFile;
+ }
+
+#if OS_VXWORKS
+ else if( pLockingStyle == &semIoMethods ){
+ /* Named semaphore locking uses the file path so it needs to be
+ ** included in the semLockingContext
+ */
+ unixEnterMutex();
+ rc = findInodeInfo(pNew, &pNew->pInode);
+ if( (rc==SQLITE_OK) && (pNew->pInode->pSem==NULL) ){
+ char *zSemName = pNew->pInode->aSemName;
+ int n;
+ sqlite3_snprintf(MAX_PATHNAME, zSemName, "/%s.sem",
+ pNew->pId->zCanonicalName);
+ for( n=1; zSemName[n]; n++ )
+ if( zSemName[n]=='/' ) zSemName[n] = '_';
+ pNew->pInode->pSem = sem_open(zSemName, O_CREAT, 0666, 1);
+ if( pNew->pInode->pSem == SEM_FAILED ){
+ rc = SQLITE_NOMEM_BKPT;
+ pNew->pInode->aSemName[0] = '\0';
+ }
+ }
+ unixLeaveMutex();
+ }
+#endif
+
+ storeLastErrno(pNew, 0);
+#if OS_VXWORKS
+ if( rc!=SQLITE_OK ){
+ if( h>=0 ) robust_close(pNew, h, __LINE__);
+ h = -1;
+ osUnlink(zFilename);
+ pNew->ctrlFlags |= UNIXFILE_DELETE;
+ }
+#endif
+ if( rc!=SQLITE_OK ){
+ if( h>=0 ) robust_close(pNew, h, __LINE__);
+ }else{
+ pId->pMethods = pLockingStyle;
+ OpenCounter(+1);
+ verifyDbFile(pNew);
+ }
+ return rc;
+}
+
+/*
+** Directories to consider for temp files.
+*/
+static const char *azTempDirs[] = {
+ 0,
+ 0,
+ "/var/tmp",
+ "/usr/tmp",
+ "/tmp",
+ "."
+};
+
+/*
+** Initialize first two members of azTempDirs[] array.
+*/
+static void unixTempFileInit(void){
+ azTempDirs[0] = getenv("SQLITE_TMPDIR");
+ azTempDirs[1] = getenv("TMPDIR");
+}
+
+/*
+** Return the name of a directory in which to put temporary files.
+** If no suitable temporary file directory can be found, return NULL.
+*/
+static const char *unixTempFileDir(void){
+ unsigned int i = 0;
+ struct stat buf;
+ const char *zDir = sqlite3_temp_directory;
+
+ while(1){
+ if( zDir!=0
+ && osStat(zDir, &buf)==0
+ && S_ISDIR(buf.st_mode)
+ && osAccess(zDir, 03)==0
+ ){
+ return zDir;
+ }
+ if( i>=sizeof(azTempDirs)/sizeof(azTempDirs[0]) ) break;
+ zDir = azTempDirs[i++];
+ }
+ return 0;
+}
+
+/*
+** Create a temporary file name in zBuf. zBuf must be allocated
+** by the calling process and must be big enough to hold at least
+** pVfs->mxPathname bytes.
+*/
+static int unixGetTempname(int nBuf, char *zBuf){
+ const char *zDir;
+ int iLimit = 0;
+ int rc = SQLITE_OK;
+
+ /* It's odd to simulate an io-error here, but really this is just
+ ** using the io-error infrastructure to test that SQLite handles this
+ ** function failing.
+ */
+ zBuf[0] = 0;
+ SimulateIOError( return SQLITE_IOERR );
+
+ sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
+ zDir = unixTempFileDir();
+ if( zDir==0 ){
+ rc = SQLITE_IOERR_GETTEMPPATH;
+ }else{
+ do{
+ u64 r;
+ sqlite3_randomness(sizeof(r), &r);
+ assert( nBuf>2 );
+ zBuf[nBuf-2] = 0;
+ sqlite3_snprintf(nBuf, zBuf, "%s/"SQLITE_TEMP_FILE_PREFIX"%llx%c",
+ zDir, r, 0);
+ if( zBuf[nBuf-2]!=0 || (iLimit++)>10 ){
+ rc = SQLITE_ERROR;
+ break;
+ }
+ }while( osAccess(zBuf,0)==0 );
+ }
+ sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
+ return rc;
+}
+
+#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)
+/*
+** Routine to transform a unixFile into a proxy-locking unixFile.
+** Implementation in the proxy-lock division, but used by unixOpen()
+** if SQLITE_PREFER_PROXY_LOCKING is defined.
+*/
+static int proxyTransformUnixFile(unixFile*, const char*);
+#endif
+
+/*
+** Search for an unused file descriptor that was opened on the database
+** file (not a journal or super-journal file) identified by pathname
+** zPath with SQLITE_OPEN_XXX flags matching those passed as the second
+** argument to this function.
+**
+** Such a file descriptor may exist if a database connection was closed
+** but the associated file descriptor could not be closed because some
+** other file descriptor open on the same file is holding a file-lock.
+** Refer to comments in the unixClose() function and the lengthy comment
+** describing "Posix Advisory Locking" at the start of this file for
+** further details. Also, ticket #4018.
+**
+** If a suitable file descriptor is found, then it is returned. If no
+** such file descriptor is located, -1 is returned.
+*/
+static UnixUnusedFd *findReusableFd(const char *zPath, int flags){
+ UnixUnusedFd *pUnused = 0;
+
+ /* Do not search for an unused file descriptor on vxworks. Not because
+ ** vxworks would not benefit from the change (it might, we're not sure),
+ ** but because no way to test it is currently available. It is better
+ ** not to risk breaking vxworks support for the sake of such an obscure
+ ** feature. */
+#if !OS_VXWORKS
+ struct stat sStat; /* Results of stat() call */
+
+ unixEnterMutex();
+
+ /* A stat() call may fail for various reasons. If this happens, it is
+ ** almost certain that an open() call on the same path will also fail.
+ ** For this reason, if an error occurs in the stat() call here, it is
+ ** ignored and -1 is returned. The caller will try to open a new file
+ ** descriptor on the same path, fail, and return an error to SQLite.
+ **
+ ** Even if a subsequent open() call does succeed, the consequences of
+ ** not searching for a reusable file descriptor are not dire. */
+ if( inodeList!=0 && 0==osStat(zPath, &sStat) ){
+ unixInodeInfo *pInode;
+
+ pInode = inodeList;
+ while( pInode && (pInode->fileId.dev!=sStat.st_dev
+ || pInode->fileId.ino!=(u64)sStat.st_ino) ){
+ pInode = pInode->pNext;
+ }
+ if( pInode ){
+ UnixUnusedFd **pp;
+ assert( sqlite3_mutex_notheld(pInode->pLockMutex) );
+ sqlite3_mutex_enter(pInode->pLockMutex);
+ flags &= (SQLITE_OPEN_READONLY|SQLITE_OPEN_READWRITE);
+ for(pp=&pInode->pUnused; *pp && (*pp)->flags!=flags; pp=&((*pp)->pNext));
+ pUnused = *pp;
+ if( pUnused ){
+ *pp = pUnused->pNext;
+ }
+ sqlite3_mutex_leave(pInode->pLockMutex);
+ }
+ }
+ unixLeaveMutex();
+#endif /* if !OS_VXWORKS */
+ return pUnused;
+}
+
+/*
+** Find the mode, uid and gid of file zFile.
+*/
+static int getFileMode(
+ const char *zFile, /* File name */
+ mode_t *pMode, /* OUT: Permissions of zFile */
+ uid_t *pUid, /* OUT: uid of zFile. */
+ gid_t *pGid /* OUT: gid of zFile. */
+){
+ struct stat sStat; /* Output of stat() on database file */
+ int rc = SQLITE_OK;
+ if( 0==osStat(zFile, &sStat) ){
+ *pMode = sStat.st_mode & 0777;
+ *pUid = sStat.st_uid;
+ *pGid = sStat.st_gid;
+ }else{
+ rc = SQLITE_IOERR_FSTAT;
+ }
+ return rc;
+}
+
+/*
+** This function is called by unixOpen() to determine the unix permissions
+** to create new files with. If no error occurs, then SQLITE_OK is returned
+** and a value suitable for passing as the third argument to open(2) is
+** written to *pMode. If an IO error occurs, an SQLite error code is
+** returned and the value of *pMode is not modified.
+**
+** In most cases, this routine sets *pMode to 0, which will become
+** an indication to robust_open() to create the file using
+** SQLITE_DEFAULT_FILE_PERMISSIONS adjusted by the umask.
+** But if the file being opened is a WAL or regular journal file, then
+** this function queries the file-system for the permissions on the
+** corresponding database file and sets *pMode to this value. Whenever
+** possible, WAL and journal files are created using the same permissions
+** as the associated database file.
+**
+** If the SQLITE_ENABLE_8_3_NAMES option is enabled, then the
+** original filename is unavailable. But 8_3_NAMES is only used for
+** FAT filesystems and permissions do not matter there, so just use
+** the default permissions. In 8_3_NAMES mode, leave *pMode set to zero.
+*/
+static int findCreateFileMode(
+ const char *zPath, /* Path of file (possibly) being created */
+ int flags, /* Flags passed as 4th argument to xOpen() */
+ mode_t *pMode, /* OUT: Permissions to open file with */
+ uid_t *pUid, /* OUT: uid to set on the file */
+ gid_t *pGid /* OUT: gid to set on the file */
+){
+ int rc = SQLITE_OK; /* Return Code */
+ *pMode = 0;
+ *pUid = 0;
+ *pGid = 0;
+ if( flags & (SQLITE_OPEN_WAL|SQLITE_OPEN_MAIN_JOURNAL) ){
+ char zDb[MAX_PATHNAME+1]; /* Database file path */
+ int nDb; /* Number of valid bytes in zDb */
+
+ /* zPath is a path to a WAL or journal file. The following block derives
+ ** the path to the associated database file from zPath. This block handles
+ ** the following naming conventions:
+ **
+ ** "<path to db>-journal"
+ ** "<path to db>-wal"
+ ** "<path to db>-journalNN"
+ ** "<path to db>-walNN"
+ **
+ ** where NN is a decimal number. The NN naming schemes are
+ ** used by the test_multiplex.c module.
+ **
+ ** In normal operation, the journal file name will always contain
+ ** a '-' character. However in 8+3 filename mode, or if a corrupt
+ ** rollback journal specifies a super-journal with a goofy name, then
+ ** the '-' might be missing or the '-' might be the first character in
+ ** the filename. In that case, just return SQLITE_OK with *pMode==0.
+ */
+ nDb = sqlite3Strlen30(zPath) - 1;
+ while( nDb>0 && zPath[nDb]!='.' ){
+ if( zPath[nDb]=='-' ){
+ memcpy(zDb, zPath, nDb);
+ zDb[nDb] = '\0';
+ rc = getFileMode(zDb, pMode, pUid, pGid);
+ break;
+ }
+ nDb--;
+ }
+ }else if( flags & SQLITE_OPEN_DELETEONCLOSE ){
+ *pMode = 0600;
+ }else if( flags & SQLITE_OPEN_URI ){
+ /* If this is a main database file and the file was opened using a URI
+ ** filename, check for the "modeof" parameter. If present, interpret
+ ** its value as a filename and try to copy the mode, uid and gid from
+ ** that file. */
+ const char *z = sqlite3_uri_parameter(zPath, "modeof");
+ if( z ){
+ rc = getFileMode(z, pMode, pUid, pGid);
+ }
+ }
+ return rc;
+}
+
+/*
+** Open the file zPath.
+**
+** Previously, the SQLite OS layer used three functions in place of this
+** one:
+**
+** sqlite3OsOpenReadWrite();
+** sqlite3OsOpenReadOnly();
+** sqlite3OsOpenExclusive();
+**
+** These calls correspond to the following combinations of flags:
+**
+** ReadWrite() -> (READWRITE | CREATE)
+** ReadOnly() -> (READONLY)
+** OpenExclusive() -> (READWRITE | CREATE | EXCLUSIVE)
+**
+** The old OpenExclusive() accepted a boolean argument - "delFlag". If
+** true, the file was configured to be automatically deleted when the
+** file handle closed. To achieve the same effect using this new
+** interface, add the DELETEONCLOSE flag to those specified above for
+** OpenExclusive().
+*/
+static int unixOpen(
+ sqlite3_vfs *pVfs, /* The VFS for which this is the xOpen method */
+ const char *zPath, /* Pathname of file to be opened */
+ sqlite3_file *pFile, /* The file descriptor to be filled in */
+ int flags, /* Input flags to control the opening */
+ int *pOutFlags /* Output flags returned to SQLite core */
+){
+ unixFile *p = (unixFile *)pFile;
+ int fd = -1; /* File descriptor returned by open() */
+ int openFlags = 0; /* Flags to pass to open() */
+ int eType = flags&0x0FFF00; /* Type of file to open */
+ int noLock; /* True to omit locking primitives */
+ int rc = SQLITE_OK; /* Function Return Code */
+ int ctrlFlags = 0; /* UNIXFILE_* flags */
+
+ int isExclusive = (flags & SQLITE_OPEN_EXCLUSIVE);
+ int isDelete = (flags & SQLITE_OPEN_DELETEONCLOSE);
+ int isCreate = (flags & SQLITE_OPEN_CREATE);
+ int isReadonly = (flags & SQLITE_OPEN_READONLY);
+ int isReadWrite = (flags & SQLITE_OPEN_READWRITE);
+#if SQLITE_ENABLE_LOCKING_STYLE
+ int isAutoProxy = (flags & SQLITE_OPEN_AUTOPROXY);
+#endif
+#if defined(__APPLE__) || SQLITE_ENABLE_LOCKING_STYLE
+ struct statfs fsInfo;
+#endif
+
+ /* If creating a super- or main-file journal, this function will open
+ ** a file-descriptor on the directory too. The first time unixSync()
+ ** is called the directory file descriptor will be fsync()ed and close()d.
+ */
+ int isNewJrnl = (isCreate && (
+ eType==SQLITE_OPEN_SUPER_JOURNAL
+ || eType==SQLITE_OPEN_MAIN_JOURNAL
+ || eType==SQLITE_OPEN_WAL
+ ));
+
+ /* If argument zPath is a NULL pointer, this function is required to open
+ ** a temporary file. Use this buffer to store the file name in.
+ */
+ char zTmpname[MAX_PATHNAME+2];
+ const char *zName = zPath;
+
+ /* Check the following statements are true:
+ **
+ ** (a) Exactly one of the READWRITE and READONLY flags must be set, and
+ ** (b) if CREATE is set, then READWRITE must also be set, and
+ ** (c) if EXCLUSIVE is set, then CREATE must also be set.
+ ** (d) if DELETEONCLOSE is set, then CREATE must also be set.
+ */
+ assert((isReadonly==0 || isReadWrite==0) && (isReadWrite || isReadonly));
+ assert(isCreate==0 || isReadWrite);
+ assert(isExclusive==0 || isCreate);
+ assert(isDelete==0 || isCreate);
+
+ /* The main DB, main journal, WAL file and super-journal are never
+ ** automatically deleted. Nor are they ever temporary files. */
+ assert( (!isDelete && zName) || eType!=SQLITE_OPEN_MAIN_DB );
+ assert( (!isDelete && zName) || eType!=SQLITE_OPEN_MAIN_JOURNAL );
+ assert( (!isDelete && zName) || eType!=SQLITE_OPEN_SUPER_JOURNAL );
+ assert( (!isDelete && zName) || eType!=SQLITE_OPEN_WAL );
+
+ /* Assert that the upper layer has set one of the "file-type" flags. */
+ assert( eType==SQLITE_OPEN_MAIN_DB || eType==SQLITE_OPEN_TEMP_DB
+ || eType==SQLITE_OPEN_MAIN_JOURNAL || eType==SQLITE_OPEN_TEMP_JOURNAL
+ || eType==SQLITE_OPEN_SUBJOURNAL || eType==SQLITE_OPEN_SUPER_JOURNAL
+ || eType==SQLITE_OPEN_TRANSIENT_DB || eType==SQLITE_OPEN_WAL
+ );
+
+ /* Detect a pid change and reset the PRNG. There is a race condition
+ ** here such that two or more threads all trying to open databases at
+ ** the same instant might all reset the PRNG. But multiple resets
+ ** are harmless.
+ */
+ if( randomnessPid!=osGetpid(0) ){
+ randomnessPid = osGetpid(0);
+ sqlite3_randomness(0,0);
+ }
+ memset(p, 0, sizeof(unixFile));
+
+#ifdef SQLITE_ASSERT_NO_FILES
+ /* Applications that never read or write a persistent disk files */
+ assert( zName==0 );
+#endif
+
+ if( eType==SQLITE_OPEN_MAIN_DB ){
+ UnixUnusedFd *pUnused;
+ pUnused = findReusableFd(zName, flags);
+ if( pUnused ){
+ fd = pUnused->fd;
+ }else{
+ pUnused = sqlite3_malloc64(sizeof(*pUnused));
+ if( !pUnused ){
+ return SQLITE_NOMEM_BKPT;
+ }
+ }
+ p->pPreallocatedUnused = pUnused;
+
+ /* Database filenames are double-zero terminated if they are not
+ ** URIs with parameters. Hence, they can always be passed into
+ ** sqlite3_uri_parameter(). */
+ assert( (flags & SQLITE_OPEN_URI) || zName[strlen(zName)+1]==0 );
+
+ }else if( !zName ){
+ /* If zName is NULL, the upper layer is requesting a temp file. */
+ assert(isDelete && !isNewJrnl);
+ rc = unixGetTempname(pVfs->mxPathname, zTmpname);
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+ zName = zTmpname;
+
+ /* Generated temporary filenames are always double-zero terminated
+ ** for use by sqlite3_uri_parameter(). */
+ assert( zName[strlen(zName)+1]==0 );
+ }
+
+ /* Determine the value of the flags parameter passed to POSIX function
+ ** open(). These must be calculated even if open() is not called, as
+ ** they may be stored as part of the file handle and used by the
+ ** 'conch file' locking functions later on. */
+ if( isReadonly ) openFlags |= O_RDONLY;
+ if( isReadWrite ) openFlags |= O_RDWR;
+ if( isCreate ) openFlags |= O_CREAT;
+ if( isExclusive ) openFlags |= (O_EXCL|O_NOFOLLOW);
+ openFlags |= (O_LARGEFILE|O_BINARY|O_NOFOLLOW);
+
+ if( fd<0 ){
+ mode_t openMode; /* Permissions to create file with */
+ uid_t uid; /* Userid for the file */
+ gid_t gid; /* Groupid for the file */
+ rc = findCreateFileMode(zName, flags, &openMode, &uid, &gid);
+ if( rc!=SQLITE_OK ){
+ assert( !p->pPreallocatedUnused );
+ assert( eType==SQLITE_OPEN_WAL || eType==SQLITE_OPEN_MAIN_JOURNAL );
+ return rc;
+ }
+ fd = robust_open(zName, openFlags, openMode);
+ OSTRACE(("OPENX %-3d %s 0%o\n", fd, zName, openFlags));
+ assert( !isExclusive || (openFlags & O_CREAT)!=0 );
+ if( fd<0 ){
+ if( isNewJrnl && errno==EACCES && osAccess(zName, F_OK) ){
+ /* If unable to create a journal because the directory is not
+ ** writable, change the error code to indicate that. */
+ rc = SQLITE_READONLY_DIRECTORY;
+ }else if( errno!=EISDIR && isReadWrite ){
+ /* Failed to open the file for read/write access. Try read-only. */
+ UnixUnusedFd *pReadonly = 0;
+ flags &= ~(SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE);
+ openFlags &= ~(O_RDWR|O_CREAT);
+ flags |= SQLITE_OPEN_READONLY;
+ openFlags |= O_RDONLY;
+ isReadonly = 1;
+ pReadonly = findReusableFd(zName, flags);
+ if( pReadonly ){
+ fd = pReadonly->fd;
+ sqlite3_free(pReadonly);
+ }else{
+ fd = robust_open(zName, openFlags, openMode);
+ }
+ }
+ }
+ if( fd<0 ){
+ int rc2 = unixLogError(SQLITE_CANTOPEN_BKPT, "open", zName);
+ if( rc==SQLITE_OK ) rc = rc2;
+ goto open_finished;
+ }
+
+ /* The owner of the rollback journal or WAL file should always be the
+ ** same as the owner of the database file. Try to ensure that this is
+ ** the case. The chown() system call will be a no-op if the current
+ ** process lacks root privileges, be we should at least try. Without
+ ** this step, if a root process opens a database file, it can leave
+ ** behinds a journal/WAL that is owned by root and hence make the
+ ** database inaccessible to unprivileged processes.
+ **
+ ** If openMode==0, then that means uid and gid are not set correctly
+ ** (probably because SQLite is configured to use 8+3 filename mode) and
+ ** in that case we do not want to attempt the chown().
+ */
+ if( openMode && (flags & (SQLITE_OPEN_WAL|SQLITE_OPEN_MAIN_JOURNAL))!=0 ){
+ robustFchown(fd, uid, gid);
+ }
+ }
+ assert( fd>=0 );
+ if( pOutFlags ){
+ *pOutFlags = flags;
+ }
+
+ if( p->pPreallocatedUnused ){
+ p->pPreallocatedUnused->fd = fd;
+ p->pPreallocatedUnused->flags =
+ flags & (SQLITE_OPEN_READONLY|SQLITE_OPEN_READWRITE);
+ }
+
+ if( isDelete ){
+#if OS_VXWORKS
+ zPath = zName;
+#elif defined(SQLITE_UNLINK_AFTER_CLOSE)
+ zPath = sqlite3_mprintf("%s", zName);
+ if( zPath==0 ){
+ robust_close(p, fd, __LINE__);
+ return SQLITE_NOMEM_BKPT;
+ }
+#else
+ osUnlink(zName);
+#endif
+ }
+#if SQLITE_ENABLE_LOCKING_STYLE
+ else{
+ p->openFlags = openFlags;
+ }
+#endif
+
+#if defined(__APPLE__) || SQLITE_ENABLE_LOCKING_STYLE
+ if( fstatfs(fd, &fsInfo) == -1 ){
+ storeLastErrno(p, errno);
+ robust_close(p, fd, __LINE__);
+ return SQLITE_IOERR_ACCESS;
+ }
+ if (0 == strncmp("msdos", fsInfo.f_fstypename, 5)) {
+ ((unixFile*)pFile)->fsFlags |= SQLITE_FSFLAGS_IS_MSDOS;
+ }
+ if (0 == strncmp("exfat", fsInfo.f_fstypename, 5)) {
+ ((unixFile*)pFile)->fsFlags |= SQLITE_FSFLAGS_IS_MSDOS;
+ }
+#endif
+
+ /* Set up appropriate ctrlFlags */
+ if( isDelete ) ctrlFlags |= UNIXFILE_DELETE;
+ if( isReadonly ) ctrlFlags |= UNIXFILE_RDONLY;
+ noLock = eType!=SQLITE_OPEN_MAIN_DB;
+ if( noLock ) ctrlFlags |= UNIXFILE_NOLOCK;
+ if( isNewJrnl ) ctrlFlags |= UNIXFILE_DIRSYNC;
+ if( flags & SQLITE_OPEN_URI ) ctrlFlags |= UNIXFILE_URI;
+
+#if SQLITE_ENABLE_LOCKING_STYLE
+#if SQLITE_PREFER_PROXY_LOCKING
+ isAutoProxy = 1;
+#endif
+ if( isAutoProxy && (zPath!=NULL) && (!noLock) && pVfs->xOpen ){
+ char *envforce = getenv("SQLITE_FORCE_PROXY_LOCKING");
+ int useProxy = 0;
+
+ /* SQLITE_FORCE_PROXY_LOCKING==1 means force always use proxy, 0 means
+ ** never use proxy, NULL means use proxy for non-local files only. */
+ if( envforce!=NULL ){
+ useProxy = atoi(envforce)>0;
+ }else{
+ useProxy = !(fsInfo.f_flags&MNT_LOCAL);
+ }
+ if( useProxy ){
+ rc = fillInUnixFile(pVfs, fd, pFile, zPath, ctrlFlags);
+ if( rc==SQLITE_OK ){
+ rc = proxyTransformUnixFile((unixFile*)pFile, ":auto:");
+ if( rc!=SQLITE_OK ){
+ /* Use unixClose to clean up the resources added in fillInUnixFile
+ ** and clear all the structure's references. Specifically,
+ ** pFile->pMethods will be NULL so sqlite3OsClose will be a no-op
+ */
+ unixClose(pFile);
+ return rc;
+ }
+ }
+ goto open_finished;
+ }
+ }
+#endif
+
+ assert( zPath==0 || zPath[0]=='/'
+ || eType==SQLITE_OPEN_SUPER_JOURNAL || eType==SQLITE_OPEN_MAIN_JOURNAL
+ );
+ rc = fillInUnixFile(pVfs, fd, pFile, zPath, ctrlFlags);
+
+open_finished:
+ if( rc!=SQLITE_OK ){
+ sqlite3_free(p->pPreallocatedUnused);
+ }
+ return rc;
+}
+
+
+/*
+** Delete the file at zPath. If the dirSync argument is true, fsync()
+** the directory after deleting the file.
+*/
+static int unixDelete(
+ sqlite3_vfs *NotUsed, /* VFS containing this as the xDelete method */
+ const char *zPath, /* Name of file to be deleted */
+ int dirSync /* If true, fsync() directory after deleting file */
+){
+ int rc = SQLITE_OK;
+ UNUSED_PARAMETER(NotUsed);
+ SimulateIOError(return SQLITE_IOERR_DELETE);
+ if( osUnlink(zPath)==(-1) ){
+ if( errno==ENOENT
+#if OS_VXWORKS
+ || osAccess(zPath,0)!=0
+#endif
+ ){
+ rc = SQLITE_IOERR_DELETE_NOENT;
+ }else{
+ rc = unixLogError(SQLITE_IOERR_DELETE, "unlink", zPath);
+ }
+ return rc;
+ }
+#ifndef SQLITE_DISABLE_DIRSYNC
+ if( (dirSync & 1)!=0 ){
+ int fd;
+ rc = osOpenDirectory(zPath, &fd);
+ if( rc==SQLITE_OK ){
+ if( full_fsync(fd,0,0) ){
+ rc = unixLogError(SQLITE_IOERR_DIR_FSYNC, "fsync", zPath);
+ }
+ robust_close(0, fd, __LINE__);
+ }else{
+ assert( rc==SQLITE_CANTOPEN );
+ rc = SQLITE_OK;
+ }
+ }
+#endif
+ return rc;
+}
+
+/*
+** Test the existence of or access permissions of file zPath. The
+** test performed depends on the value of flags:
+**
+** SQLITE_ACCESS_EXISTS: Return 1 if the file exists
+** SQLITE_ACCESS_READWRITE: Return 1 if the file is read and writable.
+** SQLITE_ACCESS_READONLY: Return 1 if the file is readable.
+**
+** Otherwise return 0.
+*/
+static int unixAccess(
+ sqlite3_vfs *NotUsed, /* The VFS containing this xAccess method */
+ const char *zPath, /* Path of the file to examine */
+ int flags, /* What do we want to learn about the zPath file? */
+ int *pResOut /* Write result boolean here */
+){
+ UNUSED_PARAMETER(NotUsed);
+ SimulateIOError( return SQLITE_IOERR_ACCESS; );
+ assert( pResOut!=0 );
+
+ /* The spec says there are three possible values for flags. But only
+ ** two of them are actually used */
+ assert( flags==SQLITE_ACCESS_EXISTS || flags==SQLITE_ACCESS_READWRITE );
+
+ if( flags==SQLITE_ACCESS_EXISTS ){
+ struct stat buf;
+ *pResOut = 0==osStat(zPath, &buf) &&
+ (!S_ISREG(buf.st_mode) || buf.st_size>0);
+ }else{
+ *pResOut = osAccess(zPath, W_OK|R_OK)==0;
+ }
+ return SQLITE_OK;
+}
+
+/*
+** A pathname under construction
+*/
+typedef struct DbPath DbPath;
+struct DbPath {
+ int rc; /* Non-zero following any error */
+ int nSymlink; /* Number of symlinks resolved */
+ char *zOut; /* Write the pathname here */
+ int nOut; /* Bytes of space available to zOut[] */
+ int nUsed; /* Bytes of zOut[] currently being used */
+};
+
+/* Forward reference */
+static void appendAllPathElements(DbPath*,const char*);
+
+/*
+** Append a single path element to the DbPath under construction
+*/
+static void appendOnePathElement(
+ DbPath *pPath, /* Path under construction, to which to append zName */
+ const char *zName, /* Name to append to pPath. Not zero-terminated */
+ int nName /* Number of significant bytes in zName */
+){
+ assert( nName>0 );
+ assert( zName!=0 );
+ if( zName[0]=='.' ){
+ if( nName==1 ) return;
+ if( zName[1]=='.' && nName==2 ){
+ if( pPath->nUsed>1 ){
+ assert( pPath->zOut[0]=='/' );
+ while( pPath->zOut[--pPath->nUsed]!='/' ){}
+ }
+ return;
+ }
+ }
+ if( pPath->nUsed + nName + 2 >= pPath->nOut ){
+ pPath->rc = SQLITE_ERROR;
+ return;
+ }
+ pPath->zOut[pPath->nUsed++] = '/';
+ memcpy(&pPath->zOut[pPath->nUsed], zName, nName);
+ pPath->nUsed += nName;
+#if defined(HAVE_READLINK) && defined(HAVE_LSTAT)
+ if( pPath->rc==SQLITE_OK ){
+ const char *zIn;
+ struct stat buf;
+ pPath->zOut[pPath->nUsed] = 0;
+ zIn = pPath->zOut;
+ if( osLstat(zIn, &buf)!=0 ){
+ if( errno!=ENOENT ){
+ pPath->rc = unixLogError(SQLITE_CANTOPEN_BKPT, "lstat", zIn);
+ }
+ }else if( S_ISLNK(buf.st_mode) ){
+ ssize_t got;
+ char zLnk[SQLITE_MAX_PATHLEN+2];
+ if( pPath->nSymlink++ > SQLITE_MAX_SYMLINK ){
+ pPath->rc = SQLITE_CANTOPEN_BKPT;
+ return;
+ }
+ got = osReadlink(zIn, zLnk, sizeof(zLnk)-2);
+ if( got<=0 || got>=(ssize_t)sizeof(zLnk)-2 ){
+ pPath->rc = unixLogError(SQLITE_CANTOPEN_BKPT, "readlink", zIn);
+ return;
+ }
+ zLnk[got] = 0;
+ if( zLnk[0]=='/' ){
+ pPath->nUsed = 0;
+ }else{
+ pPath->nUsed -= nName + 1;
+ }
+ appendAllPathElements(pPath, zLnk);
+ }
+ }
+#endif
+}
+
+/*
+** Append all path elements in zPath to the DbPath under construction.
+*/
+static void appendAllPathElements(
+ DbPath *pPath, /* Path under construction, to which to append zName */
+ const char *zPath /* Path to append to pPath. Is zero-terminated */
+){
+ int i = 0;
+ int j = 0;
+ do{
+ while( zPath[i] && zPath[i]!='/' ){ i++; }
+ if( i>j ){
+ appendOnePathElement(pPath, &zPath[j], i-j);
+ }
+ j = i+1;
+ }while( zPath[i++] );
+}
+
+/*
+** Turn a relative pathname into a full pathname. The relative path
+** is stored as a nul-terminated string in the buffer pointed to by
+** zPath.
+**
+** zOut points to a buffer of at least sqlite3_vfs.mxPathname bytes
+** (in this case, MAX_PATHNAME bytes). The full-path is written to
+** this buffer before returning.
+*/
+static int unixFullPathname(
+ sqlite3_vfs *pVfs, /* Pointer to vfs object */
+ const char *zPath, /* Possibly relative input path */
+ int nOut, /* Size of output buffer in bytes */
+ char *zOut /* Output buffer */
+){
+ DbPath path;
+ UNUSED_PARAMETER(pVfs);
+ path.rc = 0;
+ path.nUsed = 0;
+ path.nSymlink = 0;
+ path.nOut = nOut;
+ path.zOut = zOut;
+ if( zPath[0]!='/' ){
+ char zPwd[SQLITE_MAX_PATHLEN+2];
+ if( osGetcwd(zPwd, sizeof(zPwd)-2)==0 ){
+ return unixLogError(SQLITE_CANTOPEN_BKPT, "getcwd", zPath);
+ }
+ appendAllPathElements(&path, zPwd);
+ }
+ appendAllPathElements(&path, zPath);
+ zOut[path.nUsed] = 0;
+ if( path.rc || path.nUsed<2 ) return SQLITE_CANTOPEN_BKPT;
+ if( path.nSymlink ) return SQLITE_OK_SYMLINK;
+ return SQLITE_OK;
+}
+
+#ifndef SQLITE_OMIT_LOAD_EXTENSION
+/*
+** Interfaces for opening a shared library, finding entry points
+** within the shared library, and closing the shared library.
+*/
+#include <dlfcn.h>
+static void *unixDlOpen(sqlite3_vfs *NotUsed, const char *zFilename){
+ UNUSED_PARAMETER(NotUsed);
+ return dlopen(zFilename, RTLD_NOW | RTLD_GLOBAL);
+}
+
+/*
+** SQLite calls this function immediately after a call to unixDlSym() or
+** unixDlOpen() fails (returns a null pointer). If a more detailed error
+** message is available, it is written to zBufOut. If no error message
+** is available, zBufOut is left unmodified and SQLite uses a default
+** error message.
+*/
+static void unixDlError(sqlite3_vfs *NotUsed, int nBuf, char *zBufOut){
+ const char *zErr;
+ UNUSED_PARAMETER(NotUsed);
+ unixEnterMutex();
+ zErr = dlerror();
+ if( zErr ){
+ sqlite3_snprintf(nBuf, zBufOut, "%s", zErr);
+ }
+ unixLeaveMutex();
+}
+static void (*unixDlSym(sqlite3_vfs *NotUsed, void *p, const char*zSym))(void){
+ /*
+ ** GCC with -pedantic-errors says that C90 does not allow a void* to be
+ ** cast into a pointer to a function. And yet the library dlsym() routine
+ ** returns a void* which is really a pointer to a function. So how do we
+ ** use dlsym() with -pedantic-errors?
+ **
+ ** Variable x below is defined to be a pointer to a function taking
+ ** parameters void* and const char* and returning a pointer to a function.
+ ** We initialize x by assigning it a pointer to the dlsym() function.
+ ** (That assignment requires a cast.) Then we call the function that
+ ** x points to.
+ **
+ ** This work-around is unlikely to work correctly on any system where
+ ** you really cannot cast a function pointer into void*. But then, on the
+ ** other hand, dlsym() will not work on such a system either, so we have
+ ** not really lost anything.
+ */
+ void (*(*x)(void*,const char*))(void);
+ UNUSED_PARAMETER(NotUsed);
+ x = (void(*(*)(void*,const char*))(void))dlsym;
+ return (*x)(p, zSym);
+}
+static void unixDlClose(sqlite3_vfs *NotUsed, void *pHandle){
+ UNUSED_PARAMETER(NotUsed);
+ dlclose(pHandle);
+}
+#else /* if SQLITE_OMIT_LOAD_EXTENSION is defined: */
+ #define unixDlOpen 0
+ #define unixDlError 0
+ #define unixDlSym 0
+ #define unixDlClose 0
+#endif
+
+/*
+** Write nBuf bytes of random data to the supplied buffer zBuf.
+*/
+static int unixRandomness(sqlite3_vfs *NotUsed, int nBuf, char *zBuf){
+ UNUSED_PARAMETER(NotUsed);
+ assert((size_t)nBuf>=(sizeof(time_t)+sizeof(int)));
+
+ /* We have to initialize zBuf to prevent valgrind from reporting
+ ** errors. The reports issued by valgrind are incorrect - we would
+ ** prefer that the randomness be increased by making use of the
+ ** uninitialized space in zBuf - but valgrind errors tend to worry
+ ** some users. Rather than argue, it seems easier just to initialize
+ ** the whole array and silence valgrind, even if that means less randomness
+ ** in the random seed.
+ **
+ ** When testing, initializing zBuf[] to zero is all we do. That means
+ ** that we always use the same random number sequence. This makes the
+ ** tests repeatable.
+ */
+ memset(zBuf, 0, nBuf);
+ randomnessPid = osGetpid(0);
+#if !defined(SQLITE_TEST) && !defined(SQLITE_OMIT_RANDOMNESS)
+ {
+ int fd, got;
+ fd = robust_open("/dev/urandom", O_RDONLY, 0);
+ if( fd<0 ){
+ time_t t;
+ time(&t);
+ memcpy(zBuf, &t, sizeof(t));
+ memcpy(&zBuf[sizeof(t)], &randomnessPid, sizeof(randomnessPid));
+ assert( sizeof(t)+sizeof(randomnessPid)<=(size_t)nBuf );
+ nBuf = sizeof(t) + sizeof(randomnessPid);
+ }else{
+ do{ got = osRead(fd, zBuf, nBuf); }while( got<0 && errno==EINTR );
+ robust_close(0, fd, __LINE__);
+ }
+ }
+#endif
+ return nBuf;
+}
+
+
+/*
+** Sleep for a little while. Return the amount of time slept.
+** The argument is the number of microseconds we want to sleep.
+** The return value is the number of microseconds of sleep actually
+** requested from the underlying operating system, a number which
+** might be greater than or equal to the argument, but not less
+** than the argument.
+*/
+static int unixSleep(sqlite3_vfs *NotUsed, int microseconds){
+#if !defined(HAVE_NANOSLEEP) || HAVE_NANOSLEEP+0
+ struct timespec sp;
+ sp.tv_sec = microseconds / 1000000;
+ sp.tv_nsec = (microseconds % 1000000) * 1000;
+
+ /* Almost all modern unix systems support nanosleep(). But if you are
+ ** compiling for one of the rare exceptions, you can use
+ ** -DHAVE_NANOSLEEP=0 (perhaps in conjuction with -DHAVE_USLEEP if
+ ** usleep() is available) in order to bypass the use of nanosleep() */
+ nanosleep(&sp, NULL);
+
+ UNUSED_PARAMETER(NotUsed);
+ return microseconds;
+#elif defined(HAVE_USLEEP) && HAVE_USLEEP
+ if( microseconds>=1000000 ) sleep(microseconds/1000000);
+ if( microseconds%1000000 ) usleep(microseconds%1000000);
+ UNUSED_PARAMETER(NotUsed);
+ return microseconds;
+#else
+ int seconds = (microseconds+999999)/1000000;
+ sleep(seconds);
+ UNUSED_PARAMETER(NotUsed);
+ return seconds*1000000;
+#endif
+}
+
+/*
+** The following variable, if set to a non-zero value, is interpreted as
+** the number of seconds since 1970 and is used to set the result of
+** sqlite3OsCurrentTime() during testing.
+*/
+#ifdef SQLITE_TEST
+SQLITE_API int sqlite3_current_time = 0; /* Fake system time in seconds since 1970. */
+#endif
+
+/*
+** Find the current time (in Universal Coordinated Time). Write into *piNow
+** the current time and date as a Julian Day number times 86_400_000. In
+** other words, write into *piNow the number of milliseconds since the Julian
+** epoch of noon in Greenwich on November 24, 4714 B.C according to the
+** proleptic Gregorian calendar.
+**
+** On success, return SQLITE_OK. Return SQLITE_ERROR if the time and date
+** cannot be found.
+*/
+static int unixCurrentTimeInt64(sqlite3_vfs *NotUsed, sqlite3_int64 *piNow){
+ static const sqlite3_int64 unixEpoch = 24405875*(sqlite3_int64)8640000;
+ int rc = SQLITE_OK;
+#if defined(NO_GETTOD)
+ time_t t;
+ time(&t);
+ *piNow = ((sqlite3_int64)t)*1000 + unixEpoch;
+#elif OS_VXWORKS
+ struct timespec sNow;
+ clock_gettime(CLOCK_REALTIME, &sNow);
+ *piNow = unixEpoch + 1000*(sqlite3_int64)sNow.tv_sec + sNow.tv_nsec/1000000;
+#else
+ struct timeval sNow;
+ (void)gettimeofday(&sNow, 0); /* Cannot fail given valid arguments */
+ *piNow = unixEpoch + 1000*(sqlite3_int64)sNow.tv_sec + sNow.tv_usec/1000;
+#endif
+
+#ifdef SQLITE_TEST
+ if( sqlite3_current_time ){
+ *piNow = 1000*(sqlite3_int64)sqlite3_current_time + unixEpoch;
+ }
+#endif
+ UNUSED_PARAMETER(NotUsed);
+ return rc;
+}
+
+#ifndef SQLITE_OMIT_DEPRECATED
+/*
+** Find the current time (in Universal Coordinated Time). Write the
+** current time and date as a Julian Day number into *prNow and
+** return 0. Return 1 if the time and date cannot be found.
+*/
+static int unixCurrentTime(sqlite3_vfs *NotUsed, double *prNow){
+ sqlite3_int64 i = 0;
+ int rc;
+ UNUSED_PARAMETER(NotUsed);
+ rc = unixCurrentTimeInt64(0, &i);
+ *prNow = i/86400000.0;
+ return rc;
+}
+#else
+# define unixCurrentTime 0
+#endif
+
+/*
+** The xGetLastError() method is designed to return a better
+** low-level error message when operating-system problems come up
+** during SQLite operation. Only the integer return code is currently
+** used.
+*/
+static int unixGetLastError(sqlite3_vfs *NotUsed, int NotUsed2, char *NotUsed3){
+ UNUSED_PARAMETER(NotUsed);
+ UNUSED_PARAMETER(NotUsed2);
+ UNUSED_PARAMETER(NotUsed3);
+ return errno;
+}
+
+
+/*
+************************ End of sqlite3_vfs methods ***************************
+******************************************************************************/
+
+/******************************************************************************
+************************** Begin Proxy Locking ********************************
+**
+** Proxy locking is a "uber-locking-method" in this sense: It uses the
+** other locking methods on secondary lock files. Proxy locking is a
+** meta-layer over top of the primitive locking implemented above. For
+** this reason, the division that implements of proxy locking is deferred
+** until late in the file (here) after all of the other I/O methods have
+** been defined - so that the primitive locking methods are available
+** as services to help with the implementation of proxy locking.
+**
+****
+**
+** The default locking schemes in SQLite use byte-range locks on the
+** database file to coordinate safe, concurrent access by multiple readers
+** and writers [http://sqlite.org/lockingv3.html]. The five file locking
+** states (UNLOCKED, PENDING, SHARED, RESERVED, EXCLUSIVE) are implemented
+** as POSIX read & write locks over fixed set of locations (via fsctl),
+** on AFP and SMB only exclusive byte-range locks are available via fsctl
+** with _IOWR('z', 23, struct ByteRangeLockPB2) to track the same 5 states.
+** To simulate a F_RDLCK on the shared range, on AFP a randomly selected
+** address in the shared range is taken for a SHARED lock, the entire
+** shared range is taken for an EXCLUSIVE lock):
+**
+** PENDING_BYTE 0x40000000
+** RESERVED_BYTE 0x40000001
+** SHARED_RANGE 0x40000002 -> 0x40000200
+**
+** This works well on the local file system, but shows a nearly 100x
+** slowdown in read performance on AFP because the AFP client disables
+** the read cache when byte-range locks are present. Enabling the read
+** cache exposes a cache coherency problem that is present on all OS X
+** supported network file systems. NFS and AFP both observe the
+** close-to-open semantics for ensuring cache coherency
+** [http://nfs.sourceforge.net/#faq_a8], which does not effectively
+** address the requirements for concurrent database access by multiple
+** readers and writers
+** [http://www.nabble.com/SQLite-on-NFS-cache-coherency-td15655701.html].
+**
+** To address the performance and cache coherency issues, proxy file locking
+** changes the way database access is controlled by limiting access to a
+** single host at a time and moving file locks off of the database file
+** and onto a proxy file on the local file system.
+**
+**
+** Using proxy locks
+** -----------------
+**
+** C APIs
+**
+** sqlite3_file_control(db, dbname, SQLITE_FCNTL_SET_LOCKPROXYFILE,
+** <proxy_path> | ":auto:");
+** sqlite3_file_control(db, dbname, SQLITE_FCNTL_GET_LOCKPROXYFILE,
+** &<proxy_path>);
+**
+**
+** SQL pragmas
+**
+** PRAGMA [database.]lock_proxy_file=<proxy_path> | :auto:
+** PRAGMA [database.]lock_proxy_file
+**
+** Specifying ":auto:" means that if there is a conch file with a matching
+** host ID in it, the proxy path in the conch file will be used, otherwise
+** a proxy path based on the user's temp dir
+** (via confstr(_CS_DARWIN_USER_TEMP_DIR,...)) will be used and the
+** actual proxy file name is generated from the name and path of the
+** database file. For example:
+**
+** For database path "/Users/me/foo.db"
+** The lock path will be "<tmpdir>/sqliteplocks/_Users_me_foo.db:auto:")
+**
+** Once a lock proxy is configured for a database connection, it can not
+** be removed, however it may be switched to a different proxy path via
+** the above APIs (assuming the conch file is not being held by another
+** connection or process).
+**
+**
+** How proxy locking works
+** -----------------------
+**
+** Proxy file locking relies primarily on two new supporting files:
+**
+** * conch file to limit access to the database file to a single host
+** at a time
+**
+** * proxy file to act as a proxy for the advisory locks normally
+** taken on the database
+**
+** The conch file - to use a proxy file, sqlite must first "hold the conch"
+** by taking an sqlite-style shared lock on the conch file, reading the
+** contents and comparing the host's unique host ID (see below) and lock
+** proxy path against the values stored in the conch. The conch file is
+** stored in the same directory as the database file and the file name
+** is patterned after the database file name as ".<databasename>-conch".
+** If the conch file does not exist, or its contents do not match the
+** host ID and/or proxy path, then the lock is escalated to an exclusive
+** lock and the conch file contents is updated with the host ID and proxy
+** path and the lock is downgraded to a shared lock again. If the conch
+** is held by another process (with a shared lock), the exclusive lock
+** will fail and SQLITE_BUSY is returned.
+**
+** The proxy file - a single-byte file used for all advisory file locks
+** normally taken on the database file. This allows for safe sharing
+** of the database file for multiple readers and writers on the same
+** host (the conch ensures that they all use the same local lock file).
+**
+** Requesting the lock proxy does not immediately take the conch, it is
+** only taken when the first request to lock database file is made.
+** This matches the semantics of the traditional locking behavior, where
+** opening a connection to a database file does not take a lock on it.
+** The shared lock and an open file descriptor are maintained until
+** the connection to the database is closed.
+**
+** The proxy file and the lock file are never deleted so they only need
+** to be created the first time they are used.
+**
+** Configuration options
+** ---------------------
+**
+** SQLITE_PREFER_PROXY_LOCKING
+**
+** Database files accessed on non-local file systems are
+** automatically configured for proxy locking, lock files are
+** named automatically using the same logic as
+** PRAGMA lock_proxy_file=":auto:"
+**
+** SQLITE_PROXY_DEBUG
+**
+** Enables the logging of error messages during host id file
+** retrieval and creation
+**
+** LOCKPROXYDIR
+**
+** Overrides the default directory used for lock proxy files that
+** are named automatically via the ":auto:" setting
+**
+** SQLITE_DEFAULT_PROXYDIR_PERMISSIONS
+**
+** Permissions to use when creating a directory for storing the
+** lock proxy files, only used when LOCKPROXYDIR is not set.
+**
+**
+** As mentioned above, when compiled with SQLITE_PREFER_PROXY_LOCKING,
+** setting the environment variable SQLITE_FORCE_PROXY_LOCKING to 1 will
+** force proxy locking to be used for every database file opened, and 0
+** will force automatic proxy locking to be disabled for all database
+** files (explicitly calling the SQLITE_FCNTL_SET_LOCKPROXYFILE pragma or
+** sqlite_file_control API is not affected by SQLITE_FORCE_PROXY_LOCKING).
+*/
+
+/*
+** Proxy locking is only available on MacOSX
+*/
+#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE
+
+/*
+** The proxyLockingContext has the path and file structures for the remote
+** and local proxy files in it
+*/
+typedef struct proxyLockingContext proxyLockingContext;
+struct proxyLockingContext {
+ unixFile *conchFile; /* Open conch file */
+ char *conchFilePath; /* Name of the conch file */
+ unixFile *lockProxy; /* Open proxy lock file */
+ char *lockProxyPath; /* Name of the proxy lock file */
+ char *dbPath; /* Name of the open file */
+ int conchHeld; /* 1 if the conch is held, -1 if lockless */
+ int nFails; /* Number of conch taking failures */
+ void *oldLockingContext; /* Original lockingcontext to restore on close */
+ sqlite3_io_methods const *pOldMethod; /* Original I/O methods for close */
+};
+
+/*
+** The proxy lock file path for the database at dbPath is written into lPath,
+** which must point to valid, writable memory large enough for a maxLen length
+** file path.
+*/
+static int proxyGetLockPath(const char *dbPath, char *lPath, size_t maxLen){
+ int len;
+ int dbLen;
+ int i;
+
+#ifdef LOCKPROXYDIR
+ len = strlcpy(lPath, LOCKPROXYDIR, maxLen);
+#else
+# ifdef _CS_DARWIN_USER_TEMP_DIR
+ {
+ if( !confstr(_CS_DARWIN_USER_TEMP_DIR, lPath, maxLen) ){
+ OSTRACE(("GETLOCKPATH failed %s errno=%d pid=%d\n",
+ lPath, errno, osGetpid(0)));
+ return SQLITE_IOERR_LOCK;
+ }
+ len = strlcat(lPath, "sqliteplocks", maxLen);
+ }
+# else
+ len = strlcpy(lPath, "/tmp/", maxLen);
+# endif
+#endif
+
+ if( lPath[len-1]!='/' ){
+ len = strlcat(lPath, "/", maxLen);
+ }
+
+ /* transform the db path to a unique cache name */
+ dbLen = (int)strlen(dbPath);
+ for( i=0; i<dbLen && (i+len+7)<(int)maxLen; i++){
+ char c = dbPath[i];
+ lPath[i+len] = (c=='/')?'_':c;
+ }
+ lPath[i+len]='\0';
+ strlcat(lPath, ":auto:", maxLen);
+ OSTRACE(("GETLOCKPATH proxy lock path=%s pid=%d\n", lPath, osGetpid(0)));
+ return SQLITE_OK;
+}
+
+/*
+ ** Creates the lock file and any missing directories in lockPath
+ */
+static int proxyCreateLockPath(const char *lockPath){
+ int i, len;
+ char buf[MAXPATHLEN];
+ int start = 0;
+
+ assert(lockPath!=NULL);
+ /* try to create all the intermediate directories */
+ len = (int)strlen(lockPath);
+ buf[0] = lockPath[0];
+ for( i=1; i<len; i++ ){
+ if( lockPath[i] == '/' && (i - start > 0) ){
+ /* only mkdir if leaf dir != "." or "/" or ".." */
+ if( i-start>2 || (i-start==1 && buf[start] != '.' && buf[start] != '/')
+ || (i-start==2 && buf[start] != '.' && buf[start+1] != '.') ){
+ buf[i]='\0';
+ if( osMkdir(buf, SQLITE_DEFAULT_PROXYDIR_PERMISSIONS) ){
+ int err=errno;
+ if( err!=EEXIST ) {
+ OSTRACE(("CREATELOCKPATH FAILED creating %s, "
+ "'%s' proxy lock path=%s pid=%d\n",
+ buf, strerror(err), lockPath, osGetpid(0)));
+ return err;
+ }
+ }
+ }
+ start=i+1;
+ }
+ buf[i] = lockPath[i];
+ }
+ OSTRACE(("CREATELOCKPATH proxy lock path=%s pid=%d\n",lockPath,osGetpid(0)));
+ return 0;
+}
+
+/*
+** Create a new VFS file descriptor (stored in memory obtained from
+** sqlite3_malloc) and open the file named "path" in the file descriptor.
+**
+** The caller is responsible not only for closing the file descriptor
+** but also for freeing the memory associated with the file descriptor.
+*/
+static int proxyCreateUnixFile(
+ const char *path, /* path for the new unixFile */
+ unixFile **ppFile, /* unixFile created and returned by ref */
+ int islockfile /* if non zero missing dirs will be created */
+) {
+ int fd = -1;
+ unixFile *pNew;
+ int rc = SQLITE_OK;
+ int openFlags = O_RDWR | O_CREAT | O_NOFOLLOW;
+ sqlite3_vfs dummyVfs;
+ int terrno = 0;
+ UnixUnusedFd *pUnused = NULL;
+
+ /* 1. first try to open/create the file
+ ** 2. if that fails, and this is a lock file (not-conch), try creating
+ ** the parent directories and then try again.
+ ** 3. if that fails, try to open the file read-only
+ ** otherwise return BUSY (if lock file) or CANTOPEN for the conch file
+ */
+ pUnused = findReusableFd(path, openFlags);
+ if( pUnused ){
+ fd = pUnused->fd;
+ }else{
+ pUnused = sqlite3_malloc64(sizeof(*pUnused));
+ if( !pUnused ){
+ return SQLITE_NOMEM_BKPT;
+ }
+ }
+ if( fd<0 ){
+ fd = robust_open(path, openFlags, 0);
+ terrno = errno;
+ if( fd<0 && errno==ENOENT && islockfile ){
+ if( proxyCreateLockPath(path) == SQLITE_OK ){
+ fd = robust_open(path, openFlags, 0);
+ }
+ }
+ }
+ if( fd<0 ){
+ openFlags = O_RDONLY | O_NOFOLLOW;
+ fd = robust_open(path, openFlags, 0);
+ terrno = errno;
+ }
+ if( fd<0 ){
+ if( islockfile ){
+ return SQLITE_BUSY;
+ }
+ switch (terrno) {
+ case EACCES:
+ return SQLITE_PERM;
+ case EIO:
+ return SQLITE_IOERR_LOCK; /* even though it is the conch */
+ default:
+ return SQLITE_CANTOPEN_BKPT;
+ }
+ }
+
+ pNew = (unixFile *)sqlite3_malloc64(sizeof(*pNew));
+ if( pNew==NULL ){
+ rc = SQLITE_NOMEM_BKPT;
+ goto end_create_proxy;
+ }
+ memset(pNew, 0, sizeof(unixFile));
+ pNew->openFlags = openFlags;
+ memset(&dummyVfs, 0, sizeof(dummyVfs));
+ dummyVfs.pAppData = (void*)&autolockIoFinder;
+ dummyVfs.zName = "dummy";
+ pUnused->fd = fd;
+ pUnused->flags = openFlags;
+ pNew->pPreallocatedUnused = pUnused;
+
+ rc = fillInUnixFile(&dummyVfs, fd, (sqlite3_file*)pNew, path, 0);
+ if( rc==SQLITE_OK ){
+ *ppFile = pNew;
+ return SQLITE_OK;
+ }
+end_create_proxy:
+ robust_close(pNew, fd, __LINE__);
+ sqlite3_free(pNew);
+ sqlite3_free(pUnused);
+ return rc;
+}
+
+#ifdef SQLITE_TEST
+/* simulate multiple hosts by creating unique hostid file paths */
+SQLITE_API int sqlite3_hostid_num = 0;
+#endif
+
+#define PROXY_HOSTIDLEN 16 /* conch file host id length */
+
+#if HAVE_GETHOSTUUID
+/* Not always defined in the headers as it ought to be */
+extern int gethostuuid(uuid_t id, const struct timespec *wait);
+#endif
+
+/* get the host ID via gethostuuid(), pHostID must point to PROXY_HOSTIDLEN
+** bytes of writable memory.
+*/
+static int proxyGetHostID(unsigned char *pHostID, int *pError){
+ assert(PROXY_HOSTIDLEN == sizeof(uuid_t));
+ memset(pHostID, 0, PROXY_HOSTIDLEN);
+#if HAVE_GETHOSTUUID
+ {
+ struct timespec timeout = {1, 0}; /* 1 sec timeout */
+ if( gethostuuid(pHostID, &timeout) ){
+ int err = errno;
+ if( pError ){
+ *pError = err;
+ }
+ return SQLITE_IOERR;
+ }
+ }
+#else
+ UNUSED_PARAMETER(pError);
+#endif
+#ifdef SQLITE_TEST
+ /* simulate multiple hosts by creating unique hostid file paths */
+ if( sqlite3_hostid_num != 0){
+ pHostID[0] = (char)(pHostID[0] + (char)(sqlite3_hostid_num & 0xFF));
+ }
+#endif
+
+ return SQLITE_OK;
+}
+
+/* The conch file contains the header, host id and lock file path
+ */
+#define PROXY_CONCHVERSION 2 /* 1-byte header, 16-byte host id, path */
+#define PROXY_HEADERLEN 1 /* conch file header length */
+#define PROXY_PATHINDEX (PROXY_HEADERLEN+PROXY_HOSTIDLEN)
+#define PROXY_MAXCONCHLEN (PROXY_HEADERLEN+PROXY_HOSTIDLEN+MAXPATHLEN)
+
+/*
+** Takes an open conch file, copies the contents to a new path and then moves
+** it back. The newly created file's file descriptor is assigned to the
+** conch file structure and finally the original conch file descriptor is
+** closed. Returns zero if successful.
+*/
+static int proxyBreakConchLock(unixFile *pFile, uuid_t myHostID){
+ proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext;
+ unixFile *conchFile = pCtx->conchFile;
+ char tPath[MAXPATHLEN];
+ char buf[PROXY_MAXCONCHLEN];
+ char *cPath = pCtx->conchFilePath;
+ size_t readLen = 0;
+ size_t pathLen = 0;
+ char errmsg[64] = "";
+ int fd = -1;
+ int rc = -1;
+ UNUSED_PARAMETER(myHostID);
+
+ /* create a new path by replace the trailing '-conch' with '-break' */
+ pathLen = strlcpy(tPath, cPath, MAXPATHLEN);
+ if( pathLen>MAXPATHLEN || pathLen<6 ||
+ (strlcpy(&tPath[pathLen-5], "break", 6) != 5) ){
+ sqlite3_snprintf(sizeof(errmsg),errmsg,"path error (len %d)",(int)pathLen);
+ goto end_breaklock;
+ }
+ /* read the conch content */
+ readLen = osPread(conchFile->h, buf, PROXY_MAXCONCHLEN, 0);
+ if( readLen<PROXY_PATHINDEX ){
+ sqlite3_snprintf(sizeof(errmsg),errmsg,"read error (len %d)",(int)readLen);
+ goto end_breaklock;
+ }
+ /* write it out to the temporary break file */
+ fd = robust_open(tPath, (O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW), 0);
+ if( fd<0 ){
+ sqlite3_snprintf(sizeof(errmsg), errmsg, "create failed (%d)", errno);
+ goto end_breaklock;
+ }
+ if( osPwrite(fd, buf, readLen, 0) != (ssize_t)readLen ){
+ sqlite3_snprintf(sizeof(errmsg), errmsg, "write failed (%d)", errno);
+ goto end_breaklock;
+ }
+ if( rename(tPath, cPath) ){
+ sqlite3_snprintf(sizeof(errmsg), errmsg, "rename failed (%d)", errno);
+ goto end_breaklock;
+ }
+ rc = 0;
+ fprintf(stderr, "broke stale lock on %s\n", cPath);
+ robust_close(pFile, conchFile->h, __LINE__);
+ conchFile->h = fd;
+ conchFile->openFlags = O_RDWR | O_CREAT;
+
+end_breaklock:
+ if( rc ){
+ if( fd>=0 ){
+ osUnlink(tPath);
+ robust_close(pFile, fd, __LINE__);
+ }
+ fprintf(stderr, "failed to break stale lock on %s, %s\n", cPath, errmsg);
+ }
+ return rc;
+}
+
+/* Take the requested lock on the conch file and break a stale lock if the
+** host id matches.
+*/
+static int proxyConchLock(unixFile *pFile, uuid_t myHostID, int lockType){
+ proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext;
+ unixFile *conchFile = pCtx->conchFile;
+ int rc = SQLITE_OK;
+ int nTries = 0;
+ struct timespec conchModTime;
+
+ memset(&conchModTime, 0, sizeof(conchModTime));
+ do {
+ rc = conchFile->pMethod->xLock((sqlite3_file*)conchFile, lockType);
+ nTries ++;
+ if( rc==SQLITE_BUSY ){
+ /* If the lock failed (busy):
+ * 1st try: get the mod time of the conch, wait 0.5s and try again.
+ * 2nd try: fail if the mod time changed or host id is different, wait
+ * 10 sec and try again
+ * 3rd try: break the lock unless the mod time has changed.
+ */
+ struct stat buf;
+ if( osFstat(conchFile->h, &buf) ){
+ storeLastErrno(pFile, errno);
+ return SQLITE_IOERR_LOCK;
+ }
+
+ if( nTries==1 ){
+ conchModTime = buf.st_mtimespec;
+ unixSleep(0,500000); /* wait 0.5 sec and try the lock again*/
+ continue;
+ }
+
+ assert( nTries>1 );
+ if( conchModTime.tv_sec != buf.st_mtimespec.tv_sec ||
+ conchModTime.tv_nsec != buf.st_mtimespec.tv_nsec ){
+ return SQLITE_BUSY;
+ }
+
+ if( nTries==2 ){
+ char tBuf[PROXY_MAXCONCHLEN];
+ int len = osPread(conchFile->h, tBuf, PROXY_MAXCONCHLEN, 0);
+ if( len<0 ){
+ storeLastErrno(pFile, errno);
+ return SQLITE_IOERR_LOCK;
+ }
+ if( len>PROXY_PATHINDEX && tBuf[0]==(char)PROXY_CONCHVERSION){
+ /* don't break the lock if the host id doesn't match */
+ if( 0!=memcmp(&tBuf[PROXY_HEADERLEN], myHostID, PROXY_HOSTIDLEN) ){
+ return SQLITE_BUSY;
+ }
+ }else{
+ /* don't break the lock on short read or a version mismatch */
+ return SQLITE_BUSY;
+ }
+ unixSleep(0,10000000); /* wait 10 sec and try the lock again */
+ continue;
+ }
+
+ assert( nTries==3 );
+ if( 0==proxyBreakConchLock(pFile, myHostID) ){
+ rc = SQLITE_OK;
+ if( lockType==EXCLUSIVE_LOCK ){
+ rc = conchFile->pMethod->xLock((sqlite3_file*)conchFile, SHARED_LOCK);
+ }
+ if( !rc ){
+ rc = conchFile->pMethod->xLock((sqlite3_file*)conchFile, lockType);
+ }
+ }
+ }
+ } while( rc==SQLITE_BUSY && nTries<3 );
+
+ return rc;
+}
+
+/* Takes the conch by taking a shared lock and read the contents conch, if
+** lockPath is non-NULL, the host ID and lock file path must match. A NULL
+** lockPath means that the lockPath in the conch file will be used if the
+** host IDs match, or a new lock path will be generated automatically
+** and written to the conch file.
+*/
+static int proxyTakeConch(unixFile *pFile){
+ proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext;
+
+ if( pCtx->conchHeld!=0 ){
+ return SQLITE_OK;
+ }else{
+ unixFile *conchFile = pCtx->conchFile;
+ uuid_t myHostID;
+ int pError = 0;
+ char readBuf[PROXY_MAXCONCHLEN];
+ char lockPath[MAXPATHLEN];
+ char *tempLockPath = NULL;
+ int rc = SQLITE_OK;
+ int createConch = 0;
+ int hostIdMatch = 0;
+ int readLen = 0;
+ int tryOldLockPath = 0;
+ int forceNewLockPath = 0;
+
+ OSTRACE(("TAKECONCH %d for %s pid=%d\n", conchFile->h,
+ (pCtx->lockProxyPath ? pCtx->lockProxyPath : ":auto:"),
+ osGetpid(0)));
+
+ rc = proxyGetHostID(myHostID, &pError);
+ if( (rc&0xff)==SQLITE_IOERR ){
+ storeLastErrno(pFile, pError);
+ goto end_takeconch;
+ }
+ rc = proxyConchLock(pFile, myHostID, SHARED_LOCK);
+ if( rc!=SQLITE_OK ){
+ goto end_takeconch;
+ }
+ /* read the existing conch file */
+ readLen = seekAndRead((unixFile*)conchFile, 0, readBuf, PROXY_MAXCONCHLEN);
+ if( readLen<0 ){
+ /* I/O error: lastErrno set by seekAndRead */
+ storeLastErrno(pFile, conchFile->lastErrno);
+ rc = SQLITE_IOERR_READ;
+ goto end_takeconch;
+ }else if( readLen<=(PROXY_HEADERLEN+PROXY_HOSTIDLEN) ||
+ readBuf[0]!=(char)PROXY_CONCHVERSION ){
+ /* a short read or version format mismatch means we need to create a new
+ ** conch file.
+ */
+ createConch = 1;
+ }
+ /* if the host id matches and the lock path already exists in the conch
+ ** we'll try to use the path there, if we can't open that path, we'll
+ ** retry with a new auto-generated path
+ */
+ do { /* in case we need to try again for an :auto: named lock file */
+
+ if( !createConch && !forceNewLockPath ){
+ hostIdMatch = !memcmp(&readBuf[PROXY_HEADERLEN], myHostID,
+ PROXY_HOSTIDLEN);
+ /* if the conch has data compare the contents */
+ if( !pCtx->lockProxyPath ){
+ /* for auto-named local lock file, just check the host ID and we'll
+ ** use the local lock file path that's already in there
+ */
+ if( hostIdMatch ){
+ size_t pathLen = (readLen - PROXY_PATHINDEX);
+
+ if( pathLen>=MAXPATHLEN ){
+ pathLen=MAXPATHLEN-1;
+ }
+ memcpy(lockPath, &readBuf[PROXY_PATHINDEX], pathLen);
+ lockPath[pathLen] = 0;
+ tempLockPath = lockPath;
+ tryOldLockPath = 1;
+ /* create a copy of the lock path if the conch is taken */
+ goto end_takeconch;
+ }
+ }else if( hostIdMatch
+ && !strncmp(pCtx->lockProxyPath, &readBuf[PROXY_PATHINDEX],
+ readLen-PROXY_PATHINDEX)
+ ){
+ /* conch host and lock path match */
+ goto end_takeconch;
+ }
+ }
+
+ /* if the conch isn't writable and doesn't match, we can't take it */
+ if( (conchFile->openFlags&O_RDWR) == 0 ){
+ rc = SQLITE_BUSY;
+ goto end_takeconch;
+ }
+
+ /* either the conch didn't match or we need to create a new one */
+ if( !pCtx->lockProxyPath ){
+ proxyGetLockPath(pCtx->dbPath, lockPath, MAXPATHLEN);
+ tempLockPath = lockPath;
+ /* create a copy of the lock path _only_ if the conch is taken */
+ }
+
+ /* update conch with host and path (this will fail if other process
+ ** has a shared lock already), if the host id matches, use the big
+ ** stick.
+ */
+ futimes(conchFile->h, NULL);
+ if( hostIdMatch && !createConch ){
+ if( conchFile->pInode && conchFile->pInode->nShared>1 ){
+ /* We are trying for an exclusive lock but another thread in this
+ ** same process is still holding a shared lock. */
+ rc = SQLITE_BUSY;
+ } else {
+ rc = proxyConchLock(pFile, myHostID, EXCLUSIVE_LOCK);
+ }
+ }else{
+ rc = proxyConchLock(pFile, myHostID, EXCLUSIVE_LOCK);
+ }
+ if( rc==SQLITE_OK ){
+ char writeBuffer[PROXY_MAXCONCHLEN];
+ int writeSize = 0;
+
+ writeBuffer[0] = (char)PROXY_CONCHVERSION;
+ memcpy(&writeBuffer[PROXY_HEADERLEN], myHostID, PROXY_HOSTIDLEN);
+ if( pCtx->lockProxyPath!=NULL ){
+ strlcpy(&writeBuffer[PROXY_PATHINDEX], pCtx->lockProxyPath,
+ MAXPATHLEN);
+ }else{
+ strlcpy(&writeBuffer[PROXY_PATHINDEX], tempLockPath, MAXPATHLEN);
+ }
+ writeSize = PROXY_PATHINDEX + strlen(&writeBuffer[PROXY_PATHINDEX]);
+ robust_ftruncate(conchFile->h, writeSize);
+ rc = unixWrite((sqlite3_file *)conchFile, writeBuffer, writeSize, 0);
+ full_fsync(conchFile->h,0,0);
+ /* If we created a new conch file (not just updated the contents of a
+ ** valid conch file), try to match the permissions of the database
+ */
+ if( rc==SQLITE_OK && createConch ){
+ struct stat buf;
+ int err = osFstat(pFile->h, &buf);
+ if( err==0 ){
+ mode_t cmode = buf.st_mode&(S_IRUSR|S_IWUSR | S_IRGRP|S_IWGRP |
+ S_IROTH|S_IWOTH);
+ /* try to match the database file R/W permissions, ignore failure */
+#ifndef SQLITE_PROXY_DEBUG
+ osFchmod(conchFile->h, cmode);
+#else
+ do{
+ rc = osFchmod(conchFile->h, cmode);
+ }while( rc==(-1) && errno==EINTR );
+ if( rc!=0 ){
+ int code = errno;
+ fprintf(stderr, "fchmod %o FAILED with %d %s\n",
+ cmode, code, strerror(code));
+ } else {
+ fprintf(stderr, "fchmod %o SUCCEDED\n",cmode);
+ }
+ }else{
+ int code = errno;
+ fprintf(stderr, "STAT FAILED[%d] with %d %s\n",
+ err, code, strerror(code));
+#endif
+ }
+ }
+ }
+ conchFile->pMethod->xUnlock((sqlite3_file*)conchFile, SHARED_LOCK);
+
+ end_takeconch:
+ OSTRACE(("TRANSPROXY: CLOSE %d\n", pFile->h));
+ if( rc==SQLITE_OK && pFile->openFlags ){
+ int fd;
+ if( pFile->h>=0 ){
+ robust_close(pFile, pFile->h, __LINE__);
+ }
+ pFile->h = -1;
+ fd = robust_open(pCtx->dbPath, pFile->openFlags, 0);
+ OSTRACE(("TRANSPROXY: OPEN %d\n", fd));
+ if( fd>=0 ){
+ pFile->h = fd;
+ }else{
+ rc=SQLITE_CANTOPEN_BKPT; /* SQLITE_BUSY? proxyTakeConch called
+ during locking */
+ }
+ }
+ if( rc==SQLITE_OK && !pCtx->lockProxy ){
+ char *path = tempLockPath ? tempLockPath : pCtx->lockProxyPath;
+ rc = proxyCreateUnixFile(path, &pCtx->lockProxy, 1);
+ if( rc!=SQLITE_OK && rc!=SQLITE_NOMEM && tryOldLockPath ){
+ /* we couldn't create the proxy lock file with the old lock file path
+ ** so try again via auto-naming
+ */
+ forceNewLockPath = 1;
+ tryOldLockPath = 0;
+ continue; /* go back to the do {} while start point, try again */
+ }
+ }
+ if( rc==SQLITE_OK ){
+ /* Need to make a copy of path if we extracted the value
+ ** from the conch file or the path was allocated on the stack
+ */
+ if( tempLockPath ){
+ pCtx->lockProxyPath = sqlite3DbStrDup(0, tempLockPath);
+ if( !pCtx->lockProxyPath ){
+ rc = SQLITE_NOMEM_BKPT;
+ }
+ }
+ }
+ if( rc==SQLITE_OK ){
+ pCtx->conchHeld = 1;
+
+ if( pCtx->lockProxy->pMethod == &afpIoMethods ){
+ afpLockingContext *afpCtx;
+ afpCtx = (afpLockingContext *)pCtx->lockProxy->lockingContext;
+ afpCtx->dbPath = pCtx->lockProxyPath;
+ }
+ } else {
+ conchFile->pMethod->xUnlock((sqlite3_file*)conchFile, NO_LOCK);
+ }
+ OSTRACE(("TAKECONCH %d %s\n", conchFile->h,
+ rc==SQLITE_OK?"ok":"failed"));
+ return rc;
+ } while (1); /* in case we need to retry the :auto: lock file -
+ ** we should never get here except via the 'continue' call. */
+ }
+}
+
+/*
+** If pFile holds a lock on a conch file, then release that lock.
+*/
+static int proxyReleaseConch(unixFile *pFile){
+ int rc = SQLITE_OK; /* Subroutine return code */
+ proxyLockingContext *pCtx; /* The locking context for the proxy lock */
+ unixFile *conchFile; /* Name of the conch file */
+
+ pCtx = (proxyLockingContext *)pFile->lockingContext;
+ conchFile = pCtx->conchFile;
+ OSTRACE(("RELEASECONCH %d for %s pid=%d\n", conchFile->h,
+ (pCtx->lockProxyPath ? pCtx->lockProxyPath : ":auto:"),
+ osGetpid(0)));
+ if( pCtx->conchHeld>0 ){
+ rc = conchFile->pMethod->xUnlock((sqlite3_file*)conchFile, NO_LOCK);
+ }
+ pCtx->conchHeld = 0;
+ OSTRACE(("RELEASECONCH %d %s\n", conchFile->h,
+ (rc==SQLITE_OK ? "ok" : "failed")));
+ return rc;
+}
+
+/*
+** Given the name of a database file, compute the name of its conch file.
+** Store the conch filename in memory obtained from sqlite3_malloc64().
+** Make *pConchPath point to the new name. Return SQLITE_OK on success
+** or SQLITE_NOMEM if unable to obtain memory.
+**
+** The caller is responsible for ensuring that the allocated memory
+** space is eventually freed.
+**
+** *pConchPath is set to NULL if a memory allocation error occurs.
+*/
+static int proxyCreateConchPathname(char *dbPath, char **pConchPath){
+ int i; /* Loop counter */
+ int len = (int)strlen(dbPath); /* Length of database filename - dbPath */
+ char *conchPath; /* buffer in which to construct conch name */
+
+ /* Allocate space for the conch filename and initialize the name to
+ ** the name of the original database file. */
+ *pConchPath = conchPath = (char *)sqlite3_malloc64(len + 8);
+ if( conchPath==0 ){
+ return SQLITE_NOMEM_BKPT;
+ }
+ memcpy(conchPath, dbPath, len+1);
+
+ /* now insert a "." before the last / character */
+ for( i=(len-1); i>=0; i-- ){
+ if( conchPath[i]=='/' ){
+ i++;
+ break;
+ }
+ }
+ conchPath[i]='.';
+ while ( i<len ){
+ conchPath[i+1]=dbPath[i];
+ i++;
+ }
+
+ /* append the "-conch" suffix to the file */
+ memcpy(&conchPath[i+1], "-conch", 7);
+ assert( (int)strlen(conchPath) == len+7 );
+
+ return SQLITE_OK;
+}
+
+
+/* Takes a fully configured proxy locking-style unix file and switches
+** the local lock file path
+*/
+static int switchLockProxyPath(unixFile *pFile, const char *path) {
+ proxyLockingContext *pCtx = (proxyLockingContext*)pFile->lockingContext;
+ char *oldPath = pCtx->lockProxyPath;
+ int rc = SQLITE_OK;
+
+ if( pFile->eFileLock!=NO_LOCK ){
+ return SQLITE_BUSY;
+ }
+
+ /* nothing to do if the path is NULL, :auto: or matches the existing path */
+ if( !path || path[0]=='\0' || !strcmp(path, ":auto:") ||
+ (oldPath && !strncmp(oldPath, path, MAXPATHLEN)) ){
+ return SQLITE_OK;
+ }else{
+ unixFile *lockProxy = pCtx->lockProxy;
+ pCtx->lockProxy=NULL;
+ pCtx->conchHeld = 0;
+ if( lockProxy!=NULL ){
+ rc=lockProxy->pMethod->xClose((sqlite3_file *)lockProxy);
+ if( rc ) return rc;
+ sqlite3_free(lockProxy);
+ }
+ sqlite3_free(oldPath);
+ pCtx->lockProxyPath = sqlite3DbStrDup(0, path);
+ }
+
+ return rc;
+}
+
+/*
+** pFile is a file that has been opened by a prior xOpen call. dbPath
+** is a string buffer at least MAXPATHLEN+1 characters in size.
+**
+** This routine find the filename associated with pFile and writes it
+** int dbPath.
+*/
+static int proxyGetDbPathForUnixFile(unixFile *pFile, char *dbPath){
+#if defined(__APPLE__)
+ if( pFile->pMethod == &afpIoMethods ){
+ /* afp style keeps a reference to the db path in the filePath field
+ ** of the struct */
+ assert( (int)strlen((char*)pFile->lockingContext)<=MAXPATHLEN );
+ strlcpy(dbPath, ((afpLockingContext *)pFile->lockingContext)->dbPath,
+ MAXPATHLEN);
+ } else
+#endif
+ if( pFile->pMethod == &dotlockIoMethods ){
+ /* dot lock style uses the locking context to store the dot lock
+ ** file path */
+ int len = strlen((char *)pFile->lockingContext) - strlen(DOTLOCK_SUFFIX);
+ memcpy(dbPath, (char *)pFile->lockingContext, len + 1);
+ }else{
+ /* all other styles use the locking context to store the db file path */
+ assert( strlen((char*)pFile->lockingContext)<=MAXPATHLEN );
+ strlcpy(dbPath, (char *)pFile->lockingContext, MAXPATHLEN);
+ }
+ return SQLITE_OK;
+}
+
+/*
+** Takes an already filled in unix file and alters it so all file locking
+** will be performed on the local proxy lock file. The following fields
+** are preserved in the locking context so that they can be restored and
+** the unix structure properly cleaned up at close time:
+** ->lockingContext
+** ->pMethod
+*/
+static int proxyTransformUnixFile(unixFile *pFile, const char *path) {
+ proxyLockingContext *pCtx;
+ char dbPath[MAXPATHLEN+1]; /* Name of the database file */
+ char *lockPath=NULL;
+ int rc = SQLITE_OK;
+
+ if( pFile->eFileLock!=NO_LOCK ){
+ return SQLITE_BUSY;
+ }
+ proxyGetDbPathForUnixFile(pFile, dbPath);
+ if( !path || path[0]=='\0' || !strcmp(path, ":auto:") ){
+ lockPath=NULL;
+ }else{
+ lockPath=(char *)path;
+ }
+
+ OSTRACE(("TRANSPROXY %d for %s pid=%d\n", pFile->h,
+ (lockPath ? lockPath : ":auto:"), osGetpid(0)));
+
+ pCtx = sqlite3_malloc64( sizeof(*pCtx) );
+ if( pCtx==0 ){
+ return SQLITE_NOMEM_BKPT;
+ }
+ memset(pCtx, 0, sizeof(*pCtx));
+
+ rc = proxyCreateConchPathname(dbPath, &pCtx->conchFilePath);
+ if( rc==SQLITE_OK ){
+ rc = proxyCreateUnixFile(pCtx->conchFilePath, &pCtx->conchFile, 0);
+ if( rc==SQLITE_CANTOPEN && ((pFile->openFlags&O_RDWR) == 0) ){
+ /* if (a) the open flags are not O_RDWR, (b) the conch isn't there, and
+ ** (c) the file system is read-only, then enable no-locking access.
+ ** Ugh, since O_RDONLY==0x0000 we test for !O_RDWR since unixOpen asserts
+ ** that openFlags will have only one of O_RDONLY or O_RDWR.
+ */
+ struct statfs fsInfo;
+ struct stat conchInfo;
+ int goLockless = 0;
+
+ if( osStat(pCtx->conchFilePath, &conchInfo) == -1 ) {
+ int err = errno;
+ if( (err==ENOENT) && (statfs(dbPath, &fsInfo) != -1) ){
+ goLockless = (fsInfo.f_flags&MNT_RDONLY) == MNT_RDONLY;
+ }
+ }
+ if( goLockless ){
+ pCtx->conchHeld = -1; /* read only FS/ lockless */
+ rc = SQLITE_OK;
+ }
+ }
+ }
+ if( rc==SQLITE_OK && lockPath ){
+ pCtx->lockProxyPath = sqlite3DbStrDup(0, lockPath);
+ }
+
+ if( rc==SQLITE_OK ){
+ pCtx->dbPath = sqlite3DbStrDup(0, dbPath);
+ if( pCtx->dbPath==NULL ){
+ rc = SQLITE_NOMEM_BKPT;
+ }
+ }
+ if( rc==SQLITE_OK ){
+ /* all memory is allocated, proxys are created and assigned,
+ ** switch the locking context and pMethod then return.
+ */
+ pCtx->oldLockingContext = pFile->lockingContext;
+ pFile->lockingContext = pCtx;
+ pCtx->pOldMethod = pFile->pMethod;
+ pFile->pMethod = &proxyIoMethods;
+ }else{
+ if( pCtx->conchFile ){
+ pCtx->conchFile->pMethod->xClose((sqlite3_file *)pCtx->conchFile);
+ sqlite3_free(pCtx->conchFile);
+ }
+ sqlite3DbFree(0, pCtx->lockProxyPath);
+ sqlite3_free(pCtx->conchFilePath);
+ sqlite3_free(pCtx);
+ }
+ OSTRACE(("TRANSPROXY %d %s\n", pFile->h,
+ (rc==SQLITE_OK ? "ok" : "failed")));
+ return rc;
+}
+
+
+/*
+** This routine handles sqlite3_file_control() calls that are specific
+** to proxy locking.
+*/
+static int proxyFileControl(sqlite3_file *id, int op, void *pArg){
+ switch( op ){
+ case SQLITE_FCNTL_GET_LOCKPROXYFILE: {
+ unixFile *pFile = (unixFile*)id;
+ if( pFile->pMethod == &proxyIoMethods ){
+ proxyLockingContext *pCtx = (proxyLockingContext*)pFile->lockingContext;
+ proxyTakeConch(pFile);
+ if( pCtx->lockProxyPath ){
+ *(const char **)pArg = pCtx->lockProxyPath;
+ }else{
+ *(const char **)pArg = ":auto: (not held)";
+ }
+ } else {
+ *(const char **)pArg = NULL;
+ }
+ return SQLITE_OK;
+ }
+ case SQLITE_FCNTL_SET_LOCKPROXYFILE: {
+ unixFile *pFile = (unixFile*)id;
+ int rc = SQLITE_OK;
+ int isProxyStyle = (pFile->pMethod == &proxyIoMethods);
+ if( pArg==NULL || (const char *)pArg==0 ){
+ if( isProxyStyle ){
+ /* turn off proxy locking - not supported. If support is added for
+ ** switching proxy locking mode off then it will need to fail if
+ ** the journal mode is WAL mode.
+ */
+ rc = SQLITE_ERROR /*SQLITE_PROTOCOL? SQLITE_MISUSE?*/;
+ }else{
+ /* turn off proxy locking - already off - NOOP */
+ rc = SQLITE_OK;
+ }
+ }else{
+ const char *proxyPath = (const char *)pArg;
+ if( isProxyStyle ){
+ proxyLockingContext *pCtx =
+ (proxyLockingContext*)pFile->lockingContext;
+ if( !strcmp(pArg, ":auto:")
+ || (pCtx->lockProxyPath &&
+ !strncmp(pCtx->lockProxyPath, proxyPath, MAXPATHLEN))
+ ){
+ rc = SQLITE_OK;
+ }else{
+ rc = switchLockProxyPath(pFile, proxyPath);
+ }
+ }else{
+ /* turn on proxy file locking */
+ rc = proxyTransformUnixFile(pFile, proxyPath);
+ }
+ }
+ return rc;
+ }
+ default: {
+ assert( 0 ); /* The call assures that only valid opcodes are sent */
+ }
+ }
+ /*NOTREACHED*/ assert(0);
+ return SQLITE_ERROR;
+}
+
+/*
+** Within this division (the proxying locking implementation) the procedures
+** above this point are all utilities. The lock-related methods of the
+** proxy-locking sqlite3_io_method object follow.
+*/
+
+
+/*
+** This routine checks if there is a RESERVED lock held on the specified
+** file by this or any other process. If such a lock is held, set *pResOut
+** to a non-zero value otherwise *pResOut is set to zero. The return value
+** is set to SQLITE_OK unless an I/O error occurs during lock checking.
+*/
+static int proxyCheckReservedLock(sqlite3_file *id, int *pResOut) {
+ unixFile *pFile = (unixFile*)id;
+ int rc = proxyTakeConch(pFile);
+ if( rc==SQLITE_OK ){
+ proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext;
+ if( pCtx->conchHeld>0 ){
+ unixFile *proxy = pCtx->lockProxy;
+ return proxy->pMethod->xCheckReservedLock((sqlite3_file*)proxy, pResOut);
+ }else{ /* conchHeld < 0 is lockless */
+ pResOut=0;
+ }
+ }
+ return rc;
+}
+
+/*
+** Lock the file with the lock specified by parameter eFileLock - one
+** of the following:
+**
+** (1) SHARED_LOCK
+** (2) RESERVED_LOCK
+** (3) PENDING_LOCK
+** (4) EXCLUSIVE_LOCK
+**
+** Sometimes when requesting one lock state, additional lock states
+** are inserted in between. The locking might fail on one of the later
+** transitions leaving the lock state different from what it started but
+** still short of its goal. The following chart shows the allowed
+** transitions and the inserted intermediate states:
+**
+** UNLOCKED -> SHARED
+** SHARED -> RESERVED
+** SHARED -> (PENDING) -> EXCLUSIVE
+** RESERVED -> (PENDING) -> EXCLUSIVE
+** PENDING -> EXCLUSIVE
+**
+** This routine will only increase a lock. Use the sqlite3OsUnlock()
+** routine to lower a locking level.
+*/
+static int proxyLock(sqlite3_file *id, int eFileLock) {
+ unixFile *pFile = (unixFile*)id;
+ int rc = proxyTakeConch(pFile);
+ if( rc==SQLITE_OK ){
+ proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext;
+ if( pCtx->conchHeld>0 ){
+ unixFile *proxy = pCtx->lockProxy;
+ rc = proxy->pMethod->xLock((sqlite3_file*)proxy, eFileLock);
+ pFile->eFileLock = proxy->eFileLock;
+ }else{
+ /* conchHeld < 0 is lockless */
+ }
+ }
+ return rc;
+}
+
+
+/*
+** Lower the locking level on file descriptor pFile to eFileLock. eFileLock
+** must be either NO_LOCK or SHARED_LOCK.
+**
+** If the locking level of the file descriptor is already at or below
+** the requested locking level, this routine is a no-op.
+*/
+static int proxyUnlock(sqlite3_file *id, int eFileLock) {
+ unixFile *pFile = (unixFile*)id;
+ int rc = proxyTakeConch(pFile);
+ if( rc==SQLITE_OK ){
+ proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext;
+ if( pCtx->conchHeld>0 ){
+ unixFile *proxy = pCtx->lockProxy;
+ rc = proxy->pMethod->xUnlock((sqlite3_file*)proxy, eFileLock);
+ pFile->eFileLock = proxy->eFileLock;
+ }else{
+ /* conchHeld < 0 is lockless */
+ }
+ }
+ return rc;
+}
+
+/*
+** Close a file that uses proxy locks.
+*/
+static int proxyClose(sqlite3_file *id) {
+ if( ALWAYS(id) ){
+ unixFile *pFile = (unixFile*)id;
+ proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext;
+ unixFile *lockProxy = pCtx->lockProxy;
+ unixFile *conchFile = pCtx->conchFile;
+ int rc = SQLITE_OK;
+
+ if( lockProxy ){
+ rc = lockProxy->pMethod->xUnlock((sqlite3_file*)lockProxy, NO_LOCK);
+ if( rc ) return rc;
+ rc = lockProxy->pMethod->xClose((sqlite3_file*)lockProxy);
+ if( rc ) return rc;
+ sqlite3_free(lockProxy);
+ pCtx->lockProxy = 0;
+ }
+ if( conchFile ){
+ if( pCtx->conchHeld ){
+ rc = proxyReleaseConch(pFile);
+ if( rc ) return rc;
+ }
+ rc = conchFile->pMethod->xClose((sqlite3_file*)conchFile);
+ if( rc ) return rc;
+ sqlite3_free(conchFile);
+ }
+ sqlite3DbFree(0, pCtx->lockProxyPath);
+ sqlite3_free(pCtx->conchFilePath);
+ sqlite3DbFree(0, pCtx->dbPath);
+ /* restore the original locking context and pMethod then close it */
+ pFile->lockingContext = pCtx->oldLockingContext;
+ pFile->pMethod = pCtx->pOldMethod;
+ sqlite3_free(pCtx);
+ return pFile->pMethod->xClose(id);
+ }
+ return SQLITE_OK;
+}
+
+
+
+#endif /* defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE */
+/*
+** The proxy locking style is intended for use with AFP filesystems.
+** And since AFP is only supported on MacOSX, the proxy locking is also
+** restricted to MacOSX.
+**
+**
+******************* End of the proxy lock implementation **********************
+******************************************************************************/
+
+/*
+** Initialize the operating system interface.
+**
+** This routine registers all VFS implementations for unix-like operating
+** systems. This routine, and the sqlite3_os_end() routine that follows,
+** should be the only routines in this file that are visible from other
+** files.
+**
+** This routine is called once during SQLite initialization and by a
+** single thread. The memory allocation and mutex subsystems have not
+** necessarily been initialized when this routine is called, and so they
+** should not be used.
+*/
+SQLITE_API int sqlite3_os_init(void){
+ /*
+ ** The following macro defines an initializer for an sqlite3_vfs object.
+ ** The name of the VFS is NAME. The pAppData is a pointer to a pointer
+ ** to the "finder" function. (pAppData is a pointer to a pointer because
+ ** silly C90 rules prohibit a void* from being cast to a function pointer
+ ** and so we have to go through the intermediate pointer to avoid problems
+ ** when compiling with -pedantic-errors on GCC.)
+ **
+ ** The FINDER parameter to this macro is the name of the pointer to the
+ ** finder-function. The finder-function returns a pointer to the
+ ** sqlite_io_methods object that implements the desired locking
+ ** behaviors. See the division above that contains the IOMETHODS
+ ** macro for addition information on finder-functions.
+ **
+ ** Most finders simply return a pointer to a fixed sqlite3_io_methods
+ ** object. But the "autolockIoFinder" available on MacOSX does a little
+ ** more than that; it looks at the filesystem type that hosts the
+ ** database file and tries to choose an locking method appropriate for
+ ** that filesystem time.
+ */
+ #define UNIXVFS(VFSNAME, FINDER) { \
+ 3, /* iVersion */ \
+ sizeof(unixFile), /* szOsFile */ \
+ MAX_PATHNAME, /* mxPathname */ \
+ 0, /* pNext */ \
+ VFSNAME, /* zName */ \
+ (void*)&FINDER, /* pAppData */ \
+ unixOpen, /* xOpen */ \
+ unixDelete, /* xDelete */ \
+ unixAccess, /* xAccess */ \
+ unixFullPathname, /* xFullPathname */ \
+ unixDlOpen, /* xDlOpen */ \
+ unixDlError, /* xDlError */ \
+ unixDlSym, /* xDlSym */ \
+ unixDlClose, /* xDlClose */ \
+ unixRandomness, /* xRandomness */ \
+ unixSleep, /* xSleep */ \
+ unixCurrentTime, /* xCurrentTime */ \
+ unixGetLastError, /* xGetLastError */ \
+ unixCurrentTimeInt64, /* xCurrentTimeInt64 */ \
+ unixSetSystemCall, /* xSetSystemCall */ \
+ unixGetSystemCall, /* xGetSystemCall */ \
+ unixNextSystemCall, /* xNextSystemCall */ \
+ }
+
+ /*
+ ** All default VFSes for unix are contained in the following array.
+ **
+ ** Note that the sqlite3_vfs.pNext field of the VFS object is modified
+ ** by the SQLite core when the VFS is registered. So the following
+ ** array cannot be const.
+ */
+ static sqlite3_vfs aVfs[] = {
+#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)
+ UNIXVFS("unix", autolockIoFinder ),
+#elif OS_VXWORKS
+ UNIXVFS("unix", vxworksIoFinder ),
+#else
+ UNIXVFS("unix", posixIoFinder ),
+#endif
+ UNIXVFS("unix-none", nolockIoFinder ),
+ UNIXVFS("unix-dotfile", dotlockIoFinder ),
+ UNIXVFS("unix-excl", posixIoFinder ),
+#if OS_VXWORKS
+ UNIXVFS("unix-namedsem", semIoFinder ),
+#endif
+#if SQLITE_ENABLE_LOCKING_STYLE || OS_VXWORKS
+ UNIXVFS("unix-posix", posixIoFinder ),
+#endif
+#if SQLITE_ENABLE_LOCKING_STYLE
+ UNIXVFS("unix-flock", flockIoFinder ),
+#endif
+#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)
+ UNIXVFS("unix-afp", afpIoFinder ),
+ UNIXVFS("unix-nfs", nfsIoFinder ),
+ UNIXVFS("unix-proxy", proxyIoFinder ),
+#endif
+ };
+ unsigned int i; /* Loop counter */
+
+ /* Double-check that the aSyscall[] array has been constructed
+ ** correctly. See ticket [bb3a86e890c8e96ab] */
+ assert( ArraySize(aSyscall)==29 );
+
+ /* Register all VFSes defined in the aVfs[] array */
+ for(i=0; i<(sizeof(aVfs)/sizeof(sqlite3_vfs)); i++){
+#ifdef SQLITE_DEFAULT_UNIX_VFS
+ sqlite3_vfs_register(&aVfs[i],
+ 0==strcmp(aVfs[i].zName,SQLITE_DEFAULT_UNIX_VFS));
+#else
+ sqlite3_vfs_register(&aVfs[i], i==0);
+#endif
+ }
+#ifdef SQLITE_OS_KV_OPTIONAL
+ sqlite3KvvfsInit();
+#endif
+ unixBigLock = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_VFS1);
+
+#ifndef SQLITE_OMIT_WAL
+ /* Validate lock assumptions */
+ assert( SQLITE_SHM_NLOCK==8 ); /* Number of available locks */
+ assert( UNIX_SHM_BASE==120 ); /* Start of locking area */
+ /* Locks:
+ ** WRITE UNIX_SHM_BASE 120
+ ** CKPT UNIX_SHM_BASE+1 121
+ ** RECOVER UNIX_SHM_BASE+2 122
+ ** READ-0 UNIX_SHM_BASE+3 123
+ ** READ-1 UNIX_SHM_BASE+4 124
+ ** READ-2 UNIX_SHM_BASE+5 125
+ ** READ-3 UNIX_SHM_BASE+6 126
+ ** READ-4 UNIX_SHM_BASE+7 127
+ ** DMS UNIX_SHM_BASE+8 128
+ */
+ assert( UNIX_SHM_DMS==128 ); /* Byte offset of the deadman-switch */
+#endif
+
+ /* Initialize temp file dir array. */
+ unixTempFileInit();
+
+ return SQLITE_OK;
+}
+
+/*
+** Shutdown the operating system interface.
+**
+** Some operating systems might need to do some cleanup in this routine,
+** to release dynamically allocated objects. But not on unix.
+** This routine is a no-op for unix.
+*/
+SQLITE_API int sqlite3_os_end(void){
+ unixBigLock = 0;
+ return SQLITE_OK;
+}
+
+#endif /* SQLITE_OS_UNIX */
+
+/************** End of os_unix.c *********************************************/
+/************** Begin file os_win.c ******************************************/
+/*
+** 2004 May 22
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+******************************************************************************
+**
+** This file contains code that is specific to Windows.
+*/
+/* #include "sqliteInt.h" */
+#if SQLITE_OS_WIN /* This file is used for Windows only */
+
+/*
+** Include code that is common to all os_*.c files
+*/
+/* #include "os_common.h" */
+
+/*
+** Include the header file for the Windows VFS.
+*/
+/* #include "os_win.h" */
+
+/*
+** Compiling and using WAL mode requires several APIs that are only
+** available in Windows platforms based on the NT kernel.
+*/
+#if !SQLITE_OS_WINNT && !defined(SQLITE_OMIT_WAL)
+# error "WAL mode requires support from the Windows NT kernel, compile\
+ with SQLITE_OMIT_WAL."
+#endif
+
+#if !SQLITE_OS_WINNT && SQLITE_MAX_MMAP_SIZE>0
+# error "Memory mapped files require support from the Windows NT kernel,\
+ compile with SQLITE_MAX_MMAP_SIZE=0."
+#endif
+
+/*
+** Are most of the Win32 ANSI APIs available (i.e. with certain exceptions
+** based on the sub-platform)?
+*/
+#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(SQLITE_WIN32_NO_ANSI)
+# define SQLITE_WIN32_HAS_ANSI
+#endif
+
+/*
+** Are most of the Win32 Unicode APIs available (i.e. with certain exceptions
+** based on the sub-platform)?
+*/
+#if (SQLITE_OS_WINCE || SQLITE_OS_WINNT || SQLITE_OS_WINRT) && \
+ !defined(SQLITE_WIN32_NO_WIDE)
+# define SQLITE_WIN32_HAS_WIDE
+#endif
+
+/*
+** Make sure at least one set of Win32 APIs is available.
+*/
+#if !defined(SQLITE_WIN32_HAS_ANSI) && !defined(SQLITE_WIN32_HAS_WIDE)
+# error "At least one of SQLITE_WIN32_HAS_ANSI and SQLITE_WIN32_HAS_WIDE\
+ must be defined."
+#endif
+
+/*
+** Define the required Windows SDK version constants if they are not
+** already available.
+*/
+#ifndef NTDDI_WIN8
+# define NTDDI_WIN8 0x06020000
+#endif
+
+#ifndef NTDDI_WINBLUE
+# define NTDDI_WINBLUE 0x06030000
+#endif
+
+#ifndef NTDDI_WINTHRESHOLD
+# define NTDDI_WINTHRESHOLD 0x06040000
+#endif
+
+/*
+** Check to see if the GetVersionEx[AW] functions are deprecated on the
+** target system. GetVersionEx was first deprecated in Win8.1.
+*/
+#ifndef SQLITE_WIN32_GETVERSIONEX
+# if defined(NTDDI_VERSION) && NTDDI_VERSION >= NTDDI_WINBLUE
+# define SQLITE_WIN32_GETVERSIONEX 0 /* GetVersionEx() is deprecated */
+# else
+# define SQLITE_WIN32_GETVERSIONEX 1 /* GetVersionEx() is current */
+# endif
+#endif
+
+/*
+** Check to see if the CreateFileMappingA function is supported on the
+** target system. It is unavailable when using "mincore.lib" on Win10.
+** When compiling for Windows 10, always assume "mincore.lib" is in use.
+*/
+#ifndef SQLITE_WIN32_CREATEFILEMAPPINGA
+# if defined(NTDDI_VERSION) && NTDDI_VERSION >= NTDDI_WINTHRESHOLD
+# define SQLITE_WIN32_CREATEFILEMAPPINGA 0
+# else
+# define SQLITE_WIN32_CREATEFILEMAPPINGA 1
+# endif
+#endif
+
+/*
+** This constant should already be defined (in the "WinDef.h" SDK file).
+*/
+#ifndef MAX_PATH
+# define MAX_PATH (260)
+#endif
+
+/*
+** Maximum pathname length (in chars) for Win32. This should normally be
+** MAX_PATH.
+*/
+#ifndef SQLITE_WIN32_MAX_PATH_CHARS
+# define SQLITE_WIN32_MAX_PATH_CHARS (MAX_PATH)
+#endif
+
+/*
+** This constant should already be defined (in the "WinNT.h" SDK file).
+*/
+#ifndef UNICODE_STRING_MAX_CHARS
+# define UNICODE_STRING_MAX_CHARS (32767)
+#endif
+
+/*
+** Maximum pathname length (in chars) for WinNT. This should normally be
+** UNICODE_STRING_MAX_CHARS.
+*/
+#ifndef SQLITE_WINNT_MAX_PATH_CHARS
+# define SQLITE_WINNT_MAX_PATH_CHARS (UNICODE_STRING_MAX_CHARS)
+#endif
+
+/*
+** Maximum pathname length (in bytes) for Win32. The MAX_PATH macro is in
+** characters, so we allocate 4 bytes per character assuming worst-case of
+** 4-bytes-per-character for UTF8.
+*/
+#ifndef SQLITE_WIN32_MAX_PATH_BYTES
+# define SQLITE_WIN32_MAX_PATH_BYTES (SQLITE_WIN32_MAX_PATH_CHARS*4)
+#endif
+
+/*
+** Maximum pathname length (in bytes) for WinNT. This should normally be
+** UNICODE_STRING_MAX_CHARS * sizeof(WCHAR).
+*/
+#ifndef SQLITE_WINNT_MAX_PATH_BYTES
+# define SQLITE_WINNT_MAX_PATH_BYTES \
+ (sizeof(WCHAR) * SQLITE_WINNT_MAX_PATH_CHARS)
+#endif
+
+/*
+** Maximum error message length (in chars) for WinRT.
+*/
+#ifndef SQLITE_WIN32_MAX_ERRMSG_CHARS
+# define SQLITE_WIN32_MAX_ERRMSG_CHARS (1024)
+#endif
+
+/*
+** Returns non-zero if the character should be treated as a directory
+** separator.
+*/
+#ifndef winIsDirSep
+# define winIsDirSep(a) (((a) == '/') || ((a) == '\\'))
+#endif
+
+/*
+** This macro is used when a local variable is set to a value that is
+** [sometimes] not used by the code (e.g. via conditional compilation).
+*/
+#ifndef UNUSED_VARIABLE_VALUE
+# define UNUSED_VARIABLE_VALUE(x) (void)(x)
+#endif
+
+/*
+** Returns the character that should be used as the directory separator.
+*/
+#ifndef winGetDirSep
+# define winGetDirSep() '\\'
+#endif
+
+/*
+** Do we need to manually define the Win32 file mapping APIs for use with WAL
+** mode or memory mapped files (e.g. these APIs are available in the Windows
+** CE SDK; however, they are not present in the header file)?
+*/
+#if SQLITE_WIN32_FILEMAPPING_API && \
+ (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0)
+/*
+** Two of the file mapping APIs are different under WinRT. Figure out which
+** set we need.
+*/
+#if SQLITE_OS_WINRT
+WINBASEAPI HANDLE WINAPI CreateFileMappingFromApp(HANDLE, \
+ LPSECURITY_ATTRIBUTES, ULONG, ULONG64, LPCWSTR);
+
+WINBASEAPI LPVOID WINAPI MapViewOfFileFromApp(HANDLE, ULONG, ULONG64, SIZE_T);
+#else
+#if defined(SQLITE_WIN32_HAS_ANSI)
+WINBASEAPI HANDLE WINAPI CreateFileMappingA(HANDLE, LPSECURITY_ATTRIBUTES, \
+ DWORD, DWORD, DWORD, LPCSTR);
+#endif /* defined(SQLITE_WIN32_HAS_ANSI) */
+
+#if defined(SQLITE_WIN32_HAS_WIDE)
+WINBASEAPI HANDLE WINAPI CreateFileMappingW(HANDLE, LPSECURITY_ATTRIBUTES, \
+ DWORD, DWORD, DWORD, LPCWSTR);
+#endif /* defined(SQLITE_WIN32_HAS_WIDE) */
+
+WINBASEAPI LPVOID WINAPI MapViewOfFile(HANDLE, DWORD, DWORD, DWORD, SIZE_T);
+#endif /* SQLITE_OS_WINRT */
+
+/*
+** These file mapping APIs are common to both Win32 and WinRT.
+*/
+
+WINBASEAPI BOOL WINAPI FlushViewOfFile(LPCVOID, SIZE_T);
+WINBASEAPI BOOL WINAPI UnmapViewOfFile(LPCVOID);
+#endif /* SQLITE_WIN32_FILEMAPPING_API */
+
+/*
+** Some Microsoft compilers lack this definition.
+*/
+#ifndef INVALID_FILE_ATTRIBUTES
+# define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
+#endif
+
+#ifndef FILE_FLAG_MASK
+# define FILE_FLAG_MASK (0xFF3C0000)
+#endif
+
+#ifndef FILE_ATTRIBUTE_MASK
+# define FILE_ATTRIBUTE_MASK (0x0003FFF7)
+#endif
+
+#ifndef SQLITE_OMIT_WAL
+/* Forward references to structures used for WAL */
+typedef struct winShm winShm; /* A connection to shared-memory */
+typedef struct winShmNode winShmNode; /* A region of shared-memory */
+#endif
+
+/*
+** WinCE lacks native support for file locking so we have to fake it
+** with some code of our own.
+*/
+#if SQLITE_OS_WINCE
+typedef struct winceLock {
+ int nReaders; /* Number of reader locks obtained */
+ BOOL bPending; /* Indicates a pending lock has been obtained */
+ BOOL bReserved; /* Indicates a reserved lock has been obtained */
+ BOOL bExclusive; /* Indicates an exclusive lock has been obtained */
+} winceLock;
+#endif
+
+/*
+** The winFile structure is a subclass of sqlite3_file* specific to the win32
+** portability layer.
+*/
+typedef struct winFile winFile;
+struct winFile {
+ const sqlite3_io_methods *pMethod; /*** Must be first ***/
+ sqlite3_vfs *pVfs; /* The VFS used to open this file */
+ HANDLE h; /* Handle for accessing the file */
+ u8 locktype; /* Type of lock currently held on this file */
+ short sharedLockByte; /* Randomly chosen byte used as a shared lock */
+ u8 ctrlFlags; /* Flags. See WINFILE_* below */
+ DWORD lastErrno; /* The Windows errno from the last I/O error */
+#ifndef SQLITE_OMIT_WAL
+ winShm *pShm; /* Instance of shared memory on this file */
+#endif
+ const char *zPath; /* Full pathname of this file */
+ int szChunk; /* Chunk size configured by FCNTL_CHUNK_SIZE */
+#if SQLITE_OS_WINCE
+ LPWSTR zDeleteOnClose; /* Name of file to delete when closing */
+ HANDLE hMutex; /* Mutex used to control access to shared lock */
+ HANDLE hShared; /* Shared memory segment used for locking */
+ winceLock local; /* Locks obtained by this instance of winFile */
+ winceLock *shared; /* Global shared lock memory for the file */
+#endif
+#if SQLITE_MAX_MMAP_SIZE>0
+ int nFetchOut; /* Number of outstanding xFetch references */
+ HANDLE hMap; /* Handle for accessing memory mapping */
+ void *pMapRegion; /* Area memory mapped */
+ sqlite3_int64 mmapSize; /* Size of mapped region */
+ sqlite3_int64 mmapSizeMax; /* Configured FCNTL_MMAP_SIZE value */
+#endif
+};
+
+/*
+** The winVfsAppData structure is used for the pAppData member for all of the
+** Win32 VFS variants.
+*/
+typedef struct winVfsAppData winVfsAppData;
+struct winVfsAppData {
+ const sqlite3_io_methods *pMethod; /* The file I/O methods to use. */
+ void *pAppData; /* The extra pAppData, if any. */
+ BOOL bNoLock; /* Non-zero if locking is disabled. */
+};
+
+/*
+** Allowed values for winFile.ctrlFlags
+*/
+#define WINFILE_RDONLY 0x02 /* Connection is read only */
+#define WINFILE_PERSIST_WAL 0x04 /* Persistent WAL mode */
+#define WINFILE_PSOW 0x10 /* SQLITE_IOCAP_POWERSAFE_OVERWRITE */
+
+/*
+ * The size of the buffer used by sqlite3_win32_write_debug().
+ */
+#ifndef SQLITE_WIN32_DBG_BUF_SIZE
+# define SQLITE_WIN32_DBG_BUF_SIZE ((int)(4096-sizeof(DWORD)))
+#endif
+
+/*
+ * If compiled with SQLITE_WIN32_MALLOC on Windows, we will use the
+ * various Win32 API heap functions instead of our own.
+ */
+#ifdef SQLITE_WIN32_MALLOC
+
+/*
+ * If this is non-zero, an isolated heap will be created by the native Win32
+ * allocator subsystem; otherwise, the default process heap will be used. This
+ * setting has no effect when compiling for WinRT. By default, this is enabled
+ * and an isolated heap will be created to store all allocated data.
+ *
+ ******************************************************************************
+ * WARNING: It is important to note that when this setting is non-zero and the
+ * winMemShutdown function is called (e.g. by the sqlite3_shutdown
+ * function), all data that was allocated using the isolated heap will
+ * be freed immediately and any attempt to access any of that freed
+ * data will almost certainly result in an immediate access violation.
+ ******************************************************************************
+ */
+#ifndef SQLITE_WIN32_HEAP_CREATE
+# define SQLITE_WIN32_HEAP_CREATE (TRUE)
+#endif
+
+/*
+ * This is the maximum possible initial size of the Win32-specific heap, in
+ * bytes.
+ */
+#ifndef SQLITE_WIN32_HEAP_MAX_INIT_SIZE
+# define SQLITE_WIN32_HEAP_MAX_INIT_SIZE (4294967295U)
+#endif
+
+/*
+ * This is the extra space for the initial size of the Win32-specific heap,
+ * in bytes. This value may be zero.
+ */
+#ifndef SQLITE_WIN32_HEAP_INIT_EXTRA
+# define SQLITE_WIN32_HEAP_INIT_EXTRA (4194304)
+#endif
+
+/*
+ * Calculate the maximum legal cache size, in pages, based on the maximum
+ * possible initial heap size and the default page size, setting aside the
+ * needed extra space.
+ */
+#ifndef SQLITE_WIN32_MAX_CACHE_SIZE
+# define SQLITE_WIN32_MAX_CACHE_SIZE (((SQLITE_WIN32_HEAP_MAX_INIT_SIZE) - \
+ (SQLITE_WIN32_HEAP_INIT_EXTRA)) / \
+ (SQLITE_DEFAULT_PAGE_SIZE))
+#endif
+
+/*
+ * This is cache size used in the calculation of the initial size of the
+ * Win32-specific heap. It cannot be negative.
+ */
+#ifndef SQLITE_WIN32_CACHE_SIZE
+# if SQLITE_DEFAULT_CACHE_SIZE>=0
+# define SQLITE_WIN32_CACHE_SIZE (SQLITE_DEFAULT_CACHE_SIZE)
+# else
+# define SQLITE_WIN32_CACHE_SIZE (-(SQLITE_DEFAULT_CACHE_SIZE))
+# endif
+#endif
+
+/*
+ * Make sure that the calculated cache size, in pages, cannot cause the
+ * initial size of the Win32-specific heap to exceed the maximum amount
+ * of memory that can be specified in the call to HeapCreate.
+ */
+#if SQLITE_WIN32_CACHE_SIZE>SQLITE_WIN32_MAX_CACHE_SIZE
+# undef SQLITE_WIN32_CACHE_SIZE
+# define SQLITE_WIN32_CACHE_SIZE (2000)
+#endif
+
+/*
+ * The initial size of the Win32-specific heap. This value may be zero.
+ */
+#ifndef SQLITE_WIN32_HEAP_INIT_SIZE
+# define SQLITE_WIN32_HEAP_INIT_SIZE ((SQLITE_WIN32_CACHE_SIZE) * \
+ (SQLITE_DEFAULT_PAGE_SIZE) + \
+ (SQLITE_WIN32_HEAP_INIT_EXTRA))
+#endif
+
+/*
+ * The maximum size of the Win32-specific heap. This value may be zero.
+ */
+#ifndef SQLITE_WIN32_HEAP_MAX_SIZE
+# define SQLITE_WIN32_HEAP_MAX_SIZE (0)
+#endif
+
+/*
+ * The extra flags to use in calls to the Win32 heap APIs. This value may be
+ * zero for the default behavior.
+ */
+#ifndef SQLITE_WIN32_HEAP_FLAGS
+# define SQLITE_WIN32_HEAP_FLAGS (0)
+#endif
+
+
+/*
+** The winMemData structure stores information required by the Win32-specific
+** sqlite3_mem_methods implementation.
+*/
+typedef struct winMemData winMemData;
+struct winMemData {
+#ifndef NDEBUG
+ u32 magic1; /* Magic number to detect structure corruption. */
+#endif
+ HANDLE hHeap; /* The handle to our heap. */
+ BOOL bOwned; /* Do we own the heap (i.e. destroy it on shutdown)? */
+#ifndef NDEBUG
+ u32 magic2; /* Magic number to detect structure corruption. */
+#endif
+};
+
+#ifndef NDEBUG
+#define WINMEM_MAGIC1 0x42b2830b
+#define WINMEM_MAGIC2 0xbd4d7cf4
+#endif
+
+static struct winMemData win_mem_data = {
+#ifndef NDEBUG
+ WINMEM_MAGIC1,
+#endif
+ NULL, FALSE
+#ifndef NDEBUG
+ ,WINMEM_MAGIC2
+#endif
+};
+
+#ifndef NDEBUG
+#define winMemAssertMagic1() assert( win_mem_data.magic1==WINMEM_MAGIC1 )
+#define winMemAssertMagic2() assert( win_mem_data.magic2==WINMEM_MAGIC2 )
+#define winMemAssertMagic() winMemAssertMagic1(); winMemAssertMagic2();
+#else
+#define winMemAssertMagic()
+#endif
+
+#define winMemGetDataPtr() &win_mem_data
+#define winMemGetHeap() win_mem_data.hHeap
+#define winMemGetOwned() win_mem_data.bOwned
+
+static void *winMemMalloc(int nBytes);
+static void winMemFree(void *pPrior);
+static void *winMemRealloc(void *pPrior, int nBytes);
+static int winMemSize(void *p);
+static int winMemRoundup(int n);
+static int winMemInit(void *pAppData);
+static void winMemShutdown(void *pAppData);
+
+SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetWin32(void);
+#endif /* SQLITE_WIN32_MALLOC */
+
+/*
+** The following variable is (normally) set once and never changes
+** thereafter. It records whether the operating system is Win9x
+** or WinNT.
+**
+** 0: Operating system unknown.
+** 1: Operating system is Win9x.
+** 2: Operating system is WinNT.
+**
+** In order to facilitate testing on a WinNT system, the test fixture
+** can manually set this value to 1 to emulate Win98 behavior.
+*/
+#ifdef SQLITE_TEST
+SQLITE_API LONG SQLITE_WIN32_VOLATILE sqlite3_os_type = 0;
+#else
+static LONG SQLITE_WIN32_VOLATILE sqlite3_os_type = 0;
+#endif
+
+#ifndef SYSCALL
+# define SYSCALL sqlite3_syscall_ptr
+#endif
+
+/*
+** This function is not available on Windows CE or WinRT.
+ */
+
+#if SQLITE_OS_WINCE || SQLITE_OS_WINRT
+# define osAreFileApisANSI() 1
+#endif
+
+/*
+** Many system calls are accessed through pointer-to-functions so that
+** they may be overridden at runtime to facilitate fault injection during
+** testing and sandboxing. The following array holds the names and pointers
+** to all overrideable system calls.
+*/
+static struct win_syscall {
+ const char *zName; /* Name of the system call */
+ sqlite3_syscall_ptr pCurrent; /* Current value of the system call */
+ sqlite3_syscall_ptr pDefault; /* Default value */
+} aSyscall[] = {
+#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
+ { "AreFileApisANSI", (SYSCALL)AreFileApisANSI, 0 },
+#else
+ { "AreFileApisANSI", (SYSCALL)0, 0 },
+#endif
+
+#ifndef osAreFileApisANSI
+#define osAreFileApisANSI ((BOOL(WINAPI*)(VOID))aSyscall[0].pCurrent)
+#endif
+
+#if SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_WIDE)
+ { "CharLowerW", (SYSCALL)CharLowerW, 0 },
+#else
+ { "CharLowerW", (SYSCALL)0, 0 },
+#endif
+
+#define osCharLowerW ((LPWSTR(WINAPI*)(LPWSTR))aSyscall[1].pCurrent)
+
+#if SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_WIDE)
+ { "CharUpperW", (SYSCALL)CharUpperW, 0 },
+#else
+ { "CharUpperW", (SYSCALL)0, 0 },
+#endif
+
+#define osCharUpperW ((LPWSTR(WINAPI*)(LPWSTR))aSyscall[2].pCurrent)
+
+ { "CloseHandle", (SYSCALL)CloseHandle, 0 },
+
+#define osCloseHandle ((BOOL(WINAPI*)(HANDLE))aSyscall[3].pCurrent)
+
+#if defined(SQLITE_WIN32_HAS_ANSI)
+ { "CreateFileA", (SYSCALL)CreateFileA, 0 },
+#else
+ { "CreateFileA", (SYSCALL)0, 0 },
+#endif
+
+#define osCreateFileA ((HANDLE(WINAPI*)(LPCSTR,DWORD,DWORD, \
+ LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE))aSyscall[4].pCurrent)
+
+#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE)
+ { "CreateFileW", (SYSCALL)CreateFileW, 0 },
+#else
+ { "CreateFileW", (SYSCALL)0, 0 },
+#endif
+
+#define osCreateFileW ((HANDLE(WINAPI*)(LPCWSTR,DWORD,DWORD, \
+ LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE))aSyscall[5].pCurrent)
+
+#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_ANSI) && \
+ (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0) && \
+ SQLITE_WIN32_CREATEFILEMAPPINGA
+ { "CreateFileMappingA", (SYSCALL)CreateFileMappingA, 0 },
+#else
+ { "CreateFileMappingA", (SYSCALL)0, 0 },
+#endif
+
+#define osCreateFileMappingA ((HANDLE(WINAPI*)(HANDLE,LPSECURITY_ATTRIBUTES, \
+ DWORD,DWORD,DWORD,LPCSTR))aSyscall[6].pCurrent)
+
+#if SQLITE_OS_WINCE || (!SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) && \
+ (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0))
+ { "CreateFileMappingW", (SYSCALL)CreateFileMappingW, 0 },
+#else
+ { "CreateFileMappingW", (SYSCALL)0, 0 },
+#endif
+
+#define osCreateFileMappingW ((HANDLE(WINAPI*)(HANDLE,LPSECURITY_ATTRIBUTES, \
+ DWORD,DWORD,DWORD,LPCWSTR))aSyscall[7].pCurrent)
+
+#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE)
+ { "CreateMutexW", (SYSCALL)CreateMutexW, 0 },
+#else
+ { "CreateMutexW", (SYSCALL)0, 0 },
+#endif
+
+#define osCreateMutexW ((HANDLE(WINAPI*)(LPSECURITY_ATTRIBUTES,BOOL, \
+ LPCWSTR))aSyscall[8].pCurrent)
+
+#if defined(SQLITE_WIN32_HAS_ANSI)
+ { "DeleteFileA", (SYSCALL)DeleteFileA, 0 },
+#else
+ { "DeleteFileA", (SYSCALL)0, 0 },
+#endif
+
+#define osDeleteFileA ((BOOL(WINAPI*)(LPCSTR))aSyscall[9].pCurrent)
+
+#if defined(SQLITE_WIN32_HAS_WIDE)
+ { "DeleteFileW", (SYSCALL)DeleteFileW, 0 },
+#else
+ { "DeleteFileW", (SYSCALL)0, 0 },
+#endif
+
+#define osDeleteFileW ((BOOL(WINAPI*)(LPCWSTR))aSyscall[10].pCurrent)
+
+#if SQLITE_OS_WINCE
+ { "FileTimeToLocalFileTime", (SYSCALL)FileTimeToLocalFileTime, 0 },
+#else
+ { "FileTimeToLocalFileTime", (SYSCALL)0, 0 },
+#endif
+
+#define osFileTimeToLocalFileTime ((BOOL(WINAPI*)(CONST FILETIME*, \
+ LPFILETIME))aSyscall[11].pCurrent)
+
+#if SQLITE_OS_WINCE
+ { "FileTimeToSystemTime", (SYSCALL)FileTimeToSystemTime, 0 },
+#else
+ { "FileTimeToSystemTime", (SYSCALL)0, 0 },
+#endif
+
+#define osFileTimeToSystemTime ((BOOL(WINAPI*)(CONST FILETIME*, \
+ LPSYSTEMTIME))aSyscall[12].pCurrent)
+
+ { "FlushFileBuffers", (SYSCALL)FlushFileBuffers, 0 },
+
+#define osFlushFileBuffers ((BOOL(WINAPI*)(HANDLE))aSyscall[13].pCurrent)
+
+#if defined(SQLITE_WIN32_HAS_ANSI)
+ { "FormatMessageA", (SYSCALL)FormatMessageA, 0 },
+#else
+ { "FormatMessageA", (SYSCALL)0, 0 },
+#endif
+
+#define osFormatMessageA ((DWORD(WINAPI*)(DWORD,LPCVOID,DWORD,DWORD,LPSTR, \
+ DWORD,va_list*))aSyscall[14].pCurrent)
+
+#if defined(SQLITE_WIN32_HAS_WIDE)
+ { "FormatMessageW", (SYSCALL)FormatMessageW, 0 },
+#else
+ { "FormatMessageW", (SYSCALL)0, 0 },
+#endif
+
+#define osFormatMessageW ((DWORD(WINAPI*)(DWORD,LPCVOID,DWORD,DWORD,LPWSTR, \
+ DWORD,va_list*))aSyscall[15].pCurrent)
+
+#if !defined(SQLITE_OMIT_LOAD_EXTENSION)
+ { "FreeLibrary", (SYSCALL)FreeLibrary, 0 },
+#else
+ { "FreeLibrary", (SYSCALL)0, 0 },
+#endif
+
+#define osFreeLibrary ((BOOL(WINAPI*)(HMODULE))aSyscall[16].pCurrent)
+
+ { "GetCurrentProcessId", (SYSCALL)GetCurrentProcessId, 0 },
+
+#define osGetCurrentProcessId ((DWORD(WINAPI*)(VOID))aSyscall[17].pCurrent)
+
+#if !SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_ANSI)
+ { "GetDiskFreeSpaceA", (SYSCALL)GetDiskFreeSpaceA, 0 },
+#else
+ { "GetDiskFreeSpaceA", (SYSCALL)0, 0 },
+#endif
+
+#define osGetDiskFreeSpaceA ((BOOL(WINAPI*)(LPCSTR,LPDWORD,LPDWORD,LPDWORD, \
+ LPDWORD))aSyscall[18].pCurrent)
+
+#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE)
+ { "GetDiskFreeSpaceW", (SYSCALL)GetDiskFreeSpaceW, 0 },
+#else
+ { "GetDiskFreeSpaceW", (SYSCALL)0, 0 },
+#endif
+
+#define osGetDiskFreeSpaceW ((BOOL(WINAPI*)(LPCWSTR,LPDWORD,LPDWORD,LPDWORD, \
+ LPDWORD))aSyscall[19].pCurrent)
+
+#if defined(SQLITE_WIN32_HAS_ANSI)
+ { "GetFileAttributesA", (SYSCALL)GetFileAttributesA, 0 },
+#else
+ { "GetFileAttributesA", (SYSCALL)0, 0 },
+#endif
+
+#define osGetFileAttributesA ((DWORD(WINAPI*)(LPCSTR))aSyscall[20].pCurrent)
+
+#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE)
+ { "GetFileAttributesW", (SYSCALL)GetFileAttributesW, 0 },
+#else
+ { "GetFileAttributesW", (SYSCALL)0, 0 },
+#endif
+
+#define osGetFileAttributesW ((DWORD(WINAPI*)(LPCWSTR))aSyscall[21].pCurrent)
+
+#if defined(SQLITE_WIN32_HAS_WIDE)
+ { "GetFileAttributesExW", (SYSCALL)GetFileAttributesExW, 0 },
+#else
+ { "GetFileAttributesExW", (SYSCALL)0, 0 },
+#endif
+
+#define osGetFileAttributesExW ((BOOL(WINAPI*)(LPCWSTR,GET_FILEEX_INFO_LEVELS, \
+ LPVOID))aSyscall[22].pCurrent)
+
+#if !SQLITE_OS_WINRT
+ { "GetFileSize", (SYSCALL)GetFileSize, 0 },
+#else
+ { "GetFileSize", (SYSCALL)0, 0 },
+#endif
+
+#define osGetFileSize ((DWORD(WINAPI*)(HANDLE,LPDWORD))aSyscall[23].pCurrent)
+
+#if !SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_ANSI)
+ { "GetFullPathNameA", (SYSCALL)GetFullPathNameA, 0 },
+#else
+ { "GetFullPathNameA", (SYSCALL)0, 0 },
+#endif
+
+#define osGetFullPathNameA ((DWORD(WINAPI*)(LPCSTR,DWORD,LPSTR, \
+ LPSTR*))aSyscall[24].pCurrent)
+
+#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE)
+ { "GetFullPathNameW", (SYSCALL)GetFullPathNameW, 0 },
+#else
+ { "GetFullPathNameW", (SYSCALL)0, 0 },
+#endif
+
+#define osGetFullPathNameW ((DWORD(WINAPI*)(LPCWSTR,DWORD,LPWSTR, \
+ LPWSTR*))aSyscall[25].pCurrent)
+
+ { "GetLastError", (SYSCALL)GetLastError, 0 },
+
+#define osGetLastError ((DWORD(WINAPI*)(VOID))aSyscall[26].pCurrent)
+
+#if !defined(SQLITE_OMIT_LOAD_EXTENSION)
+#if SQLITE_OS_WINCE
+ /* The GetProcAddressA() routine is only available on Windows CE. */
+ { "GetProcAddressA", (SYSCALL)GetProcAddressA, 0 },
+#else
+ /* All other Windows platforms expect GetProcAddress() to take
+ ** an ANSI string regardless of the _UNICODE setting */
+ { "GetProcAddressA", (SYSCALL)GetProcAddress, 0 },
+#endif
+#else
+ { "GetProcAddressA", (SYSCALL)0, 0 },
+#endif
+
+#define osGetProcAddressA ((FARPROC(WINAPI*)(HMODULE, \
+ LPCSTR))aSyscall[27].pCurrent)
+
+#if !SQLITE_OS_WINRT
+ { "GetSystemInfo", (SYSCALL)GetSystemInfo, 0 },
+#else
+ { "GetSystemInfo", (SYSCALL)0, 0 },
+#endif
+
+#define osGetSystemInfo ((VOID(WINAPI*)(LPSYSTEM_INFO))aSyscall[28].pCurrent)
+
+ { "GetSystemTime", (SYSCALL)GetSystemTime, 0 },
+
+#define osGetSystemTime ((VOID(WINAPI*)(LPSYSTEMTIME))aSyscall[29].pCurrent)
+
+#if !SQLITE_OS_WINCE
+ { "GetSystemTimeAsFileTime", (SYSCALL)GetSystemTimeAsFileTime, 0 },
+#else
+ { "GetSystemTimeAsFileTime", (SYSCALL)0, 0 },
+#endif
+
+#define osGetSystemTimeAsFileTime ((VOID(WINAPI*)( \
+ LPFILETIME))aSyscall[30].pCurrent)
+
+#if defined(SQLITE_WIN32_HAS_ANSI)
+ { "GetTempPathA", (SYSCALL)GetTempPathA, 0 },
+#else
+ { "GetTempPathA", (SYSCALL)0, 0 },
+#endif
+
+#define osGetTempPathA ((DWORD(WINAPI*)(DWORD,LPSTR))aSyscall[31].pCurrent)
+
+#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE)
+ { "GetTempPathW", (SYSCALL)GetTempPathW, 0 },
+#else
+ { "GetTempPathW", (SYSCALL)0, 0 },
+#endif
+
+#define osGetTempPathW ((DWORD(WINAPI*)(DWORD,LPWSTR))aSyscall[32].pCurrent)
+
+#if !SQLITE_OS_WINRT
+ { "GetTickCount", (SYSCALL)GetTickCount, 0 },
+#else
+ { "GetTickCount", (SYSCALL)0, 0 },
+#endif
+
+#define osGetTickCount ((DWORD(WINAPI*)(VOID))aSyscall[33].pCurrent)
+
+#if defined(SQLITE_WIN32_HAS_ANSI) && SQLITE_WIN32_GETVERSIONEX
+ { "GetVersionExA", (SYSCALL)GetVersionExA, 0 },
+#else
+ { "GetVersionExA", (SYSCALL)0, 0 },
+#endif
+
+#define osGetVersionExA ((BOOL(WINAPI*)( \
+ LPOSVERSIONINFOA))aSyscall[34].pCurrent)
+
+#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) && \
+ SQLITE_WIN32_GETVERSIONEX
+ { "GetVersionExW", (SYSCALL)GetVersionExW, 0 },
+#else
+ { "GetVersionExW", (SYSCALL)0, 0 },
+#endif
+
+#define osGetVersionExW ((BOOL(WINAPI*)( \
+ LPOSVERSIONINFOW))aSyscall[35].pCurrent)
+
+ { "HeapAlloc", (SYSCALL)HeapAlloc, 0 },
+
+#define osHeapAlloc ((LPVOID(WINAPI*)(HANDLE,DWORD, \
+ SIZE_T))aSyscall[36].pCurrent)
+
+#if !SQLITE_OS_WINRT
+ { "HeapCreate", (SYSCALL)HeapCreate, 0 },
+#else
+ { "HeapCreate", (SYSCALL)0, 0 },
+#endif
+
+#define osHeapCreate ((HANDLE(WINAPI*)(DWORD,SIZE_T, \
+ SIZE_T))aSyscall[37].pCurrent)
+
+#if !SQLITE_OS_WINRT
+ { "HeapDestroy", (SYSCALL)HeapDestroy, 0 },
+#else
+ { "HeapDestroy", (SYSCALL)0, 0 },
+#endif
+
+#define osHeapDestroy ((BOOL(WINAPI*)(HANDLE))aSyscall[38].pCurrent)
+
+ { "HeapFree", (SYSCALL)HeapFree, 0 },
+
+#define osHeapFree ((BOOL(WINAPI*)(HANDLE,DWORD,LPVOID))aSyscall[39].pCurrent)
+
+ { "HeapReAlloc", (SYSCALL)HeapReAlloc, 0 },
+
+#define osHeapReAlloc ((LPVOID(WINAPI*)(HANDLE,DWORD,LPVOID, \
+ SIZE_T))aSyscall[40].pCurrent)
+
+ { "HeapSize", (SYSCALL)HeapSize, 0 },
+
+#define osHeapSize ((SIZE_T(WINAPI*)(HANDLE,DWORD, \
+ LPCVOID))aSyscall[41].pCurrent)
+
+#if !SQLITE_OS_WINRT
+ { "HeapValidate", (SYSCALL)HeapValidate, 0 },
+#else
+ { "HeapValidate", (SYSCALL)0, 0 },
+#endif
+
+#define osHeapValidate ((BOOL(WINAPI*)(HANDLE,DWORD, \
+ LPCVOID))aSyscall[42].pCurrent)
+
+#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
+ { "HeapCompact", (SYSCALL)HeapCompact, 0 },
+#else
+ { "HeapCompact", (SYSCALL)0, 0 },
+#endif
+
+#define osHeapCompact ((UINT(WINAPI*)(HANDLE,DWORD))aSyscall[43].pCurrent)
+
+#if defined(SQLITE_WIN32_HAS_ANSI) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
+ { "LoadLibraryA", (SYSCALL)LoadLibraryA, 0 },
+#else
+ { "LoadLibraryA", (SYSCALL)0, 0 },
+#endif
+
+#define osLoadLibraryA ((HMODULE(WINAPI*)(LPCSTR))aSyscall[44].pCurrent)
+
+#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) && \
+ !defined(SQLITE_OMIT_LOAD_EXTENSION)
+ { "LoadLibraryW", (SYSCALL)LoadLibraryW, 0 },
+#else
+ { "LoadLibraryW", (SYSCALL)0, 0 },
+#endif
+
+#define osLoadLibraryW ((HMODULE(WINAPI*)(LPCWSTR))aSyscall[45].pCurrent)
+
+#if !SQLITE_OS_WINRT
+ { "LocalFree", (SYSCALL)LocalFree, 0 },
+#else
+ { "LocalFree", (SYSCALL)0, 0 },
+#endif
+
+#define osLocalFree ((HLOCAL(WINAPI*)(HLOCAL))aSyscall[46].pCurrent)
+
+#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
+ { "LockFile", (SYSCALL)LockFile, 0 },
+#else
+ { "LockFile", (SYSCALL)0, 0 },
+#endif
+
+#ifndef osLockFile
+#define osLockFile ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \
+ DWORD))aSyscall[47].pCurrent)
+#endif
+
+#if !SQLITE_OS_WINCE
+ { "LockFileEx", (SYSCALL)LockFileEx, 0 },
+#else
+ { "LockFileEx", (SYSCALL)0, 0 },
+#endif
+
+#ifndef osLockFileEx
+#define osLockFileEx ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD,DWORD, \
+ LPOVERLAPPED))aSyscall[48].pCurrent)
+#endif
+
+#if SQLITE_OS_WINCE || (!SQLITE_OS_WINRT && \
+ (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0))
+ { "MapViewOfFile", (SYSCALL)MapViewOfFile, 0 },
+#else
+ { "MapViewOfFile", (SYSCALL)0, 0 },
+#endif
+
+#define osMapViewOfFile ((LPVOID(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \
+ SIZE_T))aSyscall[49].pCurrent)
+
+ { "MultiByteToWideChar", (SYSCALL)MultiByteToWideChar, 0 },
+
+#define osMultiByteToWideChar ((int(WINAPI*)(UINT,DWORD,LPCSTR,int,LPWSTR, \
+ int))aSyscall[50].pCurrent)
+
+ { "QueryPerformanceCounter", (SYSCALL)QueryPerformanceCounter, 0 },
+
+#define osQueryPerformanceCounter ((BOOL(WINAPI*)( \
+ LARGE_INTEGER*))aSyscall[51].pCurrent)
+
+ { "ReadFile", (SYSCALL)ReadFile, 0 },
+
+#define osReadFile ((BOOL(WINAPI*)(HANDLE,LPVOID,DWORD,LPDWORD, \
+ LPOVERLAPPED))aSyscall[52].pCurrent)
+
+ { "SetEndOfFile", (SYSCALL)SetEndOfFile, 0 },
+
+#define osSetEndOfFile ((BOOL(WINAPI*)(HANDLE))aSyscall[53].pCurrent)
+
+#if !SQLITE_OS_WINRT
+ { "SetFilePointer", (SYSCALL)SetFilePointer, 0 },
+#else
+ { "SetFilePointer", (SYSCALL)0, 0 },
+#endif
+
+#define osSetFilePointer ((DWORD(WINAPI*)(HANDLE,LONG,PLONG, \
+ DWORD))aSyscall[54].pCurrent)
+
+#if !SQLITE_OS_WINRT
+ { "Sleep", (SYSCALL)Sleep, 0 },
+#else
+ { "Sleep", (SYSCALL)0, 0 },
+#endif
+
+#define osSleep ((VOID(WINAPI*)(DWORD))aSyscall[55].pCurrent)
+
+ { "SystemTimeToFileTime", (SYSCALL)SystemTimeToFileTime, 0 },
+
+#define osSystemTimeToFileTime ((BOOL(WINAPI*)(CONST SYSTEMTIME*, \
+ LPFILETIME))aSyscall[56].pCurrent)
+
+#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
+ { "UnlockFile", (SYSCALL)UnlockFile, 0 },
+#else
+ { "UnlockFile", (SYSCALL)0, 0 },
+#endif
+
+#ifndef osUnlockFile
+#define osUnlockFile ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \
+ DWORD))aSyscall[57].pCurrent)
+#endif
+
+#if !SQLITE_OS_WINCE
+ { "UnlockFileEx", (SYSCALL)UnlockFileEx, 0 },
+#else
+ { "UnlockFileEx", (SYSCALL)0, 0 },
+#endif
+
+#define osUnlockFileEx ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \
+ LPOVERLAPPED))aSyscall[58].pCurrent)
+
+#if SQLITE_OS_WINCE || !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0
+ { "UnmapViewOfFile", (SYSCALL)UnmapViewOfFile, 0 },
+#else
+ { "UnmapViewOfFile", (SYSCALL)0, 0 },
+#endif
+
+#define osUnmapViewOfFile ((BOOL(WINAPI*)(LPCVOID))aSyscall[59].pCurrent)
+
+ { "WideCharToMultiByte", (SYSCALL)WideCharToMultiByte, 0 },
+
+#define osWideCharToMultiByte ((int(WINAPI*)(UINT,DWORD,LPCWSTR,int,LPSTR,int, \
+ LPCSTR,LPBOOL))aSyscall[60].pCurrent)
+
+ { "WriteFile", (SYSCALL)WriteFile, 0 },
+
+#define osWriteFile ((BOOL(WINAPI*)(HANDLE,LPCVOID,DWORD,LPDWORD, \
+ LPOVERLAPPED))aSyscall[61].pCurrent)
+
+#if SQLITE_OS_WINRT
+ { "CreateEventExW", (SYSCALL)CreateEventExW, 0 },
+#else
+ { "CreateEventExW", (SYSCALL)0, 0 },
+#endif
+
+#define osCreateEventExW ((HANDLE(WINAPI*)(LPSECURITY_ATTRIBUTES,LPCWSTR, \
+ DWORD,DWORD))aSyscall[62].pCurrent)
+
+#if !SQLITE_OS_WINRT
+ { "WaitForSingleObject", (SYSCALL)WaitForSingleObject, 0 },
+#else
+ { "WaitForSingleObject", (SYSCALL)0, 0 },
+#endif
+
+#define osWaitForSingleObject ((DWORD(WINAPI*)(HANDLE, \
+ DWORD))aSyscall[63].pCurrent)
+
+#if !SQLITE_OS_WINCE
+ { "WaitForSingleObjectEx", (SYSCALL)WaitForSingleObjectEx, 0 },
+#else
+ { "WaitForSingleObjectEx", (SYSCALL)0, 0 },
+#endif
+
+#define osWaitForSingleObjectEx ((DWORD(WINAPI*)(HANDLE,DWORD, \
+ BOOL))aSyscall[64].pCurrent)
+
+#if SQLITE_OS_WINRT
+ { "SetFilePointerEx", (SYSCALL)SetFilePointerEx, 0 },
+#else
+ { "SetFilePointerEx", (SYSCALL)0, 0 },
+#endif
+
+#define osSetFilePointerEx ((BOOL(WINAPI*)(HANDLE,LARGE_INTEGER, \
+ PLARGE_INTEGER,DWORD))aSyscall[65].pCurrent)
+
+#if SQLITE_OS_WINRT
+ { "GetFileInformationByHandleEx", (SYSCALL)GetFileInformationByHandleEx, 0 },
+#else
+ { "GetFileInformationByHandleEx", (SYSCALL)0, 0 },
+#endif
+
+#define osGetFileInformationByHandleEx ((BOOL(WINAPI*)(HANDLE, \
+ FILE_INFO_BY_HANDLE_CLASS,LPVOID,DWORD))aSyscall[66].pCurrent)
+
+#if SQLITE_OS_WINRT && (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0)
+ { "MapViewOfFileFromApp", (SYSCALL)MapViewOfFileFromApp, 0 },
+#else
+ { "MapViewOfFileFromApp", (SYSCALL)0, 0 },
+#endif
+
+#define osMapViewOfFileFromApp ((LPVOID(WINAPI*)(HANDLE,ULONG,ULONG64, \
+ SIZE_T))aSyscall[67].pCurrent)
+
+#if SQLITE_OS_WINRT
+ { "CreateFile2", (SYSCALL)CreateFile2, 0 },
+#else
+ { "CreateFile2", (SYSCALL)0, 0 },
+#endif
+
+#define osCreateFile2 ((HANDLE(WINAPI*)(LPCWSTR,DWORD,DWORD,DWORD, \
+ LPCREATEFILE2_EXTENDED_PARAMETERS))aSyscall[68].pCurrent)
+
+#if SQLITE_OS_WINRT && !defined(SQLITE_OMIT_LOAD_EXTENSION)
+ { "LoadPackagedLibrary", (SYSCALL)LoadPackagedLibrary, 0 },
+#else
+ { "LoadPackagedLibrary", (SYSCALL)0, 0 },
+#endif
+
+#define osLoadPackagedLibrary ((HMODULE(WINAPI*)(LPCWSTR, \
+ DWORD))aSyscall[69].pCurrent)
+
+#if SQLITE_OS_WINRT
+ { "GetTickCount64", (SYSCALL)GetTickCount64, 0 },
+#else
+ { "GetTickCount64", (SYSCALL)0, 0 },
+#endif
+
+#define osGetTickCount64 ((ULONGLONG(WINAPI*)(VOID))aSyscall[70].pCurrent)
+
+#if SQLITE_OS_WINRT
+ { "GetNativeSystemInfo", (SYSCALL)GetNativeSystemInfo, 0 },
+#else
+ { "GetNativeSystemInfo", (SYSCALL)0, 0 },
+#endif
+
+#define osGetNativeSystemInfo ((VOID(WINAPI*)( \
+ LPSYSTEM_INFO))aSyscall[71].pCurrent)
+
+#if defined(SQLITE_WIN32_HAS_ANSI)
+ { "OutputDebugStringA", (SYSCALL)OutputDebugStringA, 0 },
+#else
+ { "OutputDebugStringA", (SYSCALL)0, 0 },
+#endif
+
+#define osOutputDebugStringA ((VOID(WINAPI*)(LPCSTR))aSyscall[72].pCurrent)
+
+#if defined(SQLITE_WIN32_HAS_WIDE)
+ { "OutputDebugStringW", (SYSCALL)OutputDebugStringW, 0 },
+#else
+ { "OutputDebugStringW", (SYSCALL)0, 0 },
+#endif
+
+#define osOutputDebugStringW ((VOID(WINAPI*)(LPCWSTR))aSyscall[73].pCurrent)
+
+ { "GetProcessHeap", (SYSCALL)GetProcessHeap, 0 },
+
+#define osGetProcessHeap ((HANDLE(WINAPI*)(VOID))aSyscall[74].pCurrent)
+
+#if SQLITE_OS_WINRT && (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0)
+ { "CreateFileMappingFromApp", (SYSCALL)CreateFileMappingFromApp, 0 },
+#else
+ { "CreateFileMappingFromApp", (SYSCALL)0, 0 },
+#endif
+
+#define osCreateFileMappingFromApp ((HANDLE(WINAPI*)(HANDLE, \
+ LPSECURITY_ATTRIBUTES,ULONG,ULONG64,LPCWSTR))aSyscall[75].pCurrent)
+
+/*
+** NOTE: On some sub-platforms, the InterlockedCompareExchange "function"
+** is really just a macro that uses a compiler intrinsic (e.g. x64).
+** So do not try to make this is into a redefinable interface.
+*/
+#if defined(InterlockedCompareExchange)
+ { "InterlockedCompareExchange", (SYSCALL)0, 0 },
+
+#define osInterlockedCompareExchange InterlockedCompareExchange
+#else
+ { "InterlockedCompareExchange", (SYSCALL)InterlockedCompareExchange, 0 },
+
+#define osInterlockedCompareExchange ((LONG(WINAPI*)(LONG \
+ SQLITE_WIN32_VOLATILE*, LONG,LONG))aSyscall[76].pCurrent)
+#endif /* defined(InterlockedCompareExchange) */
+
+#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID
+ { "UuidCreate", (SYSCALL)UuidCreate, 0 },
+#else
+ { "UuidCreate", (SYSCALL)0, 0 },
+#endif
+
+#define osUuidCreate ((RPC_STATUS(RPC_ENTRY*)(UUID*))aSyscall[77].pCurrent)
+
+#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID
+ { "UuidCreateSequential", (SYSCALL)UuidCreateSequential, 0 },
+#else
+ { "UuidCreateSequential", (SYSCALL)0, 0 },
+#endif
+
+#define osUuidCreateSequential \
+ ((RPC_STATUS(RPC_ENTRY*)(UUID*))aSyscall[78].pCurrent)
+
+#if !defined(SQLITE_NO_SYNC) && SQLITE_MAX_MMAP_SIZE>0
+ { "FlushViewOfFile", (SYSCALL)FlushViewOfFile, 0 },
+#else
+ { "FlushViewOfFile", (SYSCALL)0, 0 },
+#endif
+
+#define osFlushViewOfFile \
+ ((BOOL(WINAPI*)(LPCVOID,SIZE_T))aSyscall[79].pCurrent)
+
+}; /* End of the overrideable system calls */
+
+/*
+** This is the xSetSystemCall() method of sqlite3_vfs for all of the
+** "win32" VFSes. Return SQLITE_OK upon successfully updating the
+** system call pointer, or SQLITE_NOTFOUND if there is no configurable
+** system call named zName.
+*/
+static int winSetSystemCall(
+ sqlite3_vfs *pNotUsed, /* The VFS pointer. Not used */
+ const char *zName, /* Name of system call to override */
+ sqlite3_syscall_ptr pNewFunc /* Pointer to new system call value */
+){
+ unsigned int i;
+ int rc = SQLITE_NOTFOUND;
+
+ UNUSED_PARAMETER(pNotUsed);
+ if( zName==0 ){
+ /* If no zName is given, restore all system calls to their default
+ ** settings and return NULL
+ */
+ rc = SQLITE_OK;
+ for(i=0; i<sizeof(aSyscall)/sizeof(aSyscall[0]); i++){
+ if( aSyscall[i].pDefault ){
+ aSyscall[i].pCurrent = aSyscall[i].pDefault;
+ }
+ }
+ }else{
+ /* If zName is specified, operate on only the one system call
+ ** specified.
+ */
+ for(i=0; i<sizeof(aSyscall)/sizeof(aSyscall[0]); i++){
+ if( strcmp(zName, aSyscall[i].zName)==0 ){
+ if( aSyscall[i].pDefault==0 ){
+ aSyscall[i].pDefault = aSyscall[i].pCurrent;
+ }
+ rc = SQLITE_OK;
+ if( pNewFunc==0 ) pNewFunc = aSyscall[i].pDefault;
+ aSyscall[i].pCurrent = pNewFunc;
+ break;
+ }
+ }
+ }
+ return rc;
+}
+
+/*
+** Return the value of a system call. Return NULL if zName is not a
+** recognized system call name. NULL is also returned if the system call
+** is currently undefined.
+*/
+static sqlite3_syscall_ptr winGetSystemCall(
+ sqlite3_vfs *pNotUsed,
+ const char *zName
+){
+ unsigned int i;
+
+ UNUSED_PARAMETER(pNotUsed);
+ for(i=0; i<sizeof(aSyscall)/sizeof(aSyscall[0]); i++){
+ if( strcmp(zName, aSyscall[i].zName)==0 ) return aSyscall[i].pCurrent;
+ }
+ return 0;
+}
+
+/*
+** Return the name of the first system call after zName. If zName==NULL
+** then return the name of the first system call. Return NULL if zName
+** is the last system call or if zName is not the name of a valid
+** system call.
+*/
+static const char *winNextSystemCall(sqlite3_vfs *p, const char *zName){
+ int i = -1;
+
+ UNUSED_PARAMETER(p);
+ if( zName ){
+ for(i=0; i<ArraySize(aSyscall)-1; i++){
+ if( strcmp(zName, aSyscall[i].zName)==0 ) break;
+ }
+ }
+ for(i++; i<ArraySize(aSyscall); i++){
+ if( aSyscall[i].pCurrent!=0 ) return aSyscall[i].zName;
+ }
+ return 0;
+}
+
+#ifdef SQLITE_WIN32_MALLOC
+/*
+** If a Win32 native heap has been configured, this function will attempt to
+** compact it. Upon success, SQLITE_OK will be returned. Upon failure, one
+** of SQLITE_NOMEM, SQLITE_ERROR, or SQLITE_NOTFOUND will be returned. The
+** "pnLargest" argument, if non-zero, will be used to return the size of the
+** largest committed free block in the heap, in bytes.
+*/
+SQLITE_API int sqlite3_win32_compact_heap(LPUINT pnLargest){
+ int rc = SQLITE_OK;
+ UINT nLargest = 0;
+ HANDLE hHeap;
+
+ winMemAssertMagic();
+ hHeap = winMemGetHeap();
+ assert( hHeap!=0 );
+ assert( hHeap!=INVALID_HANDLE_VALUE );
+#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE)
+ assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );
+#endif
+#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
+ if( (nLargest=osHeapCompact(hHeap, SQLITE_WIN32_HEAP_FLAGS))==0 ){
+ DWORD lastErrno = osGetLastError();
+ if( lastErrno==NO_ERROR ){
+ sqlite3_log(SQLITE_NOMEM, "failed to HeapCompact (no space), heap=%p",
+ (void*)hHeap);
+ rc = SQLITE_NOMEM_BKPT;
+ }else{
+ sqlite3_log(SQLITE_ERROR, "failed to HeapCompact (%lu), heap=%p",
+ osGetLastError(), (void*)hHeap);
+ rc = SQLITE_ERROR;
+ }
+ }
+#else
+ sqlite3_log(SQLITE_NOTFOUND, "failed to HeapCompact, heap=%p",
+ (void*)hHeap);
+ rc = SQLITE_NOTFOUND;
+#endif
+ if( pnLargest ) *pnLargest = nLargest;
+ return rc;
+}
+
+/*
+** If a Win32 native heap has been configured, this function will attempt to
+** destroy and recreate it. If the Win32 native heap is not isolated and/or
+** the sqlite3_memory_used() function does not return zero, SQLITE_BUSY will
+** be returned and no changes will be made to the Win32 native heap.
+*/
+SQLITE_API int sqlite3_win32_reset_heap(){
+ int rc;
+ MUTEX_LOGIC( sqlite3_mutex *pMainMtx; ) /* The main static mutex */
+ MUTEX_LOGIC( sqlite3_mutex *pMem; ) /* The memsys static mutex */
+ MUTEX_LOGIC( pMainMtx = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MAIN); )
+ MUTEX_LOGIC( pMem = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM); )
+ sqlite3_mutex_enter(pMainMtx);
+ sqlite3_mutex_enter(pMem);
+ winMemAssertMagic();
+ if( winMemGetHeap()!=NULL && winMemGetOwned() && sqlite3_memory_used()==0 ){
+ /*
+ ** At this point, there should be no outstanding memory allocations on
+ ** the heap. Also, since both the main and memsys locks are currently
+ ** being held by us, no other function (i.e. from another thread) should
+ ** be able to even access the heap. Attempt to destroy and recreate our
+ ** isolated Win32 native heap now.
+ */
+ assert( winMemGetHeap()!=NULL );
+ assert( winMemGetOwned() );
+ assert( sqlite3_memory_used()==0 );
+ winMemShutdown(winMemGetDataPtr());
+ assert( winMemGetHeap()==NULL );
+ assert( !winMemGetOwned() );
+ assert( sqlite3_memory_used()==0 );
+ rc = winMemInit(winMemGetDataPtr());
+ assert( rc!=SQLITE_OK || winMemGetHeap()!=NULL );
+ assert( rc!=SQLITE_OK || winMemGetOwned() );
+ assert( rc!=SQLITE_OK || sqlite3_memory_used()==0 );
+ }else{
+ /*
+ ** The Win32 native heap cannot be modified because it may be in use.
+ */
+ rc = SQLITE_BUSY;
+ }
+ sqlite3_mutex_leave(pMem);
+ sqlite3_mutex_leave(pMainMtx);
+ return rc;
+}
+#endif /* SQLITE_WIN32_MALLOC */
+
+/*
+** This function outputs the specified (ANSI) string to the Win32 debugger
+** (if available).
+*/
+
+SQLITE_API void sqlite3_win32_write_debug(const char *zBuf, int nBuf){
+ char zDbgBuf[SQLITE_WIN32_DBG_BUF_SIZE];
+ int nMin = MIN(nBuf, (SQLITE_WIN32_DBG_BUF_SIZE - 1)); /* may be negative. */
+ if( nMin<-1 ) nMin = -1; /* all negative values become -1. */
+ assert( nMin==-1 || nMin==0 || nMin<SQLITE_WIN32_DBG_BUF_SIZE );
+#ifdef SQLITE_ENABLE_API_ARMOR
+ if( !zBuf ){
+ (void)SQLITE_MISUSE_BKPT;
+ return;
+ }
+#endif
+#if defined(SQLITE_WIN32_HAS_ANSI)
+ if( nMin>0 ){
+ memset(zDbgBuf, 0, SQLITE_WIN32_DBG_BUF_SIZE);
+ memcpy(zDbgBuf, zBuf, nMin);
+ osOutputDebugStringA(zDbgBuf);
+ }else{
+ osOutputDebugStringA(zBuf);
+ }
+#elif defined(SQLITE_WIN32_HAS_WIDE)
+ memset(zDbgBuf, 0, SQLITE_WIN32_DBG_BUF_SIZE);
+ if ( osMultiByteToWideChar(
+ osAreFileApisANSI() ? CP_ACP : CP_OEMCP, 0, zBuf,
+ nMin, (LPWSTR)zDbgBuf, SQLITE_WIN32_DBG_BUF_SIZE/sizeof(WCHAR))<=0 ){
+ return;
+ }
+ osOutputDebugStringW((LPCWSTR)zDbgBuf);
+#else
+ if( nMin>0 ){
+ memset(zDbgBuf, 0, SQLITE_WIN32_DBG_BUF_SIZE);
+ memcpy(zDbgBuf, zBuf, nMin);
+ fprintf(stderr, "%s", zDbgBuf);
+ }else{
+ fprintf(stderr, "%s", zBuf);
+ }
+#endif
+}
+
+/*
+** The following routine suspends the current thread for at least ms
+** milliseconds. This is equivalent to the Win32 Sleep() interface.
+*/
+#if SQLITE_OS_WINRT
+static HANDLE sleepObj = NULL;
+#endif
+
+SQLITE_API void sqlite3_win32_sleep(DWORD milliseconds){
+#if SQLITE_OS_WINRT
+ if ( sleepObj==NULL ){
+ sleepObj = osCreateEventExW(NULL, NULL, CREATE_EVENT_MANUAL_RESET,
+ SYNCHRONIZE);
+ }
+ assert( sleepObj!=NULL );
+ osWaitForSingleObjectEx(sleepObj, milliseconds, FALSE);
+#else
+ osSleep(milliseconds);
+#endif
+}
+
+#if SQLITE_MAX_WORKER_THREADS>0 && !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && \
+ SQLITE_THREADSAFE>0
+SQLITE_PRIVATE DWORD sqlite3Win32Wait(HANDLE hObject){
+ DWORD rc;
+ while( (rc = osWaitForSingleObjectEx(hObject, INFINITE,
+ TRUE))==WAIT_IO_COMPLETION ){}
+ return rc;
+}
+#endif
+
+/*
+** Return true (non-zero) if we are running under WinNT, Win2K, WinXP,
+** or WinCE. Return false (zero) for Win95, Win98, or WinME.
+**
+** Here is an interesting observation: Win95, Win98, and WinME lack
+** the LockFileEx() API. But we can still statically link against that
+** API as long as we don't call it when running Win95/98/ME. A call to
+** this routine is used to determine if the host is Win95/98/ME or
+** WinNT/2K/XP so that we will know whether or not we can safely call
+** the LockFileEx() API.
+*/
+
+#if !SQLITE_WIN32_GETVERSIONEX
+# define osIsNT() (1)
+#elif SQLITE_OS_WINCE || SQLITE_OS_WINRT || !defined(SQLITE_WIN32_HAS_ANSI)
+# define osIsNT() (1)
+#elif !defined(SQLITE_WIN32_HAS_WIDE)
+# define osIsNT() (0)
+#else
+# define osIsNT() ((sqlite3_os_type==2) || sqlite3_win32_is_nt())
+#endif
+
+/*
+** This function determines if the machine is running a version of Windows
+** based on the NT kernel.
+*/
+SQLITE_API int sqlite3_win32_is_nt(void){
+#if SQLITE_OS_WINRT
+ /*
+ ** NOTE: The WinRT sub-platform is always assumed to be based on the NT
+ ** kernel.
+ */
+ return 1;
+#elif SQLITE_WIN32_GETVERSIONEX
+ if( osInterlockedCompareExchange(&sqlite3_os_type, 0, 0)==0 ){
+#if defined(SQLITE_WIN32_HAS_ANSI)
+ OSVERSIONINFOA sInfo;
+ sInfo.dwOSVersionInfoSize = sizeof(sInfo);
+ osGetVersionExA(&sInfo);
+ osInterlockedCompareExchange(&sqlite3_os_type,
+ (sInfo.dwPlatformId == VER_PLATFORM_WIN32_NT) ? 2 : 1, 0);
+#elif defined(SQLITE_WIN32_HAS_WIDE)
+ OSVERSIONINFOW sInfo;
+ sInfo.dwOSVersionInfoSize = sizeof(sInfo);
+ osGetVersionExW(&sInfo);
+ osInterlockedCompareExchange(&sqlite3_os_type,
+ (sInfo.dwPlatformId == VER_PLATFORM_WIN32_NT) ? 2 : 1, 0);
+#endif
+ }
+ return osInterlockedCompareExchange(&sqlite3_os_type, 2, 2)==2;
+#elif SQLITE_TEST
+ return osInterlockedCompareExchange(&sqlite3_os_type, 2, 2)==2;
+#else
+ /*
+ ** NOTE: All sub-platforms where the GetVersionEx[AW] functions are
+ ** deprecated are always assumed to be based on the NT kernel.
+ */
+ return 1;
+#endif
+}
+
+#ifdef SQLITE_WIN32_MALLOC
+/*
+** Allocate nBytes of memory.
+*/
+static void *winMemMalloc(int nBytes){
+ HANDLE hHeap;
+ void *p;
+
+ winMemAssertMagic();
+ hHeap = winMemGetHeap();
+ assert( hHeap!=0 );
+ assert( hHeap!=INVALID_HANDLE_VALUE );
+#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE)
+ assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );
+#endif
+ assert( nBytes>=0 );
+ p = osHeapAlloc(hHeap, SQLITE_WIN32_HEAP_FLAGS, (SIZE_T)nBytes);
+ if( !p ){
+ sqlite3_log(SQLITE_NOMEM, "failed to HeapAlloc %u bytes (%lu), heap=%p",
+ nBytes, osGetLastError(), (void*)hHeap);
+ }
+ return p;
+}
+
+/*
+** Free memory.
+*/
+static void winMemFree(void *pPrior){
+ HANDLE hHeap;
+
+ winMemAssertMagic();
+ hHeap = winMemGetHeap();
+ assert( hHeap!=0 );
+ assert( hHeap!=INVALID_HANDLE_VALUE );
+#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE)
+ assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) );
+#endif
+ if( !pPrior ) return; /* Passing NULL to HeapFree is undefined. */
+ if( !osHeapFree(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) ){
+ sqlite3_log(SQLITE_NOMEM, "failed to HeapFree block %p (%lu), heap=%p",
+ pPrior, osGetLastError(), (void*)hHeap);
+ }
+}
+
+/*
+** Change the size of an existing memory allocation
+*/
+static void *winMemRealloc(void *pPrior, int nBytes){
+ HANDLE hHeap;
+ void *p;
+
+ winMemAssertMagic();
+ hHeap = winMemGetHeap();
+ assert( hHeap!=0 );
+ assert( hHeap!=INVALID_HANDLE_VALUE );
+#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE)
+ assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) );
+#endif
+ assert( nBytes>=0 );
+ if( !pPrior ){
+ p = osHeapAlloc(hHeap, SQLITE_WIN32_HEAP_FLAGS, (SIZE_T)nBytes);
+ }else{
+ p = osHeapReAlloc(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior, (SIZE_T)nBytes);
+ }
+ if( !p ){
+ sqlite3_log(SQLITE_NOMEM, "failed to %s %u bytes (%lu), heap=%p",
+ pPrior ? "HeapReAlloc" : "HeapAlloc", nBytes, osGetLastError(),
+ (void*)hHeap);
+ }
+ return p;
+}
+
+/*
+** Return the size of an outstanding allocation, in bytes.
+*/
+static int winMemSize(void *p){
+ HANDLE hHeap;
+ SIZE_T n;
+
+ winMemAssertMagic();
+ hHeap = winMemGetHeap();
+ assert( hHeap!=0 );
+ assert( hHeap!=INVALID_HANDLE_VALUE );
+#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE)
+ assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, p) );
+#endif
+ if( !p ) return 0;
+ n = osHeapSize(hHeap, SQLITE_WIN32_HEAP_FLAGS, p);
+ if( n==(SIZE_T)-1 ){
+ sqlite3_log(SQLITE_NOMEM, "failed to HeapSize block %p (%lu), heap=%p",
+ p, osGetLastError(), (void*)hHeap);
+ return 0;
+ }
+ return (int)n;
+}
+
+/*
+** Round up a request size to the next valid allocation size.
+*/
+static int winMemRoundup(int n){
+ return n;
+}
+
+/*
+** Initialize this module.
+*/
+static int winMemInit(void *pAppData){
+ winMemData *pWinMemData = (winMemData *)pAppData;
+
+ if( !pWinMemData ) return SQLITE_ERROR;
+ assert( pWinMemData->magic1==WINMEM_MAGIC1 );
+ assert( pWinMemData->magic2==WINMEM_MAGIC2 );
+
+#if !SQLITE_OS_WINRT && SQLITE_WIN32_HEAP_CREATE
+ if( !pWinMemData->hHeap ){
+ DWORD dwInitialSize = SQLITE_WIN32_HEAP_INIT_SIZE;
+ DWORD dwMaximumSize = (DWORD)sqlite3GlobalConfig.nHeap;
+ if( dwMaximumSize==0 ){
+ dwMaximumSize = SQLITE_WIN32_HEAP_MAX_SIZE;
+ }else if( dwInitialSize>dwMaximumSize ){
+ dwInitialSize = dwMaximumSize;
+ }
+ pWinMemData->hHeap = osHeapCreate(SQLITE_WIN32_HEAP_FLAGS,
+ dwInitialSize, dwMaximumSize);
+ if( !pWinMemData->hHeap ){
+ sqlite3_log(SQLITE_NOMEM,
+ "failed to HeapCreate (%lu), flags=%u, initSize=%lu, maxSize=%lu",
+ osGetLastError(), SQLITE_WIN32_HEAP_FLAGS, dwInitialSize,
+ dwMaximumSize);
+ return SQLITE_NOMEM_BKPT;
+ }
+ pWinMemData->bOwned = TRUE;
+ assert( pWinMemData->bOwned );
+ }
+#else
+ pWinMemData->hHeap = osGetProcessHeap();
+ if( !pWinMemData->hHeap ){
+ sqlite3_log(SQLITE_NOMEM,
+ "failed to GetProcessHeap (%lu)", osGetLastError());
+ return SQLITE_NOMEM_BKPT;
+ }
+ pWinMemData->bOwned = FALSE;
+ assert( !pWinMemData->bOwned );
+#endif
+ assert( pWinMemData->hHeap!=0 );
+ assert( pWinMemData->hHeap!=INVALID_HANDLE_VALUE );
+#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE)
+ assert( osHeapValidate(pWinMemData->hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );
+#endif
+ return SQLITE_OK;
+}
+
+/*
+** Deinitialize this module.
+*/
+static void winMemShutdown(void *pAppData){
+ winMemData *pWinMemData = (winMemData *)pAppData;
+
+ if( !pWinMemData ) return;
+ assert( pWinMemData->magic1==WINMEM_MAGIC1 );
+ assert( pWinMemData->magic2==WINMEM_MAGIC2 );
+
+ if( pWinMemData->hHeap ){
+ assert( pWinMemData->hHeap!=INVALID_HANDLE_VALUE );
+#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE)
+ assert( osHeapValidate(pWinMemData->hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );
+#endif
+ if( pWinMemData->bOwned ){
+ if( !osHeapDestroy(pWinMemData->hHeap) ){
+ sqlite3_log(SQLITE_NOMEM, "failed to HeapDestroy (%lu), heap=%p",
+ osGetLastError(), (void*)pWinMemData->hHeap);
+ }
+ pWinMemData->bOwned = FALSE;
+ }
+ pWinMemData->hHeap = NULL;
+ }
+}
+
+/*
+** Populate the low-level memory allocation function pointers in
+** sqlite3GlobalConfig.m with pointers to the routines in this file. The
+** arguments specify the block of memory to manage.
+**
+** This routine is only called by sqlite3_config(), and therefore
+** is not required to be threadsafe (it is not).
+*/
+SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetWin32(void){
+ static const sqlite3_mem_methods winMemMethods = {
+ winMemMalloc,
+ winMemFree,
+ winMemRealloc,
+ winMemSize,
+ winMemRoundup,
+ winMemInit,
+ winMemShutdown,
+ &win_mem_data
+ };
+ return &winMemMethods;
+}
+
+SQLITE_PRIVATE void sqlite3MemSetDefault(void){
+ sqlite3_config(SQLITE_CONFIG_MALLOC, sqlite3MemGetWin32());
+}
+#endif /* SQLITE_WIN32_MALLOC */
+
+/*
+** Convert a UTF-8 string to Microsoft Unicode.
+**
+** Space to hold the returned string is obtained from sqlite3_malloc().
+*/
+static LPWSTR winUtf8ToUnicode(const char *zText){
+ int nChar;
+ LPWSTR zWideText;
+
+ nChar = osMultiByteToWideChar(CP_UTF8, 0, zText, -1, NULL, 0);
+ if( nChar==0 ){
+ return 0;
+ }
+ zWideText = sqlite3MallocZero( nChar*sizeof(WCHAR) );
+ if( zWideText==0 ){
+ return 0;
+ }
+ nChar = osMultiByteToWideChar(CP_UTF8, 0, zText, -1, zWideText,
+ nChar);
+ if( nChar==0 ){
+ sqlite3_free(zWideText);
+ zWideText = 0;
+ }
+ return zWideText;
+}
+
+/*
+** Convert a Microsoft Unicode string to UTF-8.
+**
+** Space to hold the returned string is obtained from sqlite3_malloc().
+*/
+static char *winUnicodeToUtf8(LPCWSTR zWideText){
+ int nByte;
+ char *zText;
+
+ nByte = osWideCharToMultiByte(CP_UTF8, 0, zWideText, -1, 0, 0, 0, 0);
+ if( nByte == 0 ){
+ return 0;
+ }
+ zText = sqlite3MallocZero( nByte );
+ if( zText==0 ){
+ return 0;
+ }
+ nByte = osWideCharToMultiByte(CP_UTF8, 0, zWideText, -1, zText, nByte,
+ 0, 0);
+ if( nByte == 0 ){
+ sqlite3_free(zText);
+ zText = 0;
+ }
+ return zText;
+}
+
+/*
+** Convert an ANSI string to Microsoft Unicode, using the ANSI or OEM
+** code page.
+**
+** Space to hold the returned string is obtained from sqlite3_malloc().
+*/
+static LPWSTR winMbcsToUnicode(const char *zText, int useAnsi){
+ int nByte;
+ LPWSTR zMbcsText;
+ int codepage = useAnsi ? CP_ACP : CP_OEMCP;
+
+ nByte = osMultiByteToWideChar(codepage, 0, zText, -1, NULL,
+ 0)*sizeof(WCHAR);
+ if( nByte==0 ){
+ return 0;
+ }
+ zMbcsText = sqlite3MallocZero( nByte*sizeof(WCHAR) );
+ if( zMbcsText==0 ){
+ return 0;
+ }
+ nByte = osMultiByteToWideChar(codepage, 0, zText, -1, zMbcsText,
+ nByte);
+ if( nByte==0 ){
+ sqlite3_free(zMbcsText);
+ zMbcsText = 0;
+ }
+ return zMbcsText;
+}
+
+/*
+** Convert a Microsoft Unicode string to a multi-byte character string,
+** using the ANSI or OEM code page.
+**
+** Space to hold the returned string is obtained from sqlite3_malloc().
+*/
+static char *winUnicodeToMbcs(LPCWSTR zWideText, int useAnsi){
+ int nByte;
+ char *zText;
+ int codepage = useAnsi ? CP_ACP : CP_OEMCP;
+
+ nByte = osWideCharToMultiByte(codepage, 0, zWideText, -1, 0, 0, 0, 0);
+ if( nByte == 0 ){
+ return 0;
+ }
+ zText = sqlite3MallocZero( nByte );
+ if( zText==0 ){
+ return 0;
+ }
+ nByte = osWideCharToMultiByte(codepage, 0, zWideText, -1, zText,
+ nByte, 0, 0);
+ if( nByte == 0 ){
+ sqlite3_free(zText);
+ zText = 0;
+ }
+ return zText;
+}
+
+/*
+** Convert a multi-byte character string to UTF-8.
+**
+** Space to hold the returned string is obtained from sqlite3_malloc().
+*/
+static char *winMbcsToUtf8(const char *zText, int useAnsi){
+ char *zTextUtf8;
+ LPWSTR zTmpWide;
+
+ zTmpWide = winMbcsToUnicode(zText, useAnsi);
+ if( zTmpWide==0 ){
+ return 0;
+ }
+ zTextUtf8 = winUnicodeToUtf8(zTmpWide);
+ sqlite3_free(zTmpWide);
+ return zTextUtf8;
+}
+
+/*
+** Convert a UTF-8 string to a multi-byte character string.
+**
+** Space to hold the returned string is obtained from sqlite3_malloc().
+*/
+static char *winUtf8ToMbcs(const char *zText, int useAnsi){
+ char *zTextMbcs;
+ LPWSTR zTmpWide;
+
+ zTmpWide = winUtf8ToUnicode(zText);
+ if( zTmpWide==0 ){
+ return 0;
+ }
+ zTextMbcs = winUnicodeToMbcs(zTmpWide, useAnsi);
+ sqlite3_free(zTmpWide);
+ return zTextMbcs;
+}
+
+/*
+** This is a public wrapper for the winUtf8ToUnicode() function.
+*/
+SQLITE_API LPWSTR sqlite3_win32_utf8_to_unicode(const char *zText){
+#ifdef SQLITE_ENABLE_API_ARMOR
+ if( !zText ){
+ (void)SQLITE_MISUSE_BKPT;
+ return 0;
+ }
+#endif
+#ifndef SQLITE_OMIT_AUTOINIT
+ if( sqlite3_initialize() ) return 0;
+#endif
+ return winUtf8ToUnicode(zText);
+}
+
+/*
+** This is a public wrapper for the winUnicodeToUtf8() function.
+*/
+SQLITE_API char *sqlite3_win32_unicode_to_utf8(LPCWSTR zWideText){
+#ifdef SQLITE_ENABLE_API_ARMOR
+ if( !zWideText ){
+ (void)SQLITE_MISUSE_BKPT;
+ return 0;
+ }
+#endif
+#ifndef SQLITE_OMIT_AUTOINIT
+ if( sqlite3_initialize() ) return 0;
+#endif
+ return winUnicodeToUtf8(zWideText);
+}
+
+/*
+** This is a public wrapper for the winMbcsToUtf8() function.
+*/
+SQLITE_API char *sqlite3_win32_mbcs_to_utf8(const char *zText){
+#ifdef SQLITE_ENABLE_API_ARMOR
+ if( !zText ){
+ (void)SQLITE_MISUSE_BKPT;
+ return 0;
+ }
+#endif
+#ifndef SQLITE_OMIT_AUTOINIT
+ if( sqlite3_initialize() ) return 0;
+#endif
+ return winMbcsToUtf8(zText, osAreFileApisANSI());
+}
+
+/*
+** This is a public wrapper for the winMbcsToUtf8() function.
+*/
+SQLITE_API char *sqlite3_win32_mbcs_to_utf8_v2(const char *zText, int useAnsi){
+#ifdef SQLITE_ENABLE_API_ARMOR
+ if( !zText ){
+ (void)SQLITE_MISUSE_BKPT;
+ return 0;
+ }
+#endif
+#ifndef SQLITE_OMIT_AUTOINIT
+ if( sqlite3_initialize() ) return 0;
+#endif
+ return winMbcsToUtf8(zText, useAnsi);
+}
+
+/*
+** This is a public wrapper for the winUtf8ToMbcs() function.
+*/
+SQLITE_API char *sqlite3_win32_utf8_to_mbcs(const char *zText){
+#ifdef SQLITE_ENABLE_API_ARMOR
+ if( !zText ){
+ (void)SQLITE_MISUSE_BKPT;
+ return 0;
+ }
+#endif
+#ifndef SQLITE_OMIT_AUTOINIT
+ if( sqlite3_initialize() ) return 0;
+#endif
+ return winUtf8ToMbcs(zText, osAreFileApisANSI());
+}
+
+/*
+** This is a public wrapper for the winUtf8ToMbcs() function.
+*/
+SQLITE_API char *sqlite3_win32_utf8_to_mbcs_v2(const char *zText, int useAnsi){
+#ifdef SQLITE_ENABLE_API_ARMOR
+ if( !zText ){
+ (void)SQLITE_MISUSE_BKPT;
+ return 0;
+ }
+#endif
+#ifndef SQLITE_OMIT_AUTOINIT
+ if( sqlite3_initialize() ) return 0;
+#endif
+ return winUtf8ToMbcs(zText, useAnsi);
+}
+
+/*
+** This function is the same as sqlite3_win32_set_directory (below); however,
+** it accepts a UTF-8 string.
+*/
+SQLITE_API int sqlite3_win32_set_directory8(
+ unsigned long type, /* Identifier for directory being set or reset */
+ const char *zValue /* New value for directory being set or reset */
+){
+ char **ppDirectory = 0;
+ int rc;
+#ifndef SQLITE_OMIT_AUTOINIT
+ rc = sqlite3_initialize();
+ if( rc ) return rc;
+#endif
+ sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
+ if( type==SQLITE_WIN32_DATA_DIRECTORY_TYPE ){
+ ppDirectory = &sqlite3_data_directory;
+ }else if( type==SQLITE_WIN32_TEMP_DIRECTORY_TYPE ){
+ ppDirectory = &sqlite3_temp_directory;
+ }
+ assert( !ppDirectory || type==SQLITE_WIN32_DATA_DIRECTORY_TYPE
+ || type==SQLITE_WIN32_TEMP_DIRECTORY_TYPE
+ );
+ assert( !ppDirectory || sqlite3MemdebugHasType(*ppDirectory, MEMTYPE_HEAP) );
+ if( ppDirectory ){
+ char *zCopy = 0;
+ if( zValue && zValue[0] ){
+ zCopy = sqlite3_mprintf("%s", zValue);
+ if ( zCopy==0 ){
+ rc = SQLITE_NOMEM_BKPT;
+ goto set_directory8_done;
+ }
+ }
+ sqlite3_free(*ppDirectory);
+ *ppDirectory = zCopy;
+ rc = SQLITE_OK;
+ }else{
+ rc = SQLITE_ERROR;
+ }
+set_directory8_done:
+ sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
+ return rc;
+}
+
+/*
+** This function is the same as sqlite3_win32_set_directory (below); however,
+** it accepts a UTF-16 string.
+*/
+SQLITE_API int sqlite3_win32_set_directory16(
+ unsigned long type, /* Identifier for directory being set or reset */
+ const void *zValue /* New value for directory being set or reset */
+){
+ int rc;
+ char *zUtf8 = 0;
+ if( zValue ){
+ zUtf8 = sqlite3_win32_unicode_to_utf8(zValue);
+ if( zUtf8==0 ) return SQLITE_NOMEM_BKPT;
+ }
+ rc = sqlite3_win32_set_directory8(type, zUtf8);
+ if( zUtf8 ) sqlite3_free(zUtf8);
+ return rc;
+}
+
+/*
+** This function sets the data directory or the temporary directory based on
+** the provided arguments. The type argument must be 1 in order to set the
+** data directory or 2 in order to set the temporary directory. The zValue
+** argument is the name of the directory to use. The return value will be
+** SQLITE_OK if successful.
+*/
+SQLITE_API int sqlite3_win32_set_directory(
+ unsigned long type, /* Identifier for directory being set or reset */
+ void *zValue /* New value for directory being set or reset */
+){
+ return sqlite3_win32_set_directory16(type, zValue);
+}
+
+/*
+** The return value of winGetLastErrorMsg
+** is zero if the error message fits in the buffer, or non-zero
+** otherwise (if the message was truncated).
+*/
+static int winGetLastErrorMsg(DWORD lastErrno, int nBuf, char *zBuf){
+ /* FormatMessage returns 0 on failure. Otherwise it
+ ** returns the number of TCHARs written to the output
+ ** buffer, excluding the terminating null char.
+ */
+ DWORD dwLen = 0;
+ char *zOut = 0;
+
+ if( osIsNT() ){
+#if SQLITE_OS_WINRT
+ WCHAR zTempWide[SQLITE_WIN32_MAX_ERRMSG_CHARS+1];
+ dwLen = osFormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ lastErrno,
+ 0,
+ zTempWide,
+ SQLITE_WIN32_MAX_ERRMSG_CHARS,
+ 0);
+#else
+ LPWSTR zTempWide = NULL;
+ dwLen = osFormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ lastErrno,
+ 0,
+ (LPWSTR) &zTempWide,
+ 0,
+ 0);
+#endif
+ if( dwLen > 0 ){
+ /* allocate a buffer and convert to UTF8 */
+ sqlite3BeginBenignMalloc();
+ zOut = winUnicodeToUtf8(zTempWide);
+ sqlite3EndBenignMalloc();
+#if !SQLITE_OS_WINRT
+ /* free the system buffer allocated by FormatMessage */
+ osLocalFree(zTempWide);
+#endif
+ }
+ }
+#ifdef SQLITE_WIN32_HAS_ANSI
+ else{
+ char *zTemp = NULL;
+ dwLen = osFormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ lastErrno,
+ 0,
+ (LPSTR) &zTemp,
+ 0,
+ 0);
+ if( dwLen > 0 ){
+ /* allocate a buffer and convert to UTF8 */
+ sqlite3BeginBenignMalloc();
+ zOut = winMbcsToUtf8(zTemp, osAreFileApisANSI());
+ sqlite3EndBenignMalloc();
+ /* free the system buffer allocated by FormatMessage */
+ osLocalFree(zTemp);
+ }
+ }
+#endif
+ if( 0 == dwLen ){
+ sqlite3_snprintf(nBuf, zBuf, "OsError 0x%lx (%lu)", lastErrno, lastErrno);
+ }else{
+ /* copy a maximum of nBuf chars to output buffer */
+ sqlite3_snprintf(nBuf, zBuf, "%s", zOut);
+ /* free the UTF8 buffer */
+ sqlite3_free(zOut);
+ }
+ return 0;
+}
+
+/*
+**
+** This function - winLogErrorAtLine() - is only ever called via the macro
+** winLogError().
+**
+** This routine is invoked after an error occurs in an OS function.
+** It logs a message using sqlite3_log() containing the current value of
+** error code and, if possible, the human-readable equivalent from
+** FormatMessage.
+**
+** The first argument passed to the macro should be the error code that
+** will be returned to SQLite (e.g. SQLITE_IOERR_DELETE, SQLITE_CANTOPEN).
+** The two subsequent arguments should be the name of the OS function that
+** failed and the associated file-system path, if any.
+*/
+#define winLogError(a,b,c,d) winLogErrorAtLine(a,b,c,d,__LINE__)
+static int winLogErrorAtLine(
+ int errcode, /* SQLite error code */
+ DWORD lastErrno, /* Win32 last error */
+ const char *zFunc, /* Name of OS function that failed */
+ const char *zPath, /* File path associated with error */
+ int iLine /* Source line number where error occurred */
+){
+ char zMsg[500]; /* Human readable error text */
+ int i; /* Loop counter */
+
+ zMsg[0] = 0;
+ winGetLastErrorMsg(lastErrno, sizeof(zMsg), zMsg);
+ assert( errcode!=SQLITE_OK );
+ if( zPath==0 ) zPath = "";
+ for(i=0; zMsg[i] && zMsg[i]!='\r' && zMsg[i]!='\n'; i++){}
+ zMsg[i] = 0;
+ sqlite3_log(errcode,
+ "os_win.c:%d: (%lu) %s(%s) - %s",
+ iLine, lastErrno, zFunc, zPath, zMsg
+ );
+
+ return errcode;
+}
+
+/*
+** The number of times that a ReadFile(), WriteFile(), and DeleteFile()
+** will be retried following a locking error - probably caused by
+** antivirus software. Also the initial delay before the first retry.
+** The delay increases linearly with each retry.
+*/
+#ifndef SQLITE_WIN32_IOERR_RETRY
+# define SQLITE_WIN32_IOERR_RETRY 10
+#endif
+#ifndef SQLITE_WIN32_IOERR_RETRY_DELAY
+# define SQLITE_WIN32_IOERR_RETRY_DELAY 25
+#endif
+static int winIoerrRetry = SQLITE_WIN32_IOERR_RETRY;
+static int winIoerrRetryDelay = SQLITE_WIN32_IOERR_RETRY_DELAY;
+
+/*
+** The "winIoerrCanRetry1" macro is used to determine if a particular I/O
+** error code obtained via GetLastError() is eligible to be retried. It
+** must accept the error code DWORD as its only argument and should return
+** non-zero if the error code is transient in nature and the operation
+** responsible for generating the original error might succeed upon being
+** retried. The argument to this macro should be a variable.
+**
+** Additionally, a macro named "winIoerrCanRetry2" may be defined. If it
+** is defined, it will be consulted only when the macro "winIoerrCanRetry1"
+** returns zero. The "winIoerrCanRetry2" macro is completely optional and
+** may be used to include additional error codes in the set that should
+** result in the failing I/O operation being retried by the caller. If
+** defined, the "winIoerrCanRetry2" macro must exhibit external semantics
+** identical to those of the "winIoerrCanRetry1" macro.
+*/
+#if !defined(winIoerrCanRetry1)
+#define winIoerrCanRetry1(a) (((a)==ERROR_ACCESS_DENIED) || \
+ ((a)==ERROR_SHARING_VIOLATION) || \
+ ((a)==ERROR_LOCK_VIOLATION) || \
+ ((a)==ERROR_DEV_NOT_EXIST) || \
+ ((a)==ERROR_NETNAME_DELETED) || \
+ ((a)==ERROR_SEM_TIMEOUT) || \
+ ((a)==ERROR_NETWORK_UNREACHABLE))
+#endif
+
+/*
+** If a ReadFile() or WriteFile() error occurs, invoke this routine
+** to see if it should be retried. Return TRUE to retry. Return FALSE
+** to give up with an error.
+*/
+static int winRetryIoerr(int *pnRetry, DWORD *pError){
+ DWORD e = osGetLastError();
+ if( *pnRetry>=winIoerrRetry ){
+ if( pError ){
+ *pError = e;
+ }
+ return 0;
+ }
+ if( winIoerrCanRetry1(e) ){
+ sqlite3_win32_sleep(winIoerrRetryDelay*(1+*pnRetry));
+ ++*pnRetry;
+ return 1;
+ }
+#if defined(winIoerrCanRetry2)
+ else if( winIoerrCanRetry2(e) ){
+ sqlite3_win32_sleep(winIoerrRetryDelay*(1+*pnRetry));
+ ++*pnRetry;
+ return 1;
+ }
+#endif
+ if( pError ){
+ *pError = e;
+ }
+ return 0;
+}
+
+/*
+** Log a I/O error retry episode.
+*/
+static void winLogIoerr(int nRetry, int lineno){
+ if( nRetry ){
+ sqlite3_log(SQLITE_NOTICE,
+ "delayed %dms for lock/sharing conflict at line %d",
+ winIoerrRetryDelay*nRetry*(nRetry+1)/2, lineno
+ );
+ }
+}
+
+/*
+** This #if does not rely on the SQLITE_OS_WINCE define because the
+** corresponding section in "date.c" cannot use it.
+*/
+#if !defined(SQLITE_OMIT_LOCALTIME) && defined(_WIN32_WCE) && \
+ (!defined(SQLITE_MSVC_LOCALTIME_API) || !SQLITE_MSVC_LOCALTIME_API)
+/*
+** The MSVC CRT on Windows CE may not have a localtime() function.
+** So define a substitute.
+*/
+/* # include <time.h> */
+struct tm *__cdecl localtime(const time_t *t)
+{
+ static struct tm y;
+ FILETIME uTm, lTm;
+ SYSTEMTIME pTm;
+ sqlite3_int64 t64;
+ t64 = *t;
+ t64 = (t64 + 11644473600)*10000000;
+ uTm.dwLowDateTime = (DWORD)(t64 & 0xFFFFFFFF);
+ uTm.dwHighDateTime= (DWORD)(t64 >> 32);
+ osFileTimeToLocalFileTime(&uTm,&lTm);
+ osFileTimeToSystemTime(&lTm,&pTm);
+ y.tm_year = pTm.wYear - 1900;
+ y.tm_mon = pTm.wMonth - 1;
+ y.tm_wday = pTm.wDayOfWeek;
+ y.tm_mday = pTm.wDay;
+ y.tm_hour = pTm.wHour;
+ y.tm_min = pTm.wMinute;
+ y.tm_sec = pTm.wSecond;
+ return &y;
+}
+#endif
+
+#if SQLITE_OS_WINCE
+/*************************************************************************
+** This section contains code for WinCE only.
+*/
+#define HANDLE_TO_WINFILE(a) (winFile*)&((char*)a)[-(int)offsetof(winFile,h)]
+
+/*
+** Acquire a lock on the handle h
+*/
+static void winceMutexAcquire(HANDLE h){
+ DWORD dwErr;
+ do {
+ dwErr = osWaitForSingleObject(h, INFINITE);
+ } while (dwErr != WAIT_OBJECT_0 && dwErr != WAIT_ABANDONED);
+}
+/*
+** Release a lock acquired by winceMutexAcquire()
+*/
+#define winceMutexRelease(h) ReleaseMutex(h)
+
+/*
+** Create the mutex and shared memory used for locking in the file
+** descriptor pFile
+*/
+static int winceCreateLock(const char *zFilename, winFile *pFile){
+ LPWSTR zTok;
+ LPWSTR zName;
+ DWORD lastErrno;
+ BOOL bLogged = FALSE;
+ BOOL bInit = TRUE;
+
+ zName = winUtf8ToUnicode(zFilename);
+ if( zName==0 ){
+ /* out of memory */
+ return SQLITE_IOERR_NOMEM_BKPT;
+ }
+
+ /* Initialize the local lockdata */
+ memset(&pFile->local, 0, sizeof(pFile->local));
+
+ /* Replace the backslashes from the filename and lowercase it
+ ** to derive a mutex name. */
+ zTok = osCharLowerW(zName);
+ for (;*zTok;zTok++){
+ if (*zTok == '\\') *zTok = '_';
+ }
+
+ /* Create/open the named mutex */
+ pFile->hMutex = osCreateMutexW(NULL, FALSE, zName);
+ if (!pFile->hMutex){
+ pFile->lastErrno = osGetLastError();
+ sqlite3_free(zName);
+ return winLogError(SQLITE_IOERR, pFile->lastErrno,
+ "winceCreateLock1", zFilename);
+ }
+
+ /* Acquire the mutex before continuing */
+ winceMutexAcquire(pFile->hMutex);
+
+ /* Since the names of named mutexes, semaphores, file mappings etc are
+ ** case-sensitive, take advantage of that by uppercasing the mutex name
+ ** and using that as the shared filemapping name.
+ */
+ osCharUpperW(zName);
+ pFile->hShared = osCreateFileMappingW(INVALID_HANDLE_VALUE, NULL,
+ PAGE_READWRITE, 0, sizeof(winceLock),
+ zName);
+
+ /* Set a flag that indicates we're the first to create the memory so it
+ ** must be zero-initialized */
+ lastErrno = osGetLastError();
+ if (lastErrno == ERROR_ALREADY_EXISTS){
+ bInit = FALSE;
+ }
+
+ sqlite3_free(zName);
+
+ /* If we succeeded in making the shared memory handle, map it. */
+ if( pFile->hShared ){
+ pFile->shared = (winceLock*)osMapViewOfFile(pFile->hShared,
+ FILE_MAP_READ|FILE_MAP_WRITE, 0, 0, sizeof(winceLock));
+ /* If mapping failed, close the shared memory handle and erase it */
+ if( !pFile->shared ){
+ pFile->lastErrno = osGetLastError();
+ winLogError(SQLITE_IOERR, pFile->lastErrno,
+ "winceCreateLock2", zFilename);
+ bLogged = TRUE;
+ osCloseHandle(pFile->hShared);
+ pFile->hShared = NULL;
+ }
+ }
+
+ /* If shared memory could not be created, then close the mutex and fail */
+ if( pFile->hShared==NULL ){
+ if( !bLogged ){
+ pFile->lastErrno = lastErrno;
+ winLogError(SQLITE_IOERR, pFile->lastErrno,
+ "winceCreateLock3", zFilename);
+ bLogged = TRUE;
+ }
+ winceMutexRelease(pFile->hMutex);
+ osCloseHandle(pFile->hMutex);
+ pFile->hMutex = NULL;
+ return SQLITE_IOERR;
+ }
+
+ /* Initialize the shared memory if we're supposed to */
+ if( bInit ){
+ memset(pFile->shared, 0, sizeof(winceLock));
+ }
+
+ winceMutexRelease(pFile->hMutex);
+ return SQLITE_OK;
+}
+
+/*
+** Destroy the part of winFile that deals with wince locks
+*/
+static void winceDestroyLock(winFile *pFile){
+ if (pFile->hMutex){
+ /* Acquire the mutex */
+ winceMutexAcquire(pFile->hMutex);
+
+ /* The following blocks should probably assert in debug mode, but they
+ are to cleanup in case any locks remained open */
+ if (pFile->local.nReaders){
+ pFile->shared->nReaders --;
+ }
+ if (pFile->local.bReserved){
+ pFile->shared->bReserved = FALSE;
+ }
+ if (pFile->local.bPending){
+ pFile->shared->bPending = FALSE;
+ }
+ if (pFile->local.bExclusive){
+ pFile->shared->bExclusive = FALSE;
+ }
+
+ /* De-reference and close our copy of the shared memory handle */
+ osUnmapViewOfFile(pFile->shared);
+ osCloseHandle(pFile->hShared);
+
+ /* Done with the mutex */
+ winceMutexRelease(pFile->hMutex);
+ osCloseHandle(pFile->hMutex);
+ pFile->hMutex = NULL;
+ }
+}
+
+/*
+** An implementation of the LockFile() API of Windows for CE
+*/
+static BOOL winceLockFile(
+ LPHANDLE phFile,
+ DWORD dwFileOffsetLow,
+ DWORD dwFileOffsetHigh,
+ DWORD nNumberOfBytesToLockLow,
+ DWORD nNumberOfBytesToLockHigh
+){
+ winFile *pFile = HANDLE_TO_WINFILE(phFile);
+ BOOL bReturn = FALSE;
+
+ UNUSED_PARAMETER(dwFileOffsetHigh);
+ UNUSED_PARAMETER(nNumberOfBytesToLockHigh);
+
+ if (!pFile->hMutex) return TRUE;
+ winceMutexAcquire(pFile->hMutex);
+
+ /* Wanting an exclusive lock? */
+ if (dwFileOffsetLow == (DWORD)SHARED_FIRST
+ && nNumberOfBytesToLockLow == (DWORD)SHARED_SIZE){
+ if (pFile->shared->nReaders == 0 && pFile->shared->bExclusive == 0){
+ pFile->shared->bExclusive = TRUE;
+ pFile->local.bExclusive = TRUE;
+ bReturn = TRUE;
+ }
+ }
+
+ /* Want a read-only lock? */
+ else if (dwFileOffsetLow == (DWORD)SHARED_FIRST &&
+ nNumberOfBytesToLockLow == 1){
+ if (pFile->shared->bExclusive == 0){
+ pFile->local.nReaders ++;
+ if (pFile->local.nReaders == 1){
+ pFile->shared->nReaders ++;
+ }
+ bReturn = TRUE;
+ }
+ }
+
+ /* Want a pending lock? */
+ else if (dwFileOffsetLow == (DWORD)PENDING_BYTE
+ && nNumberOfBytesToLockLow == 1){
+ /* If no pending lock has been acquired, then acquire it */
+ if (pFile->shared->bPending == 0) {
+ pFile->shared->bPending = TRUE;
+ pFile->local.bPending = TRUE;
+ bReturn = TRUE;
+ }
+ }
+
+ /* Want a reserved lock? */
+ else if (dwFileOffsetLow == (DWORD)RESERVED_BYTE
+ && nNumberOfBytesToLockLow == 1){
+ if (pFile->shared->bReserved == 0) {
+ pFile->shared->bReserved = TRUE;
+ pFile->local.bReserved = TRUE;
+ bReturn = TRUE;
+ }
+ }
+
+ winceMutexRelease(pFile->hMutex);
+ return bReturn;
+}
+
+/*
+** An implementation of the UnlockFile API of Windows for CE
+*/
+static BOOL winceUnlockFile(
+ LPHANDLE phFile,
+ DWORD dwFileOffsetLow,
+ DWORD dwFileOffsetHigh,
+ DWORD nNumberOfBytesToUnlockLow,
+ DWORD nNumberOfBytesToUnlockHigh
+){
+ winFile *pFile = HANDLE_TO_WINFILE(phFile);
+ BOOL bReturn = FALSE;
+
+ UNUSED_PARAMETER(dwFileOffsetHigh);
+ UNUSED_PARAMETER(nNumberOfBytesToUnlockHigh);
+
+ if (!pFile->hMutex) return TRUE;
+ winceMutexAcquire(pFile->hMutex);
+
+ /* Releasing a reader lock or an exclusive lock */
+ if (dwFileOffsetLow == (DWORD)SHARED_FIRST){
+ /* Did we have an exclusive lock? */
+ if (pFile->local.bExclusive){
+ assert(nNumberOfBytesToUnlockLow == (DWORD)SHARED_SIZE);
+ pFile->local.bExclusive = FALSE;
+ pFile->shared->bExclusive = FALSE;
+ bReturn = TRUE;
+ }
+
+ /* Did we just have a reader lock? */
+ else if (pFile->local.nReaders){
+ assert(nNumberOfBytesToUnlockLow == (DWORD)SHARED_SIZE
+ || nNumberOfBytesToUnlockLow == 1);
+ pFile->local.nReaders --;
+ if (pFile->local.nReaders == 0)
+ {
+ pFile->shared->nReaders --;
+ }
+ bReturn = TRUE;
+ }
+ }
+
+ /* Releasing a pending lock */
+ else if (dwFileOffsetLow == (DWORD)PENDING_BYTE
+ && nNumberOfBytesToUnlockLow == 1){
+ if (pFile->local.bPending){
+ pFile->local.bPending = FALSE;
+ pFile->shared->bPending = FALSE;
+ bReturn = TRUE;
+ }
+ }
+ /* Releasing a reserved lock */
+ else if (dwFileOffsetLow == (DWORD)RESERVED_BYTE
+ && nNumberOfBytesToUnlockLow == 1){
+ if (pFile->local.bReserved) {
+ pFile->local.bReserved = FALSE;
+ pFile->shared->bReserved = FALSE;
+ bReturn = TRUE;
+ }
+ }
+
+ winceMutexRelease(pFile->hMutex);
+ return bReturn;
+}
+/*
+** End of the special code for wince
+*****************************************************************************/
+#endif /* SQLITE_OS_WINCE */
+
+/*
+** Lock a file region.
+*/
+static BOOL winLockFile(
+ LPHANDLE phFile,
+ DWORD flags,
+ DWORD offsetLow,
+ DWORD offsetHigh,
+ DWORD numBytesLow,
+ DWORD numBytesHigh
+){
+#if SQLITE_OS_WINCE
+ /*
+ ** NOTE: Windows CE is handled differently here due its lack of the Win32
+ ** API LockFile.
+ */
+ return winceLockFile(phFile, offsetLow, offsetHigh,
+ numBytesLow, numBytesHigh);
+#else
+ if( osIsNT() ){
+ OVERLAPPED ovlp;
+ memset(&ovlp, 0, sizeof(OVERLAPPED));
+ ovlp.Offset = offsetLow;
+ ovlp.OffsetHigh = offsetHigh;
+ return osLockFileEx(*phFile, flags, 0, numBytesLow, numBytesHigh, &ovlp);
+ }else{
+ return osLockFile(*phFile, offsetLow, offsetHigh, numBytesLow,
+ numBytesHigh);
+ }
+#endif
+}
+
+/*
+** Unlock a file region.
+ */
+static BOOL winUnlockFile(
+ LPHANDLE phFile,
+ DWORD offsetLow,
+ DWORD offsetHigh,
+ DWORD numBytesLow,
+ DWORD numBytesHigh
+){
+#if SQLITE_OS_WINCE
+ /*
+ ** NOTE: Windows CE is handled differently here due its lack of the Win32
+ ** API UnlockFile.
+ */
+ return winceUnlockFile(phFile, offsetLow, offsetHigh,
+ numBytesLow, numBytesHigh);
+#else
+ if( osIsNT() ){
+ OVERLAPPED ovlp;
+ memset(&ovlp, 0, sizeof(OVERLAPPED));
+ ovlp.Offset = offsetLow;
+ ovlp.OffsetHigh = offsetHigh;
+ return osUnlockFileEx(*phFile, 0, numBytesLow, numBytesHigh, &ovlp);
+ }else{
+ return osUnlockFile(*phFile, offsetLow, offsetHigh, numBytesLow,
+ numBytesHigh);
+ }
+#endif
+}
+
+/*****************************************************************************
+** The next group of routines implement the I/O methods specified
+** by the sqlite3_io_methods object.
+******************************************************************************/
+
+/*
+** Some Microsoft compilers lack this definition.
+*/
+#ifndef INVALID_SET_FILE_POINTER
+# define INVALID_SET_FILE_POINTER ((DWORD)-1)
+#endif
+
+/*
+** Move the current position of the file handle passed as the first
+** argument to offset iOffset within the file. If successful, return 0.
+** Otherwise, set pFile->lastErrno and return non-zero.
+*/
+static int winSeekFile(winFile *pFile, sqlite3_int64 iOffset){
+#if !SQLITE_OS_WINRT
+ LONG upperBits; /* Most sig. 32 bits of new offset */
+ LONG lowerBits; /* Least sig. 32 bits of new offset */
+ DWORD dwRet; /* Value returned by SetFilePointer() */
+ DWORD lastErrno; /* Value returned by GetLastError() */
+
+ OSTRACE(("SEEK file=%p, offset=%lld\n", pFile->h, iOffset));
+
+ upperBits = (LONG)((iOffset>>32) & 0x7fffffff);
+ lowerBits = (LONG)(iOffset & 0xffffffff);
+
+ /* API oddity: If successful, SetFilePointer() returns a dword
+ ** containing the lower 32-bits of the new file-offset. Or, if it fails,
+ ** it returns INVALID_SET_FILE_POINTER. However according to MSDN,
+ ** INVALID_SET_FILE_POINTER may also be a valid new offset. So to determine
+ ** whether an error has actually occurred, it is also necessary to call
+ ** GetLastError().
+ */
+ dwRet = osSetFilePointer(pFile->h, lowerBits, &upperBits, FILE_BEGIN);
+
+ if( (dwRet==INVALID_SET_FILE_POINTER
+ && ((lastErrno = osGetLastError())!=NO_ERROR)) ){
+ pFile->lastErrno = lastErrno;
+ winLogError(SQLITE_IOERR_SEEK, pFile->lastErrno,
+ "winSeekFile", pFile->zPath);
+ OSTRACE(("SEEK file=%p, rc=SQLITE_IOERR_SEEK\n", pFile->h));
+ return 1;
+ }
+
+ OSTRACE(("SEEK file=%p, rc=SQLITE_OK\n", pFile->h));
+ return 0;
+#else
+ /*
+ ** Same as above, except that this implementation works for WinRT.
+ */
+
+ LARGE_INTEGER x; /* The new offset */
+ BOOL bRet; /* Value returned by SetFilePointerEx() */
+
+ x.QuadPart = iOffset;
+ bRet = osSetFilePointerEx(pFile->h, x, 0, FILE_BEGIN);
+
+ if(!bRet){
+ pFile->lastErrno = osGetLastError();
+ winLogError(SQLITE_IOERR_SEEK, pFile->lastErrno,
+ "winSeekFile", pFile->zPath);
+ OSTRACE(("SEEK file=%p, rc=SQLITE_IOERR_SEEK\n", pFile->h));
+ return 1;
+ }
+
+ OSTRACE(("SEEK file=%p, rc=SQLITE_OK\n", pFile->h));
+ return 0;
+#endif
+}
+
+#if SQLITE_MAX_MMAP_SIZE>0
+/* Forward references to VFS helper methods used for memory mapped files */
+static int winMapfile(winFile*, sqlite3_int64);
+static int winUnmapfile(winFile*);
+#endif
+
+/*
+** Close a file.
+**
+** It is reported that an attempt to close a handle might sometimes
+** fail. This is a very unreasonable result, but Windows is notorious
+** for being unreasonable so I do not doubt that it might happen. If
+** the close fails, we pause for 100 milliseconds and try again. As
+** many as MX_CLOSE_ATTEMPT attempts to close the handle are made before
+** giving up and returning an error.
+*/
+#define MX_CLOSE_ATTEMPT 3
+static int winClose(sqlite3_file *id){
+ int rc, cnt = 0;
+ winFile *pFile = (winFile*)id;
+
+ assert( id!=0 );
+#ifndef SQLITE_OMIT_WAL
+ assert( pFile->pShm==0 );
+#endif
+ assert( pFile->h!=NULL && pFile->h!=INVALID_HANDLE_VALUE );
+ OSTRACE(("CLOSE pid=%lu, pFile=%p, file=%p\n",
+ osGetCurrentProcessId(), pFile, pFile->h));
+
+#if SQLITE_MAX_MMAP_SIZE>0
+ winUnmapfile(pFile);
+#endif
+
+ do{
+ rc = osCloseHandle(pFile->h);
+ /* SimulateIOError( rc=0; cnt=MX_CLOSE_ATTEMPT; ); */
+ }while( rc==0 && ++cnt < MX_CLOSE_ATTEMPT && (sqlite3_win32_sleep(100), 1) );
+#if SQLITE_OS_WINCE
+#define WINCE_DELETION_ATTEMPTS 3
+ {
+ winVfsAppData *pAppData = (winVfsAppData*)pFile->pVfs->pAppData;
+ if( pAppData==NULL || !pAppData->bNoLock ){
+ winceDestroyLock(pFile);
+ }
+ }
+ if( pFile->zDeleteOnClose ){
+ int cnt = 0;
+ while(
+ osDeleteFileW(pFile->zDeleteOnClose)==0
+ && osGetFileAttributesW(pFile->zDeleteOnClose)!=0xffffffff
+ && cnt++ < WINCE_DELETION_ATTEMPTS
+ ){
+ sqlite3_win32_sleep(100); /* Wait a little before trying again */
+ }
+ sqlite3_free(pFile->zDeleteOnClose);
+ }
+#endif
+ if( rc ){
+ pFile->h = NULL;
+ }
+ OpenCounter(-1);
+ OSTRACE(("CLOSE pid=%lu, pFile=%p, file=%p, rc=%s\n",
+ osGetCurrentProcessId(), pFile, pFile->h, rc ? "ok" : "failed"));
+ return rc ? SQLITE_OK
+ : winLogError(SQLITE_IOERR_CLOSE, osGetLastError(),
+ "winClose", pFile->zPath);
+}
+
+/*
+** Read data from a file into a buffer. Return SQLITE_OK if all
+** bytes were read successfully and SQLITE_IOERR if anything goes
+** wrong.
+*/
+static int winRead(
+ sqlite3_file *id, /* File to read from */
+ void *pBuf, /* Write content into this buffer */
+ int amt, /* Number of bytes to read */
+ sqlite3_int64 offset /* Begin reading at this offset */
+){
+#if !SQLITE_OS_WINCE && !defined(SQLITE_WIN32_NO_OVERLAPPED)
+ OVERLAPPED overlapped; /* The offset for ReadFile. */
+#endif
+ winFile *pFile = (winFile*)id; /* file handle */
+ DWORD nRead; /* Number of bytes actually read from file */
+ int nRetry = 0; /* Number of retrys */
+
+ assert( id!=0 );
+ assert( amt>0 );
+ assert( offset>=0 );
+ SimulateIOError(return SQLITE_IOERR_READ);
+ OSTRACE(("READ pid=%lu, pFile=%p, file=%p, buffer=%p, amount=%d, "
+ "offset=%lld, lock=%d\n", osGetCurrentProcessId(), pFile,
+ pFile->h, pBuf, amt, offset, pFile->locktype));
+
+#if SQLITE_MAX_MMAP_SIZE>0
+ /* Deal with as much of this read request as possible by transferring
+ ** data from the memory mapping using memcpy(). */
+ if( offset<pFile->mmapSize ){
+ if( offset+amt <= pFile->mmapSize ){
+ memcpy(pBuf, &((u8 *)(pFile->pMapRegion))[offset], amt);
+ OSTRACE(("READ-MMAP pid=%lu, pFile=%p, file=%p, rc=SQLITE_OK\n",
+ osGetCurrentProcessId(), pFile, pFile->h));
+ return SQLITE_OK;
+ }else{
+ int nCopy = (int)(pFile->mmapSize - offset);
+ memcpy(pBuf, &((u8 *)(pFile->pMapRegion))[offset], nCopy);
+ pBuf = &((u8 *)pBuf)[nCopy];
+ amt -= nCopy;
+ offset += nCopy;
+ }
+ }
+#endif
+
+#if SQLITE_OS_WINCE || defined(SQLITE_WIN32_NO_OVERLAPPED)
+ if( winSeekFile(pFile, offset) ){
+ OSTRACE(("READ pid=%lu, pFile=%p, file=%p, rc=SQLITE_FULL\n",
+ osGetCurrentProcessId(), pFile, pFile->h));
+ return SQLITE_FULL;
+ }
+ while( !osReadFile(pFile->h, pBuf, amt, &nRead, 0) ){
+#else
+ memset(&overlapped, 0, sizeof(OVERLAPPED));
+ overlapped.Offset = (LONG)(offset & 0xffffffff);
+ overlapped.OffsetHigh = (LONG)((offset>>32) & 0x7fffffff);
+ while( !osReadFile(pFile->h, pBuf, amt, &nRead, &overlapped) &&
+ osGetLastError()!=ERROR_HANDLE_EOF ){
+#endif
+ DWORD lastErrno;
+ if( winRetryIoerr(&nRetry, &lastErrno) ) continue;
+ pFile->lastErrno = lastErrno;
+ OSTRACE(("READ pid=%lu, pFile=%p, file=%p, rc=SQLITE_IOERR_READ\n",
+ osGetCurrentProcessId(), pFile, pFile->h));
+ return winLogError(SQLITE_IOERR_READ, pFile->lastErrno,
+ "winRead", pFile->zPath);
+ }
+ winLogIoerr(nRetry, __LINE__);
+ if( nRead<(DWORD)amt ){
+ /* Unread parts of the buffer must be zero-filled */
+ memset(&((char*)pBuf)[nRead], 0, amt-nRead);
+ OSTRACE(("READ pid=%lu, pFile=%p, file=%p, rc=SQLITE_IOERR_SHORT_READ\n",
+ osGetCurrentProcessId(), pFile, pFile->h));
+ return SQLITE_IOERR_SHORT_READ;
+ }
+
+ OSTRACE(("READ pid=%lu, pFile=%p, file=%p, rc=SQLITE_OK\n",
+ osGetCurrentProcessId(), pFile, pFile->h));
+ return SQLITE_OK;
+}
+
+/*
+** Write data from a buffer into a file. Return SQLITE_OK on success
+** or some other error code on failure.
+*/
+static int winWrite(
+ sqlite3_file *id, /* File to write into */
+ const void *pBuf, /* The bytes to be written */
+ int amt, /* Number of bytes to write */
+ sqlite3_int64 offset /* Offset into the file to begin writing at */
+){
+ int rc = 0; /* True if error has occurred, else false */
+ winFile *pFile = (winFile*)id; /* File handle */
+ int nRetry = 0; /* Number of retries */
+
+ assert( amt>0 );
+ assert( pFile );
+ SimulateIOError(return SQLITE_IOERR_WRITE);
+ SimulateDiskfullError(return SQLITE_FULL);
+
+ OSTRACE(("WRITE pid=%lu, pFile=%p, file=%p, buffer=%p, amount=%d, "
+ "offset=%lld, lock=%d\n", osGetCurrentProcessId(), pFile,
+ pFile->h, pBuf, amt, offset, pFile->locktype));
+
+#if defined(SQLITE_MMAP_READWRITE) && SQLITE_MAX_MMAP_SIZE>0
+ /* Deal with as much of this write request as possible by transferring
+ ** data from the memory mapping using memcpy(). */
+ if( offset<pFile->mmapSize ){
+ if( offset+amt <= pFile->mmapSize ){
+ memcpy(&((u8 *)(pFile->pMapRegion))[offset], pBuf, amt);
+ OSTRACE(("WRITE-MMAP pid=%lu, pFile=%p, file=%p, rc=SQLITE_OK\n",
+ osGetCurrentProcessId(), pFile, pFile->h));
+ return SQLITE_OK;
+ }else{
+ int nCopy = (int)(pFile->mmapSize - offset);
+ memcpy(&((u8 *)(pFile->pMapRegion))[offset], pBuf, nCopy);
+ pBuf = &((u8 *)pBuf)[nCopy];
+ amt -= nCopy;
+ offset += nCopy;
+ }
+ }
+#endif
+
+#if SQLITE_OS_WINCE || defined(SQLITE_WIN32_NO_OVERLAPPED)
+ rc = winSeekFile(pFile, offset);
+ if( rc==0 ){
+#else
+ {
+#endif
+#if !SQLITE_OS_WINCE && !defined(SQLITE_WIN32_NO_OVERLAPPED)
+ OVERLAPPED overlapped; /* The offset for WriteFile. */
+#endif
+ u8 *aRem = (u8 *)pBuf; /* Data yet to be written */
+ int nRem = amt; /* Number of bytes yet to be written */
+ DWORD nWrite; /* Bytes written by each WriteFile() call */
+ DWORD lastErrno = NO_ERROR; /* Value returned by GetLastError() */
+
+#if !SQLITE_OS_WINCE && !defined(SQLITE_WIN32_NO_OVERLAPPED)
+ memset(&overlapped, 0, sizeof(OVERLAPPED));
+ overlapped.Offset = (LONG)(offset & 0xffffffff);
+ overlapped.OffsetHigh = (LONG)((offset>>32) & 0x7fffffff);
+#endif
+
+ while( nRem>0 ){
+#if SQLITE_OS_WINCE || defined(SQLITE_WIN32_NO_OVERLAPPED)
+ if( !osWriteFile(pFile->h, aRem, nRem, &nWrite, 0) ){
+#else
+ if( !osWriteFile(pFile->h, aRem, nRem, &nWrite, &overlapped) ){
+#endif
+ if( winRetryIoerr(&nRetry, &lastErrno) ) continue;
+ break;
+ }
+ assert( nWrite==0 || nWrite<=(DWORD)nRem );
+ if( nWrite==0 || nWrite>(DWORD)nRem ){
+ lastErrno = osGetLastError();
+ break;
+ }
+#if !SQLITE_OS_WINCE && !defined(SQLITE_WIN32_NO_OVERLAPPED)
+ offset += nWrite;
+ overlapped.Offset = (LONG)(offset & 0xffffffff);
+ overlapped.OffsetHigh = (LONG)((offset>>32) & 0x7fffffff);
+#endif
+ aRem += nWrite;
+ nRem -= nWrite;
+ }
+ if( nRem>0 ){
+ pFile->lastErrno = lastErrno;
+ rc = 1;
+ }
+ }
+
+ if( rc ){
+ if( ( pFile->lastErrno==ERROR_HANDLE_DISK_FULL )
+ || ( pFile->lastErrno==ERROR_DISK_FULL )){
+ OSTRACE(("WRITE pid=%lu, pFile=%p, file=%p, rc=SQLITE_FULL\n",
+ osGetCurrentProcessId(), pFile, pFile->h));
+ return winLogError(SQLITE_FULL, pFile->lastErrno,
+ "winWrite1", pFile->zPath);
+ }
+ OSTRACE(("WRITE pid=%lu, pFile=%p, file=%p, rc=SQLITE_IOERR_WRITE\n",
+ osGetCurrentProcessId(), pFile, pFile->h));
+ return winLogError(SQLITE_IOERR_WRITE, pFile->lastErrno,
+ "winWrite2", pFile->zPath);
+ }else{
+ winLogIoerr(nRetry, __LINE__);
+ }
+ OSTRACE(("WRITE pid=%lu, pFile=%p, file=%p, rc=SQLITE_OK\n",
+ osGetCurrentProcessId(), pFile, pFile->h));
+ return SQLITE_OK;
+}
+
+/*
+** Truncate an open file to a specified size
+*/
+static int winTruncate(sqlite3_file *id, sqlite3_int64 nByte){
+ winFile *pFile = (winFile*)id; /* File handle object */
+ int rc = SQLITE_OK; /* Return code for this function */
+ DWORD lastErrno;
+#if SQLITE_MAX_MMAP_SIZE>0
+ sqlite3_int64 oldMmapSize;
+ if( pFile->nFetchOut>0 ){
+ /* File truncation is a no-op if there are outstanding memory mapped
+ ** pages. This is because truncating the file means temporarily unmapping
+ ** the file, and that might delete memory out from under existing cursors.
+ **
+ ** This can result in incremental vacuum not truncating the file,
+ ** if there is an active read cursor when the incremental vacuum occurs.
+ ** No real harm comes of this - the database file is not corrupted,
+ ** though some folks might complain that the file is bigger than it
+ ** needs to be.
+ **
+ ** The only feasible work-around is to defer the truncation until after
+ ** all references to memory-mapped content are closed. That is doable,
+ ** but involves adding a few branches in the common write code path which
+ ** could slow down normal operations slightly. Hence, we have decided for
+ ** now to simply make transactions a no-op if there are pending reads. We
+ ** can maybe revisit this decision in the future.
+ */
+ return SQLITE_OK;
+ }
+#endif
+
+ assert( pFile );
+ SimulateIOError(return SQLITE_IOERR_TRUNCATE);
+ OSTRACE(("TRUNCATE pid=%lu, pFile=%p, file=%p, size=%lld, lock=%d\n",
+ osGetCurrentProcessId(), pFile, pFile->h, nByte, pFile->locktype));
+
+ /* If the user has configured a chunk-size for this file, truncate the
+ ** file so that it consists of an integer number of chunks (i.e. the
+ ** actual file size after the operation may be larger than the requested
+ ** size).
+ */
+ if( pFile->szChunk>0 ){
+ nByte = ((nByte + pFile->szChunk - 1)/pFile->szChunk) * pFile->szChunk;
+ }
+
+#if SQLITE_MAX_MMAP_SIZE>0
+ if( pFile->pMapRegion ){
+ oldMmapSize = pFile->mmapSize;
+ }else{
+ oldMmapSize = 0;
+ }
+ winUnmapfile(pFile);
+#endif
+
+ /* SetEndOfFile() returns non-zero when successful, or zero when it fails. */
+ if( winSeekFile(pFile, nByte) ){
+ rc = winLogError(SQLITE_IOERR_TRUNCATE, pFile->lastErrno,
+ "winTruncate1", pFile->zPath);
+ }else if( 0==osSetEndOfFile(pFile->h) &&
+ ((lastErrno = osGetLastError())!=ERROR_USER_MAPPED_FILE) ){
+ pFile->lastErrno = lastErrno;
+ rc = winLogError(SQLITE_IOERR_TRUNCATE, pFile->lastErrno,
+ "winTruncate2", pFile->zPath);
+ }
+
+#if SQLITE_MAX_MMAP_SIZE>0
+ if( rc==SQLITE_OK && oldMmapSize>0 ){
+ if( oldMmapSize>nByte ){
+ winMapfile(pFile, -1);
+ }else{
+ winMapfile(pFile, oldMmapSize);
+ }
+ }
+#endif
+
+ OSTRACE(("TRUNCATE pid=%lu, pFile=%p, file=%p, rc=%s\n",
+ osGetCurrentProcessId(), pFile, pFile->h, sqlite3ErrName(rc)));
+ return rc;
+}
+
+#ifdef SQLITE_TEST
+/*
+** Count the number of fullsyncs and normal syncs. This is used to test
+** that syncs and fullsyncs are occurring at the right times.
+*/
+SQLITE_API int sqlite3_sync_count = 0;
+SQLITE_API int sqlite3_fullsync_count = 0;
+#endif
+
+/*
+** Make sure all writes to a particular file are committed to disk.
+*/
+static int winSync(sqlite3_file *id, int flags){
+#ifndef SQLITE_NO_SYNC
+ /*
+ ** Used only when SQLITE_NO_SYNC is not defined.
+ */
+ BOOL rc;
+#endif
+#if !defined(NDEBUG) || !defined(SQLITE_NO_SYNC) || \
+ defined(SQLITE_HAVE_OS_TRACE)
+ /*
+ ** Used when SQLITE_NO_SYNC is not defined and by the assert() and/or
+ ** OSTRACE() macros.
+ */
+ winFile *pFile = (winFile*)id;
+#else
+ UNUSED_PARAMETER(id);
+#endif
+
+ assert( pFile );
+ /* Check that one of SQLITE_SYNC_NORMAL or FULL was passed */
+ assert((flags&0x0F)==SQLITE_SYNC_NORMAL
+ || (flags&0x0F)==SQLITE_SYNC_FULL
+ );
+
+ /* Unix cannot, but some systems may return SQLITE_FULL from here. This
+ ** line is to test that doing so does not cause any problems.
+ */
+ SimulateDiskfullError( return SQLITE_FULL );
+
+ OSTRACE(("SYNC pid=%lu, pFile=%p, file=%p, flags=%x, lock=%d\n",
+ osGetCurrentProcessId(), pFile, pFile->h, flags,
+ pFile->locktype));
+
+#ifndef SQLITE_TEST
+ UNUSED_PARAMETER(flags);
+#else
+ if( (flags&0x0F)==SQLITE_SYNC_FULL ){
+ sqlite3_fullsync_count++;
+ }
+ sqlite3_sync_count++;
+#endif
+
+ /* If we compiled with the SQLITE_NO_SYNC flag, then syncing is a
+ ** no-op
+ */
+#ifdef SQLITE_NO_SYNC
+ OSTRACE(("SYNC-NOP pid=%lu, pFile=%p, file=%p, rc=SQLITE_OK\n",
+ osGetCurrentProcessId(), pFile, pFile->h));
+ return SQLITE_OK;
+#else
+#if SQLITE_MAX_MMAP_SIZE>0
+ if( pFile->pMapRegion ){
+ if( osFlushViewOfFile(pFile->pMapRegion, 0) ){
+ OSTRACE(("SYNC-MMAP pid=%lu, pFile=%p, pMapRegion=%p, "
+ "rc=SQLITE_OK\n", osGetCurrentProcessId(),
+ pFile, pFile->pMapRegion));
+ }else{
+ pFile->lastErrno = osGetLastError();
+ OSTRACE(("SYNC-MMAP pid=%lu, pFile=%p, pMapRegion=%p, "
+ "rc=SQLITE_IOERR_MMAP\n", osGetCurrentProcessId(),
+ pFile, pFile->pMapRegion));
+ return winLogError(SQLITE_IOERR_MMAP, pFile->lastErrno,
+ "winSync1", pFile->zPath);
+ }
+ }
+#endif
+ rc = osFlushFileBuffers(pFile->h);
+ SimulateIOError( rc=FALSE );
+ if( rc ){
+ OSTRACE(("SYNC pid=%lu, pFile=%p, file=%p, rc=SQLITE_OK\n",
+ osGetCurrentProcessId(), pFile, pFile->h));
+ return SQLITE_OK;
+ }else{
+ pFile->lastErrno = osGetLastError();
+ OSTRACE(("SYNC pid=%lu, pFile=%p, file=%p, rc=SQLITE_IOERR_FSYNC\n",
+ osGetCurrentProcessId(), pFile, pFile->h));
+ return winLogError(SQLITE_IOERR_FSYNC, pFile->lastErrno,
+ "winSync2", pFile->zPath);
+ }
+#endif
+}
+
+/*
+** Determine the current size of a file in bytes
+*/
+static int winFileSize(sqlite3_file *id, sqlite3_int64 *pSize){
+ winFile *pFile = (winFile*)id;
+ int rc = SQLITE_OK;
+
+ assert( id!=0 );
+ assert( pSize!=0 );
+ SimulateIOError(return SQLITE_IOERR_FSTAT);
+ OSTRACE(("SIZE file=%p, pSize=%p\n", pFile->h, pSize));
+
+#if SQLITE_OS_WINRT
+ {
+ FILE_STANDARD_INFO info;
+ if( osGetFileInformationByHandleEx(pFile->h, FileStandardInfo,
+ &info, sizeof(info)) ){
+ *pSize = info.EndOfFile.QuadPart;
+ }else{
+ pFile->lastErrno = osGetLastError();
+ rc = winLogError(SQLITE_IOERR_FSTAT, pFile->lastErrno,
+ "winFileSize", pFile->zPath);
+ }
+ }
+#else
+ {
+ DWORD upperBits;
+ DWORD lowerBits;
+ DWORD lastErrno;
+
+ lowerBits = osGetFileSize(pFile->h, &upperBits);
+ *pSize = (((sqlite3_int64)upperBits)<<32) + lowerBits;
+ if( (lowerBits == INVALID_FILE_SIZE)
+ && ((lastErrno = osGetLastError())!=NO_ERROR) ){
+ pFile->lastErrno = lastErrno;
+ rc = winLogError(SQLITE_IOERR_FSTAT, pFile->lastErrno,
+ "winFileSize", pFile->zPath);
+ }
+ }
+#endif
+ OSTRACE(("SIZE file=%p, pSize=%p, *pSize=%lld, rc=%s\n",
+ pFile->h, pSize, *pSize, sqlite3ErrName(rc)));
+ return rc;
+}
+
+/*
+** LOCKFILE_FAIL_IMMEDIATELY is undefined on some Windows systems.
+*/
+#ifndef LOCKFILE_FAIL_IMMEDIATELY
+# define LOCKFILE_FAIL_IMMEDIATELY 1
+#endif
+
+#ifndef LOCKFILE_EXCLUSIVE_LOCK
+# define LOCKFILE_EXCLUSIVE_LOCK 2
+#endif
+
+/*
+** Historically, SQLite has used both the LockFile and LockFileEx functions.
+** When the LockFile function was used, it was always expected to fail
+** immediately if the lock could not be obtained. Also, it always expected to
+** obtain an exclusive lock. These flags are used with the LockFileEx function
+** and reflect those expectations; therefore, they should not be changed.
+*/
+#ifndef SQLITE_LOCKFILE_FLAGS
+# define SQLITE_LOCKFILE_FLAGS (LOCKFILE_FAIL_IMMEDIATELY | \
+ LOCKFILE_EXCLUSIVE_LOCK)
+#endif
+
+/*
+** Currently, SQLite never calls the LockFileEx function without wanting the
+** call to fail immediately if the lock cannot be obtained.
+*/
+#ifndef SQLITE_LOCKFILEEX_FLAGS
+# define SQLITE_LOCKFILEEX_FLAGS (LOCKFILE_FAIL_IMMEDIATELY)
+#endif
+
+/*
+** Acquire a reader lock.
+** Different API routines are called depending on whether or not this
+** is Win9x or WinNT.
+*/
+static int winGetReadLock(winFile *pFile){
+ int res;
+ OSTRACE(("READ-LOCK file=%p, lock=%d\n", pFile->h, pFile->locktype));
+ if( osIsNT() ){
+#if SQLITE_OS_WINCE
+ /*
+ ** NOTE: Windows CE is handled differently here due its lack of the Win32
+ ** API LockFileEx.
+ */
+ res = winceLockFile(&pFile->h, SHARED_FIRST, 0, 1, 0);
+#else
+ res = winLockFile(&pFile->h, SQLITE_LOCKFILEEX_FLAGS, SHARED_FIRST, 0,
+ SHARED_SIZE, 0);
+#endif
+ }
+#ifdef SQLITE_WIN32_HAS_ANSI
+ else{
+ int lk;
+ sqlite3_randomness(sizeof(lk), &lk);
+ pFile->sharedLockByte = (short)((lk & 0x7fffffff)%(SHARED_SIZE - 1));
+ res = winLockFile(&pFile->h, SQLITE_LOCKFILE_FLAGS,
+ SHARED_FIRST+pFile->sharedLockByte, 0, 1, 0);
+ }
+#endif
+ if( res == 0 ){
+ pFile->lastErrno = osGetLastError();
+ /* No need to log a failure to lock */
+ }
+ OSTRACE(("READ-LOCK file=%p, result=%d\n", pFile->h, res));
+ return res;
+}
+
+/*
+** Undo a readlock
+*/
+static int winUnlockReadLock(winFile *pFile){
+ int res;
+ DWORD lastErrno;
+ OSTRACE(("READ-UNLOCK file=%p, lock=%d\n", pFile->h, pFile->locktype));
+ if( osIsNT() ){
+ res = winUnlockFile(&pFile->h, SHARED_FIRST, 0, SHARED_SIZE, 0);
+ }
+#ifdef SQLITE_WIN32_HAS_ANSI
+ else{
+ res = winUnlockFile(&pFile->h, SHARED_FIRST+pFile->sharedLockByte, 0, 1, 0);
+ }
+#endif
+ if( res==0 && ((lastErrno = osGetLastError())!=ERROR_NOT_LOCKED) ){
+ pFile->lastErrno = lastErrno;
+ winLogError(SQLITE_IOERR_UNLOCK, pFile->lastErrno,
+ "winUnlockReadLock", pFile->zPath);
+ }
+ OSTRACE(("READ-UNLOCK file=%p, result=%d\n", pFile->h, res));
+ return res;
+}
+
+/*
+** Lock the file with the lock specified by parameter locktype - one
+** of the following:
+**
+** (1) SHARED_LOCK
+** (2) RESERVED_LOCK
+** (3) PENDING_LOCK
+** (4) EXCLUSIVE_LOCK
+**
+** Sometimes when requesting one lock state, additional lock states
+** are inserted in between. The locking might fail on one of the later
+** transitions leaving the lock state different from what it started but
+** still short of its goal. The following chart shows the allowed
+** transitions and the inserted intermediate states:
+**
+** UNLOCKED -> SHARED
+** SHARED -> RESERVED
+** SHARED -> (PENDING) -> EXCLUSIVE
+** RESERVED -> (PENDING) -> EXCLUSIVE
+** PENDING -> EXCLUSIVE
+**
+** This routine will only increase a lock. The winUnlock() routine
+** erases all locks at once and returns us immediately to locking level 0.
+** It is not possible to lower the locking level one step at a time. You
+** must go straight to locking level 0.
+*/
+static int winLock(sqlite3_file *id, int locktype){
+ int rc = SQLITE_OK; /* Return code from subroutines */
+ int res = 1; /* Result of a Windows lock call */
+ int newLocktype; /* Set pFile->locktype to this value before exiting */
+ int gotPendingLock = 0;/* True if we acquired a PENDING lock this time */
+ winFile *pFile = (winFile*)id;
+ DWORD lastErrno = NO_ERROR;
+
+ assert( id!=0 );
+ OSTRACE(("LOCK file=%p, oldLock=%d(%d), newLock=%d\n",
+ pFile->h, pFile->locktype, pFile->sharedLockByte, locktype));
+
+ /* If there is already a lock of this type or more restrictive on the
+ ** OsFile, do nothing. Don't use the end_lock: exit path, as
+ ** sqlite3OsEnterMutex() hasn't been called yet.
+ */
+ if( pFile->locktype>=locktype ){
+ OSTRACE(("LOCK-HELD file=%p, rc=SQLITE_OK\n", pFile->h));
+ return SQLITE_OK;
+ }
+
+ /* Do not allow any kind of write-lock on a read-only database
+ */
+ if( (pFile->ctrlFlags & WINFILE_RDONLY)!=0 && locktype>=RESERVED_LOCK ){
+ return SQLITE_IOERR_LOCK;
+ }
+
+ /* Make sure the locking sequence is correct
+ */
+ assert( pFile->locktype!=NO_LOCK || locktype==SHARED_LOCK );
+ assert( locktype!=PENDING_LOCK );
+ assert( locktype!=RESERVED_LOCK || pFile->locktype==SHARED_LOCK );
+
+ /* Lock the PENDING_LOCK byte if we need to acquire a PENDING lock or
+ ** a SHARED lock. If we are acquiring a SHARED lock, the acquisition of
+ ** the PENDING_LOCK byte is temporary.
+ */
+ newLocktype = pFile->locktype;
+ if( pFile->locktype==NO_LOCK
+ || (locktype==EXCLUSIVE_LOCK && pFile->locktype<=RESERVED_LOCK)
+ ){
+ int cnt = 3;
+ while( cnt-->0 && (res = winLockFile(&pFile->h, SQLITE_LOCKFILE_FLAGS,
+ PENDING_BYTE, 0, 1, 0))==0 ){
+ /* Try 3 times to get the pending lock. This is needed to work
+ ** around problems caused by indexing and/or anti-virus software on
+ ** Windows systems.
+ ** If you are using this code as a model for alternative VFSes, do not
+ ** copy this retry logic. It is a hack intended for Windows only.
+ */
+ lastErrno = osGetLastError();
+ OSTRACE(("LOCK-PENDING-FAIL file=%p, count=%d, result=%d\n",
+ pFile->h, cnt, res));
+ if( lastErrno==ERROR_INVALID_HANDLE ){
+ pFile->lastErrno = lastErrno;
+ rc = SQLITE_IOERR_LOCK;
+ OSTRACE(("LOCK-FAIL file=%p, count=%d, rc=%s\n",
+ pFile->h, cnt, sqlite3ErrName(rc)));
+ return rc;
+ }
+ if( cnt ) sqlite3_win32_sleep(1);
+ }
+ gotPendingLock = res;
+ if( !res ){
+ lastErrno = osGetLastError();
+ }
+ }
+
+ /* Acquire a shared lock
+ */
+ if( locktype==SHARED_LOCK && res ){
+ assert( pFile->locktype==NO_LOCK );
+ res = winGetReadLock(pFile);
+ if( res ){
+ newLocktype = SHARED_LOCK;
+ }else{
+ lastErrno = osGetLastError();
+ }
+ }
+
+ /* Acquire a RESERVED lock
+ */
+ if( locktype==RESERVED_LOCK && res ){
+ assert( pFile->locktype==SHARED_LOCK );
+ res = winLockFile(&pFile->h, SQLITE_LOCKFILE_FLAGS, RESERVED_BYTE, 0, 1, 0);
+ if( res ){
+ newLocktype = RESERVED_LOCK;
+ }else{
+ lastErrno = osGetLastError();
+ }
+ }
+
+ /* Acquire a PENDING lock
+ */
+ if( locktype==EXCLUSIVE_LOCK && res ){
+ newLocktype = PENDING_LOCK;
+ gotPendingLock = 0;
+ }
+
+ /* Acquire an EXCLUSIVE lock
+ */
+ if( locktype==EXCLUSIVE_LOCK && res ){
+ assert( pFile->locktype>=SHARED_LOCK );
+ (void)winUnlockReadLock(pFile);
+ res = winLockFile(&pFile->h, SQLITE_LOCKFILE_FLAGS, SHARED_FIRST, 0,
+ SHARED_SIZE, 0);
+ if( res ){
+ newLocktype = EXCLUSIVE_LOCK;
+ }else{
+ lastErrno = osGetLastError();
+ winGetReadLock(pFile);
+ }
+ }
+
+ /* If we are holding a PENDING lock that ought to be released, then
+ ** release it now.
+ */
+ if( gotPendingLock && locktype==SHARED_LOCK ){
+ winUnlockFile(&pFile->h, PENDING_BYTE, 0, 1, 0);
+ }
+
+ /* Update the state of the lock has held in the file descriptor then
+ ** return the appropriate result code.
+ */
+ if( res ){
+ rc = SQLITE_OK;
+ }else{
+ pFile->lastErrno = lastErrno;
+ rc = SQLITE_BUSY;
+ OSTRACE(("LOCK-FAIL file=%p, wanted=%d, got=%d\n",
+ pFile->h, locktype, newLocktype));
+ }
+ pFile->locktype = (u8)newLocktype;
+ OSTRACE(("LOCK file=%p, lock=%d, rc=%s\n",
+ pFile->h, pFile->locktype, sqlite3ErrName(rc)));
+ return rc;
+}
+
+/*
+** This routine checks if there is a RESERVED lock held on the specified
+** file by this or any other process. If such a lock is held, return
+** non-zero, otherwise zero.
+*/
+static int winCheckReservedLock(sqlite3_file *id, int *pResOut){
+ int res;
+ winFile *pFile = (winFile*)id;
+
+ SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; );
+ OSTRACE(("TEST-WR-LOCK file=%p, pResOut=%p\n", pFile->h, pResOut));
+
+ assert( id!=0 );
+ if( pFile->locktype>=RESERVED_LOCK ){
+ res = 1;
+ OSTRACE(("TEST-WR-LOCK file=%p, result=%d (local)\n", pFile->h, res));
+ }else{
+ res = winLockFile(&pFile->h, SQLITE_LOCKFILEEX_FLAGS,RESERVED_BYTE,0,1,0);
+ if( res ){
+ winUnlockFile(&pFile->h, RESERVED_BYTE, 0, 1, 0);
+ }
+ res = !res;
+ OSTRACE(("TEST-WR-LOCK file=%p, result=%d (remote)\n", pFile->h, res));
+ }
+ *pResOut = res;
+ OSTRACE(("TEST-WR-LOCK file=%p, pResOut=%p, *pResOut=%d, rc=SQLITE_OK\n",
+ pFile->h, pResOut, *pResOut));
+ return SQLITE_OK;
+}
+
+/*
+** Lower the locking level on file descriptor id to locktype. locktype
+** must be either NO_LOCK or SHARED_LOCK.
+**
+** If the locking level of the file descriptor is already at or below
+** the requested locking level, this routine is a no-op.
+**
+** It is not possible for this routine to fail if the second argument
+** is NO_LOCK. If the second argument is SHARED_LOCK then this routine
+** might return SQLITE_IOERR;
+*/
+static int winUnlock(sqlite3_file *id, int locktype){
+ int type;
+ winFile *pFile = (winFile*)id;
+ int rc = SQLITE_OK;
+ assert( pFile!=0 );
+ assert( locktype<=SHARED_LOCK );
+ OSTRACE(("UNLOCK file=%p, oldLock=%d(%d), newLock=%d\n",
+ pFile->h, pFile->locktype, pFile->sharedLockByte, locktype));
+ type = pFile->locktype;
+ if( type>=EXCLUSIVE_LOCK ){
+ winUnlockFile(&pFile->h, SHARED_FIRST, 0, SHARED_SIZE, 0);
+ if( locktype==SHARED_LOCK && !winGetReadLock(pFile) ){
+ /* This should never happen. We should always be able to
+ ** reacquire the read lock */
+ rc = winLogError(SQLITE_IOERR_UNLOCK, osGetLastError(),
+ "winUnlock", pFile->zPath);
+ }
+ }
+ if( type>=RESERVED_LOCK ){
+ winUnlockFile(&pFile->h, RESERVED_BYTE, 0, 1, 0);
+ }
+ if( locktype==NO_LOCK && type>=SHARED_LOCK ){
+ winUnlockReadLock(pFile);
+ }
+ if( type>=PENDING_LOCK ){
+ winUnlockFile(&pFile->h, PENDING_BYTE, 0, 1, 0);
+ }
+ pFile->locktype = (u8)locktype;
+ OSTRACE(("UNLOCK file=%p, lock=%d, rc=%s\n",
+ pFile->h, pFile->locktype, sqlite3ErrName(rc)));
+ return rc;
+}
+
+/******************************************************************************
+****************************** No-op Locking **********************************
+**
+** Of the various locking implementations available, this is by far the
+** simplest: locking is ignored. No attempt is made to lock the database
+** file for reading or writing.
+**
+** This locking mode is appropriate for use on read-only databases
+** (ex: databases that are burned into CD-ROM, for example.) It can
+** also be used if the application employs some external mechanism to
+** prevent simultaneous access of the same database by two or more
+** database connections. But there is a serious risk of database
+** corruption if this locking mode is used in situations where multiple
+** database connections are accessing the same database file at the same
+** time and one or more of those connections are writing.
+*/
+
+static int winNolockLock(sqlite3_file *id, int locktype){
+ UNUSED_PARAMETER(id);
+ UNUSED_PARAMETER(locktype);
+ return SQLITE_OK;
+}
+
+static int winNolockCheckReservedLock(sqlite3_file *id, int *pResOut){
+ UNUSED_PARAMETER(id);
+ UNUSED_PARAMETER(pResOut);
+ return SQLITE_OK;
+}
+
+static int winNolockUnlock(sqlite3_file *id, int locktype){
+ UNUSED_PARAMETER(id);
+ UNUSED_PARAMETER(locktype);
+ return SQLITE_OK;
+}
+
+/******************* End of the no-op lock implementation *********************
+******************************************************************************/
+
+/*
+** If *pArg is initially negative then this is a query. Set *pArg to
+** 1 or 0 depending on whether or not bit mask of pFile->ctrlFlags is set.
+**
+** If *pArg is 0 or 1, then clear or set the mask bit of pFile->ctrlFlags.
+*/
+static void winModeBit(winFile *pFile, unsigned char mask, int *pArg){
+ if( *pArg<0 ){
+ *pArg = (pFile->ctrlFlags & mask)!=0;
+ }else if( (*pArg)==0 ){
+ pFile->ctrlFlags &= ~mask;
+ }else{
+ pFile->ctrlFlags |= mask;
+ }
+}
+
+/* Forward references to VFS helper methods used for temporary files */
+static int winGetTempname(sqlite3_vfs *, char **);
+static int winIsDir(const void *);
+static BOOL winIsLongPathPrefix(const char *);
+static BOOL winIsDriveLetterAndColon(const char *);
+
+/*
+** Control and query of the open file handle.
+*/
+static int winFileControl(sqlite3_file *id, int op, void *pArg){
+ winFile *pFile = (winFile*)id;
+ OSTRACE(("FCNTL file=%p, op=%d, pArg=%p\n", pFile->h, op, pArg));
+ switch( op ){
+ case SQLITE_FCNTL_LOCKSTATE: {
+ *(int*)pArg = pFile->locktype;
+ OSTRACE(("FCNTL file=%p, rc=SQLITE_OK\n", pFile->h));
+ return SQLITE_OK;
+ }
+ case SQLITE_FCNTL_LAST_ERRNO: {
+ *(int*)pArg = (int)pFile->lastErrno;
+ OSTRACE(("FCNTL file=%p, rc=SQLITE_OK\n", pFile->h));
+ return SQLITE_OK;
+ }
+ case SQLITE_FCNTL_CHUNK_SIZE: {
+ pFile->szChunk = *(int *)pArg;
+ OSTRACE(("FCNTL file=%p, rc=SQLITE_OK\n", pFile->h));
+ return SQLITE_OK;
+ }
+ case SQLITE_FCNTL_SIZE_HINT: {
+ if( pFile->szChunk>0 ){
+ sqlite3_int64 oldSz;
+ int rc = winFileSize(id, &oldSz);
+ if( rc==SQLITE_OK ){
+ sqlite3_int64 newSz = *(sqlite3_int64*)pArg;
+ if( newSz>oldSz ){
+ SimulateIOErrorBenign(1);
+ rc = winTruncate(id, newSz);
+ SimulateIOErrorBenign(0);
+ }
+ }
+ OSTRACE(("FCNTL file=%p, rc=%s\n", pFile->h, sqlite3ErrName(rc)));
+ return rc;
+ }
+ OSTRACE(("FCNTL file=%p, rc=SQLITE_OK\n", pFile->h));
+ return SQLITE_OK;
+ }
+ case SQLITE_FCNTL_PERSIST_WAL: {
+ winModeBit(pFile, WINFILE_PERSIST_WAL, (int*)pArg);
+ OSTRACE(("FCNTL file=%p, rc=SQLITE_OK\n", pFile->h));
+ return SQLITE_OK;
+ }
+ case SQLITE_FCNTL_POWERSAFE_OVERWRITE: {
+ winModeBit(pFile, WINFILE_PSOW, (int*)pArg);
+ OSTRACE(("FCNTL file=%p, rc=SQLITE_OK\n", pFile->h));
+ return SQLITE_OK;
+ }
+ case SQLITE_FCNTL_VFSNAME: {
+ *(char**)pArg = sqlite3_mprintf("%s", pFile->pVfs->zName);
+ OSTRACE(("FCNTL file=%p, rc=SQLITE_OK\n", pFile->h));
+ return SQLITE_OK;
+ }
+ case SQLITE_FCNTL_WIN32_AV_RETRY: {
+ int *a = (int*)pArg;
+ if( a[0]>0 ){
+ winIoerrRetry = a[0];
+ }else{
+ a[0] = winIoerrRetry;
+ }
+ if( a[1]>0 ){
+ winIoerrRetryDelay = a[1];
+ }else{
+ a[1] = winIoerrRetryDelay;
+ }
+ OSTRACE(("FCNTL file=%p, rc=SQLITE_OK\n", pFile->h));
+ return SQLITE_OK;
+ }
+ case SQLITE_FCNTL_WIN32_GET_HANDLE: {
+ LPHANDLE phFile = (LPHANDLE)pArg;
+ *phFile = pFile->h;
+ OSTRACE(("FCNTL file=%p, rc=SQLITE_OK\n", pFile->h));
+ return SQLITE_OK;
+ }
+#ifdef SQLITE_TEST
+ case SQLITE_FCNTL_WIN32_SET_HANDLE: {
+ LPHANDLE phFile = (LPHANDLE)pArg;
+ HANDLE hOldFile = pFile->h;
+ pFile->h = *phFile;
+ *phFile = hOldFile;
+ OSTRACE(("FCNTL oldFile=%p, newFile=%p, rc=SQLITE_OK\n",
+ hOldFile, pFile->h));
+ return SQLITE_OK;
+ }
+#endif
+ case SQLITE_FCNTL_NULL_IO: {
+ (void)osCloseHandle(pFile->h);
+ pFile->h = NULL;
+ return SQLITE_OK;
+ }
+ case SQLITE_FCNTL_TEMPFILENAME: {
+ char *zTFile = 0;
+ int rc = winGetTempname(pFile->pVfs, &zTFile);
+ if( rc==SQLITE_OK ){
+ *(char**)pArg = zTFile;
+ }
+ OSTRACE(("FCNTL file=%p, rc=%s\n", pFile->h, sqlite3ErrName(rc)));
+ return rc;
+ }
+#if SQLITE_MAX_MMAP_SIZE>0
+ case SQLITE_FCNTL_MMAP_SIZE: {
+ i64 newLimit = *(i64*)pArg;
+ int rc = SQLITE_OK;
+ if( newLimit>sqlite3GlobalConfig.mxMmap ){
+ newLimit = sqlite3GlobalConfig.mxMmap;
+ }
+
+ /* The value of newLimit may be eventually cast to (SIZE_T) and passed
+ ** to MapViewOfFile(). Restrict its value to 2GB if (SIZE_T) is not at
+ ** least a 64-bit type. */
+ if( newLimit>0 && sizeof(SIZE_T)<8 ){
+ newLimit = (newLimit & 0x7FFFFFFF);
+ }
+
+ *(i64*)pArg = pFile->mmapSizeMax;
+ if( newLimit>=0 && newLimit!=pFile->mmapSizeMax && pFile->nFetchOut==0 ){
+ pFile->mmapSizeMax = newLimit;
+ if( pFile->mmapSize>0 ){
+ winUnmapfile(pFile);
+ rc = winMapfile(pFile, -1);
+ }
+ }
+ OSTRACE(("FCNTL file=%p, rc=%s\n", pFile->h, sqlite3ErrName(rc)));
+ return rc;
+ }
+#endif
+ }
+ OSTRACE(("FCNTL file=%p, rc=SQLITE_NOTFOUND\n", pFile->h));
+ return SQLITE_NOTFOUND;
+}
+
+/*
+** Return the sector size in bytes of the underlying block device for
+** the specified file. This is almost always 512 bytes, but may be
+** larger for some devices.
+**
+** SQLite code assumes this function cannot fail. It also assumes that
+** if two files are created in the same file-system directory (i.e.
+** a database and its journal file) that the sector size will be the
+** same for both.
+*/
+static int winSectorSize(sqlite3_file *id){
+ (void)id;
+ return SQLITE_DEFAULT_SECTOR_SIZE;
+}
+
+/*
+** Return a vector of device characteristics.
+*/
+static int winDeviceCharacteristics(sqlite3_file *id){
+ winFile *p = (winFile*)id;
+ return SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN | SQLITE_IOCAP_SUBPAGE_READ |
+ ((p->ctrlFlags & WINFILE_PSOW)?SQLITE_IOCAP_POWERSAFE_OVERWRITE:0);
+}
+
+/*
+** Windows will only let you create file view mappings
+** on allocation size granularity boundaries.
+** During sqlite3_os_init() we do a GetSystemInfo()
+** to get the granularity size.
+*/
+static SYSTEM_INFO winSysInfo;
+
+#ifndef SQLITE_OMIT_WAL
+
+/*
+** Helper functions to obtain and relinquish the global mutex. The
+** global mutex is used to protect the winLockInfo objects used by
+** this file, all of which may be shared by multiple threads.
+**
+** Function winShmMutexHeld() is used to assert() that the global mutex
+** is held when required. This function is only used as part of assert()
+** statements. e.g.
+**
+** winShmEnterMutex()
+** assert( winShmMutexHeld() );
+** winShmLeaveMutex()
+*/
+static sqlite3_mutex *winBigLock = 0;
+static void winShmEnterMutex(void){
+ sqlite3_mutex_enter(winBigLock);
+}
+static void winShmLeaveMutex(void){
+ sqlite3_mutex_leave(winBigLock);
+}
+#ifndef NDEBUG
+static int winShmMutexHeld(void) {
+ return sqlite3_mutex_held(winBigLock);
+}
+#endif
+
+/*
+** Object used to represent a single file opened and mmapped to provide
+** shared memory. When multiple threads all reference the same
+** log-summary, each thread has its own winFile object, but they all
+** point to a single instance of this object. In other words, each
+** log-summary is opened only once per process.
+**
+** winShmMutexHeld() must be true when creating or destroying
+** this object or while reading or writing the following fields:
+**
+** nRef
+** pNext
+**
+** The following fields are read-only after the object is created:
+**
+** fid
+** zFilename
+**
+** Either winShmNode.mutex must be held or winShmNode.nRef==0 and
+** winShmMutexHeld() is true when reading or writing any other field
+** in this structure.
+**
+*/
+struct winShmNode {
+ sqlite3_mutex *mutex; /* Mutex to access this object */
+ char *zFilename; /* Name of the file */
+ winFile hFile; /* File handle from winOpen */
+
+ int szRegion; /* Size of shared-memory regions */
+ int nRegion; /* Size of array apRegion */
+ u8 isReadonly; /* True if read-only */
+ u8 isUnlocked; /* True if no DMS lock held */
+
+ struct ShmRegion {
+ HANDLE hMap; /* File handle from CreateFileMapping */
+ void *pMap;
+ } *aRegion;
+ DWORD lastErrno; /* The Windows errno from the last I/O error */
+
+ int nRef; /* Number of winShm objects pointing to this */
+ winShm *pFirst; /* All winShm objects pointing to this */
+ winShmNode *pNext; /* Next in list of all winShmNode objects */
+#if defined(SQLITE_DEBUG) || defined(SQLITE_HAVE_OS_TRACE)
+ u8 nextShmId; /* Next available winShm.id value */
+#endif
+};
+
+/*
+** A global array of all winShmNode objects.
+**
+** The winShmMutexHeld() must be true while reading or writing this list.
+*/
+static winShmNode *winShmNodeList = 0;
+
+/*
+** Structure used internally by this VFS to record the state of an
+** open shared memory connection.
+**
+** The following fields are initialized when this object is created and
+** are read-only thereafter:
+**
+** winShm.pShmNode
+** winShm.id
+**
+** All other fields are read/write. The winShm.pShmNode->mutex must be held
+** while accessing any read/write fields.
+*/
+struct winShm {
+ winShmNode *pShmNode; /* The underlying winShmNode object */
+ winShm *pNext; /* Next winShm with the same winShmNode */
+ u8 hasMutex; /* True if holding the winShmNode mutex */
+ u16 sharedMask; /* Mask of shared locks held */
+ u16 exclMask; /* Mask of exclusive locks held */
+#if defined(SQLITE_DEBUG) || defined(SQLITE_HAVE_OS_TRACE)
+ u8 id; /* Id of this connection with its winShmNode */
+#endif
+};
+
+/*
+** Constants used for locking
+*/
+#define WIN_SHM_BASE ((22+SQLITE_SHM_NLOCK)*4) /* first lock byte */
+#define WIN_SHM_DMS (WIN_SHM_BASE+SQLITE_SHM_NLOCK) /* deadman switch */
+
+/*
+** Apply advisory locks for all n bytes beginning at ofst.
+*/
+#define WINSHM_UNLCK 1
+#define WINSHM_RDLCK 2
+#define WINSHM_WRLCK 3
+static int winShmSystemLock(
+ winShmNode *pFile, /* Apply locks to this open shared-memory segment */
+ int lockType, /* WINSHM_UNLCK, WINSHM_RDLCK, or WINSHM_WRLCK */
+ int ofst, /* Offset to first byte to be locked/unlocked */
+ int nByte /* Number of bytes to lock or unlock */
+){
+ int rc = 0; /* Result code form Lock/UnlockFileEx() */
+
+ /* Access to the winShmNode object is serialized by the caller */
+ assert( pFile->nRef==0 || sqlite3_mutex_held(pFile->mutex) );
+
+ OSTRACE(("SHM-LOCK file=%p, lock=%d, offset=%d, size=%d\n",
+ pFile->hFile.h, lockType, ofst, nByte));
+
+ /* Release/Acquire the system-level lock */
+ if( lockType==WINSHM_UNLCK ){
+ rc = winUnlockFile(&pFile->hFile.h, ofst, 0, nByte, 0);
+ }else{
+ /* Initialize the locking parameters */
+ DWORD dwFlags = LOCKFILE_FAIL_IMMEDIATELY;
+ if( lockType == WINSHM_WRLCK ) dwFlags |= LOCKFILE_EXCLUSIVE_LOCK;
+ rc = winLockFile(&pFile->hFile.h, dwFlags, ofst, 0, nByte, 0);
+ }
+
+ if( rc!= 0 ){
+ rc = SQLITE_OK;
+ }else{
+ pFile->lastErrno = osGetLastError();
+ rc = SQLITE_BUSY;
+ }
+
+ OSTRACE(("SHM-LOCK file=%p, func=%s, errno=%lu, rc=%s\n",
+ pFile->hFile.h, (lockType == WINSHM_UNLCK) ? "winUnlockFile" :
+ "winLockFile", pFile->lastErrno, sqlite3ErrName(rc)));
+
+ return rc;
+}
+
+/* Forward references to VFS methods */
+static int winOpen(sqlite3_vfs*,const char*,sqlite3_file*,int,int*);
+static int winDelete(sqlite3_vfs *,const char*,int);
+
+/*
+** Purge the winShmNodeList list of all entries with winShmNode.nRef==0.
+**
+** This is not a VFS shared-memory method; it is a utility function called
+** by VFS shared-memory methods.
+*/
+static void winShmPurge(sqlite3_vfs *pVfs, int deleteFlag){
+ winShmNode **pp;
+ winShmNode *p;
+ assert( winShmMutexHeld() );
+ OSTRACE(("SHM-PURGE pid=%lu, deleteFlag=%d\n",
+ osGetCurrentProcessId(), deleteFlag));
+ pp = &winShmNodeList;
+ while( (p = *pp)!=0 ){
+ if( p->nRef==0 ){
+ int i;
+ if( p->mutex ){ sqlite3_mutex_free(p->mutex); }
+ for(i=0; i<p->nRegion; i++){
+ BOOL bRc = osUnmapViewOfFile(p->aRegion[i].pMap);
+ OSTRACE(("SHM-PURGE-UNMAP pid=%lu, region=%d, rc=%s\n",
+ osGetCurrentProcessId(), i, bRc ? "ok" : "failed"));
+ UNUSED_VARIABLE_VALUE(bRc);
+ bRc = osCloseHandle(p->aRegion[i].hMap);
+ OSTRACE(("SHM-PURGE-CLOSE pid=%lu, region=%d, rc=%s\n",
+ osGetCurrentProcessId(), i, bRc ? "ok" : "failed"));
+ UNUSED_VARIABLE_VALUE(bRc);
+ }
+ if( p->hFile.h!=NULL && p->hFile.h!=INVALID_HANDLE_VALUE ){
+ SimulateIOErrorBenign(1);
+ winClose((sqlite3_file *)&p->hFile);
+ SimulateIOErrorBenign(0);
+ }
+ if( deleteFlag ){
+ SimulateIOErrorBenign(1);
+ sqlite3BeginBenignMalloc();
+ winDelete(pVfs, p->zFilename, 0);
+ sqlite3EndBenignMalloc();
+ SimulateIOErrorBenign(0);
+ }
+ *pp = p->pNext;
+ sqlite3_free(p->aRegion);
+ sqlite3_free(p);
+ }else{
+ pp = &p->pNext;
+ }
+ }
+}
+
+/*
+** The DMS lock has not yet been taken on shm file pShmNode. Attempt to
+** take it now. Return SQLITE_OK if successful, or an SQLite error
+** code otherwise.
+**
+** If the DMS cannot be locked because this is a readonly_shm=1
+** connection and no other process already holds a lock, return
+** SQLITE_READONLY_CANTINIT and set pShmNode->isUnlocked=1.
+*/
+static int winLockSharedMemory(winShmNode *pShmNode){
+ int rc = winShmSystemLock(pShmNode, WINSHM_WRLCK, WIN_SHM_DMS, 1);
+
+ if( rc==SQLITE_OK ){
+ if( pShmNode->isReadonly ){
+ pShmNode->isUnlocked = 1;
+ winShmSystemLock(pShmNode, WINSHM_UNLCK, WIN_SHM_DMS, 1);
+ return SQLITE_READONLY_CANTINIT;
+ }else if( winTruncate((sqlite3_file*)&pShmNode->hFile, 0) ){
+ winShmSystemLock(pShmNode, WINSHM_UNLCK, WIN_SHM_DMS, 1);
+ return winLogError(SQLITE_IOERR_SHMOPEN, osGetLastError(),
+ "winLockSharedMemory", pShmNode->zFilename);
+ }
+ }
+
+ if( rc==SQLITE_OK ){
+ winShmSystemLock(pShmNode, WINSHM_UNLCK, WIN_SHM_DMS, 1);
+ }
+
+ return winShmSystemLock(pShmNode, WINSHM_RDLCK, WIN_SHM_DMS, 1);
+}
+
+/*
+** Open the shared-memory area associated with database file pDbFd.
+**
+** When opening a new shared-memory file, if no other instances of that
+** file are currently open, in this process or in other processes, then
+** the file must be truncated to zero length or have its header cleared.
+*/
+static int winOpenSharedMemory(winFile *pDbFd){
+ struct winShm *p; /* The connection to be opened */
+ winShmNode *pShmNode = 0; /* The underlying mmapped file */
+ int rc = SQLITE_OK; /* Result code */
+ winShmNode *pNew; /* Newly allocated winShmNode */
+ int nName; /* Size of zName in bytes */
+
+ assert( pDbFd->pShm==0 ); /* Not previously opened */
+
+ /* Allocate space for the new sqlite3_shm object. Also speculatively
+ ** allocate space for a new winShmNode and filename.
+ */
+ p = sqlite3MallocZero( sizeof(*p) );
+ if( p==0 ) return SQLITE_IOERR_NOMEM_BKPT;
+ nName = sqlite3Strlen30(pDbFd->zPath);
+ pNew = sqlite3MallocZero( sizeof(*pShmNode) + nName + 17 );
+ if( pNew==0 ){
+ sqlite3_free(p);
+ return SQLITE_IOERR_NOMEM_BKPT;
+ }
+ pNew->zFilename = (char*)&pNew[1];
+ sqlite3_snprintf(nName+15, pNew->zFilename, "%s-shm", pDbFd->zPath);
+ sqlite3FileSuffix3(pDbFd->zPath, pNew->zFilename);
+
+ /* Look to see if there is an existing winShmNode that can be used.
+ ** If no matching winShmNode currently exists, create a new one.
+ */
+ winShmEnterMutex();
+ for(pShmNode = winShmNodeList; pShmNode; pShmNode=pShmNode->pNext){
+ /* TBD need to come up with better match here. Perhaps
+ ** use FILE_ID_BOTH_DIR_INFO Structure.
+ */
+ if( sqlite3StrICmp(pShmNode->zFilename, pNew->zFilename)==0 ) break;
+ }
+ if( pShmNode ){
+ sqlite3_free(pNew);
+ }else{
+ int inFlags = SQLITE_OPEN_WAL;
+ int outFlags = 0;
+
+ pShmNode = pNew;
+ pNew = 0;
+ ((winFile*)(&pShmNode->hFile))->h = INVALID_HANDLE_VALUE;
+ pShmNode->pNext = winShmNodeList;
+ winShmNodeList = pShmNode;
+
+ if( sqlite3GlobalConfig.bCoreMutex ){
+ pShmNode->mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST);
+ if( pShmNode->mutex==0 ){
+ rc = SQLITE_IOERR_NOMEM_BKPT;
+ goto shm_open_err;
+ }
+ }
+
+ if( 0==sqlite3_uri_boolean(pDbFd->zPath, "readonly_shm", 0) ){
+ inFlags |= SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE;
+ }else{
+ inFlags |= SQLITE_OPEN_READONLY;
+ }
+ rc = winOpen(pDbFd->pVfs, pShmNode->zFilename,
+ (sqlite3_file*)&pShmNode->hFile,
+ inFlags, &outFlags);
+ if( rc!=SQLITE_OK ){
+ rc = winLogError(rc, osGetLastError(), "winOpenShm",
+ pShmNode->zFilename);
+ goto shm_open_err;
+ }
+ if( outFlags==SQLITE_OPEN_READONLY ) pShmNode->isReadonly = 1;
+
+ rc = winLockSharedMemory(pShmNode);
+ if( rc!=SQLITE_OK && rc!=SQLITE_READONLY_CANTINIT ) goto shm_open_err;
+ }
+
+ /* Make the new connection a child of the winShmNode */
+ p->pShmNode = pShmNode;
+#if defined(SQLITE_DEBUG) || defined(SQLITE_HAVE_OS_TRACE)
+ p->id = pShmNode->nextShmId++;
+#endif
+ pShmNode->nRef++;
+ pDbFd->pShm = p;
+ winShmLeaveMutex();
+
+ /* The reference count on pShmNode has already been incremented under
+ ** the cover of the winShmEnterMutex() mutex and the pointer from the
+ ** new (struct winShm) object to the pShmNode has been set. All that is
+ ** left to do is to link the new object into the linked list starting
+ ** at pShmNode->pFirst. This must be done while holding the pShmNode->mutex
+ ** mutex.
+ */
+ sqlite3_mutex_enter(pShmNode->mutex);
+ p->pNext = pShmNode->pFirst;
+ pShmNode->pFirst = p;
+ sqlite3_mutex_leave(pShmNode->mutex);
+ return rc;
+
+ /* Jump here on any error */
+shm_open_err:
+ winShmSystemLock(pShmNode, WINSHM_UNLCK, WIN_SHM_DMS, 1);
+ winShmPurge(pDbFd->pVfs, 0); /* This call frees pShmNode if required */
+ sqlite3_free(p);
+ sqlite3_free(pNew);
+ winShmLeaveMutex();
+ return rc;
+}
+
+/*
+** Close a connection to shared-memory. Delete the underlying
+** storage if deleteFlag is true.
+*/
+static int winShmUnmap(
+ sqlite3_file *fd, /* Database holding shared memory */
+ int deleteFlag /* Delete after closing if true */
+){
+ winFile *pDbFd; /* Database holding shared-memory */
+ winShm *p; /* The connection to be closed */
+ winShmNode *pShmNode; /* The underlying shared-memory file */
+ winShm **pp; /* For looping over sibling connections */
+
+ pDbFd = (winFile*)fd;
+ p = pDbFd->pShm;
+ if( p==0 ) return SQLITE_OK;
+ pShmNode = p->pShmNode;
+
+ /* Remove connection p from the set of connections associated
+ ** with pShmNode */
+ sqlite3_mutex_enter(pShmNode->mutex);
+ for(pp=&pShmNode->pFirst; (*pp)!=p; pp = &(*pp)->pNext){}
+ *pp = p->pNext;
+
+ /* Free the connection p */
+ sqlite3_free(p);
+ pDbFd->pShm = 0;
+ sqlite3_mutex_leave(pShmNode->mutex);
+
+ /* If pShmNode->nRef has reached 0, then close the underlying
+ ** shared-memory file, too */
+ winShmEnterMutex();
+ assert( pShmNode->nRef>0 );
+ pShmNode->nRef--;
+ if( pShmNode->nRef==0 ){
+ winShmPurge(pDbFd->pVfs, deleteFlag);
+ }
+ winShmLeaveMutex();
+
+ return SQLITE_OK;
+}
+
+/*
+** Change the lock state for a shared-memory segment.
+*/
+static int winShmLock(
+ sqlite3_file *fd, /* Database file holding the shared memory */
+ int ofst, /* First lock to acquire or release */
+ int n, /* Number of locks to acquire or release */
+ int flags /* What to do with the lock */
+){
+ winFile *pDbFd = (winFile*)fd; /* Connection holding shared memory */
+ winShm *p = pDbFd->pShm; /* The shared memory being locked */
+ winShm *pX; /* For looping over all siblings */
+ winShmNode *pShmNode;
+ int rc = SQLITE_OK; /* Result code */
+ u16 mask; /* Mask of locks to take or release */
+
+ if( p==0 ) return SQLITE_IOERR_SHMLOCK;
+ pShmNode = p->pShmNode;
+ if( NEVER(pShmNode==0) ) return SQLITE_IOERR_SHMLOCK;
+
+ assert( ofst>=0 && ofst+n<=SQLITE_SHM_NLOCK );
+ assert( n>=1 );
+ assert( flags==(SQLITE_SHM_LOCK | SQLITE_SHM_SHARED)
+ || flags==(SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE)
+ || flags==(SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED)
+ || flags==(SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE) );
+ assert( n==1 || (flags & SQLITE_SHM_EXCLUSIVE)!=0 );
+
+ mask = (u16)((1U<<(ofst+n)) - (1U<<ofst));
+ assert( n>1 || mask==(1<<ofst) );
+ sqlite3_mutex_enter(pShmNode->mutex);
+ if( flags & SQLITE_SHM_UNLOCK ){
+ u16 allMask = 0; /* Mask of locks held by siblings */
+
+ /* See if any siblings hold this same lock */
+ for(pX=pShmNode->pFirst; pX; pX=pX->pNext){
+ if( pX==p ) continue;
+ assert( (pX->exclMask & (p->exclMask|p->sharedMask))==0 );
+ allMask |= pX->sharedMask;
+ }
+
+ /* Unlock the system-level locks */
+ if( (mask & allMask)==0 ){
+ rc = winShmSystemLock(pShmNode, WINSHM_UNLCK, ofst+WIN_SHM_BASE, n);
+ }else{
+ rc = SQLITE_OK;
+ }
+
+ /* Undo the local locks */
+ if( rc==SQLITE_OK ){
+ p->exclMask &= ~mask;
+ p->sharedMask &= ~mask;
+ }
+ }else if( flags & SQLITE_SHM_SHARED ){
+ u16 allShared = 0; /* Union of locks held by connections other than "p" */
+
+ /* Find out which shared locks are already held by sibling connections.
+ ** If any sibling already holds an exclusive lock, go ahead and return
+ ** SQLITE_BUSY.
+ */
+ for(pX=pShmNode->pFirst; pX; pX=pX->pNext){
+ if( (pX->exclMask & mask)!=0 ){
+ rc = SQLITE_BUSY;
+ break;
+ }
+ allShared |= pX->sharedMask;
+ }
+
+ /* Get shared locks at the system level, if necessary */
+ if( rc==SQLITE_OK ){
+ if( (allShared & mask)==0 ){
+ rc = winShmSystemLock(pShmNode, WINSHM_RDLCK, ofst+WIN_SHM_BASE, n);
+ }else{
+ rc = SQLITE_OK;
+ }
+ }
+
+ /* Get the local shared locks */
+ if( rc==SQLITE_OK ){
+ p->sharedMask |= mask;
+ }
+ }else{
+ /* Make sure no sibling connections hold locks that will block this
+ ** lock. If any do, return SQLITE_BUSY right away.
+ */
+ for(pX=pShmNode->pFirst; pX; pX=pX->pNext){
+ if( (pX->exclMask & mask)!=0 || (pX->sharedMask & mask)!=0 ){
+ rc = SQLITE_BUSY;
+ break;
+ }
+ }
+
+ /* Get the exclusive locks at the system level. Then if successful
+ ** also mark the local connection as being locked.
+ */
+ if( rc==SQLITE_OK ){
+ rc = winShmSystemLock(pShmNode, WINSHM_WRLCK, ofst+WIN_SHM_BASE, n);
+ if( rc==SQLITE_OK ){
+ assert( (p->sharedMask & mask)==0 );
+ p->exclMask |= mask;
+ }
+ }
+ }
+ sqlite3_mutex_leave(pShmNode->mutex);
+ OSTRACE(("SHM-LOCK pid=%lu, id=%d, sharedMask=%03x, exclMask=%03x, rc=%s\n",
+ osGetCurrentProcessId(), p->id, p->sharedMask, p->exclMask,
+ sqlite3ErrName(rc)));
+ return rc;
+}
+
+/*
+** Implement a memory barrier or memory fence on shared memory.
+**
+** All loads and stores begun before the barrier must complete before
+** any load or store begun after the barrier.
+*/
+static void winShmBarrier(
+ sqlite3_file *fd /* Database holding the shared memory */
+){
+ UNUSED_PARAMETER(fd);
+ sqlite3MemoryBarrier(); /* compiler-defined memory barrier */
+ winShmEnterMutex(); /* Also mutex, for redundancy */
+ winShmLeaveMutex();
+}
+
+/*
+** This function is called to obtain a pointer to region iRegion of the
+** shared-memory associated with the database file fd. Shared-memory regions
+** are numbered starting from zero. Each shared-memory region is szRegion
+** bytes in size.
+**
+** If an error occurs, an error code is returned and *pp is set to NULL.
+**
+** Otherwise, if the isWrite parameter is 0 and the requested shared-memory
+** region has not been allocated (by any client, including one running in a
+** separate process), then *pp is set to NULL and SQLITE_OK returned. If
+** isWrite is non-zero and the requested shared-memory region has not yet
+** been allocated, it is allocated by this function.
+**
+** If the shared-memory region has already been allocated or is allocated by
+** this call as described above, then it is mapped into this processes
+** address space (if it is not already), *pp is set to point to the mapped
+** memory and SQLITE_OK returned.
+*/
+static int winShmMap(
+ sqlite3_file *fd, /* Handle open on database file */
+ int iRegion, /* Region to retrieve */
+ int szRegion, /* Size of regions */
+ int isWrite, /* True to extend file if necessary */
+ void volatile **pp /* OUT: Mapped memory */
+){
+ winFile *pDbFd = (winFile*)fd;
+ winShm *pShm = pDbFd->pShm;
+ winShmNode *pShmNode;
+ DWORD protect = PAGE_READWRITE;
+ DWORD flags = FILE_MAP_WRITE | FILE_MAP_READ;
+ int rc = SQLITE_OK;
+
+ if( !pShm ){
+ rc = winOpenSharedMemory(pDbFd);
+ if( rc!=SQLITE_OK ) return rc;
+ pShm = pDbFd->pShm;
+ assert( pShm!=0 );
+ }
+ pShmNode = pShm->pShmNode;
+
+ sqlite3_mutex_enter(pShmNode->mutex);
+ if( pShmNode->isUnlocked ){
+ rc = winLockSharedMemory(pShmNode);
+ if( rc!=SQLITE_OK ) goto shmpage_out;
+ pShmNode->isUnlocked = 0;
+ }
+ assert( szRegion==pShmNode->szRegion || pShmNode->nRegion==0 );
+
+ if( pShmNode->nRegion<=iRegion ){
+ struct ShmRegion *apNew; /* New aRegion[] array */
+ int nByte = (iRegion+1)*szRegion; /* Minimum required file size */
+ sqlite3_int64 sz; /* Current size of wal-index file */
+
+ pShmNode->szRegion = szRegion;
+
+ /* The requested region is not mapped into this processes address space.
+ ** Check to see if it has been allocated (i.e. if the wal-index file is
+ ** large enough to contain the requested region).
+ */
+ rc = winFileSize((sqlite3_file *)&pShmNode->hFile, &sz);
+ if( rc!=SQLITE_OK ){
+ rc = winLogError(SQLITE_IOERR_SHMSIZE, osGetLastError(),
+ "winShmMap1", pDbFd->zPath);
+ goto shmpage_out;
+ }
+
+ if( sz<nByte ){
+ /* The requested memory region does not exist. If isWrite is set to
+ ** zero, exit early. *pp will be set to NULL and SQLITE_OK returned.
+ **
+ ** Alternatively, if isWrite is non-zero, use ftruncate() to allocate
+ ** the requested memory region.
+ */
+ if( !isWrite ) goto shmpage_out;
+ rc = winTruncate((sqlite3_file *)&pShmNode->hFile, nByte);
+ if( rc!=SQLITE_OK ){
+ rc = winLogError(SQLITE_IOERR_SHMSIZE, osGetLastError(),
+ "winShmMap2", pDbFd->zPath);
+ goto shmpage_out;
+ }
+ }
+
+ /* Map the requested memory region into this processes address space. */
+ apNew = (struct ShmRegion *)sqlite3_realloc64(
+ pShmNode->aRegion, (iRegion+1)*sizeof(apNew[0])
+ );
+ if( !apNew ){
+ rc = SQLITE_IOERR_NOMEM_BKPT;
+ goto shmpage_out;
+ }
+ pShmNode->aRegion = apNew;
+
+ if( pShmNode->isReadonly ){
+ protect = PAGE_READONLY;
+ flags = FILE_MAP_READ;
+ }
+
+ while( pShmNode->nRegion<=iRegion ){
+ HANDLE hMap = NULL; /* file-mapping handle */
+ void *pMap = 0; /* Mapped memory region */
+
+#if SQLITE_OS_WINRT
+ hMap = osCreateFileMappingFromApp(pShmNode->hFile.h,
+ NULL, protect, nByte, NULL
+ );
+#elif defined(SQLITE_WIN32_HAS_WIDE)
+ hMap = osCreateFileMappingW(pShmNode->hFile.h,
+ NULL, protect, 0, nByte, NULL
+ );
+#elif defined(SQLITE_WIN32_HAS_ANSI) && SQLITE_WIN32_CREATEFILEMAPPINGA
+ hMap = osCreateFileMappingA(pShmNode->hFile.h,
+ NULL, protect, 0, nByte, NULL
+ );
+#endif
+ OSTRACE(("SHM-MAP-CREATE pid=%lu, region=%d, size=%d, rc=%s\n",
+ osGetCurrentProcessId(), pShmNode->nRegion, nByte,
+ hMap ? "ok" : "failed"));
+ if( hMap ){
+ int iOffset = pShmNode->nRegion*szRegion;
+ int iOffsetShift = iOffset % winSysInfo.dwAllocationGranularity;
+#if SQLITE_OS_WINRT
+ pMap = osMapViewOfFileFromApp(hMap, flags,
+ iOffset - iOffsetShift, szRegion + iOffsetShift
+ );
+#else
+ pMap = osMapViewOfFile(hMap, flags,
+ 0, iOffset - iOffsetShift, szRegion + iOffsetShift
+ );
+#endif
+ OSTRACE(("SHM-MAP-MAP pid=%lu, region=%d, offset=%d, size=%d, rc=%s\n",
+ osGetCurrentProcessId(), pShmNode->nRegion, iOffset,
+ szRegion, pMap ? "ok" : "failed"));
+ }
+ if( !pMap ){
+ pShmNode->lastErrno = osGetLastError();
+ rc = winLogError(SQLITE_IOERR_SHMMAP, pShmNode->lastErrno,
+ "winShmMap3", pDbFd->zPath);
+ if( hMap ) osCloseHandle(hMap);
+ goto shmpage_out;
+ }
+
+ pShmNode->aRegion[pShmNode->nRegion].pMap = pMap;
+ pShmNode->aRegion[pShmNode->nRegion].hMap = hMap;
+ pShmNode->nRegion++;
+ }
+ }
+
+shmpage_out:
+ if( pShmNode->nRegion>iRegion ){
+ int iOffset = iRegion*szRegion;
+ int iOffsetShift = iOffset % winSysInfo.dwAllocationGranularity;
+ char *p = (char *)pShmNode->aRegion[iRegion].pMap;
+ *pp = (void *)&p[iOffsetShift];
+ }else{
+ *pp = 0;
+ }
+ if( pShmNode->isReadonly && rc==SQLITE_OK ) rc = SQLITE_READONLY;
+ sqlite3_mutex_leave(pShmNode->mutex);
+ return rc;
+}
+
+#else
+# define winShmMap 0
+# define winShmLock 0
+# define winShmBarrier 0
+# define winShmUnmap 0
+#endif /* #ifndef SQLITE_OMIT_WAL */
+
+/*
+** Cleans up the mapped region of the specified file, if any.
+*/
+#if SQLITE_MAX_MMAP_SIZE>0
+static int winUnmapfile(winFile *pFile){
+ assert( pFile!=0 );
+ OSTRACE(("UNMAP-FILE pid=%lu, pFile=%p, hMap=%p, pMapRegion=%p, "
+ "mmapSize=%lld, mmapSizeMax=%lld\n",
+ osGetCurrentProcessId(), pFile, pFile->hMap, pFile->pMapRegion,
+ pFile->mmapSize, pFile->mmapSizeMax));
+ if( pFile->pMapRegion ){
+ if( !osUnmapViewOfFile(pFile->pMapRegion) ){
+ pFile->lastErrno = osGetLastError();
+ OSTRACE(("UNMAP-FILE pid=%lu, pFile=%p, pMapRegion=%p, "
+ "rc=SQLITE_IOERR_MMAP\n", osGetCurrentProcessId(), pFile,
+ pFile->pMapRegion));
+ return winLogError(SQLITE_IOERR_MMAP, pFile->lastErrno,
+ "winUnmapfile1", pFile->zPath);
+ }
+ pFile->pMapRegion = 0;
+ pFile->mmapSize = 0;
+ }
+ if( pFile->hMap!=NULL ){
+ if( !osCloseHandle(pFile->hMap) ){
+ pFile->lastErrno = osGetLastError();
+ OSTRACE(("UNMAP-FILE pid=%lu, pFile=%p, hMap=%p, rc=SQLITE_IOERR_MMAP\n",
+ osGetCurrentProcessId(), pFile, pFile->hMap));
+ return winLogError(SQLITE_IOERR_MMAP, pFile->lastErrno,
+ "winUnmapfile2", pFile->zPath);
+ }
+ pFile->hMap = NULL;
+ }
+ OSTRACE(("UNMAP-FILE pid=%lu, pFile=%p, rc=SQLITE_OK\n",
+ osGetCurrentProcessId(), pFile));
+ return SQLITE_OK;
+}
+
+/*
+** Memory map or remap the file opened by file-descriptor pFd (if the file
+** is already mapped, the existing mapping is replaced by the new). Or, if
+** there already exists a mapping for this file, and there are still
+** outstanding xFetch() references to it, this function is a no-op.
+**
+** If parameter nByte is non-negative, then it is the requested size of
+** the mapping to create. Otherwise, if nByte is less than zero, then the
+** requested size is the size of the file on disk. The actual size of the
+** created mapping is either the requested size or the value configured
+** using SQLITE_FCNTL_MMAP_SIZE, whichever is smaller.
+**
+** SQLITE_OK is returned if no error occurs (even if the mapping is not
+** recreated as a result of outstanding references) or an SQLite error
+** code otherwise.
+*/
+static int winMapfile(winFile *pFd, sqlite3_int64 nByte){
+ sqlite3_int64 nMap = nByte;
+ int rc;
+
+ assert( nMap>=0 || pFd->nFetchOut==0 );
+ OSTRACE(("MAP-FILE pid=%lu, pFile=%p, size=%lld\n",
+ osGetCurrentProcessId(), pFd, nByte));
+
+ if( pFd->nFetchOut>0 ) return SQLITE_OK;
+
+ if( nMap<0 ){
+ rc = winFileSize((sqlite3_file*)pFd, &nMap);
+ if( rc ){
+ OSTRACE(("MAP-FILE pid=%lu, pFile=%p, rc=SQLITE_IOERR_FSTAT\n",
+ osGetCurrentProcessId(), pFd));
+ return SQLITE_IOERR_FSTAT;
+ }
+ }
+ if( nMap>pFd->mmapSizeMax ){
+ nMap = pFd->mmapSizeMax;
+ }
+ nMap &= ~(sqlite3_int64)(winSysInfo.dwPageSize - 1);
+
+ if( nMap==0 && pFd->mmapSize>0 ){
+ winUnmapfile(pFd);
+ }
+ if( nMap!=pFd->mmapSize ){
+ void *pNew = 0;
+ DWORD protect = PAGE_READONLY;
+ DWORD flags = FILE_MAP_READ;
+
+ winUnmapfile(pFd);
+#ifdef SQLITE_MMAP_READWRITE
+ if( (pFd->ctrlFlags & WINFILE_RDONLY)==0 ){
+ protect = PAGE_READWRITE;
+ flags |= FILE_MAP_WRITE;
+ }
+#endif
+#if SQLITE_OS_WINRT
+ pFd->hMap = osCreateFileMappingFromApp(pFd->h, NULL, protect, nMap, NULL);
+#elif defined(SQLITE_WIN32_HAS_WIDE)
+ pFd->hMap = osCreateFileMappingW(pFd->h, NULL, protect,
+ (DWORD)((nMap>>32) & 0xffffffff),
+ (DWORD)(nMap & 0xffffffff), NULL);
+#elif defined(SQLITE_WIN32_HAS_ANSI) && SQLITE_WIN32_CREATEFILEMAPPINGA
+ pFd->hMap = osCreateFileMappingA(pFd->h, NULL, protect,
+ (DWORD)((nMap>>32) & 0xffffffff),
+ (DWORD)(nMap & 0xffffffff), NULL);
+#endif
+ if( pFd->hMap==NULL ){
+ pFd->lastErrno = osGetLastError();
+ rc = winLogError(SQLITE_IOERR_MMAP, pFd->lastErrno,
+ "winMapfile1", pFd->zPath);
+ /* Log the error, but continue normal operation using xRead/xWrite */
+ OSTRACE(("MAP-FILE-CREATE pid=%lu, pFile=%p, rc=%s\n",
+ osGetCurrentProcessId(), pFd, sqlite3ErrName(rc)));
+ return SQLITE_OK;
+ }
+ assert( (nMap % winSysInfo.dwPageSize)==0 );
+ assert( sizeof(SIZE_T)==sizeof(sqlite3_int64) || nMap<=0xffffffff );
+#if SQLITE_OS_WINRT
+ pNew = osMapViewOfFileFromApp(pFd->hMap, flags, 0, (SIZE_T)nMap);
+#else
+ pNew = osMapViewOfFile(pFd->hMap, flags, 0, 0, (SIZE_T)nMap);
+#endif
+ if( pNew==NULL ){
+ osCloseHandle(pFd->hMap);
+ pFd->hMap = NULL;
+ pFd->lastErrno = osGetLastError();
+ rc = winLogError(SQLITE_IOERR_MMAP, pFd->lastErrno,
+ "winMapfile2", pFd->zPath);
+ /* Log the error, but continue normal operation using xRead/xWrite */
+ OSTRACE(("MAP-FILE-MAP pid=%lu, pFile=%p, rc=%s\n",
+ osGetCurrentProcessId(), pFd, sqlite3ErrName(rc)));
+ return SQLITE_OK;
+ }
+ pFd->pMapRegion = pNew;
+ pFd->mmapSize = nMap;
+ }
+
+ OSTRACE(("MAP-FILE pid=%lu, pFile=%p, rc=SQLITE_OK\n",
+ osGetCurrentProcessId(), pFd));
+ return SQLITE_OK;
+}
+#endif /* SQLITE_MAX_MMAP_SIZE>0 */
+
+/*
+** If possible, return a pointer to a mapping of file fd starting at offset
+** iOff. The mapping must be valid for at least nAmt bytes.
+**
+** If such a pointer can be obtained, store it in *pp and return SQLITE_OK.
+** Or, if one cannot but no error occurs, set *pp to 0 and return SQLITE_OK.
+** Finally, if an error does occur, return an SQLite error code. The final
+** value of *pp is undefined in this case.
+**
+** If this function does return a pointer, the caller must eventually
+** release the reference by calling winUnfetch().
+*/
+static int winFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){
+#if SQLITE_MAX_MMAP_SIZE>0
+ winFile *pFd = (winFile*)fd; /* The underlying database file */
+#endif
+ *pp = 0;
+
+ OSTRACE(("FETCH pid=%lu, pFile=%p, offset=%lld, amount=%d, pp=%p\n",
+ osGetCurrentProcessId(), fd, iOff, nAmt, pp));
+
+#if SQLITE_MAX_MMAP_SIZE>0
+ if( pFd->mmapSizeMax>0 ){
+ /* Ensure that there is always at least a 256 byte buffer of addressable
+ ** memory following the returned page. If the database is corrupt,
+ ** SQLite may overread the page slightly (in practice only a few bytes,
+ ** but 256 is safe, round, number). */
+ const int nEofBuffer = 256;
+ if( pFd->pMapRegion==0 ){
+ int rc = winMapfile(pFd, -1);
+ if( rc!=SQLITE_OK ){
+ OSTRACE(("FETCH pid=%lu, pFile=%p, rc=%s\n",
+ osGetCurrentProcessId(), pFd, sqlite3ErrName(rc)));
+ return rc;
+ }
+ }
+ if( pFd->mmapSize >= (iOff+nAmt+nEofBuffer) ){
+ assert( pFd->pMapRegion!=0 );
+ *pp = &((u8 *)pFd->pMapRegion)[iOff];
+ pFd->nFetchOut++;
+ }
+ }
+#endif
+
+ OSTRACE(("FETCH pid=%lu, pFile=%p, pp=%p, *pp=%p, rc=SQLITE_OK\n",
+ osGetCurrentProcessId(), fd, pp, *pp));
+ return SQLITE_OK;
+}
+
+/*
+** If the third argument is non-NULL, then this function releases a
+** reference obtained by an earlier call to winFetch(). The second
+** argument passed to this function must be the same as the corresponding
+** argument that was passed to the winFetch() invocation.
+**
+** Or, if the third argument is NULL, then this function is being called
+** to inform the VFS layer that, according to POSIX, any existing mapping
+** may now be invalid and should be unmapped.
+*/
+static int winUnfetch(sqlite3_file *fd, i64 iOff, void *p){
+#if SQLITE_MAX_MMAP_SIZE>0
+ winFile *pFd = (winFile*)fd; /* The underlying database file */
+
+ /* If p==0 (unmap the entire file) then there must be no outstanding
+ ** xFetch references. Or, if p!=0 (meaning it is an xFetch reference),
+ ** then there must be at least one outstanding. */
+ assert( (p==0)==(pFd->nFetchOut==0) );
+
+ /* If p!=0, it must match the iOff value. */
+ assert( p==0 || p==&((u8 *)pFd->pMapRegion)[iOff] );
+
+ OSTRACE(("UNFETCH pid=%lu, pFile=%p, offset=%lld, p=%p\n",
+ osGetCurrentProcessId(), pFd, iOff, p));
+
+ if( p ){
+ pFd->nFetchOut--;
+ }else{
+ /* FIXME: If Windows truly always prevents truncating or deleting a
+ ** file while a mapping is held, then the following winUnmapfile() call
+ ** is unnecessary can be omitted - potentially improving
+ ** performance. */
+ winUnmapfile(pFd);
+ }
+
+ assert( pFd->nFetchOut>=0 );
+#endif
+
+ OSTRACE(("UNFETCH pid=%lu, pFile=%p, rc=SQLITE_OK\n",
+ osGetCurrentProcessId(), fd));
+ return SQLITE_OK;
+}
+
+/*
+** Here ends the implementation of all sqlite3_file methods.
+**
+********************** End sqlite3_file Methods *******************************
+******************************************************************************/
+
+/*
+** This vector defines all the methods that can operate on an
+** sqlite3_file for win32.
+*/
+static const sqlite3_io_methods winIoMethod = {
+ 3, /* iVersion */
+ winClose, /* xClose */
+ winRead, /* xRead */
+ winWrite, /* xWrite */
+ winTruncate, /* xTruncate */
+ winSync, /* xSync */
+ winFileSize, /* xFileSize */
+ winLock, /* xLock */
+ winUnlock, /* xUnlock */
+ winCheckReservedLock, /* xCheckReservedLock */
+ winFileControl, /* xFileControl */
+ winSectorSize, /* xSectorSize */
+ winDeviceCharacteristics, /* xDeviceCharacteristics */
+ winShmMap, /* xShmMap */
+ winShmLock, /* xShmLock */
+ winShmBarrier, /* xShmBarrier */
+ winShmUnmap, /* xShmUnmap */
+ winFetch, /* xFetch */
+ winUnfetch /* xUnfetch */
+};
+
+/*
+** This vector defines all the methods that can operate on an
+** sqlite3_file for win32 without performing any locking.
+*/
+static const sqlite3_io_methods winIoNolockMethod = {
+ 3, /* iVersion */
+ winClose, /* xClose */
+ winRead, /* xRead */
+ winWrite, /* xWrite */
+ winTruncate, /* xTruncate */
+ winSync, /* xSync */
+ winFileSize, /* xFileSize */
+ winNolockLock, /* xLock */
+ winNolockUnlock, /* xUnlock */
+ winNolockCheckReservedLock, /* xCheckReservedLock */
+ winFileControl, /* xFileControl */
+ winSectorSize, /* xSectorSize */
+ winDeviceCharacteristics, /* xDeviceCharacteristics */
+ winShmMap, /* xShmMap */
+ winShmLock, /* xShmLock */
+ winShmBarrier, /* xShmBarrier */
+ winShmUnmap, /* xShmUnmap */
+ winFetch, /* xFetch */
+ winUnfetch /* xUnfetch */
+};
+
+static winVfsAppData winAppData = {
+ &winIoMethod, /* pMethod */
+ 0, /* pAppData */
+ 0 /* bNoLock */
+};
+
+static winVfsAppData winNolockAppData = {
+ &winIoNolockMethod, /* pMethod */
+ 0, /* pAppData */
+ 1 /* bNoLock */
+};
+
+/****************************************************************************
+**************************** sqlite3_vfs methods ****************************
+**
+** This division contains the implementation of methods on the
+** sqlite3_vfs object.
+*/
+
+#if defined(__CYGWIN__)
+/*
+** Convert a filename from whatever the underlying operating system
+** supports for filenames into UTF-8. Space to hold the result is
+** obtained from malloc and must be freed by the calling function.
+*/
+static char *winConvertToUtf8Filename(const void *zFilename){
+ char *zConverted = 0;
+ if( osIsNT() ){
+ zConverted = winUnicodeToUtf8(zFilename);
+ }
+#ifdef SQLITE_WIN32_HAS_ANSI
+ else{
+ zConverted = winMbcsToUtf8(zFilename, osAreFileApisANSI());
+ }
+#endif
+ /* caller will handle out of memory */
+ return zConverted;
+}
+#endif
+
+/*
+** Convert a UTF-8 filename into whatever form the underlying
+** operating system wants filenames in. Space to hold the result
+** is obtained from malloc and must be freed by the calling
+** function.
+*/
+static void *winConvertFromUtf8Filename(const char *zFilename){
+ void *zConverted = 0;
+ if( osIsNT() ){
+ zConverted = winUtf8ToUnicode(zFilename);
+ }
+#ifdef SQLITE_WIN32_HAS_ANSI
+ else{
+ zConverted = winUtf8ToMbcs(zFilename, osAreFileApisANSI());
+ }
+#endif
+ /* caller will handle out of memory */
+ return zConverted;
+}
+
+/*
+** This function returns non-zero if the specified UTF-8 string buffer
+** ends with a directory separator character or one was successfully
+** added to it.
+*/
+static int winMakeEndInDirSep(int nBuf, char *zBuf){
+ if( zBuf ){
+ int nLen = sqlite3Strlen30(zBuf);
+ if( nLen>0 ){
+ if( winIsDirSep(zBuf[nLen-1]) ){
+ return 1;
+ }else if( nLen+1<nBuf ){
+ zBuf[nLen] = winGetDirSep();
+ zBuf[nLen+1] = '\0';
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
+
+/*
+** If sqlite3_temp_directory is defined, take the mutex and return true.
+**
+** If sqlite3_temp_directory is NULL (undefined), omit the mutex and
+** return false.
+*/
+static int winTempDirDefined(void){
+ sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
+ if( sqlite3_temp_directory!=0 ) return 1;
+ sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
+ return 0;
+}
+
+/*
+** Create a temporary file name and store the resulting pointer into pzBuf.
+** The pointer returned in pzBuf must be freed via sqlite3_free().
+*/
+static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
+ static char zChars[] =
+ "abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "0123456789";
+ size_t i, j;
+ DWORD pid;
+ int nPre = sqlite3Strlen30(SQLITE_TEMP_FILE_PREFIX);
+ int nMax, nBuf, nDir, nLen;
+ char *zBuf;
+
+ /* It's odd to simulate an io-error here, but really this is just
+ ** using the io-error infrastructure to test that SQLite handles this
+ ** function failing.
+ */
+ SimulateIOError( return SQLITE_IOERR );
+
+ /* Allocate a temporary buffer to store the fully qualified file
+ ** name for the temporary file. If this fails, we cannot continue.
+ */
+ nMax = pVfs->mxPathname; nBuf = nMax + 2;
+ zBuf = sqlite3MallocZero( nBuf );
+ if( !zBuf ){
+ OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
+ return SQLITE_IOERR_NOMEM_BKPT;
+ }
+
+ /* Figure out the effective temporary directory. First, check if one
+ ** has been explicitly set by the application; otherwise, use the one
+ ** configured by the operating system.
+ */
+ nDir = nMax - (nPre + 15);
+ assert( nDir>0 );
+ if( winTempDirDefined() ){
+ int nDirLen = sqlite3Strlen30(sqlite3_temp_directory);
+ if( nDirLen>0 ){
+ if( !winIsDirSep(sqlite3_temp_directory[nDirLen-1]) ){
+ nDirLen++;
+ }
+ if( nDirLen>nDir ){
+ sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
+ sqlite3_free(zBuf);
+ OSTRACE(("TEMP-FILENAME rc=SQLITE_ERROR\n"));
+ return winLogError(SQLITE_ERROR, 0, "winGetTempname1", 0);
+ }
+ sqlite3_snprintf(nMax, zBuf, "%s", sqlite3_temp_directory);
+ }
+ sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
+ }
+
+#if defined(__CYGWIN__)
+ else{
+ static const char *azDirs[] = {
+ 0, /* getenv("SQLITE_TMPDIR") */
+ 0, /* getenv("TMPDIR") */
+ 0, /* getenv("TMP") */
+ 0, /* getenv("TEMP") */
+ 0, /* getenv("USERPROFILE") */
+ "/var/tmp",
+ "/usr/tmp",
+ "/tmp",
+ ".",
+ 0 /* List terminator */
+ };
+ unsigned int i;
+ const char *zDir = 0;
+
+ if( !azDirs[0] ) azDirs[0] = getenv("SQLITE_TMPDIR");
+ if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR");
+ if( !azDirs[2] ) azDirs[2] = getenv("TMP");
+ if( !azDirs[3] ) azDirs[3] = getenv("TEMP");
+ if( !azDirs[4] ) azDirs[4] = getenv("USERPROFILE");
+ for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); zDir=azDirs[i++]){
+ void *zConverted;
+ if( zDir==0 ) continue;
+ /* If the path starts with a drive letter followed by the colon
+ ** character, assume it is already a native Win32 path; otherwise,
+ ** it must be converted to a native Win32 path via the Cygwin API
+ ** prior to using it.
+ */
+ if( winIsDriveLetterAndColon(zDir) ){
+ zConverted = winConvertFromUtf8Filename(zDir);
+ if( !zConverted ){
+ sqlite3_free(zBuf);
+ OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
+ return SQLITE_IOERR_NOMEM_BKPT;
+ }
+ if( winIsDir(zConverted) ){
+ sqlite3_snprintf(nMax, zBuf, "%s", zDir);
+ sqlite3_free(zConverted);
+ break;
+ }
+ sqlite3_free(zConverted);
+ }else{
+ zConverted = sqlite3MallocZero( nMax+1 );
+ if( !zConverted ){
+ sqlite3_free(zBuf);
+ OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
+ return SQLITE_IOERR_NOMEM_BKPT;
+ }
+ if( cygwin_conv_path(
+ osIsNT() ? CCP_POSIX_TO_WIN_W : CCP_POSIX_TO_WIN_A, zDir,
+ zConverted, nMax+1)<0 ){
+ sqlite3_free(zConverted);
+ sqlite3_free(zBuf);
+ OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_CONVPATH\n"));
+ return winLogError(SQLITE_IOERR_CONVPATH, (DWORD)errno,
+ "winGetTempname2", zDir);
+ }
+ if( winIsDir(zConverted) ){
+ /* At this point, we know the candidate directory exists and should
+ ** be used. However, we may need to convert the string containing
+ ** its name into UTF-8 (i.e. if it is UTF-16 right now).
+ */
+ char *zUtf8 = winConvertToUtf8Filename(zConverted);
+ if( !zUtf8 ){
+ sqlite3_free(zConverted);
+ sqlite3_free(zBuf);
+ OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
+ return SQLITE_IOERR_NOMEM_BKPT;
+ }
+ sqlite3_snprintf(nMax, zBuf, "%s", zUtf8);
+ sqlite3_free(zUtf8);
+ sqlite3_free(zConverted);
+ break;
+ }
+ sqlite3_free(zConverted);
+ }
+ }
+ }
+#elif !SQLITE_OS_WINRT && !defined(__CYGWIN__)
+ else if( osIsNT() ){
+ char *zMulti;
+ LPWSTR zWidePath = sqlite3MallocZero( nMax*sizeof(WCHAR) );
+ if( !zWidePath ){
+ sqlite3_free(zBuf);
+ OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
+ return SQLITE_IOERR_NOMEM_BKPT;
+ }
+ if( osGetTempPathW(nMax, zWidePath)==0 ){
+ sqlite3_free(zWidePath);
+ sqlite3_free(zBuf);
+ OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_GETTEMPPATH\n"));
+ return winLogError(SQLITE_IOERR_GETTEMPPATH, osGetLastError(),
+ "winGetTempname2", 0);
+ }
+ zMulti = winUnicodeToUtf8(zWidePath);
+ if( zMulti ){
+ sqlite3_snprintf(nMax, zBuf, "%s", zMulti);
+ sqlite3_free(zMulti);
+ sqlite3_free(zWidePath);
+ }else{
+ sqlite3_free(zWidePath);
+ sqlite3_free(zBuf);
+ OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
+ return SQLITE_IOERR_NOMEM_BKPT;
+ }
+ }
+#ifdef SQLITE_WIN32_HAS_ANSI
+ else{
+ char *zUtf8;
+ char *zMbcsPath = sqlite3MallocZero( nMax );
+ if( !zMbcsPath ){
+ sqlite3_free(zBuf);
+ OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
+ return SQLITE_IOERR_NOMEM_BKPT;
+ }
+ if( osGetTempPathA(nMax, zMbcsPath)==0 ){
+ sqlite3_free(zBuf);
+ OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_GETTEMPPATH\n"));
+ return winLogError(SQLITE_IOERR_GETTEMPPATH, osGetLastError(),
+ "winGetTempname3", 0);
+ }
+ zUtf8 = winMbcsToUtf8(zMbcsPath, osAreFileApisANSI());
+ if( zUtf8 ){
+ sqlite3_snprintf(nMax, zBuf, "%s", zUtf8);
+ sqlite3_free(zUtf8);
+ }else{
+ sqlite3_free(zBuf);
+ OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n"));
+ return SQLITE_IOERR_NOMEM_BKPT;
+ }
+ }
+#endif /* SQLITE_WIN32_HAS_ANSI */
+#endif /* !SQLITE_OS_WINRT */
+
+ /*
+ ** Check to make sure the temporary directory ends with an appropriate
+ ** separator. If it does not and there is not enough space left to add
+ ** one, fail.
+ */
+ if( !winMakeEndInDirSep(nDir+1, zBuf) ){
+ sqlite3_free(zBuf);
+ OSTRACE(("TEMP-FILENAME rc=SQLITE_ERROR\n"));
+ return winLogError(SQLITE_ERROR, 0, "winGetTempname4", 0);
+ }
+
+ /*
+ ** Check that the output buffer is large enough for the temporary file
+ ** name in the following format:
+ **
+ ** "<temporary_directory>/etilqs_XXXXXXXXXXXXXXX\0\0"
+ **
+ ** If not, return SQLITE_ERROR. The number 17 is used here in order to
+ ** account for the space used by the 15 character random suffix and the
+ ** two trailing NUL characters. The final directory separator character
+ ** has already added if it was not already present.
+ */
+ nLen = sqlite3Strlen30(zBuf);
+ if( (nLen + nPre + 17) > nBuf ){
+ sqlite3_free(zBuf);
+ OSTRACE(("TEMP-FILENAME rc=SQLITE_ERROR\n"));
+ return winLogError(SQLITE_ERROR, 0, "winGetTempname5", 0);
+ }
+
+ sqlite3_snprintf(nBuf-16-nLen, zBuf+nLen, SQLITE_TEMP_FILE_PREFIX);
+
+ j = sqlite3Strlen30(zBuf);
+ sqlite3_randomness(15, &zBuf[j]);
+ pid = osGetCurrentProcessId();
+ for(i=0; i<15; i++, j++){
+ zBuf[j] += pid & 0xff;
+ pid >>= 8;
+ zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];
+ }
+ zBuf[j] = 0;
+ zBuf[j+1] = 0;
+ *pzBuf = zBuf;
+
+ OSTRACE(("TEMP-FILENAME name=%s, rc=SQLITE_OK\n", zBuf));
+ return SQLITE_OK;
+}
+
+/*
+** Return TRUE if the named file is really a directory. Return false if
+** it is something other than a directory, or if there is any kind of memory
+** allocation failure.
+*/
+static int winIsDir(const void *zConverted){
+ DWORD attr;
+ int rc = 0;
+ DWORD lastErrno;
+
+ if( osIsNT() ){
+ int cnt = 0;
+ WIN32_FILE_ATTRIBUTE_DATA sAttrData;
+ memset(&sAttrData, 0, sizeof(sAttrData));
+ while( !(rc = osGetFileAttributesExW((LPCWSTR)zConverted,
+ GetFileExInfoStandard,
+ &sAttrData)) && winRetryIoerr(&cnt, &lastErrno) ){}
+ if( !rc ){
+ return 0; /* Invalid name? */
+ }
+ attr = sAttrData.dwFileAttributes;
+#if SQLITE_OS_WINCE==0
+ }else{
+ attr = osGetFileAttributesA((char*)zConverted);
+#endif
+ }
+ return (attr!=INVALID_FILE_ATTRIBUTES) && (attr&FILE_ATTRIBUTE_DIRECTORY);
+}
+
+/* forward reference */
+static int winAccess(
+ sqlite3_vfs *pVfs, /* Not used on win32 */
+ const char *zFilename, /* Name of file to check */
+ int flags, /* Type of test to make on this file */
+ int *pResOut /* OUT: Result */
+);
+
+/*
+** Open a file.
+*/
+static int winOpen(
+ sqlite3_vfs *pVfs, /* Used to get maximum path length and AppData */
+ const char *zName, /* Name of the file (UTF-8) */
+ sqlite3_file *id, /* Write the SQLite file handle here */
+ int flags, /* Open mode flags */
+ int *pOutFlags /* Status return flags */
+){
+ HANDLE h;
+ DWORD lastErrno = 0;
+ DWORD dwDesiredAccess;
+ DWORD dwShareMode;
+ DWORD dwCreationDisposition;
+ DWORD dwFlagsAndAttributes = 0;
+#if SQLITE_OS_WINCE
+ int isTemp = 0;
+#endif
+ winVfsAppData *pAppData;
+ winFile *pFile = (winFile*)id;
+ void *zConverted; /* Filename in OS encoding */
+ const char *zUtf8Name = zName; /* Filename in UTF-8 encoding */
+ int cnt = 0;
+
+ /* If argument zPath is a NULL pointer, this function is required to open
+ ** a temporary file. Use this buffer to store the file name in.
+ */
+ char *zTmpname = 0; /* For temporary filename, if necessary. */
+
+ int rc = SQLITE_OK; /* Function Return Code */
+#if !defined(NDEBUG) || SQLITE_OS_WINCE
+ int eType = flags&0x0FFF00; /* Type of file to open */
+#endif
+
+ int isExclusive = (flags & SQLITE_OPEN_EXCLUSIVE);
+ int isDelete = (flags & SQLITE_OPEN_DELETEONCLOSE);
+ int isCreate = (flags & SQLITE_OPEN_CREATE);
+ int isReadonly = (flags & SQLITE_OPEN_READONLY);
+ int isReadWrite = (flags & SQLITE_OPEN_READWRITE);
+
+#ifndef NDEBUG
+ int isOpenJournal = (isCreate && (
+ eType==SQLITE_OPEN_SUPER_JOURNAL
+ || eType==SQLITE_OPEN_MAIN_JOURNAL
+ || eType==SQLITE_OPEN_WAL
+ ));
+#endif
+
+ OSTRACE(("OPEN name=%s, pFile=%p, flags=%x, pOutFlags=%p\n",
+ zUtf8Name, id, flags, pOutFlags));
+
+ /* Check the following statements are true:
+ **
+ ** (a) Exactly one of the READWRITE and READONLY flags must be set, and
+ ** (b) if CREATE is set, then READWRITE must also be set, and
+ ** (c) if EXCLUSIVE is set, then CREATE must also be set.
+ ** (d) if DELETEONCLOSE is set, then CREATE must also be set.
+ */
+ assert((isReadonly==0 || isReadWrite==0) && (isReadWrite || isReadonly));
+ assert(isCreate==0 || isReadWrite);
+ assert(isExclusive==0 || isCreate);
+ assert(isDelete==0 || isCreate);
+
+ /* The main DB, main journal, WAL file and super-journal are never
+ ** automatically deleted. Nor are they ever temporary files. */
+ assert( (!isDelete && zName) || eType!=SQLITE_OPEN_MAIN_DB );
+ assert( (!isDelete && zName) || eType!=SQLITE_OPEN_MAIN_JOURNAL );
+ assert( (!isDelete && zName) || eType!=SQLITE_OPEN_SUPER_JOURNAL );
+ assert( (!isDelete && zName) || eType!=SQLITE_OPEN_WAL );
+
+ /* Assert that the upper layer has set one of the "file-type" flags. */
+ assert( eType==SQLITE_OPEN_MAIN_DB || eType==SQLITE_OPEN_TEMP_DB
+ || eType==SQLITE_OPEN_MAIN_JOURNAL || eType==SQLITE_OPEN_TEMP_JOURNAL
+ || eType==SQLITE_OPEN_SUBJOURNAL || eType==SQLITE_OPEN_SUPER_JOURNAL
+ || eType==SQLITE_OPEN_TRANSIENT_DB || eType==SQLITE_OPEN_WAL
+ );
+
+ assert( pFile!=0 );
+ memset(pFile, 0, sizeof(winFile));
+ pFile->h = INVALID_HANDLE_VALUE;
+
+#if SQLITE_OS_WINRT
+ if( !zUtf8Name && !sqlite3_temp_directory ){
+ sqlite3_log(SQLITE_ERROR,
+ "sqlite3_temp_directory variable should be set for WinRT");
+ }
+#endif
+
+ /* If the second argument to this function is NULL, generate a
+ ** temporary file name to use
+ */
+ if( !zUtf8Name ){
+ assert( isDelete && !isOpenJournal );
+ rc = winGetTempname(pVfs, &zTmpname);
+ if( rc!=SQLITE_OK ){
+ OSTRACE(("OPEN name=%s, rc=%s", zUtf8Name, sqlite3ErrName(rc)));
+ return rc;
+ }
+ zUtf8Name = zTmpname;
+ }
+
+ /* Database filenames are double-zero terminated if they are not
+ ** URIs with parameters. Hence, they can always be passed into
+ ** sqlite3_uri_parameter().
+ */
+ assert( (eType!=SQLITE_OPEN_MAIN_DB) || (flags & SQLITE_OPEN_URI) ||
+ zUtf8Name[sqlite3Strlen30(zUtf8Name)+1]==0 );
+
+ /* Convert the filename to the system encoding. */
+ zConverted = winConvertFromUtf8Filename(zUtf8Name);
+ if( zConverted==0 ){
+ sqlite3_free(zTmpname);
+ OSTRACE(("OPEN name=%s, rc=SQLITE_IOERR_NOMEM", zUtf8Name));
+ return SQLITE_IOERR_NOMEM_BKPT;
+ }
+
+ if( winIsDir(zConverted) ){
+ sqlite3_free(zConverted);
+ sqlite3_free(zTmpname);
+ OSTRACE(("OPEN name=%s, rc=SQLITE_CANTOPEN_ISDIR", zUtf8Name));
+ return SQLITE_CANTOPEN_ISDIR;
+ }
+
+ if( isReadWrite ){
+ dwDesiredAccess = GENERIC_READ | GENERIC_WRITE;
+ }else{
+ dwDesiredAccess = GENERIC_READ;
+ }
+
+ /* SQLITE_OPEN_EXCLUSIVE is used to make sure that a new file is
+ ** created. SQLite doesn't use it to indicate "exclusive access"
+ ** as it is usually understood.
+ */
+ if( isExclusive ){
+ /* Creates a new file, only if it does not already exist. */
+ /* If the file exists, it fails. */
+ dwCreationDisposition = CREATE_NEW;
+ }else if( isCreate ){
+ /* Open existing file, or create if it doesn't exist */
+ dwCreationDisposition = OPEN_ALWAYS;
+ }else{
+ /* Opens a file, only if it exists. */
+ dwCreationDisposition = OPEN_EXISTING;
+ }
+
+ if( 0==sqlite3_uri_boolean(zName, "exclusive", 0) ){
+ dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
+ }else{
+ dwShareMode = 0;
+ }
+
+ if( isDelete ){
+#if SQLITE_OS_WINCE
+ dwFlagsAndAttributes = FILE_ATTRIBUTE_HIDDEN;
+ isTemp = 1;
+#else
+ dwFlagsAndAttributes = FILE_ATTRIBUTE_TEMPORARY
+ | FILE_ATTRIBUTE_HIDDEN
+ | FILE_FLAG_DELETE_ON_CLOSE;
+#endif
+ }else{
+ dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL;
+ }
+ /* Reports from the internet are that performance is always
+ ** better if FILE_FLAG_RANDOM_ACCESS is used. Ticket #2699. */
+#if SQLITE_OS_WINCE
+ dwFlagsAndAttributes |= FILE_FLAG_RANDOM_ACCESS;
+#endif
+
+ if( osIsNT() ){
+#if SQLITE_OS_WINRT
+ CREATEFILE2_EXTENDED_PARAMETERS extendedParameters;
+ extendedParameters.dwSize = sizeof(CREATEFILE2_EXTENDED_PARAMETERS);
+ extendedParameters.dwFileAttributes =
+ dwFlagsAndAttributes & FILE_ATTRIBUTE_MASK;
+ extendedParameters.dwFileFlags = dwFlagsAndAttributes & FILE_FLAG_MASK;
+ extendedParameters.dwSecurityQosFlags = SECURITY_ANONYMOUS;
+ extendedParameters.lpSecurityAttributes = NULL;
+ extendedParameters.hTemplateFile = NULL;
+ do{
+ h = osCreateFile2((LPCWSTR)zConverted,
+ dwDesiredAccess,
+ dwShareMode,
+ dwCreationDisposition,
+ &extendedParameters);
+ if( h!=INVALID_HANDLE_VALUE ) break;
+ if( isReadWrite ){
+ int rc2, isRO = 0;
+ sqlite3BeginBenignMalloc();
+ rc2 = winAccess(pVfs, zUtf8Name, SQLITE_ACCESS_READ, &isRO);
+ sqlite3EndBenignMalloc();
+ if( rc2==SQLITE_OK && isRO ) break;
+ }
+ }while( winRetryIoerr(&cnt, &lastErrno) );
+#else
+ do{
+ h = osCreateFileW((LPCWSTR)zConverted,
+ dwDesiredAccess,
+ dwShareMode, NULL,
+ dwCreationDisposition,
+ dwFlagsAndAttributes,
+ NULL);
+ if( h!=INVALID_HANDLE_VALUE ) break;
+ if( isReadWrite ){
+ int rc2, isRO = 0;
+ sqlite3BeginBenignMalloc();
+ rc2 = winAccess(pVfs, zUtf8Name, SQLITE_ACCESS_READ, &isRO);
+ sqlite3EndBenignMalloc();
+ if( rc2==SQLITE_OK && isRO ) break;
+ }
+ }while( winRetryIoerr(&cnt, &lastErrno) );
+#endif
+ }
+#ifdef SQLITE_WIN32_HAS_ANSI
+ else{
+ do{
+ h = osCreateFileA((LPCSTR)zConverted,
+ dwDesiredAccess,
+ dwShareMode, NULL,
+ dwCreationDisposition,
+ dwFlagsAndAttributes,
+ NULL);
+ if( h!=INVALID_HANDLE_VALUE ) break;
+ if( isReadWrite ){
+ int rc2, isRO = 0;
+ sqlite3BeginBenignMalloc();
+ rc2 = winAccess(pVfs, zUtf8Name, SQLITE_ACCESS_READ, &isRO);
+ sqlite3EndBenignMalloc();
+ if( rc2==SQLITE_OK && isRO ) break;
+ }
+ }while( winRetryIoerr(&cnt, &lastErrno) );
+ }
+#endif
+ winLogIoerr(cnt, __LINE__);
+
+ OSTRACE(("OPEN file=%p, name=%s, access=%lx, rc=%s\n", h, zUtf8Name,
+ dwDesiredAccess, (h==INVALID_HANDLE_VALUE) ? "failed" : "ok"));
+
+ if( h==INVALID_HANDLE_VALUE ){
+ sqlite3_free(zConverted);
+ sqlite3_free(zTmpname);
+ if( isReadWrite && !isExclusive ){
+ return winOpen(pVfs, zName, id,
+ ((flags|SQLITE_OPEN_READONLY) &
+ ~(SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE)),
+ pOutFlags);
+ }else{
+ pFile->lastErrno = lastErrno;
+ winLogError(SQLITE_CANTOPEN, pFile->lastErrno, "winOpen", zUtf8Name);
+ return SQLITE_CANTOPEN_BKPT;
+ }
+ }
+
+ if( pOutFlags ){
+ if( isReadWrite ){
+ *pOutFlags = SQLITE_OPEN_READWRITE;
+ }else{
+ *pOutFlags = SQLITE_OPEN_READONLY;
+ }
+ }
+
+ OSTRACE(("OPEN file=%p, name=%s, access=%lx, pOutFlags=%p, *pOutFlags=%d, "
+ "rc=%s\n", h, zUtf8Name, dwDesiredAccess, pOutFlags, pOutFlags ?
+ *pOutFlags : 0, (h==INVALID_HANDLE_VALUE) ? "failed" : "ok"));
+
+ pAppData = (winVfsAppData*)pVfs->pAppData;
+
+#if SQLITE_OS_WINCE
+ {
+ if( isReadWrite && eType==SQLITE_OPEN_MAIN_DB
+ && ((pAppData==NULL) || !pAppData->bNoLock)
+ && (rc = winceCreateLock(zName, pFile))!=SQLITE_OK
+ ){
+ osCloseHandle(h);
+ sqlite3_free(zConverted);
+ sqlite3_free(zTmpname);
+ OSTRACE(("OPEN-CE-LOCK name=%s, rc=%s\n", zName, sqlite3ErrName(rc)));
+ return rc;
+ }
+ }
+ if( isTemp ){
+ pFile->zDeleteOnClose = zConverted;
+ }else
+#endif
+ {
+ sqlite3_free(zConverted);
+ }
+
+ sqlite3_free(zTmpname);
+ id->pMethods = pAppData ? pAppData->pMethod : &winIoMethod;
+ pFile->pVfs = pVfs;
+ pFile->h = h;
+ if( isReadonly ){
+ pFile->ctrlFlags |= WINFILE_RDONLY;
+ }
+ if( (flags & SQLITE_OPEN_MAIN_DB)
+ && sqlite3_uri_boolean(zName, "psow", SQLITE_POWERSAFE_OVERWRITE)
+ ){
+ pFile->ctrlFlags |= WINFILE_PSOW;
+ }
+ pFile->lastErrno = NO_ERROR;
+ pFile->zPath = zName;
+#if SQLITE_MAX_MMAP_SIZE>0
+ pFile->hMap = NULL;
+ pFile->pMapRegion = 0;
+ pFile->mmapSize = 0;
+ pFile->mmapSizeMax = sqlite3GlobalConfig.szMmap;
+#endif
+
+ OpenCounter(+1);
+ return rc;
+}
+
+/*
+** Delete the named file.
+**
+** Note that Windows does not allow a file to be deleted if some other
+** process has it open. Sometimes a virus scanner or indexing program
+** will open a journal file shortly after it is created in order to do
+** whatever it does. While this other process is holding the
+** file open, we will be unable to delete it. To work around this
+** problem, we delay 100 milliseconds and try to delete again. Up
+** to MX_DELETION_ATTEMPTs deletion attempts are run before giving
+** up and returning an error.
+*/
+static int winDelete(
+ sqlite3_vfs *pVfs, /* Not used on win32 */
+ const char *zFilename, /* Name of file to delete */
+ int syncDir /* Not used on win32 */
+){
+ int cnt = 0;
+ int rc;
+ DWORD attr;
+ DWORD lastErrno = 0;
+ void *zConverted;
+ UNUSED_PARAMETER(pVfs);
+ UNUSED_PARAMETER(syncDir);
+
+ SimulateIOError(return SQLITE_IOERR_DELETE);
+ OSTRACE(("DELETE name=%s, syncDir=%d\n", zFilename, syncDir));
+
+ zConverted = winConvertFromUtf8Filename(zFilename);
+ if( zConverted==0 ){
+ OSTRACE(("DELETE name=%s, rc=SQLITE_IOERR_NOMEM\n", zFilename));
+ return SQLITE_IOERR_NOMEM_BKPT;
+ }
+ if( osIsNT() ){
+ do {
+#if SQLITE_OS_WINRT
+ WIN32_FILE_ATTRIBUTE_DATA sAttrData;
+ memset(&sAttrData, 0, sizeof(sAttrData));
+ if ( osGetFileAttributesExW(zConverted, GetFileExInfoStandard,
+ &sAttrData) ){
+ attr = sAttrData.dwFileAttributes;
+ }else{
+ lastErrno = osGetLastError();
+ if( lastErrno==ERROR_FILE_NOT_FOUND
+ || lastErrno==ERROR_PATH_NOT_FOUND ){
+ rc = SQLITE_IOERR_DELETE_NOENT; /* Already gone? */
+ }else{
+ rc = SQLITE_ERROR;
+ }
+ break;
+ }
+#else
+ attr = osGetFileAttributesW(zConverted);
+#endif
+ if ( attr==INVALID_FILE_ATTRIBUTES ){
+ lastErrno = osGetLastError();
+ if( lastErrno==ERROR_FILE_NOT_FOUND
+ || lastErrno==ERROR_PATH_NOT_FOUND ){
+ rc = SQLITE_IOERR_DELETE_NOENT; /* Already gone? */
+ }else{
+ rc = SQLITE_ERROR;
+ }
+ break;
+ }
+ if ( attr&FILE_ATTRIBUTE_DIRECTORY ){
+ rc = SQLITE_ERROR; /* Files only. */
+ break;
+ }
+ if ( osDeleteFileW(zConverted) ){
+ rc = SQLITE_OK; /* Deleted OK. */
+ break;
+ }
+ if ( !winRetryIoerr(&cnt, &lastErrno) ){
+ rc = SQLITE_ERROR; /* No more retries. */
+ break;
+ }
+ } while(1);
+ }
+#ifdef SQLITE_WIN32_HAS_ANSI
+ else{
+ do {
+ attr = osGetFileAttributesA(zConverted);
+ if ( attr==INVALID_FILE_ATTRIBUTES ){
+ lastErrno = osGetLastError();
+ if( lastErrno==ERROR_FILE_NOT_FOUND
+ || lastErrno==ERROR_PATH_NOT_FOUND ){
+ rc = SQLITE_IOERR_DELETE_NOENT; /* Already gone? */
+ }else{
+ rc = SQLITE_ERROR;
+ }
+ break;
+ }
+ if ( attr&FILE_ATTRIBUTE_DIRECTORY ){
+ rc = SQLITE_ERROR; /* Files only. */
+ break;
+ }
+ if ( osDeleteFileA(zConverted) ){
+ rc = SQLITE_OK; /* Deleted OK. */
+ break;
+ }
+ if ( !winRetryIoerr(&cnt, &lastErrno) ){
+ rc = SQLITE_ERROR; /* No more retries. */
+ break;
+ }
+ } while(1);
+ }
+#endif
+ if( rc && rc!=SQLITE_IOERR_DELETE_NOENT ){
+ rc = winLogError(SQLITE_IOERR_DELETE, lastErrno, "winDelete", zFilename);
+ }else{
+ winLogIoerr(cnt, __LINE__);
+ }
+ sqlite3_free(zConverted);
+ OSTRACE(("DELETE name=%s, rc=%s\n", zFilename, sqlite3ErrName(rc)));
+ return rc;
+}
+
+/*
+** Check the existence and status of a file.
+*/
+static int winAccess(
+ sqlite3_vfs *pVfs, /* Not used on win32 */
+ const char *zFilename, /* Name of file to check */
+ int flags, /* Type of test to make on this file */
+ int *pResOut /* OUT: Result */
+){
+ DWORD attr;
+ int rc = 0;
+ DWORD lastErrno = 0;
+ void *zConverted;
+ UNUSED_PARAMETER(pVfs);
+
+ SimulateIOError( return SQLITE_IOERR_ACCESS; );
+ OSTRACE(("ACCESS name=%s, flags=%x, pResOut=%p\n",
+ zFilename, flags, pResOut));
+
+ if( zFilename==0 ){
+ *pResOut = 0;
+ OSTRACE(("ACCESS name=%s, pResOut=%p, *pResOut=%d, rc=SQLITE_OK\n",
+ zFilename, pResOut, *pResOut));
+ return SQLITE_OK;
+ }
+
+ zConverted = winConvertFromUtf8Filename(zFilename);
+ if( zConverted==0 ){
+ OSTRACE(("ACCESS name=%s, rc=SQLITE_IOERR_NOMEM\n", zFilename));
+ return SQLITE_IOERR_NOMEM_BKPT;
+ }
+ if( osIsNT() ){
+ int cnt = 0;
+ WIN32_FILE_ATTRIBUTE_DATA sAttrData;
+ memset(&sAttrData, 0, sizeof(sAttrData));
+ while( !(rc = osGetFileAttributesExW((LPCWSTR)zConverted,
+ GetFileExInfoStandard,
+ &sAttrData)) && winRetryIoerr(&cnt, &lastErrno) ){}
+ if( rc ){
+ /* For an SQLITE_ACCESS_EXISTS query, treat a zero-length file
+ ** as if it does not exist.
+ */
+ if( flags==SQLITE_ACCESS_EXISTS
+ && sAttrData.nFileSizeHigh==0
+ && sAttrData.nFileSizeLow==0 ){
+ attr = INVALID_FILE_ATTRIBUTES;
+ }else{
+ attr = sAttrData.dwFileAttributes;
+ }
+ }else{
+ winLogIoerr(cnt, __LINE__);
+ if( lastErrno!=ERROR_FILE_NOT_FOUND && lastErrno!=ERROR_PATH_NOT_FOUND ){
+ sqlite3_free(zConverted);
+ return winLogError(SQLITE_IOERR_ACCESS, lastErrno, "winAccess",
+ zFilename);
+ }else{
+ attr = INVALID_FILE_ATTRIBUTES;
+ }
+ }
+ }
+#ifdef SQLITE_WIN32_HAS_ANSI
+ else{
+ attr = osGetFileAttributesA((char*)zConverted);
+ }
+#endif
+ sqlite3_free(zConverted);
+ switch( flags ){
+ case SQLITE_ACCESS_READ:
+ case SQLITE_ACCESS_EXISTS:
+ rc = attr!=INVALID_FILE_ATTRIBUTES;
+ break;
+ case SQLITE_ACCESS_READWRITE:
+ rc = attr!=INVALID_FILE_ATTRIBUTES &&
+ (attr & FILE_ATTRIBUTE_READONLY)==0;
+ break;
+ default:
+ assert(!"Invalid flags argument");
+ }
+ *pResOut = rc;
+ OSTRACE(("ACCESS name=%s, pResOut=%p, *pResOut=%d, rc=SQLITE_OK\n",
+ zFilename, pResOut, *pResOut));
+ return SQLITE_OK;
+}
+
+/*
+** Returns non-zero if the specified path name starts with the "long path"
+** prefix.
+*/
+static BOOL winIsLongPathPrefix(
+ const char *zPathname
+){
+ return ( zPathname[0]=='\\' && zPathname[1]=='\\'
+ && zPathname[2]=='?' && zPathname[3]=='\\' );
+}
+
+/*
+** Returns non-zero if the specified path name starts with a drive letter
+** followed by a colon character.
+*/
+static BOOL winIsDriveLetterAndColon(
+ const char *zPathname
+){
+ return ( sqlite3Isalpha(zPathname[0]) && zPathname[1]==':' );
+}
+
+/*
+** Returns non-zero if the specified path name should be used verbatim. If
+** non-zero is returned from this function, the calling function must simply
+** use the provided path name verbatim -OR- resolve it into a full path name
+** using the GetFullPathName Win32 API function (if available).
+*/
+static BOOL winIsVerbatimPathname(
+ const char *zPathname
+){
+ /*
+ ** If the path name starts with a forward slash or a backslash, it is either
+ ** a legal UNC name, a volume relative path, or an absolute path name in the
+ ** "Unix" format on Windows. There is no easy way to differentiate between
+ ** the final two cases; therefore, we return the safer return value of TRUE
+ ** so that callers of this function will simply use it verbatim.
+ */
+ if ( winIsDirSep(zPathname[0]) ){
+ return TRUE;
+ }
+
+ /*
+ ** If the path name starts with a letter and a colon it is either a volume
+ ** relative path or an absolute path. Callers of this function must not
+ ** attempt to treat it as a relative path name (i.e. they should simply use
+ ** it verbatim).
+ */
+ if ( winIsDriveLetterAndColon(zPathname) ){
+ return TRUE;
+ }
+
+ /*
+ ** If we get to this point, the path name should almost certainly be a purely
+ ** relative one (i.e. not a UNC name, not absolute, and not volume relative).
+ */
+ return FALSE;
+}
+
+/*
+** Turn a relative pathname into a full pathname. Write the full
+** pathname into zOut[]. zOut[] will be at least pVfs->mxPathname
+** bytes in size.
+*/
+static int winFullPathnameNoMutex(
+ sqlite3_vfs *pVfs, /* Pointer to vfs object */
+ const char *zRelative, /* Possibly relative input path */
+ int nFull, /* Size of output buffer in bytes */
+ char *zFull /* Output buffer */
+){
+#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(__CYGWIN__)
+ DWORD nByte;
+ void *zConverted;
+ char *zOut;
+#endif
+
+ /* If this path name begins with "/X:" or "\\?\", where "X" is any
+ ** alphabetic character, discard the initial "/" from the pathname.
+ */
+ if( zRelative[0]=='/' && (winIsDriveLetterAndColon(zRelative+1)
+ || winIsLongPathPrefix(zRelative+1)) ){
+ zRelative++;
+ }
+
+#if defined(__CYGWIN__)
+ SimulateIOError( return SQLITE_ERROR );
+ UNUSED_PARAMETER(nFull);
+ assert( nFull>=pVfs->mxPathname );
+ if ( sqlite3_data_directory && !winIsVerbatimPathname(zRelative) ){
+ /*
+ ** NOTE: We are dealing with a relative path name and the data
+ ** directory has been set. Therefore, use it as the basis
+ ** for converting the relative path name to an absolute
+ ** one by prepending the data directory and a slash.
+ */
+ char *zOut = sqlite3MallocZero( pVfs->mxPathname+1 );
+ if( !zOut ){
+ return SQLITE_IOERR_NOMEM_BKPT;
+ }
+ if( cygwin_conv_path(
+ (osIsNT() ? CCP_POSIX_TO_WIN_W : CCP_POSIX_TO_WIN_A) |
+ CCP_RELATIVE, zRelative, zOut, pVfs->mxPathname+1)<0 ){
+ sqlite3_free(zOut);
+ return winLogError(SQLITE_CANTOPEN_CONVPATH, (DWORD)errno,
+ "winFullPathname1", zRelative);
+ }else{
+ char *zUtf8 = winConvertToUtf8Filename(zOut);
+ if( !zUtf8 ){
+ sqlite3_free(zOut);
+ return SQLITE_IOERR_NOMEM_BKPT;
+ }
+ sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s%c%s",
+ sqlite3_data_directory, winGetDirSep(), zUtf8);
+ sqlite3_free(zUtf8);
+ sqlite3_free(zOut);
+ }
+ }else{
+ char *zOut = sqlite3MallocZero( pVfs->mxPathname+1 );
+ if( !zOut ){
+ return SQLITE_IOERR_NOMEM_BKPT;
+ }
+ if( cygwin_conv_path(
+ (osIsNT() ? CCP_POSIX_TO_WIN_W : CCP_POSIX_TO_WIN_A),
+ zRelative, zOut, pVfs->mxPathname+1)<0 ){
+ sqlite3_free(zOut);
+ return winLogError(SQLITE_CANTOPEN_CONVPATH, (DWORD)errno,
+ "winFullPathname2", zRelative);
+ }else{
+ char *zUtf8 = winConvertToUtf8Filename(zOut);
+ if( !zUtf8 ){
+ sqlite3_free(zOut);
+ return SQLITE_IOERR_NOMEM_BKPT;
+ }
+ sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zUtf8);
+ sqlite3_free(zUtf8);
+ sqlite3_free(zOut);
+ }
+ }
+ return SQLITE_OK;
+#endif
+
+#if (SQLITE_OS_WINCE || SQLITE_OS_WINRT) && !defined(__CYGWIN__)
+ SimulateIOError( return SQLITE_ERROR );
+ /* WinCE has no concept of a relative pathname, or so I am told. */
+ /* WinRT has no way to convert a relative path to an absolute one. */
+ if ( sqlite3_data_directory && !winIsVerbatimPathname(zRelative) ){
+ /*
+ ** NOTE: We are dealing with a relative path name and the data
+ ** directory has been set. Therefore, use it as the basis
+ ** for converting the relative path name to an absolute
+ ** one by prepending the data directory and a backslash.
+ */
+ sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s%c%s",
+ sqlite3_data_directory, winGetDirSep(), zRelative);
+ }else{
+ sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zRelative);
+ }
+ return SQLITE_OK;
+#endif
+
+#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(__CYGWIN__)
+ /* It's odd to simulate an io-error here, but really this is just
+ ** using the io-error infrastructure to test that SQLite handles this
+ ** function failing. This function could fail if, for example, the
+ ** current working directory has been unlinked.
+ */
+ SimulateIOError( return SQLITE_ERROR );
+ if ( sqlite3_data_directory && !winIsVerbatimPathname(zRelative) ){
+ /*
+ ** NOTE: We are dealing with a relative path name and the data
+ ** directory has been set. Therefore, use it as the basis
+ ** for converting the relative path name to an absolute
+ ** one by prepending the data directory and a backslash.
+ */
+ sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s%c%s",
+ sqlite3_data_directory, winGetDirSep(), zRelative);
+ return SQLITE_OK;
+ }
+ zConverted = winConvertFromUtf8Filename(zRelative);
+ if( zConverted==0 ){
+ return SQLITE_IOERR_NOMEM_BKPT;
+ }
+ if( osIsNT() ){
+ LPWSTR zTemp;
+ nByte = osGetFullPathNameW((LPCWSTR)zConverted, 0, 0, 0);
+ if( nByte==0 ){
+ sqlite3_free(zConverted);
+ return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(),
+ "winFullPathname1", zRelative);
+ }
+ nByte += 3;
+ zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) );
+ if( zTemp==0 ){
+ sqlite3_free(zConverted);
+ return SQLITE_IOERR_NOMEM_BKPT;
+ }
+ nByte = osGetFullPathNameW((LPCWSTR)zConverted, nByte, zTemp, 0);
+ if( nByte==0 ){
+ sqlite3_free(zConverted);
+ sqlite3_free(zTemp);
+ return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(),
+ "winFullPathname2", zRelative);
+ }
+ sqlite3_free(zConverted);
+ zOut = winUnicodeToUtf8(zTemp);
+ sqlite3_free(zTemp);
+ }
+#ifdef SQLITE_WIN32_HAS_ANSI
+ else{
+ char *zTemp;
+ nByte = osGetFullPathNameA((char*)zConverted, 0, 0, 0);
+ if( nByte==0 ){
+ sqlite3_free(zConverted);
+ return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(),
+ "winFullPathname3", zRelative);
+ }
+ nByte += 3;
+ zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) );
+ if( zTemp==0 ){
+ sqlite3_free(zConverted);
+ return SQLITE_IOERR_NOMEM_BKPT;
+ }
+ nByte = osGetFullPathNameA((char*)zConverted, nByte, zTemp, 0);
+ if( nByte==0 ){
+ sqlite3_free(zConverted);
+ sqlite3_free(zTemp);
+ return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(),
+ "winFullPathname4", zRelative);
+ }
+ sqlite3_free(zConverted);
+ zOut = winMbcsToUtf8(zTemp, osAreFileApisANSI());
+ sqlite3_free(zTemp);
+ }
+#endif
+ if( zOut ){
+ sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zOut);
+ sqlite3_free(zOut);
+ return SQLITE_OK;
+ }else{
+ return SQLITE_IOERR_NOMEM_BKPT;
+ }
+#endif
+}
+static int winFullPathname(
+ sqlite3_vfs *pVfs, /* Pointer to vfs object */
+ const char *zRelative, /* Possibly relative input path */
+ int nFull, /* Size of output buffer in bytes */
+ char *zFull /* Output buffer */
+){
+ int rc;
+ MUTEX_LOGIC( sqlite3_mutex *pMutex; )
+ MUTEX_LOGIC( pMutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR); )
+ sqlite3_mutex_enter(pMutex);
+ rc = winFullPathnameNoMutex(pVfs, zRelative, nFull, zFull);
+ sqlite3_mutex_leave(pMutex);
+ return rc;
+}
+
+#ifndef SQLITE_OMIT_LOAD_EXTENSION
+/*
+** Interfaces for opening a shared library, finding entry points
+** within the shared library, and closing the shared library.
+*/
+static void *winDlOpen(sqlite3_vfs *pVfs, const char *zFilename){
+ HANDLE h;
+#if defined(__CYGWIN__)
+ int nFull = pVfs->mxPathname+1;
+ char *zFull = sqlite3MallocZero( nFull );
+ void *zConverted = 0;
+ if( zFull==0 ){
+ OSTRACE(("DLOPEN name=%s, handle=%p\n", zFilename, (void*)0));
+ return 0;
+ }
+ if( winFullPathname(pVfs, zFilename, nFull, zFull)!=SQLITE_OK ){
+ sqlite3_free(zFull);
+ OSTRACE(("DLOPEN name=%s, handle=%p\n", zFilename, (void*)0));
+ return 0;
+ }
+ zConverted = winConvertFromUtf8Filename(zFull);
+ sqlite3_free(zFull);
+#else
+ void *zConverted = winConvertFromUtf8Filename(zFilename);
+ UNUSED_PARAMETER(pVfs);
+#endif
+ if( zConverted==0 ){
+ OSTRACE(("DLOPEN name=%s, handle=%p\n", zFilename, (void*)0));
+ return 0;
+ }
+ if( osIsNT() ){
+#if SQLITE_OS_WINRT
+ h = osLoadPackagedLibrary((LPCWSTR)zConverted, 0);
+#else
+ h = osLoadLibraryW((LPCWSTR)zConverted);
+#endif
+ }
+#ifdef SQLITE_WIN32_HAS_ANSI
+ else{
+ h = osLoadLibraryA((char*)zConverted);
+ }
+#endif
+ OSTRACE(("DLOPEN name=%s, handle=%p\n", zFilename, (void*)h));
+ sqlite3_free(zConverted);
+ return (void*)h;
+}
+static void winDlError(sqlite3_vfs *pVfs, int nBuf, char *zBufOut){
+ UNUSED_PARAMETER(pVfs);
+ winGetLastErrorMsg(osGetLastError(), nBuf, zBufOut);
+}
+static void (*winDlSym(sqlite3_vfs *pVfs,void *pH,const char *zSym))(void){
+ FARPROC proc;
+ UNUSED_PARAMETER(pVfs);
+ proc = osGetProcAddressA((HANDLE)pH, zSym);
+ OSTRACE(("DLSYM handle=%p, symbol=%s, address=%p\n",
+ (void*)pH, zSym, (void*)proc));
+ return (void(*)(void))proc;
+}
+static void winDlClose(sqlite3_vfs *pVfs, void *pHandle){
+ UNUSED_PARAMETER(pVfs);
+ osFreeLibrary((HANDLE)pHandle);
+ OSTRACE(("DLCLOSE handle=%p\n", (void*)pHandle));
+}
+#else /* if SQLITE_OMIT_LOAD_EXTENSION is defined: */
+ #define winDlOpen 0
+ #define winDlError 0
+ #define winDlSym 0
+ #define winDlClose 0
+#endif
+
+/* State information for the randomness gatherer. */
+typedef struct EntropyGatherer EntropyGatherer;
+struct EntropyGatherer {
+ unsigned char *a; /* Gather entropy into this buffer */
+ int na; /* Size of a[] in bytes */
+ int i; /* XOR next input into a[i] */
+ int nXor; /* Number of XOR operations done */
+};
+
+#if !defined(SQLITE_TEST) && !defined(SQLITE_OMIT_RANDOMNESS)
+/* Mix sz bytes of entropy into p. */
+static void xorMemory(EntropyGatherer *p, unsigned char *x, int sz){
+ int j, k;
+ for(j=0, k=p->i; j<sz; j++){
+ p->a[k++] ^= x[j];
+ if( k>=p->na ) k = 0;
+ }
+ p->i = k;
+ p->nXor += sz;
+}
+#endif /* !defined(SQLITE_TEST) && !defined(SQLITE_OMIT_RANDOMNESS) */
+
+/*
+** Write up to nBuf bytes of randomness into zBuf.
+*/
+static int winRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
+#if defined(SQLITE_TEST) || defined(SQLITE_OMIT_RANDOMNESS)
+ UNUSED_PARAMETER(pVfs);
+ memset(zBuf, 0, nBuf);
+ return nBuf;
+#else
+ EntropyGatherer e;
+ UNUSED_PARAMETER(pVfs);
+ memset(zBuf, 0, nBuf);
+ e.a = (unsigned char*)zBuf;
+ e.na = nBuf;
+ e.nXor = 0;
+ e.i = 0;
+ {
+ SYSTEMTIME x;
+ osGetSystemTime(&x);
+ xorMemory(&e, (unsigned char*)&x, sizeof(SYSTEMTIME));
+ }
+ {
+ DWORD pid = osGetCurrentProcessId();
+ xorMemory(&e, (unsigned char*)&pid, sizeof(DWORD));
+ }
+#if SQLITE_OS_WINRT
+ {
+ ULONGLONG cnt = osGetTickCount64();
+ xorMemory(&e, (unsigned char*)&cnt, sizeof(ULONGLONG));
+ }
+#else
+ {
+ DWORD cnt = osGetTickCount();
+ xorMemory(&e, (unsigned char*)&cnt, sizeof(DWORD));
+ }
+#endif /* SQLITE_OS_WINRT */
+ {
+ LARGE_INTEGER i;
+ osQueryPerformanceCounter(&i);
+ xorMemory(&e, (unsigned char*)&i, sizeof(LARGE_INTEGER));
+ }
+#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID
+ {
+ UUID id;
+ memset(&id, 0, sizeof(UUID));
+ osUuidCreate(&id);
+ xorMemory(&e, (unsigned char*)&id, sizeof(UUID));
+ memset(&id, 0, sizeof(UUID));
+ osUuidCreateSequential(&id);
+ xorMemory(&e, (unsigned char*)&id, sizeof(UUID));
+ }
+#endif /* !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID */
+ return e.nXor>nBuf ? nBuf : e.nXor;
+#endif /* defined(SQLITE_TEST) || defined(SQLITE_OMIT_RANDOMNESS) */
+}
+
+
+/*
+** Sleep for a little while. Return the amount of time slept.
+*/
+static int winSleep(sqlite3_vfs *pVfs, int microsec){
+ sqlite3_win32_sleep((microsec+999)/1000);
+ UNUSED_PARAMETER(pVfs);
+ return ((microsec+999)/1000)*1000;
+}
+
+/*
+** The following variable, if set to a non-zero value, is interpreted as
+** the number of seconds since 1970 and is used to set the result of
+** sqlite3OsCurrentTime() during testing.
+*/
+#ifdef SQLITE_TEST
+SQLITE_API int sqlite3_current_time = 0; /* Fake system time in seconds since 1970. */
+#endif
+
+/*
+** Find the current time (in Universal Coordinated Time). Write into *piNow
+** the current time and date as a Julian Day number times 86_400_000. In
+** other words, write into *piNow the number of milliseconds since the Julian
+** epoch of noon in Greenwich on November 24, 4714 B.C according to the
+** proleptic Gregorian calendar.
+**
+** On success, return SQLITE_OK. Return SQLITE_ERROR if the time and date
+** cannot be found.
+*/
+static int winCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *piNow){
+ /* FILETIME structure is a 64-bit value representing the number of
+ 100-nanosecond intervals since January 1, 1601 (= JD 2305813.5).
+ */
+ FILETIME ft;
+ static const sqlite3_int64 winFiletimeEpoch = 23058135*(sqlite3_int64)8640000;
+#ifdef SQLITE_TEST
+ static const sqlite3_int64 unixEpoch = 24405875*(sqlite3_int64)8640000;
+#endif
+ /* 2^32 - to avoid use of LL and warnings in gcc */
+ static const sqlite3_int64 max32BitValue =
+ (sqlite3_int64)2000000000 + (sqlite3_int64)2000000000 +
+ (sqlite3_int64)294967296;
+
+#if SQLITE_OS_WINCE
+ SYSTEMTIME time;
+ osGetSystemTime(&time);
+ /* if SystemTimeToFileTime() fails, it returns zero. */
+ if (!osSystemTimeToFileTime(&time,&ft)){
+ return SQLITE_ERROR;
+ }
+#else
+ osGetSystemTimeAsFileTime( &ft );
+#endif
+
+ *piNow = winFiletimeEpoch +
+ ((((sqlite3_int64)ft.dwHighDateTime)*max32BitValue) +
+ (sqlite3_int64)ft.dwLowDateTime)/(sqlite3_int64)10000;
+
+#ifdef SQLITE_TEST
+ if( sqlite3_current_time ){
+ *piNow = 1000*(sqlite3_int64)sqlite3_current_time + unixEpoch;
+ }
+#endif
+ UNUSED_PARAMETER(pVfs);
+ return SQLITE_OK;
+}
+
+/*
+** Find the current time (in Universal Coordinated Time). Write the
+** current time and date as a Julian Day number into *prNow and
+** return 0. Return 1 if the time and date cannot be found.
+*/
+static int winCurrentTime(sqlite3_vfs *pVfs, double *prNow){
+ int rc;
+ sqlite3_int64 i;
+ rc = winCurrentTimeInt64(pVfs, &i);
+ if( !rc ){
+ *prNow = i/86400000.0;
+ }
+ return rc;
+}
+
+/*
+** The idea is that this function works like a combination of
+** GetLastError() and FormatMessage() on Windows (or errno and
+** strerror_r() on Unix). After an error is returned by an OS
+** function, SQLite calls this function with zBuf pointing to
+** a buffer of nBuf bytes. The OS layer should populate the
+** buffer with a nul-terminated UTF-8 encoded error message
+** describing the last IO error to have occurred within the calling
+** thread.
+**
+** If the error message is too large for the supplied buffer,
+** it should be truncated. The return value of xGetLastError
+** is zero if the error message fits in the buffer, or non-zero
+** otherwise (if the message was truncated). If non-zero is returned,
+** then it is not necessary to include the nul-terminator character
+** in the output buffer.
+**
+** Not supplying an error message will have no adverse effect
+** on SQLite. It is fine to have an implementation that never
+** returns an error message:
+**
+** int xGetLastError(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
+** assert(zBuf[0]=='\0');
+** return 0;
+** }
+**
+** However if an error message is supplied, it will be incorporated
+** by sqlite into the error message available to the user using
+** sqlite3_errmsg(), possibly making IO errors easier to debug.
+*/
+static int winGetLastError(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
+ DWORD e = osGetLastError();
+ UNUSED_PARAMETER(pVfs);
+ if( nBuf>0 ) winGetLastErrorMsg(e, nBuf, zBuf);
+ return e;
+}
+
+/*
+** Initialize and deinitialize the operating system interface.
+*/
+SQLITE_API int sqlite3_os_init(void){
+ static sqlite3_vfs winVfs = {
+ 3, /* iVersion */
+ sizeof(winFile), /* szOsFile */
+ SQLITE_WIN32_MAX_PATH_BYTES, /* mxPathname */
+ 0, /* pNext */
+ "win32", /* zName */
+ &winAppData, /* pAppData */
+ winOpen, /* xOpen */
+ winDelete, /* xDelete */
+ winAccess, /* xAccess */
+ winFullPathname, /* xFullPathname */
+ winDlOpen, /* xDlOpen */
+ winDlError, /* xDlError */
+ winDlSym, /* xDlSym */
+ winDlClose, /* xDlClose */
+ winRandomness, /* xRandomness */
+ winSleep, /* xSleep */
+ winCurrentTime, /* xCurrentTime */
+ winGetLastError, /* xGetLastError */
+ winCurrentTimeInt64, /* xCurrentTimeInt64 */
+ winSetSystemCall, /* xSetSystemCall */
+ winGetSystemCall, /* xGetSystemCall */
+ winNextSystemCall, /* xNextSystemCall */
+ };
+#if defined(SQLITE_WIN32_HAS_WIDE)
+ static sqlite3_vfs winLongPathVfs = {
+ 3, /* iVersion */
+ sizeof(winFile), /* szOsFile */
+ SQLITE_WINNT_MAX_PATH_BYTES, /* mxPathname */
+ 0, /* pNext */
+ "win32-longpath", /* zName */
+ &winAppData, /* pAppData */
+ winOpen, /* xOpen */
+ winDelete, /* xDelete */
+ winAccess, /* xAccess */
+ winFullPathname, /* xFullPathname */
+ winDlOpen, /* xDlOpen */
+ winDlError, /* xDlError */
+ winDlSym, /* xDlSym */
+ winDlClose, /* xDlClose */
+ winRandomness, /* xRandomness */
+ winSleep, /* xSleep */
+ winCurrentTime, /* xCurrentTime */
+ winGetLastError, /* xGetLastError */
+ winCurrentTimeInt64, /* xCurrentTimeInt64 */
+ winSetSystemCall, /* xSetSystemCall */
+ winGetSystemCall, /* xGetSystemCall */
+ winNextSystemCall, /* xNextSystemCall */
+ };
+#endif
+ static sqlite3_vfs winNolockVfs = {
+ 3, /* iVersion */
+ sizeof(winFile), /* szOsFile */
+ SQLITE_WIN32_MAX_PATH_BYTES, /* mxPathname */
+ 0, /* pNext */
+ "win32-none", /* zName */
+ &winNolockAppData, /* pAppData */
+ winOpen, /* xOpen */
+ winDelete, /* xDelete */
+ winAccess, /* xAccess */
+ winFullPathname, /* xFullPathname */
+ winDlOpen, /* xDlOpen */
+ winDlError, /* xDlError */
+ winDlSym, /* xDlSym */
+ winDlClose, /* xDlClose */
+ winRandomness, /* xRandomness */
+ winSleep, /* xSleep */
+ winCurrentTime, /* xCurrentTime */
+ winGetLastError, /* xGetLastError */
+ winCurrentTimeInt64, /* xCurrentTimeInt64 */
+ winSetSystemCall, /* xSetSystemCall */
+ winGetSystemCall, /* xGetSystemCall */
+ winNextSystemCall, /* xNextSystemCall */
+ };
+#if defined(SQLITE_WIN32_HAS_WIDE)
+ static sqlite3_vfs winLongPathNolockVfs = {
+ 3, /* iVersion */
+ sizeof(winFile), /* szOsFile */
+ SQLITE_WINNT_MAX_PATH_BYTES, /* mxPathname */
+ 0, /* pNext */
+ "win32-longpath-none", /* zName */
+ &winNolockAppData, /* pAppData */
+ winOpen, /* xOpen */
+ winDelete, /* xDelete */
+ winAccess, /* xAccess */
+ winFullPathname, /* xFullPathname */
+ winDlOpen, /* xDlOpen */
+ winDlError, /* xDlError */
+ winDlSym, /* xDlSym */
+ winDlClose, /* xDlClose */
+ winRandomness, /* xRandomness */
+ winSleep, /* xSleep */
+ winCurrentTime, /* xCurrentTime */
+ winGetLastError, /* xGetLastError */
+ winCurrentTimeInt64, /* xCurrentTimeInt64 */
+ winSetSystemCall, /* xSetSystemCall */
+ winGetSystemCall, /* xGetSystemCall */
+ winNextSystemCall, /* xNextSystemCall */
+ };
+#endif
+
+ /* Double-check that the aSyscall[] array has been constructed
+ ** correctly. See ticket [bb3a86e890c8e96ab] */
+ assert( ArraySize(aSyscall)==80 );
+
+ /* get memory map allocation granularity */
+ memset(&winSysInfo, 0, sizeof(SYSTEM_INFO));
+#if SQLITE_OS_WINRT
+ osGetNativeSystemInfo(&winSysInfo);
+#else
+ osGetSystemInfo(&winSysInfo);
+#endif
+ assert( winSysInfo.dwAllocationGranularity>0 );
+ assert( winSysInfo.dwPageSize>0 );
+
+ sqlite3_vfs_register(&winVfs, 1);
+
+#if defined(SQLITE_WIN32_HAS_WIDE)
+ sqlite3_vfs_register(&winLongPathVfs, 0);
+#endif
+
+ sqlite3_vfs_register(&winNolockVfs, 0);
+
+#if defined(SQLITE_WIN32_HAS_WIDE)
+ sqlite3_vfs_register(&winLongPathNolockVfs, 0);
+#endif
+
+#ifndef SQLITE_OMIT_WAL
+ winBigLock = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_VFS1);
+#endif
+
+ return SQLITE_OK;
+}
+
+SQLITE_API int sqlite3_os_end(void){
+#if SQLITE_OS_WINRT
+ if( sleepObj!=NULL ){
+ osCloseHandle(sleepObj);
+ sleepObj = NULL;
+ }
+#endif
+
+#ifndef SQLITE_OMIT_WAL
+ winBigLock = 0;
+#endif
+
+ return SQLITE_OK;
+}
+
+#endif /* SQLITE_OS_WIN */
+
+/************** End of os_win.c **********************************************/
+/************** Begin file memdb.c *******************************************/
+/*
+** 2016-09-07
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+******************************************************************************
+**
+** This file implements an in-memory VFS. A database is held as a contiguous
+** block of memory.
+**
+** This file also implements interface sqlite3_serialize() and
+** sqlite3_deserialize().
+*/
+/* #include "sqliteInt.h" */
+#ifndef SQLITE_OMIT_DESERIALIZE
+
+/*
+** Forward declaration of objects used by this utility
+*/
+typedef struct sqlite3_vfs MemVfs;
+typedef struct MemFile MemFile;
+typedef struct MemStore MemStore;
+
+/* Access to a lower-level VFS that (might) implement dynamic loading,
+** access to randomness, etc.
+*/
+#define ORIGVFS(p) ((sqlite3_vfs*)((p)->pAppData))
+
+/* Storage for a memdb file.
+**
+** An memdb object can be shared or separate. Shared memdb objects can be
+** used by more than one database connection. Mutexes are used by shared
+** memdb objects to coordinate access. Separate memdb objects are only
+** connected to a single database connection and do not require additional
+** mutexes.
+**
+** Shared memdb objects have .zFName!=0 and .pMutex!=0. They are created
+** using "file:/name?vfs=memdb". The first character of the name must be
+** "/" or else the object will be a separate memdb object. All shared
+** memdb objects are stored in memdb_g.apMemStore[] in an arbitrary order.
+**
+** Separate memdb objects are created using a name that does not begin
+** with "/" or using sqlite3_deserialize().
+**
+** Access rules for shared MemStore objects:
+**
+** * .zFName is initialized when the object is created and afterwards
+** is unchanged until the object is destroyed. So it can be accessed
+** at any time as long as we know the object is not being destroyed,
+** which means while either the SQLITE_MUTEX_STATIC_VFS1 or
+** .pMutex is held or the object is not part of memdb_g.apMemStore[].
+**
+** * Can .pMutex can only be changed while holding the
+** SQLITE_MUTEX_STATIC_VFS1 mutex or while the object is not part
+** of memdb_g.apMemStore[].
+**
+** * Other fields can only be changed while holding the .pMutex mutex
+** or when the .nRef is less than zero and the object is not part of
+** memdb_g.apMemStore[].
+**
+** * The .aData pointer has the added requirement that it can can only
+** be changed (for resizing) when nMmap is zero.
+**
+*/
+struct MemStore {
+ sqlite3_int64 sz; /* Size of the file */
+ sqlite3_int64 szAlloc; /* Space allocated to aData */
+ sqlite3_int64 szMax; /* Maximum allowed size of the file */
+ unsigned char *aData; /* content of the file */
+ sqlite3_mutex *pMutex; /* Used by shared stores only */
+ int nMmap; /* Number of memory mapped pages */
+ unsigned mFlags; /* Flags */
+ int nRdLock; /* Number of readers */
+ int nWrLock; /* Number of writers. (Always 0 or 1) */
+ int nRef; /* Number of users of this MemStore */
+ char *zFName; /* The filename for shared stores */
+};
+
+/* An open file */
+struct MemFile {
+ sqlite3_file base; /* IO methods */
+ MemStore *pStore; /* The storage */
+ int eLock; /* Most recent lock against this file */
+};
+
+/*
+** File-scope variables for holding the memdb files that are accessible
+** to multiple database connections in separate threads.
+**
+** Must hold SQLITE_MUTEX_STATIC_VFS1 to access any part of this object.
+*/
+static struct MemFS {
+ int nMemStore; /* Number of shared MemStore objects */
+ MemStore **apMemStore; /* Array of all shared MemStore objects */
+} memdb_g;
+
+/*
+** Methods for MemFile
+*/
+static int memdbClose(sqlite3_file*);
+static int memdbRead(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst);
+static int memdbWrite(sqlite3_file*,const void*,int iAmt, sqlite3_int64 iOfst);
+static int memdbTruncate(sqlite3_file*, sqlite3_int64 size);
+static int memdbSync(sqlite3_file*, int flags);
+static int memdbFileSize(sqlite3_file*, sqlite3_int64 *pSize);
+static int memdbLock(sqlite3_file*, int);
+static int memdbUnlock(sqlite3_file*, int);
+/* static int memdbCheckReservedLock(sqlite3_file*, int *pResOut);// not used */
+static int memdbFileControl(sqlite3_file*, int op, void *pArg);
+/* static int memdbSectorSize(sqlite3_file*); // not used */
+static int memdbDeviceCharacteristics(sqlite3_file*);
+static int memdbFetch(sqlite3_file*, sqlite3_int64 iOfst, int iAmt, void **pp);
+static int memdbUnfetch(sqlite3_file*, sqlite3_int64 iOfst, void *p);
+
+/*
+** Methods for MemVfs
+*/
+static int memdbOpen(sqlite3_vfs*, const char *, sqlite3_file*, int , int *);
+/* static int memdbDelete(sqlite3_vfs*, const char *zName, int syncDir); */
+static int memdbAccess(sqlite3_vfs*, const char *zName, int flags, int *);
+static int memdbFullPathname(sqlite3_vfs*, const char *zName, int, char *zOut);
+static void *memdbDlOpen(sqlite3_vfs*, const char *zFilename);
+static void memdbDlError(sqlite3_vfs*, int nByte, char *zErrMsg);
+static void (*memdbDlSym(sqlite3_vfs *pVfs, void *p, const char*zSym))(void);
+static void memdbDlClose(sqlite3_vfs*, void*);
+static int memdbRandomness(sqlite3_vfs*, int nByte, char *zOut);
+static int memdbSleep(sqlite3_vfs*, int microseconds);
+/* static int memdbCurrentTime(sqlite3_vfs*, double*); */
+static int memdbGetLastError(sqlite3_vfs*, int, char *);
+static int memdbCurrentTimeInt64(sqlite3_vfs*, sqlite3_int64*);
+
+static sqlite3_vfs memdb_vfs = {
+ 2, /* iVersion */
+ 0, /* szOsFile (set when registered) */
+ 1024, /* mxPathname */
+ 0, /* pNext */
+ "memdb", /* zName */
+ 0, /* pAppData (set when registered) */
+ memdbOpen, /* xOpen */
+ 0, /* memdbDelete, */ /* xDelete */
+ memdbAccess, /* xAccess */
+ memdbFullPathname, /* xFullPathname */
+ memdbDlOpen, /* xDlOpen */
+ memdbDlError, /* xDlError */
+ memdbDlSym, /* xDlSym */
+ memdbDlClose, /* xDlClose */
+ memdbRandomness, /* xRandomness */
+ memdbSleep, /* xSleep */
+ 0, /* memdbCurrentTime, */ /* xCurrentTime */
+ memdbGetLastError, /* xGetLastError */
+ memdbCurrentTimeInt64, /* xCurrentTimeInt64 */
+ 0, /* xSetSystemCall */
+ 0, /* xGetSystemCall */
+ 0, /* xNextSystemCall */
+};
+
+static const sqlite3_io_methods memdb_io_methods = {
+ 3, /* iVersion */
+ memdbClose, /* xClose */
+ memdbRead, /* xRead */
+ memdbWrite, /* xWrite */
+ memdbTruncate, /* xTruncate */
+ memdbSync, /* xSync */
+ memdbFileSize, /* xFileSize */
+ memdbLock, /* xLock */
+ memdbUnlock, /* xUnlock */
+ 0, /* memdbCheckReservedLock, */ /* xCheckReservedLock */
+ memdbFileControl, /* xFileControl */
+ 0, /* memdbSectorSize,*/ /* xSectorSize */
+ memdbDeviceCharacteristics, /* xDeviceCharacteristics */
+ 0, /* xShmMap */
+ 0, /* xShmLock */
+ 0, /* xShmBarrier */
+ 0, /* xShmUnmap */
+ memdbFetch, /* xFetch */
+ memdbUnfetch /* xUnfetch */
+};
+
+/*
+** Enter/leave the mutex on a MemStore
+*/
+#if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE==0
+static void memdbEnter(MemStore *p){
+ UNUSED_PARAMETER(p);
+}
+static void memdbLeave(MemStore *p){
+ UNUSED_PARAMETER(p);
+}
+#else
+static void memdbEnter(MemStore *p){
+ sqlite3_mutex_enter(p->pMutex);
+}
+static void memdbLeave(MemStore *p){
+ sqlite3_mutex_leave(p->pMutex);
+}
+#endif
+
+
+
+/*
+** Close an memdb-file.
+** Free the underlying MemStore object when its refcount drops to zero
+** or less.
+*/
+static int memdbClose(sqlite3_file *pFile){
+ MemStore *p = ((MemFile*)pFile)->pStore;
+ if( p->zFName ){
+ int i;
+#ifndef SQLITE_MUTEX_OMIT
+ sqlite3_mutex *pVfsMutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_VFS1);
+#endif
+ sqlite3_mutex_enter(pVfsMutex);
+ for(i=0; ALWAYS(i<memdb_g.nMemStore); i++){
+ if( memdb_g.apMemStore[i]==p ){
+ memdbEnter(p);
+ if( p->nRef==1 ){
+ memdb_g.apMemStore[i] = memdb_g.apMemStore[--memdb_g.nMemStore];
+ if( memdb_g.nMemStore==0 ){
+ sqlite3_free(memdb_g.apMemStore);
+ memdb_g.apMemStore = 0;
+ }
+ }
+ break;
+ }
+ }
+ sqlite3_mutex_leave(pVfsMutex);
+ }else{
+ memdbEnter(p);
+ }
+ p->nRef--;
+ if( p->nRef<=0 ){
+ if( p->mFlags & SQLITE_DESERIALIZE_FREEONCLOSE ){
+ sqlite3_free(p->aData);
+ }
+ memdbLeave(p);
+ sqlite3_mutex_free(p->pMutex);
+ sqlite3_free(p);
+ }else{
+ memdbLeave(p);
+ }
+ return SQLITE_OK;
+}
+
+/*
+** Read data from an memdb-file.
+*/
+static int memdbRead(
+ sqlite3_file *pFile,
+ void *zBuf,
+ int iAmt,
+ sqlite_int64 iOfst
+){
+ MemStore *p = ((MemFile*)pFile)->pStore;
+ memdbEnter(p);
+ if( iOfst+iAmt>p->sz ){
+ memset(zBuf, 0, iAmt);
+ if( iOfst<p->sz ) memcpy(zBuf, p->aData+iOfst, p->sz - iOfst);
+ memdbLeave(p);
+ return SQLITE_IOERR_SHORT_READ;
+ }
+ memcpy(zBuf, p->aData+iOfst, iAmt);
+ memdbLeave(p);
+ return SQLITE_OK;
+}
+
+/*
+** Try to enlarge the memory allocation to hold at least sz bytes
+*/
+static int memdbEnlarge(MemStore *p, sqlite3_int64 newSz){
+ unsigned char *pNew;
+ if( (p->mFlags & SQLITE_DESERIALIZE_RESIZEABLE)==0 || NEVER(p->nMmap>0) ){
+ return SQLITE_FULL;
+ }
+ if( newSz>p->szMax ){
+ return SQLITE_FULL;
+ }
+ newSz *= 2;
+ if( newSz>p->szMax ) newSz = p->szMax;
+ pNew = sqlite3Realloc(p->aData, newSz);
+ if( pNew==0 ) return SQLITE_IOERR_NOMEM;
+ p->aData = pNew;
+ p->szAlloc = newSz;
+ return SQLITE_OK;
+}
+
+/*
+** Write data to an memdb-file.
+*/
+static int memdbWrite(
+ sqlite3_file *pFile,
+ const void *z,
+ int iAmt,
+ sqlite_int64 iOfst
+){
+ MemStore *p = ((MemFile*)pFile)->pStore;
+ memdbEnter(p);
+ if( NEVER(p->mFlags & SQLITE_DESERIALIZE_READONLY) ){
+ /* Can't happen: memdbLock() will return SQLITE_READONLY before
+ ** reaching this point */
+ memdbLeave(p);
+ return SQLITE_IOERR_WRITE;
+ }
+ if( iOfst+iAmt>p->sz ){
+ int rc;
+ if( iOfst+iAmt>p->szAlloc
+ && (rc = memdbEnlarge(p, iOfst+iAmt))!=SQLITE_OK
+ ){
+ memdbLeave(p);
+ return rc;
+ }
+ if( iOfst>p->sz ) memset(p->aData+p->sz, 0, iOfst-p->sz);
+ p->sz = iOfst+iAmt;
+ }
+ memcpy(p->aData+iOfst, z, iAmt);
+ memdbLeave(p);
+ return SQLITE_OK;
+}
+
+/*
+** Truncate an memdb-file.
+**
+** In rollback mode (which is always the case for memdb, as it does not
+** support WAL mode) the truncate() method is only used to reduce
+** the size of a file, never to increase the size.
+*/
+static int memdbTruncate(sqlite3_file *pFile, sqlite_int64 size){
+ MemStore *p = ((MemFile*)pFile)->pStore;
+ int rc = SQLITE_OK;
+ memdbEnter(p);
+ if( size>p->sz ){
+ /* This can only happen with a corrupt wal mode db */
+ rc = SQLITE_CORRUPT;
+ }else{
+ p->sz = size;
+ }
+ memdbLeave(p);
+ return rc;
+}
+
+/*
+** Sync an memdb-file.
+*/
+static int memdbSync(sqlite3_file *pFile, int flags){
+ UNUSED_PARAMETER(pFile);
+ UNUSED_PARAMETER(flags);
+ return SQLITE_OK;
+}
+
+/*
+** Return the current file-size of an memdb-file.
+*/
+static int memdbFileSize(sqlite3_file *pFile, sqlite_int64 *pSize){
+ MemStore *p = ((MemFile*)pFile)->pStore;
+ memdbEnter(p);
+ *pSize = p->sz;
+ memdbLeave(p);
+ return SQLITE_OK;
+}
+
+/*
+** Lock an memdb-file.
+*/
+static int memdbLock(sqlite3_file *pFile, int eLock){
+ MemFile *pThis = (MemFile*)pFile;
+ MemStore *p = pThis->pStore;
+ int rc = SQLITE_OK;
+ if( eLock<=pThis->eLock ) return SQLITE_OK;
+ memdbEnter(p);
+
+ assert( p->nWrLock==0 || p->nWrLock==1 );
+ assert( pThis->eLock<=SQLITE_LOCK_SHARED || p->nWrLock==1 );
+ assert( pThis->eLock==SQLITE_LOCK_NONE || p->nRdLock>=1 );
+
+ if( eLock>SQLITE_LOCK_SHARED && (p->mFlags & SQLITE_DESERIALIZE_READONLY) ){
+ rc = SQLITE_READONLY;
+ }else{
+ switch( eLock ){
+ case SQLITE_LOCK_SHARED: {
+ assert( pThis->eLock==SQLITE_LOCK_NONE );
+ if( p->nWrLock>0 ){
+ rc = SQLITE_BUSY;
+ }else{
+ p->nRdLock++;
+ }
+ break;
+ };
+
+ case SQLITE_LOCK_RESERVED:
+ case SQLITE_LOCK_PENDING: {
+ assert( pThis->eLock>=SQLITE_LOCK_SHARED );
+ if( ALWAYS(pThis->eLock==SQLITE_LOCK_SHARED) ){
+ if( p->nWrLock>0 ){
+ rc = SQLITE_BUSY;
+ }else{
+ p->nWrLock = 1;
+ }
+ }
+ break;
+ }
+
+ default: {
+ assert( eLock==SQLITE_LOCK_EXCLUSIVE );
+ assert( pThis->eLock>=SQLITE_LOCK_SHARED );
+ if( p->nRdLock>1 ){
+ rc = SQLITE_BUSY;
+ }else if( pThis->eLock==SQLITE_LOCK_SHARED ){
+ p->nWrLock = 1;
+ }
+ break;
+ }
+ }
+ }
+ if( rc==SQLITE_OK ) pThis->eLock = eLock;
+ memdbLeave(p);
+ return rc;
+}
+
+/*
+** Unlock an memdb-file.
+*/
+static int memdbUnlock(sqlite3_file *pFile, int eLock){
+ MemFile *pThis = (MemFile*)pFile;
+ MemStore *p = pThis->pStore;
+ if( eLock>=pThis->eLock ) return SQLITE_OK;
+ memdbEnter(p);
+
+ assert( eLock==SQLITE_LOCK_SHARED || eLock==SQLITE_LOCK_NONE );
+ if( eLock==SQLITE_LOCK_SHARED ){
+ if( ALWAYS(pThis->eLock>SQLITE_LOCK_SHARED) ){
+ p->nWrLock--;
+ }
+ }else{
+ if( pThis->eLock>SQLITE_LOCK_SHARED ){
+ p->nWrLock--;
+ }
+ p->nRdLock--;
+ }
+
+ pThis->eLock = eLock;
+ memdbLeave(p);
+ return SQLITE_OK;
+}
+
+#if 0
+/*
+** This interface is only used for crash recovery, which does not
+** occur on an in-memory database.
+*/
+static int memdbCheckReservedLock(sqlite3_file *pFile, int *pResOut){
+ *pResOut = 0;
+ return SQLITE_OK;
+}
+#endif
+
+
+/*
+** File control method. For custom operations on an memdb-file.
+*/
+static int memdbFileControl(sqlite3_file *pFile, int op, void *pArg){
+ MemStore *p = ((MemFile*)pFile)->pStore;
+ int rc = SQLITE_NOTFOUND;
+ memdbEnter(p);
+ if( op==SQLITE_FCNTL_VFSNAME ){
+ *(char**)pArg = sqlite3_mprintf("memdb(%p,%lld)", p->aData, p->sz);
+ rc = SQLITE_OK;
+ }
+ if( op==SQLITE_FCNTL_SIZE_LIMIT ){
+ sqlite3_int64 iLimit = *(sqlite3_int64*)pArg;
+ if( iLimit<p->sz ){
+ if( iLimit<0 ){
+ iLimit = p->szMax;
+ }else{
+ iLimit = p->sz;
+ }
+ }
+ p->szMax = iLimit;
+ *(sqlite3_int64*)pArg = iLimit;
+ rc = SQLITE_OK;
+ }
+ memdbLeave(p);
+ return rc;
+}
+
+#if 0 /* Not used because of SQLITE_IOCAP_POWERSAFE_OVERWRITE */
+/*
+** Return the sector-size in bytes for an memdb-file.
+*/
+static int memdbSectorSize(sqlite3_file *pFile){
+ return 1024;
+}
+#endif
+
+/*
+** Return the device characteristic flags supported by an memdb-file.
+*/
+static int memdbDeviceCharacteristics(sqlite3_file *pFile){
+ UNUSED_PARAMETER(pFile);
+ return SQLITE_IOCAP_ATOMIC |
+ SQLITE_IOCAP_POWERSAFE_OVERWRITE |
+ SQLITE_IOCAP_SAFE_APPEND |
+ SQLITE_IOCAP_SEQUENTIAL;
+}
+
+/* Fetch a page of a memory-mapped file */
+static int memdbFetch(
+ sqlite3_file *pFile,
+ sqlite3_int64 iOfst,
+ int iAmt,
+ void **pp
+){
+ MemStore *p = ((MemFile*)pFile)->pStore;
+ memdbEnter(p);
+ if( iOfst+iAmt>p->sz || (p->mFlags & SQLITE_DESERIALIZE_RESIZEABLE)!=0 ){
+ *pp = 0;
+ }else{
+ p->nMmap++;
+ *pp = (void*)(p->aData + iOfst);
+ }
+ memdbLeave(p);
+ return SQLITE_OK;
+}
+
+/* Release a memory-mapped page */
+static int memdbUnfetch(sqlite3_file *pFile, sqlite3_int64 iOfst, void *pPage){
+ MemStore *p = ((MemFile*)pFile)->pStore;
+ UNUSED_PARAMETER(iOfst);
+ UNUSED_PARAMETER(pPage);
+ memdbEnter(p);
+ p->nMmap--;
+ memdbLeave(p);
+ return SQLITE_OK;
+}
+
+/*
+** Open an mem file handle.
+*/
+static int memdbOpen(
+ sqlite3_vfs *pVfs,
+ const char *zName,
+ sqlite3_file *pFd,
+ int flags,
+ int *pOutFlags
+){
+ MemFile *pFile = (MemFile*)pFd;
+ MemStore *p = 0;
+ int szName;
+ UNUSED_PARAMETER(pVfs);
+
+ memset(pFile, 0, sizeof(*pFile));
+ szName = sqlite3Strlen30(zName);
+ if( szName>1 && (zName[0]=='/' || zName[0]=='\\') ){
+ int i;
+#ifndef SQLITE_MUTEX_OMIT
+ sqlite3_mutex *pVfsMutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_VFS1);
+#endif
+ sqlite3_mutex_enter(pVfsMutex);
+ for(i=0; i<memdb_g.nMemStore; i++){
+ if( strcmp(memdb_g.apMemStore[i]->zFName,zName)==0 ){
+ p = memdb_g.apMemStore[i];
+ break;
+ }
+ }
+ if( p==0 ){
+ MemStore **apNew;
+ p = sqlite3Malloc( sizeof(*p) + szName + 3 );
+ if( p==0 ){
+ sqlite3_mutex_leave(pVfsMutex);
+ return SQLITE_NOMEM;
+ }
+ apNew = sqlite3Realloc(memdb_g.apMemStore,
+ sizeof(apNew[0])*(memdb_g.nMemStore+1) );
+ if( apNew==0 ){
+ sqlite3_free(p);
+ sqlite3_mutex_leave(pVfsMutex);
+ return SQLITE_NOMEM;
+ }
+ apNew[memdb_g.nMemStore++] = p;
+ memdb_g.apMemStore = apNew;
+ memset(p, 0, sizeof(*p));
+ p->mFlags = SQLITE_DESERIALIZE_RESIZEABLE|SQLITE_DESERIALIZE_FREEONCLOSE;
+ p->szMax = sqlite3GlobalConfig.mxMemdbSize;
+ p->zFName = (char*)&p[1];
+ memcpy(p->zFName, zName, szName+1);
+ p->pMutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST);
+ if( p->pMutex==0 ){
+ memdb_g.nMemStore--;
+ sqlite3_free(p);
+ sqlite3_mutex_leave(pVfsMutex);
+ return SQLITE_NOMEM;
+ }
+ p->nRef = 1;
+ memdbEnter(p);
+ }else{
+ memdbEnter(p);
+ p->nRef++;
+ }
+ sqlite3_mutex_leave(pVfsMutex);
+ }else{
+ p = sqlite3Malloc( sizeof(*p) );
+ if( p==0 ){
+ return SQLITE_NOMEM;
+ }
+ memset(p, 0, sizeof(*p));
+ p->mFlags = SQLITE_DESERIALIZE_RESIZEABLE | SQLITE_DESERIALIZE_FREEONCLOSE;
+ p->szMax = sqlite3GlobalConfig.mxMemdbSize;
+ }
+ pFile->pStore = p;
+ if( pOutFlags!=0 ){
+ *pOutFlags = flags | SQLITE_OPEN_MEMORY;
+ }
+ pFd->pMethods = &memdb_io_methods;
+ memdbLeave(p);
+ return SQLITE_OK;
+}
+
+#if 0 /* Only used to delete rollback journals, super-journals, and WAL
+ ** files, none of which exist in memdb. So this routine is never used */
+/*
+** Delete the file located at zPath. If the dirSync argument is true,
+** ensure the file-system modifications are synced to disk before
+** returning.
+*/
+static int memdbDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){
+ return SQLITE_IOERR_DELETE;
+}
+#endif
+
+/*
+** Test for access permissions. Return true if the requested permission
+** is available, or false otherwise.
+**
+** With memdb, no files ever exist on disk. So always return false.
+*/
+static int memdbAccess(
+ sqlite3_vfs *pVfs,
+ const char *zPath,
+ int flags,
+ int *pResOut
+){
+ UNUSED_PARAMETER(pVfs);
+ UNUSED_PARAMETER(zPath);
+ UNUSED_PARAMETER(flags);
+ *pResOut = 0;
+ return SQLITE_OK;
+}
+
+/*
+** Populate buffer zOut with the full canonical pathname corresponding
+** to the pathname in zPath. zOut is guaranteed to point to a buffer
+** of at least (INST_MAX_PATHNAME+1) bytes.
+*/
+static int memdbFullPathname(
+ sqlite3_vfs *pVfs,
+ const char *zPath,
+ int nOut,
+ char *zOut
+){
+ UNUSED_PARAMETER(pVfs);
+ sqlite3_snprintf(nOut, zOut, "%s", zPath);
+ return SQLITE_OK;
+}
+
+/*
+** Open the dynamic library located at zPath and return a handle.
+*/
+static void *memdbDlOpen(sqlite3_vfs *pVfs, const char *zPath){
+ return ORIGVFS(pVfs)->xDlOpen(ORIGVFS(pVfs), zPath);
+}
+
+/*
+** Populate the buffer zErrMsg (size nByte bytes) with a human readable
+** utf-8 string describing the most recent error encountered associated
+** with dynamic libraries.
+*/
+static void memdbDlError(sqlite3_vfs *pVfs, int nByte, char *zErrMsg){
+ ORIGVFS(pVfs)->xDlError(ORIGVFS(pVfs), nByte, zErrMsg);
+}
+
+/*
+** Return a pointer to the symbol zSymbol in the dynamic library pHandle.
+*/
+static void (*memdbDlSym(sqlite3_vfs *pVfs, void *p, const char *zSym))(void){
+ return ORIGVFS(pVfs)->xDlSym(ORIGVFS(pVfs), p, zSym);
+}
+
+/*
+** Close the dynamic library handle pHandle.
+*/
+static void memdbDlClose(sqlite3_vfs *pVfs, void *pHandle){
+ ORIGVFS(pVfs)->xDlClose(ORIGVFS(pVfs), pHandle);
+}
+
+/*
+** Populate the buffer pointed to by zBufOut with nByte bytes of
+** random data.
+*/
+static int memdbRandomness(sqlite3_vfs *pVfs, int nByte, char *zBufOut){
+ return ORIGVFS(pVfs)->xRandomness(ORIGVFS(pVfs), nByte, zBufOut);
+}
+
+/*
+** Sleep for nMicro microseconds. Return the number of microseconds
+** actually slept.
+*/
+static int memdbSleep(sqlite3_vfs *pVfs, int nMicro){
+ return ORIGVFS(pVfs)->xSleep(ORIGVFS(pVfs), nMicro);
+}
+
+#if 0 /* Never used. Modern cores only call xCurrentTimeInt64() */
+/*
+** Return the current time as a Julian Day number in *pTimeOut.
+*/
+static int memdbCurrentTime(sqlite3_vfs *pVfs, double *pTimeOut){
+ return ORIGVFS(pVfs)->xCurrentTime(ORIGVFS(pVfs), pTimeOut);
+}
+#endif
+
+static int memdbGetLastError(sqlite3_vfs *pVfs, int a, char *b){
+ return ORIGVFS(pVfs)->xGetLastError(ORIGVFS(pVfs), a, b);
+}
+static int memdbCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *p){
+ return ORIGVFS(pVfs)->xCurrentTimeInt64(ORIGVFS(pVfs), p);
+}
+
+/*
+** Translate a database connection pointer and schema name into a
+** MemFile pointer.
+*/
+static MemFile *memdbFromDbSchema(sqlite3 *db, const char *zSchema){
+ MemFile *p = 0;
+ MemStore *pStore;
+ int rc = sqlite3_file_control(db, zSchema, SQLITE_FCNTL_FILE_POINTER, &p);
+ if( rc ) return 0;
+ if( p->base.pMethods!=&memdb_io_methods ) return 0;
+ pStore = p->pStore;
+ memdbEnter(pStore);
+ if( pStore->zFName!=0 ) p = 0;
+ memdbLeave(pStore);
+ return p;
+}
+
+/*
+** Return the serialization of a database
+*/
+SQLITE_API unsigned char *sqlite3_serialize(
+ sqlite3 *db, /* The database connection */
+ const char *zSchema, /* Which database within the connection */
+ sqlite3_int64 *piSize, /* Write size here, if not NULL */
+ unsigned int mFlags /* Maybe SQLITE_SERIALIZE_NOCOPY */
+){
+ MemFile *p;
+ int iDb;
+ Btree *pBt;
+ sqlite3_int64 sz;
+ int szPage = 0;
+ sqlite3_stmt *pStmt = 0;
+ unsigned char *pOut;
+ char *zSql;
+ int rc;
+
+#ifdef SQLITE_ENABLE_API_ARMOR
+ if( !sqlite3SafetyCheckOk(db) ){
+ (void)SQLITE_MISUSE_BKPT;
+ return 0;
+ }
+#endif
+
+ if( zSchema==0 ) zSchema = db->aDb[0].zDbSName;
+ p = memdbFromDbSchema(db, zSchema);
+ iDb = sqlite3FindDbName(db, zSchema);
+ if( piSize ) *piSize = -1;
+ if( iDb<0 ) return 0;
+ if( p ){
+ MemStore *pStore = p->pStore;
+ assert( pStore->pMutex==0 );
+ if( piSize ) *piSize = pStore->sz;
+ if( mFlags & SQLITE_SERIALIZE_NOCOPY ){
+ pOut = pStore->aData;
+ }else{
+ pOut = sqlite3_malloc64( pStore->sz );
+ if( pOut ) memcpy(pOut, pStore->aData, pStore->sz);
+ }
+ return pOut;
+ }
+ pBt = db->aDb[iDb].pBt;
+ if( pBt==0 ) return 0;
+ szPage = sqlite3BtreeGetPageSize(pBt);
+ zSql = sqlite3_mprintf("PRAGMA \"%w\".page_count", zSchema);
+ rc = zSql ? sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0) : SQLITE_NOMEM;
+ sqlite3_free(zSql);
+ if( rc ) return 0;
+ rc = sqlite3_step(pStmt);
+ if( rc!=SQLITE_ROW ){
+ pOut = 0;
+ }else{
+ sz = sqlite3_column_int64(pStmt, 0)*szPage;
+ if( sz==0 ){
+ sqlite3_reset(pStmt);
+ sqlite3_exec(db, "BEGIN IMMEDIATE; COMMIT;", 0, 0, 0);
+ rc = sqlite3_step(pStmt);
+ if( rc==SQLITE_ROW ){
+ sz = sqlite3_column_int64(pStmt, 0)*szPage;
+ }
+ }
+ if( piSize ) *piSize = sz;
+ if( mFlags & SQLITE_SERIALIZE_NOCOPY ){
+ pOut = 0;
+ }else{
+ pOut = sqlite3_malloc64( sz );
+ if( pOut ){
+ int nPage = sqlite3_column_int(pStmt, 0);
+ Pager *pPager = sqlite3BtreePager(pBt);
+ int pgno;
+ for(pgno=1; pgno<=nPage; pgno++){
+ DbPage *pPage = 0;
+ unsigned char *pTo = pOut + szPage*(sqlite3_int64)(pgno-1);
+ rc = sqlite3PagerGet(pPager, pgno, (DbPage**)&pPage, 0);
+ if( rc==SQLITE_OK ){
+ memcpy(pTo, sqlite3PagerGetData(pPage), szPage);
+ }else{
+ memset(pTo, 0, szPage);
+ }
+ sqlite3PagerUnref(pPage);
+ }
+ }
+ }
+ }
+ sqlite3_finalize(pStmt);
+ return pOut;
+}
+
+/* Convert zSchema to a MemDB and initialize its content.
+*/
+SQLITE_API int sqlite3_deserialize(
+ sqlite3 *db, /* The database connection */
+ const char *zSchema, /* Which DB to reopen with the deserialization */
+ unsigned char *pData, /* The serialized database content */
+ sqlite3_int64 szDb, /* Number bytes in the deserialization */
+ sqlite3_int64 szBuf, /* Total size of buffer pData[] */
+ unsigned mFlags /* Zero or more SQLITE_DESERIALIZE_* flags */
+){
+ MemFile *p;
+ char *zSql;
+ sqlite3_stmt *pStmt = 0;
+ int rc;
+ int iDb;
+
+#ifdef SQLITE_ENABLE_API_ARMOR
+ if( !sqlite3SafetyCheckOk(db) ){
+ return SQLITE_MISUSE_BKPT;
+ }
+ if( szDb<0 ) return SQLITE_MISUSE_BKPT;
+ if( szBuf<0 ) return SQLITE_MISUSE_BKPT;
+#endif
+
+ sqlite3_mutex_enter(db->mutex);
+ if( zSchema==0 ) zSchema = db->aDb[0].zDbSName;
+ iDb = sqlite3FindDbName(db, zSchema);
+ testcase( iDb==1 );
+ if( iDb<2 && iDb!=0 ){
+ rc = SQLITE_ERROR;
+ goto end_deserialize;
+ }
+ zSql = sqlite3_mprintf("ATTACH x AS %Q", zSchema);
+ if( zSql==0 ){
+ rc = SQLITE_NOMEM;
+ }else{
+ rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);
+ sqlite3_free(zSql);
+ }
+ if( rc ) goto end_deserialize;
+ db->init.iDb = (u8)iDb;
+ db->init.reopenMemdb = 1;
+ rc = sqlite3_step(pStmt);
+ db->init.reopenMemdb = 0;
+ if( rc!=SQLITE_DONE ){
+ rc = SQLITE_ERROR;
+ goto end_deserialize;
+ }
+ p = memdbFromDbSchema(db, zSchema);
+ if( p==0 ){
+ rc = SQLITE_ERROR;
+ }else{
+ MemStore *pStore = p->pStore;
+ pStore->aData = pData;
+ pData = 0;
+ pStore->sz = szDb;
+ pStore->szAlloc = szBuf;
+ pStore->szMax = szBuf;
+ if( pStore->szMax<sqlite3GlobalConfig.mxMemdbSize ){
+ pStore->szMax = sqlite3GlobalConfig.mxMemdbSize;
+ }
+ pStore->mFlags = mFlags;
+ rc = SQLITE_OK;
+ }
+
+end_deserialize:
+ sqlite3_finalize(pStmt);
+ if( pData && (mFlags & SQLITE_DESERIALIZE_FREEONCLOSE)!=0 ){
+ sqlite3_free(pData);
+ }
+ sqlite3_mutex_leave(db->mutex);
+ return rc;
+}
+
+/*
+** Return true if the VFS is the memvfs.
+*/
+SQLITE_PRIVATE int sqlite3IsMemdb(const sqlite3_vfs *pVfs){
+ return pVfs==&memdb_vfs;
+}
+
+/*
+** This routine is called when the extension is loaded.
+** Register the new VFS.
+*/
+SQLITE_PRIVATE int sqlite3MemdbInit(void){
+ sqlite3_vfs *pLower = sqlite3_vfs_find(0);
+ unsigned int sz;
+ if( NEVER(pLower==0) ) return SQLITE_ERROR;
+ sz = pLower->szOsFile;
+ memdb_vfs.pAppData = pLower;
+ /* The following conditional can only be true when compiled for
+ ** Windows x86 and SQLITE_MAX_MMAP_SIZE=0. We always leave
+ ** it in, to be safe, but it is marked as NO_TEST since there
+ ** is no way to reach it under most builds. */
+ if( sz<sizeof(MemFile) ) sz = sizeof(MemFile); /*NO_TEST*/
+ memdb_vfs.szOsFile = sz;
+ return sqlite3_vfs_register(&memdb_vfs, 0);
+}
+#endif /* SQLITE_OMIT_DESERIALIZE */
+
+/************** End of memdb.c ***********************************************/
+/************** Begin file bitvec.c ******************************************/
+/*
+** 2008 February 16
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This file implements an object that represents a fixed-length
+** bitmap. Bits are numbered starting with 1.
+**
+** A bitmap is used to record which pages of a database file have been
+** journalled during a transaction, or which pages have the "dont-write"
+** property. Usually only a few pages are meet either condition.
+** So the bitmap is usually sparse and has low cardinality.
+** But sometimes (for example when during a DROP of a large table) most
+** or all of the pages in a database can get journalled. In those cases,
+** the bitmap becomes dense with high cardinality. The algorithm needs
+** to handle both cases well.
+**
+** The size of the bitmap is fixed when the object is created.
+**
+** All bits are clear when the bitmap is created. Individual bits
+** may be set or cleared one at a time.
+**
+** Test operations are about 100 times more common that set operations.
+** Clear operations are exceedingly rare. There are usually between
+** 5 and 500 set operations per Bitvec object, though the number of sets can
+** sometimes grow into tens of thousands or larger. The size of the
+** Bitvec object is the number of pages in the database file at the
+** start of a transaction, and is thus usually less than a few thousand,
+** but can be as large as 2 billion for a really big database.
+*/
+/* #include "sqliteInt.h" */
+
+/* Size of the Bitvec structure in bytes. */
+#define BITVEC_SZ 512
+
+/* Round the union size down to the nearest pointer boundary, since that's how
+** it will be aligned within the Bitvec struct. */
+#define BITVEC_USIZE \
+ (((BITVEC_SZ-(3*sizeof(u32)))/sizeof(Bitvec*))*sizeof(Bitvec*))
+
+/* Type of the array "element" for the bitmap representation.
+** Should be a power of 2, and ideally, evenly divide into BITVEC_USIZE.
+** Setting this to the "natural word" size of your CPU may improve
+** performance. */
+#define BITVEC_TELEM u8
+/* Size, in bits, of the bitmap element. */
+#define BITVEC_SZELEM 8
+/* Number of elements in a bitmap array. */
+#define BITVEC_NELEM (BITVEC_USIZE/sizeof(BITVEC_TELEM))
+/* Number of bits in the bitmap array. */
+#define BITVEC_NBIT (BITVEC_NELEM*BITVEC_SZELEM)
+
+/* Number of u32 values in hash table. */
+#define BITVEC_NINT (BITVEC_USIZE/sizeof(u32))
+/* Maximum number of entries in hash table before
+** sub-dividing and re-hashing. */
+#define BITVEC_MXHASH (BITVEC_NINT/2)
+/* Hashing function for the aHash representation.
+** Empirical testing showed that the *37 multiplier
+** (an arbitrary prime)in the hash function provided
+** no fewer collisions than the no-op *1. */
+#define BITVEC_HASH(X) (((X)*1)%BITVEC_NINT)
+
+#define BITVEC_NPTR (BITVEC_USIZE/sizeof(Bitvec *))
+
+
+/*
+** A bitmap is an instance of the following structure.
+**
+** This bitmap records the existence of zero or more bits
+** with values between 1 and iSize, inclusive.
+**
+** There are three possible representations of the bitmap.
+** If iSize<=BITVEC_NBIT, then Bitvec.u.aBitmap[] is a straight
+** bitmap. The least significant bit is bit 1.
+**
+** If iSize>BITVEC_NBIT and iDivisor==0 then Bitvec.u.aHash[] is
+** a hash table that will hold up to BITVEC_MXHASH distinct values.
+**
+** Otherwise, the value i is redirected into one of BITVEC_NPTR
+** sub-bitmaps pointed to by Bitvec.u.apSub[]. Each subbitmap
+** handles up to iDivisor separate values of i. apSub[0] holds
+** values between 1 and iDivisor. apSub[1] holds values between
+** iDivisor+1 and 2*iDivisor. apSub[N] holds values between
+** N*iDivisor+1 and (N+1)*iDivisor. Each subbitmap is normalized
+** to hold deal with values between 1 and iDivisor.
+*/
+struct Bitvec {
+ u32 iSize; /* Maximum bit index. Max iSize is 4,294,967,296. */
+ u32 nSet; /* Number of bits that are set - only valid for aHash
+ ** element. Max is BITVEC_NINT. For BITVEC_SZ of 512,
+ ** this would be 125. */
+ u32 iDivisor; /* Number of bits handled by each apSub[] entry. */
+ /* Should >=0 for apSub element. */
+ /* Max iDivisor is max(u32) / BITVEC_NPTR + 1. */
+ /* For a BITVEC_SZ of 512, this would be 34,359,739. */
+ union {
+ BITVEC_TELEM aBitmap[BITVEC_NELEM]; /* Bitmap representation */
+ u32 aHash[BITVEC_NINT]; /* Hash table representation */
+ Bitvec *apSub[BITVEC_NPTR]; /* Recursive representation */
+ } u;
+};
+
+/*
+** Create a new bitmap object able to handle bits between 0 and iSize,
+** inclusive. Return a pointer to the new object. Return NULL if
+** malloc fails.
+*/
+SQLITE_PRIVATE Bitvec *sqlite3BitvecCreate(u32 iSize){
+ Bitvec *p;
+ assert( sizeof(*p)==BITVEC_SZ );
+ p = sqlite3MallocZero( sizeof(*p) );
+ if( p ){
+ p->iSize = iSize;
+ }
+ return p;
+}
+
+/*
+** Check to see if the i-th bit is set. Return true or false.
+** If p is NULL (if the bitmap has not been created) or if
+** i is out of range, then return false.
+*/
+SQLITE_PRIVATE int sqlite3BitvecTestNotNull(Bitvec *p, u32 i){
+ assert( p!=0 );
+ i--;
+ if( i>=p->iSize ) return 0;
+ while( p->iDivisor ){
+ u32 bin = i/p->iDivisor;
+ i = i%p->iDivisor;
+ p = p->u.apSub[bin];
+ if (!p) {
+ return 0;
+ }
+ }
+ if( p->iSize<=BITVEC_NBIT ){
+ return (p->u.aBitmap[i/BITVEC_SZELEM] & (1<<(i&(BITVEC_SZELEM-1))))!=0;
+ } else{
+ u32 h = BITVEC_HASH(i++);
+ while( p->u.aHash[h] ){
+ if( p->u.aHash[h]==i ) return 1;
+ h = (h+1) % BITVEC_NINT;
+ }
+ return 0;
+ }
+}
+SQLITE_PRIVATE int sqlite3BitvecTest(Bitvec *p, u32 i){
+ return p!=0 && sqlite3BitvecTestNotNull(p,i);
+}
+
+/*
+** Set the i-th bit. Return 0 on success and an error code if
+** anything goes wrong.
+**
+** This routine might cause sub-bitmaps to be allocated. Failing
+** to get the memory needed to hold the sub-bitmap is the only
+** that can go wrong with an insert, assuming p and i are valid.
+**
+** The calling function must ensure that p is a valid Bitvec object
+** and that the value for "i" is within range of the Bitvec object.
+** Otherwise the behavior is undefined.
+*/
+SQLITE_PRIVATE int sqlite3BitvecSet(Bitvec *p, u32 i){
+ u32 h;
+ if( p==0 ) return SQLITE_OK;
+ assert( i>0 );
+ assert( i<=p->iSize );
+ i--;
+ while((p->iSize > BITVEC_NBIT) && p->iDivisor) {
+ u32 bin = i/p->iDivisor;
+ i = i%p->iDivisor;
+ if( p->u.apSub[bin]==0 ){
+ p->u.apSub[bin] = sqlite3BitvecCreate( p->iDivisor );
+ if( p->u.apSub[bin]==0 ) return SQLITE_NOMEM_BKPT;
+ }
+ p = p->u.apSub[bin];
+ }
+ if( p->iSize<=BITVEC_NBIT ){
+ p->u.aBitmap[i/BITVEC_SZELEM] |= 1 << (i&(BITVEC_SZELEM-1));
+ return SQLITE_OK;
+ }
+ h = BITVEC_HASH(i++);
+ /* if there wasn't a hash collision, and this doesn't */
+ /* completely fill the hash, then just add it without */
+ /* worrying about sub-dividing and re-hashing. */
+ if( !p->u.aHash[h] ){
+ if (p->nSet<(BITVEC_NINT-1)) {
+ goto bitvec_set_end;
+ } else {
+ goto bitvec_set_rehash;
+ }
+ }
+ /* there was a collision, check to see if it's already */
+ /* in hash, if not, try to find a spot for it */
+ do {
+ if( p->u.aHash[h]==i ) return SQLITE_OK;
+ h++;
+ if( h>=BITVEC_NINT ) h = 0;
+ } while( p->u.aHash[h] );
+ /* we didn't find it in the hash. h points to the first */
+ /* available free spot. check to see if this is going to */
+ /* make our hash too "full". */
+bitvec_set_rehash:
+ if( p->nSet>=BITVEC_MXHASH ){
+ unsigned int j;
+ int rc;
+ u32 *aiValues = sqlite3StackAllocRaw(0, sizeof(p->u.aHash));
+ if( aiValues==0 ){
+ return SQLITE_NOMEM_BKPT;
+ }else{
+ memcpy(aiValues, p->u.aHash, sizeof(p->u.aHash));
+ memset(p->u.apSub, 0, sizeof(p->u.apSub));
+ p->iDivisor = (p->iSize + BITVEC_NPTR - 1)/BITVEC_NPTR;
+ rc = sqlite3BitvecSet(p, i);
+ for(j=0; j<BITVEC_NINT; j++){
+ if( aiValues[j] ) rc |= sqlite3BitvecSet(p, aiValues[j]);
+ }
+ sqlite3StackFree(0, aiValues);
+ return rc;
+ }
+ }
+bitvec_set_end:
+ p->nSet++;
+ p->u.aHash[h] = i;
+ return SQLITE_OK;
+}
+
+/*
+** Clear the i-th bit.
+**
+** pBuf must be a pointer to at least BITVEC_SZ bytes of temporary storage
+** that BitvecClear can use to rebuilt its hash table.
+*/
+SQLITE_PRIVATE void sqlite3BitvecClear(Bitvec *p, u32 i, void *pBuf){
+ if( p==0 ) return;
+ assert( i>0 );
+ i--;
+ while( p->iDivisor ){
+ u32 bin = i/p->iDivisor;
+ i = i%p->iDivisor;
+ p = p->u.apSub[bin];
+ if (!p) {
+ return;
+ }
+ }
+ if( p->iSize<=BITVEC_NBIT ){
+ p->u.aBitmap[i/BITVEC_SZELEM] &= ~(1 << (i&(BITVEC_SZELEM-1)));
+ }else{
+ unsigned int j;
+ u32 *aiValues = pBuf;
+ memcpy(aiValues, p->u.aHash, sizeof(p->u.aHash));
+ memset(p->u.aHash, 0, sizeof(p->u.aHash));
+ p->nSet = 0;
+ for(j=0; j<BITVEC_NINT; j++){
+ if( aiValues[j] && aiValues[j]!=(i+1) ){
+ u32 h = BITVEC_HASH(aiValues[j]-1);
+ p->nSet++;
+ while( p->u.aHash[h] ){
+ h++;
+ if( h>=BITVEC_NINT ) h = 0;
+ }
+ p->u.aHash[h] = aiValues[j];
+ }
+ }
+ }
+}
+
+/*
+** Destroy a bitmap object. Reclaim all memory used.
+*/
+SQLITE_PRIVATE void sqlite3BitvecDestroy(Bitvec *p){
+ if( p==0 ) return;
+ if( p->iDivisor ){
+ unsigned int i;
+ for(i=0; i<BITVEC_NPTR; i++){
+ sqlite3BitvecDestroy(p->u.apSub[i]);
+ }
+ }
+ sqlite3_free(p);
+}
+
+/*
+** Return the value of the iSize parameter specified when Bitvec *p
+** was created.
+*/
+SQLITE_PRIVATE u32 sqlite3BitvecSize(Bitvec *p){
+ return p->iSize;
+}
+
+#ifndef SQLITE_UNTESTABLE
+/*
+** Let V[] be an array of unsigned characters sufficient to hold
+** up to N bits. Let I be an integer between 0 and N. 0<=I<N.
+** Then the following macros can be used to set, clear, or test
+** individual bits within V.
+*/
+#define SETBIT(V,I) V[I>>3] |= (1<<(I&7))
+#define CLEARBIT(V,I) V[I>>3] &= ~(1<<(I&7))
+#define TESTBIT(V,I) (V[I>>3]&(1<<(I&7)))!=0
+
+/*
+** This routine runs an extensive test of the Bitvec code.
+**
+** The input is an array of integers that acts as a program
+** to test the Bitvec. The integers are opcodes followed
+** by 0, 1, or 3 operands, depending on the opcode. Another
+** opcode follows immediately after the last operand.
+**
+** There are 6 opcodes numbered from 0 through 5. 0 is the
+** "halt" opcode and causes the test to end.
+**
+** 0 Halt and return the number of errors
+** 1 N S X Set N bits beginning with S and incrementing by X
+** 2 N S X Clear N bits beginning with S and incrementing by X
+** 3 N Set N randomly chosen bits
+** 4 N Clear N randomly chosen bits
+** 5 N S X Set N bits from S increment X in array only, not in bitvec
+**
+** The opcodes 1 through 4 perform set and clear operations are performed
+** on both a Bitvec object and on a linear array of bits obtained from malloc.
+** Opcode 5 works on the linear array only, not on the Bitvec.
+** Opcode 5 is used to deliberately induce a fault in order to
+** confirm that error detection works.
+**
+** At the conclusion of the test the linear array is compared
+** against the Bitvec object. If there are any differences,
+** an error is returned. If they are the same, zero is returned.
+**
+** If a memory allocation error occurs, return -1.
+*/
+SQLITE_PRIVATE int sqlite3BitvecBuiltinTest(int sz, int *aOp){
+ Bitvec *pBitvec = 0;
+ unsigned char *pV = 0;
+ int rc = -1;
+ int i, nx, pc, op;
+ void *pTmpSpace;
+
+ /* Allocate the Bitvec to be tested and a linear array of
+ ** bits to act as the reference */
+ pBitvec = sqlite3BitvecCreate( sz );
+ pV = sqlite3MallocZero( (sz+7)/8 + 1 );
+ pTmpSpace = sqlite3_malloc64(BITVEC_SZ);
+ if( pBitvec==0 || pV==0 || pTmpSpace==0 ) goto bitvec_end;
+
+ /* NULL pBitvec tests */
+ sqlite3BitvecSet(0, 1);
+ sqlite3BitvecClear(0, 1, pTmpSpace);
+
+ /* Run the program */
+ pc = i = 0;
+ while( (op = aOp[pc])!=0 ){
+ switch( op ){
+ case 1:
+ case 2:
+ case 5: {
+ nx = 4;
+ i = aOp[pc+2] - 1;
+ aOp[pc+2] += aOp[pc+3];
+ break;
+ }
+ case 3:
+ case 4:
+ default: {
+ nx = 2;
+ sqlite3_randomness(sizeof(i), &i);
+ break;
+ }
+ }
+ if( (--aOp[pc+1]) > 0 ) nx = 0;
+ pc += nx;
+ i = (i & 0x7fffffff)%sz;
+ if( (op & 1)!=0 ){
+ SETBIT(pV, (i+1));
+ if( op!=5 ){
+ if( sqlite3BitvecSet(pBitvec, i+1) ) goto bitvec_end;
+ }
+ }else{
+ CLEARBIT(pV, (i+1));
+ sqlite3BitvecClear(pBitvec, i+1, pTmpSpace);
+ }
+ }
+
+ /* Test to make sure the linear array exactly matches the
+ ** Bitvec object. Start with the assumption that they do
+ ** match (rc==0). Change rc to non-zero if a discrepancy
+ ** is found.
+ */
+ rc = sqlite3BitvecTest(0,0) + sqlite3BitvecTest(pBitvec, sz+1)
+ + sqlite3BitvecTest(pBitvec, 0)
+ + (sqlite3BitvecSize(pBitvec) - sz);
+ for(i=1; i<=sz; i++){
+ if( (TESTBIT(pV,i))!=sqlite3BitvecTest(pBitvec,i) ){
+ rc = i;
+ break;
+ }
+ }
+
+ /* Free allocated structure */
+bitvec_end:
+ sqlite3_free(pTmpSpace);
+ sqlite3_free(pV);
+ sqlite3BitvecDestroy(pBitvec);
+ return rc;
+}
+#endif /* SQLITE_UNTESTABLE */
+
+/************** End of bitvec.c **********************************************/
+/************** Begin file pcache.c ******************************************/
+/*
+** 2008 August 05
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This file implements that page cache.
+*/
+/* #include "sqliteInt.h" */
+
+/*
+** A complete page cache is an instance of this structure. Every
+** entry in the cache holds a single page of the database file. The
+** btree layer only operates on the cached copy of the database pages.
+**
+** A page cache entry is "clean" if it exactly matches what is currently
+** on disk. A page is "dirty" if it has been modified and needs to be
+** persisted to disk.
+**
+** pDirty, pDirtyTail, pSynced:
+** All dirty pages are linked into the doubly linked list using
+** PgHdr.pDirtyNext and pDirtyPrev. The list is maintained in LRU order
+** such that p was added to the list more recently than p->pDirtyNext.
+** PCache.pDirty points to the first (newest) element in the list and
+** pDirtyTail to the last (oldest).
+**
+** The PCache.pSynced variable is used to optimize searching for a dirty
+** page to eject from the cache mid-transaction. It is better to eject
+** a page that does not require a journal sync than one that does.
+** Therefore, pSynced is maintained so that it *almost* always points
+** to either the oldest page in the pDirty/pDirtyTail list that has a
+** clear PGHDR_NEED_SYNC flag or to a page that is older than this one
+** (so that the right page to eject can be found by following pDirtyPrev
+** pointers).
+*/
+struct PCache {
+ PgHdr *pDirty, *pDirtyTail; /* List of dirty pages in LRU order */
+ PgHdr *pSynced; /* Last synced page in dirty page list */
+ i64 nRefSum; /* Sum of ref counts over all pages */
+ int szCache; /* Configured cache size */
+ int szSpill; /* Size before spilling occurs */
+ int szPage; /* Size of every page in this cache */
+ int szExtra; /* Size of extra space for each page */
+ u8 bPurgeable; /* True if pages are on backing store */
+ u8 eCreate; /* eCreate value for for xFetch() */
+ int (*xStress)(void*,PgHdr*); /* Call to try make a page clean */
+ void *pStress; /* Argument to xStress */
+ sqlite3_pcache *pCache; /* Pluggable cache module */
+};
+
+/********************************** Test and Debug Logic **********************/
+/*
+** Debug tracing macros. Enable by by changing the "0" to "1" and
+** recompiling.
+**
+** When sqlite3PcacheTrace is 1, single line trace messages are issued.
+** When sqlite3PcacheTrace is 2, a dump of the pcache showing all cache entries
+** is displayed for many operations, resulting in a lot of output.
+*/
+#if defined(SQLITE_DEBUG) && 0
+ int sqlite3PcacheTrace = 2; /* 0: off 1: simple 2: cache dumps */
+ int sqlite3PcacheMxDump = 9999; /* Max cache entries for pcacheDump() */
+# define pcacheTrace(X) if(sqlite3PcacheTrace){sqlite3DebugPrintf X;}
+ static void pcachePageTrace(int i, sqlite3_pcache_page *pLower){
+ PgHdr *pPg;
+ unsigned char *a;
+ int j;
+ if( pLower==0 ){
+ printf("%3d: NULL\n", i);
+ }else{
+ pPg = (PgHdr*)pLower->pExtra;
+ printf("%3d: nRef %2lld flgs %02x data ", i, pPg->nRef, pPg->flags);
+ a = (unsigned char *)pLower->pBuf;
+ for(j=0; j<12; j++) printf("%02x", a[j]);
+ printf(" ptr %p\n", pPg);
+ }
+ }
+ static void pcacheDump(PCache *pCache){
+ int N;
+ int i;
+ sqlite3_pcache_page *pLower;
+
+ if( sqlite3PcacheTrace<2 ) return;
+ if( pCache->pCache==0 ) return;
+ N = sqlite3PcachePagecount(pCache);
+ if( N>sqlite3PcacheMxDump ) N = sqlite3PcacheMxDump;
+ for(i=1; i<=N; i++){
+ pLower = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, i, 0);
+ pcachePageTrace(i, pLower);
+ if( pLower && ((PgHdr*)pLower)->pPage==0 ){
+ sqlite3GlobalConfig.pcache2.xUnpin(pCache->pCache, pLower, 0);
+ }
+ }
+ }
+#else
+# define pcacheTrace(X)
+# define pcachePageTrace(PGNO, X)
+# define pcacheDump(X)
+#endif
+
+/*
+** Return 1 if pPg is on the dirty list for pCache. Return 0 if not.
+** This routine runs inside of assert() statements only.
+*/
+#if defined(SQLITE_ENABLE_EXPENSIVE_ASSERT)
+static int pageOnDirtyList(PCache *pCache, PgHdr *pPg){
+ PgHdr *p;
+ for(p=pCache->pDirty; p; p=p->pDirtyNext){
+ if( p==pPg ) return 1;
+ }
+ return 0;
+}
+static int pageNotOnDirtyList(PCache *pCache, PgHdr *pPg){
+ PgHdr *p;
+ for(p=pCache->pDirty; p; p=p->pDirtyNext){
+ if( p==pPg ) return 0;
+ }
+ return 1;
+}
+#else
+# define pageOnDirtyList(A,B) 1
+# define pageNotOnDirtyList(A,B) 1
+#endif
+
+/*
+** Check invariants on a PgHdr entry. Return true if everything is OK.
+** Return false if any invariant is violated.
+**
+** This routine is for use inside of assert() statements only. For
+** example:
+**
+** assert( sqlite3PcachePageSanity(pPg) );
+*/
+#ifdef SQLITE_DEBUG
+SQLITE_PRIVATE int sqlite3PcachePageSanity(PgHdr *pPg){
+ PCache *pCache;
+ assert( pPg!=0 );
+ assert( pPg->pgno>0 || pPg->pPager==0 ); /* Page number is 1 or more */
+ pCache = pPg->pCache;
+ assert( pCache!=0 ); /* Every page has an associated PCache */
+ if( pPg->flags & PGHDR_CLEAN ){
+ assert( (pPg->flags & PGHDR_DIRTY)==0 );/* Cannot be both CLEAN and DIRTY */
+ assert( pageNotOnDirtyList(pCache, pPg) );/* CLEAN pages not on dirtylist */
+ }else{
+ assert( (pPg->flags & PGHDR_DIRTY)!=0 );/* If not CLEAN must be DIRTY */
+ assert( pPg->pDirtyNext==0 || pPg->pDirtyNext->pDirtyPrev==pPg );
+ assert( pPg->pDirtyPrev==0 || pPg->pDirtyPrev->pDirtyNext==pPg );
+ assert( pPg->pDirtyPrev!=0 || pCache->pDirty==pPg );
+ assert( pageOnDirtyList(pCache, pPg) );
+ }
+ /* WRITEABLE pages must also be DIRTY */
+ if( pPg->flags & PGHDR_WRITEABLE ){
+ assert( pPg->flags & PGHDR_DIRTY ); /* WRITEABLE implies DIRTY */
+ }
+ /* NEED_SYNC can be set independently of WRITEABLE. This can happen,
+ ** for example, when using the sqlite3PagerDontWrite() optimization:
+ ** (1) Page X is journalled, and gets WRITEABLE and NEED_SEEK.
+ ** (2) Page X moved to freelist, WRITEABLE is cleared
+ ** (3) Page X reused, WRITEABLE is set again
+ ** If NEED_SYNC had been cleared in step 2, then it would not be reset
+ ** in step 3, and page might be written into the database without first
+ ** syncing the rollback journal, which might cause corruption on a power
+ ** loss.
+ **
+ ** Another example is when the database page size is smaller than the
+ ** disk sector size. When any page of a sector is journalled, all pages
+ ** in that sector are marked NEED_SYNC even if they are still CLEAN, just
+ ** in case they are later modified, since all pages in the same sector
+ ** must be journalled and synced before any of those pages can be safely
+ ** written.
+ */
+ return 1;
+}
+#endif /* SQLITE_DEBUG */
+
+
+/********************************** Linked List Management ********************/
+
+/* Allowed values for second argument to pcacheManageDirtyList() */
+#define PCACHE_DIRTYLIST_REMOVE 1 /* Remove pPage from dirty list */
+#define PCACHE_DIRTYLIST_ADD 2 /* Add pPage to the dirty list */
+#define PCACHE_DIRTYLIST_FRONT 3 /* Move pPage to the front of the list */
+
+/*
+** Manage pPage's participation on the dirty list. Bits of the addRemove
+** argument determines what operation to do. The 0x01 bit means first
+** remove pPage from the dirty list. The 0x02 means add pPage back to
+** the dirty list. Doing both moves pPage to the front of the dirty list.
+*/
+static void pcacheManageDirtyList(PgHdr *pPage, u8 addRemove){
+ PCache *p = pPage->pCache;
+
+ pcacheTrace(("%p.DIRTYLIST.%s %d\n", p,
+ addRemove==1 ? "REMOVE" : addRemove==2 ? "ADD" : "FRONT",
+ pPage->pgno));
+ if( addRemove & PCACHE_DIRTYLIST_REMOVE ){
+ assert( pPage->pDirtyNext || pPage==p->pDirtyTail );
+ assert( pPage->pDirtyPrev || pPage==p->pDirty );
+
+ /* Update the PCache1.pSynced variable if necessary. */
+ if( p->pSynced==pPage ){
+ p->pSynced = pPage->pDirtyPrev;
+ }
+
+ if( pPage->pDirtyNext ){
+ pPage->pDirtyNext->pDirtyPrev = pPage->pDirtyPrev;
+ }else{
+ assert( pPage==p->pDirtyTail );
+ p->pDirtyTail = pPage->pDirtyPrev;
+ }
+ if( pPage->pDirtyPrev ){
+ pPage->pDirtyPrev->pDirtyNext = pPage->pDirtyNext;
+ }else{
+ /* If there are now no dirty pages in the cache, set eCreate to 2.
+ ** This is an optimization that allows sqlite3PcacheFetch() to skip
+ ** searching for a dirty page to eject from the cache when it might
+ ** otherwise have to. */
+ assert( pPage==p->pDirty );
+ p->pDirty = pPage->pDirtyNext;
+ assert( p->bPurgeable || p->eCreate==2 );
+ if( p->pDirty==0 ){ /*OPTIMIZATION-IF-TRUE*/
+ assert( p->bPurgeable==0 || p->eCreate==1 );
+ p->eCreate = 2;
+ }
+ }
+ }
+ if( addRemove & PCACHE_DIRTYLIST_ADD ){
+ pPage->pDirtyPrev = 0;
+ pPage->pDirtyNext = p->pDirty;
+ if( pPage->pDirtyNext ){
+ assert( pPage->pDirtyNext->pDirtyPrev==0 );
+ pPage->pDirtyNext->pDirtyPrev = pPage;
+ }else{
+ p->pDirtyTail = pPage;
+ if( p->bPurgeable ){
+ assert( p->eCreate==2 );
+ p->eCreate = 1;
+ }
+ }
+ p->pDirty = pPage;
+
+ /* If pSynced is NULL and this page has a clear NEED_SYNC flag, set
+ ** pSynced to point to it. Checking the NEED_SYNC flag is an
+ ** optimization, as if pSynced points to a page with the NEED_SYNC
+ ** flag set sqlite3PcacheFetchStress() searches through all newer
+ ** entries of the dirty-list for a page with NEED_SYNC clear anyway. */
+ if( !p->pSynced
+ && 0==(pPage->flags&PGHDR_NEED_SYNC) /*OPTIMIZATION-IF-FALSE*/
+ ){
+ p->pSynced = pPage;
+ }
+ }
+ pcacheDump(p);
+}
+
+/*
+** Wrapper around the pluggable caches xUnpin method. If the cache is
+** being used for an in-memory database, this function is a no-op.
+*/
+static void pcacheUnpin(PgHdr *p){
+ if( p->pCache->bPurgeable ){
+ pcacheTrace(("%p.UNPIN %d\n", p->pCache, p->pgno));
+ sqlite3GlobalConfig.pcache2.xUnpin(p->pCache->pCache, p->pPage, 0);
+ pcacheDump(p->pCache);
+ }
+}
+
+/*
+** Compute the number of pages of cache requested. p->szCache is the
+** cache size requested by the "PRAGMA cache_size" statement.
+*/
+static int numberOfCachePages(PCache *p){
+ if( p->szCache>=0 ){
+ /* IMPLEMENTATION-OF: R-42059-47211 If the argument N is positive then the
+ ** suggested cache size is set to N. */
+ return p->szCache;
+ }else{
+ i64 n;
+ /* IMPLEMENTATION-OF: R-59858-46238 If the argument N is negative, then the
+ ** number of cache pages is adjusted to be a number of pages that would
+ ** use approximately abs(N*1024) bytes of memory based on the current
+ ** page size. */
+ n = ((-1024*(i64)p->szCache)/(p->szPage+p->szExtra));
+ if( n>1000000000 ) n = 1000000000;
+ return (int)n;
+ }
+}
+
+/*************************************************** General Interfaces ******
+**
+** Initialize and shutdown the page cache subsystem. Neither of these
+** functions are threadsafe.
+*/
+SQLITE_PRIVATE int sqlite3PcacheInitialize(void){
+ if( sqlite3GlobalConfig.pcache2.xInit==0 ){
+ /* IMPLEMENTATION-OF: R-26801-64137 If the xInit() method is NULL, then the
+ ** built-in default page cache is used instead of the application defined
+ ** page cache. */
+ sqlite3PCacheSetDefault();
+ assert( sqlite3GlobalConfig.pcache2.xInit!=0 );
+ }
+ return sqlite3GlobalConfig.pcache2.xInit(sqlite3GlobalConfig.pcache2.pArg);
+}
+SQLITE_PRIVATE void sqlite3PcacheShutdown(void){
+ if( sqlite3GlobalConfig.pcache2.xShutdown ){
+ /* IMPLEMENTATION-OF: R-26000-56589 The xShutdown() method may be NULL. */
+ sqlite3GlobalConfig.pcache2.xShutdown(sqlite3GlobalConfig.pcache2.pArg);
+ }
+}
+
+/*
+** Return the size in bytes of a PCache object.
+*/
+SQLITE_PRIVATE int sqlite3PcacheSize(void){ return sizeof(PCache); }
+
+/*
+** Create a new PCache object. Storage space to hold the object
+** has already been allocated and is passed in as the p pointer.
+** The caller discovers how much space needs to be allocated by
+** calling sqlite3PcacheSize().
+**
+** szExtra is some extra space allocated for each page. The first
+** 8 bytes of the extra space will be zeroed as the page is allocated,
+** but remaining content will be uninitialized. Though it is opaque
+** to this module, the extra space really ends up being the MemPage
+** structure in the pager.
+*/
+SQLITE_PRIVATE int sqlite3PcacheOpen(
+ int szPage, /* Size of every page */
+ int szExtra, /* Extra space associated with each page */
+ int bPurgeable, /* True if pages are on backing store */
+ int (*xStress)(void*,PgHdr*),/* Call to try to make pages clean */
+ void *pStress, /* Argument to xStress */
+ PCache *p /* Preallocated space for the PCache */
+){
+ memset(p, 0, sizeof(PCache));
+ p->szPage = 1;
+ p->szExtra = szExtra;
+ assert( szExtra>=8 ); /* First 8 bytes will be zeroed */
+ p->bPurgeable = bPurgeable;
+ p->eCreate = 2;
+ p->xStress = xStress;
+ p->pStress = pStress;
+ p->szCache = 100;
+ p->szSpill = 1;
+ pcacheTrace(("%p.OPEN szPage %d bPurgeable %d\n",p,szPage,bPurgeable));
+ return sqlite3PcacheSetPageSize(p, szPage);
+}
+
+/*
+** Change the page size for PCache object. The caller must ensure that there
+** are no outstanding page references when this function is called.
+*/
+SQLITE_PRIVATE int sqlite3PcacheSetPageSize(PCache *pCache, int szPage){
+ assert( pCache->nRefSum==0 && pCache->pDirty==0 );
+ if( pCache->szPage ){
+ sqlite3_pcache *pNew;
+ pNew = sqlite3GlobalConfig.pcache2.xCreate(
+ szPage, pCache->szExtra + ROUND8(sizeof(PgHdr)),
+ pCache->bPurgeable
+ );
+ if( pNew==0 ) return SQLITE_NOMEM_BKPT;
+ sqlite3GlobalConfig.pcache2.xCachesize(pNew, numberOfCachePages(pCache));
+ if( pCache->pCache ){
+ sqlite3GlobalConfig.pcache2.xDestroy(pCache->pCache);
+ }
+ pCache->pCache = pNew;
+ pCache->szPage = szPage;
+ pcacheTrace(("%p.PAGESIZE %d\n",pCache,szPage));
+ }
+ return SQLITE_OK;
+}
+
+/*
+** Try to obtain a page from the cache.
+**
+** This routine returns a pointer to an sqlite3_pcache_page object if
+** such an object is already in cache, or if a new one is created.
+** This routine returns a NULL pointer if the object was not in cache
+** and could not be created.
+**
+** The createFlags should be 0 to check for existing pages and should
+** be 3 (not 1, but 3) to try to create a new page.
+**
+** If the createFlag is 0, then NULL is always returned if the page
+** is not already in the cache. If createFlag is 1, then a new page
+** is created only if that can be done without spilling dirty pages
+** and without exceeding the cache size limit.
+**
+** The caller needs to invoke sqlite3PcacheFetchFinish() to properly
+** initialize the sqlite3_pcache_page object and convert it into a
+** PgHdr object. The sqlite3PcacheFetch() and sqlite3PcacheFetchFinish()
+** routines are split this way for performance reasons. When separated
+** they can both (usually) operate without having to push values to
+** the stack on entry and pop them back off on exit, which saves a
+** lot of pushing and popping.
+*/
+SQLITE_PRIVATE sqlite3_pcache_page *sqlite3PcacheFetch(
+ PCache *pCache, /* Obtain the page from this cache */
+ Pgno pgno, /* Page number to obtain */
+ int createFlag /* If true, create page if it does not exist already */
+){
+ int eCreate;
+ sqlite3_pcache_page *pRes;
+
+ assert( pCache!=0 );
+ assert( pCache->pCache!=0 );
+ assert( createFlag==3 || createFlag==0 );
+ assert( pCache->eCreate==((pCache->bPurgeable && pCache->pDirty) ? 1 : 2) );
+
+ /* eCreate defines what to do if the page does not exist.
+ ** 0 Do not allocate a new page. (createFlag==0)
+ ** 1 Allocate a new page if doing so is inexpensive.
+ ** (createFlag==1 AND bPurgeable AND pDirty)
+ ** 2 Allocate a new page even it doing so is difficult.
+ ** (createFlag==1 AND !(bPurgeable AND pDirty)
+ */
+ eCreate = createFlag & pCache->eCreate;
+ assert( eCreate==0 || eCreate==1 || eCreate==2 );
+ assert( createFlag==0 || pCache->eCreate==eCreate );
+ assert( createFlag==0 || eCreate==1+(!pCache->bPurgeable||!pCache->pDirty) );
+ pRes = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, pgno, eCreate);
+ pcacheTrace(("%p.FETCH %d%s (result: %p) ",pCache,pgno,
+ createFlag?" create":"",pRes));
+ pcachePageTrace(pgno, pRes);
+ return pRes;
+}
+
+/*
+** If the sqlite3PcacheFetch() routine is unable to allocate a new
+** page because no clean pages are available for reuse and the cache
+** size limit has been reached, then this routine can be invoked to
+** try harder to allocate a page. This routine might invoke the stress
+** callback to spill dirty pages to the journal. It will then try to
+** allocate the new page and will only fail to allocate a new page on
+** an OOM error.
+**
+** This routine should be invoked only after sqlite3PcacheFetch() fails.
+*/
+SQLITE_PRIVATE int sqlite3PcacheFetchStress(
+ PCache *pCache, /* Obtain the page from this cache */
+ Pgno pgno, /* Page number to obtain */
+ sqlite3_pcache_page **ppPage /* Write result here */
+){
+ PgHdr *pPg;
+ if( pCache->eCreate==2 ) return 0;
+
+ if( sqlite3PcachePagecount(pCache)>pCache->szSpill ){
+ /* Find a dirty page to write-out and recycle. First try to find a
+ ** page that does not require a journal-sync (one with PGHDR_NEED_SYNC
+ ** cleared), but if that is not possible settle for any other
+ ** unreferenced dirty page.
+ **
+ ** If the LRU page in the dirty list that has a clear PGHDR_NEED_SYNC
+ ** flag is currently referenced, then the following may leave pSynced
+ ** set incorrectly (pointing to other than the LRU page with NEED_SYNC
+ ** cleared). This is Ok, as pSynced is just an optimization. */
+ for(pPg=pCache->pSynced;
+ pPg && (pPg->nRef || (pPg->flags&PGHDR_NEED_SYNC));
+ pPg=pPg->pDirtyPrev
+ );
+ pCache->pSynced = pPg;
+ if( !pPg ){
+ for(pPg=pCache->pDirtyTail; pPg && pPg->nRef; pPg=pPg->pDirtyPrev);
+ }
+ if( pPg ){
+ int rc;
+#ifdef SQLITE_LOG_CACHE_SPILL
+ sqlite3_log(SQLITE_FULL,
+ "spill page %d making room for %d - cache used: %d/%d",
+ pPg->pgno, pgno,
+ sqlite3GlobalConfig.pcache2.xPagecount(pCache->pCache),
+ numberOfCachePages(pCache));
+#endif
+ pcacheTrace(("%p.SPILL %d\n",pCache,pPg->pgno));
+ rc = pCache->xStress(pCache->pStress, pPg);
+ pcacheDump(pCache);
+ if( rc!=SQLITE_OK && rc!=SQLITE_BUSY ){
+ return rc;
+ }
+ }
+ }
+ *ppPage = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, pgno, 2);
+ return *ppPage==0 ? SQLITE_NOMEM_BKPT : SQLITE_OK;
+}
+
+/*
+** This is a helper routine for sqlite3PcacheFetchFinish()
+**
+** In the uncommon case where the page being fetched has not been
+** initialized, this routine is invoked to do the initialization.
+** This routine is broken out into a separate function since it
+** requires extra stack manipulation that can be avoided in the common
+** case.
+*/
+static SQLITE_NOINLINE PgHdr *pcacheFetchFinishWithInit(
+ PCache *pCache, /* Obtain the page from this cache */
+ Pgno pgno, /* Page number obtained */
+ sqlite3_pcache_page *pPage /* Page obtained by prior PcacheFetch() call */
+){
+ PgHdr *pPgHdr;
+ assert( pPage!=0 );
+ pPgHdr = (PgHdr*)pPage->pExtra;
+ assert( pPgHdr->pPage==0 );
+ memset(&pPgHdr->pDirty, 0, sizeof(PgHdr) - offsetof(PgHdr,pDirty));
+ pPgHdr->pPage = pPage;
+ pPgHdr->pData = pPage->pBuf;
+ pPgHdr->pExtra = (void *)&pPgHdr[1];
+ memset(pPgHdr->pExtra, 0, 8);
+ assert( EIGHT_BYTE_ALIGNMENT( pPgHdr->pExtra ) );
+ pPgHdr->pCache = pCache;
+ pPgHdr->pgno = pgno;
+ pPgHdr->flags = PGHDR_CLEAN;
+ return sqlite3PcacheFetchFinish(pCache,pgno,pPage);
+}
+
+/*
+** This routine converts the sqlite3_pcache_page object returned by
+** sqlite3PcacheFetch() into an initialized PgHdr object. This routine
+** must be called after sqlite3PcacheFetch() in order to get a usable
+** result.
+*/
+SQLITE_PRIVATE PgHdr *sqlite3PcacheFetchFinish(
+ PCache *pCache, /* Obtain the page from this cache */
+ Pgno pgno, /* Page number obtained */
+ sqlite3_pcache_page *pPage /* Page obtained by prior PcacheFetch() call */
+){
+ PgHdr *pPgHdr;
+
+ assert( pPage!=0 );
+ pPgHdr = (PgHdr *)pPage->pExtra;
+
+ if( !pPgHdr->pPage ){
+ return pcacheFetchFinishWithInit(pCache, pgno, pPage);
+ }
+ pCache->nRefSum++;
+ pPgHdr->nRef++;
+ assert( sqlite3PcachePageSanity(pPgHdr) );
+ return pPgHdr;
+}
+
+/*
+** Decrement the reference count on a page. If the page is clean and the
+** reference count drops to 0, then it is made eligible for recycling.
+*/
+SQLITE_PRIVATE void SQLITE_NOINLINE sqlite3PcacheRelease(PgHdr *p){
+ assert( p->nRef>0 );
+ p->pCache->nRefSum--;
+ if( (--p->nRef)==0 ){
+ if( p->flags&PGHDR_CLEAN ){
+ pcacheUnpin(p);
+ }else{
+ pcacheManageDirtyList(p, PCACHE_DIRTYLIST_FRONT);
+ assert( sqlite3PcachePageSanity(p) );
+ }
+ }
+}
+
+/*
+** Increase the reference count of a supplied page by 1.
+*/
+SQLITE_PRIVATE void sqlite3PcacheRef(PgHdr *p){
+ assert(p->nRef>0);
+ assert( sqlite3PcachePageSanity(p) );
+ p->nRef++;
+ p->pCache->nRefSum++;
+}
+
+/*
+** Drop a page from the cache. There must be exactly one reference to the
+** page. This function deletes that reference, so after it returns the
+** page pointed to by p is invalid.
+*/
+SQLITE_PRIVATE void sqlite3PcacheDrop(PgHdr *p){
+ assert( p->nRef==1 );
+ assert( sqlite3PcachePageSanity(p) );
+ if( p->flags&PGHDR_DIRTY ){
+ pcacheManageDirtyList(p, PCACHE_DIRTYLIST_REMOVE);
+ }
+ p->pCache->nRefSum--;
+ sqlite3GlobalConfig.pcache2.xUnpin(p->pCache->pCache, p->pPage, 1);
+}
+
+/*
+** Make sure the page is marked as dirty. If it isn't dirty already,
+** make it so.
+*/
+SQLITE_PRIVATE void sqlite3PcacheMakeDirty(PgHdr *p){
+ assert( p->nRef>0 );
+ assert( sqlite3PcachePageSanity(p) );
+ if( p->flags & (PGHDR_CLEAN|PGHDR_DONT_WRITE) ){ /*OPTIMIZATION-IF-FALSE*/
+ p->flags &= ~PGHDR_DONT_WRITE;
+ if( p->flags & PGHDR_CLEAN ){
+ p->flags ^= (PGHDR_DIRTY|PGHDR_CLEAN);
+ pcacheTrace(("%p.DIRTY %d\n",p->pCache,p->pgno));
+ assert( (p->flags & (PGHDR_DIRTY|PGHDR_CLEAN))==PGHDR_DIRTY );
+ pcacheManageDirtyList(p, PCACHE_DIRTYLIST_ADD);
+ assert( sqlite3PcachePageSanity(p) );
+ }
+ assert( sqlite3PcachePageSanity(p) );
+ }
+}
+
+/*
+** Make sure the page is marked as clean. If it isn't clean already,
+** make it so.
+*/
+SQLITE_PRIVATE void sqlite3PcacheMakeClean(PgHdr *p){
+ assert( sqlite3PcachePageSanity(p) );
+ assert( (p->flags & PGHDR_DIRTY)!=0 );
+ assert( (p->flags & PGHDR_CLEAN)==0 );
+ pcacheManageDirtyList(p, PCACHE_DIRTYLIST_REMOVE);
+ p->flags &= ~(PGHDR_DIRTY|PGHDR_NEED_SYNC|PGHDR_WRITEABLE);
+ p->flags |= PGHDR_CLEAN;
+ pcacheTrace(("%p.CLEAN %d\n",p->pCache,p->pgno));
+ assert( sqlite3PcachePageSanity(p) );
+ if( p->nRef==0 ){
+ pcacheUnpin(p);
+ }
+}
+
+/*
+** Make every page in the cache clean.
+*/
+SQLITE_PRIVATE void sqlite3PcacheCleanAll(PCache *pCache){
+ PgHdr *p;
+ pcacheTrace(("%p.CLEAN-ALL\n",pCache));
+ while( (p = pCache->pDirty)!=0 ){
+ sqlite3PcacheMakeClean(p);
+ }
+}
+
+/*
+** Clear the PGHDR_NEED_SYNC and PGHDR_WRITEABLE flag from all dirty pages.
+*/
+SQLITE_PRIVATE void sqlite3PcacheClearWritable(PCache *pCache){
+ PgHdr *p;
+ pcacheTrace(("%p.CLEAR-WRITEABLE\n",pCache));
+ for(p=pCache->pDirty; p; p=p->pDirtyNext){
+ p->flags &= ~(PGHDR_NEED_SYNC|PGHDR_WRITEABLE);
+ }
+ pCache->pSynced = pCache->pDirtyTail;
+}
+
+/*
+** Clear the PGHDR_NEED_SYNC flag from all dirty pages.
+*/
+SQLITE_PRIVATE void sqlite3PcacheClearSyncFlags(PCache *pCache){
+ PgHdr *p;
+ for(p=pCache->pDirty; p; p=p->pDirtyNext){
+ p->flags &= ~PGHDR_NEED_SYNC;
+ }
+ pCache->pSynced = pCache->pDirtyTail;
+}
+
+/*
+** Change the page number of page p to newPgno.
+*/
+SQLITE_PRIVATE void sqlite3PcacheMove(PgHdr *p, Pgno newPgno){
+ PCache *pCache = p->pCache;
+ sqlite3_pcache_page *pOther;
+ assert( p->nRef>0 );
+ assert( newPgno>0 );
+ assert( sqlite3PcachePageSanity(p) );
+ pcacheTrace(("%p.MOVE %d -> %d\n",pCache,p->pgno,newPgno));
+ pOther = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, newPgno, 0);
+ if( pOther ){
+ PgHdr *pXPage = (PgHdr*)pOther->pExtra;
+ assert( pXPage->nRef==0 );
+ pXPage->nRef++;
+ pCache->nRefSum++;
+ sqlite3PcacheDrop(pXPage);
+ }
+ sqlite3GlobalConfig.pcache2.xRekey(pCache->pCache, p->pPage, p->pgno,newPgno);
+ p->pgno = newPgno;
+ if( (p->flags&PGHDR_DIRTY) && (p->flags&PGHDR_NEED_SYNC) ){
+ pcacheManageDirtyList(p, PCACHE_DIRTYLIST_FRONT);
+ assert( sqlite3PcachePageSanity(p) );
+ }
+}
+
+/*
+** Drop every cache entry whose page number is greater than "pgno". The
+** caller must ensure that there are no outstanding references to any pages
+** other than page 1 with a page number greater than pgno.
+**
+** If there is a reference to page 1 and the pgno parameter passed to this
+** function is 0, then the data area associated with page 1 is zeroed, but
+** the page object is not dropped.
+*/
+SQLITE_PRIVATE void sqlite3PcacheTruncate(PCache *pCache, Pgno pgno){
+ if( pCache->pCache ){
+ PgHdr *p;
+ PgHdr *pNext;
+ pcacheTrace(("%p.TRUNCATE %d\n",pCache,pgno));
+ for(p=pCache->pDirty; p; p=pNext){
+ pNext = p->pDirtyNext;
+ /* This routine never gets call with a positive pgno except right
+ ** after sqlite3PcacheCleanAll(). So if there are dirty pages,
+ ** it must be that pgno==0.
+ */
+ assert( p->pgno>0 );
+ if( p->pgno>pgno ){
+ assert( p->flags&PGHDR_DIRTY );
+ sqlite3PcacheMakeClean(p);
+ }
+ }
+ if( pgno==0 && pCache->nRefSum ){
+ sqlite3_pcache_page *pPage1;
+ pPage1 = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache,1,0);
+ if( ALWAYS(pPage1) ){ /* Page 1 is always available in cache, because
+ ** pCache->nRefSum>0 */
+ memset(pPage1->pBuf, 0, pCache->szPage);
+ pgno = 1;
+ }
+ }
+ sqlite3GlobalConfig.pcache2.xTruncate(pCache->pCache, pgno+1);
+ }
+}
+
+/*
+** Close a cache.
+*/
+SQLITE_PRIVATE void sqlite3PcacheClose(PCache *pCache){
+ assert( pCache->pCache!=0 );
+ pcacheTrace(("%p.CLOSE\n",pCache));
+ sqlite3GlobalConfig.pcache2.xDestroy(pCache->pCache);
+}
+
+/*
+** Discard the contents of the cache.
+*/
+SQLITE_PRIVATE void sqlite3PcacheClear(PCache *pCache){
+ sqlite3PcacheTruncate(pCache, 0);
+}
+
+/*
+** Merge two lists of pages connected by pDirty and in pgno order.
+** Do not bother fixing the pDirtyPrev pointers.
+*/
+static PgHdr *pcacheMergeDirtyList(PgHdr *pA, PgHdr *pB){
+ PgHdr result, *pTail;
+ pTail = &result;
+ assert( pA!=0 && pB!=0 );
+ for(;;){
+ if( pA->pgno<pB->pgno ){
+ pTail->pDirty = pA;
+ pTail = pA;
+ pA = pA->pDirty;
+ if( pA==0 ){
+ pTail->pDirty = pB;
+ break;
+ }
+ }else{
+ pTail->pDirty = pB;
+ pTail = pB;
+ pB = pB->pDirty;
+ if( pB==0 ){
+ pTail->pDirty = pA;
+ break;
+ }
+ }
+ }
+ return result.pDirty;
+}
+
+/*
+** Sort the list of pages in ascending order by pgno. Pages are
+** connected by pDirty pointers. The pDirtyPrev pointers are
+** corrupted by this sort.
+**
+** Since there cannot be more than 2^31 distinct pages in a database,
+** there cannot be more than 31 buckets required by the merge sorter.
+** One extra bucket is added to catch overflow in case something
+** ever changes to make the previous sentence incorrect.
+*/
+#define N_SORT_BUCKET 32
+static PgHdr *pcacheSortDirtyList(PgHdr *pIn){
+ PgHdr *a[N_SORT_BUCKET], *p;
+ int i;
+ memset(a, 0, sizeof(a));
+ while( pIn ){
+ p = pIn;
+ pIn = p->pDirty;
+ p->pDirty = 0;
+ for(i=0; ALWAYS(i<N_SORT_BUCKET-1); i++){
+ if( a[i]==0 ){
+ a[i] = p;
+ break;
+ }else{
+ p = pcacheMergeDirtyList(a[i], p);
+ a[i] = 0;
+ }
+ }
+ if( NEVER(i==N_SORT_BUCKET-1) ){
+ /* To get here, there need to be 2^(N_SORT_BUCKET) elements in
+ ** the input list. But that is impossible.
+ */
+ a[i] = pcacheMergeDirtyList(a[i], p);
+ }
+ }
+ p = a[0];
+ for(i=1; i<N_SORT_BUCKET; i++){
+ if( a[i]==0 ) continue;
+ p = p ? pcacheMergeDirtyList(p, a[i]) : a[i];
+ }
+ return p;
+}
+
+/*
+** Return a list of all dirty pages in the cache, sorted by page number.
+*/
+SQLITE_PRIVATE PgHdr *sqlite3PcacheDirtyList(PCache *pCache){
+ PgHdr *p;
+ for(p=pCache->pDirty; p; p=p->pDirtyNext){
+ p->pDirty = p->pDirtyNext;
+ }
+ return pcacheSortDirtyList(pCache->pDirty);
+}
+
+/*
+** Return the total number of references to all pages held by the cache.
+**
+** This is not the total number of pages referenced, but the sum of the
+** reference count for all pages.
+*/
+SQLITE_PRIVATE i64 sqlite3PcacheRefCount(PCache *pCache){
+ return pCache->nRefSum;
+}
+
+/*
+** Return the number of references to the page supplied as an argument.
+*/
+SQLITE_PRIVATE i64 sqlite3PcachePageRefcount(PgHdr *p){
+ return p->nRef;
+}
+
+/*
+** Return the total number of pages in the cache.
+*/
+SQLITE_PRIVATE int sqlite3PcachePagecount(PCache *pCache){
+ assert( pCache->pCache!=0 );
+ return sqlite3GlobalConfig.pcache2.xPagecount(pCache->pCache);
+}
+
+#ifdef SQLITE_TEST
+/*
+** Get the suggested cache-size value.
+*/
+SQLITE_PRIVATE int sqlite3PcacheGetCachesize(PCache *pCache){
+ return numberOfCachePages(pCache);
+}
+#endif
+
+/*
+** Set the suggested cache-size value.
+*/
+SQLITE_PRIVATE void sqlite3PcacheSetCachesize(PCache *pCache, int mxPage){
+ assert( pCache->pCache!=0 );
+ pCache->szCache = mxPage;
+ sqlite3GlobalConfig.pcache2.xCachesize(pCache->pCache,
+ numberOfCachePages(pCache));
+}
+
+/*
+** Set the suggested cache-spill value. Make no changes if if the
+** argument is zero. Return the effective cache-spill size, which will
+** be the larger of the szSpill and szCache.
+*/
+SQLITE_PRIVATE int sqlite3PcacheSetSpillsize(PCache *p, int mxPage){
+ int res;
+ assert( p->pCache!=0 );
+ if( mxPage ){
+ if( mxPage<0 ){
+ mxPage = (int)((-1024*(i64)mxPage)/(p->szPage+p->szExtra));
+ }
+ p->szSpill = mxPage;
+ }
+ res = numberOfCachePages(p);
+ if( res<p->szSpill ) res = p->szSpill;
+ return res;
+}
+
+/*
+** Free up as much memory as possible from the page cache.
+*/
+SQLITE_PRIVATE void sqlite3PcacheShrink(PCache *pCache){
+ assert( pCache->pCache!=0 );
+ sqlite3GlobalConfig.pcache2.xShrink(pCache->pCache);
+}
+
+/*
+** Return the size of the header added by this middleware layer
+** in the page-cache hierarchy.
+*/
+SQLITE_PRIVATE int sqlite3HeaderSizePcache(void){ return ROUND8(sizeof(PgHdr)); }
+
+/*
+** Return the number of dirty pages currently in the cache, as a percentage
+** of the configured cache size.
+*/
+SQLITE_PRIVATE int sqlite3PCachePercentDirty(PCache *pCache){
+ PgHdr *pDirty;
+ int nDirty = 0;
+ int nCache = numberOfCachePages(pCache);
+ for(pDirty=pCache->pDirty; pDirty; pDirty=pDirty->pDirtyNext) nDirty++;
+ return nCache ? (int)(((i64)nDirty * 100) / nCache) : 0;
+}
+
+#ifdef SQLITE_DIRECT_OVERFLOW_READ
+/*
+** Return true if there are one or more dirty pages in the cache. Else false.
+*/
+SQLITE_PRIVATE int sqlite3PCacheIsDirty(PCache *pCache){
+ return (pCache->pDirty!=0);
+}
+#endif
+
+#if defined(SQLITE_CHECK_PAGES) || defined(SQLITE_DEBUG)
+/*
+** For all dirty pages currently in the cache, invoke the specified
+** callback. This is only used if the SQLITE_CHECK_PAGES macro is
+** defined.
+*/
+SQLITE_PRIVATE void sqlite3PcacheIterateDirty(PCache *pCache, void (*xIter)(PgHdr *)){
+ PgHdr *pDirty;
+ for(pDirty=pCache->pDirty; pDirty; pDirty=pDirty->pDirtyNext){
+ xIter(pDirty);
+ }
+}
+#endif
+
+/************** End of pcache.c **********************************************/
+/************** Begin file pcache1.c *****************************************/
+/*
+** 2008 November 05
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+**
+** This file implements the default page cache implementation (the
+** sqlite3_pcache interface). It also contains part of the implementation
+** of the SQLITE_CONFIG_PAGECACHE and sqlite3_release_memory() features.
+** If the default page cache implementation is overridden, then neither of
+** these two features are available.
+**
+** A Page cache line looks like this:
+**
+** -------------------------------------------------------------
+** | database page content | PgHdr1 | MemPage | PgHdr |
+** -------------------------------------------------------------
+**
+** The database page content is up front (so that buffer overreads tend to
+** flow harmlessly into the PgHdr1, MemPage, and PgHdr extensions). MemPage
+** is the extension added by the btree.c module containing information such
+** as the database page number and how that database page is used. PgHdr
+** is added by the pcache.c layer and contains information used to keep track
+** of which pages are "dirty". PgHdr1 is an extension added by this
+** module (pcache1.c). The PgHdr1 header is a subclass of sqlite3_pcache_page.
+** PgHdr1 contains information needed to look up a page by its page number.
+** The superclass sqlite3_pcache_page.pBuf points to the start of the
+** database page content and sqlite3_pcache_page.pExtra points to PgHdr.
+**
+** The size of the extension (MemPage+PgHdr+PgHdr1) can be determined at
+** runtime using sqlite3_config(SQLITE_CONFIG_PCACHE_HDRSZ, &size). The
+** sizes of the extensions sum to 272 bytes on x64 for 3.8.10, but this
+** size can vary according to architecture, compile-time options, and
+** SQLite library version number.
+**
+** Historical note: It used to be that if the SQLITE_PCACHE_SEPARATE_HEADER
+** was defined, then the page content would be held in a separate memory
+** allocation from the PgHdr1. This was intended to avoid clownshoe memory
+** allocations. However, the btree layer needs a small (16-byte) overrun
+** area after the page content buffer. The header serves as that overrun
+** area. Therefore SQLITE_PCACHE_SEPARATE_HEADER was discontinued to avoid
+** any possibility of a memory error.
+**
+** This module tracks pointers to PgHdr1 objects. Only pcache.c communicates
+** with this module. Information is passed back and forth as PgHdr1 pointers.
+**
+** The pcache.c and pager.c modules deal pointers to PgHdr objects.
+** The btree.c module deals with pointers to MemPage objects.
+**
+** SOURCE OF PAGE CACHE MEMORY:
+**
+** Memory for a page might come from any of three sources:
+**
+** (1) The general-purpose memory allocator - sqlite3Malloc()
+** (2) Global page-cache memory provided using sqlite3_config() with
+** SQLITE_CONFIG_PAGECACHE.
+** (3) PCache-local bulk allocation.
+**
+** The third case is a chunk of heap memory (defaulting to 100 pages worth)
+** that is allocated when the page cache is created. The size of the local
+** bulk allocation can be adjusted using
+**
+** sqlite3_config(SQLITE_CONFIG_PAGECACHE, (void*)0, 0, N).
+**
+** If N is positive, then N pages worth of memory are allocated using a single
+** sqlite3Malloc() call and that memory is used for the first N pages allocated.
+** Or if N is negative, then -1024*N bytes of memory are allocated and used
+** for as many pages as can be accommodated.
+**
+** Only one of (2) or (3) can be used. Once the memory available to (2) or
+** (3) is exhausted, subsequent allocations fail over to the general-purpose
+** memory allocator (1).
+**
+** Earlier versions of SQLite used only methods (1) and (2). But experiments
+** show that method (3) with N==100 provides about a 5% performance boost for
+** common workloads.
+*/
+/* #include "sqliteInt.h" */
+
+typedef struct PCache1 PCache1;
+typedef struct PgHdr1 PgHdr1;
+typedef struct PgFreeslot PgFreeslot;
+typedef struct PGroup PGroup;
+
+/*
+** Each cache entry is represented by an instance of the following
+** structure. A buffer of PgHdr1.pCache->szPage bytes is allocated
+** directly before this structure and is used to cache the page content.
+**
+** When reading a corrupt database file, it is possible that SQLite might
+** read a few bytes (no more than 16 bytes) past the end of the page buffer.
+** It will only read past the end of the page buffer, never write. This
+** object is positioned immediately after the page buffer to serve as an
+** overrun area, so that overreads are harmless.
+**
+** Variables isBulkLocal and isAnchor were once type "u8". That works,
+** but causes a 2-byte gap in the structure for most architectures (since
+** pointers must be either 4 or 8-byte aligned). As this structure is located
+** in memory directly after the associated page data, if the database is
+** corrupt, code at the b-tree layer may overread the page buffer and
+** read part of this structure before the corruption is detected. This
+** can cause a valgrind error if the uninitialized gap is accessed. Using u16
+** ensures there is no such gap, and therefore no bytes of uninitialized
+** memory in the structure.
+**
+** The pLruNext and pLruPrev pointers form a double-linked circular list
+** of all pages that are unpinned. The PGroup.lru element (which should be
+** the only element on the list with PgHdr1.isAnchor set to 1) forms the
+** beginning and the end of the list.
+*/
+struct PgHdr1 {
+ sqlite3_pcache_page page; /* Base class. Must be first. pBuf & pExtra */
+ unsigned int iKey; /* Key value (page number) */
+ u16 isBulkLocal; /* This page from bulk local storage */
+ u16 isAnchor; /* This is the PGroup.lru element */
+ PgHdr1 *pNext; /* Next in hash table chain */
+ PCache1 *pCache; /* Cache that currently owns this page */
+ PgHdr1 *pLruNext; /* Next in circular LRU list of unpinned pages */
+ PgHdr1 *pLruPrev; /* Previous in LRU list of unpinned pages */
+ /* NB: pLruPrev is only valid if pLruNext!=0 */
+};
+
+/*
+** A page is pinned if it is not on the LRU list. To be "pinned" means
+** that the page is in active use and must not be deallocated.
+*/
+#define PAGE_IS_PINNED(p) ((p)->pLruNext==0)
+#define PAGE_IS_UNPINNED(p) ((p)->pLruNext!=0)
+
+/* Each page cache (or PCache) belongs to a PGroup. A PGroup is a set
+** of one or more PCaches that are able to recycle each other's unpinned
+** pages when they are under memory pressure. A PGroup is an instance of
+** the following object.
+**
+** This page cache implementation works in one of two modes:
+**
+** (1) Every PCache is the sole member of its own PGroup. There is
+** one PGroup per PCache.
+**
+** (2) There is a single global PGroup that all PCaches are a member
+** of.
+**
+** Mode 1 uses more memory (since PCache instances are not able to rob
+** unused pages from other PCaches) but it also operates without a mutex,
+** and is therefore often faster. Mode 2 requires a mutex in order to be
+** threadsafe, but recycles pages more efficiently.
+**
+** For mode (1), PGroup.mutex is NULL. For mode (2) there is only a single
+** PGroup which is the pcache1.grp global variable and its mutex is
+** SQLITE_MUTEX_STATIC_LRU.
+*/
+struct PGroup {
+ sqlite3_mutex *mutex; /* MUTEX_STATIC_LRU or NULL */
+ unsigned int nMaxPage; /* Sum of nMax for purgeable caches */
+ unsigned int nMinPage; /* Sum of nMin for purgeable caches */
+ unsigned int mxPinned; /* nMaxpage + 10 - nMinPage */
+ unsigned int nPurgeable; /* Number of purgeable pages allocated */
+ PgHdr1 lru; /* The beginning and end of the LRU list */
+};
+
+/* Each page cache is an instance of the following object. Every
+** open database file (including each in-memory database and each
+** temporary or transient database) has a single page cache which
+** is an instance of this object.
+**
+** Pointers to structures of this type are cast and returned as
+** opaque sqlite3_pcache* handles.
+*/
+struct PCache1 {
+ /* Cache configuration parameters. Page size (szPage) and the purgeable
+ ** flag (bPurgeable) and the pnPurgeable pointer are all set when the
+ ** cache is created and are never changed thereafter. nMax may be
+ ** modified at any time by a call to the pcache1Cachesize() method.
+ ** The PGroup mutex must be held when accessing nMax.
+ */
+ PGroup *pGroup; /* PGroup this cache belongs to */
+ unsigned int *pnPurgeable; /* Pointer to pGroup->nPurgeable */
+ int szPage; /* Size of database content section */
+ int szExtra; /* sizeof(MemPage)+sizeof(PgHdr) */
+ int szAlloc; /* Total size of one pcache line */
+ int bPurgeable; /* True if cache is purgeable */
+ unsigned int nMin; /* Minimum number of pages reserved */
+ unsigned int nMax; /* Configured "cache_size" value */
+ unsigned int n90pct; /* nMax*9/10 */
+ unsigned int iMaxKey; /* Largest key seen since xTruncate() */
+ unsigned int nPurgeableDummy; /* pnPurgeable points here when not used*/
+
+ /* Hash table of all pages. The following variables may only be accessed
+ ** when the accessor is holding the PGroup mutex.
+ */
+ unsigned int nRecyclable; /* Number of pages in the LRU list */
+ unsigned int nPage; /* Total number of pages in apHash */
+ unsigned int nHash; /* Number of slots in apHash[] */
+ PgHdr1 **apHash; /* Hash table for fast lookup by key */
+ PgHdr1 *pFree; /* List of unused pcache-local pages */
+ void *pBulk; /* Bulk memory used by pcache-local */
+};
+
+/*
+** Free slots in the allocator used to divide up the global page cache
+** buffer provided using the SQLITE_CONFIG_PAGECACHE mechanism.
+*/
+struct PgFreeslot {
+ PgFreeslot *pNext; /* Next free slot */
+};
+
+/*
+** Global data used by this cache.
+*/
+static SQLITE_WSD struct PCacheGlobal {
+ PGroup grp; /* The global PGroup for mode (2) */
+
+ /* Variables related to SQLITE_CONFIG_PAGECACHE settings. The
+ ** szSlot, nSlot, pStart, pEnd, nReserve, and isInit values are all
+ ** fixed at sqlite3_initialize() time and do not require mutex protection.
+ ** The nFreeSlot and pFree values do require mutex protection.
+ */
+ int isInit; /* True if initialized */
+ int separateCache; /* Use a new PGroup for each PCache */
+ int nInitPage; /* Initial bulk allocation size */
+ int szSlot; /* Size of each free slot */
+ int nSlot; /* The number of pcache slots */
+ int nReserve; /* Try to keep nFreeSlot above this */
+ void *pStart, *pEnd; /* Bounds of global page cache memory */
+ /* Above requires no mutex. Use mutex below for variable that follow. */
+ sqlite3_mutex *mutex; /* Mutex for accessing the following: */
+ PgFreeslot *pFree; /* Free page blocks */
+ int nFreeSlot; /* Number of unused pcache slots */
+ /* The following value requires a mutex to change. We skip the mutex on
+ ** reading because (1) most platforms read a 32-bit integer atomically and
+ ** (2) even if an incorrect value is read, no great harm is done since this
+ ** is really just an optimization. */
+ int bUnderPressure; /* True if low on PAGECACHE memory */
+} pcache1_g;
+
+/*
+** All code in this file should access the global structure above via the
+** alias "pcache1". This ensures that the WSD emulation is used when
+** compiling for systems that do not support real WSD.
+*/
+#define pcache1 (GLOBAL(struct PCacheGlobal, pcache1_g))
+
+/*
+** Macros to enter and leave the PCache LRU mutex.
+*/
+#if !defined(SQLITE_ENABLE_MEMORY_MANAGEMENT) || SQLITE_THREADSAFE==0
+# define pcache1EnterMutex(X) assert((X)->mutex==0)
+# define pcache1LeaveMutex(X) assert((X)->mutex==0)
+# define PCACHE1_MIGHT_USE_GROUP_MUTEX 0
+#else
+# define pcache1EnterMutex(X) sqlite3_mutex_enter((X)->mutex)
+# define pcache1LeaveMutex(X) sqlite3_mutex_leave((X)->mutex)
+# define PCACHE1_MIGHT_USE_GROUP_MUTEX 1
+#endif
+
+/******************************************************************************/
+/******** Page Allocation/SQLITE_CONFIG_PCACHE Related Functions **************/
+
+
+/*
+** This function is called during initialization if a static buffer is
+** supplied to use for the page-cache by passing the SQLITE_CONFIG_PAGECACHE
+** verb to sqlite3_config(). Parameter pBuf points to an allocation large
+** enough to contain 'n' buffers of 'sz' bytes each.
+**
+** This routine is called from sqlite3_initialize() and so it is guaranteed
+** to be serialized already. There is no need for further mutexing.
+*/
+SQLITE_PRIVATE void sqlite3PCacheBufferSetup(void *pBuf, int sz, int n){
+ if( pcache1.isInit ){
+ PgFreeslot *p;
+ if( pBuf==0 ) sz = n = 0;
+ if( n==0 ) sz = 0;
+ sz = ROUNDDOWN8(sz);
+ pcache1.szSlot = sz;
+ pcache1.nSlot = pcache1.nFreeSlot = n;
+ pcache1.nReserve = n>90 ? 10 : (n/10 + 1);
+ pcache1.pStart = pBuf;
+ pcache1.pFree = 0;
+ pcache1.bUnderPressure = 0;
+ while( n-- ){
+ p = (PgFreeslot*)pBuf;
+ p->pNext = pcache1.pFree;
+ pcache1.pFree = p;
+ pBuf = (void*)&((char*)pBuf)[sz];
+ }
+ pcache1.pEnd = pBuf;
+ }
+}
+
+/*
+** Try to initialize the pCache->pFree and pCache->pBulk fields. Return
+** true if pCache->pFree ends up containing one or more free pages.
+*/
+static int pcache1InitBulk(PCache1 *pCache){
+ i64 szBulk;
+ char *zBulk;
+ if( pcache1.nInitPage==0 ) return 0;
+ /* Do not bother with a bulk allocation if the cache size very small */
+ if( pCache->nMax<3 ) return 0;
+ sqlite3BeginBenignMalloc();
+ if( pcache1.nInitPage>0 ){
+ szBulk = pCache->szAlloc * (i64)pcache1.nInitPage;
+ }else{
+ szBulk = -1024 * (i64)pcache1.nInitPage;
+ }
+ if( szBulk > pCache->szAlloc*(i64)pCache->nMax ){
+ szBulk = pCache->szAlloc*(i64)pCache->nMax;
+ }
+ zBulk = pCache->pBulk = sqlite3Malloc( szBulk );
+ sqlite3EndBenignMalloc();
+ if( zBulk ){
+ int nBulk = sqlite3MallocSize(zBulk)/pCache->szAlloc;
+ do{
+ PgHdr1 *pX = (PgHdr1*)&zBulk[pCache->szPage];
+ pX->page.pBuf = zBulk;
+ pX->page.pExtra = (u8*)pX + ROUND8(sizeof(*pX));
+ assert( EIGHT_BYTE_ALIGNMENT( pX->page.pExtra ) );
+ pX->isBulkLocal = 1;
+ pX->isAnchor = 0;
+ pX->pNext = pCache->pFree;
+ pX->pLruPrev = 0; /* Initializing this saves a valgrind error */
+ pCache->pFree = pX;
+ zBulk += pCache->szAlloc;
+ }while( --nBulk );
+ }
+ return pCache->pFree!=0;
+}
+
+/*
+** Malloc function used within this file to allocate space from the buffer
+** configured using sqlite3_config(SQLITE_CONFIG_PAGECACHE) option. If no
+** such buffer exists or there is no space left in it, this function falls
+** back to sqlite3Malloc().
+**
+** Multiple threads can run this routine at the same time. Global variables
+** in pcache1 need to be protected via mutex.
+*/
+static void *pcache1Alloc(int nByte){
+ void *p = 0;
+ assert( sqlite3_mutex_notheld(pcache1.grp.mutex) );
+ if( nByte<=pcache1.szSlot ){
+ sqlite3_mutex_enter(pcache1.mutex);
+ p = (PgHdr1 *)pcache1.pFree;
+ if( p ){
+ pcache1.pFree = pcache1.pFree->pNext;
+ pcache1.nFreeSlot--;
+ pcache1.bUnderPressure = pcache1.nFreeSlot<pcache1.nReserve;
+ assert( pcache1.nFreeSlot>=0 );
+ sqlite3StatusHighwater(SQLITE_STATUS_PAGECACHE_SIZE, nByte);
+ sqlite3StatusUp(SQLITE_STATUS_PAGECACHE_USED, 1);
+ }
+ sqlite3_mutex_leave(pcache1.mutex);
+ }
+ if( p==0 ){
+ /* Memory is not available in the SQLITE_CONFIG_PAGECACHE pool. Get
+ ** it from sqlite3Malloc instead.
+ */
+ p = sqlite3Malloc(nByte);
+#ifndef SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS
+ if( p ){
+ int sz = sqlite3MallocSize(p);
+ sqlite3_mutex_enter(pcache1.mutex);
+ sqlite3StatusHighwater(SQLITE_STATUS_PAGECACHE_SIZE, nByte);
+ sqlite3StatusUp(SQLITE_STATUS_PAGECACHE_OVERFLOW, sz);
+ sqlite3_mutex_leave(pcache1.mutex);
+ }
+#endif
+ sqlite3MemdebugSetType(p, MEMTYPE_PCACHE);
+ }
+ return p;
+}
+
+/*
+** Free an allocated buffer obtained from pcache1Alloc().
+*/
+static void pcache1Free(void *p){
+ if( p==0 ) return;
+ if( SQLITE_WITHIN(p, pcache1.pStart, pcache1.pEnd) ){
+ PgFreeslot *pSlot;
+ sqlite3_mutex_enter(pcache1.mutex);
+ sqlite3StatusDown(SQLITE_STATUS_PAGECACHE_USED, 1);
+ pSlot = (PgFreeslot*)p;
+ pSlot->pNext = pcache1.pFree;
+ pcache1.pFree = pSlot;
+ pcache1.nFreeSlot++;
+ pcache1.bUnderPressure = pcache1.nFreeSlot<pcache1.nReserve;
+ assert( pcache1.nFreeSlot<=pcache1.nSlot );
+ sqlite3_mutex_leave(pcache1.mutex);
+ }else{
+ assert( sqlite3MemdebugHasType(p, MEMTYPE_PCACHE) );
+ sqlite3MemdebugSetType(p, MEMTYPE_HEAP);
+#ifndef SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS
+ {
+ int nFreed = 0;
+ nFreed = sqlite3MallocSize(p);
+ sqlite3_mutex_enter(pcache1.mutex);
+ sqlite3StatusDown(SQLITE_STATUS_PAGECACHE_OVERFLOW, nFreed);
+ sqlite3_mutex_leave(pcache1.mutex);
+ }
+#endif
+ sqlite3_free(p);
+ }
+}
+
+#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
+/*
+** Return the size of a pcache allocation
+*/
+static int pcache1MemSize(void *p){
+ if( p>=pcache1.pStart && p<pcache1.pEnd ){
+ return pcache1.szSlot;
+ }else{
+ int iSize;
+ assert( sqlite3MemdebugHasType(p, MEMTYPE_PCACHE) );
+ sqlite3MemdebugSetType(p, MEMTYPE_HEAP);
+ iSize = sqlite3MallocSize(p);
+ sqlite3MemdebugSetType(p, MEMTYPE_PCACHE);
+ return iSize;
+ }
+}
+#endif /* SQLITE_ENABLE_MEMORY_MANAGEMENT */
+
+/*
+** Allocate a new page object initially associated with cache pCache.
+*/
+static PgHdr1 *pcache1AllocPage(PCache1 *pCache, int benignMalloc){
+ PgHdr1 *p = 0;
+ void *pPg;
+
+ assert( sqlite3_mutex_held(pCache->pGroup->mutex) );
+ if( pCache->pFree || (pCache->nPage==0 && pcache1InitBulk(pCache)) ){
+ assert( pCache->pFree!=0 );
+ p = pCache->pFree;
+ pCache->pFree = p->pNext;
+ p->pNext = 0;
+ }else{
+#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
+ /* The group mutex must be released before pcache1Alloc() is called. This
+ ** is because it might call sqlite3_release_memory(), which assumes that
+ ** this mutex is not held. */
+ assert( pcache1.separateCache==0 );
+ assert( pCache->pGroup==&pcache1.grp );
+ pcache1LeaveMutex(pCache->pGroup);
+#endif
+ if( benignMalloc ){ sqlite3BeginBenignMalloc(); }
+ pPg = pcache1Alloc(pCache->szAlloc);
+ if( benignMalloc ){ sqlite3EndBenignMalloc(); }
+#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
+ pcache1EnterMutex(pCache->pGroup);
+#endif
+ if( pPg==0 ) return 0;
+ p = (PgHdr1 *)&((u8 *)pPg)[pCache->szPage];
+ p->page.pBuf = pPg;
+ p->page.pExtra = (u8*)p + ROUND8(sizeof(*p));
+ assert( EIGHT_BYTE_ALIGNMENT( p->page.pExtra ) );
+ p->isBulkLocal = 0;
+ p->isAnchor = 0;
+ p->pLruPrev = 0; /* Initializing this saves a valgrind error */
+ }
+ (*pCache->pnPurgeable)++;
+ return p;
+}
+
+/*
+** Free a page object allocated by pcache1AllocPage().
+*/
+static void pcache1FreePage(PgHdr1 *p){
+ PCache1 *pCache;
+ assert( p!=0 );
+ pCache = p->pCache;
+ assert( sqlite3_mutex_held(p->pCache->pGroup->mutex) );
+ if( p->isBulkLocal ){
+ p->pNext = pCache->pFree;
+ pCache->pFree = p;
+ }else{
+ pcache1Free(p->page.pBuf);
+ }
+ (*pCache->pnPurgeable)--;
+}
+
+/*
+** Malloc function used by SQLite to obtain space from the buffer configured
+** using sqlite3_config(SQLITE_CONFIG_PAGECACHE) option. If no such buffer
+** exists, this function falls back to sqlite3Malloc().
+*/
+SQLITE_PRIVATE void *sqlite3PageMalloc(int sz){
+ assert( sz<=65536+8 ); /* These allocations are never very large */
+ return pcache1Alloc(sz);
+}
+
+/*
+** Free an allocated buffer obtained from sqlite3PageMalloc().
+*/
+SQLITE_PRIVATE void sqlite3PageFree(void *p){
+ pcache1Free(p);
+}
+
+
+/*
+** Return true if it desirable to avoid allocating a new page cache
+** entry.
+**
+** If memory was allocated specifically to the page cache using
+** SQLITE_CONFIG_PAGECACHE but that memory has all been used, then
+** it is desirable to avoid allocating a new page cache entry because
+** presumably SQLITE_CONFIG_PAGECACHE was suppose to be sufficient
+** for all page cache needs and we should not need to spill the
+** allocation onto the heap.
+**
+** Or, the heap is used for all page cache memory but the heap is
+** under memory pressure, then again it is desirable to avoid
+** allocating a new page cache entry in order to avoid stressing
+** the heap even further.
+*/
+static int pcache1UnderMemoryPressure(PCache1 *pCache){
+ if( pcache1.nSlot && (pCache->szPage+pCache->szExtra)<=pcache1.szSlot ){
+ return pcache1.bUnderPressure;
+ }else{
+ return sqlite3HeapNearlyFull();
+ }
+}
+
+/******************************************************************************/
+/******** General Implementation Functions ************************************/
+
+/*
+** This function is used to resize the hash table used by the cache passed
+** as the first argument.
+**
+** The PCache mutex must be held when this function is called.
+*/
+static void pcache1ResizeHash(PCache1 *p){
+ PgHdr1 **apNew;
+ unsigned int nNew;
+ unsigned int i;
+
+ assert( sqlite3_mutex_held(p->pGroup->mutex) );
+
+ nNew = p->nHash*2;
+ if( nNew<256 ){
+ nNew = 256;
+ }
+
+ pcache1LeaveMutex(p->pGroup);
+ if( p->nHash ){ sqlite3BeginBenignMalloc(); }
+ apNew = (PgHdr1 **)sqlite3MallocZero(sizeof(PgHdr1 *)*nNew);
+ if( p->nHash ){ sqlite3EndBenignMalloc(); }
+ pcache1EnterMutex(p->pGroup);
+ if( apNew ){
+ for(i=0; i<p->nHash; i++){
+ PgHdr1 *pPage;
+ PgHdr1 *pNext = p->apHash[i];
+ while( (pPage = pNext)!=0 ){
+ unsigned int h = pPage->iKey % nNew;
+ pNext = pPage->pNext;
+ pPage->pNext = apNew[h];
+ apNew[h] = pPage;
+ }
+ }
+ sqlite3_free(p->apHash);
+ p->apHash = apNew;
+ p->nHash = nNew;
+ }
+}
+
+/*
+** This function is used internally to remove the page pPage from the
+** PGroup LRU list, if is part of it. If pPage is not part of the PGroup
+** LRU list, then this function is a no-op.
+**
+** The PGroup mutex must be held when this function is called.
+*/
+static PgHdr1 *pcache1PinPage(PgHdr1 *pPage){
+ assert( pPage!=0 );
+ assert( PAGE_IS_UNPINNED(pPage) );
+ assert( pPage->pLruNext );
+ assert( pPage->pLruPrev );
+ assert( sqlite3_mutex_held(pPage->pCache->pGroup->mutex) );
+ pPage->pLruPrev->pLruNext = pPage->pLruNext;
+ pPage->pLruNext->pLruPrev = pPage->pLruPrev;
+ pPage->pLruNext = 0;
+ /* pPage->pLruPrev = 0;
+ ** No need to clear pLruPrev as it is never accessed if pLruNext is 0 */
+ assert( pPage->isAnchor==0 );
+ assert( pPage->pCache->pGroup->lru.isAnchor==1 );
+ pPage->pCache->nRecyclable--;
+ return pPage;
+}
+
+
+/*
+** Remove the page supplied as an argument from the hash table
+** (PCache1.apHash structure) that it is currently stored in.
+** Also free the page if freePage is true.
+**
+** The PGroup mutex must be held when this function is called.
+*/
+static void pcache1RemoveFromHash(PgHdr1 *pPage, int freeFlag){
+ unsigned int h;
+ PCache1 *pCache = pPage->pCache;
+ PgHdr1 **pp;
+
+ assert( sqlite3_mutex_held(pCache->pGroup->mutex) );
+ h = pPage->iKey % pCache->nHash;
+ for(pp=&pCache->apHash[h]; (*pp)!=pPage; pp=&(*pp)->pNext);
+ *pp = (*pp)->pNext;
+
+ pCache->nPage--;
+ if( freeFlag ) pcache1FreePage(pPage);
+}
+
+/*
+** If there are currently more than nMaxPage pages allocated, try
+** to recycle pages to reduce the number allocated to nMaxPage.
+*/
+static void pcache1EnforceMaxPage(PCache1 *pCache){
+ PGroup *pGroup = pCache->pGroup;
+ PgHdr1 *p;
+ assert( sqlite3_mutex_held(pGroup->mutex) );
+ while( pGroup->nPurgeable>pGroup->nMaxPage
+ && (p=pGroup->lru.pLruPrev)->isAnchor==0
+ ){
+ assert( p->pCache->pGroup==pGroup );
+ assert( PAGE_IS_UNPINNED(p) );
+ pcache1PinPage(p);
+ pcache1RemoveFromHash(p, 1);
+ }
+ if( pCache->nPage==0 && pCache->pBulk ){
+ sqlite3_free(pCache->pBulk);
+ pCache->pBulk = pCache->pFree = 0;
+ }
+}
+
+/*
+** Discard all pages from cache pCache with a page number (key value)
+** greater than or equal to iLimit. Any pinned pages that meet this
+** criteria are unpinned before they are discarded.
+**
+** The PCache mutex must be held when this function is called.
+*/
+static void pcache1TruncateUnsafe(
+ PCache1 *pCache, /* The cache to truncate */
+ unsigned int iLimit /* Drop pages with this pgno or larger */
+){
+ TESTONLY( int nPage = 0; ) /* To assert pCache->nPage is correct */
+ unsigned int h, iStop;
+ assert( sqlite3_mutex_held(pCache->pGroup->mutex) );
+ assert( pCache->iMaxKey >= iLimit );
+ assert( pCache->nHash > 0 );
+ if( pCache->iMaxKey - iLimit < pCache->nHash ){
+ /* If we are just shaving the last few pages off the end of the
+ ** cache, then there is no point in scanning the entire hash table.
+ ** Only scan those hash slots that might contain pages that need to
+ ** be removed. */
+ h = iLimit % pCache->nHash;
+ iStop = pCache->iMaxKey % pCache->nHash;
+ TESTONLY( nPage = -10; ) /* Disable the pCache->nPage validity check */
+ }else{
+ /* This is the general case where many pages are being removed.
+ ** It is necessary to scan the entire hash table */
+ h = pCache->nHash/2;
+ iStop = h - 1;
+ }
+ for(;;){
+ PgHdr1 **pp;
+ PgHdr1 *pPage;
+ assert( h<pCache->nHash );
+ pp = &pCache->apHash[h];
+ while( (pPage = *pp)!=0 ){
+ if( pPage->iKey>=iLimit ){
+ pCache->nPage--;
+ *pp = pPage->pNext;
+ if( PAGE_IS_UNPINNED(pPage) ) pcache1PinPage(pPage);
+ pcache1FreePage(pPage);
+ }else{
+ pp = &pPage->pNext;
+ TESTONLY( if( nPage>=0 ) nPage++; )
+ }
+ }
+ if( h==iStop ) break;
+ h = (h+1) % pCache->nHash;
+ }
+ assert( nPage<0 || pCache->nPage==(unsigned)nPage );
+}
+
+/******************************************************************************/
+/******** sqlite3_pcache Methods **********************************************/
+
+/*
+** Implementation of the sqlite3_pcache.xInit method.
+*/
+static int pcache1Init(void *NotUsed){
+ UNUSED_PARAMETER(NotUsed);
+ assert( pcache1.isInit==0 );
+ memset(&pcache1, 0, sizeof(pcache1));
+
+
+ /*
+ ** The pcache1.separateCache variable is true if each PCache has its own
+ ** private PGroup (mode-1). pcache1.separateCache is false if the single
+ ** PGroup in pcache1.grp is used for all page caches (mode-2).
+ **
+ ** * Always use a unified cache (mode-2) if ENABLE_MEMORY_MANAGEMENT
+ **
+ ** * Use a unified cache in single-threaded applications that have
+ ** configured a start-time buffer for use as page-cache memory using
+ ** sqlite3_config(SQLITE_CONFIG_PAGECACHE, pBuf, sz, N) with non-NULL
+ ** pBuf argument.
+ **
+ ** * Otherwise use separate caches (mode-1)
+ */
+#if defined(SQLITE_ENABLE_MEMORY_MANAGEMENT)
+ pcache1.separateCache = 0;
+#elif SQLITE_THREADSAFE
+ pcache1.separateCache = sqlite3GlobalConfig.pPage==0
+ || sqlite3GlobalConfig.bCoreMutex>0;
+#else
+ pcache1.separateCache = sqlite3GlobalConfig.pPage==0;
+#endif
+
+#if SQLITE_THREADSAFE
+ if( sqlite3GlobalConfig.bCoreMutex ){
+ pcache1.grp.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU);
+ pcache1.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_PMEM);
+ }
+#endif
+ if( pcache1.separateCache
+ && sqlite3GlobalConfig.nPage!=0
+ && sqlite3GlobalConfig.pPage==0
+ ){
+ pcache1.nInitPage = sqlite3GlobalConfig.nPage;
+ }else{
+ pcache1.nInitPage = 0;
+ }
+ pcache1.grp.mxPinned = 10;
+ pcache1.isInit = 1;
+ return SQLITE_OK;
+}
+
+/*
+** Implementation of the sqlite3_pcache.xShutdown method.
+** Note that the static mutex allocated in xInit does
+** not need to be freed.
+*/
+static void pcache1Shutdown(void *NotUsed){
+ UNUSED_PARAMETER(NotUsed);
+ assert( pcache1.isInit!=0 );
+ memset(&pcache1, 0, sizeof(pcache1));
+}
+
+/* forward declaration */
+static void pcache1Destroy(sqlite3_pcache *p);
+
+/*
+** Implementation of the sqlite3_pcache.xCreate method.
+**
+** Allocate a new cache.
+*/
+static sqlite3_pcache *pcache1Create(int szPage, int szExtra, int bPurgeable){
+ PCache1 *pCache; /* The newly created page cache */
+ PGroup *pGroup; /* The group the new page cache will belong to */
+ int sz; /* Bytes of memory required to allocate the new cache */
+
+ assert( (szPage & (szPage-1))==0 && szPage>=512 && szPage<=65536 );
+ assert( szExtra < 300 );
+
+ sz = sizeof(PCache1) + sizeof(PGroup)*pcache1.separateCache;
+ pCache = (PCache1 *)sqlite3MallocZero(sz);
+ if( pCache ){
+ if( pcache1.separateCache ){
+ pGroup = (PGroup*)&pCache[1];
+ pGroup->mxPinned = 10;
+ }else{
+ pGroup = &pcache1.grp;
+ }
+ pcache1EnterMutex(pGroup);
+ if( pGroup->lru.isAnchor==0 ){
+ pGroup->lru.isAnchor = 1;
+ pGroup->lru.pLruPrev = pGroup->lru.pLruNext = &pGroup->lru;
+ }
+ pCache->pGroup = pGroup;
+ pCache->szPage = szPage;
+ pCache->szExtra = szExtra;
+ pCache->szAlloc = szPage + szExtra + ROUND8(sizeof(PgHdr1));
+ pCache->bPurgeable = (bPurgeable ? 1 : 0);
+ pcache1ResizeHash(pCache);
+ if( bPurgeable ){
+ pCache->nMin = 10;
+ pGroup->nMinPage += pCache->nMin;
+ pGroup->mxPinned = pGroup->nMaxPage + 10 - pGroup->nMinPage;
+ pCache->pnPurgeable = &pGroup->nPurgeable;
+ }else{
+ pCache->pnPurgeable = &pCache->nPurgeableDummy;
+ }
+ pcache1LeaveMutex(pGroup);
+ if( pCache->nHash==0 ){
+ pcache1Destroy((sqlite3_pcache*)pCache);
+ pCache = 0;
+ }
+ }
+ return (sqlite3_pcache *)pCache;
+}
+
+/*
+** Implementation of the sqlite3_pcache.xCachesize method.
+**
+** Configure the cache_size limit for a cache.
+*/
+static void pcache1Cachesize(sqlite3_pcache *p, int nMax){
+ PCache1 *pCache = (PCache1 *)p;
+ u32 n;
+ assert( nMax>=0 );
+ if( pCache->bPurgeable ){
+ PGroup *pGroup = pCache->pGroup;
+ pcache1EnterMutex(pGroup);
+ n = (u32)nMax;
+ if( n > 0x7fff0000 - pGroup->nMaxPage + pCache->nMax ){
+ n = 0x7fff0000 - pGroup->nMaxPage + pCache->nMax;
+ }
+ pGroup->nMaxPage += (n - pCache->nMax);
+ pGroup->mxPinned = pGroup->nMaxPage + 10 - pGroup->nMinPage;
+ pCache->nMax = n;
+ pCache->n90pct = pCache->nMax*9/10;
+ pcache1EnforceMaxPage(pCache);
+ pcache1LeaveMutex(pGroup);
+ }
+}
+
+/*
+** Implementation of the sqlite3_pcache.xShrink method.
+**
+** Free up as much memory as possible.
+*/
+static void pcache1Shrink(sqlite3_pcache *p){
+ PCache1 *pCache = (PCache1*)p;
+ if( pCache->bPurgeable ){
+ PGroup *pGroup = pCache->pGroup;
+ unsigned int savedMaxPage;
+ pcache1EnterMutex(pGroup);
+ savedMaxPage = pGroup->nMaxPage;
+ pGroup->nMaxPage = 0;
+ pcache1EnforceMaxPage(pCache);
+ pGroup->nMaxPage = savedMaxPage;
+ pcache1LeaveMutex(pGroup);
+ }
+}
+
+/*
+** Implementation of the sqlite3_pcache.xPagecount method.
+*/
+static int pcache1Pagecount(sqlite3_pcache *p){
+ int n;
+ PCache1 *pCache = (PCache1*)p;
+ pcache1EnterMutex(pCache->pGroup);
+ n = pCache->nPage;
+ pcache1LeaveMutex(pCache->pGroup);
+ return n;
+}
+
+
+/*
+** Implement steps 3, 4, and 5 of the pcache1Fetch() algorithm described
+** in the header of the pcache1Fetch() procedure.
+**
+** This steps are broken out into a separate procedure because they are
+** usually not needed, and by avoiding the stack initialization required
+** for these steps, the main pcache1Fetch() procedure can run faster.
+*/
+static SQLITE_NOINLINE PgHdr1 *pcache1FetchStage2(
+ PCache1 *pCache,
+ unsigned int iKey,
+ int createFlag
+){
+ unsigned int nPinned;
+ PGroup *pGroup = pCache->pGroup;
+ PgHdr1 *pPage = 0;
+
+ /* Step 3: Abort if createFlag is 1 but the cache is nearly full */
+ assert( pCache->nPage >= pCache->nRecyclable );
+ nPinned = pCache->nPage - pCache->nRecyclable;
+ assert( pGroup->mxPinned == pGroup->nMaxPage + 10 - pGroup->nMinPage );
+ assert( pCache->n90pct == pCache->nMax*9/10 );
+ if( createFlag==1 && (
+ nPinned>=pGroup->mxPinned
+ || nPinned>=pCache->n90pct
+ || (pcache1UnderMemoryPressure(pCache) && pCache->nRecyclable<nPinned)
+ )){
+ return 0;
+ }
+
+ if( pCache->nPage>=pCache->nHash ) pcache1ResizeHash(pCache);
+ assert( pCache->nHash>0 && pCache->apHash );
+
+ /* Step 4. Try to recycle a page. */
+ if( pCache->bPurgeable
+ && !pGroup->lru.pLruPrev->isAnchor
+ && ((pCache->nPage+1>=pCache->nMax) || pcache1UnderMemoryPressure(pCache))
+ ){
+ PCache1 *pOther;
+ pPage = pGroup->lru.pLruPrev;
+ assert( PAGE_IS_UNPINNED(pPage) );
+ pcache1RemoveFromHash(pPage, 0);
+ pcache1PinPage(pPage);
+ pOther = pPage->pCache;
+ if( pOther->szAlloc != pCache->szAlloc ){
+ pcache1FreePage(pPage);
+ pPage = 0;
+ }else{
+ pGroup->nPurgeable -= (pOther->bPurgeable - pCache->bPurgeable);
+ }
+ }
+
+ /* Step 5. If a usable page buffer has still not been found,
+ ** attempt to allocate a new one.
+ */
+ if( !pPage ){
+ pPage = pcache1AllocPage(pCache, createFlag==1);
+ }
+
+ if( pPage ){
+ unsigned int h = iKey % pCache->nHash;
+ pCache->nPage++;
+ pPage->iKey = iKey;
+ pPage->pNext = pCache->apHash[h];
+ pPage->pCache = pCache;
+ pPage->pLruNext = 0;
+ /* pPage->pLruPrev = 0;
+ ** No need to clear pLruPrev since it is not accessed when pLruNext==0 */
+ *(void **)pPage->page.pExtra = 0;
+ pCache->apHash[h] = pPage;
+ if( iKey>pCache->iMaxKey ){
+ pCache->iMaxKey = iKey;
+ }
+ }
+ return pPage;
+}
+
+/*
+** Implementation of the sqlite3_pcache.xFetch method.
+**
+** Fetch a page by key value.
+**
+** Whether or not a new page may be allocated by this function depends on
+** the value of the createFlag argument. 0 means do not allocate a new
+** page. 1 means allocate a new page if space is easily available. 2
+** means to try really hard to allocate a new page.
+**
+** For a non-purgeable cache (a cache used as the storage for an in-memory
+** database) there is really no difference between createFlag 1 and 2. So
+** the calling function (pcache.c) will never have a createFlag of 1 on
+** a non-purgeable cache.
+**
+** There are three different approaches to obtaining space for a page,
+** depending on the value of parameter createFlag (which may be 0, 1 or 2).
+**
+** 1. Regardless of the value of createFlag, the cache is searched for a
+** copy of the requested page. If one is found, it is returned.
+**
+** 2. If createFlag==0 and the page is not already in the cache, NULL is
+** returned.
+**
+** 3. If createFlag is 1, and the page is not already in the cache, then
+** return NULL (do not allocate a new page) if any of the following
+** conditions are true:
+**
+** (a) the number of pages pinned by the cache is greater than
+** PCache1.nMax, or
+**
+** (b) the number of pages pinned by the cache is greater than
+** the sum of nMax for all purgeable caches, less the sum of
+** nMin for all other purgeable caches, or
+**
+** 4. If none of the first three conditions apply and the cache is marked
+** as purgeable, and if one of the following is true:
+**
+** (a) The number of pages allocated for the cache is already
+** PCache1.nMax, or
+**
+** (b) The number of pages allocated for all purgeable caches is
+** already equal to or greater than the sum of nMax for all
+** purgeable caches,
+**
+** (c) The system is under memory pressure and wants to avoid
+** unnecessary pages cache entry allocations
+**
+** then attempt to recycle a page from the LRU list. If it is the right
+** size, return the recycled buffer. Otherwise, free the buffer and
+** proceed to step 5.
+**
+** 5. Otherwise, allocate and return a new page buffer.
+**
+** There are two versions of this routine. pcache1FetchWithMutex() is
+** the general case. pcache1FetchNoMutex() is a faster implementation for
+** the common case where pGroup->mutex is NULL. The pcache1Fetch() wrapper
+** invokes the appropriate routine.
+*/
+static PgHdr1 *pcache1FetchNoMutex(
+ sqlite3_pcache *p,
+ unsigned int iKey,
+ int createFlag
+){
+ PCache1 *pCache = (PCache1 *)p;
+ PgHdr1 *pPage = 0;
+
+ /* Step 1: Search the hash table for an existing entry. */
+ pPage = pCache->apHash[iKey % pCache->nHash];
+ while( pPage && pPage->iKey!=iKey ){ pPage = pPage->pNext; }
+
+ /* Step 2: If the page was found in the hash table, then return it.
+ ** If the page was not in the hash table and createFlag is 0, abort.
+ ** Otherwise (page not in hash and createFlag!=0) continue with
+ ** subsequent steps to try to create the page. */
+ if( pPage ){
+ if( PAGE_IS_UNPINNED(pPage) ){
+ return pcache1PinPage(pPage);
+ }else{
+ return pPage;
+ }
+ }else if( createFlag ){
+ /* Steps 3, 4, and 5 implemented by this subroutine */
+ return pcache1FetchStage2(pCache, iKey, createFlag);
+ }else{
+ return 0;
+ }
+}
+#if PCACHE1_MIGHT_USE_GROUP_MUTEX
+static PgHdr1 *pcache1FetchWithMutex(
+ sqlite3_pcache *p,
+ unsigned int iKey,
+ int createFlag
+){
+ PCache1 *pCache = (PCache1 *)p;
+ PgHdr1 *pPage;
+
+ pcache1EnterMutex(pCache->pGroup);
+ pPage = pcache1FetchNoMutex(p, iKey, createFlag);
+ assert( pPage==0 || pCache->iMaxKey>=iKey );
+ pcache1LeaveMutex(pCache->pGroup);
+ return pPage;
+}
+#endif
+static sqlite3_pcache_page *pcache1Fetch(
+ sqlite3_pcache *p,
+ unsigned int iKey,
+ int createFlag
+){
+#if PCACHE1_MIGHT_USE_GROUP_MUTEX || defined(SQLITE_DEBUG)
+ PCache1 *pCache = (PCache1 *)p;
+#endif
+
+ assert( offsetof(PgHdr1,page)==0 );
+ assert( pCache->bPurgeable || createFlag!=1 );
+ assert( pCache->bPurgeable || pCache->nMin==0 );
+ assert( pCache->bPurgeable==0 || pCache->nMin==10 );
+ assert( pCache->nMin==0 || pCache->bPurgeable );
+ assert( pCache->nHash>0 );
+#if PCACHE1_MIGHT_USE_GROUP_MUTEX
+ if( pCache->pGroup->mutex ){
+ return (sqlite3_pcache_page*)pcache1FetchWithMutex(p, iKey, createFlag);
+ }else
+#endif
+ {
+ return (sqlite3_pcache_page*)pcache1FetchNoMutex(p, iKey, createFlag);
+ }
+}
+
+
+/*
+** Implementation of the sqlite3_pcache.xUnpin method.
+**
+** Mark a page as unpinned (eligible for asynchronous recycling).
+*/
+static void pcache1Unpin(
+ sqlite3_pcache *p,
+ sqlite3_pcache_page *pPg,
+ int reuseUnlikely
+){
+ PCache1 *pCache = (PCache1 *)p;
+ PgHdr1 *pPage = (PgHdr1 *)pPg;
+ PGroup *pGroup = pCache->pGroup;
+
+ assert( pPage->pCache==pCache );
+ pcache1EnterMutex(pGroup);
+
+ /* It is an error to call this function if the page is already
+ ** part of the PGroup LRU list.
+ */
+ assert( pPage->pLruNext==0 );
+ assert( PAGE_IS_PINNED(pPage) );
+
+ if( reuseUnlikely || pGroup->nPurgeable>pGroup->nMaxPage ){
+ pcache1RemoveFromHash(pPage, 1);
+ }else{
+ /* Add the page to the PGroup LRU list. */
+ PgHdr1 **ppFirst = &pGroup->lru.pLruNext;
+ pPage->pLruPrev = &pGroup->lru;
+ (pPage->pLruNext = *ppFirst)->pLruPrev = pPage;
+ *ppFirst = pPage;
+ pCache->nRecyclable++;
+ }
+
+ pcache1LeaveMutex(pCache->pGroup);
+}
+
+/*
+** Implementation of the sqlite3_pcache.xRekey method.
+*/
+static void pcache1Rekey(
+ sqlite3_pcache *p,
+ sqlite3_pcache_page *pPg,
+ unsigned int iOld,
+ unsigned int iNew
+){
+ PCache1 *pCache = (PCache1 *)p;
+ PgHdr1 *pPage = (PgHdr1 *)pPg;
+ PgHdr1 **pp;
+ unsigned int hOld, hNew;
+ assert( pPage->iKey==iOld );
+ assert( pPage->pCache==pCache );
+ assert( iOld!=iNew ); /* The page number really is changing */
+
+ pcache1EnterMutex(pCache->pGroup);
+
+ assert( pcache1FetchNoMutex(p, iOld, 0)==pPage ); /* pPg really is iOld */
+ hOld = iOld%pCache->nHash;
+ pp = &pCache->apHash[hOld];
+ while( (*pp)!=pPage ){
+ pp = &(*pp)->pNext;
+ }
+ *pp = pPage->pNext;
+
+ assert( pcache1FetchNoMutex(p, iNew, 0)==0 ); /* iNew not in cache */
+ hNew = iNew%pCache->nHash;
+ pPage->iKey = iNew;
+ pPage->pNext = pCache->apHash[hNew];
+ pCache->apHash[hNew] = pPage;
+ if( iNew>pCache->iMaxKey ){
+ pCache->iMaxKey = iNew;
+ }
+
+ pcache1LeaveMutex(pCache->pGroup);
+}
+
+/*
+** Implementation of the sqlite3_pcache.xTruncate method.
+**
+** Discard all unpinned pages in the cache with a page number equal to
+** or greater than parameter iLimit. Any pinned pages with a page number
+** equal to or greater than iLimit are implicitly unpinned.
+*/
+static void pcache1Truncate(sqlite3_pcache *p, unsigned int iLimit){
+ PCache1 *pCache = (PCache1 *)p;
+ pcache1EnterMutex(pCache->pGroup);
+ if( iLimit<=pCache->iMaxKey ){
+ pcache1TruncateUnsafe(pCache, iLimit);
+ pCache->iMaxKey = iLimit-1;
+ }
+ pcache1LeaveMutex(pCache->pGroup);
+}
+
+/*
+** Implementation of the sqlite3_pcache.xDestroy method.
+**
+** Destroy a cache allocated using pcache1Create().
+*/
+static void pcache1Destroy(sqlite3_pcache *p){
+ PCache1 *pCache = (PCache1 *)p;
+ PGroup *pGroup = pCache->pGroup;
+ assert( pCache->bPurgeable || (pCache->nMax==0 && pCache->nMin==0) );
+ pcache1EnterMutex(pGroup);
+ if( pCache->nPage ) pcache1TruncateUnsafe(pCache, 0);
+ assert( pGroup->nMaxPage >= pCache->nMax );
+ pGroup->nMaxPage -= pCache->nMax;
+ assert( pGroup->nMinPage >= pCache->nMin );
+ pGroup->nMinPage -= pCache->nMin;
+ pGroup->mxPinned = pGroup->nMaxPage + 10 - pGroup->nMinPage;
+ pcache1EnforceMaxPage(pCache);
+ pcache1LeaveMutex(pGroup);
+ sqlite3_free(pCache->pBulk);
+ sqlite3_free(pCache->apHash);
+ sqlite3_free(pCache);
+}
+
+/*
+** This function is called during initialization (sqlite3_initialize()) to
+** install the default pluggable cache module, assuming the user has not
+** already provided an alternative.
+*/
+SQLITE_PRIVATE void sqlite3PCacheSetDefault(void){
+ static const sqlite3_pcache_methods2 defaultMethods = {
+ 1, /* iVersion */
+ 0, /* pArg */
+ pcache1Init, /* xInit */
+ pcache1Shutdown, /* xShutdown */
+ pcache1Create, /* xCreate */
+ pcache1Cachesize, /* xCachesize */
+ pcache1Pagecount, /* xPagecount */
+ pcache1Fetch, /* xFetch */
+ pcache1Unpin, /* xUnpin */
+ pcache1Rekey, /* xRekey */
+ pcache1Truncate, /* xTruncate */
+ pcache1Destroy, /* xDestroy */
+ pcache1Shrink /* xShrink */
+ };
+ sqlite3_config(SQLITE_CONFIG_PCACHE2, &defaultMethods);
+}
+
+/*
+** Return the size of the header on each page of this PCACHE implementation.
+*/
+SQLITE_PRIVATE int sqlite3HeaderSizePcache1(void){ return ROUND8(sizeof(PgHdr1)); }
+
+/*
+** Return the global mutex used by this PCACHE implementation. The
+** sqlite3_status() routine needs access to this mutex.
+*/
+SQLITE_PRIVATE sqlite3_mutex *sqlite3Pcache1Mutex(void){
+ return pcache1.mutex;
+}
+
+#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
+/*
+** This function is called to free superfluous dynamically allocated memory
+** held by the pager system. Memory in use by any SQLite pager allocated
+** by the current thread may be sqlite3_free()ed.
+**
+** nReq is the number of bytes of memory required. Once this much has
+** been released, the function returns. The return value is the total number
+** of bytes of memory released.
+*/
+SQLITE_PRIVATE int sqlite3PcacheReleaseMemory(int nReq){
+ int nFree = 0;
+ assert( sqlite3_mutex_notheld(pcache1.grp.mutex) );
+ assert( sqlite3_mutex_notheld(pcache1.mutex) );
+ if( sqlite3GlobalConfig.pPage==0 ){
+ PgHdr1 *p;
+ pcache1EnterMutex(&pcache1.grp);
+ while( (nReq<0 || nFree<nReq)
+ && (p=pcache1.grp.lru.pLruPrev)!=0
+ && p->isAnchor==0
+ ){
+ nFree += pcache1MemSize(p->page.pBuf);
+ assert( PAGE_IS_UNPINNED(p) );
+ pcache1PinPage(p);
+ pcache1RemoveFromHash(p, 1);
+ }
+ pcache1LeaveMutex(&pcache1.grp);
+ }
+ return nFree;
+}
+#endif /* SQLITE_ENABLE_MEMORY_MANAGEMENT */
+
+#ifdef SQLITE_TEST
+/*
+** This function is used by test procedures to inspect the internal state
+** of the global cache.
+*/
+SQLITE_PRIVATE void sqlite3PcacheStats(
+ int *pnCurrent, /* OUT: Total number of pages cached */
+ int *pnMax, /* OUT: Global maximum cache size */
+ int *pnMin, /* OUT: Sum of PCache1.nMin for purgeable caches */
+ int *pnRecyclable /* OUT: Total number of pages available for recycling */
+){
+ PgHdr1 *p;
+ int nRecyclable = 0;
+ for(p=pcache1.grp.lru.pLruNext; p && !p->isAnchor; p=p->pLruNext){
+ assert( PAGE_IS_UNPINNED(p) );
+ nRecyclable++;
+ }
+ *pnCurrent = pcache1.grp.nPurgeable;
+ *pnMax = (int)pcache1.grp.nMaxPage;
+ *pnMin = (int)pcache1.grp.nMinPage;
+ *pnRecyclable = nRecyclable;
+}
+#endif
+
+/************** End of pcache1.c *********************************************/
+/************** Begin file rowset.c ******************************************/
+/*
+** 2008 December 3
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+**
+** This module implements an object we call a "RowSet".
+**
+** The RowSet object is a collection of rowids. Rowids
+** are inserted into the RowSet in an arbitrary order. Inserts
+** can be intermixed with tests to see if a given rowid has been
+** previously inserted into the RowSet.
+**
+** After all inserts are finished, it is possible to extract the
+** elements of the RowSet in sorted order. Once this extraction
+** process has started, no new elements may be inserted.
+**
+** Hence, the primitive operations for a RowSet are:
+**
+** CREATE
+** INSERT
+** TEST
+** SMALLEST
+** DESTROY
+**
+** The CREATE and DESTROY primitives are the constructor and destructor,
+** obviously. The INSERT primitive adds a new element to the RowSet.
+** TEST checks to see if an element is already in the RowSet. SMALLEST
+** extracts the least value from the RowSet.
+**
+** The INSERT primitive might allocate additional memory. Memory is
+** allocated in chunks so most INSERTs do no allocation. There is an
+** upper bound on the size of allocated memory. No memory is freed
+** until DESTROY.
+**
+** The TEST primitive includes a "batch" number. The TEST primitive
+** will only see elements that were inserted before the last change
+** in the batch number. In other words, if an INSERT occurs between
+** two TESTs where the TESTs have the same batch number, then the
+** value added by the INSERT will not be visible to the second TEST.
+** The initial batch number is zero, so if the very first TEST contains
+** a non-zero batch number, it will see all prior INSERTs.
+**
+** No INSERTs may occurs after a SMALLEST. An assertion will fail if
+** that is attempted.
+**
+** The cost of an INSERT is roughly constant. (Sometimes new memory
+** has to be allocated on an INSERT.) The cost of a TEST with a new
+** batch number is O(NlogN) where N is the number of elements in the RowSet.
+** The cost of a TEST using the same batch number is O(logN). The cost
+** of the first SMALLEST is O(NlogN). Second and subsequent SMALLEST
+** primitives are constant time. The cost of DESTROY is O(N).
+**
+** TEST and SMALLEST may not be used by the same RowSet. This used to
+** be possible, but the feature was not used, so it was removed in order
+** to simplify the code.
+*/
+/* #include "sqliteInt.h" */
+
+
+/*
+** Target size for allocation chunks.
+*/
+#define ROWSET_ALLOCATION_SIZE 1024
+
+/*
+** The number of rowset entries per allocation chunk.
+*/
+#define ROWSET_ENTRY_PER_CHUNK \
+ ((ROWSET_ALLOCATION_SIZE-8)/sizeof(struct RowSetEntry))
+
+/*
+** Each entry in a RowSet is an instance of the following object.
+**
+** This same object is reused to store a linked list of trees of RowSetEntry
+** objects. In that alternative use, pRight points to the next entry
+** in the list, pLeft points to the tree, and v is unused. The
+** RowSet.pForest value points to the head of this forest list.
+*/
+struct RowSetEntry {
+ i64 v; /* ROWID value for this entry */
+ struct RowSetEntry *pRight; /* Right subtree (larger entries) or list */
+ struct RowSetEntry *pLeft; /* Left subtree (smaller entries) */
+};
+
+/*
+** RowSetEntry objects are allocated in large chunks (instances of the
+** following structure) to reduce memory allocation overhead. The
+** chunks are kept on a linked list so that they can be deallocated
+** when the RowSet is destroyed.
+*/
+struct RowSetChunk {
+ struct RowSetChunk *pNextChunk; /* Next chunk on list of them all */
+ struct RowSetEntry aEntry[ROWSET_ENTRY_PER_CHUNK]; /* Allocated entries */
+};
+
+/*
+** A RowSet in an instance of the following structure.
+**
+** A typedef of this structure if found in sqliteInt.h.
+*/
+struct RowSet {
+ struct RowSetChunk *pChunk; /* List of all chunk allocations */
+ sqlite3 *db; /* The database connection */
+ struct RowSetEntry *pEntry; /* List of entries using pRight */
+ struct RowSetEntry *pLast; /* Last entry on the pEntry list */
+ struct RowSetEntry *pFresh; /* Source of new entry objects */
+ struct RowSetEntry *pForest; /* List of binary trees of entries */
+ u16 nFresh; /* Number of objects on pFresh */
+ u16 rsFlags; /* Various flags */
+ int iBatch; /* Current insert batch */
+};
+
+/*
+** Allowed values for RowSet.rsFlags
+*/
+#define ROWSET_SORTED 0x01 /* True if RowSet.pEntry is sorted */
+#define ROWSET_NEXT 0x02 /* True if sqlite3RowSetNext() has been called */
+
+/*
+** Allocate a RowSet object. Return NULL if a memory allocation
+** error occurs.
+*/
+SQLITE_PRIVATE RowSet *sqlite3RowSetInit(sqlite3 *db){
+ RowSet *p = sqlite3DbMallocRawNN(db, sizeof(*p));
+ if( p ){
+ int N = sqlite3DbMallocSize(db, p);
+ p->pChunk = 0;
+ p->db = db;
+ p->pEntry = 0;
+ p->pLast = 0;
+ p->pForest = 0;
+ p->pFresh = (struct RowSetEntry*)(ROUND8(sizeof(*p)) + (char*)p);
+ p->nFresh = (u16)((N - ROUND8(sizeof(*p)))/sizeof(struct RowSetEntry));
+ p->rsFlags = ROWSET_SORTED;
+ p->iBatch = 0;
+ }
+ return p;
+}
+
+/*
+** Deallocate all chunks from a RowSet. This frees all memory that
+** the RowSet has allocated over its lifetime. This routine is
+** the destructor for the RowSet.
+*/
+SQLITE_PRIVATE void sqlite3RowSetClear(void *pArg){
+ RowSet *p = (RowSet*)pArg;
+ struct RowSetChunk *pChunk, *pNextChunk;
+ for(pChunk=p->pChunk; pChunk; pChunk = pNextChunk){
+ pNextChunk = pChunk->pNextChunk;
+ sqlite3DbFree(p->db, pChunk);
+ }
+ p->pChunk = 0;
+ p->nFresh = 0;
+ p->pEntry = 0;
+ p->pLast = 0;
+ p->pForest = 0;
+ p->rsFlags = ROWSET_SORTED;
+}
+
+/*
+** Deallocate all chunks from a RowSet. This frees all memory that
+** the RowSet has allocated over its lifetime. This routine is
+** the destructor for the RowSet.
+*/
+SQLITE_PRIVATE void sqlite3RowSetDelete(void *pArg){
+ sqlite3RowSetClear(pArg);
+ sqlite3DbFree(((RowSet*)pArg)->db, pArg);
+}
+
+/*
+** Allocate a new RowSetEntry object that is associated with the
+** given RowSet. Return a pointer to the new and completely uninitialized
+** object.
+**
+** In an OOM situation, the RowSet.db->mallocFailed flag is set and this
+** routine returns NULL.
+*/
+static struct RowSetEntry *rowSetEntryAlloc(RowSet *p){
+ assert( p!=0 );
+ if( p->nFresh==0 ){ /*OPTIMIZATION-IF-FALSE*/
+ /* We could allocate a fresh RowSetEntry each time one is needed, but it
+ ** is more efficient to pull a preallocated entry from the pool */
+ struct RowSetChunk *pNew;
+ pNew = sqlite3DbMallocRawNN(p->db, sizeof(*pNew));
+ if( pNew==0 ){
+ return 0;
+ }
+ pNew->pNextChunk = p->pChunk;
+ p->pChunk = pNew;
+ p->pFresh = pNew->aEntry;
+ p->nFresh = ROWSET_ENTRY_PER_CHUNK;
+ }
+ p->nFresh--;
+ return p->pFresh++;
+}
+
+/*
+** Insert a new value into a RowSet.
+**
+** The mallocFailed flag of the database connection is set if a
+** memory allocation fails.
+*/
+SQLITE_PRIVATE void sqlite3RowSetInsert(RowSet *p, i64 rowid){
+ struct RowSetEntry *pEntry; /* The new entry */
+ struct RowSetEntry *pLast; /* The last prior entry */
+
+ /* This routine is never called after sqlite3RowSetNext() */
+ assert( p!=0 && (p->rsFlags & ROWSET_NEXT)==0 );
+
+ pEntry = rowSetEntryAlloc(p);
+ if( pEntry==0 ) return;
+ pEntry->v = rowid;
+ pEntry->pRight = 0;
+ pLast = p->pLast;
+ if( pLast ){
+ if( rowid<=pLast->v ){ /*OPTIMIZATION-IF-FALSE*/
+ /* Avoid unnecessary sorts by preserving the ROWSET_SORTED flags
+ ** where possible */
+ p->rsFlags &= ~ROWSET_SORTED;
+ }
+ pLast->pRight = pEntry;
+ }else{
+ p->pEntry = pEntry;
+ }
+ p->pLast = pEntry;
+}
+
+/*
+** Merge two lists of RowSetEntry objects. Remove duplicates.
+**
+** The input lists are connected via pRight pointers and are
+** assumed to each already be in sorted order.
+*/
+static struct RowSetEntry *rowSetEntryMerge(
+ struct RowSetEntry *pA, /* First sorted list to be merged */
+ struct RowSetEntry *pB /* Second sorted list to be merged */
+){
+ struct RowSetEntry head;
+ struct RowSetEntry *pTail;
+
+ pTail = &head;
+ assert( pA!=0 && pB!=0 );
+ for(;;){
+ assert( pA->pRight==0 || pA->v<=pA->pRight->v );
+ assert( pB->pRight==0 || pB->v<=pB->pRight->v );
+ if( pA->v<=pB->v ){
+ if( pA->v<pB->v ) pTail = pTail->pRight = pA;
+ pA = pA->pRight;
+ if( pA==0 ){
+ pTail->pRight = pB;
+ break;
+ }
+ }else{
+ pTail = pTail->pRight = pB;
+ pB = pB->pRight;
+ if( pB==0 ){
+ pTail->pRight = pA;
+ break;
+ }
+ }
+ }
+ return head.pRight;
+}
+
+/*
+** Sort all elements on the list of RowSetEntry objects into order of
+** increasing v.
+*/
+static struct RowSetEntry *rowSetEntrySort(struct RowSetEntry *pIn){
+ unsigned int i;
+ struct RowSetEntry *pNext, *aBucket[40];
+
+ memset(aBucket, 0, sizeof(aBucket));
+ while( pIn ){
+ pNext = pIn->pRight;
+ pIn->pRight = 0;
+ for(i=0; aBucket[i]; i++){
+ pIn = rowSetEntryMerge(aBucket[i], pIn);
+ aBucket[i] = 0;
+ }
+ aBucket[i] = pIn;
+ pIn = pNext;
+ }
+ pIn = aBucket[0];
+ for(i=1; i<sizeof(aBucket)/sizeof(aBucket[0]); i++){
+ if( aBucket[i]==0 ) continue;
+ pIn = pIn ? rowSetEntryMerge(pIn, aBucket[i]) : aBucket[i];
+ }
+ return pIn;
+}
+
+
+/*
+** The input, pIn, is a binary tree (or subtree) of RowSetEntry objects.
+** Convert this tree into a linked list connected by the pRight pointers
+** and return pointers to the first and last elements of the new list.
+*/
+static void rowSetTreeToList(
+ struct RowSetEntry *pIn, /* Root of the input tree */
+ struct RowSetEntry **ppFirst, /* Write head of the output list here */
+ struct RowSetEntry **ppLast /* Write tail of the output list here */
+){
+ assert( pIn!=0 );
+ if( pIn->pLeft ){
+ struct RowSetEntry *p;
+ rowSetTreeToList(pIn->pLeft, ppFirst, &p);
+ p->pRight = pIn;
+ }else{
+ *ppFirst = pIn;
+ }
+ if( pIn->pRight ){
+ rowSetTreeToList(pIn->pRight, &pIn->pRight, ppLast);
+ }else{
+ *ppLast = pIn;
+ }
+ assert( (*ppLast)->pRight==0 );
+}
+
+
+/*
+** Convert a sorted list of elements (connected by pRight) into a binary
+** tree with depth of iDepth. A depth of 1 means the tree contains a single
+** node taken from the head of *ppList. A depth of 2 means a tree with
+** three nodes. And so forth.
+**
+** Use as many entries from the input list as required and update the
+** *ppList to point to the unused elements of the list. If the input
+** list contains too few elements, then construct an incomplete tree
+** and leave *ppList set to NULL.
+**
+** Return a pointer to the root of the constructed binary tree.
+*/
+static struct RowSetEntry *rowSetNDeepTree(
+ struct RowSetEntry **ppList,
+ int iDepth
+){
+ struct RowSetEntry *p; /* Root of the new tree */
+ struct RowSetEntry *pLeft; /* Left subtree */
+ if( *ppList==0 ){ /*OPTIMIZATION-IF-TRUE*/
+ /* Prevent unnecessary deep recursion when we run out of entries */
+ return 0;
+ }
+ if( iDepth>1 ){ /*OPTIMIZATION-IF-TRUE*/
+ /* This branch causes a *balanced* tree to be generated. A valid tree
+ ** is still generated without this branch, but the tree is wildly
+ ** unbalanced and inefficient. */
+ pLeft = rowSetNDeepTree(ppList, iDepth-1);
+ p = *ppList;
+ if( p==0 ){ /*OPTIMIZATION-IF-FALSE*/
+ /* It is safe to always return here, but the resulting tree
+ ** would be unbalanced */
+ return pLeft;
+ }
+ p->pLeft = pLeft;
+ *ppList = p->pRight;
+ p->pRight = rowSetNDeepTree(ppList, iDepth-1);
+ }else{
+ p = *ppList;
+ *ppList = p->pRight;
+ p->pLeft = p->pRight = 0;
+ }
+ return p;
+}
+
+/*
+** Convert a sorted list of elements into a binary tree. Make the tree
+** as deep as it needs to be in order to contain the entire list.
+*/
+static struct RowSetEntry *rowSetListToTree(struct RowSetEntry *pList){
+ int iDepth; /* Depth of the tree so far */
+ struct RowSetEntry *p; /* Current tree root */
+ struct RowSetEntry *pLeft; /* Left subtree */
+
+ assert( pList!=0 );
+ p = pList;
+ pList = p->pRight;
+ p->pLeft = p->pRight = 0;
+ for(iDepth=1; pList; iDepth++){
+ pLeft = p;
+ p = pList;
+ pList = p->pRight;
+ p->pLeft = pLeft;
+ p->pRight = rowSetNDeepTree(&pList, iDepth);
+ }
+ return p;
+}
+
+/*
+** Extract the smallest element from the RowSet.
+** Write the element into *pRowid. Return 1 on success. Return
+** 0 if the RowSet is already empty.
+**
+** After this routine has been called, the sqlite3RowSetInsert()
+** routine may not be called again.
+**
+** This routine may not be called after sqlite3RowSetTest() has
+** been used. Older versions of RowSet allowed that, but as the
+** capability was not used by the code generator, it was removed
+** for code economy.
+*/
+SQLITE_PRIVATE int sqlite3RowSetNext(RowSet *p, i64 *pRowid){
+ assert( p!=0 );
+ assert( p->pForest==0 ); /* Cannot be used with sqlite3RowSetText() */
+
+ /* Merge the forest into a single sorted list on first call */
+ if( (p->rsFlags & ROWSET_NEXT)==0 ){ /*OPTIMIZATION-IF-FALSE*/
+ if( (p->rsFlags & ROWSET_SORTED)==0 ){ /*OPTIMIZATION-IF-FALSE*/
+ p->pEntry = rowSetEntrySort(p->pEntry);
+ }
+ p->rsFlags |= ROWSET_SORTED|ROWSET_NEXT;
+ }
+
+ /* Return the next entry on the list */
+ if( p->pEntry ){
+ *pRowid = p->pEntry->v;
+ p->pEntry = p->pEntry->pRight;
+ if( p->pEntry==0 ){ /*OPTIMIZATION-IF-TRUE*/
+ /* Free memory immediately, rather than waiting on sqlite3_finalize() */
+ sqlite3RowSetClear(p);
+ }
+ return 1;
+ }else{
+ return 0;
+ }
+}
+
+/*
+** Check to see if element iRowid was inserted into the rowset as
+** part of any insert batch prior to iBatch. Return 1 or 0.
+**
+** If this is the first test of a new batch and if there exist entries
+** on pRowSet->pEntry, then sort those entries into the forest at
+** pRowSet->pForest so that they can be tested.
+*/
+SQLITE_PRIVATE int sqlite3RowSetTest(RowSet *pRowSet, int iBatch, sqlite3_int64 iRowid){
+ struct RowSetEntry *p, *pTree;
+
+ /* This routine is never called after sqlite3RowSetNext() */
+ assert( pRowSet!=0 && (pRowSet->rsFlags & ROWSET_NEXT)==0 );
+
+ /* Sort entries into the forest on the first test of a new batch.
+ ** To save unnecessary work, only do this when the batch number changes.
+ */
+ if( iBatch!=pRowSet->iBatch ){ /*OPTIMIZATION-IF-FALSE*/
+ p = pRowSet->pEntry;
+ if( p ){
+ struct RowSetEntry **ppPrevTree = &pRowSet->pForest;
+ if( (pRowSet->rsFlags & ROWSET_SORTED)==0 ){ /*OPTIMIZATION-IF-FALSE*/
+ /* Only sort the current set of entries if they need it */
+ p = rowSetEntrySort(p);
+ }
+ for(pTree = pRowSet->pForest; pTree; pTree=pTree->pRight){
+ ppPrevTree = &pTree->pRight;
+ if( pTree->pLeft==0 ){
+ pTree->pLeft = rowSetListToTree(p);
+ break;
+ }else{
+ struct RowSetEntry *pAux, *pTail;
+ rowSetTreeToList(pTree->pLeft, &pAux, &pTail);
+ pTree->pLeft = 0;
+ p = rowSetEntryMerge(pAux, p);
+ }
+ }
+ if( pTree==0 ){
+ *ppPrevTree = pTree = rowSetEntryAlloc(pRowSet);
+ if( pTree ){
+ pTree->v = 0;
+ pTree->pRight = 0;
+ pTree->pLeft = rowSetListToTree(p);
+ }
+ }
+ pRowSet->pEntry = 0;
+ pRowSet->pLast = 0;
+ pRowSet->rsFlags |= ROWSET_SORTED;
+ }
+ pRowSet->iBatch = iBatch;
+ }
+
+ /* Test to see if the iRowid value appears anywhere in the forest.
+ ** Return 1 if it does and 0 if not.
+ */
+ for(pTree = pRowSet->pForest; pTree; pTree=pTree->pRight){
+ p = pTree->pLeft;
+ while( p ){
+ if( p->v<iRowid ){
+ p = p->pRight;
+ }else if( p->v>iRowid ){
+ p = p->pLeft;
+ }else{
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
+
+/************** End of rowset.c **********************************************/
+/************** Begin file pager.c *******************************************/
+/*
+** 2001 September 15
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This is the implementation of the page cache subsystem or "pager".
+**
+** The pager is used to access a database disk file. It implements
+** atomic commit and rollback through the use of a journal file that
+** is separate from the database file. The pager also implements file
+** locking to prevent two processes from writing the same database
+** file simultaneously, or one process from reading the database while
+** another is writing.
+*/
+#ifndef SQLITE_OMIT_DISKIO
+/* #include "sqliteInt.h" */
+/************** Include wal.h in the middle of pager.c ***********************/
+/************** Begin file wal.h *********************************************/
+/*
+** 2010 February 1
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This header file defines the interface to the write-ahead logging
+** system. Refer to the comments below and the header comment attached to
+** the implementation of each function in log.c for further details.
+*/
+
+#ifndef SQLITE_WAL_H
+#define SQLITE_WAL_H
+
+/* #include "sqliteInt.h" */
+
+/* Macros for extracting appropriate sync flags for either transaction
+** commits (WAL_SYNC_FLAGS(X)) or for checkpoint ops (CKPT_SYNC_FLAGS(X)):
+*/
+#define WAL_SYNC_FLAGS(X) ((X)&0x03)
+#define CKPT_SYNC_FLAGS(X) (((X)>>2)&0x03)
+
+#ifdef SQLITE_OMIT_WAL
+# define sqlite3WalOpen(x,y,z) 0
+# define sqlite3WalLimit(x,y)
+# define sqlite3WalClose(v,w,x,y,z) 0
+# define sqlite3WalBeginReadTransaction(y,z) 0
+# define sqlite3WalEndReadTransaction(z)
+# define sqlite3WalDbsize(y) 0
+# define sqlite3WalBeginWriteTransaction(y) 0
+# define sqlite3WalEndWriteTransaction(x) 0
+# define sqlite3WalUndo(x,y,z) 0
+# define sqlite3WalSavepoint(y,z)
+# define sqlite3WalSavepointUndo(y,z) 0
+# define sqlite3WalFrames(u,v,w,x,y,z) 0
+# define sqlite3WalCheckpoint(q,r,s,t,u,v,w,x,y,z) 0
+# define sqlite3WalCallback(z) 0
+# define sqlite3WalExclusiveMode(y,z) 0
+# define sqlite3WalHeapMemory(z) 0
+# define sqlite3WalFramesize(z) 0
+# define sqlite3WalFindFrame(x,y,z) 0
+# define sqlite3WalFile(x) 0
+# undef SQLITE_USE_SEH
+#else
+
+#define WAL_SAVEPOINT_NDATA 4
+
+/* Connection to a write-ahead log (WAL) file.
+** There is one object of this type for each pager.
+*/
+typedef struct Wal Wal;
+
+/* Open and close a connection to a write-ahead log. */
+SQLITE_PRIVATE int sqlite3WalOpen(sqlite3_vfs*, sqlite3_file*, const char *, int, i64, Wal**);
+SQLITE_PRIVATE int sqlite3WalClose(Wal *pWal, sqlite3*, int sync_flags, int, u8 *);
+
+/* Set the limiting size of a WAL file. */
+SQLITE_PRIVATE void sqlite3WalLimit(Wal*, i64);
+
+/* Used by readers to open (lock) and close (unlock) a snapshot. A
+** snapshot is like a read-transaction. It is the state of the database
+** at an instant in time. sqlite3WalOpenSnapshot gets a read lock and
+** preserves the current state even if the other threads or processes
+** write to or checkpoint the WAL. sqlite3WalCloseSnapshot() closes the
+** transaction and releases the lock.
+*/
+SQLITE_PRIVATE int sqlite3WalBeginReadTransaction(Wal *pWal, int *);
+SQLITE_PRIVATE void sqlite3WalEndReadTransaction(Wal *pWal);
+
+/* Read a page from the write-ahead log, if it is present. */
+SQLITE_PRIVATE int sqlite3WalFindFrame(Wal *, Pgno, u32 *);
+SQLITE_PRIVATE int sqlite3WalReadFrame(Wal *, u32, int, u8 *);
+
+/* If the WAL is not empty, return the size of the database. */
+SQLITE_PRIVATE Pgno sqlite3WalDbsize(Wal *pWal);
+
+/* Obtain or release the WRITER lock. */
+SQLITE_PRIVATE int sqlite3WalBeginWriteTransaction(Wal *pWal);
+SQLITE_PRIVATE int sqlite3WalEndWriteTransaction(Wal *pWal);
+
+/* Undo any frames written (but not committed) to the log */
+SQLITE_PRIVATE int sqlite3WalUndo(Wal *pWal, int (*xUndo)(void *, Pgno), void *pUndoCtx);
+
+/* Return an integer that records the current (uncommitted) write
+** position in the WAL */
+SQLITE_PRIVATE void sqlite3WalSavepoint(Wal *pWal, u32 *aWalData);
+
+/* Move the write position of the WAL back to iFrame. Called in
+** response to a ROLLBACK TO command. */
+SQLITE_PRIVATE int sqlite3WalSavepointUndo(Wal *pWal, u32 *aWalData);
+
+/* Write a frame or frames to the log. */
+SQLITE_PRIVATE int sqlite3WalFrames(Wal *pWal, int, PgHdr *, Pgno, int, int);
+
+/* Copy pages from the log to the database file */
+SQLITE_PRIVATE int sqlite3WalCheckpoint(
+ Wal *pWal, /* Write-ahead log connection */
+ sqlite3 *db, /* Check this handle's interrupt flag */
+ int eMode, /* One of PASSIVE, FULL and RESTART */
+ int (*xBusy)(void*), /* Function to call when busy */
+ void *pBusyArg, /* Context argument for xBusyHandler */
+ int sync_flags, /* Flags to sync db file with (or 0) */
+ int nBuf, /* Size of buffer nBuf */
+ u8 *zBuf, /* Temporary buffer to use */
+ int *pnLog, /* OUT: Number of frames in WAL */
+ int *pnCkpt /* OUT: Number of backfilled frames in WAL */
+);
+
+/* Return the value to pass to a sqlite3_wal_hook callback, the
+** number of frames in the WAL at the point of the last commit since
+** sqlite3WalCallback() was called. If no commits have occurred since
+** the last call, then return 0.
+*/
+SQLITE_PRIVATE int sqlite3WalCallback(Wal *pWal);
+
+/* Tell the wal layer that an EXCLUSIVE lock has been obtained (or released)
+** by the pager layer on the database file.
+*/
+SQLITE_PRIVATE int sqlite3WalExclusiveMode(Wal *pWal, int op);
+
+/* Return true if the argument is non-NULL and the WAL module is using
+** heap-memory for the wal-index. Otherwise, if the argument is NULL or the
+** WAL module is using shared-memory, return false.
+*/
+SQLITE_PRIVATE int sqlite3WalHeapMemory(Wal *pWal);
+
+#ifdef SQLITE_ENABLE_SNAPSHOT
+SQLITE_PRIVATE int sqlite3WalSnapshotGet(Wal *pWal, sqlite3_snapshot **ppSnapshot);
+SQLITE_PRIVATE void sqlite3WalSnapshotOpen(Wal *pWal, sqlite3_snapshot *pSnapshot);
+SQLITE_PRIVATE int sqlite3WalSnapshotRecover(Wal *pWal);
+SQLITE_PRIVATE int sqlite3WalSnapshotCheck(Wal *pWal, sqlite3_snapshot *pSnapshot);
+SQLITE_PRIVATE void sqlite3WalSnapshotUnlock(Wal *pWal);
+#endif
+
+#ifdef SQLITE_ENABLE_ZIPVFS
+/* If the WAL file is not empty, return the number of bytes of content
+** stored in each frame (i.e. the db page-size when the WAL was created).
+*/
+SQLITE_PRIVATE int sqlite3WalFramesize(Wal *pWal);
+#endif
+
+/* Return the sqlite3_file object for the WAL file */
+SQLITE_PRIVATE sqlite3_file *sqlite3WalFile(Wal *pWal);
+
+#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
+SQLITE_PRIVATE int sqlite3WalWriteLock(Wal *pWal, int bLock);
+SQLITE_PRIVATE void sqlite3WalDb(Wal *pWal, sqlite3 *db);
+#endif
+
+#ifdef SQLITE_USE_SEH
+SQLITE_PRIVATE int sqlite3WalSystemErrno(Wal*);
+#endif
+
+#endif /* ifndef SQLITE_OMIT_WAL */
+#endif /* SQLITE_WAL_H */
+
+/************** End of wal.h *************************************************/
+/************** Continuing where we left off in pager.c **********************/
+
+
+/******************* NOTES ON THE DESIGN OF THE PAGER ************************
+**
+** This comment block describes invariants that hold when using a rollback
+** journal. These invariants do not apply for journal_mode=WAL,
+** journal_mode=MEMORY, or journal_mode=OFF.
+**
+** Within this comment block, a page is deemed to have been synced
+** automatically as soon as it is written when PRAGMA synchronous=OFF.
+** Otherwise, the page is not synced until the xSync method of the VFS
+** is called successfully on the file containing the page.
+**
+** Definition: A page of the database file is said to be "overwriteable" if
+** one or more of the following are true about the page:
+**
+** (a) The original content of the page as it was at the beginning of
+** the transaction has been written into the rollback journal and
+** synced.
+**
+** (b) The page was a freelist leaf page at the start of the transaction.
+**
+** (c) The page number is greater than the largest page that existed in
+** the database file at the start of the transaction.
+**
+** (1) A page of the database file is never overwritten unless one of the
+** following are true:
+**
+** (a) The page and all other pages on the same sector are overwriteable.
+**
+** (b) The atomic page write optimization is enabled, and the entire
+** transaction other than the update of the transaction sequence
+** number consists of a single page change.
+**
+** (2) The content of a page written into the rollback journal exactly matches
+** both the content in the database when the rollback journal was written
+** and the content in the database at the beginning of the current
+** transaction.
+**
+** (3) Writes to the database file are an integer multiple of the page size
+** in length and are aligned on a page boundary.
+**
+** (4) Reads from the database file are either aligned on a page boundary and
+** an integer multiple of the page size in length or are taken from the
+** first 100 bytes of the database file.
+**
+** (5) All writes to the database file are synced prior to the rollback journal
+** being deleted, truncated, or zeroed.
+**
+** (6) If a super-journal file is used, then all writes to the database file
+** are synced prior to the super-journal being deleted.
+**
+** Definition: Two databases (or the same database at two points it time)
+** are said to be "logically equivalent" if they give the same answer to
+** all queries. Note in particular the content of freelist leaf
+** pages can be changed arbitrarily without affecting the logical equivalence
+** of the database.
+**
+** (7) At any time, if any subset, including the empty set and the total set,
+** of the unsynced changes to a rollback journal are removed and the
+** journal is rolled back, the resulting database file will be logically
+** equivalent to the database file at the beginning of the transaction.
+**
+** (8) When a transaction is rolled back, the xTruncate method of the VFS
+** is called to restore the database file to the same size it was at
+** the beginning of the transaction. (In some VFSes, the xTruncate
+** method is a no-op, but that does not change the fact the SQLite will
+** invoke it.)
+**
+** (9) Whenever the database file is modified, at least one bit in the range
+** of bytes from 24 through 39 inclusive will be changed prior to releasing
+** the EXCLUSIVE lock, thus signaling other connections on the same
+** database to flush their caches.
+**
+** (10) The pattern of bits in bytes 24 through 39 shall not repeat in less
+** than one billion transactions.
+**
+** (11) A database file is well-formed at the beginning and at the conclusion
+** of every transaction.
+**
+** (12) An EXCLUSIVE lock is held on the database file when writing to
+** the database file.
+**
+** (13) A SHARED lock is held on the database file while reading any
+** content out of the database file.
+**
+******************************************************************************/
+
+/*
+** Macros for troubleshooting. Normally turned off
+*/
+#if 0
+int sqlite3PagerTrace=1; /* True to enable tracing */
+#define sqlite3DebugPrintf printf
+#define PAGERTRACE(X) if( sqlite3PagerTrace ){ sqlite3DebugPrintf X; }
+#else
+#define PAGERTRACE(X)
+#endif
+
+/*
+** The following two macros are used within the PAGERTRACE() macros above
+** to print out file-descriptors.
+**
+** PAGERID() takes a pointer to a Pager struct as its argument. The
+** associated file-descriptor is returned. FILEHANDLEID() takes an sqlite3_file
+** struct as its argument.
+*/
+#define PAGERID(p) (SQLITE_PTR_TO_INT(p->fd))
+#define FILEHANDLEID(fd) (SQLITE_PTR_TO_INT(fd))
+
+/*
+** The Pager.eState variable stores the current 'state' of a pager. A
+** pager may be in any one of the seven states shown in the following
+** state diagram.
+**
+** OPEN <------+------+
+** | | |
+** V | |
+** +---------> READER-------+ |
+** | | |
+** | V |
+** |<-------WRITER_LOCKED------> ERROR
+** | | ^
+** | V |
+** |<------WRITER_CACHEMOD-------->|
+** | | |
+** | V |
+** |<-------WRITER_DBMOD---------->|
+** | | |
+** | V |
+** +<------WRITER_FINISHED-------->+
+**
+**
+** List of state transitions and the C [function] that performs each:
+**
+** OPEN -> READER [sqlite3PagerSharedLock]
+** READER -> OPEN [pager_unlock]
+**
+** READER -> WRITER_LOCKED [sqlite3PagerBegin]
+** WRITER_LOCKED -> WRITER_CACHEMOD [pager_open_journal]
+** WRITER_CACHEMOD -> WRITER_DBMOD [syncJournal]
+** WRITER_DBMOD -> WRITER_FINISHED [sqlite3PagerCommitPhaseOne]
+** WRITER_*** -> READER [pager_end_transaction]
+**
+** WRITER_*** -> ERROR [pager_error]
+** ERROR -> OPEN [pager_unlock]
+**
+**
+** OPEN:
+**
+** The pager starts up in this state. Nothing is guaranteed in this
+** state - the file may or may not be locked and the database size is
+** unknown. The database may not be read or written.
+**
+** * No read or write transaction is active.
+** * Any lock, or no lock at all, may be held on the database file.
+** * The dbSize, dbOrigSize and dbFileSize variables may not be trusted.
+**
+** READER:
+**
+** In this state all the requirements for reading the database in
+** rollback (non-WAL) mode are met. Unless the pager is (or recently
+** was) in exclusive-locking mode, a user-level read transaction is
+** open. The database size is known in this state.
+**
+** A connection running with locking_mode=normal enters this state when
+** it opens a read-transaction on the database and returns to state
+** OPEN after the read-transaction is completed. However a connection
+** running in locking_mode=exclusive (including temp databases) remains in
+** this state even after the read-transaction is closed. The only way
+** a locking_mode=exclusive connection can transition from READER to OPEN
+** is via the ERROR state (see below).
+**
+** * A read transaction may be active (but a write-transaction cannot).
+** * A SHARED or greater lock is held on the database file.
+** * The dbSize variable may be trusted (even if a user-level read
+** transaction is not active). The dbOrigSize and dbFileSize variables
+** may not be trusted at this point.
+** * If the database is a WAL database, then the WAL connection is open.
+** * Even if a read-transaction is not open, it is guaranteed that
+** there is no hot-journal in the file-system.
+**
+** WRITER_LOCKED:
+**
+** The pager moves to this state from READER when a write-transaction
+** is first opened on the database. In WRITER_LOCKED state, all locks
+** required to start a write-transaction are held, but no actual
+** modifications to the cache or database have taken place.
+**
+** In rollback mode, a RESERVED or (if the transaction was opened with
+** BEGIN EXCLUSIVE) EXCLUSIVE lock is obtained on the database file when
+** moving to this state, but the journal file is not written to or opened
+** to in this state. If the transaction is committed or rolled back while
+** in WRITER_LOCKED state, all that is required is to unlock the database
+** file.
+**
+** IN WAL mode, WalBeginWriteTransaction() is called to lock the log file.
+** If the connection is running with locking_mode=exclusive, an attempt
+** is made to obtain an EXCLUSIVE lock on the database file.
+**
+** * A write transaction is active.
+** * If the connection is open in rollback-mode, a RESERVED or greater
+** lock is held on the database file.
+** * If the connection is open in WAL-mode, a WAL write transaction
+** is open (i.e. sqlite3WalBeginWriteTransaction() has been successfully
+** called).
+** * The dbSize, dbOrigSize and dbFileSize variables are all valid.
+** * The contents of the pager cache have not been modified.
+** * The journal file may or may not be open.
+** * Nothing (not even the first header) has been written to the journal.
+**
+** WRITER_CACHEMOD:
+**
+** A pager moves from WRITER_LOCKED state to this state when a page is
+** first modified by the upper layer. In rollback mode the journal file
+** is opened (if it is not already open) and a header written to the
+** start of it. The database file on disk has not been modified.
+**
+** * A write transaction is active.
+** * A RESERVED or greater lock is held on the database file.
+** * The journal file is open and the first header has been written
+** to it, but the header has not been synced to disk.
+** * The contents of the page cache have been modified.
+**
+** WRITER_DBMOD:
+**
+** The pager transitions from WRITER_CACHEMOD into WRITER_DBMOD state
+** when it modifies the contents of the database file. WAL connections
+** never enter this state (since they do not modify the database file,
+** just the log file).
+**
+** * A write transaction is active.
+** * An EXCLUSIVE or greater lock is held on the database file.
+** * The journal file is open and the first header has been written
+** and synced to disk.
+** * The contents of the page cache have been modified (and possibly
+** written to disk).
+**
+** WRITER_FINISHED:
+**
+** It is not possible for a WAL connection to enter this state.
+**
+** A rollback-mode pager changes to WRITER_FINISHED state from WRITER_DBMOD
+** state after the entire transaction has been successfully written into the
+** database file. In this state the transaction may be committed simply
+** by finalizing the journal file. Once in WRITER_FINISHED state, it is
+** not possible to modify the database further. At this point, the upper
+** layer must either commit or rollback the transaction.
+**
+** * A write transaction is active.
+** * An EXCLUSIVE or greater lock is held on the database file.
+** * All writing and syncing of journal and database data has finished.
+** If no error occurred, all that remains is to finalize the journal to
+** commit the transaction. If an error did occur, the caller will need
+** to rollback the transaction.
+**
+** ERROR:
+**
+** The ERROR state is entered when an IO or disk-full error (including
+** SQLITE_IOERR_NOMEM) occurs at a point in the code that makes it
+** difficult to be sure that the in-memory pager state (cache contents,
+** db size etc.) are consistent with the contents of the file-system.
+**
+** Temporary pager files may enter the ERROR state, but in-memory pagers
+** cannot.
+**
+** For example, if an IO error occurs while performing a rollback,
+** the contents of the page-cache may be left in an inconsistent state.
+** At this point it would be dangerous to change back to READER state
+** (as usually happens after a rollback). Any subsequent readers might
+** report database corruption (due to the inconsistent cache), and if
+** they upgrade to writers, they may inadvertently corrupt the database
+** file. To avoid this hazard, the pager switches into the ERROR state
+** instead of READER following such an error.
+**
+** Once it has entered the ERROR state, any attempt to use the pager
+** to read or write data returns an error. Eventually, once all
+** outstanding transactions have been abandoned, the pager is able to
+** transition back to OPEN state, discarding the contents of the
+** page-cache and any other in-memory state at the same time. Everything
+** is reloaded from disk (and, if necessary, hot-journal rollback performed)
+** when a read-transaction is next opened on the pager (transitioning
+** the pager into READER state). At that point the system has recovered
+** from the error.
+**
+** Specifically, the pager jumps into the ERROR state if:
+**
+** 1. An error occurs while attempting a rollback. This happens in
+** function sqlite3PagerRollback().
+**
+** 2. An error occurs while attempting to finalize a journal file
+** following a commit in function sqlite3PagerCommitPhaseTwo().
+**
+** 3. An error occurs while attempting to write to the journal or
+** database file in function pagerStress() in order to free up
+** memory.
+**
+** In other cases, the error is returned to the b-tree layer. The b-tree
+** layer then attempts a rollback operation. If the error condition
+** persists, the pager enters the ERROR state via condition (1) above.
+**
+** Condition (3) is necessary because it can be triggered by a read-only
+** statement executed within a transaction. In this case, if the error
+** code were simply returned to the user, the b-tree layer would not
+** automatically attempt a rollback, as it assumes that an error in a
+** read-only statement cannot leave the pager in an internally inconsistent
+** state.
+**
+** * The Pager.errCode variable is set to something other than SQLITE_OK.
+** * There are one or more outstanding references to pages (after the
+** last reference is dropped the pager should move back to OPEN state).
+** * The pager is not an in-memory pager.
+**
+**
+** Notes:
+**
+** * A pager is never in WRITER_DBMOD or WRITER_FINISHED state if the
+** connection is open in WAL mode. A WAL connection is always in one
+** of the first four states.
+**
+** * Normally, a connection open in exclusive mode is never in PAGER_OPEN
+** state. There are two exceptions: immediately after exclusive-mode has
+** been turned on (and before any read or write transactions are
+** executed), and when the pager is leaving the "error state".
+**
+** * See also: assert_pager_state().
+*/
+#define PAGER_OPEN 0
+#define PAGER_READER 1
+#define PAGER_WRITER_LOCKED 2
+#define PAGER_WRITER_CACHEMOD 3
+#define PAGER_WRITER_DBMOD 4
+#define PAGER_WRITER_FINISHED 5
+#define PAGER_ERROR 6
+
+/*
+** The Pager.eLock variable is almost always set to one of the
+** following locking-states, according to the lock currently held on
+** the database file: NO_LOCK, SHARED_LOCK, RESERVED_LOCK or EXCLUSIVE_LOCK.
+** This variable is kept up to date as locks are taken and released by
+** the pagerLockDb() and pagerUnlockDb() wrappers.
+**
+** If the VFS xLock() or xUnlock() returns an error other than SQLITE_BUSY
+** (i.e. one of the SQLITE_IOERR subtypes), it is not clear whether or not
+** the operation was successful. In these circumstances pagerLockDb() and
+** pagerUnlockDb() take a conservative approach - eLock is always updated
+** when unlocking the file, and only updated when locking the file if the
+** VFS call is successful. This way, the Pager.eLock variable may be set
+** to a less exclusive (lower) value than the lock that is actually held
+** at the system level, but it is never set to a more exclusive value.
+**
+** This is usually safe. If an xUnlock fails or appears to fail, there may
+** be a few redundant xLock() calls or a lock may be held for longer than
+** required, but nothing really goes wrong.
+**
+** The exception is when the database file is unlocked as the pager moves
+** from ERROR to OPEN state. At this point there may be a hot-journal file
+** in the file-system that needs to be rolled back (as part of an OPEN->SHARED
+** transition, by the same pager or any other). If the call to xUnlock()
+** fails at this point and the pager is left holding an EXCLUSIVE lock, this
+** can confuse the call to xCheckReservedLock() call made later as part
+** of hot-journal detection.
+**
+** xCheckReservedLock() is defined as returning true "if there is a RESERVED
+** lock held by this process or any others". So xCheckReservedLock may
+** return true because the caller itself is holding an EXCLUSIVE lock (but
+** doesn't know it because of a previous error in xUnlock). If this happens
+** a hot-journal may be mistaken for a journal being created by an active
+** transaction in another process, causing SQLite to read from the database
+** without rolling it back.
+**
+** To work around this, if a call to xUnlock() fails when unlocking the
+** database in the ERROR state, Pager.eLock is set to UNKNOWN_LOCK. It
+** is only changed back to a real locking state after a successful call
+** to xLock(EXCLUSIVE). Also, the code to do the OPEN->SHARED state transition
+** omits the check for a hot-journal if Pager.eLock is set to UNKNOWN_LOCK
+** lock. Instead, it assumes a hot-journal exists and obtains an EXCLUSIVE
+** lock on the database file before attempting to roll it back. See function
+** PagerSharedLock() for more detail.
+**
+** Pager.eLock may only be set to UNKNOWN_LOCK when the pager is in
+** PAGER_OPEN state.
+*/
+#define UNKNOWN_LOCK (EXCLUSIVE_LOCK+1)
+
+/*
+** The maximum allowed sector size. 64KiB. If the xSectorsize() method
+** returns a value larger than this, then MAX_SECTOR_SIZE is used instead.
+** This could conceivably cause corruption following a power failure on
+** such a system. This is currently an undocumented limit.
+*/
+#define MAX_SECTOR_SIZE 0x10000
+
+
+/*
+** An instance of the following structure is allocated for each active
+** savepoint and statement transaction in the system. All such structures
+** are stored in the Pager.aSavepoint[] array, which is allocated and
+** resized using sqlite3Realloc().
+**
+** When a savepoint is created, the PagerSavepoint.iHdrOffset field is
+** set to 0. If a journal-header is written into the main journal while
+** the savepoint is active, then iHdrOffset is set to the byte offset
+** immediately following the last journal record written into the main
+** journal before the journal-header. This is required during savepoint
+** rollback (see pagerPlaybackSavepoint()).
+*/
+typedef struct PagerSavepoint PagerSavepoint;
+struct PagerSavepoint {
+ i64 iOffset; /* Starting offset in main journal */
+ i64 iHdrOffset; /* See above */
+ Bitvec *pInSavepoint; /* Set of pages in this savepoint */
+ Pgno nOrig; /* Original number of pages in file */
+ Pgno iSubRec; /* Index of first record in sub-journal */
+ int bTruncateOnRelease; /* If stmt journal may be truncated on RELEASE */
+#ifndef SQLITE_OMIT_WAL
+ u32 aWalData[WAL_SAVEPOINT_NDATA]; /* WAL savepoint context */
+#endif
+};
+
+/*
+** Bits of the Pager.doNotSpill flag. See further description below.
+*/
+#define SPILLFLAG_OFF 0x01 /* Never spill cache. Set via pragma */
+#define SPILLFLAG_ROLLBACK 0x02 /* Current rolling back, so do not spill */
+#define SPILLFLAG_NOSYNC 0x04 /* Spill is ok, but do not sync */
+
+/*
+** An open page cache is an instance of struct Pager. A description of
+** some of the more important member variables follows:
+**
+** eState
+**
+** The current 'state' of the pager object. See the comment and state
+** diagram above for a description of the pager state.
+**
+** eLock
+**
+** For a real on-disk database, the current lock held on the database file -
+** NO_LOCK, SHARED_LOCK, RESERVED_LOCK or EXCLUSIVE_LOCK.
+**
+** For a temporary or in-memory database (neither of which require any
+** locks), this variable is always set to EXCLUSIVE_LOCK. Since such
+** databases always have Pager.exclusiveMode==1, this tricks the pager
+** logic into thinking that it already has all the locks it will ever
+** need (and no reason to release them).
+**
+** In some (obscure) circumstances, this variable may also be set to
+** UNKNOWN_LOCK. See the comment above the #define of UNKNOWN_LOCK for
+** details.
+**
+** changeCountDone
+**
+** This boolean variable is used to make sure that the change-counter
+** (the 4-byte header field at byte offset 24 of the database file) is
+** not updated more often than necessary.
+**
+** It is set to true when the change-counter field is updated, which
+** can only happen if an exclusive lock is held on the database file.
+** It is cleared (set to false) whenever an exclusive lock is
+** relinquished on the database file. Each time a transaction is committed,
+** The changeCountDone flag is inspected. If it is true, the work of
+** updating the change-counter is omitted for the current transaction.
+**
+** This mechanism means that when running in exclusive mode, a connection
+** need only update the change-counter once, for the first transaction
+** committed.
+**
+** setSuper
+**
+** When PagerCommitPhaseOne() is called to commit a transaction, it may
+** (or may not) specify a super-journal name to be written into the
+** journal file before it is synced to disk.
+**
+** Whether or not a journal file contains a super-journal pointer affects
+** the way in which the journal file is finalized after the transaction is
+** committed or rolled back when running in "journal_mode=PERSIST" mode.
+** If a journal file does not contain a super-journal pointer, it is
+** finalized by overwriting the first journal header with zeroes. If
+** it does contain a super-journal pointer the journal file is finalized
+** by truncating it to zero bytes, just as if the connection were
+** running in "journal_mode=truncate" mode.
+**
+** Journal files that contain super-journal pointers cannot be finalized
+** simply by overwriting the first journal-header with zeroes, as the
+** super-journal pointer could interfere with hot-journal rollback of any
+** subsequently interrupted transaction that reuses the journal file.
+**
+** The flag is cleared as soon as the journal file is finalized (either
+** by PagerCommitPhaseTwo or PagerRollback). If an IO error prevents the
+** journal file from being successfully finalized, the setSuper flag
+** is cleared anyway (and the pager will move to ERROR state).
+**
+** doNotSpill
+**
+** This variables control the behavior of cache-spills (calls made by
+** the pcache module to the pagerStress() routine to write cached data
+** to the file-system in order to free up memory).
+**
+** When bits SPILLFLAG_OFF or SPILLFLAG_ROLLBACK of doNotSpill are set,
+** writing to the database from pagerStress() is disabled altogether.
+** The SPILLFLAG_ROLLBACK case is done in a very obscure case that
+** comes up during savepoint rollback that requires the pcache module
+** to allocate a new page to prevent the journal file from being written
+** while it is being traversed by code in pager_playback(). The SPILLFLAG_OFF
+** case is a user preference.
+**
+** If the SPILLFLAG_NOSYNC bit is set, writing to the database from
+** pagerStress() is permitted, but syncing the journal file is not.
+** This flag is set by sqlite3PagerWrite() when the file-system sector-size
+** is larger than the database page-size in order to prevent a journal sync
+** from happening in between the journalling of two pages on the same sector.
+**
+** subjInMemory
+**
+** This is a boolean variable. If true, then any required sub-journal
+** is opened as an in-memory journal file. If false, then in-memory
+** sub-journals are only used for in-memory pager files.
+**
+** This variable is updated by the upper layer each time a new
+** write-transaction is opened.
+**
+** dbSize, dbOrigSize, dbFileSize
+**
+** Variable dbSize is set to the number of pages in the database file.
+** It is valid in PAGER_READER and higher states (all states except for
+** OPEN and ERROR).
+**
+** dbSize is set based on the size of the database file, which may be
+** larger than the size of the database (the value stored at offset
+** 28 of the database header by the btree). If the size of the file
+** is not an integer multiple of the page-size, the value stored in
+** dbSize is rounded down (i.e. a 5KB file with 2K page-size has dbSize==2).
+** Except, any file that is greater than 0 bytes in size is considered
+** to have at least one page. (i.e. a 1KB file with 2K page-size leads
+** to dbSize==1).
+**
+** During a write-transaction, if pages with page-numbers greater than
+** dbSize are modified in the cache, dbSize is updated accordingly.
+** Similarly, if the database is truncated using PagerTruncateImage(),
+** dbSize is updated.
+**
+** Variables dbOrigSize and dbFileSize are valid in states
+** PAGER_WRITER_LOCKED and higher. dbOrigSize is a copy of the dbSize
+** variable at the start of the transaction. It is used during rollback,
+** and to determine whether or not pages need to be journalled before
+** being modified.
+**
+** Throughout a write-transaction, dbFileSize contains the size of
+** the file on disk in pages. It is set to a copy of dbSize when the
+** write-transaction is first opened, and updated when VFS calls are made
+** to write or truncate the database file on disk.
+**
+** The only reason the dbFileSize variable is required is to suppress
+** unnecessary calls to xTruncate() after committing a transaction. If,
+** when a transaction is committed, the dbFileSize variable indicates
+** that the database file is larger than the database image (Pager.dbSize),
+** pager_truncate() is called. The pager_truncate() call uses xFilesize()
+** to measure the database file on disk, and then truncates it if required.
+** dbFileSize is not used when rolling back a transaction. In this case
+** pager_truncate() is called unconditionally (which means there may be
+** a call to xFilesize() that is not strictly required). In either case,
+** pager_truncate() may cause the file to become smaller or larger.
+**
+** dbHintSize
+**
+** The dbHintSize variable is used to limit the number of calls made to
+** the VFS xFileControl(FCNTL_SIZE_HINT) method.
+**
+** dbHintSize is set to a copy of the dbSize variable when a
+** write-transaction is opened (at the same time as dbFileSize and
+** dbOrigSize). If the xFileControl(FCNTL_SIZE_HINT) method is called,
+** dbHintSize is increased to the number of pages that correspond to the
+** size-hint passed to the method call. See pager_write_pagelist() for
+** details.
+**
+** errCode
+**
+** The Pager.errCode variable is only ever used in PAGER_ERROR state. It
+** is set to zero in all other states. In PAGER_ERROR state, Pager.errCode
+** is always set to SQLITE_FULL, SQLITE_IOERR or one of the SQLITE_IOERR_XXX
+** sub-codes.
+**
+** syncFlags, walSyncFlags
+**
+** syncFlags is either SQLITE_SYNC_NORMAL (0x02) or SQLITE_SYNC_FULL (0x03).
+** syncFlags is used for rollback mode. walSyncFlags is used for WAL mode
+** and contains the flags used to sync the checkpoint operations in the
+** lower two bits, and sync flags used for transaction commits in the WAL
+** file in bits 0x04 and 0x08. In other words, to get the correct sync flags
+** for checkpoint operations, use (walSyncFlags&0x03) and to get the correct
+** sync flags for transaction commit, use ((walSyncFlags>>2)&0x03). Note
+** that with synchronous=NORMAL in WAL mode, transaction commit is not synced
+** meaning that the 0x04 and 0x08 bits are both zero.
+*/
+struct Pager {
+ sqlite3_vfs *pVfs; /* OS functions to use for IO */
+ u8 exclusiveMode; /* Boolean. True if locking_mode==EXCLUSIVE */
+ u8 journalMode; /* One of the PAGER_JOURNALMODE_* values */
+ u8 useJournal; /* Use a rollback journal on this file */
+ u8 noSync; /* Do not sync the journal if true */
+ u8 fullSync; /* Do extra syncs of the journal for robustness */
+ u8 extraSync; /* sync directory after journal delete */
+ u8 syncFlags; /* SYNC_NORMAL or SYNC_FULL otherwise */
+ u8 walSyncFlags; /* See description above */
+ u8 tempFile; /* zFilename is a temporary or immutable file */
+ u8 noLock; /* Do not lock (except in WAL mode) */
+ u8 readOnly; /* True for a read-only database */
+ u8 memDb; /* True to inhibit all file I/O */
+ u8 memVfs; /* VFS-implemented memory database */
+
+ /**************************************************************************
+ ** The following block contains those class members that change during
+ ** routine operation. Class members not in this block are either fixed
+ ** when the pager is first created or else only change when there is a
+ ** significant mode change (such as changing the page_size, locking_mode,
+ ** or the journal_mode). From another view, these class members describe
+ ** the "state" of the pager, while other class members describe the
+ ** "configuration" of the pager.
+ */
+ u8 eState; /* Pager state (OPEN, READER, WRITER_LOCKED..) */
+ u8 eLock; /* Current lock held on database file */
+ u8 changeCountDone; /* Set after incrementing the change-counter */
+ u8 setSuper; /* Super-jrnl name is written into jrnl */
+ u8 doNotSpill; /* Do not spill the cache when non-zero */
+ u8 subjInMemory; /* True to use in-memory sub-journals */
+ u8 bUseFetch; /* True to use xFetch() */
+ u8 hasHeldSharedLock; /* True if a shared lock has ever been held */
+ Pgno dbSize; /* Number of pages in the database */
+ Pgno dbOrigSize; /* dbSize before the current transaction */
+ Pgno dbFileSize; /* Number of pages in the database file */
+ Pgno dbHintSize; /* Value passed to FCNTL_SIZE_HINT call */
+ int errCode; /* One of several kinds of errors */
+ int nRec; /* Pages journalled since last j-header written */
+ u32 cksumInit; /* Quasi-random value added to every checksum */
+ u32 nSubRec; /* Number of records written to sub-journal */
+ Bitvec *pInJournal; /* One bit for each page in the database file */
+ sqlite3_file *fd; /* File descriptor for database */
+ sqlite3_file *jfd; /* File descriptor for main journal */
+ sqlite3_file *sjfd; /* File descriptor for sub-journal */
+ i64 journalOff; /* Current write offset in the journal file */
+ i64 journalHdr; /* Byte offset to previous journal header */
+ sqlite3_backup *pBackup; /* Pointer to list of ongoing backup processes */
+ PagerSavepoint *aSavepoint; /* Array of active savepoints */
+ int nSavepoint; /* Number of elements in aSavepoint[] */
+ u32 iDataVersion; /* Changes whenever database content changes */
+ char dbFileVers[16]; /* Changes whenever database file changes */
+
+ int nMmapOut; /* Number of mmap pages currently outstanding */
+ sqlite3_int64 szMmap; /* Desired maximum mmap size */
+ PgHdr *pMmapFreelist; /* List of free mmap page headers (pDirty) */
+ /*
+ ** End of the routinely-changing class members
+ ***************************************************************************/
+
+ u16 nExtra; /* Add this many bytes to each in-memory page */
+ i16 nReserve; /* Number of unused bytes at end of each page */
+ u32 vfsFlags; /* Flags for sqlite3_vfs.xOpen() */
+ u32 sectorSize; /* Assumed sector size during rollback */
+ Pgno mxPgno; /* Maximum allowed size of the database */
+ Pgno lckPgno; /* Page number for the locking page */
+ i64 pageSize; /* Number of bytes in a page */
+ i64 journalSizeLimit; /* Size limit for persistent journal files */
+ char *zFilename; /* Name of the database file */
+ char *zJournal; /* Name of the journal file */
+ int (*xBusyHandler)(void*); /* Function to call when busy */
+ void *pBusyHandlerArg; /* Context argument for xBusyHandler */
+ u32 aStat[4]; /* Total cache hits, misses, writes, spills */
+#ifdef SQLITE_TEST
+ int nRead; /* Database pages read */
+#endif
+ void (*xReiniter)(DbPage*); /* Call this routine when reloading pages */
+ int (*xGet)(Pager*,Pgno,DbPage**,int); /* Routine to fetch a patch */
+ char *pTmpSpace; /* Pager.pageSize bytes of space for tmp use */
+ PCache *pPCache; /* Pointer to page cache object */
+#ifndef SQLITE_OMIT_WAL
+ Wal *pWal; /* Write-ahead log used by "journal_mode=wal" */
+ char *zWal; /* File name for write-ahead log */
+#endif
+};
+
+/*
+** Indexes for use with Pager.aStat[]. The Pager.aStat[] array contains
+** the values accessed by passing SQLITE_DBSTATUS_CACHE_HIT, CACHE_MISS
+** or CACHE_WRITE to sqlite3_db_status().
+*/
+#define PAGER_STAT_HIT 0
+#define PAGER_STAT_MISS 1
+#define PAGER_STAT_WRITE 2
+#define PAGER_STAT_SPILL 3
+
+/*
+** The following global variables hold counters used for
+** testing purposes only. These variables do not exist in
+** a non-testing build. These variables are not thread-safe.
+*/
+#ifdef SQLITE_TEST
+SQLITE_API int sqlite3_pager_readdb_count = 0; /* Number of full pages read from DB */
+SQLITE_API int sqlite3_pager_writedb_count = 0; /* Number of full pages written to DB */
+SQLITE_API int sqlite3_pager_writej_count = 0; /* Number of pages written to journal */
+# define PAGER_INCR(v) v++
+#else
+# define PAGER_INCR(v)
+#endif
+
+
+
+/*
+** Journal files begin with the following magic string. The data
+** was obtained from /dev/random. It is used only as a sanity check.
+**
+** Since version 2.8.0, the journal format contains additional sanity
+** checking information. If the power fails while the journal is being
+** written, semi-random garbage data might appear in the journal
+** file after power is restored. If an attempt is then made
+** to roll the journal back, the database could be corrupted. The additional
+** sanity checking data is an attempt to discover the garbage in the
+** journal and ignore it.
+**
+** The sanity checking information for the new journal format consists
+** of a 32-bit checksum on each page of data. The checksum covers both
+** the page number and the pPager->pageSize bytes of data for the page.
+** This cksum is initialized to a 32-bit random value that appears in the
+** journal file right after the header. The random initializer is important,
+** because garbage data that appears at the end of a journal is likely
+** data that was once in other files that have now been deleted. If the
+** garbage data came from an obsolete journal file, the checksums might
+** be correct. But by initializing the checksum to random value which
+** is different for every journal, we minimize that risk.
+*/
+static const unsigned char aJournalMagic[] = {
+ 0xd9, 0xd5, 0x05, 0xf9, 0x20, 0xa1, 0x63, 0xd7,
+};
+
+/*
+** The size of the of each page record in the journal is given by
+** the following macro.
+*/
+#define JOURNAL_PG_SZ(pPager) ((pPager->pageSize) + 8)
+
+/*
+** The journal header size for this pager. This is usually the same
+** size as a single disk sector. See also setSectorSize().
+*/
+#define JOURNAL_HDR_SZ(pPager) (pPager->sectorSize)
+
+/*
+** The macro MEMDB is true if we are dealing with an in-memory database.
+** We do this as a macro so that if the SQLITE_OMIT_MEMORYDB macro is set,
+** the value of MEMDB will be a constant and the compiler will optimize
+** out code that would never execute.
+*/
+#ifdef SQLITE_OMIT_MEMORYDB
+# define MEMDB 0
+#else
+# define MEMDB pPager->memDb
+#endif
+
+/*
+** The macro USEFETCH is true if we are allowed to use the xFetch and xUnfetch
+** interfaces to access the database using memory-mapped I/O.
+*/
+#if SQLITE_MAX_MMAP_SIZE>0
+# define USEFETCH(x) ((x)->bUseFetch)
+#else
+# define USEFETCH(x) 0
+#endif
+
+#ifdef SQLITE_DIRECT_OVERFLOW_READ
+/*
+** Return true if page pgno can be read directly from the database file
+** by the b-tree layer. This is the case if:
+**
+** (1) the database file is open
+** (2) the VFS for the database is able to do unaligned sub-page reads
+** (3) there are no dirty pages in the cache, and
+** (4) the desired page is not currently in the wal file.
+*/
+SQLITE_PRIVATE int sqlite3PagerDirectReadOk(Pager *pPager, Pgno pgno){
+ assert( pPager!=0 );
+ assert( pPager->fd!=0 );
+ if( pPager->fd->pMethods==0 ) return 0; /* Case (1) */
+ if( sqlite3PCacheIsDirty(pPager->pPCache) ) return 0; /* Failed (3) */
+#ifndef SQLITE_OMIT_WAL
+ if( pPager->pWal ){
+ u32 iRead = 0;
+ (void)sqlite3WalFindFrame(pPager->pWal, pgno, &iRead);
+ if( iRead ) return 0; /* Case (4) */
+ }
+#endif
+ assert( pPager->fd->pMethods->xDeviceCharacteristics!=0 );
+ if( (pPager->fd->pMethods->xDeviceCharacteristics(pPager->fd)
+ & SQLITE_IOCAP_SUBPAGE_READ)==0 ){
+ return 0; /* Case (2) */
+ }
+ return 1;
+}
+#endif
+
+#ifndef SQLITE_OMIT_WAL
+# define pagerUseWal(x) ((x)->pWal!=0)
+#else
+# define pagerUseWal(x) 0
+# define pagerRollbackWal(x) 0
+# define pagerWalFrames(v,w,x,y) 0
+# define pagerOpenWalIfPresent(z) SQLITE_OK
+# define pagerBeginReadTransaction(z) SQLITE_OK
+#endif
+
+#ifndef NDEBUG
+/*
+** Usage:
+**
+** assert( assert_pager_state(pPager) );
+**
+** This function runs many asserts to try to find inconsistencies in
+** the internal state of the Pager object.
+*/
+static int assert_pager_state(Pager *p){
+ Pager *pPager = p;
+
+ /* State must be valid. */
+ assert( p->eState==PAGER_OPEN
+ || p->eState==PAGER_READER
+ || p->eState==PAGER_WRITER_LOCKED
+ || p->eState==PAGER_WRITER_CACHEMOD
+ || p->eState==PAGER_WRITER_DBMOD
+ || p->eState==PAGER_WRITER_FINISHED
+ || p->eState==PAGER_ERROR
+ );
+
+ /* Regardless of the current state, a temp-file connection always behaves
+ ** as if it has an exclusive lock on the database file. It never updates
+ ** the change-counter field, so the changeCountDone flag is always set.
+ */
+ assert( p->tempFile==0 || p->eLock==EXCLUSIVE_LOCK );
+ assert( p->tempFile==0 || pPager->changeCountDone );
+
+ /* If the useJournal flag is clear, the journal-mode must be "OFF".
+ ** And if the journal-mode is "OFF", the journal file must not be open.
+ */
+ assert( p->journalMode==PAGER_JOURNALMODE_OFF || p->useJournal );
+ assert( p->journalMode!=PAGER_JOURNALMODE_OFF || !isOpen(p->jfd) );
+
+ /* Check that MEMDB implies noSync. And an in-memory journal. Since
+ ** this means an in-memory pager performs no IO at all, it cannot encounter
+ ** either SQLITE_IOERR or SQLITE_FULL during rollback or while finalizing
+ ** a journal file. (although the in-memory journal implementation may
+ ** return SQLITE_IOERR_NOMEM while the journal file is being written). It
+ ** is therefore not possible for an in-memory pager to enter the ERROR
+ ** state.
+ */
+ if( MEMDB ){
+ assert( !isOpen(p->fd) );
+ assert( p->noSync );
+ assert( p->journalMode==PAGER_JOURNALMODE_OFF
+ || p->journalMode==PAGER_JOURNALMODE_MEMORY
+ );
+ assert( p->eState!=PAGER_ERROR && p->eState!=PAGER_OPEN );
+ assert( pagerUseWal(p)==0 );
+ }
+
+ /* If changeCountDone is set, a RESERVED lock or greater must be held
+ ** on the file.
+ */
+ assert( pPager->changeCountDone==0 || pPager->eLock>=RESERVED_LOCK );
+ assert( p->eLock!=PENDING_LOCK );
+
+ switch( p->eState ){
+ case PAGER_OPEN:
+ assert( !MEMDB );
+ assert( pPager->errCode==SQLITE_OK );
+ assert( sqlite3PcacheRefCount(pPager->pPCache)==0 || pPager->tempFile );
+ break;
+
+ case PAGER_READER:
+ assert( pPager->errCode==SQLITE_OK );
+ assert( p->eLock!=UNKNOWN_LOCK );
+ assert( p->eLock>=SHARED_LOCK );
+ break;
+
+ case PAGER_WRITER_LOCKED:
+ assert( p->eLock!=UNKNOWN_LOCK );
+ assert( pPager->errCode==SQLITE_OK );
+ if( !pagerUseWal(pPager) ){
+ assert( p->eLock>=RESERVED_LOCK );
+ }
+ assert( pPager->dbSize==pPager->dbOrigSize );
+ assert( pPager->dbOrigSize==pPager->dbFileSize );
+ assert( pPager->dbOrigSize==pPager->dbHintSize );
+ assert( pPager->setSuper==0 );
+ break;
+
+ case PAGER_WRITER_CACHEMOD:
+ assert( p->eLock!=UNKNOWN_LOCK );
+ assert( pPager->errCode==SQLITE_OK );
+ if( !pagerUseWal(pPager) ){
+ /* It is possible that if journal_mode=wal here that neither the
+ ** journal file nor the WAL file are open. This happens during
+ ** a rollback transaction that switches from journal_mode=off
+ ** to journal_mode=wal.
+ */
+ assert( p->eLock>=RESERVED_LOCK );
+ assert( isOpen(p->jfd)
+ || p->journalMode==PAGER_JOURNALMODE_OFF
+ || p->journalMode==PAGER_JOURNALMODE_WAL
+ );
+ }
+ assert( pPager->dbOrigSize==pPager->dbFileSize );
+ assert( pPager->dbOrigSize==pPager->dbHintSize );
+ break;
+
+ case PAGER_WRITER_DBMOD:
+ assert( p->eLock==EXCLUSIVE_LOCK );
+ assert( pPager->errCode==SQLITE_OK );
+ assert( !pagerUseWal(pPager) );
+ assert( p->eLock>=EXCLUSIVE_LOCK );
+ assert( isOpen(p->jfd)
+ || p->journalMode==PAGER_JOURNALMODE_OFF
+ || p->journalMode==PAGER_JOURNALMODE_WAL
+ || (sqlite3OsDeviceCharacteristics(p->fd)&SQLITE_IOCAP_BATCH_ATOMIC)
+ );
+ assert( pPager->dbOrigSize<=pPager->dbHintSize );
+ break;
+
+ case PAGER_WRITER_FINISHED:
+ assert( p->eLock==EXCLUSIVE_LOCK );
+ assert( pPager->errCode==SQLITE_OK );
+ assert( !pagerUseWal(pPager) );
+ assert( isOpen(p->jfd)
+ || p->journalMode==PAGER_JOURNALMODE_OFF
+ || p->journalMode==PAGER_JOURNALMODE_WAL
+ || (sqlite3OsDeviceCharacteristics(p->fd)&SQLITE_IOCAP_BATCH_ATOMIC)
+ );
+ break;
+
+ case PAGER_ERROR:
+ /* There must be at least one outstanding reference to the pager if
+ ** in ERROR state. Otherwise the pager should have already dropped
+ ** back to OPEN state.
+ */
+ assert( pPager->errCode!=SQLITE_OK );
+ assert( sqlite3PcacheRefCount(pPager->pPCache)>0 || pPager->tempFile );
+ break;
+ }
+
+ return 1;
+}
+#endif /* ifndef NDEBUG */
+
+#ifdef SQLITE_DEBUG
+/*
+** Return a pointer to a human readable string in a static buffer
+** containing the state of the Pager object passed as an argument. This
+** is intended to be used within debuggers. For example, as an alternative
+** to "print *pPager" in gdb:
+**
+** (gdb) printf "%s", print_pager_state(pPager)
+**
+** This routine has external linkage in order to suppress compiler warnings
+** about an unused function. It is enclosed within SQLITE_DEBUG and so does
+** not appear in normal builds.
+*/
+char *print_pager_state(Pager *p){
+ static char zRet[1024];
+
+ sqlite3_snprintf(1024, zRet,
+ "Filename: %s\n"
+ "State: %s errCode=%d\n"
+ "Lock: %s\n"
+ "Locking mode: locking_mode=%s\n"
+ "Journal mode: journal_mode=%s\n"
+ "Backing store: tempFile=%d memDb=%d useJournal=%d\n"
+ "Journal: journalOff=%lld journalHdr=%lld\n"
+ "Size: dbsize=%d dbOrigSize=%d dbFileSize=%d\n"
+ , p->zFilename
+ , p->eState==PAGER_OPEN ? "OPEN" :
+ p->eState==PAGER_READER ? "READER" :
+ p->eState==PAGER_WRITER_LOCKED ? "WRITER_LOCKED" :
+ p->eState==PAGER_WRITER_CACHEMOD ? "WRITER_CACHEMOD" :
+ p->eState==PAGER_WRITER_DBMOD ? "WRITER_DBMOD" :
+ p->eState==PAGER_WRITER_FINISHED ? "WRITER_FINISHED" :
+ p->eState==PAGER_ERROR ? "ERROR" : "?error?"
+ , (int)p->errCode
+ , p->eLock==NO_LOCK ? "NO_LOCK" :
+ p->eLock==RESERVED_LOCK ? "RESERVED" :
+ p->eLock==EXCLUSIVE_LOCK ? "EXCLUSIVE" :
+ p->eLock==SHARED_LOCK ? "SHARED" :
+ p->eLock==UNKNOWN_LOCK ? "UNKNOWN" : "?error?"
+ , p->exclusiveMode ? "exclusive" : "normal"
+ , p->journalMode==PAGER_JOURNALMODE_MEMORY ? "memory" :
+ p->journalMode==PAGER_JOURNALMODE_OFF ? "off" :
+ p->journalMode==PAGER_JOURNALMODE_DELETE ? "delete" :
+ p->journalMode==PAGER_JOURNALMODE_PERSIST ? "persist" :
+ p->journalMode==PAGER_JOURNALMODE_TRUNCATE ? "truncate" :
+ p->journalMode==PAGER_JOURNALMODE_WAL ? "wal" : "?error?"
+ , (int)p->tempFile, (int)p->memDb, (int)p->useJournal
+ , p->journalOff, p->journalHdr
+ , (int)p->dbSize, (int)p->dbOrigSize, (int)p->dbFileSize
+ );
+
+ return zRet;
+}
+#endif
+
+/* Forward references to the various page getters */
+static int getPageNormal(Pager*,Pgno,DbPage**,int);
+static int getPageError(Pager*,Pgno,DbPage**,int);
+#if SQLITE_MAX_MMAP_SIZE>0
+static int getPageMMap(Pager*,Pgno,DbPage**,int);
+#endif
+
+/*
+** Set the Pager.xGet method for the appropriate routine used to fetch
+** content from the pager.
+*/
+static void setGetterMethod(Pager *pPager){
+ if( pPager->errCode ){
+ pPager->xGet = getPageError;
+#if SQLITE_MAX_MMAP_SIZE>0
+ }else if( USEFETCH(pPager) ){
+ pPager->xGet = getPageMMap;
+#endif /* SQLITE_MAX_MMAP_SIZE>0 */
+ }else{
+ pPager->xGet = getPageNormal;
+ }
+}
+
+/*
+** Return true if it is necessary to write page *pPg into the sub-journal.
+** A page needs to be written into the sub-journal if there exists one
+** or more open savepoints for which:
+**
+** * The page-number is less than or equal to PagerSavepoint.nOrig, and
+** * The bit corresponding to the page-number is not set in
+** PagerSavepoint.pInSavepoint.
+*/
+static int subjRequiresPage(PgHdr *pPg){
+ Pager *pPager = pPg->pPager;
+ PagerSavepoint *p;
+ Pgno pgno = pPg->pgno;
+ int i;
+ for(i=0; i<pPager->nSavepoint; i++){
+ p = &pPager->aSavepoint[i];
+ if( p->nOrig>=pgno && 0==sqlite3BitvecTestNotNull(p->pInSavepoint, pgno) ){
+ for(i=i+1; i<pPager->nSavepoint; i++){
+ pPager->aSavepoint[i].bTruncateOnRelease = 0;
+ }
+ return 1;
+ }
+ }
+ return 0;
+}
+
+#ifdef SQLITE_DEBUG
+/*
+** Return true if the page is already in the journal file.
+*/
+static int pageInJournal(Pager *pPager, PgHdr *pPg){
+ return sqlite3BitvecTest(pPager->pInJournal, pPg->pgno);
+}
+#endif
+
+/*
+** Read a 32-bit integer from the given file descriptor. Store the integer
+** that is read in *pRes. Return SQLITE_OK if everything worked, or an
+** error code is something goes wrong.
+**
+** All values are stored on disk as big-endian.
+*/
+static int read32bits(sqlite3_file *fd, i64 offset, u32 *pRes){
+ unsigned char ac[4];
+ int rc = sqlite3OsRead(fd, ac, sizeof(ac), offset);
+ if( rc==SQLITE_OK ){
+ *pRes = sqlite3Get4byte(ac);
+ }
+ return rc;
+}
+
+/*
+** Write a 32-bit integer into a string buffer in big-endian byte order.
+*/
+#define put32bits(A,B) sqlite3Put4byte((u8*)A,B)
+
+
+/*
+** Write a 32-bit integer into the given file descriptor. Return SQLITE_OK
+** on success or an error code is something goes wrong.
+*/
+static int write32bits(sqlite3_file *fd, i64 offset, u32 val){
+ char ac[4];
+ put32bits(ac, val);
+ return sqlite3OsWrite(fd, ac, 4, offset);
+}
+
+/*
+** Unlock the database file to level eLock, which must be either NO_LOCK
+** or SHARED_LOCK. Regardless of whether or not the call to xUnlock()
+** succeeds, set the Pager.eLock variable to match the (attempted) new lock.
+**
+** Except, if Pager.eLock is set to UNKNOWN_LOCK when this function is
+** called, do not modify it. See the comment above the #define of
+** UNKNOWN_LOCK for an explanation of this.
+*/
+static int pagerUnlockDb(Pager *pPager, int eLock){
+ int rc = SQLITE_OK;
+
+ assert( !pPager->exclusiveMode || pPager->eLock==eLock );
+ assert( eLock==NO_LOCK || eLock==SHARED_LOCK );
+ assert( eLock!=NO_LOCK || pagerUseWal(pPager)==0 );
+ if( isOpen(pPager->fd) ){
+ assert( pPager->eLock>=eLock );
+ rc = pPager->noLock ? SQLITE_OK : sqlite3OsUnlock(pPager->fd, eLock);
+ if( pPager->eLock!=UNKNOWN_LOCK ){
+ pPager->eLock = (u8)eLock;
+ }
+ IOTRACE(("UNLOCK %p %d\n", pPager, eLock))
+ }
+ pPager->changeCountDone = pPager->tempFile; /* ticket fb3b3024ea238d5c */
+ return rc;
+}
+
+/*
+** Lock the database file to level eLock, which must be either SHARED_LOCK,
+** RESERVED_LOCK or EXCLUSIVE_LOCK. If the caller is successful, set the
+** Pager.eLock variable to the new locking state.
+**
+** Except, if Pager.eLock is set to UNKNOWN_LOCK when this function is
+** called, do not modify it unless the new locking state is EXCLUSIVE_LOCK.
+** See the comment above the #define of UNKNOWN_LOCK for an explanation
+** of this.
+*/
+static int pagerLockDb(Pager *pPager, int eLock){
+ int rc = SQLITE_OK;
+
+ assert( eLock==SHARED_LOCK || eLock==RESERVED_LOCK || eLock==EXCLUSIVE_LOCK );
+ if( pPager->eLock<eLock || pPager->eLock==UNKNOWN_LOCK ){
+ rc = pPager->noLock ? SQLITE_OK : sqlite3OsLock(pPager->fd, eLock);
+ if( rc==SQLITE_OK && (pPager->eLock!=UNKNOWN_LOCK||eLock==EXCLUSIVE_LOCK) ){
+ pPager->eLock = (u8)eLock;
+ IOTRACE(("LOCK %p %d\n", pPager, eLock))
+ }
+ }
+ return rc;
+}
+
+/*
+** This function determines whether or not the atomic-write or
+** atomic-batch-write optimizations can be used with this pager. The
+** atomic-write optimization can be used if:
+**
+** (a) the value returned by OsDeviceCharacteristics() indicates that
+** a database page may be written atomically, and
+** (b) the value returned by OsSectorSize() is less than or equal
+** to the page size.
+**
+** If it can be used, then the value returned is the size of the journal
+** file when it contains rollback data for exactly one page.
+**
+** The atomic-batch-write optimization can be used if OsDeviceCharacteristics()
+** returns a value with the SQLITE_IOCAP_BATCH_ATOMIC bit set. -1 is
+** returned in this case.
+**
+** If neither optimization can be used, 0 is returned.
+*/
+static int jrnlBufferSize(Pager *pPager){
+ assert( !MEMDB );
+
+#if defined(SQLITE_ENABLE_ATOMIC_WRITE) \
+ || defined(SQLITE_ENABLE_BATCH_ATOMIC_WRITE)
+ int dc; /* Device characteristics */
+
+ assert( isOpen(pPager->fd) );
+ dc = sqlite3OsDeviceCharacteristics(pPager->fd);
+#else
+ UNUSED_PARAMETER(pPager);
+#endif
+
+#ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE
+ if( pPager->dbSize>0 && (dc&SQLITE_IOCAP_BATCH_ATOMIC) ){
+ return -1;
+ }
+#endif
+
+#ifdef SQLITE_ENABLE_ATOMIC_WRITE
+ {
+ int nSector = pPager->sectorSize;
+ int szPage = pPager->pageSize;
+
+ assert(SQLITE_IOCAP_ATOMIC512==(512>>8));
+ assert(SQLITE_IOCAP_ATOMIC64K==(65536>>8));
+ if( 0==(dc&(SQLITE_IOCAP_ATOMIC|(szPage>>8)) || nSector>szPage) ){
+ return 0;
+ }
+ }
+
+ return JOURNAL_HDR_SZ(pPager) + JOURNAL_PG_SZ(pPager);
+#endif
+
+ return 0;
+}
+
+/*
+** If SQLITE_CHECK_PAGES is defined then we do some sanity checking
+** on the cache using a hash function. This is used for testing
+** and debugging only.
+*/
+#ifdef SQLITE_CHECK_PAGES
+/*
+** Return a 32-bit hash of the page data for pPage.
+*/
+static u32 pager_datahash(int nByte, unsigned char *pData){
+ u32 hash = 0;
+ int i;
+ for(i=0; i<nByte; i++){
+ hash = (hash*1039) + pData[i];
+ }
+ return hash;
+}
+static u32 pager_pagehash(PgHdr *pPage){
+ return pager_datahash(pPage->pPager->pageSize, (unsigned char *)pPage->pData);
+}
+static void pager_set_pagehash(PgHdr *pPage){
+ pPage->pageHash = pager_pagehash(pPage);
+}
+
+/*
+** The CHECK_PAGE macro takes a PgHdr* as an argument. If SQLITE_CHECK_PAGES
+** is defined, and NDEBUG is not defined, an assert() statement checks
+** that the page is either dirty or still matches the calculated page-hash.
+*/
+#define CHECK_PAGE(x) checkPage(x)
+static void checkPage(PgHdr *pPg){
+ Pager *pPager = pPg->pPager;
+ assert( pPager->eState!=PAGER_ERROR );
+ assert( (pPg->flags&PGHDR_DIRTY) || pPg->pageHash==pager_pagehash(pPg) );
+}
+
+#else
+#define pager_datahash(X,Y) 0
+#define pager_pagehash(X) 0
+#define pager_set_pagehash(X)
+#define CHECK_PAGE(x)
+#endif /* SQLITE_CHECK_PAGES */
+
+/*
+** When this is called the journal file for pager pPager must be open.
+** This function attempts to read a super-journal file name from the
+** end of the file and, if successful, copies it into memory supplied
+** by the caller. See comments above writeSuperJournal() for the format
+** used to store a super-journal file name at the end of a journal file.
+**
+** zSuper must point to a buffer of at least nSuper bytes allocated by
+** the caller. This should be sqlite3_vfs.mxPathname+1 (to ensure there is
+** enough space to write the super-journal name). If the super-journal
+** name in the journal is longer than nSuper bytes (including a
+** nul-terminator), then this is handled as if no super-journal name
+** were present in the journal.
+**
+** If a super-journal file name is present at the end of the journal
+** file, then it is copied into the buffer pointed to by zSuper. A
+** nul-terminator byte is appended to the buffer following the
+** super-journal file name.
+**
+** If it is determined that no super-journal file name is present
+** zSuper[0] is set to 0 and SQLITE_OK returned.
+**
+** If an error occurs while reading from the journal file, an SQLite
+** error code is returned.
+*/
+static int readSuperJournal(sqlite3_file *pJrnl, char *zSuper, u32 nSuper){
+ int rc; /* Return code */
+ u32 len; /* Length in bytes of super-journal name */
+ i64 szJ; /* Total size in bytes of journal file pJrnl */
+ u32 cksum; /* MJ checksum value read from journal */
+ u32 u; /* Unsigned loop counter */
+ unsigned char aMagic[8]; /* A buffer to hold the magic header */
+ zSuper[0] = '\0';
+
+ if( SQLITE_OK!=(rc = sqlite3OsFileSize(pJrnl, &szJ))
+ || szJ<16
+ || SQLITE_OK!=(rc = read32bits(pJrnl, szJ-16, &len))
+ || len>=nSuper
+ || len>szJ-16
+ || len==0
+ || SQLITE_OK!=(rc = read32bits(pJrnl, szJ-12, &cksum))
+ || SQLITE_OK!=(rc = sqlite3OsRead(pJrnl, aMagic, 8, szJ-8))
+ || memcmp(aMagic, aJournalMagic, 8)
+ || SQLITE_OK!=(rc = sqlite3OsRead(pJrnl, zSuper, len, szJ-16-len))
+ ){
+ return rc;
+ }
+
+ /* See if the checksum matches the super-journal name */
+ for(u=0; u<len; u++){
+ cksum -= zSuper[u];
+ }
+ if( cksum ){
+ /* If the checksum doesn't add up, then one or more of the disk sectors
+ ** containing the super-journal filename is corrupted. This means
+ ** definitely roll back, so just return SQLITE_OK and report a (nul)
+ ** super-journal filename.
+ */
+ len = 0;
+ }
+ zSuper[len] = '\0';
+ zSuper[len+1] = '\0';
+
+ return SQLITE_OK;
+}
+
+/*
+** Return the offset of the sector boundary at or immediately
+** following the value in pPager->journalOff, assuming a sector
+** size of pPager->sectorSize bytes.
+**
+** i.e for a sector size of 512:
+**
+** Pager.journalOff Return value
+** ---------------------------------------
+** 0 0
+** 512 512
+** 100 512
+** 2000 2048
+**
+*/
+static i64 journalHdrOffset(Pager *pPager){
+ i64 offset = 0;
+ i64 c = pPager->journalOff;
+ if( c ){
+ offset = ((c-1)/JOURNAL_HDR_SZ(pPager) + 1) * JOURNAL_HDR_SZ(pPager);
+ }
+ assert( offset%JOURNAL_HDR_SZ(pPager)==0 );
+ assert( offset>=c );
+ assert( (offset-c)<JOURNAL_HDR_SZ(pPager) );
+ return offset;
+}
+
+/*
+** The journal file must be open when this function is called.
+**
+** This function is a no-op if the journal file has not been written to
+** within the current transaction (i.e. if Pager.journalOff==0).
+**
+** If doTruncate is non-zero or the Pager.journalSizeLimit variable is
+** set to 0, then truncate the journal file to zero bytes in size. Otherwise,
+** zero the 28-byte header at the start of the journal file. In either case,
+** if the pager is not in no-sync mode, sync the journal file immediately
+** after writing or truncating it.
+**
+** If Pager.journalSizeLimit is set to a positive, non-zero value, and
+** following the truncation or zeroing described above the size of the
+** journal file in bytes is larger than this value, then truncate the
+** journal file to Pager.journalSizeLimit bytes. The journal file does
+** not need to be synced following this operation.
+**
+** If an IO error occurs, abandon processing and return the IO error code.
+** Otherwise, return SQLITE_OK.
+*/
+static int zeroJournalHdr(Pager *pPager, int doTruncate){
+ int rc = SQLITE_OK; /* Return code */
+ assert( isOpen(pPager->jfd) );
+ assert( !sqlite3JournalIsInMemory(pPager->jfd) );
+ if( pPager->journalOff ){
+ const i64 iLimit = pPager->journalSizeLimit; /* Local cache of jsl */
+
+ IOTRACE(("JZEROHDR %p\n", pPager))
+ if( doTruncate || iLimit==0 ){
+ rc = sqlite3OsTruncate(pPager->jfd, 0);
+ }else{
+ static const char zeroHdr[28] = {0};
+ rc = sqlite3OsWrite(pPager->jfd, zeroHdr, sizeof(zeroHdr), 0);
+ }
+ if( rc==SQLITE_OK && !pPager->noSync ){
+ rc = sqlite3OsSync(pPager->jfd, SQLITE_SYNC_DATAONLY|pPager->syncFlags);
+ }
+
+ /* At this point the transaction is committed but the write lock
+ ** is still held on the file. If there is a size limit configured for
+ ** the persistent journal and the journal file currently consumes more
+ ** space than that limit allows for, truncate it now. There is no need
+ ** to sync the file following this operation.
+ */
+ if( rc==SQLITE_OK && iLimit>0 ){
+ i64 sz;
+ rc = sqlite3OsFileSize(pPager->jfd, &sz);
+ if( rc==SQLITE_OK && sz>iLimit ){
+ rc = sqlite3OsTruncate(pPager->jfd, iLimit);
+ }
+ }
+ }
+ return rc;
+}
+
+/*
+** The journal file must be open when this routine is called. A journal
+** header (JOURNAL_HDR_SZ bytes) is written into the journal file at the
+** current location.
+**
+** The format for the journal header is as follows:
+** - 8 bytes: Magic identifying journal format.
+** - 4 bytes: Number of records in journal, or -1 no-sync mode is on.
+** - 4 bytes: Random number used for page hash.
+** - 4 bytes: Initial database page count.
+** - 4 bytes: Sector size used by the process that wrote this journal.
+** - 4 bytes: Database page size.
+**
+** Followed by (JOURNAL_HDR_SZ - 28) bytes of unused space.
+*/
+static int writeJournalHdr(Pager *pPager){
+ int rc = SQLITE_OK; /* Return code */
+ char *zHeader = pPager->pTmpSpace; /* Temporary space used to build header */
+ u32 nHeader = (u32)pPager->pageSize;/* Size of buffer pointed to by zHeader */
+ u32 nWrite; /* Bytes of header sector written */
+ int ii; /* Loop counter */
+
+ assert( isOpen(pPager->jfd) ); /* Journal file must be open. */
+
+ if( nHeader>JOURNAL_HDR_SZ(pPager) ){
+ nHeader = JOURNAL_HDR_SZ(pPager);
+ }
+
+ /* If there are active savepoints and any of them were created
+ ** since the most recent journal header was written, update the
+ ** PagerSavepoint.iHdrOffset fields now.
+ */
+ for(ii=0; ii<pPager->nSavepoint; ii++){
+ if( pPager->aSavepoint[ii].iHdrOffset==0 ){
+ pPager->aSavepoint[ii].iHdrOffset = pPager->journalOff;
+ }
+ }
+
+ pPager->journalHdr = pPager->journalOff = journalHdrOffset(pPager);
+
+ /*
+ ** Write the nRec Field - the number of page records that follow this
+ ** journal header. Normally, zero is written to this value at this time.
+ ** After the records are added to the journal (and the journal synced,
+ ** if in full-sync mode), the zero is overwritten with the true number
+ ** of records (see syncJournal()).
+ **
+ ** A faster alternative is to write 0xFFFFFFFF to the nRec field. When
+ ** reading the journal this value tells SQLite to assume that the
+ ** rest of the journal file contains valid page records. This assumption
+ ** is dangerous, as if a failure occurred whilst writing to the journal
+ ** file it may contain some garbage data. There are two scenarios
+ ** where this risk can be ignored:
+ **
+ ** * When the pager is in no-sync mode. Corruption can follow a
+ ** power failure in this case anyway.
+ **
+ ** * When the SQLITE_IOCAP_SAFE_APPEND flag is set. This guarantees
+ ** that garbage data is never appended to the journal file.
+ */
+ assert( isOpen(pPager->fd) || pPager->noSync );
+ if( pPager->noSync || (pPager->journalMode==PAGER_JOURNALMODE_MEMORY)
+ || (sqlite3OsDeviceCharacteristics(pPager->fd)&SQLITE_IOCAP_SAFE_APPEND)
+ ){
+ memcpy(zHeader, aJournalMagic, sizeof(aJournalMagic));
+ put32bits(&zHeader[sizeof(aJournalMagic)], 0xffffffff);
+ }else{
+ memset(zHeader, 0, sizeof(aJournalMagic)+4);
+ }
+
+
+
+ /* The random check-hash initializer */
+ if( pPager->journalMode!=PAGER_JOURNALMODE_MEMORY ){
+ sqlite3_randomness(sizeof(pPager->cksumInit), &pPager->cksumInit);
+ }
+#ifdef SQLITE_DEBUG
+ else{
+ /* The Pager.cksumInit variable is usually randomized above to protect
+ ** against there being existing records in the journal file. This is
+ ** dangerous, as following a crash they may be mistaken for records
+ ** written by the current transaction and rolled back into the database
+ ** file, causing corruption. The following assert statements verify
+ ** that this is not required in "journal_mode=memory" mode, as in that
+ ** case the journal file is always 0 bytes in size at this point.
+ ** It is advantageous to avoid the sqlite3_randomness() call if possible
+ ** as it takes the global PRNG mutex. */
+ i64 sz = 0;
+ sqlite3OsFileSize(pPager->jfd, &sz);
+ assert( sz==0 );
+ assert( pPager->journalOff==journalHdrOffset(pPager) );
+ assert( sqlite3JournalIsInMemory(pPager->jfd) );
+ }
+#endif
+ put32bits(&zHeader[sizeof(aJournalMagic)+4], pPager->cksumInit);
+
+ /* The initial database size */
+ put32bits(&zHeader[sizeof(aJournalMagic)+8], pPager->dbOrigSize);
+ /* The assumed sector size for this process */
+ put32bits(&zHeader[sizeof(aJournalMagic)+12], pPager->sectorSize);
+
+ /* The page size */
+ put32bits(&zHeader[sizeof(aJournalMagic)+16], pPager->pageSize);
+
+ /* Initializing the tail of the buffer is not necessary. Everything
+ ** works find if the following memset() is omitted. But initializing
+ ** the memory prevents valgrind from complaining, so we are willing to
+ ** take the performance hit.
+ */
+ memset(&zHeader[sizeof(aJournalMagic)+20], 0,
+ nHeader-(sizeof(aJournalMagic)+20));
+
+ /* In theory, it is only necessary to write the 28 bytes that the
+ ** journal header consumes to the journal file here. Then increment the
+ ** Pager.journalOff variable by JOURNAL_HDR_SZ so that the next
+ ** record is written to the following sector (leaving a gap in the file
+ ** that will be implicitly filled in by the OS).
+ **
+ ** However it has been discovered that on some systems this pattern can
+ ** be significantly slower than contiguously writing data to the file,
+ ** even if that means explicitly writing data to the block of
+ ** (JOURNAL_HDR_SZ - 28) bytes that will not be used. So that is what
+ ** is done.
+ **
+ ** The loop is required here in case the sector-size is larger than the
+ ** database page size. Since the zHeader buffer is only Pager.pageSize
+ ** bytes in size, more than one call to sqlite3OsWrite() may be required
+ ** to populate the entire journal header sector.
+ */
+ for(nWrite=0; rc==SQLITE_OK&&nWrite<JOURNAL_HDR_SZ(pPager); nWrite+=nHeader){
+ IOTRACE(("JHDR %p %lld %d\n", pPager, pPager->journalHdr, nHeader))
+ rc = sqlite3OsWrite(pPager->jfd, zHeader, nHeader, pPager->journalOff);
+ assert( pPager->journalHdr <= pPager->journalOff );
+ pPager->journalOff += nHeader;
+ }
+
+ return rc;
+}
+
+/*
+** The journal file must be open when this is called. A journal header file
+** (JOURNAL_HDR_SZ bytes) is read from the current location in the journal
+** file. The current location in the journal file is given by
+** pPager->journalOff. See comments above function writeJournalHdr() for
+** a description of the journal header format.
+**
+** If the header is read successfully, *pNRec is set to the number of
+** page records following this header and *pDbSize is set to the size of the
+** database before the transaction began, in pages. Also, pPager->cksumInit
+** is set to the value read from the journal header. SQLITE_OK is returned
+** in this case.
+**
+** If the journal header file appears to be corrupted, SQLITE_DONE is
+** returned and *pNRec and *PDbSize are undefined. If JOURNAL_HDR_SZ bytes
+** cannot be read from the journal file an error code is returned.
+*/
+static int readJournalHdr(
+ Pager *pPager, /* Pager object */
+ int isHot,
+ i64 journalSize, /* Size of the open journal file in bytes */
+ u32 *pNRec, /* OUT: Value read from the nRec field */
+ u32 *pDbSize /* OUT: Value of original database size field */
+){
+ int rc; /* Return code */
+ unsigned char aMagic[8]; /* A buffer to hold the magic header */
+ i64 iHdrOff; /* Offset of journal header being read */
+
+ assert( isOpen(pPager->jfd) ); /* Journal file must be open. */
+
+ /* Advance Pager.journalOff to the start of the next sector. If the
+ ** journal file is too small for there to be a header stored at this
+ ** point, return SQLITE_DONE.
+ */
+ pPager->journalOff = journalHdrOffset(pPager);
+ if( pPager->journalOff+JOURNAL_HDR_SZ(pPager) > journalSize ){
+ return SQLITE_DONE;
+ }
+ iHdrOff = pPager->journalOff;
+
+ /* Read in the first 8 bytes of the journal header. If they do not match
+ ** the magic string found at the start of each journal header, return
+ ** SQLITE_DONE. If an IO error occurs, return an error code. Otherwise,
+ ** proceed.
+ */
+ if( isHot || iHdrOff!=pPager->journalHdr ){
+ rc = sqlite3OsRead(pPager->jfd, aMagic, sizeof(aMagic), iHdrOff);
+ if( rc ){
+ return rc;
+ }
+ if( memcmp(aMagic, aJournalMagic, sizeof(aMagic))!=0 ){
+ return SQLITE_DONE;
+ }
+ }
+
+ /* Read the first three 32-bit fields of the journal header: The nRec
+ ** field, the checksum-initializer and the database size at the start
+ ** of the transaction. Return an error code if anything goes wrong.
+ */
+ if( SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+8, pNRec))
+ || SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+12, &pPager->cksumInit))
+ || SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+16, pDbSize))
+ ){
+ return rc;
+ }
+
+ if( pPager->journalOff==0 ){
+ u32 iPageSize; /* Page-size field of journal header */
+ u32 iSectorSize; /* Sector-size field of journal header */
+
+ /* Read the page-size and sector-size journal header fields. */
+ if( SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+20, &iSectorSize))
+ || SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+24, &iPageSize))
+ ){
+ return rc;
+ }
+
+ /* Versions of SQLite prior to 3.5.8 set the page-size field of the
+ ** journal header to zero. In this case, assume that the Pager.pageSize
+ ** variable is already set to the correct page size.
+ */
+ if( iPageSize==0 ){
+ iPageSize = pPager->pageSize;
+ }
+
+ /* Check that the values read from the page-size and sector-size fields
+ ** are within range. To be 'in range', both values need to be a power
+ ** of two greater than or equal to 512 or 32, and not greater than their
+ ** respective compile time maximum limits.
+ */
+ if( iPageSize<512 || iSectorSize<32
+ || iPageSize>SQLITE_MAX_PAGE_SIZE || iSectorSize>MAX_SECTOR_SIZE
+ || ((iPageSize-1)&iPageSize)!=0 || ((iSectorSize-1)&iSectorSize)!=0
+ ){
+ /* If the either the page-size or sector-size in the journal-header is
+ ** invalid, then the process that wrote the journal-header must have
+ ** crashed before the header was synced. In this case stop reading
+ ** the journal file here.
+ */
+ return SQLITE_DONE;
+ }
+
+ /* Update the page-size to match the value read from the journal.
+ ** Use a testcase() macro to make sure that malloc failure within
+ ** PagerSetPagesize() is tested.
+ */
+ rc = sqlite3PagerSetPagesize(pPager, &iPageSize, -1);
+ testcase( rc!=SQLITE_OK );
+
+ /* Update the assumed sector-size to match the value used by
+ ** the process that created this journal. If this journal was
+ ** created by a process other than this one, then this routine
+ ** is being called from within pager_playback(). The local value
+ ** of Pager.sectorSize is restored at the end of that routine.
+ */
+ pPager->sectorSize = iSectorSize;
+ }
+
+ pPager->journalOff += JOURNAL_HDR_SZ(pPager);
+ return rc;
+}
+
+
+/*
+** Write the supplied super-journal name into the journal file for pager
+** pPager at the current location. The super-journal name must be the last
+** thing written to a journal file. If the pager is in full-sync mode, the
+** journal file descriptor is advanced to the next sector boundary before
+** anything is written. The format is:
+**
+** + 4 bytes: PAGER_SJ_PGNO.
+** + N bytes: super-journal filename in utf-8.
+** + 4 bytes: N (length of super-journal name in bytes, no nul-terminator).
+** + 4 bytes: super-journal name checksum.
+** + 8 bytes: aJournalMagic[].
+**
+** The super-journal page checksum is the sum of the bytes in the super-journal
+** name, where each byte is interpreted as a signed 8-bit integer.
+**
+** If zSuper is a NULL pointer (occurs for a single database transaction),
+** this call is a no-op.
+*/
+static int writeSuperJournal(Pager *pPager, const char *zSuper){
+ int rc; /* Return code */
+ int nSuper; /* Length of string zSuper */
+ i64 iHdrOff; /* Offset of header in journal file */
+ i64 jrnlSize; /* Size of journal file on disk */
+ u32 cksum = 0; /* Checksum of string zSuper */
+
+ assert( pPager->setSuper==0 );
+ assert( !pagerUseWal(pPager) );
+
+ if( !zSuper
+ || pPager->journalMode==PAGER_JOURNALMODE_MEMORY
+ || !isOpen(pPager->jfd)
+ ){
+ return SQLITE_OK;
+ }
+ pPager->setSuper = 1;
+ assert( pPager->journalHdr <= pPager->journalOff );
+
+ /* Calculate the length in bytes and the checksum of zSuper */
+ for(nSuper=0; zSuper[nSuper]; nSuper++){
+ cksum += zSuper[nSuper];
+ }
+
+ /* If in full-sync mode, advance to the next disk sector before writing
+ ** the super-journal name. This is in case the previous page written to
+ ** the journal has already been synced.
+ */
+ if( pPager->fullSync ){
+ pPager->journalOff = journalHdrOffset(pPager);
+ }
+ iHdrOff = pPager->journalOff;
+
+ /* Write the super-journal data to the end of the journal file. If
+ ** an error occurs, return the error code to the caller.
+ */
+ if( (0 != (rc = write32bits(pPager->jfd, iHdrOff, PAGER_SJ_PGNO(pPager))))
+ || (0 != (rc = sqlite3OsWrite(pPager->jfd, zSuper, nSuper, iHdrOff+4)))
+ || (0 != (rc = write32bits(pPager->jfd, iHdrOff+4+nSuper, nSuper)))
+ || (0 != (rc = write32bits(pPager->jfd, iHdrOff+4+nSuper+4, cksum)))
+ || (0 != (rc = sqlite3OsWrite(pPager->jfd, aJournalMagic, 8,
+ iHdrOff+4+nSuper+8)))
+ ){
+ return rc;
+ }
+ pPager->journalOff += (nSuper+20);
+
+ /* If the pager is in persistent-journal mode, then the physical
+ ** journal-file may extend past the end of the super-journal name
+ ** and 8 bytes of magic data just written to the file. This is
+ ** dangerous because the code to rollback a hot-journal file
+ ** will not be able to find the super-journal name to determine
+ ** whether or not the journal is hot.
+ **
+ ** Easiest thing to do in this scenario is to truncate the journal
+ ** file to the required size.
+ */
+ if( SQLITE_OK==(rc = sqlite3OsFileSize(pPager->jfd, &jrnlSize))
+ && jrnlSize>pPager->journalOff
+ ){
+ rc = sqlite3OsTruncate(pPager->jfd, pPager->journalOff);
+ }
+ return rc;
+}
+
+/*
+** Discard the entire contents of the in-memory page-cache.
+*/
+static void pager_reset(Pager *pPager){
+ pPager->iDataVersion++;
+ sqlite3BackupRestart(pPager->pBackup);
+ sqlite3PcacheClear(pPager->pPCache);
+}
+
+/*
+** Return the pPager->iDataVersion value
+*/
+SQLITE_PRIVATE u32 sqlite3PagerDataVersion(Pager *pPager){
+ return pPager->iDataVersion;
+}
+
+/*
+** Free all structures in the Pager.aSavepoint[] array and set both
+** Pager.aSavepoint and Pager.nSavepoint to zero. Close the sub-journal
+** if it is open and the pager is not in exclusive mode.
+*/
+static void releaseAllSavepoints(Pager *pPager){
+ int ii; /* Iterator for looping through Pager.aSavepoint */
+ for(ii=0; ii<pPager->nSavepoint; ii++){
+ sqlite3BitvecDestroy(pPager->aSavepoint[ii].pInSavepoint);
+ }
+ if( !pPager->exclusiveMode || sqlite3JournalIsInMemory(pPager->sjfd) ){
+ sqlite3OsClose(pPager->sjfd);
+ }
+ sqlite3_free(pPager->aSavepoint);
+ pPager->aSavepoint = 0;
+ pPager->nSavepoint = 0;
+ pPager->nSubRec = 0;
+}
+
+/*
+** Set the bit number pgno in the PagerSavepoint.pInSavepoint
+** bitvecs of all open savepoints. Return SQLITE_OK if successful
+** or SQLITE_NOMEM if a malloc failure occurs.
+*/
+static int addToSavepointBitvecs(Pager *pPager, Pgno pgno){
+ int ii; /* Loop counter */
+ int rc = SQLITE_OK; /* Result code */
+
+ for(ii=0; ii<pPager->nSavepoint; ii++){
+ PagerSavepoint *p = &pPager->aSavepoint[ii];
+ if( pgno<=p->nOrig ){
+ rc |= sqlite3BitvecSet(p->pInSavepoint, pgno);
+ testcase( rc==SQLITE_NOMEM );
+ assert( rc==SQLITE_OK || rc==SQLITE_NOMEM );
+ }
+ }
+ return rc;
+}
+
+/*
+** This function is a no-op if the pager is in exclusive mode and not
+** in the ERROR state. Otherwise, it switches the pager to PAGER_OPEN
+** state.
+**
+** If the pager is not in exclusive-access mode, the database file is
+** completely unlocked. If the file is unlocked and the file-system does
+** not exhibit the UNDELETABLE_WHEN_OPEN property, the journal file is
+** closed (if it is open).
+**
+** If the pager is in ERROR state when this function is called, the
+** contents of the pager cache are discarded before switching back to
+** the OPEN state. Regardless of whether the pager is in exclusive-mode
+** or not, any journal file left in the file-system will be treated
+** as a hot-journal and rolled back the next time a read-transaction
+** is opened (by this or by any other connection).
+*/
+static void pager_unlock(Pager *pPager){
+
+ assert( pPager->eState==PAGER_READER
+ || pPager->eState==PAGER_OPEN
+ || pPager->eState==PAGER_ERROR
+ );
+
+ sqlite3BitvecDestroy(pPager->pInJournal);
+ pPager->pInJournal = 0;
+ releaseAllSavepoints(pPager);
+
+ if( pagerUseWal(pPager) ){
+ assert( !isOpen(pPager->jfd) );
+ sqlite3WalEndReadTransaction(pPager->pWal);
+ pPager->eState = PAGER_OPEN;
+ }else if( !pPager->exclusiveMode ){
+ int rc; /* Error code returned by pagerUnlockDb() */
+ int iDc = isOpen(pPager->fd)?sqlite3OsDeviceCharacteristics(pPager->fd):0;
+
+ /* If the operating system support deletion of open files, then
+ ** close the journal file when dropping the database lock. Otherwise
+ ** another connection with journal_mode=delete might delete the file
+ ** out from under us.
+ */
+ assert( (PAGER_JOURNALMODE_MEMORY & 5)!=1 );
+ assert( (PAGER_JOURNALMODE_OFF & 5)!=1 );
+ assert( (PAGER_JOURNALMODE_WAL & 5)!=1 );
+ assert( (PAGER_JOURNALMODE_DELETE & 5)!=1 );
+ assert( (PAGER_JOURNALMODE_TRUNCATE & 5)==1 );
+ assert( (PAGER_JOURNALMODE_PERSIST & 5)==1 );
+ if( 0==(iDc & SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN)
+ || 1!=(pPager->journalMode & 5)
+ ){
+ sqlite3OsClose(pPager->jfd);
+ }
+
+ /* If the pager is in the ERROR state and the call to unlock the database
+ ** file fails, set the current lock to UNKNOWN_LOCK. See the comment
+ ** above the #define for UNKNOWN_LOCK for an explanation of why this
+ ** is necessary.
+ */
+ rc = pagerUnlockDb(pPager, NO_LOCK);
+ if( rc!=SQLITE_OK && pPager->eState==PAGER_ERROR ){
+ pPager->eLock = UNKNOWN_LOCK;
+ }
+
+ /* The pager state may be changed from PAGER_ERROR to PAGER_OPEN here
+ ** without clearing the error code. This is intentional - the error
+ ** code is cleared and the cache reset in the block below.
+ */
+ assert( pPager->errCode || pPager->eState!=PAGER_ERROR );
+ pPager->eState = PAGER_OPEN;
+ }
+
+ /* If Pager.errCode is set, the contents of the pager cache cannot be
+ ** trusted. Now that there are no outstanding references to the pager,
+ ** it can safely move back to PAGER_OPEN state. This happens in both
+ ** normal and exclusive-locking mode.
+ */
+ assert( pPager->errCode==SQLITE_OK || !MEMDB );
+ if( pPager->errCode ){
+ if( pPager->tempFile==0 ){
+ pager_reset(pPager);
+ pPager->changeCountDone = 0;
+ pPager->eState = PAGER_OPEN;
+ }else{
+ pPager->eState = (isOpen(pPager->jfd) ? PAGER_OPEN : PAGER_READER);
+ }
+ if( USEFETCH(pPager) ) sqlite3OsUnfetch(pPager->fd, 0, 0);
+ pPager->errCode = SQLITE_OK;
+ setGetterMethod(pPager);
+ }
+
+ pPager->journalOff = 0;
+ pPager->journalHdr = 0;
+ pPager->setSuper = 0;
+}
+
+/*
+** This function is called whenever an IOERR or FULL error that requires
+** the pager to transition into the ERROR state may have occurred.
+** The first argument is a pointer to the pager structure, the second
+** the error-code about to be returned by a pager API function. The
+** value returned is a copy of the second argument to this function.
+**
+** If the second argument is SQLITE_FULL, SQLITE_IOERR or one of the
+** IOERR sub-codes, the pager enters the ERROR state and the error code
+** is stored in Pager.errCode. While the pager remains in the ERROR state,
+** all major API calls on the Pager will immediately return Pager.errCode.
+**
+** The ERROR state indicates that the contents of the pager-cache
+** cannot be trusted. This state can be cleared by completely discarding
+** the contents of the pager-cache. If a transaction was active when
+** the persistent error occurred, then the rollback journal may need
+** to be replayed to restore the contents of the database file (as if
+** it were a hot-journal).
+*/
+static int pager_error(Pager *pPager, int rc){
+ int rc2 = rc & 0xff;
+ assert( rc==SQLITE_OK || !MEMDB );
+ assert(
+ pPager->errCode==SQLITE_FULL ||
+ pPager->errCode==SQLITE_OK ||
+ (pPager->errCode & 0xff)==SQLITE_IOERR
+ );
+ if( rc2==SQLITE_FULL || rc2==SQLITE_IOERR ){
+ pPager->errCode = rc;
+ pPager->eState = PAGER_ERROR;
+ setGetterMethod(pPager);
+ }
+ return rc;
+}
+
+static int pager_truncate(Pager *pPager, Pgno nPage);
+
+/*
+** The write transaction open on pPager is being committed (bCommit==1)
+** or rolled back (bCommit==0).
+**
+** Return TRUE if and only if all dirty pages should be flushed to disk.
+**
+** Rules:
+**
+** * For non-TEMP databases, always sync to disk. This is necessary
+** for transactions to be durable.
+**
+** * Sync TEMP database only on a COMMIT (not a ROLLBACK) when the backing
+** file has been created already (via a spill on pagerStress()) and
+** when the number of dirty pages in memory exceeds 25% of the total
+** cache size.
+*/
+static int pagerFlushOnCommit(Pager *pPager, int bCommit){
+ if( pPager->tempFile==0 ) return 1;
+ if( !bCommit ) return 0;
+ if( !isOpen(pPager->fd) ) return 0;
+ return (sqlite3PCachePercentDirty(pPager->pPCache)>=25);
+}
+
+/*
+** This routine ends a transaction. A transaction is usually ended by
+** either a COMMIT or a ROLLBACK operation. This routine may be called
+** after rollback of a hot-journal, or if an error occurs while opening
+** the journal file or writing the very first journal-header of a
+** database transaction.
+**
+** This routine is never called in PAGER_ERROR state. If it is called
+** in PAGER_NONE or PAGER_SHARED state and the lock held is less
+** exclusive than a RESERVED lock, it is a no-op.
+**
+** Otherwise, any active savepoints are released.
+**
+** If the journal file is open, then it is "finalized". Once a journal
+** file has been finalized it is not possible to use it to roll back a
+** transaction. Nor will it be considered to be a hot-journal by this
+** or any other database connection. Exactly how a journal is finalized
+** depends on whether or not the pager is running in exclusive mode and
+** the current journal-mode (Pager.journalMode value), as follows:
+**
+** journalMode==MEMORY
+** Journal file descriptor is simply closed. This destroys an
+** in-memory journal.
+**
+** journalMode==TRUNCATE
+** Journal file is truncated to zero bytes in size.
+**
+** journalMode==PERSIST
+** The first 28 bytes of the journal file are zeroed. This invalidates
+** the first journal header in the file, and hence the entire journal
+** file. An invalid journal file cannot be rolled back.
+**
+** journalMode==DELETE
+** The journal file is closed and deleted using sqlite3OsDelete().
+**
+** If the pager is running in exclusive mode, this method of finalizing
+** the journal file is never used. Instead, if the journalMode is
+** DELETE and the pager is in exclusive mode, the method described under
+** journalMode==PERSIST is used instead.
+**
+** After the journal is finalized, the pager moves to PAGER_READER state.
+** If running in non-exclusive rollback mode, the lock on the file is
+** downgraded to a SHARED_LOCK.
+**
+** SQLITE_OK is returned if no error occurs. If an error occurs during
+** any of the IO operations to finalize the journal file or unlock the
+** database then the IO error code is returned to the user. If the
+** operation to finalize the journal file fails, then the code still
+** tries to unlock the database file if not in exclusive mode. If the
+** unlock operation fails as well, then the first error code related
+** to the first error encountered (the journal finalization one) is
+** returned.
+*/
+static int pager_end_transaction(Pager *pPager, int hasSuper, int bCommit){
+ int rc = SQLITE_OK; /* Error code from journal finalization operation */
+ int rc2 = SQLITE_OK; /* Error code from db file unlock operation */
+
+ /* Do nothing if the pager does not have an open write transaction
+ ** or at least a RESERVED lock. This function may be called when there
+ ** is no write-transaction active but a RESERVED or greater lock is
+ ** held under two circumstances:
+ **
+ ** 1. After a successful hot-journal rollback, it is called with
+ ** eState==PAGER_NONE and eLock==EXCLUSIVE_LOCK.
+ **
+ ** 2. If a connection with locking_mode=exclusive holding an EXCLUSIVE
+ ** lock switches back to locking_mode=normal and then executes a
+ ** read-transaction, this function is called with eState==PAGER_READER
+ ** and eLock==EXCLUSIVE_LOCK when the read-transaction is closed.
+ */
+ assert( assert_pager_state(pPager) );
+ assert( pPager->eState!=PAGER_ERROR );
+ if( pPager->eState<PAGER_WRITER_LOCKED && pPager->eLock<RESERVED_LOCK ){
+ return SQLITE_OK;
+ }
+
+ releaseAllSavepoints(pPager);
+ assert( isOpen(pPager->jfd) || pPager->pInJournal==0
+ || (sqlite3OsDeviceCharacteristics(pPager->fd)&SQLITE_IOCAP_BATCH_ATOMIC)
+ );
+ if( isOpen(pPager->jfd) ){
+ assert( !pagerUseWal(pPager) );
+
+ /* Finalize the journal file. */
+ if( sqlite3JournalIsInMemory(pPager->jfd) ){
+ /* assert( pPager->journalMode==PAGER_JOURNALMODE_MEMORY ); */
+ sqlite3OsClose(pPager->jfd);
+ }else if( pPager->journalMode==PAGER_JOURNALMODE_TRUNCATE ){
+ if( pPager->journalOff==0 ){
+ rc = SQLITE_OK;
+ }else{
+ rc = sqlite3OsTruncate(pPager->jfd, 0);
+ if( rc==SQLITE_OK && pPager->fullSync ){
+ /* Make sure the new file size is written into the inode right away.
+ ** Otherwise the journal might resurrect following a power loss and
+ ** cause the last transaction to roll back. See
+ ** https://bugzilla.mozilla.org/show_bug.cgi?id=1072773
+ */
+ rc = sqlite3OsSync(pPager->jfd, pPager->syncFlags);
+ }
+ }
+ pPager->journalOff = 0;
+ }else if( pPager->journalMode==PAGER_JOURNALMODE_PERSIST
+ || (pPager->exclusiveMode && pPager->journalMode<PAGER_JOURNALMODE_WAL)
+ ){
+ rc = zeroJournalHdr(pPager, hasSuper||pPager->tempFile);
+ pPager->journalOff = 0;
+ }else{
+ /* This branch may be executed with Pager.journalMode==MEMORY if
+ ** a hot-journal was just rolled back. In this case the journal
+ ** file should be closed and deleted. If this connection writes to
+ ** the database file, it will do so using an in-memory journal.
+ */
+ int bDelete = !pPager->tempFile;
+ assert( sqlite3JournalIsInMemory(pPager->jfd)==0 );
+ assert( pPager->journalMode==PAGER_JOURNALMODE_DELETE
+ || pPager->journalMode==PAGER_JOURNALMODE_MEMORY
+ || pPager->journalMode==PAGER_JOURNALMODE_WAL
+ );
+ sqlite3OsClose(pPager->jfd);
+ if( bDelete ){
+ rc = sqlite3OsDelete(pPager->pVfs, pPager->zJournal, pPager->extraSync);
+ }
+ }
+ }
+
+#ifdef SQLITE_CHECK_PAGES
+ sqlite3PcacheIterateDirty(pPager->pPCache, pager_set_pagehash);
+ if( pPager->dbSize==0 && sqlite3PcacheRefCount(pPager->pPCache)>0 ){
+ PgHdr *p = sqlite3PagerLookup(pPager, 1);
+ if( p ){
+ p->pageHash = 0;
+ sqlite3PagerUnrefNotNull(p);
+ }
+ }
+#endif
+
+ sqlite3BitvecDestroy(pPager->pInJournal);
+ pPager->pInJournal = 0;
+ pPager->nRec = 0;
+ if( rc==SQLITE_OK ){
+ if( MEMDB || pagerFlushOnCommit(pPager, bCommit) ){
+ sqlite3PcacheCleanAll(pPager->pPCache);
+ }else{
+ sqlite3PcacheClearWritable(pPager->pPCache);
+ }
+ sqlite3PcacheTruncate(pPager->pPCache, pPager->dbSize);
+ }
+
+ if( pagerUseWal(pPager) ){
+ /* Drop the WAL write-lock, if any. Also, if the connection was in
+ ** locking_mode=exclusive mode but is no longer, drop the EXCLUSIVE
+ ** lock held on the database file.
+ */
+ rc2 = sqlite3WalEndWriteTransaction(pPager->pWal);
+ assert( rc2==SQLITE_OK );
+ }else if( rc==SQLITE_OK && bCommit && pPager->dbFileSize>pPager->dbSize ){
+ /* This branch is taken when committing a transaction in rollback-journal
+ ** mode if the database file on disk is larger than the database image.
+ ** At this point the journal has been finalized and the transaction
+ ** successfully committed, but the EXCLUSIVE lock is still held on the
+ ** file. So it is safe to truncate the database file to its minimum
+ ** required size. */
+ assert( pPager->eLock==EXCLUSIVE_LOCK );
+ rc = pager_truncate(pPager, pPager->dbSize);
+ }
+
+ if( rc==SQLITE_OK && bCommit ){
+ rc = sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_COMMIT_PHASETWO, 0);
+ if( rc==SQLITE_NOTFOUND ) rc = SQLITE_OK;
+ }
+
+ if( !pPager->exclusiveMode
+ && (!pagerUseWal(pPager) || sqlite3WalExclusiveMode(pPager->pWal, 0))
+ ){
+ rc2 = pagerUnlockDb(pPager, SHARED_LOCK);
+ }
+ pPager->eState = PAGER_READER;
+ pPager->setSuper = 0;
+
+ return (rc==SQLITE_OK?rc2:rc);
+}
+
+/* Forward reference */
+static int pager_playback(Pager *pPager, int isHot);
+
+/*
+** Execute a rollback if a transaction is active and unlock the
+** database file.
+**
+** If the pager has already entered the ERROR state, do not attempt
+** the rollback at this time. Instead, pager_unlock() is called. The
+** call to pager_unlock() will discard all in-memory pages, unlock
+** the database file and move the pager back to OPEN state. If this
+** means that there is a hot-journal left in the file-system, the next
+** connection to obtain a shared lock on the pager (which may be this one)
+** will roll it back.
+**
+** If the pager has not already entered the ERROR state, but an IO or
+** malloc error occurs during a rollback, then this will itself cause
+** the pager to enter the ERROR state. Which will be cleared by the
+** call to pager_unlock(), as described above.
+*/
+static void pagerUnlockAndRollback(Pager *pPager){
+ if( pPager->eState!=PAGER_ERROR && pPager->eState!=PAGER_OPEN ){
+ assert( assert_pager_state(pPager) );
+ if( pPager->eState>=PAGER_WRITER_LOCKED ){
+ sqlite3BeginBenignMalloc();
+ sqlite3PagerRollback(pPager);
+ sqlite3EndBenignMalloc();
+ }else if( !pPager->exclusiveMode ){
+ assert( pPager->eState==PAGER_READER );
+ pager_end_transaction(pPager, 0, 0);
+ }
+ }else if( pPager->eState==PAGER_ERROR
+ && pPager->journalMode==PAGER_JOURNALMODE_MEMORY
+ && isOpen(pPager->jfd)
+ ){
+ /* Special case for a ROLLBACK due to I/O error with an in-memory
+ ** journal: We have to rollback immediately, before the journal is
+ ** closed, because once it is closed, all content is forgotten. */
+ int errCode = pPager->errCode;
+ u8 eLock = pPager->eLock;
+ pPager->eState = PAGER_OPEN;
+ pPager->errCode = SQLITE_OK;
+ pPager->eLock = EXCLUSIVE_LOCK;
+ pager_playback(pPager, 1);
+ pPager->errCode = errCode;
+ pPager->eLock = eLock;
+ }
+ pager_unlock(pPager);
+}
+
+/*
+** Parameter aData must point to a buffer of pPager->pageSize bytes
+** of data. Compute and return a checksum based on the contents of the
+** page of data and the current value of pPager->cksumInit.
+**
+** This is not a real checksum. It is really just the sum of the
+** random initial value (pPager->cksumInit) and every 200th byte
+** of the page data, starting with byte offset (pPager->pageSize%200).
+** Each byte is interpreted as an 8-bit unsigned integer.
+**
+** Changing the formula used to compute this checksum results in an
+** incompatible journal file format.
+**
+** If journal corruption occurs due to a power failure, the most likely
+** scenario is that one end or the other of the record will be changed.
+** It is much less likely that the two ends of the journal record will be
+** correct and the middle be corrupt. Thus, this "checksum" scheme,
+** though fast and simple, catches the mostly likely kind of corruption.
+*/
+static u32 pager_cksum(Pager *pPager, const u8 *aData){
+ u32 cksum = pPager->cksumInit; /* Checksum value to return */
+ int i = pPager->pageSize-200; /* Loop counter */
+ while( i>0 ){
+ cksum += aData[i];
+ i -= 200;
+ }
+ return cksum;
+}
+
+/*
+** Read a single page from either the journal file (if isMainJrnl==1) or
+** from the sub-journal (if isMainJrnl==0) and playback that page.
+** The page begins at offset *pOffset into the file. The *pOffset
+** value is increased to the start of the next page in the journal.
+**
+** The main rollback journal uses checksums - the statement journal does
+** not.
+**
+** If the page number of the page record read from the (sub-)journal file
+** is greater than the current value of Pager.dbSize, then playback is
+** skipped and SQLITE_OK is returned.
+**
+** If pDone is not NULL, then it is a record of pages that have already
+** been played back. If the page at *pOffset has already been played back
+** (if the corresponding pDone bit is set) then skip the playback.
+** Make sure the pDone bit corresponding to the *pOffset page is set
+** prior to returning.
+**
+** If the page record is successfully read from the (sub-)journal file
+** and played back, then SQLITE_OK is returned. If an IO error occurs
+** while reading the record from the (sub-)journal file or while writing
+** to the database file, then the IO error code is returned. If data
+** is successfully read from the (sub-)journal file but appears to be
+** corrupted, SQLITE_DONE is returned. Data is considered corrupted in
+** two circumstances:
+**
+** * If the record page-number is illegal (0 or PAGER_SJ_PGNO), or
+** * If the record is being rolled back from the main journal file
+** and the checksum field does not match the record content.
+**
+** Neither of these two scenarios are possible during a savepoint rollback.
+**
+** If this is a savepoint rollback, then memory may have to be dynamically
+** allocated by this function. If this is the case and an allocation fails,
+** SQLITE_NOMEM is returned.
+*/
+static int pager_playback_one_page(
+ Pager *pPager, /* The pager being played back */
+ i64 *pOffset, /* Offset of record to playback */
+ Bitvec *pDone, /* Bitvec of pages already played back */
+ int isMainJrnl, /* 1 -> main journal. 0 -> sub-journal. */
+ int isSavepnt /* True for a savepoint rollback */
+){
+ int rc;
+ PgHdr *pPg; /* An existing page in the cache */
+ Pgno pgno; /* The page number of a page in journal */
+ u32 cksum; /* Checksum used for sanity checking */
+ char *aData; /* Temporary storage for the page */
+ sqlite3_file *jfd; /* The file descriptor for the journal file */
+ int isSynced; /* True if journal page is synced */
+
+ assert( (isMainJrnl&~1)==0 ); /* isMainJrnl is 0 or 1 */
+ assert( (isSavepnt&~1)==0 ); /* isSavepnt is 0 or 1 */
+ assert( isMainJrnl || pDone ); /* pDone always used on sub-journals */
+ assert( isSavepnt || pDone==0 ); /* pDone never used on non-savepoint */
+
+ aData = pPager->pTmpSpace;
+ assert( aData ); /* Temp storage must have already been allocated */
+ assert( pagerUseWal(pPager)==0 || (!isMainJrnl && isSavepnt) );
+
+ /* Either the state is greater than PAGER_WRITER_CACHEMOD (a transaction
+ ** or savepoint rollback done at the request of the caller) or this is
+ ** a hot-journal rollback. If it is a hot-journal rollback, the pager
+ ** is in state OPEN and holds an EXCLUSIVE lock. Hot-journal rollback
+ ** only reads from the main journal, not the sub-journal.
+ */
+ assert( pPager->eState>=PAGER_WRITER_CACHEMOD
+ || (pPager->eState==PAGER_OPEN && pPager->eLock==EXCLUSIVE_LOCK)
+ );
+ assert( pPager->eState>=PAGER_WRITER_CACHEMOD || isMainJrnl );
+
+ /* Read the page number and page data from the journal or sub-journal
+ ** file. Return an error code to the caller if an IO error occurs.
+ */
+ jfd = isMainJrnl ? pPager->jfd : pPager->sjfd;
+ rc = read32bits(jfd, *pOffset, &pgno);
+ if( rc!=SQLITE_OK ) return rc;
+ rc = sqlite3OsRead(jfd, (u8*)aData, pPager->pageSize, (*pOffset)+4);
+ if( rc!=SQLITE_OK ) return rc;
+ *pOffset += pPager->pageSize + 4 + isMainJrnl*4;
+
+ /* Sanity checking on the page. This is more important that I originally
+ ** thought. If a power failure occurs while the journal is being written,
+ ** it could cause invalid data to be written into the journal. We need to
+ ** detect this invalid data (with high probability) and ignore it.
+ */
+ if( pgno==0 || pgno==PAGER_SJ_PGNO(pPager) ){
+ assert( !isSavepnt );
+ return SQLITE_DONE;
+ }
+ if( pgno>(Pgno)pPager->dbSize || sqlite3BitvecTest(pDone, pgno) ){
+ return SQLITE_OK;
+ }
+ if( isMainJrnl ){
+ rc = read32bits(jfd, (*pOffset)-4, &cksum);
+ if( rc ) return rc;
+ if( !isSavepnt && pager_cksum(pPager, (u8*)aData)!=cksum ){
+ return SQLITE_DONE;
+ }
+ }
+
+ /* If this page has already been played back before during the current
+ ** rollback, then don't bother to play it back again.
+ */
+ if( pDone && (rc = sqlite3BitvecSet(pDone, pgno))!=SQLITE_OK ){
+ return rc;
+ }
+
+ /* When playing back page 1, restore the nReserve setting
+ */
+ if( pgno==1 && pPager->nReserve!=((u8*)aData)[20] ){
+ pPager->nReserve = ((u8*)aData)[20];
+ }
+
+ /* If the pager is in CACHEMOD state, then there must be a copy of this
+ ** page in the pager cache. In this case just update the pager cache,
+ ** not the database file. The page is left marked dirty in this case.
+ **
+ ** An exception to the above rule: If the database is in no-sync mode
+ ** and a page is moved during an incremental vacuum then the page may
+ ** not be in the pager cache. Later: if a malloc() or IO error occurs
+ ** during a Movepage() call, then the page may not be in the cache
+ ** either. So the condition described in the above paragraph is not
+ ** assert()able.
+ **
+ ** If in WRITER_DBMOD, WRITER_FINISHED or OPEN state, then we update the
+ ** pager cache if it exists and the main file. The page is then marked
+ ** not dirty. Since this code is only executed in PAGER_OPEN state for
+ ** a hot-journal rollback, it is guaranteed that the page-cache is empty
+ ** if the pager is in OPEN state.
+ **
+ ** Ticket #1171: The statement journal might contain page content that is
+ ** different from the page content at the start of the transaction.
+ ** This occurs when a page is changed prior to the start of a statement
+ ** then changed again within the statement. When rolling back such a
+ ** statement we must not write to the original database unless we know
+ ** for certain that original page contents are synced into the main rollback
+ ** journal. Otherwise, a power loss might leave modified data in the
+ ** database file without an entry in the rollback journal that can
+ ** restore the database to its original form. Two conditions must be
+ ** met before writing to the database files. (1) the database must be
+ ** locked. (2) we know that the original page content is fully synced
+ ** in the main journal either because the page is not in cache or else
+ ** the page is marked as needSync==0.
+ **
+ ** 2008-04-14: When attempting to vacuum a corrupt database file, it
+ ** is possible to fail a statement on a database that does not yet exist.
+ ** Do not attempt to write if database file has never been opened.
+ */
+ if( pagerUseWal(pPager) ){
+ pPg = 0;
+ }else{
+ pPg = sqlite3PagerLookup(pPager, pgno);
+ }
+ assert( pPg || !MEMDB );
+ assert( pPager->eState!=PAGER_OPEN || pPg==0 || pPager->tempFile );
+ PAGERTRACE(("PLAYBACK %d page %d hash(%08x) %s\n",
+ PAGERID(pPager), pgno, pager_datahash(pPager->pageSize, (u8*)aData),
+ (isMainJrnl?"main-journal":"sub-journal")
+ ));
+ if( isMainJrnl ){
+ isSynced = pPager->noSync || (*pOffset <= pPager->journalHdr);
+ }else{
+ isSynced = (pPg==0 || 0==(pPg->flags & PGHDR_NEED_SYNC));
+ }
+ if( isOpen(pPager->fd)
+ && (pPager->eState>=PAGER_WRITER_DBMOD || pPager->eState==PAGER_OPEN)
+ && isSynced
+ ){
+ i64 ofst = (pgno-1)*(i64)pPager->pageSize;
+ testcase( !isSavepnt && pPg!=0 && (pPg->flags&PGHDR_NEED_SYNC)!=0 );
+ assert( !pagerUseWal(pPager) );
+
+ /* Write the data read from the journal back into the database file.
+ ** This is usually safe even for an encrypted database - as the data
+ ** was encrypted before it was written to the journal file. The exception
+ ** is if the data was just read from an in-memory sub-journal. In that
+ ** case it must be encrypted here before it is copied into the database
+ ** file. */
+ rc = sqlite3OsWrite(pPager->fd, (u8 *)aData, pPager->pageSize, ofst);
+
+ if( pgno>pPager->dbFileSize ){
+ pPager->dbFileSize = pgno;
+ }
+ if( pPager->pBackup ){
+ sqlite3BackupUpdate(pPager->pBackup, pgno, (u8*)aData);
+ }
+ }else if( !isMainJrnl && pPg==0 ){
+ /* If this is a rollback of a savepoint and data was not written to
+ ** the database and the page is not in-memory, there is a potential
+ ** problem. When the page is next fetched by the b-tree layer, it
+ ** will be read from the database file, which may or may not be
+ ** current.
+ **
+ ** There are a couple of different ways this can happen. All are quite
+ ** obscure. When running in synchronous mode, this can only happen
+ ** if the page is on the free-list at the start of the transaction, then
+ ** populated, then moved using sqlite3PagerMovepage().
+ **
+ ** The solution is to add an in-memory page to the cache containing
+ ** the data just read from the sub-journal. Mark the page as dirty
+ ** and if the pager requires a journal-sync, then mark the page as
+ ** requiring a journal-sync before it is written.
+ */
+ assert( isSavepnt );
+ assert( (pPager->doNotSpill & SPILLFLAG_ROLLBACK)==0 );
+ pPager->doNotSpill |= SPILLFLAG_ROLLBACK;
+ rc = sqlite3PagerGet(pPager, pgno, &pPg, 1);
+ assert( (pPager->doNotSpill & SPILLFLAG_ROLLBACK)!=0 );
+ pPager->doNotSpill &= ~SPILLFLAG_ROLLBACK;
+ if( rc!=SQLITE_OK ) return rc;
+ sqlite3PcacheMakeDirty(pPg);
+ }
+ if( pPg ){
+ /* No page should ever be explicitly rolled back that is in use, except
+ ** for page 1 which is held in use in order to keep the lock on the
+ ** database active. However such a page may be rolled back as a result
+ ** of an internal error resulting in an automatic call to
+ ** sqlite3PagerRollback().
+ */
+ void *pData;
+ pData = pPg->pData;
+ memcpy(pData, (u8*)aData, pPager->pageSize);
+ pPager->xReiniter(pPg);
+ /* It used to be that sqlite3PcacheMakeClean(pPg) was called here. But
+ ** that call was dangerous and had no detectable benefit since the cache
+ ** is normally cleaned by sqlite3PcacheCleanAll() after rollback and so
+ ** has been removed. */
+ pager_set_pagehash(pPg);
+
+ /* If this was page 1, then restore the value of Pager.dbFileVers.
+ ** Do this before any decoding. */
+ if( pgno==1 ){
+ memcpy(&pPager->dbFileVers, &((u8*)pData)[24],sizeof(pPager->dbFileVers));
+ }
+ sqlite3PcacheRelease(pPg);
+ }
+ return rc;
+}
+
+/*
+** Parameter zSuper is the name of a super-journal file. A single journal
+** file that referred to the super-journal file has just been rolled back.
+** This routine checks if it is possible to delete the super-journal file,
+** and does so if it is.
+**
+** Argument zSuper may point to Pager.pTmpSpace. So that buffer is not
+** available for use within this function.
+**
+** When a super-journal file is created, it is populated with the names
+** of all of its child journals, one after another, formatted as utf-8
+** encoded text. The end of each child journal file is marked with a
+** nul-terminator byte (0x00). i.e. the entire contents of a super-journal
+** file for a transaction involving two databases might be:
+**
+** "/home/bill/a.db-journal\x00/home/bill/b.db-journal\x00"
+**
+** A super-journal file may only be deleted once all of its child
+** journals have been rolled back.
+**
+** This function reads the contents of the super-journal file into
+** memory and loops through each of the child journal names. For
+** each child journal, it checks if:
+**
+** * if the child journal exists, and if so
+** * if the child journal contains a reference to super-journal
+** file zSuper
+**
+** If a child journal can be found that matches both of the criteria
+** above, this function returns without doing anything. Otherwise, if
+** no such child journal can be found, file zSuper is deleted from
+** the file-system using sqlite3OsDelete().
+**
+** If an IO error within this function, an error code is returned. This
+** function allocates memory by calling sqlite3Malloc(). If an allocation
+** fails, SQLITE_NOMEM is returned. Otherwise, if no IO or malloc errors
+** occur, SQLITE_OK is returned.
+**
+** TODO: This function allocates a single block of memory to load
+** the entire contents of the super-journal file. This could be
+** a couple of kilobytes or so - potentially larger than the page
+** size.
+*/
+static int pager_delsuper(Pager *pPager, const char *zSuper){
+ sqlite3_vfs *pVfs = pPager->pVfs;
+ int rc; /* Return code */
+ sqlite3_file *pSuper; /* Malloc'd super-journal file descriptor */
+ sqlite3_file *pJournal; /* Malloc'd child-journal file descriptor */
+ char *zSuperJournal = 0; /* Contents of super-journal file */
+ i64 nSuperJournal; /* Size of super-journal file */
+ char *zJournal; /* Pointer to one journal within MJ file */
+ char *zSuperPtr; /* Space to hold super-journal filename */
+ char *zFree = 0; /* Free this buffer */
+ int nSuperPtr; /* Amount of space allocated to zSuperPtr[] */
+
+ /* Allocate space for both the pJournal and pSuper file descriptors.
+ ** If successful, open the super-journal file for reading.
+ */
+ pSuper = (sqlite3_file *)sqlite3MallocZero(pVfs->szOsFile * 2);
+ if( !pSuper ){
+ rc = SQLITE_NOMEM_BKPT;
+ pJournal = 0;
+ }else{
+ const int flags = (SQLITE_OPEN_READONLY|SQLITE_OPEN_SUPER_JOURNAL);
+ rc = sqlite3OsOpen(pVfs, zSuper, pSuper, flags, 0);
+ pJournal = (sqlite3_file *)(((u8 *)pSuper) + pVfs->szOsFile);
+ }
+ if( rc!=SQLITE_OK ) goto delsuper_out;
+
+ /* Load the entire super-journal file into space obtained from
+ ** sqlite3_malloc() and pointed to by zSuperJournal. Also obtain
+ ** sufficient space (in zSuperPtr) to hold the names of super-journal
+ ** files extracted from regular rollback-journals.
+ */
+ rc = sqlite3OsFileSize(pSuper, &nSuperJournal);
+ if( rc!=SQLITE_OK ) goto delsuper_out;
+ nSuperPtr = pVfs->mxPathname+1;
+ zFree = sqlite3Malloc(4 + nSuperJournal + nSuperPtr + 2);
+ if( !zFree ){
+ rc = SQLITE_NOMEM_BKPT;
+ goto delsuper_out;
+ }
+ zFree[0] = zFree[1] = zFree[2] = zFree[3] = 0;
+ zSuperJournal = &zFree[4];
+ zSuperPtr = &zSuperJournal[nSuperJournal+2];
+ rc = sqlite3OsRead(pSuper, zSuperJournal, (int)nSuperJournal, 0);
+ if( rc!=SQLITE_OK ) goto delsuper_out;
+ zSuperJournal[nSuperJournal] = 0;
+ zSuperJournal[nSuperJournal+1] = 0;
+
+ zJournal = zSuperJournal;
+ while( (zJournal-zSuperJournal)<nSuperJournal ){
+ int exists;
+ rc = sqlite3OsAccess(pVfs, zJournal, SQLITE_ACCESS_EXISTS, &exists);
+ if( rc!=SQLITE_OK ){
+ goto delsuper_out;
+ }
+ if( exists ){
+ /* One of the journals pointed to by the super-journal exists.
+ ** Open it and check if it points at the super-journal. If
+ ** so, return without deleting the super-journal file.
+ ** NB: zJournal is really a MAIN_JOURNAL. But call it a
+ ** SUPER_JOURNAL here so that the VFS will not send the zJournal
+ ** name into sqlite3_database_file_object().
+ */
+ int c;
+ int flags = (SQLITE_OPEN_READONLY|SQLITE_OPEN_SUPER_JOURNAL);
+ rc = sqlite3OsOpen(pVfs, zJournal, pJournal, flags, 0);
+ if( rc!=SQLITE_OK ){
+ goto delsuper_out;
+ }
+
+ rc = readSuperJournal(pJournal, zSuperPtr, nSuperPtr);
+ sqlite3OsClose(pJournal);
+ if( rc!=SQLITE_OK ){
+ goto delsuper_out;
+ }
+
+ c = zSuperPtr[0]!=0 && strcmp(zSuperPtr, zSuper)==0;
+ if( c ){
+ /* We have a match. Do not delete the super-journal file. */
+ goto delsuper_out;
+ }
+ }
+ zJournal += (sqlite3Strlen30(zJournal)+1);
+ }
+
+ sqlite3OsClose(pSuper);
+ rc = sqlite3OsDelete(pVfs, zSuper, 0);
+
+delsuper_out:
+ sqlite3_free(zFree);
+ if( pSuper ){
+ sqlite3OsClose(pSuper);
+ assert( !isOpen(pJournal) );
+ sqlite3_free(pSuper);
+ }
+ return rc;
+}
+
+
+/*
+** This function is used to change the actual size of the database
+** file in the file-system. This only happens when committing a transaction,
+** or rolling back a transaction (including rolling back a hot-journal).
+**
+** If the main database file is not open, or the pager is not in either
+** DBMOD or OPEN state, this function is a no-op. Otherwise, the size
+** of the file is changed to nPage pages (nPage*pPager->pageSize bytes).
+** If the file on disk is currently larger than nPage pages, then use the VFS
+** xTruncate() method to truncate it.
+**
+** Or, it might be the case that the file on disk is smaller than
+** nPage pages. Some operating system implementations can get confused if
+** you try to truncate a file to some size that is larger than it
+** currently is, so detect this case and write a single zero byte to
+** the end of the new file instead.
+**
+** If successful, return SQLITE_OK. If an IO error occurs while modifying
+** the database file, return the error code to the caller.
+*/
+static int pager_truncate(Pager *pPager, Pgno nPage){
+ int rc = SQLITE_OK;
+ assert( pPager->eState!=PAGER_ERROR );
+ assert( pPager->eState!=PAGER_READER );
+ PAGERTRACE(("Truncate %d npage %u\n", PAGERID(pPager), nPage));
+
+
+ if( isOpen(pPager->fd)
+ && (pPager->eState>=PAGER_WRITER_DBMOD || pPager->eState==PAGER_OPEN)
+ ){
+ i64 currentSize, newSize;
+ int szPage = pPager->pageSize;
+ assert( pPager->eLock==EXCLUSIVE_LOCK );
+ /* TODO: Is it safe to use Pager.dbFileSize here? */
+ rc = sqlite3OsFileSize(pPager->fd, ¤tSize);
+ newSize = szPage*(i64)nPage;
+ if( rc==SQLITE_OK && currentSize!=newSize ){
+ if( currentSize>newSize ){
+ rc = sqlite3OsTruncate(pPager->fd, newSize);
+ }else if( (currentSize+szPage)<=newSize ){
+ char *pTmp = pPager->pTmpSpace;
+ memset(pTmp, 0, szPage);
+ testcase( (newSize-szPage) == currentSize );
+ testcase( (newSize-szPage) > currentSize );
+ sqlite3OsFileControlHint(pPager->fd, SQLITE_FCNTL_SIZE_HINT, &newSize);
+ rc = sqlite3OsWrite(pPager->fd, pTmp, szPage, newSize-szPage);
+ }
+ if( rc==SQLITE_OK ){
+ pPager->dbFileSize = nPage;
+ }
+ }
+ }
+ return rc;
+}
+
+/*
+** Return a sanitized version of the sector-size of OS file pFile. The
+** return value is guaranteed to lie between 32 and MAX_SECTOR_SIZE.
+*/
+SQLITE_PRIVATE int sqlite3SectorSize(sqlite3_file *pFile){
+ int iRet = sqlite3OsSectorSize(pFile);
+ if( iRet<32 ){
+ iRet = 512;
+ }else if( iRet>MAX_SECTOR_SIZE ){
+ assert( MAX_SECTOR_SIZE>=512 );
+ iRet = MAX_SECTOR_SIZE;
+ }
+ return iRet;
+}
+
+/*
+** Set the value of the Pager.sectorSize variable for the given
+** pager based on the value returned by the xSectorSize method
+** of the open database file. The sector size will be used
+** to determine the size and alignment of journal header and
+** super-journal pointers within created journal files.
+**
+** For temporary files the effective sector size is always 512 bytes.
+**
+** Otherwise, for non-temporary files, the effective sector size is
+** the value returned by the xSectorSize() method rounded up to 32 if
+** it is less than 32, or rounded down to MAX_SECTOR_SIZE if it
+** is greater than MAX_SECTOR_SIZE.
+**
+** If the file has the SQLITE_IOCAP_POWERSAFE_OVERWRITE property, then set
+** the effective sector size to its minimum value (512). The purpose of
+** pPager->sectorSize is to define the "blast radius" of bytes that
+** might change if a crash occurs while writing to a single byte in
+** that range. But with POWERSAFE_OVERWRITE, the blast radius is zero
+** (that is what POWERSAFE_OVERWRITE means), so we minimize the sector
+** size. For backwards compatibility of the rollback journal file format,
+** we cannot reduce the effective sector size below 512.
+*/
+static void setSectorSize(Pager *pPager){
+ assert( isOpen(pPager->fd) || pPager->tempFile );
+
+ if( pPager->tempFile
+ || (sqlite3OsDeviceCharacteristics(pPager->fd) &
+ SQLITE_IOCAP_POWERSAFE_OVERWRITE)!=0
+ ){
+ /* Sector size doesn't matter for temporary files. Also, the file
+ ** may not have been opened yet, in which case the OsSectorSize()
+ ** call will segfault. */
+ pPager->sectorSize = 512;
+ }else{
+ pPager->sectorSize = sqlite3SectorSize(pPager->fd);
+ }
+}
+
+/*
+** Playback the journal and thus restore the database file to
+** the state it was in before we started making changes.
+**
+** The journal file format is as follows:
+**
+** (1) 8 byte prefix. A copy of aJournalMagic[].
+** (2) 4 byte big-endian integer which is the number of valid page records
+** in the journal. If this value is 0xffffffff, then compute the
+** number of page records from the journal size.
+** (3) 4 byte big-endian integer which is the initial value for the
+** sanity checksum.
+** (4) 4 byte integer which is the number of pages to truncate the
+** database to during a rollback.
+** (5) 4 byte big-endian integer which is the sector size. The header
+** is this many bytes in size.
+** (6) 4 byte big-endian integer which is the page size.
+** (7) zero padding out to the next sector size.
+** (8) Zero or more pages instances, each as follows:
+** + 4 byte page number.
+** + pPager->pageSize bytes of data.
+** + 4 byte checksum
+**
+** When we speak of the journal header, we mean the first 7 items above.
+** Each entry in the journal is an instance of the 8th item.
+**
+** Call the value from the second bullet "nRec". nRec is the number of
+** valid page entries in the journal. In most cases, you can compute the
+** value of nRec from the size of the journal file. But if a power
+** failure occurred while the journal was being written, it could be the
+** case that the size of the journal file had already been increased but
+** the extra entries had not yet made it safely to disk. In such a case,
+** the value of nRec computed from the file size would be too large. For
+** that reason, we always use the nRec value in the header.
+**
+** If the nRec value is 0xffffffff it means that nRec should be computed
+** from the file size. This value is used when the user selects the
+** no-sync option for the journal. A power failure could lead to corruption
+** in this case. But for things like temporary table (which will be
+** deleted when the power is restored) we don't care.
+**
+** If the file opened as the journal file is not a well-formed
+** journal file then all pages up to the first corrupted page are rolled
+** back (or no pages if the journal header is corrupted). The journal file
+** is then deleted and SQLITE_OK returned, just as if no corruption had
+** been encountered.
+**
+** If an I/O or malloc() error occurs, the journal-file is not deleted
+** and an error code is returned.
+**
+** The isHot parameter indicates that we are trying to rollback a journal
+** that might be a hot journal. Or, it could be that the journal is
+** preserved because of JOURNALMODE_PERSIST or JOURNALMODE_TRUNCATE.
+** If the journal really is hot, reset the pager cache prior rolling
+** back any content. If the journal is merely persistent, no reset is
+** needed.
+*/
+static int pager_playback(Pager *pPager, int isHot){
+ sqlite3_vfs *pVfs = pPager->pVfs;
+ i64 szJ; /* Size of the journal file in bytes */
+ u32 nRec; /* Number of Records in the journal */
+ u32 u; /* Unsigned loop counter */
+ Pgno mxPg = 0; /* Size of the original file in pages */
+ int rc; /* Result code of a subroutine */
+ int res = 1; /* Value returned by sqlite3OsAccess() */
+ char *zSuper = 0; /* Name of super-journal file if any */
+ int needPagerReset; /* True to reset page prior to first page rollback */
+ int nPlayback = 0; /* Total number of pages restored from journal */
+ u32 savedPageSize = pPager->pageSize;
+
+ /* Figure out how many records are in the journal. Abort early if
+ ** the journal is empty.
+ */
+ assert( isOpen(pPager->jfd) );
+ rc = sqlite3OsFileSize(pPager->jfd, &szJ);
+ if( rc!=SQLITE_OK ){
+ goto end_playback;
+ }
+
+ /* Read the super-journal name from the journal, if it is present.
+ ** If a super-journal file name is specified, but the file is not
+ ** present on disk, then the journal is not hot and does not need to be
+ ** played back.
+ **
+ ** TODO: Technically the following is an error because it assumes that
+ ** buffer Pager.pTmpSpace is (mxPathname+1) bytes or larger. i.e. that
+ ** (pPager->pageSize >= pPager->pVfs->mxPathname+1). Using os_unix.c,
+ ** mxPathname is 512, which is the same as the minimum allowable value
+ ** for pageSize.
+ */
+ zSuper = pPager->pTmpSpace;
+ rc = readSuperJournal(pPager->jfd, zSuper, pPager->pVfs->mxPathname+1);
+ if( rc==SQLITE_OK && zSuper[0] ){
+ rc = sqlite3OsAccess(pVfs, zSuper, SQLITE_ACCESS_EXISTS, &res);
+ }
+ zSuper = 0;
+ if( rc!=SQLITE_OK || !res ){
+ goto end_playback;
+ }
+ pPager->journalOff = 0;
+ needPagerReset = isHot;
+
+ /* This loop terminates either when a readJournalHdr() or
+ ** pager_playback_one_page() call returns SQLITE_DONE or an IO error
+ ** occurs.
+ */
+ while( 1 ){
+ /* Read the next journal header from the journal file. If there are
+ ** not enough bytes left in the journal file for a complete header, or
+ ** it is corrupted, then a process must have failed while writing it.
+ ** This indicates nothing more needs to be rolled back.
+ */
+ rc = readJournalHdr(pPager, isHot, szJ, &nRec, &mxPg);
+ if( rc!=SQLITE_OK ){
+ if( rc==SQLITE_DONE ){
+ rc = SQLITE_OK;
+ }
+ goto end_playback;
+ }
+
+ /* If nRec is 0xffffffff, then this journal was created by a process
+ ** working in no-sync mode. This means that the rest of the journal
+ ** file consists of pages, there are no more journal headers. Compute
+ ** the value of nRec based on this assumption.
+ */
+ if( nRec==0xffffffff ){
+ assert( pPager->journalOff==JOURNAL_HDR_SZ(pPager) );
+ nRec = (int)((szJ - JOURNAL_HDR_SZ(pPager))/JOURNAL_PG_SZ(pPager));
+ }
+
+ /* If nRec is 0 and this rollback is of a transaction created by this
+ ** process and if this is the final header in the journal, then it means
+ ** that this part of the journal was being filled but has not yet been
+ ** synced to disk. Compute the number of pages based on the remaining
+ ** size of the file.
+ **
+ ** The third term of the test was added to fix ticket #2565.
+ ** When rolling back a hot journal, nRec==0 always means that the next
+ ** chunk of the journal contains zero pages to be rolled back. But
+ ** when doing a ROLLBACK and the nRec==0 chunk is the last chunk in
+ ** the journal, it means that the journal might contain additional
+ ** pages that need to be rolled back and that the number of pages
+ ** should be computed based on the journal file size.
+ */
+ if( nRec==0 && !isHot &&
+ pPager->journalHdr+JOURNAL_HDR_SZ(pPager)==pPager->journalOff ){
+ nRec = (int)((szJ - pPager->journalOff) / JOURNAL_PG_SZ(pPager));
+ }
+
+ /* If this is the first header read from the journal, truncate the
+ ** database file back to its original size.
+ */
+ if( pPager->journalOff==JOURNAL_HDR_SZ(pPager) ){
+ rc = pager_truncate(pPager, mxPg);
+ if( rc!=SQLITE_OK ){
+ goto end_playback;
+ }
+ pPager->dbSize = mxPg;
+ if( pPager->mxPgno<mxPg ){
+ pPager->mxPgno = mxPg;
+ }
+ }
+
+ /* Copy original pages out of the journal and back into the
+ ** database file and/or page cache.
+ */
+ for(u=0; u<nRec; u++){
+ if( needPagerReset ){
+ pager_reset(pPager);
+ needPagerReset = 0;
+ }
+ rc = pager_playback_one_page(pPager,&pPager->journalOff,0,1,0);
+ if( rc==SQLITE_OK ){
+ nPlayback++;
+ }else{
+ if( rc==SQLITE_DONE ){
+ pPager->journalOff = szJ;
+ break;
+ }else if( rc==SQLITE_IOERR_SHORT_READ ){
+ /* If the journal has been truncated, simply stop reading and
+ ** processing the journal. This might happen if the journal was
+ ** not completely written and synced prior to a crash. In that
+ ** case, the database should have never been written in the
+ ** first place so it is OK to simply abandon the rollback. */
+ rc = SQLITE_OK;
+ goto end_playback;
+ }else{
+ /* If we are unable to rollback, quit and return the error
+ ** code. This will cause the pager to enter the error state
+ ** so that no further harm will be done. Perhaps the next
+ ** process to come along will be able to rollback the database.
+ */
+ goto end_playback;
+ }
+ }
+ }
+ }
+ /*NOTREACHED*/
+ assert( 0 );
+
+end_playback:
+ if( rc==SQLITE_OK ){
+ rc = sqlite3PagerSetPagesize(pPager, &savedPageSize, -1);
+ }
+ /* Following a rollback, the database file should be back in its original
+ ** state prior to the start of the transaction, so invoke the
+ ** SQLITE_FCNTL_DB_UNCHANGED file-control method to disable the
+ ** assertion that the transaction counter was modified.
+ */
+#ifdef SQLITE_DEBUG
+ sqlite3OsFileControlHint(pPager->fd,SQLITE_FCNTL_DB_UNCHANGED,0);
+#endif
+
+ /* If this playback is happening automatically as a result of an IO or
+ ** malloc error that occurred after the change-counter was updated but
+ ** before the transaction was committed, then the change-counter
+ ** modification may just have been reverted. If this happens in exclusive
+ ** mode, then subsequent transactions performed by the connection will not
+ ** update the change-counter at all. This may lead to cache inconsistency
+ ** problems for other processes at some point in the future. So, just
+ ** in case this has happened, clear the changeCountDone flag now.
+ */
+ pPager->changeCountDone = pPager->tempFile;
+
+ if( rc==SQLITE_OK ){
+ /* Leave 4 bytes of space before the super-journal filename in memory.
+ ** This is because it may end up being passed to sqlite3OsOpen(), in
+ ** which case it requires 4 0x00 bytes in memory immediately before
+ ** the filename. */
+ zSuper = &pPager->pTmpSpace[4];
+ rc = readSuperJournal(pPager->jfd, zSuper, pPager->pVfs->mxPathname+1);
+ testcase( rc!=SQLITE_OK );
+ }
+ if( rc==SQLITE_OK
+ && (pPager->eState>=PAGER_WRITER_DBMOD || pPager->eState==PAGER_OPEN)
+ ){
+ rc = sqlite3PagerSync(pPager, 0);
+ }
+ if( rc==SQLITE_OK ){
+ rc = pager_end_transaction(pPager, zSuper[0]!='\0', 0);
+ testcase( rc!=SQLITE_OK );
+ }
+ if( rc==SQLITE_OK && zSuper[0] && res ){
+ /* If there was a super-journal and this routine will return success,
+ ** see if it is possible to delete the super-journal.
+ */
+ assert( zSuper==&pPager->pTmpSpace[4] );
+ memset(pPager->pTmpSpace, 0, 4);
+ rc = pager_delsuper(pPager, zSuper);
+ testcase( rc!=SQLITE_OK );
+ }
+ if( isHot && nPlayback ){
+ sqlite3_log(SQLITE_NOTICE_RECOVER_ROLLBACK, "recovered %d pages from %s",
+ nPlayback, pPager->zJournal);
+ }
+
+ /* The Pager.sectorSize variable may have been updated while rolling
+ ** back a journal created by a process with a different sector size
+ ** value. Reset it to the correct value for this process.
+ */
+ setSectorSize(pPager);
+ return rc;
+}
+
+
+/*
+** Read the content for page pPg out of the database file (or out of
+** the WAL if that is where the most recent copy if found) into
+** pPg->pData. A shared lock or greater must be held on the database
+** file before this function is called.
+**
+** If page 1 is read, then the value of Pager.dbFileVers[] is set to
+** the value read from the database file.
+**
+** If an IO error occurs, then the IO error is returned to the caller.
+** Otherwise, SQLITE_OK is returned.
+*/
+static int readDbPage(PgHdr *pPg){
+ Pager *pPager = pPg->pPager; /* Pager object associated with page pPg */
+ int rc = SQLITE_OK; /* Return code */
+
+#ifndef SQLITE_OMIT_WAL
+ u32 iFrame = 0; /* Frame of WAL containing pgno */
+
+ assert( pPager->eState>=PAGER_READER && !MEMDB );
+ assert( isOpen(pPager->fd) );
+
+ if( pagerUseWal(pPager) ){
+ rc = sqlite3WalFindFrame(pPager->pWal, pPg->pgno, &iFrame);
+ if( rc ) return rc;
+ }
+ if( iFrame ){
+ rc = sqlite3WalReadFrame(pPager->pWal, iFrame,pPager->pageSize,pPg->pData);
+ }else
+#endif
+ {
+ i64 iOffset = (pPg->pgno-1)*(i64)pPager->pageSize;
+ rc = sqlite3OsRead(pPager->fd, pPg->pData, pPager->pageSize, iOffset);
+ if( rc==SQLITE_IOERR_SHORT_READ ){
+ rc = SQLITE_OK;
+ }
+ }
+
+ if( pPg->pgno==1 ){
+ if( rc ){
+ /* If the read is unsuccessful, set the dbFileVers[] to something
+ ** that will never be a valid file version. dbFileVers[] is a copy
+ ** of bytes 24..39 of the database. Bytes 28..31 should always be
+ ** zero or the size of the database in page. Bytes 32..35 and 35..39
+ ** should be page numbers which are never 0xffffffff. So filling
+ ** pPager->dbFileVers[] with all 0xff bytes should suffice.
+ **
+ ** For an encrypted database, the situation is more complex: bytes
+ ** 24..39 of the database are white noise. But the probability of
+ ** white noise equaling 16 bytes of 0xff is vanishingly small so
+ ** we should still be ok.
+ */
+ memset(pPager->dbFileVers, 0xff, sizeof(pPager->dbFileVers));
+ }else{
+ u8 *dbFileVers = &((u8*)pPg->pData)[24];
+ memcpy(&pPager->dbFileVers, dbFileVers, sizeof(pPager->dbFileVers));
+ }
+ }
+ PAGER_INCR(sqlite3_pager_readdb_count);
+ PAGER_INCR(pPager->nRead);
+ IOTRACE(("PGIN %p %d\n", pPager, pPg->pgno));
+ PAGERTRACE(("FETCH %d page %d hash(%08x)\n",
+ PAGERID(pPager), pPg->pgno, pager_pagehash(pPg)));
+
+ return rc;
+}
+
+/*
+** Update the value of the change-counter at offsets 24 and 92 in
+** the header and the sqlite version number at offset 96.
+**
+** This is an unconditional update. See also the pager_incr_changecounter()
+** routine which only updates the change-counter if the update is actually
+** needed, as determined by the pPager->changeCountDone state variable.
+*/
+static void pager_write_changecounter(PgHdr *pPg){
+ u32 change_counter;
+ if( NEVER(pPg==0) ) return;
+
+ /* Increment the value just read and write it back to byte 24. */
+ change_counter = sqlite3Get4byte((u8*)pPg->pPager->dbFileVers)+1;
+ put32bits(((char*)pPg->pData)+24, change_counter);
+
+ /* Also store the SQLite version number in bytes 96..99 and in
+ ** bytes 92..95 store the change counter for which the version number
+ ** is valid. */
+ put32bits(((char*)pPg->pData)+92, change_counter);
+ put32bits(((char*)pPg->pData)+96, SQLITE_VERSION_NUMBER);
+}
+
+#ifndef SQLITE_OMIT_WAL
+/*
+** This function is invoked once for each page that has already been
+** written into the log file when a WAL transaction is rolled back.
+** Parameter iPg is the page number of said page. The pCtx argument
+** is actually a pointer to the Pager structure.
+**
+** If page iPg is present in the cache, and has no outstanding references,
+** it is discarded. Otherwise, if there are one or more outstanding
+** references, the page content is reloaded from the database. If the
+** attempt to reload content from the database is required and fails,
+** return an SQLite error code. Otherwise, SQLITE_OK.
+*/
+static int pagerUndoCallback(void *pCtx, Pgno iPg){
+ int rc = SQLITE_OK;
+ Pager *pPager = (Pager *)pCtx;
+ PgHdr *pPg;
+
+ assert( pagerUseWal(pPager) );
+ pPg = sqlite3PagerLookup(pPager, iPg);
+ if( pPg ){
+ if( sqlite3PcachePageRefcount(pPg)==1 ){
+ sqlite3PcacheDrop(pPg);
+ }else{
+ rc = readDbPage(pPg);
+ if( rc==SQLITE_OK ){
+ pPager->xReiniter(pPg);
+ }
+ sqlite3PagerUnrefNotNull(pPg);
+ }
+ }
+
+ /* Normally, if a transaction is rolled back, any backup processes are
+ ** updated as data is copied out of the rollback journal and into the
+ ** database. This is not generally possible with a WAL database, as
+ ** rollback involves simply truncating the log file. Therefore, if one
+ ** or more frames have already been written to the log (and therefore
+ ** also copied into the backup databases) as part of this transaction,
+ ** the backups must be restarted.
+ */
+ sqlite3BackupRestart(pPager->pBackup);
+
+ return rc;
+}
+
+/*
+** This function is called to rollback a transaction on a WAL database.
+*/
+static int pagerRollbackWal(Pager *pPager){
+ int rc; /* Return Code */
+ PgHdr *pList; /* List of dirty pages to revert */
+
+ /* For all pages in the cache that are currently dirty or have already
+ ** been written (but not committed) to the log file, do one of the
+ ** following:
+ **
+ ** + Discard the cached page (if refcount==0), or
+ ** + Reload page content from the database (if refcount>0).
+ */
+ pPager->dbSize = pPager->dbOrigSize;
+ rc = sqlite3WalUndo(pPager->pWal, pagerUndoCallback, (void *)pPager);
+ pList = sqlite3PcacheDirtyList(pPager->pPCache);
+ while( pList && rc==SQLITE_OK ){
+ PgHdr *pNext = pList->pDirty;
+ rc = pagerUndoCallback((void *)pPager, pList->pgno);
+ pList = pNext;
+ }
+
+ return rc;
+}
+
+/*
+** This function is a wrapper around sqlite3WalFrames(). As well as logging
+** the contents of the list of pages headed by pList (connected by pDirty),
+** this function notifies any active backup processes that the pages have
+** changed.
+**
+** The list of pages passed into this routine is always sorted by page number.
+** Hence, if page 1 appears anywhere on the list, it will be the first page.
+*/
+static int pagerWalFrames(
+ Pager *pPager, /* Pager object */
+ PgHdr *pList, /* List of frames to log */
+ Pgno nTruncate, /* Database size after this commit */
+ int isCommit /* True if this is a commit */
+){
+ int rc; /* Return code */
+ int nList; /* Number of pages in pList */
+ PgHdr *p; /* For looping over pages */
+
+ assert( pPager->pWal );
+ assert( pList );
+#ifdef SQLITE_DEBUG
+ /* Verify that the page list is in ascending order */
+ for(p=pList; p && p->pDirty; p=p->pDirty){
+ assert( p->pgno < p->pDirty->pgno );
+ }
+#endif
+
+ assert( pList->pDirty==0 || isCommit );
+ if( isCommit ){
+ /* If a WAL transaction is being committed, there is no point in writing
+ ** any pages with page numbers greater than nTruncate into the WAL file.
+ ** They will never be read by any client. So remove them from the pDirty
+ ** list here. */
+ PgHdr **ppNext = &pList;
+ nList = 0;
+ for(p=pList; (*ppNext = p)!=0; p=p->pDirty){
+ if( p->pgno<=nTruncate ){
+ ppNext = &p->pDirty;
+ nList++;
+ }
+ }
+ assert( pList );
+ }else{
+ nList = 1;
+ }
+ pPager->aStat[PAGER_STAT_WRITE] += nList;
+
+ if( pList->pgno==1 ) pager_write_changecounter(pList);
+ rc = sqlite3WalFrames(pPager->pWal,
+ pPager->pageSize, pList, nTruncate, isCommit, pPager->walSyncFlags
+ );
+ if( rc==SQLITE_OK && pPager->pBackup ){
+ for(p=pList; p; p=p->pDirty){
+ sqlite3BackupUpdate(pPager->pBackup, p->pgno, (u8 *)p->pData);
+ }
+ }
+
+#ifdef SQLITE_CHECK_PAGES
+ pList = sqlite3PcacheDirtyList(pPager->pPCache);
+ for(p=pList; p; p=p->pDirty){
+ pager_set_pagehash(p);
+ }
+#endif
+
+ return rc;
+}
+
+/*
+** Begin a read transaction on the WAL.
+**
+** This routine used to be called "pagerOpenSnapshot()" because it essentially
+** makes a snapshot of the database at the current point in time and preserves
+** that snapshot for use by the reader in spite of concurrently changes by
+** other writers or checkpointers.
+*/
+static int pagerBeginReadTransaction(Pager *pPager){
+ int rc; /* Return code */
+ int changed = 0; /* True if cache must be reset */
+
+ assert( pagerUseWal(pPager) );
+ assert( pPager->eState==PAGER_OPEN || pPager->eState==PAGER_READER );
+
+ /* sqlite3WalEndReadTransaction() was not called for the previous
+ ** transaction in locking_mode=EXCLUSIVE. So call it now. If we
+ ** are in locking_mode=NORMAL and EndRead() was previously called,
+ ** the duplicate call is harmless.
+ */
+ sqlite3WalEndReadTransaction(pPager->pWal);
+
+ rc = sqlite3WalBeginReadTransaction(pPager->pWal, &changed);
+ if( rc!=SQLITE_OK || changed ){
+ pager_reset(pPager);
+ if( USEFETCH(pPager) ) sqlite3OsUnfetch(pPager->fd, 0, 0);
+ }
+
+ return rc;
+}
+#endif
+
+/*
+** This function is called as part of the transition from PAGER_OPEN
+** to PAGER_READER state to determine the size of the database file
+** in pages (assuming the page size currently stored in Pager.pageSize).
+**
+** If no error occurs, SQLITE_OK is returned and the size of the database
+** in pages is stored in *pnPage. Otherwise, an error code (perhaps
+** SQLITE_IOERR_FSTAT) is returned and *pnPage is left unmodified.
+*/
+static int pagerPagecount(Pager *pPager, Pgno *pnPage){
+ Pgno nPage; /* Value to return via *pnPage */
+
+ /* Query the WAL sub-system for the database size. The WalDbsize()
+ ** function returns zero if the WAL is not open (i.e. Pager.pWal==0), or
+ ** if the database size is not available. The database size is not
+ ** available from the WAL sub-system if the log file is empty or
+ ** contains no valid committed transactions.
+ */
+ assert( pPager->eState==PAGER_OPEN );
+ assert( pPager->eLock>=SHARED_LOCK );
+ assert( isOpen(pPager->fd) );
+ assert( pPager->tempFile==0 );
+ nPage = sqlite3WalDbsize(pPager->pWal);
+
+ /* If the number of pages in the database is not available from the
+ ** WAL sub-system, determine the page count based on the size of
+ ** the database file. If the size of the database file is not an
+ ** integer multiple of the page-size, round up the result.
+ */
+ if( nPage==0 && ALWAYS(isOpen(pPager->fd)) ){
+ i64 n = 0; /* Size of db file in bytes */
+ int rc = sqlite3OsFileSize(pPager->fd, &n);
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+ nPage = (Pgno)((n+pPager->pageSize-1) / pPager->pageSize);
+ }
+
+ /* If the current number of pages in the file is greater than the
+ ** configured maximum pager number, increase the allowed limit so
+ ** that the file can be read.
+ */
+ if( nPage>pPager->mxPgno ){
+ pPager->mxPgno = (Pgno)nPage;
+ }
+
+ *pnPage = nPage;
+ return SQLITE_OK;
+}
+
+#ifndef SQLITE_OMIT_WAL
+/*
+** Check if the *-wal file that corresponds to the database opened by pPager
+** exists if the database is not empty, or verify that the *-wal file does
+** not exist (by deleting it) if the database file is empty.
+**
+** If the database is not empty and the *-wal file exists, open the pager
+** in WAL mode. If the database is empty or if no *-wal file exists and
+** if no error occurs, make sure Pager.journalMode is not set to
+** PAGER_JOURNALMODE_WAL.
+**
+** Return SQLITE_OK or an error code.
+**
+** The caller must hold a SHARED lock on the database file to call this
+** function. Because an EXCLUSIVE lock on the db file is required to delete
+** a WAL on a none-empty database, this ensures there is no race condition
+** between the xAccess() below and an xDelete() being executed by some
+** other connection.
+*/
+static int pagerOpenWalIfPresent(Pager *pPager){
+ int rc = SQLITE_OK;
+ assert( pPager->eState==PAGER_OPEN );
+ assert( pPager->eLock>=SHARED_LOCK );
+
+ if( !pPager->tempFile ){
+ int isWal; /* True if WAL file exists */
+ rc = sqlite3OsAccess(
+ pPager->pVfs, pPager->zWal, SQLITE_ACCESS_EXISTS, &isWal
+ );
+ if( rc==SQLITE_OK ){
+ if( isWal ){
+ Pgno nPage; /* Size of the database file */
+
+ rc = pagerPagecount(pPager, &nPage);
+ if( rc ) return rc;
+ if( nPage==0 ){
+ rc = sqlite3OsDelete(pPager->pVfs, pPager->zWal, 0);
+ }else{
+ testcase( sqlite3PcachePagecount(pPager->pPCache)==0 );
+ rc = sqlite3PagerOpenWal(pPager, 0);
+ }
+ }else if( pPager->journalMode==PAGER_JOURNALMODE_WAL ){
+ pPager->journalMode = PAGER_JOURNALMODE_DELETE;
+ }
+ }
+ }
+ return rc;
+}
+#endif
+
+/*
+** Playback savepoint pSavepoint. Or, if pSavepoint==NULL, then playback
+** the entire super-journal file. The case pSavepoint==NULL occurs when
+** a ROLLBACK TO command is invoked on a SAVEPOINT that is a transaction
+** savepoint.
+**
+** When pSavepoint is not NULL (meaning a non-transaction savepoint is
+** being rolled back), then the rollback consists of up to three stages,
+** performed in the order specified:
+**
+** * Pages are played back from the main journal starting at byte
+** offset PagerSavepoint.iOffset and continuing to
+** PagerSavepoint.iHdrOffset, or to the end of the main journal
+** file if PagerSavepoint.iHdrOffset is zero.
+**
+** * If PagerSavepoint.iHdrOffset is not zero, then pages are played
+** back starting from the journal header immediately following
+** PagerSavepoint.iHdrOffset to the end of the main journal file.
+**
+** * Pages are then played back from the sub-journal file, starting
+** with the PagerSavepoint.iSubRec and continuing to the end of
+** the journal file.
+**
+** Throughout the rollback process, each time a page is rolled back, the
+** corresponding bit is set in a bitvec structure (variable pDone in the
+** implementation below). This is used to ensure that a page is only
+** rolled back the first time it is encountered in either journal.
+**
+** If pSavepoint is NULL, then pages are only played back from the main
+** journal file. There is no need for a bitvec in this case.
+**
+** In either case, before playback commences the Pager.dbSize variable
+** is reset to the value that it held at the start of the savepoint
+** (or transaction). No page with a page-number greater than this value
+** is played back. If one is encountered it is simply skipped.
+*/
+static int pagerPlaybackSavepoint(Pager *pPager, PagerSavepoint *pSavepoint){
+ i64 szJ; /* Effective size of the main journal */
+ i64 iHdrOff; /* End of first segment of main-journal records */
+ int rc = SQLITE_OK; /* Return code */
+ Bitvec *pDone = 0; /* Bitvec to ensure pages played back only once */
+
+ assert( pPager->eState!=PAGER_ERROR );
+ assert( pPager->eState>=PAGER_WRITER_LOCKED );
+
+ /* Allocate a bitvec to use to store the set of pages rolled back */
+ if( pSavepoint ){
+ pDone = sqlite3BitvecCreate(pSavepoint->nOrig);
+ if( !pDone ){
+ return SQLITE_NOMEM_BKPT;
+ }
+ }
+
+ /* Set the database size back to the value it was before the savepoint
+ ** being reverted was opened.
+ */
+ pPager->dbSize = pSavepoint ? pSavepoint->nOrig : pPager->dbOrigSize;
+ pPager->changeCountDone = pPager->tempFile;
+
+ if( !pSavepoint && pagerUseWal(pPager) ){
+ return pagerRollbackWal(pPager);
+ }
+
+ /* Use pPager->journalOff as the effective size of the main rollback
+ ** journal. The actual file might be larger than this in
+ ** PAGER_JOURNALMODE_TRUNCATE or PAGER_JOURNALMODE_PERSIST. But anything
+ ** past pPager->journalOff is off-limits to us.
+ */
+ szJ = pPager->journalOff;
+ assert( pagerUseWal(pPager)==0 || szJ==0 );
+
+ /* Begin by rolling back records from the main journal starting at
+ ** PagerSavepoint.iOffset and continuing to the next journal header.
+ ** There might be records in the main journal that have a page number
+ ** greater than the current database size (pPager->dbSize) but those
+ ** will be skipped automatically. Pages are added to pDone as they
+ ** are played back.
+ */
+ if( pSavepoint && !pagerUseWal(pPager) ){
+ iHdrOff = pSavepoint->iHdrOffset ? pSavepoint->iHdrOffset : szJ;
+ pPager->journalOff = pSavepoint->iOffset;
+ while( rc==SQLITE_OK && pPager->journalOff<iHdrOff ){
+ rc = pager_playback_one_page(pPager, &pPager->journalOff, pDone, 1, 1);
+ }
+ assert( rc!=SQLITE_DONE );
+ }else{
+ pPager->journalOff = 0;
+ }
+
+ /* Continue rolling back records out of the main journal starting at
+ ** the first journal header seen and continuing until the effective end
+ ** of the main journal file. Continue to skip out-of-range pages and
+ ** continue adding pages rolled back to pDone.
+ */
+ while( rc==SQLITE_OK && pPager->journalOff<szJ ){
+ u32 ii; /* Loop counter */
+ u32 nJRec = 0; /* Number of Journal Records */
+ u32 dummy;
+ rc = readJournalHdr(pPager, 0, szJ, &nJRec, &dummy);
+ assert( rc!=SQLITE_DONE );
+
+ /*
+ ** The "pPager->journalHdr+JOURNAL_HDR_SZ(pPager)==pPager->journalOff"
+ ** test is related to ticket #2565. See the discussion in the
+ ** pager_playback() function for additional information.
+ */
+ if( nJRec==0
+ && pPager->journalHdr+JOURNAL_HDR_SZ(pPager)==pPager->journalOff
+ ){
+ nJRec = (u32)((szJ - pPager->journalOff)/JOURNAL_PG_SZ(pPager));
+ }
+ for(ii=0; rc==SQLITE_OK && ii<nJRec && pPager->journalOff<szJ; ii++){
+ rc = pager_playback_one_page(pPager, &pPager->journalOff, pDone, 1, 1);
+ }
+ assert( rc!=SQLITE_DONE );
+ }
+ assert( rc!=SQLITE_OK || pPager->journalOff>=szJ );
+
+ /* Finally, rollback pages from the sub-journal. Page that were
+ ** previously rolled back out of the main journal (and are hence in pDone)
+ ** will be skipped. Out-of-range pages are also skipped.
+ */
+ if( pSavepoint ){
+ u32 ii; /* Loop counter */
+ i64 offset = (i64)pSavepoint->iSubRec*(4+pPager->pageSize);
+
+ if( pagerUseWal(pPager) ){
+ rc = sqlite3WalSavepointUndo(pPager->pWal, pSavepoint->aWalData);
+ }
+ for(ii=pSavepoint->iSubRec; rc==SQLITE_OK && ii<pPager->nSubRec; ii++){
+ assert( offset==(i64)ii*(4+pPager->pageSize) );
+ rc = pager_playback_one_page(pPager, &offset, pDone, 0, 1);
+ }
+ assert( rc!=SQLITE_DONE );
+ }
+
+ sqlite3BitvecDestroy(pDone);
+ if( rc==SQLITE_OK ){
+ pPager->journalOff = szJ;
+ }
+
+ return rc;
+}
+
+/*
+** Change the maximum number of in-memory pages that are allowed
+** before attempting to recycle clean and unused pages.
+*/
+SQLITE_PRIVATE void sqlite3PagerSetCachesize(Pager *pPager, int mxPage){
+ sqlite3PcacheSetCachesize(pPager->pPCache, mxPage);
+}
+
+/*
+** Change the maximum number of in-memory pages that are allowed
+** before attempting to spill pages to journal.
+*/
+SQLITE_PRIVATE int sqlite3PagerSetSpillsize(Pager *pPager, int mxPage){
+ return sqlite3PcacheSetSpillsize(pPager->pPCache, mxPage);
+}
+
+/*
+** Invoke SQLITE_FCNTL_MMAP_SIZE based on the current value of szMmap.
+*/
+static void pagerFixMaplimit(Pager *pPager){
+#if SQLITE_MAX_MMAP_SIZE>0
+ sqlite3_file *fd = pPager->fd;
+ if( isOpen(fd) && fd->pMethods->iVersion>=3 ){
+ sqlite3_int64 sz;
+ sz = pPager->szMmap;
+ pPager->bUseFetch = (sz>0);
+ setGetterMethod(pPager);
+ sqlite3OsFileControlHint(pPager->fd, SQLITE_FCNTL_MMAP_SIZE, &sz);
+ }
+#endif
+}
+
+/*
+** Change the maximum size of any memory mapping made of the database file.
+*/
+SQLITE_PRIVATE void sqlite3PagerSetMmapLimit(Pager *pPager, sqlite3_int64 szMmap){
+ pPager->szMmap = szMmap;
+ pagerFixMaplimit(pPager);
+}
+
+/*
+** Free as much memory as possible from the pager.
+*/
+SQLITE_PRIVATE void sqlite3PagerShrink(Pager *pPager){
+ sqlite3PcacheShrink(pPager->pPCache);
+}
+
+/*
+** Adjust settings of the pager to those specified in the pgFlags parameter.
+**
+** The "level" in pgFlags & PAGER_SYNCHRONOUS_MASK sets the robustness
+** of the database to damage due to OS crashes or power failures by
+** changing the number of syncs()s when writing the journals.
+** There are four levels:
+**
+** OFF sqlite3OsSync() is never called. This is the default
+** for temporary and transient files.
+**
+** NORMAL The journal is synced once before writes begin on the
+** database. This is normally adequate protection, but
+** it is theoretically possible, though very unlikely,
+** that an inopertune power failure could leave the journal
+** in a state which would cause damage to the database
+** when it is rolled back.
+**
+** FULL The journal is synced twice before writes begin on the
+** database (with some additional information - the nRec field
+** of the journal header - being written in between the two
+** syncs). If we assume that writing a
+** single disk sector is atomic, then this mode provides
+** assurance that the journal will not be corrupted to the
+** point of causing damage to the database during rollback.
+**
+** EXTRA This is like FULL except that is also syncs the directory
+** that contains the rollback journal after the rollback
+** journal is unlinked.
+**
+** The above is for a rollback-journal mode. For WAL mode, OFF continues
+** to mean that no syncs ever occur. NORMAL means that the WAL is synced
+** prior to the start of checkpoint and that the database file is synced
+** at the conclusion of the checkpoint if the entire content of the WAL
+** was written back into the database. But no sync operations occur for
+** an ordinary commit in NORMAL mode with WAL. FULL means that the WAL
+** file is synced following each commit operation, in addition to the
+** syncs associated with NORMAL. There is no difference between FULL
+** and EXTRA for WAL mode.
+**
+** Do not confuse synchronous=FULL with SQLITE_SYNC_FULL. The
+** SQLITE_SYNC_FULL macro means to use the MacOSX-style full-fsync
+** using fcntl(F_FULLFSYNC). SQLITE_SYNC_NORMAL means to do an
+** ordinary fsync() call. There is no difference between SQLITE_SYNC_FULL
+** and SQLITE_SYNC_NORMAL on platforms other than MacOSX. But the
+** synchronous=FULL versus synchronous=NORMAL setting determines when
+** the xSync primitive is called and is relevant to all platforms.
+**
+** Numeric values associated with these states are OFF==1, NORMAL=2,
+** and FULL=3.
+*/
+SQLITE_PRIVATE void sqlite3PagerSetFlags(
+ Pager *pPager, /* The pager to set safety level for */
+ unsigned pgFlags /* Various flags */
+){
+ unsigned level = pgFlags & PAGER_SYNCHRONOUS_MASK;
+ if( pPager->tempFile ){
+ pPager->noSync = 1;
+ pPager->fullSync = 0;
+ pPager->extraSync = 0;
+ }else{
+ pPager->noSync = level==PAGER_SYNCHRONOUS_OFF ?1:0;
+ pPager->fullSync = level>=PAGER_SYNCHRONOUS_FULL ?1:0;
+ pPager->extraSync = level==PAGER_SYNCHRONOUS_EXTRA ?1:0;
+ }
+ if( pPager->noSync ){
+ pPager->syncFlags = 0;
+ }else if( pgFlags & PAGER_FULLFSYNC ){
+ pPager->syncFlags = SQLITE_SYNC_FULL;
+ }else{
+ pPager->syncFlags = SQLITE_SYNC_NORMAL;
+ }
+ pPager->walSyncFlags = (pPager->syncFlags<<2);
+ if( pPager->fullSync ){
+ pPager->walSyncFlags |= pPager->syncFlags;
+ }
+ if( (pgFlags & PAGER_CKPT_FULLFSYNC) && !pPager->noSync ){
+ pPager->walSyncFlags |= (SQLITE_SYNC_FULL<<2);
+ }
+ if( pgFlags & PAGER_CACHESPILL ){
+ pPager->doNotSpill &= ~SPILLFLAG_OFF;
+ }else{
+ pPager->doNotSpill |= SPILLFLAG_OFF;
+ }
+}
+
+/*
+** The following global variable is incremented whenever the library
+** attempts to open a temporary file. This information is used for
+** testing and analysis only.
+*/
+#ifdef SQLITE_TEST
+SQLITE_API int sqlite3_opentemp_count = 0;
+#endif
+
+/*
+** Open a temporary file.
+**
+** Write the file descriptor into *pFile. Return SQLITE_OK on success
+** or some other error code if we fail. The OS will automatically
+** delete the temporary file when it is closed.
+**
+** The flags passed to the VFS layer xOpen() call are those specified
+** by parameter vfsFlags ORed with the following:
+**
+** SQLITE_OPEN_READWRITE
+** SQLITE_OPEN_CREATE
+** SQLITE_OPEN_EXCLUSIVE
+** SQLITE_OPEN_DELETEONCLOSE
+*/
+static int pagerOpentemp(
+ Pager *pPager, /* The pager object */
+ sqlite3_file *pFile, /* Write the file descriptor here */
+ int vfsFlags /* Flags passed through to the VFS */
+){
+ int rc; /* Return code */
+
+#ifdef SQLITE_TEST
+ sqlite3_opentemp_count++; /* Used for testing and analysis only */
+#endif
+
+ vfsFlags |= SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE |
+ SQLITE_OPEN_EXCLUSIVE | SQLITE_OPEN_DELETEONCLOSE;
+ rc = sqlite3OsOpen(pPager->pVfs, 0, pFile, vfsFlags, 0);
+ assert( rc!=SQLITE_OK || isOpen(pFile) );
+ return rc;
+}
+
+/*
+** Set the busy handler function.
+**
+** The pager invokes the busy-handler if sqlite3OsLock() returns
+** SQLITE_BUSY when trying to upgrade from no-lock to a SHARED lock,
+** or when trying to upgrade from a RESERVED lock to an EXCLUSIVE
+** lock. It does *not* invoke the busy handler when upgrading from
+** SHARED to RESERVED, or when upgrading from SHARED to EXCLUSIVE
+** (which occurs during hot-journal rollback). Summary:
+**
+** Transition | Invokes xBusyHandler
+** --------------------------------------------------------
+** NO_LOCK -> SHARED_LOCK | Yes
+** SHARED_LOCK -> RESERVED_LOCK | No
+** SHARED_LOCK -> EXCLUSIVE_LOCK | No
+** RESERVED_LOCK -> EXCLUSIVE_LOCK | Yes
+**
+** If the busy-handler callback returns non-zero, the lock is
+** retried. If it returns zero, then the SQLITE_BUSY error is
+** returned to the caller of the pager API function.
+*/
+SQLITE_PRIVATE void sqlite3PagerSetBusyHandler(
+ Pager *pPager, /* Pager object */
+ int (*xBusyHandler)(void *), /* Pointer to busy-handler function */
+ void *pBusyHandlerArg /* Argument to pass to xBusyHandler */
+){
+ void **ap;
+ pPager->xBusyHandler = xBusyHandler;
+ pPager->pBusyHandlerArg = pBusyHandlerArg;
+ ap = (void **)&pPager->xBusyHandler;
+ assert( ((int(*)(void *))(ap[0]))==xBusyHandler );
+ assert( ap[1]==pBusyHandlerArg );
+ sqlite3OsFileControlHint(pPager->fd, SQLITE_FCNTL_BUSYHANDLER, (void *)ap);
+}
+
+/*
+** Change the page size used by the Pager object. The new page size
+** is passed in *pPageSize.
+**
+** If the pager is in the error state when this function is called, it
+** is a no-op. The value returned is the error state error code (i.e.
+** one of SQLITE_IOERR, an SQLITE_IOERR_xxx sub-code or SQLITE_FULL).
+**
+** Otherwise, if all of the following are true:
+**
+** * the new page size (value of *pPageSize) is valid (a power
+** of two between 512 and SQLITE_MAX_PAGE_SIZE, inclusive), and
+**
+** * there are no outstanding page references, and
+**
+** * the database is either not an in-memory database or it is
+** an in-memory database that currently consists of zero pages.
+**
+** then the pager object page size is set to *pPageSize.
+**
+** If the page size is changed, then this function uses sqlite3PagerMalloc()
+** to obtain a new Pager.pTmpSpace buffer. If this allocation attempt
+** fails, SQLITE_NOMEM is returned and the page size remains unchanged.
+** In all other cases, SQLITE_OK is returned.
+**
+** If the page size is not changed, either because one of the enumerated
+** conditions above is not true, the pager was in error state when this
+** function was called, or because the memory allocation attempt failed,
+** then *pPageSize is set to the old, retained page size before returning.
+*/
+SQLITE_PRIVATE int sqlite3PagerSetPagesize(Pager *pPager, u32 *pPageSize, int nReserve){
+ int rc = SQLITE_OK;
+
+ /* It is not possible to do a full assert_pager_state() here, as this
+ ** function may be called from within PagerOpen(), before the state
+ ** of the Pager object is internally consistent.
+ **
+ ** At one point this function returned an error if the pager was in
+ ** PAGER_ERROR state. But since PAGER_ERROR state guarantees that
+ ** there is at least one outstanding page reference, this function
+ ** is a no-op for that case anyhow.
+ */
+
+ u32 pageSize = *pPageSize;
+ assert( pageSize==0 || (pageSize>=512 && pageSize<=SQLITE_MAX_PAGE_SIZE) );
+ if( (pPager->memDb==0 || pPager->dbSize==0)
+ && sqlite3PcacheRefCount(pPager->pPCache)==0
+ && pageSize && pageSize!=(u32)pPager->pageSize
+ ){
+ char *pNew = NULL; /* New temp space */
+ i64 nByte = 0;
+
+ if( pPager->eState>PAGER_OPEN && isOpen(pPager->fd) ){
+ rc = sqlite3OsFileSize(pPager->fd, &nByte);
+ }
+ if( rc==SQLITE_OK ){
+ /* 8 bytes of zeroed overrun space is sufficient so that the b-tree
+ * cell header parser will never run off the end of the allocation */
+ pNew = (char *)sqlite3PageMalloc(pageSize+8);
+ if( !pNew ){
+ rc = SQLITE_NOMEM_BKPT;
+ }else{
+ memset(pNew+pageSize, 0, 8);
+ }
+ }
+
+ if( rc==SQLITE_OK ){
+ pager_reset(pPager);
+ rc = sqlite3PcacheSetPageSize(pPager->pPCache, pageSize);
+ }
+ if( rc==SQLITE_OK ){
+ sqlite3PageFree(pPager->pTmpSpace);
+ pPager->pTmpSpace = pNew;
+ pPager->dbSize = (Pgno)((nByte+pageSize-1)/pageSize);
+ pPager->pageSize = pageSize;
+ pPager->lckPgno = (Pgno)(PENDING_BYTE/pageSize) + 1;
+ }else{
+ sqlite3PageFree(pNew);
+ }
+ }
+
+ *pPageSize = pPager->pageSize;
+ if( rc==SQLITE_OK ){
+ if( nReserve<0 ) nReserve = pPager->nReserve;
+ assert( nReserve>=0 && nReserve<1000 );
+ pPager->nReserve = (i16)nReserve;
+ pagerFixMaplimit(pPager);
+ }
+ return rc;
+}
+
+/*
+** Return a pointer to the "temporary page" buffer held internally
+** by the pager. This is a buffer that is big enough to hold the
+** entire content of a database page. This buffer is used internally
+** during rollback and will be overwritten whenever a rollback
+** occurs. But other modules are free to use it too, as long as
+** no rollbacks are happening.
+*/
+SQLITE_PRIVATE void *sqlite3PagerTempSpace(Pager *pPager){
+ return pPager->pTmpSpace;
+}
+
+/*
+** Attempt to set the maximum database page count if mxPage is positive.
+** Make no changes if mxPage is zero or negative. And never reduce the
+** maximum page count below the current size of the database.
+**
+** Regardless of mxPage, return the current maximum page count.
+*/
+SQLITE_PRIVATE Pgno sqlite3PagerMaxPageCount(Pager *pPager, Pgno mxPage){
+ if( mxPage>0 ){
+ pPager->mxPgno = mxPage;
+ }
+ assert( pPager->eState!=PAGER_OPEN ); /* Called only by OP_MaxPgcnt */
+ /* assert( pPager->mxPgno>=pPager->dbSize ); */
+ /* OP_MaxPgcnt ensures that the parameter passed to this function is not
+ ** less than the total number of valid pages in the database. But this
+ ** may be less than Pager.dbSize, and so the assert() above is not valid */
+ return pPager->mxPgno;
+}
+
+/*
+** The following set of routines are used to disable the simulated
+** I/O error mechanism. These routines are used to avoid simulated
+** errors in places where we do not care about errors.
+**
+** Unless -DSQLITE_TEST=1 is used, these routines are all no-ops
+** and generate no code.
+*/
+#ifdef SQLITE_TEST
+SQLITE_API extern int sqlite3_io_error_pending;
+SQLITE_API extern int sqlite3_io_error_hit;
+static int saved_cnt;
+void disable_simulated_io_errors(void){
+ saved_cnt = sqlite3_io_error_pending;
+ sqlite3_io_error_pending = -1;
+}
+void enable_simulated_io_errors(void){
+ sqlite3_io_error_pending = saved_cnt;
+}
+#else
+# define disable_simulated_io_errors()
+# define enable_simulated_io_errors()
+#endif
+
+/*
+** Read the first N bytes from the beginning of the file into memory
+** that pDest points to.
+**
+** If the pager was opened on a transient file (zFilename==""), or
+** opened on a file less than N bytes in size, the output buffer is
+** zeroed and SQLITE_OK returned. The rationale for this is that this
+** function is used to read database headers, and a new transient or
+** zero sized database has a header than consists entirely of zeroes.
+**
+** If any IO error apart from SQLITE_IOERR_SHORT_READ is encountered,
+** the error code is returned to the caller and the contents of the
+** output buffer undefined.
+*/
+SQLITE_PRIVATE int sqlite3PagerReadFileheader(Pager *pPager, int N, unsigned char *pDest){
+ int rc = SQLITE_OK;
+ memset(pDest, 0, N);
+ assert( isOpen(pPager->fd) || pPager->tempFile );
+
+ /* This routine is only called by btree immediately after creating
+ ** the Pager object. There has not been an opportunity to transition
+ ** to WAL mode yet.
+ */
+ assert( !pagerUseWal(pPager) );
+
+ if( isOpen(pPager->fd) ){
+ IOTRACE(("DBHDR %p 0 %d\n", pPager, N))
+ rc = sqlite3OsRead(pPager->fd, pDest, N, 0);
+ if( rc==SQLITE_IOERR_SHORT_READ ){
+ rc = SQLITE_OK;
+ }
+ }
+ return rc;
+}
+
+/*
+** This function may only be called when a read-transaction is open on
+** the pager. It returns the total number of pages in the database.
+**
+** However, if the file is between 1 and <page-size> bytes in size, then
+** this is considered a 1 page file.
+*/
+SQLITE_PRIVATE void sqlite3PagerPagecount(Pager *pPager, int *pnPage){
+ assert( pPager->eState>=PAGER_READER );
+ assert( pPager->eState!=PAGER_WRITER_FINISHED );
+ *pnPage = (int)pPager->dbSize;
+}
+
+
+/*
+** Try to obtain a lock of type locktype on the database file. If
+** a similar or greater lock is already held, this function is a no-op
+** (returning SQLITE_OK immediately).
+**
+** Otherwise, attempt to obtain the lock using sqlite3OsLock(). Invoke
+** the busy callback if the lock is currently not available. Repeat
+** until the busy callback returns false or until the attempt to
+** obtain the lock succeeds.
+**
+** Return SQLITE_OK on success and an error code if we cannot obtain
+** the lock. If the lock is obtained successfully, set the Pager.state
+** variable to locktype before returning.
+*/
+static int pager_wait_on_lock(Pager *pPager, int locktype){
+ int rc; /* Return code */
+
+ /* Check that this is either a no-op (because the requested lock is
+ ** already held), or one of the transitions that the busy-handler
+ ** may be invoked during, according to the comment above
+ ** sqlite3PagerSetBusyhandler().
+ */
+ assert( (pPager->eLock>=locktype)
+ || (pPager->eLock==NO_LOCK && locktype==SHARED_LOCK)
+ || (pPager->eLock==RESERVED_LOCK && locktype==EXCLUSIVE_LOCK)
+ );
+
+ do {
+ rc = pagerLockDb(pPager, locktype);
+ }while( rc==SQLITE_BUSY && pPager->xBusyHandler(pPager->pBusyHandlerArg) );
+ return rc;
+}
+
+/*
+** Function assertTruncateConstraint(pPager) checks that one of the
+** following is true for all dirty pages currently in the page-cache:
+**
+** a) The page number is less than or equal to the size of the
+** current database image, in pages, OR
+**
+** b) if the page content were written at this time, it would not
+** be necessary to write the current content out to the sub-journal.
+**
+** If the condition asserted by this function were not true, and the
+** dirty page were to be discarded from the cache via the pagerStress()
+** routine, pagerStress() would not write the current page content to
+** the database file. If a savepoint transaction were rolled back after
+** this happened, the correct behavior would be to restore the current
+** content of the page. However, since this content is not present in either
+** the database file or the portion of the rollback journal and
+** sub-journal rolled back the content could not be restored and the
+** database image would become corrupt. It is therefore fortunate that
+** this circumstance cannot arise.
+*/
+#if defined(SQLITE_DEBUG)
+static void assertTruncateConstraintCb(PgHdr *pPg){
+ Pager *pPager = pPg->pPager;
+ assert( pPg->flags&PGHDR_DIRTY );
+ if( pPg->pgno>pPager->dbSize ){ /* if (a) is false */
+ Pgno pgno = pPg->pgno;
+ int i;
+ for(i=0; i<pPg->pPager->nSavepoint; i++){
+ PagerSavepoint *p = &pPager->aSavepoint[i];
+ assert( p->nOrig<pgno || sqlite3BitvecTestNotNull(p->pInSavepoint,pgno) );
+ }
+ }
+}
+static void assertTruncateConstraint(Pager *pPager){
+ sqlite3PcacheIterateDirty(pPager->pPCache, assertTruncateConstraintCb);
+}
+#else
+# define assertTruncateConstraint(pPager)
+#endif
+
+/*
+** Truncate the in-memory database file image to nPage pages. This
+** function does not actually modify the database file on disk. It
+** just sets the internal state of the pager object so that the
+** truncation will be done when the current transaction is committed.
+**
+** This function is only called right before committing a transaction.
+** Once this function has been called, the transaction must either be
+** rolled back or committed. It is not safe to call this function and
+** then continue writing to the database.
+*/
+SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager *pPager, Pgno nPage){
+ assert( pPager->dbSize>=nPage || CORRUPT_DB );
+ assert( pPager->eState>=PAGER_WRITER_CACHEMOD );
+ pPager->dbSize = nPage;
+
+ /* At one point the code here called assertTruncateConstraint() to
+ ** ensure that all pages being truncated away by this operation are,
+ ** if one or more savepoints are open, present in the savepoint
+ ** journal so that they can be restored if the savepoint is rolled
+ ** back. This is no longer necessary as this function is now only
+ ** called right before committing a transaction. So although the
+ ** Pager object may still have open savepoints (Pager.nSavepoint!=0),
+ ** they cannot be rolled back. So the assertTruncateConstraint() call
+ ** is no longer correct. */
+}
+
+
+/*
+** This function is called before attempting a hot-journal rollback. It
+** syncs the journal file to disk, then sets pPager->journalHdr to the
+** size of the journal file so that the pager_playback() routine knows
+** that the entire journal file has been synced.
+**
+** Syncing a hot-journal to disk before attempting to roll it back ensures
+** that if a power-failure occurs during the rollback, the process that
+** attempts rollback following system recovery sees the same journal
+** content as this process.
+**
+** If everything goes as planned, SQLITE_OK is returned. Otherwise,
+** an SQLite error code.
+*/
+static int pagerSyncHotJournal(Pager *pPager){
+ int rc = SQLITE_OK;
+ if( !pPager->noSync ){
+ rc = sqlite3OsSync(pPager->jfd, SQLITE_SYNC_NORMAL);
+ }
+ if( rc==SQLITE_OK ){
+ rc = sqlite3OsFileSize(pPager->jfd, &pPager->journalHdr);
+ }
+ return rc;
+}
+
+#if SQLITE_MAX_MMAP_SIZE>0
+/*
+** Obtain a reference to a memory mapped page object for page number pgno.
+** The new object will use the pointer pData, obtained from xFetch().
+** If successful, set *ppPage to point to the new page reference
+** and return SQLITE_OK. Otherwise, return an SQLite error code and set
+** *ppPage to zero.
+**
+** Page references obtained by calling this function should be released
+** by calling pagerReleaseMapPage().
+*/
+static int pagerAcquireMapPage(
+ Pager *pPager, /* Pager object */
+ Pgno pgno, /* Page number */
+ void *pData, /* xFetch()'d data for this page */
+ PgHdr **ppPage /* OUT: Acquired page object */
+){
+ PgHdr *p; /* Memory mapped page to return */
+
+ if( pPager->pMmapFreelist ){
+ *ppPage = p = pPager->pMmapFreelist;
+ pPager->pMmapFreelist = p->pDirty;
+ p->pDirty = 0;
+ assert( pPager->nExtra>=8 );
+ memset(p->pExtra, 0, 8);
+ }else{
+ *ppPage = p = (PgHdr *)sqlite3MallocZero(sizeof(PgHdr) + pPager->nExtra);
+ if( p==0 ){
+ sqlite3OsUnfetch(pPager->fd, (i64)(pgno-1) * pPager->pageSize, pData);
+ return SQLITE_NOMEM_BKPT;
+ }
+ p->pExtra = (void *)&p[1];
+ assert( EIGHT_BYTE_ALIGNMENT( p->pExtra ) );
+ p->flags = PGHDR_MMAP;
+ p->nRef = 1;
+ p->pPager = pPager;
+ }
+
+ assert( p->pExtra==(void *)&p[1] );
+ assert( p->pPage==0 );
+ assert( p->flags==PGHDR_MMAP );
+ assert( p->pPager==pPager );
+ assert( p->nRef==1 );
+
+ p->pgno = pgno;
+ p->pData = pData;
+ pPager->nMmapOut++;
+
+ return SQLITE_OK;
+}
+#endif
+
+/*
+** Release a reference to page pPg. pPg must have been returned by an
+** earlier call to pagerAcquireMapPage().
+*/
+static void pagerReleaseMapPage(PgHdr *pPg){
+ Pager *pPager = pPg->pPager;
+ pPager->nMmapOut--;
+ pPg->pDirty = pPager->pMmapFreelist;
+ pPager->pMmapFreelist = pPg;
+
+ assert( pPager->fd->pMethods->iVersion>=3 );
+ sqlite3OsUnfetch(pPager->fd, (i64)(pPg->pgno-1)*pPager->pageSize, pPg->pData);
+}
+
+/*
+** Free all PgHdr objects stored in the Pager.pMmapFreelist list.
+*/
+static void pagerFreeMapHdrs(Pager *pPager){
+ PgHdr *p;
+ PgHdr *pNext;
+ for(p=pPager->pMmapFreelist; p; p=pNext){
+ pNext = p->pDirty;
+ sqlite3_free(p);
+ }
+}
+
+/* Verify that the database file has not be deleted or renamed out from
+** under the pager. Return SQLITE_OK if the database is still where it ought
+** to be on disk. Return non-zero (SQLITE_READONLY_DBMOVED or some other error
+** code from sqlite3OsAccess()) if the database has gone missing.
+*/
+static int databaseIsUnmoved(Pager *pPager){
+ int bHasMoved = 0;
+ int rc;
+
+ if( pPager->tempFile ) return SQLITE_OK;
+ if( pPager->dbSize==0 ) return SQLITE_OK;
+ assert( pPager->zFilename && pPager->zFilename[0] );
+ rc = sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_HAS_MOVED, &bHasMoved);
+ if( rc==SQLITE_NOTFOUND ){
+ /* If the HAS_MOVED file-control is unimplemented, assume that the file
+ ** has not been moved. That is the historical behavior of SQLite: prior to
+ ** version 3.8.3, it never checked */
+ rc = SQLITE_OK;
+ }else if( rc==SQLITE_OK && bHasMoved ){
+ rc = SQLITE_READONLY_DBMOVED;
+ }
+ return rc;
+}
+
+
+/*
+** Shutdown the page cache. Free all memory and close all files.
+**
+** If a transaction was in progress when this routine is called, that
+** transaction is rolled back. All outstanding pages are invalidated
+** and their memory is freed. Any attempt to use a page associated
+** with this page cache after this function returns will likely
+** result in a coredump.
+**
+** This function always succeeds. If a transaction is active an attempt
+** is made to roll it back. If an error occurs during the rollback
+** a hot journal may be left in the filesystem but no error is returned
+** to the caller.
+*/
+SQLITE_PRIVATE int sqlite3PagerClose(Pager *pPager, sqlite3 *db){
+ u8 *pTmp = (u8*)pPager->pTmpSpace;
+ assert( db || pagerUseWal(pPager)==0 );
+ assert( assert_pager_state(pPager) );
+ disable_simulated_io_errors();
+ sqlite3BeginBenignMalloc();
+ pagerFreeMapHdrs(pPager);
+ /* pPager->errCode = 0; */
+ pPager->exclusiveMode = 0;
+#ifndef SQLITE_OMIT_WAL
+ {
+ u8 *a = 0;
+ assert( db || pPager->pWal==0 );
+ if( db && 0==(db->flags & SQLITE_NoCkptOnClose)
+ && SQLITE_OK==databaseIsUnmoved(pPager)
+ ){
+ a = pTmp;
+ }
+ sqlite3WalClose(pPager->pWal, db, pPager->walSyncFlags, pPager->pageSize,a);
+ pPager->pWal = 0;
+ }
+#endif
+ pager_reset(pPager);
+ if( MEMDB ){
+ pager_unlock(pPager);
+ }else{
+ /* If it is open, sync the journal file before calling UnlockAndRollback.
+ ** If this is not done, then an unsynced portion of the open journal
+ ** file may be played back into the database. If a power failure occurs
+ ** while this is happening, the database could become corrupt.
+ **
+ ** If an error occurs while trying to sync the journal, shift the pager
+ ** into the ERROR state. This causes UnlockAndRollback to unlock the
+ ** database and close the journal file without attempting to roll it
+ ** back or finalize it. The next database user will have to do hot-journal
+ ** rollback before accessing the database file.
+ */
+ if( isOpen(pPager->jfd) ){
+ pager_error(pPager, pagerSyncHotJournal(pPager));
+ }
+ pagerUnlockAndRollback(pPager);
+ }
+ sqlite3EndBenignMalloc();
+ enable_simulated_io_errors();
+ PAGERTRACE(("CLOSE %d\n", PAGERID(pPager)));
+ IOTRACE(("CLOSE %p\n", pPager))
+ sqlite3OsClose(pPager->jfd);
+ sqlite3OsClose(pPager->fd);
+ sqlite3PageFree(pTmp);
+ sqlite3PcacheClose(pPager->pPCache);
+ assert( !pPager->aSavepoint && !pPager->pInJournal );
+ assert( !isOpen(pPager->jfd) && !isOpen(pPager->sjfd) );
+
+ sqlite3_free(pPager);
+ return SQLITE_OK;
+}
+
+#if !defined(NDEBUG) || defined(SQLITE_TEST)
+/*
+** Return the page number for page pPg.
+*/
+SQLITE_PRIVATE Pgno sqlite3PagerPagenumber(DbPage *pPg){
+ return pPg->pgno;
+}
+#endif
+
+/*
+** Increment the reference count for page pPg.
+*/
+SQLITE_PRIVATE void sqlite3PagerRef(DbPage *pPg){
+ sqlite3PcacheRef(pPg);
+}
+
+/*
+** Sync the journal. In other words, make sure all the pages that have
+** been written to the journal have actually reached the surface of the
+** disk and can be restored in the event of a hot-journal rollback.
+**
+** If the Pager.noSync flag is set, then this function is a no-op.
+** Otherwise, the actions required depend on the journal-mode and the
+** device characteristics of the file-system, as follows:
+**
+** * If the journal file is an in-memory journal file, no action need
+** be taken.
+**
+** * Otherwise, if the device does not support the SAFE_APPEND property,
+** then the nRec field of the most recently written journal header
+** is updated to contain the number of journal records that have
+** been written following it. If the pager is operating in full-sync
+** mode, then the journal file is synced before this field is updated.
+**
+** * If the device does not support the SEQUENTIAL property, then
+** journal file is synced.
+**
+** Or, in pseudo-code:
+**
+** if( NOT <in-memory journal> ){
+** if( NOT SAFE_APPEND ){
+** if( <full-sync mode> ) xSync(<journal file>);
+** <update nRec field>
+** }
+** if( NOT SEQUENTIAL ) xSync(<journal file>);
+** }
+**
+** If successful, this routine clears the PGHDR_NEED_SYNC flag of every
+** page currently held in memory before returning SQLITE_OK. If an IO
+** error is encountered, then the IO error code is returned to the caller.
+*/
+static int syncJournal(Pager *pPager, int newHdr){
+ int rc; /* Return code */
+
+ assert( pPager->eState==PAGER_WRITER_CACHEMOD
+ || pPager->eState==PAGER_WRITER_DBMOD
+ );
+ assert( assert_pager_state(pPager) );
+ assert( !pagerUseWal(pPager) );
+
+ rc = sqlite3PagerExclusiveLock(pPager);
+ if( rc!=SQLITE_OK ) return rc;
+
+ if( !pPager->noSync ){
+ assert( !pPager->tempFile );
+ if( isOpen(pPager->jfd) && pPager->journalMode!=PAGER_JOURNALMODE_MEMORY ){
+ const int iDc = sqlite3OsDeviceCharacteristics(pPager->fd);
+ assert( isOpen(pPager->jfd) );
+
+ if( 0==(iDc&SQLITE_IOCAP_SAFE_APPEND) ){
+ /* This block deals with an obscure problem. If the last connection
+ ** that wrote to this database was operating in persistent-journal
+ ** mode, then the journal file may at this point actually be larger
+ ** than Pager.journalOff bytes. If the next thing in the journal
+ ** file happens to be a journal-header (written as part of the
+ ** previous connection's transaction), and a crash or power-failure
+ ** occurs after nRec is updated but before this connection writes
+ ** anything else to the journal file (or commits/rolls back its
+ ** transaction), then SQLite may become confused when doing the
+ ** hot-journal rollback following recovery. It may roll back all
+ ** of this connections data, then proceed to rolling back the old,
+ ** out-of-date data that follows it. Database corruption.
+ **
+ ** To work around this, if the journal file does appear to contain
+ ** a valid header following Pager.journalOff, then write a 0x00
+ ** byte to the start of it to prevent it from being recognized.
+ **
+ ** Variable iNextHdrOffset is set to the offset at which this
+ ** problematic header will occur, if it exists. aMagic is used
+ ** as a temporary buffer to inspect the first couple of bytes of
+ ** the potential journal header.
+ */
+ i64 iNextHdrOffset;
+ u8 aMagic[8];
+ u8 zHeader[sizeof(aJournalMagic)+4];
+
+ memcpy(zHeader, aJournalMagic, sizeof(aJournalMagic));
+ put32bits(&zHeader[sizeof(aJournalMagic)], pPager->nRec);
+
+ iNextHdrOffset = journalHdrOffset(pPager);
+ rc = sqlite3OsRead(pPager->jfd, aMagic, 8, iNextHdrOffset);
+ if( rc==SQLITE_OK && 0==memcmp(aMagic, aJournalMagic, 8) ){
+ static const u8 zerobyte = 0;
+ rc = sqlite3OsWrite(pPager->jfd, &zerobyte, 1, iNextHdrOffset);
+ }
+ if( rc!=SQLITE_OK && rc!=SQLITE_IOERR_SHORT_READ ){
+ return rc;
+ }
+
+ /* Write the nRec value into the journal file header. If in
+ ** full-synchronous mode, sync the journal first. This ensures that
+ ** all data has really hit the disk before nRec is updated to mark
+ ** it as a candidate for rollback.
+ **
+ ** This is not required if the persistent media supports the
+ ** SAFE_APPEND property. Because in this case it is not possible
+ ** for garbage data to be appended to the file, the nRec field
+ ** is populated with 0xFFFFFFFF when the journal header is written
+ ** and never needs to be updated.
+ */
+ if( pPager->fullSync && 0==(iDc&SQLITE_IOCAP_SEQUENTIAL) ){
+ PAGERTRACE(("SYNC journal of %d\n", PAGERID(pPager)));
+ IOTRACE(("JSYNC %p\n", pPager))
+ rc = sqlite3OsSync(pPager->jfd, pPager->syncFlags);
+ if( rc!=SQLITE_OK ) return rc;
+ }
+ IOTRACE(("JHDR %p %lld\n", pPager, pPager->journalHdr));
+ rc = sqlite3OsWrite(
+ pPager->jfd, zHeader, sizeof(zHeader), pPager->journalHdr
+ );
+ if( rc!=SQLITE_OK ) return rc;
+ }
+ if( 0==(iDc&SQLITE_IOCAP_SEQUENTIAL) ){
+ PAGERTRACE(("SYNC journal of %d\n", PAGERID(pPager)));
+ IOTRACE(("JSYNC %p\n", pPager))
+ rc = sqlite3OsSync(pPager->jfd, pPager->syncFlags|
+ (pPager->syncFlags==SQLITE_SYNC_FULL?SQLITE_SYNC_DATAONLY:0)
+ );
+ if( rc!=SQLITE_OK ) return rc;
+ }
+
+ pPager->journalHdr = pPager->journalOff;
+ if( newHdr && 0==(iDc&SQLITE_IOCAP_SAFE_APPEND) ){
+ pPager->nRec = 0;
+ rc = writeJournalHdr(pPager);
+ if( rc!=SQLITE_OK ) return rc;
+ }
+ }else{
+ pPager->journalHdr = pPager->journalOff;
+ }
+ }
+
+ /* Unless the pager is in noSync mode, the journal file was just
+ ** successfully synced. Either way, clear the PGHDR_NEED_SYNC flag on
+ ** all pages.
+ */
+ sqlite3PcacheClearSyncFlags(pPager->pPCache);
+ pPager->eState = PAGER_WRITER_DBMOD;
+ assert( assert_pager_state(pPager) );
+ return SQLITE_OK;
+}
+
+/*
+** The argument is the first in a linked list of dirty pages connected
+** by the PgHdr.pDirty pointer. This function writes each one of the
+** in-memory pages in the list to the database file. The argument may
+** be NULL, representing an empty list. In this case this function is
+** a no-op.
+**
+** The pager must hold at least a RESERVED lock when this function
+** is called. Before writing anything to the database file, this lock
+** is upgraded to an EXCLUSIVE lock. If the lock cannot be obtained,
+** SQLITE_BUSY is returned and no data is written to the database file.
+**
+** If the pager is a temp-file pager and the actual file-system file
+** is not yet open, it is created and opened before any data is
+** written out.
+**
+** Once the lock has been upgraded and, if necessary, the file opened,
+** the pages are written out to the database file in list order. Writing
+** a page is skipped if it meets either of the following criteria:
+**
+** * The page number is greater than Pager.dbSize, or
+** * The PGHDR_DONT_WRITE flag is set on the page.
+**
+** If writing out a page causes the database file to grow, Pager.dbFileSize
+** is updated accordingly. If page 1 is written out, then the value cached
+** in Pager.dbFileVers[] is updated to match the new value stored in
+** the database file.
+**
+** If everything is successful, SQLITE_OK is returned. If an IO error
+** occurs, an IO error code is returned. Or, if the EXCLUSIVE lock cannot
+** be obtained, SQLITE_BUSY is returned.
+*/
+static int pager_write_pagelist(Pager *pPager, PgHdr *pList){
+ int rc = SQLITE_OK; /* Return code */
+
+ /* This function is only called for rollback pagers in WRITER_DBMOD state. */
+ assert( !pagerUseWal(pPager) );
+ assert( pPager->tempFile || pPager->eState==PAGER_WRITER_DBMOD );
+ assert( pPager->eLock==EXCLUSIVE_LOCK );
+ assert( isOpen(pPager->fd) || pList->pDirty==0 );
+
+ /* If the file is a temp-file has not yet been opened, open it now. It
+ ** is not possible for rc to be other than SQLITE_OK if this branch
+ ** is taken, as pager_wait_on_lock() is a no-op for temp-files.
+ */
+ if( !isOpen(pPager->fd) ){
+ assert( pPager->tempFile && rc==SQLITE_OK );
+ rc = pagerOpentemp(pPager, pPager->fd, pPager->vfsFlags);
+ }
+
+ /* Before the first write, give the VFS a hint of what the final
+ ** file size will be.
+ */
+ assert( rc!=SQLITE_OK || isOpen(pPager->fd) );
+ if( rc==SQLITE_OK
+ && pPager->dbHintSize<pPager->dbSize
+ && (pList->pDirty || pList->pgno>pPager->dbHintSize)
+ ){
+ sqlite3_int64 szFile = pPager->pageSize * (sqlite3_int64)pPager->dbSize;
+ sqlite3OsFileControlHint(pPager->fd, SQLITE_FCNTL_SIZE_HINT, &szFile);
+ pPager->dbHintSize = pPager->dbSize;
+ }
+
+ while( rc==SQLITE_OK && pList ){
+ Pgno pgno = pList->pgno;
+
+ /* If there are dirty pages in the page cache with page numbers greater
+ ** than Pager.dbSize, this means sqlite3PagerTruncateImage() was called to
+ ** make the file smaller (presumably by auto-vacuum code). Do not write
+ ** any such pages to the file.
+ **
+ ** Also, do not write out any page that has the PGHDR_DONT_WRITE flag
+ ** set (set by sqlite3PagerDontWrite()).
+ */
+ if( pgno<=pPager->dbSize && 0==(pList->flags&PGHDR_DONT_WRITE) ){
+ i64 offset = (pgno-1)*(i64)pPager->pageSize; /* Offset to write */
+ char *pData; /* Data to write */
+
+ assert( (pList->flags&PGHDR_NEED_SYNC)==0 );
+ if( pList->pgno==1 ) pager_write_changecounter(pList);
+
+ pData = pList->pData;
+
+ /* Write out the page data. */
+ rc = sqlite3OsWrite(pPager->fd, pData, pPager->pageSize, offset);
+
+ /* If page 1 was just written, update Pager.dbFileVers to match
+ ** the value now stored in the database file. If writing this
+ ** page caused the database file to grow, update dbFileSize.
+ */
+ if( pgno==1 ){
+ memcpy(&pPager->dbFileVers, &pData[24], sizeof(pPager->dbFileVers));
+ }
+ if( pgno>pPager->dbFileSize ){
+ pPager->dbFileSize = pgno;
+ }
+ pPager->aStat[PAGER_STAT_WRITE]++;
+
+ /* Update any backup objects copying the contents of this pager. */
+ sqlite3BackupUpdate(pPager->pBackup, pgno, (u8*)pList->pData);
+
+ PAGERTRACE(("STORE %d page %d hash(%08x)\n",
+ PAGERID(pPager), pgno, pager_pagehash(pList)));
+ IOTRACE(("PGOUT %p %d\n", pPager, pgno));
+ PAGER_INCR(sqlite3_pager_writedb_count);
+ }else{
+ PAGERTRACE(("NOSTORE %d page %d\n", PAGERID(pPager), pgno));
+ }
+ pager_set_pagehash(pList);
+ pList = pList->pDirty;
+ }
+
+ return rc;
+}
+
+/*
+** Ensure that the sub-journal file is open. If it is already open, this
+** function is a no-op.
+**
+** SQLITE_OK is returned if everything goes according to plan. An
+** SQLITE_IOERR_XXX error code is returned if a call to sqlite3OsOpen()
+** fails.
+*/
+static int openSubJournal(Pager *pPager){
+ int rc = SQLITE_OK;
+ if( !isOpen(pPager->sjfd) ){
+ const int flags = SQLITE_OPEN_SUBJOURNAL | SQLITE_OPEN_READWRITE
+ | SQLITE_OPEN_CREATE | SQLITE_OPEN_EXCLUSIVE
+ | SQLITE_OPEN_DELETEONCLOSE;
+ int nStmtSpill = sqlite3Config.nStmtSpill;
+ if( pPager->journalMode==PAGER_JOURNALMODE_MEMORY || pPager->subjInMemory ){
+ nStmtSpill = -1;
+ }
+ rc = sqlite3JournalOpen(pPager->pVfs, 0, pPager->sjfd, flags, nStmtSpill);
+ }
+ return rc;
+}
+
+/*
+** Append a record of the current state of page pPg to the sub-journal.
+**
+** If successful, set the bit corresponding to pPg->pgno in the bitvecs
+** for all open savepoints before returning.
+**
+** This function returns SQLITE_OK if everything is successful, an IO
+** error code if the attempt to write to the sub-journal fails, or
+** SQLITE_NOMEM if a malloc fails while setting a bit in a savepoint
+** bitvec.
+*/
+static int subjournalPage(PgHdr *pPg){
+ int rc = SQLITE_OK;
+ Pager *pPager = pPg->pPager;
+ if( pPager->journalMode!=PAGER_JOURNALMODE_OFF ){
+
+ /* Open the sub-journal, if it has not already been opened */
+ assert( pPager->useJournal );
+ assert( isOpen(pPager->jfd) || pagerUseWal(pPager) );
+ assert( isOpen(pPager->sjfd) || pPager->nSubRec==0 );
+ assert( pagerUseWal(pPager)
+ || pageInJournal(pPager, pPg)
+ || pPg->pgno>pPager->dbOrigSize
+ );
+ rc = openSubJournal(pPager);
+
+ /* If the sub-journal was opened successfully (or was already open),
+ ** write the journal record into the file. */
+ if( rc==SQLITE_OK ){
+ void *pData = pPg->pData;
+ i64 offset = (i64)pPager->nSubRec*(4+pPager->pageSize);
+ char *pData2;
+ pData2 = pData;
+ PAGERTRACE(("STMT-JOURNAL %d page %d\n", PAGERID(pPager), pPg->pgno));
+ rc = write32bits(pPager->sjfd, offset, pPg->pgno);
+ if( rc==SQLITE_OK ){
+ rc = sqlite3OsWrite(pPager->sjfd, pData2, pPager->pageSize, offset+4);
+ }
+ }
+ }
+ if( rc==SQLITE_OK ){
+ pPager->nSubRec++;
+ assert( pPager->nSavepoint>0 );
+ rc = addToSavepointBitvecs(pPager, pPg->pgno);
+ }
+ return rc;
+}
+static int subjournalPageIfRequired(PgHdr *pPg){
+ if( subjRequiresPage(pPg) ){
+ return subjournalPage(pPg);
+ }else{
+ return SQLITE_OK;
+ }
+}
+
+/*
+** This function is called by the pcache layer when it has reached some
+** soft memory limit. The first argument is a pointer to a Pager object
+** (cast as a void*). The pager is always 'purgeable' (not an in-memory
+** database). The second argument is a reference to a page that is
+** currently dirty but has no outstanding references. The page
+** is always associated with the Pager object passed as the first
+** argument.
+**
+** The job of this function is to make pPg clean by writing its contents
+** out to the database file, if possible. This may involve syncing the
+** journal file.
+**
+** If successful, sqlite3PcacheMakeClean() is called on the page and
+** SQLITE_OK returned. If an IO error occurs while trying to make the
+** page clean, the IO error code is returned. If the page cannot be
+** made clean for some other reason, but no error occurs, then SQLITE_OK
+** is returned by sqlite3PcacheMakeClean() is not called.
+*/
+static int pagerStress(void *p, PgHdr *pPg){
+ Pager *pPager = (Pager *)p;
+ int rc = SQLITE_OK;
+
+ assert( pPg->pPager==pPager );
+ assert( pPg->flags&PGHDR_DIRTY );
+
+ /* The doNotSpill NOSYNC bit is set during times when doing a sync of
+ ** journal (and adding a new header) is not allowed. This occurs
+ ** during calls to sqlite3PagerWrite() while trying to journal multiple
+ ** pages belonging to the same sector.
+ **
+ ** The doNotSpill ROLLBACK and OFF bits inhibits all cache spilling
+ ** regardless of whether or not a sync is required. This is set during
+ ** a rollback or by user request, respectively.
+ **
+ ** Spilling is also prohibited when in an error state since that could
+ ** lead to database corruption. In the current implementation it
+ ** is impossible for sqlite3PcacheFetch() to be called with createFlag==3
+ ** while in the error state, hence it is impossible for this routine to
+ ** be called in the error state. Nevertheless, we include a NEVER()
+ ** test for the error state as a safeguard against future changes.
+ */
+ if( NEVER(pPager->errCode) ) return SQLITE_OK;
+ testcase( pPager->doNotSpill & SPILLFLAG_ROLLBACK );
+ testcase( pPager->doNotSpill & SPILLFLAG_OFF );
+ testcase( pPager->doNotSpill & SPILLFLAG_NOSYNC );
+ if( pPager->doNotSpill
+ && ((pPager->doNotSpill & (SPILLFLAG_ROLLBACK|SPILLFLAG_OFF))!=0
+ || (pPg->flags & PGHDR_NEED_SYNC)!=0)
+ ){
+ return SQLITE_OK;
+ }
+
+ pPager->aStat[PAGER_STAT_SPILL]++;
+ pPg->pDirty = 0;
+ if( pagerUseWal(pPager) ){
+ /* Write a single frame for this page to the log. */
+ rc = subjournalPageIfRequired(pPg);
+ if( rc==SQLITE_OK ){
+ rc = pagerWalFrames(pPager, pPg, 0, 0);
+ }
+ }else{
+
+#ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE
+ if( pPager->tempFile==0 ){
+ rc = sqlite3JournalCreate(pPager->jfd);
+ if( rc!=SQLITE_OK ) return pager_error(pPager, rc);
+ }
+#endif
+
+ /* Sync the journal file if required. */
+ if( pPg->flags&PGHDR_NEED_SYNC
+ || pPager->eState==PAGER_WRITER_CACHEMOD
+ ){
+ rc = syncJournal(pPager, 1);
+ }
+
+ /* Write the contents of the page out to the database file. */
+ if( rc==SQLITE_OK ){
+ assert( (pPg->flags&PGHDR_NEED_SYNC)==0 );
+ rc = pager_write_pagelist(pPager, pPg);
+ }
+ }
+
+ /* Mark the page as clean. */
+ if( rc==SQLITE_OK ){
+ PAGERTRACE(("STRESS %d page %d\n", PAGERID(pPager), pPg->pgno));
+ sqlite3PcacheMakeClean(pPg);
+ }
+
+ return pager_error(pPager, rc);
+}
+
+/*
+** Flush all unreferenced dirty pages to disk.
+*/
+SQLITE_PRIVATE int sqlite3PagerFlush(Pager *pPager){
+ int rc = pPager->errCode;
+ if( !MEMDB ){
+ PgHdr *pList = sqlite3PcacheDirtyList(pPager->pPCache);
+ assert( assert_pager_state(pPager) );
+ while( rc==SQLITE_OK && pList ){
+ PgHdr *pNext = pList->pDirty;
+ if( pList->nRef==0 ){
+ rc = pagerStress((void*)pPager, pList);
+ }
+ pList = pNext;
+ }
+ }
+
+ return rc;
+}
+
+/*
+** Allocate and initialize a new Pager object and put a pointer to it
+** in *ppPager. The pager should eventually be freed by passing it
+** to sqlite3PagerClose().
+**
+** The zFilename argument is the path to the database file to open.
+** If zFilename is NULL then a randomly-named temporary file is created
+** and used as the file to be cached. Temporary files are be deleted
+** automatically when they are closed. If zFilename is ":memory:" then
+** all information is held in cache. It is never written to disk.
+** This can be used to implement an in-memory database.
+**
+** The nExtra parameter specifies the number of bytes of space allocated
+** along with each page reference. This space is available to the user
+** via the sqlite3PagerGetExtra() API. When a new page is allocated, the
+** first 8 bytes of this space are zeroed but the remainder is uninitialized.
+** (The extra space is used by btree as the MemPage object.)
+**
+** The flags argument is used to specify properties that affect the
+** operation of the pager. It should be passed some bitwise combination
+** of the PAGER_* flags.
+**
+** The vfsFlags parameter is a bitmask to pass to the flags parameter
+** of the xOpen() method of the supplied VFS when opening files.
+**
+** If the pager object is allocated and the specified file opened
+** successfully, SQLITE_OK is returned and *ppPager set to point to
+** the new pager object. If an error occurs, *ppPager is set to NULL
+** and error code returned. This function may return SQLITE_NOMEM
+** (sqlite3Malloc() is used to allocate memory), SQLITE_CANTOPEN or
+** various SQLITE_IO_XXX errors.
+*/
+SQLITE_PRIVATE int sqlite3PagerOpen(
+ sqlite3_vfs *pVfs, /* The virtual file system to use */
+ Pager **ppPager, /* OUT: Return the Pager structure here */
+ const char *zFilename, /* Name of the database file to open */
+ int nExtra, /* Extra bytes append to each in-memory page */
+ int flags, /* flags controlling this file */
+ int vfsFlags, /* flags passed through to sqlite3_vfs.xOpen() */
+ void (*xReinit)(DbPage*) /* Function to reinitialize pages */
+){
+ u8 *pPtr;
+ Pager *pPager = 0; /* Pager object to allocate and return */
+ int rc = SQLITE_OK; /* Return code */
+ int tempFile = 0; /* True for temp files (incl. in-memory files) */
+ int memDb = 0; /* True if this is an in-memory file */
+ int memJM = 0; /* Memory journal mode */
+ int readOnly = 0; /* True if this is a read-only file */
+ int journalFileSize; /* Bytes to allocate for each journal fd */
+ char *zPathname = 0; /* Full path to database file */
+ int nPathname = 0; /* Number of bytes in zPathname */
+ int useJournal = (flags & PAGER_OMIT_JOURNAL)==0; /* False to omit journal */
+ int pcacheSize = sqlite3PcacheSize(); /* Bytes to allocate for PCache */
+ u32 szPageDflt = SQLITE_DEFAULT_PAGE_SIZE; /* Default page size */
+ const char *zUri = 0; /* URI args to copy */
+ int nUriByte = 1; /* Number of bytes of URI args at *zUri */
+
+ /* Figure out how much space is required for each journal file-handle
+ ** (there are two of them, the main journal and the sub-journal). */
+ journalFileSize = ROUND8(sqlite3JournalSize(pVfs));
+
+ /* Set the output variable to NULL in case an error occurs. */
+ *ppPager = 0;
+
+#ifndef SQLITE_OMIT_MEMORYDB
+ if( flags & PAGER_MEMORY ){
+ memDb = 1;
+ if( zFilename && zFilename[0] ){
+ zPathname = sqlite3DbStrDup(0, zFilename);
+ if( zPathname==0 ) return SQLITE_NOMEM_BKPT;
+ nPathname = sqlite3Strlen30(zPathname);
+ zFilename = 0;
+ }
+ }
+#endif
+
+ /* Compute and store the full pathname in an allocated buffer pointed
+ ** to by zPathname, length nPathname. Or, if this is a temporary file,
+ ** leave both nPathname and zPathname set to 0.
+ */
+ if( zFilename && zFilename[0] ){
+ const char *z;
+ nPathname = pVfs->mxPathname+1;
+ zPathname = sqlite3DbMallocRaw(0, nPathname*2);
+ if( zPathname==0 ){
+ return SQLITE_NOMEM_BKPT;
+ }
+ zPathname[0] = 0; /* Make sure initialized even if FullPathname() fails */
+ rc = sqlite3OsFullPathname(pVfs, zFilename, nPathname, zPathname);
+ if( rc!=SQLITE_OK ){
+ if( rc==SQLITE_OK_SYMLINK ){
+ if( vfsFlags & SQLITE_OPEN_NOFOLLOW ){
+ rc = SQLITE_CANTOPEN_SYMLINK;
+ }else{
+ rc = SQLITE_OK;
+ }
+ }
+ }
+ nPathname = sqlite3Strlen30(zPathname);
+ z = zUri = &zFilename[sqlite3Strlen30(zFilename)+1];
+ while( *z ){
+ z += strlen(z)+1;
+ z += strlen(z)+1;
+ }
+ nUriByte = (int)(&z[1] - zUri);
+ assert( nUriByte>=1 );
+ if( rc==SQLITE_OK && nPathname+8>pVfs->mxPathname ){
+ /* This branch is taken when the journal path required by
+ ** the database being opened will be more than pVfs->mxPathname
+ ** bytes in length. This means the database cannot be opened,
+ ** as it will not be possible to open the journal file or even
+ ** check for a hot-journal before reading.
+ */
+ rc = SQLITE_CANTOPEN_BKPT;
+ }
+ if( rc!=SQLITE_OK ){
+ sqlite3DbFree(0, zPathname);
+ return rc;
+ }
+ }
+
+ /* Allocate memory for the Pager structure, PCache object, the
+ ** three file descriptors, the database file name and the journal
+ ** file name. The layout in memory is as follows:
+ **
+ ** Pager object (sizeof(Pager) bytes)
+ ** PCache object (sqlite3PcacheSize() bytes)
+ ** Database file handle (pVfs->szOsFile bytes)
+ ** Sub-journal file handle (journalFileSize bytes)
+ ** Main journal file handle (journalFileSize bytes)
+ ** Ptr back to the Pager (sizeof(Pager*) bytes)
+ ** \0\0\0\0 database prefix (4 bytes)
+ ** Database file name (nPathname+1 bytes)
+ ** URI query parameters (nUriByte bytes)
+ ** Journal filename (nPathname+8+1 bytes)
+ ** WAL filename (nPathname+4+1 bytes)
+ ** \0\0\0 terminator (3 bytes)
+ **
+ ** Some 3rd-party software, over which we have no control, depends on
+ ** the specific order of the filenames and the \0 separators between them
+ ** so that it can (for example) find the database filename given the WAL
+ ** filename without using the sqlite3_filename_database() API. This is a
+ ** misuse of SQLite and a bug in the 3rd-party software, but the 3rd-party
+ ** software is in widespread use, so we try to avoid changing the filename
+ ** order and formatting if possible. In particular, the details of the
+ ** filename format expected by 3rd-party software should be as follows:
+ **
+ ** - Main Database Path
+ ** - \0
+ ** - Multiple URI components consisting of:
+ ** - Key
+ ** - \0
+ ** - Value
+ ** - \0
+ ** - \0
+ ** - Journal Path
+ ** - \0
+ ** - WAL Path (zWALName)
+ ** - \0
+ **
+ ** The sqlite3_create_filename() interface and the databaseFilename() utility
+ ** that is used by sqlite3_filename_database() and kin also depend on the
+ ** specific formatting and order of the various filenames, so if the format
+ ** changes here, be sure to change it there as well.
+ */
+ assert( SQLITE_PTRSIZE==sizeof(Pager*) );
+ pPtr = (u8 *)sqlite3MallocZero(
+ ROUND8(sizeof(*pPager)) + /* Pager structure */
+ ROUND8(pcacheSize) + /* PCache object */
+ ROUND8(pVfs->szOsFile) + /* The main db file */
+ journalFileSize * 2 + /* The two journal files */
+ SQLITE_PTRSIZE + /* Space to hold a pointer */
+ 4 + /* Database prefix */
+ nPathname + 1 + /* database filename */
+ nUriByte + /* query parameters */
+ nPathname + 8 + 1 + /* Journal filename */
+#ifndef SQLITE_OMIT_WAL
+ nPathname + 4 + 1 + /* WAL filename */
+#endif
+ 3 /* Terminator */
+ );
+ assert( EIGHT_BYTE_ALIGNMENT(SQLITE_INT_TO_PTR(journalFileSize)) );
+ if( !pPtr ){
+ sqlite3DbFree(0, zPathname);
+ return SQLITE_NOMEM_BKPT;
+ }
+ pPager = (Pager*)pPtr; pPtr += ROUND8(sizeof(*pPager));
+ pPager->pPCache = (PCache*)pPtr; pPtr += ROUND8(pcacheSize);
+ pPager->fd = (sqlite3_file*)pPtr; pPtr += ROUND8(pVfs->szOsFile);
+ pPager->sjfd = (sqlite3_file*)pPtr; pPtr += journalFileSize;
+ pPager->jfd = (sqlite3_file*)pPtr; pPtr += journalFileSize;
+ assert( EIGHT_BYTE_ALIGNMENT(pPager->jfd) );
+ memcpy(pPtr, &pPager, SQLITE_PTRSIZE); pPtr += SQLITE_PTRSIZE;
+
+ /* Fill in the Pager.zFilename and pPager.zQueryParam fields */
+ pPtr += 4; /* Skip zero prefix */
+ pPager->zFilename = (char*)pPtr;
+ if( nPathname>0 ){
+ memcpy(pPtr, zPathname, nPathname); pPtr += nPathname + 1;
+ if( zUri ){
+ memcpy(pPtr, zUri, nUriByte); pPtr += nUriByte;
+ }else{
+ pPtr++;
+ }
+ }
+
+
+ /* Fill in Pager.zJournal */
+ if( nPathname>0 ){
+ pPager->zJournal = (char*)pPtr;
+ memcpy(pPtr, zPathname, nPathname); pPtr += nPathname;
+ memcpy(pPtr, "-journal",8); pPtr += 8 + 1;
+#ifdef SQLITE_ENABLE_8_3_NAMES
+ sqlite3FileSuffix3(zFilename,pPager->zJournal);
+ pPtr = (u8*)(pPager->zJournal + sqlite3Strlen30(pPager->zJournal)+1);
+#endif
+ }else{
+ pPager->zJournal = 0;
+ }
+
+#ifndef SQLITE_OMIT_WAL
+ /* Fill in Pager.zWal */
+ if( nPathname>0 ){
+ pPager->zWal = (char*)pPtr;
+ memcpy(pPtr, zPathname, nPathname); pPtr += nPathname;
+ memcpy(pPtr, "-wal", 4); pPtr += 4 + 1;
+#ifdef SQLITE_ENABLE_8_3_NAMES
+ sqlite3FileSuffix3(zFilename, pPager->zWal);
+ pPtr = (u8*)(pPager->zWal + sqlite3Strlen30(pPager->zWal)+1);
+#endif
+ }else{
+ pPager->zWal = 0;
+ }
+#endif
+ (void)pPtr; /* Suppress warning about unused pPtr value */
+
+ if( nPathname ) sqlite3DbFree(0, zPathname);
+ pPager->pVfs = pVfs;
+ pPager->vfsFlags = vfsFlags;
+
+ /* Open the pager file.
+ */
+ if( zFilename && zFilename[0] ){
+ int fout = 0; /* VFS flags returned by xOpen() */
+ rc = sqlite3OsOpen(pVfs, pPager->zFilename, pPager->fd, vfsFlags, &fout);
+ assert( !memDb );
+ pPager->memVfs = memJM = (fout&SQLITE_OPEN_MEMORY)!=0;
+ readOnly = (fout&SQLITE_OPEN_READONLY)!=0;
+
+ /* If the file was successfully opened for read/write access,
+ ** choose a default page size in case we have to create the
+ ** database file. The default page size is the maximum of:
+ **
+ ** + SQLITE_DEFAULT_PAGE_SIZE,
+ ** + The value returned by sqlite3OsSectorSize()
+ ** + The largest page size that can be written atomically.
+ */
+ if( rc==SQLITE_OK ){
+ int iDc = sqlite3OsDeviceCharacteristics(pPager->fd);
+ if( !readOnly ){
+ setSectorSize(pPager);
+ assert(SQLITE_DEFAULT_PAGE_SIZE<=SQLITE_MAX_DEFAULT_PAGE_SIZE);
+ if( szPageDflt<pPager->sectorSize ){
+ if( pPager->sectorSize>SQLITE_MAX_DEFAULT_PAGE_SIZE ){
+ szPageDflt = SQLITE_MAX_DEFAULT_PAGE_SIZE;
+ }else{
+ szPageDflt = (u32)pPager->sectorSize;
+ }
+ }
+#ifdef SQLITE_ENABLE_ATOMIC_WRITE
+ {
+ int ii;
+ assert(SQLITE_IOCAP_ATOMIC512==(512>>8));
+ assert(SQLITE_IOCAP_ATOMIC64K==(65536>>8));
+ assert(SQLITE_MAX_DEFAULT_PAGE_SIZE<=65536);
+ for(ii=szPageDflt; ii<=SQLITE_MAX_DEFAULT_PAGE_SIZE; ii=ii*2){
+ if( iDc&(SQLITE_IOCAP_ATOMIC|(ii>>8)) ){
+ szPageDflt = ii;
+ }
+ }
+ }
+#endif
+ }
+ pPager->noLock = sqlite3_uri_boolean(pPager->zFilename, "nolock", 0);
+ if( (iDc & SQLITE_IOCAP_IMMUTABLE)!=0
+ || sqlite3_uri_boolean(pPager->zFilename, "immutable", 0) ){
+ vfsFlags |= SQLITE_OPEN_READONLY;
+ goto act_like_temp_file;
+ }
+ }
+ }else{
+ /* If a temporary file is requested, it is not opened immediately.
+ ** In this case we accept the default page size and delay actually
+ ** opening the file until the first call to OsWrite().
+ **
+ ** This branch is also run for an in-memory database. An in-memory
+ ** database is the same as a temp-file that is never written out to
+ ** disk and uses an in-memory rollback journal.
+ **
+ ** This branch also runs for files marked as immutable.
+ */
+act_like_temp_file:
+ tempFile = 1;
+ pPager->eState = PAGER_READER; /* Pretend we already have a lock */
+ pPager->eLock = EXCLUSIVE_LOCK; /* Pretend we are in EXCLUSIVE mode */
+ pPager->noLock = 1; /* Do no locking */
+ readOnly = (vfsFlags&SQLITE_OPEN_READONLY);
+ }
+
+ /* The following call to PagerSetPagesize() serves to set the value of
+ ** Pager.pageSize and to allocate the Pager.pTmpSpace buffer.
+ */
+ if( rc==SQLITE_OK ){
+ assert( pPager->memDb==0 );
+ rc = sqlite3PagerSetPagesize(pPager, &szPageDflt, -1);
+ testcase( rc!=SQLITE_OK );
+ }
+
+ /* Initialize the PCache object. */
+ if( rc==SQLITE_OK ){
+ nExtra = ROUND8(nExtra);
+ assert( nExtra>=8 && nExtra<1000 );
+ rc = sqlite3PcacheOpen(szPageDflt, nExtra, !memDb,
+ !memDb?pagerStress:0, (void *)pPager, pPager->pPCache);
+ }
+
+ /* If an error occurred above, free the Pager structure and close the file.
+ */
+ if( rc!=SQLITE_OK ){
+ sqlite3OsClose(pPager->fd);
+ sqlite3PageFree(pPager->pTmpSpace);
+ sqlite3_free(pPager);
+ return rc;
+ }
+
+ PAGERTRACE(("OPEN %d %s\n", FILEHANDLEID(pPager->fd), pPager->zFilename));
+ IOTRACE(("OPEN %p %s\n", pPager, pPager->zFilename))
+
+ pPager->useJournal = (u8)useJournal;
+ /* pPager->stmtOpen = 0; */
+ /* pPager->stmtInUse = 0; */
+ /* pPager->nRef = 0; */
+ /* pPager->stmtSize = 0; */
+ /* pPager->stmtJSize = 0; */
+ /* pPager->nPage = 0; */
+ pPager->mxPgno = SQLITE_MAX_PAGE_COUNT;
+ /* pPager->state = PAGER_UNLOCK; */
+ /* pPager->errMask = 0; */
+ pPager->tempFile = (u8)tempFile;
+ assert( tempFile==PAGER_LOCKINGMODE_NORMAL
+ || tempFile==PAGER_LOCKINGMODE_EXCLUSIVE );
+ assert( PAGER_LOCKINGMODE_EXCLUSIVE==1 );
+ pPager->exclusiveMode = (u8)tempFile;
+ pPager->changeCountDone = pPager->tempFile;
+ pPager->memDb = (u8)memDb;
+ pPager->readOnly = (u8)readOnly;
+ assert( useJournal || pPager->tempFile );
+ sqlite3PagerSetFlags(pPager, (SQLITE_DEFAULT_SYNCHRONOUS+1)|PAGER_CACHESPILL);
+ /* pPager->pFirst = 0; */
+ /* pPager->pFirstSynced = 0; */
+ /* pPager->pLast = 0; */
+ pPager->nExtra = (u16)nExtra;
+ pPager->journalSizeLimit = SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT;
+ assert( isOpen(pPager->fd) || tempFile );
+ setSectorSize(pPager);
+ if( !useJournal ){
+ pPager->journalMode = PAGER_JOURNALMODE_OFF;
+ }else if( memDb || memJM ){
+ pPager->journalMode = PAGER_JOURNALMODE_MEMORY;
+ }
+ /* pPager->xBusyHandler = 0; */
+ /* pPager->pBusyHandlerArg = 0; */
+ pPager->xReiniter = xReinit;
+ setGetterMethod(pPager);
+ /* memset(pPager->aHash, 0, sizeof(pPager->aHash)); */
+ /* pPager->szMmap = SQLITE_DEFAULT_MMAP_SIZE // will be set by btree.c */
+
+ *ppPager = pPager;
+ return SQLITE_OK;
+}
+
+/*
+** Return the sqlite3_file for the main database given the name
+** of the corresponding WAL or Journal name as passed into
+** xOpen.
+*/
+SQLITE_API sqlite3_file *sqlite3_database_file_object(const char *zName){
+ Pager *pPager;
+ const char *p;
+ while( zName[-1]!=0 || zName[-2]!=0 || zName[-3]!=0 || zName[-4]!=0 ){
+ zName--;
+ }
+ p = zName - 4 - sizeof(Pager*);
+ assert( EIGHT_BYTE_ALIGNMENT(p) );
+ pPager = *(Pager**)p;
+ return pPager->fd;
+}
+
+
+/*
+** This function is called after transitioning from PAGER_UNLOCK to
+** PAGER_SHARED state. It tests if there is a hot journal present in
+** the file-system for the given pager. A hot journal is one that
+** needs to be played back. According to this function, a hot-journal
+** file exists if the following criteria are met:
+**
+** * The journal file exists in the file system, and
+** * No process holds a RESERVED or greater lock on the database file, and
+** * The database file itself is greater than 0 bytes in size, and
+** * The first byte of the journal file exists and is not 0x00.
+**
+** If the current size of the database file is 0 but a journal file
+** exists, that is probably an old journal left over from a prior
+** database with the same name. In this case the journal file is
+** just deleted using OsDelete, *pExists is set to 0 and SQLITE_OK
+** is returned.
+**
+** This routine does not check if there is a super-journal filename
+** at the end of the file. If there is, and that super-journal file
+** does not exist, then the journal file is not really hot. In this
+** case this routine will return a false-positive. The pager_playback()
+** routine will discover that the journal file is not really hot and
+** will not roll it back.
+**
+** If a hot-journal file is found to exist, *pExists is set to 1 and
+** SQLITE_OK returned. If no hot-journal file is present, *pExists is
+** set to 0 and SQLITE_OK returned. If an IO error occurs while trying
+** to determine whether or not a hot-journal file exists, the IO error
+** code is returned and the value of *pExists is undefined.
+*/
+static int hasHotJournal(Pager *pPager, int *pExists){
+ sqlite3_vfs * const pVfs = pPager->pVfs;
+ int rc = SQLITE_OK; /* Return code */
+ int exists = 1; /* True if a journal file is present */
+ int jrnlOpen = !!isOpen(pPager->jfd);
+
+ assert( pPager->useJournal );
+ assert( isOpen(pPager->fd) );
+ assert( pPager->eState==PAGER_OPEN );
+
+ assert( jrnlOpen==0 || ( sqlite3OsDeviceCharacteristics(pPager->jfd) &
+ SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN
+ ));
+
+ *pExists = 0;
+ if( !jrnlOpen ){
+ rc = sqlite3OsAccess(pVfs, pPager->zJournal, SQLITE_ACCESS_EXISTS, &exists);
+ }
+ if( rc==SQLITE_OK && exists ){
+ int locked = 0; /* True if some process holds a RESERVED lock */
+
+ /* Race condition here: Another process might have been holding the
+ ** the RESERVED lock and have a journal open at the sqlite3OsAccess()
+ ** call above, but then delete the journal and drop the lock before
+ ** we get to the following sqlite3OsCheckReservedLock() call. If that
+ ** is the case, this routine might think there is a hot journal when
+ ** in fact there is none. This results in a false-positive which will
+ ** be dealt with by the playback routine. Ticket #3883.
+ */
+ rc = sqlite3OsCheckReservedLock(pPager->fd, &locked);
+ if( rc==SQLITE_OK && !locked ){
+ Pgno nPage; /* Number of pages in database file */
+
+ assert( pPager->tempFile==0 );
+ rc = pagerPagecount(pPager, &nPage);
+ if( rc==SQLITE_OK ){
+ /* If the database is zero pages in size, that means that either (1) the
+ ** journal is a remnant from a prior database with the same name where
+ ** the database file but not the journal was deleted, or (2) the initial
+ ** transaction that populates a new database is being rolled back.
+ ** In either case, the journal file can be deleted. However, take care
+ ** not to delete the journal file if it is already open due to
+ ** journal_mode=PERSIST.
+ */
+ if( nPage==0 && !jrnlOpen ){
+ sqlite3BeginBenignMalloc();
+ if( pagerLockDb(pPager, RESERVED_LOCK)==SQLITE_OK ){
+ sqlite3OsDelete(pVfs, pPager->zJournal, 0);
+ if( !pPager->exclusiveMode ) pagerUnlockDb(pPager, SHARED_LOCK);
+ }
+ sqlite3EndBenignMalloc();
+ }else{
+ /* The journal file exists and no other connection has a reserved
+ ** or greater lock on the database file. Now check that there is
+ ** at least one non-zero bytes at the start of the journal file.
+ ** If there is, then we consider this journal to be hot. If not,
+ ** it can be ignored.
+ */
+ if( !jrnlOpen ){
+ int f = SQLITE_OPEN_READONLY|SQLITE_OPEN_MAIN_JOURNAL;
+ rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, f, &f);
+ }
+ if( rc==SQLITE_OK ){
+ u8 first = 0;
+ rc = sqlite3OsRead(pPager->jfd, (void *)&first, 1, 0);
+ if( rc==SQLITE_IOERR_SHORT_READ ){
+ rc = SQLITE_OK;
+ }
+ if( !jrnlOpen ){
+ sqlite3OsClose(pPager->jfd);
+ }
+ *pExists = (first!=0);
+ }else if( rc==SQLITE_CANTOPEN ){
+ /* If we cannot open the rollback journal file in order to see if
+ ** it has a zero header, that might be due to an I/O error, or
+ ** it might be due to the race condition described above and in
+ ** ticket #3883. Either way, assume that the journal is hot.
+ ** This might be a false positive. But if it is, then the
+ ** automatic journal playback and recovery mechanism will deal
+ ** with it under an EXCLUSIVE lock where we do not need to
+ ** worry so much with race conditions.
+ */
+ *pExists = 1;
+ rc = SQLITE_OK;
+ }
+ }
+ }
+ }
+ }
+
+ return rc;
+}
+
+/*
+** This function is called to obtain a shared lock on the database file.
+** It is illegal to call sqlite3PagerGet() until after this function
+** has been successfully called. If a shared-lock is already held when
+** this function is called, it is a no-op.
+**
+** The following operations are also performed by this function.
+**
+** 1) If the pager is currently in PAGER_OPEN state (no lock held
+** on the database file), then an attempt is made to obtain a
+** SHARED lock on the database file. Immediately after obtaining
+** the SHARED lock, the file-system is checked for a hot-journal,
+** which is played back if present. Following any hot-journal
+** rollback, the contents of the cache are validated by checking
+** the 'change-counter' field of the database file header and
+** discarded if they are found to be invalid.
+**
+** 2) If the pager is running in exclusive-mode, and there are currently
+** no outstanding references to any pages, and is in the error state,
+** then an attempt is made to clear the error state by discarding
+** the contents of the page cache and rolling back any open journal
+** file.
+**
+** If everything is successful, SQLITE_OK is returned. If an IO error
+** occurs while locking the database, checking for a hot-journal file or
+** rolling back a journal file, the IO error code is returned.
+*/
+SQLITE_PRIVATE int sqlite3PagerSharedLock(Pager *pPager){
+ int rc = SQLITE_OK; /* Return code */
+
+ /* This routine is only called from b-tree and only when there are no
+ ** outstanding pages. This implies that the pager state should either
+ ** be OPEN or READER. READER is only possible if the pager is or was in
+ ** exclusive access mode. */
+ assert( sqlite3PcacheRefCount(pPager->pPCache)==0 );
+ assert( assert_pager_state(pPager) );
+ assert( pPager->eState==PAGER_OPEN || pPager->eState==PAGER_READER );
+ assert( pPager->errCode==SQLITE_OK );
+
+ if( !pagerUseWal(pPager) && pPager->eState==PAGER_OPEN ){
+ int bHotJournal = 1; /* True if there exists a hot journal-file */
+
+ assert( !MEMDB );
+ assert( pPager->tempFile==0 || pPager->eLock==EXCLUSIVE_LOCK );
+
+ rc = pager_wait_on_lock(pPager, SHARED_LOCK);
+ if( rc!=SQLITE_OK ){
+ assert( pPager->eLock==NO_LOCK || pPager->eLock==UNKNOWN_LOCK );
+ goto failed;
+ }
+
+ /* If a journal file exists, and there is no RESERVED lock on the
+ ** database file, then it either needs to be played back or deleted.
+ */
+ if( pPager->eLock<=SHARED_LOCK ){
+ rc = hasHotJournal(pPager, &bHotJournal);
+ }
+ if( rc!=SQLITE_OK ){
+ goto failed;
+ }
+ if( bHotJournal ){
+ if( pPager->readOnly ){
+ rc = SQLITE_READONLY_ROLLBACK;
+ goto failed;
+ }
+
+ /* Get an EXCLUSIVE lock on the database file. At this point it is
+ ** important that a RESERVED lock is not obtained on the way to the
+ ** EXCLUSIVE lock. If it were, another process might open the
+ ** database file, detect the RESERVED lock, and conclude that the
+ ** database is safe to read while this process is still rolling the
+ ** hot-journal back.
+ **
+ ** Because the intermediate RESERVED lock is not requested, any
+ ** other process attempting to access the database file will get to
+ ** this point in the code and fail to obtain its own EXCLUSIVE lock
+ ** on the database file.
+ **
+ ** Unless the pager is in locking_mode=exclusive mode, the lock is
+ ** downgraded to SHARED_LOCK before this function returns.
+ */
+ rc = pagerLockDb(pPager, EXCLUSIVE_LOCK);
+ if( rc!=SQLITE_OK ){
+ goto failed;
+ }
+
+ /* If it is not already open and the file exists on disk, open the
+ ** journal for read/write access. Write access is required because
+ ** in exclusive-access mode the file descriptor will be kept open
+ ** and possibly used for a transaction later on. Also, write-access
+ ** is usually required to finalize the journal in journal_mode=persist
+ ** mode (and also for journal_mode=truncate on some systems).
+ **
+ ** If the journal does not exist, it usually means that some
+ ** other connection managed to get in and roll it back before
+ ** this connection obtained the exclusive lock above. Or, it
+ ** may mean that the pager was in the error-state when this
+ ** function was called and the journal file does not exist.
+ */
+ if( !isOpen(pPager->jfd) && pPager->journalMode!=PAGER_JOURNALMODE_OFF ){
+ sqlite3_vfs * const pVfs = pPager->pVfs;
+ int bExists; /* True if journal file exists */
+ rc = sqlite3OsAccess(
+ pVfs, pPager->zJournal, SQLITE_ACCESS_EXISTS, &bExists);
+ if( rc==SQLITE_OK && bExists ){
+ int fout = 0;
+ int f = SQLITE_OPEN_READWRITE|SQLITE_OPEN_MAIN_JOURNAL;
+ assert( !pPager->tempFile );
+ rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, f, &fout);
+ assert( rc!=SQLITE_OK || isOpen(pPager->jfd) );
+ if( rc==SQLITE_OK && fout&SQLITE_OPEN_READONLY ){
+ rc = SQLITE_CANTOPEN_BKPT;
+ sqlite3OsClose(pPager->jfd);
+ }
+ }
+ }
+
+ /* Playback and delete the journal. Drop the database write
+ ** lock and reacquire the read lock. Purge the cache before
+ ** playing back the hot-journal so that we don't end up with
+ ** an inconsistent cache. Sync the hot journal before playing
+ ** it back since the process that crashed and left the hot journal
+ ** probably did not sync it and we are required to always sync
+ ** the journal before playing it back.
+ */
+ if( isOpen(pPager->jfd) ){
+ assert( rc==SQLITE_OK );
+ rc = pagerSyncHotJournal(pPager);
+ if( rc==SQLITE_OK ){
+ rc = pager_playback(pPager, !pPager->tempFile);
+ pPager->eState = PAGER_OPEN;
+ }
+ }else if( !pPager->exclusiveMode ){
+ pagerUnlockDb(pPager, SHARED_LOCK);
+ }
+
+ if( rc!=SQLITE_OK ){
+ /* This branch is taken if an error occurs while trying to open
+ ** or roll back a hot-journal while holding an EXCLUSIVE lock. The
+ ** pager_unlock() routine will be called before returning to unlock
+ ** the file. If the unlock attempt fails, then Pager.eLock must be
+ ** set to UNKNOWN_LOCK (see the comment above the #define for
+ ** UNKNOWN_LOCK above for an explanation).
+ **
+ ** In order to get pager_unlock() to do this, set Pager.eState to
+ ** PAGER_ERROR now. This is not actually counted as a transition
+ ** to ERROR state in the state diagram at the top of this file,
+ ** since we know that the same call to pager_unlock() will very
+ ** shortly transition the pager object to the OPEN state. Calling
+ ** assert_pager_state() would fail now, as it should not be possible
+ ** to be in ERROR state when there are zero outstanding page
+ ** references.
+ */
+ pager_error(pPager, rc);
+ goto failed;
+ }
+
+ assert( pPager->eState==PAGER_OPEN );
+ assert( (pPager->eLock==SHARED_LOCK)
+ || (pPager->exclusiveMode && pPager->eLock>SHARED_LOCK)
+ );
+ }
+
+ if( !pPager->tempFile && pPager->hasHeldSharedLock ){
+ /* The shared-lock has just been acquired then check to
+ ** see if the database has been modified. If the database has changed,
+ ** flush the cache. The hasHeldSharedLock flag prevents this from
+ ** occurring on the very first access to a file, in order to save a
+ ** single unnecessary sqlite3OsRead() call at the start-up.
+ **
+ ** Database changes are detected by looking at 15 bytes beginning
+ ** at offset 24 into the file. The first 4 of these 16 bytes are
+ ** a 32-bit counter that is incremented with each change. The
+ ** other bytes change randomly with each file change when
+ ** a codec is in use.
+ **
+ ** There is a vanishingly small chance that a change will not be
+ ** detected. The chance of an undetected change is so small that
+ ** it can be neglected.
+ */
+ char dbFileVers[sizeof(pPager->dbFileVers)];
+
+ IOTRACE(("CKVERS %p %d\n", pPager, sizeof(dbFileVers)));
+ rc = sqlite3OsRead(pPager->fd, &dbFileVers, sizeof(dbFileVers), 24);
+ if( rc!=SQLITE_OK ){
+ if( rc!=SQLITE_IOERR_SHORT_READ ){
+ goto failed;
+ }
+ memset(dbFileVers, 0, sizeof(dbFileVers));
+ }
+
+ if( memcmp(pPager->dbFileVers, dbFileVers, sizeof(dbFileVers))!=0 ){
+ pager_reset(pPager);
+
+ /* Unmap the database file. It is possible that external processes
+ ** may have truncated the database file and then extended it back
+ ** to its original size while this process was not holding a lock.
+ ** In this case there may exist a Pager.pMap mapping that appears
+ ** to be the right size but is not actually valid. Avoid this
+ ** possibility by unmapping the db here. */
+ if( USEFETCH(pPager) ){
+ sqlite3OsUnfetch(pPager->fd, 0, 0);
+ }
+ }
+ }
+
+ /* If there is a WAL file in the file-system, open this database in WAL
+ ** mode. Otherwise, the following function call is a no-op.
+ */
+ rc = pagerOpenWalIfPresent(pPager);
+#ifndef SQLITE_OMIT_WAL
+ assert( pPager->pWal==0 || rc==SQLITE_OK );
+#endif
+ }
+
+ if( pagerUseWal(pPager) ){
+ assert( rc==SQLITE_OK );
+ rc = pagerBeginReadTransaction(pPager);
+ }
+
+ if( pPager->tempFile==0 && pPager->eState==PAGER_OPEN && rc==SQLITE_OK ){
+ rc = pagerPagecount(pPager, &pPager->dbSize);
+ }
+
+ failed:
+ if( rc!=SQLITE_OK ){
+ assert( !MEMDB );
+ pager_unlock(pPager);
+ assert( pPager->eState==PAGER_OPEN );
+ }else{
+ pPager->eState = PAGER_READER;
+ pPager->hasHeldSharedLock = 1;
+ }
+ return rc;
+}
+
+/*
+** If the reference count has reached zero, rollback any active
+** transaction and unlock the pager.
+**
+** Except, in locking_mode=EXCLUSIVE when there is nothing to in
+** the rollback journal, the unlock is not performed and there is
+** nothing to rollback, so this routine is a no-op.
+*/
+static void pagerUnlockIfUnused(Pager *pPager){
+ if( sqlite3PcacheRefCount(pPager->pPCache)==0 ){
+ assert( pPager->nMmapOut==0 ); /* because page1 is never memory mapped */
+ pagerUnlockAndRollback(pPager);
+ }
+}
+
+/*
+** The page getter methods each try to acquire a reference to a
+** page with page number pgno. If the requested reference is
+** successfully obtained, it is copied to *ppPage and SQLITE_OK returned.
+**
+** There are different implementations of the getter method depending
+** on the current state of the pager.
+**
+** getPageNormal() -- The normal getter
+** getPageError() -- Used if the pager is in an error state
+** getPageMmap() -- Used if memory-mapped I/O is enabled
+**
+** If the requested page is already in the cache, it is returned.
+** Otherwise, a new page object is allocated and populated with data
+** read from the database file. In some cases, the pcache module may
+** choose not to allocate a new page object and may reuse an existing
+** object with no outstanding references.
+**
+** The extra data appended to a page is always initialized to zeros the
+** first time a page is loaded into memory. If the page requested is
+** already in the cache when this function is called, then the extra
+** data is left as it was when the page object was last used.
+**
+** If the database image is smaller than the requested page or if
+** the flags parameter contains the PAGER_GET_NOCONTENT bit and the
+** requested page is not already stored in the cache, then no
+** actual disk read occurs. In this case the memory image of the
+** page is initialized to all zeros.
+**
+** If PAGER_GET_NOCONTENT is true, it means that we do not care about
+** the contents of the page. This occurs in two scenarios:
+**
+** a) When reading a free-list leaf page from the database, and
+**
+** b) When a savepoint is being rolled back and we need to load
+** a new page into the cache to be filled with the data read
+** from the savepoint journal.
+**
+** If PAGER_GET_NOCONTENT is true, then the data returned is zeroed instead
+** of being read from the database. Additionally, the bits corresponding
+** to pgno in Pager.pInJournal (bitvec of pages already written to the
+** journal file) and the PagerSavepoint.pInSavepoint bitvecs of any open
+** savepoints are set. This means if the page is made writable at any
+** point in the future, using a call to sqlite3PagerWrite(), its contents
+** will not be journaled. This saves IO.
+**
+** The acquisition might fail for several reasons. In all cases,
+** an appropriate error code is returned and *ppPage is set to NULL.
+**
+** See also sqlite3PagerLookup(). Both this routine and Lookup() attempt
+** to find a page in the in-memory cache first. If the page is not already
+** in memory, this routine goes to disk to read it in whereas Lookup()
+** just returns 0. This routine acquires a read-lock the first time it
+** has to go to disk, and could also playback an old journal if necessary.
+** Since Lookup() never goes to disk, it never has to deal with locks
+** or journal files.
+*/
+static int getPageNormal(
+ Pager *pPager, /* The pager open on the database file */
+ Pgno pgno, /* Page number to fetch */
+ DbPage **ppPage, /* Write a pointer to the page here */
+ int flags /* PAGER_GET_XXX flags */
+){
+ int rc = SQLITE_OK;
+ PgHdr *pPg;
+ u8 noContent; /* True if PAGER_GET_NOCONTENT is set */
+ sqlite3_pcache_page *pBase;
+
+ assert( pPager->errCode==SQLITE_OK );
+ assert( pPager->eState>=PAGER_READER );
+ assert( assert_pager_state(pPager) );
+ assert( pPager->hasHeldSharedLock==1 );
+
+ if( pgno==0 ) return SQLITE_CORRUPT_BKPT;
+ pBase = sqlite3PcacheFetch(pPager->pPCache, pgno, 3);
+ if( pBase==0 ){
+ pPg = 0;
+ rc = sqlite3PcacheFetchStress(pPager->pPCache, pgno, &pBase);
+ if( rc!=SQLITE_OK ) goto pager_acquire_err;
+ if( pBase==0 ){
+ rc = SQLITE_NOMEM_BKPT;
+ goto pager_acquire_err;
+ }
+ }
+ pPg = *ppPage = sqlite3PcacheFetchFinish(pPager->pPCache, pgno, pBase);
+ assert( pPg==(*ppPage) );
+ assert( pPg->pgno==pgno );
+ assert( pPg->pPager==pPager || pPg->pPager==0 );
+
+ noContent = (flags & PAGER_GET_NOCONTENT)!=0;
+ if( pPg->pPager && !noContent ){
+ /* In this case the pcache already contains an initialized copy of
+ ** the page. Return without further ado. */
+ assert( pgno!=PAGER_SJ_PGNO(pPager) );
+ pPager->aStat[PAGER_STAT_HIT]++;
+ return SQLITE_OK;
+
+ }else{
+ /* The pager cache has created a new page. Its content needs to
+ ** be initialized. But first some error checks:
+ **
+ ** (*) obsolete. Was: maximum page number is 2^31
+ ** (2) Never try to fetch the locking page
+ */
+ if( pgno==PAGER_SJ_PGNO(pPager) ){
+ rc = SQLITE_CORRUPT_BKPT;
+ goto pager_acquire_err;
+ }
+
+ pPg->pPager = pPager;
+
+ assert( !isOpen(pPager->fd) || !MEMDB );
+ if( !isOpen(pPager->fd) || pPager->dbSize<pgno || noContent ){
+ if( pgno>pPager->mxPgno ){
+ rc = SQLITE_FULL;
+ if( pgno<=pPager->dbSize ){
+ sqlite3PcacheRelease(pPg);
+ pPg = 0;
+ }
+ goto pager_acquire_err;
+ }
+ if( noContent ){
+ /* Failure to set the bits in the InJournal bit-vectors is benign.
+ ** It merely means that we might do some extra work to journal a
+ ** page that does not need to be journaled. Nevertheless, be sure
+ ** to test the case where a malloc error occurs while trying to set
+ ** a bit in a bit vector.
+ */
+ sqlite3BeginBenignMalloc();
+ if( pgno<=pPager->dbOrigSize ){
+ TESTONLY( rc = ) sqlite3BitvecSet(pPager->pInJournal, pgno);
+ testcase( rc==SQLITE_NOMEM );
+ }
+ TESTONLY( rc = ) addToSavepointBitvecs(pPager, pgno);
+ testcase( rc==SQLITE_NOMEM );
+ sqlite3EndBenignMalloc();
+ }
+ memset(pPg->pData, 0, pPager->pageSize);
+ IOTRACE(("ZERO %p %d\n", pPager, pgno));
+ }else{
+ assert( pPg->pPager==pPager );
+ pPager->aStat[PAGER_STAT_MISS]++;
+ rc = readDbPage(pPg);
+ if( rc!=SQLITE_OK ){
+ goto pager_acquire_err;
+ }
+ }
+ pager_set_pagehash(pPg);
+ }
+ return SQLITE_OK;
+
+pager_acquire_err:
+ assert( rc!=SQLITE_OK );
+ if( pPg ){
+ sqlite3PcacheDrop(pPg);
+ }
+ pagerUnlockIfUnused(pPager);
+ *ppPage = 0;
+ return rc;
+}
+
+#if SQLITE_MAX_MMAP_SIZE>0
+/* The page getter for when memory-mapped I/O is enabled */
+static int getPageMMap(
+ Pager *pPager, /* The pager open on the database file */
+ Pgno pgno, /* Page number to fetch */
+ DbPage **ppPage, /* Write a pointer to the page here */
+ int flags /* PAGER_GET_XXX flags */
+){
+ int rc = SQLITE_OK;
+ PgHdr *pPg = 0;
+ u32 iFrame = 0; /* Frame to read from WAL file */
+
+ /* It is acceptable to use a read-only (mmap) page for any page except
+ ** page 1 if there is no write-transaction open or the ACQUIRE_READONLY
+ ** flag was specified by the caller. And so long as the db is not a
+ ** temporary or in-memory database. */
+ const int bMmapOk = (pgno>1
+ && (pPager->eState==PAGER_READER || (flags & PAGER_GET_READONLY))
+ );
+
+ assert( USEFETCH(pPager) );
+
+ /* Optimization note: Adding the "pgno<=1" term before "pgno==0" here
+ ** allows the compiler optimizer to reuse the results of the "pgno>1"
+ ** test in the previous statement, and avoid testing pgno==0 in the
+ ** common case where pgno is large. */
+ if( pgno<=1 && pgno==0 ){
+ return SQLITE_CORRUPT_BKPT;
+ }
+ assert( pPager->eState>=PAGER_READER );
+ assert( assert_pager_state(pPager) );
+ assert( pPager->hasHeldSharedLock==1 );
+ assert( pPager->errCode==SQLITE_OK );
+
+ if( bMmapOk && pagerUseWal(pPager) ){
+ rc = sqlite3WalFindFrame(pPager->pWal, pgno, &iFrame);
+ if( rc!=SQLITE_OK ){
+ *ppPage = 0;
+ return rc;
+ }
+ }
+ if( bMmapOk && iFrame==0 ){
+ void *pData = 0;
+ rc = sqlite3OsFetch(pPager->fd,
+ (i64)(pgno-1) * pPager->pageSize, pPager->pageSize, &pData
+ );
+ if( rc==SQLITE_OK && pData ){
+ if( pPager->eState>PAGER_READER || pPager->tempFile ){
+ pPg = sqlite3PagerLookup(pPager, pgno);
+ }
+ if( pPg==0 ){
+ rc = pagerAcquireMapPage(pPager, pgno, pData, &pPg);
+ }else{
+ sqlite3OsUnfetch(pPager->fd, (i64)(pgno-1)*pPager->pageSize, pData);
+ }
+ if( pPg ){
+ assert( rc==SQLITE_OK );
+ *ppPage = pPg;
+ return SQLITE_OK;
+ }
+ }
+ if( rc!=SQLITE_OK ){
+ *ppPage = 0;
+ return rc;
+ }
+ }
+ return getPageNormal(pPager, pgno, ppPage, flags);
+}
+#endif /* SQLITE_MAX_MMAP_SIZE>0 */
+
+/* The page getter method for when the pager is an error state */
+static int getPageError(
+ Pager *pPager, /* The pager open on the database file */
+ Pgno pgno, /* Page number to fetch */
+ DbPage **ppPage, /* Write a pointer to the page here */
+ int flags /* PAGER_GET_XXX flags */
+){
+ UNUSED_PARAMETER(pgno);
+ UNUSED_PARAMETER(flags);
+ assert( pPager->errCode!=SQLITE_OK );
+ *ppPage = 0;
+ return pPager->errCode;
+}
+
+
+/* Dispatch all page fetch requests to the appropriate getter method.
+*/
+SQLITE_PRIVATE int sqlite3PagerGet(
+ Pager *pPager, /* The pager open on the database file */
+ Pgno pgno, /* Page number to fetch */
+ DbPage **ppPage, /* Write a pointer to the page here */
+ int flags /* PAGER_GET_XXX flags */
+){
+#if 0 /* Trace page fetch by setting to 1 */
+ int rc;
+ printf("PAGE %u\n", pgno);
+ fflush(stdout);
+ rc = pPager->xGet(pPager, pgno, ppPage, flags);
+ if( rc ){
+ printf("PAGE %u failed with 0x%02x\n", pgno, rc);
+ fflush(stdout);
+ }
+ return rc;
+#else
+ /* Normal, high-speed version of sqlite3PagerGet() */
+ return pPager->xGet(pPager, pgno, ppPage, flags);
+#endif
+}
+
+/*
+** Acquire a page if it is already in the in-memory cache. Do
+** not read the page from disk. Return a pointer to the page,
+** or 0 if the page is not in cache.
+**
+** See also sqlite3PagerGet(). The difference between this routine
+** and sqlite3PagerGet() is that _get() will go to the disk and read
+** in the page if the page is not already in cache. This routine
+** returns NULL if the page is not in cache or if a disk I/O error
+** has ever happened.
+*/
+SQLITE_PRIVATE DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno){
+ sqlite3_pcache_page *pPage;
+ assert( pPager!=0 );
+ assert( pgno!=0 );
+ assert( pPager->pPCache!=0 );
+ pPage = sqlite3PcacheFetch(pPager->pPCache, pgno, 0);
+ assert( pPage==0 || pPager->hasHeldSharedLock );
+ if( pPage==0 ) return 0;
+ return sqlite3PcacheFetchFinish(pPager->pPCache, pgno, pPage);
+}
+
+/*
+** Release a page reference.
+**
+** The sqlite3PagerUnref() and sqlite3PagerUnrefNotNull() may only be used
+** if we know that the page being released is not the last reference to page1.
+** The btree layer always holds page1 open until the end, so these first
+** two routines can be used to release any page other than BtShared.pPage1.
+** The assert() at tag-20230419-2 proves that this constraint is always
+** honored.
+**
+** Use sqlite3PagerUnrefPageOne() to release page1. This latter routine
+** checks the total number of outstanding pages and if the number of
+** pages reaches zero it drops the database lock.
+*/
+SQLITE_PRIVATE void sqlite3PagerUnrefNotNull(DbPage *pPg){
+ TESTONLY( Pager *pPager = pPg->pPager; )
+ assert( pPg!=0 );
+ if( pPg->flags & PGHDR_MMAP ){
+ assert( pPg->pgno!=1 ); /* Page1 is never memory mapped */
+ pagerReleaseMapPage(pPg);
+ }else{
+ sqlite3PcacheRelease(pPg);
+ }
+ /* Do not use this routine to release the last reference to page1 */
+ assert( sqlite3PcacheRefCount(pPager->pPCache)>0 ); /* tag-20230419-2 */
+}
+SQLITE_PRIVATE void sqlite3PagerUnref(DbPage *pPg){
+ if( pPg ) sqlite3PagerUnrefNotNull(pPg);
+}
+SQLITE_PRIVATE void sqlite3PagerUnrefPageOne(DbPage *pPg){
+ Pager *pPager;
+ assert( pPg!=0 );
+ assert( pPg->pgno==1 );
+ assert( (pPg->flags & PGHDR_MMAP)==0 ); /* Page1 is never memory mapped */
+ pPager = pPg->pPager;
+ sqlite3PcacheRelease(pPg);
+ pagerUnlockIfUnused(pPager);
+}
+
+/*
+** This function is called at the start of every write transaction.
+** There must already be a RESERVED or EXCLUSIVE lock on the database
+** file when this routine is called.
+**
+** Open the journal file for pager pPager and write a journal header
+** to the start of it. If there are active savepoints, open the sub-journal
+** as well. This function is only used when the journal file is being
+** opened to write a rollback log for a transaction. It is not used
+** when opening a hot journal file to roll it back.
+**
+** If the journal file is already open (as it may be in exclusive mode),
+** then this function just writes a journal header to the start of the
+** already open file.
+**
+** Whether or not the journal file is opened by this function, the
+** Pager.pInJournal bitvec structure is allocated.
+**
+** Return SQLITE_OK if everything is successful. Otherwise, return
+** SQLITE_NOMEM if the attempt to allocate Pager.pInJournal fails, or
+** an IO error code if opening or writing the journal file fails.
+*/
+static int pager_open_journal(Pager *pPager){
+ int rc = SQLITE_OK; /* Return code */
+ sqlite3_vfs * const pVfs = pPager->pVfs; /* Local cache of vfs pointer */
+
+ assert( pPager->eState==PAGER_WRITER_LOCKED );
+ assert( assert_pager_state(pPager) );
+ assert( pPager->pInJournal==0 );
+
+ /* If already in the error state, this function is a no-op. But on
+ ** the other hand, this routine is never called if we are already in
+ ** an error state. */
+ if( NEVER(pPager->errCode) ) return pPager->errCode;
+
+ if( !pagerUseWal(pPager) && pPager->journalMode!=PAGER_JOURNALMODE_OFF ){
+ pPager->pInJournal = sqlite3BitvecCreate(pPager->dbSize);
+ if( pPager->pInJournal==0 ){
+ return SQLITE_NOMEM_BKPT;
+ }
+
+ /* Open the journal file if it is not already open. */
+ if( !isOpen(pPager->jfd) ){
+ if( pPager->journalMode==PAGER_JOURNALMODE_MEMORY ){
+ sqlite3MemJournalOpen(pPager->jfd);
+ }else{
+ int flags = SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE;
+ int nSpill;
+
+ if( pPager->tempFile ){
+ flags |= (SQLITE_OPEN_DELETEONCLOSE|SQLITE_OPEN_TEMP_JOURNAL);
+ flags |= SQLITE_OPEN_EXCLUSIVE;
+ nSpill = sqlite3Config.nStmtSpill;
+ }else{
+ flags |= SQLITE_OPEN_MAIN_JOURNAL;
+ nSpill = jrnlBufferSize(pPager);
+ }
+
+ /* Verify that the database still has the same name as it did when
+ ** it was originally opened. */
+ rc = databaseIsUnmoved(pPager);
+ if( rc==SQLITE_OK ){
+ rc = sqlite3JournalOpen (
+ pVfs, pPager->zJournal, pPager->jfd, flags, nSpill
+ );
+ }
+ }
+ assert( rc!=SQLITE_OK || isOpen(pPager->jfd) );
+ }
+
+
+ /* Write the first journal header to the journal file and open
+ ** the sub-journal if necessary.
+ */
+ if( rc==SQLITE_OK ){
+ /* TODO: Check if all of these are really required. */
+ pPager->nRec = 0;
+ pPager->journalOff = 0;
+ pPager->setSuper = 0;
+ pPager->journalHdr = 0;
+ rc = writeJournalHdr(pPager);
+ }
+ }
+
+ if( rc!=SQLITE_OK ){
+ sqlite3BitvecDestroy(pPager->pInJournal);
+ pPager->pInJournal = 0;
+ pPager->journalOff = 0;
+ }else{
+ assert( pPager->eState==PAGER_WRITER_LOCKED );
+ pPager->eState = PAGER_WRITER_CACHEMOD;
+ }
+
+ return rc;
+}
+
+/*
+** Begin a write-transaction on the specified pager object. If a
+** write-transaction has already been opened, this function is a no-op.
+**
+** If the exFlag argument is false, then acquire at least a RESERVED
+** lock on the database file. If exFlag is true, then acquire at least
+** an EXCLUSIVE lock. If such a lock is already held, no locking
+** functions need be called.
+**
+** If the subjInMemory argument is non-zero, then any sub-journal opened
+** within this transaction will be opened as an in-memory file. This
+** has no effect if the sub-journal is already opened (as it may be when
+** running in exclusive mode) or if the transaction does not require a
+** sub-journal. If the subjInMemory argument is zero, then any required
+** sub-journal is implemented in-memory if pPager is an in-memory database,
+** or using a temporary file otherwise.
+*/
+SQLITE_PRIVATE int sqlite3PagerBegin(Pager *pPager, int exFlag, int subjInMemory){
+ int rc = SQLITE_OK;
+
+ if( pPager->errCode ) return pPager->errCode;
+ assert( pPager->eState>=PAGER_READER && pPager->eState<PAGER_ERROR );
+ pPager->subjInMemory = (u8)subjInMemory;
+
+ if( pPager->eState==PAGER_READER ){
+ assert( pPager->pInJournal==0 );
+
+ if( pagerUseWal(pPager) ){
+ /* If the pager is configured to use locking_mode=exclusive, and an
+ ** exclusive lock on the database is not already held, obtain it now.
+ */
+ if( pPager->exclusiveMode && sqlite3WalExclusiveMode(pPager->pWal, -1) ){
+ rc = pagerLockDb(pPager, EXCLUSIVE_LOCK);
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+ (void)sqlite3WalExclusiveMode(pPager->pWal, 1);
+ }
+
+ /* Grab the write lock on the log file. If successful, upgrade to
+ ** PAGER_RESERVED state. Otherwise, return an error code to the caller.
+ ** The busy-handler is not invoked if another connection already
+ ** holds the write-lock. If possible, the upper layer will call it.
+ */
+ rc = sqlite3WalBeginWriteTransaction(pPager->pWal);
+ }else{
+ /* Obtain a RESERVED lock on the database file. If the exFlag parameter
+ ** is true, then immediately upgrade this to an EXCLUSIVE lock. The
+ ** busy-handler callback can be used when upgrading to the EXCLUSIVE
+ ** lock, but not when obtaining the RESERVED lock.
+ */
+ rc = pagerLockDb(pPager, RESERVED_LOCK);
+ if( rc==SQLITE_OK && exFlag ){
+ rc = pager_wait_on_lock(pPager, EXCLUSIVE_LOCK);
+ }
+ }
+
+ if( rc==SQLITE_OK ){
+ /* Change to WRITER_LOCKED state.
+ **
+ ** WAL mode sets Pager.eState to PAGER_WRITER_LOCKED or CACHEMOD
+ ** when it has an open transaction, but never to DBMOD or FINISHED.
+ ** This is because in those states the code to roll back savepoint
+ ** transactions may copy data from the sub-journal into the database
+ ** file as well as into the page cache. Which would be incorrect in
+ ** WAL mode.
+ */
+ pPager->eState = PAGER_WRITER_LOCKED;
+ pPager->dbHintSize = pPager->dbSize;
+ pPager->dbFileSize = pPager->dbSize;
+ pPager->dbOrigSize = pPager->dbSize;
+ pPager->journalOff = 0;
+ }
+
+ assert( rc==SQLITE_OK || pPager->eState==PAGER_READER );
+ assert( rc!=SQLITE_OK || pPager->eState==PAGER_WRITER_LOCKED );
+ assert( assert_pager_state(pPager) );
+ }
+
+ PAGERTRACE(("TRANSACTION %d\n", PAGERID(pPager)));
+ return rc;
+}
+
+/*
+** Write page pPg onto the end of the rollback journal.
+*/
+static SQLITE_NOINLINE int pagerAddPageToRollbackJournal(PgHdr *pPg){
+ Pager *pPager = pPg->pPager;
+ int rc;
+ u32 cksum;
+ char *pData2;
+ i64 iOff = pPager->journalOff;
+
+ /* We should never write to the journal file the page that
+ ** contains the database locks. The following assert verifies
+ ** that we do not. */
+ assert( pPg->pgno!=PAGER_SJ_PGNO(pPager) );
+
+ assert( pPager->journalHdr<=pPager->journalOff );
+ pData2 = pPg->pData;
+ cksum = pager_cksum(pPager, (u8*)pData2);
+
+ /* Even if an IO or diskfull error occurs while journalling the
+ ** page in the block above, set the need-sync flag for the page.
+ ** Otherwise, when the transaction is rolled back, the logic in
+ ** playback_one_page() will think that the page needs to be restored
+ ** in the database file. And if an IO error occurs while doing so,
+ ** then corruption may follow.
+ */
+ pPg->flags |= PGHDR_NEED_SYNC;
+
+ rc = write32bits(pPager->jfd, iOff, pPg->pgno);
+ if( rc!=SQLITE_OK ) return rc;
+ rc = sqlite3OsWrite(pPager->jfd, pData2, pPager->pageSize, iOff+4);
+ if( rc!=SQLITE_OK ) return rc;
+ rc = write32bits(pPager->jfd, iOff+pPager->pageSize+4, cksum);
+ if( rc!=SQLITE_OK ) return rc;
+
+ IOTRACE(("JOUT %p %d %lld %d\n", pPager, pPg->pgno,
+ pPager->journalOff, pPager->pageSize));
+ PAGER_INCR(sqlite3_pager_writej_count);
+ PAGERTRACE(("JOURNAL %d page %d needSync=%d hash(%08x)\n",
+ PAGERID(pPager), pPg->pgno,
+ ((pPg->flags&PGHDR_NEED_SYNC)?1:0), pager_pagehash(pPg)));
+
+ pPager->journalOff += 8 + pPager->pageSize;
+ pPager->nRec++;
+ assert( pPager->pInJournal!=0 );
+ rc = sqlite3BitvecSet(pPager->pInJournal, pPg->pgno);
+ testcase( rc==SQLITE_NOMEM );
+ assert( rc==SQLITE_OK || rc==SQLITE_NOMEM );
+ rc |= addToSavepointBitvecs(pPager, pPg->pgno);
+ assert( rc==SQLITE_OK || rc==SQLITE_NOMEM );
+ return rc;
+}
+
+/*
+** Mark a single data page as writeable. The page is written into the
+** main journal or sub-journal as required. If the page is written into
+** one of the journals, the corresponding bit is set in the
+** Pager.pInJournal bitvec and the PagerSavepoint.pInSavepoint bitvecs
+** of any open savepoints as appropriate.
+*/
+static int pager_write(PgHdr *pPg){
+ Pager *pPager = pPg->pPager;
+ int rc = SQLITE_OK;
+
+ /* This routine is not called unless a write-transaction has already
+ ** been started. The journal file may or may not be open at this point.
+ ** It is never called in the ERROR state.
+ */
+ assert( pPager->eState==PAGER_WRITER_LOCKED
+ || pPager->eState==PAGER_WRITER_CACHEMOD
+ || pPager->eState==PAGER_WRITER_DBMOD
+ );
+ assert( assert_pager_state(pPager) );
+ assert( pPager->errCode==0 );
+ assert( pPager->readOnly==0 );
+ CHECK_PAGE(pPg);
+
+ /* The journal file needs to be opened. Higher level routines have already
+ ** obtained the necessary locks to begin the write-transaction, but the
+ ** rollback journal might not yet be open. Open it now if this is the case.
+ **
+ ** This is done before calling sqlite3PcacheMakeDirty() on the page.
+ ** Otherwise, if it were done after calling sqlite3PcacheMakeDirty(), then
+ ** an error might occur and the pager would end up in WRITER_LOCKED state
+ ** with pages marked as dirty in the cache.
+ */
+ if( pPager->eState==PAGER_WRITER_LOCKED ){
+ rc = pager_open_journal(pPager);
+ if( rc!=SQLITE_OK ) return rc;
+ }
+ assert( pPager->eState>=PAGER_WRITER_CACHEMOD );
+ assert( assert_pager_state(pPager) );
+
+ /* Mark the page that is about to be modified as dirty. */
+ sqlite3PcacheMakeDirty(pPg);
+
+ /* If a rollback journal is in use, them make sure the page that is about
+ ** to change is in the rollback journal, or if the page is a new page off
+ ** then end of the file, make sure it is marked as PGHDR_NEED_SYNC.
+ */
+ assert( (pPager->pInJournal!=0) == isOpen(pPager->jfd) );
+ if( pPager->pInJournal!=0
+ && sqlite3BitvecTestNotNull(pPager->pInJournal, pPg->pgno)==0
+ ){
+ assert( pagerUseWal(pPager)==0 );
+ if( pPg->pgno<=pPager->dbOrigSize ){
+ rc = pagerAddPageToRollbackJournal(pPg);
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+ }else{
+ if( pPager->eState!=PAGER_WRITER_DBMOD ){
+ pPg->flags |= PGHDR_NEED_SYNC;
+ }
+ PAGERTRACE(("APPEND %d page %d needSync=%d\n",
+ PAGERID(pPager), pPg->pgno,
+ ((pPg->flags&PGHDR_NEED_SYNC)?1:0)));
+ }
+ }
+
+ /* The PGHDR_DIRTY bit is set above when the page was added to the dirty-list
+ ** and before writing the page into the rollback journal. Wait until now,
+ ** after the page has been successfully journalled, before setting the
+ ** PGHDR_WRITEABLE bit that indicates that the page can be safely modified.
+ */
+ pPg->flags |= PGHDR_WRITEABLE;
+
+ /* If the statement journal is open and the page is not in it,
+ ** then write the page into the statement journal.
+ */
+ if( pPager->nSavepoint>0 ){
+ rc = subjournalPageIfRequired(pPg);
+ }
+
+ /* Update the database size and return. */
+ if( pPager->dbSize<pPg->pgno ){
+ pPager->dbSize = pPg->pgno;
+ }
+ return rc;
+}
+
+/*
+** This is a variant of sqlite3PagerWrite() that runs when the sector size
+** is larger than the page size. SQLite makes the (reasonable) assumption that
+** all bytes of a sector are written together by hardware. Hence, all bytes of
+** a sector need to be journalled in case of a power loss in the middle of
+** a write.
+**
+** Usually, the sector size is less than or equal to the page size, in which
+** case pages can be individually written. This routine only runs in the
+** exceptional case where the page size is smaller than the sector size.
+*/
+static SQLITE_NOINLINE int pagerWriteLargeSector(PgHdr *pPg){
+ int rc = SQLITE_OK; /* Return code */
+ Pgno nPageCount; /* Total number of pages in database file */
+ Pgno pg1; /* First page of the sector pPg is located on. */
+ int nPage = 0; /* Number of pages starting at pg1 to journal */
+ int ii; /* Loop counter */
+ int needSync = 0; /* True if any page has PGHDR_NEED_SYNC */
+ Pager *pPager = pPg->pPager; /* The pager that owns pPg */
+ Pgno nPagePerSector = (pPager->sectorSize/pPager->pageSize);
+
+ /* Set the doNotSpill NOSYNC bit to 1. This is because we cannot allow
+ ** a journal header to be written between the pages journaled by
+ ** this function.
+ */
+ assert( !MEMDB );
+ assert( (pPager->doNotSpill & SPILLFLAG_NOSYNC)==0 );
+ pPager->doNotSpill |= SPILLFLAG_NOSYNC;
+
+ /* This trick assumes that both the page-size and sector-size are
+ ** an integer power of 2. It sets variable pg1 to the identifier
+ ** of the first page of the sector pPg is located on.
+ */
+ pg1 = ((pPg->pgno-1) & ~(nPagePerSector-1)) + 1;
+
+ nPageCount = pPager->dbSize;
+ if( pPg->pgno>nPageCount ){
+ nPage = (pPg->pgno - pg1)+1;
+ }else if( (pg1+nPagePerSector-1)>nPageCount ){
+ nPage = nPageCount+1-pg1;
+ }else{
+ nPage = nPagePerSector;
+ }
+ assert(nPage>0);
+ assert(pg1<=pPg->pgno);
+ assert((pg1+nPage)>pPg->pgno);
+
+ for(ii=0; ii<nPage && rc==SQLITE_OK; ii++){
+ Pgno pg = pg1+ii;
+ PgHdr *pPage;
+ if( pg==pPg->pgno || !sqlite3BitvecTest(pPager->pInJournal, pg) ){
+ if( pg!=PAGER_SJ_PGNO(pPager) ){
+ rc = sqlite3PagerGet(pPager, pg, &pPage, 0);
+ if( rc==SQLITE_OK ){
+ rc = pager_write(pPage);
+ if( pPage->flags&PGHDR_NEED_SYNC ){
+ needSync = 1;
+ }
+ sqlite3PagerUnrefNotNull(pPage);
+ }
+ }
+ }else if( (pPage = sqlite3PagerLookup(pPager, pg))!=0 ){
+ if( pPage->flags&PGHDR_NEED_SYNC ){
+ needSync = 1;
+ }
+ sqlite3PagerUnrefNotNull(pPage);
+ }
+ }
+
+ /* If the PGHDR_NEED_SYNC flag is set for any of the nPage pages
+ ** starting at pg1, then it needs to be set for all of them. Because
+ ** writing to any of these nPage pages may damage the others, the
+ ** journal file must contain sync()ed copies of all of them
+ ** before any of them can be written out to the database file.
+ */
+ if( rc==SQLITE_OK && needSync ){
+ assert( !MEMDB );
+ for(ii=0; ii<nPage; ii++){
+ PgHdr *pPage = sqlite3PagerLookup(pPager, pg1+ii);
+ if( pPage ){
+ pPage->flags |= PGHDR_NEED_SYNC;
+ sqlite3PagerUnrefNotNull(pPage);
+ }
+ }
+ }
+
+ assert( (pPager->doNotSpill & SPILLFLAG_NOSYNC)!=0 );
+ pPager->doNotSpill &= ~SPILLFLAG_NOSYNC;
+ return rc;
+}
+
+/*
+** Mark a data page as writeable. This routine must be called before
+** making changes to a page. The caller must check the return value
+** of this function and be careful not to change any page data unless
+** this routine returns SQLITE_OK.
+**
+** The difference between this function and pager_write() is that this
+** function also deals with the special case where 2 or more pages
+** fit on a single disk sector. In this case all co-resident pages
+** must have been written to the journal file before returning.
+**
+** If an error occurs, SQLITE_NOMEM or an IO error code is returned
+** as appropriate. Otherwise, SQLITE_OK.
+*/
+SQLITE_PRIVATE int sqlite3PagerWrite(PgHdr *pPg){
+ Pager *pPager = pPg->pPager;
+ assert( (pPg->flags & PGHDR_MMAP)==0 );
+ assert( pPager->eState>=PAGER_WRITER_LOCKED );
+ assert( assert_pager_state(pPager) );
+ if( (pPg->flags & PGHDR_WRITEABLE)!=0 && pPager->dbSize>=pPg->pgno ){
+ if( pPager->nSavepoint ) return subjournalPageIfRequired(pPg);
+ return SQLITE_OK;
+ }else if( pPager->errCode ){
+ return pPager->errCode;
+ }else if( pPager->sectorSize > (u32)pPager->pageSize ){
+ assert( pPager->tempFile==0 );
+ return pagerWriteLargeSector(pPg);
+ }else{
+ return pager_write(pPg);
+ }
+}
+
+/*
+** Return TRUE if the page given in the argument was previously passed
+** to sqlite3PagerWrite(). In other words, return TRUE if it is ok
+** to change the content of the page.
+*/
+#ifndef NDEBUG
+SQLITE_PRIVATE int sqlite3PagerIswriteable(DbPage *pPg){
+ return pPg->flags & PGHDR_WRITEABLE;
+}
+#endif
+
+/*
+** A call to this routine tells the pager that it is not necessary to
+** write the information on page pPg back to the disk, even though
+** that page might be marked as dirty. This happens, for example, when
+** the page has been added as a leaf of the freelist and so its
+** content no longer matters.
+**
+** The overlying software layer calls this routine when all of the data
+** on the given page is unused. The pager marks the page as clean so
+** that it does not get written to disk.
+**
+** Tests show that this optimization can quadruple the speed of large
+** DELETE operations.
+**
+** This optimization cannot be used with a temp-file, as the page may
+** have been dirty at the start of the transaction. In that case, if
+** memory pressure forces page pPg out of the cache, the data does need
+** to be written out to disk so that it may be read back in if the
+** current transaction is rolled back.
+*/
+SQLITE_PRIVATE void sqlite3PagerDontWrite(PgHdr *pPg){
+ Pager *pPager = pPg->pPager;
+ if( !pPager->tempFile && (pPg->flags&PGHDR_DIRTY) && pPager->nSavepoint==0 ){
+ PAGERTRACE(("DONT_WRITE page %d of %d\n", pPg->pgno, PAGERID(pPager)));
+ IOTRACE(("CLEAN %p %d\n", pPager, pPg->pgno))
+ pPg->flags |= PGHDR_DONT_WRITE;
+ pPg->flags &= ~PGHDR_WRITEABLE;
+ testcase( pPg->flags & PGHDR_NEED_SYNC );
+ pager_set_pagehash(pPg);
+ }
+}
+
+/*
+** This routine is called to increment the value of the database file
+** change-counter, stored as a 4-byte big-endian integer starting at
+** byte offset 24 of the pager file. The secondary change counter at
+** 92 is also updated, as is the SQLite version number at offset 96.
+**
+** But this only happens if the pPager->changeCountDone flag is false.
+** To avoid excess churning of page 1, the update only happens once.
+** See also the pager_write_changecounter() routine that does an
+** unconditional update of the change counters.
+**
+** If the isDirectMode flag is zero, then this is done by calling
+** sqlite3PagerWrite() on page 1, then modifying the contents of the
+** page data. In this case the file will be updated when the current
+** transaction is committed.
+**
+** The isDirectMode flag may only be non-zero if the library was compiled
+** with the SQLITE_ENABLE_ATOMIC_WRITE macro defined. In this case,
+** if isDirect is non-zero, then the database file is updated directly
+** by writing an updated version of page 1 using a call to the
+** sqlite3OsWrite() function.
+*/
+static int pager_incr_changecounter(Pager *pPager, int isDirectMode){
+ int rc = SQLITE_OK;
+
+ assert( pPager->eState==PAGER_WRITER_CACHEMOD
+ || pPager->eState==PAGER_WRITER_DBMOD
+ );
+ assert( assert_pager_state(pPager) );
+
+ /* Declare and initialize constant integer 'isDirect'. If the
+ ** atomic-write optimization is enabled in this build, then isDirect
+ ** is initialized to the value passed as the isDirectMode parameter
+ ** to this function. Otherwise, it is always set to zero.
+ **
+ ** The idea is that if the atomic-write optimization is not
+ ** enabled at compile time, the compiler can omit the tests of
+ ** 'isDirect' below, as well as the block enclosed in the
+ ** "if( isDirect )" condition.
+ */
+#ifndef SQLITE_ENABLE_ATOMIC_WRITE
+# define DIRECT_MODE 0
+ assert( isDirectMode==0 );
+ UNUSED_PARAMETER(isDirectMode);
+#else
+# define DIRECT_MODE isDirectMode
+#endif
+
+ if( !pPager->changeCountDone && pPager->dbSize>0 ){
+ PgHdr *pPgHdr; /* Reference to page 1 */
+
+ assert( !pPager->tempFile && isOpen(pPager->fd) );
+
+ /* Open page 1 of the file for writing. */
+ rc = sqlite3PagerGet(pPager, 1, &pPgHdr, 0);
+ assert( pPgHdr==0 || rc==SQLITE_OK );
+
+ /* If page one was fetched successfully, and this function is not
+ ** operating in direct-mode, make page 1 writable. When not in
+ ** direct mode, page 1 is always held in cache and hence the PagerGet()
+ ** above is always successful - hence the ALWAYS on rc==SQLITE_OK.
+ */
+ if( !DIRECT_MODE && ALWAYS(rc==SQLITE_OK) ){
+ rc = sqlite3PagerWrite(pPgHdr);
+ }
+
+ if( rc==SQLITE_OK ){
+ /* Actually do the update of the change counter */
+ pager_write_changecounter(pPgHdr);
+
+ /* If running in direct mode, write the contents of page 1 to the file. */
+ if( DIRECT_MODE ){
+ const void *zBuf;
+ assert( pPager->dbFileSize>0 );
+ zBuf = pPgHdr->pData;
+ if( rc==SQLITE_OK ){
+ rc = sqlite3OsWrite(pPager->fd, zBuf, pPager->pageSize, 0);
+ pPager->aStat[PAGER_STAT_WRITE]++;
+ }
+ if( rc==SQLITE_OK ){
+ /* Update the pager's copy of the change-counter. Otherwise, the
+ ** next time a read transaction is opened the cache will be
+ ** flushed (as the change-counter values will not match). */
+ const void *pCopy = (const void *)&((const char *)zBuf)[24];
+ memcpy(&pPager->dbFileVers, pCopy, sizeof(pPager->dbFileVers));
+ pPager->changeCountDone = 1;
+ }
+ }else{
+ pPager->changeCountDone = 1;
+ }
+ }
+
+ /* Release the page reference. */
+ sqlite3PagerUnref(pPgHdr);
+ }
+ return rc;
+}
+
+/*
+** Sync the database file to disk. This is a no-op for in-memory databases
+** or pages with the Pager.noSync flag set.
+**
+** If successful, or if called on a pager for which it is a no-op, this
+** function returns SQLITE_OK. Otherwise, an IO error code is returned.
+*/
+SQLITE_PRIVATE int sqlite3PagerSync(Pager *pPager, const char *zSuper){
+ int rc = SQLITE_OK;
+ void *pArg = (void*)zSuper;
+ rc = sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_SYNC, pArg);
+ if( rc==SQLITE_NOTFOUND ) rc = SQLITE_OK;
+ if( rc==SQLITE_OK && !pPager->noSync ){
+ assert( !MEMDB );
+ rc = sqlite3OsSync(pPager->fd, pPager->syncFlags);
+ }
+ return rc;
+}
+
+/*
+** This function may only be called while a write-transaction is active in
+** rollback. If the connection is in WAL mode, this call is a no-op.
+** Otherwise, if the connection does not already have an EXCLUSIVE lock on
+** the database file, an attempt is made to obtain one.
+**
+** If the EXCLUSIVE lock is already held or the attempt to obtain it is
+** successful, or the connection is in WAL mode, SQLITE_OK is returned.
+** Otherwise, either SQLITE_BUSY or an SQLITE_IOERR_XXX error code is
+** returned.
+*/
+SQLITE_PRIVATE int sqlite3PagerExclusiveLock(Pager *pPager){
+ int rc = pPager->errCode;
+ assert( assert_pager_state(pPager) );
+ if( rc==SQLITE_OK ){
+ assert( pPager->eState==PAGER_WRITER_CACHEMOD
+ || pPager->eState==PAGER_WRITER_DBMOD
+ || pPager->eState==PAGER_WRITER_LOCKED
+ );
+ assert( assert_pager_state(pPager) );
+ if( 0==pagerUseWal(pPager) ){
+ rc = pager_wait_on_lock(pPager, EXCLUSIVE_LOCK);
+ }
+ }
+ return rc;
+}
+
+/*
+** Sync the database file for the pager pPager. zSuper points to the name
+** of a super-journal file that should be written into the individual
+** journal file. zSuper may be NULL, which is interpreted as no
+** super-journal (a single database transaction).
+**
+** This routine ensures that:
+**
+** * The database file change-counter is updated,
+** * the journal is synced (unless the atomic-write optimization is used),
+** * all dirty pages are written to the database file,
+** * the database file is truncated (if required), and
+** * the database file synced.
+**
+** The only thing that remains to commit the transaction is to finalize
+** (delete, truncate or zero the first part of) the journal file (or
+** delete the super-journal file if specified).
+**
+** Note that if zSuper==NULL, this does not overwrite a previous value
+** passed to an sqlite3PagerCommitPhaseOne() call.
+**
+** If the final parameter - noSync - is true, then the database file itself
+** is not synced. The caller must call sqlite3PagerSync() directly to
+** sync the database file before calling CommitPhaseTwo() to delete the
+** journal file in this case.
+*/
+SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne(
+ Pager *pPager, /* Pager object */
+ const char *zSuper, /* If not NULL, the super-journal name */
+ int noSync /* True to omit the xSync on the db file */
+){
+ int rc = SQLITE_OK; /* Return code */
+
+ assert( pPager->eState==PAGER_WRITER_LOCKED
+ || pPager->eState==PAGER_WRITER_CACHEMOD
+ || pPager->eState==PAGER_WRITER_DBMOD
+ || pPager->eState==PAGER_ERROR
+ );
+ assert( assert_pager_state(pPager) );
+
+ /* If a prior error occurred, report that error again. */
+ if( NEVER(pPager->errCode) ) return pPager->errCode;
+
+ /* Provide the ability to easily simulate an I/O error during testing */
+ if( sqlite3FaultSim(400) ) return SQLITE_IOERR;
+
+ PAGERTRACE(("DATABASE SYNC: File=%s zSuper=%s nSize=%d\n",
+ pPager->zFilename, zSuper, pPager->dbSize));
+
+ /* If no database changes have been made, return early. */
+ if( pPager->eState<PAGER_WRITER_CACHEMOD ) return SQLITE_OK;
+
+ assert( MEMDB==0 || pPager->tempFile );
+ assert( isOpen(pPager->fd) || pPager->tempFile );
+ if( 0==pagerFlushOnCommit(pPager, 1) ){
+ /* If this is an in-memory db, or no pages have been written to, or this
+ ** function has already been called, it is mostly a no-op. However, any
+ ** backup in progress needs to be restarted. */
+ sqlite3BackupRestart(pPager->pBackup);
+ }else{
+ PgHdr *pList;
+ if( pagerUseWal(pPager) ){
+ PgHdr *pPageOne = 0;
+ pList = sqlite3PcacheDirtyList(pPager->pPCache);
+ if( pList==0 ){
+ /* Must have at least one page for the WAL commit flag.
+ ** Ticket [2d1a5c67dfc2363e44f29d9bbd57f] 2011-05-18 */
+ rc = sqlite3PagerGet(pPager, 1, &pPageOne, 0);
+ pList = pPageOne;
+ pList->pDirty = 0;
+ }
+ assert( rc==SQLITE_OK );
+ if( ALWAYS(pList) ){
+ rc = pagerWalFrames(pPager, pList, pPager->dbSize, 1);
+ }
+ sqlite3PagerUnref(pPageOne);
+ if( rc==SQLITE_OK ){
+ sqlite3PcacheCleanAll(pPager->pPCache);
+ }
+ }else{
+ /* The bBatch boolean is true if the batch-atomic-write commit method
+ ** should be used. No rollback journal is created if batch-atomic-write
+ ** is enabled.
+ */
+#ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE
+ sqlite3_file *fd = pPager->fd;
+ int bBatch = zSuper==0 /* An SQLITE_IOCAP_BATCH_ATOMIC commit */
+ && (sqlite3OsDeviceCharacteristics(fd) & SQLITE_IOCAP_BATCH_ATOMIC)
+ && !pPager->noSync
+ && sqlite3JournalIsInMemory(pPager->jfd);
+#else
+# define bBatch 0
+#endif
+
+#ifdef SQLITE_ENABLE_ATOMIC_WRITE
+ /* The following block updates the change-counter. Exactly how it
+ ** does this depends on whether or not the atomic-update optimization
+ ** was enabled at compile time, and if this transaction meets the
+ ** runtime criteria to use the operation:
+ **
+ ** * The file-system supports the atomic-write property for
+ ** blocks of size page-size, and
+ ** * This commit is not part of a multi-file transaction, and
+ ** * Exactly one page has been modified and store in the journal file.
+ **
+ ** If the optimization was not enabled at compile time, then the
+ ** pager_incr_changecounter() function is called to update the change
+ ** counter in 'indirect-mode'. If the optimization is compiled in but
+ ** is not applicable to this transaction, call sqlite3JournalCreate()
+ ** to make sure the journal file has actually been created, then call
+ ** pager_incr_changecounter() to update the change-counter in indirect
+ ** mode.
+ **
+ ** Otherwise, if the optimization is both enabled and applicable,
+ ** then call pager_incr_changecounter() to update the change-counter
+ ** in 'direct' mode. In this case the journal file will never be
+ ** created for this transaction.
+ */
+ if( bBatch==0 ){
+ PgHdr *pPg;
+ assert( isOpen(pPager->jfd)
+ || pPager->journalMode==PAGER_JOURNALMODE_OFF
+ || pPager->journalMode==PAGER_JOURNALMODE_WAL
+ );
+ if( !zSuper && isOpen(pPager->jfd)
+ && pPager->journalOff==jrnlBufferSize(pPager)
+ && pPager->dbSize>=pPager->dbOrigSize
+ && (!(pPg = sqlite3PcacheDirtyList(pPager->pPCache)) || 0==pPg->pDirty)
+ ){
+ /* Update the db file change counter via the direct-write method. The
+ ** following call will modify the in-memory representation of page 1
+ ** to include the updated change counter and then write page 1
+ ** directly to the database file. Because of the atomic-write
+ ** property of the host file-system, this is safe.
+ */
+ rc = pager_incr_changecounter(pPager, 1);
+ }else{
+ rc = sqlite3JournalCreate(pPager->jfd);
+ if( rc==SQLITE_OK ){
+ rc = pager_incr_changecounter(pPager, 0);
+ }
+ }
+ }
+#else /* SQLITE_ENABLE_ATOMIC_WRITE */
+#ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE
+ if( zSuper ){
+ rc = sqlite3JournalCreate(pPager->jfd);
+ if( rc!=SQLITE_OK ) goto commit_phase_one_exit;
+ assert( bBatch==0 );
+ }
+#endif
+ rc = pager_incr_changecounter(pPager, 0);
+#endif /* !SQLITE_ENABLE_ATOMIC_WRITE */
+ if( rc!=SQLITE_OK ) goto commit_phase_one_exit;
+
+ /* Write the super-journal name into the journal file. If a
+ ** super-journal file name has already been written to the journal file,
+ ** or if zSuper is NULL (no super-journal), then this call is a no-op.
+ */
+ rc = writeSuperJournal(pPager, zSuper);
+ if( rc!=SQLITE_OK ) goto commit_phase_one_exit;
+
+ /* Sync the journal file and write all dirty pages to the database.
+ ** If the atomic-update optimization is being used, this sync will not
+ ** create the journal file or perform any real IO.
+ **
+ ** Because the change-counter page was just modified, unless the
+ ** atomic-update optimization is used it is almost certain that the
+ ** journal requires a sync here. However, in locking_mode=exclusive
+ ** on a system under memory pressure it is just possible that this is
+ ** not the case. In this case it is likely enough that the redundant
+ ** xSync() call will be changed to a no-op by the OS anyhow.
+ */
+ rc = syncJournal(pPager, 0);
+ if( rc!=SQLITE_OK ) goto commit_phase_one_exit;
+
+ pList = sqlite3PcacheDirtyList(pPager->pPCache);
+#ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE
+ if( bBatch ){
+ rc = sqlite3OsFileControl(fd, SQLITE_FCNTL_BEGIN_ATOMIC_WRITE, 0);
+ if( rc==SQLITE_OK ){
+ rc = pager_write_pagelist(pPager, pList);
+ if( rc==SQLITE_OK && pPager->dbSize>pPager->dbFileSize ){
+ char *pTmp = pPager->pTmpSpace;
+ int szPage = (int)pPager->pageSize;
+ memset(pTmp, 0, szPage);
+ rc = sqlite3OsWrite(pPager->fd, pTmp, szPage,
+ ((i64)pPager->dbSize*pPager->pageSize)-szPage);
+ }
+ if( rc==SQLITE_OK ){
+ rc = sqlite3OsFileControl(fd, SQLITE_FCNTL_COMMIT_ATOMIC_WRITE, 0);
+ }
+ if( rc!=SQLITE_OK ){
+ sqlite3OsFileControlHint(fd, SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE, 0);
+ }
+ }
+
+ if( (rc&0xFF)==SQLITE_IOERR && rc!=SQLITE_IOERR_NOMEM ){
+ rc = sqlite3JournalCreate(pPager->jfd);
+ if( rc!=SQLITE_OK ){
+ sqlite3OsClose(pPager->jfd);
+ goto commit_phase_one_exit;
+ }
+ bBatch = 0;
+ }else{
+ sqlite3OsClose(pPager->jfd);
+ }
+ }
+#endif /* SQLITE_ENABLE_BATCH_ATOMIC_WRITE */
+
+ if( bBatch==0 ){
+ rc = pager_write_pagelist(pPager, pList);
+ }
+ if( rc!=SQLITE_OK ){
+ assert( rc!=SQLITE_IOERR_BLOCKED );
+ goto commit_phase_one_exit;
+ }
+ sqlite3PcacheCleanAll(pPager->pPCache);
+
+ /* If the file on disk is smaller than the database image, use
+ ** pager_truncate to grow the file here. This can happen if the database
+ ** image was extended as part of the current transaction and then the
+ ** last page in the db image moved to the free-list. In this case the
+ ** last page is never written out to disk, leaving the database file
+ ** undersized. Fix this now if it is the case. */
+ if( pPager->dbSize>pPager->dbFileSize ){
+ Pgno nNew = pPager->dbSize - (pPager->dbSize==PAGER_SJ_PGNO(pPager));
+ assert( pPager->eState==PAGER_WRITER_DBMOD );
+ rc = pager_truncate(pPager, nNew);
+ if( rc!=SQLITE_OK ) goto commit_phase_one_exit;
+ }
+
+ /* Finally, sync the database file. */
+ if( !noSync ){
+ rc = sqlite3PagerSync(pPager, zSuper);
+ }
+ IOTRACE(("DBSYNC %p\n", pPager))
+ }
+ }
+
+commit_phase_one_exit:
+ if( rc==SQLITE_OK && !pagerUseWal(pPager) ){
+ pPager->eState = PAGER_WRITER_FINISHED;
+ }
+ return rc;
+}
+
+
+/*
+** When this function is called, the database file has been completely
+** updated to reflect the changes made by the current transaction and
+** synced to disk. The journal file still exists in the file-system
+** though, and if a failure occurs at this point it will eventually
+** be used as a hot-journal and the current transaction rolled back.
+**
+** This function finalizes the journal file, either by deleting,
+** truncating or partially zeroing it, so that it cannot be used
+** for hot-journal rollback. Once this is done the transaction is
+** irrevocably committed.
+**
+** If an error occurs, an IO error code is returned and the pager
+** moves into the error state. Otherwise, SQLITE_OK is returned.
+*/
+SQLITE_PRIVATE int sqlite3PagerCommitPhaseTwo(Pager *pPager){
+ int rc = SQLITE_OK; /* Return code */
+
+ /* This routine should not be called if a prior error has occurred.
+ ** But if (due to a coding error elsewhere in the system) it does get
+ ** called, just return the same error code without doing anything. */
+ if( NEVER(pPager->errCode) ) return pPager->errCode;
+ pPager->iDataVersion++;
+
+ assert( pPager->eState==PAGER_WRITER_LOCKED
+ || pPager->eState==PAGER_WRITER_FINISHED
+ || (pagerUseWal(pPager) && pPager->eState==PAGER_WRITER_CACHEMOD)
+ );
+ assert( assert_pager_state(pPager) );
+
+ /* An optimization. If the database was not actually modified during
+ ** this transaction, the pager is running in exclusive-mode and is
+ ** using persistent journals, then this function is a no-op.
+ **
+ ** The start of the journal file currently contains a single journal
+ ** header with the nRec field set to 0. If such a journal is used as
+ ** a hot-journal during hot-journal rollback, 0 changes will be made
+ ** to the database file. So there is no need to zero the journal
+ ** header. Since the pager is in exclusive mode, there is no need
+ ** to drop any locks either.
+ */
+ if( pPager->eState==PAGER_WRITER_LOCKED
+ && pPager->exclusiveMode
+ && pPager->journalMode==PAGER_JOURNALMODE_PERSIST
+ ){
+ assert( pPager->journalOff==JOURNAL_HDR_SZ(pPager) || !pPager->journalOff );
+ pPager->eState = PAGER_READER;
+ return SQLITE_OK;
+ }
+
+ PAGERTRACE(("COMMIT %d\n", PAGERID(pPager)));
+ rc = pager_end_transaction(pPager, pPager->setSuper, 1);
+ return pager_error(pPager, rc);
+}
+
+/*
+** If a write transaction is open, then all changes made within the
+** transaction are reverted and the current write-transaction is closed.
+** The pager falls back to PAGER_READER state if successful, or PAGER_ERROR
+** state if an error occurs.
+**
+** If the pager is already in PAGER_ERROR state when this function is called,
+** it returns Pager.errCode immediately. No work is performed in this case.
+**
+** Otherwise, in rollback mode, this function performs two functions:
+**
+** 1) It rolls back the journal file, restoring all database file and
+** in-memory cache pages to the state they were in when the transaction
+** was opened, and
+**
+** 2) It finalizes the journal file, so that it is not used for hot
+** rollback at any point in the future.
+**
+** Finalization of the journal file (task 2) is only performed if the
+** rollback is successful.
+**
+** In WAL mode, all cache-entries containing data modified within the
+** current transaction are either expelled from the cache or reverted to
+** their pre-transaction state by re-reading data from the database or
+** WAL files. The WAL transaction is then closed.
+*/
+SQLITE_PRIVATE int sqlite3PagerRollback(Pager *pPager){
+ int rc = SQLITE_OK; /* Return code */
+ PAGERTRACE(("ROLLBACK %d\n", PAGERID(pPager)));
+
+ /* PagerRollback() is a no-op if called in READER or OPEN state. If
+ ** the pager is already in the ERROR state, the rollback is not
+ ** attempted here. Instead, the error code is returned to the caller.
+ */
+ assert( assert_pager_state(pPager) );
+ if( pPager->eState==PAGER_ERROR ) return pPager->errCode;
+ if( pPager->eState<=PAGER_READER ) return SQLITE_OK;
+
+ if( pagerUseWal(pPager) ){
+ int rc2;
+ rc = sqlite3PagerSavepoint(pPager, SAVEPOINT_ROLLBACK, -1);
+ rc2 = pager_end_transaction(pPager, pPager->setSuper, 0);
+ if( rc==SQLITE_OK ) rc = rc2;
+ }else if( !isOpen(pPager->jfd) || pPager->eState==PAGER_WRITER_LOCKED ){
+ int eState = pPager->eState;
+ rc = pager_end_transaction(pPager, 0, 0);
+ if( !MEMDB && eState>PAGER_WRITER_LOCKED ){
+ /* This can happen using journal_mode=off. Move the pager to the error
+ ** state to indicate that the contents of the cache may not be trusted.
+ ** Any active readers will get SQLITE_ABORT.
+ */
+ pPager->errCode = SQLITE_ABORT;
+ pPager->eState = PAGER_ERROR;
+ setGetterMethod(pPager);
+ return rc;
+ }
+ }else{
+ rc = pager_playback(pPager, 0);
+ }
+
+ assert( pPager->eState==PAGER_READER || rc!=SQLITE_OK );
+ assert( rc==SQLITE_OK || rc==SQLITE_FULL || rc==SQLITE_CORRUPT
+ || rc==SQLITE_NOMEM || (rc&0xFF)==SQLITE_IOERR
+ || rc==SQLITE_CANTOPEN
+ );
+
+ /* If an error occurs during a ROLLBACK, we can no longer trust the pager
+ ** cache. So call pager_error() on the way out to make any error persistent.
+ */
+ return pager_error(pPager, rc);
+}
+
+/*
+** Return TRUE if the database file is opened read-only. Return FALSE
+** if the database is (in theory) writable.
+*/
+SQLITE_PRIVATE u8 sqlite3PagerIsreadonly(Pager *pPager){
+ return pPager->readOnly;
+}
+
+#ifdef SQLITE_DEBUG
+/*
+** Return the sum of the reference counts for all pages held by pPager.
+*/
+SQLITE_PRIVATE int sqlite3PagerRefcount(Pager *pPager){
+ return sqlite3PcacheRefCount(pPager->pPCache);
+}
+#endif
+
+/*
+** Return the approximate number of bytes of memory currently
+** used by the pager and its associated cache.
+*/
+SQLITE_PRIVATE int sqlite3PagerMemUsed(Pager *pPager){
+ int perPageSize = pPager->pageSize + pPager->nExtra
+ + (int)(sizeof(PgHdr) + 5*sizeof(void*));
+ return perPageSize*sqlite3PcachePagecount(pPager->pPCache)
+ + sqlite3MallocSize(pPager)
+ + pPager->pageSize;
+}
+
+/*
+** Return the number of references to the specified page.
+*/
+SQLITE_PRIVATE int sqlite3PagerPageRefcount(DbPage *pPage){
+ return sqlite3PcachePageRefcount(pPage);
+}
+
+#ifdef SQLITE_TEST
+/*
+** This routine is used for testing and analysis only.
+*/
+SQLITE_PRIVATE int *sqlite3PagerStats(Pager *pPager){
+ static int a[11];
+ a[0] = sqlite3PcacheRefCount(pPager->pPCache);
+ a[1] = sqlite3PcachePagecount(pPager->pPCache);
+ a[2] = sqlite3PcacheGetCachesize(pPager->pPCache);
+ a[3] = pPager->eState==PAGER_OPEN ? -1 : (int) pPager->dbSize;
+ a[4] = pPager->eState;
+ a[5] = pPager->errCode;
+ a[6] = (int)pPager->aStat[PAGER_STAT_HIT] & 0x7fffffff;
+ a[7] = (int)pPager->aStat[PAGER_STAT_MISS] & 0x7fffffff;
+ a[8] = 0; /* Used to be pPager->nOvfl */
+ a[9] = pPager->nRead;
+ a[10] = (int)pPager->aStat[PAGER_STAT_WRITE] & 0x7fffffff;
+ return a;
+}
+#endif
+
+/*
+** Parameter eStat must be one of SQLITE_DBSTATUS_CACHE_HIT, _MISS, _WRITE,
+** or _WRITE+1. The SQLITE_DBSTATUS_CACHE_WRITE+1 case is a translation
+** of SQLITE_DBSTATUS_CACHE_SPILL. The _SPILL case is not contiguous because
+** it was added later.
+**
+** Before returning, *pnVal is incremented by the
+** current cache hit or miss count, according to the value of eStat. If the
+** reset parameter is non-zero, the cache hit or miss count is zeroed before
+** returning.
+*/
+SQLITE_PRIVATE void sqlite3PagerCacheStat(Pager *pPager, int eStat, int reset, u64 *pnVal){
+
+ assert( eStat==SQLITE_DBSTATUS_CACHE_HIT
+ || eStat==SQLITE_DBSTATUS_CACHE_MISS
+ || eStat==SQLITE_DBSTATUS_CACHE_WRITE
+ || eStat==SQLITE_DBSTATUS_CACHE_WRITE+1
+ );
+
+ assert( SQLITE_DBSTATUS_CACHE_HIT+1==SQLITE_DBSTATUS_CACHE_MISS );
+ assert( SQLITE_DBSTATUS_CACHE_HIT+2==SQLITE_DBSTATUS_CACHE_WRITE );
+ assert( PAGER_STAT_HIT==0 && PAGER_STAT_MISS==1
+ && PAGER_STAT_WRITE==2 && PAGER_STAT_SPILL==3 );
+
+ eStat -= SQLITE_DBSTATUS_CACHE_HIT;
+ *pnVal += pPager->aStat[eStat];
+ if( reset ){
+ pPager->aStat[eStat] = 0;
+ }
+}
+
+/*
+** Return true if this is an in-memory or temp-file backed pager.
+*/
+SQLITE_PRIVATE int sqlite3PagerIsMemdb(Pager *pPager){
+ return pPager->tempFile || pPager->memVfs;
+}
+
+/*
+** Check that there are at least nSavepoint savepoints open. If there are
+** currently less than nSavepoints open, then open one or more savepoints
+** to make up the difference. If the number of savepoints is already
+** equal to nSavepoint, then this function is a no-op.
+**
+** If a memory allocation fails, SQLITE_NOMEM is returned. If an error
+** occurs while opening the sub-journal file, then an IO error code is
+** returned. Otherwise, SQLITE_OK.
+*/
+static SQLITE_NOINLINE int pagerOpenSavepoint(Pager *pPager, int nSavepoint){
+ int rc = SQLITE_OK; /* Return code */
+ int nCurrent = pPager->nSavepoint; /* Current number of savepoints */
+ int ii; /* Iterator variable */
+ PagerSavepoint *aNew; /* New Pager.aSavepoint array */
+
+ assert( pPager->eState>=PAGER_WRITER_LOCKED );
+ assert( assert_pager_state(pPager) );
+ assert( nSavepoint>nCurrent && pPager->useJournal );
+
+ /* Grow the Pager.aSavepoint array using realloc(). Return SQLITE_NOMEM
+ ** if the allocation fails. Otherwise, zero the new portion in case a
+ ** malloc failure occurs while populating it in the for(...) loop below.
+ */
+ aNew = (PagerSavepoint *)sqlite3Realloc(
+ pPager->aSavepoint, sizeof(PagerSavepoint)*nSavepoint
+ );
+ if( !aNew ){
+ return SQLITE_NOMEM_BKPT;
+ }
+ memset(&aNew[nCurrent], 0, (nSavepoint-nCurrent) * sizeof(PagerSavepoint));
+ pPager->aSavepoint = aNew;
+
+ /* Populate the PagerSavepoint structures just allocated. */
+ for(ii=nCurrent; ii<nSavepoint; ii++){
+ aNew[ii].nOrig = pPager->dbSize;
+ if( isOpen(pPager->jfd) && pPager->journalOff>0 ){
+ aNew[ii].iOffset = pPager->journalOff;
+ }else{
+ aNew[ii].iOffset = JOURNAL_HDR_SZ(pPager);
+ }
+ aNew[ii].iSubRec = pPager->nSubRec;
+ aNew[ii].pInSavepoint = sqlite3BitvecCreate(pPager->dbSize);
+ aNew[ii].bTruncateOnRelease = 1;
+ if( !aNew[ii].pInSavepoint ){
+ return SQLITE_NOMEM_BKPT;
+ }
+ if( pagerUseWal(pPager) ){
+ sqlite3WalSavepoint(pPager->pWal, aNew[ii].aWalData);
+ }
+ pPager->nSavepoint = ii+1;
+ }
+ assert( pPager->nSavepoint==nSavepoint );
+ assertTruncateConstraint(pPager);
+ return rc;
+}
+SQLITE_PRIVATE int sqlite3PagerOpenSavepoint(Pager *pPager, int nSavepoint){
+ assert( pPager->eState>=PAGER_WRITER_LOCKED );
+ assert( assert_pager_state(pPager) );
+
+ if( nSavepoint>pPager->nSavepoint && pPager->useJournal ){
+ return pagerOpenSavepoint(pPager, nSavepoint);
+ }else{
+ return SQLITE_OK;
+ }
+}
+
+
+/*
+** This function is called to rollback or release (commit) a savepoint.
+** The savepoint to release or rollback need not be the most recently
+** created savepoint.
+**
+** Parameter op is always either SAVEPOINT_ROLLBACK or SAVEPOINT_RELEASE.
+** If it is SAVEPOINT_RELEASE, then release and destroy the savepoint with
+** index iSavepoint. If it is SAVEPOINT_ROLLBACK, then rollback all changes
+** that have occurred since the specified savepoint was created.
+**
+** The savepoint to rollback or release is identified by parameter
+** iSavepoint. A value of 0 means to operate on the outermost savepoint
+** (the first created). A value of (Pager.nSavepoint-1) means operate
+** on the most recently created savepoint. If iSavepoint is greater than
+** (Pager.nSavepoint-1), then this function is a no-op.
+**
+** If a negative value is passed to this function, then the current
+** transaction is rolled back. This is different to calling
+** sqlite3PagerRollback() because this function does not terminate
+** the transaction or unlock the database, it just restores the
+** contents of the database to its original state.
+**
+** In any case, all savepoints with an index greater than iSavepoint
+** are destroyed. If this is a release operation (op==SAVEPOINT_RELEASE),
+** then savepoint iSavepoint is also destroyed.
+**
+** This function may return SQLITE_NOMEM if a memory allocation fails,
+** or an IO error code if an IO error occurs while rolling back a
+** savepoint. If no errors occur, SQLITE_OK is returned.
+*/
+SQLITE_PRIVATE int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint){
+ int rc = pPager->errCode;
+
+#ifdef SQLITE_ENABLE_ZIPVFS
+ if( op==SAVEPOINT_RELEASE ) rc = SQLITE_OK;
+#endif
+
+ assert( op==SAVEPOINT_RELEASE || op==SAVEPOINT_ROLLBACK );
+ assert( iSavepoint>=0 || op==SAVEPOINT_ROLLBACK );
+
+ if( rc==SQLITE_OK && iSavepoint<pPager->nSavepoint ){
+ int ii; /* Iterator variable */
+ int nNew; /* Number of remaining savepoints after this op. */
+
+ /* Figure out how many savepoints will still be active after this
+ ** operation. Store this value in nNew. Then free resources associated
+ ** with any savepoints that are destroyed by this operation.
+ */
+ nNew = iSavepoint + (( op==SAVEPOINT_RELEASE ) ? 0 : 1);
+ for(ii=nNew; ii<pPager->nSavepoint; ii++){
+ sqlite3BitvecDestroy(pPager->aSavepoint[ii].pInSavepoint);
+ }
+ pPager->nSavepoint = nNew;
+
+ /* Truncate the sub-journal so that it only includes the parts
+ ** that are still in use. */
+ if( op==SAVEPOINT_RELEASE ){
+ PagerSavepoint *pRel = &pPager->aSavepoint[nNew];
+ if( pRel->bTruncateOnRelease && isOpen(pPager->sjfd) ){
+ /* Only truncate if it is an in-memory sub-journal. */
+ if( sqlite3JournalIsInMemory(pPager->sjfd) ){
+ i64 sz = (pPager->pageSize+4)*(i64)pRel->iSubRec;
+ rc = sqlite3OsTruncate(pPager->sjfd, sz);
+ assert( rc==SQLITE_OK );
+ }
+ pPager->nSubRec = pRel->iSubRec;
+ }
+ }
+ /* Else this is a rollback operation, playback the specified savepoint.
+ ** If this is a temp-file, it is possible that the journal file has
+ ** not yet been opened. In this case there have been no changes to
+ ** the database file, so the playback operation can be skipped.
+ */
+ else if( pagerUseWal(pPager) || isOpen(pPager->jfd) ){
+ PagerSavepoint *pSavepoint = (nNew==0)?0:&pPager->aSavepoint[nNew-1];
+ rc = pagerPlaybackSavepoint(pPager, pSavepoint);
+ assert(rc!=SQLITE_DONE);
+ }
+
+#ifdef SQLITE_ENABLE_ZIPVFS
+ /* If the cache has been modified but the savepoint cannot be rolled
+ ** back journal_mode=off, put the pager in the error state. This way,
+ ** if the VFS used by this pager includes ZipVFS, the entire transaction
+ ** can be rolled back at the ZipVFS level. */
+ else if(
+ pPager->journalMode==PAGER_JOURNALMODE_OFF
+ && pPager->eState>=PAGER_WRITER_CACHEMOD
+ ){
+ pPager->errCode = SQLITE_ABORT;
+ pPager->eState = PAGER_ERROR;
+ setGetterMethod(pPager);
+ }
+#endif
+ }
+
+ return rc;
+}
+
+/*
+** Return the full pathname of the database file.
+**
+** Except, if the pager is in-memory only, then return an empty string if
+** nullIfMemDb is true. This routine is called with nullIfMemDb==1 when
+** used to report the filename to the user, for compatibility with legacy
+** behavior. But when the Btree needs to know the filename for matching to
+** shared cache, it uses nullIfMemDb==0 so that in-memory databases can
+** participate in shared-cache.
+**
+** The return value to this routine is always safe to use with
+** sqlite3_uri_parameter() and sqlite3_filename_database() and friends.
+*/
+SQLITE_PRIVATE const char *sqlite3PagerFilename(const Pager *pPager, int nullIfMemDb){
+ static const char zFake[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+ if( nullIfMemDb && (pPager->memDb || sqlite3IsMemdb(pPager->pVfs)) ){
+ return &zFake[4];
+ }else{
+ return pPager->zFilename;
+ }
+}
+
+/*
+** Return the VFS structure for the pager.
+*/
+SQLITE_PRIVATE sqlite3_vfs *sqlite3PagerVfs(Pager *pPager){
+ return pPager->pVfs;
+}
+
+/*
+** Return the file handle for the database file associated
+** with the pager. This might return NULL if the file has
+** not yet been opened.
+*/
+SQLITE_PRIVATE sqlite3_file *sqlite3PagerFile(Pager *pPager){
+ return pPager->fd;
+}
+
+/*
+** Return the file handle for the journal file (if it exists).
+** This will be either the rollback journal or the WAL file.
+*/
+SQLITE_PRIVATE sqlite3_file *sqlite3PagerJrnlFile(Pager *pPager){
+#ifdef SQLITE_OMIT_WAL
+ return pPager->jfd;
+#else
+ return pPager->pWal ? sqlite3WalFile(pPager->pWal) : pPager->jfd;
+#endif
+}
+
+/*
+** Return the full pathname of the journal file.
+*/
+SQLITE_PRIVATE const char *sqlite3PagerJournalname(Pager *pPager){
+ return pPager->zJournal;
+}
+
+#ifndef SQLITE_OMIT_AUTOVACUUM
+/*
+** Move the page pPg to location pgno in the file.
+**
+** There must be no references to the page previously located at
+** pgno (which we call pPgOld) though that page is allowed to be
+** in cache. If the page previously located at pgno is not already
+** in the rollback journal, it is not put there by by this routine.
+**
+** References to the page pPg remain valid. Updating any
+** meta-data associated with pPg (i.e. data stored in the nExtra bytes
+** allocated along with the page) is the responsibility of the caller.
+**
+** A transaction must be active when this routine is called. It used to be
+** required that a statement transaction was not active, but this restriction
+** has been removed (CREATE INDEX needs to move a page when a statement
+** transaction is active).
+**
+** If the fourth argument, isCommit, is non-zero, then this page is being
+** moved as part of a database reorganization just before the transaction
+** is being committed. In this case, it is guaranteed that the database page
+** pPg refers to will not be written to again within this transaction.
+**
+** This function may return SQLITE_NOMEM or an IO error code if an error
+** occurs. Otherwise, it returns SQLITE_OK.
+*/
+SQLITE_PRIVATE int sqlite3PagerMovepage(Pager *pPager, DbPage *pPg, Pgno pgno, int isCommit){
+ PgHdr *pPgOld; /* The page being overwritten. */
+ Pgno needSyncPgno = 0; /* Old value of pPg->pgno, if sync is required */
+ int rc; /* Return code */
+ Pgno origPgno; /* The original page number */
+
+ assert( pPg->nRef>0 );
+ assert( pPager->eState==PAGER_WRITER_CACHEMOD
+ || pPager->eState==PAGER_WRITER_DBMOD
+ );
+ assert( assert_pager_state(pPager) );
+
+ /* In order to be able to rollback, an in-memory database must journal
+ ** the page we are moving from.
+ */
+ assert( pPager->tempFile || !MEMDB );
+ if( pPager->tempFile ){
+ rc = sqlite3PagerWrite(pPg);
+ if( rc ) return rc;
+ }
+
+ /* If the page being moved is dirty and has not been saved by the latest
+ ** savepoint, then save the current contents of the page into the
+ ** sub-journal now. This is required to handle the following scenario:
+ **
+ ** BEGIN;
+ ** <journal page X, then modify it in memory>
+ ** SAVEPOINT one;
+ ** <Move page X to location Y>
+ ** ROLLBACK TO one;
+ **
+ ** If page X were not written to the sub-journal here, it would not
+ ** be possible to restore its contents when the "ROLLBACK TO one"
+ ** statement were is processed.
+ **
+ ** subjournalPage() may need to allocate space to store pPg->pgno into
+ ** one or more savepoint bitvecs. This is the reason this function
+ ** may return SQLITE_NOMEM.
+ */
+ if( (pPg->flags & PGHDR_DIRTY)!=0
+ && SQLITE_OK!=(rc = subjournalPageIfRequired(pPg))
+ ){
+ return rc;
+ }
+
+ PAGERTRACE(("MOVE %d page %d (needSync=%d) moves to %d\n",
+ PAGERID(pPager), pPg->pgno, (pPg->flags&PGHDR_NEED_SYNC)?1:0, pgno));
+ IOTRACE(("MOVE %p %d %d\n", pPager, pPg->pgno, pgno))
+
+ /* If the journal needs to be sync()ed before page pPg->pgno can
+ ** be written to, store pPg->pgno in local variable needSyncPgno.
+ **
+ ** If the isCommit flag is set, there is no need to remember that
+ ** the journal needs to be sync()ed before database page pPg->pgno
+ ** can be written to. The caller has already promised not to write to it.
+ */
+ if( (pPg->flags&PGHDR_NEED_SYNC) && !isCommit ){
+ needSyncPgno = pPg->pgno;
+ assert( pPager->journalMode==PAGER_JOURNALMODE_OFF ||
+ pageInJournal(pPager, pPg) || pPg->pgno>pPager->dbOrigSize );
+ assert( pPg->flags&PGHDR_DIRTY );
+ }
+
+ /* If the cache contains a page with page-number pgno, remove it
+ ** from its hash chain. Also, if the PGHDR_NEED_SYNC flag was set for
+ ** page pgno before the 'move' operation, it needs to be retained
+ ** for the page moved there.
+ */
+ pPg->flags &= ~PGHDR_NEED_SYNC;
+ pPgOld = sqlite3PagerLookup(pPager, pgno);
+ assert( !pPgOld || pPgOld->nRef==1 || CORRUPT_DB );
+ if( pPgOld ){
+ if( NEVER(pPgOld->nRef>1) ){
+ sqlite3PagerUnrefNotNull(pPgOld);
+ return SQLITE_CORRUPT_BKPT;
+ }
+ pPg->flags |= (pPgOld->flags&PGHDR_NEED_SYNC);
+ if( pPager->tempFile ){
+ /* Do not discard pages from an in-memory database since we might
+ ** need to rollback later. Just move the page out of the way. */
+ sqlite3PcacheMove(pPgOld, pPager->dbSize+1);
+ }else{
+ sqlite3PcacheDrop(pPgOld);
+ }
+ }
+
+ origPgno = pPg->pgno;
+ sqlite3PcacheMove(pPg, pgno);
+ sqlite3PcacheMakeDirty(pPg);
+
+ /* For an in-memory database, make sure the original page continues
+ ** to exist, in case the transaction needs to roll back. Use pPgOld
+ ** as the original page since it has already been allocated.
+ */
+ if( pPager->tempFile && pPgOld ){
+ sqlite3PcacheMove(pPgOld, origPgno);
+ sqlite3PagerUnrefNotNull(pPgOld);
+ }
+
+ if( needSyncPgno ){
+ /* If needSyncPgno is non-zero, then the journal file needs to be
+ ** sync()ed before any data is written to database file page needSyncPgno.
+ ** Currently, no such page exists in the page-cache and the
+ ** "is journaled" bitvec flag has been set. This needs to be remedied by
+ ** loading the page into the pager-cache and setting the PGHDR_NEED_SYNC
+ ** flag.
+ **
+ ** If the attempt to load the page into the page-cache fails, (due
+ ** to a malloc() or IO failure), clear the bit in the pInJournal[]
+ ** array. Otherwise, if the page is loaded and written again in
+ ** this transaction, it may be written to the database file before
+ ** it is synced into the journal file. This way, it may end up in
+ ** the journal file twice, but that is not a problem.
+ */
+ PgHdr *pPgHdr;
+ rc = sqlite3PagerGet(pPager, needSyncPgno, &pPgHdr, 0);
+ if( rc!=SQLITE_OK ){
+ if( needSyncPgno<=pPager->dbOrigSize ){
+ assert( pPager->pTmpSpace!=0 );
+ sqlite3BitvecClear(pPager->pInJournal, needSyncPgno, pPager->pTmpSpace);
+ }
+ return rc;
+ }
+ pPgHdr->flags |= PGHDR_NEED_SYNC;
+ sqlite3PcacheMakeDirty(pPgHdr);
+ sqlite3PagerUnrefNotNull(pPgHdr);
+ }
+
+ return SQLITE_OK;
+}
+#endif
+
+/*
+** The page handle passed as the first argument refers to a dirty page
+** with a page number other than iNew. This function changes the page's
+** page number to iNew and sets the value of the PgHdr.flags field to
+** the value passed as the third parameter.
+*/
+SQLITE_PRIVATE void sqlite3PagerRekey(DbPage *pPg, Pgno iNew, u16 flags){
+ assert( pPg->pgno!=iNew );
+ pPg->flags = flags;
+ sqlite3PcacheMove(pPg, iNew);
+}
+
+/*
+** Return a pointer to the data for the specified page.
+*/
+SQLITE_PRIVATE void *sqlite3PagerGetData(DbPage *pPg){
+ assert( pPg->nRef>0 || pPg->pPager->memDb );
+ return pPg->pData;
+}
+
+/*
+** Return a pointer to the Pager.nExtra bytes of "extra" space
+** allocated along with the specified page.
+*/
+SQLITE_PRIVATE void *sqlite3PagerGetExtra(DbPage *pPg){
+ return pPg->pExtra;
+}
+
+/*
+** Get/set the locking-mode for this pager. Parameter eMode must be one
+** of PAGER_LOCKINGMODE_QUERY, PAGER_LOCKINGMODE_NORMAL or
+** PAGER_LOCKINGMODE_EXCLUSIVE. If the parameter is not _QUERY, then
+** the locking-mode is set to the value specified.
+**
+** The returned value is either PAGER_LOCKINGMODE_NORMAL or
+** PAGER_LOCKINGMODE_EXCLUSIVE, indicating the current (possibly updated)
+** locking-mode.
+*/
+SQLITE_PRIVATE int sqlite3PagerLockingMode(Pager *pPager, int eMode){
+ assert( eMode==PAGER_LOCKINGMODE_QUERY
+ || eMode==PAGER_LOCKINGMODE_NORMAL
+ || eMode==PAGER_LOCKINGMODE_EXCLUSIVE );
+ assert( PAGER_LOCKINGMODE_QUERY<0 );
+ assert( PAGER_LOCKINGMODE_NORMAL>=0 && PAGER_LOCKINGMODE_EXCLUSIVE>=0 );
+ assert( pPager->exclusiveMode || 0==sqlite3WalHeapMemory(pPager->pWal) );
+ if( eMode>=0 && !pPager->tempFile && !sqlite3WalHeapMemory(pPager->pWal) ){
+ pPager->exclusiveMode = (u8)eMode;
+ }
+ return (int)pPager->exclusiveMode;
+}
+
+/*
+** Set the journal-mode for this pager. Parameter eMode must be one of:
+**
+** PAGER_JOURNALMODE_DELETE
+** PAGER_JOURNALMODE_TRUNCATE
+** PAGER_JOURNALMODE_PERSIST
+** PAGER_JOURNALMODE_OFF
+** PAGER_JOURNALMODE_MEMORY
+** PAGER_JOURNALMODE_WAL
+**
+** The journalmode is set to the value specified if the change is allowed.
+** The change may be disallowed for the following reasons:
+**
+** * An in-memory database can only have its journal_mode set to _OFF
+** or _MEMORY.
+**
+** * Temporary databases cannot have _WAL journalmode.
+**
+** The returned indicate the current (possibly updated) journal-mode.
+*/
+SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){
+ u8 eOld = pPager->journalMode; /* Prior journalmode */
+
+ /* The eMode parameter is always valid */
+ assert( eMode==PAGER_JOURNALMODE_DELETE /* 0 */
+ || eMode==PAGER_JOURNALMODE_PERSIST /* 1 */
+ || eMode==PAGER_JOURNALMODE_OFF /* 2 */
+ || eMode==PAGER_JOURNALMODE_TRUNCATE /* 3 */
+ || eMode==PAGER_JOURNALMODE_MEMORY /* 4 */
+ || eMode==PAGER_JOURNALMODE_WAL /* 5 */ );
+
+ /* This routine is only called from the OP_JournalMode opcode, and
+ ** the logic there will never allow a temporary file to be changed
+ ** to WAL mode.
+ */
+ assert( pPager->tempFile==0 || eMode!=PAGER_JOURNALMODE_WAL );
+
+ /* Do allow the journalmode of an in-memory database to be set to
+ ** anything other than MEMORY or OFF
+ */
+ if( MEMDB ){
+ assert( eOld==PAGER_JOURNALMODE_MEMORY || eOld==PAGER_JOURNALMODE_OFF );
+ if( eMode!=PAGER_JOURNALMODE_MEMORY && eMode!=PAGER_JOURNALMODE_OFF ){
+ eMode = eOld;
+ }
+ }
+
+ if( eMode!=eOld ){
+
+ /* Change the journal mode. */
+ assert( pPager->eState!=PAGER_ERROR );
+ pPager->journalMode = (u8)eMode;
+
+ /* When transitioning from TRUNCATE or PERSIST to any other journal
+ ** mode except WAL, unless the pager is in locking_mode=exclusive mode,
+ ** delete the journal file.
+ */
+ assert( (PAGER_JOURNALMODE_TRUNCATE & 5)==1 );
+ assert( (PAGER_JOURNALMODE_PERSIST & 5)==1 );
+ assert( (PAGER_JOURNALMODE_DELETE & 5)==0 );
+ assert( (PAGER_JOURNALMODE_MEMORY & 5)==4 );
+ assert( (PAGER_JOURNALMODE_OFF & 5)==0 );
+ assert( (PAGER_JOURNALMODE_WAL & 5)==5 );
+
+ assert( isOpen(pPager->fd) || pPager->exclusiveMode );
+ if( !pPager->exclusiveMode && (eOld & 5)==1 && (eMode & 1)==0 ){
+ /* In this case we would like to delete the journal file. If it is
+ ** not possible, then that is not a problem. Deleting the journal file
+ ** here is an optimization only.
+ **
+ ** Before deleting the journal file, obtain a RESERVED lock on the
+ ** database file. This ensures that the journal file is not deleted
+ ** while it is in use by some other client.
+ */
+ sqlite3OsClose(pPager->jfd);
+ if( pPager->eLock>=RESERVED_LOCK ){
+ sqlite3OsDelete(pPager->pVfs, pPager->zJournal, 0);
+ }else{
+ int rc = SQLITE_OK;
+ int state = pPager->eState;
+ assert( state==PAGER_OPEN || state==PAGER_READER );
+ if( state==PAGER_OPEN ){
+ rc = sqlite3PagerSharedLock(pPager);
+ }
+ if( pPager->eState==PAGER_READER ){
+ assert( rc==SQLITE_OK );
+ rc = pagerLockDb(pPager, RESERVED_LOCK);
+ }
+ if( rc==SQLITE_OK ){
+ sqlite3OsDelete(pPager->pVfs, pPager->zJournal, 0);
+ }
+ if( rc==SQLITE_OK && state==PAGER_READER ){
+ pagerUnlockDb(pPager, SHARED_LOCK);
+ }else if( state==PAGER_OPEN ){
+ pager_unlock(pPager);
+ }
+ assert( state==pPager->eState );
+ }
+ }else if( eMode==PAGER_JOURNALMODE_OFF || eMode==PAGER_JOURNALMODE_MEMORY ){
+ sqlite3OsClose(pPager->jfd);
+ }
+ }
+
+ /* Return the new journal mode */
+ return (int)pPager->journalMode;
+}
+
+/*
+** Return the current journal mode.
+*/
+SQLITE_PRIVATE int sqlite3PagerGetJournalMode(Pager *pPager){
+ return (int)pPager->journalMode;
+}
+
+/*
+** Return TRUE if the pager is in a state where it is OK to change the
+** journalmode. Journalmode changes can only happen when the database
+** is unmodified.
+*/
+SQLITE_PRIVATE int sqlite3PagerOkToChangeJournalMode(Pager *pPager){
+ assert( assert_pager_state(pPager) );
+ if( pPager->eState>=PAGER_WRITER_CACHEMOD ) return 0;
+ if( NEVER(isOpen(pPager->jfd) && pPager->journalOff>0) ) return 0;
+ return 1;
+}
+
+/*
+** Get/set the size-limit used for persistent journal files.
+**
+** Setting the size limit to -1 means no limit is enforced.
+** An attempt to set a limit smaller than -1 is a no-op.
+*/
+SQLITE_PRIVATE i64 sqlite3PagerJournalSizeLimit(Pager *pPager, i64 iLimit){
+ if( iLimit>=-1 ){
+ pPager->journalSizeLimit = iLimit;
+ sqlite3WalLimit(pPager->pWal, iLimit);
+ }
+ return pPager->journalSizeLimit;
+}
+
+/*
+** Return a pointer to the pPager->pBackup variable. The backup module
+** in backup.c maintains the content of this variable. This module
+** uses it opaquely as an argument to sqlite3BackupRestart() and
+** sqlite3BackupUpdate() only.
+*/
+SQLITE_PRIVATE sqlite3_backup **sqlite3PagerBackupPtr(Pager *pPager){
+ return &pPager->pBackup;
+}
+
+#ifndef SQLITE_OMIT_VACUUM
+/*
+** Unless this is an in-memory or temporary database, clear the pager cache.
+*/
+SQLITE_PRIVATE void sqlite3PagerClearCache(Pager *pPager){
+ assert( MEMDB==0 || pPager->tempFile );
+ if( pPager->tempFile==0 ) pager_reset(pPager);
+}
+#endif
+
+
+#ifndef SQLITE_OMIT_WAL
+/*
+** This function is called when the user invokes "PRAGMA wal_checkpoint",
+** "PRAGMA wal_blocking_checkpoint" or calls the sqlite3_wal_checkpoint()
+** or wal_blocking_checkpoint() API functions.
+**
+** Parameter eMode is one of SQLITE_CHECKPOINT_PASSIVE, FULL or RESTART.
+*/
+SQLITE_PRIVATE int sqlite3PagerCheckpoint(
+ Pager *pPager, /* Checkpoint on this pager */
+ sqlite3 *db, /* Db handle used to check for interrupts */
+ int eMode, /* Type of checkpoint */
+ int *pnLog, /* OUT: Final number of frames in log */
+ int *pnCkpt /* OUT: Final number of checkpointed frames */
+){
+ int rc = SQLITE_OK;
+ if( pPager->pWal==0 && pPager->journalMode==PAGER_JOURNALMODE_WAL ){
+ /* This only happens when a database file is zero bytes in size opened and
+ ** then "PRAGMA journal_mode=WAL" is run and then sqlite3_wal_checkpoint()
+ ** is invoked without any intervening transactions. We need to start
+ ** a transaction to initialize pWal. The PRAGMA table_list statement is
+ ** used for this since it starts transactions on every database file,
+ ** including all ATTACHed databases. This seems expensive for a single
+ ** sqlite3_wal_checkpoint() call, but it happens very rarely.
+ ** https://sqlite.org/forum/forumpost/fd0f19d229156939
+ */
+ sqlite3_exec(db, "PRAGMA table_list",0,0,0);
+ }
+ if( pPager->pWal ){
+ rc = sqlite3WalCheckpoint(pPager->pWal, db, eMode,
+ (eMode==SQLITE_CHECKPOINT_PASSIVE ? 0 : pPager->xBusyHandler),
+ pPager->pBusyHandlerArg,
+ pPager->walSyncFlags, pPager->pageSize, (u8 *)pPager->pTmpSpace,
+ pnLog, pnCkpt
+ );
+ }
+ return rc;
+}
+
+SQLITE_PRIVATE int sqlite3PagerWalCallback(Pager *pPager){
+ return sqlite3WalCallback(pPager->pWal);
+}
+
+/*
+** Return true if the underlying VFS for the given pager supports the
+** primitives necessary for write-ahead logging.
+*/
+SQLITE_PRIVATE int sqlite3PagerWalSupported(Pager *pPager){
+ const sqlite3_io_methods *pMethods = pPager->fd->pMethods;
+ if( pPager->noLock ) return 0;
+ return pPager->exclusiveMode || (pMethods->iVersion>=2 && pMethods->xShmMap);
+}
+
+/*
+** Attempt to take an exclusive lock on the database file. If a PENDING lock
+** is obtained instead, immediately release it.
+*/
+static int pagerExclusiveLock(Pager *pPager){
+ int rc; /* Return code */
+ u8 eOrigLock; /* Original lock */
+
+ assert( pPager->eLock>=SHARED_LOCK );
+ eOrigLock = pPager->eLock;
+ rc = pagerLockDb(pPager, EXCLUSIVE_LOCK);
+ if( rc!=SQLITE_OK ){
+ /* If the attempt to grab the exclusive lock failed, release the
+ ** pending lock that may have been obtained instead. */
+ pagerUnlockDb(pPager, eOrigLock);
+ }
+
+ return rc;
+}
+
+/*
+** Call sqlite3WalOpen() to open the WAL handle. If the pager is in
+** exclusive-locking mode when this function is called, take an EXCLUSIVE
+** lock on the database file and use heap-memory to store the wal-index
+** in. Otherwise, use the normal shared-memory.
+*/
+static int pagerOpenWal(Pager *pPager){
+ int rc = SQLITE_OK;
+
+ assert( pPager->pWal==0 && pPager->tempFile==0 );
+ assert( pPager->eLock==SHARED_LOCK || pPager->eLock==EXCLUSIVE_LOCK );
+
+ /* If the pager is already in exclusive-mode, the WAL module will use
+ ** heap-memory for the wal-index instead of the VFS shared-memory
+ ** implementation. Take the exclusive lock now, before opening the WAL
+ ** file, to make sure this is safe.
+ */
+ if( pPager->exclusiveMode ){
+ rc = pagerExclusiveLock(pPager);
+ }
+
+ /* Open the connection to the log file. If this operation fails,
+ ** (e.g. due to malloc() failure), return an error code.
+ */
+ if( rc==SQLITE_OK ){
+ rc = sqlite3WalOpen(pPager->pVfs,
+ pPager->fd, pPager->zWal, pPager->exclusiveMode,
+ pPager->journalSizeLimit, &pPager->pWal
+ );
+ }
+ pagerFixMaplimit(pPager);
+
+ return rc;
+}
+
+
+/*
+** The caller must be holding a SHARED lock on the database file to call
+** this function.
+**
+** If the pager passed as the first argument is open on a real database
+** file (not a temp file or an in-memory database), and the WAL file
+** is not already open, make an attempt to open it now. If successful,
+** return SQLITE_OK. If an error occurs or the VFS used by the pager does
+** not support the xShmXXX() methods, return an error code. *pbOpen is
+** not modified in either case.
+**
+** If the pager is open on a temp-file (or in-memory database), or if
+** the WAL file is already open, set *pbOpen to 1 and return SQLITE_OK
+** without doing anything.
+*/
+SQLITE_PRIVATE int sqlite3PagerOpenWal(
+ Pager *pPager, /* Pager object */
+ int *pbOpen /* OUT: Set to true if call is a no-op */
+){
+ int rc = SQLITE_OK; /* Return code */
+
+ assert( assert_pager_state(pPager) );
+ assert( pPager->eState==PAGER_OPEN || pbOpen );
+ assert( pPager->eState==PAGER_READER || !pbOpen );
+ assert( pbOpen==0 || *pbOpen==0 );
+ assert( pbOpen!=0 || (!pPager->tempFile && !pPager->pWal) );
+
+ if( !pPager->tempFile && !pPager->pWal ){
+ if( !sqlite3PagerWalSupported(pPager) ) return SQLITE_CANTOPEN;
+
+ /* Close any rollback journal previously open */
+ sqlite3OsClose(pPager->jfd);
+
+ rc = pagerOpenWal(pPager);
+ if( rc==SQLITE_OK ){
+ pPager->journalMode = PAGER_JOURNALMODE_WAL;
+ pPager->eState = PAGER_OPEN;
+ }
+ }else{
+ *pbOpen = 1;
+ }
+
+ return rc;
+}
+
+/*
+** This function is called to close the connection to the log file prior
+** to switching from WAL to rollback mode.
+**
+** Before closing the log file, this function attempts to take an
+** EXCLUSIVE lock on the database file. If this cannot be obtained, an
+** error (SQLITE_BUSY) is returned and the log connection is not closed.
+** If successful, the EXCLUSIVE lock is not released before returning.
+*/
+SQLITE_PRIVATE int sqlite3PagerCloseWal(Pager *pPager, sqlite3 *db){
+ int rc = SQLITE_OK;
+
+ assert( pPager->journalMode==PAGER_JOURNALMODE_WAL );
+
+ /* If the log file is not already open, but does exist in the file-system,
+ ** it may need to be checkpointed before the connection can switch to
+ ** rollback mode. Open it now so this can happen.
+ */
+ if( !pPager->pWal ){
+ int logexists = 0;
+ rc = pagerLockDb(pPager, SHARED_LOCK);
+ if( rc==SQLITE_OK ){
+ rc = sqlite3OsAccess(
+ pPager->pVfs, pPager->zWal, SQLITE_ACCESS_EXISTS, &logexists
+ );
+ }
+ if( rc==SQLITE_OK && logexists ){
+ rc = pagerOpenWal(pPager);
+ }
+ }
+
+ /* Checkpoint and close the log. Because an EXCLUSIVE lock is held on
+ ** the database file, the log and log-summary files will be deleted.
+ */
+ if( rc==SQLITE_OK && pPager->pWal ){
+ rc = pagerExclusiveLock(pPager);
+ if( rc==SQLITE_OK ){
+ rc = sqlite3WalClose(pPager->pWal, db, pPager->walSyncFlags,
+ pPager->pageSize, (u8*)pPager->pTmpSpace);
+ pPager->pWal = 0;
+ pagerFixMaplimit(pPager);
+ if( rc && !pPager->exclusiveMode ) pagerUnlockDb(pPager, SHARED_LOCK);
+ }
+ }
+ return rc;
+}
+
+#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
+/*
+** If pager pPager is a wal-mode database not in exclusive locking mode,
+** invoke the sqlite3WalWriteLock() function on the associated Wal object
+** with the same db and bLock parameters as were passed to this function.
+** Return an SQLite error code if an error occurs, or SQLITE_OK otherwise.
+*/
+SQLITE_PRIVATE int sqlite3PagerWalWriteLock(Pager *pPager, int bLock){
+ int rc = SQLITE_OK;
+ if( pagerUseWal(pPager) && pPager->exclusiveMode==0 ){
+ rc = sqlite3WalWriteLock(pPager->pWal, bLock);
+ }
+ return rc;
+}
+
+/*
+** Set the database handle used by the wal layer to determine if
+** blocking locks are required.
+*/
+SQLITE_PRIVATE void sqlite3PagerWalDb(Pager *pPager, sqlite3 *db){
+ if( pagerUseWal(pPager) ){
+ sqlite3WalDb(pPager->pWal, db);
+ }
+}
+#endif
+
+#ifdef SQLITE_ENABLE_SNAPSHOT
+/*
+** If this is a WAL database, obtain a snapshot handle for the snapshot
+** currently open. Otherwise, return an error.
+*/
+SQLITE_PRIVATE int sqlite3PagerSnapshotGet(Pager *pPager, sqlite3_snapshot **ppSnapshot){
+ int rc = SQLITE_ERROR;
+ if( pPager->pWal ){
+ rc = sqlite3WalSnapshotGet(pPager->pWal, ppSnapshot);
+ }
+ return rc;
+}
+
+/*
+** If this is a WAL database, store a pointer to pSnapshot. Next time a
+** read transaction is opened, attempt to read from the snapshot it
+** identifies. If this is not a WAL database, return an error.
+*/
+SQLITE_PRIVATE int sqlite3PagerSnapshotOpen(
+ Pager *pPager,
+ sqlite3_snapshot *pSnapshot
+){
+ int rc = SQLITE_OK;
+ if( pPager->pWal ){
+ sqlite3WalSnapshotOpen(pPager->pWal, pSnapshot);
+ }else{
+ rc = SQLITE_ERROR;
+ }
+ return rc;
+}
+
+/*
+** If this is a WAL database, call sqlite3WalSnapshotRecover(). If this
+** is not a WAL database, return an error.
+*/
+SQLITE_PRIVATE int sqlite3PagerSnapshotRecover(Pager *pPager){
+ int rc;
+ if( pPager->pWal ){
+ rc = sqlite3WalSnapshotRecover(pPager->pWal);
+ }else{
+ rc = SQLITE_ERROR;
+ }
+ return rc;
+}
+
+/*
+** The caller currently has a read transaction open on the database.
+** If this is not a WAL database, SQLITE_ERROR is returned. Otherwise,
+** this function takes a SHARED lock on the CHECKPOINTER slot and then
+** checks if the snapshot passed as the second argument is still
+** available. If so, SQLITE_OK is returned.
+**
+** If the snapshot is not available, SQLITE_ERROR is returned. Or, if
+** the CHECKPOINTER lock cannot be obtained, SQLITE_BUSY. If any error
+** occurs (any value other than SQLITE_OK is returned), the CHECKPOINTER
+** lock is released before returning.
+*/
+SQLITE_PRIVATE int sqlite3PagerSnapshotCheck(Pager *pPager, sqlite3_snapshot *pSnapshot){
+ int rc;
+ if( pPager->pWal ){
+ rc = sqlite3WalSnapshotCheck(pPager->pWal, pSnapshot);
+ }else{
+ rc = SQLITE_ERROR;
+ }
+ return rc;
+}
+
+/*
+** Release a lock obtained by an earlier successful call to
+** sqlite3PagerSnapshotCheck().
+*/
+SQLITE_PRIVATE void sqlite3PagerSnapshotUnlock(Pager *pPager){
+ assert( pPager->pWal );
+ sqlite3WalSnapshotUnlock(pPager->pWal);
+}
+
+#endif /* SQLITE_ENABLE_SNAPSHOT */
+#endif /* !SQLITE_OMIT_WAL */
+
+#ifdef SQLITE_ENABLE_ZIPVFS
+/*
+** A read-lock must be held on the pager when this function is called. If
+** the pager is in WAL mode and the WAL file currently contains one or more
+** frames, return the size in bytes of the page images stored within the
+** WAL frames. Otherwise, if this is not a WAL database or the WAL file
+** is empty, return 0.
+*/
+SQLITE_PRIVATE int sqlite3PagerWalFramesize(Pager *pPager){
+ assert( pPager->eState>=PAGER_READER );
+ return sqlite3WalFramesize(pPager->pWal);
+}
+#endif
+
+#if defined(SQLITE_USE_SEH) && !defined(SQLITE_OMIT_WAL)
+SQLITE_PRIVATE int sqlite3PagerWalSystemErrno(Pager *pPager){
+ return sqlite3WalSystemErrno(pPager->pWal);
+}
+#endif
+
+#endif /* SQLITE_OMIT_DISKIO */
+
+/************** End of pager.c ***********************************************/
+/************** Begin file wal.c *********************************************/
+/*
+** 2010 February 1
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+**
+** This file contains the implementation of a write-ahead log (WAL) used in
+** "journal_mode=WAL" mode.
+**
+** WRITE-AHEAD LOG (WAL) FILE FORMAT
+**
+** A WAL file consists of a header followed by zero or more "frames".
+** Each frame records the revised content of a single page from the
+** database file. All changes to the database are recorded by writing
+** frames into the WAL. Transactions commit when a frame is written that
+** contains a commit marker. A single WAL can and usually does record
+** multiple transactions. Periodically, the content of the WAL is
+** transferred back into the database file in an operation called a
+** "checkpoint".
+**
+** A single WAL file can be used multiple times. In other words, the
+** WAL can fill up with frames and then be checkpointed and then new
+** frames can overwrite the old ones. A WAL always grows from beginning
+** toward the end. Checksums and counters attached to each frame are
+** used to determine which frames within the WAL are valid and which
+** are leftovers from prior checkpoints.
+**
+** The WAL header is 32 bytes in size and consists of the following eight
+** big-endian 32-bit unsigned integer values:
+**
+** 0: Magic number. 0x377f0682 or 0x377f0683
+** 4: File format version. Currently 3007000
+** 8: Database page size. Example: 1024
+** 12: Checkpoint sequence number
+** 16: Salt-1, random integer incremented with each checkpoint
+** 20: Salt-2, a different random integer changing with each ckpt
+** 24: Checksum-1 (first part of checksum for first 24 bytes of header).
+** 28: Checksum-2 (second part of checksum for first 24 bytes of header).
+**
+** Immediately following the wal-header are zero or more frames. Each
+** frame consists of a 24-byte frame-header followed by <page-size> bytes
+** of page data. The frame-header is six big-endian 32-bit unsigned
+** integer values, as follows:
+**
+** 0: Page number.
+** 4: For commit records, the size of the database image in pages
+** after the commit. For all other records, zero.
+** 8: Salt-1 (copied from the header)
+** 12: Salt-2 (copied from the header)
+** 16: Checksum-1.
+** 20: Checksum-2.
+**
+** A frame is considered valid if and only if the following conditions are
+** true:
+**
+** (1) The salt-1 and salt-2 values in the frame-header match
+** salt values in the wal-header
+**
+** (2) The checksum values in the final 8 bytes of the frame-header
+** exactly match the checksum computed consecutively on the
+** WAL header and the first 8 bytes and the content of all frames
+** up to and including the current frame.
+**
+** The checksum is computed using 32-bit big-endian integers if the
+** magic number in the first 4 bytes of the WAL is 0x377f0683 and it
+** is computed using little-endian if the magic number is 0x377f0682.
+** The checksum values are always stored in the frame header in a
+** big-endian format regardless of which byte order is used to compute
+** the checksum. The checksum is computed by interpreting the input as
+** an even number of unsigned 32-bit integers: x[0] through x[N]. The
+** algorithm used for the checksum is as follows:
+**
+** for i from 0 to n-1 step 2:
+** s0 += x[i] + s1;
+** s1 += x[i+1] + s0;
+** endfor
+**
+** Note that s0 and s1 are both weighted checksums using fibonacci weights
+** in reverse order (the largest fibonacci weight occurs on the first element
+** of the sequence being summed.) The s1 value spans all 32-bit
+** terms of the sequence whereas s0 omits the final term.
+**
+** On a checkpoint, the WAL is first VFS.xSync-ed, then valid content of the
+** WAL is transferred into the database, then the database is VFS.xSync-ed.
+** The VFS.xSync operations serve as write barriers - all writes launched
+** before the xSync must complete before any write that launches after the
+** xSync begins.
+**
+** After each checkpoint, the salt-1 value is incremented and the salt-2
+** value is randomized. This prevents old and new frames in the WAL from
+** being considered valid at the same time and being checkpointing together
+** following a crash.
+**
+** READER ALGORITHM
+**
+** To read a page from the database (call it page number P), a reader
+** first checks the WAL to see if it contains page P. If so, then the
+** last valid instance of page P that is a followed by a commit frame
+** or is a commit frame itself becomes the value read. If the WAL
+** contains no copies of page P that are valid and which are a commit
+** frame or are followed by a commit frame, then page P is read from
+** the database file.
+**
+** To start a read transaction, the reader records the index of the last
+** valid frame in the WAL. The reader uses this recorded "mxFrame" value
+** for all subsequent read operations. New transactions can be appended
+** to the WAL, but as long as the reader uses its original mxFrame value
+** and ignores the newly appended content, it will see a consistent snapshot
+** of the database from a single point in time. This technique allows
+** multiple concurrent readers to view different versions of the database
+** content simultaneously.
+**
+** The reader algorithm in the previous paragraphs works correctly, but
+** because frames for page P can appear anywhere within the WAL, the
+** reader has to scan the entire WAL looking for page P frames. If the
+** WAL is large (multiple megabytes is typical) that scan can be slow,
+** and read performance suffers. To overcome this problem, a separate
+** data structure called the wal-index is maintained to expedite the
+** search for frames of a particular page.
+**
+** WAL-INDEX FORMAT
+**
+** Conceptually, the wal-index is shared memory, though VFS implementations
+** might choose to implement the wal-index using a mmapped file. Because
+** the wal-index is shared memory, SQLite does not support journal_mode=WAL
+** on a network filesystem. All users of the database must be able to
+** share memory.
+**
+** In the default unix and windows implementation, the wal-index is a mmapped
+** file whose name is the database name with a "-shm" suffix added. For that
+** reason, the wal-index is sometimes called the "shm" file.
+**
+** The wal-index is transient. After a crash, the wal-index can (and should
+** be) reconstructed from the original WAL file. In fact, the VFS is required
+** to either truncate or zero the header of the wal-index when the last
+** connection to it closes. Because the wal-index is transient, it can
+** use an architecture-specific format; it does not have to be cross-platform.
+** Hence, unlike the database and WAL file formats which store all values
+** as big endian, the wal-index can store multi-byte values in the native
+** byte order of the host computer.
+**
+** The purpose of the wal-index is to answer this question quickly: Given
+** a page number P and a maximum frame index M, return the index of the
+** last frame in the wal before frame M for page P in the WAL, or return
+** NULL if there are no frames for page P in the WAL prior to M.
+**
+** The wal-index consists of a header region, followed by an one or
+** more index blocks.
+**
+** The wal-index header contains the total number of frames within the WAL
+** in the mxFrame field.
+**
+** Each index block except for the first contains information on
+** HASHTABLE_NPAGE frames. The first index block contains information on
+** HASHTABLE_NPAGE_ONE frames. The values of HASHTABLE_NPAGE_ONE and
+** HASHTABLE_NPAGE are selected so that together the wal-index header and
+** first index block are the same size as all other index blocks in the
+** wal-index. The values are:
+**
+** HASHTABLE_NPAGE 4096
+** HASHTABLE_NPAGE_ONE 4062
+**
+** Each index block contains two sections, a page-mapping that contains the
+** database page number associated with each wal frame, and a hash-table
+** that allows readers to query an index block for a specific page number.
+** The page-mapping is an array of HASHTABLE_NPAGE (or HASHTABLE_NPAGE_ONE
+** for the first index block) 32-bit page numbers. The first entry in the
+** first index-block contains the database page number corresponding to the
+** first frame in the WAL file. The first entry in the second index block
+** in the WAL file corresponds to the (HASHTABLE_NPAGE_ONE+1)th frame in
+** the log, and so on.
+**
+** The last index block in a wal-index usually contains less than the full
+** complement of HASHTABLE_NPAGE (or HASHTABLE_NPAGE_ONE) page-numbers,
+** depending on the contents of the WAL file. This does not change the
+** allocated size of the page-mapping array - the page-mapping array merely
+** contains unused entries.
+**
+** Even without using the hash table, the last frame for page P
+** can be found by scanning the page-mapping sections of each index block
+** starting with the last index block and moving toward the first, and
+** within each index block, starting at the end and moving toward the
+** beginning. The first entry that equals P corresponds to the frame
+** holding the content for that page.
+**
+** The hash table consists of HASHTABLE_NSLOT 16-bit unsigned integers.
+** HASHTABLE_NSLOT = 2*HASHTABLE_NPAGE, and there is one entry in the
+** hash table for each page number in the mapping section, so the hash
+** table is never more than half full. The expected number of collisions
+** prior to finding a match is 1. Each entry of the hash table is an
+** 1-based index of an entry in the mapping section of the same
+** index block. Let K be the 1-based index of the largest entry in
+** the mapping section. (For index blocks other than the last, K will
+** always be exactly HASHTABLE_NPAGE (4096) and for the last index block
+** K will be (mxFrame%HASHTABLE_NPAGE).) Unused slots of the hash table
+** contain a value of 0.
+**
+** To look for page P in the hash table, first compute a hash iKey on
+** P as follows:
+**
+** iKey = (P * 383) % HASHTABLE_NSLOT
+**
+** Then start scanning entries of the hash table, starting with iKey
+** (wrapping around to the beginning when the end of the hash table is
+** reached) until an unused hash slot is found. Let the first unused slot
+** be at index iUnused. (iUnused might be less than iKey if there was
+** wrap-around.) Because the hash table is never more than half full,
+** the search is guaranteed to eventually hit an unused entry. Let
+** iMax be the value between iKey and iUnused, closest to iUnused,
+** where aHash[iMax]==P. If there is no iMax entry (if there exists
+** no hash slot such that aHash[i]==p) then page P is not in the
+** current index block. Otherwise the iMax-th mapping entry of the
+** current index block corresponds to the last entry that references
+** page P.
+**
+** A hash search begins with the last index block and moves toward the
+** first index block, looking for entries corresponding to page P. On
+** average, only two or three slots in each index block need to be
+** examined in order to either find the last entry for page P, or to
+** establish that no such entry exists in the block. Each index block
+** holds over 4000 entries. So two or three index blocks are sufficient
+** to cover a typical 10 megabyte WAL file, assuming 1K pages. 8 or 10
+** comparisons (on average) suffice to either locate a frame in the
+** WAL or to establish that the frame does not exist in the WAL. This
+** is much faster than scanning the entire 10MB WAL.
+**
+** Note that entries are added in order of increasing K. Hence, one
+** reader might be using some value K0 and a second reader that started
+** at a later time (after additional transactions were added to the WAL
+** and to the wal-index) might be using a different value K1, where K1>K0.
+** Both readers can use the same hash table and mapping section to get
+** the correct result. There may be entries in the hash table with
+** K>K0 but to the first reader, those entries will appear to be unused
+** slots in the hash table and so the first reader will get an answer as
+** if no values greater than K0 had ever been inserted into the hash table
+** in the first place - which is what reader one wants. Meanwhile, the
+** second reader using K1 will see additional values that were inserted
+** later, which is exactly what reader two wants.
+**
+** When a rollback occurs, the value of K is decreased. Hash table entries
+** that correspond to frames greater than the new K value are removed
+** from the hash table at this point.
+*/
+#ifndef SQLITE_OMIT_WAL
+
+/* #include "wal.h" */
+
+/*
+** Trace output macros
+*/
+#if defined(SQLITE_TEST) && defined(SQLITE_DEBUG)
+SQLITE_PRIVATE int sqlite3WalTrace = 0;
+# define WALTRACE(X) if(sqlite3WalTrace) sqlite3DebugPrintf X
+#else
+# define WALTRACE(X)
+#endif
+
+/*
+** The maximum (and only) versions of the wal and wal-index formats
+** that may be interpreted by this version of SQLite.
+**
+** If a client begins recovering a WAL file and finds that (a) the checksum
+** values in the wal-header are correct and (b) the version field is not
+** WAL_MAX_VERSION, recovery fails and SQLite returns SQLITE_CANTOPEN.
+**
+** Similarly, if a client successfully reads a wal-index header (i.e. the
+** checksum test is successful) and finds that the version field is not
+** WALINDEX_MAX_VERSION, then no read-transaction is opened and SQLite
+** returns SQLITE_CANTOPEN.
+*/
+#define WAL_MAX_VERSION 3007000
+#define WALINDEX_MAX_VERSION 3007000
+
+/*
+** Index numbers for various locking bytes. WAL_NREADER is the number
+** of available reader locks and should be at least 3. The default
+** is SQLITE_SHM_NLOCK==8 and WAL_NREADER==5.
+**
+** Technically, the various VFSes are free to implement these locks however
+** they see fit. However, compatibility is encouraged so that VFSes can
+** interoperate. The standard implementation used on both unix and windows
+** is for the index number to indicate a byte offset into the
+** WalCkptInfo.aLock[] array in the wal-index header. In other words, all
+** locks are on the shm file. The WALINDEX_LOCK_OFFSET constant (which
+** should be 120) is the location in the shm file for the first locking
+** byte.
+*/
+#define WAL_WRITE_LOCK 0
+#define WAL_ALL_BUT_WRITE 1
+#define WAL_CKPT_LOCK 1
+#define WAL_RECOVER_LOCK 2
+#define WAL_READ_LOCK(I) (3+(I))
+#define WAL_NREADER (SQLITE_SHM_NLOCK-3)
+
+
+/* Object declarations */
+typedef struct WalIndexHdr WalIndexHdr;
+typedef struct WalIterator WalIterator;
+typedef struct WalCkptInfo WalCkptInfo;
+
+
+/*
+** The following object holds a copy of the wal-index header content.
+**
+** The actual header in the wal-index consists of two copies of this
+** object followed by one instance of the WalCkptInfo object.
+** For all versions of SQLite through 3.10.0 and probably beyond,
+** the locking bytes (WalCkptInfo.aLock) start at offset 120 and
+** the total header size is 136 bytes.
+**
+** The szPage value can be any power of 2 between 512 and 32768, inclusive.
+** Or it can be 1 to represent a 65536-byte page. The latter case was
+** added in 3.7.1 when support for 64K pages was added.
+*/
+struct WalIndexHdr {
+ u32 iVersion; /* Wal-index version */
+ u32 unused; /* Unused (padding) field */
+ u32 iChange; /* Counter incremented each transaction */
+ u8 isInit; /* 1 when initialized */
+ u8 bigEndCksum; /* True if checksums in WAL are big-endian */
+ u16 szPage; /* Database page size in bytes. 1==64K */
+ u32 mxFrame; /* Index of last valid frame in the WAL */
+ u32 nPage; /* Size of database in pages */
+ u32 aFrameCksum[2]; /* Checksum of last frame in log */
+ u32 aSalt[2]; /* Two salt values copied from WAL header */
+ u32 aCksum[2]; /* Checksum over all prior fields */
+};
+
+/*
+** A copy of the following object occurs in the wal-index immediately
+** following the second copy of the WalIndexHdr. This object stores
+** information used by checkpoint.
+**
+** nBackfill is the number of frames in the WAL that have been written
+** back into the database. (We call the act of moving content from WAL to
+** database "backfilling".) The nBackfill number is never greater than
+** WalIndexHdr.mxFrame. nBackfill can only be increased by threads
+** holding the WAL_CKPT_LOCK lock (which includes a recovery thread).
+** However, a WAL_WRITE_LOCK thread can move the value of nBackfill from
+** mxFrame back to zero when the WAL is reset.
+**
+** nBackfillAttempted is the largest value of nBackfill that a checkpoint
+** has attempted to achieve. Normally nBackfill==nBackfillAtempted, however
+** the nBackfillAttempted is set before any backfilling is done and the
+** nBackfill is only set after all backfilling completes. So if a checkpoint
+** crashes, nBackfillAttempted might be larger than nBackfill. The
+** WalIndexHdr.mxFrame must never be less than nBackfillAttempted.
+**
+** The aLock[] field is a set of bytes used for locking. These bytes should
+** never be read or written.
+**
+** There is one entry in aReadMark[] for each reader lock. If a reader
+** holds read-lock K, then the value in aReadMark[K] is no greater than
+** the mxFrame for that reader. The value READMARK_NOT_USED (0xffffffff)
+** for any aReadMark[] means that entry is unused. aReadMark[0] is
+** a special case; its value is never used and it exists as a place-holder
+** to avoid having to offset aReadMark[] indexes by one. Readers holding
+** WAL_READ_LOCK(0) always ignore the entire WAL and read all content
+** directly from the database.
+**
+** The value of aReadMark[K] may only be changed by a thread that
+** is holding an exclusive lock on WAL_READ_LOCK(K). Thus, the value of
+** aReadMark[K] cannot changed while there is a reader is using that mark
+** since the reader will be holding a shared lock on WAL_READ_LOCK(K).
+**
+** The checkpointer may only transfer frames from WAL to database where
+** the frame numbers are less than or equal to every aReadMark[] that is
+** in use (that is, every aReadMark[j] for which there is a corresponding
+** WAL_READ_LOCK(j)). New readers (usually) pick the aReadMark[] with the
+** largest value and will increase an unused aReadMark[] to mxFrame if there
+** is not already an aReadMark[] equal to mxFrame. The exception to the
+** previous sentence is when nBackfill equals mxFrame (meaning that everything
+** in the WAL has been backfilled into the database) then new readers
+** will choose aReadMark[0] which has value 0 and hence such reader will
+** get all their all content directly from the database file and ignore
+** the WAL.
+**
+** Writers normally append new frames to the end of the WAL. However,
+** if nBackfill equals mxFrame (meaning that all WAL content has been
+** written back into the database) and if no readers are using the WAL
+** (in other words, if there are no WAL_READ_LOCK(i) where i>0) then
+** the writer will first "reset" the WAL back to the beginning and start
+** writing new content beginning at frame 1.
+**
+** We assume that 32-bit loads are atomic and so no locks are needed in
+** order to read from any aReadMark[] entries.
+*/
+struct WalCkptInfo {
+ u32 nBackfill; /* Number of WAL frames backfilled into DB */
+ u32 aReadMark[WAL_NREADER]; /* Reader marks */
+ u8 aLock[SQLITE_SHM_NLOCK]; /* Reserved space for locks */
+ u32 nBackfillAttempted; /* WAL frames perhaps written, or maybe not */
+ u32 notUsed0; /* Available for future enhancements */
+};
+#define READMARK_NOT_USED 0xffffffff
+
+/*
+** This is a schematic view of the complete 136-byte header of the
+** wal-index file (also known as the -shm file):
+**
+** +-----------------------------+
+** 0: | iVersion | \
+** +-----------------------------+ |
+** 4: | (unused padding) | |
+** +-----------------------------+ |
+** 8: | iChange | |
+** +-------+-------+-------------+ |
+** 12: | bInit | bBig | szPage | |
+** +-------+-------+-------------+ |
+** 16: | mxFrame | | First copy of the
+** +-----------------------------+ | WalIndexHdr object
+** 20: | nPage | |
+** +-----------------------------+ |
+** 24: | aFrameCksum | |
+** | | |
+** +-----------------------------+ |
+** 32: | aSalt | |
+** | | |
+** +-----------------------------+ |
+** 40: | aCksum | |
+** | | /
+** +-----------------------------+
+** 48: | iVersion | \
+** +-----------------------------+ |
+** 52: | (unused padding) | |
+** +-----------------------------+ |
+** 56: | iChange | |
+** +-------+-------+-------------+ |
+** 60: | bInit | bBig | szPage | |
+** +-------+-------+-------------+ | Second copy of the
+** 64: | mxFrame | | WalIndexHdr
+** +-----------------------------+ |
+** 68: | nPage | |
+** +-----------------------------+ |
+** 72: | aFrameCksum | |
+** | | |
+** +-----------------------------+ |
+** 80: | aSalt | |
+** | | |
+** +-----------------------------+ |
+** 88: | aCksum | |
+** | | /
+** +-----------------------------+
+** 96: | nBackfill |
+** +-----------------------------+
+** 100: | 5 read marks |
+** | |
+** | |
+** | |
+** | |
+** +-------+-------+------+------+
+** 120: | Write | Ckpt | Rcvr | Rd0 | \
+** +-------+-------+------+------+ ) 8 lock bytes
+** | Read1 | Read2 | Rd3 | Rd4 | /
+** +-------+-------+------+------+
+** 128: | nBackfillAttempted |
+** +-----------------------------+
+** 132: | (unused padding) |
+** +-----------------------------+
+*/
+
+/* A block of WALINDEX_LOCK_RESERVED bytes beginning at
+** WALINDEX_LOCK_OFFSET is reserved for locks. Since some systems
+** only support mandatory file-locks, we do not read or write data
+** from the region of the file on which locks are applied.
+*/
+#define WALINDEX_LOCK_OFFSET (sizeof(WalIndexHdr)*2+offsetof(WalCkptInfo,aLock))
+#define WALINDEX_HDR_SIZE (sizeof(WalIndexHdr)*2+sizeof(WalCkptInfo))
+
+/* Size of header before each frame in wal */
+#define WAL_FRAME_HDRSIZE 24
+
+/* Size of write ahead log header, including checksum. */
+#define WAL_HDRSIZE 32
+
+/* WAL magic value. Either this value, or the same value with the least
+** significant bit also set (WAL_MAGIC | 0x00000001) is stored in 32-bit
+** big-endian format in the first 4 bytes of a WAL file.
+**
+** If the LSB is set, then the checksums for each frame within the WAL
+** file are calculated by treating all data as an array of 32-bit
+** big-endian words. Otherwise, they are calculated by interpreting
+** all data as 32-bit little-endian words.
+*/
+#define WAL_MAGIC 0x377f0682
+
+/*
+** Return the offset of frame iFrame in the write-ahead log file,
+** assuming a database page size of szPage bytes. The offset returned
+** is to the start of the write-ahead log frame-header.
+*/
+#define walFrameOffset(iFrame, szPage) ( \
+ WAL_HDRSIZE + ((iFrame)-1)*(i64)((szPage)+WAL_FRAME_HDRSIZE) \
+)
+
+/*
+** An open write-ahead log file is represented by an instance of the
+** following object.
+*/
+struct Wal {
+ sqlite3_vfs *pVfs; /* The VFS used to create pDbFd */
+ sqlite3_file *pDbFd; /* File handle for the database file */
+ sqlite3_file *pWalFd; /* File handle for WAL file */
+ u32 iCallback; /* Value to pass to log callback (or 0) */
+ i64 mxWalSize; /* Truncate WAL to this size upon reset */
+ int nWiData; /* Size of array apWiData */
+ int szFirstBlock; /* Size of first block written to WAL file */
+ volatile u32 **apWiData; /* Pointer to wal-index content in memory */
+ u32 szPage; /* Database page size */
+ i16 readLock; /* Which read lock is being held. -1 for none */
+ u8 syncFlags; /* Flags to use to sync header writes */
+ u8 exclusiveMode; /* Non-zero if connection is in exclusive mode */
+ u8 writeLock; /* True if in a write transaction */
+ u8 ckptLock; /* True if holding a checkpoint lock */
+ u8 readOnly; /* WAL_RDWR, WAL_RDONLY, or WAL_SHM_RDONLY */
+ u8 truncateOnCommit; /* True to truncate WAL file on commit */
+ u8 syncHeader; /* Fsync the WAL header if true */
+ u8 padToSectorBoundary; /* Pad transactions out to the next sector */
+ u8 bShmUnreliable; /* SHM content is read-only and unreliable */
+ WalIndexHdr hdr; /* Wal-index header for current transaction */
+ u32 minFrame; /* Ignore wal frames before this one */
+ u32 iReCksum; /* On commit, recalculate checksums from here */
+ const char *zWalName; /* Name of WAL file */
+ u32 nCkpt; /* Checkpoint sequence counter in the wal-header */
+#ifdef SQLITE_USE_SEH
+ u32 lockMask; /* Mask of locks held */
+ void *pFree; /* Pointer to sqlite3_free() if exception thrown */
+ u32 *pWiValue; /* Value to write into apWiData[iWiPg] */
+ int iWiPg; /* Write pWiValue into apWiData[iWiPg] */
+ int iSysErrno; /* System error code following exception */
+#endif
+#ifdef SQLITE_DEBUG
+ int nSehTry; /* Number of nested SEH_TRY{} blocks */
+ u8 lockError; /* True if a locking error has occurred */
+#endif
+#ifdef SQLITE_ENABLE_SNAPSHOT
+ WalIndexHdr *pSnapshot; /* Start transaction here if not NULL */
+ int bGetSnapshot; /* Transaction opened for sqlite3_get_snapshot() */
+#endif
+#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
+ sqlite3 *db;
+#endif
+};
+
+/*
+** Candidate values for Wal.exclusiveMode.
+*/
+#define WAL_NORMAL_MODE 0
+#define WAL_EXCLUSIVE_MODE 1
+#define WAL_HEAPMEMORY_MODE 2
+
+/*
+** Possible values for WAL.readOnly
+*/
+#define WAL_RDWR 0 /* Normal read/write connection */
+#define WAL_RDONLY 1 /* The WAL file is readonly */
+#define WAL_SHM_RDONLY 2 /* The SHM file is readonly */
+
+/*
+** Each page of the wal-index mapping contains a hash-table made up of
+** an array of HASHTABLE_NSLOT elements of the following type.
+*/
+typedef u16 ht_slot;
+
+/*
+** This structure is used to implement an iterator that loops through
+** all frames in the WAL in database page order. Where two or more frames
+** correspond to the same database page, the iterator visits only the
+** frame most recently written to the WAL (in other words, the frame with
+** the largest index).
+**
+** The internals of this structure are only accessed by:
+**
+** walIteratorInit() - Create a new iterator,
+** walIteratorNext() - Step an iterator,
+** walIteratorFree() - Free an iterator.
+**
+** This functionality is used by the checkpoint code (see walCheckpoint()).
+*/
+struct WalIterator {
+ u32 iPrior; /* Last result returned from the iterator */
+ int nSegment; /* Number of entries in aSegment[] */
+ struct WalSegment {
+ int iNext; /* Next slot in aIndex[] not yet returned */
+ ht_slot *aIndex; /* i0, i1, i2... such that aPgno[iN] ascend */
+ u32 *aPgno; /* Array of page numbers. */
+ int nEntry; /* Nr. of entries in aPgno[] and aIndex[] */
+ int iZero; /* Frame number associated with aPgno[0] */
+ } aSegment[1]; /* One for every 32KB page in the wal-index */
+};
+
+/*
+** Define the parameters of the hash tables in the wal-index file. There
+** is a hash-table following every HASHTABLE_NPAGE page numbers in the
+** wal-index.
+**
+** Changing any of these constants will alter the wal-index format and
+** create incompatibilities.
+*/
+#define HASHTABLE_NPAGE 4096 /* Must be power of 2 */
+#define HASHTABLE_HASH_1 383 /* Should be prime */
+#define HASHTABLE_NSLOT (HASHTABLE_NPAGE*2) /* Must be a power of 2 */
+
+/*
+** The block of page numbers associated with the first hash-table in a
+** wal-index is smaller than usual. This is so that there is a complete
+** hash-table on each aligned 32KB page of the wal-index.
+*/
+#define HASHTABLE_NPAGE_ONE (HASHTABLE_NPAGE - (WALINDEX_HDR_SIZE/sizeof(u32)))
+
+/* The wal-index is divided into pages of WALINDEX_PGSZ bytes each. */
+#define WALINDEX_PGSZ ( \
+ sizeof(ht_slot)*HASHTABLE_NSLOT + HASHTABLE_NPAGE*sizeof(u32) \
+)
+
+/*
+** Structured Exception Handling (SEH) is a Windows-specific technique
+** for catching exceptions raised while accessing memory-mapped files.
+**
+** The -DSQLITE_USE_SEH compile-time option means to use SEH to catch and
+** deal with system-level errors that arise during WAL -shm file processing.
+** Without this compile-time option, any system-level faults that appear
+** while accessing the memory-mapped -shm file will cause a process-wide
+** signal to be deliver, which will more than likely cause the entire
+** process to exit.
+*/
+#ifdef SQLITE_USE_SEH
+#include <Windows.h>
+
+/* Beginning of a block of code in which an exception might occur */
+# define SEH_TRY __try { \
+ assert( walAssertLockmask(pWal) && pWal->nSehTry==0 ); \
+ VVA_ONLY(pWal->nSehTry++);
+
+/* The end of a block of code in which an exception might occur */
+# define SEH_EXCEPT(X) \
+ VVA_ONLY(pWal->nSehTry--); \
+ assert( pWal->nSehTry==0 ); \
+ } __except( sehExceptionFilter(pWal, GetExceptionCode(), GetExceptionInformation() ) ){ X }
+
+/* Simulate a memory-mapping fault in the -shm file for testing purposes */
+# define SEH_INJECT_FAULT sehInjectFault(pWal)
+
+/*
+** The second argument is the return value of GetExceptionCode() for the
+** current exception. Return EXCEPTION_EXECUTE_HANDLER if the exception code
+** indicates that the exception may have been caused by accessing the *-shm
+** file mapping. Or EXCEPTION_CONTINUE_SEARCH otherwise.
+*/
+static int sehExceptionFilter(Wal *pWal, int eCode, EXCEPTION_POINTERS *p){
+ VVA_ONLY(pWal->nSehTry--);
+ if( eCode==EXCEPTION_IN_PAGE_ERROR ){
+ if( p && p->ExceptionRecord && p->ExceptionRecord->NumberParameters>=3 ){
+ /* From MSDN: For this type of exception, the first element of the
+ ** ExceptionInformation[] array is a read-write flag - 0 if the exception
+ ** was thrown while reading, 1 if while writing. The second element is
+ ** the virtual address being accessed. The "third array element specifies
+ ** the underlying NTSTATUS code that resulted in the exception". */
+ pWal->iSysErrno = (int)p->ExceptionRecord->ExceptionInformation[2];
+ }
+ return EXCEPTION_EXECUTE_HANDLER;
+ }
+ return EXCEPTION_CONTINUE_SEARCH;
+}
+
+/*
+** If one is configured, invoke the xTestCallback callback with 650 as
+** the argument. If it returns true, throw the same exception that is
+** thrown by the system if the *-shm file mapping is accessed after it
+** has been invalidated.
+*/
+static void sehInjectFault(Wal *pWal){
+ int res;
+ assert( pWal->nSehTry>0 );
+
+ res = sqlite3FaultSim(650);
+ if( res!=0 ){
+ ULONG_PTR aArg[3];
+ aArg[0] = 0;
+ aArg[1] = 0;
+ aArg[2] = (ULONG_PTR)res;
+ RaiseException(EXCEPTION_IN_PAGE_ERROR, 0, 3, (const ULONG_PTR*)aArg);
+ }
+}
+
+/*
+** There are two ways to use this macro. To set a pointer to be freed
+** if an exception is thrown:
+**
+** SEH_FREE_ON_ERROR(0, pPtr);
+**
+** and to cancel the same:
+**
+** SEH_FREE_ON_ERROR(pPtr, 0);
+**
+** In the first case, there must not already be a pointer registered to
+** be freed. In the second case, pPtr must be the registered pointer.
+*/
+#define SEH_FREE_ON_ERROR(X,Y) \
+ assert( (X==0 || Y==0) && pWal->pFree==X ); pWal->pFree = Y
+
+/*
+** There are two ways to use this macro. To arrange for pWal->apWiData[iPg]
+** to be set to pValue if an exception is thrown:
+**
+** SEH_SET_ON_ERROR(iPg, pValue);
+**
+** and to cancel the same:
+**
+** SEH_SET_ON_ERROR(0, 0);
+*/
+#define SEH_SET_ON_ERROR(X,Y) pWal->iWiPg = X; pWal->pWiValue = Y
+
+#else
+# define SEH_TRY VVA_ONLY(pWal->nSehTry++);
+# define SEH_EXCEPT(X) VVA_ONLY(pWal->nSehTry--); assert( pWal->nSehTry==0 );
+# define SEH_INJECT_FAULT assert( pWal->nSehTry>0 );
+# define SEH_FREE_ON_ERROR(X,Y)
+# define SEH_SET_ON_ERROR(X,Y)
+#endif /* ifdef SQLITE_USE_SEH */
+
+
+/*
+** Obtain a pointer to the iPage'th page of the wal-index. The wal-index
+** is broken into pages of WALINDEX_PGSZ bytes. Wal-index pages are
+** numbered from zero.
+**
+** If the wal-index is currently smaller the iPage pages then the size
+** of the wal-index might be increased, but only if it is safe to do
+** so. It is safe to enlarge the wal-index if pWal->writeLock is true
+** or pWal->exclusiveMode==WAL_HEAPMEMORY_MODE.
+**
+** Three possible result scenarios:
+**
+** (1) rc==SQLITE_OK and *ppPage==Requested-Wal-Index-Page
+** (2) rc>=SQLITE_ERROR and *ppPage==NULL
+** (3) rc==SQLITE_OK and *ppPage==NULL // only if iPage==0
+**
+** Scenario (3) can only occur when pWal->writeLock is false and iPage==0
+*/
+static SQLITE_NOINLINE int walIndexPageRealloc(
+ Wal *pWal, /* The WAL context */
+ int iPage, /* The page we seek */
+ volatile u32 **ppPage /* Write the page pointer here */
+){
+ int rc = SQLITE_OK;
+
+ /* Enlarge the pWal->apWiData[] array if required */
+ if( pWal->nWiData<=iPage ){
+ sqlite3_int64 nByte = sizeof(u32*)*(iPage+1);
+ volatile u32 **apNew;
+ apNew = (volatile u32 **)sqlite3Realloc((void *)pWal->apWiData, nByte);
+ if( !apNew ){
+ *ppPage = 0;
+ return SQLITE_NOMEM_BKPT;
+ }
+ memset((void*)&apNew[pWal->nWiData], 0,
+ sizeof(u32*)*(iPage+1-pWal->nWiData));
+ pWal->apWiData = apNew;
+ pWal->nWiData = iPage+1;
+ }
+
+ /* Request a pointer to the required page from the VFS */
+ assert( pWal->apWiData[iPage]==0 );
+ if( pWal->exclusiveMode==WAL_HEAPMEMORY_MODE ){
+ pWal->apWiData[iPage] = (u32 volatile *)sqlite3MallocZero(WALINDEX_PGSZ);
+ if( !pWal->apWiData[iPage] ) rc = SQLITE_NOMEM_BKPT;
+ }else{
+ rc = sqlite3OsShmMap(pWal->pDbFd, iPage, WALINDEX_PGSZ,
+ pWal->writeLock, (void volatile **)&pWal->apWiData[iPage]
+ );
+ assert( pWal->apWiData[iPage]!=0
+ || rc!=SQLITE_OK
+ || (pWal->writeLock==0 && iPage==0) );
+ testcase( pWal->apWiData[iPage]==0 && rc==SQLITE_OK );
+ if( rc==SQLITE_OK ){
+ if( iPage>0 && sqlite3FaultSim(600) ) rc = SQLITE_NOMEM;
+ }else if( (rc&0xff)==SQLITE_READONLY ){
+ pWal->readOnly |= WAL_SHM_RDONLY;
+ if( rc==SQLITE_READONLY ){
+ rc = SQLITE_OK;
+ }
+ }
+ }
+
+ *ppPage = pWal->apWiData[iPage];
+ assert( iPage==0 || *ppPage || rc!=SQLITE_OK );
+ return rc;
+}
+static int walIndexPage(
+ Wal *pWal, /* The WAL context */
+ int iPage, /* The page we seek */
+ volatile u32 **ppPage /* Write the page pointer here */
+){
+ SEH_INJECT_FAULT;
+ if( pWal->nWiData<=iPage || (*ppPage = pWal->apWiData[iPage])==0 ){
+ return walIndexPageRealloc(pWal, iPage, ppPage);
+ }
+ return SQLITE_OK;
+}
+
+/*
+** Return a pointer to the WalCkptInfo structure in the wal-index.
+*/
+static volatile WalCkptInfo *walCkptInfo(Wal *pWal){
+ assert( pWal->nWiData>0 && pWal->apWiData[0] );
+ SEH_INJECT_FAULT;
+ return (volatile WalCkptInfo*)&(pWal->apWiData[0][sizeof(WalIndexHdr)/2]);
+}
+
+/*
+** Return a pointer to the WalIndexHdr structure in the wal-index.
+*/
+static volatile WalIndexHdr *walIndexHdr(Wal *pWal){
+ assert( pWal->nWiData>0 && pWal->apWiData[0] );
+ SEH_INJECT_FAULT;
+ return (volatile WalIndexHdr*)pWal->apWiData[0];
+}
+
+/*
+** The argument to this macro must be of type u32. On a little-endian
+** architecture, it returns the u32 value that results from interpreting
+** the 4 bytes as a big-endian value. On a big-endian architecture, it
+** returns the value that would be produced by interpreting the 4 bytes
+** of the input value as a little-endian integer.
+*/
+#define BYTESWAP32(x) ( \
+ (((x)&0x000000FF)<<24) + (((x)&0x0000FF00)<<8) \
+ + (((x)&0x00FF0000)>>8) + (((x)&0xFF000000)>>24) \
+)
+
+/*
+** Generate or extend an 8 byte checksum based on the data in
+** array aByte[] and the initial values of aIn[0] and aIn[1] (or
+** initial values of 0 and 0 if aIn==NULL).
+**
+** The checksum is written back into aOut[] before returning.
+**
+** nByte must be a positive multiple of 8.
+*/
+static void walChecksumBytes(
+ int nativeCksum, /* True for native byte-order, false for non-native */
+ u8 *a, /* Content to be checksummed */
+ int nByte, /* Bytes of content in a[]. Must be a multiple of 8. */
+ const u32 *aIn, /* Initial checksum value input */
+ u32 *aOut /* OUT: Final checksum value output */
+){
+ u32 s1, s2;
+ u32 *aData = (u32 *)a;
+ u32 *aEnd = (u32 *)&a[nByte];
+
+ if( aIn ){
+ s1 = aIn[0];
+ s2 = aIn[1];
+ }else{
+ s1 = s2 = 0;
+ }
+
+ assert( nByte>=8 );
+ assert( (nByte&0x00000007)==0 );
+ assert( nByte<=65536 );
+ assert( nByte%4==0 );
+
+ if( !nativeCksum ){
+ do {
+ s1 += BYTESWAP32(aData[0]) + s2;
+ s2 += BYTESWAP32(aData[1]) + s1;
+ aData += 2;
+ }while( aData<aEnd );
+ }else if( nByte%64==0 ){
+ do {
+ s1 += *aData++ + s2;
+ s2 += *aData++ + s1;
+ s1 += *aData++ + s2;
+ s2 += *aData++ + s1;
+ s1 += *aData++ + s2;
+ s2 += *aData++ + s1;
+ s1 += *aData++ + s2;
+ s2 += *aData++ + s1;
+ s1 += *aData++ + s2;
+ s2 += *aData++ + s1;
+ s1 += *aData++ + s2;
+ s2 += *aData++ + s1;
+ s1 += *aData++ + s2;
+ s2 += *aData++ + s1;
+ s1 += *aData++ + s2;
+ s2 += *aData++ + s1;
+ }while( aData<aEnd );
+ }else{
+ do {
+ s1 += *aData++ + s2;
+ s2 += *aData++ + s1;
+ }while( aData<aEnd );
+ }
+ assert( aData==aEnd );
+
+ aOut[0] = s1;
+ aOut[1] = s2;
+}
+
+/*
+** If there is the possibility of concurrent access to the SHM file
+** from multiple threads and/or processes, then do a memory barrier.
+*/
+static void walShmBarrier(Wal *pWal){
+ if( pWal->exclusiveMode!=WAL_HEAPMEMORY_MODE ){
+ sqlite3OsShmBarrier(pWal->pDbFd);
+ }
+}
+
+/*
+** Add the SQLITE_NO_TSAN as part of the return-type of a function
+** definition as a hint that the function contains constructs that
+** might give false-positive TSAN warnings.
+**
+** See tag-20200519-1.
+*/
+#if defined(__clang__) && !defined(SQLITE_NO_TSAN)
+# define SQLITE_NO_TSAN __attribute__((no_sanitize_thread))
+#else
+# define SQLITE_NO_TSAN
+#endif
+
+/*
+** Write the header information in pWal->hdr into the wal-index.
+**
+** The checksum on pWal->hdr is updated before it is written.
+*/
+static SQLITE_NO_TSAN void walIndexWriteHdr(Wal *pWal){
+ volatile WalIndexHdr *aHdr = walIndexHdr(pWal);
+ const int nCksum = offsetof(WalIndexHdr, aCksum);
+
+ assert( pWal->writeLock );
+ pWal->hdr.isInit = 1;
+ pWal->hdr.iVersion = WALINDEX_MAX_VERSION;
+ walChecksumBytes(1, (u8*)&pWal->hdr, nCksum, 0, pWal->hdr.aCksum);
+ /* Possible TSAN false-positive. See tag-20200519-1 */
+ memcpy((void*)&aHdr[1], (const void*)&pWal->hdr, sizeof(WalIndexHdr));
+ walShmBarrier(pWal);
+ memcpy((void*)&aHdr[0], (const void*)&pWal->hdr, sizeof(WalIndexHdr));
+}
+
+/*
+** This function encodes a single frame header and writes it to a buffer
+** supplied by the caller. A frame-header is made up of a series of
+** 4-byte big-endian integers, as follows:
+**
+** 0: Page number.
+** 4: For commit records, the size of the database image in pages
+** after the commit. For all other records, zero.
+** 8: Salt-1 (copied from the wal-header)
+** 12: Salt-2 (copied from the wal-header)
+** 16: Checksum-1.
+** 20: Checksum-2.
+*/
+static void walEncodeFrame(
+ Wal *pWal, /* The write-ahead log */
+ u32 iPage, /* Database page number for frame */
+ u32 nTruncate, /* New db size (or 0 for non-commit frames) */
+ u8 *aData, /* Pointer to page data */
+ u8 *aFrame /* OUT: Write encoded frame here */
+){
+ int nativeCksum; /* True for native byte-order checksums */
+ u32 *aCksum = pWal->hdr.aFrameCksum;
+ assert( WAL_FRAME_HDRSIZE==24 );
+ sqlite3Put4byte(&aFrame[0], iPage);
+ sqlite3Put4byte(&aFrame[4], nTruncate);
+ if( pWal->iReCksum==0 ){
+ memcpy(&aFrame[8], pWal->hdr.aSalt, 8);
+
+ nativeCksum = (pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN);
+ walChecksumBytes(nativeCksum, aFrame, 8, aCksum, aCksum);
+ walChecksumBytes(nativeCksum, aData, pWal->szPage, aCksum, aCksum);
+
+ sqlite3Put4byte(&aFrame[16], aCksum[0]);
+ sqlite3Put4byte(&aFrame[20], aCksum[1]);
+ }else{
+ memset(&aFrame[8], 0, 16);
+ }
+}
+
+/*
+** Check to see if the frame with header in aFrame[] and content
+** in aData[] is valid. If it is a valid frame, fill *piPage and
+** *pnTruncate and return true. Return if the frame is not valid.
+*/
+static int walDecodeFrame(
+ Wal *pWal, /* The write-ahead log */
+ u32 *piPage, /* OUT: Database page number for frame */
+ u32 *pnTruncate, /* OUT: New db size (or 0 if not commit) */
+ u8 *aData, /* Pointer to page data (for checksum) */
+ u8 *aFrame /* Frame data */
+){
+ int nativeCksum; /* True for native byte-order checksums */
+ u32 *aCksum = pWal->hdr.aFrameCksum;
+ u32 pgno; /* Page number of the frame */
+ assert( WAL_FRAME_HDRSIZE==24 );
+
+ /* A frame is only valid if the salt values in the frame-header
+ ** match the salt values in the wal-header.
+ */
+ if( memcmp(&pWal->hdr.aSalt, &aFrame[8], 8)!=0 ){
+ return 0;
+ }
+
+ /* A frame is only valid if the page number is greater than zero.
+ */
+ pgno = sqlite3Get4byte(&aFrame[0]);
+ if( pgno==0 ){
+ return 0;
+ }
+
+ /* A frame is only valid if a checksum of the WAL header,
+ ** all prior frames, the first 16 bytes of this frame-header,
+ ** and the frame-data matches the checksum in the last 8
+ ** bytes of this frame-header.
+ */
+ nativeCksum = (pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN);
+ walChecksumBytes(nativeCksum, aFrame, 8, aCksum, aCksum);
+ walChecksumBytes(nativeCksum, aData, pWal->szPage, aCksum, aCksum);
+ if( aCksum[0]!=sqlite3Get4byte(&aFrame[16])
+ || aCksum[1]!=sqlite3Get4byte(&aFrame[20])
+ ){
+ /* Checksum failed. */
+ return 0;
+ }
+
+ /* If we reach this point, the frame is valid. Return the page number
+ ** and the new database size.
+ */
+ *piPage = pgno;
+ *pnTruncate = sqlite3Get4byte(&aFrame[4]);
+ return 1;
+}
+
+
+#if defined(SQLITE_TEST) && defined(SQLITE_DEBUG)
+/*
+** Names of locks. This routine is used to provide debugging output and is not
+** a part of an ordinary build.
+*/
+static const char *walLockName(int lockIdx){
+ if( lockIdx==WAL_WRITE_LOCK ){
+ return "WRITE-LOCK";
+ }else if( lockIdx==WAL_CKPT_LOCK ){
+ return "CKPT-LOCK";
+ }else if( lockIdx==WAL_RECOVER_LOCK ){
+ return "RECOVER-LOCK";
+ }else{
+ static char zName[15];
+ sqlite3_snprintf(sizeof(zName), zName, "READ-LOCK[%d]",
+ lockIdx-WAL_READ_LOCK(0));
+ return zName;
+ }
+}
+#endif /*defined(SQLITE_TEST) || defined(SQLITE_DEBUG) */
+
+
+/*
+** Set or release locks on the WAL. Locks are either shared or exclusive.
+** A lock cannot be moved directly between shared and exclusive - it must go
+** through the unlocked state first.
+**
+** In locking_mode=EXCLUSIVE, all of these routines become no-ops.
+*/
+static int walLockShared(Wal *pWal, int lockIdx){
+ int rc;
+ if( pWal->exclusiveMode ) return SQLITE_OK;
+ rc = sqlite3OsShmLock(pWal->pDbFd, lockIdx, 1,
+ SQLITE_SHM_LOCK | SQLITE_SHM_SHARED);
+ WALTRACE(("WAL%p: acquire SHARED-%s %s\n", pWal,
+ walLockName(lockIdx), rc ? "failed" : "ok"));
+ VVA_ONLY( pWal->lockError = (u8)(rc!=SQLITE_OK && (rc&0xFF)!=SQLITE_BUSY); )
+#ifdef SQLITE_USE_SEH
+ if( rc==SQLITE_OK ) pWal->lockMask |= (1 << lockIdx);
+#endif
+ return rc;
+}
+static void walUnlockShared(Wal *pWal, int lockIdx){
+ if( pWal->exclusiveMode ) return;
+ (void)sqlite3OsShmLock(pWal->pDbFd, lockIdx, 1,
+ SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED);
+#ifdef SQLITE_USE_SEH
+ pWal->lockMask &= ~(1 << lockIdx);
+#endif
+ WALTRACE(("WAL%p: release SHARED-%s\n", pWal, walLockName(lockIdx)));
+}
+static int walLockExclusive(Wal *pWal, int lockIdx, int n){
+ int rc;
+ if( pWal->exclusiveMode ) return SQLITE_OK;
+ rc = sqlite3OsShmLock(pWal->pDbFd, lockIdx, n,
+ SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE);
+ WALTRACE(("WAL%p: acquire EXCLUSIVE-%s cnt=%d %s\n", pWal,
+ walLockName(lockIdx), n, rc ? "failed" : "ok"));
+ VVA_ONLY( pWal->lockError = (u8)(rc!=SQLITE_OK && (rc&0xFF)!=SQLITE_BUSY); )
+#ifdef SQLITE_USE_SEH
+ if( rc==SQLITE_OK ){
+ pWal->lockMask |= (((1<<n)-1) << (SQLITE_SHM_NLOCK+lockIdx));
+ }
+#endif
+ return rc;
+}
+static void walUnlockExclusive(Wal *pWal, int lockIdx, int n){
+ if( pWal->exclusiveMode ) return;
+ (void)sqlite3OsShmLock(pWal->pDbFd, lockIdx, n,
+ SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE);
+#ifdef SQLITE_USE_SEH
+ pWal->lockMask &= ~(((1<<n)-1) << (SQLITE_SHM_NLOCK+lockIdx));
+#endif
+ WALTRACE(("WAL%p: release EXCLUSIVE-%s cnt=%d\n", pWal,
+ walLockName(lockIdx), n));
+}
+
+/*
+** Compute a hash on a page number. The resulting hash value must land
+** between 0 and (HASHTABLE_NSLOT-1). The walHashNext() function advances
+** the hash to the next value in the event of a collision.
+*/
+static int walHash(u32 iPage){
+ assert( iPage>0 );
+ assert( (HASHTABLE_NSLOT & (HASHTABLE_NSLOT-1))==0 );
+ return (iPage*HASHTABLE_HASH_1) & (HASHTABLE_NSLOT-1);
+}
+static int walNextHash(int iPriorHash){
+ return (iPriorHash+1)&(HASHTABLE_NSLOT-1);
+}
+
+/*
+** An instance of the WalHashLoc object is used to describe the location
+** of a page hash table in the wal-index. This becomes the return value
+** from walHashGet().
+*/
+typedef struct WalHashLoc WalHashLoc;
+struct WalHashLoc {
+ volatile ht_slot *aHash; /* Start of the wal-index hash table */
+ volatile u32 *aPgno; /* aPgno[1] is the page of first frame indexed */
+ u32 iZero; /* One less than the frame number of first indexed*/
+};
+
+/*
+** Return pointers to the hash table and page number array stored on
+** page iHash of the wal-index. The wal-index is broken into 32KB pages
+** numbered starting from 0.
+**
+** Set output variable pLoc->aHash to point to the start of the hash table
+** in the wal-index file. Set pLoc->iZero to one less than the frame
+** number of the first frame indexed by this hash table. If a
+** slot in the hash table is set to N, it refers to frame number
+** (pLoc->iZero+N) in the log.
+**
+** Finally, set pLoc->aPgno so that pLoc->aPgno[0] is the page number of the
+** first frame indexed by the hash table, frame (pLoc->iZero).
+*/
+static int walHashGet(
+ Wal *pWal, /* WAL handle */
+ int iHash, /* Find the iHash'th table */
+ WalHashLoc *pLoc /* OUT: Hash table location */
+){
+ int rc; /* Return code */
+
+ rc = walIndexPage(pWal, iHash, &pLoc->aPgno);
+ assert( rc==SQLITE_OK || iHash>0 );
+
+ if( pLoc->aPgno ){
+ pLoc->aHash = (volatile ht_slot *)&pLoc->aPgno[HASHTABLE_NPAGE];
+ if( iHash==0 ){
+ pLoc->aPgno = &pLoc->aPgno[WALINDEX_HDR_SIZE/sizeof(u32)];
+ pLoc->iZero = 0;
+ }else{
+ pLoc->iZero = HASHTABLE_NPAGE_ONE + (iHash-1)*HASHTABLE_NPAGE;
+ }
+ }else if( NEVER(rc==SQLITE_OK) ){
+ rc = SQLITE_ERROR;
+ }
+ return rc;
+}
+
+/*
+** Return the number of the wal-index page that contains the hash-table
+** and page-number array that contain entries corresponding to WAL frame
+** iFrame. The wal-index is broken up into 32KB pages. Wal-index pages
+** are numbered starting from 0.
+*/
+static int walFramePage(u32 iFrame){
+ int iHash = (iFrame+HASHTABLE_NPAGE-HASHTABLE_NPAGE_ONE-1) / HASHTABLE_NPAGE;
+ assert( (iHash==0 || iFrame>HASHTABLE_NPAGE_ONE)
+ && (iHash>=1 || iFrame<=HASHTABLE_NPAGE_ONE)
+ && (iHash<=1 || iFrame>(HASHTABLE_NPAGE_ONE+HASHTABLE_NPAGE))
+ && (iHash>=2 || iFrame<=HASHTABLE_NPAGE_ONE+HASHTABLE_NPAGE)
+ && (iHash<=2 || iFrame>(HASHTABLE_NPAGE_ONE+2*HASHTABLE_NPAGE))
+ );
+ assert( iHash>=0 );
+ return iHash;
+}
+
+/*
+** Return the page number associated with frame iFrame in this WAL.
+*/
+static u32 walFramePgno(Wal *pWal, u32 iFrame){
+ int iHash = walFramePage(iFrame);
+ SEH_INJECT_FAULT;
+ if( iHash==0 ){
+ return pWal->apWiData[0][WALINDEX_HDR_SIZE/sizeof(u32) + iFrame - 1];
+ }
+ return pWal->apWiData[iHash][(iFrame-1-HASHTABLE_NPAGE_ONE)%HASHTABLE_NPAGE];
+}
+
+/*
+** Remove entries from the hash table that point to WAL slots greater
+** than pWal->hdr.mxFrame.
+**
+** This function is called whenever pWal->hdr.mxFrame is decreased due
+** to a rollback or savepoint.
+**
+** At most only the hash table containing pWal->hdr.mxFrame needs to be
+** updated. Any later hash tables will be automatically cleared when
+** pWal->hdr.mxFrame advances to the point where those hash tables are
+** actually needed.
+*/
+static void walCleanupHash(Wal *pWal){
+ WalHashLoc sLoc; /* Hash table location */
+ int iLimit = 0; /* Zero values greater than this */
+ int nByte; /* Number of bytes to zero in aPgno[] */
+ int i; /* Used to iterate through aHash[] */
+
+ assert( pWal->writeLock );
+ testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE-1 );
+ testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE );
+ testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE+1 );
+
+ if( pWal->hdr.mxFrame==0 ) return;
+
+ /* Obtain pointers to the hash-table and page-number array containing
+ ** the entry that corresponds to frame pWal->hdr.mxFrame. It is guaranteed
+ ** that the page said hash-table and array reside on is already mapped.(1)
+ */
+ assert( pWal->nWiData>walFramePage(pWal->hdr.mxFrame) );
+ assert( pWal->apWiData[walFramePage(pWal->hdr.mxFrame)] );
+ i = walHashGet(pWal, walFramePage(pWal->hdr.mxFrame), &sLoc);
+ if( NEVER(i) ) return; /* Defense-in-depth, in case (1) above is wrong */
+
+ /* Zero all hash-table entries that correspond to frame numbers greater
+ ** than pWal->hdr.mxFrame.
+ */
+ iLimit = pWal->hdr.mxFrame - sLoc.iZero;
+ assert( iLimit>0 );
+ for(i=0; i<HASHTABLE_NSLOT; i++){
+ if( sLoc.aHash[i]>iLimit ){
+ sLoc.aHash[i] = 0;
+ }
+ }
+
+ /* Zero the entries in the aPgno array that correspond to frames with
+ ** frame numbers greater than pWal->hdr.mxFrame.
+ */
+ nByte = (int)((char *)sLoc.aHash - (char *)&sLoc.aPgno[iLimit]);
+ assert( nByte>=0 );
+ memset((void *)&sLoc.aPgno[iLimit], 0, nByte);
+
+#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT
+ /* Verify that the every entry in the mapping region is still reachable
+ ** via the hash table even after the cleanup.
+ */
+ if( iLimit ){
+ int j; /* Loop counter */
+ int iKey; /* Hash key */
+ for(j=0; j<iLimit; j++){
+ for(iKey=walHash(sLoc.aPgno[j]);sLoc.aHash[iKey];iKey=walNextHash(iKey)){
+ if( sLoc.aHash[iKey]==j+1 ) break;
+ }
+ assert( sLoc.aHash[iKey]==j+1 );
+ }
+ }
+#endif /* SQLITE_ENABLE_EXPENSIVE_ASSERT */
+}
+
+
+/*
+** Set an entry in the wal-index that will map database page number
+** pPage into WAL frame iFrame.
+*/
+static int walIndexAppend(Wal *pWal, u32 iFrame, u32 iPage){
+ int rc; /* Return code */
+ WalHashLoc sLoc; /* Wal-index hash table location */
+
+ rc = walHashGet(pWal, walFramePage(iFrame), &sLoc);
+
+ /* Assuming the wal-index file was successfully mapped, populate the
+ ** page number array and hash table entry.
+ */
+ if( rc==SQLITE_OK ){
+ int iKey; /* Hash table key */
+ int idx; /* Value to write to hash-table slot */
+ int nCollide; /* Number of hash collisions */
+
+ idx = iFrame - sLoc.iZero;
+ assert( idx <= HASHTABLE_NSLOT/2 + 1 );
+
+ /* If this is the first entry to be added to this hash-table, zero the
+ ** entire hash table and aPgno[] array before proceeding.
+ */
+ if( idx==1 ){
+ int nByte = (int)((u8*)&sLoc.aHash[HASHTABLE_NSLOT] - (u8*)sLoc.aPgno);
+ assert( nByte>=0 );
+ memset((void*)sLoc.aPgno, 0, nByte);
+ }
+
+ /* If the entry in aPgno[] is already set, then the previous writer
+ ** must have exited unexpectedly in the middle of a transaction (after
+ ** writing one or more dirty pages to the WAL to free up memory).
+ ** Remove the remnants of that writers uncommitted transaction from
+ ** the hash-table before writing any new entries.
+ */
+ if( sLoc.aPgno[idx-1] ){
+ walCleanupHash(pWal);
+ assert( !sLoc.aPgno[idx-1] );
+ }
+
+ /* Write the aPgno[] array entry and the hash-table slot. */
+ nCollide = idx;
+ for(iKey=walHash(iPage); sLoc.aHash[iKey]; iKey=walNextHash(iKey)){
+ if( (nCollide--)==0 ) return SQLITE_CORRUPT_BKPT;
+ }
+ sLoc.aPgno[idx-1] = iPage;
+ AtomicStore(&sLoc.aHash[iKey], (ht_slot)idx);
+
+#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT
+ /* Verify that the number of entries in the hash table exactly equals
+ ** the number of entries in the mapping region.
+ */
+ {
+ int i; /* Loop counter */
+ int nEntry = 0; /* Number of entries in the hash table */
+ for(i=0; i<HASHTABLE_NSLOT; i++){ if( sLoc.aHash[i] ) nEntry++; }
+ assert( nEntry==idx );
+ }
+
+ /* Verify that the every entry in the mapping region is reachable
+ ** via the hash table. This turns out to be a really, really expensive
+ ** thing to check, so only do this occasionally - not on every
+ ** iteration.
+ */
+ if( (idx&0x3ff)==0 ){
+ int i; /* Loop counter */
+ for(i=0; i<idx; i++){
+ for(iKey=walHash(sLoc.aPgno[i]);
+ sLoc.aHash[iKey];
+ iKey=walNextHash(iKey)){
+ if( sLoc.aHash[iKey]==i+1 ) break;
+ }
+ assert( sLoc.aHash[iKey]==i+1 );
+ }
+ }
+#endif /* SQLITE_ENABLE_EXPENSIVE_ASSERT */
+ }
+
+ return rc;
+}
+
+
+/*
+** Recover the wal-index by reading the write-ahead log file.
+**
+** This routine first tries to establish an exclusive lock on the
+** wal-index to prevent other threads/processes from doing anything
+** with the WAL or wal-index while recovery is running. The
+** WAL_RECOVER_LOCK is also held so that other threads will know
+** that this thread is running recovery. If unable to establish
+** the necessary locks, this routine returns SQLITE_BUSY.
+*/
+static int walIndexRecover(Wal *pWal){
+ int rc; /* Return Code */
+ i64 nSize; /* Size of log file */
+ u32 aFrameCksum[2] = {0, 0};
+ int iLock; /* Lock offset to lock for checkpoint */
+
+ /* Obtain an exclusive lock on all byte in the locking range not already
+ ** locked by the caller. The caller is guaranteed to have locked the
+ ** WAL_WRITE_LOCK byte, and may have also locked the WAL_CKPT_LOCK byte.
+ ** If successful, the same bytes that are locked here are unlocked before
+ ** this function returns.
+ */
+ assert( pWal->ckptLock==1 || pWal->ckptLock==0 );
+ assert( WAL_ALL_BUT_WRITE==WAL_WRITE_LOCK+1 );
+ assert( WAL_CKPT_LOCK==WAL_ALL_BUT_WRITE );
+ assert( pWal->writeLock );
+ iLock = WAL_ALL_BUT_WRITE + pWal->ckptLock;
+ rc = walLockExclusive(pWal, iLock, WAL_READ_LOCK(0)-iLock);
+ if( rc ){
+ return rc;
+ }
+
+ WALTRACE(("WAL%p: recovery begin...\n", pWal));
+
+ memset(&pWal->hdr, 0, sizeof(WalIndexHdr));
+
+ rc = sqlite3OsFileSize(pWal->pWalFd, &nSize);
+ if( rc!=SQLITE_OK ){
+ goto recovery_error;
+ }
+
+ if( nSize>WAL_HDRSIZE ){
+ u8 aBuf[WAL_HDRSIZE]; /* Buffer to load WAL header into */
+ u32 *aPrivate = 0; /* Heap copy of *-shm hash being populated */
+ u8 *aFrame = 0; /* Malloc'd buffer to load entire frame */
+ int szFrame; /* Number of bytes in buffer aFrame[] */
+ u8 *aData; /* Pointer to data part of aFrame buffer */
+ int szPage; /* Page size according to the log */
+ u32 magic; /* Magic value read from WAL header */
+ u32 version; /* Magic value read from WAL header */
+ int isValid; /* True if this frame is valid */
+ u32 iPg; /* Current 32KB wal-index page */
+ u32 iLastFrame; /* Last frame in wal, based on nSize alone */
+
+ /* Read in the WAL header. */
+ rc = sqlite3OsRead(pWal->pWalFd, aBuf, WAL_HDRSIZE, 0);
+ if( rc!=SQLITE_OK ){
+ goto recovery_error;
+ }
+
+ /* If the database page size is not a power of two, or is greater than
+ ** SQLITE_MAX_PAGE_SIZE, conclude that the WAL file contains no valid
+ ** data. Similarly, if the 'magic' value is invalid, ignore the whole
+ ** WAL file.
+ */
+ magic = sqlite3Get4byte(&aBuf[0]);
+ szPage = sqlite3Get4byte(&aBuf[8]);
+ if( (magic&0xFFFFFFFE)!=WAL_MAGIC
+ || szPage&(szPage-1)
+ || szPage>SQLITE_MAX_PAGE_SIZE
+ || szPage<512
+ ){
+ goto finished;
+ }
+ pWal->hdr.bigEndCksum = (u8)(magic&0x00000001);
+ pWal->szPage = szPage;
+ pWal->nCkpt = sqlite3Get4byte(&aBuf[12]);
+ memcpy(&pWal->hdr.aSalt, &aBuf[16], 8);
+
+ /* Verify that the WAL header checksum is correct */
+ walChecksumBytes(pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN,
+ aBuf, WAL_HDRSIZE-2*4, 0, pWal->hdr.aFrameCksum
+ );
+ if( pWal->hdr.aFrameCksum[0]!=sqlite3Get4byte(&aBuf[24])
+ || pWal->hdr.aFrameCksum[1]!=sqlite3Get4byte(&aBuf[28])
+ ){
+ goto finished;
+ }
+
+ /* Verify that the version number on the WAL format is one that
+ ** are able to understand */
+ version = sqlite3Get4byte(&aBuf[4]);
+ if( version!=WAL_MAX_VERSION ){
+ rc = SQLITE_CANTOPEN_BKPT;
+ goto finished;
+ }
+
+ /* Malloc a buffer to read frames into. */
+ szFrame = szPage + WAL_FRAME_HDRSIZE;
+ aFrame = (u8 *)sqlite3_malloc64(szFrame + WALINDEX_PGSZ);
+ SEH_FREE_ON_ERROR(0, aFrame);
+ if( !aFrame ){
+ rc = SQLITE_NOMEM_BKPT;
+ goto recovery_error;
+ }
+ aData = &aFrame[WAL_FRAME_HDRSIZE];
+ aPrivate = (u32*)&aData[szPage];
+
+ /* Read all frames from the log file. */
+ iLastFrame = (nSize - WAL_HDRSIZE) / szFrame;
+ for(iPg=0; iPg<=(u32)walFramePage(iLastFrame); iPg++){
+ u32 *aShare;
+ u32 iFrame; /* Index of last frame read */
+ u32 iLast = MIN(iLastFrame, HASHTABLE_NPAGE_ONE+iPg*HASHTABLE_NPAGE);
+ u32 iFirst = 1 + (iPg==0?0:HASHTABLE_NPAGE_ONE+(iPg-1)*HASHTABLE_NPAGE);
+ u32 nHdr, nHdr32;
+ rc = walIndexPage(pWal, iPg, (volatile u32**)&aShare);
+ assert( aShare!=0 || rc!=SQLITE_OK );
+ if( aShare==0 ) break;
+ SEH_SET_ON_ERROR(iPg, aShare);
+ pWal->apWiData[iPg] = aPrivate;
+
+ for(iFrame=iFirst; iFrame<=iLast; iFrame++){
+ i64 iOffset = walFrameOffset(iFrame, szPage);
+ u32 pgno; /* Database page number for frame */
+ u32 nTruncate; /* dbsize field from frame header */
+
+ /* Read and decode the next log frame. */
+ rc = sqlite3OsRead(pWal->pWalFd, aFrame, szFrame, iOffset);
+ if( rc!=SQLITE_OK ) break;
+ isValid = walDecodeFrame(pWal, &pgno, &nTruncate, aData, aFrame);
+ if( !isValid ) break;
+ rc = walIndexAppend(pWal, iFrame, pgno);
+ if( NEVER(rc!=SQLITE_OK) ) break;
+
+ /* If nTruncate is non-zero, this is a commit record. */
+ if( nTruncate ){
+ pWal->hdr.mxFrame = iFrame;
+ pWal->hdr.nPage = nTruncate;
+ pWal->hdr.szPage = (u16)((szPage&0xff00) | (szPage>>16));
+ testcase( szPage<=32768 );
+ testcase( szPage>=65536 );
+ aFrameCksum[0] = pWal->hdr.aFrameCksum[0];
+ aFrameCksum[1] = pWal->hdr.aFrameCksum[1];
+ }
+ }
+ pWal->apWiData[iPg] = aShare;
+ SEH_SET_ON_ERROR(0,0);
+ nHdr = (iPg==0 ? WALINDEX_HDR_SIZE : 0);
+ nHdr32 = nHdr / sizeof(u32);
+#ifndef SQLITE_SAFER_WALINDEX_RECOVERY
+ /* Memcpy() should work fine here, on all reasonable implementations.
+ ** Technically, memcpy() might change the destination to some
+ ** intermediate value before setting to the final value, and that might
+ ** cause a concurrent reader to malfunction. Memcpy() is allowed to
+ ** do that, according to the spec, but no memcpy() implementation that
+ ** we know of actually does that, which is why we say that memcpy()
+ ** is safe for this. Memcpy() is certainly a lot faster.
+ */
+ memcpy(&aShare[nHdr32], &aPrivate[nHdr32], WALINDEX_PGSZ-nHdr);
+#else
+ /* In the event that some platform is found for which memcpy()
+ ** changes the destination to some intermediate value before
+ ** setting the final value, this alternative copy routine is
+ ** provided.
+ */
+ {
+ int i;
+ for(i=nHdr32; i<WALINDEX_PGSZ/sizeof(u32); i++){
+ if( aShare[i]!=aPrivate[i] ){
+ /* Atomic memory operations are not required here because if
+ ** the value needs to be changed, that means it is not being
+ ** accessed concurrently. */
+ aShare[i] = aPrivate[i];
+ }
+ }
+ }
+#endif
+ SEH_INJECT_FAULT;
+ if( iFrame<=iLast ) break;
+ }
+
+ SEH_FREE_ON_ERROR(aFrame, 0);
+ sqlite3_free(aFrame);
+ }
+
+finished:
+ if( rc==SQLITE_OK ){
+ volatile WalCkptInfo *pInfo;
+ int i;
+ pWal->hdr.aFrameCksum[0] = aFrameCksum[0];
+ pWal->hdr.aFrameCksum[1] = aFrameCksum[1];
+ walIndexWriteHdr(pWal);
+
+ /* Reset the checkpoint-header. This is safe because this thread is
+ ** currently holding locks that exclude all other writers and
+ ** checkpointers. Then set the values of read-mark slots 1 through N.
+ */
+ pInfo = walCkptInfo(pWal);
+ pInfo->nBackfill = 0;
+ pInfo->nBackfillAttempted = pWal->hdr.mxFrame;
+ pInfo->aReadMark[0] = 0;
+ for(i=1; i<WAL_NREADER; i++){
+ rc = walLockExclusive(pWal, WAL_READ_LOCK(i), 1);
+ if( rc==SQLITE_OK ){
+ if( i==1 && pWal->hdr.mxFrame ){
+ pInfo->aReadMark[i] = pWal->hdr.mxFrame;
+ }else{
+ pInfo->aReadMark[i] = READMARK_NOT_USED;
+ }
+ SEH_INJECT_FAULT;
+ walUnlockExclusive(pWal, WAL_READ_LOCK(i), 1);
+ }else if( rc!=SQLITE_BUSY ){
+ goto recovery_error;
+ }
+ }
+
+ /* If more than one frame was recovered from the log file, report an
+ ** event via sqlite3_log(). This is to help with identifying performance
+ ** problems caused by applications routinely shutting down without
+ ** checkpointing the log file.
+ */
+ if( pWal->hdr.nPage ){
+ sqlite3_log(SQLITE_NOTICE_RECOVER_WAL,
+ "recovered %d frames from WAL file %s",
+ pWal->hdr.mxFrame, pWal->zWalName
+ );
+ }
+ }
+
+recovery_error:
+ WALTRACE(("WAL%p: recovery %s\n", pWal, rc ? "failed" : "ok"));
+ walUnlockExclusive(pWal, iLock, WAL_READ_LOCK(0)-iLock);
+ return rc;
+}
+
+/*
+** Close an open wal-index.
+*/
+static void walIndexClose(Wal *pWal, int isDelete){
+ if( pWal->exclusiveMode==WAL_HEAPMEMORY_MODE || pWal->bShmUnreliable ){
+ int i;
+ for(i=0; i<pWal->nWiData; i++){
+ sqlite3_free((void *)pWal->apWiData[i]);
+ pWal->apWiData[i] = 0;
+ }
+ }
+ if( pWal->exclusiveMode!=WAL_HEAPMEMORY_MODE ){
+ sqlite3OsShmUnmap(pWal->pDbFd, isDelete);
+ }
+}
+
+/*
+** Open a connection to the WAL file zWalName. The database file must
+** already be opened on connection pDbFd. The buffer that zWalName points
+** to must remain valid for the lifetime of the returned Wal* handle.
+**
+** A SHARED lock should be held on the database file when this function
+** is called. The purpose of this SHARED lock is to prevent any other
+** client from unlinking the WAL or wal-index file. If another process
+** were to do this just after this client opened one of these files, the
+** system would be badly broken.
+**
+** If the log file is successfully opened, SQLITE_OK is returned and
+** *ppWal is set to point to a new WAL handle. If an error occurs,
+** an SQLite error code is returned and *ppWal is left unmodified.
+*/
+SQLITE_PRIVATE int sqlite3WalOpen(
+ sqlite3_vfs *pVfs, /* vfs module to open wal and wal-index */
+ sqlite3_file *pDbFd, /* The open database file */
+ const char *zWalName, /* Name of the WAL file */
+ int bNoShm, /* True to run in heap-memory mode */
+ i64 mxWalSize, /* Truncate WAL to this size on reset */
+ Wal **ppWal /* OUT: Allocated Wal handle */
+){
+ int rc; /* Return Code */
+ Wal *pRet; /* Object to allocate and return */
+ int flags; /* Flags passed to OsOpen() */
+
+ assert( zWalName && zWalName[0] );
+ assert( pDbFd );
+
+ /* Verify the values of various constants. Any changes to the values
+ ** of these constants would result in an incompatible on-disk format
+ ** for the -shm file. Any change that causes one of these asserts to
+ ** fail is a backward compatibility problem, even if the change otherwise
+ ** works.
+ **
+ ** This table also serves as a helpful cross-reference when trying to
+ ** interpret hex dumps of the -shm file.
+ */
+ assert( 48 == sizeof(WalIndexHdr) );
+ assert( 40 == sizeof(WalCkptInfo) );
+ assert( 120 == WALINDEX_LOCK_OFFSET );
+ assert( 136 == WALINDEX_HDR_SIZE );
+ assert( 4096 == HASHTABLE_NPAGE );
+ assert( 4062 == HASHTABLE_NPAGE_ONE );
+ assert( 8192 == HASHTABLE_NSLOT );
+ assert( 383 == HASHTABLE_HASH_1 );
+ assert( 32768 == WALINDEX_PGSZ );
+ assert( 8 == SQLITE_SHM_NLOCK );
+ assert( 5 == WAL_NREADER );
+ assert( 24 == WAL_FRAME_HDRSIZE );
+ assert( 32 == WAL_HDRSIZE );
+ assert( 120 == WALINDEX_LOCK_OFFSET + WAL_WRITE_LOCK );
+ assert( 121 == WALINDEX_LOCK_OFFSET + WAL_CKPT_LOCK );
+ assert( 122 == WALINDEX_LOCK_OFFSET + WAL_RECOVER_LOCK );
+ assert( 123 == WALINDEX_LOCK_OFFSET + WAL_READ_LOCK(0) );
+ assert( 124 == WALINDEX_LOCK_OFFSET + WAL_READ_LOCK(1) );
+ assert( 125 == WALINDEX_LOCK_OFFSET + WAL_READ_LOCK(2) );
+ assert( 126 == WALINDEX_LOCK_OFFSET + WAL_READ_LOCK(3) );
+ assert( 127 == WALINDEX_LOCK_OFFSET + WAL_READ_LOCK(4) );
+
+ /* In the amalgamation, the os_unix.c and os_win.c source files come before
+ ** this source file. Verify that the #defines of the locking byte offsets
+ ** in os_unix.c and os_win.c agree with the WALINDEX_LOCK_OFFSET value.
+ ** For that matter, if the lock offset ever changes from its initial design
+ ** value of 120, we need to know that so there is an assert() to check it.
+ */
+#ifdef WIN_SHM_BASE
+ assert( WIN_SHM_BASE==WALINDEX_LOCK_OFFSET );
+#endif
+#ifdef UNIX_SHM_BASE
+ assert( UNIX_SHM_BASE==WALINDEX_LOCK_OFFSET );
+#endif
+
+
+ /* Allocate an instance of struct Wal to return. */
+ *ppWal = 0;
+ pRet = (Wal*)sqlite3MallocZero(sizeof(Wal) + pVfs->szOsFile);
+ if( !pRet ){
+ return SQLITE_NOMEM_BKPT;
+ }
+
+ pRet->pVfs = pVfs;
+ pRet->pWalFd = (sqlite3_file *)&pRet[1];
+ pRet->pDbFd = pDbFd;
+ pRet->readLock = -1;
+ pRet->mxWalSize = mxWalSize;
+ pRet->zWalName = zWalName;
+ pRet->syncHeader = 1;
+ pRet->padToSectorBoundary = 1;
+ pRet->exclusiveMode = (bNoShm ? WAL_HEAPMEMORY_MODE: WAL_NORMAL_MODE);
+
+ /* Open file handle on the write-ahead log file. */
+ flags = (SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_WAL);
+ rc = sqlite3OsOpen(pVfs, zWalName, pRet->pWalFd, flags, &flags);
+ if( rc==SQLITE_OK && flags&SQLITE_OPEN_READONLY ){
+ pRet->readOnly = WAL_RDONLY;
+ }
+
+ if( rc!=SQLITE_OK ){
+ walIndexClose(pRet, 0);
+ sqlite3OsClose(pRet->pWalFd);
+ sqlite3_free(pRet);
+ }else{
+ int iDC = sqlite3OsDeviceCharacteristics(pDbFd);
+ if( iDC & SQLITE_IOCAP_SEQUENTIAL ){ pRet->syncHeader = 0; }
+ if( iDC & SQLITE_IOCAP_POWERSAFE_OVERWRITE ){
+ pRet->padToSectorBoundary = 0;
+ }
+ *ppWal = pRet;
+ WALTRACE(("WAL%d: opened\n", pRet));
+ }
+ return rc;
+}
+
+/*
+** Change the size to which the WAL file is truncated on each reset.
+*/
+SQLITE_PRIVATE void sqlite3WalLimit(Wal *pWal, i64 iLimit){
+ if( pWal ) pWal->mxWalSize = iLimit;
+}
+
+/*
+** Find the smallest page number out of all pages held in the WAL that
+** has not been returned by any prior invocation of this method on the
+** same WalIterator object. Write into *piFrame the frame index where
+** that page was last written into the WAL. Write into *piPage the page
+** number.
+**
+** Return 0 on success. If there are no pages in the WAL with a page
+** number larger than *piPage, then return 1.
+*/
+static int walIteratorNext(
+ WalIterator *p, /* Iterator */
+ u32 *piPage, /* OUT: The page number of the next page */
+ u32 *piFrame /* OUT: Wal frame index of next page */
+){
+ u32 iMin; /* Result pgno must be greater than iMin */
+ u32 iRet = 0xFFFFFFFF; /* 0xffffffff is never a valid page number */
+ int i; /* For looping through segments */
+
+ iMin = p->iPrior;
+ assert( iMin<0xffffffff );
+ for(i=p->nSegment-1; i>=0; i--){
+ struct WalSegment *pSegment = &p->aSegment[i];
+ while( pSegment->iNext<pSegment->nEntry ){
+ u32 iPg = pSegment->aPgno[pSegment->aIndex[pSegment->iNext]];
+ if( iPg>iMin ){
+ if( iPg<iRet ){
+ iRet = iPg;
+ *piFrame = pSegment->iZero + pSegment->aIndex[pSegment->iNext];
+ }
+ break;
+ }
+ pSegment->iNext++;
+ }
+ }
+
+ *piPage = p->iPrior = iRet;
+ return (iRet==0xFFFFFFFF);
+}
+
+/*
+** This function merges two sorted lists into a single sorted list.
+**
+** aLeft[] and aRight[] are arrays of indices. The sort key is
+** aContent[aLeft[]] and aContent[aRight[]]. Upon entry, the following
+** is guaranteed for all J<K:
+**
+** aContent[aLeft[J]] < aContent[aLeft[K]]
+** aContent[aRight[J]] < aContent[aRight[K]]
+**
+** This routine overwrites aRight[] with a new (probably longer) sequence
+** of indices such that the aRight[] contains every index that appears in
+** either aLeft[] or the old aRight[] and such that the second condition
+** above is still met.
+**
+** The aContent[aLeft[X]] values will be unique for all X. And the
+** aContent[aRight[X]] values will be unique too. But there might be
+** one or more combinations of X and Y such that
+**
+** aLeft[X]!=aRight[Y] && aContent[aLeft[X]] == aContent[aRight[Y]]
+**
+** When that happens, omit the aLeft[X] and use the aRight[Y] index.
+*/
+static void walMerge(
+ const u32 *aContent, /* Pages in wal - keys for the sort */
+ ht_slot *aLeft, /* IN: Left hand input list */
+ int nLeft, /* IN: Elements in array *paLeft */
+ ht_slot **paRight, /* IN/OUT: Right hand input list */
+ int *pnRight, /* IN/OUT: Elements in *paRight */
+ ht_slot *aTmp /* Temporary buffer */
+){
+ int iLeft = 0; /* Current index in aLeft */
+ int iRight = 0; /* Current index in aRight */
+ int iOut = 0; /* Current index in output buffer */
+ int nRight = *pnRight;
+ ht_slot *aRight = *paRight;
+
+ assert( nLeft>0 && nRight>0 );
+ while( iRight<nRight || iLeft<nLeft ){
+ ht_slot logpage;
+ Pgno dbpage;
+
+ if( (iLeft<nLeft)
+ && (iRight>=nRight || aContent[aLeft[iLeft]]<aContent[aRight[iRight]])
+ ){
+ logpage = aLeft[iLeft++];
+ }else{
+ logpage = aRight[iRight++];
+ }
+ dbpage = aContent[logpage];
+
+ aTmp[iOut++] = logpage;
+ if( iLeft<nLeft && aContent[aLeft[iLeft]]==dbpage ) iLeft++;
+
+ assert( iLeft>=nLeft || aContent[aLeft[iLeft]]>dbpage );
+ assert( iRight>=nRight || aContent[aRight[iRight]]>dbpage );
+ }
+
+ *paRight = aLeft;
+ *pnRight = iOut;
+ memcpy(aLeft, aTmp, sizeof(aTmp[0])*iOut);
+}
+
+/*
+** Sort the elements in list aList using aContent[] as the sort key.
+** Remove elements with duplicate keys, preferring to keep the
+** larger aList[] values.
+**
+** The aList[] entries are indices into aContent[]. The values in
+** aList[] are to be sorted so that for all J<K:
+**
+** aContent[aList[J]] < aContent[aList[K]]
+**
+** For any X and Y such that
+**
+** aContent[aList[X]] == aContent[aList[Y]]
+**
+** Keep the larger of the two values aList[X] and aList[Y] and discard
+** the smaller.
+*/
+static void walMergesort(
+ const u32 *aContent, /* Pages in wal */
+ ht_slot *aBuffer, /* Buffer of at least *pnList items to use */
+ ht_slot *aList, /* IN/OUT: List to sort */
+ int *pnList /* IN/OUT: Number of elements in aList[] */
+){
+ struct Sublist {
+ int nList; /* Number of elements in aList */
+ ht_slot *aList; /* Pointer to sub-list content */
+ };
+
+ const int nList = *pnList; /* Size of input list */
+ int nMerge = 0; /* Number of elements in list aMerge */
+ ht_slot *aMerge = 0; /* List to be merged */
+ int iList; /* Index into input list */
+ u32 iSub = 0; /* Index into aSub array */
+ struct Sublist aSub[13]; /* Array of sub-lists */
+
+ memset(aSub, 0, sizeof(aSub));
+ assert( nList<=HASHTABLE_NPAGE && nList>0 );
+ assert( HASHTABLE_NPAGE==(1<<(ArraySize(aSub)-1)) );
+
+ for(iList=0; iList<nList; iList++){
+ nMerge = 1;
+ aMerge = &aList[iList];
+ for(iSub=0; iList & (1<<iSub); iSub++){
+ struct Sublist *p;
+ assert( iSub<ArraySize(aSub) );
+ p = &aSub[iSub];
+ assert( p->aList && p->nList<=(1<<iSub) );
+ assert( p->aList==&aList[iList&~((2<<iSub)-1)] );
+ walMerge(aContent, p->aList, p->nList, &aMerge, &nMerge, aBuffer);
+ }
+ aSub[iSub].aList = aMerge;
+ aSub[iSub].nList = nMerge;
+ }
+
+ for(iSub++; iSub<ArraySize(aSub); iSub++){
+ if( nList & (1<<iSub) ){
+ struct Sublist *p;
+ assert( iSub<ArraySize(aSub) );
+ p = &aSub[iSub];
+ assert( p->nList<=(1<<iSub) );
+ assert( p->aList==&aList[nList&~((2<<iSub)-1)] );
+ walMerge(aContent, p->aList, p->nList, &aMerge, &nMerge, aBuffer);
+ }
+ }
+ assert( aMerge==aList );
+ *pnList = nMerge;
+
+#ifdef SQLITE_DEBUG
+ {
+ int i;
+ for(i=1; i<*pnList; i++){
+ assert( aContent[aList[i]] > aContent[aList[i-1]] );
+ }
+ }
+#endif
+}
+
+/*
+** Free an iterator allocated by walIteratorInit().
+*/
+static void walIteratorFree(WalIterator *p){
+ sqlite3_free(p);
+}
+
+/*
+** Construct a WalInterator object that can be used to loop over all
+** pages in the WAL following frame nBackfill in ascending order. Frames
+** nBackfill or earlier may be included - excluding them is an optimization
+** only. The caller must hold the checkpoint lock.
+**
+** On success, make *pp point to the newly allocated WalInterator object
+** return SQLITE_OK. Otherwise, return an error code. If this routine
+** returns an error, the value of *pp is undefined.
+**
+** The calling routine should invoke walIteratorFree() to destroy the
+** WalIterator object when it has finished with it.
+*/
+static int walIteratorInit(Wal *pWal, u32 nBackfill, WalIterator **pp){
+ WalIterator *p; /* Return value */
+ int nSegment; /* Number of segments to merge */
+ u32 iLast; /* Last frame in log */
+ sqlite3_int64 nByte; /* Number of bytes to allocate */
+ int i; /* Iterator variable */
+ ht_slot *aTmp; /* Temp space used by merge-sort */
+ int rc = SQLITE_OK; /* Return Code */
+
+ /* This routine only runs while holding the checkpoint lock. And
+ ** it only runs if there is actually content in the log (mxFrame>0).
+ */
+ assert( pWal->ckptLock && pWal->hdr.mxFrame>0 );
+ iLast = pWal->hdr.mxFrame;
+
+ /* Allocate space for the WalIterator object. */
+ nSegment = walFramePage(iLast) + 1;
+ nByte = sizeof(WalIterator)
+ + (nSegment-1)*sizeof(struct WalSegment)
+ + iLast*sizeof(ht_slot);
+ p = (WalIterator *)sqlite3_malloc64(nByte
+ + sizeof(ht_slot) * (iLast>HASHTABLE_NPAGE?HASHTABLE_NPAGE:iLast)
+ );
+ if( !p ){
+ return SQLITE_NOMEM_BKPT;
+ }
+ memset(p, 0, nByte);
+ p->nSegment = nSegment;
+ aTmp = (ht_slot*)&(((u8*)p)[nByte]);
+ SEH_FREE_ON_ERROR(0, p);
+ for(i=walFramePage(nBackfill+1); rc==SQLITE_OK && i<nSegment; i++){
+ WalHashLoc sLoc;
+
+ rc = walHashGet(pWal, i, &sLoc);
+ if( rc==SQLITE_OK ){
+ int j; /* Counter variable */
+ int nEntry; /* Number of entries in this segment */
+ ht_slot *aIndex; /* Sorted index for this segment */
+
+ if( (i+1)==nSegment ){
+ nEntry = (int)(iLast - sLoc.iZero);
+ }else{
+ nEntry = (int)((u32*)sLoc.aHash - (u32*)sLoc.aPgno);
+ }
+ aIndex = &((ht_slot *)&p->aSegment[p->nSegment])[sLoc.iZero];
+ sLoc.iZero++;
+
+ for(j=0; j<nEntry; j++){
+ aIndex[j] = (ht_slot)j;
+ }
+ walMergesort((u32 *)sLoc.aPgno, aTmp, aIndex, &nEntry);
+ p->aSegment[i].iZero = sLoc.iZero;
+ p->aSegment[i].nEntry = nEntry;
+ p->aSegment[i].aIndex = aIndex;
+ p->aSegment[i].aPgno = (u32 *)sLoc.aPgno;
+ }
+ }
+ if( rc!=SQLITE_OK ){
+ SEH_FREE_ON_ERROR(p, 0);
+ walIteratorFree(p);
+ p = 0;
+ }
+ *pp = p;
+ return rc;
+}
+
+#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
+
+
+/*
+** Attempt to enable blocking locks that block for nMs ms. Return 1 if
+** blocking locks are successfully enabled, or 0 otherwise.
+*/
+static int walEnableBlockingMs(Wal *pWal, int nMs){
+ int rc = sqlite3OsFileControl(
+ pWal->pDbFd, SQLITE_FCNTL_LOCK_TIMEOUT, (void*)&nMs
+ );
+ return (rc==SQLITE_OK);
+}
+
+/*
+** Attempt to enable blocking locks. Blocking locks are enabled only if (a)
+** they are supported by the VFS, and (b) the database handle is configured
+** with a busy-timeout. Return 1 if blocking locks are successfully enabled,
+** or 0 otherwise.
+*/
+static int walEnableBlocking(Wal *pWal){
+ int res = 0;
+ if( pWal->db ){
+ int tmout = pWal->db->busyTimeout;
+ if( tmout ){
+ res = walEnableBlockingMs(pWal, tmout);
+ }
+ }
+ return res;
+}
+
+/*
+** Disable blocking locks.
+*/
+static void walDisableBlocking(Wal *pWal){
+ int tmout = 0;
+ sqlite3OsFileControl(pWal->pDbFd, SQLITE_FCNTL_LOCK_TIMEOUT, (void*)&tmout);
+}
+
+/*
+** If parameter bLock is true, attempt to enable blocking locks, take
+** the WRITER lock, and then disable blocking locks. If blocking locks
+** cannot be enabled, no attempt to obtain the WRITER lock is made. Return
+** an SQLite error code if an error occurs, or SQLITE_OK otherwise. It is not
+** an error if blocking locks can not be enabled.
+**
+** If the bLock parameter is false and the WRITER lock is held, release it.
+*/
+SQLITE_PRIVATE int sqlite3WalWriteLock(Wal *pWal, int bLock){
+ int rc = SQLITE_OK;
+ assert( pWal->readLock<0 || bLock==0 );
+ if( bLock ){
+ assert( pWal->db );
+ if( walEnableBlocking(pWal) ){
+ rc = walLockExclusive(pWal, WAL_WRITE_LOCK, 1);
+ if( rc==SQLITE_OK ){
+ pWal->writeLock = 1;
+ }
+ walDisableBlocking(pWal);
+ }
+ }else if( pWal->writeLock ){
+ walUnlockExclusive(pWal, WAL_WRITE_LOCK, 1);
+ pWal->writeLock = 0;
+ }
+ return rc;
+}
+
+/*
+** Set the database handle used to determine if blocking locks are required.
+*/
+SQLITE_PRIVATE void sqlite3WalDb(Wal *pWal, sqlite3 *db){
+ pWal->db = db;
+}
+
+#else
+# define walEnableBlocking(x) 0
+# define walDisableBlocking(x)
+# define walEnableBlockingMs(pWal, ms) 0
+# define sqlite3WalDb(pWal, db)
+#endif /* ifdef SQLITE_ENABLE_SETLK_TIMEOUT */
+
+
+/*
+** Attempt to obtain the exclusive WAL lock defined by parameters lockIdx and
+** n. If the attempt fails and parameter xBusy is not NULL, then it is a
+** busy-handler function. Invoke it and retry the lock until either the
+** lock is successfully obtained or the busy-handler returns 0.
+*/
+static int walBusyLock(
+ Wal *pWal, /* WAL connection */
+ int (*xBusy)(void*), /* Function to call when busy */
+ void *pBusyArg, /* Context argument for xBusyHandler */
+ int lockIdx, /* Offset of first byte to lock */
+ int n /* Number of bytes to lock */
+){
+ int rc;
+ do {
+ rc = walLockExclusive(pWal, lockIdx, n);
+ }while( xBusy && rc==SQLITE_BUSY && xBusy(pBusyArg) );
+#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
+ if( rc==SQLITE_BUSY_TIMEOUT ){
+ walDisableBlocking(pWal);
+ rc = SQLITE_BUSY;
+ }
+#endif
+ return rc;
+}
+
+/*
+** The cache of the wal-index header must be valid to call this function.
+** Return the page-size in bytes used by the database.
+*/
+static int walPagesize(Wal *pWal){
+ return (pWal->hdr.szPage&0xfe00) + ((pWal->hdr.szPage&0x0001)<<16);
+}
+
+/*
+** The following is guaranteed when this function is called:
+**
+** a) the WRITER lock is held,
+** b) the entire log file has been checkpointed, and
+** c) any existing readers are reading exclusively from the database
+** file - there are no readers that may attempt to read a frame from
+** the log file.
+**
+** This function updates the shared-memory structures so that the next
+** client to write to the database (which may be this one) does so by
+** writing frames into the start of the log file.
+**
+** The value of parameter salt1 is used as the aSalt[1] value in the
+** new wal-index header. It should be passed a pseudo-random value (i.e.
+** one obtained from sqlite3_randomness()).
+*/
+static void walRestartHdr(Wal *pWal, u32 salt1){
+ volatile WalCkptInfo *pInfo = walCkptInfo(pWal);
+ int i; /* Loop counter */
+ u32 *aSalt = pWal->hdr.aSalt; /* Big-endian salt values */
+ pWal->nCkpt++;
+ pWal->hdr.mxFrame = 0;
+ sqlite3Put4byte((u8*)&aSalt[0], 1 + sqlite3Get4byte((u8*)&aSalt[0]));
+ memcpy(&pWal->hdr.aSalt[1], &salt1, 4);
+ walIndexWriteHdr(pWal);
+ AtomicStore(&pInfo->nBackfill, 0);
+ pInfo->nBackfillAttempted = 0;
+ pInfo->aReadMark[1] = 0;
+ for(i=2; i<WAL_NREADER; i++) pInfo->aReadMark[i] = READMARK_NOT_USED;
+ assert( pInfo->aReadMark[0]==0 );
+}
+
+/*
+** Copy as much content as we can from the WAL back into the database file
+** in response to an sqlite3_wal_checkpoint() request or the equivalent.
+**
+** The amount of information copies from WAL to database might be limited
+** by active readers. This routine will never overwrite a database page
+** that a concurrent reader might be using.
+**
+** All I/O barrier operations (a.k.a fsyncs) occur in this routine when
+** SQLite is in WAL-mode in synchronous=NORMAL. That means that if
+** checkpoints are always run by a background thread or background
+** process, foreground threads will never block on a lengthy fsync call.
+**
+** Fsync is called on the WAL before writing content out of the WAL and
+** into the database. This ensures that if the new content is persistent
+** in the WAL and can be recovered following a power-loss or hard reset.
+**
+** Fsync is also called on the database file if (and only if) the entire
+** WAL content is copied into the database file. This second fsync makes
+** it safe to delete the WAL since the new content will persist in the
+** database file.
+**
+** This routine uses and updates the nBackfill field of the wal-index header.
+** This is the only routine that will increase the value of nBackfill.
+** (A WAL reset or recovery will revert nBackfill to zero, but not increase
+** its value.)
+**
+** The caller must be holding sufficient locks to ensure that no other
+** checkpoint is running (in any other thread or process) at the same
+** time.
+*/
+static int walCheckpoint(
+ Wal *pWal, /* Wal connection */
+ sqlite3 *db, /* Check for interrupts on this handle */
+ int eMode, /* One of PASSIVE, FULL or RESTART */
+ int (*xBusy)(void*), /* Function to call when busy */
+ void *pBusyArg, /* Context argument for xBusyHandler */
+ int sync_flags, /* Flags for OsSync() (or 0) */
+ u8 *zBuf /* Temporary buffer to use */
+){
+ int rc = SQLITE_OK; /* Return code */
+ int szPage; /* Database page-size */
+ WalIterator *pIter = 0; /* Wal iterator context */
+ u32 iDbpage = 0; /* Next database page to write */
+ u32 iFrame = 0; /* Wal frame containing data for iDbpage */
+ u32 mxSafeFrame; /* Max frame that can be backfilled */
+ u32 mxPage; /* Max database page to write */
+ int i; /* Loop counter */
+ volatile WalCkptInfo *pInfo; /* The checkpoint status information */
+
+ szPage = walPagesize(pWal);
+ testcase( szPage<=32768 );
+ testcase( szPage>=65536 );
+ pInfo = walCkptInfo(pWal);
+ if( pInfo->nBackfill<pWal->hdr.mxFrame ){
+
+ /* EVIDENCE-OF: R-62920-47450 The busy-handler callback is never invoked
+ ** in the SQLITE_CHECKPOINT_PASSIVE mode. */
+ assert( eMode!=SQLITE_CHECKPOINT_PASSIVE || xBusy==0 );
+
+ /* Compute in mxSafeFrame the index of the last frame of the WAL that is
+ ** safe to write into the database. Frames beyond mxSafeFrame might
+ ** overwrite database pages that are in use by active readers and thus
+ ** cannot be backfilled from the WAL.
+ */
+ mxSafeFrame = pWal->hdr.mxFrame;
+ mxPage = pWal->hdr.nPage;
+ for(i=1; i<WAL_NREADER; i++){
+ u32 y = AtomicLoad(pInfo->aReadMark+i); SEH_INJECT_FAULT;
+ if( mxSafeFrame>y ){
+ assert( y<=pWal->hdr.mxFrame );
+ rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(i), 1);
+ if( rc==SQLITE_OK ){
+ u32 iMark = (i==1 ? mxSafeFrame : READMARK_NOT_USED);
+ AtomicStore(pInfo->aReadMark+i, iMark); SEH_INJECT_FAULT;
+ walUnlockExclusive(pWal, WAL_READ_LOCK(i), 1);
+ }else if( rc==SQLITE_BUSY ){
+ mxSafeFrame = y;
+ xBusy = 0;
+ }else{
+ goto walcheckpoint_out;
+ }
+ }
+ }
+
+ /* Allocate the iterator */
+ if( pInfo->nBackfill<mxSafeFrame ){
+ rc = walIteratorInit(pWal, pInfo->nBackfill, &pIter);
+ assert( rc==SQLITE_OK || pIter==0 );
+ }
+
+ if( pIter
+ && (rc = walBusyLock(pWal,xBusy,pBusyArg,WAL_READ_LOCK(0),1))==SQLITE_OK
+ ){
+ u32 nBackfill = pInfo->nBackfill;
+ pInfo->nBackfillAttempted = mxSafeFrame; SEH_INJECT_FAULT;
+
+ /* Sync the WAL to disk */
+ rc = sqlite3OsSync(pWal->pWalFd, CKPT_SYNC_FLAGS(sync_flags));
+
+ /* If the database may grow as a result of this checkpoint, hint
+ ** about the eventual size of the db file to the VFS layer.
+ */
+ if( rc==SQLITE_OK ){
+ i64 nReq = ((i64)mxPage * szPage);
+ i64 nSize; /* Current size of database file */
+ sqlite3OsFileControl(pWal->pDbFd, SQLITE_FCNTL_CKPT_START, 0);
+ rc = sqlite3OsFileSize(pWal->pDbFd, &nSize);
+ if( rc==SQLITE_OK && nSize<nReq ){
+ if( (nSize+65536+(i64)pWal->hdr.mxFrame*szPage)<nReq ){
+ /* If the size of the final database is larger than the current
+ ** database plus the amount of data in the wal file, plus the
+ ** maximum size of the pending-byte page (65536 bytes), then
+ ** must be corruption somewhere. */
+ rc = SQLITE_CORRUPT_BKPT;
+ }else{
+ sqlite3OsFileControlHint(pWal->pDbFd, SQLITE_FCNTL_SIZE_HINT,&nReq);
+ }
+ }
+
+ }
+
+ /* Iterate through the contents of the WAL, copying data to the db file */
+ while( rc==SQLITE_OK && 0==walIteratorNext(pIter, &iDbpage, &iFrame) ){
+ i64 iOffset;
+ assert( walFramePgno(pWal, iFrame)==iDbpage );
+ SEH_INJECT_FAULT;
+ if( AtomicLoad(&db->u1.isInterrupted) ){
+ rc = db->mallocFailed ? SQLITE_NOMEM_BKPT : SQLITE_INTERRUPT;
+ break;
+ }
+ if( iFrame<=nBackfill || iFrame>mxSafeFrame || iDbpage>mxPage ){
+ continue;
+ }
+ iOffset = walFrameOffset(iFrame, szPage) + WAL_FRAME_HDRSIZE;
+ /* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL file */
+ rc = sqlite3OsRead(pWal->pWalFd, zBuf, szPage, iOffset);
+ if( rc!=SQLITE_OK ) break;
+ iOffset = (iDbpage-1)*(i64)szPage;
+ testcase( IS_BIG_INT(iOffset) );
+ rc = sqlite3OsWrite(pWal->pDbFd, zBuf, szPage, iOffset);
+ if( rc!=SQLITE_OK ) break;
+ }
+ sqlite3OsFileControl(pWal->pDbFd, SQLITE_FCNTL_CKPT_DONE, 0);
+
+ /* If work was actually accomplished... */
+ if( rc==SQLITE_OK ){
+ if( mxSafeFrame==walIndexHdr(pWal)->mxFrame ){
+ i64 szDb = pWal->hdr.nPage*(i64)szPage;
+ testcase( IS_BIG_INT(szDb) );
+ rc = sqlite3OsTruncate(pWal->pDbFd, szDb);
+ if( rc==SQLITE_OK ){
+ rc = sqlite3OsSync(pWal->pDbFd, CKPT_SYNC_FLAGS(sync_flags));
+ }
+ }
+ if( rc==SQLITE_OK ){
+ AtomicStore(&pInfo->nBackfill, mxSafeFrame); SEH_INJECT_FAULT;
+ }
+ }
+
+ /* Release the reader lock held while backfilling */
+ walUnlockExclusive(pWal, WAL_READ_LOCK(0), 1);
+ }
+
+ if( rc==SQLITE_BUSY ){
+ /* Reset the return code so as not to report a checkpoint failure
+ ** just because there are active readers. */
+ rc = SQLITE_OK;
+ }
+ }
+
+ /* If this is an SQLITE_CHECKPOINT_RESTART or TRUNCATE operation, and the
+ ** entire wal file has been copied into the database file, then block
+ ** until all readers have finished using the wal file. This ensures that
+ ** the next process to write to the database restarts the wal file.
+ */
+ if( rc==SQLITE_OK && eMode!=SQLITE_CHECKPOINT_PASSIVE ){
+ assert( pWal->writeLock );
+ SEH_INJECT_FAULT;
+ if( pInfo->nBackfill<pWal->hdr.mxFrame ){
+ rc = SQLITE_BUSY;
+ }else if( eMode>=SQLITE_CHECKPOINT_RESTART ){
+ u32 salt1;
+ sqlite3_randomness(4, &salt1);
+ assert( pInfo->nBackfill==pWal->hdr.mxFrame );
+ rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(1), WAL_NREADER-1);
+ if( rc==SQLITE_OK ){
+ if( eMode==SQLITE_CHECKPOINT_TRUNCATE ){
+ /* IMPLEMENTATION-OF: R-44699-57140 This mode works the same way as
+ ** SQLITE_CHECKPOINT_RESTART with the addition that it also
+ ** truncates the log file to zero bytes just prior to a
+ ** successful return.
+ **
+ ** In theory, it might be safe to do this without updating the
+ ** wal-index header in shared memory, as all subsequent reader or
+ ** writer clients should see that the entire log file has been
+ ** checkpointed and behave accordingly. This seems unsafe though,
+ ** as it would leave the system in a state where the contents of
+ ** the wal-index header do not match the contents of the
+ ** file-system. To avoid this, update the wal-index header to
+ ** indicate that the log file contains zero valid frames. */
+ walRestartHdr(pWal, salt1);
+ rc = sqlite3OsTruncate(pWal->pWalFd, 0);
+ }
+ walUnlockExclusive(pWal, WAL_READ_LOCK(1), WAL_NREADER-1);
+ }
+ }
+ }
+
+ walcheckpoint_out:
+ SEH_FREE_ON_ERROR(pIter, 0);
+ walIteratorFree(pIter);
+ return rc;
+}
+
+/*
+** If the WAL file is currently larger than nMax bytes in size, truncate
+** it to exactly nMax bytes. If an error occurs while doing so, ignore it.
+*/
+static void walLimitSize(Wal *pWal, i64 nMax){
+ i64 sz;
+ int rx;
+ sqlite3BeginBenignMalloc();
+ rx = sqlite3OsFileSize(pWal->pWalFd, &sz);
+ if( rx==SQLITE_OK && (sz > nMax ) ){
+ rx = sqlite3OsTruncate(pWal->pWalFd, nMax);
+ }
+ sqlite3EndBenignMalloc();
+ if( rx ){
+ sqlite3_log(rx, "cannot limit WAL size: %s", pWal->zWalName);
+ }
+}
+
+#ifdef SQLITE_USE_SEH
+/*
+** This is the "standard" exception handler used in a few places to handle
+** an exception thrown by reading from the *-shm mapping after it has become
+** invalid in SQLITE_USE_SEH builds. It is used as follows:
+**
+** SEH_TRY { ... }
+** SEH_EXCEPT( rc = walHandleException(pWal); )
+**
+** This function does three things:
+**
+** 1) Determines the locks that should be held, based on the contents of
+** the Wal.readLock, Wal.writeLock and Wal.ckptLock variables. All other
+** held locks are assumed to be transient locks that would have been
+** released had the exception not been thrown and are dropped.
+**
+** 2) Frees the pointer at Wal.pFree, if any, using sqlite3_free().
+**
+** 3) Set pWal->apWiData[pWal->iWiPg] to pWal->pWiValue if not NULL
+**
+** 4) Returns SQLITE_IOERR.
+*/
+static int walHandleException(Wal *pWal){
+ if( pWal->exclusiveMode==0 ){
+ static const int S = 1;
+ static const int E = (1<<SQLITE_SHM_NLOCK);
+ int ii;
+ u32 mUnlock = pWal->lockMask & ~(
+ (pWal->readLock<0 ? 0 : (S << WAL_READ_LOCK(pWal->readLock)))
+ | (pWal->writeLock ? (E << WAL_WRITE_LOCK) : 0)
+ | (pWal->ckptLock ? (E << WAL_CKPT_LOCK) : 0)
+ );
+ for(ii=0; ii<SQLITE_SHM_NLOCK; ii++){
+ if( (S<<ii) & mUnlock ) walUnlockShared(pWal, ii);
+ if( (E<<ii) & mUnlock ) walUnlockExclusive(pWal, ii, 1);
+ }
+ }
+ sqlite3_free(pWal->pFree);
+ pWal->pFree = 0;
+ if( pWal->pWiValue ){
+ pWal->apWiData[pWal->iWiPg] = pWal->pWiValue;
+ pWal->pWiValue = 0;
+ }
+ return SQLITE_IOERR_IN_PAGE;
+}
+
+/*
+** Assert that the Wal.lockMask mask, which indicates the locks held
+** by the connection, is consistent with the Wal.readLock, Wal.writeLock
+** and Wal.ckptLock variables. To be used as:
+**
+** assert( walAssertLockmask(pWal) );
+*/
+static int walAssertLockmask(Wal *pWal){
+ if( pWal->exclusiveMode==0 ){
+ static const int S = 1;
+ static const int E = (1<<SQLITE_SHM_NLOCK);
+ u32 mExpect = (
+ (pWal->readLock<0 ? 0 : (S << WAL_READ_LOCK(pWal->readLock)))
+ | (pWal->writeLock ? (E << WAL_WRITE_LOCK) : 0)
+ | (pWal->ckptLock ? (E << WAL_CKPT_LOCK) : 0)
+#ifdef SQLITE_ENABLE_SNAPSHOT
+ | (pWal->pSnapshot ? (pWal->lockMask & (1 << WAL_CKPT_LOCK)) : 0)
+#endif
+ );
+ assert( mExpect==pWal->lockMask );
+ }
+ return 1;
+}
+
+/*
+** Return and zero the "system error" field set when an
+** EXCEPTION_IN_PAGE_ERROR exception is caught.
+*/
+SQLITE_PRIVATE int sqlite3WalSystemErrno(Wal *pWal){
+ int iRet = 0;
+ if( pWal ){
+ iRet = pWal->iSysErrno;
+ pWal->iSysErrno = 0;
+ }
+ return iRet;
+}
+
+#else
+# define walAssertLockmask(x) 1
+#endif /* ifdef SQLITE_USE_SEH */
+
+/*
+** Close a connection to a log file.
+*/
+SQLITE_PRIVATE int sqlite3WalClose(
+ Wal *pWal, /* Wal to close */
+ sqlite3 *db, /* For interrupt flag */
+ int sync_flags, /* Flags to pass to OsSync() (or 0) */
+ int nBuf,
+ u8 *zBuf /* Buffer of at least nBuf bytes */
+){
+ int rc = SQLITE_OK;
+ if( pWal ){
+ int isDelete = 0; /* True to unlink wal and wal-index files */
+
+ assert( walAssertLockmask(pWal) );
+
+ /* If an EXCLUSIVE lock can be obtained on the database file (using the
+ ** ordinary, rollback-mode locking methods, this guarantees that the
+ ** connection associated with this log file is the only connection to
+ ** the database. In this case checkpoint the database and unlink both
+ ** the wal and wal-index files.
+ **
+ ** The EXCLUSIVE lock is not released before returning.
+ */
+ if( zBuf!=0
+ && SQLITE_OK==(rc = sqlite3OsLock(pWal->pDbFd, SQLITE_LOCK_EXCLUSIVE))
+ ){
+ if( pWal->exclusiveMode==WAL_NORMAL_MODE ){
+ pWal->exclusiveMode = WAL_EXCLUSIVE_MODE;
+ }
+ rc = sqlite3WalCheckpoint(pWal, db,
+ SQLITE_CHECKPOINT_PASSIVE, 0, 0, sync_flags, nBuf, zBuf, 0, 0
+ );
+ if( rc==SQLITE_OK ){
+ int bPersist = -1;
+ sqlite3OsFileControlHint(
+ pWal->pDbFd, SQLITE_FCNTL_PERSIST_WAL, &bPersist
+ );
+ if( bPersist!=1 ){
+ /* Try to delete the WAL file if the checkpoint completed and
+ ** fsynced (rc==SQLITE_OK) and if we are not in persistent-wal
+ ** mode (!bPersist) */
+ isDelete = 1;
+ }else if( pWal->mxWalSize>=0 ){
+ /* Try to truncate the WAL file to zero bytes if the checkpoint
+ ** completed and fsynced (rc==SQLITE_OK) and we are in persistent
+ ** WAL mode (bPersist) and if the PRAGMA journal_size_limit is a
+ ** non-negative value (pWal->mxWalSize>=0). Note that we truncate
+ ** to zero bytes as truncating to the journal_size_limit might
+ ** leave a corrupt WAL file on disk. */
+ walLimitSize(pWal, 0);
+ }
+ }
+ }
+
+ walIndexClose(pWal, isDelete);
+ sqlite3OsClose(pWal->pWalFd);
+ if( isDelete ){
+ sqlite3BeginBenignMalloc();
+ sqlite3OsDelete(pWal->pVfs, pWal->zWalName, 0);
+ sqlite3EndBenignMalloc();
+ }
+ WALTRACE(("WAL%p: closed\n", pWal));
+ sqlite3_free((void *)pWal->apWiData);
+ sqlite3_free(pWal);
+ }
+ return rc;
+}
+
+/*
+** Try to read the wal-index header. Return 0 on success and 1 if
+** there is a problem.
+**
+** The wal-index is in shared memory. Another thread or process might
+** be writing the header at the same time this procedure is trying to
+** read it, which might result in inconsistency. A dirty read is detected
+** by verifying that both copies of the header are the same and also by
+** a checksum on the header.
+**
+** If and only if the read is consistent and the header is different from
+** pWal->hdr, then pWal->hdr is updated to the content of the new header
+** and *pChanged is set to 1.
+**
+** If the checksum cannot be verified return non-zero. If the header
+** is read successfully and the checksum verified, return zero.
+*/
+static SQLITE_NO_TSAN int walIndexTryHdr(Wal *pWal, int *pChanged){
+ u32 aCksum[2]; /* Checksum on the header content */
+ WalIndexHdr h1, h2; /* Two copies of the header content */
+ WalIndexHdr volatile *aHdr; /* Header in shared memory */
+
+ /* The first page of the wal-index must be mapped at this point. */
+ assert( pWal->nWiData>0 && pWal->apWiData[0] );
+
+ /* Read the header. This might happen concurrently with a write to the
+ ** same area of shared memory on a different CPU in a SMP,
+ ** meaning it is possible that an inconsistent snapshot is read
+ ** from the file. If this happens, return non-zero.
+ **
+ ** tag-20200519-1:
+ ** There are two copies of the header at the beginning of the wal-index.
+ ** When reading, read [0] first then [1]. Writes are in the reverse order.
+ ** Memory barriers are used to prevent the compiler or the hardware from
+ ** reordering the reads and writes. TSAN and similar tools can sometimes
+ ** give false-positive warnings about these accesses because the tools do not
+ ** account for the double-read and the memory barrier. The use of mutexes
+ ** here would be problematic as the memory being accessed is potentially
+ ** shared among multiple processes and not all mutex implementations work
+ ** reliably in that environment.
+ */
+ aHdr = walIndexHdr(pWal);
+ memcpy(&h1, (void *)&aHdr[0], sizeof(h1)); /* Possible TSAN false-positive */
+ walShmBarrier(pWal);
+ memcpy(&h2, (void *)&aHdr[1], sizeof(h2));
+
+ if( memcmp(&h1, &h2, sizeof(h1))!=0 ){
+ return 1; /* Dirty read */
+ }
+ if( h1.isInit==0 ){
+ return 1; /* Malformed header - probably all zeros */
+ }
+ walChecksumBytes(1, (u8*)&h1, sizeof(h1)-sizeof(h1.aCksum), 0, aCksum);
+ if( aCksum[0]!=h1.aCksum[0] || aCksum[1]!=h1.aCksum[1] ){
+ return 1; /* Checksum does not match */
+ }
+
+ if( memcmp(&pWal->hdr, &h1, sizeof(WalIndexHdr)) ){
+ *pChanged = 1;
+ memcpy(&pWal->hdr, &h1, sizeof(WalIndexHdr));
+ pWal->szPage = (pWal->hdr.szPage&0xfe00) + ((pWal->hdr.szPage&0x0001)<<16);
+ testcase( pWal->szPage<=32768 );
+ testcase( pWal->szPage>=65536 );
+ }
+
+ /* The header was successfully read. Return zero. */
+ return 0;
+}
+
+/*
+** This is the value that walTryBeginRead returns when it needs to
+** be retried.
+*/
+#define WAL_RETRY (-1)
+
+/*
+** Read the wal-index header from the wal-index and into pWal->hdr.
+** If the wal-header appears to be corrupt, try to reconstruct the
+** wal-index from the WAL before returning.
+**
+** Set *pChanged to 1 if the wal-index header value in pWal->hdr is
+** changed by this operation. If pWal->hdr is unchanged, set *pChanged
+** to 0.
+**
+** If the wal-index header is successfully read, return SQLITE_OK.
+** Otherwise an SQLite error code.
+*/
+static int walIndexReadHdr(Wal *pWal, int *pChanged){
+ int rc; /* Return code */
+ int badHdr; /* True if a header read failed */
+ volatile u32 *page0; /* Chunk of wal-index containing header */
+
+ /* Ensure that page 0 of the wal-index (the page that contains the
+ ** wal-index header) is mapped. Return early if an error occurs here.
+ */
+ assert( pChanged );
+ rc = walIndexPage(pWal, 0, &page0);
+ if( rc!=SQLITE_OK ){
+ assert( rc!=SQLITE_READONLY ); /* READONLY changed to OK in walIndexPage */
+ if( rc==SQLITE_READONLY_CANTINIT ){
+ /* The SQLITE_READONLY_CANTINIT return means that the shared-memory
+ ** was openable but is not writable, and this thread is unable to
+ ** confirm that another write-capable connection has the shared-memory
+ ** open, and hence the content of the shared-memory is unreliable,
+ ** since the shared-memory might be inconsistent with the WAL file
+ ** and there is no writer on hand to fix it. */
+ assert( page0==0 );
+ assert( pWal->writeLock==0 );
+ assert( pWal->readOnly & WAL_SHM_RDONLY );
+ pWal->bShmUnreliable = 1;
+ pWal->exclusiveMode = WAL_HEAPMEMORY_MODE;
+ *pChanged = 1;
+ }else{
+ return rc; /* Any other non-OK return is just an error */
+ }
+ }else{
+ /* page0 can be NULL if the SHM is zero bytes in size and pWal->writeLock
+ ** is zero, which prevents the SHM from growing */
+ testcase( page0!=0 );
+ }
+ assert( page0!=0 || pWal->writeLock==0 );
+
+ /* If the first page of the wal-index has been mapped, try to read the
+ ** wal-index header immediately, without holding any lock. This usually
+ ** works, but may fail if the wal-index header is corrupt or currently
+ ** being modified by another thread or process.
+ */
+ badHdr = (page0 ? walIndexTryHdr(pWal, pChanged) : 1);
+
+ /* If the first attempt failed, it might have been due to a race
+ ** with a writer. So get a WRITE lock and try again.
+ */
+ if( badHdr ){
+ if( pWal->bShmUnreliable==0 && (pWal->readOnly & WAL_SHM_RDONLY) ){
+ if( SQLITE_OK==(rc = walLockShared(pWal, WAL_WRITE_LOCK)) ){
+ walUnlockShared(pWal, WAL_WRITE_LOCK);
+ rc = SQLITE_READONLY_RECOVERY;
+ }
+ }else{
+ int bWriteLock = pWal->writeLock;
+ if( bWriteLock
+ || SQLITE_OK==(rc = walLockExclusive(pWal, WAL_WRITE_LOCK, 1))
+ ){
+ pWal->writeLock = 1;
+ if( SQLITE_OK==(rc = walIndexPage(pWal, 0, &page0)) ){
+ badHdr = walIndexTryHdr(pWal, pChanged);
+ if( badHdr ){
+ /* If the wal-index header is still malformed even while holding
+ ** a WRITE lock, it can only mean that the header is corrupted and
+ ** needs to be reconstructed. So run recovery to do exactly that.
+ ** Disable blocking locks first. */
+ walDisableBlocking(pWal);
+ rc = walIndexRecover(pWal);
+ *pChanged = 1;
+ }
+ }
+ if( bWriteLock==0 ){
+ pWal->writeLock = 0;
+ walUnlockExclusive(pWal, WAL_WRITE_LOCK, 1);
+ }
+ }
+ }
+ }
+
+ /* If the header is read successfully, check the version number to make
+ ** sure the wal-index was not constructed with some future format that
+ ** this version of SQLite cannot understand.
+ */
+ if( badHdr==0 && pWal->hdr.iVersion!=WALINDEX_MAX_VERSION ){
+ rc = SQLITE_CANTOPEN_BKPT;
+ }
+ if( pWal->bShmUnreliable ){
+ if( rc!=SQLITE_OK ){
+ walIndexClose(pWal, 0);
+ pWal->bShmUnreliable = 0;
+ assert( pWal->nWiData>0 && pWal->apWiData[0]==0 );
+ /* walIndexRecover() might have returned SHORT_READ if a concurrent
+ ** writer truncated the WAL out from under it. If that happens, it
+ ** indicates that a writer has fixed the SHM file for us, so retry */
+ if( rc==SQLITE_IOERR_SHORT_READ ) rc = WAL_RETRY;
+ }
+ pWal->exclusiveMode = WAL_NORMAL_MODE;
+ }
+
+ return rc;
+}
+
+/*
+** Open a transaction in a connection where the shared-memory is read-only
+** and where we cannot verify that there is a separate write-capable connection
+** on hand to keep the shared-memory up-to-date with the WAL file.
+**
+** This can happen, for example, when the shared-memory is implemented by
+** memory-mapping a *-shm file, where a prior writer has shut down and
+** left the *-shm file on disk, and now the present connection is trying
+** to use that database but lacks write permission on the *-shm file.
+** Other scenarios are also possible, depending on the VFS implementation.
+**
+** Precondition:
+**
+** The *-wal file has been read and an appropriate wal-index has been
+** constructed in pWal->apWiData[] using heap memory instead of shared
+** memory.
+**
+** If this function returns SQLITE_OK, then the read transaction has
+** been successfully opened. In this case output variable (*pChanged)
+** is set to true before returning if the caller should discard the
+** contents of the page cache before proceeding. Or, if it returns
+** WAL_RETRY, then the heap memory wal-index has been discarded and
+** the caller should retry opening the read transaction from the
+** beginning (including attempting to map the *-shm file).
+**
+** If an error occurs, an SQLite error code is returned.
+*/
+static int walBeginShmUnreliable(Wal *pWal, int *pChanged){
+ i64 szWal; /* Size of wal file on disk in bytes */
+ i64 iOffset; /* Current offset when reading wal file */
+ u8 aBuf[WAL_HDRSIZE]; /* Buffer to load WAL header into */
+ u8 *aFrame = 0; /* Malloc'd buffer to load entire frame */
+ int szFrame; /* Number of bytes in buffer aFrame[] */
+ u8 *aData; /* Pointer to data part of aFrame buffer */
+ volatile void *pDummy; /* Dummy argument for xShmMap */
+ int rc; /* Return code */
+ u32 aSaveCksum[2]; /* Saved copy of pWal->hdr.aFrameCksum */
+
+ assert( pWal->bShmUnreliable );
+ assert( pWal->readOnly & WAL_SHM_RDONLY );
+ assert( pWal->nWiData>0 && pWal->apWiData[0] );
+
+ /* Take WAL_READ_LOCK(0). This has the effect of preventing any
+ ** writers from running a checkpoint, but does not stop them
+ ** from running recovery. */
+ rc = walLockShared(pWal, WAL_READ_LOCK(0));
+ if( rc!=SQLITE_OK ){
+ if( rc==SQLITE_BUSY ) rc = WAL_RETRY;
+ goto begin_unreliable_shm_out;
+ }
+ pWal->readLock = 0;
+
+ /* Check to see if a separate writer has attached to the shared-memory area,
+ ** thus making the shared-memory "reliable" again. Do this by invoking
+ ** the xShmMap() routine of the VFS and looking to see if the return
+ ** is SQLITE_READONLY instead of SQLITE_READONLY_CANTINIT.
+ **
+ ** If the shared-memory is now "reliable" return WAL_RETRY, which will
+ ** cause the heap-memory WAL-index to be discarded and the actual
+ ** shared memory to be used in its place.
+ **
+ ** This step is important because, even though this connection is holding
+ ** the WAL_READ_LOCK(0) which prevents a checkpoint, a writer might
+ ** have already checkpointed the WAL file and, while the current
+ ** is active, wrap the WAL and start overwriting frames that this
+ ** process wants to use.
+ **
+ ** Once sqlite3OsShmMap() has been called for an sqlite3_file and has
+ ** returned any SQLITE_READONLY value, it must return only SQLITE_READONLY
+ ** or SQLITE_READONLY_CANTINIT or some error for all subsequent invocations,
+ ** even if some external agent does a "chmod" to make the shared-memory
+ ** writable by us, until sqlite3OsShmUnmap() has been called.
+ ** This is a requirement on the VFS implementation.
+ */
+ rc = sqlite3OsShmMap(pWal->pDbFd, 0, WALINDEX_PGSZ, 0, &pDummy);
+ assert( rc!=SQLITE_OK ); /* SQLITE_OK not possible for read-only connection */
+ if( rc!=SQLITE_READONLY_CANTINIT ){
+ rc = (rc==SQLITE_READONLY ? WAL_RETRY : rc);
+ goto begin_unreliable_shm_out;
+ }
+
+ /* We reach this point only if the real shared-memory is still unreliable.
+ ** Assume the in-memory WAL-index substitute is correct and load it
+ ** into pWal->hdr.
+ */
+ memcpy(&pWal->hdr, (void*)walIndexHdr(pWal), sizeof(WalIndexHdr));
+
+ /* Make sure some writer hasn't come in and changed the WAL file out
+ ** from under us, then disconnected, while we were not looking.
+ */
+ rc = sqlite3OsFileSize(pWal->pWalFd, &szWal);
+ if( rc!=SQLITE_OK ){
+ goto begin_unreliable_shm_out;
+ }
+ if( szWal<WAL_HDRSIZE ){
+ /* If the wal file is too small to contain a wal-header and the
+ ** wal-index header has mxFrame==0, then it must be safe to proceed
+ ** reading the database file only. However, the page cache cannot
+ ** be trusted, as a read/write connection may have connected, written
+ ** the db, run a checkpoint, truncated the wal file and disconnected
+ ** since this client's last read transaction. */
+ *pChanged = 1;
+ rc = (pWal->hdr.mxFrame==0 ? SQLITE_OK : WAL_RETRY);
+ goto begin_unreliable_shm_out;
+ }
+
+ /* Check the salt keys at the start of the wal file still match. */
+ rc = sqlite3OsRead(pWal->pWalFd, aBuf, WAL_HDRSIZE, 0);
+ if( rc!=SQLITE_OK ){
+ goto begin_unreliable_shm_out;
+ }
+ if( memcmp(&pWal->hdr.aSalt, &aBuf[16], 8) ){
+ /* Some writer has wrapped the WAL file while we were not looking.
+ ** Return WAL_RETRY which will cause the in-memory WAL-index to be
+ ** rebuilt. */
+ rc = WAL_RETRY;
+ goto begin_unreliable_shm_out;
+ }
+
+ /* Allocate a buffer to read frames into */
+ assert( (pWal->szPage & (pWal->szPage-1))==0 );
+ assert( pWal->szPage>=512 && pWal->szPage<=65536 );
+ szFrame = pWal->szPage + WAL_FRAME_HDRSIZE;
+ aFrame = (u8 *)sqlite3_malloc64(szFrame);
+ if( aFrame==0 ){
+ rc = SQLITE_NOMEM_BKPT;
+ goto begin_unreliable_shm_out;
+ }
+ aData = &aFrame[WAL_FRAME_HDRSIZE];
+
+ /* Check to see if a complete transaction has been appended to the
+ ** wal file since the heap-memory wal-index was created. If so, the
+ ** heap-memory wal-index is discarded and WAL_RETRY returned to
+ ** the caller. */
+ aSaveCksum[0] = pWal->hdr.aFrameCksum[0];
+ aSaveCksum[1] = pWal->hdr.aFrameCksum[1];
+ for(iOffset=walFrameOffset(pWal->hdr.mxFrame+1, pWal->szPage);
+ iOffset+szFrame<=szWal;
+ iOffset+=szFrame
+ ){
+ u32 pgno; /* Database page number for frame */
+ u32 nTruncate; /* dbsize field from frame header */
+
+ /* Read and decode the next log frame. */
+ rc = sqlite3OsRead(pWal->pWalFd, aFrame, szFrame, iOffset);
+ if( rc!=SQLITE_OK ) break;
+ if( !walDecodeFrame(pWal, &pgno, &nTruncate, aData, aFrame) ) break;
+
+ /* If nTruncate is non-zero, then a complete transaction has been
+ ** appended to this wal file. Set rc to WAL_RETRY and break out of
+ ** the loop. */
+ if( nTruncate ){
+ rc = WAL_RETRY;
+ break;
+ }
+ }
+ pWal->hdr.aFrameCksum[0] = aSaveCksum[0];
+ pWal->hdr.aFrameCksum[1] = aSaveCksum[1];
+
+ begin_unreliable_shm_out:
+ sqlite3_free(aFrame);
+ if( rc!=SQLITE_OK ){
+ int i;
+ for(i=0; i<pWal->nWiData; i++){
+ sqlite3_free((void*)pWal->apWiData[i]);
+ pWal->apWiData[i] = 0;
+ }
+ pWal->bShmUnreliable = 0;
+ sqlite3WalEndReadTransaction(pWal);
+ *pChanged = 1;
+ }
+ return rc;
+}
+
+/*
+** The final argument passed to walTryBeginRead() is of type (int*). The
+** caller should invoke walTryBeginRead as follows:
+**
+** int cnt = 0;
+** do {
+** rc = walTryBeginRead(..., &cnt);
+** }while( rc==WAL_RETRY );
+**
+** The final value of "cnt" is of no use to the caller. It is used by
+** the implementation of walTryBeginRead() as follows:
+**
+** + Each time walTryBeginRead() is called, it is incremented. Once
+** it reaches WAL_RETRY_PROTOCOL_LIMIT - indicating that walTryBeginRead()
+** has many times been invoked and failed with WAL_RETRY - walTryBeginRead()
+** returns SQLITE_PROTOCOL.
+**
+** + If SQLITE_ENABLE_SETLK_TIMEOUT is defined and walTryBeginRead() failed
+** because a blocking lock timed out (SQLITE_BUSY_TIMEOUT from the OS
+** layer), the WAL_RETRY_BLOCKED_MASK bit is set in "cnt". In this case
+** the next invocation of walTryBeginRead() may omit an expected call to
+** sqlite3OsSleep(). There has already been a delay when the previous call
+** waited on a lock.
+*/
+#define WAL_RETRY_PROTOCOL_LIMIT 100
+#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
+# define WAL_RETRY_BLOCKED_MASK 0x10000000
+#else
+# define WAL_RETRY_BLOCKED_MASK 0
+#endif
+
+/*
+** Attempt to start a read transaction. This might fail due to a race or
+** other transient condition. When that happens, it returns WAL_RETRY to
+** indicate to the caller that it is safe to retry immediately.
+**
+** On success return SQLITE_OK. On a permanent failure (such an
+** I/O error or an SQLITE_BUSY because another process is running
+** recovery) return a positive error code.
+**
+** The useWal parameter is true to force the use of the WAL and disable
+** the case where the WAL is bypassed because it has been completely
+** checkpointed. If useWal==0 then this routine calls walIndexReadHdr()
+** to make a copy of the wal-index header into pWal->hdr. If the
+** wal-index header has changed, *pChanged is set to 1 (as an indication
+** to the caller that the local page cache is obsolete and needs to be
+** flushed.) When useWal==1, the wal-index header is assumed to already
+** be loaded and the pChanged parameter is unused.
+**
+** The caller must set the cnt parameter to the number of prior calls to
+** this routine during the current read attempt that returned WAL_RETRY.
+** This routine will start taking more aggressive measures to clear the
+** race conditions after multiple WAL_RETRY returns, and after an excessive
+** number of errors will ultimately return SQLITE_PROTOCOL. The
+** SQLITE_PROTOCOL return indicates that some other process has gone rogue
+** and is not honoring the locking protocol. There is a vanishingly small
+** chance that SQLITE_PROTOCOL could be returned because of a run of really
+** bad luck when there is lots of contention for the wal-index, but that
+** possibility is so small that it can be safely neglected, we believe.
+**
+** On success, this routine obtains a read lock on
+** WAL_READ_LOCK(pWal->readLock). The pWal->readLock integer is
+** in the range 0 <= pWal->readLock < WAL_NREADER. If pWal->readLock==(-1)
+** that means the Wal does not hold any read lock. The reader must not
+** access any database page that is modified by a WAL frame up to and
+** including frame number aReadMark[pWal->readLock]. The reader will
+** use WAL frames up to and including pWal->hdr.mxFrame if pWal->readLock>0
+** Or if pWal->readLock==0, then the reader will ignore the WAL
+** completely and get all content directly from the database file.
+** If the useWal parameter is 1 then the WAL will never be ignored and
+** this routine will always set pWal->readLock>0 on success.
+** When the read transaction is completed, the caller must release the
+** lock on WAL_READ_LOCK(pWal->readLock) and set pWal->readLock to -1.
+**
+** This routine uses the nBackfill and aReadMark[] fields of the header
+** to select a particular WAL_READ_LOCK() that strives to let the
+** checkpoint process do as much work as possible. This routine might
+** update values of the aReadMark[] array in the header, but if it does
+** so it takes care to hold an exclusive lock on the corresponding
+** WAL_READ_LOCK() while changing values.
+*/
+static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int *pCnt){
+ volatile WalCkptInfo *pInfo; /* Checkpoint information in wal-index */
+ int rc = SQLITE_OK; /* Return code */
+#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
+ int nBlockTmout = 0;
+#endif
+
+ assert( pWal->readLock<0 ); /* Not currently locked */
+
+ /* useWal may only be set for read/write connections */
+ assert( (pWal->readOnly & WAL_SHM_RDONLY)==0 || useWal==0 );
+
+ /* Take steps to avoid spinning forever if there is a protocol error.
+ **
+ ** Circumstances that cause a RETRY should only last for the briefest
+ ** instances of time. No I/O or other system calls are done while the
+ ** locks are held, so the locks should not be held for very long. But
+ ** if we are unlucky, another process that is holding a lock might get
+ ** paged out or take a page-fault that is time-consuming to resolve,
+ ** during the few nanoseconds that it is holding the lock. In that case,
+ ** it might take longer than normal for the lock to free.
+ **
+ ** After 5 RETRYs, we begin calling sqlite3OsSleep(). The first few
+ ** calls to sqlite3OsSleep() have a delay of 1 microsecond. Really this
+ ** is more of a scheduler yield than an actual delay. But on the 10th
+ ** an subsequent retries, the delays start becoming longer and longer,
+ ** so that on the 100th (and last) RETRY we delay for 323 milliseconds.
+ ** The total delay time before giving up is less than 10 seconds.
+ */
+ (*pCnt)++;
+ if( *pCnt>5 ){
+ int nDelay = 1; /* Pause time in microseconds */
+ int cnt = (*pCnt & ~WAL_RETRY_BLOCKED_MASK);
+ if( cnt>WAL_RETRY_PROTOCOL_LIMIT ){
+ VVA_ONLY( pWal->lockError = 1; )
+ return SQLITE_PROTOCOL;
+ }
+ if( *pCnt>=10 ) nDelay = (cnt-9)*(cnt-9)*39;
+#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
+ /* In SQLITE_ENABLE_SETLK_TIMEOUT builds, configure the file-descriptor
+ ** to block for locks for approximately nDelay us. This affects three
+ ** locks: (a) the shared lock taken on the DMS slot in os_unix.c (if
+ ** using os_unix.c), (b) the WRITER lock taken in walIndexReadHdr() if the
+ ** first attempted read fails, and (c) the shared lock taken on the
+ ** read-mark.
+ **
+ ** If the previous call failed due to an SQLITE_BUSY_TIMEOUT error,
+ ** then sleep for the minimum of 1us. The previous call already provided
+ ** an extra delay while it was blocking on the lock.
+ */
+ nBlockTmout = (nDelay+998) / 1000;
+ if( !useWal && walEnableBlockingMs(pWal, nBlockTmout) ){
+ if( *pCnt & WAL_RETRY_BLOCKED_MASK ) nDelay = 1;
+ }
+#endif
+ sqlite3OsSleep(pWal->pVfs, nDelay);
+ *pCnt &= ~WAL_RETRY_BLOCKED_MASK;
+ }
+
+ if( !useWal ){
+ assert( rc==SQLITE_OK );
+ if( pWal->bShmUnreliable==0 ){
+ rc = walIndexReadHdr(pWal, pChanged);
+ }
+#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
+ walDisableBlocking(pWal);
+ if( rc==SQLITE_BUSY_TIMEOUT ){
+ rc = SQLITE_BUSY;
+ *pCnt |= WAL_RETRY_BLOCKED_MASK;
+ }
+#endif
+ if( rc==SQLITE_BUSY ){
+ /* If there is not a recovery running in another thread or process
+ ** then convert BUSY errors to WAL_RETRY. If recovery is known to
+ ** be running, convert BUSY to BUSY_RECOVERY. There is a race here
+ ** which might cause WAL_RETRY to be returned even if BUSY_RECOVERY
+ ** would be technically correct. But the race is benign since with
+ ** WAL_RETRY this routine will be called again and will probably be
+ ** right on the second iteration.
+ */
+ if( pWal->apWiData[0]==0 ){
+ /* This branch is taken when the xShmMap() method returns SQLITE_BUSY.
+ ** We assume this is a transient condition, so return WAL_RETRY. The
+ ** xShmMap() implementation used by the default unix and win32 VFS
+ ** modules may return SQLITE_BUSY due to a race condition in the
+ ** code that determines whether or not the shared-memory region
+ ** must be zeroed before the requested page is returned.
+ */
+ rc = WAL_RETRY;
+ }else if( SQLITE_OK==(rc = walLockShared(pWal, WAL_RECOVER_LOCK)) ){
+ walUnlockShared(pWal, WAL_RECOVER_LOCK);
+ rc = WAL_RETRY;
+ }else if( rc==SQLITE_BUSY ){
+ rc = SQLITE_BUSY_RECOVERY;
+ }
+ }
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+ else if( pWal->bShmUnreliable ){
+ return walBeginShmUnreliable(pWal, pChanged);
+ }
+ }
+
+ assert( pWal->nWiData>0 );
+ assert( pWal->apWiData[0]!=0 );
+ pInfo = walCkptInfo(pWal);
+ SEH_INJECT_FAULT;
+ {
+ u32 mxReadMark; /* Largest aReadMark[] value */
+ int mxI; /* Index of largest aReadMark[] value */
+ int i; /* Loop counter */
+ u32 mxFrame; /* Wal frame to lock to */
+ if( !useWal && AtomicLoad(&pInfo->nBackfill)==pWal->hdr.mxFrame
+#ifdef SQLITE_ENABLE_SNAPSHOT
+ && ((pWal->bGetSnapshot==0 && pWal->pSnapshot==0) || pWal->hdr.mxFrame==0)
+#endif
+ ){
+ /* The WAL has been completely backfilled (or it is empty).
+ ** and can be safely ignored.
+ */
+ rc = walLockShared(pWal, WAL_READ_LOCK(0));
+ walShmBarrier(pWal);
+ if( rc==SQLITE_OK ){
+ if( memcmp((void *)walIndexHdr(pWal), &pWal->hdr,sizeof(WalIndexHdr)) ){
+ /* It is not safe to allow the reader to continue here if frames
+ ** may have been appended to the log before READ_LOCK(0) was obtained.
+ ** When holding READ_LOCK(0), the reader ignores the entire log file,
+ ** which implies that the database file contains a trustworthy
+ ** snapshot. Since holding READ_LOCK(0) prevents a checkpoint from
+ ** happening, this is usually correct.
+ **
+ ** However, if frames have been appended to the log (or if the log
+ ** is wrapped and written for that matter) before the READ_LOCK(0)
+ ** is obtained, that is not necessarily true. A checkpointer may
+ ** have started to backfill the appended frames but crashed before
+ ** it finished. Leaving a corrupt image in the database file.
+ */
+ walUnlockShared(pWal, WAL_READ_LOCK(0));
+ return WAL_RETRY;
+ }
+ pWal->readLock = 0;
+ return SQLITE_OK;
+ }else if( rc!=SQLITE_BUSY ){
+ return rc;
+ }
+ }
+
+ /* If we get this far, it means that the reader will want to use
+ ** the WAL to get at content from recent commits. The job now is
+ ** to select one of the aReadMark[] entries that is closest to
+ ** but not exceeding pWal->hdr.mxFrame and lock that entry.
+ */
+ mxReadMark = 0;
+ mxI = 0;
+ mxFrame = pWal->hdr.mxFrame;
+#ifdef SQLITE_ENABLE_SNAPSHOT
+ if( pWal->pSnapshot && pWal->pSnapshot->mxFrame<mxFrame ){
+ mxFrame = pWal->pSnapshot->mxFrame;
+ }
+#endif
+ for(i=1; i<WAL_NREADER; i++){
+ u32 thisMark = AtomicLoad(pInfo->aReadMark+i); SEH_INJECT_FAULT;
+ if( mxReadMark<=thisMark && thisMark<=mxFrame ){
+ assert( thisMark!=READMARK_NOT_USED );
+ mxReadMark = thisMark;
+ mxI = i;
+ }
+ }
+ if( (pWal->readOnly & WAL_SHM_RDONLY)==0
+ && (mxReadMark<mxFrame || mxI==0)
+ ){
+ for(i=1; i<WAL_NREADER; i++){
+ rc = walLockExclusive(pWal, WAL_READ_LOCK(i), 1);
+ if( rc==SQLITE_OK ){
+ AtomicStore(pInfo->aReadMark+i,mxFrame);
+ mxReadMark = mxFrame;
+ mxI = i;
+ walUnlockExclusive(pWal, WAL_READ_LOCK(i), 1);
+ break;
+ }else if( rc!=SQLITE_BUSY ){
+ return rc;
+ }
+ }
+ }
+ if( mxI==0 ){
+ assert( rc==SQLITE_BUSY || (pWal->readOnly & WAL_SHM_RDONLY)!=0 );
+ return rc==SQLITE_BUSY ? WAL_RETRY : SQLITE_READONLY_CANTINIT;
+ }
+
+ (void)walEnableBlockingMs(pWal, nBlockTmout);
+ rc = walLockShared(pWal, WAL_READ_LOCK(mxI));
+ walDisableBlocking(pWal);
+ if( rc ){
+#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
+ if( rc==SQLITE_BUSY_TIMEOUT ){
+ *pCnt |= WAL_RETRY_BLOCKED_MASK;
+ }
+#else
+ assert( rc!=SQLITE_BUSY_TIMEOUT );
+#endif
+ assert((rc&0xFF)!=SQLITE_BUSY||rc==SQLITE_BUSY||rc==SQLITE_BUSY_TIMEOUT);
+ return (rc&0xFF)==SQLITE_BUSY ? WAL_RETRY : rc;
+ }
+ /* Now that the read-lock has been obtained, check that neither the
+ ** value in the aReadMark[] array or the contents of the wal-index
+ ** header have changed.
+ **
+ ** It is necessary to check that the wal-index header did not change
+ ** between the time it was read and when the shared-lock was obtained
+ ** on WAL_READ_LOCK(mxI) was obtained to account for the possibility
+ ** that the log file may have been wrapped by a writer, or that frames
+ ** that occur later in the log than pWal->hdr.mxFrame may have been
+ ** copied into the database by a checkpointer. If either of these things
+ ** happened, then reading the database with the current value of
+ ** pWal->hdr.mxFrame risks reading a corrupted snapshot. So, retry
+ ** instead.
+ **
+ ** Before checking that the live wal-index header has not changed
+ ** since it was read, set Wal.minFrame to the first frame in the wal
+ ** file that has not yet been checkpointed. This client will not need
+ ** to read any frames earlier than minFrame from the wal file - they
+ ** can be safely read directly from the database file.
+ **
+ ** Because a ShmBarrier() call is made between taking the copy of
+ ** nBackfill and checking that the wal-header in shared-memory still
+ ** matches the one cached in pWal->hdr, it is guaranteed that the
+ ** checkpointer that set nBackfill was not working with a wal-index
+ ** header newer than that cached in pWal->hdr. If it were, that could
+ ** cause a problem. The checkpointer could omit to checkpoint
+ ** a version of page X that lies before pWal->minFrame (call that version
+ ** A) on the basis that there is a newer version (version B) of the same
+ ** page later in the wal file. But if version B happens to like past
+ ** frame pWal->hdr.mxFrame - then the client would incorrectly assume
+ ** that it can read version A from the database file. However, since
+ ** we can guarantee that the checkpointer that set nBackfill could not
+ ** see any pages past pWal->hdr.mxFrame, this problem does not come up.
+ */
+ pWal->minFrame = AtomicLoad(&pInfo->nBackfill)+1; SEH_INJECT_FAULT;
+ walShmBarrier(pWal);
+ if( AtomicLoad(pInfo->aReadMark+mxI)!=mxReadMark
+ || memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr))
+ ){
+ walUnlockShared(pWal, WAL_READ_LOCK(mxI));
+ return WAL_RETRY;
+ }else{
+ assert( mxReadMark<=pWal->hdr.mxFrame );
+ pWal->readLock = (i16)mxI;
+ }
+ }
+ return rc;
+}
+
+#ifdef SQLITE_ENABLE_SNAPSHOT
+/*
+** This function does the work of sqlite3WalSnapshotRecover().
+*/
+static int walSnapshotRecover(
+ Wal *pWal, /* WAL handle */
+ void *pBuf1, /* Temp buffer pWal->szPage bytes in size */
+ void *pBuf2 /* Temp buffer pWal->szPage bytes in size */
+){
+ int szPage = (int)pWal->szPage;
+ int rc;
+ i64 szDb; /* Size of db file in bytes */
+
+ rc = sqlite3OsFileSize(pWal->pDbFd, &szDb);
+ if( rc==SQLITE_OK ){
+ volatile WalCkptInfo *pInfo = walCkptInfo(pWal);
+ u32 i = pInfo->nBackfillAttempted;
+ for(i=pInfo->nBackfillAttempted; i>AtomicLoad(&pInfo->nBackfill); i--){
+ WalHashLoc sLoc; /* Hash table location */
+ u32 pgno; /* Page number in db file */
+ i64 iDbOff; /* Offset of db file entry */
+ i64 iWalOff; /* Offset of wal file entry */
+
+ rc = walHashGet(pWal, walFramePage(i), &sLoc);
+ if( rc!=SQLITE_OK ) break;
+ assert( i - sLoc.iZero - 1 >=0 );
+ pgno = sLoc.aPgno[i-sLoc.iZero-1];
+ iDbOff = (i64)(pgno-1) * szPage;
+
+ if( iDbOff+szPage<=szDb ){
+ iWalOff = walFrameOffset(i, szPage) + WAL_FRAME_HDRSIZE;
+ rc = sqlite3OsRead(pWal->pWalFd, pBuf1, szPage, iWalOff);
+
+ if( rc==SQLITE_OK ){
+ rc = sqlite3OsRead(pWal->pDbFd, pBuf2, szPage, iDbOff);
+ }
+
+ if( rc!=SQLITE_OK || 0==memcmp(pBuf1, pBuf2, szPage) ){
+ break;
+ }
+ }
+
+ pInfo->nBackfillAttempted = i-1;
+ }
+ }
+
+ return rc;
+}
+
+/*
+** Attempt to reduce the value of the WalCkptInfo.nBackfillAttempted
+** variable so that older snapshots can be accessed. To do this, loop
+** through all wal frames from nBackfillAttempted to (nBackfill+1),
+** comparing their content to the corresponding page with the database
+** file, if any. Set nBackfillAttempted to the frame number of the
+** first frame for which the wal file content matches the db file.
+**
+** This is only really safe if the file-system is such that any page
+** writes made by earlier checkpointers were atomic operations, which
+** is not always true. It is also possible that nBackfillAttempted
+** may be left set to a value larger than expected, if a wal frame
+** contains content that duplicate of an earlier version of the same
+** page.
+**
+** SQLITE_OK is returned if successful, or an SQLite error code if an
+** error occurs. It is not an error if nBackfillAttempted cannot be
+** decreased at all.
+*/
+SQLITE_PRIVATE int sqlite3WalSnapshotRecover(Wal *pWal){
+ int rc;
+
+ assert( pWal->readLock>=0 );
+ rc = walLockExclusive(pWal, WAL_CKPT_LOCK, 1);
+ if( rc==SQLITE_OK ){
+ void *pBuf1 = sqlite3_malloc(pWal->szPage);
+ void *pBuf2 = sqlite3_malloc(pWal->szPage);
+ if( pBuf1==0 || pBuf2==0 ){
+ rc = SQLITE_NOMEM;
+ }else{
+ pWal->ckptLock = 1;
+ SEH_TRY {
+ rc = walSnapshotRecover(pWal, pBuf1, pBuf2);
+ }
+ SEH_EXCEPT( rc = SQLITE_IOERR_IN_PAGE; )
+ pWal->ckptLock = 0;
+ }
+
+ sqlite3_free(pBuf1);
+ sqlite3_free(pBuf2);
+ walUnlockExclusive(pWal, WAL_CKPT_LOCK, 1);
+ }
+
+ return rc;
+}
+#endif /* SQLITE_ENABLE_SNAPSHOT */
+
+/*
+** This function does the work of sqlite3WalBeginReadTransaction() (see
+** below). That function simply calls this one inside an SEH_TRY{...} block.
+*/
+static int walBeginReadTransaction(Wal *pWal, int *pChanged){
+ int rc; /* Return code */
+ int cnt = 0; /* Number of TryBeginRead attempts */
+#ifdef SQLITE_ENABLE_SNAPSHOT
+ int ckptLock = 0;
+ int bChanged = 0;
+ WalIndexHdr *pSnapshot = pWal->pSnapshot;
+#endif
+
+ assert( pWal->ckptLock==0 );
+ assert( pWal->nSehTry>0 );
+
+#ifdef SQLITE_ENABLE_SNAPSHOT
+ if( pSnapshot ){
+ if( memcmp(pSnapshot, &pWal->hdr, sizeof(WalIndexHdr))!=0 ){
+ bChanged = 1;
+ }
+
+ /* It is possible that there is a checkpointer thread running
+ ** concurrent with this code. If this is the case, it may be that the
+ ** checkpointer has already determined that it will checkpoint
+ ** snapshot X, where X is later in the wal file than pSnapshot, but
+ ** has not yet set the pInfo->nBackfillAttempted variable to indicate
+ ** its intent. To avoid the race condition this leads to, ensure that
+ ** there is no checkpointer process by taking a shared CKPT lock
+ ** before checking pInfo->nBackfillAttempted. */
+ (void)walEnableBlocking(pWal);
+ rc = walLockShared(pWal, WAL_CKPT_LOCK);
+ walDisableBlocking(pWal);
+
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+ ckptLock = 1;
+ }
+#endif
+
+ do{
+ rc = walTryBeginRead(pWal, pChanged, 0, &cnt);
+ }while( rc==WAL_RETRY );
+ testcase( (rc&0xff)==SQLITE_BUSY );
+ testcase( (rc&0xff)==SQLITE_IOERR );
+ testcase( rc==SQLITE_PROTOCOL );
+ testcase( rc==SQLITE_OK );
+
+#ifdef SQLITE_ENABLE_SNAPSHOT
+ if( rc==SQLITE_OK ){
+ if( pSnapshot && memcmp(pSnapshot, &pWal->hdr, sizeof(WalIndexHdr))!=0 ){
+ /* At this point the client has a lock on an aReadMark[] slot holding
+ ** a value equal to or smaller than pSnapshot->mxFrame, but pWal->hdr
+ ** is populated with the wal-index header corresponding to the head
+ ** of the wal file. Verify that pSnapshot is still valid before
+ ** continuing. Reasons why pSnapshot might no longer be valid:
+ **
+ ** (1) The WAL file has been reset since the snapshot was taken.
+ ** In this case, the salt will have changed.
+ **
+ ** (2) A checkpoint as been attempted that wrote frames past
+ ** pSnapshot->mxFrame into the database file. Note that the
+ ** checkpoint need not have completed for this to cause problems.
+ */
+ volatile WalCkptInfo *pInfo = walCkptInfo(pWal);
+
+ assert( pWal->readLock>0 || pWal->hdr.mxFrame==0 );
+ assert( pInfo->aReadMark[pWal->readLock]<=pSnapshot->mxFrame );
+
+ /* Check that the wal file has not been wrapped. Assuming that it has
+ ** not, also check that no checkpointer has attempted to checkpoint any
+ ** frames beyond pSnapshot->mxFrame. If either of these conditions are
+ ** true, return SQLITE_ERROR_SNAPSHOT. Otherwise, overwrite pWal->hdr
+ ** with *pSnapshot and set *pChanged as appropriate for opening the
+ ** snapshot. */
+ if( !memcmp(pSnapshot->aSalt, pWal->hdr.aSalt, sizeof(pWal->hdr.aSalt))
+ && pSnapshot->mxFrame>=pInfo->nBackfillAttempted
+ ){
+ assert( pWal->readLock>0 );
+ memcpy(&pWal->hdr, pSnapshot, sizeof(WalIndexHdr));
+ *pChanged = bChanged;
+ }else{
+ rc = SQLITE_ERROR_SNAPSHOT;
+ }
+
+ /* A client using a non-current snapshot may not ignore any frames
+ ** from the start of the wal file. This is because, for a system
+ ** where (minFrame < iSnapshot < maxFrame), a checkpointer may
+ ** have omitted to checkpoint a frame earlier than minFrame in
+ ** the file because there exists a frame after iSnapshot that
+ ** is the same database page. */
+ pWal->minFrame = 1;
+
+ if( rc!=SQLITE_OK ){
+ sqlite3WalEndReadTransaction(pWal);
+ }
+ }
+ }
+
+ /* Release the shared CKPT lock obtained above. */
+ if( ckptLock ){
+ assert( pSnapshot );
+ walUnlockShared(pWal, WAL_CKPT_LOCK);
+ }
+#endif
+ return rc;
+}
+
+/*
+** Begin a read transaction on the database.
+**
+** This routine used to be called sqlite3OpenSnapshot() and with good reason:
+** it takes a snapshot of the state of the WAL and wal-index for the current
+** instant in time. The current thread will continue to use this snapshot.
+** Other threads might append new content to the WAL and wal-index but
+** that extra content is ignored by the current thread.
+**
+** If the database contents have changes since the previous read
+** transaction, then *pChanged is set to 1 before returning. The
+** Pager layer will use this to know that its cache is stale and
+** needs to be flushed.
+*/
+SQLITE_PRIVATE int sqlite3WalBeginReadTransaction(Wal *pWal, int *pChanged){
+ int rc;
+ SEH_TRY {
+ rc = walBeginReadTransaction(pWal, pChanged);
+ }
+ SEH_EXCEPT( rc = walHandleException(pWal); )
+ return rc;
+}
+
+/*
+** Finish with a read transaction. All this does is release the
+** read-lock.
+*/
+SQLITE_PRIVATE void sqlite3WalEndReadTransaction(Wal *pWal){
+ sqlite3WalEndWriteTransaction(pWal);
+ if( pWal->readLock>=0 ){
+ walUnlockShared(pWal, WAL_READ_LOCK(pWal->readLock));
+ pWal->readLock = -1;
+ }
+}
+
+/*
+** Search the wal file for page pgno. If found, set *piRead to the frame that
+** contains the page. Otherwise, if pgno is not in the wal file, set *piRead
+** to zero.
+**
+** Return SQLITE_OK if successful, or an error code if an error occurs. If an
+** error does occur, the final value of *piRead is undefined.
+*/
+static int walFindFrame(
+ Wal *pWal, /* WAL handle */
+ Pgno pgno, /* Database page number to read data for */
+ u32 *piRead /* OUT: Frame number (or zero) */
+){
+ u32 iRead = 0; /* If !=0, WAL frame to return data from */
+ u32 iLast = pWal->hdr.mxFrame; /* Last page in WAL for this reader */
+ int iHash; /* Used to loop through N hash tables */
+ int iMinHash;
+
+ /* This routine is only be called from within a read transaction. */
+ assert( pWal->readLock>=0 || pWal->lockError );
+
+ /* If the "last page" field of the wal-index header snapshot is 0, then
+ ** no data will be read from the wal under any circumstances. Return early
+ ** in this case as an optimization. Likewise, if pWal->readLock==0,
+ ** then the WAL is ignored by the reader so return early, as if the
+ ** WAL were empty.
+ */
+ if( iLast==0 || (pWal->readLock==0 && pWal->bShmUnreliable==0) ){
+ *piRead = 0;
+ return SQLITE_OK;
+ }
+
+ /* Search the hash table or tables for an entry matching page number
+ ** pgno. Each iteration of the following for() loop searches one
+ ** hash table (each hash table indexes up to HASHTABLE_NPAGE frames).
+ **
+ ** This code might run concurrently to the code in walIndexAppend()
+ ** that adds entries to the wal-index (and possibly to this hash
+ ** table). This means the value just read from the hash
+ ** slot (aHash[iKey]) may have been added before or after the
+ ** current read transaction was opened. Values added after the
+ ** read transaction was opened may have been written incorrectly -
+ ** i.e. these slots may contain garbage data. However, we assume
+ ** that any slots written before the current read transaction was
+ ** opened remain unmodified.
+ **
+ ** For the reasons above, the if(...) condition featured in the inner
+ ** loop of the following block is more stringent that would be required
+ ** if we had exclusive access to the hash-table:
+ **
+ ** (aPgno[iFrame]==pgno):
+ ** This condition filters out normal hash-table collisions.
+ **
+ ** (iFrame<=iLast):
+ ** This condition filters out entries that were added to the hash
+ ** table after the current read-transaction had started.
+ */
+ iMinHash = walFramePage(pWal->minFrame);
+ for(iHash=walFramePage(iLast); iHash>=iMinHash; iHash--){
+ WalHashLoc sLoc; /* Hash table location */
+ int iKey; /* Hash slot index */
+ int nCollide; /* Number of hash collisions remaining */
+ int rc; /* Error code */
+ u32 iH;
+
+ rc = walHashGet(pWal, iHash, &sLoc);
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+ nCollide = HASHTABLE_NSLOT;
+ iKey = walHash(pgno);
+ SEH_INJECT_FAULT;
+ while( (iH = AtomicLoad(&sLoc.aHash[iKey]))!=0 ){
+ u32 iFrame = iH + sLoc.iZero;
+ if( iFrame<=iLast && iFrame>=pWal->minFrame && sLoc.aPgno[iH-1]==pgno ){
+ assert( iFrame>iRead || CORRUPT_DB );
+ iRead = iFrame;
+ }
+ if( (nCollide--)==0 ){
+ *piRead = 0;
+ return SQLITE_CORRUPT_BKPT;
+ }
+ iKey = walNextHash(iKey);
+ }
+ if( iRead ) break;
+ }
+
+#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT
+ /* If expensive assert() statements are available, do a linear search
+ ** of the wal-index file content. Make sure the results agree with the
+ ** result obtained using the hash indexes above. */
+ {
+ u32 iRead2 = 0;
+ u32 iTest;
+ assert( pWal->bShmUnreliable || pWal->minFrame>0 );
+ for(iTest=iLast; iTest>=pWal->minFrame && iTest>0; iTest--){
+ if( walFramePgno(pWal, iTest)==pgno ){
+ iRead2 = iTest;
+ break;
+ }
+ }
+ assert( iRead==iRead2 );
+ }
+#endif
+
+ *piRead = iRead;
+ return SQLITE_OK;
+}
+
+/*
+** Search the wal file for page pgno. If found, set *piRead to the frame that
+** contains the page. Otherwise, if pgno is not in the wal file, set *piRead
+** to zero.
+**
+** Return SQLITE_OK if successful, or an error code if an error occurs. If an
+** error does occur, the final value of *piRead is undefined.
+**
+** The difference between this function and walFindFrame() is that this
+** function wraps walFindFrame() in an SEH_TRY{...} block.
+*/
+SQLITE_PRIVATE int sqlite3WalFindFrame(
+ Wal *pWal, /* WAL handle */
+ Pgno pgno, /* Database page number to read data for */
+ u32 *piRead /* OUT: Frame number (or zero) */
+){
+ int rc;
+ SEH_TRY {
+ rc = walFindFrame(pWal, pgno, piRead);
+ }
+ SEH_EXCEPT( rc = SQLITE_IOERR_IN_PAGE; )
+ return rc;
+}
+
+/*
+** Read the contents of frame iRead from the wal file into buffer pOut
+** (which is nOut bytes in size). Return SQLITE_OK if successful, or an
+** error code otherwise.
+*/
+SQLITE_PRIVATE int sqlite3WalReadFrame(
+ Wal *pWal, /* WAL handle */
+ u32 iRead, /* Frame to read */
+ int nOut, /* Size of buffer pOut in bytes */
+ u8 *pOut /* Buffer to write page data to */
+){
+ int sz;
+ i64 iOffset;
+ sz = pWal->hdr.szPage;
+ sz = (sz&0xfe00) + ((sz&0x0001)<<16);
+ testcase( sz<=32768 );
+ testcase( sz>=65536 );
+ iOffset = walFrameOffset(iRead, sz) + WAL_FRAME_HDRSIZE;
+ /* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL */
+ return sqlite3OsRead(pWal->pWalFd, pOut, (nOut>sz ? sz : nOut), iOffset);
+}
+
+/*
+** Return the size of the database in pages (or zero, if unknown).
+*/
+SQLITE_PRIVATE Pgno sqlite3WalDbsize(Wal *pWal){
+ if( pWal && ALWAYS(pWal->readLock>=0) ){
+ return pWal->hdr.nPage;
+ }
+ return 0;
+}
+
+
+/*
+** This function starts a write transaction on the WAL.
+**
+** A read transaction must have already been started by a prior call
+** to sqlite3WalBeginReadTransaction().
+**
+** If another thread or process has written into the database since
+** the read transaction was started, then it is not possible for this
+** thread to write as doing so would cause a fork. So this routine
+** returns SQLITE_BUSY in that case and no write transaction is started.
+**
+** There can only be a single writer active at a time.
+*/
+SQLITE_PRIVATE int sqlite3WalBeginWriteTransaction(Wal *pWal){
+ int rc;
+
+#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
+ /* If the write-lock is already held, then it was obtained before the
+ ** read-transaction was even opened, making this call a no-op.
+ ** Return early. */
+ if( pWal->writeLock ){
+ assert( !memcmp(&pWal->hdr,(void *)walIndexHdr(pWal),sizeof(WalIndexHdr)) );
+ return SQLITE_OK;
+ }
+#endif
+
+ /* Cannot start a write transaction without first holding a read
+ ** transaction. */
+ assert( pWal->readLock>=0 );
+ assert( pWal->writeLock==0 && pWal->iReCksum==0 );
+
+ if( pWal->readOnly ){
+ return SQLITE_READONLY;
+ }
+
+ /* Only one writer allowed at a time. Get the write lock. Return
+ ** SQLITE_BUSY if unable.
+ */
+ rc = walLockExclusive(pWal, WAL_WRITE_LOCK, 1);
+ if( rc ){
+ return rc;
+ }
+ pWal->writeLock = 1;
+
+ /* If another connection has written to the database file since the
+ ** time the read transaction on this connection was started, then
+ ** the write is disallowed.
+ */
+ SEH_TRY {
+ if( memcmp(&pWal->hdr, (void *)walIndexHdr(pWal), sizeof(WalIndexHdr))!=0 ){
+ rc = SQLITE_BUSY_SNAPSHOT;
+ }
+ }
+ SEH_EXCEPT( rc = SQLITE_IOERR_IN_PAGE; )
+
+ if( rc!=SQLITE_OK ){
+ walUnlockExclusive(pWal, WAL_WRITE_LOCK, 1);
+ pWal->writeLock = 0;
+ }
+ return rc;
+}
+
+/*
+** End a write transaction. The commit has already been done. This
+** routine merely releases the lock.
+*/
+SQLITE_PRIVATE int sqlite3WalEndWriteTransaction(Wal *pWal){
+ if( pWal->writeLock ){
+ walUnlockExclusive(pWal, WAL_WRITE_LOCK, 1);
+ pWal->writeLock = 0;
+ pWal->iReCksum = 0;
+ pWal->truncateOnCommit = 0;
+ }
+ return SQLITE_OK;
+}
+
+/*
+** If any data has been written (but not committed) to the log file, this
+** function moves the write-pointer back to the start of the transaction.
+**
+** Additionally, the callback function is invoked for each frame written
+** to the WAL since the start of the transaction. If the callback returns
+** other than SQLITE_OK, it is not invoked again and the error code is
+** returned to the caller.
+**
+** Otherwise, if the callback function does not return an error, this
+** function returns SQLITE_OK.
+*/
+SQLITE_PRIVATE int sqlite3WalUndo(Wal *pWal, int (*xUndo)(void *, Pgno), void *pUndoCtx){
+ int rc = SQLITE_OK;
+ if( ALWAYS(pWal->writeLock) ){
+ Pgno iMax = pWal->hdr.mxFrame;
+ Pgno iFrame;
+
+ SEH_TRY {
+ /* Restore the clients cache of the wal-index header to the state it
+ ** was in before the client began writing to the database.
+ */
+ memcpy(&pWal->hdr, (void *)walIndexHdr(pWal), sizeof(WalIndexHdr));
+
+ for(iFrame=pWal->hdr.mxFrame+1;
+ ALWAYS(rc==SQLITE_OK) && iFrame<=iMax;
+ iFrame++
+ ){
+ /* This call cannot fail. Unless the page for which the page number
+ ** is passed as the second argument is (a) in the cache and
+ ** (b) has an outstanding reference, then xUndo is either a no-op
+ ** (if (a) is false) or simply expels the page from the cache (if (b)
+ ** is false).
+ **
+ ** If the upper layer is doing a rollback, it is guaranteed that there
+ ** are no outstanding references to any page other than page 1. And
+ ** page 1 is never written to the log until the transaction is
+ ** committed. As a result, the call to xUndo may not fail.
+ */
+ assert( walFramePgno(pWal, iFrame)!=1 );
+ rc = xUndo(pUndoCtx, walFramePgno(pWal, iFrame));
+ }
+ if( iMax!=pWal->hdr.mxFrame ) walCleanupHash(pWal);
+ }
+ SEH_EXCEPT( rc = SQLITE_IOERR_IN_PAGE; )
+ }
+ return rc;
+}
+
+/*
+** Argument aWalData must point to an array of WAL_SAVEPOINT_NDATA u32
+** values. This function populates the array with values required to
+** "rollback" the write position of the WAL handle back to the current
+** point in the event of a savepoint rollback (via WalSavepointUndo()).
+*/
+SQLITE_PRIVATE void sqlite3WalSavepoint(Wal *pWal, u32 *aWalData){
+ assert( pWal->writeLock );
+ aWalData[0] = pWal->hdr.mxFrame;
+ aWalData[1] = pWal->hdr.aFrameCksum[0];
+ aWalData[2] = pWal->hdr.aFrameCksum[1];
+ aWalData[3] = pWal->nCkpt;
+}
+
+/*
+** Move the write position of the WAL back to the point identified by
+** the values in the aWalData[] array. aWalData must point to an array
+** of WAL_SAVEPOINT_NDATA u32 values that has been previously populated
+** by a call to WalSavepoint().
+*/
+SQLITE_PRIVATE int sqlite3WalSavepointUndo(Wal *pWal, u32 *aWalData){
+ int rc = SQLITE_OK;
+
+ assert( pWal->writeLock );
+ assert( aWalData[3]!=pWal->nCkpt || aWalData[0]<=pWal->hdr.mxFrame );
+
+ if( aWalData[3]!=pWal->nCkpt ){
+ /* This savepoint was opened immediately after the write-transaction
+ ** was started. Right after that, the writer decided to wrap around
+ ** to the start of the log. Update the savepoint values to match.
+ */
+ aWalData[0] = 0;
+ aWalData[3] = pWal->nCkpt;
+ }
+
+ if( aWalData[0]<pWal->hdr.mxFrame ){
+ pWal->hdr.mxFrame = aWalData[0];
+ pWal->hdr.aFrameCksum[0] = aWalData[1];
+ pWal->hdr.aFrameCksum[1] = aWalData[2];
+ SEH_TRY {
+ walCleanupHash(pWal);
+ }
+ SEH_EXCEPT( rc = SQLITE_IOERR_IN_PAGE; )
+ }
+
+ return rc;
+}
+
+/*
+** This function is called just before writing a set of frames to the log
+** file (see sqlite3WalFrames()). It checks to see if, instead of appending
+** to the current log file, it is possible to overwrite the start of the
+** existing log file with the new frames (i.e. "reset" the log). If so,
+** it sets pWal->hdr.mxFrame to 0. Otherwise, pWal->hdr.mxFrame is left
+** unchanged.
+**
+** SQLITE_OK is returned if no error is encountered (regardless of whether
+** or not pWal->hdr.mxFrame is modified). An SQLite error code is returned
+** if an error occurs.
+*/
+static int walRestartLog(Wal *pWal){
+ int rc = SQLITE_OK;
+ int cnt;
+
+ if( pWal->readLock==0 ){
+ volatile WalCkptInfo *pInfo = walCkptInfo(pWal);
+ assert( pInfo->nBackfill==pWal->hdr.mxFrame );
+ if( pInfo->nBackfill>0 ){
+ u32 salt1;
+ sqlite3_randomness(4, &salt1);
+ rc = walLockExclusive(pWal, WAL_READ_LOCK(1), WAL_NREADER-1);
+ if( rc==SQLITE_OK ){
+ /* If all readers are using WAL_READ_LOCK(0) (in other words if no
+ ** readers are currently using the WAL), then the transactions
+ ** frames will overwrite the start of the existing log. Update the
+ ** wal-index header to reflect this.
+ **
+ ** In theory it would be Ok to update the cache of the header only
+ ** at this point. But updating the actual wal-index header is also
+ ** safe and means there is no special case for sqlite3WalUndo()
+ ** to handle if this transaction is rolled back. */
+ walRestartHdr(pWal, salt1);
+ walUnlockExclusive(pWal, WAL_READ_LOCK(1), WAL_NREADER-1);
+ }else if( rc!=SQLITE_BUSY ){
+ return rc;
+ }
+ }
+ walUnlockShared(pWal, WAL_READ_LOCK(0));
+ pWal->readLock = -1;
+ cnt = 0;
+ do{
+ int notUsed;
+ rc = walTryBeginRead(pWal, ¬Used, 1, &cnt);
+ }while( rc==WAL_RETRY );
+ assert( (rc&0xff)!=SQLITE_BUSY ); /* BUSY not possible when useWal==1 */
+ testcase( (rc&0xff)==SQLITE_IOERR );
+ testcase( rc==SQLITE_PROTOCOL );
+ testcase( rc==SQLITE_OK );
+ }
+ return rc;
+}
+
+/*
+** Information about the current state of the WAL file and where
+** the next fsync should occur - passed from sqlite3WalFrames() into
+** walWriteToLog().
+*/
+typedef struct WalWriter {
+ Wal *pWal; /* The complete WAL information */
+ sqlite3_file *pFd; /* The WAL file to which we write */
+ sqlite3_int64 iSyncPoint; /* Fsync at this offset */
+ int syncFlags; /* Flags for the fsync */
+ int szPage; /* Size of one page */
+} WalWriter;
+
+/*
+** Write iAmt bytes of content into the WAL file beginning at iOffset.
+** Do a sync when crossing the p->iSyncPoint boundary.
+**
+** In other words, if iSyncPoint is in between iOffset and iOffset+iAmt,
+** first write the part before iSyncPoint, then sync, then write the
+** rest.
+*/
+static int walWriteToLog(
+ WalWriter *p, /* WAL to write to */
+ void *pContent, /* Content to be written */
+ int iAmt, /* Number of bytes to write */
+ sqlite3_int64 iOffset /* Start writing at this offset */
+){
+ int rc;
+ if( iOffset<p->iSyncPoint && iOffset+iAmt>=p->iSyncPoint ){
+ int iFirstAmt = (int)(p->iSyncPoint - iOffset);
+ rc = sqlite3OsWrite(p->pFd, pContent, iFirstAmt, iOffset);
+ if( rc ) return rc;
+ iOffset += iFirstAmt;
+ iAmt -= iFirstAmt;
+ pContent = (void*)(iFirstAmt + (char*)pContent);
+ assert( WAL_SYNC_FLAGS(p->syncFlags)!=0 );
+ rc = sqlite3OsSync(p->pFd, WAL_SYNC_FLAGS(p->syncFlags));
+ if( iAmt==0 || rc ) return rc;
+ }
+ rc = sqlite3OsWrite(p->pFd, pContent, iAmt, iOffset);
+ return rc;
+}
+
+/*
+** Write out a single frame of the WAL
+*/
+static int walWriteOneFrame(
+ WalWriter *p, /* Where to write the frame */
+ PgHdr *pPage, /* The page of the frame to be written */
+ int nTruncate, /* The commit flag. Usually 0. >0 for commit */
+ sqlite3_int64 iOffset /* Byte offset at which to write */
+){
+ int rc; /* Result code from subfunctions */
+ void *pData; /* Data actually written */
+ u8 aFrame[WAL_FRAME_HDRSIZE]; /* Buffer to assemble frame-header in */
+ pData = pPage->pData;
+ walEncodeFrame(p->pWal, pPage->pgno, nTruncate, pData, aFrame);
+ rc = walWriteToLog(p, aFrame, sizeof(aFrame), iOffset);
+ if( rc ) return rc;
+ /* Write the page data */
+ rc = walWriteToLog(p, pData, p->szPage, iOffset+sizeof(aFrame));
+ return rc;
+}
+
+/*
+** This function is called as part of committing a transaction within which
+** one or more frames have been overwritten. It updates the checksums for
+** all frames written to the wal file by the current transaction starting
+** with the earliest to have been overwritten.
+**
+** SQLITE_OK is returned if successful, or an SQLite error code otherwise.
+*/
+static int walRewriteChecksums(Wal *pWal, u32 iLast){
+ const int szPage = pWal->szPage;/* Database page size */
+ int rc = SQLITE_OK; /* Return code */
+ u8 *aBuf; /* Buffer to load data from wal file into */
+ u8 aFrame[WAL_FRAME_HDRSIZE]; /* Buffer to assemble frame-headers in */
+ u32 iRead; /* Next frame to read from wal file */
+ i64 iCksumOff;
+
+ aBuf = sqlite3_malloc(szPage + WAL_FRAME_HDRSIZE);
+ if( aBuf==0 ) return SQLITE_NOMEM_BKPT;
+
+ /* Find the checksum values to use as input for the recalculating the
+ ** first checksum. If the first frame is frame 1 (implying that the current
+ ** transaction restarted the wal file), these values must be read from the
+ ** wal-file header. Otherwise, read them from the frame header of the
+ ** previous frame. */
+ assert( pWal->iReCksum>0 );
+ if( pWal->iReCksum==1 ){
+ iCksumOff = 24;
+ }else{
+ iCksumOff = walFrameOffset(pWal->iReCksum-1, szPage) + 16;
+ }
+ rc = sqlite3OsRead(pWal->pWalFd, aBuf, sizeof(u32)*2, iCksumOff);
+ pWal->hdr.aFrameCksum[0] = sqlite3Get4byte(aBuf);
+ pWal->hdr.aFrameCksum[1] = sqlite3Get4byte(&aBuf[sizeof(u32)]);
+
+ iRead = pWal->iReCksum;
+ pWal->iReCksum = 0;
+ for(; rc==SQLITE_OK && iRead<=iLast; iRead++){
+ i64 iOff = walFrameOffset(iRead, szPage);
+ rc = sqlite3OsRead(pWal->pWalFd, aBuf, szPage+WAL_FRAME_HDRSIZE, iOff);
+ if( rc==SQLITE_OK ){
+ u32 iPgno, nDbSize;
+ iPgno = sqlite3Get4byte(aBuf);
+ nDbSize = sqlite3Get4byte(&aBuf[4]);
+
+ walEncodeFrame(pWal, iPgno, nDbSize, &aBuf[WAL_FRAME_HDRSIZE], aFrame);
+ rc = sqlite3OsWrite(pWal->pWalFd, aFrame, sizeof(aFrame), iOff);
+ }
+ }
+
+ sqlite3_free(aBuf);
+ return rc;
+}
+
+/*
+** Write a set of frames to the log. The caller must hold the write-lock
+** on the log file (obtained using sqlite3WalBeginWriteTransaction()).
+*/
+static int walFrames(
+ Wal *pWal, /* Wal handle to write to */
+ int szPage, /* Database page-size in bytes */
+ PgHdr *pList, /* List of dirty pages to write */
+ Pgno nTruncate, /* Database size after this commit */
+ int isCommit, /* True if this is a commit */
+ int sync_flags /* Flags to pass to OsSync() (or 0) */
+){
+ int rc; /* Used to catch return codes */
+ u32 iFrame; /* Next frame address */
+ PgHdr *p; /* Iterator to run through pList with. */
+ PgHdr *pLast = 0; /* Last frame in list */
+ int nExtra = 0; /* Number of extra copies of last page */
+ int szFrame; /* The size of a single frame */
+ i64 iOffset; /* Next byte to write in WAL file */
+ WalWriter w; /* The writer */
+ u32 iFirst = 0; /* First frame that may be overwritten */
+ WalIndexHdr *pLive; /* Pointer to shared header */
+
+ assert( pList );
+ assert( pWal->writeLock );
+
+ /* If this frame set completes a transaction, then nTruncate>0. If
+ ** nTruncate==0 then this frame set does not complete the transaction. */
+ assert( (isCommit!=0)==(nTruncate!=0) );
+
+#if defined(SQLITE_TEST) && defined(SQLITE_DEBUG)
+ { int cnt; for(cnt=0, p=pList; p; p=p->pDirty, cnt++){}
+ WALTRACE(("WAL%p: frame write begin. %d frames. mxFrame=%d. %s\n",
+ pWal, cnt, pWal->hdr.mxFrame, isCommit ? "Commit" : "Spill"));
+ }
+#endif
+
+ pLive = (WalIndexHdr*)walIndexHdr(pWal);
+ if( memcmp(&pWal->hdr, (void *)pLive, sizeof(WalIndexHdr))!=0 ){
+ iFirst = pLive->mxFrame+1;
+ }
+
+ /* See if it is possible to write these frames into the start of the
+ ** log file, instead of appending to it at pWal->hdr.mxFrame.
+ */
+ if( SQLITE_OK!=(rc = walRestartLog(pWal)) ){
+ return rc;
+ }
+
+ /* If this is the first frame written into the log, write the WAL
+ ** header to the start of the WAL file. See comments at the top of
+ ** this source file for a description of the WAL header format.
+ */
+ iFrame = pWal->hdr.mxFrame;
+ if( iFrame==0 ){
+ u8 aWalHdr[WAL_HDRSIZE]; /* Buffer to assemble wal-header in */
+ u32 aCksum[2]; /* Checksum for wal-header */
+
+ sqlite3Put4byte(&aWalHdr[0], (WAL_MAGIC | SQLITE_BIGENDIAN));
+ sqlite3Put4byte(&aWalHdr[4], WAL_MAX_VERSION);
+ sqlite3Put4byte(&aWalHdr[8], szPage);
+ sqlite3Put4byte(&aWalHdr[12], pWal->nCkpt);
+ if( pWal->nCkpt==0 ) sqlite3_randomness(8, pWal->hdr.aSalt);
+ memcpy(&aWalHdr[16], pWal->hdr.aSalt, 8);
+ walChecksumBytes(1, aWalHdr, WAL_HDRSIZE-2*4, 0, aCksum);
+ sqlite3Put4byte(&aWalHdr[24], aCksum[0]);
+ sqlite3Put4byte(&aWalHdr[28], aCksum[1]);
+
+ pWal->szPage = szPage;
+ pWal->hdr.bigEndCksum = SQLITE_BIGENDIAN;
+ pWal->hdr.aFrameCksum[0] = aCksum[0];
+ pWal->hdr.aFrameCksum[1] = aCksum[1];
+ pWal->truncateOnCommit = 1;
+
+ rc = sqlite3OsWrite(pWal->pWalFd, aWalHdr, sizeof(aWalHdr), 0);
+ WALTRACE(("WAL%p: wal-header write %s\n", pWal, rc ? "failed" : "ok"));
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+
+ /* Sync the header (unless SQLITE_IOCAP_SEQUENTIAL is true or unless
+ ** all syncing is turned off by PRAGMA synchronous=OFF). Otherwise
+ ** an out-of-order write following a WAL restart could result in
+ ** database corruption. See the ticket:
+ **
+ ** https://sqlite.org/src/info/ff5be73dee
+ */
+ if( pWal->syncHeader ){
+ rc = sqlite3OsSync(pWal->pWalFd, CKPT_SYNC_FLAGS(sync_flags));
+ if( rc ) return rc;
+ }
+ }
+ if( (int)pWal->szPage!=szPage ){
+ return SQLITE_CORRUPT_BKPT; /* TH3 test case: cov1/corrupt155.test */
+ }
+
+ /* Setup information needed to write frames into the WAL */
+ w.pWal = pWal;
+ w.pFd = pWal->pWalFd;
+ w.iSyncPoint = 0;
+ w.syncFlags = sync_flags;
+ w.szPage = szPage;
+ iOffset = walFrameOffset(iFrame+1, szPage);
+ szFrame = szPage + WAL_FRAME_HDRSIZE;
+
+ /* Write all frames into the log file exactly once */
+ for(p=pList; p; p=p->pDirty){
+ int nDbSize; /* 0 normally. Positive == commit flag */
+
+ /* Check if this page has already been written into the wal file by
+ ** the current transaction. If so, overwrite the existing frame and
+ ** set Wal.writeLock to WAL_WRITELOCK_RECKSUM - indicating that
+ ** checksums must be recomputed when the transaction is committed. */
+ if( iFirst && (p->pDirty || isCommit==0) ){
+ u32 iWrite = 0;
+ VVA_ONLY(rc =) walFindFrame(pWal, p->pgno, &iWrite);
+ assert( rc==SQLITE_OK || iWrite==0 );
+ if( iWrite>=iFirst ){
+ i64 iOff = walFrameOffset(iWrite, szPage) + WAL_FRAME_HDRSIZE;
+ void *pData;
+ if( pWal->iReCksum==0 || iWrite<pWal->iReCksum ){
+ pWal->iReCksum = iWrite;
+ }
+ pData = p->pData;
+ rc = sqlite3OsWrite(pWal->pWalFd, pData, szPage, iOff);
+ if( rc ) return rc;
+ p->flags &= ~PGHDR_WAL_APPEND;
+ continue;
+ }
+ }
+
+ iFrame++;
+ assert( iOffset==walFrameOffset(iFrame, szPage) );
+ nDbSize = (isCommit && p->pDirty==0) ? nTruncate : 0;
+ rc = walWriteOneFrame(&w, p, nDbSize, iOffset);
+ if( rc ) return rc;
+ pLast = p;
+ iOffset += szFrame;
+ p->flags |= PGHDR_WAL_APPEND;
+ }
+
+ /* Recalculate checksums within the wal file if required. */
+ if( isCommit && pWal->iReCksum ){
+ rc = walRewriteChecksums(pWal, iFrame);
+ if( rc ) return rc;
+ }
+
+ /* If this is the end of a transaction, then we might need to pad
+ ** the transaction and/or sync the WAL file.
+ **
+ ** Padding and syncing only occur if this set of frames complete a
+ ** transaction and if PRAGMA synchronous=FULL. If synchronous==NORMAL
+ ** or synchronous==OFF, then no padding or syncing are needed.
+ **
+ ** If SQLITE_IOCAP_POWERSAFE_OVERWRITE is defined, then padding is not
+ ** needed and only the sync is done. If padding is needed, then the
+ ** final frame is repeated (with its commit mark) until the next sector
+ ** boundary is crossed. Only the part of the WAL prior to the last
+ ** sector boundary is synced; the part of the last frame that extends
+ ** past the sector boundary is written after the sync.
+ */
+ if( isCommit && WAL_SYNC_FLAGS(sync_flags)!=0 ){
+ int bSync = 1;
+ if( pWal->padToSectorBoundary ){
+ int sectorSize = sqlite3SectorSize(pWal->pWalFd);
+ w.iSyncPoint = ((iOffset+sectorSize-1)/sectorSize)*sectorSize;
+ bSync = (w.iSyncPoint==iOffset);
+ testcase( bSync );
+ while( iOffset<w.iSyncPoint ){
+ rc = walWriteOneFrame(&w, pLast, nTruncate, iOffset);
+ if( rc ) return rc;
+ iOffset += szFrame;
+ nExtra++;
+ assert( pLast!=0 );
+ }
+ }
+ if( bSync ){
+ assert( rc==SQLITE_OK );
+ rc = sqlite3OsSync(w.pFd, WAL_SYNC_FLAGS(sync_flags));
+ }
+ }
+
+ /* If this frame set completes the first transaction in the WAL and
+ ** if PRAGMA journal_size_limit is set, then truncate the WAL to the
+ ** journal size limit, if possible.
+ */
+ if( isCommit && pWal->truncateOnCommit && pWal->mxWalSize>=0 ){
+ i64 sz = pWal->mxWalSize;
+ if( walFrameOffset(iFrame+nExtra+1, szPage)>pWal->mxWalSize ){
+ sz = walFrameOffset(iFrame+nExtra+1, szPage);
+ }
+ walLimitSize(pWal, sz);
+ pWal->truncateOnCommit = 0;
+ }
+
+ /* Append data to the wal-index. It is not necessary to lock the
+ ** wal-index to do this as the SQLITE_SHM_WRITE lock held on the wal-index
+ ** guarantees that there are no other writers, and no data that may
+ ** be in use by existing readers is being overwritten.
+ */
+ iFrame = pWal->hdr.mxFrame;
+ for(p=pList; p && rc==SQLITE_OK; p=p->pDirty){
+ if( (p->flags & PGHDR_WAL_APPEND)==0 ) continue;
+ iFrame++;
+ rc = walIndexAppend(pWal, iFrame, p->pgno);
+ }
+ assert( pLast!=0 || nExtra==0 );
+ while( rc==SQLITE_OK && nExtra>0 ){
+ iFrame++;
+ nExtra--;
+ rc = walIndexAppend(pWal, iFrame, pLast->pgno);
+ }
+
+ if( rc==SQLITE_OK ){
+ /* Update the private copy of the header. */
+ pWal->hdr.szPage = (u16)((szPage&0xff00) | (szPage>>16));
+ testcase( szPage<=32768 );
+ testcase( szPage>=65536 );
+ pWal->hdr.mxFrame = iFrame;
+ if( isCommit ){
+ pWal->hdr.iChange++;
+ pWal->hdr.nPage = nTruncate;
+ }
+ /* If this is a commit, update the wal-index header too. */
+ if( isCommit ){
+ walIndexWriteHdr(pWal);
+ pWal->iCallback = iFrame;
+ }
+ }
+
+ WALTRACE(("WAL%p: frame write %s\n", pWal, rc ? "failed" : "ok"));
+ return rc;
+}
+
+/*
+** Write a set of frames to the log. The caller must hold the write-lock
+** on the log file (obtained using sqlite3WalBeginWriteTransaction()).
+**
+** The difference between this function and walFrames() is that this
+** function wraps walFrames() in an SEH_TRY{...} block.
+*/
+SQLITE_PRIVATE int sqlite3WalFrames(
+ Wal *pWal, /* Wal handle to write to */
+ int szPage, /* Database page-size in bytes */
+ PgHdr *pList, /* List of dirty pages to write */
+ Pgno nTruncate, /* Database size after this commit */
+ int isCommit, /* True if this is a commit */
+ int sync_flags /* Flags to pass to OsSync() (or 0) */
+){
+ int rc;
+ SEH_TRY {
+ rc = walFrames(pWal, szPage, pList, nTruncate, isCommit, sync_flags);
+ }
+ SEH_EXCEPT( rc = walHandleException(pWal); )
+ return rc;
+}
+
+/*
+** This routine is called to implement sqlite3_wal_checkpoint() and
+** related interfaces.
+**
+** Obtain a CHECKPOINT lock and then backfill as much information as
+** we can from WAL into the database.
+**
+** If parameter xBusy is not NULL, it is a pointer to a busy-handler
+** callback. In this case this function runs a blocking checkpoint.
+*/
+SQLITE_PRIVATE int sqlite3WalCheckpoint(
+ Wal *pWal, /* Wal connection */
+ sqlite3 *db, /* Check this handle's interrupt flag */
+ int eMode, /* PASSIVE, FULL, RESTART, or TRUNCATE */
+ int (*xBusy)(void*), /* Function to call when busy */
+ void *pBusyArg, /* Context argument for xBusyHandler */
+ int sync_flags, /* Flags to sync db file with (or 0) */
+ int nBuf, /* Size of temporary buffer */
+ u8 *zBuf, /* Temporary buffer to use */
+ int *pnLog, /* OUT: Number of frames in WAL */
+ int *pnCkpt /* OUT: Number of backfilled frames in WAL */
+){
+ int rc; /* Return code */
+ int isChanged = 0; /* True if a new wal-index header is loaded */
+ int eMode2 = eMode; /* Mode to pass to walCheckpoint() */
+ int (*xBusy2)(void*) = xBusy; /* Busy handler for eMode2 */
+
+ assert( pWal->ckptLock==0 );
+ assert( pWal->writeLock==0 );
+
+ /* EVIDENCE-OF: R-62920-47450 The busy-handler callback is never invoked
+ ** in the SQLITE_CHECKPOINT_PASSIVE mode. */
+ assert( eMode!=SQLITE_CHECKPOINT_PASSIVE || xBusy==0 );
+
+ if( pWal->readOnly ) return SQLITE_READONLY;
+ WALTRACE(("WAL%p: checkpoint begins\n", pWal));
+
+ /* Enable blocking locks, if possible. */
+ sqlite3WalDb(pWal, db);
+ if( xBusy2 ) (void)walEnableBlocking(pWal);
+
+ /* IMPLEMENTATION-OF: R-62028-47212 All calls obtain an exclusive
+ ** "checkpoint" lock on the database file.
+ ** EVIDENCE-OF: R-10421-19736 If any other process is running a
+ ** checkpoint operation at the same time, the lock cannot be obtained and
+ ** SQLITE_BUSY is returned.
+ ** EVIDENCE-OF: R-53820-33897 Even if there is a busy-handler configured,
+ ** it will not be invoked in this case.
+ */
+ rc = walLockExclusive(pWal, WAL_CKPT_LOCK, 1);
+ testcase( rc==SQLITE_BUSY );
+ testcase( rc!=SQLITE_OK && xBusy2!=0 );
+ if( rc==SQLITE_OK ){
+ pWal->ckptLock = 1;
+
+ /* IMPLEMENTATION-OF: R-59782-36818 The SQLITE_CHECKPOINT_FULL, RESTART and
+ ** TRUNCATE modes also obtain the exclusive "writer" lock on the database
+ ** file.
+ **
+ ** EVIDENCE-OF: R-60642-04082 If the writer lock cannot be obtained
+ ** immediately, and a busy-handler is configured, it is invoked and the
+ ** writer lock retried until either the busy-handler returns 0 or the
+ ** lock is successfully obtained.
+ */
+ if( eMode!=SQLITE_CHECKPOINT_PASSIVE ){
+ rc = walBusyLock(pWal, xBusy2, pBusyArg, WAL_WRITE_LOCK, 1);
+ if( rc==SQLITE_OK ){
+ pWal->writeLock = 1;
+ }else if( rc==SQLITE_BUSY ){
+ eMode2 = SQLITE_CHECKPOINT_PASSIVE;
+ xBusy2 = 0;
+ rc = SQLITE_OK;
+ }
+ }
+ }
+
+
+ /* Read the wal-index header. */
+ SEH_TRY {
+ if( rc==SQLITE_OK ){
+ /* For a passive checkpoint, do not re-enable blocking locks after
+ ** reading the wal-index header. A passive checkpoint should not block
+ ** or invoke the busy handler. The only lock such a checkpoint may
+ ** attempt to obtain is a lock on a read-slot, and it should give up
+ ** immediately and do a partial checkpoint if it cannot obtain it. */
+ walDisableBlocking(pWal);
+ rc = walIndexReadHdr(pWal, &isChanged);
+ if( eMode2!=SQLITE_CHECKPOINT_PASSIVE ) (void)walEnableBlocking(pWal);
+ if( isChanged && pWal->pDbFd->pMethods->iVersion>=3 ){
+ sqlite3OsUnfetch(pWal->pDbFd, 0, 0);
+ }
+ }
+
+ /* Copy data from the log to the database file. */
+ if( rc==SQLITE_OK ){
+ if( pWal->hdr.mxFrame && walPagesize(pWal)!=nBuf ){
+ rc = SQLITE_CORRUPT_BKPT;
+ }else{
+ rc = walCheckpoint(pWal, db, eMode2, xBusy2, pBusyArg, sync_flags,zBuf);
+ }
+
+ /* If no error occurred, set the output variables. */
+ if( rc==SQLITE_OK || rc==SQLITE_BUSY ){
+ if( pnLog ) *pnLog = (int)pWal->hdr.mxFrame;
+ SEH_INJECT_FAULT;
+ if( pnCkpt ) *pnCkpt = (int)(walCkptInfo(pWal)->nBackfill);
+ }
+ }
+ }
+ SEH_EXCEPT( rc = walHandleException(pWal); )
+
+ if( isChanged ){
+ /* If a new wal-index header was loaded before the checkpoint was
+ ** performed, then the pager-cache associated with pWal is now
+ ** out of date. So zero the cached wal-index header to ensure that
+ ** next time the pager opens a snapshot on this database it knows that
+ ** the cache needs to be reset.
+ */
+ memset(&pWal->hdr, 0, sizeof(WalIndexHdr));
+ }
+
+ walDisableBlocking(pWal);
+ sqlite3WalDb(pWal, 0);
+
+ /* Release the locks. */
+ sqlite3WalEndWriteTransaction(pWal);
+ if( pWal->ckptLock ){
+ walUnlockExclusive(pWal, WAL_CKPT_LOCK, 1);
+ pWal->ckptLock = 0;
+ }
+ WALTRACE(("WAL%p: checkpoint %s\n", pWal, rc ? "failed" : "ok"));
+#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
+ if( rc==SQLITE_BUSY_TIMEOUT ) rc = SQLITE_BUSY;
+#endif
+ return (rc==SQLITE_OK && eMode!=eMode2 ? SQLITE_BUSY : rc);
+}
+
+/* Return the value to pass to a sqlite3_wal_hook callback, the
+** number of frames in the WAL at the point of the last commit since
+** sqlite3WalCallback() was called. If no commits have occurred since
+** the last call, then return 0.
+*/
+SQLITE_PRIVATE int sqlite3WalCallback(Wal *pWal){
+ u32 ret = 0;
+ if( pWal ){
+ ret = pWal->iCallback;
+ pWal->iCallback = 0;
+ }
+ return (int)ret;
+}
+
+/*
+** This function is called to change the WAL subsystem into or out
+** of locking_mode=EXCLUSIVE.
+**
+** If op is zero, then attempt to change from locking_mode=EXCLUSIVE
+** into locking_mode=NORMAL. This means that we must acquire a lock
+** on the pWal->readLock byte. If the WAL is already in locking_mode=NORMAL
+** or if the acquisition of the lock fails, then return 0. If the
+** transition out of exclusive-mode is successful, return 1. This
+** operation must occur while the pager is still holding the exclusive
+** lock on the main database file.
+**
+** If op is one, then change from locking_mode=NORMAL into
+** locking_mode=EXCLUSIVE. This means that the pWal->readLock must
+** be released. Return 1 if the transition is made and 0 if the
+** WAL is already in exclusive-locking mode - meaning that this
+** routine is a no-op. The pager must already hold the exclusive lock
+** on the main database file before invoking this operation.
+**
+** If op is negative, then do a dry-run of the op==1 case but do
+** not actually change anything. The pager uses this to see if it
+** should acquire the database exclusive lock prior to invoking
+** the op==1 case.
+*/
+SQLITE_PRIVATE int sqlite3WalExclusiveMode(Wal *pWal, int op){
+ int rc;
+ assert( pWal->writeLock==0 );
+ assert( pWal->exclusiveMode!=WAL_HEAPMEMORY_MODE || op==-1 );
+
+ /* pWal->readLock is usually set, but might be -1 if there was a
+ ** prior error while attempting to acquire are read-lock. This cannot
+ ** happen if the connection is actually in exclusive mode (as no xShmLock
+ ** locks are taken in this case). Nor should the pager attempt to
+ ** upgrade to exclusive-mode following such an error.
+ */
+#ifndef SQLITE_USE_SEH
+ assert( pWal->readLock>=0 || pWal->lockError );
+#endif
+ assert( pWal->readLock>=0 || (op<=0 && pWal->exclusiveMode==0) );
+
+ if( op==0 ){
+ if( pWal->exclusiveMode!=WAL_NORMAL_MODE ){
+ pWal->exclusiveMode = WAL_NORMAL_MODE;
+ if( walLockShared(pWal, WAL_READ_LOCK(pWal->readLock))!=SQLITE_OK ){
+ pWal->exclusiveMode = WAL_EXCLUSIVE_MODE;
+ }
+ rc = pWal->exclusiveMode==WAL_NORMAL_MODE;
+ }else{
+ /* Already in locking_mode=NORMAL */
+ rc = 0;
+ }
+ }else if( op>0 ){
+ assert( pWal->exclusiveMode==WAL_NORMAL_MODE );
+ assert( pWal->readLock>=0 );
+ walUnlockShared(pWal, WAL_READ_LOCK(pWal->readLock));
+ pWal->exclusiveMode = WAL_EXCLUSIVE_MODE;
+ rc = 1;
+ }else{
+ rc = pWal->exclusiveMode==WAL_NORMAL_MODE;
+ }
+ return rc;
+}
+
+/*
+** Return true if the argument is non-NULL and the WAL module is using
+** heap-memory for the wal-index. Otherwise, if the argument is NULL or the
+** WAL module is using shared-memory, return false.
+*/
+SQLITE_PRIVATE int sqlite3WalHeapMemory(Wal *pWal){
+ return (pWal && pWal->exclusiveMode==WAL_HEAPMEMORY_MODE );
+}
+
+#ifdef SQLITE_ENABLE_SNAPSHOT
+/* Create a snapshot object. The content of a snapshot is opaque to
+** every other subsystem, so the WAL module can put whatever it needs
+** in the object.
+*/
+SQLITE_PRIVATE int sqlite3WalSnapshotGet(Wal *pWal, sqlite3_snapshot **ppSnapshot){
+ int rc = SQLITE_OK;
+ WalIndexHdr *pRet;
+ static const u32 aZero[4] = { 0, 0, 0, 0 };
+
+ assert( pWal->readLock>=0 && pWal->writeLock==0 );
+
+ if( memcmp(&pWal->hdr.aFrameCksum[0],aZero,16)==0 ){
+ *ppSnapshot = 0;
+ return SQLITE_ERROR;
+ }
+ pRet = (WalIndexHdr*)sqlite3_malloc(sizeof(WalIndexHdr));
+ if( pRet==0 ){
+ rc = SQLITE_NOMEM_BKPT;
+ }else{
+ memcpy(pRet, &pWal->hdr, sizeof(WalIndexHdr));
+ *ppSnapshot = (sqlite3_snapshot*)pRet;
+ }
+
+ return rc;
+}
+
+/* Try to open on pSnapshot when the next read-transaction starts
+*/
+SQLITE_PRIVATE void sqlite3WalSnapshotOpen(
+ Wal *pWal,
+ sqlite3_snapshot *pSnapshot
+){
+ if( pSnapshot && ((WalIndexHdr*)pSnapshot)->iVersion==0 ){
+ /* iVersion==0 means that this is a call to sqlite3_snapshot_get(). In
+ ** this case set the bGetSnapshot flag so that if the call to
+ ** sqlite3_snapshot_get() is about to read transaction on this wal
+ ** file, it does not take read-lock 0 if the wal file has been completely
+ ** checkpointed. Taking read-lock 0 would work, but then it would be
+ ** possible for a subsequent writer to destroy the snapshot even while
+ ** this connection is holding its read-transaction open. This is contrary
+ ** to user expectations, so we avoid it by not taking read-lock 0. */
+ pWal->bGetSnapshot = 1;
+ }else{
+ pWal->pSnapshot = (WalIndexHdr*)pSnapshot;
+ pWal->bGetSnapshot = 0;
+ }
+}
+
+/*
+** Return a +ve value if snapshot p1 is newer than p2. A -ve value if
+** p1 is older than p2 and zero if p1 and p2 are the same snapshot.
+*/
+SQLITE_API int sqlite3_snapshot_cmp(sqlite3_snapshot *p1, sqlite3_snapshot *p2){
+ WalIndexHdr *pHdr1 = (WalIndexHdr*)p1;
+ WalIndexHdr *pHdr2 = (WalIndexHdr*)p2;
+
+ /* aSalt[0] is a copy of the value stored in the wal file header. It
+ ** is incremented each time the wal file is restarted. */
+ if( pHdr1->aSalt[0]<pHdr2->aSalt[0] ) return -1;
+ if( pHdr1->aSalt[0]>pHdr2->aSalt[0] ) return +1;
+ if( pHdr1->mxFrame<pHdr2->mxFrame ) return -1;
+ if( pHdr1->mxFrame>pHdr2->mxFrame ) return +1;
+ return 0;
+}
+
+/*
+** The caller currently has a read transaction open on the database.
+** This function takes a SHARED lock on the CHECKPOINTER slot and then
+** checks if the snapshot passed as the second argument is still
+** available. If so, SQLITE_OK is returned.
+**
+** If the snapshot is not available, SQLITE_ERROR is returned. Or, if
+** the CHECKPOINTER lock cannot be obtained, SQLITE_BUSY. If any error
+** occurs (any value other than SQLITE_OK is returned), the CHECKPOINTER
+** lock is released before returning.
+*/
+SQLITE_PRIVATE int sqlite3WalSnapshotCheck(Wal *pWal, sqlite3_snapshot *pSnapshot){
+ int rc;
+ SEH_TRY {
+ rc = walLockShared(pWal, WAL_CKPT_LOCK);
+ if( rc==SQLITE_OK ){
+ WalIndexHdr *pNew = (WalIndexHdr*)pSnapshot;
+ if( memcmp(pNew->aSalt, pWal->hdr.aSalt, sizeof(pWal->hdr.aSalt))
+ || pNew->mxFrame<walCkptInfo(pWal)->nBackfillAttempted
+ ){
+ rc = SQLITE_ERROR_SNAPSHOT;
+ walUnlockShared(pWal, WAL_CKPT_LOCK);
+ }
+ }
+ }
+ SEH_EXCEPT( rc = walHandleException(pWal); )
+ return rc;
+}
+
+/*
+** Release a lock obtained by an earlier successful call to
+** sqlite3WalSnapshotCheck().
+*/
+SQLITE_PRIVATE void sqlite3WalSnapshotUnlock(Wal *pWal){
+ assert( pWal );
+ walUnlockShared(pWal, WAL_CKPT_LOCK);
+}
+
+
+#endif /* SQLITE_ENABLE_SNAPSHOT */
+
+#ifdef SQLITE_ENABLE_ZIPVFS
+/*
+** If the argument is not NULL, it points to a Wal object that holds a
+** read-lock. This function returns the database page-size if it is known,
+** or zero if it is not (or if pWal is NULL).
+*/
+SQLITE_PRIVATE int sqlite3WalFramesize(Wal *pWal){
+ assert( pWal==0 || pWal->readLock>=0 );
+ return (pWal ? pWal->szPage : 0);
+}
+#endif
+
+/* Return the sqlite3_file object for the WAL file
+*/
+SQLITE_PRIVATE sqlite3_file *sqlite3WalFile(Wal *pWal){
+ return pWal->pWalFd;
+}
+
+#endif /* #ifndef SQLITE_OMIT_WAL */
+
+/************** End of wal.c *************************************************/
+/************** Begin file btmutex.c *****************************************/
+/*
+** 2007 August 27
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+**
+** This file contains code used to implement mutexes on Btree objects.
+** This code really belongs in btree.c. But btree.c is getting too
+** big and we want to break it down some. This packaged seemed like
+** a good breakout.
+*/
+/************** Include btreeInt.h in the middle of btmutex.c ****************/
+/************** Begin file btreeInt.h ****************************************/
+/*
+** 2004 April 6
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This file implements an external (disk-based) database using BTrees.
+** For a detailed discussion of BTrees, refer to
+**
+** Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
+** "Sorting And Searching", pages 473-480. Addison-Wesley
+** Publishing Company, Reading, Massachusetts.
+**
+** The basic idea is that each page of the file contains N database
+** entries and N+1 pointers to subpages.
+**
+** ----------------------------------------------------------------
+** | Ptr(0) | Key(0) | Ptr(1) | Key(1) | ... | Key(N-1) | Ptr(N) |
+** ----------------------------------------------------------------
+**
+** All of the keys on the page that Ptr(0) points to have values less
+** than Key(0). All of the keys on page Ptr(1) and its subpages have
+** values greater than Key(0) and less than Key(1). All of the keys
+** on Ptr(N) and its subpages have values greater than Key(N-1). And
+** so forth.
+**
+** Finding a particular key requires reading O(log(M)) pages from the
+** disk where M is the number of entries in the tree.
+**
+** In this implementation, a single file can hold one or more separate
+** BTrees. Each BTree is identified by the index of its root page. The
+** key and data for any entry are combined to form the "payload". A
+** fixed amount of payload can be carried directly on the database
+** page. If the payload is larger than the preset amount then surplus
+** bytes are stored on overflow pages. The payload for an entry
+** and the preceding pointer are combined to form a "Cell". Each
+** page has a small header which contains the Ptr(N) pointer and other
+** information such as the size of key and data.
+**
+** FORMAT DETAILS
+**
+** The file is divided into pages. The first page is called page 1,
+** the second is page 2, and so forth. A page number of zero indicates
+** "no such page". The page size can be any power of 2 between 512 and 65536.
+** Each page can be either a btree page, a freelist page, an overflow
+** page, or a pointer-map page.
+**
+** The first page is always a btree page. The first 100 bytes of the first
+** page contain a special header (the "file header") that describes the file.
+** The format of the file header is as follows:
+**
+** OFFSET SIZE DESCRIPTION
+** 0 16 Header string: "SQLite format 3\000"
+** 16 2 Page size in bytes. (1 means 65536)
+** 18 1 File format write version
+** 19 1 File format read version
+** 20 1 Bytes of unused space at the end of each page
+** 21 1 Max embedded payload fraction (must be 64)
+** 22 1 Min embedded payload fraction (must be 32)
+** 23 1 Min leaf payload fraction (must be 32)
+** 24 4 File change counter
+** 28 4 The size of the database in pages
+** 32 4 First freelist page
+** 36 4 Number of freelist pages in the file
+** 40 60 15 4-byte meta values passed to higher layers
+**
+** 40 4 Schema cookie
+** 44 4 File format of schema layer
+** 48 4 Size of page cache
+** 52 4 Largest root-page (auto/incr_vacuum)
+** 56 4 1=UTF-8 2=UTF16le 3=UTF16be
+** 60 4 User version
+** 64 4 Incremental vacuum mode
+** 68 4 Application-ID
+** 72 20 unused
+** 92 4 The version-valid-for number
+** 96 4 SQLITE_VERSION_NUMBER
+**
+** All of the integer values are big-endian (most significant byte first).
+**
+** The file change counter is incremented when the database is changed
+** This counter allows other processes to know when the file has changed
+** and thus when they need to flush their cache.
+**
+** The max embedded payload fraction is the amount of the total usable
+** space in a page that can be consumed by a single cell for standard
+** B-tree (non-LEAFDATA) tables. A value of 255 means 100%. The default
+** is to limit the maximum cell size so that at least 4 cells will fit
+** on one page. Thus the default max embedded payload fraction is 64.
+**
+** If the payload for a cell is larger than the max payload, then extra
+** payload is spilled to overflow pages. Once an overflow page is allocated,
+** as many bytes as possible are moved into the overflow pages without letting
+** the cell size drop below the min embedded payload fraction.
+**
+** The min leaf payload fraction is like the min embedded payload fraction
+** except that it applies to leaf nodes in a LEAFDATA tree. The maximum
+** payload fraction for a LEAFDATA tree is always 100% (or 255) and it
+** not specified in the header.
+**
+** Each btree pages is divided into three sections: The header, the
+** cell pointer array, and the cell content area. Page 1 also has a 100-byte
+** file header that occurs before the page header.
+**
+** |----------------|
+** | file header | 100 bytes. Page 1 only.
+** |----------------|
+** | page header | 8 bytes for leaves. 12 bytes for interior nodes
+** |----------------|
+** | cell pointer | | 2 bytes per cell. Sorted order.
+** | array | | Grows downward
+** | | v
+** |----------------|
+** | unallocated |
+** | space |
+** |----------------| ^ Grows upwards
+** | cell content | | Arbitrary order interspersed with freeblocks.
+** | area | | and free space fragments.
+** |----------------|
+**
+** The page headers looks like this:
+**
+** OFFSET SIZE DESCRIPTION
+** 0 1 Flags. 1: intkey, 2: zerodata, 4: leafdata, 8: leaf
+** 1 2 byte offset to the first freeblock
+** 3 2 number of cells on this page
+** 5 2 first byte of the cell content area
+** 7 1 number of fragmented free bytes
+** 8 4 Right child (the Ptr(N) value). Omitted on leaves.
+**
+** The flags define the format of this btree page. The leaf flag means that
+** this page has no children. The zerodata flag means that this page carries
+** only keys and no data. The intkey flag means that the key is an integer
+** which is stored in the key size entry of the cell header rather than in
+** the payload area.
+**
+** The cell pointer array begins on the first byte after the page header.
+** The cell pointer array contains zero or more 2-byte numbers which are
+** offsets from the beginning of the page to the cell content in the cell
+** content area. The cell pointers occur in sorted order. The system strives
+** to keep free space after the last cell pointer so that new cells can
+** be easily added without having to defragment the page.
+**
+** Cell content is stored at the very end of the page and grows toward the
+** beginning of the page.
+**
+** Unused space within the cell content area is collected into a linked list of
+** freeblocks. Each freeblock is at least 4 bytes in size. The byte offset
+** to the first freeblock is given in the header. Freeblocks occur in
+** increasing order. Because a freeblock must be at least 4 bytes in size,
+** any group of 3 or fewer unused bytes in the cell content area cannot
+** exist on the freeblock chain. A group of 3 or fewer free bytes is called
+** a fragment. The total number of bytes in all fragments is recorded.
+** in the page header at offset 7.
+**
+** SIZE DESCRIPTION
+** 2 Byte offset of the next freeblock
+** 2 Bytes in this freeblock
+**
+** Cells are of variable length. Cells are stored in the cell content area at
+** the end of the page. Pointers to the cells are in the cell pointer array
+** that immediately follows the page header. Cells is not necessarily
+** contiguous or in order, but cell pointers are contiguous and in order.
+**
+** Cell content makes use of variable length integers. A variable
+** length integer is 1 to 9 bytes where the lower 7 bits of each
+** byte are used. The integer consists of all bytes that have bit 8 set and
+** the first byte with bit 8 clear. The most significant byte of the integer
+** appears first. A variable-length integer may not be more than 9 bytes long.
+** As a special case, all 8 bits of the 9th byte are used as data. This
+** allows a 64-bit integer to be encoded in 9 bytes.
+**
+** 0x00 becomes 0x00000000
+** 0x7f becomes 0x0000007f
+** 0x81 0x00 becomes 0x00000080
+** 0x82 0x00 becomes 0x00000100
+** 0x80 0x7f becomes 0x0000007f
+** 0x81 0x91 0xd1 0xac 0x78 becomes 0x12345678
+** 0x81 0x81 0x81 0x81 0x01 becomes 0x10204081
+**
+** Variable length integers are used for rowids and to hold the number of
+** bytes of key and data in a btree cell.
+**
+** The content of a cell looks like this:
+**
+** SIZE DESCRIPTION
+** 4 Page number of the left child. Omitted if leaf flag is set.
+** var Number of bytes of data. Omitted if the zerodata flag is set.
+** var Number of bytes of key. Or the key itself if intkey flag is set.
+** * Payload
+** 4 First page of the overflow chain. Omitted if no overflow
+**
+** Overflow pages form a linked list. Each page except the last is completely
+** filled with data (pagesize - 4 bytes). The last page can have as little
+** as 1 byte of data.
+**
+** SIZE DESCRIPTION
+** 4 Page number of next overflow page
+** * Data
+**
+** Freelist pages come in two subtypes: trunk pages and leaf pages. The
+** file header points to the first in a linked list of trunk page. Each trunk
+** page points to multiple leaf pages. The content of a leaf page is
+** unspecified. A trunk page looks like this:
+**
+** SIZE DESCRIPTION
+** 4 Page number of next trunk page
+** 4 Number of leaf pointers on this page
+** * zero or more pages numbers of leaves
+*/
+/* #include "sqliteInt.h" */
+
+
+/* The following value is the maximum cell size assuming a maximum page
+** size give above.
+*/
+#define MX_CELL_SIZE(pBt) ((int)(pBt->pageSize-8))
+
+/* The maximum number of cells on a single page of the database. This
+** assumes a minimum cell size of 6 bytes (4 bytes for the cell itself
+** plus 2 bytes for the index to the cell in the page header). Such
+** small cells will be rare, but they are possible.
+*/
+#define MX_CELL(pBt) ((pBt->pageSize-8)/6)
+
+/* Forward declarations */
+typedef struct MemPage MemPage;
+typedef struct BtLock BtLock;
+typedef struct CellInfo CellInfo;
+
+/*
+** This is a magic string that appears at the beginning of every
+** SQLite database in order to identify the file as a real database.
+**
+** You can change this value at compile-time by specifying a
+** -DSQLITE_FILE_HEADER="..." on the compiler command-line. The
+** header must be exactly 16 bytes including the zero-terminator so
+** the string itself should be 15 characters long. If you change
+** the header, then your custom library will not be able to read
+** databases generated by the standard tools and the standard tools
+** will not be able to read databases created by your custom library.
+*/
+#ifndef SQLITE_FILE_HEADER /* 123456789 123456 */
+# define SQLITE_FILE_HEADER "SQLite format 3"
+#endif
+
+/*
+** Page type flags. An ORed combination of these flags appear as the
+** first byte of on-disk image of every BTree page.
+*/
+#define PTF_INTKEY 0x01
+#define PTF_ZERODATA 0x02
+#define PTF_LEAFDATA 0x04
+#define PTF_LEAF 0x08
+
+/*
+** An instance of this object stores information about each a single database
+** page that has been loaded into memory. The information in this object
+** is derived from the raw on-disk page content.
+**
+** As each database page is loaded into memory, the pager allocates an
+** instance of this object and zeros the first 8 bytes. (This is the
+** "extra" information associated with each page of the pager.)
+**
+** Access to all fields of this structure is controlled by the mutex
+** stored in MemPage.pBt->mutex.
+*/
+struct MemPage {
+ u8 isInit; /* True if previously initialized. MUST BE FIRST! */
+ u8 intKey; /* True if table b-trees. False for index b-trees */
+ u8 intKeyLeaf; /* True if the leaf of an intKey table */
+ Pgno pgno; /* Page number for this page */
+ /* Only the first 8 bytes (above) are zeroed by pager.c when a new page
+ ** is allocated. All fields that follow must be initialized before use */
+ u8 leaf; /* True if a leaf page */
+ u8 hdrOffset; /* 100 for page 1. 0 otherwise */
+ u8 childPtrSize; /* 0 if leaf==1. 4 if leaf==0 */
+ u8 max1bytePayload; /* min(maxLocal,127) */
+ u8 nOverflow; /* Number of overflow cell bodies in aCell[] */
+ u16 maxLocal; /* Copy of BtShared.maxLocal or BtShared.maxLeaf */
+ u16 minLocal; /* Copy of BtShared.minLocal or BtShared.minLeaf */
+ u16 cellOffset; /* Index in aData of first cell pointer */
+ int nFree; /* Number of free bytes on the page. -1 for unknown */
+ u16 nCell; /* Number of cells on this page, local and ovfl */
+ u16 maskPage; /* Mask for page offset */
+ u16 aiOvfl[4]; /* Insert the i-th overflow cell before the aiOvfl-th
+ ** non-overflow cell */
+ u8 *apOvfl[4]; /* Pointers to the body of overflow cells */
+ BtShared *pBt; /* Pointer to BtShared that this page is part of */
+ u8 *aData; /* Pointer to disk image of the page data */
+ u8 *aDataEnd; /* One byte past the end of the entire page - not just
+ ** the usable space, the entire page. Used to prevent
+ ** corruption-induced buffer overflow. */
+ u8 *aCellIdx; /* The cell index area */
+ u8 *aDataOfst; /* Same as aData for leaves. aData+4 for interior */
+ DbPage *pDbPage; /* Pager page handle */
+ u16 (*xCellSize)(MemPage*,u8*); /* cellSizePtr method */
+ void (*xParseCell)(MemPage*,u8*,CellInfo*); /* btreeParseCell method */
+};
+
+/*
+** A linked list of the following structures is stored at BtShared.pLock.
+** Locks are added (or upgraded from READ_LOCK to WRITE_LOCK) when a cursor
+** is opened on the table with root page BtShared.iTable. Locks are removed
+** from this list when a transaction is committed or rolled back, or when
+** a btree handle is closed.
+*/
+struct BtLock {
+ Btree *pBtree; /* Btree handle holding this lock */
+ Pgno iTable; /* Root page of table */
+ u8 eLock; /* READ_LOCK or WRITE_LOCK */
+ BtLock *pNext; /* Next in BtShared.pLock list */
+};
+
+/* Candidate values for BtLock.eLock */
+#define READ_LOCK 1
+#define WRITE_LOCK 2
+
+/* A Btree handle
+**
+** A database connection contains a pointer to an instance of
+** this object for every database file that it has open. This structure
+** is opaque to the database connection. The database connection cannot
+** see the internals of this structure and only deals with pointers to
+** this structure.
+**
+** For some database files, the same underlying database cache might be
+** shared between multiple connections. In that case, each connection
+** has it own instance of this object. But each instance of this object
+** points to the same BtShared object. The database cache and the
+** schema associated with the database file are all contained within
+** the BtShared object.
+**
+** All fields in this structure are accessed under sqlite3.mutex.
+** The pBt pointer itself may not be changed while there exists cursors
+** in the referenced BtShared that point back to this Btree since those
+** cursors have to go through this Btree to find their BtShared and
+** they often do so without holding sqlite3.mutex.
+*/
+struct Btree {
+ sqlite3 *db; /* The database connection holding this btree */
+ BtShared *pBt; /* Sharable content of this btree */
+ u8 inTrans; /* TRANS_NONE, TRANS_READ or TRANS_WRITE */
+ u8 sharable; /* True if we can share pBt with another db */
+ u8 locked; /* True if db currently has pBt locked */
+ u8 hasIncrblobCur; /* True if there are one or more Incrblob cursors */
+ int wantToLock; /* Number of nested calls to sqlite3BtreeEnter() */
+ int nBackup; /* Number of backup operations reading this btree */
+ u32 iBDataVersion; /* Combines with pBt->pPager->iDataVersion */
+ Btree *pNext; /* List of other sharable Btrees from the same db */
+ Btree *pPrev; /* Back pointer of the same list */
+#ifdef SQLITE_DEBUG
+ u64 nSeek; /* Calls to sqlite3BtreeMovetoUnpacked() */
+#endif
+#ifndef SQLITE_OMIT_SHARED_CACHE
+ BtLock lock; /* Object used to lock page 1 */
+#endif
+};
+
+/*
+** Btree.inTrans may take one of the following values.
+**
+** If the shared-data extension is enabled, there may be multiple users
+** of the Btree structure. At most one of these may open a write transaction,
+** but any number may have active read transactions.
+**
+** These values must match SQLITE_TXN_NONE, SQLITE_TXN_READ, and
+** SQLITE_TXN_WRITE
+*/
+#define TRANS_NONE 0
+#define TRANS_READ 1
+#define TRANS_WRITE 2
+
+#if TRANS_NONE!=SQLITE_TXN_NONE
+# error wrong numeric code for no-transaction
+#endif
+#if TRANS_READ!=SQLITE_TXN_READ
+# error wrong numeric code for read-transaction
+#endif
+#if TRANS_WRITE!=SQLITE_TXN_WRITE
+# error wrong numeric code for write-transaction
+#endif
+
+
+/*
+** An instance of this object represents a single database file.
+**
+** A single database file can be in use at the same time by two
+** or more database connections. When two or more connections are
+** sharing the same database file, each connection has it own
+** private Btree object for the file and each of those Btrees points
+** to this one BtShared object. BtShared.nRef is the number of
+** connections currently sharing this database file.
+**
+** Fields in this structure are accessed under the BtShared.mutex
+** mutex, except for nRef and pNext which are accessed under the
+** global SQLITE_MUTEX_STATIC_MAIN mutex. The pPager field
+** may not be modified once it is initially set as long as nRef>0.
+** The pSchema field may be set once under BtShared.mutex and
+** thereafter is unchanged as long as nRef>0.
+**
+** isPending:
+**
+** If a BtShared client fails to obtain a write-lock on a database
+** table (because there exists one or more read-locks on the table),
+** the shared-cache enters 'pending-lock' state and isPending is
+** set to true.
+**
+** The shared-cache leaves the 'pending lock' state when either of
+** the following occur:
+**
+** 1) The current writer (BtShared.pWriter) concludes its transaction, OR
+** 2) The number of locks held by other connections drops to zero.
+**
+** while in the 'pending-lock' state, no connection may start a new
+** transaction.
+**
+** This feature is included to help prevent writer-starvation.
+*/
+struct BtShared {
+ Pager *pPager; /* The page cache */
+ sqlite3 *db; /* Database connection currently using this Btree */
+ BtCursor *pCursor; /* A list of all open cursors */
+ MemPage *pPage1; /* First page of the database */
+ u8 openFlags; /* Flags to sqlite3BtreeOpen() */
+#ifndef SQLITE_OMIT_AUTOVACUUM
+ u8 autoVacuum; /* True if auto-vacuum is enabled */
+ u8 incrVacuum; /* True if incr-vacuum is enabled */
+ u8 bDoTruncate; /* True to truncate db on commit */
+#endif
+ u8 inTransaction; /* Transaction state */
+ u8 max1bytePayload; /* Maximum first byte of cell for a 1-byte payload */
+ u8 nReserveWanted; /* Desired number of extra bytes per page */
+ u16 btsFlags; /* Boolean parameters. See BTS_* macros below */
+ u16 maxLocal; /* Maximum local payload in non-LEAFDATA tables */
+ u16 minLocal; /* Minimum local payload in non-LEAFDATA tables */
+ u16 maxLeaf; /* Maximum local payload in a LEAFDATA table */
+ u16 minLeaf; /* Minimum local payload in a LEAFDATA table */
+ u32 pageSize; /* Total number of bytes on a page */
+ u32 usableSize; /* Number of usable bytes on each page */
+ int nTransaction; /* Number of open transactions (read + write) */
+ u32 nPage; /* Number of pages in the database */
+ void *pSchema; /* Pointer to space allocated by sqlite3BtreeSchema() */
+ void (*xFreeSchema)(void*); /* Destructor for BtShared.pSchema */
+ sqlite3_mutex *mutex; /* Non-recursive mutex required to access this object */
+ Bitvec *pHasContent; /* Set of pages moved to free-list this transaction */
+#ifndef SQLITE_OMIT_SHARED_CACHE
+ int nRef; /* Number of references to this structure */
+ BtShared *pNext; /* Next on a list of sharable BtShared structs */
+ BtLock *pLock; /* List of locks held on this shared-btree struct */
+ Btree *pWriter; /* Btree with currently open write transaction */
+#endif
+ u8 *pTmpSpace; /* Temp space sufficient to hold a single cell */
+ int nPreformatSize; /* Size of last cell written by TransferRow() */
+};
+
+/*
+** Allowed values for BtShared.btsFlags
+*/
+#define BTS_READ_ONLY 0x0001 /* Underlying file is readonly */
+#define BTS_PAGESIZE_FIXED 0x0002 /* Page size can no longer be changed */
+#define BTS_SECURE_DELETE 0x0004 /* PRAGMA secure_delete is enabled */
+#define BTS_OVERWRITE 0x0008 /* Overwrite deleted content with zeros */
+#define BTS_FAST_SECURE 0x000c /* Combination of the previous two */
+#define BTS_INITIALLY_EMPTY 0x0010 /* Database was empty at trans start */
+#define BTS_NO_WAL 0x0020 /* Do not open write-ahead-log files */
+#define BTS_EXCLUSIVE 0x0040 /* pWriter has an exclusive lock */
+#define BTS_PENDING 0x0080 /* Waiting for read-locks to clear */
+
+/*
+** An instance of the following structure is used to hold information
+** about a cell. The parseCellPtr() function fills in this structure
+** based on information extract from the raw disk page.
+*/
+struct CellInfo {
+ i64 nKey; /* The key for INTKEY tables, or nPayload otherwise */
+ u8 *pPayload; /* Pointer to the start of payload */
+ u32 nPayload; /* Bytes of payload */
+ u16 nLocal; /* Amount of payload held locally, not on overflow */
+ u16 nSize; /* Size of the cell content on the main b-tree page */
+};
+
+/*
+** Maximum depth of an SQLite B-Tree structure. Any B-Tree deeper than
+** this will be declared corrupt. This value is calculated based on a
+** maximum database size of 2^31 pages a minimum fanout of 2 for a
+** root-node and 3 for all other internal nodes.
+**
+** If a tree that appears to be taller than this is encountered, it is
+** assumed that the database is corrupt.
+*/
+#define BTCURSOR_MAX_DEPTH 20
+
+/*
+** A cursor is a pointer to a particular entry within a particular
+** b-tree within a database file.
+**
+** The entry is identified by its MemPage and the index in
+** MemPage.aCell[] of the entry.
+**
+** A single database file can be shared by two more database connections,
+** but cursors cannot be shared. Each cursor is associated with a
+** particular database connection identified BtCursor.pBtree.db.
+**
+** Fields in this structure are accessed under the BtShared.mutex
+** found at self->pBt->mutex.
+**
+** skipNext meaning:
+** The meaning of skipNext depends on the value of eState:
+**
+** eState Meaning of skipNext
+** VALID skipNext is meaningless and is ignored
+** INVALID skipNext is meaningless and is ignored
+** SKIPNEXT sqlite3BtreeNext() is a no-op if skipNext>0 and
+** sqlite3BtreePrevious() is no-op if skipNext<0.
+** REQUIRESEEK restoreCursorPosition() restores the cursor to
+** eState=SKIPNEXT if skipNext!=0
+** FAULT skipNext holds the cursor fault error code.
+*/
+struct BtCursor {
+ u8 eState; /* One of the CURSOR_XXX constants (see below) */
+ u8 curFlags; /* zero or more BTCF_* flags defined below */
+ u8 curPagerFlags; /* Flags to send to sqlite3PagerGet() */
+ u8 hints; /* As configured by CursorSetHints() */
+ int skipNext; /* Prev() is noop if negative. Next() is noop if positive.
+ ** Error code if eState==CURSOR_FAULT */
+ Btree *pBtree; /* The Btree to which this cursor belongs */
+ Pgno *aOverflow; /* Cache of overflow page locations */
+ void *pKey; /* Saved key that was cursor last known position */
+ /* All fields above are zeroed when the cursor is allocated. See
+ ** sqlite3BtreeCursorZero(). Fields that follow must be manually
+ ** initialized. */
+#define BTCURSOR_FIRST_UNINIT pBt /* Name of first uninitialized field */
+ BtShared *pBt; /* The BtShared this cursor points to */
+ BtCursor *pNext; /* Forms a linked list of all cursors */
+ CellInfo info; /* A parse of the cell we are pointing at */
+ i64 nKey; /* Size of pKey, or last integer key */
+ Pgno pgnoRoot; /* The root page of this tree */
+ i8 iPage; /* Index of current page in apPage */
+ u8 curIntKey; /* Value of apPage[0]->intKey */
+ u16 ix; /* Current index for apPage[iPage] */
+ u16 aiIdx[BTCURSOR_MAX_DEPTH-1]; /* Current index in apPage[i] */
+ struct KeyInfo *pKeyInfo; /* Arg passed to comparison function */
+ MemPage *pPage; /* Current page */
+ MemPage *apPage[BTCURSOR_MAX_DEPTH-1]; /* Stack of parents of current page */
+};
+
+/*
+** Legal values for BtCursor.curFlags
+*/
+#define BTCF_WriteFlag 0x01 /* True if a write cursor */
+#define BTCF_ValidNKey 0x02 /* True if info.nKey is valid */
+#define BTCF_ValidOvfl 0x04 /* True if aOverflow is valid */
+#define BTCF_AtLast 0x08 /* Cursor is pointing to the last entry */
+#define BTCF_Incrblob 0x10 /* True if an incremental I/O handle */
+#define BTCF_Multiple 0x20 /* Maybe another cursor on the same btree */
+#define BTCF_Pinned 0x40 /* Cursor is busy and cannot be moved */
+
+/*
+** Potential values for BtCursor.eState.
+**
+** CURSOR_INVALID:
+** Cursor does not point to a valid entry. This can happen (for example)
+** because the table is empty or because BtreeCursorFirst() has not been
+** called.
+**
+** CURSOR_VALID:
+** Cursor points to a valid entry. getPayload() etc. may be called.
+**
+** CURSOR_SKIPNEXT:
+** Cursor is valid except that the Cursor.skipNext field is non-zero
+** indicating that the next sqlite3BtreeNext() or sqlite3BtreePrevious()
+** operation should be a no-op.
+**
+** CURSOR_REQUIRESEEK:
+** The table that this cursor was opened on still exists, but has been
+** modified since the cursor was last used. The cursor position is saved
+** in variables BtCursor.pKey and BtCursor.nKey. When a cursor is in
+** this state, restoreCursorPosition() can be called to attempt to
+** seek the cursor to the saved position.
+**
+** CURSOR_FAULT:
+** An unrecoverable error (an I/O error or a malloc failure) has occurred
+** on a different connection that shares the BtShared cache with this
+** cursor. The error has left the cache in an inconsistent state.
+** Do nothing else with this cursor. Any attempt to use the cursor
+** should return the error code stored in BtCursor.skipNext
+*/
+#define CURSOR_VALID 0
+#define CURSOR_INVALID 1
+#define CURSOR_SKIPNEXT 2
+#define CURSOR_REQUIRESEEK 3
+#define CURSOR_FAULT 4
+
+/*
+** The database page the PENDING_BYTE occupies. This page is never used.
+*/
+#define PENDING_BYTE_PAGE(pBt) ((Pgno)((PENDING_BYTE/((pBt)->pageSize))+1))
+
+/*
+** These macros define the location of the pointer-map entry for a
+** database page. The first argument to each is the number of usable
+** bytes on each page of the database (often 1024). The second is the
+** page number to look up in the pointer map.
+**
+** PTRMAP_PAGENO returns the database page number of the pointer-map
+** page that stores the required pointer. PTRMAP_PTROFFSET returns
+** the offset of the requested map entry.
+**
+** If the pgno argument passed to PTRMAP_PAGENO is a pointer-map page,
+** then pgno is returned. So (pgno==PTRMAP_PAGENO(pgsz, pgno)) can be
+** used to test if pgno is a pointer-map page. PTRMAP_ISPAGE implements
+** this test.
+*/
+#define PTRMAP_PAGENO(pBt, pgno) ptrmapPageno(pBt, pgno)
+#define PTRMAP_PTROFFSET(pgptrmap, pgno) (5*(pgno-pgptrmap-1))
+#define PTRMAP_ISPAGE(pBt, pgno) (PTRMAP_PAGENO((pBt),(pgno))==(pgno))
+
+/*
+** The pointer map is a lookup table that identifies the parent page for
+** each child page in the database file. The parent page is the page that
+** contains a pointer to the child. Every page in the database contains
+** 0 or 1 parent pages. (In this context 'database page' refers
+** to any page that is not part of the pointer map itself.) Each pointer map
+** entry consists of a single byte 'type' and a 4 byte parent page number.
+** The PTRMAP_XXX identifiers below are the valid types.
+**
+** The purpose of the pointer map is to facility moving pages from one
+** position in the file to another as part of autovacuum. When a page
+** is moved, the pointer in its parent must be updated to point to the
+** new location. The pointer map is used to locate the parent page quickly.
+**
+** PTRMAP_ROOTPAGE: The database page is a root-page. The page-number is not
+** used in this case.
+**
+** PTRMAP_FREEPAGE: The database page is an unused (free) page. The page-number
+** is not used in this case.
+**
+** PTRMAP_OVERFLOW1: The database page is the first page in a list of
+** overflow pages. The page number identifies the page that
+** contains the cell with a pointer to this overflow page.
+**
+** PTRMAP_OVERFLOW2: The database page is the second or later page in a list of
+** overflow pages. The page-number identifies the previous
+** page in the overflow page list.
+**
+** PTRMAP_BTREE: The database page is a non-root btree page. The page number
+** identifies the parent page in the btree.
+*/
+#define PTRMAP_ROOTPAGE 1
+#define PTRMAP_FREEPAGE 2
+#define PTRMAP_OVERFLOW1 3
+#define PTRMAP_OVERFLOW2 4
+#define PTRMAP_BTREE 5
+
+/* A bunch of assert() statements to check the transaction state variables
+** of handle p (type Btree*) are internally consistent.
+*/
+#define btreeIntegrity(p) \
+ assert( p->pBt->inTransaction!=TRANS_NONE || p->pBt->nTransaction==0 ); \
+ assert( p->pBt->inTransaction>=p->inTrans );
+
+
+/*
+** The ISAUTOVACUUM macro is used within balance_nonroot() to determine
+** if the database supports auto-vacuum or not. Because it is used
+** within an expression that is an argument to another macro
+** (sqliteMallocRaw), it is not possible to use conditional compilation.
+** So, this macro is defined instead.
+*/
+#ifndef SQLITE_OMIT_AUTOVACUUM
+#define ISAUTOVACUUM(pBt) (pBt->autoVacuum)
+#else
+#define ISAUTOVACUUM(pBt) 0
+#endif
+
+
+/*
+** This structure is passed around through all the PRAGMA integrity_check
+** checking routines in order to keep track of some global state information.
+**
+** The aRef[] array is allocated so that there is 1 bit for each page in
+** the database. As the integrity-check proceeds, for each page used in
+** the database the corresponding bit is set. This allows integrity-check to
+** detect pages that are used twice and orphaned pages (both of which
+** indicate corruption).
+*/
+typedef struct IntegrityCk IntegrityCk;
+struct IntegrityCk {
+ BtShared *pBt; /* The tree being checked out */
+ Pager *pPager; /* The associated pager. Also accessible by pBt->pPager */
+ u8 *aPgRef; /* 1 bit per page in the db (see above) */
+ Pgno nCkPage; /* Pages in the database. 0 for partial check */
+ int mxErr; /* Stop accumulating errors when this reaches zero */
+ int nErr; /* Number of messages written to zErrMsg so far */
+ int rc; /* SQLITE_OK, SQLITE_NOMEM, or SQLITE_INTERRUPT */
+ u32 nStep; /* Number of steps into the integrity_check process */
+ const char *zPfx; /* Error message prefix */
+ Pgno v0; /* Value for first %u substitution in zPfx (root page) */
+ Pgno v1; /* Value for second %u substitution in zPfx (current pg) */
+ int v2; /* Value for third %d substitution in zPfx */
+ StrAccum errMsg; /* Accumulate the error message text here */
+ u32 *heap; /* Min-heap used for analyzing cell coverage */
+ sqlite3 *db; /* Database connection running the check */
+ i64 nRow; /* Number of rows visited in current tree */
+};
+
+/*
+** Routines to read or write a two- and four-byte big-endian integer values.
+*/
+#define get2byte(x) ((x)[0]<<8 | (x)[1])
+#define put2byte(p,v) ((p)[0] = (u8)((v)>>8), (p)[1] = (u8)(v))
+#define get4byte sqlite3Get4byte
+#define put4byte sqlite3Put4byte
+
+/*
+** get2byteAligned(), unlike get2byte(), requires that its argument point to a
+** two-byte aligned address. get2byteAligned() is only used for accessing the
+** cell addresses in a btree header.
+*/
+#if SQLITE_BYTEORDER==4321
+# define get2byteAligned(x) (*(u16*)(x))
+#elif SQLITE_BYTEORDER==1234 && GCC_VERSION>=4008000
+# define get2byteAligned(x) __builtin_bswap16(*(u16*)(x))
+#elif SQLITE_BYTEORDER==1234 && MSVC_VERSION>=1300
+# define get2byteAligned(x) _byteswap_ushort(*(u16*)(x))
+#else
+# define get2byteAligned(x) ((x)[0]<<8 | (x)[1])
+#endif
+
+/************** End of btreeInt.h ********************************************/
+/************** Continuing where we left off in btmutex.c ********************/
+#ifndef SQLITE_OMIT_SHARED_CACHE
+#if SQLITE_THREADSAFE
+
+/*
+** Obtain the BtShared mutex associated with B-Tree handle p. Also,
+** set BtShared.db to the database handle associated with p and the
+** p->locked boolean to true.
+*/
+static void lockBtreeMutex(Btree *p){
+ assert( p->locked==0 );
+ assert( sqlite3_mutex_notheld(p->pBt->mutex) );
+ assert( sqlite3_mutex_held(p->db->mutex) );
+
+ sqlite3_mutex_enter(p->pBt->mutex);
+ p->pBt->db = p->db;
+ p->locked = 1;
+}
+
+/*
+** Release the BtShared mutex associated with B-Tree handle p and
+** clear the p->locked boolean.
+*/
+static void SQLITE_NOINLINE unlockBtreeMutex(Btree *p){
+ BtShared *pBt = p->pBt;
+ assert( p->locked==1 );
+ assert( sqlite3_mutex_held(pBt->mutex) );
+ assert( sqlite3_mutex_held(p->db->mutex) );
+ assert( p->db==pBt->db );
+
+ sqlite3_mutex_leave(pBt->mutex);
+ p->locked = 0;
+}
+
+/* Forward reference */
+static void SQLITE_NOINLINE btreeLockCarefully(Btree *p);
+
+/*
+** Enter a mutex on the given BTree object.
+**
+** If the object is not sharable, then no mutex is ever required
+** and this routine is a no-op. The underlying mutex is non-recursive.
+** But we keep a reference count in Btree.wantToLock so the behavior
+** of this interface is recursive.
+**
+** To avoid deadlocks, multiple Btrees are locked in the same order
+** by all database connections. The p->pNext is a list of other
+** Btrees belonging to the same database connection as the p Btree
+** which need to be locked after p. If we cannot get a lock on
+** p, then first unlock all of the others on p->pNext, then wait
+** for the lock to become available on p, then relock all of the
+** subsequent Btrees that desire a lock.
+*/
+SQLITE_PRIVATE void sqlite3BtreeEnter(Btree *p){
+ /* Some basic sanity checking on the Btree. The list of Btrees
+ ** connected by pNext and pPrev should be in sorted order by
+ ** Btree.pBt value. All elements of the list should belong to
+ ** the same connection. Only shared Btrees are on the list. */
+ assert( p->pNext==0 || p->pNext->pBt>p->pBt );
+ assert( p->pPrev==0 || p->pPrev->pBt<p->pBt );
+ assert( p->pNext==0 || p->pNext->db==p->db );
+ assert( p->pPrev==0 || p->pPrev->db==p->db );
+ assert( p->sharable || (p->pNext==0 && p->pPrev==0) );
+
+ /* Check for locking consistency */
+ assert( !p->locked || p->wantToLock>0 );
+ assert( p->sharable || p->wantToLock==0 );
+
+ /* We should already hold a lock on the database connection */
+ assert( sqlite3_mutex_held(p->db->mutex) );
+
+ /* Unless the database is sharable and unlocked, then BtShared.db
+ ** should already be set correctly. */
+ assert( (p->locked==0 && p->sharable) || p->pBt->db==p->db );
+
+ if( !p->sharable ) return;
+ p->wantToLock++;
+ if( p->locked ) return;
+ btreeLockCarefully(p);
+}
+
+/* This is a helper function for sqlite3BtreeLock(). By moving
+** complex, but seldom used logic, out of sqlite3BtreeLock() and
+** into this routine, we avoid unnecessary stack pointer changes
+** and thus help the sqlite3BtreeLock() routine to run much faster
+** in the common case.
+*/
+static void SQLITE_NOINLINE btreeLockCarefully(Btree *p){
+ Btree *pLater;
+
+ /* In most cases, we should be able to acquire the lock we
+ ** want without having to go through the ascending lock
+ ** procedure that follows. Just be sure not to block.
+ */
+ if( sqlite3_mutex_try(p->pBt->mutex)==SQLITE_OK ){
+ p->pBt->db = p->db;
+ p->locked = 1;
+ return;
+ }
+
+ /* To avoid deadlock, first release all locks with a larger
+ ** BtShared address. Then acquire our lock. Then reacquire
+ ** the other BtShared locks that we used to hold in ascending
+ ** order.
+ */
+ for(pLater=p->pNext; pLater; pLater=pLater->pNext){
+ assert( pLater->sharable );
+ assert( pLater->pNext==0 || pLater->pNext->pBt>pLater->pBt );
+ assert( !pLater->locked || pLater->wantToLock>0 );
+ if( pLater->locked ){
+ unlockBtreeMutex(pLater);
+ }
+ }
+ lockBtreeMutex(p);
+ for(pLater=p->pNext; pLater; pLater=pLater->pNext){
+ if( pLater->wantToLock ){
+ lockBtreeMutex(pLater);
+ }
+ }
+}
+
+
+/*
+** Exit the recursive mutex on a Btree.
+*/
+SQLITE_PRIVATE void sqlite3BtreeLeave(Btree *p){
+ assert( sqlite3_mutex_held(p->db->mutex) );
+ if( p->sharable ){
+ assert( p->wantToLock>0 );
+ p->wantToLock--;
+ if( p->wantToLock==0 ){
+ unlockBtreeMutex(p);
+ }
+ }
+}
+
+#ifndef NDEBUG
+/*
+** Return true if the BtShared mutex is held on the btree, or if the
+** B-Tree is not marked as sharable.
+**
+** This routine is used only from within assert() statements.
+*/
+SQLITE_PRIVATE int sqlite3BtreeHoldsMutex(Btree *p){
+ assert( p->sharable==0 || p->locked==0 || p->wantToLock>0 );
+ assert( p->sharable==0 || p->locked==0 || p->db==p->pBt->db );
+ assert( p->sharable==0 || p->locked==0 || sqlite3_mutex_held(p->pBt->mutex) );
+ assert( p->sharable==0 || p->locked==0 || sqlite3_mutex_held(p->db->mutex) );
+
+ return (p->sharable==0 || p->locked);
+}
+#endif
+
+
+/*
+** Enter the mutex on every Btree associated with a database
+** connection. This is needed (for example) prior to parsing
+** a statement since we will be comparing table and column names
+** against all schemas and we do not want those schemas being
+** reset out from under us.
+**
+** There is a corresponding leave-all procedures.
+**
+** Enter the mutexes in ascending order by BtShared pointer address
+** to avoid the possibility of deadlock when two threads with
+** two or more btrees in common both try to lock all their btrees
+** at the same instant.
+*/
+static void SQLITE_NOINLINE btreeEnterAll(sqlite3 *db){
+ int i;
+ int skipOk = 1;
+ Btree *p;
+ assert( sqlite3_mutex_held(db->mutex) );
+ for(i=0; i<db->nDb; i++){
+ p = db->aDb[i].pBt;
+ if( p && p->sharable ){
+ sqlite3BtreeEnter(p);
+ skipOk = 0;
+ }
+ }
+ db->noSharedCache = skipOk;
+}
+SQLITE_PRIVATE void sqlite3BtreeEnterAll(sqlite3 *db){
+ if( db->noSharedCache==0 ) btreeEnterAll(db);
+}
+static void SQLITE_NOINLINE btreeLeaveAll(sqlite3 *db){
+ int i;
+ Btree *p;
+ assert( sqlite3_mutex_held(db->mutex) );
+ for(i=0; i<db->nDb; i++){
+ p = db->aDb[i].pBt;
+ if( p ) sqlite3BtreeLeave(p);
+ }
+}
+SQLITE_PRIVATE void sqlite3BtreeLeaveAll(sqlite3 *db){
+ if( db->noSharedCache==0 ) btreeLeaveAll(db);
+}
+
+#ifndef NDEBUG
+/*
+** Return true if the current thread holds the database connection
+** mutex and all required BtShared mutexes.
+**
+** This routine is used inside assert() statements only.
+*/
+SQLITE_PRIVATE int sqlite3BtreeHoldsAllMutexes(sqlite3 *db){
+ int i;
+ if( !sqlite3_mutex_held(db->mutex) ){
+ return 0;
+ }
+ for(i=0; i<db->nDb; i++){
+ Btree *p;
+ p = db->aDb[i].pBt;
+ if( p && p->sharable &&
+ (p->wantToLock==0 || !sqlite3_mutex_held(p->pBt->mutex)) ){
+ return 0;
+ }
+ }
+ return 1;
+}
+#endif /* NDEBUG */
+
+#ifndef NDEBUG
+/*
+** Return true if the correct mutexes are held for accessing the
+** db->aDb[iDb].pSchema structure. The mutexes required for schema
+** access are:
+**
+** (1) The mutex on db
+** (2) if iDb!=1, then the mutex on db->aDb[iDb].pBt.
+**
+** If pSchema is not NULL, then iDb is computed from pSchema and
+** db using sqlite3SchemaToIndex().
+*/
+SQLITE_PRIVATE int sqlite3SchemaMutexHeld(sqlite3 *db, int iDb, Schema *pSchema){
+ Btree *p;
+ assert( db!=0 );
+ if( db->pVfs==0 && db->nDb==0 ) return 1;
+ if( pSchema ) iDb = sqlite3SchemaToIndex(db, pSchema);
+ assert( iDb>=0 && iDb<db->nDb );
+ if( !sqlite3_mutex_held(db->mutex) ) return 0;
+ if( iDb==1 ) return 1;
+ p = db->aDb[iDb].pBt;
+ assert( p!=0 );
+ return p->sharable==0 || p->locked==1;
+}
+#endif /* NDEBUG */
+
+#else /* SQLITE_THREADSAFE>0 above. SQLITE_THREADSAFE==0 below */
+/*
+** The following are special cases for mutex enter routines for use
+** in single threaded applications that use shared cache. Except for
+** these two routines, all mutex operations are no-ops in that case and
+** are null #defines in btree.h.
+**
+** If shared cache is disabled, then all btree mutex routines, including
+** the ones below, are no-ops and are null #defines in btree.h.
+*/
+
+SQLITE_PRIVATE void sqlite3BtreeEnter(Btree *p){
+ p->pBt->db = p->db;
+}
+SQLITE_PRIVATE void sqlite3BtreeEnterAll(sqlite3 *db){
+ int i;
+ for(i=0; i<db->nDb; i++){
+ Btree *p = db->aDb[i].pBt;
+ if( p ){
+ p->pBt->db = p->db;
+ }
+ }
+}
+#endif /* if SQLITE_THREADSAFE */
+
+#ifndef SQLITE_OMIT_INCRBLOB
+/*
+** Enter a mutex on a Btree given a cursor owned by that Btree.
+**
+** These entry points are used by incremental I/O only. Enter() is required
+** any time OMIT_SHARED_CACHE is not defined, regardless of whether or not
+** the build is threadsafe. Leave() is only required by threadsafe builds.
+*/
+SQLITE_PRIVATE void sqlite3BtreeEnterCursor(BtCursor *pCur){
+ sqlite3BtreeEnter(pCur->pBtree);
+}
+# if SQLITE_THREADSAFE
+SQLITE_PRIVATE void sqlite3BtreeLeaveCursor(BtCursor *pCur){
+ sqlite3BtreeLeave(pCur->pBtree);
+}
+# endif
+#endif /* ifndef SQLITE_OMIT_INCRBLOB */
+
+#endif /* ifndef SQLITE_OMIT_SHARED_CACHE */
+
+/************** End of btmutex.c *********************************************/
+/************** Begin file btree.c *******************************************/
+/*
+** 2004 April 6
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This file implements an external (disk-based) database using BTrees.
+** See the header comment on "btreeInt.h" for additional information.
+** Including a description of file format and an overview of operation.
+*/
+/* #include "btreeInt.h" */
+
+/*
+** The header string that appears at the beginning of every
+** SQLite database.
+*/
+static const char zMagicHeader[] = SQLITE_FILE_HEADER;
+
+/*
+** Set this global variable to 1 to enable tracing using the TRACE
+** macro.
+*/
+#if 0
+int sqlite3BtreeTrace=1; /* True to enable tracing */
+# define TRACE(X) if(sqlite3BtreeTrace){printf X;fflush(stdout);}
+#else
+# define TRACE(X)
+#endif
+
+/*
+** Extract a 2-byte big-endian integer from an array of unsigned bytes.
+** But if the value is zero, make it 65536.
+**
+** This routine is used to extract the "offset to cell content area" value
+** from the header of a btree page. If the page size is 65536 and the page
+** is empty, the offset should be 65536, but the 2-byte value stores zero.
+** This routine makes the necessary adjustment to 65536.
+*/
+#define get2byteNotZero(X) (((((int)get2byte(X))-1)&0xffff)+1)
+
+/*
+** Values passed as the 5th argument to allocateBtreePage()
+*/
+#define BTALLOC_ANY 0 /* Allocate any page */
+#define BTALLOC_EXACT 1 /* Allocate exact page if possible */
+#define BTALLOC_LE 2 /* Allocate any page <= the parameter */
+
+/*
+** Macro IfNotOmitAV(x) returns (x) if SQLITE_OMIT_AUTOVACUUM is not
+** defined, or 0 if it is. For example:
+**
+** bIncrVacuum = IfNotOmitAV(pBtShared->incrVacuum);
+*/
+#ifndef SQLITE_OMIT_AUTOVACUUM
+#define IfNotOmitAV(expr) (expr)
+#else
+#define IfNotOmitAV(expr) 0
+#endif
+
+#ifndef SQLITE_OMIT_SHARED_CACHE
+/*
+** A list of BtShared objects that are eligible for participation
+** in shared cache. This variable has file scope during normal builds,
+** but the test harness needs to access it so we make it global for
+** test builds.
+**
+** Access to this variable is protected by SQLITE_MUTEX_STATIC_MAIN.
+*/
+#ifdef SQLITE_TEST
+SQLITE_PRIVATE BtShared *SQLITE_WSD sqlite3SharedCacheList = 0;
+#else
+static BtShared *SQLITE_WSD sqlite3SharedCacheList = 0;
+#endif
+#endif /* SQLITE_OMIT_SHARED_CACHE */
+
+#ifndef SQLITE_OMIT_SHARED_CACHE
+/*
+** Enable or disable the shared pager and schema features.
+**
+** This routine has no effect on existing database connections.
+** The shared cache setting effects only future calls to
+** sqlite3_open(), sqlite3_open16(), or sqlite3_open_v2().
+*/
+SQLITE_API int sqlite3_enable_shared_cache(int enable){
+ sqlite3GlobalConfig.sharedCacheEnabled = enable;
+ return SQLITE_OK;
+}
+#endif
+
+
+
+#ifdef SQLITE_OMIT_SHARED_CACHE
+ /*
+ ** The functions querySharedCacheTableLock(), setSharedCacheTableLock(),
+ ** and clearAllSharedCacheTableLocks()
+ ** manipulate entries in the BtShared.pLock linked list used to store
+ ** shared-cache table level locks. If the library is compiled with the
+ ** shared-cache feature disabled, then there is only ever one user
+ ** of each BtShared structure and so this locking is not necessary.
+ ** So define the lock related functions as no-ops.
+ */
+ #define querySharedCacheTableLock(a,b,c) SQLITE_OK
+ #define setSharedCacheTableLock(a,b,c) SQLITE_OK
+ #define clearAllSharedCacheTableLocks(a)
+ #define downgradeAllSharedCacheTableLocks(a)
+ #define hasSharedCacheTableLock(a,b,c,d) 1
+ #define hasReadConflicts(a, b) 0
+#endif
+
+#ifdef SQLITE_DEBUG
+/*
+** Return and reset the seek counter for a Btree object.
+*/
+SQLITE_PRIVATE sqlite3_uint64 sqlite3BtreeSeekCount(Btree *pBt){
+ u64 n = pBt->nSeek;
+ pBt->nSeek = 0;
+ return n;
+}
+#endif
+
+/*
+** Implementation of the SQLITE_CORRUPT_PAGE() macro. Takes a single
+** (MemPage*) as an argument. The (MemPage*) must not be NULL.
+**
+** If SQLITE_DEBUG is not defined, then this macro is equivalent to
+** SQLITE_CORRUPT_BKPT. Or, if SQLITE_DEBUG is set, then the log message
+** normally produced as a side-effect of SQLITE_CORRUPT_BKPT is augmented
+** with the page number and filename associated with the (MemPage*).
+*/
+#ifdef SQLITE_DEBUG
+int corruptPageError(int lineno, MemPage *p){
+ char *zMsg;
+ sqlite3BeginBenignMalloc();
+ zMsg = sqlite3_mprintf("database corruption page %u of %s",
+ p->pgno, sqlite3PagerFilename(p->pBt->pPager, 0)
+ );
+ sqlite3EndBenignMalloc();
+ if( zMsg ){
+ sqlite3ReportError(SQLITE_CORRUPT, lineno, zMsg);
+ }
+ sqlite3_free(zMsg);
+ return SQLITE_CORRUPT_BKPT;
+}
+# define SQLITE_CORRUPT_PAGE(pMemPage) corruptPageError(__LINE__, pMemPage)
+#else
+# define SQLITE_CORRUPT_PAGE(pMemPage) SQLITE_CORRUPT_PGNO(pMemPage->pgno)
+#endif
+
+/* Default value for SHARED_LOCK_TRACE macro if shared-cache is disabled
+** or if the lock tracking is disabled. This is always the value for
+** release builds.
+*/
+#define SHARED_LOCK_TRACE(X,MSG,TAB,TYPE) /*no-op*/
+
+#ifndef SQLITE_OMIT_SHARED_CACHE
+
+#if 0
+/* ^---- Change to 1 and recompile to enable shared-lock tracing
+** for debugging purposes.
+**
+** Print all shared-cache locks on a BtShared. Debugging use only.
+*/
+static void sharedLockTrace(
+ BtShared *pBt,
+ const char *zMsg,
+ int iRoot,
+ int eLockType
+){
+ BtLock *pLock;
+ if( iRoot>0 ){
+ printf("%s-%p %u%s:", zMsg, pBt, iRoot, eLockType==READ_LOCK?"R":"W");
+ }else{
+ printf("%s-%p:", zMsg, pBt);
+ }
+ for(pLock=pBt->pLock; pLock; pLock=pLock->pNext){
+ printf(" %p/%u%s", pLock->pBtree, pLock->iTable,
+ pLock->eLock==READ_LOCK ? "R" : "W");
+ while( pLock->pNext && pLock->pBtree==pLock->pNext->pBtree ){
+ pLock = pLock->pNext;
+ printf(",%u%s", pLock->iTable, pLock->eLock==READ_LOCK ? "R" : "W");
+ }
+ }
+ printf("\n");
+ fflush(stdout);
+}
+#undef SHARED_LOCK_TRACE
+#define SHARED_LOCK_TRACE(X,MSG,TAB,TYPE) sharedLockTrace(X,MSG,TAB,TYPE)
+#endif /* Shared-lock tracing */
+
+#ifdef SQLITE_DEBUG
+/*
+**** This function is only used as part of an assert() statement. ***
+**
+** Check to see if pBtree holds the required locks to read or write to the
+** table with root page iRoot. Return 1 if it does and 0 if not.
+**
+** For example, when writing to a table with root-page iRoot via
+** Btree connection pBtree:
+**
+** assert( hasSharedCacheTableLock(pBtree, iRoot, 0, WRITE_LOCK) );
+**
+** When writing to an index that resides in a sharable database, the
+** caller should have first obtained a lock specifying the root page of
+** the corresponding table. This makes things a bit more complicated,
+** as this module treats each table as a separate structure. To determine
+** the table corresponding to the index being written, this
+** function has to search through the database schema.
+**
+** Instead of a lock on the table/index rooted at page iRoot, the caller may
+** hold a write-lock on the schema table (root page 1). This is also
+** acceptable.
+*/
+static int hasSharedCacheTableLock(
+ Btree *pBtree, /* Handle that must hold lock */
+ Pgno iRoot, /* Root page of b-tree */
+ int isIndex, /* True if iRoot is the root of an index b-tree */
+ int eLockType /* Required lock type (READ_LOCK or WRITE_LOCK) */
+){
+ Schema *pSchema = (Schema *)pBtree->pBt->pSchema;
+ Pgno iTab = 0;
+ BtLock *pLock;
+
+ /* If this database is not shareable, or if the client is reading
+ ** and has the read-uncommitted flag set, then no lock is required.
+ ** Return true immediately.
+ */
+ if( (pBtree->sharable==0)
+ || (eLockType==READ_LOCK && (pBtree->db->flags & SQLITE_ReadUncommit))
+ ){
+ return 1;
+ }
+
+ /* If the client is reading or writing an index and the schema is
+ ** not loaded, then it is too difficult to actually check to see if
+ ** the correct locks are held. So do not bother - just return true.
+ ** This case does not come up very often anyhow.
+ */
+ if( isIndex && (!pSchema || (pSchema->schemaFlags&DB_SchemaLoaded)==0) ){
+ return 1;
+ }
+
+ /* Figure out the root-page that the lock should be held on. For table
+ ** b-trees, this is just the root page of the b-tree being read or
+ ** written. For index b-trees, it is the root page of the associated
+ ** table. */
+ if( isIndex ){
+ HashElem *p;
+ int bSeen = 0;
+ for(p=sqliteHashFirst(&pSchema->idxHash); p; p=sqliteHashNext(p)){
+ Index *pIdx = (Index *)sqliteHashData(p);
+ if( pIdx->tnum==iRoot ){
+ if( bSeen ){
+ /* Two or more indexes share the same root page. There must
+ ** be imposter tables. So just return true. The assert is not
+ ** useful in that case. */
+ return 1;
+ }
+ iTab = pIdx->pTable->tnum;
+ bSeen = 1;
+ }
+ }
+ }else{
+ iTab = iRoot;
+ }
+
+ SHARED_LOCK_TRACE(pBtree->pBt,"hasLock",iRoot,eLockType);
+
+ /* Search for the required lock. Either a write-lock on root-page iTab, a
+ ** write-lock on the schema table, or (if the client is reading) a
+ ** read-lock on iTab will suffice. Return 1 if any of these are found. */
+ for(pLock=pBtree->pBt->pLock; pLock; pLock=pLock->pNext){
+ if( pLock->pBtree==pBtree
+ && (pLock->iTable==iTab || (pLock->eLock==WRITE_LOCK && pLock->iTable==1))
+ && pLock->eLock>=eLockType
+ ){
+ return 1;
+ }
+ }
+
+ /* Failed to find the required lock. */
+ return 0;
+}
+#endif /* SQLITE_DEBUG */
+
+#ifdef SQLITE_DEBUG
+/*
+**** This function may be used as part of assert() statements only. ****
+**
+** Return true if it would be illegal for pBtree to write into the
+** table or index rooted at iRoot because other shared connections are
+** simultaneously reading that same table or index.
+**
+** It is illegal for pBtree to write if some other Btree object that
+** shares the same BtShared object is currently reading or writing
+** the iRoot table. Except, if the other Btree object has the
+** read-uncommitted flag set, then it is OK for the other object to
+** have a read cursor.
+**
+** For example, before writing to any part of the table or index
+** rooted at page iRoot, one should call:
+**
+** assert( !hasReadConflicts(pBtree, iRoot) );
+*/
+static int hasReadConflicts(Btree *pBtree, Pgno iRoot){
+ BtCursor *p;
+ for(p=pBtree->pBt->pCursor; p; p=p->pNext){
+ if( p->pgnoRoot==iRoot
+ && p->pBtree!=pBtree
+ && 0==(p->pBtree->db->flags & SQLITE_ReadUncommit)
+ ){
+ return 1;
+ }
+ }
+ return 0;
+}
+#endif /* #ifdef SQLITE_DEBUG */
+
+/*
+** Query to see if Btree handle p may obtain a lock of type eLock
+** (READ_LOCK or WRITE_LOCK) on the table with root-page iTab. Return
+** SQLITE_OK if the lock may be obtained (by calling
+** setSharedCacheTableLock()), or SQLITE_LOCKED if not.
+*/
+static int querySharedCacheTableLock(Btree *p, Pgno iTab, u8 eLock){
+ BtShared *pBt = p->pBt;
+ BtLock *pIter;
+
+ assert( sqlite3BtreeHoldsMutex(p) );
+ assert( eLock==READ_LOCK || eLock==WRITE_LOCK );
+ assert( p->db!=0 );
+ assert( !(p->db->flags&SQLITE_ReadUncommit)||eLock==WRITE_LOCK||iTab==1 );
+
+ /* If requesting a write-lock, then the Btree must have an open write
+ ** transaction on this file. And, obviously, for this to be so there
+ ** must be an open write transaction on the file itself.
+ */
+ assert( eLock==READ_LOCK || (p==pBt->pWriter && p->inTrans==TRANS_WRITE) );
+ assert( eLock==READ_LOCK || pBt->inTransaction==TRANS_WRITE );
+
+ /* This routine is a no-op if the shared-cache is not enabled */
+ if( !p->sharable ){
+ return SQLITE_OK;
+ }
+
+ /* If some other connection is holding an exclusive lock, the
+ ** requested lock may not be obtained.
+ */
+ if( pBt->pWriter!=p && (pBt->btsFlags & BTS_EXCLUSIVE)!=0 ){
+ sqlite3ConnectionBlocked(p->db, pBt->pWriter->db);
+ return SQLITE_LOCKED_SHAREDCACHE;
+ }
+
+ for(pIter=pBt->pLock; pIter; pIter=pIter->pNext){
+ /* The condition (pIter->eLock!=eLock) in the following if(...)
+ ** statement is a simplification of:
+ **
+ ** (eLock==WRITE_LOCK || pIter->eLock==WRITE_LOCK)
+ **
+ ** since we know that if eLock==WRITE_LOCK, then no other connection
+ ** may hold a WRITE_LOCK on any table in this file (since there can
+ ** only be a single writer).
+ */
+ assert( pIter->eLock==READ_LOCK || pIter->eLock==WRITE_LOCK );
+ assert( eLock==READ_LOCK || pIter->pBtree==p || pIter->eLock==READ_LOCK);
+ if( pIter->pBtree!=p && pIter->iTable==iTab && pIter->eLock!=eLock ){
+ sqlite3ConnectionBlocked(p->db, pIter->pBtree->db);
+ if( eLock==WRITE_LOCK ){
+ assert( p==pBt->pWriter );
+ pBt->btsFlags |= BTS_PENDING;
+ }
+ return SQLITE_LOCKED_SHAREDCACHE;
+ }
+ }
+ return SQLITE_OK;
+}
+#endif /* !SQLITE_OMIT_SHARED_CACHE */
+
+#ifndef SQLITE_OMIT_SHARED_CACHE
+/*
+** Add a lock on the table with root-page iTable to the shared-btree used
+** by Btree handle p. Parameter eLock must be either READ_LOCK or
+** WRITE_LOCK.
+**
+** This function assumes the following:
+**
+** (a) The specified Btree object p is connected to a sharable
+** database (one with the BtShared.sharable flag set), and
+**
+** (b) No other Btree objects hold a lock that conflicts
+** with the requested lock (i.e. querySharedCacheTableLock() has
+** already been called and returned SQLITE_OK).
+**
+** SQLITE_OK is returned if the lock is added successfully. SQLITE_NOMEM
+** is returned if a malloc attempt fails.
+*/
+static int setSharedCacheTableLock(Btree *p, Pgno iTable, u8 eLock){
+ BtShared *pBt = p->pBt;
+ BtLock *pLock = 0;
+ BtLock *pIter;
+
+ SHARED_LOCK_TRACE(pBt,"setLock", iTable, eLock);
+
+ assert( sqlite3BtreeHoldsMutex(p) );
+ assert( eLock==READ_LOCK || eLock==WRITE_LOCK );
+ assert( p->db!=0 );
+
+ /* A connection with the read-uncommitted flag set will never try to
+ ** obtain a read-lock using this function. The only read-lock obtained
+ ** by a connection in read-uncommitted mode is on the sqlite_schema
+ ** table, and that lock is obtained in BtreeBeginTrans(). */
+ assert( 0==(p->db->flags&SQLITE_ReadUncommit) || eLock==WRITE_LOCK );
+
+ /* This function should only be called on a sharable b-tree after it
+ ** has been determined that no other b-tree holds a conflicting lock. */
+ assert( p->sharable );
+ assert( SQLITE_OK==querySharedCacheTableLock(p, iTable, eLock) );
+
+ /* First search the list for an existing lock on this table. */
+ for(pIter=pBt->pLock; pIter; pIter=pIter->pNext){
+ if( pIter->iTable==iTable && pIter->pBtree==p ){
+ pLock = pIter;
+ break;
+ }
+ }
+
+ /* If the above search did not find a BtLock struct associating Btree p
+ ** with table iTable, allocate one and link it into the list.
+ */
+ if( !pLock ){
+ pLock = (BtLock *)sqlite3MallocZero(sizeof(BtLock));
+ if( !pLock ){
+ return SQLITE_NOMEM_BKPT;
+ }
+ pLock->iTable = iTable;
+ pLock->pBtree = p;
+ pLock->pNext = pBt->pLock;
+ pBt->pLock = pLock;
+ }
+
+ /* Set the BtLock.eLock variable to the maximum of the current lock
+ ** and the requested lock. This means if a write-lock was already held
+ ** and a read-lock requested, we don't incorrectly downgrade the lock.
+ */
+ assert( WRITE_LOCK>READ_LOCK );
+ if( eLock>pLock->eLock ){
+ pLock->eLock = eLock;
+ }
+
+ return SQLITE_OK;
+}
+#endif /* !SQLITE_OMIT_SHARED_CACHE */
+
+#ifndef SQLITE_OMIT_SHARED_CACHE
+/*
+** Release all the table locks (locks obtained via calls to
+** the setSharedCacheTableLock() procedure) held by Btree object p.
+**
+** This function assumes that Btree p has an open read or write
+** transaction. If it does not, then the BTS_PENDING flag
+** may be incorrectly cleared.
+*/
+static void clearAllSharedCacheTableLocks(Btree *p){
+ BtShared *pBt = p->pBt;
+ BtLock **ppIter = &pBt->pLock;
+
+ assert( sqlite3BtreeHoldsMutex(p) );
+ assert( p->sharable || 0==*ppIter );
+ assert( p->inTrans>0 );
+
+ SHARED_LOCK_TRACE(pBt, "clearAllLocks", 0, 0);
+
+ while( *ppIter ){
+ BtLock *pLock = *ppIter;
+ assert( (pBt->btsFlags & BTS_EXCLUSIVE)==0 || pBt->pWriter==pLock->pBtree );
+ assert( pLock->pBtree->inTrans>=pLock->eLock );
+ if( pLock->pBtree==p ){
+ *ppIter = pLock->pNext;
+ assert( pLock->iTable!=1 || pLock==&p->lock );
+ if( pLock->iTable!=1 ){
+ sqlite3_free(pLock);
+ }
+ }else{
+ ppIter = &pLock->pNext;
+ }
+ }
+
+ assert( (pBt->btsFlags & BTS_PENDING)==0 || pBt->pWriter );
+ if( pBt->pWriter==p ){
+ pBt->pWriter = 0;
+ pBt->btsFlags &= ~(BTS_EXCLUSIVE|BTS_PENDING);
+ }else if( pBt->nTransaction==2 ){
+ /* This function is called when Btree p is concluding its
+ ** transaction. If there currently exists a writer, and p is not
+ ** that writer, then the number of locks held by connections other
+ ** than the writer must be about to drop to zero. In this case
+ ** set the BTS_PENDING flag to 0.
+ **
+ ** If there is not currently a writer, then BTS_PENDING must
+ ** be zero already. So this next line is harmless in that case.
+ */
+ pBt->btsFlags &= ~BTS_PENDING;
+ }
+}
+
+/*
+** This function changes all write-locks held by Btree p into read-locks.
+*/
+static void downgradeAllSharedCacheTableLocks(Btree *p){
+ BtShared *pBt = p->pBt;
+
+ SHARED_LOCK_TRACE(pBt, "downgradeLocks", 0, 0);
+
+ if( pBt->pWriter==p ){
+ BtLock *pLock;
+ pBt->pWriter = 0;
+ pBt->btsFlags &= ~(BTS_EXCLUSIVE|BTS_PENDING);
+ for(pLock=pBt->pLock; pLock; pLock=pLock->pNext){
+ assert( pLock->eLock==READ_LOCK || pLock->pBtree==p );
+ pLock->eLock = READ_LOCK;
+ }
+ }
+}
+
+#endif /* SQLITE_OMIT_SHARED_CACHE */
+
+static void releasePage(MemPage *pPage); /* Forward reference */
+static void releasePageOne(MemPage *pPage); /* Forward reference */
+static void releasePageNotNull(MemPage *pPage); /* Forward reference */
+
+/*
+***** This routine is used inside of assert() only ****
+**
+** Verify that the cursor holds the mutex on its BtShared
+*/
+#ifdef SQLITE_DEBUG
+static int cursorHoldsMutex(BtCursor *p){
+ return sqlite3_mutex_held(p->pBt->mutex);
+}
+
+/* Verify that the cursor and the BtShared agree about what is the current
+** database connetion. This is important in shared-cache mode. If the database
+** connection pointers get out-of-sync, it is possible for routines like
+** btreeInitPage() to reference an stale connection pointer that references a
+** a connection that has already closed. This routine is used inside assert()
+** statements only and for the purpose of double-checking that the btree code
+** does keep the database connection pointers up-to-date.
+*/
+static int cursorOwnsBtShared(BtCursor *p){
+ assert( cursorHoldsMutex(p) );
+ return (p->pBtree->db==p->pBt->db);
+}
+#endif
+
+/*
+** Invalidate the overflow cache of the cursor passed as the first argument.
+** on the shared btree structure pBt.
+*/
+#define invalidateOverflowCache(pCur) (pCur->curFlags &= ~BTCF_ValidOvfl)
+
+/*
+** Invalidate the overflow page-list cache for all cursors opened
+** on the shared btree structure pBt.
+*/
+static void invalidateAllOverflowCache(BtShared *pBt){
+ BtCursor *p;
+ assert( sqlite3_mutex_held(pBt->mutex) );
+ for(p=pBt->pCursor; p; p=p->pNext){
+ invalidateOverflowCache(p);
+ }
+}
+
+#ifndef SQLITE_OMIT_INCRBLOB
+/*
+** This function is called before modifying the contents of a table
+** to invalidate any incrblob cursors that are open on the
+** row or one of the rows being modified.
+**
+** If argument isClearTable is true, then the entire contents of the
+** table is about to be deleted. In this case invalidate all incrblob
+** cursors open on any row within the table with root-page pgnoRoot.
+**
+** Otherwise, if argument isClearTable is false, then the row with
+** rowid iRow is being replaced or deleted. In this case invalidate
+** only those incrblob cursors open on that specific row.
+*/
+static void invalidateIncrblobCursors(
+ Btree *pBtree, /* The database file to check */
+ Pgno pgnoRoot, /* The table that might be changing */
+ i64 iRow, /* The rowid that might be changing */
+ int isClearTable /* True if all rows are being deleted */
+){
+ BtCursor *p;
+ assert( pBtree->hasIncrblobCur );
+ assert( sqlite3BtreeHoldsMutex(pBtree) );
+ pBtree->hasIncrblobCur = 0;
+ for(p=pBtree->pBt->pCursor; p; p=p->pNext){
+ if( (p->curFlags & BTCF_Incrblob)!=0 ){
+ pBtree->hasIncrblobCur = 1;
+ if( p->pgnoRoot==pgnoRoot && (isClearTable || p->info.nKey==iRow) ){
+ p->eState = CURSOR_INVALID;
+ }
+ }
+ }
+}
+
+#else
+ /* Stub function when INCRBLOB is omitted */
+ #define invalidateIncrblobCursors(w,x,y,z)
+#endif /* SQLITE_OMIT_INCRBLOB */
+
+/*
+** Set bit pgno of the BtShared.pHasContent bitvec. This is called
+** when a page that previously contained data becomes a free-list leaf
+** page.
+**
+** The BtShared.pHasContent bitvec exists to work around an obscure
+** bug caused by the interaction of two useful IO optimizations surrounding
+** free-list leaf pages:
+**
+** 1) When all data is deleted from a page and the page becomes
+** a free-list leaf page, the page is not written to the database
+** (as free-list leaf pages contain no meaningful data). Sometimes
+** such a page is not even journalled (as it will not be modified,
+** why bother journalling it?).
+**
+** 2) When a free-list leaf page is reused, its content is not read
+** from the database or written to the journal file (why should it
+** be, if it is not at all meaningful?).
+**
+** By themselves, these optimizations work fine and provide a handy
+** performance boost to bulk delete or insert operations. However, if
+** a page is moved to the free-list and then reused within the same
+** transaction, a problem comes up. If the page is not journalled when
+** it is moved to the free-list and it is also not journalled when it
+** is extracted from the free-list and reused, then the original data
+** may be lost. In the event of a rollback, it may not be possible
+** to restore the database to its original configuration.
+**
+** The solution is the BtShared.pHasContent bitvec. Whenever a page is
+** moved to become a free-list leaf page, the corresponding bit is
+** set in the bitvec. Whenever a leaf page is extracted from the free-list,
+** optimization 2 above is omitted if the corresponding bit is already
+** set in BtShared.pHasContent. The contents of the bitvec are cleared
+** at the end of every transaction.
+*/
+static int btreeSetHasContent(BtShared *pBt, Pgno pgno){
+ int rc = SQLITE_OK;
+ if( !pBt->pHasContent ){
+ assert( pgno<=pBt->nPage );
+ pBt->pHasContent = sqlite3BitvecCreate(pBt->nPage);
+ if( !pBt->pHasContent ){
+ rc = SQLITE_NOMEM_BKPT;
+ }
+ }
+ if( rc==SQLITE_OK && pgno<=sqlite3BitvecSize(pBt->pHasContent) ){
+ rc = sqlite3BitvecSet(pBt->pHasContent, pgno);
+ }
+ return rc;
+}
+
+/*
+** Query the BtShared.pHasContent vector.
+**
+** This function is called when a free-list leaf page is removed from the
+** free-list for reuse. It returns false if it is safe to retrieve the
+** page from the pager layer with the 'no-content' flag set. True otherwise.
+*/
+static int btreeGetHasContent(BtShared *pBt, Pgno pgno){
+ Bitvec *p = pBt->pHasContent;
+ return p && (pgno>sqlite3BitvecSize(p) || sqlite3BitvecTestNotNull(p, pgno));
+}
+
+/*
+** Clear (destroy) the BtShared.pHasContent bitvec. This should be
+** invoked at the conclusion of each write-transaction.
+*/
+static void btreeClearHasContent(BtShared *pBt){
+ sqlite3BitvecDestroy(pBt->pHasContent);
+ pBt->pHasContent = 0;
+}
+
+/*
+** Release all of the apPage[] pages for a cursor.
+*/
+static void btreeReleaseAllCursorPages(BtCursor *pCur){
+ int i;
+ if( pCur->iPage>=0 ){
+ for(i=0; i<pCur->iPage; i++){
+ releasePageNotNull(pCur->apPage[i]);
+ }
+ releasePageNotNull(pCur->pPage);
+ pCur->iPage = -1;
+ }
+}
+
+/*
+** The cursor passed as the only argument must point to a valid entry
+** when this function is called (i.e. have eState==CURSOR_VALID). This
+** function saves the current cursor key in variables pCur->nKey and
+** pCur->pKey. SQLITE_OK is returned if successful or an SQLite error
+** code otherwise.
+**
+** If the cursor is open on an intkey table, then the integer key
+** (the rowid) is stored in pCur->nKey and pCur->pKey is left set to
+** NULL. If the cursor is open on a non-intkey table, then pCur->pKey is
+** set to point to a malloced buffer pCur->nKey bytes in size containing
+** the key.
+*/
+static int saveCursorKey(BtCursor *pCur){
+ int rc = SQLITE_OK;
+ assert( CURSOR_VALID==pCur->eState );
+ assert( 0==pCur->pKey );
+ assert( cursorHoldsMutex(pCur) );
+
+ if( pCur->curIntKey ){
+ /* Only the rowid is required for a table btree */
+ pCur->nKey = sqlite3BtreeIntegerKey(pCur);
+ }else{
+ /* For an index btree, save the complete key content. It is possible
+ ** that the current key is corrupt. In that case, it is possible that
+ ** the sqlite3VdbeRecordUnpack() function may overread the buffer by
+ ** up to the size of 1 varint plus 1 8-byte value when the cursor
+ ** position is restored. Hence the 17 bytes of padding allocated
+ ** below. */
+ void *pKey;
+ pCur->nKey = sqlite3BtreePayloadSize(pCur);
+ pKey = sqlite3Malloc( pCur->nKey + 9 + 8 );
+ if( pKey ){
+ rc = sqlite3BtreePayload(pCur, 0, (int)pCur->nKey, pKey);
+ if( rc==SQLITE_OK ){
+ memset(((u8*)pKey)+pCur->nKey, 0, 9+8);
+ pCur->pKey = pKey;
+ }else{
+ sqlite3_free(pKey);
+ }
+ }else{
+ rc = SQLITE_NOMEM_BKPT;
+ }
+ }
+ assert( !pCur->curIntKey || !pCur->pKey );
+ return rc;
+}
+
+/*
+** Save the current cursor position in the variables BtCursor.nKey
+** and BtCursor.pKey. The cursor's state is set to CURSOR_REQUIRESEEK.
+**
+** The caller must ensure that the cursor is valid (has eState==CURSOR_VALID)
+** prior to calling this routine.
+*/
+static int saveCursorPosition(BtCursor *pCur){
+ int rc;
+
+ assert( CURSOR_VALID==pCur->eState || CURSOR_SKIPNEXT==pCur->eState );
+ assert( 0==pCur->pKey );
+ assert( cursorHoldsMutex(pCur) );
+
+ if( pCur->curFlags & BTCF_Pinned ){
+ return SQLITE_CONSTRAINT_PINNED;
+ }
+ if( pCur->eState==CURSOR_SKIPNEXT ){
+ pCur->eState = CURSOR_VALID;
+ }else{
+ pCur->skipNext = 0;
+ }
+
+ rc = saveCursorKey(pCur);
+ if( rc==SQLITE_OK ){
+ btreeReleaseAllCursorPages(pCur);
+ pCur->eState = CURSOR_REQUIRESEEK;
+ }
+
+ pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl|BTCF_AtLast);
+ return rc;
+}
+
+/* Forward reference */
+static int SQLITE_NOINLINE saveCursorsOnList(BtCursor*,Pgno,BtCursor*);
+
+/*
+** Save the positions of all cursors (except pExcept) that are open on
+** the table with root-page iRoot. "Saving the cursor position" means that
+** the location in the btree is remembered in such a way that it can be
+** moved back to the same spot after the btree has been modified. This
+** routine is called just before cursor pExcept is used to modify the
+** table, for example in BtreeDelete() or BtreeInsert().
+**
+** If there are two or more cursors on the same btree, then all such
+** cursors should have their BTCF_Multiple flag set. The btreeCursor()
+** routine enforces that rule. This routine only needs to be called in
+** the uncommon case when pExpect has the BTCF_Multiple flag set.
+**
+** If pExpect!=NULL and if no other cursors are found on the same root-page,
+** then the BTCF_Multiple flag on pExpect is cleared, to avoid another
+** pointless call to this routine.
+**
+** Implementation note: This routine merely checks to see if any cursors
+** need to be saved. It calls out to saveCursorsOnList() in the (unusual)
+** event that cursors are in need to being saved.
+*/
+static int saveAllCursors(BtShared *pBt, Pgno iRoot, BtCursor *pExcept){
+ BtCursor *p;
+ assert( sqlite3_mutex_held(pBt->mutex) );
+ assert( pExcept==0 || pExcept->pBt==pBt );
+ for(p=pBt->pCursor; p; p=p->pNext){
+ if( p!=pExcept && (0==iRoot || p->pgnoRoot==iRoot) ) break;
+ }
+ if( p ) return saveCursorsOnList(p, iRoot, pExcept);
+ if( pExcept ) pExcept->curFlags &= ~BTCF_Multiple;
+ return SQLITE_OK;
+}
+
+/* This helper routine to saveAllCursors does the actual work of saving
+** the cursors if and when a cursor is found that actually requires saving.
+** The common case is that no cursors need to be saved, so this routine is
+** broken out from its caller to avoid unnecessary stack pointer movement.
+*/
+static int SQLITE_NOINLINE saveCursorsOnList(
+ BtCursor *p, /* The first cursor that needs saving */
+ Pgno iRoot, /* Only save cursor with this iRoot. Save all if zero */
+ BtCursor *pExcept /* Do not save this cursor */
+){
+ do{
+ if( p!=pExcept && (0==iRoot || p->pgnoRoot==iRoot) ){
+ if( p->eState==CURSOR_VALID || p->eState==CURSOR_SKIPNEXT ){
+ int rc = saveCursorPosition(p);
+ if( SQLITE_OK!=rc ){
+ return rc;
+ }
+ }else{
+ testcase( p->iPage>=0 );
+ btreeReleaseAllCursorPages(p);
+ }
+ }
+ p = p->pNext;
+ }while( p );
+ return SQLITE_OK;
+}
+
+/*
+** Clear the current cursor position.
+*/
+SQLITE_PRIVATE void sqlite3BtreeClearCursor(BtCursor *pCur){
+ assert( cursorHoldsMutex(pCur) );
+ sqlite3_free(pCur->pKey);
+ pCur->pKey = 0;
+ pCur->eState = CURSOR_INVALID;
+}
+
+/*
+** In this version of BtreeMoveto, pKey is a packed index record
+** such as is generated by the OP_MakeRecord opcode. Unpack the
+** record and then call sqlite3BtreeIndexMoveto() to do the work.
+*/
+static int btreeMoveto(
+ BtCursor *pCur, /* Cursor open on the btree to be searched */
+ const void *pKey, /* Packed key if the btree is an index */
+ i64 nKey, /* Integer key for tables. Size of pKey for indices */
+ int bias, /* Bias search to the high end */
+ int *pRes /* Write search results here */
+){
+ int rc; /* Status code */
+ UnpackedRecord *pIdxKey; /* Unpacked index key */
+
+ if( pKey ){
+ KeyInfo *pKeyInfo = pCur->pKeyInfo;
+ assert( nKey==(i64)(int)nKey );
+ pIdxKey = sqlite3VdbeAllocUnpackedRecord(pKeyInfo);
+ if( pIdxKey==0 ) return SQLITE_NOMEM_BKPT;
+ sqlite3VdbeRecordUnpack(pKeyInfo, (int)nKey, pKey, pIdxKey);
+ if( pIdxKey->nField==0 || pIdxKey->nField>pKeyInfo->nAllField ){
+ rc = SQLITE_CORRUPT_BKPT;
+ }else{
+ rc = sqlite3BtreeIndexMoveto(pCur, pIdxKey, pRes);
+ }
+ sqlite3DbFree(pCur->pKeyInfo->db, pIdxKey);
+ }else{
+ pIdxKey = 0;
+ rc = sqlite3BtreeTableMoveto(pCur, nKey, bias, pRes);
+ }
+ return rc;
+}
+
+/*
+** Restore the cursor to the position it was in (or as close to as possible)
+** when saveCursorPosition() was called. Note that this call deletes the
+** saved position info stored by saveCursorPosition(), so there can be
+** at most one effective restoreCursorPosition() call after each
+** saveCursorPosition().
+*/
+static int btreeRestoreCursorPosition(BtCursor *pCur){
+ int rc;
+ int skipNext = 0;
+ assert( cursorOwnsBtShared(pCur) );
+ assert( pCur->eState>=CURSOR_REQUIRESEEK );
+ if( pCur->eState==CURSOR_FAULT ){
+ return pCur->skipNext;
+ }
+ pCur->eState = CURSOR_INVALID;
+ if( sqlite3FaultSim(410) ){
+ rc = SQLITE_IOERR;
+ }else{
+ rc = btreeMoveto(pCur, pCur->pKey, pCur->nKey, 0, &skipNext);
+ }
+ if( rc==SQLITE_OK ){
+ sqlite3_free(pCur->pKey);
+ pCur->pKey = 0;
+ assert( pCur->eState==CURSOR_VALID || pCur->eState==CURSOR_INVALID );
+ if( skipNext ) pCur->skipNext = skipNext;
+ if( pCur->skipNext && pCur->eState==CURSOR_VALID ){
+ pCur->eState = CURSOR_SKIPNEXT;
+ }
+ }
+ return rc;
+}
+
+#define restoreCursorPosition(p) \
+ (p->eState>=CURSOR_REQUIRESEEK ? \
+ btreeRestoreCursorPosition(p) : \
+ SQLITE_OK)
+
+/*
+** Determine whether or not a cursor has moved from the position where
+** it was last placed, or has been invalidated for any other reason.
+** Cursors can move when the row they are pointing at is deleted out
+** from under them, for example. Cursor might also move if a btree
+** is rebalanced.
+**
+** Calling this routine with a NULL cursor pointer returns false.
+**
+** Use the separate sqlite3BtreeCursorRestore() routine to restore a cursor
+** back to where it ought to be if this routine returns true.
+*/
+SQLITE_PRIVATE int sqlite3BtreeCursorHasMoved(BtCursor *pCur){
+ assert( EIGHT_BYTE_ALIGNMENT(pCur)
+ || pCur==sqlite3BtreeFakeValidCursor() );
+ assert( offsetof(BtCursor, eState)==0 );
+ assert( sizeof(pCur->eState)==1 );
+ return CURSOR_VALID != *(u8*)pCur;
+}
+
+/*
+** Return a pointer to a fake BtCursor object that will always answer
+** false to the sqlite3BtreeCursorHasMoved() routine above. The fake
+** cursor returned must not be used with any other Btree interface.
+*/
+SQLITE_PRIVATE BtCursor *sqlite3BtreeFakeValidCursor(void){
+ static u8 fakeCursor = CURSOR_VALID;
+ assert( offsetof(BtCursor, eState)==0 );
+ return (BtCursor*)&fakeCursor;
+}
+
+/*
+** This routine restores a cursor back to its original position after it
+** has been moved by some outside activity (such as a btree rebalance or
+** a row having been deleted out from under the cursor).
+**
+** On success, the *pDifferentRow parameter is false if the cursor is left
+** pointing at exactly the same row. *pDifferntRow is the row the cursor
+** was pointing to has been deleted, forcing the cursor to point to some
+** nearby row.
+**
+** This routine should only be called for a cursor that just returned
+** TRUE from sqlite3BtreeCursorHasMoved().
+*/
+SQLITE_PRIVATE int sqlite3BtreeCursorRestore(BtCursor *pCur, int *pDifferentRow){
+ int rc;
+
+ assert( pCur!=0 );
+ assert( pCur->eState!=CURSOR_VALID );
+ rc = restoreCursorPosition(pCur);
+ if( rc ){
+ *pDifferentRow = 1;
+ return rc;
+ }
+ if( pCur->eState!=CURSOR_VALID ){
+ *pDifferentRow = 1;
+ }else{
+ *pDifferentRow = 0;
+ }
+ return SQLITE_OK;
+}
+
+#ifdef SQLITE_ENABLE_CURSOR_HINTS
+/*
+** Provide hints to the cursor. The particular hint given (and the type
+** and number of the varargs parameters) is determined by the eHintType
+** parameter. See the definitions of the BTREE_HINT_* macros for details.
+*/
+SQLITE_PRIVATE void sqlite3BtreeCursorHint(BtCursor *pCur, int eHintType, ...){
+ /* Used only by system that substitute their own storage engine */
+#ifdef SQLITE_DEBUG
+ if( ALWAYS(eHintType==BTREE_HINT_RANGE) ){
+ va_list ap;
+ Expr *pExpr;
+ Walker w;
+ memset(&w, 0, sizeof(w));
+ w.xExprCallback = sqlite3CursorRangeHintExprCheck;
+ va_start(ap, eHintType);
+ pExpr = va_arg(ap, Expr*);
+ w.u.aMem = va_arg(ap, Mem*);
+ va_end(ap);
+ assert( pExpr!=0 );
+ assert( w.u.aMem!=0 );
+ sqlite3WalkExpr(&w, pExpr);
+ }
+#endif /* SQLITE_DEBUG */
+}
+#endif /* SQLITE_ENABLE_CURSOR_HINTS */
+
+
+/*
+** Provide flag hints to the cursor.
+*/
+SQLITE_PRIVATE void sqlite3BtreeCursorHintFlags(BtCursor *pCur, unsigned x){
+ assert( x==BTREE_SEEK_EQ || x==BTREE_BULKLOAD || x==0 );
+ pCur->hints = x;
+}
+
+
+#ifndef SQLITE_OMIT_AUTOVACUUM
+/*
+** Given a page number of a regular database page, return the page
+** number for the pointer-map page that contains the entry for the
+** input page number.
+**
+** Return 0 (not a valid page) for pgno==1 since there is
+** no pointer map associated with page 1. The integrity_check logic
+** requires that ptrmapPageno(*,1)!=1.
+*/
+static Pgno ptrmapPageno(BtShared *pBt, Pgno pgno){
+ int nPagesPerMapPage;
+ Pgno iPtrMap, ret;
+ assert( sqlite3_mutex_held(pBt->mutex) );
+ if( pgno<2 ) return 0;
+ nPagesPerMapPage = (pBt->usableSize/5)+1;
+ iPtrMap = (pgno-2)/nPagesPerMapPage;
+ ret = (iPtrMap*nPagesPerMapPage) + 2;
+ if( ret==PENDING_BYTE_PAGE(pBt) ){
+ ret++;
+ }
+ return ret;
+}
+
+/*
+** Write an entry into the pointer map.
+**
+** This routine updates the pointer map entry for page number 'key'
+** so that it maps to type 'eType' and parent page number 'pgno'.
+**
+** If *pRC is initially non-zero (non-SQLITE_OK) then this routine is
+** a no-op. If an error occurs, the appropriate error code is written
+** into *pRC.
+*/
+static void ptrmapPut(BtShared *pBt, Pgno key, u8 eType, Pgno parent, int *pRC){
+ DbPage *pDbPage; /* The pointer map page */
+ u8 *pPtrmap; /* The pointer map data */
+ Pgno iPtrmap; /* The pointer map page number */
+ int offset; /* Offset in pointer map page */
+ int rc; /* Return code from subfunctions */
+
+ if( *pRC ) return;
+
+ assert( sqlite3_mutex_held(pBt->mutex) );
+ /* The super-journal page number must never be used as a pointer map page */
+ assert( 0==PTRMAP_ISPAGE(pBt, PENDING_BYTE_PAGE(pBt)) );
+
+ assert( pBt->autoVacuum );
+ if( key==0 ){
+ *pRC = SQLITE_CORRUPT_BKPT;
+ return;
+ }
+ iPtrmap = PTRMAP_PAGENO(pBt, key);
+ rc = sqlite3PagerGet(pBt->pPager, iPtrmap, &pDbPage, 0);
+ if( rc!=SQLITE_OK ){
+ *pRC = rc;
+ return;
+ }
+ if( ((char*)sqlite3PagerGetExtra(pDbPage))[0]!=0 ){
+ /* The first byte of the extra data is the MemPage.isInit byte.
+ ** If that byte is set, it means this page is also being used
+ ** as a btree page. */
+ *pRC = SQLITE_CORRUPT_BKPT;
+ goto ptrmap_exit;
+ }
+ offset = PTRMAP_PTROFFSET(iPtrmap, key);
+ if( offset<0 ){
+ *pRC = SQLITE_CORRUPT_BKPT;
+ goto ptrmap_exit;
+ }
+ assert( offset <= (int)pBt->usableSize-5 );
+ pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage);
+
+ if( eType!=pPtrmap[offset] || get4byte(&pPtrmap[offset+1])!=parent ){
+ TRACE(("PTRMAP_UPDATE: %u->(%u,%u)\n", key, eType, parent));
+ *pRC= rc = sqlite3PagerWrite(pDbPage);
+ if( rc==SQLITE_OK ){
+ pPtrmap[offset] = eType;
+ put4byte(&pPtrmap[offset+1], parent);
+ }
+ }
+
+ptrmap_exit:
+ sqlite3PagerUnref(pDbPage);
+}
+
+/*
+** Read an entry from the pointer map.
+**
+** This routine retrieves the pointer map entry for page 'key', writing
+** the type and parent page number to *pEType and *pPgno respectively.
+** An error code is returned if something goes wrong, otherwise SQLITE_OK.
+*/
+static int ptrmapGet(BtShared *pBt, Pgno key, u8 *pEType, Pgno *pPgno){
+ DbPage *pDbPage; /* The pointer map page */
+ int iPtrmap; /* Pointer map page index */
+ u8 *pPtrmap; /* Pointer map page data */
+ int offset; /* Offset of entry in pointer map */
+ int rc;
+
+ assert( sqlite3_mutex_held(pBt->mutex) );
+
+ iPtrmap = PTRMAP_PAGENO(pBt, key);
+ rc = sqlite3PagerGet(pBt->pPager, iPtrmap, &pDbPage, 0);
+ if( rc!=0 ){
+ return rc;
+ }
+ pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage);
+
+ offset = PTRMAP_PTROFFSET(iPtrmap, key);
+ if( offset<0 ){
+ sqlite3PagerUnref(pDbPage);
+ return SQLITE_CORRUPT_BKPT;
+ }
+ assert( offset <= (int)pBt->usableSize-5 );
+ assert( pEType!=0 );
+ *pEType = pPtrmap[offset];
+ if( pPgno ) *pPgno = get4byte(&pPtrmap[offset+1]);
+
+ sqlite3PagerUnref(pDbPage);
+ if( *pEType<1 || *pEType>5 ) return SQLITE_CORRUPT_PGNO(iPtrmap);
+ return SQLITE_OK;
+}
+
+#else /* if defined SQLITE_OMIT_AUTOVACUUM */
+ #define ptrmapPut(w,x,y,z,rc)
+ #define ptrmapGet(w,x,y,z) SQLITE_OK
+ #define ptrmapPutOvflPtr(x, y, z, rc)
+#endif
+
+/*
+** Given a btree page and a cell index (0 means the first cell on
+** the page, 1 means the second cell, and so forth) return a pointer
+** to the cell content.
+**
+** findCellPastPtr() does the same except it skips past the initial
+** 4-byte child pointer found on interior pages, if there is one.
+**
+** This routine works only for pages that do not contain overflow cells.
+*/
+#define findCell(P,I) \
+ ((P)->aData + ((P)->maskPage & get2byteAligned(&(P)->aCellIdx[2*(I)])))
+#define findCellPastPtr(P,I) \
+ ((P)->aDataOfst + ((P)->maskPage & get2byteAligned(&(P)->aCellIdx[2*(I)])))
+
+
+/*
+** This is common tail processing for btreeParseCellPtr() and
+** btreeParseCellPtrIndex() for the case when the cell does not fit entirely
+** on a single B-tree page. Make necessary adjustments to the CellInfo
+** structure.
+*/
+static SQLITE_NOINLINE void btreeParseCellAdjustSizeForOverflow(
+ MemPage *pPage, /* Page containing the cell */
+ u8 *pCell, /* Pointer to the cell text. */
+ CellInfo *pInfo /* Fill in this structure */
+){
+ /* If the payload will not fit completely on the local page, we have
+ ** to decide how much to store locally and how much to spill onto
+ ** overflow pages. The strategy is to minimize the amount of unused
+ ** space on overflow pages while keeping the amount of local storage
+ ** in between minLocal and maxLocal.
+ **
+ ** Warning: changing the way overflow payload is distributed in any
+ ** way will result in an incompatible file format.
+ */
+ int minLocal; /* Minimum amount of payload held locally */
+ int maxLocal; /* Maximum amount of payload held locally */
+ int surplus; /* Overflow payload available for local storage */
+
+ minLocal = pPage->minLocal;
+ maxLocal = pPage->maxLocal;
+ surplus = minLocal + (pInfo->nPayload - minLocal)%(pPage->pBt->usableSize-4);
+ testcase( surplus==maxLocal );
+ testcase( surplus==maxLocal+1 );
+ if( surplus <= maxLocal ){
+ pInfo->nLocal = (u16)surplus;
+ }else{
+ pInfo->nLocal = (u16)minLocal;
+ }
+ pInfo->nSize = (u16)(&pInfo->pPayload[pInfo->nLocal] - pCell) + 4;
+}
+
+/*
+** Given a record with nPayload bytes of payload stored within btree
+** page pPage, return the number of bytes of payload stored locally.
+*/
+static int btreePayloadToLocal(MemPage *pPage, i64 nPayload){
+ int maxLocal; /* Maximum amount of payload held locally */
+ maxLocal = pPage->maxLocal;
+ if( nPayload<=maxLocal ){
+ return nPayload;
+ }else{
+ int minLocal; /* Minimum amount of payload held locally */
+ int surplus; /* Overflow payload available for local storage */
+ minLocal = pPage->minLocal;
+ surplus = minLocal + (nPayload - minLocal)%(pPage->pBt->usableSize-4);
+ return ( surplus <= maxLocal ) ? surplus : minLocal;
+ }
+}
+
+/*
+** The following routines are implementations of the MemPage.xParseCell()
+** method.
+**
+** Parse a cell content block and fill in the CellInfo structure.
+**
+** btreeParseCellPtr() => table btree leaf nodes
+** btreeParseCellNoPayload() => table btree internal nodes
+** btreeParseCellPtrIndex() => index btree nodes
+**
+** There is also a wrapper function btreeParseCell() that works for
+** all MemPage types and that references the cell by index rather than
+** by pointer.
+*/
+static void btreeParseCellPtrNoPayload(
+ MemPage *pPage, /* Page containing the cell */
+ u8 *pCell, /* Pointer to the cell text. */
+ CellInfo *pInfo /* Fill in this structure */
+){
+ assert( sqlite3_mutex_held(pPage->pBt->mutex) );
+ assert( pPage->leaf==0 );
+ assert( pPage->childPtrSize==4 );
+#ifndef SQLITE_DEBUG
+ UNUSED_PARAMETER(pPage);
+#endif
+ pInfo->nSize = 4 + getVarint(&pCell[4], (u64*)&pInfo->nKey);
+ pInfo->nPayload = 0;
+ pInfo->nLocal = 0;
+ pInfo->pPayload = 0;
+ return;
+}
+static void btreeParseCellPtr(
+ MemPage *pPage, /* Page containing the cell */
+ u8 *pCell, /* Pointer to the cell text. */
+ CellInfo *pInfo /* Fill in this structure */
+){
+ u8 *pIter; /* For scanning through pCell */
+ u32 nPayload; /* Number of bytes of cell payload */
+ u64 iKey; /* Extracted Key value */
+
+ assert( sqlite3_mutex_held(pPage->pBt->mutex) );
+ assert( pPage->leaf==0 || pPage->leaf==1 );
+ assert( pPage->intKeyLeaf );
+ assert( pPage->childPtrSize==0 );
+ pIter = pCell;
+
+ /* The next block of code is equivalent to:
+ **
+ ** pIter += getVarint32(pIter, nPayload);
+ **
+ ** The code is inlined to avoid a function call.
+ */
+ nPayload = *pIter;
+ if( nPayload>=0x80 ){
+ u8 *pEnd = &pIter[8];
+ nPayload &= 0x7f;
+ do{
+ nPayload = (nPayload<<7) | (*++pIter & 0x7f);
+ }while( (*pIter)>=0x80 && pIter<pEnd );
+ }
+ pIter++;
+
+ /* The next block of code is equivalent to:
+ **
+ ** pIter += getVarint(pIter, (u64*)&pInfo->nKey);
+ **
+ ** The code is inlined and the loop is unrolled for performance.
+ ** This routine is a high-runner.
+ */
+ iKey = *pIter;
+ if( iKey>=0x80 ){
+ u8 x;
+ iKey = (iKey<<7) ^ (x = *++pIter);
+ if( x>=0x80 ){
+ iKey = (iKey<<7) ^ (x = *++pIter);
+ if( x>=0x80 ){
+ iKey = (iKey<<7) ^ 0x10204000 ^ (x = *++pIter);
+ if( x>=0x80 ){
+ iKey = (iKey<<7) ^ 0x4000 ^ (x = *++pIter);
+ if( x>=0x80 ){
+ iKey = (iKey<<7) ^ 0x4000 ^ (x = *++pIter);
+ if( x>=0x80 ){
+ iKey = (iKey<<7) ^ 0x4000 ^ (x = *++pIter);
+ if( x>=0x80 ){
+ iKey = (iKey<<7) ^ 0x4000 ^ (x = *++pIter);
+ if( x>=0x80 ){
+ iKey = (iKey<<8) ^ 0x8000 ^ (*++pIter);
+ }
+ }
+ }
+ }
+ }
+ }else{
+ iKey ^= 0x204000;
+ }
+ }else{
+ iKey ^= 0x4000;
+ }
+ }
+ pIter++;
+
+ pInfo->nKey = *(i64*)&iKey;
+ pInfo->nPayload = nPayload;
+ pInfo->pPayload = pIter;
+ testcase( nPayload==pPage->maxLocal );
+ testcase( nPayload==(u32)pPage->maxLocal+1 );
+ if( nPayload<=pPage->maxLocal ){
+ /* This is the (easy) common case where the entire payload fits
+ ** on the local page. No overflow is required.
+ */
+ pInfo->nSize = nPayload + (u16)(pIter - pCell);
+ if( pInfo->nSize<4 ) pInfo->nSize = 4;
+ pInfo->nLocal = (u16)nPayload;
+ }else{
+ btreeParseCellAdjustSizeForOverflow(pPage, pCell, pInfo);
+ }
+}
+static void btreeParseCellPtrIndex(
+ MemPage *pPage, /* Page containing the cell */
+ u8 *pCell, /* Pointer to the cell text. */
+ CellInfo *pInfo /* Fill in this structure */
+){
+ u8 *pIter; /* For scanning through pCell */
+ u32 nPayload; /* Number of bytes of cell payload */
+
+ assert( sqlite3_mutex_held(pPage->pBt->mutex) );
+ assert( pPage->leaf==0 || pPage->leaf==1 );
+ assert( pPage->intKeyLeaf==0 );
+ pIter = pCell + pPage->childPtrSize;
+ nPayload = *pIter;
+ if( nPayload>=0x80 ){
+ u8 *pEnd = &pIter[8];
+ nPayload &= 0x7f;
+ do{
+ nPayload = (nPayload<<7) | (*++pIter & 0x7f);
+ }while( *(pIter)>=0x80 && pIter<pEnd );
+ }
+ pIter++;
+ pInfo->nKey = nPayload;
+ pInfo->nPayload = nPayload;
+ pInfo->pPayload = pIter;
+ testcase( nPayload==pPage->maxLocal );
+ testcase( nPayload==(u32)pPage->maxLocal+1 );
+ if( nPayload<=pPage->maxLocal ){
+ /* This is the (easy) common case where the entire payload fits
+ ** on the local page. No overflow is required.
+ */
+ pInfo->nSize = nPayload + (u16)(pIter - pCell);
+ if( pInfo->nSize<4 ) pInfo->nSize = 4;
+ pInfo->nLocal = (u16)nPayload;
+ }else{
+ btreeParseCellAdjustSizeForOverflow(pPage, pCell, pInfo);
+ }
+}
+static void btreeParseCell(
+ MemPage *pPage, /* Page containing the cell */
+ int iCell, /* The cell index. First cell is 0 */
+ CellInfo *pInfo /* Fill in this structure */
+){
+ pPage->xParseCell(pPage, findCell(pPage, iCell), pInfo);
+}
+
+/*
+** The following routines are implementations of the MemPage.xCellSize
+** method.
+**
+** Compute the total number of bytes that a Cell needs in the cell
+** data area of the btree-page. The return number includes the cell
+** data header and the local payload, but not any overflow page or
+** the space used by the cell pointer.
+**
+** cellSizePtrNoPayload() => table internal nodes
+** cellSizePtrTableLeaf() => table leaf nodes
+** cellSizePtr() => index internal nodes
+** cellSizeIdxLeaf() => index leaf nodes
+*/
+static u16 cellSizePtr(MemPage *pPage, u8 *pCell){
+ u8 *pIter = pCell + 4; /* For looping over bytes of pCell */
+ u8 *pEnd; /* End mark for a varint */
+ u32 nSize; /* Size value to return */
+
+#ifdef SQLITE_DEBUG
+ /* The value returned by this function should always be the same as
+ ** the (CellInfo.nSize) value found by doing a full parse of the
+ ** cell. If SQLITE_DEBUG is defined, an assert() at the bottom of
+ ** this function verifies that this invariant is not violated. */
+ CellInfo debuginfo;
+ pPage->xParseCell(pPage, pCell, &debuginfo);
+#endif
+
+ assert( pPage->childPtrSize==4 );
+ nSize = *pIter;
+ if( nSize>=0x80 ){
+ pEnd = &pIter[8];
+ nSize &= 0x7f;
+ do{
+ nSize = (nSize<<7) | (*++pIter & 0x7f);
+ }while( *(pIter)>=0x80 && pIter<pEnd );
+ }
+ pIter++;
+ testcase( nSize==pPage->maxLocal );
+ testcase( nSize==(u32)pPage->maxLocal+1 );
+ if( nSize<=pPage->maxLocal ){
+ nSize += (u32)(pIter - pCell);
+ assert( nSize>4 );
+ }else{
+ int minLocal = pPage->minLocal;
+ nSize = minLocal + (nSize - minLocal) % (pPage->pBt->usableSize - 4);
+ testcase( nSize==pPage->maxLocal );
+ testcase( nSize==(u32)pPage->maxLocal+1 );
+ if( nSize>pPage->maxLocal ){
+ nSize = minLocal;
+ }
+ nSize += 4 + (u16)(pIter - pCell);
+ }
+ assert( nSize==debuginfo.nSize || CORRUPT_DB );
+ return (u16)nSize;
+}
+static u16 cellSizePtrIdxLeaf(MemPage *pPage, u8 *pCell){
+ u8 *pIter = pCell; /* For looping over bytes of pCell */
+ u8 *pEnd; /* End mark for a varint */
+ u32 nSize; /* Size value to return */
+
+#ifdef SQLITE_DEBUG
+ /* The value returned by this function should always be the same as
+ ** the (CellInfo.nSize) value found by doing a full parse of the
+ ** cell. If SQLITE_DEBUG is defined, an assert() at the bottom of
+ ** this function verifies that this invariant is not violated. */
+ CellInfo debuginfo;
+ pPage->xParseCell(pPage, pCell, &debuginfo);
+#endif
+
+ assert( pPage->childPtrSize==0 );
+ nSize = *pIter;
+ if( nSize>=0x80 ){
+ pEnd = &pIter[8];
+ nSize &= 0x7f;
+ do{
+ nSize = (nSize<<7) | (*++pIter & 0x7f);
+ }while( *(pIter)>=0x80 && pIter<pEnd );
+ }
+ pIter++;
+ testcase( nSize==pPage->maxLocal );
+ testcase( nSize==(u32)pPage->maxLocal+1 );
+ if( nSize<=pPage->maxLocal ){
+ nSize += (u32)(pIter - pCell);
+ if( nSize<4 ) nSize = 4;
+ }else{
+ int minLocal = pPage->minLocal;
+ nSize = minLocal + (nSize - minLocal) % (pPage->pBt->usableSize - 4);
+ testcase( nSize==pPage->maxLocal );
+ testcase( nSize==(u32)pPage->maxLocal+1 );
+ if( nSize>pPage->maxLocal ){
+ nSize = minLocal;
+ }
+ nSize += 4 + (u16)(pIter - pCell);
+ }
+ assert( nSize==debuginfo.nSize || CORRUPT_DB );
+ return (u16)nSize;
+}
+static u16 cellSizePtrNoPayload(MemPage *pPage, u8 *pCell){
+ u8 *pIter = pCell + 4; /* For looping over bytes of pCell */
+ u8 *pEnd; /* End mark for a varint */
+
+#ifdef SQLITE_DEBUG
+ /* The value returned by this function should always be the same as
+ ** the (CellInfo.nSize) value found by doing a full parse of the
+ ** cell. If SQLITE_DEBUG is defined, an assert() at the bottom of
+ ** this function verifies that this invariant is not violated. */
+ CellInfo debuginfo;
+ pPage->xParseCell(pPage, pCell, &debuginfo);
+#else
+ UNUSED_PARAMETER(pPage);
+#endif
+
+ assert( pPage->childPtrSize==4 );
+ pEnd = pIter + 9;
+ while( (*pIter++)&0x80 && pIter<pEnd );
+ assert( debuginfo.nSize==(u16)(pIter - pCell) || CORRUPT_DB );
+ return (u16)(pIter - pCell);
+}
+static u16 cellSizePtrTableLeaf(MemPage *pPage, u8 *pCell){
+ u8 *pIter = pCell; /* For looping over bytes of pCell */
+ u8 *pEnd; /* End mark for a varint */
+ u32 nSize; /* Size value to return */
+
+#ifdef SQLITE_DEBUG
+ /* The value returned by this function should always be the same as
+ ** the (CellInfo.nSize) value found by doing a full parse of the
+ ** cell. If SQLITE_DEBUG is defined, an assert() at the bottom of
+ ** this function verifies that this invariant is not violated. */
+ CellInfo debuginfo;
+ pPage->xParseCell(pPage, pCell, &debuginfo);
+#endif
+
+ nSize = *pIter;
+ if( nSize>=0x80 ){
+ pEnd = &pIter[8];
+ nSize &= 0x7f;
+ do{
+ nSize = (nSize<<7) | (*++pIter & 0x7f);
+ }while( *(pIter)>=0x80 && pIter<pEnd );
+ }
+ pIter++;
+ /* pIter now points at the 64-bit integer key value, a variable length
+ ** integer. The following block moves pIter to point at the first byte
+ ** past the end of the key value. */
+ if( (*pIter++)&0x80
+ && (*pIter++)&0x80
+ && (*pIter++)&0x80
+ && (*pIter++)&0x80
+ && (*pIter++)&0x80
+ && (*pIter++)&0x80
+ && (*pIter++)&0x80
+ && (*pIter++)&0x80 ){ pIter++; }
+ testcase( nSize==pPage->maxLocal );
+ testcase( nSize==(u32)pPage->maxLocal+1 );
+ if( nSize<=pPage->maxLocal ){
+ nSize += (u32)(pIter - pCell);
+ if( nSize<4 ) nSize = 4;
+ }else{
+ int minLocal = pPage->minLocal;
+ nSize = minLocal + (nSize - minLocal) % (pPage->pBt->usableSize - 4);
+ testcase( nSize==pPage->maxLocal );
+ testcase( nSize==(u32)pPage->maxLocal+1 );
+ if( nSize>pPage->maxLocal ){
+ nSize = minLocal;
+ }
+ nSize += 4 + (u16)(pIter - pCell);
+ }
+ assert( nSize==debuginfo.nSize || CORRUPT_DB );
+ return (u16)nSize;
+}
+
+
+#ifdef SQLITE_DEBUG
+/* This variation on cellSizePtr() is used inside of assert() statements
+** only. */
+static u16 cellSize(MemPage *pPage, int iCell){
+ return pPage->xCellSize(pPage, findCell(pPage, iCell));
+}
+#endif
+
+#ifndef SQLITE_OMIT_AUTOVACUUM
+/*
+** The cell pCell is currently part of page pSrc but will ultimately be part
+** of pPage. (pSrc and pPage are often the same.) If pCell contains a
+** pointer to an overflow page, insert an entry into the pointer-map for
+** the overflow page that will be valid after pCell has been moved to pPage.
+*/
+static void ptrmapPutOvflPtr(MemPage *pPage, MemPage *pSrc, u8 *pCell,int *pRC){
+ CellInfo info;
+ if( *pRC ) return;
+ assert( pCell!=0 );
+ pPage->xParseCell(pPage, pCell, &info);
+ if( info.nLocal<info.nPayload ){
+ Pgno ovfl;
+ if( SQLITE_OVERFLOW(pSrc->aDataEnd, pCell, pCell+info.nLocal) ){
+ testcase( pSrc!=pPage );
+ *pRC = SQLITE_CORRUPT_BKPT;
+ return;
+ }
+ ovfl = get4byte(&pCell[info.nSize-4]);
+ ptrmapPut(pPage->pBt, ovfl, PTRMAP_OVERFLOW1, pPage->pgno, pRC);
+ }
+}
+#endif
+
+
+/*
+** Defragment the page given. This routine reorganizes cells within the
+** page so that there are no free-blocks on the free-block list.
+**
+** Parameter nMaxFrag is the maximum amount of fragmented space that may be
+** present in the page after this routine returns.
+**
+** EVIDENCE-OF: R-44582-60138 SQLite may from time to time reorganize a
+** b-tree page so that there are no freeblocks or fragment bytes, all
+** unused bytes are contained in the unallocated space region, and all
+** cells are packed tightly at the end of the page.
+*/
+static int defragmentPage(MemPage *pPage, int nMaxFrag){
+ int i; /* Loop counter */
+ int pc; /* Address of the i-th cell */
+ int hdr; /* Offset to the page header */
+ int size; /* Size of a cell */
+ int usableSize; /* Number of usable bytes on a page */
+ int cellOffset; /* Offset to the cell pointer array */
+ int cbrk; /* Offset to the cell content area */
+ int nCell; /* Number of cells on the page */
+ unsigned char *data; /* The page data */
+ unsigned char *temp; /* Temp area for cell content */
+ unsigned char *src; /* Source of content */
+ int iCellFirst; /* First allowable cell index */
+ int iCellLast; /* Last possible cell index */
+ int iCellStart; /* First cell offset in input */
+
+ assert( sqlite3PagerIswriteable(pPage->pDbPage) );
+ assert( pPage->pBt!=0 );
+ assert( pPage->pBt->usableSize <= SQLITE_MAX_PAGE_SIZE );
+ assert( pPage->nOverflow==0 );
+ assert( sqlite3_mutex_held(pPage->pBt->mutex) );
+ data = pPage->aData;
+ hdr = pPage->hdrOffset;
+ cellOffset = pPage->cellOffset;
+ nCell = pPage->nCell;
+ assert( nCell==get2byte(&data[hdr+3]) || CORRUPT_DB );
+ iCellFirst = cellOffset + 2*nCell;
+ usableSize = pPage->pBt->usableSize;
+
+ /* This block handles pages with two or fewer free blocks and nMaxFrag
+ ** or fewer fragmented bytes. In this case it is faster to move the
+ ** two (or one) blocks of cells using memmove() and add the required
+ ** offsets to each pointer in the cell-pointer array than it is to
+ ** reconstruct the entire page. */
+ if( (int)data[hdr+7]<=nMaxFrag ){
+ int iFree = get2byte(&data[hdr+1]);
+ if( iFree>usableSize-4 ) return SQLITE_CORRUPT_PAGE(pPage);
+ if( iFree ){
+ int iFree2 = get2byte(&data[iFree]);
+ if( iFree2>usableSize-4 ) return SQLITE_CORRUPT_PAGE(pPage);
+ if( 0==iFree2 || (data[iFree2]==0 && data[iFree2+1]==0) ){
+ u8 *pEnd = &data[cellOffset + nCell*2];
+ u8 *pAddr;
+ int sz2 = 0;
+ int sz = get2byte(&data[iFree+2]);
+ int top = get2byte(&data[hdr+5]);
+ if( top>=iFree ){
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ if( iFree2 ){
+ if( iFree+sz>iFree2 ) return SQLITE_CORRUPT_PAGE(pPage);
+ sz2 = get2byte(&data[iFree2+2]);
+ if( iFree2+sz2 > usableSize ) return SQLITE_CORRUPT_PAGE(pPage);
+ memmove(&data[iFree+sz+sz2], &data[iFree+sz], iFree2-(iFree+sz));
+ sz += sz2;
+ }else if( iFree+sz>usableSize ){
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+
+ cbrk = top+sz;
+ assert( cbrk+(iFree-top) <= usableSize );
+ memmove(&data[cbrk], &data[top], iFree-top);
+ for(pAddr=&data[cellOffset]; pAddr<pEnd; pAddr+=2){
+ pc = get2byte(pAddr);
+ if( pc<iFree ){ put2byte(pAddr, pc+sz); }
+ else if( pc<iFree2 ){ put2byte(pAddr, pc+sz2); }
+ }
+ goto defragment_out;
+ }
+ }
+ }
+
+ cbrk = usableSize;
+ iCellLast = usableSize - 4;
+ iCellStart = get2byte(&data[hdr+5]);
+ if( nCell>0 ){
+ temp = sqlite3PagerTempSpace(pPage->pBt->pPager);
+ memcpy(temp, data, usableSize);
+ src = temp;
+ for(i=0; i<nCell; i++){
+ u8 *pAddr; /* The i-th cell pointer */
+ pAddr = &data[cellOffset + i*2];
+ pc = get2byte(pAddr);
+ testcase( pc==iCellFirst );
+ testcase( pc==iCellLast );
+ /* These conditions have already been verified in btreeInitPage()
+ ** if PRAGMA cell_size_check=ON.
+ */
+ if( pc>iCellLast ){
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ assert( pc>=0 && pc<=iCellLast );
+ size = pPage->xCellSize(pPage, &src[pc]);
+ cbrk -= size;
+ if( cbrk<iCellStart || pc+size>usableSize ){
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ assert( cbrk+size<=usableSize && cbrk>=iCellStart );
+ testcase( cbrk+size==usableSize );
+ testcase( pc+size==usableSize );
+ put2byte(pAddr, cbrk);
+ memcpy(&data[cbrk], &src[pc], size);
+ }
+ }
+ data[hdr+7] = 0;
+
+defragment_out:
+ assert( pPage->nFree>=0 );
+ if( data[hdr+7]+cbrk-iCellFirst!=pPage->nFree ){
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ assert( cbrk>=iCellFirst );
+ put2byte(&data[hdr+5], cbrk);
+ data[hdr+1] = 0;
+ data[hdr+2] = 0;
+ memset(&data[iCellFirst], 0, cbrk-iCellFirst);
+ assert( sqlite3PagerIswriteable(pPage->pDbPage) );
+ return SQLITE_OK;
+}
+
+/*
+** Search the free-list on page pPg for space to store a cell nByte bytes in
+** size. If one can be found, return a pointer to the space and remove it
+** from the free-list.
+**
+** If no suitable space can be found on the free-list, return NULL.
+**
+** This function may detect corruption within pPg. If corruption is
+** detected then *pRc is set to SQLITE_CORRUPT and NULL is returned.
+**
+** Slots on the free list that are between 1 and 3 bytes larger than nByte
+** will be ignored if adding the extra space to the fragmentation count
+** causes the fragmentation count to exceed 60.
+*/
+static u8 *pageFindSlot(MemPage *pPg, int nByte, int *pRc){
+ const int hdr = pPg->hdrOffset; /* Offset to page header */
+ u8 * const aData = pPg->aData; /* Page data */
+ int iAddr = hdr + 1; /* Address of ptr to pc */
+ u8 *pTmp = &aData[iAddr]; /* Temporary ptr into aData[] */
+ int pc = get2byte(pTmp); /* Address of a free slot */
+ int x; /* Excess size of the slot */
+ int maxPC = pPg->pBt->usableSize - nByte; /* Max address for a usable slot */
+ int size; /* Size of the free slot */
+
+ assert( pc>0 );
+ while( pc<=maxPC ){
+ /* EVIDENCE-OF: R-22710-53328 The third and fourth bytes of each
+ ** freeblock form a big-endian integer which is the size of the freeblock
+ ** in bytes, including the 4-byte header. */
+ pTmp = &aData[pc+2];
+ size = get2byte(pTmp);
+ if( (x = size - nByte)>=0 ){
+ testcase( x==4 );
+ testcase( x==3 );
+ if( x<4 ){
+ /* EVIDENCE-OF: R-11498-58022 In a well-formed b-tree page, the total
+ ** number of bytes in fragments may not exceed 60. */
+ if( aData[hdr+7]>57 ) return 0;
+
+ /* Remove the slot from the free-list. Update the number of
+ ** fragmented bytes within the page. */
+ memcpy(&aData[iAddr], &aData[pc], 2);
+ aData[hdr+7] += (u8)x;
+ return &aData[pc];
+ }else if( x+pc > maxPC ){
+ /* This slot extends off the end of the usable part of the page */
+ *pRc = SQLITE_CORRUPT_PAGE(pPg);
+ return 0;
+ }else{
+ /* The slot remains on the free-list. Reduce its size to account
+ ** for the portion used by the new allocation. */
+ put2byte(&aData[pc+2], x);
+ }
+ return &aData[pc + x];
+ }
+ iAddr = pc;
+ pTmp = &aData[pc];
+ pc = get2byte(pTmp);
+ if( pc<=iAddr ){
+ if( pc ){
+ /* The next slot in the chain comes before the current slot */
+ *pRc = SQLITE_CORRUPT_PAGE(pPg);
+ }
+ return 0;
+ }
+ }
+ if( pc>maxPC+nByte-4 ){
+ /* The free slot chain extends off the end of the page */
+ *pRc = SQLITE_CORRUPT_PAGE(pPg);
+ }
+ return 0;
+}
+
+/*
+** Allocate nByte bytes of space from within the B-Tree page passed
+** as the first argument. Write into *pIdx the index into pPage->aData[]
+** of the first byte of allocated space. Return either SQLITE_OK or
+** an error code (usually SQLITE_CORRUPT).
+**
+** The caller guarantees that there is sufficient space to make the
+** allocation. This routine might need to defragment in order to bring
+** all the space together, however. This routine will avoid using
+** the first two bytes past the cell pointer area since presumably this
+** allocation is being made in order to insert a new cell, so we will
+** also end up needing a new cell pointer.
+*/
+static SQLITE_INLINE int allocateSpace(MemPage *pPage, int nByte, int *pIdx){
+ const int hdr = pPage->hdrOffset; /* Local cache of pPage->hdrOffset */
+ u8 * const data = pPage->aData; /* Local cache of pPage->aData */
+ int top; /* First byte of cell content area */
+ int rc = SQLITE_OK; /* Integer return code */
+ u8 *pTmp; /* Temp ptr into data[] */
+ int gap; /* First byte of gap between cell pointers and cell content */
+
+ assert( sqlite3PagerIswriteable(pPage->pDbPage) );
+ assert( pPage->pBt );
+ assert( sqlite3_mutex_held(pPage->pBt->mutex) );
+ assert( nByte>=0 ); /* Minimum cell size is 4 */
+ assert( pPage->nFree>=nByte );
+ assert( pPage->nOverflow==0 );
+ assert( nByte < (int)(pPage->pBt->usableSize-8) );
+
+ assert( pPage->cellOffset == hdr + 12 - 4*pPage->leaf );
+ gap = pPage->cellOffset + 2*pPage->nCell;
+ assert( gap<=65536 );
+ /* EVIDENCE-OF: R-29356-02391 If the database uses a 65536-byte page size
+ ** and the reserved space is zero (the usual value for reserved space)
+ ** then the cell content offset of an empty page wants to be 65536.
+ ** However, that integer is too large to be stored in a 2-byte unsigned
+ ** integer, so a value of 0 is used in its place. */
+ pTmp = &data[hdr+5];
+ top = get2byte(pTmp);
+ if( gap>top ){
+ if( top==0 && pPage->pBt->usableSize==65536 ){
+ top = 65536;
+ }else{
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ }else if( top>(int)pPage->pBt->usableSize ){
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+
+ /* If there is enough space between gap and top for one more cell pointer,
+ ** and if the freelist is not empty, then search the
+ ** freelist looking for a slot big enough to satisfy the request.
+ */
+ testcase( gap+2==top );
+ testcase( gap+1==top );
+ testcase( gap==top );
+ if( (data[hdr+2] || data[hdr+1]) && gap+2<=top ){
+ u8 *pSpace = pageFindSlot(pPage, nByte, &rc);
+ if( pSpace ){
+ int g2;
+ assert( pSpace+nByte<=data+pPage->pBt->usableSize );
+ *pIdx = g2 = (int)(pSpace-data);
+ if( g2<=gap ){
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }else{
+ return SQLITE_OK;
+ }
+ }else if( rc ){
+ return rc;
+ }
+ }
+
+ /* The request could not be fulfilled using a freelist slot. Check
+ ** to see if defragmentation is necessary.
+ */
+ testcase( gap+2+nByte==top );
+ if( gap+2+nByte>top ){
+ assert( pPage->nCell>0 || CORRUPT_DB );
+ assert( pPage->nFree>=0 );
+ rc = defragmentPage(pPage, MIN(4, pPage->nFree - (2+nByte)));
+ if( rc ) return rc;
+ top = get2byteNotZero(&data[hdr+5]);
+ assert( gap+2+nByte<=top );
+ }
+
+
+ /* Allocate memory from the gap in between the cell pointer array
+ ** and the cell content area. The btreeComputeFreeSpace() call has already
+ ** validated the freelist. Given that the freelist is valid, there
+ ** is no way that the allocation can extend off the end of the page.
+ ** The assert() below verifies the previous sentence.
+ */
+ top -= nByte;
+ put2byte(&data[hdr+5], top);
+ assert( top+nByte <= (int)pPage->pBt->usableSize );
+ *pIdx = top;
+ return SQLITE_OK;
+}
+
+/*
+** Return a section of the pPage->aData to the freelist.
+** The first byte of the new free block is pPage->aData[iStart]
+** and the size of the block is iSize bytes.
+**
+** Adjacent freeblocks are coalesced.
+**
+** Even though the freeblock list was checked by btreeComputeFreeSpace(),
+** that routine will not detect overlap between cells or freeblocks. Nor
+** does it detect cells or freeblocks that encroach into the reserved bytes
+** at the end of the page. So do additional corruption checks inside this
+** routine and return SQLITE_CORRUPT if any problems are found.
+*/
+static int freeSpace(MemPage *pPage, u16 iStart, u16 iSize){
+ u16 iPtr; /* Address of ptr to next freeblock */
+ u16 iFreeBlk; /* Address of the next freeblock */
+ u8 hdr; /* Page header size. 0 or 100 */
+ u8 nFrag = 0; /* Reduction in fragmentation */
+ u16 iOrigSize = iSize; /* Original value of iSize */
+ u16 x; /* Offset to cell content area */
+ u32 iEnd = iStart + iSize; /* First byte past the iStart buffer */
+ unsigned char *data = pPage->aData; /* Page content */
+ u8 *pTmp; /* Temporary ptr into data[] */
+
+ assert( pPage->pBt!=0 );
+ assert( sqlite3PagerIswriteable(pPage->pDbPage) );
+ assert( CORRUPT_DB || iStart>=pPage->hdrOffset+6+pPage->childPtrSize );
+ assert( CORRUPT_DB || iEnd <= pPage->pBt->usableSize );
+ assert( sqlite3_mutex_held(pPage->pBt->mutex) );
+ assert( iSize>=4 ); /* Minimum cell size is 4 */
+ assert( CORRUPT_DB || iStart<=pPage->pBt->usableSize-4 );
+
+ /* The list of freeblocks must be in ascending order. Find the
+ ** spot on the list where iStart should be inserted.
+ */
+ hdr = pPage->hdrOffset;
+ iPtr = hdr + 1;
+ if( data[iPtr+1]==0 && data[iPtr]==0 ){
+ iFreeBlk = 0; /* Shortcut for the case when the freelist is empty */
+ }else{
+ while( (iFreeBlk = get2byte(&data[iPtr]))<iStart ){
+ if( iFreeBlk<=iPtr ){
+ if( iFreeBlk==0 ) break; /* TH3: corrupt082.100 */
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ iPtr = iFreeBlk;
+ }
+ if( iFreeBlk>pPage->pBt->usableSize-4 ){ /* TH3: corrupt081.100 */
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ assert( iFreeBlk>iPtr || iFreeBlk==0 || CORRUPT_DB );
+
+ /* At this point:
+ ** iFreeBlk: First freeblock after iStart, or zero if none
+ ** iPtr: The address of a pointer to iFreeBlk
+ **
+ ** Check to see if iFreeBlk should be coalesced onto the end of iStart.
+ */
+ if( iFreeBlk && iEnd+3>=iFreeBlk ){
+ nFrag = iFreeBlk - iEnd;
+ if( iEnd>iFreeBlk ) return SQLITE_CORRUPT_PAGE(pPage);
+ iEnd = iFreeBlk + get2byte(&data[iFreeBlk+2]);
+ if( iEnd > pPage->pBt->usableSize ){
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ iSize = iEnd - iStart;
+ iFreeBlk = get2byte(&data[iFreeBlk]);
+ }
+
+ /* If iPtr is another freeblock (that is, if iPtr is not the freelist
+ ** pointer in the page header) then check to see if iStart should be
+ ** coalesced onto the end of iPtr.
+ */
+ if( iPtr>hdr+1 ){
+ int iPtrEnd = iPtr + get2byte(&data[iPtr+2]);
+ if( iPtrEnd+3>=iStart ){
+ if( iPtrEnd>iStart ) return SQLITE_CORRUPT_PAGE(pPage);
+ nFrag += iStart - iPtrEnd;
+ iSize = iEnd - iPtr;
+ iStart = iPtr;
+ }
+ }
+ if( nFrag>data[hdr+7] ) return SQLITE_CORRUPT_PAGE(pPage);
+ data[hdr+7] -= nFrag;
+ }
+ pTmp = &data[hdr+5];
+ x = get2byte(pTmp);
+ if( pPage->pBt->btsFlags & BTS_FAST_SECURE ){
+ /* Overwrite deleted information with zeros when the secure_delete
+ ** option is enabled */
+ memset(&data[iStart], 0, iSize);
+ }
+ if( iStart<=x ){
+ /* The new freeblock is at the beginning of the cell content area,
+ ** so just extend the cell content area rather than create another
+ ** freelist entry */
+ if( iStart<x ) return SQLITE_CORRUPT_PAGE(pPage);
+ if( iPtr!=hdr+1 ) return SQLITE_CORRUPT_PAGE(pPage);
+ put2byte(&data[hdr+1], iFreeBlk);
+ put2byte(&data[hdr+5], iEnd);
+ }else{
+ /* Insert the new freeblock into the freelist */
+ put2byte(&data[iPtr], iStart);
+ put2byte(&data[iStart], iFreeBlk);
+ put2byte(&data[iStart+2], iSize);
+ }
+ pPage->nFree += iOrigSize;
+ return SQLITE_OK;
+}
+
+/*
+** Decode the flags byte (the first byte of the header) for a page
+** and initialize fields of the MemPage structure accordingly.
+**
+** Only the following combinations are supported. Anything different
+** indicates a corrupt database files:
+**
+** PTF_ZERODATA (0x02, 2)
+** PTF_LEAFDATA | PTF_INTKEY (0x05, 5)
+** PTF_ZERODATA | PTF_LEAF (0x0a, 10)
+** PTF_LEAFDATA | PTF_INTKEY | PTF_LEAF (0x0d, 13)
+*/
+static int decodeFlags(MemPage *pPage, int flagByte){
+ BtShared *pBt; /* A copy of pPage->pBt */
+
+ assert( pPage->hdrOffset==(pPage->pgno==1 ? 100 : 0) );
+ assert( sqlite3_mutex_held(pPage->pBt->mutex) );
+ pBt = pPage->pBt;
+ pPage->max1bytePayload = pBt->max1bytePayload;
+ if( flagByte>=(PTF_ZERODATA | PTF_LEAF) ){
+ pPage->childPtrSize = 0;
+ pPage->leaf = 1;
+ if( flagByte==(PTF_LEAFDATA | PTF_INTKEY | PTF_LEAF) ){
+ pPage->intKeyLeaf = 1;
+ pPage->xCellSize = cellSizePtrTableLeaf;
+ pPage->xParseCell = btreeParseCellPtr;
+ pPage->intKey = 1;
+ pPage->maxLocal = pBt->maxLeaf;
+ pPage->minLocal = pBt->minLeaf;
+ }else if( flagByte==(PTF_ZERODATA | PTF_LEAF) ){
+ pPage->intKey = 0;
+ pPage->intKeyLeaf = 0;
+ pPage->xCellSize = cellSizePtrIdxLeaf;
+ pPage->xParseCell = btreeParseCellPtrIndex;
+ pPage->maxLocal = pBt->maxLocal;
+ pPage->minLocal = pBt->minLocal;
+ }else{
+ pPage->intKey = 0;
+ pPage->intKeyLeaf = 0;
+ pPage->xCellSize = cellSizePtrIdxLeaf;
+ pPage->xParseCell = btreeParseCellPtrIndex;
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ }else{
+ pPage->childPtrSize = 4;
+ pPage->leaf = 0;
+ if( flagByte==(PTF_ZERODATA) ){
+ pPage->intKey = 0;
+ pPage->intKeyLeaf = 0;
+ pPage->xCellSize = cellSizePtr;
+ pPage->xParseCell = btreeParseCellPtrIndex;
+ pPage->maxLocal = pBt->maxLocal;
+ pPage->minLocal = pBt->minLocal;
+ }else if( flagByte==(PTF_LEAFDATA | PTF_INTKEY) ){
+ pPage->intKeyLeaf = 0;
+ pPage->xCellSize = cellSizePtrNoPayload;
+ pPage->xParseCell = btreeParseCellPtrNoPayload;
+ pPage->intKey = 1;
+ pPage->maxLocal = pBt->maxLeaf;
+ pPage->minLocal = pBt->minLeaf;
+ }else{
+ pPage->intKey = 0;
+ pPage->intKeyLeaf = 0;
+ pPage->xCellSize = cellSizePtr;
+ pPage->xParseCell = btreeParseCellPtrIndex;
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ }
+ return SQLITE_OK;
+}
+
+/*
+** Compute the amount of freespace on the page. In other words, fill
+** in the pPage->nFree field.
+*/
+static int btreeComputeFreeSpace(MemPage *pPage){
+ int pc; /* Address of a freeblock within pPage->aData[] */
+ u8 hdr; /* Offset to beginning of page header */
+ u8 *data; /* Equal to pPage->aData */
+ int usableSize; /* Amount of usable space on each page */
+ int nFree; /* Number of unused bytes on the page */
+ int top; /* First byte of the cell content area */
+ int iCellFirst; /* First allowable cell or freeblock offset */
+ int iCellLast; /* Last possible cell or freeblock offset */
+
+ assert( pPage->pBt!=0 );
+ assert( pPage->pBt->db!=0 );
+ assert( sqlite3_mutex_held(pPage->pBt->mutex) );
+ assert( pPage->pgno==sqlite3PagerPagenumber(pPage->pDbPage) );
+ assert( pPage == sqlite3PagerGetExtra(pPage->pDbPage) );
+ assert( pPage->aData == sqlite3PagerGetData(pPage->pDbPage) );
+ assert( pPage->isInit==1 );
+ assert( pPage->nFree<0 );
+
+ usableSize = pPage->pBt->usableSize;
+ hdr = pPage->hdrOffset;
+ data = pPage->aData;
+ /* EVIDENCE-OF: R-58015-48175 The two-byte integer at offset 5 designates
+ ** the start of the cell content area. A zero value for this integer is
+ ** interpreted as 65536. */
+ top = get2byteNotZero(&data[hdr+5]);
+ iCellFirst = hdr + 8 + pPage->childPtrSize + 2*pPage->nCell;
+ iCellLast = usableSize - 4;
+
+ /* Compute the total free space on the page
+ ** EVIDENCE-OF: R-23588-34450 The two-byte integer at offset 1 gives the
+ ** start of the first freeblock on the page, or is zero if there are no
+ ** freeblocks. */
+ pc = get2byte(&data[hdr+1]);
+ nFree = data[hdr+7] + top; /* Init nFree to non-freeblock free space */
+ if( pc>0 ){
+ u32 next, size;
+ if( pc<top ){
+ /* EVIDENCE-OF: R-55530-52930 In a well-formed b-tree page, there will
+ ** always be at least one cell before the first freeblock.
+ */
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ while( 1 ){
+ if( pc>iCellLast ){
+ /* Freeblock off the end of the page */
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ next = get2byte(&data[pc]);
+ size = get2byte(&data[pc+2]);
+ nFree = nFree + size;
+ if( next<=pc+size+3 ) break;
+ pc = next;
+ }
+ if( next>0 ){
+ /* Freeblock not in ascending order */
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ if( pc+size>(unsigned int)usableSize ){
+ /* Last freeblock extends past page end */
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ }
+
+ /* At this point, nFree contains the sum of the offset to the start
+ ** of the cell-content area plus the number of free bytes within
+ ** the cell-content area. If this is greater than the usable-size
+ ** of the page, then the page must be corrupted. This check also
+ ** serves to verify that the offset to the start of the cell-content
+ ** area, according to the page header, lies within the page.
+ */
+ if( nFree>usableSize || nFree<iCellFirst ){
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ pPage->nFree = (u16)(nFree - iCellFirst);
+ return SQLITE_OK;
+}
+
+/*
+** Do additional sanity check after btreeInitPage() if
+** PRAGMA cell_size_check=ON
+*/
+static SQLITE_NOINLINE int btreeCellSizeCheck(MemPage *pPage){
+ int iCellFirst; /* First allowable cell or freeblock offset */
+ int iCellLast; /* Last possible cell or freeblock offset */
+ int i; /* Index into the cell pointer array */
+ int sz; /* Size of a cell */
+ int pc; /* Address of a freeblock within pPage->aData[] */
+ u8 *data; /* Equal to pPage->aData */
+ int usableSize; /* Maximum usable space on the page */
+ int cellOffset; /* Start of cell content area */
+
+ iCellFirst = pPage->cellOffset + 2*pPage->nCell;
+ usableSize = pPage->pBt->usableSize;
+ iCellLast = usableSize - 4;
+ data = pPage->aData;
+ cellOffset = pPage->cellOffset;
+ if( !pPage->leaf ) iCellLast--;
+ for(i=0; i<pPage->nCell; i++){
+ pc = get2byteAligned(&data[cellOffset+i*2]);
+ testcase( pc==iCellFirst );
+ testcase( pc==iCellLast );
+ if( pc<iCellFirst || pc>iCellLast ){
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ sz = pPage->xCellSize(pPage, &data[pc]);
+ testcase( pc+sz==usableSize );
+ if( pc+sz>usableSize ){
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ }
+ return SQLITE_OK;
+}
+
+/*
+** Initialize the auxiliary information for a disk block.
+**
+** Return SQLITE_OK on success. If we see that the page does
+** not contain a well-formed database page, then return
+** SQLITE_CORRUPT. Note that a return of SQLITE_OK does not
+** guarantee that the page is well-formed. It only shows that
+** we failed to detect any corruption.
+*/
+static int btreeInitPage(MemPage *pPage){
+ u8 *data; /* Equal to pPage->aData */
+ BtShared *pBt; /* The main btree structure */
+
+ assert( pPage->pBt!=0 );
+ assert( pPage->pBt->db!=0 );
+ assert( sqlite3_mutex_held(pPage->pBt->mutex) );
+ assert( pPage->pgno==sqlite3PagerPagenumber(pPage->pDbPage) );
+ assert( pPage == sqlite3PagerGetExtra(pPage->pDbPage) );
+ assert( pPage->aData == sqlite3PagerGetData(pPage->pDbPage) );
+ assert( pPage->isInit==0 );
+
+ pBt = pPage->pBt;
+ data = pPage->aData + pPage->hdrOffset;
+ /* EVIDENCE-OF: R-28594-02890 The one-byte flag at offset 0 indicating
+ ** the b-tree page type. */
+ if( decodeFlags(pPage, data[0]) ){
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ assert( pBt->pageSize>=512 && pBt->pageSize<=65536 );
+ pPage->maskPage = (u16)(pBt->pageSize - 1);
+ pPage->nOverflow = 0;
+ pPage->cellOffset = pPage->hdrOffset + 8 + pPage->childPtrSize;
+ pPage->aCellIdx = data + pPage->childPtrSize + 8;
+ pPage->aDataEnd = pPage->aData + pBt->pageSize;
+ pPage->aDataOfst = pPage->aData + pPage->childPtrSize;
+ /* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the
+ ** number of cells on the page. */
+ pPage->nCell = get2byte(&data[3]);
+ if( pPage->nCell>MX_CELL(pBt) ){
+ /* To many cells for a single page. The page must be corrupt */
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ testcase( pPage->nCell==MX_CELL(pBt) );
+ /* EVIDENCE-OF: R-24089-57979 If a page contains no cells (which is only
+ ** possible for a root page of a table that contains no rows) then the
+ ** offset to the cell content area will equal the page size minus the
+ ** bytes of reserved space. */
+ assert( pPage->nCell>0
+ || get2byteNotZero(&data[5])==(int)pBt->usableSize
+ || CORRUPT_DB );
+ pPage->nFree = -1; /* Indicate that this value is yet uncomputed */
+ pPage->isInit = 1;
+ if( pBt->db->flags & SQLITE_CellSizeCk ){
+ return btreeCellSizeCheck(pPage);
+ }
+ return SQLITE_OK;
+}
+
+/*
+** Set up a raw page so that it looks like a database page holding
+** no entries.
+*/
+static void zeroPage(MemPage *pPage, int flags){
+ unsigned char *data = pPage->aData;
+ BtShared *pBt = pPage->pBt;
+ u8 hdr = pPage->hdrOffset;
+ u16 first;
+
+ assert( sqlite3PagerPagenumber(pPage->pDbPage)==pPage->pgno || CORRUPT_DB );
+ assert( sqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage );
+ assert( sqlite3PagerGetData(pPage->pDbPage) == data );
+ assert( sqlite3PagerIswriteable(pPage->pDbPage) );
+ assert( sqlite3_mutex_held(pBt->mutex) );
+ if( pBt->btsFlags & BTS_FAST_SECURE ){
+ memset(&data[hdr], 0, pBt->usableSize - hdr);
+ }
+ data[hdr] = (char)flags;
+ first = hdr + ((flags&PTF_LEAF)==0 ? 12 : 8);
+ memset(&data[hdr+1], 0, 4);
+ data[hdr+7] = 0;
+ put2byte(&data[hdr+5], pBt->usableSize);
+ pPage->nFree = (u16)(pBt->usableSize - first);
+ decodeFlags(pPage, flags);
+ pPage->cellOffset = first;
+ pPage->aDataEnd = &data[pBt->pageSize];
+ pPage->aCellIdx = &data[first];
+ pPage->aDataOfst = &data[pPage->childPtrSize];
+ pPage->nOverflow = 0;
+ assert( pBt->pageSize>=512 && pBt->pageSize<=65536 );
+ pPage->maskPage = (u16)(pBt->pageSize - 1);
+ pPage->nCell = 0;
+ pPage->isInit = 1;
+}
+
+
+/*
+** Convert a DbPage obtained from the pager into a MemPage used by
+** the btree layer.
+*/
+static MemPage *btreePageFromDbPage(DbPage *pDbPage, Pgno pgno, BtShared *pBt){
+ MemPage *pPage = (MemPage*)sqlite3PagerGetExtra(pDbPage);
+ if( pgno!=pPage->pgno ){
+ pPage->aData = sqlite3PagerGetData(pDbPage);
+ pPage->pDbPage = pDbPage;
+ pPage->pBt = pBt;
+ pPage->pgno = pgno;
+ pPage->hdrOffset = pgno==1 ? 100 : 0;
+ }
+ assert( pPage->aData==sqlite3PagerGetData(pDbPage) );
+ return pPage;
+}
+
+/*
+** Get a page from the pager. Initialize the MemPage.pBt and
+** MemPage.aData elements if needed. See also: btreeGetUnusedPage().
+**
+** If the PAGER_GET_NOCONTENT flag is set, it means that we do not care
+** about the content of the page at this time. So do not go to the disk
+** to fetch the content. Just fill in the content with zeros for now.
+** If in the future we call sqlite3PagerWrite() on this page, that
+** means we have started to be concerned about content and the disk
+** read should occur at that point.
+*/
+static int btreeGetPage(
+ BtShared *pBt, /* The btree */
+ Pgno pgno, /* Number of the page to fetch */
+ MemPage **ppPage, /* Return the page in this parameter */
+ int flags /* PAGER_GET_NOCONTENT or PAGER_GET_READONLY */
+){
+ int rc;
+ DbPage *pDbPage;
+
+ assert( flags==0 || flags==PAGER_GET_NOCONTENT || flags==PAGER_GET_READONLY );
+ assert( sqlite3_mutex_held(pBt->mutex) );
+ rc = sqlite3PagerGet(pBt->pPager, pgno, (DbPage**)&pDbPage, flags);
+ if( rc ) return rc;
+ *ppPage = btreePageFromDbPage(pDbPage, pgno, pBt);
+ return SQLITE_OK;
+}
+
+/*
+** Retrieve a page from the pager cache. If the requested page is not
+** already in the pager cache return NULL. Initialize the MemPage.pBt and
+** MemPage.aData elements if needed.
+*/
+static MemPage *btreePageLookup(BtShared *pBt, Pgno pgno){
+ DbPage *pDbPage;
+ assert( sqlite3_mutex_held(pBt->mutex) );
+ pDbPage = sqlite3PagerLookup(pBt->pPager, pgno);
+ if( pDbPage ){
+ return btreePageFromDbPage(pDbPage, pgno, pBt);
+ }
+ return 0;
+}
+
+/*
+** Return the size of the database file in pages. If there is any kind of
+** error, return ((unsigned int)-1).
+*/
+static Pgno btreePagecount(BtShared *pBt){
+ return pBt->nPage;
+}
+SQLITE_PRIVATE Pgno sqlite3BtreeLastPage(Btree *p){
+ assert( sqlite3BtreeHoldsMutex(p) );
+ return btreePagecount(p->pBt);
+}
+
+/*
+** Get a page from the pager and initialize it.
+*/
+static int getAndInitPage(
+ BtShared *pBt, /* The database file */
+ Pgno pgno, /* Number of the page to get */
+ MemPage **ppPage, /* Write the page pointer here */
+ int bReadOnly /* True for a read-only page */
+){
+ int rc;
+ DbPage *pDbPage;
+ MemPage *pPage;
+ assert( sqlite3_mutex_held(pBt->mutex) );
+
+ if( pgno>btreePagecount(pBt) ){
+ *ppPage = 0;
+ return SQLITE_CORRUPT_BKPT;
+ }
+ rc = sqlite3PagerGet(pBt->pPager, pgno, (DbPage**)&pDbPage, bReadOnly);
+ if( rc ){
+ *ppPage = 0;
+ return rc;
+ }
+ pPage = (MemPage*)sqlite3PagerGetExtra(pDbPage);
+ if( pPage->isInit==0 ){
+ btreePageFromDbPage(pDbPage, pgno, pBt);
+ rc = btreeInitPage(pPage);
+ if( rc!=SQLITE_OK ){
+ releasePage(pPage);
+ *ppPage = 0;
+ return rc;
+ }
+ }
+ assert( pPage->pgno==pgno || CORRUPT_DB );
+ assert( pPage->aData==sqlite3PagerGetData(pDbPage) );
+ *ppPage = pPage;
+ return SQLITE_OK;
+}
+
+/*
+** Release a MemPage. This should be called once for each prior
+** call to btreeGetPage.
+**
+** Page1 is a special case and must be released using releasePageOne().
+*/
+static void releasePageNotNull(MemPage *pPage){
+ assert( pPage->aData );
+ assert( pPage->pBt );
+ assert( pPage->pDbPage!=0 );
+ assert( sqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage );
+ assert( sqlite3PagerGetData(pPage->pDbPage)==pPage->aData );
+ assert( sqlite3_mutex_held(pPage->pBt->mutex) );
+ sqlite3PagerUnrefNotNull(pPage->pDbPage);
+}
+static void releasePage(MemPage *pPage){
+ if( pPage ) releasePageNotNull(pPage);
+}
+static void releasePageOne(MemPage *pPage){
+ assert( pPage!=0 );
+ assert( pPage->aData );
+ assert( pPage->pBt );
+ assert( pPage->pDbPage!=0 );
+ assert( sqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage );
+ assert( sqlite3PagerGetData(pPage->pDbPage)==pPage->aData );
+ assert( sqlite3_mutex_held(pPage->pBt->mutex) );
+ sqlite3PagerUnrefPageOne(pPage->pDbPage);
+}
+
+/*
+** Get an unused page.
+**
+** This works just like btreeGetPage() with the addition:
+**
+** * If the page is already in use for some other purpose, immediately
+** release it and return an SQLITE_CURRUPT error.
+** * Make sure the isInit flag is clear
+*/
+static int btreeGetUnusedPage(
+ BtShared *pBt, /* The btree */
+ Pgno pgno, /* Number of the page to fetch */
+ MemPage **ppPage, /* Return the page in this parameter */
+ int flags /* PAGER_GET_NOCONTENT or PAGER_GET_READONLY */
+){
+ int rc = btreeGetPage(pBt, pgno, ppPage, flags);
+ if( rc==SQLITE_OK ){
+ if( sqlite3PagerPageRefcount((*ppPage)->pDbPage)>1 ){
+ releasePage(*ppPage);
+ *ppPage = 0;
+ return SQLITE_CORRUPT_BKPT;
+ }
+ (*ppPage)->isInit = 0;
+ }else{
+ *ppPage = 0;
+ }
+ return rc;
+}
+
+
+/*
+** During a rollback, when the pager reloads information into the cache
+** so that the cache is restored to its original state at the start of
+** the transaction, for each page restored this routine is called.
+**
+** This routine needs to reset the extra data section at the end of the
+** page to agree with the restored data.
+*/
+static void pageReinit(DbPage *pData){
+ MemPage *pPage;
+ pPage = (MemPage *)sqlite3PagerGetExtra(pData);
+ assert( sqlite3PagerPageRefcount(pData)>0 );
+ if( pPage->isInit ){
+ assert( sqlite3_mutex_held(pPage->pBt->mutex) );
+ pPage->isInit = 0;
+ if( sqlite3PagerPageRefcount(pData)>1 ){
+ /* pPage might not be a btree page; it might be an overflow page
+ ** or ptrmap page or a free page. In those cases, the following
+ ** call to btreeInitPage() will likely return SQLITE_CORRUPT.
+ ** But no harm is done by this. And it is very important that
+ ** btreeInitPage() be called on every btree page so we make
+ ** the call for every page that comes in for re-initializing. */
+ btreeInitPage(pPage);
+ }
+ }
+}
+
+/*
+** Invoke the busy handler for a btree.
+*/
+static int btreeInvokeBusyHandler(void *pArg){
+ BtShared *pBt = (BtShared*)pArg;
+ assert( pBt->db );
+ assert( sqlite3_mutex_held(pBt->db->mutex) );
+ return sqlite3InvokeBusyHandler(&pBt->db->busyHandler);
+}
+
+/*
+** Open a database file.
+**
+** zFilename is the name of the database file. If zFilename is NULL
+** then an ephemeral database is created. The ephemeral database might
+** be exclusively in memory, or it might use a disk-based memory cache.
+** Either way, the ephemeral database will be automatically deleted
+** when sqlite3BtreeClose() is called.
+**
+** If zFilename is ":memory:" then an in-memory database is created
+** that is automatically destroyed when it is closed.
+**
+** The "flags" parameter is a bitmask that might contain bits like
+** BTREE_OMIT_JOURNAL and/or BTREE_MEMORY.
+**
+** If the database is already opened in the same database connection
+** and we are in shared cache mode, then the open will fail with an
+** SQLITE_CONSTRAINT error. We cannot allow two or more BtShared
+** objects in the same database connection since doing so will lead
+** to problems with locking.
+*/
+SQLITE_PRIVATE int sqlite3BtreeOpen(
+ sqlite3_vfs *pVfs, /* VFS to use for this b-tree */
+ const char *zFilename, /* Name of the file containing the BTree database */
+ sqlite3 *db, /* Associated database handle */
+ Btree **ppBtree, /* Pointer to new Btree object written here */
+ int flags, /* Options */
+ int vfsFlags /* Flags passed through to sqlite3_vfs.xOpen() */
+){
+ BtShared *pBt = 0; /* Shared part of btree structure */
+ Btree *p; /* Handle to return */
+ sqlite3_mutex *mutexOpen = 0; /* Prevents a race condition. Ticket #3537 */
+ int rc = SQLITE_OK; /* Result code from this function */
+ u8 nReserve; /* Byte of unused space on each page */
+ unsigned char zDbHeader[100]; /* Database header content */
+
+ /* True if opening an ephemeral, temporary database */
+ const int isTempDb = zFilename==0 || zFilename[0]==0;
+
+ /* Set the variable isMemdb to true for an in-memory database, or
+ ** false for a file-based database.
+ */
+#ifdef SQLITE_OMIT_MEMORYDB
+ const int isMemdb = 0;
+#else
+ const int isMemdb = (zFilename && strcmp(zFilename, ":memory:")==0)
+ || (isTempDb && sqlite3TempInMemory(db))
+ || (vfsFlags & SQLITE_OPEN_MEMORY)!=0;
+#endif
+
+ assert( db!=0 );
+ assert( pVfs!=0 );
+ assert( sqlite3_mutex_held(db->mutex) );
+ assert( (flags&0xff)==flags ); /* flags fit in 8 bits */
+
+ /* Only a BTREE_SINGLE database can be BTREE_UNORDERED */
+ assert( (flags & BTREE_UNORDERED)==0 || (flags & BTREE_SINGLE)!=0 );
+
+ /* A BTREE_SINGLE database is always a temporary and/or ephemeral */
+ assert( (flags & BTREE_SINGLE)==0 || isTempDb );
+
+ if( isMemdb ){
+ flags |= BTREE_MEMORY;
+ }
+ if( (vfsFlags & SQLITE_OPEN_MAIN_DB)!=0 && (isMemdb || isTempDb) ){
+ vfsFlags = (vfsFlags & ~SQLITE_OPEN_MAIN_DB) | SQLITE_OPEN_TEMP_DB;
+ }
+ p = sqlite3MallocZero(sizeof(Btree));
+ if( !p ){
+ return SQLITE_NOMEM_BKPT;
+ }
+ p->inTrans = TRANS_NONE;
+ p->db = db;
+#ifndef SQLITE_OMIT_SHARED_CACHE
+ p->lock.pBtree = p;
+ p->lock.iTable = 1;
+#endif
+
+#if !defined(SQLITE_OMIT_SHARED_CACHE) && !defined(SQLITE_OMIT_DISKIO)
+ /*
+ ** If this Btree is a candidate for shared cache, try to find an
+ ** existing BtShared object that we can share with
+ */
+ if( isTempDb==0 && (isMemdb==0 || (vfsFlags&SQLITE_OPEN_URI)!=0) ){
+ if( vfsFlags & SQLITE_OPEN_SHAREDCACHE ){
+ int nFilename = sqlite3Strlen30(zFilename)+1;
+ int nFullPathname = pVfs->mxPathname+1;
+ char *zFullPathname = sqlite3Malloc(MAX(nFullPathname,nFilename));
+ MUTEX_LOGIC( sqlite3_mutex *mutexShared; )
+
+ p->sharable = 1;
+ if( !zFullPathname ){
+ sqlite3_free(p);
+ return SQLITE_NOMEM_BKPT;
+ }
+ if( isMemdb ){
+ memcpy(zFullPathname, zFilename, nFilename);
+ }else{
+ rc = sqlite3OsFullPathname(pVfs, zFilename,
+ nFullPathname, zFullPathname);
+ if( rc ){
+ if( rc==SQLITE_OK_SYMLINK ){
+ rc = SQLITE_OK;
+ }else{
+ sqlite3_free(zFullPathname);
+ sqlite3_free(p);
+ return rc;
+ }
+ }
+ }
+#if SQLITE_THREADSAFE
+ mutexOpen = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_OPEN);
+ sqlite3_mutex_enter(mutexOpen);
+ mutexShared = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MAIN);
+ sqlite3_mutex_enter(mutexShared);
+#endif
+ for(pBt=GLOBAL(BtShared*,sqlite3SharedCacheList); pBt; pBt=pBt->pNext){
+ assert( pBt->nRef>0 );
+ if( 0==strcmp(zFullPathname, sqlite3PagerFilename(pBt->pPager, 0))
+ && sqlite3PagerVfs(pBt->pPager)==pVfs ){
+ int iDb;
+ for(iDb=db->nDb-1; iDb>=0; iDb--){
+ Btree *pExisting = db->aDb[iDb].pBt;
+ if( pExisting && pExisting->pBt==pBt ){
+ sqlite3_mutex_leave(mutexShared);
+ sqlite3_mutex_leave(mutexOpen);
+ sqlite3_free(zFullPathname);
+ sqlite3_free(p);
+ return SQLITE_CONSTRAINT;
+ }
+ }
+ p->pBt = pBt;
+ pBt->nRef++;
+ break;
+ }
+ }
+ sqlite3_mutex_leave(mutexShared);
+ sqlite3_free(zFullPathname);
+ }
+#ifdef SQLITE_DEBUG
+ else{
+ /* In debug mode, we mark all persistent databases as sharable
+ ** even when they are not. This exercises the locking code and
+ ** gives more opportunity for asserts(sqlite3_mutex_held())
+ ** statements to find locking problems.
+ */
+ p->sharable = 1;
+ }
+#endif
+ }
+#endif
+ if( pBt==0 ){
+ /*
+ ** The following asserts make sure that structures used by the btree are
+ ** the right size. This is to guard against size changes that result
+ ** when compiling on a different architecture.
+ */
+ assert( sizeof(i64)==8 );
+ assert( sizeof(u64)==8 );
+ assert( sizeof(u32)==4 );
+ assert( sizeof(u16)==2 );
+ assert( sizeof(Pgno)==4 );
+
+ /* Suppress false-positive compiler warning from PVS-Studio */
+ memset(&zDbHeader[16], 0, 8);
+
+ pBt = sqlite3MallocZero( sizeof(*pBt) );
+ if( pBt==0 ){
+ rc = SQLITE_NOMEM_BKPT;
+ goto btree_open_out;
+ }
+ rc = sqlite3PagerOpen(pVfs, &pBt->pPager, zFilename,
+ sizeof(MemPage), flags, vfsFlags, pageReinit);
+ if( rc==SQLITE_OK ){
+ sqlite3PagerSetMmapLimit(pBt->pPager, db->szMmap);
+ rc = sqlite3PagerReadFileheader(pBt->pPager,sizeof(zDbHeader),zDbHeader);
+ }
+ if( rc!=SQLITE_OK ){
+ goto btree_open_out;
+ }
+ pBt->openFlags = (u8)flags;
+ pBt->db = db;
+ sqlite3PagerSetBusyHandler(pBt->pPager, btreeInvokeBusyHandler, pBt);
+ p->pBt = pBt;
+
+ pBt->pCursor = 0;
+ pBt->pPage1 = 0;
+ if( sqlite3PagerIsreadonly(pBt->pPager) ) pBt->btsFlags |= BTS_READ_ONLY;
+#if defined(SQLITE_SECURE_DELETE)
+ pBt->btsFlags |= BTS_SECURE_DELETE;
+#elif defined(SQLITE_FAST_SECURE_DELETE)
+ pBt->btsFlags |= BTS_OVERWRITE;
+#endif
+ /* EVIDENCE-OF: R-51873-39618 The page size for a database file is
+ ** determined by the 2-byte integer located at an offset of 16 bytes from
+ ** the beginning of the database file. */
+ pBt->pageSize = (zDbHeader[16]<<8) | (zDbHeader[17]<<16);
+ if( pBt->pageSize<512 || pBt->pageSize>SQLITE_MAX_PAGE_SIZE
+ || ((pBt->pageSize-1)&pBt->pageSize)!=0 ){
+ pBt->pageSize = 0;
+#ifndef SQLITE_OMIT_AUTOVACUUM
+ /* If the magic name ":memory:" will create an in-memory database, then
+ ** leave the autoVacuum mode at 0 (do not auto-vacuum), even if
+ ** SQLITE_DEFAULT_AUTOVACUUM is true. On the other hand, if
+ ** SQLITE_OMIT_MEMORYDB has been defined, then ":memory:" is just a
+ ** regular file-name. In this case the auto-vacuum applies as per normal.
+ */
+ if( zFilename && !isMemdb ){
+ pBt->autoVacuum = (SQLITE_DEFAULT_AUTOVACUUM ? 1 : 0);
+ pBt->incrVacuum = (SQLITE_DEFAULT_AUTOVACUUM==2 ? 1 : 0);
+ }
+#endif
+ nReserve = 0;
+ }else{
+ /* EVIDENCE-OF: R-37497-42412 The size of the reserved region is
+ ** determined by the one-byte unsigned integer found at an offset of 20
+ ** into the database file header. */
+ nReserve = zDbHeader[20];
+ pBt->btsFlags |= BTS_PAGESIZE_FIXED;
+#ifndef SQLITE_OMIT_AUTOVACUUM
+ pBt->autoVacuum = (get4byte(&zDbHeader[36 + 4*4])?1:0);
+ pBt->incrVacuum = (get4byte(&zDbHeader[36 + 7*4])?1:0);
+#endif
+ }
+ rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize, nReserve);
+ if( rc ) goto btree_open_out;
+ pBt->usableSize = pBt->pageSize - nReserve;
+ assert( (pBt->pageSize & 7)==0 ); /* 8-byte alignment of pageSize */
+
+#if !defined(SQLITE_OMIT_SHARED_CACHE) && !defined(SQLITE_OMIT_DISKIO)
+ /* Add the new BtShared object to the linked list sharable BtShareds.
+ */
+ pBt->nRef = 1;
+ if( p->sharable ){
+ MUTEX_LOGIC( sqlite3_mutex *mutexShared; )
+ MUTEX_LOGIC( mutexShared = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MAIN);)
+ if( SQLITE_THREADSAFE && sqlite3GlobalConfig.bCoreMutex ){
+ pBt->mutex = sqlite3MutexAlloc(SQLITE_MUTEX_FAST);
+ if( pBt->mutex==0 ){
+ rc = SQLITE_NOMEM_BKPT;
+ goto btree_open_out;
+ }
+ }
+ sqlite3_mutex_enter(mutexShared);
+ pBt->pNext = GLOBAL(BtShared*,sqlite3SharedCacheList);
+ GLOBAL(BtShared*,sqlite3SharedCacheList) = pBt;
+ sqlite3_mutex_leave(mutexShared);
+ }
+#endif
+ }
+
+#if !defined(SQLITE_OMIT_SHARED_CACHE) && !defined(SQLITE_OMIT_DISKIO)
+ /* If the new Btree uses a sharable pBtShared, then link the new
+ ** Btree into the list of all sharable Btrees for the same connection.
+ ** The list is kept in ascending order by pBt address.
+ */
+ if( p->sharable ){
+ int i;
+ Btree *pSib;
+ for(i=0; i<db->nDb; i++){
+ if( (pSib = db->aDb[i].pBt)!=0 && pSib->sharable ){
+ while( pSib->pPrev ){ pSib = pSib->pPrev; }
+ if( (uptr)p->pBt<(uptr)pSib->pBt ){
+ p->pNext = pSib;
+ p->pPrev = 0;
+ pSib->pPrev = p;
+ }else{
+ while( pSib->pNext && (uptr)pSib->pNext->pBt<(uptr)p->pBt ){
+ pSib = pSib->pNext;
+ }
+ p->pNext = pSib->pNext;
+ p->pPrev = pSib;
+ if( p->pNext ){
+ p->pNext->pPrev = p;
+ }
+ pSib->pNext = p;
+ }
+ break;
+ }
+ }
+ }
+#endif
+ *ppBtree = p;
+
+btree_open_out:
+ if( rc!=SQLITE_OK ){
+ if( pBt && pBt->pPager ){
+ sqlite3PagerClose(pBt->pPager, 0);
+ }
+ sqlite3_free(pBt);
+ sqlite3_free(p);
+ *ppBtree = 0;
+ }else{
+ sqlite3_file *pFile;
+
+ /* If the B-Tree was successfully opened, set the pager-cache size to the
+ ** default value. Except, when opening on an existing shared pager-cache,
+ ** do not change the pager-cache size.
+ */
+ if( sqlite3BtreeSchema(p, 0, 0)==0 ){
+ sqlite3BtreeSetCacheSize(p, SQLITE_DEFAULT_CACHE_SIZE);
+ }
+
+ pFile = sqlite3PagerFile(pBt->pPager);
+ if( pFile->pMethods ){
+ sqlite3OsFileControlHint(pFile, SQLITE_FCNTL_PDB, (void*)&pBt->db);
+ }
+ }
+ if( mutexOpen ){
+ assert( sqlite3_mutex_held(mutexOpen) );
+ sqlite3_mutex_leave(mutexOpen);
+ }
+ assert( rc!=SQLITE_OK || sqlite3BtreeConnectionCount(*ppBtree)>0 );
+ return rc;
+}
+
+/*
+** Decrement the BtShared.nRef counter. When it reaches zero,
+** remove the BtShared structure from the sharing list. Return
+** true if the BtShared.nRef counter reaches zero and return
+** false if it is still positive.
+*/
+static int removeFromSharingList(BtShared *pBt){
+#ifndef SQLITE_OMIT_SHARED_CACHE
+ MUTEX_LOGIC( sqlite3_mutex *pMainMtx; )
+ BtShared *pList;
+ int removed = 0;
+
+ assert( sqlite3_mutex_notheld(pBt->mutex) );
+ MUTEX_LOGIC( pMainMtx = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MAIN); )
+ sqlite3_mutex_enter(pMainMtx);
+ pBt->nRef--;
+ if( pBt->nRef<=0 ){
+ if( GLOBAL(BtShared*,sqlite3SharedCacheList)==pBt ){
+ GLOBAL(BtShared*,sqlite3SharedCacheList) = pBt->pNext;
+ }else{
+ pList = GLOBAL(BtShared*,sqlite3SharedCacheList);
+ while( ALWAYS(pList) && pList->pNext!=pBt ){
+ pList=pList->pNext;
+ }
+ if( ALWAYS(pList) ){
+ pList->pNext = pBt->pNext;
+ }
+ }
+ if( SQLITE_THREADSAFE ){
+ sqlite3_mutex_free(pBt->mutex);
+ }
+ removed = 1;
+ }
+ sqlite3_mutex_leave(pMainMtx);
+ return removed;
+#else
+ return 1;
+#endif
+}
+
+/*
+** Make sure pBt->pTmpSpace points to an allocation of
+** MX_CELL_SIZE(pBt) bytes with a 4-byte prefix for a left-child
+** pointer.
+*/
+static SQLITE_NOINLINE int allocateTempSpace(BtShared *pBt){
+ assert( pBt!=0 );
+ assert( pBt->pTmpSpace==0 );
+ /* This routine is called only by btreeCursor() when allocating the
+ ** first write cursor for the BtShared object */
+ assert( pBt->pCursor!=0 && (pBt->pCursor->curFlags & BTCF_WriteFlag)!=0 );
+ pBt->pTmpSpace = sqlite3PageMalloc( pBt->pageSize );
+ if( pBt->pTmpSpace==0 ){
+ BtCursor *pCur = pBt->pCursor;
+ pBt->pCursor = pCur->pNext; /* Unlink the cursor */
+ memset(pCur, 0, sizeof(*pCur));
+ return SQLITE_NOMEM_BKPT;
+ }
+
+ /* One of the uses of pBt->pTmpSpace is to format cells before
+ ** inserting them into a leaf page (function fillInCell()). If
+ ** a cell is less than 4 bytes in size, it is rounded up to 4 bytes
+ ** by the various routines that manipulate binary cells. Which
+ ** can mean that fillInCell() only initializes the first 2 or 3
+ ** bytes of pTmpSpace, but that the first 4 bytes are copied from
+ ** it into a database page. This is not actually a problem, but it
+ ** does cause a valgrind error when the 1 or 2 bytes of uninitialized
+ ** data is passed to system call write(). So to avoid this error,
+ ** zero the first 4 bytes of temp space here.
+ **
+ ** Also: Provide four bytes of initialized space before the
+ ** beginning of pTmpSpace as an area available to prepend the
+ ** left-child pointer to the beginning of a cell.
+ */
+ memset(pBt->pTmpSpace, 0, 8);
+ pBt->pTmpSpace += 4;
+ return SQLITE_OK;
+}
+
+/*
+** Free the pBt->pTmpSpace allocation
+*/
+static void freeTempSpace(BtShared *pBt){
+ if( pBt->pTmpSpace ){
+ pBt->pTmpSpace -= 4;
+ sqlite3PageFree(pBt->pTmpSpace);
+ pBt->pTmpSpace = 0;
+ }
+}
+
+/*
+** Close an open database and invalidate all cursors.
+*/
+SQLITE_PRIVATE int sqlite3BtreeClose(Btree *p){
+ BtShared *pBt = p->pBt;
+
+ /* Close all cursors opened via this handle. */
+ assert( sqlite3_mutex_held(p->db->mutex) );
+ sqlite3BtreeEnter(p);
+
+ /* Verify that no other cursors have this Btree open */
+#ifdef SQLITE_DEBUG
+ {
+ BtCursor *pCur = pBt->pCursor;
+ while( pCur ){
+ BtCursor *pTmp = pCur;
+ pCur = pCur->pNext;
+ assert( pTmp->pBtree!=p );
+
+ }
+ }
+#endif
+
+ /* Rollback any active transaction and free the handle structure.
+ ** The call to sqlite3BtreeRollback() drops any table-locks held by
+ ** this handle.
+ */
+ sqlite3BtreeRollback(p, SQLITE_OK, 0);
+ sqlite3BtreeLeave(p);
+
+ /* If there are still other outstanding references to the shared-btree
+ ** structure, return now. The remainder of this procedure cleans
+ ** up the shared-btree.
+ */
+ assert( p->wantToLock==0 && p->locked==0 );
+ if( !p->sharable || removeFromSharingList(pBt) ){
+ /* The pBt is no longer on the sharing list, so we can access
+ ** it without having to hold the mutex.
+ **
+ ** Clean out and delete the BtShared object.
+ */
+ assert( !pBt->pCursor );
+ sqlite3PagerClose(pBt->pPager, p->db);
+ if( pBt->xFreeSchema && pBt->pSchema ){
+ pBt->xFreeSchema(pBt->pSchema);
+ }
+ sqlite3DbFree(0, pBt->pSchema);
+ freeTempSpace(pBt);
+ sqlite3_free(pBt);
+ }
+
+#ifndef SQLITE_OMIT_SHARED_CACHE
+ assert( p->wantToLock==0 );
+ assert( p->locked==0 );
+ if( p->pPrev ) p->pPrev->pNext = p->pNext;
+ if( p->pNext ) p->pNext->pPrev = p->pPrev;
+#endif
+
+ sqlite3_free(p);
+ return SQLITE_OK;
+}
+
+/*
+** Change the "soft" limit on the number of pages in the cache.
+** Unused and unmodified pages will be recycled when the number of
+** pages in the cache exceeds this soft limit. But the size of the
+** cache is allowed to grow larger than this limit if it contains
+** dirty pages or pages still in active use.
+*/
+SQLITE_PRIVATE int sqlite3BtreeSetCacheSize(Btree *p, int mxPage){
+ BtShared *pBt = p->pBt;
+ assert( sqlite3_mutex_held(p->db->mutex) );
+ sqlite3BtreeEnter(p);
+ sqlite3PagerSetCachesize(pBt->pPager, mxPage);
+ sqlite3BtreeLeave(p);
+ return SQLITE_OK;
+}
+
+/*
+** Change the "spill" limit on the number of pages in the cache.
+** If the number of pages exceeds this limit during a write transaction,
+** the pager might attempt to "spill" pages to the journal early in
+** order to free up memory.
+**
+** The value returned is the current spill size. If zero is passed
+** as an argument, no changes are made to the spill size setting, so
+** using mxPage of 0 is a way to query the current spill size.
+*/
+SQLITE_PRIVATE int sqlite3BtreeSetSpillSize(Btree *p, int mxPage){
+ BtShared *pBt = p->pBt;
+ int res;
+ assert( sqlite3_mutex_held(p->db->mutex) );
+ sqlite3BtreeEnter(p);
+ res = sqlite3PagerSetSpillsize(pBt->pPager, mxPage);
+ sqlite3BtreeLeave(p);
+ return res;
+}
+
+#if SQLITE_MAX_MMAP_SIZE>0
+/*
+** Change the limit on the amount of the database file that may be
+** memory mapped.
+*/
+SQLITE_PRIVATE int sqlite3BtreeSetMmapLimit(Btree *p, sqlite3_int64 szMmap){
+ BtShared *pBt = p->pBt;
+ assert( sqlite3_mutex_held(p->db->mutex) );
+ sqlite3BtreeEnter(p);
+ sqlite3PagerSetMmapLimit(pBt->pPager, szMmap);
+ sqlite3BtreeLeave(p);
+ return SQLITE_OK;
+}
+#endif /* SQLITE_MAX_MMAP_SIZE>0 */
+
+/*
+** Change the way data is synced to disk in order to increase or decrease
+** how well the database resists damage due to OS crashes and power
+** failures. Level 1 is the same as asynchronous (no syncs() occur and
+** there is a high probability of damage) Level 2 is the default. There
+** is a very low but non-zero probability of damage. Level 3 reduces the
+** probability of damage to near zero but with a write performance reduction.
+*/
+#ifndef SQLITE_OMIT_PAGER_PRAGMAS
+SQLITE_PRIVATE int sqlite3BtreeSetPagerFlags(
+ Btree *p, /* The btree to set the safety level on */
+ unsigned pgFlags /* Various PAGER_* flags */
+){
+ BtShared *pBt = p->pBt;
+ assert( sqlite3_mutex_held(p->db->mutex) );
+ sqlite3BtreeEnter(p);
+ sqlite3PagerSetFlags(pBt->pPager, pgFlags);
+ sqlite3BtreeLeave(p);
+ return SQLITE_OK;
+}
+#endif
+
+/*
+** Change the default pages size and the number of reserved bytes per page.
+** Or, if the page size has already been fixed, return SQLITE_READONLY
+** without changing anything.
+**
+** The page size must be a power of 2 between 512 and 65536. If the page
+** size supplied does not meet this constraint then the page size is not
+** changed.
+**
+** Page sizes are constrained to be a power of two so that the region
+** of the database file used for locking (beginning at PENDING_BYTE,
+** the first byte past the 1GB boundary, 0x40000000) needs to occur
+** at the beginning of a page.
+**
+** If parameter nReserve is less than zero, then the number of reserved
+** bytes per page is left unchanged.
+**
+** If the iFix!=0 then the BTS_PAGESIZE_FIXED flag is set so that the page size
+** and autovacuum mode can no longer be changed.
+*/
+SQLITE_PRIVATE int sqlite3BtreeSetPageSize(Btree *p, int pageSize, int nReserve, int iFix){
+ int rc = SQLITE_OK;
+ int x;
+ BtShared *pBt = p->pBt;
+ assert( nReserve>=0 && nReserve<=255 );
+ sqlite3BtreeEnter(p);
+ pBt->nReserveWanted = nReserve;
+ x = pBt->pageSize - pBt->usableSize;
+ if( nReserve<x ) nReserve = x;
+ if( pBt->btsFlags & BTS_PAGESIZE_FIXED ){
+ sqlite3BtreeLeave(p);
+ return SQLITE_READONLY;
+ }
+ assert( nReserve>=0 && nReserve<=255 );
+ if( pageSize>=512 && pageSize<=SQLITE_MAX_PAGE_SIZE &&
+ ((pageSize-1)&pageSize)==0 ){
+ assert( (pageSize & 7)==0 );
+ assert( !pBt->pCursor );
+ if( nReserve>32 && pageSize==512 ) pageSize = 1024;
+ pBt->pageSize = (u32)pageSize;
+ freeTempSpace(pBt);
+ }
+ rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize, nReserve);
+ pBt->usableSize = pBt->pageSize - (u16)nReserve;
+ if( iFix ) pBt->btsFlags |= BTS_PAGESIZE_FIXED;
+ sqlite3BtreeLeave(p);
+ return rc;
+}
+
+/*
+** Return the currently defined page size
+*/
+SQLITE_PRIVATE int sqlite3BtreeGetPageSize(Btree *p){
+ return p->pBt->pageSize;
+}
+
+/*
+** This function is similar to sqlite3BtreeGetReserve(), except that it
+** may only be called if it is guaranteed that the b-tree mutex is already
+** held.
+**
+** This is useful in one special case in the backup API code where it is
+** known that the shared b-tree mutex is held, but the mutex on the
+** database handle that owns *p is not. In this case if sqlite3BtreeEnter()
+** were to be called, it might collide with some other operation on the
+** database handle that owns *p, causing undefined behavior.
+*/
+SQLITE_PRIVATE int sqlite3BtreeGetReserveNoMutex(Btree *p){
+ int n;
+ assert( sqlite3_mutex_held(p->pBt->mutex) );
+ n = p->pBt->pageSize - p->pBt->usableSize;
+ return n;
+}
+
+/*
+** Return the number of bytes of space at the end of every page that
+** are intentionally left unused. This is the "reserved" space that is
+** sometimes used by extensions.
+**
+** The value returned is the larger of the current reserve size and
+** the latest reserve size requested by SQLITE_FILECTRL_RESERVE_BYTES.
+** The amount of reserve can only grow - never shrink.
+*/
+SQLITE_PRIVATE int sqlite3BtreeGetRequestedReserve(Btree *p){
+ int n1, n2;
+ sqlite3BtreeEnter(p);
+ n1 = (int)p->pBt->nReserveWanted;
+ n2 = sqlite3BtreeGetReserveNoMutex(p);
+ sqlite3BtreeLeave(p);
+ return n1>n2 ? n1 : n2;
+}
+
+
+/*
+** Set the maximum page count for a database if mxPage is positive.
+** No changes are made if mxPage is 0 or negative.
+** Regardless of the value of mxPage, return the maximum page count.
+*/
+SQLITE_PRIVATE Pgno sqlite3BtreeMaxPageCount(Btree *p, Pgno mxPage){
+ Pgno n;
+ sqlite3BtreeEnter(p);
+ n = sqlite3PagerMaxPageCount(p->pBt->pPager, mxPage);
+ sqlite3BtreeLeave(p);
+ return n;
+}
+
+/*
+** Change the values for the BTS_SECURE_DELETE and BTS_OVERWRITE flags:
+**
+** newFlag==0 Both BTS_SECURE_DELETE and BTS_OVERWRITE are cleared
+** newFlag==1 BTS_SECURE_DELETE set and BTS_OVERWRITE is cleared
+** newFlag==2 BTS_SECURE_DELETE cleared and BTS_OVERWRITE is set
+** newFlag==(-1) No changes
+**
+** This routine acts as a query if newFlag is less than zero
+**
+** With BTS_OVERWRITE set, deleted content is overwritten by zeros, but
+** freelist leaf pages are not written back to the database. Thus in-page
+** deleted content is cleared, but freelist deleted content is not.
+**
+** With BTS_SECURE_DELETE, operation is like BTS_OVERWRITE with the addition
+** that freelist leaf pages are written back into the database, increasing
+** the amount of disk I/O.
+*/
+SQLITE_PRIVATE int sqlite3BtreeSecureDelete(Btree *p, int newFlag){
+ int b;
+ if( p==0 ) return 0;
+ sqlite3BtreeEnter(p);
+ assert( BTS_OVERWRITE==BTS_SECURE_DELETE*2 );
+ assert( BTS_FAST_SECURE==(BTS_OVERWRITE|BTS_SECURE_DELETE) );
+ if( newFlag>=0 ){
+ p->pBt->btsFlags &= ~BTS_FAST_SECURE;
+ p->pBt->btsFlags |= BTS_SECURE_DELETE*newFlag;
+ }
+ b = (p->pBt->btsFlags & BTS_FAST_SECURE)/BTS_SECURE_DELETE;
+ sqlite3BtreeLeave(p);
+ return b;
+}
+
+/*
+** Change the 'auto-vacuum' property of the database. If the 'autoVacuum'
+** parameter is non-zero, then auto-vacuum mode is enabled. If zero, it
+** is disabled. The default value for the auto-vacuum property is
+** determined by the SQLITE_DEFAULT_AUTOVACUUM macro.
+*/
+SQLITE_PRIVATE int sqlite3BtreeSetAutoVacuum(Btree *p, int autoVacuum){
+#ifdef SQLITE_OMIT_AUTOVACUUM
+ return SQLITE_READONLY;
+#else
+ BtShared *pBt = p->pBt;
+ int rc = SQLITE_OK;
+ u8 av = (u8)autoVacuum;
+
+ sqlite3BtreeEnter(p);
+ if( (pBt->btsFlags & BTS_PAGESIZE_FIXED)!=0 && (av ?1:0)!=pBt->autoVacuum ){
+ rc = SQLITE_READONLY;
+ }else{
+ pBt->autoVacuum = av ?1:0;
+ pBt->incrVacuum = av==2 ?1:0;
+ }
+ sqlite3BtreeLeave(p);
+ return rc;
+#endif
+}
+
+/*
+** Return the value of the 'auto-vacuum' property. If auto-vacuum is
+** enabled 1 is returned. Otherwise 0.
+*/
+SQLITE_PRIVATE int sqlite3BtreeGetAutoVacuum(Btree *p){
+#ifdef SQLITE_OMIT_AUTOVACUUM
+ return BTREE_AUTOVACUUM_NONE;
+#else
+ int rc;
+ sqlite3BtreeEnter(p);
+ rc = (
+ (!p->pBt->autoVacuum)?BTREE_AUTOVACUUM_NONE:
+ (!p->pBt->incrVacuum)?BTREE_AUTOVACUUM_FULL:
+ BTREE_AUTOVACUUM_INCR
+ );
+ sqlite3BtreeLeave(p);
+ return rc;
+#endif
+}
+
+/*
+** If the user has not set the safety-level for this database connection
+** using "PRAGMA synchronous", and if the safety-level is not already
+** set to the value passed to this function as the second parameter,
+** set it so.
+*/
+#if SQLITE_DEFAULT_SYNCHRONOUS!=SQLITE_DEFAULT_WAL_SYNCHRONOUS \
+ && !defined(SQLITE_OMIT_WAL)
+static void setDefaultSyncFlag(BtShared *pBt, u8 safety_level){
+ sqlite3 *db;
+ Db *pDb;
+ if( (db=pBt->db)!=0 && (pDb=db->aDb)!=0 ){
+ while( pDb->pBt==0 || pDb->pBt->pBt!=pBt ){ pDb++; }
+ if( pDb->bSyncSet==0
+ && pDb->safety_level!=safety_level
+ && pDb!=&db->aDb[1]
+ ){
+ pDb->safety_level = safety_level;
+ sqlite3PagerSetFlags(pBt->pPager,
+ pDb->safety_level | (db->flags & PAGER_FLAGS_MASK));
+ }
+ }
+}
+#else
+# define setDefaultSyncFlag(pBt,safety_level)
+#endif
+
+/* Forward declaration */
+static int newDatabase(BtShared*);
+
+
+/*
+** Get a reference to pPage1 of the database file. This will
+** also acquire a readlock on that file.
+**
+** SQLITE_OK is returned on success. If the file is not a
+** well-formed database file, then SQLITE_CORRUPT is returned.
+** SQLITE_BUSY is returned if the database is locked. SQLITE_NOMEM
+** is returned if we run out of memory.
+*/
+static int lockBtree(BtShared *pBt){
+ int rc; /* Result code from subfunctions */
+ MemPage *pPage1; /* Page 1 of the database file */
+ u32 nPage; /* Number of pages in the database */
+ u32 nPageFile = 0; /* Number of pages in the database file */
+
+ assert( sqlite3_mutex_held(pBt->mutex) );
+ assert( pBt->pPage1==0 );
+ rc = sqlite3PagerSharedLock(pBt->pPager);
+ if( rc!=SQLITE_OK ) return rc;
+ rc = btreeGetPage(pBt, 1, &pPage1, 0);
+ if( rc!=SQLITE_OK ) return rc;
+
+ /* Do some checking to help insure the file we opened really is
+ ** a valid database file.
+ */
+ nPage = get4byte(28+(u8*)pPage1->aData);
+ sqlite3PagerPagecount(pBt->pPager, (int*)&nPageFile);
+ if( nPage==0 || memcmp(24+(u8*)pPage1->aData, 92+(u8*)pPage1->aData,4)!=0 ){
+ nPage = nPageFile;
+ }
+ if( (pBt->db->flags & SQLITE_ResetDatabase)!=0 ){
+ nPage = 0;
+ }
+ if( nPage>0 ){
+ u32 pageSize;
+ u32 usableSize;
+ u8 *page1 = pPage1->aData;
+ rc = SQLITE_NOTADB;
+ /* EVIDENCE-OF: R-43737-39999 Every valid SQLite database file begins
+ ** with the following 16 bytes (in hex): 53 51 4c 69 74 65 20 66 6f 72 6d
+ ** 61 74 20 33 00. */
+ if( memcmp(page1, zMagicHeader, 16)!=0 ){
+ goto page1_init_failed;
+ }
+
+#ifdef SQLITE_OMIT_WAL
+ if( page1[18]>1 ){
+ pBt->btsFlags |= BTS_READ_ONLY;
+ }
+ if( page1[19]>1 ){
+ goto page1_init_failed;
+ }
+#else
+ if( page1[18]>2 ){
+ pBt->btsFlags |= BTS_READ_ONLY;
+ }
+ if( page1[19]>2 ){
+ goto page1_init_failed;
+ }
+
+ /* If the read version is set to 2, this database should be accessed
+ ** in WAL mode. If the log is not already open, open it now. Then
+ ** return SQLITE_OK and return without populating BtShared.pPage1.
+ ** The caller detects this and calls this function again. This is
+ ** required as the version of page 1 currently in the page1 buffer
+ ** may not be the latest version - there may be a newer one in the log
+ ** file.
+ */
+ if( page1[19]==2 && (pBt->btsFlags & BTS_NO_WAL)==0 ){
+ int isOpen = 0;
+ rc = sqlite3PagerOpenWal(pBt->pPager, &isOpen);
+ if( rc!=SQLITE_OK ){
+ goto page1_init_failed;
+ }else{
+ setDefaultSyncFlag(pBt, SQLITE_DEFAULT_WAL_SYNCHRONOUS+1);
+ if( isOpen==0 ){
+ releasePageOne(pPage1);
+ return SQLITE_OK;
+ }
+ }
+ rc = SQLITE_NOTADB;
+ }else{
+ setDefaultSyncFlag(pBt, SQLITE_DEFAULT_SYNCHRONOUS+1);
+ }
+#endif
+
+ /* EVIDENCE-OF: R-15465-20813 The maximum and minimum embedded payload
+ ** fractions and the leaf payload fraction values must be 64, 32, and 32.
+ **
+ ** The original design allowed these amounts to vary, but as of
+ ** version 3.6.0, we require them to be fixed.
+ */
+ if( memcmp(&page1[21], "\100\040\040",3)!=0 ){
+ goto page1_init_failed;
+ }
+ /* EVIDENCE-OF: R-51873-39618 The page size for a database file is
+ ** determined by the 2-byte integer located at an offset of 16 bytes from
+ ** the beginning of the database file. */
+ pageSize = (page1[16]<<8) | (page1[17]<<16);
+ /* EVIDENCE-OF: R-25008-21688 The size of a page is a power of two
+ ** between 512 and 65536 inclusive. */
+ if( ((pageSize-1)&pageSize)!=0
+ || pageSize>SQLITE_MAX_PAGE_SIZE
+ || pageSize<=256
+ ){
+ goto page1_init_failed;
+ }
+ assert( (pageSize & 7)==0 );
+ /* EVIDENCE-OF: R-59310-51205 The "reserved space" size in the 1-byte
+ ** integer at offset 20 is the number of bytes of space at the end of
+ ** each page to reserve for extensions.
+ **
+ ** EVIDENCE-OF: R-37497-42412 The size of the reserved region is
+ ** determined by the one-byte unsigned integer found at an offset of 20
+ ** into the database file header. */
+ usableSize = pageSize - page1[20];
+ if( (u32)pageSize!=pBt->pageSize ){
+ /* After reading the first page of the database assuming a page size
+ ** of BtShared.pageSize, we have discovered that the page-size is
+ ** actually pageSize. Unlock the database, leave pBt->pPage1 at
+ ** zero and return SQLITE_OK. The caller will call this function
+ ** again with the correct page-size.
+ */
+ releasePageOne(pPage1);
+ pBt->usableSize = usableSize;
+ pBt->pageSize = pageSize;
+ pBt->btsFlags |= BTS_PAGESIZE_FIXED;
+ freeTempSpace(pBt);
+ rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize,
+ pageSize-usableSize);
+ return rc;
+ }
+ if( nPage>nPageFile ){
+ if( sqlite3WritableSchema(pBt->db)==0 ){
+ rc = SQLITE_CORRUPT_BKPT;
+ goto page1_init_failed;
+ }else{
+ nPage = nPageFile;
+ }
+ }
+ /* EVIDENCE-OF: R-28312-64704 However, the usable size is not allowed to
+ ** be less than 480. In other words, if the page size is 512, then the
+ ** reserved space size cannot exceed 32. */
+ if( usableSize<480 ){
+ goto page1_init_failed;
+ }
+ pBt->btsFlags |= BTS_PAGESIZE_FIXED;
+ pBt->pageSize = pageSize;
+ pBt->usableSize = usableSize;
+#ifndef SQLITE_OMIT_AUTOVACUUM
+ pBt->autoVacuum = (get4byte(&page1[36 + 4*4])?1:0);
+ pBt->incrVacuum = (get4byte(&page1[36 + 7*4])?1:0);
+#endif
+ }
+
+ /* maxLocal is the maximum amount of payload to store locally for
+ ** a cell. Make sure it is small enough so that at least minFanout
+ ** cells can will fit on one page. We assume a 10-byte page header.
+ ** Besides the payload, the cell must store:
+ ** 2-byte pointer to the cell
+ ** 4-byte child pointer
+ ** 9-byte nKey value
+ ** 4-byte nData value
+ ** 4-byte overflow page pointer
+ ** So a cell consists of a 2-byte pointer, a header which is as much as
+ ** 17 bytes long, 0 to N bytes of payload, and an optional 4 byte overflow
+ ** page pointer.
+ */
+ pBt->maxLocal = (u16)((pBt->usableSize-12)*64/255 - 23);
+ pBt->minLocal = (u16)((pBt->usableSize-12)*32/255 - 23);
+ pBt->maxLeaf = (u16)(pBt->usableSize - 35);
+ pBt->minLeaf = (u16)((pBt->usableSize-12)*32/255 - 23);
+ if( pBt->maxLocal>127 ){
+ pBt->max1bytePayload = 127;
+ }else{
+ pBt->max1bytePayload = (u8)pBt->maxLocal;
+ }
+ assert( pBt->maxLeaf + 23 <= MX_CELL_SIZE(pBt) );
+ pBt->pPage1 = pPage1;
+ pBt->nPage = nPage;
+ return SQLITE_OK;
+
+page1_init_failed:
+ releasePageOne(pPage1);
+ pBt->pPage1 = 0;
+ return rc;
+}
+
+#ifndef NDEBUG
+/*
+** Return the number of cursors open on pBt. This is for use
+** in assert() expressions, so it is only compiled if NDEBUG is not
+** defined.
+**
+** Only write cursors are counted if wrOnly is true. If wrOnly is
+** false then all cursors are counted.
+**
+** For the purposes of this routine, a cursor is any cursor that
+** is capable of reading or writing to the database. Cursors that
+** have been tripped into the CURSOR_FAULT state are not counted.
+*/
+static int countValidCursors(BtShared *pBt, int wrOnly){
+ BtCursor *pCur;
+ int r = 0;
+ for(pCur=pBt->pCursor; pCur; pCur=pCur->pNext){
+ if( (wrOnly==0 || (pCur->curFlags & BTCF_WriteFlag)!=0)
+ && pCur->eState!=CURSOR_FAULT ) r++;
+ }
+ return r;
+}
+#endif
+
+/*
+** If there are no outstanding cursors and we are not in the middle
+** of a transaction but there is a read lock on the database, then
+** this routine unrefs the first page of the database file which
+** has the effect of releasing the read lock.
+**
+** If there is a transaction in progress, this routine is a no-op.
+*/
+static void unlockBtreeIfUnused(BtShared *pBt){
+ assert( sqlite3_mutex_held(pBt->mutex) );
+ assert( countValidCursors(pBt,0)==0 || pBt->inTransaction>TRANS_NONE );
+ if( pBt->inTransaction==TRANS_NONE && pBt->pPage1!=0 ){
+ MemPage *pPage1 = pBt->pPage1;
+ assert( pPage1->aData );
+ assert( sqlite3PagerRefcount(pBt->pPager)==1 );
+ pBt->pPage1 = 0;
+ releasePageOne(pPage1);
+ }
+}
+
+/*
+** If pBt points to an empty file then convert that empty file
+** into a new empty database by initializing the first page of
+** the database.
+*/
+static int newDatabase(BtShared *pBt){
+ MemPage *pP1;
+ unsigned char *data;
+ int rc;
+
+ assert( sqlite3_mutex_held(pBt->mutex) );
+ if( pBt->nPage>0 ){
+ return SQLITE_OK;
+ }
+ pP1 = pBt->pPage1;
+ assert( pP1!=0 );
+ data = pP1->aData;
+ rc = sqlite3PagerWrite(pP1->pDbPage);
+ if( rc ) return rc;
+ memcpy(data, zMagicHeader, sizeof(zMagicHeader));
+ assert( sizeof(zMagicHeader)==16 );
+ data[16] = (u8)((pBt->pageSize>>8)&0xff);
+ data[17] = (u8)((pBt->pageSize>>16)&0xff);
+ data[18] = 1;
+ data[19] = 1;
+ assert( pBt->usableSize<=pBt->pageSize && pBt->usableSize+255>=pBt->pageSize);
+ data[20] = (u8)(pBt->pageSize - pBt->usableSize);
+ data[21] = 64;
+ data[22] = 32;
+ data[23] = 32;
+ memset(&data[24], 0, 100-24);
+ zeroPage(pP1, PTF_INTKEY|PTF_LEAF|PTF_LEAFDATA );
+ pBt->btsFlags |= BTS_PAGESIZE_FIXED;
+#ifndef SQLITE_OMIT_AUTOVACUUM
+ assert( pBt->autoVacuum==1 || pBt->autoVacuum==0 );
+ assert( pBt->incrVacuum==1 || pBt->incrVacuum==0 );
+ put4byte(&data[36 + 4*4], pBt->autoVacuum);
+ put4byte(&data[36 + 7*4], pBt->incrVacuum);
+#endif
+ pBt->nPage = 1;
+ data[31] = 1;
+ return SQLITE_OK;
+}
+
+/*
+** Initialize the first page of the database file (creating a database
+** consisting of a single page and no schema objects). Return SQLITE_OK
+** if successful, or an SQLite error code otherwise.
+*/
+SQLITE_PRIVATE int sqlite3BtreeNewDb(Btree *p){
+ int rc;
+ sqlite3BtreeEnter(p);
+ p->pBt->nPage = 0;
+ rc = newDatabase(p->pBt);
+ sqlite3BtreeLeave(p);
+ return rc;
+}
+
+/*
+** Attempt to start a new transaction. A write-transaction
+** is started if the second argument is nonzero, otherwise a read-
+** transaction. If the second argument is 2 or more and exclusive
+** transaction is started, meaning that no other process is allowed
+** to access the database. A preexisting transaction may not be
+** upgraded to exclusive by calling this routine a second time - the
+** exclusivity flag only works for a new transaction.
+**
+** A write-transaction must be started before attempting any
+** changes to the database. None of the following routines
+** will work unless a transaction is started first:
+**
+** sqlite3BtreeCreateTable()
+** sqlite3BtreeCreateIndex()
+** sqlite3BtreeClearTable()
+** sqlite3BtreeDropTable()
+** sqlite3BtreeInsert()
+** sqlite3BtreeDelete()
+** sqlite3BtreeUpdateMeta()
+**
+** If an initial attempt to acquire the lock fails because of lock contention
+** and the database was previously unlocked, then invoke the busy handler
+** if there is one. But if there was previously a read-lock, do not
+** invoke the busy handler - just return SQLITE_BUSY. SQLITE_BUSY is
+** returned when there is already a read-lock in order to avoid a deadlock.
+**
+** Suppose there are two processes A and B. A has a read lock and B has
+** a reserved lock. B tries to promote to exclusive but is blocked because
+** of A's read lock. A tries to promote to reserved but is blocked by B.
+** One or the other of the two processes must give way or there can be
+** no progress. By returning SQLITE_BUSY and not invoking the busy callback
+** when A already has a read lock, we encourage A to give up and let B
+** proceed.
+*/
+static SQLITE_NOINLINE int btreeBeginTrans(
+ Btree *p, /* The btree in which to start the transaction */
+ int wrflag, /* True to start a write transaction */
+ int *pSchemaVersion /* Put schema version number here, if not NULL */
+){
+ BtShared *pBt = p->pBt;
+ Pager *pPager = pBt->pPager;
+ int rc = SQLITE_OK;
+
+ sqlite3BtreeEnter(p);
+ btreeIntegrity(p);
+
+ /* If the btree is already in a write-transaction, or it
+ ** is already in a read-transaction and a read-transaction
+ ** is requested, this is a no-op.
+ */
+ if( p->inTrans==TRANS_WRITE || (p->inTrans==TRANS_READ && !wrflag) ){
+ goto trans_begun;
+ }
+ assert( pBt->inTransaction==TRANS_WRITE || IfNotOmitAV(pBt->bDoTruncate)==0 );
+
+ if( (p->db->flags & SQLITE_ResetDatabase)
+ && sqlite3PagerIsreadonly(pPager)==0
+ ){
+ pBt->btsFlags &= ~BTS_READ_ONLY;
+ }
+
+ /* Write transactions are not possible on a read-only database */
+ if( (pBt->btsFlags & BTS_READ_ONLY)!=0 && wrflag ){
+ rc = SQLITE_READONLY;
+ goto trans_begun;
+ }
+
+#ifndef SQLITE_OMIT_SHARED_CACHE
+ {
+ sqlite3 *pBlock = 0;
+ /* If another database handle has already opened a write transaction
+ ** on this shared-btree structure and a second write transaction is
+ ** requested, return SQLITE_LOCKED.
+ */
+ if( (wrflag && pBt->inTransaction==TRANS_WRITE)
+ || (pBt->btsFlags & BTS_PENDING)!=0
+ ){
+ pBlock = pBt->pWriter->db;
+ }else if( wrflag>1 ){
+ BtLock *pIter;
+ for(pIter=pBt->pLock; pIter; pIter=pIter->pNext){
+ if( pIter->pBtree!=p ){
+ pBlock = pIter->pBtree->db;
+ break;
+ }
+ }
+ }
+ if( pBlock ){
+ sqlite3ConnectionBlocked(p->db, pBlock);
+ rc = SQLITE_LOCKED_SHAREDCACHE;
+ goto trans_begun;
+ }
+ }
+#endif
+
+ /* Any read-only or read-write transaction implies a read-lock on
+ ** page 1. So if some other shared-cache client already has a write-lock
+ ** on page 1, the transaction cannot be opened. */
+ rc = querySharedCacheTableLock(p, SCHEMA_ROOT, READ_LOCK);
+ if( SQLITE_OK!=rc ) goto trans_begun;
+
+ pBt->btsFlags &= ~BTS_INITIALLY_EMPTY;
+ if( pBt->nPage==0 ) pBt->btsFlags |= BTS_INITIALLY_EMPTY;
+ do {
+ sqlite3PagerWalDb(pPager, p->db);
+
+#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
+ /* If transitioning from no transaction directly to a write transaction,
+ ** block for the WRITER lock first if possible. */
+ if( pBt->pPage1==0 && wrflag ){
+ assert( pBt->inTransaction==TRANS_NONE );
+ rc = sqlite3PagerWalWriteLock(pPager, 1);
+ if( rc!=SQLITE_BUSY && rc!=SQLITE_OK ) break;
+ }
+#endif
+
+ /* Call lockBtree() until either pBt->pPage1 is populated or
+ ** lockBtree() returns something other than SQLITE_OK. lockBtree()
+ ** may return SQLITE_OK but leave pBt->pPage1 set to 0 if after
+ ** reading page 1 it discovers that the page-size of the database
+ ** file is not pBt->pageSize. In this case lockBtree() will update
+ ** pBt->pageSize to the page-size of the file on disk.
+ */
+ while( pBt->pPage1==0 && SQLITE_OK==(rc = lockBtree(pBt)) );
+
+ if( rc==SQLITE_OK && wrflag ){
+ if( (pBt->btsFlags & BTS_READ_ONLY)!=0 ){
+ rc = SQLITE_READONLY;
+ }else{
+ rc = sqlite3PagerBegin(pPager, wrflag>1, sqlite3TempInMemory(p->db));
+ if( rc==SQLITE_OK ){
+ rc = newDatabase(pBt);
+ }else if( rc==SQLITE_BUSY_SNAPSHOT && pBt->inTransaction==TRANS_NONE ){
+ /* if there was no transaction opened when this function was
+ ** called and SQLITE_BUSY_SNAPSHOT is returned, change the error
+ ** code to SQLITE_BUSY. */
+ rc = SQLITE_BUSY;
+ }
+ }
+ }
+
+ if( rc!=SQLITE_OK ){
+ (void)sqlite3PagerWalWriteLock(pPager, 0);
+ unlockBtreeIfUnused(pBt);
+ }
+ }while( (rc&0xFF)==SQLITE_BUSY && pBt->inTransaction==TRANS_NONE &&
+ btreeInvokeBusyHandler(pBt) );
+ sqlite3PagerWalDb(pPager, 0);
+#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
+ if( rc==SQLITE_BUSY_TIMEOUT ) rc = SQLITE_BUSY;
+#endif
+
+ if( rc==SQLITE_OK ){
+ if( p->inTrans==TRANS_NONE ){
+ pBt->nTransaction++;
+#ifndef SQLITE_OMIT_SHARED_CACHE
+ if( p->sharable ){
+ assert( p->lock.pBtree==p && p->lock.iTable==1 );
+ p->lock.eLock = READ_LOCK;
+ p->lock.pNext = pBt->pLock;
+ pBt->pLock = &p->lock;
+ }
+#endif
+ }
+ p->inTrans = (wrflag?TRANS_WRITE:TRANS_READ);
+ if( p->inTrans>pBt->inTransaction ){
+ pBt->inTransaction = p->inTrans;
+ }
+ if( wrflag ){
+ MemPage *pPage1 = pBt->pPage1;
+#ifndef SQLITE_OMIT_SHARED_CACHE
+ assert( !pBt->pWriter );
+ pBt->pWriter = p;
+ pBt->btsFlags &= ~BTS_EXCLUSIVE;
+ if( wrflag>1 ) pBt->btsFlags |= BTS_EXCLUSIVE;
+#endif
+
+ /* If the db-size header field is incorrect (as it may be if an old
+ ** client has been writing the database file), update it now. Doing
+ ** this sooner rather than later means the database size can safely
+ ** re-read the database size from page 1 if a savepoint or transaction
+ ** rollback occurs within the transaction.
+ */
+ if( pBt->nPage!=get4byte(&pPage1->aData[28]) ){
+ rc = sqlite3PagerWrite(pPage1->pDbPage);
+ if( rc==SQLITE_OK ){
+ put4byte(&pPage1->aData[28], pBt->nPage);
+ }
+ }
+ }
+ }
+
+trans_begun:
+ if( rc==SQLITE_OK ){
+ if( pSchemaVersion ){
+ *pSchemaVersion = get4byte(&pBt->pPage1->aData[40]);
+ }
+ if( wrflag ){
+ /* This call makes sure that the pager has the correct number of
+ ** open savepoints. If the second parameter is greater than 0 and
+ ** the sub-journal is not already open, then it will be opened here.
+ */
+ rc = sqlite3PagerOpenSavepoint(pPager, p->db->nSavepoint);
+ }
+ }
+
+ btreeIntegrity(p);
+ sqlite3BtreeLeave(p);
+ return rc;
+}
+SQLITE_PRIVATE int sqlite3BtreeBeginTrans(Btree *p, int wrflag, int *pSchemaVersion){
+ BtShared *pBt;
+ if( p->sharable
+ || p->inTrans==TRANS_NONE
+ || (p->inTrans==TRANS_READ && wrflag!=0)
+ ){
+ return btreeBeginTrans(p,wrflag,pSchemaVersion);
+ }
+ pBt = p->pBt;
+ if( pSchemaVersion ){
+ *pSchemaVersion = get4byte(&pBt->pPage1->aData[40]);
+ }
+ if( wrflag ){
+ /* This call makes sure that the pager has the correct number of
+ ** open savepoints. If the second parameter is greater than 0 and
+ ** the sub-journal is not already open, then it will be opened here.
+ */
+ return sqlite3PagerOpenSavepoint(pBt->pPager, p->db->nSavepoint);
+ }else{
+ return SQLITE_OK;
+ }
+}
+
+#ifndef SQLITE_OMIT_AUTOVACUUM
+
+/*
+** Set the pointer-map entries for all children of page pPage. Also, if
+** pPage contains cells that point to overflow pages, set the pointer
+** map entries for the overflow pages as well.
+*/
+static int setChildPtrmaps(MemPage *pPage){
+ int i; /* Counter variable */
+ int nCell; /* Number of cells in page pPage */
+ int rc; /* Return code */
+ BtShared *pBt = pPage->pBt;
+ Pgno pgno = pPage->pgno;
+
+ assert( sqlite3_mutex_held(pPage->pBt->mutex) );
+ rc = pPage->isInit ? SQLITE_OK : btreeInitPage(pPage);
+ if( rc!=SQLITE_OK ) return rc;
+ nCell = pPage->nCell;
+
+ for(i=0; i<nCell; i++){
+ u8 *pCell = findCell(pPage, i);
+
+ ptrmapPutOvflPtr(pPage, pPage, pCell, &rc);
+
+ if( !pPage->leaf ){
+ Pgno childPgno = get4byte(pCell);
+ ptrmapPut(pBt, childPgno, PTRMAP_BTREE, pgno, &rc);
+ }
+ }
+
+ if( !pPage->leaf ){
+ Pgno childPgno = get4byte(&pPage->aData[pPage->hdrOffset+8]);
+ ptrmapPut(pBt, childPgno, PTRMAP_BTREE, pgno, &rc);
+ }
+
+ return rc;
+}
+
+/*
+** Somewhere on pPage is a pointer to page iFrom. Modify this pointer so
+** that it points to iTo. Parameter eType describes the type of pointer to
+** be modified, as follows:
+**
+** PTRMAP_BTREE: pPage is a btree-page. The pointer points at a child
+** page of pPage.
+**
+** PTRMAP_OVERFLOW1: pPage is a btree-page. The pointer points at an overflow
+** page pointed to by one of the cells on pPage.
+**
+** PTRMAP_OVERFLOW2: pPage is an overflow-page. The pointer points at the next
+** overflow page in the list.
+*/
+static int modifyPagePointer(MemPage *pPage, Pgno iFrom, Pgno iTo, u8 eType){
+ assert( sqlite3_mutex_held(pPage->pBt->mutex) );
+ assert( sqlite3PagerIswriteable(pPage->pDbPage) );
+ if( eType==PTRMAP_OVERFLOW2 ){
+ /* The pointer is always the first 4 bytes of the page in this case. */
+ if( get4byte(pPage->aData)!=iFrom ){
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ put4byte(pPage->aData, iTo);
+ }else{
+ int i;
+ int nCell;
+ int rc;
+
+ rc = pPage->isInit ? SQLITE_OK : btreeInitPage(pPage);
+ if( rc ) return rc;
+ nCell = pPage->nCell;
+
+ for(i=0; i<nCell; i++){
+ u8 *pCell = findCell(pPage, i);
+ if( eType==PTRMAP_OVERFLOW1 ){
+ CellInfo info;
+ pPage->xParseCell(pPage, pCell, &info);
+ if( info.nLocal<info.nPayload ){
+ if( pCell+info.nSize > pPage->aData+pPage->pBt->usableSize ){
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ if( iFrom==get4byte(pCell+info.nSize-4) ){
+ put4byte(pCell+info.nSize-4, iTo);
+ break;
+ }
+ }
+ }else{
+ if( pCell+4 > pPage->aData+pPage->pBt->usableSize ){
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ if( get4byte(pCell)==iFrom ){
+ put4byte(pCell, iTo);
+ break;
+ }
+ }
+ }
+
+ if( i==nCell ){
+ if( eType!=PTRMAP_BTREE ||
+ get4byte(&pPage->aData[pPage->hdrOffset+8])!=iFrom ){
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ put4byte(&pPage->aData[pPage->hdrOffset+8], iTo);
+ }
+ }
+ return SQLITE_OK;
+}
+
+
+/*
+** Move the open database page pDbPage to location iFreePage in the
+** database. The pDbPage reference remains valid.
+**
+** The isCommit flag indicates that there is no need to remember that
+** the journal needs to be sync()ed before database page pDbPage->pgno
+** can be written to. The caller has already promised not to write to that
+** page.
+*/
+static int relocatePage(
+ BtShared *pBt, /* Btree */
+ MemPage *pDbPage, /* Open page to move */
+ u8 eType, /* Pointer map 'type' entry for pDbPage */
+ Pgno iPtrPage, /* Pointer map 'page-no' entry for pDbPage */
+ Pgno iFreePage, /* The location to move pDbPage to */
+ int isCommit /* isCommit flag passed to sqlite3PagerMovepage */
+){
+ MemPage *pPtrPage; /* The page that contains a pointer to pDbPage */
+ Pgno iDbPage = pDbPage->pgno;
+ Pager *pPager = pBt->pPager;
+ int rc;
+
+ assert( eType==PTRMAP_OVERFLOW2 || eType==PTRMAP_OVERFLOW1 ||
+ eType==PTRMAP_BTREE || eType==PTRMAP_ROOTPAGE );
+ assert( sqlite3_mutex_held(pBt->mutex) );
+ assert( pDbPage->pBt==pBt );
+ if( iDbPage<3 ) return SQLITE_CORRUPT_BKPT;
+
+ /* Move page iDbPage from its current location to page number iFreePage */
+ TRACE(("AUTOVACUUM: Moving %u to free page %u (ptr page %u type %u)\n",
+ iDbPage, iFreePage, iPtrPage, eType));
+ rc = sqlite3PagerMovepage(pPager, pDbPage->pDbPage, iFreePage, isCommit);
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+ pDbPage->pgno = iFreePage;
+
+ /* If pDbPage was a btree-page, then it may have child pages and/or cells
+ ** that point to overflow pages. The pointer map entries for all these
+ ** pages need to be changed.
+ **
+ ** If pDbPage is an overflow page, then the first 4 bytes may store a
+ ** pointer to a subsequent overflow page. If this is the case, then
+ ** the pointer map needs to be updated for the subsequent overflow page.
+ */
+ if( eType==PTRMAP_BTREE || eType==PTRMAP_ROOTPAGE ){
+ rc = setChildPtrmaps(pDbPage);
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+ }else{
+ Pgno nextOvfl = get4byte(pDbPage->aData);
+ if( nextOvfl!=0 ){
+ ptrmapPut(pBt, nextOvfl, PTRMAP_OVERFLOW2, iFreePage, &rc);
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+ }
+ }
+
+ /* Fix the database pointer on page iPtrPage that pointed at iDbPage so
+ ** that it points at iFreePage. Also fix the pointer map entry for
+ ** iPtrPage.
+ */
+ if( eType!=PTRMAP_ROOTPAGE ){
+ rc = btreeGetPage(pBt, iPtrPage, &pPtrPage, 0);
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+ rc = sqlite3PagerWrite(pPtrPage->pDbPage);
+ if( rc!=SQLITE_OK ){
+ releasePage(pPtrPage);
+ return rc;
+ }
+ rc = modifyPagePointer(pPtrPage, iDbPage, iFreePage, eType);
+ releasePage(pPtrPage);
+ if( rc==SQLITE_OK ){
+ ptrmapPut(pBt, iFreePage, eType, iPtrPage, &rc);
+ }
+ }
+ return rc;
+}
+
+/* Forward declaration required by incrVacuumStep(). */
+static int allocateBtreePage(BtShared *, MemPage **, Pgno *, Pgno, u8);
+
+/*
+** Perform a single step of an incremental-vacuum. If successful, return
+** SQLITE_OK. If there is no work to do (and therefore no point in
+** calling this function again), return SQLITE_DONE. Or, if an error
+** occurs, return some other error code.
+**
+** More specifically, this function attempts to re-organize the database so
+** that the last page of the file currently in use is no longer in use.
+**
+** Parameter nFin is the number of pages that this database would contain
+** were this function called until it returns SQLITE_DONE.
+**
+** If the bCommit parameter is non-zero, this function assumes that the
+** caller will keep calling incrVacuumStep() until it returns SQLITE_DONE
+** or an error. bCommit is passed true for an auto-vacuum-on-commit
+** operation, or false for an incremental vacuum.
+*/
+static int incrVacuumStep(BtShared *pBt, Pgno nFin, Pgno iLastPg, int bCommit){
+ Pgno nFreeList; /* Number of pages still on the free-list */
+ int rc;
+
+ assert( sqlite3_mutex_held(pBt->mutex) );
+ assert( iLastPg>nFin );
+
+ if( !PTRMAP_ISPAGE(pBt, iLastPg) && iLastPg!=PENDING_BYTE_PAGE(pBt) ){
+ u8 eType;
+ Pgno iPtrPage;
+
+ nFreeList = get4byte(&pBt->pPage1->aData[36]);
+ if( nFreeList==0 ){
+ return SQLITE_DONE;
+ }
+
+ rc = ptrmapGet(pBt, iLastPg, &eType, &iPtrPage);
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+ if( eType==PTRMAP_ROOTPAGE ){
+ return SQLITE_CORRUPT_BKPT;
+ }
+
+ if( eType==PTRMAP_FREEPAGE ){
+ if( bCommit==0 ){
+ /* Remove the page from the files free-list. This is not required
+ ** if bCommit is non-zero. In that case, the free-list will be
+ ** truncated to zero after this function returns, so it doesn't
+ ** matter if it still contains some garbage entries.
+ */
+ Pgno iFreePg;
+ MemPage *pFreePg;
+ rc = allocateBtreePage(pBt, &pFreePg, &iFreePg, iLastPg, BTALLOC_EXACT);
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+ assert( iFreePg==iLastPg );
+ releasePage(pFreePg);
+ }
+ } else {
+ Pgno iFreePg; /* Index of free page to move pLastPg to */
+ MemPage *pLastPg;
+ u8 eMode = BTALLOC_ANY; /* Mode parameter for allocateBtreePage() */
+ Pgno iNear = 0; /* nearby parameter for allocateBtreePage() */
+
+ rc = btreeGetPage(pBt, iLastPg, &pLastPg, 0);
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+
+ /* If bCommit is zero, this loop runs exactly once and page pLastPg
+ ** is swapped with the first free page pulled off the free list.
+ **
+ ** On the other hand, if bCommit is greater than zero, then keep
+ ** looping until a free-page located within the first nFin pages
+ ** of the file is found.
+ */
+ if( bCommit==0 ){
+ eMode = BTALLOC_LE;
+ iNear = nFin;
+ }
+ do {
+ MemPage *pFreePg;
+ Pgno dbSize = btreePagecount(pBt);
+ rc = allocateBtreePage(pBt, &pFreePg, &iFreePg, iNear, eMode);
+ if( rc!=SQLITE_OK ){
+ releasePage(pLastPg);
+ return rc;
+ }
+ releasePage(pFreePg);
+ if( iFreePg>dbSize ){
+ releasePage(pLastPg);
+ return SQLITE_CORRUPT_BKPT;
+ }
+ }while( bCommit && iFreePg>nFin );
+ assert( iFreePg<iLastPg );
+
+ rc = relocatePage(pBt, pLastPg, eType, iPtrPage, iFreePg, bCommit);
+ releasePage(pLastPg);
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+ }
+ }
+
+ if( bCommit==0 ){
+ do {
+ iLastPg--;
+ }while( iLastPg==PENDING_BYTE_PAGE(pBt) || PTRMAP_ISPAGE(pBt, iLastPg) );
+ pBt->bDoTruncate = 1;
+ pBt->nPage = iLastPg;
+ }
+ return SQLITE_OK;
+}
+
+/*
+** The database opened by the first argument is an auto-vacuum database
+** nOrig pages in size containing nFree free pages. Return the expected
+** size of the database in pages following an auto-vacuum operation.
+*/
+static Pgno finalDbSize(BtShared *pBt, Pgno nOrig, Pgno nFree){
+ int nEntry; /* Number of entries on one ptrmap page */
+ Pgno nPtrmap; /* Number of PtrMap pages to be freed */
+ Pgno nFin; /* Return value */
+
+ nEntry = pBt->usableSize/5;
+ nPtrmap = (nFree-nOrig+PTRMAP_PAGENO(pBt, nOrig)+nEntry)/nEntry;
+ nFin = nOrig - nFree - nPtrmap;
+ if( nOrig>PENDING_BYTE_PAGE(pBt) && nFin<PENDING_BYTE_PAGE(pBt) ){
+ nFin--;
+ }
+ while( PTRMAP_ISPAGE(pBt, nFin) || nFin==PENDING_BYTE_PAGE(pBt) ){
+ nFin--;
+ }
+
+ return nFin;
+}
+
+/*
+** A write-transaction must be opened before calling this function.
+** It performs a single unit of work towards an incremental vacuum.
+**
+** If the incremental vacuum is finished after this function has run,
+** SQLITE_DONE is returned. If it is not finished, but no error occurred,
+** SQLITE_OK is returned. Otherwise an SQLite error code.
+*/
+SQLITE_PRIVATE int sqlite3BtreeIncrVacuum(Btree *p){
+ int rc;
+ BtShared *pBt = p->pBt;
+
+ sqlite3BtreeEnter(p);
+ assert( pBt->inTransaction==TRANS_WRITE && p->inTrans==TRANS_WRITE );
+ if( !pBt->autoVacuum ){
+ rc = SQLITE_DONE;
+ }else{
+ Pgno nOrig = btreePagecount(pBt);
+ Pgno nFree = get4byte(&pBt->pPage1->aData[36]);
+ Pgno nFin = finalDbSize(pBt, nOrig, nFree);
+
+ if( nOrig<nFin || nFree>=nOrig ){
+ rc = SQLITE_CORRUPT_BKPT;
+ }else if( nFree>0 ){
+ rc = saveAllCursors(pBt, 0, 0);
+ if( rc==SQLITE_OK ){
+ invalidateAllOverflowCache(pBt);
+ rc = incrVacuumStep(pBt, nFin, nOrig, 0);
+ }
+ if( rc==SQLITE_OK ){
+ rc = sqlite3PagerWrite(pBt->pPage1->pDbPage);
+ put4byte(&pBt->pPage1->aData[28], pBt->nPage);
+ }
+ }else{
+ rc = SQLITE_DONE;
+ }
+ }
+ sqlite3BtreeLeave(p);
+ return rc;
+}
+
+/*
+** This routine is called prior to sqlite3PagerCommit when a transaction
+** is committed for an auto-vacuum database.
+*/
+static int autoVacuumCommit(Btree *p){
+ int rc = SQLITE_OK;
+ Pager *pPager;
+ BtShared *pBt;
+ sqlite3 *db;
+ VVA_ONLY( int nRef );
+
+ assert( p!=0 );
+ pBt = p->pBt;
+ pPager = pBt->pPager;
+ VVA_ONLY( nRef = sqlite3PagerRefcount(pPager); )
+
+ assert( sqlite3_mutex_held(pBt->mutex) );
+ invalidateAllOverflowCache(pBt);
+ assert(pBt->autoVacuum);
+ if( !pBt->incrVacuum ){
+ Pgno nFin; /* Number of pages in database after autovacuuming */
+ Pgno nFree; /* Number of pages on the freelist initially */
+ Pgno nVac; /* Number of pages to vacuum */
+ Pgno iFree; /* The next page to be freed */
+ Pgno nOrig; /* Database size before freeing */
+
+ nOrig = btreePagecount(pBt);
+ if( PTRMAP_ISPAGE(pBt, nOrig) || nOrig==PENDING_BYTE_PAGE(pBt) ){
+ /* It is not possible to create a database for which the final page
+ ** is either a pointer-map page or the pending-byte page. If one
+ ** is encountered, this indicates corruption.
+ */
+ return SQLITE_CORRUPT_BKPT;
+ }
+
+ nFree = get4byte(&pBt->pPage1->aData[36]);
+ db = p->db;
+ if( db->xAutovacPages ){
+ int iDb;
+ for(iDb=0; ALWAYS(iDb<db->nDb); iDb++){
+ if( db->aDb[iDb].pBt==p ) break;
+ }
+ nVac = db->xAutovacPages(
+ db->pAutovacPagesArg,
+ db->aDb[iDb].zDbSName,
+ nOrig,
+ nFree,
+ pBt->pageSize
+ );
+ if( nVac>nFree ){
+ nVac = nFree;
+ }
+ if( nVac==0 ){
+ return SQLITE_OK;
+ }
+ }else{
+ nVac = nFree;
+ }
+ nFin = finalDbSize(pBt, nOrig, nVac);
+ if( nFin>nOrig ) return SQLITE_CORRUPT_BKPT;
+ if( nFin<nOrig ){
+ rc = saveAllCursors(pBt, 0, 0);
+ }
+ for(iFree=nOrig; iFree>nFin && rc==SQLITE_OK; iFree--){
+ rc = incrVacuumStep(pBt, nFin, iFree, nVac==nFree);
+ }
+ if( (rc==SQLITE_DONE || rc==SQLITE_OK) && nFree>0 ){
+ rc = sqlite3PagerWrite(pBt->pPage1->pDbPage);
+ if( nVac==nFree ){
+ put4byte(&pBt->pPage1->aData[32], 0);
+ put4byte(&pBt->pPage1->aData[36], 0);
+ }
+ put4byte(&pBt->pPage1->aData[28], nFin);
+ pBt->bDoTruncate = 1;
+ pBt->nPage = nFin;
+ }
+ if( rc!=SQLITE_OK ){
+ sqlite3PagerRollback(pPager);
+ }
+ }
+
+ assert( nRef>=sqlite3PagerRefcount(pPager) );
+ return rc;
+}
+
+#else /* ifndef SQLITE_OMIT_AUTOVACUUM */
+# define setChildPtrmaps(x) SQLITE_OK
+#endif
+
+/*
+** This routine does the first phase of a two-phase commit. This routine
+** causes a rollback journal to be created (if it does not already exist)
+** and populated with enough information so that if a power loss occurs
+** the database can be restored to its original state by playing back
+** the journal. Then the contents of the journal are flushed out to
+** the disk. After the journal is safely on oxide, the changes to the
+** database are written into the database file and flushed to oxide.
+** At the end of this call, the rollback journal still exists on the
+** disk and we are still holding all locks, so the transaction has not
+** committed. See sqlite3BtreeCommitPhaseTwo() for the second phase of the
+** commit process.
+**
+** This call is a no-op if no write-transaction is currently active on pBt.
+**
+** Otherwise, sync the database file for the btree pBt. zSuperJrnl points to
+** the name of a super-journal file that should be written into the
+** individual journal file, or is NULL, indicating no super-journal file
+** (single database transaction).
+**
+** When this is called, the super-journal should already have been
+** created, populated with this journal pointer and synced to disk.
+**
+** Once this is routine has returned, the only thing required to commit
+** the write-transaction for this database file is to delete the journal.
+*/
+SQLITE_PRIVATE int sqlite3BtreeCommitPhaseOne(Btree *p, const char *zSuperJrnl){
+ int rc = SQLITE_OK;
+ if( p->inTrans==TRANS_WRITE ){
+ BtShared *pBt = p->pBt;
+ sqlite3BtreeEnter(p);
+#ifndef SQLITE_OMIT_AUTOVACUUM
+ if( pBt->autoVacuum ){
+ rc = autoVacuumCommit(p);
+ if( rc!=SQLITE_OK ){
+ sqlite3BtreeLeave(p);
+ return rc;
+ }
+ }
+ if( pBt->bDoTruncate ){
+ sqlite3PagerTruncateImage(pBt->pPager, pBt->nPage);
+ }
+#endif
+ rc = sqlite3PagerCommitPhaseOne(pBt->pPager, zSuperJrnl, 0);
+ sqlite3BtreeLeave(p);
+ }
+ return rc;
+}
+
+/*
+** This function is called from both BtreeCommitPhaseTwo() and BtreeRollback()
+** at the conclusion of a transaction.
+*/
+static void btreeEndTransaction(Btree *p){
+ BtShared *pBt = p->pBt;
+ sqlite3 *db = p->db;
+ assert( sqlite3BtreeHoldsMutex(p) );
+
+#ifndef SQLITE_OMIT_AUTOVACUUM
+ pBt->bDoTruncate = 0;
+#endif
+ if( p->inTrans>TRANS_NONE && db->nVdbeRead>1 ){
+ /* If there are other active statements that belong to this database
+ ** handle, downgrade to a read-only transaction. The other statements
+ ** may still be reading from the database. */
+ downgradeAllSharedCacheTableLocks(p);
+ p->inTrans = TRANS_READ;
+ }else{
+ /* If the handle had any kind of transaction open, decrement the
+ ** transaction count of the shared btree. If the transaction count
+ ** reaches 0, set the shared state to TRANS_NONE. The unlockBtreeIfUnused()
+ ** call below will unlock the pager. */
+ if( p->inTrans!=TRANS_NONE ){
+ clearAllSharedCacheTableLocks(p);
+ pBt->nTransaction--;
+ if( 0==pBt->nTransaction ){
+ pBt->inTransaction = TRANS_NONE;
+ }
+ }
+
+ /* Set the current transaction state to TRANS_NONE and unlock the
+ ** pager if this call closed the only read or write transaction. */
+ p->inTrans = TRANS_NONE;
+ unlockBtreeIfUnused(pBt);
+ }
+
+ btreeIntegrity(p);
+}
+
+/*
+** Commit the transaction currently in progress.
+**
+** This routine implements the second phase of a 2-phase commit. The
+** sqlite3BtreeCommitPhaseOne() routine does the first phase and should
+** be invoked prior to calling this routine. The sqlite3BtreeCommitPhaseOne()
+** routine did all the work of writing information out to disk and flushing the
+** contents so that they are written onto the disk platter. All this
+** routine has to do is delete or truncate or zero the header in the
+** the rollback journal (which causes the transaction to commit) and
+** drop locks.
+**
+** Normally, if an error occurs while the pager layer is attempting to
+** finalize the underlying journal file, this function returns an error and
+** the upper layer will attempt a rollback. However, if the second argument
+** is non-zero then this b-tree transaction is part of a multi-file
+** transaction. In this case, the transaction has already been committed
+** (by deleting a super-journal file) and the caller will ignore this
+** functions return code. So, even if an error occurs in the pager layer,
+** reset the b-tree objects internal state to indicate that the write
+** transaction has been closed. This is quite safe, as the pager will have
+** transitioned to the error state.
+**
+** This will release the write lock on the database file. If there
+** are no active cursors, it also releases the read lock.
+*/
+SQLITE_PRIVATE int sqlite3BtreeCommitPhaseTwo(Btree *p, int bCleanup){
+
+ if( p->inTrans==TRANS_NONE ) return SQLITE_OK;
+ sqlite3BtreeEnter(p);
+ btreeIntegrity(p);
+
+ /* If the handle has a write-transaction open, commit the shared-btrees
+ ** transaction and set the shared state to TRANS_READ.
+ */
+ if( p->inTrans==TRANS_WRITE ){
+ int rc;
+ BtShared *pBt = p->pBt;
+ assert( pBt->inTransaction==TRANS_WRITE );
+ assert( pBt->nTransaction>0 );
+ rc = sqlite3PagerCommitPhaseTwo(pBt->pPager);
+ if( rc!=SQLITE_OK && bCleanup==0 ){
+ sqlite3BtreeLeave(p);
+ return rc;
+ }
+ p->iBDataVersion--; /* Compensate for pPager->iDataVersion++; */
+ pBt->inTransaction = TRANS_READ;
+ btreeClearHasContent(pBt);
+ }
+
+ btreeEndTransaction(p);
+ sqlite3BtreeLeave(p);
+ return SQLITE_OK;
+}
+
+/*
+** Do both phases of a commit.
+*/
+SQLITE_PRIVATE int sqlite3BtreeCommit(Btree *p){
+ int rc;
+ sqlite3BtreeEnter(p);
+ rc = sqlite3BtreeCommitPhaseOne(p, 0);
+ if( rc==SQLITE_OK ){
+ rc = sqlite3BtreeCommitPhaseTwo(p, 0);
+ }
+ sqlite3BtreeLeave(p);
+ return rc;
+}
+
+/*
+** This routine sets the state to CURSOR_FAULT and the error
+** code to errCode for every cursor on any BtShared that pBtree
+** references. Or if the writeOnly flag is set to 1, then only
+** trip write cursors and leave read cursors unchanged.
+**
+** Every cursor is a candidate to be tripped, including cursors
+** that belong to other database connections that happen to be
+** sharing the cache with pBtree.
+**
+** This routine gets called when a rollback occurs. If the writeOnly
+** flag is true, then only write-cursors need be tripped - read-only
+** cursors save their current positions so that they may continue
+** following the rollback. Or, if writeOnly is false, all cursors are
+** tripped. In general, writeOnly is false if the transaction being
+** rolled back modified the database schema. In this case b-tree root
+** pages may be moved or deleted from the database altogether, making
+** it unsafe for read cursors to continue.
+**
+** If the writeOnly flag is true and an error is encountered while
+** saving the current position of a read-only cursor, all cursors,
+** including all read-cursors are tripped.
+**
+** SQLITE_OK is returned if successful, or if an error occurs while
+** saving a cursor position, an SQLite error code.
+*/
+SQLITE_PRIVATE int sqlite3BtreeTripAllCursors(Btree *pBtree, int errCode, int writeOnly){
+ BtCursor *p;
+ int rc = SQLITE_OK;
+
+ assert( (writeOnly==0 || writeOnly==1) && BTCF_WriteFlag==1 );
+ if( pBtree ){
+ sqlite3BtreeEnter(pBtree);
+ for(p=pBtree->pBt->pCursor; p; p=p->pNext){
+ if( writeOnly && (p->curFlags & BTCF_WriteFlag)==0 ){
+ if( p->eState==CURSOR_VALID || p->eState==CURSOR_SKIPNEXT ){
+ rc = saveCursorPosition(p);
+ if( rc!=SQLITE_OK ){
+ (void)sqlite3BtreeTripAllCursors(pBtree, rc, 0);
+ break;
+ }
+ }
+ }else{
+ sqlite3BtreeClearCursor(p);
+ p->eState = CURSOR_FAULT;
+ p->skipNext = errCode;
+ }
+ btreeReleaseAllCursorPages(p);
+ }
+ sqlite3BtreeLeave(pBtree);
+ }
+ return rc;
+}
+
+/*
+** Set the pBt->nPage field correctly, according to the current
+** state of the database. Assume pBt->pPage1 is valid.
+*/
+static void btreeSetNPage(BtShared *pBt, MemPage *pPage1){
+ int nPage = get4byte(&pPage1->aData[28]);
+ testcase( nPage==0 );
+ if( nPage==0 ) sqlite3PagerPagecount(pBt->pPager, &nPage);
+ testcase( pBt->nPage!=(u32)nPage );
+ pBt->nPage = nPage;
+}
+
+/*
+** Rollback the transaction in progress.
+**
+** If tripCode is not SQLITE_OK then cursors will be invalidated (tripped).
+** Only write cursors are tripped if writeOnly is true but all cursors are
+** tripped if writeOnly is false. Any attempt to use
+** a tripped cursor will result in an error.
+**
+** This will release the write lock on the database file. If there
+** are no active cursors, it also releases the read lock.
+*/
+SQLITE_PRIVATE int sqlite3BtreeRollback(Btree *p, int tripCode, int writeOnly){
+ int rc;
+ BtShared *pBt = p->pBt;
+ MemPage *pPage1;
+
+ assert( writeOnly==1 || writeOnly==0 );
+ assert( tripCode==SQLITE_ABORT_ROLLBACK || tripCode==SQLITE_OK );
+ sqlite3BtreeEnter(p);
+ if( tripCode==SQLITE_OK ){
+ rc = tripCode = saveAllCursors(pBt, 0, 0);
+ if( rc ) writeOnly = 0;
+ }else{
+ rc = SQLITE_OK;
+ }
+ if( tripCode ){
+ int rc2 = sqlite3BtreeTripAllCursors(p, tripCode, writeOnly);
+ assert( rc==SQLITE_OK || (writeOnly==0 && rc2==SQLITE_OK) );
+ if( rc2!=SQLITE_OK ) rc = rc2;
+ }
+ btreeIntegrity(p);
+
+ if( p->inTrans==TRANS_WRITE ){
+ int rc2;
+
+ assert( TRANS_WRITE==pBt->inTransaction );
+ rc2 = sqlite3PagerRollback(pBt->pPager);
+ if( rc2!=SQLITE_OK ){
+ rc = rc2;
+ }
+
+ /* The rollback may have destroyed the pPage1->aData value. So
+ ** call btreeGetPage() on page 1 again to make
+ ** sure pPage1->aData is set correctly. */
+ if( btreeGetPage(pBt, 1, &pPage1, 0)==SQLITE_OK ){
+ btreeSetNPage(pBt, pPage1);
+ releasePageOne(pPage1);
+ }
+ assert( countValidCursors(pBt, 1)==0 );
+ pBt->inTransaction = TRANS_READ;
+ btreeClearHasContent(pBt);
+ }
+
+ btreeEndTransaction(p);
+ sqlite3BtreeLeave(p);
+ return rc;
+}
+
+/*
+** Start a statement subtransaction. The subtransaction can be rolled
+** back independently of the main transaction. You must start a transaction
+** before starting a subtransaction. The subtransaction is ended automatically
+** if the main transaction commits or rolls back.
+**
+** Statement subtransactions are used around individual SQL statements
+** that are contained within a BEGIN...COMMIT block. If a constraint
+** error occurs within the statement, the effect of that one statement
+** can be rolled back without having to rollback the entire transaction.
+**
+** A statement sub-transaction is implemented as an anonymous savepoint. The
+** value passed as the second parameter is the total number of savepoints,
+** including the new anonymous savepoint, open on the B-Tree. i.e. if there
+** are no active savepoints and no other statement-transactions open,
+** iStatement is 1. This anonymous savepoint can be released or rolled back
+** using the sqlite3BtreeSavepoint() function.
+*/
+SQLITE_PRIVATE int sqlite3BtreeBeginStmt(Btree *p, int iStatement){
+ int rc;
+ BtShared *pBt = p->pBt;
+ sqlite3BtreeEnter(p);
+ assert( p->inTrans==TRANS_WRITE );
+ assert( (pBt->btsFlags & BTS_READ_ONLY)==0 );
+ assert( iStatement>0 );
+ assert( iStatement>p->db->nSavepoint );
+ assert( pBt->inTransaction==TRANS_WRITE );
+ /* At the pager level, a statement transaction is a savepoint with
+ ** an index greater than all savepoints created explicitly using
+ ** SQL statements. It is illegal to open, release or rollback any
+ ** such savepoints while the statement transaction savepoint is active.
+ */
+ rc = sqlite3PagerOpenSavepoint(pBt->pPager, iStatement);
+ sqlite3BtreeLeave(p);
+ return rc;
+}
+
+/*
+** The second argument to this function, op, is always SAVEPOINT_ROLLBACK
+** or SAVEPOINT_RELEASE. This function either releases or rolls back the
+** savepoint identified by parameter iSavepoint, depending on the value
+** of op.
+**
+** Normally, iSavepoint is greater than or equal to zero. However, if op is
+** SAVEPOINT_ROLLBACK, then iSavepoint may also be -1. In this case the
+** contents of the entire transaction are rolled back. This is different
+** from a normal transaction rollback, as no locks are released and the
+** transaction remains open.
+*/
+SQLITE_PRIVATE int sqlite3BtreeSavepoint(Btree *p, int op, int iSavepoint){
+ int rc = SQLITE_OK;
+ if( p && p->inTrans==TRANS_WRITE ){
+ BtShared *pBt = p->pBt;
+ assert( op==SAVEPOINT_RELEASE || op==SAVEPOINT_ROLLBACK );
+ assert( iSavepoint>=0 || (iSavepoint==-1 && op==SAVEPOINT_ROLLBACK) );
+ sqlite3BtreeEnter(p);
+ if( op==SAVEPOINT_ROLLBACK ){
+ rc = saveAllCursors(pBt, 0, 0);
+ }
+ if( rc==SQLITE_OK ){
+ rc = sqlite3PagerSavepoint(pBt->pPager, op, iSavepoint);
+ }
+ if( rc==SQLITE_OK ){
+ if( iSavepoint<0 && (pBt->btsFlags & BTS_INITIALLY_EMPTY)!=0 ){
+ pBt->nPage = 0;
+ }
+ rc = newDatabase(pBt);
+ btreeSetNPage(pBt, pBt->pPage1);
+
+ /* pBt->nPage might be zero if the database was corrupt when
+ ** the transaction was started. Otherwise, it must be at least 1. */
+ assert( CORRUPT_DB || pBt->nPage>0 );
+ }
+ sqlite3BtreeLeave(p);
+ }
+ return rc;
+}
+
+/*
+** Create a new cursor for the BTree whose root is on the page
+** iTable. If a read-only cursor is requested, it is assumed that
+** the caller already has at least a read-only transaction open
+** on the database already. If a write-cursor is requested, then
+** the caller is assumed to have an open write transaction.
+**
+** If the BTREE_WRCSR bit of wrFlag is clear, then the cursor can only
+** be used for reading. If the BTREE_WRCSR bit is set, then the cursor
+** can be used for reading or for writing if other conditions for writing
+** are also met. These are the conditions that must be met in order
+** for writing to be allowed:
+**
+** 1: The cursor must have been opened with wrFlag containing BTREE_WRCSR
+**
+** 2: Other database connections that share the same pager cache
+** but which are not in the READ_UNCOMMITTED state may not have
+** cursors open with wrFlag==0 on the same table. Otherwise
+** the changes made by this write cursor would be visible to
+** the read cursors in the other database connection.
+**
+** 3: The database must be writable (not on read-only media)
+**
+** 4: There must be an active transaction.
+**
+** The BTREE_FORDELETE bit of wrFlag may optionally be set if BTREE_WRCSR
+** is set. If FORDELETE is set, that is a hint to the implementation that
+** this cursor will only be used to seek to and delete entries of an index
+** as part of a larger DELETE statement. The FORDELETE hint is not used by
+** this implementation. But in a hypothetical alternative storage engine
+** in which index entries are automatically deleted when corresponding table
+** rows are deleted, the FORDELETE flag is a hint that all SEEK and DELETE
+** operations on this cursor can be no-ops and all READ operations can
+** return a null row (2-bytes: 0x01 0x00).
+**
+** No checking is done to make sure that page iTable really is the
+** root page of a b-tree. If it is not, then the cursor acquired
+** will not work correctly.
+**
+** It is assumed that the sqlite3BtreeCursorZero() has been called
+** on pCur to initialize the memory space prior to invoking this routine.
+*/
+static int btreeCursor(
+ Btree *p, /* The btree */
+ Pgno iTable, /* Root page of table to open */
+ int wrFlag, /* 1 to write. 0 read-only */
+ struct KeyInfo *pKeyInfo, /* First arg to comparison function */
+ BtCursor *pCur /* Space for new cursor */
+){
+ BtShared *pBt = p->pBt; /* Shared b-tree handle */
+ BtCursor *pX; /* Looping over other all cursors */
+
+ assert( sqlite3BtreeHoldsMutex(p) );
+ assert( wrFlag==0
+ || wrFlag==BTREE_WRCSR
+ || wrFlag==(BTREE_WRCSR|BTREE_FORDELETE)
+ );
+
+ /* The following assert statements verify that if this is a sharable
+ ** b-tree database, the connection is holding the required table locks,
+ ** and that no other connection has any open cursor that conflicts with
+ ** this lock. The iTable<1 term disables the check for corrupt schemas. */
+ assert( hasSharedCacheTableLock(p, iTable, pKeyInfo!=0, (wrFlag?2:1))
+ || iTable<1 );
+ assert( wrFlag==0 || !hasReadConflicts(p, iTable) );
+
+ /* Assert that the caller has opened the required transaction. */
+ assert( p->inTrans>TRANS_NONE );
+ assert( wrFlag==0 || p->inTrans==TRANS_WRITE );
+ assert( pBt->pPage1 && pBt->pPage1->aData );
+ assert( wrFlag==0 || (pBt->btsFlags & BTS_READ_ONLY)==0 );
+
+ if( iTable<=1 ){
+ if( iTable<1 ){
+ return SQLITE_CORRUPT_BKPT;
+ }else if( btreePagecount(pBt)==0 ){
+ assert( wrFlag==0 );
+ iTable = 0;
+ }
+ }
+
+ /* Now that no other errors can occur, finish filling in the BtCursor
+ ** variables and link the cursor into the BtShared list. */
+ pCur->pgnoRoot = iTable;
+ pCur->iPage = -1;
+ pCur->pKeyInfo = pKeyInfo;
+ pCur->pBtree = p;
+ pCur->pBt = pBt;
+ pCur->curFlags = 0;
+ /* If there are two or more cursors on the same btree, then all such
+ ** cursors *must* have the BTCF_Multiple flag set. */
+ for(pX=pBt->pCursor; pX; pX=pX->pNext){
+ if( pX->pgnoRoot==iTable ){
+ pX->curFlags |= BTCF_Multiple;
+ pCur->curFlags = BTCF_Multiple;
+ }
+ }
+ pCur->eState = CURSOR_INVALID;
+ pCur->pNext = pBt->pCursor;
+ pBt->pCursor = pCur;
+ if( wrFlag ){
+ pCur->curFlags |= BTCF_WriteFlag;
+ pCur->curPagerFlags = 0;
+ if( pBt->pTmpSpace==0 ) return allocateTempSpace(pBt);
+ }else{
+ pCur->curPagerFlags = PAGER_GET_READONLY;
+ }
+ return SQLITE_OK;
+}
+static int btreeCursorWithLock(
+ Btree *p, /* The btree */
+ Pgno iTable, /* Root page of table to open */
+ int wrFlag, /* 1 to write. 0 read-only */
+ struct KeyInfo *pKeyInfo, /* First arg to comparison function */
+ BtCursor *pCur /* Space for new cursor */
+){
+ int rc;
+ sqlite3BtreeEnter(p);
+ rc = btreeCursor(p, iTable, wrFlag, pKeyInfo, pCur);
+ sqlite3BtreeLeave(p);
+ return rc;
+}
+SQLITE_PRIVATE int sqlite3BtreeCursor(
+ Btree *p, /* The btree */
+ Pgno iTable, /* Root page of table to open */
+ int wrFlag, /* 1 to write. 0 read-only */
+ struct KeyInfo *pKeyInfo, /* First arg to xCompare() */
+ BtCursor *pCur /* Write new cursor here */
+){
+ if( p->sharable ){
+ return btreeCursorWithLock(p, iTable, wrFlag, pKeyInfo, pCur);
+ }else{
+ return btreeCursor(p, iTable, wrFlag, pKeyInfo, pCur);
+ }
+}
+
+/*
+** Return the size of a BtCursor object in bytes.
+**
+** This interfaces is needed so that users of cursors can preallocate
+** sufficient storage to hold a cursor. The BtCursor object is opaque
+** to users so they cannot do the sizeof() themselves - they must call
+** this routine.
+*/
+SQLITE_PRIVATE int sqlite3BtreeCursorSize(void){
+ return ROUND8(sizeof(BtCursor));
+}
+
+#ifdef SQLITE_DEBUG
+/*
+** Return true if and only if the Btree object will be automatically
+** closed with the BtCursor closes. This is used within assert() statements
+** only.
+*/
+SQLITE_PRIVATE int sqlite3BtreeClosesWithCursor(
+ Btree *pBtree, /* the btree object */
+ BtCursor *pCur /* Corresponding cursor */
+){
+ BtShared *pBt = pBtree->pBt;
+ if( (pBt->openFlags & BTREE_SINGLE)==0 ) return 0;
+ if( pBt->pCursor!=pCur ) return 0;
+ if( pCur->pNext!=0 ) return 0;
+ if( pCur->pBtree!=pBtree ) return 0;
+ return 1;
+}
+#endif
+
+/*
+** Initialize memory that will be converted into a BtCursor object.
+**
+** The simple approach here would be to memset() the entire object
+** to zero. But it turns out that the apPage[] and aiIdx[] arrays
+** do not need to be zeroed and they are large, so we can save a lot
+** of run-time by skipping the initialization of those elements.
+*/
+SQLITE_PRIVATE void sqlite3BtreeCursorZero(BtCursor *p){
+ memset(p, 0, offsetof(BtCursor, BTCURSOR_FIRST_UNINIT));
+}
+
+/*
+** Close a cursor. The read lock on the database file is released
+** when the last cursor is closed.
+*/
+SQLITE_PRIVATE int sqlite3BtreeCloseCursor(BtCursor *pCur){
+ Btree *pBtree = pCur->pBtree;
+ if( pBtree ){
+ BtShared *pBt = pCur->pBt;
+ sqlite3BtreeEnter(pBtree);
+ assert( pBt->pCursor!=0 );
+ if( pBt->pCursor==pCur ){
+ pBt->pCursor = pCur->pNext;
+ }else{
+ BtCursor *pPrev = pBt->pCursor;
+ do{
+ if( pPrev->pNext==pCur ){
+ pPrev->pNext = pCur->pNext;
+ break;
+ }
+ pPrev = pPrev->pNext;
+ }while( ALWAYS(pPrev) );
+ }
+ btreeReleaseAllCursorPages(pCur);
+ unlockBtreeIfUnused(pBt);
+ sqlite3_free(pCur->aOverflow);
+ sqlite3_free(pCur->pKey);
+ if( (pBt->openFlags & BTREE_SINGLE) && pBt->pCursor==0 ){
+ /* Since the BtShared is not sharable, there is no need to
+ ** worry about the missing sqlite3BtreeLeave() call here. */
+ assert( pBtree->sharable==0 );
+ sqlite3BtreeClose(pBtree);
+ }else{
+ sqlite3BtreeLeave(pBtree);
+ }
+ pCur->pBtree = 0;
+ }
+ return SQLITE_OK;
+}
+
+/*
+** Make sure the BtCursor* given in the argument has a valid
+** BtCursor.info structure. If it is not already valid, call
+** btreeParseCell() to fill it in.
+**
+** BtCursor.info is a cache of the information in the current cell.
+** Using this cache reduces the number of calls to btreeParseCell().
+*/
+#ifndef NDEBUG
+ static int cellInfoEqual(CellInfo *a, CellInfo *b){
+ if( a->nKey!=b->nKey ) return 0;
+ if( a->pPayload!=b->pPayload ) return 0;
+ if( a->nPayload!=b->nPayload ) return 0;
+ if( a->nLocal!=b->nLocal ) return 0;
+ if( a->nSize!=b->nSize ) return 0;
+ return 1;
+ }
+ static void assertCellInfo(BtCursor *pCur){
+ CellInfo info;
+ memset(&info, 0, sizeof(info));
+ btreeParseCell(pCur->pPage, pCur->ix, &info);
+ assert( CORRUPT_DB || cellInfoEqual(&info, &pCur->info) );
+ }
+#else
+ #define assertCellInfo(x)
+#endif
+static SQLITE_NOINLINE void getCellInfo(BtCursor *pCur){
+ if( pCur->info.nSize==0 ){
+ pCur->curFlags |= BTCF_ValidNKey;
+ btreeParseCell(pCur->pPage,pCur->ix,&pCur->info);
+ }else{
+ assertCellInfo(pCur);
+ }
+}
+
+#ifndef NDEBUG /* The next routine used only within assert() statements */
+/*
+** Return true if the given BtCursor is valid. A valid cursor is one
+** that is currently pointing to a row in a (non-empty) table.
+** This is a verification routine is used only within assert() statements.
+*/
+SQLITE_PRIVATE int sqlite3BtreeCursorIsValid(BtCursor *pCur){
+ return pCur && pCur->eState==CURSOR_VALID;
+}
+#endif /* NDEBUG */
+SQLITE_PRIVATE int sqlite3BtreeCursorIsValidNN(BtCursor *pCur){
+ assert( pCur!=0 );
+ return pCur->eState==CURSOR_VALID;
+}
+
+/*
+** Return the value of the integer key or "rowid" for a table btree.
+** This routine is only valid for a cursor that is pointing into a
+** ordinary table btree. If the cursor points to an index btree or
+** is invalid, the result of this routine is undefined.
+*/
+SQLITE_PRIVATE i64 sqlite3BtreeIntegerKey(BtCursor *pCur){
+ assert( cursorHoldsMutex(pCur) );
+ assert( pCur->eState==CURSOR_VALID );
+ assert( pCur->curIntKey );
+ getCellInfo(pCur);
+ return pCur->info.nKey;
+}
+
+/*
+** Pin or unpin a cursor.
+*/
+SQLITE_PRIVATE void sqlite3BtreeCursorPin(BtCursor *pCur){
+ assert( (pCur->curFlags & BTCF_Pinned)==0 );
+ pCur->curFlags |= BTCF_Pinned;
+}
+SQLITE_PRIVATE void sqlite3BtreeCursorUnpin(BtCursor *pCur){
+ assert( (pCur->curFlags & BTCF_Pinned)!=0 );
+ pCur->curFlags &= ~BTCF_Pinned;
+}
+
+/*
+** Return the offset into the database file for the start of the
+** payload to which the cursor is pointing.
+*/
+SQLITE_PRIVATE i64 sqlite3BtreeOffset(BtCursor *pCur){
+ assert( cursorHoldsMutex(pCur) );
+ assert( pCur->eState==CURSOR_VALID );
+ getCellInfo(pCur);
+ return (i64)pCur->pBt->pageSize*((i64)pCur->pPage->pgno - 1) +
+ (i64)(pCur->info.pPayload - pCur->pPage->aData);
+}
+
+/*
+** Return the number of bytes of payload for the entry that pCur is
+** currently pointing to. For table btrees, this will be the amount
+** of data. For index btrees, this will be the size of the key.
+**
+** The caller must guarantee that the cursor is pointing to a non-NULL
+** valid entry. In other words, the calling procedure must guarantee
+** that the cursor has Cursor.eState==CURSOR_VALID.
+*/
+SQLITE_PRIVATE u32 sqlite3BtreePayloadSize(BtCursor *pCur){
+ assert( cursorHoldsMutex(pCur) );
+ assert( pCur->eState==CURSOR_VALID );
+ getCellInfo(pCur);
+ return pCur->info.nPayload;
+}
+
+/*
+** Return an upper bound on the size of any record for the table
+** that the cursor is pointing into.
+**
+** This is an optimization. Everything will still work if this
+** routine always returns 2147483647 (which is the largest record
+** that SQLite can handle) or more. But returning a smaller value might
+** prevent large memory allocations when trying to interpret a
+** corrupt database.
+**
+** The current implementation merely returns the size of the underlying
+** database file.
+*/
+SQLITE_PRIVATE sqlite3_int64 sqlite3BtreeMaxRecordSize(BtCursor *pCur){
+ assert( cursorHoldsMutex(pCur) );
+ assert( pCur->eState==CURSOR_VALID );
+ return pCur->pBt->pageSize * (sqlite3_int64)pCur->pBt->nPage;
+}
+
+/*
+** Given the page number of an overflow page in the database (parameter
+** ovfl), this function finds the page number of the next page in the
+** linked list of overflow pages. If possible, it uses the auto-vacuum
+** pointer-map data instead of reading the content of page ovfl to do so.
+**
+** If an error occurs an SQLite error code is returned. Otherwise:
+**
+** The page number of the next overflow page in the linked list is
+** written to *pPgnoNext. If page ovfl is the last page in its linked
+** list, *pPgnoNext is set to zero.
+**
+** If ppPage is not NULL, and a reference to the MemPage object corresponding
+** to page number pOvfl was obtained, then *ppPage is set to point to that
+** reference. It is the responsibility of the caller to call releasePage()
+** on *ppPage to free the reference. In no reference was obtained (because
+** the pointer-map was used to obtain the value for *pPgnoNext), then
+** *ppPage is set to zero.
+*/
+static int getOverflowPage(
+ BtShared *pBt, /* The database file */
+ Pgno ovfl, /* Current overflow page number */
+ MemPage **ppPage, /* OUT: MemPage handle (may be NULL) */
+ Pgno *pPgnoNext /* OUT: Next overflow page number */
+){
+ Pgno next = 0;
+ MemPage *pPage = 0;
+ int rc = SQLITE_OK;
+
+ assert( sqlite3_mutex_held(pBt->mutex) );
+ assert(pPgnoNext);
+
+#ifndef SQLITE_OMIT_AUTOVACUUM
+ /* Try to find the next page in the overflow list using the
+ ** autovacuum pointer-map pages. Guess that the next page in
+ ** the overflow list is page number (ovfl+1). If that guess turns
+ ** out to be wrong, fall back to loading the data of page
+ ** number ovfl to determine the next page number.
+ */
+ if( pBt->autoVacuum ){
+ Pgno pgno;
+ Pgno iGuess = ovfl+1;
+ u8 eType;
+
+ while( PTRMAP_ISPAGE(pBt, iGuess) || iGuess==PENDING_BYTE_PAGE(pBt) ){
+ iGuess++;
+ }
+
+ if( iGuess<=btreePagecount(pBt) ){
+ rc = ptrmapGet(pBt, iGuess, &eType, &pgno);
+ if( rc==SQLITE_OK && eType==PTRMAP_OVERFLOW2 && pgno==ovfl ){
+ next = iGuess;
+ rc = SQLITE_DONE;
+ }
+ }
+ }
+#endif
+
+ assert( next==0 || rc==SQLITE_DONE );
+ if( rc==SQLITE_OK ){
+ rc = btreeGetPage(pBt, ovfl, &pPage, (ppPage==0) ? PAGER_GET_READONLY : 0);
+ assert( rc==SQLITE_OK || pPage==0 );
+ if( rc==SQLITE_OK ){
+ next = get4byte(pPage->aData);
+ }
+ }
+
+ *pPgnoNext = next;
+ if( ppPage ){
+ *ppPage = pPage;
+ }else{
+ releasePage(pPage);
+ }
+ return (rc==SQLITE_DONE ? SQLITE_OK : rc);
+}
+
+/*
+** Copy data from a buffer to a page, or from a page to a buffer.
+**
+** pPayload is a pointer to data stored on database page pDbPage.
+** If argument eOp is false, then nByte bytes of data are copied
+** from pPayload to the buffer pointed at by pBuf. If eOp is true,
+** then sqlite3PagerWrite() is called on pDbPage and nByte bytes
+** of data are copied from the buffer pBuf to pPayload.
+**
+** SQLITE_OK is returned on success, otherwise an error code.
+*/
+static int copyPayload(
+ void *pPayload, /* Pointer to page data */
+ void *pBuf, /* Pointer to buffer */
+ int nByte, /* Number of bytes to copy */
+ int eOp, /* 0 -> copy from page, 1 -> copy to page */
+ DbPage *pDbPage /* Page containing pPayload */
+){
+ if( eOp ){
+ /* Copy data from buffer to page (a write operation) */
+ int rc = sqlite3PagerWrite(pDbPage);
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+ memcpy(pPayload, pBuf, nByte);
+ }else{
+ /* Copy data from page to buffer (a read operation) */
+ memcpy(pBuf, pPayload, nByte);
+ }
+ return SQLITE_OK;
+}
+
+/*
+** This function is used to read or overwrite payload information
+** for the entry that the pCur cursor is pointing to. The eOp
+** argument is interpreted as follows:
+**
+** 0: The operation is a read. Populate the overflow cache.
+** 1: The operation is a write. Populate the overflow cache.
+**
+** A total of "amt" bytes are read or written beginning at "offset".
+** Data is read to or from the buffer pBuf.
+**
+** The content being read or written might appear on the main page
+** or be scattered out on multiple overflow pages.
+**
+** If the current cursor entry uses one or more overflow pages
+** this function may allocate space for and lazily populate
+** the overflow page-list cache array (BtCursor.aOverflow).
+** Subsequent calls use this cache to make seeking to the supplied offset
+** more efficient.
+**
+** Once an overflow page-list cache has been allocated, it must be
+** invalidated if some other cursor writes to the same table, or if
+** the cursor is moved to a different row. Additionally, in auto-vacuum
+** mode, the following events may invalidate an overflow page-list cache.
+**
+** * An incremental vacuum,
+** * A commit in auto_vacuum="full" mode,
+** * Creating a table (may require moving an overflow page).
+*/
+static int accessPayload(
+ BtCursor *pCur, /* Cursor pointing to entry to read from */
+ u32 offset, /* Begin reading this far into payload */
+ u32 amt, /* Read this many bytes */
+ unsigned char *pBuf, /* Write the bytes into this buffer */
+ int eOp /* zero to read. non-zero to write. */
+){
+ unsigned char *aPayload;
+ int rc = SQLITE_OK;
+ int iIdx = 0;
+ MemPage *pPage = pCur->pPage; /* Btree page of current entry */
+ BtShared *pBt = pCur->pBt; /* Btree this cursor belongs to */
+#ifdef SQLITE_DIRECT_OVERFLOW_READ
+ unsigned char * const pBufStart = pBuf; /* Start of original out buffer */
+#endif
+
+ assert( pPage );
+ assert( eOp==0 || eOp==1 );
+ assert( pCur->eState==CURSOR_VALID );
+ if( pCur->ix>=pPage->nCell ){
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ assert( cursorHoldsMutex(pCur) );
+
+ getCellInfo(pCur);
+ aPayload = pCur->info.pPayload;
+ assert( offset+amt <= pCur->info.nPayload );
+
+ assert( aPayload > pPage->aData );
+ if( (uptr)(aPayload - pPage->aData) > (pBt->usableSize - pCur->info.nLocal) ){
+ /* Trying to read or write past the end of the data is an error. The
+ ** conditional above is really:
+ ** &aPayload[pCur->info.nLocal] > &pPage->aData[pBt->usableSize]
+ ** but is recast into its current form to avoid integer overflow problems
+ */
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+
+ /* Check if data must be read/written to/from the btree page itself. */
+ if( offset<pCur->info.nLocal ){
+ int a = amt;
+ if( a+offset>pCur->info.nLocal ){
+ a = pCur->info.nLocal - offset;
+ }
+ rc = copyPayload(&aPayload[offset], pBuf, a, eOp, pPage->pDbPage);
+ offset = 0;
+ pBuf += a;
+ amt -= a;
+ }else{
+ offset -= pCur->info.nLocal;
+ }
+
+
+ if( rc==SQLITE_OK && amt>0 ){
+ const u32 ovflSize = pBt->usableSize - 4; /* Bytes content per ovfl page */
+ Pgno nextPage;
+
+ nextPage = get4byte(&aPayload[pCur->info.nLocal]);
+
+ /* If the BtCursor.aOverflow[] has not been allocated, allocate it now.
+ **
+ ** The aOverflow[] array is sized at one entry for each overflow page
+ ** in the overflow chain. The page number of the first overflow page is
+ ** stored in aOverflow[0], etc. A value of 0 in the aOverflow[] array
+ ** means "not yet known" (the cache is lazily populated).
+ */
+ if( (pCur->curFlags & BTCF_ValidOvfl)==0 ){
+ int nOvfl = (pCur->info.nPayload-pCur->info.nLocal+ovflSize-1)/ovflSize;
+ if( pCur->aOverflow==0
+ || nOvfl*(int)sizeof(Pgno) > sqlite3MallocSize(pCur->aOverflow)
+ ){
+ Pgno *aNew;
+ if( sqlite3FaultSim(413) ){
+ aNew = 0;
+ }else{
+ aNew = (Pgno*)sqlite3Realloc(pCur->aOverflow, nOvfl*2*sizeof(Pgno));
+ }
+ if( aNew==0 ){
+ return SQLITE_NOMEM_BKPT;
+ }else{
+ pCur->aOverflow = aNew;
+ }
+ }
+ memset(pCur->aOverflow, 0, nOvfl*sizeof(Pgno));
+ pCur->curFlags |= BTCF_ValidOvfl;
+ }else{
+ /* Sanity check the validity of the overflow page cache */
+ assert( pCur->aOverflow[0]==nextPage
+ || pCur->aOverflow[0]==0
+ || CORRUPT_DB );
+ assert( pCur->aOverflow[0]!=0 || pCur->aOverflow[offset/ovflSize]==0 );
+
+ /* If the overflow page-list cache has been allocated and the
+ ** entry for the first required overflow page is valid, skip
+ ** directly to it.
+ */
+ if( pCur->aOverflow[offset/ovflSize] ){
+ iIdx = (offset/ovflSize);
+ nextPage = pCur->aOverflow[iIdx];
+ offset = (offset%ovflSize);
+ }
+ }
+
+ assert( rc==SQLITE_OK && amt>0 );
+ while( nextPage ){
+ /* If required, populate the overflow page-list cache. */
+ if( nextPage > pBt->nPage ) return SQLITE_CORRUPT_BKPT;
+ assert( pCur->aOverflow[iIdx]==0
+ || pCur->aOverflow[iIdx]==nextPage
+ || CORRUPT_DB );
+ pCur->aOverflow[iIdx] = nextPage;
+
+ if( offset>=ovflSize ){
+ /* The only reason to read this page is to obtain the page
+ ** number for the next page in the overflow chain. The page
+ ** data is not required. So first try to lookup the overflow
+ ** page-list cache, if any, then fall back to the getOverflowPage()
+ ** function.
+ */
+ assert( pCur->curFlags & BTCF_ValidOvfl );
+ assert( pCur->pBtree->db==pBt->db );
+ if( pCur->aOverflow[iIdx+1] ){
+ nextPage = pCur->aOverflow[iIdx+1];
+ }else{
+ rc = getOverflowPage(pBt, nextPage, 0, &nextPage);
+ }
+ offset -= ovflSize;
+ }else{
+ /* Need to read this page properly. It contains some of the
+ ** range of data that is being read (eOp==0) or written (eOp!=0).
+ */
+ int a = amt;
+ if( a + offset > ovflSize ){
+ a = ovflSize - offset;
+ }
+
+#ifdef SQLITE_DIRECT_OVERFLOW_READ
+ /* If all the following are true:
+ **
+ ** 1) this is a read operation, and
+ ** 2) data is required from the start of this overflow page, and
+ ** 3) there are no dirty pages in the page-cache
+ ** 4) the database is file-backed, and
+ ** 5) the page is not in the WAL file
+ ** 6) at least 4 bytes have already been read into the output buffer
+ **
+ ** then data can be read directly from the database file into the
+ ** output buffer, bypassing the page-cache altogether. This speeds
+ ** up loading large records that span many overflow pages.
+ */
+ if( eOp==0 /* (1) */
+ && offset==0 /* (2) */
+ && sqlite3PagerDirectReadOk(pBt->pPager, nextPage) /* (3,4,5) */
+ && &pBuf[-4]>=pBufStart /* (6) */
+ ){
+ sqlite3_file *fd = sqlite3PagerFile(pBt->pPager);
+ u8 aSave[4];
+ u8 *aWrite = &pBuf[-4];
+ assert( aWrite>=pBufStart ); /* due to (6) */
+ memcpy(aSave, aWrite, 4);
+ rc = sqlite3OsRead(fd, aWrite, a+4, (i64)pBt->pageSize*(nextPage-1));
+ nextPage = get4byte(aWrite);
+ memcpy(aWrite, aSave, 4);
+ }else
+#endif
+
+ {
+ DbPage *pDbPage;
+ rc = sqlite3PagerGet(pBt->pPager, nextPage, &pDbPage,
+ (eOp==0 ? PAGER_GET_READONLY : 0)
+ );
+ if( rc==SQLITE_OK ){
+ aPayload = sqlite3PagerGetData(pDbPage);
+ nextPage = get4byte(aPayload);
+ rc = copyPayload(&aPayload[offset+4], pBuf, a, eOp, pDbPage);
+ sqlite3PagerUnref(pDbPage);
+ offset = 0;
+ }
+ }
+ amt -= a;
+ if( amt==0 ) return rc;
+ pBuf += a;
+ }
+ if( rc ) break;
+ iIdx++;
+ }
+ }
+
+ if( rc==SQLITE_OK && amt>0 ){
+ /* Overflow chain ends prematurely */
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ return rc;
+}
+
+/*
+** Read part of the payload for the row at which that cursor pCur is currently
+** pointing. "amt" bytes will be transferred into pBuf[]. The transfer
+** begins at "offset".
+**
+** pCur can be pointing to either a table or an index b-tree.
+** If pointing to a table btree, then the content section is read. If
+** pCur is pointing to an index b-tree then the key section is read.
+**
+** For sqlite3BtreePayload(), the caller must ensure that pCur is pointing
+** to a valid row in the table. For sqlite3BtreePayloadChecked(), the
+** cursor might be invalid or might need to be restored before being read.
+**
+** Return SQLITE_OK on success or an error code if anything goes
+** wrong. An error is returned if "offset+amt" is larger than
+** the available payload.
+*/
+SQLITE_PRIVATE int sqlite3BtreePayload(BtCursor *pCur, u32 offset, u32 amt, void *pBuf){
+ assert( cursorHoldsMutex(pCur) );
+ assert( pCur->eState==CURSOR_VALID );
+ assert( pCur->iPage>=0 && pCur->pPage );
+ return accessPayload(pCur, offset, amt, (unsigned char*)pBuf, 0);
+}
+
+/*
+** This variant of sqlite3BtreePayload() works even if the cursor has not
+** in the CURSOR_VALID state. It is only used by the sqlite3_blob_read()
+** interface.
+*/
+#ifndef SQLITE_OMIT_INCRBLOB
+static SQLITE_NOINLINE int accessPayloadChecked(
+ BtCursor *pCur,
+ u32 offset,
+ u32 amt,
+ void *pBuf
+){
+ int rc;
+ if ( pCur->eState==CURSOR_INVALID ){
+ return SQLITE_ABORT;
+ }
+ assert( cursorOwnsBtShared(pCur) );
+ rc = btreeRestoreCursorPosition(pCur);
+ return rc ? rc : accessPayload(pCur, offset, amt, pBuf, 0);
+}
+SQLITE_PRIVATE int sqlite3BtreePayloadChecked(BtCursor *pCur, u32 offset, u32 amt, void *pBuf){
+ if( pCur->eState==CURSOR_VALID ){
+ assert( cursorOwnsBtShared(pCur) );
+ return accessPayload(pCur, offset, amt, pBuf, 0);
+ }else{
+ return accessPayloadChecked(pCur, offset, amt, pBuf);
+ }
+}
+#endif /* SQLITE_OMIT_INCRBLOB */
+
+/*
+** Return a pointer to payload information from the entry that the
+** pCur cursor is pointing to. The pointer is to the beginning of
+** the key if index btrees (pPage->intKey==0) and is the data for
+** table btrees (pPage->intKey==1). The number of bytes of available
+** key/data is written into *pAmt. If *pAmt==0, then the value
+** returned will not be a valid pointer.
+**
+** This routine is an optimization. It is common for the entire key
+** and data to fit on the local page and for there to be no overflow
+** pages. When that is so, this routine can be used to access the
+** key and data without making a copy. If the key and/or data spills
+** onto overflow pages, then accessPayload() must be used to reassemble
+** the key/data and copy it into a preallocated buffer.
+**
+** The pointer returned by this routine looks directly into the cached
+** page of the database. The data might change or move the next time
+** any btree routine is called.
+*/
+static const void *fetchPayload(
+ BtCursor *pCur, /* Cursor pointing to entry to read from */
+ u32 *pAmt /* Write the number of available bytes here */
+){
+ int amt;
+ assert( pCur!=0 && pCur->iPage>=0 && pCur->pPage);
+ assert( pCur->eState==CURSOR_VALID );
+ assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
+ assert( cursorOwnsBtShared(pCur) );
+ assert( pCur->ix<pCur->pPage->nCell || CORRUPT_DB );
+ assert( pCur->info.nSize>0 );
+ assert( pCur->info.pPayload>pCur->pPage->aData || CORRUPT_DB );
+ assert( pCur->info.pPayload<pCur->pPage->aDataEnd ||CORRUPT_DB);
+ amt = pCur->info.nLocal;
+ if( amt>(int)(pCur->pPage->aDataEnd - pCur->info.pPayload) ){
+ /* There is too little space on the page for the expected amount
+ ** of local content. Database must be corrupt. */
+ assert( CORRUPT_DB );
+ amt = MAX(0, (int)(pCur->pPage->aDataEnd - pCur->info.pPayload));
+ }
+ *pAmt = (u32)amt;
+ return (void*)pCur->info.pPayload;
+}
+
+
+/*
+** For the entry that cursor pCur is point to, return as
+** many bytes of the key or data as are available on the local
+** b-tree page. Write the number of available bytes into *pAmt.
+**
+** The pointer returned is ephemeral. The key/data may move
+** or be destroyed on the next call to any Btree routine,
+** including calls from other threads against the same cache.
+** Hence, a mutex on the BtShared should be held prior to calling
+** this routine.
+**
+** These routines is used to get quick access to key and data
+** in the common case where no overflow pages are used.
+*/
+SQLITE_PRIVATE const void *sqlite3BtreePayloadFetch(BtCursor *pCur, u32 *pAmt){
+ return fetchPayload(pCur, pAmt);
+}
+
+
+/*
+** Move the cursor down to a new child page. The newPgno argument is the
+** page number of the child page to move to.
+**
+** This function returns SQLITE_CORRUPT if the page-header flags field of
+** the new child page does not match the flags field of the parent (i.e.
+** if an intkey page appears to be the parent of a non-intkey page, or
+** vice-versa).
+*/
+static int moveToChild(BtCursor *pCur, u32 newPgno){
+ int rc;
+ assert( cursorOwnsBtShared(pCur) );
+ assert( pCur->eState==CURSOR_VALID );
+ assert( pCur->iPage<BTCURSOR_MAX_DEPTH );
+ assert( pCur->iPage>=0 );
+ if( pCur->iPage>=(BTCURSOR_MAX_DEPTH-1) ){
+ return SQLITE_CORRUPT_BKPT;
+ }
+ pCur->info.nSize = 0;
+ pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl);
+ pCur->aiIdx[pCur->iPage] = pCur->ix;
+ pCur->apPage[pCur->iPage] = pCur->pPage;
+ pCur->ix = 0;
+ pCur->iPage++;
+ rc = getAndInitPage(pCur->pBt, newPgno, &pCur->pPage, pCur->curPagerFlags);
+ assert( pCur->pPage!=0 || rc!=SQLITE_OK );
+ if( rc==SQLITE_OK
+ && (pCur->pPage->nCell<1 || pCur->pPage->intKey!=pCur->curIntKey)
+ ){
+ releasePage(pCur->pPage);
+ rc = SQLITE_CORRUPT_PGNO(newPgno);
+ }
+ if( rc ){
+ pCur->pPage = pCur->apPage[--pCur->iPage];
+ }
+ return rc;
+}
+
+#ifdef SQLITE_DEBUG
+/*
+** Page pParent is an internal (non-leaf) tree page. This function
+** asserts that page number iChild is the left-child if the iIdx'th
+** cell in page pParent. Or, if iIdx is equal to the total number of
+** cells in pParent, that page number iChild is the right-child of
+** the page.
+*/
+static void assertParentIndex(MemPage *pParent, int iIdx, Pgno iChild){
+ if( CORRUPT_DB ) return; /* The conditions tested below might not be true
+ ** in a corrupt database */
+ assert( iIdx<=pParent->nCell );
+ if( iIdx==pParent->nCell ){
+ assert( get4byte(&pParent->aData[pParent->hdrOffset+8])==iChild );
+ }else{
+ assert( get4byte(findCell(pParent, iIdx))==iChild );
+ }
+}
+#else
+# define assertParentIndex(x,y,z)
+#endif
+
+/*
+** Move the cursor up to the parent page.
+**
+** pCur->idx is set to the cell index that contains the pointer
+** to the page we are coming from. If we are coming from the
+** right-most child page then pCur->idx is set to one more than
+** the largest cell index.
+*/
+static void moveToParent(BtCursor *pCur){
+ MemPage *pLeaf;
+ assert( cursorOwnsBtShared(pCur) );
+ assert( pCur->eState==CURSOR_VALID );
+ assert( pCur->iPage>0 );
+ assert( pCur->pPage );
+ assertParentIndex(
+ pCur->apPage[pCur->iPage-1],
+ pCur->aiIdx[pCur->iPage-1],
+ pCur->pPage->pgno
+ );
+ testcase( pCur->aiIdx[pCur->iPage-1] > pCur->apPage[pCur->iPage-1]->nCell );
+ pCur->info.nSize = 0;
+ pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl);
+ pCur->ix = pCur->aiIdx[pCur->iPage-1];
+ pLeaf = pCur->pPage;
+ pCur->pPage = pCur->apPage[--pCur->iPage];
+ releasePageNotNull(pLeaf);
+}
+
+/*
+** Move the cursor to point to the root page of its b-tree structure.
+**
+** If the table has a virtual root page, then the cursor is moved to point
+** to the virtual root page instead of the actual root page. A table has a
+** virtual root page when the actual root page contains no cells and a
+** single child page. This can only happen with the table rooted at page 1.
+**
+** If the b-tree structure is empty, the cursor state is set to
+** CURSOR_INVALID and this routine returns SQLITE_EMPTY. Otherwise,
+** the cursor is set to point to the first cell located on the root
+** (or virtual root) page and the cursor state is set to CURSOR_VALID.
+**
+** If this function returns successfully, it may be assumed that the
+** page-header flags indicate that the [virtual] root-page is the expected
+** kind of b-tree page (i.e. if when opening the cursor the caller did not
+** specify a KeyInfo structure the flags byte is set to 0x05 or 0x0D,
+** indicating a table b-tree, or if the caller did specify a KeyInfo
+** structure the flags byte is set to 0x02 or 0x0A, indicating an index
+** b-tree).
+*/
+static int moveToRoot(BtCursor *pCur){
+ MemPage *pRoot;
+ int rc = SQLITE_OK;
+
+ assert( cursorOwnsBtShared(pCur) );
+ assert( CURSOR_INVALID < CURSOR_REQUIRESEEK );
+ assert( CURSOR_VALID < CURSOR_REQUIRESEEK );
+ assert( CURSOR_FAULT > CURSOR_REQUIRESEEK );
+ assert( pCur->eState < CURSOR_REQUIRESEEK || pCur->iPage<0 );
+ assert( pCur->pgnoRoot>0 || pCur->iPage<0 );
+
+ if( pCur->iPage>=0 ){
+ if( pCur->iPage ){
+ releasePageNotNull(pCur->pPage);
+ while( --pCur->iPage ){
+ releasePageNotNull(pCur->apPage[pCur->iPage]);
+ }
+ pRoot = pCur->pPage = pCur->apPage[0];
+ goto skip_init;
+ }
+ }else if( pCur->pgnoRoot==0 ){
+ pCur->eState = CURSOR_INVALID;
+ return SQLITE_EMPTY;
+ }else{
+ assert( pCur->iPage==(-1) );
+ if( pCur->eState>=CURSOR_REQUIRESEEK ){
+ if( pCur->eState==CURSOR_FAULT ){
+ assert( pCur->skipNext!=SQLITE_OK );
+ return pCur->skipNext;
+ }
+ sqlite3BtreeClearCursor(pCur);
+ }
+ rc = getAndInitPage(pCur->pBt, pCur->pgnoRoot, &pCur->pPage,
+ pCur->curPagerFlags);
+ if( rc!=SQLITE_OK ){
+ pCur->eState = CURSOR_INVALID;
+ return rc;
+ }
+ pCur->iPage = 0;
+ pCur->curIntKey = pCur->pPage->intKey;
+ }
+ pRoot = pCur->pPage;
+ assert( pRoot->pgno==pCur->pgnoRoot || CORRUPT_DB );
+
+ /* If pCur->pKeyInfo is not NULL, then the caller that opened this cursor
+ ** expected to open it on an index b-tree. Otherwise, if pKeyInfo is
+ ** NULL, the caller expects a table b-tree. If this is not the case,
+ ** return an SQLITE_CORRUPT error.
+ **
+ ** Earlier versions of SQLite assumed that this test could not fail
+ ** if the root page was already loaded when this function was called (i.e.
+ ** if pCur->iPage>=0). But this is not so if the database is corrupted
+ ** in such a way that page pRoot is linked into a second b-tree table
+ ** (or the freelist). */
+ assert( pRoot->intKey==1 || pRoot->intKey==0 );
+ if( pRoot->isInit==0 || (pCur->pKeyInfo==0)!=pRoot->intKey ){
+ return SQLITE_CORRUPT_PAGE(pCur->pPage);
+ }
+
+skip_init:
+ pCur->ix = 0;
+ pCur->info.nSize = 0;
+ pCur->curFlags &= ~(BTCF_AtLast|BTCF_ValidNKey|BTCF_ValidOvfl);
+
+ if( pRoot->nCell>0 ){
+ pCur->eState = CURSOR_VALID;
+ }else if( !pRoot->leaf ){
+ Pgno subpage;
+ if( pRoot->pgno!=1 ) return SQLITE_CORRUPT_BKPT;
+ subpage = get4byte(&pRoot->aData[pRoot->hdrOffset+8]);
+ pCur->eState = CURSOR_VALID;
+ rc = moveToChild(pCur, subpage);
+ }else{
+ pCur->eState = CURSOR_INVALID;
+ rc = SQLITE_EMPTY;
+ }
+ return rc;
+}
+
+/*
+** Move the cursor down to the left-most leaf entry beneath the
+** entry to which it is currently pointing.
+**
+** The left-most leaf is the one with the smallest key - the first
+** in ascending order.
+*/
+static int moveToLeftmost(BtCursor *pCur){
+ Pgno pgno;
+ int rc = SQLITE_OK;
+ MemPage *pPage;
+
+ assert( cursorOwnsBtShared(pCur) );
+ assert( pCur->eState==CURSOR_VALID );
+ while( rc==SQLITE_OK && !(pPage = pCur->pPage)->leaf ){
+ assert( pCur->ix<pPage->nCell );
+ pgno = get4byte(findCell(pPage, pCur->ix));
+ rc = moveToChild(pCur, pgno);
+ }
+ return rc;
+}
+
+/*
+** Move the cursor down to the right-most leaf entry beneath the
+** page to which it is currently pointing. Notice the difference
+** between moveToLeftmost() and moveToRightmost(). moveToLeftmost()
+** finds the left-most entry beneath the *entry* whereas moveToRightmost()
+** finds the right-most entry beneath the *page*.
+**
+** The right-most entry is the one with the largest key - the last
+** key in ascending order.
+*/
+static int moveToRightmost(BtCursor *pCur){
+ Pgno pgno;
+ int rc = SQLITE_OK;
+ MemPage *pPage = 0;
+
+ assert( cursorOwnsBtShared(pCur) );
+ assert( pCur->eState==CURSOR_VALID );
+ while( !(pPage = pCur->pPage)->leaf ){
+ pgno = get4byte(&pPage->aData[pPage->hdrOffset+8]);
+ pCur->ix = pPage->nCell;
+ rc = moveToChild(pCur, pgno);
+ if( rc ) return rc;
+ }
+ pCur->ix = pPage->nCell-1;
+ assert( pCur->info.nSize==0 );
+ assert( (pCur->curFlags & BTCF_ValidNKey)==0 );
+ return SQLITE_OK;
+}
+
+/* Move the cursor to the first entry in the table. Return SQLITE_OK
+** on success. Set *pRes to 0 if the cursor actually points to something
+** or set *pRes to 1 if the table is empty.
+*/
+SQLITE_PRIVATE int sqlite3BtreeFirst(BtCursor *pCur, int *pRes){
+ int rc;
+
+ assert( cursorOwnsBtShared(pCur) );
+ assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
+ rc = moveToRoot(pCur);
+ if( rc==SQLITE_OK ){
+ assert( pCur->pPage->nCell>0 );
+ *pRes = 0;
+ rc = moveToLeftmost(pCur);
+ }else if( rc==SQLITE_EMPTY ){
+ assert( pCur->pgnoRoot==0 || (pCur->pPage!=0 && pCur->pPage->nCell==0) );
+ *pRes = 1;
+ rc = SQLITE_OK;
+ }
+ return rc;
+}
+
+#ifdef SQLITE_DEBUG
+/* The cursors is CURSOR_VALID and has BTCF_AtLast set. Verify that
+** this flags are true for a consistent database.
+**
+** This routine is is called from within assert() statements only.
+** It is an internal verification routine and does not appear in production
+** builds.
+*/
+static int cursorIsAtLastEntry(BtCursor *pCur){
+ int ii;
+ for(ii=0; ii<pCur->iPage; ii++){
+ if( pCur->aiIdx[ii]!=pCur->apPage[ii]->nCell ) return 0;
+ }
+ return pCur->ix==pCur->pPage->nCell-1 && pCur->pPage->leaf!=0;
+}
+#endif
+
+/* Move the cursor to the last entry in the table. Return SQLITE_OK
+** on success. Set *pRes to 0 if the cursor actually points to something
+** or set *pRes to 1 if the table is empty.
+*/
+static SQLITE_NOINLINE int btreeLast(BtCursor *pCur, int *pRes){
+ int rc = moveToRoot(pCur);
+ if( rc==SQLITE_OK ){
+ assert( pCur->eState==CURSOR_VALID );
+ *pRes = 0;
+ rc = moveToRightmost(pCur);
+ if( rc==SQLITE_OK ){
+ pCur->curFlags |= BTCF_AtLast;
+ }else{
+ pCur->curFlags &= ~BTCF_AtLast;
+ }
+ }else if( rc==SQLITE_EMPTY ){
+ assert( pCur->pgnoRoot==0 || pCur->pPage->nCell==0 );
+ *pRes = 1;
+ rc = SQLITE_OK;
+ }
+ return rc;
+}
+SQLITE_PRIVATE int sqlite3BtreeLast(BtCursor *pCur, int *pRes){
+ assert( cursorOwnsBtShared(pCur) );
+ assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
+
+ /* If the cursor already points to the last entry, this is a no-op. */
+ if( CURSOR_VALID==pCur->eState && (pCur->curFlags & BTCF_AtLast)!=0 ){
+ assert( cursorIsAtLastEntry(pCur) || CORRUPT_DB );
+ *pRes = 0;
+ return SQLITE_OK;
+ }
+ return btreeLast(pCur, pRes);
+}
+
+/* Move the cursor so that it points to an entry in a table (a.k.a INTKEY)
+** table near the key intKey. Return a success code.
+**
+** If an exact match is not found, then the cursor is always
+** left pointing at a leaf page which would hold the entry if it
+** were present. The cursor might point to an entry that comes
+** before or after the key.
+**
+** An integer is written into *pRes which is the result of
+** comparing the key with the entry to which the cursor is
+** pointing. The meaning of the integer written into
+** *pRes is as follows:
+**
+** *pRes<0 The cursor is left pointing at an entry that
+** is smaller than intKey or if the table is empty
+** and the cursor is therefore left point to nothing.
+**
+** *pRes==0 The cursor is left pointing at an entry that
+** exactly matches intKey.
+**
+** *pRes>0 The cursor is left pointing at an entry that
+** is larger than intKey.
+*/
+SQLITE_PRIVATE int sqlite3BtreeTableMoveto(
+ BtCursor *pCur, /* The cursor to be moved */
+ i64 intKey, /* The table key */
+ int biasRight, /* If true, bias the search to the high end */
+ int *pRes /* Write search results here */
+){
+ int rc;
+
+ assert( cursorOwnsBtShared(pCur) );
+ assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
+ assert( pRes );
+ assert( pCur->pKeyInfo==0 );
+ assert( pCur->eState!=CURSOR_VALID || pCur->curIntKey!=0 );
+
+ /* If the cursor is already positioned at the point we are trying
+ ** to move to, then just return without doing any work */
+ if( pCur->eState==CURSOR_VALID && (pCur->curFlags & BTCF_ValidNKey)!=0 ){
+ if( pCur->info.nKey==intKey ){
+ *pRes = 0;
+ return SQLITE_OK;
+ }
+ if( pCur->info.nKey<intKey ){
+ if( (pCur->curFlags & BTCF_AtLast)!=0 ){
+ assert( cursorIsAtLastEntry(pCur) || CORRUPT_DB );
+ *pRes = -1;
+ return SQLITE_OK;
+ }
+ /* If the requested key is one more than the previous key, then
+ ** try to get there using sqlite3BtreeNext() rather than a full
+ ** binary search. This is an optimization only. The correct answer
+ ** is still obtained without this case, only a little more slowly. */
+ if( pCur->info.nKey+1==intKey ){
+ *pRes = 0;
+ rc = sqlite3BtreeNext(pCur, 0);
+ if( rc==SQLITE_OK ){
+ getCellInfo(pCur);
+ if( pCur->info.nKey==intKey ){
+ return SQLITE_OK;
+ }
+ }else if( rc!=SQLITE_DONE ){
+ return rc;
+ }
+ }
+ }
+ }
+
+#ifdef SQLITE_DEBUG
+ pCur->pBtree->nSeek++; /* Performance measurement during testing */
+#endif
+
+ rc = moveToRoot(pCur);
+ if( rc ){
+ if( rc==SQLITE_EMPTY ){
+ assert( pCur->pgnoRoot==0 || pCur->pPage->nCell==0 );
+ *pRes = -1;
+ return SQLITE_OK;
+ }
+ return rc;
+ }
+ assert( pCur->pPage );
+ assert( pCur->pPage->isInit );
+ assert( pCur->eState==CURSOR_VALID );
+ assert( pCur->pPage->nCell > 0 );
+ assert( pCur->iPage==0 || pCur->apPage[0]->intKey==pCur->curIntKey );
+ assert( pCur->curIntKey );
+
+ for(;;){
+ int lwr, upr, idx, c;
+ Pgno chldPg;
+ MemPage *pPage = pCur->pPage;
+ u8 *pCell; /* Pointer to current cell in pPage */
+
+ /* pPage->nCell must be greater than zero. If this is the root-page
+ ** the cursor would have been INVALID above and this for(;;) loop
+ ** not run. If this is not the root-page, then the moveToChild() routine
+ ** would have already detected db corruption. Similarly, pPage must
+ ** be the right kind (index or table) of b-tree page. Otherwise
+ ** a moveToChild() or moveToRoot() call would have detected corruption. */
+ assert( pPage->nCell>0 );
+ assert( pPage->intKey );
+ lwr = 0;
+ upr = pPage->nCell-1;
+ assert( biasRight==0 || biasRight==1 );
+ idx = upr>>(1-biasRight); /* idx = biasRight ? upr : (lwr+upr)/2; */
+ for(;;){
+ i64 nCellKey;
+ pCell = findCellPastPtr(pPage, idx);
+ if( pPage->intKeyLeaf ){
+ while( 0x80 <= *(pCell++) ){
+ if( pCell>=pPage->aDataEnd ){
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ }
+ }
+ getVarint(pCell, (u64*)&nCellKey);
+ if( nCellKey<intKey ){
+ lwr = idx+1;
+ if( lwr>upr ){ c = -1; break; }
+ }else if( nCellKey>intKey ){
+ upr = idx-1;
+ if( lwr>upr ){ c = +1; break; }
+ }else{
+ assert( nCellKey==intKey );
+ pCur->ix = (u16)idx;
+ if( !pPage->leaf ){
+ lwr = idx;
+ goto moveto_table_next_layer;
+ }else{
+ pCur->curFlags |= BTCF_ValidNKey;
+ pCur->info.nKey = nCellKey;
+ pCur->info.nSize = 0;
+ *pRes = 0;
+ return SQLITE_OK;
+ }
+ }
+ assert( lwr+upr>=0 );
+ idx = (lwr+upr)>>1; /* idx = (lwr+upr)/2; */
+ }
+ assert( lwr==upr+1 || !pPage->leaf );
+ assert( pPage->isInit );
+ if( pPage->leaf ){
+ assert( pCur->ix<pCur->pPage->nCell );
+ pCur->ix = (u16)idx;
+ *pRes = c;
+ rc = SQLITE_OK;
+ goto moveto_table_finish;
+ }
+moveto_table_next_layer:
+ if( lwr>=pPage->nCell ){
+ chldPg = get4byte(&pPage->aData[pPage->hdrOffset+8]);
+ }else{
+ chldPg = get4byte(findCell(pPage, lwr));
+ }
+ pCur->ix = (u16)lwr;
+ rc = moveToChild(pCur, chldPg);
+ if( rc ) break;
+ }
+moveto_table_finish:
+ pCur->info.nSize = 0;
+ assert( (pCur->curFlags & BTCF_ValidOvfl)==0 );
+ return rc;
+}
+
+/*
+** Compare the "idx"-th cell on the page the cursor pCur is currently
+** pointing to to pIdxKey using xRecordCompare. Return negative or
+** zero if the cell is less than or equal pIdxKey. Return positive
+** if unknown.
+**
+** Return value negative: Cell at pCur[idx] less than pIdxKey
+**
+** Return value is zero: Cell at pCur[idx] equals pIdxKey
+**
+** Return value positive: Nothing is known about the relationship
+** of the cell at pCur[idx] and pIdxKey.
+**
+** This routine is part of an optimization. It is always safe to return
+** a positive value as that will cause the optimization to be skipped.
+*/
+static int indexCellCompare(
+ BtCursor *pCur,
+ int idx,
+ UnpackedRecord *pIdxKey,
+ RecordCompare xRecordCompare
+){
+ MemPage *pPage = pCur->pPage;
+ int c;
+ int nCell; /* Size of the pCell cell in bytes */
+ u8 *pCell = findCellPastPtr(pPage, idx);
+
+ nCell = pCell[0];
+ if( nCell<=pPage->max1bytePayload ){
+ /* This branch runs if the record-size field of the cell is a
+ ** single byte varint and the record fits entirely on the main
+ ** b-tree page. */
+ testcase( pCell+nCell+1==pPage->aDataEnd );
+ c = xRecordCompare(nCell, (void*)&pCell[1], pIdxKey);
+ }else if( !(pCell[1] & 0x80)
+ && (nCell = ((nCell&0x7f)<<7) + pCell[1])<=pPage->maxLocal
+ ){
+ /* The record-size field is a 2 byte varint and the record
+ ** fits entirely on the main b-tree page. */
+ testcase( pCell+nCell+2==pPage->aDataEnd );
+ c = xRecordCompare(nCell, (void*)&pCell[2], pIdxKey);
+ }else{
+ /* If the record extends into overflow pages, do not attempt
+ ** the optimization. */
+ c = 99;
+ }
+ return c;
+}
+
+/*
+** Return true (non-zero) if pCur is current pointing to the last
+** page of a table.
+*/
+static int cursorOnLastPage(BtCursor *pCur){
+ int i;
+ assert( pCur->eState==CURSOR_VALID );
+ for(i=0; i<pCur->iPage; i++){
+ MemPage *pPage = pCur->apPage[i];
+ if( pCur->aiIdx[i]<pPage->nCell ) return 0;
+ }
+ return 1;
+}
+
+/* Move the cursor so that it points to an entry in an index table
+** near the key pIdxKey. Return a success code.
+**
+** If an exact match is not found, then the cursor is always
+** left pointing at a leaf page which would hold the entry if it
+** were present. The cursor might point to an entry that comes
+** before or after the key.
+**
+** An integer is written into *pRes which is the result of
+** comparing the key with the entry to which the cursor is
+** pointing. The meaning of the integer written into
+** *pRes is as follows:
+**
+** *pRes<0 The cursor is left pointing at an entry that
+** is smaller than pIdxKey or if the table is empty
+** and the cursor is therefore left point to nothing.
+**
+** *pRes==0 The cursor is left pointing at an entry that
+** exactly matches pIdxKey.
+**
+** *pRes>0 The cursor is left pointing at an entry that
+** is larger than pIdxKey.
+**
+** The pIdxKey->eqSeen field is set to 1 if there
+** exists an entry in the table that exactly matches pIdxKey.
+*/
+SQLITE_PRIVATE int sqlite3BtreeIndexMoveto(
+ BtCursor *pCur, /* The cursor to be moved */
+ UnpackedRecord *pIdxKey, /* Unpacked index key */
+ int *pRes /* Write search results here */
+){
+ int rc;
+ RecordCompare xRecordCompare;
+
+ assert( cursorOwnsBtShared(pCur) );
+ assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
+ assert( pRes );
+ assert( pCur->pKeyInfo!=0 );
+
+#ifdef SQLITE_DEBUG
+ pCur->pBtree->nSeek++; /* Performance measurement during testing */
+#endif
+
+ xRecordCompare = sqlite3VdbeFindCompare(pIdxKey);
+ pIdxKey->errCode = 0;
+ assert( pIdxKey->default_rc==1
+ || pIdxKey->default_rc==0
+ || pIdxKey->default_rc==-1
+ );
+
+
+ /* Check to see if we can skip a lot of work. Two cases:
+ **
+ ** (1) If the cursor is already pointing to the very last cell
+ ** in the table and the pIdxKey search key is greater than or
+ ** equal to that last cell, then no movement is required.
+ **
+ ** (2) If the cursor is on the last page of the table and the first
+ ** cell on that last page is less than or equal to the pIdxKey
+ ** search key, then we can start the search on the current page
+ ** without needing to go back to root.
+ */
+ if( pCur->eState==CURSOR_VALID
+ && pCur->pPage->leaf
+ && cursorOnLastPage(pCur)
+ ){
+ int c;
+ if( pCur->ix==pCur->pPage->nCell-1
+ && (c = indexCellCompare(pCur, pCur->ix, pIdxKey, xRecordCompare))<=0
+ && pIdxKey->errCode==SQLITE_OK
+ ){
+ *pRes = c;
+ return SQLITE_OK; /* Cursor already pointing at the correct spot */
+ }
+ if( pCur->iPage>0
+ && indexCellCompare(pCur, 0, pIdxKey, xRecordCompare)<=0
+ && pIdxKey->errCode==SQLITE_OK
+ ){
+ pCur->curFlags &= ~(BTCF_ValidOvfl|BTCF_AtLast);
+ if( !pCur->pPage->isInit ){
+ return SQLITE_CORRUPT_BKPT;
+ }
+ goto bypass_moveto_root; /* Start search on the current page */
+ }
+ pIdxKey->errCode = SQLITE_OK;
+ }
+
+ rc = moveToRoot(pCur);
+ if( rc ){
+ if( rc==SQLITE_EMPTY ){
+ assert( pCur->pgnoRoot==0 || pCur->pPage->nCell==0 );
+ *pRes = -1;
+ return SQLITE_OK;
+ }
+ return rc;
+ }
+
+bypass_moveto_root:
+ assert( pCur->pPage );
+ assert( pCur->pPage->isInit );
+ assert( pCur->eState==CURSOR_VALID );
+ assert( pCur->pPage->nCell > 0 );
+ assert( pCur->curIntKey==0 );
+ assert( pIdxKey!=0 );
+ for(;;){
+ int lwr, upr, idx, c;
+ Pgno chldPg;
+ MemPage *pPage = pCur->pPage;
+ u8 *pCell; /* Pointer to current cell in pPage */
+
+ /* pPage->nCell must be greater than zero. If this is the root-page
+ ** the cursor would have been INVALID above and this for(;;) loop
+ ** not run. If this is not the root-page, then the moveToChild() routine
+ ** would have already detected db corruption. Similarly, pPage must
+ ** be the right kind (index or table) of b-tree page. Otherwise
+ ** a moveToChild() or moveToRoot() call would have detected corruption. */
+ assert( pPage->nCell>0 );
+ assert( pPage->intKey==0 );
+ lwr = 0;
+ upr = pPage->nCell-1;
+ idx = upr>>1; /* idx = (lwr+upr)/2; */
+ for(;;){
+ int nCell; /* Size of the pCell cell in bytes */
+ pCell = findCellPastPtr(pPage, idx);
+
+ /* The maximum supported page-size is 65536 bytes. This means that
+ ** the maximum number of record bytes stored on an index B-Tree
+ ** page is less than 16384 bytes and may be stored as a 2-byte
+ ** varint. This information is used to attempt to avoid parsing
+ ** the entire cell by checking for the cases where the record is
+ ** stored entirely within the b-tree page by inspecting the first
+ ** 2 bytes of the cell.
+ */
+ nCell = pCell[0];
+ if( nCell<=pPage->max1bytePayload ){
+ /* This branch runs if the record-size field of the cell is a
+ ** single byte varint and the record fits entirely on the main
+ ** b-tree page. */
+ testcase( pCell+nCell+1==pPage->aDataEnd );
+ c = xRecordCompare(nCell, (void*)&pCell[1], pIdxKey);
+ }else if( !(pCell[1] & 0x80)
+ && (nCell = ((nCell&0x7f)<<7) + pCell[1])<=pPage->maxLocal
+ ){
+ /* The record-size field is a 2 byte varint and the record
+ ** fits entirely on the main b-tree page. */
+ testcase( pCell+nCell+2==pPage->aDataEnd );
+ c = xRecordCompare(nCell, (void*)&pCell[2], pIdxKey);
+ }else{
+ /* The record flows over onto one or more overflow pages. In
+ ** this case the whole cell needs to be parsed, a buffer allocated
+ ** and accessPayload() used to retrieve the record into the
+ ** buffer before VdbeRecordCompare() can be called.
+ **
+ ** If the record is corrupt, the xRecordCompare routine may read
+ ** up to two varints past the end of the buffer. An extra 18
+ ** bytes of padding is allocated at the end of the buffer in
+ ** case this happens. */
+ void *pCellKey;
+ u8 * const pCellBody = pCell - pPage->childPtrSize;
+ const int nOverrun = 18; /* Size of the overrun padding */
+ pPage->xParseCell(pPage, pCellBody, &pCur->info);
+ nCell = (int)pCur->info.nKey;
+ testcase( nCell<0 ); /* True if key size is 2^32 or more */
+ testcase( nCell==0 ); /* Invalid key size: 0x80 0x80 0x00 */
+ testcase( nCell==1 ); /* Invalid key size: 0x80 0x80 0x01 */
+ testcase( nCell==2 ); /* Minimum legal index key size */
+ if( nCell<2 || nCell/pCur->pBt->usableSize>pCur->pBt->nPage ){
+ rc = SQLITE_CORRUPT_PAGE(pPage);
+ goto moveto_index_finish;
+ }
+ pCellKey = sqlite3Malloc( nCell+nOverrun );
+ if( pCellKey==0 ){
+ rc = SQLITE_NOMEM_BKPT;
+ goto moveto_index_finish;
+ }
+ pCur->ix = (u16)idx;
+ rc = accessPayload(pCur, 0, nCell, (unsigned char*)pCellKey, 0);
+ memset(((u8*)pCellKey)+nCell,0,nOverrun); /* Fix uninit warnings */
+ pCur->curFlags &= ~BTCF_ValidOvfl;
+ if( rc ){
+ sqlite3_free(pCellKey);
+ goto moveto_index_finish;
+ }
+ c = sqlite3VdbeRecordCompare(nCell, pCellKey, pIdxKey);
+ sqlite3_free(pCellKey);
+ }
+ assert(
+ (pIdxKey->errCode!=SQLITE_CORRUPT || c==0)
+ && (pIdxKey->errCode!=SQLITE_NOMEM || pCur->pBtree->db->mallocFailed)
+ );
+ if( c<0 ){
+ lwr = idx+1;
+ }else if( c>0 ){
+ upr = idx-1;
+ }else{
+ assert( c==0 );
+ *pRes = 0;
+ rc = SQLITE_OK;
+ pCur->ix = (u16)idx;
+ if( pIdxKey->errCode ) rc = SQLITE_CORRUPT_BKPT;
+ goto moveto_index_finish;
+ }
+ if( lwr>upr ) break;
+ assert( lwr+upr>=0 );
+ idx = (lwr+upr)>>1; /* idx = (lwr+upr)/2 */
+ }
+ assert( lwr==upr+1 || (pPage->intKey && !pPage->leaf) );
+ assert( pPage->isInit );
+ if( pPage->leaf ){
+ assert( pCur->ix<pCur->pPage->nCell || CORRUPT_DB );
+ pCur->ix = (u16)idx;
+ *pRes = c;
+ rc = SQLITE_OK;
+ goto moveto_index_finish;
+ }
+ if( lwr>=pPage->nCell ){
+ chldPg = get4byte(&pPage->aData[pPage->hdrOffset+8]);
+ }else{
+ chldPg = get4byte(findCell(pPage, lwr));
+ }
+
+ /* This block is similar to an in-lined version of:
+ **
+ ** pCur->ix = (u16)lwr;
+ ** rc = moveToChild(pCur, chldPg);
+ ** if( rc ) break;
+ */
+ pCur->info.nSize = 0;
+ pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl);
+ if( pCur->iPage>=(BTCURSOR_MAX_DEPTH-1) ){
+ return SQLITE_CORRUPT_BKPT;
+ }
+ pCur->aiIdx[pCur->iPage] = (u16)lwr;
+ pCur->apPage[pCur->iPage] = pCur->pPage;
+ pCur->ix = 0;
+ pCur->iPage++;
+ rc = getAndInitPage(pCur->pBt, chldPg, &pCur->pPage, pCur->curPagerFlags);
+ if( rc==SQLITE_OK
+ && (pCur->pPage->nCell<1 || pCur->pPage->intKey!=pCur->curIntKey)
+ ){
+ releasePage(pCur->pPage);
+ rc = SQLITE_CORRUPT_PGNO(chldPg);
+ }
+ if( rc ){
+ pCur->pPage = pCur->apPage[--pCur->iPage];
+ break;
+ }
+ /*
+ ***** End of in-lined moveToChild() call */
+ }
+moveto_index_finish:
+ pCur->info.nSize = 0;
+ assert( (pCur->curFlags & BTCF_ValidOvfl)==0 );
+ return rc;
+}
+
+
+/*
+** Return TRUE if the cursor is not pointing at an entry of the table.
+**
+** TRUE will be returned after a call to sqlite3BtreeNext() moves
+** past the last entry in the table or sqlite3BtreePrev() moves past
+** the first entry. TRUE is also returned if the table is empty.
+*/
+SQLITE_PRIVATE int sqlite3BtreeEof(BtCursor *pCur){
+ /* TODO: What if the cursor is in CURSOR_REQUIRESEEK but all table entries
+ ** have been deleted? This API will need to change to return an error code
+ ** as well as the boolean result value.
+ */
+ return (CURSOR_VALID!=pCur->eState);
+}
+
+/*
+** Return an estimate for the number of rows in the table that pCur is
+** pointing to. Return a negative number if no estimate is currently
+** available.
+*/
+SQLITE_PRIVATE i64 sqlite3BtreeRowCountEst(BtCursor *pCur){
+ i64 n;
+ u8 i;
+
+ assert( cursorOwnsBtShared(pCur) );
+ assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
+
+ /* Currently this interface is only called by the OP_IfSizeBetween
+ ** opcode and the OP_Count opcode with P3=1. In either case,
+ ** the cursor will always be valid unless the btree is empty. */
+ if( pCur->eState!=CURSOR_VALID ) return 0;
+ if( NEVER(pCur->pPage->leaf==0) ) return -1;
+
+ n = pCur->pPage->nCell;
+ for(i=0; i<pCur->iPage; i++){
+ n *= pCur->apPage[i]->nCell;
+ }
+ return n;
+}
+
+/*
+** Advance the cursor to the next entry in the database.
+** Return value:
+**
+** SQLITE_OK success
+** SQLITE_DONE cursor is already pointing at the last element
+** otherwise some kind of error occurred
+**
+** The main entry point is sqlite3BtreeNext(). That routine is optimized
+** for the common case of merely incrementing the cell counter BtCursor.aiIdx
+** to the next cell on the current page. The (slower) btreeNext() helper
+** routine is called when it is necessary to move to a different page or
+** to restore the cursor.
+**
+** If bit 0x01 of the F argument in sqlite3BtreeNext(C,F) is 1, then the
+** cursor corresponds to an SQL index and this routine could have been
+** skipped if the SQL index had been a unique index. The F argument
+** is a hint to the implement. SQLite btree implementation does not use
+** this hint, but COMDB2 does.
+*/
+static SQLITE_NOINLINE int btreeNext(BtCursor *pCur){
+ int rc;
+ int idx;
+ MemPage *pPage;
+
+ assert( cursorOwnsBtShared(pCur) );
+ if( pCur->eState!=CURSOR_VALID ){
+ assert( (pCur->curFlags & BTCF_ValidOvfl)==0 );
+ rc = restoreCursorPosition(pCur);
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+ if( CURSOR_INVALID==pCur->eState ){
+ return SQLITE_DONE;
+ }
+ if( pCur->eState==CURSOR_SKIPNEXT ){
+ pCur->eState = CURSOR_VALID;
+ if( pCur->skipNext>0 ) return SQLITE_OK;
+ }
+ }
+
+ pPage = pCur->pPage;
+ idx = ++pCur->ix;
+ if( sqlite3FaultSim(412) ) pPage->isInit = 0;
+ if( !pPage->isInit ){
+ return SQLITE_CORRUPT_BKPT;
+ }
+
+ if( idx>=pPage->nCell ){
+ if( !pPage->leaf ){
+ rc = moveToChild(pCur, get4byte(&pPage->aData[pPage->hdrOffset+8]));
+ if( rc ) return rc;
+ return moveToLeftmost(pCur);
+ }
+ do{
+ if( pCur->iPage==0 ){
+ pCur->eState = CURSOR_INVALID;
+ return SQLITE_DONE;
+ }
+ moveToParent(pCur);
+ pPage = pCur->pPage;
+ }while( pCur->ix>=pPage->nCell );
+ if( pPage->intKey ){
+ return sqlite3BtreeNext(pCur, 0);
+ }else{
+ return SQLITE_OK;
+ }
+ }
+ if( pPage->leaf ){
+ return SQLITE_OK;
+ }else{
+ return moveToLeftmost(pCur);
+ }
+}
+SQLITE_PRIVATE int sqlite3BtreeNext(BtCursor *pCur, int flags){
+ MemPage *pPage;
+ UNUSED_PARAMETER( flags ); /* Used in COMDB2 but not native SQLite */
+ assert( cursorOwnsBtShared(pCur) );
+ assert( flags==0 || flags==1 );
+ pCur->info.nSize = 0;
+ pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl);
+ if( pCur->eState!=CURSOR_VALID ) return btreeNext(pCur);
+ pPage = pCur->pPage;
+ if( (++pCur->ix)>=pPage->nCell ){
+ pCur->ix--;
+ return btreeNext(pCur);
+ }
+ if( pPage->leaf ){
+ return SQLITE_OK;
+ }else{
+ return moveToLeftmost(pCur);
+ }
+}
+
+/*
+** Step the cursor to the back to the previous entry in the database.
+** Return values:
+**
+** SQLITE_OK success
+** SQLITE_DONE the cursor is already on the first element of the table
+** otherwise some kind of error occurred
+**
+** The main entry point is sqlite3BtreePrevious(). That routine is optimized
+** for the common case of merely decrementing the cell counter BtCursor.aiIdx
+** to the previous cell on the current page. The (slower) btreePrevious()
+** helper routine is called when it is necessary to move to a different page
+** or to restore the cursor.
+**
+** If bit 0x01 of the F argument to sqlite3BtreePrevious(C,F) is 1, then
+** the cursor corresponds to an SQL index and this routine could have been
+** skipped if the SQL index had been a unique index. The F argument is a
+** hint to the implement. The native SQLite btree implementation does not
+** use this hint, but COMDB2 does.
+*/
+static SQLITE_NOINLINE int btreePrevious(BtCursor *pCur){
+ int rc;
+ MemPage *pPage;
+
+ assert( cursorOwnsBtShared(pCur) );
+ assert( (pCur->curFlags & (BTCF_AtLast|BTCF_ValidOvfl|BTCF_ValidNKey))==0 );
+ assert( pCur->info.nSize==0 );
+ if( pCur->eState!=CURSOR_VALID ){
+ rc = restoreCursorPosition(pCur);
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+ if( CURSOR_INVALID==pCur->eState ){
+ return SQLITE_DONE;
+ }
+ if( CURSOR_SKIPNEXT==pCur->eState ){
+ pCur->eState = CURSOR_VALID;
+ if( pCur->skipNext<0 ) return SQLITE_OK;
+ }
+ }
+
+ pPage = pCur->pPage;
+ if( sqlite3FaultSim(412) ) pPage->isInit = 0;
+ if( !pPage->isInit ){
+ return SQLITE_CORRUPT_BKPT;
+ }
+ if( !pPage->leaf ){
+ int idx = pCur->ix;
+ rc = moveToChild(pCur, get4byte(findCell(pPage, idx)));
+ if( rc ) return rc;
+ rc = moveToRightmost(pCur);
+ }else{
+ while( pCur->ix==0 ){
+ if( pCur->iPage==0 ){
+ pCur->eState = CURSOR_INVALID;
+ return SQLITE_DONE;
+ }
+ moveToParent(pCur);
+ }
+ assert( pCur->info.nSize==0 );
+ assert( (pCur->curFlags & (BTCF_ValidOvfl))==0 );
+
+ pCur->ix--;
+ pPage = pCur->pPage;
+ if( pPage->intKey && !pPage->leaf ){
+ rc = sqlite3BtreePrevious(pCur, 0);
+ }else{
+ rc = SQLITE_OK;
+ }
+ }
+ return rc;
+}
+SQLITE_PRIVATE int sqlite3BtreePrevious(BtCursor *pCur, int flags){
+ assert( cursorOwnsBtShared(pCur) );
+ assert( flags==0 || flags==1 );
+ UNUSED_PARAMETER( flags ); /* Used in COMDB2 but not native SQLite */
+ pCur->curFlags &= ~(BTCF_AtLast|BTCF_ValidOvfl|BTCF_ValidNKey);
+ pCur->info.nSize = 0;
+ if( pCur->eState!=CURSOR_VALID
+ || pCur->ix==0
+ || pCur->pPage->leaf==0
+ ){
+ return btreePrevious(pCur);
+ }
+ pCur->ix--;
+ return SQLITE_OK;
+}
+
+/*
+** Allocate a new page from the database file.
+**
+** The new page is marked as dirty. (In other words, sqlite3PagerWrite()
+** has already been called on the new page.) The new page has also
+** been referenced and the calling routine is responsible for calling
+** sqlite3PagerUnref() on the new page when it is done.
+**
+** SQLITE_OK is returned on success. Any other return value indicates
+** an error. *ppPage is set to NULL in the event of an error.
+**
+** If the "nearby" parameter is not 0, then an effort is made to
+** locate a page close to the page number "nearby". This can be used in an
+** attempt to keep related pages close to each other in the database file,
+** which in turn can make database access faster.
+**
+** If the eMode parameter is BTALLOC_EXACT and the nearby page exists
+** anywhere on the free-list, then it is guaranteed to be returned. If
+** eMode is BTALLOC_LT then the page returned will be less than or equal
+** to nearby if any such page exists. If eMode is BTALLOC_ANY then there
+** are no restrictions on which page is returned.
+*/
+static int allocateBtreePage(
+ BtShared *pBt, /* The btree */
+ MemPage **ppPage, /* Store pointer to the allocated page here */
+ Pgno *pPgno, /* Store the page number here */
+ Pgno nearby, /* Search for a page near this one */
+ u8 eMode /* BTALLOC_EXACT, BTALLOC_LT, or BTALLOC_ANY */
+){
+ MemPage *pPage1;
+ int rc;
+ u32 n; /* Number of pages on the freelist */
+ u32 k; /* Number of leaves on the trunk of the freelist */
+ MemPage *pTrunk = 0;
+ MemPage *pPrevTrunk = 0;
+ Pgno mxPage; /* Total size of the database file */
+
+ assert( sqlite3_mutex_held(pBt->mutex) );
+ assert( eMode==BTALLOC_ANY || (nearby>0 && IfNotOmitAV(pBt->autoVacuum)) );
+ pPage1 = pBt->pPage1;
+ mxPage = btreePagecount(pBt);
+ /* EVIDENCE-OF: R-21003-45125 The 4-byte big-endian integer at offset 36
+ ** stores the total number of pages on the freelist. */
+ n = get4byte(&pPage1->aData[36]);
+ testcase( n==mxPage-1 );
+ if( n>=mxPage ){
+ return SQLITE_CORRUPT_BKPT;
+ }
+ if( n>0 ){
+ /* There are pages on the freelist. Reuse one of those pages. */
+ Pgno iTrunk;
+ u8 searchList = 0; /* If the free-list must be searched for 'nearby' */
+ u32 nSearch = 0; /* Count of the number of search attempts */
+
+ /* If eMode==BTALLOC_EXACT and a query of the pointer-map
+ ** shows that the page 'nearby' is somewhere on the free-list, then
+ ** the entire-list will be searched for that page.
+ */
+#ifndef SQLITE_OMIT_AUTOVACUUM
+ if( eMode==BTALLOC_EXACT ){
+ if( nearby<=mxPage ){
+ u8 eType;
+ assert( nearby>0 );
+ assert( pBt->autoVacuum );
+ rc = ptrmapGet(pBt, nearby, &eType, 0);
+ if( rc ) return rc;
+ if( eType==PTRMAP_FREEPAGE ){
+ searchList = 1;
+ }
+ }
+ }else if( eMode==BTALLOC_LE ){
+ searchList = 1;
+ }
+#endif
+
+ /* Decrement the free-list count by 1. Set iTrunk to the index of the
+ ** first free-list trunk page. iPrevTrunk is initially 1.
+ */
+ rc = sqlite3PagerWrite(pPage1->pDbPage);
+ if( rc ) return rc;
+ put4byte(&pPage1->aData[36], n-1);
+
+ /* The code within this loop is run only once if the 'searchList' variable
+ ** is not true. Otherwise, it runs once for each trunk-page on the
+ ** free-list until the page 'nearby' is located (eMode==BTALLOC_EXACT)
+ ** or until a page less than 'nearby' is located (eMode==BTALLOC_LT)
+ */
+ do {
+ pPrevTrunk = pTrunk;
+ if( pPrevTrunk ){
+ /* EVIDENCE-OF: R-01506-11053 The first integer on a freelist trunk page
+ ** is the page number of the next freelist trunk page in the list or
+ ** zero if this is the last freelist trunk page. */
+ iTrunk = get4byte(&pPrevTrunk->aData[0]);
+ }else{
+ /* EVIDENCE-OF: R-59841-13798 The 4-byte big-endian integer at offset 32
+ ** stores the page number of the first page of the freelist, or zero if
+ ** the freelist is empty. */
+ iTrunk = get4byte(&pPage1->aData[32]);
+ }
+ testcase( iTrunk==mxPage );
+ if( iTrunk>mxPage || nSearch++ > n ){
+ rc = SQLITE_CORRUPT_PGNO(pPrevTrunk ? pPrevTrunk->pgno : 1);
+ }else{
+ rc = btreeGetUnusedPage(pBt, iTrunk, &pTrunk, 0);
+ }
+ if( rc ){
+ pTrunk = 0;
+ goto end_allocate_page;
+ }
+ assert( pTrunk!=0 );
+ assert( pTrunk->aData!=0 );
+ /* EVIDENCE-OF: R-13523-04394 The second integer on a freelist trunk page
+ ** is the number of leaf page pointers to follow. */
+ k = get4byte(&pTrunk->aData[4]);
+ if( k==0 && !searchList ){
+ /* The trunk has no leaves and the list is not being searched.
+ ** So extract the trunk page itself and use it as the newly
+ ** allocated page */
+ assert( pPrevTrunk==0 );
+ rc = sqlite3PagerWrite(pTrunk->pDbPage);
+ if( rc ){
+ goto end_allocate_page;
+ }
+ *pPgno = iTrunk;
+ memcpy(&pPage1->aData[32], &pTrunk->aData[0], 4);
+ *ppPage = pTrunk;
+ pTrunk = 0;
+ TRACE(("ALLOCATE: %u trunk - %u free pages left\n", *pPgno, n-1));
+ }else if( k>(u32)(pBt->usableSize/4 - 2) ){
+ /* Value of k is out of range. Database corruption */
+ rc = SQLITE_CORRUPT_PGNO(iTrunk);
+ goto end_allocate_page;
+#ifndef SQLITE_OMIT_AUTOVACUUM
+ }else if( searchList
+ && (nearby==iTrunk || (iTrunk<nearby && eMode==BTALLOC_LE))
+ ){
+ /* The list is being searched and this trunk page is the page
+ ** to allocate, regardless of whether it has leaves.
+ */
+ *pPgno = iTrunk;
+ *ppPage = pTrunk;
+ searchList = 0;
+ rc = sqlite3PagerWrite(pTrunk->pDbPage);
+ if( rc ){
+ goto end_allocate_page;
+ }
+ if( k==0 ){
+ if( !pPrevTrunk ){
+ memcpy(&pPage1->aData[32], &pTrunk->aData[0], 4);
+ }else{
+ rc = sqlite3PagerWrite(pPrevTrunk->pDbPage);
+ if( rc!=SQLITE_OK ){
+ goto end_allocate_page;
+ }
+ memcpy(&pPrevTrunk->aData[0], &pTrunk->aData[0], 4);
+ }
+ }else{
+ /* The trunk page is required by the caller but it contains
+ ** pointers to free-list leaves. The first leaf becomes a trunk
+ ** page in this case.
+ */
+ MemPage *pNewTrunk;
+ Pgno iNewTrunk = get4byte(&pTrunk->aData[8]);
+ if( iNewTrunk>mxPage ){
+ rc = SQLITE_CORRUPT_PGNO(iTrunk);
+ goto end_allocate_page;
+ }
+ testcase( iNewTrunk==mxPage );
+ rc = btreeGetUnusedPage(pBt, iNewTrunk, &pNewTrunk, 0);
+ if( rc!=SQLITE_OK ){
+ goto end_allocate_page;
+ }
+ rc = sqlite3PagerWrite(pNewTrunk->pDbPage);
+ if( rc!=SQLITE_OK ){
+ releasePage(pNewTrunk);
+ goto end_allocate_page;
+ }
+ memcpy(&pNewTrunk->aData[0], &pTrunk->aData[0], 4);
+ put4byte(&pNewTrunk->aData[4], k-1);
+ memcpy(&pNewTrunk->aData[8], &pTrunk->aData[12], (k-1)*4);
+ releasePage(pNewTrunk);
+ if( !pPrevTrunk ){
+ assert( sqlite3PagerIswriteable(pPage1->pDbPage) );
+ put4byte(&pPage1->aData[32], iNewTrunk);
+ }else{
+ rc = sqlite3PagerWrite(pPrevTrunk->pDbPage);
+ if( rc ){
+ goto end_allocate_page;
+ }
+ put4byte(&pPrevTrunk->aData[0], iNewTrunk);
+ }
+ }
+ pTrunk = 0;
+ TRACE(("ALLOCATE: %u trunk - %u free pages left\n", *pPgno, n-1));
+#endif
+ }else if( k>0 ){
+ /* Extract a leaf from the trunk */
+ u32 closest;
+ Pgno iPage;
+ unsigned char *aData = pTrunk->aData;
+ if( nearby>0 ){
+ u32 i;
+ closest = 0;
+ if( eMode==BTALLOC_LE ){
+ for(i=0; i<k; i++){
+ iPage = get4byte(&aData[8+i*4]);
+ if( iPage<=nearby ){
+ closest = i;
+ break;
+ }
+ }
+ }else{
+ int dist;
+ dist = sqlite3AbsInt32(get4byte(&aData[8]) - nearby);
+ for(i=1; i<k; i++){
+ int d2 = sqlite3AbsInt32(get4byte(&aData[8+i*4]) - nearby);
+ if( d2<dist ){
+ closest = i;
+ dist = d2;
+ }
+ }
+ }
+ }else{
+ closest = 0;
+ }
+
+ iPage = get4byte(&aData[8+closest*4]);
+ testcase( iPage==mxPage );
+ if( iPage>mxPage || iPage<2 ){
+ rc = SQLITE_CORRUPT_PGNO(iTrunk);
+ goto end_allocate_page;
+ }
+ testcase( iPage==mxPage );
+ if( !searchList
+ || (iPage==nearby || (iPage<nearby && eMode==BTALLOC_LE))
+ ){
+ int noContent;
+ *pPgno = iPage;
+ TRACE(("ALLOCATE: %u was leaf %u of %u on trunk %u"
+ ": %u more free pages\n",
+ *pPgno, closest+1, k, pTrunk->pgno, n-1));
+ rc = sqlite3PagerWrite(pTrunk->pDbPage);
+ if( rc ) goto end_allocate_page;
+ if( closest<k-1 ){
+ memcpy(&aData[8+closest*4], &aData[4+k*4], 4);
+ }
+ put4byte(&aData[4], k-1);
+ noContent = !btreeGetHasContent(pBt, *pPgno)? PAGER_GET_NOCONTENT : 0;
+ rc = btreeGetUnusedPage(pBt, *pPgno, ppPage, noContent);
+ if( rc==SQLITE_OK ){
+ rc = sqlite3PagerWrite((*ppPage)->pDbPage);
+ if( rc!=SQLITE_OK ){
+ releasePage(*ppPage);
+ *ppPage = 0;
+ }
+ }
+ searchList = 0;
+ }
+ }
+ releasePage(pPrevTrunk);
+ pPrevTrunk = 0;
+ }while( searchList );
+ }else{
+ /* There are no pages on the freelist, so append a new page to the
+ ** database image.
+ **
+ ** Normally, new pages allocated by this block can be requested from the
+ ** pager layer with the 'no-content' flag set. This prevents the pager
+ ** from trying to read the pages content from disk. However, if the
+ ** current transaction has already run one or more incremental-vacuum
+ ** steps, then the page we are about to allocate may contain content
+ ** that is required in the event of a rollback. In this case, do
+ ** not set the no-content flag. This causes the pager to load and journal
+ ** the current page content before overwriting it.
+ **
+ ** Note that the pager will not actually attempt to load or journal
+ ** content for any page that really does lie past the end of the database
+ ** file on disk. So the effects of disabling the no-content optimization
+ ** here are confined to those pages that lie between the end of the
+ ** database image and the end of the database file.
+ */
+ int bNoContent = (0==IfNotOmitAV(pBt->bDoTruncate))? PAGER_GET_NOCONTENT:0;
+
+ rc = sqlite3PagerWrite(pBt->pPage1->pDbPage);
+ if( rc ) return rc;
+ pBt->nPage++;
+ if( pBt->nPage==PENDING_BYTE_PAGE(pBt) ) pBt->nPage++;
+
+#ifndef SQLITE_OMIT_AUTOVACUUM
+ if( pBt->autoVacuum && PTRMAP_ISPAGE(pBt, pBt->nPage) ){
+ /* If *pPgno refers to a pointer-map page, allocate two new pages
+ ** at the end of the file instead of one. The first allocated page
+ ** becomes a new pointer-map page, the second is used by the caller.
+ */
+ MemPage *pPg = 0;
+ TRACE(("ALLOCATE: %u from end of file (pointer-map page)\n", pBt->nPage));
+ assert( pBt->nPage!=PENDING_BYTE_PAGE(pBt) );
+ rc = btreeGetUnusedPage(pBt, pBt->nPage, &pPg, bNoContent);
+ if( rc==SQLITE_OK ){
+ rc = sqlite3PagerWrite(pPg->pDbPage);
+ releasePage(pPg);
+ }
+ if( rc ) return rc;
+ pBt->nPage++;
+ if( pBt->nPage==PENDING_BYTE_PAGE(pBt) ){ pBt->nPage++; }
+ }
+#endif
+ put4byte(28 + (u8*)pBt->pPage1->aData, pBt->nPage);
+ *pPgno = pBt->nPage;
+
+ assert( *pPgno!=PENDING_BYTE_PAGE(pBt) );
+ rc = btreeGetUnusedPage(pBt, *pPgno, ppPage, bNoContent);
+ if( rc ) return rc;
+ rc = sqlite3PagerWrite((*ppPage)->pDbPage);
+ if( rc!=SQLITE_OK ){
+ releasePage(*ppPage);
+ *ppPage = 0;
+ }
+ TRACE(("ALLOCATE: %u from end of file\n", *pPgno));
+ }
+
+ assert( CORRUPT_DB || *pPgno!=PENDING_BYTE_PAGE(pBt) );
+
+end_allocate_page:
+ releasePage(pTrunk);
+ releasePage(pPrevTrunk);
+ assert( rc!=SQLITE_OK || sqlite3PagerPageRefcount((*ppPage)->pDbPage)<=1 );
+ assert( rc!=SQLITE_OK || (*ppPage)->isInit==0 );
+ return rc;
+}
+
+/*
+** This function is used to add page iPage to the database file free-list.
+** It is assumed that the page is not already a part of the free-list.
+**
+** The value passed as the second argument to this function is optional.
+** If the caller happens to have a pointer to the MemPage object
+** corresponding to page iPage handy, it may pass it as the second value.
+** Otherwise, it may pass NULL.
+**
+** If a pointer to a MemPage object is passed as the second argument,
+** its reference count is not altered by this function.
+*/
+static int freePage2(BtShared *pBt, MemPage *pMemPage, Pgno iPage){
+ MemPage *pTrunk = 0; /* Free-list trunk page */
+ Pgno iTrunk = 0; /* Page number of free-list trunk page */
+ MemPage *pPage1 = pBt->pPage1; /* Local reference to page 1 */
+ MemPage *pPage; /* Page being freed. May be NULL. */
+ int rc; /* Return Code */
+ u32 nFree; /* Initial number of pages on free-list */
+
+ assert( sqlite3_mutex_held(pBt->mutex) );
+ assert( CORRUPT_DB || iPage>1 );
+ assert( !pMemPage || pMemPage->pgno==iPage );
+
+ if( iPage<2 || iPage>pBt->nPage ){
+ return SQLITE_CORRUPT_BKPT;
+ }
+ if( pMemPage ){
+ pPage = pMemPage;
+ sqlite3PagerRef(pPage->pDbPage);
+ }else{
+ pPage = btreePageLookup(pBt, iPage);
+ }
+
+ /* Increment the free page count on pPage1 */
+ rc = sqlite3PagerWrite(pPage1->pDbPage);
+ if( rc ) goto freepage_out;
+ nFree = get4byte(&pPage1->aData[36]);
+ put4byte(&pPage1->aData[36], nFree+1);
+
+ if( pBt->btsFlags & BTS_SECURE_DELETE ){
+ /* If the secure_delete option is enabled, then
+ ** always fully overwrite deleted information with zeros.
+ */
+ if( (!pPage && ((rc = btreeGetPage(pBt, iPage, &pPage, 0))!=0) )
+ || ((rc = sqlite3PagerWrite(pPage->pDbPage))!=0)
+ ){
+ goto freepage_out;
+ }
+ memset(pPage->aData, 0, pPage->pBt->pageSize);
+ }
+
+ /* If the database supports auto-vacuum, write an entry in the pointer-map
+ ** to indicate that the page is free.
+ */
+ if( ISAUTOVACUUM(pBt) ){
+ ptrmapPut(pBt, iPage, PTRMAP_FREEPAGE, 0, &rc);
+ if( rc ) goto freepage_out;
+ }
+
+ /* Now manipulate the actual database free-list structure. There are two
+ ** possibilities. If the free-list is currently empty, or if the first
+ ** trunk page in the free-list is full, then this page will become a
+ ** new free-list trunk page. Otherwise, it will become a leaf of the
+ ** first trunk page in the current free-list. This block tests if it
+ ** is possible to add the page as a new free-list leaf.
+ */
+ if( nFree!=0 ){
+ u32 nLeaf; /* Initial number of leaf cells on trunk page */
+
+ iTrunk = get4byte(&pPage1->aData[32]);
+ if( iTrunk>btreePagecount(pBt) ){
+ rc = SQLITE_CORRUPT_BKPT;
+ goto freepage_out;
+ }
+ rc = btreeGetPage(pBt, iTrunk, &pTrunk, 0);
+ if( rc!=SQLITE_OK ){
+ goto freepage_out;
+ }
+
+ nLeaf = get4byte(&pTrunk->aData[4]);
+ assert( pBt->usableSize>32 );
+ if( nLeaf > (u32)pBt->usableSize/4 - 2 ){
+ rc = SQLITE_CORRUPT_BKPT;
+ goto freepage_out;
+ }
+ if( nLeaf < (u32)pBt->usableSize/4 - 8 ){
+ /* In this case there is room on the trunk page to insert the page
+ ** being freed as a new leaf.
+ **
+ ** Note that the trunk page is not really full until it contains
+ ** usableSize/4 - 2 entries, not usableSize/4 - 8 entries as we have
+ ** coded. But due to a coding error in versions of SQLite prior to
+ ** 3.6.0, databases with freelist trunk pages holding more than
+ ** usableSize/4 - 8 entries will be reported as corrupt. In order
+ ** to maintain backwards compatibility with older versions of SQLite,
+ ** we will continue to restrict the number of entries to usableSize/4 - 8
+ ** for now. At some point in the future (once everyone has upgraded
+ ** to 3.6.0 or later) we should consider fixing the conditional above
+ ** to read "usableSize/4-2" instead of "usableSize/4-8".
+ **
+ ** EVIDENCE-OF: R-19920-11576 However, newer versions of SQLite still
+ ** avoid using the last six entries in the freelist trunk page array in
+ ** order that database files created by newer versions of SQLite can be
+ ** read by older versions of SQLite.
+ */
+ rc = sqlite3PagerWrite(pTrunk->pDbPage);
+ if( rc==SQLITE_OK ){
+ put4byte(&pTrunk->aData[4], nLeaf+1);
+ put4byte(&pTrunk->aData[8+nLeaf*4], iPage);
+ if( pPage && (pBt->btsFlags & BTS_SECURE_DELETE)==0 ){
+ sqlite3PagerDontWrite(pPage->pDbPage);
+ }
+ rc = btreeSetHasContent(pBt, iPage);
+ }
+ TRACE(("FREE-PAGE: %u leaf on trunk page %u\n",pPage->pgno,pTrunk->pgno));
+ goto freepage_out;
+ }
+ }
+
+ /* If control flows to this point, then it was not possible to add the
+ ** the page being freed as a leaf page of the first trunk in the free-list.
+ ** Possibly because the free-list is empty, or possibly because the
+ ** first trunk in the free-list is full. Either way, the page being freed
+ ** will become the new first trunk page in the free-list.
+ */
+ if( pPage==0 && SQLITE_OK!=(rc = btreeGetPage(pBt, iPage, &pPage, 0)) ){
+ goto freepage_out;
+ }
+ rc = sqlite3PagerWrite(pPage->pDbPage);
+ if( rc!=SQLITE_OK ){
+ goto freepage_out;
+ }
+ put4byte(pPage->aData, iTrunk);
+ put4byte(&pPage->aData[4], 0);
+ put4byte(&pPage1->aData[32], iPage);
+ TRACE(("FREE-PAGE: %u new trunk page replacing %u\n", pPage->pgno, iTrunk));
+
+freepage_out:
+ if( pPage ){
+ pPage->isInit = 0;
+ }
+ releasePage(pPage);
+ releasePage(pTrunk);
+ return rc;
+}
+static void freePage(MemPage *pPage, int *pRC){
+ if( (*pRC)==SQLITE_OK ){
+ *pRC = freePage2(pPage->pBt, pPage, pPage->pgno);
+ }
+}
+
+/*
+** Free the overflow pages associated with the given Cell.
+*/
+static SQLITE_NOINLINE int clearCellOverflow(
+ MemPage *pPage, /* The page that contains the Cell */
+ unsigned char *pCell, /* First byte of the Cell */
+ CellInfo *pInfo /* Size information about the cell */
+){
+ BtShared *pBt;
+ Pgno ovflPgno;
+ int rc;
+ int nOvfl;
+ u32 ovflPageSize;
+
+ assert( sqlite3_mutex_held(pPage->pBt->mutex) );
+ assert( pInfo->nLocal!=pInfo->nPayload );
+ testcase( pCell + pInfo->nSize == pPage->aDataEnd );
+ testcase( pCell + (pInfo->nSize-1) == pPage->aDataEnd );
+ if( pCell + pInfo->nSize > pPage->aDataEnd ){
+ /* Cell extends past end of page */
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ ovflPgno = get4byte(pCell + pInfo->nSize - 4);
+ pBt = pPage->pBt;
+ assert( pBt->usableSize > 4 );
+ ovflPageSize = pBt->usableSize - 4;
+ nOvfl = (pInfo->nPayload - pInfo->nLocal + ovflPageSize - 1)/ovflPageSize;
+ assert( nOvfl>0 ||
+ (CORRUPT_DB && (pInfo->nPayload + ovflPageSize)<ovflPageSize)
+ );
+ while( nOvfl-- ){
+ Pgno iNext = 0;
+ MemPage *pOvfl = 0;
+ if( ovflPgno<2 || ovflPgno>btreePagecount(pBt) ){
+ /* 0 is not a legal page number and page 1 cannot be an
+ ** overflow page. Therefore if ovflPgno<2 or past the end of the
+ ** file the database must be corrupt. */
+ return SQLITE_CORRUPT_BKPT;
+ }
+ if( nOvfl ){
+ rc = getOverflowPage(pBt, ovflPgno, &pOvfl, &iNext);
+ if( rc ) return rc;
+ }
+
+ if( ( pOvfl || ((pOvfl = btreePageLookup(pBt, ovflPgno))!=0) )
+ && sqlite3PagerPageRefcount(pOvfl->pDbPage)!=1
+ ){
+ /* There is no reason any cursor should have an outstanding reference
+ ** to an overflow page belonging to a cell that is being deleted/updated.
+ ** So if there exists more than one reference to this page, then it
+ ** must not really be an overflow page and the database must be corrupt.
+ ** It is helpful to detect this before calling freePage2(), as
+ ** freePage2() may zero the page contents if secure-delete mode is
+ ** enabled. If this 'overflow' page happens to be a page that the
+ ** caller is iterating through or using in some other way, this
+ ** can be problematic.
+ */
+ rc = SQLITE_CORRUPT_BKPT;
+ }else{
+ rc = freePage2(pBt, pOvfl, ovflPgno);
+ }
+
+ if( pOvfl ){
+ sqlite3PagerUnref(pOvfl->pDbPage);
+ }
+ if( rc ) return rc;
+ ovflPgno = iNext;
+ }
+ return SQLITE_OK;
+}
+
+/* Call xParseCell to compute the size of a cell. If the cell contains
+** overflow, then invoke cellClearOverflow to clear out that overflow.
+** Store the result code (SQLITE_OK or some error code) in rc.
+**
+** Implemented as macro to force inlining for performance.
+*/
+#define BTREE_CLEAR_CELL(rc, pPage, pCell, sInfo) \
+ pPage->xParseCell(pPage, pCell, &sInfo); \
+ if( sInfo.nLocal!=sInfo.nPayload ){ \
+ rc = clearCellOverflow(pPage, pCell, &sInfo); \
+ }else{ \
+ rc = SQLITE_OK; \
+ }
+
+
+/*
+** Create the byte sequence used to represent a cell on page pPage
+** and write that byte sequence into pCell[]. Overflow pages are
+** allocated and filled in as necessary. The calling procedure
+** is responsible for making sure sufficient space has been allocated
+** for pCell[].
+**
+** Note that pCell does not necessary need to point to the pPage->aData
+** area. pCell might point to some temporary storage. The cell will
+** be constructed in this temporary area then copied into pPage->aData
+** later.
+*/
+static int fillInCell(
+ MemPage *pPage, /* The page that contains the cell */
+ unsigned char *pCell, /* Complete text of the cell */
+ const BtreePayload *pX, /* Payload with which to construct the cell */
+ int *pnSize /* Write cell size here */
+){
+ int nPayload;
+ const u8 *pSrc;
+ int nSrc, n, rc, mn;
+ int spaceLeft;
+ MemPage *pToRelease;
+ unsigned char *pPrior;
+ unsigned char *pPayload;
+ BtShared *pBt;
+ Pgno pgnoOvfl;
+ int nHeader;
+
+ assert( sqlite3_mutex_held(pPage->pBt->mutex) );
+
+ /* pPage is not necessarily writeable since pCell might be auxiliary
+ ** buffer space that is separate from the pPage buffer area */
+ assert( pCell<pPage->aData || pCell>=&pPage->aData[pPage->pBt->pageSize]
+ || sqlite3PagerIswriteable(pPage->pDbPage) );
+
+ /* Fill in the header. */
+ nHeader = pPage->childPtrSize;
+ if( pPage->intKey ){
+ nPayload = pX->nData + pX->nZero;
+ pSrc = pX->pData;
+ nSrc = pX->nData;
+ assert( pPage->intKeyLeaf ); /* fillInCell() only called for leaves */
+ nHeader += putVarint32(&pCell[nHeader], nPayload);
+ nHeader += putVarint(&pCell[nHeader], *(u64*)&pX->nKey);
+ }else{
+ assert( pX->nKey<=0x7fffffff && pX->pKey!=0 );
+ nSrc = nPayload = (int)pX->nKey;
+ pSrc = pX->pKey;
+ nHeader += putVarint32(&pCell[nHeader], nPayload);
+ }
+
+ /* Fill in the payload */
+ pPayload = &pCell[nHeader];
+ if( nPayload<=pPage->maxLocal ){
+ /* This is the common case where everything fits on the btree page
+ ** and no overflow pages are required. */
+ n = nHeader + nPayload;
+ testcase( n==3 );
+ testcase( n==4 );
+ if( n<4 ){
+ n = 4;
+ pPayload[nPayload] = 0;
+ }
+ *pnSize = n;
+ assert( nSrc<=nPayload );
+ testcase( nSrc<nPayload );
+ memcpy(pPayload, pSrc, nSrc);
+ memset(pPayload+nSrc, 0, nPayload-nSrc);
+ return SQLITE_OK;
+ }
+
+ /* If we reach this point, it means that some of the content will need
+ ** to spill onto overflow pages.
+ */
+ mn = pPage->minLocal;
+ n = mn + (nPayload - mn) % (pPage->pBt->usableSize - 4);
+ testcase( n==pPage->maxLocal );
+ testcase( n==pPage->maxLocal+1 );
+ if( n > pPage->maxLocal ) n = mn;
+ spaceLeft = n;
+ *pnSize = n + nHeader + 4;
+ pPrior = &pCell[nHeader+n];
+ pToRelease = 0;
+ pgnoOvfl = 0;
+ pBt = pPage->pBt;
+
+ /* At this point variables should be set as follows:
+ **
+ ** nPayload Total payload size in bytes
+ ** pPayload Begin writing payload here
+ ** spaceLeft Space available at pPayload. If nPayload>spaceLeft,
+ ** that means content must spill into overflow pages.
+ ** *pnSize Size of the local cell (not counting overflow pages)
+ ** pPrior Where to write the pgno of the first overflow page
+ **
+ ** Use a call to btreeParseCellPtr() to verify that the values above
+ ** were computed correctly.
+ */
+#ifdef SQLITE_DEBUG
+ {
+ CellInfo info;
+ pPage->xParseCell(pPage, pCell, &info);
+ assert( nHeader==(int)(info.pPayload - pCell) );
+ assert( info.nKey==pX->nKey );
+ assert( *pnSize == info.nSize );
+ assert( spaceLeft == info.nLocal );
+ }
+#endif
+
+ /* Write the payload into the local Cell and any extra into overflow pages */
+ while( 1 ){
+ n = nPayload;
+ if( n>spaceLeft ) n = spaceLeft;
+
+ /* If pToRelease is not zero than pPayload points into the data area
+ ** of pToRelease. Make sure pToRelease is still writeable. */
+ assert( pToRelease==0 || sqlite3PagerIswriteable(pToRelease->pDbPage) );
+
+ /* If pPayload is part of the data area of pPage, then make sure pPage
+ ** is still writeable */
+ assert( pPayload<pPage->aData || pPayload>=&pPage->aData[pBt->pageSize]
+ || sqlite3PagerIswriteable(pPage->pDbPage) );
+
+ if( nSrc>=n ){
+ memcpy(pPayload, pSrc, n);
+ }else if( nSrc>0 ){
+ n = nSrc;
+ memcpy(pPayload, pSrc, n);
+ }else{
+ memset(pPayload, 0, n);
+ }
+ nPayload -= n;
+ if( nPayload<=0 ) break;
+ pPayload += n;
+ pSrc += n;
+ nSrc -= n;
+ spaceLeft -= n;
+ if( spaceLeft==0 ){
+ MemPage *pOvfl = 0;
+#ifndef SQLITE_OMIT_AUTOVACUUM
+ Pgno pgnoPtrmap = pgnoOvfl; /* Overflow page pointer-map entry page */
+ if( pBt->autoVacuum ){
+ do{
+ pgnoOvfl++;
+ } while(
+ PTRMAP_ISPAGE(pBt, pgnoOvfl) || pgnoOvfl==PENDING_BYTE_PAGE(pBt)
+ );
+ }
+#endif
+ rc = allocateBtreePage(pBt, &pOvfl, &pgnoOvfl, pgnoOvfl, 0);
+#ifndef SQLITE_OMIT_AUTOVACUUM
+ /* If the database supports auto-vacuum, and the second or subsequent
+ ** overflow page is being allocated, add an entry to the pointer-map
+ ** for that page now.
+ **
+ ** If this is the first overflow page, then write a partial entry
+ ** to the pointer-map. If we write nothing to this pointer-map slot,
+ ** then the optimistic overflow chain processing in clearCell()
+ ** may misinterpret the uninitialized values and delete the
+ ** wrong pages from the database.
+ */
+ if( pBt->autoVacuum && rc==SQLITE_OK ){
+ u8 eType = (pgnoPtrmap?PTRMAP_OVERFLOW2:PTRMAP_OVERFLOW1);
+ ptrmapPut(pBt, pgnoOvfl, eType, pgnoPtrmap, &rc);
+ if( rc ){
+ releasePage(pOvfl);
+ }
+ }
+#endif
+ if( rc ){
+ releasePage(pToRelease);
+ return rc;
+ }
+
+ /* If pToRelease is not zero than pPrior points into the data area
+ ** of pToRelease. Make sure pToRelease is still writeable. */
+ assert( pToRelease==0 || sqlite3PagerIswriteable(pToRelease->pDbPage) );
+
+ /* If pPrior is part of the data area of pPage, then make sure pPage
+ ** is still writeable */
+ assert( pPrior<pPage->aData || pPrior>=&pPage->aData[pBt->pageSize]
+ || sqlite3PagerIswriteable(pPage->pDbPage) );
+
+ put4byte(pPrior, pgnoOvfl);
+ releasePage(pToRelease);
+ pToRelease = pOvfl;
+ pPrior = pOvfl->aData;
+ put4byte(pPrior, 0);
+ pPayload = &pOvfl->aData[4];
+ spaceLeft = pBt->usableSize - 4;
+ }
+ }
+ releasePage(pToRelease);
+ return SQLITE_OK;
+}
+
+/*
+** Remove the i-th cell from pPage. This routine effects pPage only.
+** The cell content is not freed or deallocated. It is assumed that
+** the cell content has been copied someplace else. This routine just
+** removes the reference to the cell from pPage.
+**
+** "sz" must be the number of bytes in the cell.
+*/
+static void dropCell(MemPage *pPage, int idx, int sz, int *pRC){
+ u32 pc; /* Offset to cell content of cell being deleted */
+ u8 *data; /* pPage->aData */
+ u8 *ptr; /* Used to move bytes around within data[] */
+ int rc; /* The return code */
+ int hdr; /* Beginning of the header. 0 most pages. 100 page 1 */
+
+ if( *pRC ) return;
+ assert( idx>=0 );
+ assert( idx<pPage->nCell );
+ assert( CORRUPT_DB || sz==cellSize(pPage, idx) );
+ assert( sqlite3PagerIswriteable(pPage->pDbPage) );
+ assert( sqlite3_mutex_held(pPage->pBt->mutex) );
+ assert( pPage->nFree>=0 );
+ data = pPage->aData;
+ ptr = &pPage->aCellIdx[2*idx];
+ assert( pPage->pBt->usableSize > (u32)(ptr-data) );
+ pc = get2byte(ptr);
+ hdr = pPage->hdrOffset;
+ testcase( pc==(u32)get2byte(&data[hdr+5]) );
+ testcase( pc+sz==pPage->pBt->usableSize );
+ if( pc+sz > pPage->pBt->usableSize ){
+ *pRC = SQLITE_CORRUPT_BKPT;
+ return;
+ }
+ rc = freeSpace(pPage, pc, sz);
+ if( rc ){
+ *pRC = rc;
+ return;
+ }
+ pPage->nCell--;
+ if( pPage->nCell==0 ){
+ memset(&data[hdr+1], 0, 4);
+ data[hdr+7] = 0;
+ put2byte(&data[hdr+5], pPage->pBt->usableSize);
+ pPage->nFree = pPage->pBt->usableSize - pPage->hdrOffset
+ - pPage->childPtrSize - 8;
+ }else{
+ memmove(ptr, ptr+2, 2*(pPage->nCell - idx));
+ put2byte(&data[hdr+3], pPage->nCell);
+ pPage->nFree += 2;
+ }
+}
+
+/*
+** Insert a new cell on pPage at cell index "i". pCell points to the
+** content of the cell.
+**
+** If the cell content will fit on the page, then put it there. If it
+** will not fit, then make a copy of the cell content into pTemp if
+** pTemp is not null. Regardless of pTemp, allocate a new entry
+** in pPage->apOvfl[] and make it point to the cell content (either
+** in pTemp or the original pCell) and also record its index.
+** Allocating a new entry in pPage->aCell[] implies that
+** pPage->nOverflow is incremented.
+**
+** The insertCellFast() routine below works exactly the same as
+** insertCell() except that it lacks the pTemp and iChild parameters
+** which are assumed zero. Other than that, the two routines are the
+** same.
+**
+** Fixes or enhancements to this routine should be reflected in
+** insertCellFast()!
+*/
+static int insertCell(
+ MemPage *pPage, /* Page into which we are copying */
+ int i, /* New cell becomes the i-th cell of the page */
+ u8 *pCell, /* Content of the new cell */
+ int sz, /* Bytes of content in pCell */
+ u8 *pTemp, /* Temp storage space for pCell, if needed */
+ Pgno iChild /* If non-zero, replace first 4 bytes with this value */
+){
+ int idx = 0; /* Where to write new cell content in data[] */
+ int j; /* Loop counter */
+ u8 *data; /* The content of the whole page */
+ u8 *pIns; /* The point in pPage->aCellIdx[] where no cell inserted */
+
+ assert( i>=0 && i<=pPage->nCell+pPage->nOverflow );
+ assert( MX_CELL(pPage->pBt)<=10921 );
+ assert( pPage->nCell<=MX_CELL(pPage->pBt) || CORRUPT_DB );
+ assert( pPage->nOverflow<=ArraySize(pPage->apOvfl) );
+ assert( ArraySize(pPage->apOvfl)==ArraySize(pPage->aiOvfl) );
+ assert( sqlite3_mutex_held(pPage->pBt->mutex) );
+ assert( sz==pPage->xCellSize(pPage, pCell) || CORRUPT_DB );
+ assert( pPage->nFree>=0 );
+ assert( iChild>0 );
+ if( pPage->nOverflow || sz+2>pPage->nFree ){
+ if( pTemp ){
+ memcpy(pTemp, pCell, sz);
+ pCell = pTemp;
+ }
+ put4byte(pCell, iChild);
+ j = pPage->nOverflow++;
+ /* Comparison against ArraySize-1 since we hold back one extra slot
+ ** as a contingency. In other words, never need more than 3 overflow
+ ** slots but 4 are allocated, just to be safe. */
+ assert( j < ArraySize(pPage->apOvfl)-1 );
+ pPage->apOvfl[j] = pCell;
+ pPage->aiOvfl[j] = (u16)i;
+
+ /* When multiple overflows occur, they are always sequential and in
+ ** sorted order. This invariants arise because multiple overflows can
+ ** only occur when inserting divider cells into the parent page during
+ ** balancing, and the dividers are adjacent and sorted.
+ */
+ assert( j==0 || pPage->aiOvfl[j-1]<(u16)i ); /* Overflows in sorted order */
+ assert( j==0 || i==pPage->aiOvfl[j-1]+1 ); /* Overflows are sequential */
+ }else{
+ int rc = sqlite3PagerWrite(pPage->pDbPage);
+ if( NEVER(rc!=SQLITE_OK) ){
+ return rc;
+ }
+ assert( sqlite3PagerIswriteable(pPage->pDbPage) );
+ data = pPage->aData;
+ assert( &data[pPage->cellOffset]==pPage->aCellIdx );
+ rc = allocateSpace(pPage, sz, &idx);
+ if( rc ){ return rc; }
+ /* The allocateSpace() routine guarantees the following properties
+ ** if it returns successfully */
+ assert( idx >= 0 );
+ assert( idx >= pPage->cellOffset+2*pPage->nCell+2 || CORRUPT_DB );
+ assert( idx+sz <= (int)pPage->pBt->usableSize );
+ pPage->nFree -= (u16)(2 + sz);
+ /* In a corrupt database where an entry in the cell index section of
+ ** a btree page has a value of 3 or less, the pCell value might point
+ ** as many as 4 bytes in front of the start of the aData buffer for
+ ** the source page. Make sure this does not cause problems by not
+ ** reading the first 4 bytes */
+ memcpy(&data[idx+4], pCell+4, sz-4);
+ put4byte(&data[idx], iChild);
+ pIns = pPage->aCellIdx + i*2;
+ memmove(pIns+2, pIns, 2*(pPage->nCell - i));
+ put2byte(pIns, idx);
+ pPage->nCell++;
+ /* increment the cell count */
+ if( (++data[pPage->hdrOffset+4])==0 ) data[pPage->hdrOffset+3]++;
+ assert( get2byte(&data[pPage->hdrOffset+3])==pPage->nCell || CORRUPT_DB );
+#ifndef SQLITE_OMIT_AUTOVACUUM
+ if( pPage->pBt->autoVacuum ){
+ int rc2 = SQLITE_OK;
+ /* The cell may contain a pointer to an overflow page. If so, write
+ ** the entry for the overflow page into the pointer map.
+ */
+ ptrmapPutOvflPtr(pPage, pPage, pCell, &rc2);
+ if( rc2 ) return rc2;
+ }
+#endif
+ }
+ return SQLITE_OK;
+}
+
+/*
+** This variant of insertCell() assumes that the pTemp and iChild
+** parameters are both zero. Use this variant in sqlite3BtreeInsert()
+** for performance improvement, and also so that this variant is only
+** called from that one place, and is thus inlined, and thus runs must
+** faster.
+**
+** Fixes or enhancements to this routine should be reflected into
+** the insertCell() routine.
+*/
+static int insertCellFast(
+ MemPage *pPage, /* Page into which we are copying */
+ int i, /* New cell becomes the i-th cell of the page */
+ u8 *pCell, /* Content of the new cell */
+ int sz /* Bytes of content in pCell */
+){
+ int idx = 0; /* Where to write new cell content in data[] */
+ int j; /* Loop counter */
+ u8 *data; /* The content of the whole page */
+ u8 *pIns; /* The point in pPage->aCellIdx[] where no cell inserted */
+
+ assert( i>=0 && i<=pPage->nCell+pPage->nOverflow );
+ assert( MX_CELL(pPage->pBt)<=10921 );
+ assert( pPage->nCell<=MX_CELL(pPage->pBt) || CORRUPT_DB );
+ assert( pPage->nOverflow<=ArraySize(pPage->apOvfl) );
+ assert( ArraySize(pPage->apOvfl)==ArraySize(pPage->aiOvfl) );
+ assert( sqlite3_mutex_held(pPage->pBt->mutex) );
+ assert( sz==pPage->xCellSize(pPage, pCell) || CORRUPT_DB );
+ assert( pPage->nFree>=0 );
+ assert( pPage->nOverflow==0 );
+ if( sz+2>pPage->nFree ){
+ j = pPage->nOverflow++;
+ /* Comparison against ArraySize-1 since we hold back one extra slot
+ ** as a contingency. In other words, never need more than 3 overflow
+ ** slots but 4 are allocated, just to be safe. */
+ assert( j < ArraySize(pPage->apOvfl)-1 );
+ pPage->apOvfl[j] = pCell;
+ pPage->aiOvfl[j] = (u16)i;
+
+ /* When multiple overflows occur, they are always sequential and in
+ ** sorted order. This invariants arise because multiple overflows can
+ ** only occur when inserting divider cells into the parent page during
+ ** balancing, and the dividers are adjacent and sorted.
+ */
+ assert( j==0 || pPage->aiOvfl[j-1]<(u16)i ); /* Overflows in sorted order */
+ assert( j==0 || i==pPage->aiOvfl[j-1]+1 ); /* Overflows are sequential */
+ }else{
+ int rc = sqlite3PagerWrite(pPage->pDbPage);
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+ assert( sqlite3PagerIswriteable(pPage->pDbPage) );
+ data = pPage->aData;
+ assert( &data[pPage->cellOffset]==pPage->aCellIdx );
+ rc = allocateSpace(pPage, sz, &idx);
+ if( rc ){ return rc; }
+ /* The allocateSpace() routine guarantees the following properties
+ ** if it returns successfully */
+ assert( idx >= 0 );
+ assert( idx >= pPage->cellOffset+2*pPage->nCell+2 || CORRUPT_DB );
+ assert( idx+sz <= (int)pPage->pBt->usableSize );
+ pPage->nFree -= (u16)(2 + sz);
+ memcpy(&data[idx], pCell, sz);
+ pIns = pPage->aCellIdx + i*2;
+ memmove(pIns+2, pIns, 2*(pPage->nCell - i));
+ put2byte(pIns, idx);
+ pPage->nCell++;
+ /* increment the cell count */
+ if( (++data[pPage->hdrOffset+4])==0 ) data[pPage->hdrOffset+3]++;
+ assert( get2byte(&data[pPage->hdrOffset+3])==pPage->nCell || CORRUPT_DB );
+#ifndef SQLITE_OMIT_AUTOVACUUM
+ if( pPage->pBt->autoVacuum ){
+ int rc2 = SQLITE_OK;
+ /* The cell may contain a pointer to an overflow page. If so, write
+ ** the entry for the overflow page into the pointer map.
+ */
+ ptrmapPutOvflPtr(pPage, pPage, pCell, &rc2);
+ if( rc2 ) return rc2;
+ }
+#endif
+ }
+ return SQLITE_OK;
+}
+
+/*
+** The following parameters determine how many adjacent pages get involved
+** in a balancing operation. NN is the number of neighbors on either side
+** of the page that participate in the balancing operation. NB is the
+** total number of pages that participate, including the target page and
+** NN neighbors on either side.
+**
+** The minimum value of NN is 1 (of course). Increasing NN above 1
+** (to 2 or 3) gives a modest improvement in SELECT and DELETE performance
+** in exchange for a larger degradation in INSERT and UPDATE performance.
+** The value of NN appears to give the best results overall.
+**
+** (Later:) The description above makes it seem as if these values are
+** tunable - as if you could change them and recompile and it would all work.
+** But that is unlikely. NB has been 3 since the inception of SQLite and
+** we have never tested any other value.
+*/
+#define NN 1 /* Number of neighbors on either side of pPage */
+#define NB 3 /* (NN*2+1): Total pages involved in the balance */
+
+/*
+** A CellArray object contains a cache of pointers and sizes for a
+** consecutive sequence of cells that might be held on multiple pages.
+**
+** The cells in this array are the divider cell or cells from the pParent
+** page plus up to three child pages. There are a total of nCell cells.
+**
+** pRef is a pointer to one of the pages that contributes cells. This is
+** used to access information such as MemPage.intKey and MemPage.pBt->pageSize
+** which should be common to all pages that contribute cells to this array.
+**
+** apCell[] and szCell[] hold, respectively, pointers to the start of each
+** cell and the size of each cell. Some of the apCell[] pointers might refer
+** to overflow cells. In other words, some apCel[] pointers might not point
+** to content area of the pages.
+**
+** A szCell[] of zero means the size of that cell has not yet been computed.
+**
+** The cells come from as many as four different pages:
+**
+** -----------
+** | Parent |
+** -----------
+** / | \
+** / | \
+** --------- --------- ---------
+** |Child-1| |Child-2| |Child-3|
+** --------- --------- ---------
+**
+** The order of cells is in the array is for an index btree is:
+**
+** 1. All cells from Child-1 in order
+** 2. The first divider cell from Parent
+** 3. All cells from Child-2 in order
+** 4. The second divider cell from Parent
+** 5. All cells from Child-3 in order
+**
+** For a table-btree (with rowids) the items 2 and 4 are empty because
+** content exists only in leaves and there are no divider cells.
+**
+** For an index btree, the apEnd[] array holds pointer to the end of page
+** for Child-1, the Parent, Child-2, the Parent (again), and Child-3,
+** respectively. The ixNx[] array holds the number of cells contained in
+** each of these 5 stages, and all stages to the left. Hence:
+**
+** ixNx[0] = Number of cells in Child-1.
+** ixNx[1] = Number of cells in Child-1 plus 1 for first divider.
+** ixNx[2] = Number of cells in Child-1 and Child-2 + 1 for 1st divider.
+** ixNx[3] = Number of cells in Child-1 and Child-2 + both divider cells
+** ixNx[4] = Total number of cells.
+**
+** For a table-btree, the concept is similar, except only apEnd[0]..apEnd[2]
+** are used and they point to the leaf pages only, and the ixNx value are:
+**
+** ixNx[0] = Number of cells in Child-1.
+** ixNx[1] = Number of cells in Child-1 and Child-2.
+** ixNx[2] = Total number of cells.
+**
+** Sometimes when deleting, a child page can have zero cells. In those
+** cases, ixNx[] entries with higher indexes, and the corresponding apEnd[]
+** entries, shift down. The end result is that each ixNx[] entry should
+** be larger than the previous
+*/
+typedef struct CellArray CellArray;
+struct CellArray {
+ int nCell; /* Number of cells in apCell[] */
+ MemPage *pRef; /* Reference page */
+ u8 **apCell; /* All cells begin balanced */
+ u16 *szCell; /* Local size of all cells in apCell[] */
+ u8 *apEnd[NB*2]; /* MemPage.aDataEnd values */
+ int ixNx[NB*2]; /* Index of at which we move to the next apEnd[] */
+};
+
+/*
+** Make sure the cell sizes at idx, idx+1, ..., idx+N-1 have been
+** computed.
+*/
+static void populateCellCache(CellArray *p, int idx, int N){
+ MemPage *pRef = p->pRef;
+ u16 *szCell = p->szCell;
+ assert( idx>=0 && idx+N<=p->nCell );
+ while( N>0 ){
+ assert( p->apCell[idx]!=0 );
+ if( szCell[idx]==0 ){
+ szCell[idx] = pRef->xCellSize(pRef, p->apCell[idx]);
+ }else{
+ assert( CORRUPT_DB ||
+ szCell[idx]==pRef->xCellSize(pRef, p->apCell[idx]) );
+ }
+ idx++;
+ N--;
+ }
+}
+
+/*
+** Return the size of the Nth element of the cell array
+*/
+static SQLITE_NOINLINE u16 computeCellSize(CellArray *p, int N){
+ assert( N>=0 && N<p->nCell );
+ assert( p->szCell[N]==0 );
+ p->szCell[N] = p->pRef->xCellSize(p->pRef, p->apCell[N]);
+ return p->szCell[N];
+}
+static u16 cachedCellSize(CellArray *p, int N){
+ assert( N>=0 && N<p->nCell );
+ if( p->szCell[N] ) return p->szCell[N];
+ return computeCellSize(p, N);
+}
+
+/*
+** Array apCell[] contains pointers to nCell b-tree page cells. The
+** szCell[] array contains the size in bytes of each cell. This function
+** replaces the current contents of page pPg with the contents of the cell
+** array.
+**
+** Some of the cells in apCell[] may currently be stored in pPg. This
+** function works around problems caused by this by making a copy of any
+** such cells before overwriting the page data.
+**
+** The MemPage.nFree field is invalidated by this function. It is the
+** responsibility of the caller to set it correctly.
+*/
+static int rebuildPage(
+ CellArray *pCArray, /* Content to be added to page pPg */
+ int iFirst, /* First cell in pCArray to use */
+ int nCell, /* Final number of cells on page */
+ MemPage *pPg /* The page to be reconstructed */
+){
+ const int hdr = pPg->hdrOffset; /* Offset of header on pPg */
+ u8 * const aData = pPg->aData; /* Pointer to data for pPg */
+ const int usableSize = pPg->pBt->usableSize;
+ u8 * const pEnd = &aData[usableSize];
+ int i = iFirst; /* Which cell to copy from pCArray*/
+ u32 j; /* Start of cell content area */
+ int iEnd = i+nCell; /* Loop terminator */
+ u8 *pCellptr = pPg->aCellIdx;
+ u8 *pTmp = sqlite3PagerTempSpace(pPg->pBt->pPager);
+ u8 *pData;
+ int k; /* Current slot in pCArray->apEnd[] */
+ u8 *pSrcEnd; /* Current pCArray->apEnd[k] value */
+
+ assert( nCell>0 );
+ assert( i<iEnd );
+ j = get2byte(&aData[hdr+5]);
+ if( j>(u32)usableSize ){ j = 0; }
+ memcpy(&pTmp[j], &aData[j], usableSize - j);
+
+ assert( pCArray->ixNx[NB*2-1]>i );
+ for(k=0; pCArray->ixNx[k]<=i; k++){}
+ pSrcEnd = pCArray->apEnd[k];
+
+ pData = pEnd;
+ while( 1/*exit by break*/ ){
+ u8 *pCell = pCArray->apCell[i];
+ u16 sz = pCArray->szCell[i];
+ assert( sz>0 );
+ if( SQLITE_WITHIN(pCell,aData+j,pEnd) ){
+ if( ((uptr)(pCell+sz))>(uptr)pEnd ) return SQLITE_CORRUPT_BKPT;
+ pCell = &pTmp[pCell - aData];
+ }else if( (uptr)(pCell+sz)>(uptr)pSrcEnd
+ && (uptr)(pCell)<(uptr)pSrcEnd
+ ){
+ return SQLITE_CORRUPT_BKPT;
+ }
+
+ pData -= sz;
+ put2byte(pCellptr, (pData - aData));
+ pCellptr += 2;
+ if( pData < pCellptr ) return SQLITE_CORRUPT_BKPT;
+ memmove(pData, pCell, sz);
+ assert( sz==pPg->xCellSize(pPg, pCell) || CORRUPT_DB );
+ i++;
+ if( i>=iEnd ) break;
+ if( pCArray->ixNx[k]<=i ){
+ k++;
+ pSrcEnd = pCArray->apEnd[k];
+ }
+ }
+
+ /* The pPg->nFree field is now set incorrectly. The caller will fix it. */
+ pPg->nCell = nCell;
+ pPg->nOverflow = 0;
+
+ put2byte(&aData[hdr+1], 0);
+ put2byte(&aData[hdr+3], pPg->nCell);
+ put2byte(&aData[hdr+5], pData - aData);
+ aData[hdr+7] = 0x00;
+ return SQLITE_OK;
+}
+
+/*
+** The pCArray objects contains pointers to b-tree cells and the cell sizes.
+** This function attempts to add the cells stored in the array to page pPg.
+** If it cannot (because the page needs to be defragmented before the cells
+** will fit), non-zero is returned. Otherwise, if the cells are added
+** successfully, zero is returned.
+**
+** Argument pCellptr points to the first entry in the cell-pointer array
+** (part of page pPg) to populate. After cell apCell[0] is written to the
+** page body, a 16-bit offset is written to pCellptr. And so on, for each
+** cell in the array. It is the responsibility of the caller to ensure
+** that it is safe to overwrite this part of the cell-pointer array.
+**
+** When this function is called, *ppData points to the start of the
+** content area on page pPg. If the size of the content area is extended,
+** *ppData is updated to point to the new start of the content area
+** before returning.
+**
+** Finally, argument pBegin points to the byte immediately following the
+** end of the space required by this page for the cell-pointer area (for
+** all cells - not just those inserted by the current call). If the content
+** area must be extended to before this point in order to accommodate all
+** cells in apCell[], then the cells do not fit and non-zero is returned.
+*/
+static int pageInsertArray(
+ MemPage *pPg, /* Page to add cells to */
+ u8 *pBegin, /* End of cell-pointer array */
+ u8 **ppData, /* IN/OUT: Page content-area pointer */
+ u8 *pCellptr, /* Pointer to cell-pointer area */
+ int iFirst, /* Index of first cell to add */
+ int nCell, /* Number of cells to add to pPg */
+ CellArray *pCArray /* Array of cells */
+){
+ int i = iFirst; /* Loop counter - cell index to insert */
+ u8 *aData = pPg->aData; /* Complete page */
+ u8 *pData = *ppData; /* Content area. A subset of aData[] */
+ int iEnd = iFirst + nCell; /* End of loop. One past last cell to ins */
+ int k; /* Current slot in pCArray->apEnd[] */
+ u8 *pEnd; /* Maximum extent of cell data */
+ assert( CORRUPT_DB || pPg->hdrOffset==0 ); /* Never called on page 1 */
+ if( iEnd<=iFirst ) return 0;
+ assert( pCArray->ixNx[NB*2-1]>i );
+ for(k=0; pCArray->ixNx[k]<=i ; k++){}
+ pEnd = pCArray->apEnd[k];
+ while( 1 /*Exit by break*/ ){
+ int sz, rc;
+ u8 *pSlot;
+ assert( pCArray->szCell[i]!=0 );
+ sz = pCArray->szCell[i];
+ if( (aData[1]==0 && aData[2]==0) || (pSlot = pageFindSlot(pPg,sz,&rc))==0 ){
+ if( (pData - pBegin)<sz ) return 1;
+ pData -= sz;
+ pSlot = pData;
+ }
+ /* pSlot and pCArray->apCell[i] will never overlap on a well-formed
+ ** database. But they might for a corrupt database. Hence use memmove()
+ ** since memcpy() sends SIGABORT with overlapping buffers on OpenBSD */
+ assert( (pSlot+sz)<=pCArray->apCell[i]
+ || pSlot>=(pCArray->apCell[i]+sz)
+ || CORRUPT_DB );
+ if( (uptr)(pCArray->apCell[i]+sz)>(uptr)pEnd
+ && (uptr)(pCArray->apCell[i])<(uptr)pEnd
+ ){
+ assert( CORRUPT_DB );
+ (void)SQLITE_CORRUPT_BKPT;
+ return 1;
+ }
+ memmove(pSlot, pCArray->apCell[i], sz);
+ put2byte(pCellptr, (pSlot - aData));
+ pCellptr += 2;
+ i++;
+ if( i>=iEnd ) break;
+ if( pCArray->ixNx[k]<=i ){
+ k++;
+ pEnd = pCArray->apEnd[k];
+ }
+ }
+ *ppData = pData;
+ return 0;
+}
+
+/*
+** The pCArray object contains pointers to b-tree cells and their sizes.
+**
+** This function adds the space associated with each cell in the array
+** that is currently stored within the body of pPg to the pPg free-list.
+** The cell-pointers and other fields of the page are not updated.
+**
+** This function returns the total number of cells added to the free-list.
+*/
+static int pageFreeArray(
+ MemPage *pPg, /* Page to edit */
+ int iFirst, /* First cell to delete */
+ int nCell, /* Cells to delete */
+ CellArray *pCArray /* Array of cells */
+){
+ u8 * const aData = pPg->aData;
+ u8 * const pEnd = &aData[pPg->pBt->usableSize];
+ u8 * const pStart = &aData[pPg->hdrOffset + 8 + pPg->childPtrSize];
+ int nRet = 0;
+ int i, j;
+ int iEnd = iFirst + nCell;
+ int nFree = 0;
+ int aOfst[10];
+ int aAfter[10];
+
+ for(i=iFirst; i<iEnd; i++){
+ u8 *pCell = pCArray->apCell[i];
+ if( SQLITE_WITHIN(pCell, pStart, pEnd) ){
+ int sz;
+ int iAfter;
+ int iOfst;
+ /* No need to use cachedCellSize() here. The sizes of all cells that
+ ** are to be freed have already been computing while deciding which
+ ** cells need freeing */
+ sz = pCArray->szCell[i]; assert( sz>0 );
+ iOfst = (u16)(pCell - aData);
+ iAfter = iOfst+sz;
+ for(j=0; j<nFree; j++){
+ if( aOfst[j]==iAfter ){
+ aOfst[j] = iOfst;
+ break;
+ }else if( aAfter[j]==iOfst ){
+ aAfter[j] = iAfter;
+ break;
+ }
+ }
+ if( j>=nFree ){
+ if( nFree>=(int)(sizeof(aOfst)/sizeof(aOfst[0])) ){
+ for(j=0; j<nFree; j++){
+ freeSpace(pPg, aOfst[j], aAfter[j]-aOfst[j]);
+ }
+ nFree = 0;
+ }
+ aOfst[nFree] = iOfst;
+ aAfter[nFree] = iAfter;
+ if( &aData[iAfter]>pEnd ) return 0;
+ nFree++;
+ }
+ nRet++;
+ }
+ }
+ for(j=0; j<nFree; j++){
+ freeSpace(pPg, aOfst[j], aAfter[j]-aOfst[j]);
+ }
+ return nRet;
+}
+
+/*
+** pCArray contains pointers to and sizes of all cells in the page being
+** balanced. The current page, pPg, has pPg->nCell cells starting with
+** pCArray->apCell[iOld]. After balancing, this page should hold nNew cells
+** starting at apCell[iNew].
+**
+** This routine makes the necessary adjustments to pPg so that it contains
+** the correct cells after being balanced.
+**
+** The pPg->nFree field is invalid when this function returns. It is the
+** responsibility of the caller to set it correctly.
+*/
+static int editPage(
+ MemPage *pPg, /* Edit this page */
+ int iOld, /* Index of first cell currently on page */
+ int iNew, /* Index of new first cell on page */
+ int nNew, /* Final number of cells on page */
+ CellArray *pCArray /* Array of cells and sizes */
+){
+ u8 * const aData = pPg->aData;
+ const int hdr = pPg->hdrOffset;
+ u8 *pBegin = &pPg->aCellIdx[nNew * 2];
+ int nCell = pPg->nCell; /* Cells stored on pPg */
+ u8 *pData;
+ u8 *pCellptr;
+ int i;
+ int iOldEnd = iOld + pPg->nCell + pPg->nOverflow;
+ int iNewEnd = iNew + nNew;
+
+#ifdef SQLITE_DEBUG
+ u8 *pTmp = sqlite3PagerTempSpace(pPg->pBt->pPager);
+ memcpy(pTmp, aData, pPg->pBt->usableSize);
+#endif
+
+ /* Remove cells from the start and end of the page */
+ assert( nCell>=0 );
+ if( iOld<iNew ){
+ int nShift = pageFreeArray(pPg, iOld, iNew-iOld, pCArray);
+ if( NEVER(nShift>nCell) ) return SQLITE_CORRUPT_BKPT;
+ memmove(pPg->aCellIdx, &pPg->aCellIdx[nShift*2], nCell*2);
+ nCell -= nShift;
+ }
+ if( iNewEnd < iOldEnd ){
+ int nTail = pageFreeArray(pPg, iNewEnd, iOldEnd - iNewEnd, pCArray);
+ assert( nCell>=nTail );
+ nCell -= nTail;
+ }
+
+ pData = &aData[get2byte(&aData[hdr+5])];
+ if( pData<pBegin ) goto editpage_fail;
+ if( NEVER(pData>pPg->aDataEnd) ) goto editpage_fail;
+
+ /* Add cells to the start of the page */
+ if( iNew<iOld ){
+ int nAdd = MIN(nNew,iOld-iNew);
+ assert( (iOld-iNew)<nNew || nCell==0 || CORRUPT_DB );
+ assert( nAdd>=0 );
+ pCellptr = pPg->aCellIdx;
+ memmove(&pCellptr[nAdd*2], pCellptr, nCell*2);
+ if( pageInsertArray(
+ pPg, pBegin, &pData, pCellptr,
+ iNew, nAdd, pCArray
+ ) ) goto editpage_fail;
+ nCell += nAdd;
+ }
+
+ /* Add any overflow cells */
+ for(i=0; i<pPg->nOverflow; i++){
+ int iCell = (iOld + pPg->aiOvfl[i]) - iNew;
+ if( iCell>=0 && iCell<nNew ){
+ pCellptr = &pPg->aCellIdx[iCell * 2];
+ if( nCell>iCell ){
+ memmove(&pCellptr[2], pCellptr, (nCell - iCell) * 2);
+ }
+ nCell++;
+ cachedCellSize(pCArray, iCell+iNew);
+ if( pageInsertArray(
+ pPg, pBegin, &pData, pCellptr,
+ iCell+iNew, 1, pCArray
+ ) ) goto editpage_fail;
+ }
+ }
+
+ /* Append cells to the end of the page */
+ assert( nCell>=0 );
+ pCellptr = &pPg->aCellIdx[nCell*2];
+ if( pageInsertArray(
+ pPg, pBegin, &pData, pCellptr,
+ iNew+nCell, nNew-nCell, pCArray
+ ) ) goto editpage_fail;
+
+ pPg->nCell = nNew;
+ pPg->nOverflow = 0;
+
+ put2byte(&aData[hdr+3], pPg->nCell);
+ put2byte(&aData[hdr+5], pData - aData);
+
+#ifdef SQLITE_DEBUG
+ for(i=0; i<nNew && !CORRUPT_DB; i++){
+ u8 *pCell = pCArray->apCell[i+iNew];
+ int iOff = get2byteAligned(&pPg->aCellIdx[i*2]);
+ if( SQLITE_WITHIN(pCell, aData, &aData[pPg->pBt->usableSize]) ){
+ pCell = &pTmp[pCell - aData];
+ }
+ assert( 0==memcmp(pCell, &aData[iOff],
+ pCArray->pRef->xCellSize(pCArray->pRef, pCArray->apCell[i+iNew])) );
+ }
+#endif
+
+ return SQLITE_OK;
+ editpage_fail:
+ /* Unable to edit this page. Rebuild it from scratch instead. */
+ if( nNew<1 ) return SQLITE_CORRUPT_BKPT;
+ populateCellCache(pCArray, iNew, nNew);
+ return rebuildPage(pCArray, iNew, nNew, pPg);
+}
+
+
+#ifndef SQLITE_OMIT_QUICKBALANCE
+/*
+** This version of balance() handles the common special case where
+** a new entry is being inserted on the extreme right-end of the
+** tree, in other words, when the new entry will become the largest
+** entry in the tree.
+**
+** Instead of trying to balance the 3 right-most leaf pages, just add
+** a new page to the right-hand side and put the one new entry in
+** that page. This leaves the right side of the tree somewhat
+** unbalanced. But odds are that we will be inserting new entries
+** at the end soon afterwards so the nearly empty page will quickly
+** fill up. On average.
+**
+** pPage is the leaf page which is the right-most page in the tree.
+** pParent is its parent. pPage must have a single overflow entry
+** which is also the right-most entry on the page.
+**
+** The pSpace buffer is used to store a temporary copy of the divider
+** cell that will be inserted into pParent. Such a cell consists of a 4
+** byte page number followed by a variable length integer. In other
+** words, at most 13 bytes. Hence the pSpace buffer must be at
+** least 13 bytes in size.
+*/
+static int balance_quick(MemPage *pParent, MemPage *pPage, u8 *pSpace){
+ BtShared *const pBt = pPage->pBt; /* B-Tree Database */
+ MemPage *pNew; /* Newly allocated page */
+ int rc; /* Return Code */
+ Pgno pgnoNew; /* Page number of pNew */
+
+ assert( sqlite3_mutex_held(pPage->pBt->mutex) );
+ assert( sqlite3PagerIswriteable(pParent->pDbPage) );
+ assert( pPage->nOverflow==1 );
+
+ if( pPage->nCell==0 ) return SQLITE_CORRUPT_BKPT; /* dbfuzz001.test */
+ assert( pPage->nFree>=0 );
+ assert( pParent->nFree>=0 );
+
+ /* Allocate a new page. This page will become the right-sibling of
+ ** pPage. Make the parent page writable, so that the new divider cell
+ ** may be inserted. If both these operations are successful, proceed.
+ */
+ rc = allocateBtreePage(pBt, &pNew, &pgnoNew, 0, 0);
+
+ if( rc==SQLITE_OK ){
+
+ u8 *pOut = &pSpace[4];
+ u8 *pCell = pPage->apOvfl[0];
+ u16 szCell = pPage->xCellSize(pPage, pCell);
+ u8 *pStop;
+ CellArray b;
+
+ assert( sqlite3PagerIswriteable(pNew->pDbPage) );
+ assert( CORRUPT_DB || pPage->aData[0]==(PTF_INTKEY|PTF_LEAFDATA|PTF_LEAF) );
+ zeroPage(pNew, PTF_INTKEY|PTF_LEAFDATA|PTF_LEAF);
+ b.nCell = 1;
+ b.pRef = pPage;
+ b.apCell = &pCell;
+ b.szCell = &szCell;
+ b.apEnd[0] = pPage->aDataEnd;
+ b.ixNx[0] = 2;
+ b.ixNx[NB*2-1] = 0x7fffffff;
+ rc = rebuildPage(&b, 0, 1, pNew);
+ if( NEVER(rc) ){
+ releasePage(pNew);
+ return rc;
+ }
+ pNew->nFree = pBt->usableSize - pNew->cellOffset - 2 - szCell;
+
+ /* If this is an auto-vacuum database, update the pointer map
+ ** with entries for the new page, and any pointer from the
+ ** cell on the page to an overflow page. If either of these
+ ** operations fails, the return code is set, but the contents
+ ** of the parent page are still manipulated by the code below.
+ ** That is Ok, at this point the parent page is guaranteed to
+ ** be marked as dirty. Returning an error code will cause a
+ ** rollback, undoing any changes made to the parent page.
+ */
+ if( ISAUTOVACUUM(pBt) ){
+ ptrmapPut(pBt, pgnoNew, PTRMAP_BTREE, pParent->pgno, &rc);
+ if( szCell>pNew->minLocal ){
+ ptrmapPutOvflPtr(pNew, pNew, pCell, &rc);
+ }
+ }
+
+ /* Create a divider cell to insert into pParent. The divider cell
+ ** consists of a 4-byte page number (the page number of pPage) and
+ ** a variable length key value (which must be the same value as the
+ ** largest key on pPage).
+ **
+ ** To find the largest key value on pPage, first find the right-most
+ ** cell on pPage. The first two fields of this cell are the
+ ** record-length (a variable length integer at most 32-bits in size)
+ ** and the key value (a variable length integer, may have any value).
+ ** The first of the while(...) loops below skips over the record-length
+ ** field. The second while(...) loop copies the key value from the
+ ** cell on pPage into the pSpace buffer.
+ */
+ pCell = findCell(pPage, pPage->nCell-1);
+ pStop = &pCell[9];
+ while( (*(pCell++)&0x80) && pCell<pStop );
+ pStop = &pCell[9];
+ while( ((*(pOut++) = *(pCell++))&0x80) && pCell<pStop );
+
+ /* Insert the new divider cell into pParent. */
+ if( rc==SQLITE_OK ){
+ rc = insertCell(pParent, pParent->nCell, pSpace, (int)(pOut-pSpace),
+ 0, pPage->pgno);
+ }
+
+ /* Set the right-child pointer of pParent to point to the new page. */
+ put4byte(&pParent->aData[pParent->hdrOffset+8], pgnoNew);
+
+ /* Release the reference to the new page. */
+ releasePage(pNew);
+ }
+
+ return rc;
+}
+#endif /* SQLITE_OMIT_QUICKBALANCE */
+
+#if 0
+/*
+** This function does not contribute anything to the operation of SQLite.
+** it is sometimes activated temporarily while debugging code responsible
+** for setting pointer-map entries.
+*/
+static int ptrmapCheckPages(MemPage **apPage, int nPage){
+ int i, j;
+ for(i=0; i<nPage; i++){
+ Pgno n;
+ u8 e;
+ MemPage *pPage = apPage[i];
+ BtShared *pBt = pPage->pBt;
+ assert( pPage->isInit );
+
+ for(j=0; j<pPage->nCell; j++){
+ CellInfo info;
+ u8 *z;
+
+ z = findCell(pPage, j);
+ pPage->xParseCell(pPage, z, &info);
+ if( info.nLocal<info.nPayload ){
+ Pgno ovfl = get4byte(&z[info.nSize-4]);
+ ptrmapGet(pBt, ovfl, &e, &n);
+ assert( n==pPage->pgno && e==PTRMAP_OVERFLOW1 );
+ }
+ if( !pPage->leaf ){
+ Pgno child = get4byte(z);
+ ptrmapGet(pBt, child, &e, &n);
+ assert( n==pPage->pgno && e==PTRMAP_BTREE );
+ }
+ }
+ if( !pPage->leaf ){
+ Pgno child = get4byte(&pPage->aData[pPage->hdrOffset+8]);
+ ptrmapGet(pBt, child, &e, &n);
+ assert( n==pPage->pgno && e==PTRMAP_BTREE );
+ }
+ }
+ return 1;
+}
+#endif
+
+/*
+** This function is used to copy the contents of the b-tree node stored
+** on page pFrom to page pTo. If page pFrom was not a leaf page, then
+** the pointer-map entries for each child page are updated so that the
+** parent page stored in the pointer map is page pTo. If pFrom contained
+** any cells with overflow page pointers, then the corresponding pointer
+** map entries are also updated so that the parent page is page pTo.
+**
+** If pFrom is currently carrying any overflow cells (entries in the
+** MemPage.apOvfl[] array), they are not copied to pTo.
+**
+** Before returning, page pTo is reinitialized using btreeInitPage().
+**
+** The performance of this function is not critical. It is only used by
+** the balance_shallower() and balance_deeper() procedures, neither of
+** which are called often under normal circumstances.
+*/
+static void copyNodeContent(MemPage *pFrom, MemPage *pTo, int *pRC){
+ if( (*pRC)==SQLITE_OK ){
+ BtShared * const pBt = pFrom->pBt;
+ u8 * const aFrom = pFrom->aData;
+ u8 * const aTo = pTo->aData;
+ int const iFromHdr = pFrom->hdrOffset;
+ int const iToHdr = ((pTo->pgno==1) ? 100 : 0);
+ int rc;
+ int iData;
+
+
+ assert( pFrom->isInit );
+ assert( pFrom->nFree>=iToHdr );
+ assert( get2byte(&aFrom[iFromHdr+5]) <= (int)pBt->usableSize );
+
+ /* Copy the b-tree node content from page pFrom to page pTo. */
+ iData = get2byte(&aFrom[iFromHdr+5]);
+ memcpy(&aTo[iData], &aFrom[iData], pBt->usableSize-iData);
+ memcpy(&aTo[iToHdr], &aFrom[iFromHdr], pFrom->cellOffset + 2*pFrom->nCell);
+
+ /* Reinitialize page pTo so that the contents of the MemPage structure
+ ** match the new data. The initialization of pTo can actually fail under
+ ** fairly obscure circumstances, even though it is a copy of initialized
+ ** page pFrom.
+ */
+ pTo->isInit = 0;
+ rc = btreeInitPage(pTo);
+ if( rc==SQLITE_OK ) rc = btreeComputeFreeSpace(pTo);
+ if( rc!=SQLITE_OK ){
+ *pRC = rc;
+ return;
+ }
+
+ /* If this is an auto-vacuum database, update the pointer-map entries
+ ** for any b-tree or overflow pages that pTo now contains the pointers to.
+ */
+ if( ISAUTOVACUUM(pBt) ){
+ *pRC = setChildPtrmaps(pTo);
+ }
+ }
+}
+
+/*
+** This routine redistributes cells on the iParentIdx'th child of pParent
+** (hereafter "the page") and up to 2 siblings so that all pages have about the
+** same amount of free space. Usually a single sibling on either side of the
+** page are used in the balancing, though both siblings might come from one
+** side if the page is the first or last child of its parent. If the page
+** has fewer than 2 siblings (something which can only happen if the page
+** is a root page or a child of a root page) then all available siblings
+** participate in the balancing.
+**
+** The number of siblings of the page might be increased or decreased by
+** one or two in an effort to keep pages nearly full but not over full.
+**
+** Note that when this routine is called, some of the cells on the page
+** might not actually be stored in MemPage.aData[]. This can happen
+** if the page is overfull. This routine ensures that all cells allocated
+** to the page and its siblings fit into MemPage.aData[] before returning.
+**
+** In the course of balancing the page and its siblings, cells may be
+** inserted into or removed from the parent page (pParent). Doing so
+** may cause the parent page to become overfull or underfull. If this
+** happens, it is the responsibility of the caller to invoke the correct
+** balancing routine to fix this problem (see the balance() routine).
+**
+** If this routine fails for any reason, it might leave the database
+** in a corrupted state. So if this routine fails, the database should
+** be rolled back.
+**
+** The third argument to this function, aOvflSpace, is a pointer to a
+** buffer big enough to hold one page. If while inserting cells into the parent
+** page (pParent) the parent page becomes overfull, this buffer is
+** used to store the parent's overflow cells. Because this function inserts
+** a maximum of four divider cells into the parent page, and the maximum
+** size of a cell stored within an internal node is always less than 1/4
+** of the page-size, the aOvflSpace[] buffer is guaranteed to be large
+** enough for all overflow cells.
+**
+** If aOvflSpace is set to a null pointer, this function returns
+** SQLITE_NOMEM.
+*/
+static int balance_nonroot(
+ MemPage *pParent, /* Parent page of siblings being balanced */
+ int iParentIdx, /* Index of "the page" in pParent */
+ u8 *aOvflSpace, /* page-size bytes of space for parent ovfl */
+ int isRoot, /* True if pParent is a root-page */
+ int bBulk /* True if this call is part of a bulk load */
+){
+ BtShared *pBt; /* The whole database */
+ int nMaxCells = 0; /* Allocated size of apCell, szCell, aFrom. */
+ int nNew = 0; /* Number of pages in apNew[] */
+ int nOld; /* Number of pages in apOld[] */
+ int i, j, k; /* Loop counters */
+ int nxDiv; /* Next divider slot in pParent->aCell[] */
+ int rc = SQLITE_OK; /* The return code */
+ u16 leafCorrection; /* 4 if pPage is a leaf. 0 if not */
+ int leafData; /* True if pPage is a leaf of a LEAFDATA tree */
+ int usableSpace; /* Bytes in pPage beyond the header */
+ int pageFlags; /* Value of pPage->aData[0] */
+ int iSpace1 = 0; /* First unused byte of aSpace1[] */
+ int iOvflSpace = 0; /* First unused byte of aOvflSpace[] */
+ int szScratch; /* Size of scratch memory requested */
+ MemPage *apOld[NB]; /* pPage and up to two siblings */
+ MemPage *apNew[NB+2]; /* pPage and up to NB siblings after balancing */
+ u8 *pRight; /* Location in parent of right-sibling pointer */
+ u8 *apDiv[NB-1]; /* Divider cells in pParent */
+ int cntNew[NB+2]; /* Index in b.paCell[] of cell after i-th page */
+ int cntOld[NB+2]; /* Old index in b.apCell[] */
+ int szNew[NB+2]; /* Combined size of cells placed on i-th page */
+ u8 *aSpace1; /* Space for copies of dividers cells */
+ Pgno pgno; /* Temp var to store a page number in */
+ u8 abDone[NB+2]; /* True after i'th new page is populated */
+ Pgno aPgno[NB+2]; /* Page numbers of new pages before shuffling */
+ CellArray b; /* Parsed information on cells being balanced */
+
+ memset(abDone, 0, sizeof(abDone));
+ assert( sizeof(b) - sizeof(b.ixNx) == offsetof(CellArray,ixNx) );
+ memset(&b, 0, sizeof(b)-sizeof(b.ixNx[0]));
+ b.ixNx[NB*2-1] = 0x7fffffff;
+ pBt = pParent->pBt;
+ assert( sqlite3_mutex_held(pBt->mutex) );
+ assert( sqlite3PagerIswriteable(pParent->pDbPage) );
+
+ /* At this point pParent may have at most one overflow cell. And if
+ ** this overflow cell is present, it must be the cell with
+ ** index iParentIdx. This scenario comes about when this function
+ ** is called (indirectly) from sqlite3BtreeDelete().
+ */
+ assert( pParent->nOverflow==0 || pParent->nOverflow==1 );
+ assert( pParent->nOverflow==0 || pParent->aiOvfl[0]==iParentIdx );
+
+ if( !aOvflSpace ){
+ return SQLITE_NOMEM_BKPT;
+ }
+ assert( pParent->nFree>=0 );
+
+ /* Find the sibling pages to balance. Also locate the cells in pParent
+ ** that divide the siblings. An attempt is made to find NN siblings on
+ ** either side of pPage. More siblings are taken from one side, however,
+ ** if there are fewer than NN siblings on the other side. If pParent
+ ** has NB or fewer children then all children of pParent are taken.
+ **
+ ** This loop also drops the divider cells from the parent page. This
+ ** way, the remainder of the function does not have to deal with any
+ ** overflow cells in the parent page, since if any existed they will
+ ** have already been removed.
+ */
+ i = pParent->nOverflow + pParent->nCell;
+ if( i<2 ){
+ nxDiv = 0;
+ }else{
+ assert( bBulk==0 || bBulk==1 );
+ if( iParentIdx==0 ){
+ nxDiv = 0;
+ }else if( iParentIdx==i ){
+ nxDiv = i-2+bBulk;
+ }else{
+ nxDiv = iParentIdx-1;
+ }
+ i = 2-bBulk;
+ }
+ nOld = i+1;
+ if( (i+nxDiv-pParent->nOverflow)==pParent->nCell ){
+ pRight = &pParent->aData[pParent->hdrOffset+8];
+ }else{
+ pRight = findCell(pParent, i+nxDiv-pParent->nOverflow);
+ }
+ pgno = get4byte(pRight);
+ while( 1 ){
+ if( rc==SQLITE_OK ){
+ rc = getAndInitPage(pBt, pgno, &apOld[i], 0);
+ }
+ if( rc ){
+ memset(apOld, 0, (i+1)*sizeof(MemPage*));
+ goto balance_cleanup;
+ }
+ if( apOld[i]->nFree<0 ){
+ rc = btreeComputeFreeSpace(apOld[i]);
+ if( rc ){
+ memset(apOld, 0, (i)*sizeof(MemPage*));
+ goto balance_cleanup;
+ }
+ }
+ nMaxCells += apOld[i]->nCell + ArraySize(pParent->apOvfl);
+ if( (i--)==0 ) break;
+
+ if( pParent->nOverflow && i+nxDiv==pParent->aiOvfl[0] ){
+ apDiv[i] = pParent->apOvfl[0];
+ pgno = get4byte(apDiv[i]);
+ szNew[i] = pParent->xCellSize(pParent, apDiv[i]);
+ pParent->nOverflow = 0;
+ }else{
+ apDiv[i] = findCell(pParent, i+nxDiv-pParent->nOverflow);
+ pgno = get4byte(apDiv[i]);
+ szNew[i] = pParent->xCellSize(pParent, apDiv[i]);
+
+ /* Drop the cell from the parent page. apDiv[i] still points to
+ ** the cell within the parent, even though it has been dropped.
+ ** This is safe because dropping a cell only overwrites the first
+ ** four bytes of it, and this function does not need the first
+ ** four bytes of the divider cell. So the pointer is safe to use
+ ** later on.
+ **
+ ** But not if we are in secure-delete mode. In secure-delete mode,
+ ** the dropCell() routine will overwrite the entire cell with zeroes.
+ ** In this case, temporarily copy the cell into the aOvflSpace[]
+ ** buffer. It will be copied out again as soon as the aSpace[] buffer
+ ** is allocated. */
+ if( pBt->btsFlags & BTS_FAST_SECURE ){
+ int iOff;
+
+ /* If the following if() condition is not true, the db is corrupted.
+ ** The call to dropCell() below will detect this. */
+ iOff = SQLITE_PTR_TO_INT(apDiv[i]) - SQLITE_PTR_TO_INT(pParent->aData);
+ if( (iOff+szNew[i])<=(int)pBt->usableSize ){
+ memcpy(&aOvflSpace[iOff], apDiv[i], szNew[i]);
+ apDiv[i] = &aOvflSpace[apDiv[i]-pParent->aData];
+ }
+ }
+ dropCell(pParent, i+nxDiv-pParent->nOverflow, szNew[i], &rc);
+ }
+ }
+
+ /* Make nMaxCells a multiple of 4 in order to preserve 8-byte
+ ** alignment */
+ nMaxCells = (nMaxCells + 3)&~3;
+
+ /*
+ ** Allocate space for memory structures
+ */
+ szScratch =
+ nMaxCells*sizeof(u8*) /* b.apCell */
+ + nMaxCells*sizeof(u16) /* b.szCell */
+ + pBt->pageSize; /* aSpace1 */
+
+ assert( szScratch<=7*(int)pBt->pageSize );
+ b.apCell = sqlite3StackAllocRaw(0, szScratch );
+ if( b.apCell==0 ){
+ rc = SQLITE_NOMEM_BKPT;
+ goto balance_cleanup;
+ }
+ b.szCell = (u16*)&b.apCell[nMaxCells];
+ aSpace1 = (u8*)&b.szCell[nMaxCells];
+ assert( EIGHT_BYTE_ALIGNMENT(aSpace1) );
+
+ /*
+ ** Load pointers to all cells on sibling pages and the divider cells
+ ** into the local b.apCell[] array. Make copies of the divider cells
+ ** into space obtained from aSpace1[]. The divider cells have already
+ ** been removed from pParent.
+ **
+ ** If the siblings are on leaf pages, then the child pointers of the
+ ** divider cells are stripped from the cells before they are copied
+ ** into aSpace1[]. In this way, all cells in b.apCell[] are without
+ ** child pointers. If siblings are not leaves, then all cell in
+ ** b.apCell[] include child pointers. Either way, all cells in b.apCell[]
+ ** are alike.
+ **
+ ** leafCorrection: 4 if pPage is a leaf. 0 if pPage is not a leaf.
+ ** leafData: 1 if pPage holds key+data and pParent holds only keys.
+ */
+ b.pRef = apOld[0];
+ leafCorrection = b.pRef->leaf*4;
+ leafData = b.pRef->intKeyLeaf;
+ for(i=0; i<nOld; i++){
+ MemPage *pOld = apOld[i];
+ int limit = pOld->nCell;
+ u8 *aData = pOld->aData;
+ u16 maskPage = pOld->maskPage;
+ u8 *piCell = aData + pOld->cellOffset;
+ u8 *piEnd;
+ VVA_ONLY( int nCellAtStart = b.nCell; )
+
+ /* Verify that all sibling pages are of the same "type" (table-leaf,
+ ** table-interior, index-leaf, or index-interior).
+ */
+ if( pOld->aData[0]!=apOld[0]->aData[0] ){
+ rc = SQLITE_CORRUPT_PAGE(pOld);
+ goto balance_cleanup;
+ }
+
+ /* Load b.apCell[] with pointers to all cells in pOld. If pOld
+ ** contains overflow cells, include them in the b.apCell[] array
+ ** in the correct spot.
+ **
+ ** Note that when there are multiple overflow cells, it is always the
+ ** case that they are sequential and adjacent. This invariant arises
+ ** because multiple overflows can only occurs when inserting divider
+ ** cells into a parent on a prior balance, and divider cells are always
+ ** adjacent and are inserted in order. There is an assert() tagged
+ ** with "NOTE 1" in the overflow cell insertion loop to prove this
+ ** invariant.
+ **
+ ** This must be done in advance. Once the balance starts, the cell
+ ** offset section of the btree page will be overwritten and we will no
+ ** long be able to find the cells if a pointer to each cell is not saved
+ ** first.
+ */
+ memset(&b.szCell[b.nCell], 0, sizeof(b.szCell[0])*(limit+pOld->nOverflow));
+ if( pOld->nOverflow>0 ){
+ if( NEVER(limit<pOld->aiOvfl[0]) ){
+ rc = SQLITE_CORRUPT_PAGE(pOld);
+ goto balance_cleanup;
+ }
+ limit = pOld->aiOvfl[0];
+ for(j=0; j<limit; j++){
+ b.apCell[b.nCell] = aData + (maskPage & get2byteAligned(piCell));
+ piCell += 2;
+ b.nCell++;
+ }
+ for(k=0; k<pOld->nOverflow; k++){
+ assert( k==0 || pOld->aiOvfl[k-1]+1==pOld->aiOvfl[k] );/* NOTE 1 */
+ b.apCell[b.nCell] = pOld->apOvfl[k];
+ b.nCell++;
+ }
+ }
+ piEnd = aData + pOld->cellOffset + 2*pOld->nCell;
+ while( piCell<piEnd ){
+ assert( b.nCell<nMaxCells );
+ b.apCell[b.nCell] = aData + (maskPage & get2byteAligned(piCell));
+ piCell += 2;
+ b.nCell++;
+ }
+ assert( (b.nCell-nCellAtStart)==(pOld->nCell+pOld->nOverflow) );
+
+ cntOld[i] = b.nCell;
+ if( i<nOld-1 && !leafData){
+ u16 sz = (u16)szNew[i];
+ u8 *pTemp;
+ assert( b.nCell<nMaxCells );
+ b.szCell[b.nCell] = sz;
+ pTemp = &aSpace1[iSpace1];
+ iSpace1 += sz;
+ assert( sz<=pBt->maxLocal+23 );
+ assert( iSpace1 <= (int)pBt->pageSize );
+ memcpy(pTemp, apDiv[i], sz);
+ b.apCell[b.nCell] = pTemp+leafCorrection;
+ assert( leafCorrection==0 || leafCorrection==4 );
+ b.szCell[b.nCell] = b.szCell[b.nCell] - leafCorrection;
+ if( !pOld->leaf ){
+ assert( leafCorrection==0 );
+ assert( pOld->hdrOffset==0 || CORRUPT_DB );
+ /* The right pointer of the child page pOld becomes the left
+ ** pointer of the divider cell */
+ memcpy(b.apCell[b.nCell], &pOld->aData[8], 4);
+ }else{
+ assert( leafCorrection==4 );
+ while( b.szCell[b.nCell]<4 ){
+ /* Do not allow any cells smaller than 4 bytes. If a smaller cell
+ ** does exist, pad it with 0x00 bytes. */
+ assert( b.szCell[b.nCell]==3 || CORRUPT_DB );
+ assert( b.apCell[b.nCell]==&aSpace1[iSpace1-3] || CORRUPT_DB );
+ aSpace1[iSpace1++] = 0x00;
+ b.szCell[b.nCell]++;
+ }
+ }
+ b.nCell++;
+ }
+ }
+
+ /*
+ ** Figure out the number of pages needed to hold all b.nCell cells.
+ ** Store this number in "k". Also compute szNew[] which is the total
+ ** size of all cells on the i-th page and cntNew[] which is the index
+ ** in b.apCell[] of the cell that divides page i from page i+1.
+ ** cntNew[k] should equal b.nCell.
+ **
+ ** Values computed by this block:
+ **
+ ** k: The total number of sibling pages
+ ** szNew[i]: Spaced used on the i-th sibling page.
+ ** cntNew[i]: Index in b.apCell[] and b.szCell[] for the first cell to
+ ** the right of the i-th sibling page.
+ ** usableSpace: Number of bytes of space available on each sibling.
+ **
+ */
+ usableSpace = pBt->usableSize - 12 + leafCorrection;
+ for(i=k=0; i<nOld; i++, k++){
+ MemPage *p = apOld[i];
+ b.apEnd[k] = p->aDataEnd;
+ b.ixNx[k] = cntOld[i];
+ if( k && b.ixNx[k]==b.ixNx[k-1] ){
+ k--; /* Omit b.ixNx[] entry for child pages with no cells */
+ }
+ if( !leafData ){
+ k++;
+ b.apEnd[k] = pParent->aDataEnd;
+ b.ixNx[k] = cntOld[i]+1;
+ }
+ assert( p->nFree>=0 );
+ szNew[i] = usableSpace - p->nFree;
+ for(j=0; j<p->nOverflow; j++){
+ szNew[i] += 2 + p->xCellSize(p, p->apOvfl[j]);
+ }
+ cntNew[i] = cntOld[i];
+ }
+ k = nOld;
+ for(i=0; i<k; i++){
+ int sz;
+ while( szNew[i]>usableSpace ){
+ if( i+1>=k ){
+ k = i+2;
+ if( k>NB+2 ){ rc = SQLITE_CORRUPT_BKPT; goto balance_cleanup; }
+ szNew[k-1] = 0;
+ cntNew[k-1] = b.nCell;
+ }
+ sz = 2 + cachedCellSize(&b, cntNew[i]-1);
+ szNew[i] -= sz;
+ if( !leafData ){
+ if( cntNew[i]<b.nCell ){
+ sz = 2 + cachedCellSize(&b, cntNew[i]);
+ }else{
+ sz = 0;
+ }
+ }
+ szNew[i+1] += sz;
+ cntNew[i]--;
+ }
+ while( cntNew[i]<b.nCell ){
+ sz = 2 + cachedCellSize(&b, cntNew[i]);
+ if( szNew[i]+sz>usableSpace ) break;
+ szNew[i] += sz;
+ cntNew[i]++;
+ if( !leafData ){
+ if( cntNew[i]<b.nCell ){
+ sz = 2 + cachedCellSize(&b, cntNew[i]);
+ }else{
+ sz = 0;
+ }
+ }
+ szNew[i+1] -= sz;
+ }
+ if( cntNew[i]>=b.nCell ){
+ k = i+1;
+ }else if( cntNew[i] <= (i>0 ? cntNew[i-1] : 0) ){
+ rc = SQLITE_CORRUPT_BKPT;
+ goto balance_cleanup;
+ }
+ }
+
+ /*
+ ** The packing computed by the previous block is biased toward the siblings
+ ** on the left side (siblings with smaller keys). The left siblings are
+ ** always nearly full, while the right-most sibling might be nearly empty.
+ ** The next block of code attempts to adjust the packing of siblings to
+ ** get a better balance.
+ **
+ ** This adjustment is more than an optimization. The packing above might
+ ** be so out of balance as to be illegal. For example, the right-most
+ ** sibling might be completely empty. This adjustment is not optional.
+ */
+ for(i=k-1; i>0; i--){
+ int szRight = szNew[i]; /* Size of sibling on the right */
+ int szLeft = szNew[i-1]; /* Size of sibling on the left */
+ int r; /* Index of right-most cell in left sibling */
+ int d; /* Index of first cell to the left of right sibling */
+
+ r = cntNew[i-1] - 1;
+ d = r + 1 - leafData;
+ (void)cachedCellSize(&b, d);
+ do{
+ int szR, szD;
+ assert( d<nMaxCells );
+ assert( r<nMaxCells );
+ szR = cachedCellSize(&b, r);
+ szD = b.szCell[d];
+ if( szRight!=0
+ && (bBulk || szRight+szD+2 > szLeft-(szR+(i==k-1?0:2)))){
+ break;
+ }
+ szRight += szD + 2;
+ szLeft -= szR + 2;
+ cntNew[i-1] = r;
+ r--;
+ d--;
+ }while( r>=0 );
+ szNew[i] = szRight;
+ szNew[i-1] = szLeft;
+ if( cntNew[i-1] <= (i>1 ? cntNew[i-2] : 0) ){
+ rc = SQLITE_CORRUPT_BKPT;
+ goto balance_cleanup;
+ }
+ }
+
+ /* Sanity check: For a non-corrupt database file one of the following
+ ** must be true:
+ ** (1) We found one or more cells (cntNew[0])>0), or
+ ** (2) pPage is a virtual root page. A virtual root page is when
+ ** the real root page is page 1 and we are the only child of
+ ** that page.
+ */
+ assert( cntNew[0]>0 || (pParent->pgno==1 && pParent->nCell==0) || CORRUPT_DB);
+ TRACE(("BALANCE: old: %u(nc=%u) %u(nc=%u) %u(nc=%u)\n",
+ apOld[0]->pgno, apOld[0]->nCell,
+ nOld>=2 ? apOld[1]->pgno : 0, nOld>=2 ? apOld[1]->nCell : 0,
+ nOld>=3 ? apOld[2]->pgno : 0, nOld>=3 ? apOld[2]->nCell : 0
+ ));
+
+ /*
+ ** Allocate k new pages. Reuse old pages where possible.
+ */
+ pageFlags = apOld[0]->aData[0];
+ for(i=0; i<k; i++){
+ MemPage *pNew;
+ if( i<nOld ){
+ pNew = apNew[i] = apOld[i];
+ apOld[i] = 0;
+ rc = sqlite3PagerWrite(pNew->pDbPage);
+ nNew++;
+ if( sqlite3PagerPageRefcount(pNew->pDbPage)!=1+(i==(iParentIdx-nxDiv))
+ && rc==SQLITE_OK
+ ){
+ rc = SQLITE_CORRUPT_BKPT;
+ }
+ if( rc ) goto balance_cleanup;
+ }else{
+ assert( i>0 );
+ rc = allocateBtreePage(pBt, &pNew, &pgno, (bBulk ? 1 : pgno), 0);
+ if( rc ) goto balance_cleanup;
+ zeroPage(pNew, pageFlags);
+ apNew[i] = pNew;
+ nNew++;
+ cntOld[i] = b.nCell;
+
+ /* Set the pointer-map entry for the new sibling page. */
+ if( ISAUTOVACUUM(pBt) ){
+ ptrmapPut(pBt, pNew->pgno, PTRMAP_BTREE, pParent->pgno, &rc);
+ if( rc!=SQLITE_OK ){
+ goto balance_cleanup;
+ }
+ }
+ }
+ }
+
+ /*
+ ** Reassign page numbers so that the new pages are in ascending order.
+ ** This helps to keep entries in the disk file in order so that a scan
+ ** of the table is closer to a linear scan through the file. That in turn
+ ** helps the operating system to deliver pages from the disk more rapidly.
+ **
+ ** An O(N*N) sort algorithm is used, but since N is never more than NB+2
+ ** (5), that is not a performance concern.
+ **
+ ** When NB==3, this one optimization makes the database about 25% faster
+ ** for large insertions and deletions.
+ */
+ for(i=0; i<nNew; i++){
+ aPgno[i] = apNew[i]->pgno;
+ assert( apNew[i]->pDbPage->flags & PGHDR_WRITEABLE );
+ assert( apNew[i]->pDbPage->flags & PGHDR_DIRTY );
+ }
+ for(i=0; i<nNew-1; i++){
+ int iB = i;
+ for(j=i+1; j<nNew; j++){
+ if( apNew[j]->pgno < apNew[iB]->pgno ) iB = j;
+ }
+
+ /* If apNew[i] has a page number that is bigger than any of the
+ ** subsequence apNew[i] entries, then swap apNew[i] with the subsequent
+ ** entry that has the smallest page number (which we know to be
+ ** entry apNew[iB]).
+ */
+ if( iB!=i ){
+ Pgno pgnoA = apNew[i]->pgno;
+ Pgno pgnoB = apNew[iB]->pgno;
+ Pgno pgnoTemp = (PENDING_BYTE/pBt->pageSize)+1;
+ u16 fgA = apNew[i]->pDbPage->flags;
+ u16 fgB = apNew[iB]->pDbPage->flags;
+ sqlite3PagerRekey(apNew[i]->pDbPage, pgnoTemp, fgB);
+ sqlite3PagerRekey(apNew[iB]->pDbPage, pgnoA, fgA);
+ sqlite3PagerRekey(apNew[i]->pDbPage, pgnoB, fgB);
+ apNew[i]->pgno = pgnoB;
+ apNew[iB]->pgno = pgnoA;
+ }
+ }
+
+ TRACE(("BALANCE: new: %u(%u nc=%u) %u(%u nc=%u) %u(%u nc=%u) "
+ "%u(%u nc=%u) %u(%u nc=%u)\n",
+ apNew[0]->pgno, szNew[0], cntNew[0],
+ nNew>=2 ? apNew[1]->pgno : 0, nNew>=2 ? szNew[1] : 0,
+ nNew>=2 ? cntNew[1] - cntNew[0] - !leafData : 0,
+ nNew>=3 ? apNew[2]->pgno : 0, nNew>=3 ? szNew[2] : 0,
+ nNew>=3 ? cntNew[2] - cntNew[1] - !leafData : 0,
+ nNew>=4 ? apNew[3]->pgno : 0, nNew>=4 ? szNew[3] : 0,
+ nNew>=4 ? cntNew[3] - cntNew[2] - !leafData : 0,
+ nNew>=5 ? apNew[4]->pgno : 0, nNew>=5 ? szNew[4] : 0,
+ nNew>=5 ? cntNew[4] - cntNew[3] - !leafData : 0
+ ));
+
+ assert( sqlite3PagerIswriteable(pParent->pDbPage) );
+ assert( nNew>=1 && nNew<=ArraySize(apNew) );
+ assert( apNew[nNew-1]!=0 );
+ put4byte(pRight, apNew[nNew-1]->pgno);
+
+ /* If the sibling pages are not leaves, ensure that the right-child pointer
+ ** of the right-most new sibling page is set to the value that was
+ ** originally in the same field of the right-most old sibling page. */
+ if( (pageFlags & PTF_LEAF)==0 && nOld!=nNew ){
+ MemPage *pOld = (nNew>nOld ? apNew : apOld)[nOld-1];
+ memcpy(&apNew[nNew-1]->aData[8], &pOld->aData[8], 4);
+ }
+
+ /* Make any required updates to pointer map entries associated with
+ ** cells stored on sibling pages following the balance operation. Pointer
+ ** map entries associated with divider cells are set by the insertCell()
+ ** routine. The associated pointer map entries are:
+ **
+ ** a) if the cell contains a reference to an overflow chain, the
+ ** entry associated with the first page in the overflow chain, and
+ **
+ ** b) if the sibling pages are not leaves, the child page associated
+ ** with the cell.
+ **
+ ** If the sibling pages are not leaves, then the pointer map entry
+ ** associated with the right-child of each sibling may also need to be
+ ** updated. This happens below, after the sibling pages have been
+ ** populated, not here.
+ */
+ if( ISAUTOVACUUM(pBt) ){
+ MemPage *pOld;
+ MemPage *pNew = pOld = apNew[0];
+ int cntOldNext = pNew->nCell + pNew->nOverflow;
+ int iNew = 0;
+ int iOld = 0;
+
+ for(i=0; i<b.nCell; i++){
+ u8 *pCell = b.apCell[i];
+ while( i==cntOldNext ){
+ iOld++;
+ assert( iOld<nNew || iOld<nOld );
+ assert( iOld>=0 && iOld<NB );
+ pOld = iOld<nNew ? apNew[iOld] : apOld[iOld];
+ cntOldNext += pOld->nCell + pOld->nOverflow + !leafData;
+ }
+ if( i==cntNew[iNew] ){
+ pNew = apNew[++iNew];
+ if( !leafData ) continue;
+ }
+
+ /* Cell pCell is destined for new sibling page pNew. Originally, it
+ ** was either part of sibling page iOld (possibly an overflow cell),
+ ** or else the divider cell to the left of sibling page iOld. So,
+ ** if sibling page iOld had the same page number as pNew, and if
+ ** pCell really was a part of sibling page iOld (not a divider or
+ ** overflow cell), we can skip updating the pointer map entries. */
+ if( iOld>=nNew
+ || pNew->pgno!=aPgno[iOld]
+ || !SQLITE_WITHIN(pCell,pOld->aData,pOld->aDataEnd)
+ ){
+ if( !leafCorrection ){
+ ptrmapPut(pBt, get4byte(pCell), PTRMAP_BTREE, pNew->pgno, &rc);
+ }
+ if( cachedCellSize(&b,i)>pNew->minLocal ){
+ ptrmapPutOvflPtr(pNew, pOld, pCell, &rc);
+ }
+ if( rc ) goto balance_cleanup;
+ }
+ }
+ }
+
+ /* Insert new divider cells into pParent. */
+ for(i=0; i<nNew-1; i++){
+ u8 *pCell;
+ u8 *pTemp;
+ int sz;
+ u8 *pSrcEnd;
+ MemPage *pNew = apNew[i];
+ j = cntNew[i];
+
+ assert( j<nMaxCells );
+ assert( b.apCell[j]!=0 );
+ pCell = b.apCell[j];
+ sz = b.szCell[j] + leafCorrection;
+ pTemp = &aOvflSpace[iOvflSpace];
+ if( !pNew->leaf ){
+ memcpy(&pNew->aData[8], pCell, 4);
+ }else if( leafData ){
+ /* If the tree is a leaf-data tree, and the siblings are leaves,
+ ** then there is no divider cell in b.apCell[]. Instead, the divider
+ ** cell consists of the integer key for the right-most cell of
+ ** the sibling-page assembled above only.
+ */
+ CellInfo info;
+ j--;
+ pNew->xParseCell(pNew, b.apCell[j], &info);
+ pCell = pTemp;
+ sz = 4 + putVarint(&pCell[4], info.nKey);
+ pTemp = 0;
+ }else{
+ pCell -= 4;
+ /* Obscure case for non-leaf-data trees: If the cell at pCell was
+ ** previously stored on a leaf node, and its reported size was 4
+ ** bytes, then it may actually be smaller than this
+ ** (see btreeParseCellPtr(), 4 bytes is the minimum size of
+ ** any cell). But it is important to pass the correct size to
+ ** insertCell(), so reparse the cell now.
+ **
+ ** This can only happen for b-trees used to evaluate "IN (SELECT ...)"
+ ** and WITHOUT ROWID tables with exactly one column which is the
+ ** primary key.
+ */
+ if( b.szCell[j]==4 ){
+ assert(leafCorrection==4);
+ sz = pParent->xCellSize(pParent, pCell);
+ }
+ }
+ iOvflSpace += sz;
+ assert( sz<=pBt->maxLocal+23 );
+ assert( iOvflSpace <= (int)pBt->pageSize );
+ assert( b.ixNx[NB*2-1]>j );
+ for(k=0; b.ixNx[k]<=j; k++){}
+ pSrcEnd = b.apEnd[k];
+ if( SQLITE_OVERFLOW(pSrcEnd, pCell, pCell+sz) ){
+ rc = SQLITE_CORRUPT_BKPT;
+ goto balance_cleanup;
+ }
+ rc = insertCell(pParent, nxDiv+i, pCell, sz, pTemp, pNew->pgno);
+ if( rc!=SQLITE_OK ) goto balance_cleanup;
+ assert( sqlite3PagerIswriteable(pParent->pDbPage) );
+ }
+
+ /* Now update the actual sibling pages. The order in which they are updated
+ ** is important, as this code needs to avoid disrupting any page from which
+ ** cells may still to be read. In practice, this means:
+ **
+ ** (1) If cells are moving left (from apNew[iPg] to apNew[iPg-1])
+ ** then it is not safe to update page apNew[iPg] until after
+ ** the left-hand sibling apNew[iPg-1] has been updated.
+ **
+ ** (2) If cells are moving right (from apNew[iPg] to apNew[iPg+1])
+ ** then it is not safe to update page apNew[iPg] until after
+ ** the right-hand sibling apNew[iPg+1] has been updated.
+ **
+ ** If neither of the above apply, the page is safe to update.
+ **
+ ** The iPg value in the following loop starts at nNew-1 goes down
+ ** to 0, then back up to nNew-1 again, thus making two passes over
+ ** the pages. On the initial downward pass, only condition (1) above
+ ** needs to be tested because (2) will always be true from the previous
+ ** step. On the upward pass, both conditions are always true, so the
+ ** upwards pass simply processes pages that were missed on the downward
+ ** pass.
+ */
+ for(i=1-nNew; i<nNew; i++){
+ int iPg = i<0 ? -i : i;
+ assert( iPg>=0 && iPg<nNew );
+ assert( iPg>=1 || i>=0 );
+ assert( iPg<ArraySize(cntOld) );
+ if( abDone[iPg] ) continue; /* Skip pages already processed */
+ if( i>=0 /* On the upwards pass, or... */
+ || cntOld[iPg-1]>=cntNew[iPg-1] /* Condition (1) is true */
+ ){
+ int iNew;
+ int iOld;
+ int nNewCell;
+
+ /* Verify condition (1): If cells are moving left, update iPg
+ ** only after iPg-1 has already been updated. */
+ assert( iPg==0 || cntOld[iPg-1]>=cntNew[iPg-1] || abDone[iPg-1] );
+
+ /* Verify condition (2): If cells are moving right, update iPg
+ ** only after iPg+1 has already been updated. */
+ assert( cntNew[iPg]>=cntOld[iPg] || abDone[iPg+1] );
+
+ if( iPg==0 ){
+ iNew = iOld = 0;
+ nNewCell = cntNew[0];
+ }else{
+ iOld = iPg<nOld ? (cntOld[iPg-1] + !leafData) : b.nCell;
+ iNew = cntNew[iPg-1] + !leafData;
+ nNewCell = cntNew[iPg] - iNew;
+ }
+
+ rc = editPage(apNew[iPg], iOld, iNew, nNewCell, &b);
+ if( rc ) goto balance_cleanup;
+ abDone[iPg]++;
+ apNew[iPg]->nFree = usableSpace-szNew[iPg];
+ assert( apNew[iPg]->nOverflow==0 );
+ assert( apNew[iPg]->nCell==nNewCell );
+ }
+ }
+
+ /* All pages have been processed exactly once */
+ assert( memcmp(abDone, "\01\01\01\01\01", nNew)==0 );
+
+ assert( nOld>0 );
+ assert( nNew>0 );
+
+ if( isRoot && pParent->nCell==0 && pParent->hdrOffset<=apNew[0]->nFree ){
+ /* The root page of the b-tree now contains no cells. The only sibling
+ ** page is the right-child of the parent. Copy the contents of the
+ ** child page into the parent, decreasing the overall height of the
+ ** b-tree structure by one. This is described as the "balance-shallower"
+ ** sub-algorithm in some documentation.
+ **
+ ** If this is an auto-vacuum database, the call to copyNodeContent()
+ ** sets all pointer-map entries corresponding to database image pages
+ ** for which the pointer is stored within the content being copied.
+ **
+ ** It is critical that the child page be defragmented before being
+ ** copied into the parent, because if the parent is page 1 then it will
+ ** by smaller than the child due to the database header, and so all the
+ ** free space needs to be up front.
+ */
+ assert( nNew==1 || CORRUPT_DB );
+ rc = defragmentPage(apNew[0], -1);
+ testcase( rc!=SQLITE_OK );
+ assert( apNew[0]->nFree ==
+ (get2byteNotZero(&apNew[0]->aData[5]) - apNew[0]->cellOffset
+ - apNew[0]->nCell*2)
+ || rc!=SQLITE_OK
+ );
+ copyNodeContent(apNew[0], pParent, &rc);
+ freePage(apNew[0], &rc);
+ }else if( ISAUTOVACUUM(pBt) && !leafCorrection ){
+ /* Fix the pointer map entries associated with the right-child of each
+ ** sibling page. All other pointer map entries have already been taken
+ ** care of. */
+ for(i=0; i<nNew; i++){
+ u32 key = get4byte(&apNew[i]->aData[8]);
+ ptrmapPut(pBt, key, PTRMAP_BTREE, apNew[i]->pgno, &rc);
+ }
+ }
+
+ assert( pParent->isInit );
+ TRACE(("BALANCE: finished: old=%u new=%u cells=%u\n",
+ nOld, nNew, b.nCell));
+
+ /* Free any old pages that were not reused as new pages.
+ */
+ for(i=nNew; i<nOld; i++){
+ freePage(apOld[i], &rc);
+ }
+
+#if 0
+ if( ISAUTOVACUUM(pBt) && rc==SQLITE_OK && apNew[0]->isInit ){
+ /* The ptrmapCheckPages() contains assert() statements that verify that
+ ** all pointer map pages are set correctly. This is helpful while
+ ** debugging. This is usually disabled because a corrupt database may
+ ** cause an assert() statement to fail. */
+ ptrmapCheckPages(apNew, nNew);
+ ptrmapCheckPages(&pParent, 1);
+ }
+#endif
+
+ /*
+ ** Cleanup before returning.
+ */
+balance_cleanup:
+ sqlite3StackFree(0, b.apCell);
+ for(i=0; i<nOld; i++){
+ releasePage(apOld[i]);
+ }
+ for(i=0; i<nNew; i++){
+ releasePage(apNew[i]);
+ }
+
+ return rc;
+}
+
+
+/*
+** This function is called when the root page of a b-tree structure is
+** overfull (has one or more overflow pages).
+**
+** A new child page is allocated and the contents of the current root
+** page, including overflow cells, are copied into the child. The root
+** page is then overwritten to make it an empty page with the right-child
+** pointer pointing to the new page.
+**
+** Before returning, all pointer-map entries corresponding to pages
+** that the new child-page now contains pointers to are updated. The
+** entry corresponding to the new right-child pointer of the root
+** page is also updated.
+**
+** If successful, *ppChild is set to contain a reference to the child
+** page and SQLITE_OK is returned. In this case the caller is required
+** to call releasePage() on *ppChild exactly once. If an error occurs,
+** an error code is returned and *ppChild is set to 0.
+*/
+static int balance_deeper(MemPage *pRoot, MemPage **ppChild){
+ int rc; /* Return value from subprocedures */
+ MemPage *pChild = 0; /* Pointer to a new child page */
+ Pgno pgnoChild = 0; /* Page number of the new child page */
+ BtShared *pBt = pRoot->pBt; /* The BTree */
+
+ assert( pRoot->nOverflow>0 );
+ assert( sqlite3_mutex_held(pBt->mutex) );
+
+ /* Make pRoot, the root page of the b-tree, writable. Allocate a new
+ ** page that will become the new right-child of pPage. Copy the contents
+ ** of the node stored on pRoot into the new child page.
+ */
+ rc = sqlite3PagerWrite(pRoot->pDbPage);
+ if( rc==SQLITE_OK ){
+ rc = allocateBtreePage(pBt,&pChild,&pgnoChild,pRoot->pgno,0);
+ copyNodeContent(pRoot, pChild, &rc);
+ if( ISAUTOVACUUM(pBt) ){
+ ptrmapPut(pBt, pgnoChild, PTRMAP_BTREE, pRoot->pgno, &rc);
+ }
+ }
+ if( rc ){
+ *ppChild = 0;
+ releasePage(pChild);
+ return rc;
+ }
+ assert( sqlite3PagerIswriteable(pChild->pDbPage) );
+ assert( sqlite3PagerIswriteable(pRoot->pDbPage) );
+ assert( pChild->nCell==pRoot->nCell || CORRUPT_DB );
+
+ TRACE(("BALANCE: copy root %u into %u\n", pRoot->pgno, pChild->pgno));
+
+ /* Copy the overflow cells from pRoot to pChild */
+ memcpy(pChild->aiOvfl, pRoot->aiOvfl,
+ pRoot->nOverflow*sizeof(pRoot->aiOvfl[0]));
+ memcpy(pChild->apOvfl, pRoot->apOvfl,
+ pRoot->nOverflow*sizeof(pRoot->apOvfl[0]));
+ pChild->nOverflow = pRoot->nOverflow;
+
+ /* Zero the contents of pRoot. Then install pChild as the right-child. */
+ zeroPage(pRoot, pChild->aData[0] & ~PTF_LEAF);
+ put4byte(&pRoot->aData[pRoot->hdrOffset+8], pgnoChild);
+
+ *ppChild = pChild;
+ return SQLITE_OK;
+}
+
+/*
+** Return SQLITE_CORRUPT if any cursor other than pCur is currently valid
+** on the same B-tree as pCur.
+**
+** This can occur if a database is corrupt with two or more SQL tables
+** pointing to the same b-tree. If an insert occurs on one SQL table
+** and causes a BEFORE TRIGGER to do a secondary insert on the other SQL
+** table linked to the same b-tree. If the secondary insert causes a
+** rebalance, that can change content out from under the cursor on the
+** first SQL table, violating invariants on the first insert.
+*/
+static int anotherValidCursor(BtCursor *pCur){
+ BtCursor *pOther;
+ for(pOther=pCur->pBt->pCursor; pOther; pOther=pOther->pNext){
+ if( pOther!=pCur
+ && pOther->eState==CURSOR_VALID
+ && pOther->pPage==pCur->pPage
+ ){
+ return SQLITE_CORRUPT_PAGE(pCur->pPage);
+ }
+ }
+ return SQLITE_OK;
+}
+
+/*
+** The page that pCur currently points to has just been modified in
+** some way. This function figures out if this modification means the
+** tree needs to be balanced, and if so calls the appropriate balancing
+** routine. Balancing routines are:
+**
+** balance_quick()
+** balance_deeper()
+** balance_nonroot()
+*/
+static int balance(BtCursor *pCur){
+ int rc = SQLITE_OK;
+ u8 aBalanceQuickSpace[13];
+ u8 *pFree = 0;
+
+ VVA_ONLY( int balance_quick_called = 0 );
+ VVA_ONLY( int balance_deeper_called = 0 );
+
+ do {
+ int iPage;
+ MemPage *pPage = pCur->pPage;
+
+ if( NEVER(pPage->nFree<0) && btreeComputeFreeSpace(pPage) ) break;
+ if( pPage->nOverflow==0 && pPage->nFree*3<=(int)pCur->pBt->usableSize*2 ){
+ /* No rebalance required as long as:
+ ** (1) There are no overflow cells
+ ** (2) The amount of free space on the page is less than 2/3rds of
+ ** the total usable space on the page. */
+ break;
+ }else if( (iPage = pCur->iPage)==0 ){
+ if( pPage->nOverflow && (rc = anotherValidCursor(pCur))==SQLITE_OK ){
+ /* The root page of the b-tree is overfull. In this case call the
+ ** balance_deeper() function to create a new child for the root-page
+ ** and copy the current contents of the root-page to it. The
+ ** next iteration of the do-loop will balance the child page.
+ */
+ assert( balance_deeper_called==0 );
+ VVA_ONLY( balance_deeper_called++ );
+ rc = balance_deeper(pPage, &pCur->apPage[1]);
+ if( rc==SQLITE_OK ){
+ pCur->iPage = 1;
+ pCur->ix = 0;
+ pCur->aiIdx[0] = 0;
+ pCur->apPage[0] = pPage;
+ pCur->pPage = pCur->apPage[1];
+ assert( pCur->pPage->nOverflow );
+ }
+ }else{
+ break;
+ }
+ }else if( sqlite3PagerPageRefcount(pPage->pDbPage)>1 ){
+ /* The page being written is not a root page, and there is currently
+ ** more than one reference to it. This only happens if the page is one
+ ** of its own ancestor pages. Corruption. */
+ rc = SQLITE_CORRUPT_PAGE(pPage);
+ }else{
+ MemPage * const pParent = pCur->apPage[iPage-1];
+ int const iIdx = pCur->aiIdx[iPage-1];
+
+ rc = sqlite3PagerWrite(pParent->pDbPage);
+ if( rc==SQLITE_OK && pParent->nFree<0 ){
+ rc = btreeComputeFreeSpace(pParent);
+ }
+ if( rc==SQLITE_OK ){
+#ifndef SQLITE_OMIT_QUICKBALANCE
+ if( pPage->intKeyLeaf
+ && pPage->nOverflow==1
+ && pPage->aiOvfl[0]==pPage->nCell
+ && pParent->pgno!=1
+ && pParent->nCell==iIdx
+ ){
+ /* Call balance_quick() to create a new sibling of pPage on which
+ ** to store the overflow cell. balance_quick() inserts a new cell
+ ** into pParent, which may cause pParent overflow. If this
+ ** happens, the next iteration of the do-loop will balance pParent
+ ** use either balance_nonroot() or balance_deeper(). Until this
+ ** happens, the overflow cell is stored in the aBalanceQuickSpace[]
+ ** buffer.
+ **
+ ** The purpose of the following assert() is to check that only a
+ ** single call to balance_quick() is made for each call to this
+ ** function. If this were not verified, a subtle bug involving reuse
+ ** of the aBalanceQuickSpace[] might sneak in.
+ */
+ assert( balance_quick_called==0 );
+ VVA_ONLY( balance_quick_called++ );
+ rc = balance_quick(pParent, pPage, aBalanceQuickSpace);
+ }else
+#endif
+ {
+ /* In this case, call balance_nonroot() to redistribute cells
+ ** between pPage and up to 2 of its sibling pages. This involves
+ ** modifying the contents of pParent, which may cause pParent to
+ ** become overfull or underfull. The next iteration of the do-loop
+ ** will balance the parent page to correct this.
+ **
+ ** If the parent page becomes overfull, the overflow cell or cells
+ ** are stored in the pSpace buffer allocated immediately below.
+ ** A subsequent iteration of the do-loop will deal with this by
+ ** calling balance_nonroot() (balance_deeper() may be called first,
+ ** but it doesn't deal with overflow cells - just moves them to a
+ ** different page). Once this subsequent call to balance_nonroot()
+ ** has completed, it is safe to release the pSpace buffer used by
+ ** the previous call, as the overflow cell data will have been
+ ** copied either into the body of a database page or into the new
+ ** pSpace buffer passed to the latter call to balance_nonroot().
+ */
+ u8 *pSpace = sqlite3PageMalloc(pCur->pBt->pageSize);
+ rc = balance_nonroot(pParent, iIdx, pSpace, iPage==1,
+ pCur->hints&BTREE_BULKLOAD);
+ if( pFree ){
+ /* If pFree is not NULL, it points to the pSpace buffer used
+ ** by a previous call to balance_nonroot(). Its contents are
+ ** now stored either on real database pages or within the
+ ** new pSpace buffer, so it may be safely freed here. */
+ sqlite3PageFree(pFree);
+ }
+
+ /* The pSpace buffer will be freed after the next call to
+ ** balance_nonroot(), or just before this function returns, whichever
+ ** comes first. */
+ pFree = pSpace;
+ }
+ }
+
+ pPage->nOverflow = 0;
+
+ /* The next iteration of the do-loop balances the parent page. */
+ releasePage(pPage);
+ pCur->iPage--;
+ assert( pCur->iPage>=0 );
+ pCur->pPage = pCur->apPage[pCur->iPage];
+ }
+ }while( rc==SQLITE_OK );
+
+ if( pFree ){
+ sqlite3PageFree(pFree);
+ }
+ return rc;
+}
+
+/* Overwrite content from pX into pDest. Only do the write if the
+** content is different from what is already there.
+*/
+static int btreeOverwriteContent(
+ MemPage *pPage, /* MemPage on which writing will occur */
+ u8 *pDest, /* Pointer to the place to start writing */
+ const BtreePayload *pX, /* Source of data to write */
+ int iOffset, /* Offset of first byte to write */
+ int iAmt /* Number of bytes to be written */
+){
+ int nData = pX->nData - iOffset;
+ if( nData<=0 ){
+ /* Overwriting with zeros */
+ int i;
+ for(i=0; i<iAmt && pDest[i]==0; i++){}
+ if( i<iAmt ){
+ int rc = sqlite3PagerWrite(pPage->pDbPage);
+ if( rc ) return rc;
+ memset(pDest + i, 0, iAmt - i);
+ }
+ }else{
+ if( nData<iAmt ){
+ /* Mixed read data and zeros at the end. Make a recursive call
+ ** to write the zeros then fall through to write the real data */
+ int rc = btreeOverwriteContent(pPage, pDest+nData, pX, iOffset+nData,
+ iAmt-nData);
+ if( rc ) return rc;
+ iAmt = nData;
+ }
+ if( memcmp(pDest, ((u8*)pX->pData) + iOffset, iAmt)!=0 ){
+ int rc = sqlite3PagerWrite(pPage->pDbPage);
+ if( rc ) return rc;
+ /* In a corrupt database, it is possible for the source and destination
+ ** buffers to overlap. This is harmless since the database is already
+ ** corrupt but it does cause valgrind and ASAN warnings. So use
+ ** memmove(). */
+ memmove(pDest, ((u8*)pX->pData) + iOffset, iAmt);
+ }
+ }
+ return SQLITE_OK;
+}
+
+/*
+** Overwrite the cell that cursor pCur is pointing to with fresh content
+** contained in pX. In this variant, pCur is pointing to an overflow
+** cell.
+*/
+static SQLITE_NOINLINE int btreeOverwriteOverflowCell(
+ BtCursor *pCur, /* Cursor pointing to cell to overwrite */
+ const BtreePayload *pX /* Content to write into the cell */
+){
+ int iOffset; /* Next byte of pX->pData to write */
+ int nTotal = pX->nData + pX->nZero; /* Total bytes of to write */
+ int rc; /* Return code */
+ MemPage *pPage = pCur->pPage; /* Page being written */
+ BtShared *pBt; /* Btree */
+ Pgno ovflPgno; /* Next overflow page to write */
+ u32 ovflPageSize; /* Size to write on overflow page */
+
+ assert( pCur->info.nLocal<nTotal ); /* pCur is an overflow cell */
+
+ /* Overwrite the local portion first */
+ rc = btreeOverwriteContent(pPage, pCur->info.pPayload, pX,
+ 0, pCur->info.nLocal);
+ if( rc ) return rc;
+
+ /* Now overwrite the overflow pages */
+ iOffset = pCur->info.nLocal;
+ assert( nTotal>=0 );
+ assert( iOffset>=0 );
+ ovflPgno = get4byte(pCur->info.pPayload + iOffset);
+ pBt = pPage->pBt;
+ ovflPageSize = pBt->usableSize - 4;
+ do{
+ rc = btreeGetPage(pBt, ovflPgno, &pPage, 0);
+ if( rc ) return rc;
+ if( sqlite3PagerPageRefcount(pPage->pDbPage)!=1 || pPage->isInit ){
+ rc = SQLITE_CORRUPT_PAGE(pPage);
+ }else{
+ if( iOffset+ovflPageSize<(u32)nTotal ){
+ ovflPgno = get4byte(pPage->aData);
+ }else{
+ ovflPageSize = nTotal - iOffset;
+ }
+ rc = btreeOverwriteContent(pPage, pPage->aData+4, pX,
+ iOffset, ovflPageSize);
+ }
+ sqlite3PagerUnref(pPage->pDbPage);
+ if( rc ) return rc;
+ iOffset += ovflPageSize;
+ }while( iOffset<nTotal );
+ return SQLITE_OK;
+}
+
+/*
+** Overwrite the cell that cursor pCur is pointing to with fresh content
+** contained in pX.
+*/
+static int btreeOverwriteCell(BtCursor *pCur, const BtreePayload *pX){
+ int nTotal = pX->nData + pX->nZero; /* Total bytes of to write */
+ MemPage *pPage = pCur->pPage; /* Page being written */
+
+ if( pCur->info.pPayload + pCur->info.nLocal > pPage->aDataEnd
+ || pCur->info.pPayload < pPage->aData + pPage->cellOffset
+ ){
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ if( pCur->info.nLocal==nTotal ){
+ /* The entire cell is local */
+ return btreeOverwriteContent(pPage, pCur->info.pPayload, pX,
+ 0, pCur->info.nLocal);
+ }else{
+ /* The cell contains overflow content */
+ return btreeOverwriteOverflowCell(pCur, pX);
+ }
+}
+
+
+/*
+** Insert a new record into the BTree. The content of the new record
+** is described by the pX object. The pCur cursor is used only to
+** define what table the record should be inserted into, and is left
+** pointing at a random location.
+**
+** For a table btree (used for rowid tables), only the pX.nKey value of
+** the key is used. The pX.pKey value must be NULL. The pX.nKey is the
+** rowid or INTEGER PRIMARY KEY of the row. The pX.nData,pData,nZero fields
+** hold the content of the row.
+**
+** For an index btree (used for indexes and WITHOUT ROWID tables), the
+** key is an arbitrary byte sequence stored in pX.pKey,nKey. The
+** pX.pData,nData,nZero fields must be zero.
+**
+** If the seekResult parameter is non-zero, then a successful call to
+** sqlite3BtreeIndexMoveto() to seek cursor pCur to (pKey,nKey) has already
+** been performed. In other words, if seekResult!=0 then the cursor
+** is currently pointing to a cell that will be adjacent to the cell
+** to be inserted. If seekResult<0 then pCur points to a cell that is
+** smaller then (pKey,nKey). If seekResult>0 then pCur points to a cell
+** that is larger than (pKey,nKey).
+**
+** If seekResult==0, that means pCur is pointing at some unknown location.
+** In that case, this routine must seek the cursor to the correct insertion
+** point for (pKey,nKey) before doing the insertion. For index btrees,
+** if pX->nMem is non-zero, then pX->aMem contains pointers to the unpacked
+** key values and pX->aMem can be used instead of pX->pKey to avoid having
+** to decode the key.
+*/
+SQLITE_PRIVATE int sqlite3BtreeInsert(
+ BtCursor *pCur, /* Insert data into the table of this cursor */
+ const BtreePayload *pX, /* Content of the row to be inserted */
+ int flags, /* True if this is likely an append */
+ int seekResult /* Result of prior IndexMoveto() call */
+){
+ int rc;
+ int loc = seekResult; /* -1: before desired location +1: after */
+ int szNew = 0;
+ int idx;
+ MemPage *pPage;
+ Btree *p = pCur->pBtree;
+ unsigned char *oldCell;
+ unsigned char *newCell = 0;
+
+ assert( (flags & (BTREE_SAVEPOSITION|BTREE_APPEND|BTREE_PREFORMAT))==flags );
+ assert( (flags & BTREE_PREFORMAT)==0 || seekResult || pCur->pKeyInfo==0 );
+
+ /* Save the positions of any other cursors open on this table.
+ **
+ ** In some cases, the call to btreeMoveto() below is a no-op. For
+ ** example, when inserting data into a table with auto-generated integer
+ ** keys, the VDBE layer invokes sqlite3BtreeLast() to figure out the
+ ** integer key to use. It then calls this function to actually insert the
+ ** data into the intkey B-Tree. In this case btreeMoveto() recognizes
+ ** that the cursor is already where it needs to be and returns without
+ ** doing any work. To avoid thwarting these optimizations, it is important
+ ** not to clear the cursor here.
+ */
+ if( pCur->curFlags & BTCF_Multiple ){
+ rc = saveAllCursors(p->pBt, pCur->pgnoRoot, pCur);
+ if( rc ) return rc;
+ if( loc && pCur->iPage<0 ){
+ /* This can only happen if the schema is corrupt such that there is more
+ ** than one table or index with the same root page as used by the cursor.
+ ** Which can only happen if the SQLITE_NoSchemaError flag was set when
+ ** the schema was loaded. This cannot be asserted though, as a user might
+ ** set the flag, load the schema, and then unset the flag. */
+ return SQLITE_CORRUPT_PGNO(pCur->pgnoRoot);
+ }
+ }
+
+ /* Ensure that the cursor is not in the CURSOR_FAULT state and that it
+ ** points to a valid cell.
+ */
+ if( pCur->eState>=CURSOR_REQUIRESEEK ){
+ testcase( pCur->eState==CURSOR_REQUIRESEEK );
+ testcase( pCur->eState==CURSOR_FAULT );
+ rc = moveToRoot(pCur);
+ if( rc && rc!=SQLITE_EMPTY ) return rc;
+ }
+
+ assert( cursorOwnsBtShared(pCur) );
+ assert( (pCur->curFlags & BTCF_WriteFlag)!=0
+ && p->pBt->inTransaction==TRANS_WRITE
+ && (p->pBt->btsFlags & BTS_READ_ONLY)==0 );
+ assert( hasSharedCacheTableLock(p, pCur->pgnoRoot, pCur->pKeyInfo!=0, 2) );
+
+ /* Assert that the caller has been consistent. If this cursor was opened
+ ** expecting an index b-tree, then the caller should be inserting blob
+ ** keys with no associated data. If the cursor was opened expecting an
+ ** intkey table, the caller should be inserting integer keys with a
+ ** blob of associated data. */
+ assert( (flags & BTREE_PREFORMAT) || (pX->pKey==0)==(pCur->pKeyInfo==0) );
+
+ if( pCur->pKeyInfo==0 ){
+ assert( pX->pKey==0 );
+ /* If this is an insert into a table b-tree, invalidate any incrblob
+ ** cursors open on the row being replaced */
+ if( p->hasIncrblobCur ){
+ invalidateIncrblobCursors(p, pCur->pgnoRoot, pX->nKey, 0);
+ }
+
+ /* If BTREE_SAVEPOSITION is set, the cursor must already be pointing
+ ** to a row with the same key as the new entry being inserted.
+ */
+#ifdef SQLITE_DEBUG
+ if( flags & BTREE_SAVEPOSITION ){
+ assert( pCur->curFlags & BTCF_ValidNKey );
+ assert( pX->nKey==pCur->info.nKey );
+ assert( loc==0 );
+ }
+#endif
+
+ /* On the other hand, BTREE_SAVEPOSITION==0 does not imply
+ ** that the cursor is not pointing to a row to be overwritten.
+ ** So do a complete check.
+ */
+ if( (pCur->curFlags&BTCF_ValidNKey)!=0 && pX->nKey==pCur->info.nKey ){
+ /* The cursor is pointing to the entry that is to be
+ ** overwritten */
+ assert( pX->nData>=0 && pX->nZero>=0 );
+ if( pCur->info.nSize!=0
+ && pCur->info.nPayload==(u32)pX->nData+pX->nZero
+ ){
+ /* New entry is the same size as the old. Do an overwrite */
+ return btreeOverwriteCell(pCur, pX);
+ }
+ assert( loc==0 );
+ }else if( loc==0 ){
+ /* The cursor is *not* pointing to the cell to be overwritten, nor
+ ** to an adjacent cell. Move the cursor so that it is pointing either
+ ** to the cell to be overwritten or an adjacent cell.
+ */
+ rc = sqlite3BtreeTableMoveto(pCur, pX->nKey,
+ (flags & BTREE_APPEND)!=0, &loc);
+ if( rc ) return rc;
+ }
+ }else{
+ /* This is an index or a WITHOUT ROWID table */
+
+ /* If BTREE_SAVEPOSITION is set, the cursor must already be pointing
+ ** to a row with the same key as the new entry being inserted.
+ */
+ assert( (flags & BTREE_SAVEPOSITION)==0 || loc==0 );
+
+ /* If the cursor is not already pointing either to the cell to be
+ ** overwritten, or if a new cell is being inserted, if the cursor is
+ ** not pointing to an immediately adjacent cell, then move the cursor
+ ** so that it does.
+ */
+ if( loc==0 && (flags & BTREE_SAVEPOSITION)==0 ){
+ if( pX->nMem ){
+ UnpackedRecord r;
+ r.pKeyInfo = pCur->pKeyInfo;
+ r.aMem = pX->aMem;
+ r.nField = pX->nMem;
+ r.default_rc = 0;
+ r.eqSeen = 0;
+ rc = sqlite3BtreeIndexMoveto(pCur, &r, &loc);
+ }else{
+ rc = btreeMoveto(pCur, pX->pKey, pX->nKey,
+ (flags & BTREE_APPEND)!=0, &loc);
+ }
+ if( rc ) return rc;
+ }
+
+ /* If the cursor is currently pointing to an entry to be overwritten
+ ** and the new content is the same as as the old, then use the
+ ** overwrite optimization.
+ */
+ if( loc==0 ){
+ getCellInfo(pCur);
+ if( pCur->info.nKey==pX->nKey ){
+ BtreePayload x2;
+ x2.pData = pX->pKey;
+ x2.nData = pX->nKey;
+ x2.nZero = 0;
+ return btreeOverwriteCell(pCur, &x2);
+ }
+ }
+ }
+ assert( pCur->eState==CURSOR_VALID
+ || (pCur->eState==CURSOR_INVALID && loc) || CORRUPT_DB );
+
+ pPage = pCur->pPage;
+ assert( pPage->intKey || pX->nKey>=0 || (flags & BTREE_PREFORMAT) );
+ assert( pPage->leaf || !pPage->intKey );
+ if( pPage->nFree<0 ){
+ if( NEVER(pCur->eState>CURSOR_INVALID) ){
+ /* ^^^^^--- due to the moveToRoot() call above */
+ rc = SQLITE_CORRUPT_PAGE(pPage);
+ }else{
+ rc = btreeComputeFreeSpace(pPage);
+ }
+ if( rc ) return rc;
+ }
+
+ TRACE(("INSERT: table=%u nkey=%lld ndata=%u page=%u %s\n",
+ pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno,
+ loc==0 ? "overwrite" : "new entry"));
+ assert( pPage->isInit || CORRUPT_DB );
+ newCell = p->pBt->pTmpSpace;
+ assert( newCell!=0 );
+ assert( BTREE_PREFORMAT==OPFLAG_PREFORMAT );
+ if( flags & BTREE_PREFORMAT ){
+ rc = SQLITE_OK;
+ szNew = p->pBt->nPreformatSize;
+ if( szNew<4 ){
+ szNew = 4;
+ newCell[3] = 0;
+ }
+ if( ISAUTOVACUUM(p->pBt) && szNew>pPage->maxLocal ){
+ CellInfo info;
+ pPage->xParseCell(pPage, newCell, &info);
+ if( info.nPayload!=info.nLocal ){
+ Pgno ovfl = get4byte(&newCell[szNew-4]);
+ ptrmapPut(p->pBt, ovfl, PTRMAP_OVERFLOW1, pPage->pgno, &rc);
+ if( NEVER(rc) ) goto end_insert;
+ }
+ }
+ }else{
+ rc = fillInCell(pPage, newCell, pX, &szNew);
+ if( rc ) goto end_insert;
+ }
+ assert( szNew==pPage->xCellSize(pPage, newCell) );
+ assert( szNew <= MX_CELL_SIZE(p->pBt) );
+ idx = pCur->ix;
+ pCur->info.nSize = 0;
+ if( loc==0 ){
+ CellInfo info;
+ assert( idx>=0 );
+ if( idx>=pPage->nCell ){
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ rc = sqlite3PagerWrite(pPage->pDbPage);
+ if( rc ){
+ goto end_insert;
+ }
+ oldCell = findCell(pPage, idx);
+ if( !pPage->leaf ){
+ memcpy(newCell, oldCell, 4);
+ }
+ BTREE_CLEAR_CELL(rc, pPage, oldCell, info);
+ testcase( pCur->curFlags & BTCF_ValidOvfl );
+ invalidateOverflowCache(pCur);
+ if( info.nSize==szNew && info.nLocal==info.nPayload
+ && (!ISAUTOVACUUM(p->pBt) || szNew<pPage->minLocal)
+ ){
+ /* Overwrite the old cell with the new if they are the same size.
+ ** We could also try to do this if the old cell is smaller, then add
+ ** the leftover space to the free list. But experiments show that
+ ** doing that is no faster then skipping this optimization and just
+ ** calling dropCell() and insertCell().
+ **
+ ** This optimization cannot be used on an autovacuum database if the
+ ** new entry uses overflow pages, as the insertCell() call below is
+ ** necessary to add the PTRMAP_OVERFLOW1 pointer-map entry. */
+ assert( rc==SQLITE_OK ); /* clearCell never fails when nLocal==nPayload */
+ if( oldCell < pPage->aData+pPage->hdrOffset+10 ){
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ if( oldCell+szNew > pPage->aDataEnd ){
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ memcpy(oldCell, newCell, szNew);
+ return SQLITE_OK;
+ }
+ dropCell(pPage, idx, info.nSize, &rc);
+ if( rc ) goto end_insert;
+ }else if( loc<0 && pPage->nCell>0 ){
+ assert( pPage->leaf );
+ idx = ++pCur->ix;
+ pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl);
+ }else{
+ assert( pPage->leaf );
+ }
+ rc = insertCellFast(pPage, idx, newCell, szNew);
+ assert( pPage->nOverflow==0 || rc==SQLITE_OK );
+ assert( rc!=SQLITE_OK || pPage->nCell>0 || pPage->nOverflow>0 );
+
+ /* If no error has occurred and pPage has an overflow cell, call balance()
+ ** to redistribute the cells within the tree. Since balance() may move
+ ** the cursor, zero the BtCursor.info.nSize and BTCF_ValidNKey
+ ** variables.
+ **
+ ** Previous versions of SQLite called moveToRoot() to move the cursor
+ ** back to the root page as balance() used to invalidate the contents
+ ** of BtCursor.apPage[] and BtCursor.aiIdx[]. Instead of doing that,
+ ** set the cursor state to "invalid". This makes common insert operations
+ ** slightly faster.
+ **
+ ** There is a subtle but important optimization here too. When inserting
+ ** multiple records into an intkey b-tree using a single cursor (as can
+ ** happen while processing an "INSERT INTO ... SELECT" statement), it
+ ** is advantageous to leave the cursor pointing to the last entry in
+ ** the b-tree if possible. If the cursor is left pointing to the last
+ ** entry in the table, and the next row inserted has an integer key
+ ** larger than the largest existing key, it is possible to insert the
+ ** row without seeking the cursor. This can be a big performance boost.
+ */
+ if( pPage->nOverflow ){
+ assert( rc==SQLITE_OK );
+ pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl);
+ rc = balance(pCur);
+
+ /* Must make sure nOverflow is reset to zero even if the balance()
+ ** fails. Internal data structure corruption will result otherwise.
+ ** Also, set the cursor state to invalid. This stops saveCursorPosition()
+ ** from trying to save the current position of the cursor. */
+ pCur->pPage->nOverflow = 0;
+ pCur->eState = CURSOR_INVALID;
+ if( (flags & BTREE_SAVEPOSITION) && rc==SQLITE_OK ){
+ btreeReleaseAllCursorPages(pCur);
+ if( pCur->pKeyInfo ){
+ assert( pCur->pKey==0 );
+ pCur->pKey = sqlite3Malloc( pX->nKey );
+ if( pCur->pKey==0 ){
+ rc = SQLITE_NOMEM;
+ }else{
+ memcpy(pCur->pKey, pX->pKey, pX->nKey);
+ }
+ }
+ pCur->eState = CURSOR_REQUIRESEEK;
+ pCur->nKey = pX->nKey;
+ }
+ }
+ assert( pCur->iPage<0 || pCur->pPage->nOverflow==0 );
+
+end_insert:
+ return rc;
+}
+
+/*
+** This function is used as part of copying the current row from cursor
+** pSrc into cursor pDest. If the cursors are open on intkey tables, then
+** parameter iKey is used as the rowid value when the record is copied
+** into pDest. Otherwise, the record is copied verbatim.
+**
+** This function does not actually write the new value to cursor pDest.
+** Instead, it creates and populates any required overflow pages and
+** writes the data for the new cell into the BtShared.pTmpSpace buffer
+** for the destination database. The size of the cell, in bytes, is left
+** in BtShared.nPreformatSize. The caller completes the insertion by
+** calling sqlite3BtreeInsert() with the BTREE_PREFORMAT flag specified.
+**
+** SQLITE_OK is returned if successful, or an SQLite error code otherwise.
+*/
+SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc, i64 iKey){
+ BtShared *pBt = pDest->pBt;
+ u8 *aOut = pBt->pTmpSpace; /* Pointer to next output buffer */
+ const u8 *aIn; /* Pointer to next input buffer */
+ u32 nIn; /* Size of input buffer aIn[] */
+ u32 nRem; /* Bytes of data still to copy */
+
+ getCellInfo(pSrc);
+ if( pSrc->info.nPayload<0x80 ){
+ *(aOut++) = pSrc->info.nPayload;
+ }else{
+ aOut += sqlite3PutVarint(aOut, pSrc->info.nPayload);
+ }
+ if( pDest->pKeyInfo==0 ) aOut += putVarint(aOut, iKey);
+ nIn = pSrc->info.nLocal;
+ aIn = pSrc->info.pPayload;
+ if( aIn+nIn>pSrc->pPage->aDataEnd ){
+ return SQLITE_CORRUPT_PAGE(pSrc->pPage);
+ }
+ nRem = pSrc->info.nPayload;
+ if( nIn==nRem && nIn<pDest->pPage->maxLocal ){
+ memcpy(aOut, aIn, nIn);
+ pBt->nPreformatSize = nIn + (aOut - pBt->pTmpSpace);
+ return SQLITE_OK;
+ }else{
+ int rc = SQLITE_OK;
+ Pager *pSrcPager = pSrc->pBt->pPager;
+ u8 *pPgnoOut = 0;
+ Pgno ovflIn = 0;
+ DbPage *pPageIn = 0;
+ MemPage *pPageOut = 0;
+ u32 nOut; /* Size of output buffer aOut[] */
+
+ nOut = btreePayloadToLocal(pDest->pPage, pSrc->info.nPayload);
+ pBt->nPreformatSize = nOut + (aOut - pBt->pTmpSpace);
+ if( nOut<pSrc->info.nPayload ){
+ pPgnoOut = &aOut[nOut];
+ pBt->nPreformatSize += 4;
+ }
+
+ if( nRem>nIn ){
+ if( aIn+nIn+4>pSrc->pPage->aDataEnd ){
+ return SQLITE_CORRUPT_PAGE(pSrc->pPage);
+ }
+ ovflIn = get4byte(&pSrc->info.pPayload[nIn]);
+ }
+
+ do {
+ nRem -= nOut;
+ do{
+ assert( nOut>0 );
+ if( nIn>0 ){
+ int nCopy = MIN(nOut, nIn);
+ memcpy(aOut, aIn, nCopy);
+ nOut -= nCopy;
+ nIn -= nCopy;
+ aOut += nCopy;
+ aIn += nCopy;
+ }
+ if( nOut>0 ){
+ sqlite3PagerUnref(pPageIn);
+ pPageIn = 0;
+ rc = sqlite3PagerGet(pSrcPager, ovflIn, &pPageIn, PAGER_GET_READONLY);
+ if( rc==SQLITE_OK ){
+ aIn = (const u8*)sqlite3PagerGetData(pPageIn);
+ ovflIn = get4byte(aIn);
+ aIn += 4;
+ nIn = pSrc->pBt->usableSize - 4;
+ }
+ }
+ }while( rc==SQLITE_OK && nOut>0 );
+
+ if( rc==SQLITE_OK && nRem>0 && ALWAYS(pPgnoOut) ){
+ Pgno pgnoNew;
+ MemPage *pNew = 0;
+ rc = allocateBtreePage(pBt, &pNew, &pgnoNew, 0, 0);
+ put4byte(pPgnoOut, pgnoNew);
+ if( ISAUTOVACUUM(pBt) && pPageOut ){
+ ptrmapPut(pBt, pgnoNew, PTRMAP_OVERFLOW2, pPageOut->pgno, &rc);
+ }
+ releasePage(pPageOut);
+ pPageOut = pNew;
+ if( pPageOut ){
+ pPgnoOut = pPageOut->aData;
+ put4byte(pPgnoOut, 0);
+ aOut = &pPgnoOut[4];
+ nOut = MIN(pBt->usableSize - 4, nRem);
+ }
+ }
+ }while( nRem>0 && rc==SQLITE_OK );
+
+ releasePage(pPageOut);
+ sqlite3PagerUnref(pPageIn);
+ return rc;
+ }
+}
+
+/*
+** Delete the entry that the cursor is pointing to.
+**
+** If the BTREE_SAVEPOSITION bit of the flags parameter is zero, then
+** the cursor is left pointing at an arbitrary location after the delete.
+** But if that bit is set, then the cursor is left in a state such that
+** the next call to BtreeNext() or BtreePrev() moves it to the same row
+** as it would have been on if the call to BtreeDelete() had been omitted.
+**
+** The BTREE_AUXDELETE bit of flags indicates that is one of several deletes
+** associated with a single table entry and its indexes. Only one of those
+** deletes is considered the "primary" delete. The primary delete occurs
+** on a cursor that is not a BTREE_FORDELETE cursor. All but one delete
+** operation on non-FORDELETE cursors is tagged with the AUXDELETE flag.
+** The BTREE_AUXDELETE bit is a hint that is not used by this implementation,
+** but which might be used by alternative storage engines.
+*/
+SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){
+ Btree *p = pCur->pBtree;
+ BtShared *pBt = p->pBt;
+ int rc; /* Return code */
+ MemPage *pPage; /* Page to delete cell from */
+ unsigned char *pCell; /* Pointer to cell to delete */
+ int iCellIdx; /* Index of cell to delete */
+ int iCellDepth; /* Depth of node containing pCell */
+ CellInfo info; /* Size of the cell being deleted */
+ u8 bPreserve; /* Keep cursor valid. 2 for CURSOR_SKIPNEXT */
+
+ assert( cursorOwnsBtShared(pCur) );
+ assert( pBt->inTransaction==TRANS_WRITE );
+ assert( (pBt->btsFlags & BTS_READ_ONLY)==0 );
+ assert( pCur->curFlags & BTCF_WriteFlag );
+ assert( hasSharedCacheTableLock(p, pCur->pgnoRoot, pCur->pKeyInfo!=0, 2) );
+ assert( !hasReadConflicts(p, pCur->pgnoRoot) );
+ assert( (flags & ~(BTREE_SAVEPOSITION | BTREE_AUXDELETE))==0 );
+ if( pCur->eState!=CURSOR_VALID ){
+ if( pCur->eState>=CURSOR_REQUIRESEEK ){
+ rc = btreeRestoreCursorPosition(pCur);
+ assert( rc!=SQLITE_OK || CORRUPT_DB || pCur->eState==CURSOR_VALID );
+ if( rc || pCur->eState!=CURSOR_VALID ) return rc;
+ }else{
+ return SQLITE_CORRUPT_PGNO(pCur->pgnoRoot);
+ }
+ }
+ assert( pCur->eState==CURSOR_VALID );
+
+ iCellDepth = pCur->iPage;
+ iCellIdx = pCur->ix;
+ pPage = pCur->pPage;
+ if( pPage->nCell<=iCellIdx ){
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ pCell = findCell(pPage, iCellIdx);
+ if( pPage->nFree<0 && btreeComputeFreeSpace(pPage) ){
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+ if( pCell<&pPage->aCellIdx[pPage->nCell] ){
+ return SQLITE_CORRUPT_PAGE(pPage);
+ }
+
+ /* If the BTREE_SAVEPOSITION bit is on, then the cursor position must
+ ** be preserved following this delete operation. If the current delete
+ ** will cause a b-tree rebalance, then this is done by saving the cursor
+ ** key and leaving the cursor in CURSOR_REQUIRESEEK state before
+ ** returning.
+ **
+ ** If the current delete will not cause a rebalance, then the cursor
+ ** will be left in CURSOR_SKIPNEXT state pointing to the entry immediately
+ ** before or after the deleted entry.
+ **
+ ** The bPreserve value records which path is required:
+ **
+ ** bPreserve==0 Not necessary to save the cursor position
+ ** bPreserve==1 Use CURSOR_REQUIRESEEK to save the cursor position
+ ** bPreserve==2 Cursor won't move. Set CURSOR_SKIPNEXT.
+ */
+ bPreserve = (flags & BTREE_SAVEPOSITION)!=0;
+ if( bPreserve ){
+ if( !pPage->leaf
+ || (pPage->nFree+pPage->xCellSize(pPage,pCell)+2) >
+ (int)(pBt->usableSize*2/3)
+ || pPage->nCell==1 /* See dbfuzz001.test for a test case */
+ ){
+ /* A b-tree rebalance will be required after deleting this entry.
+ ** Save the cursor key. */
+ rc = saveCursorKey(pCur);
+ if( rc ) return rc;
+ }else{
+ bPreserve = 2;
+ }
+ }
+
+ /* If the page containing the entry to delete is not a leaf page, move
+ ** the cursor to the largest entry in the tree that is smaller than
+ ** the entry being deleted. This cell will replace the cell being deleted
+ ** from the internal node. The 'previous' entry is used for this instead
+ ** of the 'next' entry, as the previous entry is always a part of the
+ ** sub-tree headed by the child page of the cell being deleted. This makes
+ ** balancing the tree following the delete operation easier. */
+ if( !pPage->leaf ){
+ rc = sqlite3BtreePrevious(pCur, 0);
+ assert( rc!=SQLITE_DONE );
+ if( rc ) return rc;
+ }
+
+ /* Save the positions of any other cursors open on this table before
+ ** making any modifications. */
+ if( pCur->curFlags & BTCF_Multiple ){
+ rc = saveAllCursors(pBt, pCur->pgnoRoot, pCur);
+ if( rc ) return rc;
+ }
+
+ /* If this is a delete operation to remove a row from a table b-tree,
+ ** invalidate any incrblob cursors open on the row being deleted. */
+ if( pCur->pKeyInfo==0 && p->hasIncrblobCur ){
+ invalidateIncrblobCursors(p, pCur->pgnoRoot, pCur->info.nKey, 0);
+ }
+
+ /* Make the page containing the entry to be deleted writable. Then free any
+ ** overflow pages associated with the entry and finally remove the cell
+ ** itself from within the page. */
+ rc = sqlite3PagerWrite(pPage->pDbPage);
+ if( rc ) return rc;
+ BTREE_CLEAR_CELL(rc, pPage, pCell, info);
+ dropCell(pPage, iCellIdx, info.nSize, &rc);
+ if( rc ) return rc;
+
+ /* If the cell deleted was not located on a leaf page, then the cursor
+ ** is currently pointing to the largest entry in the sub-tree headed
+ ** by the child-page of the cell that was just deleted from an internal
+ ** node. The cell from the leaf node needs to be moved to the internal
+ ** node to replace the deleted cell. */
+ if( !pPage->leaf ){
+ MemPage *pLeaf = pCur->pPage;
+ int nCell;
+ Pgno n;
+ unsigned char *pTmp;
+
+ if( pLeaf->nFree<0 ){
+ rc = btreeComputeFreeSpace(pLeaf);
+ if( rc ) return rc;
+ }
+ if( iCellDepth<pCur->iPage-1 ){
+ n = pCur->apPage[iCellDepth+1]->pgno;
+ }else{
+ n = pCur->pPage->pgno;
+ }
+ pCell = findCell(pLeaf, pLeaf->nCell-1);
+ if( pCell<&pLeaf->aData[4] ) return SQLITE_CORRUPT_PAGE(pLeaf);
+ nCell = pLeaf->xCellSize(pLeaf, pCell);
+ assert( MX_CELL_SIZE(pBt) >= nCell );
+ pTmp = pBt->pTmpSpace;
+ assert( pTmp!=0 );
+ rc = sqlite3PagerWrite(pLeaf->pDbPage);
+ if( rc==SQLITE_OK ){
+ rc = insertCell(pPage, iCellIdx, pCell-4, nCell+4, pTmp, n);
+ }
+ dropCell(pLeaf, pLeaf->nCell-1, nCell, &rc);
+ if( rc ) return rc;
+ }
+
+ /* Balance the tree. If the entry deleted was located on a leaf page,
+ ** then the cursor still points to that page. In this case the first
+ ** call to balance() repairs the tree, and the if(...) condition is
+ ** never true.
+ **
+ ** Otherwise, if the entry deleted was on an internal node page, then
+ ** pCur is pointing to the leaf page from which a cell was removed to
+ ** replace the cell deleted from the internal node. This is slightly
+ ** tricky as the leaf node may be underfull, and the internal node may
+ ** be either under or overfull. In this case run the balancing algorithm
+ ** on the leaf node first. If the balance proceeds far enough up the
+ ** tree that we can be sure that any problem in the internal node has
+ ** been corrected, so be it. Otherwise, after balancing the leaf node,
+ ** walk the cursor up the tree to the internal node and balance it as
+ ** well. */
+ assert( pCur->pPage->nOverflow==0 );
+ assert( pCur->pPage->nFree>=0 );
+ if( pCur->pPage->nFree*3<=(int)pCur->pBt->usableSize*2 ){
+ /* Optimization: If the free space is less than 2/3rds of the page,
+ ** then balance() will always be a no-op. No need to invoke it. */
+ rc = SQLITE_OK;
+ }else{
+ rc = balance(pCur);
+ }
+ if( rc==SQLITE_OK && pCur->iPage>iCellDepth ){
+ releasePageNotNull(pCur->pPage);
+ pCur->iPage--;
+ while( pCur->iPage>iCellDepth ){
+ releasePage(pCur->apPage[pCur->iPage--]);
+ }
+ pCur->pPage = pCur->apPage[pCur->iPage];
+ rc = balance(pCur);
+ }
+
+ if( rc==SQLITE_OK ){
+ if( bPreserve>1 ){
+ assert( (pCur->iPage==iCellDepth || CORRUPT_DB) );
+ assert( pPage==pCur->pPage || CORRUPT_DB );
+ assert( (pPage->nCell>0 || CORRUPT_DB) && iCellIdx<=pPage->nCell );
+ pCur->eState = CURSOR_SKIPNEXT;
+ if( iCellIdx>=pPage->nCell ){
+ pCur->skipNext = -1;
+ pCur->ix = pPage->nCell-1;
+ }else{
+ pCur->skipNext = 1;
+ }
+ }else{
+ rc = moveToRoot(pCur);
+ if( bPreserve ){
+ btreeReleaseAllCursorPages(pCur);
+ pCur->eState = CURSOR_REQUIRESEEK;
+ }
+ if( rc==SQLITE_EMPTY ) rc = SQLITE_OK;
+ }
+ }
+ return rc;
+}
+
+/*
+** Create a new BTree table. Write into *piTable the page
+** number for the root page of the new table.
+**
+** The type of type is determined by the flags parameter. Only the
+** following values of flags are currently in use. Other values for
+** flags might not work:
+**
+** BTREE_INTKEY|BTREE_LEAFDATA Used for SQL tables with rowid keys
+** BTREE_ZERODATA Used for SQL indices
+*/
+static int btreeCreateTable(Btree *p, Pgno *piTable, int createTabFlags){
+ BtShared *pBt = p->pBt;
+ MemPage *pRoot;
+ Pgno pgnoRoot;
+ int rc;
+ int ptfFlags; /* Page-type flags for the root page of new table */
+
+ assert( sqlite3BtreeHoldsMutex(p) );
+ assert( pBt->inTransaction==TRANS_WRITE );
+ assert( (pBt->btsFlags & BTS_READ_ONLY)==0 );
+
+#ifdef SQLITE_OMIT_AUTOVACUUM
+ rc = allocateBtreePage(pBt, &pRoot, &pgnoRoot, 1, 0);
+ if( rc ){
+ return rc;
+ }
+#else
+ if( pBt->autoVacuum ){
+ Pgno pgnoMove; /* Move a page here to make room for the root-page */
+ MemPage *pPageMove; /* The page to move to. */
+
+ /* Creating a new table may probably require moving an existing database
+ ** to make room for the new tables root page. In case this page turns
+ ** out to be an overflow page, delete all overflow page-map caches
+ ** held by open cursors.
+ */
+ invalidateAllOverflowCache(pBt);
+
+ /* Read the value of meta[3] from the database to determine where the
+ ** root page of the new table should go. meta[3] is the largest root-page
+ ** created so far, so the new root-page is (meta[3]+1).
+ */
+ sqlite3BtreeGetMeta(p, BTREE_LARGEST_ROOT_PAGE, &pgnoRoot);
+ if( pgnoRoot>btreePagecount(pBt) ){
+ return SQLITE_CORRUPT_PGNO(pgnoRoot);
+ }
+ pgnoRoot++;
+
+ /* The new root-page may not be allocated on a pointer-map page, or the
+ ** PENDING_BYTE page.
+ */
+ while( pgnoRoot==PTRMAP_PAGENO(pBt, pgnoRoot) ||
+ pgnoRoot==PENDING_BYTE_PAGE(pBt) ){
+ pgnoRoot++;
+ }
+ assert( pgnoRoot>=3 );
+
+ /* Allocate a page. The page that currently resides at pgnoRoot will
+ ** be moved to the allocated page (unless the allocated page happens
+ ** to reside at pgnoRoot).
+ */
+ rc = allocateBtreePage(pBt, &pPageMove, &pgnoMove, pgnoRoot, BTALLOC_EXACT);
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+
+ if( pgnoMove!=pgnoRoot ){
+ /* pgnoRoot is the page that will be used for the root-page of
+ ** the new table (assuming an error did not occur). But we were
+ ** allocated pgnoMove. If required (i.e. if it was not allocated
+ ** by extending the file), the current page at position pgnoMove
+ ** is already journaled.
+ */
+ u8 eType = 0;
+ Pgno iPtrPage = 0;
+
+ /* Save the positions of any open cursors. This is required in
+ ** case they are holding a reference to an xFetch reference
+ ** corresponding to page pgnoRoot. */
+ rc = saveAllCursors(pBt, 0, 0);
+ releasePage(pPageMove);
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+
+ /* Move the page currently at pgnoRoot to pgnoMove. */
+ rc = btreeGetPage(pBt, pgnoRoot, &pRoot, 0);
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+ rc = ptrmapGet(pBt, pgnoRoot, &eType, &iPtrPage);
+ if( eType==PTRMAP_ROOTPAGE || eType==PTRMAP_FREEPAGE ){
+ rc = SQLITE_CORRUPT_PGNO(pgnoRoot);
+ }
+ if( rc!=SQLITE_OK ){
+ releasePage(pRoot);
+ return rc;
+ }
+ assert( eType!=PTRMAP_ROOTPAGE );
+ assert( eType!=PTRMAP_FREEPAGE );
+ rc = relocatePage(pBt, pRoot, eType, iPtrPage, pgnoMove, 0);
+ releasePage(pRoot);
+
+ /* Obtain the page at pgnoRoot */
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+ rc = btreeGetPage(pBt, pgnoRoot, &pRoot, 0);
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+ rc = sqlite3PagerWrite(pRoot->pDbPage);
+ if( rc!=SQLITE_OK ){
+ releasePage(pRoot);
+ return rc;
+ }
+ }else{
+ pRoot = pPageMove;
+ }
+
+ /* Update the pointer-map and meta-data with the new root-page number. */
+ ptrmapPut(pBt, pgnoRoot, PTRMAP_ROOTPAGE, 0, &rc);
+ if( rc ){
+ releasePage(pRoot);
+ return rc;
+ }
+
+ /* When the new root page was allocated, page 1 was made writable in
+ ** order either to increase the database filesize, or to decrement the
+ ** freelist count. Hence, the sqlite3BtreeUpdateMeta() call cannot fail.
+ */
+ assert( sqlite3PagerIswriteable(pBt->pPage1->pDbPage) );
+ rc = sqlite3BtreeUpdateMeta(p, 4, pgnoRoot);
+ if( NEVER(rc) ){
+ releasePage(pRoot);
+ return rc;
+ }
+
+ }else{
+ rc = allocateBtreePage(pBt, &pRoot, &pgnoRoot, 1, 0);
+ if( rc ) return rc;
+ }
+#endif
+ assert( sqlite3PagerIswriteable(pRoot->pDbPage) );
+ if( createTabFlags & BTREE_INTKEY ){
+ ptfFlags = PTF_INTKEY | PTF_LEAFDATA | PTF_LEAF;
+ }else{
+ ptfFlags = PTF_ZERODATA | PTF_LEAF;
+ }
+ zeroPage(pRoot, ptfFlags);
+ sqlite3PagerUnref(pRoot->pDbPage);
+ assert( (pBt->openFlags & BTREE_SINGLE)==0 || pgnoRoot==2 );
+ *piTable = pgnoRoot;
+ return SQLITE_OK;
+}
+SQLITE_PRIVATE int sqlite3BtreeCreateTable(Btree *p, Pgno *piTable, int flags){
+ int rc;
+ sqlite3BtreeEnter(p);
+ rc = btreeCreateTable(p, piTable, flags);
+ sqlite3BtreeLeave(p);
+ return rc;
+}
+
+/*
+** Erase the given database page and all its children. Return
+** the page to the freelist.
+*/
+static int clearDatabasePage(
+ BtShared *pBt, /* The BTree that contains the table */
+ Pgno pgno, /* Page number to clear */
+ int freePageFlag, /* Deallocate page if true */
+ i64 *pnChange /* Add number of Cells freed to this counter */
+){
+ MemPage *pPage;
+ int rc;
+ unsigned char *pCell;
+ int i;
+ int hdr;
+ CellInfo info;
+
+ assert( sqlite3_mutex_held(pBt->mutex) );
+ if( pgno>btreePagecount(pBt) ){
+ return SQLITE_CORRUPT_PGNO(pgno);
+ }
+ rc = getAndInitPage(pBt, pgno, &pPage, 0);
+ if( rc ) return rc;
+ if( (pBt->openFlags & BTREE_SINGLE)==0
+ && sqlite3PagerPageRefcount(pPage->pDbPage) != (1 + (pgno==1))
+ ){
+ rc = SQLITE_CORRUPT_PAGE(pPage);
+ goto cleardatabasepage_out;
+ }
+ hdr = pPage->hdrOffset;
+ for(i=0; i<pPage->nCell; i++){
+ pCell = findCell(pPage, i);
+ if( !pPage->leaf ){
+ rc = clearDatabasePage(pBt, get4byte(pCell), 1, pnChange);
+ if( rc ) goto cleardatabasepage_out;
+ }
+ BTREE_CLEAR_CELL(rc, pPage, pCell, info);
+ if( rc ) goto cleardatabasepage_out;
+ }
+ if( !pPage->leaf ){
+ rc = clearDatabasePage(pBt, get4byte(&pPage->aData[hdr+8]), 1, pnChange);
+ if( rc ) goto cleardatabasepage_out;
+ if( pPage->intKey ) pnChange = 0;
+ }
+ if( pnChange ){
+ testcase( !pPage->intKey );
+ *pnChange += pPage->nCell;
+ }
+ if( freePageFlag ){
+ freePage(pPage, &rc);
+ }else if( (rc = sqlite3PagerWrite(pPage->pDbPage))==0 ){
+ zeroPage(pPage, pPage->aData[hdr] | PTF_LEAF);
+ }
+
+cleardatabasepage_out:
+ releasePage(pPage);
+ return rc;
+}
+
+/*
+** Delete all information from a single table in the database. iTable is
+** the page number of the root of the table. After this routine returns,
+** the root page is empty, but still exists.
+**
+** This routine will fail with SQLITE_LOCKED if there are any open
+** read cursors on the table. Open write cursors are moved to the
+** root of the table.
+**
+** If pnChange is not NULL, then the integer value pointed to by pnChange
+** is incremented by the number of entries in the table.
+*/
+SQLITE_PRIVATE int sqlite3BtreeClearTable(Btree *p, int iTable, i64 *pnChange){
+ int rc;
+ BtShared *pBt = p->pBt;
+ sqlite3BtreeEnter(p);
+ assert( p->inTrans==TRANS_WRITE );
+
+ rc = saveAllCursors(pBt, (Pgno)iTable, 0);
+
+ if( SQLITE_OK==rc ){
+ /* Invalidate all incrblob cursors open on table iTable (assuming iTable
+ ** is the root of a table b-tree - if it is not, the following call is
+ ** a no-op). */
+ if( p->hasIncrblobCur ){
+ invalidateIncrblobCursors(p, (Pgno)iTable, 0, 1);
+ }
+ rc = clearDatabasePage(pBt, (Pgno)iTable, 0, pnChange);
+ }
+ sqlite3BtreeLeave(p);
+ return rc;
+}
+
+/*
+** Delete all information from the single table that pCur is open on.
+**
+** This routine only work for pCur on an ephemeral table.
+*/
+SQLITE_PRIVATE int sqlite3BtreeClearTableOfCursor(BtCursor *pCur){
+ return sqlite3BtreeClearTable(pCur->pBtree, pCur->pgnoRoot, 0);
+}
+
+/*
+** Erase all information in a table and add the root of the table to
+** the freelist. Except, the root of the principle table (the one on
+** page 1) is never added to the freelist.
+**
+** This routine will fail with SQLITE_LOCKED if there are any open
+** cursors on the table.
+**
+** If AUTOVACUUM is enabled and the page at iTable is not the last
+** root page in the database file, then the last root page
+** in the database file is moved into the slot formerly occupied by
+** iTable and that last slot formerly occupied by the last root page
+** is added to the freelist instead of iTable. In this say, all
+** root pages are kept at the beginning of the database file, which
+** is necessary for AUTOVACUUM to work right. *piMoved is set to the
+** page number that used to be the last root page in the file before
+** the move. If no page gets moved, *piMoved is set to 0.
+** The last root page is recorded in meta[3] and the value of
+** meta[3] is updated by this procedure.
+*/
+static int btreeDropTable(Btree *p, Pgno iTable, int *piMoved){
+ int rc;
+ MemPage *pPage = 0;
+ BtShared *pBt = p->pBt;
+
+ assert( sqlite3BtreeHoldsMutex(p) );
+ assert( p->inTrans==TRANS_WRITE );
+ assert( iTable>=2 );
+ if( iTable>btreePagecount(pBt) ){
+ return SQLITE_CORRUPT_PGNO(iTable);
+ }
+
+ rc = sqlite3BtreeClearTable(p, iTable, 0);
+ if( rc ) return rc;
+ rc = btreeGetPage(pBt, (Pgno)iTable, &pPage, 0);
+ if( NEVER(rc) ){
+ releasePage(pPage);
+ return rc;
+ }
+
+ *piMoved = 0;
+
+#ifdef SQLITE_OMIT_AUTOVACUUM
+ freePage(pPage, &rc);
+ releasePage(pPage);
+#else
+ if( pBt->autoVacuum ){
+ Pgno maxRootPgno;
+ sqlite3BtreeGetMeta(p, BTREE_LARGEST_ROOT_PAGE, &maxRootPgno);
+
+ if( iTable==maxRootPgno ){
+ /* If the table being dropped is the table with the largest root-page
+ ** number in the database, put the root page on the free list.
+ */
+ freePage(pPage, &rc);
+ releasePage(pPage);
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+ }else{
+ /* The table being dropped does not have the largest root-page
+ ** number in the database. So move the page that does into the
+ ** gap left by the deleted root-page.
+ */
+ MemPage *pMove;
+ releasePage(pPage);
+ rc = btreeGetPage(pBt, maxRootPgno, &pMove, 0);
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+ rc = relocatePage(pBt, pMove, PTRMAP_ROOTPAGE, 0, iTable, 0);
+ releasePage(pMove);
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+ pMove = 0;
+ rc = btreeGetPage(pBt, maxRootPgno, &pMove, 0);
+ freePage(pMove, &rc);
+ releasePage(pMove);
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+ *piMoved = maxRootPgno;
+ }
+
+ /* Set the new 'max-root-page' value in the database header. This
+ ** is the old value less one, less one more if that happens to
+ ** be a root-page number, less one again if that is the
+ ** PENDING_BYTE_PAGE.
+ */
+ maxRootPgno--;
+ while( maxRootPgno==PENDING_BYTE_PAGE(pBt)
+ || PTRMAP_ISPAGE(pBt, maxRootPgno) ){
+ maxRootPgno--;
+ }
+ assert( maxRootPgno!=PENDING_BYTE_PAGE(pBt) );
+
+ rc = sqlite3BtreeUpdateMeta(p, 4, maxRootPgno);
+ }else{
+ freePage(pPage, &rc);
+ releasePage(pPage);
+ }
+#endif
+ return rc;
+}
+SQLITE_PRIVATE int sqlite3BtreeDropTable(Btree *p, int iTable, int *piMoved){
+ int rc;
+ sqlite3BtreeEnter(p);
+ rc = btreeDropTable(p, iTable, piMoved);
+ sqlite3BtreeLeave(p);
+ return rc;
+}
+
+
+/*
+** This function may only be called if the b-tree connection already
+** has a read or write transaction open on the database.
+**
+** Read the meta-information out of a database file. Meta[0]
+** is the number of free pages currently in the database. Meta[1]
+** through meta[15] are available for use by higher layers. Meta[0]
+** is read-only, the others are read/write.
+**
+** The schema layer numbers meta values differently. At the schema
+** layer (and the SetCookie and ReadCookie opcodes) the number of
+** free pages is not visible. So Cookie[0] is the same as Meta[1].
+**
+** This routine treats Meta[BTREE_DATA_VERSION] as a special case. Instead
+** of reading the value out of the header, it instead loads the "DataVersion"
+** from the pager. The BTREE_DATA_VERSION value is not actually stored in the
+** database file. It is a number computed by the pager. But its access
+** pattern is the same as header meta values, and so it is convenient to
+** read it from this routine.
+*/
+SQLITE_PRIVATE void sqlite3BtreeGetMeta(Btree *p, int idx, u32 *pMeta){
+ BtShared *pBt = p->pBt;
+
+ sqlite3BtreeEnter(p);
+ assert( p->inTrans>TRANS_NONE );
+ assert( SQLITE_OK==querySharedCacheTableLock(p, SCHEMA_ROOT, READ_LOCK) );
+ assert( pBt->pPage1 );
+ assert( idx>=0 && idx<=15 );
+
+ if( idx==BTREE_DATA_VERSION ){
+ *pMeta = sqlite3PagerDataVersion(pBt->pPager) + p->iBDataVersion;
+ }else{
+ *pMeta = get4byte(&pBt->pPage1->aData[36 + idx*4]);
+ }
+
+ /* If auto-vacuum is disabled in this build and this is an auto-vacuum
+ ** database, mark the database as read-only. */
+#ifdef SQLITE_OMIT_AUTOVACUUM
+ if( idx==BTREE_LARGEST_ROOT_PAGE && *pMeta>0 ){
+ pBt->btsFlags |= BTS_READ_ONLY;
+ }
+#endif
+
+ sqlite3BtreeLeave(p);
+}
+
+/*
+** Write meta-information back into the database. Meta[0] is
+** read-only and may not be written.
+*/
+SQLITE_PRIVATE int sqlite3BtreeUpdateMeta(Btree *p, int idx, u32 iMeta){
+ BtShared *pBt = p->pBt;
+ unsigned char *pP1;
+ int rc;
+ assert( idx>=1 && idx<=15 );
+ sqlite3BtreeEnter(p);
+ assert( p->inTrans==TRANS_WRITE );
+ assert( pBt->pPage1!=0 );
+ pP1 = pBt->pPage1->aData;
+ rc = sqlite3PagerWrite(pBt->pPage1->pDbPage);
+ if( rc==SQLITE_OK ){
+ put4byte(&pP1[36 + idx*4], iMeta);
+#ifndef SQLITE_OMIT_AUTOVACUUM
+ if( idx==BTREE_INCR_VACUUM ){
+ assert( pBt->autoVacuum || iMeta==0 );
+ assert( iMeta==0 || iMeta==1 );
+ pBt->incrVacuum = (u8)iMeta;
+ }
+#endif
+ }
+ sqlite3BtreeLeave(p);
+ return rc;
+}
+
+/*
+** The first argument, pCur, is a cursor opened on some b-tree. Count the
+** number of entries in the b-tree and write the result to *pnEntry.
+**
+** SQLITE_OK is returned if the operation is successfully executed.
+** Otherwise, if an error is encountered (i.e. an IO error or database
+** corruption) an SQLite error code is returned.
+*/
+SQLITE_PRIVATE int sqlite3BtreeCount(sqlite3 *db, BtCursor *pCur, i64 *pnEntry){
+ i64 nEntry = 0; /* Value to return in *pnEntry */
+ int rc; /* Return code */
+
+ rc = moveToRoot(pCur);
+ if( rc==SQLITE_EMPTY ){
+ *pnEntry = 0;
+ return SQLITE_OK;
+ }
+
+ /* Unless an error occurs, the following loop runs one iteration for each
+ ** page in the B-Tree structure (not including overflow pages).
+ */
+ while( rc==SQLITE_OK && !AtomicLoad(&db->u1.isInterrupted) ){
+ int iIdx; /* Index of child node in parent */
+ MemPage *pPage; /* Current page of the b-tree */
+
+ /* If this is a leaf page or the tree is not an int-key tree, then
+ ** this page contains countable entries. Increment the entry counter
+ ** accordingly.
+ */
+ pPage = pCur->pPage;
+ if( pPage->leaf || !pPage->intKey ){
+ nEntry += pPage->nCell;
+ }
+
+ /* pPage is a leaf node. This loop navigates the cursor so that it
+ ** points to the first interior cell that it points to the parent of
+ ** the next page in the tree that has not yet been visited. The
+ ** pCur->aiIdx[pCur->iPage] value is set to the index of the parent cell
+ ** of the page, or to the number of cells in the page if the next page
+ ** to visit is the right-child of its parent.
+ **
+ ** If all pages in the tree have been visited, return SQLITE_OK to the
+ ** caller.
+ */
+ if( pPage->leaf ){
+ do {
+ if( pCur->iPage==0 ){
+ /* All pages of the b-tree have been visited. Return successfully. */
+ *pnEntry = nEntry;
+ return moveToRoot(pCur);
+ }
+ moveToParent(pCur);
+ }while ( pCur->ix>=pCur->pPage->nCell );
+
+ pCur->ix++;
+ pPage = pCur->pPage;
+ }
+
+ /* Descend to the child node of the cell that the cursor currently
+ ** points at. This is the right-child if (iIdx==pPage->nCell).
+ */
+ iIdx = pCur->ix;
+ if( iIdx==pPage->nCell ){
+ rc = moveToChild(pCur, get4byte(&pPage->aData[pPage->hdrOffset+8]));
+ }else{
+ rc = moveToChild(pCur, get4byte(findCell(pPage, iIdx)));
+ }
+ }
+
+ /* An error has occurred. Return an error code. */
+ return rc;
+}
+
+/*
+** Return the pager associated with a BTree. This routine is used for
+** testing and debugging only.
+*/
+SQLITE_PRIVATE Pager *sqlite3BtreePager(Btree *p){
+ return p->pBt->pPager;
+}
+
+#ifndef SQLITE_OMIT_INTEGRITY_CHECK
+/*
+** Record an OOM error during integrity_check
+*/
+static void checkOom(IntegrityCk *pCheck){
+ pCheck->rc = SQLITE_NOMEM;
+ pCheck->mxErr = 0; /* Causes integrity_check processing to stop */
+ if( pCheck->nErr==0 ) pCheck->nErr++;
+}
+
+/*
+** Invoke the progress handler, if appropriate. Also check for an
+** interrupt.
+*/
+static void checkProgress(IntegrityCk *pCheck){
+ sqlite3 *db = pCheck->db;
+ if( AtomicLoad(&db->u1.isInterrupted) ){
+ pCheck->rc = SQLITE_INTERRUPT;
+ pCheck->nErr++;
+ pCheck->mxErr = 0;
+ }
+#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
+ if( db->xProgress ){
+ assert( db->nProgressOps>0 );
+ pCheck->nStep++;
+ if( (pCheck->nStep % db->nProgressOps)==0
+ && db->xProgress(db->pProgressArg)
+ ){
+ pCheck->rc = SQLITE_INTERRUPT;
+ pCheck->nErr++;
+ pCheck->mxErr = 0;
+ }
+ }
+#endif
+}
+
+/*
+** Append a message to the error message string.
+*/
+static void checkAppendMsg(
+ IntegrityCk *pCheck,
+ const char *zFormat,
+ ...
+){
+ va_list ap;
+ checkProgress(pCheck);
+ if( !pCheck->mxErr ) return;
+ pCheck->mxErr--;
+ pCheck->nErr++;
+ va_start(ap, zFormat);
+ if( pCheck->errMsg.nChar ){
+ sqlite3_str_append(&pCheck->errMsg, "\n", 1);
+ }
+ if( pCheck->zPfx ){
+ sqlite3_str_appendf(&pCheck->errMsg, pCheck->zPfx,
+ pCheck->v0, pCheck->v1, pCheck->v2);
+ }
+ sqlite3_str_vappendf(&pCheck->errMsg, zFormat, ap);
+ va_end(ap);
+ if( pCheck->errMsg.accError==SQLITE_NOMEM ){
+ checkOom(pCheck);
+ }
+}
+#endif /* SQLITE_OMIT_INTEGRITY_CHECK */
+
+#ifndef SQLITE_OMIT_INTEGRITY_CHECK
+
+/*
+** Return non-zero if the bit in the IntegrityCk.aPgRef[] array that
+** corresponds to page iPg is already set.
+*/
+static int getPageReferenced(IntegrityCk *pCheck, Pgno iPg){
+ assert( pCheck->aPgRef!=0 );
+ assert( iPg<=pCheck->nCkPage && sizeof(pCheck->aPgRef[0])==1 );
+ return (pCheck->aPgRef[iPg/8] & (1 << (iPg & 0x07)));
+}
+
+/*
+** Set the bit in the IntegrityCk.aPgRef[] array that corresponds to page iPg.
+*/
+static void setPageReferenced(IntegrityCk *pCheck, Pgno iPg){
+ assert( pCheck->aPgRef!=0 );
+ assert( iPg<=pCheck->nCkPage && sizeof(pCheck->aPgRef[0])==1 );
+ pCheck->aPgRef[iPg/8] |= (1 << (iPg & 0x07));
+}
+
+
+/*
+** Add 1 to the reference count for page iPage. If this is the second
+** reference to the page, add an error message to pCheck->zErrMsg.
+** Return 1 if there are 2 or more references to the page and 0 if
+** if this is the first reference to the page.
+**
+** Also check that the page number is in bounds.
+*/
+static int checkRef(IntegrityCk *pCheck, Pgno iPage){
+ if( iPage>pCheck->nCkPage || iPage==0 ){
+ checkAppendMsg(pCheck, "invalid page number %u", iPage);
+ return 1;
+ }
+ if( getPageReferenced(pCheck, iPage) ){
+ checkAppendMsg(pCheck, "2nd reference to page %u", iPage);
+ return 1;
+ }
+ setPageReferenced(pCheck, iPage);
+ return 0;
+}
+
+#ifndef SQLITE_OMIT_AUTOVACUUM
+/*
+** Check that the entry in the pointer-map for page iChild maps to
+** page iParent, pointer type ptrType. If not, append an error message
+** to pCheck.
+*/
+static void checkPtrmap(
+ IntegrityCk *pCheck, /* Integrity check context */
+ Pgno iChild, /* Child page number */
+ u8 eType, /* Expected pointer map type */
+ Pgno iParent /* Expected pointer map parent page number */
+){
+ int rc;
+ u8 ePtrmapType;
+ Pgno iPtrmapParent;
+
+ rc = ptrmapGet(pCheck->pBt, iChild, &ePtrmapType, &iPtrmapParent);
+ if( rc!=SQLITE_OK ){
+ if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ) checkOom(pCheck);
+ checkAppendMsg(pCheck, "Failed to read ptrmap key=%u", iChild);
+ return;
+ }
+
+ if( ePtrmapType!=eType || iPtrmapParent!=iParent ){
+ checkAppendMsg(pCheck,
+ "Bad ptr map entry key=%u expected=(%u,%u) got=(%u,%u)",
+ iChild, eType, iParent, ePtrmapType, iPtrmapParent);
+ }
+}
+#endif
+
+/*
+** Check the integrity of the freelist or of an overflow page list.
+** Verify that the number of pages on the list is N.
+*/
+static void checkList(
+ IntegrityCk *pCheck, /* Integrity checking context */
+ int isFreeList, /* True for a freelist. False for overflow page list */
+ Pgno iPage, /* Page number for first page in the list */
+ u32 N /* Expected number of pages in the list */
+){
+ int i;
+ u32 expected = N;
+ int nErrAtStart = pCheck->nErr;
+ while( iPage!=0 && pCheck->mxErr ){
+ DbPage *pOvflPage;
+ unsigned char *pOvflData;
+ if( checkRef(pCheck, iPage) ) break;
+ N--;
+ if( sqlite3PagerGet(pCheck->pPager, (Pgno)iPage, &pOvflPage, 0) ){
+ checkAppendMsg(pCheck, "failed to get page %u", iPage);
+ break;
+ }
+ pOvflData = (unsigned char *)sqlite3PagerGetData(pOvflPage);
+ if( isFreeList ){
+ u32 n = (u32)get4byte(&pOvflData[4]);
+#ifndef SQLITE_OMIT_AUTOVACUUM
+ if( pCheck->pBt->autoVacuum ){
+ checkPtrmap(pCheck, iPage, PTRMAP_FREEPAGE, 0);
+ }
+#endif
+ if( n>pCheck->pBt->usableSize/4-2 ){
+ checkAppendMsg(pCheck,
+ "freelist leaf count too big on page %u", iPage);
+ N--;
+ }else{
+ for(i=0; i<(int)n; i++){
+ Pgno iFreePage = get4byte(&pOvflData[8+i*4]);
+#ifndef SQLITE_OMIT_AUTOVACUUM
+ if( pCheck->pBt->autoVacuum ){
+ checkPtrmap(pCheck, iFreePage, PTRMAP_FREEPAGE, 0);
+ }
+#endif
+ checkRef(pCheck, iFreePage);
+ }
+ N -= n;
+ }
+ }
+#ifndef SQLITE_OMIT_AUTOVACUUM
+ else{
+ /* If this database supports auto-vacuum and iPage is not the last
+ ** page in this overflow list, check that the pointer-map entry for
+ ** the following page matches iPage.
+ */
+ if( pCheck->pBt->autoVacuum && N>0 ){
+ i = get4byte(pOvflData);
+ checkPtrmap(pCheck, i, PTRMAP_OVERFLOW2, iPage);
+ }
+ }
+#endif
+ iPage = get4byte(pOvflData);
+ sqlite3PagerUnref(pOvflPage);
+ }
+ if( N && nErrAtStart==pCheck->nErr ){
+ checkAppendMsg(pCheck,
+ "%s is %u but should be %u",
+ isFreeList ? "size" : "overflow list length",
+ expected-N, expected);
+ }
+}
+#endif /* SQLITE_OMIT_INTEGRITY_CHECK */
+
+/*
+** An implementation of a min-heap.
+**
+** aHeap[0] is the number of elements on the heap. aHeap[1] is the
+** root element. The daughter nodes of aHeap[N] are aHeap[N*2]
+** and aHeap[N*2+1].
+**
+** The heap property is this: Every node is less than or equal to both
+** of its daughter nodes. A consequence of the heap property is that the
+** root node aHeap[1] is always the minimum value currently in the heap.
+**
+** The btreeHeapInsert() routine inserts an unsigned 32-bit number onto
+** the heap, preserving the heap property. The btreeHeapPull() routine
+** removes the root element from the heap (the minimum value in the heap)
+** and then moves other nodes around as necessary to preserve the heap
+** property.
+**
+** This heap is used for cell overlap and coverage testing. Each u32
+** entry represents the span of a cell or freeblock on a btree page.
+** The upper 16 bits are the index of the first byte of a range and the
+** lower 16 bits are the index of the last byte of that range.
+*/
+static void btreeHeapInsert(u32 *aHeap, u32 x){
+ u32 j, i;
+ assert( aHeap!=0 );
+ i = ++aHeap[0];
+ aHeap[i] = x;
+ while( (j = i/2)>0 && aHeap[j]>aHeap[i] ){
+ x = aHeap[j];
+ aHeap[j] = aHeap[i];
+ aHeap[i] = x;
+ i = j;
+ }
+}
+static int btreeHeapPull(u32 *aHeap, u32 *pOut){
+ u32 j, i, x;
+ if( (x = aHeap[0])==0 ) return 0;
+ *pOut = aHeap[1];
+ aHeap[1] = aHeap[x];
+ aHeap[x] = 0xffffffff;
+ aHeap[0]--;
+ i = 1;
+ while( (j = i*2)<=aHeap[0] ){
+ if( aHeap[j]>aHeap[j+1] ) j++;
+ if( aHeap[i]<aHeap[j] ) break;
+ x = aHeap[i];
+ aHeap[i] = aHeap[j];
+ aHeap[j] = x;
+ i = j;
+ }
+ return 1;
+}
+
+#ifndef SQLITE_OMIT_INTEGRITY_CHECK
+/*
+** Do various sanity checks on a single page of a tree. Return
+** the tree depth. Root pages return 0. Parents of root pages
+** return 1, and so forth.
+**
+** These checks are done:
+**
+** 1. Make sure that cells and freeblocks do not overlap
+** but combine to completely cover the page.
+** 2. Make sure integer cell keys are in order.
+** 3. Check the integrity of overflow pages.
+** 4. Recursively call checkTreePage on all children.
+** 5. Verify that the depth of all children is the same.
+*/
+static int checkTreePage(
+ IntegrityCk *pCheck, /* Context for the sanity check */
+ Pgno iPage, /* Page number of the page to check */
+ i64 *piMinKey, /* Write minimum integer primary key here */
+ i64 maxKey /* Error if integer primary key greater than this */
+){
+ MemPage *pPage = 0; /* The page being analyzed */
+ int i; /* Loop counter */
+ int rc; /* Result code from subroutine call */
+ int depth = -1, d2; /* Depth of a subtree */
+ int pgno; /* Page number */
+ int nFrag; /* Number of fragmented bytes on the page */
+ int hdr; /* Offset to the page header */
+ int cellStart; /* Offset to the start of the cell pointer array */
+ int nCell; /* Number of cells */
+ int doCoverageCheck = 1; /* True if cell coverage checking should be done */
+ int keyCanBeEqual = 1; /* True if IPK can be equal to maxKey
+ ** False if IPK must be strictly less than maxKey */
+ u8 *data; /* Page content */
+ u8 *pCell; /* Cell content */
+ u8 *pCellIdx; /* Next element of the cell pointer array */
+ BtShared *pBt; /* The BtShared object that owns pPage */
+ u32 pc; /* Address of a cell */
+ u32 usableSize; /* Usable size of the page */
+ u32 contentOffset; /* Offset to the start of the cell content area */
+ u32 *heap = 0; /* Min-heap used for checking cell coverage */
+ u32 x, prev = 0; /* Next and previous entry on the min-heap */
+ const char *saved_zPfx = pCheck->zPfx;
+ int saved_v1 = pCheck->v1;
+ int saved_v2 = pCheck->v2;
+ u8 savedIsInit = 0;
+
+ /* Check that the page exists
+ */
+ checkProgress(pCheck);
+ if( pCheck->mxErr==0 ) goto end_of_check;
+ pBt = pCheck->pBt;
+ usableSize = pBt->usableSize;
+ if( iPage==0 ) return 0;
+ if( checkRef(pCheck, iPage) ) return 0;
+ pCheck->zPfx = "Tree %u page %u: ";
+ pCheck->v1 = iPage;
+ if( (rc = btreeGetPage(pBt, iPage, &pPage, 0))!=0 ){
+ checkAppendMsg(pCheck,
+ "unable to get the page. error code=%d", rc);
+ if( rc==SQLITE_IOERR_NOMEM ) pCheck->rc = SQLITE_NOMEM;
+ goto end_of_check;
+ }
+
+ /* Clear MemPage.isInit to make sure the corruption detection code in
+ ** btreeInitPage() is executed. */
+ savedIsInit = pPage->isInit;
+ pPage->isInit = 0;
+ if( (rc = btreeInitPage(pPage))!=0 ){
+ assert( rc==SQLITE_CORRUPT ); /* The only possible error from InitPage */
+ checkAppendMsg(pCheck,
+ "btreeInitPage() returns error code %d", rc);
+ goto end_of_check;
+ }
+ if( (rc = btreeComputeFreeSpace(pPage))!=0 ){
+ assert( rc==SQLITE_CORRUPT );
+ checkAppendMsg(pCheck, "free space corruption", rc);
+ goto end_of_check;
+ }
+ data = pPage->aData;
+ hdr = pPage->hdrOffset;
+
+ /* Set up for cell analysis */
+ pCheck->zPfx = "Tree %u page %u cell %u: ";
+ contentOffset = get2byteNotZero(&data[hdr+5]);
+ assert( contentOffset<=usableSize ); /* Enforced by btreeInitPage() */
+
+ /* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the
+ ** number of cells on the page. */
+ nCell = get2byte(&data[hdr+3]);
+ assert( pPage->nCell==nCell );
+ if( pPage->leaf || pPage->intKey==0 ){
+ pCheck->nRow += nCell;
+ }
+
+ /* EVIDENCE-OF: R-23882-45353 The cell pointer array of a b-tree page
+ ** immediately follows the b-tree page header. */
+ cellStart = hdr + 12 - 4*pPage->leaf;
+ assert( pPage->aCellIdx==&data[cellStart] );
+ pCellIdx = &data[cellStart + 2*(nCell-1)];
+
+ if( !pPage->leaf ){
+ /* Analyze the right-child page of internal pages */
+ pgno = get4byte(&data[hdr+8]);
+#ifndef SQLITE_OMIT_AUTOVACUUM
+ if( pBt->autoVacuum ){
+ pCheck->zPfx = "Tree %u page %u right child: ";
+ checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage);
+ }
+#endif
+ depth = checkTreePage(pCheck, pgno, &maxKey, maxKey);
+ keyCanBeEqual = 0;
+ }else{
+ /* For leaf pages, the coverage check will occur in the same loop
+ ** as the other cell checks, so initialize the heap. */
+ heap = pCheck->heap;
+ heap[0] = 0;
+ }
+
+ /* EVIDENCE-OF: R-02776-14802 The cell pointer array consists of K 2-byte
+ ** integer offsets to the cell contents. */
+ for(i=nCell-1; i>=0 && pCheck->mxErr; i--){
+ CellInfo info;
+
+ /* Check cell size */
+ pCheck->v2 = i;
+ assert( pCellIdx==&data[cellStart + i*2] );
+ pc = get2byteAligned(pCellIdx);
+ pCellIdx -= 2;
+ if( pc<contentOffset || pc>usableSize-4 ){
+ checkAppendMsg(pCheck, "Offset %u out of range %u..%u",
+ pc, contentOffset, usableSize-4);
+ doCoverageCheck = 0;
+ continue;
+ }
+ pCell = &data[pc];
+ pPage->xParseCell(pPage, pCell, &info);
+ if( pc+info.nSize>usableSize ){
+ checkAppendMsg(pCheck, "Extends off end of page");
+ doCoverageCheck = 0;
+ continue;
+ }
+
+ /* Check for integer primary key out of range */
+ if( pPage->intKey ){
+ if( keyCanBeEqual ? (info.nKey > maxKey) : (info.nKey >= maxKey) ){
+ checkAppendMsg(pCheck, "Rowid %lld out of order", info.nKey);
+ }
+ maxKey = info.nKey;
+ keyCanBeEqual = 0; /* Only the first key on the page may ==maxKey */
+ }
+
+ /* Check the content overflow list */
+ if( info.nPayload>info.nLocal ){
+ u32 nPage; /* Number of pages on the overflow chain */
+ Pgno pgnoOvfl; /* First page of the overflow chain */
+ assert( pc + info.nSize - 4 <= usableSize );
+ nPage = (info.nPayload - info.nLocal + usableSize - 5)/(usableSize - 4);
+ pgnoOvfl = get4byte(&pCell[info.nSize - 4]);
+#ifndef SQLITE_OMIT_AUTOVACUUM
+ if( pBt->autoVacuum ){
+ checkPtrmap(pCheck, pgnoOvfl, PTRMAP_OVERFLOW1, iPage);
+ }
+#endif
+ checkList(pCheck, 0, pgnoOvfl, nPage);
+ }
+
+ if( !pPage->leaf ){
+ /* Check sanity of left child page for internal pages */
+ pgno = get4byte(pCell);
+#ifndef SQLITE_OMIT_AUTOVACUUM
+ if( pBt->autoVacuum ){
+ checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage);
+ }
+#endif
+ d2 = checkTreePage(pCheck, pgno, &maxKey, maxKey);
+ keyCanBeEqual = 0;
+ if( d2!=depth ){
+ checkAppendMsg(pCheck, "Child page depth differs");
+ depth = d2;
+ }
+ }else{
+ /* Populate the coverage-checking heap for leaf pages */
+ btreeHeapInsert(heap, (pc<<16)|(pc+info.nSize-1));
+ }
+ }
+ *piMinKey = maxKey;
+
+ /* Check for complete coverage of the page
+ */
+ pCheck->zPfx = 0;
+ if( doCoverageCheck && pCheck->mxErr>0 ){
+ /* For leaf pages, the min-heap has already been initialized and the
+ ** cells have already been inserted. But for internal pages, that has
+ ** not yet been done, so do it now */
+ if( !pPage->leaf ){
+ heap = pCheck->heap;
+ heap[0] = 0;
+ for(i=nCell-1; i>=0; i--){
+ u32 size;
+ pc = get2byteAligned(&data[cellStart+i*2]);
+ size = pPage->xCellSize(pPage, &data[pc]);
+ btreeHeapInsert(heap, (pc<<16)|(pc+size-1));
+ }
+ }
+ assert( heap!=0 );
+ /* Add the freeblocks to the min-heap
+ **
+ ** EVIDENCE-OF: R-20690-50594 The second field of the b-tree page header
+ ** is the offset of the first freeblock, or zero if there are no
+ ** freeblocks on the page.
+ */
+ i = get2byte(&data[hdr+1]);
+ while( i>0 ){
+ int size, j;
+ assert( (u32)i<=usableSize-4 ); /* Enforced by btreeComputeFreeSpace() */
+ size = get2byte(&data[i+2]);
+ assert( (u32)(i+size)<=usableSize ); /* due to btreeComputeFreeSpace() */
+ btreeHeapInsert(heap, (((u32)i)<<16)|(i+size-1));
+ /* EVIDENCE-OF: R-58208-19414 The first 2 bytes of a freeblock are a
+ ** big-endian integer which is the offset in the b-tree page of the next
+ ** freeblock in the chain, or zero if the freeblock is the last on the
+ ** chain. */
+ j = get2byte(&data[i]);
+ /* EVIDENCE-OF: R-06866-39125 Freeblocks are always connected in order of
+ ** increasing offset. */
+ assert( j==0 || j>i+size ); /* Enforced by btreeComputeFreeSpace() */
+ assert( (u32)j<=usableSize-4 ); /* Enforced by btreeComputeFreeSpace() */
+ i = j;
+ }
+ /* Analyze the min-heap looking for overlap between cells and/or
+ ** freeblocks, and counting the number of untracked bytes in nFrag.
+ **
+ ** Each min-heap entry is of the form: (start_address<<16)|end_address.
+ ** There is an implied first entry the covers the page header, the cell
+ ** pointer index, and the gap between the cell pointer index and the start
+ ** of cell content.
+ **
+ ** The loop below pulls entries from the min-heap in order and compares
+ ** the start_address against the previous end_address. If there is an
+ ** overlap, that means bytes are used multiple times. If there is a gap,
+ ** that gap is added to the fragmentation count.
+ */
+ nFrag = 0;
+ prev = contentOffset - 1; /* Implied first min-heap entry */
+ while( btreeHeapPull(heap,&x) ){
+ if( (prev&0xffff)>=(x>>16) ){
+ checkAppendMsg(pCheck,
+ "Multiple uses for byte %u of page %u", x>>16, iPage);
+ break;
+ }else{
+ nFrag += (x>>16) - (prev&0xffff) - 1;
+ prev = x;
+ }
+ }
+ nFrag += usableSize - (prev&0xffff) - 1;
+ /* EVIDENCE-OF: R-43263-13491 The total number of bytes in all fragments
+ ** is stored in the fifth field of the b-tree page header.
+ ** EVIDENCE-OF: R-07161-27322 The one-byte integer at offset 7 gives the
+ ** number of fragmented free bytes within the cell content area.
+ */
+ if( heap[0]==0 && nFrag!=data[hdr+7] ){
+ checkAppendMsg(pCheck,
+ "Fragmentation of %u bytes reported as %u on page %u",
+ nFrag, data[hdr+7], iPage);
+ }
+ }
+
+end_of_check:
+ if( !doCoverageCheck ) pPage->isInit = savedIsInit;
+ releasePage(pPage);
+ pCheck->zPfx = saved_zPfx;
+ pCheck->v1 = saved_v1;
+ pCheck->v2 = saved_v2;
+ return depth+1;
+}
+#endif /* SQLITE_OMIT_INTEGRITY_CHECK */
+
+#ifndef SQLITE_OMIT_INTEGRITY_CHECK
+/*
+** This routine does a complete check of the given BTree file. aRoot[] is
+** an array of pages numbers were each page number is the root page of
+** a table. nRoot is the number of entries in aRoot.
+**
+** A read-only or read-write transaction must be opened before calling
+** this function.
+**
+** Write the number of error seen in *pnErr. Except for some memory
+** allocation errors, an error message held in memory obtained from
+** malloc is returned if *pnErr is non-zero. If *pnErr==0 then NULL is
+** returned. If a memory allocation error occurs, NULL is returned.
+**
+** If the first entry in aRoot[] is 0, that indicates that the list of
+** root pages is incomplete. This is a "partial integrity-check". This
+** happens when performing an integrity check on a single table. The
+** zero is skipped, of course. But in addition, the freelist checks
+** and the checks to make sure every page is referenced are also skipped,
+** since obviously it is not possible to know which pages are covered by
+** the unverified btrees. Except, if aRoot[1] is 1, then the freelist
+** checks are still performed.
+*/
+SQLITE_PRIVATE int sqlite3BtreeIntegrityCheck(
+ sqlite3 *db, /* Database connection that is running the check */
+ Btree *p, /* The btree to be checked */
+ Pgno *aRoot, /* An array of root pages numbers for individual trees */
+ Mem *aCnt, /* Memory cells to write counts for each tree to */
+ int nRoot, /* Number of entries in aRoot[] */
+ int mxErr, /* Stop reporting errors after this many */
+ int *pnErr, /* OUT: Write number of errors seen to this variable */
+ char **pzOut /* OUT: Write the error message string here */
+){
+ Pgno i;
+ IntegrityCk sCheck;
+ BtShared *pBt = p->pBt;
+ u64 savedDbFlags = pBt->db->flags;
+ char zErr[100];
+ int bPartial = 0; /* True if not checking all btrees */
+ int bCkFreelist = 1; /* True to scan the freelist */
+ VVA_ONLY( int nRef );
+
+ assert( nRoot>0 );
+ assert( aCnt!=0 );
+
+ /* aRoot[0]==0 means this is a partial check */
+ if( aRoot[0]==0 ){
+ assert( nRoot>1 );
+ bPartial = 1;
+ if( aRoot[1]!=1 ) bCkFreelist = 0;
+ }
+
+ sqlite3BtreeEnter(p);
+ assert( p->inTrans>TRANS_NONE && pBt->inTransaction>TRANS_NONE );
+ VVA_ONLY( nRef = sqlite3PagerRefcount(pBt->pPager) );
+ assert( nRef>=0 );
+ memset(&sCheck, 0, sizeof(sCheck));
+ sCheck.db = db;
+ sCheck.pBt = pBt;
+ sCheck.pPager = pBt->pPager;
+ sCheck.nCkPage = btreePagecount(sCheck.pBt);
+ sCheck.mxErr = mxErr;
+ sqlite3StrAccumInit(&sCheck.errMsg, 0, zErr, sizeof(zErr), SQLITE_MAX_LENGTH);
+ sCheck.errMsg.printfFlags = SQLITE_PRINTF_INTERNAL;
+ if( sCheck.nCkPage==0 ){
+ goto integrity_ck_cleanup;
+ }
+
+ sCheck.aPgRef = sqlite3MallocZero((sCheck.nCkPage / 8)+ 1);
+ if( !sCheck.aPgRef ){
+ checkOom(&sCheck);
+ goto integrity_ck_cleanup;
+ }
+ sCheck.heap = (u32*)sqlite3PageMalloc( pBt->pageSize );
+ if( sCheck.heap==0 ){
+ checkOom(&sCheck);
+ goto integrity_ck_cleanup;
+ }
+
+ i = PENDING_BYTE_PAGE(pBt);
+ if( i<=sCheck.nCkPage ) setPageReferenced(&sCheck, i);
+
+ /* Check the integrity of the freelist
+ */
+ if( bCkFreelist ){
+ sCheck.zPfx = "Freelist: ";
+ checkList(&sCheck, 1, get4byte(&pBt->pPage1->aData[32]),
+ get4byte(&pBt->pPage1->aData[36]));
+ sCheck.zPfx = 0;
+ }
+
+ /* Check all the tables.
+ */
+#ifndef SQLITE_OMIT_AUTOVACUUM
+ if( !bPartial ){
+ if( pBt->autoVacuum ){
+ Pgno mx = 0;
+ Pgno mxInHdr;
+ for(i=0; (int)i<nRoot; i++) if( mx<aRoot[i] ) mx = aRoot[i];
+ mxInHdr = get4byte(&pBt->pPage1->aData[52]);
+ if( mx!=mxInHdr ){
+ checkAppendMsg(&sCheck,
+ "max rootpage (%u) disagrees with header (%u)",
+ mx, mxInHdr
+ );
+ }
+ }else if( get4byte(&pBt->pPage1->aData[64])!=0 ){
+ checkAppendMsg(&sCheck,
+ "incremental_vacuum enabled with a max rootpage of zero"
+ );
+ }
+ }
+#endif
+ testcase( pBt->db->flags & SQLITE_CellSizeCk );
+ pBt->db->flags &= ~(u64)SQLITE_CellSizeCk;
+ for(i=0; (int)i<nRoot && sCheck.mxErr; i++){
+ sCheck.nRow = 0;
+ if( aRoot[i] ){
+ i64 notUsed;
+#ifndef SQLITE_OMIT_AUTOVACUUM
+ if( pBt->autoVacuum && aRoot[i]>1 && !bPartial ){
+ checkPtrmap(&sCheck, aRoot[i], PTRMAP_ROOTPAGE, 0);
+ }
+#endif
+ sCheck.v0 = aRoot[i];
+ checkTreePage(&sCheck, aRoot[i], ¬Used, LARGEST_INT64);
+ }
+ sqlite3MemSetArrayInt64(aCnt, i, sCheck.nRow);
+ }
+ pBt->db->flags = savedDbFlags;
+
+ /* Make sure every page in the file is referenced
+ */
+ if( !bPartial ){
+ for(i=1; i<=sCheck.nCkPage && sCheck.mxErr; i++){
+#ifdef SQLITE_OMIT_AUTOVACUUM
+ if( getPageReferenced(&sCheck, i)==0 ){
+ checkAppendMsg(&sCheck, "Page %u: never used", i);
+ }
+#else
+ /* If the database supports auto-vacuum, make sure no tables contain
+ ** references to pointer-map pages.
+ */
+ if( getPageReferenced(&sCheck, i)==0 &&
+ (PTRMAP_PAGENO(pBt, i)!=i || !pBt->autoVacuum) ){
+ checkAppendMsg(&sCheck, "Page %u: never used", i);
+ }
+ if( getPageReferenced(&sCheck, i)!=0 &&
+ (PTRMAP_PAGENO(pBt, i)==i && pBt->autoVacuum) ){
+ checkAppendMsg(&sCheck, "Page %u: pointer map referenced", i);
+ }
+#endif
+ }
+ }
+
+ /* Clean up and report errors.
+ */
+integrity_ck_cleanup:
+ sqlite3PageFree(sCheck.heap);
+ sqlite3_free(sCheck.aPgRef);
+ *pnErr = sCheck.nErr;
+ if( sCheck.nErr==0 ){
+ sqlite3_str_reset(&sCheck.errMsg);
+ *pzOut = 0;
+ }else{
+ *pzOut = sqlite3StrAccumFinish(&sCheck.errMsg);
+ }
+ /* Make sure this analysis did not leave any unref() pages. */
+ assert( nRef==sqlite3PagerRefcount(pBt->pPager) );
+ sqlite3BtreeLeave(p);
+ return sCheck.rc;
+}
+#endif /* SQLITE_OMIT_INTEGRITY_CHECK */
+
+/*
+** Return the full pathname of the underlying database file. Return
+** an empty string if the database is in-memory or a TEMP database.
+**
+** The pager filename is invariant as long as the pager is
+** open so it is safe to access without the BtShared mutex.
+*/
+SQLITE_PRIVATE const char *sqlite3BtreeGetFilename(Btree *p){
+ assert( p->pBt->pPager!=0 );
+ return sqlite3PagerFilename(p->pBt->pPager, 1);
+}
+
+/*
+** Return the pathname of the journal file for this database. The return
+** value of this routine is the same regardless of whether the journal file
+** has been created or not.
+**
+** The pager journal filename is invariant as long as the pager is
+** open so it is safe to access without the BtShared mutex.
+*/
+SQLITE_PRIVATE const char *sqlite3BtreeGetJournalname(Btree *p){
+ assert( p->pBt->pPager!=0 );
+ return sqlite3PagerJournalname(p->pBt->pPager);
+}
+
+/*
+** Return one of SQLITE_TXN_NONE, SQLITE_TXN_READ, or SQLITE_TXN_WRITE
+** to describe the current transaction state of Btree p.
+*/
+SQLITE_PRIVATE int sqlite3BtreeTxnState(Btree *p){
+ assert( p==0 || sqlite3_mutex_held(p->db->mutex) );
+ return p ? p->inTrans : 0;
+}
+
+#ifndef SQLITE_OMIT_WAL
+/*
+** Run a checkpoint on the Btree passed as the first argument.
+**
+** Return SQLITE_LOCKED if this or any other connection has an open
+** transaction on the shared-cache the argument Btree is connected to.
+**
+** Parameter eMode is one of SQLITE_CHECKPOINT_PASSIVE, FULL or RESTART.
+*/
+SQLITE_PRIVATE int sqlite3BtreeCheckpoint(Btree *p, int eMode, int *pnLog, int *pnCkpt){
+ int rc = SQLITE_OK;
+ if( p ){
+ BtShared *pBt = p->pBt;
+ sqlite3BtreeEnter(p);
+ if( pBt->inTransaction!=TRANS_NONE ){
+ rc = SQLITE_LOCKED;
+ }else{
+ rc = sqlite3PagerCheckpoint(pBt->pPager, p->db, eMode, pnLog, pnCkpt);
+ }
+ sqlite3BtreeLeave(p);
+ }
+ return rc;
+}
+#endif
+
+/*
+** Return true if there is currently a backup running on Btree p.
+*/
+SQLITE_PRIVATE int sqlite3BtreeIsInBackup(Btree *p){
+ assert( p );
+ assert( sqlite3_mutex_held(p->db->mutex) );
+ return p->nBackup!=0;
+}
+
+/*
+** This function returns a pointer to a blob of memory associated with
+** a single shared-btree. The memory is used by client code for its own
+** purposes (for example, to store a high-level schema associated with
+** the shared-btree). The btree layer manages reference counting issues.
+**
+** The first time this is called on a shared-btree, nBytes bytes of memory
+** are allocated, zeroed, and returned to the caller. For each subsequent
+** call the nBytes parameter is ignored and a pointer to the same blob
+** of memory returned.
+**
+** If the nBytes parameter is 0 and the blob of memory has not yet been
+** allocated, a null pointer is returned. If the blob has already been
+** allocated, it is returned as normal.
+**
+** Just before the shared-btree is closed, the function passed as the
+** xFree argument when the memory allocation was made is invoked on the
+** blob of allocated memory. The xFree function should not call sqlite3_free()
+** on the memory, the btree layer does that.
+*/
+SQLITE_PRIVATE void *sqlite3BtreeSchema(Btree *p, int nBytes, void(*xFree)(void *)){
+ BtShared *pBt = p->pBt;
+ sqlite3BtreeEnter(p);
+ if( !pBt->pSchema && nBytes ){
+ pBt->pSchema = sqlite3DbMallocZero(0, nBytes);
+ pBt->xFreeSchema = xFree;
+ }
+ sqlite3BtreeLeave(p);
+ return pBt->pSchema;
+}
+
+/*
+** Return SQLITE_LOCKED_SHAREDCACHE if another user of the same shared
+** btree as the argument handle holds an exclusive lock on the
+** sqlite_schema table. Otherwise SQLITE_OK.
+*/
+SQLITE_PRIVATE int sqlite3BtreeSchemaLocked(Btree *p){
+ int rc;
+ assert( sqlite3_mutex_held(p->db->mutex) );
+ sqlite3BtreeEnter(p);
+ rc = querySharedCacheTableLock(p, SCHEMA_ROOT, READ_LOCK);
+ assert( rc==SQLITE_OK || rc==SQLITE_LOCKED_SHAREDCACHE );
+ sqlite3BtreeLeave(p);
+ return rc;
+}
+
+
+#ifndef SQLITE_OMIT_SHARED_CACHE
+/*
+** Obtain a lock on the table whose root page is iTab. The
+** lock is a write lock if isWritelock is true or a read lock
+** if it is false.
+*/
+SQLITE_PRIVATE int sqlite3BtreeLockTable(Btree *p, int iTab, u8 isWriteLock){
+ int rc = SQLITE_OK;
+ assert( p->inTrans!=TRANS_NONE );
+ if( p->sharable ){
+ u8 lockType = READ_LOCK + isWriteLock;
+ assert( READ_LOCK+1==WRITE_LOCK );
+ assert( isWriteLock==0 || isWriteLock==1 );
+
+ sqlite3BtreeEnter(p);
+ rc = querySharedCacheTableLock(p, iTab, lockType);
+ if( rc==SQLITE_OK ){
+ rc = setSharedCacheTableLock(p, iTab, lockType);
+ }
+ sqlite3BtreeLeave(p);
+ }
+ return rc;
+}
+#endif
+
+#ifndef SQLITE_OMIT_INCRBLOB
+/*
+** Argument pCsr must be a cursor opened for writing on an
+** INTKEY table currently pointing at a valid table entry.
+** This function modifies the data stored as part of that entry.
+**
+** Only the data content may only be modified, it is not possible to
+** change the length of the data stored. If this function is called with
+** parameters that attempt to write past the end of the existing data,
+** no modifications are made and SQLITE_CORRUPT is returned.
+*/
+SQLITE_PRIVATE int sqlite3BtreePutData(BtCursor *pCsr, u32 offset, u32 amt, void *z){
+ int rc;
+ assert( cursorOwnsBtShared(pCsr) );
+ assert( sqlite3_mutex_held(pCsr->pBtree->db->mutex) );
+ assert( pCsr->curFlags & BTCF_Incrblob );
+
+ rc = restoreCursorPosition(pCsr);
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+ assert( pCsr->eState!=CURSOR_REQUIRESEEK );
+ if( pCsr->eState!=CURSOR_VALID ){
+ return SQLITE_ABORT;
+ }
+
+ /* Save the positions of all other cursors open on this table. This is
+ ** required in case any of them are holding references to an xFetch
+ ** version of the b-tree page modified by the accessPayload call below.
+ **
+ ** Note that pCsr must be open on a INTKEY table and saveCursorPosition()
+ ** and hence saveAllCursors() cannot fail on a BTREE_INTKEY table, hence
+ ** saveAllCursors can only return SQLITE_OK.
+ */
+ VVA_ONLY(rc =) saveAllCursors(pCsr->pBt, pCsr->pgnoRoot, pCsr);
+ assert( rc==SQLITE_OK );
+
+ /* Check some assumptions:
+ ** (a) the cursor is open for writing,
+ ** (b) there is a read/write transaction open,
+ ** (c) the connection holds a write-lock on the table (if required),
+ ** (d) there are no conflicting read-locks, and
+ ** (e) the cursor points at a valid row of an intKey table.
+ */
+ if( (pCsr->curFlags & BTCF_WriteFlag)==0 ){
+ return SQLITE_READONLY;
+ }
+ assert( (pCsr->pBt->btsFlags & BTS_READ_ONLY)==0
+ && pCsr->pBt->inTransaction==TRANS_WRITE );
+ assert( hasSharedCacheTableLock(pCsr->pBtree, pCsr->pgnoRoot, 0, 2) );
+ assert( !hasReadConflicts(pCsr->pBtree, pCsr->pgnoRoot) );
+ assert( pCsr->pPage->intKey );
+
+ return accessPayload(pCsr, offset, amt, (unsigned char *)z, 1);
+}
+
+/*
+** Mark this cursor as an incremental blob cursor.
+*/
+SQLITE_PRIVATE void sqlite3BtreeIncrblobCursor(BtCursor *pCur){
+ pCur->curFlags |= BTCF_Incrblob;
+ pCur->pBtree->hasIncrblobCur = 1;
+}
+#endif
+
+/*
+** Set both the "read version" (single byte at byte offset 18) and
+** "write version" (single byte at byte offset 19) fields in the database
+** header to iVersion.
+*/
+SQLITE_PRIVATE int sqlite3BtreeSetVersion(Btree *pBtree, int iVersion){
+ BtShared *pBt = pBtree->pBt;
+ int rc; /* Return code */
+
+ assert( iVersion==1 || iVersion==2 );
+
+ /* If setting the version fields to 1, do not automatically open the
+ ** WAL connection, even if the version fields are currently set to 2.
+ */
+ pBt->btsFlags &= ~BTS_NO_WAL;
+ if( iVersion==1 ) pBt->btsFlags |= BTS_NO_WAL;
+
+ rc = sqlite3BtreeBeginTrans(pBtree, 0, 0);
+ if( rc==SQLITE_OK ){
+ u8 *aData = pBt->pPage1->aData;
+ if( aData[18]!=(u8)iVersion || aData[19]!=(u8)iVersion ){
+ rc = sqlite3BtreeBeginTrans(pBtree, 2, 0);
+ if( rc==SQLITE_OK ){
+ rc = sqlite3PagerWrite(pBt->pPage1->pDbPage);
+ if( rc==SQLITE_OK ){
+ aData[18] = (u8)iVersion;
+ aData[19] = (u8)iVersion;
+ }
+ }
+ }
+ }
+
+ pBt->btsFlags &= ~BTS_NO_WAL;
+ return rc;
+}
+
+/*
+** Return true if the cursor has a hint specified. This routine is
+** only used from within assert() statements
+*/
+SQLITE_PRIVATE int sqlite3BtreeCursorHasHint(BtCursor *pCsr, unsigned int mask){
+ return (pCsr->hints & mask)!=0;
+}
+
+/*
+** Return true if the given Btree is read-only.
+*/
+SQLITE_PRIVATE int sqlite3BtreeIsReadonly(Btree *p){
+ return (p->pBt->btsFlags & BTS_READ_ONLY)!=0;
+}
+
+/*
+** Return the size of the header added to each page by this module.
+*/
+SQLITE_PRIVATE int sqlite3HeaderSizeBtree(void){ return ROUND8(sizeof(MemPage)); }
+
+/*
+** If no transaction is active and the database is not a temp-db, clear
+** the in-memory pager cache.
+*/
+SQLITE_PRIVATE void sqlite3BtreeClearCache(Btree *p){
+ BtShared *pBt = p->pBt;
+ if( pBt->inTransaction==TRANS_NONE ){
+ sqlite3PagerClearCache(pBt->pPager);
+ }
+}
+
+#if !defined(SQLITE_OMIT_SHARED_CACHE)
+/*
+** Return true if the Btree passed as the only argument is sharable.
+*/
+SQLITE_PRIVATE int sqlite3BtreeSharable(Btree *p){
+ return p->sharable;
+}
+
+/*
+** Return the number of connections to the BtShared object accessed by
+** the Btree handle passed as the only argument. For private caches
+** this is always 1. For shared caches it may be 1 or greater.
+*/
+SQLITE_PRIVATE int sqlite3BtreeConnectionCount(Btree *p){
+ testcase( p->sharable );
+ return p->pBt->nRef;
+}
+#endif
+
+/************** End of btree.c ***********************************************/
+/************** Begin file backup.c ******************************************/
+/*
+** 2009 January 28
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This file contains the implementation of the sqlite3_backup_XXX()
+** API functions and the related features.
+*/
+/* #include "sqliteInt.h" */
+/* #include "btreeInt.h" */
+
+/*
+** Structure allocated for each backup operation.
+*/
+struct sqlite3_backup {
+ sqlite3* pDestDb; /* Destination database handle */
+ Btree *pDest; /* Destination b-tree file */
+ u32 iDestSchema; /* Original schema cookie in destination */
+ int bDestLocked; /* True once a write-transaction is open on pDest */
+
+ Pgno iNext; /* Page number of the next source page to copy */
+ sqlite3* pSrcDb; /* Source database handle */
+ Btree *pSrc; /* Source b-tree file */
+
+ int rc; /* Backup process error code */
+
+ /* These two variables are set by every call to backup_step(). They are
+ ** read by calls to backup_remaining() and backup_pagecount().
+ */
+ Pgno nRemaining; /* Number of pages left to copy */
+ Pgno nPagecount; /* Total number of pages to copy */
+
+ int isAttached; /* True once backup has been registered with pager */
+ sqlite3_backup *pNext; /* Next backup associated with source pager */
+};
+
+/*
+** THREAD SAFETY NOTES:
+**
+** Once it has been created using backup_init(), a single sqlite3_backup
+** structure may be accessed via two groups of thread-safe entry points:
+**
+** * Via the sqlite3_backup_XXX() API function backup_step() and
+** backup_finish(). Both these functions obtain the source database
+** handle mutex and the mutex associated with the source BtShared
+** structure, in that order.
+**
+** * Via the BackupUpdate() and BackupRestart() functions, which are
+** invoked by the pager layer to report various state changes in
+** the page cache associated with the source database. The mutex
+** associated with the source database BtShared structure will always
+** be held when either of these functions are invoked.
+**
+** The other sqlite3_backup_XXX() API functions, backup_remaining() and
+** backup_pagecount() are not thread-safe functions. If they are called
+** while some other thread is calling backup_step() or backup_finish(),
+** the values returned may be invalid. There is no way for a call to
+** BackupUpdate() or BackupRestart() to interfere with backup_remaining()
+** or backup_pagecount().
+**
+** Depending on the SQLite configuration, the database handles and/or
+** the Btree objects may have their own mutexes that require locking.
+** Non-sharable Btrees (in-memory databases for example), do not have
+** associated mutexes.
+*/
+
+/*
+** Return a pointer corresponding to database zDb (i.e. "main", "temp")
+** in connection handle pDb. If such a database cannot be found, return
+** a NULL pointer and write an error message to pErrorDb.
+**
+** If the "temp" database is requested, it may need to be opened by this
+** function. If an error occurs while doing so, return 0 and write an
+** error message to pErrorDb.
+*/
+static Btree *findBtree(sqlite3 *pErrorDb, sqlite3 *pDb, const char *zDb){
+ int i = sqlite3FindDbName(pDb, zDb);
+
+ if( i==1 ){
+ Parse sParse;
+ int rc = 0;
+ sqlite3ParseObjectInit(&sParse,pDb);
+ if( sqlite3OpenTempDatabase(&sParse) ){
+ sqlite3ErrorWithMsg(pErrorDb, sParse.rc, "%s", sParse.zErrMsg);
+ rc = SQLITE_ERROR;
+ }
+ sqlite3DbFree(pErrorDb, sParse.zErrMsg);
+ sqlite3ParseObjectReset(&sParse);
+ if( rc ){
+ return 0;
+ }
+ }
+
+ if( i<0 ){
+ sqlite3ErrorWithMsg(pErrorDb, SQLITE_ERROR, "unknown database %s", zDb);
+ return 0;
+ }
+
+ return pDb->aDb[i].pBt;
+}
+
+/*
+** Attempt to set the page size of the destination to match the page size
+** of the source.
+*/
+static int setDestPgsz(sqlite3_backup *p){
+ int rc;
+ rc = sqlite3BtreeSetPageSize(p->pDest,sqlite3BtreeGetPageSize(p->pSrc),0,0);
+ return rc;
+}
+
+/*
+** Check that there is no open read-transaction on the b-tree passed as the
+** second argument. If there is not, return SQLITE_OK. Otherwise, if there
+** is an open read-transaction, return SQLITE_ERROR and leave an error
+** message in database handle db.
+*/
+static int checkReadTransaction(sqlite3 *db, Btree *p){
+ if( sqlite3BtreeTxnState(p)!=SQLITE_TXN_NONE ){
+ sqlite3ErrorWithMsg(db, SQLITE_ERROR, "destination database is in use");
+ return SQLITE_ERROR;
+ }
+ return SQLITE_OK;
+}
+
+/*
+** Create an sqlite3_backup process to copy the contents of zSrcDb from
+** connection handle pSrcDb to zDestDb in pDestDb. If successful, return
+** a pointer to the new sqlite3_backup object.
+**
+** If an error occurs, NULL is returned and an error code and error message
+** stored in database handle pDestDb.
+*/
+SQLITE_API sqlite3_backup *sqlite3_backup_init(
+ sqlite3* pDestDb, /* Database to write to */
+ const char *zDestDb, /* Name of database within pDestDb */
+ sqlite3* pSrcDb, /* Database connection to read from */
+ const char *zSrcDb /* Name of database within pSrcDb */
+){
+ sqlite3_backup *p; /* Value to return */
+
+#ifdef SQLITE_ENABLE_API_ARMOR
+ if( !sqlite3SafetyCheckOk(pSrcDb)||!sqlite3SafetyCheckOk(pDestDb) ){
+ (void)SQLITE_MISUSE_BKPT;
+ return 0;
+ }
+#endif
+
+ /* Lock the source database handle. The destination database
+ ** handle is not locked in this routine, but it is locked in
+ ** sqlite3_backup_step(). The user is required to ensure that no
+ ** other thread accesses the destination handle for the duration
+ ** of the backup operation. Any attempt to use the destination
+ ** database connection while a backup is in progress may cause
+ ** a malfunction or a deadlock.
+ */
+ sqlite3_mutex_enter(pSrcDb->mutex);
+ sqlite3_mutex_enter(pDestDb->mutex);
+
+ if( pSrcDb==pDestDb ){
+ sqlite3ErrorWithMsg(
+ pDestDb, SQLITE_ERROR, "source and destination must be distinct"
+ );
+ p = 0;
+ }else {
+ /* Allocate space for a new sqlite3_backup object...
+ ** EVIDENCE-OF: R-64852-21591 The sqlite3_backup object is created by a
+ ** call to sqlite3_backup_init() and is destroyed by a call to
+ ** sqlite3_backup_finish(). */
+ p = (sqlite3_backup *)sqlite3MallocZero(sizeof(sqlite3_backup));
+ if( !p ){
+ sqlite3Error(pDestDb, SQLITE_NOMEM_BKPT);
+ }
+ }
+
+ /* If the allocation succeeded, populate the new object. */
+ if( p ){
+ p->pSrc = findBtree(pDestDb, pSrcDb, zSrcDb);
+ p->pDest = findBtree(pDestDb, pDestDb, zDestDb);
+ p->pDestDb = pDestDb;
+ p->pSrcDb = pSrcDb;
+ p->iNext = 1;
+ p->isAttached = 0;
+
+ if( 0==p->pSrc || 0==p->pDest
+ || checkReadTransaction(pDestDb, p->pDest)!=SQLITE_OK
+ ){
+ /* One (or both) of the named databases did not exist or an OOM
+ ** error was hit. Or there is a transaction open on the destination
+ ** database. The error has already been written into the pDestDb
+ ** handle. All that is left to do here is free the sqlite3_backup
+ ** structure. */
+ sqlite3_free(p);
+ p = 0;
+ }
+ }
+ if( p ){
+ p->pSrc->nBackup++;
+ }
+
+ sqlite3_mutex_leave(pDestDb->mutex);
+ sqlite3_mutex_leave(pSrcDb->mutex);
+ return p;
+}
+
+/*
+** Argument rc is an SQLite error code. Return true if this error is
+** considered fatal if encountered during a backup operation. All errors
+** are considered fatal except for SQLITE_BUSY and SQLITE_LOCKED.
+*/
+static int isFatalError(int rc){
+ return (rc!=SQLITE_OK && rc!=SQLITE_BUSY && ALWAYS(rc!=SQLITE_LOCKED));
+}
+
+/*
+** Parameter zSrcData points to a buffer containing the data for
+** page iSrcPg from the source database. Copy this data into the
+** destination database.
+*/
+static int backupOnePage(
+ sqlite3_backup *p, /* Backup handle */
+ Pgno iSrcPg, /* Source database page to backup */
+ const u8 *zSrcData, /* Source database page data */
+ int bUpdate /* True for an update, false otherwise */
+){
+ Pager * const pDestPager = sqlite3BtreePager(p->pDest);
+ const int nSrcPgsz = sqlite3BtreeGetPageSize(p->pSrc);
+ int nDestPgsz = sqlite3BtreeGetPageSize(p->pDest);
+ const int nCopy = MIN(nSrcPgsz, nDestPgsz);
+ const i64 iEnd = (i64)iSrcPg*(i64)nSrcPgsz;
+ int rc = SQLITE_OK;
+ i64 iOff;
+
+ assert( sqlite3BtreeGetReserveNoMutex(p->pSrc)>=0 );
+ assert( p->bDestLocked );
+ assert( !isFatalError(p->rc) );
+ assert( iSrcPg!=PENDING_BYTE_PAGE(p->pSrc->pBt) );
+ assert( zSrcData );
+ assert( nSrcPgsz==nDestPgsz || sqlite3PagerIsMemdb(pDestPager)==0 );
+
+ /* This loop runs once for each destination page spanned by the source
+ ** page. For each iteration, variable iOff is set to the byte offset
+ ** of the destination page.
+ */
+ for(iOff=iEnd-(i64)nSrcPgsz; rc==SQLITE_OK && iOff<iEnd; iOff+=nDestPgsz){
+ DbPage *pDestPg = 0;
+ Pgno iDest = (Pgno)(iOff/nDestPgsz)+1;
+ if( iDest==PENDING_BYTE_PAGE(p->pDest->pBt) ) continue;
+ if( SQLITE_OK==(rc = sqlite3PagerGet(pDestPager, iDest, &pDestPg, 0))
+ && SQLITE_OK==(rc = sqlite3PagerWrite(pDestPg))
+ ){
+ const u8 *zIn = &zSrcData[iOff%nSrcPgsz];
+ u8 *zDestData = sqlite3PagerGetData(pDestPg);
+ u8 *zOut = &zDestData[iOff%nDestPgsz];
+
+ /* Copy the data from the source page into the destination page.
+ ** Then clear the Btree layer MemPage.isInit flag. Both this module
+ ** and the pager code use this trick (clearing the first byte
+ ** of the page 'extra' space to invalidate the Btree layers
+ ** cached parse of the page). MemPage.isInit is marked
+ ** "MUST BE FIRST" for this purpose.
+ */
+ memcpy(zOut, zIn, nCopy);
+ ((u8 *)sqlite3PagerGetExtra(pDestPg))[0] = 0;
+ if( iOff==0 && bUpdate==0 ){
+ sqlite3Put4byte(&zOut[28], sqlite3BtreeLastPage(p->pSrc));
+ }
+ }
+ sqlite3PagerUnref(pDestPg);
+ }
+
+ return rc;
+}
+
+/*
+** If pFile is currently larger than iSize bytes, then truncate it to
+** exactly iSize bytes. If pFile is not larger than iSize bytes, then
+** this function is a no-op.
+**
+** Return SQLITE_OK if everything is successful, or an SQLite error
+** code if an error occurs.
+*/
+static int backupTruncateFile(sqlite3_file *pFile, i64 iSize){
+ i64 iCurrent;
+ int rc = sqlite3OsFileSize(pFile, &iCurrent);
+ if( rc==SQLITE_OK && iCurrent>iSize ){
+ rc = sqlite3OsTruncate(pFile, iSize);
+ }
+ return rc;
+}
+
+/*
+** Register this backup object with the associated source pager for
+** callbacks when pages are changed or the cache invalidated.
+*/
+static void attachBackupObject(sqlite3_backup *p){
+ sqlite3_backup **pp;
+ assert( sqlite3BtreeHoldsMutex(p->pSrc) );
+ pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc));
+ p->pNext = *pp;
+ *pp = p;
+ p->isAttached = 1;
+}
+
+/*
+** Copy nPage pages from the source b-tree to the destination.
+*/
+SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage){
+ int rc;
+ int destMode; /* Destination journal mode */
+ int pgszSrc = 0; /* Source page size */
+ int pgszDest = 0; /* Destination page size */
+
+#ifdef SQLITE_ENABLE_API_ARMOR
+ if( p==0 ) return SQLITE_MISUSE_BKPT;
+#endif
+ sqlite3_mutex_enter(p->pSrcDb->mutex);
+ sqlite3BtreeEnter(p->pSrc);
+ if( p->pDestDb ){
+ sqlite3_mutex_enter(p->pDestDb->mutex);
+ }
+
+ rc = p->rc;
+ if( !isFatalError(rc) ){
+ Pager * const pSrcPager = sqlite3BtreePager(p->pSrc); /* Source pager */
+ Pager * const pDestPager = sqlite3BtreePager(p->pDest); /* Dest pager */
+ int ii; /* Iterator variable */
+ int nSrcPage = -1; /* Size of source db in pages */
+ int bCloseTrans = 0; /* True if src db requires unlocking */
+
+ /* If the source pager is currently in a write-transaction, return
+ ** SQLITE_BUSY immediately.
+ */
+ if( p->pDestDb && p->pSrc->pBt->inTransaction==TRANS_WRITE ){
+ rc = SQLITE_BUSY;
+ }else{
+ rc = SQLITE_OK;
+ }
+
+ /* If there is no open read-transaction on the source database, open
+ ** one now. If a transaction is opened here, then it will be closed
+ ** before this function exits.
+ */
+ if( rc==SQLITE_OK && SQLITE_TXN_NONE==sqlite3BtreeTxnState(p->pSrc) ){
+ rc = sqlite3BtreeBeginTrans(p->pSrc, 0, 0);
+ bCloseTrans = 1;
+ }
+
+ /* If the destination database has not yet been locked (i.e. if this
+ ** is the first call to backup_step() for the current backup operation),
+ ** try to set its page size to the same as the source database. This
+ ** is especially important on ZipVFS systems, as in that case it is
+ ** not possible to create a database file that uses one page size by
+ ** writing to it with another. */
+ if( p->bDestLocked==0 && rc==SQLITE_OK && setDestPgsz(p)==SQLITE_NOMEM ){
+ rc = SQLITE_NOMEM;
+ }
+
+ /* Lock the destination database, if it is not locked already. */
+ if( SQLITE_OK==rc && p->bDestLocked==0
+ && SQLITE_OK==(rc = sqlite3BtreeBeginTrans(p->pDest, 2,
+ (int*)&p->iDestSchema))
+ ){
+ p->bDestLocked = 1;
+ }
+
+ /* Do not allow backup if the destination database is in WAL mode
+ ** and the page sizes are different between source and destination */
+ pgszSrc = sqlite3BtreeGetPageSize(p->pSrc);
+ pgszDest = sqlite3BtreeGetPageSize(p->pDest);
+ destMode = sqlite3PagerGetJournalMode(sqlite3BtreePager(p->pDest));
+ if( SQLITE_OK==rc
+ && (destMode==PAGER_JOURNALMODE_WAL || sqlite3PagerIsMemdb(pDestPager))
+ && pgszSrc!=pgszDest
+ ){
+ rc = SQLITE_READONLY;
+ }
+
+ /* Now that there is a read-lock on the source database, query the
+ ** source pager for the number of pages in the database.
+ */
+ nSrcPage = (int)sqlite3BtreeLastPage(p->pSrc);
+ assert( nSrcPage>=0 );
+ for(ii=0; (nPage<0 || ii<nPage) && p->iNext<=(Pgno)nSrcPage && !rc; ii++){
+ const Pgno iSrcPg = p->iNext; /* Source page number */
+ if( iSrcPg!=PENDING_BYTE_PAGE(p->pSrc->pBt) ){
+ DbPage *pSrcPg; /* Source page object */
+ rc = sqlite3PagerGet(pSrcPager, iSrcPg, &pSrcPg,PAGER_GET_READONLY);
+ if( rc==SQLITE_OK ){
+ rc = backupOnePage(p, iSrcPg, sqlite3PagerGetData(pSrcPg), 0);
+ sqlite3PagerUnref(pSrcPg);
+ }
+ }
+ p->iNext++;
+ }
+ if( rc==SQLITE_OK ){
+ p->nPagecount = nSrcPage;
+ p->nRemaining = nSrcPage+1-p->iNext;
+ if( p->iNext>(Pgno)nSrcPage ){
+ rc = SQLITE_DONE;
+ }else if( !p->isAttached ){
+ attachBackupObject(p);
+ }
+ }
+
+ /* Update the schema version field in the destination database. This
+ ** is to make sure that the schema-version really does change in
+ ** the case where the source and destination databases have the
+ ** same schema version.
+ */
+ if( rc==SQLITE_DONE ){
+ if( nSrcPage==0 ){
+ rc = sqlite3BtreeNewDb(p->pDest);
+ nSrcPage = 1;
+ }
+ if( rc==SQLITE_OK || rc==SQLITE_DONE ){
+ rc = sqlite3BtreeUpdateMeta(p->pDest,1,p->iDestSchema+1);
+ }
+ if( rc==SQLITE_OK ){
+ if( p->pDestDb ){
+ sqlite3ResetAllSchemasOfConnection(p->pDestDb);
+ }
+ if( destMode==PAGER_JOURNALMODE_WAL ){
+ rc = sqlite3BtreeSetVersion(p->pDest, 2);
+ }
+ }
+ if( rc==SQLITE_OK ){
+ int nDestTruncate;
+ /* Set nDestTruncate to the final number of pages in the destination
+ ** database. The complication here is that the destination page
+ ** size may be different to the source page size.
+ **
+ ** If the source page size is smaller than the destination page size,
+ ** round up. In this case the call to sqlite3OsTruncate() below will
+ ** fix the size of the file. However it is important to call
+ ** sqlite3PagerTruncateImage() here so that any pages in the
+ ** destination file that lie beyond the nDestTruncate page mark are
+ ** journalled by PagerCommitPhaseOne() before they are destroyed
+ ** by the file truncation.
+ */
+ assert( pgszSrc==sqlite3BtreeGetPageSize(p->pSrc) );
+ assert( pgszDest==sqlite3BtreeGetPageSize(p->pDest) );
+ if( pgszSrc<pgszDest ){
+ int ratio = pgszDest/pgszSrc;
+ nDestTruncate = (nSrcPage+ratio-1)/ratio;
+ if( nDestTruncate==(int)PENDING_BYTE_PAGE(p->pDest->pBt) ){
+ nDestTruncate--;
+ }
+ }else{
+ nDestTruncate = nSrcPage * (pgszSrc/pgszDest);
+ }
+ assert( nDestTruncate>0 );
+
+ if( pgszSrc<pgszDest ){
+ /* If the source page-size is smaller than the destination page-size,
+ ** two extra things may need to happen:
+ **
+ ** * The destination may need to be truncated, and
+ **
+ ** * Data stored on the pages immediately following the
+ ** pending-byte page in the source database may need to be
+ ** copied into the destination database.
+ */
+ const i64 iSize = (i64)pgszSrc * (i64)nSrcPage;
+ sqlite3_file * const pFile = sqlite3PagerFile(pDestPager);
+ Pgno iPg;
+ int nDstPage;
+ i64 iOff;
+ i64 iEnd;
+
+ assert( pFile );
+ assert( nDestTruncate==0
+ || (i64)nDestTruncate*(i64)pgszDest >= iSize || (
+ nDestTruncate==(int)(PENDING_BYTE_PAGE(p->pDest->pBt)-1)
+ && iSize>=PENDING_BYTE && iSize<=PENDING_BYTE+pgszDest
+ ));
+
+ /* This block ensures that all data required to recreate the original
+ ** database has been stored in the journal for pDestPager and the
+ ** journal synced to disk. So at this point we may safely modify
+ ** the database file in any way, knowing that if a power failure
+ ** occurs, the original database will be reconstructed from the
+ ** journal file. */
+ sqlite3PagerPagecount(pDestPager, &nDstPage);
+ for(iPg=nDestTruncate; rc==SQLITE_OK && iPg<=(Pgno)nDstPage; iPg++){
+ if( iPg!=PENDING_BYTE_PAGE(p->pDest->pBt) ){
+ DbPage *pPg;
+ rc = sqlite3PagerGet(pDestPager, iPg, &pPg, 0);
+ if( rc==SQLITE_OK ){
+ rc = sqlite3PagerWrite(pPg);
+ sqlite3PagerUnref(pPg);
+ }
+ }
+ }
+ if( rc==SQLITE_OK ){
+ rc = sqlite3PagerCommitPhaseOne(pDestPager, 0, 1);
+ }
+
+ /* Write the extra pages and truncate the database file as required */
+ iEnd = MIN(PENDING_BYTE + pgszDest, iSize);
+ for(
+ iOff=PENDING_BYTE+pgszSrc;
+ rc==SQLITE_OK && iOff<iEnd;
+ iOff+=pgszSrc
+ ){
+ PgHdr *pSrcPg = 0;
+ const Pgno iSrcPg = (Pgno)((iOff/pgszSrc)+1);
+ rc = sqlite3PagerGet(pSrcPager, iSrcPg, &pSrcPg, 0);
+ if( rc==SQLITE_OK ){
+ u8 *zData = sqlite3PagerGetData(pSrcPg);
+ rc = sqlite3OsWrite(pFile, zData, pgszSrc, iOff);
+ }
+ sqlite3PagerUnref(pSrcPg);
+ }
+ if( rc==SQLITE_OK ){
+ rc = backupTruncateFile(pFile, iSize);
+ }
+
+ /* Sync the database file to disk. */
+ if( rc==SQLITE_OK ){
+ rc = sqlite3PagerSync(pDestPager, 0);
+ }
+ }else{
+ sqlite3PagerTruncateImage(pDestPager, nDestTruncate);
+ rc = sqlite3PagerCommitPhaseOne(pDestPager, 0, 0);
+ }
+
+ /* Finish committing the transaction to the destination database. */
+ if( SQLITE_OK==rc
+ && SQLITE_OK==(rc = sqlite3BtreeCommitPhaseTwo(p->pDest, 0))
+ ){
+ rc = SQLITE_DONE;
+ }
+ }
+ }
+
+ /* If bCloseTrans is true, then this function opened a read transaction
+ ** on the source database. Close the read transaction here. There is
+ ** no need to check the return values of the btree methods here, as
+ ** "committing" a read-only transaction cannot fail.
+ */
+ if( bCloseTrans ){
+ TESTONLY( int rc2 );
+ TESTONLY( rc2 = ) sqlite3BtreeCommitPhaseOne(p->pSrc, 0);
+ TESTONLY( rc2 |= ) sqlite3BtreeCommitPhaseTwo(p->pSrc, 0);
+ assert( rc2==SQLITE_OK );
+ }
+
+ if( rc==SQLITE_IOERR_NOMEM ){
+ rc = SQLITE_NOMEM_BKPT;
+ }
+ p->rc = rc;
+ }
+ if( p->pDestDb ){
+ sqlite3_mutex_leave(p->pDestDb->mutex);
+ }
+ sqlite3BtreeLeave(p->pSrc);
+ sqlite3_mutex_leave(p->pSrcDb->mutex);
+ return rc;
+}
+
+/*
+** Release all resources associated with an sqlite3_backup* handle.
+*/
+SQLITE_API int sqlite3_backup_finish(sqlite3_backup *p){
+ sqlite3_backup **pp; /* Ptr to head of pagers backup list */
+ sqlite3 *pSrcDb; /* Source database connection */
+ int rc; /* Value to return */
+
+ /* Enter the mutexes */
+ if( p==0 ) return SQLITE_OK;
+ pSrcDb = p->pSrcDb;
+ sqlite3_mutex_enter(pSrcDb->mutex);
+ sqlite3BtreeEnter(p->pSrc);
+ if( p->pDestDb ){
+ sqlite3_mutex_enter(p->pDestDb->mutex);
+ }
+
+ /* Detach this backup from the source pager. */
+ if( p->pDestDb ){
+ p->pSrc->nBackup--;
+ }
+ if( p->isAttached ){
+ pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc));
+ assert( pp!=0 );
+ while( *pp!=p ){
+ pp = &(*pp)->pNext;
+ assert( pp!=0 );
+ }
+ *pp = p->pNext;
+ }
+
+ /* If a transaction is still open on the Btree, roll it back. */
+ sqlite3BtreeRollback(p->pDest, SQLITE_OK, 0);
+
+ /* Set the error code of the destination database handle. */
+ rc = (p->rc==SQLITE_DONE) ? SQLITE_OK : p->rc;
+ if( p->pDestDb ){
+ sqlite3Error(p->pDestDb, rc);
+
+ /* Exit the mutexes and free the backup context structure. */
+ sqlite3LeaveMutexAndCloseZombie(p->pDestDb);
+ }
+ sqlite3BtreeLeave(p->pSrc);
+ if( p->pDestDb ){
+ /* EVIDENCE-OF: R-64852-21591 The sqlite3_backup object is created by a
+ ** call to sqlite3_backup_init() and is destroyed by a call to
+ ** sqlite3_backup_finish(). */
+ sqlite3_free(p);
+ }
+ sqlite3LeaveMutexAndCloseZombie(pSrcDb);
+ return rc;
+}
+
+/*
+** Return the number of pages still to be backed up as of the most recent
+** call to sqlite3_backup_step().
+*/
+SQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p){
+#ifdef SQLITE_ENABLE_API_ARMOR
+ if( p==0 ){
+ (void)SQLITE_MISUSE_BKPT;
+ return 0;
+ }
+#endif
+ return p->nRemaining;
+}
+
+/*
+** Return the total number of pages in the source database as of the most
+** recent call to sqlite3_backup_step().
+*/
+SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p){
+#ifdef SQLITE_ENABLE_API_ARMOR
+ if( p==0 ){
+ (void)SQLITE_MISUSE_BKPT;
+ return 0;
+ }
+#endif
+ return p->nPagecount;
+}
+
+/*
+** This function is called after the contents of page iPage of the
+** source database have been modified. If page iPage has already been
+** copied into the destination database, then the data written to the
+** destination is now invalidated. The destination copy of iPage needs
+** to be updated with the new data before the backup operation is
+** complete.
+**
+** It is assumed that the mutex associated with the BtShared object
+** corresponding to the source database is held when this function is
+** called.
+*/
+static SQLITE_NOINLINE void backupUpdate(
+ sqlite3_backup *p,
+ Pgno iPage,
+ const u8 *aData
+){
+ assert( p!=0 );
+ do{
+ assert( sqlite3_mutex_held(p->pSrc->pBt->mutex) );
+ if( !isFatalError(p->rc) && iPage<p->iNext ){
+ /* The backup process p has already copied page iPage. But now it
+ ** has been modified by a transaction on the source pager. Copy
+ ** the new data into the backup.
+ */
+ int rc;
+ assert( p->pDestDb );
+ sqlite3_mutex_enter(p->pDestDb->mutex);
+ rc = backupOnePage(p, iPage, aData, 1);
+ sqlite3_mutex_leave(p->pDestDb->mutex);
+ assert( rc!=SQLITE_BUSY && rc!=SQLITE_LOCKED );
+ if( rc!=SQLITE_OK ){
+ p->rc = rc;
+ }
+ }
+ }while( (p = p->pNext)!=0 );
+}
+SQLITE_PRIVATE void sqlite3BackupUpdate(sqlite3_backup *pBackup, Pgno iPage, const u8 *aData){
+ if( pBackup ) backupUpdate(pBackup, iPage, aData);
+}
+
+/*
+** Restart the backup process. This is called when the pager layer
+** detects that the database has been modified by an external database
+** connection. In this case there is no way of knowing which of the
+** pages that have been copied into the destination database are still
+** valid and which are not, so the entire process needs to be restarted.
+**
+** It is assumed that the mutex associated with the BtShared object
+** corresponding to the source database is held when this function is
+** called.
+*/
+SQLITE_PRIVATE void sqlite3BackupRestart(sqlite3_backup *pBackup){
+ sqlite3_backup *p; /* Iterator variable */
+ for(p=pBackup; p; p=p->pNext){
+ assert( sqlite3_mutex_held(p->pSrc->pBt->mutex) );
+ p->iNext = 1;
+ }
+}
+
+#ifndef SQLITE_OMIT_VACUUM
+/*
+** Copy the complete content of pBtFrom into pBtTo. A transaction
+** must be active for both files.
+**
+** The size of file pTo may be reduced by this operation. If anything
+** goes wrong, the transaction on pTo is rolled back. If successful, the
+** transaction is committed before returning.
+*/
+SQLITE_PRIVATE int sqlite3BtreeCopyFile(Btree *pTo, Btree *pFrom){
+ int rc;
+ sqlite3_file *pFd; /* File descriptor for database pTo */
+ sqlite3_backup b;
+ sqlite3BtreeEnter(pTo);
+ sqlite3BtreeEnter(pFrom);
+
+ assert( sqlite3BtreeTxnState(pTo)==SQLITE_TXN_WRITE );
+ pFd = sqlite3PagerFile(sqlite3BtreePager(pTo));
+ if( pFd->pMethods ){
+ i64 nByte = sqlite3BtreeGetPageSize(pFrom)*(i64)sqlite3BtreeLastPage(pFrom);
+ rc = sqlite3OsFileControl(pFd, SQLITE_FCNTL_OVERWRITE, &nByte);
+ if( rc==SQLITE_NOTFOUND ) rc = SQLITE_OK;
+ if( rc ) goto copy_finished;
+ }
+
+ /* Set up an sqlite3_backup object. sqlite3_backup.pDestDb must be set
+ ** to 0. This is used by the implementations of sqlite3_backup_step()
+ ** and sqlite3_backup_finish() to detect that they are being called
+ ** from this function, not directly by the user.
+ */
+ memset(&b, 0, sizeof(b));
+ b.pSrcDb = pFrom->db;
+ b.pSrc = pFrom;
+ b.pDest = pTo;
+ b.iNext = 1;
+
+ /* 0x7FFFFFFF is the hard limit for the number of pages in a database
+ ** file. By passing this as the number of pages to copy to
+ ** sqlite3_backup_step(), we can guarantee that the copy finishes
+ ** within a single call (unless an error occurs). The assert() statement
+ ** checks this assumption - (p->rc) should be set to either SQLITE_DONE
+ ** or an error code. */
+ sqlite3_backup_step(&b, 0x7FFFFFFF);
+ assert( b.rc!=SQLITE_OK );
+
+ rc = sqlite3_backup_finish(&b);
+ if( rc==SQLITE_OK ){
+ pTo->pBt->btsFlags &= ~BTS_PAGESIZE_FIXED;
+ }else{
+ sqlite3PagerClearCache(sqlite3BtreePager(b.pDest));
+ }
+
+ assert( sqlite3BtreeTxnState(pTo)!=SQLITE_TXN_WRITE );
+copy_finished:
+ sqlite3BtreeLeave(pFrom);
+ sqlite3BtreeLeave(pTo);
+ return rc;
+}
+#endif /* SQLITE_OMIT_VACUUM */
+
+/************** End of backup.c **********************************************/
+/************** Begin file vdbemem.c *****************************************/
+/*
+** 2004 May 26
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+**
+** This file contains code use to manipulate "Mem" structure. A "Mem"
+** stores a single value in the VDBE. Mem is an opaque structure visible
+** only within the VDBE. Interface routines refer to a Mem using the
+** name sqlite_value
+*/
+/* #include "sqliteInt.h" */
+/* #include "vdbeInt.h" */
+
+/* True if X is a power of two. 0 is considered a power of two here.
+** In other words, return true if X has at most one bit set.
+*/
+#define ISPOWEROF2(X) (((X)&((X)-1))==0)
+
+#ifdef SQLITE_DEBUG
+/*
+** Check invariants on a Mem object.
+**
+** This routine is intended for use inside of assert() statements, like
+** this: assert( sqlite3VdbeCheckMemInvariants(pMem) );
+*/
+SQLITE_PRIVATE int sqlite3VdbeCheckMemInvariants(Mem *p){
+ /* If MEM_Dyn is set then Mem.xDel!=0.
+ ** Mem.xDel might not be initialized if MEM_Dyn is clear.
+ */
+ assert( (p->flags & MEM_Dyn)==0 || p->xDel!=0 );
+
+ /* MEM_Dyn may only be set if Mem.szMalloc==0. In this way we
+ ** ensure that if Mem.szMalloc>0 then it is safe to do
+ ** Mem.z = Mem.zMalloc without having to check Mem.flags&MEM_Dyn.
+ ** That saves a few cycles in inner loops. */
+ assert( (p->flags & MEM_Dyn)==0 || p->szMalloc==0 );
+
+ /* Cannot have more than one of MEM_Int, MEM_Real, or MEM_IntReal */
+ assert( ISPOWEROF2(p->flags & (MEM_Int|MEM_Real|MEM_IntReal)) );
+
+ if( p->flags & MEM_Null ){
+ /* Cannot be both MEM_Null and some other type */
+ assert( (p->flags & (MEM_Int|MEM_Real|MEM_Str|MEM_Blob|MEM_Agg))==0 );
+
+ /* If MEM_Null is set, then either the value is a pure NULL (the usual
+ ** case) or it is a pointer set using sqlite3_bind_pointer() or
+ ** sqlite3_result_pointer(). If a pointer, then MEM_Term must also be
+ ** set.
+ */
+ if( (p->flags & (MEM_Term|MEM_Subtype))==(MEM_Term|MEM_Subtype) ){
+ /* This is a pointer type. There may be a flag to indicate what to
+ ** do with the pointer. */
+ assert( ((p->flags&MEM_Dyn)!=0 ? 1 : 0) +
+ ((p->flags&MEM_Ephem)!=0 ? 1 : 0) +
+ ((p->flags&MEM_Static)!=0 ? 1 : 0) <= 1 );
+
+ /* No other bits set */
+ assert( (p->flags & ~(MEM_Null|MEM_Term|MEM_Subtype|MEM_FromBind
+ |MEM_Dyn|MEM_Ephem|MEM_Static))==0 );
+ }else{
+ /* A pure NULL might have other flags, such as MEM_Static, MEM_Dyn,
+ ** MEM_Ephem, MEM_Cleared, or MEM_Subtype */
+ }
+ }else{
+ /* The MEM_Cleared bit is only allowed on NULLs */
+ assert( (p->flags & MEM_Cleared)==0 );
+ }
+
+ /* The szMalloc field holds the correct memory allocation size */
+ assert( p->szMalloc==0
+ || (p->flags==MEM_Undefined
+ && p->szMalloc<=sqlite3DbMallocSize(p->db,p->zMalloc))
+ || p->szMalloc==sqlite3DbMallocSize(p->db,p->zMalloc));
+
+ /* If p holds a string or blob, the Mem.z must point to exactly
+ ** one of the following:
+ **
+ ** (1) Memory in Mem.zMalloc and managed by the Mem object
+ ** (2) Memory to be freed using Mem.xDel
+ ** (3) An ephemeral string or blob
+ ** (4) A static string or blob
+ */
+ if( (p->flags & (MEM_Str|MEM_Blob)) && p->n>0 ){
+ assert(
+ ((p->szMalloc>0 && p->z==p->zMalloc)? 1 : 0) +
+ ((p->flags&MEM_Dyn)!=0 ? 1 : 0) +
+ ((p->flags&MEM_Ephem)!=0 ? 1 : 0) +
+ ((p->flags&MEM_Static)!=0 ? 1 : 0) == 1
+ );
+ }
+ return 1;
+}
+#endif
+
+/*
+** Render a Mem object which is one of MEM_Int, MEM_Real, or MEM_IntReal
+** into a buffer.
+*/
+static void vdbeMemRenderNum(int sz, char *zBuf, Mem *p){
+ StrAccum acc;
+ assert( p->flags & (MEM_Int|MEM_Real|MEM_IntReal) );
+ assert( sz>22 );
+ if( p->flags & MEM_Int ){
+#if GCC_VERSION>=7000000
+ /* Work-around for GCC bug
+ ** https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96270 */
+ i64 x;
+ assert( (p->flags&MEM_Int)*2==sizeof(x) );
+ memcpy(&x, (char*)&p->u, (p->flags&MEM_Int)*2);
+ p->n = sqlite3Int64ToText(x, zBuf);
+#else
+ p->n = sqlite3Int64ToText(p->u.i, zBuf);
+#endif
+ }else{
+ sqlite3StrAccumInit(&acc, 0, zBuf, sz, 0);
+ sqlite3_str_appendf(&acc, "%!.15g",
+ (p->flags & MEM_IntReal)!=0 ? (double)p->u.i : p->u.r);
+ assert( acc.zText==zBuf && acc.mxAlloc<=0 );
+ zBuf[acc.nChar] = 0; /* Fast version of sqlite3StrAccumFinish(&acc) */
+ p->n = acc.nChar;
+ }
+}
+
+#ifdef SQLITE_DEBUG
+/*
+** Validity checks on pMem. pMem holds a string.
+**
+** (1) Check that string value of pMem agrees with its integer or real value.
+** (2) Check that the string is correctly zero terminated
+**
+** A single int or real value always converts to the same strings. But
+** many different strings can be converted into the same int or real.
+** If a table contains a numeric value and an index is based on the
+** corresponding string value, then it is important that the string be
+** derived from the numeric value, not the other way around, to ensure
+** that the index and table are consistent. See ticket
+** https://www.sqlite.org/src/info/343634942dd54ab (2018-01-31) for
+** an example.
+**
+** This routine looks at pMem to verify that if it has both a numeric
+** representation and a string representation then the string rep has
+** been derived from the numeric and not the other way around. It returns
+** true if everything is ok and false if there is a problem.
+**
+** This routine is for use inside of assert() statements only.
+*/
+SQLITE_PRIVATE int sqlite3VdbeMemValidStrRep(Mem *p){
+ Mem tmp;
+ char zBuf[100];
+ char *z;
+ int i, j, incr;
+ if( (p->flags & MEM_Str)==0 ) return 1;
+ if( p->db && p->db->mallocFailed ) return 1;
+ if( p->flags & MEM_Term ){
+ /* Insure that the string is properly zero-terminated. Pay particular
+ ** attention to the case where p->n is odd */
+ if( p->szMalloc>0 && p->z==p->zMalloc ){
+ assert( p->enc==SQLITE_UTF8 || p->szMalloc >= ((p->n+1)&~1)+2 );
+ assert( p->enc!=SQLITE_UTF8 || p->szMalloc >= p->n+1 );
+ }
+ assert( p->z[p->n]==0 );
+ assert( p->enc==SQLITE_UTF8 || p->z[(p->n+1)&~1]==0 );
+ assert( p->enc==SQLITE_UTF8 || p->z[((p->n+1)&~1)+1]==0 );
+ }
+ if( (p->flags & (MEM_Int|MEM_Real|MEM_IntReal))==0 ) return 1;
+ memcpy(&tmp, p, sizeof(tmp));
+ vdbeMemRenderNum(sizeof(zBuf), zBuf, &tmp);
+ z = p->z;
+ i = j = 0;
+ incr = 1;
+ if( p->enc!=SQLITE_UTF8 ){
+ incr = 2;
+ if( p->enc==SQLITE_UTF16BE ) z++;
+ }
+ while( zBuf[j] ){
+ if( zBuf[j++]!=z[i] ) return 0;
+ i += incr;
+ }
+ return 1;
+}
+#endif /* SQLITE_DEBUG */
+
+/*
+** If pMem is an object with a valid string representation, this routine
+** ensures the internal encoding for the string representation is
+** 'desiredEnc', one of SQLITE_UTF8, SQLITE_UTF16LE or SQLITE_UTF16BE.
+**
+** If pMem is not a string object, or the encoding of the string
+** representation is already stored using the requested encoding, then this
+** routine is a no-op.
+**
+** SQLITE_OK is returned if the conversion is successful (or not required).
+** SQLITE_NOMEM may be returned if a malloc() fails during conversion
+** between formats.
+*/
+SQLITE_PRIVATE int sqlite3VdbeChangeEncoding(Mem *pMem, int desiredEnc){
+#ifndef SQLITE_OMIT_UTF16
+ int rc;
+#endif
+ assert( pMem!=0 );
+ assert( !sqlite3VdbeMemIsRowSet(pMem) );
+ assert( desiredEnc==SQLITE_UTF8 || desiredEnc==SQLITE_UTF16LE
+ || desiredEnc==SQLITE_UTF16BE );
+ if( !(pMem->flags&MEM_Str) ){
+ pMem->enc = desiredEnc;
+ return SQLITE_OK;
+ }
+ if( pMem->enc==desiredEnc ){
+ return SQLITE_OK;
+ }
+ assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
+#ifdef SQLITE_OMIT_UTF16
+ return SQLITE_ERROR;
+#else
+
+ /* MemTranslate() may return SQLITE_OK or SQLITE_NOMEM. If NOMEM is returned,
+ ** then the encoding of the value may not have changed.
+ */
+ rc = sqlite3VdbeMemTranslate(pMem, (u8)desiredEnc);
+ assert(rc==SQLITE_OK || rc==SQLITE_NOMEM);
+ assert(rc==SQLITE_OK || pMem->enc!=desiredEnc);
+ assert(rc==SQLITE_NOMEM || pMem->enc==desiredEnc);
+ return rc;
+#endif
+}
+
+/*
+** Make sure pMem->z points to a writable allocation of at least n bytes.
+**
+** If the bPreserve argument is true, then copy of the content of
+** pMem->z into the new allocation. pMem must be either a string or
+** blob if bPreserve is true. If bPreserve is false, any prior content
+** in pMem->z is discarded.
+*/
+SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3VdbeMemGrow(Mem *pMem, int n, int bPreserve){
+ assert( sqlite3VdbeCheckMemInvariants(pMem) );
+ assert( !sqlite3VdbeMemIsRowSet(pMem) );
+ testcase( pMem->db==0 );
+
+ /* If the bPreserve flag is set to true, then the memory cell must already
+ ** contain a valid string or blob value. */
+ assert( bPreserve==0 || pMem->flags&(MEM_Blob|MEM_Str) );
+ testcase( bPreserve && pMem->z==0 );
+
+ assert( pMem->szMalloc==0
+ || (pMem->flags==MEM_Undefined
+ && pMem->szMalloc<=sqlite3DbMallocSize(pMem->db,pMem->zMalloc))
+ || pMem->szMalloc==sqlite3DbMallocSize(pMem->db,pMem->zMalloc));
+ if( pMem->szMalloc>0 && bPreserve && pMem->z==pMem->zMalloc ){
+ if( pMem->db ){
+ pMem->z = pMem->zMalloc = sqlite3DbReallocOrFree(pMem->db, pMem->z, n);
+ }else{
+ pMem->zMalloc = sqlite3Realloc(pMem->z, n);
+ if( pMem->zMalloc==0 ) sqlite3_free(pMem->z);
+ pMem->z = pMem->zMalloc;
+ }
+ bPreserve = 0;
+ }else{
+ if( pMem->szMalloc>0 ) sqlite3DbFreeNN(pMem->db, pMem->zMalloc);
+ pMem->zMalloc = sqlite3DbMallocRaw(pMem->db, n);
+ }
+ if( pMem->zMalloc==0 ){
+ sqlite3VdbeMemSetNull(pMem);
+ pMem->z = 0;
+ pMem->szMalloc = 0;
+ return SQLITE_NOMEM_BKPT;
+ }else{
+ pMem->szMalloc = sqlite3DbMallocSize(pMem->db, pMem->zMalloc);
+ }
+
+ if( bPreserve && pMem->z ){
+ assert( pMem->z!=pMem->zMalloc );
+ memcpy(pMem->zMalloc, pMem->z, pMem->n);
+ }
+ if( (pMem->flags&MEM_Dyn)!=0 ){
+ assert( pMem->xDel!=0 && pMem->xDel!=SQLITE_DYNAMIC );
+ pMem->xDel((void *)(pMem->z));
+ }
+
+ pMem->z = pMem->zMalloc;
+ pMem->flags &= ~(MEM_Dyn|MEM_Ephem|MEM_Static);
+ return SQLITE_OK;
+}
+
+/*
+** Change the pMem->zMalloc allocation to be at least szNew bytes.
+** If pMem->zMalloc already meets or exceeds the requested size, this
+** routine is a no-op.
+**
+** Any prior string or blob content in the pMem object may be discarded.
+** The pMem->xDel destructor is called, if it exists. Though MEM_Str
+** and MEM_Blob values may be discarded, MEM_Int, MEM_Real, MEM_IntReal,
+** and MEM_Null values are preserved.
+**
+** Return SQLITE_OK on success or an error code (probably SQLITE_NOMEM)
+** if unable to complete the resizing.
+*/
+SQLITE_PRIVATE int sqlite3VdbeMemClearAndResize(Mem *pMem, int szNew){
+ assert( CORRUPT_DB || szNew>0 );
+ assert( (pMem->flags & MEM_Dyn)==0 || pMem->szMalloc==0 );
+ if( pMem->szMalloc<szNew ){
+ return sqlite3VdbeMemGrow(pMem, szNew, 0);
+ }
+ assert( (pMem->flags & MEM_Dyn)==0 );
+ pMem->z = pMem->zMalloc;
+ pMem->flags &= (MEM_Null|MEM_Int|MEM_Real|MEM_IntReal);
+ return SQLITE_OK;
+}
+
+/*
+** If pMem is already a string, detect if it is a zero-terminated
+** string, or make it into one if possible, and mark it as such.
+**
+** This is an optimization. Correct operation continues even if
+** this routine is a no-op.
+*/
+SQLITE_PRIVATE void sqlite3VdbeMemZeroTerminateIfAble(Mem *pMem){
+ if( (pMem->flags & (MEM_Str|MEM_Term|MEM_Ephem|MEM_Static))!=MEM_Str ){
+ /* pMem must be a string, and it cannot be an ephemeral or static string */
+ return;
+ }
+ if( pMem->enc!=SQLITE_UTF8 ) return;
+ if( NEVER(pMem->z==0) ) return;
+ if( pMem->flags & MEM_Dyn ){
+ if( pMem->xDel==sqlite3_free
+ && sqlite3_msize(pMem->z) >= (u64)(pMem->n+1)
+ ){
+ pMem->z[pMem->n] = 0;
+ pMem->flags |= MEM_Term;
+ return;
+ }
+ if( pMem->xDel==sqlite3RCStrUnref ){
+ /* Blindly assume that all RCStr objects are zero-terminated */
+ pMem->flags |= MEM_Term;
+ return;
+ }
+ }else if( pMem->szMalloc >= pMem->n+1 ){
+ pMem->z[pMem->n] = 0;
+ pMem->flags |= MEM_Term;
+ return;
+ }
+}
+
+/*
+** It is already known that pMem contains an unterminated string.
+** Add the zero terminator.
+**
+** Three bytes of zero are added. In this way, there is guaranteed
+** to be a double-zero byte at an even byte boundary in order to
+** terminate a UTF16 string, even if the initial size of the buffer
+** is an odd number of bytes.
+*/
+static SQLITE_NOINLINE int vdbeMemAddTerminator(Mem *pMem){
+ if( sqlite3VdbeMemGrow(pMem, pMem->n+3, 1) ){
+ return SQLITE_NOMEM_BKPT;
+ }
+ pMem->z[pMem->n] = 0;
+ pMem->z[pMem->n+1] = 0;
+ pMem->z[pMem->n+2] = 0;
+ pMem->flags |= MEM_Term;
+ return SQLITE_OK;
+}
+
+/*
+** Change pMem so that its MEM_Str or MEM_Blob value is stored in
+** MEM.zMalloc, where it can be safely written.
+**
+** Return SQLITE_OK on success or SQLITE_NOMEM if malloc fails.
+*/
+SQLITE_PRIVATE int sqlite3VdbeMemMakeWriteable(Mem *pMem){
+ assert( pMem!=0 );
+ assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
+ assert( !sqlite3VdbeMemIsRowSet(pMem) );
+ if( (pMem->flags & (MEM_Str|MEM_Blob))!=0 ){
+ if( ExpandBlob(pMem) ) return SQLITE_NOMEM;
+ if( pMem->szMalloc==0 || pMem->z!=pMem->zMalloc ){
+ int rc = vdbeMemAddTerminator(pMem);
+ if( rc ) return rc;
+ }
+ }
+ pMem->flags &= ~MEM_Ephem;
+#ifdef SQLITE_DEBUG
+ pMem->pScopyFrom = 0;
+#endif
+
+ return SQLITE_OK;
+}
+
+/*
+** If the given Mem* has a zero-filled tail, turn it into an ordinary
+** blob stored in dynamically allocated space.
+*/
+#ifndef SQLITE_OMIT_INCRBLOB
+SQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *pMem){
+ int nByte;
+ assert( pMem!=0 );
+ assert( pMem->flags & MEM_Zero );
+ assert( (pMem->flags&MEM_Blob)!=0 || MemNullNochng(pMem) );
+ testcase( sqlite3_value_nochange(pMem) );
+ assert( !sqlite3VdbeMemIsRowSet(pMem) );
+ assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
+
+ /* Set nByte to the number of bytes required to store the expanded blob. */
+ nByte = pMem->n + pMem->u.nZero;
+ if( nByte<=0 ){
+ if( (pMem->flags & MEM_Blob)==0 ) return SQLITE_OK;
+ nByte = 1;
+ }
+ if( sqlite3VdbeMemGrow(pMem, nByte, 1) ){
+ return SQLITE_NOMEM_BKPT;
+ }
+ assert( pMem->z!=0 );
+ assert( sqlite3DbMallocSize(pMem->db,pMem->z) >= nByte );
+
+ memset(&pMem->z[pMem->n], 0, pMem->u.nZero);
+ pMem->n += pMem->u.nZero;
+ pMem->flags &= ~(MEM_Zero|MEM_Term);
+ return SQLITE_OK;
+}
+#endif
+
+/*
+** Make sure the given Mem is \u0000 terminated.
+*/
+SQLITE_PRIVATE int sqlite3VdbeMemNulTerminate(Mem *pMem){
+ assert( pMem!=0 );
+ assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
+ testcase( (pMem->flags & (MEM_Term|MEM_Str))==(MEM_Term|MEM_Str) );
+ testcase( (pMem->flags & (MEM_Term|MEM_Str))==0 );
+ if( (pMem->flags & (MEM_Term|MEM_Str))!=MEM_Str ){
+ return SQLITE_OK; /* Nothing to do */
+ }else{
+ return vdbeMemAddTerminator(pMem);
+ }
+}
+
+/*
+** Add MEM_Str to the set of representations for the given Mem. This
+** routine is only called if pMem is a number of some kind, not a NULL
+** or a BLOB.
+**
+** Existing representations MEM_Int, MEM_Real, or MEM_IntReal are invalidated
+** if bForce is true but are retained if bForce is false.
+**
+** A MEM_Null value will never be passed to this function. This function is
+** used for converting values to text for returning to the user (i.e. via
+** sqlite3_value_text()), or for ensuring that values to be used as btree
+** keys are strings. In the former case a NULL pointer is returned the
+** user and the latter is an internal programming error.
+*/
+SQLITE_PRIVATE int sqlite3VdbeMemStringify(Mem *pMem, u8 enc, u8 bForce){
+ const int nByte = 32;
+
+ assert( pMem!=0 );
+ assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
+ assert( !(pMem->flags&MEM_Zero) );
+ assert( !(pMem->flags&(MEM_Str|MEM_Blob)) );
+ assert( pMem->flags&(MEM_Int|MEM_Real|MEM_IntReal) );
+ assert( !sqlite3VdbeMemIsRowSet(pMem) );
+ assert( EIGHT_BYTE_ALIGNMENT(pMem) );
+
+
+ if( sqlite3VdbeMemClearAndResize(pMem, nByte) ){
+ pMem->enc = 0;
+ return SQLITE_NOMEM_BKPT;
+ }
+
+ vdbeMemRenderNum(nByte, pMem->z, pMem);
+ assert( pMem->z!=0 );
+ assert( pMem->n==(int)sqlite3Strlen30NN(pMem->z) );
+ pMem->enc = SQLITE_UTF8;
+ pMem->flags |= MEM_Str|MEM_Term;
+ if( bForce ) pMem->flags &= ~(MEM_Int|MEM_Real|MEM_IntReal);
+ sqlite3VdbeChangeEncoding(pMem, enc);
+ return SQLITE_OK;
+}
+
+/*
+** Memory cell pMem contains the context of an aggregate function.
+** This routine calls the finalize method for that function. The
+** result of the aggregate is stored back into pMem.
+**
+** Return SQLITE_ERROR if the finalizer reports an error. SQLITE_OK
+** otherwise.
+*/
+SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem *pMem, FuncDef *pFunc){
+ sqlite3_context ctx;
+ Mem t;
+ assert( pFunc!=0 );
+ assert( pMem!=0 );
+ assert( pMem->db!=0 );
+ assert( pFunc->xFinalize!=0 );
+ assert( (pMem->flags & MEM_Null)!=0 || pFunc==pMem->u.pDef );
+ assert( sqlite3_mutex_held(pMem->db->mutex) );
+ memset(&ctx, 0, sizeof(ctx));
+ memset(&t, 0, sizeof(t));
+ t.flags = MEM_Null;
+ t.db = pMem->db;
+ ctx.pOut = &t;
+ ctx.pMem = pMem;
+ ctx.pFunc = pFunc;
+ ctx.enc = ENC(t.db);
+ pFunc->xFinalize(&ctx); /* IMP: R-24505-23230 */
+ assert( (pMem->flags & MEM_Dyn)==0 );
+ if( pMem->szMalloc>0 ) sqlite3DbFreeNN(pMem->db, pMem->zMalloc);
+ memcpy(pMem, &t, sizeof(t));
+ return ctx.isError;
+}
+
+/*
+** Memory cell pAccum contains the context of an aggregate function.
+** This routine calls the xValue method for that function and stores
+** the results in memory cell pMem.
+**
+** SQLITE_ERROR is returned if xValue() reports an error. SQLITE_OK
+** otherwise.
+*/
+#ifndef SQLITE_OMIT_WINDOWFUNC
+SQLITE_PRIVATE int sqlite3VdbeMemAggValue(Mem *pAccum, Mem *pOut, FuncDef *pFunc){
+ sqlite3_context ctx;
+ assert( pFunc!=0 );
+ assert( pFunc->xValue!=0 );
+ assert( (pAccum->flags & MEM_Null)!=0 || pFunc==pAccum->u.pDef );
+ assert( pAccum->db!=0 );
+ assert( sqlite3_mutex_held(pAccum->db->mutex) );
+ memset(&ctx, 0, sizeof(ctx));
+ sqlite3VdbeMemSetNull(pOut);
+ ctx.pOut = pOut;
+ ctx.pMem = pAccum;
+ ctx.pFunc = pFunc;
+ ctx.enc = ENC(pAccum->db);
+ pFunc->xValue(&ctx);
+ return ctx.isError;
+}
+#endif /* SQLITE_OMIT_WINDOWFUNC */
+
+/*
+** If the memory cell contains a value that must be freed by
+** invoking the external callback in Mem.xDel, then this routine
+** will free that value. It also sets Mem.flags to MEM_Null.
+**
+** This is a helper routine for sqlite3VdbeMemSetNull() and
+** for sqlite3VdbeMemRelease(). Use those other routines as the
+** entry point for releasing Mem resources.
+*/
+static SQLITE_NOINLINE void vdbeMemClearExternAndSetNull(Mem *p){
+ assert( p->db==0 || sqlite3_mutex_held(p->db->mutex) );
+ assert( VdbeMemDynamic(p) );
+ if( p->flags&MEM_Agg ){
+ sqlite3VdbeMemFinalize(p, p->u.pDef);
+ assert( (p->flags & MEM_Agg)==0 );
+ testcase( p->flags & MEM_Dyn );
+ }
+ if( p->flags&MEM_Dyn ){
+ assert( p->xDel!=SQLITE_DYNAMIC && p->xDel!=0 );
+ p->xDel((void *)p->z);
+ }
+ p->flags = MEM_Null;
+}
+
+/*
+** Release memory held by the Mem p, both external memory cleared
+** by p->xDel and memory in p->zMalloc.
+**
+** This is a helper routine invoked by sqlite3VdbeMemRelease() in
+** the unusual case where there really is memory in p that needs
+** to be freed.
+*/
+static SQLITE_NOINLINE void vdbeMemClear(Mem *p){
+ if( VdbeMemDynamic(p) ){
+ vdbeMemClearExternAndSetNull(p);
+ }
+ if( p->szMalloc ){
+ sqlite3DbFreeNN(p->db, p->zMalloc);
+ p->szMalloc = 0;
+ }
+ p->z = 0;
+}
+
+/*
+** Release any memory resources held by the Mem. Both the memory that is
+** free by Mem.xDel and the Mem.zMalloc allocation are freed.
+**
+** Use this routine prior to clean up prior to abandoning a Mem, or to
+** reset a Mem back to its minimum memory utilization.
+**
+** Use sqlite3VdbeMemSetNull() to release just the Mem.xDel space
+** prior to inserting new content into the Mem.
+*/
+SQLITE_PRIVATE void sqlite3VdbeMemRelease(Mem *p){
+ assert( sqlite3VdbeCheckMemInvariants(p) );
+ if( VdbeMemDynamic(p) || p->szMalloc ){
+ vdbeMemClear(p);
+ }
+}
+
+/* Like sqlite3VdbeMemRelease() but faster for cases where we
+** know in advance that the Mem is not MEM_Dyn or MEM_Agg.
+*/
+SQLITE_PRIVATE void sqlite3VdbeMemReleaseMalloc(Mem *p){
+ assert( !VdbeMemDynamic(p) );
+ if( p->szMalloc ) vdbeMemClear(p);
+}
+
+/*
+** Return some kind of integer value which is the best we can do
+** at representing the value that *pMem describes as an integer.
+** If pMem is an integer, then the value is exact. If pMem is
+** a floating-point then the value returned is the integer part.
+** If pMem is a string or blob, then we make an attempt to convert
+** it into an integer and return that. If pMem represents an
+** an SQL-NULL value, return 0.
+**
+** If pMem represents a string value, its encoding might be changed.
+*/
+static SQLITE_NOINLINE i64 memIntValue(const Mem *pMem){
+ i64 value = 0;
+ sqlite3Atoi64(pMem->z, &value, pMem->n, pMem->enc);
+ return value;
+}
+SQLITE_PRIVATE i64 sqlite3VdbeIntValue(const Mem *pMem){
+ int flags;
+ assert( pMem!=0 );
+ assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
+ assert( EIGHT_BYTE_ALIGNMENT(pMem) );
+ flags = pMem->flags;
+ if( flags & (MEM_Int|MEM_IntReal) ){
+ testcase( flags & MEM_IntReal );
+ return pMem->u.i;
+ }else if( flags & MEM_Real ){
+ return sqlite3RealToI64(pMem->u.r);
+ }else if( (flags & (MEM_Str|MEM_Blob))!=0 && pMem->z!=0 ){
+ return memIntValue(pMem);
+ }else{
+ return 0;
+ }
+}
+
+/*
+** Return the best representation of pMem that we can get into a
+** double. If pMem is already a double or an integer, return its
+** value. If it is a string or blob, try to convert it to a double.
+** If it is a NULL, return 0.0.
+*/
+static SQLITE_NOINLINE double memRealValue(Mem *pMem){
+ /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */
+ double val = (double)0;
+ sqlite3AtoF(pMem->z, &val, pMem->n, pMem->enc);
+ return val;
+}
+SQLITE_PRIVATE double sqlite3VdbeRealValue(Mem *pMem){
+ assert( pMem!=0 );
+ assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
+ assert( EIGHT_BYTE_ALIGNMENT(pMem) );
+ if( pMem->flags & MEM_Real ){
+ return pMem->u.r;
+ }else if( pMem->flags & (MEM_Int|MEM_IntReal) ){
+ testcase( pMem->flags & MEM_IntReal );
+ return (double)pMem->u.i;
+ }else if( pMem->flags & (MEM_Str|MEM_Blob) ){
+ return memRealValue(pMem);
+ }else{
+ /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */
+ return (double)0;
+ }
+}
+
+/*
+** Return 1 if pMem represents true, and return 0 if pMem represents false.
+** Return the value ifNull if pMem is NULL.
+*/
+SQLITE_PRIVATE int sqlite3VdbeBooleanValue(Mem *pMem, int ifNull){
+ testcase( pMem->flags & MEM_IntReal );
+ if( pMem->flags & (MEM_Int|MEM_IntReal) ) return pMem->u.i!=0;
+ if( pMem->flags & MEM_Null ) return ifNull;
+ return sqlite3VdbeRealValue(pMem)!=0.0;
+}
+
+/*
+** The MEM structure is already a MEM_Real or MEM_IntReal. Try to
+** make it a MEM_Int if we can.
+*/
+SQLITE_PRIVATE void sqlite3VdbeIntegerAffinity(Mem *pMem){
+ assert( pMem!=0 );
+ assert( pMem->flags & (MEM_Real|MEM_IntReal) );
+ assert( !sqlite3VdbeMemIsRowSet(pMem) );
+ assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
+ assert( EIGHT_BYTE_ALIGNMENT(pMem) );
+
+ if( pMem->flags & MEM_IntReal ){
+ MemSetTypeFlag(pMem, MEM_Int);
+ }else{
+ i64 ix = sqlite3RealToI64(pMem->u.r);
+
+ /* Only mark the value as an integer if
+ **
+ ** (1) the round-trip conversion real->int->real is a no-op, and
+ ** (2) The integer is neither the largest nor the smallest
+ ** possible integer (ticket #3922)
+ **
+ ** The second and third terms in the following conditional enforces
+ ** the second condition under the assumption that addition overflow causes
+ ** values to wrap around.
+ */
+ if( pMem->u.r==ix && ix>SMALLEST_INT64 && ix<LARGEST_INT64 ){
+ pMem->u.i = ix;
+ MemSetTypeFlag(pMem, MEM_Int);
+ }
+ }
+}
+
+/*
+** Convert pMem to type integer. Invalidate any prior representations.
+*/
+SQLITE_PRIVATE int sqlite3VdbeMemIntegerify(Mem *pMem){
+ assert( pMem!=0 );
+ assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
+ assert( !sqlite3VdbeMemIsRowSet(pMem) );
+ assert( EIGHT_BYTE_ALIGNMENT(pMem) );
+
+ pMem->u.i = sqlite3VdbeIntValue(pMem);
+ MemSetTypeFlag(pMem, MEM_Int);
+ return SQLITE_OK;
+}
+
+/*
+** Convert pMem so that it is of type MEM_Real.
+** Invalidate any prior representations.
+*/
+SQLITE_PRIVATE int sqlite3VdbeMemRealify(Mem *pMem){
+ assert( pMem!=0 );
+ assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
+ assert( EIGHT_BYTE_ALIGNMENT(pMem) );
+
+ pMem->u.r = sqlite3VdbeRealValue(pMem);
+ MemSetTypeFlag(pMem, MEM_Real);
+ return SQLITE_OK;
+}
+
+/* Compare a floating point value to an integer. Return true if the two
+** values are the same within the precision of the floating point value.
+**
+** This function assumes that i was obtained by assignment from r1.
+**
+** For some versions of GCC on 32-bit machines, if you do the more obvious
+** comparison of "r1==(double)i" you sometimes get an answer of false even
+** though the r1 and (double)i values are bit-for-bit the same.
+*/
+SQLITE_PRIVATE int sqlite3RealSameAsInt(double r1, sqlite3_int64 i){
+ double r2 = (double)i;
+ return r1==0.0
+ || (memcmp(&r1, &r2, sizeof(r1))==0
+ && i >= -2251799813685248LL && i < 2251799813685248LL);
+}
+
+/* Convert a floating point value to its closest integer. Do so in
+** a way that avoids 'outside the range of representable values' warnings
+** from UBSAN.
+*/
+SQLITE_PRIVATE i64 sqlite3RealToI64(double r){
+ if( r<-9223372036854774784.0 ) return SMALLEST_INT64;
+ if( r>+9223372036854774784.0 ) return LARGEST_INT64;
+ return (i64)r;
+}
+
+/*
+** Convert pMem so that it has type MEM_Real or MEM_Int.
+** Invalidate any prior representations.
+**
+** Every effort is made to force the conversion, even if the input
+** is a string that does not look completely like a number. Convert
+** as much of the string as we can and ignore the rest.
+*/
+SQLITE_PRIVATE int sqlite3VdbeMemNumerify(Mem *pMem){
+ assert( pMem!=0 );
+ testcase( pMem->flags & MEM_Int );
+ testcase( pMem->flags & MEM_Real );
+ testcase( pMem->flags & MEM_IntReal );
+ testcase( pMem->flags & MEM_Null );
+ if( (pMem->flags & (MEM_Int|MEM_Real|MEM_IntReal|MEM_Null))==0 ){
+ int rc;
+ sqlite3_int64 ix;
+ assert( (pMem->flags & (MEM_Blob|MEM_Str))!=0 );
+ assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
+ rc = sqlite3AtoF(pMem->z, &pMem->u.r, pMem->n, pMem->enc);
+ if( ((rc==0 || rc==1) && sqlite3Atoi64(pMem->z, &ix, pMem->n, pMem->enc)<=1)
+ || sqlite3RealSameAsInt(pMem->u.r, (ix = sqlite3RealToI64(pMem->u.r)))
+ ){
+ pMem->u.i = ix;
+ MemSetTypeFlag(pMem, MEM_Int);
+ }else{
+ MemSetTypeFlag(pMem, MEM_Real);
+ }
+ }
+ assert( (pMem->flags & (MEM_Int|MEM_Real|MEM_IntReal|MEM_Null))!=0 );
+ pMem->flags &= ~(MEM_Str|MEM_Blob|MEM_Zero);
+ return SQLITE_OK;
+}
+
+/*
+** Cast the datatype of the value in pMem according to the affinity
+** "aff". Casting is different from applying affinity in that a cast
+** is forced. In other words, the value is converted into the desired
+** affinity even if that results in loss of data. This routine is
+** used (for example) to implement the SQL "cast()" operator.
+*/
+SQLITE_PRIVATE int sqlite3VdbeMemCast(Mem *pMem, u8 aff, u8 encoding){
+ if( pMem->flags & MEM_Null ) return SQLITE_OK;
+ switch( aff ){
+ case SQLITE_AFF_BLOB: { /* Really a cast to BLOB */
+ if( (pMem->flags & MEM_Blob)==0 ){
+ sqlite3ValueApplyAffinity(pMem, SQLITE_AFF_TEXT, encoding);
+ assert( pMem->flags & MEM_Str || pMem->db->mallocFailed );
+ if( pMem->flags & MEM_Str ) MemSetTypeFlag(pMem, MEM_Blob);
+ }else{
+ pMem->flags &= ~(MEM_TypeMask&~MEM_Blob);
+ }
+ break;
+ }
+ case SQLITE_AFF_NUMERIC: {
+ sqlite3VdbeMemNumerify(pMem);
+ break;
+ }
+ case SQLITE_AFF_INTEGER: {
+ sqlite3VdbeMemIntegerify(pMem);
+ break;
+ }
+ case SQLITE_AFF_REAL: {
+ sqlite3VdbeMemRealify(pMem);
+ break;
+ }
+ default: {
+ int rc;
+ assert( aff==SQLITE_AFF_TEXT );
+ assert( MEM_Str==(MEM_Blob>>3) );
+ pMem->flags |= (pMem->flags&MEM_Blob)>>3;
+ sqlite3ValueApplyAffinity(pMem, SQLITE_AFF_TEXT, encoding);
+ assert( pMem->flags & MEM_Str || pMem->db->mallocFailed );
+ pMem->flags &= ~(MEM_Int|MEM_Real|MEM_IntReal|MEM_Blob|MEM_Zero);
+ if( encoding!=SQLITE_UTF8 ) pMem->n &= ~1;
+ rc = sqlite3VdbeChangeEncoding(pMem, encoding);
+ if( rc ) return rc;
+ sqlite3VdbeMemZeroTerminateIfAble(pMem);
+ }
+ }
+ return SQLITE_OK;
+}
+
+/*
+** Initialize bulk memory to be a consistent Mem object.
+**
+** The minimum amount of initialization feasible is performed.
+*/
+SQLITE_PRIVATE void sqlite3VdbeMemInit(Mem *pMem, sqlite3 *db, u16 flags){
+ assert( (flags & ~MEM_TypeMask)==0 );
+ pMem->flags = flags;
+ pMem->db = db;
+ pMem->szMalloc = 0;
+}
+
+
+/*
+** Delete any previous value and set the value stored in *pMem to NULL.
+**
+** This routine calls the Mem.xDel destructor to dispose of values that
+** require the destructor. But it preserves the Mem.zMalloc memory allocation.
+** To free all resources, use sqlite3VdbeMemRelease(), which both calls this
+** routine to invoke the destructor and deallocates Mem.zMalloc.
+**
+** Use this routine to reset the Mem prior to insert a new value.
+**
+** Use sqlite3VdbeMemRelease() to complete erase the Mem prior to abandoning it.
+*/
+SQLITE_PRIVATE void sqlite3VdbeMemSetNull(Mem *pMem){
+ if( VdbeMemDynamic(pMem) ){
+ vdbeMemClearExternAndSetNull(pMem);
+ }else{
+ pMem->flags = MEM_Null;
+ }
+}
+SQLITE_PRIVATE void sqlite3ValueSetNull(sqlite3_value *p){
+ sqlite3VdbeMemSetNull((Mem*)p);
+}
+
+/*
+** Delete any previous value and set the value to be a BLOB of length
+** n containing all zeros.
+*/
+#ifndef SQLITE_OMIT_INCRBLOB
+SQLITE_PRIVATE void sqlite3VdbeMemSetZeroBlob(Mem *pMem, int n){
+ sqlite3VdbeMemRelease(pMem);
+ pMem->flags = MEM_Blob|MEM_Zero;
+ pMem->n = 0;
+ if( n<0 ) n = 0;
+ pMem->u.nZero = n;
+ pMem->enc = SQLITE_UTF8;
+ pMem->z = 0;
+}
+#else
+SQLITE_PRIVATE int sqlite3VdbeMemSetZeroBlob(Mem *pMem, int n){
+ int nByte = n>0?n:1;
+ if( sqlite3VdbeMemGrow(pMem, nByte, 0) ){
+ return SQLITE_NOMEM_BKPT;
+ }
+ assert( pMem->z!=0 );
+ assert( sqlite3DbMallocSize(pMem->db, pMem->z)>=nByte );
+ memset(pMem->z, 0, nByte);
+ pMem->n = n>0?n:0;
+ pMem->flags = MEM_Blob;
+ pMem->enc = SQLITE_UTF8;
+ return SQLITE_OK;
+}
+#endif
+
+/*
+** The pMem is known to contain content that needs to be destroyed prior
+** to a value change. So invoke the destructor, then set the value to
+** a 64-bit integer.
+*/
+static SQLITE_NOINLINE void vdbeReleaseAndSetInt64(Mem *pMem, i64 val){
+ sqlite3VdbeMemSetNull(pMem);
+ pMem->u.i = val;
+ pMem->flags = MEM_Int;
+}
+
+/*
+** Delete any previous value and set the value stored in *pMem to val,
+** manifest type INTEGER.
+*/
+SQLITE_PRIVATE void sqlite3VdbeMemSetInt64(Mem *pMem, i64 val){
+ if( VdbeMemDynamic(pMem) ){
+ vdbeReleaseAndSetInt64(pMem, val);
+ }else{
+ pMem->u.i = val;
+ pMem->flags = MEM_Int;
+ }
+}
+
+/*
+** Set the iIdx'th entry of array aMem[] to contain integer value val.
+*/
+SQLITE_PRIVATE void sqlite3MemSetArrayInt64(sqlite3_value *aMem, int iIdx, i64 val){
+ sqlite3VdbeMemSetInt64(&aMem[iIdx], val);
+}
+
+/* A no-op destructor */
+SQLITE_PRIVATE void sqlite3NoopDestructor(void *p){ UNUSED_PARAMETER(p); }
+
+/*
+** Set the value stored in *pMem should already be a NULL.
+** Also store a pointer to go with it.
+*/
+SQLITE_PRIVATE void sqlite3VdbeMemSetPointer(
+ Mem *pMem,
+ void *pPtr,
+ const char *zPType,
+ void (*xDestructor)(void*)
+){
+ assert( pMem->flags==MEM_Null );
+ vdbeMemClear(pMem);
+ pMem->u.zPType = zPType ? zPType : "";
+ pMem->z = pPtr;
+ pMem->flags = MEM_Null|MEM_Dyn|MEM_Subtype|MEM_Term;
+ pMem->eSubtype = 'p';
+ pMem->xDel = xDestructor ? xDestructor : sqlite3NoopDestructor;
+}
+
+#ifndef SQLITE_OMIT_FLOATING_POINT
+/*
+** Delete any previous value and set the value stored in *pMem to val,
+** manifest type REAL.
+*/
+SQLITE_PRIVATE void sqlite3VdbeMemSetDouble(Mem *pMem, double val){
+ sqlite3VdbeMemSetNull(pMem);
+ if( !sqlite3IsNaN(val) ){
+ pMem->u.r = val;
+ pMem->flags = MEM_Real;
+ }
+}
+#endif
+
+#ifdef SQLITE_DEBUG
+/*
+** Return true if the Mem holds a RowSet object. This routine is intended
+** for use inside of assert() statements.
+*/
+SQLITE_PRIVATE int sqlite3VdbeMemIsRowSet(const Mem *pMem){
+ return (pMem->flags&(MEM_Blob|MEM_Dyn))==(MEM_Blob|MEM_Dyn)
+ && pMem->xDel==sqlite3RowSetDelete;
+}
+#endif
+
+/*
+** Delete any previous value and set the value of pMem to be an
+** empty boolean index.
+**
+** Return SQLITE_OK on success and SQLITE_NOMEM if a memory allocation
+** error occurs.
+*/
+SQLITE_PRIVATE int sqlite3VdbeMemSetRowSet(Mem *pMem){
+ sqlite3 *db = pMem->db;
+ RowSet *p;
+ assert( db!=0 );
+ assert( !sqlite3VdbeMemIsRowSet(pMem) );
+ sqlite3VdbeMemRelease(pMem);
+ p = sqlite3RowSetInit(db);
+ if( p==0 ) return SQLITE_NOMEM;
+ pMem->z = (char*)p;
+ pMem->flags = MEM_Blob|MEM_Dyn;
+ pMem->xDel = sqlite3RowSetDelete;
+ return SQLITE_OK;
+}
+
+/*
+** Return true if the Mem object contains a TEXT or BLOB that is
+** too large - whose size exceeds SQLITE_MAX_LENGTH.
+*/
+SQLITE_PRIVATE int sqlite3VdbeMemTooBig(Mem *p){
+ assert( p->db!=0 );
+ if( p->flags & (MEM_Str|MEM_Blob) ){
+ int n = p->n;
+ if( p->flags & MEM_Zero ){
+ n += p->u.nZero;
+ }
+ return n>p->db->aLimit[SQLITE_LIMIT_LENGTH];
+ }
+ return 0;
+}
+
+#ifdef SQLITE_DEBUG
+/*
+** This routine prepares a memory cell for modification by breaking
+** its link to a shallow copy and by marking any current shallow
+** copies of this cell as invalid.
+**
+** This is used for testing and debugging only - to help ensure that shallow
+** copies (created by OP_SCopy) are not misused.
+*/
+SQLITE_PRIVATE void sqlite3VdbeMemAboutToChange(Vdbe *pVdbe, Mem *pMem){
+ int i;
+ Mem *pX;
+ if( pMem->bScopy ){
+ for(i=1, pX=pVdbe->aMem+1; i<pVdbe->nMem; i++, pX++){
+ if( pX->pScopyFrom==pMem ){
+ u16 mFlags;
+ if( pVdbe->db->flags & SQLITE_VdbeTrace ){
+ sqlite3DebugPrintf("Invalidate R[%d] due to change in R[%d]\n",
+ (int)(pX - pVdbe->aMem), (int)(pMem - pVdbe->aMem));
+ }
+ /* If pX is marked as a shallow copy of pMem, then try to verify that
+ ** no significant changes have been made to pX since the OP_SCopy.
+ ** A significant change would indicated a missed call to this
+ ** function for pX. Minor changes, such as adding or removing a
+ ** dual type, are allowed, as long as the underlying value is the
+ ** same. */
+ mFlags = pMem->flags & pX->flags & pX->mScopyFlags;
+ assert( (mFlags&(MEM_Int|MEM_IntReal))==0 || pMem->u.i==pX->u.i );
+
+ /* pMem is the register that is changing. But also mark pX as
+ ** undefined so that we can quickly detect the shallow-copy error */
+ pX->flags = MEM_Undefined;
+ pX->pScopyFrom = 0;
+ }
+ }
+ pMem->bScopy = 0;
+ }
+ pMem->pScopyFrom = 0;
+}
+#endif /* SQLITE_DEBUG */
+
+/*
+** Make an shallow copy of pFrom into pTo. Prior contents of
+** pTo are freed. The pFrom->z field is not duplicated. If
+** pFrom->z is used, then pTo->z points to the same thing as pFrom->z
+** and flags gets srcType (either MEM_Ephem or MEM_Static).
+*/
+static SQLITE_NOINLINE void vdbeClrCopy(Mem *pTo, const Mem *pFrom, int eType){
+ vdbeMemClearExternAndSetNull(pTo);
+ assert( !VdbeMemDynamic(pTo) );
+ sqlite3VdbeMemShallowCopy(pTo, pFrom, eType);
+}
+SQLITE_PRIVATE void sqlite3VdbeMemShallowCopy(Mem *pTo, const Mem *pFrom, int srcType){
+ assert( !sqlite3VdbeMemIsRowSet(pFrom) );
+ assert( pTo->db==pFrom->db );
+ if( VdbeMemDynamic(pTo) ){ vdbeClrCopy(pTo,pFrom,srcType); return; }
+ memcpy(pTo, pFrom, MEMCELLSIZE);
+ if( (pFrom->flags&MEM_Static)==0 ){
+ pTo->flags &= ~(MEM_Dyn|MEM_Static|MEM_Ephem);
+ assert( srcType==MEM_Ephem || srcType==MEM_Static );
+ pTo->flags |= srcType;
+ }
+}
+
+/*
+** Make a full copy of pFrom into pTo. Prior contents of pTo are
+** freed before the copy is made.
+*/
+SQLITE_PRIVATE int sqlite3VdbeMemCopy(Mem *pTo, const Mem *pFrom){
+ int rc = SQLITE_OK;
+
+ assert( !sqlite3VdbeMemIsRowSet(pFrom) );
+ if( VdbeMemDynamic(pTo) ) vdbeMemClearExternAndSetNull(pTo);
+ memcpy(pTo, pFrom, MEMCELLSIZE);
+ pTo->flags &= ~MEM_Dyn;
+ if( pTo->flags&(MEM_Str|MEM_Blob) ){
+ if( 0==(pFrom->flags&MEM_Static) ){
+ pTo->flags |= MEM_Ephem;
+ rc = sqlite3VdbeMemMakeWriteable(pTo);
+ }
+ }
+
+ return rc;
+}
+
+/*
+** Transfer the contents of pFrom to pTo. Any existing value in pTo is
+** freed. If pFrom contains ephemeral data, a copy is made.
+**
+** pFrom contains an SQL NULL when this routine returns.
+*/
+SQLITE_PRIVATE void sqlite3VdbeMemMove(Mem *pTo, Mem *pFrom){
+ assert( pFrom->db==0 || sqlite3_mutex_held(pFrom->db->mutex) );
+ assert( pTo->db==0 || sqlite3_mutex_held(pTo->db->mutex) );
+ assert( pFrom->db==0 || pTo->db==0 || pFrom->db==pTo->db );
+
+ sqlite3VdbeMemRelease(pTo);
+ memcpy(pTo, pFrom, sizeof(Mem));
+ pFrom->flags = MEM_Null;
+ pFrom->szMalloc = 0;
+}
+
+/*
+** Change the value of a Mem to be a string or a BLOB.
+**
+** The memory management strategy depends on the value of the xDel
+** parameter. If the value passed is SQLITE_TRANSIENT, then the
+** string is copied into a (possibly existing) buffer managed by the
+** Mem structure. Otherwise, any existing buffer is freed and the
+** pointer copied.
+**
+** If the string is too large (if it exceeds the SQLITE_LIMIT_LENGTH
+** size limit) then no memory allocation occurs. If the string can be
+** stored without allocating memory, then it is. If a memory allocation
+** is required to store the string, then value of pMem is unchanged. In
+** either case, SQLITE_TOOBIG is returned.
+**
+** The "enc" parameter is the text encoding for the string, or zero
+** to store a blob.
+**
+** If n is negative, then the string consists of all bytes up to but
+** excluding the first zero character. The n parameter must be
+** non-negative for blobs.
+*/
+SQLITE_PRIVATE int sqlite3VdbeMemSetStr(
+ Mem *pMem, /* Memory cell to set to string value */
+ const char *z, /* String pointer */
+ i64 n, /* Bytes in string, or negative */
+ u8 enc, /* Encoding of z. 0 for BLOBs */
+ void (*xDel)(void*) /* Destructor function */
+){
+ i64 nByte = n; /* New value for pMem->n */
+ int iLimit; /* Maximum allowed string or blob size */
+ u16 flags; /* New value for pMem->flags */
+
+ assert( pMem!=0 );
+ assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
+ assert( !sqlite3VdbeMemIsRowSet(pMem) );
+ assert( enc!=0 || n>=0 );
+
+ /* If z is a NULL pointer, set pMem to contain an SQL NULL. */
+ if( !z ){
+ sqlite3VdbeMemSetNull(pMem);
+ return SQLITE_OK;
+ }
+
+ if( pMem->db ){
+ iLimit = pMem->db->aLimit[SQLITE_LIMIT_LENGTH];
+ }else{
+ iLimit = SQLITE_MAX_LENGTH;
+ }
+ if( nByte<0 ){
+ assert( enc!=0 );
+ if( enc==SQLITE_UTF8 ){
+ nByte = strlen(z);
+ }else{
+ for(nByte=0; nByte<=iLimit && (z[nByte] | z[nByte+1]); nByte+=2){}
+ }
+ flags= MEM_Str|MEM_Term;
+ }else if( enc==0 ){
+ flags = MEM_Blob;
+ enc = SQLITE_UTF8;
+ }else{
+ flags = MEM_Str;
+ }
+ if( nByte>iLimit ){
+ if( xDel && xDel!=SQLITE_TRANSIENT ){
+ if( xDel==SQLITE_DYNAMIC ){
+ sqlite3DbFree(pMem->db, (void*)z);
+ }else{
+ xDel((void*)z);
+ }
+ }
+ sqlite3VdbeMemSetNull(pMem);
+ return sqlite3ErrorToParser(pMem->db, SQLITE_TOOBIG);
+ }
+
+ /* The following block sets the new values of Mem.z and Mem.xDel. It
+ ** also sets a flag in local variable "flags" to indicate the memory
+ ** management (one of MEM_Dyn or MEM_Static).
+ */
+ if( xDel==SQLITE_TRANSIENT ){
+ i64 nAlloc = nByte;
+ if( flags&MEM_Term ){
+ nAlloc += (enc==SQLITE_UTF8?1:2);
+ }
+ testcase( nAlloc==0 );
+ testcase( nAlloc==31 );
+ testcase( nAlloc==32 );
+ if( sqlite3VdbeMemClearAndResize(pMem, (int)MAX(nAlloc,32)) ){
+ return SQLITE_NOMEM_BKPT;
+ }
+ memcpy(pMem->z, z, nAlloc);
+ }else{
+ sqlite3VdbeMemRelease(pMem);
+ pMem->z = (char *)z;
+ if( xDel==SQLITE_DYNAMIC ){
+ pMem->zMalloc = pMem->z;
+ pMem->szMalloc = sqlite3DbMallocSize(pMem->db, pMem->zMalloc);
+ }else{
+ pMem->xDel = xDel;
+ flags |= ((xDel==SQLITE_STATIC)?MEM_Static:MEM_Dyn);
+ }
+ }
+
+ pMem->n = (int)(nByte & 0x7fffffff);
+ pMem->flags = flags;
+ pMem->enc = enc;
+
+#ifndef SQLITE_OMIT_UTF16
+ if( enc>SQLITE_UTF8 && sqlite3VdbeMemHandleBom(pMem) ){
+ return SQLITE_NOMEM_BKPT;
+ }
+#endif
+
+
+ return SQLITE_OK;
+}
+
+/*
+** Move data out of a btree key or data field and into a Mem structure.
+** The data is payload from the entry that pCur is currently pointing
+** to. offset and amt determine what portion of the data or key to retrieve.
+** The result is written into the pMem element.
+**
+** The pMem object must have been initialized. This routine will use
+** pMem->zMalloc to hold the content from the btree, if possible. New
+** pMem->zMalloc space will be allocated if necessary. The calling routine
+** is responsible for making sure that the pMem object is eventually
+** destroyed.
+**
+** If this routine fails for any reason (malloc returns NULL or unable
+** to read from the disk) then the pMem is left in an inconsistent state.
+*/
+SQLITE_PRIVATE int sqlite3VdbeMemFromBtree(
+ BtCursor *pCur, /* Cursor pointing at record to retrieve. */
+ u32 offset, /* Offset from the start of data to return bytes from. */
+ u32 amt, /* Number of bytes to return. */
+ Mem *pMem /* OUT: Return data in this Mem structure. */
+){
+ int rc;
+ pMem->flags = MEM_Null;
+ if( sqlite3BtreeMaxRecordSize(pCur)<offset+amt ){
+ return SQLITE_CORRUPT_BKPT;
+ }
+ if( SQLITE_OK==(rc = sqlite3VdbeMemClearAndResize(pMem, amt+1)) ){
+ rc = sqlite3BtreePayload(pCur, offset, amt, pMem->z);
+ if( rc==SQLITE_OK ){
+ pMem->z[amt] = 0; /* Overrun area used when reading malformed records */
+ pMem->flags = MEM_Blob;
+ pMem->n = (int)amt;
+ }else{
+ sqlite3VdbeMemRelease(pMem);
+ }
+ }
+ return rc;
+}
+SQLITE_PRIVATE int sqlite3VdbeMemFromBtreeZeroOffset(
+ BtCursor *pCur, /* Cursor pointing at record to retrieve. */
+ u32 amt, /* Number of bytes to return. */
+ Mem *pMem /* OUT: Return data in this Mem structure. */
+){
+ u32 available = 0; /* Number of bytes available on the local btree page */
+ int rc = SQLITE_OK; /* Return code */
+
+ assert( sqlite3BtreeCursorIsValid(pCur) );
+ assert( !VdbeMemDynamic(pMem) );
+
+ /* Note: the calls to BtreeKeyFetch() and DataFetch() below assert()
+ ** that both the BtShared and database handle mutexes are held. */
+ assert( !sqlite3VdbeMemIsRowSet(pMem) );
+ pMem->z = (char *)sqlite3BtreePayloadFetch(pCur, &available);
+ assert( pMem->z!=0 );
+
+ if( amt<=available ){
+ pMem->flags = MEM_Blob|MEM_Ephem;
+ pMem->n = (int)amt;
+ }else{
+ rc = sqlite3VdbeMemFromBtree(pCur, 0, amt, pMem);
+ }
+
+ return rc;
+}
+
+/*
+** The pVal argument is known to be a value other than NULL.
+** Convert it into a string with encoding enc and return a pointer
+** to a zero-terminated version of that string.
+*/
+static SQLITE_NOINLINE const void *valueToText(sqlite3_value* pVal, u8 enc){
+ assert( pVal!=0 );
+ assert( pVal->db==0 || sqlite3_mutex_held(pVal->db->mutex) );
+ assert( (enc&3)==(enc&~SQLITE_UTF16_ALIGNED) );
+ assert( !sqlite3VdbeMemIsRowSet(pVal) );
+ assert( (pVal->flags & (MEM_Null))==0 );
+ if( pVal->flags & (MEM_Blob|MEM_Str) ){
+ if( ExpandBlob(pVal) ) return 0;
+ pVal->flags |= MEM_Str;
+ if( pVal->enc != (enc & ~SQLITE_UTF16_ALIGNED) ){
+ sqlite3VdbeChangeEncoding(pVal, enc & ~SQLITE_UTF16_ALIGNED);
+ }
+ if( (enc & SQLITE_UTF16_ALIGNED)!=0 && 1==(1&SQLITE_PTR_TO_INT(pVal->z)) ){
+ assert( (pVal->flags & (MEM_Ephem|MEM_Static))!=0 );
+ if( sqlite3VdbeMemMakeWriteable(pVal)!=SQLITE_OK ){
+ return 0;
+ }
+ }
+ sqlite3VdbeMemNulTerminate(pVal); /* IMP: R-31275-44060 */
+ }else{
+ sqlite3VdbeMemStringify(pVal, enc, 0);
+ assert( 0==(1&SQLITE_PTR_TO_INT(pVal->z)) );
+ }
+ assert(pVal->enc==(enc & ~SQLITE_UTF16_ALIGNED) || pVal->db==0
+ || pVal->db->mallocFailed );
+ if( pVal->enc==(enc & ~SQLITE_UTF16_ALIGNED) ){
+ assert( sqlite3VdbeMemValidStrRep(pVal) );
+ return pVal->z;
+ }else{
+ return 0;
+ }
+}
+
+/* This function is only available internally, it is not part of the
+** external API. It works in a similar way to sqlite3_value_text(),
+** except the data returned is in the encoding specified by the second
+** parameter, which must be one of SQLITE_UTF16BE, SQLITE_UTF16LE or
+** SQLITE_UTF8.
+**
+** (2006-02-16:) The enc value can be or-ed with SQLITE_UTF16_ALIGNED.
+** If that is the case, then the result must be aligned on an even byte
+** boundary.
+*/
+SQLITE_PRIVATE const void *sqlite3ValueText(sqlite3_value* pVal, u8 enc){
+ if( !pVal ) return 0;
+ assert( pVal->db==0 || sqlite3_mutex_held(pVal->db->mutex) );
+ assert( (enc&3)==(enc&~SQLITE_UTF16_ALIGNED) );
+ assert( !sqlite3VdbeMemIsRowSet(pVal) );
+ if( (pVal->flags&(MEM_Str|MEM_Term))==(MEM_Str|MEM_Term) && pVal->enc==enc ){
+ assert( sqlite3VdbeMemValidStrRep(pVal) );
+ return pVal->z;
+ }
+ if( pVal->flags&MEM_Null ){
+ return 0;
+ }
+ return valueToText(pVal, enc);
+}
+
+/* Return true if sqlit3_value object pVal is a string or blob value
+** that uses the destructor specified in the second argument.
+**
+** TODO: Maybe someday promote this interface into a published API so
+** that third-party extensions can get access to it?
+*/
+SQLITE_PRIVATE int sqlite3ValueIsOfClass(const sqlite3_value *pVal, void(*xFree)(void*)){
+ if( ALWAYS(pVal!=0)
+ && ALWAYS((pVal->flags & (MEM_Str|MEM_Blob))!=0)
+ && (pVal->flags & MEM_Dyn)!=0
+ && pVal->xDel==xFree
+ ){
+ return 1;
+ }else{
+ return 0;
+ }
+}
+
+/*
+** Create a new sqlite3_value object.
+*/
+SQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *db){
+ Mem *p = sqlite3DbMallocZero(db, sizeof(*p));
+ if( p ){
+ p->flags = MEM_Null;
+ p->db = db;
+ }
+ return p;
+}
+
+/*
+** Context object passed by sqlite3Stat4ProbeSetValue() through to
+** valueNew(). See comments above valueNew() for details.
+*/
+struct ValueNewStat4Ctx {
+ Parse *pParse;
+ Index *pIdx;
+ UnpackedRecord **ppRec;
+ int iVal;
+};
+
+/*
+** Allocate and return a pointer to a new sqlite3_value object. If
+** the second argument to this function is NULL, the object is allocated
+** by calling sqlite3ValueNew().
+**
+** Otherwise, if the second argument is non-zero, then this function is
+** being called indirectly by sqlite3Stat4ProbeSetValue(). If it has not
+** already been allocated, allocate the UnpackedRecord structure that
+** that function will return to its caller here. Then return a pointer to
+** an sqlite3_value within the UnpackedRecord.a[] array.
+*/
+static sqlite3_value *valueNew(sqlite3 *db, struct ValueNewStat4Ctx *p){
+#ifdef SQLITE_ENABLE_STAT4
+ if( p ){
+ UnpackedRecord *pRec = p->ppRec[0];
+
+ if( pRec==0 ){
+ Index *pIdx = p->pIdx; /* Index being probed */
+ int nByte; /* Bytes of space to allocate */
+ int i; /* Counter variable */
+ int nCol = pIdx->nColumn; /* Number of index columns including rowid */
+
+ nByte = sizeof(Mem) * nCol + ROUND8(sizeof(UnpackedRecord));
+ pRec = (UnpackedRecord*)sqlite3DbMallocZero(db, nByte);
+ if( pRec ){
+ pRec->pKeyInfo = sqlite3KeyInfoOfIndex(p->pParse, pIdx);
+ if( pRec->pKeyInfo ){
+ assert( pRec->pKeyInfo->nAllField==nCol );
+ assert( pRec->pKeyInfo->enc==ENC(db) );
+ pRec->aMem = (Mem *)((u8*)pRec + ROUND8(sizeof(UnpackedRecord)));
+ for(i=0; i<nCol; i++){
+ pRec->aMem[i].flags = MEM_Null;
+ pRec->aMem[i].db = db;
+ }
+ }else{
+ sqlite3DbFreeNN(db, pRec);
+ pRec = 0;
+ }
+ }
+ if( pRec==0 ) return 0;
+ p->ppRec[0] = pRec;
+ }
+
+ pRec->nField = p->iVal+1;
+ sqlite3VdbeMemSetNull(&pRec->aMem[p->iVal]);
+ return &pRec->aMem[p->iVal];
+ }
+#else
+ UNUSED_PARAMETER(p);
+#endif /* defined(SQLITE_ENABLE_STAT4) */
+ return sqlite3ValueNew(db);
+}
+
+/*
+** The expression object indicated by the second argument is guaranteed
+** to be a scalar SQL function. If
+**
+** * all function arguments are SQL literals,
+** * one of the SQLITE_FUNC_CONSTANT or _SLOCHNG function flags is set, and
+** * the SQLITE_FUNC_NEEDCOLL function flag is not set,
+**
+** then this routine attempts to invoke the SQL function. Assuming no
+** error occurs, output parameter (*ppVal) is set to point to a value
+** object containing the result before returning SQLITE_OK.
+**
+** Affinity aff is applied to the result of the function before returning.
+** If the result is a text value, the sqlite3_value object uses encoding
+** enc.
+**
+** If the conditions above are not met, this function returns SQLITE_OK
+** and sets (*ppVal) to NULL. Or, if an error occurs, (*ppVal) is set to
+** NULL and an SQLite error code returned.
+*/
+#ifdef SQLITE_ENABLE_STAT4
+static int valueFromFunction(
+ sqlite3 *db, /* The database connection */
+ const Expr *p, /* The expression to evaluate */
+ u8 enc, /* Encoding to use */
+ u8 aff, /* Affinity to use */
+ sqlite3_value **ppVal, /* Write the new value here */
+ struct ValueNewStat4Ctx *pCtx /* Second argument for valueNew() */
+){
+ sqlite3_context ctx; /* Context object for function invocation */
+ sqlite3_value **apVal = 0; /* Function arguments */
+ int nVal = 0; /* Size of apVal[] array */
+ FuncDef *pFunc = 0; /* Function definition */
+ sqlite3_value *pVal = 0; /* New value */
+ int rc = SQLITE_OK; /* Return code */
+ ExprList *pList = 0; /* Function arguments */
+ int i; /* Iterator variable */
+
+ assert( pCtx!=0 );
+ assert( (p->flags & EP_TokenOnly)==0 );
+ assert( ExprUseXList(p) );
+ pList = p->x.pList;
+ if( pList ) nVal = pList->nExpr;
+ assert( !ExprHasProperty(p, EP_IntValue) );
+ pFunc = sqlite3FindFunction(db, p->u.zToken, nVal, enc, 0);
+#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
+ if( pFunc==0 ) return SQLITE_OK;
+#endif
+ assert( pFunc );
+ if( (pFunc->funcFlags & (SQLITE_FUNC_CONSTANT|SQLITE_FUNC_SLOCHNG))==0
+ || (pFunc->funcFlags & (SQLITE_FUNC_NEEDCOLL|SQLITE_FUNC_RUNONLY))!=0
+ ){
+ return SQLITE_OK;
+ }
+
+ if( pList ){
+ apVal = (sqlite3_value**)sqlite3DbMallocZero(db, sizeof(apVal[0]) * nVal);
+ if( apVal==0 ){
+ rc = SQLITE_NOMEM_BKPT;
+ goto value_from_function_out;
+ }
+ for(i=0; i<nVal; i++){
+ rc = sqlite3Stat4ValueFromExpr(pCtx->pParse, pList->a[i].pExpr, aff,
+ &apVal[i]);
+ if( apVal[i]==0 || rc!=SQLITE_OK ) goto value_from_function_out;
+ }
+ }
+
+ pVal = valueNew(db, pCtx);
+ if( pVal==0 ){
+ rc = SQLITE_NOMEM_BKPT;
+ goto value_from_function_out;
+ }
+
+ memset(&ctx, 0, sizeof(ctx));
+ ctx.pOut = pVal;
+ ctx.pFunc = pFunc;
+ ctx.enc = ENC(db);
+ pFunc->xSFunc(&ctx, nVal, apVal);
+ if( ctx.isError ){
+ rc = ctx.isError;
+ sqlite3ErrorMsg(pCtx->pParse, "%s", sqlite3_value_text(pVal));
+ }else{
+ sqlite3ValueApplyAffinity(pVal, aff, SQLITE_UTF8);
+ assert( rc==SQLITE_OK );
+ rc = sqlite3VdbeChangeEncoding(pVal, enc);
+ if( NEVER(rc==SQLITE_OK && sqlite3VdbeMemTooBig(pVal)) ){
+ rc = SQLITE_TOOBIG;
+ pCtx->pParse->nErr++;
+ }
+ }
+
+ value_from_function_out:
+ if( rc!=SQLITE_OK ){
+ pVal = 0;
+ pCtx->pParse->rc = rc;
+ }
+ if( apVal ){
+ for(i=0; i<nVal; i++){
+ sqlite3ValueFree(apVal[i]);
+ }
+ sqlite3DbFreeNN(db, apVal);
+ }
+
+ *ppVal = pVal;
+ return rc;
+}
+#else
+# define valueFromFunction(a,b,c,d,e,f) SQLITE_OK
+#endif /* defined(SQLITE_ENABLE_STAT4) */
+
+/*
+** Extract a value from the supplied expression in the manner described
+** above sqlite3ValueFromExpr(). Allocate the sqlite3_value object
+** using valueNew().
+**
+** If pCtx is NULL and an error occurs after the sqlite3_value object
+** has been allocated, it is freed before returning. Or, if pCtx is not
+** NULL, it is assumed that the caller will free any allocated object
+** in all cases.
+*/
+static int valueFromExpr(
+ sqlite3 *db, /* The database connection */
+ const Expr *pExpr, /* The expression to evaluate */
+ u8 enc, /* Encoding to use */
+ u8 affinity, /* Affinity to use */
+ sqlite3_value **ppVal, /* Write the new value here */
+ struct ValueNewStat4Ctx *pCtx /* Second argument for valueNew() */
+){
+ int op;
+ char *zVal = 0;
+ sqlite3_value *pVal = 0;
+ int negInt = 1;
+ const char *zNeg = "";
+ int rc = SQLITE_OK;
+
+ assert( pExpr!=0 );
+ while( (op = pExpr->op)==TK_UPLUS || op==TK_SPAN ) pExpr = pExpr->pLeft;
+ if( op==TK_REGISTER ) op = pExpr->op2;
+
+ /* Compressed expressions only appear when parsing the DEFAULT clause
+ ** on a table column definition, and hence only when pCtx==0. This
+ ** check ensures that an EP_TokenOnly expression is never passed down
+ ** into valueFromFunction(). */
+ assert( (pExpr->flags & EP_TokenOnly)==0 || pCtx==0 );
+
+ if( op==TK_CAST ){
+ u8 aff;
+ assert( !ExprHasProperty(pExpr, EP_IntValue) );
+ aff = sqlite3AffinityType(pExpr->u.zToken,0);
+ rc = valueFromExpr(db, pExpr->pLeft, enc, aff, ppVal, pCtx);
+ testcase( rc!=SQLITE_OK );
+ if( *ppVal ){
+#ifdef SQLITE_ENABLE_STAT4
+ rc = ExpandBlob(*ppVal);
+#else
+ /* zero-blobs only come from functions, not literal values. And
+ ** functions are only processed under STAT4 */
+ assert( (ppVal[0][0].flags & MEM_Zero)==0 );
+#endif
+ sqlite3VdbeMemCast(*ppVal, aff, enc);
+ sqlite3ValueApplyAffinity(*ppVal, affinity, enc);
+ }
+ return rc;
+ }
+
+ /* Handle negative integers in a single step. This is needed in the
+ ** case when the value is -9223372036854775808. Except - do not do this
+ ** for hexadecimal literals. */
+ if( op==TK_UMINUS ){
+ Expr *pLeft = pExpr->pLeft;
+ if( (pLeft->op==TK_INTEGER || pLeft->op==TK_FLOAT) ){
+ if( ExprHasProperty(pLeft, EP_IntValue)
+ || pLeft->u.zToken[0]!='0' || (pLeft->u.zToken[1] & ~0x20)!='X'
+ ){
+ pExpr = pLeft;
+ op = pExpr->op;
+ negInt = -1;
+ zNeg = "-";
+ }
+ }
+ }
+
+ if( op==TK_STRING || op==TK_FLOAT || op==TK_INTEGER ){
+ pVal = valueNew(db, pCtx);
+ if( pVal==0 ) goto no_mem;
+ if( ExprHasProperty(pExpr, EP_IntValue) ){
+ sqlite3VdbeMemSetInt64(pVal, (i64)pExpr->u.iValue*negInt);
+ }else{
+ i64 iVal;
+ if( op==TK_INTEGER && 0==sqlite3DecOrHexToI64(pExpr->u.zToken, &iVal) ){
+ sqlite3VdbeMemSetInt64(pVal, iVal*negInt);
+ }else{
+ zVal = sqlite3MPrintf(db, "%s%s", zNeg, pExpr->u.zToken);
+ if( zVal==0 ) goto no_mem;
+ sqlite3ValueSetStr(pVal, -1, zVal, SQLITE_UTF8, SQLITE_DYNAMIC);
+ }
+ }
+ if( affinity==SQLITE_AFF_BLOB ){
+ if( op==TK_FLOAT ){
+ assert( pVal && pVal->z && pVal->flags==(MEM_Str|MEM_Term) );
+ sqlite3AtoF(pVal->z, &pVal->u.r, pVal->n, SQLITE_UTF8);
+ pVal->flags = MEM_Real;
+ }else if( op==TK_INTEGER ){
+ /* This case is required by -9223372036854775808 and other strings
+ ** that look like integers but cannot be handled by the
+ ** sqlite3DecOrHexToI64() call above. */
+ sqlite3ValueApplyAffinity(pVal, SQLITE_AFF_NUMERIC, SQLITE_UTF8);
+ }
+ }else{
+ sqlite3ValueApplyAffinity(pVal, affinity, SQLITE_UTF8);
+ }
+ assert( (pVal->flags & MEM_IntReal)==0 );
+ if( pVal->flags & (MEM_Int|MEM_IntReal|MEM_Real) ){
+ testcase( pVal->flags & MEM_Int );
+ testcase( pVal->flags & MEM_Real );
+ pVal->flags &= ~MEM_Str;
+ }
+ if( enc!=SQLITE_UTF8 ){
+ rc = sqlite3VdbeChangeEncoding(pVal, enc);
+ }
+ }else if( op==TK_UMINUS ) {
+ /* This branch happens for multiple negative signs. Ex: -(-5) */
+ if( SQLITE_OK==valueFromExpr(db,pExpr->pLeft,enc,affinity,&pVal,pCtx)
+ && pVal!=0
+ ){
+ sqlite3VdbeMemNumerify(pVal);
+ if( pVal->flags & MEM_Real ){
+ pVal->u.r = -pVal->u.r;
+ }else if( pVal->u.i==SMALLEST_INT64 ){
+#ifndef SQLITE_OMIT_FLOATING_POINT
+ pVal->u.r = -(double)SMALLEST_INT64;
+#else
+ pVal->u.r = LARGEST_INT64;
+#endif
+ MemSetTypeFlag(pVal, MEM_Real);
+ }else{
+ pVal->u.i = -pVal->u.i;
+ }
+ sqlite3ValueApplyAffinity(pVal, affinity, enc);
+ }
+ }else if( op==TK_NULL ){
+ pVal = valueNew(db, pCtx);
+ if( pVal==0 ) goto no_mem;
+ sqlite3VdbeMemSetNull(pVal);
+ }
+#ifndef SQLITE_OMIT_BLOB_LITERAL
+ else if( op==TK_BLOB ){
+ int nVal;
+ assert( !ExprHasProperty(pExpr, EP_IntValue) );
+ assert( pExpr->u.zToken[0]=='x' || pExpr->u.zToken[0]=='X' );
+ assert( pExpr->u.zToken[1]=='\'' );
+ pVal = valueNew(db, pCtx);
+ if( !pVal ) goto no_mem;
+ zVal = &pExpr->u.zToken[2];
+ nVal = sqlite3Strlen30(zVal)-1;
+ assert( zVal[nVal]=='\'' );
+ sqlite3VdbeMemSetStr(pVal, sqlite3HexToBlob(db, zVal, nVal), nVal/2,
+ 0, SQLITE_DYNAMIC);
+ }
+#endif
+#ifdef SQLITE_ENABLE_STAT4
+ else if( op==TK_FUNCTION && pCtx!=0 ){
+ rc = valueFromFunction(db, pExpr, enc, affinity, &pVal, pCtx);
+ }
+#endif
+ else if( op==TK_TRUEFALSE ){
+ assert( !ExprHasProperty(pExpr, EP_IntValue) );
+ pVal = valueNew(db, pCtx);
+ if( pVal ){
+ pVal->flags = MEM_Int;
+ pVal->u.i = pExpr->u.zToken[4]==0;
+ sqlite3ValueApplyAffinity(pVal, affinity, enc);
+ }
+ }
+
+ *ppVal = pVal;
+ return rc;
+
+no_mem:
+#ifdef SQLITE_ENABLE_STAT4
+ if( pCtx==0 || NEVER(pCtx->pParse->nErr==0) )
+#endif
+ sqlite3OomFault(db);
+ sqlite3DbFree(db, zVal);
+ assert( *ppVal==0 );
+#ifdef SQLITE_ENABLE_STAT4
+ if( pCtx==0 ) sqlite3ValueFree(pVal);
+#else
+ assert( pCtx==0 ); sqlite3ValueFree(pVal);
+#endif
+ return SQLITE_NOMEM_BKPT;
+}
+
+/*
+** Create a new sqlite3_value object, containing the value of pExpr.
+**
+** This only works for very simple expressions that consist of one constant
+** token (i.e. "5", "5.1", "'a string'"). If the expression can
+** be converted directly into a value, then the value is allocated and
+** a pointer written to *ppVal. The caller is responsible for deallocating
+** the value by passing it to sqlite3ValueFree() later on. If the expression
+** cannot be converted to a value, then *ppVal is set to NULL.
+*/
+SQLITE_PRIVATE int sqlite3ValueFromExpr(
+ sqlite3 *db, /* The database connection */
+ const Expr *pExpr, /* The expression to evaluate */
+ u8 enc, /* Encoding to use */
+ u8 affinity, /* Affinity to use */
+ sqlite3_value **ppVal /* Write the new value here */
+){
+ return pExpr ? valueFromExpr(db, pExpr, enc, affinity, ppVal, 0) : 0;
+}
+
+#ifdef SQLITE_ENABLE_STAT4
+/*
+** Attempt to extract a value from pExpr and use it to construct *ppVal.
+**
+** If pAlloc is not NULL, then an UnpackedRecord object is created for
+** pAlloc if one does not exist and the new value is added to the
+** UnpackedRecord object.
+**
+** A value is extracted in the following cases:
+**
+** * (pExpr==0). In this case the value is assumed to be an SQL NULL,
+**
+** * The expression is a bound variable, and this is a reprepare, or
+**
+** * The expression is a literal value.
+**
+** On success, *ppVal is made to point to the extracted value. The caller
+** is responsible for ensuring that the value is eventually freed.
+*/
+static int stat4ValueFromExpr(
+ Parse *pParse, /* Parse context */
+ Expr *pExpr, /* The expression to extract a value from */
+ u8 affinity, /* Affinity to use */
+ struct ValueNewStat4Ctx *pAlloc,/* How to allocate space. Or NULL */
+ sqlite3_value **ppVal /* OUT: New value object (or NULL) */
+){
+ int rc = SQLITE_OK;
+ sqlite3_value *pVal = 0;
+ sqlite3 *db = pParse->db;
+
+ /* Skip over any TK_COLLATE nodes */
+ pExpr = sqlite3ExprSkipCollate(pExpr);
+
+ assert( pExpr==0 || pExpr->op!=TK_REGISTER || pExpr->op2!=TK_VARIABLE );
+ if( !pExpr ){
+ pVal = valueNew(db, pAlloc);
+ if( pVal ){
+ sqlite3VdbeMemSetNull((Mem*)pVal);
+ }
+ }else if( pExpr->op==TK_VARIABLE && (db->flags & SQLITE_EnableQPSG)==0 ){
+ Vdbe *v;
+ int iBindVar = pExpr->iColumn;
+ sqlite3VdbeSetVarmask(pParse->pVdbe, iBindVar);
+ if( (v = pParse->pReprepare)!=0 ){
+ pVal = valueNew(db, pAlloc);
+ if( pVal ){
+ rc = sqlite3VdbeMemCopy((Mem*)pVal, &v->aVar[iBindVar-1]);
+ sqlite3ValueApplyAffinity(pVal, affinity, ENC(db));
+ pVal->db = pParse->db;
+ }
+ }
+ }else{
+ rc = valueFromExpr(db, pExpr, ENC(db), affinity, &pVal, pAlloc);
+ }
+
+ assert( pVal==0 || pVal->db==db );
+ *ppVal = pVal;
+ return rc;
+}
+
+/*
+** This function is used to allocate and populate UnpackedRecord
+** structures intended to be compared against sample index keys stored
+** in the sqlite_stat4 table.
+**
+** A single call to this function populates zero or more fields of the
+** record starting with field iVal (fields are numbered from left to
+** right starting with 0). A single field is populated if:
+**
+** * (pExpr==0). In this case the value is assumed to be an SQL NULL,
+**
+** * The expression is a bound variable, and this is a reprepare, or
+**
+** * The sqlite3ValueFromExpr() function is able to extract a value
+** from the expression (i.e. the expression is a literal value).
+**
+** Or, if pExpr is a TK_VECTOR, one field is populated for each of the
+** vector components that match either of the two latter criteria listed
+** above.
+**
+** Before any value is appended to the record, the affinity of the
+** corresponding column within index pIdx is applied to it. Before
+** this function returns, output parameter *pnExtract is set to the
+** number of values appended to the record.
+**
+** When this function is called, *ppRec must either point to an object
+** allocated by an earlier call to this function, or must be NULL. If it
+** is NULL and a value can be successfully extracted, a new UnpackedRecord
+** is allocated (and *ppRec set to point to it) before returning.
+**
+** Unless an error is encountered, SQLITE_OK is returned. It is not an
+** error if a value cannot be extracted from pExpr. If an error does
+** occur, an SQLite error code is returned.
+*/
+SQLITE_PRIVATE int sqlite3Stat4ProbeSetValue(
+ Parse *pParse, /* Parse context */
+ Index *pIdx, /* Index being probed */
+ UnpackedRecord **ppRec, /* IN/OUT: Probe record */
+ Expr *pExpr, /* The expression to extract a value from */
+ int nElem, /* Maximum number of values to append */
+ int iVal, /* Array element to populate */
+ int *pnExtract /* OUT: Values appended to the record */
+){
+ int rc = SQLITE_OK;
+ int nExtract = 0;
+
+ if( pExpr==0 || pExpr->op!=TK_SELECT ){
+ int i;
+ struct ValueNewStat4Ctx alloc;
+
+ alloc.pParse = pParse;
+ alloc.pIdx = pIdx;
+ alloc.ppRec = ppRec;
+
+ for(i=0; i<nElem; i++){
+ sqlite3_value *pVal = 0;
+ Expr *pElem = (pExpr ? sqlite3VectorFieldSubexpr(pExpr, i) : 0);
+ u8 aff = sqlite3IndexColumnAffinity(pParse->db, pIdx, iVal+i);
+ alloc.iVal = iVal+i;
+ rc = stat4ValueFromExpr(pParse, pElem, aff, &alloc, &pVal);
+ if( !pVal ) break;
+ nExtract++;
+ }
+ }
+
+ *pnExtract = nExtract;
+ return rc;
+}
+
+/*
+** Attempt to extract a value from expression pExpr using the methods
+** as described for sqlite3Stat4ProbeSetValue() above.
+**
+** If successful, set *ppVal to point to a new value object and return
+** SQLITE_OK. If no value can be extracted, but no other error occurs
+** (e.g. OOM), return SQLITE_OK and set *ppVal to NULL. Or, if an error
+** does occur, return an SQLite error code. The final value of *ppVal
+** is undefined in this case.
+*/
+SQLITE_PRIVATE int sqlite3Stat4ValueFromExpr(
+ Parse *pParse, /* Parse context */
+ Expr *pExpr, /* The expression to extract a value from */
+ u8 affinity, /* Affinity to use */
+ sqlite3_value **ppVal /* OUT: New value object (or NULL) */
+){
+ return stat4ValueFromExpr(pParse, pExpr, affinity, 0, ppVal);
+}
+
+/*
+** Extract the iCol-th column from the nRec-byte record in pRec. Write
+** the column value into *ppVal. If *ppVal is initially NULL then a new
+** sqlite3_value object is allocated.
+**
+** If *ppVal is initially NULL then the caller is responsible for
+** ensuring that the value written into *ppVal is eventually freed.
+*/
+SQLITE_PRIVATE int sqlite3Stat4Column(
+ sqlite3 *db, /* Database handle */
+ const void *pRec, /* Pointer to buffer containing record */
+ int nRec, /* Size of buffer pRec in bytes */
+ int iCol, /* Column to extract */
+ sqlite3_value **ppVal /* OUT: Extracted value */
+){
+ u32 t = 0; /* a column type code */
+ u32 nHdr; /* Size of the header in the record */
+ u32 iHdr; /* Next unread header byte */
+ i64 iField; /* Next unread data byte */
+ u32 szField = 0; /* Size of the current data field */
+ int i; /* Column index */
+ u8 *a = (u8*)pRec; /* Typecast byte array */
+ Mem *pMem = *ppVal; /* Write result into this Mem object */
+
+ assert( iCol>0 );
+ iHdr = getVarint32(a, nHdr);
+ if( nHdr>(u32)nRec || iHdr>=nHdr ) return SQLITE_CORRUPT_BKPT;
+ iField = nHdr;
+ for(i=0; i<=iCol; i++){
+ iHdr += getVarint32(&a[iHdr], t);
+ testcase( iHdr==nHdr );
+ testcase( iHdr==nHdr+1 );
+ if( iHdr>nHdr ) return SQLITE_CORRUPT_BKPT;
+ szField = sqlite3VdbeSerialTypeLen(t);
+ iField += szField;
+ }
+ testcase( iField==nRec );
+ testcase( iField==nRec+1 );
+ if( iField>nRec ) return SQLITE_CORRUPT_BKPT;
+ if( pMem==0 ){
+ pMem = *ppVal = sqlite3ValueNew(db);
+ if( pMem==0 ) return SQLITE_NOMEM_BKPT;
+ }
+ sqlite3VdbeSerialGet(&a[iField-szField], t, pMem);
+ pMem->enc = ENC(db);
+ return SQLITE_OK;
+}
+
+/*
+** Unless it is NULL, the argument must be an UnpackedRecord object returned
+** by an earlier call to sqlite3Stat4ProbeSetValue(). This call deletes
+** the object.
+*/
+SQLITE_PRIVATE void sqlite3Stat4ProbeFree(UnpackedRecord *pRec){
+ if( pRec ){
+ int i;
+ int nCol = pRec->pKeyInfo->nAllField;
+ Mem *aMem = pRec->aMem;
+ sqlite3 *db = aMem[0].db;
+ for(i=0; i<nCol; i++){
+ sqlite3VdbeMemRelease(&aMem[i]);
+ }
+ sqlite3KeyInfoUnref(pRec->pKeyInfo);
+ sqlite3DbFreeNN(db, pRec);
+ }
+}
+#endif /* ifdef SQLITE_ENABLE_STAT4 */
+
+/*
+** Change the string value of an sqlite3_value object
+*/
+SQLITE_PRIVATE void sqlite3ValueSetStr(
+ sqlite3_value *v, /* Value to be set */
+ int n, /* Length of string z */
+ const void *z, /* Text of the new string */
+ u8 enc, /* Encoding to use */
+ void (*xDel)(void*) /* Destructor for the string */
+){
+ if( v ) sqlite3VdbeMemSetStr((Mem *)v, z, n, enc, xDel);
+}
+
+/*
+** Free an sqlite3_value object
+*/
+SQLITE_PRIVATE void sqlite3ValueFree(sqlite3_value *v){
+ if( !v ) return;
+ sqlite3VdbeMemRelease((Mem *)v);
+ sqlite3DbFreeNN(((Mem*)v)->db, v);
+}
+
+/*
+** The sqlite3ValueBytes() routine returns the number of bytes in the
+** sqlite3_value object assuming that it uses the encoding "enc".
+** The valueBytes() routine is a helper function.
+*/
+static SQLITE_NOINLINE int valueBytes(sqlite3_value *pVal, u8 enc){
+ return valueToText(pVal, enc)!=0 ? pVal->n : 0;
+}
+SQLITE_PRIVATE int sqlite3ValueBytes(sqlite3_value *pVal, u8 enc){
+ Mem *p = (Mem*)pVal;
+ assert( (p->flags & MEM_Null)==0 || (p->flags & (MEM_Str|MEM_Blob))==0 );
+ if( (p->flags & MEM_Str)!=0 && pVal->enc==enc ){
+ return p->n;
+ }
+ if( (p->flags & MEM_Str)!=0 && enc!=SQLITE_UTF8 && pVal->enc!=SQLITE_UTF8 ){
+ return p->n;
+ }
+ if( (p->flags & MEM_Blob)!=0 ){
+ if( p->flags & MEM_Zero ){
+ return p->n + p->u.nZero;
+ }else{
+ return p->n;
+ }
+ }
+ if( p->flags & MEM_Null ) return 0;
+ return valueBytes(pVal, enc);
+}
+
+/************** End of vdbemem.c *********************************************/
+/************** Begin file vdbeaux.c *****************************************/
+/*
+** 2003 September 6
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This file contains code used for creating, destroying, and populating
+** a VDBE (or an "sqlite3_stmt" as it is known to the outside world.)
+*/
+/* #include "sqliteInt.h" */
+/* #include "vdbeInt.h" */
+
+/* Forward references */
+static void freeEphemeralFunction(sqlite3 *db, FuncDef *pDef);
+static void vdbeFreeOpArray(sqlite3 *, Op *, int);
+
+/*
+** Create a new virtual database engine.
+*/
+SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(Parse *pParse){
+ sqlite3 *db = pParse->db;
+ Vdbe *p;
+ p = sqlite3DbMallocRawNN(db, sizeof(Vdbe) );
+ if( p==0 ) return 0;
+ memset(&p->aOp, 0, sizeof(Vdbe)-offsetof(Vdbe,aOp));
+ p->db = db;
+ if( db->pVdbe ){
+ db->pVdbe->ppVPrev = &p->pVNext;
+ }
+ p->pVNext = db->pVdbe;
+ p->ppVPrev = &db->pVdbe;
+ db->pVdbe = p;
+ assert( p->eVdbeState==VDBE_INIT_STATE );
+ p->pParse = pParse;
+ pParse->pVdbe = p;
+ assert( pParse->aLabel==0 );
+ assert( pParse->nLabel==0 );
+ assert( p->nOpAlloc==0 );
+ assert( pParse->szOpAlloc==0 );
+ sqlite3VdbeAddOp2(p, OP_Init, 0, 1);
+ return p;
+}
+
+/*
+** Return the Parse object that owns a Vdbe object.
+*/
+SQLITE_PRIVATE Parse *sqlite3VdbeParser(Vdbe *p){
+ return p->pParse;
+}
+
+/*
+** Change the error string stored in Vdbe.zErrMsg
+*/
+SQLITE_PRIVATE void sqlite3VdbeError(Vdbe *p, const char *zFormat, ...){
+ va_list ap;
+ sqlite3DbFree(p->db, p->zErrMsg);
+ va_start(ap, zFormat);
+ p->zErrMsg = sqlite3VMPrintf(p->db, zFormat, ap);
+ va_end(ap);
+}
+
+/*
+** Remember the SQL string for a prepared statement.
+*/
+SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe *p, const char *z, int n, u8 prepFlags){
+ if( p==0 ) return;
+ p->prepFlags = prepFlags;
+ if( (prepFlags & SQLITE_PREPARE_SAVESQL)==0 ){
+ p->expmask = 0;
+ }
+ assert( p->zSql==0 );
+ p->zSql = sqlite3DbStrNDup(p->db, z, n);
+}
+
+#ifdef SQLITE_ENABLE_NORMALIZE
+/*
+** Add a new element to the Vdbe->pDblStr list.
+*/
+SQLITE_PRIVATE void sqlite3VdbeAddDblquoteStr(sqlite3 *db, Vdbe *p, const char *z){
+ if( p ){
+ int n = sqlite3Strlen30(z);
+ DblquoteStr *pStr = sqlite3DbMallocRawNN(db,
+ sizeof(*pStr)+n+1-sizeof(pStr->z));
+ if( pStr ){
+ pStr->pNextStr = p->pDblStr;
+ p->pDblStr = pStr;
+ memcpy(pStr->z, z, n+1);
+ }
+ }
+}
+#endif
+
+#ifdef SQLITE_ENABLE_NORMALIZE
+/*
+** zId of length nId is a double-quoted identifier. Check to see if
+** that identifier is really used as a string literal.
+*/
+SQLITE_PRIVATE int sqlite3VdbeUsesDoubleQuotedString(
+ Vdbe *pVdbe, /* The prepared statement */
+ const char *zId /* The double-quoted identifier, already dequoted */
+){
+ DblquoteStr *pStr;
+ assert( zId!=0 );
+ if( pVdbe->pDblStr==0 ) return 0;
+ for(pStr=pVdbe->pDblStr; pStr; pStr=pStr->pNextStr){
+ if( strcmp(zId, pStr->z)==0 ) return 1;
+ }
+ return 0;
+}
+#endif
+
+/*
+** Swap byte-code between two VDBE structures.
+**
+** This happens after pB was previously run and returned
+** SQLITE_SCHEMA. The statement was then reprepared in pA.
+** This routine transfers the new bytecode in pA over to pB
+** so that pB can be run again. The old pB byte code is
+** moved back to pA so that it will be cleaned up when pA is
+** finalized.
+*/
+SQLITE_PRIVATE void sqlite3VdbeSwap(Vdbe *pA, Vdbe *pB){
+ Vdbe tmp, *pTmp, **ppTmp;
+ char *zTmp;
+ assert( pA->db==pB->db );
+ tmp = *pA;
+ *pA = *pB;
+ *pB = tmp;
+ pTmp = pA->pVNext;
+ pA->pVNext = pB->pVNext;
+ pB->pVNext = pTmp;
+ ppTmp = pA->ppVPrev;
+ pA->ppVPrev = pB->ppVPrev;
+ pB->ppVPrev = ppTmp;
+ zTmp = pA->zSql;
+ pA->zSql = pB->zSql;
+ pB->zSql = zTmp;
+#ifdef SQLITE_ENABLE_NORMALIZE
+ zTmp = pA->zNormSql;
+ pA->zNormSql = pB->zNormSql;
+ pB->zNormSql = zTmp;
+#endif
+ pB->expmask = pA->expmask;
+ pB->prepFlags = pA->prepFlags;
+ memcpy(pB->aCounter, pA->aCounter, sizeof(pB->aCounter));
+ pB->aCounter[SQLITE_STMTSTATUS_REPREPARE]++;
+}
+
+/*
+** Resize the Vdbe.aOp array so that it is at least nOp elements larger
+** than its current size. nOp is guaranteed to be less than or equal
+** to 1024/sizeof(Op).
+**
+** If an out-of-memory error occurs while resizing the array, return
+** SQLITE_NOMEM. In this case Vdbe.aOp and Vdbe.nOpAlloc remain
+** unchanged (this is so that any opcodes already allocated can be
+** correctly deallocated along with the rest of the Vdbe).
+*/
+static int growOpArray(Vdbe *v, int nOp){
+ VdbeOp *pNew;
+ Parse *p = v->pParse;
+
+ /* The SQLITE_TEST_REALLOC_STRESS compile-time option is designed to force
+ ** more frequent reallocs and hence provide more opportunities for
+ ** simulated OOM faults. SQLITE_TEST_REALLOC_STRESS is generally used
+ ** during testing only. With SQLITE_TEST_REALLOC_STRESS grow the op array
+ ** by the minimum* amount required until the size reaches 512. Normal
+ ** operation (without SQLITE_TEST_REALLOC_STRESS) is to double the current
+ ** size of the op array or add 1KB of space, whichever is smaller. */
+#ifdef SQLITE_TEST_REALLOC_STRESS
+ sqlite3_int64 nNew = (v->nOpAlloc>=512 ? 2*(sqlite3_int64)v->nOpAlloc
+ : (sqlite3_int64)v->nOpAlloc+nOp);
+#else
+ sqlite3_int64 nNew = (v->nOpAlloc ? 2*(sqlite3_int64)v->nOpAlloc
+ : (sqlite3_int64)(1024/sizeof(Op)));
+ UNUSED_PARAMETER(nOp);
+#endif
+
+ /* Ensure that the size of a VDBE does not grow too large */
+ if( nNew > p->db->aLimit[SQLITE_LIMIT_VDBE_OP] ){
+ sqlite3OomFault(p->db);
+ return SQLITE_NOMEM;
+ }
+
+ assert( nOp<=(int)(1024/sizeof(Op)) );
+ assert( nNew>=(v->nOpAlloc+nOp) );
+ pNew = sqlite3DbRealloc(p->db, v->aOp, nNew*sizeof(Op));
+ if( pNew ){
+ p->szOpAlloc = sqlite3DbMallocSize(p->db, pNew);
+ v->nOpAlloc = p->szOpAlloc/sizeof(Op);
+ v->aOp = pNew;
+ }
+ return (pNew ? SQLITE_OK : SQLITE_NOMEM_BKPT);
+}
+
+#ifdef SQLITE_DEBUG
+/* This routine is just a convenient place to set a breakpoint that will
+** fire after each opcode is inserted and displayed using
+** "PRAGMA vdbe_addoptrace=on". Parameters "pc" (program counter) and
+** pOp are available to make the breakpoint conditional.
+**
+** Other useful labels for breakpoints include:
+** test_trace_breakpoint(pc,pOp)
+** sqlite3CorruptError(lineno)
+** sqlite3MisuseError(lineno)
+** sqlite3CantopenError(lineno)
+*/
+static void test_addop_breakpoint(int pc, Op *pOp){
+ static u64 n = 0;
+ (void)pc;
+ (void)pOp;
+ n++;
+ if( n==LARGEST_UINT64 ) abort(); /* so that n is used, preventing a warning */
+}
+#endif
+
+/*
+** Slow paths for sqlite3VdbeAddOp3() and sqlite3VdbeAddOp4Int() for the
+** unusual case when we need to increase the size of the Vdbe.aOp[] array
+** before adding the new opcode.
+*/
+static SQLITE_NOINLINE int growOp3(Vdbe *p, int op, int p1, int p2, int p3){
+ assert( p->nOpAlloc<=p->nOp );
+ if( growOpArray(p, 1) ) return 1;
+ assert( p->nOpAlloc>p->nOp );
+ return sqlite3VdbeAddOp3(p, op, p1, p2, p3);
+}
+static SQLITE_NOINLINE int addOp4IntSlow(
+ Vdbe *p, /* Add the opcode to this VM */
+ int op, /* The new opcode */
+ int p1, /* The P1 operand */
+ int p2, /* The P2 operand */
+ int p3, /* The P3 operand */
+ int p4 /* The P4 operand as an integer */
+){
+ int addr = sqlite3VdbeAddOp3(p, op, p1, p2, p3);
+ if( p->db->mallocFailed==0 ){
+ VdbeOp *pOp = &p->aOp[addr];
+ pOp->p4type = P4_INT32;
+ pOp->p4.i = p4;
+ }
+ return addr;
+}
+
+
+/*
+** Add a new instruction to the list of instructions current in the
+** VDBE. Return the address of the new instruction.
+**
+** Parameters:
+**
+** p Pointer to the VDBE
+**
+** op The opcode for this instruction
+**
+** p1, p2, p3, p4 Operands
+*/
+SQLITE_PRIVATE int sqlite3VdbeAddOp0(Vdbe *p, int op){
+ return sqlite3VdbeAddOp3(p, op, 0, 0, 0);
+}
+SQLITE_PRIVATE int sqlite3VdbeAddOp1(Vdbe *p, int op, int p1){
+ return sqlite3VdbeAddOp3(p, op, p1, 0, 0);
+}
+SQLITE_PRIVATE int sqlite3VdbeAddOp2(Vdbe *p, int op, int p1, int p2){
+ return sqlite3VdbeAddOp3(p, op, p1, p2, 0);
+}
+SQLITE_PRIVATE int sqlite3VdbeAddOp3(Vdbe *p, int op, int p1, int p2, int p3){
+ int i;
+ VdbeOp *pOp;
+
+ i = p->nOp;
+ assert( p->eVdbeState==VDBE_INIT_STATE );
+ assert( op>=0 && op<0xff );
+ if( p->nOpAlloc<=i ){
+ return growOp3(p, op, p1, p2, p3);
+ }
+ assert( p->aOp!=0 );
+ p->nOp++;
+ pOp = &p->aOp[i];
+ assert( pOp!=0 );
+ pOp->opcode = (u8)op;
+ pOp->p5 = 0;
+ pOp->p1 = p1;
+ pOp->p2 = p2;
+ pOp->p3 = p3;
+ pOp->p4.p = 0;
+ pOp->p4type = P4_NOTUSED;
+
+ /* Replicate this logic in sqlite3VdbeAddOp4Int()
+ ** vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv */
+#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
+ pOp->zComment = 0;
+#endif
+#if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || defined(VDBE_PROFILE)
+ pOp->nExec = 0;
+ pOp->nCycle = 0;
+#endif
+#ifdef SQLITE_DEBUG
+ if( p->db->flags & SQLITE_VdbeAddopTrace ){
+ sqlite3VdbePrintOp(0, i, &p->aOp[i]);
+ test_addop_breakpoint(i, &p->aOp[i]);
+ }
+#endif
+#ifdef SQLITE_VDBE_COVERAGE
+ pOp->iSrcLine = 0;
+#endif
+ /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ ** Replicate in sqlite3VdbeAddOp4Int() */
+
+ return i;
+}
+SQLITE_PRIVATE int sqlite3VdbeAddOp4Int(
+ Vdbe *p, /* Add the opcode to this VM */
+ int op, /* The new opcode */
+ int p1, /* The P1 operand */
+ int p2, /* The P2 operand */
+ int p3, /* The P3 operand */
+ int p4 /* The P4 operand as an integer */
+){
+ int i;
+ VdbeOp *pOp;
+
+ i = p->nOp;
+ if( p->nOpAlloc<=i ){
+ return addOp4IntSlow(p, op, p1, p2, p3, p4);
+ }
+ p->nOp++;
+ pOp = &p->aOp[i];
+ assert( pOp!=0 );
+ pOp->opcode = (u8)op;
+ pOp->p5 = 0;
+ pOp->p1 = p1;
+ pOp->p2 = p2;
+ pOp->p3 = p3;
+ pOp->p4.i = p4;
+ pOp->p4type = P4_INT32;
+
+ /* Replicate this logic in sqlite3VdbeAddOp3()
+ ** vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv */
+#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
+ pOp->zComment = 0;
+#endif
+#if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || defined(VDBE_PROFILE)
+ pOp->nExec = 0;
+ pOp->nCycle = 0;
+#endif
+#ifdef SQLITE_DEBUG
+ if( p->db->flags & SQLITE_VdbeAddopTrace ){
+ sqlite3VdbePrintOp(0, i, &p->aOp[i]);
+ test_addop_breakpoint(i, &p->aOp[i]);
+ }
+#endif
+#ifdef SQLITE_VDBE_COVERAGE
+ pOp->iSrcLine = 0;
+#endif
+ /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ ** Replicate in sqlite3VdbeAddOp3() */
+
+ return i;
+}
+
+/* Generate code for an unconditional jump to instruction iDest
+*/
+SQLITE_PRIVATE int sqlite3VdbeGoto(Vdbe *p, int iDest){
+ return sqlite3VdbeAddOp3(p, OP_Goto, 0, iDest, 0);
+}
+
+/* Generate code to cause the string zStr to be loaded into
+** register iDest
+*/
+SQLITE_PRIVATE int sqlite3VdbeLoadString(Vdbe *p, int iDest, const char *zStr){
+ return sqlite3VdbeAddOp4(p, OP_String8, 0, iDest, 0, zStr, 0);
+}
+
+/*
+** Generate code that initializes multiple registers to string or integer
+** constants. The registers begin with iDest and increase consecutively.
+** One register is initialized for each characgter in zTypes[]. For each
+** "s" character in zTypes[], the register is a string if the argument is
+** not NULL, or OP_Null if the value is a null pointer. For each "i" character
+** in zTypes[], the register is initialized to an integer.
+**
+** If the input string does not end with "X" then an OP_ResultRow instruction
+** is generated for the values inserted.
+*/
+SQLITE_PRIVATE void sqlite3VdbeMultiLoad(Vdbe *p, int iDest, const char *zTypes, ...){
+ va_list ap;
+ int i;
+ char c;
+ va_start(ap, zTypes);
+ for(i=0; (c = zTypes[i])!=0; i++){
+ if( c=='s' ){
+ const char *z = va_arg(ap, const char*);
+ sqlite3VdbeAddOp4(p, z==0 ? OP_Null : OP_String8, 0, iDest+i, 0, z, 0);
+ }else if( c=='i' ){
+ sqlite3VdbeAddOp2(p, OP_Integer, va_arg(ap, int), iDest+i);
+ }else{
+ goto skip_op_resultrow;
+ }
+ }
+ sqlite3VdbeAddOp2(p, OP_ResultRow, iDest, i);
+skip_op_resultrow:
+ va_end(ap);
+}
+
+/*
+** Add an opcode that includes the p4 value as a pointer.
+*/
+SQLITE_PRIVATE int sqlite3VdbeAddOp4(
+ Vdbe *p, /* Add the opcode to this VM */
+ int op, /* The new opcode */
+ int p1, /* The P1 operand */
+ int p2, /* The P2 operand */
+ int p3, /* The P3 operand */
+ const char *zP4, /* The P4 operand */
+ int p4type /* P4 operand type */
+){
+ int addr = sqlite3VdbeAddOp3(p, op, p1, p2, p3);
+ sqlite3VdbeChangeP4(p, addr, zP4, p4type);
+ return addr;
+}
+
+/*
+** Add an OP_Function or OP_PureFunc opcode.
+**
+** The eCallCtx argument is information (typically taken from Expr.op2)
+** that describes the calling context of the function. 0 means a general
+** function call. NC_IsCheck means called by a check constraint,
+** NC_IdxExpr means called as part of an index expression. NC_PartIdx
+** means in the WHERE clause of a partial index. NC_GenCol means called
+** while computing a generated column value. 0 is the usual case.
+*/
+SQLITE_PRIVATE int sqlite3VdbeAddFunctionCall(
+ Parse *pParse, /* Parsing context */
+ int p1, /* Constant argument mask */
+ int p2, /* First argument register */
+ int p3, /* Register into which results are written */
+ int nArg, /* Number of argument */
+ const FuncDef *pFunc, /* The function to be invoked */
+ int eCallCtx /* Calling context */
+){
+ Vdbe *v = pParse->pVdbe;
+ int nByte;
+ int addr;
+ sqlite3_context *pCtx;
+ assert( v );
+ nByte = sizeof(*pCtx) + (nArg-1)*sizeof(sqlite3_value*);
+ pCtx = sqlite3DbMallocRawNN(pParse->db, nByte);
+ if( pCtx==0 ){
+ assert( pParse->db->mallocFailed );
+ freeEphemeralFunction(pParse->db, (FuncDef*)pFunc);
+ return 0;
+ }
+ pCtx->pOut = 0;
+ pCtx->pFunc = (FuncDef*)pFunc;
+ pCtx->pVdbe = 0;
+ pCtx->isError = 0;
+ pCtx->argc = nArg;
+ pCtx->iOp = sqlite3VdbeCurrentAddr(v);
+ addr = sqlite3VdbeAddOp4(v, eCallCtx ? OP_PureFunc : OP_Function,
+ p1, p2, p3, (char*)pCtx, P4_FUNCCTX);
+ sqlite3VdbeChangeP5(v, eCallCtx & NC_SelfRef);
+ sqlite3MayAbort(pParse);
+ return addr;
+}
+
+/*
+** Add an opcode that includes the p4 value with a P4_INT64 or
+** P4_REAL type.
+*/
+SQLITE_PRIVATE int sqlite3VdbeAddOp4Dup8(
+ Vdbe *p, /* Add the opcode to this VM */
+ int op, /* The new opcode */
+ int p1, /* The P1 operand */
+ int p2, /* The P2 operand */
+ int p3, /* The P3 operand */
+ const u8 *zP4, /* The P4 operand */
+ int p4type /* P4 operand type */
+){
+ char *p4copy = sqlite3DbMallocRawNN(sqlite3VdbeDb(p), 8);
+ if( p4copy ) memcpy(p4copy, zP4, 8);
+ return sqlite3VdbeAddOp4(p, op, p1, p2, p3, p4copy, p4type);
+}
+
+#ifndef SQLITE_OMIT_EXPLAIN
+/*
+** Return the address of the current EXPLAIN QUERY PLAN baseline.
+** 0 means "none".
+*/
+SQLITE_PRIVATE int sqlite3VdbeExplainParent(Parse *pParse){
+ VdbeOp *pOp;
+ if( pParse->addrExplain==0 ) return 0;
+ pOp = sqlite3VdbeGetOp(pParse->pVdbe, pParse->addrExplain);
+ return pOp->p2;
+}
+
+/*
+** Set a debugger breakpoint on the following routine in order to
+** monitor the EXPLAIN QUERY PLAN code generation.
+*/
+#if defined(SQLITE_DEBUG)
+SQLITE_PRIVATE void sqlite3ExplainBreakpoint(const char *z1, const char *z2){
+ (void)z1;
+ (void)z2;
+}
+#endif
+
+/*
+** Add a new OP_Explain opcode.
+**
+** If the bPush flag is true, then make this opcode the parent for
+** subsequent Explains until sqlite3VdbeExplainPop() is called.
+*/
+SQLITE_PRIVATE int sqlite3VdbeExplain(Parse *pParse, u8 bPush, const char *zFmt, ...){
+ int addr = 0;
+#if !defined(SQLITE_DEBUG)
+ /* Always include the OP_Explain opcodes if SQLITE_DEBUG is defined.
+ ** But omit them (for performance) during production builds */
+ if( pParse->explain==2 || IS_STMT_SCANSTATUS(pParse->db) )
+#endif
+ {
+ char *zMsg;
+ Vdbe *v;
+ va_list ap;
+ int iThis;
+ va_start(ap, zFmt);
+ zMsg = sqlite3VMPrintf(pParse->db, zFmt, ap);
+ va_end(ap);
+ v = pParse->pVdbe;
+ iThis = v->nOp;
+ addr = sqlite3VdbeAddOp4(v, OP_Explain, iThis, pParse->addrExplain, 0,
+ zMsg, P4_DYNAMIC);
+ sqlite3ExplainBreakpoint(bPush?"PUSH":"", sqlite3VdbeGetLastOp(v)->p4.z);
+ if( bPush){
+ pParse->addrExplain = iThis;
+ }
+ sqlite3VdbeScanStatus(v, iThis, -1, -1, 0, 0);
+ }
+ return addr;
+}
+
+/*
+** Pop the EXPLAIN QUERY PLAN stack one level.
+*/
+SQLITE_PRIVATE void sqlite3VdbeExplainPop(Parse *pParse){
+ sqlite3ExplainBreakpoint("POP", 0);
+ pParse->addrExplain = sqlite3VdbeExplainParent(pParse);
+}
+#endif /* SQLITE_OMIT_EXPLAIN */
+
+/*
+** Add an OP_ParseSchema opcode. This routine is broken out from
+** sqlite3VdbeAddOp4() since it needs to also needs to mark all btrees
+** as having been used.
+**
+** The zWhere string must have been obtained from sqlite3_malloc().
+** This routine will take ownership of the allocated memory.
+*/
+SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe *p, int iDb, char *zWhere, u16 p5){
+ int j;
+ sqlite3VdbeAddOp4(p, OP_ParseSchema, iDb, 0, 0, zWhere, P4_DYNAMIC);
+ sqlite3VdbeChangeP5(p, p5);
+ for(j=0; j<p->db->nDb; j++) sqlite3VdbeUsesBtree(p, j);
+ sqlite3MayAbort(p->pParse);
+}
+
+/* Insert the end of a co-routine
+*/
+SQLITE_PRIVATE void sqlite3VdbeEndCoroutine(Vdbe *v, int regYield){
+ sqlite3VdbeAddOp1(v, OP_EndCoroutine, regYield);
+
+ /* Clear the temporary register cache, thereby ensuring that each
+ ** co-routine has its own independent set of registers, because co-routines
+ ** might expect their registers to be preserved across an OP_Yield, and
+ ** that could cause problems if two or more co-routines are using the same
+ ** temporary register.
+ */
+ v->pParse->nTempReg = 0;
+ v->pParse->nRangeReg = 0;
+}
+
+/*
+** Create a new symbolic label for an instruction that has yet to be
+** coded. The symbolic label is really just a negative number. The
+** label can be used as the P2 value of an operation. Later, when
+** the label is resolved to a specific address, the VDBE will scan
+** through its operation list and change all values of P2 which match
+** the label into the resolved address.
+**
+** The VDBE knows that a P2 value is a label because labels are
+** always negative and P2 values are suppose to be non-negative.
+** Hence, a negative P2 value is a label that has yet to be resolved.
+** (Later:) This is only true for opcodes that have the OPFLG_JUMP
+** property.
+**
+** Variable usage notes:
+**
+** Parse.aLabel[x] Stores the address that the x-th label resolves
+** into. For testing (SQLITE_DEBUG), unresolved
+** labels stores -1, but that is not required.
+** Parse.nLabelAlloc Number of slots allocated to Parse.aLabel[]
+** Parse.nLabel The *negative* of the number of labels that have
+** been issued. The negative is stored because
+** that gives a performance improvement over storing
+** the equivalent positive value.
+*/
+SQLITE_PRIVATE int sqlite3VdbeMakeLabel(Parse *pParse){
+ return --pParse->nLabel;
+}
+
+/*
+** Resolve label "x" to be the address of the next instruction to
+** be inserted. The parameter "x" must have been obtained from
+** a prior call to sqlite3VdbeMakeLabel().
+*/
+static SQLITE_NOINLINE void resizeResolveLabel(Parse *p, Vdbe *v, int j){
+ int nNewSize = 10 - p->nLabel;
+ p->aLabel = sqlite3DbReallocOrFree(p->db, p->aLabel,
+ nNewSize*sizeof(p->aLabel[0]));
+ if( p->aLabel==0 ){
+ p->nLabelAlloc = 0;
+ }else{
+#ifdef SQLITE_DEBUG
+ int i;
+ for(i=p->nLabelAlloc; i<nNewSize; i++) p->aLabel[i] = -1;
+#endif
+ if( nNewSize>=100 && (nNewSize/100)>(p->nLabelAlloc/100) ){
+ sqlite3ProgressCheck(p);
+ }
+ p->nLabelAlloc = nNewSize;
+ p->aLabel[j] = v->nOp;
+ }
+}
+SQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe *v, int x){
+ Parse *p = v->pParse;
+ int j = ADDR(x);
+ assert( v->eVdbeState==VDBE_INIT_STATE );
+ assert( j<-p->nLabel );
+ assert( j>=0 );
+#ifdef SQLITE_DEBUG
+ if( p->db->flags & SQLITE_VdbeAddopTrace ){
+ printf("RESOLVE LABEL %d to %d\n", x, v->nOp);
+ }
+#endif
+ if( p->nLabelAlloc + p->nLabel < 0 ){
+ resizeResolveLabel(p,v,j);
+ }else{
+ assert( p->aLabel[j]==(-1) ); /* Labels may only be resolved once */
+ p->aLabel[j] = v->nOp;
+ }
+}
+
+/*
+** Mark the VDBE as one that can only be run one time.
+*/
+SQLITE_PRIVATE void sqlite3VdbeRunOnlyOnce(Vdbe *p){
+ sqlite3VdbeAddOp2(p, OP_Expire, 1, 1);
+}
+
+/*
+** Mark the VDBE as one that can be run multiple times.
+*/
+SQLITE_PRIVATE void sqlite3VdbeReusable(Vdbe *p){
+ int i;
+ for(i=1; ALWAYS(i<p->nOp); i++){
+ if( ALWAYS(p->aOp[i].opcode==OP_Expire) ){
+ p->aOp[1].opcode = OP_Noop;
+ break;
+ }
+ }
+}
+
+#ifdef SQLITE_DEBUG /* sqlite3AssertMayAbort() logic */
+
+/*
+** The following type and function are used to iterate through all opcodes
+** in a Vdbe main program and each of the sub-programs (triggers) it may
+** invoke directly or indirectly. It should be used as follows:
+**
+** Op *pOp;
+** VdbeOpIter sIter;
+**
+** memset(&sIter, 0, sizeof(sIter));
+** sIter.v = v; // v is of type Vdbe*
+** while( (pOp = opIterNext(&sIter)) ){
+** // Do something with pOp
+** }
+** sqlite3DbFree(v->db, sIter.apSub);
+**
+*/
+typedef struct VdbeOpIter VdbeOpIter;
+struct VdbeOpIter {
+ Vdbe *v; /* Vdbe to iterate through the opcodes of */
+ SubProgram **apSub; /* Array of subprograms */
+ int nSub; /* Number of entries in apSub */
+ int iAddr; /* Address of next instruction to return */
+ int iSub; /* 0 = main program, 1 = first sub-program etc. */
+};
+static Op *opIterNext(VdbeOpIter *p){
+ Vdbe *v = p->v;
+ Op *pRet = 0;
+ Op *aOp;
+ int nOp;
+
+ if( p->iSub<=p->nSub ){
+
+ if( p->iSub==0 ){
+ aOp = v->aOp;
+ nOp = v->nOp;
+ }else{
+ aOp = p->apSub[p->iSub-1]->aOp;
+ nOp = p->apSub[p->iSub-1]->nOp;
+ }
+ assert( p->iAddr<nOp );
+
+ pRet = &aOp[p->iAddr];
+ p->iAddr++;
+ if( p->iAddr==nOp ){
+ p->iSub++;
+ p->iAddr = 0;
+ }
+
+ if( pRet->p4type==P4_SUBPROGRAM ){
+ int nByte = (p->nSub+1)*sizeof(SubProgram*);
+ int j;
+ for(j=0; j<p->nSub; j++){
+ if( p->apSub[j]==pRet->p4.pProgram ) break;
+ }
+ if( j==p->nSub ){
+ p->apSub = sqlite3DbReallocOrFree(v->db, p->apSub, nByte);
+ if( !p->apSub ){
+ pRet = 0;
+ }else{
+ p->apSub[p->nSub++] = pRet->p4.pProgram;
+ }
+ }
+ }
+ }
+
+ return pRet;
+}
+
+/*
+** Check if the program stored in the VM associated with pParse may
+** throw an ABORT exception (causing the statement, but not entire transaction
+** to be rolled back). This condition is true if the main program or any
+** sub-programs contains any of the following:
+**
+** * OP_Halt with P1=SQLITE_CONSTRAINT and P2=OE_Abort.
+** * OP_HaltIfNull with P1=SQLITE_CONSTRAINT and P2=OE_Abort.
+** * OP_Destroy
+** * OP_VUpdate
+** * OP_VCreate
+** * OP_VRename
+** * OP_FkCounter with P2==0 (immediate foreign key constraint)
+** * OP_CreateBtree/BTREE_INTKEY and OP_InitCoroutine
+** (for CREATE TABLE AS SELECT ...)
+**
+** Then check that the value of Parse.mayAbort is true if an
+** ABORT may be thrown, or false otherwise. Return true if it does
+** match, or false otherwise. This function is intended to be used as
+** part of an assert statement in the compiler. Similar to:
+**
+** assert( sqlite3VdbeAssertMayAbort(pParse->pVdbe, pParse->mayAbort) );
+*/
+SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *v, int mayAbort){
+ int hasAbort = 0;
+ int hasFkCounter = 0;
+ int hasCreateTable = 0;
+ int hasCreateIndex = 0;
+ int hasInitCoroutine = 0;
+ Op *pOp;
+ VdbeOpIter sIter;
+
+ if( v==0 ) return 0;
+ memset(&sIter, 0, sizeof(sIter));
+ sIter.v = v;
+
+ while( (pOp = opIterNext(&sIter))!=0 ){
+ int opcode = pOp->opcode;
+ if( opcode==OP_Destroy || opcode==OP_VUpdate || opcode==OP_VRename
+ || opcode==OP_VDestroy
+ || opcode==OP_VCreate
+ || opcode==OP_ParseSchema
+ || opcode==OP_Function || opcode==OP_PureFunc
+ || ((opcode==OP_Halt || opcode==OP_HaltIfNull)
+ && ((pOp->p1)!=SQLITE_OK && pOp->p2==OE_Abort))
+ ){
+ hasAbort = 1;
+ break;
+ }
+ if( opcode==OP_CreateBtree && pOp->p3==BTREE_INTKEY ) hasCreateTable = 1;
+ if( mayAbort ){
+ /* hasCreateIndex may also be set for some DELETE statements that use
+ ** OP_Clear. So this routine may end up returning true in the case
+ ** where a "DELETE FROM tbl" has a statement-journal but does not
+ ** require one. This is not so bad - it is an inefficiency, not a bug. */
+ if( opcode==OP_CreateBtree && pOp->p3==BTREE_BLOBKEY ) hasCreateIndex = 1;
+ if( opcode==OP_Clear ) hasCreateIndex = 1;
+ }
+ if( opcode==OP_InitCoroutine ) hasInitCoroutine = 1;
+#ifndef SQLITE_OMIT_FOREIGN_KEY
+ if( opcode==OP_FkCounter && pOp->p1==0 && pOp->p2==1 ){
+ hasFkCounter = 1;
+ }
+#endif
+ }
+ sqlite3DbFree(v->db, sIter.apSub);
+
+ /* Return true if hasAbort==mayAbort. Or if a malloc failure occurred.
+ ** If malloc failed, then the while() loop above may not have iterated
+ ** through all opcodes and hasAbort may be set incorrectly. Return
+ ** true for this case to prevent the assert() in the callers frame
+ ** from failing. */
+ return ( v->db->mallocFailed || hasAbort==mayAbort || hasFkCounter
+ || (hasCreateTable && hasInitCoroutine) || hasCreateIndex
+ );
+}
+#endif /* SQLITE_DEBUG - the sqlite3AssertMayAbort() function */
+
+#ifdef SQLITE_DEBUG
+/*
+** Increment the nWrite counter in the VDBE if the cursor is not an
+** ephemeral cursor, or if the cursor argument is NULL.
+*/
+SQLITE_PRIVATE void sqlite3VdbeIncrWriteCounter(Vdbe *p, VdbeCursor *pC){
+ if( pC==0
+ || (pC->eCurType!=CURTYPE_SORTER
+ && pC->eCurType!=CURTYPE_PSEUDO
+ && !pC->isEphemeral)
+ ){
+ p->nWrite++;
+ }
+}
+#endif
+
+#ifdef SQLITE_DEBUG
+/*
+** Assert if an Abort at this point in time might result in a corrupt
+** database.
+*/
+SQLITE_PRIVATE void sqlite3VdbeAssertAbortable(Vdbe *p){
+ assert( p->nWrite==0 || p->usesStmtJournal );
+}
+#endif
+
+/*
+** This routine is called after all opcodes have been inserted. It loops
+** through all the opcodes and fixes up some details.
+**
+** (1) For each jump instruction with a negative P2 value (a label)
+** resolve the P2 value to an actual address.
+**
+** (2) Compute the maximum number of arguments used by any SQL function
+** and store that value in *pMaxFuncArgs.
+**
+** (3) Update the Vdbe.readOnly and Vdbe.bIsReader flags to accurately
+** indicate what the prepared statement actually does.
+**
+** (4) (discontinued)
+**
+** (5) Reclaim the memory allocated for storing labels.
+**
+** This routine will only function correctly if the mkopcodeh.tcl generator
+** script numbers the opcodes correctly. Changes to this routine must be
+** coordinated with changes to mkopcodeh.tcl.
+*/
+static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){
+ int nMaxArgs = *pMaxFuncArgs;
+ Op *pOp;
+ Parse *pParse = p->pParse;
+ int *aLabel = pParse->aLabel;
+
+ assert( pParse->db->mallocFailed==0 ); /* tag-20230419-1 */
+ p->readOnly = 1;
+ p->bIsReader = 0;
+ pOp = &p->aOp[p->nOp-1];
+ assert( p->aOp[0].opcode==OP_Init );
+ while( 1 /* Loop terminates when it reaches the OP_Init opcode */ ){
+ /* Only JUMP opcodes and the short list of special opcodes in the switch
+ ** below need to be considered. The mkopcodeh.tcl generator script groups
+ ** all these opcodes together near the front of the opcode list. Skip
+ ** any opcode that does not need processing by virtual of the fact that
+ ** it is larger than SQLITE_MX_JUMP_OPCODE, as a performance optimization.
+ */
+ if( pOp->opcode<=SQLITE_MX_JUMP_OPCODE ){
+ /* NOTE: Be sure to update mkopcodeh.tcl when adding or removing
+ ** cases from this switch! */
+ switch( pOp->opcode ){
+ case OP_Transaction: {
+ if( pOp->p2!=0 ) p->readOnly = 0;
+ /* no break */ deliberate_fall_through
+ }
+ case OP_AutoCommit:
+ case OP_Savepoint: {
+ p->bIsReader = 1;
+ break;
+ }
+#ifndef SQLITE_OMIT_WAL
+ case OP_Checkpoint:
+#endif
+ case OP_Vacuum:
+ case OP_JournalMode: {
+ p->readOnly = 0;
+ p->bIsReader = 1;
+ break;
+ }
+ case OP_Init: {
+ assert( pOp->p2>=0 );
+ goto resolve_p2_values_loop_exit;
+ }
+#ifndef SQLITE_OMIT_VIRTUALTABLE
+ case OP_VUpdate: {
+ if( pOp->p2>nMaxArgs ) nMaxArgs = pOp->p2;
+ break;
+ }
+ case OP_VFilter: {
+ int n;
+ assert( (pOp - p->aOp) >= 3 );
+ assert( pOp[-1].opcode==OP_Integer );
+ n = pOp[-1].p1;
+ if( n>nMaxArgs ) nMaxArgs = n;
+ /* Fall through into the default case */
+ /* no break */ deliberate_fall_through
+ }
+#endif
+ default: {
+ if( pOp->p2<0 ){
+ /* The mkopcodeh.tcl script has so arranged things that the only
+ ** non-jump opcodes less than SQLITE_MX_JUMP_CODE are guaranteed to
+ ** have non-negative values for P2. */
+ assert( (sqlite3OpcodeProperty[pOp->opcode] & OPFLG_JUMP)!=0 );
+ assert( ADDR(pOp->p2)<-pParse->nLabel );
+ assert( aLabel!=0 ); /* True because of tag-20230419-1 */
+ pOp->p2 = aLabel[ADDR(pOp->p2)];
+ }
+
+ /* OPFLG_JUMP opcodes never have P2==0, though OPFLG_JUMP0 opcodes
+ ** might */
+ assert( pOp->p2>0
+ || (sqlite3OpcodeProperty[pOp->opcode] & OPFLG_JUMP0)!=0 );
+
+ /* Jumps never go off the end of the bytecode array */
+ assert( pOp->p2<p->nOp
+ || (sqlite3OpcodeProperty[pOp->opcode] & OPFLG_JUMP)==0 );
+ break;
+ }
+ }
+ /* The mkopcodeh.tcl script has so arranged things that the only
+ ** non-jump opcodes less than SQLITE_MX_JUMP_CODE are guaranteed to
+ ** have non-negative values for P2. */
+ assert( (sqlite3OpcodeProperty[pOp->opcode]&OPFLG_JUMP)==0 || pOp->p2>=0);
+ }
+ assert( pOp>p->aOp );
+ pOp--;
+ }
+resolve_p2_values_loop_exit:
+ if( aLabel ){
+ sqlite3DbNNFreeNN(p->db, pParse->aLabel);
+ pParse->aLabel = 0;
+ }
+ pParse->nLabel = 0;
+ *pMaxFuncArgs = nMaxArgs;
+ assert( p->bIsReader!=0 || DbMaskAllZero(p->btreeMask) );
+}
+
+#ifdef SQLITE_DEBUG
+/*
+** Check to see if a subroutine contains a jump to a location outside of
+** the subroutine. If a jump outside the subroutine is detected, add code
+** that will cause the program to halt with an error message.
+**
+** The subroutine consists of opcodes between iFirst and iLast. Jumps to
+** locations within the subroutine are acceptable. iRetReg is a register
+** that contains the return address. Jumps to outside the range of iFirst
+** through iLast are also acceptable as long as the jump destination is
+** an OP_Return to iReturnAddr.
+**
+** A jump to an unresolved label means that the jump destination will be
+** beyond the current address. That is normally a jump to an early
+** termination and is consider acceptable.
+**
+** This routine only runs during debug builds. The purpose is (of course)
+** to detect invalid escapes out of a subroutine. The OP_Halt opcode
+** is generated rather than an assert() or other error, so that ".eqp full"
+** will still work to show the original bytecode, to aid in debugging.
+*/
+SQLITE_PRIVATE void sqlite3VdbeNoJumpsOutsideSubrtn(
+ Vdbe *v, /* The byte-code program under construction */
+ int iFirst, /* First opcode of the subroutine */
+ int iLast, /* Last opcode of the subroutine */
+ int iRetReg /* Subroutine return address register */
+){
+ VdbeOp *pOp;
+ Parse *pParse;
+ int i;
+ sqlite3_str *pErr = 0;
+ assert( v!=0 );
+ pParse = v->pParse;
+ assert( pParse!=0 );
+ if( pParse->nErr ) return;
+ assert( iLast>=iFirst );
+ assert( iLast<v->nOp );
+ pOp = &v->aOp[iFirst];
+ for(i=iFirst; i<=iLast; i++, pOp++){
+ if( (sqlite3OpcodeProperty[pOp->opcode] & OPFLG_JUMP)!=0 ){
+ int iDest = pOp->p2; /* Jump destination */
+ if( iDest==0 ) continue;
+ if( pOp->opcode==OP_Gosub ) continue;
+ if( pOp->p3==20230325 && pOp->opcode==OP_NotNull ){
+ /* This is a deliberately taken illegal branch. tag-20230325-2 */
+ continue;
+ }
+ if( iDest<0 ){
+ int j = ADDR(iDest);
+ assert( j>=0 );
+ if( j>=-pParse->nLabel || pParse->aLabel[j]<0 ){
+ continue;
+ }
+ iDest = pParse->aLabel[j];
+ }
+ if( iDest<iFirst || iDest>iLast ){
+ int j = iDest;
+ for(; j<v->nOp; j++){
+ VdbeOp *pX = &v->aOp[j];
+ if( pX->opcode==OP_Return ){
+ if( pX->p1==iRetReg ) break;
+ continue;
+ }
+ if( pX->opcode==OP_Noop ) continue;
+ if( pX->opcode==OP_Explain ) continue;
+ if( pErr==0 ){
+ pErr = sqlite3_str_new(0);
+ }else{
+ sqlite3_str_appendchar(pErr, 1, '\n');
+ }
+ sqlite3_str_appendf(pErr,
+ "Opcode at %d jumps to %d which is outside the "
+ "subroutine at %d..%d",
+ i, iDest, iFirst, iLast);
+ break;
+ }
+ }
+ }
+ }
+ if( pErr ){
+ char *zErr = sqlite3_str_finish(pErr);
+ sqlite3VdbeAddOp4(v, OP_Halt, SQLITE_INTERNAL, OE_Abort, 0, zErr, 0);
+ sqlite3_free(zErr);
+ sqlite3MayAbort(pParse);
+ }
+}
+#endif /* SQLITE_DEBUG */
+
+/*
+** Return the address of the next instruction to be inserted.
+*/
+SQLITE_PRIVATE int sqlite3VdbeCurrentAddr(Vdbe *p){
+ assert( p->eVdbeState==VDBE_INIT_STATE );
+ return p->nOp;
+}
+
+/*
+** Verify that at least N opcode slots are available in p without
+** having to malloc for more space (except when compiled using
+** SQLITE_TEST_REALLOC_STRESS). This interface is used during testing
+** to verify that certain calls to sqlite3VdbeAddOpList() can never
+** fail due to a OOM fault and hence that the return value from
+** sqlite3VdbeAddOpList() will always be non-NULL.
+*/
+#if defined(SQLITE_DEBUG) && !defined(SQLITE_TEST_REALLOC_STRESS)
+SQLITE_PRIVATE void sqlite3VdbeVerifyNoMallocRequired(Vdbe *p, int N){
+ assert( p->nOp + N <= p->nOpAlloc );
+}
+#endif
+
+/*
+** Verify that the VM passed as the only argument does not contain
+** an OP_ResultRow opcode. Fail an assert() if it does. This is used
+** by code in pragma.c to ensure that the implementation of certain
+** pragmas comports with the flags specified in the mkpragmatab.tcl
+** script.
+*/
+#if defined(SQLITE_DEBUG) && !defined(SQLITE_TEST_REALLOC_STRESS)
+SQLITE_PRIVATE void sqlite3VdbeVerifyNoResultRow(Vdbe *p){
+ int i;
+ for(i=0; i<p->nOp; i++){
+ assert( p->aOp[i].opcode!=OP_ResultRow );
+ }
+}
+#endif
+
+/*
+** Generate code (a single OP_Abortable opcode) that will
+** verify that the VDBE program can safely call Abort in the current
+** context.
+*/
+#if defined(SQLITE_DEBUG)
+SQLITE_PRIVATE void sqlite3VdbeVerifyAbortable(Vdbe *p, int onError){
+ if( onError==OE_Abort ) sqlite3VdbeAddOp0(p, OP_Abortable);
+}
+#endif
+
+/*
+** This function returns a pointer to the array of opcodes associated with
+** the Vdbe passed as the first argument. It is the callers responsibility
+** to arrange for the returned array to be eventually freed using the
+** vdbeFreeOpArray() function.
+**
+** Before returning, *pnOp is set to the number of entries in the returned
+** array. Also, *pnMaxArg is set to the larger of its current value and
+** the number of entries in the Vdbe.apArg[] array required to execute the
+** returned program.
+*/
+SQLITE_PRIVATE VdbeOp *sqlite3VdbeTakeOpArray(Vdbe *p, int *pnOp, int *pnMaxArg){
+ VdbeOp *aOp = p->aOp;
+ assert( aOp && !p->db->mallocFailed );
+
+ /* Check that sqlite3VdbeUsesBtree() was not called on this VM */
+ assert( DbMaskAllZero(p->btreeMask) );
+
+ resolveP2Values(p, pnMaxArg);
+ *pnOp = p->nOp;
+ p->aOp = 0;
+ return aOp;
+}
+
+/*
+** Add a whole list of operations to the operation stack. Return a
+** pointer to the first operation inserted.
+**
+** Non-zero P2 arguments to jump instructions are automatically adjusted
+** so that the jump target is relative to the first operation inserted.
+*/
+SQLITE_PRIVATE VdbeOp *sqlite3VdbeAddOpList(
+ Vdbe *p, /* Add opcodes to the prepared statement */
+ int nOp, /* Number of opcodes to add */
+ VdbeOpList const *aOp, /* The opcodes to be added */
+ int iLineno /* Source-file line number of first opcode */
+){
+ int i;
+ VdbeOp *pOut, *pFirst;
+ assert( nOp>0 );
+ assert( p->eVdbeState==VDBE_INIT_STATE );
+ if( p->nOp + nOp > p->nOpAlloc && growOpArray(p, nOp) ){
+ return 0;
+ }
+ pFirst = pOut = &p->aOp[p->nOp];
+ for(i=0; i<nOp; i++, aOp++, pOut++){
+ pOut->opcode = aOp->opcode;
+ pOut->p1 = aOp->p1;
+ pOut->p2 = aOp->p2;
+ assert( aOp->p2>=0 );
+ if( (sqlite3OpcodeProperty[aOp->opcode] & OPFLG_JUMP)!=0 && aOp->p2>0 ){
+ pOut->p2 += p->nOp;
+ }
+ pOut->p3 = aOp->p3;
+ pOut->p4type = P4_NOTUSED;
+ pOut->p4.p = 0;
+ pOut->p5 = 0;
+#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
+ pOut->zComment = 0;
+#endif
+#ifdef SQLITE_VDBE_COVERAGE
+ pOut->iSrcLine = iLineno+i;
+#else
+ (void)iLineno;
+#endif
+#ifdef SQLITE_DEBUG
+ if( p->db->flags & SQLITE_VdbeAddopTrace ){
+ sqlite3VdbePrintOp(0, i+p->nOp, &p->aOp[i+p->nOp]);
+ }
+#endif
+ }
+ p->nOp += nOp;
+ return pFirst;
+}
+
+#if defined(SQLITE_ENABLE_STMT_SCANSTATUS)
+/*
+** Add an entry to the array of counters managed by sqlite3_stmt_scanstatus().
+*/
+SQLITE_PRIVATE void sqlite3VdbeScanStatus(
+ Vdbe *p, /* VM to add scanstatus() to */
+ int addrExplain, /* Address of OP_Explain (or 0) */
+ int addrLoop, /* Address of loop counter */
+ int addrVisit, /* Address of rows visited counter */
+ LogEst nEst, /* Estimated number of output rows */
+ const char *zName /* Name of table or index being scanned */
+){
+ if( IS_STMT_SCANSTATUS(p->db) ){
+ sqlite3_int64 nByte = (p->nScan+1) * sizeof(ScanStatus);
+ ScanStatus *aNew;
+ aNew = (ScanStatus*)sqlite3DbRealloc(p->db, p->aScan, nByte);
+ if( aNew ){
+ ScanStatus *pNew = &aNew[p->nScan++];
+ memset(pNew, 0, sizeof(ScanStatus));
+ pNew->addrExplain = addrExplain;
+ pNew->addrLoop = addrLoop;
+ pNew->addrVisit = addrVisit;
+ pNew->nEst = nEst;
+ pNew->zName = sqlite3DbStrDup(p->db, zName);
+ p->aScan = aNew;
+ }
+ }
+}
+
+/*
+** Add the range of instructions from addrStart to addrEnd (inclusive) to
+** the set of those corresponding to the sqlite3_stmt_scanstatus() counters
+** associated with the OP_Explain instruction at addrExplain. The
+** sum of the sqlite3Hwtime() values for each of these instructions
+** will be returned for SQLITE_SCANSTAT_NCYCLE requests.
+*/
+SQLITE_PRIVATE void sqlite3VdbeScanStatusRange(
+ Vdbe *p,
+ int addrExplain,
+ int addrStart,
+ int addrEnd
+){
+ if( IS_STMT_SCANSTATUS(p->db) ){
+ ScanStatus *pScan = 0;
+ int ii;
+ for(ii=p->nScan-1; ii>=0; ii--){
+ pScan = &p->aScan[ii];
+ if( pScan->addrExplain==addrExplain ) break;
+ pScan = 0;
+ }
+ if( pScan ){
+ if( addrEnd<0 ) addrEnd = sqlite3VdbeCurrentAddr(p)-1;
+ for(ii=0; ii<ArraySize(pScan->aAddrRange); ii+=2){
+ if( pScan->aAddrRange[ii]==0 ){
+ pScan->aAddrRange[ii] = addrStart;
+ pScan->aAddrRange[ii+1] = addrEnd;
+ break;
+ }
+ }
+ }
+ }
+}
+
+/*
+** Set the addresses for the SQLITE_SCANSTAT_NLOOP and SQLITE_SCANSTAT_NROW
+** counters for the query element associated with the OP_Explain at
+** addrExplain.
+*/
+SQLITE_PRIVATE void sqlite3VdbeScanStatusCounters(
+ Vdbe *p,
+ int addrExplain,
+ int addrLoop,
+ int addrVisit
+){
+ if( IS_STMT_SCANSTATUS(p->db) ){
+ ScanStatus *pScan = 0;
+ int ii;
+ for(ii=p->nScan-1; ii>=0; ii--){
+ pScan = &p->aScan[ii];
+ if( pScan->addrExplain==addrExplain ) break;
+ pScan = 0;
+ }
+ if( pScan ){
+ if( addrLoop>0 ) pScan->addrLoop = addrLoop;
+ if( addrVisit>0 ) pScan->addrVisit = addrVisit;
+ }
+ }
+}
+#endif /* defined(SQLITE_ENABLE_STMT_SCANSTATUS) */
+
+
+/*
+** Change the value of the opcode, or P1, P2, P3, or P5 operands
+** for a specific instruction.
+*/
+SQLITE_PRIVATE void sqlite3VdbeChangeOpcode(Vdbe *p, int addr, u8 iNewOpcode){
+ assert( addr>=0 );
+ sqlite3VdbeGetOp(p,addr)->opcode = iNewOpcode;
+}
+SQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe *p, int addr, int val){
+ assert( addr>=0 );
+ sqlite3VdbeGetOp(p,addr)->p1 = val;
+}
+SQLITE_PRIVATE void sqlite3VdbeChangeP2(Vdbe *p, int addr, int val){
+ assert( addr>=0 || p->db->mallocFailed );
+ sqlite3VdbeGetOp(p,addr)->p2 = val;
+}
+SQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe *p, int addr, int val){
+ assert( addr>=0 );
+ sqlite3VdbeGetOp(p,addr)->p3 = val;
+}
+SQLITE_PRIVATE void sqlite3VdbeChangeP5(Vdbe *p, u16 p5){
+ assert( p->nOp>0 || p->db->mallocFailed );
+ if( p->nOp>0 ) p->aOp[p->nOp-1].p5 = p5;
+}
+
+/*
+** If the previous opcode is an OP_Column that delivers results
+** into register iDest, then add the OPFLAG_TYPEOFARG flag to that
+** opcode.
+*/
+SQLITE_PRIVATE void sqlite3VdbeTypeofColumn(Vdbe *p, int iDest){
+ VdbeOp *pOp = sqlite3VdbeGetLastOp(p);
+ if( pOp->p3==iDest && pOp->opcode==OP_Column ){
+ pOp->p5 |= OPFLAG_TYPEOFARG;
+ }
+}
+
+/*
+** Change the P2 operand of instruction addr so that it points to
+** the address of the next instruction to be coded.
+*/
+SQLITE_PRIVATE void sqlite3VdbeJumpHere(Vdbe *p, int addr){
+ sqlite3VdbeChangeP2(p, addr, p->nOp);
+}
+
+/*
+** Change the P2 operand of the jump instruction at addr so that
+** the jump lands on the next opcode. Or if the jump instruction was
+** the previous opcode (and is thus a no-op) then simply back up
+** the next instruction counter by one slot so that the jump is
+** overwritten by the next inserted opcode.
+**
+** This routine is an optimization of sqlite3VdbeJumpHere() that
+** strives to omit useless byte-code like this:
+**
+** 7 Once 0 8 0
+** 8 ...
+*/
+SQLITE_PRIVATE void sqlite3VdbeJumpHereOrPopInst(Vdbe *p, int addr){
+ if( addr==p->nOp-1 ){
+ assert( p->aOp[addr].opcode==OP_Once
+ || p->aOp[addr].opcode==OP_If
+ || p->aOp[addr].opcode==OP_FkIfZero );
+ assert( p->aOp[addr].p4type==0 );
+#ifdef SQLITE_VDBE_COVERAGE
+ sqlite3VdbeGetLastOp(p)->iSrcLine = 0; /* Erase VdbeCoverage() macros */
+#endif
+ p->nOp--;
+ }else{
+ sqlite3VdbeChangeP2(p, addr, p->nOp);
+ }
+}
+
+
+/*
+** If the input FuncDef structure is ephemeral, then free it. If
+** the FuncDef is not ephemeral, then do nothing.
+*/
+static void freeEphemeralFunction(sqlite3 *db, FuncDef *pDef){
+ assert( db!=0 );
+ if( (pDef->funcFlags & SQLITE_FUNC_EPHEM)!=0 ){
+ sqlite3DbNNFreeNN(db, pDef);
+ }
+}
+
+/*
+** Delete a P4 value if necessary.
+*/
+static SQLITE_NOINLINE void freeP4Mem(sqlite3 *db, Mem *p){
+ if( p->szMalloc ) sqlite3DbFree(db, p->zMalloc);
+ sqlite3DbNNFreeNN(db, p);
+}
+static SQLITE_NOINLINE void freeP4FuncCtx(sqlite3 *db, sqlite3_context *p){
+ assert( db!=0 );
+ freeEphemeralFunction(db, p->pFunc);
+ sqlite3DbNNFreeNN(db, p);
+}
+static void freeP4(sqlite3 *db, int p4type, void *p4){
+ assert( db );
+ switch( p4type ){
+ case P4_FUNCCTX: {
+ freeP4FuncCtx(db, (sqlite3_context*)p4);
+ break;
+ }
+ case P4_REAL:
+ case P4_INT64:
+ case P4_DYNAMIC:
+ case P4_INTARRAY: {
+ if( p4 ) sqlite3DbNNFreeNN(db, p4);
+ break;
+ }
+ case P4_KEYINFO: {
+ if( db->pnBytesFreed==0 ) sqlite3KeyInfoUnref((KeyInfo*)p4);
+ break;
+ }
+#ifdef SQLITE_ENABLE_CURSOR_HINTS
+ case P4_EXPR: {
+ sqlite3ExprDelete(db, (Expr*)p4);
+ break;
+ }
+#endif
+ case P4_FUNCDEF: {
+ freeEphemeralFunction(db, (FuncDef*)p4);
+ break;
+ }
+ case P4_MEM: {
+ if( db->pnBytesFreed==0 ){
+ sqlite3ValueFree((sqlite3_value*)p4);
+ }else{
+ freeP4Mem(db, (Mem*)p4);
+ }
+ break;
+ }
+ case P4_VTAB : {
+ if( db->pnBytesFreed==0 ) sqlite3VtabUnlock((VTable *)p4);
+ break;
+ }
+ case P4_TABLEREF: {
+ if( db->pnBytesFreed==0 ) sqlite3DeleteTable(db, (Table*)p4);
+ break;
+ }
+ case P4_SUBRTNSIG: {
+ SubrtnSig *pSig = (SubrtnSig*)p4;
+ sqlite3DbFree(db, pSig->zAff);
+ sqlite3DbFree(db, pSig);
+ break;
+ }
+ }
+}
+
+/*
+** Free the space allocated for aOp and any p4 values allocated for the
+** opcodes contained within. If aOp is not NULL it is assumed to contain
+** nOp entries.
+*/
+static void vdbeFreeOpArray(sqlite3 *db, Op *aOp, int nOp){
+ assert( nOp>=0 );
+ assert( db!=0 );
+ if( aOp ){
+ Op *pOp = &aOp[nOp-1];
+ while(1){ /* Exit via break */
+ if( pOp->p4type <= P4_FREE_IF_LE ) freeP4(db, pOp->p4type, pOp->p4.p);
+#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
+ sqlite3DbFree(db, pOp->zComment);
+#endif
+ if( pOp==aOp ) break;
+ pOp--;
+ }
+ sqlite3DbNNFreeNN(db, aOp);
+ }
+}
+
+/*
+** Link the SubProgram object passed as the second argument into the linked
+** list at Vdbe.pSubProgram. This list is used to delete all sub-program
+** objects when the VM is no longer required.
+*/
+SQLITE_PRIVATE void sqlite3VdbeLinkSubProgram(Vdbe *pVdbe, SubProgram *p){
+ p->pNext = pVdbe->pProgram;
+ pVdbe->pProgram = p;
+}
+
+/*
+** Return true if the given Vdbe has any SubPrograms.
+*/
+SQLITE_PRIVATE int sqlite3VdbeHasSubProgram(Vdbe *pVdbe){
+ return pVdbe->pProgram!=0;
+}
+
+/*
+** Change the opcode at addr into OP_Noop
+*/
+SQLITE_PRIVATE int sqlite3VdbeChangeToNoop(Vdbe *p, int addr){
+ VdbeOp *pOp;
+ if( p->db->mallocFailed ) return 0;
+ assert( addr>=0 && addr<p->nOp );
+ pOp = &p->aOp[addr];
+ freeP4(p->db, pOp->p4type, pOp->p4.p);
+ pOp->p4type = P4_NOTUSED;
+ pOp->p4.z = 0;
+ pOp->opcode = OP_Noop;
+ return 1;
+}
+
+/*
+** If the last opcode is "op" and it is not a jump destination,
+** then remove it. Return true if and only if an opcode was removed.
+*/
+SQLITE_PRIVATE int sqlite3VdbeDeletePriorOpcode(Vdbe *p, u8 op){
+ if( p->nOp>0 && p->aOp[p->nOp-1].opcode==op ){
+ return sqlite3VdbeChangeToNoop(p, p->nOp-1);
+ }else{
+ return 0;
+ }
+}
+
+#ifdef SQLITE_DEBUG
+/*
+** Generate an OP_ReleaseReg opcode to indicate that a range of
+** registers, except any identified by mask, are no longer in use.
+*/
+SQLITE_PRIVATE void sqlite3VdbeReleaseRegisters(
+ Parse *pParse, /* Parsing context */
+ int iFirst, /* Index of first register to be released */
+ int N, /* Number of registers to release */
+ u32 mask, /* Mask of registers to NOT release */
+ int bUndefine /* If true, mark registers as undefined */
+){
+ if( N==0 || OptimizationDisabled(pParse->db, SQLITE_ReleaseReg) ) return;
+ assert( pParse->pVdbe );
+ assert( iFirst>=1 );
+ assert( iFirst+N-1<=pParse->nMem );
+ if( N<=31 && mask!=0 ){
+ while( N>0 && (mask&1)!=0 ){
+ mask >>= 1;
+ iFirst++;
+ N--;
+ }
+ while( N>0 && N<=32 && (mask & MASKBIT32(N-1))!=0 ){
+ mask &= ~MASKBIT32(N-1);
+ N--;
+ }
+ }
+ if( N>0 ){
+ sqlite3VdbeAddOp3(pParse->pVdbe, OP_ReleaseReg, iFirst, N, *(int*)&mask);
+ if( bUndefine ) sqlite3VdbeChangeP5(pParse->pVdbe, 1);
+ }
+}
+#endif /* SQLITE_DEBUG */
+
+/*
+** Change the value of the P4 operand for a specific instruction.
+** This routine is useful when a large program is loaded from a
+** static array using sqlite3VdbeAddOpList but we want to make a
+** few minor changes to the program.
+**
+** If n>=0 then the P4 operand is dynamic, meaning that a copy of
+** the string is made into memory obtained from sqlite3_malloc().
+** A value of n==0 means copy bytes of zP4 up to and including the
+** first null byte. If n>0 then copy n+1 bytes of zP4.
+**
+** Other values of n (P4_STATIC, P4_COLLSEQ etc.) indicate that zP4 points
+** to a string or structure that is guaranteed to exist for the lifetime of
+** the Vdbe. In these cases we can just copy the pointer.
+**
+** If addr<0 then change P4 on the most recently inserted instruction.
+*/
+static void SQLITE_NOINLINE vdbeChangeP4Full(
+ Vdbe *p,
+ Op *pOp,
+ const char *zP4,
+ int n
+){
+ if( pOp->p4type ){
+ assert( pOp->p4type > P4_FREE_IF_LE );
+ pOp->p4type = 0;
+ pOp->p4.p = 0;
+ }
+ if( n<0 ){
+ sqlite3VdbeChangeP4(p, (int)(pOp - p->aOp), zP4, n);
+ }else{
+ if( n==0 ) n = sqlite3Strlen30(zP4);
+ pOp->p4.z = sqlite3DbStrNDup(p->db, zP4, n);
+ pOp->p4type = P4_DYNAMIC;
+ }
+}
+SQLITE_PRIVATE void sqlite3VdbeChangeP4(Vdbe *p, int addr, const char *zP4, int n){
+ Op *pOp;
+ sqlite3 *db;
+ assert( p!=0 );
+ db = p->db;
+ assert( p->eVdbeState==VDBE_INIT_STATE );
+ assert( p->aOp!=0 || db->mallocFailed );
+ if( db->mallocFailed ){
+ if( n!=P4_VTAB ) freeP4(db, n, (void*)*(char**)&zP4);
+ return;
+ }
+ assert( p->nOp>0 );
+ assert( addr<p->nOp );
+ if( addr<0 ){
+ addr = p->nOp - 1;
+ }
+ pOp = &p->aOp[addr];
+ if( n>=0 || pOp->p4type ){
+ vdbeChangeP4Full(p, pOp, zP4, n);
+ return;
+ }
+ if( n==P4_INT32 ){
+ /* Note: this cast is safe, because the origin data point was an int
+ ** that was cast to a (const char *). */
+ pOp->p4.i = SQLITE_PTR_TO_INT(zP4);
+ pOp->p4type = P4_INT32;
+ }else if( zP4!=0 ){
+ assert( n<0 );
+ pOp->p4.p = (void*)zP4;
+ pOp->p4type = (signed char)n;
+ if( n==P4_VTAB ) sqlite3VtabLock((VTable*)zP4);
+ }
+}
+
+/*
+** Change the P4 operand of the most recently coded instruction
+** to the value defined by the arguments. This is a high-speed
+** version of sqlite3VdbeChangeP4().
+**
+** The P4 operand must not have been previously defined. And the new
+** P4 must not be P4_INT32. Use sqlite3VdbeChangeP4() in either of
+** those cases.
+*/
+SQLITE_PRIVATE void sqlite3VdbeAppendP4(Vdbe *p, void *pP4, int n){
+ VdbeOp *pOp;
+ assert( n!=P4_INT32 && n!=P4_VTAB );
+ assert( n<=0 );
+ if( p->db->mallocFailed ){
+ freeP4(p->db, n, pP4);
+ }else{
+ assert( pP4!=0 || n==P4_DYNAMIC );
+ assert( p->nOp>0 );
+ pOp = &p->aOp[p->nOp-1];
+ assert( pOp->p4type==P4_NOTUSED );
+ pOp->p4type = n;
+ pOp->p4.p = pP4;
+ }
+}
+
+/*
+** Set the P4 on the most recently added opcode to the KeyInfo for the
+** index given.
+*/
+SQLITE_PRIVATE void sqlite3VdbeSetP4KeyInfo(Parse *pParse, Index *pIdx){
+ Vdbe *v = pParse->pVdbe;
+ KeyInfo *pKeyInfo;
+ assert( v!=0 );
+ assert( pIdx!=0 );
+ pKeyInfo = sqlite3KeyInfoOfIndex(pParse, pIdx);
+ if( pKeyInfo ) sqlite3VdbeAppendP4(v, pKeyInfo, P4_KEYINFO);
+}
+
+#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
+/*
+** Change the comment on the most recently coded instruction. Or
+** insert a No-op and add the comment to that new instruction. This
+** makes the code easier to read during debugging. None of this happens
+** in a production build.
+*/
+static void vdbeVComment(Vdbe *p, const char *zFormat, va_list ap){
+ assert( p->nOp>0 || p->aOp==0 );
+ assert( p->aOp==0 || p->aOp[p->nOp-1].zComment==0 || p->pParse->nErr>0 );
+ if( p->nOp ){
+ assert( p->aOp );
+ sqlite3DbFree(p->db, p->aOp[p->nOp-1].zComment);
+ p->aOp[p->nOp-1].zComment = sqlite3VMPrintf(p->db, zFormat, ap);
+ }
+}
+SQLITE_PRIVATE void sqlite3VdbeComment(Vdbe *p, const char *zFormat, ...){
+ va_list ap;
+ if( p ){
+ va_start(ap, zFormat);
+ vdbeVComment(p, zFormat, ap);
+ va_end(ap);
+ }
+}
+SQLITE_PRIVATE void sqlite3VdbeNoopComment(Vdbe *p, const char *zFormat, ...){
+ va_list ap;
+ if( p ){
+ sqlite3VdbeAddOp0(p, OP_Noop);
+ va_start(ap, zFormat);
+ vdbeVComment(p, zFormat, ap);
+ va_end(ap);
+ }
+}
+#endif /* NDEBUG */
+
+#ifdef SQLITE_VDBE_COVERAGE
+/*
+** Set the value if the iSrcLine field for the previously coded instruction.
+*/
+SQLITE_PRIVATE void sqlite3VdbeSetLineNumber(Vdbe *v, int iLine){
+ sqlite3VdbeGetLastOp(v)->iSrcLine = iLine;
+}
+#endif /* SQLITE_VDBE_COVERAGE */
+
+/*
+** Return the opcode for a given address. The address must be non-negative.
+** See sqlite3VdbeGetLastOp() to get the most recently added opcode.
+**
+** If a memory allocation error has occurred prior to the calling of this
+** routine, then a pointer to a dummy VdbeOp will be returned. That opcode
+** is readable but not writable, though it is cast to a writable value.
+** The return of a dummy opcode allows the call to continue functioning
+** after an OOM fault without having to check to see if the return from
+** this routine is a valid pointer. But because the dummy.opcode is 0,
+** dummy will never be written to. This is verified by code inspection and
+** by running with Valgrind.
+*/
+SQLITE_PRIVATE VdbeOp *sqlite3VdbeGetOp(Vdbe *p, int addr){
+ /* C89 specifies that the constant "dummy" will be initialized to all
+ ** zeros, which is correct. MSVC generates a warning, nevertheless. */
+ static VdbeOp dummy; /* Ignore the MSVC warning about no initializer */
+ assert( p->eVdbeState==VDBE_INIT_STATE );
+ assert( (addr>=0 && addr<p->nOp) || p->db->mallocFailed );
+ if( p->db->mallocFailed ){
+ return (VdbeOp*)&dummy;
+ }else{
+ return &p->aOp[addr];
+ }
+}
+
+/* Return the most recently added opcode
+*/
+SQLITE_PRIVATE VdbeOp *sqlite3VdbeGetLastOp(Vdbe *p){
+ return sqlite3VdbeGetOp(p, p->nOp - 1);
+}
+
+#if defined(SQLITE_ENABLE_EXPLAIN_COMMENTS)
+/*
+** Return an integer value for one of the parameters to the opcode pOp
+** determined by character c.
+*/
+static int translateP(char c, const Op *pOp){
+ if( c=='1' ) return pOp->p1;
+ if( c=='2' ) return pOp->p2;
+ if( c=='3' ) return pOp->p3;
+ if( c=='4' ) return pOp->p4.i;
+ return pOp->p5;
+}
+
+/*
+** Compute a string for the "comment" field of a VDBE opcode listing.
+**
+** The Synopsis: field in comments in the vdbe.c source file gets converted
+** to an extra string that is appended to the sqlite3OpcodeName(). In the
+** absence of other comments, this synopsis becomes the comment on the opcode.
+** Some translation occurs:
+**
+** "PX" -> "r[X]"
+** "PX@PY" -> "r[X..X+Y-1]" or "r[x]" if y is 0 or 1
+** "PX@PY+1" -> "r[X..X+Y]" or "r[x]" if y is 0
+** "PY..PY" -> "r[X..Y]" or "r[x]" if y<=x
+*/
+SQLITE_PRIVATE char *sqlite3VdbeDisplayComment(
+ sqlite3 *db, /* Optional - Oom error reporting only */
+ const Op *pOp, /* The opcode to be commented */
+ const char *zP4 /* Previously obtained value for P4 */
+){
+ const char *zOpName;
+ const char *zSynopsis;
+ int nOpName;
+ int ii;
+ char zAlt[50];
+ StrAccum x;
+
+ sqlite3StrAccumInit(&x, 0, 0, 0, SQLITE_MAX_LENGTH);
+ zOpName = sqlite3OpcodeName(pOp->opcode);
+ nOpName = sqlite3Strlen30(zOpName);
+ if( zOpName[nOpName+1] ){
+ int seenCom = 0;
+ char c;
+ zSynopsis = zOpName + nOpName + 1;
+ if( strncmp(zSynopsis,"IF ",3)==0 ){
+ sqlite3_snprintf(sizeof(zAlt), zAlt, "if %s goto P2", zSynopsis+3);
+ zSynopsis = zAlt;
+ }
+ for(ii=0; (c = zSynopsis[ii])!=0; ii++){
+ if( c=='P' ){
+ c = zSynopsis[++ii];
+ if( c=='4' ){
+ sqlite3_str_appendall(&x, zP4);
+ }else if( c=='X' ){
+ if( pOp->zComment && pOp->zComment[0] ){
+ sqlite3_str_appendall(&x, pOp->zComment);
+ seenCom = 1;
+ break;
+ }
+ }else{
+ int v1 = translateP(c, pOp);
+ int v2;
+ if( strncmp(zSynopsis+ii+1, "@P", 2)==0 ){
+ ii += 3;
+ v2 = translateP(zSynopsis[ii], pOp);
+ if( strncmp(zSynopsis+ii+1,"+1",2)==0 ){
+ ii += 2;
+ v2++;
+ }
+ if( v2<2 ){
+ sqlite3_str_appendf(&x, "%d", v1);
+ }else{
+ sqlite3_str_appendf(&x, "%d..%d", v1, v1+v2-1);
+ }
+ }else if( strncmp(zSynopsis+ii+1, "@NP", 3)==0 ){
+ sqlite3_context *pCtx = pOp->p4.pCtx;
+ if( pOp->p4type!=P4_FUNCCTX || pCtx->argc==1 ){
+ sqlite3_str_appendf(&x, "%d", v1);
+ }else if( pCtx->argc>1 ){
+ sqlite3_str_appendf(&x, "%d..%d", v1, v1+pCtx->argc-1);
+ }else if( x.accError==0 ){
+ assert( x.nChar>2 );
+ x.nChar -= 2;
+ ii++;
+ }
+ ii += 3;
+ }else{
+ sqlite3_str_appendf(&x, "%d", v1);
+ if( strncmp(zSynopsis+ii+1, "..P3", 4)==0 && pOp->p3==0 ){
+ ii += 4;
+ }
+ }
+ }
+ }else{
+ sqlite3_str_appendchar(&x, 1, c);
+ }
+ }
+ if( !seenCom && pOp->zComment ){
+ sqlite3_str_appendf(&x, "; %s", pOp->zComment);
+ }
+ }else if( pOp->zComment ){
+ sqlite3_str_appendall(&x, pOp->zComment);
+ }
+ if( (x.accError & SQLITE_NOMEM)!=0 && db!=0 ){
+ sqlite3OomFault(db);
+ }
+ return sqlite3StrAccumFinish(&x);
+}
+#endif /* SQLITE_ENABLE_EXPLAIN_COMMENTS */
+
+#if VDBE_DISPLAY_P4 && defined(SQLITE_ENABLE_CURSOR_HINTS)
+/*
+** Translate the P4.pExpr value for an OP_CursorHint opcode into text
+** that can be displayed in the P4 column of EXPLAIN output.
+*/
+static void displayP4Expr(StrAccum *p, Expr *pExpr){
+ const char *zOp = 0;
+ switch( pExpr->op ){
+ case TK_STRING:
+ assert( !ExprHasProperty(pExpr, EP_IntValue) );
+ sqlite3_str_appendf(p, "%Q", pExpr->u.zToken);
+ break;
+ case TK_INTEGER:
+ sqlite3_str_appendf(p, "%d", pExpr->u.iValue);
+ break;
+ case TK_NULL:
+ sqlite3_str_appendf(p, "NULL");
+ break;
+ case TK_REGISTER: {
+ sqlite3_str_appendf(p, "r[%d]", pExpr->iTable);
+ break;
+ }
+ case TK_COLUMN: {
+ if( pExpr->iColumn<0 ){
+ sqlite3_str_appendf(p, "rowid");
+ }else{
+ sqlite3_str_appendf(p, "c%d", (int)pExpr->iColumn);
+ }
+ break;
+ }
+ case TK_LT: zOp = "LT"; break;
+ case TK_LE: zOp = "LE"; break;
+ case TK_GT: zOp = "GT"; break;
+ case TK_GE: zOp = "GE"; break;
+ case TK_NE: zOp = "NE"; break;
+ case TK_EQ: zOp = "EQ"; break;
+ case TK_IS: zOp = "IS"; break;
+ case TK_ISNOT: zOp = "ISNOT"; break;
+ case TK_AND: zOp = "AND"; break;
+ case TK_OR: zOp = "OR"; break;
+ case TK_PLUS: zOp = "ADD"; break;
+ case TK_STAR: zOp = "MUL"; break;
+ case TK_MINUS: zOp = "SUB"; break;
+ case TK_REM: zOp = "REM"; break;
+ case TK_BITAND: zOp = "BITAND"; break;
+ case TK_BITOR: zOp = "BITOR"; break;
+ case TK_SLASH: zOp = "DIV"; break;
+ case TK_LSHIFT: zOp = "LSHIFT"; break;
+ case TK_RSHIFT: zOp = "RSHIFT"; break;
+ case TK_CONCAT: zOp = "CONCAT"; break;
+ case TK_UMINUS: zOp = "MINUS"; break;
+ case TK_UPLUS: zOp = "PLUS"; break;
+ case TK_BITNOT: zOp = "BITNOT"; break;
+ case TK_NOT: zOp = "NOT"; break;
+ case TK_ISNULL: zOp = "ISNULL"; break;
+ case TK_NOTNULL: zOp = "NOTNULL"; break;
+
+ default:
+ sqlite3_str_appendf(p, "%s", "expr");
+ break;
+ }
+
+ if( zOp ){
+ sqlite3_str_appendf(p, "%s(", zOp);
+ displayP4Expr(p, pExpr->pLeft);
+ if( pExpr->pRight ){
+ sqlite3_str_append(p, ",", 1);
+ displayP4Expr(p, pExpr->pRight);
+ }
+ sqlite3_str_append(p, ")", 1);
+ }
+}
+#endif /* VDBE_DISPLAY_P4 && defined(SQLITE_ENABLE_CURSOR_HINTS) */
+
+
+#if VDBE_DISPLAY_P4
+/*
+** Compute a string that describes the P4 parameter for an opcode.
+** Use zTemp for any required temporary buffer space.
+*/
+SQLITE_PRIVATE char *sqlite3VdbeDisplayP4(sqlite3 *db, Op *pOp){
+ char *zP4 = 0;
+ StrAccum x;
+
+ sqlite3StrAccumInit(&x, 0, 0, 0, SQLITE_MAX_LENGTH);
+ switch( pOp->p4type ){
+ case P4_KEYINFO: {
+ int j;
+ KeyInfo *pKeyInfo = pOp->p4.pKeyInfo;
+ assert( pKeyInfo->aSortFlags!=0 );
+ sqlite3_str_appendf(&x, "k(%d", pKeyInfo->nKeyField);
+ for(j=0; j<pKeyInfo->nKeyField; j++){
+ CollSeq *pColl = pKeyInfo->aColl[j];
+ const char *zColl = pColl ? pColl->zName : "";
+ if( strcmp(zColl, "BINARY")==0 ) zColl = "B";
+ sqlite3_str_appendf(&x, ",%s%s%s",
+ (pKeyInfo->aSortFlags[j] & KEYINFO_ORDER_DESC) ? "-" : "",
+ (pKeyInfo->aSortFlags[j] & KEYINFO_ORDER_BIGNULL)? "N." : "",
+ zColl);
+ }
+ sqlite3_str_append(&x, ")", 1);
+ break;
+ }
+#ifdef SQLITE_ENABLE_CURSOR_HINTS
+ case P4_EXPR: {
+ displayP4Expr(&x, pOp->p4.pExpr);
+ break;
+ }
+#endif
+ case P4_COLLSEQ: {
+ static const char *const encnames[] = {"?", "8", "16LE", "16BE"};
+ CollSeq *pColl = pOp->p4.pColl;
+ assert( pColl->enc<4 );
+ sqlite3_str_appendf(&x, "%.18s-%s", pColl->zName,
+ encnames[pColl->enc]);
+ break;
+ }
+ case P4_FUNCDEF: {
+ FuncDef *pDef = pOp->p4.pFunc;
+ sqlite3_str_appendf(&x, "%s(%d)", pDef->zName, pDef->nArg);
+ break;
+ }
+ case P4_FUNCCTX: {
+ FuncDef *pDef = pOp->p4.pCtx->pFunc;
+ sqlite3_str_appendf(&x, "%s(%d)", pDef->zName, pDef->nArg);
+ break;
+ }
+ case P4_INT64: {
+ sqlite3_str_appendf(&x, "%lld", *pOp->p4.pI64);
+ break;
+ }
+ case P4_INT32: {
+ sqlite3_str_appendf(&x, "%d", pOp->p4.i);
+ break;
+ }
+ case P4_REAL: {
+ sqlite3_str_appendf(&x, "%.16g", *pOp->p4.pReal);
+ break;
+ }
+ case P4_MEM: {
+ Mem *pMem = pOp->p4.pMem;
+ if( pMem->flags & MEM_Str ){
+ zP4 = pMem->z;
+ }else if( pMem->flags & (MEM_Int|MEM_IntReal) ){
+ sqlite3_str_appendf(&x, "%lld", pMem->u.i);
+ }else if( pMem->flags & MEM_Real ){
+ sqlite3_str_appendf(&x, "%.16g", pMem->u.r);
+ }else if( pMem->flags & MEM_Null ){
+ zP4 = "NULL";
+ }else{
+ assert( pMem->flags & MEM_Blob );
+ zP4 = "(blob)";
+ }
+ break;
+ }
+#ifndef SQLITE_OMIT_VIRTUALTABLE
+ case P4_VTAB: {
+ sqlite3_vtab *pVtab = pOp->p4.pVtab->pVtab;
+ sqlite3_str_appendf(&x, "vtab:%p", pVtab);
+ break;
+ }
+#endif
+ case P4_INTARRAY: {
+ u32 i;
+ u32 *ai = pOp->p4.ai;
+ u32 n = ai[0]; /* The first element of an INTARRAY is always the
+ ** count of the number of elements to follow */
+ for(i=1; i<=n; i++){
+ sqlite3_str_appendf(&x, "%c%u", (i==1 ? '[' : ','), ai[i]);
+ }
+ sqlite3_str_append(&x, "]", 1);
+ break;
+ }
+ case P4_SUBPROGRAM: {
+ zP4 = "program";
+ break;
+ }
+ case P4_TABLE: {
+ zP4 = pOp->p4.pTab->zName;
+ break;
+ }
+ case P4_SUBRTNSIG: {
+ SubrtnSig *pSig = pOp->p4.pSubrtnSig;
+ sqlite3_str_appendf(&x, "subrtnsig:%d,%s", pSig->selId, pSig->zAff);
+ break;
+ }
+ default: {
+ zP4 = pOp->p4.z;
+ }
+ }
+ if( zP4 ) sqlite3_str_appendall(&x, zP4);
+ if( (x.accError & SQLITE_NOMEM)!=0 ){
+ sqlite3OomFault(db);
+ }
+ return sqlite3StrAccumFinish(&x);
+}
+#endif /* VDBE_DISPLAY_P4 */
+
+/*
+** Declare to the Vdbe that the BTree object at db->aDb[i] is used.
+**
+** The prepared statements need to know in advance the complete set of
+** attached databases that will be use. A mask of these databases
+** is maintained in p->btreeMask. The p->lockMask value is the subset of
+** p->btreeMask of databases that will require a lock.
+*/
+SQLITE_PRIVATE void sqlite3VdbeUsesBtree(Vdbe *p, int i){
+ assert( i>=0 && i<p->db->nDb && i<(int)sizeof(yDbMask)*8 );
+ assert( i<(int)sizeof(p->btreeMask)*8 );
+ DbMaskSet(p->btreeMask, i);
+ if( i!=1 && sqlite3BtreeSharable(p->db->aDb[i].pBt) ){
+ DbMaskSet(p->lockMask, i);
+ }
+}
+
+#if !defined(SQLITE_OMIT_SHARED_CACHE)
+/*
+** If SQLite is compiled to support shared-cache mode and to be threadsafe,
+** this routine obtains the mutex associated with each BtShared structure
+** that may be accessed by the VM passed as an argument. In doing so it also
+** sets the BtShared.db member of each of the BtShared structures, ensuring
+** that the correct busy-handler callback is invoked if required.
+**
+** If SQLite is not threadsafe but does support shared-cache mode, then
+** sqlite3BtreeEnter() is invoked to set the BtShared.db variables
+** of all of BtShared structures accessible via the database handle
+** associated with the VM.
+**
+** If SQLite is not threadsafe and does not support shared-cache mode, this
+** function is a no-op.
+**
+** The p->btreeMask field is a bitmask of all btrees that the prepared
+** statement p will ever use. Let N be the number of bits in p->btreeMask
+** corresponding to btrees that use shared cache. Then the runtime of
+** this routine is N*N. But as N is rarely more than 1, this should not
+** be a problem.
+*/
+SQLITE_PRIVATE void sqlite3VdbeEnter(Vdbe *p){
+ int i;
+ sqlite3 *db;
+ Db *aDb;
+ int nDb;
+ if( DbMaskAllZero(p->lockMask) ) return; /* The common case */
+ db = p->db;
+ aDb = db->aDb;
+ nDb = db->nDb;
+ for(i=0; i<nDb; i++){
+ if( i!=1 && DbMaskTest(p->lockMask,i) && ALWAYS(aDb[i].pBt!=0) ){
+ sqlite3BtreeEnter(aDb[i].pBt);
+ }
+ }
+}
+#endif
+
+#if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE>0
+/*
+** Unlock all of the btrees previously locked by a call to sqlite3VdbeEnter().
+*/
+static SQLITE_NOINLINE void vdbeLeave(Vdbe *p){
+ int i;
+ sqlite3 *db;
+ Db *aDb;
+ int nDb;
+ db = p->db;
+ aDb = db->aDb;
+ nDb = db->nDb;
+ for(i=0; i<nDb; i++){
+ if( i!=1 && DbMaskTest(p->lockMask,i) && ALWAYS(aDb[i].pBt!=0) ){
+ sqlite3BtreeLeave(aDb[i].pBt);
+ }
+ }
+}
+SQLITE_PRIVATE void sqlite3VdbeLeave(Vdbe *p){
+ if( DbMaskAllZero(p->lockMask) ) return; /* The common case */
+ vdbeLeave(p);
+}
+#endif
+
+#if defined(VDBE_PROFILE) || defined(SQLITE_DEBUG)
+/*
+** Print a single opcode. This routine is used for debugging only.
+*/
+SQLITE_PRIVATE void sqlite3VdbePrintOp(FILE *pOut, int pc, VdbeOp *pOp){
+ char *zP4;
+ char *zCom;
+ sqlite3 dummyDb;
+ static const char *zFormat1 = "%4d %-13s %4d %4d %4d %-13s %.2X %s\n";
+ if( pOut==0 ) pOut = stdout;
+ sqlite3BeginBenignMalloc();
+ dummyDb.mallocFailed = 1;
+ zP4 = sqlite3VdbeDisplayP4(&dummyDb, pOp);
+#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
+ zCom = sqlite3VdbeDisplayComment(0, pOp, zP4);
+#else
+ zCom = 0;
+#endif
+ /* NB: The sqlite3OpcodeName() function is implemented by code created
+ ** by the mkopcodeh.awk and mkopcodec.awk scripts which extract the
+ ** information from the vdbe.c source text */
+ fprintf(pOut, zFormat1, pc,
+ sqlite3OpcodeName(pOp->opcode), pOp->p1, pOp->p2, pOp->p3,
+ zP4 ? zP4 : "", pOp->p5,
+ zCom ? zCom : ""
+ );
+ fflush(pOut);
+ sqlite3_free(zP4);
+ sqlite3_free(zCom);
+ sqlite3EndBenignMalloc();
+}
+#endif
+
+/*
+** Initialize an array of N Mem element.
+**
+** This is a high-runner, so only those fields that really do need to
+** be initialized are set. The Mem structure is organized so that
+** the fields that get initialized are nearby and hopefully on the same
+** cache line.
+**
+** Mem.flags = flags
+** Mem.db = db
+** Mem.szMalloc = 0
+**
+** All other fields of Mem can safely remain uninitialized for now. They
+** will be initialized before use.
+*/
+static void initMemArray(Mem *p, int N, sqlite3 *db, u16 flags){
+ assert( db!=0 );
+ if( N>0 ){
+ do{
+ p->flags = flags;
+ p->db = db;
+ p->szMalloc = 0;
+#ifdef SQLITE_DEBUG
+ p->pScopyFrom = 0;
+ p->bScopy = 0;
+#endif
+ p++;
+ }while( (--N)>0 );
+ }
+}
+
+/*
+** Release auxiliary memory held in an array of N Mem elements.
+**
+** After this routine returns, all Mem elements in the array will still
+** be valid. Those Mem elements that were not holding auxiliary resources
+** will be unchanged. Mem elements which had something freed will be
+** set to MEM_Undefined.
+*/
+static void releaseMemArray(Mem *p, int N){
+ if( p && N ){
+ Mem *pEnd = &p[N];
+ sqlite3 *db = p->db;
+ assert( db!=0 );
+ if( db->pnBytesFreed ){
+ do{
+ if( p->szMalloc ) sqlite3DbFree(db, p->zMalloc);
+ }while( (++p)<pEnd );
+ return;
+ }
+ do{
+ assert( (&p[1])==pEnd || p[0].db==p[1].db );
+ assert( sqlite3VdbeCheckMemInvariants(p) );
+
+ /* This block is really an inlined version of sqlite3VdbeMemRelease()
+ ** that takes advantage of the fact that the memory cell value is
+ ** being set to NULL after releasing any dynamic resources.
+ **
+ ** The justification for duplicating code is that according to
+ ** callgrind, this causes a certain test case to hit the CPU 4.7
+ ** percent less (x86 linux, gcc version 4.1.2, -O6) than if
+ ** sqlite3MemRelease() were called from here. With -O2, this jumps
+ ** to 6.6 percent. The test case is inserting 1000 rows into a table
+ ** with no indexes using a single prepared INSERT statement, bind()
+ ** and reset(). Inserts are grouped into a transaction.
+ */
+ testcase( p->flags & MEM_Agg );
+ testcase( p->flags & MEM_Dyn );
+ if( p->flags&(MEM_Agg|MEM_Dyn) ){
+ testcase( (p->flags & MEM_Dyn)!=0 && p->xDel==sqlite3VdbeFrameMemDel );
+ sqlite3VdbeMemRelease(p);
+ p->flags = MEM_Undefined;
+ }else if( p->szMalloc ){
+ sqlite3DbNNFreeNN(db, p->zMalloc);
+ p->szMalloc = 0;
+ p->flags = MEM_Undefined;
+ }
+#ifdef SQLITE_DEBUG
+ else{
+ p->flags = MEM_Undefined;
+ }
+#endif
+ }while( (++p)<pEnd );
+ }
+}
+
+#ifdef SQLITE_DEBUG
+/*
+** Verify that pFrame is a valid VdbeFrame pointer. Return true if it is
+** and false if something is wrong.
+**
+** This routine is intended for use inside of assert() statements only.
+*/
+SQLITE_PRIVATE int sqlite3VdbeFrameIsValid(VdbeFrame *pFrame){
+ if( pFrame->iFrameMagic!=SQLITE_FRAME_MAGIC ) return 0;
+ return 1;
+}
+#endif
+
+
+/*
+** This is a destructor on a Mem object (which is really an sqlite3_value)
+** that deletes the Frame object that is attached to it as a blob.
+**
+** This routine does not delete the Frame right away. It merely adds the
+** frame to a list of frames to be deleted when the Vdbe halts.
+*/
+SQLITE_PRIVATE void sqlite3VdbeFrameMemDel(void *pArg){
+ VdbeFrame *pFrame = (VdbeFrame*)pArg;
+ assert( sqlite3VdbeFrameIsValid(pFrame) );
+ pFrame->pParent = pFrame->v->pDelFrame;
+ pFrame->v->pDelFrame = pFrame;
+}
+
+#if defined(SQLITE_ENABLE_BYTECODE_VTAB) || !defined(SQLITE_OMIT_EXPLAIN)
+/*
+** Locate the next opcode to be displayed in EXPLAIN or EXPLAIN
+** QUERY PLAN output.
+**
+** Return SQLITE_ROW on success. Return SQLITE_DONE if there are no
+** more opcodes to be displayed.
+*/
+SQLITE_PRIVATE int sqlite3VdbeNextOpcode(
+ Vdbe *p, /* The statement being explained */
+ Mem *pSub, /* Storage for keeping track of subprogram nesting */
+ int eMode, /* 0: normal. 1: EQP. 2: TablesUsed */
+ int *piPc, /* IN/OUT: Current rowid. Overwritten with next rowid */
+ int *piAddr, /* OUT: Write index into (*paOp)[] here */
+ Op **paOp /* OUT: Write the opcode array here */
+){
+ int nRow; /* Stop when row count reaches this */
+ int nSub = 0; /* Number of sub-vdbes seen so far */
+ SubProgram **apSub = 0; /* Array of sub-vdbes */
+ int i; /* Next instruction address */
+ int rc = SQLITE_OK; /* Result code */
+ Op *aOp = 0; /* Opcode array */
+ int iPc; /* Rowid. Copy of value in *piPc */
+
+ /* When the number of output rows reaches nRow, that means the
+ ** listing has finished and sqlite3_step() should return SQLITE_DONE.
+ ** nRow is the sum of the number of rows in the main program, plus
+ ** the sum of the number of rows in all trigger subprograms encountered
+ ** so far. The nRow value will increase as new trigger subprograms are
+ ** encountered, but p->pc will eventually catch up to nRow.
+ */
+ nRow = p->nOp;
+ if( pSub!=0 ){
+ if( pSub->flags&MEM_Blob ){
+ /* pSub is initiallly NULL. It is initialized to a BLOB by
+ ** the P4_SUBPROGRAM processing logic below */
+ nSub = pSub->n/sizeof(Vdbe*);
+ apSub = (SubProgram **)pSub->z;
+ }
+ for(i=0; i<nSub; i++){
+ nRow += apSub[i]->nOp;
+ }
+ }
+ iPc = *piPc;
+ while(1){ /* Loop exits via break */
+ i = iPc++;
+ if( i>=nRow ){
+ p->rc = SQLITE_OK;
+ rc = SQLITE_DONE;
+ break;
+ }
+ if( i<p->nOp ){
+ /* The rowid is small enough that we are still in the
+ ** main program. */
+ aOp = p->aOp;
+ }else{
+ /* We are currently listing subprograms. Figure out which one and
+ ** pick up the appropriate opcode. */
+ int j;
+ i -= p->nOp;
+ assert( apSub!=0 );
+ assert( nSub>0 );
+ for(j=0; i>=apSub[j]->nOp; j++){
+ i -= apSub[j]->nOp;
+ assert( i<apSub[j]->nOp || j+1<nSub );
+ }
+ aOp = apSub[j]->aOp;
+ }
+
+ /* When an OP_Program opcode is encounter (the only opcode that has
+ ** a P4_SUBPROGRAM argument), expand the size of the array of subprograms
+ ** kept in p->aMem[9].z to hold the new program - assuming this subprogram
+ ** has not already been seen.
+ */
+ if( pSub!=0 && aOp[i].p4type==P4_SUBPROGRAM ){
+ int nByte = (nSub+1)*sizeof(SubProgram*);
+ int j;
+ for(j=0; j<nSub; j++){
+ if( apSub[j]==aOp[i].p4.pProgram ) break;
+ }
+ if( j==nSub ){
+ p->rc = sqlite3VdbeMemGrow(pSub, nByte, nSub!=0);
+ if( p->rc!=SQLITE_OK ){
+ rc = SQLITE_ERROR;
+ break;
+ }
+ apSub = (SubProgram **)pSub->z;
+ apSub[nSub++] = aOp[i].p4.pProgram;
+ MemSetTypeFlag(pSub, MEM_Blob);
+ pSub->n = nSub*sizeof(SubProgram*);
+ nRow += aOp[i].p4.pProgram->nOp;
+ }
+ }
+ if( eMode==0 ) break;
+#ifdef SQLITE_ENABLE_BYTECODE_VTAB
+ if( eMode==2 ){
+ Op *pOp = aOp + i;
+ if( pOp->opcode==OP_OpenRead ) break;
+ if( pOp->opcode==OP_OpenWrite && (pOp->p5 & OPFLAG_P2ISREG)==0 ) break;
+ if( pOp->opcode==OP_ReopenIdx ) break;
+ }else
+#endif
+ {
+ assert( eMode==1 );
+ if( aOp[i].opcode==OP_Explain ) break;
+ if( aOp[i].opcode==OP_Init && iPc>1 ) break;
+ }
+ }
+ *piPc = iPc;
+ *piAddr = i;
+ *paOp = aOp;
+ return rc;
+}
+#endif /* SQLITE_ENABLE_BYTECODE_VTAB || !SQLITE_OMIT_EXPLAIN */
+
+
+/*
+** Delete a VdbeFrame object and its contents. VdbeFrame objects are
+** allocated by the OP_Program opcode in sqlite3VdbeExec().
+*/
+SQLITE_PRIVATE void sqlite3VdbeFrameDelete(VdbeFrame *p){
+ int i;
+ Mem *aMem = VdbeFrameMem(p);
+ VdbeCursor **apCsr = (VdbeCursor **)&aMem[p->nChildMem];
+ assert( sqlite3VdbeFrameIsValid(p) );
+ for(i=0; i<p->nChildCsr; i++){
+ if( apCsr[i] ) sqlite3VdbeFreeCursorNN(p->v, apCsr[i]);
+ }
+ releaseMemArray(aMem, p->nChildMem);
+ sqlite3VdbeDeleteAuxData(p->v->db, &p->pAuxData, -1, 0);
+ sqlite3DbFree(p->v->db, p);
+}
+
+#ifndef SQLITE_OMIT_EXPLAIN
+/*
+** Give a listing of the program in the virtual machine.
+**
+** The interface is the same as sqlite3VdbeExec(). But instead of
+** running the code, it invokes the callback once for each instruction.
+** This feature is used to implement "EXPLAIN".
+**
+** When p->explain==1, each instruction is listed. When
+** p->explain==2, only OP_Explain instructions are listed and these
+** are shown in a different format. p->explain==2 is used to implement
+** EXPLAIN QUERY PLAN.
+** 2018-04-24: In p->explain==2 mode, the OP_Init opcodes of triggers
+** are also shown, so that the boundaries between the main program and
+** each trigger are clear.
+**
+** When p->explain==1, first the main program is listed, then each of
+** the trigger subprograms are listed one by one.
+*/
+SQLITE_PRIVATE int sqlite3VdbeList(
+ Vdbe *p /* The VDBE */
+){
+ Mem *pSub = 0; /* Memory cell hold array of subprogs */
+ sqlite3 *db = p->db; /* The database connection */
+ int i; /* Loop counter */
+ int rc = SQLITE_OK; /* Return code */
+ Mem *pMem = &p->aMem[1]; /* First Mem of result set */
+ int bListSubprogs = (p->explain==1 || (db->flags & SQLITE_TriggerEQP)!=0);
+ Op *aOp; /* Array of opcodes */
+ Op *pOp; /* Current opcode */
+
+ assert( p->explain );
+ assert( p->eVdbeState==VDBE_RUN_STATE );
+ assert( p->rc==SQLITE_OK || p->rc==SQLITE_BUSY || p->rc==SQLITE_NOMEM );
+
+ /* Even though this opcode does not use dynamic strings for
+ ** the result, result columns may become dynamic if the user calls
+ ** sqlite3_column_text16(), causing a translation to UTF-16 encoding.
+ */
+ releaseMemArray(pMem, 8);
+
+ if( p->rc==SQLITE_NOMEM ){
+ /* This happens if a malloc() inside a call to sqlite3_column_text() or
+ ** sqlite3_column_text16() failed. */
+ sqlite3OomFault(db);
+ return SQLITE_ERROR;
+ }
+
+ if( bListSubprogs ){
+ /* The first 8 memory cells are used for the result set. So we will
+ ** commandeer the 9th cell to use as storage for an array of pointers
+ ** to trigger subprograms. The VDBE is guaranteed to have at least 9
+ ** cells. */
+ assert( p->nMem>9 );
+ pSub = &p->aMem[9];
+ }else{
+ pSub = 0;
+ }
+
+ /* Figure out which opcode is next to display */
+ rc = sqlite3VdbeNextOpcode(p, pSub, p->explain==2, &p->pc, &i, &aOp);
+
+ if( rc==SQLITE_OK ){
+ pOp = aOp + i;
+ if( AtomicLoad(&db->u1.isInterrupted) ){
+ p->rc = SQLITE_INTERRUPT;
+ rc = SQLITE_ERROR;
+ sqlite3VdbeError(p, sqlite3ErrStr(p->rc));
+ }else{
+ char *zP4 = sqlite3VdbeDisplayP4(db, pOp);
+ if( p->explain==2 ){
+ sqlite3VdbeMemSetInt64(pMem, pOp->p1);
+ sqlite3VdbeMemSetInt64(pMem+1, pOp->p2);
+ sqlite3VdbeMemSetInt64(pMem+2, pOp->p3);
+ sqlite3VdbeMemSetStr(pMem+3, zP4, -1, SQLITE_UTF8, sqlite3_free);
+ assert( p->nResColumn==4 );
+ }else{
+ sqlite3VdbeMemSetInt64(pMem+0, i);
+ sqlite3VdbeMemSetStr(pMem+1, (char*)sqlite3OpcodeName(pOp->opcode),
+ -1, SQLITE_UTF8, SQLITE_STATIC);
+ sqlite3VdbeMemSetInt64(pMem+2, pOp->p1);
+ sqlite3VdbeMemSetInt64(pMem+3, pOp->p2);
+ sqlite3VdbeMemSetInt64(pMem+4, pOp->p3);
+ /* pMem+5 for p4 is done last */
+ sqlite3VdbeMemSetInt64(pMem+6, pOp->p5);
+#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
+ {
+ char *zCom = sqlite3VdbeDisplayComment(db, pOp, zP4);
+ sqlite3VdbeMemSetStr(pMem+7, zCom, -1, SQLITE_UTF8, sqlite3_free);
+ }
+#else
+ sqlite3VdbeMemSetNull(pMem+7);
+#endif
+ sqlite3VdbeMemSetStr(pMem+5, zP4, -1, SQLITE_UTF8, sqlite3_free);
+ assert( p->nResColumn==8 );
+ }
+ p->pResultRow = pMem;
+ if( db->mallocFailed ){
+ p->rc = SQLITE_NOMEM;
+ rc = SQLITE_ERROR;
+ }else{
+ p->rc = SQLITE_OK;
+ rc = SQLITE_ROW;
+ }
+ }
+ }
+ return rc;
+}
+#endif /* SQLITE_OMIT_EXPLAIN */
+
+#ifdef SQLITE_DEBUG
+/*
+** Print the SQL that was used to generate a VDBE program.
+*/
+SQLITE_PRIVATE void sqlite3VdbePrintSql(Vdbe *p){
+ const char *z = 0;
+ if( p->zSql ){
+ z = p->zSql;
+ }else if( p->nOp>=1 ){
+ const VdbeOp *pOp = &p->aOp[0];
+ if( pOp->opcode==OP_Init && pOp->p4.z!=0 ){
+ z = pOp->p4.z;
+ while( sqlite3Isspace(*z) ) z++;
+ }
+ }
+ if( z ) printf("SQL: [%s]\n", z);
+}
+#endif
+
+#if !defined(SQLITE_OMIT_TRACE) && defined(SQLITE_ENABLE_IOTRACE)
+/*
+** Print an IOTRACE message showing SQL content.
+*/
+SQLITE_PRIVATE void sqlite3VdbeIOTraceSql(Vdbe *p){
+ int nOp = p->nOp;
+ VdbeOp *pOp;
+ if( sqlite3IoTrace==0 ) return;
+ if( nOp<1 ) return;
+ pOp = &p->aOp[0];
+ if( pOp->opcode==OP_Init && pOp->p4.z!=0 ){
+ int i, j;
+ char z[1000];
+ sqlite3_snprintf(sizeof(z), z, "%s", pOp->p4.z);
+ for(i=0; sqlite3Isspace(z[i]); i++){}
+ for(j=0; z[i]; i++){
+ if( sqlite3Isspace(z[i]) ){
+ if( z[i-1]!=' ' ){
+ z[j++] = ' ';
+ }
+ }else{
+ z[j++] = z[i];
+ }
+ }
+ z[j] = 0;
+ sqlite3IoTrace("SQL %s\n", z);
+ }
+}
+#endif /* !SQLITE_OMIT_TRACE && SQLITE_ENABLE_IOTRACE */
+
+/* An instance of this object describes bulk memory available for use
+** by subcomponents of a prepared statement. Space is allocated out
+** of a ReusableSpace object by the allocSpace() routine below.
+*/
+struct ReusableSpace {
+ u8 *pSpace; /* Available memory */
+ sqlite3_int64 nFree; /* Bytes of available memory */
+ sqlite3_int64 nNeeded; /* Total bytes that could not be allocated */
+};
+
+/* Try to allocate nByte bytes of 8-byte aligned bulk memory for pBuf
+** from the ReusableSpace object. Return a pointer to the allocated
+** memory on success. If insufficient memory is available in the
+** ReusableSpace object, increase the ReusableSpace.nNeeded
+** value by the amount needed and return NULL.
+**
+** If pBuf is not initially NULL, that means that the memory has already
+** been allocated by a prior call to this routine, so just return a copy
+** of pBuf and leave ReusableSpace unchanged.
+**
+** This allocator is employed to repurpose unused slots at the end of the
+** opcode array of prepared state for other memory needs of the prepared
+** statement.
+*/
+static void *allocSpace(
+ struct ReusableSpace *p, /* Bulk memory available for allocation */
+ void *pBuf, /* Pointer to a prior allocation */
+ sqlite3_int64 nByte /* Bytes of memory needed. */
+){
+ assert( EIGHT_BYTE_ALIGNMENT(p->pSpace) );
+ if( pBuf==0 ){
+ nByte = ROUND8P(nByte);
+ if( nByte <= p->nFree ){
+ p->nFree -= nByte;
+ pBuf = &p->pSpace[p->nFree];
+ }else{
+ p->nNeeded += nByte;
+ }
+ }
+ assert( EIGHT_BYTE_ALIGNMENT(pBuf) );
+ return pBuf;
+}
+
+/*
+** Rewind the VDBE back to the beginning in preparation for
+** running it.
+*/
+SQLITE_PRIVATE void sqlite3VdbeRewind(Vdbe *p){
+#if defined(SQLITE_DEBUG)
+ int i;
+#endif
+ assert( p!=0 );
+ assert( p->eVdbeState==VDBE_INIT_STATE
+ || p->eVdbeState==VDBE_READY_STATE
+ || p->eVdbeState==VDBE_HALT_STATE );
+
+ /* There should be at least one opcode.
+ */
+ assert( p->nOp>0 );
+
+ p->eVdbeState = VDBE_READY_STATE;
+
+#ifdef SQLITE_DEBUG
+ for(i=0; i<p->nMem; i++){
+ assert( p->aMem[i].db==p->db );
+ }
+#endif
+ p->pc = -1;
+ p->rc = SQLITE_OK;
+ p->errorAction = OE_Abort;
+ p->nChange = 0;
+ p->cacheCtr = 1;
+ p->minWriteFileFormat = 255;
+ p->iStatement = 0;
+ p->nFkConstraint = 0;
+#ifdef VDBE_PROFILE
+ for(i=0; i<p->nOp; i++){
+ p->aOp[i].nExec = 0;
+ p->aOp[i].nCycle = 0;
+ }
+#endif
+}
+
+/*
+** Prepare a virtual machine for execution for the first time after
+** creating the virtual machine. This involves things such
+** as allocating registers and initializing the program counter.
+** After the VDBE has be prepped, it can be executed by one or more
+** calls to sqlite3VdbeExec().
+**
+** This function may be called exactly once on each virtual machine.
+** After this routine is called the VM has been "packaged" and is ready
+** to run. After this routine is called, further calls to
+** sqlite3VdbeAddOp() functions are prohibited. This routine disconnects
+** the Vdbe from the Parse object that helped generate it so that the
+** the Vdbe becomes an independent entity and the Parse object can be
+** destroyed.
+**
+** Use the sqlite3VdbeRewind() procedure to restore a virtual machine back
+** to its initial state after it has been run.
+*/
+SQLITE_PRIVATE void sqlite3VdbeMakeReady(
+ Vdbe *p, /* The VDBE */
+ Parse *pParse /* Parsing context */
+){
+ sqlite3 *db; /* The database connection */
+ int nVar; /* Number of parameters */
+ int nMem; /* Number of VM memory registers */
+ int nCursor; /* Number of cursors required */
+ int nArg; /* Number of arguments in subprograms */
+ int n; /* Loop counter */
+ struct ReusableSpace x; /* Reusable bulk memory */
+
+ assert( p!=0 );
+ assert( p->nOp>0 );
+ assert( pParse!=0 );
+ assert( p->eVdbeState==VDBE_INIT_STATE );
+ assert( pParse==p->pParse );
+ assert( pParse->db==p->db );
+ p->pVList = pParse->pVList;
+ pParse->pVList = 0;
+ db = p->db;
+ assert( db->mallocFailed==0 );
+ nVar = pParse->nVar;
+ nMem = pParse->nMem;
+ nCursor = pParse->nTab;
+ nArg = pParse->nMaxArg;
+
+ /* Each cursor uses a memory cell. The first cursor (cursor 0) can
+ ** use aMem[0] which is not otherwise used by the VDBE program. Allocate
+ ** space at the end of aMem[] for cursors 1 and greater.
+ ** See also: allocateCursor().
+ */
+ nMem += nCursor;
+ if( nCursor==0 && nMem>0 ) nMem++; /* Space for aMem[0] even if not used */
+
+ /* Figure out how much reusable memory is available at the end of the
+ ** opcode array. This extra memory will be reallocated for other elements
+ ** of the prepared statement.
+ */
+ n = ROUND8P(sizeof(Op)*p->nOp); /* Bytes of opcode memory used */
+ x.pSpace = &((u8*)p->aOp)[n]; /* Unused opcode memory */
+ assert( EIGHT_BYTE_ALIGNMENT(x.pSpace) );
+ x.nFree = ROUNDDOWN8(pParse->szOpAlloc - n); /* Bytes of unused memory */
+ assert( x.nFree>=0 );
+ assert( EIGHT_BYTE_ALIGNMENT(&x.pSpace[x.nFree]) );
+
+ resolveP2Values(p, &nArg);
+ p->usesStmtJournal = (u8)(pParse->isMultiWrite && pParse->mayAbort);
+ if( pParse->explain ){
+ if( nMem<10 ) nMem = 10;
+ p->explain = pParse->explain;
+ p->nResColumn = 12 - 4*p->explain;
+ }
+ p->expired = 0;
+
+ /* Memory for registers, parameters, cursor, etc, is allocated in one or two
+ ** passes. On the first pass, we try to reuse unused memory at the
+ ** end of the opcode array. If we are unable to satisfy all memory
+ ** requirements by reusing the opcode array tail, then the second
+ ** pass will fill in the remainder using a fresh memory allocation.
+ **
+ ** This two-pass approach that reuses as much memory as possible from
+ ** the leftover memory at the end of the opcode array. This can significantly
+ ** reduce the amount of memory held by a prepared statement.
+ */
+ x.nNeeded = 0;
+ p->aMem = allocSpace(&x, 0, nMem*sizeof(Mem));
+ p->aVar = allocSpace(&x, 0, nVar*sizeof(Mem));
+ p->apArg = allocSpace(&x, 0, nArg*sizeof(Mem*));
+ p->apCsr = allocSpace(&x, 0, nCursor*sizeof(VdbeCursor*));
+ if( x.nNeeded ){
+ x.pSpace = p->pFree = sqlite3DbMallocRawNN(db, x.nNeeded);
+ x.nFree = x.nNeeded;
+ if( !db->mallocFailed ){
+ p->aMem = allocSpace(&x, p->aMem, nMem*sizeof(Mem));
+ p->aVar = allocSpace(&x, p->aVar, nVar*sizeof(Mem));
+ p->apArg = allocSpace(&x, p->apArg, nArg*sizeof(Mem*));
+ p->apCsr = allocSpace(&x, p->apCsr, nCursor*sizeof(VdbeCursor*));
+ }
+ }
+
+ if( db->mallocFailed ){
+ p->nVar = 0;
+ p->nCursor = 0;
+ p->nMem = 0;
+ }else{
+ p->nCursor = nCursor;
+ p->nVar = (ynVar)nVar;
+ initMemArray(p->aVar, nVar, db, MEM_Null);
+ p->nMem = nMem;
+ initMemArray(p->aMem, nMem, db, MEM_Undefined);
+ memset(p->apCsr, 0, nCursor*sizeof(VdbeCursor*));
+ }
+ sqlite3VdbeRewind(p);
+}
+
+/*
+** Close a VDBE cursor and release all the resources that cursor
+** happens to hold.
+*/
+SQLITE_PRIVATE void sqlite3VdbeFreeCursor(Vdbe *p, VdbeCursor *pCx){
+ if( pCx ) sqlite3VdbeFreeCursorNN(p,pCx);
+}
+static SQLITE_NOINLINE void freeCursorWithCache(Vdbe *p, VdbeCursor *pCx){
+ VdbeTxtBlbCache *pCache = pCx->pCache;
+ assert( pCx->colCache );
+ pCx->colCache = 0;
+ pCx->pCache = 0;
+ if( pCache->pCValue ){
+ sqlite3RCStrUnref(pCache->pCValue);
+ pCache->pCValue = 0;
+ }
+ sqlite3DbFree(p->db, pCache);
+ sqlite3VdbeFreeCursorNN(p, pCx);
+}
+SQLITE_PRIVATE void sqlite3VdbeFreeCursorNN(Vdbe *p, VdbeCursor *pCx){
+ if( pCx->colCache ){
+ freeCursorWithCache(p, pCx);
+ return;
+ }
+ switch( pCx->eCurType ){
+ case CURTYPE_SORTER: {
+ sqlite3VdbeSorterClose(p->db, pCx);
+ break;
+ }
+ case CURTYPE_BTREE: {
+ assert( pCx->uc.pCursor!=0 );
+ sqlite3BtreeCloseCursor(pCx->uc.pCursor);
+ break;
+ }
+#ifndef SQLITE_OMIT_VIRTUALTABLE
+ case CURTYPE_VTAB: {
+ sqlite3_vtab_cursor *pVCur = pCx->uc.pVCur;
+ const sqlite3_module *pModule = pVCur->pVtab->pModule;
+ assert( pVCur->pVtab->nRef>0 );
+ pVCur->pVtab->nRef--;
+ pModule->xClose(pVCur);
+ break;
+ }
+#endif
+ }
+}
+
+/*
+** Close all cursors in the current frame.
+*/
+static void closeCursorsInFrame(Vdbe *p){
+ int i;
+ for(i=0; i<p->nCursor; i++){
+ VdbeCursor *pC = p->apCsr[i];
+ if( pC ){
+ sqlite3VdbeFreeCursorNN(p, pC);
+ p->apCsr[i] = 0;
+ }
+ }
+}
+
+/*
+** Copy the values stored in the VdbeFrame structure to its Vdbe. This
+** is used, for example, when a trigger sub-program is halted to restore
+** control to the main program.
+*/
+SQLITE_PRIVATE int sqlite3VdbeFrameRestore(VdbeFrame *pFrame){
+ Vdbe *v = pFrame->v;
+ closeCursorsInFrame(v);
+ v->aOp = pFrame->aOp;
+ v->nOp = pFrame->nOp;
+ v->aMem = pFrame->aMem;
+ v->nMem = pFrame->nMem;
+ v->apCsr = pFrame->apCsr;
+ v->nCursor = pFrame->nCursor;
+ v->db->lastRowid = pFrame->lastRowid;
+ v->nChange = pFrame->nChange;
+ v->db->nChange = pFrame->nDbChange;
+ sqlite3VdbeDeleteAuxData(v->db, &v->pAuxData, -1, 0);
+ v->pAuxData = pFrame->pAuxData;
+ pFrame->pAuxData = 0;
+ return pFrame->pc;
+}
+
+/*
+** Close all cursors.
+**
+** Also release any dynamic memory held by the VM in the Vdbe.aMem memory
+** cell array. This is necessary as the memory cell array may contain
+** pointers to VdbeFrame objects, which may in turn contain pointers to
+** open cursors.
+*/
+static void closeAllCursors(Vdbe *p){
+ if( p->pFrame ){
+ VdbeFrame *pFrame;
+ for(pFrame=p->pFrame; pFrame->pParent; pFrame=pFrame->pParent);
+ sqlite3VdbeFrameRestore(pFrame);
+ p->pFrame = 0;
+ p->nFrame = 0;
+ }
+ assert( p->nFrame==0 );
+ closeCursorsInFrame(p);
+ releaseMemArray(p->aMem, p->nMem);
+ while( p->pDelFrame ){
+ VdbeFrame *pDel = p->pDelFrame;
+ p->pDelFrame = pDel->pParent;
+ sqlite3VdbeFrameDelete(pDel);
+ }
+
+ /* Delete any auxdata allocations made by the VM */
+ if( p->pAuxData ) sqlite3VdbeDeleteAuxData(p->db, &p->pAuxData, -1, 0);
+ assert( p->pAuxData==0 );
+}
+
+/*
+** Set the number of result columns that will be returned by this SQL
+** statement. This is now set at compile time, rather than during
+** execution of the vdbe program so that sqlite3_column_count() can
+** be called on an SQL statement before sqlite3_step().
+*/
+SQLITE_PRIVATE void sqlite3VdbeSetNumCols(Vdbe *p, int nResColumn){
+ int n;
+ sqlite3 *db = p->db;
+
+ if( p->nResAlloc ){
+ releaseMemArray(p->aColName, p->nResAlloc*COLNAME_N);
+ sqlite3DbFree(db, p->aColName);
+ }
+ n = nResColumn*COLNAME_N;
+ p->nResColumn = p->nResAlloc = (u16)nResColumn;
+ p->aColName = (Mem*)sqlite3DbMallocRawNN(db, sizeof(Mem)*n );
+ if( p->aColName==0 ) return;
+ initMemArray(p->aColName, n, db, MEM_Null);
+}
+
+/*
+** Set the name of the idx'th column to be returned by the SQL statement.
+** zName must be a pointer to a nul terminated string.
+**
+** This call must be made after a call to sqlite3VdbeSetNumCols().
+**
+** The final parameter, xDel, must be one of SQLITE_DYNAMIC, SQLITE_STATIC
+** or SQLITE_TRANSIENT. If it is SQLITE_DYNAMIC, then the buffer pointed
+** to by zName will be freed by sqlite3DbFree() when the vdbe is destroyed.
+*/
+SQLITE_PRIVATE int sqlite3VdbeSetColName(
+ Vdbe *p, /* Vdbe being configured */
+ int idx, /* Index of column zName applies to */
+ int var, /* One of the COLNAME_* constants */
+ const char *zName, /* Pointer to buffer containing name */
+ void (*xDel)(void*) /* Memory management strategy for zName */
+){
+ int rc;
+ Mem *pColName;
+ assert( idx<p->nResAlloc );
+ assert( var<COLNAME_N );
+ if( p->db->mallocFailed ){
+ assert( !zName || xDel!=SQLITE_DYNAMIC );
+ return SQLITE_NOMEM_BKPT;
+ }
+ assert( p->aColName!=0 );
+ pColName = &(p->aColName[idx+var*p->nResAlloc]);
+ rc = sqlite3VdbeMemSetStr(pColName, zName, -1, SQLITE_UTF8, xDel);
+ assert( rc!=0 || !zName || (pColName->flags&MEM_Term)!=0 );
+ return rc;
+}
+
+/*
+** A read or write transaction may or may not be active on database handle
+** db. If a transaction is active, commit it. If there is a
+** write-transaction spanning more than one database file, this routine
+** takes care of the super-journal trickery.
+*/
+static int vdbeCommit(sqlite3 *db, Vdbe *p){
+ int i;
+ int nTrans = 0; /* Number of databases with an active write-transaction
+ ** that are candidates for a two-phase commit using a
+ ** super-journal */
+ int rc = SQLITE_OK;
+ int needXcommit = 0;
+
+#ifdef SQLITE_OMIT_VIRTUALTABLE
+ /* With this option, sqlite3VtabSync() is defined to be simply
+ ** SQLITE_OK so p is not used.
+ */
+ UNUSED_PARAMETER(p);
+#endif
+
+ /* Before doing anything else, call the xSync() callback for any
+ ** virtual module tables written in this transaction. This has to
+ ** be done before determining whether a super-journal file is
+ ** required, as an xSync() callback may add an attached database
+ ** to the transaction.
+ */
+ rc = sqlite3VtabSync(db, p);
+
+ /* This loop determines (a) if the commit hook should be invoked and
+ ** (b) how many database files have open write transactions, not
+ ** including the temp database. (b) is important because if more than
+ ** one database file has an open write transaction, a super-journal
+ ** file is required for an atomic commit.
+ */
+ for(i=0; rc==SQLITE_OK && i<db->nDb; i++){
+ Btree *pBt = db->aDb[i].pBt;
+ if( sqlite3BtreeTxnState(pBt)==SQLITE_TXN_WRITE ){
+ /* Whether or not a database might need a super-journal depends upon
+ ** its journal mode (among other things). This matrix determines which
+ ** journal modes use a super-journal and which do not */
+ static const u8 aMJNeeded[] = {
+ /* DELETE */ 1,
+ /* PERSIST */ 1,
+ /* OFF */ 0,
+ /* TRUNCATE */ 1,
+ /* MEMORY */ 0,
+ /* WAL */ 0
+ };
+ Pager *pPager; /* Pager associated with pBt */
+ needXcommit = 1;
+ sqlite3BtreeEnter(pBt);
+ pPager = sqlite3BtreePager(pBt);
+ if( db->aDb[i].safety_level!=PAGER_SYNCHRONOUS_OFF
+ && aMJNeeded[sqlite3PagerGetJournalMode(pPager)]
+ && sqlite3PagerIsMemdb(pPager)==0
+ ){
+ assert( i!=1 );
+ nTrans++;
+ }
+ rc = sqlite3PagerExclusiveLock(pPager);
+ sqlite3BtreeLeave(pBt);
+ }
+ }
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+
+ /* If there are any write-transactions at all, invoke the commit hook */
+ if( needXcommit && db->xCommitCallback ){
+ rc = db->xCommitCallback(db->pCommitArg);
+ if( rc ){
+ return SQLITE_CONSTRAINT_COMMITHOOK;
+ }
+ }
+
+ /* The simple case - no more than one database file (not counting the
+ ** TEMP database) has a transaction active. There is no need for the
+ ** super-journal.
+ **
+ ** If the return value of sqlite3BtreeGetFilename() is a zero length
+ ** string, it means the main database is :memory: or a temp file. In
+ ** that case we do not support atomic multi-file commits, so use the
+ ** simple case then too.
+ */
+ if( 0==sqlite3Strlen30(sqlite3BtreeGetFilename(db->aDb[0].pBt))
+ || nTrans<=1
+ ){
+ for(i=0; rc==SQLITE_OK && i<db->nDb; i++){
+ Btree *pBt = db->aDb[i].pBt;
+ if( pBt ){
+ rc = sqlite3BtreeCommitPhaseOne(pBt, 0);
+ }
+ }
+
+ /* Do the commit only if all databases successfully complete phase 1.
+ ** If one of the BtreeCommitPhaseOne() calls fails, this indicates an
+ ** IO error while deleting or truncating a journal file. It is unlikely,
+ ** but could happen. In this case abandon processing and return the error.
+ */
+ for(i=0; rc==SQLITE_OK && i<db->nDb; i++){
+ Btree *pBt = db->aDb[i].pBt;
+ if( pBt ){
+ rc = sqlite3BtreeCommitPhaseTwo(pBt, 0);
+ }
+ }
+ if( rc==SQLITE_OK ){
+ sqlite3VtabCommit(db);
+ }
+ }
+
+ /* The complex case - There is a multi-file write-transaction active.
+ ** This requires a super-journal file to ensure the transaction is
+ ** committed atomically.
+ */
+#ifndef SQLITE_OMIT_DISKIO
+ else{
+ sqlite3_vfs *pVfs = db->pVfs;
+ char *zSuper = 0; /* File-name for the super-journal */
+ char const *zMainFile = sqlite3BtreeGetFilename(db->aDb[0].pBt);
+ sqlite3_file *pSuperJrnl = 0;
+ i64 offset = 0;
+ int res;
+ int retryCount = 0;
+ int nMainFile;
+
+ /* Select a super-journal file name */
+ nMainFile = sqlite3Strlen30(zMainFile);
+ zSuper = sqlite3MPrintf(db, "%.4c%s%.16c", 0,zMainFile,0);
+ if( zSuper==0 ) return SQLITE_NOMEM_BKPT;
+ zSuper += 4;
+ do {
+ u32 iRandom;
+ if( retryCount ){
+ if( retryCount>100 ){
+ sqlite3_log(SQLITE_FULL, "MJ delete: %s", zSuper);
+ sqlite3OsDelete(pVfs, zSuper, 0);
+ break;
+ }else if( retryCount==1 ){
+ sqlite3_log(SQLITE_FULL, "MJ collide: %s", zSuper);
+ }
+ }
+ retryCount++;
+ sqlite3_randomness(sizeof(iRandom), &iRandom);
+ sqlite3_snprintf(13, &zSuper[nMainFile], "-mj%06X9%02X",
+ (iRandom>>8)&0xffffff, iRandom&0xff);
+ /* The antipenultimate character of the super-journal name must
+ ** be "9" to avoid name collisions when using 8+3 filenames. */
+ assert( zSuper[sqlite3Strlen30(zSuper)-3]=='9' );
+ sqlite3FileSuffix3(zMainFile, zSuper);
+ rc = sqlite3OsAccess(pVfs, zSuper, SQLITE_ACCESS_EXISTS, &res);
+ }while( rc==SQLITE_OK && res );
+ if( rc==SQLITE_OK ){
+ /* Open the super-journal. */
+ rc = sqlite3OsOpenMalloc(pVfs, zSuper, &pSuperJrnl,
+ SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|
+ SQLITE_OPEN_EXCLUSIVE|SQLITE_OPEN_SUPER_JOURNAL, 0
+ );
+ }
+ if( rc!=SQLITE_OK ){
+ sqlite3DbFree(db, zSuper-4);
+ return rc;
+ }
+
+ /* Write the name of each database file in the transaction into the new
+ ** super-journal file. If an error occurs at this point close
+ ** and delete the super-journal file. All the individual journal files
+ ** still have 'null' as the super-journal pointer, so they will roll
+ ** back independently if a failure occurs.
+ */
+ for(i=0; i<db->nDb; i++){
+ Btree *pBt = db->aDb[i].pBt;
+ if( sqlite3BtreeTxnState(pBt)==SQLITE_TXN_WRITE ){
+ char const *zFile = sqlite3BtreeGetJournalname(pBt);
+ if( zFile==0 ){
+ continue; /* Ignore TEMP and :memory: databases */
+ }
+ assert( zFile[0]!=0 );
+ rc = sqlite3OsWrite(pSuperJrnl, zFile, sqlite3Strlen30(zFile)+1,offset);
+ offset += sqlite3Strlen30(zFile)+1;
+ if( rc!=SQLITE_OK ){
+ sqlite3OsCloseFree(pSuperJrnl);
+ sqlite3OsDelete(pVfs, zSuper, 0);
+ sqlite3DbFree(db, zSuper-4);
+ return rc;
+ }
+ }
+ }
+
+ /* Sync the super-journal file. If the IOCAP_SEQUENTIAL device
+ ** flag is set this is not required.
+ */
+ if( 0==(sqlite3OsDeviceCharacteristics(pSuperJrnl)&SQLITE_IOCAP_SEQUENTIAL)
+ && SQLITE_OK!=(rc = sqlite3OsSync(pSuperJrnl, SQLITE_SYNC_NORMAL))
+ ){
+ sqlite3OsCloseFree(pSuperJrnl);
+ sqlite3OsDelete(pVfs, zSuper, 0);
+ sqlite3DbFree(db, zSuper-4);
+ return rc;
+ }
+
+ /* Sync all the db files involved in the transaction. The same call
+ ** sets the super-journal pointer in each individual journal. If
+ ** an error occurs here, do not delete the super-journal file.
+ **
+ ** If the error occurs during the first call to
+ ** sqlite3BtreeCommitPhaseOne(), then there is a chance that the
+ ** super-journal file will be orphaned. But we cannot delete it,
+ ** in case the super-journal file name was written into the journal
+ ** file before the failure occurred.
+ */
+ for(i=0; rc==SQLITE_OK && i<db->nDb; i++){
+ Btree *pBt = db->aDb[i].pBt;
+ if( pBt ){
+ rc = sqlite3BtreeCommitPhaseOne(pBt, zSuper);
+ }
+ }
+ sqlite3OsCloseFree(pSuperJrnl);
+ assert( rc!=SQLITE_BUSY );
+ if( rc!=SQLITE_OK ){
+ sqlite3DbFree(db, zSuper-4);
+ return rc;
+ }
+
+ /* Delete the super-journal file. This commits the transaction. After
+ ** doing this the directory is synced again before any individual
+ ** transaction files are deleted.
+ */
+ rc = sqlite3OsDelete(pVfs, zSuper, 1);
+ sqlite3DbFree(db, zSuper-4);
+ zSuper = 0;
+ if( rc ){
+ return rc;
+ }
+
+ /* All files and directories have already been synced, so the following
+ ** calls to sqlite3BtreeCommitPhaseTwo() are only closing files and
+ ** deleting or truncating journals. If something goes wrong while
+ ** this is happening we don't really care. The integrity of the
+ ** transaction is already guaranteed, but some stray 'cold' journals
+ ** may be lying around. Returning an error code won't help matters.
+ */
+ disable_simulated_io_errors();
+ sqlite3BeginBenignMalloc();
+ for(i=0; i<db->nDb; i++){
+ Btree *pBt = db->aDb[i].pBt;
+ if( pBt ){
+ sqlite3BtreeCommitPhaseTwo(pBt, 1);
+ }
+ }
+ sqlite3EndBenignMalloc();
+ enable_simulated_io_errors();
+
+ sqlite3VtabCommit(db);
+ }
+#endif
+
+ return rc;
+}
+
+/*
+** This routine checks that the sqlite3.nVdbeActive count variable
+** matches the number of vdbe's in the list sqlite3.pVdbe that are
+** currently active. An assertion fails if the two counts do not match.
+** This is an internal self-check only - it is not an essential processing
+** step.
+**
+** This is a no-op if NDEBUG is defined.
+*/
+#ifndef NDEBUG
+static void checkActiveVdbeCnt(sqlite3 *db){
+ Vdbe *p;
+ int cnt = 0;
+ int nWrite = 0;
+ int nRead = 0;
+ p = db->pVdbe;
+ while( p ){
+ if( sqlite3_stmt_busy((sqlite3_stmt*)p) ){
+ cnt++;
+ if( p->readOnly==0 ) nWrite++;
+ if( p->bIsReader ) nRead++;
+ }
+ p = p->pVNext;
+ }
+ assert( cnt==db->nVdbeActive );
+ assert( nWrite==db->nVdbeWrite );
+ assert( nRead==db->nVdbeRead );
+}
+#else
+#define checkActiveVdbeCnt(x)
+#endif
+
+/*
+** If the Vdbe passed as the first argument opened a statement-transaction,
+** close it now. Argument eOp must be either SAVEPOINT_ROLLBACK or
+** SAVEPOINT_RELEASE. If it is SAVEPOINT_ROLLBACK, then the statement
+** transaction is rolled back. If eOp is SAVEPOINT_RELEASE, then the
+** statement transaction is committed.
+**
+** If an IO error occurs, an SQLITE_IOERR_XXX error code is returned.
+** Otherwise SQLITE_OK.
+*/
+static SQLITE_NOINLINE int vdbeCloseStatement(Vdbe *p, int eOp){
+ sqlite3 *const db = p->db;
+ int rc = SQLITE_OK;
+ int i;
+ const int iSavepoint = p->iStatement-1;
+
+ assert( eOp==SAVEPOINT_ROLLBACK || eOp==SAVEPOINT_RELEASE);
+ assert( db->nStatement>0 );
+ assert( p->iStatement==(db->nStatement+db->nSavepoint) );
+
+ for(i=0; i<db->nDb; i++){
+ int rc2 = SQLITE_OK;
+ Btree *pBt = db->aDb[i].pBt;
+ if( pBt ){
+ if( eOp==SAVEPOINT_ROLLBACK ){
+ rc2 = sqlite3BtreeSavepoint(pBt, SAVEPOINT_ROLLBACK, iSavepoint);
+ }
+ if( rc2==SQLITE_OK ){
+ rc2 = sqlite3BtreeSavepoint(pBt, SAVEPOINT_RELEASE, iSavepoint);
+ }
+ if( rc==SQLITE_OK ){
+ rc = rc2;
+ }
+ }
+ }
+ db->nStatement--;
+ p->iStatement = 0;
+
+ if( rc==SQLITE_OK ){
+ if( eOp==SAVEPOINT_ROLLBACK ){
+ rc = sqlite3VtabSavepoint(db, SAVEPOINT_ROLLBACK, iSavepoint);
+ }
+ if( rc==SQLITE_OK ){
+ rc = sqlite3VtabSavepoint(db, SAVEPOINT_RELEASE, iSavepoint);
+ }
+ }
+
+ /* If the statement transaction is being rolled back, also restore the
+ ** database handles deferred constraint counter to the value it had when
+ ** the statement transaction was opened. */
+ if( eOp==SAVEPOINT_ROLLBACK ){
+ db->nDeferredCons = p->nStmtDefCons;
+ db->nDeferredImmCons = p->nStmtDefImmCons;
+ }
+ return rc;
+}
+SQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *p, int eOp){
+ if( p->db->nStatement && p->iStatement ){
+ return vdbeCloseStatement(p, eOp);
+ }
+ return SQLITE_OK;
+}
+
+
+/*
+** This function is called when a transaction opened by the database
+** handle associated with the VM passed as an argument is about to be
+** committed. If there are outstanding deferred foreign key constraint
+** violations, return SQLITE_ERROR. Otherwise, SQLITE_OK.
+**
+** If there are outstanding FK violations and this function returns
+** SQLITE_ERROR, set the result of the VM to SQLITE_CONSTRAINT_FOREIGNKEY
+** and write an error message to it. Then return SQLITE_ERROR.
+*/
+#ifndef SQLITE_OMIT_FOREIGN_KEY
+SQLITE_PRIVATE int sqlite3VdbeCheckFk(Vdbe *p, int deferred){
+ sqlite3 *db = p->db;
+ if( (deferred && (db->nDeferredCons+db->nDeferredImmCons)>0)
+ || (!deferred && p->nFkConstraint>0)
+ ){
+ p->rc = SQLITE_CONSTRAINT_FOREIGNKEY;
+ p->errorAction = OE_Abort;
+ sqlite3VdbeError(p, "FOREIGN KEY constraint failed");
+ if( (p->prepFlags & SQLITE_PREPARE_SAVESQL)==0 ) return SQLITE_ERROR;
+ return SQLITE_CONSTRAINT_FOREIGNKEY;
+ }
+ return SQLITE_OK;
+}
+#endif
+
+/*
+** This routine is called the when a VDBE tries to halt. If the VDBE
+** has made changes and is in autocommit mode, then commit those
+** changes. If a rollback is needed, then do the rollback.
+**
+** This routine is the only way to move the sqlite3eOpenState of a VM from
+** SQLITE_STATE_RUN to SQLITE_STATE_HALT. It is harmless to
+** call this on a VM that is in the SQLITE_STATE_HALT state.
+**
+** Return an error code. If the commit could not complete because of
+** lock contention, return SQLITE_BUSY. If SQLITE_BUSY is returned, it
+** means the close did not happen and needs to be repeated.
+*/
+SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){
+ int rc; /* Used to store transient return codes */
+ sqlite3 *db = p->db;
+
+ /* This function contains the logic that determines if a statement or
+ ** transaction will be committed or rolled back as a result of the
+ ** execution of this virtual machine.
+ **
+ ** If any of the following errors occur:
+ **
+ ** SQLITE_NOMEM
+ ** SQLITE_IOERR
+ ** SQLITE_FULL
+ ** SQLITE_INTERRUPT
+ **
+ ** Then the internal cache might have been left in an inconsistent
+ ** state. We need to rollback the statement transaction, if there is
+ ** one, or the complete transaction if there is no statement transaction.
+ */
+
+ assert( p->eVdbeState==VDBE_RUN_STATE );
+ if( db->mallocFailed ){
+ p->rc = SQLITE_NOMEM_BKPT;
+ }
+ closeAllCursors(p);
+ checkActiveVdbeCnt(db);
+
+ /* No commit or rollback needed if the program never started or if the
+ ** SQL statement does not read or write a database file. */
+ if( p->bIsReader ){
+ int mrc; /* Primary error code from p->rc */
+ int eStatementOp = 0;
+ int isSpecialError; /* Set to true if a 'special' error */
+
+ /* Lock all btrees used by the statement */
+ sqlite3VdbeEnter(p);
+
+ /* Check for one of the special errors */
+ if( p->rc ){
+ mrc = p->rc & 0xff;
+ isSpecialError = mrc==SQLITE_NOMEM
+ || mrc==SQLITE_IOERR
+ || mrc==SQLITE_INTERRUPT
+ || mrc==SQLITE_FULL;
+ }else{
+ mrc = isSpecialError = 0;
+ }
+ if( isSpecialError ){
+ /* If the query was read-only and the error code is SQLITE_INTERRUPT,
+ ** no rollback is necessary. Otherwise, at least a savepoint
+ ** transaction must be rolled back to restore the database to a
+ ** consistent state.
+ **
+ ** Even if the statement is read-only, it is important to perform
+ ** a statement or transaction rollback operation. If the error
+ ** occurred while writing to the journal, sub-journal or database
+ ** file as part of an effort to free up cache space (see function
+ ** pagerStress() in pager.c), the rollback is required to restore
+ ** the pager to a consistent state.
+ */
+ if( !p->readOnly || mrc!=SQLITE_INTERRUPT ){
+ if( (mrc==SQLITE_NOMEM || mrc==SQLITE_FULL) && p->usesStmtJournal ){
+ eStatementOp = SAVEPOINT_ROLLBACK;
+ }else{
+ /* We are forced to roll back the active transaction. Before doing
+ ** so, abort any other statements this handle currently has active.
+ */
+ sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK);
+ sqlite3CloseSavepoints(db);
+ db->autoCommit = 1;
+ p->nChange = 0;
+ }
+ }
+ }
+
+ /* Check for immediate foreign key violations. */
+ if( p->rc==SQLITE_OK || (p->errorAction==OE_Fail && !isSpecialError) ){
+ (void)sqlite3VdbeCheckFk(p, 0);
+ }
+
+ /* If the auto-commit flag is set and this is the only active writer
+ ** VM, then we do either a commit or rollback of the current transaction.
+ **
+ ** Note: This block also runs if one of the special errors handled
+ ** above has occurred.
+ */
+ if( !sqlite3VtabInSync(db)
+ && db->autoCommit
+ && db->nVdbeWrite==(p->readOnly==0)
+ ){
+ if( p->rc==SQLITE_OK || (p->errorAction==OE_Fail && !isSpecialError) ){
+ rc = sqlite3VdbeCheckFk(p, 1);
+ if( rc!=SQLITE_OK ){
+ if( NEVER(p->readOnly) ){
+ sqlite3VdbeLeave(p);
+ return SQLITE_ERROR;
+ }
+ rc = SQLITE_CONSTRAINT_FOREIGNKEY;
+ }else if( db->flags & SQLITE_CorruptRdOnly ){
+ rc = SQLITE_CORRUPT;
+ db->flags &= ~SQLITE_CorruptRdOnly;
+ }else{
+ /* The auto-commit flag is true, the vdbe program was successful
+ ** or hit an 'OR FAIL' constraint and there are no deferred foreign
+ ** key constraints to hold up the transaction. This means a commit
+ ** is required. */
+ rc = vdbeCommit(db, p);
+ }
+ if( rc==SQLITE_BUSY && p->readOnly ){
+ sqlite3VdbeLeave(p);
+ return SQLITE_BUSY;
+ }else if( rc!=SQLITE_OK ){
+ sqlite3SystemError(db, rc);
+ p->rc = rc;
+ sqlite3RollbackAll(db, SQLITE_OK);
+ p->nChange = 0;
+ }else{
+ db->nDeferredCons = 0;
+ db->nDeferredImmCons = 0;
+ db->flags &= ~(u64)SQLITE_DeferFKs;
+ sqlite3CommitInternalChanges(db);
+ }
+ }else if( p->rc==SQLITE_SCHEMA && db->nVdbeActive>1 ){
+ p->nChange = 0;
+ }else{
+ sqlite3RollbackAll(db, SQLITE_OK);
+ p->nChange = 0;
+ }
+ db->nStatement = 0;
+ }else if( eStatementOp==0 ){
+ if( p->rc==SQLITE_OK || p->errorAction==OE_Fail ){
+ eStatementOp = SAVEPOINT_RELEASE;
+ }else if( p->errorAction==OE_Abort ){
+ eStatementOp = SAVEPOINT_ROLLBACK;
+ }else{
+ sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK);
+ sqlite3CloseSavepoints(db);
+ db->autoCommit = 1;
+ p->nChange = 0;
+ }
+ }
+
+ /* If eStatementOp is non-zero, then a statement transaction needs to
+ ** be committed or rolled back. Call sqlite3VdbeCloseStatement() to
+ ** do so. If this operation returns an error, and the current statement
+ ** error code is SQLITE_OK or SQLITE_CONSTRAINT, then promote the
+ ** current statement error code.
+ */
+ if( eStatementOp ){
+ rc = sqlite3VdbeCloseStatement(p, eStatementOp);
+ if( rc ){
+ if( p->rc==SQLITE_OK || (p->rc&0xff)==SQLITE_CONSTRAINT ){
+ p->rc = rc;
+ sqlite3DbFree(db, p->zErrMsg);
+ p->zErrMsg = 0;
+ }
+ sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK);
+ sqlite3CloseSavepoints(db);
+ db->autoCommit = 1;
+ p->nChange = 0;
+ }
+ }
+
+ /* If this was an INSERT, UPDATE or DELETE and no statement transaction
+ ** has been rolled back, update the database connection change-counter.
+ */
+ if( p->changeCntOn ){
+ if( eStatementOp!=SAVEPOINT_ROLLBACK ){
+ sqlite3VdbeSetChanges(db, p->nChange);
+ }else{
+ sqlite3VdbeSetChanges(db, 0);
+ }
+ p->nChange = 0;
+ }
+
+ /* Release the locks */
+ sqlite3VdbeLeave(p);
+ }
+
+ /* We have successfully halted and closed the VM. Record this fact. */
+ db->nVdbeActive--;
+ if( !p->readOnly ) db->nVdbeWrite--;
+ if( p->bIsReader ) db->nVdbeRead--;
+ assert( db->nVdbeActive>=db->nVdbeRead );
+ assert( db->nVdbeRead>=db->nVdbeWrite );
+ assert( db->nVdbeWrite>=0 );
+ p->eVdbeState = VDBE_HALT_STATE;
+ checkActiveVdbeCnt(db);
+ if( db->mallocFailed ){
+ p->rc = SQLITE_NOMEM_BKPT;
+ }
+
+ /* If the auto-commit flag is set to true, then any locks that were held
+ ** by connection db have now been released. Call sqlite3ConnectionUnlocked()
+ ** to invoke any required unlock-notify callbacks.
+ */
+ if( db->autoCommit ){
+ sqlite3ConnectionUnlocked(db);
+ }
+
+ assert( db->nVdbeActive>0 || db->autoCommit==0 || db->nStatement==0 );
+ return (p->rc==SQLITE_BUSY ? SQLITE_BUSY : SQLITE_OK);
+}
+
+
+/*
+** Each VDBE holds the result of the most recent sqlite3_step() call
+** in p->rc. This routine sets that result back to SQLITE_OK.
+*/
+SQLITE_PRIVATE void sqlite3VdbeResetStepResult(Vdbe *p){
+ p->rc = SQLITE_OK;
+}
+
+/*
+** Copy the error code and error message belonging to the VDBE passed
+** as the first argument to its database handle (so that they will be
+** returned by calls to sqlite3_errcode() and sqlite3_errmsg()).
+**
+** This function does not clear the VDBE error code or message, just
+** copies them to the database handle.
+*/
+SQLITE_PRIVATE int sqlite3VdbeTransferError(Vdbe *p){
+ sqlite3 *db = p->db;
+ int rc = p->rc;
+ if( p->zErrMsg ){
+ db->bBenignMalloc++;
+ sqlite3BeginBenignMalloc();
+ if( db->pErr==0 ) db->pErr = sqlite3ValueNew(db);
+ sqlite3ValueSetStr(db->pErr, -1, p->zErrMsg, SQLITE_UTF8, SQLITE_TRANSIENT);
+ sqlite3EndBenignMalloc();
+ db->bBenignMalloc--;
+ }else if( db->pErr ){
+ sqlite3ValueSetNull(db->pErr);
+ }
+ db->errCode = rc;
+ db->errByteOffset = -1;
+ return rc;
+}
+
+#ifdef SQLITE_ENABLE_SQLLOG
+/*
+** If an SQLITE_CONFIG_SQLLOG hook is registered and the VM has been run,
+** invoke it.
+*/
+static void vdbeInvokeSqllog(Vdbe *v){
+ if( sqlite3GlobalConfig.xSqllog && v->rc==SQLITE_OK && v->zSql && v->pc>=0 ){
+ char *zExpanded = sqlite3VdbeExpandSql(v, v->zSql);
+ assert( v->db->init.busy==0 );
+ if( zExpanded ){
+ sqlite3GlobalConfig.xSqllog(
+ sqlite3GlobalConfig.pSqllogArg, v->db, zExpanded, 1
+ );
+ sqlite3DbFree(v->db, zExpanded);
+ }
+ }
+}
+#else
+# define vdbeInvokeSqllog(x)
+#endif
+
+/*
+** Clean up a VDBE after execution but do not delete the VDBE just yet.
+** Write any error messages into *pzErrMsg. Return the result code.
+**
+** After this routine is run, the VDBE should be ready to be executed
+** again.
+**
+** To look at it another way, this routine resets the state of the
+** virtual machine from VDBE_RUN_STATE or VDBE_HALT_STATE back to
+** VDBE_READY_STATE.
+*/
+SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe *p){
+#if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)
+ int i;
+#endif
+
+ sqlite3 *db;
+ db = p->db;
+
+ /* If the VM did not run to completion or if it encountered an
+ ** error, then it might not have been halted properly. So halt
+ ** it now.
+ */
+ if( p->eVdbeState==VDBE_RUN_STATE ) sqlite3VdbeHalt(p);
+
+ /* If the VDBE has been run even partially, then transfer the error code
+ ** and error message from the VDBE into the main database structure. But
+ ** if the VDBE has just been set to run but has not actually executed any
+ ** instructions yet, leave the main database error information unchanged.
+ */
+ if( p->pc>=0 ){
+ vdbeInvokeSqllog(p);
+ if( db->pErr || p->zErrMsg ){
+ sqlite3VdbeTransferError(p);
+ }else{
+ db->errCode = p->rc;
+ }
+ }
+
+ /* Reset register contents and reclaim error message memory.
+ */
+#ifdef SQLITE_DEBUG
+ /* Execute assert() statements to ensure that the Vdbe.apCsr[] and
+ ** Vdbe.aMem[] arrays have already been cleaned up. */
+ if( p->apCsr ) for(i=0; i<p->nCursor; i++) assert( p->apCsr[i]==0 );
+ if( p->aMem ){
+ for(i=0; i<p->nMem; i++) assert( p->aMem[i].flags==MEM_Undefined );
+ }
+#endif
+ if( p->zErrMsg ){
+ sqlite3DbFree(db, p->zErrMsg);
+ p->zErrMsg = 0;
+ }
+ p->pResultRow = 0;
+#ifdef SQLITE_DEBUG
+ p->nWrite = 0;
+#endif
+
+ /* Save profiling information from this VDBE run.
+ */
+#ifdef VDBE_PROFILE
+ {
+ FILE *out = fopen("vdbe_profile.out", "a");
+ if( out ){
+ fprintf(out, "---- ");
+ for(i=0; i<p->nOp; i++){
+ fprintf(out, "%02x", p->aOp[i].opcode);
+ }
+ fprintf(out, "\n");
+ if( p->zSql ){
+ char c, pc = 0;
+ fprintf(out, "-- ");
+ for(i=0; (c = p->zSql[i])!=0; i++){
+ if( pc=='\n' ) fprintf(out, "-- ");
+ putc(c, out);
+ pc = c;
+ }
+ if( pc!='\n' ) fprintf(out, "\n");
+ }
+ for(i=0; i<p->nOp; i++){
+ char zHdr[100];
+ i64 cnt = p->aOp[i].nExec;
+ i64 cycles = p->aOp[i].nCycle;
+ sqlite3_snprintf(sizeof(zHdr), zHdr, "%6u %12llu %8llu ",
+ cnt,
+ cycles,
+ cnt>0 ? cycles/cnt : 0
+ );
+ fprintf(out, "%s", zHdr);
+ sqlite3VdbePrintOp(out, i, &p->aOp[i]);
+ }
+ fclose(out);
+ }
+ }
+#endif
+ return p->rc & db->errMask;
+}
+
+/*
+** Clean up and delete a VDBE after execution. Return an integer which is
+** the result code. Write any error message text into *pzErrMsg.
+*/
+SQLITE_PRIVATE int sqlite3VdbeFinalize(Vdbe *p){
+ int rc = SQLITE_OK;
+ assert( VDBE_RUN_STATE>VDBE_READY_STATE );
+ assert( VDBE_HALT_STATE>VDBE_READY_STATE );
+ assert( VDBE_INIT_STATE<VDBE_READY_STATE );
+ if( p->eVdbeState>=VDBE_READY_STATE ){
+ rc = sqlite3VdbeReset(p);
+ assert( (rc & p->db->